|
107 | 107 | #define ESDHC_TUNING_START_TAP_DEFAULT 0x1
|
108 | 108 | #define ESDHC_TUNING_START_TAP_MASK 0x7f
|
109 | 109 | #define ESDHC_TUNING_CMD_CRC_CHECK_DISABLE (1 << 7)
|
| 110 | +#define ESDHC_TUNING_STEP_DEFAULT 0x1 |
110 | 111 | #define ESDHC_TUNING_STEP_MASK 0x00070000
|
111 | 112 | #define ESDHC_TUNING_STEP_SHIFT 16
|
112 | 113 |
|
@@ -1368,7 +1369,7 @@ static void sdhci_esdhc_imx_hwinit(struct sdhci_host *host)
|
1368 | 1369 | struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
|
1369 | 1370 | struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host);
|
1370 | 1371 | struct cqhci_host *cq_host = host->mmc->cqe_private;
|
1371 |
| - int tmp; |
| 1372 | + u32 tmp; |
1372 | 1373 |
|
1373 | 1374 | if (esdhc_is_usdhc(imx_data)) {
|
1374 | 1375 | /*
|
@@ -1423,17 +1424,24 @@ static void sdhci_esdhc_imx_hwinit(struct sdhci_host *host)
|
1423 | 1424 |
|
1424 | 1425 | if (imx_data->socdata->flags & ESDHC_FLAG_STD_TUNING) {
|
1425 | 1426 | tmp = readl(host->ioaddr + ESDHC_TUNING_CTRL);
|
1426 |
| - tmp |= ESDHC_STD_TUNING_EN | |
1427 |
| - ESDHC_TUNING_START_TAP_DEFAULT; |
1428 |
| - if (imx_data->boarddata.tuning_start_tap) { |
1429 |
| - tmp &= ~ESDHC_TUNING_START_TAP_MASK; |
| 1427 | + tmp |= ESDHC_STD_TUNING_EN; |
| 1428 | + |
| 1429 | + /* |
| 1430 | + * ROM code or bootloader may config the start tap |
| 1431 | + * and step, unmask them first. |
| 1432 | + */ |
| 1433 | + tmp &= ~(ESDHC_TUNING_START_TAP_MASK | ESDHC_TUNING_STEP_MASK); |
| 1434 | + if (imx_data->boarddata.tuning_start_tap) |
1430 | 1435 | tmp |= imx_data->boarddata.tuning_start_tap;
|
1431 |
| - } |
| 1436 | + else |
| 1437 | + tmp |= ESDHC_TUNING_START_TAP_DEFAULT; |
1432 | 1438 |
|
1433 | 1439 | if (imx_data->boarddata.tuning_step) {
|
1434 |
| - tmp &= ~ESDHC_TUNING_STEP_MASK; |
1435 | 1440 | tmp |= imx_data->boarddata.tuning_step
|
1436 | 1441 | << ESDHC_TUNING_STEP_SHIFT;
|
| 1442 | + } else { |
| 1443 | + tmp |= ESDHC_TUNING_STEP_DEFAULT |
| 1444 | + << ESDHC_TUNING_STEP_SHIFT; |
1437 | 1445 | }
|
1438 | 1446 |
|
1439 | 1447 | /* Disable the CMD CRC check for tuning, if not, need to
|
|
0 commit comments