diff options
author | Christian Glindkamp <christian.glindkamp@taskit.de> | 2010-12-09 05:15:59 -0500 |
---|---|---|
committer | Nicolas Ferre <nicolas.ferre@atmel.com> | 2010-12-17 06:10:39 -0500 |
commit | c20b4dd31820a551d0fb60bf27b99345905c2eb6 (patch) | |
tree | 470d233028356edf47a4a7898660e8d1e8ca2164 /arch/arm/mach-at91/board-stamp9g20.c | |
parent | 8251544f9e28058e54c4f35b7cd13b0d191d7555 (diff) |
at91: Refactor Stamp9G20 and PControl G20 board file
As PControl G20 is a carrier board for the Stamp9G20 SoM, some code can
be shared. Therefore board-stamp9g20.c is refactored to allow reusing the
SoM initialization and board-pcontrol-g20.c is modified to use it.
Signed-off-by: Christian Glindkamp <christian.glindkamp@taskit.de>
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Diffstat (limited to 'arch/arm/mach-at91/board-stamp9g20.c')
-rw-r--r-- | arch/arm/mach-at91/board-stamp9g20.c | 82 |
1 files changed, 43 insertions, 39 deletions
diff --git a/arch/arm/mach-at91/board-stamp9g20.c b/arch/arm/mach-at91/board-stamp9g20.c index 5206eef4a67e..f8902b118960 100644 --- a/arch/arm/mach-at91/board-stamp9g20.c +++ b/arch/arm/mach-at91/board-stamp9g20.c | |||
@@ -32,7 +32,7 @@ | |||
32 | #include "generic.h" | 32 | #include "generic.h" |
33 | 33 | ||
34 | 34 | ||
35 | static void __init portuxg20_map_io(void) | 35 | void __init stamp9g20_map_io(void) |
36 | { | 36 | { |
37 | /* Initialize processor: 18.432 MHz crystal */ | 37 | /* Initialize processor: 18.432 MHz crystal */ |
38 | at91sam9260_initialize(18432000); | 38 | at91sam9260_initialize(18432000); |
@@ -40,6 +40,24 @@ static void __init portuxg20_map_io(void) | |||
40 | /* DGBU on ttyS0. (Rx & Tx only) */ | 40 | /* DGBU on ttyS0. (Rx & Tx only) */ |
41 | at91_register_uart(0, 0, 0); | 41 | at91_register_uart(0, 0, 0); |
42 | 42 | ||
43 | /* set serial console to ttyS0 (ie, DBGU) */ | ||
44 | at91_set_serial_console(0); | ||
45 | } | ||
46 | |||
47 | static void __init stamp9g20evb_map_io(void) | ||
48 | { | ||
49 | stamp9g20_map_io(); | ||
50 | |||
51 | /* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */ | ||
52 | at91_register_uart(AT91SAM9260_ID_US0, 1, ATMEL_UART_CTS | ATMEL_UART_RTS | ||
53 | | ATMEL_UART_DTR | ATMEL_UART_DSR | ||
54 | | ATMEL_UART_DCD | ATMEL_UART_RI); | ||
55 | } | ||
56 | |||
57 | static void __init portuxg20_map_io(void) | ||
58 | { | ||
59 | stamp9g20_map_io(); | ||
60 | |||
43 | /* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */ | 61 | /* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */ |
44 | at91_register_uart(AT91SAM9260_ID_US0, 1, ATMEL_UART_CTS | ATMEL_UART_RTS | 62 | at91_register_uart(AT91SAM9260_ID_US0, 1, ATMEL_UART_CTS | ATMEL_UART_RTS |
45 | | ATMEL_UART_DTR | ATMEL_UART_DSR | 63 | | ATMEL_UART_DTR | ATMEL_UART_DSR |
@@ -56,26 +74,6 @@ static void __init portuxg20_map_io(void) | |||
56 | 74 | ||
57 | /* USART5 on ttyS6. (Rx, Tx only) */ | 75 | /* USART5 on ttyS6. (Rx, Tx only) */ |
58 | at91_register_uart(AT91SAM9260_ID_US5, 6, 0); | 76 | at91_register_uart(AT91SAM9260_ID_US5, 6, 0); |
59 | |||
60 | /* set serial console to ttyS0 (ie, DBGU) */ | ||
61 | at91_set_serial_console(0); | ||
62 | } | ||
63 | |||
64 | static void __init stamp9g20_map_io(void) | ||
65 | { | ||
66 | /* Initialize processor: 18.432 MHz crystal */ | ||
67 | at91sam9260_initialize(18432000); | ||
68 | |||
69 | /* DGBU on ttyS0. (Rx & Tx only) */ | ||
70 | at91_register_uart(0, 0, 0); | ||
71 | |||
72 | /* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */ | ||
73 | at91_register_uart(AT91SAM9260_ID_US0, 1, ATMEL_UART_CTS | ATMEL_UART_RTS | ||
74 | | ATMEL_UART_DTR | ATMEL_UART_DSR | ||
75 | | ATMEL_UART_DCD | ATMEL_UART_RI); | ||
76 | |||
77 | /* set serial console to ttyS0 (ie, DBGU) */ | ||
78 | at91_set_serial_console(0); | ||
79 | } | 77 | } |
80 | 78 | ||
81 | static void __init init_irq(void) | 79 | static void __init init_irq(void) |
@@ -156,7 +154,7 @@ static struct at91_udc_data __initdata portuxg20_udc_data = { | |||
156 | .pullup_pin = 0, /* pull-up driven by UDC */ | 154 | .pullup_pin = 0, /* pull-up driven by UDC */ |
157 | }; | 155 | }; |
158 | 156 | ||
159 | static struct at91_udc_data __initdata stamp9g20_udc_data = { | 157 | static struct at91_udc_data __initdata stamp9g20evb_udc_data = { |
160 | .vbus_pin = AT91_PIN_PA22, | 158 | .vbus_pin = AT91_PIN_PA22, |
161 | .pullup_pin = 0, /* pull-up driven by UDC */ | 159 | .pullup_pin = 0, /* pull-up driven by UDC */ |
162 | }; | 160 | }; |
@@ -190,7 +188,7 @@ static struct gpio_led portuxg20_leds[] = { | |||
190 | } | 188 | } |
191 | }; | 189 | }; |
192 | 190 | ||
193 | static struct gpio_led stamp9g20_leds[] = { | 191 | static struct gpio_led stamp9g20evb_leds[] = { |
194 | { | 192 | { |
195 | .name = "D8", | 193 | .name = "D8", |
196 | .gpio = AT91_PIN_PB18, | 194 | .gpio = AT91_PIN_PB18, |
@@ -250,7 +248,7 @@ void add_w1(void) | |||
250 | } | 248 | } |
251 | 249 | ||
252 | 250 | ||
253 | static void __init generic_board_init(void) | 251 | void __init stamp9g20_board_init(void) |
254 | { | 252 | { |
255 | /* Serial */ | 253 | /* Serial */ |
256 | at91_add_device_serial(); | 254 | at91_add_device_serial(); |
@@ -262,34 +260,40 @@ static void __init generic_board_init(void) | |||
262 | #else | 260 | #else |
263 | at91_add_device_mmc(0, &mmc_data); | 261 | at91_add_device_mmc(0, &mmc_data); |
264 | #endif | 262 | #endif |
265 | /* USB Host */ | ||
266 | at91_add_device_usbh(&usbh_data); | ||
267 | /* Ethernet */ | ||
268 | at91_add_device_eth(&macb_data); | ||
269 | /* I2C */ | ||
270 | at91_add_device_i2c(NULL, 0); | ||
271 | /* W1 */ | 263 | /* W1 */ |
272 | add_w1(); | 264 | add_w1(); |
273 | } | 265 | } |
274 | 266 | ||
275 | static void __init portuxg20_board_init(void) | 267 | static void __init portuxg20_board_init(void) |
276 | { | 268 | { |
277 | generic_board_init(); | 269 | stamp9g20_board_init(); |
278 | /* SPI */ | 270 | /* USB Host */ |
279 | at91_add_device_spi(portuxg20_spi_devices, ARRAY_SIZE(portuxg20_spi_devices)); | 271 | at91_add_device_usbh(&usbh_data); |
280 | /* USB Device */ | 272 | /* USB Device */ |
281 | at91_add_device_udc(&portuxg20_udc_data); | 273 | at91_add_device_udc(&portuxg20_udc_data); |
274 | /* Ethernet */ | ||
275 | at91_add_device_eth(&macb_data); | ||
276 | /* I2C */ | ||
277 | at91_add_device_i2c(NULL, 0); | ||
278 | /* SPI */ | ||
279 | at91_add_device_spi(portuxg20_spi_devices, ARRAY_SIZE(portuxg20_spi_devices)); | ||
282 | /* LEDs */ | 280 | /* LEDs */ |
283 | at91_gpio_leds(portuxg20_leds, ARRAY_SIZE(portuxg20_leds)); | 281 | at91_gpio_leds(portuxg20_leds, ARRAY_SIZE(portuxg20_leds)); |
284 | } | 282 | } |
285 | 283 | ||
286 | static void __init stamp9g20_board_init(void) | 284 | static void __init stamp9g20evb_board_init(void) |
287 | { | 285 | { |
288 | generic_board_init(); | 286 | stamp9g20_board_init(); |
287 | /* USB Host */ | ||
288 | at91_add_device_usbh(&usbh_data); | ||
289 | /* USB Device */ | 289 | /* USB Device */ |
290 | at91_add_device_udc(&stamp9g20_udc_data); | 290 | at91_add_device_udc(&stamp9g20evb_udc_data); |
291 | /* Ethernet */ | ||
292 | at91_add_device_eth(&macb_data); | ||
293 | /* I2C */ | ||
294 | at91_add_device_i2c(NULL, 0); | ||
291 | /* LEDs */ | 295 | /* LEDs */ |
292 | at91_gpio_leds(stamp9g20_leds, ARRAY_SIZE(stamp9g20_leds)); | 296 | at91_gpio_leds(stamp9g20evb_leds, ARRAY_SIZE(stamp9g20evb_leds)); |
293 | } | 297 | } |
294 | 298 | ||
295 | MACHINE_START(PORTUXG20, "taskit PortuxG20") | 299 | MACHINE_START(PORTUXG20, "taskit PortuxG20") |
@@ -305,7 +309,7 @@ MACHINE_START(STAMP9G20, "taskit Stamp9G20") | |||
305 | /* Maintainer: taskit GmbH */ | 309 | /* Maintainer: taskit GmbH */ |
306 | .boot_params = AT91_SDRAM_BASE + 0x100, | 310 | .boot_params = AT91_SDRAM_BASE + 0x100, |
307 | .timer = &at91sam926x_timer, | 311 | .timer = &at91sam926x_timer, |
308 | .map_io = stamp9g20_map_io, | 312 | .map_io = stamp9g20evb_map_io, |
309 | .init_irq = init_irq, | 313 | .init_irq = init_irq, |
310 | .init_machine = stamp9g20_board_init, | 314 | .init_machine = stamp9g20evb_board_init, |
311 | MACHINE_END | 315 | MACHINE_END |