[U-Boot] [PATCH v4 0/6] board: sama5d3: convert boards to support DM/DT

The purpose of patch set is to convert the board to support device tree and driver model, and enable the early debug UART as well. It is based on the patch set: [PATCH v8 0/2] pinctrl: at91: Add pinctrl driver https://lists.denx.de/pipermail/u-boot/2017-March/284577.html
Changes in v4: - Remove wrong using CONFIG_PHY_MICREL. - Remove the ethernet init code completely.
Changes in v3: - Convert the macb to support DM and clean up macb init code. - Remain the SPI speed macros. - Update the config options for SPL. - Update the commit log. - Remove the unneeded dbgu init during board_early_init_f stage. - Use CONFIG_DEBUG_UART_CLOCK as the input clock for the early debug uart. - Drop [PATCH] configs: sama5d3_xplained: move CONFIG_SYS_NO_FLASH to defconfig. - Rebase on v2017.03.
Changes in v2: - rebase on the patch set: [PATCH v3 0/8] board: sama5d4: convert boards to support DM/DT http://lists.denx.de/pipermail/u-boot/2017-February/280506.html
Wenyou Yang (6): board: sama5d3xek: update to support DM/DT board: sama5d3xek: clean up code board: sama5d3xek: enable early debug UART board: sama5d3_xplained: update to support DM/DT board: sama5d3_xplained: clean up code board: sama5d3_xplained: enable early debug UART
board/atmel/sama5d3_xplained/sama5d3_xplained.c | 47 ++------ board/atmel/sama5d3xek/sama5d3xek.c | 145 +++--------------------- configs/sama5d3_xplained_mmc_defconfig | 35 +++++- configs/sama5d3_xplained_nandflash_defconfig | 34 +++++- configs/sama5d3xek_mmc_defconfig | 40 ++++++- configs/sama5d3xek_nandflash_defconfig | 37 +++++- configs/sama5d3xek_spiflash_defconfig | 41 ++++++- include/configs/sama5d3_xplained.h | 26 +---- include/configs/sama5d3xek.h | 35 +----- 9 files changed, 212 insertions(+), 228 deletions(-)

Update the configuration files to support the device tree and driver model, so do SPL. The device clock and pins configuration are handled by the clock and the pinctrl drivers respectively.
Signed-off-by: Wenyou Yang wenyou.yang@atmel.com ---
Changes in v4: - Remove wrong using CONFIG_PHY_MICREL.
Changes in v3: None Changes in v2: None
board/atmel/sama5d3xek/sama5d3xek.c | 2 ++ configs/sama5d3xek_mmc_defconfig | 34 ++++++++++++++++++++++++++++++++- configs/sama5d3xek_nandflash_defconfig | 31 +++++++++++++++++++++++++++++- configs/sama5d3xek_spiflash_defconfig | 35 +++++++++++++++++++++++++++++++--- include/configs/sama5d3xek.h | 35 ++++------------------------------ 5 files changed, 101 insertions(+), 36 deletions(-)
diff --git a/board/atmel/sama5d3xek/sama5d3xek.c b/board/atmel/sama5d3xek/sama5d3xek.c index 134c2fe1eb..1d96149921 100644 --- a/board/atmel/sama5d3xek/sama5d3xek.c +++ b/board/atmel/sama5d3xek/sama5d3xek.c @@ -331,6 +331,7 @@ int board_mmc_init(bd_t *bis) #ifdef CONFIG_ATMEL_SPI #include <spi.h>
+#ifndef CONFIG_DM_SPI int spi_cs_is_valid(unsigned int bus, unsigned int cs) { return bus == 0 && cs < 4; @@ -367,6 +368,7 @@ void spi_cs_deactivate(struct spi_slave *slave) break; } } +#endif #endif /* CONFIG_ATMEL_SPI */
#ifdef CONFIG_BOARD_LATE_INIT diff --git a/configs/sama5d3xek_mmc_defconfig b/configs/sama5d3xek_mmc_defconfig index b73d647ee3..e71f87101d 100644 --- a/configs/sama5d3xek_mmc_defconfig +++ b/configs/sama5d3xek_mmc_defconfig @@ -4,10 +4,13 @@ CONFIG_TARGET_SAMA5D3XEK=y CONFIG_SPL_GPIO_SUPPORT=y CONFIG_SPL_LIBCOMMON_SUPPORT=y CONFIG_SPL_LIBGENERIC_SUPPORT=y +CONFIG_SYS_MALLOC_F_LEN=0x2000 CONFIG_SPL_MMC_SUPPORT=y CONFIG_SPL_SERIAL_SUPPORT=y +CONFIG_SPL_DRIVERS_MISC_SUPPORT=y CONFIG_SPL_LIBDISK_SUPPORT=y CONFIG_SPL_FAT_SUPPORT=y +CONFIG_DEFAULT_DEVICE_TREE="sama5d36ek" CONFIG_FIT=y CONFIG_SYS_EXTRA_OPTIONS="SAMA5D3,SYS_USE_MMC" CONFIG_BOOTDELAY=3 @@ -15,6 +18,7 @@ CONFIG_BOOTDELAY=3 CONFIG_SYS_CONSOLE_IS_IN_ENV=y # CONFIG_DISPLAY_BOARDINFO is not set CONFIG_SPL=y +CONFIG_SPL_SEPARATE_BSS=y CONFIG_HUSH_PARSER=y CONFIG_CMD_BOOTZ=y # CONFIG_CMD_IMI is not set @@ -26,13 +30,41 @@ CONFIG_CMD_USB=y CONFIG_CMD_DHCP=y CONFIG_CMD_MII=y CONFIG_CMD_PING=y +CONFIG_CMD_EXT4=y +CONFIG_CMD_EXT4_WRITE=y CONFIG_CMD_FAT=y +CONFIG_OF_CONTROL=y +CONFIG_SPL_OF_CONTROL=y +CONFIG_OF_SPL_REMOVE_PROPS="interrupts interrupt-parent dmas dma-names" +CONFIG_DM=y +CONFIG_SPL_DM=y +CONFIG_SPL_DM_SEQ_ALIAS=y +CONFIG_CLK=y +CONFIG_SPL_CLK=y +CONFIG_CLK_AT91=y +CONFIG_AT91_UTMI=y +CONFIG_AT91_H32MX=y +CONFIG_DM_GPIO=y +CONFIG_AT91_GPIO=y +CONFIG_DM_MMC=y +CONFIG_GENERIC_ATMEL_MCI=y CONFIG_MTD_NOR_FLASH=y +CONFIG_DM_SPI_FLASH=y CONFIG_SPI_FLASH=y CONFIG_SPI_FLASH_ATMEL=y +CONFIG_DM_ETH=y +CONFIG_MACB=y +CONFIG_PINCTRL=y +CONFIG_SPL_PINCTRL=y +CONFIG_PINCTRL_AT91=y +CONFIG_DM_SERIAL=y +CONFIG_ATMEL_USART=y +CONFIG_DM_SPI=y +CONFIG_ATMEL_SPI=y CONFIG_USB=y +CONFIG_DM_USB=y +CONFIG_USB_EHCI_HCD=y CONFIG_USB_STORAGE=y CONFIG_USB_GADGET=y CONFIG_USB_GADGET_ATMEL_USBA=y CONFIG_LCD=y -CONFIG_OF_LIBFDT=y diff --git a/configs/sama5d3xek_nandflash_defconfig b/configs/sama5d3xek_nandflash_defconfig index 7f68d7db96..2cd6691f4c 100644 --- a/configs/sama5d3xek_nandflash_defconfig +++ b/configs/sama5d3xek_nandflash_defconfig @@ -4,8 +4,11 @@ CONFIG_TARGET_SAMA5D3XEK=y CONFIG_SPL_GPIO_SUPPORT=y CONFIG_SPL_LIBCOMMON_SUPPORT=y CONFIG_SPL_LIBGENERIC_SUPPORT=y +CONFIG_SYS_MALLOC_F_LEN=0x2000 CONFIG_SPL_SERIAL_SUPPORT=y +CONFIG_SPL_DRIVERS_MISC_SUPPORT=y CONFIG_SPL_NAND_SUPPORT=y +CONFIG_DEFAULT_DEVICE_TREE="sama5d36ek" CONFIG_FIT=y CONFIG_SYS_EXTRA_OPTIONS="SAMA5D3,SYS_USE_NANDFLASH" CONFIG_BOOTDELAY=3 @@ -25,12 +28,38 @@ CONFIG_CMD_DHCP=y CONFIG_CMD_MII=y CONFIG_CMD_PING=y CONFIG_CMD_FAT=y +CONFIG_OF_CONTROL=y +CONFIG_SPL_OF_CONTROL=y +CONFIG_OF_SPL_REMOVE_PROPS="interrupts interrupt-parent dmas dma-names" +CONFIG_DM=y +CONFIG_SPL_DM=y +CONFIG_SPL_DM_SEQ_ALIAS=y +CONFIG_CLK=y +CONFIG_SPL_CLK=y +CONFIG_CLK_AT91=y +CONFIG_AT91_UTMI=y +CONFIG_AT91_H32MX=y +CONFIG_DM_GPIO=y +CONFIG_AT91_GPIO=y +CONFIG_DM_MMC=y +CONFIG_GENERIC_ATMEL_MCI=y CONFIG_MTD_NOR_FLASH=y +CONFIG_DM_SPI_FLASH=y CONFIG_SPI_FLASH=y CONFIG_SPI_FLASH_ATMEL=y +CONFIG_DM_ETH=y +CONFIG_MACB=y +CONFIG_PINCTRL=y +CONFIG_SPL_PINCTRL=y +CONFIG_PINCTRL_AT91=y +CONFIG_DM_SERIAL=y +CONFIG_ATMEL_USART=y +CONFIG_DM_SPI=y +CONFIG_ATMEL_SPI=y CONFIG_USB=y +CONFIG_DM_USB=y +CONFIG_USB_EHCI_HCD=y CONFIG_USB_STORAGE=y CONFIG_USB_GADGET=y CONFIG_USB_GADGET_ATMEL_USBA=y CONFIG_LCD=y -CONFIG_OF_LIBFDT=y diff --git a/configs/sama5d3xek_spiflash_defconfig b/configs/sama5d3xek_spiflash_defconfig index c7a183f7ce..748f4da77c 100644 --- a/configs/sama5d3xek_spiflash_defconfig +++ b/configs/sama5d3xek_spiflash_defconfig @@ -4,20 +4,23 @@ CONFIG_TARGET_SAMA5D3XEK=y CONFIG_SPL_GPIO_SUPPORT=y CONFIG_SPL_LIBCOMMON_SUPPORT=y CONFIG_SPL_LIBGENERIC_SUPPORT=y +CONFIG_SYS_MALLOC_F_LEN=0x2000 CONFIG_SPL_SERIAL_SUPPORT=y +CONFIG_SPL_DRIVERS_MISC_SUPPORT=y CONFIG_SPL_SPI_FLASH_SUPPORT=y CONFIG_SPL_SPI_SUPPORT=y +CONFIG_DEFAULT_DEVICE_TREE="sama5d36ek" CONFIG_FIT=y CONFIG_SYS_EXTRA_OPTIONS="SAMA5D3,SYS_USE_SERIALFLASH" CONFIG_BOOTDELAY=3 -# CONFIG_CONSOLE_MUX is not set -CONFIG_SYS_CONSOLE_IS_IN_ENV=y # CONFIG_DISPLAY_BOARDINFO is not set CONFIG_SPL=y CONFIG_HUSH_PARSER=y CONFIG_CMD_BOOTZ=y # CONFIG_CMD_IMI is not set +# CONFIG_CMD_IMLS is not set # CONFIG_CMD_LOADS is not set +# CONFIG_CMD_FLASH is not set CONFIG_CMD_MMC=y CONFIG_CMD_SF=y CONFIG_CMD_USB=y @@ -26,12 +29,38 @@ CONFIG_CMD_DHCP=y CONFIG_CMD_MII=y CONFIG_CMD_PING=y CONFIG_CMD_FAT=y +CONFIG_OF_CONTROL=y +CONFIG_SPL_OF_CONTROL=y +CONFIG_OF_SPL_REMOVE_PROPS="interrupts interrupt-parent dmas dma-names" +CONFIG_DM=y +CONFIG_SPL_DM=y +CONFIG_SPL_DM_SEQ_ALIAS=y +CONFIG_CLK=y +CONFIG_SPL_CLK=y +CONFIG_CLK_AT91=y +CONFIG_AT91_UTMI=y +CONFIG_AT91_H32MX=y +CONFIG_DM_GPIO=y +CONFIG_AT91_GPIO=y +CONFIG_DM_MMC=y +CONFIG_GENERIC_ATMEL_MCI=y CONFIG_MTD_NOR_FLASH=y +CONFIG_DM_SPI_FLASH=y CONFIG_SPI_FLASH=y CONFIG_SPI_FLASH_ATMEL=y +CONFIG_DM_ETH=y +CONFIG_MACB=y +CONFIG_PINCTRL=y +CONFIG_SPL_PINCTRL=y +CONFIG_PINCTRL_AT91=y +CONFIG_DM_SERIAL=y +CONFIG_ATMEL_USART=y +CONFIG_DM_SPI=y +CONFIG_ATMEL_SPI=y CONFIG_USB=y +CONFIG_DM_USB=y +CONFIG_USB_EHCI_HCD=y CONFIG_USB_STORAGE=y CONFIG_USB_GADGET=y CONFIG_USB_GADGET_ATMEL_USBA=y CONFIG_LCD=y -CONFIG_OF_LIBFDT=y diff --git a/include/configs/sama5d3xek.h b/include/configs/sama5d3xek.h index 13790e7244..6c28c4c19e 100644 --- a/include/configs/sama5d3xek.h +++ b/include/configs/sama5d3xek.h @@ -17,11 +17,6 @@
#define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
-/* serial console */ -#define CONFIG_ATMEL_USART -#define CONFIG_USART_BASE ATMEL_BASE_DBGU -#define CONFIG_USART_ID ATMEL_ID_DBGU - /* * This needs to be defined for the OHCI code to work but it is defined as * ATMEL_ID_UHPHS in the CPU specific header files. @@ -62,16 +57,15 @@ #define CONFIG_SYS_SDRAM_SIZE 0x20000000
#ifdef CONFIG_SPL_BUILD -#define CONFIG_SYS_INIT_SP_ADDR 0x310000 +#define CONFIG_SYS_INIT_SP_ADDR 0x318000 #else #define CONFIG_SYS_INIT_SP_ADDR \ - (CONFIG_SYS_SDRAM_BASE + 4 * 1024 - GENERATED_GBL_DATA_SIZE) + (CONFIG_SYS_SDRAM_BASE + 16 * 1024 - GENERATED_GBL_DATA_SIZE) #endif
/* SerialFlash */
#ifdef CONFIG_CMD_SF -#define CONFIG_ATMEL_SPI #define CONFIG_SF_DEFAULT_SPEED 30000000 #endif
@@ -95,27 +89,11 @@ #define CONFIG_CMD_NAND_TRIMFFS #endif
-/* Ethernet Hardware */ -#define CONFIG_MACB -#define CONFIG_RMII -#define CONFIG_NET_RETRY_COUNT 20 -#define CONFIG_MACB_SEARCH_PHY -#define CONFIG_RGMII -#define CONFIG_PHYLIB -#define CONFIG_PHY_MICREL #define CONFIG_PHY_MICREL_KSZ9021
-/* MMC */ - -#ifdef CONFIG_CMD_MMC -#define CONFIG_GENERIC_ATMEL_MCI -#define ATMEL_BASE_MMCI ATMEL_BASE_MCI0 -#endif - /* USB */
#ifdef CONFIG_CMD_USB -#define CONFIG_USB_ATMEL #define CONFIG_USB_ATMEL_CLK_SEL_UPLL #define CONFIG_USB_OHCI_NEW #define CONFIG_SYS_USB_OHCI_CPU_INIT @@ -124,11 +102,6 @@ #define CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS 3 #endif
-/* USB device */ -#define CONFIG_USB_ETHER -#define CONFIG_USB_ETH_RNDIS -#define CONFIG_USBNET_MANUFACTURER "Atmel SAMA5D3xEK" - #if defined(CONFIG_CMD_USB) || defined(CONFIG_CMD_MMC) #define CONFIG_FAT_WRITE #endif @@ -148,7 +121,7 @@ /* SPL */ #define CONFIG_SPL_FRAMEWORK #define CONFIG_SPL_TEXT_BASE 0x300000 -#define CONFIG_SPL_MAX_SIZE 0x10000 +#define CONFIG_SPL_MAX_SIZE 0x18000 #define CONFIG_SPL_BSS_START_ADDR 0x20000000 #define CONFIG_SPL_BSS_MAX_SIZE 0x80000 #define CONFIG_SYS_SPL_MALLOC_START 0x20080000 @@ -176,7 +149,7 @@
#elif CONFIG_SYS_USE_SERIALFLASH #define CONFIG_SPL_SPI_LOAD -#define CONFIG_SYS_SPI_U_BOOT_OFFS 0x8000 +#define CONFIG_SYS_SPI_U_BOOT_OFFS 0x10000
#endif

Due to the introduction of the pinctrl and clk driver, and using device tree files, remove the unneeded hardcoded pin configuration and clock enabling code from the board file.
Signed-off-by: Wenyou Yang wenyou.yang@atmel.com ---
Changes in v4: - Remove the ethernet init code completely.
Changes in v3: None Changes in v2: None
board/atmel/sama5d3xek/sama5d3xek.c | 134 +----------------------------------- 1 file changed, 1 insertion(+), 133 deletions(-)
diff --git a/board/atmel/sama5d3xek/sama5d3xek.c b/board/atmel/sama5d3xek/sama5d3xek.c index 1d96149921..2a18d877a2 100644 --- a/board/atmel/sama5d3xek/sama5d3xek.c +++ b/board/atmel/sama5d3xek/sama5d3xek.c @@ -6,7 +6,6 @@ */
#include <common.h> -#include <mmc.h> #include <asm/io.h> #include <asm/arch/sama5d3_smc.h> #include <asm/arch/at91_common.h> @@ -16,19 +15,12 @@ #include <lcd.h> #include <linux/ctype.h> #include <atmel_hlcdc.h> -#include <atmel_mci.h> #include <phy.h> #include <micrel.h> -#include <net.h> -#include <netdev.h> #include <spl.h> #include <asm/arch/atmel_mpddrc.h> #include <asm/arch/at91_wdt.h>
-#ifdef CONFIG_USB_GADGET_ATMEL_USBA -#include <asm/arch/atmel_usba_udc.h> -#endif - DECLARE_GLOBAL_DATA_PTR;
/* ------------------------------------------------------------------------- */ @@ -135,8 +127,6 @@ static void sama5d3xek_usb_hw_init(void) #ifdef CONFIG_GENERIC_ATMEL_MCI static void sama5d3xek_mci_hw_init(void) { - at91_mci_hw_init(); - at91_set_pio_output(AT91_PIO_PORTB, 10, 0); /* MCI0 Power */ } #endif @@ -217,12 +207,6 @@ void lcd_show_board_info(void)
int board_early_init_f(void) { - at91_periph_clk_enable(ATMEL_ID_PIOA); - at91_periph_clk_enable(ATMEL_ID_PIOB); - at91_periph_clk_enable(ATMEL_ID_PIOC); - at91_periph_clk_enable(ATMEL_ID_PIOD); - at91_periph_clk_enable(ATMEL_ID_PIOE); - at91_seriald_hw_init();
return 0; @@ -242,21 +226,9 @@ int board_init(void) #ifdef CONFIG_CMD_USB sama5d3xek_usb_hw_init(); #endif -#ifdef CONFIG_USB_GADGET_ATMEL_USBA - at91_udp_hw_init(); -#endif #ifdef CONFIG_GENERIC_ATMEL_MCI sama5d3xek_mci_hw_init(); #endif -#ifdef CONFIG_ATMEL_SPI - at91_spi0_hw_init(1 << 0); -#endif -#ifdef CONFIG_MACB - if (has_emac()) - at91_macb_hw_init(); - if (has_gmac()) - at91_gmac_hw_init(); -#endif #ifdef CONFIG_LCD if (has_lcdc()) sama5d3xek_lcd_hw_init(); @@ -271,106 +243,6 @@ int dram_init(void) return 0; }
-int board_phy_config(struct phy_device *phydev) -{ - /* board specific timings for GMAC */ - if (has_gmac()) { - /* rx data delay */ - ksz9021_phy_extended_write(phydev, - MII_KSZ9021_EXT_RGMII_RX_DATA_SKEW, - 0x2222); - /* tx data delay */ - ksz9021_phy_extended_write(phydev, - MII_KSZ9021_EXT_RGMII_TX_DATA_SKEW, - 0x2222); - /* rx/tx clock delay */ - ksz9021_phy_extended_write(phydev, - MII_KSZ9021_EXT_RGMII_CLOCK_SKEW, - 0xf2f4); - } - - /* always run the PHY's config routine */ - if (phydev->drv->config) - return phydev->drv->config(phydev); - - return 0; -} - -int board_eth_init(bd_t *bis) -{ - int rc = 0; - -#ifdef CONFIG_MACB - if (has_emac()) - rc = macb_eth_initialize(0, (void *)ATMEL_BASE_EMAC, 0x00); - if (has_gmac()) - rc = macb_eth_initialize(0, (void *)ATMEL_BASE_GMAC, 0x00); -#endif -#ifdef CONFIG_USB_GADGET_ATMEL_USBA - usba_udc_probe(&pdata); -#ifdef CONFIG_USB_ETH_RNDIS - usb_eth_initialize(bis); -#endif -#endif - - return rc; -} - -#ifdef CONFIG_GENERIC_ATMEL_MCI -int board_mmc_init(bd_t *bis) -{ - int rc = 0; - - rc = atmel_mci_init((void *)ATMEL_BASE_MCI0); - - return rc; -} -#endif - -/* SPI chip select control */ -#ifdef CONFIG_ATMEL_SPI -#include <spi.h> - -#ifndef CONFIG_DM_SPI -int spi_cs_is_valid(unsigned int bus, unsigned int cs) -{ - return bus == 0 && cs < 4; -} - -void spi_cs_activate(struct spi_slave *slave) -{ - switch (slave->cs) { - case 0: - at91_set_pio_output(AT91_PIO_PORTD, 13, 0); - case 1: - at91_set_pio_output(AT91_PIO_PORTD, 14, 0); - case 2: - at91_set_pio_output(AT91_PIO_PORTD, 15, 0); - case 3: - at91_set_pio_output(AT91_PIO_PORTD, 16, 0); - default: - break; - } -} - -void spi_cs_deactivate(struct spi_slave *slave) -{ - switch (slave->cs) { - case 0: - at91_set_pio_output(AT91_PIO_PORTD, 13, 1); - case 1: - at91_set_pio_output(AT91_PIO_PORTD, 14, 1); - case 2: - at91_set_pio_output(AT91_PIO_PORTD, 15, 1); - case 3: - at91_set_pio_output(AT91_PIO_PORTD, 16, 1); - default: - break; - } -} -#endif -#endif /* CONFIG_ATMEL_SPI */ - #ifdef CONFIG_BOARD_LATE_INIT int board_late_init(void) { @@ -394,12 +266,8 @@ int board_late_init(void) #ifdef CONFIG_SPL_BUILD void spl_board_init(void) { -#ifdef CONFIG_SYS_USE_MMC - sama5d3xek_mci_hw_init(); -#elif CONFIG_SYS_USE_NANDFLASH +#if CONFIG_SYS_USE_NANDFLASH sama5d3xek_nand_hw_init(); -#elif CONFIG_SYS_USE_SERIALFLASH - at91_spi0_hw_init(1 << 0); #endif }

Enable the early debug UART to debug problems when an ICE or other debug mechanism is not available.
Signed-off-by: Wenyou Yang wenyou.yang@atmel.com ---
Changes in v4: None Changes in v3: None Changes in v2: None
board/atmel/sama5d3xek/sama5d3xek.c | 13 ++++++++++++- configs/sama5d3xek_mmc_defconfig | 6 ++++++ configs/sama5d3xek_nandflash_defconfig | 6 ++++++ configs/sama5d3xek_spiflash_defconfig | 6 ++++++ 4 files changed, 30 insertions(+), 1 deletion(-)
diff --git a/board/atmel/sama5d3xek/sama5d3xek.c b/board/atmel/sama5d3xek/sama5d3xek.c index 2a18d877a2..cae6e245dd 100644 --- a/board/atmel/sama5d3xek/sama5d3xek.c +++ b/board/atmel/sama5d3xek/sama5d3xek.c @@ -12,6 +12,7 @@ #include <asm/arch/at91_rstc.h> #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> @@ -205,12 +206,22 @@ void lcd_show_board_info(void) #endif /* CONFIG_LCD_INFO */ #endif /* CONFIG_LCD */
-int board_early_init_f(void) +#ifdef CONFIG_DEBUG_UART_BOARD_INIT +void board_debug_uart_init(void) { at91_seriald_hw_init(); +} +#endif
+#ifdef CONFIG_BOARD_EARLY_INIT_F +int board_early_init_f(void) +{ +#ifdef CONFIG_DEBUG_UART + debug_uart_init(); +#endif return 0; } +#endif
int board_init(void) { diff --git a/configs/sama5d3xek_mmc_defconfig b/configs/sama5d3xek_mmc_defconfig index e71f87101d..994bc048ba 100644 --- a/configs/sama5d3xek_mmc_defconfig +++ b/configs/sama5d3xek_mmc_defconfig @@ -58,6 +58,12 @@ CONFIG_PINCTRL=y CONFIG_SPL_PINCTRL=y CONFIG_PINCTRL_AT91=y CONFIG_DM_SERIAL=y +CONFIG_DEBUG_UART=y +CONFIG_DEBUG_UART_ATMEL=y +CONFIG_DEBUG_UART_BASE=0xffffee00 +CONFIG_DEBUG_UART_CLOCK=132000000 +CONFIG_DEBUG_UART_BOARD_INIT=y +CONFIG_DEBUG_UART_ANNOUNCE=y CONFIG_ATMEL_USART=y CONFIG_DM_SPI=y CONFIG_ATMEL_SPI=y diff --git a/configs/sama5d3xek_nandflash_defconfig b/configs/sama5d3xek_nandflash_defconfig index 2cd6691f4c..dd0263cea2 100644 --- a/configs/sama5d3xek_nandflash_defconfig +++ b/configs/sama5d3xek_nandflash_defconfig @@ -53,6 +53,12 @@ CONFIG_PINCTRL=y CONFIG_SPL_PINCTRL=y CONFIG_PINCTRL_AT91=y CONFIG_DM_SERIAL=y +CONFIG_DEBUG_UART=y +CONFIG_DEBUG_UART_ATMEL=y +CONFIG_DEBUG_UART_BASE=0xffffee00 +CONFIG_DEBUG_UART_CLOCK=132000000 +CONFIG_DEBUG_UART_BOARD_INIT=y +CONFIG_DEBUG_UART_ANNOUNCE=y CONFIG_ATMEL_USART=y CONFIG_DM_SPI=y CONFIG_ATMEL_SPI=y diff --git a/configs/sama5d3xek_spiflash_defconfig b/configs/sama5d3xek_spiflash_defconfig index 748f4da77c..069fbcc0a3 100644 --- a/configs/sama5d3xek_spiflash_defconfig +++ b/configs/sama5d3xek_spiflash_defconfig @@ -54,6 +54,12 @@ CONFIG_PINCTRL=y CONFIG_SPL_PINCTRL=y CONFIG_PINCTRL_AT91=y CONFIG_DM_SERIAL=y +CONFIG_DEBUG_UART=y +CONFIG_DEBUG_UART_ATMEL=y +CONFIG_DEBUG_UART_BASE=0xffffee00 +CONFIG_DEBUG_UART_CLOCK=132000000 +CONFIG_DEBUG_UART_BOARD_INIT=y +CONFIG_DEBUG_UART_ANNOUNCE=y CONFIG_ATMEL_USART=y CONFIG_DM_SPI=y CONFIG_ATMEL_SPI=y

Update the configuration files to support the device tree and driver model, so do SPL. The device clock and pins configuration are handled by the clock and the pinctrl drivers respectively.
Signed-off-by: Wenyou Yang wenyou.yang@atmel.com ---
Changes in v4: None Changes in v3: None Changes in v2: None
configs/sama5d3_xplained_mmc_defconfig | 29 +++++++++++++++++++++++++++- configs/sama5d3_xplained_nandflash_defconfig | 28 ++++++++++++++++++++++++++- include/configs/sama5d3_xplained.h | 26 +++---------------------- 3 files changed, 58 insertions(+), 25 deletions(-)
diff --git a/configs/sama5d3_xplained_mmc_defconfig b/configs/sama5d3_xplained_mmc_defconfig index 2654aa11ba..921b6a2112 100644 --- a/configs/sama5d3_xplained_mmc_defconfig +++ b/configs/sama5d3_xplained_mmc_defconfig @@ -4,15 +4,19 @@ CONFIG_TARGET_SAMA5D3_XPLAINED=y CONFIG_SPL_GPIO_SUPPORT=y CONFIG_SPL_LIBCOMMON_SUPPORT=y CONFIG_SPL_LIBGENERIC_SUPPORT=y +CONFIG_SYS_MALLOC_F_LEN=0x2000 CONFIG_SPL_MMC_SUPPORT=y CONFIG_SPL_SERIAL_SUPPORT=y +CONFIG_SPL_DRIVERS_MISC_SUPPORT=y CONFIG_SPL_LIBDISK_SUPPORT=y CONFIG_SPL_FAT_SUPPORT=y +CONFIG_DEFAULT_DEVICE_TREE="at91-sama5d3_xplained" CONFIG_FIT=y CONFIG_SYS_EXTRA_OPTIONS="SAMA5D3,SYS_USE_MMC" CONFIG_BOOTDELAY=3 # CONFIG_DISPLAY_BOARDINFO is not set CONFIG_SPL=y +CONFIG_SPL_SEPARATE_BSS=y CONFIG_HUSH_PARSER=y CONFIG_CMD_BOOTZ=y # CONFIG_CMD_IMI is not set @@ -29,6 +33,29 @@ CONFIG_CMD_EXT4=y CONFIG_CMD_EXT4_WRITE=y CONFIG_CMD_FAT=y CONFIG_CMD_UBI=y +CONFIG_OF_CONTROL=y +CONFIG_SPL_OF_CONTROL=y +CONFIG_OF_SPL_REMOVE_PROPS="interrupts interrupt-parent dmas dma-names" +CONFIG_DM=y +CONFIG_SPL_DM=y +CONFIG_SPL_DM_SEQ_ALIAS=y +CONFIG_CLK=y +CONFIG_SPL_CLK=y +CONFIG_CLK_AT91=y +CONFIG_AT91_UTMI=y +CONFIG_AT91_H32MX=y +CONFIG_DM_GPIO=y +CONFIG_AT91_GPIO=y +CONFIG_DM_MMC=y +CONFIG_GENERIC_ATMEL_MCI=y +CONFIG_DM_ETH=y +CONFIG_MACB=y +CONFIG_PINCTRL=y +CONFIG_SPL_PINCTRL=y +CONFIG_PINCTRL_AT91=y +CONFIG_DM_SERIAL=y +CONFIG_ATMEL_USART=y CONFIG_USB=y +CONFIG_DM_USB=y +CONFIG_USB_EHCI_HCD=y CONFIG_USB_STORAGE=y -CONFIG_OF_LIBFDT=y diff --git a/configs/sama5d3_xplained_nandflash_defconfig b/configs/sama5d3_xplained_nandflash_defconfig index dc487d92e0..042f6a78e7 100644 --- a/configs/sama5d3_xplained_nandflash_defconfig +++ b/configs/sama5d3_xplained_nandflash_defconfig @@ -6,6 +6,9 @@ CONFIG_SPL_LIBCOMMON_SUPPORT=y CONFIG_SPL_LIBGENERIC_SUPPORT=y CONFIG_SPL_SERIAL_SUPPORT=y CONFIG_SPL_NAND_SUPPORT=y +CONFIG_SYS_MALLOC_F_LEN=0x2000 +CONFIG_SPL_DRIVERS_MISC_SUPPORT=y +CONFIG_DEFAULT_DEVICE_TREE="at91-sama5d3_xplained" CONFIG_FIT=y CONFIG_SYS_EXTRA_OPTIONS="SAMA5D3,SYS_USE_NANDFLASH" CONFIG_BOOTDELAY=3 @@ -27,6 +30,29 @@ CONFIG_CMD_EXT4=y CONFIG_CMD_EXT4_WRITE=y CONFIG_CMD_FAT=y CONFIG_CMD_UBI=y +CONFIG_OF_CONTROL=y +CONFIG_SPL_OF_CONTROL=y +CONFIG_OF_SPL_REMOVE_PROPS="interrupts interrupt-parent dmas dma-names" +CONFIG_DM=y +CONFIG_SPL_DM=y +CONFIG_SPL_DM_SEQ_ALIAS=y +CONFIG_CLK=y +CONFIG_SPL_CLK=y +CONFIG_CLK_AT91=y +CONFIG_AT91_UTMI=y +CONFIG_AT91_H32MX=y +CONFIG_DM_GPIO=y +CONFIG_AT91_GPIO=y +CONFIG_DM_MMC=y +CONFIG_GENERIC_ATMEL_MCI=y +CONFIG_DM_ETH=y +CONFIG_MACB=y +CONFIG_PINCTRL=y +CONFIG_SPL_PINCTRL=y +CONFIG_PINCTRL_AT91=y +CONFIG_DM_SERIAL=y +CONFIG_ATMEL_USART=y CONFIG_USB=y +CONFIG_DM_USB=y +CONFIG_USB_EHCI_HCD=y CONFIG_USB_STORAGE=y -CONFIG_OF_LIBFDT=y diff --git a/include/configs/sama5d3_xplained.h b/include/configs/sama5d3_xplained.h index 3c9f49e426..b4a62bd63a 100644 --- a/include/configs/sama5d3_xplained.h +++ b/include/configs/sama5d3_xplained.h @@ -12,11 +12,6 @@
#include "at91-sama5_common.h"
-/* serial console */ -#define CONFIG_ATMEL_USART -#define CONFIG_USART_BASE ATMEL_BASE_DBGU -#define CONFIG_USART_ID ATMEL_ID_DBGU - /* * This needs to be defined for the OHCI code to work but it is defined as * ATMEL_ID_UHPHS in the CPU specific header files. @@ -34,10 +29,10 @@ #define CONFIG_SYS_SDRAM_SIZE 0x10000000
#ifdef CONFIG_SPL_BUILD -#define CONFIG_SYS_INIT_SP_ADDR 0x310000 +#define CONFIG_SYS_INIT_SP_ADDR 0x318000 #else #define CONFIG_SYS_INIT_SP_ADDR \ - (CONFIG_SYS_SDRAM_BASE + 4 * 1024 - GENERATED_GBL_DATA_SIZE) + (CONFIG_SYS_SDRAM_BASE + 16 * 1024 - GENERATED_GBL_DATA_SIZE) #endif
/* NAND flash */ @@ -67,21 +62,6 @@ #define CONFIG_CMD_UBIFS #endif
-/* Ethernet Hardware */ -#define CONFIG_MACB -#define CONFIG_RMII -#define CONFIG_NET_RETRY_COUNT 20 -#define CONFIG_MACB_SEARCH_PHY -#define CONFIG_RGMII -#define CONFIG_PHYLIB - -/* MMC */ - -#ifdef CONFIG_CMD_MMC -#define CONFIG_GENERIC_ATMEL_MCI -#define CONFIG_ATMEL_MCI_8BIT -#endif - /* USB */
#ifdef CONFIG_CMD_USB @@ -111,7 +91,7 @@ /* SPL */ #define CONFIG_SPL_FRAMEWORK #define CONFIG_SPL_TEXT_BASE 0x300000 -#define CONFIG_SPL_MAX_SIZE 0x10000 +#define CONFIG_SPL_MAX_SIZE 0x18000 #define CONFIG_SPL_BSS_START_ADDR 0x20000000 #define CONFIG_SPL_BSS_MAX_SIZE 0x80000 #define CONFIG_SYS_SPL_MALLOC_START 0x20080000

Due to the introduction of the pinctrl and clk driver, and using device tree files, remove the unneeded hardcoded pin configuration and clock enabling code from the board file.
Signed-off-by: Wenyou Yang wenyou.yang@atmel.com ---
Changes in v4: None Changes in v3: None Changes in v2: None
board/atmel/sama5d3_xplained/sama5d3_xplained.c | 34 ------------------------- 1 file changed, 34 deletions(-)
diff --git a/board/atmel/sama5d3_xplained/sama5d3_xplained.c b/board/atmel/sama5d3_xplained/sama5d3_xplained.c index 2b9da91b2d..f2f5506adc 100644 --- a/board/atmel/sama5d3_xplained/sama5d3_xplained.c +++ b/board/atmel/sama5d3_xplained/sama5d3_xplained.c @@ -6,16 +6,12 @@ */
#include <common.h> -#include <mmc.h> #include <asm/io.h> #include <asm/arch/sama5d3_smc.h> #include <asm/arch/at91_common.h> #include <asm/arch/at91_rstc.h> #include <asm/arch/gpio.h> #include <asm/arch/clk.h> -#include <atmel_mci.h> -#include <net.h> -#include <netdev.h> #include <spl.h> #include <asm/arch/atmel_mpddrc.h> #include <asm/arch/at91_wdt.h> @@ -65,20 +61,12 @@ static void sama5d3_xplained_usb_hw_init(void) #ifdef CONFIG_GENERIC_ATMEL_MCI static void sama5d3_xplained_mci0_hw_init(void) { - at91_mci_hw_init(); - at91_set_pio_output(AT91_PIO_PORTE, 2, 0); /* MCI0 Power */ } #endif
int board_early_init_f(void) { - at91_periph_clk_enable(ATMEL_ID_PIOA); - at91_periph_clk_enable(ATMEL_ID_PIOB); - at91_periph_clk_enable(ATMEL_ID_PIOC); - at91_periph_clk_enable(ATMEL_ID_PIOD); - at91_periph_clk_enable(ATMEL_ID_PIOE); - at91_seriald_hw_init();
return 0; @@ -98,10 +86,6 @@ int board_init(void) #ifdef CONFIG_GENERIC_ATMEL_MCI sama5d3_xplained_mci0_hw_init(); #endif -#ifdef CONFIG_MACB - at91_gmac_hw_init(); - at91_macb_hw_init(); -#endif return 0; }
@@ -113,24 +97,6 @@ int dram_init(void) return 0; }
-int board_eth_init(bd_t *bis) -{ -#ifdef CONFIG_MACB - macb_eth_initialize(0, (void *)ATMEL_BASE_GMAC, 0x00); - macb_eth_initialize(0, (void *)ATMEL_BASE_EMAC, 0x00); -#endif - return 0; -} - -#ifdef CONFIG_GENERIC_ATMEL_MCI -int board_mmc_init(bd_t *bis) -{ - atmel_mci_init((void *)ATMEL_BASE_MCI0); - - return 0; -} -#endif - /* SPL */ #ifdef CONFIG_SPL_BUILD void spl_board_init(void)

Enable the early debug UART to debug problems when an ICE or other debug mechanism is not available.
Signed-off-by: Wenyou Yang wenyou.yang@atmel.com ---
Changes in v4: None Changes in v3: - Convert the macb to support DM and clean up macb init code. - Remain the SPI speed macros. - Update the config options for SPL. - Update the commit log. - Remove the unneeded dbgu init during board_early_init_f stage. - Use CONFIG_DEBUG_UART_CLOCK as the input clock for the early debug uart. - Drop [PATCH] configs: sama5d3_xplained: move CONFIG_SYS_NO_FLASH to defconfig. - Rebase on v2017.03.
Changes in v2: - rebase on the patch set: [PATCH v3 0/8] board: sama5d4: convert boards to support DM/DT http://lists.denx.de/pipermail/u-boot/2017-February/280506.html
board/atmel/sama5d3_xplained/sama5d3_xplained.c | 13 ++++++++++++- configs/sama5d3_xplained_mmc_defconfig | 6 ++++++ configs/sama5d3_xplained_nandflash_defconfig | 6 ++++++ 3 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/board/atmel/sama5d3_xplained/sama5d3_xplained.c b/board/atmel/sama5d3_xplained/sama5d3_xplained.c index f2f5506adc..21f332b382 100644 --- a/board/atmel/sama5d3_xplained/sama5d3_xplained.c +++ b/board/atmel/sama5d3_xplained/sama5d3_xplained.c @@ -12,6 +12,7 @@ #include <asm/arch/at91_rstc.h> #include <asm/arch/gpio.h> #include <asm/arch/clk.h> +#include <debug_uart.h> #include <spl.h> #include <asm/arch/atmel_mpddrc.h> #include <asm/arch/at91_wdt.h> @@ -65,12 +66,22 @@ static void sama5d3_xplained_mci0_hw_init(void) } #endif
-int board_early_init_f(void) +#ifdef CONFIG_DEBUG_UART_BOARD_INIT +void board_debug_uart_init(void) { at91_seriald_hw_init(); +} +#endif
+#ifdef CONFIG_BOARD_EARLY_INIT_F +int board_early_init_f(void) +{ +#ifdef CONFIG_DEBUG_UART + debug_uart_init(); +#endif return 0; } +#endif
int board_init(void) { diff --git a/configs/sama5d3_xplained_mmc_defconfig b/configs/sama5d3_xplained_mmc_defconfig index 921b6a2112..d28d1d9a33 100644 --- a/configs/sama5d3_xplained_mmc_defconfig +++ b/configs/sama5d3_xplained_mmc_defconfig @@ -54,6 +54,12 @@ CONFIG_PINCTRL=y CONFIG_SPL_PINCTRL=y CONFIG_PINCTRL_AT91=y CONFIG_DM_SERIAL=y +CONFIG_DEBUG_UART=y +CONFIG_DEBUG_UART_ATMEL=y +CONFIG_DEBUG_UART_BASE=0xffffee00 +CONFIG_DEBUG_UART_CLOCK=132000000 +CONFIG_DEBUG_UART_BOARD_INIT=y +CONFIG_DEBUG_UART_ANNOUNCE=y CONFIG_ATMEL_USART=y CONFIG_USB=y CONFIG_DM_USB=y diff --git a/configs/sama5d3_xplained_nandflash_defconfig b/configs/sama5d3_xplained_nandflash_defconfig index 042f6a78e7..8cc8169de5 100644 --- a/configs/sama5d3_xplained_nandflash_defconfig +++ b/configs/sama5d3_xplained_nandflash_defconfig @@ -51,6 +51,12 @@ CONFIG_PINCTRL=y CONFIG_SPL_PINCTRL=y CONFIG_PINCTRL_AT91=y CONFIG_DM_SERIAL=y +CONFIG_DEBUG_UART=y +CONFIG_DEBUG_UART_ATMEL=y +CONFIG_DEBUG_UART_BASE=0xffffee00 +CONFIG_DEBUG_UART_CLOCK=132000000 +CONFIG_DEBUG_UART_BOARD_INIT=y +CONFIG_DEBUG_UART_ANNOUNCE=y CONFIG_ATMEL_USART=y CONFIG_USB=y CONFIG_DM_USB=y
participants (1)
-
Wenyou Yang