Paul Mundt [Mon, 11 May 2009 21:18:09 +0000 (06:18 +0900)]
sh: clkfwk: Wire up clk_get_sys() support.
This stubs in clk_get_sys() from the ARM clkdev implementation.
Tentatively conver the clk_get() lookup code to use this, and once the
rest of the in-tree users are happy with this, it can replace the
fallback lookups.
Paul Mundt [Mon, 11 May 2009 21:05:32 +0000 (06:05 +0900)]
sh: clkfwk: Kill off clk_recalc_rate().
The only user for this is the SH-Mobile r_clk, which is now added as a
root clock and can be kicked via propagate_rate() as usual. Given that,
there is no longer any need for the special clk_recalc_rate(), so we kill
it off.
Paul Mundt [Mon, 11 May 2009 20:59:27 +0000 (05:59 +0900)]
sh: clkfwk: Tidy up on-chip clock registration and rate propagation.
This tidies up the set_rate hack that the on-chip clocks were abusing to
trigger rate propagation, which is now handled generically.
Additionally, now that CLK_ENABLE_ON_INIT is wired up where it needs to
be for these clocks, the clk_enable() can go away. In some cases this was
bumping up the refcount higher than it should have been.
Paul Mundt [Mon, 11 May 2009 20:51:05 +0000 (05:51 +0900)]
sh: clkfwk: Improve the generic clk_set_parent() implementation.
This causes the generic clk_set_parent() implementation to be a bit more
intelligent. A clk_reparent() is added to move the clock over to the new
parent's sibling list, which then allows the generic rate propagation
code to succeed. This also becomes a nop if the new and old parents are
unchanged.
Paul Mundt [Mon, 11 May 2009 20:30:10 +0000 (05:30 +0900)]
sh: clkfwk: Fix up the clk_enable() error path.
There are a couple of instances where a clk_enable() can fail, which the
SH-Mobile code presently handles, but doesn't get reported all the way
back up. This fixes up the return type so the errors make it all the way
down to the drivers.
Additionally, we now also error out properly if the parent enable fails.
Prep work for aggressively turning off unused clocks on boot.
Paul Mundt [Mon, 11 May 2009 20:14:53 +0000 (05:14 +0900)]
sh: clkfwk: Consolidate the ALWAYS_ENABLED / NEEDS_INIT mess.
There is no real distinction here in behaviour, either a clock needs to
be enabled on initialiation or not. The ALWAYS_ENABLED flag was always
intended to only apply to clocks that were physically always on and could
simply not be disabled at all from software. Unfortunately over time this
was abused and the meaning became a bit blurry.
So, we kill off both of all of those paths now, as well as the newer
NEEDS_INIT flag, and consolidate on a CLK_ENABLE_ON_INIT. Clocks that
need to be enabled on initialization can set this, and it will purposely
enable them and bump the refcount up.
Paul Mundt [Mon, 11 May 2009 19:27:43 +0000 (04:27 +0900)]
sh: clkfwk: refactor rate propagation.
This resyncs the rate propagation strategy with the scheme used by the
OMAP clock framework. Child clocks are tracked on a list under each
parent and propagation happens there specifically rather than constantly
iterating over the global clock list.
Paul Mundt [Mon, 11 May 2009 18:50:44 +0000 (03:50 +0900)]
sh: clkfwk: Add a followparent_recalc() helper.
This adds a followparent_recalc() helper for clocks that just follow the
parent's rate. Switch over the few CPUs that use this scheme for some of
their clocks.
Magnus Damm [Mon, 11 May 2009 09:01:08 +0000 (09:01 +0000)]
sh: multiple vectors per irq - sh7760
Update intc tables and platform data to use one linux irq
per maskable interrupt source instead of keeping the one-to-one
mapping between vectors and linux irqs.
This fixes potential irq masking issues for sh7760 hardware
blocks such as DMAC/TMU2/REF.
Signed-off-by: Magnus Damm <damm@igel.co.jp> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Paul Mundt [Mon, 11 May 2009 03:15:14 +0000 (12:15 +0900)]
sh: Account for INITIAL_JIFFIES when using jiffies clocksource.
In the case where we fall back on the generic jiffies clocksource,
INITIAL_JIFFIES needs to be accounted for so that printk times aren't
completely skewed.
Paul Mundt [Sun, 10 May 2009 05:25:39 +0000 (14:25 +0900)]
sh: Fix up R0 dependence in __arch_swab16/32.
There is nothing in these routines that inherently depends on R0 use.
Given that these routines are inlined, it is rather easy to blow up the
compiler by exhausting the spill class when performing a 64-bit swab.
This presently manifests itself as the following:
CC fs/ocfs2/suballoc.o
fs/ocfs2/suballoc.c: In function 'ocfs2_reserve_suballoc_bits':
fs/ocfs2/suballoc.c:638: error: unrecognizable insn:
(insn 2793 1230 1231 103 arch/sh/include/asm/swab.h:33 (set (reg:HI 853)
(subreg:HI (reg:SI 149 macl) 2)) -1 (expr_list:REG_DEAD (reg:SI 149 macl)
(nil)))
fs/ocfs2/suballoc.c:638: internal compiler error: in extract_insn, at recog.c:1991
This patch switches over to using an arbitrarily assigned register instead.
While the same issue does not exist in the SH-5 case, there is likewise no harm
in having an alternate register used for the byterev/shari pair.
Paul Mundt [Sat, 9 May 2009 16:23:25 +0000 (01:23 +0900)]
sh: Consolidate the boot link and entry offset definitions.
Consolidate these in a single place in the Kconfig menus. At the same
time, disable their interactivity and set them according to the board
config defaults.
Paul Mundt [Sat, 9 May 2009 15:55:45 +0000 (00:55 +0900)]
sh: Provide a BITS definition, use it in the arch/sh/boot/ Makefiles.
This introduces a BITS export that can handily be picked up by Makefiles
for cleaner sharing. Reflect its use in arch/sh/boot/compressed/ in
preparation for unifying the Makefiles.
Paul Mundt [Sat, 9 May 2009 15:25:08 +0000 (00:25 +0900)]
sh: Tidy up the ldscript output format specifier.
Tie this in to the Makefile directly, where we already know what we are
running on. This tidies up the linker script a bit, and is prep work for
unifying the arch/sh/boot/compressed linker scripts.
Paul Mundt [Sat, 9 May 2009 14:33:02 +0000 (23:33 +0900)]
sh: Integrate sh64 bits in vmlinux_32.lds.S.
This adds all of the requisite bits from vmlinux_64.lds.S in to the _32
variant, resulting in a unified and generic linker script that can be
shared across both.
Paul Mundt [Sat, 9 May 2009 08:57:21 +0000 (17:57 +0900)]
sh: Provide an __sdivsi3_2 export for sh64.
Newer code paths that are heavier in 64-bit math manage to get this
generated by newer compilers, provide a definition and export
accordingly. This is trivially wrapped around the existing __sdivsi3
code.
Paul Mundt [Fri, 8 May 2009 14:48:33 +0000 (23:48 +0900)]
serial: sh-sci: Fix up section mismatch in error path.
The sci_probe_single() path attempts to use sci_remove() for the error
path, while sci_remove() is still flagged as __devexit. So, we simply
discard the section annotation.
Paul Mundt [Fri, 8 May 2009 13:14:01 +0000 (22:14 +0900)]
sh: Kill off the GENERIC_CALIBRATE_DELAY ifndef.
Now that everyone is using the clock framework directly and we
unconditionally provide our own calibrate_delay() function, having it
wrapped in an ifndef is no longer useful. So, kill it off.
Paul Mundt [Fri, 8 May 2009 11:32:56 +0000 (20:32 +0900)]
sh: Always fixup unaligned userspace accesses on sh64.
sh64 has traditionally had this configurable via a Kconfig option
(CONFIG_SH64_USER_MISALIGNED_FIXUP). In practice it has never really been
terribly useful to turn this off, so just get rid of the option entirely.
We leave the sysctl around so we don't end up breaking existing root
file systems, and to allow folks that really want this off to do so at
their own risk.
Paul Mundt [Fri, 8 May 2009 10:48:47 +0000 (19:48 +0900)]
sh: Always select RTC_LIB, not just for SUPERH32.
The RTC_LIB helpers are used in arch/sh/kernel/time.c, which was
previously only the case for the 32-bit variant. Now that this has
become the common implementation, move the RTC_LIB select to reflect
that. Fixes up the sh64 build.
Paul Mundt [Fri, 8 May 2009 09:01:03 +0000 (18:01 +0900)]
sh: Drop dead rules from arch/sh/kernel/Makefile_64.
Several of these options are specific to the SHcompact ISA and will need
to be rewritten for SHmedia if they are to be supported at all. Drop
the impossible rules for now.
Magnus Damm [Fri, 8 May 2009 08:32:18 +0000 (08:32 +0000)]
sh: TMU platform data for sh7723
This patch adds TMU platform data for sh7723. Both clockevent
and clocksource support is enabled. While at it, adjust the
CMT clocksource rating to prioritize the TMU.
Signed-off-by: Magnus Damm <damm@igel.co.jp> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Magnus Damm [Fri, 8 May 2009 08:23:29 +0000 (08:23 +0000)]
sh: clock framework update, fix count and kill off kref
This patch updates the clock framework use count code.
With this patch the enable() and disable() callbacks
only get called when counting from and to zero.
While at it the kref stuff gets replaced with an int.
Signed-off-by: Magnus Damm <damm@igel.co.jp> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Paul Mundt [Fri, 8 May 2009 08:41:59 +0000 (17:41 +0900)]
sh: Move out cayman-specific panic handler code to its own file.
This moves out the cayman-specific panic handler code to a better
location, and leaves the generic implementation a simple stub that is
still used under emulation.
Paul Mundt [Fri, 8 May 2009 07:57:35 +0000 (16:57 +0900)]
sh: mach-sh03: Give the sh03 rtc its own spinlock.
This converts the sh03 rtc code off of using the global rtc_lock and on
to its own spinlock. There are no other possible users of the rtc_lock,
so serializing with it is not necessary.
Paul Mundt [Fri, 8 May 2009 07:36:13 +0000 (16:36 +0900)]
sh: Wire up GENERIC_CMOS_UPDATE for the platforms that need it.
Now that everything has converted over to generic timekeeping, we need an
alternate method for keeping the RTC updated for those platforms that are
still using the rtc_sh_get/set_time pairs, presently limited to SH-03 and
the Dreamcast. This wires up the GENERIC_CMOS_UPDATE hooks for those to
maintain the same behaviour.
Paul Mundt [Fri, 8 May 2009 07:12:17 +0000 (16:12 +0900)]
sh: Finish the sh64 migration off of ARCH_USES_GETTIMEOFFSET.
This adds sh_tmu support to the SH-5 subtypes, which subsequently allows
us to kill off time_64.c and use the now generic time_32.c. As a bonus,
SH-5 now supports highres timers and tickless for the first time.
Magnus Damm [Thu, 7 May 2009 10:31:39 +0000 (10:31 +0000)]
sh: call clock framework init() callback once
Make sure that clk->ops->init() only gets called once in
the case of CLK_ALWAYS_ENABLED. Without this patch the
init() callback may be called multiple times.
Signed-off-by: Magnus Damm <damm@igel.co.jp> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Magnus Damm [Thu, 7 May 2009 10:17:44 +0000 (10:17 +0000)]
sh: sh7785 early scif fix
This patch moves the SH4 case of EARLY_SCIF_CONSOLE_PORT
so the SH7785 default value gets used. Without this patch
the value for SH7785 is set to 0xffe80000.
Signed-off-by: Magnus Damm <damm@igel.co.jp> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Paul Mundt [Thu, 7 May 2009 09:10:27 +0000 (18:10 +0900)]
sh: Integrate the SH-5 onchip_remap() more coherently.
Presently this is special-cased for early initialization. While there are
situations where these static early initializations are still necessary,
with minor changes it is possible to use this for the regular ioremap
implementation as well. This allows us to kill off the special-casing for
the remap completely and to start tidying up all of the SH-5
special-casing in drivers.
Paul Mundt [Sun, 3 May 2009 09:29:27 +0000 (18:29 +0900)]
sh: Move dummy clockevents broadcast timer to its new home.
The old arch/sh/kernel/timers/ directly will be going away completely
once the rest of the TMU users are migrated, so move the dummy broadcast
driver up a level in preparation.
Paul Mundt [Sun, 3 May 2009 09:18:14 +0000 (18:18 +0900)]
sh: Kill off the now unused ARCH_USES_GETTIMEOFFSET code.
Now that the stragglers (MTU2/CMT/etc.) have been rewritten and we are
selecting both GENERIC_TIME and GENERIC_CLOCKEVENTS, the get_offset()
timer op is completely unused. As a result, we are now able to kill off
the ARCH_USES_GETTIMEOFFSET references.
Paul Mundt [Sun, 3 May 2009 08:57:17 +0000 (17:57 +0900)]
sh: Consolidate MTU2/CMT/TMU timer platform data.
All of the SH timers use a roughly identical structure for platform data,
which presently is broken out for each block. Consolidate all of these
definitions, as there is no reason for them to be broken out in the first
place.
Magnus Damm [Fri, 1 May 2009 06:58:52 +0000 (06:58 +0000)]
sh: TMU platform data for sh7722
This patch adds TMU platform data for sh7722. Only clockevent
mode is enabled for now, clocksource requires this patch:
"clocksource: setup mult_orig in clocksource_enable()"
Signed-off-by: Magnus Damm <damm@igel.co.jp> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Magnus Damm [Fri, 1 May 2009 06:51:00 +0000 (06:51 +0000)]
clocksource: SuperH TMU Timer driver
This patch adds a TMU driver for the SuperH architecture.
The TMU driver is a platform driver with early platform
support to allow using a TMU channel as clockevent or
clocksource during system bootup or later.
Clocksource or clockevent can be selected.
Both periodic and oneshot clockevents are supported.
Signed-off-by: Magnus Damm <damm@igel.co.jp> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Magnus Damm [Thu, 30 Apr 2009 07:12:09 +0000 (07:12 +0000)]
sh: remove old MTU2 driver
This patch removes the old MTU2 driver (CONFIG_SH_MTU2/timer-mtu2.c)
As replacement, select the sh_cmt driver with CONFIG_SH_TIMER_MTU2
and configure timer channel using platform data.
If multiple MTU channels are enabled using platform data, use the
earlytimer parameter on the kernel command line to select channel.
For instance, use "earlytimer=sh_mtu2.0" to select the first channel.
To verify which timer is being used, look at printouts or the timer
irq count in /proc/interrupts.
Signed-off-by: Magnus Damm <damm@igel.co.jp> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Magnus Damm [Thu, 30 Apr 2009 07:02:49 +0000 (07:02 +0000)]
clocksource: SuperH MTU2 Timer driver
This patch adds a MTU2 driver for the SuperH architecture.
The MTU2 driver is a platform driver with early platform
support to allow using a MTU2 channel as only clockevent
during system bootup.
Clocksource on sh2a is currently unsupported due to code
generation issues with 64-bit math, so at this point only
periodic clockevent support is in place.
Signed-off-by: Magnus Damm <damm@igel.co.jp> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
john stultz [Fri, 1 May 2009 20:10:28 +0000 (13:10 -0700)]
time: sh: convert to use arch_getoffset() infrastructure
Convert sh to use GENERIC_TIME via the arch_getoffset() infrastructure.
Signed-off-by: John Stultz <johnstul@us.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Some arches don't supply their own clocksource. This is mainly the
case in architectures that get their inter-tick times by reading the
counter on their interval timer. Since these timers wrap every tick,
they're not really useful as clocksources. Wrapping them to act like
one is possible but not very efficient. So we provide a callout these
arches can implement for use with the jiffies clocksource to provide
finer then tick granular time.
[ Impact: ease the migration to generic time keeping ]
Signed-off-by: John Stultz <johnstul@us.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Magnus Damm [Fri, 1 May 2009 05:45:46 +0000 (14:45 +0900)]
clocksource: setup mult_orig in clocksource_enable()
Setup clocksource mult_orig in clocksource_enable().
Clocksource drivers can save power by using keeping the
device clock disabled while the clocksource is unused.
In practice this means that the enable() and disable()
callbacks perform clk_enable() and clk_disable().
The enable() callback may also use clk_get_rate() to get
the clock rate from the clock framework. This information
can then be used to calculate the shift and mult variables.
Currently the mult_orig variable is setup from mult at
registration time only. This is conflicting with the above
case since the clock is disabled and the mult variable is
not yet calculated at the time of registration.
Moving the mult_orig setup code to clocksource_enable()
allows us to both handle the common case with no enable()
callback and the mult-changed-after-enable() case.
[ Impact: allow dynamic clock source usage ]
Signed-off-by: Magnus Damm <damm@igel.co.jp>
LKML-Reference: <20090501054546.8193.10688.sendpatchset@rx1.opensource.se> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ecryptfs/ecryptfs-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ecryptfs/ecryptfs-2.6:
eCryptfs: Fix min function comparison warning
ecryptfs: fix printk format warning