All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Geis <pgwipeout@gmail.com>
To: Rob Herring <robh+dt@kernel.org>,
	Heiko Stuebner <heiko@sntech.de>,
	Kishon Vijay Abraham I <kishon@ti.com>,
	Vinod Koul <vkoul@kernel.org>
Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org,
	linux-phy@lists.infradead.org, Peter Geis <pgwipeout@gmail.com>
Subject: [RFC PATCH 4/9] phy: phy-rockchip-inno-usb2: support #address_cells = 2
Date: Wed, 28 Jul 2021 08:26:01 -0400	[thread overview]
Message-ID: <20210728122606.697619-5-pgwipeout@gmail.com> (raw)
In-Reply-To: <20210728122606.697619-1-pgwipeout@gmail.com>

New Rockchip devices have the usb phy nodes as standalone devices.
These nodes have register nodes with #address_cells = 2, but only use 32
bit addresses.

Adjust the driver to check if the returned address is "0", and adjust
the index in that case.

Signed-off-by: Peter Geis <pgwipeout@gmail.com>
---
 drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
index beacac1dd253..5d2916143df7 100644
--- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
+++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
@@ -1098,12 +1098,21 @@ static int rockchip_usb2phy_probe(struct platform_device *pdev)
 		rphy->usbgrf = NULL;
 	}
 
-	if (of_property_read_u32(np, "reg", &reg)) {
+	if (of_property_read_u32_index(np, "reg", 0, &reg)) {
 		dev_err(dev, "the reg property is not assigned in %pOFn node\n",
 			np);
 		return -EINVAL;
 	}
 
+	/* support address_cells=2 */
+	if (reg == 0) {
+		if (of_property_read_u32_index(np, "reg", 1, &reg)) {
+			dev_err(dev, "the reg property is not assigned in %pOFn node\n",
+				np);
+			return -EINVAL;
+		}
+	}
+
 	rphy->dev = dev;
 	phy_cfgs = match->data;
 	rphy->chg_state = USB_CHG_STATE_UNDEFINED;
-- 
2.25.1


WARNING: multiple messages have this Message-ID (diff)
From: Peter Geis <pgwipeout@gmail.com>
To: Rob Herring <robh+dt@kernel.org>,
	Heiko Stuebner <heiko@sntech.de>,
	Kishon Vijay Abraham I <kishon@ti.com>,
	Vinod Koul <vkoul@kernel.org>
Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org,
	linux-phy@lists.infradead.org, Peter Geis <pgwipeout@gmail.com>
Subject: [RFC PATCH 4/9] phy: phy-rockchip-inno-usb2: support #address_cells = 2
Date: Wed, 28 Jul 2021 08:26:01 -0400	[thread overview]
Message-ID: <20210728122606.697619-5-pgwipeout@gmail.com> (raw)
In-Reply-To: <20210728122606.697619-1-pgwipeout@gmail.com>

New Rockchip devices have the usb phy nodes as standalone devices.
These nodes have register nodes with #address_cells = 2, but only use 32
bit addresses.

Adjust the driver to check if the returned address is "0", and adjust
the index in that case.

Signed-off-by: Peter Geis <pgwipeout@gmail.com>
---
 drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
index beacac1dd253..5d2916143df7 100644
--- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
+++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
@@ -1098,12 +1098,21 @@ static int rockchip_usb2phy_probe(struct platform_device *pdev)
 		rphy->usbgrf = NULL;
 	}
 
-	if (of_property_read_u32(np, "reg", &reg)) {
+	if (of_property_read_u32_index(np, "reg", 0, &reg)) {
 		dev_err(dev, "the reg property is not assigned in %pOFn node\n",
 			np);
 		return -EINVAL;
 	}
 
+	/* support address_cells=2 */
+	if (reg == 0) {
+		if (of_property_read_u32_index(np, "reg", 1, &reg)) {
+			dev_err(dev, "the reg property is not assigned in %pOFn node\n",
+				np);
+			return -EINVAL;
+		}
+	}
+
 	rphy->dev = dev;
 	phy_cfgs = match->data;
 	rphy->chg_state = USB_CHG_STATE_UNDEFINED;
-- 
2.25.1


_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

WARNING: multiple messages have this Message-ID (diff)
From: Peter Geis <pgwipeout@gmail.com>
To: Rob Herring <robh+dt@kernel.org>,
	Heiko Stuebner <heiko@sntech.de>,
	Kishon Vijay Abraham I <kishon@ti.com>,
	Vinod Koul <vkoul@kernel.org>
Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org,
	linux-phy@lists.infradead.org, Peter Geis <pgwipeout@gmail.com>
Subject: [RFC PATCH 4/9] phy: phy-rockchip-inno-usb2: support #address_cells = 2
Date: Wed, 28 Jul 2021 08:26:01 -0400	[thread overview]
Message-ID: <20210728122606.697619-5-pgwipeout@gmail.com> (raw)
In-Reply-To: <20210728122606.697619-1-pgwipeout@gmail.com>

New Rockchip devices have the usb phy nodes as standalone devices.
These nodes have register nodes with #address_cells = 2, but only use 32
bit addresses.

Adjust the driver to check if the returned address is "0", and adjust
the index in that case.

Signed-off-by: Peter Geis <pgwipeout@gmail.com>
---
 drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
index beacac1dd253..5d2916143df7 100644
--- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
+++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
@@ -1098,12 +1098,21 @@ static int rockchip_usb2phy_probe(struct platform_device *pdev)
 		rphy->usbgrf = NULL;
 	}
 
-	if (of_property_read_u32(np, "reg", &reg)) {
+	if (of_property_read_u32_index(np, "reg", 0, &reg)) {
 		dev_err(dev, "the reg property is not assigned in %pOFn node\n",
 			np);
 		return -EINVAL;
 	}
 
+	/* support address_cells=2 */
+	if (reg == 0) {
+		if (of_property_read_u32_index(np, "reg", 1, &reg)) {
+			dev_err(dev, "the reg property is not assigned in %pOFn node\n",
+				np);
+			return -EINVAL;
+		}
+	}
+
 	rphy->dev = dev;
 	phy_cfgs = match->data;
 	rphy->chg_state = USB_CHG_STATE_UNDEFINED;
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

WARNING: multiple messages have this Message-ID (diff)
From: Peter Geis <pgwipeout@gmail.com>
To: Rob Herring <robh+dt@kernel.org>,
	Heiko Stuebner <heiko@sntech.de>,
	Kishon Vijay Abraham I <kishon@ti.com>,
	Vinod Koul <vkoul@kernel.org>
Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org,
	linux-phy@lists.infradead.org, Peter Geis <pgwipeout@gmail.com>
Subject: [RFC PATCH 4/9] phy: phy-rockchip-inno-usb2: support #address_cells = 2
Date: Wed, 28 Jul 2021 08:26:01 -0400	[thread overview]
Message-ID: <20210728122606.697619-5-pgwipeout@gmail.com> (raw)
In-Reply-To: <20210728122606.697619-1-pgwipeout@gmail.com>

New Rockchip devices have the usb phy nodes as standalone devices.
These nodes have register nodes with #address_cells = 2, but only use 32
bit addresses.

Adjust the driver to check if the returned address is "0", and adjust
the index in that case.

Signed-off-by: Peter Geis <pgwipeout@gmail.com>
---
 drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
index beacac1dd253..5d2916143df7 100644
--- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
+++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
@@ -1098,12 +1098,21 @@ static int rockchip_usb2phy_probe(struct platform_device *pdev)
 		rphy->usbgrf = NULL;
 	}
 
-	if (of_property_read_u32(np, "reg", &reg)) {
+	if (of_property_read_u32_index(np, "reg", 0, &reg)) {
 		dev_err(dev, "the reg property is not assigned in %pOFn node\n",
 			np);
 		return -EINVAL;
 	}
 
+	/* support address_cells=2 */
+	if (reg == 0) {
+		if (of_property_read_u32_index(np, "reg", 1, &reg)) {
+			dev_err(dev, "the reg property is not assigned in %pOFn node\n",
+				np);
+			return -EINVAL;
+		}
+	}
+
 	rphy->dev = dev;
 	phy_cfgs = match->data;
 	rphy->chg_state = USB_CHG_STATE_UNDEFINED;
-- 
2.25.1


-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

  parent reply	other threads:[~2021-07-28 12:26 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-28 12:25 [RFC PATCH 0/9] phy-rockchip-inno-usb2: support rk356x usb2phy Peter Geis
2021-07-28 12:25 ` Peter Geis
2021-07-28 12:25 ` Peter Geis
2021-07-28 12:25 ` Peter Geis
2021-07-28 12:25 ` [RFC PATCH 1/9] dt-bindings: soc: rockchip: add rk3568-usb2phy-grf Peter Geis
2021-07-28 12:25   ` Peter Geis
2021-07-28 12:25   ` Peter Geis
2021-07-28 12:25   ` Peter Geis
2021-07-28 14:36   ` Johan Jonker
2021-07-28 14:36     ` Johan Jonker
2021-07-28 14:36     ` Johan Jonker
2021-07-28 14:36     ` Johan Jonker
2021-07-28 15:20     ` Peter Geis
2021-07-28 15:20       ` Peter Geis
2021-07-28 15:20       ` Peter Geis
2021-07-28 15:20       ` Peter Geis
2021-07-28 12:25 ` [RFC PATCH 2/9] dt-bindings: phy: phy-rockchip-inno-usb2: add rk3568 documentation Peter Geis
2021-07-28 12:25   ` Peter Geis
2021-07-28 12:25   ` Peter Geis
2021-07-28 12:25   ` Peter Geis
2021-07-28 15:14   ` Johan Jonker
2021-07-28 15:14     ` Johan Jonker
2021-07-28 15:14     ` Johan Jonker
2021-07-28 15:14     ` Johan Jonker
2021-07-28 15:19     ` Peter Geis
2021-07-28 15:19       ` Peter Geis
2021-07-28 15:19       ` Peter Geis
2021-07-28 15:19       ` Peter Geis
2021-07-28 12:26 ` [RFC PATCH 3/9] dt-bindings: usb: generic-ohci: increase maximum clocks Peter Geis
2021-07-28 12:26   ` Peter Geis
2021-07-28 12:26   ` Peter Geis
2021-07-28 12:26   ` Peter Geis
2021-07-28 14:59   ` Heiko Stübner
2021-07-28 14:59     ` Heiko Stübner
2021-07-28 14:59     ` Heiko Stübner
2021-07-28 14:59     ` Heiko Stübner
2021-07-28 15:20     ` Peter Geis
2021-07-28 15:20       ` Peter Geis
2021-07-28 15:20       ` Peter Geis
2021-07-28 15:20       ` Peter Geis
2021-07-28 12:26 ` Peter Geis [this message]
2021-07-28 12:26   ` [RFC PATCH 4/9] phy: phy-rockchip-inno-usb2: support #address_cells = 2 Peter Geis
2021-07-28 12:26   ` Peter Geis
2021-07-28 12:26   ` Peter Geis
2021-07-28 12:26 ` [RFC PATCH 5/9] phy: phy-rockchip-inno-usb2: support standalone phy nodes Peter Geis
2021-07-28 12:26   ` Peter Geis
2021-07-28 12:26   ` Peter Geis
2021-07-28 12:26   ` Peter Geis
2021-07-28 12:26 ` [RFC PATCH 6/9] phy: phy-rockchip-inno-usb2: support muxed interrupts Peter Geis
2021-07-28 12:26   ` Peter Geis
2021-07-28 12:26   ` Peter Geis
2021-07-28 12:26   ` Peter Geis
2021-07-28 12:26 ` [RFC PATCH 7/9] phy: phy-rockchip-inno-usb2: add rk3568 support Peter Geis
2021-07-28 12:26   ` Peter Geis
2021-07-28 12:26   ` Peter Geis
2021-07-28 12:26   ` Peter Geis
2021-07-28 12:26 ` [RFC PATCH 8/9] arm64: dts: rockchip: add usb2 nodes to rk3568 device tree Peter Geis
2021-07-28 12:26   ` Peter Geis
2021-07-28 12:26   ` Peter Geis
2021-07-28 12:26   ` Peter Geis
2021-07-28 12:26 ` [RFC PATCH 9/9] arm64: dts: rockchip: add Quartz64-A usb2 support Peter Geis
2021-07-28 12:26   ` Peter Geis
2021-07-28 12:26   ` Peter Geis
2021-07-28 12:26   ` Peter Geis

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=20210728122606.697619-5-pgwipeout@gmail.com \
    --to=pgwipeout@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=heiko@sntech.de \
    --cc=kishon@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-phy@lists.infradead.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=robh+dt@kernel.org \
    --cc=vkoul@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.