Commit graph

1349 commits

Author SHA1 Message Date
Paul Mundt 272966c070 serial: sh-sci: Reorder the SCxTDR write after the TDxE clear.
Under qemu there is a race between the TDxE read-and-clear and the SCxTDR
write. While on hardware it can be gauranteed that the read-and-clear
will happen prior to the character being written out, no such assumption
can be made under emulation. As this path happens with IRQs off and the
hardware itself doesn't care about the ordering, move the SCxTDR write
until after the read-and-clear.

Signed-off-by: Vladimir Prus <vladimir@codesourcery.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-11-13 17:46:06 +09:00
Stuart MENEFY 5d52013cbb sh: __copy_user function can corrupt the stack in case of exception
The __copy_user function can corrupt the stack in the case of a
non-trivial length of data, and either of the first two move instructions
cause an exception. This is because the fixup for these two instructions
is mapped to the no_pop case, but these instructions execute after the
stack is pushed.

This change creates an explicit NO_POP exception mapping macro, and uses
it for the two instructions executed in the trivial case where no stack
pushes occur.

More information at ST Linux bugzilla:

	https://bugzilla.stlinux.com/show_bug.cgi?id=4824

Signed-off-by: Dylan Reid <dylan_reid@bose.com>
Signed-off-by: Stuart Menefy <stuart.menefy@st.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-11-13 17:40:30 +09:00
Francesco VIRLINZI 2cd0ebc83d sh: Fixed the TMU0 reload value on resume
This patch fixes the TMU0 interrupt frequency on suspend/resume.
During the resume the kernel reprograms the TMU0.ClockEvent mode
but if the mode is periodic than the TMU0.TCOR is updated with
a random wrong value without taking care latest valid saved value.

There was no problem with No_HZ system where TMU0.TCOR isn't used.

Signed-off-by: Francesco M. Virlinzi <francesco.virlinzi@st.com>
Signed-off-by: Stuart Menefy <stuart.menefy@st.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-11-13 17:40:30 +09:00
Paul Mundt 10840f034e sh: Don't factor in PAGE_OFFSET for valid_phys_addr_range() check.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-11-13 15:38:02 +09:00
Magnus Damm bfbedf787c sh: early printk port type fix
Add PORT_SCIF to unbreak the early printk code.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-11-13 15:37:07 +09:00
Paul Mundt 185aed7557 sh: Provide a sane valid_phys_addr_range() to prevent TLB reset with PMB.
With the PMB enabled, only P1SEG and up are covered by the PMB mappings,
meaning that situations where out-of-bounds physical addresses are read
from will lead to TLB reset after the PMB miss, allowing for use cases
like dd if=/dev/mem to reset the TLB.

Fix this up to make sure the reference is between __MEMORY_START (phys)
and __pa(high_memory). This is coherent across all variants of sh/sh64
with and without MMU, though the PMB bug itself is only applicable to
SH-4A parts.

Reported-by: Hideo Saito <saito@densan.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-11-12 12:53:48 +09:00
Yoshihiro Shimoda 51ee3d92bf fix sci type for SH7723
This patch changes sci type of SH7723 from PORT_SCI to PORT_SCIFA.

Signed-off-by: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-11-12 12:29:56 +09:00
Paul Mundt acca4f4d9b sh: Handle fixmap TLB eviction more coherently.
There was a race in the kmap_coherent() implementation. While we
guarded against preemption, there was nothing preventing eviction of
the pre-faulted fixmap entry from the UTLB. Under certain workloads
this would result in the fixmap entries used for cache colouring being
evicted from the UTLB in the midst of a copy_page().

In addition to pre-faulting, we also make sure to preserve the PTEs
in the kernel page table and introduce a cached PTE for kmap_coherent()
usage. This follows a similar change on MIPS ("[MIPS] Fix aliasing bug
in copy_to_user_page / copy_from_user_page").

Reported-by: Hideo Saito <saito@densan.co.jp>
Reported-by: CHIKAMA Masaki <masaki.chikama@gmail.com>
Tested-by: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-11-10 20:00:45 +09:00
Yoshihiro Shimoda 216813a8bb sh: fix sh2a cache entry_mask
fix sh2a cache entry_mask in __flush_{purge,invalidate}_region.

Signed-off-by: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-10-31 16:29:20 +09:00
Kuninori Morimoto 464f763d5a sh: Enable NFS root in Migo-R defconfig.
Signed-off-by: Kuninori Morimoto <morimoto.kuninori@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-10-31 16:22:31 +09:00
Paul Mundt 694f94f263 sh: FTRACE renamed to FUNCTION_TRACER.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-10-31 16:20:36 +09:00
Kuninori Morimoto 47c2968c84 Add support usb setting on sh 7366
This patch add usb setting for sh 7366

Signed-off-by: Kuninori Morimoto <morimoto.kuninori@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-10-31 16:03:30 +09:00
Harvey Harrison 1406266732 sh: use the new byteorder headers.
Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-10-31 16:01:22 +09:00
Paul Mundt ddb72b0241 sh: SHmedia ISA tuning fixups.
SH-5 doesn't support any elaborate ISA inheritance schemes (-dsp, -up,
etc.), so only bother with that if we are building an sh32 kernel.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-10-31 15:58:53 +09:00
Paul Mundt 3eeebf17f3 sh: Kill off long-dead HD64465 cchip support.
This code has been dead for many years. The last update it received
was in 2003 in order to update it for the driver model changes, though
it had already been in disarray and unused before that point. The only
boards that ever used this chip have not had users in many years either,
so it is finally safe to just kill it off and move on with life.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-10-28 20:07:44 +09:00
Paul Mundt 86d758ef2c Merge branches 'sh/serial-rework' and 'sh/oprofile' 2008-10-28 19:44:15 +09:00
Paul Mundt b2d86a3fd9 sh: Simplify and lock down the ISA tuning.
The ISA tuning as it is today can not cope with all of the different
variations that are possible, so all we can do is a best attempt based on
the CPU family. The DSP and FPU generation are already at odds with each
other, and the nommu tuning we weren't handling at all.  Additionally,
for platforms that never had an FPU, the -nofpu variant never existed,
meaning that we would lose out on family granular tuning completely in
certain cases.

With tat out of the way, we were also using -up versions, allowing for
later instructions that branched off of a particular subset of the ISA,
but are not actually reflected on the hardware being targetted. This
leads to some confusion, and the possibility of bogus instructions on
older parts. Kill that off and lock it down to the family being built
for specifically.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-10-28 19:37:05 +09:00
Paul Mundt 1a30603233 sh: sh7785lcr: Select uImage as default image target.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-10-28 18:50:00 +09:00
Paul Mundt b4d36a254f sh: Add on-chip RTC support for SH7722.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-10-28 18:40:19 +09:00
Kuninori Morimoto e00afb6423 sh: Provide a sample defconfig for the UL2 (SH7366) board.
Signed-off-by: Kuninori Morimoto <morimoto.kuninori@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-10-28 17:36:11 +09:00
Paul Mundt 8a2fd5f3ab sh: Fix FPU tuning on toolchains with mismatched multilib targets.
Presently there is very little standing in the way of using an SH-4
toolchain for building an SH-2 kernel, and vice versa. Binutils itself
has no limitations whatsoever and supports explicit ISA hinting, which
we already use with varying degrees of success today.

This leaves GCC as the odd one out, due to a rather dubious policy
decision by the GCC folks to not include all of the CPU family variants
in the default list of multilib targets in GCC4. Despite best efforts to
the contrary, libgcc itself already contains awareness of the various CPU
types and remains generally usable, allowing it to safely be referenced
even on a mismatched target (and indeed, explicit ISA tuning by binutils
keeps us honest in terms of ensuring that we do not link incompatible
objects in).

In order to support this, a couple of changes had to be made. Firstly,
the introduction of MAYBE_DECLARE_EXPORT(), which provides a __weak
extern reference for libgcc resident routines when finer-grained
-m<cpu-family> based tuning is not supported by the toolchain. This
fixes up the __sdivsi3_i4i and __udivsi3_i4i references when dealing
with SH-2 kernels linked with an SH-4 libgcc. Secondly, in case where we
are unable to find a suitable match for CPU family tuning but still
have a toolchain that defaults to FP instruction generation, a suitable
nofpu target must be selected. This is accomplished by selecting the
first nofpu multilib target supported by the toolchain, which is
also necessary for selecting the proper libgcc to link against.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-10-28 17:19:35 +09:00
Paul Mundt 2a88b6e815 sh: oprofile: Fix up the SH7750 performance counter name.
Rather than varying this on a subtype level, we use the counter type as a
generic identifier. This simplifies logic in the userspace tools where no
fundamental difference exists across the various subtypes.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-10-27 09:51:45 +09:00
Paul Mundt e4b41dbd60 sh: asm/gpio.h needs linux/kernel.h for might_sleep()/WARN_ON().
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-10-23 12:37:20 +09:00
Paul Mundt 61dc6eaeef sh: mach-highlander: Handle SCIF pinmuxing on R7785RP.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-10-23 12:35:43 +09:00
Magnus Damm 0835f127e5 sh: sh7785 pinmux support
This patch implements pinmux tables for the sh7785 processor.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-10-23 11:59:37 +09:00
Paul Mundt 4bb273e955 sh: update defconfigs.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-10-22 20:05:11 +09:00
Paul Mundt 6f8f6daa6d sh: Kill off unused p1fc divisors from SH7763 clk fwk.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-10-22 19:38:30 +09:00
Magnus Damm 42eed42bac sh: improve pinmux support for single direction pins
This patch improves the support for gpio pins that are hard wired
to either input or output and lack control register association.
A special force enum id is used to allow use without control
register but still mark the gpio pin as input or output.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-10-22 18:34:16 +09:00
Magnus Damm 22ee3ba611 sh: use 10MHz VIO_CLK for ov772x on Migo-R
Use a slower VIO_CKO clock frequency for the ov772x on Migo-R.
This improves the camera picture quality on Panel Board V2.1.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-10-22 18:34:09 +09:00
Magnus Damm ed0b2ef55a sh: Update gpio_set_value() pin value handling
This patch updates the pinmux code to use the boolean value for
the function gpio_set_value(). Without this patch values other
than 0 and 1 will result in incorrect GPIO settings.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-10-21 21:41:23 +09:00
Magnus Damm 3b495513a2 sh: update ov772x byte order on Migo-R
Update the ov772x byte sequence to enable byte swap. This to reflect
the recent CEU driver change to follow incoming byte order.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-10-21 21:41:23 +09:00
Paul Mundt 2bba37e64a sh: Export cache flush routines needed by sh_eth on SH7619.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-10-21 19:45:08 +09:00
Paul Mundt c9306f0efb sh: Wire up oops reporting in the die notifier chain.
Commit 3f5a54e371 ("ftrace: dump out ftrace
buffers to console on panic") added an ftrace buffer dumper that hooks
in to the die notifier chain and dumps out data in the oops path.

Unfortunately SH supported ftrace but didn't support DIE_OOPS, so add
that in and get it building again.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-10-21 18:33:36 +09:00
Paul Mundt f7141d5884 sh: ap325rxa: Kill off unused port definitions.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-10-21 18:13:15 +09:00
Paul Mundt 7dd0558d70 sh: Hook up PB0->PB7 input-only pins in SH7203 PFC.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-10-21 18:09:43 +09:00
Paul Mundt dd0e20e588 sh: ap325rxa: Move off of hardcoded pinmux for flctl initialization.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-10-21 18:08:10 +09:00
Yoshihiro Shimoda 908978acbe sh: add support FLCTL for ap325rxa board
This patch adds platform_device for sh_flctl driver, NAND Flash
simple partition, and GPIO setting.

Signed-off-by: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-10-21 18:03:33 +09:00
Paul Mundt 5501093784 sh: gpio: Stub in dummy GPIO<->IRQ mapping routines.
IRQ modes are not presently supported, so stub in dummy definitions
for now (taken from linux/gpio.h).

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-10-21 17:48:40 +09:00
Paul Mundt bbc97411d1 sh: rsk7203: leds-gpio support for RSK+ LEDs.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-10-21 14:27:51 +09:00
Paul Mundt 10bfc6e190 sh: gpio: Include asm-generic/gpio.h for non-gpiolib stubs.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-10-21 14:27:05 +09:00
Guennadi Liakhovetski 58419abd50 sh: fix soc-camera compile breakage on Migo-R.
Fix Migo-R compile breakage caused by incomplete merge.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-10-21 12:51:51 +09:00
Paul Mundt b56050ae5e sh: arch/sh/kernel/smp.c needs linux/cpu.h for notify_cpu_starting().
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-10-21 12:51:51 +09:00
Andrew Morton 5e451d9c9d sh: Kill off duplicate remove_memory() definition.
Use the generic remove_memory() provided by mm/memory_hotplug.c instead.

Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-10-21 12:51:51 +09:00
Paul Mundt a51413a65f sh: Fix up the SH7203 build.
The sh7203.h include paths were missed in the previous update, so switch
the include path to cpu/ as with the rest.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-10-21 12:51:51 +09:00
Linus Torvalds ed402af3c2 Merge git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6: (112 commits)
  sh: Move SH-4 CPU headers down one more level.
  sh: Only build in gpio.o when CONFIG_GENERIC_GPIO is selected.
  sh: Migrate common board headers to mach-common/.
  sh: Move the CPU definition headers from asm/ to cpu/.
  serial: sh-sci: Add support SCIF of SH7723
  video: add sh_mobile_lcdc platform flags
  video: remove unused sh_mobile_lcdc platform data
  sh: remove consistent alloc cruft
  sh: add dynamic crash base address support
  sh: reduce Migo-R smc91x overruns
  sh: Fix up some merge damage.
  Fix debugfs_create_file's error checking method for arch/sh/mm/
  Fix debugfs_create_dir's error checking method for arch/sh/kernel/
  sh: ap325rxa: Add support RTC RX-8564LC in AP325RXA board
  sh: Use sh7720 GPIO on magicpanelr2 board
  sh: Add sh7720 pinmux code
  sh: Use sh7203 GPIO on rsk7203 board
  sh: Add sh7203 pinmux code
  sh: Use sh7723 GPIO on AP325RXA board
  sh: Add sh7723 pinmux code
  ...
2008-10-20 09:13:34 -07:00
Vivek Goyal 57cac4d188 kdump: make elfcorehdr_addr independent of CONFIG_PROC_VMCORE
o elfcorehdr_addr is used by not only the code under CONFIG_PROC_VMCORE
  but also by the code which is not inside CONFIG_PROC_VMCORE.  For
  example, is_kdump_kernel() is used by powerpc code to determine if
  kernel is booting after a panic then use previous kernel's TCE table.
  So even if CONFIG_PROC_VMCORE is not set in second kernel, one should be
  able to correctly determine that we are booting after a panic and setup
  calgary iommu accordingly.

o So remove the assumption that elfcorehdr_addr is under
  CONFIG_PROC_VMCORE.

o Move definition of elfcorehdr_addr to arch dependent crash files.
  (Unfortunately crash dump does not have an arch independent file
  otherwise that would have been the best place).

o kexec.c is not the right place as one can Have CRASH_DUMP enabled in
  second kernel without KEXEC being enabled.

o I don't see sh setup code parsing the command line for
  elfcorehdr_addr.  I am wondering how does vmcore interface work on sh.
  Anyway, I am atleast defining elfcoredhr_addr so that compilation is not
  broken on sh.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Acked-by: "Eric W. Biederman" <ebiederm@xmission.com>
Acked-by: Simon Horman <horms@verge.net.au>
Acked-by: Paul Mundt <lethal@linux-sh.org>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-10-20 08:52:39 -07:00
Matt Helsley dc52ddc0e6 container freezer: implement freezer cgroup subsystem
This patch implements a new freezer subsystem in the control groups
framework.  It provides a way to stop and resume execution of all tasks in
a cgroup by writing in the cgroup filesystem.

The freezer subsystem in the container filesystem defines a file named
freezer.state.  Writing "FROZEN" to the state file will freeze all tasks
in the cgroup.  Subsequently writing "RUNNING" will unfreeze the tasks in
the cgroup.  Reading will return the current state.

* Examples of usage :

   # mkdir /containers/freezer
   # mount -t cgroup -ofreezer freezer  /containers
   # mkdir /containers/0
   # echo $some_pid > /containers/0/tasks

to get status of the freezer subsystem :

   # cat /containers/0/freezer.state
   RUNNING

to freeze all tasks in the container :

   # echo FROZEN > /containers/0/freezer.state
   # cat /containers/0/freezer.state
   FREEZING
   # cat /containers/0/freezer.state
   FROZEN

to unfreeze all tasks in the container :

   # echo RUNNING > /containers/0/freezer.state
   # cat /containers/0/freezer.state
   RUNNING

This is the basic mechanism which should do the right thing for user space
task in a simple scenario.

It's important to note that freezing can be incomplete.  In that case we
return EBUSY.  This means that some tasks in the cgroup are busy doing
something that prevents us from completely freezing the cgroup at this
time.  After EBUSY, the cgroup will remain partially frozen -- reflected
by freezer.state reporting "FREEZING" when read.  The state will remain
"FREEZING" until one of these things happens:

	1) Userspace cancels the freezing operation by writing "RUNNING" to
		the freezer.state file
	2) Userspace retries the freezing operation by writing "FROZEN" to
		the freezer.state file (writing "FREEZING" is not legal
		and returns EIO)
	3) The tasks that blocked the cgroup from entering the "FROZEN"
		state disappear from the cgroup's set of tasks.

[akpm@linux-foundation.org: coding-style fixes]
[akpm@linux-foundation.org: export thaw_process]
Signed-off-by: Cedric Le Goater <clg@fr.ibm.com>
Signed-off-by: Matt Helsley <matthltc@us.ibm.com>
Acked-by: Serge E. Hallyn <serue@us.ibm.com>
Tested-by: Matt Helsley <matthltc@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-10-20 08:52:34 -07:00
Paul Mundt 40e24c403f sh: Move SH-4 CPU headers down one more level.
These accidentally got placed in to cpu-sh4 instead of cpu-sh4/cpu, push
them down one more level.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-10-20 14:30:17 +09:00
Paul Mundt ebf9c118df sh: Only build in gpio.o when CONFIG_GENERIC_GPIO is selected.
The pinmux management is tied in to this code, while it is presently only
used by platforms that select GENERIC_GPIO. The asm/gpio.h definitions
are not referenced when GENERIC_GPIO is disabled, resulting in a build
failure for all of the platforms that don't select it.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-10-20 13:04:06 +09:00
Paul Mundt 7639a4541f sh: Migrate common board headers to mach-common/.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-10-20 13:02:48 +09:00