1 From dc9aa43c43668481089c48135707ec3f8f5b2e19 Mon Sep 17 00:00:00 2001
2 From: Al Cooper <alcooperx@gmail.com>
3 Date: Fri, 3 Jan 2020 13:17:59 -0500
4 Subject: [PATCH] phy: usb: EHCI DMA may lose a burst of DMA data for 7255xA0
7 When the EHCI controller received a 512 byte USB packet that
8 had to be broken into 2 256 byte bursts across the SCB bus AND
9 there was a following 512 byte USB packet, the second burst of
10 data from the first packet was sometimes being lost. If the
11 burst size was changed to 128 bytes via the EBR_SCB_SIZE field
12 in the USB_CTRL_EBRIDGE register we'd see the 4th 128 byte burst
13 of the first packet being lost. This problem became much worse
14 if other threads were running that accessed memory, like a memcpy
15 test. Setting the EBR_SCB_SIZE to 512, which prevents breaking
16 the EHCI USB packet (max size of 512 bytes) into bursts, fixed
19 Signed-off-by: Al Cooper <alcooperx@gmail.com>
20 Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
21 Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
23 drivers/phy/broadcom/phy-brcm-usb-init.c | 13 +++++++++++++
24 1 file changed, 13 insertions(+)
26 --- a/drivers/phy/broadcom/phy-brcm-usb-init.c
27 +++ b/drivers/phy/broadcom/phy-brcm-usb-init.c
29 #define USB_CTRL_PLL_CTL_PLL_IDDQ_PWRDN_MASK 0x80000000 /* option */
30 #define USB_CTRL_EBRIDGE 0x0c
31 #define USB_CTRL_EBRIDGE_ESTOP_SCB_REQ_MASK 0x00020000 /* option */
32 +#define USB_CTRL_EBRIDGE_EBR_SCB_SIZE_MASK 0x00000f80 /* option */
33 #define USB_CTRL_OBRIDGE 0x10
34 #define USB_CTRL_OBRIDGE_LS_KEEP_ALIVE_MASK 0x08000000
35 #define USB_CTRL_MDIO 0x14
36 @@ -176,6 +177,7 @@ static const struct id_to_type id_to_typ
37 { 0x33900000, BRCM_FAMILY_3390A0 },
38 { 0x72500010, BRCM_FAMILY_7250B0 },
39 { 0x72600000, BRCM_FAMILY_7260A0 },
40 + { 0x72550000, BRCM_FAMILY_7260A0 },
41 { 0x72680000, BRCM_FAMILY_7271A0 },
42 { 0x72710000, BRCM_FAMILY_7271A0 },
43 { 0x73640000, BRCM_FAMILY_7364A0 },
44 @@ -948,6 +950,17 @@ void brcm_usb_init_eohci(struct brcm_usb
45 if (params->selected_family == BRCM_FAMILY_7271A0)
46 /* Enable LS keep alive fix for certain keyboards */
47 USB_CTRL_SET(ctrl, OBRIDGE, LS_KEEP_ALIVE);
49 + if (params->family_id == 0x72550000) {
51 + * Make the burst size 512 bytes to fix a hardware bug
52 + * on the 7255a0. See HW7255-24.
54 + reg = brcmusb_readl(USB_CTRL_REG(ctrl, EBRIDGE));
55 + reg &= ~USB_CTRL_MASK(EBRIDGE, EBR_SCB_SIZE);
57 + brcmusb_writel(reg, USB_CTRL_REG(ctrl, EBRIDGE));
61 void brcm_usb_init_xhci(struct brcm_usb_init_params *params)