diff options
author | Alexander Shishkin <alexander.shishkin@linux.intel.com> | 2012-05-11 17:25:54 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-05-11 16:56:15 -0700 |
commit | eb70e5ab8f95a81283623c03d2c99dfc59fcb319 (patch) | |
tree | fc20c9d10484171490cf6b69f7f5b6f934803366 /drivers/usb/chipidea/core.c | |
parent | 758fc9860c19eceb56e5886a5225db623c521971 (diff) | |
download | kernel_replicant_linux-eb70e5ab8f95a81283623c03d2c99dfc59fcb319.tar.gz kernel_replicant_linux-eb70e5ab8f95a81283623c03d2c99dfc59fcb319.tar.bz2 kernel_replicant_linux-eb70e5ab8f95a81283623c03d2c99dfc59fcb319.zip |
usb: chipidea: add host role
This adds EHCI host support to the chipidea driver. We want it to be
part of the hdrc driver and not a standalone (sub-)driver module, as
the structure of ehci-hcd.c suggests, so for chipidea controller we
hack it to not provide platform-related code, but only the ehci hcd.
The ehci-platform driver won't work for us here too, because the
controller uses the same registers for both device and host mode and
also otg-related bits, so it's not really possible to put ehci registers
into a separate resource.
This is not a pretty solution, but the alternative is exporting symbols
from the chipidea driver to a ehci-chipidea driver and doing all the
module refcounting.
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/chipidea/core.c')
-rw-r--r-- | drivers/usb/chipidea/core.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index 3d48c9be6923..f568b8e86cee 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -70,6 +70,7 @@ #include "ci.h" #include "udc.h" #include "bits.h" +#include "host.h" #include "debug.h" /* Controller register map */ @@ -215,7 +216,7 @@ static int hw_device_init(struct ci13xxx *ci, void __iomem *base) * * This function returns an error code */ -int hw_device_reset(struct ci13xxx *ci) +int hw_device_reset(struct ci13xxx *ci, u32 mode) { /* should flush & stop before reset */ hw_write(ci, OP_ENDPTFLUSH, ~0, ~0); @@ -235,12 +236,12 @@ int hw_device_reset(struct ci13xxx *ci) /* USBMODE should be configured step by step */ hw_write(ci, OP_USBMODE, USBMODE_CM, USBMODE_CM_IDLE); - hw_write(ci, OP_USBMODE, USBMODE_CM, USBMODE_CM_DC); + hw_write(ci, OP_USBMODE, USBMODE_CM, mode); /* HW >= 2.3 */ hw_write(ci, OP_USBMODE, USBMODE_SLOM, USBMODE_SLOM); - if (hw_read(ci, OP_USBMODE, USBMODE_CM) != USBMODE_CM_DC) { - pr_err("cannot enter in device mode"); + if (hw_read(ci, OP_USBMODE, USBMODE_CM) != mode) { + pr_err("cannot enter in %s mode", ci_role(ci)->name); pr_err("lpm = %i", ci->hw_bank.lpm); return -ENODEV; } @@ -371,6 +372,8 @@ static int __devinit ci_hdrc_probe(struct platform_device *pdev) return -ENODEV; } + ci->hw_bank.phys = res->start; + ci->irq = platform_get_irq(pdev, 0); if (ci->irq < 0) { dev_err(dev, "missing IRQ\n"); @@ -385,6 +388,10 @@ static int __devinit ci_hdrc_probe(struct platform_device *pdev) } /* initialize role(s) before the interrupt is requested */ + ret = ci_hdrc_host_init(ci); + if (ret) + dev_info(dev, "doesn't support host\n"); + ret = ci_hdrc_gadget_init(ci); if (ret) dev_info(dev, "doesn't support gadget\n"); |