Skip to contentSkip to conversation

emxx_udc device tree bindings

DISCUSSION Arkadiusz Lis 2 participants 2 messages Sep 20, 2018

lore
Share & tools
lore
#0 lore raw

Hi all,
I would like to help getting emxx_udc driver out of staging.
One of the things to do is to adjust it to using device tree.
The bindings are not defined yet. I have a blurred idea what properties are needed however I've never done it and your support and comments will be really appreciated.

So, the drivers usually need the 'compatible' property with the manufacturer and device name, so it is probably needed here as well.

According to Documentation/driver-api/gpio/board.rst,
to use gpio consumer interface (also on TODO list), '<function>-gpios' property will be required. '<function>' is the name that is referenced in the driver to obtain the gpio via gpiod_get(). Linus Walleij proposed 'vbus-gpios'.

IRQs are also used in this driver: USB_UDC_IRQ_1 and INT_VBUS, it seems that 'interrupts' property will also be required.

Also memory region is mapped in the probe function.

	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
	mmio_base = devm_ioremap_resource(&pdev->dev, r);

Maybe 'reg' property can be used to describe physical base address and size of register map? What are your suggestions?

Thanks for help,
Arek

#1 lore raw

I don't know about device tree...

There a bunch of easy aesthetic things one could do.

1) Get rid of forward declarations. (I haven't looked if this is easy).
2) Remove underscore prefixes from names.
3) Fix the comments. (Delete most of them).
4) pr_info("=== %s()\n", __func__); <-- delete useles prints
5) Clean up the strange white space.
6) Also it's a bad idea to try to align declarations inside a .c file. That's fine for struct declarations in a .h file but in a .c file we mess with stuff too much. You need to change all the declarations to make them line up but it's not really related to the patch so you're not allowed to change them. Catch-22.

In other words change:
- int result = -EINVAL;
+ int result = -EINVAL;
7) Remove pointless NULL checks:

	ep = container_of(_ep, struct nbu2ss_ep, ep);
	if (!ep) {

We already know the _ep is non-NULL so that means container_of() can't be NULL.

regards,
dan carpenter