/* This function walks LBC banks comparing "Base address" field of the BR registers with the supplied addr_base argument. When bases match this function returns bank number (starting with 0), otherwise it returns appropriate errno value.  */
int fsl_lbc_find(phys_addr_t addr_base)
/* This function walks LBC banks comparing "Base address" field of the BR registers with the supplied addr_base argument. When bases match this function returns bank number (starting with 0), otherwise it returns appropriate errno value.  */
int fsl_lbc_find(phys_addr_t addr_base)
{
	int i;
	if (!fsl_lbc_regs)
		return -ENODEV;
	for (i = 0; i < ARRAY_SIZE(fsl_lbc_regs->bank); i++) {
		__be32 br = in_be32(&fsl_lbc_regs->bank[i].br);
		__be32 or = in_be32(&fsl_lbc_regs->bank[i].or);
		if (br & BR_V && (br & or & BR_BA) == addr_base)
			return i;
	}
	return -ENOENT;
}