From: Heiko Schocher Date: Wed, 25 May 2016 05:23:45 +0000 (+0200) Subject: corvus DTS / DM support X-Git-Tag: v2016.07-rc3~27 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=289f979cc9585b68ff74971d90512847f9b3c868;p=u-boot corvus DTS / DM support Signed-off-by: Heiko Schocher Reviewed-by: Andreas Bießmann [rebase on current ToT, don't delete gurnard DTB creation] Signed-off-by: Andreas Bießmann --- diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index de75e24d1b..5338a39bba 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile @@ -2,7 +2,9 @@ # SPDX-License-Identifier: GPL-2.0+ # -dtb-$(CONFIG_AT91FAMILY) += at91sam9g45-gurnard.dtb +dtb-$(CONFIG_AT91FAMILY) += at91sam9g45-corvus.dtb \ + at91sam9g45-gurnard.dtb + 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 0000000000..c207c02858 --- /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@ffffee00 { + status = "okay"; + }; + + usart1: serial@fff90000 { + pinctrl-0 = + <&pinctrl_usart1 + &pinctrl_usart1_rts + &pinctrl_usart1_cts>; + status = "okay"; + }; + + macb0: ethernet@fffbc000 { + phy-mode = "rmii"; + status = "okay"; + }; + + watchdog@fffffd40 { + status = "okay"; + }; + + spi0: spi@fffa4000{ + status = "okay"; + cs-gpios = <&pioB 3 0>, <0>, <0>, <0>; + mtd_dataflash@0 { + compatible = "atmel,at45", "atmel,dataflash"; + spi-max-frequency = <13000000>; + reg = <0>; + }; + }; + + usb2: gadget@fff78000 { + atmel,vbus-gpio = <&pioB 19 GPIO_ACTIVE_HIGH>; + status = "okay"; + }; + + rtc@fffffd20 { + atmel,rtt-rtc-time-reg = <&gpbr 0x0>; + status = "okay"; + }; + + gpbr: syscon@fffffd60 { + status = "okay"; + }; + + rtc@fffffdb0 { + status = "okay"; + }; + }; + + nand0: nand@40000000 { + nand-bus-width = <8>; + nand-ecc-mode = "soft"; + nand-on-flash-bbt; + status = "okay"; + }; + + usb0: ohci@00700000 { + status = "okay"; + num-ports = <2>; + atmel,vbus-gpio = <&pioD 1 GPIO_ACTIVE_LOW + &pioD 3 GPIO_ACTIVE_LOW>; + }; + + usb1: ehci@00800000 { + status = "okay"; + }; + }; +}; diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig index 6180699fed..0ff0d1d82d 100644 --- a/arch/arm/mach-at91/Kconfig +++ b/arch/arm/mach-at91/Kconfig @@ -122,6 +122,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 9d5266151b..d4416e6468 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 2efffb5985..51d1516457 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_BOOTDELAY=3 @@ -14,6 +15,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 @@ -25,3 +28,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 686760d0a5..e6a811af03 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