aboutsummaryrefslogtreecommitdiff
path: root/arch/arm
diff options
context:
space:
mode:
authorJon Medhurst <tixy@linaro.org>2013-05-03 14:24:48 +0100
committerJon Medhurst <tixy@linaro.org>2013-05-03 14:24:48 +0100
commit8417d689429075fe59d92af4036e25424b13ea9c (patch)
treef0d341e6eae1cd5c4ca6180aeb29a00e21ff8a8e /arch/arm
parent83e4a8b0fe64a97fc92f436c7eff09569352c5ed (diff)
parentcee7bd6c72b15e357eb375a178532851c72e789c (diff)
Merge branch 'tracking-armlt-arm64' into integration-linux-vexpresstracking-integration-linux-vexpress-lsk-20130505.0
Conflicts: drivers/clk/versatile/Makefile
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/common/timer-sp.c14
-rw-r--r--arch/arm/include/asm/hardware/timer-sp.h15
-rw-r--r--arch/arm/mach-highbank/highbank.c5
-rw-r--r--arch/arm/mach-integrator/integrator_cp.c8
-rw-r--r--arch/arm/mach-realview/core.c4
-rw-r--r--arch/arm/mach-versatile/core.c4
-rw-r--r--arch/arm/mach-vexpress/Kconfig3
-rw-r--r--arch/arm/mach-vexpress/Makefile2
-rw-r--r--arch/arm/mach-vexpress/reset.c141
-rw-r--r--arch/arm/mach-vexpress/v2m.c18
10 files changed, 40 insertions, 174 deletions
diff --git a/arch/arm/common/timer-sp.c b/arch/arm/common/timer-sp.c
index 9d2d3ba339f..2c64c4bc6d5 100644
--- a/arch/arm/common/timer-sp.c
+++ b/arch/arm/common/timer-sp.c
@@ -29,13 +29,14 @@
#include <asm/sched_clock.h>
#include <asm/hardware/arm_timer.h>
-static long __init sp804_get_clock_rate(const char *name)
+static long __init sp804_get_clock_rate(struct clk *clk,
+ const char *name)
{
- struct clk *clk;
long rate;
int err;
- clk = clk_get_sys("sp804", name);
+ if (!clk)
+ clk = clk_get_sys("sp804", name);
if (IS_ERR(clk)) {
pr_err("sp804: %s clock not found: %d\n", name,
(int)PTR_ERR(clk));
@@ -77,9 +78,10 @@ static u32 sp804_read(void)
void __init __sp804_clocksource_and_sched_clock_init(void __iomem *base,
const char *name,
+ struct clk *clk,
int use_sched_clock)
{
- long rate = sp804_get_clock_rate(name);
+ long rate = sp804_get_clock_rate(clk, name);
if (rate < 0)
return;
@@ -172,10 +174,10 @@ static struct irqaction sp804_timer_irq = {
};
void __init sp804_clockevents_init(void __iomem *base, unsigned int irq,
- const char *name)
+ const char *name, struct clk *clk)
{
struct clock_event_device *evt = &sp804_clockevent;
- long rate = sp804_get_clock_rate(name);
+ long rate = sp804_get_clock_rate(clk, name);
if (rate < 0)
return;
diff --git a/arch/arm/include/asm/hardware/timer-sp.h b/arch/arm/include/asm/hardware/timer-sp.h
index 2dd9d3f83f2..4cba3e6d8ae 100644
--- a/arch/arm/include/asm/hardware/timer-sp.h
+++ b/arch/arm/include/asm/hardware/timer-sp.h
@@ -1,15 +1,18 @@
void __sp804_clocksource_and_sched_clock_init(void __iomem *,
- const char *, int);
+ const char *, struct clk *, int);
-static inline void sp804_clocksource_init(void __iomem *base, const char *name)
+static inline void sp804_clocksource_init(void __iomem *base, const char *name,
+ struct clk *clk)
{
- __sp804_clocksource_and_sched_clock_init(base, name, 0);
+ __sp804_clocksource_and_sched_clock_init(base, name, clk, 0);
}
static inline void sp804_clocksource_and_sched_clock_init(void __iomem *base,
- const char *name)
+ const char *name,
+ struct clk *clk)
{
- __sp804_clocksource_and_sched_clock_init(base, name, 1);
+ __sp804_clocksource_and_sched_clock_init(base, name, clk, 1);
}
-void sp804_clockevents_init(void __iomem *, unsigned int, const char *);
+void sp804_clockevents_init(void __iomem *, unsigned int, const char *,
+ struct clk *);
diff --git a/arch/arm/mach-highbank/highbank.c b/arch/arm/mach-highbank/highbank.c
index a4f9f50247d..53d0c79b543 100644
--- a/arch/arm/mach-highbank/highbank.c
+++ b/arch/arm/mach-highbank/highbank.c
@@ -116,8 +116,9 @@ static void __init highbank_timer_init(void)
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");
+ sp804_clocksource_and_sched_clock_init(timer_base + 0x20, "timer1",
+ NULL);
+ sp804_clockevents_init(timer_base, irq, "timer0", NULL);
twd_local_timer_of_register();
diff --git a/arch/arm/mach-integrator/integrator_cp.c b/arch/arm/mach-integrator/integrator_cp.c
index 2b0db82a538..5976d3465a3 100644
--- a/arch/arm/mach-integrator/integrator_cp.c
+++ b/arch/arm/mach-integrator/integrator_cp.c
@@ -268,7 +268,7 @@ static void __init cp_of_timer_init(void)
if (WARN_ON(!base))
return;
writel(0, base + TIMER_CTRL);
- sp804_clocksource_init(base, node->name);
+ sp804_clocksource_init(base, node->name, NULL);
err = of_property_read_string(of_aliases,
"arm,timer-secondary", &path);
@@ -280,7 +280,7 @@ static void __init cp_of_timer_init(void)
return;
irq = irq_of_parse_and_map(node, 0);
writel(0, base + TIMER_CTRL);
- sp804_clockevents_init(base, irq, node->name);
+ sp804_clockevents_init(base, irq, node->name, NULL);
}
static const struct of_device_id fpga_irq_of_match[] __initconst = {
@@ -514,8 +514,8 @@ static void __init cp_timer_init(void)
writel(0, TIMER1_VA_BASE + TIMER_CTRL);
writel(0, TIMER2_VA_BASE + TIMER_CTRL);
- sp804_clocksource_init(TIMER2_VA_BASE, "timer2");
- sp804_clockevents_init(TIMER1_VA_BASE, IRQ_TIMERINT1, "timer1");
+ sp804_clocksource_init(TIMER2_VA_BASE, "timer2", NULL);
+ sp804_clockevents_init(TIMER1_VA_BASE, IRQ_TIMERINT1, "timer1", NULL);
}
#define INTEGRATOR_CP_MMC_IRQS { IRQ_CP_MMCIINT0, IRQ_CP_MMCIINT1 }
diff --git a/arch/arm/mach-realview/core.c b/arch/arm/mach-realview/core.c
index 1d5ee5c9a1d..a4cf86fe591 100644
--- a/arch/arm/mach-realview/core.c
+++ b/arch/arm/mach-realview/core.c
@@ -363,8 +363,8 @@ void __init realview_timer_init(unsigned int timer_irq)
writel(0, timer2_va_base + TIMER_CTRL);
writel(0, timer3_va_base + TIMER_CTRL);
- sp804_clocksource_init(timer3_va_base, "timer3");
- sp804_clockevents_init(timer0_va_base, timer_irq, "timer0");
+ sp804_clocksource_init(timer3_va_base, "timer3", NULL);
+ sp804_clockevents_init(timer0_va_base, timer_irq, "timer0", NULL);
}
/*
diff --git a/arch/arm/mach-versatile/core.c b/arch/arm/mach-versatile/core.c
index 25160aeaa3b..9506688ef9a 100644
--- a/arch/arm/mach-versatile/core.c
+++ b/arch/arm/mach-versatile/core.c
@@ -807,6 +807,6 @@ void __init versatile_timer_init(void)
writel(0, TIMER2_VA_BASE + TIMER_CTRL);
writel(0, TIMER3_VA_BASE + TIMER_CTRL);
- sp804_clocksource_init(TIMER3_VA_BASE, "timer3");
- sp804_clockevents_init(TIMER0_VA_BASE, IRQ_TIMERINT0_1, "timer0");
+ sp804_clocksource_init(TIMER3_VA_BASE, "timer3", NULL);
+ sp804_clockevents_init(TIMER0_VA_BASE, IRQ_TIMERINT0_1, "timer0", NULL);
}
diff --git a/arch/arm/mach-vexpress/Kconfig b/arch/arm/mach-vexpress/Kconfig
index 7b2ebc29ce3..bdad7d49d4d 100644
--- a/arch/arm/mach-vexpress/Kconfig
+++ b/arch/arm/mach-vexpress/Kconfig
@@ -18,6 +18,9 @@ config ARCH_VEXPRESS
select NO_IOPORT
select PLAT_VERSATILE
select PLAT_VERSATILE_CLCD
+ select POWER_RESET
+ select POWER_RESET_VEXPRESS
+ select POWER_SUPPLY
select REGULATOR_FIXED_VOLTAGE if REGULATOR
select VEXPRESS_CONFIG
help
diff --git a/arch/arm/mach-vexpress/Makefile b/arch/arm/mach-vexpress/Makefile
index b4117dbfe85..14193dc7e6e 100644
--- a/arch/arm/mach-vexpress/Makefile
+++ b/arch/arm/mach-vexpress/Makefile
@@ -4,7 +4,7 @@
ccflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/$(src)/include \
-I$(srctree)/arch/arm/plat-versatile/include
-obj-y := v2m.o reset.o
+obj-y := v2m.o
obj-$(CONFIG_ARCH_VEXPRESS_CA9X4) += ct-ca9x4.o
obj-$(CONFIG_ARCH_VEXPRESS_DCSCB) += dcscb.o dcscb_setup.o
CFLAGS_REMOVE_dcscb.o = -pg
diff --git a/arch/arm/mach-vexpress/reset.c b/arch/arm/mach-vexpress/reset.c
deleted file mode 100644
index 465923aa381..00000000000
--- a/arch/arm/mach-vexpress/reset.c
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that 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.
- *
- * Copyright (C) 2012 ARM Limited
- */
-
-#include <linux/jiffies.h>
-#include <linux/of.h>
-#include <linux/of_device.h>
-#include <linux/platform_device.h>
-#include <linux/stat.h>
-#include <linux/vexpress.h>
-
-static void vexpress_reset_do(struct device *dev, const char *what)
-{
- int err = -ENOENT;
- struct vexpress_config_func *func =
- vexpress_config_func_get_by_dev(dev);
-
- if (func) {
- unsigned long timeout;
-
- err = vexpress_config_write(func, 0, 0);
-
- timeout = jiffies + HZ;
- while (time_before(jiffies, timeout))
- cpu_relax();
- }
-
- dev_emerg(dev, "Unable to %s (%d)\n", what, err);
-}
-
-static struct device *vexpress_power_off_device;
-
-void vexpress_power_off(void)
-{
- vexpress_reset_do(vexpress_power_off_device, "power off");
-}
-
-static struct device *vexpress_restart_device;
-
-void vexpress_restart(char str, const char *cmd)
-{
- vexpress_reset_do(vexpress_restart_device, "restart");
-}
-
-static ssize_t vexpress_reset_active_show(struct device *dev,
- struct device_attribute *attr, char *buf)
-{
- return sprintf(buf, "%d\n", vexpress_restart_device == dev);
-}
-
-static ssize_t vexpress_reset_active_store(struct device *dev,
- struct device_attribute *attr, const char *buf, size_t count)
-{
- long value;
- int err = kstrtol(buf, 0, &value);
-
- if (!err && value)
- vexpress_restart_device = dev;
-
- return err ? err : count;
-}
-
-DEVICE_ATTR(active, S_IRUGO | S_IWUSR, vexpress_reset_active_show,
- vexpress_reset_active_store);
-
-
-enum vexpress_reset_func { FUNC_RESET, FUNC_SHUTDOWN, FUNC_REBOOT };
-
-static struct of_device_id vexpress_reset_of_match[] = {
- {
- .compatible = "arm,vexpress-reset",
- .data = (void *)FUNC_RESET,
- }, {
- .compatible = "arm,vexpress-shutdown",
- .data = (void *)FUNC_SHUTDOWN
- }, {
- .compatible = "arm,vexpress-reboot",
- .data = (void *)FUNC_REBOOT
- },
- {}
-};
-
-static int vexpress_reset_probe(struct platform_device *pdev)
-{
- enum vexpress_reset_func func;
- const struct of_device_id *match =
- of_match_device(vexpress_reset_of_match, &pdev->dev);
-
- if (match)
- func = (enum vexpress_reset_func)match->data;
- else
- func = pdev->id_entry->driver_data;
-
- switch (func) {
- case FUNC_SHUTDOWN:
- vexpress_power_off_device = &pdev->dev;
- break;
- case FUNC_RESET:
- if (!vexpress_restart_device)
- vexpress_restart_device = &pdev->dev;
- device_create_file(&pdev->dev, &dev_attr_active);
- break;
- case FUNC_REBOOT:
- vexpress_restart_device = &pdev->dev;
- device_create_file(&pdev->dev, &dev_attr_active);
- break;
- };
-
- return 0;
-}
-
-static const struct platform_device_id vexpress_reset_id_table[] = {
- { .name = "vexpress-reset", .driver_data = FUNC_RESET, },
- { .name = "vexpress-shutdown", .driver_data = FUNC_SHUTDOWN, },
- { .name = "vexpress-reboot", .driver_data = FUNC_REBOOT, },
- {}
-};
-
-static struct platform_driver vexpress_reset_driver = {
- .probe = vexpress_reset_probe,
- .driver = {
- .name = "vexpress-reset",
- .of_match_table = vexpress_reset_of_match,
- },
- .id_table = vexpress_reset_id_table,
-};
-
-static int __init vexpress_reset_init(void)
-{
- return platform_driver_register(&vexpress_reset_driver);
-}
-device_initcall(vexpress_reset_init);
diff --git a/arch/arm/mach-vexpress/v2m.c b/arch/arm/mach-vexpress/v2m.c
index 772b7a179dd..421b186df2b 100644
--- a/arch/arm/mach-vexpress/v2m.c
+++ b/arch/arm/mach-vexpress/v2m.c
@@ -57,7 +57,8 @@ static struct map_desc v2m_io_desc[] __initdata = {
},
};
-static void __init v2m_sp804_init(void __iomem *base, unsigned int irq)
+static void __init v2m_sp804_init(void __iomem *base, unsigned int irq,
+ struct clk *clk1, struct clk *clk2)
{
if (WARN_ON(!base || irq == NO_IRQ))
return;
@@ -65,8 +66,8 @@ static void __init v2m_sp804_init(void __iomem *base, unsigned int irq)
writel(0, base + TIMER_1_BASE + TIMER_CTRL);
writel(0, base + TIMER_2_BASE + TIMER_CTRL);
- sp804_clocksource_init(base + TIMER_2_BASE, "v2m-timer1");
- sp804_clockevents_init(base + TIMER_1_BASE, irq, "v2m-timer0");
+ sp804_clocksource_init(base + TIMER_2_BASE, "v2m-timer1", clk2);
+ sp804_clockevents_init(base + TIMER_1_BASE, irq, "v2m-timer0", clk1);
}
@@ -289,7 +290,7 @@ static struct amba_device *v2m_amba_devs[] __initdata = {
static void __init v2m_timer_init(void)
{
vexpress_clk_init(ioremap(V2M_SYSCTL, SZ_4K));
- v2m_sp804_init(ioremap(V2M_TIMER01, SZ_4K), IRQ_V2M_TIMER0);
+ v2m_sp804_init(ioremap(V2M_TIMER01, SZ_4K), IRQ_V2M_TIMER0, NULL, NULL);
}
static void __init v2m_init_early(void)
@@ -362,8 +363,6 @@ static void __init v2m_init(void)
for (i = 0; i < ARRAY_SIZE(v2m_amba_devs); i++)
amba_device_register(v2m_amba_devs[i], &iomem_resource);
- pm_power_off = vexpress_power_off;
-
ct_desc->init_tile();
}
@@ -375,7 +374,6 @@ MACHINE_START(VEXPRESS, "ARM-Versatile Express")
.init_irq = v2m_init_irq,
.init_time = v2m_timer_init,
.init_machine = v2m_init,
- .restart = vexpress_restart,
MACHINE_END
static void __init v2m_dt_hdlcd_init(void)
@@ -470,7 +468,9 @@ static void __init v2m_dt_timer_init(void)
pr_info("Using SP804 '%s' as a clock & events source\n",
node->full_name);
v2m_sp804_init(of_iomap(node, 0),
- irq_of_parse_and_map(node, 0));
+ irq_of_parse_and_map(node, 0),
+ of_clk_get_by_name(node, "timclken1"),
+ of_clk_get_by_name(node, "timclken2"));
}
if (arch_timer_of_register() != 0)
@@ -492,7 +492,6 @@ static void __init v2m_dt_init(void)
{
l2x0_of_init(0x00400000, 0xfe0fffff);
of_platform_populate(NULL, v2m_dt_bus_match, NULL, NULL);
- pm_power_off = vexpress_power_off;
}
static const char * const v2m_dt_match[] __initconst = {
@@ -510,5 +509,4 @@ DT_MACHINE_START(VEXPRESS_DT, "ARM-Versatile Express")
.init_irq = irqchip_init,
.init_time = v2m_dt_timer_init,
.init_machine = v2m_dt_init,
- .restart = vexpress_restart,
MACHINE_END