aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/chipidea/core.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/chipidea/core.c')
-rw-r--r--drivers/usb/chipidea/core.c15
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 @@
70#include "ci.h" 70#include "ci.h"
71#include "udc.h" 71#include "udc.h"
72#include "bits.h" 72#include "bits.h"
73#include "host.h"
73#include "debug.h" 74#include "debug.h"
74 75
75/* Controller register map */ 76/* Controller register map */
@@ -215,7 +216,7 @@ static int hw_device_init(struct ci13xxx *ci, void __iomem *base)
215 * 216 *
216 * This function returns an error code 217 * This function returns an error code
217 */ 218 */
218int hw_device_reset(struct ci13xxx *ci) 219int hw_device_reset(struct ci13xxx *ci, u32 mode)
219{ 220{
220 /* should flush & stop before reset */ 221 /* should flush & stop before reset */
221 hw_write(ci, OP_ENDPTFLUSH, ~0, ~0); 222 hw_write(ci, OP_ENDPTFLUSH, ~0, ~0);
@@ -235,12 +236,12 @@ int hw_device_reset(struct ci13xxx *ci)
235 236
236 /* USBMODE should be configured step by step */ 237 /* USBMODE should be configured step by step */
237 hw_write(ci, OP_USBMODE, USBMODE_CM, USBMODE_CM_IDLE); 238 hw_write(ci, OP_USBMODE, USBMODE_CM, USBMODE_CM_IDLE);
238 hw_write(ci, OP_USBMODE, USBMODE_CM, USBMODE_CM_DC); 239 hw_write(ci, OP_USBMODE, USBMODE_CM, mode);
239 /* HW >= 2.3 */ 240 /* HW >= 2.3 */
240 hw_write(ci, OP_USBMODE, USBMODE_SLOM, USBMODE_SLOM); 241 hw_write(ci, OP_USBMODE, USBMODE_SLOM, USBMODE_SLOM);
241 242
242 if (hw_read(ci, OP_USBMODE, USBMODE_CM) != USBMODE_CM_DC) { 243 if (hw_read(ci, OP_USBMODE, USBMODE_CM) != mode) {
243 pr_err("cannot enter in device mode"); 244 pr_err("cannot enter in %s mode", ci_role(ci)->name);
244 pr_err("lpm = %i", ci->hw_bank.lpm); 245 pr_err("lpm = %i", ci->hw_bank.lpm);
245 return -ENODEV; 246 return -ENODEV;
246 } 247 }
@@ -371,6 +372,8 @@ static int __devinit ci_hdrc_probe(struct platform_device *pdev)
371 return -ENODEV; 372 return -ENODEV;
372 } 373 }
373 374
375 ci->hw_bank.phys = res->start;
376
374 ci->irq = platform_get_irq(pdev, 0); 377 ci->irq = platform_get_irq(pdev, 0);
375 if (ci->irq < 0) { 378 if (ci->irq < 0) {
376 dev_err(dev, "missing IRQ\n"); 379 dev_err(dev, "missing IRQ\n");
@@ -385,6 +388,10 @@ static int __devinit ci_hdrc_probe(struct platform_device *pdev)
385 } 388 }
386 389
387 /* initialize role(s) before the interrupt is requested */ 390 /* initialize role(s) before the interrupt is requested */
391 ret = ci_hdrc_host_init(ci);
392 if (ret)
393 dev_info(dev, "doesn't support host\n");
394
388 ret = ci_hdrc_gadget_init(ci); 395 ret = ci_hdrc_gadget_init(ci);
389 if (ret) 396 if (ret)
390 dev_info(dev, "doesn't support gadget\n"); 397 dev_info(dev, "doesn't support gadget\n");