cascardo/linux.git
10 years agoMerge branches 'alignment', 'fixes', 'l2c' (early part) and 'misc' into for-next
Russell King [Thu, 5 Jun 2014 11:35:52 +0000 (12:35 +0100)]
Merge branches 'alignment', 'fixes', 'l2c' (early part) and 'misc' into for-next

10 years agoARM: ensure C page table setup code follows assembly code (part II)
Russell King [Mon, 2 Jun 2014 08:29:37 +0000 (09:29 +0100)]
ARM: ensure C page table setup code follows assembly code (part II)

This does the same as the previous commit, but for the S bit, which also
needs to match the initial value which the assembly code used for the
same reasons.  Again, we add a check for SMP to ensure that the page
tables are correctly setup for SMP.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: ensure C page table setup code follows assembly code
Russell King [Tue, 27 May 2014 19:34:28 +0000 (20:34 +0100)]
ARM: ensure C page table setup code follows assembly code

Fix a long standing bug where, for ARMv6+, we don't fully ensure that
the C code sets the same cache policy as the assembly code.  This was
introduced partially by commit 11179d8ca28d ([ARM] 4497/1: Only allow
safe cache configurations on ARMv6 and later) and also by adding SMP
support.

This patch sets the default cache policy based on the flags used by the
assembly code, and then ensures that when a cache policy command line
argument is used, we verify that on ARMv6, it matches the initial setup.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: consolidate last remaining open-coded alignment trap enable
Russell King [Sun, 13 Apr 2014 19:24:51 +0000 (20:24 +0100)]
ARM: consolidate last remaining open-coded alignment trap enable

We can use the alignment_trap assembly macro here too.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: remove global cr_no_alignment
Russell King [Sun, 13 Apr 2014 18:43:26 +0000 (19:43 +0100)]
ARM: remove global cr_no_alignment

cr_no_alignment is really only used by the alignment code.  Since we no
longer change the setting of cr_alignment after boot, we can localise
this to alignment.c

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: remove CPU_CP15 conditional from alignment.c
Russell King [Sun, 13 Apr 2014 18:40:12 +0000 (19:40 +0100)]
ARM: remove CPU_CP15 conditional from alignment.c

alignment.c will not be built unless CPU_CP15 is set:

config CPU_CP15
        bool

config CPU_CP15_MMU
        bool
        select CPU_CP15

config ALIGNMENT_TRAP
        bool
        depends on CPU_CP15_MMU

So there's no point having conditionals on CPU_CP15 within this code.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: remove unused adjust_cr() function
Russell King [Sun, 13 Apr 2014 18:01:14 +0000 (19:01 +0100)]
ARM: remove unused adjust_cr() function

adjust_cr() is not used anymore, so let's get rid of it.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: move "noalign" command line option to alignment.c
Russell King [Sun, 13 Apr 2014 18:00:17 +0000 (19:00 +0100)]
ARM: move "noalign" command line option to alignment.c

Keep all bits of alignment handling together.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: provide common method to clear bits in CPU control register
Russell King [Sun, 13 Apr 2014 17:57:29 +0000 (18:57 +0100)]
ARM: provide common method to clear bits in CPU control register

Several places open-code this manipulation, let's consolidate this.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: 8025/1: Get rid of meminfo
Laura Abbott [Sun, 13 Apr 2014 21:54:58 +0000 (22:54 +0100)]
ARM: 8025/1: Get rid of meminfo

memblock is now fully integrated into the kernel and is the prefered
method for tracking memory. Rather than reinvent the wheel with
meminfo, migrate to using memblock directly instead of meminfo as
an intermediate.

Acked-by: Jason Cooper <jason@lakedaemon.net>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Acked-by: Kukjin Kim <kgene.kim@samsung.com>
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Tested-by: Leif Lindholm <leif.lindholm@linaro.org>
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: 8060/1: mm: allow sub-architectures to override PCI I/O memory type
Thomas Petazzoni [Mon, 19 May 2014 10:04:39 +0000 (11:04 +0100)]
ARM: 8060/1: mm: allow sub-architectures to override PCI I/O memory type

Due to a design incompatibility between the PCIe Marvell controller
and the Cortex-A9, stressing PCIe devices with a lot of traffic
quickly causes a deadlock.

One part of the workaround for this is to have all PCIe regions mapped
as strongly-ordered (MT_UNCACHED) instead of the default
MT_DEVICE. While the arch_ioremap_caller() mechanism allows
sub-architecture code to override ioremap(), used to map PCIe memory
regions, there isn't such a mechanism to override the behavior of
pci_ioremap_io().

This commit adds the arch_pci_ioremap_mem_type variable, initialized
to MT_DEVICE by default, and that sub-architecture code can
override. We have chosen to expose a single variable rather than
offering the possibility of overriding the entire pci_ioremap_io(),
because implementing pci_ioremap_io() requires calling functions
(get_mem_type()) that are private to the arch/arm/mm/ code.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: 8066/1: correction for ARM patch 8031/2
Nicolas Pitre [Fri, 30 May 2014 19:58:27 +0000 (20:58 +0100)]
ARM: 8066/1: correction for ARM patch 8031/2

A small mistake slipped through in memory.txt.

Signed-off-by: Nicolas Pitre <nico@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: 8049/1: ftrace/add save_stack_trace_regs() implementation
Lin Yongting [Sun, 4 May 2014 15:27:41 +0000 (16:27 +0100)]
ARM: 8049/1: ftrace/add save_stack_trace_regs() implementation

When configure kprobe events of ftrace with "stacktrace" option enabled
in arm, there is no stacktrace was recorded after the kprobe event was
triggered. The root cause is no save_stack_trace_regs() function implemented.

Implement the save_stack_trace_regs() function in arm, then ftrace will
call this architecture-related function to record the stacktrace into
ring buffer.

After this fix, stacktrace can be recorded, for example:

 # mount -t debugfs nodev /sys/kernel/debug
 # echo "p:netrx net_rx_action" >> /sys/kernel/debug/tracing/kprobe_events
 # echo 1 > /sys/kernel/debug/tracing/events/kprobes/netrx/enable
 # echo 1 > /sys/kernel/debug/tracing/options/stacktrace
 # echo 1 > /sys/kernel/debug/tracing/tracing_on
 # ping 127.0.0.1 -c 1
 # echo 0 > /sys/kernel/debug/tracing/tracing_on

 # cat /sys/kernel/debug/tracing/trace
 # tracer: nop
 #
 # entries-in-buffer/entries-written: 12/12   #P:1
 #
 #                              _-----=> irqs-off
 #                             / _----=> need-resched
 #                            | / _---=> hardirq/softirq
 #                            || / _--=> preempt-depth
 #                            ||| /     delay
 #           TASK-PID   CPU#  ||||    TIMESTAMP  FUNCTION
 #              | |       |   ||||       |         |
             <------ missing some entries ---------------->
             ping-1200  [000] dNs1   667.603250: netrx: (net_rx_action+0x0/0x1f8)
             ping-1200  [000] dNs1   667.604738: <stack trace>
  => net_rx_action
  => do_softirq
  => local_bh_enable
  => ip_finish_output
  => ip_output
  => ip_local_out
  => ip_send_skb
  => ip_push_pending_frames
  => raw_sendmsg
  => inet_sendmsg
  => sock_sendmsg
  => SyS_sendto
  => ret_fast_syscall

Signed-off-by: Lin Yongting <linyongting@gmail.com>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: 8065/1: remove last use of CONFIG_CPU_ARM710
Paul Bolle [Mon, 26 May 2014 09:30:14 +0000 (10:30 +0100)]
ARM: 8065/1: remove last use of CONFIG_CPU_ARM710

Support for ARM710 CPUs was removed in v3.5. Now remove the last code
depending on its Kconfig macro.

Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: 8062/1: Modify ldrt fixup handler to re-execute the userspace instruction
Arun K S [Mon, 19 May 2014 10:43:00 +0000 (11:43 +0100)]
ARM: 8062/1: Modify ldrt fixup handler to re-execute the userspace instruction

We will reach fixup handler when one thread(say cpu0) caused an undefined exception, while another thread(say cpu1) is unmmaping the page.

Fixup handler returns to the next userspace instruction which has caused the undef execption, rather than going to the same instruction.

ARM ARM says that after undefined exception, the PC will be pointing
to the next instruction. ie +4 offset in case of ARM and +2 in case of Thumb

And there is no correction offset passed to vector_stub in case of
undef exception.

File: arch/arm/kernel/entry-armv.S +1085
vector_stub     und, UND_MODE

During an undefined exception, in normal scenario(ie when ldrt
instruction does not cause an abort) after resorting the context in
VFP hardware, the PC is modified as show below before jumping to
ret_from_exception which is in r9.

File: arch/arm/vfp/vfphw.S +169
@ The context stored in the VFP hardware is up to date with this thread
vfp_hw_state_valid:
   tst     r1, #FPEXC_EX
   bne     process_exception     @ might as well handle the pending
                                 @ exception before retrying branch
                                 @ out before setting an FPEXC that
                                 @ stops us reading stuff
        VFPFMXR FPEXC, r1        @ Restore FPEXC last
        sub     r2, r2, #4       @ Retry current instruction - if Thumb
        str     r2, [sp, #S_PC]  @ mode it's two 16-bit instructions,
                                 @ else it's one 32-bit instruction, so
                                 @ always subtract 4 from the following
                                 @ instruction address.

But if ldrt results in an abort, we reach the fixup handler and return
to ret_from_execption without correcting the pc.

This patch modifes the fixup handler to re-execute the same instruction which caused undefined execption.

Signed-off-by: Vinayak Menon <vinayakm.list@gmail.com>
Signed-off-by: Arun KS <getarunks@gmail.com>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: 8047/1: rwsem: use asm-generic rwsem implementation
Will Deacon [Fri, 2 May 2014 16:06:19 +0000 (17:06 +0100)]
ARM: 8047/1: rwsem: use asm-generic rwsem implementation

asm-generic offers an atomic-add based rwsem implementation, which
can avoid the need for heavier, spinlock-based synchronisation on the
fast path.

This patch makes use of the optimised implementation for ARM CPUs.

Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: trial at enabling some Cortex-A9 optimisations
Russell King [Tue, 18 Mar 2014 21:40:01 +0000 (21:40 +0000)]
ARM: l2c: trial at enabling some Cortex-A9 optimisations

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: add warnings for stuff modifying aux_ctrl register values
Russell King [Mon, 17 Mar 2014 17:02:56 +0000 (17:02 +0000)]
ARM: l2c: add warnings for stuff modifying aux_ctrl register values

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: print a warning with L2C-310 caches if the cache size is modified
Russell King [Wed, 19 Mar 2014 14:07:12 +0000 (14:07 +0000)]
ARM: l2c: print a warning with L2C-310 caches if the cache size is modified

As we have now removed all instances of the L2C-310 having its cache
size "modified" via platform/SoC code, discourage new cases showing
up by printing a warning.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: remove old .set_debug method
Russell King [Sun, 16 Mar 2014 19:38:25 +0000 (19:38 +0000)]
ARM: l2c: remove old .set_debug method

We no longer need or require the .set_debug method; we handle everything
it used to do via the .write_sec method instead.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: kill L2X0_AUX_CTRL_MASK before anyone else makes use of this
Russell King [Wed, 19 Mar 2014 12:24:42 +0000 (12:24 +0000)]
ARM: l2c: kill L2X0_AUX_CTRL_MASK before anyone else makes use of this

L2X0_AUX_CTRL_MASK is not useful for PL310s.  It would be better if
people thought about their value for this rather than cargo-cult
programming.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: zynq: convert to generic l2c OF initialisation
Russell King [Mon, 28 Apr 2014 14:31:11 +0000 (15:31 +0100)]
ARM: l2c: zynq: convert to generic l2c OF initialisation

Remove the explicit call to l2x0_of_init(), converting to the generic
infrastructure instead.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: zynq: remove cache size override
Russell King [Wed, 19 Mar 2014 12:22:34 +0000 (12:22 +0000)]
ARM: l2c: zynq: remove cache size override

The cache size should already be present in the L2 cache auxiliary
control register: it is part of the integration process to configure
the hardware IP.  Most platforms get this right, yet still many
cargo-cult program, and assume that they always need specifying to
the L2 cache code.  Remove them so we can find out which really need
this.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: vexpress: convert to generic l2c OF initialisation
Russell King [Mon, 28 Apr 2014 14:43:12 +0000 (15:43 +0100)]
ARM: l2c: vexpress: convert to generic l2c OF initialisation

Remove the explicit call to l2x0_of_init(), converting to the generic
infrastructure instead.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: vexpress ca9x4: move L2 cache initialisation earlier
Russell King [Wed, 19 Mar 2014 11:15:38 +0000 (11:15 +0000)]
ARM: l2c: vexpress ca9x4: move L2 cache initialisation earlier

It is beneficial to have the L2 cache up and running earlier in the
system boot.  Not only will this allow for simpler code when we come to
enable some features, but it also means that we get a more accurate
bogomips value for the udelay() loop.  Calibrating the loop with the
L2 cache off, and then running with the L2 cache on is not the best
idea.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: ux500: don't try to change the L2 cache auxiliary control register
Russell King [Wed, 19 Mar 2014 12:47:58 +0000 (12:47 +0000)]
ARM: l2c: ux500: don't try to change the L2 cache auxiliary control register

ux500 can't change the auxiliary control register, so there's no point
passing values to try and modify it to the l2x0 init functions.

Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: ux500: remove cache size override
Russell King [Wed, 19 Mar 2014 01:22:05 +0000 (01:22 +0000)]
ARM: l2c: ux500: remove cache size override

The cache size should already be present in the L2 cache auxiliary
control register: it is part of the integration process to configure
the hardware IP.  Most platforms get this right, yet still many
cargo-cult program, and assume that they always need specifying to
the L2 cache code.  Remove them so we can find out which really need
this.

Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: ux500: implement dummy write_sec method
Russell King [Sun, 16 Mar 2014 19:15:21 +0000 (19:15 +0000)]
ARM: l2c: ux500: implement dummy write_sec method

ux500 can't write to any of the secure registers on the L2C controllers,
so provide a dummy handler which ignores all writes.

Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: tegra: convert to generic l2c OF initialisation
Russell King [Mon, 28 Apr 2014 14:36:04 +0000 (15:36 +0100)]
ARM: l2c: tegra: convert to generic l2c OF initialisation

Remove the explicit call to l2x0_of_init(), converting to the generic
infrastructure instead.

Acked-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: tegra: convert to common l2c310 early resume functionality
Russell King [Sat, 5 Apr 2014 10:50:38 +0000 (11:50 +0100)]
ARM: l2c: tegra: convert to common l2c310 early resume functionality

Acked-by: Stephen Warren <swarren@nvidia.com>
Tested-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Joseph Lo <josephl@nvidia.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: tegra: remove cache size override
Russell King [Wed, 19 Mar 2014 01:17:21 +0000 (01:17 +0000)]
ARM: l2c: tegra: remove cache size override

The cache size should already be present in the L2 cache auxiliary
control register: it is part of the integration process to configure
the hardware IP.  Most platforms get this right, yet still many
cargo-cult program, and assume that they always need specifying to
the L2 cache code.  Remove them so we can find out which really need
this.

Acked-by: Stephen Warren <swarren@nvidia.com>
Tested-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Peter De Schrijver <pdeschrijver@nvidia.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: sti: convert to generic l2c OF initialisation
Russell King [Mon, 28 Apr 2014 14:49:48 +0000 (15:49 +0100)]
ARM: l2c: sti: convert to generic l2c OF initialisation

Remove the explicit call to l2x0_of_init(), converting to the generic
infrastructure instead.  We can remove the .init_machine as it becomes
the same as the generic version.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: spear13xx: remove cache size override
Russell King [Wed, 19 Mar 2014 12:18:02 +0000 (12:18 +0000)]
ARM: l2c: spear13xx: remove cache size override

The cache size should already be present in the L2 cache auxiliary
control register: it is part of the integration process to configure
the hardware IP.  Most platforms get this right, yet still many
cargo-cult program, and assume that they always need specifying to
the L2 cache code.  Remove them so we can find out which really need
this.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: socfpga: convert to generic l2c OF initialisation
Russell King [Mon, 28 Apr 2014 14:55:59 +0000 (15:55 +0100)]
ARM: l2c: socfpga: convert to generic l2c OF initialisation

Remove the explicit call to l2x0_of_init(), converting to the generic
infrastructure instead.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: shmobile: remove cache size override
Russell King [Wed, 19 Mar 2014 12:16:36 +0000 (12:16 +0000)]
ARM: l2c: shmobile: remove cache size override

The cache size should already be present in the L2 cache auxiliary
control register: it is part of the integration process to configure
the hardware IP.  Most platforms get this right, yet still many
cargo-cult program, and assume that they always need specifying to
the L2 cache code.  Remove them so we can find out which really need
this.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: rockchip: convert to generic l2c OF initialisation
Russell King [Mon, 28 Apr 2014 14:27:59 +0000 (15:27 +0100)]
ARM: l2c: rockchip: convert to generic l2c OF initialisation

Remove the explicit call to l2x0_of_init(), converting to the generic
infrastructure instead.  This also allows us to eliminate the
.init_machine function as this becomes the same as the generic version.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: realview: improve commentry about the L2 cache requirements
Russell King [Wed, 19 Mar 2014 14:53:54 +0000 (14:53 +0000)]
ARM: l2c: realview: improve commentry about the L2 cache requirements

Add better commentry about the L2 cache requirements on these platforms.
Unfortunately, the auxiliary control register is not pre-set to indicate
the correct cache parameters, so we have to manually program these.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: prima2: convert to generic l2c OF initialisation
Russell King [Mon, 28 Apr 2014 14:41:08 +0000 (15:41 +0100)]
ARM: l2c: prima2: convert to generic l2c OF initialisation

Remove the explicit call to l2x0_of_init(), converting to the generic
infrastructure instead.  Along with this change, we can delete l2x0.c
from prima2.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: prima2: remove cache size override
Russell King [Wed, 19 Mar 2014 12:14:18 +0000 (12:14 +0000)]
ARM: l2c: prima2: remove cache size override

The cache size should already be present in the L2 cache auxiliary
control register: it is part of the integration process to configure
the hardware IP.  Most platforms get this right, yet still many
cargo-cult program, and assume that they always need specifying to
the L2 cache code.  Remove them so we can find out which really need
this.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: AM43x: add L2 cache support
Sekhar Nori [Tue, 22 Apr 2014 08:28:03 +0000 (13:58 +0530)]
ARM: l2c: AM43x: add L2 cache support

Add support for L2 cache controller (PL310) on AM437x SoC.

Signed-off-by: Sekhar Nori <nsekhar@ti.com>
Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: omap2+: get rid of init call
Sekhar Nori [Tue, 22 Apr 2014 08:28:01 +0000 (13:58 +0530)]
ARM: l2c: omap2+: get rid of init call

Get rid of init call to initialize L2 cache.  Instead use the init_early
machine hook. This helps in using the initialization routine across
SoCs without the need of ugly cpu_is_*() checks.

Signed-off-by: Sekhar Nori <nsekhar@ti.com>
Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: omap2+: get rid of redundant cache replacement policy setting
Sekhar Nori [Tue, 22 Apr 2014 08:28:02 +0000 (13:58 +0530)]
ARM: l2c: omap2+: get rid of redundant cache replacement policy setting

L2 cache initialization for OMAP4 redundantly sets the cache policy to
Round-Robin. This is not needed since thats the PL310 default anyway.

Removing this reduces the number of platform specific aux control
settings.

Signed-off-by: Sekhar Nori <nsekhar@ti.com>
Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: omap2: avoid reading directly from the L2 registers in platform code
Russell King [Sat, 5 Apr 2014 09:57:44 +0000 (10:57 +0100)]
ARM: l2c: omap2: avoid reading directly from the L2 registers in platform code

Avoid reading directly from the L2 registers in platform code.  The L2
code will have already saved the register values itself into the
l2x0_saved_regs structure, so platform code should just move these
values to where they're required.

This is safe because the L2x0 will have been initialised by an early
initcall, whereas the OMAP4 PM code is initialised late.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: omap2: remove explicit non-secure access bits
Russell King [Thu, 10 Apr 2014 23:48:25 +0000 (00:48 +0100)]
ARM: l2c: omap2: remove explicit non-secure access bits

Since we now always enable NS access to the unlock registers, this can
be removed from OMAP4.  Remove the NS access bit for the interrupt
registers from OMAP4 as well - nothing in the kernel accesses that yet,
and we can add it in core code when we have the need.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: omap2: remove cache size override
Russell King [Mon, 17 Mar 2014 16:53:31 +0000 (16:53 +0000)]
ARM: l2c: omap2: remove cache size override

The cache size should already be present in the L2 cache auxiliary
control register: it is part of the integration process to configure
the hardware IP.  Most platforms get this right, yet still many
cargo-cult program, and assume that they always need specifying to
the L2 cache code.  Remove them so we can find out which really need
this.

Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: omap2: remove explicit SMI calls to enable L2 cache
Russell King [Mon, 17 Mar 2014 16:35:46 +0000 (16:35 +0000)]
ARM: l2c: omap2: remove explicit SMI calls to enable L2 cache

Now that OMAP2 uses the write_sec method, we don't need to enable the L2
cache in OMAP2 specific code; this can be done via the normal mechanisms
in the L2C code.  Remove the OMAP2 specific code.

Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: omap2: implement new write_sec method
Russell King [Sun, 16 Mar 2014 17:45:56 +0000 (17:45 +0000)]
ARM: l2c: omap2: implement new write_sec method

With the write_sec method, we no longer need to override the default
L2C disable method, and we no longer need the L2C set_debug method.
Both of these can be handled via the write_sec method.

Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: nomadik: convert to generic l2c OF initialisation
Russell King [Mon, 28 Apr 2014 14:27:59 +0000 (15:27 +0100)]
ARM: l2c: nomadik: convert to generic l2c OF initialisation

Remove the explicit call to l2x0_of_init(), converting to the generic
infrastructure instead.  This also allows us to eliminate the
.init_machine function as it is identical to the generic version.

Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: nomadik: remove cache size override
Russell King [Wed, 19 Mar 2014 12:10:16 +0000 (12:10 +0000)]
ARM: l2c: nomadik: remove cache size override

The cache size should already be present in the L2 cache auxiliary
control register: it is part of the integration process to configure
the hardware IP.  Most platforms get this right, yet still many
cargo-cult program, and assume that they always need specifying to
the L2 cache code.  Remove them so we can find out which really need
this.

Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: mvebu: convert to generic l2c OF initialisation
Russell King [Mon, 28 Apr 2014 14:44:47 +0000 (15:44 +0100)]
ARM: l2c: mvebu: convert to generic l2c OF initialisation

Remove the explicit call to l2x0_of_init(), converting to the generic
infrastructure instead.

Acked-by: Jason Cooper <jason@lakedaemon.net>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: imx vf610: convert to generic l2c OF initialisation
Russell King [Mon, 28 Apr 2014 14:48:14 +0000 (15:48 +0100)]
ARM: l2c: imx vf610: convert to generic l2c OF initialisation

Remove the explicit call to l2x0_of_init(), converting to the generic
infrastructure instead.  Since the .init_irq method only calls
irqchip_init(), we can remove that too as the generic code will take
care of that.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: imx: convert to common l2c310 early resume functionality
Russell King [Sat, 5 Apr 2014 10:55:03 +0000 (11:55 +0100)]
ARM: l2c: imx: convert to common l2c310 early resume functionality

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: imx: remove direct write to power control register
Russell King [Fri, 28 Mar 2014 14:36:38 +0000 (14:36 +0000)]
ARM: l2c: imx: remove direct write to power control register

Now that we handle this in core code, we don't need platforms enabling
the low power modes directly.

Acked-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: highbank: convert to generic l2c OF initialisation
Russell King [Mon, 28 Apr 2014 14:34:11 +0000 (15:34 +0100)]
ARM: l2c: highbank: convert to generic l2c OF initialisation

Remove the explicit call to l2x0_of_init(), converting to the generic
infrastructure instead.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: highbank: remove explicit SMI call in L2 cache initialisation
Russell King [Mon, 17 Mar 2014 22:42:48 +0000 (22:42 +0000)]
ARM: l2c: highbank: remove explicit SMI call in L2 cache initialisation

Now that highbank uses the write_sec method, we don't need to enable
the L2 cache in SoC specific code; this can be done via the normal
mechanisms in the L2C code.

Checking with Rob Herring:
> > Can we kill the "highbank_smc1(0x102, 0x1);" here? That means
> > l2x0_of_init() will see the L2 cache disabled, and will try to enable
> > it via the write_sec hook, so it should do the right thing.
>
> Yes, that should work. You should be able to just call l2x0_of_init
> unconditionally. The condition was really to just avoid the smc on
> Midway which does get handled on h/w, but not if running virtualized.

So also drop the DT check too.  I'm leaving the config check in place
so that if L2 is disabled, the write_sec hook can be optimised away.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: highbank: implement new write_sec method
Russell King [Sun, 16 Mar 2014 17:53:23 +0000 (17:53 +0000)]
ARM: l2c: highbank: implement new write_sec method

With the write_sec method, we no longer need to override the default L2C
disable method.  This can be handled via the write_sec method instead.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: exynos: convert to generic l2c OF initialisation (and thereby fix it)
Russell King [Mon, 28 Apr 2014 14:54:08 +0000 (15:54 +0100)]
ARM: l2c: exynos: convert to generic l2c OF initialisation (and thereby fix it)

exynos was unconditionally calling the L2 cache initialisation from an
early_initcall.  This breaks multiplatform kernels.  Thankfully,
converting to generic l2c initialisation fixes this.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: exynos: convert to common l2c310 early resume functionality
Russell King [Sat, 5 Apr 2014 10:45:34 +0000 (11:45 +0100)]
ARM: l2c: exynos: convert to common l2c310 early resume functionality

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: exynos: remove cache size override
Russell King [Wed, 19 Mar 2014 12:07:34 +0000 (12:07 +0000)]
ARM: l2c: exynos: remove cache size override

The cache size should already be present in the L2 cache auxiliary
control register: it is part of the integration process to configure
the hardware IP.  Most platforms get this right, yet still many
cargo-cult program, and assume that they always need specifying to
the L2 cache code.  Remove them so we can find out which really need
this.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: cns3xxx: remove cache size override
Russell King [Wed, 19 Mar 2014 12:06:27 +0000 (12:06 +0000)]
ARM: l2c: cns3xxx: remove cache size override

The cache size should already be present in the L2 cache auxiliary
control register: it is part of the integration process to configure
the hardware IP.  Most platforms get this right, yet still many
cargo-cult program, and assume that they always need specifying to
the L2 cache code.  Remove them so we can find out which really need
this.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: berlin: convert to generic l2c OF initialisation
Russell King [Mon, 28 Apr 2014 14:57:21 +0000 (15:57 +0100)]
ARM: l2c: berlin: convert to generic l2c OF initialisation

Remove the explicit call to l2x0_of_init(), converting to the generic
infrastructure instead.  We can remove the explicit machine init too
as this becomes identical to the generic version.

Acked-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: bcm_5301x: convert to generic l2c OF initialisation
Russell King [Mon, 28 Apr 2014 14:27:59 +0000 (15:27 +0100)]
ARM: l2c: bcm_5301x: convert to generic l2c OF initialisation

Remove the explicit call to l2x0_of_init(), converting to the generic
infrastructure instead.  We can remove the explicit machine init too
as this becomes identical to the generic version.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: provide common PL310 early resume code
Russell King [Sat, 5 Apr 2014 10:39:57 +0000 (11:39 +0100)]
ARM: l2c: provide common PL310 early resume code

Provide a common assembly implementation for PL310 resume code.  Certain
platforms need to re-initialise the L2C cache early as it may preserve
data across a S2RAM cycle, and therefore must be enabled along with the
L1 cache and MMU.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: add platform independent core L2 cache OF initialisation
Russell King [Mon, 28 Apr 2014 14:24:10 +0000 (15:24 +0100)]
ARM: l2c: add platform independent core L2 cache OF initialisation

Add a hook into the core ARM code to perform L2 cache initialisation
in a platform independent manner.  Platforms still get to indicate
their auxiliary control register values and mask, but the
initialisation call will now be made from generic code.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: always enable non-secure access to lockdown registers
Russell King [Thu, 10 Apr 2014 23:48:25 +0000 (00:48 +0100)]
ARM: l2c: always enable non-secure access to lockdown registers

Since we always write to these during the cache initialisation, it is
a good idea to always have the non-secure access bit set.  Set it in
core code.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: always enable low power modes
Russell King [Fri, 28 Mar 2014 14:22:04 +0000 (14:22 +0000)]
ARM: l2c: always enable low power modes

Always enable the L2C low power modes on L2C-310 R3P0 and newer parts.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: remove platforms/SoCs setting early BRESP
Russell King [Wed, 19 Mar 2014 12:44:41 +0000 (12:44 +0000)]
ARM: l2c: remove platforms/SoCs setting early BRESP

Since we now automatically enable early BRESP in core L2C-310 code when
we detect a Cortex-A9, we don't need platforms/SoCs to set this bit
explicitly.  Instead, they should seek to preserve the value of bit 30
in the auxiliary control register.

Acked-by: Tony Lindgren <tony@atomide.com>
Acked-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: add automatic enable of early BRESP
Russell King [Wed, 19 Mar 2014 15:39:09 +0000 (15:39 +0000)]
ARM: l2c: add automatic enable of early BRESP

The AXI bus protocol requires that a write response should only be
sent back to the master when the last write has been accepted.  Early
BRESP allows the L2C-310 to send the write response as soon as the
store buffer accepts the write address.

Cortex-A9 processors can signal to the L2C-310 that they wish to be
notified early, and if this optimisation is enabled, the L2C-310 can
signal an early write response.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: move L2 cache register saving to a more sensible location
Russell King [Fri, 28 Mar 2014 14:18:35 +0000 (14:18 +0000)]
ARM: l2c: move L2 cache register saving to a more sensible location

Move the L2 cache register saving to a more sensible location - after
the cache has been enabled, and fixups have been run.  We move the
saving of the auxiliary control register into the ->save function as
well which makes everything operate in a sane and maintainable way.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: check that DT files specify the required "cache-unified" property
Russell King [Mon, 17 Mar 2014 12:59:08 +0000 (12:59 +0000)]
ARM: l2c: check that DT files specify the required "cache-unified" property

This is a required property, and should always be specified.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: fix register naming
Russell King [Sun, 16 Mar 2014 20:52:25 +0000 (20:52 +0000)]
ARM: l2c: fix register naming

We have a mixture of different devices with different register layouts,
but we group all the bits together in an opaque mess.  Split them out
into those which are L2C-310 specific and ones which refer to earlier
devices.  Provide full auxiliary control register definitions.

Acked-by: Tony Lindgren <tony@atomide.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Shawn Guo <shawn.guo@linaro.org>
Acked-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: implement L2C-310 erratum 752271 in core L2C code
Russell King [Sun, 16 Mar 2014 20:02:06 +0000 (20:02 +0000)]
ARM: l2c: implement L2C-310 erratum 752271 in core L2C code

Rather than having SoCs work around L2C erratum themselves, move them
into core code.  This erratum affects the double linefill feature which
needs to be disabled for r3p0 to r3p1-50rel0.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: provide generic hook to intercept writes to secure registers
Russell King [Sun, 16 Mar 2014 17:38:08 +0000 (17:38 +0000)]
ARM: l2c: provide generic hook to intercept writes to secure registers

When Linux is running in the non-secure world, any write to a secure
L2C register will generate an abort.  Platforms normally have to call
firmware to work around this.  Provide a hook for them to intercept
any L2C secure register write.

l2c_write_sec() avoids writes to secure registers which are already set
to the appropriate value, thus avoiding the overhead of needlessly
calling into the secure monitor.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: move errata configuration options to arch/arm/mm/Kconfig
Russell King [Sun, 16 Mar 2014 12:12:11 +0000 (12:12 +0000)]
ARM: l2c: move errata configuration options to arch/arm/mm/Kconfig

Move the L2C-310 errata configuration options to arch/arm/mm/Kconfig
along side the option which enables support for this device.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: move way size calculation data into l2c_init_data
Russell King [Sat, 15 Mar 2014 23:26:24 +0000 (23:26 +0000)]
ARM: l2c: move way size calculation data into l2c_init_data

Move the way size calculation data (base of way size) out of the
switch statement into the provided initialisation data.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: add decode for L2C-220 cache ways
Russell King [Sat, 15 Mar 2014 23:07:07 +0000 (23:07 +0000)]
ARM: l2c: add decode for L2C-220 cache ways

Rather than assuming these are always 8-way, it can be decoded from the
auxillary register in the same manner as L2C-210.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: move type string into l2c_init_data structure
Russell King [Sat, 15 Mar 2014 23:04:10 +0000 (23:04 +0000)]
ARM: l2c: move type string into l2c_init_data structure

Rather than decoding this from the ID register, store it in the
l2c_init_data structure.  This simplifies things some more, and
allows us to better provide further details as to how we're
driving the cache.  We print the cache ID value anyway should we
need to precisely identify the cache hardware.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: remove obsolete l2x0 ops for non-OF init
Russell King [Sat, 15 Mar 2014 22:44:38 +0000 (22:44 +0000)]
ARM: l2c: remove obsolete l2x0 ops for non-OF init

non-OF initialisation has never been used with any cache controller
which isn't an ARM cache controller, so we can safely get rid of the
old (and buggy) l2x0_*-based operations structure.

This is also the last reference to:
- l2x0_clean_line()
- l2x0_inv_line()
- l2x0_flush_line()
- l2x0_flush_all()
- l2x0_clean_all()
- l2x0_inv_all()
- l2x0_inv_range()
- l2x0_clean_range()
- l2x0_flush_range()
- l2x0_enable()
- l2x0_resume()
so kill those functions too.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: convert Broadcom L2C-310 to new code
Russell King [Wed, 19 Mar 2014 19:14:13 +0000 (19:14 +0000)]
ARM: l2c: convert Broadcom L2C-310 to new code

The Broadcom L2C-310 devices use ARMs L2C-310 R2P3 or later.  These
require no errata workarounds, and so we can directly call the l2c210
functions from their methods.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: add L2C-220 specific handlers
Russell King [Sat, 15 Mar 2014 21:29:28 +0000 (21:29 +0000)]
ARM: l2c: add L2C-220 specific handlers

The L2C-220 is different from the L2C-210 and L2C-310 in that every
operation is a background operation: this means we have to use
spinlocks to protect all operations, and we have to wait for every
operation to complete.

Should a second operation be attempted while a previous operation
is in progress, the response will be an imprecise abort.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: use L2C-210 handlers for L2C-310 errata-less implementations
Russell King [Sat, 15 Mar 2014 20:51:47 +0000 (20:51 +0000)]
ARM: l2c: use L2C-210 handlers for L2C-310 errata-less implementations

Where no errata affect the L2C-310 handlers, they are functionally
equivalent to L2C-210.  Re-use the L2C-210 handlers for the L2C-310
part.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: implement L2C-310 erratum 588369 as a method override
Russell King [Sat, 15 Mar 2014 19:08:11 +0000 (19:08 +0000)]
ARM: l2c: implement L2C-310 erratum 588369 as a method override

Implement L2C-310 erratum 588369 by overriding the invalidate range
and flush range methods in the outer_cache operations structure.
This allows us to sensibly contain the erratum code in one place
without affecting other locations/implemetations.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: implement L2C-310 erratum 727915 as a method override
Russell King [Sat, 15 Mar 2014 16:48:18 +0000 (16:48 +0000)]
ARM: l2c: implement L2C-310 erratum 727915 as a method override

Implement L2C-310 erratum 727915 by overriding the flush_all method
in the outer_cache operations structure.  This allows us to sensibly
contain the erratum code in one place without affecting other
locations or implementations.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: add L2C-210 specific handlers
Russell King [Sat, 15 Mar 2014 18:55:53 +0000 (18:55 +0000)]
ARM: l2c: add L2C-210 specific handlers

Add L2C-210 specific cache operation handlers.  These are tailored to
the requirements of the L2C-210 cache controller, which doesn't
require any workarounds.  We avoid using the way operations during
normal operation, which means we can avoid locking: the only time
we use the way operations are during initialisation, and when
disabling the cache.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: move pl310_set_debug() into l2c-310 code
Russell King [Sat, 15 Mar 2014 16:48:16 +0000 (16:48 +0000)]
ARM: l2c: move pl310_set_debug() into l2c-310 code

Move the pl310_set_debug() into the l2c-310 code area, and don't hide
it with ifdefs.  Rename it to l2c310_set_debug().

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: simplify l2x0 unlocking code
Russell King [Sat, 15 Mar 2014 22:49:59 +0000 (22:49 +0000)]
ARM: l2c: simplify l2x0 unlocking code

The l2x0 unlocking code is only called from l2x0_enable() now, so move
the logic entirely into that function and simplify it.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: clean up save/resume functions
Russell King [Sat, 15 Mar 2014 16:48:13 +0000 (16:48 +0000)]
ARM: l2c: clean up save/resume functions

Rename the pl310 save/resume functions to have a l2c310 prefix - this
is it's official name.  Use a local cached copy of the l2x0_base
virtual address, and also realise that many of the resume function
tails are the same as the enable functions, so make a call to the
enable function instead of duplicating that code.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: move and add ARM L2C-2x0/L2C-310 save/resume code to non-OF
Russell King [Sat, 15 Mar 2014 16:48:11 +0000 (16:48 +0000)]
ARM: l2c: move and add ARM L2C-2x0/L2C-310 save/resume code to non-OF

Add the save/resume code hooks to the non-OF implementations as well.
There's no reason for the non-OF implementations to be any different
from the OF implementations.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: clean up L2 cache initialisation messages
Russell King [Sat, 15 Mar 2014 16:48:08 +0000 (16:48 +0000)]
ARM: l2c: clean up L2 cache initialisation messages

Make one of them purely "English", and the other purely technical.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: implement fixups for L2 cache controller quirks/errata
Russell King [Sat, 15 Mar 2014 16:48:07 +0000 (16:48 +0000)]
ARM: l2c: implement fixups for L2 cache controller quirks/errata

Rather than putting quirk handling in __l2c_init(), move it out to a
separate function which individual implementations can specify.  This
helps to localise the quirks to those implementations which require
them.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: move aurora broadcast setup to enable function
Russell King [Sat, 15 Mar 2014 16:47:59 +0000 (16:47 +0000)]
ARM: l2c: move aurora broadcast setup to enable function

Rather than having this hacked into the OF initialiation function, we
can handle this via the enable function instead.  While here, clean
up that code and comments a little.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: only write the auxiliary control register if required
Russell King [Mon, 17 Mar 2014 20:10:31 +0000 (20:10 +0000)]
ARM: l2c: only write the auxiliary control register if required

Avoid unnecessary writes to the auxiliary control register if the
register already contains the required value.  This allows us to
avoid invoking the platforms secure monitor code unnecessarily.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: write auxctrl register before unlocking
Russell King [Mon, 17 Mar 2014 17:15:02 +0000 (17:15 +0000)]
ARM: l2c: write auxctrl register before unlocking

We should write the auxillary control register before unlocking: the
write may be necessary to enable non-secure access to the lock
registers.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: provide enable method
Russell King [Sat, 15 Mar 2014 16:47:57 +0000 (16:47 +0000)]
ARM: l2c: provide enable method

Providing an enable method gives L2 cache controllers a chance to do
special handling at enable time.  This allows us to remove a hack in
l2x0_unlock() for Marvell Aurora L2 caches.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: group implementation specific code together
Russell King [Sat, 15 Mar 2014 16:48:06 +0000 (16:48 +0000)]
ARM: l2c: group implementation specific code together

Back in the mists of time, someone decided that it would be a good idea
to group like functions together - so all the save functions in one
place, all the resume functions in another, all the OF parsing functions
some place else.

This makes it difficult to get an overview on what a particular
implementation is doing - grouping an implementations specific functions
together makes more sense, because you can see what it's doing without
the clutter of other implementations.

Organise it according to implementation.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: move l2c save function to __l2c_init()
Russell King [Sat, 15 Mar 2014 16:48:04 +0000 (16:48 +0000)]
ARM: l2c: move l2c save function to __l2c_init()

There's no reason this functionality should be specific to DT, so move
it into the common initialisation function.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: pass iomem address into data->save function
Russell King [Sat, 15 Mar 2014 16:47:55 +0000 (16:47 +0000)]
ARM: l2c: pass iomem address into data->save function

Pass the iomem address into this function so we don't have to keep
accessing it from a global.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: clean up OF initialisation a bit
Russell King [Sat, 15 Mar 2014 16:47:52 +0000 (16:47 +0000)]
ARM: l2c: clean up OF initialisation a bit

Rather than having a boolean and other tricks to disable some bits of
l2x0_init(), split this function into two parts: a common part shared
between OF and non-OF, and the non-OF part.

The common part can take a block of function pointers, and the cache
ID (to cope with Aurora's DT specified ID.)  Eliminate the redundant
setting of l2x0_base in the OF case, moving it to the non-OF init
function.

This allows us to localise the OF-specific initialisation handling
from the non-OF handling.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: add and use L2C revision constants
Russell King [Sat, 15 Mar 2014 16:47:49 +0000 (16:47 +0000)]
ARM: l2c: add and use L2C revision constants

The revision namespace is specific to the L2 cache part, so don't name
these with generic identifiers, use a part specific identifier.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: l2c: rename cache_wait_way()
Russell King [Sat, 15 Mar 2014 16:48:14 +0000 (16:48 +0000)]
ARM: l2c: rename cache_wait_way()

cache_wait_way() is actually used to wait for a particular mask to
report clear; it's not really got much to do with cache ways at all.
Indeed, it gets used to wait for the C bit to clear on older caches.
Rename this with a more generic function name which better reflects
its purpose: l2c_wait_mask().

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>