* [PATCH V2] AT91: dt: at91sam9g45 family and board device tree files @ 2011-10-03 10:00 ` Nicolas Ferre 0 siblings, 0 replies; 49+ messages in thread From: Nicolas Ferre @ 2011-10-03 10:00 UTC (permalink / raw) To: linux-arm-kernel Create a new device tree source file for Atmel at91sam9g45 SoC family. The Evaluation Kit at91sam9m10g45ek includes it. This first basic support will be populated as drivers and boards will be converted to device tree. Contains serial, dma and interrupt controllers. The generic board file still takes advantage of platform data for early serial init. As we need a storage media and the NAND flash driver is not converted to DT yet, we keep old initialization for it. Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> --- V2: foundation for AT91SAM generic support - device tree focused board file - inclusion of USART DT support - early USART and NAND still using platform data arch/arm/boot/dts/at91sam9g45.dtsi | 103 +++++++++++++++++++++++++ arch/arm/boot/dts/at91sam9m10g45ek.dts | 37 +++++++++ arch/arm/mach-at91/Kconfig | 11 +++ arch/arm/mach-at91/Makefile | 3 + arch/arm/mach-at91/Makefile.boot | 2 + arch/arm/mach-at91/at91sam9g45_devices.c | 24 +++++-- arch/arm/mach-at91/board-dt.c | 122 ++++++++++++++++++++++++++++++ 7 files changed, 296 insertions(+), 6 deletions(-) create mode 100644 arch/arm/boot/dts/at91sam9g45.dtsi create mode 100644 arch/arm/boot/dts/at91sam9m10g45ek.dts create mode 100644 arch/arm/mach-at91/board-dt.c diff --git a/arch/arm/boot/dts/at91sam9g45.dtsi b/arch/arm/boot/dts/at91sam9g45.dtsi new file mode 100644 index 0000000..7d3341f --- /dev/null +++ b/arch/arm/boot/dts/at91sam9g45.dtsi @@ -0,0 +1,103 @@ +/* + * at91sam9g45.dtsi - Device Tree Include file for AT91SAM9G45 family SoC + * applies to AT91SAM9G45, AT91SAM9M10, + * AT91SAM9G46, AT91SAM9M11 SoC + * + * Copyright (C) 2011 Atmel, + * 2011 Nicolas Ferre <nicolas.ferre@atmel.com> + * + * Licensed under GPLv2 or later. + */ + +/include/ "skeleton.dtsi" + +/ { + model = "Atmel AT91SAM9G45 family SoC"; + compatible = "atmel,at91sam9g45"; + interrupt-parent = <&aic>; + + aliases { + serial0 = &dbgu; + serial1 = &usart0; + serial2 = &usart1; + serial3 = &usart2; + serial4 = &usart3; + }; + cpus { + cpu at 0 { + compatible = "arm,arm926ejs"; + }; + }; + + memory { + reg = <0x70000000 0x10000000>; + }; + + ahb { + compatible = "simple-bus"; + #address-cells = <1>; + #size-cells = <1>; + ranges; + + apb { + compatible = "simple-bus"; + #address-cells = <1>; + #size-cells = <1>; + ranges; + + aic: interrupt-controller at fffff000 { + #interrupt-cells = <1>; + compatible = "atmel,at91rm9200-aic"; + interrupt-controller; + reg = <0xfffff000 0x200>; + }; + + dma: dma-controller at ffffec00 { + compatible = "atmel,at91sam9g45-hdmac"; + reg = <0xffffec00 0x200>; + interrupts = <21>; + atmel,hdmac-nr-channels = <8>; + atmel,hdmac-cap-memcpy; + atmel,hdmac-cap-slave; + }; + + dbgu: serial at ffffee00 { + compatible = "atmel,at91sam9260-usart"; + reg = <0xffffee00 0x200>; + interrupts = <1>; + }; + + usart0: serial at fff8c000 { + compatible = "atmel,at91sam9260-usart"; + reg = <0xfff8c000 0x4000>; + interrupts = <7>; + atmel,use-dma-rx; + atmel,use-dma-tx; + }; + + usart1: serial at fff90000 { + compatible = "atmel,at91sam9260-usart"; + reg = <0xfff90000 0x4000>; + interrupts = <8>; + atmel,use-dma-rx; + atmel,use-dma-tx; + }; + + usart2: serial at fff94000 { + compatible = "atmel,at91sam9260-usart"; + reg = <0xfff94000 0x4000>; + interrupts = <9>; + atmel,use-dma-rx; + atmel,use-dma-tx; + }; + + usart3: serial at fff98000 { + compatible = "atmel,at91sam9260-usart"; + reg = <0xfff98000 0x4000>; + interrupts = <10>; + atmel,use-dma-rx; + atmel,use-dma-tx; + }; + }; + }; +}; diff --git a/arch/arm/boot/dts/at91sam9m10g45ek.dts b/arch/arm/boot/dts/at91sam9m10g45ek.dts new file mode 100644 index 0000000..cf743de --- /dev/null +++ b/arch/arm/boot/dts/at91sam9m10g45ek.dts @@ -0,0 +1,37 @@ +/* + * at91sam9m10g45ek.dts - Device Tree file for AT91SAM9M10G45-EK board + * + * Copyright (C) 2011 Atmel, + * 2011 Nicolas Ferre <nicolas.ferre@atmel.com> + * + * Licensed under GPLv2 or later. + */ +/dts-v1/; +/include/ "at91sam9g45.dtsi" + +/ { + model = "Atmel AT91SAM9M10G45-EK"; + compatible = "atmel,at91sam9m10g45ek", "atmel,at91sam9g45", "atmel,at91sam9"; + + chosen { + bootargs = "mem=64M console=ttyS0,115200 mtdparts=atmel_nand:4M(bootstrap/uboot/kernel)ro,60M(rootfs),-(data) root=/dev/mtdblock1 rw rootfstype=jffs2"; + }; + + memory { + reg = <0x70000000 0x4000000>; + }; + + ahb { + apb { + usart0: serial at fff8c000 { + status = "disabled"; + }; + usart2: serial at fff94000 { + status = "disabled"; + }; + usart3: serial at fff98000 { + status = "disabled"; + }; + }; + }; +}; diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig index 2248467..4b59d96 100644 --- a/arch/arm/mach-at91/Kconfig +++ b/arch/arm/mach-at91/Kconfig @@ -442,6 +442,17 @@ endif # ---------------------------------------------------------- +comment "Generic Board Type" + +config MACH_AT91SAM_DT + bool "Atmel AT91SAM Evaluation Kits with device-tree support" + select USE_OF + help + Select this if you want to experiment device-tree with + an Atmel Evaluation Kit. + +# ---------------------------------------------------------- + comment "AT91 Board Options" config MTD_AT91_DATAFLASH_CARD diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile index bf57e8b..3ff245e 100644 --- a/arch/arm/mach-at91/Makefile +++ b/arch/arm/mach-at91/Makefile @@ -74,6 +74,9 @@ obj-$(CONFIG_MACH_SNAPPER_9260) += board-snapper9260.o # AT91SAM9G45 board-specific support obj-$(CONFIG_MACH_AT91SAM9M10G45EK) += board-sam9m10g45ek.o +# AT91SAM board with device-tree +obj-$(CONFIG_MACH_AT91SAM_DT) += board-dt.o + # AT91CAP9 board-specific support obj-$(CONFIG_MACH_AT91CAP9ADK) += board-cap9adk.o diff --git a/arch/arm/mach-at91/Makefile.boot b/arch/arm/mach-at91/Makefile.boot index 3462b81..d278863 100644 --- a/arch/arm/mach-at91/Makefile.boot +++ b/arch/arm/mach-at91/Makefile.boot @@ -16,3 +16,5 @@ else params_phys-y := 0x20000100 initrd_phys-y := 0x20410000 endif + +dtb-$(CONFIG_MACH_AT91SAM_DT) += at91sam9m10g45ek.dtb diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c index bb84040..27276b8 100644 --- a/arch/arm/mach-at91/at91sam9g45_devices.c +++ b/arch/arm/mach-at91/at91sam9g45_devices.c @@ -69,9 +69,16 @@ static struct platform_device at_hdmac_device = { void __init at91_add_device_hdmac(void) { - dma_cap_set(DMA_MEMCPY, atdma_pdata.cap_mask); - dma_cap_set(DMA_SLAVE, atdma_pdata.cap_mask); - platform_device_register(&at_hdmac_device); + struct device_node *of_node = + of_find_node_by_name(NULL, "dma-controller"); + + if (of_node) { + of_node_put(of_node); + } else { + dma_cap_set(DMA_MEMCPY, atdma_pdata.cap_mask); + dma_cap_set(DMA_SLAVE, atdma_pdata.cap_mask); + platform_device_register(&at_hdmac_device); + } } #else void __init at91_add_device_hdmac(void) {} @@ -1556,10 +1563,15 @@ void __init at91_set_serial_console(unsigned portnr) void __init at91_add_device_serial(void) { int i; + struct device_node *of_node = of_find_node_by_name(NULL, "serial"); - for (i = 0; i < ATMEL_MAX_UART; i++) { - if (at91_uarts[i]) - platform_device_register(at91_uarts[i]); + if (of_node) { + of_node_put(of_node); + } else { + for (i = 0; i < ATMEL_MAX_UART; i++) { + if (at91_uarts[i]) + platform_device_register(at91_uarts[i]); + } } if (!atmel_default_console_device) diff --git a/arch/arm/mach-at91/board-dt.c b/arch/arm/mach-at91/board-dt.c new file mode 100644 index 0000000..7bcb9a9 --- /dev/null +++ b/arch/arm/mach-at91/board-dt.c @@ -0,0 +1,122 @@ +/* + * Setup code for AT91SAM Evaluation Kits with Device Tree support + * + * Covers: * AT91SAM9G45-EKES board + * * AT91SAM9M10-EKES board + * * AT91SAM9M10G45-EK board + * + * Copyright (C) 2011 Atmel, + * 2011 Nicolas Ferre <nicolas.ferre@atmel.com> + * + * Licensed under GPLv2 or later. + */ + +#include <linux/types.h> +#include <linux/init.h> +#include <linux/module.h> +#include <linux/irqdomain.h> +#include <linux/of_irq.h> +#include <linux/of_platform.h> + +#include <mach/hardware.h> +#include <mach/board.h> +#include <mach/gpio.h> +#include <mach/system_rev.h> +#include <mach/at91sam9_smc.h> + +#include <asm/setup.h> +#include <asm/irq.h> +#include <asm/mach/arch.h> +#include <asm/mach/map.h> +#include <asm/mach/irq.h> + +#include "sam9_smc.h" +#include "generic.h" + + +static void __init ek_init_early(void) +{ + /* Initialize processor: 12.000 MHz crystal */ + at91_initialize(12000000); + + /* DGBU on ttyS0. (Rx & Tx only) */ + at91_register_uart(0, 0, 0); + + /* USART0 not connected on the -EK board */ + /* USART1 on ttyS2. (Rx, Tx, RTS, CTS) */ + at91_register_uart(AT91SAM9G45_ID_US1, 2, ATMEL_UART_CTS | ATMEL_UART_RTS); + + /* set serial console to ttyS0 (ie, DBGU) */ + at91_set_serial_console(0); +} + +/* det_pin is not connected */ +static struct atmel_nand_data __initdata ek_nand_data = { + .ale = 21, + .cle = 22, + .rdy_pin = AT91_PIN_PC8, + .enable_pin = AT91_PIN_PC14, +}; + +static struct sam9_smc_config __initdata ek_nand_smc_config = { + .ncs_read_setup = 0, + .nrd_setup = 2, + .ncs_write_setup = 0, + .nwe_setup = 2, + + .ncs_read_pulse = 4, + .nrd_pulse = 4, + .ncs_write_pulse = 4, + .nwe_pulse = 4, + + .read_cycle = 7, + .write_cycle = 7, + + .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE, + .tdf_cycles = 3, +}; + +static void __init ek_add_device_nand(void) +{ + ek_nand_data.bus_width_16 = board_have_nand_16bit(); + /* setup bus-width (8 or 16) */ + if (ek_nand_data.bus_width_16) + ek_nand_smc_config.mode |= AT91_SMC_DBW_16; + else + ek_nand_smc_config.mode |= AT91_SMC_DBW_8; + + /* configure chip-select 3 (NAND) */ + sam9_smc_configure(3, &ek_nand_smc_config); + + at91_add_device_nand(&ek_nand_data); +} + +static const struct of_device_id aic_of_match[] __initconst = { + { .compatible = "atmel,at91rm9200-aic", }, + {}, +}; + +static void __init at91_dt_device_init(void) +{ + irq_domain_generate_simple(aic_of_match, 0xfffff000, 0); + + of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); + + /* NAND */ + ek_add_device_nand(); +} + +static const char *at91_dt_board_compat[] __initdata = { + "atmel,at91sam9m10g45ek", + NULL +}; + +DT_MACHINE_START(at91sam9m10g45ek_dt, "Atmel AT91SAM (Device Tree)") + /* Maintainer: Atmel */ + .timer = &at91sam926x_timer, + .map_io = at91_map_io, + .init_early = ek_init_early, + .init_irq = at91_init_irq_default, + .init_machine = at91_dt_device_init, + .dt_compat = at91_dt_board_compat, +MACHINE_END -- 1.7.3 ^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH V2] AT91: dt: at91sam9g45 family and board device tree files @ 2011-10-03 10:00 ` Nicolas Ferre 0 siblings, 0 replies; 49+ messages in thread From: Nicolas Ferre @ 2011-10-03 10:00 UTC (permalink / raw) To: linux-arm-kernel, devicetree-discuss, grant.likely Cc: Nicolas Ferre, linux-kernel Create a new device tree source file for Atmel at91sam9g45 SoC family. The Evaluation Kit at91sam9m10g45ek includes it. This first basic support will be populated as drivers and boards will be converted to device tree. Contains serial, dma and interrupt controllers. The generic board file still takes advantage of platform data for early serial init. As we need a storage media and the NAND flash driver is not converted to DT yet, we keep old initialization for it. Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> --- V2: foundation for AT91SAM generic support - device tree focused board file - inclusion of USART DT support - early USART and NAND still using platform data arch/arm/boot/dts/at91sam9g45.dtsi | 103 +++++++++++++++++++++++++ arch/arm/boot/dts/at91sam9m10g45ek.dts | 37 +++++++++ arch/arm/mach-at91/Kconfig | 11 +++ arch/arm/mach-at91/Makefile | 3 + arch/arm/mach-at91/Makefile.boot | 2 + arch/arm/mach-at91/at91sam9g45_devices.c | 24 +++++-- arch/arm/mach-at91/board-dt.c | 122 ++++++++++++++++++++++++++++++ 7 files changed, 296 insertions(+), 6 deletions(-) create mode 100644 arch/arm/boot/dts/at91sam9g45.dtsi create mode 100644 arch/arm/boot/dts/at91sam9m10g45ek.dts create mode 100644 arch/arm/mach-at91/board-dt.c diff --git a/arch/arm/boot/dts/at91sam9g45.dtsi b/arch/arm/boot/dts/at91sam9g45.dtsi new file mode 100644 index 0000000..7d3341f --- /dev/null +++ b/arch/arm/boot/dts/at91sam9g45.dtsi @@ -0,0 +1,103 @@ +/* + * at91sam9g45.dtsi - Device Tree Include file for AT91SAM9G45 family SoC + * applies to AT91SAM9G45, AT91SAM9M10, + * AT91SAM9G46, AT91SAM9M11 SoC + * + * Copyright (C) 2011 Atmel, + * 2011 Nicolas Ferre <nicolas.ferre@atmel.com> + * + * Licensed under GPLv2 or later. + */ + +/include/ "skeleton.dtsi" + +/ { + model = "Atmel AT91SAM9G45 family SoC"; + compatible = "atmel,at91sam9g45"; + interrupt-parent = <&aic>; + + aliases { + serial0 = &dbgu; + serial1 = &usart0; + serial2 = &usart1; + serial3 = &usart2; + serial4 = &usart3; + }; + cpus { + cpu@0 { + compatible = "arm,arm926ejs"; + }; + }; + + memory { + reg = <0x70000000 0x10000000>; + }; + + ahb { + compatible = "simple-bus"; + #address-cells = <1>; + #size-cells = <1>; + ranges; + + apb { + compatible = "simple-bus"; + #address-cells = <1>; + #size-cells = <1>; + ranges; + + aic: interrupt-controller@fffff000 { + #interrupt-cells = <1>; + compatible = "atmel,at91rm9200-aic"; + interrupt-controller; + reg = <0xfffff000 0x200>; + }; + + dma: dma-controller@ffffec00 { + compatible = "atmel,at91sam9g45-hdmac"; + reg = <0xffffec00 0x200>; + interrupts = <21>; + atmel,hdmac-nr-channels = <8>; + atmel,hdmac-cap-memcpy; + atmel,hdmac-cap-slave; + }; + + dbgu: serial@ffffee00 { + compatible = "atmel,at91sam9260-usart"; + reg = <0xffffee00 0x200>; + interrupts = <1>; + }; + + usart0: serial@fff8c000 { + compatible = "atmel,at91sam9260-usart"; + reg = <0xfff8c000 0x4000>; + interrupts = <7>; + atmel,use-dma-rx; + atmel,use-dma-tx; + }; + + usart1: serial@fff90000 { + compatible = "atmel,at91sam9260-usart"; + reg = <0xfff90000 0x4000>; + interrupts = <8>; + atmel,use-dma-rx; + atmel,use-dma-tx; + }; + + usart2: serial@fff94000 { + compatible = "atmel,at91sam9260-usart"; + reg = <0xfff94000 0x4000>; + interrupts = <9>; + atmel,use-dma-rx; + atmel,use-dma-tx; + }; + + usart3: serial@fff98000 { + compatible = "atmel,at91sam9260-usart"; + reg = <0xfff98000 0x4000>; + interrupts = <10>; + atmel,use-dma-rx; + atmel,use-dma-tx; + }; + }; + }; +}; diff --git a/arch/arm/boot/dts/at91sam9m10g45ek.dts b/arch/arm/boot/dts/at91sam9m10g45ek.dts new file mode 100644 index 0000000..cf743de --- /dev/null +++ b/arch/arm/boot/dts/at91sam9m10g45ek.dts @@ -0,0 +1,37 @@ +/* + * at91sam9m10g45ek.dts - Device Tree file for AT91SAM9M10G45-EK board + * + * Copyright (C) 2011 Atmel, + * 2011 Nicolas Ferre <nicolas.ferre@atmel.com> + * + * Licensed under GPLv2 or later. + */ +/dts-v1/; +/include/ "at91sam9g45.dtsi" + +/ { + model = "Atmel AT91SAM9M10G45-EK"; + compatible = "atmel,at91sam9m10g45ek", "atmel,at91sam9g45", "atmel,at91sam9"; + + chosen { + bootargs = "mem=64M console=ttyS0,115200 mtdparts=atmel_nand:4M(bootstrap/uboot/kernel)ro,60M(rootfs),-(data) root=/dev/mtdblock1 rw rootfstype=jffs2"; + }; + + memory { + reg = <0x70000000 0x4000000>; + }; + + ahb { + apb { + usart0: serial@fff8c000 { + status = "disabled"; + }; + usart2: serial@fff94000 { + status = "disabled"; + }; + usart3: serial@fff98000 { + status = "disabled"; + }; + }; + }; +}; diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig index 2248467..4b59d96 100644 --- a/arch/arm/mach-at91/Kconfig +++ b/arch/arm/mach-at91/Kconfig @@ -442,6 +442,17 @@ endif # ---------------------------------------------------------- +comment "Generic Board Type" + +config MACH_AT91SAM_DT + bool "Atmel AT91SAM Evaluation Kits with device-tree support" + select USE_OF + help + Select this if you want to experiment device-tree with + an Atmel Evaluation Kit. + +# ---------------------------------------------------------- + comment "AT91 Board Options" config MTD_AT91_DATAFLASH_CARD diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile index bf57e8b..3ff245e 100644 --- a/arch/arm/mach-at91/Makefile +++ b/arch/arm/mach-at91/Makefile @@ -74,6 +74,9 @@ obj-$(CONFIG_MACH_SNAPPER_9260) += board-snapper9260.o # AT91SAM9G45 board-specific support obj-$(CONFIG_MACH_AT91SAM9M10G45EK) += board-sam9m10g45ek.o +# AT91SAM board with device-tree +obj-$(CONFIG_MACH_AT91SAM_DT) += board-dt.o + # AT91CAP9 board-specific support obj-$(CONFIG_MACH_AT91CAP9ADK) += board-cap9adk.o diff --git a/arch/arm/mach-at91/Makefile.boot b/arch/arm/mach-at91/Makefile.boot index 3462b81..d278863 100644 --- a/arch/arm/mach-at91/Makefile.boot +++ b/arch/arm/mach-at91/Makefile.boot @@ -16,3 +16,5 @@ else params_phys-y := 0x20000100 initrd_phys-y := 0x20410000 endif + +dtb-$(CONFIG_MACH_AT91SAM_DT) += at91sam9m10g45ek.dtb diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c index bb84040..27276b8 100644 --- a/arch/arm/mach-at91/at91sam9g45_devices.c +++ b/arch/arm/mach-at91/at91sam9g45_devices.c @@ -69,9 +69,16 @@ static struct platform_device at_hdmac_device = { void __init at91_add_device_hdmac(void) { - dma_cap_set(DMA_MEMCPY, atdma_pdata.cap_mask); - dma_cap_set(DMA_SLAVE, atdma_pdata.cap_mask); - platform_device_register(&at_hdmac_device); + struct device_node *of_node = + of_find_node_by_name(NULL, "dma-controller"); + + if (of_node) { + of_node_put(of_node); + } else { + dma_cap_set(DMA_MEMCPY, atdma_pdata.cap_mask); + dma_cap_set(DMA_SLAVE, atdma_pdata.cap_mask); + platform_device_register(&at_hdmac_device); + } } #else void __init at91_add_device_hdmac(void) {} @@ -1556,10 +1563,15 @@ void __init at91_set_serial_console(unsigned portnr) void __init at91_add_device_serial(void) { int i; + struct device_node *of_node = of_find_node_by_name(NULL, "serial"); - for (i = 0; i < ATMEL_MAX_UART; i++) { - if (at91_uarts[i]) - platform_device_register(at91_uarts[i]); + if (of_node) { + of_node_put(of_node); + } else { + for (i = 0; i < ATMEL_MAX_UART; i++) { + if (at91_uarts[i]) + platform_device_register(at91_uarts[i]); + } } if (!atmel_default_console_device) diff --git a/arch/arm/mach-at91/board-dt.c b/arch/arm/mach-at91/board-dt.c new file mode 100644 index 0000000..7bcb9a9 --- /dev/null +++ b/arch/arm/mach-at91/board-dt.c @@ -0,0 +1,122 @@ +/* + * Setup code for AT91SAM Evaluation Kits with Device Tree support + * + * Covers: * AT91SAM9G45-EKES board + * * AT91SAM9M10-EKES board + * * AT91SAM9M10G45-EK board + * + * Copyright (C) 2011 Atmel, + * 2011 Nicolas Ferre <nicolas.ferre@atmel.com> + * + * Licensed under GPLv2 or later. + */ + +#include <linux/types.h> +#include <linux/init.h> +#include <linux/module.h> +#include <linux/irqdomain.h> +#include <linux/of_irq.h> +#include <linux/of_platform.h> + +#include <mach/hardware.h> +#include <mach/board.h> +#include <mach/gpio.h> +#include <mach/system_rev.h> +#include <mach/at91sam9_smc.h> + +#include <asm/setup.h> +#include <asm/irq.h> +#include <asm/mach/arch.h> +#include <asm/mach/map.h> +#include <asm/mach/irq.h> + +#include "sam9_smc.h" +#include "generic.h" + + +static void __init ek_init_early(void) +{ + /* Initialize processor: 12.000 MHz crystal */ + at91_initialize(12000000); + + /* DGBU on ttyS0. (Rx & Tx only) */ + at91_register_uart(0, 0, 0); + + /* USART0 not connected on the -EK board */ + /* USART1 on ttyS2. (Rx, Tx, RTS, CTS) */ + at91_register_uart(AT91SAM9G45_ID_US1, 2, ATMEL_UART_CTS | ATMEL_UART_RTS); + + /* set serial console to ttyS0 (ie, DBGU) */ + at91_set_serial_console(0); +} + +/* det_pin is not connected */ +static struct atmel_nand_data __initdata ek_nand_data = { + .ale = 21, + .cle = 22, + .rdy_pin = AT91_PIN_PC8, + .enable_pin = AT91_PIN_PC14, +}; + +static struct sam9_smc_config __initdata ek_nand_smc_config = { + .ncs_read_setup = 0, + .nrd_setup = 2, + .ncs_write_setup = 0, + .nwe_setup = 2, + + .ncs_read_pulse = 4, + .nrd_pulse = 4, + .ncs_write_pulse = 4, + .nwe_pulse = 4, + + .read_cycle = 7, + .write_cycle = 7, + + .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE, + .tdf_cycles = 3, +}; + +static void __init ek_add_device_nand(void) +{ + ek_nand_data.bus_width_16 = board_have_nand_16bit(); + /* setup bus-width (8 or 16) */ + if (ek_nand_data.bus_width_16) + ek_nand_smc_config.mode |= AT91_SMC_DBW_16; + else + ek_nand_smc_config.mode |= AT91_SMC_DBW_8; + + /* configure chip-select 3 (NAND) */ + sam9_smc_configure(3, &ek_nand_smc_config); + + at91_add_device_nand(&ek_nand_data); +} + +static const struct of_device_id aic_of_match[] __initconst = { + { .compatible = "atmel,at91rm9200-aic", }, + {}, +}; + +static void __init at91_dt_device_init(void) +{ + irq_domain_generate_simple(aic_of_match, 0xfffff000, 0); + + of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); + + /* NAND */ + ek_add_device_nand(); +} + +static const char *at91_dt_board_compat[] __initdata = { + "atmel,at91sam9m10g45ek", + NULL +}; + +DT_MACHINE_START(at91sam9m10g45ek_dt, "Atmel AT91SAM (Device Tree)") + /* Maintainer: Atmel */ + .timer = &at91sam926x_timer, + .map_io = at91_map_io, + .init_early = ek_init_early, + .init_irq = at91_init_irq_default, + .init_machine = at91_dt_device_init, + .dt_compat = at91_dt_board_compat, +MACHINE_END -- 1.7.3 ^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH V2] AT91: dt: at91sam9g45 family and board device tree files @ 2011-10-03 10:00 ` Nicolas Ferre 0 siblings, 0 replies; 49+ messages in thread From: Nicolas Ferre @ 2011-10-03 10:00 UTC (permalink / raw) To: linux-arm-kernel, devicetree-discuss, grant.likely Cc: linux-kernel, Nicolas Ferre Create a new device tree source file for Atmel at91sam9g45 SoC family. The Evaluation Kit at91sam9m10g45ek includes it. This first basic support will be populated as drivers and boards will be converted to device tree. Contains serial, dma and interrupt controllers. The generic board file still takes advantage of platform data for early serial init. As we need a storage media and the NAND flash driver is not converted to DT yet, we keep old initialization for it. Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> --- V2: foundation for AT91SAM generic support - device tree focused board file - inclusion of USART DT support - early USART and NAND still using platform data arch/arm/boot/dts/at91sam9g45.dtsi | 103 +++++++++++++++++++++++++ arch/arm/boot/dts/at91sam9m10g45ek.dts | 37 +++++++++ arch/arm/mach-at91/Kconfig | 11 +++ arch/arm/mach-at91/Makefile | 3 + arch/arm/mach-at91/Makefile.boot | 2 + arch/arm/mach-at91/at91sam9g45_devices.c | 24 +++++-- arch/arm/mach-at91/board-dt.c | 122 ++++++++++++++++++++++++++++++ 7 files changed, 296 insertions(+), 6 deletions(-) create mode 100644 arch/arm/boot/dts/at91sam9g45.dtsi create mode 100644 arch/arm/boot/dts/at91sam9m10g45ek.dts create mode 100644 arch/arm/mach-at91/board-dt.c diff --git a/arch/arm/boot/dts/at91sam9g45.dtsi b/arch/arm/boot/dts/at91sam9g45.dtsi new file mode 100644 index 0000000..7d3341f --- /dev/null +++ b/arch/arm/boot/dts/at91sam9g45.dtsi @@ -0,0 +1,103 @@ +/* + * at91sam9g45.dtsi - Device Tree Include file for AT91SAM9G45 family SoC + * applies to AT91SAM9G45, AT91SAM9M10, + * AT91SAM9G46, AT91SAM9M11 SoC + * + * Copyright (C) 2011 Atmel, + * 2011 Nicolas Ferre <nicolas.ferre@atmel.com> + * + * Licensed under GPLv2 or later. + */ + +/include/ "skeleton.dtsi" + +/ { + model = "Atmel AT91SAM9G45 family SoC"; + compatible = "atmel,at91sam9g45"; + interrupt-parent = <&aic>; + + aliases { + serial0 = &dbgu; + serial1 = &usart0; + serial2 = &usart1; + serial3 = &usart2; + serial4 = &usart3; + }; + cpus { + cpu@0 { + compatible = "arm,arm926ejs"; + }; + }; + + memory { + reg = <0x70000000 0x10000000>; + }; + + ahb { + compatible = "simple-bus"; + #address-cells = <1>; + #size-cells = <1>; + ranges; + + apb { + compatible = "simple-bus"; + #address-cells = <1>; + #size-cells = <1>; + ranges; + + aic: interrupt-controller@fffff000 { + #interrupt-cells = <1>; + compatible = "atmel,at91rm9200-aic"; + interrupt-controller; + reg = <0xfffff000 0x200>; + }; + + dma: dma-controller@ffffec00 { + compatible = "atmel,at91sam9g45-hdmac"; + reg = <0xffffec00 0x200>; + interrupts = <21>; + atmel,hdmac-nr-channels = <8>; + atmel,hdmac-cap-memcpy; + atmel,hdmac-cap-slave; + }; + + dbgu: serial@ffffee00 { + compatible = "atmel,at91sam9260-usart"; + reg = <0xffffee00 0x200>; + interrupts = <1>; + }; + + usart0: serial@fff8c000 { + compatible = "atmel,at91sam9260-usart"; + reg = <0xfff8c000 0x4000>; + interrupts = <7>; + atmel,use-dma-rx; + atmel,use-dma-tx; + }; + + usart1: serial@fff90000 { + compatible = "atmel,at91sam9260-usart"; + reg = <0xfff90000 0x4000>; + interrupts = <8>; + atmel,use-dma-rx; + atmel,use-dma-tx; + }; + + usart2: serial@fff94000 { + compatible = "atmel,at91sam9260-usart"; + reg = <0xfff94000 0x4000>; + interrupts = <9>; + atmel,use-dma-rx; + atmel,use-dma-tx; + }; + + usart3: serial@fff98000 { + compatible = "atmel,at91sam9260-usart"; + reg = <0xfff98000 0x4000>; + interrupts = <10>; + atmel,use-dma-rx; + atmel,use-dma-tx; + }; + }; + }; +}; diff --git a/arch/arm/boot/dts/at91sam9m10g45ek.dts b/arch/arm/boot/dts/at91sam9m10g45ek.dts new file mode 100644 index 0000000..cf743de --- /dev/null +++ b/arch/arm/boot/dts/at91sam9m10g45ek.dts @@ -0,0 +1,37 @@ +/* + * at91sam9m10g45ek.dts - Device Tree file for AT91SAM9M10G45-EK board + * + * Copyright (C) 2011 Atmel, + * 2011 Nicolas Ferre <nicolas.ferre@atmel.com> + * + * Licensed under GPLv2 or later. + */ +/dts-v1/; +/include/ "at91sam9g45.dtsi" + +/ { + model = "Atmel AT91SAM9M10G45-EK"; + compatible = "atmel,at91sam9m10g45ek", "atmel,at91sam9g45", "atmel,at91sam9"; + + chosen { + bootargs = "mem=64M console=ttyS0,115200 mtdparts=atmel_nand:4M(bootstrap/uboot/kernel)ro,60M(rootfs),-(data) root=/dev/mtdblock1 rw rootfstype=jffs2"; + }; + + memory { + reg = <0x70000000 0x4000000>; + }; + + ahb { + apb { + usart0: serial@fff8c000 { + status = "disabled"; + }; + usart2: serial@fff94000 { + status = "disabled"; + }; + usart3: serial@fff98000 { + status = "disabled"; + }; + }; + }; +}; diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig index 2248467..4b59d96 100644 --- a/arch/arm/mach-at91/Kconfig +++ b/arch/arm/mach-at91/Kconfig @@ -442,6 +442,17 @@ endif # ---------------------------------------------------------- +comment "Generic Board Type" + +config MACH_AT91SAM_DT + bool "Atmel AT91SAM Evaluation Kits with device-tree support" + select USE_OF + help + Select this if you want to experiment device-tree with + an Atmel Evaluation Kit. + +# ---------------------------------------------------------- + comment "AT91 Board Options" config MTD_AT91_DATAFLASH_CARD diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile index bf57e8b..3ff245e 100644 --- a/arch/arm/mach-at91/Makefile +++ b/arch/arm/mach-at91/Makefile @@ -74,6 +74,9 @@ obj-$(CONFIG_MACH_SNAPPER_9260) += board-snapper9260.o # AT91SAM9G45 board-specific support obj-$(CONFIG_MACH_AT91SAM9M10G45EK) += board-sam9m10g45ek.o +# AT91SAM board with device-tree +obj-$(CONFIG_MACH_AT91SAM_DT) += board-dt.o + # AT91CAP9 board-specific support obj-$(CONFIG_MACH_AT91CAP9ADK) += board-cap9adk.o diff --git a/arch/arm/mach-at91/Makefile.boot b/arch/arm/mach-at91/Makefile.boot index 3462b81..d278863 100644 --- a/arch/arm/mach-at91/Makefile.boot +++ b/arch/arm/mach-at91/Makefile.boot @@ -16,3 +16,5 @@ else params_phys-y := 0x20000100 initrd_phys-y := 0x20410000 endif + +dtb-$(CONFIG_MACH_AT91SAM_DT) += at91sam9m10g45ek.dtb diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c index bb84040..27276b8 100644 --- a/arch/arm/mach-at91/at91sam9g45_devices.c +++ b/arch/arm/mach-at91/at91sam9g45_devices.c @@ -69,9 +69,16 @@ static struct platform_device at_hdmac_device = { void __init at91_add_device_hdmac(void) { - dma_cap_set(DMA_MEMCPY, atdma_pdata.cap_mask); - dma_cap_set(DMA_SLAVE, atdma_pdata.cap_mask); - platform_device_register(&at_hdmac_device); + struct device_node *of_node = + of_find_node_by_name(NULL, "dma-controller"); + + if (of_node) { + of_node_put(of_node); + } else { + dma_cap_set(DMA_MEMCPY, atdma_pdata.cap_mask); + dma_cap_set(DMA_SLAVE, atdma_pdata.cap_mask); + platform_device_register(&at_hdmac_device); + } } #else void __init at91_add_device_hdmac(void) {} @@ -1556,10 +1563,15 @@ void __init at91_set_serial_console(unsigned portnr) void __init at91_add_device_serial(void) { int i; + struct device_node *of_node = of_find_node_by_name(NULL, "serial"); - for (i = 0; i < ATMEL_MAX_UART; i++) { - if (at91_uarts[i]) - platform_device_register(at91_uarts[i]); + if (of_node) { + of_node_put(of_node); + } else { + for (i = 0; i < ATMEL_MAX_UART; i++) { + if (at91_uarts[i]) + platform_device_register(at91_uarts[i]); + } } if (!atmel_default_console_device) diff --git a/arch/arm/mach-at91/board-dt.c b/arch/arm/mach-at91/board-dt.c new file mode 100644 index 0000000..7bcb9a9 --- /dev/null +++ b/arch/arm/mach-at91/board-dt.c @@ -0,0 +1,122 @@ +/* + * Setup code for AT91SAM Evaluation Kits with Device Tree support + * + * Covers: * AT91SAM9G45-EKES board + * * AT91SAM9M10-EKES board + * * AT91SAM9M10G45-EK board + * + * Copyright (C) 2011 Atmel, + * 2011 Nicolas Ferre <nicolas.ferre@atmel.com> + * + * Licensed under GPLv2 or later. + */ + +#include <linux/types.h> +#include <linux/init.h> +#include <linux/module.h> +#include <linux/irqdomain.h> +#include <linux/of_irq.h> +#include <linux/of_platform.h> + +#include <mach/hardware.h> +#include <mach/board.h> +#include <mach/gpio.h> +#include <mach/system_rev.h> +#include <mach/at91sam9_smc.h> + +#include <asm/setup.h> +#include <asm/irq.h> +#include <asm/mach/arch.h> +#include <asm/mach/map.h> +#include <asm/mach/irq.h> + +#include "sam9_smc.h" +#include "generic.h" + + +static void __init ek_init_early(void) +{ + /* Initialize processor: 12.000 MHz crystal */ + at91_initialize(12000000); + + /* DGBU on ttyS0. (Rx & Tx only) */ + at91_register_uart(0, 0, 0); + + /* USART0 not connected on the -EK board */ + /* USART1 on ttyS2. (Rx, Tx, RTS, CTS) */ + at91_register_uart(AT91SAM9G45_ID_US1, 2, ATMEL_UART_CTS | ATMEL_UART_RTS); + + /* set serial console to ttyS0 (ie, DBGU) */ + at91_set_serial_console(0); +} + +/* det_pin is not connected */ +static struct atmel_nand_data __initdata ek_nand_data = { + .ale = 21, + .cle = 22, + .rdy_pin = AT91_PIN_PC8, + .enable_pin = AT91_PIN_PC14, +}; + +static struct sam9_smc_config __initdata ek_nand_smc_config = { + .ncs_read_setup = 0, + .nrd_setup = 2, + .ncs_write_setup = 0, + .nwe_setup = 2, + + .ncs_read_pulse = 4, + .nrd_pulse = 4, + .ncs_write_pulse = 4, + .nwe_pulse = 4, + + .read_cycle = 7, + .write_cycle = 7, + + .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE, + .tdf_cycles = 3, +}; + +static void __init ek_add_device_nand(void) +{ + ek_nand_data.bus_width_16 = board_have_nand_16bit(); + /* setup bus-width (8 or 16) */ + if (ek_nand_data.bus_width_16) + ek_nand_smc_config.mode |= AT91_SMC_DBW_16; + else + ek_nand_smc_config.mode |= AT91_SMC_DBW_8; + + /* configure chip-select 3 (NAND) */ + sam9_smc_configure(3, &ek_nand_smc_config); + + at91_add_device_nand(&ek_nand_data); +} + +static const struct of_device_id aic_of_match[] __initconst = { + { .compatible = "atmel,at91rm9200-aic", }, + {}, +}; + +static void __init at91_dt_device_init(void) +{ + irq_domain_generate_simple(aic_of_match, 0xfffff000, 0); + + of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); + + /* NAND */ + ek_add_device_nand(); +} + +static const char *at91_dt_board_compat[] __initdata = { + "atmel,at91sam9m10g45ek", + NULL +}; + +DT_MACHINE_START(at91sam9m10g45ek_dt, "Atmel AT91SAM (Device Tree)") + /* Maintainer: Atmel */ + .timer = &at91sam926x_timer, + .map_io = at91_map_io, + .init_early = ek_init_early, + .init_irq = at91_init_irq_default, + .init_machine = at91_dt_device_init, + .dt_compat = at91_dt_board_compat, +MACHINE_END -- 1.7.3 ^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH V2] AT91: dt: at91sam9g45 family and board device tree files 2011-10-03 10:00 ` Nicolas Ferre (?) @ 2011-10-03 8:52 ` Russell King - ARM Linux -1 siblings, 0 replies; 49+ messages in thread From: Russell King - ARM Linux @ 2011-10-03 8:52 UTC (permalink / raw) To: linux-arm-kernel On Mon, Oct 03, 2011 at 12:00:56PM +0200, Nicolas Ferre wrote: > diff --git a/arch/arm/mach-at91/board-dt.c b/arch/arm/mach-at91/board-dt.c > new file mode 100644 > index 0000000..7bcb9a9 > --- /dev/null > +++ b/arch/arm/mach-at91/board-dt.c > @@ -0,0 +1,122 @@ > +/* > + * Setup code for AT91SAM Evaluation Kits with Device Tree support > + * > + * Covers: * AT91SAM9G45-EKES board > + * * AT91SAM9M10-EKES board > + * * AT91SAM9M10G45-EK board > + * > + * Copyright (C) 2011 Atmel, > + * 2011 Nicolas Ferre <nicolas.ferre@atmel.com> > + * > + * Licensed under GPLv2 or later. > + */ > + > +#include <linux/types.h> > +#include <linux/init.h> > +#include <linux/module.h> > +#include <linux/irqdomain.h> > +#include <linux/of_irq.h> > +#include <linux/of_platform.h> > + > +#include <mach/hardware.h> > +#include <mach/board.h> > +#include <mach/gpio.h> Is linux/gpio.h broken for you? ^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH V2] AT91: dt: at91sam9g45 family and board device tree files @ 2011-10-03 8:52 ` Russell King - ARM Linux 0 siblings, 0 replies; 49+ messages in thread From: Russell King - ARM Linux @ 2011-10-03 8:52 UTC (permalink / raw) To: Nicolas Ferre Cc: grant.likely, devicetree-discuss, linux-kernel, linux-arm-kernel On Mon, Oct 03, 2011 at 12:00:56PM +0200, Nicolas Ferre wrote: > diff --git a/arch/arm/mach-at91/board-dt.c b/arch/arm/mach-at91/board-dt.c > new file mode 100644 > index 0000000..7bcb9a9 > --- /dev/null > +++ b/arch/arm/mach-at91/board-dt.c > @@ -0,0 +1,122 @@ > +/* > + * Setup code for AT91SAM Evaluation Kits with Device Tree support > + * > + * Covers: * AT91SAM9G45-EKES board > + * * AT91SAM9M10-EKES board > + * * AT91SAM9M10G45-EK board > + * > + * Copyright (C) 2011 Atmel, > + * 2011 Nicolas Ferre <nicolas.ferre@atmel.com> > + * > + * Licensed under GPLv2 or later. > + */ > + > +#include <linux/types.h> > +#include <linux/init.h> > +#include <linux/module.h> > +#include <linux/irqdomain.h> > +#include <linux/of_irq.h> > +#include <linux/of_platform.h> > + > +#include <mach/hardware.h> > +#include <mach/board.h> > +#include <mach/gpio.h> Is linux/gpio.h broken for you? ^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH V2] AT91: dt: at91sam9g45 family and board device tree files @ 2011-10-03 8:52 ` Russell King - ARM Linux 0 siblings, 0 replies; 49+ messages in thread From: Russell King - ARM Linux @ 2011-10-03 8:52 UTC (permalink / raw) To: Nicolas Ferre Cc: linux-arm-kernel, devicetree-discuss, grant.likely, linux-kernel On Mon, Oct 03, 2011 at 12:00:56PM +0200, Nicolas Ferre wrote: > diff --git a/arch/arm/mach-at91/board-dt.c b/arch/arm/mach-at91/board-dt.c > new file mode 100644 > index 0000000..7bcb9a9 > --- /dev/null > +++ b/arch/arm/mach-at91/board-dt.c > @@ -0,0 +1,122 @@ > +/* > + * Setup code for AT91SAM Evaluation Kits with Device Tree support > + * > + * Covers: * AT91SAM9G45-EKES board > + * * AT91SAM9M10-EKES board > + * * AT91SAM9M10G45-EK board > + * > + * Copyright (C) 2011 Atmel, > + * 2011 Nicolas Ferre <nicolas.ferre@atmel.com> > + * > + * Licensed under GPLv2 or later. > + */ > + > +#include <linux/types.h> > +#include <linux/init.h> > +#include <linux/module.h> > +#include <linux/irqdomain.h> > +#include <linux/of_irq.h> > +#include <linux/of_platform.h> > + > +#include <mach/hardware.h> > +#include <mach/board.h> > +#include <mach/gpio.h> Is linux/gpio.h broken for you? ^ permalink raw reply [flat|nested] 49+ messages in thread
* [PATCH V2] AT91: dt: at91sam9g45 family and board device tree files 2011-10-03 10:00 ` Nicolas Ferre (?) @ 2011-10-05 13:00 ` Rob Herring -1 siblings, 0 replies; 49+ messages in thread From: Rob Herring @ 2011-10-05 13:00 UTC (permalink / raw) To: linux-arm-kernel Nicolas, On 10/03/2011 05:00 AM, Nicolas Ferre wrote: > Create a new device tree source file for Atmel at91sam9g45 SoC family. > The Evaluation Kit at91sam9m10g45ek includes it. > This first basic support will be populated as drivers and boards will be > converted to device tree. > Contains serial, dma and interrupt controllers. > > The generic board file still takes advantage of platform data for early serial > init. As we need a storage media and the NAND flash driver is not converted to > DT yet, we keep old initialization for it. > > Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> > --- > V2: foundation for AT91SAM generic support > - device tree focused board file > - inclusion of USART DT support > - early USART and NAND still using platform data > > arch/arm/boot/dts/at91sam9g45.dtsi | 103 +++++++++++++++++++++++++ > arch/arm/boot/dts/at91sam9m10g45ek.dts | 37 +++++++++ > arch/arm/mach-at91/Kconfig | 11 +++ > arch/arm/mach-at91/Makefile | 3 + > arch/arm/mach-at91/Makefile.boot | 2 + > arch/arm/mach-at91/at91sam9g45_devices.c | 24 +++++-- > arch/arm/mach-at91/board-dt.c | 122 ++++++++++++++++++++++++++++++ > 7 files changed, 296 insertions(+), 6 deletions(-) > create mode 100644 arch/arm/boot/dts/at91sam9g45.dtsi > create mode 100644 arch/arm/boot/dts/at91sam9m10g45ek.dts > create mode 100644 arch/arm/mach-at91/board-dt.c > > diff --git a/arch/arm/boot/dts/at91sam9g45.dtsi b/arch/arm/boot/dts/at91sam9g45.dtsi > new file mode 100644 > index 0000000..7d3341f > --- /dev/null > +++ b/arch/arm/boot/dts/at91sam9g45.dtsi > @@ -0,0 +1,103 @@ > +/* > + * at91sam9g45.dtsi - Device Tree Include file for AT91SAM9G45 family SoC > + * applies to AT91SAM9G45, AT91SAM9M10, > + * AT91SAM9G46, AT91SAM9M11 SoC > + * > + * Copyright (C) 2011 Atmel, > + * 2011 Nicolas Ferre <nicolas.ferre@atmel.com> > + * > + * Licensed under GPLv2 or later. > + */ > + > +/include/ "skeleton.dtsi" > + > +/ { > + model = "Atmel AT91SAM9G45 family SoC"; > + compatible = "atmel,at91sam9g45"; > + interrupt-parent = <&aic>; > + > + aliases { > + serial0 = &dbgu; > + serial1 = &usart0; > + serial2 = &usart1; > + serial3 = &usart2; > + serial4 = &usart3; > + }; > + cpus { > + cpu at 0 { > + compatible = "arm,arm926ejs"; > + }; > + }; > + > + memory { Should be memory at 0x70000000 > + reg = <0x70000000 0x10000000>; > + }; > + > + ahb { > + compatible = "simple-bus"; > + #address-cells = <1>; > + #size-cells = <1>; > + ranges; > + > + apb { > + compatible = "simple-bus"; > + #address-cells = <1>; > + #size-cells = <1>; > + ranges; > + > + aic: interrupt-controller at fffff000 { > + #interrupt-cells = <1>; > + compatible = "atmel,at91rm9200-aic"; > + interrupt-controller; Add "interrupt-parent;" so that the aic is not the parent of itself. > + reg = <0xfffff000 0x200>; > + }; > + > + dma: dma-controller at ffffec00 { > + compatible = "atmel,at91sam9g45-hdmac"; > + reg = <0xffffec00 0x200>; > + interrupts = <21>; > + atmel,hdmac-nr-channels = <8>; > + atmel,hdmac-cap-memcpy; > + atmel,hdmac-cap-slave; > + }; > + > + dbgu: serial at ffffee00 { > + compatible = "atmel,at91sam9260-usart"; > + reg = <0xffffee00 0x200>; > + interrupts = <1>; > + }; > + > + usart0: serial at fff8c000 { > + compatible = "atmel,at91sam9260-usart"; > + reg = <0xfff8c000 0x4000>; Is 16K really used? I would set to 4K so your not wasting virtual space (probably not an issue yet on Atmel parts). > + interrupts = <7>; > + atmel,use-dma-rx; > + atmel,use-dma-tx; > + }; > + > + usart1: serial at fff90000 { > + compatible = "atmel,at91sam9260-usart"; > + reg = <0xfff90000 0x4000>; > + interrupts = <8>; > + atmel,use-dma-rx; > + atmel,use-dma-tx; > + }; > + > + usart2: serial at fff94000 { > + compatible = "atmel,at91sam9260-usart"; > + reg = <0xfff94000 0x4000>; > + interrupts = <9>; > + atmel,use-dma-rx; > + atmel,use-dma-tx; > + }; > + > + usart3: serial at fff98000 { > + compatible = "atmel,at91sam9260-usart"; > + reg = <0xfff98000 0x4000>; > + interrupts = <10>; > + atmel,use-dma-rx; > + atmel,use-dma-tx; > + }; > + }; > + }; > +}; > diff --git a/arch/arm/boot/dts/at91sam9m10g45ek.dts b/arch/arm/boot/dts/at91sam9m10g45ek.dts > new file mode 100644 > index 0000000..cf743de > --- /dev/null > +++ b/arch/arm/boot/dts/at91sam9m10g45ek.dts > @@ -0,0 +1,37 @@ > +/* > + * at91sam9m10g45ek.dts - Device Tree file for AT91SAM9M10G45-EK board > + * > + * Copyright (C) 2011 Atmel, > + * 2011 Nicolas Ferre <nicolas.ferre@atmel.com> > + * > + * Licensed under GPLv2 or later. > + */ > +/dts-v1/; > +/include/ "at91sam9g45.dtsi" > + > +/ { > + model = "Atmel AT91SAM9M10G45-EK"; > + compatible = "atmel,at91sam9m10g45ek", "atmel,at91sam9g45", "atmel,at91sam9"; > + > + chosen { > + bootargs = "mem=64M console=ttyS0,115200 mtdparts=atmel_nand:4M(bootstrap/uboot/kernel)ro,60M(rootfs),-(data) root=/dev/mtdblock1 rw rootfstype=jffs2"; > + }; > + > + memory { > + reg = <0x70000000 0x4000000>; > + }; > + > + ahb { > + apb { > + usart0: serial at fff8c000 { > + status = "disabled"; > + }; > + usart2: serial at fff94000 { > + status = "disabled"; > + }; > + usart3: serial at fff98000 { > + status = "disabled"; > + }; > + }; > + }; > +}; > diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig > index 2248467..4b59d96 100644 > --- a/arch/arm/mach-at91/Kconfig > +++ b/arch/arm/mach-at91/Kconfig > @@ -442,6 +442,17 @@ endif > > # ---------------------------------------------------------- > > +comment "Generic Board Type" > + > +config MACH_AT91SAM_DT > + bool "Atmel AT91SAM Evaluation Kits with device-tree support" > + select USE_OF > + help > + Select this if you want to experiment device-tree with > + an Atmel Evaluation Kit. > + > +# ---------------------------------------------------------- > + > comment "AT91 Board Options" > > config MTD_AT91_DATAFLASH_CARD > diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile > index bf57e8b..3ff245e 100644 > --- a/arch/arm/mach-at91/Makefile > +++ b/arch/arm/mach-at91/Makefile > @@ -74,6 +74,9 @@ obj-$(CONFIG_MACH_SNAPPER_9260) += board-snapper9260.o > # AT91SAM9G45 board-specific support > obj-$(CONFIG_MACH_AT91SAM9M10G45EK) += board-sam9m10g45ek.o > > +# AT91SAM board with device-tree > +obj-$(CONFIG_MACH_AT91SAM_DT) += board-dt.o > + > # AT91CAP9 board-specific support > obj-$(CONFIG_MACH_AT91CAP9ADK) += board-cap9adk.o > > diff --git a/arch/arm/mach-at91/Makefile.boot b/arch/arm/mach-at91/Makefile.boot > index 3462b81..d278863 100644 > --- a/arch/arm/mach-at91/Makefile.boot > +++ b/arch/arm/mach-at91/Makefile.boot > @@ -16,3 +16,5 @@ else > params_phys-y := 0x20000100 > initrd_phys-y := 0x20410000 > endif > + > +dtb-$(CONFIG_MACH_AT91SAM_DT) += at91sam9m10g45ek.dtb > diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c > index bb84040..27276b8 100644 > --- a/arch/arm/mach-at91/at91sam9g45_devices.c > +++ b/arch/arm/mach-at91/at91sam9g45_devices.c > @@ -69,9 +69,16 @@ static struct platform_device at_hdmac_device = { > > void __init at91_add_device_hdmac(void) > { > - dma_cap_set(DMA_MEMCPY, atdma_pdata.cap_mask); > - dma_cap_set(DMA_SLAVE, atdma_pdata.cap_mask); > - platform_device_register(&at_hdmac_device); > + struct device_node *of_node = > + of_find_node_by_name(NULL, "dma-controller"); You should really search by the compatible string. > + > + if (of_node) { > + of_node_put(of_node); > + } else { > + dma_cap_set(DMA_MEMCPY, atdma_pdata.cap_mask); > + dma_cap_set(DMA_SLAVE, atdma_pdata.cap_mask); This really should be in the driver. > + platform_device_register(&at_hdmac_device); > + } > } > #else > void __init at91_add_device_hdmac(void) {} > @@ -1556,10 +1563,15 @@ void __init at91_set_serial_console(unsigned portnr) > void __init at91_add_device_serial(void) > { > int i; > + struct device_node *of_node = of_find_node_by_name(NULL, "serial"); > > - for (i = 0; i < ATMEL_MAX_UART; i++) { > - if (at91_uarts[i]) > - platform_device_register(at91_uarts[i]); > + if (of_node) { > + of_node_put(of_node); > + } else { > + for (i = 0; i < ATMEL_MAX_UART; i++) { > + if (at91_uarts[i]) > + platform_device_register(at91_uarts[i]); > + } Why can't you only call these init functions when booting non-DT? > } > > if (!atmel_default_console_device) > diff --git a/arch/arm/mach-at91/board-dt.c b/arch/arm/mach-at91/board-dt.c > new file mode 100644 > index 0000000..7bcb9a9 > --- /dev/null > +++ b/arch/arm/mach-at91/board-dt.c > @@ -0,0 +1,122 @@ > +/* > + * Setup code for AT91SAM Evaluation Kits with Device Tree support > + * > + * Covers: * AT91SAM9G45-EKES board > + * * AT91SAM9M10-EKES board > + * * AT91SAM9M10G45-EK board > + * > + * Copyright (C) 2011 Atmel, > + * 2011 Nicolas Ferre <nicolas.ferre@atmel.com> > + * > + * Licensed under GPLv2 or later. > + */ > + > +#include <linux/types.h> > +#include <linux/init.h> > +#include <linux/module.h> > +#include <linux/irqdomain.h> > +#include <linux/of_irq.h> > +#include <linux/of_platform.h> > + > +#include <mach/hardware.h> > +#include <mach/board.h> > +#include <mach/gpio.h> > +#include <mach/system_rev.h> > +#include <mach/at91sam9_smc.h> > + > +#include <asm/setup.h> > +#include <asm/irq.h> > +#include <asm/mach/arch.h> > +#include <asm/mach/map.h> > +#include <asm/mach/irq.h> > + > +#include "sam9_smc.h" > +#include "generic.h" > + > + > +static void __init ek_init_early(void) > +{ > + /* Initialize processor: 12.000 MHz crystal */ > + at91_initialize(12000000); > + > + /* DGBU on ttyS0. (Rx & Tx only) */ > + at91_register_uart(0, 0, 0); > + > + /* USART0 not connected on the -EK board */ > + /* USART1 on ttyS2. (Rx, Tx, RTS, CTS) */ > + at91_register_uart(AT91SAM9G45_ID_US1, 2, ATMEL_UART_CTS | ATMEL_UART_RTS); > + > + /* set serial console to ttyS0 (ie, DBGU) */ > + at91_set_serial_console(0); > +} > + > +/* det_pin is not connected */ > +static struct atmel_nand_data __initdata ek_nand_data = { > + .ale = 21, > + .cle = 22, > + .rdy_pin = AT91_PIN_PC8, > + .enable_pin = AT91_PIN_PC14, > +}; > + > +static struct sam9_smc_config __initdata ek_nand_smc_config = { > + .ncs_read_setup = 0, > + .nrd_setup = 2, > + .ncs_write_setup = 0, > + .nwe_setup = 2, > + > + .ncs_read_pulse = 4, > + .nrd_pulse = 4, > + .ncs_write_pulse = 4, > + .nwe_pulse = 4, > + > + .read_cycle = 7, > + .write_cycle = 7, > + > + .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE, > + .tdf_cycles = 3, > +}; > + > +static void __init ek_add_device_nand(void) > +{ > + ek_nand_data.bus_width_16 = board_have_nand_16bit(); > + /* setup bus-width (8 or 16) */ > + if (ek_nand_data.bus_width_16) > + ek_nand_smc_config.mode |= AT91_SMC_DBW_16; > + else > + ek_nand_smc_config.mode |= AT91_SMC_DBW_8; > + > + /* configure chip-select 3 (NAND) */ > + sam9_smc_configure(3, &ek_nand_smc_config); > + > + at91_add_device_nand(&ek_nand_data); > +} > + > +static const struct of_device_id aic_of_match[] __initconst = { > + { .compatible = "atmel,at91rm9200-aic", }, > + {}, > +}; > + > +static void __init at91_dt_device_init(void) > +{ > + irq_domain_generate_simple(aic_of_match, 0xfffff000, 0); Why is this not in the .init_irq function? I'm surprised your timer interrupt even works. Rob ^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH V2] AT91: dt: at91sam9g45 family and board device tree files @ 2011-10-05 13:00 ` Rob Herring 0 siblings, 0 replies; 49+ messages in thread From: Rob Herring @ 2011-10-05 13:00 UTC (permalink / raw) To: Nicolas Ferre Cc: grant.likely, devicetree-discuss, linux-kernel, linux-arm-kernel Nicolas, On 10/03/2011 05:00 AM, Nicolas Ferre wrote: > Create a new device tree source file for Atmel at91sam9g45 SoC family. > The Evaluation Kit at91sam9m10g45ek includes it. > This first basic support will be populated as drivers and boards will be > converted to device tree. > Contains serial, dma and interrupt controllers. > > The generic board file still takes advantage of platform data for early serial > init. As we need a storage media and the NAND flash driver is not converted to > DT yet, we keep old initialization for it. > > Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> > --- > V2: foundation for AT91SAM generic support > - device tree focused board file > - inclusion of USART DT support > - early USART and NAND still using platform data > > arch/arm/boot/dts/at91sam9g45.dtsi | 103 +++++++++++++++++++++++++ > arch/arm/boot/dts/at91sam9m10g45ek.dts | 37 +++++++++ > arch/arm/mach-at91/Kconfig | 11 +++ > arch/arm/mach-at91/Makefile | 3 + > arch/arm/mach-at91/Makefile.boot | 2 + > arch/arm/mach-at91/at91sam9g45_devices.c | 24 +++++-- > arch/arm/mach-at91/board-dt.c | 122 ++++++++++++++++++++++++++++++ > 7 files changed, 296 insertions(+), 6 deletions(-) > create mode 100644 arch/arm/boot/dts/at91sam9g45.dtsi > create mode 100644 arch/arm/boot/dts/at91sam9m10g45ek.dts > create mode 100644 arch/arm/mach-at91/board-dt.c > > diff --git a/arch/arm/boot/dts/at91sam9g45.dtsi b/arch/arm/boot/dts/at91sam9g45.dtsi > new file mode 100644 > index 0000000..7d3341f > --- /dev/null > +++ b/arch/arm/boot/dts/at91sam9g45.dtsi > @@ -0,0 +1,103 @@ > +/* > + * at91sam9g45.dtsi - Device Tree Include file for AT91SAM9G45 family SoC > + * applies to AT91SAM9G45, AT91SAM9M10, > + * AT91SAM9G46, AT91SAM9M11 SoC > + * > + * Copyright (C) 2011 Atmel, > + * 2011 Nicolas Ferre <nicolas.ferre@atmel.com> > + * > + * Licensed under GPLv2 or later. > + */ > + > +/include/ "skeleton.dtsi" > + > +/ { > + model = "Atmel AT91SAM9G45 family SoC"; > + compatible = "atmel,at91sam9g45"; > + interrupt-parent = <&aic>; > + > + aliases { > + serial0 = &dbgu; > + serial1 = &usart0; > + serial2 = &usart1; > + serial3 = &usart2; > + serial4 = &usart3; > + }; > + cpus { > + cpu@0 { > + compatible = "arm,arm926ejs"; > + }; > + }; > + > + memory { Should be memory@0x70000000 > + reg = <0x70000000 0x10000000>; > + }; > + > + ahb { > + compatible = "simple-bus"; > + #address-cells = <1>; > + #size-cells = <1>; > + ranges; > + > + apb { > + compatible = "simple-bus"; > + #address-cells = <1>; > + #size-cells = <1>; > + ranges; > + > + aic: interrupt-controller@fffff000 { > + #interrupt-cells = <1>; > + compatible = "atmel,at91rm9200-aic"; > + interrupt-controller; Add "interrupt-parent;" so that the aic is not the parent of itself. > + reg = <0xfffff000 0x200>; > + }; > + > + dma: dma-controller@ffffec00 { > + compatible = "atmel,at91sam9g45-hdmac"; > + reg = <0xffffec00 0x200>; > + interrupts = <21>; > + atmel,hdmac-nr-channels = <8>; > + atmel,hdmac-cap-memcpy; > + atmel,hdmac-cap-slave; > + }; > + > + dbgu: serial@ffffee00 { > + compatible = "atmel,at91sam9260-usart"; > + reg = <0xffffee00 0x200>; > + interrupts = <1>; > + }; > + > + usart0: serial@fff8c000 { > + compatible = "atmel,at91sam9260-usart"; > + reg = <0xfff8c000 0x4000>; Is 16K really used? I would set to 4K so your not wasting virtual space (probably not an issue yet on Atmel parts). > + interrupts = <7>; > + atmel,use-dma-rx; > + atmel,use-dma-tx; > + }; > + > + usart1: serial@fff90000 { > + compatible = "atmel,at91sam9260-usart"; > + reg = <0xfff90000 0x4000>; > + interrupts = <8>; > + atmel,use-dma-rx; > + atmel,use-dma-tx; > + }; > + > + usart2: serial@fff94000 { > + compatible = "atmel,at91sam9260-usart"; > + reg = <0xfff94000 0x4000>; > + interrupts = <9>; > + atmel,use-dma-rx; > + atmel,use-dma-tx; > + }; > + > + usart3: serial@fff98000 { > + compatible = "atmel,at91sam9260-usart"; > + reg = <0xfff98000 0x4000>; > + interrupts = <10>; > + atmel,use-dma-rx; > + atmel,use-dma-tx; > + }; > + }; > + }; > +}; > diff --git a/arch/arm/boot/dts/at91sam9m10g45ek.dts b/arch/arm/boot/dts/at91sam9m10g45ek.dts > new file mode 100644 > index 0000000..cf743de > --- /dev/null > +++ b/arch/arm/boot/dts/at91sam9m10g45ek.dts > @@ -0,0 +1,37 @@ > +/* > + * at91sam9m10g45ek.dts - Device Tree file for AT91SAM9M10G45-EK board > + * > + * Copyright (C) 2011 Atmel, > + * 2011 Nicolas Ferre <nicolas.ferre@atmel.com> > + * > + * Licensed under GPLv2 or later. > + */ > +/dts-v1/; > +/include/ "at91sam9g45.dtsi" > + > +/ { > + model = "Atmel AT91SAM9M10G45-EK"; > + compatible = "atmel,at91sam9m10g45ek", "atmel,at91sam9g45", "atmel,at91sam9"; > + > + chosen { > + bootargs = "mem=64M console=ttyS0,115200 mtdparts=atmel_nand:4M(bootstrap/uboot/kernel)ro,60M(rootfs),-(data) root=/dev/mtdblock1 rw rootfstype=jffs2"; > + }; > + > + memory { > + reg = <0x70000000 0x4000000>; > + }; > + > + ahb { > + apb { > + usart0: serial@fff8c000 { > + status = "disabled"; > + }; > + usart2: serial@fff94000 { > + status = "disabled"; > + }; > + usart3: serial@fff98000 { > + status = "disabled"; > + }; > + }; > + }; > +}; > diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig > index 2248467..4b59d96 100644 > --- a/arch/arm/mach-at91/Kconfig > +++ b/arch/arm/mach-at91/Kconfig > @@ -442,6 +442,17 @@ endif > > # ---------------------------------------------------------- > > +comment "Generic Board Type" > + > +config MACH_AT91SAM_DT > + bool "Atmel AT91SAM Evaluation Kits with device-tree support" > + select USE_OF > + help > + Select this if you want to experiment device-tree with > + an Atmel Evaluation Kit. > + > +# ---------------------------------------------------------- > + > comment "AT91 Board Options" > > config MTD_AT91_DATAFLASH_CARD > diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile > index bf57e8b..3ff245e 100644 > --- a/arch/arm/mach-at91/Makefile > +++ b/arch/arm/mach-at91/Makefile > @@ -74,6 +74,9 @@ obj-$(CONFIG_MACH_SNAPPER_9260) += board-snapper9260.o > # AT91SAM9G45 board-specific support > obj-$(CONFIG_MACH_AT91SAM9M10G45EK) += board-sam9m10g45ek.o > > +# AT91SAM board with device-tree > +obj-$(CONFIG_MACH_AT91SAM_DT) += board-dt.o > + > # AT91CAP9 board-specific support > obj-$(CONFIG_MACH_AT91CAP9ADK) += board-cap9adk.o > > diff --git a/arch/arm/mach-at91/Makefile.boot b/arch/arm/mach-at91/Makefile.boot > index 3462b81..d278863 100644 > --- a/arch/arm/mach-at91/Makefile.boot > +++ b/arch/arm/mach-at91/Makefile.boot > @@ -16,3 +16,5 @@ else > params_phys-y := 0x20000100 > initrd_phys-y := 0x20410000 > endif > + > +dtb-$(CONFIG_MACH_AT91SAM_DT) += at91sam9m10g45ek.dtb > diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c > index bb84040..27276b8 100644 > --- a/arch/arm/mach-at91/at91sam9g45_devices.c > +++ b/arch/arm/mach-at91/at91sam9g45_devices.c > @@ -69,9 +69,16 @@ static struct platform_device at_hdmac_device = { > > void __init at91_add_device_hdmac(void) > { > - dma_cap_set(DMA_MEMCPY, atdma_pdata.cap_mask); > - dma_cap_set(DMA_SLAVE, atdma_pdata.cap_mask); > - platform_device_register(&at_hdmac_device); > + struct device_node *of_node = > + of_find_node_by_name(NULL, "dma-controller"); You should really search by the compatible string. > + > + if (of_node) { > + of_node_put(of_node); > + } else { > + dma_cap_set(DMA_MEMCPY, atdma_pdata.cap_mask); > + dma_cap_set(DMA_SLAVE, atdma_pdata.cap_mask); This really should be in the driver. > + platform_device_register(&at_hdmac_device); > + } > } > #else > void __init at91_add_device_hdmac(void) {} > @@ -1556,10 +1563,15 @@ void __init at91_set_serial_console(unsigned portnr) > void __init at91_add_device_serial(void) > { > int i; > + struct device_node *of_node = of_find_node_by_name(NULL, "serial"); > > - for (i = 0; i < ATMEL_MAX_UART; i++) { > - if (at91_uarts[i]) > - platform_device_register(at91_uarts[i]); > + if (of_node) { > + of_node_put(of_node); > + } else { > + for (i = 0; i < ATMEL_MAX_UART; i++) { > + if (at91_uarts[i]) > + platform_device_register(at91_uarts[i]); > + } Why can't you only call these init functions when booting non-DT? > } > > if (!atmel_default_console_device) > diff --git a/arch/arm/mach-at91/board-dt.c b/arch/arm/mach-at91/board-dt.c > new file mode 100644 > index 0000000..7bcb9a9 > --- /dev/null > +++ b/arch/arm/mach-at91/board-dt.c > @@ -0,0 +1,122 @@ > +/* > + * Setup code for AT91SAM Evaluation Kits with Device Tree support > + * > + * Covers: * AT91SAM9G45-EKES board > + * * AT91SAM9M10-EKES board > + * * AT91SAM9M10G45-EK board > + * > + * Copyright (C) 2011 Atmel, > + * 2011 Nicolas Ferre <nicolas.ferre@atmel.com> > + * > + * Licensed under GPLv2 or later. > + */ > + > +#include <linux/types.h> > +#include <linux/init.h> > +#include <linux/module.h> > +#include <linux/irqdomain.h> > +#include <linux/of_irq.h> > +#include <linux/of_platform.h> > + > +#include <mach/hardware.h> > +#include <mach/board.h> > +#include <mach/gpio.h> > +#include <mach/system_rev.h> > +#include <mach/at91sam9_smc.h> > + > +#include <asm/setup.h> > +#include <asm/irq.h> > +#include <asm/mach/arch.h> > +#include <asm/mach/map.h> > +#include <asm/mach/irq.h> > + > +#include "sam9_smc.h" > +#include "generic.h" > + > + > +static void __init ek_init_early(void) > +{ > + /* Initialize processor: 12.000 MHz crystal */ > + at91_initialize(12000000); > + > + /* DGBU on ttyS0. (Rx & Tx only) */ > + at91_register_uart(0, 0, 0); > + > + /* USART0 not connected on the -EK board */ > + /* USART1 on ttyS2. (Rx, Tx, RTS, CTS) */ > + at91_register_uart(AT91SAM9G45_ID_US1, 2, ATMEL_UART_CTS | ATMEL_UART_RTS); > + > + /* set serial console to ttyS0 (ie, DBGU) */ > + at91_set_serial_console(0); > +} > + > +/* det_pin is not connected */ > +static struct atmel_nand_data __initdata ek_nand_data = { > + .ale = 21, > + .cle = 22, > + .rdy_pin = AT91_PIN_PC8, > + .enable_pin = AT91_PIN_PC14, > +}; > + > +static struct sam9_smc_config __initdata ek_nand_smc_config = { > + .ncs_read_setup = 0, > + .nrd_setup = 2, > + .ncs_write_setup = 0, > + .nwe_setup = 2, > + > + .ncs_read_pulse = 4, > + .nrd_pulse = 4, > + .ncs_write_pulse = 4, > + .nwe_pulse = 4, > + > + .read_cycle = 7, > + .write_cycle = 7, > + > + .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE, > + .tdf_cycles = 3, > +}; > + > +static void __init ek_add_device_nand(void) > +{ > + ek_nand_data.bus_width_16 = board_have_nand_16bit(); > + /* setup bus-width (8 or 16) */ > + if (ek_nand_data.bus_width_16) > + ek_nand_smc_config.mode |= AT91_SMC_DBW_16; > + else > + ek_nand_smc_config.mode |= AT91_SMC_DBW_8; > + > + /* configure chip-select 3 (NAND) */ > + sam9_smc_configure(3, &ek_nand_smc_config); > + > + at91_add_device_nand(&ek_nand_data); > +} > + > +static const struct of_device_id aic_of_match[] __initconst = { > + { .compatible = "atmel,at91rm9200-aic", }, > + {}, > +}; > + > +static void __init at91_dt_device_init(void) > +{ > + irq_domain_generate_simple(aic_of_match, 0xfffff000, 0); Why is this not in the .init_irq function? I'm surprised your timer interrupt even works. Rob ^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH V2] AT91: dt: at91sam9g45 family and board device tree files @ 2011-10-05 13:00 ` Rob Herring 0 siblings, 0 replies; 49+ messages in thread From: Rob Herring @ 2011-10-05 13:00 UTC (permalink / raw) To: Nicolas Ferre Cc: linux-arm-kernel, devicetree-discuss, grant.likely, linux-kernel Nicolas, On 10/03/2011 05:00 AM, Nicolas Ferre wrote: > Create a new device tree source file for Atmel at91sam9g45 SoC family. > The Evaluation Kit at91sam9m10g45ek includes it. > This first basic support will be populated as drivers and boards will be > converted to device tree. > Contains serial, dma and interrupt controllers. > > The generic board file still takes advantage of platform data for early serial > init. As we need a storage media and the NAND flash driver is not converted to > DT yet, we keep old initialization for it. > > Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> > --- > V2: foundation for AT91SAM generic support > - device tree focused board file > - inclusion of USART DT support > - early USART and NAND still using platform data > > arch/arm/boot/dts/at91sam9g45.dtsi | 103 +++++++++++++++++++++++++ > arch/arm/boot/dts/at91sam9m10g45ek.dts | 37 +++++++++ > arch/arm/mach-at91/Kconfig | 11 +++ > arch/arm/mach-at91/Makefile | 3 + > arch/arm/mach-at91/Makefile.boot | 2 + > arch/arm/mach-at91/at91sam9g45_devices.c | 24 +++++-- > arch/arm/mach-at91/board-dt.c | 122 ++++++++++++++++++++++++++++++ > 7 files changed, 296 insertions(+), 6 deletions(-) > create mode 100644 arch/arm/boot/dts/at91sam9g45.dtsi > create mode 100644 arch/arm/boot/dts/at91sam9m10g45ek.dts > create mode 100644 arch/arm/mach-at91/board-dt.c > > diff --git a/arch/arm/boot/dts/at91sam9g45.dtsi b/arch/arm/boot/dts/at91sam9g45.dtsi > new file mode 100644 > index 0000000..7d3341f > --- /dev/null > +++ b/arch/arm/boot/dts/at91sam9g45.dtsi > @@ -0,0 +1,103 @@ > +/* > + * at91sam9g45.dtsi - Device Tree Include file for AT91SAM9G45 family SoC > + * applies to AT91SAM9G45, AT91SAM9M10, > + * AT91SAM9G46, AT91SAM9M11 SoC > + * > + * Copyright (C) 2011 Atmel, > + * 2011 Nicolas Ferre <nicolas.ferre@atmel.com> > + * > + * Licensed under GPLv2 or later. > + */ > + > +/include/ "skeleton.dtsi" > + > +/ { > + model = "Atmel AT91SAM9G45 family SoC"; > + compatible = "atmel,at91sam9g45"; > + interrupt-parent = <&aic>; > + > + aliases { > + serial0 = &dbgu; > + serial1 = &usart0; > + serial2 = &usart1; > + serial3 = &usart2; > + serial4 = &usart3; > + }; > + cpus { > + cpu@0 { > + compatible = "arm,arm926ejs"; > + }; > + }; > + > + memory { Should be memory@0x70000000 > + reg = <0x70000000 0x10000000>; > + }; > + > + ahb { > + compatible = "simple-bus"; > + #address-cells = <1>; > + #size-cells = <1>; > + ranges; > + > + apb { > + compatible = "simple-bus"; > + #address-cells = <1>; > + #size-cells = <1>; > + ranges; > + > + aic: interrupt-controller@fffff000 { > + #interrupt-cells = <1>; > + compatible = "atmel,at91rm9200-aic"; > + interrupt-controller; Add "interrupt-parent;" so that the aic is not the parent of itself. > + reg = <0xfffff000 0x200>; > + }; > + > + dma: dma-controller@ffffec00 { > + compatible = "atmel,at91sam9g45-hdmac"; > + reg = <0xffffec00 0x200>; > + interrupts = <21>; > + atmel,hdmac-nr-channels = <8>; > + atmel,hdmac-cap-memcpy; > + atmel,hdmac-cap-slave; > + }; > + > + dbgu: serial@ffffee00 { > + compatible = "atmel,at91sam9260-usart"; > + reg = <0xffffee00 0x200>; > + interrupts = <1>; > + }; > + > + usart0: serial@fff8c000 { > + compatible = "atmel,at91sam9260-usart"; > + reg = <0xfff8c000 0x4000>; Is 16K really used? I would set to 4K so your not wasting virtual space (probably not an issue yet on Atmel parts). > + interrupts = <7>; > + atmel,use-dma-rx; > + atmel,use-dma-tx; > + }; > + > + usart1: serial@fff90000 { > + compatible = "atmel,at91sam9260-usart"; > + reg = <0xfff90000 0x4000>; > + interrupts = <8>; > + atmel,use-dma-rx; > + atmel,use-dma-tx; > + }; > + > + usart2: serial@fff94000 { > + compatible = "atmel,at91sam9260-usart"; > + reg = <0xfff94000 0x4000>; > + interrupts = <9>; > + atmel,use-dma-rx; > + atmel,use-dma-tx; > + }; > + > + usart3: serial@fff98000 { > + compatible = "atmel,at91sam9260-usart"; > + reg = <0xfff98000 0x4000>; > + interrupts = <10>; > + atmel,use-dma-rx; > + atmel,use-dma-tx; > + }; > + }; > + }; > +}; > diff --git a/arch/arm/boot/dts/at91sam9m10g45ek.dts b/arch/arm/boot/dts/at91sam9m10g45ek.dts > new file mode 100644 > index 0000000..cf743de > --- /dev/null > +++ b/arch/arm/boot/dts/at91sam9m10g45ek.dts > @@ -0,0 +1,37 @@ > +/* > + * at91sam9m10g45ek.dts - Device Tree file for AT91SAM9M10G45-EK board > + * > + * Copyright (C) 2011 Atmel, > + * 2011 Nicolas Ferre <nicolas.ferre@atmel.com> > + * > + * Licensed under GPLv2 or later. > + */ > +/dts-v1/; > +/include/ "at91sam9g45.dtsi" > + > +/ { > + model = "Atmel AT91SAM9M10G45-EK"; > + compatible = "atmel,at91sam9m10g45ek", "atmel,at91sam9g45", "atmel,at91sam9"; > + > + chosen { > + bootargs = "mem=64M console=ttyS0,115200 mtdparts=atmel_nand:4M(bootstrap/uboot/kernel)ro,60M(rootfs),-(data) root=/dev/mtdblock1 rw rootfstype=jffs2"; > + }; > + > + memory { > + reg = <0x70000000 0x4000000>; > + }; > + > + ahb { > + apb { > + usart0: serial@fff8c000 { > + status = "disabled"; > + }; > + usart2: serial@fff94000 { > + status = "disabled"; > + }; > + usart3: serial@fff98000 { > + status = "disabled"; > + }; > + }; > + }; > +}; > diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig > index 2248467..4b59d96 100644 > --- a/arch/arm/mach-at91/Kconfig > +++ b/arch/arm/mach-at91/Kconfig > @@ -442,6 +442,17 @@ endif > > # ---------------------------------------------------------- > > +comment "Generic Board Type" > + > +config MACH_AT91SAM_DT > + bool "Atmel AT91SAM Evaluation Kits with device-tree support" > + select USE_OF > + help > + Select this if you want to experiment device-tree with > + an Atmel Evaluation Kit. > + > +# ---------------------------------------------------------- > + > comment "AT91 Board Options" > > config MTD_AT91_DATAFLASH_CARD > diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile > index bf57e8b..3ff245e 100644 > --- a/arch/arm/mach-at91/Makefile > +++ b/arch/arm/mach-at91/Makefile > @@ -74,6 +74,9 @@ obj-$(CONFIG_MACH_SNAPPER_9260) += board-snapper9260.o > # AT91SAM9G45 board-specific support > obj-$(CONFIG_MACH_AT91SAM9M10G45EK) += board-sam9m10g45ek.o > > +# AT91SAM board with device-tree > +obj-$(CONFIG_MACH_AT91SAM_DT) += board-dt.o > + > # AT91CAP9 board-specific support > obj-$(CONFIG_MACH_AT91CAP9ADK) += board-cap9adk.o > > diff --git a/arch/arm/mach-at91/Makefile.boot b/arch/arm/mach-at91/Makefile.boot > index 3462b81..d278863 100644 > --- a/arch/arm/mach-at91/Makefile.boot > +++ b/arch/arm/mach-at91/Makefile.boot > @@ -16,3 +16,5 @@ else > params_phys-y := 0x20000100 > initrd_phys-y := 0x20410000 > endif > + > +dtb-$(CONFIG_MACH_AT91SAM_DT) += at91sam9m10g45ek.dtb > diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c > index bb84040..27276b8 100644 > --- a/arch/arm/mach-at91/at91sam9g45_devices.c > +++ b/arch/arm/mach-at91/at91sam9g45_devices.c > @@ -69,9 +69,16 @@ static struct platform_device at_hdmac_device = { > > void __init at91_add_device_hdmac(void) > { > - dma_cap_set(DMA_MEMCPY, atdma_pdata.cap_mask); > - dma_cap_set(DMA_SLAVE, atdma_pdata.cap_mask); > - platform_device_register(&at_hdmac_device); > + struct device_node *of_node = > + of_find_node_by_name(NULL, "dma-controller"); You should really search by the compatible string. > + > + if (of_node) { > + of_node_put(of_node); > + } else { > + dma_cap_set(DMA_MEMCPY, atdma_pdata.cap_mask); > + dma_cap_set(DMA_SLAVE, atdma_pdata.cap_mask); This really should be in the driver. > + platform_device_register(&at_hdmac_device); > + } > } > #else > void __init at91_add_device_hdmac(void) {} > @@ -1556,10 +1563,15 @@ void __init at91_set_serial_console(unsigned portnr) > void __init at91_add_device_serial(void) > { > int i; > + struct device_node *of_node = of_find_node_by_name(NULL, "serial"); > > - for (i = 0; i < ATMEL_MAX_UART; i++) { > - if (at91_uarts[i]) > - platform_device_register(at91_uarts[i]); > + if (of_node) { > + of_node_put(of_node); > + } else { > + for (i = 0; i < ATMEL_MAX_UART; i++) { > + if (at91_uarts[i]) > + platform_device_register(at91_uarts[i]); > + } Why can't you only call these init functions when booting non-DT? > } > > if (!atmel_default_console_device) > diff --git a/arch/arm/mach-at91/board-dt.c b/arch/arm/mach-at91/board-dt.c > new file mode 100644 > index 0000000..7bcb9a9 > --- /dev/null > +++ b/arch/arm/mach-at91/board-dt.c > @@ -0,0 +1,122 @@ > +/* > + * Setup code for AT91SAM Evaluation Kits with Device Tree support > + * > + * Covers: * AT91SAM9G45-EKES board > + * * AT91SAM9M10-EKES board > + * * AT91SAM9M10G45-EK board > + * > + * Copyright (C) 2011 Atmel, > + * 2011 Nicolas Ferre <nicolas.ferre@atmel.com> > + * > + * Licensed under GPLv2 or later. > + */ > + > +#include <linux/types.h> > +#include <linux/init.h> > +#include <linux/module.h> > +#include <linux/irqdomain.h> > +#include <linux/of_irq.h> > +#include <linux/of_platform.h> > + > +#include <mach/hardware.h> > +#include <mach/board.h> > +#include <mach/gpio.h> > +#include <mach/system_rev.h> > +#include <mach/at91sam9_smc.h> > + > +#include <asm/setup.h> > +#include <asm/irq.h> > +#include <asm/mach/arch.h> > +#include <asm/mach/map.h> > +#include <asm/mach/irq.h> > + > +#include "sam9_smc.h" > +#include "generic.h" > + > + > +static void __init ek_init_early(void) > +{ > + /* Initialize processor: 12.000 MHz crystal */ > + at91_initialize(12000000); > + > + /* DGBU on ttyS0. (Rx & Tx only) */ > + at91_register_uart(0, 0, 0); > + > + /* USART0 not connected on the -EK board */ > + /* USART1 on ttyS2. (Rx, Tx, RTS, CTS) */ > + at91_register_uart(AT91SAM9G45_ID_US1, 2, ATMEL_UART_CTS | ATMEL_UART_RTS); > + > + /* set serial console to ttyS0 (ie, DBGU) */ > + at91_set_serial_console(0); > +} > + > +/* det_pin is not connected */ > +static struct atmel_nand_data __initdata ek_nand_data = { > + .ale = 21, > + .cle = 22, > + .rdy_pin = AT91_PIN_PC8, > + .enable_pin = AT91_PIN_PC14, > +}; > + > +static struct sam9_smc_config __initdata ek_nand_smc_config = { > + .ncs_read_setup = 0, > + .nrd_setup = 2, > + .ncs_write_setup = 0, > + .nwe_setup = 2, > + > + .ncs_read_pulse = 4, > + .nrd_pulse = 4, > + .ncs_write_pulse = 4, > + .nwe_pulse = 4, > + > + .read_cycle = 7, > + .write_cycle = 7, > + > + .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE, > + .tdf_cycles = 3, > +}; > + > +static void __init ek_add_device_nand(void) > +{ > + ek_nand_data.bus_width_16 = board_have_nand_16bit(); > + /* setup bus-width (8 or 16) */ > + if (ek_nand_data.bus_width_16) > + ek_nand_smc_config.mode |= AT91_SMC_DBW_16; > + else > + ek_nand_smc_config.mode |= AT91_SMC_DBW_8; > + > + /* configure chip-select 3 (NAND) */ > + sam9_smc_configure(3, &ek_nand_smc_config); > + > + at91_add_device_nand(&ek_nand_data); > +} > + > +static const struct of_device_id aic_of_match[] __initconst = { > + { .compatible = "atmel,at91rm9200-aic", }, > + {}, > +}; > + > +static void __init at91_dt_device_init(void) > +{ > + irq_domain_generate_simple(aic_of_match, 0xfffff000, 0); Why is this not in the .init_irq function? I'm surprised your timer interrupt even works. Rob ^ permalink raw reply [flat|nested] 49+ messages in thread
* [PATCH V2] AT91: dt: at91sam9g45 family and board device tree files 2011-10-05 13:00 ` Rob Herring (?) @ 2011-10-07 12:56 ` Nicolas Ferre -1 siblings, 0 replies; 49+ messages in thread From: Nicolas Ferre @ 2011-10-07 12:56 UTC (permalink / raw) To: linux-arm-kernel On 10/05/2011 03:00 PM, Rob Herring : > Nicolas, > > On 10/03/2011 05:00 AM, Nicolas Ferre wrote: >> Create a new device tree source file for Atmel at91sam9g45 SoC family. >> The Evaluation Kit at91sam9m10g45ek includes it. >> This first basic support will be populated as drivers and boards will be >> converted to device tree. >> Contains serial, dma and interrupt controllers. >> >> The generic board file still takes advantage of platform data for early serial >> init. As we need a storage media and the NAND flash driver is not converted to >> DT yet, we keep old initialization for it. >> >> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> >> --- >> V2: foundation for AT91SAM generic support >> - device tree focused board file >> - inclusion of USART DT support >> - early USART and NAND still using platform data >> >> arch/arm/boot/dts/at91sam9g45.dtsi | 103 +++++++++++++++++++++++++ >> arch/arm/boot/dts/at91sam9m10g45ek.dts | 37 +++++++++ >> arch/arm/mach-at91/Kconfig | 11 +++ >> arch/arm/mach-at91/Makefile | 3 + >> arch/arm/mach-at91/Makefile.boot | 2 + >> arch/arm/mach-at91/at91sam9g45_devices.c | 24 +++++-- >> arch/arm/mach-at91/board-dt.c | 122 ++++++++++++++++++++++++++++++ >> 7 files changed, 296 insertions(+), 6 deletions(-) >> create mode 100644 arch/arm/boot/dts/at91sam9g45.dtsi >> create mode 100644 arch/arm/boot/dts/at91sam9m10g45ek.dts >> create mode 100644 arch/arm/mach-at91/board-dt.c >> >> diff --git a/arch/arm/boot/dts/at91sam9g45.dtsi b/arch/arm/boot/dts/at91sam9g45.dtsi >> new file mode 100644 >> index 0000000..7d3341f >> --- /dev/null >> +++ b/arch/arm/boot/dts/at91sam9g45.dtsi >> @@ -0,0 +1,103 @@ >> +/* >> + * at91sam9g45.dtsi - Device Tree Include file for AT91SAM9G45 family SoC >> + * applies to AT91SAM9G45, AT91SAM9M10, >> + * AT91SAM9G46, AT91SAM9M11 SoC >> + * >> + * Copyright (C) 2011 Atmel, >> + * 2011 Nicolas Ferre <nicolas.ferre@atmel.com> >> + * >> + * Licensed under GPLv2 or later. >> + */ >> + >> +/include/ "skeleton.dtsi" >> + >> +/ { >> + model = "Atmel AT91SAM9G45 family SoC"; >> + compatible = "atmel,at91sam9g45"; >> + interrupt-parent = <&aic>; >> + >> + aliases { >> + serial0 = &dbgu; >> + serial1 = &usart0; >> + serial2 = &usart1; >> + serial3 = &usart2; >> + serial4 = &usart3; >> + }; >> + cpus { >> + cpu at 0 { >> + compatible = "arm,arm926ejs"; >> + }; >> + }; >> + >> + memory { > > Should be memory at 0x70000000 > >> + reg = <0x70000000 0x10000000>; >> + }; >> + >> + ahb { >> + compatible = "simple-bus"; >> + #address-cells = <1>; >> + #size-cells = <1>; >> + ranges; >> + >> + apb { >> + compatible = "simple-bus"; >> + #address-cells = <1>; >> + #size-cells = <1>; >> + ranges; >> + >> + aic: interrupt-controller at fffff000 { >> + #interrupt-cells = <1>; >> + compatible = "atmel,at91rm9200-aic"; >> + interrupt-controller; > > Add "interrupt-parent;" so that the aic is not the parent of itself. > >> + reg = <0xfffff000 0x200>; >> + }; >> + >> + dma: dma-controller at ffffec00 { >> + compatible = "atmel,at91sam9g45-hdmac"; >> + reg = <0xffffec00 0x200>; >> + interrupts = <21>; >> + atmel,hdmac-nr-channels = <8>; >> + atmel,hdmac-cap-memcpy; >> + atmel,hdmac-cap-slave; >> + }; >> + >> + dbgu: serial at ffffee00 { >> + compatible = "atmel,at91sam9260-usart"; >> + reg = <0xffffee00 0x200>; >> + interrupts = <1>; >> + }; >> + >> + usart0: serial at fff8c000 { >> + compatible = "atmel,at91sam9260-usart"; >> + reg = <0xfff8c000 0x4000>; > > Is 16K really used? I would set to 4K so your not wasting virtual space > (probably not an issue yet on Atmel parts). Yes, I can adapt this value to the real size of register bank. The memory map on the datasheet is not precise about this and I have to refer to the IP documentation itself. But anyway, if it has an interest, I can adapt this to real values. >> + interrupts = <7>; >> + atmel,use-dma-rx; >> + atmel,use-dma-tx; >> + }; >> + >> + usart1: serial at fff90000 { >> + compatible = "atmel,at91sam9260-usart"; >> + reg = <0xfff90000 0x4000>; >> + interrupts = <8>; >> + atmel,use-dma-rx; >> + atmel,use-dma-tx; >> + }; >> + >> + usart2: serial at fff94000 { >> + compatible = "atmel,at91sam9260-usart"; >> + reg = <0xfff94000 0x4000>; >> + interrupts = <9>; >> + atmel,use-dma-rx; >> + atmel,use-dma-tx; >> + }; >> + >> + usart3: serial at fff98000 { >> + compatible = "atmel,at91sam9260-usart"; >> + reg = <0xfff98000 0x4000>; >> + interrupts = <10>; >> + atmel,use-dma-rx; >> + atmel,use-dma-tx; >> + }; >> + }; >> + }; >> +}; >> diff --git a/arch/arm/boot/dts/at91sam9m10g45ek.dts b/arch/arm/boot/dts/at91sam9m10g45ek.dts >> new file mode 100644 >> index 0000000..cf743de >> --- /dev/null >> +++ b/arch/arm/boot/dts/at91sam9m10g45ek.dts >> @@ -0,0 +1,37 @@ >> +/* >> + * at91sam9m10g45ek.dts - Device Tree file for AT91SAM9M10G45-EK board >> + * >> + * Copyright (C) 2011 Atmel, >> + * 2011 Nicolas Ferre <nicolas.ferre@atmel.com> >> + * >> + * Licensed under GPLv2 or later. >> + */ >> +/dts-v1/; >> +/include/ "at91sam9g45.dtsi" >> + >> +/ { >> + model = "Atmel AT91SAM9M10G45-EK"; >> + compatible = "atmel,at91sam9m10g45ek", "atmel,at91sam9g45", "atmel,at91sam9"; >> + >> + chosen { >> + bootargs = "mem=64M console=ttyS0,115200 mtdparts=atmel_nand:4M(bootstrap/uboot/kernel)ro,60M(rootfs),-(data) root=/dev/mtdblock1 rw rootfstype=jffs2"; >> + }; >> + >> + memory { >> + reg = <0x70000000 0x4000000>; >> + }; >> + >> + ahb { >> + apb { >> + usart0: serial at fff8c000 { >> + status = "disabled"; >> + }; >> + usart2: serial at fff94000 { >> + status = "disabled"; >> + }; >> + usart3: serial at fff98000 { >> + status = "disabled"; >> + }; >> + }; >> + }; >> +}; >> diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig >> index 2248467..4b59d96 100644 >> --- a/arch/arm/mach-at91/Kconfig >> +++ b/arch/arm/mach-at91/Kconfig >> @@ -442,6 +442,17 @@ endif >> >> # ---------------------------------------------------------- >> >> +comment "Generic Board Type" >> + >> +config MACH_AT91SAM_DT >> + bool "Atmel AT91SAM Evaluation Kits with device-tree support" >> + select USE_OF >> + help >> + Select this if you want to experiment device-tree with >> + an Atmel Evaluation Kit. >> + >> +# ---------------------------------------------------------- >> + >> comment "AT91 Board Options" >> >> config MTD_AT91_DATAFLASH_CARD >> diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile >> index bf57e8b..3ff245e 100644 >> --- a/arch/arm/mach-at91/Makefile >> +++ b/arch/arm/mach-at91/Makefile >> @@ -74,6 +74,9 @@ obj-$(CONFIG_MACH_SNAPPER_9260) += board-snapper9260.o >> # AT91SAM9G45 board-specific support >> obj-$(CONFIG_MACH_AT91SAM9M10G45EK) += board-sam9m10g45ek.o >> >> +# AT91SAM board with device-tree >> +obj-$(CONFIG_MACH_AT91SAM_DT) += board-dt.o >> + >> # AT91CAP9 board-specific support >> obj-$(CONFIG_MACH_AT91CAP9ADK) += board-cap9adk.o >> >> diff --git a/arch/arm/mach-at91/Makefile.boot b/arch/arm/mach-at91/Makefile.boot >> index 3462b81..d278863 100644 >> --- a/arch/arm/mach-at91/Makefile.boot >> +++ b/arch/arm/mach-at91/Makefile.boot >> @@ -16,3 +16,5 @@ else >> params_phys-y := 0x20000100 >> initrd_phys-y := 0x20410000 >> endif >> + >> +dtb-$(CONFIG_MACH_AT91SAM_DT) += at91sam9m10g45ek.dtb >> diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c >> index bb84040..27276b8 100644 >> --- a/arch/arm/mach-at91/at91sam9g45_devices.c >> +++ b/arch/arm/mach-at91/at91sam9g45_devices.c >> @@ -69,9 +69,16 @@ static struct platform_device at_hdmac_device = { >> >> void __init at91_add_device_hdmac(void) >> { >> - dma_cap_set(DMA_MEMCPY, atdma_pdata.cap_mask); >> - dma_cap_set(DMA_SLAVE, atdma_pdata.cap_mask); >> - platform_device_register(&at_hdmac_device); >> + struct device_node *of_node = >> + of_find_node_by_name(NULL, "dma-controller"); > > You should really search by the compatible string. > >> + >> + if (of_node) { >> + of_node_put(of_node); >> + } else { >> + dma_cap_set(DMA_MEMCPY, atdma_pdata.cap_mask); >> + dma_cap_set(DMA_SLAVE, atdma_pdata.cap_mask); > > This really should be in the driver. Yes, I will try to find a way to get rid of those platform data. >> + platform_device_register(&at_hdmac_device); >> + } >> } >> #else >> void __init at91_add_device_hdmac(void) {} >> @@ -1556,10 +1563,15 @@ void __init at91_set_serial_console(unsigned portnr) >> void __init at91_add_device_serial(void) >> { >> int i; >> + struct device_node *of_node = of_find_node_by_name(NULL, "serial"); >> >> - for (i = 0; i < ATMEL_MAX_UART; i++) { >> - if (at91_uarts[i]) >> - platform_device_register(at91_uarts[i]); >> + if (of_node) { >> + of_node_put(of_node); >> + } else { >> + for (i = 0; i < ATMEL_MAX_UART; i++) { >> + if (at91_uarts[i]) >> + platform_device_register(at91_uarts[i]); >> + } > > Why can't you only call these init functions when booting non-DT? For the dma driver function: this init function is called as an arch_initcall(). But for the 91_add_device_serial() function, I can simply avoid calling it, like you suggest. >> } >> >> if (!atmel_default_console_device) >> diff --git a/arch/arm/mach-at91/board-dt.c b/arch/arm/mach-at91/board-dt.c >> new file mode 100644 >> index 0000000..7bcb9a9 >> --- /dev/null >> +++ b/arch/arm/mach-at91/board-dt.c >> @@ -0,0 +1,122 @@ >> +/* >> + * Setup code for AT91SAM Evaluation Kits with Device Tree support >> + * >> + * Covers: * AT91SAM9G45-EKES board >> + * * AT91SAM9M10-EKES board >> + * * AT91SAM9M10G45-EK board >> + * >> + * Copyright (C) 2011 Atmel, >> + * 2011 Nicolas Ferre <nicolas.ferre@atmel.com> >> + * >> + * Licensed under GPLv2 or later. >> + */ >> + >> +#include <linux/types.h> >> +#include <linux/init.h> >> +#include <linux/module.h> >> +#include <linux/irqdomain.h> >> +#include <linux/of_irq.h> >> +#include <linux/of_platform.h> >> + >> +#include <mach/hardware.h> >> +#include <mach/board.h> >> +#include <mach/gpio.h> >> +#include <mach/system_rev.h> >> +#include <mach/at91sam9_smc.h> >> + >> +#include <asm/setup.h> >> +#include <asm/irq.h> >> +#include <asm/mach/arch.h> >> +#include <asm/mach/map.h> >> +#include <asm/mach/irq.h> >> + >> +#include "sam9_smc.h" >> +#include "generic.h" >> + >> + >> +static void __init ek_init_early(void) >> +{ >> + /* Initialize processor: 12.000 MHz crystal */ >> + at91_initialize(12000000); >> + >> + /* DGBU on ttyS0. (Rx & Tx only) */ >> + at91_register_uart(0, 0, 0); >> + >> + /* USART0 not connected on the -EK board */ >> + /* USART1 on ttyS2. (Rx, Tx, RTS, CTS) */ >> + at91_register_uart(AT91SAM9G45_ID_US1, 2, ATMEL_UART_CTS | ATMEL_UART_RTS); >> + >> + /* set serial console to ttyS0 (ie, DBGU) */ >> + at91_set_serial_console(0); >> +} >> + >> +/* det_pin is not connected */ >> +static struct atmel_nand_data __initdata ek_nand_data = { >> + .ale = 21, >> + .cle = 22, >> + .rdy_pin = AT91_PIN_PC8, >> + .enable_pin = AT91_PIN_PC14, >> +}; >> + >> +static struct sam9_smc_config __initdata ek_nand_smc_config = { >> + .ncs_read_setup = 0, >> + .nrd_setup = 2, >> + .ncs_write_setup = 0, >> + .nwe_setup = 2, >> + >> + .ncs_read_pulse = 4, >> + .nrd_pulse = 4, >> + .ncs_write_pulse = 4, >> + .nwe_pulse = 4, >> + >> + .read_cycle = 7, >> + .write_cycle = 7, >> + >> + .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE, >> + .tdf_cycles = 3, >> +}; >> + >> +static void __init ek_add_device_nand(void) >> +{ >> + ek_nand_data.bus_width_16 = board_have_nand_16bit(); >> + /* setup bus-width (8 or 16) */ >> + if (ek_nand_data.bus_width_16) >> + ek_nand_smc_config.mode |= AT91_SMC_DBW_16; >> + else >> + ek_nand_smc_config.mode |= AT91_SMC_DBW_8; >> + >> + /* configure chip-select 3 (NAND) */ >> + sam9_smc_configure(3, &ek_nand_smc_config); >> + >> + at91_add_device_nand(&ek_nand_data); >> +} >> + >> +static const struct of_device_id aic_of_match[] __initconst = { >> + { .compatible = "atmel,at91rm9200-aic", }, >> + {}, >> +}; >> + >> +static void __init at91_dt_device_init(void) >> +{ >> + irq_domain_generate_simple(aic_of_match, 0xfffff000, 0); > > Why is this not in the .init_irq function? I'm surprised your timer > interrupt even works. Ok, I will add an .init_irq function in my v3 patch. BTW, as I am a little bit confused about the "early" serial initialization, what is the proper way to address this? So, can you tell me or give me a pointer to an update on this topic: I know that it is moving a lot those days... Thanks a lot for your review. Best regards, -- Nicolas Ferre ^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH V2] AT91: dt: at91sam9g45 family and board device tree files @ 2011-10-07 12:56 ` Nicolas Ferre 0 siblings, 0 replies; 49+ messages in thread From: Nicolas Ferre @ 2011-10-07 12:56 UTC (permalink / raw) To: Rob Herring, grant.likely Cc: devicetree-discuss, Jean-Christophe PLAGNIOL-VILLARD, linux-kernel, linux-arm-kernel On 10/05/2011 03:00 PM, Rob Herring : > Nicolas, > > On 10/03/2011 05:00 AM, Nicolas Ferre wrote: >> Create a new device tree source file for Atmel at91sam9g45 SoC family. >> The Evaluation Kit at91sam9m10g45ek includes it. >> This first basic support will be populated as drivers and boards will be >> converted to device tree. >> Contains serial, dma and interrupt controllers. >> >> The generic board file still takes advantage of platform data for early serial >> init. As we need a storage media and the NAND flash driver is not converted to >> DT yet, we keep old initialization for it. >> >> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> >> --- >> V2: foundation for AT91SAM generic support >> - device tree focused board file >> - inclusion of USART DT support >> - early USART and NAND still using platform data >> >> arch/arm/boot/dts/at91sam9g45.dtsi | 103 +++++++++++++++++++++++++ >> arch/arm/boot/dts/at91sam9m10g45ek.dts | 37 +++++++++ >> arch/arm/mach-at91/Kconfig | 11 +++ >> arch/arm/mach-at91/Makefile | 3 + >> arch/arm/mach-at91/Makefile.boot | 2 + >> arch/arm/mach-at91/at91sam9g45_devices.c | 24 +++++-- >> arch/arm/mach-at91/board-dt.c | 122 ++++++++++++++++++++++++++++++ >> 7 files changed, 296 insertions(+), 6 deletions(-) >> create mode 100644 arch/arm/boot/dts/at91sam9g45.dtsi >> create mode 100644 arch/arm/boot/dts/at91sam9m10g45ek.dts >> create mode 100644 arch/arm/mach-at91/board-dt.c >> >> diff --git a/arch/arm/boot/dts/at91sam9g45.dtsi b/arch/arm/boot/dts/at91sam9g45.dtsi >> new file mode 100644 >> index 0000000..7d3341f >> --- /dev/null >> +++ b/arch/arm/boot/dts/at91sam9g45.dtsi >> @@ -0,0 +1,103 @@ >> +/* >> + * at91sam9g45.dtsi - Device Tree Include file for AT91SAM9G45 family SoC >> + * applies to AT91SAM9G45, AT91SAM9M10, >> + * AT91SAM9G46, AT91SAM9M11 SoC >> + * >> + * Copyright (C) 2011 Atmel, >> + * 2011 Nicolas Ferre <nicolas.ferre@atmel.com> >> + * >> + * Licensed under GPLv2 or later. >> + */ >> + >> +/include/ "skeleton.dtsi" >> + >> +/ { >> + model = "Atmel AT91SAM9G45 family SoC"; >> + compatible = "atmel,at91sam9g45"; >> + interrupt-parent = <&aic>; >> + >> + aliases { >> + serial0 = &dbgu; >> + serial1 = &usart0; >> + serial2 = &usart1; >> + serial3 = &usart2; >> + serial4 = &usart3; >> + }; >> + cpus { >> + cpu@0 { >> + compatible = "arm,arm926ejs"; >> + }; >> + }; >> + >> + memory { > > Should be memory@0x70000000 > >> + reg = <0x70000000 0x10000000>; >> + }; >> + >> + ahb { >> + compatible = "simple-bus"; >> + #address-cells = <1>; >> + #size-cells = <1>; >> + ranges; >> + >> + apb { >> + compatible = "simple-bus"; >> + #address-cells = <1>; >> + #size-cells = <1>; >> + ranges; >> + >> + aic: interrupt-controller@fffff000 { >> + #interrupt-cells = <1>; >> + compatible = "atmel,at91rm9200-aic"; >> + interrupt-controller; > > Add "interrupt-parent;" so that the aic is not the parent of itself. > >> + reg = <0xfffff000 0x200>; >> + }; >> + >> + dma: dma-controller@ffffec00 { >> + compatible = "atmel,at91sam9g45-hdmac"; >> + reg = <0xffffec00 0x200>; >> + interrupts = <21>; >> + atmel,hdmac-nr-channels = <8>; >> + atmel,hdmac-cap-memcpy; >> + atmel,hdmac-cap-slave; >> + }; >> + >> + dbgu: serial@ffffee00 { >> + compatible = "atmel,at91sam9260-usart"; >> + reg = <0xffffee00 0x200>; >> + interrupts = <1>; >> + }; >> + >> + usart0: serial@fff8c000 { >> + compatible = "atmel,at91sam9260-usart"; >> + reg = <0xfff8c000 0x4000>; > > Is 16K really used? I would set to 4K so your not wasting virtual space > (probably not an issue yet on Atmel parts). Yes, I can adapt this value to the real size of register bank. The memory map on the datasheet is not precise about this and I have to refer to the IP documentation itself. But anyway, if it has an interest, I can adapt this to real values. >> + interrupts = <7>; >> + atmel,use-dma-rx; >> + atmel,use-dma-tx; >> + }; >> + >> + usart1: serial@fff90000 { >> + compatible = "atmel,at91sam9260-usart"; >> + reg = <0xfff90000 0x4000>; >> + interrupts = <8>; >> + atmel,use-dma-rx; >> + atmel,use-dma-tx; >> + }; >> + >> + usart2: serial@fff94000 { >> + compatible = "atmel,at91sam9260-usart"; >> + reg = <0xfff94000 0x4000>; >> + interrupts = <9>; >> + atmel,use-dma-rx; >> + atmel,use-dma-tx; >> + }; >> + >> + usart3: serial@fff98000 { >> + compatible = "atmel,at91sam9260-usart"; >> + reg = <0xfff98000 0x4000>; >> + interrupts = <10>; >> + atmel,use-dma-rx; >> + atmel,use-dma-tx; >> + }; >> + }; >> + }; >> +}; >> diff --git a/arch/arm/boot/dts/at91sam9m10g45ek.dts b/arch/arm/boot/dts/at91sam9m10g45ek.dts >> new file mode 100644 >> index 0000000..cf743de >> --- /dev/null >> +++ b/arch/arm/boot/dts/at91sam9m10g45ek.dts >> @@ -0,0 +1,37 @@ >> +/* >> + * at91sam9m10g45ek.dts - Device Tree file for AT91SAM9M10G45-EK board >> + * >> + * Copyright (C) 2011 Atmel, >> + * 2011 Nicolas Ferre <nicolas.ferre@atmel.com> >> + * >> + * Licensed under GPLv2 or later. >> + */ >> +/dts-v1/; >> +/include/ "at91sam9g45.dtsi" >> + >> +/ { >> + model = "Atmel AT91SAM9M10G45-EK"; >> + compatible = "atmel,at91sam9m10g45ek", "atmel,at91sam9g45", "atmel,at91sam9"; >> + >> + chosen { >> + bootargs = "mem=64M console=ttyS0,115200 mtdparts=atmel_nand:4M(bootstrap/uboot/kernel)ro,60M(rootfs),-(data) root=/dev/mtdblock1 rw rootfstype=jffs2"; >> + }; >> + >> + memory { >> + reg = <0x70000000 0x4000000>; >> + }; >> + >> + ahb { >> + apb { >> + usart0: serial@fff8c000 { >> + status = "disabled"; >> + }; >> + usart2: serial@fff94000 { >> + status = "disabled"; >> + }; >> + usart3: serial@fff98000 { >> + status = "disabled"; >> + }; >> + }; >> + }; >> +}; >> diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig >> index 2248467..4b59d96 100644 >> --- a/arch/arm/mach-at91/Kconfig >> +++ b/arch/arm/mach-at91/Kconfig >> @@ -442,6 +442,17 @@ endif >> >> # ---------------------------------------------------------- >> >> +comment "Generic Board Type" >> + >> +config MACH_AT91SAM_DT >> + bool "Atmel AT91SAM Evaluation Kits with device-tree support" >> + select USE_OF >> + help >> + Select this if you want to experiment device-tree with >> + an Atmel Evaluation Kit. >> + >> +# ---------------------------------------------------------- >> + >> comment "AT91 Board Options" >> >> config MTD_AT91_DATAFLASH_CARD >> diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile >> index bf57e8b..3ff245e 100644 >> --- a/arch/arm/mach-at91/Makefile >> +++ b/arch/arm/mach-at91/Makefile >> @@ -74,6 +74,9 @@ obj-$(CONFIG_MACH_SNAPPER_9260) += board-snapper9260.o >> # AT91SAM9G45 board-specific support >> obj-$(CONFIG_MACH_AT91SAM9M10G45EK) += board-sam9m10g45ek.o >> >> +# AT91SAM board with device-tree >> +obj-$(CONFIG_MACH_AT91SAM_DT) += board-dt.o >> + >> # AT91CAP9 board-specific support >> obj-$(CONFIG_MACH_AT91CAP9ADK) += board-cap9adk.o >> >> diff --git a/arch/arm/mach-at91/Makefile.boot b/arch/arm/mach-at91/Makefile.boot >> index 3462b81..d278863 100644 >> --- a/arch/arm/mach-at91/Makefile.boot >> +++ b/arch/arm/mach-at91/Makefile.boot >> @@ -16,3 +16,5 @@ else >> params_phys-y := 0x20000100 >> initrd_phys-y := 0x20410000 >> endif >> + >> +dtb-$(CONFIG_MACH_AT91SAM_DT) += at91sam9m10g45ek.dtb >> diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c >> index bb84040..27276b8 100644 >> --- a/arch/arm/mach-at91/at91sam9g45_devices.c >> +++ b/arch/arm/mach-at91/at91sam9g45_devices.c >> @@ -69,9 +69,16 @@ static struct platform_device at_hdmac_device = { >> >> void __init at91_add_device_hdmac(void) >> { >> - dma_cap_set(DMA_MEMCPY, atdma_pdata.cap_mask); >> - dma_cap_set(DMA_SLAVE, atdma_pdata.cap_mask); >> - platform_device_register(&at_hdmac_device); >> + struct device_node *of_node = >> + of_find_node_by_name(NULL, "dma-controller"); > > You should really search by the compatible string. > >> + >> + if (of_node) { >> + of_node_put(of_node); >> + } else { >> + dma_cap_set(DMA_MEMCPY, atdma_pdata.cap_mask); >> + dma_cap_set(DMA_SLAVE, atdma_pdata.cap_mask); > > This really should be in the driver. Yes, I will try to find a way to get rid of those platform data. >> + platform_device_register(&at_hdmac_device); >> + } >> } >> #else >> void __init at91_add_device_hdmac(void) {} >> @@ -1556,10 +1563,15 @@ void __init at91_set_serial_console(unsigned portnr) >> void __init at91_add_device_serial(void) >> { >> int i; >> + struct device_node *of_node = of_find_node_by_name(NULL, "serial"); >> >> - for (i = 0; i < ATMEL_MAX_UART; i++) { >> - if (at91_uarts[i]) >> - platform_device_register(at91_uarts[i]); >> + if (of_node) { >> + of_node_put(of_node); >> + } else { >> + for (i = 0; i < ATMEL_MAX_UART; i++) { >> + if (at91_uarts[i]) >> + platform_device_register(at91_uarts[i]); >> + } > > Why can't you only call these init functions when booting non-DT? For the dma driver function: this init function is called as an arch_initcall(). But for the 91_add_device_serial() function, I can simply avoid calling it, like you suggest. >> } >> >> if (!atmel_default_console_device) >> diff --git a/arch/arm/mach-at91/board-dt.c b/arch/arm/mach-at91/board-dt.c >> new file mode 100644 >> index 0000000..7bcb9a9 >> --- /dev/null >> +++ b/arch/arm/mach-at91/board-dt.c >> @@ -0,0 +1,122 @@ >> +/* >> + * Setup code for AT91SAM Evaluation Kits with Device Tree support >> + * >> + * Covers: * AT91SAM9G45-EKES board >> + * * AT91SAM9M10-EKES board >> + * * AT91SAM9M10G45-EK board >> + * >> + * Copyright (C) 2011 Atmel, >> + * 2011 Nicolas Ferre <nicolas.ferre@atmel.com> >> + * >> + * Licensed under GPLv2 or later. >> + */ >> + >> +#include <linux/types.h> >> +#include <linux/init.h> >> +#include <linux/module.h> >> +#include <linux/irqdomain.h> >> +#include <linux/of_irq.h> >> +#include <linux/of_platform.h> >> + >> +#include <mach/hardware.h> >> +#include <mach/board.h> >> +#include <mach/gpio.h> >> +#include <mach/system_rev.h> >> +#include <mach/at91sam9_smc.h> >> + >> +#include <asm/setup.h> >> +#include <asm/irq.h> >> +#include <asm/mach/arch.h> >> +#include <asm/mach/map.h> >> +#include <asm/mach/irq.h> >> + >> +#include "sam9_smc.h" >> +#include "generic.h" >> + >> + >> +static void __init ek_init_early(void) >> +{ >> + /* Initialize processor: 12.000 MHz crystal */ >> + at91_initialize(12000000); >> + >> + /* DGBU on ttyS0. (Rx & Tx only) */ >> + at91_register_uart(0, 0, 0); >> + >> + /* USART0 not connected on the -EK board */ >> + /* USART1 on ttyS2. (Rx, Tx, RTS, CTS) */ >> + at91_register_uart(AT91SAM9G45_ID_US1, 2, ATMEL_UART_CTS | ATMEL_UART_RTS); >> + >> + /* set serial console to ttyS0 (ie, DBGU) */ >> + at91_set_serial_console(0); >> +} >> + >> +/* det_pin is not connected */ >> +static struct atmel_nand_data __initdata ek_nand_data = { >> + .ale = 21, >> + .cle = 22, >> + .rdy_pin = AT91_PIN_PC8, >> + .enable_pin = AT91_PIN_PC14, >> +}; >> + >> +static struct sam9_smc_config __initdata ek_nand_smc_config = { >> + .ncs_read_setup = 0, >> + .nrd_setup = 2, >> + .ncs_write_setup = 0, >> + .nwe_setup = 2, >> + >> + .ncs_read_pulse = 4, >> + .nrd_pulse = 4, >> + .ncs_write_pulse = 4, >> + .nwe_pulse = 4, >> + >> + .read_cycle = 7, >> + .write_cycle = 7, >> + >> + .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE, >> + .tdf_cycles = 3, >> +}; >> + >> +static void __init ek_add_device_nand(void) >> +{ >> + ek_nand_data.bus_width_16 = board_have_nand_16bit(); >> + /* setup bus-width (8 or 16) */ >> + if (ek_nand_data.bus_width_16) >> + ek_nand_smc_config.mode |= AT91_SMC_DBW_16; >> + else >> + ek_nand_smc_config.mode |= AT91_SMC_DBW_8; >> + >> + /* configure chip-select 3 (NAND) */ >> + sam9_smc_configure(3, &ek_nand_smc_config); >> + >> + at91_add_device_nand(&ek_nand_data); >> +} >> + >> +static const struct of_device_id aic_of_match[] __initconst = { >> + { .compatible = "atmel,at91rm9200-aic", }, >> + {}, >> +}; >> + >> +static void __init at91_dt_device_init(void) >> +{ >> + irq_domain_generate_simple(aic_of_match, 0xfffff000, 0); > > Why is this not in the .init_irq function? I'm surprised your timer > interrupt even works. Ok, I will add an .init_irq function in my v3 patch. BTW, as I am a little bit confused about the "early" serial initialization, what is the proper way to address this? So, can you tell me or give me a pointer to an update on this topic: I know that it is moving a lot those days... Thanks a lot for your review. Best regards, -- Nicolas Ferre ^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH V2] AT91: dt: at91sam9g45 family and board device tree files @ 2011-10-07 12:56 ` Nicolas Ferre 0 siblings, 0 replies; 49+ messages in thread From: Nicolas Ferre @ 2011-10-07 12:56 UTC (permalink / raw) To: Rob Herring, grant.likely Cc: linux-arm-kernel, devicetree-discuss, linux-kernel, Jean-Christophe PLAGNIOL-VILLARD On 10/05/2011 03:00 PM, Rob Herring : > Nicolas, > > On 10/03/2011 05:00 AM, Nicolas Ferre wrote: >> Create a new device tree source file for Atmel at91sam9g45 SoC family. >> The Evaluation Kit at91sam9m10g45ek includes it. >> This first basic support will be populated as drivers and boards will be >> converted to device tree. >> Contains serial, dma and interrupt controllers. >> >> The generic board file still takes advantage of platform data for early serial >> init. As we need a storage media and the NAND flash driver is not converted to >> DT yet, we keep old initialization for it. >> >> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> >> --- >> V2: foundation for AT91SAM generic support >> - device tree focused board file >> - inclusion of USART DT support >> - early USART and NAND still using platform data >> >> arch/arm/boot/dts/at91sam9g45.dtsi | 103 +++++++++++++++++++++++++ >> arch/arm/boot/dts/at91sam9m10g45ek.dts | 37 +++++++++ >> arch/arm/mach-at91/Kconfig | 11 +++ >> arch/arm/mach-at91/Makefile | 3 + >> arch/arm/mach-at91/Makefile.boot | 2 + >> arch/arm/mach-at91/at91sam9g45_devices.c | 24 +++++-- >> arch/arm/mach-at91/board-dt.c | 122 ++++++++++++++++++++++++++++++ >> 7 files changed, 296 insertions(+), 6 deletions(-) >> create mode 100644 arch/arm/boot/dts/at91sam9g45.dtsi >> create mode 100644 arch/arm/boot/dts/at91sam9m10g45ek.dts >> create mode 100644 arch/arm/mach-at91/board-dt.c >> >> diff --git a/arch/arm/boot/dts/at91sam9g45.dtsi b/arch/arm/boot/dts/at91sam9g45.dtsi >> new file mode 100644 >> index 0000000..7d3341f >> --- /dev/null >> +++ b/arch/arm/boot/dts/at91sam9g45.dtsi >> @@ -0,0 +1,103 @@ >> +/* >> + * at91sam9g45.dtsi - Device Tree Include file for AT91SAM9G45 family SoC >> + * applies to AT91SAM9G45, AT91SAM9M10, >> + * AT91SAM9G46, AT91SAM9M11 SoC >> + * >> + * Copyright (C) 2011 Atmel, >> + * 2011 Nicolas Ferre <nicolas.ferre@atmel.com> >> + * >> + * Licensed under GPLv2 or later. >> + */ >> + >> +/include/ "skeleton.dtsi" >> + >> +/ { >> + model = "Atmel AT91SAM9G45 family SoC"; >> + compatible = "atmel,at91sam9g45"; >> + interrupt-parent = <&aic>; >> + >> + aliases { >> + serial0 = &dbgu; >> + serial1 = &usart0; >> + serial2 = &usart1; >> + serial3 = &usart2; >> + serial4 = &usart3; >> + }; >> + cpus { >> + cpu@0 { >> + compatible = "arm,arm926ejs"; >> + }; >> + }; >> + >> + memory { > > Should be memory@0x70000000 > >> + reg = <0x70000000 0x10000000>; >> + }; >> + >> + ahb { >> + compatible = "simple-bus"; >> + #address-cells = <1>; >> + #size-cells = <1>; >> + ranges; >> + >> + apb { >> + compatible = "simple-bus"; >> + #address-cells = <1>; >> + #size-cells = <1>; >> + ranges; >> + >> + aic: interrupt-controller@fffff000 { >> + #interrupt-cells = <1>; >> + compatible = "atmel,at91rm9200-aic"; >> + interrupt-controller; > > Add "interrupt-parent;" so that the aic is not the parent of itself. > >> + reg = <0xfffff000 0x200>; >> + }; >> + >> + dma: dma-controller@ffffec00 { >> + compatible = "atmel,at91sam9g45-hdmac"; >> + reg = <0xffffec00 0x200>; >> + interrupts = <21>; >> + atmel,hdmac-nr-channels = <8>; >> + atmel,hdmac-cap-memcpy; >> + atmel,hdmac-cap-slave; >> + }; >> + >> + dbgu: serial@ffffee00 { >> + compatible = "atmel,at91sam9260-usart"; >> + reg = <0xffffee00 0x200>; >> + interrupts = <1>; >> + }; >> + >> + usart0: serial@fff8c000 { >> + compatible = "atmel,at91sam9260-usart"; >> + reg = <0xfff8c000 0x4000>; > > Is 16K really used? I would set to 4K so your not wasting virtual space > (probably not an issue yet on Atmel parts). Yes, I can adapt this value to the real size of register bank. The memory map on the datasheet is not precise about this and I have to refer to the IP documentation itself. But anyway, if it has an interest, I can adapt this to real values. >> + interrupts = <7>; >> + atmel,use-dma-rx; >> + atmel,use-dma-tx; >> + }; >> + >> + usart1: serial@fff90000 { >> + compatible = "atmel,at91sam9260-usart"; >> + reg = <0xfff90000 0x4000>; >> + interrupts = <8>; >> + atmel,use-dma-rx; >> + atmel,use-dma-tx; >> + }; >> + >> + usart2: serial@fff94000 { >> + compatible = "atmel,at91sam9260-usart"; >> + reg = <0xfff94000 0x4000>; >> + interrupts = <9>; >> + atmel,use-dma-rx; >> + atmel,use-dma-tx; >> + }; >> + >> + usart3: serial@fff98000 { >> + compatible = "atmel,at91sam9260-usart"; >> + reg = <0xfff98000 0x4000>; >> + interrupts = <10>; >> + atmel,use-dma-rx; >> + atmel,use-dma-tx; >> + }; >> + }; >> + }; >> +}; >> diff --git a/arch/arm/boot/dts/at91sam9m10g45ek.dts b/arch/arm/boot/dts/at91sam9m10g45ek.dts >> new file mode 100644 >> index 0000000..cf743de >> --- /dev/null >> +++ b/arch/arm/boot/dts/at91sam9m10g45ek.dts >> @@ -0,0 +1,37 @@ >> +/* >> + * at91sam9m10g45ek.dts - Device Tree file for AT91SAM9M10G45-EK board >> + * >> + * Copyright (C) 2011 Atmel, >> + * 2011 Nicolas Ferre <nicolas.ferre@atmel.com> >> + * >> + * Licensed under GPLv2 or later. >> + */ >> +/dts-v1/; >> +/include/ "at91sam9g45.dtsi" >> + >> +/ { >> + model = "Atmel AT91SAM9M10G45-EK"; >> + compatible = "atmel,at91sam9m10g45ek", "atmel,at91sam9g45", "atmel,at91sam9"; >> + >> + chosen { >> + bootargs = "mem=64M console=ttyS0,115200 mtdparts=atmel_nand:4M(bootstrap/uboot/kernel)ro,60M(rootfs),-(data) root=/dev/mtdblock1 rw rootfstype=jffs2"; >> + }; >> + >> + memory { >> + reg = <0x70000000 0x4000000>; >> + }; >> + >> + ahb { >> + apb { >> + usart0: serial@fff8c000 { >> + status = "disabled"; >> + }; >> + usart2: serial@fff94000 { >> + status = "disabled"; >> + }; >> + usart3: serial@fff98000 { >> + status = "disabled"; >> + }; >> + }; >> + }; >> +}; >> diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig >> index 2248467..4b59d96 100644 >> --- a/arch/arm/mach-at91/Kconfig >> +++ b/arch/arm/mach-at91/Kconfig >> @@ -442,6 +442,17 @@ endif >> >> # ---------------------------------------------------------- >> >> +comment "Generic Board Type" >> + >> +config MACH_AT91SAM_DT >> + bool "Atmel AT91SAM Evaluation Kits with device-tree support" >> + select USE_OF >> + help >> + Select this if you want to experiment device-tree with >> + an Atmel Evaluation Kit. >> + >> +# ---------------------------------------------------------- >> + >> comment "AT91 Board Options" >> >> config MTD_AT91_DATAFLASH_CARD >> diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile >> index bf57e8b..3ff245e 100644 >> --- a/arch/arm/mach-at91/Makefile >> +++ b/arch/arm/mach-at91/Makefile >> @@ -74,6 +74,9 @@ obj-$(CONFIG_MACH_SNAPPER_9260) += board-snapper9260.o >> # AT91SAM9G45 board-specific support >> obj-$(CONFIG_MACH_AT91SAM9M10G45EK) += board-sam9m10g45ek.o >> >> +# AT91SAM board with device-tree >> +obj-$(CONFIG_MACH_AT91SAM_DT) += board-dt.o >> + >> # AT91CAP9 board-specific support >> obj-$(CONFIG_MACH_AT91CAP9ADK) += board-cap9adk.o >> >> diff --git a/arch/arm/mach-at91/Makefile.boot b/arch/arm/mach-at91/Makefile.boot >> index 3462b81..d278863 100644 >> --- a/arch/arm/mach-at91/Makefile.boot >> +++ b/arch/arm/mach-at91/Makefile.boot >> @@ -16,3 +16,5 @@ else >> params_phys-y := 0x20000100 >> initrd_phys-y := 0x20410000 >> endif >> + >> +dtb-$(CONFIG_MACH_AT91SAM_DT) += at91sam9m10g45ek.dtb >> diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c >> index bb84040..27276b8 100644 >> --- a/arch/arm/mach-at91/at91sam9g45_devices.c >> +++ b/arch/arm/mach-at91/at91sam9g45_devices.c >> @@ -69,9 +69,16 @@ static struct platform_device at_hdmac_device = { >> >> void __init at91_add_device_hdmac(void) >> { >> - dma_cap_set(DMA_MEMCPY, atdma_pdata.cap_mask); >> - dma_cap_set(DMA_SLAVE, atdma_pdata.cap_mask); >> - platform_device_register(&at_hdmac_device); >> + struct device_node *of_node = >> + of_find_node_by_name(NULL, "dma-controller"); > > You should really search by the compatible string. > >> + >> + if (of_node) { >> + of_node_put(of_node); >> + } else { >> + dma_cap_set(DMA_MEMCPY, atdma_pdata.cap_mask); >> + dma_cap_set(DMA_SLAVE, atdma_pdata.cap_mask); > > This really should be in the driver. Yes, I will try to find a way to get rid of those platform data. >> + platform_device_register(&at_hdmac_device); >> + } >> } >> #else >> void __init at91_add_device_hdmac(void) {} >> @@ -1556,10 +1563,15 @@ void __init at91_set_serial_console(unsigned portnr) >> void __init at91_add_device_serial(void) >> { >> int i; >> + struct device_node *of_node = of_find_node_by_name(NULL, "serial"); >> >> - for (i = 0; i < ATMEL_MAX_UART; i++) { >> - if (at91_uarts[i]) >> - platform_device_register(at91_uarts[i]); >> + if (of_node) { >> + of_node_put(of_node); >> + } else { >> + for (i = 0; i < ATMEL_MAX_UART; i++) { >> + if (at91_uarts[i]) >> + platform_device_register(at91_uarts[i]); >> + } > > Why can't you only call these init functions when booting non-DT? For the dma driver function: this init function is called as an arch_initcall(). But for the 91_add_device_serial() function, I can simply avoid calling it, like you suggest. >> } >> >> if (!atmel_default_console_device) >> diff --git a/arch/arm/mach-at91/board-dt.c b/arch/arm/mach-at91/board-dt.c >> new file mode 100644 >> index 0000000..7bcb9a9 >> --- /dev/null >> +++ b/arch/arm/mach-at91/board-dt.c >> @@ -0,0 +1,122 @@ >> +/* >> + * Setup code for AT91SAM Evaluation Kits with Device Tree support >> + * >> + * Covers: * AT91SAM9G45-EKES board >> + * * AT91SAM9M10-EKES board >> + * * AT91SAM9M10G45-EK board >> + * >> + * Copyright (C) 2011 Atmel, >> + * 2011 Nicolas Ferre <nicolas.ferre@atmel.com> >> + * >> + * Licensed under GPLv2 or later. >> + */ >> + >> +#include <linux/types.h> >> +#include <linux/init.h> >> +#include <linux/module.h> >> +#include <linux/irqdomain.h> >> +#include <linux/of_irq.h> >> +#include <linux/of_platform.h> >> + >> +#include <mach/hardware.h> >> +#include <mach/board.h> >> +#include <mach/gpio.h> >> +#include <mach/system_rev.h> >> +#include <mach/at91sam9_smc.h> >> + >> +#include <asm/setup.h> >> +#include <asm/irq.h> >> +#include <asm/mach/arch.h> >> +#include <asm/mach/map.h> >> +#include <asm/mach/irq.h> >> + >> +#include "sam9_smc.h" >> +#include "generic.h" >> + >> + >> +static void __init ek_init_early(void) >> +{ >> + /* Initialize processor: 12.000 MHz crystal */ >> + at91_initialize(12000000); >> + >> + /* DGBU on ttyS0. (Rx & Tx only) */ >> + at91_register_uart(0, 0, 0); >> + >> + /* USART0 not connected on the -EK board */ >> + /* USART1 on ttyS2. (Rx, Tx, RTS, CTS) */ >> + at91_register_uart(AT91SAM9G45_ID_US1, 2, ATMEL_UART_CTS | ATMEL_UART_RTS); >> + >> + /* set serial console to ttyS0 (ie, DBGU) */ >> + at91_set_serial_console(0); >> +} >> + >> +/* det_pin is not connected */ >> +static struct atmel_nand_data __initdata ek_nand_data = { >> + .ale = 21, >> + .cle = 22, >> + .rdy_pin = AT91_PIN_PC8, >> + .enable_pin = AT91_PIN_PC14, >> +}; >> + >> +static struct sam9_smc_config __initdata ek_nand_smc_config = { >> + .ncs_read_setup = 0, >> + .nrd_setup = 2, >> + .ncs_write_setup = 0, >> + .nwe_setup = 2, >> + >> + .ncs_read_pulse = 4, >> + .nrd_pulse = 4, >> + .ncs_write_pulse = 4, >> + .nwe_pulse = 4, >> + >> + .read_cycle = 7, >> + .write_cycle = 7, >> + >> + .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE, >> + .tdf_cycles = 3, >> +}; >> + >> +static void __init ek_add_device_nand(void) >> +{ >> + ek_nand_data.bus_width_16 = board_have_nand_16bit(); >> + /* setup bus-width (8 or 16) */ >> + if (ek_nand_data.bus_width_16) >> + ek_nand_smc_config.mode |= AT91_SMC_DBW_16; >> + else >> + ek_nand_smc_config.mode |= AT91_SMC_DBW_8; >> + >> + /* configure chip-select 3 (NAND) */ >> + sam9_smc_configure(3, &ek_nand_smc_config); >> + >> + at91_add_device_nand(&ek_nand_data); >> +} >> + >> +static const struct of_device_id aic_of_match[] __initconst = { >> + { .compatible = "atmel,at91rm9200-aic", }, >> + {}, >> +}; >> + >> +static void __init at91_dt_device_init(void) >> +{ >> + irq_domain_generate_simple(aic_of_match, 0xfffff000, 0); > > Why is this not in the .init_irq function? I'm surprised your timer > interrupt even works. Ok, I will add an .init_irq function in my v3 patch. BTW, as I am a little bit confused about the "early" serial initialization, what is the proper way to address this? So, can you tell me or give me a pointer to an update on this topic: I know that it is moving a lot those days... Thanks a lot for your review. Best regards, -- Nicolas Ferre ^ permalink raw reply [flat|nested] 49+ messages in thread
* [PATCH V2] AT91: dt: at91sam9g45 family and board device tree files 2011-10-07 12:56 ` Nicolas Ferre @ 2011-10-18 10:07 ` Nicolas Ferre -1 siblings, 0 replies; 49+ messages in thread From: Nicolas Ferre @ 2011-10-18 10:07 UTC (permalink / raw) To: linux-arm-kernel On 10/07/2011 02:56 PM, Nicolas Ferre : > On 10/05/2011 03:00 PM, Rob Herring : >> Nicolas, >> >> On 10/03/2011 05:00 AM, Nicolas Ferre wrote: >>> Create a new device tree source file for Atmel at91sam9g45 SoC family. >>> The Evaluation Kit at91sam9m10g45ek includes it. >>> This first basic support will be populated as drivers and boards will be >>> converted to device tree. >>> Contains serial, dma and interrupt controllers. >>> >>> The generic board file still takes advantage of platform data for early serial >>> init. As we need a storage media and the NAND flash driver is not converted to >>> DT yet, we keep old initialization for it. >>> >>> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> [..] >>> diff --git a/arch/arm/mach-at91/board-dt.c b/arch/arm/mach-at91/board-dt.c >>> new file mode 100644 >>> index 0000000..7bcb9a9 >>> --- /dev/null >>> +++ b/arch/arm/mach-at91/board-dt.c >>> @@ -0,0 +1,122 @@ >>> +/* >>> + * Setup code for AT91SAM Evaluation Kits with Device Tree support >>> + * >>> + * Covers: * AT91SAM9G45-EKES board >>> + * * AT91SAM9M10-EKES board >>> + * * AT91SAM9M10G45-EK board >>> + * >>> + * Copyright (C) 2011 Atmel, >>> + * 2011 Nicolas Ferre <nicolas.ferre@atmel.com> >>> + * >>> + * Licensed under GPLv2 or later. >>> + */ >>> + >>> +#include <linux/types.h> >>> +#include <linux/init.h> >>> +#include <linux/module.h> >>> +#include <linux/irqdomain.h> >>> +#include <linux/of_irq.h> >>> +#include <linux/of_platform.h> >>> + >>> +#include <mach/hardware.h> >>> +#include <mach/board.h> >>> +#include <mach/gpio.h> >>> +#include <mach/system_rev.h> >>> +#include <mach/at91sam9_smc.h> >>> + >>> +#include <asm/setup.h> >>> +#include <asm/irq.h> >>> +#include <asm/mach/arch.h> >>> +#include <asm/mach/map.h> >>> +#include <asm/mach/irq.h> >>> + >>> +#include "sam9_smc.h" >>> +#include "generic.h" As found by Jean-Christophe, it seems that some clock lookup data are missing here. Something like: +/* + * Lookup table for attaching a specific name and platform_data pointer to + * devices as they get created by of_platform_populate(). Ideally this table + * would not exist, but the current clock implementation depends on some devices + * having a specific name. + / +static const struct of_dev_auxdata at91_auxdata_lookup[] __initconst = { + / at91sam9260/ at91sam9g20 / + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffff200, "atmel_usart.0", NULL), + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffb0000, "atmel_usart.1", NULL), + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffb4000, "atmel_usart.2", NULL), + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffb8000, "atmel_usart.3", NULL), + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffd0000, "atmel_usart.4", NULL), + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffd4000, "atmel_usart.5", NULL), + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffd8000, "atmel_usart.6", NULL), + / at91sam9g45*/ + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xffffee00, "atmel_usart.0", NULL), + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfff8c000, "atmel_usart.1", NULL), + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfff90000, "atmel_usart.2", NULL), + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfff94000, "atmel_usart.3", NULL), + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfff98000, "atmel_usart.4", NULL), + { /* sentinel */ } +}; With a change here: of_platform_populate(NULL, of_default_bus_match_table, at91_auxdata_lookup, NULL); I know that it is a temporary usage of auxdata. Does it sound the right thing to do for the moment? Best regards, -- Nicolas Ferre ^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH V2] AT91: dt: at91sam9g45 family and board device tree files @ 2011-10-18 10:07 ` Nicolas Ferre 0 siblings, 0 replies; 49+ messages in thread From: Nicolas Ferre @ 2011-10-18 10:07 UTC (permalink / raw) To: Rob Herring, grant.likely, devicetree-discuss, Jean-Christophe PLAGNIOL-VILLARD Cc: linux-kernel, linux-arm-kernel On 10/07/2011 02:56 PM, Nicolas Ferre : > On 10/05/2011 03:00 PM, Rob Herring : >> Nicolas, >> >> On 10/03/2011 05:00 AM, Nicolas Ferre wrote: >>> Create a new device tree source file for Atmel at91sam9g45 SoC family. >>> The Evaluation Kit at91sam9m10g45ek includes it. >>> This first basic support will be populated as drivers and boards will be >>> converted to device tree. >>> Contains serial, dma and interrupt controllers. >>> >>> The generic board file still takes advantage of platform data for early serial >>> init. As we need a storage media and the NAND flash driver is not converted to >>> DT yet, we keep old initialization for it. >>> >>> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> [..] >>> diff --git a/arch/arm/mach-at91/board-dt.c b/arch/arm/mach-at91/board-dt.c >>> new file mode 100644 >>> index 0000000..7bcb9a9 >>> --- /dev/null >>> +++ b/arch/arm/mach-at91/board-dt.c >>> @@ -0,0 +1,122 @@ >>> +/* >>> + * Setup code for AT91SAM Evaluation Kits with Device Tree support >>> + * >>> + * Covers: * AT91SAM9G45-EKES board >>> + * * AT91SAM9M10-EKES board >>> + * * AT91SAM9M10G45-EK board >>> + * >>> + * Copyright (C) 2011 Atmel, >>> + * 2011 Nicolas Ferre <nicolas.ferre@atmel.com> >>> + * >>> + * Licensed under GPLv2 or later. >>> + */ >>> + >>> +#include <linux/types.h> >>> +#include <linux/init.h> >>> +#include <linux/module.h> >>> +#include <linux/irqdomain.h> >>> +#include <linux/of_irq.h> >>> +#include <linux/of_platform.h> >>> + >>> +#include <mach/hardware.h> >>> +#include <mach/board.h> >>> +#include <mach/gpio.h> >>> +#include <mach/system_rev.h> >>> +#include <mach/at91sam9_smc.h> >>> + >>> +#include <asm/setup.h> >>> +#include <asm/irq.h> >>> +#include <asm/mach/arch.h> >>> +#include <asm/mach/map.h> >>> +#include <asm/mach/irq.h> >>> + >>> +#include "sam9_smc.h" >>> +#include "generic.h" As found by Jean-Christophe, it seems that some clock lookup data are missing here. Something like: +/* + * Lookup table for attaching a specific name and platform_data pointer to + * devices as they get created by of_platform_populate(). Ideally this table + * would not exist, but the current clock implementation depends on some devices + * having a specific name. + / +static const struct of_dev_auxdata at91_auxdata_lookup[] __initconst = { + / at91sam9260/ at91sam9g20 / + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffff200, "atmel_usart.0", NULL), + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffb0000, "atmel_usart.1", NULL), + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffb4000, "atmel_usart.2", NULL), + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffb8000, "atmel_usart.3", NULL), + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffd0000, "atmel_usart.4", NULL), + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffd4000, "atmel_usart.5", NULL), + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffd8000, "atmel_usart.6", NULL), + / at91sam9g45*/ + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xffffee00, "atmel_usart.0", NULL), + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfff8c000, "atmel_usart.1", NULL), + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfff90000, "atmel_usart.2", NULL), + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfff94000, "atmel_usart.3", NULL), + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfff98000, "atmel_usart.4", NULL), + { /* sentinel */ } +}; With a change here: of_platform_populate(NULL, of_default_bus_match_table, at91_auxdata_lookup, NULL); I know that it is a temporary usage of auxdata. Does it sound the right thing to do for the moment? Best regards, -- Nicolas Ferre ^ permalink raw reply [flat|nested] 49+ messages in thread
* [PATCH V2] AT91: dt: at91sam9g45 family and board device tree files 2011-10-18 10:07 ` Nicolas Ferre @ 2011-10-18 20:44 ` Rob Herring -1 siblings, 0 replies; 49+ messages in thread From: Rob Herring @ 2011-10-18 20:44 UTC (permalink / raw) To: linux-arm-kernel Nicolas, On 10/18/2011 05:07 AM, Nicolas Ferre wrote: > On 10/07/2011 02:56 PM, Nicolas Ferre : >> On 10/05/2011 03:00 PM, Rob Herring : >>> Nicolas, >>> >>> On 10/03/2011 05:00 AM, Nicolas Ferre wrote: >>>> Create a new device tree source file for Atmel at91sam9g45 SoC family. >>>> The Evaluation Kit at91sam9m10g45ek includes it. >>>> This first basic support will be populated as drivers and boards will be >>>> converted to device tree. >>>> Contains serial, dma and interrupt controllers. >>>> >>>> The generic board file still takes advantage of platform data for early serial >>>> init. As we need a storage media and the NAND flash driver is not converted to >>>> DT yet, we keep old initialization for it. >>>> >>>> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> > > [..] > >>>> diff --git a/arch/arm/mach-at91/board-dt.c b/arch/arm/mach-at91/board-dt.c >>>> new file mode 100644 >>>> index 0000000..7bcb9a9 >>>> --- /dev/null >>>> +++ b/arch/arm/mach-at91/board-dt.c >>>> @@ -0,0 +1,122 @@ >>>> +/* >>>> + * Setup code for AT91SAM Evaluation Kits with Device Tree support >>>> + * >>>> + * Covers: * AT91SAM9G45-EKES board >>>> + * * AT91SAM9M10-EKES board >>>> + * * AT91SAM9M10G45-EK board >>>> + * >>>> + * Copyright (C) 2011 Atmel, >>>> + * 2011 Nicolas Ferre <nicolas.ferre@atmel.com> >>>> + * >>>> + * Licensed under GPLv2 or later. >>>> + */ >>>> + >>>> +#include <linux/types.h> >>>> +#include <linux/init.h> >>>> +#include <linux/module.h> >>>> +#include <linux/irqdomain.h> >>>> +#include <linux/of_irq.h> >>>> +#include <linux/of_platform.h> >>>> + >>>> +#include <mach/hardware.h> >>>> +#include <mach/board.h> >>>> +#include <mach/gpio.h> >>>> +#include <mach/system_rev.h> >>>> +#include <mach/at91sam9_smc.h> >>>> + >>>> +#include <asm/setup.h> >>>> +#include <asm/irq.h> >>>> +#include <asm/mach/arch.h> >>>> +#include <asm/mach/map.h> >>>> +#include <asm/mach/irq.h> >>>> + >>>> +#include "sam9_smc.h" >>>> +#include "generic.h" > > As found by Jean-Christophe, it seems that some clock lookup data are missing here. Something like: > > +/* > + * Lookup table for attaching a specific name and platform_data pointer to > + * devices as they get created by of_platform_populate(). Ideally this table > + * would not exist, but the current clock implementation depends on some devices > + * having a specific name. > + / > +static const struct of_dev_auxdata at91_auxdata_lookup[] __initconst = { > + / at91sam9260/ at91sam9g20 / > + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffff200, "atmel_usart.0", NULL), > + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffb0000, "atmel_usart.1", NULL), > + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffb4000, "atmel_usart.2", NULL), > + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffb8000, "atmel_usart.3", NULL), > + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffd0000, "atmel_usart.4", NULL), > + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffd4000, "atmel_usart.5", NULL), > + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffd8000, "atmel_usart.6", NULL), > + / at91sam9g45*/ > + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xffffee00, "atmel_usart.0", NULL), > + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfff8c000, "atmel_usart.1", NULL), > + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfff90000, "atmel_usart.2", NULL), > + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfff94000, "atmel_usart.3", NULL), > + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfff98000, "atmel_usart.4", NULL), > + { /* sentinel */ } > +}; > > With a change here: > of_platform_populate(NULL, of_default_bus_match_table, at91_auxdata_lookup, NULL); > > I know that it is a temporary usage of auxdata. Does it sound the right thing to do for the moment? > If clk lookups are the only thing needed, can't you jusst add the lookups for DT? Rob ^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH V2] AT91: dt: at91sam9g45 family and board device tree files @ 2011-10-18 20:44 ` Rob Herring 0 siblings, 0 replies; 49+ messages in thread From: Rob Herring @ 2011-10-18 20:44 UTC (permalink / raw) To: Nicolas Ferre Cc: grant.likely, devicetree-discuss, Jean-Christophe PLAGNIOL-VILLARD, linux-kernel, linux-arm-kernel Nicolas, On 10/18/2011 05:07 AM, Nicolas Ferre wrote: > On 10/07/2011 02:56 PM, Nicolas Ferre : >> On 10/05/2011 03:00 PM, Rob Herring : >>> Nicolas, >>> >>> On 10/03/2011 05:00 AM, Nicolas Ferre wrote: >>>> Create a new device tree source file for Atmel at91sam9g45 SoC family. >>>> The Evaluation Kit at91sam9m10g45ek includes it. >>>> This first basic support will be populated as drivers and boards will be >>>> converted to device tree. >>>> Contains serial, dma and interrupt controllers. >>>> >>>> The generic board file still takes advantage of platform data for early serial >>>> init. As we need a storage media and the NAND flash driver is not converted to >>>> DT yet, we keep old initialization for it. >>>> >>>> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> > > [..] > >>>> diff --git a/arch/arm/mach-at91/board-dt.c b/arch/arm/mach-at91/board-dt.c >>>> new file mode 100644 >>>> index 0000000..7bcb9a9 >>>> --- /dev/null >>>> +++ b/arch/arm/mach-at91/board-dt.c >>>> @@ -0,0 +1,122 @@ >>>> +/* >>>> + * Setup code for AT91SAM Evaluation Kits with Device Tree support >>>> + * >>>> + * Covers: * AT91SAM9G45-EKES board >>>> + * * AT91SAM9M10-EKES board >>>> + * * AT91SAM9M10G45-EK board >>>> + * >>>> + * Copyright (C) 2011 Atmel, >>>> + * 2011 Nicolas Ferre <nicolas.ferre@atmel.com> >>>> + * >>>> + * Licensed under GPLv2 or later. >>>> + */ >>>> + >>>> +#include <linux/types.h> >>>> +#include <linux/init.h> >>>> +#include <linux/module.h> >>>> +#include <linux/irqdomain.h> >>>> +#include <linux/of_irq.h> >>>> +#include <linux/of_platform.h> >>>> + >>>> +#include <mach/hardware.h> >>>> +#include <mach/board.h> >>>> +#include <mach/gpio.h> >>>> +#include <mach/system_rev.h> >>>> +#include <mach/at91sam9_smc.h> >>>> + >>>> +#include <asm/setup.h> >>>> +#include <asm/irq.h> >>>> +#include <asm/mach/arch.h> >>>> +#include <asm/mach/map.h> >>>> +#include <asm/mach/irq.h> >>>> + >>>> +#include "sam9_smc.h" >>>> +#include "generic.h" > > As found by Jean-Christophe, it seems that some clock lookup data are missing here. Something like: > > +/* > + * Lookup table for attaching a specific name and platform_data pointer to > + * devices as they get created by of_platform_populate(). Ideally this table > + * would not exist, but the current clock implementation depends on some devices > + * having a specific name. > + / > +static const struct of_dev_auxdata at91_auxdata_lookup[] __initconst = { > + / at91sam9260/ at91sam9g20 / > + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffff200, "atmel_usart.0", NULL), > + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffb0000, "atmel_usart.1", NULL), > + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffb4000, "atmel_usart.2", NULL), > + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffb8000, "atmel_usart.3", NULL), > + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffd0000, "atmel_usart.4", NULL), > + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffd4000, "atmel_usart.5", NULL), > + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffd8000, "atmel_usart.6", NULL), > + / at91sam9g45*/ > + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xffffee00, "atmel_usart.0", NULL), > + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfff8c000, "atmel_usart.1", NULL), > + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfff90000, "atmel_usart.2", NULL), > + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfff94000, "atmel_usart.3", NULL), > + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfff98000, "atmel_usart.4", NULL), > + { /* sentinel */ } > +}; > > With a change here: > of_platform_populate(NULL, of_default_bus_match_table, at91_auxdata_lookup, NULL); > > I know that it is a temporary usage of auxdata. Does it sound the right thing to do for the moment? > If clk lookups are the only thing needed, can't you jusst add the lookups for DT? Rob ^ permalink raw reply [flat|nested] 49+ messages in thread
* [PATCH V2] AT91: dt: at91sam9g45 family and board device tree files 2011-10-18 20:44 ` Rob Herring @ 2011-10-19 8:03 ` Nicolas Ferre -1 siblings, 0 replies; 49+ messages in thread From: Nicolas Ferre @ 2011-10-19 8:03 UTC (permalink / raw) To: linux-arm-kernel On 10/18/2011 10:44 PM, Rob Herring : > Nicolas, > > On 10/18/2011 05:07 AM, Nicolas Ferre wrote: >> On 10/07/2011 02:56 PM, Nicolas Ferre : >>> On 10/05/2011 03:00 PM, Rob Herring : >>>> Nicolas, >>>> >>>> On 10/03/2011 05:00 AM, Nicolas Ferre wrote: >>>>> Create a new device tree source file for Atmel at91sam9g45 SoC family. >>>>> The Evaluation Kit at91sam9m10g45ek includes it. >>>>> This first basic support will be populated as drivers and boards will be >>>>> converted to device tree. >>>>> Contains serial, dma and interrupt controllers. >>>>> >>>>> The generic board file still takes advantage of platform data for early serial >>>>> init. As we need a storage media and the NAND flash driver is not converted to >>>>> DT yet, we keep old initialization for it. >>>>> >>>>> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> >> >> [..] >> >>>>> diff --git a/arch/arm/mach-at91/board-dt.c b/arch/arm/mach-at91/board-dt.c >>>>> new file mode 100644 >>>>> index 0000000..7bcb9a9 >>>>> --- /dev/null >>>>> +++ b/arch/arm/mach-at91/board-dt.c >>>>> @@ -0,0 +1,122 @@ >>>>> +/* >>>>> + * Setup code for AT91SAM Evaluation Kits with Device Tree support >>>>> + * >>>>> + * Covers: * AT91SAM9G45-EKES board >>>>> + * * AT91SAM9M10-EKES board >>>>> + * * AT91SAM9M10G45-EK board >>>>> + * >>>>> + * Copyright (C) 2011 Atmel, >>>>> + * 2011 Nicolas Ferre <nicolas.ferre@atmel.com> >>>>> + * >>>>> + * Licensed under GPLv2 or later. >>>>> + */ >>>>> + >>>>> +#include <linux/types.h> >>>>> +#include <linux/init.h> >>>>> +#include <linux/module.h> >>>>> +#include <linux/irqdomain.h> >>>>> +#include <linux/of_irq.h> >>>>> +#include <linux/of_platform.h> >>>>> + >>>>> +#include <mach/hardware.h> >>>>> +#include <mach/board.h> >>>>> +#include <mach/gpio.h> >>>>> +#include <mach/system_rev.h> >>>>> +#include <mach/at91sam9_smc.h> >>>>> + >>>>> +#include <asm/setup.h> >>>>> +#include <asm/irq.h> >>>>> +#include <asm/mach/arch.h> >>>>> +#include <asm/mach/map.h> >>>>> +#include <asm/mach/irq.h> >>>>> + >>>>> +#include "sam9_smc.h" >>>>> +#include "generic.h" >> >> As found by Jean-Christophe, it seems that some clock lookup data are missing here. Something like: >> >> +/* >> + * Lookup table for attaching a specific name and platform_data pointer to >> + * devices as they get created by of_platform_populate(). Ideally this table >> + * would not exist, but the current clock implementation depends on some devices >> + * having a specific name. >> + / >> +static const struct of_dev_auxdata at91_auxdata_lookup[] __initconst = { >> + / at91sam9260/ at91sam9g20 / >> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffff200, "atmel_usart.0", NULL), >> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffb0000, "atmel_usart.1", NULL), >> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffb4000, "atmel_usart.2", NULL), >> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffb8000, "atmel_usart.3", NULL), >> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffd0000, "atmel_usart.4", NULL), >> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffd4000, "atmel_usart.5", NULL), >> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffd8000, "atmel_usart.6", NULL), >> + / at91sam9g45*/ >> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xffffee00, "atmel_usart.0", NULL), >> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfff8c000, "atmel_usart.1", NULL), >> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfff90000, "atmel_usart.2", NULL), >> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfff94000, "atmel_usart.3", NULL), >> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfff98000, "atmel_usart.4", NULL), >> + { /* sentinel */ } >> +}; >> >> With a change here: >> of_platform_populate(NULL, of_default_bus_match_table, at91_auxdata_lookup, NULL); >> >> I know that it is a temporary usage of auxdata. Does it sound the right thing to do for the moment? >> > > If clk lookups are the only thing needed, can't you jusst add the > lookups for DT? You mean this code surrounded by #ifdef CONFIG_OF? This board file is dedicated to device tree support and selects CONFIG_USE_OF in Kconfig... So I thought it was not necessary to add it. Cheers, -- Nicolas Ferre ^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH V2] AT91: dt: at91sam9g45 family and board device tree files @ 2011-10-19 8:03 ` Nicolas Ferre 0 siblings, 0 replies; 49+ messages in thread From: Nicolas Ferre @ 2011-10-19 8:03 UTC (permalink / raw) To: Rob Herring Cc: grant.likely, devicetree-discuss, Jean-Christophe PLAGNIOL-VILLARD, linux-kernel, linux-arm-kernel On 10/18/2011 10:44 PM, Rob Herring : > Nicolas, > > On 10/18/2011 05:07 AM, Nicolas Ferre wrote: >> On 10/07/2011 02:56 PM, Nicolas Ferre : >>> On 10/05/2011 03:00 PM, Rob Herring : >>>> Nicolas, >>>> >>>> On 10/03/2011 05:00 AM, Nicolas Ferre wrote: >>>>> Create a new device tree source file for Atmel at91sam9g45 SoC family. >>>>> The Evaluation Kit at91sam9m10g45ek includes it. >>>>> This first basic support will be populated as drivers and boards will be >>>>> converted to device tree. >>>>> Contains serial, dma and interrupt controllers. >>>>> >>>>> The generic board file still takes advantage of platform data for early serial >>>>> init. As we need a storage media and the NAND flash driver is not converted to >>>>> DT yet, we keep old initialization for it. >>>>> >>>>> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> >> >> [..] >> >>>>> diff --git a/arch/arm/mach-at91/board-dt.c b/arch/arm/mach-at91/board-dt.c >>>>> new file mode 100644 >>>>> index 0000000..7bcb9a9 >>>>> --- /dev/null >>>>> +++ b/arch/arm/mach-at91/board-dt.c >>>>> @@ -0,0 +1,122 @@ >>>>> +/* >>>>> + * Setup code for AT91SAM Evaluation Kits with Device Tree support >>>>> + * >>>>> + * Covers: * AT91SAM9G45-EKES board >>>>> + * * AT91SAM9M10-EKES board >>>>> + * * AT91SAM9M10G45-EK board >>>>> + * >>>>> + * Copyright (C) 2011 Atmel, >>>>> + * 2011 Nicolas Ferre <nicolas.ferre@atmel.com> >>>>> + * >>>>> + * Licensed under GPLv2 or later. >>>>> + */ >>>>> + >>>>> +#include <linux/types.h> >>>>> +#include <linux/init.h> >>>>> +#include <linux/module.h> >>>>> +#include <linux/irqdomain.h> >>>>> +#include <linux/of_irq.h> >>>>> +#include <linux/of_platform.h> >>>>> + >>>>> +#include <mach/hardware.h> >>>>> +#include <mach/board.h> >>>>> +#include <mach/gpio.h> >>>>> +#include <mach/system_rev.h> >>>>> +#include <mach/at91sam9_smc.h> >>>>> + >>>>> +#include <asm/setup.h> >>>>> +#include <asm/irq.h> >>>>> +#include <asm/mach/arch.h> >>>>> +#include <asm/mach/map.h> >>>>> +#include <asm/mach/irq.h> >>>>> + >>>>> +#include "sam9_smc.h" >>>>> +#include "generic.h" >> >> As found by Jean-Christophe, it seems that some clock lookup data are missing here. Something like: >> >> +/* >> + * Lookup table for attaching a specific name and platform_data pointer to >> + * devices as they get created by of_platform_populate(). Ideally this table >> + * would not exist, but the current clock implementation depends on some devices >> + * having a specific name. >> + / >> +static const struct of_dev_auxdata at91_auxdata_lookup[] __initconst = { >> + / at91sam9260/ at91sam9g20 / >> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffff200, "atmel_usart.0", NULL), >> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffb0000, "atmel_usart.1", NULL), >> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffb4000, "atmel_usart.2", NULL), >> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffb8000, "atmel_usart.3", NULL), >> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffd0000, "atmel_usart.4", NULL), >> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffd4000, "atmel_usart.5", NULL), >> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffd8000, "atmel_usart.6", NULL), >> + / at91sam9g45*/ >> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xffffee00, "atmel_usart.0", NULL), >> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfff8c000, "atmel_usart.1", NULL), >> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfff90000, "atmel_usart.2", NULL), >> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfff94000, "atmel_usart.3", NULL), >> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfff98000, "atmel_usart.4", NULL), >> + { /* sentinel */ } >> +}; >> >> With a change here: >> of_platform_populate(NULL, of_default_bus_match_table, at91_auxdata_lookup, NULL); >> >> I know that it is a temporary usage of auxdata. Does it sound the right thing to do for the moment? >> > > If clk lookups are the only thing needed, can't you jusst add the > lookups for DT? You mean this code surrounded by #ifdef CONFIG_OF? This board file is dedicated to device tree support and selects CONFIG_USE_OF in Kconfig... So I thought it was not necessary to add it. Cheers, -- Nicolas Ferre ^ permalink raw reply [flat|nested] 49+ messages in thread
* [PATCH V2] AT91: dt: at91sam9g45 family and board device tree files 2011-10-19 8:03 ` Nicolas Ferre (?) @ 2011-10-20 2:06 ` Rob Herring -1 siblings, 0 replies; 49+ messages in thread From: Rob Herring @ 2011-10-20 2:06 UTC (permalink / raw) To: linux-arm-kernel On 10/19/2011 03:03 AM, Nicolas Ferre wrote: > On 10/18/2011 10:44 PM, Rob Herring : >> Nicolas, >> >> On 10/18/2011 05:07 AM, Nicolas Ferre wrote: >>> On 10/07/2011 02:56 PM, Nicolas Ferre : >>>> On 10/05/2011 03:00 PM, Rob Herring : >>>>> Nicolas, >>>>> >>>>> On 10/03/2011 05:00 AM, Nicolas Ferre wrote: >>>>>> Create a new device tree source file for Atmel at91sam9g45 SoC family. >>>>>> The Evaluation Kit at91sam9m10g45ek includes it. >>>>>> This first basic support will be populated as drivers and boards will be >>>>>> converted to device tree. >>>>>> Contains serial, dma and interrupt controllers. >>>>>> >>>>>> The generic board file still takes advantage of platform data for early serial >>>>>> init. As we need a storage media and the NAND flash driver is not converted to >>>>>> DT yet, we keep old initialization for it. >>>>>> >>>>>> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> >>> >>> [..] >>> >>>>>> diff --git a/arch/arm/mach-at91/board-dt.c b/arch/arm/mach-at91/board-dt.c >>>>>> new file mode 100644 >>>>>> index 0000000..7bcb9a9 >>>>>> --- /dev/null >>>>>> +++ b/arch/arm/mach-at91/board-dt.c >>>>>> @@ -0,0 +1,122 @@ >>>>>> +/* >>>>>> + * Setup code for AT91SAM Evaluation Kits with Device Tree support >>>>>> + * >>>>>> + * Covers: * AT91SAM9G45-EKES board >>>>>> + * * AT91SAM9M10-EKES board >>>>>> + * * AT91SAM9M10G45-EK board >>>>>> + * >>>>>> + * Copyright (C) 2011 Atmel, >>>>>> + * 2011 Nicolas Ferre <nicolas.ferre@atmel.com> >>>>>> + * >>>>>> + * Licensed under GPLv2 or later. >>>>>> + */ >>>>>> + >>>>>> +#include <linux/types.h> >>>>>> +#include <linux/init.h> >>>>>> +#include <linux/module.h> >>>>>> +#include <linux/irqdomain.h> >>>>>> +#include <linux/of_irq.h> >>>>>> +#include <linux/of_platform.h> >>>>>> + >>>>>> +#include <mach/hardware.h> >>>>>> +#include <mach/board.h> >>>>>> +#include <mach/gpio.h> >>>>>> +#include <mach/system_rev.h> >>>>>> +#include <mach/at91sam9_smc.h> >>>>>> + >>>>>> +#include <asm/setup.h> >>>>>> +#include <asm/irq.h> >>>>>> +#include <asm/mach/arch.h> >>>>>> +#include <asm/mach/map.h> >>>>>> +#include <asm/mach/irq.h> >>>>>> + >>>>>> +#include "sam9_smc.h" >>>>>> +#include "generic.h" >>> >>> As found by Jean-Christophe, it seems that some clock lookup data are missing here. Something like: >>> >>> +/* >>> + * Lookup table for attaching a specific name and platform_data pointer to >>> + * devices as they get created by of_platform_populate(). Ideally this table >>> + * would not exist, but the current clock implementation depends on some devices >>> + * having a specific name. >>> + / >>> +static const struct of_dev_auxdata at91_auxdata_lookup[] __initconst = { >>> + / at91sam9260/ at91sam9g20 / >>> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffff200, "atmel_usart.0", NULL), >>> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffb0000, "atmel_usart.1", NULL), >>> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffb4000, "atmel_usart.2", NULL), >>> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffb8000, "atmel_usart.3", NULL), >>> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffd0000, "atmel_usart.4", NULL), >>> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffd4000, "atmel_usart.5", NULL), >>> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffd8000, "atmel_usart.6", NULL), >>> + / at91sam9g45*/ >>> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xffffee00, "atmel_usart.0", NULL), >>> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfff8c000, "atmel_usart.1", NULL), >>> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfff90000, "atmel_usart.2", NULL), >>> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfff94000, "atmel_usart.3", NULL), >>> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfff98000, "atmel_usart.4", NULL), >>> + { /* sentinel */ } >>> +}; >>> >>> With a change here: >>> of_platform_populate(NULL, of_default_bus_match_table, at91_auxdata_lookup, NULL); >>> >>> I know that it is a temporary usage of auxdata. Does it sound the right thing to do for the moment? >>> >> >> If clk lookups are the only thing needed, can't you jusst add the >> lookups for DT? > > You mean this code surrounded by #ifdef CONFIG_OF? > > This board file is dedicated to device tree support and selects > CONFIG_USE_OF in Kconfig... So I thought it was not necessary to add it. > No, I mean you already have a clkdev lookup table with atmel_usart.0 for example. Can't you just add to that table a clkdev lookup entry for atmel_usart.ffffee000. You can ifdef it if you're concerned about size, but it doesn't have to be. There shouldn't be any issue having 2 entries for 2 different device names. Rob ^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH V2] AT91: dt: at91sam9g45 family and board device tree files @ 2011-10-20 2:06 ` Rob Herring 0 siblings, 0 replies; 49+ messages in thread From: Rob Herring @ 2011-10-20 2:06 UTC (permalink / raw) To: Nicolas Ferre Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r On 10/19/2011 03:03 AM, Nicolas Ferre wrote: > On 10/18/2011 10:44 PM, Rob Herring : >> Nicolas, >> >> On 10/18/2011 05:07 AM, Nicolas Ferre wrote: >>> On 10/07/2011 02:56 PM, Nicolas Ferre : >>>> On 10/05/2011 03:00 PM, Rob Herring : >>>>> Nicolas, >>>>> >>>>> On 10/03/2011 05:00 AM, Nicolas Ferre wrote: >>>>>> Create a new device tree source file for Atmel at91sam9g45 SoC family. >>>>>> The Evaluation Kit at91sam9m10g45ek includes it. >>>>>> This first basic support will be populated as drivers and boards will be >>>>>> converted to device tree. >>>>>> Contains serial, dma and interrupt controllers. >>>>>> >>>>>> The generic board file still takes advantage of platform data for early serial >>>>>> init. As we need a storage media and the NAND flash driver is not converted to >>>>>> DT yet, we keep old initialization for it. >>>>>> >>>>>> Signed-off-by: Nicolas Ferre <nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org> >>> >>> [..] >>> >>>>>> diff --git a/arch/arm/mach-at91/board-dt.c b/arch/arm/mach-at91/board-dt.c >>>>>> new file mode 100644 >>>>>> index 0000000..7bcb9a9 >>>>>> --- /dev/null >>>>>> +++ b/arch/arm/mach-at91/board-dt.c >>>>>> @@ -0,0 +1,122 @@ >>>>>> +/* >>>>>> + * Setup code for AT91SAM Evaluation Kits with Device Tree support >>>>>> + * >>>>>> + * Covers: * AT91SAM9G45-EKES board >>>>>> + * * AT91SAM9M10-EKES board >>>>>> + * * AT91SAM9M10G45-EK board >>>>>> + * >>>>>> + * Copyright (C) 2011 Atmel, >>>>>> + * 2011 Nicolas Ferre <nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org> >>>>>> + * >>>>>> + * Licensed under GPLv2 or later. >>>>>> + */ >>>>>> + >>>>>> +#include <linux/types.h> >>>>>> +#include <linux/init.h> >>>>>> +#include <linux/module.h> >>>>>> +#include <linux/irqdomain.h> >>>>>> +#include <linux/of_irq.h> >>>>>> +#include <linux/of_platform.h> >>>>>> + >>>>>> +#include <mach/hardware.h> >>>>>> +#include <mach/board.h> >>>>>> +#include <mach/gpio.h> >>>>>> +#include <mach/system_rev.h> >>>>>> +#include <mach/at91sam9_smc.h> >>>>>> + >>>>>> +#include <asm/setup.h> >>>>>> +#include <asm/irq.h> >>>>>> +#include <asm/mach/arch.h> >>>>>> +#include <asm/mach/map.h> >>>>>> +#include <asm/mach/irq.h> >>>>>> + >>>>>> +#include "sam9_smc.h" >>>>>> +#include "generic.h" >>> >>> As found by Jean-Christophe, it seems that some clock lookup data are missing here. Something like: >>> >>> +/* >>> + * Lookup table for attaching a specific name and platform_data pointer to >>> + * devices as they get created by of_platform_populate(). Ideally this table >>> + * would not exist, but the current clock implementation depends on some devices >>> + * having a specific name. >>> + / >>> +static const struct of_dev_auxdata at91_auxdata_lookup[] __initconst = { >>> + / at91sam9260/ at91sam9g20 / >>> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffff200, "atmel_usart.0", NULL), >>> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffb0000, "atmel_usart.1", NULL), >>> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffb4000, "atmel_usart.2", NULL), >>> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffb8000, "atmel_usart.3", NULL), >>> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffd0000, "atmel_usart.4", NULL), >>> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffd4000, "atmel_usart.5", NULL), >>> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffd8000, "atmel_usart.6", NULL), >>> + / at91sam9g45*/ >>> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xffffee00, "atmel_usart.0", NULL), >>> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfff8c000, "atmel_usart.1", NULL), >>> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfff90000, "atmel_usart.2", NULL), >>> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfff94000, "atmel_usart.3", NULL), >>> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfff98000, "atmel_usart.4", NULL), >>> + { /* sentinel */ } >>> +}; >>> >>> With a change here: >>> of_platform_populate(NULL, of_default_bus_match_table, at91_auxdata_lookup, NULL); >>> >>> I know that it is a temporary usage of auxdata. Does it sound the right thing to do for the moment? >>> >> >> If clk lookups are the only thing needed, can't you jusst add the >> lookups for DT? > > You mean this code surrounded by #ifdef CONFIG_OF? > > This board file is dedicated to device tree support and selects > CONFIG_USE_OF in Kconfig... So I thought it was not necessary to add it. > No, I mean you already have a clkdev lookup table with atmel_usart.0 for example. Can't you just add to that table a clkdev lookup entry for atmel_usart.ffffee000. You can ifdef it if you're concerned about size, but it doesn't have to be. There shouldn't be any issue having 2 entries for 2 different device names. Rob ^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH V2] AT91: dt: at91sam9g45 family and board device tree files @ 2011-10-20 2:06 ` Rob Herring 0 siblings, 0 replies; 49+ messages in thread From: Rob Herring @ 2011-10-20 2:06 UTC (permalink / raw) To: Nicolas Ferre Cc: grant.likely, devicetree-discuss, Jean-Christophe PLAGNIOL-VILLARD, linux-kernel, linux-arm-kernel On 10/19/2011 03:03 AM, Nicolas Ferre wrote: > On 10/18/2011 10:44 PM, Rob Herring : >> Nicolas, >> >> On 10/18/2011 05:07 AM, Nicolas Ferre wrote: >>> On 10/07/2011 02:56 PM, Nicolas Ferre : >>>> On 10/05/2011 03:00 PM, Rob Herring : >>>>> Nicolas, >>>>> >>>>> On 10/03/2011 05:00 AM, Nicolas Ferre wrote: >>>>>> Create a new device tree source file for Atmel at91sam9g45 SoC family. >>>>>> The Evaluation Kit at91sam9m10g45ek includes it. >>>>>> This first basic support will be populated as drivers and boards will be >>>>>> converted to device tree. >>>>>> Contains serial, dma and interrupt controllers. >>>>>> >>>>>> The generic board file still takes advantage of platform data for early serial >>>>>> init. As we need a storage media and the NAND flash driver is not converted to >>>>>> DT yet, we keep old initialization for it. >>>>>> >>>>>> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> >>> >>> [..] >>> >>>>>> diff --git a/arch/arm/mach-at91/board-dt.c b/arch/arm/mach-at91/board-dt.c >>>>>> new file mode 100644 >>>>>> index 0000000..7bcb9a9 >>>>>> --- /dev/null >>>>>> +++ b/arch/arm/mach-at91/board-dt.c >>>>>> @@ -0,0 +1,122 @@ >>>>>> +/* >>>>>> + * Setup code for AT91SAM Evaluation Kits with Device Tree support >>>>>> + * >>>>>> + * Covers: * AT91SAM9G45-EKES board >>>>>> + * * AT91SAM9M10-EKES board >>>>>> + * * AT91SAM9M10G45-EK board >>>>>> + * >>>>>> + * Copyright (C) 2011 Atmel, >>>>>> + * 2011 Nicolas Ferre <nicolas.ferre@atmel.com> >>>>>> + * >>>>>> + * Licensed under GPLv2 or later. >>>>>> + */ >>>>>> + >>>>>> +#include <linux/types.h> >>>>>> +#include <linux/init.h> >>>>>> +#include <linux/module.h> >>>>>> +#include <linux/irqdomain.h> >>>>>> +#include <linux/of_irq.h> >>>>>> +#include <linux/of_platform.h> >>>>>> + >>>>>> +#include <mach/hardware.h> >>>>>> +#include <mach/board.h> >>>>>> +#include <mach/gpio.h> >>>>>> +#include <mach/system_rev.h> >>>>>> +#include <mach/at91sam9_smc.h> >>>>>> + >>>>>> +#include <asm/setup.h> >>>>>> +#include <asm/irq.h> >>>>>> +#include <asm/mach/arch.h> >>>>>> +#include <asm/mach/map.h> >>>>>> +#include <asm/mach/irq.h> >>>>>> + >>>>>> +#include "sam9_smc.h" >>>>>> +#include "generic.h" >>> >>> As found by Jean-Christophe, it seems that some clock lookup data are missing here. Something like: >>> >>> +/* >>> + * Lookup table for attaching a specific name and platform_data pointer to >>> + * devices as they get created by of_platform_populate(). Ideally this table >>> + * would not exist, but the current clock implementation depends on some devices >>> + * having a specific name. >>> + / >>> +static const struct of_dev_auxdata at91_auxdata_lookup[] __initconst = { >>> + / at91sam9260/ at91sam9g20 / >>> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffff200, "atmel_usart.0", NULL), >>> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffb0000, "atmel_usart.1", NULL), >>> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffb4000, "atmel_usart.2", NULL), >>> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffb8000, "atmel_usart.3", NULL), >>> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffd0000, "atmel_usart.4", NULL), >>> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffd4000, "atmel_usart.5", NULL), >>> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffd8000, "atmel_usart.6", NULL), >>> + / at91sam9g45*/ >>> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xffffee00, "atmel_usart.0", NULL), >>> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfff8c000, "atmel_usart.1", NULL), >>> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfff90000, "atmel_usart.2", NULL), >>> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfff94000, "atmel_usart.3", NULL), >>> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfff98000, "atmel_usart.4", NULL), >>> + { /* sentinel */ } >>> +}; >>> >>> With a change here: >>> of_platform_populate(NULL, of_default_bus_match_table, at91_auxdata_lookup, NULL); >>> >>> I know that it is a temporary usage of auxdata. Does it sound the right thing to do for the moment? >>> >> >> If clk lookups are the only thing needed, can't you jusst add the >> lookups for DT? > > You mean this code surrounded by #ifdef CONFIG_OF? > > This board file is dedicated to device tree support and selects > CONFIG_USE_OF in Kconfig... So I thought it was not necessary to add it. > No, I mean you already have a clkdev lookup table with atmel_usart.0 for example. Can't you just add to that table a clkdev lookup entry for atmel_usart.ffffee000. You can ifdef it if you're concerned about size, but it doesn't have to be. There shouldn't be any issue having 2 entries for 2 different device names. Rob ^ permalink raw reply [flat|nested] 49+ messages in thread
* [PATCH V3 1/2] ARM: at91: dt: at91sam9g45 family and board device tree files 2011-10-20 2:06 ` Rob Herring (?) @ 2011-10-24 14:05 ` Nicolas Ferre -1 siblings, 0 replies; 49+ messages in thread From: Nicolas Ferre @ 2011-10-24 14:05 UTC (permalink / raw) To: linux-arm-kernel Create a new device tree source file for Atmel at91sam9g45 SoC family. The Evaluation Kit at91sam9m10g45ek includes it. This first basic support will be populated as drivers and boards will be converted to device tree. Contains serial, dma and interrupt controllers. The generic board file still takes advantage of platform data for early serial init. As we need a storage media and the NAND flash driver is not converted to DT yet, we keep old initialization for it. Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> --- V3: - additional clock lookup for device tree handling - devices disabled in dtsi file so that only useful devices are enabled in dts files V2: foundation for AT91SAM generic support - device tree focused board file - inclusion of USART DT support - early USART and NAND still using platform data arch/arm/boot/dts/at91sam9g45.dtsi | 106 +++++++++++++++++++++++++++ arch/arm/boot/dts/at91sam9m10g45ek.dts | 35 +++++++++ arch/arm/mach-at91/Kconfig | 11 +++ arch/arm/mach-at91/Makefile | 3 + arch/arm/mach-at91/Makefile.boot | 2 + arch/arm/mach-at91/at91sam9g45.c | 6 ++ arch/arm/mach-at91/board-dt.c | 122 ++++++++++++++++++++++++++++++++ 7 files changed, 285 insertions(+), 0 deletions(-) create mode 100644 arch/arm/boot/dts/at91sam9g45.dtsi create mode 100644 arch/arm/boot/dts/at91sam9m10g45ek.dts create mode 100644 arch/arm/mach-at91/board-dt.c diff --git a/arch/arm/boot/dts/at91sam9g45.dtsi b/arch/arm/boot/dts/at91sam9g45.dtsi new file mode 100644 index 0000000..db6a452 --- /dev/null +++ b/arch/arm/boot/dts/at91sam9g45.dtsi @@ -0,0 +1,106 @@ +/* + * at91sam9g45.dtsi - Device Tree Include file for AT91SAM9G45 family SoC + * applies to AT91SAM9G45, AT91SAM9M10, + * AT91SAM9G46, AT91SAM9M11 SoC + * + * Copyright (C) 2011 Atmel, + * 2011 Nicolas Ferre <nicolas.ferre@atmel.com> + * + * Licensed under GPLv2 or later. + */ + +/include/ "skeleton.dtsi" + +/ { + model = "Atmel AT91SAM9G45 family SoC"; + compatible = "atmel,at91sam9g45"; + interrupt-parent = <&aic>; + + aliases { + serial0 = &dbgu; + serial1 = &usart0; + serial2 = &usart1; + serial3 = &usart2; + serial4 = &usart3; + }; + cpus { + cpu at 0 { + compatible = "arm,arm926ejs"; + }; + }; + + memory at 70000000 { + reg = <0x70000000 0x10000000>; + }; + + ahb { + compatible = "simple-bus"; + #address-cells = <1>; + #size-cells = <1>; + ranges; + + apb { + compatible = "simple-bus"; + #address-cells = <1>; + #size-cells = <1>; + ranges; + + aic: interrupt-controller at fffff000 { + #interrupt-cells = <1>; + compatible = "atmel,at91rm9200-aic"; + interrupt-controller; + interrupt-parent; + reg = <0xfffff000 0x200>; + }; + + dma: dma-controller at ffffec00 { + compatible = "atmel,at91sam9g45-dma"; + reg = <0xffffec00 0x200>; + interrupts = <21>; + }; + + dbgu: serial at ffffee00 { + compatible = "atmel,at91sam9260-usart"; + reg = <0xffffee00 0x200>; + interrupts = <1>; + status = "disabled"; + }; + + usart0: serial at fff8c000 { + compatible = "atmel,at91sam9260-usart"; + reg = <0xfff8c000 0x200>; + interrupts = <7>; + atmel,use-dma-rx; + atmel,use-dma-tx; + status = "disabled"; + }; + + usart1: serial at fff90000 { + compatible = "atmel,at91sam9260-usart"; + reg = <0xfff90000 0x200>; + interrupts = <8>; + atmel,use-dma-rx; + atmel,use-dma-tx; + status = "disabled"; + }; + + usart2: serial at fff94000 { + compatible = "atmel,at91sam9260-usart"; + reg = <0xfff94000 0x200>; + interrupts = <9>; + atmel,use-dma-rx; + atmel,use-dma-tx; + status = "disabled"; + }; + + usart3: serial at fff98000 { + compatible = "atmel,at91sam9260-usart"; + reg = <0xfff98000 0x200>; + interrupts = <10>; + atmel,use-dma-rx; + atmel,use-dma-tx; + status = "disabled"; + }; + }; + }; +}; diff --git a/arch/arm/boot/dts/at91sam9m10g45ek.dts b/arch/arm/boot/dts/at91sam9m10g45ek.dts new file mode 100644 index 0000000..85b34f5 --- /dev/null +++ b/arch/arm/boot/dts/at91sam9m10g45ek.dts @@ -0,0 +1,35 @@ +/* + * at91sam9m10g45ek.dts - Device Tree file for AT91SAM9M10G45-EK board + * + * Copyright (C) 2011 Atmel, + * 2011 Nicolas Ferre <nicolas.ferre@atmel.com> + * + * Licensed under GPLv2 or later. + */ +/dts-v1/; +/include/ "at91sam9g45.dtsi" + +/ { + model = "Atmel AT91SAM9M10G45-EK"; + compatible = "atmel,at91sam9m10g45ek", "atmel,at91sam9g45", "atmel,at91sam9"; + + chosen { + bootargs = "mem=64M console=ttyS0,115200 mtdparts=atmel_nand:4M(bootstrap/uboot/kernel)ro,60M(rootfs),-(data) root=/dev/mtdblock1 rw rootfstype=jffs2"; + }; + + memory at 70000000 { + reg = <0x70000000 0x4000000>; + }; + + ahb { + apb { + dbgu: serial at ffffee00 { + status = "okay"; + }; + + usart1: serial at fff90000 { + status = "okay"; + }; + }; + }; +}; diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig index 2248467..4b59d96 100644 --- a/arch/arm/mach-at91/Kconfig +++ b/arch/arm/mach-at91/Kconfig @@ -442,6 +442,17 @@ endif # ---------------------------------------------------------- +comment "Generic Board Type" + +config MACH_AT91SAM_DT + bool "Atmel AT91SAM Evaluation Kits with device-tree support" + select USE_OF + help + Select this if you want to experiment device-tree with + an Atmel Evaluation Kit. + +# ---------------------------------------------------------- + comment "AT91 Board Options" config MTD_AT91_DATAFLASH_CARD diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile index bf57e8b..3ff245e 100644 --- a/arch/arm/mach-at91/Makefile +++ b/arch/arm/mach-at91/Makefile @@ -74,6 +74,9 @@ obj-$(CONFIG_MACH_SNAPPER_9260) += board-snapper9260.o # AT91SAM9G45 board-specific support obj-$(CONFIG_MACH_AT91SAM9M10G45EK) += board-sam9m10g45ek.o +# AT91SAM board with device-tree +obj-$(CONFIG_MACH_AT91SAM_DT) += board-dt.o + # AT91CAP9 board-specific support obj-$(CONFIG_MACH_AT91CAP9ADK) += board-cap9adk.o diff --git a/arch/arm/mach-at91/Makefile.boot b/arch/arm/mach-at91/Makefile.boot index 3462b81..d278863 100644 --- a/arch/arm/mach-at91/Makefile.boot +++ b/arch/arm/mach-at91/Makefile.boot @@ -16,3 +16,5 @@ else params_phys-y := 0x20000100 initrd_phys-y := 0x20410000 endif + +dtb-$(CONFIG_MACH_AT91SAM_DT) += at91sam9m10g45ek.dtb diff --git a/arch/arm/mach-at91/at91sam9g45.c b/arch/arm/mach-at91/at91sam9g45.c index e04c5fb..8baf5a1 100644 --- a/arch/arm/mach-at91/at91sam9g45.c +++ b/arch/arm/mach-at91/at91sam9g45.c @@ -215,6 +215,12 @@ static struct clk_lookup periph_clocks_lookups[] = { CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.1", &tcb0_clk), CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc0_clk), CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk), + /* more usart lookup table for DT entries */ + CLKDEV_CON_DEV_ID("usart", "ffffee00.serial", &mck), + CLKDEV_CON_DEV_ID("usart", "fff8c000.serial", &usart0_clk), + CLKDEV_CON_DEV_ID("usart", "fff90000.serial", &usart1_clk), + CLKDEV_CON_DEV_ID("usart", "fff94000.serial", &usart2_clk), + CLKDEV_CON_DEV_ID("usart", "fff98000.serial", &usart3_clk), }; static struct clk_lookup usart_clocks_lookups[] = { diff --git a/arch/arm/mach-at91/board-dt.c b/arch/arm/mach-at91/board-dt.c new file mode 100644 index 0000000..77fe466 --- /dev/null +++ b/arch/arm/mach-at91/board-dt.c @@ -0,0 +1,122 @@ +/* + * Setup code for AT91SAM Evaluation Kits with Device Tree support + * + * Covers: * AT91SAM9G45-EKES board + * * AT91SAM9M10-EKES board + * * AT91SAM9M10G45-EK board + * + * Copyright (C) 2011 Atmel, + * 2011 Nicolas Ferre <nicolas.ferre@atmel.com> + * + * Licensed under GPLv2 or later. + */ + +#include <linux/types.h> +#include <linux/init.h> +#include <linux/module.h> +#include <linux/gpio.h> +#include <linux/irqdomain.h> +#include <linux/of_irq.h> +#include <linux/of_platform.h> + +#include <mach/hardware.h> +#include <mach/board.h> +#include <mach/system_rev.h> +#include <mach/at91sam9_smc.h> + +#include <asm/setup.h> +#include <asm/irq.h> +#include <asm/mach/arch.h> +#include <asm/mach/map.h> +#include <asm/mach/irq.h> + +#include "sam9_smc.h" +#include "generic.h" + + +static void __init ek_init_early(void) +{ + /* Initialize processor: 12.000 MHz crystal */ + at91_initialize(12000000); + + /* DGBU on ttyS0. (Rx & Tx only) */ + at91_register_uart(0, 0, 0); + + /* set serial console to ttyS0 (ie, DBGU) */ + at91_set_serial_console(0); +} + +/* det_pin is not connected */ +static struct atmel_nand_data __initdata ek_nand_data = { + .ale = 21, + .cle = 22, + .rdy_pin = AT91_PIN_PC8, + .enable_pin = AT91_PIN_PC14, +}; + +static struct sam9_smc_config __initdata ek_nand_smc_config = { + .ncs_read_setup = 0, + .nrd_setup = 2, + .ncs_write_setup = 0, + .nwe_setup = 2, + + .ncs_read_pulse = 4, + .nrd_pulse = 4, + .ncs_write_pulse = 4, + .nwe_pulse = 4, + + .read_cycle = 7, + .write_cycle = 7, + + .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE, + .tdf_cycles = 3, +}; + +static void __init ek_add_device_nand(void) +{ + ek_nand_data.bus_width_16 = board_have_nand_16bit(); + /* setup bus-width (8 or 16) */ + if (ek_nand_data.bus_width_16) + ek_nand_smc_config.mode |= AT91_SMC_DBW_16; + else + ek_nand_smc_config.mode |= AT91_SMC_DBW_8; + + /* configure chip-select 3 (NAND) */ + sam9_smc_configure(3, &ek_nand_smc_config); + + at91_add_device_nand(&ek_nand_data); +} + +static const struct of_device_id aic_of_match[] __initconst = { + { .compatible = "atmel,at91rm9200-aic", }, + {}, +}; + +static void __init at91_dt_init_irq(void) +{ + irq_domain_generate_simple(aic_of_match, 0xfffff000, 0); + at91_init_irq_default(); +} + +static void __init at91_dt_device_init(void) +{ + of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); + + /* NAND */ + ek_add_device_nand(); +} + +static const char *at91_dt_board_compat[] __initdata = { + "atmel,at91sam9m10g45ek", + NULL +}; + +DT_MACHINE_START(at91sam9m10g45ek_dt, "Atmel AT91SAM (Device Tree)") + /* Maintainer: Atmel */ + .timer = &at91sam926x_timer, + .map_io = at91_map_io, + .init_early = ek_init_early, + .init_irq = at91_dt_init_irq, + .init_machine = at91_dt_device_init, + .dt_compat = at91_dt_board_compat, +MACHINE_END -- 1.7.5.4 ^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH V3 1/2] ARM: at91: dt: at91sam9g45 family and board device tree files @ 2011-10-24 14:05 ` Nicolas Ferre 0 siblings, 0 replies; 49+ messages in thread From: Nicolas Ferre @ 2011-10-24 14:05 UTC (permalink / raw) To: robherring2-Re5JQEeQqe8AvxtiuMwx3w, grant.likely-s3s/WqlpOiPyB63q8FvJNQ Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r Create a new device tree source file for Atmel at91sam9g45 SoC family. The Evaluation Kit at91sam9m10g45ek includes it. This first basic support will be populated as drivers and boards will be converted to device tree. Contains serial, dma and interrupt controllers. The generic board file still takes advantage of platform data for early serial init. As we need a storage media and the NAND flash driver is not converted to DT yet, we keep old initialization for it. Signed-off-by: Nicolas Ferre <nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org> --- V3: - additional clock lookup for device tree handling - devices disabled in dtsi file so that only useful devices are enabled in dts files V2: foundation for AT91SAM generic support - device tree focused board file - inclusion of USART DT support - early USART and NAND still using platform data arch/arm/boot/dts/at91sam9g45.dtsi | 106 +++++++++++++++++++++++++++ arch/arm/boot/dts/at91sam9m10g45ek.dts | 35 +++++++++ arch/arm/mach-at91/Kconfig | 11 +++ arch/arm/mach-at91/Makefile | 3 + arch/arm/mach-at91/Makefile.boot | 2 + arch/arm/mach-at91/at91sam9g45.c | 6 ++ arch/arm/mach-at91/board-dt.c | 122 ++++++++++++++++++++++++++++++++ 7 files changed, 285 insertions(+), 0 deletions(-) create mode 100644 arch/arm/boot/dts/at91sam9g45.dtsi create mode 100644 arch/arm/boot/dts/at91sam9m10g45ek.dts create mode 100644 arch/arm/mach-at91/board-dt.c diff --git a/arch/arm/boot/dts/at91sam9g45.dtsi b/arch/arm/boot/dts/at91sam9g45.dtsi new file mode 100644 index 0000000..db6a452 --- /dev/null +++ b/arch/arm/boot/dts/at91sam9g45.dtsi @@ -0,0 +1,106 @@ +/* + * at91sam9g45.dtsi - Device Tree Include file for AT91SAM9G45 family SoC + * applies to AT91SAM9G45, AT91SAM9M10, + * AT91SAM9G46, AT91SAM9M11 SoC + * + * Copyright (C) 2011 Atmel, + * 2011 Nicolas Ferre <nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org> + * + * Licensed under GPLv2 or later. + */ + +/include/ "skeleton.dtsi" + +/ { + model = "Atmel AT91SAM9G45 family SoC"; + compatible = "atmel,at91sam9g45"; + interrupt-parent = <&aic>; + + aliases { + serial0 = &dbgu; + serial1 = &usart0; + serial2 = &usart1; + serial3 = &usart2; + serial4 = &usart3; + }; + cpus { + cpu@0 { + compatible = "arm,arm926ejs"; + }; + }; + + memory@70000000 { + reg = <0x70000000 0x10000000>; + }; + + ahb { + compatible = "simple-bus"; + #address-cells = <1>; + #size-cells = <1>; + ranges; + + apb { + compatible = "simple-bus"; + #address-cells = <1>; + #size-cells = <1>; + ranges; + + aic: interrupt-controller@fffff000 { + #interrupt-cells = <1>; + compatible = "atmel,at91rm9200-aic"; + interrupt-controller; + interrupt-parent; + reg = <0xfffff000 0x200>; + }; + + dma: dma-controller@ffffec00 { + compatible = "atmel,at91sam9g45-dma"; + reg = <0xffffec00 0x200>; + interrupts = <21>; + }; + + dbgu: serial@ffffee00 { + compatible = "atmel,at91sam9260-usart"; + reg = <0xffffee00 0x200>; + interrupts = <1>; + status = "disabled"; + }; + + usart0: serial@fff8c000 { + compatible = "atmel,at91sam9260-usart"; + reg = <0xfff8c000 0x200>; + interrupts = <7>; + atmel,use-dma-rx; + atmel,use-dma-tx; + status = "disabled"; + }; + + usart1: serial@fff90000 { + compatible = "atmel,at91sam9260-usart"; + reg = <0xfff90000 0x200>; + interrupts = <8>; + atmel,use-dma-rx; + atmel,use-dma-tx; + status = "disabled"; + }; + + usart2: serial@fff94000 { + compatible = "atmel,at91sam9260-usart"; + reg = <0xfff94000 0x200>; + interrupts = <9>; + atmel,use-dma-rx; + atmel,use-dma-tx; + status = "disabled"; + }; + + usart3: serial@fff98000 { + compatible = "atmel,at91sam9260-usart"; + reg = <0xfff98000 0x200>; + interrupts = <10>; + atmel,use-dma-rx; + atmel,use-dma-tx; + status = "disabled"; + }; + }; + }; +}; diff --git a/arch/arm/boot/dts/at91sam9m10g45ek.dts b/arch/arm/boot/dts/at91sam9m10g45ek.dts new file mode 100644 index 0000000..85b34f5 --- /dev/null +++ b/arch/arm/boot/dts/at91sam9m10g45ek.dts @@ -0,0 +1,35 @@ +/* + * at91sam9m10g45ek.dts - Device Tree file for AT91SAM9M10G45-EK board + * + * Copyright (C) 2011 Atmel, + * 2011 Nicolas Ferre <nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org> + * + * Licensed under GPLv2 or later. + */ +/dts-v1/; +/include/ "at91sam9g45.dtsi" + +/ { + model = "Atmel AT91SAM9M10G45-EK"; + compatible = "atmel,at91sam9m10g45ek", "atmel,at91sam9g45", "atmel,at91sam9"; + + chosen { + bootargs = "mem=64M console=ttyS0,115200 mtdparts=atmel_nand:4M(bootstrap/uboot/kernel)ro,60M(rootfs),-(data) root=/dev/mtdblock1 rw rootfstype=jffs2"; + }; + + memory@70000000 { + reg = <0x70000000 0x4000000>; + }; + + ahb { + apb { + dbgu: serial@ffffee00 { + status = "okay"; + }; + + usart1: serial@fff90000 { + status = "okay"; + }; + }; + }; +}; diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig index 2248467..4b59d96 100644 --- a/arch/arm/mach-at91/Kconfig +++ b/arch/arm/mach-at91/Kconfig @@ -442,6 +442,17 @@ endif # ---------------------------------------------------------- +comment "Generic Board Type" + +config MACH_AT91SAM_DT + bool "Atmel AT91SAM Evaluation Kits with device-tree support" + select USE_OF + help + Select this if you want to experiment device-tree with + an Atmel Evaluation Kit. + +# ---------------------------------------------------------- + comment "AT91 Board Options" config MTD_AT91_DATAFLASH_CARD diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile index bf57e8b..3ff245e 100644 --- a/arch/arm/mach-at91/Makefile +++ b/arch/arm/mach-at91/Makefile @@ -74,6 +74,9 @@ obj-$(CONFIG_MACH_SNAPPER_9260) += board-snapper9260.o # AT91SAM9G45 board-specific support obj-$(CONFIG_MACH_AT91SAM9M10G45EK) += board-sam9m10g45ek.o +# AT91SAM board with device-tree +obj-$(CONFIG_MACH_AT91SAM_DT) += board-dt.o + # AT91CAP9 board-specific support obj-$(CONFIG_MACH_AT91CAP9ADK) += board-cap9adk.o diff --git a/arch/arm/mach-at91/Makefile.boot b/arch/arm/mach-at91/Makefile.boot index 3462b81..d278863 100644 --- a/arch/arm/mach-at91/Makefile.boot +++ b/arch/arm/mach-at91/Makefile.boot @@ -16,3 +16,5 @@ else params_phys-y := 0x20000100 initrd_phys-y := 0x20410000 endif + +dtb-$(CONFIG_MACH_AT91SAM_DT) += at91sam9m10g45ek.dtb diff --git a/arch/arm/mach-at91/at91sam9g45.c b/arch/arm/mach-at91/at91sam9g45.c index e04c5fb..8baf5a1 100644 --- a/arch/arm/mach-at91/at91sam9g45.c +++ b/arch/arm/mach-at91/at91sam9g45.c @@ -215,6 +215,12 @@ static struct clk_lookup periph_clocks_lookups[] = { CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.1", &tcb0_clk), CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc0_clk), CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk), + /* more usart lookup table for DT entries */ + CLKDEV_CON_DEV_ID("usart", "ffffee00.serial", &mck), + CLKDEV_CON_DEV_ID("usart", "fff8c000.serial", &usart0_clk), + CLKDEV_CON_DEV_ID("usart", "fff90000.serial", &usart1_clk), + CLKDEV_CON_DEV_ID("usart", "fff94000.serial", &usart2_clk), + CLKDEV_CON_DEV_ID("usart", "fff98000.serial", &usart3_clk), }; static struct clk_lookup usart_clocks_lookups[] = { diff --git a/arch/arm/mach-at91/board-dt.c b/arch/arm/mach-at91/board-dt.c new file mode 100644 index 0000000..77fe466 --- /dev/null +++ b/arch/arm/mach-at91/board-dt.c @@ -0,0 +1,122 @@ +/* + * Setup code for AT91SAM Evaluation Kits with Device Tree support + * + * Covers: * AT91SAM9G45-EKES board + * * AT91SAM9M10-EKES board + * * AT91SAM9M10G45-EK board + * + * Copyright (C) 2011 Atmel, + * 2011 Nicolas Ferre <nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org> + * + * Licensed under GPLv2 or later. + */ + +#include <linux/types.h> +#include <linux/init.h> +#include <linux/module.h> +#include <linux/gpio.h> +#include <linux/irqdomain.h> +#include <linux/of_irq.h> +#include <linux/of_platform.h> + +#include <mach/hardware.h> +#include <mach/board.h> +#include <mach/system_rev.h> +#include <mach/at91sam9_smc.h> + +#include <asm/setup.h> +#include <asm/irq.h> +#include <asm/mach/arch.h> +#include <asm/mach/map.h> +#include <asm/mach/irq.h> + +#include "sam9_smc.h" +#include "generic.h" + + +static void __init ek_init_early(void) +{ + /* Initialize processor: 12.000 MHz crystal */ + at91_initialize(12000000); + + /* DGBU on ttyS0. (Rx & Tx only) */ + at91_register_uart(0, 0, 0); + + /* set serial console to ttyS0 (ie, DBGU) */ + at91_set_serial_console(0); +} + +/* det_pin is not connected */ +static struct atmel_nand_data __initdata ek_nand_data = { + .ale = 21, + .cle = 22, + .rdy_pin = AT91_PIN_PC8, + .enable_pin = AT91_PIN_PC14, +}; + +static struct sam9_smc_config __initdata ek_nand_smc_config = { + .ncs_read_setup = 0, + .nrd_setup = 2, + .ncs_write_setup = 0, + .nwe_setup = 2, + + .ncs_read_pulse = 4, + .nrd_pulse = 4, + .ncs_write_pulse = 4, + .nwe_pulse = 4, + + .read_cycle = 7, + .write_cycle = 7, + + .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE, + .tdf_cycles = 3, +}; + +static void __init ek_add_device_nand(void) +{ + ek_nand_data.bus_width_16 = board_have_nand_16bit(); + /* setup bus-width (8 or 16) */ + if (ek_nand_data.bus_width_16) + ek_nand_smc_config.mode |= AT91_SMC_DBW_16; + else + ek_nand_smc_config.mode |= AT91_SMC_DBW_8; + + /* configure chip-select 3 (NAND) */ + sam9_smc_configure(3, &ek_nand_smc_config); + + at91_add_device_nand(&ek_nand_data); +} + +static const struct of_device_id aic_of_match[] __initconst = { + { .compatible = "atmel,at91rm9200-aic", }, + {}, +}; + +static void __init at91_dt_init_irq(void) +{ + irq_domain_generate_simple(aic_of_match, 0xfffff000, 0); + at91_init_irq_default(); +} + +static void __init at91_dt_device_init(void) +{ + of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); + + /* NAND */ + ek_add_device_nand(); +} + +static const char *at91_dt_board_compat[] __initdata = { + "atmel,at91sam9m10g45ek", + NULL +}; + +DT_MACHINE_START(at91sam9m10g45ek_dt, "Atmel AT91SAM (Device Tree)") + /* Maintainer: Atmel */ + .timer = &at91sam926x_timer, + .map_io = at91_map_io, + .init_early = ek_init_early, + .init_irq = at91_dt_init_irq, + .init_machine = at91_dt_device_init, + .dt_compat = at91_dt_board_compat, +MACHINE_END -- 1.7.5.4 ^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH V3 1/2] ARM: at91: dt: at91sam9g45 family and board device tree files @ 2011-10-24 14:05 ` Nicolas Ferre 0 siblings, 0 replies; 49+ messages in thread From: Nicolas Ferre @ 2011-10-24 14:05 UTC (permalink / raw) To: robherring2, grant.likely Cc: linux-kernel, linux-arm-kernel, devicetree-discuss, plagnioj, Nicolas Ferre Create a new device tree source file for Atmel at91sam9g45 SoC family. The Evaluation Kit at91sam9m10g45ek includes it. This first basic support will be populated as drivers and boards will be converted to device tree. Contains serial, dma and interrupt controllers. The generic board file still takes advantage of platform data for early serial init. As we need a storage media and the NAND flash driver is not converted to DT yet, we keep old initialization for it. Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> --- V3: - additional clock lookup for device tree handling - devices disabled in dtsi file so that only useful devices are enabled in dts files V2: foundation for AT91SAM generic support - device tree focused board file - inclusion of USART DT support - early USART and NAND still using platform data arch/arm/boot/dts/at91sam9g45.dtsi | 106 +++++++++++++++++++++++++++ arch/arm/boot/dts/at91sam9m10g45ek.dts | 35 +++++++++ arch/arm/mach-at91/Kconfig | 11 +++ arch/arm/mach-at91/Makefile | 3 + arch/arm/mach-at91/Makefile.boot | 2 + arch/arm/mach-at91/at91sam9g45.c | 6 ++ arch/arm/mach-at91/board-dt.c | 122 ++++++++++++++++++++++++++++++++ 7 files changed, 285 insertions(+), 0 deletions(-) create mode 100644 arch/arm/boot/dts/at91sam9g45.dtsi create mode 100644 arch/arm/boot/dts/at91sam9m10g45ek.dts create mode 100644 arch/arm/mach-at91/board-dt.c diff --git a/arch/arm/boot/dts/at91sam9g45.dtsi b/arch/arm/boot/dts/at91sam9g45.dtsi new file mode 100644 index 0000000..db6a452 --- /dev/null +++ b/arch/arm/boot/dts/at91sam9g45.dtsi @@ -0,0 +1,106 @@ +/* + * at91sam9g45.dtsi - Device Tree Include file for AT91SAM9G45 family SoC + * applies to AT91SAM9G45, AT91SAM9M10, + * AT91SAM9G46, AT91SAM9M11 SoC + * + * Copyright (C) 2011 Atmel, + * 2011 Nicolas Ferre <nicolas.ferre@atmel.com> + * + * Licensed under GPLv2 or later. + */ + +/include/ "skeleton.dtsi" + +/ { + model = "Atmel AT91SAM9G45 family SoC"; + compatible = "atmel,at91sam9g45"; + interrupt-parent = <&aic>; + + aliases { + serial0 = &dbgu; + serial1 = &usart0; + serial2 = &usart1; + serial3 = &usart2; + serial4 = &usart3; + }; + cpus { + cpu@0 { + compatible = "arm,arm926ejs"; + }; + }; + + memory@70000000 { + reg = <0x70000000 0x10000000>; + }; + + ahb { + compatible = "simple-bus"; + #address-cells = <1>; + #size-cells = <1>; + ranges; + + apb { + compatible = "simple-bus"; + #address-cells = <1>; + #size-cells = <1>; + ranges; + + aic: interrupt-controller@fffff000 { + #interrupt-cells = <1>; + compatible = "atmel,at91rm9200-aic"; + interrupt-controller; + interrupt-parent; + reg = <0xfffff000 0x200>; + }; + + dma: dma-controller@ffffec00 { + compatible = "atmel,at91sam9g45-dma"; + reg = <0xffffec00 0x200>; + interrupts = <21>; + }; + + dbgu: serial@ffffee00 { + compatible = "atmel,at91sam9260-usart"; + reg = <0xffffee00 0x200>; + interrupts = <1>; + status = "disabled"; + }; + + usart0: serial@fff8c000 { + compatible = "atmel,at91sam9260-usart"; + reg = <0xfff8c000 0x200>; + interrupts = <7>; + atmel,use-dma-rx; + atmel,use-dma-tx; + status = "disabled"; + }; + + usart1: serial@fff90000 { + compatible = "atmel,at91sam9260-usart"; + reg = <0xfff90000 0x200>; + interrupts = <8>; + atmel,use-dma-rx; + atmel,use-dma-tx; + status = "disabled"; + }; + + usart2: serial@fff94000 { + compatible = "atmel,at91sam9260-usart"; + reg = <0xfff94000 0x200>; + interrupts = <9>; + atmel,use-dma-rx; + atmel,use-dma-tx; + status = "disabled"; + }; + + usart3: serial@fff98000 { + compatible = "atmel,at91sam9260-usart"; + reg = <0xfff98000 0x200>; + interrupts = <10>; + atmel,use-dma-rx; + atmel,use-dma-tx; + status = "disabled"; + }; + }; + }; +}; diff --git a/arch/arm/boot/dts/at91sam9m10g45ek.dts b/arch/arm/boot/dts/at91sam9m10g45ek.dts new file mode 100644 index 0000000..85b34f5 --- /dev/null +++ b/arch/arm/boot/dts/at91sam9m10g45ek.dts @@ -0,0 +1,35 @@ +/* + * at91sam9m10g45ek.dts - Device Tree file for AT91SAM9M10G45-EK board + * + * Copyright (C) 2011 Atmel, + * 2011 Nicolas Ferre <nicolas.ferre@atmel.com> + * + * Licensed under GPLv2 or later. + */ +/dts-v1/; +/include/ "at91sam9g45.dtsi" + +/ { + model = "Atmel AT91SAM9M10G45-EK"; + compatible = "atmel,at91sam9m10g45ek", "atmel,at91sam9g45", "atmel,at91sam9"; + + chosen { + bootargs = "mem=64M console=ttyS0,115200 mtdparts=atmel_nand:4M(bootstrap/uboot/kernel)ro,60M(rootfs),-(data) root=/dev/mtdblock1 rw rootfstype=jffs2"; + }; + + memory@70000000 { + reg = <0x70000000 0x4000000>; + }; + + ahb { + apb { + dbgu: serial@ffffee00 { + status = "okay"; + }; + + usart1: serial@fff90000 { + status = "okay"; + }; + }; + }; +}; diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig index 2248467..4b59d96 100644 --- a/arch/arm/mach-at91/Kconfig +++ b/arch/arm/mach-at91/Kconfig @@ -442,6 +442,17 @@ endif # ---------------------------------------------------------- +comment "Generic Board Type" + +config MACH_AT91SAM_DT + bool "Atmel AT91SAM Evaluation Kits with device-tree support" + select USE_OF + help + Select this if you want to experiment device-tree with + an Atmel Evaluation Kit. + +# ---------------------------------------------------------- + comment "AT91 Board Options" config MTD_AT91_DATAFLASH_CARD diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile index bf57e8b..3ff245e 100644 --- a/arch/arm/mach-at91/Makefile +++ b/arch/arm/mach-at91/Makefile @@ -74,6 +74,9 @@ obj-$(CONFIG_MACH_SNAPPER_9260) += board-snapper9260.o # AT91SAM9G45 board-specific support obj-$(CONFIG_MACH_AT91SAM9M10G45EK) += board-sam9m10g45ek.o +# AT91SAM board with device-tree +obj-$(CONFIG_MACH_AT91SAM_DT) += board-dt.o + # AT91CAP9 board-specific support obj-$(CONFIG_MACH_AT91CAP9ADK) += board-cap9adk.o diff --git a/arch/arm/mach-at91/Makefile.boot b/arch/arm/mach-at91/Makefile.boot index 3462b81..d278863 100644 --- a/arch/arm/mach-at91/Makefile.boot +++ b/arch/arm/mach-at91/Makefile.boot @@ -16,3 +16,5 @@ else params_phys-y := 0x20000100 initrd_phys-y := 0x20410000 endif + +dtb-$(CONFIG_MACH_AT91SAM_DT) += at91sam9m10g45ek.dtb diff --git a/arch/arm/mach-at91/at91sam9g45.c b/arch/arm/mach-at91/at91sam9g45.c index e04c5fb..8baf5a1 100644 --- a/arch/arm/mach-at91/at91sam9g45.c +++ b/arch/arm/mach-at91/at91sam9g45.c @@ -215,6 +215,12 @@ static struct clk_lookup periph_clocks_lookups[] = { CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.1", &tcb0_clk), CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc0_clk), CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk), + /* more usart lookup table for DT entries */ + CLKDEV_CON_DEV_ID("usart", "ffffee00.serial", &mck), + CLKDEV_CON_DEV_ID("usart", "fff8c000.serial", &usart0_clk), + CLKDEV_CON_DEV_ID("usart", "fff90000.serial", &usart1_clk), + CLKDEV_CON_DEV_ID("usart", "fff94000.serial", &usart2_clk), + CLKDEV_CON_DEV_ID("usart", "fff98000.serial", &usart3_clk), }; static struct clk_lookup usart_clocks_lookups[] = { diff --git a/arch/arm/mach-at91/board-dt.c b/arch/arm/mach-at91/board-dt.c new file mode 100644 index 0000000..77fe466 --- /dev/null +++ b/arch/arm/mach-at91/board-dt.c @@ -0,0 +1,122 @@ +/* + * Setup code for AT91SAM Evaluation Kits with Device Tree support + * + * Covers: * AT91SAM9G45-EKES board + * * AT91SAM9M10-EKES board + * * AT91SAM9M10G45-EK board + * + * Copyright (C) 2011 Atmel, + * 2011 Nicolas Ferre <nicolas.ferre@atmel.com> + * + * Licensed under GPLv2 or later. + */ + +#include <linux/types.h> +#include <linux/init.h> +#include <linux/module.h> +#include <linux/gpio.h> +#include <linux/irqdomain.h> +#include <linux/of_irq.h> +#include <linux/of_platform.h> + +#include <mach/hardware.h> +#include <mach/board.h> +#include <mach/system_rev.h> +#include <mach/at91sam9_smc.h> + +#include <asm/setup.h> +#include <asm/irq.h> +#include <asm/mach/arch.h> +#include <asm/mach/map.h> +#include <asm/mach/irq.h> + +#include "sam9_smc.h" +#include "generic.h" + + +static void __init ek_init_early(void) +{ + /* Initialize processor: 12.000 MHz crystal */ + at91_initialize(12000000); + + /* DGBU on ttyS0. (Rx & Tx only) */ + at91_register_uart(0, 0, 0); + + /* set serial console to ttyS0 (ie, DBGU) */ + at91_set_serial_console(0); +} + +/* det_pin is not connected */ +static struct atmel_nand_data __initdata ek_nand_data = { + .ale = 21, + .cle = 22, + .rdy_pin = AT91_PIN_PC8, + .enable_pin = AT91_PIN_PC14, +}; + +static struct sam9_smc_config __initdata ek_nand_smc_config = { + .ncs_read_setup = 0, + .nrd_setup = 2, + .ncs_write_setup = 0, + .nwe_setup = 2, + + .ncs_read_pulse = 4, + .nrd_pulse = 4, + .ncs_write_pulse = 4, + .nwe_pulse = 4, + + .read_cycle = 7, + .write_cycle = 7, + + .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE, + .tdf_cycles = 3, +}; + +static void __init ek_add_device_nand(void) +{ + ek_nand_data.bus_width_16 = board_have_nand_16bit(); + /* setup bus-width (8 or 16) */ + if (ek_nand_data.bus_width_16) + ek_nand_smc_config.mode |= AT91_SMC_DBW_16; + else + ek_nand_smc_config.mode |= AT91_SMC_DBW_8; + + /* configure chip-select 3 (NAND) */ + sam9_smc_configure(3, &ek_nand_smc_config); + + at91_add_device_nand(&ek_nand_data); +} + +static const struct of_device_id aic_of_match[] __initconst = { + { .compatible = "atmel,at91rm9200-aic", }, + {}, +}; + +static void __init at91_dt_init_irq(void) +{ + irq_domain_generate_simple(aic_of_match, 0xfffff000, 0); + at91_init_irq_default(); +} + +static void __init at91_dt_device_init(void) +{ + of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); + + /* NAND */ + ek_add_device_nand(); +} + +static const char *at91_dt_board_compat[] __initdata = { + "atmel,at91sam9m10g45ek", + NULL +}; + +DT_MACHINE_START(at91sam9m10g45ek_dt, "Atmel AT91SAM (Device Tree)") + /* Maintainer: Atmel */ + .timer = &at91sam926x_timer, + .map_io = at91_map_io, + .init_early = ek_init_early, + .init_irq = at91_dt_init_irq, + .init_machine = at91_dt_device_init, + .dt_compat = at91_dt_board_compat, +MACHINE_END -- 1.7.5.4 ^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH V3 2/2] ARM: at91: add at91sam9g20 and Calao USB A9G20 DT support 2011-10-24 14:05 ` Nicolas Ferre (?) @ 2011-10-24 14:05 ` Nicolas Ferre -1 siblings, 0 replies; 49+ messages in thread From: Nicolas Ferre @ 2011-10-24 14:05 UTC (permalink / raw) To: linux-arm-kernel From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> --- arch/arm/boot/dts/at91sam9g20.dtsi | 119 ++++++++++++++++++++++++++++++++++++ arch/arm/boot/dts/usb_a9g20.dts | 30 +++++++++ arch/arm/mach-at91/Makefile.boot | 2 +- arch/arm/mach-at91/at91sam9260.c | 8 +++ arch/arm/mach-at91/board-dt.c | 1 + 5 files changed, 159 insertions(+), 1 deletions(-) create mode 100644 arch/arm/boot/dts/at91sam9g20.dtsi create mode 100644 arch/arm/boot/dts/usb_a9g20.dts diff --git a/arch/arm/boot/dts/at91sam9g20.dtsi b/arch/arm/boot/dts/at91sam9g20.dtsi new file mode 100644 index 0000000..aeef042 --- /dev/null +++ b/arch/arm/boot/dts/at91sam9g20.dtsi @@ -0,0 +1,119 @@ +/* + * at91sam9g20.dtsi - Device Tree Include file for AT91SAM9G20 family SoC + * + * Copyright (C) 2011 Atmel, + * 2011 Nicolas Ferre <nicolas.ferre@atmel.com>, + * 2011 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> + * + * Licensed under GPLv2 or later. + */ + +/include/ "skeleton.dtsi" + +/ { + model = "Atmel AT91SAM9G20 family SoC"; + compatible = "atmel,at91sam9g20"; + interrupt-parent = <&aic>; + + aliases { + serial0 = &dbgu; + serial1 = &usart0; + serial2 = &usart1; + serial3 = &usart2; + serial4 = &usart3; + serial5 = &usart4; + serial6 = &usart5; + }; + cpus { + cpu at 0 { + compatible = "arm,arm926ejs"; + }; + }; + + memory at 20000000 { + reg = <0x20000000 0x08000000>; + }; + + ahb { + compatible = "simple-bus"; + #address-cells = <1>; + #size-cells = <1>; + ranges; + + apb { + compatible = "simple-bus"; + #address-cells = <1>; + #size-cells = <1>; + ranges; + + aic: interrupt-controller at fffff000 { + #interrupt-cells = <1>; + compatible = "atmel,at91rm9200-aic"; + interrupt-controller; + interrupt-parent; + reg = <0xfffff000 0x200>; + }; + + dbgu: serial at fffff200 { + compatible = "atmel,at91sam9260-usart"; + reg = <0xfffff200 0x200>; + interrupts = <1>; + status = "disabled"; + }; + + usart0: serial at fffb0000 { + compatible = "atmel,at91sam9260-usart"; + reg = <0xfffb0000 0x200>; + interrupts = <6>; + atmel,use-dma-rx; + atmel,use-dma-tx; + status = "disabled"; + }; + + usart1: serial at fffb4000 { + compatible = "atmel,at91sam9260-usart"; + reg = <0xfffb4000 0x200>; + interrupts = <7>; + atmel,use-dma-rx; + atmel,use-dma-tx; + status = "disabled"; + }; + + usart2: serial at fffb8000 { + compatible = "atmel,at91sam9260-usart"; + reg = <0xfffb8000 0x200>; + interrupts = <8>; + atmel,use-dma-rx; + atmel,use-dma-tx; + status = "disabled"; + }; + + usart3: serial at fffd0000 { + compatible = "atmel,at91sam9260-usart"; + reg = <0xfffd0000 0x200>; + interrupts = <23>; + atmel,use-dma-rx; + atmel,use-dma-tx; + status = "disabled"; + }; + + usart4: serial at fffd4000 { + compatible = "atmel,at91sam9260-usart"; + reg = <0xfffd4000 0x200>; + interrupts = <24>; + atmel,use-dma-rx; + atmel,use-dma-tx; + status = "disabled"; + }; + + usart5: serial at fffd8000 { + compatible = "atmel,at91sam9260-usart"; + reg = <0xfffd8000 0x200>; + interrupts = <25>; + atmel,use-dma-rx; + atmel,use-dma-tx; + status = "disabled"; + }; + }; + }; +}; diff --git a/arch/arm/boot/dts/usb_a9g20.dts b/arch/arm/boot/dts/usb_a9g20.dts new file mode 100644 index 0000000..a060f6c --- /dev/null +++ b/arch/arm/boot/dts/usb_a9g20.dts @@ -0,0 +1,30 @@ +/* + * usb_a9g20.dts - Device Tree file for Caloa USB A9G20 board + * + * Copyright (C) 2011 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> + * + * Licensed under GPLv2 or later. + */ +/dts-v1/; +/include/ "at91sam9g20.dtsi" + +/ { + model = "Calao USB A9G20"; + compatible = "calao,usb-a9g20", "atmel,at91sam9g20", "atmel,at91sam9"; + + chosen { + bootargs = "mem=64M console=ttyS0,115200 mtdparts=atmel_nand:128k(at91bootstrap),256k(barebox)ro,128k(bareboxenv),128k(bareboxenv2),4M(kernel),120M(rootfs),-(data) root=/dev/mtdblock5 rw rootfstype=ubifs"; + }; + + memory at 70000000 { + reg = <0x20000000 0x4000000>; + }; + + ahb { + apb { + dbgu: serial at fffff200 { + status = "okay"; + }; + }; + }; +}; diff --git a/arch/arm/mach-at91/Makefile.boot b/arch/arm/mach-at91/Makefile.boot index d278863..08c665a 100644 --- a/arch/arm/mach-at91/Makefile.boot +++ b/arch/arm/mach-at91/Makefile.boot @@ -17,4 +17,4 @@ params_phys-y := 0x20000100 initrd_phys-y := 0x20410000 endif -dtb-$(CONFIG_MACH_AT91SAM_DT) += at91sam9m10g45ek.dtb +dtb-$(CONFIG_MACH_AT91SAM_DT) += at91sam9m10g45ek.dtb usb_a9g20.dtb diff --git a/arch/arm/mach-at91/at91sam9260.c b/arch/arm/mach-at91/at91sam9260.c index cb397be..f4518b4 100644 --- a/arch/arm/mach-at91/at91sam9260.c +++ b/arch/arm/mach-at91/at91sam9260.c @@ -199,6 +199,14 @@ static struct clk_lookup periph_clocks_lookups[] = { CLKDEV_CON_DEV_ID("t4_clk", "atmel_tcb.1", &tc4_clk), CLKDEV_CON_DEV_ID("t5_clk", "atmel_tcb.1", &tc5_clk), CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc_clk), + /* more usart lookup table for DT entries */ + CLKDEV_CON_DEV_ID("usart", "fffff200.serial", &mck), + CLKDEV_CON_DEV_ID("usart", "fffb0000.serial", &usart0_clk), + CLKDEV_CON_DEV_ID("usart", "fffb4000.serial", &usart1_clk), + CLKDEV_CON_DEV_ID("usart", "fffb8000.serial", &usart2_clk), + CLKDEV_CON_DEV_ID("usart", "fffd0000.serial", &usart3_clk), + CLKDEV_CON_DEV_ID("usart", "fffd4000.serial", &usart4_clk), + CLKDEV_CON_DEV_ID("usart", "fffd8000.serial", &usart5_clk), }; static struct clk_lookup usart_clocks_lookups[] = { diff --git a/arch/arm/mach-at91/board-dt.c b/arch/arm/mach-at91/board-dt.c index 77fe466..a3d22f8 100644 --- a/arch/arm/mach-at91/board-dt.c +++ b/arch/arm/mach-at91/board-dt.c @@ -108,6 +108,7 @@ static void __init at91_dt_device_init(void) static const char *at91_dt_board_compat[] __initdata = { "atmel,at91sam9m10g45ek", + "calao,usb-a9g20", NULL }; -- 1.7.5.4 ^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH V3 2/2] ARM: at91: add at91sam9g20 and Calao USB A9G20 DT support @ 2011-10-24 14:05 ` Nicolas Ferre 0 siblings, 0 replies; 49+ messages in thread From: Nicolas Ferre @ 2011-10-24 14:05 UTC (permalink / raw) To: robherring2, grant.likely Cc: Nicolas Ferre, devicetree-discuss, plagnioj, linux-kernel, linux-arm-kernel From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> --- arch/arm/boot/dts/at91sam9g20.dtsi | 119 ++++++++++++++++++++++++++++++++++++ arch/arm/boot/dts/usb_a9g20.dts | 30 +++++++++ arch/arm/mach-at91/Makefile.boot | 2 +- arch/arm/mach-at91/at91sam9260.c | 8 +++ arch/arm/mach-at91/board-dt.c | 1 + 5 files changed, 159 insertions(+), 1 deletions(-) create mode 100644 arch/arm/boot/dts/at91sam9g20.dtsi create mode 100644 arch/arm/boot/dts/usb_a9g20.dts diff --git a/arch/arm/boot/dts/at91sam9g20.dtsi b/arch/arm/boot/dts/at91sam9g20.dtsi new file mode 100644 index 0000000..aeef042 --- /dev/null +++ b/arch/arm/boot/dts/at91sam9g20.dtsi @@ -0,0 +1,119 @@ +/* + * at91sam9g20.dtsi - Device Tree Include file for AT91SAM9G20 family SoC + * + * Copyright (C) 2011 Atmel, + * 2011 Nicolas Ferre <nicolas.ferre@atmel.com>, + * 2011 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> + * + * Licensed under GPLv2 or later. + */ + +/include/ "skeleton.dtsi" + +/ { + model = "Atmel AT91SAM9G20 family SoC"; + compatible = "atmel,at91sam9g20"; + interrupt-parent = <&aic>; + + aliases { + serial0 = &dbgu; + serial1 = &usart0; + serial2 = &usart1; + serial3 = &usart2; + serial4 = &usart3; + serial5 = &usart4; + serial6 = &usart5; + }; + cpus { + cpu@0 { + compatible = "arm,arm926ejs"; + }; + }; + + memory@20000000 { + reg = <0x20000000 0x08000000>; + }; + + ahb { + compatible = "simple-bus"; + #address-cells = <1>; + #size-cells = <1>; + ranges; + + apb { + compatible = "simple-bus"; + #address-cells = <1>; + #size-cells = <1>; + ranges; + + aic: interrupt-controller@fffff000 { + #interrupt-cells = <1>; + compatible = "atmel,at91rm9200-aic"; + interrupt-controller; + interrupt-parent; + reg = <0xfffff000 0x200>; + }; + + dbgu: serial@fffff200 { + compatible = "atmel,at91sam9260-usart"; + reg = <0xfffff200 0x200>; + interrupts = <1>; + status = "disabled"; + }; + + usart0: serial@fffb0000 { + compatible = "atmel,at91sam9260-usart"; + reg = <0xfffb0000 0x200>; + interrupts = <6>; + atmel,use-dma-rx; + atmel,use-dma-tx; + status = "disabled"; + }; + + usart1: serial@fffb4000 { + compatible = "atmel,at91sam9260-usart"; + reg = <0xfffb4000 0x200>; + interrupts = <7>; + atmel,use-dma-rx; + atmel,use-dma-tx; + status = "disabled"; + }; + + usart2: serial@fffb8000 { + compatible = "atmel,at91sam9260-usart"; + reg = <0xfffb8000 0x200>; + interrupts = <8>; + atmel,use-dma-rx; + atmel,use-dma-tx; + status = "disabled"; + }; + + usart3: serial@fffd0000 { + compatible = "atmel,at91sam9260-usart"; + reg = <0xfffd0000 0x200>; + interrupts = <23>; + atmel,use-dma-rx; + atmel,use-dma-tx; + status = "disabled"; + }; + + usart4: serial@fffd4000 { + compatible = "atmel,at91sam9260-usart"; + reg = <0xfffd4000 0x200>; + interrupts = <24>; + atmel,use-dma-rx; + atmel,use-dma-tx; + status = "disabled"; + }; + + usart5: serial@fffd8000 { + compatible = "atmel,at91sam9260-usart"; + reg = <0xfffd8000 0x200>; + interrupts = <25>; + atmel,use-dma-rx; + atmel,use-dma-tx; + status = "disabled"; + }; + }; + }; +}; diff --git a/arch/arm/boot/dts/usb_a9g20.dts b/arch/arm/boot/dts/usb_a9g20.dts new file mode 100644 index 0000000..a060f6c --- /dev/null +++ b/arch/arm/boot/dts/usb_a9g20.dts @@ -0,0 +1,30 @@ +/* + * usb_a9g20.dts - Device Tree file for Caloa USB A9G20 board + * + * Copyright (C) 2011 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> + * + * Licensed under GPLv2 or later. + */ +/dts-v1/; +/include/ "at91sam9g20.dtsi" + +/ { + model = "Calao USB A9G20"; + compatible = "calao,usb-a9g20", "atmel,at91sam9g20", "atmel,at91sam9"; + + chosen { + bootargs = "mem=64M console=ttyS0,115200 mtdparts=atmel_nand:128k(at91bootstrap),256k(barebox)ro,128k(bareboxenv),128k(bareboxenv2),4M(kernel),120M(rootfs),-(data) root=/dev/mtdblock5 rw rootfstype=ubifs"; + }; + + memory@70000000 { + reg = <0x20000000 0x4000000>; + }; + + ahb { + apb { + dbgu: serial@fffff200 { + status = "okay"; + }; + }; + }; +}; diff --git a/arch/arm/mach-at91/Makefile.boot b/arch/arm/mach-at91/Makefile.boot index d278863..08c665a 100644 --- a/arch/arm/mach-at91/Makefile.boot +++ b/arch/arm/mach-at91/Makefile.boot @@ -17,4 +17,4 @@ params_phys-y := 0x20000100 initrd_phys-y := 0x20410000 endif -dtb-$(CONFIG_MACH_AT91SAM_DT) += at91sam9m10g45ek.dtb +dtb-$(CONFIG_MACH_AT91SAM_DT) += at91sam9m10g45ek.dtb usb_a9g20.dtb diff --git a/arch/arm/mach-at91/at91sam9260.c b/arch/arm/mach-at91/at91sam9260.c index cb397be..f4518b4 100644 --- a/arch/arm/mach-at91/at91sam9260.c +++ b/arch/arm/mach-at91/at91sam9260.c @@ -199,6 +199,14 @@ static struct clk_lookup periph_clocks_lookups[] = { CLKDEV_CON_DEV_ID("t4_clk", "atmel_tcb.1", &tc4_clk), CLKDEV_CON_DEV_ID("t5_clk", "atmel_tcb.1", &tc5_clk), CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc_clk), + /* more usart lookup table for DT entries */ + CLKDEV_CON_DEV_ID("usart", "fffff200.serial", &mck), + CLKDEV_CON_DEV_ID("usart", "fffb0000.serial", &usart0_clk), + CLKDEV_CON_DEV_ID("usart", "fffb4000.serial", &usart1_clk), + CLKDEV_CON_DEV_ID("usart", "fffb8000.serial", &usart2_clk), + CLKDEV_CON_DEV_ID("usart", "fffd0000.serial", &usart3_clk), + CLKDEV_CON_DEV_ID("usart", "fffd4000.serial", &usart4_clk), + CLKDEV_CON_DEV_ID("usart", "fffd8000.serial", &usart5_clk), }; static struct clk_lookup usart_clocks_lookups[] = { diff --git a/arch/arm/mach-at91/board-dt.c b/arch/arm/mach-at91/board-dt.c index 77fe466..a3d22f8 100644 --- a/arch/arm/mach-at91/board-dt.c +++ b/arch/arm/mach-at91/board-dt.c @@ -108,6 +108,7 @@ static void __init at91_dt_device_init(void) static const char *at91_dt_board_compat[] __initdata = { "atmel,at91sam9m10g45ek", + "calao,usb-a9g20", NULL }; -- 1.7.5.4 ^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH V3 2/2] ARM: at91: add at91sam9g20 and Calao USB A9G20 DT support @ 2011-10-24 14:05 ` Nicolas Ferre 0 siblings, 0 replies; 49+ messages in thread From: Nicolas Ferre @ 2011-10-24 14:05 UTC (permalink / raw) To: robherring2, grant.likely Cc: linux-kernel, linux-arm-kernel, devicetree-discuss, plagnioj, Nicolas Ferre From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> --- arch/arm/boot/dts/at91sam9g20.dtsi | 119 ++++++++++++++++++++++++++++++++++++ arch/arm/boot/dts/usb_a9g20.dts | 30 +++++++++ arch/arm/mach-at91/Makefile.boot | 2 +- arch/arm/mach-at91/at91sam9260.c | 8 +++ arch/arm/mach-at91/board-dt.c | 1 + 5 files changed, 159 insertions(+), 1 deletions(-) create mode 100644 arch/arm/boot/dts/at91sam9g20.dtsi create mode 100644 arch/arm/boot/dts/usb_a9g20.dts diff --git a/arch/arm/boot/dts/at91sam9g20.dtsi b/arch/arm/boot/dts/at91sam9g20.dtsi new file mode 100644 index 0000000..aeef042 --- /dev/null +++ b/arch/arm/boot/dts/at91sam9g20.dtsi @@ -0,0 +1,119 @@ +/* + * at91sam9g20.dtsi - Device Tree Include file for AT91SAM9G20 family SoC + * + * Copyright (C) 2011 Atmel, + * 2011 Nicolas Ferre <nicolas.ferre@atmel.com>, + * 2011 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> + * + * Licensed under GPLv2 or later. + */ + +/include/ "skeleton.dtsi" + +/ { + model = "Atmel AT91SAM9G20 family SoC"; + compatible = "atmel,at91sam9g20"; + interrupt-parent = <&aic>; + + aliases { + serial0 = &dbgu; + serial1 = &usart0; + serial2 = &usart1; + serial3 = &usart2; + serial4 = &usart3; + serial5 = &usart4; + serial6 = &usart5; + }; + cpus { + cpu@0 { + compatible = "arm,arm926ejs"; + }; + }; + + memory@20000000 { + reg = <0x20000000 0x08000000>; + }; + + ahb { + compatible = "simple-bus"; + #address-cells = <1>; + #size-cells = <1>; + ranges; + + apb { + compatible = "simple-bus"; + #address-cells = <1>; + #size-cells = <1>; + ranges; + + aic: interrupt-controller@fffff000 { + #interrupt-cells = <1>; + compatible = "atmel,at91rm9200-aic"; + interrupt-controller; + interrupt-parent; + reg = <0xfffff000 0x200>; + }; + + dbgu: serial@fffff200 { + compatible = "atmel,at91sam9260-usart"; + reg = <0xfffff200 0x200>; + interrupts = <1>; + status = "disabled"; + }; + + usart0: serial@fffb0000 { + compatible = "atmel,at91sam9260-usart"; + reg = <0xfffb0000 0x200>; + interrupts = <6>; + atmel,use-dma-rx; + atmel,use-dma-tx; + status = "disabled"; + }; + + usart1: serial@fffb4000 { + compatible = "atmel,at91sam9260-usart"; + reg = <0xfffb4000 0x200>; + interrupts = <7>; + atmel,use-dma-rx; + atmel,use-dma-tx; + status = "disabled"; + }; + + usart2: serial@fffb8000 { + compatible = "atmel,at91sam9260-usart"; + reg = <0xfffb8000 0x200>; + interrupts = <8>; + atmel,use-dma-rx; + atmel,use-dma-tx; + status = "disabled"; + }; + + usart3: serial@fffd0000 { + compatible = "atmel,at91sam9260-usart"; + reg = <0xfffd0000 0x200>; + interrupts = <23>; + atmel,use-dma-rx; + atmel,use-dma-tx; + status = "disabled"; + }; + + usart4: serial@fffd4000 { + compatible = "atmel,at91sam9260-usart"; + reg = <0xfffd4000 0x200>; + interrupts = <24>; + atmel,use-dma-rx; + atmel,use-dma-tx; + status = "disabled"; + }; + + usart5: serial@fffd8000 { + compatible = "atmel,at91sam9260-usart"; + reg = <0xfffd8000 0x200>; + interrupts = <25>; + atmel,use-dma-rx; + atmel,use-dma-tx; + status = "disabled"; + }; + }; + }; +}; diff --git a/arch/arm/boot/dts/usb_a9g20.dts b/arch/arm/boot/dts/usb_a9g20.dts new file mode 100644 index 0000000..a060f6c --- /dev/null +++ b/arch/arm/boot/dts/usb_a9g20.dts @@ -0,0 +1,30 @@ +/* + * usb_a9g20.dts - Device Tree file for Caloa USB A9G20 board + * + * Copyright (C) 2011 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> + * + * Licensed under GPLv2 or later. + */ +/dts-v1/; +/include/ "at91sam9g20.dtsi" + +/ { + model = "Calao USB A9G20"; + compatible = "calao,usb-a9g20", "atmel,at91sam9g20", "atmel,at91sam9"; + + chosen { + bootargs = "mem=64M console=ttyS0,115200 mtdparts=atmel_nand:128k(at91bootstrap),256k(barebox)ro,128k(bareboxenv),128k(bareboxenv2),4M(kernel),120M(rootfs),-(data) root=/dev/mtdblock5 rw rootfstype=ubifs"; + }; + + memory@70000000 { + reg = <0x20000000 0x4000000>; + }; + + ahb { + apb { + dbgu: serial@fffff200 { + status = "okay"; + }; + }; + }; +}; diff --git a/arch/arm/mach-at91/Makefile.boot b/arch/arm/mach-at91/Makefile.boot index d278863..08c665a 100644 --- a/arch/arm/mach-at91/Makefile.boot +++ b/arch/arm/mach-at91/Makefile.boot @@ -17,4 +17,4 @@ params_phys-y := 0x20000100 initrd_phys-y := 0x20410000 endif -dtb-$(CONFIG_MACH_AT91SAM_DT) += at91sam9m10g45ek.dtb +dtb-$(CONFIG_MACH_AT91SAM_DT) += at91sam9m10g45ek.dtb usb_a9g20.dtb diff --git a/arch/arm/mach-at91/at91sam9260.c b/arch/arm/mach-at91/at91sam9260.c index cb397be..f4518b4 100644 --- a/arch/arm/mach-at91/at91sam9260.c +++ b/arch/arm/mach-at91/at91sam9260.c @@ -199,6 +199,14 @@ static struct clk_lookup periph_clocks_lookups[] = { CLKDEV_CON_DEV_ID("t4_clk", "atmel_tcb.1", &tc4_clk), CLKDEV_CON_DEV_ID("t5_clk", "atmel_tcb.1", &tc5_clk), CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc_clk), + /* more usart lookup table for DT entries */ + CLKDEV_CON_DEV_ID("usart", "fffff200.serial", &mck), + CLKDEV_CON_DEV_ID("usart", "fffb0000.serial", &usart0_clk), + CLKDEV_CON_DEV_ID("usart", "fffb4000.serial", &usart1_clk), + CLKDEV_CON_DEV_ID("usart", "fffb8000.serial", &usart2_clk), + CLKDEV_CON_DEV_ID("usart", "fffd0000.serial", &usart3_clk), + CLKDEV_CON_DEV_ID("usart", "fffd4000.serial", &usart4_clk), + CLKDEV_CON_DEV_ID("usart", "fffd8000.serial", &usart5_clk), }; static struct clk_lookup usart_clocks_lookups[] = { diff --git a/arch/arm/mach-at91/board-dt.c b/arch/arm/mach-at91/board-dt.c index 77fe466..a3d22f8 100644 --- a/arch/arm/mach-at91/board-dt.c +++ b/arch/arm/mach-at91/board-dt.c @@ -108,6 +108,7 @@ static void __init at91_dt_device_init(void) static const char *at91_dt_board_compat[] __initdata = { "atmel,at91sam9m10g45ek", + "calao,usb-a9g20", NULL }; -- 1.7.5.4 ^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH V3 (bugfix to fold)] ARM: at91: usb_a9g20.dts: fix memory location 2011-10-24 14:05 ` Nicolas Ferre (?) @ 2011-10-24 14:09 ` Nicolas Ferre -1 siblings, 0 replies; 49+ messages in thread From: Nicolas Ferre @ 2011-10-24 14:09 UTC (permalink / raw) To: linux-arm-kernel Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> --- arch/arm/boot/dts/usb_a9g20.dts | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/arch/arm/boot/dts/usb_a9g20.dts b/arch/arm/boot/dts/usb_a9g20.dts index a060f6c..d66e2c0 100644 --- a/arch/arm/boot/dts/usb_a9g20.dts +++ b/arch/arm/boot/dts/usb_a9g20.dts @@ -16,7 +16,7 @@ bootargs = "mem=64M console=ttyS0,115200 mtdparts=atmel_nand:128k(at91bootstrap),256k(barebox)ro,128k(bareboxenv),128k(bareboxenv2),4M(kernel),120M(rootfs),-(data) root=/dev/mtdblock5 rw rootfstype=ubifs"; }; - memory at 70000000 { + memory at 20000000 { reg = <0x20000000 0x4000000>; }; -- 1.7.5.4 ^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH V3 (bugfix to fold)] ARM: at91: usb_a9g20.dts: fix memory location @ 2011-10-24 14:09 ` Nicolas Ferre 0 siblings, 0 replies; 49+ messages in thread From: Nicolas Ferre @ 2011-10-24 14:09 UTC (permalink / raw) To: robherring2-Re5JQEeQqe8AvxtiuMwx3w, grant.likely-s3s/WqlpOiPyB63q8FvJNQ Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r Signed-off-by: Nicolas Ferre <nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org> --- arch/arm/boot/dts/usb_a9g20.dts | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/arch/arm/boot/dts/usb_a9g20.dts b/arch/arm/boot/dts/usb_a9g20.dts index a060f6c..d66e2c0 100644 --- a/arch/arm/boot/dts/usb_a9g20.dts +++ b/arch/arm/boot/dts/usb_a9g20.dts @@ -16,7 +16,7 @@ bootargs = "mem=64M console=ttyS0,115200 mtdparts=atmel_nand:128k(at91bootstrap),256k(barebox)ro,128k(bareboxenv),128k(bareboxenv2),4M(kernel),120M(rootfs),-(data) root=/dev/mtdblock5 rw rootfstype=ubifs"; }; - memory@70000000 { + memory@20000000 { reg = <0x20000000 0x4000000>; }; -- 1.7.5.4 ^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH V3 (bugfix to fold)] ARM: at91: usb_a9g20.dts: fix memory location @ 2011-10-24 14:09 ` Nicolas Ferre 0 siblings, 0 replies; 49+ messages in thread From: Nicolas Ferre @ 2011-10-24 14:09 UTC (permalink / raw) To: robherring2, grant.likely Cc: linux-kernel, linux-arm-kernel, devicetree-discuss, plagnioj, Nicolas Ferre Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> --- arch/arm/boot/dts/usb_a9g20.dts | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/arch/arm/boot/dts/usb_a9g20.dts b/arch/arm/boot/dts/usb_a9g20.dts index a060f6c..d66e2c0 100644 --- a/arch/arm/boot/dts/usb_a9g20.dts +++ b/arch/arm/boot/dts/usb_a9g20.dts @@ -16,7 +16,7 @@ bootargs = "mem=64M console=ttyS0,115200 mtdparts=atmel_nand:128k(at91bootstrap),256k(barebox)ro,128k(bareboxenv),128k(bareboxenv2),4M(kernel),120M(rootfs),-(data) root=/dev/mtdblock5 rw rootfstype=ubifs"; }; - memory@70000000 { + memory@20000000 { reg = <0x20000000 0x4000000>; }; -- 1.7.5.4 ^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH V3 2/2] ARM: at91: add at91sam9g20 and Calao USB A9G20 DT support 2011-10-24 14:05 ` Nicolas Ferre @ 2011-10-24 14:49 ` Rob Herring -1 siblings, 0 replies; 49+ messages in thread From: Rob Herring @ 2011-10-24 14:49 UTC (permalink / raw) To: linux-arm-kernel On 10/24/2011 09:05 AM, Nicolas Ferre wrote: > From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> > > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> > Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> > --- Looks good. Reviewed-by: Rob Herring <rob.herring@calxeda.com> Rob ^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH V3 2/2] ARM: at91: add at91sam9g20 and Calao USB A9G20 DT support @ 2011-10-24 14:49 ` Rob Herring 0 siblings, 0 replies; 49+ messages in thread From: Rob Herring @ 2011-10-24 14:49 UTC (permalink / raw) To: Nicolas Ferre Cc: grant.likely, linux-kernel, linux-arm-kernel, devicetree-discuss, plagnioj On 10/24/2011 09:05 AM, Nicolas Ferre wrote: > From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> > > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> > Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> > --- Looks good. Reviewed-by: Rob Herring <rob.herring@calxeda.com> Rob ^ permalink raw reply [flat|nested] 49+ messages in thread
* [PATCH V3 1/2] ARM: at91: dt: at91sam9g45 family and board device tree files 2011-10-24 14:05 ` Nicolas Ferre (?) @ 2011-10-24 14:12 ` Baruch Siach -1 siblings, 0 replies; 49+ messages in thread From: Baruch Siach @ 2011-10-24 14:12 UTC (permalink / raw) To: linux-arm-kernel Hi Nicolas, On Mon, Oct 24, 2011 at 04:05:00PM +0200, Nicolas Ferre wrote: > Create a new device tree source file for Atmel at91sam9g45 SoC family. > The Evaluation Kit at91sam9m10g45ek includes it. > This first basic support will be populated as drivers and boards will be > converted to device tree. > Contains serial, dma and interrupt controllers. > > The generic board file still takes advantage of platform data for early serial > init. As we need a storage media and the NAND flash driver is not converted to > DT yet, we keep old initialization for it. > > Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> > --- [snip] > +DT_MACHINE_START(at91sam9m10g45ek_dt, "Atmel AT91SAM (Device Tree)") Since this is a generic AT91 machine descriptor, won't "at91sam_dt" be a more appropriate name? > + /* Maintainer: Atmel */ > + .timer = &at91sam926x_timer, > + .map_io = at91_map_io, > + .init_early = ek_init_early, > + .init_irq = at91_dt_init_irq, > + .init_machine = at91_dt_device_init, > + .dt_compat = at91_dt_board_compat, > +MACHINE_END baruch -- ~. .~ Tk Open Systems =}------------------------------------------------ooO--U--Ooo------------{= - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il - ^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH V3 1/2] ARM: at91: dt: at91sam9g45 family and board device tree files @ 2011-10-24 14:12 ` Baruch Siach 0 siblings, 0 replies; 49+ messages in thread From: Baruch Siach @ 2011-10-24 14:12 UTC (permalink / raw) To: Nicolas Ferre Cc: devicetree-discuss, linux-kernel, grant.likely, plagnioj, linux-arm-kernel Hi Nicolas, On Mon, Oct 24, 2011 at 04:05:00PM +0200, Nicolas Ferre wrote: > Create a new device tree source file for Atmel at91sam9g45 SoC family. > The Evaluation Kit at91sam9m10g45ek includes it. > This first basic support will be populated as drivers and boards will be > converted to device tree. > Contains serial, dma and interrupt controllers. > > The generic board file still takes advantage of platform data for early serial > init. As we need a storage media and the NAND flash driver is not converted to > DT yet, we keep old initialization for it. > > Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> > --- [snip] > +DT_MACHINE_START(at91sam9m10g45ek_dt, "Atmel AT91SAM (Device Tree)") Since this is a generic AT91 machine descriptor, won't "at91sam_dt" be a more appropriate name? > + /* Maintainer: Atmel */ > + .timer = &at91sam926x_timer, > + .map_io = at91_map_io, > + .init_early = ek_init_early, > + .init_irq = at91_dt_init_irq, > + .init_machine = at91_dt_device_init, > + .dt_compat = at91_dt_board_compat, > +MACHINE_END baruch -- ~. .~ Tk Open Systems =}------------------------------------------------ooO--U--Ooo------------{= - baruch@tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il - ^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH V3 1/2] ARM: at91: dt: at91sam9g45 family and board device tree files @ 2011-10-24 14:12 ` Baruch Siach 0 siblings, 0 replies; 49+ messages in thread From: Baruch Siach @ 2011-10-24 14:12 UTC (permalink / raw) To: Nicolas Ferre Cc: robherring2, grant.likely, devicetree-discuss, plagnioj, linux-kernel, linux-arm-kernel Hi Nicolas, On Mon, Oct 24, 2011 at 04:05:00PM +0200, Nicolas Ferre wrote: > Create a new device tree source file for Atmel at91sam9g45 SoC family. > The Evaluation Kit at91sam9m10g45ek includes it. > This first basic support will be populated as drivers and boards will be > converted to device tree. > Contains serial, dma and interrupt controllers. > > The generic board file still takes advantage of platform data for early serial > init. As we need a storage media and the NAND flash driver is not converted to > DT yet, we keep old initialization for it. > > Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> > --- [snip] > +DT_MACHINE_START(at91sam9m10g45ek_dt, "Atmel AT91SAM (Device Tree)") Since this is a generic AT91 machine descriptor, won't "at91sam_dt" be a more appropriate name? > + /* Maintainer: Atmel */ > + .timer = &at91sam926x_timer, > + .map_io = at91_map_io, > + .init_early = ek_init_early, > + .init_irq = at91_dt_init_irq, > + .init_machine = at91_dt_device_init, > + .dt_compat = at91_dt_board_compat, > +MACHINE_END baruch -- ~. .~ Tk Open Systems =}------------------------------------------------ooO--U--Ooo------------{= - baruch@tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il - ^ permalink raw reply [flat|nested] 49+ messages in thread
* [PATCH V3 1/2] ARM: at91: dt: at91sam9g45 family and board device tree files 2011-10-24 14:12 ` Baruch Siach (?) @ 2011-10-24 14:32 ` Nicolas Ferre -1 siblings, 0 replies; 49+ messages in thread From: Nicolas Ferre @ 2011-10-24 14:32 UTC (permalink / raw) To: linux-arm-kernel On 10/24/2011 04:12 PM, Baruch Siach : > Hi Nicolas, > > On Mon, Oct 24, 2011 at 04:05:00PM +0200, Nicolas Ferre wrote: >> Create a new device tree source file for Atmel at91sam9g45 SoC family. >> The Evaluation Kit at91sam9m10g45ek includes it. >> This first basic support will be populated as drivers and boards will be >> converted to device tree. >> Contains serial, dma and interrupt controllers. >> >> The generic board file still takes advantage of platform data for early serial >> init. As we need a storage media and the NAND flash driver is not converted to >> DT yet, we keep old initialization for it. >> >> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> >> --- > > [snip] > >> +DT_MACHINE_START(at91sam9m10g45ek_dt, "Atmel AT91SAM (Device Tree)") > > Since this is a generic AT91 machine descriptor, won't "at91sam_dt" be a more > appropriate name? For sure that makes sense. I queue this change and make it appear only in the pull request if it is the only change requested. >> + /* Maintainer: Atmel */ >> + .timer = &at91sam926x_timer, >> + .map_io = at91_map_io, >> + .init_early = ek_init_early, >> + .init_irq = at91_dt_init_irq, >> + .init_machine = at91_dt_device_init, >> + .dt_compat = at91_dt_board_compat, >> +MACHINE_END > > baruch Thanks for your review, Best regards, -- Nicolas Ferre ^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH V3 1/2] ARM: at91: dt: at91sam9g45 family and board device tree files @ 2011-10-24 14:32 ` Nicolas Ferre 0 siblings, 0 replies; 49+ messages in thread From: Nicolas Ferre @ 2011-10-24 14:32 UTC (permalink / raw) To: Baruch Siach Cc: devicetree-discuss, linux-kernel, grant.likely, plagnioj, linux-arm-kernel On 10/24/2011 04:12 PM, Baruch Siach : > Hi Nicolas, > > On Mon, Oct 24, 2011 at 04:05:00PM +0200, Nicolas Ferre wrote: >> Create a new device tree source file for Atmel at91sam9g45 SoC family. >> The Evaluation Kit at91sam9m10g45ek includes it. >> This first basic support will be populated as drivers and boards will be >> converted to device tree. >> Contains serial, dma and interrupt controllers. >> >> The generic board file still takes advantage of platform data for early serial >> init. As we need a storage media and the NAND flash driver is not converted to >> DT yet, we keep old initialization for it. >> >> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> >> --- > > [snip] > >> +DT_MACHINE_START(at91sam9m10g45ek_dt, "Atmel AT91SAM (Device Tree)") > > Since this is a generic AT91 machine descriptor, won't "at91sam_dt" be a more > appropriate name? For sure that makes sense. I queue this change and make it appear only in the pull request if it is the only change requested. >> + /* Maintainer: Atmel */ >> + .timer = &at91sam926x_timer, >> + .map_io = at91_map_io, >> + .init_early = ek_init_early, >> + .init_irq = at91_dt_init_irq, >> + .init_machine = at91_dt_device_init, >> + .dt_compat = at91_dt_board_compat, >> +MACHINE_END > > baruch Thanks for your review, Best regards, -- Nicolas Ferre ^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH V3 1/2] ARM: at91: dt: at91sam9g45 family and board device tree files @ 2011-10-24 14:32 ` Nicolas Ferre 0 siblings, 0 replies; 49+ messages in thread From: Nicolas Ferre @ 2011-10-24 14:32 UTC (permalink / raw) To: Baruch Siach Cc: robherring2, grant.likely, devicetree-discuss, plagnioj, linux-kernel, linux-arm-kernel On 10/24/2011 04:12 PM, Baruch Siach : > Hi Nicolas, > > On Mon, Oct 24, 2011 at 04:05:00PM +0200, Nicolas Ferre wrote: >> Create a new device tree source file for Atmel at91sam9g45 SoC family. >> The Evaluation Kit at91sam9m10g45ek includes it. >> This first basic support will be populated as drivers and boards will be >> converted to device tree. >> Contains serial, dma and interrupt controllers. >> >> The generic board file still takes advantage of platform data for early serial >> init. As we need a storage media and the NAND flash driver is not converted to >> DT yet, we keep old initialization for it. >> >> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> >> --- > > [snip] > >> +DT_MACHINE_START(at91sam9m10g45ek_dt, "Atmel AT91SAM (Device Tree)") > > Since this is a generic AT91 machine descriptor, won't "at91sam_dt" be a more > appropriate name? For sure that makes sense. I queue this change and make it appear only in the pull request if it is the only change requested. >> + /* Maintainer: Atmel */ >> + .timer = &at91sam926x_timer, >> + .map_io = at91_map_io, >> + .init_early = ek_init_early, >> + .init_irq = at91_dt_init_irq, >> + .init_machine = at91_dt_device_init, >> + .dt_compat = at91_dt_board_compat, >> +MACHINE_END > > baruch Thanks for your review, Best regards, -- Nicolas Ferre ^ permalink raw reply [flat|nested] 49+ messages in thread
* [PATCH V3 1/2] ARM: at91: dt: at91sam9g45 family and board device tree files 2011-10-24 14:05 ` Nicolas Ferre (?) @ 2011-10-24 14:44 ` Rob Herring -1 siblings, 0 replies; 49+ messages in thread From: Rob Herring @ 2011-10-24 14:44 UTC (permalink / raw) To: linux-arm-kernel On 10/24/2011 09:05 AM, Nicolas Ferre wrote: > Create a new device tree source file for Atmel at91sam9g45 SoC family. > The Evaluation Kit at91sam9m10g45ek includes it. > This first basic support will be populated as drivers and boards will be > converted to device tree. > Contains serial, dma and interrupt controllers. > > The generic board file still takes advantage of platform data for early serial > init. As we need a storage media and the NAND flash driver is not converted to > DT yet, we keep old initialization for it. > This comment is out of date for serial. > Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> > --- > V3: > - additional clock lookup for device tree handling > - devices disabled in dtsi file so that only useful devices are > enabled in dts files > > V2: foundation for AT91SAM generic support > - device tree focused board file > - inclusion of USART DT support > - early USART and NAND still using platform data > Reviewed-by: Rob Herring <rob.herring@calxeda.com> Rob ^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH V3 1/2] ARM: at91: dt: at91sam9g45 family and board device tree files @ 2011-10-24 14:44 ` Rob Herring 0 siblings, 0 replies; 49+ messages in thread From: Rob Herring @ 2011-10-24 14:44 UTC (permalink / raw) To: Nicolas Ferre Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r On 10/24/2011 09:05 AM, Nicolas Ferre wrote: > Create a new device tree source file for Atmel at91sam9g45 SoC family. > The Evaluation Kit at91sam9m10g45ek includes it. > This first basic support will be populated as drivers and boards will be > converted to device tree. > Contains serial, dma and interrupt controllers. > > The generic board file still takes advantage of platform data for early serial > init. As we need a storage media and the NAND flash driver is not converted to > DT yet, we keep old initialization for it. > This comment is out of date for serial. > Signed-off-by: Nicolas Ferre <nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org> > --- > V3: > - additional clock lookup for device tree handling > - devices disabled in dtsi file so that only useful devices are > enabled in dts files > > V2: foundation for AT91SAM generic support > - device tree focused board file > - inclusion of USART DT support > - early USART and NAND still using platform data > Reviewed-by: Rob Herring <rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org> Rob ^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH V3 1/2] ARM: at91: dt: at91sam9g45 family and board device tree files @ 2011-10-24 14:44 ` Rob Herring 0 siblings, 0 replies; 49+ messages in thread From: Rob Herring @ 2011-10-24 14:44 UTC (permalink / raw) To: Nicolas Ferre Cc: grant.likely, linux-kernel, linux-arm-kernel, devicetree-discuss, plagnioj On 10/24/2011 09:05 AM, Nicolas Ferre wrote: > Create a new device tree source file for Atmel at91sam9g45 SoC family. > The Evaluation Kit at91sam9m10g45ek includes it. > This first basic support will be populated as drivers and boards will be > converted to device tree. > Contains serial, dma and interrupt controllers. > > The generic board file still takes advantage of platform data for early serial > init. As we need a storage media and the NAND flash driver is not converted to > DT yet, we keep old initialization for it. > This comment is out of date for serial. > Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> > --- > V3: > - additional clock lookup for device tree handling > - devices disabled in dtsi file so that only useful devices are > enabled in dts files > > V2: foundation for AT91SAM generic support > - device tree focused board file > - inclusion of USART DT support > - early USART and NAND still using platform data > Reviewed-by: Rob Herring <rob.herring@calxeda.com> Rob ^ permalink raw reply [flat|nested] 49+ messages in thread
* [PATCH V3 1/2] ARM: at91: dt: at91sam9g45 family and board device tree files 2011-10-24 14:44 ` Rob Herring (?) @ 2011-10-25 11:06 ` Nicolas Ferre -1 siblings, 0 replies; 49+ messages in thread From: Nicolas Ferre @ 2011-10-25 11:06 UTC (permalink / raw) To: linux-arm-kernel On 10/24/2011 04:44 PM, Rob Herring : > On 10/24/2011 09:05 AM, Nicolas Ferre wrote: >> Create a new device tree source file for Atmel at91sam9g45 SoC family. >> The Evaluation Kit at91sam9m10g45ek includes it. >> This first basic support will be populated as drivers and boards will be >> converted to device tree. >> Contains serial, dma and interrupt controllers. >> >> The generic board file still takes advantage of platform data for early serial >> init. As we need a storage media and the NAND flash driver is not converted to >> DT yet, we keep old initialization for it. >> > > This comment is out of date for serial. Well, not for early serial actually. >> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> >> --- >> V3: >> - additional clock lookup for device tree handling >> - devices disabled in dtsi file so that only useful devices are >> enabled in dts files >> >> V2: foundation for AT91SAM generic support >> - device tree focused board file >> - inclusion of USART DT support >> - early USART and NAND still using platform data >> > > Reviewed-by: Rob Herring <rob.herring@calxeda.com> Thanks Rob for your review. I send a pull request to Arnd on this material. Best regards, -- Nicolas Ferre ^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH V3 1/2] ARM: at91: dt: at91sam9g45 family and board device tree files @ 2011-10-25 11:06 ` Nicolas Ferre 0 siblings, 0 replies; 49+ messages in thread From: Nicolas Ferre @ 2011-10-25 11:06 UTC (permalink / raw) To: Rob Herring Cc: grant.likely, devicetree-discuss, plagnioj, linux-kernel, linux-arm-kernel On 10/24/2011 04:44 PM, Rob Herring : > On 10/24/2011 09:05 AM, Nicolas Ferre wrote: >> Create a new device tree source file for Atmel at91sam9g45 SoC family. >> The Evaluation Kit at91sam9m10g45ek includes it. >> This first basic support will be populated as drivers and boards will be >> converted to device tree. >> Contains serial, dma and interrupt controllers. >> >> The generic board file still takes advantage of platform data for early serial >> init. As we need a storage media and the NAND flash driver is not converted to >> DT yet, we keep old initialization for it. >> > > This comment is out of date for serial. Well, not for early serial actually. >> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> >> --- >> V3: >> - additional clock lookup for device tree handling >> - devices disabled in dtsi file so that only useful devices are >> enabled in dts files >> >> V2: foundation for AT91SAM generic support >> - device tree focused board file >> - inclusion of USART DT support >> - early USART and NAND still using platform data >> > > Reviewed-by: Rob Herring <rob.herring@calxeda.com> Thanks Rob for your review. I send a pull request to Arnd on this material. Best regards, -- Nicolas Ferre ^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH V3 1/2] ARM: at91: dt: at91sam9g45 family and board device tree files @ 2011-10-25 11:06 ` Nicolas Ferre 0 siblings, 0 replies; 49+ messages in thread From: Nicolas Ferre @ 2011-10-25 11:06 UTC (permalink / raw) To: Rob Herring Cc: grant.likely, linux-kernel, linux-arm-kernel, devicetree-discuss, plagnioj On 10/24/2011 04:44 PM, Rob Herring : > On 10/24/2011 09:05 AM, Nicolas Ferre wrote: >> Create a new device tree source file for Atmel at91sam9g45 SoC family. >> The Evaluation Kit at91sam9m10g45ek includes it. >> This first basic support will be populated as drivers and boards will be >> converted to device tree. >> Contains serial, dma and interrupt controllers. >> >> The generic board file still takes advantage of platform data for early serial >> init. As we need a storage media and the NAND flash driver is not converted to >> DT yet, we keep old initialization for it. >> > > This comment is out of date for serial. Well, not for early serial actually. >> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> >> --- >> V3: >> - additional clock lookup for device tree handling >> - devices disabled in dtsi file so that only useful devices are >> enabled in dts files >> >> V2: foundation for AT91SAM generic support >> - device tree focused board file >> - inclusion of USART DT support >> - early USART and NAND still using platform data >> > > Reviewed-by: Rob Herring <rob.herring@calxeda.com> Thanks Rob for your review. I send a pull request to Arnd on this material. Best regards, -- Nicolas Ferre ^ permalink raw reply [flat|nested] 49+ messages in thread
* [PATCH V2] AT91: dt: at91sam9g45 family and board device tree files 2011-10-18 10:07 ` Nicolas Ferre @ 2011-10-24 14:34 ` Grant Likely -1 siblings, 0 replies; 49+ messages in thread From: Grant Likely @ 2011-10-24 14:34 UTC (permalink / raw) To: linux-arm-kernel On Tue, Oct 18, 2011 at 12:07:17PM +0200, Nicolas Ferre wrote: > On 10/07/2011 02:56 PM, Nicolas Ferre : > > On 10/05/2011 03:00 PM, Rob Herring : > >> Nicolas, > >> > >> On 10/03/2011 05:00 AM, Nicolas Ferre wrote: > >>> Create a new device tree source file for Atmel at91sam9g45 SoC family. > >>> The Evaluation Kit at91sam9m10g45ek includes it. > >>> This first basic support will be populated as drivers and boards will be > >>> converted to device tree. > >>> Contains serial, dma and interrupt controllers. > >>> > >>> The generic board file still takes advantage of platform data for early serial > >>> init. As we need a storage media and the NAND flash driver is not converted to > >>> DT yet, we keep old initialization for it. > >>> > >>> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> > > [..] > > >>> diff --git a/arch/arm/mach-at91/board-dt.c b/arch/arm/mach-at91/board-dt.c > >>> new file mode 100644 > >>> index 0000000..7bcb9a9 > >>> --- /dev/null > >>> +++ b/arch/arm/mach-at91/board-dt.c > >>> @@ -0,0 +1,122 @@ > >>> +/* > >>> + * Setup code for AT91SAM Evaluation Kits with Device Tree support > >>> + * > >>> + * Covers: * AT91SAM9G45-EKES board > >>> + * * AT91SAM9M10-EKES board > >>> + * * AT91SAM9M10G45-EK board > >>> + * > >>> + * Copyright (C) 2011 Atmel, > >>> + * 2011 Nicolas Ferre <nicolas.ferre@atmel.com> > >>> + * > >>> + * Licensed under GPLv2 or later. > >>> + */ > >>> + > >>> +#include <linux/types.h> > >>> +#include <linux/init.h> > >>> +#include <linux/module.h> > >>> +#include <linux/irqdomain.h> > >>> +#include <linux/of_irq.h> > >>> +#include <linux/of_platform.h> > >>> + > >>> +#include <mach/hardware.h> > >>> +#include <mach/board.h> > >>> +#include <mach/gpio.h> > >>> +#include <mach/system_rev.h> > >>> +#include <mach/at91sam9_smc.h> > >>> + > >>> +#include <asm/setup.h> > >>> +#include <asm/irq.h> > >>> +#include <asm/mach/arch.h> > >>> +#include <asm/mach/map.h> > >>> +#include <asm/mach/irq.h> > >>> + > >>> +#include "sam9_smc.h" > >>> +#include "generic.h" > > As found by Jean-Christophe, it seems that some clock lookup data are missing here. Something like: > > +/* > + * Lookup table for attaching a specific name and platform_data pointer to > + * devices as they get created by of_platform_populate(). Ideally this table > + * would not exist, but the current clock implementation depends on some devices > + * having a specific name. > + / > +static const struct of_dev_auxdata at91_auxdata_lookup[] __initconst = { > + / at91sam9260/ at91sam9g20 / > + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffff200, "atmel_usart.0", NULL), > + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffb0000, "atmel_usart.1", NULL), > + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffb4000, "atmel_usart.2", NULL), > + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffb8000, "atmel_usart.3", NULL), > + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffd0000, "atmel_usart.4", NULL), > + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffd4000, "atmel_usart.5", NULL), > + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffd8000, "atmel_usart.6", NULL), > + / at91sam9g45*/ > + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xffffee00, "atmel_usart.0", NULL), > + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfff8c000, "atmel_usart.1", NULL), > + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfff90000, "atmel_usart.2", NULL), > + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfff94000, "atmel_usart.3", NULL), > + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfff98000, "atmel_usart.4", NULL), > + { /* sentinel */ } > +}; > > With a change here: > of_platform_populate(NULL, of_default_bus_match_table, at91_auxdata_lookup, NULL); > > I know that it is a temporary usage of auxdata. Does it sound the right thing to do for the moment? yes. g. ^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH V2] AT91: dt: at91sam9g45 family and board device tree files @ 2011-10-24 14:34 ` Grant Likely 0 siblings, 0 replies; 49+ messages in thread From: Grant Likely @ 2011-10-24 14:34 UTC (permalink / raw) To: Nicolas Ferre Cc: Rob Herring, devicetree-discuss, Jean-Christophe PLAGNIOL-VILLARD, linux-kernel, linux-arm-kernel On Tue, Oct 18, 2011 at 12:07:17PM +0200, Nicolas Ferre wrote: > On 10/07/2011 02:56 PM, Nicolas Ferre : > > On 10/05/2011 03:00 PM, Rob Herring : > >> Nicolas, > >> > >> On 10/03/2011 05:00 AM, Nicolas Ferre wrote: > >>> Create a new device tree source file for Atmel at91sam9g45 SoC family. > >>> The Evaluation Kit at91sam9m10g45ek includes it. > >>> This first basic support will be populated as drivers and boards will be > >>> converted to device tree. > >>> Contains serial, dma and interrupt controllers. > >>> > >>> The generic board file still takes advantage of platform data for early serial > >>> init. As we need a storage media and the NAND flash driver is not converted to > >>> DT yet, we keep old initialization for it. > >>> > >>> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> > > [..] > > >>> diff --git a/arch/arm/mach-at91/board-dt.c b/arch/arm/mach-at91/board-dt.c > >>> new file mode 100644 > >>> index 0000000..7bcb9a9 > >>> --- /dev/null > >>> +++ b/arch/arm/mach-at91/board-dt.c > >>> @@ -0,0 +1,122 @@ > >>> +/* > >>> + * Setup code for AT91SAM Evaluation Kits with Device Tree support > >>> + * > >>> + * Covers: * AT91SAM9G45-EKES board > >>> + * * AT91SAM9M10-EKES board > >>> + * * AT91SAM9M10G45-EK board > >>> + * > >>> + * Copyright (C) 2011 Atmel, > >>> + * 2011 Nicolas Ferre <nicolas.ferre@atmel.com> > >>> + * > >>> + * Licensed under GPLv2 or later. > >>> + */ > >>> + > >>> +#include <linux/types.h> > >>> +#include <linux/init.h> > >>> +#include <linux/module.h> > >>> +#include <linux/irqdomain.h> > >>> +#include <linux/of_irq.h> > >>> +#include <linux/of_platform.h> > >>> + > >>> +#include <mach/hardware.h> > >>> +#include <mach/board.h> > >>> +#include <mach/gpio.h> > >>> +#include <mach/system_rev.h> > >>> +#include <mach/at91sam9_smc.h> > >>> + > >>> +#include <asm/setup.h> > >>> +#include <asm/irq.h> > >>> +#include <asm/mach/arch.h> > >>> +#include <asm/mach/map.h> > >>> +#include <asm/mach/irq.h> > >>> + > >>> +#include "sam9_smc.h" > >>> +#include "generic.h" > > As found by Jean-Christophe, it seems that some clock lookup data are missing here. Something like: > > +/* > + * Lookup table for attaching a specific name and platform_data pointer to > + * devices as they get created by of_platform_populate(). Ideally this table > + * would not exist, but the current clock implementation depends on some devices > + * having a specific name. > + / > +static const struct of_dev_auxdata at91_auxdata_lookup[] __initconst = { > + / at91sam9260/ at91sam9g20 / > + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffff200, "atmel_usart.0", NULL), > + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffb0000, "atmel_usart.1", NULL), > + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffb4000, "atmel_usart.2", NULL), > + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffb8000, "atmel_usart.3", NULL), > + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffd0000, "atmel_usart.4", NULL), > + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffd4000, "atmel_usart.5", NULL), > + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffd8000, "atmel_usart.6", NULL), > + / at91sam9g45*/ > + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xffffee00, "atmel_usart.0", NULL), > + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfff8c000, "atmel_usart.1", NULL), > + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfff90000, "atmel_usart.2", NULL), > + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfff94000, "atmel_usart.3", NULL), > + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfff98000, "atmel_usart.4", NULL), > + { /* sentinel */ } > +}; > > With a change here: > of_platform_populate(NULL, of_default_bus_match_table, at91_auxdata_lookup, NULL); > > I know that it is a temporary usage of auxdata. Does it sound the right thing to do for the moment? yes. g. ^ permalink raw reply [flat|nested] 49+ messages in thread
* [PATCH V2] AT91: dt: at91sam9g45 family and board device tree files 2011-10-24 14:34 ` Grant Likely (?) @ 2011-10-24 14:42 ` Nicolas Ferre -1 siblings, 0 replies; 49+ messages in thread From: Nicolas Ferre @ 2011-10-24 14:42 UTC (permalink / raw) To: linux-arm-kernel On 10/24/2011 04:34 PM, Grant Likely : > On Tue, Oct 18, 2011 at 12:07:17PM +0200, Nicolas Ferre wrote: >> On 10/07/2011 02:56 PM, Nicolas Ferre : >>> On 10/05/2011 03:00 PM, Rob Herring : >>>> Nicolas, >>>> >>>> On 10/03/2011 05:00 AM, Nicolas Ferre wrote: >>>>> Create a new device tree source file for Atmel at91sam9g45 SoC family. >>>>> The Evaluation Kit at91sam9m10g45ek includes it. >>>>> This first basic support will be populated as drivers and boards will be >>>>> converted to device tree. >>>>> Contains serial, dma and interrupt controllers. >>>>> >>>>> The generic board file still takes advantage of platform data for early serial >>>>> init. As we need a storage media and the NAND flash driver is not converted to >>>>> DT yet, we keep old initialization for it. >>>>> >>>>> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> >> >> [..] >> >>>>> diff --git a/arch/arm/mach-at91/board-dt.c b/arch/arm/mach-at91/board-dt.c >>>>> new file mode 100644 >>>>> index 0000000..7bcb9a9 >>>>> --- /dev/null >>>>> +++ b/arch/arm/mach-at91/board-dt.c >>>>> @@ -0,0 +1,122 @@ >>>>> +/* >>>>> + * Setup code for AT91SAM Evaluation Kits with Device Tree support >>>>> + * >>>>> + * Covers: * AT91SAM9G45-EKES board >>>>> + * * AT91SAM9M10-EKES board >>>>> + * * AT91SAM9M10G45-EK board >>>>> + * >>>>> + * Copyright (C) 2011 Atmel, >>>>> + * 2011 Nicolas Ferre <nicolas.ferre@atmel.com> >>>>> + * >>>>> + * Licensed under GPLv2 or later. >>>>> + */ >>>>> + >>>>> +#include <linux/types.h> >>>>> +#include <linux/init.h> >>>>> +#include <linux/module.h> >>>>> +#include <linux/irqdomain.h> >>>>> +#include <linux/of_irq.h> >>>>> +#include <linux/of_platform.h> >>>>> + >>>>> +#include <mach/hardware.h> >>>>> +#include <mach/board.h> >>>>> +#include <mach/gpio.h> >>>>> +#include <mach/system_rev.h> >>>>> +#include <mach/at91sam9_smc.h> >>>>> + >>>>> +#include <asm/setup.h> >>>>> +#include <asm/irq.h> >>>>> +#include <asm/mach/arch.h> >>>>> +#include <asm/mach/map.h> >>>>> +#include <asm/mach/irq.h> >>>>> + >>>>> +#include "sam9_smc.h" >>>>> +#include "generic.h" >> >> As found by Jean-Christophe, it seems that some clock lookup data are missing here. Something like: >> >> +/* >> + * Lookup table for attaching a specific name and platform_data pointer to >> + * devices as they get created by of_platform_populate(). Ideally this table >> + * would not exist, but the current clock implementation depends on some devices >> + * having a specific name. >> + / >> +static const struct of_dev_auxdata at91_auxdata_lookup[] __initconst = { >> + / at91sam9260/ at91sam9g20 / >> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffff200, "atmel_usart.0", NULL), >> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffb0000, "atmel_usart.1", NULL), >> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffb4000, "atmel_usart.2", NULL), >> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffb8000, "atmel_usart.3", NULL), >> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffd0000, "atmel_usart.4", NULL), >> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffd4000, "atmel_usart.5", NULL), >> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffd8000, "atmel_usart.6", NULL), >> + / at91sam9g45*/ >> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xffffee00, "atmel_usart.0", NULL), >> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfff8c000, "atmel_usart.1", NULL), >> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfff90000, "atmel_usart.2", NULL), >> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfff94000, "atmel_usart.3", NULL), >> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfff98000, "atmel_usart.4", NULL), >> + { /* sentinel */ } >> +}; >> >> With a change here: >> of_platform_populate(NULL, of_default_bus_match_table, at91_auxdata_lookup, NULL); >> >> I know that it is a temporary usage of auxdata. Does it sound the right thing to do for the moment? > > yes. Grant, It seems that Rob has had another idea. He advices me (on a Oct. 20th email) that I should add some clock lookup entries. That is what I did in a couple of patches that I have just sent some minutes ago... I tend to like the clock lookup adding more as it prevent the adding of big amount of code into the board-dt.c file. What is the preferred option? Are you fine with patches that I have just sent? Thanks, Best regards, -- Nicolas Ferre ^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH V2] AT91: dt: at91sam9g45 family and board device tree files @ 2011-10-24 14:42 ` Nicolas Ferre 0 siblings, 0 replies; 49+ messages in thread From: Nicolas Ferre @ 2011-10-24 14:42 UTC (permalink / raw) To: Grant Likely Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r On 10/24/2011 04:34 PM, Grant Likely : > On Tue, Oct 18, 2011 at 12:07:17PM +0200, Nicolas Ferre wrote: >> On 10/07/2011 02:56 PM, Nicolas Ferre : >>> On 10/05/2011 03:00 PM, Rob Herring : >>>> Nicolas, >>>> >>>> On 10/03/2011 05:00 AM, Nicolas Ferre wrote: >>>>> Create a new device tree source file for Atmel at91sam9g45 SoC family. >>>>> The Evaluation Kit at91sam9m10g45ek includes it. >>>>> This first basic support will be populated as drivers and boards will be >>>>> converted to device tree. >>>>> Contains serial, dma and interrupt controllers. >>>>> >>>>> The generic board file still takes advantage of platform data for early serial >>>>> init. As we need a storage media and the NAND flash driver is not converted to >>>>> DT yet, we keep old initialization for it. >>>>> >>>>> Signed-off-by: Nicolas Ferre <nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org> >> >> [..] >> >>>>> diff --git a/arch/arm/mach-at91/board-dt.c b/arch/arm/mach-at91/board-dt.c >>>>> new file mode 100644 >>>>> index 0000000..7bcb9a9 >>>>> --- /dev/null >>>>> +++ b/arch/arm/mach-at91/board-dt.c >>>>> @@ -0,0 +1,122 @@ >>>>> +/* >>>>> + * Setup code for AT91SAM Evaluation Kits with Device Tree support >>>>> + * >>>>> + * Covers: * AT91SAM9G45-EKES board >>>>> + * * AT91SAM9M10-EKES board >>>>> + * * AT91SAM9M10G45-EK board >>>>> + * >>>>> + * Copyright (C) 2011 Atmel, >>>>> + * 2011 Nicolas Ferre <nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org> >>>>> + * >>>>> + * Licensed under GPLv2 or later. >>>>> + */ >>>>> + >>>>> +#include <linux/types.h> >>>>> +#include <linux/init.h> >>>>> +#include <linux/module.h> >>>>> +#include <linux/irqdomain.h> >>>>> +#include <linux/of_irq.h> >>>>> +#include <linux/of_platform.h> >>>>> + >>>>> +#include <mach/hardware.h> >>>>> +#include <mach/board.h> >>>>> +#include <mach/gpio.h> >>>>> +#include <mach/system_rev.h> >>>>> +#include <mach/at91sam9_smc.h> >>>>> + >>>>> +#include <asm/setup.h> >>>>> +#include <asm/irq.h> >>>>> +#include <asm/mach/arch.h> >>>>> +#include <asm/mach/map.h> >>>>> +#include <asm/mach/irq.h> >>>>> + >>>>> +#include "sam9_smc.h" >>>>> +#include "generic.h" >> >> As found by Jean-Christophe, it seems that some clock lookup data are missing here. Something like: >> >> +/* >> + * Lookup table for attaching a specific name and platform_data pointer to >> + * devices as they get created by of_platform_populate(). Ideally this table >> + * would not exist, but the current clock implementation depends on some devices >> + * having a specific name. >> + / >> +static const struct of_dev_auxdata at91_auxdata_lookup[] __initconst = { >> + / at91sam9260/ at91sam9g20 / >> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffff200, "atmel_usart.0", NULL), >> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffb0000, "atmel_usart.1", NULL), >> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffb4000, "atmel_usart.2", NULL), >> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffb8000, "atmel_usart.3", NULL), >> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffd0000, "atmel_usart.4", NULL), >> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffd4000, "atmel_usart.5", NULL), >> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffd8000, "atmel_usart.6", NULL), >> + / at91sam9g45*/ >> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xffffee00, "atmel_usart.0", NULL), >> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfff8c000, "atmel_usart.1", NULL), >> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfff90000, "atmel_usart.2", NULL), >> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfff94000, "atmel_usart.3", NULL), >> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfff98000, "atmel_usart.4", NULL), >> + { /* sentinel */ } >> +}; >> >> With a change here: >> of_platform_populate(NULL, of_default_bus_match_table, at91_auxdata_lookup, NULL); >> >> I know that it is a temporary usage of auxdata. Does it sound the right thing to do for the moment? > > yes. Grant, It seems that Rob has had another idea. He advices me (on a Oct. 20th email) that I should add some clock lookup entries. That is what I did in a couple of patches that I have just sent some minutes ago... I tend to like the clock lookup adding more as it prevent the adding of big amount of code into the board-dt.c file. What is the preferred option? Are you fine with patches that I have just sent? Thanks, Best regards, -- Nicolas Ferre ^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH V2] AT91: dt: at91sam9g45 family and board device tree files @ 2011-10-24 14:42 ` Nicolas Ferre 0 siblings, 0 replies; 49+ messages in thread From: Nicolas Ferre @ 2011-10-24 14:42 UTC (permalink / raw) To: Grant Likely Cc: Rob Herring, devicetree-discuss, Jean-Christophe PLAGNIOL-VILLARD, linux-kernel, linux-arm-kernel On 10/24/2011 04:34 PM, Grant Likely : > On Tue, Oct 18, 2011 at 12:07:17PM +0200, Nicolas Ferre wrote: >> On 10/07/2011 02:56 PM, Nicolas Ferre : >>> On 10/05/2011 03:00 PM, Rob Herring : >>>> Nicolas, >>>> >>>> On 10/03/2011 05:00 AM, Nicolas Ferre wrote: >>>>> Create a new device tree source file for Atmel at91sam9g45 SoC family. >>>>> The Evaluation Kit at91sam9m10g45ek includes it. >>>>> This first basic support will be populated as drivers and boards will be >>>>> converted to device tree. >>>>> Contains serial, dma and interrupt controllers. >>>>> >>>>> The generic board file still takes advantage of platform data for early serial >>>>> init. As we need a storage media and the NAND flash driver is not converted to >>>>> DT yet, we keep old initialization for it. >>>>> >>>>> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> >> >> [..] >> >>>>> diff --git a/arch/arm/mach-at91/board-dt.c b/arch/arm/mach-at91/board-dt.c >>>>> new file mode 100644 >>>>> index 0000000..7bcb9a9 >>>>> --- /dev/null >>>>> +++ b/arch/arm/mach-at91/board-dt.c >>>>> @@ -0,0 +1,122 @@ >>>>> +/* >>>>> + * Setup code for AT91SAM Evaluation Kits with Device Tree support >>>>> + * >>>>> + * Covers: * AT91SAM9G45-EKES board >>>>> + * * AT91SAM9M10-EKES board >>>>> + * * AT91SAM9M10G45-EK board >>>>> + * >>>>> + * Copyright (C) 2011 Atmel, >>>>> + * 2011 Nicolas Ferre <nicolas.ferre@atmel.com> >>>>> + * >>>>> + * Licensed under GPLv2 or later. >>>>> + */ >>>>> + >>>>> +#include <linux/types.h> >>>>> +#include <linux/init.h> >>>>> +#include <linux/module.h> >>>>> +#include <linux/irqdomain.h> >>>>> +#include <linux/of_irq.h> >>>>> +#include <linux/of_platform.h> >>>>> + >>>>> +#include <mach/hardware.h> >>>>> +#include <mach/board.h> >>>>> +#include <mach/gpio.h> >>>>> +#include <mach/system_rev.h> >>>>> +#include <mach/at91sam9_smc.h> >>>>> + >>>>> +#include <asm/setup.h> >>>>> +#include <asm/irq.h> >>>>> +#include <asm/mach/arch.h> >>>>> +#include <asm/mach/map.h> >>>>> +#include <asm/mach/irq.h> >>>>> + >>>>> +#include "sam9_smc.h" >>>>> +#include "generic.h" >> >> As found by Jean-Christophe, it seems that some clock lookup data are missing here. Something like: >> >> +/* >> + * Lookup table for attaching a specific name and platform_data pointer to >> + * devices as they get created by of_platform_populate(). Ideally this table >> + * would not exist, but the current clock implementation depends on some devices >> + * having a specific name. >> + / >> +static const struct of_dev_auxdata at91_auxdata_lookup[] __initconst = { >> + / at91sam9260/ at91sam9g20 / >> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffff200, "atmel_usart.0", NULL), >> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffb0000, "atmel_usart.1", NULL), >> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffb4000, "atmel_usart.2", NULL), >> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffb8000, "atmel_usart.3", NULL), >> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffd0000, "atmel_usart.4", NULL), >> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffd4000, "atmel_usart.5", NULL), >> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfffd8000, "atmel_usart.6", NULL), >> + / at91sam9g45*/ >> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xffffee00, "atmel_usart.0", NULL), >> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfff8c000, "atmel_usart.1", NULL), >> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfff90000, "atmel_usart.2", NULL), >> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfff94000, "atmel_usart.3", NULL), >> + OF_DEV_AUXDATA("atmel,at91sam9260-usart", 0xfff98000, "atmel_usart.4", NULL), >> + { /* sentinel */ } >> +}; >> >> With a change here: >> of_platform_populate(NULL, of_default_bus_match_table, at91_auxdata_lookup, NULL); >> >> I know that it is a temporary usage of auxdata. Does it sound the right thing to do for the moment? > > yes. Grant, It seems that Rob has had another idea. He advices me (on a Oct. 20th email) that I should add some clock lookup entries. That is what I did in a couple of patches that I have just sent some minutes ago... I tend to like the clock lookup adding more as it prevent the adding of big amount of code into the board-dt.c file. What is the preferred option? Are you fine with patches that I have just sent? Thanks, Best regards, -- Nicolas Ferre ^ permalink raw reply [flat|nested] 49+ messages in thread
end of thread, other threads:[~2011-10-25 11:07 UTC | newest] Thread overview: 49+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2011-10-03 10:00 [PATCH V2] AT91: dt: at91sam9g45 family and board device tree files Nicolas Ferre 2011-10-03 10:00 ` Nicolas Ferre 2011-10-03 10:00 ` Nicolas Ferre 2011-10-03 8:52 ` Russell King - ARM Linux 2011-10-03 8:52 ` Russell King - ARM Linux 2011-10-03 8:52 ` Russell King - ARM Linux 2011-10-05 13:00 ` Rob Herring 2011-10-05 13:00 ` Rob Herring 2011-10-05 13:00 ` Rob Herring 2011-10-07 12:56 ` Nicolas Ferre 2011-10-07 12:56 ` Nicolas Ferre 2011-10-07 12:56 ` Nicolas Ferre 2011-10-18 10:07 ` Nicolas Ferre 2011-10-18 10:07 ` Nicolas Ferre 2011-10-18 20:44 ` Rob Herring 2011-10-18 20:44 ` Rob Herring 2011-10-19 8:03 ` Nicolas Ferre 2011-10-19 8:03 ` Nicolas Ferre 2011-10-20 2:06 ` Rob Herring 2011-10-20 2:06 ` Rob Herring 2011-10-20 2:06 ` Rob Herring 2011-10-24 14:05 ` [PATCH V3 1/2] ARM: at91: " Nicolas Ferre 2011-10-24 14:05 ` Nicolas Ferre 2011-10-24 14:05 ` Nicolas Ferre 2011-10-24 14:05 ` [PATCH V3 2/2] ARM: at91: add at91sam9g20 and Calao USB A9G20 DT support Nicolas Ferre 2011-10-24 14:05 ` Nicolas Ferre 2011-10-24 14:05 ` Nicolas Ferre 2011-10-24 14:09 ` [PATCH V3 (bugfix to fold)] ARM: at91: usb_a9g20.dts: fix memory location Nicolas Ferre 2011-10-24 14:09 ` Nicolas Ferre 2011-10-24 14:09 ` Nicolas Ferre 2011-10-24 14:49 ` [PATCH V3 2/2] ARM: at91: add at91sam9g20 and Calao USB A9G20 DT support Rob Herring 2011-10-24 14:49 ` Rob Herring 2011-10-24 14:12 ` [PATCH V3 1/2] ARM: at91: dt: at91sam9g45 family and board device tree files Baruch Siach 2011-10-24 14:12 ` Baruch Siach 2011-10-24 14:12 ` Baruch Siach 2011-10-24 14:32 ` Nicolas Ferre 2011-10-24 14:32 ` Nicolas Ferre 2011-10-24 14:32 ` Nicolas Ferre 2011-10-24 14:44 ` Rob Herring 2011-10-24 14:44 ` Rob Herring 2011-10-24 14:44 ` Rob Herring 2011-10-25 11:06 ` Nicolas Ferre 2011-10-25 11:06 ` Nicolas Ferre 2011-10-25 11:06 ` Nicolas Ferre 2011-10-24 14:34 ` [PATCH V2] AT91: " Grant Likely 2011-10-24 14:34 ` Grant Likely 2011-10-24 14:42 ` Nicolas Ferre 2011-10-24 14:42 ` Nicolas Ferre 2011-10-24 14:42 ` Nicolas Ferre
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.