Loops checking for certain condition were rather inconsistent.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@nokia.com>
Reported-by: Juha Leppanen <juha_motorsportcom@luukku.com>
/* PLL_PWR_STATUS */
while (FLD_GET(dsi_read_reg(DSI_CLK_CTRL), 29, 28) != state) {
/* PLL_PWR_STATUS */
while (FLD_GET(dsi_read_reg(DSI_CLK_CTRL), 29, 28) != state) {
- udelay(1);
- if (t++ > 1000) {
DSSERR("Failed to set DSI PLL power mode to %d\n",
state);
return -ENODEV;
}
DSSERR("Failed to set DSI PLL power mode to %d\n",
state);
return -ENODEV;
}
/* PWR_STATUS */
while (FLD_GET(dsi_read_reg(DSI_COMPLEXIO_CFG1), 26, 25) != state) {
/* PWR_STATUS */
while (FLD_GET(dsi_read_reg(DSI_COMPLEXIO_CFG1), 26, 25) != state) {
- udelay(1);
- if (t++ > 1000) {
DSSERR("failed to set complexio power state to "
"%d\n", state);
return -ENODEV;
}
DSSERR("failed to set complexio power state to "
"%d\n", state);
return -ENODEV;
}
static int _dsi_wait_reset(void)
{
static int _dsi_wait_reset(void)
{
while (REG_GET(DSI_SYSSTATUS, 0, 0) == 0) {
while (REG_GET(DSI_SYSSTATUS, 0, 0) == 0) {
DSSERR("soft reset failed\n");
return -ENODEV;
}
DSSERR("soft reset failed\n");
return -ENODEV;
}
/* using fifo not empty */
/* TX_FIFO_NOT_EMPTY */
while (FLD_GET(dsi_read_reg(DSI_VC_CTRL(0)), 5, 5)) {
/* using fifo not empty */
/* TX_FIFO_NOT_EMPTY */
while (FLD_GET(dsi_read_reg(DSI_VC_CTRL(0)), 5, 5)) {
fifo_stalls++;
if (fifo_stalls > 0xfffff) {
DSSERR("fifo stalls overflow, pixels left %d\n",
fifo_stalls++;
if (fifo_stalls > 0xfffff) {
DSSERR("fifo stalls overflow, pixels left %d\n",
dsi_if_enable(0);
return -EIO;
}
dsi_if_enable(0);
return -EIO;
}
}
#elif 1
/* using fifo emptiness */
}
#elif 1
/* using fifo emptiness */
static int _omap_dss_wait_reset(void)
{
static int _omap_dss_wait_reset(void)
{
- unsigned timeout = 1000;
while (REG_GET(DSS_SYSSTATUS, 0, 0) == 0) {
while (REG_GET(DSS_SYSSTATUS, 0, 0) == 0) {
- udelay(1);
- if (!--timeout) {
DSSERR("soft reset failed\n");
return -ENODEV;
}
DSSERR("soft reset failed\n");
return -ENODEV;
}