/* This routine will get the status register of the flash chip present at the given bank  */
static unsigned int smi_read_sr(int bank)
/* This routine will get the status register of the flash chip present at the given bank  */
static unsigned int smi_read_sr(int bank)
{
	u32 ctrlreg1;
	ctrlreg1 = readl(&smicntl->smi_cr1);
	writel(readl(&smicntl->smi_cr1) & ~(SW_MODE | WB_MODE),
	       &smicntl->smi_cr1);
	writel((bank << BANKSEL_SHIFT) | RD_STATUS_REG, &smicntl->smi_cr2);
	smi_wait_xfer_finish(XFER_FINISH_TOUT);
	writel(ctrlreg1, &smicntl->smi_cr1);
	return readl(&smicntl->smi_sr);
}