Skip to contentSkip to conversation

usb: ehci-hcd: add OF bindings

RFC In review Peter Mamonov 2 participants 2 messages Aug 27, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

RFC 1/1 usb: ehci-hcd: add OF bindings

---
 drivers/usb/host/ehci-hcd.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
drivers/usb/host/ehci-hcd.c +13 -0
index 1146b71..ef555eb 100644
@@ -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);
Signature · 7 lines
2.1.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#1 lore raw
Quoted 13 lines · Peter Mamonov
---
 drivers/usb/host/ehci-hcd.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
drivers/usb/host/ehci-hcd.c +0 -0
index 1146b71..ef555eb 100644
@@ -940,12 +940,16 @@ static int ehci_probe(struct device_d *dev)
 {
 	struct ehci_data data = {};
 	struct ehci_platform_data *pdata = dev->platform_data;

drivers/usb/host/ehci-hcd.c static int ehci_probe(struct device_d *dev) · line 952

Quoted 10 lines
drivers/usb/host/ehci-hcd.c +4 -0
+	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;

Shouldn't you check the has-transaction-translator boolean property instead? That's what documented in dts/Bindings/usb/usb-ehci.txt

Otherwise looks good.

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox