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

Commit d81d188c authored by Mark A. Greer's avatar Mark A. Greer Committed by Kevin Hilman
Browse files

davinci: Add support for multiple PSCs



The current code to support the DaVinci Power and Sleep Controller (PSC)
assumes that there is only one controller.  This assumption is no longer
valid so expand the support to allow greater than one PSC.

To accomplish this, put the base addresses for the PSCs in the SoC
infrastructure so it can be referenced by the PSC code.  This also
requires adding an extra parameter to davinci_psc_config() to specify
the PSC that is to be enabled/disabled.

Signed-off-by: default avatarMark A. Greer <mgreer@mvista.com>
Signed-off-by: default avatarKevin Hilman <khilman@deeprootsystems.com>
parent 66e0c399
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -42,7 +42,8 @@ static void __clk_enable(struct clk *clk)
	if (clk->parent)
		__clk_enable(clk->parent);
	if (clk->usecount++ == 0 && (clk->flags & CLK_PSC))
		davinci_psc_config(psc_domain(clk), clk->lpsc, 1);
		davinci_psc_config(psc_domain(clk), clk->psc_ctlr,
				clk->lpsc, 1);
}

static void __clk_disable(struct clk *clk)
@@ -50,7 +51,8 @@ static void __clk_disable(struct clk *clk)
	if (WARN_ON(clk->usecount == 0))
		return;
	if (--clk->usecount == 0 && !(clk->flags & CLK_PLL))
		davinci_psc_config(psc_domain(clk), clk->lpsc, 0);
		davinci_psc_config(psc_domain(clk), clk->psc_ctlr,
				clk->lpsc, 0);
	if (clk->parent)
		__clk_disable(clk->parent);
}
@@ -164,11 +166,11 @@ static int __init clk_disable_unused(void)
			continue;

		/* ignore if in Disabled or SwRstDisable states */
		if (!davinci_psc_is_clk_active(ck->lpsc))
		if (!davinci_psc_is_clk_active(ck->psc_ctlr, ck->lpsc))
			continue;

		pr_info("Clocks: disable unused %s\n", ck->name);
		davinci_psc_config(psc_domain(ck), ck->lpsc, 0);
		davinci_psc_config(psc_domain(ck), ck->psc_ctlr, ck->lpsc, 0);
	}
	spin_unlock_irq(&clockfw_lock);

+1 −0
Original line number Diff line number Diff line
@@ -67,6 +67,7 @@ struct clk {
	u8			usecount;
	u8			flags;
	u8			lpsc;
	u8			psc_ctlr;
	struct clk              *parent;
	struct pll_data         *pll_data;
	u32                     div_reg;
+6 −0
Original line number Diff line number Diff line
@@ -545,6 +545,10 @@ static struct davinci_id dm355_ids[] = {
	},
};

static void __iomem *dm355_psc_bases[] = {
	IO_ADDRESS(DAVINCI_PWR_SLEEP_CNTRL_BASE),
};

static struct davinci_soc_info davinci_soc_info_dm355 = {
	.io_desc		= dm355_io_desc,
	.io_desc_num		= ARRAY_SIZE(dm355_io_desc),
@@ -552,6 +556,8 @@ static struct davinci_soc_info davinci_soc_info_dm355 = {
	.ids			= dm355_ids,
	.ids_num		= ARRAY_SIZE(dm355_ids),
	.cpu_clks		= dm355_clks,
	.psc_bases		= dm355_psc_bases,
	.psc_bases_num		= ARRAY_SIZE(dm355_psc_bases),
};

void __init dm355_init(void)
+6 −0
Original line number Diff line number Diff line
@@ -485,6 +485,10 @@ static struct davinci_id dm644x_ids[] = {
	},
};

static void __iomem *dm644x_psc_bases[] = {
	IO_ADDRESS(DAVINCI_PWR_SLEEP_CNTRL_BASE),
};

static struct davinci_soc_info davinci_soc_info_dm644x = {
	.io_desc		= dm644x_io_desc,
	.io_desc_num		= ARRAY_SIZE(dm644x_io_desc),
@@ -492,6 +496,8 @@ static struct davinci_soc_info davinci_soc_info_dm644x = {
	.ids			= dm644x_ids,
	.ids_num		= ARRAY_SIZE(dm644x_ids),
	.cpu_clks		= dm644x_clks,
	.psc_bases		= dm644x_psc_bases,
	.psc_bases_num		= ARRAY_SIZE(dm644x_psc_bases),
};

void __init dm644x_init(void)
+6 −0
Original line number Diff line number Diff line
@@ -465,6 +465,10 @@ static struct davinci_id dm646x_ids[] = {
	},
};

static void __iomem *dm646x_psc_bases[] = {
	IO_ADDRESS(DAVINCI_PWR_SLEEP_CNTRL_BASE),
};

static struct davinci_soc_info davinci_soc_info_dm646x = {
	.io_desc		= dm646x_io_desc,
	.io_desc_num		= ARRAY_SIZE(dm646x_io_desc),
@@ -472,6 +476,8 @@ static struct davinci_soc_info davinci_soc_info_dm646x = {
	.ids			= dm646x_ids,
	.ids_num		= ARRAY_SIZE(dm646x_ids),
	.cpu_clks		= dm646x_clks,
	.psc_bases		= dm646x_psc_bases,
	.psc_bases_num		= ARRAY_SIZE(dm646x_psc_bases),
};

void __init dm646x_init(void)
Loading