* Nokia N900: musb is in wrong state after boot @ 2016-01-09 15:16 Pali Rohár 2016-01-19 20:33 ` Tony Lindgren 0 siblings, 1 reply; 41+ messages in thread From: Pali Rohár @ 2016-01-09 15:16 UTC (permalink / raw) To: Tony Lindgren, Felipe Balbi, Greg Kroah-Hartman, linux-usb, linux-kernel, linux-omap, Ivaylo Dimitrov, Sebastian Reichel, Aaro Koskinen, Pavel Machek, Nishanth Menon [-- Attachment #1.1: Type: text/plain, Size: 1213 bytes --] Hello, when I boot 4.4.0-rc7+ kernel compiled with g_nokia into zImage on Nokia N900 into userspace then usb gadget (g_nokia) does not work. Notebook, connected on other side does not see any usb device... Connecting and disconnecting cable does not change anything, still not work. But if I run this command $ echo peripheral > /sys/bus/platform/devices/musb-hdrc.0.auto/mode then gadget starts working. Other side see usb device and can use it. Also connecting and disconnecting usb cable working fine. After connecting it again, usb device OK. So it looks like musb is in some wrong state after boot if above command is not called. Any idea where is problem? In attachment is output from more musb sysfs entries (before and after calling that command) which I think could be useful. If you want to see more logs, let me know what. Note that host mode on Nokia N900 does not work because of HW design. For 2.6.28 Nokia's kernel there are special and ugly (!) patches which enable host mode together with userspace interaction. So it does not make sense to have other than peripheral mode enabled by default on Nokia N900... -- Pali Rohár pali.rohar@gmail.com [-- Attachment #1.2: musb_log --] [-- Type: text/plain, Size: 5794 bytes --] Nokia-N900:~# grep "" /sys/bus/platform/devices/musb-hdrc.0.auto/* /sys/bus/platform/devices/musb-hdrc.0.auto/driver_override:(null) /sys/bus/platform/devices/musb-hdrc.0.auto/modalias:platform:musb-hdrc /sys/bus/platform/devices/musb-hdrc.0.auto/mode:b_idle /sys/bus/platform/devices/musb-hdrc.0.auto/uevent:DRIVER=musb-hdrc /sys/bus/platform/devices/musb-hdrc.0.auto/uevent:MODALIAS=platform:musb-hdrc /sys/bus/platform/devices/musb-hdrc.0.auto/vbus:Vbus on, timeout 1100 msec Nokia-N900:~# grep "" /sys/bus/platform/devices/musb-hdrc.0.auto/musb-hdrc.0.auto/* /sys/bus/platform/devices/musb-hdrc.0.auto/musb-hdrc.0.auto/a_alt_hnp_support:0 /sys/bus/platform/devices/musb-hdrc.0.auto/musb-hdrc.0.auto/a_hnp_support:0 /sys/bus/platform/devices/musb-hdrc.0.auto/musb-hdrc.0.auto/b_hnp_enable:0 /sys/bus/platform/devices/musb-hdrc.0.auto/musb-hdrc.0.auto/current_speed:UNKNOWN /sys/bus/platform/devices/musb-hdrc.0.auto/musb-hdrc.0.auto/is_a_peripheral:0 /sys/bus/platform/devices/musb-hdrc.0.auto/musb-hdrc.0.auto/is_otg:1 /sys/bus/platform/devices/musb-hdrc.0.auto/musb-hdrc.0.auto/is_selfpowered:0 /sys/bus/platform/devices/musb-hdrc.0.auto/musb-hdrc.0.auto/maximum_speed:high-speed grep: /sys/bus/platform/devices/musb-hdrc.0.auto/musb-hdrc.0.auto/soft_connect: Permission denied grep: /sys/bus/platform/devices/musb-hdrc.0.auto/musb-hdrc.0.auto/srp: Permission denied /sys/bus/platform/devices/musb-hdrc.0.auto/musb-hdrc.0.auto/state:not attached Nokia-N900:~# cat /sys/kernel/debug/musb-hdrc.0.auto/regdump MUSB (M)HDRC Register Dump FAddr : 00 Power : a0 Frame : 0000 Index : 00 Testmode : 00 TxMaxPp : a000 TxCSRp : 0000 RxMaxPp : 0000 RxCSR : ffff RxCount : fffe IntrRxE : fffe IntrTxE : ffff IntrUsbE : f7 DevCtl : 98 VControl : 00000000 HWVers : 0000 LinkInfo : 5c VPLen : 3c HS_EOF1 : 80 FS_EOF1 : 77 LS_EOF1 : 72 SOFT_RST : 00 DMA_CNTLch0 : 0000 DMA_ADDRch0 : 00000000 DMA_COUNTch0: 00000000 DMA_CNTLch1 : 0000 DMA_ADDRch1 : 00000000 DMA_COUNTch1: 00000000 DMA_CNTLch2 : 0000 DMA_ADDRch2 : 00000000 DMA_COUNTch2: 00000000 DMA_CNTLch3 : 0000 DMA_ADDRch3 : 00000000 DMA_COUNTch3: 00000000 DMA_CNTLch4 : 0000 DMA_ADDRch4 : 00000000 DMA_COUNTch4: 00000000 DMA_CNTLch5 : 0000 DMA_ADDRch5 : 00000000 DMA_COUNTch5: 00000000 DMA_CNTLch6 : 0000 DMA_ADDRch6 : 00000000 DMA_COUNTch6: 00000000 DMA_CNTLch7 : 0000 DMA_ADDRch7 : 00000000 DMA_COUNTch7: 00000000 ConfigData : 00 BabbleCtl : 00 TxFIFOsz : 00 RxFIFOsz : 00 TxFIFOadd : 0000 RxFIFOadd : 0000 EPInfo : ff RAMInfo : 8c Nokia-N900:~# cat /sys/kernel/debug/musb-hdrc.0.auto/softconnect -1 Nokia-N900:~# cat /sys/kernel/debug/musb-hdrc.0.auto/testmode Nokia-N900:~# Nokia-N900:~# Nokia-N900:~# echo peripheral > /sys/bus/platform/devices/musb-hdrc.0.auto/mode Nokia-N900:~# Nokia-N900:~# Nokia-N900:~# Nokia-N900:~# grep "" /sys/bus/platform/devices/musb-hdrc.0.auto/* /sys/bus/platform/devices/musb-hdrc.0.auto/driver_override:(null) /sys/bus/platform/devices/musb-hdrc.0.auto/modalias:platform:musb-hdrc /sys/bus/platform/devices/musb-hdrc.0.auto/mode:b_peripheral /sys/bus/platform/devices/musb-hdrc.0.auto/uevent:DRIVER=musb-hdrc /sys/bus/platform/devices/musb-hdrc.0.auto/uevent:MODALIAS=platform:musb-hdrc /sys/bus/platform/devices/musb-hdrc.0.auto/vbus:Vbus on, timeout 1100 msec Nokia-N900:~# grep "" /sys/bus/platform/devices/musb-hdrc.0.auto/musb-hdrc.0.auto/* /sys/bus/platform/devices/musb-hdrc.0.auto/musb-hdrc.0.auto/a_alt_hnp_support:0 /sys/bus/platform/devices/musb-hdrc.0.auto/musb-hdrc.0.auto/a_hnp_support:0 /sys/bus/platform/devices/musb-hdrc.0.auto/musb-hdrc.0.auto/b_hnp_enable:0 /sys/bus/platform/devices/musb-hdrc.0.auto/musb-hdrc.0.auto/current_speed:high-speed /sys/bus/platform/devices/musb-hdrc.0.auto/musb-hdrc.0.auto/is_a_peripheral:0 /sys/bus/platform/devices/musb-hdrc.0.auto/musb-hdrc.0.auto/is_otg:1 /sys/bus/platform/devices/musb-hdrc.0.auto/musb-hdrc.0.auto/is_selfpowered:0 /sys/bus/platform/devices/musb-hdrc.0.auto/musb-hdrc.0.auto/maximum_speed:high-speed grep: /sys/bus/platform/devices/musb-hdrc.0.auto/musb-hdrc.0.auto/soft_connect: Permission denied grep: /sys/bus/platform/devices/musb-hdrc.0.auto/musb-hdrc.0.auto/srp: Permission denied /sys/bus/platform/devices/musb-hdrc.0.auto/musb-hdrc.0.auto/state:configured Nokia-N900:~# cat /sys/kernel/debug/musb-hdrc.0.auto/regdump MUSB (M)HDRC Register Dump FAddr : 1f Power : f0 Frame : 02dd Index : 00 Testmode : 00 TxMaxPp : f01f TxCSRp : 0000 RxMaxPp : 0000 RxCSR : ffff RxCount : fffe IntrRxE : fffe IntrTxE : ffff IntrUsbE : f7 DevCtl : 99 VControl : 00000000 HWVers : 0000 LinkInfo : 5c VPLen : 3c HS_EOF1 : 80 FS_EOF1 : 77 LS_EOF1 : 72 SOFT_RST : 00 DMA_CNTLch0 : 0000 DMA_ADDRch0 : 00000000 DMA_COUNTch0: 00000000 DMA_CNTLch1 : 0000 DMA_ADDRch1 : 00000000 DMA_COUNTch1: 00000000 DMA_CNTLch2 : 0000 DMA_ADDRch2 : 00000000 DMA_COUNTch2: 00000000 DMA_CNTLch3 : 0000 DMA_ADDRch3 : 00000000 DMA_COUNTch3: 00000000 DMA_CNTLch4 : 0000 DMA_ADDRch4 : 00000000 DMA_COUNTch4: 00000000 DMA_CNTLch5 : 0000 DMA_ADDRch5 : 00000000 DMA_COUNTch5: 00000000 DMA_CNTLch6 : 0000 DMA_ADDRch6 : 00000000 DMA_COUNTch6: 00000000 DMA_CNTLch7 : 0000 DMA_ADDRch7 : 00000000 DMA_COUNTch7: 00000000 ConfigData : 00 BabbleCtl : 00 TxFIFOsz : 00 RxFIFOsz : 00 TxFIFOadd : 0000 RxFIFOadd : 0000 EPInfo : ff RAMInfo : 8c Nokia-N900:~# cat /sys/kernel/debug/musb-hdrc.0.auto/softconnect -1 Nokia-N900:~# cat /sys/kernel/debug/musb-hdrc.0.auto/testmode Nokia-N900:~# [-- Attachment #2: This is a digitally signed message part. --] [-- Type: application/pgp-signature, Size: 198 bytes --] ^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: Nokia N900: musb is in wrong state after boot 2016-01-09 15:16 Nokia N900: musb is in wrong state after boot Pali Rohár @ 2016-01-19 20:33 ` Tony Lindgren 2016-01-21 8:40 ` Pali Rohár 0 siblings, 1 reply; 41+ messages in thread From: Tony Lindgren @ 2016-01-19 20:33 UTC (permalink / raw) To: Pali Rohár Cc: Felipe Balbi, Greg Kroah-Hartman, linux-usb, linux-kernel, linux-omap, Ivaylo Dimitrov, Sebastian Reichel, Aaro Koskinen, Pavel Machek, Nishanth Menon Hi, * Pali Rohár <pali.rohar@gmail.com> [160109 07:16]: > Hello, > > when I boot 4.4.0-rc7+ kernel compiled with g_nokia into zImage on Nokia > N900 into userspace then usb gadget (g_nokia) does not work. Notebook, > connected on other side does not see any usb device... Connecting and > disconnecting cable does not change anything, still not work. > > But if I run this command > $ echo peripheral > /sys/bus/platform/devices/musb-hdrc.0.auto/mode > > then gadget starts working. Other side see usb device and can use it. > Also connecting and disconnecting usb cable working fine. After > connecting it again, usb device OK. N900 had the PHY interrupt wired to the bq chip instead of twl4030, right? You can fix this issue similar to phy-twl4030-usb.c. In function twl4030_phy_power_on() we call schedule_delayed_work() that checks the state of the ID pin on boot up. I think that's only needed for the i2c based PHY's with MUSB, with the others the USB driver has a better idea of the current state. Regards, Tony ^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: Nokia N900: musb is in wrong state after boot 2016-01-19 20:33 ` Tony Lindgren @ 2016-01-21 8:40 ` Pali Rohár 2016-01-21 9:57 ` Ivaylo Dimitrov 2016-01-21 10:29 ` joerg Reisenweber 0 siblings, 2 replies; 41+ messages in thread From: Pali Rohár @ 2016-01-21 8:40 UTC (permalink / raw) To: Tony Lindgren Cc: Felipe Balbi, Greg Kroah-Hartman, linux-usb, linux-kernel, linux-omap, Ivaylo Dimitrov, Sebastian Reichel, Aaro Koskinen, Pavel Machek, Nishanth Menon, joerg Reisenweber On Tuesday 19 January 2016 12:33:15 Tony Lindgren wrote: > Hi, > > * Pali Rohár <pali.rohar@gmail.com> [160109 07:16]: > > Hello, > > > > when I boot 4.4.0-rc7+ kernel compiled with g_nokia into zImage on Nokia > > N900 into userspace then usb gadget (g_nokia) does not work. Notebook, > > connected on other side does not see any usb device... Connecting and > > disconnecting cable does not change anything, still not work. > > > > But if I run this command > > $ echo peripheral > /sys/bus/platform/devices/musb-hdrc.0.auto/mode > > > > then gadget starts working. Other side see usb device and can use it. > > Also connecting and disconnecting usb cable working fine. After > > connecting it again, usb device OK. > > N900 had the PHY interrupt wired to the bq chip instead of twl4030, right? I do not know now. I tried to find it in N900 schemantics, but do not see it. CCing Joerg, do you know? > You can fix this issue similar to phy-twl4030-usb.c. In function > twl4030_phy_power_on() we call schedule_delayed_work() that checks > the state of the ID pin on boot up. I looked at that code, but do not see what and how can be fixed :-( > I think that's only needed for the i2c based PHY's with MUSB, with > the others the USB driver has a better idea of the current state. > > Regards, > > Tony -- Pali Rohár pali.rohar@gmail.com ^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: Nokia N900: musb is in wrong state after boot 2016-01-21 8:40 ` Pali Rohár @ 2016-01-21 9:57 ` Ivaylo Dimitrov 2016-01-21 10:23 ` Pali Rohár 2016-01-21 10:29 ` joerg Reisenweber 1 sibling, 1 reply; 41+ messages in thread From: Ivaylo Dimitrov @ 2016-01-21 9:57 UTC (permalink / raw) To: Pali Rohár, Tony Lindgren Cc: Felipe Balbi, Greg Kroah-Hartman, linux-usb, linux-kernel, linux-omap, Sebastian Reichel, Aaro Koskinen, Pavel Machek, Nishanth Menon, joerg Reisenweber On 21.01.2016 10:40, Pali Rohár wrote: > > I do not know now. I tried to find it in N900 schemantics, but do not > see it. > > CCing Joerg, do you know? > http://plan9.stanleylieber.com/hardware/n900/n900.schematics.pdf ^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: Nokia N900: musb is in wrong state after boot 2016-01-21 9:57 ` Ivaylo Dimitrov @ 2016-01-21 10:23 ` Pali Rohár 2016-01-21 10:27 ` Ivaylo Dimitrov 0 siblings, 1 reply; 41+ messages in thread From: Pali Rohár @ 2016-01-21 10:23 UTC (permalink / raw) To: Ivaylo Dimitrov Cc: Tony Lindgren, Felipe Balbi, Greg Kroah-Hartman, linux-usb, linux-kernel, linux-omap, Sebastian Reichel, Aaro Koskinen, Pavel Machek, Nishanth Menon, joerg Reisenweber On Thursday 21 January 2016 11:57:48 Ivaylo Dimitrov wrote: > > > On 21.01.2016 10:40, Pali Rohár wrote: > > > >I do not know now. I tried to find it in N900 schemantics, but do not > >see it. > > > >CCing Joerg, do you know? > > > > > http://plan9.stanleylieber.com/hardware/n900/n900.schematics.pdf You probably forgot to specify page in PDF or other location where is that PHY interrupt. As I wrote I tried to find it, but do not see it there. -- Pali Rohár pali.rohar@gmail.com ^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: Nokia N900: musb is in wrong state after boot 2016-01-21 10:23 ` Pali Rohár @ 2016-01-21 10:27 ` Ivaylo Dimitrov 0 siblings, 0 replies; 41+ messages in thread From: Ivaylo Dimitrov @ 2016-01-21 10:27 UTC (permalink / raw) To: Pali Rohár Cc: Tony Lindgren, Felipe Balbi, Greg Kroah-Hartman, linux-usb, linux-kernel, linux-omap, Sebastian Reichel, Aaro Koskinen, Pavel Machek, Nishanth Menon, joerg Reisenweber On 21.01.2016 12:23, Pali Rohár wrote: > > You probably forgot to specify page in PDF or other location where is > that PHY interrupt. As I wrote I tried to find it, but do not see it > there. > Oh, sorry, I misunderstood what you wrote - I was under the impression that you can't find the schematics itself :) Ivo ^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: Nokia N900: musb is in wrong state after boot 2016-01-21 8:40 ` Pali Rohár 2016-01-21 9:57 ` Ivaylo Dimitrov @ 2016-01-21 10:29 ` joerg Reisenweber 2016-01-21 17:41 ` Tony Lindgren 1 sibling, 1 reply; 41+ messages in thread From: joerg Reisenweber @ 2016-01-21 10:29 UTC (permalink / raw) To: Pali Rohár Cc: Tony Lindgren, Felipe Balbi, Greg Kroah-Hartman, linux-usb, linux-kernel, linux-omap, Ivaylo Dimitrov, Sebastian Reichel, Aaro Koskinen, Pavel Machek, Nishanth Menon [-- Attachment #1: Type: text/plain, Size: 2995 bytes --] On Thu 21 January 2016 09:40:07 Pali Rohár wrote: > On Tuesday 19 January 2016 12:33:15 Tony Lindgren wrote: > > Hi, > > > > * Pali Rohár <pali.rohar@gmail.com> [160109 07:16]: > > > Hello, > > > > > > when I boot 4.4.0-rc7+ kernel compiled with g_nokia into zImage on Nokia > > > N900 into userspace then usb gadget (g_nokia) does not work. Notebook, > > > connected on other side does not see any usb device... Connecting and > > > disconnecting cable does not change anything, still not work. > > > > > > But if I run this command > > > $ echo peripheral > /sys/bus/platform/devices/musb-hdrc.0.auto/mode > > > > > > > > > then gadget starts working. Other side see usb device and can use it. > > > Also connecting and disconnecting usb cable working fine. After > > > connecting it again, usb device OK. > > > > N900 had the PHY interrupt wired to the bq chip instead of twl4030, right? which interrupt? I'll try to answer based on assumptions: 1707 PHY connects to bq24150 charger via CHRG_DET signal. I guess you're talking about the VBUS detection which is done in twl4030 VBUS- pin R8. > > I do not know now. I tried to find it in N900 schemantics, but do not > see it. > > CCing Joerg, do you know? > > > You can fix this issue similar to phy-twl4030-usb.c. In function > > twl4030_phy_power_on() we call schedule_delayed_work() that checks > > the state of the ID pin on boot up. > > I looked at that code, but do not see what and how can be fixed :-( > > > I think that's only needed for the i2c based PHY's with MUSB, with > > the others the USB driver has a better idea of the current state. > > > > Regards, > > > > Tony N900 PHY (1707) is connected to musb core via ULPI (https://www.mentor.com/products/ip/usb/usb20otg/phy_interfaces), it has no I2C interface and no other IRQ than what's implemented in (normally powered- down?) ULPI already. I guess the problem in this case is along the USB VBUS and ID pin A/B OTG detection: the USB jack's ID pin is _not_ connected to the PHY in N900 but rather is connected to TWL4030 aka GAIA ID pin R11 which afaik is part of the otherwise unused (except VBUS detection?) PHY in TWL4030. It seems to me the actually used PHY 1707 does not support ID, neither does it support a dedicated IRQ line for VBUS. Generally musb-core and buses should be suspended/off by default, for energy conservation reasons (seemingly ~40mA on Vbatt!), and only get enabled when twl4030 detects +5V on VBUS (also before my hostmode botch tries to talk to the musb core debug registers which needs to happen before VBUS gets applied) cheers jOERG -- () ascii ribbon campaign /\ against html e-mail - against proprietary attachments http://www.georgedillon.com/web/html_email_is_evil.shtml http://www.nonhtmlmail.org/campaign.html http://www.georgedillon.com/web/html_email_is_evil_still.shtml http://www.gerstbach.at/2004/ascii/ (German) [-- Attachment #2: This is a digitally signed message part. --] [-- Type: application/pgp-signature, Size: 198 bytes --] ^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: Nokia N900: musb is in wrong state after boot 2016-01-21 10:29 ` joerg Reisenweber @ 2016-01-21 17:41 ` Tony Lindgren 2016-01-21 18:44 ` joerg Reisenweber 0 siblings, 1 reply; 41+ messages in thread From: Tony Lindgren @ 2016-01-21 17:41 UTC (permalink / raw) To: joerg Reisenweber Cc: Pali Rohár, Felipe Balbi, Greg Kroah-Hartman, linux-usb, linux-kernel, linux-omap, Ivaylo Dimitrov, Sebastian Reichel, Aaro Koskinen, Pavel Machek, Nishanth Menon * joerg Reisenweber <joerg@openmoko.org> [160121 02:30]: > On Thu 21 January 2016 09:40:07 Pali Rohár wrote: > > On Tuesday 19 January 2016 12:33:15 Tony Lindgren wrote: > > > Hi, > > > > > > * Pali Rohár <pali.rohar@gmail.com> [160109 07:16]: > > > > Hello, > > > > > > > > when I boot 4.4.0-rc7+ kernel compiled with g_nokia into zImage on Nokia > > > > N900 into userspace then usb gadget (g_nokia) does not work. Notebook, > > > > connected on other side does not see any usb device... Connecting and > > > > disconnecting cable does not change anything, still not work. > > > > > > > > But if I run this command > > > > $ echo peripheral > /sys/bus/platform/devices/musb-hdrc.0.auto/mode > > > > > > > > > > > > then gadget starts working. Other side see usb device and can use it. > > > > Also connecting and disconnecting usb cable working fine. After > > > > connecting it again, usb device OK. > > > > > > N900 had the PHY interrupt wired to the bq chip instead of twl4030, right? > > which interrupt? I'll try to answer based on assumptions: 1707 PHY connects to > bq24150 charger via CHRG_DET signal. > I guess you're talking about the VBUS detection which is done in twl4030 VBUS- > pin R8. Right, I'm confusing things a bit here. If the VBUS detection is done in twl4030, then it should notify the USB subsystem. But on n900 the USB phy is not ti,twl4030-usb, it's the 1707 instead. So my guess is that in drivers/phy/phy-twl4030-usb.c the interrupt never gets enabled as the PHY driver never gets probed? Then for supporting the USB host mode.. We should add regulator support to the USB PHY driver so if the ID pin is grounded, the PHY driver enables the VBUS regulator. That too seems to need some coordination between the drivers/phy/phy-twl4030-usb.c and 1707 driver if the ID pin interrupt is only detected in drivers/phy/phy-twl4030-usb.c. > N900 PHY (1707) is connected to musb core via ULPI > (https://www.mentor.com/products/ip/usb/usb20otg/phy_interfaces), it has no > I2C interface and no other IRQ than what's implemented in (normally powered- > down?) ULPI already. > I guess the problem in this case is along the USB VBUS and ID pin A/B OTG > detection: the USB jack's ID pin is _not_ connected to the PHY in N900 but > rather is connected to TWL4030 aka GAIA ID pin R11 which afaik is part of the > otherwise unused (except VBUS detection?) PHY in TWL4030. > It seems to me the actually used PHY 1707 does not support ID, neither does it > support a dedicated IRQ line for VBUS. Yes so it seems. > Generally musb-core and buses should be suspended/off by default, for energy > conservation reasons (seemingly ~40mA on Vbatt!), and only get enabled when > twl4030 detects +5V on VBUS (also before my hostmode botch tries to talk to > the musb core debug registers which needs to happen before VBUS gets applied) I also think there's also some related twl4030 errata where it's recommended the USB PHY is in suspend mode instead of disabled. Regards, Tony ^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: Nokia N900: musb is in wrong state after boot 2016-01-21 17:41 ` Tony Lindgren @ 2016-01-21 18:44 ` joerg Reisenweber 2016-01-21 19:21 ` Tony Lindgren 0 siblings, 1 reply; 41+ messages in thread From: joerg Reisenweber @ 2016-01-21 18:44 UTC (permalink / raw) To: Tony Lindgren Cc: Pali Rohár, Felipe Balbi, Greg Kroah-Hartman, linux-usb, linux-kernel, linux-omap, Ivaylo Dimitrov, Sebastian Reichel, Aaro Koskinen, Pavel Machek, Nishanth Menon [-- Attachment #1: Type: text/plain, Size: 2396 bytes --] On Thu 21 January 2016 09:41:46 Tony Lindgren wrote: > Then for supporting the USB host mode.. We should add regulator support > to the USB PHY driver so if the ID pin is grounded, the PHY driver enables > the VBUS regulator. That too seems to need some coordination between the > drivers/phy/phy-twl4030-usb.c and 1707 driver if the ID pin interrupt is > only detected in drivers/phy/phy-twl4030-usb.c. Note that, while this is probably a good thing to do, it needs to be sufficiently loose coupling to allow user to 'intercept' this VBOOS regulator enabling and instead allow device charging while in externally powered hostmode. There's even a spec for this in USB-docs-foo iirc, something along a certain resistor value on ID to GND - alas I guess the twl4030 is not capable to detect such sophisticated signaling, and anyway it's always desirable to allow user to manually override the VBOOST and enable VBUS-charging while in hostmode. On N900 the situation is even more complex since the 1707 doesn't support genuine ID detection, neither does it support emulated ID grounding. And there's no other method than a ID=GND message from PHY to musb core to make the musb core state engine transfer into proper hostmode. Thus my H-E-N hostmode botch abuses debug flags to force the musb core into a "emulated" hostmode and this mode doesn't support USB speed detection. Thus speed settings are forced onto musb core and PHY by software, and the musb core speed bits are only effective before session enabled. Bottom line: you need VBUS to try and negotiate speed with the attached device in hostmode, but to actually set this speed you detected by software means, you need to disable and discharge VBUS again, or musb core won't care about the speed you set. To be utterly clear: unconditional enabling of VBUS in ID=GND won't work. This is quite complex and it's questionable if it could get handled reasonably in kernel space. *Very* N900 specific niche solution, I'd not think it's suited for upstreaming. /jOERG -- () ascii ribbon campaign /\ against html e-mail - against proprietary attachments http://www.georgedillon.com/web/html_email_is_evil.shtml http://www.nonhtmlmail.org/campaign.html http://www.georgedillon.com/web/html_email_is_evil_still.shtml http://www.gerstbach.at/2004/ascii/ (German) [-- Attachment #2: This is a digitally signed message part. --] [-- Type: application/pgp-signature, Size: 198 bytes --] ^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: Nokia N900: musb is in wrong state after boot 2016-01-21 18:44 ` joerg Reisenweber @ 2016-01-21 19:21 ` Tony Lindgren 2016-01-21 19:34 ` joerg Reisenweber 2016-01-23 12:57 ` Pali Rohár 0 siblings, 2 replies; 41+ messages in thread From: Tony Lindgren @ 2016-01-21 19:21 UTC (permalink / raw) To: joerg Reisenweber Cc: Pali Rohár, Felipe Balbi, Greg Kroah-Hartman, linux-usb, linux-kernel, linux-omap, Ivaylo Dimitrov, Sebastian Reichel, Aaro Koskinen, Pavel Machek, Nishanth Menon * joerg Reisenweber <joerg@openmoko.org> [160121 10:45]: > On Thu 21 January 2016 09:41:46 Tony Lindgren wrote: > > Then for supporting the USB host mode.. We should add regulator support > > to the USB PHY driver so if the ID pin is grounded, the PHY driver enables > > the VBUS regulator. That too seems to need some coordination between the > > drivers/phy/phy-twl4030-usb.c and 1707 driver if the ID pin interrupt is > > only detected in drivers/phy/phy-twl4030-usb.c. > > Note that, while this is probably a good thing to do, it needs to be > sufficiently loose coupling to allow user to 'intercept' this VBOOS regulator > enabling and instead allow device charging while in externally powered > hostmode. There's even a spec for this in USB-docs-foo iirc, something along a > certain resistor value on ID to GND - alas I guess the twl4030 is not capable > to detect such sophisticated signaling, and anyway it's always desirable to > allow user to manually override the VBOOST and enable VBUS-charging while in > hostmode. OK, I think this is what's happening with the Motorola LapDock BTW. It always feeds the VBUS, well most of the time. Do you have some pointer to the "certain resistor value on ID to GND" spec? Is it maybe part of the carkit related parts of the USB spec? > On N900 the situation is even more complex since the 1707 doesn't support > genuine ID detection, neither does it support emulated ID grounding. And > there's no other method than a ID=GND message from PHY to musb core to make > the musb core state engine transfer into proper hostmode. Thus my H-E-N > hostmode botch abuses debug flags to force the musb core into a "emulated" > hostmode and this mode doesn't support USB speed detection. Thus speed > settings are forced onto musb core and PHY by software, and the musb core > speed bits are only effective before session enabled. > Bottom line: you need VBUS to try and negotiate speed with the attached device > in hostmode, but to actually set this speed you detected by software means, > you need to disable and discharge VBUS again, or musb core won't care about > the speed you set. To be utterly clear: unconditional enabling of VBUS in > ID=GND won't work. > > This is quite complex and it's questionable if it could get handled reasonably > in kernel space. *Very* N900 specific niche solution, I'd not think it's suited > for upstreaming. Yeah OK. I think we should be able to support the aux VBUS regulator part with mainline kernel though. Regards, Tony ^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: Nokia N900: musb is in wrong state after boot 2016-01-21 19:21 ` Tony Lindgren @ 2016-01-21 19:34 ` joerg Reisenweber 2016-01-21 20:30 ` Tony Lindgren 2016-01-23 12:57 ` Pali Rohár 1 sibling, 1 reply; 41+ messages in thread From: joerg Reisenweber @ 2016-01-21 19:34 UTC (permalink / raw) To: Tony Lindgren Cc: Pali Rohár, Felipe Balbi, Greg Kroah-Hartman, linux-usb, linux-kernel, linux-omap, Ivaylo Dimitrov, Sebastian Reichel, Aaro Koskinen, Pavel Machek, Nishanth Menon [-- Attachment #1: Type: text/plain, Size: 913 bytes --] On Thu 21 January 2016 11:21:13 Tony Lindgren wrote: > Do you have some pointer > to the "certain resistor value on ID to GND" spec? Is it maybe part of > the carkit related parts of the USB spec? ""Three additional ID pin states are defined[4] at the nominal resistance values of 124 kΩ, 68 kΩ, and 36.5 kΩ, with respect to the ground pin. These permit the device to work with USB Accessory Charger Adapters that allows the OTG device to be attached to both a charger and another device simultaneously. [6]"" https://en.wikipedia.org/wiki/USB_On-The-Go#OTG_micro_plugs /j -- () ascii ribbon campaign /\ against html e-mail - against proprietary attachments http://www.georgedillon.com/web/html_email_is_evil.shtml http://www.nonhtmlmail.org/campaign.html http://www.georgedillon.com/web/html_email_is_evil_still.shtml http://www.gerstbach.at/2004/ascii/ (German) [-- Attachment #2: This is a digitally signed message part. --] [-- Type: application/pgp-signature, Size: 198 bytes --] ^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: Nokia N900: musb is in wrong state after boot 2016-01-21 19:34 ` joerg Reisenweber @ 2016-01-21 20:30 ` Tony Lindgren 2016-01-26 14:34 ` Pali Rohár 0 siblings, 1 reply; 41+ messages in thread From: Tony Lindgren @ 2016-01-21 20:30 UTC (permalink / raw) To: joerg Reisenweber Cc: Pali Rohár, Felipe Balbi, Greg Kroah-Hartman, linux-usb, linux-kernel, linux-omap, Ivaylo Dimitrov, Sebastian Reichel, Aaro Koskinen, Pavel Machek, Nishanth Menon * joerg Reisenweber <joerg@openmoko.org> [160121 11:35]: > On Thu 21 January 2016 11:21:13 Tony Lindgren wrote: > > Do you have some pointer > > to the "certain resistor value on ID to GND" spec? Is it maybe part of > > the carkit related parts of the USB spec? > > ""Three additional ID pin states are defined[4] at the nominal resistance > values of 124 kΩ, 68 kΩ, and 36.5 kΩ, with respect to the ground pin. These > permit the device to work with USB Accessory Charger Adapters that allows the > OTG device to be attached to both a charger and another device simultaneously. > [6]"" > https://en.wikipedia.org/wiki/USB_On-The-Go#OTG_micro_plugs OK thanks. So it's the "accessory charger" part of the battery charging specification 1.1. Regards, Tony ^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: Nokia N900: musb is in wrong state after boot 2016-01-21 20:30 ` Tony Lindgren @ 2016-01-26 14:34 ` Pali Rohár 2016-01-26 17:26 ` Tony Lindgren 0 siblings, 1 reply; 41+ messages in thread From: Pali Rohár @ 2016-01-26 14:34 UTC (permalink / raw) To: Tony Lindgren Cc: joerg Reisenweber, Felipe Balbi, Greg Kroah-Hartman, linux-usb, linux-kernel, linux-omap, Ivaylo Dimitrov, Sebastian Reichel, Aaro Koskinen, Pavel Machek, Nishanth Menon On Thursday 21 January 2016 12:30:13 Tony Lindgren wrote: > * joerg Reisenweber <joerg@openmoko.org> [160121 11:35]: > > On Thu 21 January 2016 11:21:13 Tony Lindgren wrote: > > > Do you have some pointer > > > to the "certain resistor value on ID to GND" spec? Is it maybe part of > > > the carkit related parts of the USB spec? > > > > ""Three additional ID pin states are defined[4] at the nominal resistance > > values of 124 kΩ, 68 kΩ, and 36.5 kΩ, with respect to the ground pin. These > > permit the device to work with USB Accessory Charger Adapters that allows the > > OTG device to be attached to both a charger and another device simultaneously. > > [6]"" > > https://en.wikipedia.org/wiki/USB_On-The-Go#OTG_micro_plugs > > OK thanks. So it's the "accessory charger" part of the > battery charging specification 1.1. So, Tony, do you have some idea what needs to be changed and how to fix peripheral mode after boot on Nokia N900? First I would like to have fully working peripheral mode on Nokia N900 and then we can try to hack host mode (if possible). But peripheral mode is a must due to development, because it provides usb network or usb tty. -- Pali Rohár pali.rohar@gmail.com ^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: Nokia N900: musb is in wrong state after boot 2016-01-26 14:34 ` Pali Rohár @ 2016-01-26 17:26 ` Tony Lindgren 2016-02-21 11:12 ` Pali Rohár 0 siblings, 1 reply; 41+ messages in thread From: Tony Lindgren @ 2016-01-26 17:26 UTC (permalink / raw) To: Pali Rohár Cc: joerg Reisenweber, Felipe Balbi, Greg Kroah-Hartman, linux-usb, linux-kernel, linux-omap, Ivaylo Dimitrov, Sebastian Reichel, Aaro Koskinen, Pavel Machek, Nishanth Menon * Pali Rohár <pali.rohar@gmail.com> [160126 06:35]: > On Thursday 21 January 2016 12:30:13 Tony Lindgren wrote: > > * joerg Reisenweber <joerg@openmoko.org> [160121 11:35]: > > > On Thu 21 January 2016 11:21:13 Tony Lindgren wrote: > > > > Do you have some pointer > > > > to the "certain resistor value on ID to GND" spec? Is it maybe part of > > > > the carkit related parts of the USB spec? > > > > > > ""Three additional ID pin states are defined[4] at the nominal resistance > > > values of 124 kΩ, 68 kΩ, and 36.5 kΩ, with respect to the ground pin. These > > > permit the device to work with USB Accessory Charger Adapters that allows the > > > OTG device to be attached to both a charger and another device simultaneously. > > > [6]"" > > > https://en.wikipedia.org/wiki/USB_On-The-Go#OTG_micro_plugs > > > > OK thanks. So it's the "accessory charger" part of the > > battery charging specification 1.1. > > So, Tony, do you have some idea what needs to be changed and how to fix > peripheral mode after boot on Nokia N900? No, I'm waiting to hear an educated guess from Felipe on this one. > First I would like to have fully working peripheral mode on Nokia N900 > and then we can try to hack host mode (if possible). > > But peripheral mode is a must due to development, because it provides > usb network or usb tty. Totally. Regards, Tony ^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: Nokia N900: musb is in wrong state after boot 2016-01-26 17:26 ` Tony Lindgren @ 2016-02-21 11:12 ` Pali Rohár 2016-02-22 7:31 ` Felipe Balbi 0 siblings, 1 reply; 41+ messages in thread From: Pali Rohár @ 2016-02-21 11:12 UTC (permalink / raw) To: Tony Lindgren Cc: joerg Reisenweber, Felipe Balbi, Greg Kroah-Hartman, linux-usb, linux-kernel, linux-omap, Ivaylo Dimitrov, Sebastian Reichel, Aaro Koskinen, Pavel Machek, Nishanth Menon [-- Attachment #1: Type: Text/Plain, Size: 1629 bytes --] On Tuesday 26 January 2016 18:26:32 Tony Lindgren wrote: > * Pali Rohár <pali.rohar@gmail.com> [160126 06:35]: > > On Thursday 21 January 2016 12:30:13 Tony Lindgren wrote: > > > * joerg Reisenweber <joerg@openmoko.org> [160121 11:35]: > > > > On Thu 21 January 2016 11:21:13 Tony Lindgren wrote: > > > > > Do you have some pointer > > > > > to the "certain resistor value on ID to GND" spec? Is it > > > > > maybe part of the carkit related parts of the USB spec? > > > > > > > > ""Three additional ID pin states are defined[4] at the nominal > > > > resistance values of 124 kΩ, 68 kΩ, and 36.5 kΩ, with respect > > > > to the ground pin. These permit the device to work with USB > > > > Accessory Charger Adapters that allows the OTG device to be > > > > attached to both a charger and another device simultaneously. > > > > [6]"" > > > > https://en.wikipedia.org/wiki/USB_On-The-Go#OTG_micro_plugs > > > > > > OK thanks. So it's the "accessory charger" part of the > > > battery charging specification 1.1. > > > > So, Tony, do you have some idea what needs to be changed and how to > > fix peripheral mode after boot on Nokia N900? > > No, I'm waiting to hear an educated guess from Felipe on this one. PING! Still no answer. Felipe changed email address. > > First I would like to have fully working peripheral mode on Nokia > > N900 and then we can try to hack host mode (if possible). > > > > But peripheral mode is a must due to development, because it > > provides usb network or usb tty. > > Totally. > > Regards, > > Tony -- Pali Rohár pali.rohar@gmail.com [-- Attachment #2: This is a digitally signed message part. --] [-- Type: application/pgp-signature, Size: 198 bytes --] ^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: Nokia N900: musb is in wrong state after boot 2016-02-21 11:12 ` Pali Rohár @ 2016-02-22 7:31 ` Felipe Balbi 2016-02-22 8:34 ` Pali Rohár 0 siblings, 1 reply; 41+ messages in thread From: Felipe Balbi @ 2016-02-22 7:31 UTC (permalink / raw) To: Pali Rohár, Tony Lindgren, b-liu Cc: joerg Reisenweber, Greg Kroah-Hartman, linux-usb, linux-kernel, linux-omap, Ivaylo Dimitrov, Sebastian Reichel, Aaro Koskinen, Pavel Machek, Nishanth Menon [-- Attachment #1: Type: text/plain, Size: 1879 bytes --] Pali Rohár <pali.rohar@gmail.com> writes: > On Tuesday 26 January 2016 18:26:32 Tony Lindgren wrote: >> * Pali Rohár <pali.rohar@gmail.com> [160126 06:35]: >> > On Thursday 21 January 2016 12:30:13 Tony Lindgren wrote: >> > > * joerg Reisenweber <joerg@openmoko.org> [160121 11:35]: >> > > > On Thu 21 January 2016 11:21:13 Tony Lindgren wrote: >> > > > > Do you have some pointer >> > > > > to the "certain resistor value on ID to GND" spec? Is it >> > > > > maybe part of the carkit related parts of the USB spec? >> > > > >> > > > ""Three additional ID pin states are defined[4] at the nominal >> > > > resistance values of 124 kΩ, 68 kΩ, and 36.5 kΩ, with respect >> > > > to the ground pin. These permit the device to work with USB >> > > > Accessory Charger Adapters that allows the OTG device to be >> > > > attached to both a charger and another device simultaneously. >> > > > [6]"" >> > > > https://en.wikipedia.org/wiki/USB_On-The-Go#OTG_micro_plugs >> > > >> > > OK thanks. So it's the "accessory charger" part of the >> > > battery charging specification 1.1. >> > >> > So, Tony, do you have some idea what needs to be changed and how to >> > fix peripheral mode after boot on Nokia N900? >> >> No, I'm waiting to hear an educated guess from Felipe on this one. about why peripheral mode doesn't work on n900 ? No idea. that's always the default role of MUSB and last I checked, before stopping working on this, BBB was working just fine. N900 is odd in that it has two PHYs (1701 handles data lines while twl4030 handles power lines, IIRC), but peripheral should be working. The only reason for MUSB to not start would be that it's not detecting VBUS being above session valid threshold, however twl4030 should have an IRQ for that. What happens when cable is attached ? Any IRQs anywhere firing ? -- balbi [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 818 bytes --] ^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: Nokia N900: musb is in wrong state after boot 2016-02-22 7:31 ` Felipe Balbi @ 2016-02-22 8:34 ` Pali Rohár 2016-02-22 8:54 ` Felipe Balbi 2016-02-22 8:54 ` Felipe Balbi 0 siblings, 2 replies; 41+ messages in thread From: Pali Rohár @ 2016-02-22 8:34 UTC (permalink / raw) To: Felipe Balbi Cc: Tony Lindgren, b-liu, joerg Reisenweber, Greg Kroah-Hartman, linux-usb, linux-kernel, linux-omap, Ivaylo Dimitrov, Sebastian Reichel, Aaro Koskinen, Pavel Machek, Nishanth Menon On Monday 22 February 2016 09:31:50 Felipe Balbi wrote: > Pali Rohár <pali.rohar@gmail.com> writes: > > > On Tuesday 26 January 2016 18:26:32 Tony Lindgren wrote: > >> * Pali Rohár <pali.rohar@gmail.com> [160126 06:35]: > >> > On Thursday 21 January 2016 12:30:13 Tony Lindgren wrote: > >> > > * joerg Reisenweber <joerg@openmoko.org> [160121 11:35]: > >> > > > On Thu 21 January 2016 11:21:13 Tony Lindgren wrote: > >> > > > > Do you have some pointer > >> > > > > to the "certain resistor value on ID to GND" spec? Is it > >> > > > > maybe part of the carkit related parts of the USB spec? > >> > > > > >> > > > ""Three additional ID pin states are defined[4] at the nominal > >> > > > resistance values of 124 kΩ, 68 kΩ, and 36.5 kΩ, with respect > >> > > > to the ground pin. These permit the device to work with USB > >> > > > Accessory Charger Adapters that allows the OTG device to be > >> > > > attached to both a charger and another device simultaneously. > >> > > > [6]"" > >> > > > https://en.wikipedia.org/wiki/USB_On-The-Go#OTG_micro_plugs > >> > > > >> > > OK thanks. So it's the "accessory charger" part of the > >> > > battery charging specification 1.1. > >> > > >> > So, Tony, do you have some idea what needs to be changed and how to > >> > fix peripheral mode after boot on Nokia N900? > >> > >> No, I'm waiting to hear an educated guess from Felipe on this one. > > about why peripheral mode doesn't work on n900 ? No idea. that's always > the default role of MUSB and last I checked, before stopping working on > this, BBB was working just fine. > > N900 is odd in that it has two PHYs (1701 handles data lines while > twl4030 handles power lines, IIRC), but peripheral should be working. > > The only reason for MUSB to not start would be that it's not detecting > VBUS being above session valid threshold, however twl4030 should have an > IRQ for that. > > What happens when cable is attached ? Any IRQs anywhere firing ? > Just to note, when I call echo peripheral > mode then detecting usb cable starts working and usb peripheral mode also works fine (also after disconnecting and connecting usb cable again). Read my first post in this thread, there are also some logs: https://lkml.org/lkml/2016/1/9/69 -- Pali Rohár pali.rohar@gmail.com ^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: Nokia N900: musb is in wrong state after boot 2016-02-22 8:34 ` Pali Rohár @ 2016-02-22 8:54 ` Felipe Balbi 2016-02-22 8:54 ` Felipe Balbi 1 sibling, 0 replies; 41+ messages in thread From: Felipe Balbi @ 2016-02-22 8:54 UTC (permalink / raw) To: Pali Rohár, b-liu Cc: Tony Lindgren, joerg Reisenweber, Greg Kroah-Hartman, linux-usb, linux-kernel, linux-omap, Ivaylo Dimitrov, Sebastian Reichel, Aaro Koskinen, Pavel Machek, Nishanth Menon [-- Attachment #1: Type: text/plain, Size: 2956 bytes --] Hi, Pali Rohár <pali.rohar@gmail.com> writes: > On Monday 22 February 2016 09:31:50 Felipe Balbi wrote: >> Pali Rohár <pali.rohar@gmail.com> writes: >> >> > On Tuesday 26 January 2016 18:26:32 Tony Lindgren wrote: >> >> * Pali Rohár <pali.rohar@gmail.com> [160126 06:35]: >> >> > On Thursday 21 January 2016 12:30:13 Tony Lindgren wrote: >> >> > > * joerg Reisenweber <joerg@openmoko.org> [160121 11:35]: >> >> > > > On Thu 21 January 2016 11:21:13 Tony Lindgren wrote: >> >> > > > > Do you have some pointer >> >> > > > > to the "certain resistor value on ID to GND" spec? Is it >> >> > > > > maybe part of the carkit related parts of the USB spec? >> >> > > > >> >> > > > ""Three additional ID pin states are defined[4] at the nominal >> >> > > > resistance values of 124 kΩ, 68 kΩ, and 36.5 kΩ, with respect >> >> > > > to the ground pin. These permit the device to work with USB >> >> > > > Accessory Charger Adapters that allows the OTG device to be >> >> > > > attached to both a charger and another device simultaneously. >> >> > > > [6]"" >> >> > > > https://en.wikipedia.org/wiki/USB_On-The-Go#OTG_micro_plugs >> >> > > >> >> > > OK thanks. So it's the "accessory charger" part of the >> >> > > battery charging specification 1.1. >> >> > >> >> > So, Tony, do you have some idea what needs to be changed and how to >> >> > fix peripheral mode after boot on Nokia N900? >> >> >> >> No, I'm waiting to hear an educated guess from Felipe on this one. >> >> about why peripheral mode doesn't work on n900 ? No idea. that's always >> the default role of MUSB and last I checked, before stopping working on >> this, BBB was working just fine. >> >> N900 is odd in that it has two PHYs (1701 handles data lines while >> twl4030 handles power lines, IIRC), but peripheral should be working. >> >> The only reason for MUSB to not start would be that it's not detecting >> VBUS being above session valid threshold, however twl4030 should have an >> IRQ for that. >> >> What happens when cable is attached ? Any IRQs anywhere firing ? >> > > Just to note, when I call echo peripheral > mode then detecting usb > cable starts working and usb peripheral mode also works fine (also > after disconnecting and connecting usb cable again). Read my first > post in this thread, there are also some logs: > https://lkml.org/lkml/2016/1/9/69 interesting... that softconnect interface looks odd. We _know_ the value of softconnect from musb->softconnect. /me reads commit which added it... Oh okay, that's only valid for host mode. Argh! Okay, the session bit is _NOT_ set when it should be. Note that DevCtl reads as 0x98. Bit 0 is Session bit and that's not set. MUSB _is_ in the device mode (bit 7 set). For some reason DevCtl didn't get set. Care to add a print to musb_gadget_pullup() to see when/if it's called ? BTW, Bin will be maintaining MUSB going forward. -- balbi [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 818 bytes --] ^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: Nokia N900: musb is in wrong state after boot 2016-02-22 8:34 ` Pali Rohár 2016-02-22 8:54 ` Felipe Balbi @ 2016-02-22 8:54 ` Felipe Balbi 2016-02-22 15:36 ` Bin Liu 1 sibling, 1 reply; 41+ messages in thread From: Felipe Balbi @ 2016-02-22 8:54 UTC (permalink / raw) To: Pali Rohár, b-liu Cc: Tony Lindgren, joerg Reisenweber, Greg Kroah-Hartman, linux-usb, linux-kernel, linux-omap, Ivaylo Dimitrov, Sebastian Reichel, Aaro Koskinen, Pavel Machek, Nishanth Menon [-- Attachment #1: Type: text/plain, Size: 2956 bytes --] Hi, Pali Rohár <pali.rohar@gmail.com> writes: > On Monday 22 February 2016 09:31:50 Felipe Balbi wrote: >> Pali Rohár <pali.rohar@gmail.com> writes: >> >> > On Tuesday 26 January 2016 18:26:32 Tony Lindgren wrote: >> >> * Pali Rohár <pali.rohar@gmail.com> [160126 06:35]: >> >> > On Thursday 21 January 2016 12:30:13 Tony Lindgren wrote: >> >> > > * joerg Reisenweber <joerg@openmoko.org> [160121 11:35]: >> >> > > > On Thu 21 January 2016 11:21:13 Tony Lindgren wrote: >> >> > > > > Do you have some pointer >> >> > > > > to the "certain resistor value on ID to GND" spec? Is it >> >> > > > > maybe part of the carkit related parts of the USB spec? >> >> > > > >> >> > > > ""Three additional ID pin states are defined[4] at the nominal >> >> > > > resistance values of 124 kΩ, 68 kΩ, and 36.5 kΩ, with respect >> >> > > > to the ground pin. These permit the device to work with USB >> >> > > > Accessory Charger Adapters that allows the OTG device to be >> >> > > > attached to both a charger and another device simultaneously. >> >> > > > [6]"" >> >> > > > https://en.wikipedia.org/wiki/USB_On-The-Go#OTG_micro_plugs >> >> > > >> >> > > OK thanks. So it's the "accessory charger" part of the >> >> > > battery charging specification 1.1. >> >> > >> >> > So, Tony, do you have some idea what needs to be changed and how to >> >> > fix peripheral mode after boot on Nokia N900? >> >> >> >> No, I'm waiting to hear an educated guess from Felipe on this one. >> >> about why peripheral mode doesn't work on n900 ? No idea. that's always >> the default role of MUSB and last I checked, before stopping working on >> this, BBB was working just fine. >> >> N900 is odd in that it has two PHYs (1701 handles data lines while >> twl4030 handles power lines, IIRC), but peripheral should be working. >> >> The only reason for MUSB to not start would be that it's not detecting >> VBUS being above session valid threshold, however twl4030 should have an >> IRQ for that. >> >> What happens when cable is attached ? Any IRQs anywhere firing ? >> > > Just to note, when I call echo peripheral > mode then detecting usb > cable starts working and usb peripheral mode also works fine (also > after disconnecting and connecting usb cable again). Read my first > post in this thread, there are also some logs: > https://lkml.org/lkml/2016/1/9/69 interesting... that softconnect interface looks odd. We _know_ the value of softconnect from musb->softconnect. /me reads commit which added it... Oh okay, that's only valid for host mode. Argh! Okay, the session bit is _NOT_ set when it should be. Note that DevCtl reads as 0x98. Bit 0 is Session bit and that's not set. MUSB _is_ in the device mode (bit 7 set). For some reason DevCtl didn't get set. Care to add a print to musb_gadget_pullup() to see when/if it's called ? BTW, Bin will be maintaining MUSB going forward. -- balbi [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 818 bytes --] ^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: Nokia N900: musb is in wrong state after boot 2016-02-22 8:54 ` Felipe Balbi @ 2016-02-22 15:36 ` Bin Liu 2016-02-22 15:49 ` Adam Ford 0 siblings, 1 reply; 41+ messages in thread From: Bin Liu @ 2016-02-22 15:36 UTC (permalink / raw) To: Felipe Balbi, Pali Rohár Cc: Tony Lindgren, joerg Reisenweber, Greg Kroah-Hartman, linux-usb, linux-kernel, linux-omap, Ivaylo Dimitrov, Sebastian Reichel, Aaro Koskinen, Pavel Machek, Nishanth Menon Hi, On Mon, Feb 22, 2016 at 10:54:21AM +0200, Felipe Balbi wrote: > > Hi, > > Pali Rohár <pali.rohar@gmail.com> writes: > > On Monday 22 February 2016 09:31:50 Felipe Balbi wrote: > >> Pali Rohár <pali.rohar@gmail.com> writes: > >> > >> > On Tuesday 26 January 2016 18:26:32 Tony Lindgren wrote: > >> >> * Pali Rohár <pali.rohar@gmail.com> [160126 06:35]: > >> >> > On Thursday 21 January 2016 12:30:13 Tony Lindgren wrote: > >> >> > > * joerg Reisenweber <joerg@openmoko.org> [160121 11:35]: > >> >> > > > On Thu 21 January 2016 11:21:13 Tony Lindgren wrote: > >> >> > > > > Do you have some pointer > >> >> > > > > to the "certain resistor value on ID to GND" spec? Is it > >> >> > > > > maybe part of the carkit related parts of the USB spec? > >> >> > > > > >> >> > > > ""Three additional ID pin states are defined[4] at the nominal > >> >> > > > resistance values of 124 kΩ, 68 kΩ, and 36.5 kΩ, with respect > >> >> > > > to the ground pin. These permit the device to work with USB > >> >> > > > Accessory Charger Adapters that allows the OTG device to be > >> >> > > > attached to both a charger and another device simultaneously. > >> >> > > > [6]"" > >> >> > > > https://en.wikipedia.org/wiki/USB_On-The-Go#OTG_micro_plugs > >> >> > > > >> >> > > OK thanks. So it's the "accessory charger" part of the > >> >> > > battery charging specification 1.1. > >> >> > > >> >> > So, Tony, do you have some idea what needs to be changed and how to > >> >> > fix peripheral mode after boot on Nokia N900? > >> >> > >> >> No, I'm waiting to hear an educated guess from Felipe on this one. > >> > >> about why peripheral mode doesn't work on n900 ? No idea. that's always > >> the default role of MUSB and last I checked, before stopping working on > >> this, BBB was working just fine. > >> > >> N900 is odd in that it has two PHYs (1701 handles data lines while > >> twl4030 handles power lines, IIRC), but peripheral should be working. > >> > >> The only reason for MUSB to not start would be that it's not detecting > >> VBUS being above session valid threshold, however twl4030 should have an > >> IRQ for that. > >> > >> What happens when cable is attached ? Any IRQs anywhere firing ? > >> > > > > Just to note, when I call echo peripheral > mode then detecting usb > > cable starts working and usb peripheral mode also works fine (also > > after disconnecting and connecting usb cable again). Read my first > > post in this thread, there are also some logs: > > https://lkml.org/lkml/2016/1/9/69 > > interesting... that softconnect interface looks odd. We _know_ the value > of softconnect from musb->softconnect. /me reads commit which added > it... Oh okay, that's only valid for host mode. Argh! softconnet bit is only valid for *peripheral* mode, but the bit is not set in this case, so the host will not be able to detect the device. Pali, Is this never worked or just broken recently? If latter, possible to git-bisect to find out which patch causes softconnect bit not set? Regards, -Bin. > > Okay, the session bit is _NOT_ set when it should be. Note that DevCtl > reads as 0x98. Bit 0 is Session bit and that's not set. MUSB _is_ in the > device mode (bit 7 set). > > For some reason DevCtl didn't get set. Care to add a print to > musb_gadget_pullup() to see when/if it's called ? > > BTW, Bin will be maintaining MUSB going forward. > > -- > balbi ^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: Nokia N900: musb is in wrong state after boot 2016-02-22 15:36 ` Bin Liu @ 2016-02-22 15:49 ` Adam Ford 0 siblings, 0 replies; 41+ messages in thread From: Adam Ford @ 2016-02-22 15:49 UTC (permalink / raw) To: Bin Liu Cc: Felipe Balbi, Pali Rohár, Tony Lindgren, joerg Reisenweber, Greg Kroah-Hartman, linux-usb, linux-kernel, linux-omap, Ivaylo Dimitrov, Sebastian Reichel, Aaro Koskinen, Pavel Machek, Nishanth Menon For what it's worth, I tried running the MUSB via the twl4030 on Linux-Next (I don't remember which snapshot), and it was broken for me on a DM3730 (OMAP 3630), but Kernel 4.4.2 worked. Are you using Linux-Next or one of the stable kernels? I can try again later this week with a newer linux-next when I have more time to see if it's still there. Once I realized the stable kernel worked, I stoped since I was just testing some device tree stuff. adam On Mon, Feb 22, 2016 at 9:36 AM, Bin Liu <b-liu@ti.com> wrote: > Hi, > > On Mon, Feb 22, 2016 at 10:54:21AM +0200, Felipe Balbi wrote: >> >> Hi, >> >> Pali Rohár <pali.rohar@gmail.com> writes: >> > On Monday 22 February 2016 09:31:50 Felipe Balbi wrote: >> >> Pali Rohár <pali.rohar@gmail.com> writes: >> >> >> >> > On Tuesday 26 January 2016 18:26:32 Tony Lindgren wrote: >> >> >> * Pali Rohár <pali.rohar@gmail.com> [160126 06:35]: >> >> >> > On Thursday 21 January 2016 12:30:13 Tony Lindgren wrote: >> >> >> > > * joerg Reisenweber <joerg@openmoko.org> [160121 11:35]: >> >> >> > > > On Thu 21 January 2016 11:21:13 Tony Lindgren wrote: >> >> >> > > > > Do you have some pointer >> >> >> > > > > to the "certain resistor value on ID to GND" spec? Is it >> >> >> > > > > maybe part of the carkit related parts of the USB spec? >> >> >> > > > >> >> >> > > > ""Three additional ID pin states are defined[4] at the nominal >> >> >> > > > resistance values of 124 kΩ, 68 kΩ, and 36.5 kΩ, with respect >> >> >> > > > to the ground pin. These permit the device to work with USB >> >> >> > > > Accessory Charger Adapters that allows the OTG device to be >> >> >> > > > attached to both a charger and another device simultaneously. >> >> >> > > > [6]"" >> >> >> > > > https://en.wikipedia.org/wiki/USB_On-The-Go#OTG_micro_plugs >> >> >> > > >> >> >> > > OK thanks. So it's the "accessory charger" part of the >> >> >> > > battery charging specification 1.1. >> >> >> > >> >> >> > So, Tony, do you have some idea what needs to be changed and how to >> >> >> > fix peripheral mode after boot on Nokia N900? >> >> >> >> >> >> No, I'm waiting to hear an educated guess from Felipe on this one. >> >> >> >> about why peripheral mode doesn't work on n900 ? No idea. that's always >> >> the default role of MUSB and last I checked, before stopping working on >> >> this, BBB was working just fine. >> >> >> >> N900 is odd in that it has two PHYs (1701 handles data lines while >> >> twl4030 handles power lines, IIRC), but peripheral should be working. >> >> >> >> The only reason for MUSB to not start would be that it's not detecting >> >> VBUS being above session valid threshold, however twl4030 should have an >> >> IRQ for that. >> >> >> >> What happens when cable is attached ? Any IRQs anywhere firing ? >> >> >> > >> > Just to note, when I call echo peripheral > mode then detecting usb >> > cable starts working and usb peripheral mode also works fine (also >> > after disconnecting and connecting usb cable again). Read my first >> > post in this thread, there are also some logs: >> > https://lkml.org/lkml/2016/1/9/69 >> >> interesting... that softconnect interface looks odd. We _know_ the value >> of softconnect from musb->softconnect. /me reads commit which added >> it... Oh okay, that's only valid for host mode. Argh! > > softconnet bit is only valid for *peripheral* mode, but the bit is not > set in this case, so the host will not be able to detect the device. > > Pali, > > Is this never worked or just broken recently? If latter, possible to > git-bisect to find out which patch causes softconnect bit not set? > > Regards, > -Bin. > >> >> Okay, the session bit is _NOT_ set when it should be. Note that DevCtl >> reads as 0x98. Bit 0 is Session bit and that's not set. MUSB _is_ in the >> device mode (bit 7 set). >> >> For some reason DevCtl didn't get set. Care to add a print to >> musb_gadget_pullup() to see when/if it's called ? >> >> BTW, Bin will be maintaining MUSB going forward. >> >> -- >> balbi > > > -- > 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 ^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: Nokia N900: musb is in wrong state after boot 2016-01-21 19:21 ` Tony Lindgren 2016-01-21 19:34 ` joerg Reisenweber @ 2016-01-23 12:57 ` Pali Rohár 2016-05-29 10:38 ` Pali Rohár 1 sibling, 1 reply; 41+ messages in thread From: Pali Rohár @ 2016-01-23 12:57 UTC (permalink / raw) To: Tony Lindgren Cc: joerg Reisenweber, Felipe Balbi, Greg Kroah-Hartman, linux-usb, linux-kernel, linux-omap, Ivaylo Dimitrov, Sebastian Reichel, Aaro Koskinen, Pavel Machek, Nishanth Menon [-- Attachment #1.1: Type: Text/Plain, Size: 2981 bytes --] On Thursday 21 January 2016 20:21:13 Tony Lindgren wrote: > * joerg Reisenweber <joerg@openmoko.org> [160121 10:45]: > > On Thu 21 January 2016 09:41:46 Tony Lindgren wrote: > > > Then for supporting the USB host mode.. We should add regulator > > > support to the USB PHY driver so if the ID pin is grounded, the > > > PHY driver enables the VBUS regulator. That too seems to need > > > some coordination between the drivers/phy/phy-twl4030-usb.c and > > > 1707 driver if the ID pin interrupt is only detected in > > > drivers/phy/phy-twl4030-usb.c. > > > > Note that, while this is probably a good thing to do, it needs to > > be sufficiently loose coupling to allow user to 'intercept' this > > VBOOS regulator enabling and instead allow device charging while > > in externally powered hostmode. There's even a spec for this in > > USB-docs-foo iirc, something along a certain resistor value on ID > > to GND - alas I guess the twl4030 is not capable to detect such > > sophisticated signaling, and anyway it's always desirable to allow > > user to manually override the VBOOST and enable VBUS-charging > > while in hostmode. > > OK, I think this is what's happening with the Motorola LapDock BTW. > It always feeds the VBUS, well most of the time. Do you have some > pointer to the "certain resistor value on ID to GND" spec? Is it > maybe part of the carkit related parts of the USB spec? > > > On N900 the situation is even more complex since the 1707 doesn't > > support genuine ID detection, neither does it support emulated ID > > grounding. And there's no other method than a ID=GND message from > > PHY to musb core to make the musb core state engine transfer into > > proper hostmode. Thus my H-E-N hostmode botch abuses debug flags > > to force the musb core into a "emulated" hostmode and this mode > > doesn't support USB speed detection. Thus speed settings are > > forced onto musb core and PHY by software, and the musb core speed > > bits are only effective before session enabled. > > Bottom line: you need VBUS to try and negotiate speed with the > > attached device in hostmode, but to actually set this speed you > > detected by software means, you need to disable and discharge VBUS > > again, or musb core won't care about the speed you set. To be > > utterly clear: unconditional enabling of VBUS in ID=GND won't > > work. > > > > This is quite complex and it's questionable if it could get handled > > reasonably in kernel space. *Very* N900 specific niche solution, > > I'd not think it's suited for upstreaming. > > Yeah OK. I think we should be able to support the aux VBUS regulator > part with mainline kernel though. > > Regards, > > Tony Hello, attached patch for musb debugfs adds option to force both hostmode with speed. It is just example, I tested only compilation. Something like that will be needed for usb host mode on Nokia N900. -- Pali Rohár pali.rohar@gmail.com [-- Attachment #1.2: 0001-musb-debugfs-Add-support-in-testmode-for-forcing-hos.patch --] [-- Type: text/x-patch, Size: 3256 bytes --] From fd67b58e3538c0732750ecad915cde736da099dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <pali.rohar@gmail.com> Date: Sat, 9 Jan 2016 16:57:59 +0100 Subject: [PATCH] musb: debugfs: Add support in testmode for forcing host mode together with speed --- drivers/usb/musb/musb_debugfs.c | 44 +++++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/drivers/usb/musb/musb_debugfs.c b/drivers/usb/musb/musb_debugfs.c index 9b22d94..62c13a2 100644 --- a/drivers/usb/musb/musb_debugfs.c +++ b/drivers/usb/musb/musb_debugfs.c @@ -147,28 +147,34 @@ static int musb_test_mode_show(struct seq_file *s, void *unused) test = musb_readb(musb->mregs, MUSB_TESTMODE); - if (test & MUSB_TEST_FORCE_HOST) + if (test & (MUSB_TEST_FORCE_HOST | MUSB_TEST_FORCE_FS)) + seq_printf(s, "force host full-speed\n"); + + else if (test & (MUSB_TEST_FORCE_HOST | MUSB_TEST_FORCE_HS)) + seq_printf(s, "force host high-speed\n"); + + else if (test & MUSB_TEST_FORCE_HOST) seq_printf(s, "force host\n"); - if (test & MUSB_TEST_FIFO_ACCESS) + else if (test & MUSB_TEST_FIFO_ACCESS) seq_printf(s, "fifo access\n"); - if (test & MUSB_TEST_FORCE_FS) + else if (test & MUSB_TEST_FORCE_FS) seq_printf(s, "force full-speed\n"); - if (test & MUSB_TEST_FORCE_HS) + else if (test & MUSB_TEST_FORCE_HS) seq_printf(s, "force high-speed\n"); - if (test & MUSB_TEST_PACKET) + else if (test & MUSB_TEST_PACKET) seq_printf(s, "test packet\n"); - if (test & MUSB_TEST_K) + else if (test & MUSB_TEST_K) seq_printf(s, "test K\n"); - if (test & MUSB_TEST_J) + else if (test & MUSB_TEST_J) seq_printf(s, "test J\n"); - if (test & MUSB_TEST_SE0_NAK) + else if (test & MUSB_TEST_SE0_NAK) seq_printf(s, "test SE0 NAK\n"); return 0; @@ -206,30 +212,36 @@ static ssize_t musb_test_mode_write(struct file *file, if (copy_from_user(buf, ubuf, min_t(size_t, sizeof(buf) - 1, count))) return -EFAULT; - if (strstarts(buf, "force host")) + if (strstarts(buf, "force host full-speed")) + test = MUSB_TEST_FORCE_HOST | MUSB_TEST_FORCE_FS; + + else if (strstarts(buf, "force host high-speed")) + test = MUSB_TEST_FORCE_HOST | MUSB_TEST_FORCE_HS; + + else if (strstarts(buf, "force host")) test = MUSB_TEST_FORCE_HOST; - if (strstarts(buf, "fifo access")) + else if (strstarts(buf, "fifo access")) test = MUSB_TEST_FIFO_ACCESS; - if (strstarts(buf, "force full-speed")) + else if (strstarts(buf, "force full-speed")) test = MUSB_TEST_FORCE_FS; - if (strstarts(buf, "force high-speed")) + else if (strstarts(buf, "force high-speed")) test = MUSB_TEST_FORCE_HS; - if (strstarts(buf, "test packet")) { + else if (strstarts(buf, "test packet")) { test = MUSB_TEST_PACKET; musb_load_testpacket(musb); } - if (strstarts(buf, "test K")) + else if (strstarts(buf, "test K")) test = MUSB_TEST_K; - if (strstarts(buf, "test J")) + else if (strstarts(buf, "test J")) test = MUSB_TEST_J; - if (strstarts(buf, "test SE0 NAK")) + else if (strstarts(buf, "test SE0 NAK")) test = MUSB_TEST_SE0_NAK; musb_writeb(musb->mregs, MUSB_TESTMODE, test); -- 1.7.9.5 [-- Attachment #2: This is a digitally signed message part. --] [-- Type: application/pgp-signature, Size: 198 bytes --] ^ permalink raw reply related [flat|nested] 41+ messages in thread
* Re: Nokia N900: musb is in wrong state after boot 2016-01-23 12:57 ` Pali Rohár @ 2016-05-29 10:38 ` Pali Rohár 2016-06-07 12:50 ` Pali Rohár 2016-06-09 20:58 ` Bin Liu 0 siblings, 2 replies; 41+ messages in thread From: Pali Rohár @ 2016-05-29 10:38 UTC (permalink / raw) To: Tony Lindgren Cc: joerg Reisenweber, Felipe Balbi, Greg Kroah-Hartman, linux-usb, linux-kernel, linux-omap, Ivaylo Dimitrov, Sebastian Reichel, Aaro Koskinen, Pavel Machek, Nishanth Menon On Saturday 23 January 2016 13:57:32 Pali Rohár wrote: > On Thursday 21 January 2016 20:21:13 Tony Lindgren wrote: > > * joerg Reisenweber <joerg@openmoko.org> [160121 10:45]: > > > On Thu 21 January 2016 09:41:46 Tony Lindgren wrote: > > > > Then for supporting the USB host mode.. We should add regulator > > > > support to the USB PHY driver so if the ID pin is grounded, the > > > > PHY driver enables the VBUS regulator. That too seems to need > > > > some coordination between the drivers/phy/phy-twl4030-usb.c and > > > > 1707 driver if the ID pin interrupt is only detected in > > > > drivers/phy/phy-twl4030-usb.c. > > > > > > Note that, while this is probably a good thing to do, it needs to > > > be sufficiently loose coupling to allow user to 'intercept' this > > > VBOOS regulator enabling and instead allow device charging while > > > in externally powered hostmode. There's even a spec for this in > > > USB-docs-foo iirc, something along a certain resistor value on ID > > > to GND - alas I guess the twl4030 is not capable to detect such > > > sophisticated signaling, and anyway it's always desirable to allow > > > user to manually override the VBOOST and enable VBUS-charging > > > while in hostmode. > > > > OK, I think this is what's happening with the Motorola LapDock BTW. > > It always feeds the VBUS, well most of the time. Do you have some > > pointer to the "certain resistor value on ID to GND" spec? Is it > > maybe part of the carkit related parts of the USB spec? > > > > > On N900 the situation is even more complex since the 1707 doesn't > > > support genuine ID detection, neither does it support emulated ID > > > grounding. And there's no other method than a ID=GND message from > > > PHY to musb core to make the musb core state engine transfer into > > > proper hostmode. Thus my H-E-N hostmode botch abuses debug flags > > > to force the musb core into a "emulated" hostmode and this mode > > > doesn't support USB speed detection. Thus speed settings are > > > forced onto musb core and PHY by software, and the musb core speed > > > bits are only effective before session enabled. > > > Bottom line: you need VBUS to try and negotiate speed with the > > > attached device in hostmode, but to actually set this speed you > > > detected by software means, you need to disable and discharge VBUS > > > again, or musb core won't care about the speed you set. To be > > > utterly clear: unconditional enabling of VBUS in ID=GND won't > > > work. > > > > > > This is quite complex and it's questionable if it could get handled > > > reasonably in kernel space. *Very* N900 specific niche solution, > > > I'd not think it's suited for upstreaming. > > > > Yeah OK. I think we should be able to support the aux VBUS regulator > > part with mainline kernel though. > > > > Regards, > > > > Tony > > Hello, attached patch for musb debugfs adds option to force both > hostmode with speed. It is just example, I tested only compilation. > > Something like that will be needed for usb host mode on Nokia N900. > > -- > Pali Rohár > pali.rohar@gmail.com > From fd67b58e3538c0732750ecad915cde736da099dc Mon Sep 17 00:00:00 2001 > From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <pali.rohar@gmail.com> > Date: Sat, 9 Jan 2016 16:57:59 +0100 > Subject: [PATCH] musb: debugfs: Add support in testmode for forcing host mode > together with speed > > --- > drivers/usb/musb/musb_debugfs.c | 44 +++++++++++++++++++++++++-------------- > 1 file changed, 28 insertions(+), 16 deletions(-) > > diff --git a/drivers/usb/musb/musb_debugfs.c b/drivers/usb/musb/musb_debugfs.c > index 9b22d94..62c13a2 100644 > --- a/drivers/usb/musb/musb_debugfs.c > +++ b/drivers/usb/musb/musb_debugfs.c > @@ -147,28 +147,34 @@ static int musb_test_mode_show(struct seq_file *s, void *unused) > > test = musb_readb(musb->mregs, MUSB_TESTMODE); > > - if (test & MUSB_TEST_FORCE_HOST) > + if (test & (MUSB_TEST_FORCE_HOST | MUSB_TEST_FORCE_FS)) > + seq_printf(s, "force host full-speed\n"); > + > + else if (test & (MUSB_TEST_FORCE_HOST | MUSB_TEST_FORCE_HS)) > + seq_printf(s, "force host high-speed\n"); > + > + else if (test & MUSB_TEST_FORCE_HOST) > seq_printf(s, "force host\n"); > > - if (test & MUSB_TEST_FIFO_ACCESS) > + else if (test & MUSB_TEST_FIFO_ACCESS) > seq_printf(s, "fifo access\n"); > > - if (test & MUSB_TEST_FORCE_FS) > + else if (test & MUSB_TEST_FORCE_FS) > seq_printf(s, "force full-speed\n"); > > - if (test & MUSB_TEST_FORCE_HS) > + else if (test & MUSB_TEST_FORCE_HS) > seq_printf(s, "force high-speed\n"); > > - if (test & MUSB_TEST_PACKET) > + else if (test & MUSB_TEST_PACKET) > seq_printf(s, "test packet\n"); > > - if (test & MUSB_TEST_K) > + else if (test & MUSB_TEST_K) > seq_printf(s, "test K\n"); > > - if (test & MUSB_TEST_J) > + else if (test & MUSB_TEST_J) > seq_printf(s, "test J\n"); > > - if (test & MUSB_TEST_SE0_NAK) > + else if (test & MUSB_TEST_SE0_NAK) > seq_printf(s, "test SE0 NAK\n"); > > return 0; > @@ -206,30 +212,36 @@ static ssize_t musb_test_mode_write(struct file *file, > if (copy_from_user(buf, ubuf, min_t(size_t, sizeof(buf) - 1, count))) > return -EFAULT; > > - if (strstarts(buf, "force host")) > + if (strstarts(buf, "force host full-speed")) > + test = MUSB_TEST_FORCE_HOST | MUSB_TEST_FORCE_FS; > + > + else if (strstarts(buf, "force host high-speed")) > + test = MUSB_TEST_FORCE_HOST | MUSB_TEST_FORCE_HS; > + > + else if (strstarts(buf, "force host")) > test = MUSB_TEST_FORCE_HOST; > > - if (strstarts(buf, "fifo access")) > + else if (strstarts(buf, "fifo access")) > test = MUSB_TEST_FIFO_ACCESS; > > - if (strstarts(buf, "force full-speed")) > + else if (strstarts(buf, "force full-speed")) > test = MUSB_TEST_FORCE_FS; > > - if (strstarts(buf, "force high-speed")) > + else if (strstarts(buf, "force high-speed")) > test = MUSB_TEST_FORCE_HS; > > - if (strstarts(buf, "test packet")) { > + else if (strstarts(buf, "test packet")) { > test = MUSB_TEST_PACKET; > musb_load_testpacket(musb); > } > > - if (strstarts(buf, "test K")) > + else if (strstarts(buf, "test K")) > test = MUSB_TEST_K; > > - if (strstarts(buf, "test J")) > + else if (strstarts(buf, "test J")) > test = MUSB_TEST_J; > > - if (strstarts(buf, "test SE0 NAK")) > + else if (strstarts(buf, "test SE0 NAK")) > test = MUSB_TEST_SE0_NAK; > > musb_writeb(musb->mregs, MUSB_TESTMODE, test); > -- > 1.7.9.5 > Tony, what do you think about that patch? -- Pali Rohár pali.rohar@gmail.com ^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: Nokia N900: musb is in wrong state after boot 2016-05-29 10:38 ` Pali Rohár @ 2016-06-07 12:50 ` Pali Rohár 2016-06-08 9:53 ` Tony Lindgren 2016-06-09 20:58 ` Bin Liu 1 sibling, 1 reply; 41+ messages in thread From: Pali Rohár @ 2016-06-07 12:50 UTC (permalink / raw) To: Tony Lindgren Cc: joerg Reisenweber, Felipe Balbi, Greg Kroah-Hartman, linux-usb, linux-kernel, linux-omap, Ivaylo Dimitrov, Sebastian Reichel, Aaro Koskinen, Pavel Machek, Nishanth Menon On Sunday 29 May 2016 12:38:24 Pali Rohár wrote: > > From fd67b58e3538c0732750ecad915cde736da099dc Mon Sep 17 00:00:00 2001 > > From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <pali.rohar@gmail.com> > > Date: Sat, 9 Jan 2016 16:57:59 +0100 > > Subject: [PATCH] musb: debugfs: Add support in testmode for forcing host mode > > together with speed > > > > --- > > drivers/usb/musb/musb_debugfs.c | 44 +++++++++++++++++++++++++-------------- > > 1 file changed, 28 insertions(+), 16 deletions(-) > > > > diff --git a/drivers/usb/musb/musb_debugfs.c b/drivers/usb/musb/musb_debugfs.c > > index 9b22d94..62c13a2 100644 > > --- a/drivers/usb/musb/musb_debugfs.c > > +++ b/drivers/usb/musb/musb_debugfs.c > > @@ -147,28 +147,34 @@ static int musb_test_mode_show(struct seq_file *s, void *unused) > > > > test = musb_readb(musb->mregs, MUSB_TESTMODE); > > > > - if (test & MUSB_TEST_FORCE_HOST) > > + if (test & (MUSB_TEST_FORCE_HOST | MUSB_TEST_FORCE_FS)) > > + seq_printf(s, "force host full-speed\n"); > > + > > + else if (test & (MUSB_TEST_FORCE_HOST | MUSB_TEST_FORCE_HS)) > > + seq_printf(s, "force host high-speed\n"); > > + > > + else if (test & MUSB_TEST_FORCE_HOST) > > seq_printf(s, "force host\n"); > > > > - if (test & MUSB_TEST_FIFO_ACCESS) > > + else if (test & MUSB_TEST_FIFO_ACCESS) > > seq_printf(s, "fifo access\n"); > > > > - if (test & MUSB_TEST_FORCE_FS) > > + else if (test & MUSB_TEST_FORCE_FS) > > seq_printf(s, "force full-speed\n"); > > > > - if (test & MUSB_TEST_FORCE_HS) > > + else if (test & MUSB_TEST_FORCE_HS) > > seq_printf(s, "force high-speed\n"); > > > > - if (test & MUSB_TEST_PACKET) > > + else if (test & MUSB_TEST_PACKET) > > seq_printf(s, "test packet\n"); > > > > - if (test & MUSB_TEST_K) > > + else if (test & MUSB_TEST_K) > > seq_printf(s, "test K\n"); > > > > - if (test & MUSB_TEST_J) > > + else if (test & MUSB_TEST_J) > > seq_printf(s, "test J\n"); > > > > - if (test & MUSB_TEST_SE0_NAK) > > + else if (test & MUSB_TEST_SE0_NAK) > > seq_printf(s, "test SE0 NAK\n"); > > > > return 0; > > @@ -206,30 +212,36 @@ static ssize_t musb_test_mode_write(struct file *file, > > if (copy_from_user(buf, ubuf, min_t(size_t, sizeof(buf) - 1, count))) > > return -EFAULT; > > > > - if (strstarts(buf, "force host")) > > + if (strstarts(buf, "force host full-speed")) > > + test = MUSB_TEST_FORCE_HOST | MUSB_TEST_FORCE_FS; > > + > > + else if (strstarts(buf, "force host high-speed")) > > + test = MUSB_TEST_FORCE_HOST | MUSB_TEST_FORCE_HS; > > + > > + else if (strstarts(buf, "force host")) > > test = MUSB_TEST_FORCE_HOST; > > > > - if (strstarts(buf, "fifo access")) > > + else if (strstarts(buf, "fifo access")) > > test = MUSB_TEST_FIFO_ACCESS; > > > > - if (strstarts(buf, "force full-speed")) > > + else if (strstarts(buf, "force full-speed")) > > test = MUSB_TEST_FORCE_FS; > > > > - if (strstarts(buf, "force high-speed")) > > + else if (strstarts(buf, "force high-speed")) > > test = MUSB_TEST_FORCE_HS; > > > > - if (strstarts(buf, "test packet")) { > > + else if (strstarts(buf, "test packet")) { > > test = MUSB_TEST_PACKET; > > musb_load_testpacket(musb); > > } > > > > - if (strstarts(buf, "test K")) > > + else if (strstarts(buf, "test K")) > > test = MUSB_TEST_K; > > > > - if (strstarts(buf, "test J")) > > + else if (strstarts(buf, "test J")) > > test = MUSB_TEST_J; > > > > - if (strstarts(buf, "test SE0 NAK")) > > + else if (strstarts(buf, "test SE0 NAK")) > > test = MUSB_TEST_SE0_NAK; > > > > musb_writeb(musb->mregs, MUSB_TESTMODE, test); > > -- > > 1.7.9.5 > > > > Tony, what do you think about that patch? > Tony, PING -- Pali Rohár pali.rohar@gmail.com ^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: Nokia N900: musb is in wrong state after boot 2016-06-07 12:50 ` Pali Rohár @ 2016-06-08 9:53 ` Tony Lindgren 2016-06-08 10:02 ` Felipe Balbi 0 siblings, 1 reply; 41+ messages in thread From: Tony Lindgren @ 2016-06-08 9:53 UTC (permalink / raw) To: Pali Rohár Cc: joerg Reisenweber, Felipe Balbi, Greg Kroah-Hartman, linux-usb, linux-kernel, linux-omap, Ivaylo Dimitrov, Sebastian Reichel, Aaro Koskinen, Pavel Machek, Nishanth Menon * Pali Rohár <pali.rohar@gmail.com> [160607 05:53]: > > Tony, what do you think about that patch? > > > > Tony, PING Yeah I don't know, AFAIK we don't have a generic way to force MUSB to change mode without ID pin. If you have figured something generic for that which does not actually tinker with the PHY registers directly, that should be the generic musb_set_mode() that we've been wondering about for years. Maybe split the patches to the mode change and then the sysfs entry fixes and repost to linux-usb and linux-omap and make sure Bin as the new musb maintainer is included :) The custom sysfs flags we should maintain support for naturally. Regards, Tony ^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: Nokia N900: musb is in wrong state after boot 2016-06-08 9:53 ` Tony Lindgren @ 2016-06-08 10:02 ` Felipe Balbi 2016-06-08 10:19 ` Pali Rohár ` (3 more replies) 0 siblings, 4 replies; 41+ messages in thread From: Felipe Balbi @ 2016-06-08 10:02 UTC (permalink / raw) To: Tony Lindgren, Pali Rohár Cc: joerg Reisenweber, Felipe Balbi, Greg Kroah-Hartman, linux-usb, linux-kernel, linux-omap, Ivaylo Dimitrov, Sebastian Reichel, Aaro Koskinen, Pavel Machek, Nishanth Menon [-- Attachment #1: Type: text/plain, Size: 651 bytes --] Hi, Tony Lindgren <tony@atomide.com> writes: > * Pali Rohár <pali.rohar@gmail.com> [160607 05:53]: >> > Tony, what do you think about that patch? >> > >> >> Tony, PING > > Yeah I don't know, AFAIK we don't have a generic way to > force MUSB to change mode without ID pin. If you have figured > something generic for that which does not actually tinker with > the PHY registers directly, that should be the generic > musb_set_mode() that we've been wondering about for years. #define MUSB_TEST_FORCE_HOST 0x80 Can someone confirm on MUSB's docs (and actual running system) that this does what's supposed to do? -- balbi [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 818 bytes --] ^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: Nokia N900: musb is in wrong state after boot 2016-06-08 10:02 ` Felipe Balbi @ 2016-06-08 10:19 ` Pali Rohár 2016-06-08 10:20 ` joerg Reisenweber ` (2 subsequent siblings) 3 siblings, 0 replies; 41+ messages in thread From: Pali Rohár @ 2016-06-08 10:19 UTC (permalink / raw) To: Felipe Balbi Cc: Tony Lindgren, joerg Reisenweber, Felipe Balbi, Greg Kroah-Hartman, linux-usb, linux-kernel, linux-omap, Ivaylo Dimitrov, Sebastian Reichel, Aaro Koskinen, Pavel Machek, Nishanth Menon [-- Attachment #1: Type: Text/Plain, Size: 1126 bytes --] On Wednesday 08 June 2016 12:02:00 Felipe Balbi wrote: > Hi, > > Tony Lindgren <tony@atomide.com> writes: > > * Pali Rohár <pali.rohar@gmail.com> [160607 05:53]: > >> > Tony, what do you think about that patch? > >> > >> Tony, PING > > > > Yeah I don't know, AFAIK we don't have a generic way to > > force MUSB to change mode without ID pin. If you have figured > > something generic for that which does not actually tinker with > > the PHY registers directly, that should be the generic > > musb_set_mode() that we've been wondering about for years. > > #define MUSB_TEST_FORCE_HOST 0x80 > > Can someone confirm on MUSB's docs (and actual running system) that > this does what's supposed to do? Maybe this can help you: https://garage.maemo.org/plugins/ggit/browse.php/?p=kernel-power;a=blob;f=kernel-power-2.6.28/debian/patches/usbhostmode.diff Patch for 2.6.28 omap1 kernel which adds usb host mode support for Nokia N900. Look for MUSB_TESTMODE, MUSB_TEST_FORCE_HOST is called together with MUSB_TEST_FORCE_FS or MUSB_TEST_FORCE_HS (line 355). -- Pali Rohár pali.rohar@gmail.com [-- Attachment #2: This is a digitally signed message part. --] [-- Type: application/pgp-signature, Size: 198 bytes --] ^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: Nokia N900: musb is in wrong state after boot 2016-06-08 10:02 ` Felipe Balbi 2016-06-08 10:19 ` Pali Rohár @ 2016-06-08 10:20 ` joerg Reisenweber 2016-06-08 12:04 ` Sergei Shtylyov 2016-06-09 21:09 ` Bin Liu 3 siblings, 0 replies; 41+ messages in thread From: joerg Reisenweber @ 2016-06-08 10:20 UTC (permalink / raw) To: Felipe Balbi Cc: Tony Lindgren, Pali Rohár, Felipe Balbi, Greg Kroah-Hartman, linux-usb, linux-kernel, linux-omap, Ivaylo Dimitrov, Sebastian Reichel, Aaro Koskinen, Pavel Machek, Nishanth Menon [-- Attachment #1: Type: text/plain, Size: 929 bytes --] On Wed 08 June 2016 13:02:00 Felipe Balbi wrote: > Hi, > > Tony Lindgren <tony@atomide.com> writes: > > Yeah I don't know, AFAIK we don't have a generic way to > > force MUSB to change mode without ID pin. If you have figured > #define MUSB_TEST_FORCE_HOST 0x80 > > Can someone confirm on MUSB's docs (and actual running system) that this > does what's supposed to do? (disclaimer: all IIRC) Alas it doesn't, at least for the MentorGraphics MUSB in OMAP3. We use MUSB_TEST_FORCE_HOST in the H-E-N N900 hostmode hack (http://talk.maemo.org/showthread.php?p=696115) and it's really just a test thing that doesn't support full hostmode as we know it. There is definitely no other way to force the state machine in MUSB core into hostmode, than the "ID pin grounded" message from PHY via ULPI bus up to the MUSB, whether it's real or *sw-triggered by a command to PHY*. Shame on the MUSB core design for this. /jOERG [-- Attachment #2: This is a digitally signed message part. --] [-- Type: application/pgp-signature, Size: 198 bytes --] ^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: Nokia N900: musb is in wrong state after boot 2016-06-08 10:02 ` Felipe Balbi 2016-06-08 10:19 ` Pali Rohár 2016-06-08 10:20 ` joerg Reisenweber @ 2016-06-08 12:04 ` Sergei Shtylyov 2016-06-08 12:18 ` joerg Reisenweber 2016-06-09 21:09 ` Bin Liu 3 siblings, 1 reply; 41+ messages in thread From: Sergei Shtylyov @ 2016-06-08 12:04 UTC (permalink / raw) To: Felipe Balbi, Tony Lindgren, Pali Rohár Cc: joerg Reisenweber, Felipe Balbi, Greg Kroah-Hartman, linux-usb, linux-kernel, linux-omap, Ivaylo Dimitrov, Sebastian Reichel, Aaro Koskinen, Pavel Machek, Nishanth Menon On 6/8/2016 1:02 PM, Felipe Balbi wrote: >> * Pali Rohár <pali.rohar@gmail.com> [160607 05:53]: >>>> Tony, what do you think about that patch? >>>> >>> >>> Tony, PING >> >> Yeah I don't know, AFAIK we don't have a generic way to >> force MUSB to change mode without ID pin. If you have figured >> something generic for that which does not actually tinker with >> the PHY registers directly, that should be the generic >> musb_set_mode() that we've been wondering about for years. > > #define MUSB_TEST_FORCE_HOST 0x80 > > Can someone confirm on MUSB's docs (and actual running system) that this > does what's supposed to do? The MUSB programmer's guide says the CID (sic) input is ignored when the Force_Host bit is set. The host mode is entered when the Session bit is set. But I don't have a MUSB hardware readily available to confirm. MBR, Sergei ^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: Nokia N900: musb is in wrong state after boot 2016-06-08 12:04 ` Sergei Shtylyov @ 2016-06-08 12:18 ` joerg Reisenweber 2016-06-08 12:32 ` Sergei Shtylyov 0 siblings, 1 reply; 41+ messages in thread From: joerg Reisenweber @ 2016-06-08 12:18 UTC (permalink / raw) To: Sergei Shtylyov Cc: Felipe Balbi, Tony Lindgren, Pali Rohár, Felipe Balbi, Greg Kroah-Hartman, linux-usb, linux-kernel, linux-omap, Ivaylo Dimitrov, Sebastian Reichel, Aaro Koskinen, Pavel Machek, Nishanth Menon On Wed 08 June 2016 15:04:02 Sergei Shtylyov wrote: > On 6/8/2016 1:02 PM, Felipe Balbi wrote: > >> * Pali Rohár <pali.rohar@gmail.com> [160607 05:53]: > >>>> Tony, what do you think about that patch? > >>> > >>> Tony, PING > >> > >> Yeah I don't know, AFAIK we don't have a generic way to > >> force MUSB to change mode without ID pin. If you have figured > >> something generic for that which does not actually tinker with > >> the PHY registers directly, that should be the generic > >> musb_set_mode() that we've been wondering about for years. > > > > #define MUSB_TEST_FORCE_HOST 0x80 > > > > Can someone confirm on MUSB's docs (and actual running system) that this > > does what's supposed to do? > > The MUSB programmer's guide says the CID (sic) input is ignored when the > Force_Host bit is set. The host mode is entered when the Session bit is > set. But I don't have a MUSB hardware readily available to confirm. > > MBR, Sergei also says: While the FORCE_HOST bit remains set, the core will enter Host mode when the Session bit is set and **remain in Host mode until the Session bit is cleared even if a connected device is disconnected during the session.** The operating speed while in this mode **is determined for the setting of the FORCE_HS and FORCE_FS bits of the Testmode register** in Section 23.1.4.11. see http://talk.maemo.org/showthread.php?p=685367 It's not any fully operational hostmode. /j -- () ascii ribbon campaign /\ against html e-mail - against proprietary attachments http://www.georgedillon.com/web/html_email_is_evil.shtml http://www.nonhtmlmail.org/campaign.html http://www.georgedillon.com/web/html_email_is_evil_still.shtml http://www.gerstbach.at/2004/ascii/ (German) ^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: Nokia N900: musb is in wrong state after boot 2016-06-08 12:18 ` joerg Reisenweber @ 2016-06-08 12:32 ` Sergei Shtylyov 0 siblings, 0 replies; 41+ messages in thread From: Sergei Shtylyov @ 2016-06-08 12:32 UTC (permalink / raw) To: joerg Reisenweber Cc: Felipe Balbi, Tony Lindgren, Pali Rohár, Felipe Balbi, Greg Kroah-Hartman, linux-usb, linux-kernel, linux-omap, Ivaylo Dimitrov, Sebastian Reichel, Aaro Koskinen, Pavel Machek, Nishanth Menon On 6/8/2016 3:18 PM, joerg Reisenweber wrote: >>>>>> Tony, what do you think about that patch? >>>>> >>>>> Tony, PING >>>> >>>> Yeah I don't know, AFAIK we don't have a generic way to >>>> force MUSB to change mode without ID pin. If you have figured >>>> something generic for that which does not actually tinker with >>>> the PHY registers directly, that should be the generic >>>> musb_set_mode() that we've been wondering about for years. >>> >>> #define MUSB_TEST_FORCE_HOST 0x80 >>> >>> Can someone confirm on MUSB's docs (and actual running system) that this >>> does what's supposed to do? >> >> The MUSB programmer's guide says the CID (sic) input is ignored when the >> Force_Host bit is set. The host mode is entered when the Session bit is >> set. But I don't have a MUSB hardware readily available to confirm. >> >> MBR, Sergei > > also says: > > While the FORCE_HOST bit remains set, the core will enter Host mode when the > Session bit is set and **remain in Host mode until the Session bit is cleared > even if a connected device is disconnected during the session.** > The operating speed while in this mode **is determined for the setting of the > FORCE_HS and FORCE_FS bits of the Testmode register** in Section 23.1.4.11. Yeah, the MUSB PG says the same. [...] > /j MBR, Sergei ^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: Nokia N900: musb is in wrong state after boot 2016-06-08 10:02 ` Felipe Balbi ` (2 preceding siblings ...) 2016-06-08 12:04 ` Sergei Shtylyov @ 2016-06-09 21:09 ` Bin Liu 3 siblings, 0 replies; 41+ messages in thread From: Bin Liu @ 2016-06-09 21:09 UTC (permalink / raw) To: Felipe Balbi Cc: Tony Lindgren, Pali Rohár, joerg Reisenweber, Felipe Greg Kroah-Hartman, linux-usb, linux-kernel, linux-omap, Ivaylo Dimitrov, Sebastian Reichel, Aaro Koskinen, Pavel Machek, Nishanth Menon Hi, On Wed, Jun 08, 2016 at 01:02:00PM +0300, Felipe Balbi wrote: > > Hi, > > Tony Lindgren <tony@atomide.com> writes: > > * Pali Rohár <pali.rohar@gmail.com> [160607 05:53]: > >> > Tony, what do you think about that patch? > >> > > >> > >> Tony, PING > > > > Yeah I don't know, AFAIK we don't have a generic way to > > force MUSB to change mode without ID pin. If you have figured > > something generic for that which does not actually tinker with > > the PHY registers directly, that should be the generic > > musb_set_mode() that we've been wondering about for years. > > #define MUSB_TEST_FORCE_HOST 0x80 > > Can someone confirm on MUSB's docs (and actual running system) that this > does what's supposed to do? I don't know what to expect while setting this bit. I am never able to get musb to enumerate anything or does anything which a host suppose to do. Regards, -Bin. ^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: Nokia N900: musb is in wrong state after boot 2016-05-29 10:38 ` Pali Rohár 2016-06-07 12:50 ` Pali Rohár @ 2016-06-09 20:58 ` Bin Liu 2016-06-09 21:25 ` joerg Reisenweber 1 sibling, 1 reply; 41+ messages in thread From: Bin Liu @ 2016-06-09 20:58 UTC (permalink / raw) To: Pali Rohár Cc: Tony Lindgren, joerg Reisenweber, Greg Kroah-Hartman, linux-usb, linux-kernel, linux-omap, Ivaylo Dimitrov, Sebastian Reichel, Aaro Koskinen, Pavel Machek, Nishanth Menon, Felipe Balbi Hi, On Sun, May 29, 2016 at 12:38:24PM +0200, Pali Rohár wrote: > > Hello, attached patch for musb debugfs adds option to force both > > hostmode with speed. It is just example, I tested only compilation. > > > > Something like that will be needed for usb host mode on Nokia N900. > > > > -- > > Pali Rohár > > pali.rohar@gmail.com > > > From fd67b58e3538c0732750ecad915cde736da099dc Mon Sep 17 00:00:00 2001 > > From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <pali.rohar@gmail.com> > > Date: Sat, 9 Jan 2016 16:57:59 +0100 > > Subject: [PATCH] musb: debugfs: Add support in testmode for forcing host mode > > together with speed > > > > --- > > drivers/usb/musb/musb_debugfs.c | 44 +++++++++++++++++++++++++-------------- > > 1 file changed, 28 insertions(+), 16 deletions(-) > > > > diff --git a/drivers/usb/musb/musb_debugfs.c b/drivers/usb/musb/musb_debugfs.c > > index 9b22d94..62c13a2 100644 > > --- a/drivers/usb/musb/musb_debugfs.c > > +++ b/drivers/usb/musb/musb_debugfs.c > > @@ -147,28 +147,34 @@ static int musb_test_mode_show(struct seq_file *s, void *unused) > > > > test = musb_readb(musb->mregs, MUSB_TESTMODE); > > > > - if (test & MUSB_TEST_FORCE_HOST) > > + if (test & (MUSB_TEST_FORCE_HOST | MUSB_TEST_FORCE_FS)) > > + seq_printf(s, "force host full-speed\n"); > > + > > + else if (test & (MUSB_TEST_FORCE_HOST | MUSB_TEST_FORCE_HS)) > > + seq_printf(s, "force host high-speed\n"); > > + > > + else if (test & MUSB_TEST_FORCE_HOST) > > seq_printf(s, "force host\n"); > > > > - if (test & MUSB_TEST_FIFO_ACCESS) > > + else if (test & MUSB_TEST_FIFO_ACCESS) > > seq_printf(s, "fifo access\n"); > > > > - if (test & MUSB_TEST_FORCE_FS) > > + else if (test & MUSB_TEST_FORCE_FS) > > seq_printf(s, "force full-speed\n"); > > > > - if (test & MUSB_TEST_FORCE_HS) > > + else if (test & MUSB_TEST_FORCE_HS) > > seq_printf(s, "force high-speed\n"); > > > > - if (test & MUSB_TEST_PACKET) > > + else if (test & MUSB_TEST_PACKET) > > seq_printf(s, "test packet\n"); > > > > - if (test & MUSB_TEST_K) > > + else if (test & MUSB_TEST_K) > > seq_printf(s, "test K\n"); > > > > - if (test & MUSB_TEST_J) > > + else if (test & MUSB_TEST_J) > > seq_printf(s, "test J\n"); > > > > - if (test & MUSB_TEST_SE0_NAK) > > + else if (test & MUSB_TEST_SE0_NAK) > > seq_printf(s, "test SE0 NAK\n"); > > > > return 0; > > @@ -206,30 +212,36 @@ static ssize_t musb_test_mode_write(struct file *file, > > if (copy_from_user(buf, ubuf, min_t(size_t, sizeof(buf) - 1, count))) > > return -EFAULT; > > > > - if (strstarts(buf, "force host")) > > + if (strstarts(buf, "force host full-speed")) > > + test = MUSB_TEST_FORCE_HOST | MUSB_TEST_FORCE_FS; > > + > > + else if (strstarts(buf, "force host high-speed")) > > + test = MUSB_TEST_FORCE_HOST | MUSB_TEST_FORCE_HS; > > + > > + else if (strstarts(buf, "force host")) > > test = MUSB_TEST_FORCE_HOST; > > > > - if (strstarts(buf, "fifo access")) > > + else if (strstarts(buf, "fifo access")) > > test = MUSB_TEST_FIFO_ACCESS; > > > > - if (strstarts(buf, "force full-speed")) > > + else if (strstarts(buf, "force full-speed")) > > test = MUSB_TEST_FORCE_FS; > > > > - if (strstarts(buf, "force high-speed")) > > + else if (strstarts(buf, "force high-speed")) > > test = MUSB_TEST_FORCE_HS; > > > > - if (strstarts(buf, "test packet")) { > > + else if (strstarts(buf, "test packet")) { > > test = MUSB_TEST_PACKET; > > musb_load_testpacket(musb); > > } > > > > - if (strstarts(buf, "test K")) > > + else if (strstarts(buf, "test K")) > > test = MUSB_TEST_K; > > > > - if (strstarts(buf, "test J")) > > + else if (strstarts(buf, "test J")) > > test = MUSB_TEST_J; > > > > - if (strstarts(buf, "test SE0 NAK")) > > + else if (strstarts(buf, "test SE0 NAK")) > > test = MUSB_TEST_SE0_NAK; > > > > musb_writeb(musb->mregs, MUSB_TESTMODE, test); > > -- > > 1.7.9.5 > > > > Tony, what do you think about that patch? Based on the musb ug, force_host bit is allowed to be set along with force_hs or force_fs bit. So please resend this patch with subject changed to the following, and I will take it. The current suject makes is sound like a new feature rather than a bugfix. "usb: musb: debugfs: allow forcing host mode together with speed in testmode" But I am not sure how this will fix n900 host mode problem, since testmode is not used in normal operation. Regards, -Bin. ^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: Nokia N900: musb is in wrong state after boot 2016-06-09 20:58 ` Bin Liu @ 2016-06-09 21:25 ` joerg Reisenweber 2016-06-10 15:08 ` Bin Liu 0 siblings, 1 reply; 41+ messages in thread From: joerg Reisenweber @ 2016-06-09 21:25 UTC (permalink / raw) To: Bin Liu Cc: Pali Rohár, Tony Lindgren, Greg Kroah-Hartman, linux-usb, linux-kernel, linux-omap, Ivaylo Dimitrov, Sebastian Reichel, Aaro Koskinen, Pavel Machek, Nishanth Menon, Felipe Balbi [-- Attachment #1: Type: text/plain, Size: 730 bytes --] On Thu 09 June 2016 15:58:56 Bin Liu wrote: > But I am not sure how this will fix n900 host mode problem, since > testmode is not used in normal operation. Please see http://talk.maemo.org/showthread.php?p=685367 and http://maemo.org/packages/view/hostmode-gui/ which indeed is _no_ normal hostmode but an implementation of a workaround that exploits the force host test mode (among others) /jOERG -- () ascii ribbon campaign /\ against html e-mail - against proprietary attachments http://www.georgedillon.com/web/html_email_is_evil.shtml http://www.nonhtmlmail.org/campaign.html http://www.georgedillon.com/web/html_email_is_evil_still.shtml http://www.gerstbach.at/2004/ascii/ (German) [-- Attachment #2: This is a digitally signed message part. --] [-- Type: application/pgp-signature, Size: 198 bytes --] ^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: Nokia N900: musb is in wrong state after boot 2016-06-09 21:25 ` joerg Reisenweber @ 2016-06-10 15:08 ` Bin Liu 2016-06-10 15:23 ` joerg Reisenweber 0 siblings, 1 reply; 41+ messages in thread From: Bin Liu @ 2016-06-10 15:08 UTC (permalink / raw) To: joerg Reisenweber Cc: Pali Rohár, Tony Lindgren, Greg Kroah-Hartman, linux-usb, linux-kernel, linux-omap, Ivaylo Dimitrov, Sebastian Reichel, Aaro Koskinen, Pavel Machek, Nishanth Menon, Felipe Balbi Hi, On Thu, Jun 09, 2016 at 11:25:57PM +0200, joerg Reisenweber wrote: > On Thu 09 June 2016 15:58:56 Bin Liu wrote: > > But I am not sure how this will fix n900 host mode problem, since > > testmode is not used in normal operation. > > Please see http://talk.maemo.org/showthread.php?p=685367 and > http://maemo.org/packages/view/hostmode-gui/ which indeed is _no_ normal > hostmode but an implementation of a workaround that exploits the force host > test mode (among others) What I meant was that it is okay for hobby, but you don't want to something that the IP vender does not support in real products. Regards, -Bin. ^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: Nokia N900: musb is in wrong state after boot 2016-06-10 15:08 ` Bin Liu @ 2016-06-10 15:23 ` joerg Reisenweber 2016-06-10 15:59 ` Bin Liu 0 siblings, 1 reply; 41+ messages in thread From: joerg Reisenweber @ 2016-06-10 15:23 UTC (permalink / raw) To: Bin Liu Cc: Pali Rohár, Tony Lindgren, Greg Kroah-Hartman, linux-usb, linux-kernel, linux-omap, Ivaylo Dimitrov, Sebastian Reichel, Aaro Koskinen, Pavel Machek, Nishanth Menon, Felipe Balbi On Fri 10 June 2016 10:08:08 Bin Liu wrote: > Hi, > > On Thu, Jun 09, 2016 at 11:25:57PM +0200, joerg Reisenweber wrote: > > On Thu 09 June 2016 15:58:56 Bin Liu wrote: > > > But I am not sure how this will fix n900 host mode problem, since > > > testmode is not used in normal operation. > > > > Please see http://talk.maemo.org/showthread.php?p=685367 and > > http://maemo.org/packages/view/hostmode-gui/ which indeed is _no_ normal > > hostmode but an implementation of a workaround that exploits the force > > host > > test mode (among others) > > What I meant was that it is okay for hobby, but you don't want to > something that the IP vender does not support in real products. You lost me. > > > But I am not sure how this will fix n900 host mode problem http://maemo.org/packages/view/hostmode-gui/ and the associated kernel patches for FORCE_HOSTMODE _is_ how we 'fix' the N900 hostmode problem (see https://www.youtube.com/watch?v=fkCDyUO0sKQ for a proof) /j -- () ascii ribbon campaign /\ against html e-mail - against proprietary attachments http://www.georgedillon.com/web/html_email_is_evil.shtml http://www.nonhtmlmail.org/campaign.html http://www.georgedillon.com/web/html_email_is_evil_still.shtml http://www.gerstbach.at/2004/ascii/ (German) ^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: Nokia N900: musb is in wrong state after boot 2016-06-10 15:23 ` joerg Reisenweber @ 2016-06-10 15:59 ` Bin Liu 2016-06-10 16:15 ` joerg Reisenweber 0 siblings, 1 reply; 41+ messages in thread From: Bin Liu @ 2016-06-10 15:59 UTC (permalink / raw) To: joerg Reisenweber Cc: Pali Rohár, Tony Lindgren, Greg Kroah-Hartman, linux-usb, linux-kernel, linux-omap, Ivaylo Dimitrov, Sebastian Reichel, Aaro Koskinen, Pavel Machek, Nishanth Menon, Felipe Balbi Hi, On Fri, Jun 10, 2016 at 05:23:11PM +0200, joerg Reisenweber wrote: > On Fri 10 June 2016 10:08:08 Bin Liu wrote: > > Hi, > > > > On Thu, Jun 09, 2016 at 11:25:57PM +0200, joerg Reisenweber wrote: > > > On Thu 09 June 2016 15:58:56 Bin Liu wrote: > > > > But I am not sure how this will fix n900 host mode problem, since > > > > testmode is not used in normal operation. > > > > > > Please see http://talk.maemo.org/showthread.php?p=685367 and > > > http://maemo.org/packages/view/hostmode-gui/ which indeed is _no_ normal > > > hostmode but an implementation of a workaround that exploits the force > > > host > > > test mode (among others) > > > > What I meant was that it is okay for hobby, but you don't want to > > something that the IP vender does not support in real products. > > > You lost me. Sorry. The musb ug says the testmde is not used in normal operation, so my opinion is force_host should not be used for hacking n900 host mode if this is for real product development or support. Regards, -Bin. ^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: Nokia N900: musb is in wrong state after boot 2016-06-10 15:59 ` Bin Liu @ 2016-06-10 16:15 ` joerg Reisenweber 2016-06-10 17:04 ` Nishanth Menon 2016-06-10 17:37 ` Bin Liu 0 siblings, 2 replies; 41+ messages in thread From: joerg Reisenweber @ 2016-06-10 16:15 UTC (permalink / raw) To: Bin Liu Cc: Pali Rohár, Tony Lindgren, Greg Kroah-Hartman, linux-usb, linux-kernel, linux-omap, Ivaylo Dimitrov, Sebastian Reichel, Aaro Koskinen, Pavel Machek, Nishanth Menon, Felipe Balbi On Fri 10 June 2016 10:59:40 Bin Liu wrote: > The musb ug says the testmde is not used in normal operation, so my > opinion is force_host should not be used for hacking n900 host mode if > this is for real product development or support. You're aware N900 OS aka maemo is a) FOSS, and b) EOL at least from Nokia's POV? So there's neither "product development" nor any _'official'_ support involved. And c) we (community) already _did_ use it since it was the only chance to make hostmode sort of work for N900, it's not like we could redesign N900 hardware to support regular hostmode, we need to work with what RL gave us. It evades me why you discourage resp reject this established solution. Just Nokia not supporting hostmode evidently doesn't mean we can't get anything done, and I don't see why we should refrain from doing so. /j -- () ascii ribbon campaign /\ against html e-mail - against proprietary attachments http://www.georgedillon.com/web/html_email_is_evil.shtml http://www.nonhtmlmail.org/campaign.html http://www.georgedillon.com/web/html_email_is_evil_still.shtml http://www.gerstbach.at/2004/ascii/ (German) ^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: Nokia N900: musb is in wrong state after boot 2016-06-10 16:15 ` joerg Reisenweber @ 2016-06-10 17:04 ` Nishanth Menon 2016-06-10 17:21 ` joerg Reisenweber 2016-06-10 17:37 ` Bin Liu 1 sibling, 1 reply; 41+ messages in thread From: Nishanth Menon @ 2016-06-10 17:04 UTC (permalink / raw) To: joerg Reisenweber, Bin Liu Cc: Pali Rohár, Tony Lindgren, Greg Kroah-Hartman, linux-usb, linux-kernel, linux-omap, Ivaylo Dimitrov, Sebastian Reichel, Aaro Koskinen, Pavel Machek, Felipe Balbi On 06/10/2016 11:15 AM, joerg Reisenweber wrote: Sorry for butting in... > On Fri 10 June 2016 10:59:40 Bin Liu wrote: >> The musb ug says the testmde is not used in normal operation, so my >> opinion is force_host should not be used for hacking n900 host mode if >> this is for real product development or support. > > You're aware N900 OS aka maemo is a) FOSS, and b) EOL at least from Nokia's > POV? So there's neither "product development" nor any _'official'_ support > involved. > And c) we (community) already _did_ use it since it was the only chance to > make hostmode sort of work for N900, it's not like we could redesign N900 > hardware to support regular hostmode, we need to work with what RL gave us. > It evades me why you discourage resp reject this established solution. > Just Nokia not supporting hostmode evidently doesn't mean we can't get > anything done, and I don't see why we should refrain from doing so. I think there was some unfortunately choice of words used in the thread. It is TI intention to support community effort and we are very appreciative of the work and effort done by the N900 community. Please do not misunderstand that we dont care for FOSS community, in fact, we are part of the FOSS community as well and a significant investment is done to ensure that "upstream first" approach is taken to benefit everyone. Hopefully with that out of the way, on this specific topic, based on a quick chat with Bin, I think Bin meant to indicate that as per Mentor vendor documentation, the option is a test mode meant for silicon validation purposes - typically many vendor hardware blocks have these "test mode" bits and options meant to help silicon validation software, unfortunately these modes do not tend to be well tested and the typical "official disclaimer" is "Not for 'production device usage' and 'user might be on his/her own' " - That does not mean it cannot work, but it may not always be working OR can have reliability issues/open up unknown silicon issues that has not been well covered by SoC and/or IP vendor. In this case specifically, I think Bin's experience of having had tried to get this working in AM335x and had failed makes him a little more skeptical. I think Bin has accepted this patch, but anyways, it is always good to highlight potential risk. I assume Bin can elaborate more as needed. Post Note: We all do appreciate all the creative ways folks do use TI SoCs, it is important we try and continue do that to leverage every single transistor that the SoC has, but we should also just keep a watch for any potential risks we might have to face with these options we exploit. -- Regards, Nishanth Menon ^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: Nokia N900: musb is in wrong state after boot 2016-06-10 17:04 ` Nishanth Menon @ 2016-06-10 17:21 ` joerg Reisenweber 0 siblings, 0 replies; 41+ messages in thread From: joerg Reisenweber @ 2016-06-10 17:21 UTC (permalink / raw) To: Nishanth Menon Cc: Bin Liu, Pali Rohár, Tony Lindgren, Greg Kroah-Hartman, linux-usb, linux-kernel, linux-omap, Ivaylo Dimitrov, Sebastian Reichel, Aaro Koskinen, Pavel Machek, Felipe Balbi On Fri 10 June 2016 12:04:43 Nishanth Menon wrote: > I think there was some unfortunately choice of words used in the > thread. It is TI intention to support community effort [...] > software, unfortunately these modes do not tend to be well tested and > the typical "official disclaimer" is "Not for 'production device > usage' and 'user might be on his/her own' " Understood, agreed and appreciated, many thanks! :-) I didn't mean to suggest this as the recommended way to implement hostmode on arbitrary devices, we just had to find a way to fix a hw-flaw in N900 platform. Odds are this N900 specific H-E-N botch won't work on any other platform ever. Best Regards jOERG -- () ascii ribbon campaign /\ against html e-mail - against proprietary attachments http://www.georgedillon.com/web/html_email_is_evil.shtml http://www.nonhtmlmail.org/campaign.html http://www.georgedillon.com/web/html_email_is_evil_still.shtml http://www.gerstbach.at/2004/ascii/ (German) ^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: Nokia N900: musb is in wrong state after boot 2016-06-10 16:15 ` joerg Reisenweber 2016-06-10 17:04 ` Nishanth Menon @ 2016-06-10 17:37 ` Bin Liu 1 sibling, 0 replies; 41+ messages in thread From: Bin Liu @ 2016-06-10 17:37 UTC (permalink / raw) To: joerg Reisenweber Cc: Pali Rohár, Tony Lindgren, Greg Kroah-Hartman, linux-usb, linux-kernel, linux-omap, Ivaylo Dimitrov, Sebastian Reichel, Aaro Koskinen, Pavel Machek, Nishanth Menon, Felipe Balbi Hi, On Fri, Jun 10, 2016 at 06:15:26PM +0200, joerg Reisenweber wrote: > On Fri 10 June 2016 10:59:40 Bin Liu wrote: > > The musb ug says the testmde is not used in normal operation, so my > > opinion is force_host should not be used for hacking n900 host mode if > > this is for real product development or support. > > You're aware N900 OS aka maemo is a) FOSS, and b) EOL at least from Nokia's > POV? So there's neither "product development" nor any _'official'_ support > involved. > And c) we (community) already _did_ use it since it was the only chance to > make hostmode sort of work for N900, it's not like we could redesign N900 > hardware to support regular hostmode, we need to work with what RL gave us. Well, misunderstanding does happening as Nishanth warned me offline :( > It evades me why you discourage resp reject this established solution. Not sure how you concluded I reject this. Instead I am taking patches. The only thing I did was warning that if you use force_host testmode in normal operation in your 'products', you would get liability problem. > Just Nokia not supporting hostmode evidently doesn't mean we can't get > anything done, and I don't see why we should refrain from doing so. Regards, -Bin. ^ permalink raw reply [flat|nested] 41+ messages in thread
end of thread, other threads:[~2016-06-10 17:39 UTC | newest] Thread overview: 41+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2016-01-09 15:16 Nokia N900: musb is in wrong state after boot Pali Rohár 2016-01-19 20:33 ` Tony Lindgren 2016-01-21 8:40 ` Pali Rohár 2016-01-21 9:57 ` Ivaylo Dimitrov 2016-01-21 10:23 ` Pali Rohár 2016-01-21 10:27 ` Ivaylo Dimitrov 2016-01-21 10:29 ` joerg Reisenweber 2016-01-21 17:41 ` Tony Lindgren 2016-01-21 18:44 ` joerg Reisenweber 2016-01-21 19:21 ` Tony Lindgren 2016-01-21 19:34 ` joerg Reisenweber 2016-01-21 20:30 ` Tony Lindgren 2016-01-26 14:34 ` Pali Rohár 2016-01-26 17:26 ` Tony Lindgren 2016-02-21 11:12 ` Pali Rohár 2016-02-22 7:31 ` Felipe Balbi 2016-02-22 8:34 ` Pali Rohár 2016-02-22 8:54 ` Felipe Balbi 2016-02-22 8:54 ` Felipe Balbi 2016-02-22 15:36 ` Bin Liu 2016-02-22 15:49 ` Adam Ford 2016-01-23 12:57 ` Pali Rohár 2016-05-29 10:38 ` Pali Rohár 2016-06-07 12:50 ` Pali Rohár 2016-06-08 9:53 ` Tony Lindgren 2016-06-08 10:02 ` Felipe Balbi 2016-06-08 10:19 ` Pali Rohár 2016-06-08 10:20 ` joerg Reisenweber 2016-06-08 12:04 ` Sergei Shtylyov 2016-06-08 12:18 ` joerg Reisenweber 2016-06-08 12:32 ` Sergei Shtylyov 2016-06-09 21:09 ` Bin Liu 2016-06-09 20:58 ` Bin Liu 2016-06-09 21:25 ` joerg Reisenweber 2016-06-10 15:08 ` Bin Liu 2016-06-10 15:23 ` joerg Reisenweber 2016-06-10 15:59 ` Bin Liu 2016-06-10 16:15 ` joerg Reisenweber 2016-06-10 17:04 ` Nishanth Menon 2016-06-10 17:21 ` joerg Reisenweber 2016-06-10 17:37 ` Bin Liu
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).