From 352223cdc65681499b87d78999d1d80126dcd7a3 Mon Sep 17 00:00:00 2001 From: Raquel Medina Date: Mon, 16 Nov 2020 04:05:13 +0100 Subject: [PATCH] Update agl refhw patches for kernel 5.4 Rework agl refhw patches to apply to agl master branch (linux-renesas v5.4/rcar-4.0.0). Bug-AGL: SPEC-3658 Signed-off-by: Raquel Medina Change-Id: I0d69179c9acb9a28c9381c42927bda70a7589d61 --- .../linux/files/0001-add-agl-refhw.patch | 129 +++++++-------------- ...0001-create-r8a7795-usb-ovc-pinmux-groups.patch | 67 +++++------ 2 files changed, 74 insertions(+), 122 deletions(-) diff --git a/meta-agl-refhw-gen3/recipes-kernel/linux/files/0001-add-agl-refhw.patch b/meta-agl-refhw-gen3/recipes-kernel/linux/files/0001-add-agl-refhw.patch index d6bf869..12df0d8 100644 --- a/meta-agl-refhw-gen3/recipes-kernel/linux/files/0001-add-agl-refhw.patch +++ b/meta-agl-refhw-gen3/recipes-kernel/linux/files/0001-add-agl-refhw.patch @@ -3,6 +3,7 @@ Add AGL reference hardware support Upstream-Status: pending Signed-off-by: Scott Murray +Signed-off-by: Raquel Medina --- arch/arm64/boot/dts/renesas/agl-refhw-common.dtsi | 912 ++++++++++++++++++++++ @@ -16,7 +17,7 @@ new file mode 100644 index 000000000000..a35cd24b27b9 --- /dev/null +++ b/arch/arm64/boot/dts/renesas/agl-refhw-common.dtsi -@@ -0,0 +1,912 @@ +@@ -0,0 +1,918 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Device Tree Source for common parts of AGL Reference Hardware board variants @@ -362,7 +363,10 @@ index 000000000000..a35cd24b27b9 + + video-receiver@70 { + compatible = "adi,adv7481"; -+ reg = <0x70>; ++ reg = <0x70 0x26 0x22 0x34 0x36 0x32 ++ 0x31 0x30 0x41 0x79 0x4a 0x48>; ++ reg-names = "main", "dpll", "cp", "hdmi", "edid", "repeater", ++ "infoframe", "cbus", "cec", "sdp", "txa", "txb" ; + + #address-cells = <1>; + #size-cells = <0>; @@ -394,7 +398,10 @@ index 000000000000..a35cd24b27b9 + + video-receiver@71 { + compatible = "adi,adv7481"; -+ reg = <0x71>; ++ reg = <0x71 0x27 0x23 0x35 0x37 0x33 ++ 0x28 0x29 0x42 0x78 0x4b 0x49>; ++ reg-names = "main", "dpll", "cp", "hdmi", "edid", "repeater", ++ "infoframe", "cbus", "cec", "sdp", "txa", "txb" ; + + #address-cells = <1>; + #size-cells = <0>; @@ -1317,102 +1324,46 @@ diff --git a/drivers/media/i2c/adv748x/adv748x-core.c b/drivers/media/i2c/adv748 index da8f0621a10b..c2b37f70f711 100644 --- a/drivers/media/i2c/adv748x/adv748x-core.c +++ b/drivers/media/i2c/adv748x/adv748x-core.c -@@ -165,6 +165,21 @@ static int adv748x_i2c_addresses[ADV748X_PAGE_MAX] = { - ADV748X_I2C_TXA, +@@ -97,6 +97,21 @@ static const struct adv748x_register_map + [ADV748X_PAGE_TXA] = { "txa", 0x4a }, }; -+/* Default addresses for the I2C pages 0x71*/ -+static int adv748x_i2c_addresses2[ADV748X_PAGE_MAX] = { -+ ADV748X_I2C_IO2, -+ ADV748X_I2C_DPLL2, -+ ADV748X_I2C_CP2, -+ ADV748X_I2C_HDMI2, -+ ADV748X_I2C_EDID2, -+ ADV748X_I2C_REPEATER2, -+ ADV748X_I2C_INFOFRAME2, -+ ADV748X_I2C_CEC2, -+ ADV748X_I2C_SDP2, -+ ADV748X_I2C_TXB2, -+ ADV748X_I2C_TXA2, ++static const struct adv748x_register_map adv748x_default_addresses2[] = { ++ [ADV748X_PAGE_IO] = { "main", 0x71 }, ++ [ADV748X_PAGE_DPLL] = { "dpll", 0x27 }, ++ [ADV748X_PAGE_CP] = { "cp", 0x23 }, ++ [ADV748X_PAGE_HDMI] = { "hdmi", 0x35 }, ++ [ADV748X_PAGE_EDID] = { "edid", 0x37 }, ++ [ADV748X_PAGE_REPEATER] = { "repeater", 0x33 }, ++ [ADV748X_PAGE_INFOFRAME] = { "infoframe", 0x28 }, ++ [ADV748X_PAGE_CBUS] = { "cbus", 0x29 }, ++ [ADV748X_PAGE_CEC] = { "cec", 0x42 }, ++ [ADV748X_PAGE_SDP] = { "sdp", 0x78 }, ++ [ADV748X_PAGE_TXB] = { "txb", 0x49 }, ++ [ADV748X_PAGE_TXA] = { "txa", 0x4b }, +}; + static int adv748x_read_check(struct adv748x_state *state, int client_page, u8 reg) { -@@ -238,9 +253,16 @@ static int adv748x_initialise_clients(struct adv748x_state *state) +@@ -183,10 +198,17 @@ static int adv748x_initialise_clients(st int ret; for (i = ADV748X_PAGE_DPLL; i < ADV748X_PAGE_MAX; ++i) { -- state->i2c_clients[i] = -- adv748x_dummy_client(state, adv748x_i2c_addresses[i], -- ADV748X_IO_SLAVE_ADDR_BASE + i); -+ if((state->client->addr << 1) == 0xe0) { -+ state->i2c_clients[i] = -+ adv748x_dummy_client(state, adv748x_i2c_addresses[i], -+ ADV748X_IO_SLAVE_ADDR_BASE + i); +- state->i2c_clients[i] = i2c_new_ancillary_device( ++ if ((state->client->addr << 1) == 0xe0) { ++ state->i2c_clients[i] = i2c_new_ancillary_device( + state->client, + adv748x_default_addresses[i].name, + adv748x_default_addresses[i].default_addr); + } else { -+ state->i2c_clients[i] = -+ adv748x_dummy_client(state, adv748x_i2c_addresses2[i], -+ ADV748X_IO_SLAVE_ADDR_BASE + i); ++ state->i2c_clients[i] = i2c_new_ancillary_device( ++ state->client, ++ adv748x_default_addresses2[i].name, ++ adv748x_default_addresses2[i].default_addr); + } -+ - if (state->i2c_clients[i] == NULL) { - adv_err(state, "failed to create i2c client %u\n", i); - return -ENOMEM; -@@ -508,6 +530,20 @@ static const struct adv748x_reg_value adv748x_set_slave_address[] = { - {ADV748X_PAGE_EOR, 0xff, 0xff} /* End of register table */ - }; - -+static const struct adv748x_reg_value adv748x_set_slave_address2[] = { -+ {ADV748X_PAGE_IO, 0xf3, ADV748X_I2C_DPLL2 << 1}, -+ {ADV748X_PAGE_IO, 0xf4, ADV748X_I2C_CP2 << 1}, -+ {ADV748X_PAGE_IO, 0xf5, ADV748X_I2C_HDMI2 << 1}, -+ {ADV748X_PAGE_IO, 0xf6, ADV748X_I2C_EDID2 << 1}, -+ {ADV748X_PAGE_IO, 0xf7, ADV748X_I2C_REPEATER2 << 1}, -+ {ADV748X_PAGE_IO, 0xf8, ADV748X_I2C_INFOFRAME2 << 1}, -+ {ADV748X_PAGE_IO, 0xfa, ADV748X_I2C_CEC2 << 1}, -+ {ADV748X_PAGE_IO, 0xfb, ADV748X_I2C_SDP2 << 1}, -+ {ADV748X_PAGE_IO, 0xfc, ADV748X_I2C_TXB2 << 1}, -+ {ADV748X_PAGE_IO, 0xfd, ADV748X_I2C_TXA2 << 1}, -+ {ADV748X_PAGE_EOR, 0xff, 0xff} /* End of register table */ -+}; -+ - /* Supported Formats For Script Below */ - /* - 01-29 HDMI to MIPI TxA CSI 4-Lane - RGB888: */ - static const struct adv748x_reg_value adv748x_init_txa_4lane[] = { -@@ -683,7 +719,11 @@ static int adv748x_reset(struct adv748x_state *state) - if (ret < 0) - return ret; - -- ret = adv748x_write_regs(state, adv748x_set_slave_address); -+ if((state->client->addr << 1) == 0xe0) { -+ ret = adv748x_write_regs(state, adv748x_set_slave_address); //i2c address 0x70 -+ } else { -+ ret = adv748x_write_regs(state, adv748x_set_slave_address2); //i2c address 0x71 -+ } - if (ret < 0) - return ret; -diff --git a/drivers/media/i2c/adv748x/adv748x.h b/drivers/media/i2c/adv748x/adv748x.h -index fb30bfade946..ac50a9e41b08 100644 ---- a/drivers/media/i2c/adv748x/adv748x.h -+++ b/drivers/media/i2c/adv748x/adv748x.h -@@ -40,6 +40,18 @@ - #define ADV748X_I2C_TXB 0x48 /* CSI-TXB Map */ - #define ADV748X_I2C_TXA 0x4a /* CSI-TXA Map */ - -+#define ADV748X_I2C_IO2 0x71 /* IO Map */ -+#define ADV748X_I2C_DPLL2 0x27 /* DPLL Map */ -+#define ADV748X_I2C_CP2 0x23 /* CP Map */ -+#define ADV748X_I2C_HDMI2 0x35 /* HDMI Map */ -+#define ADV748X_I2C_EDID2 0x37 /* EDID Map */ -+#define ADV748X_I2C_REPEATER2 0x33 /* HDMI RX Repeater Map */ -+#define ADV748X_I2C_INFOFRAME2 0x30 /* HDMI RX InfoFrame Map */ -+#define ADV748X_I2C_CEC2 0x42 /* CEC Map */ -+#define ADV748X_I2C_SDP2 0x78 /* SDP Map */ -+#define ADV748X_I2C_TXB2 0x49 /* CSI-TXB Map */ -+#define ADV748X_I2C_TXA2 0x4b /* CSI-TXA Map */ -+ - enum adv748x_page { - ADV748X_PAGE_IO, - ADV748X_PAGE_DPLL, + if (IS_ERR(state->i2c_clients[i])) { + adv_err(state, "failed to create i2c client %u\n", i); + + diff --git a/meta-agl-refhw-gen3/recipes-kernel/linux/files/0001-create-r8a7795-usb-ovc-pinmux-groups.patch b/meta-agl-refhw-gen3/recipes-kernel/linux/files/0001-create-r8a7795-usb-ovc-pinmux-groups.patch index da49e7f..8e0c4ac 100644 --- a/meta-agl-refhw-gen3/recipes-kernel/linux/files/0001-create-r8a7795-usb-ovc-pinmux-groups.patch +++ b/meta-agl-refhw-gen3/recipes-kernel/linux/files/0001-create-r8a7795-usb-ovc-pinmux-groups.patch @@ -7,6 +7,7 @@ which use some of the OVC pins in other pinmux modes. Upstream-Status: pending Signed-off-by: Scott Murray +Signed-off-by: Raquel Medina 8 files changed, 129 insertions(+), 39 deletions(-) diff --git a/arch/arm64/boot/dts/renesas/r8a7795-es1-salvator-x.dts b/arch/arm64/boot/dts/renesas/r8a7795-es1-salvator-x.dts -index 5c3935ef4fb9..07d3f03274e3 100644 +index 63d7cd7c5c47..4a3e0deaa929 100644 --- a/arch/arm64/boot/dts/renesas/r8a7795-es1-salvator-x.dts +++ b/arch/arm64/boot/dts/renesas/r8a7795-es1-salvator-x.dts -@@ -202,7 +202,7 @@ +@@ -166,7 +166,7 @@ &pfc { usb2_pins: usb2 { @@ -33,10 +34,10 @@ index 5c3935ef4fb9..07d3f03274e3 100644 }; }; diff --git a/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts b/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts -index 6928afbd8e06..9c229b1bbb59 100644 +index 4f743db4b9ae..6a1f58ed40d1 100644 --- a/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts +++ b/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts -@@ -202,7 +202,7 @@ +@@ -166,7 +166,7 @@ &pfc { usb2_pins: usb2 { @@ -46,10 +47,10 @@ index 6928afbd8e06..9c229b1bbb59 100644 }; }; diff --git a/arch/arm64/boot/dts/renesas/r8a7795-salvator-xs.dts b/arch/arm64/boot/dts/renesas/r8a7795-salvator-xs.dts -index 498f78875dbd..abd1d480292e 100644 +index 9bf8bee35113..9e8dbeecd755 100644 --- a/arch/arm64/boot/dts/renesas/r8a7795-salvator-xs.dts +++ b/arch/arm64/boot/dts/renesas/r8a7795-salvator-xs.dts -@@ -217,7 +217,7 @@ +@@ -190,7 +190,7 @@ &pfc { usb2_pins: usb2 { @@ -58,7 +59,7 @@ index 498f78875dbd..abd1d480292e 100644 function = "usb2"; }; -@@ -234,7 +234,7 @@ +@@ -207,7 +207,7 @@ * - Connect GP6_{04,21} to ADV7842. */ usb2_ch3_pins: usb2_ch3 { @@ -68,10 +69,10 @@ index 498f78875dbd..abd1d480292e 100644 }; }; diff --git a/arch/arm64/boot/dts/renesas/salvator-common.dtsi b/arch/arm64/boot/dts/renesas/salvator-common.dtsi -index 878ed7caca77..a9e2d0a02fe1 100644 +index 08b1259c4a1c..26a8cfbcf4c3 100644 --- a/arch/arm64/boot/dts/renesas/salvator-common.dtsi +++ b/arch/arm64/boot/dts/renesas/salvator-common.dtsi -@@ -690,13 +690,13 @@ +@@ -751,13 +751,13 @@ }; usb0_pins: usb0 { @@ -87,7 +88,7 @@ index 878ed7caca77..a9e2d0a02fe1 100644 function = "usb1"; }; -@@ -712,7 +712,7 @@ +@@ -773,7 +773,7 @@ }; usb30_pins: usb30 { @@ -97,10 +98,10 @@ index 878ed7caca77..a9e2d0a02fe1 100644 }; }; diff --git a/arch/arm64/boot/dts/renesas/ulcb-kf.dtsi b/arch/arm64/boot/dts/renesas/ulcb-kf.dtsi -index 1b316d79df88..9d44b5ef4f63 100644 +index 202177706cde..6a09243d2b49 100644 --- a/arch/arm64/boot/dts/renesas/ulcb-kf.dtsi +++ b/arch/arm64/boot/dts/renesas/ulcb-kf.dtsi -@@ -170,7 +170,7 @@ +@@ -285,7 +285,7 @@ }; usb0_pins: usb0 { @@ -110,10 +111,10 @@ index 1b316d79df88..9d44b5ef4f63 100644 }; }; diff --git a/arch/arm64/boot/dts/renesas/ulcb.dtsi b/arch/arm64/boot/dts/renesas/ulcb.dtsi -index b60fd45f0a17..6f054ab8e611 100644 +index 9fda41e8317c..469665305630 100644 --- a/arch/arm64/boot/dts/renesas/ulcb.dtsi +++ b/arch/arm64/boot/dts/renesas/ulcb.dtsi -@@ -366,7 +366,7 @@ +@@ -375,7 +375,7 @@ }; usb1_pins: usb1 { @@ -123,10 +124,10 @@ index b60fd45f0a17..6f054ab8e611 100644 }; }; diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7795-es1.c b/drivers/pinctrl/sh-pfc/pfc-r8a7795-es1.c -index 9f302f60297f..55f99fe4d8ac 100644 +index 48fd5415f811..153039dfc83e 100644 --- a/drivers/pinctrl/sh-pfc/pfc-r8a7795-es1.c +++ b/drivers/pinctrl/sh-pfc/pfc-r8a7795-es1.c -@@ -3822,44 +3822,79 @@ static const unsigned int tmu_tclk2_b_mux[] = { +@@ -3834,44 +3834,79 @@ static const unsigned int tmu_tclk2_b_mux[] = { /* - USB0 ------------------------------------------------------------------- */ static const unsigned int usb0_pins[] = { @@ -219,11 +220,11 @@ index 9f302f60297f..55f99fe4d8ac 100644 +static const unsigned int usb31_ovc_mux[] = { + USB31_OVC_MARK, }; - - /* - VIN4 ------------------------------------------------------------------- */ -@@ -4486,10 +4521,15 @@ static const struct sh_pfc_pin_group pinmux_groups[] = { - SH_PFC_PIN_GROUP(tmu_tclk2_a), - SH_PFC_PIN_GROUP(tmu_tclk2_b), + + static const unsigned int vin4_data18_a_mux[] = { +@@ -4430,10 +4465,15 @@ static const struct sh_pfc_pin_group pinmux_groups[] = { + SH_PFC_PIN_GROUP(tpu_to2), + SH_PFC_PIN_GROUP(tpu_to3), SH_PFC_PIN_GROUP(usb0), + SH_PFC_PIN_GROUP(usb0_ovc), SH_PFC_PIN_GROUP(usb1), @@ -234,10 +235,10 @@ index 9f302f60297f..55f99fe4d8ac 100644 + SH_PFC_PIN_GROUP(usb30_ovc), SH_PFC_PIN_GROUP(usb31), + SH_PFC_PIN_GROUP(usb31_ovc), - SH_PFC_PIN_GROUP(vin4_data8_a), - SH_PFC_PIN_GROUP(vin4_data16_a), + VIN_DATA_PIN_GROUP(vin4_data, 8, _a), + VIN_DATA_PIN_GROUP(vin4_data. 16, _a), SH_PFC_PIN_GROUP(vin4_data18_a), -@@ -4977,22 +5017,27 @@ static const char * const tmu_groups[] = { +@@ -4928,22 +4967,27 @@ static const char * const tpu_groups[] = { static const char * const usb0_groups[] = { "usb0", @@ -266,10 +267,10 @@ index 9f302f60297f..55f99fe4d8ac 100644 static const char * const vin4_groups[] = { diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7795.c b/drivers/pinctrl/sh-pfc/pfc-r8a7795.c -index 3ebe8deb24d6..745f93884fe1 100644 +index 2988c1d43c32..5292ea7c15de 100644 --- a/drivers/pinctrl/sh-pfc/pfc-r8a7795.c +++ b/drivers/pinctrl/sh-pfc/pfc-r8a7795.c -@@ -3911,44 +3911,79 @@ static const unsigned int tmu_tclk2_b_mux[] = { +@@ -3925,44 +3925,79 @@ static const unsigned int tmu_tclk2_b_mux[] = { /* - USB0 ------------------------------------------------------------------- */ static const unsigned int usb0_pins[] = { @@ -364,9 +365,9 @@ index 3ebe8deb24d6..745f93884fe1 100644 }; /* - VIN4 ------------------------------------------------------------------- */ -@@ -4528,10 +4563,15 @@ static const struct sh_pfc_pin_group pinmux_groups[] = { - SH_PFC_PIN_GROUP(tmu_tclk2_a), - SH_PFC_PIN_GROUP(tmu_tclk2_b), +@@ -4507,10 +4542,15 @@ static const struct sh_pfc_pin_group pinmux_groups[] = { + SH_PFC_PIN_GROUP(tpu_to2), + SH_PFC_PIN_GROUP(tpu_to3), SH_PFC_PIN_GROUP(usb0), + SH_PFC_PIN_GROUP(usb0_ovc), SH_PFC_PIN_GROUP(usb1), @@ -377,10 +378,10 @@ index 3ebe8deb24d6..745f93884fe1 100644 + SH_PFC_PIN_GROUP(usb2_ch3_ovc), SH_PFC_PIN_GROUP(usb30), + SH_PFC_PIN_GROUP(usb30_ovc), - VIN_DATA_PIN_GROUP(vin4_data_a, 8), - VIN_DATA_PIN_GROUP(vin4_data_a, 10), - VIN_DATA_PIN_GROUP(vin4_data_a, 12), -@@ -5026,22 +5066,27 @@ static const char * const tmu_groups[] = { + VIN_DATA_PIN_GROUP(vin4_data, 8, _a), + VIN_DATA_PIN_GROUP(vin4_data, 10, _a), + VIN_DATA_PIN_GROUP(vin4_data, 12, _a), +@@ -5012,22 +5052,27 @@ static const char * const tmu_groups[] = { static const char * const usb0_groups[] = { "usb0", -- 2.16.6