board: at91sam9m10g45ek: Convert to support DM and DT
v4 cover board: at91sam9m10g45ek: Convert to support DM and DT
The purpose of the patch set is to convert the board to support the driver model and the device tree.
The patch set is based on the patch set:
1./ [PATCH v3 0/6] ARM: dts: at91: Add dts files for AT91 SoCs' boards
https://lists.denx.de/pipermail/u-boot/2017-April/287845.html
Changes in v4:
- Adjust CONFIG_ENV_OFFSET for NAND to avoid the conflict caused by the increased binary size.
- Rebase on the master branch(ad46af0e76) of u-boot-dm git tree.
- Update the cover-letter.
- Add Reviewed-by tag
Changes in v3:
- Rebase on the master branch (22e10be45) of u-boot-dm git tree.
- Update the cover-letter.
Changes in v2:
- Add the support of Atmel uart device be used in the board_init_f stage.
- Remove unused LED feature.
- Disable the SPL options.
- Move out [PATCH] ARM: dts: at91: Add dts files for at91sam9m10g45ek.
- Add [PATCH] board: at91sam9m10g45ek: Enable early debug UART
Wenyou Yang (3):
configs: at91sam9m10g45ek: Update to support DM/DT
board: at91sam9m10g45ek: Clean up code
board: at91sam9m10g45ek: Enable early debug UART
board/atmel/at91sam9m10g45ek/Makefile | 2 +- board/atmel/at91sam9m10g45ek/at91sam9m10g45ek.c | 107 ++---------------------- configs/at91sam9m10g45ek_mmc_defconfig | 34 ++++++-- configs/at91sam9m10g45ek_nandflash_defconfig | 32 +++++-- include/configs/at91sam9m10g45ek.h | 31 +------ 5 files changed, 62 insertions(+), 144 deletions(-)
Signature · 1 line
2.11.0
PATCH v4 1/3 configs: at91sam9m10g45ek: Update to support DM/DT
Update the configuration files to support the device tree and driver model. The device clock and pins configuration are handled by the clock and the pinctrl drivers respectively.
Because the limitation of internal SRAM size, the SPL with driver model can't be supported, disable the SPL option.
---
Changes in v4:
- Adjust CONFIG_ENV_OFFSET for NAND to avoid the conflict caused by the increased binary size.
Changes in v3: None
Changes in v2:
- Add the support of Atmel uart device be used in the board_init_f stage.
- Remove unused LED feature.
- Disable the SPL options.
board/atmel/at91sam9m10g45ek/Makefile | 2 +- configs/at91sam9m10g45ek_mmc_defconfig | 28 +++++++++++++++++-------- configs/at91sam9m10g45ek_nandflash_defconfig | 26 ++++++++++++++++------- include/configs/at91sam9m10g45ek.h | 31 ++-------------------------- 4 files changed, 41 insertions(+), 46 deletions(-)
board/atmel/at91sam9m10g45ek/Makefile +1 -1
@@ -10,4 +10,4 @@ # obj-y += at91sam9m10g45ek.o -obj-y += led.o +obj-(CONFIG_AT91_LED) += led.o
configs/at91sam9m10g45ek_mmc_defconfig +19 -9
@@ -1,19 +1,13 @@ CONFIG_ARM=y CONFIG_ARCH_AT91=y CONFIG_TARGET_AT91SAM9M10G45EK=y -CONFIG_SPL_GPIO_SUPPORT=y -CONFIG_SPL_LIBCOMMON_SUPPORT=y -CONFIG_SPL_LIBGENERIC_SUPPORT=y -CONFIG_SPL_MMC_SUPPORT=y -CONFIG_SPL_SERIAL_SUPPORT=y -CONFIG_SPL_LIBDISK_SUPPORT=y -CONFIG_SPL_FAT_SUPPORT=y +CONFIG_SYS_MALLOC_F_LEN=0x2000 +CONFIG_DEFAULT_DEVICE_TREE="at91sam9m10g45ek" CONFIG_SYS_EXTRA_OPTIONS="AT91SAM9M10G45,SYS_USE_MMC" 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_SYS_PROMPT="U-Boot> " # CONFIG_CMD_BDI is not set
@@ -29,7 +23,23 @@ CONFIG_CMD_USB=y CONFIG_CMD_DHCP=y CONFIG_CMD_PING=y CONFIG_CMD_FAT=y +CONFIG_OF_CONTROL=y +CONFIG_DM=y +CONFIG_CLK=y +CONFIG_CLK_AT91=y +CONFIG_AT91_UTMI=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_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_LCD=y -CONFIG_OF_LIBFDT=y
configs/at91sam9m10g45ek_nandflash_defconfig +19 -7
@@ -1,17 +1,13 @@ CONFIG_ARM=y CONFIG_ARCH_AT91=y CONFIG_TARGET_AT91SAM9M10G45EK=y -CONFIG_SPL_GPIO_SUPPORT=y -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_DEFAULT_DEVICE_TREE="at91sam9m10g45ek" CONFIG_SYS_EXTRA_OPTIONS="AT91SAM9M10G45,SYS_USE_NANDFLASH" 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_SYS_PROMPT="U-Boot> " # CONFIG_CMD_BDI is not set
@@ -27,7 +23,23 @@ CONFIG_CMD_USB=y CONFIG_CMD_DHCP=y CONFIG_CMD_PING=y CONFIG_CMD_FAT=y +CONFIG_OF_CONTROL=y +CONFIG_DM=y +CONFIG_CLK=y +CONFIG_CLK_AT91=y +CONFIG_AT91_UTMI=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_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_LCD=y -CONFIG_OF_LIBFDT=y
include/configs/at91sam9m10g45ek.h +2 -29
@@ -30,13 +30,6 @@/* general purpose I/O */ #define CONFIG_ATMEL_LEGACY /* required until (g)pio is fixed */ -#define CONFIG_AT91_GPIO -#define CONFIG_AT91_GPIO_PULLUP 1/* keep pullups on peripheral pins */ - -/* serial console */ -#define CONFIG_ATMEL_USART -#define CONFIG_USART_BASE ATMEL_BASE_DBGU -#define CONFIG_USART_ID ATMEL_ID_SYS/* LCD */ #define LCD_BPP LCD_COLOR8
@@ -50,12 +43,6 @@/* board specific(not enough SRAM) */ #define CONFIG_AT91SAM9G45_LCD_BASE 0x73E00000 -/* LED */ -#define CONFIG_AT91_LED -#define CONFIG_RED_LED AT91_PIN_PD31/* this is the user1 led */ -#define CONFIG_GREEN_LED AT91_PIN_PD0/* this is the user2 led */ - -/* * BOOTP options */
@@ -76,7 +63,7 @@#define CONFIG_SYS_SDRAM_SIZE 0x08000000#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)/* NAND flash */ #ifdef CONFIG_CMD_NAND
@@ -93,24 +80,10 @@#endif -/* MMC */ - -#ifdef CONFIG_CMD_MMC -#define CONFIG_GENERIC_ATMEL_MCI -#endif -/* Ethernet */ -#define CONFIG_MACB -#define CONFIG_RMII -#define CONFIG_NET_RETRY_COUNT 20#define CONFIG_RESET_PHY_R #define CONFIG_AT91_WANTS_COMMON_PHY -/* USB */ -#define CONFIG_USB_EHCI -#define CONFIG_USB_EHCI_ATMEL -#define CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS 2 -#define CONFIG_SYS_LOAD_ADDR 0x22000000/* load address */ #define CONFIG_SYS_MEMTEST_START CONFIG_SYS_SDRAM_BASE
@@ -119,7 +92,7 @@#ifdef CONFIG_SYS_USE_NANDFLASH /* bootstrap + u-boot + env in nandflash */ #define CONFIG_ENV_IS_IN_NAND -#define CONFIG_ENV_OFFSET 0xc0000 +#define CONFIG_ENV_OFFSET 0x120000#define CONFIG_ENV_OFFSET_REDUND 0x100000#define CONFIG_ENV_SIZE 0x20000
Signature · 1 line
2.11.0
PATCH v4 1/3 configs: at91sam9m10g45ek: Update to support DM/DT
Update the configuration files to support the device tree and driver model. The device clock and pins configuration are handled by the clock and the pinctrl drivers respectively.
Because the limitation of internal SRAM size, the SPL with driver model can't be supported, disable the SPL option.
---
Changes in v4:
- Adjust CONFIG_ENV_OFFSET for NAND to avoid the conflict caused by the increased binary size.
Changes in v3: None
Changes in v2:
- Add the support of Atmel uart device be used in the board_init_f stage.
- Remove unused LED feature.
- Disable the SPL options.
board/atmel/at91sam9m10g45ek/Makefile | 2 +- configs/at91sam9m10g45ek_mmc_defconfig | 28 +++++++++++++++++-------- configs/at91sam9m10g45ek_nandflash_defconfig | 26 ++++++++++++++++------- include/configs/at91sam9m10g45ek.h | 31 ++-------------------------- 4 files changed, 41 insertions(+), 46 deletions(-)
Applied to u-boot-dm/next, thanks!
PATCH v4 2/3 board: at91sam9m10g45ek: Clean up code
In reply to Wenyou YangSince the introduction of the pinctrl and clk drivers and the device tree files, remove unneeded hard coded related code from the board file.
---
Changes in v4: None
Changes in v3: None
Changes in v2: None
board/atmel/at91sam9m10g45ek/at91sam9m10g45ek.c | 102 ------------------------ 1 file changed, 102 deletions(-)
board/atmel/at91sam9m10g45ek/at91sam9m10g45ek.c +0 -102
@@ -17,11 +17,6 @@#include <lcd.h> #include <linux/mtd/nand.h> #include <atmel_lcdc.h> -#include <atmel_mci.h> -#if defined(CONFIG_RESET_PHY_R ) && defined(CONFIG_MACB ) -#include <net.h> -#endif -#include <netdev.h> DECLARE_GLOBAL_DATA_PTR ;
@@ -149,39 +144,6 @@ static void at91sam9m10g45ek_usb_hw_init(void) }#endif -#ifdef CONFIG_MACB -static void at91sam9m10g45ek_macb_hw_init (void ) -{ -struct at91_port *pioa = (struct at91_port *)ATMEL_BASE_PIOA ; - -at91_periph_clk_enable (ATMEL_ID_EMAC ); - -/* -* Disable pull-up on: -* RXDV (PA15) => PHY normal mode (not Test mode) -* ERX0 (PA12) => PHY ADDR0 -* ERX1 (PA13) => PHY ADDR1 => PHYADDR = 0x0 -* -* PHY has internal pull-down -*/ -writel (pin_to_mask (AT91_PIN_PA15 ) | -pin_to_mask (AT91_PIN_PA12 ) | -pin_to_mask (AT91_PIN_PA13 ), - &pioa->pudr); - -at91_phy_reset (); - -/* Re-enable pull-up */ -writel (pin_to_mask (AT91_PIN_PA15 ) | -pin_to_mask (AT91_PIN_PA12 ) | -pin_to_mask (AT91_PIN_PA13 ), - &pioa->puer); - -/* And the pins. */ -at91_macb_hw_init (); -} -#endif -#ifdef CONFIG_LCD vidinfo_t panel_info = {
@@ -280,18 +242,8 @@ void lcd_show_board_info(void)#endif /* CONFIG_LCD_INFO */ #endif -#ifdef CONFIG_GENERIC_ATMEL_MCI -int board_mmc_init (bd_t *bis) -{ -at91_mci_hw_init (); - -return atmel_mci_init ((void *)ATMEL_BASE_MCI0 ); -} -#endif -int board_early_init_f (void ) { -at91_seriald_hw_init ();return 0 ; }
@@ -313,15 +265,6 @@ int board_init(void)#ifdef CONFIG_CMD_USB at91sam9m10g45ek_usb_hw_init ();#endif -#ifdef CONFIG_HAS_DATAFLASH -at91_spi0_hw_init (1 <<0 ); -#endif -#ifdef CONFIG_ATMEL_SPI -at91_spi0_hw_init (1 <<4 ); -#endif -#ifdef CONFIG_MACB -at91sam9m10g45ek_macb_hw_init (); -#endif #ifdef CONFIG_LCD at91sam9m10g45ek_lcd_hw_init ();#endif
@@ -340,48 +283,3 @@ void reset_phy(void) { }#endif - -int board_eth_init (bd_t *bis) -{ -int rc =0 ; -#ifdef CONFIG_MACB - rc =macb_eth_initialize (0 , (void *)ATMEL_BASE_EMAC ,0x00 ); -#endif -return rc; -} - -/* SPI chip select control */ -#ifdef CONFIG_ATMEL_SPI -#include <spi.h> - -int spi_cs_is_valid (unsigned int bus,unsigned int cs) -{ -return bus ==0 && cs <2 ; -} - -void spi_cs_activate (struct spi_slave *slave) -{ -switch (slave->cs) { -case 1 : -at91_set_gpio_output (AT91_PIN_PB18 ,0 ); -break ; -case 0 : -default : -at91_set_gpio_output (AT91_PIN_PB3 ,0 ); -break ; - } -} - -void spi_cs_deactivate (struct spi_slave *slave) -{ -switch (slave->cs) { -case 1 : -at91_set_gpio_output (AT91_PIN_PB18 ,1 ); -break ; -case 0 : -default : -at91_set_gpio_output (AT91_PIN_PB3 ,1 ); -break ; - } -} -#endif /* CONFIG_ATMEL_SPI */
Signature · 1 line
2.11.0
PATCH v4 2/3 board: at91sam9m10g45ek: Clean up code
Since the introduction of the pinctrl and clk drivers and the device tree files, remove unneeded hard coded related code from the board file.
---
Changes in v4: None
Changes in v3: None
Changes in v2: None
board/atmel/at91sam9m10g45ek/at91sam9m10g45ek.c | 102 ------------------------ 1 file changed, 102 deletions(-)
Applied to u-boot-dm/next, thanks!
PATCH v4 3/3 board: at91sam9m10g45ek: Enable early debug UART
In reply to Wenyou YangEnable the early debug UART to debug problems when an ICE or other debug mechanism is not available.
---
Changes in v4:
- Rebase on the master branch(ad46af0e76) of u-boot-dm git tree.
- Update the cover-letter.
- Add Reviewed-by tag
Changes in v3:
- Rebase on the master branch (22e10be45) of u-boot-dm git tree.
- Update the cover-letter.
Changes in v2:
- Move out [PATCH] ARM: dts: at91: Add dts files for at91sam9m10g45ek.
- Add [PATCH] board: at91sam9m10g45ek: Enable early debug UART
board/atmel/at91sam9m10g45ek/at91sam9m10g45ek.c | 13 +++++++++++++ configs/at91sam9m10g45ek_mmc_defconfig | 6 ++++++ configs/at91sam9m10g45ek_nandflash_defconfig | 6 ++++++ 3 files changed, 25 insertions(+)
board/atmel/at91sam9m10g45ek/at91sam9m10g45ek.c +13 -0
@@ -7,6 +7,7 @@*/ #include <common.h> +#include <debug_uart.h> #include <asm/io.h> #include <asm/arch/clk.h> #include <asm/arch/at91sam9g45_matrix.h>
@@ -242,10 +243,22 @@ void lcd_show_board_info(void)#endif /* CONFIG_LCD_INFO */ #endif +#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 ) {
configs/at91sam9m10g45ek_mmc_defconfig +6 -0
@@ -37,6 +37,12 @@ CONFIG_MACB=y CONFIG_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
configs/at91sam9m10g45ek_nandflash_defconfig +6 -0
@@ -37,6 +37,12 @@ CONFIG_MACB=y CONFIG_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
Signature · 1 line
2.11.0
Yang
PATCH v4 3/3 board: at91sam9m10g45ek: Enable early debug UART
Hi Simon,
The patches has been rebased on the master branch of u-boot-dm git tree
Could you help take them?
Best Regards,
Wenyou Yang
Quoted 94 lines · Wenyou Yang
Enable the early debug UART to debug problems when an ICE or other debug mechanism is not available.
Signed-off-by Wenyou Yang <[email protected]>Reviewed-by Simon Glass <[email protected]>---
Changes in v4:
- Rebase on the master branch(ad46af0e76) of u-boot-dm git tree.
- Update the cover-letter.
- Add Reviewed-by tagChanges in v3:
- Rebase on the master branch (22e10be45) of u-boot-dm git tree.
- Update the cover-letter.Changes in v2:
- Move out [PATCH] ARM: dts: at91: Add dts files for at91sam9m10g45ek.
- Add [PATCH] board: at91sam9m10g45ek: Enable early debug UARTboard/atmel/at91sam9m10g45ek/at91sam9m10g45ek.c | 13 +++++++++++++ configs/at91sam9m10g45ek_mmc_defconfig | 6 ++++++ configs/at91sam9m10g45ek_nandflash_defconfig | 6 ++++++ 3 files changed, 25 insertions(+)board/atmel/at91sam9m10g45ek/at91sam9m10g45ek.c +13
-0@@ -7,6 +7,7 @@*/ #include <common.h> +#include <debug_uart.h> #include <asm/io.h> #include <asm/arch/clk.h> #include <asm/arch/at91sam9g45_matrix.h> @@ -242,10 +243,22 @@ void lcd_show_board_info(void)#endif /* CONFIG_LCD_INFO */ #endif +#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 ) {configs/at91sam9m10g45ek_mmc_defconfig +6
-0@@ -37,6 +37,12 @@ CONFIG_MACB=y CONFIG_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=yconfigs/at91sam9m10g45ek_nandflash_defconfig +6
-0@@ -37,6 +37,12 @@ CONFIG_MACB=y CONFIG_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
PATCH v4 3/3 board: at91sam9m10g45ek: Enable early debug UART
Hi Simon,
The patches has been rebased on the master branch of u-boot-dm git tree
Could you help take them?
Best Regards,
Wenyou Yang
Quoted 16 lines · Wenyou Yang
Enable the early debug UART to debug problems when an ICE or other debug mechanism is not available.
Signed-off-by Wenyou Yang <[email protected]>Reviewed-by Simon Glass <[email protected]>---
Changes in v4:
- Rebase on the master branch(ad46af0e76) of u-boot-dm git tree.
- Update the cover-letter.
- Add Reviewed-by tagChanges in v3:
- Rebase on the master branch (22e10be45) of u-boot-dm git tree.
- Update the cover-letter.
Quoted 9 lines
Changes in v2:
- Move out [PATCH] ARM: dts: at91: Add dts files for at91sam9m10g45ek.
- Add [PATCH] board: at91sam9m10g45ek: Enable early debug UARTboard/atmel/at91sam9m10g45ek/at91sam9m10g45ek.c | 13 +++++++++++++ configs/at91sam9m10g45ek_mmc_defconfig | 6 ++++++ configs/at91sam9m10g45ek_nandflash_defconfig | 6 ++++++ 3 files changed, 25 insertions(+)
Applied to u-boot-dm/next, thanks!