diff mbox

thermal: exynos: Handle the misplaced TRIMINFO register

Message ID 1375336979-14747-1-git-send-email-ch.naveen@samsung.com (mailing list archive)
State Changes Requested
Delegated to: Zhang Rui
Headers show

Commit Message

Naveen Krishna Chatradhi Aug. 1, 2013, 6:02 a.m. UTC
This patch adds code to handle the misplaced TRIMINFO register
incase of Exynos5420.

On Exynos5420 we have a TRIMINFO register being misplaced for
TMU channels 2, 3 and 4

TRIMINFO at 0x1006c000 contains data for TMU channel 3
TRIMINFO at 0x100a0000 contains data for TMU channel 4
TRIMINFO at 0x10068000 contains data for TMU channel 2

The misplaced register address is passed through devicetree and
map it seperately during probe.
Also, adds the documentation under devicetree/bindings/thermal/

Signed-off-by: Naveen Krishna Chatradhi <ch.naveen@samsung.com>
Reviewed-by: Doug Anderson <dianders@chromium.org>
---

Rebased on http://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
master branch. I'm not sure which one is the right tree to rebase.

 .../devicetree/bindings/thermal/exynos-thermal.txt | 48 ++++++++++++++++++++++
 drivers/thermal/exynos_thermal.c                   | 26 +++++++++++-
 2 files changed, 72 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/thermal/exynos-thermal.txt

Comments

Amit Kachhap Aug. 1, 2013, 8:32 a.m. UTC | #1
Hi Naveen,

Can you rebase these patches against
https://git.kernel.org/cgit/linux/kernel/git/evalenti/linux-soc-thermal.git/log/?h=next.
All these patches have been queued for 3.12 merge and contains the new
re-structured TMU driver.

Thanks,
Amit Daniel

On Thu, Aug 1, 2013 at 11:32 AM, Naveen Krishna Chatradhi
<ch.naveen@samsung.com> wrote:
> This patch adds code to handle the misplaced TRIMINFO register
> incase of Exynos5420.
>
> On Exynos5420 we have a TRIMINFO register being misplaced for
> TMU channels 2, 3 and 4
>
> TRIMINFO at 0x1006c000 contains data for TMU channel 3
> TRIMINFO at 0x100a0000 contains data for TMU channel 4
> TRIMINFO at 0x10068000 contains data for TMU channel 2
>
> The misplaced register address is passed through devicetree and
> map it seperately during probe.
> Also, adds the documentation under devicetree/bindings/thermal/
>
> Signed-off-by: Naveen Krishna Chatradhi <ch.naveen@samsung.com>
> Reviewed-by: Doug Anderson <dianders@chromium.org>
> ---
>
> Rebased on http://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> master branch. I'm not sure which one is the right tree to rebase.
>
>  .../devicetree/bindings/thermal/exynos-thermal.txt | 48 ++++++++++++++++++++++
>  drivers/thermal/exynos_thermal.c                   | 26 +++++++++++-
>  2 files changed, 72 insertions(+), 2 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/thermal/exynos-thermal.txt
>
> diff --git a/Documentation/devicetree/bindings/thermal/exynos-thermal.txt b/Documentation/devicetree/bindings/thermal/exynos-thermal.txt
> new file mode 100644
> index 0000000..1db279e
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/thermal/exynos-thermal.txt
> @@ -0,0 +1,48 @@
> +* Exynos Thermal
> +
> +Required properties:
> +- compatible: should be one of the following.
> +    * "samsung,exynos4210-tmu" - for controllers compatible with exynos4210 tmu.
> +    * "samsung,exynos5250-tmu" - for controllers compatible with exynos5250 tmu.
> +    * "samsung,exynos5420-tmu" - for controllers compatible with exynos5420 tmu.
> +
> +- reg: physical base address of the controller and length of
> +  memory mapped region.
> +
> +    ** NOTE FOR EXYNOS5420 **
> +    TRIMINFO register is being misplaced for TMU channels 2, 3 and 4
> +
> +    TERMINFO for TMU channel 2 is present in address space of TMU channel 3
> +    TERMINFO for TMU channel 3 is present in address space of TMU channel 4
> +    TERMINFO for TMU channel 4 is present in address space of TMU channel 2
> +
> +    * In such cases the reg property contains the misplaced register address and
> +      range as the second parameter.
> +
> +- interrupts : interrupt number to the cpu.
> +- clocks : Clock number as per common clock framework for the cpu.
> +- clock-names : clock name to be used in the driver
> +
> +Example:
> +
> +       /* tmu for CPU0 */
> +       tmu@10060000 {
> +               compatible = "samsung,exynos5420-tmu";
> +               reg = <0x10060000 0x100>;
> +               interrupts = <0 65 0>;
> +               clocks = <&clock 318>;
> +               clock-names = "tmu_apbif";
> +       };
> +
> +Example: In case of Exynos5420 TMU channel 3
> +
> +       /* tmu for CPU3 */
> +       tmu@1006c000 {
> +               compatible = "samsung,exynos5420-tmu";
> +               /* 2nd reg is for the misplaced TRIMINFO register */
> +               reg = <0x1006c000 0x100>, <0x100a0000 0x4>;
> +               interrupts = <0 185 0>;
> +               clocks = <&clock 318>;
> +               clock-names = "tmu_apbif";
> +       };
> +
> diff --git a/drivers/thermal/exynos_thermal.c b/drivers/thermal/exynos_thermal.c
> index cec3f1f..a229314 100644
> --- a/drivers/thermal/exynos_thermal.c
> +++ b/drivers/thermal/exynos_thermal.c
> @@ -38,6 +38,7 @@
>  #include <linux/cpufreq.h>
>  #include <linux/cpu_cooling.h>
>  #include <linux/of.h>
> +#include <linux/of_address.h>
>
>  #include <plat/cpu.h>
>  #include <mach/regs-pmu.h>     /* for EXYNOS5_PS_HOLD_CONTROL */
> @@ -123,7 +124,7 @@ struct exynos_thermal_zone;
>  struct exynos_tmu_data {
>         struct exynos_tmu_platform_data *pdata;
>         struct resource *mem;
> -       void __iomem *base;
> +       void __iomem *base, *triminfo_base;
>         int irq;
>         enum soc_type soc;
>         struct work_struct irq_work;
> @@ -665,8 +666,14 @@ static int exynos_tmu_initialize(struct platform_device *pdev)
>                 __raw_writel(EXYNOS_TRIMINFO_RELOAD,
>                                 data->base + EXYNOS_TMU_TRIMINFO_CON);
>         }
> +
>         /* Save trimming info in order to perform calibration */
> -       trim_info = readl(data->base + EXYNOS_TMU_REG_TRIMINFO);
> +       if (data->triminfo_base)
> +               /* On exynos5420 TRIMINFO is misplaced for some channels */
> +               trim_info = readl(data->triminfo_base);
> +       else
> +               trim_info = readl(data->base + EXYNOS_TMU_REG_TRIMINFO);
> +
>         data->temp_error1 = trim_info & EXYNOS_TMU_TRIM_TEMP_MASK;
>         data->temp_error2 = ((trim_info >> 8) & EXYNOS_TMU_TRIM_TEMP_MASK);
>
> @@ -1016,6 +1023,15 @@ static int exynos_tmu_probe(struct platform_device *pdev)
>                 return -ENODEV;
>         }
>
> +       /* For Exynos5420 The misplaced TERMINFO register address will be
> +        * passed from device tree node.
> +        *
> +        * We cannot use devm_request_and_ioremap, as the base address
> +        * over laps with the address space of the other TMU channel.
> +        * Check Documentation for details
> +        */
> +       data->triminfo_base = of_iomap(pdev->dev.of_node, 1);
> +
>         data->clk = devm_clk_get(&pdev->dev, "tmu_apbif");
>         if (IS_ERR(data->clk)) {
>                 dev_err(&pdev->dev, "Failed to get clock\n");
> @@ -1086,6 +1102,9 @@ static int exynos_tmu_probe(struct platform_device *pdev)
>  err_irq:
>         exynos_unregister_thermal(data);
>  err_clk:
> +       if (data->triminfo_base)
> +               iounmap(data->triminfo_base);
> +
>         platform_set_drvdata(pdev, NULL);
>         clk_unprepare(data->clk);
>         return ret;
> @@ -1100,6 +1119,9 @@ static int exynos_tmu_remove(struct platform_device *pdev)
>
>         exynos_unregister_thermal(data);
>
> +       if (data->triminfo_base)
> +               iounmap(data->triminfo_base);
> +
>         clk_unprepare(data->clk);
>
>         platform_set_drvdata(pdev, NULL);
> --
> 1.7.12.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Naveen Krishna Ch Aug. 1, 2013, 8:48 a.m. UTC | #2
On 1 August 2013 14:02, amit daniel kachhap <amit.daniel@samsung.com> wrote:
> Hi Naveen,
>
> Can you rebase these patches against
> https://git.kernel.org/cgit/linux/kernel/git/evalenti/linux-soc-thermal.git/log/?h=next.
> All these patches have been queued for 3.12 merge and contains the new
> re-structured TMU driver.
Sure, I will re base and submit.
>
> Thanks,
> Amit Daniel
>
> On Thu, Aug 1, 2013 at 11:32 AM, Naveen Krishna Chatradhi
> <ch.naveen@samsung.com> wrote:
>> This patch adds code to handle the misplaced TRIMINFO register
>> incase of Exynos5420.
>>
>> On Exynos5420 we have a TRIMINFO register being misplaced for
>> TMU channels 2, 3 and 4
>>
>> TRIMINFO at 0x1006c000 contains data for TMU channel 3
>> TRIMINFO at 0x100a0000 contains data for TMU channel 4
>> TRIMINFO at 0x10068000 contains data for TMU channel 2
>>
>> The misplaced register address is passed through devicetree and
>> map it seperately during probe.
>> Also, adds the documentation under devicetree/bindings/thermal/
>>
>> Signed-off-by: Naveen Krishna Chatradhi <ch.naveen@samsung.com>
>> Reviewed-by: Doug Anderson <dianders@chromium.org>
>> ---
>>
>> Rebased on http://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
>> master branch. I'm not sure which one is the right tree to rebase.
>>
>>  .../devicetree/bindings/thermal/exynos-thermal.txt | 48 ++++++++++++++++++++++
>>  drivers/thermal/exynos_thermal.c                   | 26 +++++++++++-
>>  2 files changed, 72 insertions(+), 2 deletions(-)
>>  create mode 100644 Documentation/devicetree/bindings/thermal/exynos-thermal.txt
>>
>> diff --git a/Documentation/devicetree/bindings/thermal/exynos-thermal.txt b/Documentation/devicetree/bindings/thermal/exynos-thermal.txt
>> new file mode 100644
>> index 0000000..1db279e
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/thermal/exynos-thermal.txt
>> @@ -0,0 +1,48 @@
>> +* Exynos Thermal
>> +
>> +Required properties:
>> +- compatible: should be one of the following.
>> +    * "samsung,exynos4210-tmu" - for controllers compatible with exynos4210 tmu.
>> +    * "samsung,exynos5250-tmu" - for controllers compatible with exynos5250 tmu.
>> +    * "samsung,exynos5420-tmu" - for controllers compatible with exynos5420 tmu.
>> +
>> +- reg: physical base address of the controller and length of
>> +  memory mapped region.
>> +
>> +    ** NOTE FOR EXYNOS5420 **
>> +    TRIMINFO register is being misplaced for TMU channels 2, 3 and 4
>> +
>> +    TERMINFO for TMU channel 2 is present in address space of TMU channel 3
>> +    TERMINFO for TMU channel 3 is present in address space of TMU channel 4
>> +    TERMINFO for TMU channel 4 is present in address space of TMU channel 2
>> +
>> +    * In such cases the reg property contains the misplaced register address and
>> +      range as the second parameter.
>> +
>> +- interrupts : interrupt number to the cpu.
>> +- clocks : Clock number as per common clock framework for the cpu.
>> +- clock-names : clock name to be used in the driver
>> +
>> +Example:
>> +
>> +       /* tmu for CPU0 */
>> +       tmu@10060000 {
>> +               compatible = "samsung,exynos5420-tmu";
>> +               reg = <0x10060000 0x100>;
>> +               interrupts = <0 65 0>;
>> +               clocks = <&clock 318>;
>> +               clock-names = "tmu_apbif";
>> +       };
>> +
>> +Example: In case of Exynos5420 TMU channel 3
>> +
>> +       /* tmu for CPU3 */
>> +       tmu@1006c000 {
>> +               compatible = "samsung,exynos5420-tmu";
>> +               /* 2nd reg is for the misplaced TRIMINFO register */
>> +               reg = <0x1006c000 0x100>, <0x100a0000 0x4>;
>> +               interrupts = <0 185 0>;
>> +               clocks = <&clock 318>;
>> +               clock-names = "tmu_apbif";
>> +       };
>> +
>> diff --git a/drivers/thermal/exynos_thermal.c b/drivers/thermal/exynos_thermal.c
>> index cec3f1f..a229314 100644
>> --- a/drivers/thermal/exynos_thermal.c
>> +++ b/drivers/thermal/exynos_thermal.c
>> @@ -38,6 +38,7 @@
>>  #include <linux/cpufreq.h>
>>  #include <linux/cpu_cooling.h>
>>  #include <linux/of.h>
>> +#include <linux/of_address.h>
>>
>>  #include <plat/cpu.h>
>>  #include <mach/regs-pmu.h>     /* for EXYNOS5_PS_HOLD_CONTROL */
>> @@ -123,7 +124,7 @@ struct exynos_thermal_zone;
>>  struct exynos_tmu_data {
>>         struct exynos_tmu_platform_data *pdata;
>>         struct resource *mem;
>> -       void __iomem *base;
>> +       void __iomem *base, *triminfo_base;
>>         int irq;
>>         enum soc_type soc;
>>         struct work_struct irq_work;
>> @@ -665,8 +666,14 @@ static int exynos_tmu_initialize(struct platform_device *pdev)
>>                 __raw_writel(EXYNOS_TRIMINFO_RELOAD,
>>                                 data->base + EXYNOS_TMU_TRIMINFO_CON);
>>         }
>> +
>>         /* Save trimming info in order to perform calibration */
>> -       trim_info = readl(data->base + EXYNOS_TMU_REG_TRIMINFO);
>> +       if (data->triminfo_base)
>> +               /* On exynos5420 TRIMINFO is misplaced for some channels */
>> +               trim_info = readl(data->triminfo_base);
>> +       else
>> +               trim_info = readl(data->base + EXYNOS_TMU_REG_TRIMINFO);
>> +
>>         data->temp_error1 = trim_info & EXYNOS_TMU_TRIM_TEMP_MASK;
>>         data->temp_error2 = ((trim_info >> 8) & EXYNOS_TMU_TRIM_TEMP_MASK);
>>
>> @@ -1016,6 +1023,15 @@ static int exynos_tmu_probe(struct platform_device *pdev)
>>                 return -ENODEV;
>>         }
>>
>> +       /* For Exynos5420 The misplaced TERMINFO register address will be
>> +        * passed from device tree node.
>> +        *
>> +        * We cannot use devm_request_and_ioremap, as the base address
>> +        * over laps with the address space of the other TMU channel.
>> +        * Check Documentation for details
>> +        */
>> +       data->triminfo_base = of_iomap(pdev->dev.of_node, 1);
>> +
>>         data->clk = devm_clk_get(&pdev->dev, "tmu_apbif");
>>         if (IS_ERR(data->clk)) {
>>                 dev_err(&pdev->dev, "Failed to get clock\n");
>> @@ -1086,6 +1102,9 @@ static int exynos_tmu_probe(struct platform_device *pdev)
>>  err_irq:
>>         exynos_unregister_thermal(data);
>>  err_clk:
>> +       if (data->triminfo_base)
>> +               iounmap(data->triminfo_base);
>> +
>>         platform_set_drvdata(pdev, NULL);
>>         clk_unprepare(data->clk);
>>         return ret;
>> @@ -1100,6 +1119,9 @@ static int exynos_tmu_remove(struct platform_device *pdev)
>>
>>         exynos_unregister_thermal(data);
>>
>> +       if (data->triminfo_base)
>> +               iounmap(data->triminfo_base);
>> +
>>         clk_unprepare(data->clk);
>>
>>         platform_set_drvdata(pdev, NULL);
>> --
>> 1.7.12.4
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
Naveen Krishna Chatradhi Aug. 28, 2013, 5:45 a.m. UTC | #3
The below patchset adds the TMU support for Exynos5420
1. correct the fall interrupt en, status bit fields
  Fixes an existing bug in the register field access
2. Add TMU support for Exynos5420 SoCs
  Adds support for Exynos5420. (These changes were tested on a different
  kernel version)
3. Handle the misplaced TRIMINFO register
  Discussion was going on at https://lkml.org/lkml/2013/8/7/59
  Handles the misplaced register on Exynos5420 Only

Naveen Krishna Chatradhi (3):
  thermal: samsung: correct the fall interrupt en, status bit fields
  thermal: samsung: Add TMU support for Exynos5420 SoCs
  thermal: exynos: Handle the misplaced TRIMINFO register

 .../devicetree/bindings/thermal/exynos-thermal.txt |   21 +++++
 drivers/thermal/samsung/exynos_tmu.c               |   38 ++++++--
 drivers/thermal/samsung/exynos_tmu.h               |    3 +
 drivers/thermal/samsung/exynos_tmu_data.c          |   92 ++++++++++++++++++++
 drivers/thermal/samsung/exynos_tmu_data.h          |   10 ++-
 5 files changed, 158 insertions(+), 6 deletions(-)
Naveen Krishna Chatradhi Nov. 12, 2013, 6:35 a.m. UTC | #4
This patchset does a little clean up of the existing code
1.  [v9] thermal: samsung: replace inten_ bit fields with intclr_
2.  [v9] thermal: samsung: change base_common to more meaningful base_second

adds support for Exynos5420 in the driver and
3.  [v9] thermal: samsung: Add TMU support for Exynos5420 SoCs
also adds the device tree nodes for the same to exynos5420.dtsi (linux-samsung.git)
4.  [v3] ARM: dts: Exynos5420: Add device nodes for TMU blocks

Naveen Krishna Chatradhi (3):
  thermal: samsung: replace inten_ bit fields with intclr_
  thermal: samsung: change base_common to more meaningful base_second
  thermal: samsung: Add TMU support for Exynos5420 SoCs
  ARM: dts: Exynos5420: Add device nodes for TMU blocks

 .../devicetree/bindings/thermal/exynos-thermal.txt |   49 +++++++-
 drivers/thermal/samsung/exynos_tmu.c               |   78 +++++++++---
 drivers/thermal/samsung/exynos_tmu.h               |   22 ++--
 drivers/thermal/samsung/exynos_tmu_data.c          |  126 ++++++++++++++++++--
 drivers/thermal/samsung/exynos_tmu_data.h          |   12 +-
 5 files changed, 249 insertions(+), 38 deletions(-)
Naveen Krishna Ch Nov. 18, 2013, 3:25 a.m. UTC | #5
Hello All,

On 12 November 2013 12:05, Naveen Krishna Chatradhi
<ch.naveen@samsung.com> wrote:
> This patchset does a little clean up of the existing code
> 1.  [v9] thermal: samsung: replace inten_ bit fields with intclr_
> 2.  [v9] thermal: samsung: change base_common to more meaningful base_second
>
> adds support for Exynos5420 in the driver and
> 3.  [v9] thermal: samsung: Add TMU support for Exynos5420 SoCs
> also adds the device tree nodes for the same to exynos5420.dtsi (linux-samsung.git)
> 4.  [v3] ARM: dts: Exynos5420: Add device nodes for TMU blocks
>
> Naveen Krishna Chatradhi (3):
>   thermal: samsung: replace inten_ bit fields with intclr_
>   thermal: samsung: change base_common to more meaningful base_second
>   thermal: samsung: Add TMU support for Exynos5420 SoCs
>   ARM: dts: Exynos5420: Add device nodes for TMU blocks
>
>  .../devicetree/bindings/thermal/exynos-thermal.txt |   49 +++++++-
>  drivers/thermal/samsung/exynos_tmu.c               |   78 +++++++++---
>  drivers/thermal/samsung/exynos_tmu.h               |   22 ++--
>  drivers/thermal/samsung/exynos_tmu_data.c          |  126 ++++++++++++++++++--
>  drivers/thermal/samsung/exynos_tmu_data.h          |   12 +-
>  5 files changed, 249 insertions(+), 38 deletions(-)
>
> --
> 1.7.10.4
Any comments on this patch set please.
>
Naveen Krishna Chatradhi Dec. 10, 2013, 6:40 a.m. UTC | #6
This patchset does a little clean up of the existing code (linux-soc-thermal)
1.  [v11] thermal: samsung: replace inten_ bit fields with intclr_
2.  [v11] thermal: samsung: change base_common to more meaningful base_second

adds support for Exynos5420 in the driver and (linux-soc-thermal)
3.  [v11] thermal: samsung: Add TMU support for Exynos5420 SoCs
also adds the device tree nodes for the same to exynos5420.dtsi (linux-samsung.git)
4.  [v11] ARM: dts: Exynos5420: Add device nodes for TMU blocks

(linux-soc-thermal)
Naveen Krishna Chatradhi (3):
  thermal: samsung: replace inten_ bit fields with intclr_
  thermal: samsung: change base_common to more meaningful base_second
  thermal: samsung: Add TMU support for Exynos5420 SoCs

 .../devicetree/bindings/thermal/exynos-thermal.txt |   42 ++++++-
 drivers/thermal/samsung/exynos_tmu.c               |   72 +++++++++---
 drivers/thermal/samsung/exynos_tmu.h               |   21 ++--
 drivers/thermal/samsung/exynos_tmu_data.c          |  119 ++++++++++++++++++--
 drivers/thermal/samsung/exynos_tmu_data.h          |   12 +-
 5 files changed, 228 insertions(+), 38 deletions(-)

(linux-samsung.git)
Naveen Krishna Chatradhi (1):
  ARM: dts: Exynos5420: Add device nodes for TMU blocks

 arch/arm/boot/dts/exynos5420.dtsi |   40 +++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)
Leela Krishna Amudala March 19, 2014, 11:19 a.m. UTC | #7
Hi All,

I didn't see this series in mainline, Any comments for this ?

Thanks,
Leela Krishna Amudala.


On Tue, Dec 10, 2013 at 12:10 PM, Naveen Krishna Chatradhi
<ch.naveen@samsung.com> wrote:
> This patchset does a little clean up of the existing code (linux-soc-thermal)
> 1.  [v11] thermal: samsung: replace inten_ bit fields with intclr_
> 2.  [v11] thermal: samsung: change base_common to more meaningful base_second
>
> adds support for Exynos5420 in the driver and (linux-soc-thermal)
> 3.  [v11] thermal: samsung: Add TMU support for Exynos5420 SoCs
> also adds the device tree nodes for the same to exynos5420.dtsi (linux-samsung.git)
> 4.  [v11] ARM: dts: Exynos5420: Add device nodes for TMU blocks
>
> (linux-soc-thermal)
> Naveen Krishna Chatradhi (3):
>   thermal: samsung: replace inten_ bit fields with intclr_
>   thermal: samsung: change base_common to more meaningful base_second
>   thermal: samsung: Add TMU support for Exynos5420 SoCs
>
>  .../devicetree/bindings/thermal/exynos-thermal.txt |   42 ++++++-
>  drivers/thermal/samsung/exynos_tmu.c               |   72 +++++++++---
>  drivers/thermal/samsung/exynos_tmu.h               |   21 ++--
>  drivers/thermal/samsung/exynos_tmu_data.c          |  119 ++++++++++++++++++--
>  drivers/thermal/samsung/exynos_tmu_data.h          |   12 +-
>  5 files changed, 228 insertions(+), 38 deletions(-)
>
> (linux-samsung.git)
> Naveen Krishna Chatradhi (1):
>   ARM: dts: Exynos5420: Add device nodes for TMU blocks
>
>  arch/arm/boot/dts/exynos5420.dtsi |   40 +++++++++++++++++++++++++++++++++++++
>  1 file changed, 40 insertions(+)
> --
> 1.7.10.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Tomasz Figa March 19, 2014, 3:58 p.m. UTC | #8
Hi Leela,

On 19.03.2014 12:19, Leela Krishna Amudala wrote:
> Hi All,
>
> I didn't see this series in mainline, Any comments for this ?

Naveen had posted v12 of this series and I believe all the patches got 
my Reviewed-by.

Best regards,
Tomasz
--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Naveen Krishna Ch March 20, 2014, 2:45 a.m. UTC | #9
Hello Tomasz,

On 20 March 2014 00:58, Tomasz Figa <t.figa@samsung.com> wrote:
> Hi Leela,
>
>
> On 19.03.2014 12:19, Leela Krishna Amudala wrote:
>>
>> Hi All,
>>
>> I didn't see this series in mainline, Any comments for this ?
>
>
> Naveen had posted v12 of this series and I believe all the patches got my
> Reviewed-by.
>
> Best regards,
> Tomasz
Thanks for your reply.
These patches are posted to the mailing list quite some time now.
Anything i can do to speed up the process.
Javi Merino April 8, 2014, 9:33 a.m. UTC | #10
On Thu, Mar 20, 2014 at 02:45:54AM +0000, Naveen Krishna Ch wrote:
> Hello Tomasz,
> 
> On 20 March 2014 00:58, Tomasz Figa <t.figa@samsung.com> wrote:
> > Hi Leela,
> >
> >
> > On 19.03.2014 12:19, Leela Krishna Amudala wrote:
> >>
> >> Hi All,
> >>
> >> I didn't see this series in mainline, Any comments for this ?
> >
> >
> > Naveen had posted v12 of this series and I believe all the patches got my
> > Reviewed-by.
> >
> > Best regards,
> > Tomasz
> Thanks for your reply.
> These patches are posted to the mailing list quite some time now.
> Anything i can do to speed up the process.

These patches create 5 thermal zones, one for each sensor.  Due to the
way the exynos code in drivers/thermal/samsung/exynos_thermal_common.c
registers thermal zones, each one gets a cpufreq_cooling_device.
Therefore you end up with 5 thermal zone each of which is controlling
the cpu frequency.

Wouldn't it be better to collate these 5 sensors to create one thermal
zone for the whole SoC?  Maybe a simplistic algorithm like reporting
the maximum temperature of all the sensors as the thermal zone
temperature is good enough.

Cheers,
Javi

--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/Documentation/devicetree/bindings/thermal/exynos-thermal.txt b/Documentation/devicetree/bindings/thermal/exynos-thermal.txt
new file mode 100644
index 0000000..1db279e
--- /dev/null
+++ b/Documentation/devicetree/bindings/thermal/exynos-thermal.txt
@@ -0,0 +1,48 @@ 
+* Exynos Thermal
+
+Required properties:
+- compatible: should be one of the following.
+    * "samsung,exynos4210-tmu" - for controllers compatible with exynos4210 tmu.
+    * "samsung,exynos5250-tmu" - for controllers compatible with exynos5250 tmu.
+    * "samsung,exynos5420-tmu" - for controllers compatible with exynos5420 tmu.
+
+- reg: physical base address of the controller and length of
+  memory mapped region.
+
+    ** NOTE FOR EXYNOS5420 **
+    TRIMINFO register is being misplaced for TMU channels 2, 3 and 4
+
+    TERMINFO for TMU channel 2 is present in address space of TMU channel 3
+    TERMINFO for TMU channel 3 is present in address space of TMU channel 4
+    TERMINFO for TMU channel 4 is present in address space of TMU channel 2
+
+    * In such cases the reg property contains the misplaced register address and
+      range as the second parameter.
+
+- interrupts : interrupt number to the cpu.
+- clocks : Clock number as per common clock framework for the cpu.
+- clock-names : clock name to be used in the driver
+
+Example:
+
+	/* tmu for CPU0 */
+	tmu@10060000 {
+		compatible = "samsung,exynos5420-tmu";
+		reg = <0x10060000 0x100>;
+		interrupts = <0 65 0>;
+		clocks = <&clock 318>;
+		clock-names = "tmu_apbif";
+	};
+
+Example: In case of Exynos5420 TMU channel 3
+
+	/* tmu for CPU3 */
+	tmu@1006c000 {
+		compatible = "samsung,exynos5420-tmu";
+		/* 2nd reg is for the misplaced TRIMINFO register */
+		reg = <0x1006c000 0x100>, <0x100a0000 0x4>;
+		interrupts = <0 185 0>;
+		clocks = <&clock 318>;
+		clock-names = "tmu_apbif";
+	};
+
diff --git a/drivers/thermal/exynos_thermal.c b/drivers/thermal/exynos_thermal.c
index cec3f1f..a229314 100644
--- a/drivers/thermal/exynos_thermal.c
+++ b/drivers/thermal/exynos_thermal.c
@@ -38,6 +38,7 @@ 
 #include <linux/cpufreq.h>
 #include <linux/cpu_cooling.h>
 #include <linux/of.h>
+#include <linux/of_address.h>
 
 #include <plat/cpu.h>
 #include <mach/regs-pmu.h>	/* for EXYNOS5_PS_HOLD_CONTROL */
@@ -123,7 +124,7 @@  struct exynos_thermal_zone;
 struct exynos_tmu_data {
 	struct exynos_tmu_platform_data *pdata;
 	struct resource *mem;
-	void __iomem *base;
+	void __iomem *base, *triminfo_base;
 	int irq;
 	enum soc_type soc;
 	struct work_struct irq_work;
@@ -665,8 +666,14 @@  static int exynos_tmu_initialize(struct platform_device *pdev)
 		__raw_writel(EXYNOS_TRIMINFO_RELOAD,
 				data->base + EXYNOS_TMU_TRIMINFO_CON);
 	}
+
 	/* Save trimming info in order to perform calibration */
-	trim_info = readl(data->base + EXYNOS_TMU_REG_TRIMINFO);
+	if (data->triminfo_base)
+		/* On exynos5420 TRIMINFO is misplaced for some channels */
+		trim_info = readl(data->triminfo_base);
+	else
+		trim_info = readl(data->base + EXYNOS_TMU_REG_TRIMINFO);
+
 	data->temp_error1 = trim_info & EXYNOS_TMU_TRIM_TEMP_MASK;
 	data->temp_error2 = ((trim_info >> 8) & EXYNOS_TMU_TRIM_TEMP_MASK);
 
@@ -1016,6 +1023,15 @@  static int exynos_tmu_probe(struct platform_device *pdev)
 		return -ENODEV;
 	}
 
+	/* For Exynos5420 The misplaced TERMINFO register address will be
+	 * passed from device tree node.
+	 *
+	 * We cannot use devm_request_and_ioremap, as the base address
+	 * over laps with the address space of the other TMU channel.
+	 * Check Documentation for details
+	 */
+	data->triminfo_base = of_iomap(pdev->dev.of_node, 1);
+
 	data->clk = devm_clk_get(&pdev->dev, "tmu_apbif");
 	if (IS_ERR(data->clk)) {
 		dev_err(&pdev->dev, "Failed to get clock\n");
@@ -1086,6 +1102,9 @@  static int exynos_tmu_probe(struct platform_device *pdev)
 err_irq:
 	exynos_unregister_thermal(data);
 err_clk:
+	if (data->triminfo_base)
+		iounmap(data->triminfo_base);
+
 	platform_set_drvdata(pdev, NULL);
 	clk_unprepare(data->clk);
 	return ret;
@@ -1100,6 +1119,9 @@  static int exynos_tmu_remove(struct platform_device *pdev)
 
 	exynos_unregister_thermal(data);
 
+	if (data->triminfo_base)
+		iounmap(data->triminfo_base);
+
 	clk_unprepare(data->clk);
 
 	platform_set_drvdata(pdev, NULL);