diff options
author | Sherry Sun <sherry.sun@nxp.com> | 2019-07-30 20:42:02 -0400 |
---|---|---|
committer | Ye Li <ye.li@nxp.com> | 2020-04-26 23:36:23 -0700 |
commit | 8e96b7197a91142c9f70d8fed7b994b2e3d8eb1a (patch) | |
tree | f4cd491080d967923b0fd121e76bb41712f288a5 | |
parent | b8d23c9eba14419ccd3b16d403670d4bba2423b1 (diff) |
MLK-22357-1 usb: Add handle_interrupts function pointer for UCLASS_USB_GADGET_GENERIC
Since the orginal way to call interrupts handle function of DM usb
gadget driver is through dm_usb_gadget_handle_interrupts(), when we want
to use two or more different gadget drivers at the same time, it will
cause error of duplicate names.
So here add a handle_interrupts function pointer instead of driectly
call dm_usb_gadget_handle_interrupts(), then the error can be avoided.
Signed-off-by: Sherry Sun <sherry.sun@nxp.com>
(cherry picked from commit 2458ddd952a6a2d2304dfe7ea34e4192cd1d5ed4)
-rw-r--r-- | drivers/usb/cdns3/cdns3-generic.c | 3 | ||||
-rw-r--r-- | drivers/usb/dwc3/dwc3-generic.c | 3 | ||||
-rw-r--r-- | drivers/usb/gadget/ci_udc.c | 3 | ||||
-rw-r--r-- | drivers/usb/gadget/udc/udc-uclass.c | 13 | ||||
-rw-r--r-- | drivers/usb/musb-new/ti-musb.c | 3 | ||||
-rw-r--r-- | include/dm/device.h | 1 | ||||
-rw-r--r-- | include/linux/usb/gadget.h | 1 |
7 files changed, 21 insertions, 6 deletions
diff --git a/drivers/usb/cdns3/cdns3-generic.c b/drivers/usb/cdns3/cdns3-generic.c index 571b6f1bdac..827fd97b3f1 100644 --- a/drivers/usb/cdns3/cdns3-generic.c +++ b/drivers/usb/cdns3/cdns3-generic.c @@ -35,7 +35,7 @@ static int cdns3_generic_peripheral_clk_init(struct udevice *dev, return 0; } -int dm_usb_gadget_handle_interrupts(struct udevice *dev) +static int cdns3_generic_handle_interrupts(struct udevice *dev) { struct cdns3_generic_peripheral *priv = dev_get_priv(dev); struct cdns3 *cdns3 = &priv->cdns3; @@ -110,5 +110,6 @@ U_BOOT_DRIVER(cdns3_generic_peripheral) = { .ofdata_to_platdata = cdns3_generic_peripheral_ofdata_to_platdata, .probe = cdns3_generic_peripheral_probe, .remove = cdns3_generic_peripheral_remove, + .handle_interrupts = cdns3_generic_handle_interrupts, .priv_auto_alloc_size = sizeof(struct cdns3_generic_peripheral), }; diff --git a/drivers/usb/dwc3/dwc3-generic.c b/drivers/usb/dwc3/dwc3-generic.c index 3e116b2c5cc..ed5a16197c6 100644 --- a/drivers/usb/dwc3/dwc3-generic.c +++ b/drivers/usb/dwc3/dwc3-generic.c @@ -108,7 +108,7 @@ static int dwc3_generic_ofdata_to_platdata(struct udevice *dev) } #if CONFIG_IS_ENABLED(DM_USB_GADGET) -int dm_usb_gadget_handle_interrupts(struct udevice *dev) +static int dwc3_generic_peripheral_handle_interrupts(struct udevice *dev) { struct dwc3_generic_priv *priv = dev_get_priv(dev); struct dwc3 *dwc3 = &priv->dwc3; @@ -138,6 +138,7 @@ U_BOOT_DRIVER(dwc3_generic_peripheral) = { .ofdata_to_platdata = dwc3_generic_ofdata_to_platdata, .probe = dwc3_generic_peripheral_probe, .remove = dwc3_generic_peripheral_remove, + .handle_interrupts = dwc3_generic_peripheral_handle_interrupts, .priv_auto_alloc_size = sizeof(struct dwc3_generic_priv), .platdata_auto_alloc_size = sizeof(struct dwc3_generic_plat), }; diff --git a/drivers/usb/gadget/ci_udc.c b/drivers/usb/gadget/ci_udc.c index d133d97319d..251e7294b28 100644 --- a/drivers/usb/gadget/ci_udc.c +++ b/drivers/usb/gadget/ci_udc.c @@ -1126,7 +1126,7 @@ struct ci_udc_priv_data { struct power_domain phy_pd; }; -int dm_usb_gadget_handle_interrupts(struct udevice *dev) +static int ci_udc_gadget_handle_interrupts(struct udevice *dev) { return ci_udc_handle_interrupts(); } @@ -1365,6 +1365,7 @@ U_BOOT_DRIVER(ci_udc_otg) = { .ofdata_to_platdata = ci_udc_otg_ofdata_to_platdata, .probe = ci_udc_otg_probe, .remove = ci_udc_otg_remove, + .handle_interrupts = ci_udc_gadget_handle_interrupts, .priv_auto_alloc_size = sizeof(struct ci_udc_priv_data), }; diff --git a/drivers/usb/gadget/udc/udc-uclass.c b/drivers/usb/gadget/udc/udc-uclass.c index 3053ccf7d97..f117a42a656 100644 --- a/drivers/usb/gadget/udc/udc-uclass.c +++ b/drivers/usb/gadget/udc/udc-uclass.c @@ -51,9 +51,20 @@ int usb_gadget_release(int index) int usb_gadget_handle_interrupts(int index) { + const struct driver *drv; + if (index < 0 || index >= ARRAY_SIZE(dev_array)) return -EINVAL; - return dm_usb_gadget_handle_interrupts(dev_array[index]); + + drv = dev_array[index]->driver; + assert(drv); + + if (drv->handle_interrupts) + return drv->handle_interrupts(dev_array[index]); + else + pr_err("No handle_interrupts function found\n"); + + return -EINVAL; } #endif diff --git a/drivers/usb/musb-new/ti-musb.c b/drivers/usb/musb-new/ti-musb.c index 00759f3e832..5fb6ca4e6fd 100644 --- a/drivers/usb/musb-new/ti-musb.c +++ b/drivers/usb/musb-new/ti-musb.c @@ -231,7 +231,7 @@ static int ti_musb_peripheral_ofdata_to_platdata(struct udevice *dev) } #endif -int dm_usb_gadget_handle_interrupts(struct udevice *dev) +static int ti_musb_peripheral_handle_interrupts(struct udevice *dev) { struct ti_musb_peripheral *priv = dev_get_priv(dev); @@ -276,6 +276,7 @@ U_BOOT_DRIVER(ti_musb_peripheral) = { .probe = ti_musb_peripheral_probe, .remove = ti_musb_peripheral_remove, .ops = &musb_usb_ops, + .handle_interrupts = ti_musb_peripheral_handle_interrupts, .platdata_auto_alloc_size = sizeof(struct ti_musb_platdata), .priv_auto_alloc_size = sizeof(struct ti_musb_peripheral), .flags = DM_FLAG_PRE_RELOC, diff --git a/include/dm/device.h b/include/dm/device.h index ce6bc389db3..2c41db845ca 100644 --- a/include/dm/device.h +++ b/include/dm/device.h @@ -261,6 +261,7 @@ struct driver { int (*child_post_bind)(struct udevice *dev); int (*child_pre_probe)(struct udevice *dev); int (*child_post_remove)(struct udevice *dev); + int (*handle_interrupts)(struct udevice *dev); int priv_auto_alloc_size; int platdata_auto_alloc_size; int per_child_auto_alloc_size; diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h index 7e6d329e542..cc8c2eaafcf 100644 --- a/include/linux/usb/gadget.h +++ b/include/linux/usb/gadget.h @@ -973,7 +973,6 @@ extern int usb_gadget_handle_interrupts(int index); #if CONFIG_IS_ENABLED(DM_USB_GADGET) int usb_gadget_initialize(int index); int usb_gadget_release(int index); -int dm_usb_gadget_handle_interrupts(struct udevice *dev); #else #include <usb.h> static inline int usb_gadget_initialize(int index) |