/* Calculates the size of an MC7 memory in bytes from the value of its configuration register.  */
static unsigned int mc7_calc_size(u32 cfg)
/* Calculates the size of an MC7 memory in bytes from the value of its configuration register.  */
static unsigned int mc7_calc_size(u32 cfg)
{
	unsigned int width = G_WIDTH(cfg);
	unsigned int banks = !!(cfg & F_BKS) + 1;
	unsigned int org = !!(cfg & F_ORG) + 1;
	unsigned int density = G_DEN(cfg);
	unsigned int MBs = ((256 << density) * banks) / (org << width);
	return MBs << 20;
}