Commit d9b6ee148dadd85433803f25cc62024ffcb4a0b8

Authored by Amit Daniel Kachhap
Committed by Eduardo Valentin
1 parent c55930e33e

thermal: exynos: Add support to access common register for multistance

This patch adds support to parse one more common set of TMU register. First
set of register belongs to each instance of TMU and second set belongs to
common TMU registers.

Acked-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
Acked-by: Kukjin Kim <kgene.kim@samsung.com>
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Amit Daniel Kachhap <amit.daniel@samsung.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>

Showing 1 changed file with 20 additions and 0 deletions Side-by-side Diff

drivers/thermal/samsung/exynos_tmu.c
... ... @@ -40,6 +40,7 @@
40 40 * @id: identifier of the one instance of the TMU controller.
41 41 * @pdata: pointer to the tmu platform/configuration data
42 42 * @base: base address of the single instance of the TMU controller.
  43 + * @base_common: base address of the common registers of the TMU controller.
43 44 * @irq: irq number of the TMU controller.
44 45 * @soc: id of the SOC type.
45 46 * @irq_work: pointer to the irq work structure.
... ... @@ -53,6 +54,7 @@
53 54 int id;
54 55 struct exynos_tmu_platform_data *pdata;
55 56 void __iomem *base;
  57 + void __iomem *base_common;
56 58 int irq;
57 59 enum soc_type soc;
58 60 struct work_struct irq_work;
... ... @@ -478,6 +480,24 @@
478 480 return -ENODEV;
479 481 }
480 482 data->pdata = pdata;
  483 + /*
  484 + * Check if the TMU shares some registers and then try to map the
  485 + * memory of common registers.
  486 + */
  487 + if (!TMU_SUPPORTS(pdata, SHARED_MEMORY))
  488 + return 0;
  489 +
  490 + if (of_address_to_resource(pdev->dev.of_node, 1, &res)) {
  491 + dev_err(&pdev->dev, "failed to get Resource 1\n");
  492 + return -ENODEV;
  493 + }
  494 +
  495 + data->base_common = devm_ioremap(&pdev->dev, res.start,
  496 + resource_size(&res));
  497 + if (!data->base) {
  498 + dev_err(&pdev->dev, "Failed to ioremap memory\n");
  499 + return -ENOMEM;
  500 + }
481 501  
482 502 return 0;
483 503 }