* [PATCH 1/3] ARM: stm32mp: migrate board initcalls to board drivers
@ 2020-10-05 8:10 Ahmad Fatoum
2020-10-05 8:10 ` [PATCH 2/3] ARM: stm32mp: dk2: rename to dkx to make dk1 support clearer Ahmad Fatoum
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Ahmad Fatoum @ 2020-10-05 8:10 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
Board drivers are now the way to go. Migrate the STM32 boards to use it,
to encourage future copy-pasting in following suit.
As the board now supports both DK2 and DK1, rename the prefix to dkx_.
dk1 specifics follow in a separate commit.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
arch/arm/boards/lxa-mc1/board.c | 17 +++++++++++++----
arch/arm/boards/seeed-odyssey/board.c | 15 +++++++++++++--
arch/arm/boards/stm32mp157c-dk2/board.c | 18 +++++++++++++-----
3 files changed, 39 insertions(+), 11 deletions(-)
diff --git a/arch/arm/boards/lxa-mc1/board.c b/arch/arm/boards/lxa-mc1/board.c
index 7f1f3ccd7e06..9126973dcbdc 100644
--- a/arch/arm/boards/lxa-mc1/board.c
+++ b/arch/arm/boards/lxa-mc1/board.c
@@ -28,11 +28,9 @@ static int of_fixup_regulator_supply_disable(struct device_node *root, void *pat
return 0;
}
-static int mc1_device_init(void)
+static int mc1_probe(struct device_d *dev)
{
int flags;
- if (!of_machine_is_compatible("lxa,stm32mp157c-mc1"))
- return 0;
flags = bootsource_get_instance() == 0 ? BBU_HANDLER_FLAG_DEFAULT : 0;
stm32mp_bbu_mmc_register_handler("sd", "/dev/mmc0.ssbl", flags);
@@ -55,4 +53,15 @@ static int mc1_device_init(void)
*/
return of_register_fixup(of_fixup_regulator_supply_disable, "/regulator_3v3");
}
-device_initcall(mc1_device_init);
+
+static const struct of_device_id mc1_of_match[] = {
+ { .compatible = "lxa,stm32mp157c-mc1" },
+ { /* sentinel */ },
+};
+
+static struct driver_d mc1_board_driver = {
+ .name = "board-lxa-mc1",
+ .probe = mc1_probe,
+ .of_compatible = mc1_of_match,
+};
+device_platform_driver(mc1_board_driver);
diff --git a/arch/arm/boards/seeed-odyssey/board.c b/arch/arm/boards/seeed-odyssey/board.c
index e3fe5368731c..fd077c02b273 100644
--- a/arch/arm/boards/seeed-odyssey/board.c
+++ b/arch/arm/boards/seeed-odyssey/board.c
@@ -7,7 +7,7 @@
#include <bootsource.h>
#include <of.h>
-static int odyssey_device_init(void)
+static int odyssey_som_probe(struct device_d *dev)
{
int flags;
int instance = bootsource_get_instance();
@@ -29,4 +29,15 @@ static int odyssey_device_init(void)
return 0;
}
-device_initcall(odyssey_device_init);
+
+static const struct of_device_id odyssey_som_of_match[] = {
+ { .compatible = "seeed,stm32mp157c-odyssey-som" },
+ { /* sentinel */ },
+};
+
+static struct driver_d odyssey_som_driver = {
+ .name = "odyssey-som",
+ .probe = odyssey_som_probe,
+ .of_compatible = odyssey_som_of_match,
+};
+device_platform_driver(odyssey_som_driver);
diff --git a/arch/arm/boards/stm32mp157c-dk2/board.c b/arch/arm/boards/stm32mp157c-dk2/board.c
index 46366031218d..a547209cdf5e 100644
--- a/arch/arm/boards/stm32mp157c-dk2/board.c
+++ b/arch/arm/boards/stm32mp157c-dk2/board.c
@@ -3,11 +3,8 @@
#include <init.h>
#include <mach/bbu.h>
-static int dk2_postcore_init(void)
+static int dkx_probe(struct device_d *dev)
{
- if (!of_machine_is_compatible("st,stm32mp157c-dk2"))
- return 0;
-
stm32mp_bbu_mmc_register_handler("sd", "/dev/mmc0.ssbl",
BBU_HANDLER_FLAG_DEFAULT);
@@ -15,4 +12,15 @@ static int dk2_postcore_init(void)
return 0;
}
-postcore_initcall(dk2_postcore_init);
+
+static const struct of_device_id dkx_of_match[] = {
+ { .compatible = "st,stm32mp157c-dk2" },
+ { /* sentinel */ },
+};
+
+static struct driver_d dkx_board_driver = {
+ .name = "board-stm32mp15xx-dkx",
+ .probe = dkx_probe,
+ .of_compatible = dkx_of_match,
+};
+postcore_platform_driver(dkx_board_driver);
--
2.28.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/3] ARM: stm32mp: dk2: rename to dkx to make dk1 support clearer
2020-10-05 8:10 [PATCH 1/3] ARM: stm32mp: migrate board initcalls to board drivers Ahmad Fatoum
@ 2020-10-05 8:10 ` Ahmad Fatoum
2020-10-05 8:10 ` [PATCH 3/3] ARM: stm32mp: defconfig: enable more useful options Ahmad Fatoum
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Ahmad Fatoum @ 2020-10-05 8:10 UTC (permalink / raw)
To: barebox; +Cc: Holger Assmann, Ahmad Fatoum
As we now support both the stm32mp157a-dk1 and stm32mp157c-dk2 with
the same barebox image, we should call the board stm32mp15xx-dkx
instead. That's also how the upstream DTSI is named.
Suggested-by: Holger Assmann <has@pengutronix.de>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
Documentation/boards/stm32mp.rst | 2 +-
arch/arm/boards/Makefile | 2 +-
.../{stm32mp157c-dk2 => stm32mp15xx-dkx}/Makefile | 0
.../{stm32mp157c-dk2 => stm32mp15xx-dkx}/board.c | 10 ++++++++--
.../{stm32mp157c-dk2 => stm32mp15xx-dkx}/lowlevel.c | 2 +-
arch/arm/configs/stm32mp_defconfig | 2 +-
arch/arm/dts/Makefile | 2 +-
arch/arm/dts/stm32mp157a-dk1.dts | 2 +-
arch/arm/dts/stm32mp157c-dk2.dts | 2 +-
.../dts/{stm32mp157a-dk1.dtsi => stm32mp15xx-dkx.dtsi} | 0
arch/arm/mach-stm32mp/Kconfig | 7 +++++--
images/Makefile.stm32mp | 8 ++++----
12 files changed, 24 insertions(+), 15 deletions(-)
rename arch/arm/boards/{stm32mp157c-dk2 => stm32mp15xx-dkx}/Makefile (100%)
rename arch/arm/boards/{stm32mp157c-dk2 => stm32mp15xx-dkx}/board.c (65%)
rename arch/arm/boards/{stm32mp157c-dk2 => stm32mp15xx-dkx}/lowlevel.c (93%)
rename arch/arm/dts/{stm32mp157a-dk1.dtsi => stm32mp15xx-dkx.dtsi} (100%)
diff --git a/Documentation/boards/stm32mp.rst b/Documentation/boards/stm32mp.rst
index b235c399271d..a06578602d9d 100644
--- a/Documentation/boards/stm32mp.rst
+++ b/Documentation/boards/stm32mp.rst
@@ -29,7 +29,7 @@ The resulting images will be placed under ``images/``:
::
- barebox-stm32mp157c-dk2.img
+ barebox-stm32mp15xx-dkx.img # both DK1 and DK2
barebox-stm32mp157c-lxa-mc1.img
barebox-stm32mp157c-seeed-odyssey.img
diff --git a/arch/arm/boards/Makefile b/arch/arm/boards/Makefile
index 986ea7a983fa..9183da684b79 100644
--- a/arch/arm/boards/Makefile
+++ b/arch/arm/boards/Makefile
@@ -132,7 +132,7 @@ obj-$(CONFIG_MACH_SOCFPGA_TERASIC_DE0_NANO_SOC) += terasic-de0-nano-soc/
obj-$(CONFIG_MACH_SOCFPGA_TERASIC_SOCKIT) += terasic-sockit/
obj-$(CONFIG_MACH_SOLIDRUN_CUBOX) += solidrun-cubox/
obj-$(CONFIG_MACH_SOLIDRUN_MICROSOM) += solidrun-microsom/
-obj-$(CONFIG_MACH_STM32MP157C_DK2) += stm32mp157c-dk2/
+obj-$(CONFIG_MACH_STM32MP15XX_DKX) += stm32mp15xx-dkx/
obj-$(CONFIG_MACH_LXA_MC1) += lxa-mc1/
obj-$(CONFIG_MACH_TECHNEXION_PICO_HOBBIT) += technexion-pico-hobbit/
obj-$(CONFIG_MACH_TECHNEXION_WANDBOARD) += technexion-wandboard/
diff --git a/arch/arm/boards/stm32mp157c-dk2/Makefile b/arch/arm/boards/stm32mp15xx-dkx/Makefile
similarity index 100%
rename from arch/arm/boards/stm32mp157c-dk2/Makefile
rename to arch/arm/boards/stm32mp15xx-dkx/Makefile
diff --git a/arch/arm/boards/stm32mp157c-dk2/board.c b/arch/arm/boards/stm32mp15xx-dkx/board.c
similarity index 65%
rename from arch/arm/boards/stm32mp157c-dk2/board.c
rename to arch/arm/boards/stm32mp15xx-dkx/board.c
index a547209cdf5e..1ddfee698d84 100644
--- a/arch/arm/boards/stm32mp157c-dk2/board.c
+++ b/arch/arm/boards/stm32mp15xx-dkx/board.c
@@ -5,16 +5,22 @@
static int dkx_probe(struct device_d *dev)
{
+ const void *model;
+
stm32mp_bbu_mmc_register_handler("sd", "/dev/mmc0.ssbl",
BBU_HANDLER_FLAG_DEFAULT);
- barebox_set_model("STM32MP157C-DK2");
+ if (dev_get_drvdata(dev, &model) == 0)
+ barebox_set_model(model);
+
+ barebox_set_hostname("stm32mp15xx-dkx");
return 0;
}
static const struct of_device_id dkx_of_match[] = {
- { .compatible = "st,stm32mp157c-dk2" },
+ { .compatible = "st,stm32mp157a-dk1", .data = "STM32MP157A-DK1" },
+ { .compatible = "st,stm32mp157c-dk2", .data = "STM32MP157C-DK2" },
{ /* sentinel */ },
};
diff --git a/arch/arm/boards/stm32mp157c-dk2/lowlevel.c b/arch/arm/boards/stm32mp15xx-dkx/lowlevel.c
similarity index 93%
rename from arch/arm/boards/stm32mp157c-dk2/lowlevel.c
rename to arch/arm/boards/stm32mp15xx-dkx/lowlevel.c
index d79bfa4f4d01..65f4bbb4dafd 100644
--- a/arch/arm/boards/stm32mp157c-dk2/lowlevel.c
+++ b/arch/arm/boards/stm32mp15xx-dkx/lowlevel.c
@@ -13,7 +13,7 @@ static void setup_uart(void)
putc_ll('>');
}
-ENTRY_FUNCTION(start_stm32mp157c_dk2, r0, r1, r2)
+ENTRY_FUNCTION(start_stm32mp15xx_dkx, r0, r1, r2)
{
void *fdt;
u32 cputype;
diff --git a/arch/arm/configs/stm32mp_defconfig b/arch/arm/configs/stm32mp_defconfig
index 92bdf5b04083..870d47739bdf 100644
--- a/arch/arm/configs/stm32mp_defconfig
+++ b/arch/arm/configs/stm32mp_defconfig
@@ -1,5 +1,5 @@
CONFIG_ARCH_STM32MP=y
-CONFIG_MACH_STM32MP157C_DK2=y
+CONFIG_MACH_STM32MP15XX_DKX=y
CONFIG_MACH_LXA_MC1=y
CONFIG_MACH_SEEED_ODYSSEY=y
CONFIG_THUMB2_BAREBOX=y
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 376e8f0fa0db..fedcb0e29a93 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -111,7 +111,7 @@ lwl-$(CONFIG_MACH_SOLIDRUN_MICROSOM) += imx6dl-hummingboard.dtb.o imx6q-hummingb
imx6dl-hummingboard2.dtb.o imx6q-hummingboard2.dtb.o \
imx6q-h100.dtb.o
lwl-$(CONFIG_MACH_SEEED_ODYSSEY) += stm32mp157c-odyssey.dtb.o
-lwl-$(CONFIG_MACH_STM32MP157C_DK2) += stm32mp157c-dk2.dtb.o stm32mp157a-dk1.dtb.o
+lwl-$(CONFIG_MACH_STM32MP15XX_DKX) += stm32mp157c-dk2.dtb.o stm32mp157a-dk1.dtb.o
lwl-$(CONFIG_MACH_LXA_MC1) += stm32mp157c-lxa-mc1.dtb.o
lwl-$(CONFIG_MACH_SCB9328) += imx1-scb9328.dtb.o
lwl-$(CONFIG_MACH_TECHNEXION_WANDBOARD) += imx6q-wandboard.dtb.o imx6dl-wandboard.dtb.o
diff --git a/arch/arm/dts/stm32mp157a-dk1.dts b/arch/arm/dts/stm32mp157a-dk1.dts
index f2cafae66b9b..7a907cc31446 100644
--- a/arch/arm/dts/stm32mp157a-dk1.dts
+++ b/arch/arm/dts/stm32mp157a-dk1.dts
@@ -5,4 +5,4 @@
*/
#include <arm/stm32mp157a-dk1.dts>
-#include "stm32mp157a-dk1.dtsi"
+#include "stm32mp15xx-dkx.dtsi"
diff --git a/arch/arm/dts/stm32mp157c-dk2.dts b/arch/arm/dts/stm32mp157c-dk2.dts
index 6e73162ea4bd..98525abd71fb 100644
--- a/arch/arm/dts/stm32mp157c-dk2.dts
+++ b/arch/arm/dts/stm32mp157c-dk2.dts
@@ -5,4 +5,4 @@
*/
#include <arm/stm32mp157c-dk2.dts>
-#include "stm32mp157a-dk1.dtsi"
+#include "stm32mp15xx-dkx.dtsi"
diff --git a/arch/arm/dts/stm32mp157a-dk1.dtsi b/arch/arm/dts/stm32mp15xx-dkx.dtsi
similarity index 100%
rename from arch/arm/dts/stm32mp157a-dk1.dtsi
rename to arch/arm/dts/stm32mp15xx-dkx.dtsi
diff --git a/arch/arm/mach-stm32mp/Kconfig b/arch/arm/mach-stm32mp/Kconfig
index f064a38088f4..b8ccbaab6702 100644
--- a/arch/arm/mach-stm32mp/Kconfig
+++ b/arch/arm/mach-stm32mp/Kconfig
@@ -8,9 +8,12 @@ config ARCH_STM32MP157
select ARM_PSCI_CLIENT
bool
-config MACH_STM32MP157C_DK2
+config MACH_STM32MP15XX_DKX
select ARCH_STM32MP157
- bool "STM32MP157C-DK2 board"
+ bool "STM32MP157 DK1 and DK2 boards"
+ help
+ builds a single barebox-stm32mp15xx-dkx.img that can be deployed
+ as SSBL on both the stm32mp157a-dk1 and stm32mp157c-dk2
config MACH_LXA_MC1
select ARCH_STM32MP157
diff --git a/images/Makefile.stm32mp b/images/Makefile.stm32mp
index 1330a7ef3d71..eafe84a72185 100644
--- a/images/Makefile.stm32mp
+++ b/images/Makefile.stm32mp
@@ -13,10 +13,10 @@ STM32MP1_OPTS = -a 0xc0100000 -e 0xc0100000 -v1
# --------------------------------------
-pblb-$(CONFIG_MACH_STM32MP157C_DK2) += start_stm32mp157c_dk2
-FILE_barebox-stm32mp157c-dk2.img = start_stm32mp157c_dk2.pblb.stm32
-OPTS_start_stm32mp157c_dk2.pblb.stm32 = $(STM32MP1_OPTS)
-image-$(CONFIG_MACH_STM32MP157C_DK2) += barebox-stm32mp157c-dk2.img
+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
--
2.28.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 3/3] ARM: stm32mp: defconfig: enable more useful options
2020-10-05 8:10 [PATCH 1/3] ARM: stm32mp: migrate board initcalls to board drivers Ahmad Fatoum
2020-10-05 8:10 ` [PATCH 2/3] ARM: stm32mp: dk2: rename to dkx to make dk1 support clearer Ahmad Fatoum
@ 2020-10-05 8:10 ` Ahmad Fatoum
2020-10-05 9:39 ` [PATCH] fixup! ARM: stm32mp: migrate board initcalls to board drivers Ahmad Fatoum
2020-10-07 8:08 ` [PATCH 1/3] " Sascha Hauer
3 siblings, 0 replies; 5+ messages in thread
From: Ahmad Fatoum @ 2020-10-05 8:10 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
Improve coverage by enabling more common code. Users will tweak the
defconfig and cut it down anyway.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
arch/arm/configs/stm32mp_defconfig | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/arch/arm/configs/stm32mp_defconfig b/arch/arm/configs/stm32mp_defconfig
index 870d47739bdf..e9f89e69d969 100644
--- a/arch/arm/configs/stm32mp_defconfig
+++ b/arch/arm/configs/stm32mp_defconfig
@@ -12,7 +12,6 @@ CONFIG_MALLOC_TLSF=y
CONFIG_KALLSYMS=y
CONFIG_RELOCATABLE=y
CONFIG_HUSH_FANCY_PROMPT=y
-CONFIG_CMDLINE_EDITING=y
CONFIG_AUTO_COMPLETE=y
CONFIG_MENU=y
CONFIG_BOOTM_SHOW_TYPE=y
@@ -24,10 +23,14 @@ CONFIG_BLSPEC=y
CONFIG_CONSOLE_ACTIVATE_NONE=y
CONFIG_CONSOLE_ALLOW_COLOR=y
CONFIG_PBL_CONSOLE=y
+CONFIG_CONSOLE_RATP=y
+CONFIG_RATP_CMD_I2C=y
+CONFIG_RATP_CMD_GPIO=y
CONFIG_PARTITION_DISK_EFI=y
# CONFIG_PARTITION_DISK_EFI_GPT_NO_FORCE is not set
# CONFIG_PARTITION_DISK_EFI_GPT_COMPARE is not set
CONFIG_DEFAULT_ENVIRONMENT_GENERIC_NEW=y
+CONFIG_DEFAULT_ENVIRONMENT_GENERIC_NEW_REBOOT_MODE=y
CONFIG_RESET_SOURCE=y
CONFIG_CMD_DMESG=y
CONFIG_LONGHELP=y
@@ -83,10 +86,12 @@ CONFIG_CMD_BAREBOX_UPDATE=y
CONFIG_CMD_OF_DIFF=y
CONFIG_CMD_OF_NODE=y
CONFIG_CMD_OF_PROPERTY=y
+CONFIG_CMD_OF_OVERLAY=y
CONFIG_CMD_OFTREE=y
CONFIG_CMD_TIME=y
CONFIG_NET=y
CONFIG_NET_NETCONSOLE=y
+CONFIG_NET_FASTBOOT=y
CONFIG_OFDEVICE=y
CONFIG_OF_BAREBOX_DRIVERS=y
CONFIG_DRIVER_SERIAL_STM32=y
@@ -111,6 +116,7 @@ CONFIG_LED=y
CONFIG_LED_GPIO=y
CONFIG_LED_PWM=y
CONFIG_LED_GPIO_OF=y
+CONFIG_LED_TRIGGERS=y
CONFIG_EEPROM_AT24=y
CONFIG_KEYBOARD_GPIO=y
CONFIG_INPUT_SPECIALKEYS=y
@@ -132,11 +138,17 @@ CONFIG_STM32_REMOTEPROC=y
CONFIG_RESET_STM32=y
CONFIG_GENERIC_PHY=y
CONFIG_PHY_STM32_USBPHYC=y
+CONFIG_SYSCON_REBOOT_MODE=y
CONFIG_FS_EXT4=y
CONFIG_FS_TFTP=y
CONFIG_FS_NFS=y
CONFIG_FS_FAT=y
CONFIG_FS_FAT_WRITE=y
CONFIG_FS_FAT_LFN=y
+CONFIG_FS_PSTORE=y
+CONFIG_FS_PSTORE_CONSOLE=y
+CONFIG_FS_PSTORE_RAMOOPS=y
+CONFIG_FS_SQUASHFS=y
+CONFIG_FS_RATP=y
CONFIG_ZLIB=y
CONFIG_CRC8=y
--
2.28.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] fixup! ARM: stm32mp: migrate board initcalls to board drivers
2020-10-05 8:10 [PATCH 1/3] ARM: stm32mp: migrate board initcalls to board drivers Ahmad Fatoum
2020-10-05 8:10 ` [PATCH 2/3] ARM: stm32mp: dk2: rename to dkx to make dk1 support clearer Ahmad Fatoum
2020-10-05 8:10 ` [PATCH 3/3] ARM: stm32mp: defconfig: enable more useful options Ahmad Fatoum
@ 2020-10-05 9:39 ` Ahmad Fatoum
2020-10-07 8:08 ` [PATCH 1/3] " Sascha Hauer
3 siblings, 0 replies; 5+ messages in thread
From: Ahmad Fatoum @ 2020-10-05 9:39 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
Driver code know does the compatible check for us, so drop the
no longer needed explicit check.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
arch/arm/boards/seeed-odyssey/board.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/arch/arm/boards/seeed-odyssey/board.c b/arch/arm/boards/seeed-odyssey/board.c
index fd077c02b273..8c011898a33e 100644
--- a/arch/arm/boards/seeed-odyssey/board.c
+++ b/arch/arm/boards/seeed-odyssey/board.c
@@ -12,9 +12,6 @@ static int odyssey_som_probe(struct device_d *dev)
int flags;
int instance = bootsource_get_instance();
- if (!of_machine_is_compatible("seeed,stm32mp157c-odyssey-som"))
- return 0;
-
flags = instance == 0 ? BBU_HANDLER_FLAG_DEFAULT : 0;
stm32mp_bbu_mmc_register_handler("sd", "/dev/mmc0.ssbl", flags);
--
2.28.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/3] ARM: stm32mp: migrate board initcalls to board drivers
2020-10-05 8:10 [PATCH 1/3] ARM: stm32mp: migrate board initcalls to board drivers Ahmad Fatoum
` (2 preceding siblings ...)
2020-10-05 9:39 ` [PATCH] fixup! ARM: stm32mp: migrate board initcalls to board drivers Ahmad Fatoum
@ 2020-10-07 8:08 ` Sascha Hauer
3 siblings, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2020-10-07 8:08 UTC (permalink / raw)
To: Ahmad Fatoum; +Cc: barebox
On Mon, Oct 05, 2020 at 10:10:56AM +0200, Ahmad Fatoum wrote:
> Board drivers are now the way to go. Migrate the STM32 boards to use it,
> to encourage future copy-pasting in following suit.
>
> As the board now supports both DK2 and DK1, rename the prefix to dkx_.
> dk1 specifics follow in a separate commit.
>
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
> arch/arm/boards/lxa-mc1/board.c | 17 +++++++++++++----
> arch/arm/boards/seeed-odyssey/board.c | 15 +++++++++++++--
> arch/arm/boards/stm32mp157c-dk2/board.c | 18 +++++++++++++-----
> 3 files changed, 39 insertions(+), 11 deletions(-)
Applied, thanks
Sascha
>
> diff --git a/arch/arm/boards/lxa-mc1/board.c b/arch/arm/boards/lxa-mc1/board.c
> index 7f1f3ccd7e06..9126973dcbdc 100644
> --- a/arch/arm/boards/lxa-mc1/board.c
> +++ b/arch/arm/boards/lxa-mc1/board.c
> @@ -28,11 +28,9 @@ static int of_fixup_regulator_supply_disable(struct device_node *root, void *pat
> return 0;
> }
>
> -static int mc1_device_init(void)
> +static int mc1_probe(struct device_d *dev)
> {
> int flags;
> - if (!of_machine_is_compatible("lxa,stm32mp157c-mc1"))
> - return 0;
>
> flags = bootsource_get_instance() == 0 ? BBU_HANDLER_FLAG_DEFAULT : 0;
> stm32mp_bbu_mmc_register_handler("sd", "/dev/mmc0.ssbl", flags);
> @@ -55,4 +53,15 @@ static int mc1_device_init(void)
> */
> return of_register_fixup(of_fixup_regulator_supply_disable, "/regulator_3v3");
> }
> -device_initcall(mc1_device_init);
> +
> +static const struct of_device_id mc1_of_match[] = {
> + { .compatible = "lxa,stm32mp157c-mc1" },
> + { /* sentinel */ },
> +};
> +
> +static struct driver_d mc1_board_driver = {
> + .name = "board-lxa-mc1",
> + .probe = mc1_probe,
> + .of_compatible = mc1_of_match,
> +};
> +device_platform_driver(mc1_board_driver);
> diff --git a/arch/arm/boards/seeed-odyssey/board.c b/arch/arm/boards/seeed-odyssey/board.c
> index e3fe5368731c..fd077c02b273 100644
> --- a/arch/arm/boards/seeed-odyssey/board.c
> +++ b/arch/arm/boards/seeed-odyssey/board.c
> @@ -7,7 +7,7 @@
> #include <bootsource.h>
> #include <of.h>
>
> -static int odyssey_device_init(void)
> +static int odyssey_som_probe(struct device_d *dev)
> {
> int flags;
> int instance = bootsource_get_instance();
> @@ -29,4 +29,15 @@ static int odyssey_device_init(void)
>
> return 0;
> }
> -device_initcall(odyssey_device_init);
> +
> +static const struct of_device_id odyssey_som_of_match[] = {
> + { .compatible = "seeed,stm32mp157c-odyssey-som" },
> + { /* sentinel */ },
> +};
> +
> +static struct driver_d odyssey_som_driver = {
> + .name = "odyssey-som",
> + .probe = odyssey_som_probe,
> + .of_compatible = odyssey_som_of_match,
> +};
> +device_platform_driver(odyssey_som_driver);
> diff --git a/arch/arm/boards/stm32mp157c-dk2/board.c b/arch/arm/boards/stm32mp157c-dk2/board.c
> index 46366031218d..a547209cdf5e 100644
> --- a/arch/arm/boards/stm32mp157c-dk2/board.c
> +++ b/arch/arm/boards/stm32mp157c-dk2/board.c
> @@ -3,11 +3,8 @@
> #include <init.h>
> #include <mach/bbu.h>
>
> -static int dk2_postcore_init(void)
> +static int dkx_probe(struct device_d *dev)
> {
> - if (!of_machine_is_compatible("st,stm32mp157c-dk2"))
> - return 0;
> -
> stm32mp_bbu_mmc_register_handler("sd", "/dev/mmc0.ssbl",
> BBU_HANDLER_FLAG_DEFAULT);
>
> @@ -15,4 +12,15 @@ static int dk2_postcore_init(void)
>
> return 0;
> }
> -postcore_initcall(dk2_postcore_init);
> +
> +static const struct of_device_id dkx_of_match[] = {
> + { .compatible = "st,stm32mp157c-dk2" },
> + { /* sentinel */ },
> +};
> +
> +static struct driver_d dkx_board_driver = {
> + .name = "board-stm32mp15xx-dkx",
> + .probe = dkx_probe,
> + .of_compatible = dkx_of_match,
> +};
> +postcore_platform_driver(dkx_board_driver);
> --
> 2.28.0
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-10-07 8:08 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-05 8:10 [PATCH 1/3] ARM: stm32mp: migrate board initcalls to board drivers Ahmad Fatoum
2020-10-05 8:10 ` [PATCH 2/3] ARM: stm32mp: dk2: rename to dkx to make dk1 support clearer Ahmad Fatoum
2020-10-05 8:10 ` [PATCH 3/3] ARM: stm32mp: defconfig: enable more useful options Ahmad Fatoum
2020-10-05 9:39 ` [PATCH] fixup! ARM: stm32mp: migrate board initcalls to board drivers Ahmad Fatoum
2020-10-07 8:08 ` [PATCH 1/3] " Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox