Skip to content

Commit 12e6ac6

Browse files
Xu Yanggregkh
Xu Yang
authored andcommitted
usb: chipidea: add workaround for chipidea PEC bug
Some NXP processors using ChipIdea USB IP have a bug when frame babble is detected. Issue description: In USB camera test, our controller is host in HS mode. In ISOC IN, when device sends data across the micro frame, it causes the babble in host controller. This will clear the PE bit. In spec, it also requires to set the PEC bit and then set the PCI bit. Without the PCI interrupt, the software does not know the PE is cleared. This will add a flag CI_HDRC_HAS_PORTSC_PEC_MISSED to some impacted platform datas. And the ehci host driver will assert PEC by SW when specific conditions are satisfied. Signed-off-by: Xu Yang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent dda4b60 commit 12e6ac6

File tree

5 files changed

+8
-1
lines changed

5 files changed

+8
-1
lines changed

drivers/usb/chipidea/ci.h

+1
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ struct ci_hdrc {
257257
bool id_event;
258258
bool b_sess_valid_event;
259259
bool imx28_write_fix;
260+
bool has_portsc_pec_bug;
260261
bool supports_runtime_pm;
261262
bool in_lpm;
262263
bool wakeup_int;

drivers/usb/chipidea/ci_hdrc_imx.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,13 @@ static const struct ci_hdrc_imx_platform_flag imx7d_usb_data = {
6868

6969
static const struct ci_hdrc_imx_platform_flag imx7ulp_usb_data = {
7070
.flags = CI_HDRC_SUPPORTS_RUNTIME_PM |
71+
CI_HDRC_HAS_PORTSC_PEC_MISSED |
7172
CI_HDRC_PMQOS,
7273
};
7374

7475
static const struct ci_hdrc_imx_platform_flag imx8ulp_usb_data = {
75-
.flags = CI_HDRC_SUPPORTS_RUNTIME_PM,
76+
.flags = CI_HDRC_SUPPORTS_RUNTIME_PM |
77+
CI_HDRC_HAS_PORTSC_PEC_MISSED,
7678
};
7779

7880
static const struct of_device_id ci_hdrc_imx_dt_ids[] = {

drivers/usb/chipidea/core.c

+2
Original file line numberDiff line numberDiff line change
@@ -1044,6 +1044,8 @@ static int ci_hdrc_probe(struct platform_device *pdev)
10441044
CI_HDRC_IMX28_WRITE_FIX);
10451045
ci->supports_runtime_pm = !!(ci->platdata->flags &
10461046
CI_HDRC_SUPPORTS_RUNTIME_PM);
1047+
ci->has_portsc_pec_bug = !!(ci->platdata->flags &
1048+
CI_HDRC_HAS_PORTSC_PEC_MISSED);
10471049
platform_set_drvdata(pdev, ci);
10481050

10491051
ret = hw_device_init(ci, base);

drivers/usb/chipidea/host.c

+1
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ static int host_start(struct ci_hdrc *ci)
151151
ehci->has_hostpc = ci->hw_bank.lpm;
152152
ehci->has_tdi_phy_lpm = ci->hw_bank.lpm;
153153
ehci->imx28_write_fix = ci->imx28_write_fix;
154+
ehci->has_ci_pec_bug = ci->has_portsc_pec_bug;
154155

155156
priv = (struct ehci_ci_priv *)ehci->priv;
156157
priv->reg_vbus = NULL;

include/linux/usb/chipidea.h

+1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ struct ci_hdrc_platform_data {
6363
#define CI_HDRC_IMX_IS_HSIC BIT(14)
6464
#define CI_HDRC_PMQOS BIT(15)
6565
#define CI_HDRC_PHY_VBUS_CONTROL BIT(16)
66+
#define CI_HDRC_HAS_PORTSC_PEC_MISSED BIT(17)
6667
enum usb_dr_mode dr_mode;
6768
#define CI_HDRC_CONTROLLER_RESET_EVENT 0
6869
#define CI_HDRC_CONTROLLER_STOPPED_EVENT 1

0 commit comments

Comments
 (0)