Message ID | 1346943430-18236-3-git-send-email-kishon@ti.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
2012/9/6 Kishon Vijay Abraham I <kishon@ti.com>: > All the PHY configuration other than VBUS, ID GND and OTG SRP are removed > from twl6030. The phy configurations are taken care by the dedicated > usb2 phy driver. So twl6030 is made as comparator driver for VBUS and > ID detection. > > Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> USB doesn't work on pandaboard on linux-next, and bisection shows this patch. Unfortunately, I can't provide a dmesg log because USB is the only way I currently have to get one out(!), but presumably it's because this omap-usb2 device is never registered? Looks like this breaks non-dt USB on pandaboard; is that intended? (I see that current linux-next doesn't have USB support even in pandaboard DT, but I see patches for that on the lists)
Hi, On Sat, Sep 22, 2012 at 3:03 AM, Rabin Vincent <rabin@rab.in> wrote: > 2012/9/6 Kishon Vijay Abraham I <kishon@ti.com>: >> All the PHY configuration other than VBUS, ID GND and OTG SRP are removed >> from twl6030. The phy configurations are taken care by the dedicated >> usb2 phy driver. So twl6030 is made as comparator driver for VBUS and >> ID detection. >> >> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> > > USB doesn't work on pandaboard on linux-next, and bisection shows this > patch. Unfortunately, I can't provide a dmesg log because USB is the > only way I currently have to get one out(!), but presumably it's because > this omap-usb2 device is never registered? Looks like this breaks > non-dt USB on pandaboard; is that intended? Yes. omap-usb2 is *only* dt supported (New drivers shouldn't have the old non-dt support). Some patches are queued only for 3.7. In case you want to use MUSB please use these patches on linux-next.. [PATCH v2] arm: omap: hwmod: make *phy_48m* as the main_clk of ocp2scp [PATCH] ARM: OMAP2+: hwmod data: Fix ocp2scp_usb_phy and usb_host_hs entries (from Benoit) [PATCH 0/2] ARM: dts: Add subnode for ocp2scp (patch series) [PATCH v3 0/3] ARM: dts: omap: add dt data for MUSB (patch series) Pls note all these patches are queued for 3.7 Thanks Kishon
2012/9/24 ABRAHAM, KISHON VIJAY <kishon@ti.com>: > On Sat, Sep 22, 2012 at 3:03 AM, Rabin Vincent <rabin@rab.in> wrote: >> USB doesn't work on pandaboard on linux-next, and bisection shows this >> patch. Unfortunately, I can't provide a dmesg log because USB is the >> only way I currently have to get one out(!), but presumably it's because >> this omap-usb2 device is never registered? Looks like this breaks >> non-dt USB on pandaboard; is that intended? > > Yes. omap-usb2 is *only* dt supported (New drivers shouldn't have the > old non-dt support). Well, USB used to work fine on Pandaboard without DT before the introduction of "omap-usb2", so one would expected it to continue working (until the board file is completely removed). Anyway, I've moved to DT now. > Some patches are queued only for 3.7. > > In case you want to use MUSB please use these patches on linux-next.. > [PATCH v2] arm: omap: hwmod: make *phy_48m* as the main_clk of ocp2scp > [PATCH] ARM: OMAP2+: hwmod data: Fix ocp2scp_usb_phy and usb_host_hs > entries (from Benoit) > [PATCH 0/2] ARM: dts: Add subnode for ocp2scp (patch series) > [PATCH v3 0/3] ARM: dts: omap: add dt data for MUSB (patch series) I got these by merging in Benoit's for_3.7/dts_part2 on top of next-20120921. Thanks.
Hi Kishon & Benoit, On 09/24/2012 12:06 PM, Rabin Vincent wrote: > 2012/9/24 ABRAHAM, KISHON VIJAY <kishon@ti.com>: >> On Sat, Sep 22, 2012 at 3:03 AM, Rabin Vincent <rabin@rab.in> wrote: >>> USB doesn't work on pandaboard on linux-next, and bisection shows this >>> patch. Unfortunately, I can't provide a dmesg log because USB is the >>> only way I currently have to get one out(!), but presumably it's because >>> this omap-usb2 device is never registered? Looks like this breaks >>> non-dt USB on pandaboard; is that intended? >> >> Yes. omap-usb2 is *only* dt supported (New drivers shouldn't have the >> old non-dt support). > > Well, USB used to work fine on Pandaboard without DT before the > introduction of "omap-usb2", so one would expected it to continue > working (until the board file is completely removed). > > Anyway, I've moved to DT now. > >> Some patches are queued only for 3.7. >> >> In case you want to use MUSB please use these patches on linux-next.. >> [PATCH v2] arm: omap: hwmod: make *phy_48m* as the main_clk of ocp2scp >> [PATCH] ARM: OMAP2+: hwmod data: Fix ocp2scp_usb_phy and usb_host_hs >> entries (from Benoit) >> [PATCH 0/2] ARM: dts: Add subnode for ocp2scp (patch series) >> [PATCH v3 0/3] ARM: dts: omap: add dt data for MUSB (patch series) > > I got these by merging in Benoit's for_3.7/dts_part2 on top of > next-20120921. Thanks. > -- > To unsubscribe from this list: send the line "unsubscribe linux-omap" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > I still can't get musb to work on 3.7-rc2. Apparently it is still missing the patches from Benoit's for_3.7/dts_part2. Maybe I just need to wait for it to be merged? Till then, where can I get a tree where musb works on Panda? Benoit, FYI, I get merge conflicts when merging 3.7-rc2 on top of Linus's kernel HEAD. Am I missing something? regards, -roger
Hi Roger, On 10/26/2012 05:16 PM, Roger Quadros wrote: > Hi Kishon & Benoit, > > On 09/24/2012 12:06 PM, Rabin Vincent wrote: >> 2012/9/24 ABRAHAM, KISHON VIJAY <kishon@ti.com>: >>> On Sat, Sep 22, 2012 at 3:03 AM, Rabin Vincent <rabin@rab.in> wrote: >>>> USB doesn't work on pandaboard on linux-next, and bisection shows this >>>> patch. Unfortunately, I can't provide a dmesg log because USB is the >>>> only way I currently have to get one out(!), but presumably it's because >>>> this omap-usb2 device is never registered? Looks like this breaks >>>> non-dt USB on pandaboard; is that intended? >>> >>> Yes. omap-usb2 is *only* dt supported (New drivers shouldn't have the >>> old non-dt support). >> >> Well, USB used to work fine on Pandaboard without DT before the >> introduction of "omap-usb2", so one would expected it to continue >> working (until the board file is completely removed). >> >> Anyway, I've moved to DT now. >> >>> Some patches are queued only for 3.7. >>> >>> In case you want to use MUSB please use these patches on linux-next.. >>> [PATCH v2] arm: omap: hwmod: make *phy_48m* as the main_clk of ocp2scp >>> [PATCH] ARM: OMAP2+: hwmod data: Fix ocp2scp_usb_phy and usb_host_hs >>> entries (from Benoit) >>> [PATCH 0/2] ARM: dts: Add subnode for ocp2scp (patch series) >>> [PATCH v3 0/3] ARM: dts: omap: add dt data for MUSB (patch series) >> >> I got these by merging in Benoit's for_3.7/dts_part2 on top of >> next-20120921. Thanks. >> -- >> To unsubscribe from this list: send the line "unsubscribe linux-omap" in >> the body of a message to majordomo@vger.kernel.org >> More majordomo info at http://vger.kernel.org/majordomo-info.html >> > > I still can't get musb to work on 3.7-rc2. Apparently it is still > missing the patches from Benoit's for_3.7/dts_part2. > > Maybe I just need to wait for it to be merged? They are now in a for_3.8/dts. Unfortunately, one patch that was adding ctrl_module address in the USB data was rejected and thus I'm not sure it will work without that. I think Tony had an idea to map the ctrl_register to regulator fmwk or something like that. > Till then, where can I get a tree where musb works on Panda? > > Benoit, > > FYI, I get merge conflicts when merging 3.7-rc2 on top of Linus's kernel > HEAD. Am I missing something? Yeah, some more patches were merged outside our tree. I fixed that. Can you try with the updated branch? Regards, Benoit
* Benoit Cousson <b-cousson@ti.com> [121026 08:23]: > Hi Roger, > > On 10/26/2012 05:16 PM, Roger Quadros wrote: > > Hi Kishon & Benoit, > > > > On 09/24/2012 12:06 PM, Rabin Vincent wrote: > >> 2012/9/24 ABRAHAM, KISHON VIJAY <kishon@ti.com>: > >>> On Sat, Sep 22, 2012 at 3:03 AM, Rabin Vincent <rabin@rab.in> wrote: > >>>> USB doesn't work on pandaboard on linux-next, and bisection shows this > >>>> patch. Unfortunately, I can't provide a dmesg log because USB is the > >>>> only way I currently have to get one out(!), but presumably it's because > >>>> this omap-usb2 device is never registered? Looks like this breaks > >>>> non-dt USB on pandaboard; is that intended? > >>> > >>> Yes. omap-usb2 is *only* dt supported (New drivers shouldn't have the > >>> old non-dt support). > >> > >> Well, USB used to work fine on Pandaboard without DT before the > >> introduction of "omap-usb2", so one would expected it to continue > >> working (until the board file is completely removed). > >> > >> Anyway, I've moved to DT now. > >> > >>> Some patches are queued only for 3.7. > >>> > >>> In case you want to use MUSB please use these patches on linux-next.. > >>> [PATCH v2] arm: omap: hwmod: make *phy_48m* as the main_clk of ocp2scp > >>> [PATCH] ARM: OMAP2+: hwmod data: Fix ocp2scp_usb_phy and usb_host_hs > >>> entries (from Benoit) > >>> [PATCH 0/2] ARM: dts: Add subnode for ocp2scp (patch series) > >>> [PATCH v3 0/3] ARM: dts: omap: add dt data for MUSB (patch series) > >> > >> I got these by merging in Benoit's for_3.7/dts_part2 on top of > >> next-20120921. Thanks. > >> -- > >> To unsubscribe from this list: send the line "unsubscribe linux-omap" in > >> the body of a message to majordomo@vger.kernel.org > >> More majordomo info at http://vger.kernel.org/majordomo-info.html > >> > > > > I still can't get musb to work on 3.7-rc2. Apparently it is still > > missing the patches from Benoit's for_3.7/dts_part2. > > > > Maybe I just need to wait for it to be merged? > > They are now in a for_3.8/dts. Unfortunately, one patch that was adding > ctrl_module address in the USB data was rejected and thus I'm not sure > it will work without that. > > I think Tony had an idea to map the ctrl_register to regulator fmwk or > something like that. For device tree, we may be eventually able to handle the ctrl_register using pinctrl-single.c and pinconf API. It probably does not make sense to set it up as a regulator as the comparator can trigger errors also for the pinconf related bits at least for MMC PBIAS. > > Till then, where can I get a tree where musb works on Panda? On panda, without using device tree, use v3.7-rc2 + the following patches: ARM: OMAP: ocp2scp: create omap device for ocp2scp ARM: OMAP4: add _dev_attr_ to ocp2scp for representing usb_phy drivers: bus: ocp2scp: add pdata support Also you need to enable CONFIG_OMAP_USB2. No idea what all is needed to use MUSB with device tree at this point. Regards, Tony
On Fri, 26 Oct 2012, Benoit Cousson wrote: > On 10/26/2012 05:16 PM, Roger Quadros wrote: > > > I still can't get musb to work on 3.7-rc2. Apparently it is still > > missing the patches from Benoit's for_3.7/dts_part2. > > > > Maybe I just need to wait for it to be merged? > > They are now in a for_3.8/dts. Unfortunately, one patch that was adding > ctrl_module address in the USB data was rejected and thus I'm not sure > it will work without that. For v3.7-rc timeframe, looks like it's waiting on an ack from you: http://www.spinics.net/lists/arm-kernel/msg201028.html - Paul
Hi Paul, On 10/26/2012 07:54 PM, Paul Walmsley wrote: > On Fri, 26 Oct 2012, Benoit Cousson wrote: > >> On 10/26/2012 05:16 PM, Roger Quadros wrote: >> >>> I still can't get musb to work on 3.7-rc2. Apparently it is still >>> missing the patches from Benoit's for_3.7/dts_part2. >>> >>> Maybe I just need to wait for it to be merged? >> >> They are now in a for_3.8/dts. Unfortunately, one patch that was adding >> ctrl_module address in the USB data was rejected and thus I'm not sure >> it will work without that. > > For v3.7-rc timeframe, looks like it's waiting on an ack from you: > > http://www.spinics.net/lists/arm-kernel/msg201028.html Oups, I missed that one. But I thought Roger was mentioning the DT patch and not that one. Anyway, I will answer to Tony. Thanks for the reminder Paul. Regards, Benoit
On 10/26/2012 07:57 PM, Benoit Cousson wrote: > Hi Paul, > > On 10/26/2012 07:54 PM, Paul Walmsley wrote: >> On Fri, 26 Oct 2012, Benoit Cousson wrote: >> >>> On 10/26/2012 05:16 PM, Roger Quadros wrote: >>> >>>> I still can't get musb to work on 3.7-rc2. Apparently it is still >>>> missing the patches from Benoit's for_3.7/dts_part2. >>>> >>>> Maybe I just need to wait for it to be merged? >>> >>> They are now in a for_3.8/dts. Unfortunately, one patch that was adding >>> ctrl_module address in the USB data was rejected and thus I'm not sure >>> it will work without that. >> >> For v3.7-rc timeframe, looks like it's waiting on an ack from you: >> >> http://www.spinics.net/lists/arm-kernel/msg201028.html > > Oups, I missed that one. But I thought Roger was mentioning the DT patch > and not that one. > > Anyway, I will answer to Tony. Thanks for the reminder Paul. Well, in fact, I cannot even find the original email in my mailbox :-( I was banned again from linux-omap around that time, so that might be the reason. Tony, So please take that hacky patch if it prevents the regression. Thanks, Benoit
* Benoit Cousson <b-cousson@ti.com> [121026 11:11]: > On 10/26/2012 07:57 PM, Benoit Cousson wrote: > > Hi Paul, > > > > On 10/26/2012 07:54 PM, Paul Walmsley wrote: > >> On Fri, 26 Oct 2012, Benoit Cousson wrote: > >> > >>> On 10/26/2012 05:16 PM, Roger Quadros wrote: > >>> > >>>> I still can't get musb to work on 3.7-rc2. Apparently it is still > >>>> missing the patches from Benoit's for_3.7/dts_part2. > >>>> > >>>> Maybe I just need to wait for it to be merged? > >>> > >>> They are now in a for_3.8/dts. Unfortunately, one patch that was adding > >>> ctrl_module address in the USB data was rejected and thus I'm not sure > >>> it will work without that. > >> > >> For v3.7-rc timeframe, looks like it's waiting on an ack from you: > >> > >> http://www.spinics.net/lists/arm-kernel/msg201028.html > > > > Oups, I missed that one. But I thought Roger was mentioning the DT patch > > and not that one. > > > > Anyway, I will answer to Tony. Thanks for the reminder Paul. > > Well, in fact, I cannot even find the original email in my mailbox :-( > I was banned again from linux-omap around that time, so that might be > the reason. > > So please take that hacky patch if it prevents the regression. OK yes it seems like that's the only option we have until omap4 is device tree only. Regards, Tony
Hi Tony, On 10/26/2012 07:36 PM, Tony Lindgren wrote: > * Benoit Cousson <b-cousson@ti.com> [121026 08:23]: >> Hi Roger, >> >> On 10/26/2012 05:16 PM, Roger Quadros wrote: >>> Hi Kishon & Benoit, >>> >>> On 09/24/2012 12:06 PM, Rabin Vincent wrote: >>>> 2012/9/24 ABRAHAM, KISHON VIJAY <kishon@ti.com>: >>>>> On Sat, Sep 22, 2012 at 3:03 AM, Rabin Vincent <rabin@rab.in> wrote: >>>>>> USB doesn't work on pandaboard on linux-next, and bisection shows this >>>>>> patch. Unfortunately, I can't provide a dmesg log because USB is the >>>>>> only way I currently have to get one out(!), but presumably it's because >>>>>> this omap-usb2 device is never registered? Looks like this breaks >>>>>> non-dt USB on pandaboard; is that intended? >>>>> >>>>> Yes. omap-usb2 is *only* dt supported (New drivers shouldn't have the >>>>> old non-dt support). >>>> >>>> Well, USB used to work fine on Pandaboard without DT before the >>>> introduction of "omap-usb2", so one would expected it to continue >>>> working (until the board file is completely removed). >>>> >>>> Anyway, I've moved to DT now. >>>> >>>>> Some patches are queued only for 3.7. >>>>> >>>>> In case you want to use MUSB please use these patches on linux-next.. >>>>> [PATCH v2] arm: omap: hwmod: make *phy_48m* as the main_clk of ocp2scp >>>>> [PATCH] ARM: OMAP2+: hwmod data: Fix ocp2scp_usb_phy and usb_host_hs >>>>> entries (from Benoit) >>>>> [PATCH 0/2] ARM: dts: Add subnode for ocp2scp (patch series) >>>>> [PATCH v3 0/3] ARM: dts: omap: add dt data for MUSB (patch series) >>>> >>>> I got these by merging in Benoit's for_3.7/dts_part2 on top of >>>> next-20120921. Thanks. >>>> -- >>>> To unsubscribe from this list: send the line "unsubscribe linux-omap" in >>>> the body of a message to majordomo@vger.kernel.org >>>> More majordomo info at http://vger.kernel.org/majordomo-info.html >>>> >>> >>> I still can't get musb to work on 3.7-rc2. Apparently it is still >>> missing the patches from Benoit's for_3.7/dts_part2. >>> >>> Maybe I just need to wait for it to be merged? >> >> They are now in a for_3.8/dts. Unfortunately, one patch that was adding >> ctrl_module address in the USB data was rejected and thus I'm not sure >> it will work without that. >> >> I think Tony had an idea to map the ctrl_register to regulator fmwk or >> something like that. > > For device tree, we may be eventually able to handle the ctrl_register > using pinctrl-single.c and pinconf API. It probably does not make > sense to set it up as a regulator as the comparator can trigger errors > also for the pinconf related bits at least for MMC PBIAS. > >>> Till then, where can I get a tree where musb works on Panda? > > On panda, without using device tree, use v3.7-rc2 + the following patches: > > ARM: OMAP: ocp2scp: create omap device for ocp2scp > ARM: OMAP4: add _dev_attr_ to ocp2scp for representing usb_phy > drivers: bus: ocp2scp: add pdata support > The above 3 patches got it to work for me. Thanks for the hint. > Also you need to enable CONFIG_OMAP_USB2. No idea what all is needed > to use MUSB with device tree at this point. > Yes, you need to enable a bunch of other things which are not so easy to figure out for someone who has not worked with MUSB. Do you think we should enable musb and all dependencies in omap2plus_defconfig? One more thing to note is that building CONFIG_OMAP_USB2 as module breaks the kernel build with the following error. drivers/built-in.o: In function `twl4030_usb_irq': /work/linux-2.6/drivers/usb/otg/twl4030-usb.c:518: undefined reference to `omap_musb_mailbox' drivers/built-in.o: In function `twl4030_usb_phy_init': /work/linux-2.6/drivers/usb/otg/twl4030-usb.c:540: undefined reference to `omap_musb_mailbox' make: *** [vmlinux] Error 1 I bet the error would come while building twl6030-usb.c too. regards, -roger
Hi, On Monday 29 October 2012 02:31 PM, Roger Quadros wrote: > Hi Tony, > > On 10/26/2012 07:36 PM, Tony Lindgren wrote: >> * Benoit Cousson <b-cousson@ti.com> [121026 08:23]: >>> Hi Roger, >>> >>> On 10/26/2012 05:16 PM, Roger Quadros wrote: >>>> Hi Kishon & Benoit, >>>> >>>> On 09/24/2012 12:06 PM, Rabin Vincent wrote: >>>>> 2012/9/24 ABRAHAM, KISHON VIJAY <kishon@ti.com>: >>>>>> On Sat, Sep 22, 2012 at 3:03 AM, Rabin Vincent <rabin@rab.in> wrote: >>>>>>> USB doesn't work on pandaboard on linux-next, and bisection shows this >>>>>>> patch. Unfortunately, I can't provide a dmesg log because USB is the >>>>>>> only way I currently have to get one out(!), but presumably it's because >>>>>>> this omap-usb2 device is never registered? Looks like this breaks >>>>>>> non-dt USB on pandaboard; is that intended? >>>>>> >>>>>> Yes. omap-usb2 is *only* dt supported (New drivers shouldn't have the >>>>>> old non-dt support). >>>>> >>>>> Well, USB used to work fine on Pandaboard without DT before the >>>>> introduction of "omap-usb2", so one would expected it to continue >>>>> working (until the board file is completely removed). >>>>> >>>>> Anyway, I've moved to DT now. >>>>> >>>>>> Some patches are queued only for 3.7. >>>>>> >>>>>> In case you want to use MUSB please use these patches on linux-next.. >>>>>> [PATCH v2] arm: omap: hwmod: make *phy_48m* as the main_clk of ocp2scp >>>>>> [PATCH] ARM: OMAP2+: hwmod data: Fix ocp2scp_usb_phy and usb_host_hs >>>>>> entries (from Benoit) >>>>>> [PATCH 0/2] ARM: dts: Add subnode for ocp2scp (patch series) >>>>>> [PATCH v3 0/3] ARM: dts: omap: add dt data for MUSB (patch series) >>>>> >>>>> I got these by merging in Benoit's for_3.7/dts_part2 on top of >>>>> next-20120921. Thanks. >>>>> -- >>>>> To unsubscribe from this list: send the line "unsubscribe linux-omap" in >>>>> the body of a message to majordomo@vger.kernel.org >>>>> More majordomo info at http://vger.kernel.org/majordomo-info.html >>>>> >>>> >>>> I still can't get musb to work on 3.7-rc2. Apparently it is still >>>> missing the patches from Benoit's for_3.7/dts_part2. >>>> >>>> Maybe I just need to wait for it to be merged? >>> >>> They are now in a for_3.8/dts. Unfortunately, one patch that was adding >>> ctrl_module address in the USB data was rejected and thus I'm not sure >>> it will work without that. >>> >>> I think Tony had an idea to map the ctrl_register to regulator fmwk or >>> something like that. >> >> For device tree, we may be eventually able to handle the ctrl_register >> using pinctrl-single.c and pinconf API. It probably does not make >> sense to set it up as a regulator as the comparator can trigger errors >> also for the pinconf related bits at least for MMC PBIAS. >> >>>> Till then, where can I get a tree where musb works on Panda? >> >> On panda, without using device tree, use v3.7-rc2 + the following patches: >> >> ARM: OMAP: ocp2scp: create omap device for ocp2scp >> ARM: OMAP4: add _dev_attr_ to ocp2scp for representing usb_phy >> drivers: bus: ocp2scp: add pdata support >> > > The above 3 patches got it to work for me. Thanks for the hint. > >> Also you need to enable CONFIG_OMAP_USB2. No idea what all is needed >> to use MUSB with device tree at this point. >> > > Yes, you need to enable a bunch of other things which are not so easy to > figure out for someone who has not worked with MUSB. Do you think we > should enable musb and all dependencies in omap2plus_defconfig? > > One more thing to note is that building CONFIG_OMAP_USB2 as module > breaks the kernel build with the following error. > > drivers/built-in.o: In function `twl4030_usb_irq': > /work/linux-2.6/drivers/usb/otg/twl4030-usb.c:518: undefined reference > to `omap_musb_mailbox' > drivers/built-in.o: In function `twl4030_usb_phy_init': > /work/linux-2.6/drivers/usb/otg/twl4030-usb.c:540: undefined reference > to `omap_musb_mailbox' > make: *** [vmlinux] Error 1 > > I bet the error would come while building twl6030-usb.c too. There are couple of fixes floating in the list to fix this. https://patchwork.kernel.org/patch/1370291/ and an alternative fix here: https://patchwork.kernel.org/patch/1409671/ Thanks Kishon
diff --git a/drivers/usb/otg/Kconfig b/drivers/usb/otg/Kconfig index 13fd1ddf..d8c8a42 100644 --- a/drivers/usb/otg/Kconfig +++ b/drivers/usb/otg/Kconfig @@ -68,7 +68,7 @@ config TWL4030_USB config TWL6030_USB tristate "TWL6030 USB Transceiver Driver" - depends on TWL4030_CORE + depends on TWL4030_CORE && OMAP_USB2 select USB_OTG_UTILS help Enable this to support the USB OTG transceiver on TWL6030 diff --git a/drivers/usb/otg/twl6030-usb.c b/drivers/usb/otg/twl6030-usb.c index 6907d8d..32525bb 100644 --- a/drivers/usb/otg/twl6030-usb.c +++ b/drivers/usb/otg/twl6030-usb.c @@ -25,8 +25,9 @@ #include <linux/interrupt.h> #include <linux/platform_device.h> #include <linux/io.h> -#include <linux/usb/otg.h> #include <linux/usb/musb-omap.h> +#include <linux/usb/phy_companion.h> +#include <linux/usb/omap_usb.h> #include <linux/i2c/twl.h> #include <linux/regulator/consumer.h> #include <linux/err.h> @@ -87,7 +88,7 @@ #define VBUS_DET BIT(2) struct twl6030_usb { - struct usb_phy phy; + struct phy_companion comparator; struct device *dev; /* for vbus reporting with irqs disabled */ @@ -107,7 +108,7 @@ struct twl6030_usb { unsigned long features; }; -#define phy_to_twl(x) container_of((x), struct twl6030_usb, phy) +#define comparator_to_twl(x) container_of((x), struct twl6030_usb, comparator) /*-------------------------------------------------------------------------*/ @@ -137,50 +138,9 @@ static inline u8 twl6030_readb(struct twl6030_usb *twl, u8 module, u8 address) return ret; } -static int twl6030_phy_init(struct usb_phy *x) +static int twl6030_start_srp(struct phy_companion *comparator) { - struct twl6030_usb *twl; - struct device *dev; - struct twl4030_usb_data *pdata; - - twl = phy_to_twl(x); - dev = twl->dev; - pdata = dev->platform_data; - - if (twl->linkstat == OMAP_MUSB_ID_GROUND) - pdata->phy_power(twl->dev, 1, 1); - else - pdata->phy_power(twl->dev, 0, 1); - - return 0; -} - -static void twl6030_phy_shutdown(struct usb_phy *x) -{ - struct twl6030_usb *twl; - struct device *dev; - struct twl4030_usb_data *pdata; - - twl = phy_to_twl(x); - dev = twl->dev; - pdata = dev->platform_data; - pdata->phy_power(twl->dev, 0, 0); -} - -static int twl6030_phy_suspend(struct usb_phy *x, int suspend) -{ - struct twl6030_usb *twl = phy_to_twl(x); - struct device *dev = twl->dev; - struct twl4030_usb_data *pdata = dev->platform_data; - - pdata->phy_suspend(dev, suspend); - - return 0; -} - -static int twl6030_start_srp(struct usb_otg *otg) -{ - struct twl6030_usb *twl = phy_to_twl(otg->phy); + struct twl6030_usb *twl = comparator_to_twl(comparator); twl6030_writeb(twl, TWL_MODULE_USB, 0x24, USB_VBUS_CTRL_SET); twl6030_writeb(twl, TWL_MODULE_USB, 0x84, USB_VBUS_CTRL_SET); @@ -313,23 +273,8 @@ static irqreturn_t twl6030_usbotg_irq(int irq, void *_twl) return IRQ_HANDLED; } -static int twl6030_set_peripheral(struct usb_otg *otg, - struct usb_gadget *gadget) +static int twl6030_enable_irq(struct twl6030_usb *twl) { - if (!otg) - return -ENODEV; - - otg->gadget = gadget; - if (!gadget) - otg->phy->state = OTG_STATE_UNDEFINED; - - return 0; -} - -static int twl6030_enable_irq(struct usb_phy *x) -{ - struct twl6030_usb *twl = phy_to_twl(x); - twl6030_writeb(twl, TWL_MODULE_USB, 0x1, USB_ID_INT_EN_HI_SET); twl6030_interrupt_unmask(0x05, REG_INT_MSK_LINE_C); twl6030_interrupt_unmask(0x05, REG_INT_MSK_STS_C); @@ -362,9 +307,9 @@ static void otg_set_vbus_work(struct work_struct *data) CHARGERUSB_CTRL1); } -static int twl6030_set_vbus(struct usb_otg *otg, bool enabled) +static int twl6030_set_vbus(struct phy_companion *comparator, bool enabled) { - struct twl6030_usb *twl = phy_to_twl(otg->phy); + struct twl6030_usb *twl = comparator_to_twl(comparator); twl->vbus_enable = enabled; schedule_work(&twl->set_vbus_work); @@ -372,23 +317,12 @@ static int twl6030_set_vbus(struct usb_otg *otg, bool enabled) return 0; } -static int twl6030_set_host(struct usb_otg *otg, struct usb_bus *host) -{ - if (!otg) - return -ENODEV; - - otg->host = host; - if (!host) - otg->phy->state = OTG_STATE_UNDEFINED; - return 0; -} - static int __devinit twl6030_usb_probe(struct platform_device *pdev) { + u32 ret; struct twl6030_usb *twl; int status, err; struct twl4030_usb_data *pdata; - struct usb_otg *otg; struct device *dev = &pdev->dev; pdata = dev->platform_data; @@ -396,28 +330,20 @@ static int __devinit twl6030_usb_probe(struct platform_device *pdev) if (!twl) return -ENOMEM; - otg = devm_kzalloc(dev, sizeof *otg, GFP_KERNEL); - if (!otg) - return -ENOMEM; - twl->dev = &pdev->dev; twl->irq1 = platform_get_irq(pdev, 0); twl->irq2 = platform_get_irq(pdev, 1); twl->features = pdata->features; twl->linkstat = OMAP_MUSB_UNKNOWN; - twl->phy.dev = twl->dev; - twl->phy.label = "twl6030"; - twl->phy.otg = otg; - twl->phy.init = twl6030_phy_init; - twl->phy.shutdown = twl6030_phy_shutdown; - twl->phy.set_suspend = twl6030_phy_suspend; + twl->comparator.set_vbus = twl6030_set_vbus; + twl->comparator.start_srp = twl6030_start_srp; - otg->phy = &twl->phy; - otg->set_host = twl6030_set_host; - otg->set_peripheral = twl6030_set_peripheral; - otg->set_vbus = twl6030_set_vbus; - otg->start_srp = twl6030_start_srp; + ret = omap_usb2_set_comparator(&twl->comparator); + if (ret == -ENODEV) { + dev_info(&pdev->dev, "phy not ready, deferring probe"); + return -EPROBE_DEFER; + } /* init spinlock for workqueue */ spin_lock_init(&twl->lock); @@ -427,7 +353,6 @@ static int __devinit twl6030_usb_probe(struct platform_device *pdev) dev_err(&pdev->dev, "ldo init failed\n"); return err; } - usb_add_phy(&twl->phy, USB_PHY_TYPE_USB2); platform_set_drvdata(pdev, twl); if (device_create_file(&pdev->dev, &dev_attr_vbus)) @@ -458,9 +383,7 @@ static int __devinit twl6030_usb_probe(struct platform_device *pdev) } twl->asleep = 0; - pdata->phy_init(dev); - twl6030_phy_suspend(&twl->phy, 0); - twl6030_enable_irq(&twl->phy); + twl6030_enable_irq(twl); dev_info(&pdev->dev, "Initialized TWL6030 USB module\n"); return 0; @@ -470,10 +393,6 @@ static int __exit twl6030_usb_remove(struct platform_device *pdev) { struct twl6030_usb *twl = platform_get_drvdata(pdev); - struct twl4030_usb_data *pdata; - struct device *dev = &pdev->dev; - pdata = dev->platform_data; - twl6030_interrupt_mask(TWL6030_USBOTG_INT_MASK, REG_INT_MSK_LINE_C); twl6030_interrupt_mask(TWL6030_USBOTG_INT_MASK, @@ -481,7 +400,6 @@ static int __exit twl6030_usb_remove(struct platform_device *pdev) free_irq(twl->irq1, twl); free_irq(twl->irq2, twl); regulator_put(twl->usb3v3); - pdata->phy_exit(twl->dev); device_remove_file(twl->dev, &dev_attr_vbus); cancel_work_sync(&twl->set_vbus_work);
All the PHY configuration other than VBUS, ID GND and OTG SRP are removed from twl6030. The phy configurations are taken care by the dedicated usb2 phy driver. So twl6030 is made as comparator driver for VBUS and ID detection. Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> --- drivers/usb/otg/Kconfig | 2 +- drivers/usb/otg/twl6030-usb.c | 118 +++++++---------------------------------- 2 files changed, 19 insertions(+), 101 deletions(-)