1 // SPDX-License-Identifier: GPL-2.0+ 2 /* 3 * Copyright (C) 2016 Freescale Semiconductor, Inc. 4 */ 5 6 #include <init.h> 7 #include <asm/global_data.h> 8 #include <asm/io.h> 9 #include <asm/arch/sys_proto.h> 10 #include <asm/arch/mx7ulp-pins.h> 11 #include <asm/arch/iomux.h> 12 #include <asm/gpio.h> 13 14 DECLARE_GLOBAL_DATA_PTR; 15 16 #define UART_PAD_CTRL (PAD_CTL_PUS_UP) 17 dram_init(void)18int dram_init(void) 19 { 20 gd->ram_size = imx_ddr_size(); 21 22 #ifdef CONFIG_OPTEE_TZDRAM_SIZE 23 gd->ram_size -= CONFIG_OPTEE_TZDRAM_SIZE; 24 #endif 25 26 return 0; 27 } 28 29 static iomux_cfg_t const lpuart4_pads[] = { 30 MX7ULP_PAD_PTC3__LPUART4_RX | MUX_PAD_CTRL(UART_PAD_CTRL), 31 MX7ULP_PAD_PTC2__LPUART4_TX | MUX_PAD_CTRL(UART_PAD_CTRL), 32 }; 33 setup_iomux_uart(void)34static void setup_iomux_uart(void) 35 { 36 mx7ulp_iomux_setup_multiple_pads(lpuart4_pads, 37 ARRAY_SIZE(lpuart4_pads)); 38 } 39 board_early_init_f(void)40int board_early_init_f(void) 41 { 42 setup_iomux_uart(); 43 44 return 0; 45 } 46 board_init(void)47int board_init(void) 48 { 49 /* address of boot parameters */ 50 gd->bd->bi_boot_params = PHYS_SDRAM + 0x100; 51 52 return 0; 53 } 54 55 #ifdef CONFIG_XPL_BUILD 56 #include <spl.h> 57 58 #ifdef CONFIG_SPL_LOAD_FIT board_fit_config_name_match(const char * name)59int board_fit_config_name_match(const char *name) 60 { 61 if (!strcmp(name, "imx7ulp-com")) 62 return 0; 63 64 return -1; 65 } 66 #endif 67 spl_board_init(void)68void spl_board_init(void) 69 { 70 preloader_console_init(); 71 } 72 board_init_f(ulong dummy)73void board_init_f(ulong dummy) 74 { 75 arch_cpu_init(); 76 77 board_early_init_f(); 78 } 79 #endif 80