Skip to contentSkip to conversation

pinctl: sh-pfc: r7s72100: Ethernet support

RFC PATCH New Simon Horman 3 participants 5 messages Dec 15, 2013 – Dec 18, 2013

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

cover pinctl: sh-pfc: r7s72100: Ethernet support

Hi,

this is a first pass at adding ethernet support to sh-pfc for the r7s72100 SoC.

It has been written with reference to the hardware documentation but not well tested.

This series is based on the topic/r7s72100-v3.13-rc3-20131214v2 tag in my renesas tree.

Simon Horman (2):
pinctl: sh-pfc: r7s72100: Ethernet support
ARM: shmobile: r7s72100: Add ethernet PFC node to DT

 arch/arm/boot/dts/r7s72100-genmai-reference.dts | 25 +++++++++-
 drivers/pinctrl/sh-pfc/pfc-r7s72100.c           | 64 +++++++++++++++++++++++++
 2 files changed, 88 insertions(+), 1 deletion(-)

-
1.8.4

#1 lore raw

RFC PATCH 1/2 pinctl: sh-pfc: r7s72100: Ethernet support

---

This has not been well exercised.

---
 drivers/pinctrl/sh-pfc/pfc-r7s72100.c | 64 +++++++++++++++++++++++++++++++++++
 1 file changed, 64 insertions(+)
drivers/pinctrl/sh-pfc/pfc-r7s72100.c +64 -0
index c5bb533..77b4ce7 100644
@@ -141,15 +141,79 @@ static const unsigned int __RZ_STR(pfx, hw, bank, pin, _mux)[] = {	\
 
 SCIF2(RZ_PIN_AND_MUX)
 
+#define ETHERNET(fn)			\
+	fn(ethernet, col,    1,  3, 3)		\
+	fn(ethernet, col,    1, 14, 4)		\
+	fn(ethernet, int,    1, 15, 1)		\
+	fn(ethernet, txclk,  2,  0, 2)		\
+	fn(ethernet, txer,   2,  1, 2)		\
+	fn(ethernet, txen,   2,  2, 2)		\
+	fn(ethernet, txcrs,  2,  3, 2)		\
+	fn(ethernet, txd,    2,  4, 2)		\
+	fn(ethernet, txd,    2,  5, 2)		\
+	fn(ethernet, txd,    2,  6, 2)		\
+	fn(ethernet, txd,    2,  7, 2)		\
+	fn(ethernet, rxd,    2,  8, 2)		\
+	fn(ethernet, rxd,    2,  9, 2)		\
+	fn(ethernet, rxd,    2, 10, 2)		\
+	fn(ethernet, rxd,    2, 11, 2)		\
+	fn(ethernet, txclk,  3,  0, 2)		\
+	fn(ethernet, txer,   3,  1, 2)		\
+	fn(ethernet, txen,   3,  2, 2)		\
+	fn(ethernet, mdio,   3,  3, 2)		\
+	fn(ethernet, rxclk,  3,  4, 2)		\
+	fn(ethernet, rxer,   3,  5, 2)		\
+	fn(ethernet, rxdv,   3,  6, 2)		\
+	fn(ethernet, mdc,    5,  9, 2)		\
+	fn(ethernet, mdc,    7,  0, 3)		\
+	fn(ethernet, txclk,  7,  1, 3)		\
+	fn(ethernet, txer,   7,  2, 3)		\
+	fn(ethernet, txen,   7,  3, 3)		\
+	fn(ethernet, txd,    7,  4, 3)		\
+	fn(ethernet, txd,    7,  5, 3)		\
+	fn(ethernet, txd,    7,  6, 3)		\
+	fn(ethernet, txd,    7,  7, 3)		\
+	fn(ethernet, rxd,    7,  9, 3)		\
+	fn(ethernet, rxd,    7, 10, 3)		\
+	fn(ethernet, rxd,    7, 11, 2)		\
+	fn(ethernet, rxd,    7, 12, 3)		\
+	fn(ethernet, mdio,   7, 13, 3)		\
+	fn(ethernet, crs,    7, 14, 3)		\
+	fn(ethernet, rxclk,  7, 15, 3)		\
+	fn(ethernet, rxer,   8,  0, 3)		\
+	fn(ethernet, rxd,    8,  1, 3)		\
+	fn(ethernet, col,    8,  7, 5)		\
+	fn(ethernet, txclk, 10,  0, 4)		\
+	fn(ethernet, txer,  10,  1, 4)		\
+	fn(ethernet, txen,  10,  2, 4)		\
+	fn(ethernet, crs,   10,  3, 4)		\
+	fn(ethernet, txd,   10,  4, 4)		\
+	fn(ethernet, txd,   10,  5, 4)		\
+	fn(ethernet, txd,   10,  6, 4)		\
+	fn(ethernet, txd,   10,  7, 4)		\
+	fn(ethernet, txd,   10,  8, 4)		\
+	fn(ethernet, txd,   10,  9, 4)		\
+	fn(ethernet, txd,   10, 10, 4)		\
+	fn(ethernet, txd,   10, 11, 4)		\
+
+ETHERNET(RZ_PIN_AND_MUX)
+
 static const struct sh_pfc_pin_group pinmux_groups[] = {
 	SCIF2(RZ_PMX_GRP)
+	ETHERNET(RZ_PMX_GRP)
 };
 
 static const char * const scif2_groups[] = {
 	SCIF2(RZ_GRPS)
 };
+
+static const char * const ethernet_groups[] = {
+	ETHERNET(RZ_GRPS)
+};
+
 static const struct sh_pfc_function pinmux_functions[] = {
 	SH_PFC_FUNCTION(scif2),
+	SH_PFC_FUNCTION(ethernet),
 };
 
 #define PFC_REG(idx, name, reg)						\
Signature · 1 line
1.8.4
#2 lore raw

RFC PATCH 1/2 pinctl: sh-pfc: r7s72100: Ethernet support

Hi Simon,

Thank you for the patch.

Quoted 20 lines · On Sunday 15 December 2013 17:23:59 Simon Horman wrote:

---

This has not been well exercised.

---
 drivers/pinctrl/sh-pfc/pfc-r7s72100.c | 64 ++++++++++++++++++++++++++++++++
 1 file changed, 64 insertions(+)
(quoted diff) +0 -0

b/drivers/pinctrl/sh-pfc/pfc-r7s72100.c index c5bb533..77b4ce7 100644

drivers/pinctrl/sh-pfc/pfc-r7s72100.c +2 -0
@@ -141,15 +141,79 @@ static const unsigned int __RZ_STR(pfx, hw, bank, pin,
 _mux)[] = {	\
 
 SCIF2(RZ_PIN_AND_MUX)
 
+#define ETHERNET(fn)			\
+	fn(ethernet, col,    1,  3, 3)		\

drivers/pinctrl/sh-pfc/pfc-r7s72100.c static const unsigned int __RZ_STR(pfx, hw, bank, pin, · line 156

Quoted 10 lines
drivers/pinctrl/sh-pfc/pfc-r7s72100.c +10 -0
+	fn(ethernet, col,    1, 14, 4)		\
+	fn(ethernet, int,    1, 15, 1)		\
+	fn(ethernet, txclk,  2,  0, 2)		\
+	fn(ethernet, txer,   2,  1, 2)		\
+	fn(ethernet, txen,   2,  2, 2)		\
+	fn(ethernet, txcrs,  2,  3, 2)		\
+	fn(ethernet, txd,    2,  4, 2)		\
+	fn(ethernet, txd,    2,  5, 2)		\
+	fn(ethernet, txd,    2,  6, 2)		\
+	fn(ethernet, txd,    2,  7, 2)		\

Those pins should be called txd0, txd1, txd2 and txd3. Same below for the txd and rxd pins.

Quoted 34 lines
drivers/pinctrl/sh-pfc/pfc-r7s72100.c +34 -0
+	fn(ethernet, rxd,    2,  8, 2)		\
+	fn(ethernet, rxd,    2,  9, 2)		\
+	fn(ethernet, rxd,    2, 10, 2)		\
+	fn(ethernet, rxd,    2, 11, 2)		\
+	fn(ethernet, txclk,  3,  0, 2)		\
+	fn(ethernet, txer,   3,  1, 2)		\
+	fn(ethernet, txen,   3,  2, 2)		\
+	fn(ethernet, mdio,   3,  3, 2)		\
+	fn(ethernet, rxclk,  3,  4, 2)		\
+	fn(ethernet, rxer,   3,  5, 2)		\
+	fn(ethernet, rxdv,   3,  6, 2)		\
+	fn(ethernet, mdc,    5,  9, 2)		\
+	fn(ethernet, mdc,    7,  0, 3)		\
+	fn(ethernet, txclk,  7,  1, 3)		\
+	fn(ethernet, txer,   7,  2, 3)		\
+	fn(ethernet, txen,   7,  3, 3)		\
+	fn(ethernet, txd,    7,  4, 3)		\
+	fn(ethernet, txd,    7,  5, 3)		\
+	fn(ethernet, txd,    7,  6, 3)		\
+	fn(ethernet, txd,    7,  7, 3)		\
+	fn(ethernet, rxd,    7,  9, 3)		\
+	fn(ethernet, rxd,    7, 10, 3)		\
+	fn(ethernet, rxd,    7, 11, 2)		\
+	fn(ethernet, rxd,    7, 12, 3)		\
+	fn(ethernet, mdio,   7, 13, 3)		\
+	fn(ethernet, crs,    7, 14, 3)		\
+	fn(ethernet, rxclk,  7, 15, 3)		\
+	fn(ethernet, rxer,   8,  0, 3)		\
+	fn(ethernet, rxd,    8,  1, 3)		\
+	fn(ethernet, col,    8,  7, 5)		\
+	fn(ethernet, txclk, 10,  0, 4)		\
+	fn(ethernet, txer,  10,  1, 4)		\
+	fn(ethernet, txen,  10,  2, 4)		\
+	fn(ethernet, crs,   10,  3, 4)		\

drivers/pinctrl/sh-pfc/pfc-r7s72100.c static const unsigned int __RZ_STR(pfx, hw, bank, pin, _mux)[] = { \ · line 199

Quoted 10 lines
drivers/pinctrl/sh-pfc/pfc-r7s72100.c +10 -0
+	fn(ethernet, txd,   10,  4, 4)		\
+	fn(ethernet, txd,   10,  5, 4)		\
+	fn(ethernet, txd,   10,  6, 4)		\
+	fn(ethernet, txd,   10,  7, 4)		\
+	fn(ethernet, txd,   10,  8, 4)		\
+	fn(ethernet, txd,   10,  9, 4)		\
+	fn(ethernet, txd,   10, 10, 4)		\
+	fn(ethernet, txd,   10, 11, 4)		\
+
+ETHERNET(RZ_PIN_AND_MUX)

Could you please move this above the SCIF entries to keep the file alphabetically sorted ? Same for the groups and functions below.

Quoted 20 lines
drivers/pinctrl/sh-pfc/pfc-r7s72100.c +8 -0
+
 static const struct sh_pfc_pin_group pinmux_groups[] = {
 	SCIF2(RZ_PMX_GRP)
+	ETHERNET(RZ_PMX_GRP)
 };
 
 static const char * const scif2_groups[] = {
 	SCIF2(RZ_GRPS)
 };
+
+static const char * const ethernet_groups[] = {
+	ETHERNET(RZ_GRPS)
+};
+
 static const struct sh_pfc_function pinmux_functions[] = {
 	SH_PFC_FUNCTION(scif2),
+	SH_PFC_FUNCTION(ethernet),
 };
 

#define PFC_REG(idx, name, reg) \

Signature · 3 lines
Regards,

Laurent Pinchart
#3 lore raw

RFC PATCH 1/2 pinctl: sh-pfc: r7s72100: Ethernet support

Quoted 23 lines · Laurent Pinchart

Hi Simon,

Thank you for the patch.

Quoted 18 lines · On Sunday 15 December 2013 17:23:59 Simon Horman wrote:

---

This has not been well exercised.

---
 drivers/pinctrl/sh-pfc/pfc-r7s72100.c | 64 ++++++++++++++++++++++++++++++++
 1 file changed, 64 insertions(+)
(quoted diff) +0 -0

b/drivers/pinctrl/sh-pfc/pfc-r7s72100.c index c5bb533..77b4ce7 100644

drivers/pinctrl/sh-pfc/pfc-r7s72100.c +0 -0
@@ -141,15 +141,79 @@ static const unsigned int __RZ_STR(pfx, hw, bank, pin,
 _mux)[] = {	\
 
 SCIF2(RZ_PIN_AND_MUX)
 
Quoted 15 lines

drivers/pinctrl/sh-pfc/pfc-r7s72100.c static const unsigned int __RZ_STR(pfx, hw, bank, pin, _mux)[] = { \ · line 155

Quoted 12 lines
drivers/pinctrl/sh-pfc/pfc-r7s72100.c +12 -0
+#define ETHERNET(fn)			\
+	fn(ethernet, col,    1,  3, 3)		\
+	fn(ethernet, col,    1, 14, 4)		\
+	fn(ethernet, int,    1, 15, 1)		\
+	fn(ethernet, txclk,  2,  0, 2)		\
+	fn(ethernet, txer,   2,  1, 2)		\
+	fn(ethernet, txen,   2,  2, 2)		\
+	fn(ethernet, txcrs,  2,  3, 2)		\
+	fn(ethernet, txd,    2,  4, 2)		\
+	fn(ethernet, txd,    2,  5, 2)		\
+	fn(ethernet, txd,    2,  6, 2)		\
+	fn(ethernet, txd,    2,  7, 2)		\

Those pins should be called txd0, txd1, txd2 and txd3. Same below for the txd and rxd pins.

Thanks, will do.

Quoted 39 lines
Quoted 39 lines
drivers/pinctrl/sh-pfc/pfc-r7s72100.c +39 -0
+	fn(ethernet, rxd,    2,  8, 2)		\
+	fn(ethernet, rxd,    2,  9, 2)		\
+	fn(ethernet, rxd,    2, 10, 2)		\
+	fn(ethernet, rxd,    2, 11, 2)		\
+	fn(ethernet, txclk,  3,  0, 2)		\
+	fn(ethernet, txer,   3,  1, 2)		\
+	fn(ethernet, txen,   3,  2, 2)		\
+	fn(ethernet, mdio,   3,  3, 2)		\
+	fn(ethernet, rxclk,  3,  4, 2)		\
+	fn(ethernet, rxer,   3,  5, 2)		\
+	fn(ethernet, rxdv,   3,  6, 2)		\
+	fn(ethernet, mdc,    5,  9, 2)		\
+	fn(ethernet, mdc,    7,  0, 3)		\
+	fn(ethernet, txclk,  7,  1, 3)		\
+	fn(ethernet, txer,   7,  2, 3)		\
+	fn(ethernet, txen,   7,  3, 3)		\
+	fn(ethernet, txd,    7,  4, 3)		\
+	fn(ethernet, txd,    7,  5, 3)		\
+	fn(ethernet, txd,    7,  6, 3)		\
+	fn(ethernet, txd,    7,  7, 3)		\
+	fn(ethernet, rxd,    7,  9, 3)		\
+	fn(ethernet, rxd,    7, 10, 3)		\
+	fn(ethernet, rxd,    7, 11, 2)		\
+	fn(ethernet, rxd,    7, 12, 3)		\
+	fn(ethernet, mdio,   7, 13, 3)		\
+	fn(ethernet, crs,    7, 14, 3)		\
+	fn(ethernet, rxclk,  7, 15, 3)		\
+	fn(ethernet, rxer,   8,  0, 3)		\
+	fn(ethernet, rxd,    8,  1, 3)		\
+	fn(ethernet, col,    8,  7, 5)		\
+	fn(ethernet, txclk, 10,  0, 4)		\
+	fn(ethernet, txer,  10,  1, 4)		\
+	fn(ethernet, txen,  10,  2, 4)		\
+	fn(ethernet, crs,   10,  3, 4)		\
+	fn(ethernet, txd,   10,  4, 4)		\
+	fn(ethernet, txd,   10,  5, 4)		\
+	fn(ethernet, txd,   10,  6, 4)		\
+	fn(ethernet, txd,   10,  7, 4)		\
+	fn(ethernet, txd,   10,  8, 4)		\
Quoted 8 lines

drivers/pinctrl/sh-pfc/pfc-r7s72100.c static const unsigned int __RZ_STR(pfx, hw, bank, pin, _mux)[] = { \ · line 199

Quoted 5 lines
drivers/pinctrl/sh-pfc/pfc-r7s72100.c +5 -0
+	fn(ethernet, txd,   10,  9, 4)		\
+	fn(ethernet, txd,   10, 10, 4)		\
+	fn(ethernet, txd,   10, 11, 4)		\
+
+ETHERNET(RZ_PIN_AND_MUX)

Could you please move this above the SCIF entries to keep the file alphabetically sorted ? Same for the groups and functions below.

Sure.

Quoted 25 lines
Quoted 20 lines
drivers/pinctrl/sh-pfc/pfc-r7s72100.c +8 -0
+
 static const struct sh_pfc_pin_group pinmux_groups[] = {
 	SCIF2(RZ_PMX_GRP)
+	ETHERNET(RZ_PMX_GRP)
 };
 
 static const char * const scif2_groups[] = {
 	SCIF2(RZ_GRPS)
 };
+
+static const char * const ethernet_groups[] = {
+	ETHERNET(RZ_GRPS)
+};
+
 static const struct sh_pfc_function pinmux_functions[] = {
 	SH_PFC_FUNCTION(scif2),
+	SH_PFC_FUNCTION(ethernet),
 };
 

#define PFC_REG(idx, name, reg) \

Signature · 3 lines
Regards,

Laurent Pinchart
#4 lore raw

RFC PATCH 2/2 ARM: shmobile: r7s72100: Add ethernet PFC node to DT

In reply to Simon Horman

---

This has not been well exercised.

---
 arch/arm/boot/dts/r7s72100-genmai-reference.dts | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)
arch/arm/boot/dts/r7s72100-genmai-reference.dts +24 -1
index 040aa0f..2ca0196 100644
@@ -60,11 +60,34 @@
 };
 
 &pfc {
-	pinctrl-0 = <&scif2_pins>;
+	pinctrl-0 = <&scif2_pins &ethernet_pins>;
 	pinctrl-names = "default";
 
 	scif2_pins: serial2 {
 		renesas,groups = "scif2_txd_p3_0", "scif2_rxd_p3_2";
 		renesas,function = "scif2";
 	};
+
+	ethernet_pins: ethernet {
+		renesas,groups = "ethernet_rxdv_p3_6",
+				 "ethernet_rxer_p3_5",
+				 "ethernet_rxclk_p3_4",
+				 "ethernet_mdio_p3_3",
+				 "ethernet_rxd_p2_11",
+				 "ethernet_rxd_p2_10",
+				 "ethernet_rxd_p2_9",
+				 "ethernet_rxd_p2_8",
+				 "ethernet_txd_p2_7",
+				 "ethernet_txd_p2_6",
+				 "ethernet_txd_p2_5",
+				 "ethernet_txd_p2_4",
+				 "ethernet_txcrs_p2_3",
+				 "ethernet_txen_p2_2",
+				 "ethernet_txer_p2_1",
+				 "ethernet_txclk_p2_0",
+				 "ethernet_mdc_p5_9",
+				 "ethernet_col_p1_14",
+				 "ethernet_int_p1_15";
+		renesas,function = "ethernet";
+	};
 };
Signature · 1 line
1.8.4