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:
Jakob Genßler 2024-03-15 17:55:09 +01:00 committed by David Leach
parent 64fd289b2f
commit 3d1a4039ea

View file

@ -18,8 +18,7 @@
LOG_MODULE_DECLARE(sd, CONFIG_SD_LOG_LEVEL);
static inline void sdmmc_decode_scr(struct sd_scr *scr,
uint32_t *raw_scr, uint8_t *version)
static inline void sdmmc_decode_scr(struct sd_scr *scr, uint32_t *raw_scr, uint8_t *version)
{
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
* blocks should be left as 0xF (no effect on current function)
*/
static int sdmmc_switch(struct sd_card *card, enum sd_switch_arg mode,
enum sd_group_num group, uint8_t value, uint8_t *response)
static int sdmmc_switch(struct sd_card *card, enum sd_switch_arg mode, enum sd_group_num group,
uint8_t value, uint8_t *response)
{
struct sdhc_command cmd = {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->bus_io.driver_type = SD_DRIVER_TYPE_C;
/* Change drive strength */
ret = sdmmc_switch(card, SD_SWITCH_SET,
SD_GRP_DRIVER_STRENGTH_MODE,
ret = sdmmc_switch(card, SD_SWITCH_SET, SD_GRP_DRIVER_STRENGTH_MODE,
(find_msb_set(SD_DRIVER_TYPE_C) - 1), status);
}
return ret;
@ -397,8 +395,7 @@ static int sdmmc_set_current_limit(struct sd_card *card)
int max_current = -1;
uint8_t *status = card->card_buffer;
if ((card->card_speed != SD_TIMING_SDR50) &&
(card->card_speed != SD_TIMING_SDR104) &&
if ((card->card_speed != SD_TIMING_SDR50) && (card->card_speed != SD_TIMING_SDR104) &&
(card->card_speed != SD_TIMING_DDR50)) {
return 0; /* Cannot set current limit */
} 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) {
LOG_DBG("Changing SD current limit: %d", max_current);
/* Switch SD current */
ret = sdmmc_switch(card, SD_SWITCH_SET, SD_GRP_CURRENT_LIMIT_MODE,
max_current, status);
ret = sdmmc_switch(card, SD_SWITCH_SET, SD_GRP_CURRENT_LIMIT_MODE, max_current,
status);
if (ret) {
LOG_DBG("Failed to set SD current limit");
return ret;
@ -466,8 +463,7 @@ static int sdmmc_set_bus_speed(struct sd_card *card)
}
/* Switch bus speed */
ret = sdmmc_switch(card, SD_SWITCH_SET, SD_GRP_TIMING_MODE,
card->card_speed, status);
ret = sdmmc_switch(card, SD_SWITCH_SET, SD_GRP_TIMING_MODE, card->card_speed, status);
if (ret) {
LOG_DBG("Failed to switch SD card speed");
return ret;
@ -521,8 +517,7 @@ static int sdmmc_init_uhs(struct sd_card *card)
LOG_DBG("Failed to set card bus speed");
return ret;
}
if (card->card_speed == SD_TIMING_SDR50 ||
card->card_speed == SD_TIMING_SDR104 ||
if (card->card_speed == SD_TIMING_SDR50 || card->card_speed == SD_TIMING_SDR104 ||
card->card_speed == SD_TIMING_DDR50) {
/* SDR104, SDR50, and DDR50 mode need tuning */
ret = sdhc_execute_tuning(card->sdhc);
@ -538,8 +533,7 @@ static int sdmmc_init_hs(struct sd_card *card)
{
int ret;
if ((!card->host_props.host_caps.high_spd_support) ||
(card->sd_version < SD_SPEC_VER1_1) ||
if ((!card->host_props.host_caps.high_spd_support) || (card->sd_version < SD_SPEC_VER1_1) ||
(card->switch_caps.hs_max_dtr == 0)) {
/* No high speed support. Leave card untouched */
return 0;
@ -638,10 +632,8 @@ int sdmmc_card_init(struct sd_card *card)
* switch to new signal voltage using "signal voltage switch procedure"
* described in SD specification
*/
if ((card->flags & SD_1800MV_FLAG) &&
(card->host_props.host_caps.vol_180_support) &&
(!card->host_props.is_spi) &&
IS_ENABLED(CONFIG_SD_UHS_PROTOCOL)) {
if ((card->flags & SD_1800MV_FLAG) && (card->host_props.host_caps.vol_180_support) &&
(!card->host_props.is_spi) && IS_ENABLED(CONFIG_SD_UHS_PROTOCOL)) {
ret = sdmmc_switch_voltage(card);
if (ret) {
/* Disable host support for 1.8 V */
@ -713,10 +705,8 @@ int sdmmc_card_init(struct sd_card *card)
return ret;
}
}
if ((card->flags & SD_1800MV_FLAG) &&
sdmmc_host_uhs(&card->host_props) &&
!(card->host_props.is_spi) &&
IS_ENABLED(CONFIG_SD_UHS_PROTOCOL)) {
if ((card->flags & SD_1800MV_FLAG) && sdmmc_host_uhs(&card->host_props) &&
!(card->host_props.is_spi) && IS_ENABLED(CONFIG_SD_UHS_PROTOCOL)) {
ret = sdmmc_init_uhs(card);
if (ret) {
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);
}
int sdmmc_read_blocks(struct sd_card *card, uint8_t *rbuf,
uint32_t start_block, uint32_t num_blocks)
int sdmmc_read_blocks(struct sd_card *card, uint8_t *rbuf, uint32_t start_block,
uint32_t num_blocks)
{
return card_read_blocks(card, rbuf, start_block, num_blocks);
}
int sdmmc_write_blocks(struct sd_card *card, const uint8_t *wbuf,
uint32_t start_block, uint32_t num_blocks)
int sdmmc_write_blocks(struct sd_card *card, const uint8_t *wbuf, uint32_t start_block,
uint32_t num_blocks)
{
return card_write_blocks(card, wbuf, start_block, num_blocks);
}