Skip to contentSkip to conversation

pinctrl: sh-pfc: r8a77965: Add CAN pins, groups and functions

PATCH In review Marek Vasut 2 participants 12 messages Nov 19, 2018 – Nov 27, 2018 Pin control

lore
Share & tools
lore
#0 lore raw

PATCH 1/4 pinctrl: sh-pfc: r8a77965: Add CAN pins, groups and functions

From: Takeshi Kihara <[email protected]>

This patch adds CAN{0,1} pins, groups and functions to the R8A77965 SoC.

Cc Geert Uytterhoeven <[email protected]>
Cc Simon Horman <[email protected]>
Cc Wolfram Sang <[email protected]>
Cc Yoshihiro Shimoda <[email protected]>
---
 drivers/pinctrl/sh-pfc/pfc-r8a77965.c | 58 +++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)
drivers/pinctrl/sh-pfc/pfc-r8a77965.c +58 -0
index dfdd982984d4..759b10e91d74 100644
@@ -1784,6 +1784,44 @@ static const unsigned int avb_avtp_capture_b_mux[] = {
 	AVB_AVTP_CAPTURE_B_MARK,
 };
 
+/* - CAN ------------------------------------------------------------------ */
+static const unsigned int can0_data_a_pins[] = {
+	/* TX, RX */
+	RCAR_GP_PIN(1, 23),	RCAR_GP_PIN(1, 24),
+};
+
+static const unsigned int can0_data_a_mux[] = {
+	CAN0_TX_A_MARK,		CAN0_RX_A_MARK,
+};
+
+static const unsigned int can0_data_b_pins[] = {
+	/* TX, RX */
+	RCAR_GP_PIN(2, 0),	RCAR_GP_PIN(2, 1),
+};
+
+static const unsigned int can0_data_b_mux[] = {
+	CAN0_TX_B_MARK,		CAN0_RX_B_MARK,
+};
+
+static const unsigned int can1_data_pins[] = {
+	/* TX, RX */
+	RCAR_GP_PIN(1, 22),	RCAR_GP_PIN(1, 26),
+};
+
+static const unsigned int can1_data_mux[] = {
+	CAN1_TX_MARK,		CAN1_RX_MARK,
+};
+
+/* - CAN Clock -------------------------------------------------------------- */
+static const unsigned int can_clk_pins[] = {
+	/* CLK */
+	RCAR_GP_PIN(1, 25),
+};
+
+static const unsigned int can_clk_mux[] = {
+	CAN_CLK_MARK,
+};
+
 /* - DU --------------------------------------------------------------------- */
 static const unsigned int du_rgb666_pins[] = {
 	/* R[7:2], G[7:2], B[7:2] */
@@ -3754,6 +3792,10 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {
 	SH_PFC_PIN_GROUP(avb_avtp_capture_a),
 	SH_PFC_PIN_GROUP(avb_avtp_match_b),
 	SH_PFC_PIN_GROUP(avb_avtp_capture_b),
+	SH_PFC_PIN_GROUP(can0_data_a),
+	SH_PFC_PIN_GROUP(can0_data_b),
+	SH_PFC_PIN_GROUP(can1_data),
+	SH_PFC_PIN_GROUP(can_clk),
 	SH_PFC_PIN_GROUP(du_rgb666),
 	SH_PFC_PIN_GROUP(du_rgb888),
 	SH_PFC_PIN_GROUP(du_clk_out_0),
@@ -4036,6 +4078,19 @@ static const char * const avb_groups[] = {
 	"avb_avtp_capture_b",
 };
 
+static const char * const can0_groups[] = {
+	"can0_data_a",
+	"can0_data_b",
+};
+
+static const char * const can1_groups[] = {
+	"can1_data",
+};
+
+static const char * const can_clk_groups[] = {
+	"can_clk",
+};
+
 static const char * const du_groups[] = {
 	"du_rgb666",
 	"du_rgb888",
@@ -4395,6 +4450,9 @@ static const char * const usb30_groups[] = {
 static const struct sh_pfc_function pinmux_functions[] = {
 	SH_PFC_FUNCTION(audio_clk),
 	SH_PFC_FUNCTION(avb),
+	SH_PFC_FUNCTION(can0),
+	SH_PFC_FUNCTION(can1),
+	SH_PFC_FUNCTION(can_clk),
 	SH_PFC_FUNCTION(du),
 	SH_PFC_FUNCTION(hscif0),
 	SH_PFC_FUNCTION(hscif1),
Signature · 1 line
2.18.0
#1 lore raw

PATCH 2/4 pinctrl: sh-pfc: r8a77965: Add CAN FD pins, groups and functions

From: Takeshi Kihara <[email protected]>

This patch adds CAN FD{0,1} pins, groups and functions to the R8A77965 SoC.

Cc Geert Uytterhoeven <[email protected]>
Cc Simon Horman <[email protected]>
Cc Wolfram Sang <[email protected]>
Cc Yoshihiro Shimoda <[email protected]>
---
 drivers/pinctrl/sh-pfc/pfc-r8a77965.c | 42 +++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)
drivers/pinctrl/sh-pfc/pfc-r8a77965.c +42 -0
index 759b10e91d74..e26d101fe51c 100644
@@ -1822,6 +1822,34 @@ static const unsigned int can_clk_mux[] = {
 	CAN_CLK_MARK,
 };
 
+/* - CAN FD --------------------------------------------------------------- */
+static const unsigned int canfd0_data_a_pins[] = {
+	/* TX, RX */
+	RCAR_GP_PIN(1, 23),     RCAR_GP_PIN(1, 24),
+};
+
+static const unsigned int canfd0_data_a_mux[] = {
+	CANFD0_TX_A_MARK,       CANFD0_RX_A_MARK,
+};
+
+static const unsigned int canfd0_data_b_pins[] = {
+	/* TX, RX */
+	RCAR_GP_PIN(2, 0),      RCAR_GP_PIN(2, 1),
+};
+
+static const unsigned int canfd0_data_b_mux[] = {
+	CANFD0_TX_B_MARK,       CANFD0_RX_B_MARK,
+};
+
+static const unsigned int canfd1_data_pins[] = {
+	/* TX, RX */
+	RCAR_GP_PIN(1, 22),     RCAR_GP_PIN(1, 26),
+};
+
+static const unsigned int canfd1_data_mux[] = {
+	CANFD1_TX_MARK,         CANFD1_RX_MARK,
+};
+
 /* - DU --------------------------------------------------------------------- */
 static const unsigned int du_rgb666_pins[] = {
 	/* R[7:2], G[7:2], B[7:2] */
@@ -3796,6 +3824,9 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {
 	SH_PFC_PIN_GROUP(can0_data_b),
 	SH_PFC_PIN_GROUP(can1_data),
 	SH_PFC_PIN_GROUP(can_clk),
+	SH_PFC_PIN_GROUP(canfd0_data_a),
+	SH_PFC_PIN_GROUP(canfd0_data_b),
+	SH_PFC_PIN_GROUP(canfd1_data),
 	SH_PFC_PIN_GROUP(du_rgb666),
 	SH_PFC_PIN_GROUP(du_rgb888),
 	SH_PFC_PIN_GROUP(du_clk_out_0),
@@ -4091,6 +4122,15 @@ static const char * const can_clk_groups[] = {
 	"can_clk",
 };
 
+static const char * const canfd0_groups[] = {
+	"canfd0_data_a",
+	"canfd0_data_b",
+};
+
+static const char * const canfd1_groups[] = {
+	"canfd1_data",
+};
+
 static const char * const du_groups[] = {
 	"du_rgb666",
 	"du_rgb888",
@@ -4453,6 +4493,8 @@ static const struct sh_pfc_function pinmux_functions[] = {
 	SH_PFC_FUNCTION(can0),
 	SH_PFC_FUNCTION(can1),
 	SH_PFC_FUNCTION(can_clk),
+	SH_PFC_FUNCTION(canfd0),
+	SH_PFC_FUNCTION(canfd1),
 	SH_PFC_FUNCTION(du),
 	SH_PFC_FUNCTION(hscif0),
 	SH_PFC_FUNCTION(hscif1),
Signature · 1 line
2.18.0
Reviewed-by on v1 2/4
#2 lore raw

Re: [PATCH 2/4] pinctrl: sh-pfc: r8a77965: Add CAN FD pins, groups and functions

Quoted 7 lines · Marek Vasut

From: Takeshi Kihara <[email protected]>

This patch adds CAN FD{0,1} pins, groups and functions to the R8A77965 SoC.

i.e. will queue in sh-pfc-for-v4.21.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
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 3/4 pinctrl: sh-pfc: r8a77990: Add CAN pins, groups and functions

In reply to Marek Vasut

From: Takeshi Kihara <[email protected]>

This patch adds CAN{0,1} pins, groups and functions to the R8A77990 SoC.

Cc Geert Uytterhoeven <[email protected]>
Cc Simon Horman <[email protected]>
Cc Wolfram Sang <[email protected]>
Cc Yoshihiro Shimoda <[email protected]>
---
 drivers/pinctrl/sh-pfc/pfc-r8a77990.c | 51 +++++++++++++++++++++++++--
 1 file changed, 49 insertions(+), 2 deletions(-)
drivers/pinctrl/sh-pfc/pfc-r8a77990.c +49 -2
index 95d478353627..db000acc880c 100644
@@ -1375,6 +1375,35 @@ static const unsigned int avb_avtp_capture_a_mux[] = {
 	AVB_AVTP_CAPTURE_A_MARK,
 };
 
+/* - CAN ------------------------------------------------------------------ */
+static const unsigned int can0_data_pins[] = {
+	/* TX, RX */
+	RCAR_GP_PIN(0, 12), RCAR_GP_PIN(0, 13),
+};
+
+static const unsigned int can0_data_mux[] = {
+	CAN0_TX_MARK, CAN0_RX_MARK,
+};
+
+static const unsigned int can1_data_pins[] = {
+	/* TX, RX */
+	RCAR_GP_PIN(0, 4), RCAR_GP_PIN(0, 7),
+};
+
+static const unsigned int can1_data_mux[] = {
+	CAN1_TX_MARK, CAN1_RX_MARK,
+};
+
+/* - CAN Clock -------------------------------------------------------------- */
+static const unsigned int can_clk_pins[] = {
+	/* CLK */
+	RCAR_GP_PIN(0, 14),
+};
+
+static const unsigned int can_clk_mux[] = {
+	CAN_CLK_MARK,
+};
+
 /* - DU --------------------------------------------------------------------- */
 static const unsigned int du_rgb666_pins[] = {
 	/* R[7:2], G[7:2], B[7:2] */
@@ -2606,7 +2635,7 @@ static const unsigned int usb30_id_mux[] = {
 };
 
 static const struct {
-	struct sh_pfc_pin_group common[140];
+	struct sh_pfc_pin_group common[143];
 	struct sh_pfc_pin_group automotive[0];
 } pinmux_groups = {
 	.common = {
@@ -2617,6 +2646,9 @@ static const struct {
 		SH_PFC_PIN_GROUP(avb_avtp_pps),
 		SH_PFC_PIN_GROUP(avb_avtp_match_a),
 		SH_PFC_PIN_GROUP(avb_avtp_capture_a),
+		SH_PFC_PIN_GROUP(can0_data),
+		SH_PFC_PIN_GROUP(can1_data),
+		SH_PFC_PIN_GROUP(can_clk),
 		SH_PFC_PIN_GROUP(du_rgb666),
 		SH_PFC_PIN_GROUP(du_rgb888),
 		SH_PFC_PIN_GROUP(du_clk_in_0),
@@ -2763,6 +2795,18 @@ static const char * const avb_groups[] = {
 	"avb_avtp_capture_a",
 };
 
+static const char * const can0_groups[] = {
+	"can0_data",
+};
+
+static const char * const can1_groups[] = {
+	"can1_data",
+};
+
+static const char * const can_clk_groups[] = {
+	"can_clk",
+};
+
 static const char * const du_groups[] = {
 	"du_rgb666",
 	"du_rgb888",
@@ -2990,11 +3034,14 @@ static const char * const usb30_groups[] = {
 };
 
 static const struct {
-	struct sh_pfc_function common[32];
+	struct sh_pfc_function common[35];
 	struct sh_pfc_function automotive[0];
 } pinmux_functions = {
 	.common = {
 		SH_PFC_FUNCTION(avb),
+		SH_PFC_FUNCTION(can0),
+		SH_PFC_FUNCTION(can1),
+		SH_PFC_FUNCTION(can_clk),
 		SH_PFC_FUNCTION(du),
 		SH_PFC_FUNCTION(i2c1),
 		SH_PFC_FUNCTION(i2c2),
Signature · 1 line
2.18.0
Reviewed-by on v1 3/4
#4 lore raw

Re: [PATCH 3/4] pinctrl: sh-pfc: r8a77990: Add CAN pins, groups and functions

Quoted 6 lines · Marek Vasut

From: Takeshi Kihara <[email protected]>

This patch adds CAN{0,1} pins, groups and functions to the R8A77990 SoC.

i.e. will queue in sh-pfc-for-v4.21.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
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

PATCH 4/4 pinctrl: sh-pfc: r8a77990: Add CAN FD pins, groups and functions

In reply to Marek Vasut

From: Takeshi Kihara <[email protected]>

This patch adds CAN FD{0,1} pins, groups and functions to the R8A77990 SoC.

Cc Geert Uytterhoeven <[email protected]>
Cc Simon Horman <[email protected]>
Cc Wolfram Sang <[email protected]>
Cc Yoshihiro Shimoda <[email protected]>
---
 drivers/pinctrl/sh-pfc/pfc-r8a77990.c | 35 +++++++++++++++++++++++++--
 1 file changed, 33 insertions(+), 2 deletions(-)
drivers/pinctrl/sh-pfc/pfc-r8a77990.c +33 -2
index db000acc880c..96c2f4fcdb8e 100644
@@ -1404,6 +1404,25 @@ static const unsigned int can_clk_mux[] = {
 	CAN_CLK_MARK,
 };
 
+/* - CAN FD --------------------------------------------------------------- */
+static const unsigned int canfd0_data_pins[] = {
+	/* TX, RX */
+	RCAR_GP_PIN(0, 12), RCAR_GP_PIN(0, 13),
+};
+
+static const unsigned int canfd0_data_mux[] = {
+	CANFD0_TX_MARK, CANFD0_RX_MARK,
+};
+
+static const unsigned int canfd1_data_pins[] = {
+	/* TX, RX */
+	RCAR_GP_PIN(0, 4), RCAR_GP_PIN(0, 7),
+};
+
+static const unsigned int canfd1_data_mux[] = {
+	CANFD1_TX_MARK, CANFD1_RX_MARK,
+};
+
 /* - DU --------------------------------------------------------------------- */
 static const unsigned int du_rgb666_pins[] = {
 	/* R[7:2], G[7:2], B[7:2] */
@@ -2635,7 +2654,7 @@ static const unsigned int usb30_id_mux[] = {
 };
 
 static const struct {
-	struct sh_pfc_pin_group common[143];
+	struct sh_pfc_pin_group common[145];
 	struct sh_pfc_pin_group automotive[0];
 } pinmux_groups = {
 	.common = {
@@ -2649,6 +2668,8 @@ static const struct {
 		SH_PFC_PIN_GROUP(can0_data),
 		SH_PFC_PIN_GROUP(can1_data),
 		SH_PFC_PIN_GROUP(can_clk),
+		SH_PFC_PIN_GROUP(canfd0_data),
+		SH_PFC_PIN_GROUP(canfd1_data),
 		SH_PFC_PIN_GROUP(du_rgb666),
 		SH_PFC_PIN_GROUP(du_rgb888),
 		SH_PFC_PIN_GROUP(du_clk_in_0),
@@ -2807,6 +2828,14 @@ static const char * const can_clk_groups[] = {
 	"can_clk",
 };
 
+static const char * const canfd0_groups[] = {
+	"canfd0_data",
+};
+
+static const char * const canfd1_groups[] = {
+	"canfd1_data",
+};
+
 static const char * const du_groups[] = {
 	"du_rgb666",
 	"du_rgb888",
@@ -3034,7 +3063,7 @@ static const char * const usb30_groups[] = {
 };
 
 static const struct {
-	struct sh_pfc_function common[35];
+	struct sh_pfc_function common[37];
 	struct sh_pfc_function automotive[0];
 } pinmux_functions = {
 	.common = {
@@ -3042,6 +3071,8 @@ static const struct {
 		SH_PFC_FUNCTION(can0),
 		SH_PFC_FUNCTION(can1),
 		SH_PFC_FUNCTION(can_clk),
+		SH_PFC_FUNCTION(canfd0),
+		SH_PFC_FUNCTION(canfd1),
 		SH_PFC_FUNCTION(du),
 		SH_PFC_FUNCTION(i2c1),
 		SH_PFC_FUNCTION(i2c2),
Signature · 1 line
2.18.0
Reviewed-by on v1 4/4
#6 lore raw

Re: [PATCH 4/4] pinctrl: sh-pfc: r8a77990: Add CAN FD pins, groups and functions

Quoted 7 lines · Marek Vasut

From: Takeshi Kihara <[email protected]>

This patch adds CAN FD{0,1} pins, groups and functions to the R8A77990 SoC.

i.e. will queue in sh-pfc-for-v4.21.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
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 4/4] pinctrl: sh-pfc: r8a77990: Add CAN FD pins, groups and functions

Hi Marek,

Quoted 11 lines · Geert Uytterhoeven
Quoted 7 lines · Marek Vasut

From: Takeshi Kihara <[email protected]>

This patch adds CAN FD{0,1} pins, groups and functions to the R8A77990 SoC.

i.e. will queue in sh-pfc-for-v4.21.

Upon second look, the canfd groups and functions should be moved from the common to the automotive section, as RZ/G2E does not have them. As I have to update the array sizes anyway (my branch already has more patches applied), I moved them while applying.

Please check the result later today, after I have pushed. Thanks!

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
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
#8 lore raw

Re: [PATCH 4/4] pinctrl: sh-pfc: r8a77990: Add CAN FD pins, groups and functions

Quoted 1 line · Geert Uytterhoeven

Hi Marek,

Hi,

Quoted 14 lines
Quoted 11 lines · Geert Uytterhoeven
Quoted 7 lines · Marek Vasut

From: Takeshi Kihara <[email protected]>

This patch adds CAN FD{0,1} pins, groups and functions to the R8A77990 SoC.

i.e. will queue in sh-pfc-for-v4.21.

Quoted 6 lines

Upon second look, the canfd groups and functions should be moved from the common to the automotive section, as RZ/G2E does not have them. As I have to update the array sizes anyway (my branch already has more patches applied), I moved them while applying.

Please check the result later today, after I have pushed.

Looks OK to me. Incrementing the array sizes in the driver is kinda icky though.

Signature · 2 lines
Best regards,
Marek Vasut
#9 lore raw

Re: [PATCH 4/4] pinctrl: sh-pfc: r8a77990: Add CAN FD pins, groups and functions

Hi Marek,

Quoted 15 lines · Marek Vasut
Quoted 14 lines · Geert Uytterhoeven
Quoted 11 lines · Geert Uytterhoeven
Quoted 7 lines · Marek Vasut

From: Takeshi Kihara <[email protected]>

This patch adds CAN FD{0,1} pins, groups and functions to the R8A77990 SoC.

i.e. will queue in sh-pfc-for-v4.21.

Quoted 8 lines
Quoted 6 lines

Upon second look, the canfd groups and functions should be moved from the common to the automotive section, as RZ/G2E does not have them. As I have to update the array sizes anyway (my branch already has more patches applied), I moved them while applying.

Please check the result later today, after I have pushed.

Looks OK to me. Incrementing the array sizes in the driver is kinda icky

Thanks!

Quoted 1 line

though.

Unfortunately I see no way to avoid that, as both arrays need to be consecutive in memory. Do you see a better solution?

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
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
#10 lore raw

Re: [PATCH 4/4] pinctrl: sh-pfc: r8a77990: Add CAN FD pins, groups and functions

Quoted 1 line · Geert Uytterhoeven

Hi Marek,

Hi,

Quoted 23 lines · Marek Vasut
Quoted 22 lines · Geert Uytterhoeven
Quoted 20 lines
Quoted 11 lines · Geert Uytterhoeven
Quoted 7 lines · Marek Vasut

From: Takeshi Kihara <[email protected]>

This patch adds CAN FD{0,1} pins, groups and functions to the R8A77990 SoC.

i.e. will queue in sh-pfc-for-v4.21.

Upon second look, the canfd groups and functions should be moved from the common to the automotive section, as RZ/G2E does not have them. As I have to update the array sizes anyway (my branch already has more patches applied), I moved them while applying.

Please check the result later today, after I have pushed.

Quoted 8 lines
Quoted 1 line

Looks OK to me. Incrementing the array sizes in the driver is kinda icky

Thanks!

Quoted 1 line

though.

Unfortunately I see no way to avoid that, as both arrays need to be consecutive in memory. Do you see a better solution?

U-Boot uses linker-generated lists , but I think this might be an overkill here.

Signature · 2 lines
Best regards,
Marek Vasut
Reviewed-by on v1 1/4
#11 lore raw
In reply to Marek Vasut
Quoted 6 lines · Marek Vasut

From: Takeshi Kihara <[email protected]>

This patch adds CAN{0,1} pins, groups and functions to the R8A77965 SoC.

i.e. will queue in sh-pfc-for-v4.21.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
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