Device migrations and driver implementations (#564)

This commit is contained in:
Ken Van Hoeylandt
2026-07-15 12:46:24 +02:00
committed by GitHub
parent 8af6204ba1
commit bd8fdfd858
55 changed files with 1695 additions and 447 deletions
@@ -41,3 +41,11 @@ properties:
element-type: "struct GpioPinSpec"
default: "{ }"
description: Null-terminated array of chip select GPIO pin specs for peripherals on this bus
miso-pull-up:
type: boolean
default: false
description: >
Enables a weak internal pull-up on MISO, which floats between transactions/while another
device on the bus is selected. Helps some SPI peripherals (a garbled/invalid response on
CMD8/if_cond has been observed for SD-over-SPI on some boards) but has been observed to
break others (prevents the SD card from responding to CMD0 at all) - opt in per board.
@@ -27,6 +27,14 @@ struct Esp32SpiConfig {
struct GpioPinSpec* cs_gpios;
/** The item count of cs_gpios */
uint8_t cs_gpios_count;
/**
* Enables a weak internal pull-up on MISO, which floats between transactions/while
* another device on the bus is selected. Helps some SPI peripherals (a garbled/invalid
* response on CMD8/if_cond has been observed for SD-over-SPI on some boards) but has been
* observed to break others (e.g. prevents the SD card from responding to CMD0 at all on
* some boards) - opt in per board rather than defaulting it on for everyone.
*/
bool miso_pull_up;
};
/**
@@ -129,8 +129,9 @@ static error_t start(Device* device) {
// MISO is only actively driven by the selected slave; between commands (and briefly during
// slave selection/response) it floats, which can be read as spurious bits. A weak pull-up
// costs nothing against an actively-driven line and avoids that, e.g. on SD-over-SPI this
// shows up as CMD8/if_cond failing with a garbled/invalid response.
if (data->miso_descriptor != nullptr) {
// shows up as CMD8/if_cond failing with a garbled/invalid response. Opt-in per board though:
// it's been observed to instead prevent an SD card from responding to CMD0 at all elsewhere.
if (data->miso_descriptor != nullptr && dts_config->miso_pull_up) {
gpio_descriptor_set_flags(data->miso_descriptor, GPIO_FLAG_DIRECTION_INPUT | GPIO_FLAG_PULL_UP);
}