blob: ab920a4539cdf9a77607e1eba5640fa8a6233436 [file] [log] [blame]
Peng Fanaeb9c062018-11-20 10:20:00 +00001// SPDX-License-Identifier: GPL-2.0+
2/*
3 * Copyright 2018 NXP
4 */
5
Simon Glass5e6201b2019-08-01 09:46:51 -06006#include <env.h>
Simon Glassa7b51302019-11-14 12:57:46 -07007#include <init.h>
Peng Fanaeb9c062018-11-20 10:20:00 +00008#include <malloc.h>
9#include <errno.h>
Simon Glass3ba929a2020-10-30 21:38:53 -060010#include <asm/global_data.h>
Peng Fanaeb9c062018-11-20 10:20:00 +000011#include <asm/io.h>
12#include <miiphy.h>
13#include <netdev.h>
14#include <asm/mach-imx/iomux-v3.h>
15#include <asm-generic/gpio.h>
Yangbo Lu73340382019-06-21 11:42:28 +080016#include <fsl_esdhc_imx.h>
Peng Fanaeb9c062018-11-20 10:20:00 +000017#include <mmc.h>
18#include <asm/arch/imx8mq_pins.h>
19#include <asm/arch/sys_proto.h>
20#include <asm/mach-imx/gpio.h>
21#include <asm/mach-imx/mxc_i2c.h>
22#include <asm/arch/clock.h>
23#include <spl.h>
Simon Glass4dcacfc2020-05-10 11:40:13 -060024#include <linux/bitops.h>
Peng Fanaeb9c062018-11-20 10:20:00 +000025#include <power/pmic.h>
26#include <power/pfuze100_pmic.h>
27#include "../common/pfuze.h"
28
29DECLARE_GLOBAL_DATA_PTR;
30
31#define UART_PAD_CTRL (PAD_CTL_DSE6 | PAD_CTL_FSEL1)
32
33#define WDOG_PAD_CTRL (PAD_CTL_DSE6 | PAD_CTL_HYS | PAD_CTL_PUE)
34
35static iomux_v3_cfg_t const wdog_pads[] = {
36 IMX8MQ_PAD_GPIO1_IO02__WDOG1_WDOG_B | MUX_PAD_CTRL(WDOG_PAD_CTRL),
37};
38
39static iomux_v3_cfg_t const uart_pads[] = {
40 IMX8MQ_PAD_UART1_RXD__UART1_RX | MUX_PAD_CTRL(UART_PAD_CTRL),
41 IMX8MQ_PAD_UART1_TXD__UART1_TX | MUX_PAD_CTRL(UART_PAD_CTRL),
42};
43
44int board_early_init_f(void)
45{
46 struct wdog_regs *wdog = (struct wdog_regs *)WDOG1_BASE_ADDR;
47
48 imx_iomux_v3_setup_multiple_pads(wdog_pads, ARRAY_SIZE(wdog_pads));
49 set_wdog_reset(wdog);
50
51 imx_iomux_v3_setup_multiple_pads(uart_pads, ARRAY_SIZE(uart_pads));
52
53 return 0;
54}
55
Peng Fanaeb9c062018-11-20 10:20:00 +000056int board_init(void)
57{
Ye Li55fc7822021-02-21 08:26:24 -080058#if defined(CONFIG_USB_DWC3) || defined(CONFIG_USB_XHCI_DWC3)
59 init_usb_clk();
60#endif
61
Peng Fanaeb9c062018-11-20 10:20:00 +000062 return 0;
63}
64
65int board_mmc_get_env_dev(int devno)
66{
67 return devno;
68}
69
70int board_late_init(void)
71{
72#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
73 env_set("board_name", "EVK");
74 env_set("board_rev", "iMX8MQ");
75#endif
76
77 return 0;
78}