mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-04-18 09:25:06 +00:00
Fix for LilyGO T-HMI SD card
This commit is contained in:
parent
e560cc7df2
commit
36db47624b
@ -28,6 +28,8 @@
|
|||||||
pin-clk = <&gpio0 12 GPIO_FLAG_NONE>;
|
pin-clk = <&gpio0 12 GPIO_FLAG_NONE>;
|
||||||
pin-cmd = <&gpio0 11 GPIO_FLAG_NONE>;
|
pin-cmd = <&gpio0 11 GPIO_FLAG_NONE>;
|
||||||
pin-d0 = <&gpio0 13 GPIO_FLAG_NONE>;
|
pin-d0 = <&gpio0 13 GPIO_FLAG_NONE>;
|
||||||
|
pin-d3 = <&gpio0 10 GPIO_FLAG_NONE>;
|
||||||
bus-width = <1>;
|
bus-width = <1>;
|
||||||
|
pullups;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@ -50,4 +50,12 @@ properties:
|
|||||||
enable-uhs:
|
enable-uhs:
|
||||||
type: boolean
|
type: boolean
|
||||||
default: false
|
default: false
|
||||||
description: Enable UHS mode
|
description: Enable UHS mode
|
||||||
|
pullups:
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
|
description: Enable internal pullups for SDMMC pins
|
||||||
|
on-chip-ldo-chan:
|
||||||
|
type: int
|
||||||
|
default: -1
|
||||||
|
description: On-chip LDO channel for SD power (e.g. 4 for LDO4). Set to -1 to disable.
|
||||||
@ -28,6 +28,8 @@ struct Esp32SdmmcConfig {
|
|||||||
uint8_t bus_width;
|
uint8_t bus_width;
|
||||||
bool wp_active_high;
|
bool wp_active_high;
|
||||||
bool enable_uhs;
|
bool enable_uhs;
|
||||||
|
bool pullups;
|
||||||
|
int32_t on_chip_ldo_chan;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -78,20 +78,23 @@ static error_t mount(void* data) {
|
|||||||
sdmmc_host_t host = SDMMC_HOST_DEFAULT();
|
sdmmc_host_t host = SDMMC_HOST_DEFAULT();
|
||||||
|
|
||||||
#if SOC_SD_PWR_CTRL_SUPPORTED
|
#if SOC_SD_PWR_CTRL_SUPPORTED
|
||||||
sd_pwr_ctrl_ldo_config_t ldo_config = {
|
if (config->on_chip_ldo_chan != -1) {
|
||||||
.ldo_chan_id = 4, // LDO4 is typically used for SDMMC on ESP32-S3
|
sd_pwr_ctrl_ldo_config_t ldo_config = {
|
||||||
};
|
.ldo_chan_id = (uint32_t)config->on_chip_ldo_chan,
|
||||||
esp_err_t pwr_err = sd_pwr_ctrl_new_on_chip_ldo(&ldo_config, &fs_data->pwr_ctrl_handle);
|
};
|
||||||
if (pwr_err != ESP_OK) {
|
esp_err_t pwr_err = sd_pwr_ctrl_new_on_chip_ldo(&ldo_config, &fs_data->pwr_ctrl_handle);
|
||||||
LOG_E(TAG, "Failed to create SD power control driver, err=0x%x", pwr_err);
|
if (pwr_err != ESP_OK) {
|
||||||
return ERROR_NOT_SUPPORTED;
|
LOG_E(TAG, "Failed to create SD power control driver, err=0x%x", pwr_err);
|
||||||
|
return ERROR_NOT_SUPPORTED;
|
||||||
|
}
|
||||||
|
host.pwr_ctrl_handle = fs_data->pwr_ctrl_handle;
|
||||||
}
|
}
|
||||||
host.pwr_ctrl_handle = fs_data->pwr_ctrl_handle;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint32_t slot_config_flags = 0;
|
uint32_t slot_config_flags = 0;
|
||||||
if (config->enable_uhs) slot_config_flags |= SDMMC_SLOT_FLAG_UHS1;
|
if (config->enable_uhs) slot_config_flags |= SDMMC_SLOT_FLAG_UHS1;
|
||||||
if (config->wp_active_high) slot_config_flags |= SDMMC_SLOT_FLAG_WP_ACTIVE_HIGH;
|
if (config->wp_active_high) slot_config_flags |= SDMMC_SLOT_FLAG_WP_ACTIVE_HIGH;
|
||||||
|
if (config->pullups) slot_config_flags |= SDMMC_SLOT_FLAG_INTERNAL_PULLUP;
|
||||||
|
|
||||||
sdmmc_slot_config_t slot_config = {
|
sdmmc_slot_config_t slot_config = {
|
||||||
.clk = to_native_pin(config->pin_clk),
|
.clk = to_native_pin(config->pin_clk),
|
||||||
@ -124,6 +127,7 @@ static error_t mount(void* data) {
|
|||||||
fs_data->pwr_ctrl_handle = nullptr;
|
fs_data->pwr_ctrl_handle = nullptr;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
sdmmc_card_print_info(stdout, fs_data->card);
|
||||||
return ERROR_UNDEFINED;
|
return ERROR_UNDEFINED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user