From patchwork Thu Jan 10 20:48:17 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Stern X-Patchwork-Id: 1962471 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 3452ADF264 for ; Thu, 10 Jan 2013 20:58:23 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TtP9l-0003zu-Gl; Thu, 10 Jan 2013 20:55:21 +0000 Received: from iolanthe.rowland.org ([192.131.102.54]) by merlin.infradead.org with smtp (Exim 4.76 #1 (Red Hat Linux)) id 1TtP9b-0003wT-8a for linux-arm-kernel@lists.infradead.org; Thu, 10 Jan 2013 20:55:14 +0000 Received: (qmail 4418 invoked by uid 2102); 10 Jan 2013 15:48:17 -0500 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 10 Jan 2013 15:48:17 -0500 Date: Thu, 10 Jan 2013 15:48:17 -0500 (EST) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: Roger Quadros Subject: Re: [PATCH 07/14] usb: ehci-omap: Instantiate PHY devices if required In-Reply-To: <1357836694-30788-8-git-send-email-rogerq@ti.com> Message-ID: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130110_155511_445504_E595D112 X-CRM114-Status: GOOD ( 22.81 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: sameo@linux.intel.com, tony@atomide.com, gregkh@linuxfoundation.org, USB list , Kernel development list , Felipe Balbi , kishon@ti.com, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org On Thu, 10 Jan 2013, Roger Quadros wrote: > If the OMAP's Host controller is in PHY mode then we instantiate > a platform device for the PHY (one for each port in PHY mode) and > hold a reference to it so that we can use the usb_phy API, e.g. > while suspend/resume. > > The platform data for the PHY must be supplied in the newly added > .phy_config parameter in struct usbhs_omap_platform_data. > > The end goal is to move the PHY's reset and power handling code > out of the ehci-omap driver and into the phy driver. As mentioned in another thread, I would prefer to have these changes to ehci-omap.c made after the driver is converted to the new "ehci-hcd is a library" scheme. The patch below does the conversion; it is meant to apply on top of the similar patch for ehci-mxc posted recently on the linux-usb mailing list. After this conversion, the omap_ehci_hcd private data structure doesn't have to be allocated specifically. It can be handled in the same way as the private data structure in the ehci-mxc patch. I haven't even tried to compile this. Please let me know how it works. Alan Stern Index: usb-3.7/drivers/usb/host/Kconfig =================================================================== --- usb-3.7.orig/drivers/usb/host/Kconfig +++ usb-3.7/drivers/usb/host/Kconfig @@ -155,7 +155,7 @@ config USB_EHCI_MXC Variation of ARC USB block used in some Freescale chips. config USB_EHCI_HCD_OMAP - bool "EHCI support for OMAP3 and later chips" + tristate "EHCI support for OMAP3 and later chips" depends on USB_EHCI_HCD && ARCH_OMAP default y ---help--- Index: usb-3.7/drivers/usb/host/Makefile =================================================================== --- usb-3.7.orig/drivers/usb/host/Makefile +++ usb-3.7/drivers/usb/host/Makefile @@ -27,6 +27,7 @@ obj-$(CONFIG_USB_EHCI_HCD) += ehci-hcd.o obj-$(CONFIG_USB_EHCI_PCI) += ehci-pci.o obj-$(CONFIG_USB_EHCI_HCD_PLATFORM) += ehci-platform.o obj-$(CONFIG_USB_EHCI_MXC) += ehci-mxc.o +obj-$(CONFIG_USB_EHCI_HCD_OMAP) += ehci-omap.o obj-$(CONFIG_USB_OXU210HP_HCD) += oxu210hp-hcd.o obj-$(CONFIG_USB_ISP116X_HCD) += isp116x-hcd.o Index: usb-3.7/drivers/usb/host/ehci-hcd.c =================================================================== --- usb-3.7.orig/drivers/usb/host/ehci-hcd.c +++ usb-3.7/drivers/usb/host/ehci-hcd.c @@ -1255,11 +1255,6 @@ MODULE_LICENSE ("GPL"); #define PLATFORM_DRIVER ehci_hcd_sh_driver #endif -#ifdef CONFIG_USB_EHCI_HCD_OMAP -#include "ehci-omap.c" -#define PLATFORM_DRIVER ehci_hcd_omap_driver -#endif - #ifdef CONFIG_PPC_PS3 #include "ehci-ps3.c" #define PS3_SYSTEM_BUS_DRIVER ps3_ehci_driver @@ -1349,6 +1344,7 @@ MODULE_LICENSE ("GPL"); !IS_ENABLED(CONFIG_USB_EHCI_HCD_PLATFORM) && \ !defined(CONFIG_USB_CHIPIDEA_HOST) && \ !defined(CONFIG_USB_EHCI_MXC) && \ + !defined(CONFIG_USB_EHCI_HCD_OMAP) && \ !defined(PLATFORM_DRIVER) && \ !defined(PS3_SYSTEM_BUS_DRIVER) && \ !defined(OF_PLATFORM_DRIVER) && \ Index: usb-3.7/drivers/usb/host/ehci-omap.c =================================================================== --- usb-3.7.orig/drivers/usb/host/ehci-omap.c +++ usb-3.7/drivers/usb/host/ehci-omap.c @@ -36,6 +36,9 @@ * - convert to use hwmod and runtime PM */ +#include +#include +#include #include #include #include @@ -44,6 +47,10 @@ #include #include #include +#include +#include + +#include "ehci.h" /* EHCI Register Set */ #define EHCI_INSNREG04 (0xA0) @@ -56,11 +63,13 @@ #define EHCI_INSNREG05_ULPI_EXTREGADD_SHIFT 8 #define EHCI_INSNREG05_ULPI_WRDATA_SHIFT 0 -/*-------------------------------------------------------------------------*/ +#define DRIVER_DESC = "OMAP-EHCI Host Controller driver"; -static const struct hc_driver ehci_omap_hc_driver; +static const char hcd_name[] = "ehci-omap"; +/*-------------------------------------------------------------------------*/ + static inline void ehci_write(void __iomem *base, u32 reg, u32 val) { __raw_writel(val, base + reg); @@ -165,6 +174,12 @@ static void disable_put_regulator( /* configure so an HC device and id are always provided */ /* always called with process context; sleeping is OK */ +static struct hc_driver __read_mostly ehci_omap_hc_driver; + +static const struct ehci_driver_overrides ehci_omap_overrides __initdata = { + .reset = omap_ehci_init, +}; + /** * ehci_hcd_omap_probe - initialize TI-based HCDs * @@ -322,56 +337,33 @@ static struct platform_driver ehci_hcd_o /*.suspend = ehci_hcd_omap_suspend, */ /*.resume = ehci_hcd_omap_resume, */ .driver = { - .name = "ehci-omap", + .name = hcd_name, } }; /*-------------------------------------------------------------------------*/ -static const struct hc_driver ehci_omap_hc_driver = { - .description = hcd_name, - .product_desc = "OMAP-EHCI Host Controller", - .hcd_priv_size = sizeof(struct ehci_hcd), - - /* - * generic hardware linkage - */ - .irq = ehci_irq, - .flags = HCD_MEMORY | HCD_USB2, - - /* - * basic lifecycle operations - */ - .reset = omap_ehci_init, - .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, +static int __init ehci_omap_init(void) +{ + if (usb_disabled()) + return -ENODEV; - /* - * scheduling support - */ - .get_frame_number = ehci_get_frame, + pr_info("%s: " DRIVER_DESC "\n", hcd_name); - /* - * 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, + ehci_init_driver(&ehci_omap_hc_driver, &ehci_omap_overrides); + return platform_driver_register(&ehci_omap_driver); +} +module_init(ehci_omap_init); - .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete, -}; +static void __exit ehci_omap_cleanup(void) +{ + platform_driver_unregister(&ehci_omap_driver); +} +module_exit(ehci_omap_cleanup); MODULE_ALIAS("platform:omap-ehci"); MODULE_AUTHOR("Texas Instruments, Inc."); MODULE_AUTHOR("Felipe Balbi "); +MODULE_DESCRIPTION(DRIVER_DESC); +MODULE_LICENSE("GPL");