2 * (C) Copyright 2012 Henrik Nordstrom <henrik@henriknordstrom.net>
4 * (C) Copyright 2007-2011
5 * Allwinner Technology Co., Ltd. <www.allwinnertech.com>
6 * Tom Cubie <tangliang@allwinnertech.com>
8 * Some init for sunxi platform.
10 * SPDX-License-Identifier: GPL-2.0+
17 #ifdef CONFIG_SPL_BUILD
22 #include <asm/arch/clock.h>
23 #include <asm/arch/gpio.h>
24 #include <asm/arch/sys_proto.h>
25 #include <asm/arch/timer.h>
27 #ifdef CONFIG_SPL_BUILD
28 /* Pointer to the global data structure for SPL */
29 DECLARE_GLOBAL_DATA_PTR;
31 /* The sunxi internal brom will try to loader external bootloader
32 * from mmc0, nand flash, mmc2.
33 * Unfortunately we can't check how SPL was loaded so assume
34 * it's always the first SD/MMC controller
36 u32 spl_boot_device(void)
38 return BOOT_DEVICE_MMC1;
41 /* No confirmation data available in SPL yet. Hardcode bootmode */
42 u32 spl_boot_mode(void)
44 return MMCSD_MODE_RAW;
50 sunxi_gpio_set_cfgpin(SUNXI_GPB(22), SUN4I_GPB22_UART0_TX);
51 sunxi_gpio_set_cfgpin(SUNXI_GPB(23), SUN4I_GPB23_UART0_RX);
52 sunxi_gpio_set_pull(SUNXI_GPB(23), 1);
57 void reset_cpu(ulong addr)
61 /* do some early init */
64 #if !defined CONFIG_SPL_BUILD && (defined CONFIG_SUN7I || defined CONFIG_SUN6I)
65 /* Enable SMP mode for CPU0, by setting bit 6 of Auxiliary Ctl reg */
67 "mrc p15, 0, r0, c1, c0, 1\n"
68 "orr r0, r0, #1 << 6\n"
69 "mcr p15, 0, r0, c1, c0, 1\n");
76 #ifdef CONFIG_SPL_BUILD
78 preloader_console_init();
84 #ifndef CONFIG_SYS_DCACHE_OFF
85 void enable_caches(void)
87 /* Enable D-cache. I-cache is already enabled in start.S */
94 * Initializes on-chip ethernet controllers.
95 * to override, implement board_eth_init()
97 int cpu_eth_init(bd_t *bis)
101 #ifdef CONFIG_SUNXI_GMAC
102 rc = sunxi_gmac_initialize(bis);
104 printf("sunxi: failed to initialize gmac\n");