Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 264909
b: refs/heads/master
c: 938fbe5
h: refs/heads/master
i:
  264907: 170d43f
v: v3
  • Loading branch information
Heiko Stübner authored and Greg Kroah-Hartman committed Aug 22, 2011
1 parent 79d9420 commit e755f0d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: da4fc14c9955bbcafb9cdcc34f9772f3e9481bb8
refs/heads/master: 938fbe54f33e97c2911d0665ec613d7f0c967d9a
23 changes: 23 additions & 0 deletions trunk/drivers/usb/gadget/s3c-hsudc.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <linux/clk.h>
#include <linux/usb/ch9.h>
#include <linux/usb/gadget.h>
#include <linux/usb/otg.h>
#include <linux/prefetch.h>

#include <mach/regs-s3c2443-clock.h>
Expand Down Expand Up @@ -137,6 +138,7 @@ struct s3c_hsudc {
struct usb_gadget_driver *driver;
struct device *dev;
struct s3c24xx_hsudc_platdata *pd;
struct otg_transceiver *transceiver;
spinlock_t lock;
void __iomem *regs;
struct resource *mem_rsrc;
Expand Down Expand Up @@ -1171,6 +1173,22 @@ static int s3c_hsudc_start(struct usb_gadget_driver *driver,
return ret;
}

/* connect to bus through transceiver */
if (hsudc->transceiver) {
ret = otg_set_peripheral(hsudc->transceiver, &hsudc->gadget);
if (ret) {
dev_err(hsudc->dev, "%s: can't bind to transceiver\n",
hsudc->gadget.name);
driver->unbind(&hsudc->gadget);

device_del(&hsudc->gadget.dev);

hsudc->driver = NULL;
hsudc->gadget.dev.driver = NULL;
return ret;
}
}

enable_irq(hsudc->irq);
dev_info(hsudc->dev, "bound driver %s\n", driver->driver.name);

Expand Down Expand Up @@ -1201,6 +1219,9 @@ static int s3c_hsudc_stop(struct usb_gadget_driver *driver)
s3c_hsudc_stop_activity(hsudc, driver);
spin_unlock_irqrestore(&hsudc->lock, flags);

if (hsudc->transceiver)
(void) otg_set_peripheral(hsudc->transceiver, NULL);

driver->unbind(&hsudc->gadget);
device_del(&hsudc->gadget.dev);
disable_irq(hsudc->irq);
Expand Down Expand Up @@ -1247,6 +1268,8 @@ static int s3c_hsudc_probe(struct platform_device *pdev)
hsudc->dev = dev;
hsudc->pd = pdev->dev.platform_data;

hsudc->transceiver = otg_get_transceiver();

res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res) {
dev_err(dev, "unable to obtain driver resource data\n");
Expand Down

0 comments on commit e755f0d

Please sign in to comment.