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