Revert "drivers/usbmisc/fusb303.c: Toggle enable bit off/on after detaching". This reverts unnecessary workaround for FUSB303 from commit ddcc6dd501
, as true source of bug we've seen is after all in a wrong way device was being powered in R&D.
This commit is contained in:
parent
1928db35bf
commit
e14d0b2575
@ -503,51 +503,6 @@ err_out:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Name: fusb303_toggle_control1_enable
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Switch enable flag off and then on.
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
static int fusb303_toggle_control1_enable(FAR struct fusb303_dev_s *priv)
|
|
||||||
{
|
|
||||||
int regval;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
regval = fusb303_getreg(priv, FUSB303_CONTROL1_REG);
|
|
||||||
if (regval < 0)
|
|
||||||
{
|
|
||||||
fusb303_err("ERROR: Failed to read CONTROL1 register\n");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(regval & CONTROL1_ENABLE))
|
|
||||||
{
|
|
||||||
/* Not enabled, skip toggling. */
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = fusb303_putreg(priv, FUSB303_CONTROL1_REG,
|
|
||||||
regval & ~CONTROL1_ENABLE);
|
|
||||||
if (ret < 0)
|
|
||||||
{
|
|
||||||
fusb303_err("ERROR: Failed to write CONTROL1 register\n");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = fusb303_putreg(priv, FUSB303_CONTROL1_REG, regval);
|
|
||||||
if (ret < 0)
|
|
||||||
{
|
|
||||||
fusb303_err("ERROR: Failed to write CONTROL1 register\n");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: fusb303_set_mode
|
* Name: fusb303_set_mode
|
||||||
*
|
*
|
||||||
@ -776,6 +731,10 @@ static ssize_t fusb303_read(FAR struct file *filep, FAR char *buffer,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
flags = enter_critical_section();
|
||||||
|
priv->int_pending = false;
|
||||||
|
leave_critical_section(flags);
|
||||||
|
|
||||||
ptr->status = fusb303_getreg(priv, FUSB303_STATUS_REG);
|
ptr->status = fusb303_getreg(priv, FUSB303_STATUS_REG);
|
||||||
ptr->status1 = fusb303_getreg(priv, FUSB303_STATUS1_REG);
|
ptr->status1 = fusb303_getreg(priv, FUSB303_STATUS1_REG);
|
||||||
ptr->dev_type = fusb303_getreg(priv, FUSB303_TYPE_REG);
|
ptr->dev_type = fusb303_getreg(priv, FUSB303_TYPE_REG);
|
||||||
@ -784,22 +743,6 @@ static ssize_t fusb303_read(FAR struct file *filep, FAR char *buffer,
|
|||||||
fusb303_dumpregs("fusb303_read", priv);
|
fusb303_dumpregs("fusb303_read", priv);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!(ptr->status & STATUS_ATTACH) ||
|
|
||||||
(ptr->status & STATUS_BC_LVL_3000) == STATUS_BC_LVL_UNATT)
|
|
||||||
{
|
|
||||||
/* Toggle enable bit when USB is not attached. This is needed to
|
|
||||||
* enable attach interrupt when orientation of USB-C cable changes.
|
|
||||||
*/
|
|
||||||
|
|
||||||
(void)fusb303_toggle_control1_enable(priv);
|
|
||||||
|
|
||||||
up_mdelay(1); /* Wait for initial interrupt. */
|
|
||||||
}
|
|
||||||
|
|
||||||
flags = enter_critical_section();
|
|
||||||
priv->int_pending = false;
|
|
||||||
leave_critical_section(flags);
|
|
||||||
|
|
||||||
(void)fusb303_clear_interrupts(priv);
|
(void)fusb303_clear_interrupts(priv);
|
||||||
|
|
||||||
nxsem_post(&priv->devsem);
|
nxsem_post(&priv->devsem);
|
||||||
|
Loading…
Reference in New Issue
Block a user