Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 90129336 authored by Tero Kristo's avatar Tero Kristo Committed by Tony Lindgren
Browse files

ARM: OMAP2+: PRCM: store also physical addresses for instances



In some cases the physical address info is needed, so store this
under the existing cm*_base, prm_base and prcm_mpu_base variables.
These are converted now to structs that contain both virtual and
physical address base for the instance.

Signed-off-by: default avatarTero Kristo <t-kristo@ti.com>
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent 24d8d498
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -24,8 +24,11 @@

# ifndef __ASSEMBLER__
#include <linux/clk/ti.h>
extern void __iomem *cm_base;
extern void __iomem *cm2_base;

#include "prcm-common.h"

extern struct omap_domain_base cm_base;
extern struct omap_domain_base cm2_base;
extern void omap2_set_globals_cm(void __iomem *cm, void __iomem *cm2);
# endif

+2 −2
Original line number Diff line number Diff line
@@ -52,12 +52,12 @@

static inline u32 omap2_cm_read_mod_reg(s16 module, u16 idx)
{
	return readl_relaxed(cm_base + module + idx);
	return readl_relaxed(cm_base.va + module + idx);
}

static inline void omap2_cm_write_mod_reg(u32 val, s16 module, u16 idx)
{
	writel_relaxed(val, cm_base + module + idx);
	writel_relaxed(val, cm_base.va + module + idx);
}

/* Read-modify-write a register in a CM module. Caller must lock */
+2 −2
Original line number Diff line number Diff line
@@ -50,13 +50,13 @@
/* Read a register in a CM instance */
static inline u32 am33xx_cm_read_reg(u16 inst, u16 idx)
{
	return readl_relaxed(cm_base + inst + idx);
	return readl_relaxed(cm_base.va + inst + idx);
}

/* Write into a register in a CM */
static inline void am33xx_cm_write_reg(u32 val, u16 inst, u16 idx)
{
	writel_relaxed(val, cm_base + inst + idx);
	writel_relaxed(val, cm_base.va + inst + idx);
}

/* Read-modify-write a register in CM */
+2 −1
Original line number Diff line number Diff line
@@ -669,7 +669,8 @@ static struct cm_ll_data omap3xxx_cm_ll_data = {

int __init omap3xxx_cm_init(const struct omap_prcm_init_data *data)
{
	omap2_clk_legacy_provider_init(TI_CLKM_CM, cm_base + OMAP3430_IVA2_MOD);
	omap2_clk_legacy_provider_init(TI_CLKM_CM, cm_base.va +
				       OMAP3430_IVA2_MOD);
	return cm_register(&omap3xxx_cm_ll_data);
}

+19 −12
Original line number Diff line number Diff line
@@ -32,10 +32,10 @@ static struct cm_ll_data null_cm_ll_data;
static struct cm_ll_data *cm_ll_data = &null_cm_ll_data;

/* cm_base: base virtual address of the CM IP block */
void __iomem *cm_base;
struct omap_domain_base cm_base;

/* cm2_base: base virtual address of the CM2 IP block (OMAP44xx only) */
void __iomem *cm2_base;
struct omap_domain_base cm2_base;

#define CM_NO_CLOCKS		0x1
#define CM_SINGLE_INSTANCE	0x2
@@ -49,8 +49,8 @@ void __iomem *cm2_base;
 */
void __init omap2_set_globals_cm(void __iomem *cm, void __iomem *cm2)
{
	cm_base = cm;
	cm2_base = cm2;
	cm_base.va = cm;
	cm2_base.va = cm2;
}

/**
@@ -315,27 +315,34 @@ int __init omap2_cm_base_init(void)
	struct device_node *np;
	const struct of_device_id *match;
	struct omap_prcm_init_data *data;
	void __iomem *mem;
	struct resource res;
	int ret;
	struct omap_domain_base *mem = NULL;

	for_each_matching_node_and_match(np, omap_cm_dt_match_table, &match) {
		data = (struct omap_prcm_init_data *)match->data;

		mem = of_iomap(np, 0);
		if (!mem)
			return -ENOMEM;
		ret = of_address_to_resource(np, 0, &res);
		if (ret)
			return ret;

		if (data->index == TI_CLKM_CM)
			cm_base = mem + data->offset;
			mem = &cm_base;

		if (data->index == TI_CLKM_CM2)
			cm2_base = mem + data->offset;
			mem = &cm2_base;

		data->mem = mem;
		data->mem = ioremap(res.start, resource_size(&res));

		if (mem) {
			mem->pa = res.start + data->offset;
			mem->va = data->mem + data->offset;
		}

		data->np = np;

		if (data->init && (data->flags & CM_SINGLE_INSTANCE ||
				   (cm_base && cm2_base)))
				   (cm_base.va && cm2_base.va)))
			data->init(data);
	}

Loading