Skip to contentSkip to conversation

Add Renesas R8A77970 PFC driver

PATCH Superseded Sergei Shtylyov 3 participants 13 messages Feb 25, 2018 – Mar 7, 2018

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Add Renesas R8A77970 PFC driver

Hello!

Here's a set of 2 patches against the 'sh-pfc' branch of Geert Uytterhoeven's 'renesas-drivers.git' repo. These patches add the basic support for the R8A77980 PFC.

[1/2] pinctrl: sh-pfc: add PORT_GP_CFG_25() helper macros [2/2] pinctrl: sh-pfc: add R8A77980 PFC support

MBR, Sergei

#1 lore raw

PATCH 1/2 pinctrl: sh-pfc: add PORT_GP_CFG_25() helper macro

They follow the style of the existing PORT_GP_CFG_<n>() macros and will be used by a follow-up patch for the R8A77980 SoC.

Based on the original (and large) patch by Vladimir Barinov.

---
 drivers/pinctrl/sh-pfc/sh_pfc.h |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/pinctrl/sh-pfc/sh_pfc.h +6 -2
Index: renesas/drivers/pinctrl/sh-pfc/sh_pfc.h
===================================================================
@@ -470,9 +470,13 @@ extern const struct sh_pfc_soc_info shx3
 	PORT_GP_CFG_1(bank, 23, fn, sfx, cfg)
 #define PORT_GP_24(bank, fn, sfx)	PORT_GP_CFG_24(bank, fn, sfx, 0)
 
-#define PORT_GP_CFG_26(bank, fn, sfx, cfg)				\
+#define PORT_GP_CFG_25(bank, fn, sfx, cfg)				\
 	PORT_GP_CFG_24(bank, fn, sfx, cfg),				\
-	PORT_GP_CFG_1(bank, 24, fn, sfx, cfg),				\
+	PORT_GP_CFG_1(bank, 24, fn, sfx, cfg)
+#define PORT_GP_25(bank, fn, sfx)	PORT_GP_CFG_25(bank, fn, sfx, 0)
+
+#define PORT_GP_CFG_26(bank, fn, sfx, cfg)				\
+	PORT_GP_CFG_25(bank, fn, sfx, cfg),				\
 	PORT_GP_CFG_1(bank, 25, fn, sfx, cfg)
 #define PORT_GP_26(bank, fn, sfx)	PORT_GP_CFG_26(bank, fn, sfx, 0)
 
Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] pinctrl: sh-pfc: add PORT_GP_CFG_25() helper macro

Quoted 7 lines · Sergei Shtylyov

They follow the style of the existing PORT_GP_CFG_<n>() macros and will be used by a follow-up patch for the R8A77980 SoC.

Based on the original (and large) patch by Vladimir Barinov.

i.e. queuing in sh-pfc-for-v4.17.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#3 lore raw

PATCH 2/2 pinctrl: sh-pfc: add R8A77980 PFC support

In reply to Sergei Shtylyov

Add the PFC support for the R8A77980 SoC including pin groups for some on-chip devices such as AVB, CAN-FD, GETHER, [H]SCIF, I2C, INTC-EX, MMC, MSIOF, PWM, and VIN...

Based on the original (and large) patch by Vladimir Barinov.

---
 Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt |    1 
 drivers/pinctrl/sh-pfc/Kconfig                                    |    5 
 drivers/pinctrl/sh-pfc/Makefile                                   |    1 
 drivers/pinctrl/sh-pfc/core.c                                     |    6 
 drivers/pinctrl/sh-pfc/pfc-r8a77980.c                             | 2738 ++++++++++
 drivers/pinctrl/sh-pfc/sh_pfc.h                                   |    1 
 6 files changed, 2752 insertions(+)
Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt +1 -0
Index: renesas-drivers/Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt
===================================================================
@@ -26,6 +26,7 @@ Required Properties:
     - "renesas,pfc-r8a7796": for R8A7796 (R-Car M3-W) compatible pin-controller.
     - "renesas,pfc-r8a77965": for R8A77965 (R-Car M3-N) compatible pin-controller.
     - "renesas,pfc-r8a77970": for R8A77970 (R-Car V3M) compatible pin-controller.
+    - "renesas,pfc-r8a77980": for R8A77980 (R-Car V3H) compatible pin-controller.
     - "renesas,pfc-r8a77995": for R8A77995 (R-Car D3) compatible pin-controller.
     - "renesas,pfc-sh73a0": for SH73A0 (SH-Mobile AG5) compatible pin-controller.
 
drivers/pinctrl/sh-pfc/Kconfig +5 -0
Index: renesas-drivers/drivers/pinctrl/sh-pfc/Kconfig
===================================================================
@@ -99,6 +99,11 @@ config PINCTRL_PFC_R8A77970
 	depends on ARCH_R8A77970
 	select PINCTRL_SH_PFC
 
+config PINCTRL_PFC_R8A77980
+	def_bool y
+	depends on ARCH_R8A77980
+	select PINCTRL_SH_PFC
+
 config PINCTRL_PFC_R8A77995
         def_bool y
         depends on ARCH_R8A77995
drivers/pinctrl/sh-pfc/Makefile +1 -0
Index: renesas-drivers/drivers/pinctrl/sh-pfc/Makefile
===================================================================
@@ -18,6 +18,7 @@ obj-$(CONFIG_PINCTRL_PFC_R8A7795)	+= pfc
 obj-$(CONFIG_PINCTRL_PFC_R8A7796)	+= pfc-r8a7796.o
 obj-$(CONFIG_PINCTRL_PFC_R8A77965)	+= pfc-r8a77965.o
 obj-$(CONFIG_PINCTRL_PFC_R8A77970)	+= pfc-r8a77970.o
+obj-$(CONFIG_PINCTRL_PFC_R8A77980)	+= pfc-r8a77980.o
 obj-$(CONFIG_PINCTRL_PFC_R8A77995)	+= pfc-r8a77995.o
 obj-$(CONFIG_PINCTRL_PFC_SH7203)	+= pfc-sh7203.o
 obj-$(CONFIG_PINCTRL_PFC_SH7264)	+= pfc-sh7264.o
drivers/pinctrl/sh-pfc/core.c +6 -0
Index: renesas-drivers/drivers/pinctrl/sh-pfc/core.c
===================================================================
@@ -569,6 +569,12 @@ static const struct of_device_id sh_pfc_
 		.data = &r8a77970_pinmux_info,
 	},
 #endif
+#ifdef CONFIG_PINCTRL_PFC_R8A77980
+	{
+		.compatible = "renesas,pfc-r8a77980",
+		.data = &r8a77980_pinmux_info,
+	},
+#endif
 #ifdef CONFIG_PINCTRL_PFC_R8A77995
 	{
 		.compatible = "renesas,pfc-r8a77995",
drivers/pinctrl/sh-pfc/pfc-r8a77980.c new file +2738 -0

2,738 lines not on this page · raw message

drivers/pinctrl/sh-pfc/sh_pfc.h +1 -0
Index: renesas-drivers/drivers/pinctrl/sh-pfc/sh_pfc.h
===================================================================
@@ -285,6 +285,7 @@ extern const struct sh_pfc_soc_info r8a7
 extern const struct sh_pfc_soc_info r8a7796_pinmux_info;
 extern const struct sh_pfc_soc_info r8a77965_pinmux_info;
 extern const struct sh_pfc_soc_info r8a77970_pinmux_info;
+extern const struct sh_pfc_soc_info r8a77980_pinmux_info;
 extern const struct sh_pfc_soc_info r8a77995_pinmux_info;
 extern const struct sh_pfc_soc_info sh7203_pinmux_info;
 extern const struct sh_pfc_soc_info sh7264_pinmux_info;
#4 lore raw

Re: [PATCH 2/2] pinctrl: sh-pfc: add R8A77980 PFC support

Hi Sergei,

Quoted 8 lines · Sergei Shtylyov

Add the PFC support for the R8A77980 SoC including pin groups for some on-chip devices such as AVB, CAN-FD, GETHER, [H]SCIF, I2C, INTC-EX, MMC, MSIOF, PWM, and VIN...

Based on the original (and large) patch by Vladimir Barinov.

Thanks for your patch!

To avoid scaring off potential reviewers, it may be better to not include that many pin groups and functions in future initial submissions.
This also helps if issues are detected during review in some of them (like below), delaying queuing of basic functionality and other correct parts.

I only looked at CPU_ALL_PORT(), pins, groups, and functions. Comments below.

Quoted 22 lines
drivers/pinctrl/sh-pfc/pfc-r8a77980.c new file +19 -0
 
+/* - AVB -------------------------------------------------------------------- */
+static const unsigned int avb_link_pins[] = {
+       /* AVB_LINK */
+       RCAR_GP_PIN(1, 18),
+};
+static const unsigned int avb_link_mux[] = {
+       AVB_LINK_MARK,
+};
+static const unsigned int avb_magic_pins[] = {
+       /* AVB_MAGIC */
+       RCAR_GP_PIN(1, 16),
+};
+static const unsigned int avb_magic_mux[] = {
+       AVB_MAGIC_MARK,
+};
+static const unsigned int avb_phy_int_pins[] = {
+       /* AVB_PHY_INT */
+       RCAR_GP_PIN(1, 17),
+};

drivers/pinctrl/sh-pfc/pfc-r8a77980.c line 866

Quoted 10 lines
drivers/pinctrl/sh-pfc/pfc-r8a77980.c new file +10 -0
+static const unsigned int avb_phy_int_mux[] = {
+       AVB_PHY_INT_MARK,
+};
+static const unsigned int avb_mdio_pins[] = {
+       /* AVB_MDC, AVB_MDIO */
+       RCAR_GP_PIN(1, 15), RCAR_GP_PIN(1, 14),
+};
+static const unsigned int avb_mdio_mux[] = {
+       AVB_MDC_MARK, AVB_MDIO_MARK,
+};

The grouping is different from other R-Car Gen3 SoCs.

Quoted 19 lines
drivers/pinctrl/sh-pfc/pfc-r8a77980.c new file +19 -0
+/* - CANFD0 ----------------------------------------------------------------- */
+static const unsigned int canfd0_data_a_pins[] = {
+       /* CANFD0_TX, CANFD0_RX */
+       RCAR_GP_PIN(1, 21), RCAR_GP_PIN(1, 22),
+};
+static const unsigned int canfd0_data_a_mux[] = {
+       CANFD0_TX_A_MARK, CANFD0_RX_A_MARK,
+};
+static const unsigned int canfd_clk_a_pins[] = {
+       /* CANFD_CLK */
+       RCAR_GP_PIN(1, 25),
+};
+static const unsigned int canfd_clk_a_mux[] = {
+       CANFD_CLK_A_MARK,
+};
+static const unsigned int canfd0_data_b_pins[] = {
+       /* CANFD0_TX, CANFD0_RX */
+       RCAR_GP_PIN(3, 6), RCAR_GP_PIN(3, 7),
+};

drivers/pinctrl/sh-pfc/pfc-r8a77980.c line 942

Quoted 10 lines
drivers/pinctrl/sh-pfc/pfc-r8a77980.c new file +10 -0
+static const unsigned int canfd0_data_b_mux[] = {
+       CANFD0_TX_B_MARK, CANFD0_RX_B_MARK,
+};
+static const unsigned int canfd_clk_b_pins[] = {
+       /* CANFD_CLK */
+       RCAR_GP_PIN(3, 8),
+};
+static const unsigned int canfd_clk_b_mux[] = {
+       CANFD_CLK_B_MARK,
+};

Please move the canfd_clk pins to their own section.

Note that they are called can_clk in the pin function sheet, but the PFC section uses both can_clk and canfd_clk.
Given V3H (like V3M) has no plain CAN, only CANFD, using canfd_clk sounds right to me, though.

Quoted 8 lines
drivers/pinctrl/sh-pfc/pfc-r8a77980.c new file +8 -0
+/* - DU --------------------------------------------------------------------- */
+static const unsigned int du_rgb666_pins[] = {
+       /* DU_R[7:2], DU_G[7:2], DU_B[7:2] */
+       RCAR_GP_PIN(0, 5), RCAR_GP_PIN(0, 4), RCAR_GP_PIN(0, 3),
+       RCAR_GP_PIN(0, 2), RCAR_GP_PIN(0, 1), RCAR_GP_PIN(0, 0),
+       RCAR_GP_PIN(0, 11), RCAR_GP_PIN(0, 10), RCAR_GP_PIN(0, 9),
+       RCAR_GP_PIN(0, 8), RCAR_GP_PIN(0, 7), RCAR_GP_PIN(0, 6),
+       RCAR_GP_PIN(0, 17), RCAR_GP_PIN(0, 16), RCAR_GP_PIN(0, 15),

drivers/pinctrl/sh-pfc/pfc-r8a77980.c line 970

Quoted 10 lines
drivers/pinctrl/sh-pfc/pfc-r8a77980.c new file +10 -0
+       RCAR_GP_PIN(0, 14), RCAR_GP_PIN(0, 13), RCAR_GP_PIN(0, 12),
+};
+static const unsigned int du_rgb666_mux[] = {
+       DU_DR7_MARK, DU_DR6_MARK, DU_DR5_MARK,
+       DU_DR4_MARK, DU_DR3_MARK, DU_DR2_MARK,
+       DU_DG7_MARK, DU_DG6_MARK, DU_DG5_MARK,
+       DU_DG4_MARK, DU_DG3_MARK, DU_DG2_MARK,
+       DU_DB7_MARK, DU_DB6_MARK, DU_DB5_MARK,
+       DU_DB4_MARK, DU_DB3_MARK, DU_DB2_MARK,
+};

du_rgb888 is missing (see GP2_19..GP2_24).

Quoted 9 lines
drivers/pinctrl/sh-pfc/pfc-r8a77980.c new file +8 -0
+/* - HSCIF0 ----------------------------------------------------------------- */
 
+static const unsigned int scif_clk_a_pins[] = {
+       /* SCIF_CLK */
+       RCAR_GP_PIN(0, 10),
+};
+static const unsigned int scif_clk_a_mux[] = {
+       SCIF_CLK_A_MARK,
+};

[...]

drivers/pinctrl/sh-pfc/pfc-r8a77980.c line 1168

Quoted 7 lines
drivers/pinctrl/sh-pfc/pfc-r8a77980.c new file +7 -0
+static const unsigned int scif_clk_b_pins[] = {
+       /* SCIF_CLK */
+       RCAR_GP_PIN(1, 25),
+};
+static const unsigned int scif_clk_b_mux[] = {
+       SCIF_CLK_B_MARK,
+};

Please move the scif_clk pins to their own section, as they are shared by HSCIF and SCIF.

drivers/pinctrl/sh-pfc/pfc-r8a77980.c line 1849

Quoted 8 lines
drivers/pinctrl/sh-pfc/pfc-r8a77980.c new file +7 -0
+/* - VIN0 ------------------------------------------------------------------- */
 
+static const unsigned int vin0_sync_pins[] = {
+       /* VI0_VSYNC#, VI0_HSYNC# */
+       RCAR_GP_PIN(2, 3), RCAR_GP_PIN(2, 2),
+};
+static const unsigned int vin0_sync_mux[] = {
+       VI0_HSYNC_N_MARK, VI0_VSYNC_N_MARK,

Reversed order compared to the pins above.

drivers/pinctrl/sh-pfc/pfc-r8a77980.c line 1921

Quoted 8 lines
drivers/pinctrl/sh-pfc/pfc-r8a77980.c new file +7 -0
+/* - VIN1 ------------------------------------------------------------------- */
 
+static const unsigned int vin1_sync_pins[] = {
+       /* VI1_VSYNC#, VI1_HSYNC# */
+        RCAR_GP_PIN(3, 3), RCAR_GP_PIN(3, 2),
+};
+static const unsigned int vin1_sync_mux[] = {
+       VI1_HSYNC_N_MARK, VI1_VSYNC_N_MARK,

Reversed order compared to the pins above.

Quoted 5 lines
drivers/pinctrl/sh-pfc/pfc-r8a77980.c new file +5 -0
+static const struct sh_pfc_pin_group pinmux_groups[] = {
+       SH_PFC_PIN_GROUP(avb_link),
+       SH_PFC_PIN_GROUP(avb_magic),
+       SH_PFC_PIN_GROUP(avb_phy_int),
+       SH_PFC_PIN_GROUP(avb_mdio),

drivers/pinctrl/sh-pfc/pfc-r8a77980.c line 1959

Quoted 10 lines
drivers/pinctrl/sh-pfc/pfc-r8a77980.c new file +10 -0
+       SH_PFC_PIN_GROUP(avb_rgmii),
+       SH_PFC_PIN_GROUP(avb_txcrefclk),
+       SH_PFC_PIN_GROUP(avb_avtp_pps),
+       SH_PFC_PIN_GROUP(avb_avtp_capture),
+       SH_PFC_PIN_GROUP(avb_avtp_match),
+       SH_PFC_PIN_GROUP(canfd0_data_a),
+       SH_PFC_PIN_GROUP(canfd_clk_a),
+       SH_PFC_PIN_GROUP(canfd0_data_b),
+       SH_PFC_PIN_GROUP(canfd_clk_b),
+       SH_PFC_PIN_GROUP(canfd1_data),

Please split off canfd_clk.

Quoted 15 lines
drivers/pinctrl/sh-pfc/pfc-r8a77980.c new file +15 -0
+       SH_PFC_PIN_GROUP(du_rgb666),
+       SH_PFC_PIN_GROUP(du_clk_out),
+       SH_PFC_PIN_GROUP(du_sync),
+       SH_PFC_PIN_GROUP(du_oddf),
+       SH_PFC_PIN_GROUP(du_cde),
+       SH_PFC_PIN_GROUP(du_disp),
+       SH_PFC_PIN_GROUP(gether_link_a),
+       SH_PFC_PIN_GROUP(gether_phy_int_a),
+       SH_PFC_PIN_GROUP(gether_mdio_a),
+       SH_PFC_PIN_GROUP(gether_link_b),
+       SH_PFC_PIN_GROUP(gether_phy_int_b),
+       SH_PFC_PIN_GROUP(gether_mdio_b),
+       SH_PFC_PIN_GROUP(gether_magic),
+       SH_PFC_PIN_GROUP(gether_rgmii),
+       SH_PFC_PIN_GROUP(gether_txcrefclk),

drivers/pinctrl/sh-pfc/pfc-r8a77980.c line 1984

Quoted 10 lines
drivers/pinctrl/sh-pfc/pfc-r8a77980.c new file +10 -0
+       SH_PFC_PIN_GROUP(gether_txcrefclk_mega),
+       SH_PFC_PIN_GROUP(gether_rmii),
+       SH_PFC_PIN_GROUP(hscif0_data_a),
+       SH_PFC_PIN_GROUP(hscif0_clk_a),
+       SH_PFC_PIN_GROUP(hscif0_ctrl_a),
+       SH_PFC_PIN_GROUP(scif_clk_a),
+       SH_PFC_PIN_GROUP(hscif0_data_b),
+       SH_PFC_PIN_GROUP(hscif0_clk_b),
+       SH_PFC_PIN_GROUP(hscif0_ctrl_b),
+       SH_PFC_PIN_GROUP(scif_clk_b),

Please move scif_clk down.

Quoted 79 lines
drivers/pinctrl/sh-pfc/pfc-r8a77980.c new file +79 -0
+       SH_PFC_PIN_GROUP(hscif1_data),
+       SH_PFC_PIN_GROUP(hscif1_clk),
+       SH_PFC_PIN_GROUP(hscif1_ctrl),
+       SH_PFC_PIN_GROUP(hscif2_data),
+       SH_PFC_PIN_GROUP(hscif2_clk),
+       SH_PFC_PIN_GROUP(hscif2_ctrl),
+       SH_PFC_PIN_GROUP(hscif3_data),
+       SH_PFC_PIN_GROUP(hscif3_clk),
+       SH_PFC_PIN_GROUP(hscif3_ctrl),
+       SH_PFC_PIN_GROUP(i2c0),
+       SH_PFC_PIN_GROUP(i2c1),
+       SH_PFC_PIN_GROUP(i2c2),
+       SH_PFC_PIN_GROUP(i2c3),
+       SH_PFC_PIN_GROUP(i2c4),
+       SH_PFC_PIN_GROUP(i2c5),
+       SH_PFC_PIN_GROUP(intc_ex_irq0),
+       SH_PFC_PIN_GROUP(intc_ex_irq1),
+       SH_PFC_PIN_GROUP(intc_ex_irq2),
+       SH_PFC_PIN_GROUP(intc_ex_irq3),
+       SH_PFC_PIN_GROUP(intc_ex_irq4),
+       SH_PFC_PIN_GROUP(intc_ex_irq5),
+       SH_PFC_PIN_GROUP(mmc_data1),
+       SH_PFC_PIN_GROUP(mmc_data4),
+       SH_PFC_PIN_GROUP(mmc_data8),
+       SH_PFC_PIN_GROUP(mmc_ctrl),
+       SH_PFC_PIN_GROUP(mmc_cd),
+       SH_PFC_PIN_GROUP(mmc_wp),
+       SH_PFC_PIN_GROUP(mmc_ds),
+       SH_PFC_PIN_GROUP(msiof0_clk),
+       SH_PFC_PIN_GROUP(msiof0_sync),
+       SH_PFC_PIN_GROUP(msiof0_ss1),
+       SH_PFC_PIN_GROUP(msiof0_ss2),
+       SH_PFC_PIN_GROUP(msiof0_txd),
+       SH_PFC_PIN_GROUP(msiof0_rxd),
+       SH_PFC_PIN_GROUP(msiof1_clk),
+       SH_PFC_PIN_GROUP(msiof1_sync),
+       SH_PFC_PIN_GROUP(msiof1_ss1),
+       SH_PFC_PIN_GROUP(msiof1_ss2),
+       SH_PFC_PIN_GROUP(msiof1_txd),
+       SH_PFC_PIN_GROUP(msiof1_rxd),
+       SH_PFC_PIN_GROUP(msiof2_clk),
+       SH_PFC_PIN_GROUP(msiof2_sync),
+       SH_PFC_PIN_GROUP(msiof2_ss1),
+       SH_PFC_PIN_GROUP(msiof2_ss2),
+       SH_PFC_PIN_GROUP(msiof2_txd),
+       SH_PFC_PIN_GROUP(msiof2_rxd),
+       SH_PFC_PIN_GROUP(msiof3_clk),
+       SH_PFC_PIN_GROUP(msiof3_sync),
+       SH_PFC_PIN_GROUP(msiof3_ss1),
+       SH_PFC_PIN_GROUP(msiof3_ss2),
+       SH_PFC_PIN_GROUP(msiof3_txd),
+       SH_PFC_PIN_GROUP(msiof3_rxd),
+       SH_PFC_PIN_GROUP(pwm0_a),
+       SH_PFC_PIN_GROUP(pwm0_b),
+       SH_PFC_PIN_GROUP(pwm1_a),
+       SH_PFC_PIN_GROUP(pwm1_b),
+       SH_PFC_PIN_GROUP(pwm2_a),
+       SH_PFC_PIN_GROUP(pwm2_b),
+       SH_PFC_PIN_GROUP(pwm3_a),
+       SH_PFC_PIN_GROUP(pwm3_b),
+       SH_PFC_PIN_GROUP(pwm4_a),
+       SH_PFC_PIN_GROUP(pwm4_b),
+       SH_PFC_PIN_GROUP(scif0_data),
+       SH_PFC_PIN_GROUP(scif0_clk),
+       SH_PFC_PIN_GROUP(scif0_ctrl),
+       SH_PFC_PIN_GROUP(scif1_data_a),
+       SH_PFC_PIN_GROUP(scif1_clk),
+       SH_PFC_PIN_GROUP(scif1_ctrl),
+       SH_PFC_PIN_GROUP(scif1_data_b),
+       SH_PFC_PIN_GROUP(scif3_data),
+       SH_PFC_PIN_GROUP(scif3_clk),
+       SH_PFC_PIN_GROUP(scif3_ctrl),
+       SH_PFC_PIN_GROUP(scif4_data),
+       SH_PFC_PIN_GROUP(scif4_clk),
+       SH_PFC_PIN_GROUP(scif4_ctrl),
+       SH_PFC_PIN_GROUP(tmu_tclk1_a),
+       SH_PFC_PIN_GROUP(tmu_tclk1_b),
+       SH_PFC_PIN_GROUP(tmu_tclk2_a),
+       SH_PFC_PIN_GROUP(tmu_tclk2_b),

drivers/pinctrl/sh-pfc/pfc-r8a77980.c line 2073

Quoted 10 lines
drivers/pinctrl/sh-pfc/pfc-r8a77980.c new file +10 -0
+       SH_PFC_PIN_GROUP(tpu_to0),
+       SH_PFC_PIN_GROUP(tpu_to1),
+       SH_PFC_PIN_GROUP(tpu_to2),
+       SH_PFC_PIN_GROUP(tpu_to3),
+       VIN_DATA_PIN_GROUP(vin0_data, 8),
+       VIN_DATA_PIN_GROUP(vin0_data, 10),
+       VIN_DATA_PIN_GROUP(vin0_data, 12),
+       VIN_DATA_PIN_GROUP(vin0_data, 16),
+       VIN_DATA_PIN_GROUP(vin0_data, 20),
+       VIN_DATA_PIN_GROUP(vin0_data, 24),

Missing case for vin0_data_18 (RGB-666)

Quoted 8 lines
drivers/pinctrl/sh-pfc/pfc-r8a77980.c new file +8 -0
+       SH_PFC_PIN_GROUP(vin0_sync),
+       SH_PFC_PIN_GROUP(vin0_field),
+       SH_PFC_PIN_GROUP(vin0_clkenb),
+       SH_PFC_PIN_GROUP(vin0_clk),
+       SH_PFC_PIN_GROUP(vin1_data8),
+       SH_PFC_PIN_GROUP(vin1_data10),
+       SH_PFC_PIN_GROUP(vin1_data12),
+       SH_PFC_PIN_GROUP(vin1_sync),

drivers/pinctrl/sh-pfc/pfc-r8a77980.c line 2103

Quoted 10 lines
drivers/pinctrl/sh-pfc/pfc-r8a77980.c new file +9 -0
+       SH_PFC_PIN_GROUP(vin1_field),
+       SH_PFC_PIN_GROUP(vin1_clkenb),
+       SH_PFC_PIN_GROUP(vin1_clk),
+};
 
+static const char * const canfd0_groups[] = {
+       "canfd0_data_a",
+       "canfd_clk_a",
+       "canfd0_data_b",
+       "canfd_clk_b",

canfd_clk needs its own groups, and its own function.

drivers/pinctrl/sh-pfc/pfc-r8a77980.c line 2141

Quoted 9 lines
drivers/pinctrl/sh-pfc/pfc-r8a77980.c new file +9 -0
+static const char * const hscif0_groups[] = {
+       "hscif0_data_a",
+       "hscif0_clk_a",
+       "hscif0_ctrl_a",
+       "scif_clk_a",
+       "hscif0_data_b",
+       "hscif0_clk_b",
+       "hscif0_ctrl_b",
+       "scif_clk_b",

scif_clk needs its own groups, and its own function.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#5 lore raw

Re: [PATCH 2/2] pinctrl: sh-pfc: add R8A77980 PFC support

Hello!

Quoted 45 lines · Geert Uytterhoeven
Quoted 8 lines

Add the PFC support for the R8A77980 SoC including pin groups for some on-chip devices such as AVB, CAN-FD, GETHER, [H]SCIF, I2C, INTC-EX, MMC, MSIOF, PWM, and VIN...

Based on the original (and large) patch by Vladimir Barinov.

Thanks for your patch!

To avoid scaring off potential reviewers, it may be better to not include that many pin groups and functions in future initial submissions.
This also helps if issues are detected during review in some of them (like below), delaying queuing of basic functionality and other correct parts.

I only looked at CPU_ALL_PORT(), pins, groups, and functions. Comments below.

Quoted 26 lines
drivers/pinctrl/sh-pfc/pfc-r8a77980.c new file +23 -0
 
+/* - AVB -------------------------------------------------------------------- */
+static const unsigned int avb_link_pins[] = {
+       /* AVB_LINK */
+       RCAR_GP_PIN(1, 18),
+};
+static const unsigned int avb_link_mux[] = {
+       AVB_LINK_MARK,
+};
+static const unsigned int avb_magic_pins[] = {
+       /* AVB_MAGIC */
+       RCAR_GP_PIN(1, 16),
+};
+static const unsigned int avb_magic_mux[] = {
+       AVB_MAGIC_MARK,
+};
+static const unsigned int avb_phy_int_pins[] = {
+       /* AVB_PHY_INT */
+       RCAR_GP_PIN(1, 17),
+};
+static const unsigned int avb_phy_int_mux[] = {
+       AVB_PHY_INT_MARK,
+};
+static const unsigned int avb_mdio_pins[] = {
Quoted 8 lines

drivers/pinctrl/sh-pfc/pfc-r8a77980.c line 866

Quoted 6 lines
drivers/pinctrl/sh-pfc/pfc-r8a77980.c new file +6 -0
+       /* AVB_MDC, AVB_MDIO */
+       RCAR_GP_PIN(1, 15), RCAR_GP_PIN(1, 14),
+};
+static const unsigned int avb_mdio_mux[] = {
+       AVB_MDC_MARK, AVB_MDIO_MARK,
+};

The grouping is different from other R-Car Gen3 SoCs.

Not true AFAICS -- only the group naming is different.

Quoted 23 lines
Quoted 23 lines
drivers/pinctrl/sh-pfc/pfc-r8a77980.c new file +23 -0
+/* - CANFD0 ----------------------------------------------------------------- */
+static const unsigned int canfd0_data_a_pins[] = {
+       /* CANFD0_TX, CANFD0_RX */
+       RCAR_GP_PIN(1, 21), RCAR_GP_PIN(1, 22),
+};
+static const unsigned int canfd0_data_a_mux[] = {
+       CANFD0_TX_A_MARK, CANFD0_RX_A_MARK,
+};
+static const unsigned int canfd_clk_a_pins[] = {
+       /* CANFD_CLK */
+       RCAR_GP_PIN(1, 25),
+};
+static const unsigned int canfd_clk_a_mux[] = {
+       CANFD_CLK_A_MARK,
+};
+static const unsigned int canfd0_data_b_pins[] = {
+       /* CANFD0_TX, CANFD0_RX */
+       RCAR_GP_PIN(3, 6), RCAR_GP_PIN(3, 7),
+};
+static const unsigned int canfd0_data_b_mux[] = {
+       CANFD0_TX_B_MARK, CANFD0_RX_B_MARK,
+};
+static const unsigned int canfd_clk_b_pins[] = {
Quoted 8 lines

drivers/pinctrl/sh-pfc/pfc-r8a77980.c line 942

Quoted 6 lines
drivers/pinctrl/sh-pfc/pfc-r8a77980.c new file +6 -0
+       /* CANFD_CLK */
+       RCAR_GP_PIN(3, 8),
+};
+static const unsigned int canfd_clk_b_mux[] = {
+       CANFD_CLK_B_MARK,
+};

Please move the canfd_clk pins to their own section.

Are you aware the CANFD_CLK is controlled by MOD_SEL0.SEL_CANFD0? If it's allowed
to have the pins controlled by a single MOD_SEL field in the diff groups, I'll place CANFD_CLK into a separate group...

Quoted 17 lines

Note that they are called can_clk in the pin function sheet, but the PFC section uses both can_clk and canfd_clk.
Given V3H (like V3M) has no plain CAN, only CANFD, using canfd_clk sounds right to me, though.

Quoted 12 lines
drivers/pinctrl/sh-pfc/pfc-r8a77980.c new file +12 -0
+/* - DU --------------------------------------------------------------------- */
+static const unsigned int du_rgb666_pins[] = {
+       /* DU_R[7:2], DU_G[7:2], DU_B[7:2] */
+       RCAR_GP_PIN(0, 5), RCAR_GP_PIN(0, 4), RCAR_GP_PIN(0, 3),
+       RCAR_GP_PIN(0, 2), RCAR_GP_PIN(0, 1), RCAR_GP_PIN(0, 0),
+       RCAR_GP_PIN(0, 11), RCAR_GP_PIN(0, 10), RCAR_GP_PIN(0, 9),
+       RCAR_GP_PIN(0, 8), RCAR_GP_PIN(0, 7), RCAR_GP_PIN(0, 6),
+       RCAR_GP_PIN(0, 17), RCAR_GP_PIN(0, 16), RCAR_GP_PIN(0, 15),
+       RCAR_GP_PIN(0, 14), RCAR_GP_PIN(0, 13), RCAR_GP_PIN(0, 12),
+};
+static const unsigned int du_rgb666_mux[] = {
+       DU_DR7_MARK, DU_DR6_MARK, DU_DR5_MARK,
Quoted 8 lines

drivers/pinctrl/sh-pfc/pfc-r8a77980.c line 970

Quoted 6 lines
drivers/pinctrl/sh-pfc/pfc-r8a77980.c new file +6 -0
+       DU_DR4_MARK, DU_DR3_MARK, DU_DR2_MARK,
+       DU_DG7_MARK, DU_DG6_MARK, DU_DG5_MARK,
+       DU_DG4_MARK, DU_DG3_MARK, DU_DG2_MARK,
+       DU_DB7_MARK, DU_DB6_MARK, DU_DB5_MARK,
+       DU_DB4_MARK, DU_DB3_MARK, DU_DB2_MARK,
+};

du_rgb888 is missing (see GP2_19..GP2_24).

OK, seeing...

Quoted 13 lines
Quoted 9 lines
drivers/pinctrl/sh-pfc/pfc-r8a77980.c new file +8 -0
+/* - HSCIF0 ----------------------------------------------------------------- */
 
+static const unsigned int scif_clk_a_pins[] = {
+       /* SCIF_CLK */
+       RCAR_GP_PIN(0, 10),
+};
+static const unsigned int scif_clk_a_mux[] = {
+       SCIF_CLK_A_MARK,
+};

[...]

Quoted 10 lines

drivers/pinctrl/sh-pfc/pfc-r8a77980.c line 1168

Quoted 7 lines
drivers/pinctrl/sh-pfc/pfc-r8a77980.c new file +7 -0
+static const unsigned int scif_clk_b_pins[] = {
+       /* SCIF_CLK */
+       RCAR_GP_PIN(1, 25),
+};
+static const unsigned int scif_clk_b_mux[] = {
+       SCIF_CLK_B_MARK,
+};

Please move the scif_clk pins to their own section, as they are shared by HSCIF and SCIF.

Again, the same bit in MOD_SEL0...

Quoted 10 lines

drivers/pinctrl/sh-pfc/pfc-r8a77980.c line 1849

Quoted 8 lines
drivers/pinctrl/sh-pfc/pfc-r8a77980.c new file +7 -0
+/* - VIN0 ------------------------------------------------------------------- */
 
+static const unsigned int vin0_sync_pins[] = {
+       /* VI0_VSYNC#, VI0_HSYNC# */
+       RCAR_GP_PIN(2, 3), RCAR_GP_PIN(2, 2),
+};
+static const unsigned int vin0_sync_mux[] = {
+       VI0_HSYNC_N_MARK, VI0_VSYNC_N_MARK,

Reversed order compared to the pins above.

Right.

Quoted 10 lines

drivers/pinctrl/sh-pfc/pfc-r8a77980.c line 1921

Quoted 8 lines
drivers/pinctrl/sh-pfc/pfc-r8a77980.c new file +7 -0
+/* - VIN1 ------------------------------------------------------------------- */
 
+static const unsigned int vin1_sync_pins[] = {
+       /* VI1_VSYNC#, VI1_HSYNC# */
+        RCAR_GP_PIN(3, 3), RCAR_GP_PIN(3, 2),
+};
+static const unsigned int vin1_sync_mux[] = {
+       VI1_HSYNC_N_MARK, VI1_VSYNC_N_MARK,

Reversed order compared to the pins above.

Right.

[...]

Quoted 8 lines

drivers/pinctrl/sh-pfc/pfc-r8a77980.c line 2073

Quoted 6 lines
drivers/pinctrl/sh-pfc/pfc-r8a77980.c new file +6 -0
+       VIN_DATA_PIN_GROUP(vin0_data, 8),
+       VIN_DATA_PIN_GROUP(vin0_data, 10),
+       VIN_DATA_PIN_GROUP(vin0_data, 12),
+       VIN_DATA_PIN_GROUP(vin0_data, 16),
+       VIN_DATA_PIN_GROUP(vin0_data, 20),
+       VIN_DATA_PIN_GROUP(vin0_data, 24),

Missing case for vin0_data_18 (RGB-666)

We probably need the vin pin union extended...

[...]

Quoted 3 lines

Gr{oetje,eeting}s,

Geert

MBR, Sergei

#6 lore raw

Re: [PATCH 2/2] pinctrl: sh-pfc: add R8A77980 PFC support

Hi Sergei,

Quoted 55 lines · Sergei Shtylyov
Quoted 45 lines · Geert Uytterhoeven
Quoted 8 lines

Add the PFC support for the R8A77980 SoC including pin groups for some on-chip devices such as AVB, CAN-FD, GETHER, [H]SCIF, I2C, INTC-EX, MMC, MSIOF, PWM, and VIN...

Based on the original (and large) patch by Vladimir Barinov.

Thanks for your patch!

To avoid scaring off potential reviewers, it may be better to not include that many pin groups and functions in future initial submissions.
This also helps if issues are detected during review in some of them (like below), delaying queuing of basic functionality and other correct parts.

I only looked at CPU_ALL_PORT(), pins, groups, and functions. Comments below.

Quoted 26 lines
drivers/pinctrl/sh-pfc/pfc-r8a77980.c new file +23 -0
 
+/* - AVB -------------------------------------------------------------------- */
+static const unsigned int avb_link_pins[] = {
+       /* AVB_LINK */
+       RCAR_GP_PIN(1, 18),
+};
+static const unsigned int avb_link_mux[] = {
+       AVB_LINK_MARK,
+};
+static const unsigned int avb_magic_pins[] = {
+       /* AVB_MAGIC */
+       RCAR_GP_PIN(1, 16),
+};
+static const unsigned int avb_magic_mux[] = {
+       AVB_MAGIC_MARK,
+};
+static const unsigned int avb_phy_int_pins[] = {
+       /* AVB_PHY_INT */
+       RCAR_GP_PIN(1, 17),
+};
+static const unsigned int avb_phy_int_mux[] = {
+       AVB_PHY_INT_MARK,
+};
+static const unsigned int avb_mdio_pins[] = {
Quoted 8 lines

drivers/pinctrl/sh-pfc/pfc-r8a77980.c line 866

Quoted 6 lines
drivers/pinctrl/sh-pfc/pfc-r8a77980.c new file +6 -0
+       /* AVB_MDC, AVB_MDIO */
+       RCAR_GP_PIN(1, 15), RCAR_GP_PIN(1, 14),
+};
+static const unsigned int avb_mdio_mux[] = {
+       AVB_MDC_MARK, AVB_MDIO_MARK,
+};

The grouping is different from other R-Car Gen3 SoCs.

Quoted 1 line

Not true AFAICS -- only the group naming is different.

Oh, so we can have both groups names, and be compatible?

Quoted 32 lines
Quoted 23 lines
Quoted 23 lines
drivers/pinctrl/sh-pfc/pfc-r8a77980.c new file +23 -0
+/* - CANFD0 ----------------------------------------------------------------- */
+static const unsigned int canfd0_data_a_pins[] = {
+       /* CANFD0_TX, CANFD0_RX */
+       RCAR_GP_PIN(1, 21), RCAR_GP_PIN(1, 22),
+};
+static const unsigned int canfd0_data_a_mux[] = {
+       CANFD0_TX_A_MARK, CANFD0_RX_A_MARK,
+};
+static const unsigned int canfd_clk_a_pins[] = {
+       /* CANFD_CLK */
+       RCAR_GP_PIN(1, 25),
+};
+static const unsigned int canfd_clk_a_mux[] = {
+       CANFD_CLK_A_MARK,
+};
+static const unsigned int canfd0_data_b_pins[] = {
+       /* CANFD0_TX, CANFD0_RX */
+       RCAR_GP_PIN(3, 6), RCAR_GP_PIN(3, 7),
+};
+static const unsigned int canfd0_data_b_mux[] = {
+       CANFD0_TX_B_MARK, CANFD0_RX_B_MARK,
+};
+static const unsigned int canfd_clk_b_pins[] = {
Quoted 8 lines

drivers/pinctrl/sh-pfc/pfc-r8a77980.c line 942

Quoted 6 lines
drivers/pinctrl/sh-pfc/pfc-r8a77980.c new file +6 -0
+       /* CANFD_CLK */
+       RCAR_GP_PIN(3, 8),
+};
+static const unsigned int canfd_clk_b_mux[] = {
+       CANFD_CLK_B_MARK,
+};

Please move the canfd_clk pins to their own section.

Quoted 3 lines

Are you aware the CANFD_CLK is controlled by MOD_SEL0.SEL_CANFD0? If it's allowed
to have the pins controlled by a single MOD_SEL field in the diff groups, I'll place CANFD_CLK into a separate group...

SEL_CANFD0 switches between the A and B groups for CANFD0_TX, CANFD0_RX, and CANFD0_CLK together.
So all three pins must use either group A, or group B. That's something the user must do correctly anyway.

However, the CANFD_CLK pin is shared between the CANFD0 and CANFD1 modules. So a user who uses CANFD1, and not CANFD0, still has to configure pinmuxing for CANFD_CLK.

Quoted 24 lines
Quoted 13 lines
Quoted 9 lines
drivers/pinctrl/sh-pfc/pfc-r8a77980.c new file +8 -0
+/* - HSCIF0 ----------------------------------------------------------------- */
 
+static const unsigned int scif_clk_a_pins[] = {
+       /* SCIF_CLK */
+       RCAR_GP_PIN(0, 10),
+};
+static const unsigned int scif_clk_a_mux[] = {
+       SCIF_CLK_A_MARK,
+};

[...]

Quoted 10 lines

drivers/pinctrl/sh-pfc/pfc-r8a77980.c line 1168

Quoted 7 lines
drivers/pinctrl/sh-pfc/pfc-r8a77980.c new file +7 -0
+static const unsigned int scif_clk_b_pins[] = {
+       /* SCIF_CLK */
+       RCAR_GP_PIN(1, 25),
+};
+static const unsigned int scif_clk_b_mux[] = {
+       SCIF_CLK_B_MARK,
+};

Please move the scif_clk pins to their own section, as they are shared by HSCIF and SCIF.

Quoted 1 line

Again, the same bit in MOD_SEL0...

Same story: SCIF_CLK is shared by the HSCIFx and SCIFx modules. Still puts the responsability in the hands of the board designer: he must know not to select SCIF_CLK_A and HSCIF0_B, or SCIF_CLK_B and HSCIF0_A.

On this SoC, the limitations seem to be worse than on other members of the same family.

However, on other SoCs you have similar limitations. E.g. on H3/M3-W/M3-N you cannot select scif5_data_a and scif5_clk_b, as they are both controlled through sel_scif5, although the driver has them in separate groups. But that is done to allow using only RX/TX functionality, and using the CTS/RTS pins for something else (a completely different function, or GPIO).

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#7 lore raw

Re: [PATCH 2/2] pinctrl: sh-pfc: add R8A77980 PFC support

Quoted 54 lines · Geert Uytterhoeven
Quoted 54 lines
Quoted 53 lines
Quoted 8 lines

Add the PFC support for the R8A77980 SoC including pin groups for some on-chip devices such as AVB, CAN-FD, GETHER, [H]SCIF, I2C, INTC-EX, MMC, MSIOF, PWM, and VIN...

Based on the original (and large) patch by Vladimir Barinov.

Thanks for your patch!

To avoid scaring off potential reviewers, it may be better to not include that many pin groups and functions in future initial submissions.
This also helps if issues are detected during review in some of them (like below), delaying queuing of basic functionality and other correct parts.

I only looked at CPU_ALL_PORT(), pins, groups, and functions. Comments below.

Quoted 22 lines
drivers/pinctrl/sh-pfc/pfc-r8a77980.c new file +19 -0
 
+/* - AVB -------------------------------------------------------------------- */
+static const unsigned int avb_link_pins[] = {
+       /* AVB_LINK */
+       RCAR_GP_PIN(1, 18),
+};
+static const unsigned int avb_link_mux[] = {
+       AVB_LINK_MARK,
+};
+static const unsigned int avb_magic_pins[] = {
+       /* AVB_MAGIC */
+       RCAR_GP_PIN(1, 16),
+};
+static const unsigned int avb_magic_mux[] = {
+       AVB_MAGIC_MARK,
+};
+static const unsigned int avb_phy_int_pins[] = {
+       /* AVB_PHY_INT */
+       RCAR_GP_PIN(1, 17),
+};

drivers/pinctrl/sh-pfc/pfc-r8a77980.c line 866

Quoted 10 lines
drivers/pinctrl/sh-pfc/pfc-r8a77980.c new file +10 -0
+static const unsigned int avb_phy_int_mux[] = {
+       AVB_PHY_INT_MARK,
+};
+static const unsigned int avb_mdio_pins[] = {
+       /* AVB_MDC, AVB_MDIO */
+       RCAR_GP_PIN(1, 15), RCAR_GP_PIN(1, 14),
+};
+static const unsigned int avb_mdio_mux[] = {
+       AVB_MDC_MARK, AVB_MDIO_MARK,
+};

The grouping is different from other R-Car Gen3 SoCs.

Quoted 3 lines
Quoted 1 line

Not true AFAICS -- only the group naming is different.

Oh, so we can have both groups names, and be compatible?

Probably. Just not sure if there's any worth to have the same groups for the not
pin compatible SoCs. Care to elaborate?

Quoted 32 lines
Quoted 32 lines
Quoted 31 lines
Quoted 19 lines
drivers/pinctrl/sh-pfc/pfc-r8a77980.c new file +19 -0
+/* - CANFD0 ----------------------------------------------------------------- */
+static const unsigned int canfd0_data_a_pins[] = {
+       /* CANFD0_TX, CANFD0_RX */
+       RCAR_GP_PIN(1, 21), RCAR_GP_PIN(1, 22),
+};
+static const unsigned int canfd0_data_a_mux[] = {
+       CANFD0_TX_A_MARK, CANFD0_RX_A_MARK,
+};
+static const unsigned int canfd_clk_a_pins[] = {
+       /* CANFD_CLK */
+       RCAR_GP_PIN(1, 25),
+};
+static const unsigned int canfd_clk_a_mux[] = {
+       CANFD_CLK_A_MARK,
+};
+static const unsigned int canfd0_data_b_pins[] = {
+       /* CANFD0_TX, CANFD0_RX */
+       RCAR_GP_PIN(3, 6), RCAR_GP_PIN(3, 7),
+};

drivers/pinctrl/sh-pfc/pfc-r8a77980.c line 942

Quoted 10 lines
drivers/pinctrl/sh-pfc/pfc-r8a77980.c new file +10 -0
+static const unsigned int canfd0_data_b_mux[] = {
+       CANFD0_TX_B_MARK, CANFD0_RX_B_MARK,
+};
+static const unsigned int canfd_clk_b_pins[] = {
+       /* CANFD_CLK */
+       RCAR_GP_PIN(3, 8),
+};
+static const unsigned int canfd_clk_b_mux[] = {
+       CANFD_CLK_B_MARK,
+};

Please move the canfd_clk pins to their own section.

Quoted 6 lines
Quoted 3 lines

Are you aware the CANFD_CLK is controlled by MOD_SEL0.SEL_CANFD0? If it's allowed
to have the pins controlled by a single MOD_SEL field in the diff groups, I'll place CANFD_CLK into a separate group...

SEL_CANFD0 switches between the A and B groups for CANFD0_TX, CANFD0_RX, and CANFD0_CLK together.

CANFD_CLK. :-)

Quoted 31 lines

So all three pins must use either group A, or group B. That's something the user must do correctly anyway.

However, the CANFD_CLK pin is shared between the CANFD0 and CANFD1 modules. So a user who uses CANFD1, and not CANFD0, still has to configure pinmuxing for CANFD_CLK.

Quoted 24 lines
Quoted 23 lines
Quoted 9 lines
drivers/pinctrl/sh-pfc/pfc-r8a77980.c new file +8 -0
+/* - HSCIF0 ----------------------------------------------------------------- */
 
+static const unsigned int scif_clk_a_pins[] = {
+       /* SCIF_CLK */
+       RCAR_GP_PIN(0, 10),
+};
+static const unsigned int scif_clk_a_mux[] = {
+       SCIF_CLK_A_MARK,
+};

[...]

drivers/pinctrl/sh-pfc/pfc-r8a77980.c line 1168

Quoted 7 lines
drivers/pinctrl/sh-pfc/pfc-r8a77980.c new file +7 -0
+static const unsigned int scif_clk_b_pins[] = {
+       /* SCIF_CLK */
+       RCAR_GP_PIN(1, 25),
+};
+static const unsigned int scif_clk_b_mux[] = {
+       SCIF_CLK_B_MARK,
+};

Please move the scif_clk pins to their own section, as they are shared by HSCIF and SCIF.

Quoted 4 lines
Quoted 1 line

Again, the same bit in MOD_SEL0...

Same story: SCIF_CLK is shared by the HSCIFx and SCIFx modules. Still puts the responsability in the hands of the board designer: he must

Responsibility. :-)

Quoted 5 lines

know not to select SCIF_CLK_A and HSCIF0_B, or SCIF_CLK_B and HSCIF0_A.

On this SoC, the limitations seem to be worse than on other members of the same family.

Quoted 7 lines

However, on other SoCs you have similar limitations. E.g. on H3/M3-W/M3-N you cannot select scif5_data_a and scif5_clk_b, as they are both controlled through sel_scif5,

although the driver has them in separate groups.
But that is done to allow using only RX/TX functionality, and using the CTS/RTS pins for something else (a completely different function, or GPIO).

That's OK as they both are the part of the same function. My case is different,
sorry for not making this clear...

Quoted 3 lines

Gr{oetje,eeting}s,

Geert

MBR, Sergei

#8 lore raw

Re: [PATCH 2/2] pinctrl: sh-pfc: add R8A77980 PFC support

Hi Sergei,

Quoted 55 lines · Sergei Shtylyov
Quoted 54 lines · Geert Uytterhoeven
Quoted 54 lines
Quoted 53 lines
Quoted 8 lines

Add the PFC support for the R8A77980 SoC including pin groups for some on-chip devices such as AVB, CAN-FD, GETHER, [H]SCIF, I2C, INTC-EX, MMC, MSIOF, PWM, and VIN...

Based on the original (and large) patch by Vladimir Barinov.

Thanks for your patch!

To avoid scaring off potential reviewers, it may be better to not include that many pin groups and functions in future initial submissions.
This also helps if issues are detected during review in some of them (like below), delaying queuing of basic functionality and other correct parts.

I only looked at CPU_ALL_PORT(), pins, groups, and functions. Comments below.

Quoted 22 lines
drivers/pinctrl/sh-pfc/pfc-r8a77980.c new file +19 -0
 
+/* - AVB -------------------------------------------------------------------- */
+static const unsigned int avb_link_pins[] = {
+       /* AVB_LINK */
+       RCAR_GP_PIN(1, 18),
+};
+static const unsigned int avb_link_mux[] = {
+       AVB_LINK_MARK,
+};
+static const unsigned int avb_magic_pins[] = {
+       /* AVB_MAGIC */
+       RCAR_GP_PIN(1, 16),
+};
+static const unsigned int avb_magic_mux[] = {
+       AVB_MAGIC_MARK,
+};
+static const unsigned int avb_phy_int_pins[] = {
+       /* AVB_PHY_INT */
+       RCAR_GP_PIN(1, 17),
+};

drivers/pinctrl/sh-pfc/pfc-r8a77980.c line 866

Quoted 10 lines
drivers/pinctrl/sh-pfc/pfc-r8a77980.c new file +10 -0
+static const unsigned int avb_phy_int_mux[] = {
+       AVB_PHY_INT_MARK,
+};
+static const unsigned int avb_mdio_pins[] = {
+       /* AVB_MDC, AVB_MDIO */
+       RCAR_GP_PIN(1, 15), RCAR_GP_PIN(1, 14),
+};
+static const unsigned int avb_mdio_mux[] = {
+       AVB_MDC_MARK, AVB_MDIO_MARK,
+};

The grouping is different from other R-Car Gen3 SoCs.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Not true AFAICS -- only the group naming is different.

Oh, so we can have both groups names, and be compatible?

Probably. Just not sure if there's any worth to have the same groups for the not
pin compatible SoCs. Care to elaborate?

So I have compared all AVB/(G)ETHER pin groups on supported SoCs, to solve the issue for good, hopefully.

EtherAVB:
--------

R-Car Gen2:

Common (r8a7790/r8a7791/r8a7792/r8a7793/r8a7794) AVB:

    link = { LINK }
    magic = { MAGIC }
    phy_int = { PHY_INT }
    mdio = { MDC, MDIO }
    mii = { COL, CRS, RX_CLK, RXD[0-3], RX_DV, RX_ER, TX_CLK, TXD[0-3],
            TX_EN, TX_ER }
    gmii = { COL, CRS, GTX_CLK, GTXREFCLK, RX_CLK, RXD[0-7], RX_DV, RX_ER,
             TX_CLK, TXD[0-7], TX_EN, TX_ER }

AVB exceptions:
- r8a7790 "mii" lacks TX_ER (should it?)
- r8a7792 has match = { AVTP_MATCH }

R-Car Gen3:

r8a7795/r8a7795-es1/r8a7796/r8a77965/r8a77995 AVB:

    link = { LINK }
    magic = { MAGIC }
    phy_int = { PHY_INT }
    mdc = { MDC, MDIO }
    mii = { RD[0-3], RXC, RX_CTL, TD[0-3], TXC, TXCREFCLK, TX_CTL }
    avtp_pps = { AVTP_PPS }
    avtp_match = { AVTP_MATCH }
    avtp_capture = { AVTP_CAPTURE }

    Notes:
      - { MDC, MDIO } groups is named "mdc" instead of "mdio"
      - Supports RGMII, but group is named "mii"

Sergei's r8a77970 AVB proposal:

    link = { LINK }
    magic = { MAGIC }
    phy_int = { PHY_INT }
  * mdio = { MDC, MDIO }
    mii = { RD[0-3], RXC, RX_CTL, TD[0-3], TXC, TXCREFCLK, TX_CTL }
    avtp_pps = { AVTP_PPS }
    avtp_match = { AVTP_MATCH }
    avtp_capture = { AVTP_CAPTURE }

    Notes:
      * indicates difference with H3/M3/D3
      - Supports RGMII, but group is named "mii"

Sergei's r8a77980 AVB proposal:

    link = { LINK }
    magic = { MAGIC }
    phy_int = { PHY_INT }

* mdio = { MDC, MDIO }
* rgmii = { RD[0-3], RXC, RX_CTL, TD[0-3], TXC, TX_CTL }
* txcrefclk = { TXCREFCLK }
avtp_pps = { AVTP_PPS }
avtp_match = { AVTP_MATCH }
avtp_capture = { AVTP_CAPTURE }

Notes:
* indicates difference with H3/M3/D3
- Supports RGMII, and group is called "rgmii"
- TXCREFCLK has its own group. Why? Similarity with GETHER on V3H?

(G)Ether:
--------

R-Mobile A1 (r8a7740) ETHER:

    rmii = { CRS_DV, MDC, MDIO, REF50CK, RXD[01], RX_ER, TXD[01], TX_EN }
    mii = { COL, CRS, MDC, MDIO, RX_CLK, RXD[0-3], RX_DV, RX_ER, TX_CLK,
            TXD[0-3], TX_EN, TX_ER }
    gmii = { COL, CRS, GTX_CLK, MDC, MDIO, REF125CK, RXD[0-7], RX_CLK,
             RX_DV, RX_ER, TX_CLK, TXD[0-7], TX_EN, TX_ER }
    int = { PHY_INT }
    link = { LINK }
    wol = { WOL }

    Notes:
      - "rmii", "mii", and "gmii" include MDC and MDIO

R-Car Gen1:

r8a7778/r8a7779 ETHER:

    link = { LINK }
    magic = { MAGIC }
    rmii = { CRS_DV, MDC, MDIO, REF_CLK, RXD[01], RX_ER, TXD[01], TX_EN }

    Notes:
      - "rmii" includes MDC and MDIO (there's only one choice of interface)

R-Car Gen2:

r8a7790/r8a7791/r8a7793/r8a7794 ETHER:

    link = { LINK }
    magic = { MAGIC }
    mdio = { MDC, MDIO }
    rmii = { CRS_DV, REF_CLK, RXD[01], RX_ER, TXD[01], TX_EN }

R-Car Gen3:

Sergei's r8a77980 GETHER proposal:

    link = { LINK }
    magic = { MAGIC }
    phy_int = { PHY_INT }
    mdio = { MDC, MDIO }
    rgmii = { RD[0-3], RXC, RX_CTL, TD[0-3], TXC, TX_CTL }
    rmii = { CRS_DV, REFCLK, RXD[01], RX_ER, TXD[01], TXD_EN }
    txcrefclk = { TXCREFCLK }
    txcrefclk_mega = { TXCREFCLK_MEGA }

    Notes:
      - TXCREFCLK has its own group. I assume because one has to choose
        between TXCREFCLK and TXCREFCLK_MEGA?

Actions:
--------

- Add missing TX_ER to "mii" group on r8a7790,
- Rename "mdc" to "mdio" on H3/M3/D3, as the bus is called "Management Data Input/Output (MDIO)", add alias for backwords compatibility,
https://en.wikipedia.org/wiki/Management_Data_Input/Output
- Should we rename "mii" to "rgmii" on H3/M3/D3?
The group does not contain all RGMII pins anyway.

Thanks for your comments!

Quoted 24 lines
Quoted 24 lines
Quoted 24 lines
Quoted 23 lines
Quoted 9 lines
drivers/pinctrl/sh-pfc/pfc-r8a77980.c new file +8 -0
+/* - HSCIF0 ----------------------------------------------------------------- */
 
+static const unsigned int scif_clk_a_pins[] = {
+       /* SCIF_CLK */
+       RCAR_GP_PIN(0, 10),
+};
+static const unsigned int scif_clk_a_mux[] = {
+       SCIF_CLK_A_MARK,
+};

[...]

drivers/pinctrl/sh-pfc/pfc-r8a77980.c line 1168

Quoted 7 lines
drivers/pinctrl/sh-pfc/pfc-r8a77980.c new file +7 -0
+static const unsigned int scif_clk_b_pins[] = {
+       /* SCIF_CLK */
+       RCAR_GP_PIN(1, 25),
+};
+static const unsigned int scif_clk_b_mux[] = {
+       SCIF_CLK_B_MARK,
+};

Please move the scif_clk pins to their own section, as they are shared by HSCIF and SCIF.

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

Again, the same bit in MOD_SEL0...

Same story: SCIF_CLK is shared by the HSCIFx and SCIFx modules. Still puts the responsability in the hands of the board designer: he must

Responsibility. :-)

As long as it doesn't end up in a commit message...

Quoted 9 lines
Quoted 8 lines

know not to select SCIF_CLK_A and HSCIF0_B, or SCIF_CLK_B and HSCIF0_A.

On this SoC, the limitations seem to be worse than on other members of the same family.

However, on other SoCs you have similar limitations. E.g. on H3/M3-W/M3-N you cannot select scif5_data_a and scif5_clk_b, as they are both controlled through sel_scif5,

Quoted 6 lines
Quoted 3 lines

although the driver has them in separate groups.
But that is done to allow using only RX/TX functionality, and using the CTS/RTS pins for something else (a completely different function, or GPIO).

That's OK as they both are the part of the same function. My case is different,
sorry for not making this clear...

So, do you agree having a separate SCIF_CLK function, like on all other R-Car SoCs?

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#9 lore raw

Re: [PATCH 2/2] pinctrl: sh-pfc: add R8A77980 PFC support

Quoted 71 lines · Geert Uytterhoeven
Quoted 54 lines
Quoted 54 lines
Quoted 54 lines
Quoted 53 lines
Quoted 8 lines

Add the PFC support for the R8A77980 SoC including pin groups for some on-chip devices such as AVB, CAN-FD, GETHER, [H]SCIF, I2C, INTC-EX, MMC, MSIOF, PWM, and VIN...

Based on the original (and large) patch by Vladimir Barinov.

Thanks for your patch!

To avoid scaring off potential reviewers, it may be better to not include that many pin groups and functions in future initial submissions.
This also helps if issues are detected during review in some of them (like below), delaying queuing of basic functionality and other correct parts.

I only looked at CPU_ALL_PORT(), pins, groups, and functions. Comments below.

Quoted 22 lines
drivers/pinctrl/sh-pfc/pfc-r8a77980.c new file +19 -0
 
+/* - AVB -------------------------------------------------------------------- */
+static const unsigned int avb_link_pins[] = {
+       /* AVB_LINK */
+       RCAR_GP_PIN(1, 18),
+};
+static const unsigned int avb_link_mux[] = {
+       AVB_LINK_MARK,
+};
+static const unsigned int avb_magic_pins[] = {
+       /* AVB_MAGIC */
+       RCAR_GP_PIN(1, 16),
+};
+static const unsigned int avb_magic_mux[] = {
+       AVB_MAGIC_MARK,
+};
+static const unsigned int avb_phy_int_pins[] = {
+       /* AVB_PHY_INT */
+       RCAR_GP_PIN(1, 17),
+};

drivers/pinctrl/sh-pfc/pfc-r8a77980.c line 866

Quoted 10 lines
drivers/pinctrl/sh-pfc/pfc-r8a77980.c new file +10 -0
+static const unsigned int avb_phy_int_mux[] = {
+       AVB_PHY_INT_MARK,
+};
+static const unsigned int avb_mdio_pins[] = {
+       /* AVB_MDC, AVB_MDIO */
+       RCAR_GP_PIN(1, 15), RCAR_GP_PIN(1, 14),
+};
+static const unsigned int avb_mdio_mux[] = {
+       AVB_MDC_MARK, AVB_MDIO_MARK,
+};

The grouping is different from other R-Car Gen3 SoCs.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Not true AFAICS -- only the group naming is different.

Oh, so we can have both groups names, and be compatible?

Probably. Just not sure if there's any worth to have the same groups for the not
pin compatible SoCs. Care to elaborate?

So I have compared all AVB/(G)ETHER pin groups on supported SoCs, to solve the issue for good, hopefully.

EtherAVB:
--------

R-Car Gen2:

Common (r8a7790/r8a7791/r8a7792/r8a7793/r8a7794) AVB:

Quoted 7 lines
    link = { LINK }
    magic = { MAGIC }
    phy_int = { PHY_INT }
    mdio = { MDC, MDIO }
    mii = { COL, CRS, RX_CLK, RXD[0-3], RX_DV, RX_ER, TX_CLK, TXD[0-3],
            TX_EN, TX_ER }
    gmii = { COL, CRS, GTX_CLK, GTXREFCLK, RX_CLK, RXD[0-7], RX_DV, RX_ER,

Oops! GTXREFCLK is not a part of GMII (at least according to Wikipedia) ...

Quoted 4 lines
             TX_CLK, TXD[0-7], TX_EN, TX_ER }

AVB exceptions:
- r8a7790 "mii" lacks TX_ER (should it?)

This signal is optional.

Quoted 5 lines

- r8a7792 has match = { AVTP_MATCH }

R-Car Gen3:

Quoted 7 lines

r8a7795/r8a7795-es1/r8a7796/r8a77965/r8a77995 AVB:

    link = { LINK }
    magic = { MAGIC }
    phy_int = { PHY_INT }
    mdc = { MDC, MDIO }
    mii = { RD[0-3], RXC, RX_CTL, TD[0-3], TXC, TXCREFCLK, TX_CTL }

Oops again! TXREFCLK doen't belong in MII...

Quoted 7 lines
    avtp_pps = { AVTP_PPS }
    avtp_match = { AVTP_MATCH }
    avtp_capture = { AVTP_CAPTURE }

    Notes:
      - { MDC, MDIO } groups is named "mdc" instead of "mdio"
      - Supports RGMII, but group is named "mii"

Oops... I blame Renesas! :-)

Quoted 14 lines

Sergei's r8a77970 AVB proposal:

    link = { LINK }
    magic = { MAGIC }
    phy_int = { PHY_INT }
  * mdio = { MDC, MDIO }
    mii = { RD[0-3], RXC, RX_CTL, TD[0-3], TXC, TXCREFCLK, TX_CTL }
    avtp_pps = { AVTP_PPS }
    avtp_match = { AVTP_MATCH }
    avtp_capture = { AVTP_CAPTURE }

    Notes:
      * indicates difference with H3/M3/D3
      - Supports RGMII, but group is named "mii"

Oops, needs fixing...

Quoted 12 lines

Sergei's r8a77980 AVB proposal:

    link = { LINK }
    magic = { MAGIC }
    phy_int = { PHY_INT }

* mdio = { MDC, MDIO }
* rgmii = { RD[0-3], RXC, RX_CTL, TD[0-3], TXC, TX_CTL }
* txcrefclk = { TXCREFCLK }
avtp_pps = { AVTP_PPS }
avtp_match = { AVTP_MATCH }
avtp_capture = { AVTP_CAPTURE }

Quoted 4 lines

Notes:
* indicates difference with H3/M3/D3
- Supports RGMII, and group is called "rgmii"
- TXCREFCLK has its own group. Why? Similarity with GETHER on V3H?

Because that signal doesn't belong to RGMII (according to Wikipedia).

Quoted 9 lines

(G)Ether:
--------

R-Mobile A1 (r8a7740) ETHER:

    rmii = { CRS_DV, MDC, MDIO, REF50CK, RXD[01], RX_ER, TXD[01], TX_EN }
    mii = { COL, CRS, MDC, MDIO, RX_CLK, RXD[0-3], RX_DV, RX_ER, TX_CLK,
            TXD[0-3], TX_EN, TX_ER }
    gmii = { COL, CRS, GTX_CLK, MDC, MDIO, REF125CK, RXD[0-7], RX_CLK,

Oops, REF125CK doesn't belong to GMII...

Quoted 7 lines
             RX_DV, RX_ER, TX_CLK, TXD[0-7], TX_EN, TX_ER }
    int = { PHY_INT }
    link = { LINK }
    wol = { WOL }

    Notes:
      - "rmii", "mii", and "gmii" include MDC and MDIO

That sucketh! :-)

Quoted 10 lines

R-Car Gen1:

r8a7778/r8a7779 ETHER:

    link = { LINK }
    magic = { MAGIC }
    rmii = { CRS_DV, MDC, MDIO, REF_CLK, RXD[01], RX_ER, TXD[01], TX_EN }

    Notes:
      - "rmii" includes MDC and MDIO (there's only one choice of interface)

That too...

Quoted 14 lines

R-Car Gen2:

r8a7790/r8a7791/r8a7793/r8a7794 ETHER:

    link = { LINK }
    magic = { MAGIC }
    mdio = { MDC, MDIO }
    rmii = { CRS_DV, REF_CLK, RXD[01], RX_ER, TXD[01], TX_EN }

R-Car Gen3:

Sergei's r8a77980 GETHER proposal:

Quoted 12 lines
    link = { LINK }
    magic = { MAGIC }
    phy_int = { PHY_INT }
    mdio = { MDC, MDIO }
    rgmii = { RD[0-3], RXC, RX_CTL, TD[0-3], TXC, TX_CTL }
    rmii = { CRS_DV, REFCLK, RXD[01], RX_ER, TXD[01], TXD_EN }
    txcrefclk = { TXCREFCLK }
    txcrefclk_mega = { TXCREFCLK_MEGA }

    Notes:
      - TXCREFCLK has its own group. I assume because one has to choose
        between TXCREFCLK and TXCREFCLK_MEGA?

No, because they're not a part of either RGMII or RMII interfaces.

Quoted 4 lines

Actions:
--------

- Add missing TX_ER to "mii" group on r8a7790,

Remembering it's optional...

Quoted 3 lines

- Rename "mdc" to "mdio" on H3/M3/D3, as the bus is called "Management Data Input/Output (MDIO)", add alias for backwords compatibility,
https://en.wikipedia.org/wiki/Management_Data_Input/Output

Agreed.

Quoted 2 lines

- Should we rename "mii" to "rgmii" on H3/M3/D3? The group does not contain all RGMII pins anyway.

It does!

Quoted 48 lines

Thanks for your comments!

Quoted 24 lines
Quoted 24 lines
Quoted 24 lines
Quoted 23 lines
Quoted 9 lines
drivers/pinctrl/sh-pfc/pfc-r8a77980.c new file +8 -0
+/* - HSCIF0 ----------------------------------------------------------------- */
 
+static const unsigned int scif_clk_a_pins[] = {
+       /* SCIF_CLK */
+       RCAR_GP_PIN(0, 10),
+};
+static const unsigned int scif_clk_a_mux[] = {
+       SCIF_CLK_A_MARK,
+};

[...]

drivers/pinctrl/sh-pfc/pfc-r8a77980.c line 1168

Quoted 7 lines
drivers/pinctrl/sh-pfc/pfc-r8a77980.c new file +7 -0
+static const unsigned int scif_clk_b_pins[] = {
+       /* SCIF_CLK */
+       RCAR_GP_PIN(1, 25),
+};
+static const unsigned int scif_clk_b_mux[] = {
+       SCIF_CLK_B_MARK,
+};

Please move the scif_clk pins to their own section, as they are shared by HSCIF and SCIF.

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

Again, the same bit in MOD_SEL0...

Same story: SCIF_CLK is shared by the HSCIFx and SCIFx modules. Still puts the responsability in the hands of the board designer: he must

Responsibility. :-)

As long as it doesn't end up in a commit message...

Quoted 13 lines
Quoted 12 lines

know not to select SCIF_CLK_A and HSCIF0_B, or SCIF_CLK_B and HSCIF0_A.

On this SoC, the limitations seem to be worse than on other members of the same family.

However, on other SoCs you have similar limitations. E.g. on H3/M3-W/M3-N you cannot select scif5_data_a and scif5_clk_b, as they are both controlled through sel_scif5,

although the driver has them in separate groups.
But that is done to allow using only RX/TX functionality, and using the CTS/RTS pins for something else (a completely different function, or GPIO).

Quoted 5 lines
Quoted 2 lines

That's OK as they both are the part of the same function. My case is different,
sorry for not making this clear...

So, do you agree having a separate SCIF_CLK function, like on all other R-Car SoCs?

I agree as long as that works...

Quoted 3 lines

Gr{oetje,eeting}s,

Geert

MBR, Sergei

#10 lore raw

Re: [PATCH 2/2] pinctrl: sh-pfc: add R8A77980 PFC support

Hi Sergei,

Quoted 80 lines · Sergei Shtylyov
Quoted 71 lines · Geert Uytterhoeven
Quoted 54 lines
Quoted 54 lines
Quoted 54 lines
Quoted 53 lines
Quoted 8 lines

Add the PFC support for the R8A77980 SoC including pin groups for some on-chip devices such as AVB, CAN-FD, GETHER, [H]SCIF, I2C, INTC-EX, MMC, MSIOF, PWM, and VIN...

Based on the original (and large) patch by Vladimir Barinov.

Thanks for your patch!

To avoid scaring off potential reviewers, it may be better to not include that many pin groups and functions in future initial submissions.
This also helps if issues are detected during review in some of them (like below), delaying queuing of basic functionality and other correct parts.

I only looked at CPU_ALL_PORT(), pins, groups, and functions. Comments below.

Quoted 22 lines
drivers/pinctrl/sh-pfc/pfc-r8a77980.c new file +19 -0
 
+/* - AVB -------------------------------------------------------------------- */
+static const unsigned int avb_link_pins[] = {
+       /* AVB_LINK */
+       RCAR_GP_PIN(1, 18),
+};
+static const unsigned int avb_link_mux[] = {
+       AVB_LINK_MARK,
+};
+static const unsigned int avb_magic_pins[] = {
+       /* AVB_MAGIC */
+       RCAR_GP_PIN(1, 16),
+};
+static const unsigned int avb_magic_mux[] = {
+       AVB_MAGIC_MARK,
+};
+static const unsigned int avb_phy_int_pins[] = {
+       /* AVB_PHY_INT */
+       RCAR_GP_PIN(1, 17),
+};

drivers/pinctrl/sh-pfc/pfc-r8a77980.c

Quoted 10 lines
drivers/pinctrl/sh-pfc/pfc-r8a77980.c new file +10 -0
+static const unsigned int avb_phy_int_mux[] = {
+       AVB_PHY_INT_MARK,
+};
+static const unsigned int avb_mdio_pins[] = {
+       /* AVB_MDC, AVB_MDIO */
+       RCAR_GP_PIN(1, 15), RCAR_GP_PIN(1, 14),
+};
+static const unsigned int avb_mdio_mux[] = {
+       AVB_MDC_MARK, AVB_MDIO_MARK,
+};

The grouping is different from other R-Car Gen3 SoCs.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Not true AFAICS -- only the group naming is different.

Oh, so we can have both groups names, and be compatible?

Probably. Just not sure if there's any worth to have the same groups for the not
pin compatible SoCs. Care to elaborate?

So I have compared all AVB/(G)ETHER pin groups on supported SoCs, to solve the issue for good, hopefully.

EtherAVB:
--------

R-Car Gen2:

Common (r8a7790/r8a7791/r8a7792/r8a7793/r8a7794) AVB:

Quoted 7 lines
    link = { LINK }
    magic = { MAGIC }
    phy_int = { PHY_INT }
    mdio = { MDC, MDIO }
    mii = { COL, CRS, RX_CLK, RXD[0-3], RX_DV, RX_ER, TX_CLK, TXD[0-3],
            TX_EN, TX_ER }
    gmii = { COL, CRS, GTX_CLK, GTXREFCLK, RX_CLK, RXD[0-7], RX_DV, RX_ER,
Quoted 1 line

Oops! GTXREFCLK is not a part of GMII (at least according to Wikipedia) ...

According to the datasheet, it's the "GMII reference clock signal", which is an input, and can be used as one of the options for the gPTP clock. So that makes it optional.

We have only two in-tree users of RAVB:
iwg20d-q7-common.dtsi
r8a7745-iwg22d-sodimm.dts

On both, GTXREFCLK is wired to the CLK125_NDO/LED_MODE _input_ of the KSZ9031MNXIA PHY, so there it is used as an output?

Quoted 6 lines
Quoted 4 lines
             TX_CLK, TXD[0-7], TX_EN, TX_ER }

AVB exceptions:
- r8a7790 "mii" lacks TX_ER (should it?)

This signal is optional.

But currently there's no way to enable it on r8a7790? If it is optional, it should have its own pingroup.

And this is inconsistent with the other R-Car Gen2 platforms.

Quoted 7 lines
Quoted 7 lines

- r8a7792 has match = { AVTP_MATCH }

R-Car Gen3:

r8a7795/r8a7795-es1/r8a7796/r8a77965/r8a77995 AVB:

Quoted 7 lines
Quoted 5 lines
    link = { LINK }
    magic = { MAGIC }
    phy_int = { PHY_INT }
    mdc = { MDC, MDIO }
    mii = { RD[0-3], RXC, RX_CTL, TD[0-3], TXC, TXCREFCLK, TX_CTL }

Oops again! TXREFCLK doen't belong in MII...

We cannot move it out because of backwards compatibility (this is DT ABI). But we can create a new group named "rgmii" without it, and add a separate "txcrefclk" group.

Quoted 21 lines
Quoted 7 lines
    avtp_pps = { AVTP_PPS }
    avtp_match = { AVTP_MATCH }
    avtp_capture = { AVTP_CAPTURE }

    Notes:
      - { MDC, MDIO } groups is named "mdc" instead of "mdio"
      - Supports RGMII, but group is named "mii"

Oops... I blame Renesas! :-)

Quoted 11 lines

Sergei's r8a77970 AVB proposal:

    link = { LINK }
    magic = { MAGIC }
    phy_int = { PHY_INT }
  * mdio = { MDC, MDIO }
    mii = { RD[0-3], RXC, RX_CTL, TD[0-3], TXC, TXCREFCLK, TX_CTL }
    avtp_pps = { AVTP_PPS }
    avtp_match = { AVTP_MATCH }
    avtp_capture = { AVTP_CAPTURE }
Quoted 5 lines
Quoted 3 lines

Notes:
* indicates difference with H3/M3/D3
- Supports RGMII, but group is named "mii"

Oops, needs fixing...

This we can fix easily, as it is not yet upstream.

Quoted 12 lines
Quoted 12 lines

Sergei's r8a77980 AVB proposal:

    link = { LINK }
    magic = { MAGIC }
    phy_int = { PHY_INT }
  * mdio = { MDC, MDIO }
  * rgmii = { RD[0-3], RXC, RX_CTL, TD[0-3], TXC, TX_CTL }
  * txcrefclk = { TXCREFCLK }
    avtp_pps = { AVTP_PPS }
    avtp_match = { AVTP_MATCH }
    avtp_capture = { AVTP_CAPTURE }
Quoted 6 lines
Quoted 4 lines

Notes:
* indicates difference with H3/M3/D3
- Supports RGMII, and group is called "rgmii"
- TXCREFCLK has its own group. Why? Similarity with GETHER on V3H?

Because that signal doesn't belong to RGMII (according to Wikipedia).

OK (so this one looks best ;-)

Quoted 11 lines
Quoted 9 lines

(G)Ether:
--------

R-Mobile A1 (r8a7740) ETHER:

    rmii = { CRS_DV, MDC, MDIO, REF50CK, RXD[01], RX_ER, TXD[01], TX_EN }
    mii = { COL, CRS, MDC, MDIO, RX_CLK, RXD[0-3], RX_DV, RX_ER, TX_CLK,
            TXD[0-3], TX_EN, TX_ER }
    gmii = { COL, CRS, GTX_CLK, MDC, MDIO, REF125CK, RXD[0-7], RX_CLK,

Oops, REF125CK doesn't belong to GMII...

Cannot be changed because of backwards compatibility.

Quoted 9 lines
Quoted 7 lines
             RX_DV, RX_ER, TX_CLK, TXD[0-7], TX_EN, TX_ER }
    int = { PHY_INT }
    link = { LINK }
    wol = { WOL }

    Notes:
      - "rmii", "mii", and "gmii" include MDC and MDIO

That sucketh! :-)

Cannot be changed.

Quoted 4 lines
Quoted 4 lines

R-Car Gen1:

r8a7778/r8a7779 ETHER:

Quoted 8 lines
Quoted 6 lines
    link = { LINK }
    magic = { MAGIC }
    rmii = { CRS_DV, MDC, MDIO, REF_CLK, RXD[01], RX_ER, TXD[01], TX_EN }

    Notes:
      - "rmii" includes MDC and MDIO (there's only one choice of interface)
   That too...

Cannot be changed.

Quoted 23 lines
Quoted 23 lines

R-Car Gen2:

r8a7790/r8a7791/r8a7793/r8a7794 ETHER:

    link = { LINK }
    magic = { MAGIC }
    mdio = { MDC, MDIO }
    rmii = { CRS_DV, REF_CLK, RXD[01], RX_ER, TXD[01], TX_EN }

R-Car Gen3:

Sergei's r8a77980 GETHER proposal:

    link = { LINK }
    magic = { MAGIC }
    phy_int = { PHY_INT }
    mdio = { MDC, MDIO }
    rgmii = { RD[0-3], RXC, RX_CTL, TD[0-3], TXC, TX_CTL }
    rmii = { CRS_DV, REFCLK, RXD[01], RX_ER, TXD[01], TXD_EN }
    txcrefclk = { TXCREFCLK }
    txcrefclk_mega = { TXCREFCLK_MEGA }
Quoted 5 lines
Quoted 3 lines

Notes:
- TXCREFCLK has its own group. I assume because one has to choose between TXCREFCLK and TXCREFCLK_MEGA?

No, because they're not a part of either RGMII or RMII interfaces.

OK.

Quoted 6 lines
Quoted 4 lines

Actions:
--------

- Add missing TX_ER to "mii" group on r8a7790,

Remembering it's optional...

While we can add a separate "tx_er" group, we cannot change the "mii" groups on the other R-Car Gen2 SoCs.
So just making r8a7790 consistent with the others looks like the path of least harm to me...

Quoted 10 lines
Quoted 3 lines

- Rename "mdc" to "mdio" on H3/M3/D3, as the bus is called "Management Data Input/Output (MDIO)", add alias for backwords compatibility,
https://en.wikipedia.org/wiki/Management_Data_Input/Output

Agreed.

Quoted 2 lines

- Should we rename "mii" to "rgmii" on H3/M3/D3? The group does not contain all RGMII pins anyway.

It does!

I mean it doesn't include MDIO/MDC, which are part of "rgmii" according to Wikipedia.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

maintainer Reviewed-by on v1 2/2
#11 lore raw

Re: [PATCH 2/2] pinctrl: sh-pfc: add R8A77980 PFC support

In reply to Sergei Shtylyov
Quoted 11 lines · Sergei Shtylyov

Add the PFC support for the R8A77980 SoC including pin groups for some on-chip devices such as AVB, CAN-FD, GETHER, [H]SCIF, I2C, INTC-EX, MMC, MSIOF, PWM, and VIN...

Based on the original (and large) patch by Vladimir Barinov.

---
 Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt |    1 
Quoted 6 lines
 drivers/pinctrl/sh-pfc/Kconfig                                    |    5 
 drivers/pinctrl/sh-pfc/Makefile                                   |    1 
 drivers/pinctrl/sh-pfc/core.c                                     |    6 
 drivers/pinctrl/sh-pfc/pfc-r8a77980.c                             | 2738 ++++++++++
 drivers/pinctrl/sh-pfc/sh_pfc.h                                   |    1 
 6 files changed, 2752 insertions(+)