diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-omap1/Kconfig | 2 | ||||
-rw-r--r-- | arch/arm/mach-omap1/board-ams-delta.c | 116 | ||||
-rw-r--r-- | arch/arm/plat-omap/include/plat/board-ams-delta.h | 1 |
3 files changed, 98 insertions, 21 deletions
diff --git a/arch/arm/mach-omap1/Kconfig b/arch/arm/mach-omap1/Kconfig index 5b1edbae6893..4b6a774606cb 100644 --- a/arch/arm/mach-omap1/Kconfig +++ b/arch/arm/mach-omap1/Kconfig | |||
@@ -157,6 +157,8 @@ config MACH_AMS_DELTA | |||
157 | select FIQ | 157 | select FIQ |
158 | select GPIO_GENERIC_PLATFORM | 158 | select GPIO_GENERIC_PLATFORM |
159 | select LEDS_GPIO_REGISTER | 159 | select LEDS_GPIO_REGISTER |
160 | select REGULATOR | ||
161 | select REGULATOR_FIXED_VOLTAGE | ||
160 | help | 162 | help |
161 | Support for the Amstrad E3 (codename Delta) videophone. Say Y here | 163 | Support for the Amstrad E3 (codename Delta) videophone. Say Y here |
162 | if you have such a device. | 164 | if you have such a device. |
diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c index 87b13039f936..cb6afe670468 100644 --- a/arch/arm/mach-omap1/board-ams-delta.c +++ b/arch/arm/mach-omap1/board-ams-delta.c | |||
@@ -19,6 +19,9 @@ | |||
19 | #include <linux/interrupt.h> | 19 | #include <linux/interrupt.h> |
20 | #include <linux/leds.h> | 20 | #include <linux/leds.h> |
21 | #include <linux/platform_device.h> | 21 | #include <linux/platform_device.h> |
22 | #include <linux/regulator/consumer.h> | ||
23 | #include <linux/regulator/fixed.h> | ||
24 | #include <linux/regulator/machine.h> | ||
22 | #include <linux/serial_8250.h> | 25 | #include <linux/serial_8250.h> |
23 | #include <linux/export.h> | 26 | #include <linux/export.h> |
24 | 27 | ||
@@ -150,11 +153,11 @@ static struct map_desc ams_delta_io_desc[] __initdata = { | |||
150 | } | 153 | } |
151 | }; | 154 | }; |
152 | 155 | ||
153 | static struct omap_lcd_config ams_delta_lcd_config = { | 156 | static struct omap_lcd_config ams_delta_lcd_config __initdata = { |
154 | .ctrl_name = "internal", | 157 | .ctrl_name = "internal", |
155 | }; | 158 | }; |
156 | 159 | ||
157 | static struct omap_usb_config ams_delta_usb_config __initdata = { | 160 | static struct omap_usb_config ams_delta_usb_config = { |
158 | .register_host = 1, | 161 | .register_host = 1, |
159 | .hmc_mode = 16, | 162 | .hmc_mode = 16, |
160 | .pins[0] = 2, | 163 | .pins[0] = 2, |
@@ -167,7 +170,7 @@ static struct omap_board_config_kernel ams_delta_config[] __initdata = { | |||
167 | #define LATCH1_GPIO_BASE 232 | 170 | #define LATCH1_GPIO_BASE 232 |
168 | #define LATCH1_NGPIO 8 | 171 | #define LATCH1_NGPIO 8 |
169 | 172 | ||
170 | static struct resource latch1_resources[] __initconst = { | 173 | static struct resource latch1_resources[] = { |
171 | [0] = { | 174 | [0] = { |
172 | .name = "dat", | 175 | .name = "dat", |
173 | .start = LATCH1_PHYS, | 176 | .start = LATCH1_PHYS, |
@@ -176,7 +179,7 @@ static struct resource latch1_resources[] __initconst = { | |||
176 | }, | 179 | }, |
177 | }; | 180 | }; |
178 | 181 | ||
179 | static struct bgpio_pdata latch1_pdata __initconst = { | 182 | static struct bgpio_pdata latch1_pdata = { |
180 | .base = LATCH1_GPIO_BASE, | 183 | .base = LATCH1_GPIO_BASE, |
181 | .ngpio = LATCH1_NGPIO, | 184 | .ngpio = LATCH1_NGPIO, |
182 | }; | 185 | }; |
@@ -191,7 +194,7 @@ static struct platform_device latch1_gpio_device = { | |||
191 | }, | 194 | }, |
192 | }; | 195 | }; |
193 | 196 | ||
194 | static struct resource latch2_resources[] __initconst = { | 197 | static struct resource latch2_resources[] = { |
195 | [0] = { | 198 | [0] = { |
196 | .name = "dat", | 199 | .name = "dat", |
197 | .start = LATCH2_PHYS, | 200 | .start = LATCH2_PHYS, |
@@ -200,7 +203,7 @@ static struct resource latch2_resources[] __initconst = { | |||
200 | }, | 203 | }, |
201 | }; | 204 | }; |
202 | 205 | ||
203 | static struct bgpio_pdata latch2_pdata __initconst = { | 206 | static struct bgpio_pdata latch2_pdata = { |
204 | .base = AMS_DELTA_LATCH2_GPIO_BASE, | 207 | .base = AMS_DELTA_LATCH2_GPIO_BASE, |
205 | .ngpio = AMS_DELTA_LATCH2_NGPIO, | 208 | .ngpio = AMS_DELTA_LATCH2_NGPIO, |
206 | }; | 209 | }; |
@@ -215,7 +218,7 @@ static struct platform_device latch2_gpio_device = { | |||
215 | }, | 218 | }, |
216 | }; | 219 | }; |
217 | 220 | ||
218 | static struct gpio latch_gpios[] __initconst = { | 221 | static const struct gpio latch_gpios[] __initconst = { |
219 | { | 222 | { |
220 | .gpio = LATCH1_GPIO_BASE + 6, | 223 | .gpio = LATCH1_GPIO_BASE + 6, |
221 | .flags = GPIOF_OUT_INIT_LOW, | 224 | .flags = GPIOF_OUT_INIT_LOW, |
@@ -237,11 +240,6 @@ static struct gpio latch_gpios[] __initconst = { | |||
237 | .label = "scard_cmdvcc", | 240 | .label = "scard_cmdvcc", |
238 | }, | 241 | }, |
239 | { | 242 | { |
240 | .gpio = AMS_DELTA_GPIO_PIN_MODEM_NRESET, | ||
241 | .flags = GPIOF_OUT_INIT_LOW, | ||
242 | .label = "modem_nreset", | ||
243 | }, | ||
244 | { | ||
245 | .gpio = AMS_DELTA_GPIO_PIN_MODEM_CODEC, | 243 | .gpio = AMS_DELTA_GPIO_PIN_MODEM_CODEC, |
246 | .flags = GPIOF_OUT_INIT_LOW, | 244 | .flags = GPIOF_OUT_INIT_LOW, |
247 | .label = "modem_codec", | 245 | .label = "modem_codec", |
@@ -258,6 +256,44 @@ static struct gpio latch_gpios[] __initconst = { | |||
258 | }, | 256 | }, |
259 | }; | 257 | }; |
260 | 258 | ||
259 | static struct regulator_consumer_supply modem_nreset_consumers[] = { | ||
260 | REGULATOR_SUPPLY("RESET#", "serial8250.1"), | ||
261 | REGULATOR_SUPPLY("POR", "cx20442-codec"), | ||
262 | }; | ||
263 | |||
264 | static struct regulator_init_data modem_nreset_data = { | ||
265 | .constraints = { | ||
266 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
267 | .boot_on = 1, | ||
268 | }, | ||
269 | .num_consumer_supplies = ARRAY_SIZE(modem_nreset_consumers), | ||
270 | .consumer_supplies = modem_nreset_consumers, | ||
271 | }; | ||
272 | |||
273 | static struct fixed_voltage_config modem_nreset_config = { | ||
274 | .supply_name = "modem_nreset", | ||
275 | .microvolts = 3300000, | ||
276 | .gpio = AMS_DELTA_GPIO_PIN_MODEM_NRESET, | ||
277 | .startup_delay = 25000, | ||
278 | .enable_high = 1, | ||
279 | .enabled_at_boot = 1, | ||
280 | .init_data = &modem_nreset_data, | ||
281 | }; | ||
282 | |||
283 | static struct platform_device modem_nreset_device = { | ||
284 | .name = "reg-fixed-voltage", | ||
285 | .id = -1, | ||
286 | .dev = { | ||
287 | .platform_data = &modem_nreset_config, | ||
288 | }, | ||
289 | }; | ||
290 | |||
291 | struct modem_private_data { | ||
292 | struct regulator *regulator; | ||
293 | }; | ||
294 | |||
295 | static struct modem_private_data modem_priv; | ||
296 | |||
261 | void ams_delta_latch_write(int base, int ngpio, u16 mask, u16 value) | 297 | void ams_delta_latch_write(int base, int ngpio, u16 mask, u16 value) |
262 | { | 298 | { |
263 | int bit = 0; | 299 | int bit = 0; |
@@ -266,7 +302,8 @@ void ams_delta_latch_write(int base, int ngpio, u16 mask, u16 value) | |||
266 | for (; bit < ngpio; bit++, bitpos = bitpos << 1) { | 302 | for (; bit < ngpio; bit++, bitpos = bitpos << 1) { |
267 | if (!(mask & bitpos)) | 303 | if (!(mask & bitpos)) |
268 | continue; | 304 | continue; |
269 | gpio_set_value(base + bit, (value & bitpos) != 0); | 305 | else |
306 | gpio_set_value(base + bit, (value & bitpos) != 0); | ||
270 | } | 307 | } |
271 | } | 308 | } |
272 | EXPORT_SYMBOL(ams_delta_latch_write); | 309 | EXPORT_SYMBOL(ams_delta_latch_write); |
@@ -300,7 +337,7 @@ static const struct matrix_keymap_data ams_delta_keymap_data = { | |||
300 | .keymap_size = ARRAY_SIZE(ams_delta_keymap), | 337 | .keymap_size = ARRAY_SIZE(ams_delta_keymap), |
301 | }; | 338 | }; |
302 | 339 | ||
303 | static struct omap_kp_platform_data ams_delta_kp_data __initdata = { | 340 | static struct omap_kp_platform_data ams_delta_kp_data = { |
304 | .rows = 8, | 341 | .rows = 8, |
305 | .cols = 8, | 342 | .cols = 8, |
306 | .keymap_data = &ams_delta_keymap_data, | 343 | .keymap_data = &ams_delta_keymap_data, |
@@ -322,7 +359,7 @@ static struct platform_device ams_delta_lcd_device = { | |||
322 | .id = -1, | 359 | .id = -1, |
323 | }; | 360 | }; |
324 | 361 | ||
325 | static struct gpio_led gpio_leds[] __initconst = { | 362 | static const struct gpio_led gpio_leds[] __initconst = { |
326 | { | 363 | { |
327 | .name = "camera", | 364 | .name = "camera", |
328 | .gpio = LATCH1_GPIO_BASE + 0, | 365 | .gpio = LATCH1_GPIO_BASE + 0, |
@@ -358,7 +395,7 @@ static struct gpio_led gpio_leds[] __initconst = { | |||
358 | }, | 395 | }, |
359 | }; | 396 | }; |
360 | 397 | ||
361 | static struct gpio_led_platform_data leds_pdata __initconst = { | 398 | static const struct gpio_led_platform_data leds_pdata __initconst = { |
362 | .leds = gpio_leds, | 399 | .leds = gpio_leds, |
363 | .num_leds = ARRAY_SIZE(gpio_leds), | 400 | .num_leds = ARRAY_SIZE(gpio_leds), |
364 | }; | 401 | }; |
@@ -415,7 +452,7 @@ static struct platform_device *ams_delta_devices[] __initdata = { | |||
415 | &ams_delta_camera_device, | 452 | &ams_delta_camera_device, |
416 | }; | 453 | }; |
417 | 454 | ||
418 | static struct platform_device *late_devices[] __initconst = { | 455 | static struct platform_device *late_devices[] __initdata = { |
419 | &ams_delta_nand_device, | 456 | &ams_delta_nand_device, |
420 | &ams_delta_lcd_device, | 457 | &ams_delta_lcd_device, |
421 | }; | 458 | }; |
@@ -459,6 +496,22 @@ static void __init ams_delta_init(void) | |||
459 | omap_writew(omap_readw(ARM_RSTCT1) | 0x0004, ARM_RSTCT1); | 496 | omap_writew(omap_readw(ARM_RSTCT1) | 0x0004, ARM_RSTCT1); |
460 | } | 497 | } |
461 | 498 | ||
499 | static void modem_pm(struct uart_port *port, unsigned int state, unsigned old) | ||
500 | { | ||
501 | struct modem_private_data *priv = port->private_data; | ||
502 | |||
503 | if (IS_ERR(priv->regulator)) | ||
504 | return; | ||
505 | |||
506 | if (state == old) | ||
507 | return; | ||
508 | |||
509 | if (state == 0) | ||
510 | regulator_enable(priv->regulator); | ||
511 | else if (old == 0) | ||
512 | regulator_disable(priv->regulator); | ||
513 | } | ||
514 | |||
462 | static struct plat_serial8250_port ams_delta_modem_ports[] = { | 515 | static struct plat_serial8250_port ams_delta_modem_ports[] = { |
463 | { | 516 | { |
464 | .membase = IOMEM(MODEM_VIRT), | 517 | .membase = IOMEM(MODEM_VIRT), |
@@ -469,6 +522,8 @@ static struct plat_serial8250_port ams_delta_modem_ports[] = { | |||
469 | .iotype = UPIO_MEM, | 522 | .iotype = UPIO_MEM, |
470 | .regshift = 1, | 523 | .regshift = 1, |
471 | .uartclk = BASE_BAUD * 16, | 524 | .uartclk = BASE_BAUD * 16, |
525 | .pm = modem_pm, | ||
526 | .private_data = &modem_priv, | ||
472 | }, | 527 | }, |
473 | { }, | 528 | { }, |
474 | }; | 529 | }; |
@@ -496,6 +551,12 @@ static int __init late_init(void) | |||
496 | 551 | ||
497 | platform_add_devices(late_devices, ARRAY_SIZE(late_devices)); | 552 | platform_add_devices(late_devices, ARRAY_SIZE(late_devices)); |
498 | 553 | ||
554 | err = platform_device_register(&modem_nreset_device); | ||
555 | if (err) { | ||
556 | pr_err("Couldn't register the modem regulator device\n"); | ||
557 | return err; | ||
558 | } | ||
559 | |||
499 | omap_cfg_reg(M14_1510_GPIO2); | 560 | omap_cfg_reg(M14_1510_GPIO2); |
500 | ams_delta_modem_ports[0].irq = | 561 | ams_delta_modem_ports[0].irq = |
501 | gpio_to_irq(AMS_DELTA_GPIO_PIN_MODEM_IRQ); | 562 | gpio_to_irq(AMS_DELTA_GPIO_PIN_MODEM_IRQ); |
@@ -507,15 +568,30 @@ static int __init late_init(void) | |||
507 | } | 568 | } |
508 | gpio_direction_input(AMS_DELTA_GPIO_PIN_MODEM_IRQ); | 569 | gpio_direction_input(AMS_DELTA_GPIO_PIN_MODEM_IRQ); |
509 | 570 | ||
510 | ams_delta_latch2_write( | 571 | /* Initialize the modem_nreset regulator consumer before use */ |
511 | AMS_DELTA_LATCH2_MODEM_NRESET | AMS_DELTA_LATCH2_MODEM_CODEC, | 572 | modem_priv.regulator = ERR_PTR(-ENODEV); |
512 | AMS_DELTA_LATCH2_MODEM_NRESET | AMS_DELTA_LATCH2_MODEM_CODEC); | 573 | |
574 | ams_delta_latch2_write(AMS_DELTA_LATCH2_MODEM_CODEC, | ||
575 | AMS_DELTA_LATCH2_MODEM_CODEC); | ||
513 | 576 | ||
514 | err = platform_device_register(&ams_delta_modem_device); | 577 | err = platform_device_register(&ams_delta_modem_device); |
515 | if (err) | 578 | if (err) |
516 | goto gpio_free; | 579 | goto gpio_free; |
580 | |||
581 | /* | ||
582 | * Once the modem device is registered, the modem_nreset | ||
583 | * regulator can be requested on behalf of that device. | ||
584 | */ | ||
585 | modem_priv.regulator = regulator_get(&ams_delta_modem_device.dev, | ||
586 | "RESET#"); | ||
587 | if (IS_ERR(modem_priv.regulator)) { | ||
588 | err = PTR_ERR(modem_priv.regulator); | ||
589 | goto unregister; | ||
590 | } | ||
517 | return 0; | 591 | return 0; |
518 | 592 | ||
593 | unregister: | ||
594 | platform_device_unregister(&ams_delta_modem_device); | ||
519 | gpio_free: | 595 | gpio_free: |
520 | gpio_free(AMS_DELTA_GPIO_PIN_MODEM_IRQ); | 596 | gpio_free(AMS_DELTA_GPIO_PIN_MODEM_IRQ); |
521 | return err; | 597 | return err; |
diff --git a/arch/arm/plat-omap/include/plat/board-ams-delta.h b/arch/arm/plat-omap/include/plat/board-ams-delta.h index 027e79eead5e..ad6f865d1f16 100644 --- a/arch/arm/plat-omap/include/plat/board-ams-delta.h +++ b/arch/arm/plat-omap/include/plat/board-ams-delta.h | |||
@@ -30,7 +30,6 @@ | |||
30 | 30 | ||
31 | #define AMD_DELTA_LATCH2_SCARD_RSTIN 0x0400 | 31 | #define AMD_DELTA_LATCH2_SCARD_RSTIN 0x0400 |
32 | #define AMD_DELTA_LATCH2_SCARD_CMDVCC 0x0800 | 32 | #define AMD_DELTA_LATCH2_SCARD_CMDVCC 0x0800 |
33 | #define AMS_DELTA_LATCH2_MODEM_NRESET 0x1000 | ||
34 | #define AMS_DELTA_LATCH2_MODEM_CODEC 0x2000 | 33 | #define AMS_DELTA_LATCH2_MODEM_CODEC 0x2000 |
35 | 34 | ||
36 | #define AMS_DELTA_GPIO_PIN_KEYBRD_DATA 0 | 35 | #define AMS_DELTA_GPIO_PIN_KEYBRD_DATA 0 |