提交 3a0e09af 编写于 作者: M Marek Szyprowski 提交者: Zheng Zengkai

clocksource/drivers/exynos_mct: Refactor resources allocation

stable inclusion
from stable-v5.10.110
commit d4e13c4a6f4186645260db86473a59871983ee5e
bugzilla: https://gitee.com/openeuler/kernel/issues/I574AL

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=d4e13c4a6f4186645260db86473a59871983ee5e

--------------------------------

[ Upstream commit 7cd925a8 ]

Move interrupts allocation from exynos4_timer_resources() into separate
function together with the interrupt number parsing code from
mct_init_dt(), so the code for managing interrupts is kept together.
While touching exynos4_timer_resources() function, move of_iomap() to it.
No functional changes.
Signed-off-by: NMarek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: NChanwoo Choi <cw00.choi@samsung.com>
Tested-by: NChanwoo Choi <cw00.choi@samsung.com>
Reviewed-by: NKrzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: NSam Protsenko <semen.protsenko@linaro.org>
Link: https://lore.kernel.org/r/20211101193531.15078-2-semen.protsenko@linaro.orgSigned-off-by: NDaniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NYu Liao <liaoyu15@huawei.com>
Reviewed-by: NWei Li <liwei391@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 a624c207
...@@ -494,11 +494,14 @@ static int exynos4_mct_dying_cpu(unsigned int cpu) ...@@ -494,11 +494,14 @@ static int exynos4_mct_dying_cpu(unsigned int cpu)
return 0; return 0;
} }
static int __init exynos4_timer_resources(struct device_node *np, void __iomem *base) static int __init exynos4_timer_resources(struct device_node *np)
{ {
int err, cpu;
struct clk *mct_clk, *tick_clk; struct clk *mct_clk, *tick_clk;
reg_base = of_iomap(np, 0);
if (!reg_base)
panic("%s: unable to ioremap mct address space\n", __func__);
tick_clk = of_clk_get_by_name(np, "fin_pll"); tick_clk = of_clk_get_by_name(np, "fin_pll");
if (IS_ERR(tick_clk)) if (IS_ERR(tick_clk))
panic("%s: unable to determine tick clock rate\n", __func__); panic("%s: unable to determine tick clock rate\n", __func__);
...@@ -509,9 +512,27 @@ static int __init exynos4_timer_resources(struct device_node *np, void __iomem * ...@@ -509,9 +512,27 @@ static int __init exynos4_timer_resources(struct device_node *np, void __iomem *
panic("%s: unable to retrieve mct clock instance\n", __func__); panic("%s: unable to retrieve mct clock instance\n", __func__);
clk_prepare_enable(mct_clk); clk_prepare_enable(mct_clk);
reg_base = base; return 0;
if (!reg_base) }
panic("%s: unable to ioremap mct address space\n", __func__);
static int __init exynos4_timer_interrupts(struct device_node *np,
unsigned int int_type)
{
int nr_irqs, i, err, cpu;
mct_int_type = int_type;
/* This driver uses only one global timer interrupt */
mct_irqs[MCT_G0_IRQ] = irq_of_parse_and_map(np, MCT_G0_IRQ);
/*
* Find out the number of local irqs specified. The local
* timer irqs are specified after the four global timer
* irqs are specified.
*/
nr_irqs = of_irq_count(np);
for (i = MCT_L0_IRQ; i < nr_irqs; i++)
mct_irqs[i] = irq_of_parse_and_map(np, i);
if (mct_int_type == MCT_INT_PPI) { if (mct_int_type == MCT_INT_PPI) {
...@@ -571,24 +592,13 @@ static int __init exynos4_timer_resources(struct device_node *np, void __iomem * ...@@ -571,24 +592,13 @@ static int __init exynos4_timer_resources(struct device_node *np, void __iomem *
static int __init mct_init_dt(struct device_node *np, unsigned int int_type) static int __init mct_init_dt(struct device_node *np, unsigned int int_type)
{ {
u32 nr_irqs, i;
int ret; int ret;
mct_int_type = int_type; ret = exynos4_timer_resources(np);
if (ret)
/* This driver uses only one global timer interrupt */ return ret;
mct_irqs[MCT_G0_IRQ] = irq_of_parse_and_map(np, MCT_G0_IRQ);
/*
* Find out the number of local irqs specified. The local
* timer irqs are specified after the four global timer
* irqs are specified.
*/
nr_irqs = of_irq_count(np);
for (i = MCT_L0_IRQ; i < nr_irqs; i++)
mct_irqs[i] = irq_of_parse_and_map(np, i);
ret = exynos4_timer_resources(np, of_iomap(np, 0)); ret = exynos4_timer_interrupts(np, int_type);
if (ret) if (ret)
return ret; return ret;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册