Skip to contentSkip to conversation

mmc: fsl_esdhc: actually enable cache snooping on mpc830x

PATCH New Rasmus Villemoes 3 participants 4 messages Jan 30, 2020 – Feb 11, 2020 MMC, SD and SDIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mmc: fsl_esdhc: actually enable cache snooping on mpc830x

The reference manuals for MPC8308 and MPC8309 both say that the esdhcctl aka DMA Control Register "is implemented as SDHCCR" in the System configuration registers. Unfortunately, that doesn't mean that the registers are just mirrors of each other - any write to esdhcctl is simply ignored. So to actually enable cache snooping, we unfortunately have to add a little ifdeffery.

There is, naturally, no description of the bit fields of esdhcctl in the MPC8309 manual, but comparing the description of esdhcctl from the LS1021A reference manual to the description of the sdhccr in MPC8309, one also finds that the fields are bit-reversed, so the bit to set is 0x02000000 rather than 0x00000040 - this is also what board_mmc_init() uses in the two gdsys/mpc8308/ boards.

---
 drivers/mmc/fsl_esdhc.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
drivers/mmc/fsl_esdhc.c +13 -2
index 1e7d606cd8..34e5bd270f 100644
@@ -577,6 +577,18 @@ static int esdhc_set_ios_common(struct fsl_esdhc_priv *priv, struct mmc *mmc)
 	return 0;
 }
 
+static void esdhc_enable_cache_snooping(struct fsl_esdhc *regs)
+{
+#ifdef CONFIG_ARCH_MPC830X
+	immap_t *immr = (immap_t *)CONFIG_SYS_IMMR;
+	sysconf83xx_t *sysconf = &immr->sysconf;
+
+	setbits_be32(&sysconf->sdhccr, 0x02000000);
+#else
+	esdhc_write32(&regs->esdhcctl, 0x00000040);
+#endif
+}
+
 static int esdhc_init_common(struct fsl_esdhc_priv *priv, struct mmc *mmc)
 {
 	struct fsl_esdhc *regs = priv->esdhc_regs;
@@ -592,8 +604,7 @@ static int esdhc_init_common(struct fsl_esdhc_priv *priv, struct mmc *mmc)
 			return -ETIMEDOUT;
 	}
 
-	/* Enable cache snooping */
-	esdhc_write32(&regs->esdhcctl, 0x00000040);
+	esdhc_enable_cache_snooping(regs);
 
 	esdhc_setbits32(&regs->sysctl, SYSCTL_HCKEN | SYSCTL_IPGEN);
 
Signature · 1 line
2.23.0
#1 lore raw

PATCH 1/1 mmc: fsl_esdhc: actually enable cache snooping on mpc830x

Quoted 1 line

Subject: [PATCH] mmc: fsl_esdhc: actually enable cache snooping on mpc830x

+ Y.b

Are you ok with this patch?

Thanks,
Peng.

Quoted 52 lines

The reference manuals for MPC8308 and MPC8309 both say that the esdhcctl aka DMA Control Register "is implemented as SDHCCR" in the System configuration registers. Unfortunately, that doesn't mean that the registers are just mirrors of each other - any write to esdhcctl is simply ignored. So to actually enable cache snooping, we unfortunately have to add a little ifdeffery.

There is, naturally, no description of the bit fields of esdhcctl in the MPC8309 manual, but comparing the description of esdhcctl from the LS1021A reference manual to the description of the sdhccr in MPC8309, one also finds that the fields are bit-reversed, so the bit to set is
0x02000000 rather than 0x00000040 - this is also what board_mmc_init() uses in the two gdsys/mpc8308/ boards.

---
 drivers/mmc/fsl_esdhc.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
drivers/mmc/fsl_esdhc.c index renamed from drivers/mmc/fsl_esdhc.c +0 -0

1e7d606cd8..34e5bd270f 100644

drivers/mmc/fsl_esdhc.c +8 -0
@@ -577,6 +577,18 @@ static int esdhc_set_ios_common(struct
 fsl_esdhc_priv *priv, struct mmc *mmc)
 	return 0;
 }
 
+static void esdhc_enable_cache_snooping(struct fsl_esdhc *regs) {
+#ifdef CONFIG_ARCH_MPC830X
+	immap_t *immr = (immap_t *)CONFIG_SYS_IMMR;
+	sysconf83xx_t *sysconf = &immr->sysconf;
+
+	setbits_be32(&sysconf->sdhccr, 0x02000000); #else
+	esdhc_write32(&regs->esdhcctl, 0x00000040); #endif }
+
 static int esdhc_init_common(struct fsl_esdhc_priv *priv, struct mmc *mmc)
 {
 	struct fsl_esdhc *regs = priv->esdhc_regs; @@ -592,8 +604,7 @@ static

int esdhc_init_common(struct fsl_esdhc_priv *priv, struct mmc *mmc)

drivers/mmc/fsl_esdhc.c +1 -3
 			return -ETIMEDOUT;
 	}
 
-	/* Enable cache snooping */
-	esdhc_write32(&regs->esdhcctl, 0x00000040);
+	esdhc_enable_cache_snooping(regs);
 
 	esdhc_setbits32(&regs->sysctl, SYSCTL_HCKEN | SYSCTL_IPGEN);
 
--

2.23.0

#2 lore raw

PATCH 1/1 mmc: fsl_esdhc: actually enable cache snooping on mpc830x

Quoted 9 lines

-----Original Message-----
From: Peng Fan <[email protected]>
Sent: Wednesday, February 5, 2020 3:08 PM
To: Rasmus Villemoes <[email protected]>; u-boot at lists.denx.de; Y.b. Lu <[email protected]>
Cc: Mario Six <[email protected]>
Subject: RE: [PATCH] mmc: fsl_esdhc: actually enable cache snooping on mpc830x

Quoted 6 lines
Quoted 1 line

Subject: [PATCH] mmc: fsl_esdhc: actually enable cache snooping on

mpc830x

+ Y.b

Are you ok with this patch?

The mpc830x is old Freescale PowerPC platforms I don't have. But I agree the fix-up.

Quoted 59 lines

Thanks,
Peng.

Quoted 2 lines

The reference manuals for MPC8308 and MPC8309 both say that the

esdhcctl

Quoted 2 lines

aka DMA Control Register "is implemented as SDHCCR" in the System configuration registers. Unfortunately, that doesn't mean that the registers

are

Quoted 24 lines

just mirrors of each other - any write to esdhcctl is simply ignored. So to actually enable cache snooping, we unfortunately have to add a little ifdeffery.

There is, naturally, no description of the bit fields of esdhcctl in the MPC8309 manual, but comparing the description of esdhcctl from the LS1021A reference manual to the description of the sdhccr in MPC8309, one also finds that the fields are bit-reversed, so the bit to set is
0x02000000 rather than 0x00000040 - this is also what board_mmc_init() uses in the two gdsys/mpc8308/ boards.

---
 drivers/mmc/fsl_esdhc.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
drivers/mmc/fsl_esdhc.c index renamed from drivers/mmc/fsl_esdhc.c +0 -0

1e7d606cd8..34e5bd270f 100644

drivers/mmc/fsl_esdhc.c +0 -0
@@ -577,6 +577,18 @@ static int esdhc_set_ios_common(struct
 fsl_esdhc_priv *priv, struct mmc *mmc)
 	return 0;
 }

drivers/mmc/fsl_esdhc.c static int esdhc_set_ios_common(struct · line 589

Quoted 10 lines
drivers/mmc/fsl_esdhc.c +8 -0
 
+static void esdhc_enable_cache_snooping(struct fsl_esdhc *regs) {
+#ifdef CONFIG_ARCH_MPC830X
+	immap_t *immr = (immap_t *)CONFIG_SYS_IMMR;
+	sysconf83xx_t *sysconf = &immr->sysconf;
+
+	setbits_be32(&sysconf->sdhccr, 0x02000000); #else
+	esdhc_write32(&regs->esdhcctl, 0x00000040); #endif }
+
 static int esdhc_init_common(struct fsl_esdhc_priv *priv, struct mmc

*mmc)

Quoted 14 lines
drivers/mmc/fsl_esdhc.c +0 -0
 {
 	struct fsl_esdhc *regs = priv->esdhc_regs; @@ -592,8 +604,7 @@ static

int esdhc_init_common(struct fsl_esdhc_priv *priv, struct mmc *mmc)

drivers/mmc/fsl_esdhc.c +1 -3
 			return -ETIMEDOUT;
 	}
 
-	/* Enable cache snooping */
-	esdhc_write32(&regs->esdhcctl, 0x00000040);
+	esdhc_enable_cache_snooping(regs);
 
 	esdhc_setbits32(&regs->sysctl, SYSCTL_HCKEN | SYSCTL_IPGEN);
 
--

2.23.0

#3 lore raw

PATCH 1/1 mmc: fsl_esdhc: actually enable cache snooping on mpc830x

Quoted 12 lines · Y.b. Lu
Quoted 12 lines

-----Original Message-----
From: Peng Fan <[email protected]>
Sent: Wednesday, February 5, 2020 3:08 PM
To: Rasmus Villemoes <[email protected]>; u-boot at lists.denx.de; Y.b. Lu <[email protected]>
Cc: Mario Six <[email protected]>
Subject: RE: [PATCH] mmc: fsl_esdhc: actually enable cache snooping on mpc830x

Quoted 1 line

Subject: [PATCH] mmc: fsl_esdhc: actually enable cache snooping on

mpc830x

Quoted 8 lines
Quoted 3 lines

+ Y.b

Are you ok with this patch?

The mpc830x is old Freescale PowerPC platforms I don't have. But I agree the fix-up.

Thanks. Any chance this could make it to master before the 2020.04 release?

Rasmus