3
* Stefan Roese, esd gmbh germany, stefan.roese@esd-electronics.com
5
* SPDX-License-Identifier: GPL-2.0+
9
#include <asm/ppc4xx.h>
10
#include <asm/processor.h>
13
* include common flash code (for esd boards)
15
#include "../common/flash.c"
17
/*-----------------------------------------------------------------------
20
static ulong flash_get_size (vu_long * addr, flash_info_t * info);
21
static void flash_get_offsets (ulong base, flash_info_t * info);
23
/*-----------------------------------------------------------------------
26
unsigned long flash_init (void)
28
unsigned long size_b0;
31
unsigned long base_b0;
34
/* Init: no FLASHes known */
35
for (i=0; i<CONFIG_SYS_MAX_FLASH_BANKS; ++i) {
36
flash_info[i].flash_id = FLASH_UNKNOWN;
39
/* Static FLASH Bank configuration here - FIXME XXX */
41
size_b0 = flash_get_size((vu_long *)FLASH_BASE0_PRELIM, &flash_info[0]);
43
if (flash_info[0].flash_id == FLASH_UNKNOWN) {
44
printf ("## Unknown FLASH on Bank 0 - Size = 0x%08lx = %ld MB\n",
45
size_b0, size_b0<<20);
49
flash_get_offsets (-size_b0, &flash_info[0]);
51
/* Re-do sizing to get full correct info */
52
mtdcr(EBC0_CFGADDR, PB0CR);
53
pbcr = mfdcr(EBC0_CFGDATA);
54
mtdcr(EBC0_CFGADDR, PB0CR);
73
pbcr = (pbcr & 0x0001ffff) | base_b0 | (size_val << 17);
74
mtdcr(EBC0_CFGDATA, pbcr);
76
/* Monitor protection ON by default */
77
(void)flash_protect(FLAG_PROTECT_SET,
82
flash_info[0].size = size_b0;