mirror of
https://github.com/torvalds/linux.git
synced 2024-10-31 17:21:49 +00:00
b274776c54
A large number of cleanups, all over the platforms. This is dominated largely by the Samsung platforms (s3c, s5p, exynos) and a few of the others moving code out of arch/arm into more appropriate subsystems. The clocksource and irqchip drivers are now abstracted to the point where platforms that are already cleaned up do not need to even specify the driver they use, it can all get configured from the device tree as we do for normal device drivers. The clocksource changes basically touch every single platform in the process. We further clean up the use of platform specific header files here, with the goal of turning more of the platforms over to being "multiplatform" enabled, which implies that they cannot expose their headers to architecture independent code any more. It is expected that no functional changes are part of the cleanup. The overall reduction in total code lines is mostly the result of removing broken and obsolete code. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iQIVAwUAUSUyKmCrR//JCVInAQIN8RAAnb/uPytmlMjn5yCksF4Mvb/FVbn/TVwz KRIGpCHOzyKK1q7pM8NRUVWfjW2SZqbXJFqx6zBGKSlDPvFTOhsLyyupU+Tnyu5W IX4eIUBwb+a6H7XDHw0X2YI8uHzi5RNLhne0A1QyDKcnuHs1LDAttXnJHaK4Ap6Y NN2YFt3l3ld7DXWXJtMsw5v8lC10aeIFGTvXefaPDAdeMLivmI57qEUMDXknNr7W Odz/Rc0/cw3BNBVl/zNHA0jw7FOjKAymCYYNUa4xDCJEr+JnIRTqizd0N/YIIC7x aA2xjJ3oKUFyF51yiJE6nFuTyJznhwtehc+uiMOSIkjrPLym52LEHmd7G5Yqlmjz oiei09qBb870q3lGxwfht9iaeIwYgQFYGfD0yW5QWArCO5pxhtCPLPH7YZNZtcQd ZJRSGGqT/ljBz3bm0K9OLESeeTTN7+Nxvtpiz/CD+Piegz0gWJzDYJRTzkJ3UWpA WTVhVQdWUeX2JrNkgM7Z3Tu8iXOe+LIEs7kVXGJZSREmIIZiRvR36UrODZtAkp9I 7YQ+srX/uaR832pgK0RrHK0zY0psU6MmIvhYxJZFbx7keiPA9eH6drb0x7tGqcUD FzEUzvcZvyqppndfBi+R60H/YKAhJDEXdwxzo6dyCpPQaW1T9GnzIqXuE1zin+Aw X7Y8YywMbHI= =DvgJ -----END PGP SIGNATURE----- Merge tag 'cleanup' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc Pull ARM SoC cleanups from Arnd Bergmann: "A large number of cleanups, all over the platforms. This is dominated largely by the Samsung platforms (s3c, s5p, exynos) and a few of the others moving code out of arch/arm into more appropriate subsystems. The clocksource and irqchip drivers are now abstracted to the point where platforms that are already cleaned up do not need to even specify the driver they use, it can all get configured from the device tree as we do for normal device drivers. The clocksource changes basically touch every single platform in the process. We further clean up the use of platform specific header files here, with the goal of turning more of the platforms over to being "multiplatform" enabled, which implies that they cannot expose their headers to architecture independent code any more. It is expected that no functional changes are part of the cleanup. The overall reduction in total code lines is mostly the result of removing broken and obsolete code." * tag 'cleanup' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (133 commits) ARM: mvebu: correct gated clock documentation ARM: kirkwood: add missing include for nsa310 ARM: exynos: move exynos4210-combiner to drivers/irqchip mfd: db8500-prcmu: update resource passing drivers/db8500-cpufreq: delete dangling include ARM: at91: remove NEOCORE 926 board sunxi: Cleanup the reset code and add meaningful registers defines ARM: S3C24XX: header mach/regs-mem.h local ARM: S3C24XX: header mach/regs-power.h local ARM: S3C24XX: header mach/regs-s3c2412-mem.h local ARM: S3C24XX: Remove plat-s3c24xx directory in arch/arm/ ARM: S3C24XX: transform s3c2443 subirqs into new structure ARM: S3C24XX: modify s3c2443 irq init to initialize all irqs ARM: S3C24XX: move s3c2443 irq code to irq.c ARM: S3C24XX: transform s3c2416 irqs into new structure ARM: S3C24XX: modify s3c2416 irq init to initialize all irqs ARM: S3C24XX: move s3c2416 irq init to common irq code ARM: S3C24XX: Modify s3c_irq_wake to use the hwirq property ARM: S3C24XX: Move irq syscore-ops to irq-pm clocksource: always define CLOCKSOURCE_OF_DECLARE ...
209 lines
5.1 KiB
C
209 lines
5.1 KiB
C
/*
|
|
* Copyright 2010-2011 Calxeda, Inc.
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
* under the terms and conditions of the GNU General Public License,
|
|
* version 2, as published by the Free Software Foundation.
|
|
*
|
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
* more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License along with
|
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
#include <linux/clk.h>
|
|
#include <linux/clkdev.h>
|
|
#include <linux/dma-mapping.h>
|
|
#include <linux/io.h>
|
|
#include <linux/irq.h>
|
|
#include <linux/irqchip.h>
|
|
#include <linux/irqdomain.h>
|
|
#include <linux/of.h>
|
|
#include <linux/of_irq.h>
|
|
#include <linux/of_platform.h>
|
|
#include <linux/of_address.h>
|
|
#include <linux/smp.h>
|
|
#include <linux/amba/bus.h>
|
|
#include <linux/clk-provider.h>
|
|
|
|
#include <asm/arch_timer.h>
|
|
#include <asm/cacheflush.h>
|
|
#include <asm/cputype.h>
|
|
#include <asm/smp_plat.h>
|
|
#include <asm/smp_twd.h>
|
|
#include <asm/hardware/arm_timer.h>
|
|
#include <asm/hardware/timer-sp.h>
|
|
#include <asm/hardware/cache-l2x0.h>
|
|
#include <asm/mach/arch.h>
|
|
#include <asm/mach/map.h>
|
|
#include <asm/mach/time.h>
|
|
|
|
#include "core.h"
|
|
#include "sysregs.h"
|
|
|
|
void __iomem *sregs_base;
|
|
void __iomem *scu_base_addr;
|
|
|
|
static void __init highbank_scu_map_io(void)
|
|
{
|
|
unsigned long base;
|
|
|
|
/* Get SCU base */
|
|
asm("mrc p15, 4, %0, c15, c0, 0" : "=r" (base));
|
|
|
|
scu_base_addr = ioremap(base, SZ_4K);
|
|
}
|
|
|
|
#define HB_JUMP_TABLE_PHYS(cpu) (0x40 + (0x10 * (cpu)))
|
|
#define HB_JUMP_TABLE_VIRT(cpu) phys_to_virt(HB_JUMP_TABLE_PHYS(cpu))
|
|
|
|
void highbank_set_cpu_jump(int cpu, void *jump_addr)
|
|
{
|
|
cpu = MPIDR_AFFINITY_LEVEL(cpu_logical_map(cpu), 0);
|
|
writel(virt_to_phys(jump_addr), HB_JUMP_TABLE_VIRT(cpu));
|
|
__cpuc_flush_dcache_area(HB_JUMP_TABLE_VIRT(cpu), 16);
|
|
outer_clean_range(HB_JUMP_TABLE_PHYS(cpu),
|
|
HB_JUMP_TABLE_PHYS(cpu) + 15);
|
|
}
|
|
|
|
#ifdef CONFIG_CACHE_L2X0
|
|
static void highbank_l2x0_disable(void)
|
|
{
|
|
/* Disable PL310 L2 Cache controller */
|
|
highbank_smc1(0x102, 0x0);
|
|
}
|
|
#endif
|
|
|
|
static void __init highbank_init_irq(void)
|
|
{
|
|
irqchip_init();
|
|
|
|
if (of_find_compatible_node(NULL, NULL, "arm,cortex-a9"))
|
|
highbank_scu_map_io();
|
|
|
|
#ifdef CONFIG_CACHE_L2X0
|
|
/* Enable PL310 L2 Cache controller */
|
|
highbank_smc1(0x102, 0x1);
|
|
l2x0_of_init(0, ~0UL);
|
|
outer_cache.disable = highbank_l2x0_disable;
|
|
#endif
|
|
}
|
|
|
|
static struct clk_lookup lookup = {
|
|
.dev_id = "sp804",
|
|
.con_id = NULL,
|
|
};
|
|
|
|
static void __init highbank_timer_init(void)
|
|
{
|
|
int irq;
|
|
struct device_node *np;
|
|
void __iomem *timer_base;
|
|
|
|
/* Map system registers */
|
|
np = of_find_compatible_node(NULL, NULL, "calxeda,hb-sregs");
|
|
sregs_base = of_iomap(np, 0);
|
|
WARN_ON(!sregs_base);
|
|
|
|
np = of_find_compatible_node(NULL, NULL, "arm,sp804");
|
|
timer_base = of_iomap(np, 0);
|
|
WARN_ON(!timer_base);
|
|
irq = irq_of_parse_and_map(np, 0);
|
|
|
|
of_clk_init(NULL);
|
|
lookup.clk = of_clk_get(np, 0);
|
|
clkdev_add(&lookup);
|
|
|
|
sp804_clocksource_and_sched_clock_init(timer_base + 0x20, "timer1");
|
|
sp804_clockevents_init(timer_base, irq, "timer0");
|
|
|
|
twd_local_timer_of_register();
|
|
|
|
arch_timer_of_register();
|
|
arch_timer_sched_clock_init();
|
|
}
|
|
|
|
static void highbank_power_off(void)
|
|
{
|
|
highbank_set_pwr_shutdown();
|
|
|
|
while (1)
|
|
cpu_do_idle();
|
|
}
|
|
|
|
static int highbank_platform_notifier(struct notifier_block *nb,
|
|
unsigned long event, void *__dev)
|
|
{
|
|
struct resource *res;
|
|
int reg = -1;
|
|
struct device *dev = __dev;
|
|
|
|
if (event != BUS_NOTIFY_ADD_DEVICE)
|
|
return NOTIFY_DONE;
|
|
|
|
if (of_device_is_compatible(dev->of_node, "calxeda,hb-ahci"))
|
|
reg = 0xc;
|
|
else if (of_device_is_compatible(dev->of_node, "calxeda,hb-sdhci"))
|
|
reg = 0x18;
|
|
else if (of_device_is_compatible(dev->of_node, "arm,pl330"))
|
|
reg = 0x20;
|
|
else if (of_device_is_compatible(dev->of_node, "calxeda,hb-xgmac")) {
|
|
res = platform_get_resource(to_platform_device(dev),
|
|
IORESOURCE_MEM, 0);
|
|
if (res) {
|
|
if (res->start == 0xfff50000)
|
|
reg = 0;
|
|
else if (res->start == 0xfff51000)
|
|
reg = 4;
|
|
}
|
|
}
|
|
|
|
if (reg < 0)
|
|
return NOTIFY_DONE;
|
|
|
|
if (of_property_read_bool(dev->of_node, "dma-coherent")) {
|
|
writel(0xff31, sregs_base + reg);
|
|
set_dma_ops(dev, &arm_coherent_dma_ops);
|
|
} else
|
|
writel(0, sregs_base + reg);
|
|
|
|
return NOTIFY_OK;
|
|
}
|
|
|
|
static struct notifier_block highbank_amba_nb = {
|
|
.notifier_call = highbank_platform_notifier,
|
|
};
|
|
|
|
static struct notifier_block highbank_platform_nb = {
|
|
.notifier_call = highbank_platform_notifier,
|
|
};
|
|
|
|
static void __init highbank_init(void)
|
|
{
|
|
pm_power_off = highbank_power_off;
|
|
highbank_pm_init();
|
|
|
|
bus_register_notifier(&platform_bus_type, &highbank_platform_nb);
|
|
bus_register_notifier(&amba_bustype, &highbank_amba_nb);
|
|
|
|
of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
|
|
}
|
|
|
|
static const char *highbank_match[] __initconst = {
|
|
"calxeda,highbank",
|
|
"calxeda,ecx-2000",
|
|
NULL,
|
|
};
|
|
|
|
DT_MACHINE_START(HIGHBANK, "Highbank")
|
|
.smp = smp_ops(highbank_smp_ops),
|
|
.map_io = debug_ll_io_init,
|
|
.init_irq = highbank_init_irq,
|
|
.init_time = highbank_timer_init,
|
|
.init_machine = highbank_init,
|
|
.dt_compat = highbank_match,
|
|
.restart = highbank_restart,
|
|
MACHINE_END
|