Skip to contentSkip to conversation

usb: dwc2: Fix and improve power saving modes.

PATCH Minas Harutyunyan 3 participants 4 messages Oct 23, 2020 – Oct 27, 2020 1 message not in the archive USB

lore
Share & tools
lore

Minas Harutyunyan

author Acked-by
#1 lore raw
In reply to a message not in the archive
Quoted 88 lines · Artur Petrosyan

This patch set fixes/improves partial power down, hibernation power saving modes and adds support for host/device clock gating.

Changes from V1:
- Added new patches.
1. usb: dwc2: Add support for dwc2 host/device clock gating.
2. usb: dwc2: Add exit power saving mode before removing driver.
3. usb: dwc2: Fix HPRT0.PrtSusp bit setting for HiKey 960 board.

- Updated patches
1. usb: dwc2: Fix/update enter/exit partial power down.
- Updated the patch name from "usb: dwc2: Fix dwc2_restore_device_registers() function." to "usb: dwc2:
Fix/update enter/exit partial power down."
- Updated entering and exiting partial power down function flow. Before there was a lot of confusions with core entering to partial power down in device or host mode.
- Added "rem_wakeup" for host exiting from Partial Power Down mode from host remote wakeup flow. According to programming guide in host mode, port power must be
turned on when wakeup is detected.
- Added "in_ppd" flag to indicate the core state after entering into Partial Power Down mode.
2. usb: dwc2: Fix wakeup detected and session request interrupt handlers.
- According to programming guide added partial power
down exit flow in wakeup detected interrupt handler.
- Added clock gating exit flow from wakeup detected
and session request interrupt handlers.
3. usb: dwc2: Fix suspend state in host mode for partial power down.
- Added "dwc2_port_suspend" and "dwc2_port_resume" functions to "core.h" header file
- Updated "USB_PORT_FEAT_RESET" flow when core receives port reset in Partial Power Down or Hibernation state.
- Added return "-ENODEV" if core is in suspend state
in "_dwc2_hcd_urb_enqueue" function to avoid port
reset issue, when an external hub is connected.
4. usb: dwc2: Add part. power down exit from dwc2_conn_id_status_change().
- Instead of clearing registers inline for exiting partial power down mode, now calling the "dwc2_exit_partial_power_down" function without restoring the backup registers.
5. usb: dwc2: Update dwc2_handle_usb_suspend_intr function.
- Added changes suggested by Douglas Anderson from commit "usb: dwc2: Get rid of useless error checks for hibernation/partial power down"
6. usb: dwc2: Fix hibernation between host and device modes.
- Added setting of "hsotg->bus_suspended" flag to 0 because before if core exited from "GPWRDN_STS_CHGINT" interrupt in host mode the flag remained true not letting enter to hibernation next time.
7. usb: dwc2: Clear fifo_map when resetting core.
- Added "static inline void dwc2_clear_fifo_map()" helper function to clear fifo_map with peripheral or dual role mode.
- Added a dummy version of "dwc2_clear_fifo_map()" helper for host-only mode.
8. usb: dwc2: Add power saving mode support from system issued suspend/resume.
- Updated the patch name from "usb: dwc2: Add enter/exit hibernation from system scheduled suspend" to "usb: dwc2: Add power saving mode support from system issued suspend/resume."
- Fixed issue related to "spinlock already unlocked" reported by Doug Anderson.

- Abandoned patches.
1. usb: dwc2: Add port conn. sts. checking in _dwc2_hcd_resume() function.
- The changes of this patch are moved to the "usb: dwc2: Add power saving mode support from system issued suspend/resume" patch.
2. usb: dwc2: Add flag and debug messages for Partial Power Down mode.
- The changes of this patch are moved to the "usb: dwc2: Fix/update enter/exit partial power down." patch.

Artur Petrosyan (15):
usb: dwc2: Fix/update enter/exit partial power down.
usb: dwc2: Add support for dwc2 host/device clock gating.
usb: dwc2: Fix wakeup detected and session request interrupt handlers.
usb: dwc2: Fix suspend state in host mode for partial power down.
usb: dwc2: Add part. power down exit from

     dwc2_conn_id_status_change().

usb: dwc2: Reset DEVADDR after exiting gadget hibernation.
usb: dwc2: Add default param to control power optimization.
usb: dwc2: Update dwc2_handle_usb_suspend_intr function.
usb: dwc2: Fix hibernation between host and device modes.
usb: dwc2: Fix HPRT0.PrtSusp bit setting for HiKey 960 board.
usb: dwc2: Allow exiting hibernation from gpwrdn rst detect
usb: dwc2: Clear fifo_map when resetting core.
usb: dwc2: Clear GINTSTS_RESTOREDONE bit after restore is generated.
usb: dwc2: Add power saving mode support from system issued
suspend/resume
usb: dwc2: Add exit power saving mode before removing driver

Quoted 11 lines
  drivers/usb/dwc2/core.c      | 125 ++------
  drivers/usb/dwc2/core.h      |  46 ++-
  drivers/usb/dwc2/core_intr.c | 284 ++++++++++-------
  drivers/usb/dwc2/debugfs.c   |   2 +
  drivers/usb/dwc2/gadget.c    | 223 ++++++++++++-
  drivers/usb/dwc2/hcd.c       | 589 ++++++++++++++++++++++++++---------
  drivers/usb/dwc2/hw.h        |   1 +
  drivers/usb/dwc2/params.c    |  17 +-
  drivers/usb/dwc2/platform.c  |  44 ++-
  9 files changed, 960 insertions(+), 371 deletions(-)
#2 lore raw

Hi,

Quoted 80 lines · Minas Harutyunyan
Quoted 79 lines · Artur Petrosyan

This patch set fixes/improves partial power down, hibernation power saving modes and adds support for host/device clock gating.

Changes from V1:
- Added new patches.
1. usb: dwc2: Add support for dwc2 host/device clock gating.
2. usb: dwc2: Add exit power saving mode before removing driver.
3. usb: dwc2: Fix HPRT0.PrtSusp bit setting for HiKey 960 board.

- Updated patches
1. usb: dwc2: Fix/update enter/exit partial power down.
- Updated the patch name from "usb: dwc2: Fix dwc2_restore_device_registers() function." to "usb: dwc2:
Fix/update enter/exit partial power down."
- Updated entering and exiting partial power down function flow. Before there was a lot of confusions with core entering to partial power down in device or host mode.
- Added "rem_wakeup" for host exiting from Partial Power Down mode from host remote wakeup flow. According to programming guide in host mode, port power must be
turned on when wakeup is detected.
- Added "in_ppd" flag to indicate the core state after entering into Partial Power Down mode.
2. usb: dwc2: Fix wakeup detected and session request interrupt handlers.
- According to programming guide added partial power
down exit flow in wakeup detected interrupt handler.
- Added clock gating exit flow from wakeup detected
and session request interrupt handlers.
3. usb: dwc2: Fix suspend state in host mode for partial power down.
- Added "dwc2_port_suspend" and "dwc2_port_resume" functions to "core.h" header file
- Updated "USB_PORT_FEAT_RESET" flow when core receives port reset in Partial Power Down or Hibernation state.
- Added return "-ENODEV" if core is in suspend state
in "_dwc2_hcd_urb_enqueue" function to avoid port
reset issue, when an external hub is connected.
4. usb: dwc2: Add part. power down exit from dwc2_conn_id_status_change().
- Instead of clearing registers inline for exiting partial power down mode, now calling the "dwc2_exit_partial_power_down" function without restoring the backup registers.
5. usb: dwc2: Update dwc2_handle_usb_suspend_intr function.
- Added changes suggested by Douglas Anderson from commit "usb: dwc2: Get rid of useless error checks for hibernation/partial power down"
6. usb: dwc2: Fix hibernation between host and device modes.
- Added setting of "hsotg->bus_suspended" flag to 0 because before if core exited from "GPWRDN_STS_CHGINT" interrupt in host mode the flag remained true not letting enter to hibernation next time.
7. usb: dwc2: Clear fifo_map when resetting core.
- Added "static inline void dwc2_clear_fifo_map()" helper function to clear fifo_map with peripheral or dual role mode.
- Added a dummy version of "dwc2_clear_fifo_map()" helper for host-only mode.
8. usb: dwc2: Add power saving mode support from system issued suspend/resume.
- Updated the patch name from "usb: dwc2: Add enter/exit hibernation from system scheduled suspend" to "usb: dwc2: Add power saving mode support from system issued suspend/resume."
- Fixed issue related to "spinlock already unlocked" reported by Doug Anderson.

- Abandoned patches.
1. usb: dwc2: Add port conn. sts. checking in _dwc2_hcd_resume() function.
- The changes of this patch are moved to the "usb: dwc2: Add power saving mode support from system issued suspend/resume" patch.
2. usb: dwc2: Add flag and debug messages for Partial Power Down mode.
- The changes of this patch are moved to the "usb: dwc2: Fix/update enter/exit partial power down." patch.

Artur Petrosyan (15):
usb: dwc2: Fix/update enter/exit partial power down.
usb: dwc2: Add support for dwc2 host/device clock gating.
usb: dwc2: Fix wakeup detected and session request interrupt handlers.
usb: dwc2: Fix suspend state in host mode for partial power down.
usb: dwc2: Add part. power down exit from

     dwc2_conn_id_status_change().

usb: dwc2: Reset DEVADDR after exiting gadget hibernation.
usb: dwc2: Add default param to control power optimization.
usb: dwc2: Update dwc2_handle_usb_suspend_intr function.

Quoted 8 lines
Quoted 8 lines

usb: dwc2: Fix hibernation between host and device modes.
usb: dwc2: Fix HPRT0.PrtSusp bit setting for HiKey 960 board.
usb: dwc2: Allow exiting hibernation from gpwrdn rst detect
usb: dwc2: Clear fifo_map when resetting core.
usb: dwc2: Clear GINTSTS_RESTOREDONE bit after restore is generated.
usb: dwc2: Add power saving mode support from system issued
suspend/resume
usb: dwc2: Add exit power saving mode before removing driver

where are all the patches? I only got the cover letter. When resending, please collect Minas' acked-by.

Signature · 1 line
balbi
#3 lore raw

Hi Felipe,

Quoted 93 lines · Felipe Balbi

Hi,

Quoted 80 lines · Minas Harutyunyan
Quoted 79 lines · Artur Petrosyan

This patch set fixes/improves partial power down, hibernation power saving modes and adds support for host/device clock gating.

Changes from V1:
- Added new patches.
1. usb: dwc2: Add support for dwc2 host/device clock gating.
2. usb: dwc2: Add exit power saving mode before removing driver.
3. usb: dwc2: Fix HPRT0.PrtSusp bit setting for HiKey 960 board.

- Updated patches
1. usb: dwc2: Fix/update enter/exit partial power down.
- Updated the patch name from "usb: dwc2: Fix dwc2_restore_device_registers() function." to "usb: dwc2:
Fix/update enter/exit partial power down."
- Updated entering and exiting partial power down function flow. Before there was a lot of confusions with core
entering to partial power down in device or host mode.
- Added "rem_wakeup" for host exiting from Partial Power
Down mode from host remote wakeup flow. According to programming guide in host mode, port power must be
turned on when wakeup is detected.
- Added "in_ppd" flag to indicate the core state after entering into Partial Power Down mode.
2. usb: dwc2: Fix wakeup detected and session request interrupt handlers.
- According to programming guide added partial power
down exit flow in wakeup detected interrupt handler.
- Added clock gating exit flow from wakeup detected
and session request interrupt handlers.
3. usb: dwc2: Fix suspend state in host mode for partial power down.
- Added "dwc2_port_suspend" and "dwc2_port_resume" functions to "core.h" header file
- Updated "USB_PORT_FEAT_RESET" flow when core receives port reset in Partial Power Down or Hibernation state.
- Added return "-ENODEV" if core is in suspend state
in "_dwc2_hcd_urb_enqueue" function to avoid port
reset issue, when an external hub is connected.
4. usb: dwc2: Add part. power down exit from dwc2_conn_id_status_change().
- Instead of clearing registers inline for exiting partial power down mode, now calling the "dwc2_exit_partial_power_down" function without restoring the backup registers.
5. usb: dwc2: Update dwc2_handle_usb_suspend_intr function.
- Added changes suggested by Douglas Anderson from commit "usb: dwc2: Get rid of useless error checks for hibernation/partial power down"
6. usb: dwc2: Fix hibernation between host and device modes.
- Added setting of "hsotg->bus_suspended" flag to 0 because before if core exited from "GPWRDN_STS_CHGINT" interrupt in host mode the flag remained true not letting enter to hibernation next time.
7. usb: dwc2: Clear fifo_map when resetting core.
- Added "static inline void dwc2_clear_fifo_map()" helper function to clear fifo_map with peripheral or dual role mode.
- Added a dummy version of "dwc2_clear_fifo_map()" helper
for host-only mode.
8. usb: dwc2: Add power saving mode support from system issued suspend/resume.
- Updated the patch name from "usb: dwc2: Add enter/exit hibernation from system scheduled suspend" to "usb: dwc2: Add power saving mode support from system issued suspend/resume."
- Fixed issue related to "spinlock already unlocked" reported by Doug Anderson.

- Abandoned patches.
1. usb: dwc2: Add port conn. sts. checking in _dwc2_hcd_resume() function.
- The changes of this patch are moved to the "usb: dwc2: Add power saving mode support from system issued suspend/resume" patch.
2. usb: dwc2: Add flag and debug messages for Partial Power Down mode.
- The changes of this patch are moved to the "usb: dwc2: Fix/update enter/exit partial power down." patch.

Artur Petrosyan (15):
usb: dwc2: Fix/update enter/exit partial power down.
usb: dwc2: Add support for dwc2 host/device clock gating.
usb: dwc2: Fix wakeup detected and session request interrupt handlers.
usb: dwc2: Fix suspend state in host mode for partial power down.
usb: dwc2: Add part. power down exit from
dwc2_conn_id_status_change().
usb: dwc2: Reset DEVADDR after exiting gadget hibernation.
usb: dwc2: Add default param to control power optimization.
usb: dwc2: Update dwc2_handle_usb_suspend_intr function.

Quoted 8 lines
Quoted 8 lines

usb: dwc2: Fix hibernation between host and device modes.
usb: dwc2: Fix HPRT0.PrtSusp bit setting for HiKey 960 board.
usb: dwc2: Allow exiting hibernation from gpwrdn rst detect
usb: dwc2: Clear fifo_map when resetting core.
usb: dwc2: Clear GINTSTS_RESTOREDONE bit after restore is generated.
usb: dwc2: Add power saving mode support from system issued
suspend/resume
usb: dwc2: Add exit power saving mode before removing driver

Quoted 3 lines

where are all the patches? I only got the cover letter. When resending, please collect Minas' acked-by.

I am not sure how to answer to the question. The patch series including all the patches has been successfully sent to LKML. My colleagues has received them. Didn't you get e-mail? because I can see that your e-mail address is listed in "To" list of all the patches in the series.

Also related to collection of Minas' acked-by. Do I need to add the acked-by tag to all the patches or only in the 0 patch? Because the acked-by tag is now done for only the 0 patch.

Regards,
Artur

#4 lore raw

Hi,

Quoted 96 lines · Artur Petrosyan

Hi Felipe,

Quoted 93 lines · Felipe Balbi

Hi,

Quoted 88 lines · Minas Harutyunyan
Quoted 87 lines · Artur Petrosyan

This patch set fixes/improves partial power down, hibernation power saving modes and adds support for host/device clock gating.

Changes from V1:
- Added new patches.
1. usb: dwc2: Add support for dwc2 host/device clock gating.
2. usb: dwc2: Add exit power saving mode before removing driver.
3. usb: dwc2: Fix HPRT0.PrtSusp bit setting for HiKey 960 board.

- Updated patches
1. usb: dwc2: Fix/update enter/exit partial power down.
- Updated the patch name from "usb: dwc2: Fix dwc2_restore_device_registers() function." to "usb: dwc2:
Fix/update enter/exit partial power down."
- Updated entering and exiting partial power down function flow. Before there was a lot of confusions with core
entering to partial power down in device or host mode.
- Added "rem_wakeup" for host exiting from Partial Power
Down mode from host remote wakeup flow. According to programming guide in host mode, port power must be
turned on when wakeup is detected.
- Added "in_ppd" flag to indicate the core state after entering into Partial Power Down mode.
2. usb: dwc2: Fix wakeup detected and session request interrupt handlers.
- According to programming guide added partial power
down exit flow in wakeup detected interrupt handler.
- Added clock gating exit flow from wakeup detected
and session request interrupt handlers.
3. usb: dwc2: Fix suspend state in host mode for partial power down.
- Added "dwc2_port_suspend" and "dwc2_port_resume" functions to "core.h" header file
- Updated "USB_PORT_FEAT_RESET" flow when core receives port reset in Partial Power Down or Hibernation state.
- Added return "-ENODEV" if core is in suspend state
in "_dwc2_hcd_urb_enqueue" function to avoid port
reset issue, when an external hub is connected.
4. usb: dwc2: Add part. power down exit from dwc2_conn_id_status_change().
- Instead of clearing registers inline for exiting partial power down mode, now calling the "dwc2_exit_partial_power_down" function without restoring the backup registers.
5. usb: dwc2: Update dwc2_handle_usb_suspend_intr function.
- Added changes suggested by Douglas Anderson from commit "usb: dwc2: Get rid of useless error checks for hibernation/partial power down"
6. usb: dwc2: Fix hibernation between host and device modes.
- Added setting of "hsotg->bus_suspended" flag to 0 because before if core exited from "GPWRDN_STS_CHGINT" interrupt in host mode the flag remained true not letting enter to hibernation next time.
7. usb: dwc2: Clear fifo_map when resetting core.
- Added "static inline void dwc2_clear_fifo_map()" helper function to clear fifo_map with peripheral or dual role mode.
- Added a dummy version of "dwc2_clear_fifo_map()" helper
for host-only mode.
8. usb: dwc2: Add power saving mode support from system issued suspend/resume.
- Updated the patch name from "usb: dwc2: Add enter/exit hibernation from system scheduled suspend" to "usb: dwc2: Add power saving mode support from system issued suspend/resume."
- Fixed issue related to "spinlock already unlocked" reported by Doug Anderson.

- Abandoned patches.
1. usb: dwc2: Add port conn. sts. checking in _dwc2_hcd_resume() function.
- The changes of this patch are moved to the "usb: dwc2: Add power saving mode support from system issued suspend/resume" patch.
2. usb: dwc2: Add flag and debug messages for Partial Power Down mode.
- The changes of this patch are moved to the "usb: dwc2: Fix/update enter/exit partial power down." patch.

Artur Petrosyan (15):
usb: dwc2: Fix/update enter/exit partial power down.
usb: dwc2: Add support for dwc2 host/device clock gating.
usb: dwc2: Fix wakeup detected and session request interrupt handlers.
usb: dwc2: Fix suspend state in host mode for partial power down.
usb: dwc2: Add part. power down exit from
dwc2_conn_id_status_change().
usb: dwc2: Reset DEVADDR after exiting gadget hibernation.
usb: dwc2: Add default param to control power optimization.
usb: dwc2: Update dwc2_handle_usb_suspend_intr function.
usb: dwc2: Fix hibernation between host and device modes.
usb: dwc2: Fix HPRT0.PrtSusp bit setting for HiKey 960 board.
usb: dwc2: Allow exiting hibernation from gpwrdn rst detect
usb: dwc2: Clear fifo_map when resetting core.
usb: dwc2: Clear GINTSTS_RESTOREDONE bit after restore is generated.
usb: dwc2: Add power saving mode support from system issued
suspend/resume
usb: dwc2: Add exit power saving mode before removing driver

Quoted 8 lines
Quoted 3 lines

where are all the patches? I only got the cover letter. When resending, please collect Minas' acked-by.

I am not sure how to answer to the question. The patch series including all the patches has been successfully sent to LKML. My colleagues has received them. Didn't you get e-mail? because I can see that your e-mail address is listed in "To" list of all the patches in the series.

oh, I see what happened, this is the same series where patches were not sent as a reply to the cover letter. Now I understand.

Quoted 3 lines

Also related to collection of Minas' acked-by. Do I need to add the acked-by tag to all the patches or only in the 0 patch? Because the acked-by tag is now done for only the 0 patch.

Every patch. Patch 0 doesn't go into git ;-)

Signature · 1 line
balbi