USB support for Armada 38x and Armada 375
Subsystems (8)
v4 cover USB support for Armada 38x and Armada 375
Hello,
This patch set adds the USB support for the Armada 38x and Armada 375 SOCs. These SoCs use an xHCI but still need specific initialization, mainly to setup the MBus memory windows. They also have another USB controller for EHCI, identical to the one used on other mvebu SOCs.
This series is also available in
the branch USB-375-38x-3.15-rc1-V4
https://github.com/MISL-EBU-System-SW/mainline-public.git
Changes since v3:
* Additional patch that removes the use of of_irq_parse_and_map() in ehci-orion, and just uses platform_get_irq() instead, to avoid a different case between DT and non-T.
* Additional patch that renames the ehci-orion error handling goto labels to have more meaningful names, in preparation for handling of additional error cases in followup patches.
* Additional patch to update the ehci-orion Device Tree binding documentation.
* Merge of 375/38x XHCI support patches: one patch for the driver, one patch for the Device Tree binding documentation (instead of one patch of these, for each SoC).
* Update of the XHCI Device Tree binding documentation to indicate the new optional clocks property.
* Update of armada-375.dtsi to add missing spaces in the phy-names definition.
* Update of armada-38x.dtsi to use 0x4000 instead of 0x3fff for the register area length. Noticed by Andrew Lunn.
* Changed the PHY driver Kconfig option to only be enabled either when MACH_ARMADA_375 or COMPILE_TEST are enabled. In the previous version, the PHY driver was always enabled, regardless of the platform.
* Various improvements to the PHY driver:
- Rename USB2_PHY_CONFIG_ENABLE to USB2_PHY_CONFIG_DISABLE, as suggested by Ezequiel Garcia.
- Simplify the logic of armada375_usb_phy_init() by handling the !cluster_phy->enable case first.
- Use devm_ioremap_resource() in the ->probe() function instead of of_iomap().
- Bail out from ->probe() when a PHY cannot be created.
- Fix typos in comments.
* Reworded the Kconfig prompt and help text of XHCI_MVEBU to indicate that it's for both 375 and 38x (it was only indicating 38x until now).
* Changed the Makefile bit of the xhci-mvebu driver according to the suggestion of Felipe Balbi, so that things work properly when CONFIG_USB_XHCI_MVEBU is 'm'.
* Various improvements in the ehci-orion driver:
- Use better goto labels for error handling in ->probe().
- Use devm_phy_optional_get() instead of devm_phy_get(), which allows to handle EPROBE_DEFER cases nicely.
- Call phy_power_off() when needed (probe error handling, and remove).
- Use __initconst instead of __initdata for override structure, as noticed by checkpatch.
- Fix use after free errors noticed by Felipe Balbi.
* Various improvements to the XHCI driver:
- Don't make xhci_mvebu_mbus_config() an __init function, since it's called from probe(), which isn't in __init.
- Don't use the buggy 'priv[0]' solution implemented in the previous version of the patch set (see in
http://lists.infradead.org/pipermail/linux-arm-kernel/2014-May/253871.html
the details of why it doesn't work). Instead, add a 'struct clk*' field in xhci_hcd to support the clock in xhci-plat, exactly like xhci_hcd has msix_count and msix_entries for xhci-pci.
- Misc minor code style improvements.
Thomas
Gregory CLEMENT (17):
usb: ehci-orion: fix clock reference leaking
usb: ehci-orion: add optional PHY support
usb: host: xhci-plat: sort the headers in alphabetic order
usb: host: xhci-plat: add clock support
usb: host: xhci-plat: add support for the Armada 375/38x XHCI
controllers
Documentation: dt-bindings: update xhci-platform DT binding
phy: add support for USB cluster on the Armada 375 SoC
Documentation: dt-bindings: document the Armada 375 USB cluster
binding
ARM: mvebu: add USB3 support for Armada 38x
ARM: mvebu: add USB3 support for Armada 375
ARM: configs: enable XHCI mvebu support in mvebu_v7_defconfig
ARM: configs: enable XHCI mvebu support in multi_v7_defconfig
ARM: mvebu: add Device Tree description of xHCI controllers on Armada
38x
ARM: mvebu: add Device Tree description of the EHCI controller on
Armada 38x
ARM: mvebu: add Device Tree description of USB cluster controller on
Armada 375
ARM: mvebu: add Device Tree description of the xHCI controller on
Armada 375
ARM: mvebu: add Device Tree description of the EHCI controller on
Armada 375Thomas Petazzoni (3):
usb: ehci-orion: use platform_get_irq() for DT probing
usb: ehci-orion: rename error goto labels in ehci_orion_drv_probe()
Documentation: dt-bindings: update ehci-orion binding documentation
.../bindings/phy/armada-375-usb-phy-cluster.txt | 19 +++ .../devicetree/bindings/usb/ehci-orion.txt | 5 + Documentation/devicetree/bindings/usb/usb-xhci.txt | 7 +- arch/arm/boot/dts/armada-375-db.dts | 8 ++ arch/arm/boot/dts/armada-375.dtsi | 34 +++++ arch/arm/boot/dts/armada-385-db.dts | 12 ++ arch/arm/boot/dts/armada-385-rd.dts | 4 + arch/arm/boot/dts/armada-38x.dtsi | 25 ++++ arch/arm/configs/multi_v7_defconfig | 1 + arch/arm/configs/mvebu_v7_defconfig | 1 + arch/arm/mach-mvebu/Kconfig | 2 + drivers/phy/Kconfig | 6 + drivers/phy/Makefile | 1 + drivers/phy/phy-armada375-usb2.c | 157 +++++++++++++++++++++ drivers/usb/host/Kconfig | 8 ++ drivers/usb/host/Makefile | 3 + drivers/usb/host/ehci-orion.c | 92 ++++++++---- drivers/usb/host/xhci-mvebu.c | 70 +++++++++ drivers/usb/host/xhci-mvebu.h | 21 +++ drivers/usb/host/xhci-plat.c | 42 +++++- drivers/usb/host/xhci.h | 2 + 21 files changed, 488 insertions(+), 32 deletions(-) create mode 100644 Documentation/devicetree/bindings/phy/armada-375-usb-phy-cluster.txt create mode 100644 drivers/phy/phy-armada375-usb2.c create mode 100644 drivers/usb/host/xhci-mvebu.c create mode 100644 drivers/usb/host/xhci-mvebu.h
Signature · 1 line
1.9.2
PATCH v4 1/20 usb: ehci-orion: use platform_get_irq() for DT probing
Commit 77dae54ab385033e488d8b07045bc7f8d931740f ('ARM: Kirkwood:
ehci-orion: Add device tree binding') added the Device Tree binding for the ehci-orion driver. To achieve that with the irq, it used the irq_of_parse_and_map() function when probed in DT-mode, and platform_get_irq() when probed in non-DT mode.
This is not necessary: platform_get_irq() works just as fine in DT-mode, since the conversion from DT information to 'struct resource' is done by the generic layers of the kernel.
Therefore, this commit switches back to use just platform_get_irq().
--- drivers/usb/host/ehci-orion.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/usb/host/ehci-orion.c +1 -4
@@ -154,10 +154,7 @@ static int ehci_orion_drv_probe(struct platform_device *pdev)pr_debug ("Initializing Orion-SoC USB Host Controller\n" ); -if (pdev->dev.of_node) - irq =irq_of_parse_and_map (pdev->dev.of_node,0 ); -else - irq =platform_get_irq (pdev,0 ); + irq =platform_get_irq (pdev,0 );if (irq <=0 ) { dev_err(&pdev->dev, "Found HC with no IRQ. Check %s setup!\n",
Signature · 1 line
1.9.2
Alan Stern
maintainerPATCH v4 1/20 usb: ehci-orion: use platform_get_irq() for DT probing
Quoted 6 lines · Thomas Petazzoni
Commit
77dae54ab385033e488d8b07045bc7f8d931740f('ARM: Kirkwood:
ehci-orion: Add device tree binding') added the Device Tree binding for the ehci-orion driver. To achieve that with the irq, it used theirq_of_parse_and_map()function when probed in DT-mode, andplatform_get_irq()when probed in non-DT mode.
Quoted 7 lines
This is not necessary:
platform_get_irq()works just as fine in DT-mode, since the conversion from DT information to 'struct resource' is done by the generic layers of the kernel.Therefore, this commit switches back to use just
platform_get_irq().Signed-off-by Thomas Petazzoni <[email protected]>
For patches 1 - 4:
PATCH v4 2/20 usb: ehci-orion: rename error goto labels in ehci_orion_drv_probe()
In reply to Thomas PetazzoniIn preparation to the introduction of additional initialization steps in ehci_orion_drv_probe(), we rename the error goto labels from err1, err2 and err3 names to some more meaningful names.
--- drivers/usb/host/ehci-orion.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/usb/host/ehci-orion.c +9 -9
@@ -160,7 +160,7 @@ static int ehci_orion_drv_probe(struct platform_device *pdev)"Found HC with no IRQ. Check %s setup!\n" , dev_name(&pdev->dev)); err = -ENODEV ; - goto err1; + goto err; } res =platform_get_resource (pdev,IORESOURCE_MEM ,0 );
@@ -169,7 +169,7 @@ static int ehci_orion_drv_probe(struct platform_device *pdev)"Found HC with no register addr. Check %s setup!\n" , dev_name(&pdev->dev)); err = -ENODEV ; - goto err1; + goto err; }/*
@@ -179,12 +179,12 @@ static int ehci_orion_drv_probe(struct platform_device *pdev)*/ err =dma_coerce_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (32 ));if (err) - goto err1; + goto err; regs =devm_ioremap_resource (&pdev->dev, res);if (IS_ERR (regs)) { err =PTR_ERR (regs); - goto err1; + goto err; }/* Not all platforms can gate the clock, so it is not
@@ -197,7 +197,7 @@ static int ehci_orion_drv_probe(struct platform_device *pdev) &pdev->dev, dev_name(&pdev->dev));if (!hcd) { err = -ENOMEM ; - goto err2; + goto err_create_hcd; } hcd->rsrc_start = res->start;
@@ -237,17 +237,17 @@ static int ehci_orion_drv_probe(struct platform_device *pdev) err =usb_add_hcd (hcd, irq,IRQF_SHARED );if (err) - goto err3; + goto err_add_hcd;device_wakeup_enable (hcd->self.controller);return 0 ; -err3: +err_add_hcd:usb_put_hcd (hcd); -err2: +err_create_hcd:if (!IS_ERR (clk))clk_disable_unprepare (clk); -err1: +err:dev_err (&pdev->dev,"init %s fail, %d\n" ,dev_name (&pdev->dev), err);
Signature · 1 line
1.9.2
PATCH v4 3/20 usb: ehci-orion: fix clock reference leaking
In reply to Thomas PetazzoniFrom: Gregory CLEMENT <[email protected]>
In order to disable the clock in the ->remove() function, a call to devm_clk_get() is being made, which further increases the reference count of the clock.
In order to clean this up, a private structure holding a pointer to the clock is added using the override mechanism provided by the ehci framework. This makes the driver clock handling much more logical.
The bug was introduced in v3.6, however the ehci framework allowing to use the override mechanism has only been introduced in v3.8, so this patch won't apply before it.
[Thomas: reword commit log, fix goto label names.]
--- drivers/usb/host/ehci-orion.c | 45 ++++++++++++++++++++++++++++--------------- 1 file changed, 29 insertions(+), 16 deletions(-)
drivers/usb/host/ehci-orion.c +29 -16
@@ -42,6 +42,12 @@#define DRIVER_DESC "EHCI orion driver" +#define hcd_to_orion_priv (h) ((struct orion_ehci_hcd *)hcd_to_ehci(h)->priv) + +struct orion_ehci_hcd { +struct clk *clk; +}; +static const char hcd_name[] ="ehci-orion" ;static struct hc_driver __read_mostly ehci_orion_hc_driver;
@@ -137,6 +143,10 @@ ehci_orion_conf_mbus_windows(struct usb_hcd *hcd, } } +static const struct ehci_driver_overrides orion_overrides__initconst = { + .extra_priv_size =sizeof (struct orion_ehci_hcd ), +}; +static int ehci_orion_drv_probe (struct platform_device *pdev) {struct orion_ehci_data *pd =dev_get_platdata (&pdev->dev);
@@ -144,10 +154,10 @@ static int ehci_orion_drv_probe(struct platform_device *pdev)struct resource *res;struct usb_hcd *hcd;struct ehci_hcd *ehci; -struct clk *clk;void __iomem *regs;int irq, err;enum orion_ehci_phy_ver phy_version; +struct orion_ehci_hcd *priv;if (usb_disabled ())return -ENODEV ;
@@ -187,17 +197,11 @@ static int ehci_orion_drv_probe(struct platform_device *pdev) goto err; } -/* Not all platforms can gate the clock, so it is not -an error if the clock does not exists. */ - clk =devm_clk_get (&pdev->dev,NULL ); -if (!IS_ERR (clk)) -clk_prepare_enable (clk); - hcd =usb_create_hcd (&ehci_orion_hc_driver, &pdev->dev,dev_name (&pdev->dev));if (!hcd) { err = -ENOMEM ; - goto err_create_hcd; + goto err; } hcd->rsrc_start = res->start;
@@ -208,6 +212,15 @@ static int ehci_orion_drv_probe(struct platform_device *pdev) ehci->caps = hcd->regs +0x100 ; hcd->has_tt =1 ; + priv =hcd_to_orion_priv (hcd); +/* +* Not all platforms can gate the clock, so it is not an error if +* the clock does not exists. +*/ + priv->clk =devm_clk_get (&pdev->dev,NULL ); +if (!IS_ERR (priv->clk)) +clk_prepare_enable (priv->clk); +/* * (Re-)program MBUS remapping windows if we are asked to. */
@@ -243,10 +256,9 @@ static int ehci_orion_drv_probe(struct platform_device *pdev)return 0 ; err_add_hcd: +if (!IS_ERR (priv->clk)) +clk_disable_unprepare (priv->clk);usb_put_hcd (hcd); -err_create_hcd: -if (!IS_ERR (clk)) -clk_disable_unprepare (clk); err:dev_err (&pdev->dev,"init %s fail, %d\n" ,dev_name (&pdev->dev), err);
@@ -257,14 +269,15 @@ err:static int ehci_orion_drv_remove (struct platform_device *pdev) {struct usb_hcd *hcd =platform_get_drvdata (pdev); -struct clk *clk; +struct orion_ehci_hcd *priv =hcd_to_orion_priv (hcd);usb_remove_hcd (hcd); + +if (!IS_ERR (priv->clk)) +clk_disable_unprepare (priv->clk); +usb_put_hcd (hcd); - clk =devm_clk_get (&pdev->dev,NULL ); -if (!IS_ERR (clk)) -clk_disable_unprepare (clk);return 0 ; }
@@ -292,7 +305,7 @@ static int __init ehci_orion_init(void)pr_info ("%s: " DRIVER_DESC "\n" , hcd_name); -ehci_init_driver (&ehci_orion_hc_driver,NULL ); +ehci_init_driver (&ehci_orion_hc_driver, &orion_overrides);return platform_driver_register (&ehci_orion_driver); }module_init (ehci_orion_init);
Signature · 1 line
1.9.2
PATCH v4 4/20 usb: ehci-orion: add optional PHY support
In reply to Thomas PetazzoniFrom: Gregory CLEMENT <[email protected]>
This commit extends the ehci-orion so that it can optionally be passed a reference to a PHY through the Device Tree. It will be useful for the Armada 375 SoCs. If no PHY is provided then the behavior of the driver is unchanged.
[Thomas: use devm_phy_optional_get() so that we handle -EPROBE_DEFER properly. Also call phy_power_off() when needed, and rename goto labels.]
--- drivers/usb/host/ehci-orion.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
drivers/usb/host/ehci-orion.c +28 -0
@@ -15,6 +15,7 @@#include <linux/clk.h> #include <linux/platform_data/usb-ehci-orion.h> #include <linux/of.h> +#include <linux/phy/phy.h> #include <linux/of_device.h> #include <linux/of_irq.h> #include <linux/usb.h>
@@ -46,6 +47,7 @@struct orion_ehci_hcd {struct clk *clk; +struct phy *phy; };static const char hcd_name[] ="ehci-orion" ;
@@ -221,6 +223,20 @@ static int ehci_orion_drv_probe(struct platform_device *pdev)if (!IS_ERR (priv->clk))clk_prepare_enable (priv->clk); + priv->phy =devm_phy_optional_get (&pdev->dev,"usb" ); +if (IS_ERR (priv->phy)) { + err =PTR_ERR (priv->phy); + goto err_phy_get; + }else { + err =phy_init (priv->phy); +if (err) + goto err_phy_init; + + err =phy_power_on (priv->phy); +if (err) + goto err_phy_power_on; + } +/* * (Re-)program MBUS remapping windows if we are asked to. */
@@ -256,6 +272,13 @@ static int ehci_orion_drv_probe(struct platform_device *pdev)return 0 ; err_add_hcd: +if (!IS_ERR (priv->phy)) +phy_power_off (priv->phy); +err_phy_power_on: +if (!IS_ERR (priv->phy)) +phy_exit (priv->phy); +err_phy_init: +err_phy_get:if (!IS_ERR (priv->clk))clk_disable_unprepare (priv->clk);usb_put_hcd (hcd);
@@ -273,6 +296,11 @@ static int ehci_orion_drv_remove(struct platform_device *pdev)usb_remove_hcd (hcd); +if (!IS_ERR (priv->phy)) { +phy_power_off (priv->phy); +phy_exit (priv->phy); + } +if (!IS_ERR (priv->clk))clk_disable_unprepare (priv->clk);
Signature · 1 line
1.9.2
PATCH v4 5/20 Documentation: dt-bindings: update ehci-orion binding documentation
In reply to Thomas PetazzoniThis commit updates the Device Tree binding documentation of ehci-orion to take into account the fact that we can now optionally pass a clock and a PHY reference.
--- Documentation/devicetree/bindings/usb/ehci-orion.txt | 5 +++++ 1 file changed, 5 insertions(+)
Documentation/devicetree/bindings/usb/ehci-orion.txt +5 -0
@@ -6,6 +6,11 @@ Required properties: region. - interrupts: The EHCI interrupt +Optional properties: +- clocks: reference to the clock +- phys: reference to the USB PHY +- phy-names: name of the USB PHY, should be "usb" + Example: ehci at 50000 {
Signature · 1 line
1.9.2
PATCH v4 6/20 usb: host: xhci-plat: sort the headers in alphabetic order
In reply to Thomas PetazzoniFrom: Gregory CLEMENT <[email protected]>
Sorting the headers in alphabetic order will help to reduce the conflict when adding new headers later.
--- drivers/usb/host/xhci-plat.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/usb/host/xhci-plat.c +3 -3
@@ -11,11 +11,11 @@* version 2 as published by the Free Software Foundation. */ -#include <linux/platform_device.h> +#include <linux/dma-mapping.h> #include <linux/module.h> -#include <linux/slab.h> #include <linux/of.h> -#include <linux/dma-mapping.h> +#include <linux/platform_device.h> +#include <linux/slab.h> #include "xhci.h"
Signature · 1 line
1.9.2
PATCH v4 7/20 usb: host: xhci-plat: add clock support
In reply to Thomas PetazzoniFrom: Gregory CLEMENT <[email protected]>
Some platforms (such as the Armada 38x ones) can gate the clock of their USB controller. This patch adds the support for one clock in xhci-plat, by enabling it during probe and disabling it on remove.
To achieve this, it adds a 'struct clk *' member in xhci_hcd. While only used for now in xhci-plat, it might be used by other drivers in the future. Moreover, the xhci_hcd structure already holds other members such as msix_count and msix_entries, which are MSI-X specific, and therefore only used by xhci-pci.
--- drivers/usb/host/xhci-plat.c | 24 +++++++++++++++++++++++- drivers/usb/host/xhci.h | 2 ++ 2 files changed, 25 insertions(+), 1 deletion(-)
drivers/usb/host/xhci-plat.c +23 -1
@@ -11,6 +11,7 @@* version 2 as published by the Free Software Foundation. */ +#include <linux/clk.h> #include <linux/dma-mapping.h> #include <linux/module.h> #include <linux/of.h>
@@ -91,6 +92,7 @@ static int xhci_plat_probe(struct platform_device *pdev)struct xhci_hcd *xhci;struct resource *res;struct usb_hcd *hcd; +struct clk *clk;int ret;int irq;
@@ -137,14 +139,27 @@ static int xhci_plat_probe(struct platform_device *pdev) goto release_mem_region; } +/* +* Not all platforms have a clk so it is not an error if the +* clock does not exists. +*/ + clk =devm_clk_get (&pdev->dev,NULL ); +if (!IS_ERR (clk)) { + ret =clk_prepare_enable (clk); +if (ret) + goto unmap_registers; + } + ret =usb_add_hcd (hcd, irq,IRQF_SHARED );if (ret) - goto unmap_registers; + goto disable_clk; +device_wakeup_enable (hcd->self.controller);/* USB 2.0 roothub is stored in the platform_device now. */ hcd =platform_get_drvdata (pdev); xhci =hcd_to_xhci (hcd); + xhci->clk = clk; xhci->shared_hcd =usb_create_shared_hcd (driver, &pdev->dev,dev_name (&pdev->dev), hcd);if (!xhci->shared_hcd) {
@@ -173,6 +188,10 @@ put_usb3_hcd: dealloc_usb2_hcd:usb_remove_hcd (hcd); +disable_clk: +if (!IS_ERR (clk)) +clk_disable_unprepare (clk); + unmap_registers:iounmap (hcd->regs);
@@ -189,11 +208,14 @@ static int xhci_plat_remove(struct platform_device *dev) {struct usb_hcd *hcd =platform_get_drvdata (dev);struct xhci_hcd *xhci =hcd_to_xhci (hcd); +struct clk *clk = xhci->clk;usb_remove_hcd (xhci->shared_hcd);usb_put_hcd (xhci->shared_hcd);usb_remove_hcd (hcd); +if (!IS_ERR (clk)) +clk_disable_unprepare (clk);iounmap (hcd->regs);release_mem_region (hcd->rsrc_start, hcd->rsrc_len);usb_put_hcd (hcd);
drivers/usb/host/xhci.h +2 -0
@@ -1478,6 +1478,8 @@ struct xhci_hcd {/* msi-x vectors */ int msix_count;struct msix_entry *msix_entries; +/* optional clock */ +struct clk *clk;/* data structures */ struct xhci_device_context_array *dcbaa;struct xhci_ring *cmd_ring;
Signature · 1 line
1.9.2
PATCH v4 8/20 usb: host: xhci-plat: add support for the Armada 375/38x XHCI controllers
In reply to Thomas PetazzoniFrom: Gregory CLEMENT <[email protected]>
The Armada 375 and 38x SoCs come with an XHCI controller that requires some specific initialization related to the MBus windows configuration. This patch adds the support for this special configuration as an XHCI quirk executed during probe.
Two new compatible strings are added to identify the Armada 375 and Armada 38x XHCI controllers, and therefore enable the relevant quirk.
--- drivers/usb/host/Kconfig | 8 +++++ drivers/usb/host/Makefile | 3 ++ drivers/usb/host/xhci-mvebu.c | 70 +++++++++++++++++++++++++++++++++++++++++++ drivers/usb/host/xhci-mvebu.h | 21 +++++++++++++ drivers/usb/host/xhci-plat.c | 12 ++++++++ 5 files changed, 114 insertions(+) create mode 100644 drivers/usb/host/xhci-mvebu.c create mode 100644 drivers/usb/host/xhci-mvebu.h
drivers/usb/host/Kconfig +8 -0
@@ -29,6 +29,14 @@ if USB_XHCI_HCD config USB_XHCI_PLATFORM tristate +config USB_XHCI_MVEBU + tristate "xHCI support for Marvell Armada 375/38x" + select USB_XHCI_PLATFORM + depends on ARCH_MVEBU || COMPILE_TEST + ---help--- + Say 'Y' to enable the support for the xHCI host controller + found in Marvell Armada 375/38x ARM SOCs. + endif # USB_XHCI_HCD config USB_EHCI_HCD
drivers/usb/host/Makefile +3 -0
@@ -19,6 +19,9 @@ xhci-hcd-$(CONFIG_PCI) += xhci-pci.o ifneq ($(CONFIG_USB_XHCI_PLATFORM), ) xhci-hcd-y += xhci-plat.o +ifneq ($(CONFIG_USB_XHCI_MVEBU), ) + xhci-hcd-y += xhci-mvebu.o +endif endif obj-$(CONFIG_USB_WHCI_HCD) += whci/
drivers/usb/host/xhci-mvebu.c new file +70 -0
70 lines not on this page · raw message
drivers/usb/host/xhci-mvebu.h new file +21 -0
@@ -0,0 +1,21 @@ +/* +* Copyright (C) 2014 Marvell +* +* Gregory Clement <[email protected]> +* +* This file is licensed under the terms of the GNU General Public +* License version 2. This program is licensed "as is" without any +* warranty of any kind, whether express or implied. +*/ + +#ifndef __LINUX_XHCI_MVEBU_H +#define __LINUX_XHCI_MVEBU_H +#if IS_ENABLED (CONFIG_USB_XHCI_MVEBU ) +int xhci_mvebu_mbus_init_quirk (struct platform_device *pdev); +#else +static inline int xhci_mvebu_mbus_init_quirk (struct device dev) +{ +return 0 ; +} +#endif +#endif /* __LINUX_XHCI_MVEBU_H */
drivers/usb/host/xhci-plat.c +12 -0
@@ -19,6 +19,7 @@#include <linux/slab.h> #include "xhci.h" +#include "xhci-mvebu.h" static void xhci_plat_quirks (struct device *dev,struct xhci_hcd *xhci) {
@@ -109,6 +110,15 @@ static int xhci_plat_probe(struct platform_device *pdev)if (!res)return -ENODEV ; +if (of_device_is_compatible (pdev->dev.of_node, +"marvell,armada-375-xhci" ) || +of_device_is_compatible (pdev->dev.of_node, +"marvell,armada-380-xhci" )) { + ret =xhci_mvebu_mbus_init_quirk (pdev); +if (ret) +return ret; + } +/* Initialize dma_mask and coherent_dma_mask to 32-bits */ ret =dma_set_coherent_mask (&pdev->dev,DMA_BIT_MASK (32 ));if (ret)
@@ -253,6 +263,8 @@ static const struct dev_pm_ops xhci_plat_pm_ops = {static const struct of_device_id usb_xhci_of_match[] = { { .compatible ="generic-xhci" }, { .compatible ="xhci-platform" }, + { .compatible ="marvell,armada-375-xhci" }, + { .compatible ="marvell,armada-380-xhci" }, { }, };MODULE_DEVICE_TABLE (of, usb_xhci_of_match);
Signature · 1 line
1.9.2
PATCH v4 8/20 usb: host: xhci-plat: add support for the Armada 375/38x XHCI controllers
Hi,
Quoted 12 lines · Thomas Petazzoni
drivers/usb/host/xhci-mvebu.h new file +6
-0@@ -0,0 +1,21 @@ +/* +* Copyright (C) 2014 Marvell +* +* Gregory Clement <[email protected]> +* +* This file is licensed under the terms of the GNU General Public
drivers/usb/host/xhci-mvebu.h line 16
Quoted 10 lines
drivers/usb/host/xhci-mvebu.h new file +10
-0+* License version 2. This program is licensed "as is" without any +* warranty of any kind, whether express or implied. +*/ + +#ifndef __LINUX_XHCI_MVEBU_H +#define __LINUX_XHCI_MVEBU_H +#if IS_ENABLED (CONFIG_USB_XHCI_MVEBU ) +int xhci_mvebu_mbus_init_quirk (struct platform_device *pdev); +#else +static inline int xhci_mvebu_mbus_init_quirk (struct device dev)
I could not compile this code when I disabled CONFIG_USB_XHCI_MVEBU:
incompatible type for argument 1 of 'xhci_mvebu_mbus_init_quirk'.
So, the "struct device dev" should be changed to "struct platform_device *pdev".
Best regards,
Yoshihiro Shimoda
PATCH v4 8/20 usb: host: xhci-plat: add support for the Armada 375/38x XHCI controllers
Dear Shimoda, Yoshihiro,
Quoted 11 lines · Yoshihiro
drivers/usb/host/xhci-mvebu.h line 16
Quoted 6 lines
drivers/usb/host/xhci-mvebu.h new file +6
-0+#ifndef __LINUX_XHCI_MVEBU_H +#define __LINUX_XHCI_MVEBU_H +#if IS_ENABLED (CONFIG_USB_XHCI_MVEBU ) +int xhci_mvebu_mbus_init_quirk (struct platform_device *pdev); +#else +static inline int xhci_mvebu_mbus_init_quirk (struct device dev)I could not compile this code when I disabled
CONFIG_USB_XHCI_MVEBU:
incompatible type for argument 1 of 'xhci_mvebu_mbus_init_quirk'.So, the "struct device dev" should be changed to "struct
platform_device*pdev".
Ah, yes, correct, thanks! Will fix in v5.
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
PATCH v4 9/20 Documentation: dt-bindings: update xhci-platform DT binding
In reply to Thomas PetazzoniFrom: Gregory CLEMENT <[email protected]>
This commit extends the compatible string list of the xhci-platform binding with the new "armada-375-xhci" and "armada-380-xhci" compatible strings. It is used to describe the XHCI controller which is available in the Armada 375 and 38x SoCs.
It also indicates that an optional 'clocks' property is now supported.
--- Documentation/devicetree/bindings/usb/usb-xhci.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/usb/usb-xhci.txt +6 -1
@@ -1,11 +1,16 @@ USB xHCI controllers Required properties: - - compatible: should be "generic-xhci" (deprecated: "xhci-platform"). + - compatible: should be one of "generic-xhci", + "marvell,armada-375-xhci", "marvell,armada-380-xhci" (deprecated: + "xhci-platform"). - reg: should contain address and length of the standard XHCI register set for the device. - interrupts: one XHCI interrupt should be described here. +Optional property: + - clocks: reference to a clock + Example: usb at f0931000 { compatible = "generic-xhci";
Signature · 1 line
1.9.2
PATCH v4 10/20 phy: add support for USB cluster on the Armada 375 SoC
In reply to Thomas PetazzoniFrom: Gregory CLEMENT <[email protected]>
The Armada 375 SoC comes with an USB2 host and device controller and an USB3 controller. The USB cluster control register allows to manage common features of both USB controllers.
This commit adds a driver integrated in the generic PHY framework to control this USB cluster feature.
--- drivers/phy/Kconfig | 6 ++ drivers/phy/Makefile | 1 + drivers/phy/phy-armada375-usb2.c | 157 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 164 insertions(+) create mode 100644 drivers/phy/phy-armada375-usb2.c
drivers/phy/Kconfig +6 -0
@@ -15,6 +15,12 @@ config GENERIC_PHY phy users can obtain reference to the PHY. All the users of this framework should select this config. +config ARMADA375_USBCLUSTER_PHY + def_bool y + depends on MACH_ARMADA_375 || COMPILE_TEST + depends on OF + select GENERIC_PHY + config PHY_EXYNOS_MIPI_VIDEO tristate "S5P/EXYNOS SoC series MIPI CSI-2/DSI PHY driver" depends on HAS_IOMEM
drivers/phy/Makefile +1 -0
@@ -3,6 +3,7 @@ # obj-$(CONFIG_GENERIC_PHY) += phy-core.o +obj-$(CONFIG_ARMADA375_USBCLUSTER_PHY) += phy-armada375-usb2.o obj-$(CONFIG_BCM_KONA_USB2_PHY) += phy-bcm-kona-usb2.o obj-$(CONFIG_PHY_EXYNOS_DP_VIDEO) += phy-exynos-dp-video.o obj-$(CONFIG_PHY_EXYNOS_MIPI_VIDEO) += phy-exynos-mipi-video.o
drivers/phy/phy-armada375-usb2.c new file +157 -0
157 lines not on this page · raw message
Signature · 1 line
1.9.2
PATCH v4 11/20 Documentation: dt-bindings: document the Armada 375 USB cluster binding
In reply to Thomas PetazzoniFrom: Gregory CLEMENT <[email protected]>
Armada 375 comes with an USB2 host and device controller and an USB3 controller. The USB cluster control register allows to manage common features of both USB controllers. This commit adds the Device Tree binding documentation for this piece of hardware.
--- .../bindings/phy/armada-375-usb-phy-cluster.txt | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/armada-375-usb-phy-cluster.txt
Documentation/devicetree/bindings/phy/armada-375-usb-phy-cluster.txt new file +19 -0
@@ -0,0 +1,19 @@ +Armada 375 USB cluster +---------------------- + +Armada 375 comes with an USB2 host and device controller and an USB3 +controller. The USB cluster control register allows to manage common +features of both USB controllers. + +Required properties: + +- compatible: "marvell,armada-375-usb-cluster" +- reg: Should contain usb cluster register location and length. +- #phy-cells : from the generic phy bindings, must be 1 + +Example: + usbcluster: usb-cluster at 18400 { + compatible = "marvell,armada-375-usb-cluster"; + reg = <0x18400 0x4>; + #phy-cells = <1> + };
Signature · 1 line
1.9.2
PATCH v4 12/20 ARM: mvebu: add USB3 support for Armada 38x
In reply to Thomas PetazzoniFrom: Gregory CLEMENT <[email protected]>
This patch adds the selection of the config symbol needed to build the USB3 support for Armada 38x into mvebu_v7_defconfig.
--- arch/arm/mach-mvebu/Kconfig | 1 + 1 file changed, 1 insertion(+)
arch/arm/mach-mvebu/Kconfig +1 -0
@@ -54,6 +54,7 @@ config MACH_ARMADA_38X select CPU_V7 select MACH_MVEBU_V7 select PINCTRL_ARMADA_38X + select USB_ARCH_HAS_XHCI help Say 'Y' here if you want your kernel to support boards based on the Marvell Armada 380/385 SoC with device tree.
Signature · 1 line
1.9.2
PATCH v4 13/20 ARM: mvebu: add USB3 support for Armada 375
In reply to Thomas PetazzoniFrom: Gregory CLEMENT <[email protected]>
This patch add the selection of the config symbol to build the USB3 support for Armada 375.
--- arch/arm/mach-mvebu/Kconfig | 1 + 1 file changed, 1 insertion(+)
arch/arm/mach-mvebu/Kconfig +1 -0
@@ -41,6 +41,7 @@ config MACH_ARMADA_375 select CPU_V7 select MACH_MVEBU_V7 select PINCTRL_ARMADA_375 + select USB_ARCH_HAS_XHCI help Say 'Y' here if you want your kernel to support boards based on the Marvell Armada 375 SoC with device tree.
Signature · 1 line
1.9.2
PATCH v4 14/20 ARM: configs: enable XHCI mvebu support in mvebu_v7_defconfig
In reply to Thomas PetazzoniFrom: Gregory CLEMENT <[email protected]>
The Marvell Armada 38x platform needs the xhci_mvebu driver enabled for the xHCI USB hosts, so this commit enables the corresponding Kconfig option in mvebu_v7_defconfig.
--- arch/arm/configs/mvebu_v7_defconfig | 1 + 1 file changed, 1 insertion(+)
arch/arm/configs/mvebu_v7_defconfig +1 -0
@@ -78,6 +78,7 @@ CONFIG_USB_EHCI_HCD=y CONFIG_USB_EHCI_ROOT_HUB_TT=y CONFIG_USB_STORAGE=y CONFIG_USB_XHCI_HCD=y +CONFIG_USB_XHCI_MVEBU=y CONFIG_MMC=y CONFIG_MMC_MVSDIO=y CONFIG_NEW_LEDS=y
Signature · 1 line
1.9.2
PATCH v4 15/20 ARM: configs: enable XHCI mvebu support in multi_v7_defconfig
In reply to Thomas PetazzoniFrom: Gregory CLEMENT <[email protected]>
The Marvell Armada 38x platform needs the xhci_mvebu driver enabled for the xHCI USB hosts, so this commit enables the corresponding Kconfig option in multi_v7_defconfig.
--- arch/arm/configs/multi_v7_defconfig | 1 + 1 file changed, 1 insertion(+)
arch/arm/configs/multi_v7_defconfig +1 -0
@@ -254,6 +254,7 @@ CONFIG_SND_SOC_TEGRA_ALC5632=y CONFIG_SND_SOC_TEGRA_MAX98090=y CONFIG_USB=y CONFIG_USB_XHCI_HCD=y +CONFIG_USB_XHCI_MVEBU=y CONFIG_USB_EHCI_HCD=y CONFIG_USB_EHCI_TEGRA=y CONFIG_USB_EHCI_HCD_PLATFORM=y
Signature · 1 line
1.9.2
Olof Johansson
AppliedPATCH v4 15/20 ARM: configs: enable XHCI mvebu support in multi_v7_defconfig
Quoted 6 lines · Thomas Petazzoni
From: Gregory CLEMENT <[email protected]>
The Marvell Armada 38x platform needs the
xhci_mvebudriver enabled for the xHCI USB hosts, so this commit enables the correspondingKconfigoption inmulti_v7_defconfig.
Quoted 6 lines
Signed-off-by Gregory CLEMENT <[email protected]>Signed-off-by Thomas Petazzoni <[email protected]>Cc arm at kernel.orgCc Kevin Hilman <[email protected]>Cc Olof Johansson <[email protected]>Cc Arnd Bergmann <[email protected]>
Applied.
-Olof
PATCH v4 16/20 ARM: mvebu: add Device Tree description of xHCI controllers on Armada 38x
In reply to Thomas PetazzoniFrom: Gregory CLEMENT <[email protected]>
The Marvell Armada 38x SoCs contains two xHCI controllers. This commit adds the Device Tree description of those interfaces at the SoC level, and also enables the two USB3 ports on the Armada 385 DB platform and one USB3 port on the Armada 385 RD platform.
--- arch/arm/boot/dts/armada-385-db.dts | 8 ++++++++ arch/arm/boot/dts/armada-385-rd.dts | 4 ++++ arch/arm/boot/dts/armada-38x.dtsi | 17 +++++++++++++++++ 3 files changed, 29 insertions(+)
arch/arm/boot/dts/armada-385-db.dts +8 -0
@@ -101,6 +101,14 @@ reg = <0x1000000 0x3f000000>; }; }; + + usb3 at f0000 { + status = "okay"; + }; + + usb3 at f8000 { + status = "okay"; + }; }; pcie-controller {
arch/arm/boot/dts/armada-385-rd.dts +4 -0
@@ -77,6 +77,10 @@ reg = <1>; }; }; + + usb3 at f0000 { + status = "okay"; + }; }; pcie-controller {
arch/arm/boot/dts/armada-38x.dtsi +17 -0
@@ -355,6 +355,23 @@ clocks = <&coredivclk 0>; status = "disabled"; }; + + usb3 at f0000 { + compatible = "marvell,armada-380-xhci"; + reg = <0xf0000 0x4000>,<0xf4000 0x4000>; + interrupts = <GIC_SPI 16 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&gateclk 9>; + status = "disabled"; + }; + + usb3 at f8000 { + compatible = "marvell,armada-380-xhci"; + reg = <0xf8000 0x4000>,<0xfc000 0x4000>; + interrupts = <GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&gateclk 10>; + status = "disabled"; + }; + }; };
Signature · 1 line
1.9.2
PATCH v4 17/20 ARM: mvebu: add Device Tree description of the EHCI controller on Armada 38x
In reply to Thomas PetazzoniFrom: Gregory CLEMENT <[email protected]>
The Marvell Armada 38x SoCs contains one EHCI controller. This commit adds the Device Tree description of this interface at the SoC level, and also enables the USB2 port on the Armada 385 DB platform.
--- arch/arm/boot/dts/armada-385-db.dts | 4 ++++ arch/arm/boot/dts/armada-38x.dtsi | 8 ++++++++ 2 files changed, 12 insertions(+)
arch/arm/boot/dts/armada-385-db.dts +4 -0
@@ -65,6 +65,10 @@ phy-mode = "rgmii-id"; }; + usb at 50000 { + status = "ok"; + }; + ethernet at 70000 { status = "okay"; phy = <&phy0>;
arch/arm/boot/dts/armada-38x.dtsi +8 -0
@@ -283,6 +283,14 @@ status = "disabled"; }; + usb at 50000 { + compatible = "marvell,orion-ehci"; + reg = <0x58000 0x500>; + interrupts = <GIC_SPI 18 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&gateclk 18>; + status = "disabled"; + }; + xor at 60800 { compatible = "marvell,orion-xor"; reg = <0x60800 0x100
Signature · 1 line
1.9.2
PATCH v4 18/20 ARM: mvebu: add Device Tree description of USB cluster controller on Armada 375
In reply to Thomas PetazzoniFrom: Gregory CLEMENT <[email protected]>
On Armada 375, the USB cluster allows to control the cluster composed of the USB2 and USB3 host controllers.
--- arch/arm/boot/dts/armada-375.dtsi | 6 ++++++ 1 file changed, 6 insertions(+)
arch/arm/boot/dts/armada-375.dtsi +6 -0
@@ -320,6 +320,12 @@ clocks = <&coreclk 0>; }; + usbcluster: usb-cluster at 18400 { + compatible = "marvell,armada-375-usb-cluster"; + reg = <0x18400 0x4>; + #phy-cells = <1>; + }; + xor at 60800 { compatible = "marvell,orion-xor"; reg = <0x60800 0x100
Signature · 1 line
1.9.2
PATCH v4 19/20 ARM: mvebu: add Device Tree description of the xHCI controller on Armada 375
In reply to Thomas PetazzoniFrom: Gregory CLEMENT <[email protected]>
The Marvell Armada 375 SoCs contain a xHCI controller. This commit adds the Device Tree description of this interfaces at the SoC level, and also enables the USB3 port on the Armada 375 DB platform.
--- arch/arm/boot/dts/armada-375-db.dts | 4 ++++ arch/arm/boot/dts/armada-375.dtsi | 10 ++++++++++ 2 files changed, 14 insertions(+)
arch/arm/boot/dts/armada-375-db.dts +4 -0
@@ -102,6 +102,10 @@ }; }; + usb3 at 58000 { + status = "okay"; + }; + mvsdio at d4000 { pinctrl-0 = <&sdio_pins &sdio_st_pins>; pinctrl-names = "default";
arch/arm/boot/dts/armada-375.dtsi +10 -0
@@ -320,6 +320,16 @@ clocks = <&coreclk 0>; }; + usb3 at 58000 { + compatible = "marvell,armada-375-xhci"; + reg = <0x58000 0x20000>,<0x5b880 0x80>; + interrupts = <GIC_SPI 16 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&gateclk 16>; + phys = <&usbcluster 1>; + phy-names="usb"; + status = "disabled"; + }; + usbcluster: usb-cluster at 18400 { compatible = "marvell,armada-375-usb-cluster"; reg = <0x18400 0x4>;
Signature · 1 line
1.9.2
PATCH v4 20/20 ARM: mvebu: add Device Tree description of the EHCI controller on Armada 375
In reply to Thomas PetazzoniFrom: Gregory CLEMENT <[email protected]>
The Marvell Armada 375 SoCs contains one EHCI controller. This commit adds the Device Tree description of this interfaces at the SoC level, and also enables the USB2 port on the Armada 375 DB platform.
--- arch/arm/boot/dts/armada-375-db.dts | 4 ++++ arch/arm/boot/dts/armada-375.dtsi | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+)
arch/arm/boot/dts/armada-375-db.dts +4 -0
@@ -102,6 +102,10 @@ }; }; + usb at 54000 { + status = "okay"; + }; + usb3 at 58000 { status = "okay"; };
arch/arm/boot/dts/armada-375.dtsi +18 -0
@@ -320,6 +320,24 @@ clocks = <&coreclk 0>; }; + usb at 50000 { + compatible = "marvell,orion-ehci"; + reg = <0x50000 0x500>; + interrupts = <GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&gateclk 18>; + phys = <&usbcluster 0>; + phy-names = "usb"; + status = "disabled"; + }; + + usb at 54000 { + compatible = "marvell,orion-ehci"; + reg = <0x54000 0x500>; + interrupts = <GIC_SPI 18 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&gateclk 26>; + status = "disabled"; + }; + usb3 at 58000 { compatible = "marvell,armada-375-xhci"; reg = <0x58000 0x20000>,<0x5b880 0x80>;
Signature · 1 line
1.9.2