diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2011-12-12 18:19:40 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-12-12 18:19:53 -0500 |
commit | 007d00d4c11b30b8fd7ff23b9d5aed3743e41f74 (patch) | |
tree | d5c307ba2ee0e2f56fbc284db21b8bccf95d8a40 /drivers/usb/renesas_usbhs | |
parent | c91043adaf50ef13609003120f3471783460fb71 (diff) | |
parent | 68d3e668d245bb8300c7c6ddbc8508ddfe352e0f (diff) |
Merge branch 'for-next/dwc3' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next
* 'for-next/dwc3' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb: (392 commits)
usb: dwc3: ep0: fix for possible early delayed_status
usb: dwc3: gadget: fix stream enable bit
usb: dwc3: ep0: fix GetStatus handling (again)
usb: dwc3: ep0: use dwc3_request for ep0 requsts instead of usb_request
usb: dwc3: use correct hwparam register for power mgm check
usb: dwc3: omap: move to module_platform_driver
usb: dwc3: workaround: missing disconnect event
usb: dwc3: workaround: missing USB3 Reset event
usb: dwc3: workaround: U1/U2 -> U0 transiton
usb: dwc3: gadget: return early in dwc3_cleanup_done_reqs()
usb: dwc3: ep0: handle delayed_status again
usb: dwc3: ep0: push ep0state into xfernotready processing
usb: dwc3: fix sparse errors
usb: dwc3: fix few coding style problems
usb: dwc3: move generic dwc3 code from gadget into core
usb: dwc3: use a helper function for operation mode setting
usb: dwc3: ep0: don't use ep0in for transfers
usb: dwc3: ep0: use proper endianess in SetFeature for wIndex
usb: dwc3: core: drop DWC3_EVENT_BUFFERS_MAX
usb: dwc3: omap: add multiple instances support to OMAP
...
Diffstat (limited to 'drivers/usb/renesas_usbhs')
-rw-r--r-- | drivers/usb/renesas_usbhs/mod_gadget.c | 47 |
1 files changed, 20 insertions, 27 deletions
diff --git a/drivers/usb/renesas_usbhs/mod_gadget.c b/drivers/usb/renesas_usbhs/mod_gadget.c index d9717e0bc1ff..7f4e80338570 100644 --- a/drivers/usb/renesas_usbhs/mod_gadget.c +++ b/drivers/usb/renesas_usbhs/mod_gadget.c | |||
@@ -751,53 +751,32 @@ static int usbhsg_gadget_start(struct usb_gadget *gadget, | |||
751 | struct usb_gadget_driver *driver) | 751 | struct usb_gadget_driver *driver) |
752 | { | 752 | { |
753 | struct usbhsg_gpriv *gpriv = usbhsg_gadget_to_gpriv(gadget); | 753 | struct usbhsg_gpriv *gpriv = usbhsg_gadget_to_gpriv(gadget); |
754 | struct usbhs_priv *priv; | 754 | struct usbhs_priv *priv = usbhsg_gpriv_to_priv(gpriv); |
755 | struct device *dev; | ||
756 | int ret; | ||
757 | 755 | ||
758 | if (!driver || | 756 | if (!driver || |
759 | !driver->setup || | 757 | !driver->setup || |
760 | driver->speed != USB_SPEED_HIGH) | 758 | driver->speed < USB_SPEED_FULL) |
761 | return -EINVAL; | 759 | return -EINVAL; |
762 | 760 | ||
763 | dev = usbhsg_gpriv_to_dev(gpriv); | ||
764 | priv = usbhsg_gpriv_to_priv(gpriv); | ||
765 | |||
766 | /* first hook up the driver ... */ | 761 | /* first hook up the driver ... */ |
767 | gpriv->driver = driver; | 762 | gpriv->driver = driver; |
768 | gpriv->gadget.dev.driver = &driver->driver; | 763 | gpriv->gadget.dev.driver = &driver->driver; |
769 | 764 | ||
770 | ret = device_add(&gpriv->gadget.dev); | ||
771 | if (ret) { | ||
772 | dev_err(dev, "device_add error %d\n", ret); | ||
773 | goto add_fail; | ||
774 | } | ||
775 | |||
776 | return usbhsg_try_start(priv, USBHSG_STATUS_REGISTERD); | 765 | return usbhsg_try_start(priv, USBHSG_STATUS_REGISTERD); |
777 | |||
778 | add_fail: | ||
779 | gpriv->driver = NULL; | ||
780 | gpriv->gadget.dev.driver = NULL; | ||
781 | |||
782 | return ret; | ||
783 | } | 766 | } |
784 | 767 | ||
785 | static int usbhsg_gadget_stop(struct usb_gadget *gadget, | 768 | static int usbhsg_gadget_stop(struct usb_gadget *gadget, |
786 | struct usb_gadget_driver *driver) | 769 | struct usb_gadget_driver *driver) |
787 | { | 770 | { |
788 | struct usbhsg_gpriv *gpriv = usbhsg_gadget_to_gpriv(gadget); | 771 | struct usbhsg_gpriv *gpriv = usbhsg_gadget_to_gpriv(gadget); |
789 | struct usbhs_priv *priv; | 772 | struct usbhs_priv *priv = usbhsg_gpriv_to_priv(gpriv); |
790 | struct device *dev; | ||
791 | 773 | ||
792 | if (!driver || | 774 | if (!driver || |
793 | !driver->unbind) | 775 | !driver->unbind) |
794 | return -EINVAL; | 776 | return -EINVAL; |
795 | 777 | ||
796 | dev = usbhsg_gpriv_to_dev(gpriv); | ||
797 | priv = usbhsg_gpriv_to_priv(gpriv); | ||
798 | |||
799 | usbhsg_try_stop(priv, USBHSG_STATUS_REGISTERD); | 778 | usbhsg_try_stop(priv, USBHSG_STATUS_REGISTERD); |
800 | device_del(&gpriv->gadget.dev); | 779 | gpriv->gadget.dev.driver = NULL; |
801 | gpriv->driver = NULL; | 780 | gpriv->driver = NULL; |
802 | 781 | ||
803 | return 0; | 782 | return 0; |
@@ -827,6 +806,13 @@ static int usbhsg_start(struct usbhs_priv *priv) | |||
827 | 806 | ||
828 | static int usbhsg_stop(struct usbhs_priv *priv) | 807 | static int usbhsg_stop(struct usbhs_priv *priv) |
829 | { | 808 | { |
809 | struct usbhsg_gpriv *gpriv = usbhsg_priv_to_gpriv(priv); | ||
810 | |||
811 | /* cable disconnect */ | ||
812 | if (gpriv->driver && | ||
813 | gpriv->driver->disconnect) | ||
814 | gpriv->driver->disconnect(&gpriv->gadget); | ||
815 | |||
830 | return usbhsg_try_stop(priv, USBHSG_STATUS_STARTED); | 816 | return usbhsg_try_stop(priv, USBHSG_STATUS_STARTED); |
831 | } | 817 | } |
832 | 818 | ||
@@ -876,12 +862,14 @@ int usbhs_mod_gadget_probe(struct usbhs_priv *priv) | |||
876 | /* | 862 | /* |
877 | * init gadget | 863 | * init gadget |
878 | */ | 864 | */ |
879 | device_initialize(&gpriv->gadget.dev); | ||
880 | dev_set_name(&gpriv->gadget.dev, "gadget"); | 865 | dev_set_name(&gpriv->gadget.dev, "gadget"); |
881 | gpriv->gadget.dev.parent = dev; | 866 | gpriv->gadget.dev.parent = dev; |
882 | gpriv->gadget.name = "renesas_usbhs_udc"; | 867 | gpriv->gadget.name = "renesas_usbhs_udc"; |
883 | gpriv->gadget.ops = &usbhsg_gadget_ops; | 868 | gpriv->gadget.ops = &usbhsg_gadget_ops; |
884 | gpriv->gadget.is_dualspeed = 1; | 869 | gpriv->gadget.is_dualspeed = 1; |
870 | ret = device_register(&gpriv->gadget.dev); | ||
871 | if (ret < 0) | ||
872 | goto err_add_udc; | ||
885 | 873 | ||
886 | INIT_LIST_HEAD(&gpriv->gadget.ep_list); | 874 | INIT_LIST_HEAD(&gpriv->gadget.ep_list); |
887 | 875 | ||
@@ -912,12 +900,15 @@ int usbhs_mod_gadget_probe(struct usbhs_priv *priv) | |||
912 | 900 | ||
913 | ret = usb_add_gadget_udc(dev, &gpriv->gadget); | 901 | ret = usb_add_gadget_udc(dev, &gpriv->gadget); |
914 | if (ret) | 902 | if (ret) |
915 | goto err_add_udc; | 903 | goto err_register; |
916 | 904 | ||
917 | 905 | ||
918 | dev_info(dev, "gadget probed\n"); | 906 | dev_info(dev, "gadget probed\n"); |
919 | 907 | ||
920 | return 0; | 908 | return 0; |
909 | |||
910 | err_register: | ||
911 | device_unregister(&gpriv->gadget.dev); | ||
921 | err_add_udc: | 912 | err_add_udc: |
922 | kfree(gpriv->uep); | 913 | kfree(gpriv->uep); |
923 | 914 | ||
@@ -933,6 +924,8 @@ void usbhs_mod_gadget_remove(struct usbhs_priv *priv) | |||
933 | 924 | ||
934 | usb_del_gadget_udc(&gpriv->gadget); | 925 | usb_del_gadget_udc(&gpriv->gadget); |
935 | 926 | ||
927 | device_unregister(&gpriv->gadget.dev); | ||
928 | |||
936 | usbhsg_controller_unregister(gpriv); | 929 | usbhsg_controller_unregister(gpriv); |
937 | 930 | ||
938 | kfree(gpriv->uep); | 931 | kfree(gpriv->uep); |