diff mbox series

[2/2] USB: gadget: pxa25x: Add DT probing

Message ID 20190202235908.30751-2-linus.walleij@linaro.org (mailing list archive)
State New, archived
Headers show
Series [1/2] USB: gadget: pxa25x: Add DT bindings | expand

Commit Message

Linus Walleij Feb. 2, 2019, 11:59 p.m. UTC
This makes it possible to instantiate the PXA25x UDC
driver from the device tree.

Cc: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/usb/gadget/udc/pxa25x_udc.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Robert Jarzmik Feb. 6, 2019, 9:31 p.m. UTC | #1
Linus Walleij <linus.walleij@linaro.org> writes:

> This makes it possible to instantiate the PXA25x UDC
> driver from the device tree.
>
> Cc: Robert Jarzmik <robert.jarzmik@free.fr>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
>  drivers/usb/gadget/udc/pxa25x_udc.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)

Mmmh it's a good start, but I don't think it's complete.
The kind of errors that bother me are lines such as :
> static int pxa25x_udc_probe(struct platform_device *pdev)
> ...
>	if (gpio_is_valid(dev->mach->gpio_pullup)) {
I think this will be a NULL deref and kernel crash ...

From memory this driver relies on an always filled mach platform_data structure,
so the port to devicetree should be a bit more painful.

This makes me think that either :
 - you have not run tested the patch
 - or I'm late in the last patches and I'm missing some information

Cheers.

--
Robert
diff mbox series

Patch

diff --git a/drivers/usb/gadget/udc/pxa25x_udc.c b/drivers/usb/gadget/udc/pxa25x_udc.c
index d4be53559f2e..480828b76059 100644
--- a/drivers/usb/gadget/udc/pxa25x_udc.c
+++ b/drivers/usb/gadget/udc/pxa25x_udc.c
@@ -2529,6 +2529,16 @@  static int pxa25x_udc_resume(struct platform_device *dev)
 
 /*-------------------------------------------------------------------------*/
 
+static const struct of_device_id udc_of_match[] = {
+	{
+		.compatible = "intel,ixp4xx-udc",
+	},
+	{
+		.compatible = "marvell,pxa25x-udc",
+	},
+	{},
+};
+
 static struct platform_driver udc_driver = {
 	.shutdown	= pxa25x_udc_shutdown,
 	.probe		= pxa25x_udc_probe,
@@ -2537,6 +2547,7 @@  static struct platform_driver udc_driver = {
 	.resume		= pxa25x_udc_resume,
 	.driver		= {
 		.name	= "pxa25x-udc",
+		.of_match_table = of_match_ptr(udc_of_match),
 	},
 };