Skip to contentSkip to conversation

clk: renesas: Fix swapped arguments in debug message

PATCH New Marek Vasut 2 participants 16 messages Jun 1, 2018 – Jun 6, 2018

Subsystems (11)
lore
Share & tools
lore
#0 lore raw

PATCH 1/15 clk: renesas: Fix swapped arguments in debug message

The mul and div arguments were reported in reverse order in the debug message, swap them to fix this.

Cc Nobuhiro Iwamatsu <[email protected]>
---
 drivers/clk/renesas/clk-rcar-gen3.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/renesas/clk-rcar-gen3.c +1 -1
index 3a95647abe..4f10fd6352 100644
@@ -230,7 +230,7 @@ static ulong gen3_clk_get_rate(struct clk *clk)
 	case CLK_TYPE_FF:
 	case CLK_TYPE_GEN3_PE:		/* FIXME */
 		rate = (gen3_clk_get_rate(&parent) * core->mult) / core->div;
-		debug("%s[%i] FIXED clk: parent=%i div=%i mul=%i => rate=%u\n",
+		debug("%s[%i] FIXED clk: parent=%i mul=%i div=%i => rate=%u\n",
 		      __func__, __LINE__,
 		      core->parent, core->mult, core->div, rate);
 		return rate;
Signature · 1 line
2.16.2
#1 lore raw

PATCH 2/15 clk: renesas: Pass clock rate around as 64bit number internally

The PLL rate could be in the GHz range, which could overflow a 32bit data type. Since the hardware is 64bit anyway, pass the clock rates as 64bit number internally to avoid this.

Cc Nobuhiro Iwamatsu <[email protected]>
---
 drivers/clk/renesas/clk-rcar-gen3.c | 56 ++++++++++++++++++++-----------------
 1 file changed, 31 insertions(+), 25 deletions(-)
drivers/clk/renesas/clk-rcar-gen3.c +31 -25
index 4f10fd6352..834cd5ac58 100644
@@ -134,7 +134,7 @@ static int gen3_clk_disable(struct clk *clk)
 	return renesas_clk_endisable(clk, priv->base, false);
 }
 
-static ulong gen3_clk_get_rate(struct clk *clk)
+static u64 gen3_clk_get_rate64(struct clk *clk)
 {
 	struct gen3_clk_priv *priv = dev_get_priv(clk->dev);
 	struct cpg_mssr_info *info = priv->info;
@@ -142,7 +142,8 @@ static ulong gen3_clk_get_rate(struct clk *clk)
 	const struct cpg_core_clk *core;
 	const struct rcar_gen3_cpg_pll_config *pll_config =
 					priv->cpg_pll_config;
-	u32 value, mult, prediv, postdiv, rate = 0;
+	u32 value, mult, prediv, postdiv;
+	u64 rate = 0;
 	int i, ret;
 
 	debug("%s[%i] Clock: id=%lu\n", __func__, __LINE__, clk->id);
@@ -154,8 +155,8 @@ static ulong gen3_clk_get_rate(struct clk *clk)
 	}
 
 	if (renesas_clk_is_mod(clk)) {
-		rate = gen3_clk_get_rate(&parent);
-		debug("%s[%i] MOD clk: parent=%lu => rate=%u\n",
+		rate = gen3_clk_get_rate64(&parent);
+		debug("%s[%i] MOD clk: parent=%lu => rate=%llu\n",
 		      __func__, __LINE__, parent.id, rate);
 		return rate;
 	}
@@ -168,14 +169,14 @@ static ulong gen3_clk_get_rate(struct clk *clk)
 	case CLK_TYPE_IN:
 		if (core->id == info->clk_extal_id) {
 			rate = clk_get_rate(&priv->clk_extal);
-			debug("%s[%i] EXTAL clk: rate=%u\n",
+			debug("%s[%i] EXTAL clk: rate=%llu\n",
 			      __func__, __LINE__, rate);
 			return rate;
 		}
 
 		if (core->id == info->clk_extalr_id) {
 			rate = clk_get_rate(&priv->clk_extalr);
-			debug("%s[%i] EXTALR clk: rate=%u\n",
+			debug("%s[%i] EXTALR clk: rate=%llu\n",
 			      __func__, __LINE__, rate);
 			return rate;
 		}
@@ -183,8 +184,8 @@ static ulong gen3_clk_get_rate(struct clk *clk)
 		return -EINVAL;
 
 	case CLK_TYPE_GEN3_MAIN:
-		rate = gen3_clk_get_rate(&parent) / pll_config->extal_div;
-		debug("%s[%i] MAIN clk: parent=%i extal_div=%i => rate=%u\n",
+		rate = gen3_clk_get_rate64(&parent) / pll_config->extal_div;
+		debug("%s[%i] MAIN clk: parent=%i extal_div=%i => rate=%llu\n",
 		      __func__, __LINE__,
 		      core->parent, pll_config->extal_div, rate);
 		return rate;
@@ -192,14 +193,14 @@ static ulong gen3_clk_get_rate(struct clk *clk)
 	case CLK_TYPE_GEN3_PLL0:
 		value = readl(priv->base + CPG_PLL0CR);
 		mult = (((value >> 24) & 0x7f) + 1) * 2;
-		rate = gen3_clk_get_rate(&parent) * mult;
-		debug("%s[%i] PLL0 clk: parent=%i mult=%u => rate=%u\n",
+		rate = gen3_clk_get_rate64(&parent) * mult;
+		debug("%s[%i] PLL0 clk: parent=%i mult=%u => rate=%llu\n",
 		      __func__, __LINE__, core->parent, mult, rate);
 		return rate;
 
 	case CLK_TYPE_GEN3_PLL1:
-		rate = gen3_clk_get_rate(&parent) * pll_config->pll1_mult;
-		debug("%s[%i] PLL1 clk: parent=%i mul=%i => rate=%u\n",
+		rate = gen3_clk_get_rate64(&parent) * pll_config->pll1_mult;
+		debug("%s[%i] PLL1 clk: parent=%i mul=%i => rate=%llu\n",
 		      __func__, __LINE__,
 		      core->parent, pll_config->pll1_mult, rate);
 		return rate;
@@ -207,14 +208,14 @@ static ulong gen3_clk_get_rate(struct clk *clk)
 	case CLK_TYPE_GEN3_PLL2:
 		value = readl(priv->base + CPG_PLL2CR);
 		mult = (((value >> 24) & 0x7f) + 1) * 2;
-		rate = gen3_clk_get_rate(&parent) * mult;
-		debug("%s[%i] PLL2 clk: parent=%i mult=%u => rate=%u\n",
+		rate = gen3_clk_get_rate64(&parent) * mult;
+		debug("%s[%i] PLL2 clk: parent=%i mult=%u => rate=%llu\n",
 		      __func__, __LINE__, core->parent, mult, rate);
 		return rate;
 
 	case CLK_TYPE_GEN3_PLL3:
-		rate = gen3_clk_get_rate(&parent) * pll_config->pll3_mult;
-		debug("%s[%i] PLL3 clk: parent=%i mul=%i => rate=%u\n",
+		rate = gen3_clk_get_rate64(&parent) * pll_config->pll3_mult;
+		debug("%s[%i] PLL3 clk: parent=%i mul=%i => rate=%llu\n",
 		      __func__, __LINE__,
 		      core->parent, pll_config->pll3_mult, rate);
 		return rate;
@@ -222,15 +223,15 @@ static ulong gen3_clk_get_rate(struct clk *clk)
 	case CLK_TYPE_GEN3_PLL4:
 		value = readl(priv->base + CPG_PLL4CR);
 		mult = (((value >> 24) & 0x7f) + 1) * 2;
-		rate = gen3_clk_get_rate(&parent) * mult;
-		debug("%s[%i] PLL4 clk: parent=%i mult=%u => rate=%u\n",
+		rate = gen3_clk_get_rate64(&parent) * mult;
+		debug("%s[%i] PLL4 clk: parent=%i mult=%u => rate=%llu\n",
 		      __func__, __LINE__, core->parent, mult, rate);
 		return rate;
 
 	case CLK_TYPE_FF:
 	case CLK_TYPE_GEN3_PE:		/* FIXME */
-		rate = (gen3_clk_get_rate(&parent) * core->mult) / core->div;
-		debug("%s[%i] FIXED clk: parent=%i mul=%i div=%i => rate=%u\n",
+		rate = (gen3_clk_get_rate64(&parent) * core->mult) / core->div;
+		debug("%s[%i] FIXED clk: parent=%i mul=%i div=%i => rate=%llu\n",
 		      __func__, __LINE__,
 		      core->parent, core->mult, core->div, rate);
 		return rate;
@@ -243,9 +244,9 @@ static ulong gen3_clk_get_rate(struct clk *clk)
 			if (cpg_sd_div_table[i].val != value)
 				continue;
 
-			rate = gen3_clk_get_rate(&parent) /
+			rate = gen3_clk_get_rate64(&parent) /
 			       cpg_sd_div_table[i].div;
-			debug("%s[%i] SD clk: parent=%i div=%i => rate=%u\n",
+			debug("%s[%i] SD clk: parent=%i div=%i => rate=%llu\n",
 			      __func__, __LINE__,
 			      core->parent, cpg_sd_div_table[i].div, rate);
 
@@ -255,7 +256,7 @@ static ulong gen3_clk_get_rate(struct clk *clk)
 		return -EINVAL;
 
 	case CLK_TYPE_GEN3_RPC:
-		rate = gen3_clk_get_rate(&parent);
+		rate = gen3_clk_get_rate64(&parent);
 
 		value = readl(priv->base + core->offset);
 
@@ -272,7 +273,7 @@ static ulong gen3_clk_get_rate(struct clk *clk)
 			  CPG_RPC_POSTDIV_MASK;
 		rate /= postdiv + 1;
 
-		debug("%s[%i] RPC clk: parent=%i prediv=%i postdiv=%i => rate=%u\n",
+		debug("%s[%i] RPC clk: parent=%i prediv=%i postdiv=%i => rate=%llu\n",
 		      __func__, __LINE__,
 		      core->parent, prediv, postdiv, rate);
 
@@ -285,11 +286,16 @@ static ulong gen3_clk_get_rate(struct clk *clk)
 	return -ENOENT;
 }
 
+static ulong gen3_clk_get_rate(struct clk *clk)
+{
+	return gen3_clk_get_rate64(clk);
+}
+
 static ulong gen3_clk_set_rate(struct clk *clk, ulong rate)
 {
 	/* Force correct SD-IF divider configuration if applicable */
 	gen3_clk_setup_sdif_div(clk);
-	return gen3_clk_get_rate(clk);
+	return gen3_clk_get_rate64(clk);
 }
 
 static int gen3_clk_of_xlate(struct clk *clk, struct ofnode_phandle_args *args)
Signature · 1 line
2.16.2
#2 lore raw

PATCH 3/15 clk: renesas: Add PLL1 and PLL3 dividers

In reply to Marek Vasut

Add and use the PLL1 and PLL3 dividers.

Cc Nobuhiro Iwamatsu <[email protected]>
---
 drivers/clk/renesas/clk-rcar-gen3.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/clk/renesas/clk-rcar-gen3.c +8 -4
index 834cd5ac58..f2550598a4 100644
@@ -200,9 +200,11 @@ static u64 gen3_clk_get_rate64(struct clk *clk)
 
 	case CLK_TYPE_GEN3_PLL1:
 		rate = gen3_clk_get_rate64(&parent) * pll_config->pll1_mult;
-		debug("%s[%i] PLL1 clk: parent=%i mul=%i => rate=%llu\n",
+		rate /= pll_config->pll1_div;
+		debug("%s[%i] PLL1 clk: parent=%i mul=%i div=%i => rate=%llu\n",
 		      __func__, __LINE__,
-		      core->parent, pll_config->pll1_mult, rate);
+		      core->parent, pll_config->pll1_mult,
+		      pll_config->pll1_div, rate);
 		return rate;
 
 	case CLK_TYPE_GEN3_PLL2:
@@ -215,9 +217,11 @@ static u64 gen3_clk_get_rate64(struct clk *clk)
 
 	case CLK_TYPE_GEN3_PLL3:
 		rate = gen3_clk_get_rate64(&parent) * pll_config->pll3_mult;
-		debug("%s[%i] PLL3 clk: parent=%i mul=%i => rate=%llu\n",
+		rate /= pll_config->pll3_div;
+		debug("%s[%i] PLL3 clk: parent=%i mul=%i div=%i => rate=%llu\n",
 		      __func__, __LINE__,
-		      core->parent, pll_config->pll3_mult, rate);
+		      core->parent, pll_config->pll3_mult,
+		      pll_config->pll3_div, rate);
 		return rate;
 
 	case CLK_TYPE_GEN3_PLL4:
Signature · 1 line
2.16.2
#3 lore raw

PATCH 4/15 clk: renesas: Add PE clock handling

In reply to Marek Vasut

The PE clock have two parents, add support for picking the correct one and deriving the clock from it.

Cc Nobuhiro Iwamatsu <[email protected]>
---
 drivers/clk/renesas/clk-rcar-gen3.c | 40 +++++++++++++++++++++++++++++++++----
 drivers/clk/renesas/rcar-gen3-cpg.h |  6 ++++--
 2 files changed, 40 insertions(+), 6 deletions(-)
drivers/clk/renesas/clk-rcar-gen3.c +36 -4
index f2550598a4..99698b1f46 100644
@@ -85,6 +85,28 @@ static const struct sd_div_table cpg_sd_div_table[] = {
 	CPG_SD_DIV_TABLE_DATA(1,        0,        4,          0,       32),
 };
 
+static int gen3_clk_get_parent(struct gen3_clk_priv *priv, struct clk *clk,
+			       struct cpg_mssr_info *info, struct clk *parent)
+{
+	const struct cpg_core_clk *core;
+	int ret;
+
+	if (!renesas_clk_is_mod(clk)) {
+		ret = renesas_clk_get_core(clk, info, &core);
+		if (ret)
+			return ret;
+
+		if (core->type == CLK_TYPE_GEN3_PE) {
+			parent->dev = clk->dev;
+			parent->id = core->parent >> (priv->sscg ? 16 : 0);
+			parent->id &= 0xffff;
+			return 0;
+		}
+	}
+
+	return renesas_clk_get_parent(clk, info, parent);
+}
+
 static int gen3_clk_setup_sdif_div(struct clk *clk)
 {
 	struct gen3_clk_priv *priv = dev_get_priv(clk->dev);
@@ -93,7 +115,7 @@ static int gen3_clk_setup_sdif_div(struct clk *clk)
 	struct clk parent;
 	int ret;
 
-	ret = renesas_clk_get_parent(clk, info, &parent);
+	ret = gen3_clk_get_parent(priv, clk, info, &parent);
 	if (ret) {
 		printf("%s[%i] parent fail, ret=%i\n", __func__, __LINE__, ret);
 		return ret;
@@ -142,13 +164,13 @@ static u64 gen3_clk_get_rate64(struct clk *clk)
 	const struct cpg_core_clk *core;
 	const struct rcar_gen3_cpg_pll_config *pll_config =
 					priv->cpg_pll_config;
-	u32 value, mult, prediv, postdiv;
+	u32 value, mult, div, prediv, postdiv;
 	u64 rate = 0;
 	int i, ret;
 
 	debug("%s[%i] Clock: id=%lu\n", __func__, __LINE__, clk->id);
 
-	ret = renesas_clk_get_parent(clk, info, &parent);
+	ret = gen3_clk_get_parent(priv, clk, info, &parent);
 	if (ret) {
 		printf("%s[%i] parent fail, ret=%i\n", __func__, __LINE__, ret);
 		return ret;
@@ -233,13 +255,21 @@ static u64 gen3_clk_get_rate64(struct clk *clk)
 		return rate;
 
 	case CLK_TYPE_FF:
-	case CLK_TYPE_GEN3_PE:		/* FIXME */
 		rate = (gen3_clk_get_rate64(&parent) * core->mult) / core->div;
 		debug("%s[%i] FIXED clk: parent=%i mul=%i div=%i => rate=%llu\n",
 		      __func__, __LINE__,
 		      core->parent, core->mult, core->div, rate);
 		return rate;
 
+	case CLK_TYPE_GEN3_PE:
+		div = (core->div >> (priv->sscg ? 16 : 0)) & 0xffff;
+		rate = gen3_clk_get_rate64(&parent) / div;
+		debug("%s[%i] PE clk: parent=%i div=%u => rate=%llu\n",
+		      __func__, __LINE__,
+		      (core->parent >> (priv->sscg ? 16 : 0)) & 0xffff,
+		      div, rate);
+		return rate;
+
 	case CLK_TYPE_GEN3_SD:		/* FIXME */
 		value = readl(priv->base + core->offset);
 		value &= CPG_SD_STP_MASK | CPG_SD_FC_MASK;
@@ -351,6 +381,8 @@ int gen3_clk_probe(struct udevice *dev)
 	if (!priv->cpg_pll_config->extal_div)
 		return -EINVAL;
 
+	priv->sscg = !(cpg_mode & BIT(12));
+
 	ret = clk_get_by_name(dev, "extal", &priv->clk_extal);
 	if (ret < 0)
 		return ret;
drivers/clk/renesas/rcar-gen3-cpg.h +4 -2
index 2f410df42a..58e71f363c 100644
@@ -31,8 +31,9 @@ enum rcar_gen3_clk_types {
 	DEF_BASE(_name, _id, CLK_TYPE_GEN3_RPC, _parent, .offset = _offset)
 #define DEF_GEN3_PE(_name, _id, _parent_sscg, _div_sscg, _parent_clean, \
 		    _div_clean) \
-	DEF_BASE(_name, _id, CLK_TYPE_FF,			\
-		 (_parent_clean), .div = (_div_clean), 1)
+	DEF_BASE(_name, _id, CLK_TYPE_GEN3_PE,			\
+		 (_parent_sscg) << 16 | (_parent_clean),	\
+		 .div = (_div_sscg) << 16 | (_div_clean))
 
 struct rcar_gen3_cpg_pll_config {
 	u8 extal_div;
@@ -49,6 +50,7 @@ struct gen3_clk_priv {
 	struct cpg_mssr_info	*info;
 	struct clk		clk_extal;
 	struct clk		clk_extalr;
+	bool			sscg;
 	const struct rcar_gen3_cpg_pll_config *cpg_pll_config;
 };
 
Signature · 1 line
2.16.2
#4 lore raw

PATCH 5/15 clk: renesas: Add R8A77990 E3 clock tables

In reply to Marek Vasut

Add clock tables for R8A77990 E3 SoC .

Cc Nobuhiro Iwamatsu <[email protected]>
---
 drivers/clk/renesas/Kconfig                   |   7 +
 drivers/clk/renesas/Makefile                  |   1 +
 drivers/clk/renesas/r8a77990-cpg-mssr.c       | 303 ++++++++++++++++++++++++++
 include/dt-bindings/clock/r8a77990-cpg-mssr.h |  63 ++++++
 4 files changed, 374 insertions(+)
 create mode 100644 drivers/clk/renesas/r8a77990-cpg-mssr.c
 create mode 100644 include/dt-bindings/clock/r8a77990-cpg-mssr.h
drivers/clk/renesas/Kconfig +7 -0
index b5a6bcc3af..578e6a8049 100644
@@ -74,6 +74,13 @@ config CLK_R8A77970
 	help
 	  Enable this to support the clocks on Renesas R8A77970 SoC.
 
+config CLK_R8A77990
+	bool "Renesas R8A77990 clock driver"
+	def_bool y if R8A77990
+	depends on CLK_RCAR_GEN3
+	help
+	  Enable this to support the clocks on Renesas R8A77990 SoC.
+
 config CLK_R8A77995
 	bool "Renesas R8A77995 clock driver"
 	def_bool y if R8A77995
drivers/clk/renesas/Makefile +1 -0
index a65d89f59c..22a817a919 100644
@@ -9,4 +9,5 @@ obj-$(CONFIG_CLK_RCAR_GEN3) += clk-rcar-gen3.o
 obj-$(CONFIG_CLK_R8A7795) += r8a7795-cpg-mssr.o
 obj-$(CONFIG_CLK_R8A7796) += r8a7796-cpg-mssr.o
 obj-$(CONFIG_CLK_R8A77970) += r8a77970-cpg-mssr.o
+obj-$(CONFIG_CLK_R8A77990) += r8a77990-cpg-mssr.o
 obj-$(CONFIG_CLK_R8A77995) += r8a77995-cpg-mssr.o
drivers/clk/renesas/r8a77990-cpg-mssr.c new file +303 -0

303 lines not on this page · raw message

include/dt-bindings/clock/r8a77990-cpg-mssr.h new file +63 -0

63 lines not on this page · raw message

Signature · 1 line
2.16.2
#5 lore raw

PATCH 6/15 pinctrl: renesas: Add PORT_GP_11 helper macro

In reply to Marek Vasut

From: Takeshi Kihara <[email protected]>

This follows the style of existion PORT_GP_X macros and will be used by a follow-up patch for the r8a77990 SoC.

Cc Nobuhiro Iwamatsu <[email protected]>
---
 drivers/pinctrl/renesas/sh_pfc.h | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/pinctrl/renesas/sh_pfc.h +6 -2
index 22b8c95009..9755826201 100644
@@ -368,9 +368,13 @@ extern const struct sh_pfc_soc_info r8a77995_pinmux_info;
 	PORT_GP_CFG_1(bank, 9,  fn, sfx, cfg)
 #define PORT_GP_10(bank, fn, sfx)	PORT_GP_CFG_10(bank, fn, sfx, 0)
 
-#define PORT_GP_CFG_12(bank, fn, sfx, cfg)				\
+#define PORT_GP_CFG_11(bank, fn, sfx, cfg)				\
 	PORT_GP_CFG_10(bank, fn, sfx, cfg),				\
-	PORT_GP_CFG_1(bank, 10, fn, sfx, cfg),				\
+	PORT_GP_CFG_1(bank, 10,  fn, sfx, cfg)
+#define PORT_GP_11(bank, fn, sfx)	PORT_GP_CFG_11(bank, fn, sfx, 0)
+
+#define PORT_GP_CFG_12(bank, fn, sfx, cfg)				\
+	PORT_GP_CFG_11(bank, fn, sfx, cfg),				\
 	PORT_GP_CFG_1(bank, 11, fn, sfx, cfg)
 #define PORT_GP_12(bank, fn, sfx)	PORT_GP_CFG_12(bank, fn, sfx, 0)
 
Signature · 1 line
2.16.2
#6 lore raw

PATCH 7/15 pinctrl: renesas: Initial R8A77990 PFC support

In reply to Marek Vasut

This patch adds initial pinctrl driver to support for the R8A77990 SoC.

---
 drivers/pinctrl/renesas/Kconfig        |   11 +
 drivers/pinctrl/renesas/Makefile       |    1 +
 drivers/pinctrl/renesas/pfc-r8a77990.c | 1732 ++++++++++++++++++++++++++++++++
 drivers/pinctrl/renesas/pfc.c          |   11 +
 drivers/pinctrl/renesas/sh_pfc.h       |    1 +
 5 files changed, 1756 insertions(+)
 create mode 100644 drivers/pinctrl/renesas/pfc-r8a77990.c
drivers/pinctrl/renesas/Kconfig +11 -0
index 5e6d854065..1baab9088a 100644
@@ -94,6 +94,17 @@ config PINCTRL_PFC_R8A77970
 	  the GPIO definitions and pin control functions for each available
 	  multiplex function.
 
+config PINCTRL_PFC_R8A77990
+	bool "Renesas RCar Gen3 R8A77990 pin control driver"
+	def_bool y if R8A77990
+	depends on PINCTRL_PFC
+	help
+	  Support pin multiplexing control on Renesas RCar Gen3 R8A77990 SoCs.
+
+	  The driver is controlled by a device tree node which contains both
+	  the GPIO definitions and pin control functions for each available
+	  multiplex function.
+
 config PINCTRL_PFC_R8A77995
 	bool "Renesas RCar Gen3 R8A77995 pin control driver"
 	def_bool y if R8A77995
drivers/pinctrl/renesas/Makefile +1 -0
index 29b9912f83..62bc40b8c1 100644
@@ -7,4 +7,5 @@ obj-$(CONFIG_PINCTRL_PFC_R8A7794) += pfc-r8a7794.o
 obj-$(CONFIG_PINCTRL_PFC_R8A7795) += pfc-r8a7795.o
 obj-$(CONFIG_PINCTRL_PFC_R8A7796) += pfc-r8a7796.o
 obj-$(CONFIG_PINCTRL_PFC_R8A77970) += pfc-r8a77970.o
+obj-$(CONFIG_PINCTRL_PFC_R8A77990) += pfc-r8a77990.o
 obj-$(CONFIG_PINCTRL_PFC_R8A77995) += pfc-r8a77995.o
drivers/pinctrl/renesas/pfc-r8a77990.c new file +1732 -0

1,732 lines not on this page · raw message

drivers/pinctrl/renesas/pfc.c +11 -0
index 66f0ce11b6..01a027f663 100644
@@ -29,6 +29,7 @@ enum sh_pfc_model {
 	SH_PFC_R8A7795,
 	SH_PFC_R8A7796,
 	SH_PFC_R8A77970,
+	SH_PFC_R8A77990,
 	SH_PFC_R8A77995,
 };
 
@@ -806,6 +807,10 @@ static int sh_pfc_pinctrl_probe(struct udevice *dev)
 	if (model == SH_PFC_R8A77970)
 		priv->pfc.info = &r8a77970_pinmux_info;
 #endif
+#ifdef CONFIG_PINCTRL_PFC_R8A77990
+	if (model == SH_PFC_R8A77990)
+		priv->pfc.info = &r8a77990_pinmux_info;
+#endif
 #ifdef CONFIG_PINCTRL_PFC_R8A77995
 	if (model == SH_PFC_R8A77995)
 		priv->pfc.info = &r8a77995_pinmux_info;
@@ -870,6 +875,12 @@ static const struct udevice_id sh_pfc_pinctrl_ids[] = {
 		.data = SH_PFC_R8A77970,
 	},
 #endif
+#ifdef CONFIG_PINCTRL_PFC_R8A77990
+	{
+		.compatible = "renesas,pfc-r8a77990",
+		.data = SH_PFC_R8A77990,
+	},
+#endif
 #ifdef CONFIG_PINCTRL_PFC_R8A77995
 	{
 		.compatible = "renesas,pfc-r8a77995",
drivers/pinctrl/renesas/sh_pfc.h +1 -0
index 9755826201..f4060096e2 100644
@@ -253,6 +253,7 @@ extern const struct sh_pfc_soc_info r8a7794_pinmux_info;
 extern const struct sh_pfc_soc_info r8a7795_pinmux_info;
 extern const struct sh_pfc_soc_info r8a7796_pinmux_info;
 extern const struct sh_pfc_soc_info r8a77970_pinmux_info;
+extern const struct sh_pfc_soc_info r8a77990_pinmux_info;
 extern const struct sh_pfc_soc_info r8a77995_pinmux_info;
 /* -----------------------------------------------------------------------------
  * Helper macros to create pin and port lists
Signature · 1 line
2.16.2
#7 lore raw

PATCH 8/15 gpio: rmobile: Add R8A77990 E3 compatible

In reply to Marek Vasut

Add new compatible to the GPIO driver for R8A77990 E3 SoC.

Cc Nobuhiro Iwamatsu <[email protected]>
---
 drivers/gpio/gpio-rcar.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpio/gpio-rcar.c +1 -0
index b46621f76b..6fd1270640 100644
@@ -175,6 +175,7 @@ static const struct udevice_id rcar_gpio_ids[] = {
 	{ .compatible = "renesas,gpio-r8a7796" },
 	{ .compatible = "renesas,gpio-r8a77965" },
 	{ .compatible = "renesas,gpio-r8a77970" },
+	{ .compatible = "renesas,gpio-r8a77990" },
 	{ .compatible = "renesas,gpio-r8a77995" },
 	{ .compatible = "renesas,rcar-gen2-gpio" },
 	{ .compatible = "renesas,rcar-gen3-gpio" },
Signature · 1 line
2.16.2
#8 lore raw

PATCH 9/15 mmc: renesas-sdhi: Add R8A77990 E3 compatible

In reply to Marek Vasut

Add new compatible to the Uniphier SD driver for R8A77990 E3 SoC.

Cc Masahiro Yamada <[email protected]>
Cc Nobuhiro Iwamatsu <[email protected]>
---
 drivers/mmc/renesas-sdhi.c | 1 +
 1 file changed, 1 insertion(+)
drivers/mmc/renesas-sdhi.c +1 -0
index 62577895ee..ecdb088ac4 100644
@@ -323,6 +323,7 @@ static const struct udevice_id renesas_sdhi_match[] = {
 	{ .compatible = "renesas,sdhi-r8a7796", .data = RENESAS_GEN3_QUIRKS },
 	{ .compatible = "renesas,sdhi-r8a77965", .data = RENESAS_GEN3_QUIRKS },
 	{ .compatible = "renesas,sdhi-r8a77970", .data = RENESAS_GEN3_QUIRKS },
+	{ .compatible = "renesas,sdhi-r8a77990", .data = RENESAS_GEN3_QUIRKS },
 	{ .compatible = "renesas,sdhi-r8a77995", .data = RENESAS_GEN3_QUIRKS },
 	{ /* sentinel */ }
 };
Signature · 1 line
2.16.2
#9 lore raw

PATCH 10/15 net: ravb: Add R8A77990 E3 compatible

In reply to Marek Vasut

Add new compatible to the Ethernet AVB driver for R8A77990 E3 SoC.

Cc Joe Hershberger <[email protected]>
Cc Nobuhiro Iwamatsu <[email protected]>
---
 drivers/net/ravb.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/ravb.c +1 -0
index 3392e5854d..999894f0f6 100644
@@ -659,6 +659,7 @@ static const struct udevice_id ravb_ids[] = {
 	{ .compatible = "renesas,etheravb-r8a7796" },
 	{ .compatible = "renesas,etheravb-r8a77965" },
 	{ .compatible = "renesas,etheravb-r8a77970" },
+	{ .compatible = "renesas,etheravb-r8a77990" },
 	{ .compatible = "renesas,etheravb-r8a77995" },
 	{ .compatible = "renesas,etheravb-rcar-gen3" },
 	{ }
Signature · 1 line
2.16.2
#11 lore raw

PATCH 11/15 ARM: renesas: Add R8A77990 E3 SoC ID

In reply to Marek Vasut

Add ID and Kconfig entry for the Renesas R8A77990 E3 SoC.

Cc Nobuhiro Iwamatsu <[email protected]>
---
 arch/arm/mach-rmobile/Kconfig.64             | 3 +++
 arch/arm/mach-rmobile/cpu_info.c             | 1 +
 arch/arm/mach-rmobile/include/mach/rmobile.h | 1 +
 3 files changed, 5 insertions(+)
arch/arm/mach-rmobile/Kconfig.64 +3 -0
index 6112d79f0d..6b93d25358 100644
@@ -12,6 +12,9 @@ config R8A7796
 config R8A77970
 	bool "Renesas SoC R8A77970"
 
+config R8A77990
+	bool "Renesas SoC R8A77990"
+
 config R8A77995
 	bool "Renesas SoC R8A77995"
 
arch/arm/mach-rmobile/cpu_info.c +1 -0
index 4e6a191cb1..e110737471 100644
@@ -59,6 +59,7 @@ static const struct {
 	{ RMOBILE_CPU_TYPE_R8A7796, "R8A7796" },
 	{ RMOBILE_CPU_TYPE_R8A77965, "R8A77965" },
 	{ RMOBILE_CPU_TYPE_R8A77970, "R8A77970" },
+	{ RMOBILE_CPU_TYPE_R8A77990, "R8A77990" },
 	{ RMOBILE_CPU_TYPE_R8A77995, "R8A77995" },
 	{ 0x0, "CPU" },
 };
arch/arm/mach-rmobile/include/mach/rmobile.h +1 -0
index 94ea366f45..c94b3ff509 100644
@@ -35,6 +35,7 @@
 #define RMOBILE_CPU_TYPE_R8A7796	0x52
 #define RMOBILE_CPU_TYPE_R8A77965	0x55
 #define RMOBILE_CPU_TYPE_R8A77970	0x54
+#define RMOBILE_CPU_TYPE_R8A77990	0x57
 #define RMOBILE_CPU_TYPE_R8A77995	0x58
 
 #ifndef __ASSEMBLY__
Signature · 1 line
2.16.2
#12 lore raw

PATCH 12/15 ARM: dts: rmobile: Add Renesas R8A77990 SoC support

In reply to Marek Vasut

From: Yoshihiro Shimoda <[email protected]>

This patch adds basic support for the Renesas R-Car E3 (R8A77990) SoC:
- PSCI
- CPU (single)
- Cache controller
- Main clocks and controller
- Interrupt controller
- Timer
- PMU
- Reset controller
- Product register
- System controller
- UART for console

Inspried by a patch by Takeshi Kihara in the BSP.

---
 arch/arm/dts/r8a77990.dtsi | 131 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 131 insertions(+)
 create mode 100644 arch/arm/dts/r8a77990.dtsi
arch/arm/dts/r8a77990.dtsi new file +131 -0
new file mode 100644
index 0000000000..310bfd9d88
@@ -0,0 +1,131 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Device Tree Source for the r8a77990 SoC
+ *
+ * Copyright (C) 2018 Renesas Electronics Corp.
+ */
+
+#include <dt-bindings/clock/renesas-cpg-mssr.h>
+#include <dt-bindings/interrupt-controller/arm-gic.h>
+
+/ {
+	compatible = "renesas,r8a77990";
+	#address-cells = <2>;
+	#size-cells = <2>;
+
+	cpus {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		/* 1 core only at this point */
+		a53_0: cpu at 0 {
+			compatible = "arm,cortex-a53", "arm,armv8";
+			reg = <0x0>;
+			device_type = "cpu";
+			power-domains = <&sysc 5>;
+			next-level-cache = <&L2_CA53>;
+			enable-method = "psci";
+		};
+
+		L2_CA53: cache-controller at 0 {
+			compatible = "cache";
+			reg = <0>;
+			power-domains = <&sysc 21>;
+			cache-unified;
+			cache-level = <2>;
+		};
+	};
+
+	extal_clk: extal {
+		compatible = "fixed-clock";
+		#clock-cells = <0>;
+		/* This value must be overridden by the board */
+		clock-frequency = <0>;
+	};
+
+	psci {
+		compatible = "arm,psci-0.2";
+		method = "smc";
+	};
+
+	soc: soc {
+		compatible = "simple-bus";
+		interrupt-parent = <&gic>;
+		#address-cells = <2>;
+		#size-cells = <2>;
+		ranges;
+
+		gic: interrupt-controller at f1010000 {
+			compatible = "arm,gic-400";
+			#interrupt-cells = <3>;
+			#address-cells = <0>;
+			interrupt-controller;
+			reg = <0x0 0xf1010000 0 0x1000>,
+			      <0x0 0xf1020000 0 0x20000>,
+			      <0x0 0xf1040000 0 0x20000>,
+			      <0x0 0xf1060000 0 0x20000>;
+			interrupts = <GIC_PPI 9
+					(GIC_CPU_MASK_SIMPLE(1) | IRQ_TYPE_LEVEL_HIGH)>;
+			clocks = <&cpg CPG_MOD 408>;
+			clock-names = "clk";
+			power-domains = <&sysc 32>;
+			resets = <&cpg 408>;
+		};
+
+		timer {
+			compatible = "arm,armv8-timer";
+			interrupts = <GIC_PPI 13
+					(GIC_CPU_MASK_SIMPLE(1) | IRQ_TYPE_LEVEL_LOW)>,
+				     <GIC_PPI 14
+					(GIC_CPU_MASK_SIMPLE(1) | IRQ_TYPE_LEVEL_LOW)>,
+				     <GIC_PPI 11
+					(GIC_CPU_MASK_SIMPLE(1) | IRQ_TYPE_LEVEL_LOW)>,
+				     <GIC_PPI 10
+					(GIC_CPU_MASK_SIMPLE(1) | IRQ_TYPE_LEVEL_LOW)>;
+		};
+
+		pmu_a53 {
+			compatible = "arm,cortex-a53-pmu";
+			interrupts = <GIC_SPI 84 IRQ_TYPE_LEVEL_HIGH>;
+			interrupt-affinity = <&a53_0>;
+		};
+
+		cpg: clock-controller at e6150000 {
+			compatible = "renesas,r8a77990-cpg-mssr";
+			reg = <0 0xe6150000 0 0x1000>;
+			clocks = <&extal_clk>;
+			clock-names = "extal";
+			#clock-cells = <2>;
+			#power-domain-cells = <0>;
+			#reset-cells = <1>;
+		};
+
+		rst: reset-controller at e6160000 {
+			compatible = "renesas,r8a77990-rst";
+			reg = <0 0xe6160000 0 0x0200>;
+		};
+
+		prr: chipid at fff00044 {
+			compatible = "renesas,prr";
+			reg = <0 0xfff00044 0 4>;
+		};
+
+		sysc: system-controller at e6180000 {
+			compatible = "renesas,r8a77990-sysc";
+			reg = <0 0xe6180000 0 0x0400>;
+			#power-domain-cells = <1>;
+		};
+
+		scif2: serial at e6e88000 {
+			compatible = "renesas,scif-r8a77990",
+				     "renesas,rcar-gen3-scif", "renesas,scif";
+			reg = <0 0xe6e88000 0 64>;
+			interrupts = <GIC_SPI 164 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&cpg CPG_MOD 310>;
+			clock-names = "fck";
+			power-domains = <&sysc 32>;
+			resets = <&cpg 310>;
+			status = "disabled";
+		};
+	};
+};
Signature · 1 line
2.16.2
#13 lore raw

PATCH 13/15 ARM: dts: rmobile: Add Renesas Ebisu board support

In reply to Marek Vasut

From: Takeshi Kihara <[email protected]>

Basic support for the Renesas Ebisu board based on R-Car E3:
- Memory,
- Main crystal,
- Serial console,

[shimoda: rebase and add SPDX-License-Identifier]
Cc Nobuhiro Iwamatsu <[email protected]>
---
 arch/arm/dts/Makefile           |  1 +
 arch/arm/dts/r8a77990-ebisu.dts | 37 +++++++++++++++++++++++++++++++++++++
 2 files changed, 38 insertions(+)
 create mode 100644 arch/arm/dts/r8a77990-ebisu.dts
arch/arm/dts/Makefile +1 -0
index a0349a8975..6df8bc2fd6 100644
@@ -439,6 +439,7 @@ dtb-$(CONFIG_RCAR_GEN3) += \
 	r8a7796-salvator-x.dtb \
 	r8a77965-salvator-x.dtb \
 	r8a77970-eagle.dtb \
+	r8a77990-ebisu.dtb \
 	r8a77995-draak.dtb
 
 dtb-$(CONFIG_SOC_KEYSTONE) += keystone-k2hk-evm.dtb \
arch/arm/dts/r8a77990-ebisu.dts new file +37 -0
new file mode 100644
index 0000000000..63ee1347bb
@@ -0,0 +1,37 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Device Tree Source for the ebisu board
+ *
+ * Copyright (C) 2018 Renesas Electronics Corp.
+ */
+
+/dts-v1/;
+#include "r8a77990.dtsi"
+
+/ {
+	model = "Renesas Ebisu board based on r8a77990";
+	compatible = "renesas,ebisu", "renesas,r8a77990";
+
+	aliases {
+		serial0 = &scif2;
+	};
+
+	chosen {
+		bootargs = "ignore_loglevel";
+		stdout-path = "serial0:115200n8";
+	};
+
+	memory at 48000000 {
+		device_type = "memory";
+		/* first 128MB is reserved for secure area. */
+		reg = <0x0 0x48000000 0x0 0x38000000>;
+	};
+};
+
+&extal_clk {
+	clock-frequency = <48000000>;
+};
+
+&scif2 {
+	status = "okay";
+};
Signature · 1 line
2.16.2
#14 lore raw

PATCH 14/15 ARM: renesas: Add R8A77990 E3 Ebisu board

In reply to Marek Vasut

Add support for the R8A77990 Ebisu board.

Cc Nobuhiro Iwamatsu <[email protected]>
---
 arch/arm/dts/r8a77990-ebisu-u-boot.dts | 10 ++++
 arch/arm/dts/r8a77990-u-boot.dtsi      |  9 ++++
 arch/arm/mach-rmobile/Kconfig.64       |  6 +++
 board/renesas/ebisu/Kconfig            | 15 ++++++
 board/renesas/ebisu/MAINTAINERS        |  6 +++
 board/renesas/ebisu/Makefile           |  9 ++++
 board/renesas/ebisu/ebisu.c            | 87 ++++++++++++++++++++++++++++++++++
 configs/r8a77990_ebisu_defconfig       | 64 +++++++++++++++++++++++++
 include/configs/ebisu.h                | 34 +++++++++++++
 9 files changed, 240 insertions(+)
 create mode 100644 arch/arm/dts/r8a77990-ebisu-u-boot.dts
 create mode 100644 arch/arm/dts/r8a77990-u-boot.dtsi
 create mode 100644 board/renesas/ebisu/Kconfig
 create mode 100644 board/renesas/ebisu/MAINTAINERS
 create mode 100644 board/renesas/ebisu/Makefile
 create mode 100644 board/renesas/ebisu/ebisu.c
 create mode 100644 configs/r8a77990_ebisu_defconfig
 create mode 100644 include/configs/ebisu.h
arch/arm/dts/r8a77990-ebisu-u-boot.dts new file +10 -0
new file mode 100644
index 0000000000..28bc497046
@@ -0,0 +1,10 @@
+/*
+ * Device Tree Source extras for U-Boot for the Ebisu board
+ *
+ * Copyright (C) 2018 Marek Vasut <[email protected]>
+ *
+ * SPDX-License-Identifier:	GPL-2.0
+ */
+
+#include "r8a77990-ebisu.dts"
+#include "r8a77990-u-boot.dtsi"
arch/arm/dts/r8a77990-u-boot.dtsi new file +9 -0
new file mode 100644
index 0000000000..30a9f0b8ea
@@ -0,0 +1,9 @@
+/*
+ * Device Tree Source extras for U-Boot on RCar R8A77990 SoC
+ *
+ * Copyright (C) 2018 Marek Vasut <[email protected]>
+ *
+ * SPDX-License-Identifier:	GPL-2.0
+ */
+
+#include "r8a779x-u-boot.dtsi"
arch/arm/mach-rmobile/Kconfig.64 +6 -0
index 6b93d25358..cb9f569e5f 100644
@@ -34,6 +34,11 @@ config TARGET_EAGLE
 	help
           Support for Renesas R-Car Gen3 Eagle platform
 
+config TARGET_EBISU
+	bool "Ebisu board"
+	help
+          Support for Renesas R-Car Gen3 Ebisu platform
+
 config TARGET_SALVATOR_X
 	bool "Salvator-X board"
 	help
@@ -51,6 +56,7 @@ config SYS_SOC
 
 source "board/renesas/draak/Kconfig"
 source "board/renesas/eagle/Kconfig"
+source "board/renesas/ebisu/Kconfig"
 source "board/renesas/salvator-x/Kconfig"
 source "board/renesas/ulcb/Kconfig"
 
board/renesas/ebisu/Kconfig new file +15 -0
new file mode 100644
index 0000000000..f500a94c9a
@@ -0,0 +1,15 @@
+if TARGET_EBISU
+
+config SYS_SOC
+	default "rmobile"
+
+config SYS_BOARD
+	default "ebisu"
+
+config SYS_VENDOR
+	default "renesas"
+
+config SYS_CONFIG_NAME
+	default "ebisu"
+
+endif
board/renesas/ebisu/MAINTAINERS new file +6 -0
new file mode 100644
index 0000000000..facad520ca
@@ -0,0 +1,6 @@
+EBISU BOARD
+M:	Marek Vasut <[email protected]>
+S:	Maintained
+F:	board/renesas/ebisu/
+F:	include/configs/ebisu.h
+F:	configs/r8a77990_ebisu_defconfig
board/renesas/ebisu/Makefile new file +9 -0
new file mode 100644
index 0000000000..2741035c57
@@ -0,0 +1,9 @@
+#
+# board/renesas/ebisu/Makefile
+#
+# Copyright (C) 2018 Renesas Electronics Corporation
+#
+# SPDX-License-Identifier: GPL-2.0+
+#
+
+obj-y	:= ebisu.o
board/renesas/ebisu/ebisu.c new file +87 -0

87 lines not on this page · raw message

configs/r8a77990_ebisu_defconfig new file +64 -0

64 lines not on this page · raw message

include/configs/ebisu.h new file +34 -0
new file mode 100644
index 0000000000..7dc4651dd2
@@ -0,0 +1,34 @@
+/*
+ * include/configs/ebisu.h
+ *     This file is Ebisu board configuration.
+ *
+ * Copyright (C) 2018 Renesas Electronics Corporation
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#ifndef __EBISU_H
+#define __EBISU_H
+
+#undef DEBUG
+
+#include "rcar-gen3-common.h"
+
+/* Ethernet RAVB */
+#define CONFIG_NET_MULTI
+#define CONFIG_BITBANGMII
+#define CONFIG_BITBANGMII_MULTI
+
+/* Board Clock */
+/* XTAL_CLK : 33.33MHz */
+#define CONFIG_SYS_CLK_FREQ	48000000u
+
+/* Generic Timer Definitions (use in assembler source) */
+#define COUNTER_FREQUENCY	0xFE502A	/* 16.66MHz from CPclk */
+
+/* Environment in eMMC, at the end of 2nd "boot sector" */
+#define CONFIG_ENV_OFFSET		(-CONFIG_ENV_SIZE)
+#define CONFIG_SYS_MMC_ENV_DEV		2
+#define CONFIG_SYS_MMC_ENV_PART		2
+
+#endif /* __EBISU_H */
Signature · 1 line
2.16.2
#15 lore raw

PATCH 15/15 ARM: dts: rmobile: Sync R8A77990 Ebisu DTS with Linux

In reply to Marek Vasut

Import the R8A77990 and Ebisu DTS from linux-next to get the latest version. This makes AVB ethernet work in U-Boot since the ethernet node is now present in DT, as well as GPIOs.

Cc Nobuhiro Iwamatsu <[email protected]>
---
 arch/arm/dts/r8a77990-ebisu.dts |  28 +++++
 arch/arm/dts/r8a77990.dtsi      | 220 +++++++++++++++++++++++++++++++++-------
 2 files changed, 213 insertions(+), 35 deletions(-)
arch/arm/dts/r8a77990-ebisu.dts +28 -0
index 63ee1347bb..7a09d0524f 100644
@@ -7,6 +7,7 @@
 
 /dts-v1/;
 #include "r8a77990.dtsi"
+#include <dt-bindings/gpio/gpio.h>
 
 / {
 	model = "Renesas Ebisu board based on r8a77990";
@@ -14,6 +15,7 @@
 
 	aliases {
 		serial0 = &scif2;
+		ethernet0 = &avb;
 	};
 
 	chosen {
@@ -28,10 +30,36 @@
 	};
 };
 
+&avb {
+	pinctrl-0 = <&avb_pins>;
+	pinctrl-names = "default";
+	renesas,no-ether-link;
+	phy-handle = <&phy0>;
+	phy-mode = "rgmii-txid";
+	status = "okay";
+
+	phy0: ethernet-phy at 0 {
+		rxc-skew-ps = <1500>;
+		reg = <0>;
+		interrupt-parent = <&gpio2>;
+		interrupts = <21 IRQ_TYPE_LEVEL_LOW>;
+		reset-gpios = <&gpio1 20 GPIO_ACTIVE_LOW>;
+	};
+};
+
 &extal_clk {
 	clock-frequency = <48000000>;
 };
 
+&pfc {
+	avb_pins: avb {
+		mux {
+			groups = "avb_link", "avb_mii";
+			function = "avb";
+		};
+	};
+};
+
 &scif2 {
 	status = "okay";
 };
arch/arm/dts/r8a77990.dtsi +185 -35

263 lines not on this page · raw message

Signature · 1 line
2.16.2