Commit bf4348e6 authored by Olof Johansson's avatar Olof Johansson

Merge tag 'renesas-soc-cleanup-for-v3.16' of...

Merge tag 'renesas-soc-cleanup-for-v3.16' of git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas into next/soc

Merge "Renesas ARM Based SoC soc-cleanup Updates for v3.16" from Simon Horman:

r8a7791 (R-Car H2) SoC and its Koelsch board and,
r8a7740 (R-Mobile A1) SoC and its Armadillo800eva board
* Set CPU clock frequency from OF nodes

* tag 'renesas-soc-cleanup-for-v3.16' of git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas:
  ARM: shmobile: Set clock frequency in HZ from OF nodes
  ARM: shmobile: Use shmobile_init_late() on r8a7740
  ARM: shmobile: Remove unused r8a7791_init_early()
  ARM: shmobile: Use r8a7791 DT CPU Frequency for Koelsch
  ARM: shmobile: Use r8a7791 DT CPU Frequency in common case
  ARM: shmobile: Remove unused r8a7740_init_delay()
  ARM: shmobile: Use r8a7740 DT CPU Frequency for Armadillo DT Ref
  ARM: shmobile: Use r8a7740 DT CPU Frequency in common case
  ARM: shmobile: Add r8a7740 Maximum CPU Frequency to DTS
Signed-off-by: default avatarOlof Johansson <olof@lixom.net>
parents fd46edb9 f492b817
......@@ -22,6 +22,7 @@ cpu@0 {
compatible = "arm,cortex-a9";
device_type = "cpu";
reg = <0x0>;
clock-frequency = <800000000>;
};
};
......
......@@ -187,7 +187,7 @@ static const char *eva_boards_compat_dt[] __initdata = {
DT_MACHINE_START(ARMADILLO800EVA_DT, "armadillo800eva-reference")
.map_io = r8a7740_map_io,
.init_early = r8a7740_init_delay,
.init_early = shmobile_init_delay,
.init_irq = r8a7740_init_irq_of,
.init_machine = eva_init,
.init_late = shmobile_init_late,
......
......@@ -139,7 +139,7 @@ static const char * const koelsch_boards_compat_dt[] __initconst = {
DT_MACHINE_START(KOELSCH_DT, "koelsch")
.smp = smp_ops(r8a7791_smp_ops),
.init_early = r8a7791_init_early,
.init_early = shmobile_init_delay,
.init_time = rcar_gen2_timer_init,
.init_machine = koelsch_add_standard_devices,
.init_late = shmobile_init_late,
......
......@@ -522,7 +522,7 @@ static const char * const koelsch_boards_compat_dt[] __initconst = {
DT_MACHINE_START(KOELSCH_DT, "koelsch")
.smp = smp_ops(r8a7791_smp_ops),
.init_early = r8a7791_init_early,
.init_early = shmobile_init_delay,
.init_time = rcar_gen2_timer_init,
.init_machine = koelsch_init,
.init_late = shmobile_init_late,
......
......@@ -47,7 +47,6 @@ enum {
};
extern void r8a7740_meram_workaround(void);
extern void r8a7740_init_delay(void);
extern void r8a7740_init_irq_of(void);
extern void r8a7740_map_io(void);
extern void r8a7740_add_early_devices(void);
......
......@@ -5,7 +5,6 @@ void r8a7791_add_standard_devices(void);
void r8a7791_add_dt_devices(void);
void r8a7791_clock_init(void);
void r8a7791_pinmux_init(void);
void r8a7791_init_early(void);
extern struct smp_operations r8a7791_smp_ops;
#endif /* __ASM_R8A7791_H__ */
......@@ -887,11 +887,6 @@ void __init r8a7740_add_standard_devices_dt(void)
of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
}
void __init r8a7740_init_delay(void)
{
shmobile_setup_delay(800, 1, 3); /* Cortex-A9 @ 800MHz */
};
void __init r8a7740_init_irq_of(void)
{
void __iomem *intc_prio_base = ioremap_nocache(0xe6900010, 0x10);
......@@ -935,9 +930,10 @@ static const char *r8a7740_boards_compat_dt[] __initdata = {
DT_MACHINE_START(R8A7740_DT, "Generic R8A7740 (Flattened Device Tree)")
.map_io = r8a7740_map_io,
.init_early = r8a7740_init_delay,
.init_early = shmobile_init_delay,
.init_irq = r8a7740_init_irq_of,
.init_machine = r8a7740_generic_init,
.init_late = shmobile_init_late,
.dt_compat = r8a7740_boards_compat_dt,
MACHINE_END
......
......@@ -210,13 +210,6 @@ void __init r8a7791_add_standard_devices(void)
r8a7791_register_thermal();
}
void __init r8a7791_init_early(void)
{
#ifndef CONFIG_ARM_ARCH_TIMER
shmobile_setup_delay(1500, 2, 4); /* Cortex-A15 @ 1500MHz */
#endif
}
#ifdef CONFIG_USE_OF
static const char *r8a7791_boards_compat_dt[] __initdata = {
"renesas,r8a7791",
......@@ -225,7 +218,7 @@ static const char *r8a7791_boards_compat_dt[] __initdata = {
DT_MACHINE_START(R8A7791_DT, "Generic R8A7791 (Flattened Device Tree)")
.smp = smp_ops(r8a7791_smp_ops),
.init_early = r8a7791_init_early,
.init_early = shmobile_init_delay,
.init_time = rcar_gen2_timer_init,
.dt_compat = r8a7791_boards_compat_dt,
MACHINE_END
......
......@@ -23,6 +23,23 @@
#include <linux/delay.h>
#include <linux/of_address.h>
void __init shmobile_setup_delay_hz(unsigned int max_cpu_core_hz,
unsigned int mult, unsigned int div)
{
/* calculate a worst-case loops-per-jiffy value
* based on maximum cpu core hz setting and the
* __delay() implementation in arch/arm/lib/delay.S
*
* this will result in a longer delay than expected
* when the cpu core runs on lower frequencies.
*/
unsigned int value = HZ * div / mult;
if (!preset_lpj)
preset_lpj = max_cpu_core_hz / value;
}
void __init shmobile_setup_delay(unsigned int max_cpu_core_mhz,
unsigned int mult, unsigned int div)
{
......@@ -58,12 +75,12 @@ void __init shmobile_init_delay(void)
if (max_freq) {
if (of_find_compatible_node(NULL, NULL, "arm,cortex-a8"))
shmobile_setup_delay(max_freq, 1, 3);
shmobile_setup_delay_hz(max_freq, 1, 3);
else if (of_find_compatible_node(NULL, NULL, "arm,cortex-a9"))
shmobile_setup_delay(max_freq, 1, 3);
shmobile_setup_delay_hz(max_freq, 1, 3);
else if (of_find_compatible_node(NULL, NULL, "arm,cortex-a15"))
if (!IS_ENABLED(CONFIG_ARM_ARCH_TIMER))
shmobile_setup_delay(max_freq, 2, 4);
shmobile_setup_delay_hz(max_freq, 2, 4);
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment