aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/s3c-hsotg.c
diff options
context:
space:
mode:
authorLukasz Majewski <l.majewski@samsung.com>2012-06-22 03:29:56 -0400
committerFelipe Balbi <balbi@ti.com>2012-06-22 06:25:02 -0400
commita188b6897e3dca82dd6f5beceabf1fc62b9786d9 (patch)
treea193fdafdae4b81336e06d6b38b82e39842a925e /drivers/usb/gadget/s3c-hsotg.c
parentd6e16a89578fcc8834be634c85c5c5ddc2d13229 (diff)
usb: gadget: hsotg: pullup method implementation for s3c-hsotg UDC driver
This commit adds pullup method implementation for UDC s3c-hsotg driver. It is needed for e.g. CCG - Configurable Composite Gadget, when user space configuration change request device disconnection from USB bus (done via calling usb_gadget_connect/disconnect, which calls UDC's pullup method). Implementation of pullup method has caused removal of phy_enable and core_init methods from udc_start to pullup. Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/gadget/s3c-hsotg.c')
-rw-r--r--drivers/usb/gadget/s3c-hsotg.c33
1 files changed, 30 insertions, 3 deletions
diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c
index d208c46341d7..75a28e6d3761 100644
--- a/drivers/usb/gadget/s3c-hsotg.c
+++ b/drivers/usb/gadget/s3c-hsotg.c
@@ -2963,9 +2963,6 @@ static int s3c_hsotg_udc_start(struct usb_gadget *gadget,
2963 goto err; 2963 goto err;
2964 } 2964 }
2965 2965
2966 s3c_hsotg_phy_enable(hsotg);
2967
2968 s3c_hsotg_core_init(hsotg);
2969 hsotg->last_rst = jiffies; 2966 hsotg->last_rst = jiffies;
2970 dev_info(hsotg->dev, "bound driver %s\n", driver->driver.name); 2967 dev_info(hsotg->dev, "bound driver %s\n", driver->driver.name);
2971 return 0; 2968 return 0;
@@ -3028,10 +3025,40 @@ static int s3c_hsotg_gadget_getframe(struct usb_gadget *gadget)
3028 return s3c_hsotg_read_frameno(to_hsotg(gadget)); 3025 return s3c_hsotg_read_frameno(to_hsotg(gadget));
3029} 3026}
3030 3027
3028/**
3029 * s3c_hsotg_pullup - connect/disconnect the USB PHY
3030 * @gadget: The usb gadget state
3031 * @is_on: Current state of the USB PHY
3032 *
3033 * Connect/Disconnect the USB PHY pullup
3034 */
3035static int s3c_hsotg_pullup(struct usb_gadget *gadget, int is_on)
3036{
3037 struct s3c_hsotg *hsotg = to_hsotg(gadget);
3038 unsigned long flags = 0;
3039
3040 dev_dbg(hsotg->dev, "%s: is_in: %d\n", __func__, is_on);
3041
3042 spin_lock_irqsave(&hsotg->lock, flags);
3043 if (is_on) {
3044 s3c_hsotg_phy_enable(hsotg);
3045 s3c_hsotg_core_init(hsotg);
3046 } else {
3047 s3c_hsotg_disconnect(hsotg);
3048 s3c_hsotg_phy_disable(hsotg);
3049 }
3050
3051 hsotg->gadget.speed = USB_SPEED_UNKNOWN;
3052 spin_unlock_irqrestore(&hsotg->lock, flags);
3053
3054 return 0;
3055}
3056
3031static struct usb_gadget_ops s3c_hsotg_gadget_ops = { 3057static struct usb_gadget_ops s3c_hsotg_gadget_ops = {
3032 .get_frame = s3c_hsotg_gadget_getframe, 3058 .get_frame = s3c_hsotg_gadget_getframe,
3033 .udc_start = s3c_hsotg_udc_start, 3059 .udc_start = s3c_hsotg_udc_start,
3034 .udc_stop = s3c_hsotg_udc_stop, 3060 .udc_stop = s3c_hsotg_udc_stop,
3061 .pullup = s3c_hsotg_pullup,
3035}; 3062};
3036 3063
3037/** 3064/**