HI:
I am having a problem of usb client after a suspend/resume.
1) cold boot -> plug in USB -> active sync works
2) plug out usb cable -> suspend unit -> resume unit
3) plug in usb cable -> on host PC it showed failed to
recognized device.

the usbfn driver is provided by mainstone III bsp,when I traced
the code of bul_usbfn.cpp,
I found the register UDCCR[UDA] always be '0' after suspend /
resume.


any helps?
Thanks !

Jason

Re: USB client suspend and resume on PXA270 by Elias

Elias
Mon May 14 13:14:31 CDT 2007

Jason,

A question-Does USBC work if you don't suspend/resume, i.e. plug->
connect-> unplug -> plug -> connect?
If so, this might point some settings in your Suspend/Resume
implementation of the system not the Mainstoneiii driver.
It is usually it bit complicated to suspend/resume USBC when connect
without doing an unplug. But what you are doing should be similar to a
regular unplug and replug and the Suspend should not be a factor
UNLESS:
what is happening is that when you plug the device, D+ is being pulled
high so that the HOST PC recognized the speed and starts communication
with the device. But the communication is failing somewhere. So
1) Check that you are not trying to save/change/restore any UCD
register on your way to suspend or out of resume outside the USBC
driver, the Mainstone code should handle this.
2) Make sure that you are restoring the clock enable register USBC
(CKEN) when you are resumed.
3) Make sure that when you unplug before a suspend, that the PC sees
a disconnect
4) Make sure that when in suspend, the D+ is not pulled high - that
the PC thinks there is something connected prematurely

-Elias

On May 14, 7:52 am, ddj...@gmail.com wrote:
> HI:
> I am having a problem of usb client after a suspend/resume.
> 1) cold boot -> plug in USB -> active sync works
> 2) plug out usb cable -> suspend unit -> resume unit
> 3) plug in usb cable -> on host PC it showed failed to
> recognized device.
>
> the usbfn driver is provided by mainstone III bsp,when I traced
> the code of bul_usbfn.cpp,
> I found the register UDCCR[UDA] always be '0' after suspend /
> resume.
>
> any helps?
> Thanks !
>
> Jason



Re: USB client suspend and resume on PXA270 by ddjpol

ddjpol
Tue May 15 00:11:09 CDT 2007

On 5=D4=C215=C8=D5, =C9=CF=CE=E72=CA=B114=B7=D6, Elias Radi <l...@inhand.co=
m> wrote:
> Jason,
>
> A question-Does USBC work if you don't suspend/resume, i.e. plug->
> connect-> unplug -> plug -> connect?
> If so, this might point some settings in your Suspend/Resume
> implementation of the system not the Mainstoneiii driver.
> It is usually it bit complicated to suspend/resume USBC when connect
> without doing an unplug. But what you are doing should be similar to a
> regular unplug and replug and the Suspend should not be a factor
> UNLESS:
> what is happening is that when you plug the device, D+ is being pulled
> high so that the HOST PC recognized the speed and starts communication
> with the device. But the communication is failing somewhere. So
> 1) Check that you are not trying to save/change/restore any UCD
> register on your way to suspend or out of resume outside the USBC
> driver, the Mainstone code should handle this.
> 2) Make sure that you are restoring the clock enable register USBC
> (CKEN) when you are resumed.
> 3) Make sure that when you unplug before a suspend, that the PC sees
> a disconnect
> 4) Make sure that when in suspend, the D+ is not pulled high - that
> the PC thinks there is something connected prematurely
>
> -Elias
>
> On May 14, 7:52 am, ddj...@gmail.com wrote:
>
>
>
> > HI:
> > I am having a problem of usb client after a suspend/resume.
> > 1) cold boot -> plug in USB -> active sync works
> > 2) plug out usb cable -> suspend unit -> resume unit
> > 3) plug in usb cable -> on host PC it showed failed to
> > recognized device.
>
> > the usbfn driver is provided by mainstone III bsp,when I traced
> > the code of bul_usbfn.cpp,
> > I found the register UDCCR[UDA] always be '0' after suspend /
> > resume.
>
> > any helps?
> > Thanks !
>
> > Jason- =D2=FE=B2=D8=B1=BB=D2=FD=D3=C3=CE=C4=D7=D6 -
>
> - =CF=D4=CA=BE=D2=FD=D3=C3=B5=C4=CE=C4=D7=D6 -

Elias:

Thanks for you reply!
Yes, before suspend/resume, the usb client works very good.
plug->connect->unplug->disconnect.->plug->...... And when I
unplug, the PC disconnect immediately.
In System suspend/resume routine, I did not save/change/restore
any UDC register. after resume ,the CKEN of usb client has be set
correctly.
the following is the trace information of usbfn driver in supend-
>resume routine.

1)In suspending, PM call usbfn's IOControl ,Set D0->D4, it called
PowerMgr(TRUE)
void BulUsbDevice::PowerMgr(BOOL bOff)
{
Lock();
if (bOff) {
// Disable Device to simulate remove from bus.
UDCCR udccr;
udccr.ulValue =3D 0;
udccr.bit.UDE =3D 0 ;
WriteControlRegister(udccr.ulValue);
......

2)after resume PM Call IOControl,set D4->D0,it called
PowerMgr(FALSE)
else{
UDCCR udccr;
udccr.ulValue =3D 0;
udccr.bit.UDE =3D 1 ;
WriteControlRegister(udccr.ulValue);
......
and then call ReInit() in SetPowerState().
then ,the UDC generate a USB reset intterupt, and the IST
"ThreadRun()"
handled this intterupt. but the UDCCR[UDA] is always be '0'.

3)when I plugin usb cable, the D+ pull high,but not intterup .
4) PC showed failed to recognized device.

I have no ideas, do you have any suggest?

Jason


Re: USB client suspend and resume on PXA270 by Elias

Elias
Tue May 15 19:31:51 CDT 2007

Jason,
The bul_usbfn.cpp code should work fine, no need to to save/restore
any UDC regs. How is the hardware connected? Do have a Cable Connected
pin going to a GPIO? If so, check that the IsCableAttached() call is
using it and it is configured well after the resume, i.e. Input, NO
AltFunc...etc.
If this still does not work, try using the MainstoneII drivers or port
MainstoneIII CE6.0 drives.

Elias

\On May 15, 1:11 am, ddj...@gmail.com wrote:
> On 5=E6=9C=8815=E6=97=A5, =E4=B8=8A=E5=8D=882=E6=97=B614=E5=88=86, Elias =
Radi <l...@inhand.com> wrote:
>
>
>
> > Jason,
>
> > A question-Does USBC work if you don't suspend/resume, i.e. plug->
> > connect-> unplug -> plug -> connect?
> > If so, this might point some settings in your Suspend/Resume
> > implementation of the system not the Mainstoneiii driver.
> > It is usually it bit complicated to suspend/resume USBC when connect
> > without doing an unplug. But what you are doing should be similar to a
> > regular unplug and replug and the Suspend should not be a factor
> > UNLESS:
> > what is happening is that when you plug the device, D+ is being pulled
> > high so that the HOST PC recognized the speed and starts communication
> > with the device. But the communication is failing somewhere. So
> > 1) Check that you are not trying to save/change/restore any UCD
> > register on your way to suspend or out of resume outside the USBC
> > driver, the Mainstone code should handle this.
> > 2) Make sure that you are restoring the clock enable register USBC
> > (CKEN) when you are resumed.
> > 3) Make sure that when you unplug before a suspend, that the PC sees
> > a disconnect
> > 4) Make sure that when in suspend, the D+ is not pulled high - that
> > the PC thinks there is something connected prematurely
>
> > -Elias
>
> > On May 14, 7:52 am, ddj...@gmail.com wrote:
>
> > > HI:
> > > I am having a problem of usb client after a suspend/resume.
> > > 1) cold boot -> plug in USB -> active sync works
> > > 2) plug out usb cable -> suspend unit -> resume unit
> > > 3) plug in usb cable -> on host PC it showed failed to
> > > recognized device.
>
> > > the usbfn driver is provided by mainstone III bsp,when I traced
> > > the code of bul_usbfn.cpp,
> > > I found the register UDCCR[UDA] always be '0' after suspend /
> > > resume.
>
> > > any helps?
> > > Thanks !
>
> > > Jason- =E9=9A=90=E8=97=8F=E8=A2=AB=E5=BC=95=E7=94=A8=E6=96=87=E5=
=AD=97 -
>
> > - =E6=98=BE=E7=A4=BA=E5=BC=95=E7=94=A8=E7=9A=84=E6=96=87=E5=AD=97 -
>
> Elias:
>
> Thanks for you reply!
> Yes, before suspend/resume, the usb client works very good.
> plug->connect->unplug->disconnect.->plug->...... And when I
> unplug, the PC disconnect immediately.
> In System suspend/resume routine, I did not save/change/restore
> any UDC register. after resume ,the CKEN of usb client has be set
> correctly.
> the following is the trace information of usbfn driver in supend-
>
> >resume routine.
>
> 1)In suspending, PM call usbfn's IOControl ,Set D0->D4, it called
> PowerMgr(TRUE)
> void BulUsbDevice::PowerMgr(BOOL bOff)
> {
> Lock();
> if (bOff) {
> // Disable Device to simulate remove from bus.
> UDCCR udccr;
> udccr.ulValue =3D 0;
> udccr.bit.UDE =3D 0 ;
> WriteControlRegister(udccr.ulValue);
> ......
>
> 2)after resume PM Call IOControl,set D4->D0,it called
> PowerMgr(FALSE)
> else{
> UDCCR udccr;
> udccr.ulValue =3D 0;
> udccr.bit.UDE =3D 1 ;
> WriteControlRegister(udccr.ulValue);
> ......
> and then call ReInit() in SetPowerState().
> then ,the UDC generate a USB reset intterupt, and the IST
> "ThreadRun()"
> handled this intterupt. but the UDCCR[UDA] is always be '0'.
>
> 3)when I plugin usb cable, the D+ pull high,but not intterup .
> 4) PC showed failed to recognized device.
>
> I have no ideas, do you have any suggest?
>
> Jason



Re: USB client suspend and resume on PXA270 by ddjpol

ddjpol
Tue May 15 23:39:16 CDT 2007

On 5=D4=C216=C8=D5, =C9=CF=CE=E78=CA=B131=B7=D6, Elias Radi <l...@inhand.co=
m> wrote:
> Jason,
> The bul_usbfn.cpp code should work fine, no need to to save/restore
> any UDC regs. How is the hardware connected? Do have a Cable Connected
> pin going to a GPIO? If so, check that the IsCableAttached() call is
> using it and it is configured well after the resume, i.e. Input, NO
> AltFunc...etc.
> If this still does not work, try using the MainstoneII drivers or port
> MainstoneIII CE6.0 drives.
>
> Elias
>
> \On May 15, 1:11 am, ddj...@gmail.com wrote:
>
>
>
> > On 5=D4=C215=C8=D5, =C9=CF=CE=E72=CA=B114=B7=D6, Elias Radi <l...@inhan=
d=2Ecom> wrote:
>
> > > Jason,
>
> > > A question-Does USBC work if you don't suspend/resume, i.e. plug->
> > > connect-> unplug -> plug -> connect?
> > > If so, this might point some settings in your Suspend/Resume
> > > implementation of the system not the Mainstoneiii driver.
> > > It is usually it bit complicated to suspend/resume USBC when connect
> > > without doing an unplug. But what you are doing should be similar to a
> > > regular unplug and replug and the Suspend should not be a factor
> > > UNLESS:
> > > what is happening is that when you plug the device, D+ is being pulled
> > > high so that the HOST PC recognized the speed and starts communication
> > > with the device. But the communication is failing somewhere. So
> > > 1) Check that you are not trying to save/change/restore any UCD
> > > register on your way to suspend or out of resume outside the USBC
> > > driver, the Mainstone code should handle this.
> > > 2) Make sure that you are restoring the clock enable register USBC
> > > (CKEN) when you are resumed.
> > > 3) Make sure that when you unplug before a suspend, that the PC sees
> > > a disconnect
> > > 4) Make sure that when in suspend, the D+ is not pulled high - that
> > > the PC thinks there is something connected prematurely
>
> > > -Elias
>
> > > On May 14, 7:52 am, ddj...@gmail.com wrote:
>
> > > > HI:
> > > > I am having a problem of usb client after a suspend/resume.
> > > > 1) cold boot -> plug in USB -> active sync works
> > > > 2) plug out usb cable -> suspend unit -> resume unit
> > > > 3) plug in usb cable -> on host PC it showed failed to
> > > > recognized device.
>
> > > > the usbfn driver is provided by mainstone III bsp,when I trac=
ed
> > > > the code of bul_usbfn.cpp,
> > > > I found the register UDCCR[UDA] always be '0' after suspend /
> > > > resume.
>
> > > > any helps?
> > > > Thanks !
>
> > > > Jason- =D2=FE=B2=D8=B1=BB=D2=FD=D3=C3=CE=C4=D7=D6 -
>
> > > - =CF=D4=CA=BE=D2=FD=D3=C3=B5=C4=CE=C4=D7=D6 -
>
> > Elias:
>
> > Thanks for you reply!
> > Yes, before suspend/resume, the usb client works very good.
> > plug->connect->unplug->disconnect.->plug->...... And when I
> > unplug, the PC disconnect immediately.
> > In System suspend/resume routine, I did not save/change/restore
> > any UDC register. after resume ,the CKEN of usb client has be set
> > correctly.
> > the following is the trace information of usbfn driver in supend-
>
> > >resume routine.
>
> > 1)In suspending, PM call usbfn's IOControl ,Set D0->D4, it called
> > PowerMgr(TRUE)
> > void BulUsbDevice::PowerMgr(BOOL bOff)
> > {
> > Lock();
> > if (bOff) {
> > // Disable Device to simulate remove from bus.
> > UDCCR udccr;
> > udccr.ulValue =3D 0;
> > udccr.bit.UDE =3D 0 ;
> > WriteControlRegister(udccr.ulValue);
> > ......
>
> > 2)after resume PM Call IOControl,set D4->D0,it called
> > PowerMgr(FALSE)
> > else{
> > UDCCR udccr;
> > udccr.ulValue =3D 0;
> > udccr.bit.UDE =3D 1 ;
> > WriteControlRegister(udccr.ulValue);
> > ......
> > and then call ReInit() in SetPowerState().
> > then ,the UDC generate a USB reset intterupt, and the IST
> > "ThreadRun()"
> > handled this intterupt. but the UDCCR[UDA] is always be '0'.
>
> > 3)when I plugin usb cable, the D+ pull high,but not intterup .
> > 4) PC showed failed to recognized device.
>
> > I have no ideas, do you have any suggest?
>
> > Jason- =D2=FE=B2=D8=B1=BB=D2=FD=D3=C3=CE=C4=D7=D6 -
>
> - =CF=D4=CA=BE=D2=FD=D3=C3=B5=C4=CE=C4=D7=D6 -

Elias:

This issue has being solved, thanks for your help.
After resume, the PWR register PSSR[OTGPH] has being
set as '1',I don't know why,so I unmask this bit, then the
usb client work.


Thanks!

Jason