On 19 Jul 2022 at 17:02, Andrei Borzenkov wrote: > On 19.07.2022 13:59, Santhosh Nambiar wrote: > > Hi Community, > > I would like to know whether GRUB2 supports i2c/smbus communication or not. > > I have a requirement in which an i2c device has to be accessed from GRUB in > > an X86 based platform. > > Appreciate any help you can provide. > > Thank you. > > There is no generic support. There is some code to access SMBus in > CS5536 driver, but I guess that's all. > Ahh, the Geode. Still alive and kicking, kind of :-)
The trouble with i2c/smbus is, that the hardware bus interfaces are varied, on embedded platforms often outright custom (via GPIO) and the bus is not so popular among end users - all of that compared to e.g. the USB. Take Linux for example - the hacker OS platform of choice. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tre e/drivers/i2c Support for various i2c interfaces is pretty comprehensive: both for bus interfaces implemented in silicon (in various popular SoC's / PC chipsets / interface converters / NIC's / VGA chips / whatever ), and there is some generic API for you to easily implement a driver for custom bit-banging interfaces using GPIO (which in itself is a diverse family of hardware with no real standard). Now... how real would it be, to port all that into a bootloader. I'm afraid that in Grub, you're on your own. Actually there is one other project that may be closer to Grub than Linux, and certainly involves i2c: you may want to check out Coreboot. https://review.coreboot.org/plugins/gitiles/coreboot/+/refs/heads/mast er/src/drivers/i2c/ Linux or Coreboot, the codebase related to i2c appears to strive for a layered approach (for extensibility) and may seem overwhelming to a novice :-) Frank
