]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
board: sama5d2_xplained: Convert to CONFIG_DM_VIDEO
authorWenyou Yang <wenyou.yang@microchip.com>
Mon, 18 Sep 2017 07:25:57 +0000 (15:25 +0800)
committerAnatolij Gustschin <agust@denx.de>
Fri, 29 Sep 2017 15:48:56 +0000 (17:48 +0200)
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>
arch/arm/dts/at91-sama5d2_xplained.dts
arch/arm/dts/sama5d2.dtsi
arch/arm/mach-at91/Kconfig
board/atmel/sama5d2_xplained/sama5d2_xplained.c
configs/sama5d2_xplained_mmc_defconfig
configs/sama5d2_xplained_spiflash_defconfig
include/configs/sama5d2_xplained.h

index b00aaa2c79209eed3fd0ac313c4f9793a20b108c..01326a1ee03472250d4e2367e974b9064b362f4c 100644 (file)
                };
 
                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";
 
                                                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;
index b02a602378ee81304f0ca2e1f269173ef8b9342f..7520446dc1a5f79c9cc46c744c9dd7844e793715 100644 (file)
                        #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>;
index 0e71b69a1965b55c445d97f9628a708809f2c7ac..abc79d9637ddd6095b437a9a3c5a6bca16c0f437 100644 (file)
@@ -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"
index 57586530304531880c6a6f7b702b6d1b9d09c048..778142ac7161c2da494f101a31272daafb7e6464 100644 (file)
@@ -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
index 215961a65c0deb882cc496f9e7b51ff4fb70b19a..87fc049b6d53af0ba6999a16ef750e64ed5356be 100644 (file)
@@ -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
index 869d405838e55e5dedbdb0ae5d7464a6eaef6829..37572489e2e08707b66e7e407276579358cf67fa 100644 (file)
@@ -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
index 4f24a56899a982caed671cf5d656ada8a3fa4cee..545ba1740de8a5a7efa7e4fb778b45d53ad931b7 100644 (file)
 #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 */