From patchwork Mon Jun 3 15:14:15 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: manjunath.goudar@linaro.org X-Patchwork-Id: 17488 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ea0-f197.google.com (mail-ea0-f197.google.com [209.85.215.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 732D7238F2 for ; Mon, 3 Jun 2013 15:14:37 +0000 (UTC) Received: by mail-ea0-f197.google.com with SMTP id z7sf3523140eaf.4 for ; Mon, 03 Jun 2013 08:14:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-beenthere:x-forwarded-to:x-forwarded-for :delivered-to:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe; bh=/e8Sygu+Q1oYzvzbfkzTcB+lr8oC0wRi0KaxOaa1muc=; b=Gn73+WXEQzk4crxcAJK1jlJlUK0BMU6qt0niVGCpLHIilDsN4pLijiI2VDqxHq2tK9 jBho5NRsWn9cXa90sWEb5YBhJsKwH4Q5CxivXt1JTKcPJ1sLALi1nnZ6VoZM7dEBEtgk 3ikyarCy0npMzVZ3buad/1ElOHQ8w0ki0GMw9y60QcMjurOTZAvhpAOBxgll50PNwai9 lUurgM4yv31I1hVe+pybZjfm0nbUrhvSVjncT7ckCQp13o74JB0tGWETtw610wihp7Ai 2hZOiRjGk3XEttGnPwh3K4vmjL75+p510QIYPj9yfiGqb+VQuZd7fk15icAxY4rpw3iC Ycxg== X-Received: by 10.180.11.232 with SMTP id t8mr5078588wib.3.1370272476168; Mon, 03 Jun 2013 08:14:36 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.180.96.34 with SMTP id dp2ls798323wib.14.gmail; Mon, 03 Jun 2013 08:14:36 -0700 (PDT) X-Received: by 10.180.206.180 with SMTP id lp20mr13075460wic.41.1370272475998; Mon, 03 Jun 2013 08:14:35 -0700 (PDT) Received: from mail-ve0-x229.google.com (mail-ve0-x229.google.com [2607:f8b0:400c:c01::229]) by mx.google.com with ESMTPS id x14si9881833wiv.44.2013.06.03.08.14.35 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 03 Jun 2013 08:14:35 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c01::229 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c01::229; Received: by mail-ve0-f169.google.com with SMTP id m1so2985077ves.0 for ; Mon, 03 Jun 2013 08:14:34 -0700 (PDT) X-Received: by 10.58.116.211 with SMTP id jy19mr16996755veb.7.1370272474740; Mon, 03 Jun 2013 08:14:34 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.221.10.206 with SMTP id pb14csp82569vcb; Mon, 3 Jun 2013 08:14:34 -0700 (PDT) X-Received: by 10.66.228.98 with SMTP id sh2mr7542226pac.80.1370272473597; Mon, 03 Jun 2013 08:14:33 -0700 (PDT) Received: from mail-pa0-x22a.google.com (mail-pa0-x22a.google.com [2607:f8b0:400e:c03::22a]) by mx.google.com with ESMTPS id xl2si40117414pbc.31.2013.06.03.08.14.33 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 03 Jun 2013 08:14:33 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400e:c03::22a is neither permitted nor denied by best guess record for domain of manjunath.goudar@linaro.org) client-ip=2607:f8b0:400e:c03::22a; Received: by mail-pa0-f42.google.com with SMTP id bj1so938330pad.1 for ; Mon, 03 Jun 2013 08:14:33 -0700 (PDT) X-Received: by 10.68.248.100 with SMTP id yl4mr24057866pbc.125.1370272473085; Mon, 03 Jun 2013 08:14:33 -0700 (PDT) Received: from localhost.localdomain ([223.239.135.240]) by mx.google.com with ESMTPSA id pl9sm41171958pbc.5.2013.06.03.08.14.28 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 03 Jun 2013 08:14:32 -0700 (PDT) From: Manjunath Goudar To: linux-usb@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, patches@linaro.org, stern@rowland.harvard.edu, arnd@linaro.org, manjunath.goudar@linaro.org, linaro-dev@lists.linaro.org, Arnd Bergmann , Greg KH Subject: [PATCH 1/2] USB: OHCI: make ohci-platform a separate driver Date: Mon, 3 Jun 2013 20:44:15 +0530 Message-Id: <1370272457-25983-2-git-send-email-manjunath.goudar@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1370272457-25983-1-git-send-email-manjunath.goudar@linaro.org> References: <1369907454-11003-2-git-send-email-manjunath.goudar@linaro.org> <1370272457-25983-1-git-send-email-manjunath.goudar@linaro.org> X-Gm-Message-State: ALoCoQkubpSrg3Fg+BovoOq31i8ExojAC1hiqNuwxgvO4nTsjgSboK+cYT4p2qCN5UlmAsUpJ7/Z X-Original-Sender: manjunath.goudar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c01::229 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , This patch splits the ohci-platform code from ohci-hcd out into its own separate driver module.This work is part of enabling multi-platform kernels on ARM. In V2: -Passed "hcd" argument instead of "ohci" in ohci_setup() because it is using "struct usb_hcd" argument. In V3: -Directly passed "hcd" argument not required to call ohci_to_hcd() function. Signed-off-by: Manjunath Goudar Acked-by: Alan Stern Cc: Arnd Bergmann Cc: Greg KH Cc: linux-usb@vger.kernel.org --- drivers/usb/host/Kconfig | 2 +- drivers/usb/host/Makefile | 1 + drivers/usb/host/ohci-hcd.c | 6 +-- drivers/usb/host/ohci-platform.c | 88 ++++++++++++++++++-------------------- 4 files changed, 44 insertions(+), 53 deletions(-) diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index a0a2f3a..5391a38 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig @@ -501,7 +501,7 @@ config USB_CNS3XXX_OHCI It is needed for low-speed USB 1.0 device support. config USB_OHCI_HCD_PLATFORM - bool "Generic OHCI driver for a platform device" + tristate "Generic OHCI driver for a platform device" default n ---help--- Adds an OHCI host driver for a generic platform device, which diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile index 2214ded..8a89c3d 100644 --- a/drivers/usb/host/Makefile +++ b/drivers/usb/host/Makefile @@ -45,6 +45,7 @@ obj-$(CONFIG_USB_ISP1362_HCD) += isp1362-hcd.o obj-$(CONFIG_USB_OHCI_HCD) += ohci-hcd.o obj-$(CONFIG_USB_OHCI_HCD_PCI) += ohci-pci.o +obj-$(CONFIG_USB_OHCI_HCD_PLATFORM) += ohci-platform.o obj-$(CONFIG_USB_UHCI_HCD) += uhci-hcd.o obj-$(CONFIG_USB_FHCI_HCD) += fhci.o diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c index 237be7c..39c7624 100644 --- a/drivers/usb/host/ohci-hcd.c +++ b/drivers/usb/host/ohci-hcd.c @@ -1258,12 +1258,8 @@ MODULE_LICENSE ("GPL"); #define PLATFORM_DRIVER ohci_hcd_tilegx_driver #endif -#ifdef CONFIG_USB_OHCI_HCD_PLATFORM -#include "ohci-platform.c" -#define PLATFORM_DRIVER ohci_platform_driver -#endif - #if !IS_ENABLED(CONFIG_USB_OHCI_HCD_PCI) && \ + !IS_ENABLED(CONFIG_USB_OHCI_HCD_PLATFORM) && \ !defined(PLATFORM_DRIVER) && \ !defined(OMAP1_PLATFORM_DRIVER) && \ !defined(OMAP3_PLATFORM_DRIVER) && \ diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c index 76a3531..bc30475 100644 --- a/drivers/usb/host/ohci-platform.c +++ b/drivers/usb/host/ohci-platform.c @@ -13,16 +13,28 @@ * * Licensed under the GNU/GPL. See COPYING for details. */ + +#include +#include +#include +#include #include #include #include +#include +#include + +#include "ohci.h" + +#define DRIVER_DESC "OHCI generic platform driver" + +static const char hcd_name[] = "ohci-platform"; static int ohci_platform_reset(struct usb_hcd *hcd) { struct platform_device *pdev = to_platform_device(hcd->self.controller); struct usb_ohci_pdata *pdata = pdev->dev.platform_data; struct ohci_hcd *ohci = hcd_to_ohci(hcd); - int err; if (pdata->big_endian_desc) ohci->flags |= OHCI_QUIRK_BE_DESC; @@ -30,58 +42,17 @@ static int ohci_platform_reset(struct usb_hcd *hcd) ohci->flags |= OHCI_QUIRK_BE_MMIO; if (pdata->no_big_frame_no) ohci->flags |= OHCI_QUIRK_FRAME_NO; - - ohci_hcd_init(ohci); - if (pdata->num_ports) ohci->num_ports = pdata->num_ports; - err = ohci_init(ohci); - - return err; -} - -static int ohci_platform_start(struct usb_hcd *hcd) -{ - struct ohci_hcd *ohci = hcd_to_ohci(hcd); - int err; - - err = ohci_run(ohci); - if (err < 0) { - ohci_err(ohci, "can't start\n"); - ohci_stop(hcd); - } - - return err; + return ohci_setup(hcd); } -static const struct hc_driver ohci_platform_hc_driver = { - .description = hcd_name, - .product_desc = "Generic Platform OHCI Controller", - .hcd_priv_size = sizeof(struct ohci_hcd), +static struct hc_driver __read_mostly ohci_platform_hc_driver; - .irq = ohci_irq, - .flags = HCD_MEMORY | HCD_USB11, - - .reset = ohci_platform_reset, - .start = ohci_platform_start, - .stop = ohci_stop, - .shutdown = ohci_shutdown, - - .urb_enqueue = ohci_urb_enqueue, - .urb_dequeue = ohci_urb_dequeue, - .endpoint_disable = ohci_endpoint_disable, - - .get_frame_number = ohci_get_frame, - - .hub_status_data = ohci_hub_status_data, - .hub_control = ohci_hub_control, -#ifdef CONFIG_PM - .bus_suspend = ohci_bus_suspend, - .bus_resume = ohci_bus_resume, -#endif - - .start_port_reset = ohci_start_port_reset, +static const struct ohci_driver_overrides platform_overrides __initconst = { + .product_desc = "Generic Platform OHCI controller", + .reset = ohci_platform_reset, }; static int ohci_platform_probe(struct platform_device *dev) @@ -222,3 +193,26 @@ static struct platform_driver ohci_platform_driver = { .pm = &ohci_platform_pm_ops, } }; + +static int __init ohci_platform_init(void) +{ + if (usb_disabled()) + return -ENODEV; + + pr_info("%s: " DRIVER_DESC "\n", hcd_name); + + ohci_init_driver(&ohci_platform_hc_driver, &platform_overrides); + return platform_driver_register(&ohci_platform_driver); +} +module_init(ohci_platform_init); + +static void __exit ohci_platform_cleanup(void) +{ + platform_driver_unregister(&ohci_platform_driver); +} +module_exit(ohci_platform_cleanup); + +MODULE_DESCRIPTION(DRIVER_DESC); +MODULE_AUTHOR("Hauke Mehrtens"); +MODULE_AUTHOR("Alan Stern"); +MODULE_LICENSE("GPL");