On Thu, Feb 16, 2012 at 2:00 PM, Ramneek Mehresh <ramneek.mehresh@xxxxxxxxxxxxx> wrote: > Add support for ULPI and UTMI PHYs based on usb controller version info > read from device-tree > > Example of USB Controller versioning info: > Version 1.2 and below : MPC8536, MPC8315, etc > Version 1.6 : P1020, P1010, P2020, etc > Version 2.2 : PSC9131, PSC9132, P3060, etc > > No changes for non-DT users > > Signed-off-by: Ramneek Mehresh <ramneek.mehresh@xxxxxxxxxxxxx> > --- > Changes for v4: > - removed drivers/usb/host/fsl directory > - moved usb_get_ver_info() from fsl_usb.h file to > include/linux/fsl_devices.h > - replaced printk() with dev_warn() > > Top commit > commit 5407a3c3d942e75d4d123d213fd692bce5acc961 > Author: Felipe Balbi <balbi@xxxxxx> > Date: Wed Feb 15 09:34:26 2012 +0200 > > Hi Peter, could you please help me test this patch in IMX platform > > drivers/usb/gadget/fsl_udc_core.c | 24 +++++++++++++++++++++- > drivers/usb/gadget/fsl_usb2_udc.h | 13 ++++++++++++ > drivers/usb/host/ehci-fsl.c | 35 +++++++++++++++++++++++++++----- > drivers/usb/host/ehci-fsl.h | 13 +++++++++++- > include/linux/fsl_devices.h | 39 ++++++++++++++++++++++++++++++++++++- > 5 files changed, 115 insertions(+), 9 deletions(-) > [snip] > @@ -135,4 +139,37 @@ int fsl_deep_sleep(void); > static inline int fsl_deep_sleep(void) { return 0; } > #endif > > +static inline int usb_get_ver_info(void) > +{ > + struct device_node *np; > + int ver = -1; > + > + /* > + * returns 1 for usb controller version 1.6 > + * returns 2 for usb controller version 2.2 > + * returns 0 otherwise > + */ > + for_each_compatible_node(np, NULL, "fsl-usb2-dr") { > + if (of_device_is_compatible(np, "fsl-usb2-dr-v1.6")) > + ver = 1; > + else if (of_device_is_compatible(np, "fsl-usb2-dr-v2.2")) > + ver = 2; > + else /* for previous controller versions/non-dt users */ > + ver = 0; > + } > + > + if (ver > -1) > + return ver; > + > + for_each_compatible_node(np, NULL, "fsl-usb2-mph") { > + if (of_device_is_compatible(np, "fsl-usb2-mph-v1.6")) > + ver = 1; > + else if (of_device_is_compatible(np, "fsl-usb2-mph-v2.2")) > + ver = 2; > + else /* for previous controller versions/non-dt users */ > + ver = 0; > + } > + > + return ver; You could get the wrong answer if we have both mph and dr on the same chip while they have different versions. I think the best way is to pass in the specific device node to be checked. - Leo -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html