|
@@ -404,21 +404,10 @@ static void sdio_select_driver_type(struct mmc_card *card)
|
|
|
{
|
|
|
int host_drv_type = SD_DRIVER_TYPE_B;
|
|
|
int card_drv_type = SD_DRIVER_TYPE_B;
|
|
|
- int drive_strength;
|
|
|
+ int drive_strength, drv_type;
|
|
|
unsigned char card_strength;
|
|
|
int err;
|
|
|
|
|
|
- /*
|
|
|
- * If the host doesn't support any of the Driver Types A,C or D,
|
|
|
- * or there is no board specific handler then default Driver
|
|
|
- * Type B is used.
|
|
|
- */
|
|
|
- if (!(card->host->caps &
|
|
|
- (MMC_CAP_DRIVER_TYPE_A |
|
|
|
- MMC_CAP_DRIVER_TYPE_C |
|
|
|
- MMC_CAP_DRIVER_TYPE_D)))
|
|
|
- return;
|
|
|
-
|
|
|
if (!card->host->ops->select_drive_strength)
|
|
|
return;
|
|
|
|
|
@@ -448,23 +437,27 @@ static void sdio_select_driver_type(struct mmc_card *card)
|
|
|
*/
|
|
|
drive_strength = card->host->ops->select_drive_strength(
|
|
|
card->sw_caps.uhs_max_dtr,
|
|
|
- host_drv_type, card_drv_type);
|
|
|
+ host_drv_type, card_drv_type, &drv_type);
|
|
|
|
|
|
- /* if error just use default for drive strength B */
|
|
|
- err = mmc_io_rw_direct(card, 0, 0, SDIO_CCCR_DRIVE_STRENGTH, 0,
|
|
|
- &card_strength);
|
|
|
- if (err)
|
|
|
- return;
|
|
|
+ if (drive_strength) {
|
|
|
+ /* if error just use default for drive strength B */
|
|
|
+ err = mmc_io_rw_direct(card, 0, 0, SDIO_CCCR_DRIVE_STRENGTH, 0,
|
|
|
+ &card_strength);
|
|
|
+ if (err)
|
|
|
+ return;
|
|
|
|
|
|
- card_strength &= ~(SDIO_DRIVE_DTSx_MASK<<SDIO_DRIVE_DTSx_SHIFT);
|
|
|
- card_strength |= host_drive_to_sdio_drive(drive_strength);
|
|
|
+ card_strength &= ~(SDIO_DRIVE_DTSx_MASK<<SDIO_DRIVE_DTSx_SHIFT);
|
|
|
+ card_strength |= host_drive_to_sdio_drive(drive_strength);
|
|
|
|
|
|
- err = mmc_io_rw_direct(card, 1, 0, SDIO_CCCR_DRIVE_STRENGTH,
|
|
|
- card_strength, NULL);
|
|
|
+ /* if error default to drive strength B */
|
|
|
+ err = mmc_io_rw_direct(card, 1, 0, SDIO_CCCR_DRIVE_STRENGTH,
|
|
|
+ card_strength, NULL);
|
|
|
+ if (err)
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
- /* if error default to drive strength B */
|
|
|
- if (!err)
|
|
|
- mmc_set_driver_type(card->host, drive_strength);
|
|
|
+ if (drv_type)
|
|
|
+ mmc_set_driver_type(card->host, drv_type);
|
|
|
}
|
|
|
|
|
|
|