Ejemplo n.º 1
0
ulong flash_init(void)
{
	int i;
	ulong size = 0;
	ulong fbase = 0;

#if defined(CONFIG_SERIAL_FLASH) && defined(CONFIG_CF_DSPI)
	dspi_init();
#endif

	for (i = 0; i < CFG_MAX_FLASH_BANKS; i++) {
		memset(&flash_info[i], 0, sizeof(flash_info_t));

		switch (i) {
		case 0:
			fbase = (ulong) CFG_FLASH0_BASE;
			break;
		case 1:
			fbase = (ulong) CFG_FLASH1_BASE;
			break;
#if defined(CONFIG_SERIAL_FLASH) && defined(CONFIG_CF_DSPI)
		case 2:
			fbase = (ulong) CFG_FLASH2_BASE;
			break;
#endif
		}

		flash_get_size((FPWV *) fbase, &flash_info[i]);
		flash_get_offsets((ulong) fbase, &flash_info[i]);
		fbase += flash_info[i].size;
		size += flash_info[i].size;

		/* get the h/w and s/w protection status in sync */
		flash_sync_real_protect(&flash_info[i]);
	}

	/* Protect monitor and environment sectors */
	flash_protect(FLAG_PROTECT_SET,
		      CFG_MONITOR_BASE,
		      CFG_MONITOR_BASE + monitor_flash_len - 1, &flash_info[0]);

	return size;
}
Ejemplo n.º 2
0
void spi_init(void)
{
	dspi_init();
}