Skip to content

Commit 35ca91d

Browse files
saprojstorulf
authored andcommitted
mmc: moxart: fix 4-bit bus width and remove 8-bit bus width
According to the datasheet [1] at page 377, 4-bit bus width is turned on by bit 2 of the Bus Width Register. Thus the current bitmask is wrong: define BUS_WIDTH_4 BIT(1) BIT(1) does not work but BIT(2) works. This has been verified on real MOXA hardware with FTSDC010 controller revision 1_6_0. The corrected value of BUS_WIDTH_4 mask collides with: define BUS_WIDTH_8 BIT(2). Additionally, 8-bit bus width mode isn't supported according to the datasheet, so let's remove the corresponding code. [1] https://bitbucket.org/Kasreyn/mkrom-uc7112lx/src/master/documents/FIC8120_DS_v1.2.pdf Fixes: 1b66e94 ("mmc: moxart: Add MOXA ART SD/MMC driver") Signed-off-by: Sergei Antonov <[email protected]> Cc: Jonas Jensen <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Ulf Hansson <[email protected]>
1 parent faded9b commit 35ca91d

File tree

1 file changed

+3
-14
lines changed

1 file changed

+3
-14
lines changed

drivers/mmc/host/moxart-mmc.c

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@
111111
#define CLK_DIV_MASK 0x7f
112112

113113
/* REG_BUS_WIDTH */
114-
#define BUS_WIDTH_8 BIT(2)
115-
#define BUS_WIDTH_4 BIT(1)
114+
#define BUS_WIDTH_4_SUPPORT BIT(3)
115+
#define BUS_WIDTH_4 BIT(2)
116116
#define BUS_WIDTH_1 BIT(0)
117117

118118
#define MMC_VDD_360 23
@@ -524,9 +524,6 @@ static void moxart_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
524524
case MMC_BUS_WIDTH_4:
525525
writel(BUS_WIDTH_4, host->base + REG_BUS_WIDTH);
526526
break;
527-
case MMC_BUS_WIDTH_8:
528-
writel(BUS_WIDTH_8, host->base + REG_BUS_WIDTH);
529-
break;
530527
default:
531528
writel(BUS_WIDTH_1, host->base + REG_BUS_WIDTH);
532529
break;
@@ -651,16 +648,8 @@ static int moxart_probe(struct platform_device *pdev)
651648
dmaengine_slave_config(host->dma_chan_rx, &cfg);
652649
}
653650

654-
switch ((readl(host->base + REG_BUS_WIDTH) >> 3) & 3) {
655-
case 1:
651+
if (readl(host->base + REG_BUS_WIDTH) & BUS_WIDTH_4_SUPPORT)
656652
mmc->caps |= MMC_CAP_4_BIT_DATA;
657-
break;
658-
case 2:
659-
mmc->caps |= MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA;
660-
break;
661-
default:
662-
break;
663-
}
664653

665654
writel(0, host->base + REG_INTERRUPT_MASK);
666655

0 commit comments

Comments
 (0)