Re: [PATCH v2 1/3] USB: Add driver for NXP ISP1301 USB transceiver

From: Arnd Bergmann
Date: Mon Apr 16 2012 - 10:14:43 EST


On Monday 16 April 2012, Roland Stigge wrote:
> This very-lowlevel driver registers the NXP ISP1301 chip via the I2C subsystem.
> The chip is the USB transceiver shared by ohci-nxp, lpc32xx_udc (gadget) and
> isp1301_omap.
>
> Following patches let the respective USB host and gadget drivers use this
> driver, instead of duplicating ISP1301 handling.
>
> Signed-off-by: Roland Stigge <stigge@xxxxxxxxx>

All three patches:

Acked-by: Arnd Bergmann <arnd@xxxxxxxx>

> This driver needs to be probe()d before the respective USB driver using it. For
> modules, this is handled via the module dependency. When linking statically, it
> is done via linking order in the Makefile (misc/ before host/ and the gadget/).

You can easily avoid the link order restriction now by returning -EPROBE_DEFER
from the probe function of the device that needs this one.

> Currently, only one ISP1301 chip is supported. To support multiple instances,
> we would need a mechanism to identify the respective chips via DT (and static
> resources or platform data) to be referenced by the higher level USB driver at
> isp1301_get_client(). Any suggestions?

Put a phandle into the usb device node, like:

isp1301: usb-transceiver@23 {
compatible = "nxp,isp1301";
reg = <23>;
};

usbd@31020000 {
compatible = "nxp,lpc32xx-udc";
reg = <0x31020000 0x300>;
interrupt-parent = <&mic>;
interrupts = <0x3d 0>, <0x3e 0>, <0x3c 0>, <0x3a 0>;
transceiver = <&isp1301>;
status = "disable";
};

Then add a device_node argument to the isp1301_get_client() function
and change the function to use bus_find_device() with a match function
that compares the driver pointer.

Alternatively (and much more complex), you could add a generic usb-transceiver
abstraction that does this and also hides the register accesses behind
hardware independent function calls.

Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/