1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun * board.c
3*4882a593Smuzhiyun *
4*4882a593Smuzhiyun * Common board functions for AM33XX based boards
5*4882a593Smuzhiyun *
6*4882a593Smuzhiyun * Copyright (C) 2011, Texas Instruments, Incorporated - http://www.ti.com/
7*4882a593Smuzhiyun *
8*4882a593Smuzhiyun * SPDX-License-Identifier: GPL-2.0+
9*4882a593Smuzhiyun */
10*4882a593Smuzhiyun
11*4882a593Smuzhiyun #include <common.h>
12*4882a593Smuzhiyun #include <dm.h>
13*4882a593Smuzhiyun #include <debug_uart.h>
14*4882a593Smuzhiyun #include <errno.h>
15*4882a593Smuzhiyun #include <ns16550.h>
16*4882a593Smuzhiyun #include <spl.h>
17*4882a593Smuzhiyun #include <asm/arch/cpu.h>
18*4882a593Smuzhiyun #include <asm/arch/hardware.h>
19*4882a593Smuzhiyun #include <asm/arch/omap.h>
20*4882a593Smuzhiyun #include <asm/arch/ddr_defs.h>
21*4882a593Smuzhiyun #include <asm/arch/clock.h>
22*4882a593Smuzhiyun #include <asm/arch/gpio.h>
23*4882a593Smuzhiyun #include <asm/arch/mem.h>
24*4882a593Smuzhiyun #include <asm/arch/mmc_host_def.h>
25*4882a593Smuzhiyun #include <asm/arch/sys_proto.h>
26*4882a593Smuzhiyun #include <asm/io.h>
27*4882a593Smuzhiyun #include <asm/emif.h>
28*4882a593Smuzhiyun #include <asm/gpio.h>
29*4882a593Smuzhiyun #include <asm/omap_common.h>
30*4882a593Smuzhiyun #include <i2c.h>
31*4882a593Smuzhiyun #include <miiphy.h>
32*4882a593Smuzhiyun #include <cpsw.h>
33*4882a593Smuzhiyun #include <linux/errno.h>
34*4882a593Smuzhiyun #include <linux/compiler.h>
35*4882a593Smuzhiyun #include <linux/usb/ch9.h>
36*4882a593Smuzhiyun #include <linux/usb/gadget.h>
37*4882a593Smuzhiyun #include <linux/usb/musb.h>
38*4882a593Smuzhiyun #include <asm/omap_musb.h>
39*4882a593Smuzhiyun #include <asm/davinci_rtc.h>
40*4882a593Smuzhiyun
41*4882a593Smuzhiyun DECLARE_GLOBAL_DATA_PTR;
42*4882a593Smuzhiyun
dram_init(void)43*4882a593Smuzhiyun int dram_init(void)
44*4882a593Smuzhiyun {
45*4882a593Smuzhiyun #ifndef CONFIG_SKIP_LOWLEVEL_INIT
46*4882a593Smuzhiyun sdram_init();
47*4882a593Smuzhiyun #endif
48*4882a593Smuzhiyun
49*4882a593Smuzhiyun /* dram_init must store complete ramsize in gd->ram_size */
50*4882a593Smuzhiyun gd->ram_size = get_ram_size(
51*4882a593Smuzhiyun (void *)CONFIG_SYS_SDRAM_BASE,
52*4882a593Smuzhiyun CONFIG_MAX_RAM_BANK_SIZE);
53*4882a593Smuzhiyun return 0;
54*4882a593Smuzhiyun }
55*4882a593Smuzhiyun
dram_init_banksize(void)56*4882a593Smuzhiyun int dram_init_banksize(void)
57*4882a593Smuzhiyun {
58*4882a593Smuzhiyun gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
59*4882a593Smuzhiyun gd->bd->bi_dram[0].size = gd->ram_size;
60*4882a593Smuzhiyun
61*4882a593Smuzhiyun return 0;
62*4882a593Smuzhiyun }
63*4882a593Smuzhiyun
64*4882a593Smuzhiyun #if !CONFIG_IS_ENABLED(OF_CONTROL)
65*4882a593Smuzhiyun static const struct ns16550_platdata am33xx_serial[] = {
66*4882a593Smuzhiyun { .base = CONFIG_SYS_NS16550_COM1, .reg_shift = 2,
67*4882a593Smuzhiyun .clock = CONFIG_SYS_NS16550_CLK, .fcr = UART_FCR_DEFVAL, },
68*4882a593Smuzhiyun # ifdef CONFIG_SYS_NS16550_COM2
69*4882a593Smuzhiyun { .base = CONFIG_SYS_NS16550_COM2, .reg_shift = 2,
70*4882a593Smuzhiyun .clock = CONFIG_SYS_NS16550_CLK, .fcr = UART_FCR_DEFVAL, },
71*4882a593Smuzhiyun # ifdef CONFIG_SYS_NS16550_COM3
72*4882a593Smuzhiyun { .base = CONFIG_SYS_NS16550_COM3, .reg_shift = 2,
73*4882a593Smuzhiyun .clock = CONFIG_SYS_NS16550_CLK, .fcr = UART_FCR_DEFVAL, },
74*4882a593Smuzhiyun { .base = CONFIG_SYS_NS16550_COM4, .reg_shift = 2,
75*4882a593Smuzhiyun .clock = CONFIG_SYS_NS16550_CLK, .fcr = UART_FCR_DEFVAL, },
76*4882a593Smuzhiyun { .base = CONFIG_SYS_NS16550_COM5, .reg_shift = 2,
77*4882a593Smuzhiyun .clock = CONFIG_SYS_NS16550_CLK, .fcr = UART_FCR_DEFVAL, },
78*4882a593Smuzhiyun { .base = CONFIG_SYS_NS16550_COM6, .reg_shift = 2,
79*4882a593Smuzhiyun .clock = CONFIG_SYS_NS16550_CLK, .fcr = UART_FCR_DEFVAL, },
80*4882a593Smuzhiyun # endif
81*4882a593Smuzhiyun # endif
82*4882a593Smuzhiyun };
83*4882a593Smuzhiyun
84*4882a593Smuzhiyun U_BOOT_DEVICES(am33xx_uarts) = {
85*4882a593Smuzhiyun { "ns16550_serial", &am33xx_serial[0] },
86*4882a593Smuzhiyun # ifdef CONFIG_SYS_NS16550_COM2
87*4882a593Smuzhiyun { "ns16550_serial", &am33xx_serial[1] },
88*4882a593Smuzhiyun # ifdef CONFIG_SYS_NS16550_COM3
89*4882a593Smuzhiyun { "ns16550_serial", &am33xx_serial[2] },
90*4882a593Smuzhiyun { "ns16550_serial", &am33xx_serial[3] },
91*4882a593Smuzhiyun { "ns16550_serial", &am33xx_serial[4] },
92*4882a593Smuzhiyun { "ns16550_serial", &am33xx_serial[5] },
93*4882a593Smuzhiyun # endif
94*4882a593Smuzhiyun # endif
95*4882a593Smuzhiyun };
96*4882a593Smuzhiyun
97*4882a593Smuzhiyun #ifdef CONFIG_DM_GPIO
98*4882a593Smuzhiyun static const struct omap_gpio_platdata am33xx_gpio[] = {
99*4882a593Smuzhiyun { 0, AM33XX_GPIO0_BASE },
100*4882a593Smuzhiyun { 1, AM33XX_GPIO1_BASE },
101*4882a593Smuzhiyun { 2, AM33XX_GPIO2_BASE },
102*4882a593Smuzhiyun { 3, AM33XX_GPIO3_BASE },
103*4882a593Smuzhiyun #ifdef CONFIG_AM43XX
104*4882a593Smuzhiyun { 4, AM33XX_GPIO4_BASE },
105*4882a593Smuzhiyun { 5, AM33XX_GPIO5_BASE },
106*4882a593Smuzhiyun #endif
107*4882a593Smuzhiyun };
108*4882a593Smuzhiyun
109*4882a593Smuzhiyun U_BOOT_DEVICES(am33xx_gpios) = {
110*4882a593Smuzhiyun { "gpio_omap", &am33xx_gpio[0] },
111*4882a593Smuzhiyun { "gpio_omap", &am33xx_gpio[1] },
112*4882a593Smuzhiyun { "gpio_omap", &am33xx_gpio[2] },
113*4882a593Smuzhiyun { "gpio_omap", &am33xx_gpio[3] },
114*4882a593Smuzhiyun #ifdef CONFIG_AM43XX
115*4882a593Smuzhiyun { "gpio_omap", &am33xx_gpio[4] },
116*4882a593Smuzhiyun { "gpio_omap", &am33xx_gpio[5] },
117*4882a593Smuzhiyun #endif
118*4882a593Smuzhiyun };
119*4882a593Smuzhiyun #endif
120*4882a593Smuzhiyun #endif
121*4882a593Smuzhiyun
122*4882a593Smuzhiyun #ifndef CONFIG_DM_GPIO
123*4882a593Smuzhiyun static const struct gpio_bank gpio_bank_am33xx[] = {
124*4882a593Smuzhiyun { (void *)AM33XX_GPIO0_BASE },
125*4882a593Smuzhiyun { (void *)AM33XX_GPIO1_BASE },
126*4882a593Smuzhiyun { (void *)AM33XX_GPIO2_BASE },
127*4882a593Smuzhiyun { (void *)AM33XX_GPIO3_BASE },
128*4882a593Smuzhiyun #ifdef CONFIG_AM43XX
129*4882a593Smuzhiyun { (void *)AM33XX_GPIO4_BASE },
130*4882a593Smuzhiyun { (void *)AM33XX_GPIO5_BASE },
131*4882a593Smuzhiyun #endif
132*4882a593Smuzhiyun };
133*4882a593Smuzhiyun
134*4882a593Smuzhiyun const struct gpio_bank *const omap_gpio_bank = gpio_bank_am33xx;
135*4882a593Smuzhiyun #endif
136*4882a593Smuzhiyun
137*4882a593Smuzhiyun #if defined(CONFIG_MMC_OMAP_HS)
cpu_mmc_init(bd_t * bis)138*4882a593Smuzhiyun int cpu_mmc_init(bd_t *bis)
139*4882a593Smuzhiyun {
140*4882a593Smuzhiyun int ret;
141*4882a593Smuzhiyun
142*4882a593Smuzhiyun ret = omap_mmc_init(0, 0, 0, -1, -1);
143*4882a593Smuzhiyun if (ret)
144*4882a593Smuzhiyun return ret;
145*4882a593Smuzhiyun
146*4882a593Smuzhiyun return omap_mmc_init(1, 0, 0, -1, -1);
147*4882a593Smuzhiyun }
148*4882a593Smuzhiyun #endif
149*4882a593Smuzhiyun
150*4882a593Smuzhiyun /* AM33XX has two MUSB controllers which can be host or gadget */
151*4882a593Smuzhiyun #if (defined(CONFIG_USB_MUSB_GADGET) || defined(CONFIG_USB_MUSB_HOST)) && \
152*4882a593Smuzhiyun (defined(CONFIG_AM335X_USB0) || defined(CONFIG_AM335X_USB1)) && \
153*4882a593Smuzhiyun (!defined(CONFIG_DM_USB))
154*4882a593Smuzhiyun static struct ctrl_dev *cdev = (struct ctrl_dev *)CTRL_DEVICE_BASE;
155*4882a593Smuzhiyun
156*4882a593Smuzhiyun /* USB 2.0 PHY Control */
157*4882a593Smuzhiyun #define CM_PHY_PWRDN (1 << 0)
158*4882a593Smuzhiyun #define CM_PHY_OTG_PWRDN (1 << 1)
159*4882a593Smuzhiyun #define OTGVDET_EN (1 << 19)
160*4882a593Smuzhiyun #define OTGSESSENDEN (1 << 20)
161*4882a593Smuzhiyun
am33xx_usb_set_phy_power(u8 on,u32 * reg_addr)162*4882a593Smuzhiyun static void am33xx_usb_set_phy_power(u8 on, u32 *reg_addr)
163*4882a593Smuzhiyun {
164*4882a593Smuzhiyun if (on) {
165*4882a593Smuzhiyun clrsetbits_le32(reg_addr, CM_PHY_PWRDN | CM_PHY_OTG_PWRDN,
166*4882a593Smuzhiyun OTGVDET_EN | OTGSESSENDEN);
167*4882a593Smuzhiyun } else {
168*4882a593Smuzhiyun clrsetbits_le32(reg_addr, 0, CM_PHY_PWRDN | CM_PHY_OTG_PWRDN);
169*4882a593Smuzhiyun }
170*4882a593Smuzhiyun }
171*4882a593Smuzhiyun
172*4882a593Smuzhiyun static struct musb_hdrc_config musb_config = {
173*4882a593Smuzhiyun .multipoint = 1,
174*4882a593Smuzhiyun .dyn_fifo = 1,
175*4882a593Smuzhiyun .num_eps = 16,
176*4882a593Smuzhiyun .ram_bits = 12,
177*4882a593Smuzhiyun };
178*4882a593Smuzhiyun
179*4882a593Smuzhiyun #ifdef CONFIG_AM335X_USB0
am33xx_otg0_set_phy_power(struct udevice * dev,u8 on)180*4882a593Smuzhiyun static void am33xx_otg0_set_phy_power(struct udevice *dev, u8 on)
181*4882a593Smuzhiyun {
182*4882a593Smuzhiyun am33xx_usb_set_phy_power(on, &cdev->usb_ctrl0);
183*4882a593Smuzhiyun }
184*4882a593Smuzhiyun
185*4882a593Smuzhiyun struct omap_musb_board_data otg0_board_data = {
186*4882a593Smuzhiyun .set_phy_power = am33xx_otg0_set_phy_power,
187*4882a593Smuzhiyun };
188*4882a593Smuzhiyun
189*4882a593Smuzhiyun static struct musb_hdrc_platform_data otg0_plat = {
190*4882a593Smuzhiyun .mode = CONFIG_AM335X_USB0_MODE,
191*4882a593Smuzhiyun .config = &musb_config,
192*4882a593Smuzhiyun .power = 50,
193*4882a593Smuzhiyun .platform_ops = &musb_dsps_ops,
194*4882a593Smuzhiyun .board_data = &otg0_board_data,
195*4882a593Smuzhiyun };
196*4882a593Smuzhiyun #endif
197*4882a593Smuzhiyun
198*4882a593Smuzhiyun #ifdef CONFIG_AM335X_USB1
am33xx_otg1_set_phy_power(struct udevice * dev,u8 on)199*4882a593Smuzhiyun static void am33xx_otg1_set_phy_power(struct udevice *dev, u8 on)
200*4882a593Smuzhiyun {
201*4882a593Smuzhiyun am33xx_usb_set_phy_power(on, &cdev->usb_ctrl1);
202*4882a593Smuzhiyun }
203*4882a593Smuzhiyun
204*4882a593Smuzhiyun struct omap_musb_board_data otg1_board_data = {
205*4882a593Smuzhiyun .set_phy_power = am33xx_otg1_set_phy_power,
206*4882a593Smuzhiyun };
207*4882a593Smuzhiyun
208*4882a593Smuzhiyun static struct musb_hdrc_platform_data otg1_plat = {
209*4882a593Smuzhiyun .mode = CONFIG_AM335X_USB1_MODE,
210*4882a593Smuzhiyun .config = &musb_config,
211*4882a593Smuzhiyun .power = 50,
212*4882a593Smuzhiyun .platform_ops = &musb_dsps_ops,
213*4882a593Smuzhiyun .board_data = &otg1_board_data,
214*4882a593Smuzhiyun };
215*4882a593Smuzhiyun #endif
216*4882a593Smuzhiyun
arch_misc_init(void)217*4882a593Smuzhiyun int arch_misc_init(void)
218*4882a593Smuzhiyun {
219*4882a593Smuzhiyun #ifdef CONFIG_AM335X_USB0
220*4882a593Smuzhiyun musb_register(&otg0_plat, &otg0_board_data,
221*4882a593Smuzhiyun (void *)USB0_OTG_BASE);
222*4882a593Smuzhiyun #endif
223*4882a593Smuzhiyun #ifdef CONFIG_AM335X_USB1
224*4882a593Smuzhiyun musb_register(&otg1_plat, &otg1_board_data,
225*4882a593Smuzhiyun (void *)USB1_OTG_BASE);
226*4882a593Smuzhiyun #endif
227*4882a593Smuzhiyun return 0;
228*4882a593Smuzhiyun }
229*4882a593Smuzhiyun
230*4882a593Smuzhiyun #else /* CONFIG_USB_MUSB_* && CONFIG_AM335X_USB* && !CONFIG_DM_USB */
231*4882a593Smuzhiyun
arch_misc_init(void)232*4882a593Smuzhiyun int arch_misc_init(void)
233*4882a593Smuzhiyun {
234*4882a593Smuzhiyun struct udevice *dev;
235*4882a593Smuzhiyun int ret;
236*4882a593Smuzhiyun
237*4882a593Smuzhiyun ret = uclass_first_device(UCLASS_MISC, &dev);
238*4882a593Smuzhiyun if (ret || !dev)
239*4882a593Smuzhiyun return ret;
240*4882a593Smuzhiyun
241*4882a593Smuzhiyun #if defined(CONFIG_DM_ETH) && defined(CONFIG_USB_ETHER)
242*4882a593Smuzhiyun ret = usb_ether_init();
243*4882a593Smuzhiyun if (ret) {
244*4882a593Smuzhiyun pr_err("USB ether init failed\n");
245*4882a593Smuzhiyun return ret;
246*4882a593Smuzhiyun }
247*4882a593Smuzhiyun #endif
248*4882a593Smuzhiyun
249*4882a593Smuzhiyun return 0;
250*4882a593Smuzhiyun }
251*4882a593Smuzhiyun
252*4882a593Smuzhiyun #endif /* CONFIG_USB_MUSB_* && CONFIG_AM335X_USB* && !CONFIG_DM_USB */
253*4882a593Smuzhiyun
254*4882a593Smuzhiyun #ifndef CONFIG_SKIP_LOWLEVEL_INIT
255*4882a593Smuzhiyun /*
256*4882a593Smuzhiyun * In the case of non-SPL based booting we'll want to call these
257*4882a593Smuzhiyun * functions a tiny bit later as it will require gd to be set and cleared
258*4882a593Smuzhiyun * and that's not true in s_init in this case so we cannot do it there.
259*4882a593Smuzhiyun */
board_early_init_f(void)260*4882a593Smuzhiyun int board_early_init_f(void)
261*4882a593Smuzhiyun {
262*4882a593Smuzhiyun prcm_init();
263*4882a593Smuzhiyun set_mux_conf_regs();
264*4882a593Smuzhiyun
265*4882a593Smuzhiyun return 0;
266*4882a593Smuzhiyun }
267*4882a593Smuzhiyun
268*4882a593Smuzhiyun /*
269*4882a593Smuzhiyun * This function is the place to do per-board things such as ramp up the
270*4882a593Smuzhiyun * MPU clock frequency.
271*4882a593Smuzhiyun */
am33xx_spl_board_init(void)272*4882a593Smuzhiyun __weak void am33xx_spl_board_init(void)
273*4882a593Smuzhiyun {
274*4882a593Smuzhiyun }
275*4882a593Smuzhiyun
276*4882a593Smuzhiyun #if defined(CONFIG_SPL_AM33XX_ENABLE_RTC32K_OSC)
rtc32k_enable(void)277*4882a593Smuzhiyun static void rtc32k_enable(void)
278*4882a593Smuzhiyun {
279*4882a593Smuzhiyun struct davinci_rtc *rtc = (struct davinci_rtc *)RTC_BASE;
280*4882a593Smuzhiyun
281*4882a593Smuzhiyun /*
282*4882a593Smuzhiyun * Unlock the RTC's registers. For more details please see the
283*4882a593Smuzhiyun * RTC_SS section of the TRM. In order to unlock we need to
284*4882a593Smuzhiyun * write these specific values (keys) in this order.
285*4882a593Smuzhiyun */
286*4882a593Smuzhiyun writel(RTC_KICK0R_WE, &rtc->kick0r);
287*4882a593Smuzhiyun writel(RTC_KICK1R_WE, &rtc->kick1r);
288*4882a593Smuzhiyun
289*4882a593Smuzhiyun /* Enable the RTC 32K OSC by setting bits 3 and 6. */
290*4882a593Smuzhiyun writel((1 << 3) | (1 << 6), &rtc->osc);
291*4882a593Smuzhiyun }
292*4882a593Smuzhiyun #endif
293*4882a593Smuzhiyun
uart_soft_reset(void)294*4882a593Smuzhiyun static void uart_soft_reset(void)
295*4882a593Smuzhiyun {
296*4882a593Smuzhiyun struct uart_sys *uart_base = (struct uart_sys *)DEFAULT_UART_BASE;
297*4882a593Smuzhiyun u32 regval;
298*4882a593Smuzhiyun
299*4882a593Smuzhiyun regval = readl(&uart_base->uartsyscfg);
300*4882a593Smuzhiyun regval |= UART_RESET;
301*4882a593Smuzhiyun writel(regval, &uart_base->uartsyscfg);
302*4882a593Smuzhiyun while ((readl(&uart_base->uartsyssts) &
303*4882a593Smuzhiyun UART_CLK_RUNNING_MASK) != UART_CLK_RUNNING_MASK)
304*4882a593Smuzhiyun ;
305*4882a593Smuzhiyun
306*4882a593Smuzhiyun /* Disable smart idle */
307*4882a593Smuzhiyun regval = readl(&uart_base->uartsyscfg);
308*4882a593Smuzhiyun regval |= UART_SMART_IDLE_EN;
309*4882a593Smuzhiyun writel(regval, &uart_base->uartsyscfg);
310*4882a593Smuzhiyun }
311*4882a593Smuzhiyun
watchdog_disable(void)312*4882a593Smuzhiyun static void watchdog_disable(void)
313*4882a593Smuzhiyun {
314*4882a593Smuzhiyun struct wd_timer *wdtimer = (struct wd_timer *)WDT_BASE;
315*4882a593Smuzhiyun
316*4882a593Smuzhiyun writel(0xAAAA, &wdtimer->wdtwspr);
317*4882a593Smuzhiyun while (readl(&wdtimer->wdtwwps) != 0x0)
318*4882a593Smuzhiyun ;
319*4882a593Smuzhiyun writel(0x5555, &wdtimer->wdtwspr);
320*4882a593Smuzhiyun while (readl(&wdtimer->wdtwwps) != 0x0)
321*4882a593Smuzhiyun ;
322*4882a593Smuzhiyun }
323*4882a593Smuzhiyun
s_init(void)324*4882a593Smuzhiyun void s_init(void)
325*4882a593Smuzhiyun {
326*4882a593Smuzhiyun }
327*4882a593Smuzhiyun
early_system_init(void)328*4882a593Smuzhiyun void early_system_init(void)
329*4882a593Smuzhiyun {
330*4882a593Smuzhiyun /*
331*4882a593Smuzhiyun * The ROM will only have set up sufficient pinmux to allow for the
332*4882a593Smuzhiyun * first 4KiB NOR to be read, we must finish doing what we know of
333*4882a593Smuzhiyun * the NOR mux in this space in order to continue.
334*4882a593Smuzhiyun */
335*4882a593Smuzhiyun #ifdef CONFIG_NOR_BOOT
336*4882a593Smuzhiyun enable_norboot_pin_mux();
337*4882a593Smuzhiyun #endif
338*4882a593Smuzhiyun watchdog_disable();
339*4882a593Smuzhiyun set_uart_mux_conf();
340*4882a593Smuzhiyun setup_early_clocks();
341*4882a593Smuzhiyun uart_soft_reset();
342*4882a593Smuzhiyun #ifdef CONFIG_SPL_BUILD
343*4882a593Smuzhiyun /*
344*4882a593Smuzhiyun * Save the boot parameters passed from romcode.
345*4882a593Smuzhiyun * We cannot delay the saving further than this,
346*4882a593Smuzhiyun * to prevent overwrites.
347*4882a593Smuzhiyun */
348*4882a593Smuzhiyun save_omap_boot_params();
349*4882a593Smuzhiyun #endif
350*4882a593Smuzhiyun #ifdef CONFIG_DEBUG_UART_OMAP
351*4882a593Smuzhiyun debug_uart_init();
352*4882a593Smuzhiyun #endif
353*4882a593Smuzhiyun #ifdef CONFIG_TI_I2C_BOARD_DETECT
354*4882a593Smuzhiyun do_board_detect();
355*4882a593Smuzhiyun #endif
356*4882a593Smuzhiyun #if defined(CONFIG_SPL_AM33XX_ENABLE_RTC32K_OSC)
357*4882a593Smuzhiyun /* Enable RTC32K clock */
358*4882a593Smuzhiyun rtc32k_enable();
359*4882a593Smuzhiyun #endif
360*4882a593Smuzhiyun }
361*4882a593Smuzhiyun
362*4882a593Smuzhiyun #ifdef CONFIG_SPL_BUILD
board_init_f(ulong dummy)363*4882a593Smuzhiyun void board_init_f(ulong dummy)
364*4882a593Smuzhiyun {
365*4882a593Smuzhiyun hw_data_init();
366*4882a593Smuzhiyun early_system_init();
367*4882a593Smuzhiyun board_early_init_f();
368*4882a593Smuzhiyun sdram_init();
369*4882a593Smuzhiyun /* dram_init must store complete ramsize in gd->ram_size */
370*4882a593Smuzhiyun gd->ram_size = get_ram_size(
371*4882a593Smuzhiyun (void *)CONFIG_SYS_SDRAM_BASE,
372*4882a593Smuzhiyun CONFIG_MAX_RAM_BANK_SIZE);
373*4882a593Smuzhiyun }
374*4882a593Smuzhiyun #endif
375*4882a593Smuzhiyun
376*4882a593Smuzhiyun #endif
377*4882a593Smuzhiyun
arch_cpu_init_dm(void)378*4882a593Smuzhiyun int arch_cpu_init_dm(void)
379*4882a593Smuzhiyun {
380*4882a593Smuzhiyun hw_data_init();
381*4882a593Smuzhiyun #ifndef CONFIG_SKIP_LOWLEVEL_INIT
382*4882a593Smuzhiyun early_system_init();
383*4882a593Smuzhiyun #endif
384*4882a593Smuzhiyun return 0;
385*4882a593Smuzhiyun }
386