au-ts / sddf

A collection of interfaces, libraries and tools for writing device drivers for seL4 that allow accessing devices securely and with low overhead.
Other
17 stars 14 forks source link

Future work for i.MX8 uSDHC driver #187

Open Ivan-Velickovic opened 1 month ago

Ivan-Velickovic commented 1 month ago

https://github.com/au-ts/sddf/pull/157 adds initial support for the i.MX8 based MMC block device.

The main motivation for this is to support experimentation regarding hot-plugging and so we do not implement all driver features you would expect with a uSDHC driver.

Below is various future work we may or may not implement. It is likely for the minor things and high-speed mode to be implemented eventually.

Ivan-Velickovic commented 1 month ago

Whoops, wrong repository (fixed now).

midnightveil commented 1 month ago

Regarding card detection:

Neither the MaaxBoard nor the i.MX8MM-EVK board's (nominally-iMX8-specific) uSDHC controller fire the CINSIEN/CRMIEN IRQs for card insertion / removal, as per the standard SD-PHY specifications. However:

The iMX8MM-EVK specifies the cd-gpios property in its device tree, and is correctly updates to reflect the card status:

# in
u-boot=> gpio status
Bank GPIO1_:
GPIO1_15: input: 0 [x] mmc@30b50000.cd-gpio
# out
u-boot=> gpio status
Bank GPIO1_:
GPIO1_15: input: 1 [x] mmc@30b50000.cd-gpios

In contrast, the MaaXboard does not set the cd-gpios property in its device tree, and so U-Boot/Linux don't know about unplug/replug. However, there is still a GPIO linked up to the card detect pin:

# from running `gpio status -a` in uboot
$ diff ~/plug.txt ~/unplug.txt
8c8
< GPIO1_6: input: 0 [ ]
---
> GPIO1_6: input: 1 [ ]

For this feature to work, we need a GPIO driver and to listen for interrupts on those pins, as per the device tree for mmc controllers.