aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2014-04-16 12:00:12 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-04-24 16:05:32 -0400
commit541e00ae0c1e1fd1e9e2bf2cf010c26d0a1ed0a0 (patch)
treece53a29073e81ad52a117800b15329d13c9fb421
parentcecabe5c349b613614fbbf822e3aeb33758a22f0 (diff)
ARM: pxa: zeus: Replace OHCI init/exit functions with a regulator
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--arch/arm/mach-pxa/zeus.c89
1 files changed, 48 insertions, 41 deletions
diff --git a/arch/arm/mach-pxa/zeus.c b/arch/arm/mach-pxa/zeus.c
index b19d1c361cab..205f9bf3821e 100644
--- a/arch/arm/mach-pxa/zeus.c
+++ b/arch/arm/mach-pxa/zeus.c
@@ -413,7 +413,7 @@ static struct fixed_voltage_config can_regulator_pdata = {
413 413
414static struct platform_device can_regulator_device = { 414static struct platform_device can_regulator_device = {
415 .name = "reg-fixed-volage", 415 .name = "reg-fixed-volage",
416 .id = -1, 416 .id = 0,
417 .dev = { 417 .dev = {
418 .platform_data = &can_regulator_pdata, 418 .platform_data = &can_regulator_pdata,
419 }, 419 },
@@ -510,18 +510,6 @@ struct platform_device zeus_max6369_device = {
510 .num_resources = 1, 510 .num_resources = 1,
511}; 511};
512 512
513static struct platform_device *zeus_devices[] __initdata = {
514 &zeus_serial_device,
515 &zeus_mtd_devices[0],
516 &zeus_dm9k0_device,
517 &zeus_dm9k1_device,
518 &zeus_sram_device,
519 &zeus_leds_device,
520 &zeus_pcmcia_device,
521 &zeus_max6369_device,
522 &can_regulator_device,
523};
524
525/* AC'97 */ 513/* AC'97 */
526static pxa2xx_audio_ops_t zeus_ac97_info = { 514static pxa2xx_audio_ops_t zeus_ac97_info = {
527 .reset_gpio = 95, 515 .reset_gpio = 95,
@@ -532,44 +520,50 @@ static pxa2xx_audio_ops_t zeus_ac97_info = {
532 * USB host 520 * USB host
533 */ 521 */
534 522
535static int zeus_ohci_init(struct device *dev) 523static struct regulator_consumer_supply zeus_ohci_regulator_supplies[] = {
536{ 524 REGULATOR_SUPPLY("vbus2", "pxa27x-ohci"),
537 int err; 525};
538
539 /* Switch on port 2. */
540 if ((err = gpio_request(ZEUS_USB2_PWREN_GPIO, "USB2_PWREN"))) {
541 dev_err(dev, "Can't request USB2_PWREN\n");
542 return err;
543 }
544
545 if ((err = gpio_direction_output(ZEUS_USB2_PWREN_GPIO, 1))) {
546 gpio_free(ZEUS_USB2_PWREN_GPIO);
547 dev_err(dev, "Can't enable USB2_PWREN\n");
548 return err;
549 }
550 526
551 /* Port 2 is shared between host and client interface. */ 527static struct regulator_init_data zeus_ohci_regulator_data = {
552 UP2OCR = UP2OCR_HXOE | UP2OCR_HXS | UP2OCR_DMPDE | UP2OCR_DPPDE; 528 .constraints = {
529 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
530 },
531 .num_consumer_supplies = ARRAY_SIZE(zeus_ohci_regulator_supplies),
532 .consumer_supplies = zeus_ohci_regulator_supplies,
533};
553 534
554 return 0; 535static struct fixed_voltage_config zeus_ohci_regulator_config = {
555} 536 .supply_name = "vbus2",
537 .microvolts = 5000000, /* 5.0V */
538 .gpio = ZEUS_USB2_PWREN_GPIO,
539 .enable_high = 1,
540 .startup_delay = 0,
541 .init_data = &zeus_ohci_regulator_data,
542};
556 543
557static void zeus_ohci_exit(struct device *dev) 544static struct platform_device zeus_ohci_regulator_device = {
558{ 545 .name = "reg-fixed-voltage",
559 /* Power-off port 2 */ 546 .id = 1,
560 gpio_direction_output(ZEUS_USB2_PWREN_GPIO, 0); 547 .dev = {
561 gpio_free(ZEUS_USB2_PWREN_GPIO); 548 .platform_data = &zeus_ohci_regulator_config,
562} 549 },
550};
563 551
564static struct pxaohci_platform_data zeus_ohci_platform_data = { 552static struct pxaohci_platform_data zeus_ohci_platform_data = {
565 .port_mode = PMM_NPS_MODE, 553 .port_mode = PMM_NPS_MODE,
566 /* Clear Power Control Polarity Low and set Power Sense 554 /* Clear Power Control Polarity Low and set Power Sense
567 * Polarity Low. Supply power to USB ports. */ 555 * Polarity Low. Supply power to USB ports. */
568 .flags = ENABLE_PORT_ALL | POWER_SENSE_LOW, 556 .flags = ENABLE_PORT_ALL | POWER_SENSE_LOW,
569 .init = zeus_ohci_init,
570 .exit = zeus_ohci_exit,
571}; 557};
572 558
559static void zeus_register_ohci(void)
560{
561 /* Port 2 is shared between host and client interface. */
562 UP2OCR = UP2OCR_HXOE | UP2OCR_HXS | UP2OCR_DMPDE | UP2OCR_DPPDE;
563
564 pxa_set_ohci_info(&zeus_ohci_platform_data);
565}
566
573/* 567/*
574 * Flat Panel 568 * Flat Panel
575 */ 569 */
@@ -677,6 +671,19 @@ static struct pxa2xx_udc_mach_info zeus_udc_info = {
677 .udc_command = zeus_udc_command, 671 .udc_command = zeus_udc_command,
678}; 672};
679 673
674static struct platform_device *zeus_devices[] __initdata = {
675 &zeus_serial_device,
676 &zeus_mtd_devices[0],
677 &zeus_dm9k0_device,
678 &zeus_dm9k1_device,
679 &zeus_sram_device,
680 &zeus_leds_device,
681 &zeus_pcmcia_device,
682 &zeus_max6369_device,
683 &can_regulator_device,
684 &zeus_ohci_regulator_device,
685};
686
680#ifdef CONFIG_PM 687#ifdef CONFIG_PM
681static void zeus_power_off(void) 688static void zeus_power_off(void)
682{ 689{
@@ -847,7 +854,7 @@ static void __init zeus_init(void)
847 854
848 platform_add_devices(zeus_devices, ARRAY_SIZE(zeus_devices)); 855 platform_add_devices(zeus_devices, ARRAY_SIZE(zeus_devices));
849 856
850 pxa_set_ohci_info(&zeus_ohci_platform_data); 857 zeus_register_ohci();
851 858
852 if (zeus_setup_fb_gpios()) 859 if (zeus_setup_fb_gpios())
853 pr_err("Failed to setup fb gpios\n"); 860 pr_err("Failed to setup fb gpios\n");