aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/chipidea/core.c
diff options
context:
space:
mode:
authorLi Jun <b47624@freescale.com>2014-04-23 03:56:50 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-04-24 15:56:35 -0400
commit4dcf720c5d40b27c916e7115ad75b335c9c1e264 (patch)
treedd40e11f5e40ee2dbe96b8a9ac2b12538692dd33 /drivers/usb/chipidea/core.c
parente287b67b00c8d5306e0fe6be1d597e23d8c4783e (diff)
usb: chipidea: OTG HNP and SRP fsm implementation
USB OTG interrupt handling and fsm transitions according to USB OTG and EH 2.0. Signed-off-by: Peter Chen <peter.chen@freescale.com> Signed-off-by: Li Jun <b47624@freescale.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/chipidea/core.c')
-rw-r--r--drivers/usb/chipidea/core.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index 6a6379a8f1f5..128b92ba58a8 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -42,7 +42,6 @@
42 * - Not Supported: 15 & 16 (ISO) 42 * - Not Supported: 15 & 16 (ISO)
43 * 43 *
44 * TODO List 44 * TODO List
45 * - OTG
46 * - Interrupt Traffic 45 * - Interrupt Traffic
47 * - GET_STATUS(device) - always reports 0 46 * - GET_STATUS(device) - always reports 0
48 * - Gadget API (majority of optional features) 47 * - Gadget API (majority of optional features)
@@ -74,6 +73,7 @@
74#include "host.h" 73#include "host.h"
75#include "debug.h" 74#include "debug.h"
76#include "otg.h" 75#include "otg.h"
76#include "otg_fsm.h"
77 77
78/* Controller register map */ 78/* Controller register map */
79static const u8 ci_regs_nolpm[] = { 79static const u8 ci_regs_nolpm[] = {
@@ -411,8 +411,14 @@ static irqreturn_t ci_irq(int irq, void *data)
411 irqreturn_t ret = IRQ_NONE; 411 irqreturn_t ret = IRQ_NONE;
412 u32 otgsc = 0; 412 u32 otgsc = 0;
413 413
414 if (ci->is_otg) 414 if (ci->is_otg) {
415 otgsc = hw_read_otgsc(ci, ~0); 415 otgsc = hw_read_otgsc(ci, ~0);
416 if (ci_otg_is_fsm_mode(ci)) {
417 ret = ci_otg_fsm_irq(ci);
418 if (ret == IRQ_HANDLED)
419 return ret;
420 }
421 }
416 422
417 /* 423 /*
418 * Handle id change interrupt, it indicates device/host function 424 * Handle id change interrupt, it indicates device/host function
@@ -691,10 +697,13 @@ static int ci_hdrc_probe(struct platform_device *pdev)
691 if (ci->role == CI_ROLE_GADGET) 697 if (ci->role == CI_ROLE_GADGET)
692 ci_handle_vbus_change(ci); 698 ci_handle_vbus_change(ci);
693 699
694 ret = ci_role_start(ci, ci->role); 700 if (!ci_otg_is_fsm_mode(ci)) {
695 if (ret) { 701 ret = ci_role_start(ci, ci->role);
696 dev_err(dev, "can't start %s role\n", ci_role(ci)->name); 702 if (ret) {
697 goto stop; 703 dev_err(dev, "can't start %s role\n",
704 ci_role(ci)->name);
705 goto stop;
706 }
698 } 707 }
699 708
700 platform_set_drvdata(pdev, ci); 709 platform_set_drvdata(pdev, ci);
@@ -703,6 +712,9 @@ static int ci_hdrc_probe(struct platform_device *pdev)
703 if (ret) 712 if (ret)
704 goto stop; 713 goto stop;
705 714
715 if (ci_otg_is_fsm_mode(ci))
716 ci_hdrc_otg_fsm_start(ci);
717
706 ret = dbg_create_files(ci); 718 ret = dbg_create_files(ci);
707 if (!ret) 719 if (!ret)
708 return 0; 720 return 0;