From patchwork Tue Nov 5 05:31:08 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Popple X-Patchwork-Id: 288384 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [IPv6:::1]) by ozlabs.org (Postfix) with ESMTP id DC9922C0461 for ; Tue, 5 Nov 2013 16:33:35 +1100 (EST) Received: from ipmail04.adl6.internode.on.net (ipmail04.adl6.internode.on.net [IPv6:2001:44b8:8060:ff02:300:1:6:4]) by ozlabs.org (Postfix) with ESMTP id 9BE5B2C033F for ; Tue, 5 Nov 2013 16:31:55 +1100 (EST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AqMEAHqBeFKl5H4J/2dsb2JhbABZhkO9C4E/dIImAQUnUhAISVcZiAG+Qo9LBxaEGAOYCpIJgzoo Received: from ibmaus65.lnk.telstra.net (HELO localhost) ([165.228.126.9]) by ipmail04.adl6.internode.on.net with ESMTP; 05 Nov 2013 16:01:55 +1030 From: Alistair Popple To: linuxppc-dev@lists.ozlabs.org Subject: [PATCH 4/7] IBM Akebono: Add support to the OHCI platform driver for Akebono Date: Tue, 5 Nov 2013 16:31:08 +1100 Message-Id: <1383629471-16979-4-git-send-email-alistair@popple.id.au> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1383629471-16979-1-git-send-email-alistair@popple.id.au> References: <1383629471-16979-1-git-send-email-alistair@popple.id.au> Cc: Alistair Popple , linux-usb@vger.kernel.org, Alan Stern X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.16rc2 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" The IBM Akebono board 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 Cc: Alan Stern Cc: linux-usb@vger.kernel.org Acked-by: Alan Stern --- drivers/usb/host/ohci-platform.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c index a4c6410..4331454 100644 --- a/drivers/usb/host/ohci-platform.c +++ b/drivers/usb/host/ohci-platform.c @@ -23,6 +23,8 @@ #include #include #include +#include +#include #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,14 @@ 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 +175,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 = "ibm,akebono-ohci", }, + {}, +}; + static const struct platform_device_id ohci_platform_table[] = { { "ohci-platform", 0 }, { } @@ -191,6 +200,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, } };