On Mon, Jun 17, 2013 at 05:13:33PM +0200, Sebastian Andrzej Siewior wrote: > If we specify right now more than once instance then we attempt to add > the platform device twice. The nop driver does not mind the second add > because it checks for it and returns without a word. At removal time a > segfault is likely because the first intance clean ups the phy and > second, well, goes boom. > This patchs adds two dummy device node to the am33xx for the dummy phy > which we have now. During probe time, we grab the phy based on the > device node if we have one. If not, we use the same hack we used so far. > > Signed-off-by: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx> > --- > arch/arm/boot/dts/am33xx.dtsi | 8 ++++++++ > drivers/usb/musb/musb_dsps.c | 18 +++++++++++++----- > include/linux/usb/musb.h | 1 + > 3 files changed, 22 insertions(+), 5 deletions(-) > > diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi > index 8e1248f..30d0d45 100644 > --- a/arch/arm/boot/dts/am33xx.dtsi > +++ b/arch/arm/boot/dts/am33xx.dtsi > @@ -341,6 +341,14 @@ > port1-mode = <3>; > power = <250>; > ti,hwmods = "usb_otg_hs"; > + phys = <&nopphy0 &nopphy1>; > + }; > + > + nopphy0: usbphy@0 { > + compatible = "usb-nop-xceiv"; > + }; > + nopphy1: usbphy@1 { > + compatible = "usb-nop-xceiv"; > }; > > mac: ethernet@4a100000 { > diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c > index e1b661d..d9ff390 100644 > --- a/drivers/usb/musb/musb_dsps.c > +++ b/drivers/usb/musb/musb_dsps.c > @@ -415,9 +415,14 @@ static int dsps_musb_init(struct musb *musb) > /* mentor core register starts at offset of 0x400 from musb base */ > musb->mregs += wrp->musb_core_offset; > > - /* NOP driver needs change if supporting dual instance */ > - usb_nop_xceiv_register(); > - musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2); > + if (!glue->dev->of_node) { > + /* This hack works only for a single instance. */ > + usb_nop_xceiv_register(); > + musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2); I think you can drop this altogether, am335x is DT-only anyway :-) > + } else { > + musb->xceiv = devm_usb_get_phy_by_phandle(glue->dev, "phys", > + musb->config->instance); > + } after doing all this, perhaps we should re-factor phy_get into musb_core.c, so that we can remove this sort of support from all glue layers. -- balbi
Attachment:
signature.asc
Description: Digital signature