ARM: OMAP3: Dynamically disable secure timer nodes for secure devices
authorJon Hunter <jon-hunter@ti.com>
Wed, 20 Jun 2012 20:55:24 +0000 (15:55 -0500)
committerJon Hunter <jon-hunter@ti.com>
Fri, 2 Nov 2012 18:16:28 +0000 (13:16 -0500)
commitad24bde8f1025da014108493b595bed22d989efb
treea592f2174fee71fd8f16a2378cc1b35d28fb5bd0
parent8f0d8163b50e01f398b14bcd4dc039ac5ab18d64
ARM: OMAP3: Dynamically disable secure timer nodes for secure devices

OMAP3 devices may or may not have security features enabled. Security enabled
devices are known as high-secure (HS) and devices without security are known as
general purpose (GP).

For OMAP3 devices there are 12 general purpose timers available. On secure
devices the 12th timer is reserved for secure usage and so cannot be used by
the kernel, where as for a GP device it is available. We can detect the OMAP
device type, secure or GP, at runtime via an on-chip register. Today, when not
using DT, we do not register the 12th timer as a linux device if the device is
secure.

When using device tree, device tree is going to register all the timer devices
it finds in the device tree blob. To prevent device tree from registering 12th
timer on a secure OMAP3 device we can add a status property to the timer
binding with the value "disabled" at boot time. Note that timer 12 on a OMAP3
device has a property "ti,timer-secure" to indicate that it will not be
available on a secure device and so for secure OMAP3 devices, we search for
timers with this property and then disable them. Using the prom_add_property()
function to dynamically add a property was a recommended approach suggested by
Rob Herring [1].

I have tested this on an OMAP3 GP device and faking it to pretend to be a
secure device to ensure that any timers marked with "ti,timer-secure" are not
registered on boot. I have also made sure that all timers are registered as
expected on a GP device by default.

[1] http://comments.gmane.org/gmane.linux.ports.arm.omap/79203

Signed-off-by: Jon Hunter <jon-hunter@ti.com>
arch/arm/mach-omap2/timer.c