[PATCH RFC 8/8] pinctrl: renesas: r8a7795: Optimize pinctrl image size for R8A7795

Biju Das biju.das.jz at bp.renesas.com
Wed Oct 28 11:34:28 CET 2020


Optimize pinctrl image size by disabling pins which are not used
by u-boot(ie, not enabled in board dts file).

Signed-off-by: Biju Das <biju.das.jz at bp.renesas.com>
---
 drivers/pinctrl/renesas/pfc-r8a7795.c | 52 +++++++++++++++++++--------
 1 file changed, 38 insertions(+), 14 deletions(-)

diff --git a/drivers/pinctrl/renesas/pfc-r8a7795.c b/drivers/pinctrl/renesas/pfc-r8a7795.c
index 898f837950..eb178494a9 100644
--- a/drivers/pinctrl/renesas/pfc-r8a7795.c
+++ b/drivers/pinctrl/renesas/pfc-r8a7795.c
@@ -1836,7 +1836,7 @@ static const unsigned int canfd1_data_mux[] = {
 	CANFD1_TX_MARK,         CANFD1_RX_MARK,
 };
 
-#ifdef CONFIG_PINCTRL_PFC_R8A7795
+#if defined(CONFIG_PINCTRL_PFC_R8A7795) && defined(CONFIG_PINCTRL_PFC_EXTRAS)
 /* - DRIF0 --------------------------------------------------------------- */
 static const unsigned int drif0_ctrl_a_pins[] = {
 	/* CLK, SYNC */
@@ -2051,7 +2051,7 @@ static const unsigned int drif3_data1_b_pins[] = {
 static const unsigned int drif3_data1_b_mux[] = {
 	RIF3_D1_B_MARK,
 };
-#endif /* CONFIG_PINCTRL_PFC_R8A7795 */
+#endif /* CONFIG_PINCTRL_PFC_R8A7795 && CONFIG_PINCTRL_PFC_EXTRAS */
 
 /* - DU --------------------------------------------------------------------- */
 static const unsigned int du_rgb666_pins[] = {
@@ -2464,6 +2464,7 @@ static const unsigned int intc_ex_irq5_mux[] = {
 	IRQ5_MARK,
 };
 
+#if defined(CONFIG_PINCTRL_PFC_EXTRAS)
 /* - MSIOF0 ----------------------------------------------------------------- */
 static const unsigned int msiof0_clk_pins[] = {
 	/* SCK */
@@ -3161,6 +3162,7 @@ static const unsigned int msiof3_rxd_e_pins[] = {
 static const unsigned int msiof3_rxd_e_mux[] = {
 	MSIOF3_RXD_E_MARK,
 };
+#endif /* CONFIG_PINCTRL_PFC_EXTRAS */
 
 /* - PWM0 --------------------------------------------------------------------*/
 static const unsigned int pwm0_pins[] = {
@@ -4169,10 +4171,14 @@ static const unsigned int vin5_clk_mux[] = {
 };
 
 static const struct {
+#if defined(CONFIG_PINCTRL_PFC_EXTRAS)
 	struct sh_pfc_pin_group common[320];
-#ifdef CONFIG_PINCTRL_PFC_R8A7795
+#if defined(CONFIG_PINCTRL_PFC_R8A7795)
 	struct sh_pfc_pin_group automotive[30];
-#endif
+#endif /* CONFIG_PINCTRL_PFC_R8A7795 */
+#else  /* CONFIG_PINCTRL_PFC_EXTRAS */
+	struct sh_pfc_pin_group common[221];
+#endif /* CONFIG_PINCTRL_PFC_EXTRAS */
 } pinmux_groups = {
 	.common = {
 		SH_PFC_PIN_GROUP(audio_clk_a_a),
@@ -4262,6 +4268,7 @@ static const struct {
 		SH_PFC_PIN_GROUP(intc_ex_irq3),
 		SH_PFC_PIN_GROUP(intc_ex_irq4),
 		SH_PFC_PIN_GROUP(intc_ex_irq5),
+#if defined(CONFIG_PINCTRL_PFC_EXTRAS)
 		SH_PFC_PIN_GROUP(msiof0_clk),
 		SH_PFC_PIN_GROUP(msiof0_sync),
 		SH_PFC_PIN_GROUP(msiof0_ss1),
@@ -4361,6 +4368,7 @@ static const struct {
 		SH_PFC_PIN_GROUP(msiof3_ss2_e),
 		SH_PFC_PIN_GROUP(msiof3_txd_e),
 		SH_PFC_PIN_GROUP(msiof3_rxd_e),
+#endif /* CONFIG_PINCTRL_PFC_EXTRAS */
 		SH_PFC_PIN_GROUP(pwm0),
 		SH_PFC_PIN_GROUP(pwm1_a),
 		SH_PFC_PIN_GROUP(pwm1_b),
@@ -4496,7 +4504,7 @@ static const struct {
 		SH_PFC_PIN_GROUP(vin5_clkenb),
 		SH_PFC_PIN_GROUP(vin5_clk),
 	},
-#ifdef CONFIG_PINCTRL_PFC_R8A7795
+#if defined(CONFIG_PINCTRL_PFC_R8A7795) && defined(CONFIG_PINCTRL_PFC_EXTRAS)
 	.automotive = {
 		SH_PFC_PIN_GROUP(drif0_ctrl_a),
 		SH_PFC_PIN_GROUP(drif0_data0_a),
@@ -4529,7 +4537,7 @@ static const struct {
 		SH_PFC_PIN_GROUP(drif3_data0_b),
 		SH_PFC_PIN_GROUP(drif3_data1_b),
 	}
-#endif /* CONFIG_PINCTRL_PFC_R8A7795 */
+#endif /* CONFIG_PINCTRL_PFC_R8A7795 && CONFIG_PINCTRL_PFC_EXTRAS */
 };
 
 static const char * const audio_clk_groups[] = {
@@ -4588,7 +4596,7 @@ static const char * const canfd1_groups[] = {
 	"canfd1_data",
 };
 
-#ifdef CONFIG_PINCTRL_PFC_R8A7795
+#if defined(CONFIG_PINCTRL_PFC_R8A7795) && defined(CONFIG_PINCTRL_PFC_EXTRAS)
 static const char * const drif0_groups[] = {
 	"drif0_ctrl_a",
 	"drif0_data0_a",
@@ -4630,7 +4638,7 @@ static const char * const drif3_groups[] = {
 	"drif3_data0_b",
 	"drif3_data1_b",
 };
-#endif /* CONFIG_PINCTRL_PFC_R8A7795 */
+#endif /* CONFIG_PINCTRL_PFC_R8A7795 && CONFIG_PINCTRL_PFC_EXTRAS */
 
 static const char * const du_groups[] = {
 	"du_rgb666",
@@ -4723,6 +4731,7 @@ static const char * const intc_ex_groups[] = {
 	"intc_ex_irq5",
 };
 
+#if defined(CONFIG_PINCTRL_PFC_EXTRAS)
 static const char * const msiof0_groups[] = {
 	"msiof0_clk",
 	"msiof0_sync",
@@ -4833,6 +4842,7 @@ static const char * const msiof3_groups[] = {
 	"msiof3_txd_e",
 	"msiof3_rxd_e",
 };
+#endif /* CONFIG_PINCTRL_PFC_EXTRAS */
 
 static const char * const pwm0_groups[] = {
 	"pwm0",
@@ -5056,10 +5066,14 @@ static const char * const vin5_groups[] = {
 };
 
 static const struct {
+#if defined(CONFIG_PINCTRL_PFC_EXTRAS)
 	struct sh_pfc_function common[53];
-#ifdef CONFIG_PINCTRL_PFC_R8A7795
+#if defined(CONFIG_PINCTRL_PFC_R8A7795)
 	struct sh_pfc_function automotive[4];
-#endif
+#endif  /* CONFIG_PINCTRL_PFC_R8A7795 */
+#else /* CONFIG_PINCTRL_PFC_EXTRAS */
+	struct sh_pfc_function common[49];
+#endif /* CONFIG_PINCTRL_PFC_EXTRAS */
 } pinmux_functions = {
 	.common = {
 		SH_PFC_FUNCTION(audio_clk),
@@ -5082,10 +5096,12 @@ static const struct {
 		SH_PFC_FUNCTION(i2c5),
 		SH_PFC_FUNCTION(i2c6),
 		SH_PFC_FUNCTION(intc_ex),
+#if defined(CONFIG_PINCTRL_PFC_EXTRAS)
 		SH_PFC_FUNCTION(msiof0),
 		SH_PFC_FUNCTION(msiof1),
 		SH_PFC_FUNCTION(msiof2),
 		SH_PFC_FUNCTION(msiof3),
+#endif /* CONFIG_PINCTRL_PFC_EXTRAS */
 		SH_PFC_FUNCTION(pwm0),
 		SH_PFC_FUNCTION(pwm1),
 		SH_PFC_FUNCTION(pwm2),
@@ -5116,14 +5132,14 @@ static const struct {
 		SH_PFC_FUNCTION(vin4),
 		SH_PFC_FUNCTION(vin5),
 	},
-#ifdef CONFIG_PINCTRL_PFC_R8A7795
+#if defined(CONFIG_PINCTRL_PFC_R8A7795) && defined(CONFIG_PINCTRL_PFC_EXTRAS)
 	.automotive = {
 		SH_PFC_FUNCTION(drif0),
 		SH_PFC_FUNCTION(drif1),
 		SH_PFC_FUNCTION(drif2),
 		SH_PFC_FUNCTION(drif3),
 	}
-#endif /* CONFIG_PINCTRL_PFC_R8A7795 */
+#endif /* CONFIG_PINCTRL_PFC_R8A7795 && CONFIG_PINCTRL_PFC_EXTRAS */
 };
 
 static const struct pinmux_cfg_reg pinmux_config_regs[] = {
@@ -6290,11 +6306,19 @@ const struct sh_pfc_soc_info r8a7795_pinmux_info = {
 	.pins = pinmux_pins,
 	.nr_pins = ARRAY_SIZE(pinmux_pins),
 	.groups = pinmux_groups.common,
+#if defined(CONFIG_PINCTRL_PFC_EXTRAS)
 	.nr_groups = ARRAY_SIZE(pinmux_groups.common) +
-			ARRAY_SIZE(pinmux_groups.automotive),
+		ARRAY_SIZE(pinmux_groups.automotive),
+#else
+	.nr_groups = ARRAY_SIZE(pinmux_groups.common),
+#endif
 	.functions = pinmux_functions.common,
+#if defined(CONFIG_PINCTRL_PFC_EXTRAS)
 	.nr_functions = ARRAY_SIZE(pinmux_functions.common) +
-			ARRAY_SIZE(pinmux_functions.automotive),
+		ARRAY_SIZE(pinmux_functions.automotive),
+#else
+	.nr_functions = ARRAY_SIZE(pinmux_functions.common),
+#endif
 
 	.cfg_regs = pinmux_config_regs,
 	.drive_regs = pinmux_drive_regs,
-- 
2.17.1



More information about the U-Boot mailing list