mbox series

[0/3] thermal: Add support for R-Car V3U (r8a779a0)

Message ID 20201126223028.3119044-1-niklas.soderlund+renesas@ragnatech.se
Headers show
Series thermal: Add support for R-Car V3U (r8a779a0) | expand

Message

Niklas Söderlund Nov. 26, 2020, 10:30 p.m. UTC
Hello,

This series enables support for the R-Car V3U r8a779a0 thermal IP. It 
needs to touch both the device tree schema and driver as the IP is a tad 
different then its siblings in the Gen3 family.

  - It have 4 TSC cells instead of 2-3 that is used in other SoCs.

  - The interrupts are no longer wired to the INTC-AP so the driver 
    can't make use of them directly and are therefor made optional for 
    the V3U bindings. For this reason this series depends on [1].

The driver is tested together with it's dependency [1] and [2] on V3U 
and all 4 thermal sensors behaves as expected. The driver has also been 
tested on other R-Car Gen3 SoC for regressions, none where found.

The additional THCODE tuning parameters used in 3/3 are taken from the 
datasheet example and may need to be updated. In future the tuning 
parameters shall be read from fused registers on the IP directly and the 
hardcoded values in the driver only used as fallback for IP where the 
values are not fused.

1. [PATCH] thermal: rcar_gen3_thermal: Do not use interrupts for normal operation
2. [PATCH 0/2] clk: renesas: r8a779a0: Add clocks to support thermal

Niklas Söderlund (3):
  dt-bindings: thermal: rcar-gen3-thermal: Add r8a779a0 support
  arm64: dts: renesas: r8a779a0: Add thermal support
  thermal: rcar_gen3_thermal: Add r8a779a0 support

 .../bindings/thermal/rcar-gen3-thermal.yaml   | 17 ++++-
 arch/arm64/boot/dts/renesas/r8a779a0.dtsi     | 70 +++++++++++++++++++
 drivers/thermal/rcar_gen3_thermal.c           |  7 +-
 3 files changed, 91 insertions(+), 3 deletions(-)

Comments

Geert Uytterhoeven Jan. 5, 2021, 10:27 a.m. UTC | #1
Hi Niklas,

On Thu, Nov 26, 2020 at 11:30 PM Niklas Söderlund
<niklas.soderlund+renesas@ragnatech.se> wrote:
> Add support for thermal.

>

> Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>


Thanks for your patch!

> --- a/arch/arm64/boot/dts/renesas/r8a779a0.dtsi

> +++ b/arch/arm64/boot/dts/renesas/r8a779a0.dtsi

> @@ -91,6 +91,18 @@ sysc: system-controller@e6180000 {

>                         #power-domain-cells = <1>;

>                 };

>

> +               tsc: thermal@e6190000 {

> +                       compatible = "renesas,r8a779a0-thermal";

> +                       reg = <0 0xe6190000 0 0x100>,

> +                             <0 0xe6198000 0 0x100>,

> +                             <0 0xe61a0000 0 0x100>,

> +                             <0 0xe61a8000 0 0x100>;


The fifth region at 0x161b0000 is missing.

> +                       clocks = <&cpg CPG_MOD 919>;

> +                       power-domains = <&sysc R8A779A0_PD_ALWAYS_ON>;

> +                       resets = <&cpg 919>;

> +                       #thermal-sensor-cells = <1>;

> +               };

> +

>                 scif0: serial@e6e60000 {

>                         compatible = "renesas,scif-r8a779a0",

>                                      "renesas,rcar-gen3-scif", "renesas,scif";

> @@ -123,6 +135,64 @@ prr: chipid@fff00044 {

>                 };

>         };

>

> +       thermal-zones {

> +               sensor_thermal1: sensor-thermal1 {

> +                       polling-delay-passive = <250>;

> +                       polling-delay = <1000>;

> +                       thermal-sensors = <&tsc 0>;

> +

> +                       trips {

> +                               sensor1_crit: sensor1-crit {

> +                                       temperature = <120000>;

> +                                       hysteresis = <1000>;

> +                                       type = "critical";

> +                               };

> +                       };

> +               };

> +

> +               sensor_thermal2: sensor-thermal2 {

> +                       polling-delay-passive = <250>;

> +                       polling-delay = <1000>;

> +                       thermal-sensors = <&tsc 1>;

> +

> +                       trips {

> +                               sensor2_crit: sensor2-crit {

> +                                       temperature = <120000>;

> +                                       hysteresis = <1000>;

> +                                       type = "critical";

> +                               };

> +                       };

> +               };

> +

> +               sensor_thermal3: sensor-thermal3 {

> +                       polling-delay-passive = <250>;

> +                       polling-delay = <1000>;

> +                       thermal-sensors = <&tsc 2>;

> +

> +                       trips {

> +                               sensor3_crit: sensor3-crit {

> +                                       temperature = <120000>;

> +                                       hysteresis = <1000>;

> +                                       type = "critical";

> +                               };

> +                       };

> +               };

> +

> +               sensor_thermal4: sensor-thermal4 {

> +                       polling-delay-passive = <250>;

> +                       polling-delay = <1000>;

> +                       thermal-sensors = <&tsc 3>;

> +

> +                       trips {

> +                               sensor4_crit: sensor4-crit {

> +                                       temperature = <120000>;

> +                                       hysteresis = <1000>;

> +                                       type = "critical";

> +                               };

> +                       };

> +               };


Missing fifth entry.

> +       };

> +

>         timer {

>                 compatible = "arm,armv8-timer";

>                 interrupts-extended = <&gic GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(1) | IRQ_TYPE_LEVEL_LOW)>,


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
Geert Uytterhoeven Jan. 5, 2021, 10:29 a.m. UTC | #2
Hi Niklas,

On Thu, Nov 26, 2020 at 11:30 PM Niklas Söderlund
<niklas.soderlund+renesas@ragnatech.se> wrote:
> Add support for R-Car V3U. The new THCODE values are taken from the
> example in the datasheet.
>
> Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>

Thanks for your patch!

> --- a/drivers/thermal/rcar_gen3_thermal.c
> +++ b/drivers/thermal/rcar_gen3_thermal.c
> @@ -60,13 +60,14 @@
>  #define MCELSIUS(temp) ((temp) * 1000)
>  #define GEN3_FUSE_MASK 0xFFF
>
> -#define TSC_MAX_NUM    3
> +#define TSC_MAX_NUM    4

As pointed out by Shimoda-san in response to the DT binding update,
R-Car V3U has 5 sensors.

>
>  /* default THCODE values if FUSEs are missing */
>  static const int thcodes[TSC_MAX_NUM][3] = {
>         { 3397, 2800, 2221 },
>         { 3393, 2795, 2216 },
>         { 3389, 2805, 2237 },
> +       { 3415, 2694, 2195 },

No idea what the missing fifth entry should be...

Gr{oetje,eeting}s,

                        Geert