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

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

378 Views
koikekazuma
Contributor I

■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?

Labels (1)
0 Kudos
1 Reply

270 Views
igorpadykov
NXP Employee
NXP Employee

Hi koike

i.mx uSDHC driver is described in attached Linux Manual Chapter 32,

according to Table 32-5. uSDHC Driver Files MMC/SD Driver Files

sdhci.c is sdhci standard stack code, so not all its functions are used for i.mx.

For register reading one can use memtool in imx-test package:
www.nxp.com/lgfiles/NMG/MAD/YOCTO/imx-test-5.7.tar.gz

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos