AnsweredAssumed Answered

imx6q: sdhci driver read incorrect register value when use sdhci_readb().

Question asked by koike kazuma on Apr 4, 2017
Latest reply on Apr 7, 2017 by igorpadykov

■Occurrence phenomenon
When sdhci_readb () is used to read the register value of the SD host controller in kernel_imx / driver / mmc / host / sdhci.c, the return value may be incorrect.

 

■Details

In sdhci_readb (), in order to absorb the specification difference of register of SD host controller,  try to read by referring to ops of ".read_b"  for each SD host controller platform as bellow.

 

static inline u8 sdhci_readb(struct sdhci_host *host, int reg)
{
if (unlikely(host->ops->read_b))
return host->ops->read_b(host, reg);
else
return readb(host->ioaddr + reg);
}


However, since ".read_b" is undefined in ops in sdhci-esdhc-imx.c which is the reference destination, the value without correction is returned as it is as the read result.

Therefore, when byte-reading a register that has a register configuration different from that of the SD host controller standard (Host Control Register (Offset 028h) etc.) seems to be reading a different value from the actual one.

 

· Ops of host (mmc / host / sdhci-esdhc-imx.c)

 .read_b is undefined.
Static struct sdhci_ops sdhci_esdhc_ops = {
    .read_l = esdhc_readl_le,
    .read_w = esdhc_readw_le,
    .write_l = esdhc_writel_le,
    .write_w = esdhc_writew_le,
    .write_b = esdhc_writeb_le,
    .set_clock = esdhc_pltfm_set_clock,
    .get_max_clock = esdhc_pltfm_get_max_clock,
    .get_min_clock = esdhc_pltfm_get_min_clock,
    .get_max_timeout_count = esdhc_get_max_timeout_count,
    .get_ro = esdhc_pltfm_get_ro,
    .set_timeout = esdhc_set_timeout,
    .set_bus_width = esdhc_pltfm_set_bus_width,
    .set_uhs_signaling = esdhc_set_uhs_signaling,
    .reset = esdhc_reset,
    .hw_reset = esdhc_hw_reset,
};

 

■ Question

 · sdhci_readb () is exists on current code and this method is actually called at execution time (when led activate/deactivate ,etc...), but is there a possibility that trouble may occur by reading different values Is it?

Outcomes