aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDmitry Eremin-Solenikov <dbaryshkov@gmail.com>2011-02-14 07:33:19 -0500
committerEric Miao <eric.y.miao@gmail.com>2011-03-16 04:33:34 -0400
commita8ecc860ef117f9405758d8d1378553afcdd9ca3 (patch)
tree1f08eacc0e52680304ea2770f41d127117130cd8 /drivers
parentef8b3cc68a1df83717bc8f9e7737084246a56ce2 (diff)
ARM: pxa25x_udc: stop handling gpio-vbus internally
Stop handling gpio-vbus internally. All boards that depended on this functionality have been converted to use gpio-vbus tranceiver. All new boards can use it right from the start. Drop unused code. Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> Signed-off-by: Eric Miao <eric.y.miao@gmail.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/gadget/pxa25x_udc.c76
1 files changed, 7 insertions, 69 deletions
diff --git a/drivers/usb/gadget/pxa25x_udc.c b/drivers/usb/gadget/pxa25x_udc.c
index b37f92cb71bc..444b60aa15e9 100644
--- a/drivers/usb/gadget/pxa25x_udc.c
+++ b/drivers/usb/gadget/pxa25x_udc.c
@@ -139,24 +139,6 @@ static const char ep0name [] = "ep0";
139static void pxa25x_ep_fifo_flush (struct usb_ep *ep); 139static void pxa25x_ep_fifo_flush (struct usb_ep *ep);
140static void nuke (struct pxa25x_ep *, int status); 140static void nuke (struct pxa25x_ep *, int status);
141 141
142/* one GPIO should be used to detect VBUS from the host */
143static int is_vbus_present(void)
144{
145 struct pxa2xx_udc_mach_info *mach = the_controller->mach;
146
147 if (gpio_is_valid(mach->gpio_vbus)) {
148 int value = gpio_get_value(mach->gpio_vbus);
149
150 if (mach->gpio_vbus_inverted)
151 return !value;
152 else
153 return !!value;
154 }
155 if (mach->udc_is_connected)
156 return mach->udc_is_connected();
157 return 1;
158}
159
160/* one GPIO should control a D+ pullup, so host sees this device (or not) */ 142/* one GPIO should control a D+ pullup, so host sees this device (or not) */
161static void pullup_off(void) 143static void pullup_off(void)
162{ 144{
@@ -1055,7 +1037,7 @@ udc_seq_show(struct seq_file *m, void *_d)
1055 "%s version: %s\nGadget driver: %s\nHost %s\n\n", 1037 "%s version: %s\nGadget driver: %s\nHost %s\n\n",
1056 driver_name, DRIVER_VERSION SIZE_STR "(pio)", 1038 driver_name, DRIVER_VERSION SIZE_STR "(pio)",
1057 dev->driver ? dev->driver->driver.name : "(none)", 1039 dev->driver ? dev->driver->driver.name : "(none)",
1058 is_vbus_present() ? "full speed" : "disconnected"); 1040 dev->gadget.speed == USB_SPEED_FULL ? "full speed" : "disconnected");
1059 1041
1060 /* registers for device and ep0 */ 1042 /* registers for device and ep0 */
1061 seq_printf(m, 1043 seq_printf(m,
@@ -1094,7 +1076,7 @@ udc_seq_show(struct seq_file *m, void *_d)
1094 (tmp & UDCCFR_ACM) ? " acm" : ""); 1076 (tmp & UDCCFR_ACM) ? " acm" : "");
1095 } 1077 }
1096 1078
1097 if (!is_vbus_present() || !dev->driver) 1079 if (dev->gadget.speed != USB_SPEED_FULL || !dev->driver)
1098 goto done; 1080 goto done;
1099 1081
1100 seq_printf(m, "ep0 IN %lu/%lu, OUT %lu/%lu\nirqs %lu\n\n", 1082 seq_printf(m, "ep0 IN %lu/%lu, OUT %lu/%lu\nirqs %lu\n\n",
@@ -1435,14 +1417,6 @@ lubbock_vbus_irq(int irq, void *_dev)
1435 1417
1436#endif 1418#endif
1437 1419
1438static irqreturn_t udc_vbus_irq(int irq, void *_dev)
1439{
1440 struct pxa25x_udc *dev = _dev;
1441
1442 pxa25x_udc_vbus_session(&dev->gadget, is_vbus_present());
1443 return IRQ_HANDLED;
1444}
1445
1446 1420
1447/*-------------------------------------------------------------------------*/ 1421/*-------------------------------------------------------------------------*/
1448 1422
@@ -1766,12 +1740,9 @@ pxa25x_udc_irq(int irq, void *_dev)
1766 if (unlikely(udccr & UDCCR_SUSIR)) { 1740 if (unlikely(udccr & UDCCR_SUSIR)) {
1767 udc_ack_int_UDCCR(UDCCR_SUSIR); 1741 udc_ack_int_UDCCR(UDCCR_SUSIR);
1768 handled = 1; 1742 handled = 1;
1769 DBG(DBG_VERBOSE, "USB suspend%s\n", is_vbus_present() 1743 DBG(DBG_VERBOSE, "USB suspend\n");
1770 ? "" : "+disconnect");
1771 1744
1772 if (!is_vbus_present()) 1745 if (dev->gadget.speed != USB_SPEED_UNKNOWN
1773 stop_activity(dev, dev->driver);
1774 else if (dev->gadget.speed != USB_SPEED_UNKNOWN
1775 && dev->driver 1746 && dev->driver
1776 && dev->driver->suspend) 1747 && dev->driver->suspend)
1777 dev->driver->suspend(&dev->gadget); 1748 dev->driver->suspend(&dev->gadget);
@@ -1786,8 +1757,7 @@ pxa25x_udc_irq(int irq, void *_dev)
1786 1757
1787 if (dev->gadget.speed != USB_SPEED_UNKNOWN 1758 if (dev->gadget.speed != USB_SPEED_UNKNOWN
1788 && dev->driver 1759 && dev->driver
1789 && dev->driver->resume 1760 && dev->driver->resume)
1790 && is_vbus_present())
1791 dev->driver->resume(&dev->gadget); 1761 dev->driver->resume(&dev->gadget);
1792 } 1762 }
1793 1763
@@ -2137,7 +2107,7 @@ static struct pxa25x_udc memory = {
2137static int __init pxa25x_udc_probe(struct platform_device *pdev) 2107static int __init pxa25x_udc_probe(struct platform_device *pdev)
2138{ 2108{
2139 struct pxa25x_udc *dev = &memory; 2109 struct pxa25x_udc *dev = &memory;
2140 int retval, vbus_irq, irq; 2110 int retval, irq;
2141 u32 chiprev; 2111 u32 chiprev;
2142 2112
2143 /* insist on Intel/ARM/XScale */ 2113 /* insist on Intel/ARM/XScale */
@@ -2199,19 +2169,6 @@ static int __init pxa25x_udc_probe(struct platform_device *pdev)
2199 2169
2200 dev->transceiver = otg_get_transceiver(); 2170 dev->transceiver = otg_get_transceiver();
2201 2171
2202 if (gpio_is_valid(dev->mach->gpio_vbus)) {
2203 if ((retval = gpio_request(dev->mach->gpio_vbus,
2204 "pxa25x_udc GPIO VBUS"))) {
2205 dev_dbg(&pdev->dev,
2206 "can't get vbus gpio %d, err: %d\n",
2207 dev->mach->gpio_vbus, retval);
2208 goto err_gpio_vbus;
2209 }
2210 gpio_direction_input(dev->mach->gpio_vbus);
2211 vbus_irq = gpio_to_irq(dev->mach->gpio_vbus);
2212 } else
2213 vbus_irq = 0;
2214
2215 if (gpio_is_valid(dev->mach->gpio_pullup)) { 2172 if (gpio_is_valid(dev->mach->gpio_pullup)) {
2216 if ((retval = gpio_request(dev->mach->gpio_pullup, 2173 if ((retval = gpio_request(dev->mach->gpio_pullup,
2217 "pca25x_udc GPIO PULLUP"))) { 2174 "pca25x_udc GPIO PULLUP"))) {
@@ -2237,7 +2194,7 @@ static int __init pxa25x_udc_probe(struct platform_device *pdev)
2237 udc_disable(dev); 2194 udc_disable(dev);
2238 udc_reinit(dev); 2195 udc_reinit(dev);
2239 2196
2240 dev->vbus = !!is_vbus_present(); 2197 dev->vbus = 0;
2241 2198
2242 /* irq setup after old hardware state is cleaned up */ 2199 /* irq setup after old hardware state is cleaned up */
2243 retval = request_irq(irq, pxa25x_udc_irq, 2200 retval = request_irq(irq, pxa25x_udc_irq,
@@ -2273,22 +2230,10 @@ lubbock_fail0:
2273 } 2230 }
2274 } else 2231 } else
2275#endif 2232#endif
2276 if (vbus_irq) {
2277 retval = request_irq(vbus_irq, udc_vbus_irq,
2278 IRQF_DISABLED | IRQF_SAMPLE_RANDOM |
2279 IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
2280 driver_name, dev);
2281 if (retval != 0) {
2282 pr_err("%s: can't get irq %i, err %d\n",
2283 driver_name, vbus_irq, retval);
2284 goto err_vbus_irq;
2285 }
2286 }
2287 create_debug_files(dev); 2233 create_debug_files(dev);
2288 2234
2289 return 0; 2235 return 0;
2290 2236
2291 err_vbus_irq:
2292#ifdef CONFIG_ARCH_LUBBOCK 2237#ifdef CONFIG_ARCH_LUBBOCK
2293 free_irq(LUBBOCK_USB_DISC_IRQ, dev); 2238 free_irq(LUBBOCK_USB_DISC_IRQ, dev);
2294 err_irq_lub: 2239 err_irq_lub:
@@ -2298,9 +2243,6 @@ lubbock_fail0:
2298 if (gpio_is_valid(dev->mach->gpio_pullup)) 2243 if (gpio_is_valid(dev->mach->gpio_pullup))
2299 gpio_free(dev->mach->gpio_pullup); 2244 gpio_free(dev->mach->gpio_pullup);
2300 err_gpio_pullup: 2245 err_gpio_pullup:
2301 if (gpio_is_valid(dev->mach->gpio_vbus))
2302 gpio_free(dev->mach->gpio_vbus);
2303 err_gpio_vbus:
2304 if (dev->transceiver) { 2246 if (dev->transceiver) {
2305 otg_put_transceiver(dev->transceiver); 2247 otg_put_transceiver(dev->transceiver);
2306 dev->transceiver = NULL; 2248 dev->transceiver = NULL;
@@ -2337,10 +2279,6 @@ static int __exit pxa25x_udc_remove(struct platform_device *pdev)
2337 free_irq(LUBBOCK_USB_IRQ, dev); 2279 free_irq(LUBBOCK_USB_IRQ, dev);
2338 } 2280 }
2339#endif 2281#endif
2340 if (gpio_is_valid(dev->mach->gpio_vbus)) {
2341 free_irq(gpio_to_irq(dev->mach->gpio_vbus), dev);
2342 gpio_free(dev->mach->gpio_vbus);
2343 }
2344 if (gpio_is_valid(dev->mach->gpio_pullup)) 2282 if (gpio_is_valid(dev->mach->gpio_pullup))
2345 gpio_free(dev->mach->gpio_pullup); 2283 gpio_free(dev->mach->gpio_pullup);
2346 2284