From: Maxime Ripard <maxime.ripard@free-electrons.com>
To: Emilio Lopez <emilio@elopez.com.ar>,
Mike Turquette <mturquette@linaro.org>,
stern@rowland.harvard.edu, kishon@ti.com, hdegoede@redhat.com
Cc: Boris Brezillon <boris@free-electrons.com>,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, linux-usb@vger.kernel.org,
kevin.z.m.zh@gmail.com, sunny@allwinnertech.com,
shuge@allwinnertech.com, zhuzhenhua@allwinnertech.com,
linux-sunxi@googlegroups.com,
Boris BREZILLON <boris.brezillon@free-electrons.com>,
Maxime Ripard <maxime.ripard@free-electrons.com>
Subject: [PATCH v3 5/8] usb: ehci-platform: add optional reset controller retrieval
Date: Mon, 12 May 2014 21:34:31 +0200 [thread overview]
Message-ID: <1399923274-6017-6-git-send-email-maxime.ripard@free-electrons.com> (raw)
In-Reply-To: <1399923274-6017-1-git-send-email-maxime.ripard@free-electrons.com>
From: Boris BREZILLON <boris.brezillon@free-electrons.com>
On the Allwinner's A31 SoC the reset line connected to the EHCI IP has to
be deasserted for the EHCI block to be usable.
Add support for an optional reset controller that will be deasserted on
power off and asserted on power on.
Signed-off-by: Boris BREZILLON <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
---
Documentation/devicetree/bindings/usb/usb-ehci.txt | 1 +
drivers/usb/host/ehci-platform.c | 17 +++++++++++++++++
2 files changed, 18 insertions(+)
diff --git a/Documentation/devicetree/bindings/usb/usb-ehci.txt b/Documentation/devicetree/bindings/usb/usb-ehci.txt
index ff151ec084c4..43c1a4e06767 100644
--- a/Documentation/devicetree/bindings/usb/usb-ehci.txt
+++ b/Documentation/devicetree/bindings/usb/usb-ehci.txt
@@ -15,6 +15,7 @@ Optional properties:
- clocks : a list of phandle + clock specifier pairs
- phys : phandle + phy specifier pair
- phy-names : "usb"
+ - resets : phandle + reset specifier pair
Example (Sequoia 440EPx):
ehci@e0000300 {
diff --git a/drivers/usb/host/ehci-platform.c b/drivers/usb/host/ehci-platform.c
index c7dd93aad20c..8bb15eda9713 100644
--- a/drivers/usb/host/ehci-platform.c
+++ b/drivers/usb/host/ehci-platform.c
@@ -29,6 +29,7 @@
#include <linux/of.h>
#include <linux/phy/phy.h>
#include <linux/platform_device.h>
+#include <linux/reset.h>
#include <linux/usb.h>
#include <linux/usb/hcd.h>
#include <linux/usb/ehci_pdriver.h>
@@ -41,6 +42,7 @@
struct ehci_platform_priv {
struct clk *clks[EHCI_MAX_CLKS];
+ struct reset_control *rst;
struct phy *phy;
};
@@ -208,6 +210,18 @@ static int ehci_platform_probe(struct platform_device *dev)
}
}
+ 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;
+ }
+
if (pdata->big_endian_desc)
ehci->big_endian_desc = 1;
if (pdata->big_endian_mmio)
@@ -280,6 +294,9 @@ static int ehci_platform_remove(struct platform_device *dev)
if (pdata->power_off)
pdata->power_off(dev);
+ if (priv->rst)
+ reset_control_assert(priv->rst);
+
for (clk = 0; clk < EHCI_MAX_CLKS && priv->clks[clk]; clk++)
clk_put(priv->clks[clk]);
--
1.9.3
next prev parent reply other threads:[~2014-05-12 19:35 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-12 19:34 [PATCH v3 0/8] Add Allwinner A31 USB support Maxime Ripard
2014-05-12 19:34 ` [PATCH v3 1/8] clk: sunxi: Implement A31 USB clock Maxime Ripard
2014-05-13 1:32 ` Mike Turquette
2014-05-12 19:34 ` [PATCH v3 2/8] ARM: sun6i: Add the USB clocks to the DTSI Maxime Ripard
2014-05-12 19:34 ` [PATCH v3 3/8] phy: sunxi: Rework phy initialization Maxime Ripard
2014-05-13 6:39 ` Hans de Goede
2014-05-12 19:34 ` [PATCH v3 4/8] phy: usb: sunxi: Introduce Allwinner A31 USB PHY support Maxime Ripard
2014-05-12 19:34 ` Maxime Ripard [this message]
2014-05-12 20:06 ` [PATCH v3 5/8] usb: ehci-platform: add optional reset controller retrieval Alan Stern
2014-05-13 7:51 ` Maxime Ripard
2014-05-12 19:34 ` [PATCH v3 6/8] usb: ohci-platform: Enable optional use of reset controller Maxime Ripard
2014-05-12 19:34 ` [PATCH v3 7/8] ARM: sun6i: dt: Add support for the USB controllers Maxime Ripard
2014-05-12 19:34 ` [PATCH v3 8/8] ARM: sunxi: dt: add APP4-EVB1 board support Maxime Ripard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1399923274-6017-6-git-send-email-maxime.ripard@free-electrons.com \
--to=maxime.ripard@free-electrons.com \
--cc=boris.brezillon@free-electrons.com \
--cc=boris@free-electrons.com \
--cc=emilio@elopez.com.ar \
--cc=hdegoede@redhat.com \
--cc=kevin.z.m.zh@gmail.com \
--cc=kishon@ti.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sunxi@googlegroups.com \
--cc=linux-usb@vger.kernel.org \
--cc=mturquette@linaro.org \
--cc=shuge@allwinnertech.com \
--cc=stern@rowland.harvard.edu \
--cc=sunny@allwinnertech.com \
--cc=zhuzhenhua@allwinnertech.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®