From: =?UTF-8?Q?Andreas_Bie=c3=9fmann?= Date: Sat, 25 Jun 2016 23:35:31 +0200 Subject: [U-Boot] [PATCH v1 2/5] corvus DTS / DM support In-Reply-To: <1464153828-13837-3-git-send-email-hs@denx.de> References: <1464153828-13837-1-git-send-email-hs@denx.de> <1464153828-13837-3-git-send-email-hs@denx.de> Message-ID: <40e45ecb-e8c8-92fd-0aba-ff312fed37de@biessmann.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 25.05.16 07:23, Heiko Schocher wrote: > Signed-off-by: Heiko Schocher Reviewed-by: Andreas Bie?mann with some nits below ... > --- > > arch/arm/dts/Makefile | 2 +- > arch/arm/dts/at91sam9g45-corvus.dts | 108 ++++++++++++++++++++++++++++++++++++ > arch/arm/mach-at91/Kconfig | 4 ++ > board/siemens/corvus/board.c | 41 +++++++++++++- > configs/corvus_defconfig | 8 +++ > include/configs/corvus.h | 2 +- > 6 files changed, 160 insertions(+), 5 deletions(-) > create mode 100644 arch/arm/dts/at91sam9g45-corvus.dts > > diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile > index 3bfce04..a8c4fd2 100644 > --- a/arch/arm/dts/Makefile > +++ b/arch/arm/dts/Makefile > @@ -2,7 +2,7 @@ > # SPDX-License-Identifier: GPL-2.0+ > # > > -dtb-$(CONFIG_AT91FAMILY) += at91sam9g45-gurnard.dtb > +dtb-$(CONFIG_AT91FAMILY) += at91sam9g45-corvus.dtb We should not remove the newly introduced gurnard board here ... I'll adopt it while applying. > dtb-$(CONFIG_S5PC100) += s5pc1xx-smdkc100.dtb > dtb-$(CONFIG_S5PC110) += s5pc1xx-goni.dtb > dtb-$(CONFIG_EXYNOS4) += exynos4210-origen.dtb \ > diff --git a/arch/arm/dts/at91sam9g45-corvus.dts b/arch/arm/dts/at91sam9g45-corvus.dts > new file mode 100644 > index 0000000..c207c02 > --- /dev/null > +++ b/arch/arm/dts/at91sam9g45-corvus.dts > @@ -0,0 +1,108 @@ > +/* > + * at91sam9g45-corvus.dts Device Tree file fir Siemens corvus board > + * (C) Copyright 2016 Heiko Schocher > + * > + * based on: > + * at91sam9m10g45ek.dts - Device Tree file for AT91SAM9M10G45-EK board > + * > + * Copyright (C) 2011 Atmel, > + * 2011 Nicolas Ferre > + * > + * SPDX-License-Identifier: GPL-2.0+ > + */ > +/dts-v1/; > +#include "at91sam9g45.dtsi" > + > +/ { > + model = "Siemens corvus"; > + compatible = "atmel,at91sam9m10g45ek", "atmel,at91sam9g45", "atmel,at91sam9"; > + > + chosen { > + stdout-path = &dbgu; > + }; > + > + memory { > + reg = <0x70000000 0x8000000>; > + }; > + > + clocks { > + slow_xtal { > + clock-frequency = <32768>; > + }; > + > + main_xtal { > + clock-frequency = <12000000>; > + }; > + }; > + > + ahb { > + apb { > + dbgu: serial at ffffee00 { > + status = "okay"; > + }; > + > + usart1: serial at fff90000 { > + pinctrl-0 = > + <&pinctrl_usart1 > + &pinctrl_usart1_rts > + &pinctrl_usart1_cts>; > + status = "okay"; > + }; > + > + macb0: ethernet at fffbc000 { > + phy-mode = "rmii"; > + status = "okay"; > + }; > + > + watchdog at fffffd40 { > + status = "okay"; > + }; > + > + spi0: spi at fffa4000{ > + status = "okay"; > + cs-gpios = <&pioB 3 0>, <0>, <0>, <0>; > + mtd_dataflash at 0 { > + compatible = "atmel,at45", "atmel,dataflash"; > + spi-max-frequency = <13000000>; > + reg = <0>; > + }; > + }; > + > + usb2: gadget at fff78000 { > + atmel,vbus-gpio = <&pioB 19 GPIO_ACTIVE_HIGH>; > + status = "okay"; > + }; > + > + rtc at fffffd20 { > + atmel,rtt-rtc-time-reg = <&gpbr 0x0>; > + status = "okay"; > + }; > + > + gpbr: syscon at fffffd60 { > + status = "okay"; > + }; > + > + rtc at fffffdb0 { > + status = "okay"; > + }; > + }; > + > + nand0: nand at 40000000 { > + nand-bus-width = <8>; > + nand-ecc-mode = "soft"; > + nand-on-flash-bbt; > + status = "okay"; > + }; > + > + usb0: ohci at 00700000 { > + status = "okay"; > + num-ports = <2>; > + atmel,vbus-gpio = <&pioD 1 GPIO_ACTIVE_LOW > + &pioD 3 GPIO_ACTIVE_LOW>; > + }; > + > + usb1: ehci at 00800000 { > + status = "okay"; > + }; > + }; > +}; > diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig > index 9ce775e..7933137 100644 > --- a/arch/arm/mach-at91/Kconfig > +++ b/arch/arm/mach-at91/Kconfig > @@ -109,6 +109,10 @@ config TARGET_CORVUS > bool "Support corvus" > select CPU_ARM926EJS > select SUPPORT_SPL > + select DM > + select DM_SERIAL > + select DM_GPIO > + select DM_ETH > > config TARGET_TAURUS > bool "Support taurus" > diff --git a/board/siemens/corvus/board.c b/board/siemens/corvus/board.c > index 9d52661..d4416e6 100644 > --- a/board/siemens/corvus/board.c > +++ b/board/siemens/corvus/board.c > @@ -11,21 +11,23 @@ > * SPDX-License-Identifier: GPL-2.0+ > */ > > - > #include > +#include > #include > #include > #include > #include > #include > +#include > #include > +#include > #include > -#include > -#include > #if defined(CONFIG_RESET_PHY_R) && defined(CONFIG_MACB) > #include > #endif > +#ifndef CONFIG_DM_ETH > #include > +#endif > #include > > #ifdef CONFIG_USB_GADGET_ATMEL_USBA > @@ -34,6 +36,24 @@ > > DECLARE_GLOBAL_DATA_PTR; > > +static void corvus_request_gpio(void) > +{ > + gpio_request(CONFIG_SYS_NAND_ENABLE_PIN, "nand ena"); > + gpio_request(CONFIG_SYS_NAND_READY_PIN, "nand rdy"); > + gpio_request(AT91_PIN_PD7, "d0"); > + gpio_request(AT91_PIN_PD8, "d1"); > + gpio_request(AT91_PIN_PA12, "d2"); > + gpio_request(AT91_PIN_PA13, "d3"); > + gpio_request(AT91_PIN_PA15, "d4"); > + gpio_request(AT91_PIN_PB7, "recovery button"); > + gpio_request(AT91_PIN_PD1, "USB0"); > + gpio_request(AT91_PIN_PD3, "USB1"); > + gpio_request(AT91_PIN_PB18, "SPICS1"); > + gpio_request(AT91_PIN_PB3, "SPICS0"); > + gpio_request(CONFIG_RED_LED, "red led"); > + gpio_request(CONFIG_GREEN_LED, "green led"); > +} > + > static void corvus_nand_hw_init(void) > { > struct at91_smc *smc = (struct at91_smc *)ATMEL_BASE_SMC; > @@ -78,6 +98,7 @@ static void corvus_nand_hw_init(void) > > void spl_board_init(void) > { > + corvus_request_gpio(); > /* > * For on the sam9m10g45ek board, the chip wm9711 stay in the test > * mode, so it need do some action to exit mode. > @@ -200,6 +221,7 @@ static void corvus_macb_hw_init(void) > int board_early_init_f(void) > { > at91_seriald_hw_init(); > + corvus_request_gpio(); > return 0; > } > > @@ -220,6 +242,8 @@ int board_init(void) > /* address of boot parameters */ > gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100; > > + /* we have to request the gpios again after relocation */ > + corvus_request_gpio(); > #ifdef CONFIG_CMD_NAND > corvus_nand_hw_init(); > #endif > @@ -249,6 +273,7 @@ int dram_init(void) > return 0; > } > > +#ifndef CONFIG_DM_ETH > int board_eth_init(bd_t *bis) > { > int rc = 0; > @@ -257,6 +282,7 @@ int board_eth_init(bd_t *bis) > #endif > return rc; > } > +#endif > > /* SPI chip select control */ > int spi_cs_is_valid(unsigned int bus, unsigned int cs) > @@ -289,3 +315,12 @@ void spi_cs_deactivate(struct spi_slave *slave) > break; > } > } > + > +static struct atmel_serial_platdata at91sam9260_serial_plat = { > + .base_addr = ATMEL_BASE_DBGU, > +}; > + > +U_BOOT_DEVICE(at91sam9260_serial) = { > + .name = "serial_atmel", > + .platdata = &at91sam9260_serial_plat, > +}; > diff --git a/configs/corvus_defconfig b/configs/corvus_defconfig > index 37488dd..31ebe4c 100644 > --- a/configs/corvus_defconfig > +++ b/configs/corvus_defconfig > @@ -1,6 +1,7 @@ > CONFIG_ARM=y > CONFIG_ARCH_AT91=y > CONFIG_TARGET_CORVUS=y > +CONFIG_DEFAULT_DEVICE_TREE="at91sam9g45-corvus" > CONFIG_SPL=y > CONFIG_SYS_EXTRA_OPTIONS="AT91SAM9M10G45,MACH_TYPE=2066,SYS_USE_NANDFLASH" > CONFIG_HUSH_PARSER=y > @@ -13,6 +14,8 @@ CONFIG_CMD_BOOTZ=y > CONFIG_CMD_USB=y > CONFIG_CMD_DFU=y > # CONFIG_CMD_FPGA is not set > +CONFIG_CMD_GPIO=y > +# CONFIG_CMD_SOURCE is not set > # CONFIG_CMD_SETEXPR is not set > CONFIG_CMD_DHCP=y > CONFIG_CMD_PING=y > @@ -24,3 +27,8 @@ CONFIG_G_DNL_MANUFACTURER="Siemens AG" > CONFIG_G_DNL_VENDOR_NUM=0x0908 > CONFIG_G_DNL_PRODUCT_NUM=0x02d2 > CONFIG_OF_LIBFDT=y > +CONFIG_OF_CONTROL=y > +CONFIG_OF_EMBED=y > +CONFIG_USB=y > +CONFIG_USB_GADGET=y > +# CONFIG_EFI_LOADER is not set > diff --git a/include/configs/corvus.h b/include/configs/corvus.h > index 8b3c715..b61888f 100644 > --- a/include/configs/corvus.h > +++ b/include/configs/corvus.h > @@ -35,7 +35,7 @@ > #define CONFIG_CMDLINE_TAG /* enable passing of ATAGs */ > #define CONFIG_SETUP_MEMORY_TAGS > #define CONFIG_INITRD_TAG > -#define CONFIG_SKIP_LOWLEVEL_INIT > +#define CONFIG_SKIP_LOWLEVEL_INIT_ONLY > #define CONFIG_BOARD_EARLY_INIT_F > #define CONFIG_DISPLAY_CPUINFO > >