Commit graph

2801 commits

Author SHA1 Message Date
Paul Mundt
028c5d5d59 Merge branch 'sh/stable-updates' 2010-02-15 14:49:37 +09:00
Paul Mundt
4b505db9c4 sh64: fix tracing of signals.
This follows the parisc change to ensure that tracehook_signal_handler()
is aware of when we are single-stepping in order to ptrace_notify()
appropriately. While this was implemented for 32-bit SH, sh64 neglected
to make use of TIF_SINGLESTEP when it was folded in with the 32-bit code,
resulting in ptrace_notify() never being called.

As sh64 uses all of the other abstractions already, this simply plugs in
the thread flag in the appropriate enable/disable paths and fixes up the
tracehook notification accordingly. With this in place, sh64 is brought
in line with what 32-bit is already doing.

Reported-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-02-15 14:17:45 +09:00
Paul Mundt
19f6b8b44e sh64: fix up memory offset calculation.
The linker script offsets were broken by the recent 29/32-bit
integration, so this fixes it up for sh64.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-02-12 15:41:45 +09:00
Paul Mundt
b0f3ae03ac sh: Isolate uncached mapping support.
This splits out the uncached mapping support under its own config option,
presently only used by 29-bit mode and 32-bit + PMB. This will make it
possible to optionally add an uncached mapping on sh64 as well as booting
without an uncached mapping for 32-bit.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-02-12 15:40:00 +09:00
Paul Mundt
a4dad4c75c sh: update sdk7786 defconfig.
This plugs in USB and PCI and other bits for SDK7786.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-02-10 16:06:42 +09:00
Paul Mundt
7578a4c625 sh: Fix up multi-resource mapping for SH7786 PCIe.
This reworks some of the SH7786 PCIe initialization code to dynamically
setup and size the various resource windows, as opposed to the original
code that simply wired in a couple of them statically.

At the same time, we tidy up the initialization code a bit, kill off some
read-only register twiddling that was gleaned from the bus analyzer, and
also propagate the physical slot/channel mapping.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-02-10 16:00:58 +09:00
Magnus Damm
801cd56e3e sh: break out enable/reparent div4 clocks on sh7723
Break out sh7723 div4 clocks for SIU and IRDA as
reparent / enable clocks. Similar to the SIU clock
patch for sh7722 by Guennadi.

Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-02-09 18:24:31 +09:00
Magnus Damm
3844eadcfd sh: sh7724/Ecovec24/KFR2R09/MS7724SE SDHI vector merge
Merge the SDHI vectors in the sh7724 INTC table
and update the SDHI platform data for Ecovec24,
KFR2R09 and MS7724SE.

Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-02-09 18:24:30 +09:00
Magnus Damm
e3e80046e0 sh: sh7723/AP325 SDHI vector merge
Merge the SDHI vectors in the sh7723 INTC table
and update the SDHI platform data for AP325.

Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-02-09 18:24:30 +09:00
Magnus Damm
8d9adabac3 sh: sh7722/Migo-R SDHI vector merge
Merge the SDHI vectors in the sh7722 INTC table
and update the SDHI platform data for Migo-R.

Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-02-09 18:24:29 +09:00
Paul Mundt
7561f2dd39 sh: Fix up SH7786 PCI resource definitions.
This adds in some of the missing memory resources for channels 1/2 and
gets the code building again for the recent changes.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-02-08 16:36:56 +09:00
Paul Mundt
13fd7aeb9a Merge branches 'sh/dwarf-unwinder', 'sh/g3-prep' and 'sh/stable-updates' 2010-02-08 11:48:10 +09:00
Paul Mundt
2e18e04798 Merge branch 'sh/dmaengine'
Conflicts:
	arch/sh/drivers/dma/dma-sh.c
2010-02-08 11:34:03 +09:00
Matt Fleming
858918b77b sh: Optimise FDE/CIE lookup by using red-black trees
Now that the DWARF unwinder is being used to provide perf callstacks
unwinding speed is an issue. It is no longer being used in exceptional
circumstances where we don't care about runtime performance, e.g. when
panicing, so it makes sense improve performance is possible.

With this patch I saw a 42% improvement in unwind time when calling
return_address(1). Greater improvements will be seen as the number of
levels unwound increases as each unwind is now cheaper.

Note that insertion time has doubled but that's just the price we pay
for keeping the trees balanced. However, this is a one-time cost for
kernel boot/module load and so the improvements in lookup time dominate
the extra time we spend keeping the trees balanced.

Signed-off-by: Matt Fleming <matt@console-pimps.org>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-02-08 11:29:15 +09:00
Matt Fleming
1af0b2fc67 sh: Remove superfluous setup_frame_reg call
There's no need to setup the frame pointer again in
call_handle_tlbmiss. The frame pointer will already have been setup in
handle_interrupt.

Signed-off-by: Matt Fleming <matt@console-pimps.org>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-02-08 10:47:11 +09:00
Matt Fleming
944a343861 sh: Don't continue unwinding across interrupts
Unfortunately, due to poor DWARF info in current toolchains, unwinding
through interrutps cannot be done reliably. The problem is that the
DWARF info for function epilogues is wrong.

Take this standard epilogue sequence,

80003cc4:       e3 6f           mov     r14,r15
80003cc6:       26 4f           lds.l   @r15+,pr
80003cc8:       f6 6e           mov.l   @r15+,r14
						<---- interrupt here
80003cca:       f6 6b           mov.l   @r15+,r11
80003ccc:       f6 6a           mov.l   @r15+,r10
80003cce:       f6 69           mov.l   @r15+,r9
80003cd0:       0b 00           rts

If we take an interrupt at the highlighted point, the DWARF info will
bogusly claim that the return address can be found at some offset from
the frame pointer, even though the frame pointer was just restored. The
worst part is if the unwinder finds a text address at the bogus stack
address - unwinding will continue, for a bit, until it finally comes
across an unexpected address on the stack and blows up.

The only solution is to stop unwinding once we've calculated the
function that was executing when the interrupt occurred. This PC can be
easily calculated from pt_regs->pc.

Signed-off-by: Matt Fleming <matt@console-pimps.org>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-02-08 10:47:04 +09:00
Matt Fleming
1dca56f138 sh: Setup frame pointer in handle_exception path
In order to allow the DWARF unwinder to unwind through exceptions we
need to setup the frame pointer register (r14).

Signed-off-by: Matt Fleming <matt@console-pimps.org>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-02-08 10:46:53 +09:00
Matt Fleming
142698282c sh: Correct the offset of the return address in ret_from_exception
The address that ret_from_exception and ret_from_irq will return to is
found in the stack slot for SPC, not PR. This error was causing the
DWARF unwinder to pick up the wrong return address on the stack and then
unwind using the unwind tables for the wrong function.

While I'm here I might as well add CFI annotations for the other
registers since they could be useful when unwinding.

Signed-off-by: Matt Fleming <matt@console-pimps.org>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-02-08 10:46:46 +09:00
Guennadi Liakhovetski
cfefe99795 sh: implement DMA_SLAVE capability in SH dmaengine driver
Tested to work with a SIU ASoC driver on sh7722 (migor).

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Acked-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-02-08 09:40:26 +09:00
Guennadi Liakhovetski
623b4ac4bf sh: fix Transfer Size calculation in both DMA drivers
Both the original arch/sh/drivers/dma/dma-sh.c and the new SH dmaengine drivers
do not take into account bits 3:2 of the Transfer Size field in the CHCR
register, besides, bit-field defines set bit 2, but the mask only passes bits
1:0 through. TS_16BLK and TS_32BLK macros are bogus too. This patch fixes all
these issues for sh7722 and sh7724, other CPUs stay unchanged and might need to
be fixed too.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Acked-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-02-08 09:40:24 +09:00
James Bottomley
c9334f6067 sh: add mm API for DMA to vmalloc/vmap areas
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-02-05 12:32:34 -06:00
Paul Mundt
b06ede84dd sh: Fix up hp6xx build.
With the sparseirq conversion there was a stray irq_desc reference left
over, this tidies it up and brings the demuxer in line with what the
solution engine boards are doing.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-02-05 17:45:14 +09:00
Paul Mundt
3b0be1a4f2 sh: Fix an off-by-1 in SH7780 PCIC memory resource mapping.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-02-05 16:11:25 +09:00
Paul Mundt
9ad62ec4f7 sh: Fix up early PCI PERR/SERR IRQ handling.
This adds support for handling early PERR/SERR triggering in between
controller registration and the initial bus scan. Buggy cards end up
asserting these as soon as the M66EN scan is undertaken, resulting in
an early crash.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-02-03 16:46:20 +09:00
Paul Mundt
37feecb0ae sh: Disable generic IRQ probing.
IRQ autoprobing hasn't actually worked for us at all since very early in
2.6, but no one seems to have noticed given that none of the drivers
that use it see much testing.

yenta_socket is the odd one out, and that depends on PCI IRQs which are
fixed on all SH platforms anyways. Consequently, turning off autoprobing
fixes up crashes triggered by yenta_socket and at least gets it working
again on r7785rp.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-02-02 19:17:42 +09:00
Paul Mundt
4b842c8571 sh: enable sparseirq for highlander and r2d.
highlander and r2d are the only remaining ones that were blocking
sparseirq being turned on by default, but it turns out that they already
work fine with it by virtue of register_intc_controller(). As such, we
can kill off the dependencies and turn it on by default.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-02-02 19:15:17 +09:00
Paul Mundt
deb9b22b89 sh: mach-dreamcast: Convert to sparseirq.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-02-02 18:01:55 +09:00
Paul Mundt
6eb6f98396 sh: hd6446x: Convert to sparseirq.
Follows the se7724 change and converts the hd64461 IRQ handling to
sparseirq.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-02-02 17:48:17 +09:00
Paul Mundt
c7a967273a sh: mach-se: Convert SH7724 solution engine FPGA to sparseirq.
This uses the new create_irq_nr() to build up the FPGA's desired virtual
IRQ mapping and permits us to finally flip on sparseirq for this board.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-02-02 17:38:04 +09:00
Guennadi Liakhovetski
b4f74767a0 sh: add high impedance mode management for SIUA pins on sh7722
This improves power management for the SIUA controller on sh7722. Similar
patches might be desired for other SIU-enabled SH platforms.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Acked-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-02-02 13:02:30 +09:00
Paul Mundt
9d3f1881ab Merge branch 'sh/stable-updates' 2010-02-02 11:33:45 +09:00
Marek Skuczynski
bc10e875d4 sh: Fix access to released memory in clk_debugfs_register_one()
Signed-off-by: Marek Skuczynski <mareksk7@gmail.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-02-02 11:32:23 +09:00
Marek Skuczynski
00b3e0a2e0 sh: Fix access to released memory in dwarf_unwinder_cleanup()
Signed-off-by: Marek Skuczynski <mareksk7@gmail.com>
Acked-by: Matt Fleming <matt@console-pimps.org>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-02-02 11:32:22 +09:00
Paul Mundt
b6c58b1d98 sh: Improved multi-resource handling for SH7780 PCI.
The SH7780 PCI controller supports 3 different ranges of PCI memory in
addition to its PCI I/O window. In the case of 29-bit mode, only 2 memory
windows are supported, while in 32-bit mode all 3 are visible. This
attempts to make the resource handling completely dynamic and to permit
platforms to map in as many apertures as they can handle.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-02-01 20:01:50 +09:00
Paul Mundt
ef407beefb sh: Hook up ERR/PERR/SERR detection for SH7780 PCI host controllers.
These were never handled before, so implement some common infrastructure
to support them, then make use of that in the SH7780-specific code. In
practice there is little here that can not be generalized for SH4 parts,
which will be an incremental change as the 7780/7751 code is gradually
unified.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-02-01 16:39:46 +09:00
Paul Mundt
bcf39352eb sh: Handle PCI controller resource conflicts.
register_pci_controller() can fail, but presently is a void function.
Change this over to an int so that we can bail early before continuing on
with post-registration initialization (such as throwing the controller in
to 66MHz mode in the case of the SH7780 host controller).

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-02-01 13:11:25 +09:00
Paul Mundt
85b59f5bb2 sh: Enable PCI66 support for SH7780 host controller.
This adds some helper glue for scanning the bus and determining if all
of the devices are 66MHz capable or not before flipping on 66MHz mode.
This isn't quite to spec, but it's fairly consistent with what other
embedded controllers end up having to do.

Scanning code cribbed from the MIPS txx9 PCI code.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-02-01 13:01:42 +09:00
Paul Mundt
aee4467b5c sh: Fix up large system memory handling for SH7780 PCI.
For systems that have more than 512MB we need to set up an additional
mapping, this fixes up the rounding to the next power of two and splits
out the mapping accordingly between the two local bus mapping windows.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-02-01 11:33:22 +09:00
Paul Mundt
31a090ae06 sh: Fix up asm/hw_breakpoint.h header check.
Presently headers_check complains about linux/kdebug.h being unexported,
so just bump the __KERNEL__ ifdef up, as per the x86 change.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-01-30 11:29:56 +09:00
Paul Mundt
97b19778ee sh: mach-se: Fix up irq_desc reference.
The irq_desc needs to be accessed with irq_to_desc(), this fixes up a
build error with irq_desc being undefined.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-01-30 11:04:38 +09:00
Paul Mundt
396c56a9c6 sh: Kill off broken type 1 PCI config access checks.
The host controllers only support type 1, so there's not much else to
test for. Some of the older controllers also supported type 2 accesses,
but we've never supported those, and likely never will. Beyond that, the
P1SEG test is meaningless for 32-bit mode, so rather than refactoring it,
just kill the type 1 test off completely.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-01-30 01:41:21 +09:00
Linus Torvalds
221af7f87b Split 'flush_old_exec' into two functions
'flush_old_exec()' is the point of no return when doing an execve(), and
it is pretty badly misnamed.  It doesn't just flush the old executable
environment, it also starts up the new one.

Which is very inconvenient for things like setting up the new
personality, because we want the new personality to affect the starting
of the new environment, but at the same time we do _not_ want the new
personality to take effect if flushing the old one fails.

As a result, the x86-64 '32-bit' personality is actually done using this
insane "I'm going to change the ABI, but I haven't done it yet" bit
(TIF_ABI_PENDING), with SET_PERSONALITY() not actually setting the
personality, but just the "pending" bit, so that "flush_thread()" can do
the actual personality magic.

This patch in no way changes any of that insanity, but it does split the
'flush_old_exec()' function up into a preparatory part that can fail
(still called flush_old_exec()), and a new part that will actually set
up the new exec environment (setup_new_exec()).  All callers are changed
to trivially comply with the new world order.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Cc: stable@kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2010-01-29 08:22:01 -08:00
Paul Mundt
320e68da59 sh: support PCI domains.
Newer SH parts are now commonly shipping with multiple controllers, so
we wire up PCI domain support to deal with them. Shamelessly cloned from
the MIPS implementation.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-01-29 22:38:13 +09:00
Paul Mundt
ac8ab54a8e sh: Bail out early on PCI resource conflicts.
Presently we just call in to request_resource() for the ioport and iomem
resources without checking for errors. This has already hidden a couple
of bugs, so add some error handling in for good measure.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-01-29 22:22:27 +09:00
Paul Mundt
a45635dfb0 sh: Reworked SH7780 PCI initialization.
This consolidates the PCI initialization code for all of the pci-sh7780
users, and sets up the memory window dynamically as opposed to using
hardcoded window positions.

A number of bugs were fixed at the same time, including the PIO handling
and master abort timeout settings being incorrect.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-01-29 22:19:04 +09:00
Ingo Molnar
ae7f6711d6 Merge branch 'perf/urgent' into perf/core
Merge reason: We want to queue up a dependent patch. Also update to
              later -rc's.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
2010-01-29 10:36:22 +01:00
Paul Mundt
9762528f37 sh: Kill off deprecated fixed PCI memory window accessors.
This kills off the deprected fixed memory range accessors for
the cases of non-translatable ioremapping.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-01-29 16:14:29 +09:00
Anton Blanchard
339ce1a4dc perf: Fix inconsistency between IP and callchain sampling
When running perf across all cpus with backtracing (-a -g), sometimes we
get samples without associated backtraces:

    23.44%         init  [kernel]                     [k] restore
    11.46%         init                       eeba0c  [k] 0x00000000eeba0c
     6.77%      swapper  [kernel]                     [k] .perf_ctx_adjust_freq
     5.73%         init  [kernel]                     [k] .__trace_hcall_entry
     4.69%         perf  libc-2.9.so                  [.] 0x0000000006bb8c
                       |
                       |--11.11%-- 0xfffa941bbbc

It turns out the backtrace code has a check for the idle task and the IP
sampling does not. This creates problems when profiling an interrupt
heavy workload (in my case 10Gbit ethernet) since we get no backtraces
for interrupts received while idle (ie most of the workload).

Right now x86 and sh check that current is not NULL, which should never
happen so remove that too.

Idle task's exclusion must be performed from the core code, on top
of perf_event_attr:exclude_idle.

Signed-off-by: Anton Blanchard <anton@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mundt <lethal@linux-sh.org>
LKML-Reference: <20100118054707.GT12666@kryten>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
2010-01-28 14:31:20 +01:00
Paul Mundt
abec86a802 sh: Kill off superfluous sh_bios references from compressed loader.
The VBR value needs to be initialized in order for any of the bios
trapping to work, and as we don't do that until slightly later in the
boot process, this has no real chance of working.

The only reason for using this in the past was due to the fact that early
serial initialization wasn't possible, but now that early sh-sci is
supported by everyone, there's no longer any reason to support the
sh_bios hacks in the first place. Given that, we just kill off the
references completely.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-01-28 18:26:37 +09:00
Paul Mundt
d627a2ebd1 sh: Fix up the ioremap_fixed() build for nommu.
arch/sh/kernel/setup.c:455: error: implicit declaration of function 'ioremap_fixed_init'

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-01-28 18:17:29 +09:00
Paul Mundt
849593591c sh: Fix up read-only variable assignment in pcibios_align_resource().
arch/sh/drivers/pci/pci.c:167: error: assignment of read-only location '*res'

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-01-28 18:15:05 +09:00
Paul Mundt
621266bdf4 sh: Quiet noisy coherent DMA unmapping on R2D.
IRQs are re-enabled at a later stage when doing the unmapping on R2D via
the sm501 USB coherent DMA, resulting in the irqs_disabled() check
producing considerable noise for this configuration. Just kill off the
check, which was blindly copied from x86 anyways.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-01-28 15:55:37 +09:00
Paul Mundt
f655f5e956 sh: mach-titan: Kill off unused PIO port mangling.
Nothing is using this, kill it off. Fixing up access sizes can be done
with trapped I/O for anyone wanting to make use of this for devices that
need it, everything else is already pure MMIO.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-01-28 15:08:21 +09:00
Giuseppe CAVALLARO
7013109f52 sh: fixed cmpxchg gRB version
This patch fixes a bug within the cmpxchg GRB version.

A problem was notices while running some tests to stress
the priority inheritance, for example pi_stress
(http://rt.wiki.kernel.org/index.php/PI_Mutex_Test).

Also, without this patch, after applying the latest work to
consolidate atomic_cmpxchg() definitions (commit:
8c0b8139c8)
the Kernel doesn't boot at all.

Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Signed-off-by: Stuart Menefy <stuart.menefy@st.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-01-27 22:36:25 +09:00
Chris Smith
660e2acad8 sh: kmemleak support.
Enables support for kmemleak on sh.

Signed-off-by: Chris Smith <chris.smith@st.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-01-27 22:03:11 +09:00
Paul Mundt
08b36c4a02 sh: Optimize runtime disabling of trapped I/O.
Presently trapped I/O is only registered if it's not explicitly disabled
for the platforms that select it openly. From the fault path this runs
through an address lookup before figuring out that nothing matches and
falls back through the error path, but we can forego the lookup
completely by testing if it's been explicitly disabled. This provides a
measurable speedup for things like qemu that rely on runtime disabling.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-01-27 21:56:57 +09:00
Paul Mundt
485773f3e4 sh: flag ctrl_in/outX as __deprecated.
These routines are unsuitable for cross-platform use and no new code
should be using them, flag them as deprecated in order to give drivers
sufficient time to migrate over.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-01-26 13:02:10 +09:00
Paul Mundt
9d56dd3b08 sh: Mass ctrl_in/outX to __raw_read/writeX conversion.
The old ctrl in/out routines are non-portable and unsuitable for
cross-platform use. While drivers/sh has already been sanitized, there
is still quite a lot of code that is not. This converts the arch/sh/ bits
over, which permits us to flag the routines as deprecated whilst still
building with -Werror for the architecture code, and to ensure that
future users are not added.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-01-26 12:58:40 +09:00
Mark Brown
f1487fcbe4 Merge branch 'for-2.6.33' into for-2.6.34 2010-01-25 14:52:48 +00:00
Guennadi Liakhovetski
895d4509d0 ASoC: add DAI and platform / DMA drivers for SH SIU
Several SuperH platforms, including sh7722, sh7343, sh7354, sh7367 include
a Sound Interface Unit (SIU). This patch adds DAI and platform / DMA
drivers for this interface.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2010-01-25 14:52:20 +00:00
Paul Mundt
a077e91690 sh: Conserve fixmap slots when IOREMAP_FIXED=n.
Presently the IOREMAP_FIXED fixmaps are always defined, even if the
platform isn't capable of supporting it. Since we already have an ifdef
for it, ifdef the entries, too.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-01-21 16:16:36 +09:00
Paul Mundt
2dc2f8e0c4 sh: Kill off the special uncached section and fixmap.
Now that cached_to_uncached works as advertized in 32-bit mode and we're
never going to be able to map < 16MB anyways, there's no need for the
special uncached section. Kill it off.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-01-21 16:05:25 +09:00
Paul Mundt
3125ee72dc sh: Track the uncached mapping size.
This provides a variable for tracking the uncached mapping size, and uses
it for pretty printing the uncached lowmem range. Beyond this, we'll also
be building on top of this for figuring out from where the remainder of
P2 becomes usable when constructing unrelated mappings.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-01-21 15:54:31 +09:00
Paul Mundt
2023b843d7 sh: Rework P2 to only include kernel text.
This effectively neutralizes P2 by getting rid of P1 identity mapping
for all available memory and instead only establishes a single unbuffered
PMB entry (16MB -- the smallest available) that covers the kernel.

As using segmentation for abusing caching attributes in drivers is no
longer supported (and there are no drivers that can be enabled in 32-bit
mode that do this), this provides us with all of the uncached access
needs by the kernel itself.

Drivers and their ilk need to specify their caching attributes when
remapping through page tables, as usual.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-01-21 15:42:58 +09:00
Paul Mundt
77c2019fc1 sh: initial PMB mapping iteration by helper macro.
All of the cached/uncached mapping setup is duplicated for each size, and
also misses out on the 16MB case. Rather than duplicating the same iter
code for that we just consolidate it in to a helper macro that builds an
iter for each size. The 16MB case is then trivially bolted on at the end.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-01-21 14:19:41 +09:00
Paul Mundt
35f99c0da1 sh: pretty print virtual memory map on boot.
This cribs the pretty printing from arch/x86/mm/init_32.c to dump the
virtual memory layout on boot. This is primarily intended as a debugging
aid, given that the newer CPUs have full control over their address space
and as such have little to nothing in common with the legacy layout.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-01-20 18:48:17 +09:00
Paul Mundt
d9116d07f6 sh: mach-sdk7786: Probe system FPGA area mapping.
This implements dynamic probing for the system FPGA. The system reset
controller contains a fixed magic read word in order to identify the
FPGA. This just utilizes a simple loop that scans across all of the fixed
physical areas (area 0 through area 6) to locate the FPGA.

The FPGA also contains register information detailing the area mappings
and chip select settings for all of the other blocks, so this needs to be
done before we can set up anything else.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-01-20 18:25:19 +09:00
Paul Mundt
920efaabcb sh: Correct iounmap fixmap teardown.
iounmap_fixed() had a couple of bugs in it that caused it to effectively
fail at life. The total number of pages to unmap factored in the mapping
offset and aligned up to the next page boundary, which doesn't match the
ioremap_fixed() behaviour.

When ioremap_fixed() pegs a slot, the address in the mapping data already
contains the offset displacement, and the size is recorded verbatim given
that we're only interested in total number of pages required. As such, we
need to calculate the total number from the original size in the unmap
path as well.

At the same time, there was also an off-by-1 problem in the fixmap index
calculation which has also been corrected.

Previously subsequent remaps of an identical fixmap index would trigger
the pte_ERROR() in set_pte_phys():

	arch/sh/mm/init.c:77: bad pte 8053ffb0(0000781003fff506).
	arch/sh/mm/init.c:77: bad pte 8053ffb0(0000781003fff506).
	arch/sh/mm/init.c:77: bad pte 8053ffb0(0000781003fff506).
	arch/sh/mm/init.c:77: bad pte 8053ffb0(0000781003fff506).
	arch/sh/mm/init.c:77: bad pte 8053ffb0(0000781003fff506).
	arch/sh/mm/init.c:77: bad pte 8053ffb0(0000781003fff506).

With this patch in place, the iounmap-driven fixmap teardown actually
does what it's supposed to do.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-01-20 18:10:30 +09:00
Paul Mundt
b51989b8af sh: mach-sdk7786: reset controller reboot support.
This wires up the machine_ops reboot call to use the system reset
controller.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-01-20 16:53:11 +09:00
Paul Mundt
fbb82b0365 sh: machine_ops based reboot support.
This provides a machine_ops-based reboot interface loosely cloned from
x86, and converts the native sh32 and sh64 cases over to it.

Necessary both for tying in SMP support and also enabling platforms like
SDK7786 to add support for their microcontroller-based power managers.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-01-20 16:42:52 +09:00
Paul Mundt
2efa53b269 sh: Make 29/32-bit mode check helper generally available.
Presently __in_29bit_mode() is only defined for the PMB case, but
it's also easily derived from the CONFIG_29BIT and CONFIG_32BIT &&
CONFIG_PMB=n cases.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-01-20 16:40:48 +09:00
Paul Mundt
5f240718b4 sh: mach-sdk7786: Split out FPGA IRQ controller setup.
This moves out the FPGA IRQ controller setup code to its own file, in
preparation for switching off of IRL mode and having it provide its own
irq_chip.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-01-20 15:23:54 +09:00
Paul Mundt
efd590d57a sh: mach-sdk7786: FPGA updates.
This does a bit of refactoring of the FPGA management code. The primary
FPGA initialization is moved out to its own file in preparation for
implementing some of the more complex capabilities, a complete set of
register definitions is provided, and all of the existing users in the
board code are moved over to use the new interface instead of setting up
overlapping mappings. This also corrects the FPGA size, which previously
was chomped off at the SDIF control register.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-01-20 15:08:36 +09:00
Paul Mundt
bdc27300f5 sh: Handle SH-4 FPU variants with broken CVR values.
Usually we can look to the CVR to work out whether we have an FPU or not.
Unfortunately not all parts comply with this, so just set the flag
manually for all SH-4 parts and clear it on the only SH-4 that doesn't
have one (SH4-501).

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-01-20 03:38:56 +09:00
Paul Mundt
70911b861b sh: Shut up noisy IOREMAP_FIXED=n build.
The ioremap_fixed() stub neglected to provide a return value, resulting
in a fairly noisy build.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-01-20 02:45:05 +09:00
Guennadi Liakhovetski
31c3af503e sh: support SIU sourcing from external clock on sh7722
Implement .set_rate() for all SH "div4 clocks," .enable(), .disable(), and
.set_parent() for those, that support them. This allows, among other uses,
reparenting of SIU clocks to the external source, and enabling and
disabling of the IrDA clock on sh7722.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-01-19 20:23:00 +09:00
Paul Mundt
14965f16b4 sh: Fix up sdk7780 and urquell builds.
These two got broken in the heartbeat private data conversion,
fix them up.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-01-19 20:10:33 +09:00
Paul Mundt
dea3cf1c39 sh: urquell: Handle EXTAL configuration here, too.
urquell happens to use the same mode pins and EXTAL configuration as
SDK7786, so just copy it over.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-01-19 20:09:28 +09:00
Paul Mundt
c809821827 sh: mach-sdk7786: Detect/configure/propagate EXTAL.
This uses the mode pins exposed through the FPGA to work out whether
we're driven from EXTAL or not and does the appropriate setup and
propagation through the clock framework.

This will also -EINVAL out for anyone adding in their own oscillators,
forcing proper configuration with the clock framework instead of
proceeding on with bogus clock values.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-01-19 19:38:36 +09:00
Paul Mundt
43a1839cb1 sh: SH7786 clock framework rewrite.
This rewrites the SH7786 clock framework support completely. It's
reworked to provide all of the DIV4 and MSTP function clocks. This brings
it in line with the current clock framework code and lets us drop SH7786
from the list of CPUs that require legacy CPG handling.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-01-19 19:37:14 +09:00
Paul Mundt
79f211b8e1 sh64: wire up sys_accept4.
sh64 on the other hand provides both direct broken out syscalls as well
as socketcall access. As there are binaries that use both socketcall has
to stay around. The current ABI prefers direct syscalls.

It was pointed out that when sys_recvmmsg was added in, sys_accept4 was
overlooked. This takes care of wiring it up.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-01-19 17:00:31 +09:00
Paul Mundt
6eacb2c4cb sh: unwire sys_recvmmsg.
sh32 at the moment only uses sys_socketcall to reach these, so unwire
recvmmsg for now. While we're at it, add it to the ignore list, as per
the s390 change.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-01-19 17:00:06 +09:00
Paul Mundt
a4ae2b2b18 sh64: Fixup build breakage from breakpoint handler rename.
The breakpoint handler was renamed on sh32, but sh64 was overlooked in
the conversion. Fix it up now.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-01-19 15:58:27 +09:00
Paul Mundt
d6db8888c8 sh64: Use the shared FPU state restorer.
This kills off the sh64-specific state restorer and switches over to
the generic one.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-01-19 15:55:27 +09:00
Paul Mundt
88ea1a445a sh64: Fix up PC casting in unaligned fixup notifier with 32bit ABI.
Presently the build bails with the following:

  CC      arch/sh/mm/alignment.o
cc1: warnings being treated as errors
arch/sh/mm/alignment.c: In function 'unaligned_fixups_notify':
arch/sh/mm/alignment.c:69: warning: cast to pointer from integer of different size
arch/sh/mm/alignment.c:74: warning: cast to pointer from integer of different size
make[2]: *** [arch/sh/mm/alignment.o] Error 1

This is due to the fact that regs->pc is always 64-bit, while the pointer size
depends on the ABI. Wrapping through instruction_pointer() takes care of the
appropriate casting for both configurations.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-01-19 15:41:50 +09:00
Paul Mundt
3ef2932b8c sh64: Fix up the build for the thread_xstate changes.
This updates the sh64 processor info with the sh32 changes in order to
tie in to the generic task_xstate management code.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-01-19 15:40:03 +09:00
Paul Mundt
cb6d04468d sh: Kill off now bogus fixmap/page wiring documentation.
The plans for _PAGE_WIRED were detailed in a comment with the fixmap
code, but as it's now all taken care of, we no longer have any reason for
keeping it around, particularly since it's no longer accurate. Kill it
off.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-01-19 15:22:52 +09:00
Paul Mundt
bb29c677b3 sh: Split out MMUCR.URB based entry wiring in to shared helper.
Presently this is duplicated between tlb-sh4 and tlb-pteaex. Split the
helpers out in to a generic tlb-urb that can be used by any parts
equipped with MMUCR.URB.

At the same time, move the SH-5 code out-of-line, as we require single
global state for DTLB entry wiring.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-01-19 15:20:35 +09:00
Paul Mundt
046581f962 sh: Provide a dummy _PAGE_WIRED flag for non-X2TLB parts.
This provides a dummy value for legacy parts which permits the entry
wiring to be open-coded. The compiler takes care of optimizing the entry
wiring away in these cases.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-01-19 14:23:39 +09:00
Paul Mundt
6d63e73d52 sh: Limit ioremap_prot() to 32bit pgprot parts.
Presently ioremap_prot() uses an unsigned long to pass the pgprot value
around. This results in the upper half of the pgprot being chomped when
using 64-bit pgprots on a 32-bit ABI (X2TLB and SH-5).

As the only users of ioremap_prot() are presently legacy parts, this
doesn't cause too much of an issue. In the future when the interface is
converted to use pgprot_t directly this can be re-enabled for the other
parts, too.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-01-19 14:00:14 +09:00
Paul Mundt
f33609344a sh: Convert p3_ioremap() users to ioremap_prot().
This kills off the ancient p3_ioremap(), converting over to the more
generic ioremap_prot() instead.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-01-19 13:55:41 +09:00
Paul Mundt
acf2c9685f sh: Kill off duplicate address alignment in ioremap_fixed().
This is already taken care of in the top-level ioremap, and now that
no one should be calling ioremap_fixed() directly we can simply throw the
mapping displacement in as an additional argument.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-01-19 13:49:19 +09:00
Paul Mundt
d57d64080d sh: Prevent 64-bit pgprot clobbering across ioremap implementations.
Presently 'flags' gets passed around a lot between the various ioremap
helpers and implementations, which is only 32-bits. In the X2TLB case
we use 64-bit pgprots which presently results in the upper 32bits being
chopped off (which handily include our read/write/exec permissions).

As such, we convert everything internally to using pgprot_t directly and
simply convert over with pgprot_val() where needed. With this in place,
transparent fixmap utilization for early ioremap works as expected.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-01-19 13:34:38 +09:00
Paul Mundt
af1415314a sh: Flag __ioremap_caller() __init_refok.
The mem_init_done test makes sure that this path is only entered in
__init cases, so leaving ioremap_fixed() as __init and flagging the
caller __init_refok is sufficient.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-01-18 21:45:00 +09:00
Paul Mundt
12b6b01cb4 sh: Handle unmapping of fixed slots transparently in iounmap().
iounmap() should balance whatever is done by ioremap(). Presently
ioremap() can do any of fixed mappings, PMB mappings, or page table
mappings. Presently only the latter two are handled through the standard
unmap path, so tie in the fixed unmapping, too.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-01-18 21:33:08 +09:00
Paul Mundt
4f744affc3 sh: Make iounmap_fixed() return success/failure for iounmap() path.
This converts iounmap_fixed() to return success/error if it handled the
unmap request or not. At the same time, drop the __init label, as this
can be called in to later.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-01-18 21:30:29 +09:00
Paul Mundt
0b59e38ffa sh: Merge _32/_64 ioremap implementations.
There is nothing of interest in the _64 version anymore, so the _32 one
can be renamed and used unconditionally.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-01-18 21:21:32 +09:00
Paul Mundt
edf711b66f sh: Fixup the IOREMAP_FIXED=n build.
Presently the fixed ioremap API is only defined when CONFIG_IOREMAP_FIXED
is set. As we want to call in to it unconditionally, provide a stubbed
out interface.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-01-18 21:20:13 +09:00
Paul Mundt
d9b9487af7 sh: Handle early ioremaps through fixed mappings.
This adds in a mem_init_done to work out when a standard ioremap() is
possible, falling back to the fixmap based ioremap otherwise.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-01-18 21:08:32 +09:00
Paul Mundt
0c54de146e Merge branch 'sh/stable-updates' 2010-01-18 20:47:37 +09:00