Skip to contentSkip to conversation

Help wanted with USB and OMAP3 off_mode

PATCH NeilBrown 4 participants 21 messages Jan 8, 2013 – Jan 17, 2013

Subsystems (2)
lore
Share & tools
lore

NeilBrown

author
#0 lore raw

Hi,
I'm trying to get off_mode working reliably on my gta04 mobile phone.

My current stumbling block is USB. The "Option" GSM module is attached via USB (there is a separate transceiver chip attached to port 1 which is placed in OMAP_EHCI_PORT_MODE_PHY).

After a suspend/resume cycle with off_mode enabled the GSM module disappears. i.e. 'lsusb' doesn't see it any more and the various ttyHSxx devices don't exist.
Without off mode, the modem always appears after resume.

I discovered that the registers set by:

drivers/mfd/omap-usb-host.c

are not maintained across as suspend/resume so I added the following patch (which I can make a formal submission of if it looks right to others), but that didn't help (or didn't help enough).

If I

echo 1 > /sys/kernel/debug/pm_debug/usbhost_pwrdm/suspend

thus keeping just the USBHOST power domain out of off_mode, the GSM module doesn't disappear. So it seems that some context in the usbhost domain is not being save and restored.

This is as far as I can get. Can someone suggest where I should look to find out what is not being saved/restored properly, and how to go about saving and restoring?

Thanks in advance,
NeilBrown

drivers/mfd/omap-usb-host.c +10 -0
index 23cec57..522405e 100644
@@ -100,6 +100,10 @@ struct usbhs_hcd_omap {
 
 	void __iomem			*uhh_base;
 
+	struct {
+		unsigned		hostconfig;
+	} context;
+
 	struct usbhs_omap_platform_data	platdata;
 
 	u32				usbhs_rev;
@@ -300,6 +304,10 @@ static int usbhs_runtime_resume(struct device *dev)
 	clk_enable(omap->utmi_p1_fck);
 	clk_enable(omap->utmi_p2_fck);
 
+	usbhs_write(omap->uhh_base,
+		    OMAP_UHH_HOSTCONFIG,
+		    omap->context.hostconfig);
+
 	spin_unlock_irqrestore(&omap->lock, flags);
 
 	return 0;
@@ -319,6 +327,8 @@ static int usbhs_runtime_suspend(struct device *dev)
 	}
 
 	spin_lock_irqsave(&omap->lock, flags);
+	omap->context.hostconfig = usbhs_read(omap->uhh_base,
+					      OMAP_UHH_HOSTCONFIG);
 
 	if (is_ehci_tll_mode(pdata->port_mode[0]))
 		clk_disable(omap->usbhost_p1_fck);
#1 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Neil,

Quoted 7 lines · NeilBrown

Hi,
I'm trying to get off_mode working reliably on my gta04 mobile phone.

My current stumbling block is USB. The "Option" GSM module is attached via USB (there is a separate transceiver chip attached to port 1 which is placed in OMAP_EHCI_PORT_MODE_PHY).

Which PHY is this (vendor/model)?

Quoted 58 lines

After a suspend/resume cycle with off_mode enabled the GSM module disappears. i.e. 'lsusb' doesn't see it any more and the various ttyHSxx devices don't exist.
Without off mode, the modem always appears after resume.

I discovered that the registers set by:

drivers/mfd/omap-usb-host.c

are not maintained across as suspend/resume so I added the following patch (which I can make a formal submission of if it looks right to others), but that didn't help (or didn't help enough).

If I

echo 1 > /sys/kernel/debug/pm_debug/usbhost_pwrdm/suspend

thus keeping just the USBHOST power domain out of off_mode, the GSM module doesn't disappear. So it seems that some context in the usbhost domain is not being save and restored.

This is as far as I can get. Can someone suggest where I should look to find out what is not being saved/restored properly, and how to go about saving and restoring?

Thanks in advance,
NeilBrown

drivers/mfd/omap-usb-host.c +8 -0
index 23cec57..522405e 100644
@@ -100,6 +100,10 @@ struct usbhs_hcd_omap {
 
 	void __iomem			*uhh_base;
 
+	struct {
+		unsigned		hostconfig;
+	} context;
+
 	struct usbhs_omap_platform_data	platdata;
 
 	u32				usbhs_rev;
@@ -300,6 +304,10 @@ static int usbhs_runtime_resume(struct device *dev)
 	clk_enable(omap->utmi_p1_fck);
 	clk_enable(omap->utmi_p2_fck);
 
+	usbhs_write(omap->uhh_base,
+		    OMAP_UHH_HOSTCONFIG,
+		    omap->context.hostconfig);
+
 	spin_unlock_irqrestore(&omap->lock, flags);
 
 	return 0;

drivers/mfd/omap-usb-host.c static int usbhs_runtime_suspend(struct device *dev) · line 334

Quoted 8 lines
drivers/mfd/omap-usb-host.c +2 -0
@@ -319,6 +327,8 @@ static int usbhs_runtime_suspend(struct device *dev)
 	}
 
 	spin_lock_irqsave(&omap->lock, flags);
+	omap->context.hostconfig = usbhs_read(omap->uhh_base,
+					      OMAP_UHH_HOSTCONFIG);
 
 	if (is_ehci_tll_mode(pdata->port_mode[0]))
 		clk_disable(omap->usbhost_p1_fck);

- --
Regards,
Igor.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJQ7T+kAAoJEBDE8YO64Efaj8YQAI5nOE9vvf8wxbu5IXTxaMxn 6B+g2m/zkMlyVNL5hTrwkPkP4CTBwvsGCZYkZT5JS3KM+R+TuyIX07+eM59Ie0Po u1CCn2XKZY2CP53b3nAtgk9Phxwruf5fDjEu9QiQapdUpbiTWmIn8W3CVye241O2 wXBKAXszX1bD81NFNY+Jm5Us5uGHNTtNtqe78Rng7BTvmaaNgE61PurFclgn0xQb IO5E7eyq7TG1u/IBhge2jlZGx2BbLcVsrQI3WyuE2L6F+MRgAKBDD7K8uHTfxPyM eXAk/u5tbA21t1mTIXk19N4c0YVgeFW2kKQOPShKywy9J6k3tE5LE4yUjooo4ZeS TlIf7HFcp15N3FfX90FOYsQOXILnoNL6a8SOK3gU+iVxZU/4VohKOXBlMjuZ7o10 5FnglPaHjsEaa1DgB/FcnYh3OO33mODJsckUhi5GiIlrbm70JspfWShZfln1k8FS SwClmyb6FCiqBOcRJ2uS1KTwObzYV9WeuPGCTXC5d4UBB57eRcGcX/NvSftV57mX jcSEle93kgZx1EiG53Vwd29oV9nU6SJECF7Q8CqulDEQVr76E7Xh8Z1CrsD+BhKe XuFa3zdtMg1SZO/ctcTIPPpElCVPF1FChX2lY9fCIdK2luHNrOs4GyrozCGXQcXO ZMFiiStsjr021CGqQUFw
=yIA2
-----END PGP SIGNATURE-----

author
#2 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 7 lines · On Wed, 09 Jan 2013 12:00:05 +0200 Igor Grinberg <[email protected]>…

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Neil,

Quoted 1 line · NeilBrown
Quoted 8 lines
Quoted 6 lines

Hi,
I'm trying to get off_mode working reliably on my gta04 mobile phone.

My current stumbling block is USB. The "Option" GSM module is attached via USB (there is a separate transceiver chip attached to port 1 which is placed in OMAP_EHCI_PORT_MODE_PHY).

Which PHY is this (vendor/model)?

Hi Igor,
it is the SMSC USB3322

http://www.smsc.com/media/Downloads_Public/Data_Sheets/3320.pdf

BTW I subsequently discovered that keeping USBHOST out off off_mode only sometimes avoid the problem, not always. So there are probably multiple issues :-(

NeilBrown

Quoted 75 lines
Quoted 59 lines

After a suspend/resume cycle with off_mode enabled the GSM module disappears. i.e. 'lsusb' doesn't see it any more and the various ttyHSxx devices don't exist.
Without off mode, the modem always appears after resume.

I discovered that the registers set by:

drivers/mfd/omap-usb-host.c

are not maintained across as suspend/resume so I added the following patch (which I can make a formal submission of if it looks right to others), but that didn't help (or didn't help enough).

If I

echo 1 > /sys/kernel/debug/pm_debug/usbhost_pwrdm/suspend

thus keeping just the USBHOST power domain out of off_mode, the GSM module doesn't disappear. So it seems that some context in the usbhost domain is not being save and restored.

This is as far as I can get. Can someone suggest where I should look to find out what is not being saved/restored properly, and how to go about saving and restoring?

Thanks in advance,
NeilBrown

drivers/mfd/omap-usb-host.c +8 -0
index 23cec57..522405e 100644
@@ -100,6 +100,10 @@ struct usbhs_hcd_omap {
 
 	void __iomem			*uhh_base;
 
+	struct {
+		unsigned		hostconfig;
+	} context;
+
 	struct usbhs_omap_platform_data	platdata;
 
 	u32				usbhs_rev;
@@ -300,6 +304,10 @@ static int usbhs_runtime_resume(struct device *dev)
 	clk_enable(omap->utmi_p1_fck);
 	clk_enable(omap->utmi_p2_fck);
 
+	usbhs_write(omap->uhh_base,
+		    OMAP_UHH_HOSTCONFIG,
+		    omap->context.hostconfig);
+
 	spin_unlock_irqrestore(&omap->lock, flags);
 
 	return 0;

drivers/mfd/omap-usb-host.c static int usbhs_runtime_suspend(struct device *dev) · line 334

Quoted 8 lines
drivers/mfd/omap-usb-host.c +2 -0
@@ -319,6 +327,8 @@ static int usbhs_runtime_suspend(struct device *dev)
 	}
 
 	spin_lock_irqsave(&omap->lock, flags);
+	omap->context.hostconfig = usbhs_read(omap->uhh_base,
+					      OMAP_UHH_HOSTCONFIG);
 
 	if (is_ehci_tll_mode(pdata->port_mode[0]))
 		clk_disable(omap->usbhost_p1_fck);

- --
Regards,
Igor.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

Quoted 14 lines

iQIcBAEBAgAGBQJQ7T+kAAoJEBDE8YO64Efaj8YQAI5nOE9vvf8wxbu5IXTxaMxn 6B+g2m/zkMlyVNL5hTrwkPkP4CTBwvsGCZYkZT5JS3KM+R+TuyIX07+eM59Ie0Po u1CCn2XKZY2CP53b3nAtgk9Phxwruf5fDjEu9QiQapdUpbiTWmIn8W3CVye241O2 wXBKAXszX1bD81NFNY+Jm5Us5uGHNTtNtqe78Rng7BTvmaaNgE61PurFclgn0xQb IO5E7eyq7TG1u/IBhge2jlZGx2BbLcVsrQI3WyuE2L6F+MRgAKBDD7K8uHTfxPyM eXAk/u5tbA21t1mTIXk19N4c0YVgeFW2kKQOPShKywy9J6k3tE5LE4yUjooo4ZeS TlIf7HFcp15N3FfX90FOYsQOXILnoNL6a8SOK3gU+iVxZU/4VohKOXBlMjuZ7o10 5FnglPaHjsEaa1DgB/FcnYh3OO33mODJsckUhi5GiIlrbm70JspfWShZfln1k8FS SwClmyb6FCiqBOcRJ2uS1KTwObzYV9WeuPGCTXC5d4UBB57eRcGcX/NvSftV57mX jcSEle93kgZx1EiG53Vwd29oV9nU6SJECF7Q8CqulDEQVr76E7Xh8Z1CrsD+BhKe XuFa3zdtMg1SZO/ctcTIPPpElCVPF1FChX2lY9fCIdK2luHNrOs4GyrozCGXQcXO ZMFiiStsjr021CGqQUFw
=yIA2
-----END PGP SIGNATURE-----

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (GNU/Linux)

iQIVAwUBUO1EMznsnt1WYoG5AQJ9Gg//Qwx5P/VjOi+9TDXIGr10OqldLEQKG4zv Dbwhw5l9DR85JIuF+m5xVXUe9IWJZ0UCasi61LtkRJVGW8U7Lv0O2mmXcYHoQ9zt diph8SVM9ZTh4SAaz2iiHeJ1Sqz0WkiZ47Kv1C0Q/n9MyFqKKG7Nxg5UAyAj39x4 pa8vsBGcPmwn5U/dUPQBxs3QKdp9aI3i2I6Q6vObRLYLJSvxAeXkGYfrmMy/NoZz RNhkLhVTajPCYTBcPw+zH06Pv8VF+i/UwFggnVl+uW+6LrIpKbaLa7CMntXmrSgz fi7y1LLiQuE7qK26IizLu/XIapb0tPGy28AebYwSbjFTaqHPNmlLAzyfww3lBteI PS76DulKiR4YX58v0KGKITcYLKK3mUliOETcWylot2eTyqbP9m0Y3nX57AEDi0+N FBBuoG4EKUQaLf5CnjF6ViMttUfvcfwL+Vrn+4VaYndS9S9w5IXTii5b1OcuhJaZ aGS+Tm/Mwa1uNQWBjujc/DdvwKZRrRilHTBH4w/rHRwxNTqKAxWmq72162efpxdR JxkHrPTEZZZwLewPXmTbD1+h50284apAw+D2PERFiB+Fh4ZVzsLIcBcUIZ3OT4L1 AlrqYC0wAS2RgjhvmveR360i8DS1SXMMafonrLhrwRu7oe1uzltKmnNX21Sp76vB gM5LIokwosA=
=8VnD
-----END PGP SIGNATURE-----

#3 lore raw

Hi Neil

Quoted 22 lines · NeilBrown
Quoted 7 lines · On Wed, 09 Jan 2013 12:00:05 +0200 Igor Grinberg <[email protected]>…

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Neil,

Quoted 1 line · NeilBrown
Quoted 8 lines
Quoted 6 lines

Hi,
I'm trying to get off_mode working reliably on my gta04 mobile phone.

My current stumbling block is USB. The "Option" GSM module is attached via USB (there is a separate transceiver chip attached to port 1 which is placed in OMAP_EHCI_PORT_MODE_PHY).

Which PHY is this (vendor/model)?

Hi Igor,
it is the SMSC USB3322

Quoted 6 lines

http://www.smsc.com/media/Downloads_Public/Data_Sheets/3320.pdf

BTW I subsequently discovered that keeping USBHOST out off off_mode only sometimes avoid the problem, not always. So there are probably multiple issues :-(

Are you sure that you don't have glitch on power, reset pin during suspend?

Michael

Quoted 78 lines

NeilBrown

Quoted 64 lines
Quoted 64 lines

After a suspend/resume cycle with off_mode enabled the GSM module disappears. i.e. 'lsusb' doesn't see it any more and the various ttyHSxx devices don't exist.
Without off mode, the modem always appears after resume.

I discovered that the registers set by:

drivers/mfd/omap-usb-host.c

are not maintained across as suspend/resume so I added the following patch (which I can make a formal submission of if it looks right to others), but that didn't help (or didn't help enough).

If I

echo 1 > /sys/kernel/debug/pm_debug/usbhost_pwrdm/suspend

thus keeping just the USBHOST power domain out of off_mode, the GSM module doesn't disappear. So it seems that some context in the usbhost domain is not being save and restored.

This is as far as I can get. Can someone suggest where I should look to find out what is not being saved/restored properly, and how to go about saving and restoring?

Thanks in advance,
NeilBrown

drivers/mfd/omap-usb-host.c +10 -0
index 23cec57..522405e 100644
@@ -100,6 +100,10 @@ struct usbhs_hcd_omap {
 
 	void __iomem			*uhh_base;
 
+	struct {
+		unsigned		hostconfig;
+	} context;
+
 	struct usbhs_omap_platform_data	platdata;
 
 	u32				usbhs_rev;
@@ -300,6 +304,10 @@ static int usbhs_runtime_resume(struct device *dev)
 	clk_enable(omap->utmi_p1_fck);
 	clk_enable(omap->utmi_p2_fck);
 
+	usbhs_write(omap->uhh_base,
+		    OMAP_UHH_HOSTCONFIG,
+		    omap->context.hostconfig);
+
 	spin_unlock_irqrestore(&omap->lock, flags);
 
 	return 0;
@@ -319,6 +327,8 @@ static int usbhs_runtime_suspend(struct device *dev)
 	}
 
 	spin_lock_irqsave(&omap->lock, flags);
+	omap->context.hostconfig = usbhs_read(omap->uhh_base,
+					      OMAP_UHH_HOSTCONFIG);
 
Quoted 7 lines

drivers/mfd/omap-usb-host.c static int usbhs_runtime_suspend(struct device *dev) · line 334

Quoted 2 lines
drivers/mfd/omap-usb-host.c +0 -0
 	if (is_ehci_tll_mode(pdata->port_mode[0]))
 		clk_disable(omap->usbhost_p1_fck);

- --
Regards,
Igor.

Quoted 2 lines

N‹§²æìr¸›yúèšØb²X¬¶Ç§vØ^–)Þº{.nÇ+‰·¥Š{±¢f©Š{ayºʇڙë,j­¢f£¢·hš‹àz¹®w¥¢¸ ¢·¦j:+v‰¨ŠwèjØm¶Ÿÿ¾«‘êçzZ+ƒùšŽŠÝ¢j"�ú!tml=

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

author
#4 lore raw
Quoted 25 lines · On Wed, 09 Jan 2013 11:24:09 +0100 Michael Trimarchi…

Hi Neil

Quoted 22 lines · NeilBrown
Quoted 7 lines · On Wed, 09 Jan 2013 12:00:05 +0200 Igor Grinberg <[email protected]>…

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Neil,

Quoted 1 line · NeilBrown
Quoted 8 lines
Quoted 6 lines

Hi,
I'm trying to get off_mode working reliably on my gta04 mobile phone.

My current stumbling block is USB. The "Option" GSM module is attached via USB (there is a separate transceiver chip attached to port 1 which is placed in OMAP_EHCI_PORT_MODE_PHY).

Which PHY is this (vendor/model)?

Hi Igor,
it is the SMSC USB3322

Quoted 9 lines
Quoted 6 lines

http://www.smsc.com/media/Downloads_Public/Data_Sheets/3320.pdf

BTW I subsequently discovered that keeping USBHOST out off off_mode only sometimes avoid the problem, not always. So there are probably multiple issues :-(

Are you sure that you don't have glitch on power, reset pin during suspend?

No, I don't really have the equipment to measure such things. But is it likely? Would enabling off_mode make it more likely? Can you suggest some way I could test the hypothesis?

The power pin is connected to a 3v3 regulator which certainly should stay on the whole time and other things which depend on it keep working.

The reset line is connected to GPIO174 which is configured:

# cat /sys/kernel/debug/omap_mux/mcspi1_cs0
name: mcspi1_cs0.gpio_174 (0x480021ce/0x19e = 0x011c), b ac2, t NA
mode: OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE4
signals: mcspi1_cs0 | sdmmc2_dat7 | NA | NA | gpio_174 | NA | NA | safe_mode

The "PIN_INPUT" seems a bit odd, so I changed it to OMAP_PIN_OUTPUT but that didn't appear to make any difference.

Thanks,
NeilBrown

#5 lore raw
Quoted 47 lines · NeilBrown
Quoted 25 lines · On Wed, 09 Jan 2013 11:24:09 +0100 Michael Trimarchi…

Hi Neil

Quoted 22 lines · NeilBrown
Quoted 7 lines · On Wed, 09 Jan 2013 12:00:05 +0200 Igor Grinberg <[email protected]>…

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Neil,

Quoted 1 line · NeilBrown
Quoted 8 lines
Quoted 6 lines

Hi,
I'm trying to get off_mode working reliably on my gta04 mobile phone.

My current stumbling block is USB. The "Option" GSM module is attached via USB (there is a separate transceiver chip attached to port 1 which is placed in OMAP_EHCI_PORT_MODE_PHY).

Which PHY is this (vendor/model)?

Hi Igor,
it is the SMSC USB3322

Quoted 9 lines
Quoted 6 lines

http://www.smsc.com/media/Downloads_Public/Data_Sheets/3320.pdf

BTW I subsequently discovered that keeping USBHOST out off off_mode only sometimes avoid the problem, not always. So there are probably multiple issues :-(

Are you sure that you don't have glitch on power, reset pin during suspend?

No, I don't really have the equipment to measure such things. But is it likely? Would enabling off_mode make it more likely? Can you suggest some way I could test the hypothesis?

The power pin is connected to a 3v3 regulator which certainly should stay on the whole time and other things which depend on it keep working.

The reset line is connected to GPIO174 which is configured:

Quoted 8 lines
# cat /sys/kernel/debug/omap_mux/mcspi1_cs0
name: mcspi1_cs0.gpio_174 (0x480021ce/0x19e = 0x011c), b ac2, t NA
mode: OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE4
signals: mcspi1_cs0 | sdmmc2_dat7 | NA | NA | gpio_174 | NA | NA | safe_mode

The "PIN_INPUT" seems a bit odd, so I changed it to OMAP_PIN_OUTPUT but that didn't appear to make any difference.

Can you try to add this OMAP_PIN_OFF_OUTPUT_HIGH or LOW? It's suppose to be the off_mode status of the pin. Is it correct?

Michael

Quoted 3 lines

Thanks,
NeilBrown

Signature · 3 lines
| Michael Nazzareno Trimarchi                     Amarula Solutions BV |
| COO  -  Founder                                      Cruquiuskade 47 |
| +31(0)851119172                                 Amsterdam 1018 AM NL |
author
#6 lore raw
Quoted 53 lines · On Wed, 09 Jan 2013 12:42:43 +0100 Michael Trimarchi…
Quoted 52 lines · NeilBrown
Quoted 25 lines · On Wed, 09 Jan 2013 11:24:09 +0100 Michael Trimarchi…

Hi Neil

Quoted 22 lines · NeilBrown
Quoted 7 lines · On Wed, 09 Jan 2013 12:00:05 +0200 Igor Grinberg <[email protected]>…

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Neil,

Quoted 1 line · NeilBrown
Quoted 8 lines
Quoted 6 lines

Hi,
I'm trying to get off_mode working reliably on my gta04 mobile phone.

My current stumbling block is USB. The "Option" GSM module is attached via USB (there is a separate transceiver chip attached to port 1 which is placed in OMAP_EHCI_PORT_MODE_PHY).

Which PHY is this (vendor/model)?

Hi Igor,
it is the SMSC USB3322

Quoted 9 lines
Quoted 6 lines

http://www.smsc.com/media/Downloads_Public/Data_Sheets/3320.pdf

BTW I subsequently discovered that keeping USBHOST out off off_mode only sometimes avoid the problem, not always. So there are probably multiple issues :-(

Are you sure that you don't have glitch on power, reset pin during suspend?

No, I don't really have the equipment to measure such things. But is it likely? Would enabling off_mode make it more likely? Can you suggest some way I could test the hypothesis?

The power pin is connected to a 3v3 regulator which certainly should stay on the whole time and other things which depend on it keep working.

The reset line is connected to GPIO174 which is configured:

# cat /sys/kernel/debug/omap_mux/mcspi1_cs0
name: mcspi1_cs0.gpio_174 (0x480021ce/0x19e = 0x011c), b ac2, t NA
mode: OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE4
signals: mcspi1_cs0 | sdmmc2_dat7 | NA | NA | gpio_174 | NA | NA | safe_mode
Quoted 7 lines
Quoted 3 lines

The "PIN_INPUT" seems a bit odd, so I changed it to OMAP_PIN_OUTPUT but that didn't appear to make any difference.

Can you try to add this OMAP_PIN_OFF_OUTPUT_HIGH or LOW? It's suppose to be the off_mode status of the pin. Is it correct?

You only set OMAP_PIN_OFF_OUTPUT_HIGH etc if you want the status in offmode to be different to what is was before off mode.
In the normal case without any of these bits set, the current value is latched when output in entered and it remains like that that until you leave off_mode.

Thanks,
NeilBrown

#7 lore raw
In reply to NeilBrown

Hi Neil

I forget to answer to your questions

Quoted 35 lines · NeilBrown
Quoted 32 lines · On Wed, 09 Jan 2013 11:24:09 +0100 Michael Trimarchi…

Hi Neil

Quoted 28 lines · NeilBrown
Quoted 7 lines · On Wed, 09 Jan 2013 12:00:05 +0200 Igor Grinberg <[email protected]>…

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Neil,

Quoted 1 line · NeilBrown
Quoted 8 lines
Quoted 6 lines

Hi,
I'm trying to get off_mode working reliably on my gta04 mobile phone.

My current stumbling block is USB. The "Option" GSM module is attached via USB (there is a separate transceiver chip attached to port 1 which is placed in OMAP_EHCI_PORT_MODE_PHY).

Which PHY is this (vendor/model)?

Hi Igor,
it is the SMSC USB3322

http://www.smsc.com/media/Downloads_Public/Data_Sheets/3320.pdf

BTW I subsequently discovered that keeping USBHOST out off off_mode only sometimes avoid the problem, not always. So there are probably multiple issues :-(

Quoted 5 lines
Quoted 2 lines

Are you sure that you don't have glitch on power, reset pin during suspend?

No, I don't really have the equipment to measure such things. But is it likely? Would enabling off_mode make it more likely?

I don't know the reason of the off_mode problem :(

Quoted 1 line

Can you suggest some way I could test the hypothesis?

I had the same problem on a rugged mobile phone, so it is just experience Check the modem power and reset gpio too, but if you don't need to unblock it with the pin after resume we know that modem is not the problem

Michael

Quoted 17 lines

The power pin is connected to a 3v3 regulator which certainly should stay on the whole time and other things which depend on it keep working.

The reset line is connected to GPIO174 which is configured:

# cat /sys/kernel/debug/omap_mux/mcspi1_cs0
name: mcspi1_cs0.gpio_174 (0x480021ce/0x19e = 0x011c), b ac2, t NA
mode: OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE4
signals: mcspi1_cs0 | sdmmc2_dat7 | NA | NA | gpio_174 | NA | NA | safe_mode

The "PIN_INPUT" seems a bit odd, so I changed it to OMAP_PIN_OUTPUT but that didn't appear to make any difference.

Thanks,
NeilBrown

#8 lore raw
Quoted 39 lines · Michael Trimarchi

Hi Neil

I forget to answer to your questions

Quoted 34 lines · NeilBrown
Quoted 31 lines · On Wed, 09 Jan 2013 11:24:09 +0100 Michael Trimarchi…

Hi Neil

Quoted 28 lines · NeilBrown
Quoted 7 lines · On Wed, 09 Jan 2013 12:00:05 +0200 Igor Grinberg <[email protected]>…

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Neil,

Quoted 1 line · NeilBrown
Quoted 8 lines
Quoted 6 lines

Hi,
I'm trying to get off_mode working reliably on my gta04 mobile phone.

My current stumbling block is USB. The "Option" GSM module is attached via USB (there is a separate transceiver chip attached to port 1 which is placed in OMAP_EHCI_PORT_MODE_PHY).

Which PHY is this (vendor/model)?

Hi Igor,
it is the SMSC USB3322

http://www.smsc.com/media/Downloads_Public/Data_Sheets/3320.pdf

BTW I subsequently discovered that keeping USBHOST out off off_mode only sometimes avoid the problem, not always. So there are probably multiple issues :-(

We have the same PHY and it has some issues with the OMAP USB code. First issue we experience is that if we reset the PHY more then once w/o power cycling it, the PHY dies until next power cycle. So, we stop providing the reset GPIO to the usb code and do the reset in the board code.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

Are you sure that you don't have glitch on power, reset pin during suspend?

No, I don't really have the equipment to measure such things. But is it likely? Would enabling off_mode make it more likely?

I don't know the reason of the off_mode problem :(

We have the equipment to check this and no - this is not the case.

Quoted 6 lines
Quoted 2 lines

Can you suggest some way I could test the hypothesis?

I had the same problem on a rugged mobile phone, so it is just experience Check the modem power and reset gpio too, but if you don't need to unblock it with the pin after resume we know that modem is not the problem

I don't think modem is the problem...
We have plain USB connector ports that are dead after the resume from off-mode.

The good news are that we have the off-mode working on v3.6.1, including the USB, but we had to do some horrible ugly hacking for this.

Signature · 2 lines
Regards,
Igor.
author
#9 lore raw
Quoted 41 lines · On Wed, 09 Jan 2013 14:54:00 +0200 Igor Grinberg <[email protected]>…
Quoted 39 lines · Michael Trimarchi

Hi Neil

I forget to answer to your questions

Quoted 34 lines · NeilBrown
Quoted 31 lines · On Wed, 09 Jan 2013 11:24:09 +0100 Michael Trimarchi…

Hi Neil

Quoted 28 lines · NeilBrown
Quoted 7 lines · On Wed, 09 Jan 2013 12:00:05 +0200 Igor Grinberg <[email protected]>…

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Neil,

Quoted 1 line · NeilBrown
Quoted 8 lines
Quoted 6 lines

Hi,
I'm trying to get off_mode working reliably on my gta04 mobile phone.

My current stumbling block is USB. The "Option" GSM module is attached via USB (there is a separate transceiver chip attached to port 1 which is placed in OMAP_EHCI_PORT_MODE_PHY).

Which PHY is this (vendor/model)?

Hi Igor,
it is the SMSC USB3322

http://www.smsc.com/media/Downloads_Public/Data_Sheets/3320.pdf

BTW I subsequently discovered that keeping USBHOST out off off_mode only sometimes avoid the problem, not always. So there are probably multiple issues :-(

Quoted 5 lines

We have the same PHY and it has some issues with the OMAP USB code. First issue we experience is that if we reset the PHY more then once w/o power cycling it, the PHY dies until next power cycle. So, we stop providing the reset GPIO to the usb code and do the reset in the board code.

I've tried various change w.r.t the resetting and I cannot fault it. Resetting or not resetting neither causes a problem while the USB is otherwise working, not fixed the USB while it is otherwise failing. So I don't think this is my problem - thanks.

Quoted 19 lines
Quoted 9 lines
Quoted 7 lines
Quoted 4 lines

Are you sure that you don't have glitch on power, reset pin during suspend?

No, I don't really have the equipment to measure such things. But is it likely? Would enabling off_mode make it more likely?

I don't know the reason of the off_mode problem :(

We have the equipment to check this and no - this is not the case.

Quoted 6 lines
Quoted 2 lines

Can you suggest some way I could test the hypothesis?

I had the same problem on a rugged mobile phone, so it is just experience Check the modem power and reset gpio too, but if you don't need to unblock it with the pin after resume we know that modem is not the problem

Quoted 6 lines

I don't think modem is the problem...
We have plain USB connector ports that are dead after the resume from off-mode.

The good news are that we have the off-mode working on v3.6.1, including the USB, but we had to do some horrible ugly hacking for this.

I assume this means "some patches on top of 3.6.1" ??
Care to share your code? Even horribly ugly hacks can be educational.

Thanks,
NeilBrown

#10 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 77 lines · NeilBrown
Quoted 41 lines · On Wed, 09 Jan 2013 14:54:00 +0200 Igor Grinberg <[email protected]>…
Quoted 39 lines · Michael Trimarchi

Hi Neil

I forget to answer to your questions

Quoted 34 lines · NeilBrown
Quoted 31 lines · On Wed, 09 Jan 2013 11:24:09 +0100 Michael Trimarchi…

Hi Neil

Quoted 28 lines · NeilBrown
Quoted 7 lines · On Wed, 09 Jan 2013 12:00:05 +0200 Igor Grinberg <[email protected]>…

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Neil,

Quoted 1 line · NeilBrown
Quoted 8 lines
Quoted 6 lines

Hi,
I'm trying to get off_mode working reliably on my gta04 mobile phone.

My current stumbling block is USB. The "Option" GSM module is attached via USB (there is a separate transceiver chip attached to port 1 which is placed in OMAP_EHCI_PORT_MODE_PHY).

Which PHY is this (vendor/model)?

Hi Igor,
it is the SMSC USB3322

http://www.smsc.com/media/Downloads_Public/Data_Sheets/3320.pdf

BTW I subsequently discovered that keeping USBHOST out off off_mode only sometimes avoid the problem, not always. So there are probably multiple issues :-(

Quoted 5 lines

We have the same PHY and it has some issues with the OMAP USB code. First issue we experience is that if we reset the PHY more then once w/o power cycling it, the PHY dies until next power cycle. So, we stop providing the reset GPIO to the usb code and do the reset in the board code.

I've tried various change w.r.t the resetting and I cannot fault it. Resetting or not resetting neither causes a problem while the USB is otherwise working, not fixed the USB while it is otherwise failing. So I don't think this is my problem - thanks.

Quoted 22 lines
Quoted 9 lines
Quoted 7 lines
Quoted 4 lines

Are you sure that you don't have glitch on power, reset pin during suspend?

No, I don't really have the equipment to measure such things. But is it likely? Would enabling off_mode make it more likely?

I don't know the reason of the off_mode problem :(

We have the equipment to check this and no - this is not the case.

Quoted 6 lines
Quoted 2 lines

Can you suggest some way I could test the hypothesis?

I had the same problem on a rugged mobile phone, so it is just experience Check the modem power and reset gpio too, but if you don't need to unblock it with the pin after resume we know that modem is not the problem

I don't think modem is the problem...
We have plain USB connector ports that are dead after the resume from off-mode.

Quoted 6 lines
Quoted 3 lines

The good news are that we have the off-mode working on v3.6.1, including the USB, but we had to do some horrible ugly hacking for this.

I assume this means "some patches on top of 3.6.1" ??
Care to share your code? Even horribly ugly hacks can be educational.

We are not ready to share these patches (this will happen eventually after some work is finished), but I can explain what they do...

We split the ehci_run function to separate the debugfs and sysfs stuff from other initializations, so we can run the new version without the debugfs and sysfs stuff multiple times.

Then we implement the suspend/resume ehci callbacks:
on suspend, assert phy reset,
on resume, deassert phy reset, write EHCI_INSNREG04_DISABLE_UNSUSPEND to EHCI_INSNREG04, and call the new ehci_run() function.

That does the job for USB host to resume from off mode.

- --
Regards,
Igor.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJQ9nKiAAoJEBDE8YO64Efa7U4QAKFXRyyNR5Q7jjwVG6UwITWq 6kJyNXJKQTqn6GLEV7xJmT4SZAtxq+dRDl/XE9dcXFK3RTebttXxyVz1X0vXZQud h6QLenH8jHczNubfn6CTLI38PKprl1F2zpZtjKpHfNmD5cLWzJ1EIoTH19ENsJ4v zV3KI3RgiFuq02vxOULtp9gP/x0WZSHwBEGm/ToqqsEaX7wAJc2BDFOSS8NpSGbb VLPFA1doMrFOYkL+oMS2IVudM0wEYCBGhGxMi/Y++RY1omlonhEGCoVxaxzGoHrk H/ZpxFheIGBKwo+VX1eSgW9oQZyzbPZttyEWXXNCRh/6oejXCBSS3zkKrWrctmVD ONu1gzoaC9p/c1n2GDioIfxC41dPKdjCETMbTi9rR5shc12ZmwtrgUOU80mpzWj3 6fY+TRW4x8qYbsFL89T6TWGpDz7JrBdtdJiBD/TPtJW05ikn9DTL5/GNVjeeoRk0 5DJ06pHh+rQFKThEvoDdLAH3PZdtDVSdXnAg+gF4D7/BMZ14TLHmW2l471I95S2I eKxZxIwFa2IscTbGKhTlrdPF4UShEvLuFgO6NCb1ea1FT7m3ih8rwA5ObI4676DG Y5kokqi9dpzMB/6T/SDk/gySTg9WUDXFlhS6x/b89f1xC71GzGTJkkqqH4u6KfX8 GcqI3wEFlqpG4FM39XAw
=nynZ
-----END PGP SIGNATURE-----

author
#11 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 95 lines · On Wed, 16 Jan 2013 11:28:02 +0200 Igor Grinberg <[email protected]>…

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 77 lines · NeilBrown
Quoted 41 lines · On Wed, 09 Jan 2013 14:54:00 +0200 Igor Grinberg <[email protected]>…
Quoted 39 lines · Michael Trimarchi

Hi Neil

I forget to answer to your questions

Quoted 34 lines · NeilBrown
Quoted 31 lines · On Wed, 09 Jan 2013 11:24:09 +0100 Michael Trimarchi…

Hi Neil

Quoted 28 lines · NeilBrown
Quoted 7 lines · On Wed, 09 Jan 2013 12:00:05 +0200 Igor Grinberg <[email protected]>…

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Neil,

Quoted 1 line · NeilBrown
Quoted 8 lines
Quoted 6 lines

Hi,
I'm trying to get off_mode working reliably on my gta04 mobile phone.

My current stumbling block is USB. The "Option" GSM module is attached via USB (there is a separate transceiver chip attached to port 1 which is placed in OMAP_EHCI_PORT_MODE_PHY).

Which PHY is this (vendor/model)?

Hi Igor,
it is the SMSC USB3322

http://www.smsc.com/media/Downloads_Public/Data_Sheets/3320.pdf

BTW I subsequently discovered that keeping USBHOST out off off_mode only sometimes avoid the problem, not always. So there are probably multiple issues :-(

Quoted 5 lines

We have the same PHY and it has some issues with the OMAP USB code. First issue we experience is that if we reset the PHY more then once w/o power cycling it, the PHY dies until next power cycle. So, we stop providing the reset GPIO to the usb code and do the reset in the board code.

I've tried various change w.r.t the resetting and I cannot fault it. Resetting or not resetting neither causes a problem while the USB is otherwise working, not fixed the USB while it is otherwise failing. So I don't think this is my problem - thanks.

Quoted 22 lines
Quoted 9 lines
Quoted 7 lines
Quoted 4 lines

Are you sure that you don't have glitch on power, reset pin during suspend?

No, I don't really have the equipment to measure such things. But is it likely? Would enabling off_mode make it more likely?

I don't know the reason of the off_mode problem :(

We have the equipment to check this and no - this is not the case.

Quoted 6 lines
Quoted 2 lines

Can you suggest some way I could test the hypothesis?

I had the same problem on a rugged mobile phone, so it is just experience Check the modem power and reset gpio too, but if you don't need to unblock it with the pin after resume we know that modem is not the problem

I don't think modem is the problem...
We have plain USB connector ports that are dead after the resume from off-mode.

Quoted 6 lines
Quoted 3 lines

The good news are that we have the off-mode working on v3.6.1, including the USB, but we had to do some horrible ugly hacking for this.

I assume this means "some patches on top of 3.6.1" ??
Care to share your code? Even horribly ugly hacks can be educational.

We are not ready to share these patches (this will happen eventually after some work is finished), but I can explain what they do...

We split the ehci_run function to separate the debugfs and sysfs stuff from other initializations, so we can run the new version without the debugfs and sysfs stuff multiple times.

Quoted 6 lines

Then we implement the suspend/resume ehci callbacks:
on suspend, assert phy reset,
on resume, deassert phy reset, write EHCI_INSNREG04_DISABLE_UNSUSPEND to EHCI_INSNREG04, and call the new ehci_run() function.

That does the job for USB host to resume from off mode.

Interesting thanks. That makes a certain amount of sense.

However I tried compiling ehci-hcd as a module and unload/reloading it which should have a similar net effect to what you did, but it didn't make any difference - device disappears on resume.

I also tried restoring the correct value to EHCI_INSNREG04 and EHCI_INSNREG05_ULPI which are the only registers written by ehci-omap.c, and that didn't help either.

The only thing I've found that works is keeping 'core' out of off-mode.

BTW I discovered that arch/arm/mach-omap2/powerdomains3xxx_data.c comments out the setting of
.flags = PWRDM_HAS_HDWR_SAR,
for the usbhost powerdomain - that is why I had to leave it in retention. If I uncomment that setting, the it is safe for USBHOST to go to off-mode, just not for CORE.

I'll keep exploring.

NeilBrown
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (GNU/Linux)

iQIVAwUBUPZ+rznsnt1WYoG5AQLYug//T+J3L11fwVq8JHfiPJVfbEfrAdx96+Id OD+qpwWUarWfpxcgthuRmkrxxUSXxI8sBr0Y0wKWRw4biFxtzcY3qk5xnlUMCfFx BuqrevVZ6bQZ3JDORv1OfeRwZXOheW0ocJ50s1aV8QTTZvrTKo0TNv7G2uLYIssK vafA1WOTQPWAxMd7gx8qjpbT/HPi2kYaLlEJ1/kXYeylGboncUyus42j1q1qnGqy xN6031rpwba4CXtXysx830/uPrnr3LPCh15HUUpxHsYB8rey+60F0ClbT72ZqajJ w1Cy1GR+UDAM7DP3wt1z87H6/IHRXpJLVodUQ5LIZezbWYF1CbAcyJoSyrjZhefe yQnGrFaxHS9oNwaZpDOccxGCPOt8uY5DBRMtEpQKt+3LR0lFJzeICMpfENyMg+3a mU+fzVfGs0puyg/Imcds5yrpmjtGDzuF0yIZ2pIW8pcWjJwbYVzaw9TfzYSSALv1 VaJp7DItUw9JreBtyb7W4P3KvLjH1GAHjPSFBU4iWhXF6JmQnG6ntDeH+eKNpO2F 0BcaxhP8Ll1kWif+cf0gIVBMBTjbBaWYkD8zPpXAnEI+FHNdxT5knbohMDPVjR1A W5rYHvzpa04N/DQSVJVq7zBbAs0QkYGLtC03b9ebk7Y9z7HS/KdzZafqW0Gr50j7 DqBKnGA/0GE=
=srfM
-----END PGP SIGNATURE-----

#12 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 103 lines · NeilBrown
Quoted 99 lines · On Wed, 16 Jan 2013 11:28:02 +0200 Igor Grinberg <[email protected]>…

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 77 lines · NeilBrown
Quoted 41 lines · On Wed, 09 Jan 2013 14:54:00 +0200 Igor Grinberg <[email protected]>…
Quoted 39 lines · Michael Trimarchi

Hi Neil

I forget to answer to your questions

Quoted 34 lines · NeilBrown
Quoted 31 lines · On Wed, 09 Jan 2013 11:24:09 +0100 Michael Trimarchi…

Hi Neil

Quoted 28 lines · NeilBrown
Quoted 7 lines · On Wed, 09 Jan 2013 12:00:05 +0200 Igor Grinberg <[email protected]>…

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Neil,

Quoted 1 line · NeilBrown
Quoted 8 lines
Quoted 6 lines

Hi,
I'm trying to get off_mode working reliably on my gta04 mobile phone.

My current stumbling block is USB. The "Option" GSM module is attached via USB (there is a separate transceiver chip attached to port 1 which is placed in OMAP_EHCI_PORT_MODE_PHY).

Which PHY is this (vendor/model)?

Hi Igor,
it is the SMSC USB3322

http://www.smsc.com/media/Downloads_Public/Data_Sheets/3320.pdf

BTW I subsequently discovered that keeping USBHOST out off off_mode only sometimes avoid the problem, not always. So there are probably multiple issues :-(

Quoted 5 lines

We have the same PHY and it has some issues with the OMAP USB code. First issue we experience is that if we reset the PHY more then once w/o power cycling it, the PHY dies until next power cycle. So, we stop providing the reset GPIO to the usb code and do the reset in the board code.

I've tried various change w.r.t the resetting and I cannot fault it. Resetting or not resetting neither causes a problem while the USB is otherwise working, not fixed the USB while it is otherwise failing. So I don't think this is my problem - thanks.

Quoted 22 lines
Quoted 9 lines
Quoted 7 lines
Quoted 4 lines

Are you sure that you don't have glitch on power, reset pin during suspend?

No, I don't really have the equipment to measure such things. But is it likely? Would enabling off_mode make it more likely?

I don't know the reason of the off_mode problem :(

We have the equipment to check this and no - this is not the case.

Quoted 6 lines
Quoted 2 lines

Can you suggest some way I could test the hypothesis?

I had the same problem on a rugged mobile phone, so it is just experience Check the modem power and reset gpio too, but if you don't need to unblock it with the pin after resume we know that modem is not the problem

I don't think modem is the problem...
We have plain USB connector ports that are dead after the resume from off-mode.

Quoted 6 lines
Quoted 3 lines

The good news are that we have the off-mode working on v3.6.1, including the USB, but we had to do some horrible ugly hacking for this.

I assume this means "some patches on top of 3.6.1" ??
Care to share your code? Even horribly ugly hacks can be educational.

We are not ready to share these patches (this will happen eventually after some work is finished), but I can explain what they do...

We split the ehci_run function to separate the debugfs and sysfs stuff from other initializations, so we can run the new version without the debugfs and sysfs stuff multiple times.

Then we implement the suspend/resume ehci callbacks:
on suspend, assert phy reset,
on resume, deassert phy reset, write EHCI_INSNREG04_DISABLE_UNSUSPEND to EHCI_INSNREG04, and call the new ehci_run() function.

Quoted 7 lines
Quoted 1 line

That does the job for USB host to resume from off mode.

Interesting thanks. That makes a certain amount of sense.

However I tried compiling ehci-hcd as a module and unload/reloading it which should have a similar net effect to what you did, but it didn't make any difference - device disappears on resume.

Yes it does for cm-t3730, in fact, that is what we have started from...

Quoted 6 lines

I also tried restoring the correct value to EHCI_INSNREG04 and EHCI_INSNREG05_ULPI which are the only registers written by ehci-omap.c, and that didn't help either.

The only thing I've found that works is keeping 'core' out of off-mode.

Ah, one more thing, we ensure that phy is completely powered off through the TPS power scripts, otherwise, it does not work...

Quoted 8 lines

BTW I discovered that arch/arm/mach-omap2/powerdomains3xxx_data.c comments out the setting of
.flags = PWRDM_HAS_HDWR_SAR,
for the usbhost powerdomain - that is why I had to leave it in retention. If I uncomment that setting, the it is safe for USBHOST to go to off-mode, just not for CORE.

Quoted 4 lines

I'll keep exploring.

NeilBrown
N?§²æìr¸?yúè?Øb²X¬¶Ç§vØ^?)Þº{.nÇ+?·¥?{±¢f©?{ayºÊ?Ú?ë,j­¢f£¢·h??àz¹®w¥¢¸ ¢·¦j:+v?¨?wèjØm¶?ÿ¾«?êçzZ+?ù???Ý¢j"?ú!tml=

- --
Regards,
Igor.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJQ9oreAAoJEBDE8YO64EfaRasP/iUDBXhmPQtVm7ESB1DPopMc b5dUWY1mwQGfNhdcPqApyPk5MPzHTAFfNiLTxJURUqN562gMl1+SR4Mr9cOX6ju4 ahlxyciOlb2KzsCTAUC9PPJVQSR2UbAPMZIA84B4pt6GOYF0OVHzFDickFhAg7Nu dvnpMyE1gNTCISAi28lp6pLY5POcyo4HAeZaapPrl3G1GbivplKH+AqJLLeVoJzA InebBUBe1lCDZ31RyY8uiTjjr8Qc+JDzSLybKkuijULwXualJDaJjRxvfG9cfoju 3v+/HvVdAJzqTN9cdQBJJ3VLAhpLZJHKvSlQ3K8IYLHaG5K4QJsrf6WZldRIPaAe Ztv5EdKK3l2e4nbTP3oJmU56R2XREcKltw8e1XWNkpnN6sKn6sx8iuVPCeFlb/SA snA1i9gkvQWRnKeW7At2Jiv3C3Xn9L+1fulYzTjk/mX+P4sKhigllV73naAeGnZZ GOa7F1FeCq0L8d2CV36FWwXOvOqdyrkgCabA2GQrOHlIOjnOqhymc/pybGGly1Ph arGUSdcFdl1rxcuzIYcBKgV8eF5E+wjnLMVubO/Bj9nrpbxVAeyAyF0qNY1RWmBx oY5JJah2EM/AyPBKCSEY3PBugwAFLPV9uL69Bw0rJbxfT1uWBHVoby3Q5/dpWAJv bt+zpdKaK5n3KYHqbPci
=qbkL
-----END PGP SIGNATURE-----
--
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

author
#13 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 118 lines · On Wed, 16 Jan 2013 13:11:26 +0200 Igor Grinberg <[email protected]>…

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 103 lines · NeilBrown
Quoted 99 lines · On Wed, 16 Jan 2013 11:28:02 +0200 Igor Grinberg <[email protected]>…

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 77 lines · NeilBrown
Quoted 41 lines · On Wed, 09 Jan 2013 14:54:00 +0200 Igor Grinberg <[email protected]>…
Quoted 39 lines · Michael Trimarchi

Hi Neil

I forget to answer to your questions

Quoted 34 lines · NeilBrown
Quoted 31 lines · On Wed, 09 Jan 2013 11:24:09 +0100 Michael Trimarchi…

Hi Neil

Quoted 28 lines · NeilBrown
Quoted 7 lines · On Wed, 09 Jan 2013 12:00:05 +0200 Igor Grinberg <[email protected]>…

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Neil,

Quoted 1 line · NeilBrown
Quoted 8 lines
Quoted 6 lines

Hi,
I'm trying to get off_mode working reliably on my gta04 mobile phone.

My current stumbling block is USB. The "Option" GSM module is attached via USB (there is a separate transceiver chip attached to port 1 which is placed in OMAP_EHCI_PORT_MODE_PHY).

Which PHY is this (vendor/model)?

Hi Igor,
it is the SMSC USB3322

http://www.smsc.com/media/Downloads_Public/Data_Sheets/3320.pdf

BTW I subsequently discovered that keeping USBHOST out off off_mode only sometimes avoid the problem, not always. So there are probably multiple issues :-(

Quoted 5 lines

We have the same PHY and it has some issues with the OMAP USB code. First issue we experience is that if we reset the PHY more then once w/o power cycling it, the PHY dies until next power cycle. So, we stop providing the reset GPIO to the usb code and do the reset in the board code.

I've tried various change w.r.t the resetting and I cannot fault it. Resetting or not resetting neither causes a problem while the USB is otherwise working, not fixed the USB while it is otherwise failing. So I don't think this is my problem - thanks.

Quoted 22 lines
Quoted 9 lines
Quoted 7 lines
Quoted 4 lines

Are you sure that you don't have glitch on power, reset pin during suspend?

No, I don't really have the equipment to measure such things. But is it likely? Would enabling off_mode make it more likely?

I don't know the reason of the off_mode problem :(

We have the equipment to check this and no - this is not the case.

Quoted 6 lines
Quoted 2 lines

Can you suggest some way I could test the hypothesis?

I had the same problem on a rugged mobile phone, so it is just experience Check the modem power and reset gpio too, but if you don't need to unblock it with the pin after resume we know that modem is not the problem

I don't think modem is the problem...
We have plain USB connector ports that are dead after the resume from off-mode.

Quoted 6 lines
Quoted 3 lines

The good news are that we have the off-mode working on v3.6.1, including the USB, but we had to do some horrible ugly hacking for this.

I assume this means "some patches on top of 3.6.1" ??
Care to share your code? Even horribly ugly hacks can be educational.

We are not ready to share these patches (this will happen eventually after some work is finished), but I can explain what they do...

We split the ehci_run function to separate the debugfs and sysfs stuff from other initializations, so we can run the new version without the debugfs and sysfs stuff multiple times.

Then we implement the suspend/resume ehci callbacks:
on suspend, assert phy reset,
on resume, deassert phy reset, write EHCI_INSNREG04_DISABLE_UNSUSPEND to EHCI_INSNREG04, and call the new ehci_run() function.

Quoted 7 lines
Quoted 1 line

That does the job for USB host to resume from off mode.

Interesting thanks. That makes a certain amount of sense.

However I tried compiling ehci-hcd as a module and unload/reloading it which should have a similar net effect to what you did, but it didn't make any difference - device disappears on resume.

Yes it does for cm-t3730, in fact, that is what we have started from...

Quoted 1 line
Quoted 9 lines
Quoted 5 lines

I also tried restoring the correct value to EHCI_INSNREG04 and EHCI_INSNREG05_ULPI which are the only registers written by ehci-omap.c, and that didn't help either.

The only thing I've found that works is keeping 'core' out of off-mode.

Ah, one more thing, we ensure that phy is completely powered off through the TPS power scripts, otherwise, it does not work...

Ahhh.... that does make a difference.

I turned off the 5V5 rail which powered the phy (and a few other things) and now the usb-attached modem appears after resume. Very interesting.

I hadn't been doing this as I had been advised that the hardware wouldn't like it. There are a few devices (including the USB PHY) which are supplied by both a 1V8 rail and the 5V5 rail. Some of them are out-of-spec if the 1V8 is supplied, but the 5V5 isn't.
The 1V8 must remain on during suspend as it keep the RAM powered, so the 5V5 must as well. Awkward.

It is not entirely satisfactory for other reasons. It seems that with off_mode fully working, we drop to off mode when CPUIDLE puts things to sleep, and that removes the 5V5 too, which is bad. This disconnects the USB. My current console log shows:

[ 2453.837402] usb 1-2: new high-speed USB device number 10 using ehci-omap
[ 2454.006256] usb 1-2: New USB device found, idVendor=0af0, idProduct=8800
[ 2454.015686] usb 1-2: New USB device strings: Mfr=3, Product=2, SerialNumber=0
[ 2454.025512] usb 1-2: Product: Globetrotter HSUPA Modem
[ 2454.031005] usb 1-2: Manufacturer: Option N.V.
[ 2455.355804] usb 1-2: USB disconnect, device number 10
[ 2459.829589] usb 1-2: new high-speed USB device number 11 using ehci-omap
[ 2459.997894] usb 1-2: New USB device found, idVendor=0af0, idProduct=8800
[ 2460.007385] usb 1-2: New USB device strings: Mfr=3, Product=2, SerialNumber=0
[ 2460.017242] usb 1-2: Product: Globetrotter HSUPA Modem
[ 2460.022644] usb 1-2: Manufacturer: Option N.V.
[ 2469.496490] usb 1-2: USB disconnect, device number 11
[ 2472.845245] usb 1-2: new high-speed USB device number 12 using ehci-omap
[ 2473.013946] usb 1-2: New USB device found, idVendor=0af0, idProduct=8800
[ 2473.023376] usb 1-2: New USB device strings: Mfr=3, Product=2, SerialNumber=0
[ 2473.033264] usb 1-2: Product: Globetrotter HSUPA Modem
[ 2473.038757] usb 1-2: Manufacturer: Option N.V.
[ 2474.528289] usb 1-2: USB disconnect, device number 12
[ 2478.829589] usb 1-2: new high-speed USB device number 13 using ehci-omap
[ 2478.998748] usb 1-2: New USB device found, idVendor=0af0, idProduct=8800
[ 2479.008209] usb 1-2: New USB device strings: Mfr=3, Product=2, SerialNumber=0
[ 2479.018005] usb 1-2: Product: Globetrotter HSUPA Modem
[ 2479.023498] usb 1-2: Manufacturer: Option N.V.
[ 2480.374694] usb 1-2: USB disconnect, device number 13

i.e. the modem disconnecting and reconnecting. every few seconds. The modem eventually got upset and has entered a state where I cannot communicate with it.

So - interesting and useful, but I don't have a complete solution yet.

Also, while this gets the internal USB working (to some extent) the external usb (USB-OTG using the musb driver) is still broken. When CORE is only allowed into retention mode, it works fine. When CORE goes to off-mode, I lose the USB port. So that'll be another problem to solve.

Thanks again,

NeilBrown
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (GNU/Linux)

iQIVAwUBUPdEXznsnt1WYoG5AQJ5qg/8DrSirSXfIT0U/IqyQyimdRS6w11JjuUa xQnSl7be6Tr0buNM/xZ1ZfQ6fs47aOOnFYjAVLUjHUqVxXhUjDZLo5KxI0yoYi35 gzoGWTB4AS8Bx/V7dOHxBtOO0t/vUyxiTiAWhG7AFZZc6CM/Z4UzQvD4uyY+bQNj 2YmF112lMULtpfW5m56vsqxyf9sQn+Cr+1snnOx416wF2Vq5lNaZhVhqX+Oqz9o2 TvtSS2p3hntAQPBPl0VZ4DZAdiquSkq8LZTKKca0u85MHwHx1v4HvG5S9NqDkDfo hIaQdaku5Xe7SgLoUrIb4a2ppWe8OwjcrB6MSDugzP0Y0gt/kq5uoe75/TVJ23Kw ijjo/LwQNvT1G8ruHBg0evawX5Ttn4prfh1FQeyJkDWewXtVaonb7AV4E+RUc2qw obhZ4rxor+sGy7Qj18RBMsWv+8n4/QPKw1RkUYrkSITDof3OYI3UcnFfT9hKVwhe Uz2vFX/rBj3uVn+5uSR3flMtwgpey9RAAb5tMzqDtPPi+R8v6gUxOZkvBjje6hQc YLcULiFxdPiFNTiWs7BkTO7nRxS5DIE5mtG/LmWoa73abAN2JjIfVIPwRwlS7xdB on0MwUNIQmNL58seYS2JA2UavDP/Y/Lcnjos0b/BqxjXWrHTEdP6WSkq2k48+40M 5D3wKCNXC8w=
=m9M+
-----END PGP SIGNATURE-----

author
#14 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 182 lines · On Thu, 17 Jan 2013 11:22:55 +1100 NeilBrown <[email protected]> wrote:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 118 lines · On Wed, 16 Jan 2013 13:11:26 +0200 Igor Grinberg <[email protected]>…

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 103 lines · NeilBrown
Quoted 99 lines · On Wed, 16 Jan 2013 11:28:02 +0200 Igor Grinberg <[email protected]>…

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 77 lines · NeilBrown
Quoted 41 lines · On Wed, 09 Jan 2013 14:54:00 +0200 Igor Grinberg <[email protected]>…
Quoted 39 lines · Michael Trimarchi

Hi Neil

I forget to answer to your questions

Quoted 34 lines · NeilBrown
Quoted 31 lines · On Wed, 09 Jan 2013 11:24:09 +0100 Michael Trimarchi…

Hi Neil

Quoted 28 lines · NeilBrown
Quoted 7 lines · On Wed, 09 Jan 2013 12:00:05 +0200 Igor Grinberg <[email protected]>…

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Neil,

Quoted 1 line · NeilBrown
Quoted 8 lines
Quoted 6 lines

Hi,
I'm trying to get off_mode working reliably on my gta04 mobile phone.

My current stumbling block is USB. The "Option" GSM module is attached via USB (there is a separate transceiver chip attached to port 1 which is placed in OMAP_EHCI_PORT_MODE_PHY).

Which PHY is this (vendor/model)?

Hi Igor,
it is the SMSC USB3322

http://www.smsc.com/media/Downloads_Public/Data_Sheets/3320.pdf

BTW I subsequently discovered that keeping USBHOST out off off_mode only sometimes avoid the problem, not always. So there are probably multiple issues :-(

Quoted 5 lines

We have the same PHY and it has some issues with the OMAP USB code. First issue we experience is that if we reset the PHY more then once w/o power cycling it, the PHY dies until next power cycle. So, we stop providing the reset GPIO to the usb code and do the reset in the board code.

I've tried various change w.r.t the resetting and I cannot fault it. Resetting or not resetting neither causes a problem while the USB is otherwise working, not fixed the USB while it is otherwise failing. So I don't think this is my problem - thanks.

Quoted 22 lines
Quoted 9 lines
Quoted 7 lines
Quoted 4 lines

Are you sure that you don't have glitch on power, reset pin during suspend?

No, I don't really have the equipment to measure such things. But is it likely? Would enabling off_mode make it more likely?

I don't know the reason of the off_mode problem :(

We have the equipment to check this and no - this is not the case.

Quoted 6 lines
Quoted 2 lines

Can you suggest some way I could test the hypothesis?

I had the same problem on a rugged mobile phone, so it is just experience Check the modem power and reset gpio too, but if you don't need to unblock it with the pin after resume we know that modem is not the problem

I don't think modem is the problem...
We have plain USB connector ports that are dead after the resume from off-mode.

Quoted 6 lines
Quoted 3 lines

The good news are that we have the off-mode working on v3.6.1, including the USB, but we had to do some horrible ugly hacking for this.

I assume this means "some patches on top of 3.6.1" ??
Care to share your code? Even horribly ugly hacks can be educational.

We are not ready to share these patches (this will happen eventually after some work is finished), but I can explain what they do...

We split the ehci_run function to separate the debugfs and sysfs stuff from other initializations, so we can run the new version without the debugfs and sysfs stuff multiple times.

Then we implement the suspend/resume ehci callbacks:
on suspend, assert phy reset,
on resume, deassert phy reset, write EHCI_INSNREG04_DISABLE_UNSUSPEND to EHCI_INSNREG04, and call the new ehci_run() function.

Quoted 7 lines
Quoted 1 line

That does the job for USB host to resume from off mode.

Interesting thanks. That makes a certain amount of sense.

However I tried compiling ehci-hcd as a module and unload/reloading it which should have a similar net effect to what you did, but it didn't make any difference - device disappears on resume.

Yes it does for cm-t3730, in fact, that is what we have started from...

Quoted 1 line
Quoted 9 lines
Quoted 5 lines

I also tried restoring the correct value to EHCI_INSNREG04 and EHCI_INSNREG05_ULPI which are the only registers written by ehci-omap.c, and that didn't help either.

The only thing I've found that works is keeping 'core' out of off-mode.

Ah, one more thing, we ensure that phy is completely powered off through the TPS power scripts, otherwise, it does not work...

Ahhh.... that does make a difference.

I turned off the 5V5 rail which powered the phy (and a few other things) and now the usb-attached modem appears after resume. Very interesting.

I hadn't been doing this as I had been advised that the hardware wouldn't like it. There are a few devices (including the USB PHY) which are supplied by both a 1V8 rail and the 5V5 rail. Some of them are out-of-spec if the 1V8 is supplied, but the 5V5 isn't.
The 1V8 must remain on during suspend as it keep the RAM powered, so the 5V5 must as well. Awkward.

It is not entirely satisfactory for other reasons. It seems that with off_mode fully working, we drop to off mode when CPUIDLE puts things to sleep, and that removes the 5V5 too, which is bad. This disconnects the USB. My current console log shows:

[ 2453.837402] usb 1-2: new high-speed USB device number 10 using ehci-omap
[ 2454.006256] usb 1-2: New USB device found, idVendor=0af0, idProduct=8800
[ 2454.015686] usb 1-2: New USB device strings: Mfr=3, Product=2, SerialNumber=0
[ 2454.025512] usb 1-2: Product: Globetrotter HSUPA Modem
[ 2454.031005] usb 1-2: Manufacturer: Option N.V.
[ 2455.355804] usb 1-2: USB disconnect, device number 10
[ 2459.829589] usb 1-2: new high-speed USB device number 11 using ehci-omap
[ 2459.997894] usb 1-2: New USB device found, idVendor=0af0, idProduct=8800
[ 2460.007385] usb 1-2: New USB device strings: Mfr=3, Product=2, SerialNumber=0
[ 2460.017242] usb 1-2: Product: Globetrotter HSUPA Modem
[ 2460.022644] usb 1-2: Manufacturer: Option N.V.
[ 2469.496490] usb 1-2: USB disconnect, device number 11
[ 2472.845245] usb 1-2: new high-speed USB device number 12 using ehci-omap
[ 2473.013946] usb 1-2: New USB device found, idVendor=0af0, idProduct=8800
[ 2473.023376] usb 1-2: New USB device strings: Mfr=3, Product=2, SerialNumber=0
[ 2473.033264] usb 1-2: Product: Globetrotter HSUPA Modem
[ 2473.038757] usb 1-2: Manufacturer: Option N.V.
[ 2474.528289] usb 1-2: USB disconnect, device number 12
[ 2478.829589] usb 1-2: new high-speed USB device number 13 using ehci-omap
[ 2478.998748] usb 1-2: New USB device found, idVendor=0af0, idProduct=8800
[ 2479.008209] usb 1-2: New USB device strings: Mfr=3, Product=2, SerialNumber=0
[ 2479.018005] usb 1-2: Product: Globetrotter HSUPA Modem
[ 2479.023498] usb 1-2: Manufacturer: Option N.V.
[ 2480.374694] usb 1-2: USB disconnect, device number 13

i.e. the modem disconnecting and reconnecting. every few seconds. The modem eventually got upset and has entered a state where I cannot communicate with it.

Quoted 7 lines

So - interesting and useful, but I don't have a complete solution yet.

Also, while this gets the internal USB working (to some extent) the external usb (USB-OTG using the musb driver) is still broken. When CORE is only allowed into retention mode, it works fine. When CORE goes to off-mode, I lose the USB port. So that'll be another problem to solve.

Actually, forget all that. My testing methodology was flawed and I wasn't really seeing what I thought I was seeing.
I'll try to find time to be more careful and if I find something interesting, I'll let you know.

NeilBrown
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (GNU/Linux)

iQIVAwUBUPfDZTnsnt1WYoG5AQJ66w/6Ai4Gw4qQRcSWjK+trZ+1LjobLxjzSmOf OXygPengsCbkAvHyEGPVilsz3C/INQm4DEo6xxqeva8aMU5LjCJFXgwdVCI/mi60 /FShjWVcLWzuakemEbBdXHLC4zrBTbYUb0yFwdqDlBhjSpBtyOqPCqfWNc3oTLs5 p2K8cUsCctKQfQCQW7LWOtgoyC1sRXQY1hTSCkdiXIruv5Kmb038CHUNhpdBbhkC YrG8YE/Xjh7rEJPsrskPpemXgWS80gTQ0R0FPjQ9NNS85USvmAx20ei7DpoGZub1 8QIyGlULq9fXrA4wzlF5+dGgPsNkxjwRRd9MxFoogO0VUMdOocr6hnoS6QCn9AcI VNNJvaBu8bOkyoWU65d46RL+NPYiYMb/6NzPdiLqSYbAeI050+DH589t/yZUeei8 vranN0haOGHbURoi3sw2A4EFID22uSyCdUtyIYAWLpxu0f3Cao3UddzGJFli63wk LnG9a6T6iReeRf3fJwobiIQeEOQTjWTYQknaQscWBzzdFt3Wp72s5uTOhonvES0o 60HpCFHEqfQeK1KG7ueMlFUOggUfO81y0Yow3GZ7SG1QKaiJdt7SnqKJpb4T+IDX BIatatH/s66jLCHWB205t/3/Xf7O83YaqEeLnyY8U4n91vspntW5J2gFltapTymj jzJQI7m9+9c=
=ebni
-----END PGP SIGNATURE-----

#15 lore raw
In reply to NeilBrown
Quoted 25 lines · NeilBrown

Hi,
I'm trying to get off_mode working reliably on my gta04 mobile phone.

My current stumbling block is USB. The "Option" GSM module is attached via USB (there is a separate transceiver chip attached to port 1 which is placed in OMAP_EHCI_PORT_MODE_PHY).

After a suspend/resume cycle with off_mode enabled the GSM module disappears. i.e. 'lsusb' doesn't see it any more and the various ttyHSxx devices don't exist.
Without off mode, the modem always appears after resume.

I discovered that the registers set by:

drivers/mfd/omap-usb-host.c

are not maintained across as suspend/resume so I added the following patch (which I can make a formal submission of if it looks right to others), but that didn't help (or didn't help enough).

If I

echo 1 > /sys/kernel/debug/pm_debug/usbhost_pwrdm/suspend

Quoted 7 lines

thus keeping just the USBHOST power domain out of off_mode, the GSM module doesn't disappear. So it seems that some context in the usbhost domain is not being save and restored.

This is as far as I can get. Can someone suggest where I should look to find out what is not being saved/restored properly, and how to go about saving and restoring?

You need to ensure that USBHOST/TLL context is saved as per the Save and Restore sequence see section "USBHOST/USBTLL Save-and-Restore Management" in the OMAP Technical Reference Manual.

The basic idea there is that software does the context saving into SAR RAM before entering OFF mode and hardware automatically restores the context after coming out of OFF mode.

But that alone is not enough for USB host to work. We need to make sure we have covered all the erratas. There are a number of them which are not covered yet in mainline.

USB remote wakeup is another challenge with OMAP USB host (while in OFF mode). The usual workaround here is to use a GPIO as a wakeup line from the modem.

regards,
-roger

author
#16 lore raw
Quoted 34 lines · On Wed, 16 Jan 2013 12:00:48 +0200 Roger Quadros <[email protected]> wrote:
Quoted 25 lines · NeilBrown

Hi,
I'm trying to get off_mode working reliably on my gta04 mobile phone.

My current stumbling block is USB. The "Option" GSM module is attached via USB (there is a separate transceiver chip attached to port 1 which is placed in OMAP_EHCI_PORT_MODE_PHY).

After a suspend/resume cycle with off_mode enabled the GSM module disappears. i.e. 'lsusb' doesn't see it any more and the various ttyHSxx devices don't exist.
Without off mode, the modem always appears after resume.

I discovered that the registers set by:

drivers/mfd/omap-usb-host.c

are not maintained across as suspend/resume so I added the following patch (which I can make a formal submission of if it looks right to others), but that didn't help (or didn't help enough).

If I

echo 1 > /sys/kernel/debug/pm_debug/usbhost_pwrdm/suspend

Quoted 7 lines

thus keeping just the USBHOST power domain out of off_mode, the GSM module doesn't disappear. So it seems that some context in the usbhost domain is not being save and restored.

This is as far as I can get. Can someone suggest where I should look to find out what is not being saved/restored properly, and how to go about saving and restoring?

Quoted 7 lines

You need to ensure that USBHOST/TLL context is saved as per the Save and Restore sequence see section "USBHOST/USBTLL Save-and-Restore Management" in the OMAP Technical Reference Manual.

The basic idea there is that software does the context saving into SAR RAM before entering OFF mode and hardware automatically restores the context after coming out of OFF mode.

Is it? The way I read the doco, the hardware both saves to SAR RAM, and restores from SAR RAM.
Section 22.2.4.1.6 Save and Restore
of my copy of the TRM says:

Quoted 6 lines

The save-and-restore (SAR) mechanism can extract the hardware context of the high-speed USB host controller (after all USB activity has been suspended) before switching off (=save), save it to an external always-on memory, and reinject it later after the module has been switched on again and reset (=restore) seamlessly for the USB. Part of that context is composed of the register fields described in the current chapter. The rest of the context is composed of the "buried" flip-flops and memories (not accessible by software) like finite state-machine (FSM) states, buffer contents, and miscellaneous random logic bits.

which strongly suggests that it is all handled by hardware. Of course there are other registers that aren't covered by the SAR - we need to identify those and make sure they are saved and restored. I've found a few registers that aren't being restored, but restoring them hasn't made a visible difference yet.

Am I missing something?

Quoted 4 lines

But that alone is not enough for USB host to work. We need to make sure we have covered all the erratas. There are a number of them which are not covered yet in mainline.

Is there a list somewhere?

Quoted 4 lines

USB remote wakeup is another challenge with OMAP USB host (while in OFF mode). The usual workaround here is to use a GPIO as a wakeup line from the modem.

Yes, this is not a problem for my device. There is a GPIO line which signals and incoming SMS or Call and it successfully wakes the device.

Quoted 3 lines

regards,
-roger

Thanks,
NeilBrown

#17 lore raw
Quoted 56 lines · NeilBrown
Quoted 34 lines · On Wed, 16 Jan 2013 12:00:48 +0200 Roger Quadros <[email protected]> wrote:
Quoted 25 lines · NeilBrown

Hi,
I'm trying to get off_mode working reliably on my gta04 mobile phone.

My current stumbling block is USB. The "Option" GSM module is attached via USB (there is a separate transceiver chip attached to port 1 which is placed in OMAP_EHCI_PORT_MODE_PHY).

After a suspend/resume cycle with off_mode enabled the GSM module disappears. i.e. 'lsusb' doesn't see it any more and the various ttyHSxx devices don't exist.
Without off mode, the modem always appears after resume.

I discovered that the registers set by:

drivers/mfd/omap-usb-host.c

are not maintained across as suspend/resume so I added the following patch (which I can make a formal submission of if it looks right to others), but that didn't help (or didn't help enough).

If I

echo 1 > /sys/kernel/debug/pm_debug/usbhost_pwrdm/suspend

Quoted 7 lines

thus keeping just the USBHOST power domain out of off_mode, the GSM module doesn't disappear. So it seems that some context in the usbhost domain is not being save and restored.

This is as far as I can get. Can someone suggest where I should look to find out what is not being saved/restored properly, and how to go about saving and restoring?

Quoted 7 lines

You need to ensure that USBHOST/TLL context is saved as per the Save and Restore sequence see section "USBHOST/USBTLL Save-and-Restore Management" in the OMAP Technical Reference Manual.

The basic idea there is that software does the context saving into SAR RAM before entering OFF mode and hardware automatically restores the context after coming out of OFF mode.

Is it? The way I read the doco, the hardware both saves to SAR RAM, and restores from SAR RAM.
Section 22.2.4.1.6 Save and Restore
of my copy of the TRM says:

Quoted 6 lines

The save-and-restore (SAR) mechanism can extract the hardware context of the high-speed USB host controller (after all USB activity has been suspended) before switching off (=save), save it to an external always-on memory, and reinject it later after the module has been switched on again and reset (=restore) seamlessly for the USB. Part of that context is composed of the register fields described in the current chapter. The rest of the context is composed of the "buried" flip-flops and memories (not accessible by software) like finite state-machine (FSM) states, buffer contents, and miscellaneous random logic bits.

Quoted 5 lines

which strongly suggests that it is all handled by hardware. Of course there are other registers that aren't covered by the SAR - we need to identify those and make sure they are saved and restored. I've found a few registers that aren't being restored, but restoring them hasn't made a visible difference yet.

Yes, you are right. I mixed it up with OMAP4 behaviour, sorry. But still, software needs to ensure that the USBHOST and CORE power domain's SAVEANDRESTORE bit are set to ensure that SAR works.

see section "3.5.4.6 USBHOST/USBTLL Save-and-Restore Management"

This seems to be done by the powerdomain code based on the PWRDM_HAS_HDWR_SAR flag. However, this flag is disabled for USBHOST powerdomain with the following comment.

Quoted 8 lines

Both USBHOST and USBTLL support a save-and-restore mechanism. When the device enters into off mode (that is, all power domains, except the WKUP power domain, are off), the user may want to save the USBHOST context and restore it when exiting off mode. The save-and-restore mechanism for the HS USB Host is enabled by setting the PRCM.PM_PWSTCTRL_USBHOST[4] SAVEANDRESTORE bit; for the USBTLL, it is configured by the PRCM.PM_PWSTCTRL_CORE[4] SAVEANDRESTORE bit. The save mechanism is initiated as the power domain transitions from active to off state (or to OSWR state for the USBTLL), whereas the restore mechanism is initiated as the power domain transitions from off to active power state.

Can you try with the flag enabled?

Quoted 10 lines

Am I missing something?

Quoted 4 lines

But that alone is not enough for USB host to work. We need to make sure we have covered all the erratas. There are a number of them which are not covered yet in mainline.

Is there a list somewhere?

They should be mentioned in the Silicon Errata.

http://www.ti.com/product/omap3530

regards,
-roger

author
#18 lore raw
Quoted 82 lines · On Wed, 16 Jan 2013 12:57:08 +0200 Roger Quadros <[email protected]> wrote:
Quoted 56 lines · NeilBrown
Quoted 34 lines · On Wed, 16 Jan 2013 12:00:48 +0200 Roger Quadros <[email protected]> wrote:
Quoted 25 lines · NeilBrown

Hi,
I'm trying to get off_mode working reliably on my gta04 mobile phone.

My current stumbling block is USB. The "Option" GSM module is attached via USB (there is a separate transceiver chip attached to port 1 which is placed in OMAP_EHCI_PORT_MODE_PHY).

After a suspend/resume cycle with off_mode enabled the GSM module disappears. i.e. 'lsusb' doesn't see it any more and the various ttyHSxx devices don't exist.
Without off mode, the modem always appears after resume.

I discovered that the registers set by:

drivers/mfd/omap-usb-host.c

are not maintained across as suspend/resume so I added the following patch (which I can make a formal submission of if it looks right to others), but that didn't help (or didn't help enough).

If I

echo 1 > /sys/kernel/debug/pm_debug/usbhost_pwrdm/suspend

Quoted 7 lines

thus keeping just the USBHOST power domain out of off_mode, the GSM module doesn't disappear. So it seems that some context in the usbhost domain is not being save and restored.

This is as far as I can get. Can someone suggest where I should look to find out what is not being saved/restored properly, and how to go about saving and restoring?

Quoted 7 lines

You need to ensure that USBHOST/TLL context is saved as per the Save and Restore sequence see section "USBHOST/USBTLL Save-and-Restore Management" in the OMAP Technical Reference Manual.

The basic idea there is that software does the context saving into SAR RAM before entering OFF mode and hardware automatically restores the context after coming out of OFF mode.

Is it? The way I read the doco, the hardware both saves to SAR RAM, and restores from SAR RAM.
Section 22.2.4.1.6 Save and Restore
of my copy of the TRM says:

Quoted 6 lines

The save-and-restore (SAR) mechanism can extract the hardware context of the high-speed USB host controller (after all USB activity has been suspended) before switching off (=save), save it to an external always-on memory, and reinject it later after the module has been switched on again and reset (=restore) seamlessly for the USB. Part of that context is composed of the register fields described in the current chapter. The rest of the context is composed of the "buried" flip-flops and memories (not accessible by software) like finite state-machine (FSM) states, buffer contents, and miscellaneous random logic bits.

Quoted 5 lines

which strongly suggests that it is all handled by hardware. Of course there are other registers that aren't covered by the SAR - we need to identify those and make sure they are saved and restored. I've found a few registers that aren't being restored, but restoring them hasn't made a visible difference yet.

Yes, you are right. I mixed it up with OMAP4 behaviour, sorry. But still, software needs to ensure that the USBHOST and CORE power domain's SAVEANDRESTORE bit are set to ensure that SAR works.

see section "3.5.4.6 USBHOST/USBTLL Save-and-Restore Management"

This seems to be done by the powerdomain code based on the PWRDM_HAS_HDWR_SAR flag. However, this flag is disabled for USBHOST powerdomain with the following comment.

Quoted 8 lines

Both USBHOST and USBTLL support a save-and-restore mechanism. When the device enters into off mode (that is, all power domains, except the WKUP power domain, are off), the user may want to save the USBHOST context and restore it when exiting off mode. The save-and-restore mechanism for the HS USB Host is enabled by setting the PRCM.PM_PWSTCTRL_USBHOST[4] SAVEANDRESTORE bit; for the USBTLL, it is configured by the PRCM.PM_PWSTCTRL_CORE[4] SAVEANDRESTORE bit. The save mechanism is initiated as the power domain transitions from active to off state (or to OSWR state for the USBTLL), whereas the restore mechanism is initiated as the power domain transitions from off to active power state.

Quoted 1 line

Can you try with the flag enabled?

If I keep CORE and USBHOST out of off-mode (by writing to the relevant 'suspend' files in /sys/kernel/debug/pm-debug) then it all works.

If I set this flag, then I can allow USBHOST to enter off-mode as long as I keep CORE in retention or better.

If I let CORE and USBHOST go to off-mode and don't have the flag set, then I can resume from suspend, but the usb modem has disappeared.

If I let CORE and USBHOST go to off-mode and DO have the flag set, then I cannot even resume from suspend.... sometimes.

I hate those "sometimes"s!

If I remove the battery (with no other power source present) and re-insert it, and let the phone boot up to stable state and then enter suspend, I cannot resume from suspend. (I tried setting "no_console_suspend" to see if anything was happening - but that keeps CORE awake).

If I do the same but before it suspends I:

echo 1 > /sys/kernel/debug/pm_debug/core_pwrdm/suspend

then let is suspend and resume, the resume works. Then I:

echo 0 > /sys/kernel/debug/pm_debug/core_pwrdm/suspend

to allow full sleep mode and now suspend, and again resume works. And it continues to work.
And the USB modem remains visible - it doesn't disconnect at all.

So.... something very odd is happening somewhere.
Maybe the USBHOST powerdomain isn't really going to off-mode again after the first time like the comment in powerdomains3xxx_data.c says:

/*
* REVISIT: Enabling usb host save and restore mechanism seems to
* leave the usb host domain permanently in ACTIVE mode after
* changing the usb host power domain state from OFF to active once.
* Disabling for now.
*/

However the /sys/kernel/debug/pm_debug/count file shows the "OFF" count for usbhost_pwrdm increments on each suspend, and that seems to be based on info read out of the the OMAP3 itself....

All very odd.

Thanks,
NeilBrown

#19 lore raw
Quoted 89 lines · NeilBrown
Quoted 82 lines · On Wed, 16 Jan 2013 12:57:08 +0200 Roger Quadros <[email protected]> wrote:
Quoted 56 lines · NeilBrown
Quoted 34 lines · On Wed, 16 Jan 2013 12:00:48 +0200 Roger Quadros <[email protected]> wrote:
Quoted 25 lines · NeilBrown

Hi,
I'm trying to get off_mode working reliably on my gta04 mobile phone.

My current stumbling block is USB. The "Option" GSM module is attached via USB (there is a separate transceiver chip attached to port 1 which is placed in OMAP_EHCI_PORT_MODE_PHY).

After a suspend/resume cycle with off_mode enabled the GSM module disappears. i.e. 'lsusb' doesn't see it any more and the various ttyHSxx devices don't exist.
Without off mode, the modem always appears after resume.

I discovered that the registers set by:

drivers/mfd/omap-usb-host.c

are not maintained across as suspend/resume so I added the following patch (which I can make a formal submission of if it looks right to others), but that didn't help (or didn't help enough).

If I

echo 1 > /sys/kernel/debug/pm_debug/usbhost_pwrdm/suspend

Quoted 7 lines

thus keeping just the USBHOST power domain out of off_mode, the GSM module doesn't disappear. So it seems that some context in the usbhost domain is not being save and restored.

This is as far as I can get. Can someone suggest where I should look to find out what is not being saved/restored properly, and how to go about saving and restoring?

Quoted 7 lines

You need to ensure that USBHOST/TLL context is saved as per the Save and Restore sequence see section "USBHOST/USBTLL Save-and-Restore Management" in the OMAP Technical Reference Manual.

The basic idea there is that software does the context saving into SAR RAM before entering OFF mode and hardware automatically restores the context after coming out of OFF mode.

Is it? The way I read the doco, the hardware both saves to SAR RAM, and restores from SAR RAM.
Section 22.2.4.1.6 Save and Restore
of my copy of the TRM says:

Quoted 6 lines

The save-and-restore (SAR) mechanism can extract the hardware context of the high-speed USB host controller (after all USB activity has been suspended) before switching off (=save), save it to an external always-on memory, and reinject it later after the module has been switched on again and reset (=restore) seamlessly for the USB. Part of that context is composed of the register fields described in the current chapter. The rest of the context is composed of the "buried" flip-flops and memories (not accessible by software) like finite state-machine (FSM) states, buffer contents, and miscellaneous random logic bits.

Quoted 5 lines

which strongly suggests that it is all handled by hardware. Of course there are other registers that aren't covered by the SAR - we need to identify those and make sure they are saved and restored. I've found a few registers that aren't being restored, but restoring them hasn't made a visible difference yet.

Yes, you are right. I mixed it up with OMAP4 behaviour, sorry. But still, software needs to ensure that the USBHOST and CORE power domain's SAVEANDRESTORE bit are set to ensure that SAR works.

see section "3.5.4.6 USBHOST/USBTLL Save-and-Restore Management"

This seems to be done by the powerdomain code based on the PWRDM_HAS_HDWR_SAR flag. However, this flag is disabled for USBHOST powerdomain with the following comment.

Quoted 8 lines

Both USBHOST and USBTLL support a save-and-restore mechanism. When the device enters into off mode (that is, all power domains, except the WKUP power domain, are off), the user may want to save the USBHOST context and restore it when exiting off mode. The save-and-restore mechanism for the HS USB Host is enabled by setting the PRCM.PM_PWSTCTRL_USBHOST[4] SAVEANDRESTORE bit; for the USBTLL, it is configured by the PRCM.PM_PWSTCTRL_CORE[4] SAVEANDRESTORE bit. The save mechanism is initiated as the power domain transitions from active to off state (or to OSWR state for the USBTLL), whereas the restore mechanism is initiated as the power domain transitions from off to active power state.

Quoted 1 line

Can you try with the flag enabled?

If I keep CORE and USBHOST out of off-mode (by writing to the relevant 'suspend' files in /sys/kernel/debug/pm-debug) then it all works.

Quoted 9 lines

If I set this flag, then I can allow USBHOST to enter off-mode as long as I keep CORE in retention or better.

If I let CORE and USBHOST go to off-mode and don't have the flag set, then I can resume from suspend, but the usb modem has disappeared.

If I let CORE and USBHOST go to off-mode and DO have the flag set, then I cannot even resume from suspend.... sometimes.

It looks like the problem creeps in when the OMAP device hits OFF. i.e. CORE is allowed to go OFF.

Quoted 11 lines

I hate those "sometimes"s!

If I remove the battery (with no other power source present) and re-insert it, and let the phone boot up to stable state and then enter suspend, I cannot resume from suspend. (I tried setting "no_console_suspend" to see if anything was happening - but that keeps CORE awake).

If I do the same but before it suspends I:

echo 1 > /sys/kernel/debug/pm_debug/core_pwrdm/suspend

Quoted 8 lines

then let is suspend and resume, the resume works. Then I:

echo 0 > /sys/kernel/debug/pm_debug/core_pwrdm/suspend

to allow full sleep mode and now suspend, and again resume works. And it continues to work.
And the USB modem remains visible - it doesn't disconnect at all.

So does repeated suspend/resume work after this? Or is it only the first suspend/resume.

Quoted 11 lines

So.... something very odd is happening somewhere.
Maybe the USBHOST powerdomain isn't really going to off-mode again after the first time like the comment in powerdomains3xxx_data.c says:

/*
* REVISIT: Enabling usb host save and restore mechanism seems to
* leave the usb host domain permanently in ACTIVE mode after
* changing the usb host power domain state from OFF to active once.
* Disabling for now.
*/

Quoted 5 lines

However the /sys/kernel/debug/pm_debug/count file shows the "OFF" count for usbhost_pwrdm increments on each suspend, and that seems to be based on info read out of the the OMAP3 itself....

All very odd.

I need to give this a try. I can try it out on OMAP3 beagle board.

What OMAP3 are you on, and which kernel are you using for your tests?

cheers,
-roger

author
#20 lore raw
Quoted 118 lines · On Thu, 17 Jan 2013 13:29:07 +0200 Roger Quadros <[email protected]> wrote:
Quoted 89 lines · NeilBrown
Quoted 82 lines · On Wed, 16 Jan 2013 12:57:08 +0200 Roger Quadros <[email protected]> wrote:
Quoted 56 lines · NeilBrown
Quoted 34 lines · On Wed, 16 Jan 2013 12:00:48 +0200 Roger Quadros <[email protected]> wrote:
Quoted 25 lines · NeilBrown

Hi,
I'm trying to get off_mode working reliably on my gta04 mobile phone.

My current stumbling block is USB. The "Option" GSM module is attached via USB (there is a separate transceiver chip attached to port 1 which is placed in OMAP_EHCI_PORT_MODE_PHY).

After a suspend/resume cycle with off_mode enabled the GSM module disappears. i.e. 'lsusb' doesn't see it any more and the various ttyHSxx devices don't exist.
Without off mode, the modem always appears after resume.

I discovered that the registers set by:

drivers/mfd/omap-usb-host.c

are not maintained across as suspend/resume so I added the following patch (which I can make a formal submission of if it looks right to others), but that didn't help (or didn't help enough).

If I

echo 1 > /sys/kernel/debug/pm_debug/usbhost_pwrdm/suspend

Quoted 7 lines

thus keeping just the USBHOST power domain out of off_mode, the GSM module doesn't disappear. So it seems that some context in the usbhost domain is not being save and restored.

This is as far as I can get. Can someone suggest where I should look to find out what is not being saved/restored properly, and how to go about saving and restoring?

Quoted 7 lines

You need to ensure that USBHOST/TLL context is saved as per the Save and Restore sequence see section "USBHOST/USBTLL Save-and-Restore Management" in the OMAP Technical Reference Manual.

The basic idea there is that software does the context saving into SAR RAM before entering OFF mode and hardware automatically restores the context after coming out of OFF mode.

Is it? The way I read the doco, the hardware both saves to SAR RAM, and restores from SAR RAM.
Section 22.2.4.1.6 Save and Restore
of my copy of the TRM says:

Quoted 6 lines

The save-and-restore (SAR) mechanism can extract the hardware context of the high-speed USB host controller (after all USB activity has been suspended) before switching off (=save), save it to an external always-on memory, and reinject it later after the module has been switched on again and reset (=restore) seamlessly for the USB. Part of that context is composed of the register fields described in the current chapter. The rest of the context is composed of the "buried" flip-flops and memories (not accessible by software) like finite state-machine (FSM) states, buffer contents, and miscellaneous random logic bits.

Quoted 5 lines

which strongly suggests that it is all handled by hardware. Of course there are other registers that aren't covered by the SAR - we need to identify those and make sure they are saved and restored. I've found a few registers that aren't being restored, but restoring them hasn't made a visible difference yet.

Yes, you are right. I mixed it up with OMAP4 behaviour, sorry. But still, software needs to ensure that the USBHOST and CORE power domain's SAVEANDRESTORE bit are set to ensure that SAR works.

see section "3.5.4.6 USBHOST/USBTLL Save-and-Restore Management"

This seems to be done by the powerdomain code based on the PWRDM_HAS_HDWR_SAR flag. However, this flag is disabled for USBHOST powerdomain with the following comment.

Quoted 8 lines

Both USBHOST and USBTLL support a save-and-restore mechanism. When the device enters into off mode (that is, all power domains, except the WKUP power domain, are off), the user may want to save the USBHOST context and restore it when exiting off mode. The save-and-restore mechanism for the HS USB Host is enabled by setting the PRCM.PM_PWSTCTRL_USBHOST[4] SAVEANDRESTORE bit; for the USBTLL, it is configured by the PRCM.PM_PWSTCTRL_CORE[4] SAVEANDRESTORE bit. The save mechanism is initiated as the power domain transitions from active to off state (or to OSWR state for the USBTLL), whereas the restore mechanism is initiated as the power domain transitions from off to active power state.

Quoted 1 line

Can you try with the flag enabled?

If I keep CORE and USBHOST out of off-mode (by writing to the relevant 'suspend' files in /sys/kernel/debug/pm-debug) then it all works.

Quoted 9 lines

If I set this flag, then I can allow USBHOST to enter off-mode as long as I keep CORE in retention or better.

If I let CORE and USBHOST go to off-mode and don't have the flag set, then I can resume from suspend, but the usb modem has disappeared.

If I let CORE and USBHOST go to off-mode and DO have the flag set, then I cannot even resume from suspend.... sometimes.

It looks like the problem creeps in when the OMAP device hits OFF. i.e. CORE is allowed to go OFF.

Quoted 15 lines

I hate those "sometimes"s!

If I remove the battery (with no other power source present) and re-insert it, and let the phone boot up to stable state and then enter suspend, I cannot resume from suspend. (I tried setting "no_console_suspend" to see if anything was happening - but that keeps CORE awake).

If I do the same but before it suspends I:

echo 1 > /sys/kernel/debug/pm_debug/core_pwrdm/suspend

then let is suspend and resume, the resume works. Then I:

echo 0 > /sys/kernel/debug/pm_debug/core_pwrdm/suspend

Quoted 7 lines
Quoted 4 lines

to allow full sleep mode and now suspend, and again resume works. And it continues to work.
And the USB modem remains visible - it doesn't disconnect at all.

So does repeated suspend/resume work after this? Or is it only the first suspend/resume.

suspend/resume continues to work until a power-down.
Even after a soft reboot (which goes back to ILO and u-boot, but doesn't remove power), suspend/resume continue to work.
It is only after a power-off that I need one suspend cycle with CORE in retention before things work.

Quoted 16 lines
Quoted 16 lines

So.... something very odd is happening somewhere.
Maybe the USBHOST powerdomain isn't really going to off-mode again after the first time like the comment in powerdomains3xxx_data.c says:

/*
* REVISIT: Enabling usb host save and restore mechanism seems to
* leave the usb host domain permanently in ACTIVE mode after
* changing the usb host power domain state from OFF to active once.
* Disabling for now.
*/

However the /sys/kernel/debug/pm_debug/count file shows the "OFF" count for usbhost_pwrdm increments on each suspend, and that seems to be based on info read out of the the OMAP3 itself....

Quoted 5 lines
Quoted 1 line

All very odd.

I need to give this a try. I can try it out on OMAP3 beagle board.

What OMAP3 are you on, and which kernel are you using for your tests?

I believe it is a DM3730

# cat /proc/cpuinfo 
Processor	: ARMv7 Processor rev 2 (v7l)
BogoMIPS	: 311.92
Features	: swp half thumb fastmult vfp edsp thumbee neon vfpv3 tls 
CPU implementer	: 0x41
CPU architecture: 7
CPU variant	: 0x3
CPU part	: 0xc08
CPU revision	: 2

Hardware : GTA04
Revision : 0020
Serial : 0000000000000000

Kernel is the 'mainline' branch of git://neil.brown.name/gta04 (commit
388c9f46f9d566bd7f7dd6acb45c113c59c11417)

This is 3.7 plus a bunch of fixes and additions to make it all mostly work on this board (Panel driver, audio glue, sdio wifi fixes, sensor drivers, bug fixes, etc etc etc).

Thanks,
NeilBrown