/* Detect the SMI flash by reading the ID. Initializes the flash_info structure with size, sector count etc.  */
static ulong flash_get_size(ulong base, int banknum)
/* Detect the SMI flash by reading the ID. Initializes the flash_info structure with size, sector count etc.  */
static ulong flash_get_size(ulong base, int banknum)
{
	flash_info_t *info = &flash_info[banknum];
	struct flash_dev *dev;
	unsigned int value;
	unsigned int density;
	int i;
	value = smi_read_id(info, banknum);
	density = (value >> 16) & 0xff;
	for (i = 0, dev = &flash_ids[0]; dev->density != 0x0;
	     i++, dev = &flash_ids[i]) {
		if (dev->density == density) {
			info->size = dev->size;
			info->sector_count = dev->sector_count;
			break;
		}
	}
	if (dev->density == 0x0)
		return 0;
	info->flash_id = value & 0xffff;
	info->start[0] = base;
	return info->size;
}