linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marek Szyprowski <m.szyprowski@samsung.com>
To: linux-usb@vger.kernel.org, linux-samsung-soc@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Marek Szyprowski" <m.szyprowski@samsung.com>,
	"Bartlomiej Zolnierkiewicz" <b.zolnierkie@samsung.com>,
	"Markus Reichl" <m.reichl@fivetechno.de>,
	"Måns Rullgård" <mans@mansr.com>,
	"Krzysztof Kozlowski" <krzk@kernel.org>,
	"Peter Chen" <peter.chen@nxp.com>,
	"Alan Stern" <stern@rowland.harvard.edu>,
	"Rob Herring" <robh+dt@kernel.org>
Subject: [PATCH 5/5] usb: exynos: Remove support for legacy PHY bindings
Date: Tue, 21 May 2019 13:58:49 +0200	[thread overview]
Message-ID: <20190521115849.9882-6-m.szyprowski@samsung.com> (raw)
In-Reply-To: <20190521115849.9882-1-m.szyprowski@samsung.com>

Exnyos EHCI/OHCI custom port device tree sub-nodes under EHCI/OHCI
devices has been removed, so the code for handling them can be also
removed. Once this has been done, we can also remove the workaround
added by commit 01d4071486fe ("usb: exynos: add workaround for the USB
device bindings conflict") and enable support for the generic USB device
bindings.

Suggested-by: Måns Rullgård <mans@mansr.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
 drivers/usb/host/ehci-exynos.c | 46 ----------------------------------
 drivers/usb/host/ohci-exynos.c | 46 ----------------------------------
 2 files changed, 92 deletions(-)

diff --git a/drivers/usb/host/ehci-exynos.c b/drivers/usb/host/ehci-exynos.c
index 2a551a807ec0..afde1ffa0824 100644
--- a/drivers/usb/host/ehci-exynos.c
+++ b/drivers/usb/host/ehci-exynos.c
@@ -39,7 +39,6 @@ static struct hc_driver __read_mostly exynos_ehci_hc_driver;
 
 struct exynos_ehci_hcd {
 	struct clk *clk;
-	struct device_node *of_node;
 	struct phy *phy[PHY_NUMBER];
 };
 
@@ -48,10 +47,8 @@ struct exynos_ehci_hcd {
 static int exynos_ehci_get_phy(struct device *dev,
 				struct exynos_ehci_hcd *exynos_ehci)
 {
-	struct device_node *child;
 	struct phy *phy;
 	int phy_number, num_phys;
-	int ret;
 
 	/* Get PHYs for the controller */
 	num_phys = of_count_phandle_with_args(dev->of_node, "phys",
@@ -62,39 +59,6 @@ static int exynos_ehci_get_phy(struct device *dev,
 			return PTR_ERR(phy);
 		exynos_ehci->phy[phy_number] = phy;
 	}
-	if (num_phys)
-		return 0;
-
-	/* Get PHYs using legacy bindings */
-	for_each_available_child_of_node(dev->of_node, child) {
-		ret = of_property_read_u32(child, "reg", &phy_number);
-		if (ret) {
-			dev_err(dev, "Failed to parse device tree\n");
-			of_node_put(child);
-			return ret;
-		}
-
-		if (phy_number >= PHY_NUMBER) {
-			dev_err(dev, "Invalid number of PHYs\n");
-			of_node_put(child);
-			return -EINVAL;
-		}
-
-		phy = devm_of_phy_get(dev, child, NULL);
-		exynos_ehci->phy[phy_number] = phy;
-		if (IS_ERR(phy)) {
-			ret = PTR_ERR(phy);
-			if (ret == -EPROBE_DEFER) {
-				of_node_put(child);
-				return ret;
-			} else if (ret != -ENOSYS && ret != -ENODEV) {
-				dev_err(dev,
-					"Error retrieving usb2 phy: %d\n", ret);
-				of_node_put(child);
-				return ret;
-			}
-		}
-	}
 
 	return 0;
 }
@@ -216,13 +180,6 @@ static int exynos_ehci_probe(struct platform_device *pdev)
 	ehci = hcd_to_ehci(hcd);
 	ehci->caps = hcd->regs;
 
-	/*
-	 * Workaround: reset of_node pointer to avoid conflict between Exynos
-	 * EHCI port subnodes and generic USB device bindings
-	 */
-	exynos_ehci->of_node = pdev->dev.of_node;
-	pdev->dev.of_node = NULL;
-
 	/* DMA burst Enable */
 	writel(EHCI_INSNREG00_ENABLE_DMA_BURST, EHCI_INSNREG00(hcd->regs));
 
@@ -239,7 +196,6 @@ static int exynos_ehci_probe(struct platform_device *pdev)
 
 fail_add_hcd:
 	exynos_ehci_phy_disable(&pdev->dev);
-	pdev->dev.of_node = exynos_ehci->of_node;
 fail_io:
 	clk_disable_unprepare(exynos_ehci->clk);
 fail_clk:
@@ -252,8 +208,6 @@ static int exynos_ehci_remove(struct platform_device *pdev)
 	struct usb_hcd *hcd = platform_get_drvdata(pdev);
 	struct exynos_ehci_hcd *exynos_ehci = to_exynos_ehci(hcd);
 
-	pdev->dev.of_node = exynos_ehci->of_node;
-
 	usb_remove_hcd(hcd);
 
 	exynos_ehci_phy_disable(&pdev->dev);
diff --git a/drivers/usb/host/ohci-exynos.c b/drivers/usb/host/ohci-exynos.c
index 195ea5fa021e..8e9f4ef4e397 100644
--- a/drivers/usb/host/ohci-exynos.c
+++ b/drivers/usb/host/ohci-exynos.c
@@ -30,17 +30,14 @@ static struct hc_driver __read_mostly exynos_ohci_hc_driver;
 
 struct exynos_ohci_hcd {
 	struct clk *clk;
-	struct device_node *of_node;
 	struct phy *phy[PHY_NUMBER];
 };
 
 static int exynos_ohci_get_phy(struct device *dev,
 				struct exynos_ohci_hcd *exynos_ohci)
 {
-	struct device_node *child;
 	struct phy *phy;
 	int phy_number, num_phys;
-	int ret;
 
 	/* Get PHYs for the controller */
 	num_phys = of_count_phandle_with_args(dev->of_node, "phys",
@@ -51,39 +48,6 @@ static int exynos_ohci_get_phy(struct device *dev,
 			return PTR_ERR(phy);
 		exynos_ohci->phy[phy_number] = phy;
 	}
-	if (num_phys)
-		return 0;
-
-	/* Get PHYs using legacy bindings */
-	for_each_available_child_of_node(dev->of_node, child) {
-		ret = of_property_read_u32(child, "reg", &phy_number);
-		if (ret) {
-			dev_err(dev, "Failed to parse device tree\n");
-			of_node_put(child);
-			return ret;
-		}
-
-		if (phy_number >= PHY_NUMBER) {
-			dev_err(dev, "Invalid number of PHYs\n");
-			of_node_put(child);
-			return -EINVAL;
-		}
-
-		phy = devm_of_phy_get(dev, child, NULL);
-		exynos_ohci->phy[phy_number] = phy;
-		if (IS_ERR(phy)) {
-			ret = PTR_ERR(phy);
-			if (ret == -EPROBE_DEFER) {
-				of_node_put(child);
-				return ret;
-			} else if (ret != -ENOSYS && ret != -ENODEV) {
-				dev_err(dev,
-					"Error retrieving usb2 phy: %d\n", ret);
-				of_node_put(child);
-				return ret;
-			}
-		}
-	}
 
 	return 0;
 }
@@ -183,13 +147,6 @@ static int exynos_ohci_probe(struct platform_device *pdev)
 		goto fail_io;
 	}
 
-	/*
-	 * Workaround: reset of_node pointer to avoid conflict between Exynos
-	 * OHCI port subnodes and generic USB device bindings
-	 */
-	exynos_ohci->of_node = pdev->dev.of_node;
-	pdev->dev.of_node = NULL;
-
 	err = usb_add_hcd(hcd, irq, IRQF_SHARED);
 	if (err) {
 		dev_err(&pdev->dev, "Failed to add USB HCD\n");
@@ -200,7 +157,6 @@ static int exynos_ohci_probe(struct platform_device *pdev)
 
 fail_add_hcd:
 	exynos_ohci_phy_disable(&pdev->dev);
-	pdev->dev.of_node = exynos_ohci->of_node;
 fail_io:
 	clk_disable_unprepare(exynos_ohci->clk);
 fail_clk:
@@ -213,8 +169,6 @@ static int exynos_ohci_remove(struct platform_device *pdev)
 	struct usb_hcd *hcd = platform_get_drvdata(pdev);
 	struct exynos_ohci_hcd *exynos_ohci = to_exynos_ohci(hcd);
 
-	pdev->dev.of_node = exynos_ohci->of_node;
-
 	usb_remove_hcd(hcd);
 
 	exynos_ohci_phy_disable(&pdev->dev);
-- 
2.17.1


  parent reply	other threads:[~2019-05-21 12:04 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20190521120015eucas1p1da2f3f32d6b8af8cb550463686fd4e12@eucas1p1.samsung.com>
2019-05-21 11:58 ` [PATCH 0/5] Exynos EHCI/OHCI: resolve conflict with the generic USB device bindings Marek Szyprowski
     [not found]   ` <CGME20190521120107eucas1p1a56efaa0e7f2117063e70683276edc10@eucas1p1.samsung.com>
2019-05-21 11:58     ` [PATCH 1/5] dt-bindings: switch Exynos EHCI/OHCI bindings to use array of generic PHYs Marek Szyprowski
2019-06-14 16:30       ` Rob Herring
     [not found]   ` <CGME20190521120205eucas1p27671f3b96e443da8b13bd10618a77636@eucas1p2.samsung.com>
2019-05-21 11:58     ` [PATCH 2/5] ARM: dts: exynos: Add array of generic PHYs to EHCI/OHCI devices Marek Szyprowski
     [not found]   ` <CGME20190521120249eucas1p2e4a8fec922fa78783d7d3fed785f3e3b@eucas1p2.samsung.com>
2019-05-21 11:58     ` [PATCH 3/5] usb: exynos: add support for getting PHYs from the standard dt array Marek Szyprowski
     [not found]   ` <CGME20190521120330eucas1p21d9704bfd16f286ae764d20e456ef6b3@eucas1p2.samsung.com>
2019-05-21 11:58     ` [PATCH 4/5] ARM: dts: exynos: Remove obsolete port sub-nodes from EHCI/OHCI devices Marek Szyprowski
     [not found]   ` <CGME20190521120354eucas1p2a39ba06586ddd388a9c376a40327bb4c@eucas1p2.samsung.com>
2019-05-21 11:58     ` Marek Szyprowski [this message]
2019-05-21 13:30   ` [PATCH 0/5] Exynos EHCI/OHCI: resolve conflict with the generic USB device bindings Måns Rullgård
2019-05-22  6:01     ` Marek Szyprowski
2019-05-22 10:54       ` Måns Rullgård
2019-06-05  8:37         ` Marek Szyprowski

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=20190521115849.9882-6-m.szyprowski@samsung.com \
    --to=m.szyprowski@samsung.com \
    --cc=b.zolnierkie@samsung.com \
    --cc=devicetree@vger.kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=krzk@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=m.reichl@fivetechno.de \
    --cc=mans@mansr.com \
    --cc=peter.chen@nxp.com \
    --cc=robh+dt@kernel.org \
    --cc=stern@rowland.harvard.edu \
    /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).