Re: [PATCH net-next 9/9] net: pse-pd: Add PD692x0 PSE controller driver

From: Köry Maincent
Date: Mon Nov 27 2023 - 12:28:27 EST


On Wed, 22 Nov 2023 18:11:25 +0100
Andrew Lunn <andrew@xxxxxxx> wrote:

> > > Is the firmware in Motorola SREC format? I thought the kernel had a
> > > helper for that, but a quick search did not find it. So maybe i'm
> > > remembering wrongly. But it seems silly for every driver to implement
> > > an SREC parser.
> >
> > Oh, I didn't know this format.
>
> Its often used in small deeply embedded systems. Microcontrollers,
> rather than something which can run Linux.
>
> > The firmware seems indeed to match this format
> > specification.
> > I found two reference of this Firmware format in the kernel:
> > https://elixir.bootlin.com/linux/v6.5.7/source/sound/soc/codecs/zl38060.c#L178
> > https://elixir.bootlin.com/linux/v6.5.7/source/drivers/staging/wlan-ng/prism2fw.c
> >
>
> Ah, all inside a header file. Probably why i missed it. But ihex is
> not SREC. ihex came from Intel. SREC from Motorola.
>
> So i would follow the basic flow in include/linux/ihex.h, add an
> include/linux/srec.h but adapt it for SREC.

In fact the ihex.h header is only adding the ihex_validate_fw and the
request_ihex_firmware functions. In my case I do not use request firmware but
sysfs firmware loader. I could add srec_validate_fw but I am already
checking the firmware during the flashing process due to its special flashing
process.
I could not treat the firmware to one blob to be send. Each byte need to be
send in one i2c messages and at the end of eaxch line we need to wait a "\r\n"
(within 30ms) before sending next line. Yes, it takes time to be flashed!

Do you see generic helper that I could add?

Regards,
--
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com