linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Alistair Popple <alistair@popple.id.au>
To: benh@kernel.crashing.org
Cc: linuxppc-dev@ozlabs.org, linux-usb@vger.kernel.org,
	Alistair Popple <alistair@popple.id.au>
Subject: [PATCH 4/8] IBM Akebono: Add support to the OHCI platform driver for PPC476GTR
Date: Fri, 22 Nov 2013 13:08:32 +1100	[thread overview]
Message-ID: <1385086116-10972-4-git-send-email-alistair@popple.id.au> (raw)
In-Reply-To: <1385086057-10884-1-git-send-email-alistair@popple.id.au>

The IBM Akebono board uses the PPC476GTR SoC which has a OHCI
compliant USB host interface. This patch adds support for it to the
OHCI platform driver.

As we use device tree to pass platform specific data instead of
platform data we remove the check for platform data and instead
provide reasonable defaults if no platform data is present. This is
similar to what is currently done in ehci-platform.c.

Signed-off-by: Alistair Popple <alistair@popple.id.au>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Cc: linux-usb@vger.kernel.org
---
 drivers/usb/host/ohci-platform.c |   22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c
index a4c6410..e1ae5d3 100644
--- a/drivers/usb/host/ohci-platform.c
+++ b/drivers/usb/host/ohci-platform.c
@@ -23,6 +23,8 @@
 #include <linux/usb/ohci_pdriver.h>
 #include <linux/usb.h>
 #include <linux/usb/hcd.h>
+#include <linux/slab.h>
+#include <linux/of.h>
 
 #include "ohci.h"
 
@@ -55,6 +57,8 @@ static const struct ohci_driver_overrides platform_overrides __initconst = {
 	.reset =	ohci_platform_reset,
 };
 
+static struct usb_ohci_pdata ohci_platform_defaults;
+
 static int ohci_platform_probe(struct platform_device *dev)
 {
 	struct usb_hcd *hcd;
@@ -63,14 +67,16 @@ static int ohci_platform_probe(struct platform_device *dev)
 	int irq;
 	int err = -ENOMEM;
 
-	if (!pdata) {
-		WARN_ON(1);
-		return -ENODEV;
-	}
-
 	if (usb_disabled())
 		return -ENODEV;
 
+	/*
+	 * Platforms using DT don't always provide platform data.
+	 * This should provide reasonable defaults.
+	 */
+	if (!pdata)
+		dev->dev.platform_data = pdata = &ohci_platform_defaults;
+
 	irq = platform_get_irq(dev, 0);
 	if (irq < 0) {
 		dev_err(&dev->dev, "no irq provided");
@@ -171,6 +177,11 @@ static int ohci_platform_resume(struct device *dev)
 #define ohci_platform_resume	NULL
 #endif /* CONFIG_PM */
 
+static const struct of_device_id ohci_of_match[] = {
+	{ .compatible = "usb-ohci", },
+	{},
+};
+
 static const struct platform_device_id ohci_platform_table[] = {
 	{ "ohci-platform", 0 },
 	{ }
@@ -191,6 +202,7 @@ static struct platform_driver ohci_platform_driver = {
 		.owner	= THIS_MODULE,
 		.name	= "ohci-platform",
 		.pm	= &ohci_platform_pm_ops,
+		.of_match_table = ohci_of_match,
 	}
 };
 
-- 
1.7.10.4

  parent reply	other threads:[~2013-11-22  2:08 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-22  2:07 [PATCH 0/8] IBM Akebono/PPC476GTR Support Alistair Popple
2013-11-22  2:08 ` [PATCH 1/8] IBM Akebono: Add support to AHCI platform driver Alistair Popple
2013-11-22 22:24   ` Tejun Heo
2013-11-22  2:08 ` [PATCH 2/8] IBM Akebono: Add a SDHCI " Alistair Popple
2013-12-17  1:11   ` Alistair Popple
2013-11-22  2:08 ` [PATCH 3/8] IBM Akebono: Add support for a new PHY interface to the IBM emac driver Alistair Popple
2013-12-05  4:49   ` Benjamin Herrenschmidt
2013-11-22  2:08 ` Alistair Popple [this message]
2014-01-11  1:27   ` [PATCH 4/8] IBM Akebono: Add support to the OHCI platform driver for PPC476GTR Sergei Shtylyov
2014-01-11  0:52     ` Greg KH
2014-01-11  1:06       ` Benjamin Herrenschmidt
2014-01-12 23:54         ` Alistair Popple
2013-11-22  2:08 ` [PATCH 5/8] ECHI Platform: Merge ppc-of EHCI driver into the ehci-platform driver Alistair Popple
2013-11-22  2:08 ` [PATCH 6/8] IBM Currituck: Clean up board specific code before adding Akebono code Alistair Popple
2013-11-22  2:08 ` [PATCH 7/8] IBM Akebono: Add the Akebono platform Alistair Popple
2013-11-22  2:08 ` [PATCH 8/8] powerpc: Added PCI MSI support using the HSTA module Alistair Popple

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=1385086116-10972-4-git-send-email-alistair@popple.id.au \
    --to=alistair@popple.id.au \
    --cc=benh@kernel.crashing.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=linuxppc-dev@ozlabs.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 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).