If the property cd-gpios is present in the dts, we will check the value of the gpio before scanning.
It avoid some boring timeouts when no extra sd card is inserted.
Note that it could/should be extend in the future to support gpio interrupts/polling to detect later card insertion.
Details
- Reviewers
- None
Tested on Olimex A20 SOM EVB
Diff Detail
- Lint
Lint Passed - Unit
No Test Coverage - Build Status
Buildable 6237 Build 6480: arc lint + arc unit
Event Timeline
Timeout isn't as long as I remembered, so no need for this now (except to hide error message from the sd controller).
I'll implement interrupt/polling and update this review.
sys/dev/mmc/mmc.c | ||
---|---|---|
254 | This will break on arm64 when booting with ACPI. There is no ofw node in this case, but FDT may be defined. |
sys/dev/mmc/mmc.c | ||
---|---|---|
257 | The use of ofw_gpiobus_parse_gpios() is incorrect. The *-gpios property can specify any number of pins, ofw_gpiobus_parse_gpios() will return the number of read pins and will allocate the correct amount of memory for the pins structure (with all the pins). You are supposed to free that memory after use. Here is an usage example: + /* Get GPIO power pins, if any. */ |
sys/dev/mmc/mmc.c | ||
---|---|---|
257 | or you can simply use gpio_pin_get_by_ofw_property(() ... |
sys/dev/mmc/mmc.c | ||
---|---|---|
254 | You can subclass the mmc driver for FDT. It would check if ofw_bus_get_node returns a valid node in the probe function & run these in the attach function before calling into the existing mmc_attach. You will need to change mmc_probe to return a BUS_PROBE_ so this new driver will attach. |