aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-at91
diff options
context:
space:
mode:
authorNicolas Ferre <nicolas.ferre@atmel.com>2011-10-10 12:29:24 -0400
committerNicolas Ferre <nicolas.ferre@atmel.com>2011-10-25 07:08:21 -0400
commit49fe2ba3138ca60422fd90ed76c1918be1c30fc0 (patch)
tree706cfe55a2e796ec304cd7ff4c9670e95f2b9402 /arch/arm/mach-at91
parentc3b92c8787367a8bb53d57d9789b558f1295cc96 (diff)
ARM: at91: dt: at91sam9g45 family and board device tree files
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> Reviewed-by: Rob Herring <rob.herring@calxeda.com>
Diffstat (limited to 'arch/arm/mach-at91')
-rw-r--r--arch/arm/mach-at91/Kconfig11
-rw-r--r--arch/arm/mach-at91/Makefile3
-rw-r--r--arch/arm/mach-at91/Makefile.boot2
-rw-r--r--arch/arm/mach-at91/at91sam9g45.c6
-rw-r--r--arch/arm/mach-at91/board-dt.c122
5 files changed, 144 insertions, 0 deletions
diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index 22484670e7ba..4b59d96e1cd8 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -442,6 +442,17 @@ endif
442 442
443# ---------------------------------------------------------- 443# ----------------------------------------------------------
444 444
445comment "Generic Board Type"
446
447config MACH_AT91SAM_DT
448 bool "Atmel AT91SAM Evaluation Kits with device-tree support"
449 select USE_OF
450 help
451 Select this if you want to experiment device-tree with
452 an Atmel Evaluation Kit.
453
454# ----------------------------------------------------------
455
445comment "AT91 Board Options" 456comment "AT91 Board Options"
446 457
447config MTD_AT91_DATAFLASH_CARD 458config MTD_AT91_DATAFLASH_CARD
diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile
index bf57e8b1c9d0..3ff245ebcad1 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
74# AT91SAM9G45 board-specific support 74# AT91SAM9G45 board-specific support
75obj-$(CONFIG_MACH_AT91SAM9M10G45EK) += board-sam9m10g45ek.o 75obj-$(CONFIG_MACH_AT91SAM9M10G45EK) += board-sam9m10g45ek.o
76 76
77# AT91SAM board with device-tree
78obj-$(CONFIG_MACH_AT91SAM_DT) += board-dt.o
79
77# AT91CAP9 board-specific support 80# AT91CAP9 board-specific support
78obj-$(CONFIG_MACH_AT91CAP9ADK) += board-cap9adk.o 81obj-$(CONFIG_MACH_AT91CAP9ADK) += board-cap9adk.o
79 82
diff --git a/arch/arm/mach-at91/Makefile.boot b/arch/arm/mach-at91/Makefile.boot
index 3462b815054a..d2788636805c 100644
--- a/arch/arm/mach-at91/Makefile.boot
+++ b/arch/arm/mach-at91/Makefile.boot
@@ -16,3 +16,5 @@ else
16params_phys-y := 0x20000100 16params_phys-y := 0x20000100
17initrd_phys-y := 0x20410000 17initrd_phys-y := 0x20410000
18endif 18endif
19
20dtb-$(CONFIG_MACH_AT91SAM_DT) += at91sam9m10g45ek.dtb
diff --git a/arch/arm/mach-at91/at91sam9g45.c b/arch/arm/mach-at91/at91sam9g45.c
index e04c5fb6f1ee..8baf5a1ed167 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[] = {
215 CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.1", &tcb0_clk), 215 CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.1", &tcb0_clk),
216 CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc0_clk), 216 CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc0_clk),
217 CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk), 217 CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk),
218 /* more usart lookup table for DT entries */
219 CLKDEV_CON_DEV_ID("usart", "ffffee00.serial", &mck),
220 CLKDEV_CON_DEV_ID("usart", "fff8c000.serial", &usart0_clk),
221 CLKDEV_CON_DEV_ID("usart", "fff90000.serial", &usart1_clk),
222 CLKDEV_CON_DEV_ID("usart", "fff94000.serial", &usart2_clk),
223 CLKDEV_CON_DEV_ID("usart", "fff98000.serial", &usart3_clk),
218}; 224};
219 225
220static struct clk_lookup usart_clocks_lookups[] = { 226static 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 000000000000..33a0d8b549b4
--- /dev/null
+++ b/arch/arm/mach-at91/board-dt.c
@@ -0,0 +1,122 @@
1/*
2 * Setup code for AT91SAM Evaluation Kits with Device Tree support
3 *
4 * Covers: * AT91SAM9G45-EKES board
5 * * AT91SAM9M10-EKES board
6 * * AT91SAM9M10G45-EK board
7 *
8 * Copyright (C) 2011 Atmel,
9 * 2011 Nicolas Ferre <nicolas.ferre@atmel.com>
10 *
11 * Licensed under GPLv2 or later.
12 */
13
14#include <linux/types.h>
15#include <linux/init.h>
16#include <linux/module.h>
17#include <linux/gpio.h>
18#include <linux/irqdomain.h>
19#include <linux/of_irq.h>
20#include <linux/of_platform.h>
21
22#include <mach/hardware.h>
23#include <mach/board.h>
24#include <mach/system_rev.h>
25#include <mach/at91sam9_smc.h>
26
27#include <asm/setup.h>
28#include <asm/irq.h>
29#include <asm/mach/arch.h>
30#include <asm/mach/map.h>
31#include <asm/mach/irq.h>
32
33#include "sam9_smc.h"
34#include "generic.h"
35
36
37static void __init ek_init_early(void)
38{
39 /* Initialize processor: 12.000 MHz crystal */
40 at91_initialize(12000000);
41
42 /* DGBU on ttyS0. (Rx & Tx only) */
43 at91_register_uart(0, 0, 0);
44
45 /* set serial console to ttyS0 (ie, DBGU) */
46 at91_set_serial_console(0);
47}
48
49/* det_pin is not connected */
50static struct atmel_nand_data __initdata ek_nand_data = {
51 .ale = 21,
52 .cle = 22,
53 .rdy_pin = AT91_PIN_PC8,
54 .enable_pin = AT91_PIN_PC14,
55};
56
57static struct sam9_smc_config __initdata ek_nand_smc_config = {
58 .ncs_read_setup = 0,
59 .nrd_setup = 2,
60 .ncs_write_setup = 0,
61 .nwe_setup = 2,
62
63 .ncs_read_pulse = 4,
64 .nrd_pulse = 4,
65 .ncs_write_pulse = 4,
66 .nwe_pulse = 4,
67
68 .read_cycle = 7,
69 .write_cycle = 7,
70
71 .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE,
72 .tdf_cycles = 3,
73};
74
75static void __init ek_add_device_nand(void)
76{
77 ek_nand_data.bus_width_16 = board_have_nand_16bit();
78 /* setup bus-width (8 or 16) */
79 if (ek_nand_data.bus_width_16)
80 ek_nand_smc_config.mode |= AT91_SMC_DBW_16;
81 else
82 ek_nand_smc_config.mode |= AT91_SMC_DBW_8;
83
84 /* configure chip-select 3 (NAND) */
85 sam9_smc_configure(3, &ek_nand_smc_config);
86
87 at91_add_device_nand(&ek_nand_data);
88}
89
90static const struct of_device_id aic_of_match[] __initconst = {
91 { .compatible = "atmel,at91rm9200-aic", },
92 {},
93};
94
95static void __init at91_dt_init_irq(void)
96{
97 irq_domain_generate_simple(aic_of_match, 0xfffff000, 0);
98 at91_init_irq_default();
99}
100
101static void __init at91_dt_device_init(void)
102{
103 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
104
105 /* NAND */
106 ek_add_device_nand();
107}
108
109static const char *at91_dt_board_compat[] __initdata = {
110 "atmel,at91sam9m10g45ek",
111 NULL
112};
113
114DT_MACHINE_START(at91sam_dt, "Atmel AT91SAM (Device Tree)")
115 /* Maintainer: Atmel */
116 .timer = &at91sam926x_timer,
117 .map_io = at91_map_io,
118 .init_early = ek_init_early,
119 .init_irq = at91_dt_init_irq,
120 .init_machine = at91_dt_device_init,
121 .dt_compat = at91_dt_board_compat,
122MACHINE_END