* [PATCH 1/2] drm/bridge: lt9611uxc: read the flash back in read mode
2026-11-24 23:13 [PATCH 0/2] drm/bridge: lt9611uxc: fix firmware update verification Dmitry Baryshkov
@ 2026-11-24 23:13 ` Dmitry Baryshkov
2026-11-24 23:13 ` [PATCH 2/2] drm/bridge: lt9611uxc: report a failed firmware update as a failure Dmitry Baryshkov
2026-11-27 17:11 ` [PATCH 0/2] drm/bridge: lt9611uxc: fix firmware update verification Luca Ceresoli
2 siblings, 0 replies; 4+ messages in thread
From: Dmitry Baryshkov @ 2026-11-24 23:13 UTC (permalink / raw)
To: Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
Jonas Karlman, Jernej Skrabec, Luca Ceresoli, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
Sam Ravnborg, Dmitry Baryshkov
Cc: dri-devel, linux-kernel
After flashing the firmware the driver reads the flash back to verify
it, but the read-back never switches the flash controller from the
write setup (0x5e = 0xdf) to reading (0x5e = 0x5f), so the data it
gets does not match what is in the flash. On an SM8350-HDK the
read-back differed from the image although the bridge came up with
the new firmware afterwards.
Set 0x5e to 0x5f before each page read, as the vendor driver does.
Fixes: 0cbbd5b1a012 ("drm: bridge: add support for lontium LT9611UXC bridge")
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
---
drivers/gpu/drm/bridge/lontium-lt9611uxc.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/gpu/drm/bridge/lontium-lt9611uxc.c b/drivers/gpu/drm/bridge/lontium-lt9611uxc.c
index b3bb7f2cebb3..6a7d479e86f6 100644
--- a/drivers/gpu/drm/bridge/lontium-lt9611uxc.c
+++ b/drivers/gpu/drm/bridge/lontium-lt9611uxc.c
@@ -587,6 +587,7 @@ static void lt9611uxc_firmware_write_page(struct lt9611uxc *lt9611uxc, u16 addr,
static void lt9611uxc_firmware_read_page(struct lt9611uxc *lt9611uxc, u16 addr, char *buf)
{
struct reg_sequence seq_read_page[] = {
+ REG_SEQ0(0x805e, 0x5f),
REG_SEQ0(0x805a, 0xa0),
REG_SEQ0(0x805a, 0x80),
REG_SEQ0(0x805b, (addr >> 16) & 0xff),
--
2.47.3
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH 2/2] drm/bridge: lt9611uxc: report a failed firmware update as a failure
2026-11-24 23:13 [PATCH 0/2] drm/bridge: lt9611uxc: fix firmware update verification Dmitry Baryshkov
2026-11-24 23:13 ` [PATCH 1/2] drm/bridge: lt9611uxc: read the flash back in read mode Dmitry Baryshkov
@ 2026-11-24 23:13 ` Dmitry Baryshkov
2026-11-27 17:11 ` [PATCH 0/2] drm/bridge: lt9611uxc: fix firmware update verification Luca Ceresoli
2 siblings, 0 replies; 4+ messages in thread
From: Dmitry Baryshkov @ 2026-11-24 23:13 UTC (permalink / raw)
To: Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
Jonas Karlman, Jernej Skrabec, Luca Ceresoli, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
Sam Ravnborg, Dmitry Baryshkov
Cc: dri-devel, linux-kernel
The check after flashing is inverted: memcmp() returns 0 when the read
back matches the image, so a good update is reported as "Firmware
update failed", with a hex dump and -EINVAL to the sysfs writer (and a
failed probe-time update for a blank chip), while a mismatch is
reported as success.
Treat a mismatch as the failure.
Fixes: 0cbbd5b1a012 ("drm: bridge: add support for lontium LT9611UXC bridge")
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
---
drivers/gpu/drm/bridge/lontium-lt9611uxc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/bridge/lontium-lt9611uxc.c b/drivers/gpu/drm/bridge/lontium-lt9611uxc.c
index 6a7d479e86f6..8992222c6a5a 100644
--- a/drivers/gpu/drm/bridge/lontium-lt9611uxc.c
+++ b/drivers/gpu/drm/bridge/lontium-lt9611uxc.c
@@ -691,7 +691,7 @@ static int lt9611uxc_firmware_update(struct lt9611uxc *lt9611uxc)
goto out;
}
- if (!memcmp(readbuf, fw->data, fw->size)) {
+ if (memcmp(readbuf, fw->data, fw->size)) {
dev_err(lt9611uxc->dev, "Firmware update failed\n");
print_hex_dump(KERN_ERR, "fw: ", DUMP_PREFIX_OFFSET, 16, 1, readbuf, fw->size, false);
ret = -EINVAL;
--
2.47.3
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH 0/2] drm/bridge: lt9611uxc: fix firmware update verification
2026-11-24 23:13 [PATCH 0/2] drm/bridge: lt9611uxc: fix firmware update verification Dmitry Baryshkov
2026-11-24 23:13 ` [PATCH 1/2] drm/bridge: lt9611uxc: read the flash back in read mode Dmitry Baryshkov
2026-11-24 23:13 ` [PATCH 2/2] drm/bridge: lt9611uxc: report a failed firmware update as a failure Dmitry Baryshkov
@ 2026-11-27 17:11 ` Luca Ceresoli
2 siblings, 0 replies; 4+ messages in thread
From: Luca Ceresoli @ 2026-11-27 17:11 UTC (permalink / raw)
To: Dmitry Baryshkov, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Luca Ceresoli,
Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
David Airlie, Simona Vetter, Sam Ravnborg, Dmitry Baryshkov
Cc: dri-devel, linux-kernel
On Wed Nov 25, 2026 at 12:13 AM CET, Dmitry Baryshkov wrote:
> The firmware update verifies the flash backwards: it reports a failure
> when the read-back matches the image and success when it does not. The
> read-back itself is also broken, as it never switches the flash into
> read mode. Updating an SM8350-HDK bridge from firmware 0x41 to 0x43
> printed "updates successfully" even though the comparison had failed.
>
> Fix both.
Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 4+ messages in thread