diff options
author | Oleksij Rempel <o.rempel@pengutronix.de> | 2022-02-03 11:45:47 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2022-02-07 09:05:12 +0100 |
commit | 7acb9c143cd173463e7c7e8dc3ae9c58b6060965 (patch) | |
tree | 087d52019d8ae8e7bf63caf800819ee8492d4a19 /arch/arm | |
parent | bfa76583c12407d9ef8cf59e02b95297ec19f845 (diff) | |
download | barebox-7acb9c143cd173463e7c7e8dc3ae9c58b6060965.tar.gz barebox-7acb9c143cd173463e7c7e8dc3ae9c58b6060965.tar.xz |
ARM: rpi: convert board code to a driver
Convert board code to a driver model. This will prevent executing this
part of code on any other BCM2xxx based boards.
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Link: https://lore.barebox.org/20220203104552.3158202-2-o.rempel@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/boards/raspberry-pi/rpi-common.c | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/arch/arm/boards/raspberry-pi/rpi-common.c b/arch/arm/boards/raspberry-pi/rpi-common.c index 2684bd5ed7..247d12467a 100644 --- a/arch/arm/boards/raspberry-pi/rpi-common.c +++ b/arch/arm/boards/raspberry-pi/rpi-common.c @@ -511,7 +511,7 @@ static void rpi_vc_fdt(void) } } -static int rpi_devices_init(void) +static int rpi_devices_probe(struct device_d *dev) { struct regulator *reg; @@ -529,4 +529,33 @@ static int rpi_devices_init(void) return 0; } -late_initcall(rpi_devices_init); + +static const struct of_device_id rpi_of_match[] = { + /* BCM2835 based Boards */ + { .compatible = "raspberrypi,model-a" }, + { .compatible = "raspberrypi,model-a-plus" }, + { .compatible = "raspberrypi,model-b" }, + /* Raspberry Pi Model B (no P5) */ + { .compatible = "raspberrypi,model-b-i2c0" }, + { .compatible = "raspberrypi,model-b-rev2" }, + { .compatible = "raspberrypi,model-b-plus" }, + { .compatible = "raspberrypi,compute-module" }, + { .compatible = "raspberrypi,model-zero" }, + { .compatible = "raspberrypi,model-zero-w" }, + + /* BCM2836 based Boards */ + { .compatible = "raspberrypi,2-model-b" }, + + /* BCM2837 based Boards */ + { .compatible = "raspberrypi,3-model-a-plus" }, + { .compatible = "raspberrypi,3-model-b" }, + { .compatible = "raspberrypi,3-model-b-plus" }, + { /* sentinel */ }, +}; + +static struct driver_d rpi_board_driver = { + .name = "board-rpi", + .probe = rpi_devices_probe, + .of_compatible = DRV_OF_COMPAT(rpi_of_match), +}; +late_platform_driver(rpi_board_driver); |