Peng Fan | b72606c | 2022-07-26 16:41:10 +0800 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
| 2 | /* |
| 3 | * Copyright 2022 NXP |
| 4 | */ |
| 5 | |
Peng Fan | b72606c | 2022-07-26 16:41:10 +0800 | [diff] [blame] | 6 | #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 | |
| 21 | DECLARE_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 | |
| 26 | static 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 | |
| 31 | int board_early_init_f(void) |
| 32 | { |
| 33 | imx_iomux_v3_setup_multiple_pads(uart_pads, ARRAY_SIZE(uart_pads)); |
| 34 | |
Peng Fan | b72606c | 2022-07-26 16:41:10 +0800 | [diff] [blame] | 35 | return 0; |
| 36 | } |
| 37 | |
Peng Fan | 7aaa58a | 2022-07-26 16:41:18 +0800 | [diff] [blame] | 38 | static int setup_fec(void) |
| 39 | { |
| 40 | return set_clk_enet(ENET_125MHZ); |
| 41 | } |
| 42 | |
| 43 | int 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 Fan | b72606c | 2022-07-26 16:41:10 +0800 | [diff] [blame] | 51 | int board_init(void) |
| 52 | { |
Simon Glass | b42427e | 2023-02-05 17:54:16 -0700 | [diff] [blame] | 53 | if (IS_ENABLED(CONFIG_FEC_MXC)) |
Peng Fan | 7aaa58a | 2022-07-26 16:41:18 +0800 | [diff] [blame] | 54 | setup_fec(); |
| 55 | |
Peng Fan | b72606c | 2022-07-26 16:41:10 +0800 | [diff] [blame] | 56 | return 0; |
| 57 | } |
| 58 | |
| 59 | int 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 | } |