Date   

Re: [PATCH 4.4.y-cip 00/12] Add CAN/IRQC/THERMAL/VIN/Audio support

Nobuhiro Iwamatsu
 

Hi Biju,

On Fri, Dec 06, 2019 at 12:12:16PM +0000, Biju Das wrote:
This patch series add CAN/IRQC/THERMAL/VIN/Audio support for iWave iwg20d platform based on RZ/G1N.

This patch series is based on linux-4.4.y-cip and all the patches in this series are cherry-picked from linux rc tree.


Biju Das (11):
dt-bindings: can: rcar_can: Add r8a7744 support
ARM: dts: r8a7744: Add CAN support
dt-bindings: irqchip: renesas-irqc: Document r8a7744 support
ARM: dts: r8a7744: Add IRQC support
dt-bindings: thermal: rcar: Add device tree support for r8a7744
ARM: dts: r8a7744: Add thermal device to DT
media: dt-bindings: media: rcar_vin: add device tree support for
r8a7744
ARM: dts: r8a7744: add VIN dt support
ASoC: rsnd: Add r8a7744 support
ARM: dts: r8a7744: Add audio support
ARM: dts: r8a7744-iwg20d-q7-dbcm-ca: Add device tree for camera DB

Kuninori Morimoto (1):
thermal: trip_point_temp_store() calls thermal_zone_device_update()

.../bindings/interrupt-controller/renesas,irqc.txt | 1 +
.../devicetree/bindings/media/rcar_vin.txt | 1 +
.../devicetree/bindings/net/can/rcar_can.txt | 1 +
.../devicetree/bindings/sound/renesas,rsnd.txt | 1 +
.../devicetree/bindings/thermal/rcar-thermal.txt | 1 +
arch/arm/boot/dts/Makefile | 1 +
arch/arm/boot/dts/r8a7744-iwg20d-q7-dbcm-ca.dts | 17 ++
arch/arm/boot/dts/r8a7744.dtsi | 334 ++++++++++++++++++++-
drivers/thermal/thermal_core.c | 6 +-
9 files changed, 352 insertions(+), 11 deletions(-)
create mode 100644 arch/arm/boot/dts/r8a7744-iwg20d-q7-dbcm-ca.dts
Looks good to me. I will apply if there is no other opinion.

Best regards,
Nobuhiro


[PATCH 4.4.y-cip 12/12] ARM: dts: r8a7744-iwg20d-q7-dbcm-ca: Add device tree for camera DB

Biju Das <biju.das@...>
 

commit 7fbbfe07b588cd81c1046a1846345a5cf614589a upstream.

This patch adds support for the camera daughter board which is
connected to iWave's RZ/G1N Qseven carrier board.

Signed-off-by: Biju Das <biju.das@...>
Reviewed-by: Geert Uytterhoeven <geert+renesas@...>
Signed-off-by: Simon Horman <horms+renesas@...>
---
arch/arm/boot/dts/Makefile | 1 +
arch/arm/boot/dts/r8a7744-iwg20d-q7-dbcm-ca.dts | 17 +++++++++++++++++
2 files changed, 18 insertions(+)
create mode 100644 arch/arm/boot/dts/r8a7744-iwg20d-q7-dbcm-ca.dts

diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index 88c3f12..147c66b 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -547,6 +547,7 @@ dtb-$(CONFIG_ARCH_SHMOBILE_MULTI) += \
r8a7743-iwg20d-q7.dtb \
r8a7743-iwg20d-q7-dbcm-ca.dtb \
r8a7744-iwg20d-q7.dtb \
+ r8a7744-iwg20d-q7-dbcm-ca.dtb \
r8a7745-iwg22d-sodimm.dtb \
r8a7745-iwg22d-sodimm-dbhd-ca.dtb \
r8a77470-iwg23s-sbc.dtb \
diff --git a/arch/arm/boot/dts/r8a7744-iwg20d-q7-dbcm-ca.dts b/arch/arm/boot/dts/r8a7744-iwg20d-q7-dbcm-ca.dts
new file mode 100644
index 0000000..3e58c2e9
--- /dev/null
+++ b/arch/arm/boot/dts/r8a7744-iwg20d-q7-dbcm-ca.dts
@@ -0,0 +1,17 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Device Tree Source for the iWave Systems RZ/G1N Qseven board development
+ * platform with camera daughter board
+ *
+ * Copyright (C) 2018 Renesas Electronics Corp.
+ */
+
+/dts-v1/;
+#include "r8a7744-iwg20m.dtsi"
+#include "iwg20d-q7-common.dtsi"
+#include "iwg20d-q7-dbcm-ca.dtsi"
+
+/ {
+ model = "iWave Systems RZ/G1N Qseven development platform with camera add-on";
+ compatible = "iwave,g20d", "iwave,g20m", "renesas,r8a7744";
+};
--
2.7.4


[PATCH 4.4.y-cip 11/12] ARM: dts: r8a7744: Add audio support

Biju Das <biju.das@...>
 

commit 5133bfed5e585cec75550cdc795d848fe70097a9 upstream.

Add sound support for the RZ/G1N SoC (a.k.a. R8A7744).

This work is based on similar work done on the R8A7743 SoC.

Signed-off-by: Biju Das <biju.das@...>
Reviewed-by: Geert Uytterhoeven <geert+renesas@...>
Signed-off-by: Simon Horman <horms+renesas@...>
[biju: Removed reset and updated clk and power domain properties]
Signed-off-by: Biju Das <biju.das@...>
---
arch/arm/boot/dts/r8a7744.dtsi | 235 +++++++++++++++++++++++++++++++++++++++--
1 file changed, 227 insertions(+), 8 deletions(-)

diff --git a/arch/arm/boot/dts/r8a7744.dtsi b/arch/arm/boot/dts/r8a7744.dtsi
index 10cf55e..7902f7e 100644
--- a/arch/arm/boot/dts/r8a7744.dtsi
+++ b/arch/arm/boot/dts/r8a7744.dtsi
@@ -904,23 +904,242 @@
};

rcar_sound: sound@ec500000 {
- reg = <0 0xec500000 0 0x1000>;
+ /*
+ * #sound-dai-cells is required
+ *
+ * Single DAI : #sound-dai-cells = <0>; <&rcar_sound>;
+ * Multi DAI : #sound-dai-cells = <1>; <&rcar_sound N>;
+ */
+ compatible = "renesas,rcar_sound-r8a7744",
+ "renesas,rcar_sound-gen2";
+ reg = <0 0xec500000 0 0x1000>, /* SCU */
+ <0 0xec5a0000 0 0x100>, /* ADG */
+ <0 0xec540000 0 0x1000>, /* SSIU */
+ <0 0xec541000 0 0x280>, /* SSI */
+ <0 0xec740000 0 0x200>; /* Audio DMAC peri peri*/
+ reg-names = "scu", "adg", "ssiu", "ssi", "audmapp";
+
+ clocks = <&mstp10_clks R8A7744_CLK_SSI_ALL>,
+ <&mstp10_clks R8A7744_CLK_SSI9>, <&mstp10_clks R8A7744_CLK_SSI8>,
+ <&mstp10_clks R8A7744_CLK_SSI7>, <&mstp10_clks R8A7744_CLK_SSI6>,
+ <&mstp10_clks R8A7744_CLK_SSI5>, <&mstp10_clks R8A7744_CLK_SSI4>,
+ <&mstp10_clks R8A7744_CLK_SSI3>, <&mstp10_clks R8A7744_CLK_SSI2>,
+ <&mstp10_clks R8A7744_CLK_SSI1>, <&mstp10_clks R8A7744_CLK_SSI0>,
+ <&mstp10_clks R8A7744_CLK_SCU_SRC9>, <&mstp10_clks R8A7744_CLK_SCU_SRC8>,
+ <&mstp10_clks R8A7744_CLK_SCU_SRC7>, <&mstp10_clks R8A7744_CLK_SCU_SRC6>,
+ <&mstp10_clks R8A7744_CLK_SCU_SRC5>, <&mstp10_clks R8A7744_CLK_SCU_SRC4>,
+ <&mstp10_clks R8A7744_CLK_SCU_SRC3>, <&mstp10_clks R8A7744_CLK_SCU_SRC2>,
+ <&mstp10_clks R8A7744_CLK_SCU_SRC1>, <&mstp10_clks R8A7744_CLK_SCU_SRC0>,
+ <&mstp10_clks R8A7744_CLK_SCU_CTU0_MIX0>, <&mstp10_clks R8A7744_CLK_SCU_CTU1_MIX1>,
+ <&mstp10_clks R8A7744_CLK_SCU_CTU0_MIX0>, <&mstp10_clks R8A7744_CLK_SCU_CTU1_MIX1>,
+ <&mstp10_clks R8A7744_CLK_SCU_DVC0>, <&mstp10_clks R8A7744_CLK_SCU_DVC1>,
+ <&audio_clk_a>, <&audio_clk_b>, <&audio_clk_c>,
+ <&m2_clk>;
+ clock-names = "ssi-all",
+ "ssi.9", "ssi.8", "ssi.7", "ssi.6", "ssi.5",
+ "ssi.4", "ssi.3", "ssi.2", "ssi.1", "ssi.0",
+ "src.9", "src.8", "src.7", "src.6", "src.5",
+ "src.4", "src.3", "src.2", "src.1", "src.0",
+ "ctu.0", "ctu.1",
+ "mix.0", "mix.1",
+ "dvc.0", "dvc.1",
+ "clk_a", "clk_b", "clk_c", "clk_i";
+ power-domains = <&cpg_clocks>;
+
+ status = "disabled";

rcar_sound,dvc {
- dvc0: dvc-0 {};
- dvc1: dvc-1 {};
+ dvc0: dvc-0 {
+ dmas = <&audma1 0xbc>;
+ dma-names = "tx";
+ };
+ dvc1: dvc-1 {
+ dmas = <&audma1 0xbe>;
+ dma-names = "tx";
+ };
+ };
+
+ rcar_sound,mix {
+ mix0: mix-0 { };
+ mix1: mix-1 { };
+ };
+
+ rcar_sound,ctu {
+ ctu00: ctu-0 { };
+ ctu01: ctu-1 { };
+ ctu02: ctu-2 { };
+ ctu03: ctu-3 { };
+ ctu10: ctu-4 { };
+ ctu11: ctu-5 { };
+ ctu12: ctu-6 { };
+ ctu13: ctu-7 { };
};

rcar_sound,src {
- src2: src-2 {};
- src3: src-3 {};
+ src0: src-0 {
+ interrupts = <GIC_SPI 352 IRQ_TYPE_LEVEL_HIGH>;
+ dmas = <&audma0 0x85>, <&audma1 0x9a>;
+ dma-names = "rx", "tx";
+ };
+ src1: src-1 {
+ interrupts = <GIC_SPI 353 IRQ_TYPE_LEVEL_HIGH>;
+ dmas = <&audma0 0x87>, <&audma1 0x9c>;
+ dma-names = "rx", "tx";
+ };
+ src2: src-2 {
+ interrupts = <GIC_SPI 354 IRQ_TYPE_LEVEL_HIGH>;
+ dmas = <&audma0 0x89>, <&audma1 0x9e>;
+ dma-names = "rx", "tx";
+ };
+ src3: src-3 {
+ interrupts = <GIC_SPI 355 IRQ_TYPE_LEVEL_HIGH>;
+ dmas = <&audma0 0x8b>, <&audma1 0xa0>;
+ dma-names = "rx", "tx";
+ };
+ src4: src-4 {
+ interrupts = <GIC_SPI 356 IRQ_TYPE_LEVEL_HIGH>;
+ dmas = <&audma0 0x8d>, <&audma1 0xb0>;
+ dma-names = "rx", "tx";
+ };
+ src5: src-5 {
+ interrupts = <GIC_SPI 357 IRQ_TYPE_LEVEL_HIGH>;
+ dmas = <&audma0 0x8f>, <&audma1 0xb2>;
+ dma-names = "rx", "tx";
+ };
+ src6: src-6 {
+ interrupts = <GIC_SPI 358 IRQ_TYPE_LEVEL_HIGH>;
+ dmas = <&audma0 0x91>, <&audma1 0xb4>;
+ dma-names = "rx", "tx";
+ };
+ src7: src-7 {
+ interrupts = <GIC_SPI 359 IRQ_TYPE_LEVEL_HIGH>;
+ dmas = <&audma0 0x93>, <&audma1 0xb6>;
+ dma-names = "rx", "tx";
+ };
+ src8: src-8 {
+ interrupts = <GIC_SPI 360 IRQ_TYPE_LEVEL_HIGH>;
+ dmas = <&audma0 0x95>, <&audma1 0xb8>;
+ dma-names = "rx", "tx";
+ };
+ src9: src-9 {
+ interrupts = <GIC_SPI 361 IRQ_TYPE_LEVEL_HIGH>;
+ dmas = <&audma0 0x97>, <&audma1 0xba>;
+ dma-names = "rx", "tx";
+ };
};

rcar_sound,ssi {
- ssi0: ssi-0 {};
- ssi1: ssi-1 {};
+ ssi0: ssi-0 {
+ interrupts = <GIC_SPI 370 IRQ_TYPE_LEVEL_HIGH>;
+ dmas = <&audma0 0x01>, <&audma1 0x02>, <&audma0 0x15>, <&audma1 0x16>;
+ dma-names = "rx", "tx", "rxu", "txu";
+ };
+ ssi1: ssi-1 {
+ interrupts = <GIC_SPI 371 IRQ_TYPE_LEVEL_HIGH>;
+ dmas = <&audma0 0x03>, <&audma1 0x04>, <&audma0 0x49>, <&audma1 0x4a>;
+ dma-names = "rx", "tx", "rxu", "txu";
+ };
+ ssi2: ssi-2 {
+ interrupts = <GIC_SPI 372 IRQ_TYPE_LEVEL_HIGH>;
+ dmas = <&audma0 0x05>, <&audma1 0x06>, <&audma0 0x63>, <&audma1 0x64>;
+ dma-names = "rx", "tx", "rxu", "txu";
+ };
+ ssi3: ssi-3 {
+ interrupts = <GIC_SPI 373 IRQ_TYPE_LEVEL_HIGH>;
+ dmas = <&audma0 0x07>, <&audma1 0x08>, <&audma0 0x6f>, <&audma1 0x70>;
+ dma-names = "rx", "tx", "rxu", "txu";
+ };
+ ssi4: ssi-4 {
+ interrupts = <GIC_SPI 374 IRQ_TYPE_LEVEL_HIGH>;
+ dmas = <&audma0 0x09>, <&audma1 0x0a>, <&audma0 0x71>, <&audma1 0x72>;
+ dma-names = "rx", "tx", "rxu", "txu";
+ };
+ ssi5: ssi-5 {
+ interrupts = <GIC_SPI 375 IRQ_TYPE_LEVEL_HIGH>;
+ dmas = <&audma0 0x0b>, <&audma1 0x0c>, <&audma0 0x73>, <&audma1 0x74>;
+ dma-names = "rx", "tx", "rxu", "txu";
+ };
+ ssi6: ssi-6 {
+ interrupts = <GIC_SPI 376 IRQ_TYPE_LEVEL_HIGH>;
+ dmas = <&audma0 0x0d>, <&audma1 0x0e>, <&audma0 0x75>, <&audma1 0x76>;
+ dma-names = "rx", "tx", "rxu", "txu";
+ };
+ ssi7: ssi-7 {
+ interrupts = <GIC_SPI 377 IRQ_TYPE_LEVEL_HIGH>;
+ dmas = <&audma0 0x0f>, <&audma1 0x10>, <&audma0 0x79>, <&audma1 0x7a>;
+ dma-names = "rx", "tx", "rxu", "txu";
+ };
+ ssi8: ssi-8 {
+ interrupts = <GIC_SPI 378 IRQ_TYPE_LEVEL_HIGH>;
+ dmas = <&audma0 0x11>, <&audma1 0x12>, <&audma0 0x7b>, <&audma1 0x7c>;
+ dma-names = "rx", "tx", "rxu", "txu";
+ };
+ ssi9: ssi-9 {
+ interrupts = <GIC_SPI 379 IRQ_TYPE_LEVEL_HIGH>;
+ dmas = <&audma0 0x13>, <&audma1 0x14>, <&audma0 0x7d>, <&audma1 0x7e>;
+ dma-names = "rx", "tx", "rxu", "txu";
+ };
};
- /* placeholder */
+ };
+
+ audma0: dma-controller@ec700000 {
+ compatible = "renesas,dmac-r8a7744",
+ "renesas,rcar-dmac";
+ reg = <0 0xec700000 0 0x10000>;
+ interrupts = <GIC_SPI 346 IRQ_TYPE_LEVEL_HIGH
+ GIC_SPI 320 IRQ_TYPE_LEVEL_HIGH
+ GIC_SPI 321 IRQ_TYPE_LEVEL_HIGH
+ GIC_SPI 322 IRQ_TYPE_LEVEL_HIGH
+ GIC_SPI 323 IRQ_TYPE_LEVEL_HIGH
+ GIC_SPI 324 IRQ_TYPE_LEVEL_HIGH
+ GIC_SPI 325 IRQ_TYPE_LEVEL_HIGH
+ GIC_SPI 326 IRQ_TYPE_LEVEL_HIGH
+ GIC_SPI 327 IRQ_TYPE_LEVEL_HIGH
+ GIC_SPI 328 IRQ_TYPE_LEVEL_HIGH
+ GIC_SPI 329 IRQ_TYPE_LEVEL_HIGH
+ GIC_SPI 330 IRQ_TYPE_LEVEL_HIGH
+ GIC_SPI 331 IRQ_TYPE_LEVEL_HIGH
+ GIC_SPI 332 IRQ_TYPE_LEVEL_HIGH>;
+ interrupt-names = "error",
+ "ch0", "ch1", "ch2", "ch3",
+ "ch4", "ch5", "ch6", "ch7",
+ "ch8", "ch9", "ch10", "ch11",
+ "ch12";
+ clocks = <&mstp5_clks R8A7744_CLK_AUDIO_DMAC0>;
+ clock-names = "fck";
+ power-domains = <&cpg_clocks>;
+ #dma-cells = <1>;
+ dma-channels = <13>;
+ };
+
+ audma1: dma-controller@ec720000 {
+ compatible = "renesas,dmac-r8a7744",
+ "renesas,rcar-dmac";
+ reg = <0 0xec720000 0 0x10000>;
+ interrupts = <GIC_SPI 347 IRQ_TYPE_LEVEL_HIGH
+ GIC_SPI 333 IRQ_TYPE_LEVEL_HIGH
+ GIC_SPI 334 IRQ_TYPE_LEVEL_HIGH
+ GIC_SPI 335 IRQ_TYPE_LEVEL_HIGH
+ GIC_SPI 336 IRQ_TYPE_LEVEL_HIGH
+ GIC_SPI 337 IRQ_TYPE_LEVEL_HIGH
+ GIC_SPI 338 IRQ_TYPE_LEVEL_HIGH
+ GIC_SPI 339 IRQ_TYPE_LEVEL_HIGH
+ GIC_SPI 340 IRQ_TYPE_LEVEL_HIGH
+ GIC_SPI 341 IRQ_TYPE_LEVEL_HIGH
+ GIC_SPI 342 IRQ_TYPE_LEVEL_HIGH
+ GIC_SPI 343 IRQ_TYPE_LEVEL_HIGH
+ GIC_SPI 344 IRQ_TYPE_LEVEL_HIGH
+ GIC_SPI 345 IRQ_TYPE_LEVEL_HIGH>;
+ interrupt-names = "error",
+ "ch0", "ch1", "ch2", "ch3",
+ "ch4", "ch5", "ch6", "ch7",
+ "ch8", "ch9", "ch10", "ch11",
+ "ch12";
+ clocks = <&mstp5_clks R8A7744_CLK_AUDIO_DMAC1>;
+ clock-names = "fck";
+ power-domains = <&cpg_clocks>;
+ #dma-cells = <1>;
+ dma-channels = <13>;
};

pci0: pci@ee090000 {
--
2.7.4


[PATCH 4.4.y-cip 10/12] ASoC: rsnd: Add r8a7744 support

Biju Das <biju.das@...>
 

commit 765f50d464457c6a397506b3f3dc58dacc227c6d upstream.

Document RZ/G1N (R8A7744) SoC bindings.

Signed-off-by: Biju Das <biju.das@...>
Reviewed-by: Chris Paterson <Chris.Paterson2@...>
Signed-off-by: Mark Brown <broonie@...>
---
Documentation/devicetree/bindings/sound/renesas,rsnd.txt | 1 +
1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/sound/renesas,rsnd.txt b/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
index 649cd3a..23656d1 100644
--- a/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
+++ b/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
@@ -7,6 +7,7 @@ Required properties:
"renesas,rcar_sound-gen3" if generation3
Examples with soctypes are:
- "renesas,rcar_sound-r8a7743" (RZ/G1M)
+ - "renesas,rcar_sound-r8a7744" (RZ/G1N)
- "renesas,rcar_sound-r8a7745" (RZ/G1E)
- "renesas,rcar_sound-r8a7778" (R-Car M1A)
- "renesas,rcar_sound-r8a7790" (R-Car H2)
--
2.7.4


[PATCH 4.4.y-cip 09/12] ARM: dts: r8a7744: add VIN dt support

Biju Das <biju.das@...>
 

commit 10fabcb817c5e37aeb8a1b79a95468c8df45898c upstream.

Add VIN[012] support to SoC dt.

Signed-off-by: Biju Das <biju.das@...>
Reviewed-by: Geert Uytterhoeven <geert+renesas@...>
Signed-off-by: Simon Horman <horms+renesas@...>
[biju: Removed reset and updated clk and power domain properties]
Signed-off-by: Biju Das <biju.das@...>
---
arch/arm/boot/dts/r8a7744.dtsi | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)

diff --git a/arch/arm/boot/dts/r8a7744.dtsi b/arch/arm/boot/dts/r8a7744.dtsi
index 5fab84f..10cf55e 100644
--- a/arch/arm/boot/dts/r8a7744.dtsi
+++ b/arch/arm/boot/dts/r8a7744.dtsi
@@ -873,6 +873,36 @@
status = "disabled";
};

+ vin0: video@e6ef0000 {
+ compatible = "renesas,vin-r8a7744",
+ "renesas,rcar-gen2-vin";
+ reg = <0 0xe6ef0000 0 0x1000>;
+ interrupts = <GIC_SPI 188 IRQ_TYPE_LEVEL_HIGH>;
+ clocks = <&mstp8_clks R8A7744_CLK_VIN0>;
+ power-domains = <&cpg_clocks>;
+ status = "disabled";
+ };
+
+ vin1: video@e6ef1000 {
+ compatible = "renesas,vin-r8a7744",
+ "renesas,rcar-gen2-vin";
+ reg = <0 0xe6ef1000 0 0x1000>;
+ interrupts = <GIC_SPI 189 IRQ_TYPE_LEVEL_HIGH>;
+ clocks = <&mstp8_clks R8A7744_CLK_VIN1>;
+ power-domains = <&cpg_clocks>;
+ status = "disabled";
+ };
+
+ vin2: video@e6ef2000 {
+ compatible = "renesas,vin-r8a7744",
+ "renesas,rcar-gen2-vin";
+ reg = <0 0xe6ef2000 0 0x1000>;
+ interrupts = <GIC_SPI 190 IRQ_TYPE_LEVEL_HIGH>;
+ clocks = <&mstp8_clks R8A7744_CLK_VIN2>;
+ power-domains = <&cpg_clocks>;
+ status = "disabled";
+ };
+
rcar_sound: sound@ec500000 {
reg = <0 0xec500000 0 0x1000>;

--
2.7.4


[PATCH 4.4.y-cip 08/12] media: dt-bindings: media: rcar_vin: add device tree support for r8a7744

Biju Das <biju.das@...>
 

commit d07d9195c950d1cd16ec32a0819b2b98084c0753 upstream.

Add compatible strings for r8a7744. No driver change is needed as
"renesas,rcar-gen2-vin" will activate the right code.However, it is good
practice to document compatible strings for the specific SoC as this
allows SoC specific changes to the driver if needed, in addition to
document SoC support and therefore allow checkpatch.pl to validate
compatible string values.

Signed-off-by: Biju Das <biju.das@...>
Reviewed-by: Chris Paterson <Chris.Paterson2@...>
Acked-by: Niklas Söderlund <niklas.soderlund+renesas@...>
Signed-off-by: Hans Verkuil <hverkuil@...>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@...>
---
Documentation/devicetree/bindings/media/rcar_vin.txt | 1 +
1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/media/rcar_vin.txt b/Documentation/devicetree/bindings/media/rcar_vin.txt
index 08eca2e..6c7ba02 100644
--- a/Documentation/devicetree/bindings/media/rcar_vin.txt
+++ b/Documentation/devicetree/bindings/media/rcar_vin.txt
@@ -7,6 +7,7 @@ channel which can be either RGB, YUYV or BT656.

- compatible: Must be one or more of the following
- "renesas,vin-r8a7743" for the R8A7743 device
+ - "renesas,vin-r8a7744" for the R8A7744 device
- "renesas,vin-r8a7745" for the R8A7745 device
- "renesas,vin-r8a7778" for the R8A7778 device
- "renesas,vin-r8a7779" for the R8A7779 device
--
2.7.4


[PATCH 4.4.y-cip 07/12] ARM: dts: r8a7744: Add thermal device to DT

Biju Das <biju.das@...>
 

commit ef9d757c06e9b0258b10fcb19c3be2d8cbbc0a30 upstream.

This patch instantiates the thermal sensor module with thermal-zone
support.

Signed-off-by: Biju Das <biju.das@...>
Reviewed-by: Geert Uytterhoeven <geert+renesas@...>
Signed-off-by: Simon Horman <horms+renesas@...>
[biju: Removed reset and updated clk and power domain properties]
Signed-off-by: Biju Das <biju.das@...>
---
arch/arm/boot/dts/r8a7744.dtsi | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)

diff --git a/arch/arm/boot/dts/r8a7744.dtsi b/arch/arm/boot/dts/r8a7744.dtsi
index 1e7e410..5fab84f 100644
--- a/arch/arm/boot/dts/r8a7744.dtsi
+++ b/arch/arm/boot/dts/r8a7744.dtsi
@@ -290,6 +290,16 @@
power-domains = <&cpg_clocks>;
};

+ thermal: thermal@e61f0000 {
+ compatible = "renesas,thermal-r8a7744",
+ "renesas,rcar-gen2-thermal";
+ reg = <0 0xe61f0000 0 0x10>, <0 0xe61f0100 0 0x38>;
+ interrupts = <GIC_SPI 69 IRQ_TYPE_LEVEL_HIGH>;
+ clocks = <&mstp5_clks R8A7744_CLK_THERMAL>;
+ power-domains = <&cpg_clocks>;
+ #thermal-sensor-cells = <0>;
+ };
+
icram0: sram@e63a0000 {
compatible = "mmio-sram";
reg = <0 0xe63a0000 0 0x12000>;
@@ -1506,6 +1516,26 @@
};
};

+ thermal-zones {
+ cpu_thermal: cpu-thermal {
+ polling-delay-passive = <0>;
+ polling-delay = <0>;
+
+ thermal-sensors = <&thermal>;
+
+ trips {
+ cpu-crit {
+ temperature = <95000>;
+ hysteresis = <0>;
+ type = "critical";
+ };
+ };
+
+ cooling-maps {
+ };
+ };
+ };
+
timer {
compatible = "arm,armv7-timer";
interrupts-extended = <&gic GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_LOW)>,
--
2.7.4


[PATCH 4.4.y-cip 06/12] dt-bindings: thermal: rcar: Add device tree support for r8a7744

Biju Das <biju.das@...>
 

commit 304d9b486b3c6994c193b6693c601b463987e6ac upstream.

Add thermal sensor support for r8a7744 SoC. The Renesas RZ/G1N
(r8a7744) thermal sensor module is identical to the R-Car Gen2 family.

No driver change is needed due to the fallback compatible value
"renesas,rcar-gen2-thermal".

Signed-off-by: Biju Das <biju.das@...>
Reviewed-by: Chris Paterson <Chris.Paterson2@...>
Reviewed-by: Daniel Lezcano <daniel.lezcano@...>
Reviewed-by: Simon Horman <horms+renesas@...>
Reviewed-by: Geert Uytterhoeven <geert+renesas@...>
Signed-off-by: Eduardo Valentin <edubezval@...>
---
Documentation/devicetree/bindings/thermal/rcar-thermal.txt | 1 +
1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/thermal/rcar-thermal.txt b/Documentation/devicetree/bindings/thermal/rcar-thermal.txt
index 689e7e8..1e0f837 100644
--- a/Documentation/devicetree/bindings/thermal/rcar-thermal.txt
+++ b/Documentation/devicetree/bindings/thermal/rcar-thermal.txt
@@ -7,6 +7,7 @@ Required properties:
Examples with soctypes are:
- "renesas,thermal-r8a73a4" (R-Mobile APE6)
- "renesas,thermal-r8a7743" (RZ/G1M)
+ - "renesas,thermal-r8a7744" (RZ/G1N)
- "renesas,thermal-r8a7779" (R-Car H1)
- "renesas,thermal-r8a7790" (R-Car H2)
- "renesas,thermal-r8a7791" (R-Car M2-W)
--
2.7.4


[PATCH 4.4.y-cip 05/12] thermal: trip_point_temp_store() calls thermal_zone_device_update()

Biju Das <biju.das@...>
 

From: Kuninori Morimoto <kuninori.morimoto.gx@...>

commit ad74e46cb3ba9e706f91f3f71baf816d2d8e45db upstream.

trip_point_temp_store() updates trip temperature. It should call
thermal_zone_device_update() immediately.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@...>
Signed-off-by: Eduardo Valentin <edubezval@...>
Signed-off-by: Biju Das <biju.das@...>
---
drivers/thermal/thermal_core.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index 929092f..0e919c3 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -700,8 +700,12 @@ trip_point_temp_store(struct device *dev, struct device_attribute *attr,
return -EINVAL;

ret = tz->ops->set_trip_temp(tz, trip, temperature);
+ if (ret)
+ return ret;

- return ret ? ret : count;
+ thermal_zone_device_update(tz);
+
+ return count;
}

static ssize_t
--
2.7.4


[PATCH 4.4.y-cip 04/12] ARM: dts: r8a7744: Add IRQC support

Biju Das <biju.das@...>
 

commit 154a05f0c870e6c49753cda689d2209c0915996e upstream.

Describe the IRQC interrupt controller in the r8a7744 device tree.

Signed-off-by: Biju Das <biju.das@...>
Reviewed-by: Geert Uytterhoeven <geert+renesas@...>
Signed-off-by: Simon Horman <horms+renesas@...>
[biju: Removed reset and updated clk and power domain properties]
Signed-off-by: Biju Das <biju.das@...>
---
arch/arm/boot/dts/r8a7744.dtsi | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)

diff --git a/arch/arm/boot/dts/r8a7744.dtsi b/arch/arm/boot/dts/r8a7744.dtsi
index 4538689..1e7e410 100644
--- a/arch/arm/boot/dts/r8a7744.dtsi
+++ b/arch/arm/boot/dts/r8a7744.dtsi
@@ -271,6 +271,25 @@
reg = <0 0xe6160000 0 0x100>;
};

+ irqc: interrupt-controller@e61c0000 {
+ compatible = "renesas,irqc-r8a7744", "renesas,irqc";
+ #interrupt-cells = <2>;
+ interrupt-controller;
+ reg = <0 0xe61c0000 0 0x200>;
+ interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 12 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 13 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 16 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>;
+ clocks = <&mstp4_clks R8A7744_CLK_IRQC>;
+ power-domains = <&cpg_clocks>;
+ };
+
icram0: sram@e63a0000 {
compatible = "mmio-sram";
reg = <0 0xe63a0000 0 0x12000>;
--
2.7.4


[PATCH 4.4.y-cip 03/12] dt-bindings: irqchip: renesas-irqc: Document r8a7744 support

Biju Das <biju.das@...>
 

commit 0c4cb97d4ec9d98fc5e30317326f28ed206f3ac6 upstream.

Document RZ/G1N (R8A7744) SoC bindings.

Reviewed-by: Chris Paterson <Chris.Paterson2@...>
Reviewed-by: Simon Horman <horms+renesas@...>
Reviewed-by: Geert Uytterhoeven <geert+renesas@...>
Signed-off-by: Biju Das <biju.das@...>
Signed-off-by: Marc Zyngier <marc.zyngier@...>
---
Documentation/devicetree/bindings/interrupt-controller/renesas,irqc.txt | 1 +
1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/interrupt-controller/renesas,irqc.txt b/Documentation/devicetree/bindings/interrupt-controller/renesas,irqc.txt
index 1ed382e..eea4c7b 100644
--- a/Documentation/devicetree/bindings/interrupt-controller/renesas,irqc.txt
+++ b/Documentation/devicetree/bindings/interrupt-controller/renesas,irqc.txt
@@ -6,6 +6,7 @@ Required properties:
Examples with soctypes are:
- "renesas,irqc-r8a73a4" (R-Mobile APE6)
- "renesas,irqc-r8a7743" (RZ/G1M)
+ - "renesas,irqc-r8a7744" (RZ/G1N)
- "renesas,irqc-r8a7745" (RZ/G1E)
- "renesas,irqc-r8a77470" (RZ/G1C)
- "renesas,irqc-r8a7790" (R-Car H2)
--
2.7.4


[PATCH 4.4.y-cip 02/12] ARM: dts: r8a7744: Add CAN support

Biju Das <biju.das@...>
 

commit 56f1896093043c63c6ecd8a53080aa89d6b41070 upstream.

Add the definitions for can0 and can1 to the r8a7744 SoC dtsi.

Signed-off-by: Biju Das <biju.das@...>
Reviewed-by: Geert Uytterhoeven <geert+renesas@...>
Signed-off-by: Simon Horman <horms+renesas@...>
[biju: Removed reset and updated clk and power domain properties]
Signed-off-by: Biju Das <biju.das@...>
---
arch/arm/boot/dts/r8a7744.dtsi | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/r8a7744.dtsi b/arch/arm/boot/dts/r8a7744.dtsi
index c73269c..4538689 100644
--- a/arch/arm/boot/dts/r8a7744.dtsi
+++ b/arch/arm/boot/dts/r8a7744.dtsi
@@ -819,13 +819,29 @@
};

can0: can@e6e80000 {
+ compatible = "renesas,can-r8a7744",
+ "renesas,rcar-gen2-can";
reg = <0 0xe6e80000 0 0x1000>;
- /* placeholder */
+ interrupts = <GIC_SPI 186 IRQ_TYPE_LEVEL_HIGH>;
+ clocks = <&mstp9_clks R8A7744_CLK_RCAN0>,
+ <&cpg_clocks R8A7744_CLK_RCAN>,
+ <&can_clk>;
+ clock-names = "clkp1", "clkp2", "can_clk";
+ power-domains = <&cpg_clocks>;
+ status = "disabled";
};

can1: can@e6e88000 {
+ compatible = "renesas,can-r8a7744",
+ "renesas,rcar-gen2-can";
reg = <0 0xe6e88000 0 0x1000>;
- /* placeholder */
+ interrupts = <GIC_SPI 187 IRQ_TYPE_LEVEL_HIGH>;
+ clocks = <&mstp9_clks R8A7744_CLK_RCAN1>,
+ <&cpg_clocks R8A7744_CLK_RCAN>,
+ <&can_clk>;
+ clock-names = "clkp1", "clkp2", "can_clk";
+ power-domains = <&cpg_clocks>;
+ status = "disabled";
};

rcar_sound: sound@ec500000 {
--
2.7.4


[PATCH 4.4.y-cip 01/12] dt-bindings: can: rcar_can: Add r8a7744 support

Biju Das <biju.das@...>
 

commit 700992d361c7912923d1e570681eed65b54a6d9b upstream.

Document RZ/G1N (r8a7744) SoC specific bindings.

Signed-off-by: Biju Das <biju.das@...>
Reviewed-by: Chris Paterson <Chris.Paterson2@...>
Reviewed-by: Simon Horman <horms+renesas@...>
Signed-off-by: Rob Herring <robh@...>
---
Documentation/devicetree/bindings/net/can/rcar_can.txt | 1 +
1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/net/can/rcar_can.txt b/Documentation/devicetree/bindings/net/can/rcar_can.txt
index 6f81b1f..fbad4d5 100644
--- a/Documentation/devicetree/bindings/net/can/rcar_can.txt
+++ b/Documentation/devicetree/bindings/net/can/rcar_can.txt
@@ -3,6 +3,7 @@ Renesas R-Car CAN controller Device Tree Bindings

Required properties:
- compatible: "renesas,can-r8a7743" if CAN controller is a part of R8A7743 SoC.
+ "renesas,can-r8a7744" if CAN controller is a part of R8A7744 SoC.
"renesas,can-r8a7745" if CAN controller is a part of R8A7745 SoC.
"renesas,can-r8a7778" if CAN controller is a part of R8A7778 SoC.
"renesas,can-r8a7779" if CAN controller is a part of R8A7779 SoC.
--
2.7.4


[PATCH 4.4.y-cip 00/12] Add CAN/IRQC/THERMAL/VIN/Audio support

Biju Das <biju.das@...>
 

This patch series add CAN/IRQC/THERMAL/VIN/Audio support for iWave iwg20d platform based on RZ/G1N.

This patch series is based on linux-4.4.y-cip and all the patches in this series are cherry-picked from linux rc tree.


Biju Das (11):
dt-bindings: can: rcar_can: Add r8a7744 support
ARM: dts: r8a7744: Add CAN support
dt-bindings: irqchip: renesas-irqc: Document r8a7744 support
ARM: dts: r8a7744: Add IRQC support
dt-bindings: thermal: rcar: Add device tree support for r8a7744
ARM: dts: r8a7744: Add thermal device to DT
media: dt-bindings: media: rcar_vin: add device tree support for
r8a7744
ARM: dts: r8a7744: add VIN dt support
ASoC: rsnd: Add r8a7744 support
ARM: dts: r8a7744: Add audio support
ARM: dts: r8a7744-iwg20d-q7-dbcm-ca: Add device tree for camera DB

Kuninori Morimoto (1):
thermal: trip_point_temp_store() calls thermal_zone_device_update()

.../bindings/interrupt-controller/renesas,irqc.txt | 1 +
.../devicetree/bindings/media/rcar_vin.txt | 1 +
.../devicetree/bindings/net/can/rcar_can.txt | 1 +
.../devicetree/bindings/sound/renesas,rsnd.txt | 1 +
.../devicetree/bindings/thermal/rcar-thermal.txt | 1 +
arch/arm/boot/dts/Makefile | 1 +
arch/arm/boot/dts/r8a7744-iwg20d-q7-dbcm-ca.dts | 17 ++
arch/arm/boot/dts/r8a7744.dtsi | 334 ++++++++++++++++++++-
drivers/thermal/thermal_core.c | 6 +-
9 files changed, 352 insertions(+), 11 deletions(-)
create mode 100644 arch/arm/boot/dts/r8a7744-iwg20d-q7-dbcm-ca.dts

--
2.7.4


Re: [PATCH linux-4.4.y-cip v3] gpiolib: Fix bad of_node pointer

johnsonch.chen@moxa.com
 

Dear all,

Thanks for this patch. It help us a lot!

Best regards,
Johnson

From: cip-dev <cip-dev-bounces@...> On Behalf Of
nobuhiro1.iwamatsu@...
Sent: Friday, December 6, 2019 6:56 AM
To: Chris.Paterson2@...; fabrizio.castro@...;
cip-dev@...
Cc: biju.das@...
Subject: Re: [cip-dev] [PATCH linux-4.4.y-cip v3] gpiolib: Fix bad
of_node pointer

Hi,

-----Original Message-----
From: Chris Paterson [mailto:Chris.Paterson2@...]
Sent: Friday, December 6, 2019 3:52 AM
To: Fabrizio Castro <fabrizio.castro@...>;
cip-dev@...
Cc: iwamatsu nobuhiro(岩松 信洋 ○SWC□OST)
<nobuhiro1.iwamatsu@...>; pavel@...; Biju Das
<biju.das@...>; Fabrizio Castro
<fabrizio.castro@...>
Subject: RE: [cip-dev][PATCH linux-4.4.y-cip v3] gpiolib: Fix bad
of_node pointer

Hello,

From: Fabrizio Castro <fabrizio.castro@...>
Sent: 05 December 2019 13:40

Not every driver initialises of_node from struct gpio_chip,
therefore the replacement of of_node from struct gpio_chip with
dev->of_node in the below commit won't work on every
platform:
baff4777cdb8 ("gpiolib: Support 'gpio-reserved-ranges' property")
The final result is that on some platforms the kernel will try to
dereference a NULL pointer, with obvious consequences.

This patch makes sure the pointer gets initialised before its
first usage.

Fixes: baff4777cdb8 ("gpiolib: Support 'gpio-reserved-ranges'
property")
Reported-by: Johnson CH Chen <JohnsonCH.Chen@...>
Signed-off-by: Fabrizio Castro <fabrizio.castro@...>

---
Hi guys,

sorry for the trouble.
v2 broke Intel builds (thank you Chris for spotting this), v3
fixes
that.

I've tested v3 (current linux-v4.4.y-cip 7b4a8ef7 + a revert for v2)
and all builds pass:
https://gitlab.com/cip-project/cip-kernel/linux-cip/pipelines/100999
517
Thanks for test report.


Are you happy to replace v2 with v3 on linux-4.4.y-cip?
I guess this depends on CIP's rules on force-pushing ??
I applied v3 instead of v2 and force-push.

Best regards,
Nobuhiro
_______________________________________________
cip-dev mailing list
cip-dev@...
https://lists.cip-project.org/mailman/listinfo/cip-dev


Re: [PATCH linux-4.4.y-cip v3] gpiolib: Fix bad of_node pointer

Nobuhiro Iwamatsu
 

Hi,

-----Original Message-----
From: Chris Paterson [mailto:Chris.Paterson2@...]
Sent: Friday, December 6, 2019 3:52 AM
To: Fabrizio Castro <fabrizio.castro@...>;
cip-dev@...
Cc: iwamatsu nobuhiro(岩松 信洋 ○SWC□OST)
<nobuhiro1.iwamatsu@...>; pavel@...; Biju Das
<biju.das@...>; Fabrizio Castro
<fabrizio.castro@...>
Subject: RE: [cip-dev][PATCH linux-4.4.y-cip v3] gpiolib: Fix bad of_node
pointer

Hello,

From: Fabrizio Castro <fabrizio.castro@...>
Sent: 05 December 2019 13:40

Not every driver initialises of_node from struct gpio_chip, therefore
the replacement of of_node from struct gpio_chip with dev->of_node in
the below commit won't work on every
platform:
baff4777cdb8 ("gpiolib: Support 'gpio-reserved-ranges' property") The
final result is that on some platforms the kernel will try to
dereference a NULL pointer, with obvious consequences.

This patch makes sure the pointer gets initialised before its first
usage.

Fixes: baff4777cdb8 ("gpiolib: Support 'gpio-reserved-ranges'
property")
Reported-by: Johnson CH Chen <JohnsonCH.Chen@...>
Signed-off-by: Fabrizio Castro <fabrizio.castro@...>

---
Hi guys,

sorry for the trouble.
v2 broke Intel builds (thank you Chris for spotting this), v3 fixes
that.

I've tested v3 (current linux-v4.4.y-cip 7b4a8ef7 + a revert for v2) and
all builds pass:
https://gitlab.com/cip-project/cip-kernel/linux-cip/pipelines/100999
517
Thanks for test report.


Are you happy to replace v2 with v3 on linux-4.4.y-cip?
I guess this depends on CIP's rules on force-pushing ??
I applied v3 instead of v2 and force-push.

Best regards,
Nobuhiro


Re: [PATCH linux-4.4.y-cip v3] gpiolib: Fix bad of_node pointer

Chris Paterson
 

Hello,

From: Fabrizio Castro <fabrizio.castro@...>
Sent: 05 December 2019 13:40

Not every driver initialises of_node from struct gpio_chip,
therefore the replacement of of_node from struct gpio_chip
with dev->of_node in the below commit won't work on every
platform:
baff4777cdb8 ("gpiolib: Support 'gpio-reserved-ranges' property")
The final result is that on some platforms the kernel will
try to dereference a NULL pointer, with obvious consequences.

This patch makes sure the pointer gets initialised before its
first usage.

Fixes: baff4777cdb8 ("gpiolib: Support 'gpio-reserved-ranges' property")
Reported-by: Johnson CH Chen <JohnsonCH.Chen@...>
Signed-off-by: Fabrizio Castro <fabrizio.castro@...>

---
Hi guys,

sorry for the trouble.
v2 broke Intel builds (thank you Chris for spotting this), v3 fixes that.
I've tested v3 (current linux-v4.4.y-cip 7b4a8ef7 + a revert for v2) and all builds pass:
https://gitlab.com/cip-project/cip-kernel/linux-cip/pipelines/100999517

Are you happy to replace v2 with v3 on linux-4.4.y-cip?
I guess this depends on CIP's rules on force-pushing ??

Kind regards, Chris


Thanks,
Fab

v2->v3:
* v2 was accessing chip->of_node regardless of CONFIG_OF_GPIO
being enabled or not. v3 compiles that out in case CONFIG_OF_GPIO
is not enabled.
v1->v2:
* v1 was for testing purposes only, but no point in sending
out a dirty patch, therefore cleaned it up
---
drivers/gpio/gpiolib-of.c | 2 +-
drivers/gpio/gpiolib.c | 7 ++++++-
2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c
index ec642bf..6fa1818 100644
--- a/drivers/gpio/gpiolib-of.c
+++ b/drivers/gpio/gpiolib-of.c
@@ -338,7 +338,7 @@ static void of_gpiochip_init_valid_mask(struct
gpio_chip *chip)
{
int len, i;
u32 start, count;
- struct device_node *np = chip->dev->of_node;
+ struct device_node *np = chip->of_node;

len = of_property_count_u32_elems(np, "gpio-reserved-ranges");
if (len < 0 || len % 2 != 0)
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index d72218f..516498e 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -296,7 +296,7 @@ static int gpiochip_init_valid_mask(struct gpio_chip
*gpiochip)
{
#ifdef CONFIG_OF_GPIO
int size;
- struct device_node *np = gpiochip->dev->of_node;
+ struct device_node *np = gpiochip->of_node;

size = of_property_count_u32_elems(np, "gpio-reserved-ranges");
if (size > 0 && size % 2 == 0)
@@ -360,6 +360,11 @@ int gpiochip_add_data(struct gpio_chip *chip, void
*data)

chip->data = data;

+#ifdef CONFIG_OF_GPIO
+ if ((!chip->of_node) && (chip->dev))
+ chip->of_node = chip->dev->of_node;
+#endif
+
spin_lock_irqsave(&gpio_lock, flags);

if (base < 0) {
--
2.7.4


[PATCH linux-4.4.y-cip v3] gpiolib: Fix bad of_node pointer

Fabrizio Castro <fabrizio.castro@...>
 

Not every driver initialises of_node from struct gpio_chip,
therefore the replacement of of_node from struct gpio_chip
with dev->of_node in the below commit won't work on every
platform:
baff4777cdb8 ("gpiolib: Support 'gpio-reserved-ranges' property")
The final result is that on some platforms the kernel will
try to dereference a NULL pointer, with obvious consequences.

This patch makes sure the pointer gets initialised before its
first usage.

Fixes: baff4777cdb8 ("gpiolib: Support 'gpio-reserved-ranges' property")
Reported-by: Johnson CH Chen <JohnsonCH.Chen@...>
Signed-off-by: Fabrizio Castro <fabrizio.castro@...>

---
Hi guys,

sorry for the trouble.
v2 broke Intel builds (thank you Chris for spotting this), v3 fixes that.
Are you happy to replace v2 with v3 on linux-4.4.y-cip?

Thanks,
Fab

v2->v3:
* v2 was accessing chip->of_node regardless of CONFIG_OF_GPIO
being enabled or not. v3 compiles that out in case CONFIG_OF_GPIO
is not enabled.
v1->v2:
* v1 was for testing purposes only, but no point in sending
out a dirty patch, therefore cleaned it up
---
drivers/gpio/gpiolib-of.c | 2 +-
drivers/gpio/gpiolib.c | 7 ++++++-
2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c
index ec642bf..6fa1818 100644
--- a/drivers/gpio/gpiolib-of.c
+++ b/drivers/gpio/gpiolib-of.c
@@ -338,7 +338,7 @@ static void of_gpiochip_init_valid_mask(struct gpio_chip *chip)
{
int len, i;
u32 start, count;
- struct device_node *np = chip->dev->of_node;
+ struct device_node *np = chip->of_node;

len = of_property_count_u32_elems(np, "gpio-reserved-ranges");
if (len < 0 || len % 2 != 0)
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index d72218f..516498e 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -296,7 +296,7 @@ static int gpiochip_init_valid_mask(struct gpio_chip *gpiochip)
{
#ifdef CONFIG_OF_GPIO
int size;
- struct device_node *np = gpiochip->dev->of_node;
+ struct device_node *np = gpiochip->of_node;

size = of_property_count_u32_elems(np, "gpio-reserved-ranges");
if (size > 0 && size % 2 == 0)
@@ -360,6 +360,11 @@ int gpiochip_add_data(struct gpio_chip *chip, void *data)

chip->data = data;

+#ifdef CONFIG_OF_GPIO
+ if ((!chip->of_node) && (chip->dev))
+ chip->of_node = chip->dev->of_node;
+#endif
+
spin_lock_irqsave(&gpio_lock, flags);

if (base < 0) {
--
2.7.4


Re: [PATCH 4.4.y-cip] gpiolib: Fix invalid access of nullptr

Fabrizio Castro <fabrizio.castro@...>
 

Hi Chris,

Thank you for your feedback!

From: Chris Paterson <Chris.Paterson2@...>
Sent: 05 December 2019 09:44
To: nobuhiro1.iwamatsu@...; pavel@...
Cc: Fabrizio Castro <fabrizio.castro@...>; stefan-koch@...; cip-dev@...; Biju Das
<biju.das@...>
Subject: RE: [PATCH 4.4.y-cip] gpiolib: Fix invalid access of nullptr

Hello all,

From: nobuhiro1.iwamatsu@...
<nobuhiro1.iwamatsu@...>
Sent: 04 December 2019 23:21

From: Pavel Machek [mailto:pavel@...]
Sent: Wednesday, December 4, 2019 9:37 PM

Hi!

That's a known problem, please have a look at:
https://patchwork.kernel.org/patch/11235267/

Pavel, Iwamatsu-san, could you please take patch:
https://patchwork.kernel.org/patch/11235267/

I think this is quite urgent as others will stumble across the
problem and will try and fix it.
OK, I will apply this with following comment if there is no other opinion.

NOTE: gpiochip_add_data()'s fixes is based on
6ff0497402ef7269ee6a72f62eb85adaa7a4768e.

Sounds good to me.
Applied.
This patch seems to have broken builds for 2/16 of our v4.4.y-cip configurations.
Pipeline: https://gitlab.com/cip-project/cip-kernel/linux-cip/pipelines/100757773

1) x86_plathome_obsvx1.config: https://gitlab.com/cip-project/cip-kernel/linux-cip/-/jobs/369871332

Error log:
3274 drivers/gpio/gpiolib.c: In function 'gpiochip_add_data':
3275 drivers/gpio/gpiolib.c:363:12: error: 'struct gpio_chip' has no member named 'of_node'
3276 if ((!chip->of_node) && (chip->dev))
3277 ^~
3278 drivers/gpio/gpiolib.c:364:7: error: 'struct gpio_chip' has no member named 'of_node'
3279 chip->of_node = chip->dev->of_node;
3280 ^~
3281 CC drivers/dma/ioat/prep.o
3282 scripts/Makefile.build:277: recipe for target 'drivers/gpio/gpiolib.o' failed
3283 make[2]: *** [drivers/gpio/gpiolib.o] Error 1
3284 scripts/Makefile.build:484: recipe for target 'drivers/gpio' failed
3285 make[1]: *** [drivers/gpio] Error 2
3286 make[1]: *** Waiting for unfinished jobs....


2) x86_siemens_iot2000.config: https://gitlab.com/cip-project/cip-kernel/linux-cip/-/jobs/369871333

Error log:
2729 drivers/gpio/gpiolib.c: In function 'gpiochip_add_data':
2730 drivers/gpio/gpiolib.c:363:12: error: 'struct gpio_chip' has no member named 'of_node'
2731 if ((!chip->of_node) && (chip->dev))
2732 ^~
2733 drivers/gpio/gpiolib.c:364:7: error: 'struct gpio_chip' has no member named 'of_node'
2734 chip->of_node = chip->dev->of_node;
2735 ^~
2736 scripts/Makefile.build:277: recipe for target 'drivers/gpio/gpiolib.o' failed
2737 make[2]: *** [drivers/gpio/gpiolib.o] Error 1
2738 make[1]: *** [drivers/gpio] Error 2
2739 make[1]: *** Waiting for unfinished jobs....
2740 scripts/Makefile.build:484: recipe for target 'drivers/gpio' failed
This makes a lot of sense, Intel would not have CONFIG_OF_GPIO set!
I'll send another version.

Thanks,
Fab



Kind regards, Chris


Best regards,
Nobuhiro


Re: [PATCH 4.4.y-cip] gpiolib: Fix invalid access of nullptr

Chris Paterson
 

Hello all,

From: nobuhiro1.iwamatsu@...
<nobuhiro1.iwamatsu@...>
Sent: 04 December 2019 23:21

From: Pavel Machek [mailto:pavel@...]
Sent: Wednesday, December 4, 2019 9:37 PM

Hi!

That's a known problem, please have a look at:
https://patchwork.kernel.org/patch/11235267/

Pavel, Iwamatsu-san, could you please take patch:
https://patchwork.kernel.org/patch/11235267/

I think this is quite urgent as others will stumble across the
problem and will try and fix it.
OK, I will apply this with following comment if there is no other opinion.

NOTE: gpiochip_add_data()'s fixes is based on
6ff0497402ef7269ee6a72f62eb85adaa7a4768e.

Sounds good to me.
Applied.
This patch seems to have broken builds for 2/16 of our v4.4.y-cip configurations.
Pipeline: https://gitlab.com/cip-project/cip-kernel/linux-cip/pipelines/100757773

1) x86_plathome_obsvx1.config: https://gitlab.com/cip-project/cip-kernel/linux-cip/-/jobs/369871332

Error log:
3274 drivers/gpio/gpiolib.c: In function 'gpiochip_add_data':
3275 drivers/gpio/gpiolib.c:363:12: error: 'struct gpio_chip' has no member named 'of_node'
3276 if ((!chip->of_node) && (chip->dev))
3277 ^~
3278 drivers/gpio/gpiolib.c:364:7: error: 'struct gpio_chip' has no member named 'of_node'
3279 chip->of_node = chip->dev->of_node;
3280 ^~
3281 CC drivers/dma/ioat/prep.o
3282 scripts/Makefile.build:277: recipe for target 'drivers/gpio/gpiolib.o' failed
3283 make[2]: *** [drivers/gpio/gpiolib.o] Error 1
3284 scripts/Makefile.build:484: recipe for target 'drivers/gpio' failed
3285 make[1]: *** [drivers/gpio] Error 2
3286 make[1]: *** Waiting for unfinished jobs....


2) x86_siemens_iot2000.config: https://gitlab.com/cip-project/cip-kernel/linux-cip/-/jobs/369871333

Error log:
2729 drivers/gpio/gpiolib.c: In function 'gpiochip_add_data':
2730 drivers/gpio/gpiolib.c:363:12: error: 'struct gpio_chip' has no member named 'of_node'
2731 if ((!chip->of_node) && (chip->dev))
2732 ^~
2733 drivers/gpio/gpiolib.c:364:7: error: 'struct gpio_chip' has no member named 'of_node'
2734 chip->of_node = chip->dev->of_node;
2735 ^~
2736 scripts/Makefile.build:277: recipe for target 'drivers/gpio/gpiolib.o' failed
2737 make[2]: *** [drivers/gpio/gpiolib.o] Error 1
2738 make[1]: *** [drivers/gpio] Error 2
2739 make[1]: *** Waiting for unfinished jobs....
2740 scripts/Makefile.build:484: recipe for target 'drivers/gpio' failed


Kind regards, Chris


Best regards,
Nobuhiro

6561 - 6580 of 10561