mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* Re: [RFC] usb: ehci-hcd: add OF bindings
@ 2015-08-28 11:06 Peter Mamonov
  2015-09-04  6:06 ` Sascha Hauer
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Mamonov @ 2015-08-28 11:06 UTC (permalink / raw)
  To: barebox, s.hauer; +Cc: Peter Mamonov

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

diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 1146b71..1077ac4 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -940,13 +940,18 @@ 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;
 
-	/* default to EHCI_HAS_TT to not change behaviour of boards
-	 * without platform_data
-	 */
 	if (pdata)
 		data.flags = pdata->flags;
-	else
+	else if (dn) {
+		data.flags = 0;
+		if (of_property_read_bool(dn, "has-transaction-translator"))
+			data.flags |= EHCI_HAS_TT;
+	} else
+		/* default to EHCI_HAS_TT to not change behaviour of boards
+		 * without platform_data
+		 */
 		data.flags = EHCI_HAS_TT;
 
 	data.hccr = dev_request_mem_region(dev, 0);
@@ -967,9 +972,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


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC] usb: ehci-hcd: add OF bindings
  2015-08-28 11:06 [RFC] usb: ehci-hcd: add OF bindings Peter Mamonov
@ 2015-09-04  6:06 ` Sascha Hauer
  0 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2015-09-04  6:06 UTC (permalink / raw)
  To: Peter Mamonov; +Cc: barebox

On Fri, Aug 28, 2015 at 02:06:25PM +0300, Peter Mamonov wrote:
> Signed-off-by: Peter Mamonov <pmamonov@gmail.com>
> ---
>  drivers/usb/host/ehci-hcd.c | 22 ++++++++++++++++++----
>  1 file changed, 18 insertions(+), 4 deletions(-)

Applied, thanks

Sascha


-- 
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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC] usb: ehci-hcd: add OF bindings
  2015-08-27 16:48 Peter Mamonov
@ 2015-08-27 19:41 ` Sascha Hauer
  0 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2015-08-27 19:41 UTC (permalink / raw)
  To: Peter Mamonov; +Cc: barebox

On Thu, Aug 27, 2015 at 07:48:31PM +0300, Peter Mamonov wrote:
> Signed-off-by: Peter Mamonov <pmamonov@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;

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

-- 
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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [RFC] usb: ehci-hcd: add OF bindings
@ 2015-08-27 16:48 Peter Mamonov
  2015-08-27 19:41 ` Sascha Hauer
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Mamonov @ 2015-08-27 16:48 UTC (permalink / raw)
  To: barebox; +Cc: Peter Mamonov

Signed-off-by: Peter Mamonov <pmamonov@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


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-09-04  6:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-28 11:06 [RFC] usb: ehci-hcd: add OF bindings Peter Mamonov
2015-09-04  6:06 ` Sascha Hauer
  -- strict thread matches above, loose matches on Subject: below --
2015-08-27 16:48 Peter Mamonov
2015-08-27 19:41 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox