aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Victor <andrew@sanpeople.com>2006-04-02 12:15:51 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2006-04-02 12:15:51 -0400
commit3267c077e589bc146a0b45e220fcefafbf83fb80 (patch)
tree6c1fdd680fecbc90ce00b79e5e6e0e24093f1d1b
parent486bcc59f3083c54df7b67d1d69db81585632a8b (diff)
[ARM] 3396/2: AT91RM9200 Platform devices update
Patch from Andrew Victor This patch updates the platform device resources for the Ethernet and MMC peripherals. It also adds platform device information for the NAND (SmartMedia), I2C and the RTC. (This version of the patch can be applied before Patch 3392/1) Signed-off-by: Andrew Victor <andrew@sanpeople.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r--arch/arm/mach-at91rm9200/devices.c135
-rw-r--r--include/asm-arm/arch-at91rm9200/board.h19
2 files changed, 146 insertions, 8 deletions
diff --git a/arch/arm/mach-at91rm9200/devices.c b/arch/arm/mach-at91rm9200/devices.c
index aa36760efbc3..1781b8f342c4 100644
--- a/arch/arm/mach-at91rm9200/devices.c
+++ b/arch/arm/mach-at91rm9200/devices.c
@@ -28,10 +28,10 @@
28static u64 ohci_dmamask = 0xffffffffUL; 28static u64 ohci_dmamask = 0xffffffffUL;
29static struct at91_usbh_data usbh_data; 29static struct at91_usbh_data usbh_data;
30 30
31static struct resource at91rm9200_usbh_resource[] = { 31static struct resource at91_usbh_resource[] = {
32 [0] = { 32 [0] = {
33 .start = AT91_UHP_BASE, 33 .start = AT91_UHP_BASE,
34 .end = AT91_UHP_BASE + SZ_1M -1, 34 .end = AT91_UHP_BASE + SZ_1M - 1,
35 .flags = IORESOURCE_MEM, 35 .flags = IORESOURCE_MEM,
36 }, 36 },
37 [1] = { 37 [1] = {
@@ -49,8 +49,8 @@ static struct platform_device at91rm9200_usbh_device = {
49 .coherent_dma_mask = 0xffffffff, 49 .coherent_dma_mask = 0xffffffff,
50 .platform_data = &usbh_data, 50 .platform_data = &usbh_data,
51 }, 51 },
52 .resource = at91rm9200_usbh_resource, 52 .resource = at91_usbh_resource,
53 .num_resources = ARRAY_SIZE(at91rm9200_usbh_resource), 53 .num_resources = ARRAY_SIZE(at91_usbh_resource),
54}; 54};
55 55
56void __init at91_add_device_usbh(struct at91_usbh_data *data) 56void __init at91_add_device_usbh(struct at91_usbh_data *data)
@@ -121,6 +121,19 @@ void __init at91_add_device_udc(struct at91_udc_data *data) {}
121static u64 eth_dmamask = 0xffffffffUL; 121static u64 eth_dmamask = 0xffffffffUL;
122static struct at91_eth_data eth_data; 122static struct at91_eth_data eth_data;
123 123
124static struct resource at91_eth_resources[] = {
125 [0] = {
126 .start = AT91_BASE_EMAC,
127 .end = AT91_BASE_EMAC + SZ_16K - 1,
128 .flags = IORESOURCE_MEM,
129 },
130 [1] = {
131 .start = AT91_ID_EMAC,
132 .end = AT91_ID_EMAC,
133 .flags = IORESOURCE_IRQ,
134 },
135};
136
124static struct platform_device at91rm9200_eth_device = { 137static struct platform_device at91rm9200_eth_device = {
125 .name = "at91_ether", 138 .name = "at91_ether",
126 .id = -1, 139 .id = -1,
@@ -129,7 +142,8 @@ static struct platform_device at91rm9200_eth_device = {
129 .coherent_dma_mask = 0xffffffff, 142 .coherent_dma_mask = 0xffffffff,
130 .platform_data = &eth_data, 143 .platform_data = &eth_data,
131 }, 144 },
132 .num_resources = 0, 145 .resource = at91_eth_resources,
146 .num_resources = ARRAY_SIZE(at91_eth_resources),
133}; 147};
134 148
135void __init at91_add_device_eth(struct at91_eth_data *data) 149void __init at91_add_device_eth(struct at91_eth_data *data)
@@ -224,15 +238,20 @@ static u64 mmc_dmamask = 0xffffffffUL;
224static struct at91_mmc_data mmc_data; 238static struct at91_mmc_data mmc_data;
225 239
226static struct resource at91_mmc_resources[] = { 240static struct resource at91_mmc_resources[] = {
227 { 241 [0] = {
228 .start = AT91_BASE_MCI, 242 .start = AT91_BASE_MCI,
229 .end = AT91_BASE_MCI + SZ_16K - 1, 243 .end = AT91_BASE_MCI + SZ_16K - 1,
230 .flags = IORESOURCE_MEM, 244 .flags = IORESOURCE_MEM,
231 } 245 },
246 [1] = {
247 .start = AT91_ID_MCI,
248 .end = AT91_ID_MCI,
249 .flags = IORESOURCE_IRQ,
250 },
232}; 251};
233 252
234static struct platform_device at91rm9200_mmc_device = { 253static struct platform_device at91rm9200_mmc_device = {
235 .name = "at91rm9200_mci", 254 .name = "at91_mci",
236 .id = -1, 255 .id = -1,
237 .dev = { 256 .dev = {
238 .dma_mask = &mmc_dmamask, 257 .dma_mask = &mmc_dmamask,
@@ -291,6 +310,106 @@ void __init at91_add_device_mmc(struct at91_mmc_data *data) {}
291#endif 310#endif
292 311
293/* -------------------------------------------------------------------- 312/* --------------------------------------------------------------------
313 * NAND / SmartMedia
314 * -------------------------------------------------------------------- */
315
316#if defined(CONFIG_MTD_NAND_AT91) || defined(CONFIG_MTD_NAND_AT91_MODULE)
317static struct at91_nand_data nand_data;
318
319static struct resource at91_nand_resources[] = {
320 {
321 .start = AT91_SMARTMEDIA_BASE,
322 .end = AT91_SMARTMEDIA_BASE + SZ_8M - 1,
323 .flags = IORESOURCE_MEM,
324 }
325};
326
327static struct platform_device at91_nand_device = {
328 .name = "at91_nand",
329 .id = -1,
330 .dev = {
331 .platform_data = &nand_data,
332 },
333 .resource = at91_nand_resources,
334 .num_resources = ARRAY_SIZE(at91_nand_resources),
335};
336
337void __init at91_add_device_nand(struct at91_nand_data *data)
338{
339 if (!data)
340 return;
341
342 /* enable pin */
343 if (data->enable_pin)
344 at91_set_gpio_output(data->enable_pin, 1);
345
346 /* ready/busy pin */
347 if (data->rdy_pin)
348 at91_set_gpio_input(data->rdy_pin, 1);
349
350 /* card detect pin */
351 if (data->det_pin)
352 at91_set_gpio_input(data->det_pin, 1);
353
354 at91_set_A_periph(AT91_PIN_PC1, 0); /* SMOE */
355 at91_set_A_periph(AT91_PIN_PC3, 0); /* SMWE */
356
357 nand_data = *data;
358 platform_device_register(&at91_nand_device);
359}
360#else
361void __init at91_add_device_nand(struct at91_nand_data *data) {}
362#endif
363
364
365/* --------------------------------------------------------------------
366 * TWI (i2c)
367 * -------------------------------------------------------------------- */
368
369#if defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE)
370static struct platform_device at91rm9200_twi_device = {
371 .name = "at91_i2c",
372 .id = -1,
373 .num_resources = 0,
374};
375
376void __init at91_add_device_i2c(void)
377{
378 /* pins used for TWI interface */
379 at91_set_A_periph(AT91_PIN_PA25, 0); /* TWD */
380 at91_set_multi_drive(AT91_PIN_PA25, 1);
381
382 at91_set_A_periph(AT91_PIN_PA26, 0); /* TWCK */
383 at91_set_multi_drive(AT91_PIN_PA26, 1);
384
385 platform_device_register(&at91rm9200_twi_device);
386}
387#else
388void __init at91_add_device_i2c(void) {}
389#endif
390
391
392/* --------------------------------------------------------------------
393 * RTC
394 * -------------------------------------------------------------------- */
395
396#if defined(CONFIG_AT91_RTC) || defined(CONFIG_AT91_RTC_MODULE)
397static struct platform_device at91rm9200_rtc_device = {
398 .name = "at91_rtc",
399 .id = -1,
400 .num_resources = 0,
401};
402
403void __init at91_add_device_rtc(void)
404{
405 platform_device_register(&at91rm9200_rtc_device);
406}
407#else
408void __init at91_add_device_rtc(void) {}
409#endif
410
411
412/* --------------------------------------------------------------------
294 * LEDs 413 * LEDs
295 * -------------------------------------------------------------------- */ 414 * -------------------------------------------------------------------- */
296 415
diff --git a/include/asm-arm/arch-at91rm9200/board.h b/include/asm-arm/arch-at91rm9200/board.h
index 834d0ab991ae..4fdef13d01d4 100644
--- a/include/asm-arm/arch-at91rm9200/board.h
+++ b/include/asm-arm/arch-at91rm9200/board.h
@@ -38,6 +38,8 @@ extern unsigned long at91_master_clock;
38extern int at91_serial_map[AT91_NR_UART]; 38extern int at91_serial_map[AT91_NR_UART];
39extern int at91_console_port; 39extern int at91_console_port;
40 40
41#include <linux/mtd/partitions.h>
42
41 /* USB Device */ 43 /* USB Device */
42struct at91_udc_data { 44struct at91_udc_data {
43 u8 vbus_pin; /* high == host powering us */ 45 u8 vbus_pin; /* high == host powering us */
@@ -77,6 +79,23 @@ struct at91_usbh_data {
77}; 79};
78extern void __init at91_add_device_usbh(struct at91_usbh_data *data); 80extern void __init at91_add_device_usbh(struct at91_usbh_data *data);
79 81
82 /* NAND / SmartMedia */
83struct at91_nand_data {
84 u8 enable_pin; /* chip enable */
85 u8 det_pin; /* card detect */
86 u8 rdy_pin; /* ready/busy */
87 u8 ale; /* address line number connected to ALE */
88 u8 cle; /* address line number connected to CLE */
89 struct mtd_partition* (*partition_info)(int, int*);
90};
91extern void __init at91_add_device_nand(struct at91_nand_data *data);
92
93 /* I2C*/
94void __init at91_add_device_i2c(void);
95
96 /* RTC */
97void __init at91_add_device_rtc(void);
98
80 /* LEDs */ 99 /* LEDs */
81extern u8 at91_leds_cpu; 100extern u8 at91_leds_cpu;
82extern u8 at91_leds_timer; 101extern u8 at91_leds_timer;