From patchwork Fri Mar 15 17:00:26 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 2279771 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 EC291DF24C for ; Fri, 15 Mar 2013 17:03:44 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UGY0F-00089F-Sf; Fri, 15 Mar 2013 17:01:11 +0000 Received: from moutng.kundenserver.de ([212.227.126.186]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UGY0C-00088b-Cb for linux-arm-kernel@lists.infradead.org; Fri, 15 Mar 2013 17:01:09 +0000 Received: from klappe2.localnet (HSI-KBW-46-223-90-92.hsi.kabel-badenwuerttemberg.de [46.223.90.92]) by mrelayeu.kundenserver.de (node=mrbap4) with ESMTP (Nemesis) id 0M3SaW-1UYDMt17mC-00rLQQ; Fri, 15 Mar 2013 18:00:31 +0100 From: Arnd Bergmann To: Alan Stern Subject: Re: [RFC] USB: EHCI: hot-fix OMAP and Orion multiplatform config Date: Fri, 15 Mar 2013 17:00:26 +0000 User-Agent: KMail/1.12.2 (Linux/3.8.0-8-generic; KDE/4.3.2; x86_64; ; ) References: In-Reply-To: MIME-Version: 1.0 Message-Id: <201303151700.27231.arnd@arndb.de> X-Provags-ID: V02:K0:IJE+FzTKPWTCRfhzc8TDIcDzioQlWrMhBF6RmuM8HZn wL0csKMz78LvIeRaPMy08y0FPjZcamVU+bKJorm2CRrhKa6lWt MKF7l/c7vTPX+MBLFtB1dbB8bSfZgp1v8Hv+0x2y9eHa6t2s43 qOktk2LqH4rCcpsY9Xxcq9YnFyjpyreMv8z5G9lhy8NwdU4hSL eg8fVVW/Ss4n6HBnNgqN0CRnaan0jeSCjHRdGFj/iwieH/Hkou L69/dJFFzFJg+wbCL6vEkE1XLdw81DtUqXtEmNcjqFjfGvQri8 qNHyw7hYdCqscQE+x/mZ4vBDqKmAsr/m9hj2lwU+yjr1uZb8p0 DQXH5OnT+7sfdEJLA6PA= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130315_130108_700944_B5DD91D8 X-CRM114-Status: GOOD ( 21.97 ) 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 ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [212.227.126.186 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Andrew Lunn , Jason Cooper , patches@linaro.org, Greg Kroah-Hartman , Manjunath Goudar , USB list , Alexey Charkov , linux-arm-kernel@lists.infradead.org, Roger Quadros X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org On Friday 15 March 2013, Alan Stern wrote: > Roger just submitted my patch to split out ehci-omap. Ok, if we can merge that for 3.9, the main issue will be resolved, because an OMAP+Orion config is much more interesting in practice than adding VT8500 to the mix. An alternative for VT8500 would be to remove drivers/usb/host/ehci-vt8500.c completely and use the generic ehci-platform.c bus glue with added DT support, as the patch below that I just hacked up. Not sure if that anyone would prefer that over the hot-fix for 3.9, but it's possibly a better solution in the long run. > What happened to Manjunath Goudar? I haven't heard from him since his > first round of submissions a month ago. Fixing them up shouldn't be > too much work. He's still around and working on his patches for 3.10. I'm currently working with him to resolve a few of the remaining problems in his series and he will post the lot soon. > As far as I can tell, your scheme should be okay for now. It would be > good to hear from other people, though. > > I'd guess that the only reason it wasn't done this way from the > beginning is that nobody considered the possibility of building a > multi-platform driver. Right. It's been a long way until it became possible on ARM. The four PowerPC bus glues have already been mutually exclusive like this all the time. Arnd diff --git a/drivers/usb/host/ehci-platform.c b/drivers/usb/host/ehci-platform.c index ca75063..2e4ddd4 100644 --- a/drivers/usb/host/ehci-platform.c +++ b/drivers/usb/host/ehci-platform.c @@ -18,11 +18,13 @@ * * Licensed under the GNU/GPL. See COPYING for details. */ +#include #include #include #include #include #include +#include #include #include #include @@ -41,17 +43,21 @@ static int ehci_platform_reset(struct usb_hcd *hcd) struct ehci_hcd *ehci = hcd_to_ehci(hcd); int retval; - hcd->has_tt = pdata->has_tt; - ehci->has_synopsys_hc_bug = pdata->has_synopsys_hc_bug; - ehci->big_endian_desc = pdata->big_endian_desc; - ehci->big_endian_mmio = pdata->big_endian_mmio; + ehci->caps = hcd->regs; + + if (pdata) { + hcd->has_tt = pdata->has_tt; + ehci->has_synopsys_hc_bug = pdata->has_synopsys_hc_bug; + ehci->big_endian_desc = pdata->big_endian_desc; + ehci->big_endian_mmio = pdata->big_endian_mmio; + ehci->caps += pdata->caps_offset; + } - ehci->caps = hcd->regs + pdata->caps_offset; retval = ehci_setup(hcd); if (retval) return retval; - if (pdata->no_io_watchdog) + if (pdata && pdata->no_io_watchdog) ehci->need_io_watchdog = 0; return 0; } @@ -70,11 +76,6 @@ static int ehci_platform_probe(struct platform_device *dev) int irq; int err = -ENOMEM; - if (!pdata) { - WARN_ON(1); - return -ENODEV; - } - if (usb_disabled()) return -ENODEV; @@ -89,12 +90,17 @@ static int ehci_platform_probe(struct platform_device *dev) return -ENXIO; } - if (pdata->power_on) { + if (pdata && pdata->power_on) { err = pdata->power_on(dev); if (err < 0) return err; } + if (!dev->dev.dma_mask) { + dev->dev.dma_mask = &dev->dev.coherent_dma_mask; + dev->dev.coherent_dma_mask = DMA_BIT_MASK(32); + } + hcd = usb_create_hcd(&ehci_platform_hc_driver, &dev->dev, dev_name(&dev->dev)); if (!hcd) { @@ -121,7 +127,7 @@ static int ehci_platform_probe(struct platform_device *dev) err_put_hcd: usb_put_hcd(hcd); err_power: - if (pdata->power_off) + if (pdata && pdata->power_off) pdata->power_off(dev); return err; @@ -136,7 +142,7 @@ static int ehci_platform_remove(struct platform_device *dev) usb_put_hcd(hcd); platform_set_drvdata(dev, NULL); - if (pdata->power_off) + if (pdata && pdata->power_off) pdata->power_off(dev); return 0; @@ -155,7 +161,7 @@ static int ehci_platform_suspend(struct device *dev) ret = ehci_suspend(hcd, do_wakeup); - if (pdata->power_suspend) + if (pdata && pdata->power_suspend) pdata->power_suspend(pdev); return ret; @@ -168,7 +174,7 @@ static int ehci_platform_resume(struct device *dev) struct platform_device *pdev = container_of(dev, struct platform_device, dev); - if (pdata->power_on) { + if (pdata && pdata->power_on) { int err = pdata->power_on(pdev); if (err < 0) return err; @@ -183,6 +189,12 @@ static int ehci_platform_resume(struct device *dev) #define ehci_platform_resume NULL #endif /* CONFIG_PM */ +static const struct of_device_id vt8500_ehci_ids[] = { + { .compatible = "via,vt8500-ehci", }, + { .compatible = "wm,prizm-ehci", }, + {} +}; + static const struct platform_device_id ehci_platform_table[] = { { "ehci-platform", 0 }, { } @@ -203,6 +215,7 @@ static struct platform_driver ehci_platform_driver = { .owner = THIS_MODULE, .name = "ehci-platform", .pm = &ehci_platform_pm_ops, + .of_match_table = of_match_ptr(vt8500_ehci_ids), } };