1
0
mirror of https://github.com/home-assistant/operating-system.git synced 2025-12-19 18:08:29 +00:00
Files
operating-system/buildroot-external/board/raspberrypi/patches/linux/0005-misc-rp1-pio-Error-out-on-incompatible-firmware.patch
Jan Čermák 5e9c47a318 Backport RPi patches for PIO/RP1 firmware probing errors (#3972)
One of the reason for failures after update to OS 15.0 was missing support for
the kernel PIO driver in EEPROM firmware. Backport upstream patches from
raspberrypi/linux#6645 and raspberrypi/linux#6642 that handle this situation
more gracefully. These patches could be dropped after the next RPi kernel
release.

Refs #3943
2025-03-26 16:26:44 +01:00

45 lines
1.6 KiB
Diff

From ab1d73e2b5101689fcd1737e588119b4fde3a5ff Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.com>
Date: Mon, 3 Feb 2025 14:44:08 +0000
Subject: [PATCH] misc: rp1-pio: Error out on incompatible firmware
If the RP1 firmware has reported an error then return that from the PIO
probe function, otherwise defer the probing.
Link: https://github.com/raspberrypi/linux/issues/6642
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
---
drivers/misc/rp1-pio.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/drivers/misc/rp1-pio.c b/drivers/misc/rp1-pio.c
index dbf69279e313d..7e875811509f8 100644
--- a/drivers/misc/rp1-pio.c
+++ b/drivers/misc/rp1-pio.c
@@ -1268,8 +1268,10 @@ static int rp1_pio_probe(struct platform_device *pdev)
return dev_err_probe(dev, pdev->id, "alias is missing\n");
fw = devm_rp1_firmware_get(dev, dev->of_node);
- if (IS_ERR_OR_NULL(fw))
- return dev_err_probe(dev, -ENOENT, "failed to contact RP1 firmware\n");
+ if (!fw)
+ return dev_err_probe(dev, -EPROBE_DEFER, "failed to find RP1 firmware driver\n");
+ if (IS_ERR(fw))
+ return dev_err_probe(dev, PTR_ERR(fw), "failed to contact RP1 firmware\n");
ret = rp1_firmware_get_feature(fw, FOURCC_PIO, &op_base, &op_count);
if (ret < 0)
return ret;
@@ -1346,6 +1348,11 @@ static void rp1_pio_remove(struct platform_device *pdev)
if (g_pio == pio)
g_pio = NULL;
+
+ device_destroy(pio->dev_class, pio->dev_num);
+ cdev_del(&pio->cdev);
+ class_destroy(pio->dev_class);
+ unregister_chrdev_region(pio->dev_num, 1);
}
static const struct of_device_id rp1_pio_ids[] = {