From patchwork Mon Jul 31 06:02:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wenyou Yang X-Patchwork-Id: 795568 X-Patchwork-Delegate: agust@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3xLTby0fkjz9sRW for ; Mon, 31 Jul 2017 16:11:26 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id C06D1C22098; Mon, 31 Jul 2017 06:09:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=RCVD_IN_DNSWL_MED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 73FEDC22039; Mon, 31 Jul 2017 06:08:47 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 4DD60C21FC1; Mon, 31 Jul 2017 06:08:34 +0000 (UTC) Received: from eusmtp01.atmel.com (eusmtp01.atmel.com [212.144.249.242]) by lists.denx.de (Postfix) with ESMTPS id 25F42C21FFF for ; Mon, 31 Jul 2017 06:08:29 +0000 (UTC) Received: from apsmtp01.atmel.com (10.168.254.31) by eusmtp01.atmel.com (10.145.145.30) with Microsoft SMTP Server id 14.3.235.1; Mon, 31 Jul 2017 08:08:25 +0200 Received: from shaarm01.corp.atmel.com (10.168.254.13) by apsmtp01.atmel.com (10.168.254.31) with Microsoft SMTP Server id 14.3.235.1; Mon, 31 Jul 2017 14:11:17 +0800 From: Wenyou Yang To: U-Boot Mailing List Date: Mon, 31 Jul 2017 14:02:30 +0800 Message-ID: <20170731060230.981-8-wenyou.yang@microchip.com> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170731060230.981-1-wenyou.yang@microchip.com> References: <20170731060230.981-1-wenyou.yang@microchip.com> MIME-Version: 1.0 Cc: Albert Aribaud , Tom Rini Subject: [U-Boot] [PATCH 7/7] board: at91sam9x5ek: Convert to support DM_VIDEO X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Convert the board to enable the driver model support for LCD/video. Signed-off-by: Wenyou Yang --- 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 3cc37f431b..9f39e210b1 100644 --- a/arch/arm/mach-at91/Kconfig +++ b/arch/arm/mach-at91/Kconfig @@ -85,6 +85,7 @@ config TARGET_AT91SAM9X5EK select CPU_ARM926EJS 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 2452e63881..3d1763b1e2 100644 --- a/board/atmel/at91sam9x5ek/at91sam9x5ek.c +++ b/board/atmel/at91sam9x5ek/at91sam9x5ek.c @@ -13,12 +13,6 @@ #include #include #include -#include -#include -#ifdef CONFIG_LCD_INFO -#include -#include -#endif #include 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 8fc457b28c..fa1f7dffd9 100644 --- a/configs/at91sam9x5ek_dataflash_defconfig +++ b/configs/at91sam9x5ek_dataflash_defconfig @@ -54,4 +54,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 1b76127934..04ff0a21c8 100644 --- a/configs/at91sam9x5ek_mmc_defconfig +++ b/configs/at91sam9x5ek_mmc_defconfig @@ -54,5 +54,6 @@ 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 CONFIG_FAT_WRITE=y diff --git a/configs/at91sam9x5ek_nandflash_defconfig b/configs/at91sam9x5ek_nandflash_defconfig index 23ef8072a3..da983408b7 100644 --- a/configs/at91sam9x5ek_nandflash_defconfig +++ b/configs/at91sam9x5ek_nandflash_defconfig @@ -54,4 +54,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 48c2559c52..bc81f7ab50 100644 --- a/configs/at91sam9x5ek_spiflash_defconfig +++ b/configs/at91sam9x5ek_spiflash_defconfig @@ -54,4 +54,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 7e8a9e921a..7887791c37 100644 --- a/include/configs/at91sam9x5ek.h +++ b/include/configs/at91sam9x5ek.h @@ -27,16 +27,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 */