diff options
author | Lucas Stach <l.stach@pengutronix.de> | 2017-07-31 20:21:02 +0200 |
---|---|---|
committer | Lucas Stach <l.stach@pengutronix.de> | 2017-07-31 20:21:02 +0200 |
commit | 45ec38ce6d96a2ac3b3bb20502ff2df7040032e2 (patch) | |
tree | 459524480df7dfbb7b13e70ac46b2d08e47df139 /drivers/mci | |
parent | 361c36d997789ac1f42d14ccd6f45449c8604958 (diff) | |
parent | 154154bce5b1b18382e57920a399f2c54d1fa19f (diff) | |
download | barebox-45ec38ce6d96a2ac3b3bb20502ff2df7040032e2.tar.gz barebox-45ec38ce6d96a2ac3b3bb20502ff2df7040032e2.tar.xz |
Merge branch 'for-next/mmc'
Diffstat (limited to 'drivers/mci')
-rw-r--r-- | drivers/mci/mci-core.c | 54 |
1 files changed, 30 insertions, 24 deletions
diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c index 3da1c261a9..07911d43d7 100644 --- a/drivers/mci/mci-core.c +++ b/drivers/mci/mci-core.c @@ -469,7 +469,7 @@ static int mmc_change_freq(struct mci *mci) return err; } - cardtype = mci->ext_csd[EXT_CSD_CARD_TYPE] & EXT_CSD_CARD_TYPE_MASK; + cardtype = mci->ext_csd[EXT_CSD_DEVICE_TYPE] & EXT_CSD_CARD_TYPE_MASK; err = mci_switch(mci, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_HS_TIMING, 1); @@ -499,13 +499,13 @@ static int mmc_change_freq(struct mci *mci) mci->card_caps |= MMC_CAP_MMC_HIGHSPEED; if (IS_ENABLED(CONFIG_MCI_MMC_BOOT_PARTITIONS) && - mci->ext_csd[EXT_CSD_REV] >= 3 && mci->ext_csd[EXT_CSD_BOOT_MULT]) { + mci->ext_csd[EXT_CSD_REV] >= 3 && mci->ext_csd[EXT_CSD_BOOT_SIZE_MULT]) { int idx; unsigned int part_size; for (idx = 0; idx < MMC_NUM_BOOT_PARTITION; idx++) { char *name, *partname; - part_size = mci->ext_csd[EXT_CSD_BOOT_MULT] << 17; + part_size = mci->ext_csd[EXT_CSD_BOOT_SIZE_MULT] << 17; partname = basprintf("boot%d", idx); name = basprintf("%s.%s", mci->cdevname, partname); @@ -515,7 +515,7 @@ static int mmc_change_freq(struct mci *mci) MMC_BLK_DATA_AREA_BOOT); } - mci->ext_csd_part_config = mci->ext_csd[EXT_CSD_PART_CONFIG]; + mci->ext_csd_part_config = mci->ext_csd[EXT_CSD_PARTITION_CONFIG]; mci->bootpart = (mci->ext_csd_part_config >> 3) & 0x7; } @@ -770,6 +770,12 @@ static void mci_correct_version_from_ext_csd(struct mci *mci) case 6: mci->version = MMC_VERSION_4_5; break; + case 7: + mci->version = MMC_VERSION_5_0; + break; + case 8: + mci->version = MMC_VERSION_5_1; + break; } } } @@ -863,10 +869,10 @@ static void mci_extract_card_capacity_from_csd(struct mci *mci) csize = UNSTUFF_BITS(mci->csd, 48, 22); mci->capacity = (1 + csize) << 10; } else { - mci->capacity = mci->ext_csd[EXT_CSD_SEC_CNT] << 0 | - mci->ext_csd[EXT_CSD_SEC_CNT + 1] << 8 | - mci->ext_csd[EXT_CSD_SEC_CNT + 2] << 16 | - mci->ext_csd[EXT_CSD_SEC_CNT + 3] << 24; + mci->capacity = mci->ext_csd[EXT_CSD_SEC_COUNT] << 0 | + mci->ext_csd[EXT_CSD_SEC_COUNT + 1] << 8 | + mci->ext_csd[EXT_CSD_SEC_COUNT + 2] << 16 | + mci->ext_csd[EXT_CSD_SEC_COUNT + 3] << 24; } } else { cmult = UNSTUFF_BITS(mci->csd, 47, 3); @@ -907,16 +913,16 @@ static int mmc_compare_ext_csds(struct mci *mci, unsigned bus_width) if (bus_width == MMC_BUS_WIDTH_1) goto out; /* only compare read only fields */ - err = (mci->ext_csd[EXT_CSD_PARTITION_SUPPORT] == - bw_ext_csd[EXT_CSD_PARTITION_SUPPORT]) && + err = (mci->ext_csd[EXT_CSD_PARTITIONING_SUPPORT] == + bw_ext_csd[EXT_CSD_PARTITIONING_SUPPORT]) && (mci->ext_csd[EXT_CSD_ERASED_MEM_CONT] == bw_ext_csd[EXT_CSD_ERASED_MEM_CONT]) && (mci->ext_csd[EXT_CSD_REV] == bw_ext_csd[EXT_CSD_REV]) && - (mci->ext_csd[EXT_CSD_STRUCTURE] == - bw_ext_csd[EXT_CSD_STRUCTURE]) && - (mci->ext_csd[EXT_CSD_CARD_TYPE] == - bw_ext_csd[EXT_CSD_CARD_TYPE]) && + (mci->ext_csd[EXT_CSD_CSD_STRUCTURE] == + bw_ext_csd[EXT_CSD_CSD_STRUCTURE]) && + (mci->ext_csd[EXT_CSD_DEVICE_TYPE] == + bw_ext_csd[EXT_CSD_DEVICE_TYPE]) && (mci->ext_csd[EXT_CSD_S_A_TIMEOUT] == bw_ext_csd[EXT_CSD_S_A_TIMEOUT]) && (mci->ext_csd[EXT_CSD_HC_WP_GRP_SIZE] == @@ -933,14 +939,14 @@ static int mmc_compare_ext_csds(struct mci *mci, unsigned bus_width) bw_ext_csd[EXT_CSD_SEC_FEATURE_SUPPORT]) && (mci->ext_csd[EXT_CSD_TRIM_MULT] == bw_ext_csd[EXT_CSD_TRIM_MULT]) && - (mci->ext_csd[EXT_CSD_SEC_CNT + 0] == - bw_ext_csd[EXT_CSD_SEC_CNT + 0]) && - (mci->ext_csd[EXT_CSD_SEC_CNT + 1] == - bw_ext_csd[EXT_CSD_SEC_CNT + 1]) && - (mci->ext_csd[EXT_CSD_SEC_CNT + 2] == - bw_ext_csd[EXT_CSD_SEC_CNT + 2]) && - (mci->ext_csd[EXT_CSD_SEC_CNT + 3] == - bw_ext_csd[EXT_CSD_SEC_CNT + 3]) ? + (mci->ext_csd[EXT_CSD_SEC_COUNT + 0] == + bw_ext_csd[EXT_CSD_SEC_COUNT + 0]) && + (mci->ext_csd[EXT_CSD_SEC_COUNT + 1] == + bw_ext_csd[EXT_CSD_SEC_COUNT + 1]) && + (mci->ext_csd[EXT_CSD_SEC_COUNT + 2] == + bw_ext_csd[EXT_CSD_SEC_COUNT + 2]) && + (mci->ext_csd[EXT_CSD_SEC_COUNT + 3] == + bw_ext_csd[EXT_CSD_SEC_COUNT + 3]) ? 0 : -EINVAL; out: @@ -1248,7 +1254,7 @@ static int mci_blk_part_switch(struct mci_part *part) part_config |= part->part_cfg; ret = mci_switch(mci, EXT_CSD_CMD_SET_NORMAL, - EXT_CSD_PART_CONFIG, part_config); + EXT_CSD_PARTITION_CONFIG, part_config); if (ret) return ret; @@ -1563,7 +1569,7 @@ static int mci_set_boot(struct param_d *param, void *priv) mci->ext_csd_part_config |= mci->bootpart << 3; return mci_switch(mci, EXT_CSD_CMD_SET_NORMAL, - EXT_CSD_PART_CONFIG, mci->ext_csd_part_config); + EXT_CSD_PARTITION_CONFIG, mci->ext_csd_part_config); } static const char *mci_boot_names[] = { |