Em Friday 22 February 2008 17:33:10 Alan Stern escreveu:
> On Thu, 21 Feb 2008, Herton Ronaldo Krzesinski wrote:
> 
> > So the child branch is taken and USB_PERSIST && child->persist_enabled
> > evaluates as true. Also udev->reset_resume is enabled. The problem here
> > is inside usb_reset_device. The devices are redetected because a
> > reenumeration is forced, see that usb_reset_device return -ENOTCONN because:
> > 
> > - usb_reset_device call chain is hub_port_init -> hub_port_reset ->
> > hub_port_wait_reset. In hub_port_wait_reset, the call to hub_port_status
> > doesn't fail, but portstatus or portchange are respectively
> > USB_PORT_STAT_CONNECTION or USB_PORT_STAT_C_CONNECTION
> > (Look that no one of the printks in hub_port_wait_reset are printed),
> > and -ENOTCONN then from one of the two returns go back until
> > usb_reset_device that then takes the re_enumeration label that causes the
> > logical disconnect, so the redetection happens.
> > 
> > I don't know why ehci is returning this portchange/portstatus, but this is
> > triggering the redetection.
> 
> Yes, the problem is the USB_PORT_STAT_C_CONNECTION.  (Although I'm not 
> sure why udev->reset_resume was enabled...)
> 
> Anyway, try this patch; it ought to help.
> 
> Alan Stern
> 

Hi Alan, I had some delay as only could access the hardware today. Your patch
helped without a doubt, thanks a lot, s2ram is working ok now, here is the
complete log:

[   89.412854] PM: Syncing filesystems ... done.
[   89.427257] Freezing user space processes ... (elapsed 0.01 seconds) done.
[   89.446375] Freezing remaining freezable tasks ... (elapsed 0.00 seconds) 
done.
[   89.446739] ACPI: Preparing to enter system sleep state S3
[   89.447454] Suspending console(s)
[   89.955861] uhci_hcd 0000:00:1d.1: release dev 2 ep81-INT, period 8, phase 
4, 118 us
[   89.956788] uhci_hcd 0000:00:1d.1: release dev 2 ep82-INT, period 8, phase 
4, 118 us
[   89.958834] usb 3-1: usb suspend
[   89.969786] usb 1-6: usb suspend
[   89.980745] usb 1-5: usb suspend
[   89.991715] usb 1-1: usb suspend
[   90.002680] hub 3-0:1.0: hub_suspend
[   90.002691] usb usb3: bus suspend
[   90.002695] usb usb3: suspend_rh
[   90.002719] hub 1-0:1.0: hub_suspend
[   90.002723] usb usb1: bus suspend
[   90.002727] ehci_hcd 0000:00:1d.7: suspend root hub
[   90.002761] drm_sysfs_suspend
[   90.003321] ACPI: PCI interrupt for device 0000:00:02.0 disabled
[   90.013911] ACPI handle has no context!
[   90.013936] ACPI handle has no context!
[   90.024912] ACPI: PCI interrupt for device 0000:00:1e.2 disabled
[   90.025032] ACPI: PCI interrupt for device 0000:00:1d.7 disabled
[   90.035579] ehci_hcd 0000:00:1d.7: --> PCI D3/wakeup
[   90.035609] uhci_hcd 0000:00:1d.3: uhci_suspend
[   90.035643] ACPI: PCI interrupt for device 0000:00:1d.3 disabled
[   90.035646] uhci_hcd 0000:00:1d.3: --> PCI D0/legacy
[   90.035650] uhci_hcd 0000:00:1d.2: uhci_suspend
[   90.035684] ACPI: PCI interrupt for device 0000:00:1d.2 disabled
[   90.035687] uhci_hcd 0000:00:1d.2: --> PCI D0/legacy
[   90.035691] uhci_hcd 0000:00:1d.1: uhci_suspend
[   90.035723] ACPI: PCI interrupt for device 0000:00:1d.1 disabled
[   90.035727] uhci_hcd 0000:00:1d.1: --> PCI D0/legacy
[   90.035730] uhci_hcd 0000:00:1d.0: uhci_suspend
[   90.035762] ACPI: PCI interrupt for device 0000:00:1d.0 disabled
[   90.035766] uhci_hcd 0000:00:1d.0: --> PCI D0/legacy
[   90.035766] Intel machine check architecture supported.
[   90.035779] Intel machine check reporting enabled on CPU#0.
[   90.035833] Back to C!
[   90.062187] PM: Writing back config space on device 0000:00:02.0 at offset 1 
(was 900007, writing 900003)
[   90.081040] PM: Writing back config space on device 0000:00:1c.0 at offset f 
(was 20100, writing 2010a)
[   90.081111] ACPI: PCI Interrupt 0000:00:1c.0[A] -> GSI 16 (level, low) -> 
IRQ 16
[   90.081121] PCI: Setting latency timer of device 0000:00:1c.0 to 64
[   90.081128] uhci_hcd 0000:00:1d.0: PCI legacy resume
[   90.081135] ACPI: PCI Interrupt 0000:00:1d.0[A] -> GSI 23 (level, low) -> 
IRQ 23
[   90.081143] PCI: Setting latency timer of device 0000:00:1d.0 to 64
[   90.081171] uhci_hcd 0000:00:1d.0: uhci_resume
[   90.081178] uhci_hcd 0000:00:1d.0: uhci_check_and_reset_hc: legsup = 0x0f30
[   90.081182] uhci_hcd 0000:00:1d.0: Performing full reset
[   90.081184] usb usb2: root hub lost power or was reset
[   90.081184] usb usb2: suspend_rh
[   90.081195] uhci_hcd 0000:00:1d.1: PCI legacy resume
[   90.081204] ACPI: PCI Interrupt 0000:00:1d.1[B] -> GSI 19 (level, low) -> 
IRQ 19
[   90.081212] PCI: Setting latency timer of device 0000:00:1d.1 to 64
[   90.081240] uhci_hcd 0000:00:1d.1: uhci_resume
[   90.081245] uhci_hcd 0000:00:1d.1: uhci_check_and_reset_hc: legsup = 0x0030
[   90.081249] uhci_hcd 0000:00:1d.1: Performing full reset
[   90.081269] usb usb3: root hub lost power or was reset
[   90.081273] usb usb3: suspend_rh
[   90.081323] uhci_hcd 0000:00:1d.2: PCI legacy resume
[   90.081333] ACPI: PCI Interrupt 0000:00:1d.2[C] -> GSI 18 (level, low) -> 
IRQ 18
[   90.081341] PCI: Setting latency timer of device 0000:00:1d.2 to 64
[   90.081369] uhci_hcd 0000:00:1d.2: uhci_resume
[   90.081375] uhci_hcd 0000:00:1d.2: uhci_check_and_reset_hc: legsup = 0x0030
[   90.081379] uhci_hcd 0000:00:1d.2: Performing full reset
[   90.081399] usb usb4: root hub lost power or was reset
[   90.081402] usb usb4: suspend_rh
[   90.081417] uhci_hcd 0000:00:1d.3: PCI legacy resume
[   90.081424] ACPI: PCI Interrupt 0000:00:1d.3[D] -> GSI 16 (level, low) -> 
IRQ 16
[   90.081432] PCI: Setting latency timer of device 0000:00:1d.3 to 64
[   90.081459] uhci_hcd 0000:00:1d.3: uhci_resume
[   90.081464] uhci_hcd 0000:00:1d.3: uhci_check_and_reset_hc: legsup = 0x0030
[   90.081468] uhci_hcd 0000:00:1d.3: Performing full reset
[   90.081488] usb usb5: root hub lost power or was reset
[   90.081491] usb usb5: suspend_rh
[   90.081513] ehci_hcd 0000:00:1d.7: PCI D0, from previous PCI D3
[   90.092161] ACPI: PCI Interrupt 0000:00:1d.7[A] -> GSI 23 (level, low) -> 
IRQ 23
[   90.092173] PCI: Setting latency timer of device 0000:00:1d.7 to 64
[   90.092247] PM: Writing back config space on device 0000:00:1e.0 at offset f 
(was 20000, writing 200ff)
[   90.092285] PCI: Setting latency timer of device 0000:00:1e.0 to 64
[   90.092318] PM: Writing back config space on device 0000:00:1e.2 at offset 1 
(was 2900007, writing 2900003)
[   90.092336] ACPI: PCI Interrupt 0000:00:1e.2[A] -> GSI 17 (level, low) -> 
IRQ 17
[   90.092345] PCI: Setting latency timer of device 0000:00:1e.2 to 64
[   90.107139] PM: Writing back config space on device 0000:01:00.0 at offset f 
(was 100, writing 10a)
[   90.107155] PM: Writing back config space on device 0000:01:00.0 at offset c 
(was 0, writing febc0000)
[   90.107173] PM: Writing back config space on device 0000:01:00.0 at offset 6 
(was 4, writing febff004)
[   90.107184] PM: Writing back config space on device 0000:01:00.0 at offset 4 
(was 1, writing e801)
[   90.107193] PM: Writing back config space on device 0000:01:00.0 at offset 3 
(was 0, writing 10)
[   90.107204] PM: Writing back config space on device 0000:01:00.0 at offset 1 
(was 100000, writing 100007)
[   90.111117] r8169: eth0: link up
[   90.118094] ACPI: PCI Interrupt 0000:00:02.0[A] -> GSI 16 (level, low) -> 
IRQ 16
[   90.119533] usb usb1: usb resume
[   90.119538] ehci_hcd 0000:00:1d.7: resume root hub
[   90.130509] hub 1-0:1.0: hub_resume
[   90.130523] usb usb2: usb resume
[   90.130527] usb usb2: wakeup_rh
[   90.162456] hub 2-0:1.0: trying to enable port power on non-switchable hub
[   90.263238] usb usb3: usb resume
[   90.263244] usb usb3: wakeup_rh
[   90.295176] hub 3-0:1.0: trying to enable port power on non-switchable hub
[   90.395960] hub 3-0:1.0: hub_reset_resume: child TRUE
[   90.395969] hub 3-0:1.0: hub_reset_resume: USB_PERSIST && 
child->persist_enabled
[   90.395991] usb usb4: usb resume
[   90.395994] usb usb4: wakeup_rh
[   90.427916] hub 4-0:1.0: trying to enable port power on non-switchable hub
[   90.528697] usb usb5: usb resume
[   90.528706] usb usb5: wakeup_rh
[   90.560633] hub 5-0:1.0: trying to enable port power on non-switchable hub
[   90.661403] ehci_hcd 0000:00:1d.7: GetStatus port 1 status 001803 POWER 
sig=j CSC CONNECT
[   90.661414] usb 1-1: persist_enabled 1 status 0 portstatus 501 change 1
[   90.672325] usb 1-1: finish reset-resume
[   90.672332] usb 1-1: finish_port_resume: udev->reset_resume enabled
[   90.723483] ehci_hcd 0000:00:1d.7: port 1 high speed
[   90.723495] ehci_hcd 0000:00:1d.7: GetStatus port 1 status 001005 POWER 
sig=se0 PE CONNECT
[   90.723503] hub_port_wait_reset successful or delayed
[   90.774123] usb 1-1: reset high speed USB device using ehci_hcd and address 2
[   90.825266] ehci_hcd 0000:00:1d.7: port 1 high speed
[   90.825276] ehci_hcd 0000:00:1d.7: GetStatus port 1 status 001005 POWER 
sig=se0 PE CONNECT
[   90.825283] hub_port_wait_reset successful or delayed
[   90.888539] ehci_hcd 0000:00:1d.7: GetStatus port 5 status 001803 POWER 
sig=j CSC CONNECT
[   90.888550] usb 1-5: persist_enabled 1 status 0 portstatus 501 change 1
[   90.898823] usb 1-5: finish reset-resume
[   90.898829] usb 1-5: finish_port_resume: udev->reset_resume enabled
[   90.949969] ehci_hcd 0000:00:1d.7: port 5 high speed
[   90.949980] ehci_hcd 0000:00:1d.7: GetStatus port 5 status 001005 POWER 
sig=se0 PE CONNECT
[   90.949988] hub_port_wait_reset successful or delayed
[   91.000564] usb 1-5: reset high speed USB device using ehci_hcd and address 4
[   91.069618] ehci_hcd 0000:00:1d.7: port 5 high speed
[   91.069628] ehci_hcd 0000:00:1d.7: GetStatus port 5 status 001005 POWER 
sig=se0 PE CONNECT
[   91.069635] hub_port_wait_reset successful or delayed
[   91.169047] usb usb2: suspend_rh (auto-stop)
[   91.205977] ehci_hcd 0000:00:1d.7: GetStatus port 6 status 001803 POWER 
sig=j CSC CONNECT
[   91.205977] usb 1-6: persist_enabled 1 status 0 portstatus 501 change 1
[   91.216711] usb 1-6: finish reset-resume
[   91.216717] usb 1-6: finish_port_resume: udev->reset_resume enabled
[   91.267875] ehci_hcd 0000:00:1d.7: port 6 high speed
[   91.267886] ehci_hcd 0000:00:1d.7: GetStatus port 6 status 001005 POWER 
sig=se0 PE CONNECT
[   91.267893] hub_port_wait_reset successful or delayed
[   91.318460] usb 1-6: reset high speed USB device using ehci_hcd and address 5
[   91.370572] ehci_hcd 0000:00:1d.7: port 6 high speed
[   91.370582] ehci_hcd 0000:00:1d.7: GetStatus port 6 status 001005 POWER 
sig=se0 PE CONNECT
[   91.370589] hub_port_wait_reset successful or delayed
[   91.418191] usb usb4: suspend_rh (auto-stop)
[   91.519837] usb 1-6: manual set_interface for iface 0, alt 0
[   91.520777] uhci_hcd 0000:00:1d.1: port 1 portsc 01a9,00
[   91.520777] usb 3-1: persist_enabled 1 status 0 portstatus 301 change 2
[   91.531474] usb 3-1: finish reset-resume
[   91.531480] usb 3-1: finish_port_resume: udev->reset_resume enabled
[   91.667119] usb usb5: suspend_rh (auto-stop)
[   91.731956] hub_port_wait_reset successful or delayed
[   91.782818] usb 3-1: reset low speed USB device using uhci_hcd and address 2
[   91.989217] hub_port_wait_reset successful or delayed
[   92.086504] uhci_hcd 0000:00:1d.1: reserve dev 2 ep81-INT, period 8, phase 
4, 118 us
[   92.089407] uhci_hcd 0000:00:1d.1: reserve dev 2 ep82-INT, period 8, phase 
4, 118 us
[   92.629916] Restarting tasks ... <7>hub 1-0:1.0: state 7 ports 8 chg 0000 
evt 0000
[   92.631090] ehci_hcd 0000:00:1d.7: GetStatus port 4 status 001803 POWER 
sig=j CSC CONNECT
[   92.631228] hub 1-0:1.0: port 4, status 0501, change 0001, 480 Mb/s
[   92.633096] done.
[   92.648424] input: AT Translated Set 2 keyboard as /class/input/input10
[   92.734908] hub 1-0:1.0: debounce: port 4: total 100ms stable 100ms status 
0x501
[   92.786004] ehci_hcd 0000:00:1d.7: port 4 high speed
[   92.786110] ehci_hcd 0000:00:1d.7: GetStatus port 4 status 001005 POWER 
sig=se0 PE CONNECT
[   92.786246] hub_port_wait_reset successful or delayed
[   92.836706] usb 1-4: new high speed USB device using ehci_hcd and address 6
[   92.889711] ehci_hcd 0000:00:1d.7: port 4 high speed
[   92.889809] ehci_hcd 0000:00:1d.7: GetStatus port 4 status 001005 POWER 
sig=se0 PE CONNECT
[   92.889943] hub_port_wait_reset successful or delayed
[   92.954677] usb 1-4: default language 0x0409
[   92.958882] usb 1-4: uevent
[   92.958882] usb 1-4: usb_probe_device
[   92.958882] usb 1-4: configuration #1 chosen from 1 choice
[   92.959125] usb 1-4: adding 1-4:1.0 (config #1, interface 0)
[   92.959303] usb 1-4:1.0: uevent
[   92.959451] usb-storage 1-4:1.0: usb_probe_interface
[   92.959552] usb-storage 1-4:1.0: usb_probe_interface - got id
[   93.013953] scsi1 : SCSI emulation for USB Mass Storage devices
[   93.015196] drivers/usb/core/inode.c: creating file '006'
[   93.015339] usb 1-4: New USB device found, idVendor=05e3, idProduct=0715
[   93.015433] usb 1-4: New USB device strings: Mfr=3, Product=4, SerialNumber=5
[   93.015534] usb 1-4: Product: USB Reader
[   93.015616] usb 1-4: Manufacturer: Genesys
[   93.015704] usb 1-4: SerialNumber: 000000000000
[   93.015827] hub 2-0:1.0: state 7 ports 2 chg 0000 evt 0000
[   93.015939] hub 3-0:1.0: state 7 ports 2 chg 0000 evt 0002
[   93.016057] hub 4-0:1.0: state 7 ports 2 chg 0000 evt 0000
[   93.016165] hub 5-0:1.0: state 7 ports 2 chg 0000 evt 0000
[   93.016288] usb-storage: device found at 6
[   93.016375] usb-storage: waiting for device to settle before scanning
[   95.387940] hub 2-0:1.0: hub_suspend
[   95.388058] usb usb2: bus auto-suspend
[   95.388140] usb usb2: suspend_rh
[   95.388228] hub 4-0:1.0: hub_suspend
[   95.388307] usb usb4: bus auto-suspend
[   95.388390] usb usb4: suspend_rh
[   95.388476] hub 5-0:1.0: hub_suspend
[   95.388554] usb usb5: bus auto-suspend
[   95.388640] usb usb5: suspend_rh
[   98.007245] scsi 1:0:0:0: Direct-Access     Generic  STORAGE DEVICE   9404 
PQ: 0 ANSI: 0
[   98.010086] sd 1:0:0:0: [sdb] Attached SCSI removable disk
[   98.010346] sd 1:0:0:0: Attached scsi generic sg1 type 0
[   98.011712] usb-storage: device scan complete

> 
> 
> Index: usb-2.6/drivers/usb/core/hub.c
> ===================================================================
> --- usb-2.6.orig/drivers/usb/core/hub.c
> +++ usb-2.6/drivers/usb/core/hub.c
> @@ -1903,6 +1903,24 @@ int usb_port_resume(struct usb_device *u
>               status = hub_port_status(hub, port1, &portstatus, &portchange);
>  
>   SuspendCleared:
> +             /* Even if the root hub didn't lose power, an unplug-replug
> +              * cycle should cause USB_PERSIST to kick in.
> +              */
> +             dev_dbg(&udev->dev, "persist_enabled %d status %d "
> +                             "portstatus %x change %x\n",
> +                             udev->persist_enabled, status,
> +                             portstatus, portchange);
> +             if (USB_PERSIST && udev->persist_enabled && status >= 0 &&
> +                             !(portstatus & USB_PORT_STAT_ENABLE)) {
> +                     if (portchange & USB_PORT_STAT_C_ENABLE)
> +                             clear_port_feature(hub->hdev, port1,
> +                                             USB_PORT_FEAT_C_ENABLE);
> +                     if (portchange & USB_PORT_STAT_C_CONNECTION)
> +                             clear_port_feature(hub->hdev, port1,
> +                                             USB_PORT_FEAT_C_CONNECTION);
> +                     udev->reset_resume = 1;
> +             }
> +
>               if (USB_PERSIST && udev->reset_resume)
>                       want_flags = USB_PORT_STAT_POWER
>                                       | USB_PORT_STAT_CONNECTION;
> 
> 

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

Reply via email to