Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mmc: core: Simplify card drive strength mask

Card drive strength selection uses a callback to
which a mask of supported drive strengths is passed.
Currently, the bits are checked against the values
in the SD specifications. That is not necessary
because the callback will anyway match the mask
against a valid value. Simplify by taking the mask
as is but still ensuring that the default mandatory
value (type B) is always supported.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

authored by

Adrian Hunter and committed by
Ulf Hansson
fa021cef b4f30a17

+4 -20
+2 -10
drivers/mmc/core/sd.c
··· 387 387 static int sd_select_driver_type(struct mmc_card *card, u8 *status) 388 388 { 389 389 int host_drv_type = SD_DRIVER_TYPE_B; 390 - int card_drv_type = SD_DRIVER_TYPE_B; 391 - int drive_strength, drv_type; 390 + int card_drv_type, drive_strength, drv_type; 392 391 int err; 393 392 394 393 if (!card->host->ops->select_drive_strength) ··· 402 403 if (card->host->caps & MMC_CAP_DRIVER_TYPE_D) 403 404 host_drv_type |= SD_DRIVER_TYPE_D; 404 405 405 - if (card->sw_caps.sd3_drv_type & SD_DRIVER_TYPE_A) 406 - card_drv_type |= SD_DRIVER_TYPE_A; 407 - 408 - if (card->sw_caps.sd3_drv_type & SD_DRIVER_TYPE_C) 409 - card_drv_type |= SD_DRIVER_TYPE_C; 410 - 411 - if (card->sw_caps.sd3_drv_type & SD_DRIVER_TYPE_D) 412 - card_drv_type |= SD_DRIVER_TYPE_D; 406 + card_drv_type = card->sw_caps.sd3_drv_type | SD_DRIVER_TYPE_B; 413 407 414 408 /* 415 409 * The drive strength that the hardware can support
+2 -10
drivers/mmc/core/sdio.c
··· 403 403 static void sdio_select_driver_type(struct mmc_card *card) 404 404 { 405 405 int host_drv_type = SD_DRIVER_TYPE_B; 406 - int card_drv_type = SD_DRIVER_TYPE_B; 407 - int drive_strength, drv_type; 406 + int card_drv_type, drive_strength, drv_type; 408 407 unsigned char card_strength; 409 408 int err; 410 409 ··· 419 420 if (card->host->caps & MMC_CAP_DRIVER_TYPE_D) 420 421 host_drv_type |= SD_DRIVER_TYPE_D; 421 422 422 - if (card->sw_caps.sd3_drv_type & SD_DRIVER_TYPE_A) 423 - card_drv_type |= SD_DRIVER_TYPE_A; 424 - 425 - if (card->sw_caps.sd3_drv_type & SD_DRIVER_TYPE_C) 426 - card_drv_type |= SD_DRIVER_TYPE_C; 427 - 428 - if (card->sw_caps.sd3_drv_type & SD_DRIVER_TYPE_D) 429 - card_drv_type |= SD_DRIVER_TYPE_D; 423 + card_drv_type = card->sw_caps.sd3_drv_type | SD_DRIVER_TYPE_B; 430 424 431 425 /* 432 426 * The drive strength that the hardware can support