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