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: 15385 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 8808B23E3E for ; Fri, 15 Mar 2013 17:01:12 +0000 (UTC) Received: from mail-vc0-f172.google.com (mail-vc0-f172.google.com [209.85.220.172]) by fiordland.canonical.com (Postfix) with ESMTP id 2556CA1888C for ; Fri, 15 Mar 2013 17:01:12 +0000 (UTC) Received: by mail-vc0-f172.google.com with SMTP id hr11so1415241vcb.17 for ; Fri, 15 Mar 2013 10:01:11 -0700 (PDT) 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:subject:date:user-agent:cc:references :in-reply-to:mime-version:content-type:content-transfer-encoding :message-id:x-provags-id:x-gm-message-state; bh=cCdI5lRg8k5GaAjvjlybhK3RNkqXeaU7IQnXzv2rX74=; b=hgmZNZOkFoUTcWvTtmr06aom9GeSUWvO9nbOwy/NNv6DqgStY1xspCLiFPEmhyDLIe AmCwz+4OY4iKW8NpEL9d+zQ7XsaDguUM2yu85xd8P45A7nmnE4FJnvmInTu5WaaC8P6a tMKywL0y8Ic0gtTX80AxpJeT48SG+vons/L/3Fam/QoqHahw0p4xBCbuobO9hmOQ0Y4+ iCHTvxUeO2M/rxFTC9kfl+ITw0yzedONu79wuqh2zG5OyFcoe8ZRUZOE6jV4RCoYrCyC 3pwrw++/yAH6+LZtfhlrCthxwCbepzst0JriIG50Sm32STwuYn+wNSIF4jDaERknASlT ZbRQ== X-Received: by 10.58.181.201 with SMTP id dy9mr8176073vec.34.1363366871586; Fri, 15 Mar 2013 10:01:11 -0700 (PDT) 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.58.127.98 with SMTP id nf2csp129845veb; Fri, 15 Mar 2013 10:01:10 -0700 (PDT) X-Received: by 10.14.110.68 with SMTP id t44mr19932750eeg.25.1363366870373; Fri, 15 Mar 2013 10:01:10 -0700 (PDT) Received: from moutng.kundenserver.de (moutng.kundenserver.de. [212.227.126.186]) by mx.google.com with ESMTPS id v44si12631670eep.140.2013.03.15.10.01.09 (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 15 Mar 2013 10:01:10 -0700 (PDT) Received-SPF: neutral (google.com: 212.227.126.186 is neither permitted nor denied by best guess record for domain of arnd@arndb.de) client-ip=212.227.126.186; Authentication-Results: mx.google.com; spf=neutral (google.com: 212.227.126.186 is neither permitted nor denied by best guess record for domain of arnd@arndb.de) smtp.mail=arnd@arndb.de 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; ; ) Cc: Manjunath Goudar , USB list , linux-arm-kernel@lists.infradead.org, patches@linaro.org, "Greg Kroah-Hartman" , Roger Quadros , Andrew Lunn , Jason Cooper , Alexey Charkov 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-Gm-Message-State: ALoCoQkIdGtegagyLSma9yB53I2RC/+yKQogUCsf5PV5BKXbmaZoP1YrepLmAIw+5DGYI7J81b8g 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), } };