diff mbox series

[v3,1/8] board: synquacer: Initialize SCBM SMMU at board_init()

Message ID 162608614422.206671.16863457236408720329.stgit@localhost
State Accepted
Commit 1ad3c8365a7d47f16a11db084e38c3604639fd68
Headers show
Series arm64: synquacer: DeveloperBox updates | expand

Commit Message

Masami Hiramatsu July 12, 2021, 10:35 a.m. UTC
Since the SCBM SMMU is not only connected to the NETSEC
but also shared with the F_SDH30 (eMMC controller), that
should be initialized at board level instead of NETSEC.

Move the SMMU initialization code into board support
and call it from board_init().

Without this fix, if the NETSEC is disabled, the Linux
eMMC ADMA cause an error because SMMU is not initialized.

Signed-off-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>

---
 board/socionext/developerbox/developerbox.c |   15 +++++++++++++++
 drivers/net/sni_netsec.c                    |    7 -------
 2 files changed, 15 insertions(+), 7 deletions(-)

Comments

Tom Rini July 24, 2021, 8:40 p.m. UTC | #1
On Mon, Jul 12, 2021 at 07:35:44PM +0900, Masami Hiramatsu wrote:

> Since the SCBM SMMU is not only connected to the NETSEC

> but also shared with the F_SDH30 (eMMC controller), that

> should be initialized at board level instead of NETSEC.

> 

> Move the SMMU initialization code into board support

> and call it from board_init().

> 

> Without this fix, if the NETSEC is disabled, the Linux

> eMMC ADMA cause an error because SMMU is not initialized.

> 

> Signed-off-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>


Applied to u-boot/master, thanks!

-- 
Tom
diff mbox series

Patch

diff --git a/board/socionext/developerbox/developerbox.c b/board/socionext/developerbox/developerbox.c
index 34335baec3..9552bfcdc3 100644
--- a/board/socionext/developerbox/developerbox.c
+++ b/board/socionext/developerbox/developerbox.c
@@ -62,6 +62,19 @@  DECLARE_GLOBAL_DATA_PTR;
 
 #define LOAD_OFFSET 0x100
 
+/* SCBM System MMU is used for eMMC and NETSEC */
+#define SCBM_SMMU_ADDR				(0x52e00000UL)
+#define SMMU_SCR0_OFFS				(0x0)
+#define SMMU_SCR0_SHCFG_INNER			(0x2 << 22)
+#define SMMU_SCR0_MTCFG				(0x1 << 20)
+#define SMMU_SCR0_MEMATTR_INNER_OUTER_WB	(0xf << 16)
+
+static void synquacer_setup_scbm_smmu(void)
+{
+	writel(SMMU_SCR0_SHCFG_INNER | SMMU_SCR0_MTCFG | SMMU_SCR0_MEMATTR_INNER_OUTER_WB,
+	       SCBM_SMMU_ADDR + SMMU_SCR0_OFFS);
+}
+
 /*
  * Miscellaneous platform dependent initialisations
  */
@@ -71,6 +84,8 @@  int board_init(void)
 
 	gd->env_addr = (ulong)&default_environment[0];
 
+	synquacer_setup_scbm_smmu();
+
 	return 0;
 }
 
diff --git a/drivers/net/sni_netsec.c b/drivers/net/sni_netsec.c
index a9ebf6af9c..4901321d0c 100644
--- a/drivers/net/sni_netsec.c
+++ b/drivers/net/sni_netsec.c
@@ -1059,18 +1059,11 @@  static int netsec_of_to_plat(struct udevice *dev)
 	return 0;
 }
 
-#define SMMU_SCR0_SHCFG_INNER             (0x2 << 22)
-#define SMMU_SCR0_MTCFG                   (0x1 << 20)
-#define SMMU_SCR0_MEMATTR_INNER_OUTER_WB  (0xf << 16)
-
 static int netsec_probe(struct udevice *dev)
 {
 	struct netsec_priv *priv = dev_get_priv(dev);
 	int ret;
 
-	writel(SMMU_SCR0_SHCFG_INNER | SMMU_SCR0_MTCFG | SMMU_SCR0_MEMATTR_INNER_OUTER_WB,
-	       (phys_addr_t)0x52E00000);
-
 	netsec_reset_hardware(priv, true);
 
 	ret = netsec_mdiobus_init(priv, dev->name);