[U-Boot] [PATCH v3 0/5] board: atmel: Convert to support video driver model

Convert the boards to support the driver model of LCD/video via enabling CONFIG_DM_VIDEO, remove CONFIG_LCD and the unnecessary code.
Changes in v3: - Collect the Reviewed-by tags.
Changes in v2: - Rebase the u-boot/master (5541543f686). - Drop the applied patches. - Improve the commit log.
Wenyou Yang (5): board: sama5d2_xplained: Convert to CONFIG_DM_VIDEO board: sama5d3xek: Convert to CONFIG_DM_VIDEO board: sama5d4ek: Convert to CONFIG_DM_VIDEO board: sama5d4_xplained: Convert to CONFIG_DM_VIDEO board: at91sam9x5ek: Convert to CONFIG_DM_VIDEO
arch/arm/dts/at91-sama5d2_xplained.dts | 60 +++++++++++++ arch/arm/dts/at91-sama5d4_xplained.dts | 25 ++++++ arch/arm/dts/at91-sama5d4ek.dts | 26 ++++++ arch/arm/dts/sama5d2.dtsi | 7 ++ arch/arm/dts/sama5d36ek_cmp.dts | 1 + arch/arm/dts/sama5d3_lcd.dtsi | 21 +---- arch/arm/dts/sama5d3xdm.dtsi | 26 ++++++ arch/arm/dts/sama5d4.dtsi | 21 +---- arch/arm/mach-at91/Kconfig | 4 + board/atmel/at91sam9x5ek/at91sam9x5ek.c | 111 ++---------------------- board/atmel/common/video_display.c | 2 +- board/atmel/sama5d2_xplained/sama5d2_xplained.c | 95 ++------------------ board/atmel/sama5d3xek/sama5d3xek.c | 83 +----------------- board/atmel/sama5d4_xplained/sama5d4_xplained.c | 102 ++-------------------- board/atmel/sama5d4ek/sama5d4ek.c | 97 ++------------------- configs/at91sam9x5ek_dataflash_defconfig | 3 +- configs/at91sam9x5ek_mmc_defconfig | 3 +- configs/at91sam9x5ek_nandflash_defconfig | 3 +- configs/at91sam9x5ek_spiflash_defconfig | 3 +- configs/sama5d2_xplained_mmc_defconfig | 2 + configs/sama5d2_xplained_spiflash_defconfig | 2 + configs/sama5d36ek_cmp_mmc_defconfig | 3 +- configs/sama5d36ek_cmp_nandflash_defconfig | 3 +- configs/sama5d36ek_cmp_spiflash_defconfig | 3 +- configs/sama5d3xek_mmc_defconfig | 3 +- configs/sama5d3xek_nandflash_defconfig | 3 +- configs/sama5d3xek_spiflash_defconfig | 3 +- configs/sama5d4_xplained_mmc_defconfig | 2 + configs/sama5d4_xplained_nandflash_defconfig | 2 + configs/sama5d4_xplained_spiflash_defconfig | 2 + configs/sama5d4ek_mmc_defconfig | 3 +- configs/sama5d4ek_nandflash_defconfig | 3 +- configs/sama5d4ek_spiflash_defconfig | 3 +- include/configs/at91sam9x5ek.h | 10 --- include/configs/sama5d2_xplained.h | 12 --- include/configs/sama5d3xek.h | 9 -- include/configs/sama5d4_xplained.h | 11 --- include/configs/sama5d4ek.h | 9 -- 38 files changed, 217 insertions(+), 564 deletions(-)

Convert the board to support the video driver model, add the device tree node, and remove the unnecessary code.
Signed-off-by: Wenyou Yang wenyou.yang@microchip.com Reviewed-by: Simon Glass sjg@chromium.org ---
Changes in v3: None Changes in v2: None
arch/arm/dts/at91-sama5d2_xplained.dts | 60 ++++++++++++++++ arch/arm/dts/sama5d2.dtsi | 7 ++ arch/arm/mach-at91/Kconfig | 1 + board/atmel/sama5d2_xplained/sama5d2_xplained.c | 95 ++----------------------- configs/sama5d2_xplained_mmc_defconfig | 2 + configs/sama5d2_xplained_spiflash_defconfig | 2 + include/configs/sama5d2_xplained.h | 12 ---- 7 files changed, 79 insertions(+), 100 deletions(-)
diff --git a/arch/arm/dts/at91-sama5d2_xplained.dts b/arch/arm/dts/at91-sama5d2_xplained.dts index b00aaa2c79..01326a1ee0 100644 --- a/arch/arm/dts/at91-sama5d2_xplained.dts +++ b/arch/arm/dts/at91-sama5d2_xplained.dts @@ -41,6 +41,31 @@ };
apb { + hlcdc: hlcdc@f0000000 { + atmel,vl-bpix = <4>; + atmel,guard-time = <1>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_lcd_base &pinctrl_lcd_pwm &pinctrl_lcd_rgb666>; + status = "okay"; + u-boot,dm-pre-reloc; + + display-timings { + u-boot,dm-pre-reloc; + 480x272 { + clock-frequency = <9000000>; + hactive = <480>; + vactive = <272>; + hsync-len = <41>; + hfront-porch = <2>; + hback-porch = <2>; + vfront-porch = <2>; + vback-porch = <2>; + vsync-len = <11>; + u-boot,dm-pre-reloc; + }; + }; + }; + qspi0: spi@f0020000 { status = "okay";
@@ -117,6 +142,41 @@ bias-disable; };
+ pinctrl_lcd_base: pinctrl_lcd_base { + pinmux = <PIN_PC30__LCDVSYNC>, + <PIN_PC31__LCDHSYNC>, + <PIN_PD1__LCDDEN>, + <PIN_PD0__LCDPCK>; + bias-disable; + }; + + pinctrl_lcd_pwm: pinctrl_lcd_pwm { + pinmux = <PIN_PC28__LCDPWM>; + bias-disable; + }; + + pinctrl_lcd_rgb666: pinctrl_lcd_rgb666 { + pinmux = <PIN_PC10__LCDDAT2>, + <PIN_PC11__LCDDAT3>, + <PIN_PC12__LCDDAT4>, + <PIN_PC13__LCDDAT5>, + <PIN_PC14__LCDDAT6>, + <PIN_PC15__LCDDAT7>, + <PIN_PC16__LCDDAT10>, + <PIN_PC17__LCDDAT11>, + <PIN_PC18__LCDDAT12>, + <PIN_PC19__LCDDAT13>, + <PIN_PC20__LCDDAT14>, + <PIN_PC21__LCDDAT15>, + <PIN_PC22__LCDDAT18>, + <PIN_PC23__LCDDAT19>, + <PIN_PC24__LCDDAT20>, + <PIN_PC25__LCDDAT21>, + <PIN_PC26__LCDDAT22>, + <PIN_PC27__LCDDAT23>; + bias-disable; + }; + pinctrl_macb0_phy_irq: macb0_phy_irq { pinmux = <PIN_PC9__GPIO>; bias-disable; diff --git a/arch/arm/dts/sama5d2.dtsi b/arch/arm/dts/sama5d2.dtsi index b02a602378..7520446dc1 100644 --- a/arch/arm/dts/sama5d2.dtsi +++ b/arch/arm/dts/sama5d2.dtsi @@ -69,6 +69,13 @@ #size-cells = <1>; u-boot,dm-pre-reloc;
+ hlcdc: hlcdc@f0000000 { + compatible = "atmel,at91sam9x5-hlcdc"; + reg = <0xf0000000 0x2000>; + clocks = <&lcdc_clk>; + status = "disabled"; + }; + pmc: pmc@f0014000 { compatible = "atmel,sama5d2-pmc", "syscon"; reg = <0xf0014000 0x160>; diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig index 0e71b69a19..abc79d9637 100644 --- a/arch/arm/mach-at91/Kconfig +++ b/arch/arm/mach-at91/Kconfig @@ -153,6 +153,7 @@ config TARGET_SAMA5D2_XPLAINED select SAMA5D2 select SUPPORT_SPL select BOARD_EARLY_INIT_F + select BOARD_LATE_INIT
config TARGET_SAMA5D27_SOM1_EK bool "SAMA5D27 SOM1 EK board" diff --git a/board/atmel/sama5d2_xplained/sama5d2_xplained.c b/board/atmel/sama5d2_xplained/sama5d2_xplained.c index 5758653030..778142ac71 100644 --- a/board/atmel/sama5d2_xplained/sama5d2_xplained.c +++ b/board/atmel/sama5d2_xplained/sama5d2_xplained.c @@ -6,10 +6,7 @@ */
#include <common.h> -#include <atmel_hlcdc.h> #include <debug_uart.h> -#include <lcd.h> -#include <version.h> #include <asm/io.h> #include <asm/arch/at91_common.h> #include <asm/arch/atmel_pio4.h> @@ -26,90 +23,15 @@ static void board_usb_hw_init(void) atmel_pio4_set_pio_output(AT91_PIO_PORTB, 10, 1); }
-#ifdef CONFIG_LCD -vidinfo_t panel_info = { - .vl_col = 480, - .vl_row = 272, - .vl_clk = 9000000, - .vl_bpix = LCD_BPP, - .vl_tft = 1, - .vl_hsync_len = 41, - .vl_left_margin = 2, - .vl_right_margin = 2, - .vl_vsync_len = 11, - .vl_upper_margin = 2, - .vl_lower_margin = 2, - .mmio = ATMEL_BASE_LCDC, -}; - -/* No power up/down pin for the LCD pannel */ -void lcd_enable(void) { /* Empty! */ } -void lcd_disable(void) { /* Empty! */ } - -unsigned int has_lcdc(void) +#ifdef CONFIG_BOARD_LATE_INIT +int board_late_init(void) { - return 1; -} - -static void board_lcd_hw_init(void) -{ - atmel_pio4_set_a_periph(AT91_PIO_PORTC, 28, 0); /* LCDPWM */ - atmel_pio4_set_a_periph(AT91_PIO_PORTC, 29, 0); /* LCDDISP */ - atmel_pio4_set_a_periph(AT91_PIO_PORTC, 30, 0); /* LCDVSYNC */ - atmel_pio4_set_a_periph(AT91_PIO_PORTC, 31, 0); /* LCDHSYNC */ - atmel_pio4_set_a_periph(AT91_PIO_PORTD, 0, 0); /* LCDPCK */ - atmel_pio4_set_a_periph(AT91_PIO_PORTD, 1, 0); /* LCDDEN */ - - /* LCDDAT0 */ - /* LCDDAT1 */ - atmel_pio4_set_a_periph(AT91_PIO_PORTC, 10, 0); /* LCDDAT2 */ - atmel_pio4_set_a_periph(AT91_PIO_PORTC, 11, 0); /* LCDDAT3 */ - atmel_pio4_set_a_periph(AT91_PIO_PORTC, 12, 0); /* LCDDAT4 */ - atmel_pio4_set_a_periph(AT91_PIO_PORTC, 13, 0); /* LCDDAT5 */ - atmel_pio4_set_a_periph(AT91_PIO_PORTC, 14, 0); /* LCDDAT6 */ - atmel_pio4_set_a_periph(AT91_PIO_PORTC, 15, 0); /* LCDDAT7 */ - - /* LCDDAT8 */ - /* LCDDAT9 */ - atmel_pio4_set_a_periph(AT91_PIO_PORTC, 16, 0); /* LCDDAT10 */ - atmel_pio4_set_a_periph(AT91_PIO_PORTC, 17, 0); /* LCDDAT11 */ - atmel_pio4_set_a_periph(AT91_PIO_PORTC, 18, 0); /* LCDDAT12 */ - atmel_pio4_set_a_periph(AT91_PIO_PORTC, 19, 0); /* LCDDAT13 */ - atmel_pio4_set_a_periph(AT91_PIO_PORTC, 20, 0); /* LCDDAT14 */ - atmel_pio4_set_a_periph(AT91_PIO_PORTC, 21, 0); /* LCDDAT15 */ - - /* LCDD16 */ - /* LCDD17 */ - atmel_pio4_set_a_periph(AT91_PIO_PORTC, 22, 0); /* LCDDAT18 */ - atmel_pio4_set_a_periph(AT91_PIO_PORTC, 23, 0); /* LCDDAT19 */ - atmel_pio4_set_a_periph(AT91_PIO_PORTC, 24, 0); /* LCDDAT20 */ - atmel_pio4_set_a_periph(AT91_PIO_PORTC, 25, 0); /* LCDDAT21 */ - atmel_pio4_set_a_periph(AT91_PIO_PORTC, 26, 0); /* LCDDAT22 */ - atmel_pio4_set_a_periph(AT91_PIO_PORTC, 27, 0); /* LCDDAT23 */ - - at91_periph_clk_enable(ATMEL_ID_LCDC); -} - -#ifdef CONFIG_LCD_INFO -void lcd_show_board_info(void) -{ - ulong dram_size; - int i; - char temp[32]; - - lcd_printf("%s\n", U_BOOT_VERSION); - lcd_printf("2015 ATMEL Corp\n"); - lcd_printf("%s CPU at %s MHz\n", get_cpu_name(), - strmhz(temp, get_cpu_clk_rate())); - - dram_size = 0; - for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) - dram_size += gd->bd->bi_dram[i].size; - - lcd_printf("%ld MB SDRAM\n", dram_size >> 20); +#ifdef CONFIG_DM_VIDEO + at91_video_show_board_info(); +#endif + return 0; } -#endif /* CONFIG_LCD_INFO */ -#endif /* CONFIG_LCD */ +#endif
#ifdef CONFIG_DEBUG_UART_BOARD_INIT static void board_uart1_hw_init(void) @@ -142,9 +64,6 @@ int board_init(void) /* address of boot parameters */ gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
-#ifdef CONFIG_LCD - board_lcd_hw_init(); -#endif #ifdef CONFIG_CMD_USB board_usb_hw_init(); #endif diff --git a/configs/sama5d2_xplained_mmc_defconfig b/configs/sama5d2_xplained_mmc_defconfig index 215961a65c..87fc049b6d 100644 --- a/configs/sama5d2_xplained_mmc_defconfig +++ b/configs/sama5d2_xplained_mmc_defconfig @@ -82,3 +82,5 @@ CONFIG_USB_EHCI_HCD=y CONFIG_USB_STORAGE=y CONFIG_USB_GADGET=y CONFIG_USB_GADGET_ATMEL_USBA=y +CONFIG_DM_VIDEO=y +CONFIG_ATMEL_HLCD=y diff --git a/configs/sama5d2_xplained_spiflash_defconfig b/configs/sama5d2_xplained_spiflash_defconfig index 869d405838..37572489e2 100644 --- a/configs/sama5d2_xplained_spiflash_defconfig +++ b/configs/sama5d2_xplained_spiflash_defconfig @@ -79,3 +79,5 @@ CONFIG_USB_EHCI_HCD=y CONFIG_USB_STORAGE=y CONFIG_USB_GADGET=y CONFIG_USB_GADGET_ATMEL_USBA=y +CONFIG_DM_VIDEO=y +CONFIG_ATMEL_HLCD=y diff --git a/include/configs/sama5d2_xplained.h b/include/configs/sama5d2_xplained.h index 4f24a56899..545ba1740d 100644 --- a/include/configs/sama5d2_xplained.h +++ b/include/configs/sama5d2_xplained.h @@ -35,18 +35,6 @@ #define CONFIG_SF_DEFAULT_SPEED 30000000 #endif
-/* LCD */ - -#ifdef CONFIG_LCD -#define LCD_BPP LCD_COLOR16 -#define LCD_OUTPUT_BPP 24 -#define CONFIG_LCD_LOGO -#define CONFIG_LCD_INFO -#define CONFIG_LCD_INFO_BELOW_LOGO -#define CONFIG_ATMEL_HLCD -#define CONFIG_ATMEL_LCD_RGB565 -#endif - #ifdef CONFIG_SD_BOOT
/* bootstrap + u-boot + env in sd card */

From: Wenyou Yang wenyou.yang@atmel.com
Convert the board to support the video driver model, add the device tree node, and remove the unnecessary code.
Signed-off-by: Wenyou Yang wenyou.yang@microchip.com Reviewed-by: Simon Glass sjg@chromium.org ---
Changes in v3: None Changes in v2: None
arch/arm/dts/sama5d36ek_cmp.dts | 1 + arch/arm/dts/sama5d3_lcd.dtsi | 21 +------- arch/arm/dts/sama5d3xdm.dtsi | 26 ++++++++++ board/atmel/sama5d3xek/sama5d3xek.c | 83 ++---------------------------- configs/sama5d36ek_cmp_mmc_defconfig | 3 +- configs/sama5d36ek_cmp_nandflash_defconfig | 3 +- configs/sama5d36ek_cmp_spiflash_defconfig | 3 +- configs/sama5d3xek_mmc_defconfig | 3 +- configs/sama5d3xek_nandflash_defconfig | 3 +- configs/sama5d3xek_spiflash_defconfig | 3 +- include/configs/sama5d3xek.h | 9 ---- 11 files changed, 43 insertions(+), 115 deletions(-)
diff --git a/arch/arm/dts/sama5d36ek_cmp.dts b/arch/arm/dts/sama5d36ek_cmp.dts index be41490f63..c17bc9f0dc 100644 --- a/arch/arm/dts/sama5d36ek_cmp.dts +++ b/arch/arm/dts/sama5d36ek_cmp.dts @@ -8,6 +8,7 @@ /dts-v1/; #include "sama5d36.dtsi" #include "sama5d3xmb_cmp.dtsi" +#include "sama5d3xdm.dtsi"
/ { model = "Atmel SAMA5D36-EK"; diff --git a/arch/arm/dts/sama5d3_lcd.dtsi b/arch/arm/dts/sama5d3_lcd.dtsi index 14d7c2bc75..10fb3a97ea 100644 --- a/arch/arm/dts/sama5d3_lcd.dtsi +++ b/arch/arm/dts/sama5d3_lcd.dtsi @@ -14,31 +14,12 @@ ahb { apb { hlcdc: hlcdc@f0030000 { - compatible = "atmel,sama5d3-hlcdc"; + compatible = "atmel,at91sam9x5-hlcdc"; reg = <0xf0030000 0x2000>; interrupts = <36 IRQ_TYPE_LEVEL_HIGH 0>; clocks = <&lcdc_clk>, <&lcdck>, <&clk32k>; clock-names = "periph_clk","sys_clk", "slow_clk"; status = "disabled"; - - hlcdc-display-controller { - compatible = "atmel,hlcdc-display-controller"; - #address-cells = <1>; - #size-cells = <0>; - - port@0 { - #address-cells = <1>; - #size-cells = <0>; - reg = <0>; - }; - }; - - hlcdc_pwm: hlcdc-pwm { - compatible = "atmel,hlcdc-pwm"; - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_lcd_pwm>; - #pwm-cells = <3>; - }; };
pinctrl@fffff200 { diff --git a/arch/arm/dts/sama5d3xdm.dtsi b/arch/arm/dts/sama5d3xdm.dtsi index 035ab72b39..b3df9af2b4 100644 --- a/arch/arm/dts/sama5d3xdm.dtsi +++ b/arch/arm/dts/sama5d3xdm.dtsi @@ -10,6 +10,32 @@ / { ahb { apb { + hlcdc: hlcdc@f0030000 { + atmel,vl-bpix = <4>; + atmel,output-mode = <24>; + atmel,guard-time = <1>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_lcd_base &pinctrl_lcd_pwm &pinctrl_lcd_rgb888_alt>; + status = "okay"; + u-boot,dm-pre-reloc; + + display-timings { + u-boot,dm-pre-reloc; + 800x480 { + clock-frequency = <24000000>; + hactive = <800>; + vactive = <480>; + hsync-len = <5>; + hfront-porch = <64>; + hback-porch = <64>; + vfront-porch = <22>; + vback-porch = <21>; + vsync-len = <5>; + u-boot,dm-pre-reloc; + }; + }; + }; + i2c1: i2c@f0018000 { qt1070: keyboard@1b { compatible = "qt1070"; diff --git a/board/atmel/sama5d3xek/sama5d3xek.c b/board/atmel/sama5d3xek/sama5d3xek.c index 6d473fc06d..98d846fd79 100644 --- a/board/atmel/sama5d3xek/sama5d3xek.c +++ b/board/atmel/sama5d3xek/sama5d3xek.c @@ -13,9 +13,7 @@ #include <asm/arch/gpio.h> #include <asm/arch/clk.h> #include <debug_uart.h> -#include <lcd.h> #include <linux/ctype.h> -#include <atmel_hlcdc.h> #include <phy.h> #include <micrel.h> #include <spl.h> @@ -132,80 +130,6 @@ static void sama5d3xek_mci_hw_init(void) } #endif
-#ifdef CONFIG_LCD -vidinfo_t panel_info = { - .vl_col = 800, - .vl_row = 480, - .vl_clk = 24000000, - .vl_bpix = LCD_BPP, - .vl_tft = 1, - .vl_hsync_len = 128, - .vl_left_margin = 64, - .vl_right_margin = 64, - .vl_vsync_len = 2, - .vl_upper_margin = 22, - .vl_lower_margin = 21, - .mmio = ATMEL_BASE_LCDC, -}; - -void lcd_enable(void) -{ -} - -void lcd_disable(void) -{ -} - -static void sama5d3xek_lcd_hw_init(void) -{ - gd->fb_base = CONFIG_SAMA5D3_LCD_BASE; - - /* The higher 8 bit of LCD is board related */ - at91_pio3_set_c_periph(AT91_PIO_PORTC, 14, 0); /* LCDD16 */ - at91_pio3_set_c_periph(AT91_PIO_PORTC, 13, 0); /* LCDD17 */ - at91_pio3_set_c_periph(AT91_PIO_PORTC, 12, 0); /* LCDD18 */ - at91_pio3_set_c_periph(AT91_PIO_PORTC, 11, 0); /* LCDD19 */ - at91_pio3_set_c_periph(AT91_PIO_PORTC, 10, 0); /* LCDD20 */ - at91_pio3_set_c_periph(AT91_PIO_PORTC, 15, 0); /* LCDD21 */ - at91_pio3_set_c_periph(AT91_PIO_PORTE, 27, 0); /* LCDD22 */ - at91_pio3_set_c_periph(AT91_PIO_PORTE, 28, 0); /* LCDD23 */ - - /* Configure lower 16 bit of LCD and enable clock */ - at91_lcd_hw_init(); -} - -#ifdef CONFIG_LCD_INFO -#include <nand.h> -#include <version.h> - -void lcd_show_board_info(void) -{ - ulong dram_size; - uint64_t nand_size; - int i; - char temp[32]; - - lcd_printf("%s\n", U_BOOT_VERSION); - lcd_printf("(C) 2013 ATMEL Corp\n"); - lcd_printf("at91@atmel.com\n"); - lcd_printf("%s CPU at %s MHz\n", get_cpu_name(), - strmhz(temp, get_cpu_clk_rate())); - - dram_size = 0; - for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) - dram_size += gd->bd->bi_dram[i].size; - - nand_size = 0; -#ifdef CONFIG_NAND_ATMEL - for (i = 0; i < CONFIG_SYS_MAX_NAND_DEVICE; i++) - nand_size += get_nand_dev_by_index(i)->size; -#endif - lcd_printf("%ld MB SDRAM, %lld MB NAND\n", - dram_size >> 20, nand_size >> 20); -} -#endif /* CONFIG_LCD_INFO */ -#endif /* CONFIG_LCD */ - #ifdef CONFIG_DEBUG_UART_BOARD_INIT void board_debug_uart_init(void) { @@ -240,10 +164,6 @@ int board_init(void) #ifdef CONFIG_GENERIC_ATMEL_MCI sama5d3xek_mci_hw_init(); #endif -#ifdef CONFIG_LCD - if (has_lcdc()) - sama5d3xek_lcd_hw_init(); -#endif return 0; }
@@ -269,6 +189,9 @@ int board_late_init(void) strcat(name, "ek.dtb"); env_set("dtb_name", name); #endif +#ifdef CONFIG_DM_VIDEO + at91_video_show_board_info(); +#endif return 0; } #endif diff --git a/configs/sama5d36ek_cmp_mmc_defconfig b/configs/sama5d36ek_cmp_mmc_defconfig index b6c60cbcae..7c27812c3f 100644 --- a/configs/sama5d36ek_cmp_mmc_defconfig +++ b/configs/sama5d36ek_cmp_mmc_defconfig @@ -55,4 +55,5 @@ CONFIG_DM_SPI=y CONFIG_ATMEL_SPI=y CONFIG_TIMER=y CONFIG_ATMEL_PIT_TIMER=y -CONFIG_LCD=y +CONFIG_DM_VIDEO=y +CONFIG_ATMEL_HLCD=y diff --git a/configs/sama5d36ek_cmp_nandflash_defconfig b/configs/sama5d36ek_cmp_nandflash_defconfig index 01b57efe03..09508dafa4 100644 --- a/configs/sama5d36ek_cmp_nandflash_defconfig +++ b/configs/sama5d36ek_cmp_nandflash_defconfig @@ -55,5 +55,6 @@ CONFIG_DM_SPI=y CONFIG_ATMEL_SPI=y CONFIG_TIMER=y CONFIG_ATMEL_PIT_TIMER=y -CONFIG_LCD=y CONFIG_FAT_WRITE=y +CONFIG_DM_VIDEO=y +CONFIG_ATMEL_HLCD=y diff --git a/configs/sama5d36ek_cmp_spiflash_defconfig b/configs/sama5d36ek_cmp_spiflash_defconfig index e29e3a8098..1c004ef2ac 100644 --- a/configs/sama5d36ek_cmp_spiflash_defconfig +++ b/configs/sama5d36ek_cmp_spiflash_defconfig @@ -55,5 +55,6 @@ CONFIG_DM_SPI=y CONFIG_ATMEL_SPI=y CONFIG_TIMER=y CONFIG_ATMEL_PIT_TIMER=y -CONFIG_LCD=y +CONFIG_DM_VIDEO=y +CONFIG_ATMEL_HLCD=y CONFIG_FAT_WRITE=y diff --git a/configs/sama5d3xek_mmc_defconfig b/configs/sama5d3xek_mmc_defconfig index f45449fd93..8b4c37a125 100644 --- a/configs/sama5d3xek_mmc_defconfig +++ b/configs/sama5d3xek_mmc_defconfig @@ -81,4 +81,5 @@ CONFIG_USB_EHCI_HCD=y CONFIG_USB_STORAGE=y CONFIG_USB_GADGET=y CONFIG_USB_GADGET_ATMEL_USBA=y -CONFIG_LCD=y +CONFIG_DM_VIDEO=y +CONFIG_ATMEL_HLCD=y diff --git a/configs/sama5d3xek_nandflash_defconfig b/configs/sama5d3xek_nandflash_defconfig index 6217600f01..f9d4b8db3a 100644 --- a/configs/sama5d3xek_nandflash_defconfig +++ b/configs/sama5d3xek_nandflash_defconfig @@ -76,5 +76,6 @@ CONFIG_USB_EHCI_HCD=y CONFIG_USB_STORAGE=y CONFIG_USB_GADGET=y CONFIG_USB_GADGET_ATMEL_USBA=y -CONFIG_LCD=y +CONFIG_DM_VIDEO=y +CONFIG_ATMEL_HLCD=y CONFIG_FAT_WRITE=y diff --git a/configs/sama5d3xek_spiflash_defconfig b/configs/sama5d3xek_spiflash_defconfig index 2fe08e4e59..7399b3e51f 100644 --- a/configs/sama5d3xek_spiflash_defconfig +++ b/configs/sama5d3xek_spiflash_defconfig @@ -77,5 +77,6 @@ CONFIG_USB_EHCI_HCD=y CONFIG_USB_STORAGE=y CONFIG_USB_GADGET=y CONFIG_USB_GADGET_ATMEL_USBA=y -CONFIG_LCD=y +CONFIG_DM_VIDEO=y +CONFIG_ATMEL_HLCD=y CONFIG_FAT_WRITE=y diff --git a/include/configs/sama5d3xek.h b/include/configs/sama5d3xek.h index bd93a1e84c..9ec1e76052 100644 --- a/include/configs/sama5d3xek.h +++ b/include/configs/sama5d3xek.h @@ -28,15 +28,6 @@ */ #define ATMEL_PMC_UHP (1 << 6)
-/* LCD */ -#define LCD_BPP LCD_COLOR16 -#define LCD_OUTPUT_BPP 24 -#define CONFIG_LCD_LOGO -#define CONFIG_LCD_INFO -#define CONFIG_LCD_INFO_BELOW_LOGO -#define CONFIG_ATMEL_HLCD -#define CONFIG_ATMEL_LCD_RGB565 - /* board specific (not enough SRAM) */ #define CONFIG_SAMA5D3_LCD_BASE 0x23E00000

From: Wenyou Yang wenyou.yang@atmel.com
Convert the board to support the video driver model, add the device tree node, and remove the unnecessary code.
Signed-off-by: Wenyou Yang wenyou.yang@microchip.com Reviewed-by: Simon Glass sjg@chromium.org ---
Changes in v3: None Changes in v2: None
arch/arm/dts/at91-sama5d4ek.dts | 26 ++++++++++ arch/arm/mach-at91/Kconfig | 1 + board/atmel/sama5d4ek/sama5d4ek.c | 97 +++-------------------------------- configs/sama5d4ek_mmc_defconfig | 3 +- configs/sama5d4ek_nandflash_defconfig | 3 +- configs/sama5d4ek_spiflash_defconfig | 3 +- include/configs/sama5d4ek.h | 9 ---- 7 files changed, 39 insertions(+), 103 deletions(-)
diff --git a/arch/arm/dts/at91-sama5d4ek.dts b/arch/arm/dts/at91-sama5d4ek.dts index b965f5b39d..a5d75452cf 100644 --- a/arch/arm/dts/at91-sama5d4ek.dts +++ b/arch/arm/dts/at91-sama5d4ek.dts @@ -75,6 +75,32 @@
ahb { apb { + hlcdc: hlcdc@f0000000 { + atmel,vl-bpix = <4>; + atmel,output-mode = <18>; + atmel,guard-time = <1>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_lcd_base &pinctrl_lcd_pwm &pinctrl_lcd_rgb666>; + status = "okay"; + u-boot,dm-pre-reloc; + + display-timings { + u-boot,dm-pre-reloc; + 800x480 { + clock-frequency = <33260000>; + hactive = <800>; + vactive = <480>; + hsync-len = <5>; + hfront-porch = <128>; + hback-porch = <0>; + vfront-porch = <23>; + vback-porch = <22>; + vsync-len = <5>; + u-boot,dm-pre-reloc; + }; + }; + }; + adc0: adc@fc034000 { pinctrl-names = "default"; pinctrl-0 = < diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig index abc79d9637..b4967f9203 100644 --- a/arch/arm/mach-at91/Kconfig +++ b/arch/arm/mach-at91/Kconfig @@ -192,6 +192,7 @@ config TARGET_SAMA5D4EK select SAMA5D4 select SUPPORT_SPL select BOARD_EARLY_INIT_F + select BOARD_LATE_INIT
config TARGET_MA5D4EVK bool "Aries MA5D4EVK Evaluation Kit" diff --git a/board/atmel/sama5d4ek/sama5d4ek.c b/board/atmel/sama5d4ek/sama5d4ek.c index ee07038e2e..48c43f0163 100644 --- a/board/atmel/sama5d4ek/sama5d4ek.c +++ b/board/atmel/sama5d4ek/sama5d4ek.c @@ -14,11 +14,7 @@ #include <asm/arch/clk.h> #include <asm/arch/sama5d3_smc.h> #include <asm/arch/sama5d4.h> -#include <atmel_hlcdc.h> #include <debug_uart.h> -#include <lcd.h> -#include <nand.h> -#include <version.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -74,93 +70,15 @@ static void sama5d4ek_usb_hw_init(void) } #endif
-#ifdef CONFIG_LCD -vidinfo_t panel_info = { - .vl_col = 800, - .vl_row = 480, - .vl_clk = 33260000, - .vl_bpix = LCD_BPP, - .vl_tft = 1, - .vl_hsync_len = 5, - .vl_left_margin = 128, - .vl_right_margin = 0, - .vl_vsync_len = 5, - .vl_upper_margin = 23, - .vl_lower_margin = 22, - .mmio = ATMEL_BASE_LCDC, -}; - -/* No power up/down pin for the LCD pannel */ -void lcd_enable(void) { /* Empty! */ } -void lcd_disable(void) { /* Empty! */ } - -unsigned int has_lcdc(void) +#ifdef CONFIG_BOARD_LATE_INIT +int board_late_init(void) { - return 1; -} - -static void sama5d4ek_lcd_hw_init(void) -{ - at91_pio3_set_a_periph(AT91_PIO_PORTA, 24, 0); /* LCDPWM */ - at91_pio3_set_a_periph(AT91_PIO_PORTA, 25, 0); /* LCDDISP */ - at91_pio3_set_a_periph(AT91_PIO_PORTA, 26, 0); /* LCDVSYNC */ - at91_pio3_set_a_periph(AT91_PIO_PORTA, 27, 0); /* LCDHSYNC */ - at91_pio3_set_a_periph(AT91_PIO_PORTA, 28, 0); /* LCDDOTCK */ - at91_pio3_set_a_periph(AT91_PIO_PORTA, 29, 0); /* LCDDEN */ - - at91_pio3_set_a_periph(AT91_PIO_PORTA, 2, 0); /* LCDD2 */ - at91_pio3_set_a_periph(AT91_PIO_PORTA, 3, 0); /* LCDD3 */ - at91_pio3_set_a_periph(AT91_PIO_PORTA, 4, 0); /* LCDD4 */ - at91_pio3_set_a_periph(AT91_PIO_PORTA, 5, 0); /* LCDD5 */ - at91_pio3_set_a_periph(AT91_PIO_PORTA, 6, 0); /* LCDD6 */ - at91_pio3_set_a_periph(AT91_PIO_PORTA, 7, 0); /* LCDD7 */ - - at91_pio3_set_a_periph(AT91_PIO_PORTA, 10, 0); /* LCDD10 */ - at91_pio3_set_a_periph(AT91_PIO_PORTA, 11, 0); /* LCDD11 */ - at91_pio3_set_a_periph(AT91_PIO_PORTA, 12, 0); /* LCDD12 */ - at91_pio3_set_a_periph(AT91_PIO_PORTA, 13, 0); /* LCDD13 */ - at91_pio3_set_a_periph(AT91_PIO_PORTA, 14, 0); /* LCDD14 */ - at91_pio3_set_a_periph(AT91_PIO_PORTA, 15, 0); /* LCDD15 */ - - at91_pio3_set_a_periph(AT91_PIO_PORTA, 18, 0); /* LCDD18 */ - at91_pio3_set_a_periph(AT91_PIO_PORTA, 19, 0); /* LCDD19 */ - at91_pio3_set_a_periph(AT91_PIO_PORTA, 20, 0); /* LCDD20 */ - at91_pio3_set_a_periph(AT91_PIO_PORTA, 21, 0); /* LCDD21 */ - at91_pio3_set_a_periph(AT91_PIO_PORTA, 22, 0); /* LCDD22 */ - at91_pio3_set_a_periph(AT91_PIO_PORTA, 23, 0); /* LCDD23 */ - - /* Enable clock */ - at91_periph_clk_enable(ATMEL_ID_LCDC); -} - -#ifdef CONFIG_LCD_INFO -void lcd_show_board_info(void) -{ - ulong dram_size, nand_size; - int i; - char temp[32]; - - lcd_printf("%s\n", U_BOOT_VERSION); - lcd_printf("2014 ATMEL Corp\n"); - lcd_printf("at91@atmel.com\n"); - lcd_printf("%s CPU at %s MHz\n", get_cpu_name(), - strmhz(temp, get_cpu_clk_rate())); - - dram_size = 0; - for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) - dram_size += gd->bd->bi_dram[i].size; - - nand_size = 0; -#ifdef CONFIG_NAND_ATMEL - for (i = 0; i < CONFIG_SYS_MAX_NAND_DEVICE; i++) - nand_size += get_nand_dev_by_index(i)->size; +#ifdef CONFIG_DM_VIDEO + at91_video_show_board_info(); #endif - lcd_printf("%ld MB SDRAM, %ld MB NAND\n", - dram_size >> 20, nand_size >> 20); + return 0; } -#endif /* CONFIG_LCD_INFO */ - -#endif /* CONFIG_LCD */ +#endif
#ifdef CONFIG_DEBUG_UART_BOARD_INIT static void sama5d4ek_serial3_hw_init(void) @@ -196,9 +114,6 @@ int board_init(void) #ifdef CONFIG_NAND_ATMEL sama5d4ek_nand_hw_init(); #endif -#ifdef CONFIG_LCD - sama5d4ek_lcd_hw_init(); -#endif #ifdef CONFIG_CMD_USB sama5d4ek_usb_hw_init(); #endif diff --git a/configs/sama5d4ek_mmc_defconfig b/configs/sama5d4ek_mmc_defconfig index aaa5855b22..7367b6cb7a 100644 --- a/configs/sama5d4ek_mmc_defconfig +++ b/configs/sama5d4ek_mmc_defconfig @@ -78,4 +78,5 @@ CONFIG_USB_EHCI_HCD=y CONFIG_USB_STORAGE=y CONFIG_USB_GADGET=y CONFIG_USB_GADGET_ATMEL_USBA=y -CONFIG_LCD=y +CONFIG_DM_VIDEO=y +CONFIG_ATMEL_HLCD=y diff --git a/configs/sama5d4ek_nandflash_defconfig b/configs/sama5d4ek_nandflash_defconfig index 901d17bfa3..94970c6e7f 100644 --- a/configs/sama5d4ek_nandflash_defconfig +++ b/configs/sama5d4ek_nandflash_defconfig @@ -75,4 +75,5 @@ CONFIG_USB_EHCI_HCD=y CONFIG_USB_STORAGE=y CONFIG_USB_GADGET=y CONFIG_USB_GADGET_ATMEL_USBA=y -CONFIG_LCD=y +CONFIG_DM_VIDEO=y +CONFIG_ATMEL_HLCD=y diff --git a/configs/sama5d4ek_spiflash_defconfig b/configs/sama5d4ek_spiflash_defconfig index 535031024b..160ed127bd 100644 --- a/configs/sama5d4ek_spiflash_defconfig +++ b/configs/sama5d4ek_spiflash_defconfig @@ -74,4 +74,5 @@ CONFIG_USB_EHCI_HCD=y CONFIG_USB_STORAGE=y CONFIG_USB_GADGET=y CONFIG_USB_GADGET_ATMEL_USBA=y -CONFIG_LCD=y +CONFIG_DM_VIDEO=y +CONFIG_ATMEL_HLCD=y diff --git a/include/configs/sama5d4ek.h b/include/configs/sama5d4ek.h index 94e8e893c0..a46e3508bf 100644 --- a/include/configs/sama5d4ek.h +++ b/include/configs/sama5d4ek.h @@ -45,15 +45,6 @@ #define CONFIG_ATMEL_NAND_HW_PMECC #endif
-/* LCD */ -#define LCD_BPP LCD_COLOR16 -#define LCD_OUTPUT_BPP 18 -#define CONFIG_LCD_LOGO -#define CONFIG_LCD_INFO -#define CONFIG_LCD_INFO_BELOW_LOGO -#define CONFIG_ATMEL_HLCD -#define CONFIG_ATMEL_LCD_RGB565 - /* SPL */ #define CONFIG_SPL_FRAMEWORK #define CONFIG_SPL_TEXT_BASE 0x200000

From: Wenyou Yang wenyou.yang@atmel.com
Convert the board to support the video driver model, add the device tree node, and remove the unnecessary code.
Signed-off-by: Wenyou Yang wenyou.yang@microchip.com Reviewed-by: Simon Glass sjg@chromium.org ---
Changes in v3: None Changes in v2: None
arch/arm/dts/at91-sama5d4_xplained.dts | 25 ++++++ arch/arm/dts/sama5d4.dtsi | 21 +---- arch/arm/mach-at91/Kconfig | 1 + board/atmel/common/video_display.c | 2 +- board/atmel/sama5d4_xplained/sama5d4_xplained.c | 102 ++---------------------- configs/sama5d4_xplained_mmc_defconfig | 2 + configs/sama5d4_xplained_nandflash_defconfig | 2 + configs/sama5d4_xplained_spiflash_defconfig | 2 + include/configs/sama5d4_xplained.h | 11 --- 9 files changed, 40 insertions(+), 128 deletions(-)
diff --git a/arch/arm/dts/at91-sama5d4_xplained.dts b/arch/arm/dts/at91-sama5d4_xplained.dts index 0592b31b91..ea35dc21b6 100644 --- a/arch/arm/dts/at91-sama5d4_xplained.dts +++ b/arch/arm/dts/at91-sama5d4_xplained.dts @@ -74,6 +74,31 @@
ahb { apb { + hlcdc: hlcdc@f0000000 { + atmel,vl-bpix = <4>; + atmel,guard-time = <1>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_lcd_base &pinctrl_lcd_pwm &pinctrl_lcd_rgb888>; + status = "okay"; + u-boot,dm-pre-reloc; + + display-timings { + u-boot,dm-pre-reloc; + 480x272 { + clock-frequency = <9000000>; + hactive = <480>; + vactive = <272>; + hsync-len = <41>; + hfront-porch = <2>; + hback-porch = <2>; + vfront-porch = <2>; + vback-porch = <2>; + vsync-len = <11>; + u-boot,dm-pre-reloc; + }; + }; + }; + spi0: spi@f8010000 { u-boot,dm-pre-reloc; cs-gpios = <&pioC 3 0>, <0>, <0>, <0>; diff --git a/arch/arm/dts/sama5d4.dtsi b/arch/arm/dts/sama5d4.dtsi index c6512ae437..8072b8a4f2 100644 --- a/arch/arm/dts/sama5d4.dtsi +++ b/arch/arm/dts/sama5d4.dtsi @@ -320,31 +320,12 @@ u-boot,dm-pre-reloc;
hlcdc: hlcdc@f0000000 { - compatible = "atmel,sama5d4-hlcdc"; + compatible = "atmel,at91sam9x5-hlcdc"; reg = <0xf0000000 0x4000>; interrupts = <51 IRQ_TYPE_LEVEL_HIGH 0>; clocks = <&lcdc_clk>, <&lcdck>, <&clk32k>; clock-names = "periph_clk","sys_clk", "slow_clk"; status = "disabled"; - - hlcdc-display-controller { - compatible = "atmel,hlcdc-display-controller"; - #address-cells = <1>; - #size-cells = <0>; - - port@0 { - #address-cells = <1>; - #size-cells = <0>; - reg = <0>; - }; - }; - - hlcdc_pwm: hlcdc-pwm { - compatible = "atmel,hlcdc-pwm"; - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_lcd_pwm>; - #pwm-cells = <3>; - }; };
dma1: dma-controller@f0004000 { diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig index b4967f9203..ebd865ab5b 100644 --- a/arch/arm/mach-at91/Kconfig +++ b/arch/arm/mach-at91/Kconfig @@ -186,6 +186,7 @@ config TARGET_SAMA5D4_XPLAINED select SAMA5D4 select SUPPORT_SPL select BOARD_EARLY_INIT_F + select BOARD_LATE_INIT
config TARGET_SAMA5D4EK bool "SAMA5D4 Evaluation Kit" diff --git a/board/atmel/common/video_display.c b/board/atmel/common/video_display.c index 39ad619819..b20abc7386 100644 --- a/board/atmel/common/video_display.c +++ b/board/atmel/common/video_display.c @@ -43,7 +43,7 @@ int at91_video_show_board_info(void) nand_size = 0; #ifdef CONFIG_NAND_ATMEL for (i = 0; i < CONFIG_SYS_MAX_NAND_DEVICE; i++) - nand_size += nand_info[i]->size; + nand_size += get_nand_dev_by_index(i)->size; #endif
len += sprintf(&buf[len], "%ld MB SDRAM, %ld MB NAND\n", diff --git a/board/atmel/sama5d4_xplained/sama5d4_xplained.c b/board/atmel/sama5d4_xplained/sama5d4_xplained.c index 9236a28549..78eddb8beb 100644 --- a/board/atmel/sama5d4_xplained/sama5d4_xplained.c +++ b/board/atmel/sama5d4_xplained/sama5d4_xplained.c @@ -14,11 +14,7 @@ #include <asm/arch/clk.h> #include <asm/arch/sama5d3_smc.h> #include <asm/arch/sama5d4.h> -#include <atmel_hlcdc.h> #include <debug_uart.h> -#include <lcd.h> -#include <nand.h> -#include <version.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -73,98 +69,15 @@ static void sama5d4_xplained_usb_hw_init(void) } #endif
-#ifdef CONFIG_LCD -vidinfo_t panel_info = { - .vl_col = 480, - .vl_row = 272, - .vl_clk = 9000000, - .vl_bpix = LCD_BPP, - .vl_tft = 1, - .vl_hsync_len = 41, - .vl_left_margin = 2, - .vl_right_margin = 2, - .vl_vsync_len = 11, - .vl_upper_margin = 2, - .vl_lower_margin = 2, - .mmio = ATMEL_BASE_LCDC, -}; - -/* No power up/down pin for the LCD pannel */ -void lcd_enable(void) { /* Empty! */ } -void lcd_disable(void) { /* Empty! */ } - -unsigned int has_lcdc(void) +#ifdef CONFIG_BOARD_LATE_INIT +int board_late_init(void) { - return 1; -} - -static void sama5d4_xplained_lcd_hw_init(void) -{ - at91_pio3_set_a_periph(AT91_PIO_PORTA, 24, 0); /* LCDPWM */ - at91_pio3_set_a_periph(AT91_PIO_PORTA, 25, 0); /* LCDDISP */ - at91_pio3_set_a_periph(AT91_PIO_PORTA, 26, 0); /* LCDVSYNC */ - at91_pio3_set_a_periph(AT91_PIO_PORTA, 27, 0); /* LCDHSYNC */ - at91_pio3_set_a_periph(AT91_PIO_PORTA, 28, 0); /* LCDDOTCK */ - at91_pio3_set_a_periph(AT91_PIO_PORTA, 29, 0); /* LCDDEN */ - - at91_pio3_set_a_periph(AT91_PIO_PORTA, 0, 0); /* LCDD0 */ - at91_pio3_set_a_periph(AT91_PIO_PORTA, 1, 0); /* LCDD1 */ - at91_pio3_set_a_periph(AT91_PIO_PORTA, 2, 0); /* LCDD2 */ - at91_pio3_set_a_periph(AT91_PIO_PORTA, 3, 0); /* LCDD3 */ - at91_pio3_set_a_periph(AT91_PIO_PORTA, 4, 0); /* LCDD4 */ - at91_pio3_set_a_periph(AT91_PIO_PORTA, 5, 0); /* LCDD5 */ - at91_pio3_set_a_periph(AT91_PIO_PORTA, 6, 0); /* LCDD6 */ - at91_pio3_set_a_periph(AT91_PIO_PORTA, 7, 0); /* LCDD7 */ - - at91_pio3_set_a_periph(AT91_PIO_PORTA, 8, 0); /* LCDD9 */ - at91_pio3_set_a_periph(AT91_PIO_PORTA, 9, 0); /* LCDD8 */ - at91_pio3_set_a_periph(AT91_PIO_PORTA, 10, 0); /* LCDD10 */ - at91_pio3_set_a_periph(AT91_PIO_PORTA, 11, 0); /* LCDD11 */ - at91_pio3_set_a_periph(AT91_PIO_PORTA, 12, 0); /* LCDD12 */ - at91_pio3_set_a_periph(AT91_PIO_PORTA, 13, 0); /* LCDD13 */ - at91_pio3_set_a_periph(AT91_PIO_PORTA, 14, 0); /* LCDD14 */ - at91_pio3_set_a_periph(AT91_PIO_PORTA, 15, 0); /* LCDD15 */ - - at91_pio3_set_a_periph(AT91_PIO_PORTA, 16, 0); /* LCDD16 */ - at91_pio3_set_a_periph(AT91_PIO_PORTA, 17, 0); /* LCDD17 */ - at91_pio3_set_a_periph(AT91_PIO_PORTA, 18, 0); /* LCDD18 */ - at91_pio3_set_a_periph(AT91_PIO_PORTA, 19, 0); /* LCDD19 */ - at91_pio3_set_a_periph(AT91_PIO_PORTA, 20, 0); /* LCDD20 */ - at91_pio3_set_a_periph(AT91_PIO_PORTA, 21, 0); /* LCDD21 */ - at91_pio3_set_a_periph(AT91_PIO_PORTA, 22, 0); /* LCDD22 */ - at91_pio3_set_a_periph(AT91_PIO_PORTA, 23, 0); /* LCDD23 */ - - /* Enable clock */ - at91_periph_clk_enable(ATMEL_ID_LCDC); -} - -#ifdef CONFIG_LCD_INFO -void lcd_show_board_info(void) -{ - ulong dram_size, nand_size; - int i; - char temp[32]; - - lcd_printf("%s\n", U_BOOT_VERSION); - lcd_printf("2014 ATMEL Corp\n"); - lcd_printf("%s CPU at %s MHz\n", get_cpu_name(), - strmhz(temp, get_cpu_clk_rate())); - - dram_size = 0; - for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) - dram_size += gd->bd->bi_dram[i].size; - - nand_size = 0; -#ifdef CONFIG_NAND_ATMEL - for (i = 0; i < CONFIG_SYS_MAX_NAND_DEVICE; i++) - nand_size += get_nand_dev_by_index(i)->size; +#ifdef CONFIG_DM_VIDEO + at91_video_show_board_info(); #endif - lcd_printf("%ld MB SDRAM, %ld MB NAND\n", - dram_size >> 20, nand_size >> 20); + return 0; } -#endif /* CONFIG_LCD_INFO */ - -#endif /* CONFIG_LCD */ +#endif
#ifdef CONFIG_DEBUG_UART_BOARD_INIT static void sama5d4_xplained_serial3_hw_init(void) @@ -212,9 +125,6 @@ int board_init(void) #ifdef CONFIG_NAND_ATMEL sama5d4_xplained_nand_hw_init(); #endif -#ifdef CONFIG_LCD - sama5d4_xplained_lcd_hw_init(); -#endif #ifdef CONFIG_CMD_USB sama5d4_xplained_usb_hw_init(); #endif diff --git a/configs/sama5d4_xplained_mmc_defconfig b/configs/sama5d4_xplained_mmc_defconfig index dabbf605c5..8ecba5b7d4 100644 --- a/configs/sama5d4_xplained_mmc_defconfig +++ b/configs/sama5d4_xplained_mmc_defconfig @@ -78,3 +78,5 @@ CONFIG_USB_EHCI_HCD=y CONFIG_USB_STORAGE=y CONFIG_USB_GADGET=y CONFIG_USB_GADGET_ATMEL_USBA=y +CONFIG_DM_VIDEO=y +CONFIG_ATMEL_HLCD=y diff --git a/configs/sama5d4_xplained_nandflash_defconfig b/configs/sama5d4_xplained_nandflash_defconfig index 85157878cd..bd3131f4cc 100644 --- a/configs/sama5d4_xplained_nandflash_defconfig +++ b/configs/sama5d4_xplained_nandflash_defconfig @@ -75,3 +75,5 @@ CONFIG_USB_EHCI_HCD=y CONFIG_USB_STORAGE=y CONFIG_USB_GADGET=y CONFIG_USB_GADGET_ATMEL_USBA=y +CONFIG_DM_VIDEO=y +CONFIG_ATMEL_HLCD=y diff --git a/configs/sama5d4_xplained_spiflash_defconfig b/configs/sama5d4_xplained_spiflash_defconfig index 4061720b3a..d37be67eb6 100644 --- a/configs/sama5d4_xplained_spiflash_defconfig +++ b/configs/sama5d4_xplained_spiflash_defconfig @@ -77,3 +77,5 @@ CONFIG_USB_EHCI_HCD=y CONFIG_USB_STORAGE=y CONFIG_USB_GADGET=y CONFIG_USB_GADGET_ATMEL_USBA=y +CONFIG_DM_VIDEO=y +CONFIG_ATMEL_HLCD=y diff --git a/include/configs/sama5d4_xplained.h b/include/configs/sama5d4_xplained.h index 5dc5e7dd0c..6aa4bcc5c5 100644 --- a/include/configs/sama5d4_xplained.h +++ b/include/configs/sama5d4_xplained.h @@ -47,17 +47,6 @@ #define CONFIG_ATMEL_NAND_HW_PMECC #endif
-/* LCD */ -#ifdef CONFIG_LCD -#define LCD_BPP LCD_COLOR16 -#define LCD_OUTPUT_BPP 24 -#define CONFIG_LCD_LOGO -#define CONFIG_LCD_INFO -#define CONFIG_LCD_INFO_BELOW_LOGO -#define CONFIG_ATMEL_HLCD -#define CONFIG_ATMEL_LCD_RGB565 -#endif - /* SPL */ #define CONFIG_SPL_FRAMEWORK #define CONFIG_SPL_TEXT_BASE 0x200000

Convert the board to support the video driver model, add the device tree node, and remove the unnecessary code.
Signed-off-by: Wenyou Yang wenyou.yang@microchip.com Reviewed-by: Simon Glass sjg@chromium.org ---
Changes in v3: - Collect the Reviewed-by tags.
Changes in v2: - Rebase the u-boot/master (5541543f686). - Drop the applied patches. - Improve the commit log.
arch/arm/mach-at91/Kconfig | 1 + board/atmel/at91sam9x5ek/at91sam9x5ek.c | 111 ++----------------------------- configs/at91sam9x5ek_dataflash_defconfig | 3 +- configs/at91sam9x5ek_mmc_defconfig | 3 +- configs/at91sam9x5ek_nandflash_defconfig | 3 +- configs/at91sam9x5ek_spiflash_defconfig | 3 +- include/configs/at91sam9x5ek.h | 10 --- 7 files changed, 16 insertions(+), 118 deletions(-)
diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig index ebd865ab5b..7e85b69679 100644 --- a/arch/arm/mach-at91/Kconfig +++ b/arch/arm/mach-at91/Kconfig @@ -141,6 +141,7 @@ config TARGET_AT91SAM9X5EK select AT91SAM9X5 select SUPPORT_SPL select BOARD_EARLY_INIT_F + select BOARD_LATE_INIT
config TARGET_SAMA5D2_PTC bool "SAMA5D2 PTC board" diff --git a/board/atmel/at91sam9x5ek/at91sam9x5ek.c b/board/atmel/at91sam9x5ek/at91sam9x5ek.c index be6dd4a6d3..d69831ad15 100644 --- a/board/atmel/at91sam9x5ek/at91sam9x5ek.c +++ b/board/atmel/at91sam9x5ek/at91sam9x5ek.c @@ -13,12 +13,6 @@ #include <asm/arch/clk.h> #include <asm/arch/gpio.h> #include <debug_uart.h> -#include <lcd.h> -#include <atmel_hlcdc.h> -#ifdef CONFIG_LCD_INFO -#include <nand.h> -#include <version.h> -#endif #include <asm/mach-types.h>
DECLARE_GLOBAL_DATA_PTR; @@ -86,103 +80,15 @@ static void at91sam9x5ek_nand_hw_init(void) } #endif
-#ifdef CONFIG_LCD -vidinfo_t panel_info = { - .vl_col = 800, - .vl_row = 480, - .vl_clk = 24000000, - .vl_sync = LCDC_LCDCFG5_HSPOL | LCDC_LCDCFG5_VSPOL, - .vl_bpix = LCD_BPP, - .vl_tft = 1, - .vl_clk_pol = 1, - .vl_hsync_len = 128, - .vl_left_margin = 64, - .vl_right_margin = 64, - .vl_vsync_len = 2, - .vl_upper_margin = 22, - .vl_lower_margin = 21, - .mmio = ATMEL_BASE_LCDC, -}; - -void lcd_enable(void) -{ - if (has_lcdc()) - at91_pio3_set_a_periph(AT91_PIO_PORTC, 29, 1); /* power up */ -} - -void lcd_disable(void) -{ - if (has_lcdc()) - at91_pio3_set_a_periph(AT91_PIO_PORTC, 29, 0); /* power down */ -} - -static void at91sam9x5ek_lcd_hw_init(void) -{ - if (has_lcdc()) { - at91_pio3_set_a_periph(AT91_PIO_PORTC, 26, 0); /* LCDPWM */ - at91_pio3_set_a_periph(AT91_PIO_PORTC, 27, 0); /* LCDVSYNC */ - at91_pio3_set_a_periph(AT91_PIO_PORTC, 28, 0); /* LCDHSYNC */ - at91_pio3_set_a_periph(AT91_PIO_PORTC, 24, 0); /* LCDDISP */ - at91_pio3_set_a_periph(AT91_PIO_PORTC, 29, 0); /* LCDDEN */ - at91_pio3_set_a_periph(AT91_PIO_PORTC, 30, 0); /* LCDPCK */ - - at91_pio3_set_a_periph(AT91_PIO_PORTC, 0, 0); /* LCDD0 */ - at91_pio3_set_a_periph(AT91_PIO_PORTC, 1, 0); /* LCDD1 */ - at91_pio3_set_a_periph(AT91_PIO_PORTC, 2, 0); /* LCDD2 */ - at91_pio3_set_a_periph(AT91_PIO_PORTC, 3, 0); /* LCDD3 */ - at91_pio3_set_a_periph(AT91_PIO_PORTC, 4, 0); /* LCDD4 */ - at91_pio3_set_a_periph(AT91_PIO_PORTC, 5, 0); /* LCDD5 */ - at91_pio3_set_a_periph(AT91_PIO_PORTC, 6, 0); /* LCDD6 */ - at91_pio3_set_a_periph(AT91_PIO_PORTC, 7, 0); /* LCDD7 */ - at91_pio3_set_a_periph(AT91_PIO_PORTC, 8, 0); /* LCDD8 */ - at91_pio3_set_a_periph(AT91_PIO_PORTC, 9, 0); /* LCDD9 */ - at91_pio3_set_a_periph(AT91_PIO_PORTC, 10, 0); /* LCDD10 */ - at91_pio3_set_a_periph(AT91_PIO_PORTC, 11, 0); /* LCDD11 */ - at91_pio3_set_a_periph(AT91_PIO_PORTC, 12, 0); /* LCDD12 */ - at91_pio3_set_a_periph(AT91_PIO_PORTC, 13, 0); /* LCDD13 */ - at91_pio3_set_a_periph(AT91_PIO_PORTC, 14, 0); /* LCDD14 */ - at91_pio3_set_a_periph(AT91_PIO_PORTC, 15, 0); /* LCDD15 */ - at91_pio3_set_a_periph(AT91_PIO_PORTC, 16, 0); /* LCDD16 */ - at91_pio3_set_a_periph(AT91_PIO_PORTC, 17, 0); /* LCDD17 */ - at91_pio3_set_a_periph(AT91_PIO_PORTC, 18, 0); /* LCDD18 */ - at91_pio3_set_a_periph(AT91_PIO_PORTC, 19, 0); /* LCDD19 */ - at91_pio3_set_a_periph(AT91_PIO_PORTC, 20, 0); /* LCDD20 */ - at91_pio3_set_a_periph(AT91_PIO_PORTC, 21, 0); /* LCDD21 */ - at91_pio3_set_a_periph(AT91_PIO_PORTC, 22, 0); /* LCDD22 */ - at91_pio3_set_a_periph(AT91_PIO_PORTC, 23, 0); /* LCDD23 */ - - at91_periph_clk_enable(ATMEL_ID_LCDC); - } -} - -#ifdef CONFIG_LCD_INFO -void lcd_show_board_info(void) +#ifdef CONFIG_BOARD_LATE_INIT +int board_late_init(void) { - ulong dram_size, nand_size; - int i; - char temp[32]; - - if (has_lcdc()) { - lcd_printf("%s\n", U_BOOT_VERSION); - lcd_printf("(C) 2012 ATMEL Corp\n"); - lcd_printf("at91support@atmel.com\n"); - lcd_printf("%s CPU at %s MHz\n", - get_cpu_name(), - strmhz(temp, get_cpu_clk_rate())); - - dram_size = 0; - for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) - dram_size += gd->bd->bi_dram[i].size; - nand_size = 0; - for (i = 0; i < CONFIG_SYS_MAX_NAND_DEVICE; i++) - nand_size += get_nand_dev_by_index(i)->size; - lcd_printf(" %ld MB SDRAM, %ld MB NAND\n", - dram_size >> 20, - nand_size >> 20); - } +#ifdef CONFIG_DM_VIDEO + at91_video_show_board_info(); +#endif + return 0; } -#endif /* CONFIG_LCD_INFO */ -#endif /* CONFIG_LCD */ +#endif
#ifdef CONFIG_DEBUG_UART_BOARD_INIT void board_debug_uart_init(void) @@ -216,9 +122,6 @@ int board_init(void) #if defined(CONFIG_USB_OHCI_NEW) || defined(CONFIG_USB_EHCI_HCD) at91_uhp_hw_init(); #endif -#ifdef CONFIG_LCD - at91sam9x5ek_lcd_hw_init(); -#endif return 0; }
diff --git a/configs/at91sam9x5ek_dataflash_defconfig b/configs/at91sam9x5ek_dataflash_defconfig index 9d61dd8de0..c417eb8c10 100644 --- a/configs/at91sam9x5ek_dataflash_defconfig +++ b/configs/at91sam9x5ek_dataflash_defconfig @@ -60,4 +60,5 @@ CONFIG_USB=y CONFIG_DM_USB=y CONFIG_USB_EHCI_HCD=y CONFIG_USB_STORAGE=y -CONFIG_LCD=y +CONFIG_DM_VIDEO=y +CONFIG_ATMEL_HLCD=y diff --git a/configs/at91sam9x5ek_mmc_defconfig b/configs/at91sam9x5ek_mmc_defconfig index 9fa4801480..e0a24a5b48 100644 --- a/configs/at91sam9x5ek_mmc_defconfig +++ b/configs/at91sam9x5ek_mmc_defconfig @@ -60,4 +60,5 @@ CONFIG_USB=y CONFIG_DM_USB=y CONFIG_USB_EHCI_HCD=y CONFIG_USB_STORAGE=y -CONFIG_LCD=y +CONFIG_DM_VIDEO=y +CONFIG_ATMEL_HLCD=y diff --git a/configs/at91sam9x5ek_nandflash_defconfig b/configs/at91sam9x5ek_nandflash_defconfig index b28bec7f0b..0e8c07f609 100644 --- a/configs/at91sam9x5ek_nandflash_defconfig +++ b/configs/at91sam9x5ek_nandflash_defconfig @@ -60,4 +60,5 @@ CONFIG_USB=y CONFIG_DM_USB=y CONFIG_USB_EHCI_HCD=y CONFIG_USB_STORAGE=y -CONFIG_LCD=y +CONFIG_DM_VIDEO=y +CONFIG_ATMEL_HLCD=y diff --git a/configs/at91sam9x5ek_spiflash_defconfig b/configs/at91sam9x5ek_spiflash_defconfig index 838d8a0ad7..70e96ecc2f 100644 --- a/configs/at91sam9x5ek_spiflash_defconfig +++ b/configs/at91sam9x5ek_spiflash_defconfig @@ -60,4 +60,5 @@ CONFIG_USB=y CONFIG_DM_USB=y CONFIG_USB_EHCI_HCD=y CONFIG_USB_STORAGE=y -CONFIG_LCD=y +CONFIG_DM_VIDEO=y +CONFIG_ATMEL_HLCD=y diff --git a/include/configs/at91sam9x5ek.h b/include/configs/at91sam9x5ek.h index 1d4971c59f..9450784521 100644 --- a/include/configs/at91sam9x5ek.h +++ b/include/configs/at91sam9x5ek.h @@ -23,16 +23,6 @@ /* general purpose I/O */ #define CONFIG_ATMEL_LEGACY /* required until (g)pio is fixed */
-/* LCD */ -#define LCD_BPP LCD_COLOR16 -#define LCD_OUTPUT_BPP 24 -#define CONFIG_LCD_LOGO -#define CONFIG_LCD_INFO -#define CONFIG_LCD_INFO_BELOW_LOGO -#define CONFIG_ATMEL_HLCD -#define CONFIG_ATMEL_LCD_RGB565 - - /* * BOOTP options */

On Mon, 18 Sep 2017 15:25:56 +0800 Wenyou Yang wenyou.yang@microchip.com wrote:
Convert the boards to support the driver model of LCD/video via enabling CONFIG_DM_VIDEO, remove CONFIG_LCD and the unnecessary code.
Changes in v3:
- Collect the Reviewed-by tags.
Note that resubmitting with collected Reviewed-by tags is not necessary, patchwork collects them automatically.
Series applied to u-boot-video/master, thanks!
-- Anatolij
participants (2)
-
Anatolij Gustschin
-
Wenyou Yang