From: Peter Griffin <peter.griffin@linaro.org>
To: linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, srinivas.kandagatla@gmail.com,
maxime.coquelin@st.com, patrice.chotard@st.com,
peppe.cavallaro@st.com, kishon@ti.com, arnd@arndb.de
Cc: peter.griffin@linaro.org, lee.jones@linaro.org,
netdev@vger.kernel.org, devicetree@vger.kernel.org,
alexandre.torgue@st.com
Subject: [PATCH 1/7] phy: phy-stih407-usb: Pass sysconfig register offsets via syscfg property.
Date: Wed, 19 Nov 2014 08:27:06 +0000 [thread overview]
Message-ID: <1416385632-5832-2-git-send-email-peter.griffin@linaro.org> (raw)
In-Reply-To: <1416385632-5832-1-git-send-email-peter.griffin@linaro.org>
Based on Arnds review comments here https://lkml.org/lkml/2014/11/13/161, update
the phy driver to not use the reg property to access the sysconfig register offsets.
This is because other phy's (miphy28, miphy365) have a combination of memory mapped
registers and sysconfig control regs, and we shouldn't be mixing address spaces
in the reg property. In addition we would ideally like the sysconfig offsets to be
passed via DT in a uniform way. This new method will also allow us to support devices
which have sysconfig registers in different banks more easily and it is also analagous
to how keystone and bcm7745 platforms pass there syscon offsets in DT.
This breaks DT compatibility, but this platform is considered WIP, and is only
used by a few developers who are upstreaming support for it.
Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
---
.../devicetree/bindings/phy/phy-stih407-usb.txt | 10 ++-------
drivers/phy/phy-stih407-usb.c | 25 ++++++++++++----------
2 files changed, 16 insertions(+), 19 deletions(-)
diff --git a/Documentation/devicetree/bindings/phy/phy-stih407-usb.txt b/Documentation/devicetree/bindings/phy/phy-stih407-usb.txt
index 1ef8228..de6a706 100644
--- a/Documentation/devicetree/bindings/phy/phy-stih407-usb.txt
+++ b/Documentation/devicetree/bindings/phy/phy-stih407-usb.txt
@@ -5,10 +5,7 @@ host controllers (when controlling usb2/1.1 devices) available on STiH407 SoC fa
Required properties:
- compatible : should be "st,stih407-usb2-phy"
-- reg : contain the offset and length of the system configuration registers
- used as glue logic to control & parameter phy
-- reg-names : the names of the system configuration registers in "reg", should be "param" and "reg"
-- st,syscfg : sysconfig register to manage phy parameter at driver level
+- st,syscfg : phandle of sysconfig bank plus integer array containing phyparam and phyctrl register offsets
- resets : list of phandle and reset specifier pairs. There should be two entries, one
for the whole phy and one for the port
- reset-names : list of reset signal names. Should be "global" and "port"
@@ -19,11 +16,8 @@ Example:
usb2_picophy0: usbpicophy@f8 {
compatible = "st,stih407-usb2-phy";
- reg = <0xf8 0x04>, /* syscfg 5062 */
- <0xf4 0x04>; /* syscfg 5061 */
- reg-names = "param", "ctrl";
#phy-cells = <0>;
- st,syscfg = <&syscfg_core>;
+ st,syscfg = <&syscfg_core 0x100 0xf4>;
resets = <&softreset STIH407_PICOPHY_SOFTRESET>,
<&picophyreset STIH407_PICOPHY0_RESET>;
reset-names = "global", "port";
diff --git a/drivers/phy/phy-stih407-usb.c b/drivers/phy/phy-stih407-usb.c
index 42428d4..24d5e2a 100644
--- a/drivers/phy/phy-stih407-usb.c
+++ b/drivers/phy/phy-stih407-usb.c
@@ -22,6 +22,9 @@
#include <linux/mfd/syscon.h>
#include <linux/phy/phy.h>
+#define PHYPARAM_REG 1
+#define PHYCTRL_REG 2
+
/* Default PHY_SEL and REFCLKSEL configuration */
#define STIH407_USB_PICOPHY_CTRL_PORT_CONF 0x6
#define STIH407_USB_PICOPHY_CTRL_PORT_MASK 0x1f
@@ -93,7 +96,7 @@ static int stih407_usb2_picophy_probe(struct platform_device *pdev)
struct device_node *np = dev->of_node;
struct phy_provider *phy_provider;
struct phy *phy;
- struct resource *res;
+ int ret;
phy_dev = devm_kzalloc(dev, sizeof(*phy_dev), GFP_KERNEL);
if (!phy_dev)
@@ -123,19 +126,19 @@ static int stih407_usb2_picophy_probe(struct platform_device *pdev)
return PTR_ERR(phy_dev->regmap);
}
- res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ctrl");
- if (!res) {
- dev_err(dev, "No ctrl reg found\n");
- return -ENXIO;
+ ret = of_property_read_u32_index(np, "st,syscfg", PHYPARAM_REG,
+ &phy_dev->param);
+ if (ret) {
+ dev_err(dev, "can't get phyparam offset (%d)\n", ret);
+ return ret;
}
- phy_dev->ctrl = res->start;
- res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "param");
- if (!res) {
- dev_err(dev, "No param reg found\n");
- return -ENXIO;
+ ret = of_property_read_u32_index(np, "st,syscfg", PHYCTRL_REG,
+ &phy_dev->ctrl);
+ if (ret) {
+ dev_err(dev, "can't get phyctrl offset (%d)\n", ret);
+ return ret;
}
- phy_dev->param = res->start;
phy = devm_phy_create(dev, NULL, &stih407_usb2_picophy_data, NULL);
if (IS_ERR(phy)) {
--
1.9.1
next prev parent reply other threads:[~2014-11-19 8:27 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-19 8:27 [PATCH 0/7] Fix sti drivers whcih mix reg address spaces Peter Griffin
2014-11-19 8:27 ` Peter Griffin [this message]
2014-11-19 8:27 ` [PATCH 2/7] phy: miphy365x: Pass sysconfig register offsets via syscfg dt property Peter Griffin
2014-11-19 10:42 ` Lee Jones
2014-11-19 8:27 ` [PATCH 3/7] ARM: STi: DT: STiH407: Add usb2 picophy dt nodes Peter Griffin
2014-11-19 8:27 ` [PATCH 4/7] ARM: STi: DT: STiH410: " Peter Griffin
2014-12-01 15:40 ` Arnd Bergmann
2014-11-19 8:27 ` [PATCH 5/7] ARM: STi: DT: STiH410: Add DT nodes for the ehci and ohci usb controllers Peter Griffin
2014-11-19 8:27 ` [PATCH 6/7] ARM: multi_v7_defconfig: Enable stih407 usb picophy Peter Griffin
2014-11-19 8:27 ` [PATCH 7/7] stmmac: dwmac-sti: Pass sysconfig register offset via syscon dt property Peter Griffin
2014-11-19 8:51 ` Lee Jones
[not found] ` <1416385632-5832-1-git-send-email-peter.griffin-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2014-12-01 15:36 ` [PATCH 0/7] Fix sti drivers whcih mix reg address spaces Arnd Bergmann
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=1416385632-5832-2-git-send-email-peter.griffin@linaro.org \
--to=peter.griffin@linaro.org \
--cc=alexandre.torgue@st.com \
--cc=arnd@arndb.de \
--cc=devicetree@vger.kernel.org \
--cc=kishon@ti.com \
--cc=lee.jones@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maxime.coquelin@st.com \
--cc=netdev@vger.kernel.org \
--cc=patrice.chotard@st.com \
--cc=peppe.cavallaro@st.com \
--cc=srinivas.kandagatla@gmail.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;
as well as URLs for NNTP newsgroup(s).