Skip to contentSkip to conversation

Nokia N900: musb is in wrong state after boot

DISCUSSION Pali Rohár 10 participants 41 messages Jan 9, 2016 – Jun 10, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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...

Signature · 2 lines
Pali Rohár
[email protected]
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:~# 
#1 lore raw

Hi,

Quoted 9 lines · Pali Rohár

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 

Quoted 4 lines

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
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw
Quoted 14 lines · On Tuesday 19 January 2016 12:33:15 Tony Lindgren wrote:

Hi,

Quoted 9 lines · Pali Rohár

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 
Quoted 5 lines
Quoted 3 lines

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?

Quoted 3 lines

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 :-(

Quoted 6 lines

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

Signature · 2 lines
Pali Rohár
[email protected]
#4 lore raw
Quoted 4 lines · On Thursday 21 January 2016 11:57:48 Ivaylo Dimitrov wrote:
Quoted 1 line · Pali Rohár
Quoted 8 lines
Quoted 5 lines

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.

Signature · 2 lines
Pali Rohár
[email protected]
#5 lore raw
Quoted 5 lines · Pali Rohár

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

#6 lore raw
In reply to Pali Rohár
Quoted 15 lines · On Thu 21 January 2016 09:40:07 Pali Rohár wrote:
Quoted 14 lines · On Tuesday 19 January 2016 12:33:15 Tony Lindgren wrote:

Hi,

Quoted 11 lines · Pali Rohár

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
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines

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.

Quoted 4 lines

I do not know now. I tried to find it in N900 schemantics, but do not see it.

Quoted 14 lines

CCing Joerg, do you know?

Quoted 3 lines

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 :-(

Quoted 6 lines

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

Signature · 7 lines
()  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)
#7 lore raw
Quoted 20 lines · joerg Reisenweber
Quoted 19 lines · On Thu 21 January 2016 09:40:07 Pali Rohár wrote:
Quoted 18 lines · On Tuesday 19 January 2016 12:33:15 Tony Lindgren wrote:

Hi,

Quoted 14 lines · Pali Rohár

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.

Quoted 6 lines
Quoted 1 line
Quoted 1 line

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.

Quoted 10 lines

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.

Quoted 4 lines

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

#8 lore raw
Quoted 5 lines · 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

Signature · 7 lines
()  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)
#9 lore raw
Quoted 7 lines · joerg Reisenweber
Quoted 5 lines · 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.

Quoted 8 lines

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?

Quoted 14 lines

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.

Quoted 3 lines

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

#10 lore raw
Quoted 3 lines · 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

Signature · 7 lines
()  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)
#11 lore raw
Quoted 11 lines · joerg Reisenweber
Quoted 3 lines · 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

#12 lore raw
Quoted 13 lines · On Thursday 21 January 2016 12:30:13 Tony Lindgren wrote:
Quoted 11 lines · joerg Reisenweber
Quoted 3 lines · 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

Quoted 2 lines

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.

Signature · 2 lines
Pali Rohár
[email protected]
#13 lore raw
Quoted 14 lines · Pali Rohár
Quoted 13 lines · On Thursday 21 January 2016 12:30:13 Tony Lindgren wrote:
Quoted 11 lines · joerg Reisenweber
Quoted 3 lines · 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

Quoted 5 lines
Quoted 2 lines

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.

Quoted 5 lines

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

#14 lore raw
Quoted 16 lines · On Tuesday 26 January 2016 18:26:32 Tony Lindgren wrote:
Quoted 15 lines · Pali Rohár
Quoted 14 lines · On Thursday 21 January 2016 12:30:13 Tony Lindgren wrote:
Quoted 12 lines · joerg Reisenweber
Quoted 3 lines · 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

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

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.

Quoted 11 lines
Quoted 5 lines

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

Signature · 2 lines
Pali Rohár
[email protected]
#15 lore raw
Quoted 17 lines · Pali Rohár
Quoted 16 lines · On Tuesday 26 January 2016 18:26:32 Tony Lindgren wrote:
Quoted 15 lines · Pali Rohár
Quoted 14 lines · On Thursday 21 January 2016 12:30:13 Tony Lindgren wrote:
Quoted 12 lines · joerg Reisenweber
Quoted 3 lines · 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

Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

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 ?

Signature · 1 line
balbi
#16 lore raw
Quoted 31 lines · On Monday 22 February 2016 09:31:50 Felipe Balbi wrote:
Quoted 17 lines · Pali Rohár
Quoted 16 lines · On Tuesday 26 January 2016 18:26:32 Tony Lindgren wrote:
Quoted 15 lines · Pali Rohár
Quoted 14 lines · On Thursday 21 January 2016 12:30:13 Tony Lindgren wrote:
Quoted 12 lines · joerg Reisenweber
Quoted 3 lines · 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

Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

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.

Quoted 9 lines

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

Signature · 2 lines
Pali Rohár
[email protected]
#17 lore raw

Hi,

Quoted 39 lines · Pali Rohár
Quoted 38 lines · On Monday 22 February 2016 09:31:50 Felipe Balbi wrote:
Quoted 17 lines · Pali Rohár
Quoted 16 lines · On Tuesday 26 January 2016 18:26:32 Tony Lindgren wrote:
Quoted 15 lines · Pali Rohár
Quoted 14 lines · On Thursday 21 January 2016 12:30:13 Tony Lindgren wrote:
Quoted 12 lines · joerg Reisenweber
Quoted 3 lines · 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

Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

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.

Quoted 8 lines
Quoted 2 lines

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.

Signature · 1 line
balbi
#18 lore raw
In reply to Pali Rohár

Hi,

Quoted 39 lines · Pali Rohár
Quoted 38 lines · On Monday 22 February 2016 09:31:50 Felipe Balbi wrote:
Quoted 17 lines · Pali Rohár
Quoted 16 lines · On Tuesday 26 January 2016 18:26:32 Tony Lindgren wrote:
Quoted 15 lines · Pali Rohár
Quoted 14 lines · On Thursday 21 January 2016 12:30:13 Tony Lindgren wrote:
Quoted 12 lines · joerg Reisenweber
Quoted 3 lines · 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

Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

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.

Quoted 8 lines
Quoted 2 lines

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.

Signature · 1 line
balbi
maintainer
#19 lore raw

Hi,

Quoted 52 lines · Felipe Balbi

Hi,

Quoted 39 lines · Pali Rohár
Quoted 38 lines · On Monday 22 February 2016 09:31:50 Felipe Balbi wrote:
Quoted 17 lines · Pali Rohár
Quoted 16 lines · On Tuesday 26 January 2016 18:26:32 Tony Lindgren wrote:
Quoted 15 lines · Pali Rohár
Quoted 14 lines · On Thursday 21 January 2016 12:30:13 Tony Lindgren wrote:
Quoted 12 lines · joerg Reisenweber
Quoted 3 lines · 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

Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

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.

Quoted 8 lines
Quoted 2 lines

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

Quoted 3 lines

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.

Quoted 12 lines

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.

Signature · 1 line
balbi
#20 lore raw

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

Quoted 80 lines · Bin Liu

Hi,

Quoted 52 lines · Felipe Balbi

Hi,

Quoted 39 lines · Pali Rohár
Quoted 38 lines · On Monday 22 February 2016 09:31:50 Felipe Balbi wrote:
Quoted 17 lines · Pali Rohár
Quoted 16 lines · On Tuesday 26 January 2016 18:26:32 Tony Lindgren wrote:
Quoted 15 lines · Pali Rohár
Quoted 14 lines · On Thursday 21 January 2016 12:30:13 Tony Lindgren wrote:
Quoted 12 lines · joerg Reisenweber
Quoted 3 lines · 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

Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

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.

Quoted 8 lines
Quoted 2 lines

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

Quoted 3 lines

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.

Quoted 10 lines

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.

Quoted 8 lines
Quoted 2 lines

--
balbi

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#21 lore raw
In reply to Tony Lindgren
Quoted 44 lines · On Thursday 21 January 2016 20:21:13 Tony Lindgren wrote:
Quoted 8 lines · joerg Reisenweber
Quoted 6 lines · 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.

Quoted 9 lines

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?

Quoted 16 lines

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.

Quoted 3 lines

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.

Quoted 6 lines

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.

Signature · 2 lines
Pali Rohár
[email protected]

From fd67b58e3538c0732750ecad915cde736da099dc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <[email protected]>
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(-)
drivers/usb/musb/musb_debugfs.c +28 -16
index 9b22d94..62c13a2 100644
@@ -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);
Signature · 1 line
1.7.9.5
#22 lore raw
Quoted 166 lines · On Saturday 23 January 2016 13:57:32 Pali Rohár wrote:
Quoted 44 lines · On Thursday 21 January 2016 20:21:13 Tony Lindgren wrote:
Quoted 8 lines · joerg Reisenweber
Quoted 6 lines · 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.

Quoted 9 lines

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?

Quoted 16 lines

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.

Quoted 3 lines

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.

Quoted 6 lines

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.

Signature · 12 lines
Pali Rohár
[email protected]

From fd67b58e3538c0732750ecad915cde736da099dc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <[email protected]>
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(-)
drivers/usb/musb/musb_debugfs.c +28 -16
index 9b22d94..62c13a2 100644
@@ -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);
Signature · 1 line
1.7.9.5

Tony, what do you think about that patch?

Signature · 6 lines
Pali Rohár
[email protected]
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#23 lore raw
Quoted 101 lines · On Sunday 29 May 2016 12:38:24 Pali Rohár wrote:
Quoted 101 lines

From fd67b58e3538c0732750ecad915cde736da099dc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <[email protected]>
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(-)
drivers/usb/musb/musb_debugfs.c +28 -16
index 9b22d94..62c13a2 100644
@@ -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;
 
Quoted 7 lines
Quoted 4 lines
drivers/usb/musb/musb_debugfs.c +0 -0
 	musb_writeb(musb->mregs, MUSB_TESTMODE, test);
Signature · 1 line
1.7.9.5

Tony, what do you think about that patch?

Tony, PING

Signature · 2 lines
Pali Rohár
[email protected]
#24 lore raw
Quoted 4 lines · Pali Rohár
Quoted 2 lines

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

#25 lore raw

Hi,

Quoted 11 lines · Tony Lindgren
Quoted 4 lines · Pali Rohár
Quoted 2 lines

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?

Signature · 1 line
balbi
#26 lore raw
Quoted 14 lines · On Wednesday 08 June 2016 12:02:00 Felipe Balbi wrote:

Hi,

Quoted 10 lines · Tony Lindgren
Quoted 3 lines · Pali Rohár
Quoted 1 line

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.

Quoted 4 lines

#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).

Signature · 2 lines
Pali Rohár
[email protected]
#27 lore raw
In reply to Felipe Balbi
Quoted 9 lines · On Wed 08 June 2016 13:02:00 Felipe Balbi wrote:

Hi,

Quoted 2 lines · Tony Lindgren

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

#28 lore raw
In reply to Felipe Balbi
Quoted 12 lines · Felipe Balbi
Quoted 11 lines · Pali Rohár
Quoted 4 lines
Quoted 2 lines

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.

Quoted 4 lines

#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

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#29 lore raw
Quoted 14 lines · On Wed 08 June 2016 15:04:02 Sergei Shtylyov wrote:
Quoted 13 lines · Felipe Balbi
Quoted 10 lines · Pali Rohár
Quoted 3 lines
Quoted 1 line

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

Quoted 8 lines
Quoted 2 lines

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

Signature · 12 lines
()  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)

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#30 lore raw
Quoted 21 lines · joerg Reisenweber
Quoted 12 lines
Quoted 12 lines
Quoted 9 lines
Quoted 3 lines
Quoted 1 line

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

Quoted 8 lines
Quoted 2 lines

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

Quoted 7 lines

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.

[...]

Quoted 1 line

/j

MBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

maintainer
#31 lore raw
In reply to Felipe Balbi

Hi,

Quoted 16 lines · Felipe Balbi

Hi,

Quoted 11 lines · Tony Lindgren
Quoted 4 lines · Pali Rohár
Quoted 2 lines

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.

Quoted 4 lines

#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.

maintainer
#32 lore raw
In reply to Pali Rohár

Hi,

Quoted 110 lines · Pali Rohár
Quoted 110 lines

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.

Signature · 12 lines
Pali Rohár
[email protected]

From fd67b58e3538c0732750ecad915cde736da099dc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <[email protected]>
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(-)
drivers/usb/musb/musb_debugfs.c +28 -16
index 9b22d94..62c13a2 100644
@@ -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;
 
Quoted 6 lines
Quoted 4 lines
drivers/usb/musb/musb_debugfs.c +0 -0
 	musb_writeb(musb->mregs, MUSB_TESTMODE, test);
Signature · 1 line
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.

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#33 lore raw
Quoted 2 lines · 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

Signature · 7 lines
()  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)
maintainer
#34 lore raw

Hi,

Quoted 8 lines · joerg Reisenweber
Quoted 2 lines · 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.

#35 lore raw
Quoted 7 lines · On Fri 10 June 2016 10:08:08 Bin Liu wrote:

Hi,

Quoted 4 lines · joerg Reisenweber
Quoted 2 lines · 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.

Quoted 8 lines
Quoted 5 lines

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.

Quoted 1 line
Quoted 1 line
Quoted 1 line

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

Signature · 7 lines
()  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)
maintainer
#36 lore raw

Hi,

Quoted 14 lines · joerg Reisenweber
Quoted 13 lines · On Fri 10 June 2016 10:08:08 Bin Liu wrote:

Hi,

Quoted 9 lines · joerg Reisenweber
Quoted 2 lines · 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)

Quoted 5 lines
Quoted 2 lines

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.

#37 lore raw
Quoted 3 lines · 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

Signature · 7 lines
()  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)
#38 lore raw

On 06/10/2016 11:15 AM, joerg Reisenweber wrote:

Sorry for butting in...

Quoted 5 lines · On Fri 10 June 2016 10:59:40 Bin Liu wrote:
Quoted 3 lines

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.

Quoted 9 lines

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.

Signature · 2 lines
Regards,
Nishanth Menon
#39 lore raw
Quoted 2 lines · 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

[...]

Quoted 3 lines

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

Signature · 12 lines
()  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)

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
maintainer
#40 lore raw
In reply to joerg Reisenweber

Hi,

Quoted 11 lines · joerg Reisenweber
Quoted 3 lines · 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 :(

Quoted 1 line

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.

Quoted 2 lines

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.