diff options
Diffstat (limited to 'arch/arm/mach-at91rm9200')
-rw-r--r-- | arch/arm/mach-at91rm9200/Makefile | 9 | ||||
-rw-r--r-- | arch/arm/mach-at91rm9200/board-csb337.c | 3 | ||||
-rw-r--r-- | arch/arm/mach-at91rm9200/board-csb637.c | 3 | ||||
-rw-r--r-- | arch/arm/mach-at91rm9200/board-dk.c | 10 | ||||
-rw-r--r-- | arch/arm/mach-at91rm9200/board-ek.c | 10 | ||||
-rw-r--r-- | arch/arm/mach-at91rm9200/devices.c | 154 | ||||
-rw-r--r-- | arch/arm/mach-at91rm9200/leds.c | 100 |
7 files changed, 275 insertions, 14 deletions
diff --git a/arch/arm/mach-at91rm9200/Makefile b/arch/arm/mach-at91rm9200/Makefile index 75e6ee318ded..ef88c4128edc 100644 --- a/arch/arm/mach-at91rm9200/Makefile +++ b/arch/arm/mach-at91rm9200/Makefile | |||
@@ -16,11 +16,12 @@ obj-$(CONFIG_MACH_CSB637) += board-csb637.o | |||
16 | #obj-$(CONFIG_MACH_KB9200) += board-kb9202.o | 16 | #obj-$(CONFIG_MACH_KB9200) += board-kb9202.o |
17 | 17 | ||
18 | # LEDs support | 18 | # LEDs support |
19 | #led-$(CONFIG_ARCH_AT91RM9200DK) += leds.o | 19 | led-$(CONFIG_ARCH_AT91RM9200DK) += leds.o |
20 | #led-$(CONFIG_MACH_AT91RM9200EK) += leds.o | 20 | led-$(CONFIG_MACH_AT91RM9200EK) += leds.o |
21 | #led-$(CONFIG_MACH_CSB337) += leds.o | 21 | led-$(CONFIG_MACH_CSB337) += leds.o |
22 | #led-$(CONFIG_MACH_CSB637) += leds.o | 22 | led-$(CONFIG_MACH_CSB637) += leds.o |
23 | #led-$(CONFIG_MACH_KB9200) += leds.o | 23 | #led-$(CONFIG_MACH_KB9200) += leds.o |
24 | #led-$(CONFIG_MACH_KAFA) += leds.o | ||
24 | obj-$(CONFIG_LEDS) += $(led-y) | 25 | obj-$(CONFIG_LEDS) += $(led-y) |
25 | 26 | ||
26 | # VGA support | 27 | # VGA support |
diff --git a/arch/arm/mach-at91rm9200/board-csb337.c b/arch/arm/mach-at91rm9200/board-csb337.c index 54022e58d50d..f45104ceea8f 100644 --- a/arch/arm/mach-at91rm9200/board-csb337.c +++ b/arch/arm/mach-at91rm9200/board-csb337.c | |||
@@ -67,6 +67,9 @@ static void __init csb337_map_io(void) | |||
67 | /* Initialize clocks: 3.6864 MHz crystal */ | 67 | /* Initialize clocks: 3.6864 MHz crystal */ |
68 | at91_clock_init(3686400); | 68 | at91_clock_init(3686400); |
69 | 69 | ||
70 | /* Setup the LEDs */ | ||
71 | at91_init_leds(AT91_PIN_PB2, AT91_PIN_PB2); | ||
72 | |||
70 | #ifdef CONFIG_SERIAL_AT91 | 73 | #ifdef CONFIG_SERIAL_AT91 |
71 | at91_console_port = CSB337_SERIAL_CONSOLE; | 74 | at91_console_port = CSB337_SERIAL_CONSOLE; |
72 | memcpy(at91_serial_map, serial, sizeof(serial)); | 75 | memcpy(at91_serial_map, serial, sizeof(serial)); |
diff --git a/arch/arm/mach-at91rm9200/board-csb637.c b/arch/arm/mach-at91rm9200/board-csb637.c index 8195f9d919ea..f2c2d6e79bc6 100644 --- a/arch/arm/mach-at91rm9200/board-csb637.c +++ b/arch/arm/mach-at91rm9200/board-csb637.c | |||
@@ -67,6 +67,9 @@ static void __init csb637_map_io(void) | |||
67 | /* Initialize clocks: 3.6864 MHz crystal */ | 67 | /* Initialize clocks: 3.6864 MHz crystal */ |
68 | at91_clock_init(3686400); | 68 | at91_clock_init(3686400); |
69 | 69 | ||
70 | /* Setup the LEDs */ | ||
71 | at91_init_leds(AT91_PIN_PB2, AT91_PIN_PB2); | ||
72 | |||
70 | #ifdef CONFIG_SERIAL_AT91 | 73 | #ifdef CONFIG_SERIAL_AT91 |
71 | at91_console_port = CSB637_SERIAL_CONSOLE; | 74 | at91_console_port = CSB637_SERIAL_CONSOLE; |
72 | memcpy(at91_serial_map, serial, sizeof(serial)); | 75 | memcpy(at91_serial_map, serial, sizeof(serial)); |
diff --git a/arch/arm/mach-at91rm9200/board-dk.c b/arch/arm/mach-at91rm9200/board-dk.c index 8a783368366e..2d7200ed66ed 100644 --- a/arch/arm/mach-at91rm9200/board-dk.c +++ b/arch/arm/mach-at91rm9200/board-dk.c | |||
@@ -70,6 +70,9 @@ static void __init dk_map_io(void) | |||
70 | /* Initialize clocks: 18.432 MHz crystal */ | 70 | /* Initialize clocks: 18.432 MHz crystal */ |
71 | at91_clock_init(18432000); | 71 | at91_clock_init(18432000); |
72 | 72 | ||
73 | /* Setup the LEDs */ | ||
74 | at91_init_leds(AT91_PIN_PB2, AT91_PIN_PB2); | ||
75 | |||
73 | #ifdef CONFIG_SERIAL_AT91 | 76 | #ifdef CONFIG_SERIAL_AT91 |
74 | at91_console_port = DK_SERIAL_CONSOLE; | 77 | at91_console_port = DK_SERIAL_CONSOLE; |
75 | memcpy(at91_serial_map, serial, sizeof(serial)); | 78 | memcpy(at91_serial_map, serial, sizeof(serial)); |
@@ -118,9 +121,14 @@ static void __init dk_board_init(void) | |||
118 | at91_add_device_udc(&dk_udc_data); | 121 | at91_add_device_udc(&dk_udc_data); |
119 | /* Compact Flash */ | 122 | /* Compact Flash */ |
120 | at91_add_device_cf(&dk_cf_data); | 123 | at91_add_device_cf(&dk_cf_data); |
124 | #ifdef CONFIG_MTD_AT91_DATAFLASH_CARD | ||
125 | /* DataFlash card */ | ||
126 | at91_set_gpio_output(AT91_PIN_PB7, 0); | ||
127 | #else | ||
121 | /* MMC */ | 128 | /* MMC */ |
122 | at91_set_gpio_output(AT91_PIN_PB7, 1); /* this MMC card slot can optionally use SPI signaling (CS3). default: MMC */ | 129 | at91_set_gpio_output(AT91_PIN_PB7, 1); /* this MMC card slot can optionally use SPI signaling (CS3). */ |
123 | at91_add_device_mmc(&dk_mmc_data); | 130 | at91_add_device_mmc(&dk_mmc_data); |
131 | #endif | ||
124 | /* VGA */ | 132 | /* VGA */ |
125 | // dk_add_device_video(); | 133 | // dk_add_device_video(); |
126 | } | 134 | } |
diff --git a/arch/arm/mach-at91rm9200/board-ek.c b/arch/arm/mach-at91rm9200/board-ek.c index fd0752eba897..80d90f5135a1 100644 --- a/arch/arm/mach-at91rm9200/board-ek.c +++ b/arch/arm/mach-at91rm9200/board-ek.c | |||
@@ -70,6 +70,9 @@ static void __init ek_map_io(void) | |||
70 | /* Initialize clocks: 18.432 MHz crystal */ | 70 | /* Initialize clocks: 18.432 MHz crystal */ |
71 | at91_clock_init(18432000); | 71 | at91_clock_init(18432000); |
72 | 72 | ||
73 | /* Setup the LEDs */ | ||
74 | at91_init_leds(AT91_PIN_PB1, AT91_PIN_PB2); | ||
75 | |||
73 | #ifdef CONFIG_SERIAL_AT91 | 76 | #ifdef CONFIG_SERIAL_AT91 |
74 | at91_console_port = EK_SERIAL_CONSOLE; | 77 | at91_console_port = EK_SERIAL_CONSOLE; |
75 | memcpy(at91_serial_map, serial, sizeof(serial)); | 78 | memcpy(at91_serial_map, serial, sizeof(serial)); |
@@ -111,9 +114,14 @@ static void __init ek_board_init(void) | |||
111 | at91_add_device_usbh(&ek_usbh_data); | 114 | at91_add_device_usbh(&ek_usbh_data); |
112 | /* USB Device */ | 115 | /* USB Device */ |
113 | at91_add_device_udc(&ek_udc_data); | 116 | at91_add_device_udc(&ek_udc_data); |
117 | #ifdef CONFIG_MTD_AT91_DATAFLASH_CARD | ||
118 | /* DataFlash card */ | ||
119 | at91_set_gpio_output(AT91_PIN_PB22, 0); | ||
120 | #else | ||
114 | /* MMC */ | 121 | /* MMC */ |
115 | at91_set_gpio_output(AT91_PIN_PB22, 1); /* this MMC card slot can optionally use SPI signaling (CS3). default: MMC */ | 122 | at91_set_gpio_output(AT91_PIN_PB22, 1); /* this MMC card slot can optionally use SPI signaling (CS3). */ |
116 | at91_add_device_mmc(&ek_mmc_data); | 123 | at91_add_device_mmc(&ek_mmc_data); |
124 | #endif | ||
117 | /* VGA */ | 125 | /* VGA */ |
118 | // ek_add_device_video(); | 126 | // ek_add_device_video(); |
119 | } | 127 | } |
diff --git a/arch/arm/mach-at91rm9200/devices.c b/arch/arm/mach-at91rm9200/devices.c index 57eedd5beaf6..1781b8f342c4 100644 --- a/arch/arm/mach-at91rm9200/devices.c +++ b/arch/arm/mach-at91rm9200/devices.c | |||
@@ -28,10 +28,10 @@ | |||
28 | static u64 ohci_dmamask = 0xffffffffUL; | 28 | static u64 ohci_dmamask = 0xffffffffUL; |
29 | static struct at91_usbh_data usbh_data; | 29 | static struct at91_usbh_data usbh_data; |
30 | 30 | ||
31 | static struct resource at91rm9200_usbh_resource[] = { | 31 | static 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 | ||
56 | void __init at91_add_device_usbh(struct at91_usbh_data *data) | 56 | void __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) {} | |||
121 | static u64 eth_dmamask = 0xffffffffUL; | 121 | static u64 eth_dmamask = 0xffffffffUL; |
122 | static struct at91_eth_data eth_data; | 122 | static struct at91_eth_data eth_data; |
123 | 123 | ||
124 | static 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 | |||
124 | static struct platform_device at91rm9200_eth_device = { | 137 | static 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 = ð_data, | 143 | .platform_data = ð_data, |
131 | }, | 144 | }, |
132 | .num_resources = 0, | 145 | .resource = at91_eth_resources, |
146 | .num_resources = ARRAY_SIZE(at91_eth_resources), | ||
133 | }; | 147 | }; |
134 | 148 | ||
135 | void __init at91_add_device_eth(struct at91_eth_data *data) | 149 | void __init at91_add_device_eth(struct at91_eth_data *data) |
@@ -224,15 +238,20 @@ static u64 mmc_dmamask = 0xffffffffUL; | |||
224 | static struct at91_mmc_data mmc_data; | 238 | static struct at91_mmc_data mmc_data; |
225 | 239 | ||
226 | static struct resource at91_mmc_resources[] = { | 240 | static 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 | ||
234 | static struct platform_device at91rm9200_mmc_device = { | 253 | static 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, |
@@ -290,4 +309,123 @@ void __init at91_add_device_mmc(struct at91_mmc_data *data) | |||
290 | void __init at91_add_device_mmc(struct at91_mmc_data *data) {} | 309 | void __init at91_add_device_mmc(struct at91_mmc_data *data) {} |
291 | #endif | 310 | #endif |
292 | 311 | ||
312 | /* -------------------------------------------------------------------- | ||
313 | * NAND / SmartMedia | ||
314 | * -------------------------------------------------------------------- */ | ||
315 | |||
316 | #if defined(CONFIG_MTD_NAND_AT91) || defined(CONFIG_MTD_NAND_AT91_MODULE) | ||
317 | static struct at91_nand_data nand_data; | ||
318 | |||
319 | static 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 | |||
327 | static 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 | |||
337 | void __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 | ||
361 | void __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) | ||
370 | static struct platform_device at91rm9200_twi_device = { | ||
371 | .name = "at91_i2c", | ||
372 | .id = -1, | ||
373 | .num_resources = 0, | ||
374 | }; | ||
375 | |||
376 | void __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 | ||
388 | void __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) | ||
397 | static struct platform_device at91rm9200_rtc_device = { | ||
398 | .name = "at91_rtc", | ||
399 | .id = -1, | ||
400 | .num_resources = 0, | ||
401 | }; | ||
402 | |||
403 | void __init at91_add_device_rtc(void) | ||
404 | { | ||
405 | platform_device_register(&at91rm9200_rtc_device); | ||
406 | } | ||
407 | #else | ||
408 | void __init at91_add_device_rtc(void) {} | ||
409 | #endif | ||
410 | |||
411 | |||
412 | /* -------------------------------------------------------------------- | ||
413 | * LEDs | ||
414 | * -------------------------------------------------------------------- */ | ||
415 | |||
416 | #if defined(CONFIG_LEDS) | ||
417 | u8 at91_leds_cpu; | ||
418 | u8 at91_leds_timer; | ||
419 | |||
420 | void __init at91_init_leds(u8 cpu_led, u8 timer_led) | ||
421 | { | ||
422 | at91_leds_cpu = cpu_led; | ||
423 | at91_leds_timer = timer_led; | ||
424 | } | ||
425 | |||
426 | #else | ||
427 | void __init at91_init_leds(u8 cpu_led, u8 timer_led) {} | ||
428 | #endif | ||
429 | |||
430 | |||
293 | /* -------------------------------------------------------------------- */ | 431 | /* -------------------------------------------------------------------- */ |
diff --git a/arch/arm/mach-at91rm9200/leds.c b/arch/arm/mach-at91rm9200/leds.c new file mode 100644 index 000000000000..28150e8905ba --- /dev/null +++ b/arch/arm/mach-at91rm9200/leds.c | |||
@@ -0,0 +1,100 @@ | |||
1 | /* | ||
2 | * LED driver for Atmel AT91-based boards. | ||
3 | * | ||
4 | * Copyright (C) SAN People (Pty) Ltd | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the License, or (at your option) any later version. | ||
10 | */ | ||
11 | |||
12 | #include <linux/config.h> | ||
13 | #include <linux/kernel.h> | ||
14 | #include <linux/module.h> | ||
15 | #include <linux/init.h> | ||
16 | |||
17 | #include <asm/mach-types.h> | ||
18 | #include <asm/leds.h> | ||
19 | #include <asm/arch/board.h> | ||
20 | #include <asm/arch/gpio.h> | ||
21 | |||
22 | |||
23 | static inline void at91_led_on(unsigned int led) | ||
24 | { | ||
25 | at91_set_gpio_value(led, 0); | ||
26 | } | ||
27 | |||
28 | static inline void at91_led_off(unsigned int led) | ||
29 | { | ||
30 | at91_set_gpio_value(led, 1); | ||
31 | } | ||
32 | |||
33 | static inline void at91_led_toggle(unsigned int led) | ||
34 | { | ||
35 | unsigned long is_off = at91_get_gpio_value(led); | ||
36 | if (is_off) | ||
37 | at91_led_on(led); | ||
38 | else | ||
39 | at91_led_off(led); | ||
40 | } | ||
41 | |||
42 | |||
43 | /* | ||
44 | * Handle LED events. | ||
45 | */ | ||
46 | static void at91_leds_event(led_event_t evt) | ||
47 | { | ||
48 | unsigned long flags; | ||
49 | |||
50 | local_irq_save(flags); | ||
51 | |||
52 | switch(evt) { | ||
53 | case led_start: /* System startup */ | ||
54 | at91_led_on(at91_leds_cpu); | ||
55 | break; | ||
56 | |||
57 | case led_stop: /* System stop / suspend */ | ||
58 | at91_led_off(at91_leds_cpu); | ||
59 | break; | ||
60 | |||
61 | #ifdef CONFIG_LEDS_TIMER | ||
62 | case led_timer: /* Every 50 timer ticks */ | ||
63 | at91_led_toggle(at91_leds_timer); | ||
64 | break; | ||
65 | #endif | ||
66 | |||
67 | #ifdef CONFIG_LEDS_CPU | ||
68 | case led_idle_start: /* Entering idle state */ | ||
69 | at91_led_off(at91_leds_cpu); | ||
70 | break; | ||
71 | |||
72 | case led_idle_end: /* Exit idle state */ | ||
73 | at91_led_on(at91_leds_cpu); | ||
74 | break; | ||
75 | #endif | ||
76 | |||
77 | default: | ||
78 | break; | ||
79 | } | ||
80 | |||
81 | local_irq_restore(flags); | ||
82 | } | ||
83 | |||
84 | |||
85 | static int __init leds_init(void) | ||
86 | { | ||
87 | if (!at91_leds_timer || !at91_leds_cpu) | ||
88 | return -ENODEV; | ||
89 | |||
90 | /* Enable PIO to access the LEDs */ | ||
91 | at91_set_gpio_output(at91_leds_timer, 1); | ||
92 | at91_set_gpio_output(at91_leds_cpu, 1); | ||
93 | |||
94 | leds_event = at91_leds_event; | ||
95 | |||
96 | leds_event(led_start); | ||
97 | return 0; | ||
98 | } | ||
99 | |||
100 | __initcall(leds_init); | ||