Commit 50f3f2d7 authored by Geert Uytterhoeven's avatar Geert Uytterhoeven

pinctrl: sh-pfc: Reduce kernel size for narrow VIN channels

Some VIN channels support less than 24 lanes.  As union vin_data always
consumes space for 24 lanes, this wastes memory.

Hence introduce new smaller unions vin_data12 and vin_data16, to
accommodate VIN channels with only 12 or 16 lanes.

This reduces the static pin controller driver size by 320 bytes for
R-Car V2H, and by 96 bytes for R-Car E2.
Signed-off-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: default avatarSimon Horman <horms+renesas@verge.net.au>
Reviewed-by: default avatarNiklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
parent 9f8dc8e2
...@@ -1474,7 +1474,7 @@ static const unsigned int vin1_clk_mux[] = { ...@@ -1474,7 +1474,7 @@ static const unsigned int vin1_clk_mux[] = {
VI1_CLK_MARK, VI1_CLK_MARK,
}; };
/* - VIN2 ------------------------------------------------------------------- */ /* - VIN2 ------------------------------------------------------------------- */
static const union vin_data vin2_data_pins = { static const union vin_data16 vin2_data_pins = {
.data16 = { .data16 = {
RCAR_GP_PIN(6, 4), RCAR_GP_PIN(6, 5), RCAR_GP_PIN(6, 4), RCAR_GP_PIN(6, 5),
RCAR_GP_PIN(6, 6), RCAR_GP_PIN(6, 7), RCAR_GP_PIN(6, 6), RCAR_GP_PIN(6, 7),
...@@ -1486,7 +1486,7 @@ static const union vin_data vin2_data_pins = { ...@@ -1486,7 +1486,7 @@ static const union vin_data vin2_data_pins = {
RCAR_GP_PIN(8, 11), RCAR_GP_PIN(8, 12), RCAR_GP_PIN(8, 11), RCAR_GP_PIN(8, 12),
}, },
}; };
static const union vin_data vin2_data_mux = { static const union vin_data16 vin2_data_mux = {
.data16 = { .data16 = {
VI2_D0_C0_MARK, VI2_D1_C1_MARK, VI2_D0_C0_MARK, VI2_D1_C1_MARK,
VI2_D2_C2_MARK, VI2_D3_C3_MARK, VI2_D2_C2_MARK, VI2_D3_C3_MARK,
...@@ -1524,7 +1524,7 @@ static const unsigned int vin2_clk_mux[] = { ...@@ -1524,7 +1524,7 @@ static const unsigned int vin2_clk_mux[] = {
VI2_CLK_MARK, VI2_CLK_MARK,
}; };
/* - VIN3 ------------------------------------------------------------------- */ /* - VIN3 ------------------------------------------------------------------- */
static const union vin_data vin3_data_pins = { static const union vin_data16 vin3_data_pins = {
.data16 = { .data16 = {
RCAR_GP_PIN(7, 4), RCAR_GP_PIN(7, 5), RCAR_GP_PIN(7, 4), RCAR_GP_PIN(7, 5),
RCAR_GP_PIN(7, 6), RCAR_GP_PIN(7, 7), RCAR_GP_PIN(7, 6), RCAR_GP_PIN(7, 7),
...@@ -1536,7 +1536,7 @@ static const union vin_data vin3_data_pins = { ...@@ -1536,7 +1536,7 @@ static const union vin_data vin3_data_pins = {
RCAR_GP_PIN(8, 15), RCAR_GP_PIN(8, 16), RCAR_GP_PIN(8, 15), RCAR_GP_PIN(8, 16),
}, },
}; };
static const union vin_data vin3_data_mux = { static const union vin_data16 vin3_data_mux = {
.data16 = { .data16 = {
VI3_D0_C0_MARK, VI3_D1_C1_MARK, VI3_D0_C0_MARK, VI3_D1_C1_MARK,
VI3_D2_C2_MARK, VI3_D3_C3_MARK, VI3_D2_C2_MARK, VI3_D3_C3_MARK,
...@@ -1574,7 +1574,7 @@ static const unsigned int vin3_clk_mux[] = { ...@@ -1574,7 +1574,7 @@ static const unsigned int vin3_clk_mux[] = {
VI3_CLK_MARK, VI3_CLK_MARK,
}; };
/* - VIN4 ------------------------------------------------------------------- */ /* - VIN4 ------------------------------------------------------------------- */
static const union vin_data vin4_data_pins = { static const union vin_data12 vin4_data_pins = {
.data12 = { .data12 = {
RCAR_GP_PIN(8, 4), RCAR_GP_PIN(8, 5), RCAR_GP_PIN(8, 4), RCAR_GP_PIN(8, 5),
RCAR_GP_PIN(8, 6), RCAR_GP_PIN(8, 7), RCAR_GP_PIN(8, 6), RCAR_GP_PIN(8, 7),
...@@ -1584,7 +1584,7 @@ static const union vin_data vin4_data_pins = { ...@@ -1584,7 +1584,7 @@ static const union vin_data vin4_data_pins = {
RCAR_GP_PIN(8, 14), RCAR_GP_PIN(8, 15), RCAR_GP_PIN(8, 14), RCAR_GP_PIN(8, 15),
}, },
}; };
static const union vin_data vin4_data_mux = { static const union vin_data12 vin4_data_mux = {
.data12 = { .data12 = {
VI4_D0_C0_MARK, VI4_D1_C1_MARK, VI4_D0_C0_MARK, VI4_D1_C1_MARK,
VI4_D2_C2_MARK, VI4_D3_C3_MARK, VI4_D2_C2_MARK, VI4_D3_C3_MARK,
...@@ -1620,7 +1620,7 @@ static const unsigned int vin4_clk_mux[] = { ...@@ -1620,7 +1620,7 @@ static const unsigned int vin4_clk_mux[] = {
VI4_CLK_MARK, VI4_CLK_MARK,
}; };
/* - VIN5 ------------------------------------------------------------------- */ /* - VIN5 ------------------------------------------------------------------- */
static const union vin_data vin5_data_pins = { static const union vin_data12 vin5_data_pins = {
.data12 = { .data12 = {
RCAR_GP_PIN(9, 4), RCAR_GP_PIN(9, 5), RCAR_GP_PIN(9, 4), RCAR_GP_PIN(9, 5),
RCAR_GP_PIN(9, 6), RCAR_GP_PIN(9, 7), RCAR_GP_PIN(9, 6), RCAR_GP_PIN(9, 7),
...@@ -1630,7 +1630,7 @@ static const union vin_data vin5_data_pins = { ...@@ -1630,7 +1630,7 @@ static const union vin_data vin5_data_pins = {
RCAR_GP_PIN(9, 14), RCAR_GP_PIN(9, 15), RCAR_GP_PIN(9, 14), RCAR_GP_PIN(9, 15),
}, },
}; };
static const union vin_data vin5_data_mux = { static const union vin_data12 vin5_data_mux = {
.data12 = { .data12 = {
VI5_D0_C0_MARK, VI5_D1_C1_MARK, VI5_D0_C0_MARK, VI5_D1_C1_MARK,
VI5_D2_C2_MARK, VI5_D3_C3_MARK, VI5_D2_C2_MARK, VI5_D3_C3_MARK,
......
...@@ -3704,7 +3704,7 @@ static const unsigned int vin0_clk_mux[] = { ...@@ -3704,7 +3704,7 @@ static const unsigned int vin0_clk_mux[] = {
VI0_CLK_MARK, VI0_CLK_MARK,
}; };
/* - VIN1 ------------------------------------------------------------------- */ /* - VIN1 ------------------------------------------------------------------- */
static const union vin_data vin1_data_pins = { static const union vin_data12 vin1_data_pins = {
.data12 = { .data12 = {
RCAR_GP_PIN(5, 12), RCAR_GP_PIN(5, 13), RCAR_GP_PIN(5, 12), RCAR_GP_PIN(5, 13),
RCAR_GP_PIN(5, 14), RCAR_GP_PIN(5, 15), RCAR_GP_PIN(5, 14), RCAR_GP_PIN(5, 15),
...@@ -3714,7 +3714,7 @@ static const union vin_data vin1_data_pins = { ...@@ -3714,7 +3714,7 @@ static const union vin_data vin1_data_pins = {
RCAR_GP_PIN(1, 12), RCAR_GP_PIN(1, 13), RCAR_GP_PIN(1, 12), RCAR_GP_PIN(1, 13),
}, },
}; };
static const union vin_data vin1_data_mux = { static const union vin_data12 vin1_data_mux = {
.data12 = { .data12 = {
VI1_DATA0_MARK, VI1_DATA1_MARK, VI1_DATA0_MARK, VI1_DATA1_MARK,
VI1_DATA2_MARK, VI1_DATA3_MARK, VI1_DATA2_MARK, VI1_DATA3_MARK,
......
...@@ -53,8 +53,8 @@ struct sh_pfc_pin_group { ...@@ -53,8 +53,8 @@ struct sh_pfc_pin_group {
}; };
/* /*
* Using union vin_data saves memory occupied by the VIN data pins. * Using union vin_data{,12,16} saves memory occupied by the VIN data pins.
* VIN_DATA_PIN_GROUP() is a macro used to describe the VIN pin groups * VIN_DATA_PIN_GROUP() is a macro used to describe the VIN pin groups
* in this case. * in this case.
*/ */
#define VIN_DATA_PIN_GROUP(n, s) \ #define VIN_DATA_PIN_GROUP(n, s) \
...@@ -65,6 +65,19 @@ struct sh_pfc_pin_group { ...@@ -65,6 +65,19 @@ struct sh_pfc_pin_group {
.nr_pins = ARRAY_SIZE(n##_pins.data##s), \ .nr_pins = ARRAY_SIZE(n##_pins.data##s), \
} }
union vin_data12 {
unsigned int data12[12];
unsigned int data10[10];
unsigned int data8[8];
};
union vin_data16 {
unsigned int data16[16];
unsigned int data12[12];
unsigned int data10[10];
unsigned int data8[8];
};
union vin_data { union vin_data {
unsigned int data24[24]; unsigned int data24[24];
unsigned int data20[20]; unsigned int data20[20];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment