Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usb: orion-ehci: Add support for the Armada 3700

- Add a new compatible string for the Armada 3700 SoCs

- add sbuscfg support for orion usb controller driver. For the SoCs
without hlock, need to program BAWR/BARD/AHBBRST fields in the sbuscfg
register to guarantee the AHB master's burst would not overrun or
underrun the FIFO.

- the sbuscfg register has to be set after the usb controller reset,
otherwise the value would be overridden to 0. In order to do this, the
reset callback is registered.

[gregory.clement@free-electrons.com: - reword commit and comments
- fix error path in ehci_orion_drv_reset()
- fix checkpatch warning]
Signed-off-by: Hua Jing <jinghua@marvell.com>
Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Acked-by: Rob Herring <robh@kernel.org>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Hua Jing and committed by
Greg Kroah-Hartman
356c5007 8d66db50

+39 -1
+3 -1
Documentation/devicetree/bindings/usb/ehci-orion.txt
··· 1 1 * EHCI controller, Orion Marvell variants 2 2 3 3 Required properties: 4 - - compatible: must be "marvell,orion-ehci" 4 + - compatible: must be one of the following 5 + "marvell,orion-ehci" 6 + "marvell,armada-3700-ehci" 5 7 - reg: physical base address of the controller and length of memory mapped 6 8 region. 7 9 - interrupts: The EHCI interrupt
+36
drivers/usb/host/ehci-orion.c
··· 47 47 #define USB_PHY_IVREF_CTRL 0x440 48 48 #define USB_PHY_TST_GRP_CTRL 0x450 49 49 50 + #define USB_SBUSCFG 0x90 51 + 52 + /* BAWR = BARD = 3 : Align read/write bursts packets larger than 128 bytes */ 53 + #define USB_SBUSCFG_BAWR_ALIGN_128B (0x3 << 6) 54 + #define USB_SBUSCFG_BARD_ALIGN_128B (0x3 << 3) 55 + /* AHBBRST = 3 : Align AHB Burst to INCR16 (64 bytes) */ 56 + #define USB_SBUSCFG_AHBBRST_INCR16 (0x3 << 0) 57 + 58 + #define USB_SBUSCFG_DEF_VAL (USB_SBUSCFG_BAWR_ALIGN_128B \ 59 + | USB_SBUSCFG_BARD_ALIGN_128B \ 60 + | USB_SBUSCFG_AHBBRST_INCR16) 61 + 50 62 #define DRIVER_DESC "EHCI orion driver" 51 63 52 64 #define hcd_to_orion_priv(h) ((struct orion_ehci_hcd *)hcd_to_ehci(h)->priv) ··· 163 151 } 164 152 } 165 153 154 + static int ehci_orion_drv_reset(struct usb_hcd *hcd) 155 + { 156 + struct device *dev = hcd->self.controller; 157 + int ret; 158 + 159 + ret = ehci_setup(hcd); 160 + if (ret) 161 + return ret; 162 + 163 + /* 164 + * For SoC without hlock, need to program sbuscfg value to guarantee 165 + * AHB master's burst would not overrun or underrun FIFO. 166 + * 167 + * sbuscfg reg has to be set after usb controller reset, otherwise 168 + * the value would be override to 0. 169 + */ 170 + if (of_device_is_compatible(dev->of_node, "marvell,armada-3700-ehci")) 171 + wrl(USB_SBUSCFG, USB_SBUSCFG_DEF_VAL); 172 + 173 + return ret; 174 + } 175 + 166 176 static const struct ehci_driver_overrides orion_overrides __initconst = { 167 177 .extra_priv_size = sizeof(struct orion_ehci_hcd), 178 + .reset = ehci_orion_drv_reset, 168 179 }; 169 180 170 181 static int ehci_orion_drv_probe(struct platform_device *pdev) ··· 345 310 346 311 static const struct of_device_id ehci_orion_dt_ids[] = { 347 312 { .compatible = "marvell,orion-ehci", }, 313 + { .compatible = "marvell,armada-3700-ehci", }, 348 314 {}, 349 315 }; 350 316 MODULE_DEVICE_TABLE(of, ehci_orion_dt_ids);