* [PATCH] ARM: exynos: move sysram info to exynos.c
@ 2014-06-03 4:47 Olof Johansson
2014-06-10 12:49 ` Tomasz Figa
0 siblings, 1 reply; 2+ messages in thread
From: Olof Johansson @ 2014-06-03 4:47 UTC (permalink / raw)
To: linux-arm-kernel
This solves a problem with building with CONFIG_SMP=n due to missing
sysram_base_addr (or sysram_ns_base_addr) variables.
The new setup method is more awkward than I'd like for it to be, but
it can't be done in init_early() since ioremap is not yet available,
but it needs to happen before SMP.
Reported-by: Russell King <linux@arm.linux.org.uk>
Cc: Kukjin Kim <kgene.kim@samsung.com>
Cc: Tomasz Figa <t.figa@samsung.com>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Olof Johansson <olof@lixom.net>
---
I'm not entirely happy with the solution here, especially the dual
call path. The platsmp.c->exynos.c call isn't ideal either but I'm less
worried about that. Seemed overkill to create a new c file just for this.
I've tested to make sure this still works on arndale, and the build
errors as reported by Russell are definitely gone.
Better ideas welcome.
arch/arm/mach-exynos/common.h | 1 +
arch/arm/mach-exynos/exynos.c | 29 +++++++++++++++++++++++++++++
arch/arm/mach-exynos/platsmp.c | 26 ++------------------------
3 files changed, 32 insertions(+), 24 deletions(-)
diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h
index 80b90e3..5a3a1ec 100644
--- a/arch/arm/mach-exynos/common.h
+++ b/arch/arm/mach-exynos/common.h
@@ -118,6 +118,7 @@ extern void __iomem *sysram_ns_base_addr;
extern void __iomem *sysram_base_addr;
void exynos_init_io(void);
void exynos_restart(enum reboot_mode mode, const char *cmd);
+void exynos_sysram_init(void);
void exynos_cpuidle_init(void);
void exynos_cpufreq_init(void);
void exynos_init_late(void);
diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c
index bc43e22..9183675 100644
--- a/arch/arm/mach-exynos/exynos.c
+++ b/arch/arm/mach-exynos/exynos.c
@@ -187,6 +187,28 @@ void __init exynos_cpufreq_init(void)
platform_device_register_simple("exynos-cpufreq", -1, NULL, 0);
}
+void __iomem *sysram_base_addr;
+void __iomem *sysram_ns_base_addr;
+
+void __init exynos_sysram_init(void)
+{
+ struct device_node *node;
+
+ for_each_compatible_node(node, NULL, "samsung,exynos4210-sysram") {
+ if (!of_device_is_available(node))
+ continue;
+ sysram_base_addr = of_iomap(node, 0);
+ break;
+ }
+
+ for_each_compatible_node(node, NULL, "samsung,exynos4210-sysram-ns") {
+ if (!of_device_is_available(node))
+ continue;
+ sysram_ns_base_addr = of_iomap(node, 0);
+ break;
+ }
+}
+
void __init exynos_init_late(void)
{
if (of_machine_is_compatible("samsung,exynos5440"))
@@ -293,6 +315,13 @@ static void __init exynos_dt_machine_init(void)
}
}
+ /*
+ * This is called from smp_prepare_cpus if we've built for SMP, but
+ * we still need to set it up for PM and firmware ops if not.
+ */
+ if (!IS_ENABLED(SMP))
+ exynos_sysram_init();
+
exynos_cpuidle_init();
exynos_cpufreq_init();
diff --git a/arch/arm/mach-exynos/platsmp.c b/arch/arm/mach-exynos/platsmp.c
index ec02422..1c8d31e 100644
--- a/arch/arm/mach-exynos/platsmp.c
+++ b/arch/arm/mach-exynos/platsmp.c
@@ -32,28 +32,6 @@
extern void exynos4_secondary_startup(void);
-void __iomem *sysram_base_addr;
-void __iomem *sysram_ns_base_addr;
-
-static void __init exynos_smp_prepare_sysram(void)
-{
- struct device_node *node;
-
- for_each_compatible_node(node, NULL, "samsung,exynos4210-sysram") {
- if (!of_device_is_available(node))
- continue;
- sysram_base_addr = of_iomap(node, 0);
- break;
- }
-
- for_each_compatible_node(node, NULL, "samsung,exynos4210-sysram-ns") {
- if (!of_device_is_available(node))
- continue;
- sysram_ns_base_addr = of_iomap(node, 0);
- break;
- }
-}
-
static inline void __iomem *cpu_boot_reg_base(void)
{
if (soc_is_exynos4210() && samsung_rev() == EXYNOS4210_REV_1_1)
@@ -234,11 +212,11 @@ static void __init exynos_smp_prepare_cpus(unsigned int max_cpus)
{
int i;
+ exynos_sysram_init();
+
if (read_cpuid_part_number() == ARM_CPU_PART_CORTEX_A9)
scu_enable(scu_base_addr());
- exynos_smp_prepare_sysram();
-
/*
* Write the address of secondary startup into the
* system-wide flags register. The boot monitor waits
--
1.7.10.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH] ARM: exynos: move sysram info to exynos.c
2014-06-03 4:47 [PATCH] ARM: exynos: move sysram info to exynos.c Olof Johansson
@ 2014-06-10 12:49 ` Tomasz Figa
0 siblings, 0 replies; 2+ messages in thread
From: Tomasz Figa @ 2014-06-10 12:49 UTC (permalink / raw)
To: linux-arm-kernel
Hi Olof,
On 03.06.2014 06:47, Olof Johansson wrote:
> This solves a problem with building with CONFIG_SMP=n due to missing
> sysram_base_addr (or sysram_ns_base_addr) variables.
>
> The new setup method is more awkward than I'd like for it to be, but
> it can't be done in init_early() since ioremap is not yet available,
> but it needs to happen before SMP.
>
> Reported-by: Russell King <linux@arm.linux.org.uk>
> Cc: Kukjin Kim <kgene.kim@samsung.com>
> Cc: Tomasz Figa <t.figa@samsung.com>
> Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
> Signed-off-by: Olof Johansson <olof@lixom.net>
> ---
>
> I'm not entirely happy with the solution here, especially the dual
> call path. The platsmp.c->exynos.c call isn't ideal either but I'm less
> worried about that. Seemed overkill to create a new c file just for this.
>
> I've tested to make sure this still works on arndale, and the build
> errors as reported by Russell are definitely gone.
In general, I'm okay with this patch, so if nobody is willing to find a
better way feel free to add my Reviewed-by.
>
> Better ideas welcome.
>
Probably the best idea would be to find a way to always call
exynos_sysram_init() after DT unflattening and before SMP
initialization. Some platforms (e.g. tegra) abuse .init_irq callback for
this, e.g.:
mach-tegra/tegra.c:
static void __init tegra_dt_init_irq(void)
{
tegra_pmc_init_irq();
tegra_init_irq();
irqchip_init();
tegra_legacy_irq_syscore_init();
}
We could do the same on Exynos if this is considered better.
Best regards,
Tomasz
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-06-10 12:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-03 4:47 [PATCH] ARM: exynos: move sysram info to exynos.c Olof Johansson
2014-06-10 12:49 ` Tomasz Figa
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).