diff options
Diffstat (limited to 'drivers/usb/dwc2/core.h')
| -rw-r--r-- | drivers/usb/dwc2/core.h | 49 | 
1 files changed, 45 insertions, 4 deletions
| diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h index 7161344c6522..da5ac4a4595b 100644 --- a/drivers/usb/dwc2/core.h +++ b/drivers/usb/dwc2/core.h @@ -38,6 +38,7 @@  #ifndef __DWC2_CORE_H__  #define __DWC2_CORE_H__ +#include <linux/acpi.h>  #include <linux/phy/phy.h>  #include <linux/regulator/consumer.h>  #include <linux/usb/gadget.h> @@ -426,7 +427,7 @@ enum dwc2_ep0_state {   * @g_tx_fifo_size:	An array of TX fifo sizes in dedicated fifo   *			mode. Each value corresponds to one EP   *			starting from EP1 (max 15 values). Sizes are - *			in DWORDS with possible values from from + *			in DWORDS with possible values from   *			16-32768 (default: 256, 256, 256, 256, 768,   *			768, 768, 768, 0, 0, 0, 0, 0, 0, 0).   * @change_speed_quirk: Change speed configuration to DWC2_SPEED_PARAM_FULL @@ -865,6 +866,8 @@ struct dwc2_hregs_backup {   * @gadget_enabled:	Peripheral mode sub-driver initialization indicator.   * @ll_hw_enabled:	Status of low-level hardware resources.   * @hibernated:		True if core is hibernated + * @in_ppd:		True if core is partial power down mode. + * @bus_suspended:	True if bus is suspended   * @reset_phy_on_wake:	Quirk saying that we should assert PHY reset on a   *			remote wakeup.   * @phy_off_for_suspend: Status of whether we turned the PHY off at suspend. @@ -1022,7 +1025,6 @@ struct dwc2_hregs_backup {   *			a pointer to an array of register definitions, the   *			array size and the base address where the register bank   *			is to be found. - * @bus_suspended:	True if bus is suspended   * @last_frame_num:	Number of last frame. Range from 0 to  32768   * @frame_num_array:    Used only  if CONFIG_USB_DWC2_TRACK_MISSED_SOFS is   *			defined, for missed SOFs tracking. Array holds that @@ -1060,6 +1062,8 @@ struct dwc2_hsotg {  	unsigned int gadget_enabled:1;  	unsigned int ll_hw_enabled:1;  	unsigned int hibernated:1; +	unsigned int in_ppd:1; +	bool bus_suspended;  	unsigned int reset_phy_on_wake:1;  	unsigned int need_phy_for_wake:1;  	unsigned int phy_off_for_suspend:1; @@ -1143,7 +1147,6 @@ struct dwc2_hsotg {  	unsigned long hs_periodic_bitmap[  		DIV_ROUND_UP(DWC2_HS_SCHEDULE_US, BITS_PER_LONG)];  	u16 periodic_qh_count; -	bool bus_suspended;  	bool new_connection;  	u16 last_frame_num; @@ -1301,7 +1304,8 @@ static inline bool dwc2_is_hs_iot(struct dwc2_hsotg *hsotg)   */  int dwc2_core_reset(struct dwc2_hsotg *hsotg, bool skip_wait);  int dwc2_enter_partial_power_down(struct dwc2_hsotg *hsotg); -int dwc2_exit_partial_power_down(struct dwc2_hsotg *hsotg, bool restore); +int dwc2_exit_partial_power_down(struct dwc2_hsotg *hsotg, int rem_wakeup, +				 bool restore);  int dwc2_enter_hibernation(struct dwc2_hsotg *hsotg, int is_host);  int dwc2_exit_hibernation(struct dwc2_hsotg *hsotg, int rem_wakeup,  		int reset, int is_host); @@ -1339,6 +1343,7 @@ irqreturn_t dwc2_handle_common_intr(int irq, void *dev);  /* The device ID match table */  extern const struct of_device_id dwc2_of_match_table[]; +extern const struct acpi_device_id dwc2_acpi_match[];  int dwc2_lowlevel_hw_enable(struct dwc2_hsotg *hsotg);  int dwc2_lowlevel_hw_disable(struct dwc2_hsotg *hsotg); @@ -1409,11 +1414,19 @@ int dwc2_restore_device_registers(struct dwc2_hsotg *hsotg, int remote_wakeup);  int dwc2_gadget_enter_hibernation(struct dwc2_hsotg *hsotg);  int dwc2_gadget_exit_hibernation(struct dwc2_hsotg *hsotg,  				 int rem_wakeup, int reset); +int dwc2_gadget_enter_partial_power_down(struct dwc2_hsotg *hsotg); +int dwc2_gadget_exit_partial_power_down(struct dwc2_hsotg *hsotg, +					bool restore); +void dwc2_gadget_enter_clock_gating(struct dwc2_hsotg *hsotg); +void dwc2_gadget_exit_clock_gating(struct dwc2_hsotg *hsotg, +				   int rem_wakeup);  int dwc2_hsotg_tx_fifo_count(struct dwc2_hsotg *hsotg);  int dwc2_hsotg_tx_fifo_total_depth(struct dwc2_hsotg *hsotg);  int dwc2_hsotg_tx_fifo_average_depth(struct dwc2_hsotg *hsotg);  void dwc2_gadget_init_lpm(struct dwc2_hsotg *hsotg);  void dwc2_gadget_program_ref_clk(struct dwc2_hsotg *hsotg); +static inline void dwc2_clear_fifo_map(struct dwc2_hsotg *hsotg) +{ hsotg->fifo_map = 0; }  #else  static inline int dwc2_hsotg_remove(struct dwc2_hsotg *dwc2)  { return 0; } @@ -1442,6 +1455,14 @@ static inline int dwc2_gadget_enter_hibernation(struct dwc2_hsotg *hsotg)  static inline int dwc2_gadget_exit_hibernation(struct dwc2_hsotg *hsotg,  					       int rem_wakeup, int reset)  { return 0; } +static inline int dwc2_gadget_enter_partial_power_down(struct dwc2_hsotg *hsotg) +{ return 0; } +static inline int dwc2_gadget_exit_partial_power_down(struct dwc2_hsotg *hsotg, +						      bool restore) +{ return 0; } +static inline void dwc2_gadget_enter_clock_gating(struct dwc2_hsotg *hsotg) {} +static inline void dwc2_gadget_exit_clock_gating(struct dwc2_hsotg *hsotg, +						 int rem_wakeup) {}  static inline int dwc2_hsotg_tx_fifo_count(struct dwc2_hsotg *hsotg)  { return 0; }  static inline int dwc2_hsotg_tx_fifo_total_depth(struct dwc2_hsotg *hsotg) @@ -1450,6 +1471,7 @@ static inline int dwc2_hsotg_tx_fifo_average_depth(struct dwc2_hsotg *hsotg)  { return 0; }  static inline void dwc2_gadget_init_lpm(struct dwc2_hsotg *hsotg) {}  static inline void dwc2_gadget_program_ref_clk(struct dwc2_hsotg *hsotg) {} +static inline void dwc2_clear_fifo_map(struct dwc2_hsotg *hsotg) {}  #endif  #if IS_ENABLED(CONFIG_USB_DWC2_HOST) || IS_ENABLED(CONFIG_USB_DWC2_DUAL_ROLE) @@ -1459,11 +1481,18 @@ void dwc2_hcd_connect(struct dwc2_hsotg *hsotg);  void dwc2_hcd_disconnect(struct dwc2_hsotg *hsotg, bool force);  void dwc2_hcd_start(struct dwc2_hsotg *hsotg);  int dwc2_core_init(struct dwc2_hsotg *hsotg, bool initial_setup); +int dwc2_port_suspend(struct dwc2_hsotg *hsotg, u16 windex); +int dwc2_port_resume(struct dwc2_hsotg *hsotg);  int dwc2_backup_host_registers(struct dwc2_hsotg *hsotg);  int dwc2_restore_host_registers(struct dwc2_hsotg *hsotg);  int dwc2_host_enter_hibernation(struct dwc2_hsotg *hsotg);  int dwc2_host_exit_hibernation(struct dwc2_hsotg *hsotg,  			       int rem_wakeup, int reset); +int dwc2_host_enter_partial_power_down(struct dwc2_hsotg *hsotg); +int dwc2_host_exit_partial_power_down(struct dwc2_hsotg *hsotg, +				      int rem_wakeup, bool restore); +void dwc2_host_enter_clock_gating(struct dwc2_hsotg *hsotg); +void dwc2_host_exit_clock_gating(struct dwc2_hsotg *hsotg, int rem_wakeup);  bool dwc2_host_can_poweroff_phy(struct dwc2_hsotg *dwc2);  static inline void dwc2_host_schedule_phy_reset(struct dwc2_hsotg *hsotg)  { schedule_work(&hsotg->phy_reset_work); } @@ -1479,6 +1508,10 @@ static inline void dwc2_hcd_start(struct dwc2_hsotg *hsotg) {}  static inline void dwc2_hcd_remove(struct dwc2_hsotg *hsotg) {}  static inline int dwc2_core_init(struct dwc2_hsotg *hsotg, bool initial_setup)  { return 0; } +static inline int dwc2_port_suspend(struct dwc2_hsotg *hsotg, u16 windex) +{ return 0; } +static inline int dwc2_port_resume(struct dwc2_hsotg *hsotg) +{ return 0; }  static inline int dwc2_hcd_init(struct dwc2_hsotg *hsotg)  { return 0; }  static inline int dwc2_backup_host_registers(struct dwc2_hsotg *hsotg) @@ -1490,6 +1523,14 @@ static inline int dwc2_host_enter_hibernation(struct dwc2_hsotg *hsotg)  static inline int dwc2_host_exit_hibernation(struct dwc2_hsotg *hsotg,  					     int rem_wakeup, int reset)  { return 0; } +static inline int dwc2_host_enter_partial_power_down(struct dwc2_hsotg *hsotg) +{ return 0; } +static inline int dwc2_host_exit_partial_power_down(struct dwc2_hsotg *hsotg, +						    int rem_wakeup, bool restore) +{ return 0; } +static inline void dwc2_host_enter_clock_gating(struct dwc2_hsotg *hsotg) {} +static inline void dwc2_host_exit_clock_gating(struct dwc2_hsotg *hsotg, +					       int rem_wakeup) {}  static inline bool dwc2_host_can_poweroff_phy(struct dwc2_hsotg *dwc2)  { return false; }  static inline void dwc2_host_schedule_phy_reset(struct dwc2_hsotg *hsotg) {} | 
