3 * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
4 * Marius Groeger <mgroeger@sysgo.de>
7 * David Mueller, ELSOFT AG, <d.mueller@elsoft.ch>
10 * Texas Instruments, <www.ti.com>
11 * Kshitij Gupta <Kshitij@ti.com>
15 * Philippe Robin, <philippe.robin@arm.com>
17 * SPDX-License-Identifier: GPL-2.0+
24 #include "integrator-sc.h"
26 DECLARE_GLOBAL_DATA_PTR;
28 void peripheral_power_enable (void);
30 #if defined(CONFIG_SHOW_BOOT_PROGRESS)
31 void show_boot_progress(int progress)
33 printf("Boot reached stage %d\n", progress);
37 #define COMP_MODE_ENABLE ((unsigned int)0x0000EAEF)
40 * Miscellaneous platform dependent initialisations
47 /* arch number of Integrator Board */
48 #ifdef CONFIG_ARCH_CINTEGRATOR
49 gd->bd->bi_arch_number = MACH_TYPE_CINTEGRATOR;
51 gd->bd->bi_arch_number = MACH_TYPE_INTEGRATOR;
54 /* adress of boot parameters */
55 gd->bd->bi_boot_params = 0x00000100;
59 #ifdef CONFIG_CM_REMAP
60 extern void cm_remap(void);
61 cm_remap(); /* remaps writeable memory to 0x00000000 */
64 #ifdef CONFIG_ARCH_CINTEGRATOR
66 * Flash protection on the Integrator/CP is in a simple register
68 val = readl(CP_FLASHPROG);
69 val |= (CP_FLASHPROG_FLVPPEN | CP_FLASHPROG_FLWREN);
70 writel(val, CP_FLASHPROG);
73 * The Integrator/AP has some special protection mechanisms
74 * for the external memories, first the External Bus Interface (EBI)
75 * then the system controller (SC).
77 * The system comes up with the flash memory non-writable and
78 * configuration locked. If we want U-Boot to be used for flash
79 * access we cannot have the flash memory locked.
81 writel(EBI_UNLOCK_MAGIC, EBI_BASE + EBI_LOCK_REG);
82 val = readl(EBI_BASE + EBI_CSR1_REG);
83 val &= EBI_CSR_WREN_MASK;
84 val |= EBI_CSR_WREN_ENABLE;
85 writel(val, EBI_BASE + EBI_CSR1_REG);
86 writel(0, EBI_BASE + EBI_LOCK_REG);
89 * Set up the system controller to remove write protection from
90 * the flash memory and enable Vpp
92 writel(SC_CTRL_FLASHVPP | SC_CTRL_FLASHWP, SC_CTRLS);
100 int misc_init_r (void)
102 setenv("verify", "n");
107 * The Integrator remaps the Flash memory to 0x00000000 and executes U-Boot
108 * from there, which means we cannot test the RAM underneath the ROM at this
109 * point. It will be unmapped later on, when we are executing from the
110 * relocated in RAM U-Boot. We simply assume that this RAM is usable if the
111 * RAM on higher addresses works fine.
113 #define REMAPPED_FLASH_SZ 0x40000
117 gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
118 #ifdef CONFIG_CM_SPD_DETECT
120 extern void dram_query(void);
124 dram_query(); /* Assembler accesses to CM registers */
125 /* Queries the SPD values */
127 /* Obtain the SDRAM size from the CM SDRAM register */
129 cm_reg_sdram = readl(CM_BASE + OS_SDRAM);
130 /* Register SDRAM size
132 * 0xXXXXXXbbb000bb 16 MB
133 * 0xXXXXXXbbb001bb 32 MB
134 * 0xXXXXXXbbb010bb 64 MB
135 * 0xXXXXXXbbb011bb 128 MB
136 * 0xXXXXXXbbb100bb 256 MB
139 sdram_shift = ((cm_reg_sdram & 0x0000001C)/4)%4;
140 gd->ram_size = get_ram_size((long *) CONFIG_SYS_SDRAM_BASE +
142 0x01000000 << sdram_shift);
145 gd->ram_size = get_ram_size((long *) CONFIG_SYS_SDRAM_BASE +
148 #endif /* CM_SPD_DETECT */
149 /* We only have one bank of RAM, set it to whatever was detected */
150 gd->bd->bi_dram[0].size = gd->ram_size;
155 #ifdef CONFIG_CMD_NET
156 int board_eth_init(bd_t *bis)
159 #ifdef CONFIG_SMC91111
160 rc = smc91111_initialize(0, CONFIG_SMC91111_BASE);
162 rc += pci_eth_init(bis);