summaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2020-10-05 10:10:56 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2020-10-07 10:07:51 +0200
commita03af1e0b38bca202325f57b19f9a95cbbb7c4c5 (patch)
tree4bbdfd04371954bb4e93874bad90142c3f347f09 /arch/arm
parent2fb1c3da0636addb7b1fb9d016b861ff4fd9da8b (diff)
downloadbarebox-a03af1e0b38bca202325f57b19f9a95cbbb7c4c5.tar.gz
barebox-a03af1e0b38bca202325f57b19f9a95cbbb7c4c5.tar.xz
ARM: stm32mp: migrate board initcalls to board drivers
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> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/boards/lxa-mc1/board.c17
-rw-r--r--arch/arm/boards/seeed-odyssey/board.c18
-rw-r--r--arch/arm/boards/stm32mp157c-dk2/board.c18
3 files changed, 39 insertions, 14 deletions
diff --git a/arch/arm/boards/lxa-mc1/board.c b/arch/arm/boards/lxa-mc1/board.c
index 7f1f3ccd7e..9126973dcb 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 e3fe536873..8c011898a3 100644
--- a/arch/arm/boards/seeed-odyssey/board.c
+++ b/arch/arm/boards/seeed-odyssey/board.c
@@ -7,14 +7,11 @@
#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();
- 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);
@@ -29,4 +26,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 4636603121..a547209cdf 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);