diff mbox

[15/67] usb: gadget: pxa27x_udc: add devicetree support

Message ID 1413566234-13537-16-git-send-email-balbi@ti.com
State Accepted
Commit 1803fe15ad54e68aae8b2b44e04a635e9b5d52f2
Headers show

Commit Message

Felipe Balbi Oct. 17, 2014, 5:16 p.m. UTC
From: Robert Jarzmik <robert.jarzmik@free.fr>

Add support for device-tree device discovery. If devicetree is not
provided, fallback to legacy platform data "discovery".

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Cc: devicetree@vger.kernel.org
Signed-off-by: Felipe Balbi <balbi@ti.com>
---
 drivers/usb/gadget/udc/pxa27x_udc.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Robert Jarzmik Oct. 17, 2014, 6:06 p.m. UTC | #1
Felipe Balbi <balbi@ti.com> writes:

Thanks Felipe.

Can I post now the remaining 3 patches of the partial serie, ie. :
 - usb: gadget: pxa27x_udc device-tree documentation
 - usb: gadget: pxa27x_udc: use devm_* helpers
 - usb: gadget: pxa27x_udc: fix clock prepare and enable

Do you want me to rebase against a specific tree to ensure everything is in
order ?

Cheers.

--
Robert
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Felipe Balbi Oct. 17, 2014, 6:19 p.m. UTC | #2
Hi,

On Fri, Oct 17, 2014 at 08:06:45PM +0200, Robert Jarzmik wrote:
> Felipe Balbi <balbi@ti.com> writes:
> 
> Thanks Felipe.
> 
> Can I post now the remaining 3 patches of the partial serie, ie. :
>  - usb: gadget: pxa27x_udc device-tree documentation
>  - usb: gadget: pxa27x_udc: use devm_* helpers
>  - usb: gadget: pxa27x_udc: fix clock prepare and enable

please do :-)

> Do you want me to rebase against a specific tree to ensure everything
> is in order ?

All these patches are in my testing/next. If you can rebase there and
make sure everything still works for you, I'd be very glad.

Please, make sure you can still properly load and unload gadget drivers
too ;-)

cheers
Robert Jarzmik Oct. 17, 2014, 7:08 p.m. UTC | #3
Felipe Balbi <balbi@ti.com> writes:

> Hi,
>
> On Fri, Oct 17, 2014 at 08:06:45PM +0200, Robert Jarzmik wrote:
>> Felipe Balbi <balbi@ti.com> writes:
>> 
>> Thanks Felipe.
>> 
>> Can I post now the remaining 3 patches of the partial serie, ie. :
>>  - usb: gadget: pxa27x_udc device-tree documentation
>>  - usb: gadget: pxa27x_udc: use devm_* helpers
>>  - usb: gadget: pxa27x_udc: fix clock prepare and enable
>
> please do :-)
Great, I'm on my way.

>> Do you want me to rebase against a specific tree to ensure everything
>> is in order ?
>
> All these patches are in my testing/next. If you can rebase there and
> make sure everything still works for you, I'd be very glad.
Ok, no problem.

> Please, make sure you can still properly load and unload gadget drivers
> too ;-)
Ah, I'd like to. The problem I have is that the only interaction I have with my
platform is through the USB UDC (I have no serial console available, and no
network).

I'll see if I can have a script in background to load/unload every other 1mn,
but I'm not sure this will work.

Cheers.
Felipe Balbi Oct. 17, 2014, 7:14 p.m. UTC | #4
On Fri, Oct 17, 2014 at 09:08:51PM +0200, Robert Jarzmik wrote:
> Felipe Balbi <balbi@ti.com> writes:
> 
> > Hi,
> >
> > On Fri, Oct 17, 2014 at 08:06:45PM +0200, Robert Jarzmik wrote:
> >> Felipe Balbi <balbi@ti.com> writes:
> >> 
> >> Thanks Felipe.
> >> 
> >> Can I post now the remaining 3 patches of the partial serie, ie. :
> >>  - usb: gadget: pxa27x_udc device-tree documentation
> >>  - usb: gadget: pxa27x_udc: use devm_* helpers
> >>  - usb: gadget: pxa27x_udc: fix clock prepare and enable
> >
> > please do :-)
> Great, I'm on my way.
> 
> >> Do you want me to rebase against a specific tree to ensure everything
> >> is in order ?
> >
> > All these patches are in my testing/next. If you can rebase there and
> > make sure everything still works for you, I'd be very glad.
> Ok, no problem.
> 
> > Please, make sure you can still properly load and unload gadget drivers
> > too ;-)
> Ah, I'd like to. The problem I have is that the only interaction I have with my
> platform is through the USB UDC (I have no serial console available, and no
> network).
> 
> I'll see if I can have a script in background to load/unload every other 1mn,
> but I'm not sure this will work.

so you're using g_serial ? I guess you can:

# echo disconnect > /sys/class/udc/$UDC/soft_connect && sleep 1 && \
	echo connect > /sys/class/udc/$UDC/soft_connect

I think that should work ;-)
diff mbox

Patch

diff --git a/drivers/usb/gadget/udc/pxa27x_udc.c b/drivers/usb/gadget/udc/pxa27x_udc.c
index 5280f64..55598c0 100644
--- a/drivers/usb/gadget/udc/pxa27x_udc.c
+++ b/drivers/usb/gadget/udc/pxa27x_udc.c
@@ -27,6 +27,8 @@ 
 #include <linux/prefetch.h>
 #include <linux/byteorder/generic.h>
 #include <linux/platform_data/pxa2xx_udc.h>
+#include <linux/of_device.h>
+#include <linux/of_gpio.h>
 
 #include <linux/usb.h>
 #include <linux/usb/ch9.h>
@@ -2400,6 +2402,12 @@  static struct pxa_udc memory = {
 	}
 };
 
+static struct of_device_id udc_pxa_dt_ids[] = {
+	{ .compatible = "marvell,pxa270-udc" },
+	{}
+};
+MODULE_DEVICE_TABLE(of, udc_pxa_dt_ids);
+
 /**
  * pxa_udc_probe - probes the udc device
  * @_dev: platform device
@@ -2427,6 +2435,8 @@  static int pxa_udc_probe(struct platform_device *pdev)
 			udc->gpiod = gpio_to_desc(mach->gpio_pullup);
 		}
 		udc->udc_command = mach->udc_command;
+	} else {
+		udc->gpiod = devm_gpiod_get(&pdev->dev, NULL);
 	}
 
 	regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -2618,6 +2628,7 @@  static struct platform_driver udc_driver = {
 	.driver		= {
 		.name	= "pxa27x-udc",
 		.owner	= THIS_MODULE,
+		.of_match_table = of_match_ptr(udc_pxa_dt_ids),
 	},
 	.probe		= pxa_udc_probe,
 	.remove		= pxa_udc_remove,