[RFC] usb: ehci-hcd: add OF bindings

Peter Mamonov pmamonov at gmail.com
Thu Aug 27 09:48:31 PDT 2015


Signed-off-by: Peter Mamonov <pmamonov at gmail.com>
---
 drivers/usb/host/ehci-hcd.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 1146b71..ef555eb 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -940,12 +940,16 @@ static int ehci_probe(struct device_d *dev)
 {
 	struct ehci_data data = {};
 	struct ehci_platform_data *pdata = dev->platform_data;
+	struct device_node *dn = dev->device_node;
+	uint32_t flags;
 
 	/* default to EHCI_HAS_TT to not change behaviour of boards
 	 * without platform_data
 	 */
 	if (pdata)
 		data.flags = pdata->flags;
+	else if (dn && of_property_read_u32(dn, "flags", &flags) == 0)
+		data.flags = flags;
 	else
 		data.flags = EHCI_HAS_TT;
 
@@ -967,9 +971,18 @@ static void ehci_remove(struct device_d *dev)
 	ehci_halt(ehci);
 }
 
+static __maybe_unused struct of_device_id ehci_platform_dt_ids[] = {
+	{
+		.compatible = "generic-ehci",
+	}, {
+		/* sentinel */
+	}
+};
+
 static struct driver_d ehci_driver = {
 	.name  = "ehci",
 	.probe = ehci_probe,
 	.remove = ehci_remove,
+	.of_compatible = DRV_OF_COMPAT(ehci_platform_dt_ids),
 };
 device_platform_driver(ehci_driver);
-- 
2.1.4




More information about the barebox mailing list