From 7150bc9b4d43471fa37b26f5839892d4cf1fe09b Mon Sep 17 00:00:00 2001 From: Wenyou Yang Date: Wed, 8 Jun 2016 12:15:10 +0800 Subject: usb: ohci-at91: Forcibly suspend ports while USB suspend In order to the save power consumption, as a workaround, suspend forcibly the USB PORTA/B/C via set the SUSPEND_A/B/C bits of OHCI Interrupt Configuration Register in the SFRs while OHCI USB suspend. This suspend operation must be done before the USB clock is disabled, resume after the USB clock is enabled. Signed-off-by: Wenyou Yang Signed-off-by: Greg Kroah-Hartman --- Documentation/devicetree/bindings/usb/atmel-usb.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'Documentation/devicetree') diff --git a/Documentation/devicetree/bindings/usb/atmel-usb.txt b/Documentation/devicetree/bindings/usb/atmel-usb.txt index 5883b73ea1b5..888deaa8a4ca 100644 --- a/Documentation/devicetree/bindings/usb/atmel-usb.txt +++ b/Documentation/devicetree/bindings/usb/atmel-usb.txt @@ -3,8 +3,10 @@ Atmel SOC USB controllers OHCI Required properties: - - compatible: Should be "atmel,at91rm9200-ohci" for USB controllers - used in host mode. + - compatible: Should be one of the following + "atmel,at91rm9200-ohci" for USB controllers used in host mode. + "atmel,sama5d2-ohci" for USB controllers used in host mode + on SAMA5D2 which can force to suspend. - reg: Address and length of the register set for the device - interrupts: Should contain ehci interrupt - clocks: Should reference the peripheral, host and system clocks -- cgit v1.2.3-59-g8ed1b From 62d9694a003dba585026df36c181e3ca930aeafc Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Thu, 2 Jun 2016 17:14:06 +0200 Subject: ohci-platform: Add support for controllers with multiple reset lines At least the EHCI/OHCI found on the Allwinnner H3 SoC needs multiple reset lines, the controller will not initialize while the reset for its companion is still asserted, which means we need to de-assert 2 resets for the controller to work. Signed-off-by: Hans de Goede Signed-off-by: Greg Kroah-Hartman --- Documentation/devicetree/bindings/usb/usb-ohci.txt | 2 +- drivers/usb/host/ohci-platform.c | 43 ++++++++++++---------- 2 files changed, 24 insertions(+), 21 deletions(-) (limited to 'Documentation/devicetree') diff --git a/Documentation/devicetree/bindings/usb/usb-ohci.txt b/Documentation/devicetree/bindings/usb/usb-ohci.txt index 19233b7365e1..9df456968596 100644 --- a/Documentation/devicetree/bindings/usb/usb-ohci.txt +++ b/Documentation/devicetree/bindings/usb/usb-ohci.txt @@ -14,7 +14,7 @@ Optional properties: - clocks : a list of phandle + clock specifier pairs - phys : phandle + phy specifier pair - phy-names : "usb" -- resets : phandle + reset specifier pair +- resets : a list of phandle + reset specifier pairs Example: diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c index ae1c988da146..898b74086c12 100644 --- a/drivers/usb/host/ohci-platform.c +++ b/drivers/usb/host/ohci-platform.c @@ -33,11 +33,12 @@ #define DRIVER_DESC "OHCI generic platform driver" #define OHCI_MAX_CLKS 3 +#define OHCI_MAX_RESETS 2 #define hcd_to_ohci_priv(h) ((struct ohci_platform_priv *)hcd_to_ohci(h)->priv) struct ohci_platform_priv { struct clk *clks[OHCI_MAX_CLKS]; - struct reset_control *rst; + struct reset_control *resets[OHCI_MAX_RESETS]; struct phy **phys; int num_phys; }; @@ -117,7 +118,7 @@ static int ohci_platform_probe(struct platform_device *dev) struct usb_ohci_pdata *pdata = dev_get_platdata(&dev->dev); struct ohci_platform_priv *priv; struct ohci_hcd *ohci; - int err, irq, phy_num, clk = 0; + int err, irq, phy_num, clk = 0, rst = 0; if (usb_disabled()) return -ENODEV; @@ -195,19 +196,21 @@ static int ohci_platform_probe(struct platform_device *dev) break; } } - - } - - priv->rst = devm_reset_control_get_optional(&dev->dev, NULL); - if (IS_ERR(priv->rst)) { - err = PTR_ERR(priv->rst); - if (err == -EPROBE_DEFER) - goto err_put_clks; - priv->rst = NULL; - } else { - err = reset_control_deassert(priv->rst); - if (err) - goto err_put_clks; + for (rst = 0; rst < OHCI_MAX_RESETS; rst++) { + priv->resets[rst] = + devm_reset_control_get_shared_by_index( + &dev->dev, rst); + if (IS_ERR(priv->resets[rst])) { + err = PTR_ERR(priv->resets[rst]); + if (err == -EPROBE_DEFER) + goto err_reset; + priv->resets[rst] = NULL; + break; + } + err = reset_control_deassert(priv->resets[rst]); + if (err) + goto err_reset; + } } if (pdata->big_endian_desc) @@ -265,8 +268,8 @@ err_power: if (pdata->power_off) pdata->power_off(dev); err_reset: - if (priv->rst) - reset_control_assert(priv->rst); + while (--rst >= 0) + reset_control_assert(priv->resets[rst]); err_put_clks: while (--clk >= 0) clk_put(priv->clks[clk]); @@ -284,15 +287,15 @@ static int ohci_platform_remove(struct platform_device *dev) struct usb_hcd *hcd = platform_get_drvdata(dev); struct usb_ohci_pdata *pdata = dev_get_platdata(&dev->dev); struct ohci_platform_priv *priv = hcd_to_ohci_priv(hcd); - int clk; + int clk, rst; usb_remove_hcd(hcd); if (pdata->power_off) pdata->power_off(dev); - if (priv->rst) - reset_control_assert(priv->rst); + for (rst = 0; rst < OHCI_MAX_RESETS && priv->resets[rst]; rst++) + reset_control_assert(priv->resets[rst]); for (clk = 0; clk < OHCI_MAX_CLKS && priv->clks[clk]; clk++) clk_put(priv->clks[clk]); -- cgit v1.2.3-59-g8ed1b From aa5e94a2e13377e374795de5400e346c978f46be Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 20 Jun 2016 07:42:07 -0700 Subject: Revert "usb: ohci-at91: Forcibly suspend ports while USB suspend" This reverts commit 7150bc9b4d43471fa37b26f5839892d4cf1fe09b. It is not correct, based on review from others. Reported-by: Wenyou Yang Signed-off-by: Greg Kroah-Hartman --- .../devicetree/bindings/usb/atmel-usb.txt | 6 +- drivers/usb/host/ohci-at91.c | 80 +--------------------- include/soc/at91/at91_sfr.h | 29 -------- 3 files changed, 3 insertions(+), 112 deletions(-) delete mode 100644 include/soc/at91/at91_sfr.h (limited to 'Documentation/devicetree') diff --git a/Documentation/devicetree/bindings/usb/atmel-usb.txt b/Documentation/devicetree/bindings/usb/atmel-usb.txt index 888deaa8a4ca..5883b73ea1b5 100644 --- a/Documentation/devicetree/bindings/usb/atmel-usb.txt +++ b/Documentation/devicetree/bindings/usb/atmel-usb.txt @@ -3,10 +3,8 @@ Atmel SOC USB controllers OHCI Required properties: - - compatible: Should be one of the following - "atmel,at91rm9200-ohci" for USB controllers used in host mode. - "atmel,sama5d2-ohci" for USB controllers used in host mode - on SAMA5D2 which can force to suspend. + - compatible: Should be "atmel,at91rm9200-ohci" for USB controllers + used in host mode. - reg: Address and length of the register set for the device - interrupts: Should contain ehci interrupt - clocks: Should reference the peripheral, host and system clocks diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c index 54e8feb8a964..d177372bb357 100644 --- a/drivers/usb/host/ohci-at91.c +++ b/drivers/usb/host/ohci-at91.c @@ -21,11 +21,8 @@ #include #include #include -#include -#include #include #include -#include #include "ohci.h" @@ -48,18 +45,12 @@ struct at91_usbh_data { u8 overcurrent_changed[AT91_MAX_USBH_PORTS]; }; -struct ohci_at91_caps { - bool suspend_ctrl; -}; - struct ohci_at91_priv { struct clk *iclk; struct clk *fclk; struct clk *hclk; bool clocked; bool wakeup; /* Saved wake-up state for resume */ - const struct ohci_at91_caps *caps; - struct regmap *sfr_regmap; }; /* interface and function clocks; sometimes also an AHB clock */ @@ -141,17 +132,6 @@ static void at91_stop_hc(struct platform_device *pdev) /*-------------------------------------------------------------------------*/ -struct regmap *at91_dt_syscon_sfr(void) -{ - struct regmap *regmap; - - regmap = syscon_regmap_lookup_by_compatible("atmel,sama5d2-sfr"); - if (IS_ERR(regmap)) - regmap = NULL; - - return regmap; -} - static void usb_hcd_at91_remove (struct usb_hcd *, struct platform_device *); /* configure so an HC device and id are always provided */ @@ -217,17 +197,6 @@ static int usb_hcd_at91_probe(const struct hc_driver *driver, goto err; } - ohci_at91->caps = (const struct ohci_at91_caps *) - of_device_get_match_data(&pdev->dev); - if (!ohci_at91->caps) - return -ENODEV; - - if (ohci_at91->caps->suspend_ctrl) { - ohci_at91->sfr_regmap = at91_dt_syscon_sfr(); - if (!ohci_at91->sfr_regmap) - dev_warn(dev, "failed to find sfr node\n"); - } - board = hcd->self.controller->platform_data; ohci = hcd_to_ohci(hcd); ohci->num_ports = board->ports; @@ -471,17 +440,8 @@ static irqreturn_t ohci_hcd_at91_overcurrent_irq(int irq, void *data) return IRQ_HANDLED; } -static const struct ohci_at91_caps at91rm9200_caps = { - .suspend_ctrl = false, -}; - -static const struct ohci_at91_caps sama5d2_caps = { - .suspend_ctrl = true, -}; - static const struct of_device_id at91_ohci_dt_ids[] = { - { .compatible = "atmel,at91rm9200-ohci", .data = &at91rm9200_caps }, - { .compatible = "atmel,sama5d2-ohci", .data = &sama5d2_caps }, + { .compatible = "atmel,at91rm9200-ohci" }, { /* sentinel */ } }; @@ -621,38 +581,6 @@ static int ohci_hcd_at91_drv_remove(struct platform_device *pdev) return 0; } -static int ohci_at91_port_ctrl(struct regmap *regmap, bool enable) -{ - u32 regval; - int ret; - - if (!regmap) - return -EINVAL; - - ret = regmap_read(regmap, SFR_OHCIICR, ®val); - if (ret) - return ret; - - if (enable) - regval &= ~SFR_OHCIICR_USB_SUSPEND; - else - regval |= SFR_OHCIICR_USB_SUSPEND; - - regmap_write(regmap, SFR_OHCIICR, regval); - - return 0; -} - -static int ohci_at91_port_suspend(struct regmap *regmap) -{ - return ohci_at91_port_ctrl(regmap, false); -} - -static int ohci_at91_port_resume(struct regmap *regmap) -{ - return ohci_at91_port_ctrl(regmap, true); -} - static int __maybe_unused ohci_hcd_at91_drv_suspend(struct device *dev) { @@ -690,9 +618,6 @@ ohci_hcd_at91_drv_suspend(struct device *dev) ohci_writel(ohci, ohci->hc_control, &ohci->regs->control); ohci->rh_state = OHCI_RH_HALTED; - if (ohci_at91->caps->suspend_ctrl) - ohci_at91_port_suspend(ohci_at91->sfr_regmap); - /* flush the writes */ (void) ohci_readl (ohci, &ohci->regs->control); at91_stop_clock(ohci_at91); @@ -712,9 +637,6 @@ ohci_hcd_at91_drv_resume(struct device *dev) at91_start_clock(ohci_at91); - if (ohci_at91->caps->suspend_ctrl) - ohci_at91_port_resume(ohci_at91->sfr_regmap); - ohci_resume(hcd, false); return 0; } diff --git a/include/soc/at91/at91_sfr.h b/include/soc/at91/at91_sfr.h deleted file mode 100644 index 04a3a1eee22e..000000000000 --- a/include/soc/at91/at91_sfr.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Header file for the Atmel DDR/SDR SDRAM Controller - * - * Copyright (C) 2016 Atmel Corporation - * - * Author: Wenyou Yang - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - */ -#ifndef __AT91_SFR_H__ -#define __AT91_SFR_H__ - -#define SFR_DDRCFG 0x04 /* DDR Configuration Register */ -/* 0x08 ~ 0x0c: Reserved */ -#define SFR_OHCIICR 0x10 /* OHCI Interrupt Configuration Register */ -#define SFR_OHCIISR 0x14 /* OHCI Interrupt Status Register */ - -#define SFR_OHCIICR_SUSPEND_A BIT(8) -#define SFR_OHCIICR_SUSPEND_B BIT(9) -#define SFR_OHCIICR_SUSPEND_C BIT(10) - -#define SFR_OHCIICR_USB_SUSPEND (SFR_OHCIICR_SUSPEND_A | \ - SFR_OHCIICR_SUSPEND_B | \ - SFR_OHCIICR_SUSPEND_C) - -#endif -- cgit v1.2.3-59-g8ed1b From ebfad91c5da3b32d83aaad280d6918867aea501c Mon Sep 17 00:00:00 2001 From: Jisheng Zhang Date: Thu, 16 Jun 2016 16:13:18 +0800 Subject: dt-bindings: ci-hdrc-usb2: s/gadget-itc-setting/itc-setting in example What the code expect is "itc-setting" rather than "gadget-itc-setting", and this is also correctly described in the optional properties. Signed-off-by: Jisheng Zhang Signed-off-by: Peter Chen Acked-by: Rob Herring --- Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Documentation/devicetree') diff --git a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt index 1084e2bcbe1c..341dc67f3472 100644 --- a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt +++ b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt @@ -93,7 +93,7 @@ Example: phys = <&usb_phy0>; phy-names = "usb-phy"; vbus-supply = <®_usb0_vbus>; - gadget-itc-setting = <0x4>; /* 4 micro-frames */ + itc-setting = <0x4>; /* 4 micro-frames */ /* Incremental burst of unspecified length */ ahb-burst-config = <0x0>; tx-burst-size-dword = <0x10>; /* 64 bytes */ -- cgit v1.2.3-59-g8ed1b From 5358aa3ea1d1f1d1b79c7f9e7c41449f584228fa Mon Sep 17 00:00:00 2001 From: David Lechner Date: Mon, 9 May 2016 18:39:58 -0500 Subject: dt-bindings: Add bindings for phy-da8xx-usb Device tree binding for new phy-da8xx-usb driver. Signed-off-by: David Lechner Acked-by: Rob Herring Signed-off-by: Kishon Vijay Abraham I --- .../devicetree/bindings/phy/phy-da8xx-usb.txt | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/phy-da8xx-usb.txt (limited to 'Documentation/devicetree') diff --git a/Documentation/devicetree/bindings/phy/phy-da8xx-usb.txt b/Documentation/devicetree/bindings/phy/phy-da8xx-usb.txt new file mode 100644 index 000000000000..c26478be391b --- /dev/null +++ b/Documentation/devicetree/bindings/phy/phy-da8xx-usb.txt @@ -0,0 +1,40 @@ +TI DA8xx/OMAP-L1xx/AM18xx USB PHY + +Required properties: + - compatible: must be "ti,da830-usb-phy". + - #phy-cells: must be 1. + +This device controls the PHY for both the USB 1.1 OHCI and USB 2.0 OTG +controllers on DA8xx SoCs. Consumers of this device should use index 0 for +the USB 2.0 phy device and index 1 for the USB 1.1 phy device. + +It also requires a "syscon" node with compatible = "ti,da830-cfgchip", "syscon" +to access the CFGCHIP2 register. + +Example: + + cfgchip: cfgchip@1417c { + compatible = "ti,da830-cfgchip", "syscon"; + reg = <0x1417c 0x14>; + }; + + usb_phy: usb-phy { + compatible = "ti,da830-usb-phy"; + #phy-cells = <1>; + }; + + usb20: usb@200000 { + compatible = "ti,da830-musb"; + reg = <0x200000 0x1000>; + interrupts = <58>; + phys = <&usb_phy 0>; + phy-names = "usb-phy"; + }; + + usb11: usb@225000 { + compatible = "ti,da830-ohci"; + reg = <0x225000 0x1000>; + interrupts = <59>; + phys = <&usb_phy 1>; + phy-names = "usb-phy"; + }; -- cgit v1.2.3-59-g8ed1b From a0da445aabe49c31093ecf3930f531e3c63e0b83 Mon Sep 17 00:00:00 2001 From: Heiko Stuebner Date: Wed, 29 Jun 2016 00:12:58 +0200 Subject: phy: rockchip-usb: should be a child device of the GRF The usb-phy is fully enclosed in the general register files (GRF). Therefore as seen from the device-tree it shouldn't be a separate platform-device but instead a sub-device of the GRF - using the simply-mfd mechanism. As the usb-phy is part of the kernel for some releases now, we keep the old (and now deprecated) binding for compatibility purposes. Signed-off-by: Heiko Stuebner Signed-off-by: Kishon Vijay Abraham I --- .../devicetree/bindings/phy/rockchip-usb-phy.txt | 27 ++++++++++++++-------- drivers/phy/phy-rockchip-usb.c | 15 +++++++++--- 2 files changed, 29 insertions(+), 13 deletions(-) (limited to 'Documentation/devicetree') diff --git a/Documentation/devicetree/bindings/phy/rockchip-usb-phy.txt b/Documentation/devicetree/bindings/phy/rockchip-usb-phy.txt index 68498d560354..cc6be9680a6d 100644 --- a/Documentation/devicetree/bindings/phy/rockchip-usb-phy.txt +++ b/Documentation/devicetree/bindings/phy/rockchip-usb-phy.txt @@ -5,11 +5,13 @@ Required properties: "rockchip,rk3066a-usb-phy" "rockchip,rk3188-usb-phy" "rockchip,rk3288-usb-phy" - - rockchip,grf : phandle to the syscon managing the "general - register files" - #address-cells: should be 1 - #size-cells: should be 0 +Deprecated properties: + - rockchip,grf : phandle to the syscon managing the "general + register files" - phy should be a child of the GRF instead + Sub-nodes: Each PHY should be represented as a sub-node. @@ -28,14 +30,19 @@ Optional Properties: Example: -usbphy: phy { - compatible = "rockchip,rk3288-usb-phy"; - rockchip,grf = <&grf>; - #address-cells = <1>; - #size-cells = <0>; +grf: syscon@ff770000 { + compatible = "rockchip,rk3288-grf", "syscon", "simple-mfd"; + +... + + usbphy: phy { + compatible = "rockchip,rk3288-usb-phy"; + #address-cells = <1>; + #size-cells = <0>; - usbphy0: usb-phy0 { - #phy-cells = <0>; - reg = <0x320>; + usbphy0: usb-phy0 { + #phy-cells = <0>; + reg = <0x320>; + }; }; }; diff --git a/drivers/phy/phy-rockchip-usb.c b/drivers/phy/phy-rockchip-usb.c index d60b149cff0f..e66b5bf3605f 100644 --- a/drivers/phy/phy-rockchip-usb.c +++ b/drivers/phy/phy-rockchip-usb.c @@ -397,8 +397,13 @@ static int rockchip_usb_phy_probe(struct platform_device *pdev) phy_base->pdata = match->data; phy_base->dev = dev; - phy_base->reg_base = syscon_regmap_lookup_by_phandle(dev->of_node, - "rockchip,grf"); + phy_base->reg_base = ERR_PTR(-ENODEV); + if (dev->parent && dev->parent->of_node) + phy_base->reg_base = syscon_node_to_regmap( + dev->parent->of_node); + if (IS_ERR(phy_base->reg_base)) + phy_base->reg_base = syscon_regmap_lookup_by_phandle( + dev->of_node, "rockchip,grf"); if (IS_ERR(phy_base->reg_base)) { dev_err(&pdev->dev, "Missing rockchip,grf property\n"); return PTR_ERR(phy_base->reg_base); @@ -463,7 +468,11 @@ static int __init rockchip_init_usb_uart(void) return -ENOTSUPP; } - grf = syscon_regmap_lookup_by_phandle(np, "rockchip,grf"); + grf = ERR_PTR(-ENODEV); + if (np->parent) + grf = syscon_node_to_regmap(np->parent); + if (IS_ERR(grf)) + grf = syscon_regmap_lookup_by_phandle(np, "rockchip,grf"); if (IS_ERR(grf)) { pr_err("%s: Missing rockchip,grf property, %lu\n", __func__, PTR_ERR(grf)); -- cgit v1.2.3-59-g8ed1b