mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paul Burton <paul.burton@imgtec.com>
To: <linux-mips@linux-mips.org>, Ralf Baechle <ralf@linux-mips.org>
Cc: Paul Burton <paul.burton@imgtec.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Alan Stern <stern@rowland.harvard.edu>,
	<linux-usb@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: [PATCH 06/20] usb: host: ehci-sead3: Support probing using device tree
Date: Tue, 9 Aug 2016 13:35:31 +0100	[thread overview]
Message-ID: <20160809123546.10190-7-paul.burton@imgtec.com> (raw)
In-Reply-To: <20160809123546.10190-1-paul.burton@imgtec.com>

Introduce support for probing the SEAD3 EHCI driver using device tree.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
---

 drivers/usb/host/ehci-sead3.c | 29 +++++++++++++++++++++++------
 1 file changed, 23 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/host/ehci-sead3.c b/drivers/usb/host/ehci-sead3.c
index 3d86cc2..05db1ae 100644
--- a/drivers/usb/host/ehci-sead3.c
+++ b/drivers/usb/host/ehci-sead3.c
@@ -20,6 +20,7 @@
  */
 
 #include <linux/err.h>
+#include <linux/of_irq.h>
 #include <linux/platform_device.h>
 
 static int ehci_sead3_setup(struct usb_hcd *hcd)
@@ -96,15 +97,25 @@ static int ehci_hcd_sead3_drv_probe(struct platform_device *pdev)
 {
 	struct usb_hcd *hcd;
 	struct resource *res;
-	int ret;
+	int ret, irq;
 
 	if (usb_disabled())
 		return -ENODEV;
 
-	if (pdev->resource[1].flags != IORESOURCE_IRQ) {
-		pr_debug("resource[1] is not IORESOURCE_IRQ");
-		return -ENOMEM;
+	if (pdev->dev.of_node) {
+		irq = irq_of_parse_and_map(pdev->dev.of_node, 0);
+		if (!irq) {
+			dev_err(&pdev->dev, "failed to map IRQ\n");
+			return -ENODEV;
+		}
+	} else {
+		if (pdev->resource[1].flags != IORESOURCE_IRQ) {
+			pr_debug("resource[1] is not IORESOURCE_IRQ");
+			return -ENOMEM;
+		}
+		irq = pdev->resource[1].start;
 	}
+
 	hcd = usb_create_hcd(&ehci_sead3_hc_driver, &pdev->dev, "SEAD-3");
 	if (!hcd)
 		return -ENOMEM;
@@ -121,8 +132,7 @@ static int ehci_hcd_sead3_drv_probe(struct platform_device *pdev)
 	/* Root hub has integrated TT. */
 	hcd->has_tt = 1;
 
-	ret = usb_add_hcd(hcd, pdev->resource[1].start,
-			  IRQF_SHARED);
+	ret = usb_add_hcd(hcd, irq, IRQF_SHARED);
 	if (ret == 0) {
 		platform_set_drvdata(pdev, hcd);
 		device_wakeup_enable(hcd->self.controller);
@@ -172,12 +182,19 @@ static const struct dev_pm_ops sead3_ehci_pmops = {
 #define SEAD3_EHCI_PMOPS NULL
 #endif
 
+static const struct of_device_id sead3_ehci_of_match[] = {
+	{ .compatible = "mti,sead3-ehci" },
+	{},
+};
+MODULE_DEVICE_TABLE(of, sead3_ehci_of_match);
+
 static struct platform_driver ehci_hcd_sead3_driver = {
 	.probe		= ehci_hcd_sead3_drv_probe,
 	.remove		= ehci_hcd_sead3_drv_remove,
 	.shutdown	= usb_hcd_platform_shutdown,
 	.driver = {
 		.name	= "sead3-ehci",
+		.of_match_table = sead3_ehci_of_match,
 		.pm	= SEAD3_EHCI_PMOPS,
 	}
 };
-- 
2.9.2

  parent reply	other threads:[~2016-08-09 12:37 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-09 12:35 [PATCH 00/20] MIPS: SEAD3 device tree conversion Paul Burton
2016-08-09 12:35 ` [PATCH 01/20] MIPS: SEAD3: Split obj-y entries across lines Paul Burton
2016-08-09 12:35 ` [PATCH 02/20] MIPS: SEAD3: Probe interrupt controllers using DT Paul Burton
2016-08-10  9:41   ` kbuild test robot
2016-08-09 12:35 ` [PATCH 03/20] MIPS: SEAD3: Probe UARTs " Paul Burton
2016-08-10 10:15   ` kbuild test robot
2016-08-10 10:57   ` kbuild test robot
2016-08-09 12:35 ` [PATCH 04/20] MIPS: SEAD3: Use generic ns16550a earlycon support Paul Burton
2016-08-09 12:35 ` [PATCH 05/20] MIPS: SEAD3: Probe ethernet controller using DT Paul Burton
2016-08-09 12:35 ` Paul Burton [this message]
2016-08-09 14:08   ` [PATCH 06/20] usb: host: ehci-sead3: Support probing using device tree Jonas Gorski
2016-08-09 12:35 ` [PATCH 07/20] MIPS: SEAD3: Probe EHCI controller using DT Paul Burton
2016-08-09 12:35 ` [PATCH 08/20] usb: host: ehci-sead3: Remove non-DT probe code Paul Burton
2016-08-09 14:21   ` Alan Stern
2016-08-09 12:35 ` [PATCH 09/20] SEAD3: Probe parallel flash via DT Paul Burton
2016-08-09 13:23   ` Sergei Shtylyov
2016-08-09 12:35 ` [PATCH 10/20] MIPS: SEAD3: Use register-bit-led driver via DT for LEDs Paul Burton
2016-08-09 12:35 ` [PATCH 11/20] leds: Remove SEAD3 driver Paul Burton
2016-08-09 12:35 ` [PATCH 12/20] MIPS: SEAD3: Reset via generic syscon-reboot driver & DT Paul Burton
2016-08-09 12:35 ` [PATCH 13/20] MIPS: SEAD3: Use generic restart-poweroff driver Paul Burton
2016-08-09 12:35 ` [PATCH 14/20] MIPS: SEAD3: Parse memsize in DT shim Paul Burton
2016-08-09 12:35 ` [PATCH 15/20] MIPS: SEAD3: Drop use of cobalt fbdev driver Paul Burton
2016-08-09 12:35 ` [PATCH 16/20] fbdev: cobalt_lcdfb: Drop SEAD3 support Paul Burton
2016-08-10 10:17   ` Tomi Valkeinen
2016-08-09 12:35 ` [PATCH 17/20] dt-bindings: img-ascii-lcd: Document a binding for simple ASCII LCDs Paul Burton
2016-08-10 22:16   ` Rob Herring
2016-08-09 12:35 ` [PATCH 18/20] auxdisplay: img-ascii-lcd: driver for simple ASCII LCD displays Paul Burton
2016-08-09 12:35 ` [PATCH 19/20] MIPS: SEAD3: Use img-ascii-lcd driver Paul Burton
2016-08-09 12:35 ` [PATCH 20/20] MIPS: SEAD3: Remove custom read_persistent_clock Paul Burton

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=20160809123546.10190-7-paul.burton@imgtec.com \
    --to=paul.burton@imgtec.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=ralf@linux-mips.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

all inboxes | Powered by JetHome®