USB i.MX: Add chipidea gadget support
This adds USB gadget support to the i.MX chipidea driver. Basically we have to add a register function to the fsl udc driver and call this from the chipidea driver if device mode is selected. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
8139fa78b9
commit
0a643b3d42
|
@ -2257,7 +2257,7 @@ static struct poller_struct poller = {
|
|||
.func = fsl_udc_poller
|
||||
};
|
||||
|
||||
static int fsl_udc_probe(struct device_d *dev)
|
||||
int ci_udc_register(struct device_d *dev, void __iomem *regs)
|
||||
{
|
||||
int ret, i;
|
||||
u32 dccparams;
|
||||
|
@ -2265,7 +2265,7 @@ static int fsl_udc_probe(struct device_d *dev)
|
|||
udc_controller = xzalloc(sizeof(*udc_controller));
|
||||
udc_controller->stopped = 1;
|
||||
|
||||
dr_regs = dev_request_mem_region(dev, 0);
|
||||
dr_regs = regs;
|
||||
|
||||
/* Read Device Controller Capability Parameters register */
|
||||
dccparams = readl(&dr_regs->dccparams);
|
||||
|
@ -2326,6 +2326,13 @@ err_out:
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int fsl_udc_probe(struct device_d *dev)
|
||||
{
|
||||
void __iomem *regs = dev_request_mem_region(dev, 0);
|
||||
|
||||
return ci_udc_register(dev, regs);
|
||||
}
|
||||
|
||||
static struct driver_d fsl_udc_driver = {
|
||||
.name = "fsl-udc",
|
||||
.probe = fsl_udc_probe,
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include <usb/ehci.h>
|
||||
#include <usb/chipidea-imx.h>
|
||||
#include <usb/ulpi.h>
|
||||
#include <usb/fsl_usb2.h>
|
||||
|
||||
#define MXC_EHCI_PORTSC_MASK ((0xf << 28) | (1 << 25))
|
||||
|
||||
|
@ -96,13 +97,13 @@ static int imx_chipidea_probe(struct device_d *dev)
|
|||
data.hcor = base + 0x140;
|
||||
data.flags = EHCI_HAS_TT;
|
||||
|
||||
if (pdata->mode == IMX_USB_MODE_HOST) {
|
||||
if (pdata->mode == IMX_USB_MODE_HOST && IS_ENABLED(CONFIG_USB_EHCI)) {
|
||||
ret = ehci_register(dev, &data);
|
||||
} else if (pdata->mode == IMX_USB_MODE_DEVICE && IS_ENABLED(CONFIG_USB_GADGET_DRIVER_ARC)) {
|
||||
ret = ci_udc_register(dev, base);
|
||||
} else {
|
||||
/*
|
||||
* Not yet implemented. Register USB gadget driver here.
|
||||
*/
|
||||
ret = -ENOSYS;
|
||||
dev_err(dev, "No supported role\n");
|
||||
ret = -ENODEV;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
#ifndef __USB_FSL_USB2_H
|
||||
#define __USB_FSL_USB2_H
|
||||
|
||||
enum fsl_usb2_operating_modes {
|
||||
FSL_USB2_MPH_HOST,
|
||||
FSL_USB2_DR_HOST,
|
||||
|
@ -20,3 +23,6 @@ struct fsl_usb2_platform_data {
|
|||
unsigned int port_enables;
|
||||
};
|
||||
|
||||
int ci_udc_register(struct device_d *dev, void __iomem *regs);
|
||||
|
||||
#endif /* __USB_FSL_USB2_H */
|
||||
|
|
Loading…
Reference in New Issue