[PATCH 1/4] ARM: imx8m: Deduplicate CAAM init with arch_misc_init() call
Peng Fan
peng.fan at oss.nxp.com
Wed Sep 21 07:31:08 CEST 2022
On 9/20/2022 3:41 AM, Marek Vasut wrote:
> Instead of duplicating code implemented by i.MX8M version of arch_misc_init()
> in every board, enable CONFIG_ARCH_MISC_INIT and call arch_misc_init() from
> spl_board_init(). This removes the duplication. No functional change.
>
> Signed-off-by: Marek Vasut <marex at denx.de>
> ---
> Cc: Fabio Estevam <festevam at denx.de>
> Cc: Frieder Schrempf <frieder.schrempf at kontron.de>
> Cc: Marcel Ziswiler <marcel.ziswiler at toradex.com>
> Cc: Max Krummenacher <max.krummenacher at toradex.com>
> Cc: Peng Fan <peng.fan at nxp.com>
> Cc: Stefano Babic <sbabic at denx.de>
> Cc: Teresa Remmet <t.remmet at phytec.de>
Reviewed-by: Peng Fan <peng.fan at nxp.com>
> ---
> board/freescale/imx8mm_evk/spl.c | 10 +---------
> board/freescale/imx8mn_evk/spl.c | 7 ++-----
> board/freescale/imx8mp_evk/spl.c | 8 +-------
> board/kontron/sl-mx8mm/spl.c | 6 +-----
> board/toradex/verdin-imx8mm/spl.c | 9 +--------
> configs/imx8mm-mx8menlo_defconfig | 1 +
> configs/imx8mm_evk_defconfig | 1 +
> configs/imx8mm_evk_fspi_defconfig | 1 +
> configs/imx8mp_evk_defconfig | 1 +
> configs/kontron-sl-mx8mm_defconfig | 1 +
> configs/verdin-imx8mm_defconfig | 1 +
> 11 files changed, 12 insertions(+), 34 deletions(-)
>
> diff --git a/board/freescale/imx8mm_evk/spl.c b/board/freescale/imx8mm_evk/spl.c
> index e2eb1426c83..e0e97c7fd9a 100644
> --- a/board/freescale/imx8mm_evk/spl.c
> +++ b/board/freescale/imx8mm_evk/spl.c
> @@ -53,15 +53,7 @@ static void spl_dram_init(void)
>
> void spl_board_init(void)
> {
> - if (IS_ENABLED(CONFIG_FSL_CAAM)) {
> - struct udevice *dev;
> - int ret;
> -
> - ret = uclass_get_device_by_driver(UCLASS_MISC, DM_DRIVER_GET(caam_jr), &dev);
> - if (ret)
> - printf("Failed to initialize caam_jr: %d\n", ret);
> - }
> - puts("Normal Boot\n");
> + arch_misc_init();
> }
>
> #ifdef CONFIG_SPL_LOAD_FIT
> diff --git a/board/freescale/imx8mn_evk/spl.c b/board/freescale/imx8mn_evk/spl.c
> index c0bfb67199a..380abecd746 100644
> --- a/board/freescale/imx8mn_evk/spl.c
> +++ b/board/freescale/imx8mn_evk/spl.c
> @@ -49,11 +49,8 @@ void spl_board_init(void)
> struct udevice *dev;
> int ret;
>
> - if (IS_ENABLED(CONFIG_FSL_CAAM)) {
> - ret = uclass_get_device_by_driver(UCLASS_MISC, DM_DRIVER_GET(caam_jr), &dev);
> - if (ret)
> - printf("Failed to initialize caam_jr: %d\n", ret);
> - }
> + arch_misc_init();
> +
> puts("Normal Boot\n");
>
> ret = uclass_get_device_by_name(UCLASS_CLK,
> diff --git a/board/freescale/imx8mp_evk/spl.c b/board/freescale/imx8mp_evk/spl.c
> index 719b1f6d7da..f1b285417d0 100644
> --- a/board/freescale/imx8mp_evk/spl.c
> +++ b/board/freescale/imx8mp_evk/spl.c
> @@ -37,14 +37,8 @@ void spl_dram_init(void)
>
> void spl_board_init(void)
> {
> - if (IS_ENABLED(CONFIG_FSL_CAAM)) {
> - struct udevice *dev;
> - int ret;
> + arch_misc_init();
>
> - ret = uclass_get_device_by_driver(UCLASS_MISC, DM_DRIVER_GET(caam_jr), &dev);
> - if (ret)
> - printf("Failed to initialize caam_jr: %d\n", ret);
> - }
> /*
> * Set GIC clock to 500Mhz for OD VDD_SOC. Kernel driver does
> * not allow to change it. Should set the clock after PMIC
> diff --git a/board/kontron/sl-mx8mm/spl.c b/board/kontron/sl-mx8mm/spl.c
> index 09f81351dd4..b884c91aef9 100644
> --- a/board/kontron/sl-mx8mm/spl.c
> +++ b/board/kontron/sl-mx8mm/spl.c
> @@ -205,11 +205,7 @@ void spl_board_init(void)
> struct udevice *dev;
> int ret;
>
> - if (IS_ENABLED(CONFIG_FSL_CAAM)) {
> - ret = uclass_get_device_by_driver(UCLASS_MISC, DM_DRIVER_GET(caam_jr), &dev);
> - if (ret)
> - printf("Failed to initialize %s: %d\n", dev->name, ret);
> - }
> + arch_misc_init();
>
> puts("Normal Boot\n");
>
> diff --git a/board/toradex/verdin-imx8mm/spl.c b/board/toradex/verdin-imx8mm/spl.c
> index fb9aae6c9c8..59a3d9e0cae 100644
> --- a/board/toradex/verdin-imx8mm/spl.c
> +++ b/board/toradex/verdin-imx8mm/spl.c
> @@ -53,14 +53,7 @@ void spl_dram_init(void)
>
> void spl_board_init(void)
> {
> - if (IS_ENABLED(CONFIG_FSL_CAAM)) {
> - struct udevice *dev;
> - int ret;
> -
> - ret = uclass_get_device_by_driver(UCLASS_MISC, DM_DRIVER_GET(caam_jr), &dev);
> - if (ret)
> - printf("Failed to initialize %s: %d\n", dev->name, ret);
> - }
> + arch_misc_init();
>
> /* Serial download mode */
> if (is_usb_boot()) {
> diff --git a/configs/imx8mm-mx8menlo_defconfig b/configs/imx8mm-mx8menlo_defconfig
> index 702162f86de..929ff382f27 100644
> --- a/configs/imx8mm-mx8menlo_defconfig
> +++ b/configs/imx8mm-mx8menlo_defconfig
> @@ -34,6 +34,7 @@ CONFIG_DEFAULT_FDT_FILE="imx8mm-mx8menlo.dtb"
> CONFIG_LOG=y
> # CONFIG_DISPLAY_BOARDINFO is not set
> CONFIG_DISPLAY_BOARDINFO_LATE=y
> +CONFIG_ARCH_MISC_INIT=y
> CONFIG_BOARD_LATE_INIT=y
> CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
> CONFIG_SPL_BSS_START_ADDR=0x910000
> diff --git a/configs/imx8mm_evk_defconfig b/configs/imx8mm_evk_defconfig
> index 7bcedcd51f5..58b5e468a58 100644
> --- a/configs/imx8mm_evk_defconfig
> +++ b/configs/imx8mm_evk_defconfig
> @@ -23,6 +23,7 @@ CONFIG_FIT_EXTERNAL_OFFSET=0x3000
> CONFIG_SPL_LOAD_FIT=y
> # CONFIG_USE_SPL_FIT_GENERATOR is not set
> CONFIG_OF_SYSTEM_SETUP=y
> +CONFIG_ARCH_MISC_INIT=y
> CONFIG_BOARD_LATE_INIT=y
> CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
> CONFIG_SPL_BSS_START_ADDR=0x910000
> diff --git a/configs/imx8mm_evk_fspi_defconfig b/configs/imx8mm_evk_fspi_defconfig
> index 21fd7e08db1..73c96f634ce 100644
> --- a/configs/imx8mm_evk_fspi_defconfig
> +++ b/configs/imx8mm_evk_fspi_defconfig
> @@ -24,6 +24,7 @@ CONFIG_FIT_EXTERNAL_OFFSET=0x3000
> CONFIG_SPL_LOAD_FIT=y
> # CONFIG_USE_SPL_FIT_GENERATOR is not set
> CONFIG_OF_SYSTEM_SETUP=y
> +CONFIG_ARCH_MISC_INIT=y
> CONFIG_BOARD_LATE_INIT=y
> CONFIG_SPL_MAX_SIZE=0x25000
> CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
> diff --git a/configs/imx8mp_evk_defconfig b/configs/imx8mp_evk_defconfig
> index 0be1951e740..406e89e428b 100644
> --- a/configs/imx8mp_evk_defconfig
> +++ b/configs/imx8mp_evk_defconfig
> @@ -28,6 +28,7 @@ CONFIG_SPL_LOAD_FIT=y
> # CONFIG_USE_SPL_FIT_GENERATOR is not set
> CONFIG_OF_SYSTEM_SETUP=y
> CONFIG_DEFAULT_FDT_FILE="imx8mp-evk.dtb"
> +CONFIG_ARCH_MISC_INIT=y
> CONFIG_BOARD_LATE_INIT=y
> CONFIG_SPL_MAX_SIZE=0x26000
> CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
> diff --git a/configs/kontron-sl-mx8mm_defconfig b/configs/kontron-sl-mx8mm_defconfig
> index 5387f65926f..43731e4c280 100644
> --- a/configs/kontron-sl-mx8mm_defconfig
> +++ b/configs/kontron-sl-mx8mm_defconfig
> @@ -27,6 +27,7 @@ CONFIG_SPL_LOAD_FIT=y
> # CONFIG_USE_SPL_FIT_GENERATOR is not set
> CONFIG_OF_BOARD_SETUP=y
> CONFIG_BOARD_TYPES=y
> +CONFIG_ARCH_MISC_INIT=y
> CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
> CONFIG_SPL_BSS_START_ADDR=0x910000
> CONFIG_SPL_BSS_MAX_SIZE=0x2000
> diff --git a/configs/verdin-imx8mm_defconfig b/configs/verdin-imx8mm_defconfig
> index f65b4a7f307..230fe55d068 100644
> --- a/configs/verdin-imx8mm_defconfig
> +++ b/configs/verdin-imx8mm_defconfig
> @@ -36,6 +36,7 @@ CONFIG_PREBOOT="test -n ${fdtfile} || setenv fdtfile imx8mm-verdin-${variant}-${
> CONFIG_LOG=y
> # CONFIG_DISPLAY_BOARDINFO is not set
> CONFIG_DISPLAY_BOARDINFO_LATE=y
> +CONFIG_ARCH_MISC_INIT=y
> CONFIG_BOARD_LATE_INIT=y
> CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
> CONFIG_SPL_BSS_START_ADDR=0x910000
More information about the U-Boot
mailing list