* APB or I/O clock cycle and repeat the check
*/
while ((__raw_readl(mlb_base + REG_MLBC1) & MLBC1_CLKM)
- || timeout--)
+ && --timeout)
__raw_writel(~MLBC1_CLKM, mlb_base + REG_MLBC1);
if (0 == timeout)
timeout = 10000;
/* Poll for MLB lock (MLBC0.MLBLK = 1) */
while (!(__raw_readl(mlb_base + REG_MLBC0) & MLBC0_MLBLK)
- || timeout--)
+ && --timeout)
;
if (0 == timeout)
/*
* Enable the MLB channel
*/
-static void mlb_channel_enable(struct mlb_data *drvdata,
+static s32 mlb_channel_enable(struct mlb_data *drvdata,
int chan_dev_id, int on)
{
struct mlb_dev_info *pdevinfo = drvdata->devinfo;
u32 rx_ch = rx_chinfo->address;
u32 tx_cl = tx_chinfo->cl;
u32 rx_cl = rx_chinfo->cl;
+ s32 ret = 0;
/*
* setup the direction, enable, channel type,
mlb150_dev_dump_ctr_tbl(0, tx_chinfo->cl + 1);
#endif
/* Synchronize and unmute synchrouous channel */
- if (MLB_CTYPE_SYNC == ctype)
- mlb150_dev_unmute_syn_ch(rx_ch, rx_cl, tx_ch, tx_cl);
+ if (MLB_CTYPE_SYNC == ctype) {
+ ret = mlb150_dev_unmute_syn_ch(rx_ch, rx_cl,
+ tx_ch, tx_cl);
+ if (ret)
+ return ret;
+ }
mlb150_dev_enable_ctr_write(0x0, ADT_RDY1 | ADT_DNE1 |
ADT_ERR1 | ADT_PS1 |
if (pdevinfo->fps >= CLK_2048FS)
mlb150_disable_pll(drvdata);
}
+
+ return 0;
}
/*
pr_debug("mxc_mlb150: channel alreadly startup\n");
break;
}
- mlb_channel_enable(drvdata, minor, 1);
+ if (mlb_channel_enable(drvdata, minor, 1))
+ return -EFAULT;
break;
case MLB_CHAN_SHUTDOWN:
if (atomic_read(&pdevinfo->on) == 0) {