aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2011-03-07 02:42:00 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2011-03-07 15:23:22 -0500
commite27c3c5c7e0fb107990c7f465a3525312f6d45aa (patch)
tree697835d843f1310cc670511ad078e1ddd305f0ec /arch
parenta74022a55e44fe2044ac3660452cafecb300aece (diff)
ARM: s3c24xx: Switch to common GPIO controlled UDC pullup implementation
Currently all boards using the s3c2410_udc driver use a GPIO to control the state of the pullup, as a result the same code is reimplemented in each board This patch changes these boards to use the common implementation for GPIO controlled pullup in the UDC driver. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Acked-by: Vasily Khoruzhick <anarsoul@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-s3c2410/mach-h1940.c24
-rw-r--r--arch/arm/mach-s3c2410/mach-n30.c21
-rw-r--r--arch/arm/mach-s3c2412/mach-smdk2413.c24
-rw-r--r--arch/arm/mach-s3c2440/mach-gta02.c22
-rw-r--r--arch/arm/mach-s3c2440/mach-mini2440.c24
-rw-r--r--arch/arm/mach-s3c2440/mach-rx1950.c21
6 files changed, 7 insertions, 129 deletions
diff --git a/arch/arm/mach-s3c2410/mach-h1940.c b/arch/arm/mach-s3c2410/mach-h1940.c
index 1a81fe12ccd7..1e93f176c1de 100644
--- a/arch/arm/mach-s3c2410/mach-h1940.c
+++ b/arch/arm/mach-s3c2410/mach-h1940.c
@@ -162,29 +162,10 @@ struct gpio_chip h1940_latch_gpiochip = {
162 .get = h1940_gpiolib_latch_get, 162 .get = h1940_gpiolib_latch_get,
163}; 163};
164 164
165static void h1940_udc_pullup(enum s3c2410_udc_cmd_e cmd)
166{
167 printk(KERN_DEBUG "udc: pullup(%d)\n",cmd);
168
169 switch (cmd)
170 {
171 case S3C2410_UDC_P_ENABLE :
172 gpio_set_value(H1940_LATCH_USB_DP, 1);
173 break;
174 case S3C2410_UDC_P_DISABLE :
175 gpio_set_value(H1940_LATCH_USB_DP, 0);
176 break;
177 case S3C2410_UDC_P_RESET :
178 break;
179 default:
180 break;
181 }
182}
183
184static struct s3c2410_udc_mach_info h1940_udc_cfg __initdata = { 165static struct s3c2410_udc_mach_info h1940_udc_cfg __initdata = {
185 .udc_command = h1940_udc_pullup,
186 .vbus_pin = S3C2410_GPG(5), 166 .vbus_pin = S3C2410_GPG(5),
187 .vbus_pin_inverted = 1, 167 .vbus_pin_inverted = 1,
168 .pullup_pin = H1940_LATCH_USB_DP,
188}; 169};
189 170
190static struct s3c2410_ts_mach_info h1940_ts_cfg __initdata = { 171static struct s3c2410_ts_mach_info h1940_ts_cfg __initdata = {
@@ -475,9 +456,6 @@ static void __init h1940_init(void)
475 gpio_direction_output(H1940_LATCH_LCD_P4, 0); 456 gpio_direction_output(H1940_LATCH_LCD_P4, 0);
476 gpio_direction_output(H1940_LATCH_MAX1698_nSHUTDOWN, 0); 457 gpio_direction_output(H1940_LATCH_MAX1698_nSHUTDOWN, 0);
477 458
478 gpio_request(H1940_LATCH_USB_DP, "USB pullup");
479 gpio_direction_output(H1940_LATCH_USB_DP, 0);
480
481 gpio_request(H1940_LATCH_SD_POWER, "SD power"); 459 gpio_request(H1940_LATCH_SD_POWER, "SD power");
482 gpio_direction_output(H1940_LATCH_SD_POWER, 0); 460 gpio_direction_output(H1940_LATCH_SD_POWER, 0);
483 461
diff --git a/arch/arm/mach-s3c2410/mach-n30.c b/arch/arm/mach-s3c2410/mach-n30.c
index 271b9aa6d40a..66f44440d5d3 100644
--- a/arch/arm/mach-s3c2410/mach-n30.c
+++ b/arch/arm/mach-s3c2410/mach-n30.c
@@ -84,26 +84,10 @@ static struct s3c2410_uartcfg n30_uartcfgs[] = {
84 }, 84 },
85}; 85};
86 86
87static void n30_udc_pullup(enum s3c2410_udc_cmd_e cmd)
88{
89 switch (cmd) {
90 case S3C2410_UDC_P_ENABLE :
91 gpio_set_value(S3C2410_GPB(3), 1);
92 break;
93 case S3C2410_UDC_P_DISABLE :
94 gpio_set_value(S3C2410_GPB(3), 0);
95 break;
96 case S3C2410_UDC_P_RESET :
97 break;
98 default:
99 break;
100 }
101}
102
103static struct s3c2410_udc_mach_info n30_udc_cfg __initdata = { 87static struct s3c2410_udc_mach_info n30_udc_cfg __initdata = {
104 .udc_command = n30_udc_pullup,
105 .vbus_pin = S3C2410_GPG(1), 88 .vbus_pin = S3C2410_GPG(1),
106 .vbus_pin_inverted = 0, 89 .vbus_pin_inverted = 0,
90 .pullup_pin = S3C2410_GPB(3),
107}; 91};
108 92
109static struct gpio_keys_button n30_buttons[] = { 93static struct gpio_keys_button n30_buttons[] = {
@@ -596,9 +580,6 @@ static void __init n30_init(void)
596 580
597 platform_add_devices(n35_devices, ARRAY_SIZE(n35_devices)); 581 platform_add_devices(n35_devices, ARRAY_SIZE(n35_devices));
598 } 582 }
599
600 WARN_ON(gpio_request(S3C2410_GPB(3), "udc pup"));
601 gpio_direction_output(S3C2410_GPB(3), 0);
602} 583}
603 584
604MACHINE_START(N30, "Acer-N30") 585MACHINE_START(N30, "Acer-N30")
diff --git a/arch/arm/mach-s3c2412/mach-smdk2413.c b/arch/arm/mach-s3c2412/mach-smdk2413.c
index 8e5758bdd666..834cfb61bcfe 100644
--- a/arch/arm/mach-s3c2412/mach-smdk2413.c
+++ b/arch/arm/mach-s3c2412/mach-smdk2413.c
@@ -78,28 +78,9 @@ static struct s3c2410_uartcfg smdk2413_uartcfgs[] __initdata = {
78 } 78 }
79}; 79};
80 80
81static void smdk2413_udc_pullup(enum s3c2410_udc_cmd_e cmd)
82{
83 printk(KERN_DEBUG "udc: pullup(%d)\n",cmd);
84
85 switch (cmd)
86 {
87 case S3C2410_UDC_P_ENABLE :
88 gpio_set_value(S3C2410_GPF(2), 1);
89 break;
90 case S3C2410_UDC_P_DISABLE :
91 gpio_set_value(S3C2410_GPF(2), 0);
92 break;
93 case S3C2410_UDC_P_RESET :
94 break;
95 default:
96 break;
97 }
98}
99
100 81
101static struct s3c2410_udc_mach_info smdk2413_udc_cfg __initdata = { 82static struct s3c2410_udc_mach_info smdk2413_udc_cfg __initdata = {
102 .udc_command = smdk2413_udc_pullup, 83 .pullup_pin = S3C2410_GPF(2),
103}; 84};
104 85
105 86
@@ -133,9 +114,6 @@ static void __init smdk2413_machine_init(void)
133{ /* Turn off suspend on both USB ports, and switch the 114{ /* Turn off suspend on both USB ports, and switch the
134 * selectable USB port to USB device mode. */ 115 * selectable USB port to USB device mode. */
135 116
136 WARN_ON(gpio_request(S3C2410_GPF(2), "udc pull"));
137 gpio_direction_output(S3C2410_GPF(2), 0);
138
139 s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST | 117 s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST |
140 S3C2410_MISCCR_USBSUSPND0 | 118 S3C2410_MISCCR_USBSUSPND0 |
141 S3C2410_MISCCR_USBSUSPND1, 0x0); 119 S3C2410_MISCCR_USBSUSPND1, 0x0);
diff --git a/arch/arm/mach-s3c2440/mach-gta02.c b/arch/arm/mach-s3c2440/mach-gta02.c
index 9f2c14ec7181..37405d9abe32 100644
--- a/arch/arm/mach-s3c2440/mach-gta02.c
+++ b/arch/arm/mach-s3c2440/mach-gta02.c
@@ -455,28 +455,10 @@ static struct s3c2410_platform_nand __initdata gta02_nand_info = {
455}; 455};
456 456
457 457
458static void gta02_udc_command(enum s3c2410_udc_cmd_e cmd)
459{
460 switch (cmd) {
461 case S3C2410_UDC_P_ENABLE:
462 pr_debug("%s S3C2410_UDC_P_ENABLE\n", __func__);
463 gpio_direction_output(GTA02_GPIO_USB_PULLUP, 1);
464 break;
465 case S3C2410_UDC_P_DISABLE:
466 pr_debug("%s S3C2410_UDC_P_DISABLE\n", __func__);
467 gpio_direction_output(GTA02_GPIO_USB_PULLUP, 0);
468 break;
469 case S3C2410_UDC_P_RESET:
470 pr_debug("%s S3C2410_UDC_P_RESET\n", __func__);
471 /* FIXME: Do something here. */
472 }
473}
474
475/* Get PMU to set USB current limit accordingly. */ 458/* Get PMU to set USB current limit accordingly. */
476static struct s3c2410_udc_mach_info gta02_udc_cfg = { 459static struct s3c2410_udc_mach_info gta02_udc_cfg __initdata = {
477 .vbus_draw = gta02_udc_vbus_draw, 460 .vbus_draw = gta02_udc_vbus_draw,
478 .udc_command = gta02_udc_command, 461 .pullup_pin = GTA02_GPIO_USB_PULLUP,
479
480}; 462};
481 463
482/* USB */ 464/* USB */
diff --git a/arch/arm/mach-s3c2440/mach-mini2440.c b/arch/arm/mach-s3c2440/mach-mini2440.c
index f62bb4c793bd..d80f129bca94 100644
--- a/arch/arm/mach-s3c2440/mach-mini2440.c
+++ b/arch/arm/mach-s3c2440/mach-mini2440.c
@@ -97,26 +97,8 @@ static struct s3c2410_uartcfg mini2440_uartcfgs[] __initdata = {
97 97
98/* USB device UDC support */ 98/* USB device UDC support */
99 99
100static void mini2440_udc_pullup(enum s3c2410_udc_cmd_e cmd)
101{
102 pr_debug("udc: pullup(%d)\n", cmd);
103
104 switch (cmd) {
105 case S3C2410_UDC_P_ENABLE :
106 gpio_set_value(S3C2410_GPC(5), 1);
107 break;
108 case S3C2410_UDC_P_DISABLE :
109 gpio_set_value(S3C2410_GPC(5), 0);
110 break;
111 case S3C2410_UDC_P_RESET :
112 break;
113 default:
114 break;
115 }
116}
117
118static struct s3c2410_udc_mach_info mini2440_udc_cfg __initdata = { 100static struct s3c2410_udc_mach_info mini2440_udc_cfg __initdata = {
119 .udc_command = mini2440_udc_pullup, 101 .pullup_pin = S3C2410_GPC(5),
120}; 102};
121 103
122 104
@@ -644,10 +626,6 @@ static void __init mini2440_init(void)
644 s3c2410_gpio_setpin(S3C2410_GPB(1), 0); 626 s3c2410_gpio_setpin(S3C2410_GPB(1), 0);
645 s3c_gpio_cfgpin(S3C2410_GPB(1), S3C2410_GPIO_INPUT); 627 s3c_gpio_cfgpin(S3C2410_GPB(1), S3C2410_GPIO_INPUT);
646 628
647 /* Make sure the D+ pullup pin is output */
648 WARN_ON(gpio_request(S3C2410_GPC(5), "udc pup"));
649 gpio_direction_output(S3C2410_GPC(5), 0);
650
651 /* mark the key as input, without pullups (there is one on the board) */ 629 /* mark the key as input, without pullups (there is one on the board) */
652 for (i = 0; i < ARRAY_SIZE(mini2440_buttons); i++) { 630 for (i = 0; i < ARRAY_SIZE(mini2440_buttons); i++) {
653 s3c_gpio_setpull(mini2440_buttons[i].gpio, S3C_GPIO_PULL_UP); 631 s3c_gpio_setpull(mini2440_buttons[i].gpio, S3C_GPIO_PULL_UP);
diff --git a/arch/arm/mach-s3c2440/mach-rx1950.c b/arch/arm/mach-s3c2440/mach-rx1950.c
index eab6ae50683c..86bbc233b31c 100644
--- a/arch/arm/mach-s3c2440/mach-rx1950.c
+++ b/arch/arm/mach-s3c2440/mach-rx1950.c
@@ -566,26 +566,10 @@ static struct s3c2410_platform_nand rx1950_nand_info = {
566 .sets = rx1950_nand_sets, 566 .sets = rx1950_nand_sets,
567}; 567};
568 568
569static void rx1950_udc_pullup(enum s3c2410_udc_cmd_e cmd)
570{
571 switch (cmd) {
572 case S3C2410_UDC_P_ENABLE:
573 gpio_direction_output(S3C2410_GPJ(5), 1);
574 break;
575 case S3C2410_UDC_P_DISABLE:
576 gpio_direction_output(S3C2410_GPJ(5), 0);
577 break;
578 case S3C2410_UDC_P_RESET:
579 break;
580 default:
581 break;
582 }
583}
584
585static struct s3c2410_udc_mach_info rx1950_udc_cfg __initdata = { 569static struct s3c2410_udc_mach_info rx1950_udc_cfg __initdata = {
586 .udc_command = rx1950_udc_pullup,
587 .vbus_pin = S3C2410_GPG(5), 570 .vbus_pin = S3C2410_GPG(5),
588 .vbus_pin_inverted = 1, 571 .vbus_pin_inverted = 1,
572 .pullup_pin = S3C2410_GPJ(5),
589}; 573};
590 574
591static struct s3c2410_ts_mach_info rx1950_ts_cfg __initdata = { 575static struct s3c2410_ts_mach_info rx1950_ts_cfg __initdata = {
@@ -750,9 +734,6 @@ static void __init rx1950_init_machine(void)
750 S3C2410_MISCCR_USBSUSPND0 | 734 S3C2410_MISCCR_USBSUSPND0 |
751 S3C2410_MISCCR_USBSUSPND1, 0x0); 735 S3C2410_MISCCR_USBSUSPND1, 0x0);
752 736
753 WARN_ON(gpio_request(S3C2410_GPJ(5), "UDC pullup"));
754 gpio_direction_output(S3C2410_GPJ(5), 0);
755
756 /* mmc power is disabled by default */ 737 /* mmc power is disabled by default */
757 WARN_ON(gpio_request(S3C2410_GPJ(1), "MMC power")); 738 WARN_ON(gpio_request(S3C2410_GPJ(1), "MMC power"));
758 gpio_direction_output(S3C2410_GPJ(1), 0); 739 gpio_direction_output(S3C2410_GPJ(1), 0);