diff options
Diffstat (limited to 'drivers/mmc/host/sdhci-of-esdhc.c')
-rw-r--r-- | drivers/mmc/host/sdhci-of-esdhc.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c index ff4adc018041..5d876ff86f37 100644 --- a/drivers/mmc/host/sdhci-of-esdhc.c +++ b/drivers/mmc/host/sdhci-of-esdhc.c | |||
@@ -38,6 +38,23 @@ static u8 esdhc_readb(struct sdhci_host *host, int reg) | |||
38 | int base = reg & ~0x3; | 38 | int base = reg & ~0x3; |
39 | int shift = (reg & 0x3) * 8; | 39 | int shift = (reg & 0x3) * 8; |
40 | u8 ret = (in_be32(host->ioaddr + base) >> shift) & 0xff; | 40 | u8 ret = (in_be32(host->ioaddr + base) >> shift) & 0xff; |
41 | |||
42 | /* | ||
43 | * "DMA select" locates at offset 0x28 in SD specification, but on | ||
44 | * P5020 or P3041, it locates at 0x29. | ||
45 | */ | ||
46 | if (reg == SDHCI_HOST_CONTROL) { | ||
47 | u32 dma_bits; | ||
48 | |||
49 | dma_bits = in_be32(host->ioaddr + reg); | ||
50 | /* DMA select is 22,23 bits in Protocol Control Register */ | ||
51 | dma_bits = (dma_bits >> 5) & SDHCI_CTRL_DMA_MASK; | ||
52 | |||
53 | /* fixup the result */ | ||
54 | ret &= ~SDHCI_CTRL_DMA_MASK; | ||
55 | ret |= dma_bits; | ||
56 | } | ||
57 | |||
41 | return ret; | 58 | return ret; |
42 | } | 59 | } |
43 | 60 | ||
@@ -56,6 +73,21 @@ static void esdhc_writew(struct sdhci_host *host, u16 val, int reg) | |||
56 | 73 | ||
57 | static void esdhc_writeb(struct sdhci_host *host, u8 val, int reg) | 74 | static void esdhc_writeb(struct sdhci_host *host, u8 val, int reg) |
58 | { | 75 | { |
76 | /* | ||
77 | * "DMA select" location is offset 0x28 in SD specification, but on | ||
78 | * P5020 or P3041, it's located at 0x29. | ||
79 | */ | ||
80 | if (reg == SDHCI_HOST_CONTROL) { | ||
81 | u32 dma_bits; | ||
82 | |||
83 | /* DMA select is 22,23 bits in Protocol Control Register */ | ||
84 | dma_bits = (val & SDHCI_CTRL_DMA_MASK) << 5; | ||
85 | clrsetbits_be32(host->ioaddr + reg , SDHCI_CTRL_DMA_MASK << 5, | ||
86 | dma_bits); | ||
87 | val &= ~SDHCI_CTRL_DMA_MASK; | ||
88 | val |= in_be32(host->ioaddr + reg) & SDHCI_CTRL_DMA_MASK; | ||
89 | } | ||
90 | |||
59 | /* Prevent SDHCI core from writing reserved bits (e.g. HISPD). */ | 91 | /* Prevent SDHCI core from writing reserved bits (e.g. HISPD). */ |
60 | if (reg == SDHCI_HOST_CONTROL) | 92 | if (reg == SDHCI_HOST_CONTROL) |
61 | val &= ~ESDHC_HOST_CONTROL_RES; | 93 | val &= ~ESDHC_HOST_CONTROL_RES; |