hats icon indicating copy to clipboard operation
hats copied to clipboard

eeprom-format: Add support to configure GPIO bank 1

Open iluminat23 opened this issue 3 years ago • 7 comments

The GPIO bank 1 is available on CM1/CM3/CM3+ and CM4S devices. On these devices an ID EEPROM can be used to get all available GPIOs in a defined state before the operating system takes over.

This is a RFC, if you might be willing to implement this or something similar in the bootloader code. We will provide the implementation to the eepromutils if you have no objections to these changes.

iluminat23 avatar Oct 13 '22 10:10 iluminat23

GPIO_BANK1 will have to be type 0x0005 - 0x0004 is the custom blob - but otherwise it's looking plausible. I've had a look at our end and it's a relatively small change. I can't guarantee that some nasty problem won't make this unattractive, but for now I think this should be acceptable.

pelwell avatar Oct 13 '22 10:10 pelwell

Yes, you're right about the type. Fixed it. We will schedule the changes to the tooling on our side and hopefully have a PR soon. I'm not sure about the "EEPROM data format version", should it be incremented? But this is a detail which should not block anything at the moment.

iluminat23 avatar Oct 13 '22 11:10 iluminat23

Since the new format is compatible with the old if the new type isn't used I would leave the format version as it is.

pelwell avatar Oct 13 '22 11:10 pelwell

Looking at the parsing code in the firmware it exits (successfully!) when an unknown ID is encountered. It therefore makes sense when building the eep to put the new chunk at the end of the image, after any custom chunks.

I also found it convenient to reuse the same gpio_map_d structure for the smaller second bank, leaving the remaining entries zeroed (and therefore ignored).

pelwell avatar Oct 14 '22 09:10 pelwell

Thanks for the fast replay. I updated the document to reflect this.

iluminat23 avatar Oct 14 '22 12:10 iluminat23

I wasn't actually thinking of using a larger blob in the image, just to unpack it into a gpio_map_d rather than adding say a gpio_bank1_map_d structure.

pelwell avatar Oct 14 '22 14:10 pelwell

Ohhh ok, so only the internal representation. Will change it back.

iluminat23 avatar Oct 14 '22 15:10 iluminat23

closed in favor of https://github.com/raspberrypi/hats/pull/93 The format is the same but now also the tooling was updated.

iluminat23 avatar Nov 08 '22 17:11 iluminat23