diff options
author | Robert Marklund <robert.marklund@stericsson.com> | 2011-06-20 09:55:46 -0400 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2011-06-23 06:04:55 -0400 |
commit | 350abe0379f8106319f73cbcce37bfa2f0bfa05a (patch) | |
tree | 2b84532489cb835ce4c67cf9040c450c70ae4774 /arch/arm/mach-ux500 | |
parent | 58402b6e397555884d926fd22fb40ccf6fe68b46 (diff) |
mach-ux500: add basic support for snowball board
Based on work from Mathieu J. Poirier <mathieu.poirier@linaro.org>
For more information on snowball please visit
http://www.igloocommunity.org
Signed-off-by: Robert Marklund <robert.marklund@stericsson.com>
Diffstat (limited to 'arch/arm/mach-ux500')
-rw-r--r-- | arch/arm/mach-ux500/board-mop500.c | 154 |
1 files changed, 145 insertions, 9 deletions
diff --git a/arch/arm/mach-ux500/board-mop500.c b/arch/arm/mach-ux500/board-mop500.c index c64d6aa1355c..e3bbb5506dd1 100644 --- a/arch/arm/mach-ux500/board-mop500.c +++ b/arch/arm/mach-ux500/board-mop500.c | |||
@@ -26,8 +26,10 @@ | |||
26 | #include <linux/mfd/ab8500/gpio.h> | 26 | #include <linux/mfd/ab8500/gpio.h> |
27 | #include <linux/leds-lp5521.h> | 27 | #include <linux/leds-lp5521.h> |
28 | #include <linux/input.h> | 28 | #include <linux/input.h> |
29 | #include <linux/smsc911x.h> | ||
29 | #include <linux/gpio_keys.h> | 30 | #include <linux/gpio_keys.h> |
30 | 31 | ||
32 | #include <linux/leds.h> | ||
31 | #include <asm/mach-types.h> | 33 | #include <asm/mach-types.h> |
32 | #include <asm/mach/arch.h> | 34 | #include <asm/mach/arch.h> |
33 | 35 | ||
@@ -44,6 +46,26 @@ | |||
44 | #include "board-mop500.h" | 46 | #include "board-mop500.h" |
45 | #include "board-mop500-regulators.h" | 47 | #include "board-mop500-regulators.h" |
46 | 48 | ||
49 | static struct gpio_led snowball_led_array[] = { | ||
50 | { | ||
51 | .name = "user_led", | ||
52 | .default_trigger = "none", | ||
53 | .gpio = 142, | ||
54 | }, | ||
55 | }; | ||
56 | |||
57 | static struct gpio_led_platform_data snowball_led_data = { | ||
58 | .leds = snowball_led_array, | ||
59 | .num_leds = ARRAY_SIZE(snowball_led_array), | ||
60 | }; | ||
61 | |||
62 | static struct platform_device snowball_led_dev = { | ||
63 | .name = "leds-gpio", | ||
64 | .dev = { | ||
65 | .platform_data = &snowball_led_data, | ||
66 | }, | ||
67 | }; | ||
68 | |||
47 | static struct ab8500_gpio_platform_data ab8500_gpio_pdata = { | 69 | static struct ab8500_gpio_platform_data ab8500_gpio_pdata = { |
48 | .gpio_base = MOP500_AB8500_GPIO(0), | 70 | .gpio_base = MOP500_AB8500_GPIO(0), |
49 | .irq_base = MOP500_AB8500_VIR_GPIO_IRQ_BASE, | 71 | .irq_base = MOP500_AB8500_VIR_GPIO_IRQ_BASE, |
@@ -66,6 +88,97 @@ static struct ab8500_gpio_platform_data ab8500_gpio_pdata = { | |||
66 | 0x7A, 0x00, 0x00}, | 88 | 0x7A, 0x00, 0x00}, |
67 | }; | 89 | }; |
68 | 90 | ||
91 | static struct gpio_keys_button snowball_key_array[] = { | ||
92 | { | ||
93 | .gpio = 32, | ||
94 | .type = EV_KEY, | ||
95 | .code = KEY_1, | ||
96 | .desc = "userpb", | ||
97 | .active_low = 1, | ||
98 | .debounce_interval = 50, | ||
99 | .wakeup = 1, | ||
100 | }, | ||
101 | { | ||
102 | .gpio = 151, | ||
103 | .type = EV_KEY, | ||
104 | .code = KEY_2, | ||
105 | .desc = "extkb1", | ||
106 | .active_low = 1, | ||
107 | .debounce_interval = 50, | ||
108 | .wakeup = 1, | ||
109 | }, | ||
110 | { | ||
111 | .gpio = 152, | ||
112 | .type = EV_KEY, | ||
113 | .code = KEY_3, | ||
114 | .desc = "extkb2", | ||
115 | .active_low = 1, | ||
116 | .debounce_interval = 50, | ||
117 | .wakeup = 1, | ||
118 | }, | ||
119 | { | ||
120 | .gpio = 161, | ||
121 | .type = EV_KEY, | ||
122 | .code = KEY_4, | ||
123 | .desc = "extkb3", | ||
124 | .active_low = 1, | ||
125 | .debounce_interval = 50, | ||
126 | .wakeup = 1, | ||
127 | }, | ||
128 | { | ||
129 | .gpio = 162, | ||
130 | .type = EV_KEY, | ||
131 | .code = KEY_5, | ||
132 | .desc = "extkb4", | ||
133 | .active_low = 1, | ||
134 | .debounce_interval = 50, | ||
135 | .wakeup = 1, | ||
136 | }, | ||
137 | }; | ||
138 | |||
139 | static struct gpio_keys_platform_data snowball_key_data = { | ||
140 | .buttons = snowball_key_array, | ||
141 | .nbuttons = ARRAY_SIZE(snowball_key_array), | ||
142 | }; | ||
143 | |||
144 | static struct platform_device snowball_key_dev = { | ||
145 | .name = "gpio-keys", | ||
146 | .id = -1, | ||
147 | .dev = { | ||
148 | .platform_data = &snowball_key_data, | ||
149 | } | ||
150 | }; | ||
151 | |||
152 | static struct smsc911x_platform_config snowball_sbnet_cfg = { | ||
153 | .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_HIGH, | ||
154 | .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL, | ||
155 | .flags = SMSC911X_USE_16BIT | SMSC911X_FORCE_INTERNAL_PHY, | ||
156 | .shift = 1, | ||
157 | }; | ||
158 | |||
159 | static struct resource sbnet_res[] = { | ||
160 | { | ||
161 | .name = "smsc911x-memory", | ||
162 | .start = (0x5000 << 16), | ||
163 | .end = (0x5000 << 16) + 0xffff, | ||
164 | .flags = IORESOURCE_MEM, | ||
165 | }, | ||
166 | { | ||
167 | .start = NOMADIK_GPIO_TO_IRQ(140), | ||
168 | .end = NOMADIK_GPIO_TO_IRQ(140), | ||
169 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE, | ||
170 | }, | ||
171 | }; | ||
172 | |||
173 | static struct platform_device snowball_sbnet_dev = { | ||
174 | .name = "smsc911x", | ||
175 | .num_resources = ARRAY_SIZE(sbnet_res), | ||
176 | .resource = sbnet_res, | ||
177 | .dev = { | ||
178 | .platform_data = &snowball_sbnet_cfg, | ||
179 | }, | ||
180 | }; | ||
181 | |||
69 | static struct ab8500_platform_data ab8500_platdata = { | 182 | static struct ab8500_platform_data ab8500_platdata = { |
70 | .irq_base = MOP500_AB8500_IRQ_BASE, | 183 | .irq_base = MOP500_AB8500_IRQ_BASE, |
71 | .regulator_reg_init = ab8500_regulator_reg_init, | 184 | .regulator_reg_init = ab8500_regulator_reg_init, |
@@ -292,8 +405,9 @@ static void mop500_prox_deactivate(struct device *dev) | |||
292 | } | 405 | } |
293 | 406 | ||
294 | /* add any platform devices here - TODO */ | 407 | /* add any platform devices here - TODO */ |
295 | static struct platform_device *platform_devs[] __initdata = { | 408 | static struct platform_device *mop500_platform_devs[] __initdata = { |
296 | &mop500_gpio_keys_device, | 409 | &mop500_gpio_keys_device, |
410 | &ab8500_device, | ||
297 | }; | 411 | }; |
298 | 412 | ||
299 | #ifdef CONFIG_STE_DMA40 | 413 | #ifdef CONFIG_STE_DMA40 |
@@ -424,6 +538,13 @@ static void __init mop500_uart_init(void) | |||
424 | db8500_add_uart2(&uart2_plat); | 538 | db8500_add_uart2(&uart2_plat); |
425 | } | 539 | } |
426 | 540 | ||
541 | static struct platform_device *snowball_platform_devs[] __initdata = { | ||
542 | &snowball_led_dev, | ||
543 | &snowball_key_dev, | ||
544 | &snowball_sbnet_dev, | ||
545 | &ab8500_device, | ||
546 | }; | ||
547 | |||
427 | static void __init mop500_init_machine(void) | 548 | static void __init mop500_init_machine(void) |
428 | { | 549 | { |
429 | int i2c0_devs; | 550 | int i2c0_devs; |
@@ -433,24 +554,30 @@ static void __init mop500_init_machine(void) | |||
433 | * all these GPIO pins to the internal GPIO controller | 554 | * all these GPIO pins to the internal GPIO controller |
434 | * instead. | 555 | * instead. |
435 | */ | 556 | */ |
436 | if (machine_is_hrefv60()) | 557 | if (!machine_is_snowball()) { |
437 | mop500_gpio_keys[0].gpio = HREFV60_PROX_SENSE_GPIO; | 558 | if (machine_is_hrefv60()) |
438 | else | 559 | mop500_gpio_keys[0].gpio = HREFV60_PROX_SENSE_GPIO; |
439 | mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR; | 560 | else |
561 | mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR; | ||
562 | } | ||
440 | 563 | ||
441 | u8500_init_devices(); | 564 | u8500_init_devices(); |
442 | 565 | ||
443 | mop500_pins_init(); | 566 | mop500_pins_init(); |
444 | 567 | ||
445 | platform_add_devices(platform_devs, ARRAY_SIZE(platform_devs)); | 568 | if (machine_is_snowball()) |
569 | platform_add_devices(snowball_platform_devs, | ||
570 | ARRAY_SIZE(snowball_platform_devs)); | ||
571 | else | ||
572 | platform_add_devices(mop500_platform_devs, | ||
573 | ARRAY_SIZE(mop500_platform_devs)); | ||
446 | 574 | ||
447 | mop500_i2c_init(); | 575 | mop500_i2c_init(); |
448 | mop500_sdi_init(); | 576 | if (!machine_is_snowball()) |
577 | mop500_sdi_init(); | ||
449 | mop500_spi_init(); | 578 | mop500_spi_init(); |
450 | mop500_uart_init(); | 579 | mop500_uart_init(); |
451 | 580 | ||
452 | platform_device_register(&ab8500_device); | ||
453 | |||
454 | i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices); | 581 | i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices); |
455 | if (machine_is_hrefv60()) | 582 | if (machine_is_hrefv60()) |
456 | i2c0_devs -= NUM_PRE_V60_I2C0_DEVICES; | 583 | i2c0_devs -= NUM_PRE_V60_I2C0_DEVICES; |
@@ -480,3 +607,12 @@ MACHINE_START(HREFV60, "ST-Ericsson U8500 Platform HREFv60+") | |||
480 | .timer = &ux500_timer, | 607 | .timer = &ux500_timer, |
481 | .init_machine = mop500_init_machine, | 608 | .init_machine = mop500_init_machine, |
482 | MACHINE_END | 609 | MACHINE_END |
610 | |||
611 | MACHINE_START(SNOWBALL, "Calao Systems Snowball platform") | ||
612 | .boot_params = 0x100, | ||
613 | .map_io = u8500_map_io, | ||
614 | .init_irq = ux500_init_irq, | ||
615 | /* we re-use nomadik timer here */ | ||
616 | .timer = &ux500_timer, | ||
617 | .init_machine = mop500_init_machine, | ||
618 | MACHINE_END | ||