@@ -373,6 +373,8 @@ enum dwc2_ep0_state {
* case.
* 0 - No (default)
* 1 - Yes
+ * @power_saving: Specifies if power saving is enabled or not. If it is
+ * enabled power_down functionality will be enabled.
* @power_down: Specifies whether the controller support power_down.
* If power_down is enabled, the controller will enter
* power_down in both peripheral and host mode when
@@ -452,6 +454,7 @@ struct dwc2_core_params {
bool uframe_sched;
bool external_id_pin_ctl;
+ unsigned int power_saving:1;
int power_down;
#define DWC2_POWER_DOWN_PARAM_NONE 0
#define DWC2_POWER_DOWN_PARAM_PARTIAL 1
@@ -695,6 +695,7 @@ static int params_show(struct seq_file *seq, void *v)
print_param_hex(seq, p, ahbcfg);
print_param(seq, p, uframe_sched);
print_param(seq, p, external_id_pin_ctl);
+ print_param(seq, p, power_saving);
print_param(seq, p, power_down);
print_param(seq, p, lpm);
print_param(seq, p, lpm_clock_gating);
@@ -745,6 +746,7 @@ static int hw_params_show(struct seq_file *seq, void *v)
print_param(seq, hw, num_dev_perio_in_ep);
print_param(seq, hw, total_fifo_size);
print_param(seq, hw, power_optimized);
+ print_param(seq, hw, hibernation);
print_param(seq, hw, utmi_phy_data_width);
print_param_hex(seq, hw, snpsid);
print_param_hex(seq, hw, dev_ep_dirs);
@@ -253,12 +253,18 @@ static void dwc2_set_param_power_down(struct dwc2_hsotg *hsotg)
{
int val;
- if (hsotg->hw_params.hibernation)
- val = 2;
- else if (hsotg->hw_params.power_optimized)
- val = 1;
- else
- val = 0;
+ if (!hsotg->params.power_saving) {
+ val = DWC2_POWER_DOWN_PARAM_NONE;
+ dev_dbg(hsotg->dev, "%s: Power saving is disabled.\n",
+ __func__);
+ } else {
+ if (hsotg->hw_params.hibernation)
+ val = DWC2_POWER_DOWN_PARAM_HIBERNATION;
+ else if (hsotg->hw_params.power_optimized)
+ val = DWC2_POWER_DOWN_PARAM_PARTIAL;
+ else
+ val = DWC2_POWER_DOWN_PARAM_NONE;
+ }
hsotg->params.power_down = val;
}
@@ -280,6 +286,7 @@ static void dwc2_set_default_params(struct dwc2_hsotg *hsotg)
dwc2_set_param_phy_type(hsotg);
dwc2_set_param_speed(hsotg);
dwc2_set_param_phy_utmi_width(hsotg);
+ p->power_saving = true;
dwc2_set_param_power_down(hsotg);
p->phy_ulpi_ddr = false;
p->phy_ulpi_ext_vbus = false;