From patchwork Fri Feb 15 22:12:29 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 14927 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id C799023E2E for ; Fri, 15 Feb 2013 22:12:40 +0000 (UTC) Received: from mail-ve0-f171.google.com (mail-ve0-f171.google.com [209.85.128.171]) by fiordland.canonical.com (Postfix) with ESMTP id 6A48CA18102 for ; Fri, 15 Feb 2013 22:12:40 +0000 (UTC) Received: by mail-ve0-f171.google.com with SMTP id b10so3510629vea.2 for ; Fri, 15 Feb 2013 14:12:40 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-provags-id:x-gm-message-state; bh=fT3JFNfPCy+JL5/OJoGx7Cc85vVuvZNyIepAOj7Wocs=; b=fJCzkRNQB8aZR1AjQULGs7xG5RQVrpw+ItPTyoQhVTGwWRENzeI87hrH2oJR+rlYVh 5XtmtpH7mrFSPkuPJ5ICMlwdROVSx+Nfl3VX7HNfk9dxETA2xpOImZngB5scXdBreXCO cODRgQGf6l6CgpZuQO4NEX1qRl6KUYPIg9oXsO78TXUX8A4Qmy/5cNpfukloq6/LW1sp 4WO5H/rEfK1k9Sayd+Uqg8jJF1FmASd3LZyGaBGCeELWXFwvyDqviKGqsl5WmGH9zo0v om8nJgZOjaeNJmFH2IYxW7Po/UWvjeTACjTeDhwG6+XhyPjYqA4oWoRwZ82XZ1RT//0T ln8A== X-Received: by 10.52.175.66 with SMTP id by2mr4882971vdc.53.1360966359861; Fri, 15 Feb 2013 14:12:39 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.221.4.5 with SMTP id oa5csp39420vcb; Fri, 15 Feb 2013 14:12:39 -0800 (PST) X-Received: by 10.14.220.135 with SMTP id o7mr13381770eep.3.1360966358018; Fri, 15 Feb 2013 14:12:38 -0800 (PST) Received: from moutng.kundenserver.de (moutng.kundenserver.de. [212.227.126.171]) by mx.google.com with ESMTPS id h48si18601920eeo.196.2013.02.15.14.12.37 (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 15 Feb 2013 14:12:38 -0800 (PST) Received-SPF: neutral (google.com: 212.227.126.171 is neither permitted nor denied by best guess record for domain of arnd@arndb.de) client-ip=212.227.126.171; Authentication-Results: mx.google.com; spf=neutral (google.com: 212.227.126.171 is neither permitted nor denied by best guess record for domain of arnd@arndb.de) smtp.mail=arnd@arndb.de Received: from wuerfel.lan (HSI-KBW-46-223-90-92.hsi.kabel-badenwuerttemberg.de [46.223.90.92]) by mrelayeu.kundenserver.de (node=mrbap1) with ESMTP (Nemesis) id 0LgNIi-1Uimt73CEu-00ndFS; Fri, 15 Feb 2013 23:12:30 +0100 From: Arnd Bergmann To: Greg KH Cc: Manjunath Goudar , linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org, patches@linaro.org, Arnd Bergmann , Jason Cooper , Andrew Lunn Subject: [PATCH 2/2] USB: EHCI: make ehci-orion a separate driver Date: Fri, 15 Feb 2013 23:12:29 +0100 Message-Id: <1360966349-1242560-2-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1360966349-1242560-1-git-send-email-arnd@arndb.de> References: <201302152158.23446.arnd@arndb.de> <1360966349-1242560-1-git-send-email-arnd@arndb.de> X-Provags-ID: V02:K0:0PDDbTC8RFyz4iYFZ0AipBAyAi/+yvYbeXEqeIjTHWr RKQfrdLtU4Sy8JJVj6k9yWwswwGysjWvYZivl69ZvX5/R+UfZY qmJshmgI4fo+kctH2eQW8uUTjeLclXbt9KDbfqYRSapmjwYz5W D0sA4+crgiBcQhufG8UFnb9mbBA25r1kpWPUfOBwBQlNE/8pP4 ElV6/vprxPreGZB1jtDDrOLXNuxWzQt4FkAzmLfzj8qkdi3opJ SOEFrN0XDmiY0Jpv5MYaQTs8bwQ1hnX8FcDErTvR7kNKM5JFiB yROWUZKMSdwPez1gClOmYSu7C1r6qCR+NXvddb84ds0dres3Bu kwZWFrdzj4IzjLNgXOeCl4NppLk9i3EL5qHSUYYgk X-Gm-Message-State: ALoCoQmpUzjTnnd7M3UqSpLATtrMY8dx2I24/HZrhFGvQxChESPg1WH01vGykTwi4VVgYPaSV2vm From: Manjunath Goudar With the multiplatform changes in arm-soc tree, it becomes possible to enable the mvebu platform (which uses ehci-orion) at the same time as other platforms that require a conflicting EHCI bus glue. At the moment, this results in a warning like drivers/usb/host/ehci-hcd.c:1297:0: warning: "PLATFORM_DRIVER" redefined [enabled by default] drivers/usb/host/ehci-hcd.c:1277:0: note: this is the location of the previous definition drivers/usb/host/ehci-orion.c:334:31: warning: 'ehci_orion_driver' defined but not used [-Wunused-variable] and an ehci driver that only works on one of them. With the infrastructure added by Alan Stern in patch 3e0232039 "USB: EHCI: prepare to make ehci-hcd a library module", we can avoid this problem by turning a bus glue into a separate module, as we do here for the orion bus glue. Signed-off-by: Manjunath Goudar Signed-off-by: Arnd Bergmann Cc: Jason Cooper Cc: Andrew Lunn Acked-by: Jason Cooper Tested-by: Andrew Lunn --- drivers/usb/host/Kconfig | 8 ++++ drivers/usb/host/Makefile | 1 + drivers/usb/host/ehci-hcd.c | 6 +-- drivers/usb/host/ehci-orion.c | 90 ++++++++++++++++++++----------------------- 4 files changed, 52 insertions(+), 53 deletions(-) diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index d77e028..7ac6f48 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig @@ -162,6 +162,14 @@ config USB_EHCI_HCD_OMAP Enables support for the on-chip EHCI controller on OMAP3 and later chips. +config USB_EHCI_HCD_ORION + tristate "Support for Marvell Orion on-chip EHCI USB controller" + depends on USB_EHCI_HCD && PLAT_ORION + default y + ---help--- + Enables support for the on-chip EHCI controller on + Morvell Orion chips. + config USB_EHCI_HCD_VT8500 tristate "Support for VT8500 on-chip EHCI USB controller" depends on USB_EHCI_HCD && ARCH_VT8500 diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile index b0da9cf..4db3f01 100644 --- a/drivers/usb/host/Makefile +++ b/drivers/usb/host/Makefile @@ -30,6 +30,7 @@ obj-$(CONFIG_USB_EHCI_MXC) += ehci-mxc.o obj-$(CONFIG_USB_OXU210HP_HCD) += oxu210hp-hcd.o obj-$(CONFIG_USB_EHCI_HCD_VT8500)+= ehci-vt8500.o +obj-$(CONFIG_USB_EHCI_HCD_ORION)+= ehci-orion.o obj-$(CONFIG_USB_ISP116X_HCD) += isp116x-hcd.o obj-$(CONFIG_USB_ISP1362_HCD) += isp1362-hcd.o obj-$(CONFIG_USB_OHCI_HCD) += ohci-hcd.o diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 487ebb8..26154f0 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c @@ -1272,11 +1272,6 @@ MODULE_LICENSE ("GPL"); #define XILINX_OF_PLATFORM_DRIVER ehci_hcd_xilinx_of_driver #endif -#ifdef CONFIG_PLAT_ORION -#include "ehci-orion.c" -#define PLATFORM_DRIVER ehci_orion_driver -#endif - #ifdef CONFIG_USB_W90X900_EHCI #include "ehci-w90x900.c" #define PLATFORM_DRIVER ehci_hcd_w90x900_driver @@ -1343,6 +1338,7 @@ MODULE_LICENSE ("GPL"); !IS_ENABLED(CONFIG_USB_EHCI_MXC) && \ !defined(PLATFORM_DRIVER) && \ !IS_ENABLED(CONFIG_ARCH_VT8500) && \ + !IS_ENABLED(CONFIG_PLAT_ORION) && \ !defined(PS3_SYSTEM_BUS_DRIVER) && \ !defined(OF_PLATFORM_DRIVER) && \ !defined(XILINX_OF_PLATFORM_DRIVER) diff --git a/drivers/usb/host/ehci-orion.c b/drivers/usb/host/ehci-orion.c index 914a3ec..cfc4803 100644 --- a/drivers/usb/host/ehci-orion.c +++ b/drivers/usb/host/ehci-orion.c @@ -17,6 +17,13 @@ #include #include #include +#include +#include +#include +#include + +#include "ehci.h" + #define rdl(off) __raw_readl(hcd->regs + (off)) #define wrl(off, val) __raw_writel((val), hcd->regs + (off)) @@ -34,6 +41,17 @@ #define USB_PHY_IVREF_CTRL 0x440 #define USB_PHY_TST_GRP_CTRL 0x450 +#define DRIVER_DESC "EHCI orion driver" + +static const char hcd_name[] = "ehci-orion"; + +static struct hc_driver __read_mostly ehci_orion_hc_driver; + +static const struct ehci_driver_overrides orion_overrides __initdata = { + .reset = ehci_setup, +}; + + /* * Implement Orion USB controller specification guidelines */ @@ -104,51 +122,6 @@ static void orion_usb_phy_v1_setup(struct usb_hcd *hcd) wrl(USB_MODE, 0x13); } -static const struct hc_driver ehci_orion_hc_driver = { - .description = hcd_name, - .product_desc = "Marvell Orion EHCI", - .hcd_priv_size = sizeof(struct ehci_hcd), - - /* - * generic hardware linkage - */ - .irq = ehci_irq, - .flags = HCD_MEMORY | HCD_USB2, - - /* - * basic lifecycle operations - */ - .reset = ehci_setup, - .start = ehci_run, - .stop = ehci_stop, - .shutdown = ehci_shutdown, - - /* - * managing i/o requests and associated device resources - */ - .urb_enqueue = ehci_urb_enqueue, - .urb_dequeue = ehci_urb_dequeue, - .endpoint_disable = ehci_endpoint_disable, - .endpoint_reset = ehci_endpoint_reset, - - /* - * scheduling support - */ - .get_frame_number = ehci_get_frame, - - /* - * root hub support - */ - .hub_status_data = ehci_hub_status_data, - .hub_control = ehci_hub_control, - .bus_suspend = ehci_bus_suspend, - .bus_resume = ehci_bus_resume, - .relinquish_port = ehci_relinquish_port, - .port_handed_over = ehci_port_handed_over, - - .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete, -}; - static void ehci_orion_conf_mbus_windows(struct usb_hcd *hcd, const struct mbus_dram_target_info *dram) @@ -323,8 +296,6 @@ static int __exit ehci_orion_drv_remove(struct platform_device *pdev) return 0; } -MODULE_ALIAS("platform:orion-ehci"); - static const struct of_device_id ehci_orion_dt_ids[] = { { .compatible = "marvell,orion-ehci", }, {}, @@ -336,8 +307,31 @@ static struct platform_driver ehci_orion_driver = { .remove = __exit_p(ehci_orion_drv_remove), .shutdown = usb_hcd_platform_shutdown, .driver = { - .name = "orion-ehci", + .name = hcd_name, .owner = THIS_MODULE, .of_match_table = of_match_ptr(ehci_orion_dt_ids), }, }; + +static int __init ehci_orion_init(void) +{ + if (usb_disabled()) + return -ENODEV; + + pr_info("%s: " DRIVER_DESC "\n", hcd_name); + + ehci_init_driver(&ehci_orion_hc_driver, &orion_overrides); + return platform_driver_register(&ehci_orion_driver); +} +module_init(ehci_orion_init); + +static void __exit ehci_orion_cleanup(void) +{ + platform_driver_unregister(&ehci_orion_driver); +} +module_exit(ehci_orion_cleanup); + +MODULE_DESCRIPTION(DRIVER_DESC); +MODULE_ALIAS("platform:ehci-orion"); +MODULE_AUTHOR("Tzachi Perelstein"); +MODULE_LICENSE("GPL");