diff options
author | Uros Majstorovic <majstor@majstor.org> | 2021-08-07 03:15:02 +0200 |
---|---|---|
committer | Uros Majstorovic <majstor@majstor.org> | 2021-08-07 03:15:02 +0200 |
commit | ee7fda01cec2e83a8ad01acd006e318848657cb8 (patch) | |
tree | 6e8bc6200407d373f00082a097b4901737f52b01 | |
parent | f4eb0e4cc611ddc9c3df81d63746401acd064bed (diff) |
added common.[ch] to u-boot
5 files changed, 48 insertions, 26 deletions
diff --git a/recipes-bsp/u-boot/rvphone/cl-imx8/board/rvphone/cl-imx8/Makefile b/recipes-bsp/u-boot/rvphone/cl-imx8/board/rvphone/cl-imx8/Makefile index a9adfe3..30eb144 100644 --- a/recipes-bsp/u-boot/rvphone/cl-imx8/board/rvphone/cl-imx8/Makefile +++ b/recipes-bsp/u-boot/rvphone/cl-imx8/board/rvphone/cl-imx8/Makefile @@ -5,6 +5,7 @@ # ccflags-y += -I../../freescale +obj-y += common.o obj-y += ../../freescale/common/mmc.o obj-$(CONFIG_$(SPL_)DM_PMIC_PFUZE100) += ../../freescale/common/pfuze.o obj-$(CONFIG_POWER_PFUZE100) += ../../freescale/common/pfuze.o diff --git a/recipes-bsp/u-boot/rvphone/cl-imx8/board/rvphone/cl-imx8/cl-imx8.c b/recipes-bsp/u-boot/rvphone/cl-imx8/board/rvphone/cl-imx8/cl-imx8.c index 3259df7..b728bc7 100644 --- a/recipes-bsp/u-boot/rvphone/cl-imx8/board/rvphone/cl-imx8/cl-imx8.c +++ b/recipes-bsp/u-boot/rvphone/cl-imx8/board/rvphone/cl-imx8/cl-imx8.c @@ -26,33 +26,9 @@ #include <power/pfuze100_pmic.h> #include "../../freescale/common/pfuze.h" -DECLARE_GLOBAL_DATA_PTR; - -#define WDOG_PAD_CTRL (PAD_CTL_DSE6 | PAD_CTL_HYS | PAD_CTL_PUE) - -static iomux_v3_cfg_t const wdog_pads[] = { - IMX8MQ_PAD_GPIO1_IO02__WDOG1_WDOG_B | MUX_PAD_CTRL(WDOG_PAD_CTRL), -}; +#include "common.h" -#define UART_PAD_CTRL (PAD_CTL_DSE6 | PAD_CTL_FSEL1) - -static iomux_v3_cfg_t const uart_pads[] = { - IMX8MQ_PAD_UART3_RXD__UART3_RX | MUX_PAD_CTRL(UART_PAD_CTRL), - IMX8MQ_PAD_UART3_TXD__UART3_TX | MUX_PAD_CTRL(UART_PAD_CTRL), -}; - -int board_early_init_f(void) -{ - struct wdog_regs *wdog = (struct wdog_regs *)WDOG1_BASE_ADDR; - - imx_iomux_v3_setup_multiple_pads(wdog_pads, ARRAY_SIZE(wdog_pads)); - - set_wdog_reset(wdog); - - imx_iomux_v3_setup_multiple_pads(uart_pads, ARRAY_SIZE(uart_pads)); - - return 0; -} +DECLARE_GLOBAL_DATA_PTR; #ifdef CONFIG_BOARD_POSTCLK_INIT int board_postclk_init(void) diff --git a/recipes-bsp/u-boot/rvphone/cl-imx8/board/rvphone/cl-imx8/common.c b/recipes-bsp/u-boot/rvphone/cl-imx8/board/rvphone/cl-imx8/common.c new file mode 100644 index 0000000..d3a8f3f --- /dev/null +++ b/recipes-bsp/u-boot/rvphone/cl-imx8/board/rvphone/cl-imx8/common.c @@ -0,0 +1,33 @@ +#include "common.h" +#include <asm/arch/clock.h> +#include <asm/arch/imx8mq_pins.h> +#include <asm-generic/gpio.h> +#include <asm/mach-imx/gpio.h> + +void set_wdog_reset(struct wdog_regs *wdog); + +#define WDOG_PAD_CTRL (PAD_CTL_DSE6 | PAD_CTL_HYS | PAD_CTL_PUE) + +static iomux_v3_cfg_t const wdog_pads[] = { + IMX8MQ_PAD_GPIO1_IO02__WDOG1_WDOG_B | MUX_PAD_CTRL(WDOG_PAD_CTRL), +}; + +#define UART_PAD_CTRL (PAD_CTL_DSE6 | PAD_CTL_FSEL1) + +static iomux_v3_cfg_t const uart_pads[] = { + IMX8MQ_PAD_UART3_RXD__UART3_RX | MUX_PAD_CTRL(UART_PAD_CTRL), + IMX8MQ_PAD_UART3_TXD__UART3_TX | MUX_PAD_CTRL(UART_PAD_CTRL), +}; + +int board_early_init_f(void) +{ + struct wdog_regs *wdog = (struct wdog_regs *)WDOG1_BASE_ADDR; + + imx_iomux_v3_setup_multiple_pads(wdog_pads, ARRAY_SIZE(wdog_pads)); + + set_wdog_reset(wdog); + + imx_iomux_v3_setup_multiple_pads(uart_pads, ARRAY_SIZE(uart_pads)); + + return 0; +} diff --git a/recipes-bsp/u-boot/rvphone/cl-imx8/board/rvphone/cl-imx8/common.h b/recipes-bsp/u-boot/rvphone/cl-imx8/board/rvphone/cl-imx8/common.h new file mode 100644 index 0000000..d70f78c --- /dev/null +++ b/recipes-bsp/u-boot/rvphone/cl-imx8/board/rvphone/cl-imx8/common.h @@ -0,0 +1,11 @@ +#ifndef __CL_IMX8_COMMON_H__ +#define __CL_IMX8_COMMON_H__ + +#include <asm/mach-imx/iomux-v3.h> + +int board_early_init_f(void); + +#define I2C_PAD_CTRL (PAD_CTL_DSE6 | PAD_CTL_HYS | PAD_CTL_PUE) +#define PC MUX_PAD_CTRL(I2C_PAD_CTRL) + +#endif /* __CL_IMX8_COMMON_H__ */ diff --git a/recipes-bsp/u-boot/rvphone/cl-imx8/board/rvphone/cl-imx8/spl.c b/recipes-bsp/u-boot/rvphone/cl-imx8/board/rvphone/cl-imx8/spl.c index 351a0d1..1524173 100644 --- a/recipes-bsp/u-boot/rvphone/cl-imx8/board/rvphone/cl-imx8/spl.c +++ b/recipes-bsp/u-boot/rvphone/cl-imx8/board/rvphone/cl-imx8/spl.c @@ -22,6 +22,7 @@ #include <fsl_esdhc.h> #include <mmc.h> +#include "common.h" #include "ddr/ddr.h" DECLARE_GLOBAL_DATA_PTR; |