/* Reads from CLASS internal bus peripherals (ccu, pe-lem) from the host through indirect access registers.  */
static u32 class_bus_read(u32 addr, u8 size)
/* Reads from CLASS internal bus peripherals (ccu, pe-lem) from the host through indirect access registers.  */
static u32 class_bus_read(u32 addr, u8 size)
{
	u32 offset = addr & 0x3;
	u32 mask = 0xffffffff >> ((4 - size) << 3);
	u32 val;
	writel((addr & CLASS_BUS_ACCESS_BASE_MASK), CLASS_BUS_ACCESS_BASE);
	addr = (addr & ~CLASS_BUS_ACCESS_BASE_MASK) | (size << 24);
	writel(addr, CLASS_BUS_ACCESS_ADDR);
	val = be32_to_cpu(readl(CLASS_BUS_ACCESS_RDATA));
	return (val >> (offset << 3)) & mask;
}