Commit 2f98382d authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Greg Kroah-Hartman

usb: renesas_usbhs: Add Renesas USBHS Gadget

This patch add usb gadget code to SuperH USBHS.
Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent f1407d5c
...@@ -260,6 +260,24 @@ config USB_R8A66597 ...@@ -260,6 +260,24 @@ config USB_R8A66597
default USB_GADGET default USB_GADGET
select USB_GADGET_SELECTED select USB_GADGET_SELECTED
config USB_GADGET_RENESAS_USBHS
boolean "Renesas USBHS"
depends on USB_RENESAS_USBHS
select USB_GADGET_DUALSPEED
help
Renesas USBHS is a discrete USB host and peripheral controller
chip that supports both full and high speed USB 2.0 data transfers.
platform is able to configure endpoint (pipe) style
Say "y" to enable the gadget specific portion of the USBHS driver.
config USB_RENESAS_USBHS_UDC
tristate
depends on USB_GADGET_RENESAS_USBHS
default USB_GADGET
select USB_GADGET_SELECTED
config USB_GADGET_PXA27X config USB_GADGET_PXA27X
boolean "PXA 27x" boolean "PXA 27x"
depends on ARCH_PXA && (PXA27x || PXA3xx) depends on ARCH_PXA && (PXA27x || PXA3xx)
......
...@@ -148,6 +148,12 @@ ...@@ -148,6 +148,12 @@
#define gadget_is_ci13xxx_msm(g) 0 #define gadget_is_ci13xxx_msm(g) 0
#endif #endif
#ifdef CONFIG_USB_GADGET_RENESAS_USBHS
#define gadget_is_renesas_usbhs(g) (!strcmp("renesas_usbhs_udc", (g)->name))
#else
#define gadget_is_renesas_usbhs(g) 0
#endif
/** /**
* usb_gadget_controller_number - support bcdDevice id convention * usb_gadget_controller_number - support bcdDevice id convention
* @gadget: the controller being driven * @gadget: the controller being driven
...@@ -207,6 +213,9 @@ static inline int usb_gadget_controller_number(struct usb_gadget *gadget) ...@@ -207,6 +213,9 @@ static inline int usb_gadget_controller_number(struct usb_gadget *gadget)
return 0x27; return 0x27;
else if (gadget_is_ci13xxx_msm(gadget)) else if (gadget_is_ci13xxx_msm(gadget))
return 0x28; return 0x28;
else if (gadget_is_renesas_usbhs(gadget))
return 0x29;
return -ENOENT; return -ENOENT;
} }
......
...@@ -5,3 +5,5 @@ ...@@ -5,3 +5,5 @@
obj-$(CONFIG_USB_RENESAS_USBHS) += renesas_usbhs.o obj-$(CONFIG_USB_RENESAS_USBHS) += renesas_usbhs.o
renesas_usbhs-y := common.o mod.o pipe.o renesas_usbhs-y := common.o mod.o pipe.o
renesas_usbhs-$(CONFIG_USB_RENESAS_USBHS_UDC) += mod_gadget.o
...@@ -94,17 +94,32 @@ int usbhs_mod_probe(struct usbhs_priv *priv) ...@@ -94,17 +94,32 @@ int usbhs_mod_probe(struct usbhs_priv *priv)
struct device *dev = usbhs_priv_to_dev(priv); struct device *dev = usbhs_priv_to_dev(priv);
int ret; int ret;
/*
* install host/gadget driver
*/
ret = usbhs_mod_gadget_probe(priv);
if (ret < 0)
return ret;
/* irq settings */ /* irq settings */
ret = request_irq(priv->irq, usbhs_interrupt, ret = request_irq(priv->irq, usbhs_interrupt,
IRQF_DISABLED, dev_name(dev), priv); IRQF_DISABLED, dev_name(dev), priv);
if (ret) if (ret) {
dev_err(dev, "irq request err\n"); dev_err(dev, "irq request err\n");
goto mod_init_gadget_err;
}
return ret;
mod_init_gadget_err:
usbhs_mod_gadget_remove(priv);
return ret; return ret;
} }
void usbhs_mod_remove(struct usbhs_priv *priv) void usbhs_mod_remove(struct usbhs_priv *priv)
{ {
usbhs_mod_gadget_remove(priv);
free_irq(priv->irq, priv); free_irq(priv->irq, priv);
} }
......
...@@ -103,4 +103,20 @@ void usbhs_irq_callback_update(struct usbhs_priv *priv, struct usbhs_mod *mod); ...@@ -103,4 +103,20 @@ void usbhs_irq_callback_update(struct usbhs_priv *priv, struct usbhs_mod *mod);
mod->func(param); \ mod->func(param); \
}) })
/*
* gadget control
*/
#ifdef CONFIG_USB_RENESAS_USBHS_UDC
extern int __devinit usbhs_mod_gadget_probe(struct usbhs_priv *priv);
extern void __devexit usbhs_mod_gadget_remove(struct usbhs_priv *priv);
#else
static inline int usbhs_mod_gadget_probe(struct usbhs_priv *priv)
{
return 0;
}
static inline void usbhs_mod_gadget_remove(struct usbhs_priv *priv)
{
}
#endif
#endif /* RENESAS_USB_MOD_H */ #endif /* RENESAS_USB_MOD_H */
This diff is collapsed.
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