Shawn Guo | ec907a0 | 2019-07-07 20:59:55 +0800 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
| 2 | /* |
| 3 | * Copyright (C) 2019 Linaro Ltd. |
| 4 | * Copyright (C) 2016 NXP Semiconductors |
| 5 | */ |
| 6 | |
Simon Glass | 9758973 | 2020-05-10 11:40:02 -0600 | [diff] [blame] | 7 | #include <init.h> |
Shawn Guo | ec907a0 | 2019-07-07 20:59:55 +0800 | [diff] [blame] | 8 | #include <asm/arch/clock.h> |
| 9 | #include <asm/arch/imx-regs.h> |
| 10 | #include <asm/arch/mx7-pins.h> |
| 11 | #include <asm/arch/sys_proto.h> |
Simon Glass | 3ba929a | 2020-10-30 21:38:53 -0600 | [diff] [blame] | 12 | #include <asm/global_data.h> |
Shawn Guo | ec907a0 | 2019-07-07 20:59:55 +0800 | [diff] [blame] | 13 | #include <asm/mach-imx/iomux-v3.h> |
| 14 | #include <asm/io.h> |
Shawn Guo | ec907a0 | 2019-07-07 20:59:55 +0800 | [diff] [blame] | 15 | #include <linux/sizes.h> |
| 16 | |
| 17 | DECLARE_GLOBAL_DATA_PTR; |
| 18 | |
| 19 | #define UART_PAD_CTRL (PAD_CTL_DSE_3P3V_49OHM | \ |
| 20 | PAD_CTL_PUS_PU100KOHM | PAD_CTL_HYS) |
| 21 | |
| 22 | static iomux_v3_cfg_t const meerkat96_pads[] = { |
| 23 | /* UART6 as debug serial */ |
| 24 | MX7D_PAD_SD1_CD_B__UART6_DCE_RX | MUX_PAD_CTRL(UART_PAD_CTRL), |
| 25 | MX7D_PAD_SD1_WP__UART6_DCE_TX | MUX_PAD_CTRL(UART_PAD_CTRL), |
| 26 | /* WDOG1 for reset */ |
| 27 | MX7D_PAD_GPIO1_IO00__WDOG1_WDOG_B | MUX_PAD_CTRL(NO_PAD_CTRL), |
| 28 | }; |
| 29 | |
| 30 | int dram_init(void) |
| 31 | { |
| 32 | gd->ram_size = PHYS_SDRAM_SIZE; |
| 33 | |
| 34 | return 0; |
| 35 | } |
| 36 | |
| 37 | int board_early_init_f(void) |
| 38 | { |
| 39 | imx_iomux_v3_setup_multiple_pads(meerkat96_pads, |
| 40 | ARRAY_SIZE(meerkat96_pads)); |
| 41 | |
| 42 | return 0; |
| 43 | } |
| 44 | |
| 45 | int board_init(void) |
| 46 | { |
| 47 | /* address of boot parameters */ |
| 48 | gd->bd->bi_boot_params = PHYS_SDRAM + 0x100; |
| 49 | |
| 50 | return 0; |
| 51 | } |
| 52 | |
| 53 | int checkboard(void) |
| 54 | { |
| 55 | char *mode; |
| 56 | |
| 57 | if (IS_ENABLED(CONFIG_ARMV7_BOOT_SEC_DEFAULT)) |
| 58 | mode = "secure"; |
| 59 | else |
| 60 | mode = "non-secure"; |
| 61 | |
| 62 | printf("Board: i.MX7D Meerkat96 in %s mode\n", mode); |
| 63 | |
| 64 | return 0; |
| 65 | } |
| 66 | |
| 67 | int board_late_init(void) |
| 68 | { |
| 69 | set_wdog_reset((struct wdog_regs *)WDOG1_BASE_ADDR); |
| 70 | |
| 71 | return 0; |
| 72 | } |