Commit 10775eb1 authored by Peter Chen's avatar Peter Chen Committed by Greg Kroah-Hartman

usb: chipidea: udc: update gadget states according to ch9

Update device states according to ch9 in USB 2.0 specification
Signed-off-by: default avatarPeter Chen <peter.chen@freescale.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ec447ab1
...@@ -709,6 +709,8 @@ __acquires(ci->lock) ...@@ -709,6 +709,8 @@ __acquires(ci->lock)
if (ci->status == NULL) if (ci->status == NULL)
retval = -ENOMEM; retval = -ENOMEM;
usb_gadget_set_state(&ci->gadget, USB_STATE_DEFAULT);
done: done:
spin_lock(&ci->lock); spin_lock(&ci->lock);
...@@ -864,6 +866,8 @@ isr_setup_status_complete(struct usb_ep *ep, struct usb_request *req) ...@@ -864,6 +866,8 @@ isr_setup_status_complete(struct usb_ep *ep, struct usb_request *req)
if (ci->setaddr) { if (ci->setaddr) {
hw_usb_set_address(ci, ci->address); hw_usb_set_address(ci, ci->address);
ci->setaddr = false; ci->setaddr = false;
if (ci->address)
usb_gadget_set_state(&ci->gadget, USB_STATE_ADDRESS);
} }
spin_lock_irqsave(&ci->lock, flags); spin_lock_irqsave(&ci->lock, flags);
...@@ -1466,7 +1470,7 @@ static int ci_udc_vbus_session(struct usb_gadget *_gadget, int is_active) ...@@ -1466,7 +1470,7 @@ static int ci_udc_vbus_session(struct usb_gadget *_gadget, int is_active)
pm_runtime_get_sync(&_gadget->dev); pm_runtime_get_sync(&_gadget->dev);
hw_device_reset(ci, USBMODE_CM_DC); hw_device_reset(ci, USBMODE_CM_DC);
hw_device_state(ci, ci->ep0out->qh.dma); hw_device_state(ci, ci->ep0out->qh.dma);
dev_dbg(ci->dev, "Connected to host\n"); usb_gadget_set_state(_gadget, USB_STATE_POWERED);
} else { } else {
if (ci->driver) if (ci->driver)
ci->driver->disconnect(&ci->gadget); ci->driver->disconnect(&ci->gadget);
...@@ -1476,7 +1480,7 @@ static int ci_udc_vbus_session(struct usb_gadget *_gadget, int is_active) ...@@ -1476,7 +1480,7 @@ static int ci_udc_vbus_session(struct usb_gadget *_gadget, int is_active)
CI_HDRC_CONTROLLER_STOPPED_EVENT); CI_HDRC_CONTROLLER_STOPPED_EVENT);
_gadget_stop_activity(&ci->gadget); _gadget_stop_activity(&ci->gadget);
pm_runtime_put_sync(&_gadget->dev); pm_runtime_put_sync(&_gadget->dev);
dev_dbg(ci->dev, "Disconnected from host\n"); usb_gadget_set_state(_gadget, USB_STATE_NOTATTACHED);
} }
} }
...@@ -1749,6 +1753,8 @@ static irqreturn_t udc_irq(struct ci_hdrc *ci) ...@@ -1749,6 +1753,8 @@ static irqreturn_t udc_irq(struct ci_hdrc *ci)
ci->suspended = 1; ci->suspended = 1;
spin_unlock(&ci->lock); spin_unlock(&ci->lock);
ci->driver->suspend(&ci->gadget); ci->driver->suspend(&ci->gadget);
usb_gadget_set_state(&ci->gadget,
USB_STATE_SUSPENDED);
spin_lock(&ci->lock); spin_lock(&ci->lock);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment