RPi4
RPi4 copied to clipboard
I2C driver not discovered on Linux
I2C is currently not supported on Linux when booting using UEFI. The following issues need to be resolved before the patches can be posted:
- There is currently no way of distinguishing between the BCM2835 and BCM2711 I2C blocks based on information in the ACPI tables. The driver needs to know the revision to turn on the right quirks.
- Linux currently doesn't know how to interpret honour pin function descriptors. This means that the firmware needs to configure the pin mux to route the I2C signals before handing over to Linux. I have a patch that adds this functionality.
- There is no (obvious) way of discovering the frequency of the clock driving the I2C block. The current driver relies on the clocks being declared in the device tree.
I have a series patches that "work", but it relies on a hard-coded clock frequency and assumes it is running on a BCM2711. That's not ideal and won't be good enough for mainline.
We should also consider whether we want the I2C buses to be enabled by default or if we want to make the pin functions configurable. For example, the I2C bus used for hat identification (currently not exported) can be used as a serial port instead on the BCM2711.
Another thing to consider is how we handle I2C buses that the firmware wants to use. For example, my Waveshare PoE hat uses a PCF8574 to control its fan which could be controlled by firmware. To make things more interesting, it has a SSD1306 display on the same bus which probably should be exposed to Linux.
Having talked to some people who actually understand ACPI (my understanding is currently a bit limited, it seems like the cleanest solution to the problems above is to let the firmware configure the pinmux and the I2C bus frequency. My impression is that the _HRV field could be used to identify the revision of the IP block and enable the relevant quirks.
It seems like this implies that we need a general HAT configuration mechanism in UEFI. Some hats have configuration EEPROMs that could be used to automatically configure the pinmux and expose the right buses to the OS.
Has there been any progress with this?