3 * Stefan Roese, DENX Software Engineering, sr@denx.de.
5 * SPDX-License-Identifier: GPL-2.0+
9 #include <asm/arch/ixp425.h>
11 #if !defined(CONFIG_FLASH_CFI_DRIVER)
14 * include common flash code (for esd boards)
16 #include "../common/flash.c"
21 static ulong flash_get_size (vu_long * addr, flash_info_t * info);
23 static inline ulong ld(ulong x)
33 unsigned long flash_init(void)
38 /* Init: no FLASHes known */
39 for (i=0; i<CONFIG_SYS_MAX_FLASH_BANKS; i++)
40 flash_info[i].flash_id = FLASH_UNKNOWN;
42 size = flash_get_size((vu_long *)FLASH_BASE0_PRELIM, &flash_info[0]);
44 if (flash_info[0].flash_id == FLASH_UNKNOWN)
45 printf ("## Unknown FLASH on Bank 0 - Size = 0x%08lx = %ld MB\n",
48 /* Reconfigure CS0 to actual FLASH size */
49 *IXP425_EXP_CS0 = (*IXP425_EXP_CS0 & ~0x00003C00) | ((ld(size) - 9) << 10);
51 /* Monitor protection ON by default */
52 flash_protect(FLAG_PROTECT_SET,
53 CONFIG_SYS_MONITOR_BASE, CONFIG_SYS_MONITOR_BASE + monitor_flash_len - 1,
54 &flash_info[CONFIG_SYS_MAX_FLASH_BANKS - 1]);
56 /* Environment protection ON by default */
57 flash_protect(FLAG_PROTECT_SET,
59 CONFIG_ENV_ADDR + CONFIG_ENV_SECT_SIZE - 1,
60 &flash_info[CONFIG_SYS_MAX_FLASH_BANKS - 1]);
62 /* Redundant environment protection ON by default */
63 flash_protect(FLAG_PROTECT_SET,
64 CONFIG_ENV_ADDR_REDUND,
65 CONFIG_ENV_ADDR_REDUND + CONFIG_ENV_SECT_SIZE - 1,
66 &flash_info[CONFIG_SYS_MAX_FLASH_BANKS - 1]);
68 flash_info[0].size = size;
73 #endif /* CONFIG_FLASH_CFI_DRIVER */