Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fce9e5b

Browse files
pankajkdubeykgene
authored andcommitted
ARM: EXYNOS: Add support for mapping PMU base address via DT
Add support for mapping Samsung Power Management Unit (PMU) base address from device tree. Signed-off-by: Pankaj Dubey <[email protected]> Reviewed-by: Tomasz Figa <[email protected]> Signed-off-by: Kukjin Kim <[email protected]>
1 parent 632b98a commit fce9e5b

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

arch/arm/mach-exynos/common.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ IS_SAMSUNG_CPU(exynos5800, EXYNOS5800_SOC_ID, EXYNOS5_SOC_MASK)
113113

114114
extern void __iomem *sysram_ns_base_addr;
115115
extern void __iomem *sysram_base_addr;
116+
extern void __iomem *pmu_base_addr;
116117
void exynos_sysram_init(void);
117118

118119
void exynos_firmware_init(void);

arch/arm/mach-exynos/exynos.c

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <linux/of_platform.h>
2020
#include <linux/platform_device.h>
2121
#include <linux/pm_domain.h>
22+
#include <linux/irqchip.h>
2223

2324
#include <asm/cacheflush.h>
2425
#include <asm/hardware/cache-l2x0.h>
@@ -31,6 +32,8 @@
3132
#include "regs-pmu.h"
3233
#include "regs-sys.h"
3334

35+
void __iomem *pmu_base_addr;
36+
3437
static struct map_desc exynos4_iodesc[] __initdata = {
3538
{
3639
.virtual = (unsigned long)S3C_VA_SYS,
@@ -264,6 +267,39 @@ static void __init exynos_init_io(void)
264267
exynos_map_io();
265268
}
266269

270+
static const struct of_device_id exynos_dt_pmu_match[] = {
271+
{ .compatible = "samsung,exynos3250-pmu" },
272+
{ .compatible = "samsung,exynos4210-pmu" },
273+
{ .compatible = "samsung,exynos4212-pmu" },
274+
{ .compatible = "samsung,exynos4412-pmu" },
275+
{ .compatible = "samsung,exynos5250-pmu" },
276+
{ .compatible = "samsung,exynos5420-pmu" },
277+
{ /*sentinel*/ },
278+
};
279+
280+
static void exynos_map_pmu(void)
281+
{
282+
struct device_node *np;
283+
284+
np = of_find_matching_node(NULL, exynos_dt_pmu_match);
285+
if (np)
286+
pmu_base_addr = of_iomap(np, 0);
287+
288+
if (!pmu_base_addr)
289+
panic("failed to find exynos pmu register\n");
290+
}
291+
292+
static void __init exynos_init_irq(void)
293+
{
294+
irqchip_init();
295+
/*
296+
* Since platsmp.c needs pmu base address by the time
297+
* DT is not unflatten so we can't use DT APIs before
298+
* init_irq
299+
*/
300+
exynos_map_pmu();
301+
}
302+
267303
static void __init exynos_dt_machine_init(void)
268304
{
269305
struct device_node *i2c_np;
@@ -344,6 +380,7 @@ DT_MACHINE_START(EXYNOS_DT, "SAMSUNG EXYNOS (Flattened Device Tree)")
344380
.smp = smp_ops(exynos_smp_ops),
345381
.map_io = exynos_init_io,
346382
.init_early = exynos_firmware_init,
383+
.init_irq = exynos_init_irq,
347384
.init_machine = exynos_dt_machine_init,
348385
.init_late = exynos_init_late,
349386
.dt_compat = exynos_dt_compat,

0 commit comments

Comments
 (0)