/* Configure chipselect base address and size (bytes). Size must be a power of two between 8k and 256M.  */
int bcm63xx_set_cs_base(unsigned int cs, u32 base, unsigned int size)
/* Configure chipselect base address and size (bytes). Size must be a power of two between 8k and 256M.  */
int bcm63xx_set_cs_base(unsigned int cs, u32 base, unsigned int size)
{
	unsigned long flags;
	u32 val;
	if (!is_valid_cs(cs))
		return -EINVAL;
	if (size != roundup_pow_of_two(size))
		return -EINVAL;
	if (size < 8 * 1024 || size > 256 * 1024 * 1024)
		return -EINVAL;
	val = (base & MPI_CSBASE_BASE_MASK);
	val |= (ilog2(size) - ilog2(8 * 1024)) << MPI_CSBASE_SIZE_SHIFT;
	spin_lock_irqsave(&bcm63xx_cs_lock, flags);
	bcm_mpi_writel(val, MPI_CSBASE_REG(cs));
	spin_unlock_irqrestore(&bcm63xx_cs_lock, flags);
	return 0;
}