[PATCH 14/42] rockchip: Simplify check for SPL
Jonas Karlman
jonas at kwiboo.se
Fri Sep 27 02:13:32 CEST 2024
Hi Simon,
On 2024-09-27 00:35, Simon Glass wrote:
> Now that SPL means SPL (only) and is not defined for TPL, simplify some
> checks for SPL.
>
> Signed-off-by: Simon Glass <sjg at chromium.org>
> ---
>
> arch/arm/include/asm/arch-rockchip/boot0.h | 3 +--
> arch/arm/mach-rockchip/rk3399/rk3399.c | 2 +-
> drivers/clk/rockchip/clk_rk3368.c | 8 ++++----
> drivers/ram/rockchip/sdram_rk3288.c | 10 +++++-----
> drivers/ram/rockchip/sdram_rk3399.c | 2 +-
> drivers/ram/rockchip/sdram_rv1126.c | 9 +++------
> 6 files changed, 15 insertions(+), 19 deletions(-)
>
> diff --git a/arch/arm/include/asm/arch-rockchip/boot0.h b/arch/arm/include/asm/arch-rockchip/boot0.h
> index edb2a31c348..918f0495fa0 100644
> --- a/arch/arm/include/asm/arch-rockchip/boot0.h
> +++ b/arch/arm/include/asm/arch-rockchip/boot0.h
> @@ -54,7 +54,6 @@ _start:
> ARM_VECTORS
> #endif
>
> -#if !defined(CONFIG_TPL_BUILD) && defined(CONFIG_XPL_BUILD) && \
> - (CONFIG_ROCKCHIP_SPL_RESERVE_IRAM > 0)
> +#if defined(CONFIG_SPL_BUILD) && (CONFIG_ROCKCHIP_SPL_RESERVE_IRAM > 0)
This was changed from SPL to XPL just to be changed back to SPL in this
patch?, such change probably just clutter git blame, was the change to
use XPL really necessary in the first place?
Because SPL_BUILD was used together with !TPL_BUILD it is pretty obvious
that SPL_BUILD did not need to change to XPL_BUILD in the first place.
> .space CONFIG_ROCKCHIP_SPL_RESERVE_IRAM /* space for the ATF data */
> #endif
> diff --git a/arch/arm/mach-rockchip/rk3399/rk3399.c b/arch/arm/mach-rockchip/rk3399/rk3399.c
> index edccb2a3980..47bcc71038b 100644
> --- a/arch/arm/mach-rockchip/rk3399/rk3399.c
> +++ b/arch/arm/mach-rockchip/rk3399/rk3399.c
> @@ -169,7 +169,7 @@ void board_debug_uart_init(void)
> }
> #endif
>
> -#if defined(CONFIG_XPL_BUILD) && !defined(CONFIG_TPL_BUILD)
> +#if defined(CONFIG_SPL_BUILD)
Same.
> static void rk3399_force_power_on_reset(void)
> {
> ofnode node;
> diff --git a/drivers/clk/rockchip/clk_rk3368.c b/drivers/clk/rockchip/clk_rk3368.c
> index 630253fbb1d..5ba19bce7b2 100644
> --- a/drivers/clk/rockchip/clk_rk3368.c
> +++ b/drivers/clk/rockchip/clk_rk3368.c
> @@ -50,7 +50,7 @@ struct pll_div {
> (_nr * _no) == hz, #hz "Hz cannot be hit with PLL " \
> "divisors on line " __stringify(__LINE__));
>
> -#if IS_ENABLED(CONFIG_XPL_BUILD) || IS_ENABLED(CONFIG_TPL_BUILD)
> +#if IS_ENABLED(CONFIG_XPL_BUILD)
> static const struct pll_div apll_l_init_cfg = PLL_DIVISORS(APLL_L_HZ, 12, 2);
> static const struct pll_div apll_b_init_cfg = PLL_DIVISORS(APLL_B_HZ, 1, 2);
> #if !defined(CONFIG_TPL_BUILD)
> @@ -88,7 +88,7 @@ static uint32_t rkclk_pll_get_rate(struct rk3368_cru *cru,
> }
> }
>
> -#if IS_ENABLED(CONFIG_XPL_BUILD) || IS_ENABLED(CONFIG_TPL_BUILD)
> +#if IS_ENABLED(CONFIG_XPL_BUILD)
> static int rkclk_set_pll(struct rk3368_cru *cru, enum rk3368_pll_id pll_id,
> const struct pll_div *div)
> {
> @@ -130,7 +130,7 @@ static int rkclk_set_pll(struct rk3368_cru *cru, enum rk3368_pll_id pll_id,
> }
> #endif
>
> -#if IS_ENABLED(CONFIG_XPL_BUILD) || IS_ENABLED(CONFIG_TPL_BUILD)
> +#if IS_ENABLED(CONFIG_XPL_BUILD)
> static void rkclk_init(struct rk3368_cru *cru)
> {
> u32 apllb, aplll, dpll, cpll, gpll;
> @@ -586,7 +586,7 @@ static int rk3368_clk_probe(struct udevice *dev)
>
> priv->cru = map_sysmem(plat->dtd.reg[0], plat->dtd.reg[1]);
> #endif
> -#if IS_ENABLED(CONFIG_XPL_BUILD) || IS_ENABLED(CONFIG_TPL_BUILD)
> +#if IS_ENABLED(CONFIG_XPL_BUILD)
> rkclk_init(priv->cru);
> #endif
>
> diff --git a/drivers/ram/rockchip/sdram_rk3288.c b/drivers/ram/rockchip/sdram_rk3288.c
> index 25ceab98ee9..b6d51068baa 100644
> --- a/drivers/ram/rockchip/sdram_rk3288.c
> +++ b/drivers/ram/rockchip/sdram_rk3288.c
> @@ -84,7 +84,7 @@ const int ddrconf_table[] = {
> #define DQS_GATE_TRAINING_ERROR_RANK1 (2 << 4)
>
> #if defined(CONFIG_TPL_BUILD) || \
> - (!defined(CONFIG_TPL) && defined(CONFIG_XPL_BUILD))
> + (!defined(CONFIG_TPL) && defined(CONFIG_SPL_BUILD))
Same.
> static void copy_to_reg(u32 *dest, const u32 *src, u32 n)
> {
> int i;
> @@ -1041,7 +1041,7 @@ static int conv_of_plat(struct udevice *dev)
> static int rk3288_dmc_probe(struct udevice *dev)
> {
> #if defined(CONFIG_TPL_BUILD) || \
> - (!defined(CONFIG_TPL) && defined(CONFIG_XPL_BUILD))
> + (!defined(CONFIG_TPL) && defined(CONFIG_SPL_BUILD))
Same.
> struct rk3288_sdram_params *plat = dev_get_plat(dev);
> struct udevice *dev_clk;
> struct regmap *map;
> @@ -1051,7 +1051,7 @@ static int rk3288_dmc_probe(struct udevice *dev)
>
> priv->pmu = syscon_get_first_range(ROCKCHIP_SYSCON_PMU);
> #if defined(CONFIG_TPL_BUILD) || \
> - (!defined(CONFIG_TPL) && defined(CONFIG_XPL_BUILD))
> + (!defined(CONFIG_TPL) && defined(CONFIG_SPL_BUILD))
Same.
> #if CONFIG_IS_ENABLED(OF_PLATDATA)
> ret = conv_of_plat(dev);
> if (ret)
> @@ -1119,13 +1119,13 @@ U_BOOT_DRIVER(rockchip_rk3288_dmc) = {
> .of_match = rk3288_dmc_ids,
> .ops = &rk3288_dmc_ops,
> #if defined(CONFIG_TPL_BUILD) || \
> - (!defined(CONFIG_TPL) && defined(CONFIG_XPL_BUILD))
> + (!defined(CONFIG_TPL) && defined(CONFIG_SPL_BUILD))
Same.
> .of_to_plat = rk3288_dmc_of_to_plat,
> #endif
> .probe = rk3288_dmc_probe,
> .priv_auto = sizeof(struct dram_info),
> #if defined(CONFIG_TPL_BUILD) || \
> - (!defined(CONFIG_TPL) && defined(CONFIG_XPL_BUILD))
> + (!defined(CONFIG_TPL) && defined(CONFIG_SPL_BUILD))
Same.
> .plat_auto = sizeof(struct rk3288_sdram_params),
> #endif
> };
> diff --git a/drivers/ram/rockchip/sdram_rk3399.c b/drivers/ram/rockchip/sdram_rk3399.c
> index c3745f9445b..45270e27184 100644
> --- a/drivers/ram/rockchip/sdram_rk3399.c
> +++ b/drivers/ram/rockchip/sdram_rk3399.c
> @@ -3196,7 +3196,7 @@ U_BOOT_DRIVER(dmc_rk3399) = {
> .probe = rk3399_dmc_probe,
> .priv_auto = sizeof(struct dram_info),
> #if defined(CONFIG_TPL_BUILD) || \
> - (!defined(CONFIG_TPL) && defined(CONFIG_XPL_BUILD))
> + (!defined(CONFIG_TPL) && defined(CONFIG_SPL_BUILD))
Same.
> .plat_auto = sizeof(struct rockchip_dmc_plat),
> #endif
> };
> diff --git a/drivers/ram/rockchip/sdram_rv1126.c b/drivers/ram/rockchip/sdram_rv1126.c
> index b371f597d23..58fd589f68e 100644
> --- a/drivers/ram/rockchip/sdram_rv1126.c
> +++ b/drivers/ram/rockchip/sdram_rv1126.c
> @@ -33,8 +33,7 @@
> #define DESKEW_MDF_DIFF_VAL (1)
>
> struct dram_info {
> -#if defined(CONFIG_TPL_BUILD) || \
> - (!defined(CONFIG_TPL) && defined(CONFIG_XPL_BUILD))
> +#if defined(CONFIG_TPL_BUILD) || defined(CONFIG_SPL_BUILD)
This changes meaning of the code, similar to other rockchip sdram code
this should only change CONFIG_XPL_BUILD back to CONFIG_SPL_BUILD.
DRAM on rockchip platform is initialized by TPL, or SPL when CONFIG_TPL
is not enabled, not both in TPL and SPL.
> void __iomem *pctl;
> void __iomem *phy;
> struct rv1126_cru *cru;
> @@ -48,8 +47,7 @@ struct dram_info {
> struct rv1126_pmugrf *pmugrf;
> };
>
> -#if defined(CONFIG_TPL_BUILD) || \
> - (!defined(CONFIG_TPL) && defined(CONFIG_XPL_BUILD))
> +#if defined(CONFIG_TPL_BUILD) || defined(CONFIG_SPL_BUILD)
Same.
>
> #define GRF_BASE_ADDR 0xfe000000
> #define PMU_GRF_BASE_ADDR 0xfe020000
> @@ -3506,8 +3504,7 @@ error:
>
> static int rv1126_dmc_probe(struct udevice *dev)
> {
> -#if defined(CONFIG_TPL_BUILD) || \
> - (!defined(CONFIG_TPL) && defined(CONFIG_XPL_BUILD))
> +#if defined(CONFIG_TPL_BUILD) || defined(CONFIG_SPL_BUILD)
Same.
Regards,
Jonas
> if (rv1126_dmc_init(dev))
> return 0;
> #else
More information about the U-Boot
mailing list