summaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/timer.c
diff options
context:
space:
mode:
authorOlof Johansson <olof@lixom.net>2018-05-14 01:18:44 -0700
committerOlof Johansson <olof@lixom.net>2018-05-14 01:18:44 -0700
commite5d9875ecd2e75b30d906c480ccc1896948e2d03 (patch)
tree10d0178964003518402b72f532e500187279652e /arch/arm/mach-omap2/timer.c
parentde6037fa207f3476a276da8233e5d32d59debe0e (diff)
parentdc4c85eac6bc8cfe25144936c5636aa1415bbc12 (diff)
downloadop-kernel-dev-e5d9875ecd2e75b30d906c480ccc1896948e2d03.zip
op-kernel-dev-e5d9875ecd2e75b30d906c480ccc1896948e2d03.tar.gz
Merge tag 'omap-for-v4.18/ti-sysc-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap into next/soc
ti-sysc driver related changes for omap variants This series improves the ti-sysc interconnect target module driver to the point where a most of SoC can be booted with interconnect target module data configured in device tree instead of legacy platform data. The related device tree changes need some more work though, and can wait for v4.19. Also some drivers using nested interconnects like DSS need more work. We can now remove the unused pm-noop code that is not doing anything any longer. And we can now initialize things for PM and display pdata later to prepare things for using ti-sysc driver. We also need to add some more quirk handling so we can boot both with platform data and dts data. * tag 'omap-for-v4.18/ti-sysc-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap: bus: ti-sysc: Show module information for suspend if DEBUG is enabled bus: ti-sysc: Tag sdio and wdt with legacy mode for suspend bus: ti-sysc: Detect UARTs for SYSC_QUIRK_LEGACY_IDLE quirk on omap4 bus: ti-sysc: Detect omap4 type timers for quirk bus: ti-sysc: Add initial support for external resets bus: ti-sysc: Improve suspend and resume handling bus: ti-sysc: Tag some modules resource providers for noirq suspend bus: ti-sysc: Add handling for clkctrl opt clocks bus: ti-sysc: Make child clock alias handling more generic bus: ti-sysc: Handle simple-bus for nested children ARM: OMAP2+: Make display related init into device_initcall ARM: OMAP2+: Initialize SoC PM later ARM: OMAP2+: Only probe SDMA via ti-sysc if configured in dts ARM: OMAP2+: Use signed value for sysc register offsets ARM: OMAP2+: Allow using ti-sysc for system timers ARM: OMAP2+: Drop unused pm-noop Signed-off-by: Olof Johansson <olof@lixom.net>
Diffstat (limited to 'arch/arm/mach-omap2/timer.c')
-rw-r--r--arch/arm/mach-omap2/timer.c68
1 files changed, 52 insertions, 16 deletions
diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
index 4fb4dc2..5a70ab6 100644
--- a/arch/arm/mach-omap2/timer.c
+++ b/arch/arm/mach-omap2/timer.c
@@ -50,7 +50,6 @@
#include "omap_device.h"
#include <plat/counter-32k.h>
#include <clocksource/timer-ti-dm.h>
-#include "omap-pm.h"
#include "soc.h"
#include "common.h"
@@ -168,6 +167,43 @@ static const struct of_device_id omap_timer_match[] __initconst = {
{ }
};
+static int omap_timer_add_disabled_property(struct device_node *np)
+{
+ struct property *prop;
+
+ prop = kzalloc(sizeof(*prop), GFP_KERNEL);
+ if (!prop)
+ return -ENOMEM;
+
+ prop->name = "status";
+ prop->value = "disabled";
+ prop->length = strlen(prop->value);
+
+ return of_add_property(np, prop);
+}
+
+static int omap_timer_update_dt(struct device_node *np)
+{
+ int error = 0;
+
+ if (!of_device_is_compatible(np, "ti,omap-counter32k")) {
+ error = omap_timer_add_disabled_property(np);
+ if (error)
+ return error;
+ }
+
+ /* No parent interconnect target module configured? */
+ if (of_get_property(np, "ti,hwmods", NULL))
+ return error;
+
+ /* Tag parent interconnect target module disabled */
+ error = omap_timer_add_disabled_property(np->parent);
+ if (error)
+ return error;
+
+ return 0;
+}
+
/**
* omap_get_timer_dt - get a timer using device-tree
* @match - device-tree match structure for matching a device type
@@ -183,6 +219,7 @@ static struct device_node * __init omap_get_timer_dt(const struct of_device_id *
const char *property)
{
struct device_node *np;
+ int error;
for_each_matching_node(np, match) {
if (!of_device_is_available(np))
@@ -197,17 +234,9 @@ static struct device_node * __init omap_get_timer_dt(const struct of_device_id *
of_get_property(np, "ti,timer-secure", NULL)))
continue;
- if (!of_device_is_compatible(np, "ti,omap-counter32k")) {
- struct property *prop;
+ error = omap_timer_update_dt(np);
+ WARN(error, "%s: Could not update dt: %i\n", __func__, error);
- prop = kzalloc(sizeof(*prop), GFP_KERNEL);
- if (!prop)
- return NULL;
- prop->name = "status";
- prop->value = "disabled";
- prop->length = strlen(prop->value);
- of_add_property(np, prop);
- }
return np;
}
@@ -266,8 +295,12 @@ static int __init omap_dm_timer_init_one(struct omap_dm_timer *timer,
return -ENODEV;
of_property_read_string_index(np, "ti,hwmods", 0, &oh_name);
- if (!oh_name)
- return -ENODEV;
+ if (!oh_name) {
+ of_property_read_string_index(np->parent, "ti,hwmods", 0,
+ &oh_name);
+ if (!oh_name)
+ return -ENODEV;
+ }
timer->irq = irq_of_parse_and_map(np, 0);
if (!timer->irq)
@@ -419,9 +452,12 @@ static int __init __maybe_unused omap2_sync32k_clocksource_init(void)
if (!np)
return -ENODEV;
- of_property_read_string_index(np, "ti,hwmods", 0, &oh_name);
- if (!oh_name)
- return -ENODEV;
+ of_property_read_string_index(np->parent, "ti,hwmods", 0, &oh_name);
+ if (!oh_name) {
+ of_property_read_string_index(np, "ti,hwmods", 0, &oh_name);
+ if (!oh_name)
+ return -ENODEV;
+ }
/*
* First check hwmod data is available for sync32k counter
OpenPOWER on IntegriCloud