From: Naveen Krishna Ch <naveenkrishna.ch@gmail.com>
To: amit daniel kachhap <amit.daniel@samsung.com>
Cc: Naveen Krishna Chatradhi <ch.naveen@samsung.com>,
"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
Zhang Rui <rui.zhang@intel.com>,
"Valentin, Eduardo" <eduardo.valentin@ti.com>,
"linux-samsung-soc@vger.kernel.org"
<linux-samsung-soc@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Kukjin Kim <kgene.kim@samsung.com>,
devicetree@vger.kernel.org
Subject: Re: [PATCH 3/3] thermal: exynos: Handle the misplaced TRIMINFO register
Date: Wed, 28 Aug 2013 11:49:54 +0530 [thread overview]
Message-ID: <CAHfPSqBubNwj7ASY8dfU3q2-O1xhr+6xXC+TcRbRiPhVVRsJ7Q@mail.gmail.com> (raw)
In-Reply-To: <CADGdYn5fykqperPUJtGbh-E9sECFP4J8xSyjB3YA4_KzO3ZwNA@mail.gmail.com>
On 28 August 2013 11:33, amit daniel kachhap <amit.daniel@samsung.com> wrote:
> Hi Naveen
>
> On Wed, Aug 28, 2013 at 11:15 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>
>> ---
>> .../devicetree/bindings/thermal/exynos-thermal.txt | 21 +++++++++++++
>> drivers/thermal/samsung/exynos_tmu.c | 32 +++++++++++++++++---
>> 2 files changed, 49 insertions(+), 4 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/thermal/exynos-thermal.txt b/Documentation/devicetree/bindings/thermal/exynos-thermal.txt
>> index 284f530..e818473 100644
>> --- a/Documentation/devicetree/bindings/thermal/exynos-thermal.txt
>> +++ b/Documentation/devicetree/bindings/thermal/exynos-thermal.txt
>> @@ -7,12 +7,21 @@
>> "samsung,exynos4210-tmu"
>> "samsung,exynos5250-tmu"
>> "samsung,exynos5440-tmu"
>> + "samsung,exynos5420-tmu"
>> - interrupt-parent : The phandle for the interrupt controller
>> - reg : Address range of the thermal registers. For soc's which has multiple
>> instances of TMU and some registers are shared across all TMU's like
>> interrupt related then 2 set of register has to supplied. First set
>> belongs to each instance of TMU and second set belongs to common TMU
>> registers.
>> +
>> + ** 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
>> +
>> - interrupts : Should contain interrupt for thermal system
>> - clocks : The main clock for TMU device
>> - clock-names : Thermal system clock name
>> @@ -43,6 +52,18 @@ Example 2):
>> clock-names = "tmu_apbif";
>> };
>>
>> +Example 3): 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";
>> + };
>> +
>> Note: For multi-instance tmu each instance should have an alias correctly
>> numbered in "aliases" node.
>>
>> diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
>> index bfdfbd6..f95844e 100644
>> --- a/drivers/thermal/samsung/exynos_tmu.c
>> +++ b/drivers/thermal/samsung/exynos_tmu.c
>> @@ -42,6 +42,7 @@
>> * @pdata: pointer to the tmu platform/configuration data
>> * @base: base address of the single instance of the TMU controller.
>> * @base_common: base address of the common registers of the TMU controller.
>> + * @triminfo_base: misplaced register base for TRIMINFO on Exynos5420 only
>
> Instead of creating this new field you can re-use base_common for
> accessing the second set of register for misplaced triminfo address.
> Also you can rename this variable as base_second.
The purpose and the meaning of the fields are entirely different.
The triminfo is a hardware bug present only in Exynos5420
and the common registers are available only on Exynos5440 i guess.
IMHO, reusing is not a nice idea.
I'm willing to modify the code if there is a better idea.
>
>> * @irq: irq number of the TMU controller.
>> * @soc: id of the SOC type.
>> * @irq_work: pointer to the irq work structure.
>> @@ -57,6 +58,7 @@ struct exynos_tmu_data {
>> struct exynos_tmu_platform_data *pdata;
>> void __iomem *base;
>> void __iomem *base_common;
>> + void __iomem *triminfo_base; /* Needed only Exynos5420 */
>> int irq;
>> enum soc_type soc;
>> struct work_struct irq_work;
>> @@ -186,7 +188,12 @@ static int exynos_tmu_initialize(struct platform_device *pdev)
>> EXYNOS5440_EFUSE_SWAP_OFFSET + reg->triminfo_data);
>> }
>> } else {
>> - trim_info = readl(data->base + reg->triminfo_data);
>> + /* On exynos5420 TRIMINFO is misplaced for some channels */
>> + if (data->triminfo_base)
>> + trim_info = readl(data->triminfo_base +
>> + reg->triminfo_data);
>> + else
>> + trim_info = readl(data->base + reg->triminfo_data);
>> }
>> data->temp_error1 = trim_info & EXYNOS_TMU_TEMP_MASK;
>> data->temp_error2 = ((trim_info >> reg->triminfo_85_shift) &
>> @@ -586,8 +593,17 @@ static int exynos_map_dt_data(struct platform_device *pdev)
>> * Check if the TMU shares some registers and then try to map the
>> * memory of common registers.
>> */
>> - if (!TMU_SUPPORTS(pdata, SHARED_MEMORY))
>> + if (!TMU_SUPPORTS(pdata, SHARED_MEMORY)) {
>> + /* 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);
>> return 0;
>> + }
> In the below code, remove the request resource API for common_base and
> use simple of_iomap API.
That will be a separate fix patch. Will submit separately,
This patchset is to add exynos5420 support
Is the res_size for the common registers fixed ?
>
> Thanks,
> Amit Daniel
>>
>> if (of_address_to_resource(pdev->dev.of_node, 1, &res)) {
>> dev_err(&pdev->dev, "failed to get Resource 1\n");
>> @@ -632,12 +648,13 @@ static int exynos_tmu_probe(struct platform_device *pdev)
>> data->clk = devm_clk_get(&pdev->dev, "tmu_apbif");
>> if (IS_ERR(data->clk)) {
>> dev_err(&pdev->dev, "Failed to get clock\n");
>> - return PTR_ERR(data->clk);
>> + ret = PTR_ERR(data->clk);
>> + goto err_triminfo_base;
>> }
>>
>> ret = clk_prepare(data->clk);
>> if (ret)
>> - return ret;
>> + goto err_triminfo_base;
>>
>> if (pdata->type == SOC_ARCH_EXYNOS ||
>> pdata->type == SOC_ARCH_EXYNOS4210 ||
>> @@ -707,9 +724,13 @@ static int exynos_tmu_probe(struct platform_device *pdev)
>> }
>>
>> return 0;
>> +
>> err_clk:
>> clk_unprepare(data->clk);
>> return ret;
>> +err_triminfo_base:
>> + if (data->triminfo_base)
>> + iounmap(data->triminfo_base);
>> }
>>
>> static int exynos_tmu_remove(struct platform_device *pdev)
>> @@ -720,6 +741,9 @@ static int exynos_tmu_remove(struct platform_device *pdev)
>>
>> exynos_unregister_thermal(data->reg_conf);
>>
>> + if (data->triminfo_base)
>> + iounmap(data->triminfo_base);
>> +
>> clk_unprepare(data->clk);
>>
>> if (!IS_ERR(data->regulator))
>> --
>> 1.7.9.5
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>> Please read the FAQ at http://www.tux.org/lkml/
--
Shine bright,
(: Nav :)
next prev parent reply other threads:[~2013-08-28 6:20 UTC|newest]
Thread overview: 98+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-01 6:02 [PATCH] thermal: exynos: Handle the misplaced TRIMINFO register Naveen Krishna Chatradhi
2013-08-01 8:32 ` amit daniel kachhap
2013-08-01 8:48 ` Naveen Krishna Ch
2013-08-01 10:36 ` [PATCH v2] " Naveen Krishna Chatradhi
2013-08-07 6:36 ` amit daniel kachhap
2013-08-07 6:43 ` Naveen Krishna Ch
2013-08-28 5:45 ` [PATCH 0/3] thermal: samsung: Add TMU for Exynos5420 Naveen Krishna Chatradhi
2013-08-28 5:45 ` [PATCH 1/3] thermal: samsung: correct the fall interrupt en, status bit fields Naveen Krishna Chatradhi
2013-08-28 5:57 ` amit daniel kachhap
2013-09-04 4:23 ` Naveen Krishna Chatradhi
2013-09-04 4:23 ` [PATCH 2/3] thermal: samsung: change base_common to more meaningful base_second Naveen Krishna Chatradhi
2013-09-06 4:38 ` amit daniel kachhap
2013-10-17 3:12 ` [PATCH 2/3 v6] " Naveen Krishna Chatradhi
2013-11-06 13:28 ` [PATCH 2/3 v7] " Naveen Krishna Chatradhi
2013-11-07 5:53 ` [PATCH 2/3 v8] " Naveen Krishna Chatradhi
2013-11-12 6:36 ` [PATCH 2/4 v9] " Naveen Krishna Chatradhi
2013-11-18 3:24 ` Naveen Krishna Ch
2013-11-19 13:04 ` [PATCH 2/4 v10] " Naveen Krishna Chatradhi
2013-11-22 8:56 ` Naveen Krishna Ch
2013-12-09 12:48 ` Tomasz Figa
2013-12-10 6:41 ` [PATCH v11 2/4] " Naveen Krishna Chatradhi
2013-12-18 15:51 ` Tomasz Figa
2013-12-19 6:06 ` [PATCH v12 " Naveen Krishna Chatradhi
2014-02-07 9:35 ` Naveen Krishna Ch
2013-09-04 4:23 ` [PATCH 3/3] thermal: samsung: Add TMU support for Exynos5420 SoCs Naveen Krishna Chatradhi
2013-10-03 12:01 ` Naveen Krishna Ch
2013-10-03 12:42 ` Bartlomiej Zolnierkiewicz
2013-10-09 11:45 ` Naveen Krishna Ch
2013-10-09 12:08 ` [PATCH 1/3 v4] thermal: samsung: correct the fall interrupt en, status bit fields Naveen Krishna Chatradhi
2013-10-09 12:08 ` [PATCH 2/3 v4] thermal: samsung: change base_common to more meaningful base_second Naveen Krishna Chatradhi
2013-10-14 13:47 ` Eduardo Valentin
2013-10-09 12:08 ` [PATCH 3/3 v4] thermal: samsung: Add TMU support for Exynos5420 SoCs Naveen Krishna Chatradhi
2013-10-09 14:03 ` [PATCH 1/3 v4] thermal: samsung: correct the fall interrupt en, status bit fields Bartlomiej Zolnierkiewicz
2013-10-11 15:10 ` Eduardo Valentin
2013-10-11 15:57 ` Bartlomiej Zolnierkiewicz
2013-10-14 14:18 ` Eduardo Valentin
2013-10-14 16:01 ` Bartlomiej Zolnierkiewicz
2013-10-15 11:39 ` Naveen Krishna Ch
2013-10-14 13:56 ` Eduardo Valentin
2013-11-06 13:28 ` [PATCH 3/3 v7] thermal: samsung: Add TMU support for Exynos5420 SoCs Naveen Krishna Chatradhi
2013-11-06 13:44 ` Bartlomiej Zolnierkiewicz
2013-11-07 5:53 ` [PATCH 3/3 v8] " Naveen Krishna Chatradhi
2013-11-07 15:09 ` Tomasz Figa
2013-11-12 6:19 ` Naveen Krishna Ch
2013-11-12 6:37 ` [PATCH 3/4 v9] " Naveen Krishna Chatradhi
2013-11-18 3:22 ` Naveen Krishna Ch
2013-11-18 11:27 ` Mark Rutland
2013-12-09 12:43 ` Tomasz Figa
2013-11-19 13:05 ` [PATCH 3/4 v10] " Naveen Krishna Chatradhi
2013-11-22 8:55 ` Naveen Krishna Ch
2013-12-09 12:46 ` Tomasz Figa
2013-12-10 6:42 ` [PATCH v11 3/4] " Naveen Krishna Chatradhi
2013-12-18 15:50 ` Tomasz Figa
2013-12-19 4:44 ` Naveen Krishna Ch
2013-12-19 6:06 ` [PATCH v12 " Naveen Krishna Chatradhi
2013-12-19 11:34 ` Tomasz Figa
2014-02-07 9:34 ` Naveen Krishna Ch
2013-10-17 3:11 ` [PATCH 1/3 v6] thermal: samsung: add intclr_fall_shift bit in exynos_tmu_register Naveen Krishna Chatradhi
2013-10-17 10:03 ` Bartlomiej Zolnierkiewicz
2013-11-06 13:17 ` Naveen Krishna Ch
2013-11-06 13:36 ` Bartlomiej Zolnierkiewicz
2013-11-06 13:27 ` [PATCH 1/3 v7] " Naveen Krishna Chatradhi
2013-11-07 5:52 ` [PATCH 1/3 v8] thermal: samsung: add intclr_fall_shift bit in exynos_tmu_register struct Naveen Krishna Chatradhi
2013-11-07 10:48 ` Bartlomiej Zolnierkiewicz
2013-11-07 10:58 ` Naveen Krishna Ch
2013-11-07 14:47 ` Tomasz Figa
2013-11-12 6:36 ` [PATCH 1/4 v9] thermal: samsung: replace inten_ bit fields with intclr_ Naveen Krishna Chatradhi
2013-11-18 3:25 ` Naveen Krishna Ch
2013-11-19 13:04 ` [PATCH 1/4 v10] " Naveen Krishna Chatradhi
2013-12-09 12:51 ` Tomasz Figa
2013-12-10 6:41 ` [PATCH v11 1/4] " Naveen Krishna Chatradhi
2013-12-18 15:51 ` Tomasz Figa
2013-12-19 6:05 ` [PATCH v12 " Naveen Krishna Chatradhi
2014-01-02 2:33 ` Zhang Rui
2014-02-07 9:33 ` Naveen Krishna Ch
2014-04-10 12:43 ` Bartlomiej Zolnierkiewicz
2013-08-28 5:45 ` [PATCH 2/3] thermal: samsung: Add TMU support for Exynos5420 SoCs Naveen Krishna Chatradhi
2013-08-28 5:58 ` amit daniel kachhap
2013-08-28 9:28 ` amit daniel kachhap
2013-10-17 3:12 ` [PATCH 3/3 v6] " Naveen Krishna Chatradhi
2013-08-28 5:45 ` [PATCH 3/3] thermal: exynos: Handle the misplaced TRIMINFO register Naveen Krishna Chatradhi
2013-08-28 6:03 ` amit daniel kachhap
2013-08-28 6:19 ` Naveen Krishna Ch [this message]
2013-08-28 8:43 ` amit daniel kachhap
2013-08-28 8:57 ` Naveen Krishna Ch
2013-08-28 9:04 ` amit daniel kachhap
2013-08-28 10:06 ` Bartlomiej Zolnierkiewicz
2013-11-12 6:35 ` [PATCH 0/3] thermal: samsung: Clean up and add support for Exynos5420 Naveen Krishna Chatradhi
2013-11-18 3:25 ` Naveen Krishna Ch
2013-12-10 6:40 ` [PATCH v11 0/4] " Naveen Krishna Chatradhi
2014-03-19 11:19 ` Leela Krishna Amudala
2014-03-19 15:58 ` Tomasz Figa
2014-03-20 2:45 ` Naveen Krishna Ch
2014-04-08 9:33 ` Javi Merino
2013-08-28 9:16 ` [PATCH 1/3 v2] thermal: samsung: correct the fall interrupt en, status bit fields Naveen Krishna Chatradhi
2013-08-28 9:16 ` [PATCH 2/3] thermal: samsung: change base_common to more meaningful base_second Naveen Krishna Chatradhi
2013-08-28 9:16 ` [PATCH v2: 3/3] thermal: samsung: Add TMU support for Exynos5420 SoCs Naveen Krishna Chatradhi
2013-08-28 10:38 ` Bartlomiej Zolnierkiewicz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAHfPSqBubNwj7ASY8dfU3q2-O1xhr+6xXC+TcRbRiPhVVRsJ7Q@mail.gmail.com \
--to=naveenkrishna.ch@gmail.com \
--cc=amit.daniel@samsung.com \
--cc=ch.naveen@samsung.com \
--cc=devicetree@vger.kernel.org \
--cc=eduardo.valentin@ti.com \
--cc=kgene.kim@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=rui.zhang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).