mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Xogium <contact@xogium.me>, Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 03/24] ARM: stm32mp: simplify with build_stm32mp_image macro
Date: Sun, 20 Feb 2022 13:47:15 +0100	[thread overview]
Message-ID: <20220220124736.3052502-4-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20220220124736.3052502-1-a.fatoum@pengutronix.de>

Reduce duplication by adding a common macro to get the four lines of
boilerplate down to a single line. No functional change.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 images/Makefile.stm32mp | 49 +++++++++++++++++------------------------
 1 file changed, 20 insertions(+), 29 deletions(-)

diff --git a/images/Makefile.stm32mp b/images/Makefile.stm32mp
index 17f03908b0d0..558f8c585984 100644
--- a/images/Makefile.stm32mp
+++ b/images/Makefile.stm32mp
@@ -9,35 +9,26 @@
 $(obj)/%.stm32: $(obj)/% FORCE
 	$(call if_changed,stm32_image)
 
-STM32MP1_OPTS = -a 0xc0100000 -e 0xc0100000 -v1
+define build_stm32mp_image =
+$(eval
+ifeq ($($(strip $(1))), y)
+	pblb-y += $(strip $(2))
+	FILE_barebox-$(strip $(3)).img    = $(strip $(2)).pblb.stm32
+	OPTS_$(strip $(2)).pblb.stm32 = -a 0xc0100000 -e 0xc0100000 -v1
+	image-y += barebox-$(strip $(3)).img
+endif
+)
+endef
 
 # --------------------------------------
 
-pblb-$(CONFIG_MACH_STM32MP15XX_DKX) += start_stm32mp15xx_dkx
-FILE_barebox-stm32mp15xx-dkx.img = start_stm32mp15xx_dkx.pblb.stm32
-OPTS_start_stm32mp15xx_dkx.pblb.stm32 = $(STM32MP1_OPTS)
-image-$(CONFIG_MACH_STM32MP15XX_DKX) += barebox-stm32mp15xx-dkx.img
-
-pblb-$(CONFIG_MACH_LXA_MC1) += start_stm32mp157c_lxa_mc1
-FILE_barebox-stm32mp157c-lxa-mc1.img = start_stm32mp157c_lxa_mc1.pblb.stm32
-OPTS_start_stm32mp157c_lxa_mc1.pblb.stm32 = $(STM32MP1_OPTS)
-image-$(CONFIG_MACH_LXA_MC1) += barebox-stm32mp157c-lxa-mc1.img
-
-pblb-$(CONFIG_MACH_PROTONIC_STM32MP1) += start_prtt1a start_prtt1s start_prtt1c
-FILE_barebox-prtt1a.img = start_prtt1a.pblb.stm32
-FILE_barebox-prtt1c.img = start_prtt1c.pblb.stm32
-FILE_barebox-prtt1s.img = start_prtt1s.pblb.stm32
-OPTS_start_prtt1a.pblb.stm32 = $(STM32MP1_OPTS)
-OPTS_start_prtt1c.pblb.stm32 = $(STM32MP1_OPTS)
-OPTS_start_prtt1s.pblb.stm32 = $(STM32MP1_OPTS)
-image-$(CONFIG_MACH_PROTONIC_STM32MP1) += barebox-prtt1a.img barebox-prtt1s.img barebox-prtt1c.img
-
-pblb-$(CONFIG_MACH_SEEED_ODYSSEY) += start_stm32mp157c_seeed_odyssey
-FILE_barebox-stm32mp157c-seeed-odyssey.img = start_stm32mp157c_seeed_odyssey.pblb.stm32
-OPTS_start_stm32mp157c_seeed_odyssey.pblb.stm32 = $(STM32MP1_OPTS)
-image-$(CONFIG_MACH_SEEED_ODYSSEY) += barebox-stm32mp157c-seeed-odyssey.img
-
-pblb-$(CONFIG_MACH_STM32MP15X_EV1) += start_stm32mp15x_ev1
-FILE_barebox-stm32mp15x-ev1.img = start_stm32mp15x_ev1.pblb.stm32
-OPTS_start_stm32mp15x_ev1.pblb.stm32 = $(STM32MP1_OPTS)
-image-$(CONFIG_MACH_STM32MP15X_EV1) += barebox-stm32mp15x-ev1.img
+$(call build_stm32mp_image, CONFIG_MACH_STM32MP15XX_DKX, start_stm32mp15xx_dkx, stm32mp15xx-dkx)
+$(call build_stm32mp_image, CONFIG_MACH_STM32MP15X_EV1, start_stm32mp15x_ev1, stm32mp15x-ev1)
+
+$(call build_stm32mp_image, CONFIG_MACH_LXA_MC1, start_stm32mp157c_lxa_mc1, stm32mp157c-lxa-mc1)
+
+$(call build_stm32mp_image, CONFIG_MACH_PROTONIC_STM32MP1, start_prtt1a, prtt1a)
+$(call build_stm32mp_image, CONFIG_MACH_PROTONIC_STM32MP1, start_prtt1s, prtt1s)
+$(call build_stm32mp_image, CONFIG_MACH_PROTONIC_STM32MP1, start_prtt1c, prtt1c)
+
+$(call build_stm32mp_image, CONFIG_MACH_SEEED_ODYSSEY, start_stm32mp157c_seeed_odyssey, stm32mp157c-seeed-odyssey)
-- 
2.30.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


  parent reply	other threads:[~2022-02-20 12:51 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-20 12:47 [PATCH 00/24] ARM: stm32mp: add trusted bootchain (SCMI&FIP) support Ahmad Fatoum
2022-02-20 12:47 ` [PATCH 01/24] PBL: fdt: factor reg property parsing into helper Ahmad Fatoum
2022-02-20 12:47 ` [PATCH 02/24] pinctrl: stm32: use gpio-ranges instead of alias Ahmad Fatoum
2022-02-20 12:47 ` Ahmad Fatoum [this message]
2022-02-20 12:47 ` [PATCH 04/24] ARM: stm32mp: change stm32image extension to .stm32 Ahmad Fatoum
2022-02-20 12:47 ` [PATCH 05/24] filetype: detect TF-A Firmware Image Packages (FIP) Ahmad Fatoum
2022-02-20 12:47 ` [PATCH 06/24] scripts: add tool to adjust bl33 load address in existing FIP Ahmad Fatoum
2022-02-20 12:47 ` [PATCH 07/24] ARM: stm32mp: build extra barebox-stm32mp-generic-bl33.img Ahmad Fatoum
2022-02-21 10:35   ` [PATCH] fixup! " Ahmad Fatoum
2022-02-20 12:47 ` [PATCH 08/24] ARM: stm32mp: ddrctrl: fix wrong register field widths Ahmad Fatoum
2022-02-20 12:47 ` [PATCH 09/24] reset: stm32: drop stm32mp1_reset_ops indirection Ahmad Fatoum
2022-02-20 12:47 ` [PATCH 10/24] reset: move stm32 reset code to drivers/power/reset Ahmad Fatoum
2022-02-20 12:47 ` [PATCH 11/24] ARM: smccc: sync header with upstream Ahmad Fatoum
2022-02-20 12:47 ` [PATCH 12/24] firmware: import Linux v5.13 SCMI support Ahmad Fatoum
2022-02-20 12:47 ` [PATCH 13/24] reset: add " Ahmad Fatoum
2022-02-20 12:47 ` [PATCH 14/24] clk: add SCMI clock driver Ahmad Fatoum
2022-02-20 12:47 ` [PATCH 15/24] regulator: add SCMI regulator driver Ahmad Fatoum
2022-02-20 12:47 ` [PATCH 16/24] clk: accept const arguments in clk_to_clk_hw/clk_hw_to_clk Ahmad Fatoum
2022-02-20 12:47 ` [PATCH 17/24] serial: stm32: bail if clock_get_rate returns zero Ahmad Fatoum
2022-02-20 12:47 ` [PATCH 18/24] clk: implement of_clk_hw_{onecell,simple}_get Ahmad Fatoum
2022-02-20 12:47 ` [PATCH 19/24] clk: implement clk_hw_reparent Ahmad Fatoum
2022-02-20 12:47 ` [PATCH 20/24] reset: add support for reset_control_status Ahmad Fatoum
2022-02-20 12:47 ` [PATCH 21/24] clk: stm32mp1: sync with Linux v5.17-rc1 Ahmad Fatoum
2022-02-21 10:35   ` [PATCH] fixup! " Ahmad Fatoum
2022-02-20 12:47 ` [PATCH 22/24] regulator: core: fall back to node name if no regulator-name property Ahmad Fatoum
2022-02-20 12:47 ` [PATCH 23/24] ARM: dts: stm32mp: remove regulator-name override in stm32mp151.dtsi Ahmad Fatoum
2022-02-20 12:47 ` [PATCH 24/24] ARM: stm32mp: enable more config options Ahmad Fatoum
2022-02-23 10:57 ` [PATCH 00/24] ARM: stm32mp: add trusted bootchain (SCMI&FIP) support Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220220124736.3052502-4-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=contact@xogium.me \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox