blob: c54dc9d05c5c493c3c604b6841d10deacc815f57 [file] [log] [blame]
Peng Fanb72606c2022-07-26 16:41:10 +08001// SPDX-License-Identifier: GPL-2.0+
2/*
3 * Copyright 2022 NXP
4 */
5
6#include <common.h>
7#include <env.h>
8#include <init.h>
9#include <miiphy.h>
10#include <netdev.h>
11#include <asm/global_data.h>
12#include <asm/arch-imx9/ccm_regs.h>
13#include <asm/arch/sys_proto.h>
14#include <asm/arch-imx9/imx93_pins.h>
15#include <asm/arch/clock.h>
16#include <power/pmic.h>
17#include <dm/device.h>
18#include <dm/uclass.h>
19#include <usb.h>
20#include <dwc3-uboot.h>
21
22DECLARE_GLOBAL_DATA_PTR;
23
24#define UART_PAD_CTRL (PAD_CTL_DSE(6) | PAD_CTL_FSEL2)
25#define WDOG_PAD_CTRL (PAD_CTL_DSE(6) | PAD_CTL_ODE | PAD_CTL_PUE | PAD_CTL_PE)
26
27static iomux_v3_cfg_t const uart_pads[] = {
28 MX93_PAD_UART1_RXD__LPUART1_RX | MUX_PAD_CTRL(UART_PAD_CTRL),
29 MX93_PAD_UART1_TXD__LPUART1_TX | MUX_PAD_CTRL(UART_PAD_CTRL),
30};
31
32int board_early_init_f(void)
33{
34 imx_iomux_v3_setup_multiple_pads(uart_pads, ARRAY_SIZE(uart_pads));
35
Peng Fanb72606c2022-07-26 16:41:10 +080036 return 0;
37}
38
Peng Fan7aaa58a2022-07-26 16:41:18 +080039static int setup_fec(void)
40{
41 return set_clk_enet(ENET_125MHZ);
42}
43
44int board_phy_config(struct phy_device *phydev)
45{
46 if (phydev->drv->config)
47 phydev->drv->config(phydev);
48
49 return 0;
50}
51
Peng Fanb72606c2022-07-26 16:41:10 +080052int board_init(void)
53{
Simon Glassb42427e2023-02-05 17:54:16 -070054 if (IS_ENABLED(CONFIG_FEC_MXC))
Peng Fan7aaa58a2022-07-26 16:41:18 +080055 setup_fec();
56
Peng Fanb72606c2022-07-26 16:41:10 +080057 return 0;
58}
59
60int board_late_init(void)
61{
62#ifdef CONFIG_ENV_IS_IN_MMC
63 board_late_mmc_env_init();
64#endif
65
66#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
67 env_set("board_name", "11X11_EVK");
68 env_set("board_rev", "iMX93");
69#endif
70 return 0;
71}