sd: sdmmc: fix formatting
Formats according to latest .clang-format rules. Signed-off-by: Jakob Genßler <jakob.genssler@gin.de>
This commit is contained in:
parent
64fd289b2f
commit
3d1a4039ea
|
@ -18,8 +18,7 @@
|
||||||
|
|
||||||
LOG_MODULE_DECLARE(sd, CONFIG_SD_LOG_LEVEL);
|
LOG_MODULE_DECLARE(sd, CONFIG_SD_LOG_LEVEL);
|
||||||
|
|
||||||
static inline void sdmmc_decode_scr(struct sd_scr *scr,
|
static inline void sdmmc_decode_scr(struct sd_scr *scr, uint32_t *raw_scr, uint8_t *version)
|
||||||
uint32_t *raw_scr, uint8_t *version)
|
|
||||||
{
|
{
|
||||||
uint32_t tmp_version = 0;
|
uint32_t tmp_version = 0;
|
||||||
|
|
||||||
|
@ -283,8 +282,8 @@ static int sdmmc_set_bus_width(struct sd_card *card, enum sdhc_bus_width width)
|
||||||
* argument corresponding to that function to "value", and all other 4 bit
|
* argument corresponding to that function to "value", and all other 4 bit
|
||||||
* blocks should be left as 0xF (no effect on current function)
|
* blocks should be left as 0xF (no effect on current function)
|
||||||
*/
|
*/
|
||||||
static int sdmmc_switch(struct sd_card *card, enum sd_switch_arg mode,
|
static int sdmmc_switch(struct sd_card *card, enum sd_switch_arg mode, enum sd_group_num group,
|
||||||
enum sd_group_num group, uint8_t value, uint8_t *response)
|
uint8_t value, uint8_t *response)
|
||||||
{
|
{
|
||||||
struct sdhc_command cmd = {0};
|
struct sdhc_command cmd = {0};
|
||||||
struct sdhc_data data = {0};
|
struct sdhc_data data = {0};
|
||||||
|
@ -383,8 +382,7 @@ static int sdmmc_select_driver_type(struct sd_card *card)
|
||||||
(card->switch_caps.sd_drv_type & SD_DRIVER_TYPE_C)) {
|
(card->switch_caps.sd_drv_type & SD_DRIVER_TYPE_C)) {
|
||||||
card->bus_io.driver_type = SD_DRIVER_TYPE_C;
|
card->bus_io.driver_type = SD_DRIVER_TYPE_C;
|
||||||
/* Change drive strength */
|
/* Change drive strength */
|
||||||
ret = sdmmc_switch(card, SD_SWITCH_SET,
|
ret = sdmmc_switch(card, SD_SWITCH_SET, SD_GRP_DRIVER_STRENGTH_MODE,
|
||||||
SD_GRP_DRIVER_STRENGTH_MODE,
|
|
||||||
(find_msb_set(SD_DRIVER_TYPE_C) - 1), status);
|
(find_msb_set(SD_DRIVER_TYPE_C) - 1), status);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -397,8 +395,7 @@ static int sdmmc_set_current_limit(struct sd_card *card)
|
||||||
int max_current = -1;
|
int max_current = -1;
|
||||||
uint8_t *status = card->card_buffer;
|
uint8_t *status = card->card_buffer;
|
||||||
|
|
||||||
if ((card->card_speed != SD_TIMING_SDR50) &&
|
if ((card->card_speed != SD_TIMING_SDR50) && (card->card_speed != SD_TIMING_SDR104) &&
|
||||||
(card->card_speed != SD_TIMING_SDR104) &&
|
|
||||||
(card->card_speed != SD_TIMING_DDR50)) {
|
(card->card_speed != SD_TIMING_DDR50)) {
|
||||||
return 0; /* Cannot set current limit */
|
return 0; /* Cannot set current limit */
|
||||||
} else if (card->host_props.max_current_180 >= 800 &&
|
} else if (card->host_props.max_current_180 >= 800 &&
|
||||||
|
@ -417,8 +414,8 @@ static int sdmmc_set_current_limit(struct sd_card *card)
|
||||||
if (max_current != -1) {
|
if (max_current != -1) {
|
||||||
LOG_DBG("Changing SD current limit: %d", max_current);
|
LOG_DBG("Changing SD current limit: %d", max_current);
|
||||||
/* Switch SD current */
|
/* Switch SD current */
|
||||||
ret = sdmmc_switch(card, SD_SWITCH_SET, SD_GRP_CURRENT_LIMIT_MODE,
|
ret = sdmmc_switch(card, SD_SWITCH_SET, SD_GRP_CURRENT_LIMIT_MODE, max_current,
|
||||||
max_current, status);
|
status);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
LOG_DBG("Failed to set SD current limit");
|
LOG_DBG("Failed to set SD current limit");
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -466,8 +463,7 @@ static int sdmmc_set_bus_speed(struct sd_card *card)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Switch bus speed */
|
/* Switch bus speed */
|
||||||
ret = sdmmc_switch(card, SD_SWITCH_SET, SD_GRP_TIMING_MODE,
|
ret = sdmmc_switch(card, SD_SWITCH_SET, SD_GRP_TIMING_MODE, card->card_speed, status);
|
||||||
card->card_speed, status);
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
LOG_DBG("Failed to switch SD card speed");
|
LOG_DBG("Failed to switch SD card speed");
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -521,8 +517,7 @@ static int sdmmc_init_uhs(struct sd_card *card)
|
||||||
LOG_DBG("Failed to set card bus speed");
|
LOG_DBG("Failed to set card bus speed");
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
if (card->card_speed == SD_TIMING_SDR50 ||
|
if (card->card_speed == SD_TIMING_SDR50 || card->card_speed == SD_TIMING_SDR104 ||
|
||||||
card->card_speed == SD_TIMING_SDR104 ||
|
|
||||||
card->card_speed == SD_TIMING_DDR50) {
|
card->card_speed == SD_TIMING_DDR50) {
|
||||||
/* SDR104, SDR50, and DDR50 mode need tuning */
|
/* SDR104, SDR50, and DDR50 mode need tuning */
|
||||||
ret = sdhc_execute_tuning(card->sdhc);
|
ret = sdhc_execute_tuning(card->sdhc);
|
||||||
|
@ -538,8 +533,7 @@ static int sdmmc_init_hs(struct sd_card *card)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if ((!card->host_props.host_caps.high_spd_support) ||
|
if ((!card->host_props.host_caps.high_spd_support) || (card->sd_version < SD_SPEC_VER1_1) ||
|
||||||
(card->sd_version < SD_SPEC_VER1_1) ||
|
|
||||||
(card->switch_caps.hs_max_dtr == 0)) {
|
(card->switch_caps.hs_max_dtr == 0)) {
|
||||||
/* No high speed support. Leave card untouched */
|
/* No high speed support. Leave card untouched */
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -638,10 +632,8 @@ int sdmmc_card_init(struct sd_card *card)
|
||||||
* switch to new signal voltage using "signal voltage switch procedure"
|
* switch to new signal voltage using "signal voltage switch procedure"
|
||||||
* described in SD specification
|
* described in SD specification
|
||||||
*/
|
*/
|
||||||
if ((card->flags & SD_1800MV_FLAG) &&
|
if ((card->flags & SD_1800MV_FLAG) && (card->host_props.host_caps.vol_180_support) &&
|
||||||
(card->host_props.host_caps.vol_180_support) &&
|
(!card->host_props.is_spi) && IS_ENABLED(CONFIG_SD_UHS_PROTOCOL)) {
|
||||||
(!card->host_props.is_spi) &&
|
|
||||||
IS_ENABLED(CONFIG_SD_UHS_PROTOCOL)) {
|
|
||||||
ret = sdmmc_switch_voltage(card);
|
ret = sdmmc_switch_voltage(card);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
/* Disable host support for 1.8 V */
|
/* Disable host support for 1.8 V */
|
||||||
|
@ -713,10 +705,8 @@ int sdmmc_card_init(struct sd_card *card)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((card->flags & SD_1800MV_FLAG) &&
|
if ((card->flags & SD_1800MV_FLAG) && sdmmc_host_uhs(&card->host_props) &&
|
||||||
sdmmc_host_uhs(&card->host_props) &&
|
!(card->host_props.is_spi) && IS_ENABLED(CONFIG_SD_UHS_PROTOCOL)) {
|
||||||
!(card->host_props.is_spi) &&
|
|
||||||
IS_ENABLED(CONFIG_SD_UHS_PROTOCOL)) {
|
|
||||||
ret = sdmmc_init_uhs(card);
|
ret = sdmmc_init_uhs(card);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
LOG_ERR("UHS card init failed");
|
LOG_ERR("UHS card init failed");
|
||||||
|
@ -745,14 +735,14 @@ int sdmmc_ioctl(struct sd_card *card, uint8_t cmd, void *buf)
|
||||||
return card_ioctl(card, cmd, buf);
|
return card_ioctl(card, cmd, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
int sdmmc_read_blocks(struct sd_card *card, uint8_t *rbuf,
|
int sdmmc_read_blocks(struct sd_card *card, uint8_t *rbuf, uint32_t start_block,
|
||||||
uint32_t start_block, uint32_t num_blocks)
|
uint32_t num_blocks)
|
||||||
{
|
{
|
||||||
return card_read_blocks(card, rbuf, start_block, num_blocks);
|
return card_read_blocks(card, rbuf, start_block, num_blocks);
|
||||||
}
|
}
|
||||||
|
|
||||||
int sdmmc_write_blocks(struct sd_card *card, const uint8_t *wbuf,
|
int sdmmc_write_blocks(struct sd_card *card, const uint8_t *wbuf, uint32_t start_block,
|
||||||
uint32_t start_block, uint32_t num_blocks)
|
uint32_t num_blocks)
|
||||||
{
|
{
|
||||||
return card_write_blocks(card, wbuf, start_block, num_blocks);
|
return card_write_blocks(card, wbuf, start_block, num_blocks);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue