* [PATCH/RFT 0/3] thermal: add support for r8a77995
@ 2018-03-11 20:26 Yoshihiro Kaneko
2018-03-11 20:26 ` [PATCH/RFT 1/3] thermal: rcar_thermal: add r8a77995 support Yoshihiro Kaneko
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: Yoshihiro Kaneko @ 2018-03-11 20:26 UTC (permalink / raw)
To: linux-renesas-soc
Cc: Zhang Rui, Eduardo Valentin, Rob Herring, linux-pm, devicetree
This series adds thermal support for r8a77995.
R-Car D3 (r8a77995) have a thermal sensor module which is similar to Gen2.
Therefore this series adds r8a77995 support to rcar_thermal driver not
rcar_gen3_thermal driver.
This series is based on the next branch of Zhang Rui's linux tree.
Yoshihiro Kaneko (3):
thermal: rcar_thermal: add r8a77995 support
dt-bindings: thermal: rcar-thermal: add R8A77995 support
arm64: dts: renesas: r8a77995: add thermal device support
.../devicetree/bindings/thermal/rcar-thermal.txt | 1 +
arch/arm64/boot/dts/renesas/r8a77995.dtsi | 31 +++++
drivers/thermal/rcar_thermal.c | 141 ++++++++++++++++-----
3 files changed, 144 insertions(+), 29 deletions(-)
--
1.9.1
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH/RFT 1/3] thermal: rcar_thermal: add r8a77995 support
2018-03-11 20:26 [PATCH/RFT 0/3] thermal: add support for r8a77995 Yoshihiro Kaneko
@ 2018-03-11 20:26 ` Yoshihiro Kaneko
2018-03-12 11:02 ` Geert Uytterhoeven
2018-03-11 20:26 ` [PATCH 2/3] dt-bindings: thermal: rcar-thermal: add R8A77995 support Yoshihiro Kaneko
2018-03-11 20:26 ` [PATCH 3/3] arm64: dts: renesas: r8a77995: add thermal device support Yoshihiro Kaneko
2 siblings, 1 reply; 10+ messages in thread
From: Yoshihiro Kaneko @ 2018-03-11 20:26 UTC (permalink / raw)
To: linux-renesas-soc
Cc: Zhang Rui, Eduardo Valentin, Rob Herring, linux-pm, devicetree
Add support for R-Car D3 (r8a77995) thermal sensor.
Signed-off-by: Yoshihiro Kaneko <ykaneko0929@gmail.com>
---
drivers/thermal/rcar_thermal.c | 141 ++++++++++++++++++++++++++++++++---------
1 file changed, 112 insertions(+), 29 deletions(-)
diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c
index 73e5fee..d517155 100644
--- a/drivers/thermal/rcar_thermal.c
+++ b/drivers/thermal/rcar_thermal.c
@@ -69,6 +69,30 @@ struct rcar_thermal_priv {
u32 ctemp;
};
+enum rcar_thermal_type {
+ RCAR_THERMAL,
+ RCAR_GEN2_THERMAL,
+ RCAR_GEN3_THERMAL,
+};
+
+struct rcar_thermal_chip {
+ int use_of_thermal;
+ enum rcar_thermal_type type;
+};
+
+static const struct rcar_thermal_chip rcar_thermal = {
+ .use_of_thermal = 0,
+ .type = RCAR_THERMAL,
+};
+static const struct rcar_thermal_chip rcar_gen2_thermal = {
+ .use_of_thermal = 1,
+ .type = RCAR_GEN2_THERMAL,
+};
+static const struct rcar_thermal_chip rcar_gen3_thermal = {
+ .use_of_thermal = 1,
+ .type = RCAR_GEN3_THERMAL,
+};
+
#define rcar_thermal_for_each_priv(pos, common) \
list_for_each_entry(pos, &common->head, list)
@@ -77,13 +101,23 @@ struct rcar_thermal_priv {
#define rcar_priv_to_dev(priv) ((priv)->common->dev)
#define rcar_has_irq_support(priv) ((priv)->common->base)
#define rcar_id_to_shift(priv) ((priv)->id * 8)
-#define rcar_of_data(dev) ((unsigned long)of_device_get_match_data(dev))
-#define rcar_use_of_thermal(dev) (rcar_of_data(dev) == USE_OF_THERMAL)
+#define rcar_of_data(dev) \
+ ((struct rcar_thermal_chip *)of_device_get_match_data(dev))
+#define rcar_use_of_thermal(dev) (rcar_of_data(dev)->use_of_thermal)
-#define USE_OF_THERMAL 1
static const struct of_device_id rcar_thermal_dt_ids[] = {
- { .compatible = "renesas,rcar-thermal", },
- { .compatible = "renesas,rcar-gen2-thermal", .data = (void *)USE_OF_THERMAL },
+ {
+ .compatible = "renesas,rcar-thermal",
+ .data = (void *)&rcar_thermal,
+ },
+ {
+ .compatible = "renesas,rcar-gen2-thermal",
+ .data = (void *)&rcar_gen2_thermal,
+ },
+ {
+ .compatible = "renesas,thermal-r8a77995",
+ .data = (void *)&rcar_gen3_thermal,
+ },
{},
};
MODULE_DEVICE_TABLE(of, rcar_thermal_dt_ids);
@@ -190,7 +224,8 @@ static int rcar_thermal_update_temp(struct rcar_thermal_priv *priv)
* enable IRQ
*/
if (rcar_has_irq_support(priv)) {
- rcar_thermal_write(priv, FILONOFF, 0);
+ if (rcar_of_data(dev)->type != RCAR_GEN3_THERMAL)
+ rcar_thermal_write(priv, FILONOFF, 0);
/* enable Rising/Falling edge interrupt */
rcar_thermal_write(priv, POSNEG, 0x1);
@@ -438,6 +473,7 @@ static int rcar_thermal_probe(struct platform_device *pdev)
struct rcar_thermal_priv *priv;
struct device *dev = &pdev->dev;
struct resource *res, *irq;
+ int nirq = rcar_of_data(dev)->type == RCAR_GEN3_THERMAL ? 2 : 1;
int mres = 0;
int i;
int ret = -ENODEV;
@@ -457,19 +493,35 @@ static int rcar_thermal_probe(struct platform_device *pdev)
pm_runtime_enable(dev);
pm_runtime_get_sync(dev);
- irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
- if (irq) {
- /*
- * platform has IRQ support.
- * Then, driver uses common registers
- * rcar_has_irq_support() will be enabled
- */
- res = platform_get_resource(pdev, IORESOURCE_MEM, mres++);
- common->base = devm_ioremap_resource(dev, res);
- if (IS_ERR(common->base))
- return PTR_ERR(common->base);
+ for (i = 0; i < nirq; i++) {
+ irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
+ if (!irq)
+ continue;
+ if (!common->base) {
+ /*
+ * platform has IRQ support.
+ * Then, driver uses common registers
+ * rcar_has_irq_support() will be enabled
+ */
+ res = platform_get_resource(pdev, IORESOURCE_MEM,
+ mres++);
+ common->base = devm_ioremap_resource(dev, res);
+ if (IS_ERR(common->base))
+ return PTR_ERR(common->base);
- idle = 0; /* polling delay is not needed */
+ idle = 0; /* polling delay is not needed */
+ }
+
+ ret = devm_request_irq(dev, irq->start, rcar_thermal_irq,
+ IRQF_SHARED, dev_name(dev), common);
+ if (ret) {
+ dev_err(dev, "irq request failed\n ");
+ goto error_unregister;
+ }
+
+ /* update ENR bits */
+ if (rcar_of_data(dev)->type == RCAR_GEN3_THERMAL)
+ enr_bits |= 1 << i;
}
for (i = 0;; i++) {
@@ -531,20 +583,12 @@ static int rcar_thermal_probe(struct platform_device *pdev)
list_move_tail(&priv->list, &common->head);
/* update ENR bits */
- enr_bits |= 3 << (i * 8);
+ if (rcar_of_data(dev)->type != RCAR_GEN3_THERMAL)
+ enr_bits |= 3 << (i * 8);
}
- /* enable temperature comparation */
- if (irq) {
- ret = devm_request_irq(dev, irq->start, rcar_thermal_irq, 0,
- dev_name(dev), common);
- if (ret) {
- dev_err(dev, "irq request failed\n ");
- goto error_unregister;
- }
-
+ if (enr_bits)
rcar_thermal_common_write(common, ENR, enr_bits);
- }
dev_info(dev, "%d sensor probed\n", i);
@@ -556,9 +600,48 @@ static int rcar_thermal_probe(struct platform_device *pdev)
return ret;
}
+#ifdef CONFIG_PM_SLEEP
+static int rcar_thermal_suspend(struct device *dev)
+{
+ struct rcar_thermal_common *common = dev_get_drvdata(dev);
+ struct rcar_thermal_priv *priv;
+
+ if (rcar_of_data(dev)->type == RCAR_GEN3_THERMAL) {
+ rcar_thermal_common_write(common, ENR, 0);
+ priv = list_first_entry(&common->head, typeof(*priv), list);
+ rcar_thermal_irq_disable(priv);
+ rcar_thermal_bset(priv, THSCR, CPCTL, 0);
+ }
+
+ return 0;
+}
+
+static int rcar_thermal_resume(struct device *dev)
+{
+ struct rcar_thermal_common *common = dev_get_drvdata(dev);
+ struct rcar_thermal_priv *priv;
+ int ret;
+
+ if (rcar_of_data(dev)->type == RCAR_GEN3_THERMAL) {
+ priv = list_first_entry(&common->head, typeof(*priv), list);
+ ret = rcar_thermal_update_temp(priv);
+ if (ret < 0)
+ return ret;
+ rcar_thermal_irq_enable(priv);
+ rcar_thermal_common_write(common, ENR, 0x03);
+ }
+
+ return 0;
+}
+#endif
+
+static SIMPLE_DEV_PM_OPS(rcar_thermal_pm_ops, rcar_thermal_suspend,
+ rcar_thermal_resume);
+
static struct platform_driver rcar_thermal_driver = {
.driver = {
.name = "rcar_thermal",
+ .pm = &rcar_thermal_pm_ops,
.of_match_table = rcar_thermal_dt_ids,
},
.probe = rcar_thermal_probe,
--
1.9.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 2/3] dt-bindings: thermal: rcar-thermal: add R8A77995 support
2018-03-11 20:26 [PATCH/RFT 0/3] thermal: add support for r8a77995 Yoshihiro Kaneko
2018-03-11 20:26 ` [PATCH/RFT 1/3] thermal: rcar_thermal: add r8a77995 support Yoshihiro Kaneko
@ 2018-03-11 20:26 ` Yoshihiro Kaneko
2018-03-12 10:13 ` Geert Uytterhoeven
2018-03-11 20:26 ` [PATCH 3/3] arm64: dts: renesas: r8a77995: add thermal device support Yoshihiro Kaneko
2 siblings, 1 reply; 10+ messages in thread
From: Yoshihiro Kaneko @ 2018-03-11 20:26 UTC (permalink / raw)
To: linux-renesas-soc
Cc: Zhang Rui, Eduardo Valentin, Rob Herring, linux-pm, devicetree
Signed-off-by: Yoshihiro Kaneko <ykaneko0929@gmail.com>
---
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 349e635..b2829cb 100644
--- a/Documentation/devicetree/bindings/thermal/rcar-thermal.txt
+++ b/Documentation/devicetree/bindings/thermal/rcar-thermal.txt
@@ -12,6 +12,7 @@ Required properties:
- "renesas,thermal-r8a7791" (R-Car M2-W)
- "renesas,thermal-r8a7792" (R-Car V2H)
- "renesas,thermal-r8a7793" (R-Car M2-N)
+ - "renesas,thermal-r8a77995" (R-Car D3)
- reg : Address range of the thermal registers.
The 1st reg will be recognized as common register
if it has "interrupts".
--
1.9.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 3/3] arm64: dts: renesas: r8a77995: add thermal device support
2018-03-11 20:26 [PATCH/RFT 0/3] thermal: add support for r8a77995 Yoshihiro Kaneko
2018-03-11 20:26 ` [PATCH/RFT 1/3] thermal: rcar_thermal: add r8a77995 support Yoshihiro Kaneko
2018-03-11 20:26 ` [PATCH 2/3] dt-bindings: thermal: rcar-thermal: add R8A77995 support Yoshihiro Kaneko
@ 2018-03-11 20:26 ` Yoshihiro Kaneko
2018-03-12 10:56 ` Geert Uytterhoeven
2 siblings, 1 reply; 10+ messages in thread
From: Yoshihiro Kaneko @ 2018-03-11 20:26 UTC (permalink / raw)
To: linux-renesas-soc
Cc: Zhang Rui, Eduardo Valentin, Rob Herring, linux-pm, devicetree
Signed-off-by: Yoshihiro Kaneko <ykaneko0929@gmail.com>
---
arch/arm64/boot/dts/renesas/r8a77995.dtsi | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/arch/arm64/boot/dts/renesas/r8a77995.dtsi b/arch/arm64/boot/dts/renesas/r8a77995.dtsi
index 788e3af..d1a5197 100644
--- a/arch/arm64/boot/dts/renesas/r8a77995.dtsi
+++ b/arch/arm64/boot/dts/renesas/r8a77995.dtsi
@@ -402,5 +402,36 @@
#phy-cells = <0>;
status = "disabled";
};
+
+ thermal: thermal@e61f0000 {
+ compatible = "renesas,thermal-r8a77995",
+ "renesas,rcar-thermal";
+ reg = <0 0xe61f0000 0 0x10>, <0 0xe61f0100 0 0x38>;
+ interrupts = <GIC_SPI 67 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 68 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 69 IRQ_TYPE_LEVEL_HIGH>;
+ clocks = <&cpg CPG_MOD 522>;
+ power-domains = <&sysc R8A77995_PD_ALWAYS_ON>;
+ resets = <&cpg 522>;
+ #thermal-sensor-cells = <0>;
+ };
+ };
+
+ thermal-zones {
+ cpu_thermal: cpu-thermal {
+ polling-delay-passive = <250>;
+ polling-delay = <1000>;
+ thermal-sensors = <&thermal>;
+
+ trips {
+ cpu-crit {
+ temperature = <120000>;
+ hysteresis = <2000>;
+ type = "critical";
+ };
+ };
+ cooling-maps {
+ };
+ };
};
};
--
1.9.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 2/3] dt-bindings: thermal: rcar-thermal: add R8A77995 support
2018-03-11 20:26 ` [PATCH 2/3] dt-bindings: thermal: rcar-thermal: add R8A77995 support Yoshihiro Kaneko
@ 2018-03-12 10:13 ` Geert Uytterhoeven
2018-03-13 16:35 ` Yoshihiro Kaneko
0 siblings, 1 reply; 10+ messages in thread
From: Geert Uytterhoeven @ 2018-03-12 10:13 UTC (permalink / raw)
To: Yoshihiro Kaneko
Cc: Linux-Renesas, Zhang Rui, Eduardo Valentin, Rob Herring,
Linux PM list,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS
Hi Kaneko-san,
On Sun, Mar 11, 2018 at 9:26 PM, Yoshihiro Kaneko <ykaneko0929@gmail.com> wrote:
> Signed-off-by: Yoshihiro Kaneko <ykaneko0929@gmail.com>
Thanks for your patch!
> --- a/Documentation/devicetree/bindings/thermal/rcar-thermal.txt
> +++ b/Documentation/devicetree/bindings/thermal/rcar-thermal.txt
> @@ -12,6 +12,7 @@ Required properties:
> - "renesas,thermal-r8a7791" (R-Car M2-W)
> - "renesas,thermal-r8a7792" (R-Car V2H)
> - "renesas,thermal-r8a7793" (R-Car M2-N)
> + - "renesas,thermal-r8a77995" (R-Car D3)
OK for this change.
I think the paragraph above needs some clarification, too:
Required properties:
- compatible : "renesas,thermal-<soctype>",
"renesas,rcar-gen2-thermal" (with
thermal-zone) or
"renesas,rcar-thermal" (without
thermal-zone) as fallback.
Your DT update for D3 contains the thermal-zone, but it is not R-Car Gen2,
while you declare it compatible with "renesas,rcar-thermal".
Probably we can just drop the fallback for D3 (and V3M later)?
And the paragraph about interrupts need an update, too, as D3 has more
than one interrupt:
Option properties:
- interrupts : use interrupt
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
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
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 3/3] arm64: dts: renesas: r8a77995: add thermal device support
2018-03-11 20:26 ` [PATCH 3/3] arm64: dts: renesas: r8a77995: add thermal device support Yoshihiro Kaneko
@ 2018-03-12 10:56 ` Geert Uytterhoeven
2018-03-13 16:41 ` Yoshihiro Kaneko
0 siblings, 1 reply; 10+ messages in thread
From: Geert Uytterhoeven @ 2018-03-12 10:56 UTC (permalink / raw)
To: Yoshihiro Kaneko
Cc: Linux-Renesas, Zhang Rui, Eduardo Valentin, Rob Herring,
Linux PM list,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS
Hi Kaneko-san,
On Sun, Mar 11, 2018 at 9:26 PM, Yoshihiro Kaneko <ykaneko0929@gmail.com> wrote:
> Signed-off-by: Yoshihiro Kaneko <ykaneko0929@gmail.com>
Thanks for your patch!
> --- a/arch/arm64/boot/dts/renesas/r8a77995.dtsi
> +++ b/arch/arm64/boot/dts/renesas/r8a77995.dtsi
> @@ -402,5 +402,36 @@
> #phy-cells = <0>;
> status = "disabled";
> };
> +
> + thermal: thermal@e61f0000 {
According to the Hard User Manual rev. 0.80, the base address is e6190000?
> + compatible = "renesas,thermal-r8a77995",
> + "renesas,rcar-thermal";
I would drop the fallback property, cfr. my comments on the DT binding
patch.
> + reg = <0 0xe61f0000 0 0x10>, <0 0xe61f0100 0 0x38>;
0xe619... (twice)
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
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
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH/RFT 1/3] thermal: rcar_thermal: add r8a77995 support
2018-03-11 20:26 ` [PATCH/RFT 1/3] thermal: rcar_thermal: add r8a77995 support Yoshihiro Kaneko
@ 2018-03-12 11:02 ` Geert Uytterhoeven
2018-03-13 16:59 ` Yoshihiro Kaneko
0 siblings, 1 reply; 10+ messages in thread
From: Geert Uytterhoeven @ 2018-03-12 11:02 UTC (permalink / raw)
To: Yoshihiro Kaneko
Cc: Linux-Renesas, Zhang Rui, Eduardo Valentin, Rob Herring,
Linux PM list,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS
Hi Kaneko-san,
On Sun, Mar 11, 2018 at 9:26 PM, Yoshihiro Kaneko <ykaneko0929@gmail.com> wrote:
> Add support for R-Car D3 (r8a77995) thermal sensor.
>
> Signed-off-by: Yoshihiro Kaneko <ykaneko0929@gmail.com>
Thanks for your patch!
> --- a/drivers/thermal/rcar_thermal.c
> +++ b/drivers/thermal/rcar_thermal.c
> @@ -77,13 +101,23 @@ struct rcar_thermal_priv {
> #define rcar_priv_to_dev(priv) ((priv)->common->dev)
> #define rcar_has_irq_support(priv) ((priv)->common->base)
> #define rcar_id_to_shift(priv) ((priv)->id * 8)
> -#define rcar_of_data(dev) ((unsigned long)of_device_get_match_data(dev))
> -#define rcar_use_of_thermal(dev) (rcar_of_data(dev) == USE_OF_THERMAL)
> +#define rcar_of_data(dev) \
> + ((struct rcar_thermal_chip *)of_device_get_match_data(dev))
I think it would be better to get rid of this macro, as
of_device_get_match_data()
walks the rcar_thermal_dt_ids[] over and over again.
Instead, you can store a pointer to struct rcar_thermal_chip in struct
rcar_thermal_priv in rcar_thermal_probe().
> +#define rcar_use_of_thermal(dev) (rcar_of_data(dev)->use_of_thermal)
> -#define USE_OF_THERMAL 1
> static const struct of_device_id rcar_thermal_dt_ids[] = {
> - { .compatible = "renesas,rcar-thermal", },
> - { .compatible = "renesas,rcar-gen2-thermal", .data = (void *)USE_OF_THERMAL },
> + {
> + .compatible = "renesas,rcar-thermal",
> + .data = (void *)&rcar_thermal,
This cast not needed.
> @@ -438,6 +473,7 @@ static int rcar_thermal_probe(struct platform_device *pdev)
> struct rcar_thermal_priv *priv;
> struct device *dev = &pdev->dev;
> struct resource *res, *irq;
> + int nirq = rcar_of_data(dev)->type == RCAR_GEN3_THERMAL ? 2 : 1;
Why 2? Your DT patch has 3 interrupts, which matches the datasheet.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
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
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/3] dt-bindings: thermal: rcar-thermal: add R8A77995 support
2018-03-12 10:13 ` Geert Uytterhoeven
@ 2018-03-13 16:35 ` Yoshihiro Kaneko
0 siblings, 0 replies; 10+ messages in thread
From: Yoshihiro Kaneko @ 2018-03-13 16:35 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Linux-Renesas, Zhang Rui, Eduardo Valentin, Rob Herring,
Linux PM list,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS
Hi Geert-san,
Thank you for your review!
2018-03-12 19:13 GMT+09:00 Geert Uytterhoeven <geert@linux-m68k.org>:
> Hi Kaneko-san,
>
> On Sun, Mar 11, 2018 at 9:26 PM, Yoshihiro Kaneko <ykaneko0929@gmail.com> wrote:
>> Signed-off-by: Yoshihiro Kaneko <ykaneko0929@gmail.com>
>
> Thanks for your patch!
>
>> --- a/Documentation/devicetree/bindings/thermal/rcar-thermal.txt
>> +++ b/Documentation/devicetree/bindings/thermal/rcar-thermal.txt
>> @@ -12,6 +12,7 @@ Required properties:
>> - "renesas,thermal-r8a7791" (R-Car M2-W)
>> - "renesas,thermal-r8a7792" (R-Car V2H)
>> - "renesas,thermal-r8a7793" (R-Car M2-N)
>> + - "renesas,thermal-r8a77995" (R-Car D3)
>
> OK for this change.
>
> I think the paragraph above needs some clarification, too:
>
> Required properties:
> - compatible : "renesas,thermal-<soctype>",
> "renesas,rcar-gen2-thermal" (with
> thermal-zone) or
> "renesas,rcar-thermal" (without
> thermal-zone) as fallback.
>
> Your DT update for D3 contains the thermal-zone, but it is not R-Car Gen2,
> while you declare it compatible with "renesas,rcar-thermal".
>
> Probably we can just drop the fallback for D3 (and V3M later)?
It sounds good.
I will update DT to drop the fallback for D3.
>
> And the paragraph about interrupts need an update, too, as D3 has more
> than one interrupt:
>
> Option properties:
> - interrupts : use interrupt
I will update this paragraph.
Thanks,
Kaneko
>
> Gr{oetje,eeting}s,
>
> Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
>
> 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
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 3/3] arm64: dts: renesas: r8a77995: add thermal device support
2018-03-12 10:56 ` Geert Uytterhoeven
@ 2018-03-13 16:41 ` Yoshihiro Kaneko
0 siblings, 0 replies; 10+ messages in thread
From: Yoshihiro Kaneko @ 2018-03-13 16:41 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Linux-Renesas, Zhang Rui, Eduardo Valentin, Rob Herring,
Linux PM list,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS
Hi Geert-san,
Thanks for your review.
2018-03-12 19:56 GMT+09:00 Geert Uytterhoeven <geert@linux-m68k.org>:
> Hi Kaneko-san,
>
> On Sun, Mar 11, 2018 at 9:26 PM, Yoshihiro Kaneko <ykaneko0929@gmail.com> wrote:
>> Signed-off-by: Yoshihiro Kaneko <ykaneko0929@gmail.com>
>
> Thanks for your patch!
>
>> --- a/arch/arm64/boot/dts/renesas/r8a77995.dtsi
>> +++ b/arch/arm64/boot/dts/renesas/r8a77995.dtsi
>> @@ -402,5 +402,36 @@
>> #phy-cells = <0>;
>> status = "disabled";
>> };
>> +
>> + thermal: thermal@e61f0000 {
>
> According to the Hard User Manual rev. 0.80, the base address is e6190000?
You are correct.
I will update this patch to fix it.
>
>> + compatible = "renesas,thermal-r8a77995",
>> + "renesas,rcar-thermal";
>
> I would drop the fallback property, cfr. my comments on the DT binding
> patch.
Yes. I will do it.
>
>> + reg = <0 0xe61f0000 0 0x10>, <0 0xe61f0100 0 0x38>;
>
> 0xe619... (twice)
I will fix it.
Thanks,
Kaneko
>
> Gr{oetje,eeting}s,
>
> Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
>
> 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
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH/RFT 1/3] thermal: rcar_thermal: add r8a77995 support
2018-03-12 11:02 ` Geert Uytterhoeven
@ 2018-03-13 16:59 ` Yoshihiro Kaneko
0 siblings, 0 replies; 10+ messages in thread
From: Yoshihiro Kaneko @ 2018-03-13 16:59 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Linux-Renesas, Zhang Rui, Eduardo Valentin, Rob Herring,
Linux PM list,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS
Hi Geert-san,
Thanks for your review.
2018-03-12 20:02 GMT+09:00 Geert Uytterhoeven <geert@linux-m68k.org>:
> Hi Kaneko-san,
>
> On Sun, Mar 11, 2018 at 9:26 PM, Yoshihiro Kaneko <ykaneko0929@gmail.com> wrote:
>> Add support for R-Car D3 (r8a77995) thermal sensor.
>>
>> Signed-off-by: Yoshihiro Kaneko <ykaneko0929@gmail.com>
>
> Thanks for your patch!
>
>> --- a/drivers/thermal/rcar_thermal.c
>> +++ b/drivers/thermal/rcar_thermal.c
>
>> @@ -77,13 +101,23 @@ struct rcar_thermal_priv {
>> #define rcar_priv_to_dev(priv) ((priv)->common->dev)
>> #define rcar_has_irq_support(priv) ((priv)->common->base)
>> #define rcar_id_to_shift(priv) ((priv)->id * 8)
>> -#define rcar_of_data(dev) ((unsigned long)of_device_get_match_data(dev))
>> -#define rcar_use_of_thermal(dev) (rcar_of_data(dev) == USE_OF_THERMAL)
>> +#define rcar_of_data(dev) \
>> + ((struct rcar_thermal_chip *)of_device_get_match_data(dev))
>
> I think it would be better to get rid of this macro, as
> of_device_get_match_data()
> walks the rcar_thermal_dt_ids[] over and over again.
>
> Instead, you can store a pointer to struct rcar_thermal_chip in struct
> rcar_thermal_priv in rcar_thermal_probe().
I understand.
I will work on this improvement.
>
>> +#define rcar_use_of_thermal(dev) (rcar_of_data(dev)->use_of_thermal)
>> -#define USE_OF_THERMAL 1
>> static const struct of_device_id rcar_thermal_dt_ids[] = {
>> - { .compatible = "renesas,rcar-thermal", },
>> - { .compatible = "renesas,rcar-gen2-thermal", .data = (void *)USE_OF_THERMAL },
>> + {
>> + .compatible = "renesas,rcar-thermal",
>> + .data = (void *)&rcar_thermal,
>
> This cast not needed.
Yes.
>
>> @@ -438,6 +473,7 @@ static int rcar_thermal_probe(struct platform_device *pdev)
>> struct rcar_thermal_priv *priv;
>> struct device *dev = &pdev->dev;
>> struct resource *res, *irq;
>> + int nirq = rcar_of_data(dev)->type == RCAR_GEN3_THERMAL ? 2 : 1;
>
> Why 2? Your DT patch has 3 interrupts, which matches the datasheet.
This driver uses INTDT0 and INTDT1. INTDT2 is not used.
Thanks,
Kaneko
>
> Gr{oetje,eeting}s,
>
> Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
>
> 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
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2018-03-13 16:59 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-11 20:26 [PATCH/RFT 0/3] thermal: add support for r8a77995 Yoshihiro Kaneko
2018-03-11 20:26 ` [PATCH/RFT 1/3] thermal: rcar_thermal: add r8a77995 support Yoshihiro Kaneko
2018-03-12 11:02 ` Geert Uytterhoeven
2018-03-13 16:59 ` Yoshihiro Kaneko
2018-03-11 20:26 ` [PATCH 2/3] dt-bindings: thermal: rcar-thermal: add R8A77995 support Yoshihiro Kaneko
2018-03-12 10:13 ` Geert Uytterhoeven
2018-03-13 16:35 ` Yoshihiro Kaneko
2018-03-11 20:26 ` [PATCH 3/3] arm64: dts: renesas: r8a77995: add thermal device support Yoshihiro Kaneko
2018-03-12 10:56 ` Geert Uytterhoeven
2018-03-13 16:41 ` Yoshihiro Kaneko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).