Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1577640

[PATCH 1/3 v2] usb: host: fotg2: add device tree probing

From Hans Ulli Kroll <ulli.kroll@googlemail.com>
Newsgroups linux.kernel
Subject [PATCH 1/3 v2] usb: host: fotg2: add device tree probing
Date 2017-02-09 15:30 +0100
Message-ID <t8XTr-7gc-7@gated-at.bofh.it> (permalink)
References <t8GSB-4S1-7@gated-at.bofh.it> <t8HbY-4Z7-33@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Add device tree probe for fotg2 driver

v2:
fix in wrong MODULE_DEVICE_TABLE

Signed-off-by: Hans Ulli Kroll <ulli.kroll@googlemail.com>
---
 drivers/usb/host/fotg210-hcd.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/drivers/usb/host/fotg210-hcd.c b/drivers/usb/host/fotg210-hcd.c
index 9d0b0518290a..2acc51b0be5a 100644
--- a/drivers/usb/host/fotg210-hcd.c
+++ b/drivers/usb/host/fotg210-hcd.c
@@ -23,6 +23,7 @@
  * Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 #include <linux/module.h>
+#include <linux/of.h>
 #include <linux/device.h>
 #include <linux/dmapool.h>
 #include <linux/kernel.h>
@@ -5600,6 +5601,15 @@ static int fotg210_hcd_probe(struct platform_device *pdev)
 	if (usb_disabled())
 		return -ENODEV;
 
+	/* Right now device-tree probed devices don't get dma_mask set.
+	 * Since shared usb code relies on it, set it here for now.
+	 * Once we have dma capability bindings this can go away.
+	 */
+
+	retval = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
+	if (retval)
+		goto fail_create_hcd;
+
 	pdev->dev.power.power_state = PMSG_ON;
 
 	res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
@@ -5676,9 +5686,18 @@ static int fotg210_hcd_remove(struct platform_device *pdev)
 	return 0;
 }
 
+#ifdef CONFIG_OF
+static const struct of_device_id fotg210_ehci_match[] = {
+	{ .compatible = "faraday,fotg210-hcd" },
+	{},
+};
+MODULE_DEVICE_TABLE(of, fotg210_ehci_match);
+#endif
+
 static struct platform_driver fotg210_hcd_driver = {
 	.driver = {
 		.name   = "fotg210-hcd",
+		.of_match_table = of_match_ptr(fotg210_ehci_match),
 	},
 	.probe  = fotg210_hcd_probe,
 	.remove = fotg210_hcd_remove,
-- 
2.11.0

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/3] usb: add device tree support for fotg2-hcd driver Hans Ulli Kroll <ulli.kroll@googlemail.com> - 2017-02-08 21:20 +0100
  [PATCH 1/3] usb: host: fotg2: add devicetree probing Hans Ulli Kroll <ulli.kroll@googlemail.com> - 2017-02-08 21:40 +0100
    Re: [PATCH 1/3] usb: host: fotg2: add devicetree probing kbuild test robot <lkp@intel.com> - 2017-02-09 05:30 +0100
    [PATCH 1/3 v2] usb: host: fotg2: add device tree probing Hans Ulli Kroll <ulli.kroll@googlemail.com> - 2017-02-09 15:30 +0100
      Re: [PATCH 1/3 v2] usb: host: fotg2: add device tree probing Linus Walleij <linus.walleij@linaro.org> - 2017-02-10 14:20 +0100
        Re: [PATCH 1/3 v2] usb: host: fotg2: add device tree probing Arnd Bergmann <arnd@arndb.de> - 2017-02-10 21:30 +0100
      Re: [PATCH 1/3 v2] usb: host: fotg2: add device tree probing Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-10 14:40 +0100
  Re: [PATCH 0/3] usb: add device tree support for fotg2-hcd driver Linus Walleij <linus.walleij@linaro.org> - 2017-02-10 14:30 +0100

csiph-web