Skip to content

Commit

Permalink
Merge branch 'omap-for-v4.13/clkctrl' into omap-for-v4.13/soc-v4
Browse files Browse the repository at this point in the history
  • Loading branch information
Tony Lindgren committed Jun 12, 2017
2 parents 018b732 + 70f05be commit 67d0047
Show file tree
Hide file tree
Showing 21 changed files with 245 additions and 73 deletions.
8 changes: 8 additions & 0 deletions arch/arm/mach-omap2/clockdomain.c
Original file line number Diff line number Diff line change
Expand Up @@ -1224,6 +1224,14 @@ int clkdm_clk_disable(struct clockdomain *clkdm, struct clk *clk)
return 0;
}

u32 clkdm_xlate_address(struct clockdomain *clkdm)
{
if (arch_clkdm->clkdm_xlate_address)
return arch_clkdm->clkdm_xlate_address(clkdm);

return 0;
}

/**
* clkdm_hwmod_enable - add an enabled downstream hwmod to this clkdm
* @clkdm: struct clockdomain *
Expand Down
2 changes: 2 additions & 0 deletions arch/arm/mach-omap2/clockdomain.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ struct clkdm_ops {
void (*clkdm_deny_idle)(struct clockdomain *clkdm);
int (*clkdm_clk_enable)(struct clockdomain *clkdm);
int (*clkdm_clk_disable)(struct clockdomain *clkdm);
u32 (*clkdm_xlate_address)(struct clockdomain *clkdm);
};

int clkdm_register_platform_funcs(struct clkdm_ops *co);
Expand Down Expand Up @@ -213,6 +214,7 @@ int clkdm_clk_enable(struct clockdomain *clkdm, struct clk *clk);
int clkdm_clk_disable(struct clockdomain *clkdm, struct clk *clk);
int clkdm_hwmod_enable(struct clockdomain *clkdm, struct omap_hwmod *oh);
int clkdm_hwmod_disable(struct clockdomain *clkdm, struct omap_hwmod *oh);
u32 clkdm_xlate_address(struct clockdomain *clkdm);

extern void __init omap242x_clockdomains_init(void);
extern void __init omap243x_clockdomains_init(void);
Expand Down
7 changes: 5 additions & 2 deletions arch/arm/mach-omap2/cm.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions arch/arm/mach-omap2/cm2xxx_3xxx.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/mach-omap2/cm33xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
3 changes: 2 additions & 1 deletion arch/arm/mach-omap2/cm3xxx.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
31 changes: 19 additions & 12 deletions arch/arm/mach-omap2/cm_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
}

/**
Expand Down Expand Up @@ -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 = ioremap(res.start, resource_size(&res));

data->mem = mem;
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);
}

Expand Down
29 changes: 20 additions & 9 deletions arch/arm/mach-omap2/cminst44xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
#define CLKCTRL_IDLEST_INTERFACE_IDLE 0x2
#define CLKCTRL_IDLEST_DISABLED 0x3

static void __iomem *_cm_bases[OMAP4_MAX_PRCM_PARTITIONS];
static struct omap_domain_base _cm_bases[OMAP4_MAX_PRCM_PARTITIONS];

/**
* omap_cm_base_init - Populates the cm partitions
Expand All @@ -65,10 +65,11 @@ static void __iomem *_cm_bases[OMAP4_MAX_PRCM_PARTITIONS];
*/
static void omap_cm_base_init(void)
{
_cm_bases[OMAP4430_PRM_PARTITION] = prm_base;
_cm_bases[OMAP4430_CM1_PARTITION] = cm_base;
_cm_bases[OMAP4430_CM2_PARTITION] = cm2_base;
_cm_bases[OMAP4430_PRCM_MPU_PARTITION] = prcm_mpu_base;
memcpy(&_cm_bases[OMAP4430_PRM_PARTITION], &prm_base, sizeof(prm_base));
memcpy(&_cm_bases[OMAP4430_CM1_PARTITION], &cm_base, sizeof(cm_base));
memcpy(&_cm_bases[OMAP4430_CM2_PARTITION], &cm2_base, sizeof(cm2_base));
memcpy(&_cm_bases[OMAP4430_PRCM_MPU_PARTITION], &prcm_mpu_base,
sizeof(prcm_mpu_base));
}

/* Private functions */
Expand Down Expand Up @@ -116,17 +117,17 @@ static u32 omap4_cminst_read_inst_reg(u8 part, u16 inst, u16 idx)
{
BUG_ON(part >= OMAP4_MAX_PRCM_PARTITIONS ||
part == OMAP4430_INVALID_PRCM_PARTITION ||
!_cm_bases[part]);
return readl_relaxed(_cm_bases[part] + inst + idx);
!_cm_bases[part].va);
return readl_relaxed(_cm_bases[part].va + inst + idx);
}

/* Write into a register in a CM instance */
static void omap4_cminst_write_inst_reg(u32 val, u8 part, u16 inst, u16 idx)
{
BUG_ON(part >= OMAP4_MAX_PRCM_PARTITIONS ||
part == OMAP4430_INVALID_PRCM_PARTITION ||
!_cm_bases[part]);
writel_relaxed(val, _cm_bases[part] + inst + idx);
!_cm_bases[part].va);
writel_relaxed(val, _cm_bases[part].va + inst + idx);
}

/* Read-modify-write a register in CM1. Caller must lock */
Expand Down Expand Up @@ -475,6 +476,14 @@ static int omap4_clkdm_clk_disable(struct clockdomain *clkdm)
return 0;
}

static u32 omap4_clkdm_xlate_address(struct clockdomain *clkdm)
{
u32 addr = _cm_bases[clkdm->prcm_partition].pa + clkdm->cm_inst +
clkdm->clkdm_offs;

return addr;
}

struct clkdm_ops omap4_clkdm_operations = {
.clkdm_add_wkdep = omap4_clkdm_add_wkup_sleep_dep,
.clkdm_del_wkdep = omap4_clkdm_del_wkup_sleep_dep,
Expand All @@ -490,6 +499,7 @@ struct clkdm_ops omap4_clkdm_operations = {
.clkdm_deny_idle = omap4_clkdm_deny_idle,
.clkdm_clk_enable = omap4_clkdm_clk_enable,
.clkdm_clk_disable = omap4_clkdm_clk_disable,
.clkdm_xlate_address = omap4_clkdm_xlate_address,
};

struct clkdm_ops am43xx_clkdm_operations = {
Expand All @@ -499,6 +509,7 @@ struct clkdm_ops am43xx_clkdm_operations = {
.clkdm_deny_idle = omap4_clkdm_deny_idle,
.clkdm_clk_enable = omap4_clkdm_clk_enable,
.clkdm_clk_disable = omap4_clkdm_clk_disable,
.clkdm_xlate_address = omap4_clkdm_xlate_address,
};

static struct cm_ll_data omap4xxx_cm_ll_data = {
Expand Down
Loading

0 comments on commit 67d0047

Please sign in to comment.