Commit e78a0b7a authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] sh: various fixes

From: Paul Mundt <lethal@linux-sh.org>

This is the rest of the sh update, which includes everything else
sh-specific, general cleanups, bugfixes, etc.  Nothing really eventful.
parent 7cb3c483
...@@ -27,7 +27,6 @@ config RWSEM_XCHGADD_ALGORITHM ...@@ -27,7 +27,6 @@ config RWSEM_XCHGADD_ALGORITHM
source "init/Kconfig" source "init/Kconfig"
menu "System type" menu "System type"
choice choice
...@@ -528,6 +527,8 @@ config SH_PCLK_FREQ ...@@ -528,6 +527,8 @@ config SH_PCLK_FREQ
with an auto-probed frequency which should be considered the proper with an auto-probed frequency which should be considered the proper
value for your hardware. value for your hardware.
menu "CPU Frequency scaling"
config CPU_FREQ config CPU_FREQ
bool "CPU Frequency scaling" bool "CPU Frequency scaling"
help help
...@@ -538,6 +539,8 @@ config CPU_FREQ ...@@ -538,6 +539,8 @@ config CPU_FREQ
If unsure, say N. If unsure, say N.
source "drivers/cpufreq/Kconfig"
config CPU_FREQ_TABLE config CPU_FREQ_TABLE
tristate "CPU frequency table helpers" tristate "CPU frequency table helpers"
depends on CPU_FREQ depends on CPU_FREQ
...@@ -559,12 +562,20 @@ config SH_CPU_FREQ ...@@ -559,12 +562,20 @@ config SH_CPU_FREQ
If unsure, say N. If unsure, say N.
source "drivers/cpufreq/Kconfig" endmenu
source "arch/sh/drivers/dma/Kconfig" source "arch/sh/drivers/dma/Kconfig"
source "arch/sh/cchips/Kconfig" source "arch/sh/cchips/Kconfig"
config HEARTBEAT
bool "Heartbeat LED"
depends on SH_MPC1211 || SH_CAT68701 || SH_STB1_HARP || SH_STB1_OVERDRIVE || SH_BIGSUR || SH_7751_SOLUTION_ENGINE || SH_SOLUTION_ENGINE
help
Use the power-on LED on your machine as a load meter. The exact
behavior is platform-dependent, but normally the flash frequency is
a hyperbolic function of the 5-minute load average.
endmenu endmenu
...@@ -614,8 +625,9 @@ config SBUS ...@@ -614,8 +625,9 @@ config SBUS
bool bool
config MAPLE config MAPLE
bool tristate "Maple Bus support"
default y if SH_DREAMCAST depends on SH_DREAMCAST
default y
source "arch/sh/drivers/pci/Kconfig" source "arch/sh/drivers/pci/Kconfig"
...@@ -634,351 +646,10 @@ source "fs/Kconfig.binfmt" ...@@ -634,351 +646,10 @@ source "fs/Kconfig.binfmt"
endmenu endmenu
source "drivers/base/Kconfig" source "drivers/Kconfig"
source "drivers/mtd/Kconfig"
source "drivers/parport/Kconfig"
source "drivers/block/Kconfig"
source "drivers/ide/Kconfig"
source "drivers/scsi/Kconfig"
source "drivers/cdrom/Kconfig"
source "drivers/md/Kconfig"
source "drivers/ieee1394/Kconfig"
source "net/Kconfig"
source "drivers/isdn/Kconfig"
source "drivers/telephony/Kconfig"
#
# input - input/joystick depends on it. As does USB.
#
source "drivers/input/Kconfig"
menu "Character devices"
config VT
bool "Virtual terminal"
---help---
If you say Y here, you will get support for terminal devices with
display and keyboard devices. These are called "virtual" because you
can run several virtual terminals (also called virtual consoles) on
one physical terminal. This is rather useful, for example one
virtual terminal can collect system messages and warnings, another
one can be used for a text-mode user session, and a third could run
an X session, all in parallel. Switching between virtual terminals
is done with certain key combinations, usually Alt-<function key>.
The setterm command ("man setterm") can be used to change the
properties (such as colors or beeping) of a virtual terminal. The
man page console_codes(4) ("man console_codes") contains the special
character sequences that can be used to change those properties
directly. The fonts used on virtual terminals can be changed with
the setfont ("man setfont") command and the key bindings are defined
with the loadkeys ("man loadkeys") command.
You need at least one virtual terminal device in order to make use
of your keyboard and monitor. Therefore, only people configuring an
embedded system would want to say N here in order to save some
memory; the only way to log into such a system is then via a serial
or network connection.
If unsure, say Y, or else you won't be able to do much with your new
shiny Linux system :-)
config VT_CONSOLE
bool "Support for console on virtual terminal"
depends on VT
---help---
The system console is the device which receives all kernel messages
and warnings and which allows logins in single user mode. If you
answer Y here, a virtual terminal (the device used to interact with
a physical terminal) can be used as system console. This is the most
common mode of operations, so you should say Y here unless you want
the kernel messages be output only to a serial port (in which case
you should say Y to "Console on serial port", below).
If you do say Y here, by default the currently visible virtual
terminal (/dev/tty0) will be used as system console. You can change
that with a kernel command line option such as "console=tty3" which
would use the third virtual terminal as system console. (Try "man
bootparam" or see the documentation of your boot loader (lilo or
loadlin) about how to pass options to the kernel at boot time.)
If unsure, say Y.
config HW_CONSOLE
bool
depends on VT && !S390 && !UM
default y
config SERIAL
tristate "Serial (8250, 16450, 16550 or compatible) support"
---help---
This selects whether you want to include the driver for the standard
serial ports. The standard answer is Y. People who might say N
here are those that are setting up dedicated Ethernet WWW/FTP
servers, or users that have one of the various bus mice instead of a
serial mouse and don't intend to use their machine's standard serial
port for anything. (Note that the Cyclades and Stallion multi
serial port drivers do not need this driver built in for them to
work.)
To compile this driver as a module, choose M here: the
module will be called serial.
[WARNING: Do not compile this driver as a module if you are using
non-standard serial ports, since the configuration information will
be lost when the driver is unloaded. This limitation may be lifted
in the future.]
BTW1: If you have a mouseman serial mouse which is not recognized by
the X window system, try running gpm first.
BTW2: If you intend to use a software modem (also called Winmodem)
under Linux, forget it. These modems are crippled and require
proprietary drivers which are only available under Windows.
Most people will say Y or M here, so that they can use serial mice,
modems and similar devices connecting to the standard serial ports.
config SH_SCI
tristate "Serial (SCI, SCIF) support"
help
Selecting this option will allow the Linux kernel to transfer data
over SCI (Serial Communication Interface) and/or SCIF (Serial
Communication Interface with FIFO) which are built into the Hitachi
SuperH processor. The option provides 1 to 3 (depending
on the CPU model) standard Linux tty devices, /dev/ttySC[012]; one
of these is normally used as the system console.
If in doubt, press "y".
config SERIAL_CONSOLE
bool "Support for console on serial port"
depends on SERIAL=y || SH_SCI=y
---help---
If you say Y here, it will be possible to use a serial port as the
system console (the system console is the device which receives all
kernel messages and warnings and which allows logins in single user
mode). This could be useful if some terminal or printer is connected
to that serial port.
Even if you say Y here, the currently visible virtual console
(/dev/tty0) will still be used as the system console by default, but
you can alter that using a kernel command line option such as
"console=ttyS1". (Try "man bootparam" or see the documentation of
your boot loader (lilo or loadlin) about how to pass options to the
kernel at boot time.)
If you don't have a VGA card installed and you say Y here, the
kernel will automatically use the first serial line, /dev/ttyS0, as
system console.
If unsure, say N.
comment "Unix98 PTY support"
config UNIX98_PTYS
bool "Unix98 PTY support"
---help---
A pseudo terminal (PTY) is a software device consisting of two
halves: a master and a slave. The slave device behaves identical to
a physical terminal; the master device is used by a process to
read data from and write data to the slave, thereby emulating a
terminal. Typical programs for the master side are telnet servers
and xterms.
Linux has traditionally used the BSD-like names /dev/ptyxx for
masters and /dev/ttyxx for slaves of pseudo terminals. This scheme
has a number of problems. The GNU C library glibc 2.1 and later,
however, supports the Unix98 naming standard: in order to acquire a
pseudo terminal, a process opens /dev/ptmx; the number of the pseudo
terminal is then made available to the process and the pseudo
terminal slave can be accessed as /dev/pts/<number>. What was
traditionally /dev/ttyp2 will then be /dev/pts/2, for example.
The entries in /dev/pts/ are created on the fly by a virtual
file system; therefore, if you say Y here you should say Y to
"/dev/pts file system for Unix98 PTYs" as well.
If you want to say Y here, you need to have the C library glibc 2.1
or later (equal to libc-6.1, check with "ls -l /lib/libc.so.*").
Read the instructions in <file:Documentation/Changes> pertaining to
pseudo terminals. It's safe to say N.
config UNIX98_PTY_COUNT
int "Maximum number of Unix98 PTYs in use (0-2048)"
depends on UNIX98_PTYS
default "256"
help
The maximum number of Unix98 PTYs that can be used at any one time.
The default is 256, and should be enough for desktop systems. Server
machines which support incoming telnet/rlogin/ssh connections and/or
serve several X terminals may want to increase this: every incoming
connection and every xterm uses up one PTY.
When not in use, each additional set of 256 PTYs occupy
approximately 8 KB of kernel memory on 32-bit architectures.
config HEARTBEAT
bool "Heartbeat LED"
depends on SH_MPC1211 || SH_CAT68701 || SH_STB1_HARP || SH_STB1_OVERDRIVE || SH_BIGSUR || SH_7751_SOLUTION_ENGINE || SH_SOLUTION_ENGINE
help
Use the power-on LED on your machine as a load meter. The exact
behavior is platform-dependent, but normally the flash frequency is
a hyperbolic function of the 5-minute load average.
menu "Maple Bus input peripherals"
depends on SH_DREAMCAST && MAPLE
config MAPLE_KEYBOARD
tristate "Maple Bus keyboard support"
depends on INPUT
config MAPLE_MOUSE
tristate "Maple Bus mouse support"
depends on INPUT
comment "Input core support is required for Maple input peripherals"
depends on INPUT=n
endmenu
config PRINTER
tristate "Parallel printer support"
depends on PARPORT
---help---
If you intend to attach a printer to the parallel port of your Linux
box (as opposed to using a serial printer; if the connector at the
printer has 9 or 25 holes ["female"], then it's serial), say Y.
Also read the Printing-HOWTO, available from
<http://www.tldp.org/docs.html#howto>.
It is possible to share one parallel port among several devices
(e.g. printer and ZIP drive) and it is safe to compile the
corresponding drivers into the kernel.
To compile this driver as a module, choose M here and read
<file:Documentation/parport.txt>. The module will be called lp.
If you have several parallel ports, you can specify which ports to
use with the "lp" kernel command line option. (Try "man bootparam"
or see the documentation of your boot loader (lilo or loadlin) about
how to pass options to the kernel at boot time.) The syntax of the
"lp" command line option can be found in <file:drivers/char/lp.c>.
If you have more than 8 printers, you need to increase the LP_NO
macro in lp.c and the PARPORT_MAX macro in parport.h.
config LP_CONSOLE
bool "Support for console on line printer"
depends on PRINTER
---help---
If you want kernel messages to be printed out as they occur, you
can have a console on the printer. This option adds support for
doing that; to actually get it to happen you need to pass the
option "console=lp0" to the kernel at boot time.
If the printer is out of paper (or off, or unplugged, or too
busy..) the kernel will stall until the printer is ready again.
By defining CONSOLE_LP_STRICT to 0 (at your own risk) you
can make the kernel continue when this happens,
but it'll lose the kernel messages.
If unsure, say N.
config PPDEV
tristate "Support for user-space parallel port device drivers"
depends on PARPORT
---help---
Saying Y to this adds support for /dev/parport device nodes. This
is needed for programs that want portable access to the parallel
port, for instance deviceid (which displays Plug-and-Play device
IDs).
This is the parallel port equivalent of SCSI generic support (sg).
It is safe to say N to this -- it is not needed for normal printing
or parallel port CD-ROM/disk support.
To compile this support as a module, choose M here: the
module will be called ppdev.
If unsure, say N.
config PSMOUSE
bool "PS/2 mouse (aka \"auxiliary device\") support"
---help---
The PS/2 mouse connects to a special mouse port that looks much like
the keyboard port (small circular connector with 6 pins). This way,
the mouse does not use any serial ports. This port can also be used
for other input devices like light pens, tablets, keypads. Compaq,
AST and IBM all use this as their mouse port on currently shipping
machines. The trackballs of some laptops are PS/2 mice also. In
particular, the C&T 82C710 mouse on TI Travelmates is a PS/2 mouse.
Although PS/2 mice are not technically bus mice, they are explained
in detail in the Busmouse-HOWTO, available from
<http://www.tldp.org/docs.html#howto>.
When using a PS/2 mouse, you can get problems if you want to use the
mouse both on the Linux console and under X. Using the "-R" option
of the Linux mouse managing program gpm (available from
<ftp://gnu.systemy.it/pub/gpm/>) solves this problem, or you can get
the "mconv2" utility from <ftp://ibiblio.org/pub/Linux/system/mouse/>.
source "drivers/char/watchdog/Kconfig"
config RTC
tristate "Enhanced Real Time Clock Support"
---help---
If you say Y here and create a character special file /dev/rtc with
major number 10 and minor number 135 using mknod ("man mknod"), you
will get access to the real time clock (or hardware clock) built
into your computer.
Every PC has such a clock built in. It can be used to generate
signals from as low as 1Hz up to 8192Hz, and can also be used
as a 24 hour alarm. It reports status information via the file
/proc/driver/rtc and its behaviour is set by various ioctls on
/dev/rtc.
If you run Linux on a multiprocessor machine and said Y to
"Symmetric Multi Processing" above, you should say Y here to read
and set the RTC in an SMP compatible fashion.
If you think you have a use for such a device (such as periodic data
sampling), then say Y here, and read <file:Documentation/rtc.txt>
for details.
To compile this driver as a module, choose M here: the
module will be called rtc.
source "drivers/char/pcmcia/Kconfig"
source "drivers/serial/Kconfig"
source "drivers/i2c/Kconfig"
endmenu
source "fs/Kconfig" source "fs/Kconfig"
source "drivers/media/Kconfig"
source "drivers/video/Kconfig"
source "sound/Kconfig"
source "drivers/usb/Kconfig"
source "arch/sh/oprofile/Kconfig" source "arch/sh/oprofile/Kconfig"
menu "Kernel hacking" menu "Kernel hacking"
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#include <asm/irq.h> #include <asm/irq.h>
struct sh_machine_vector mv_hp680 __initmv = { struct sh_machine_vector mv_hp680 __initmv = {
.mv_nr_irqs = HD64461_IRQBASE+HD64461_IRQ_NUM, .mv_nr_irqs = HD64461_IRQBASE + HD64461_IRQ_NUM,
.mv_inb = hd64461_inb, .mv_inb = hd64461_inb,
.mv_inw = hd64461_inw, .mv_inw = hd64461_inw,
...@@ -44,6 +44,10 @@ struct sh_machine_vector mv_hp680 __initmv = { ...@@ -44,6 +44,10 @@ struct sh_machine_vector mv_hp680 __initmv = {
.mv_outsw = hd64461_outsw, .mv_outsw = hd64461_outsw,
.mv_outsl = hd64461_outsl, .mv_outsl = hd64461_outsl,
.mv_readw = hd64461_readw,
.mv_writew = hd64461_writew,
.mv_irq_demux = hd64461_irq_demux, .mv_irq_demux = hd64461_irq_demux,
}; };
ALIAS_MV(hp680) ALIAS_MV(hp680)
...@@ -12,6 +12,9 @@ ...@@ -12,6 +12,9 @@
#include <linux/config.h> #include <linux/config.h>
#include <linux/init.h> #include <linux/init.h>
#include <asm/hd64461/hd64461.h> #include <asm/hd64461/hd64461.h>
#include <asm/io.h>
#include <asm/hp6xx/hp6xx.h>
#include <asm/cpu/dac.h>
const char *get_system_type(void) const char *get_system_type(void)
{ {
...@@ -20,8 +23,19 @@ const char *get_system_type(void) ...@@ -20,8 +23,19 @@ const char *get_system_type(void)
int __init platform_setup(void) int __init platform_setup(void)
{ {
__set_io_port_base(CONFIG_HD64461_IOBASE - HD64461_STBCR); u16 v;
v = inw(HD64461_STBCR);
v |= HD64461_STBCR_SURTST | HD64461_STBCR_SIRST |
HD64461_STBCR_STM1ST | HD64461_STBCR_STM0ST |
HD64461_STBCR_SAFEST | HD64461_STBCR_SPC0ST |
HD64461_STBCR_SMIAST | HD64461_STBCR_SAFECKE_OST |
HD64461_STBCR_SAFECKE_IST;
outw(v, HD64461_STBCR);
v = inw(HD64461_GPADR);
v |= HD64461_GPADR_SPEAKER | HD64461_GPADR_PCMCIA0;
outw(v, HD64461_GPADR);
sh_dac_disable(DAC_SPEAKER_VOLUME);
return 0; return 0;
} }
/* $Id: io.c,v 1.4 2003/08/03 03:05:10 lethal Exp $ /* $Id: io.c,v 1.5 2004/02/22 23:08:43 kkojima Exp $
* *
* linux/arch/sh/kernel/io_se.c * linux/arch/sh/kernel/io_se.c
* *
...@@ -134,25 +134,27 @@ void se_outl(unsigned int value, unsigned long port) ...@@ -134,25 +134,27 @@ void se_outl(unsigned int value, unsigned long port)
void se_insb(unsigned long port, void *addr, unsigned long count) void se_insb(unsigned long port, void *addr, unsigned long count)
{ {
volatile __u16 *p = port2adr(port); volatile __u16 *p = port2adr(port);
__u8 *ap = addr;
if (sh_pcic_io_start <= port && port <= sh_pcic_io_stop) { if (sh_pcic_io_start <= port && port <= sh_pcic_io_stop) {
volatile __u8 *bp = (__u8 *) (sh_pcic_io_wbase + 0x40000 + port); volatile __u8 *bp = (__u8 *) (sh_pcic_io_wbase + 0x40000 + port);
while (count--) while (count--)
*((__u8 *) addr)++ = *bp; *ap++ = *bp;
} else if (shifted_port(port)) { } else if (shifted_port(port)) {
while (count--) while (count--)
*((__u8 *) addr)++ = *p >> 8; *ap++ = *p >> 8;
} else { } else {
while (count--) while (count--)
*((__u8 *) addr)++ = *p; *ap++ = *p;
} }
} }
void se_insw(unsigned long port, void *addr, unsigned long count) void se_insw(unsigned long port, void *addr, unsigned long count)
{ {
volatile __u16 *p = port2adr(port); volatile __u16 *p = port2adr(port);
__u16 *ap = addr;
while (count--) while (count--)
*((__u16 *) addr)++ = *p; *ap++ = *p;
} }
void se_insl(unsigned long port, void *addr, unsigned long count) void se_insl(unsigned long port, void *addr, unsigned long count)
...@@ -163,25 +165,27 @@ void se_insl(unsigned long port, void *addr, unsigned long count) ...@@ -163,25 +165,27 @@ void se_insl(unsigned long port, void *addr, unsigned long count)
void se_outsb(unsigned long port, const void *addr, unsigned long count) void se_outsb(unsigned long port, const void *addr, unsigned long count)
{ {
volatile __u16 *p = port2adr(port); volatile __u16 *p = port2adr(port);
const __u8 *ap = addr;
if (sh_pcic_io_start <= port && port <= sh_pcic_io_stop) { if (sh_pcic_io_start <= port && port <= sh_pcic_io_stop) {
volatile __u8 *bp = (__u8 *) (sh_pcic_io_wbase + port); volatile __u8 *bp = (__u8 *) (sh_pcic_io_wbase + port);
while (count--) while (count--)
*bp = *((__u8 *) addr)++; *bp = *ap++;
} else if (shifted_port(port)) { } else if (shifted_port(port)) {
while (count--) while (count--)
*p = *((__u8 *) addr)++ << 8; *p = *ap++ << 8;
} else { } else {
while (count--) while (count--)
*p = *((__u8 *) addr)++; *p = *ap++;
} }
} }
void se_outsw(unsigned long port, const void *addr, unsigned long count) void se_outsw(unsigned long port, const void *addr, unsigned long count)
{ {
volatile __u16 *p = port2adr(port); volatile __u16 *p = port2adr(port);
const __u16 *ap = addr;
while (count--) while (count--)
*p = *((__u16 *) addr)++; *p = *ap++;
} }
void se_outsl(unsigned long port, const void *addr, unsigned long count) void se_outsl(unsigned long port, const void *addr, unsigned long count)
......
/* $Id: irq.c,v 1.1.2.2 2002/10/29 00:56:09 lethal Exp $ /* $Id: irq.c,v 1.4 2004/02/22 22:44:36 kkojima Exp $
* *
* linux/arch/sh/boards/se/770x/irq.c * linux/arch/sh/boards/se/770x/irq.c
* *
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/irq.h> #include <linux/irq.h>
#include <asm/irq.h> #include <asm/irq.h>
#include <asm/hitachi_se.h> #include <asm/se/se.h>
/* /*
* Initialize IRQ setting * Initialize IRQ setting
......
menu "Companion Chips"
# A board must have defined HD6446X_SERIES in order to see these # A board must have defined HD6446X_SERIES in order to see these
config HD6446X_SERIES
bool "HD6446x support"
default n
choice choice
prompt "HD6446x options" prompt "HD6446x options"
depends HD6446X_SERIES depends on HD6446X_SERIES
default HD64461 default HD64461
config HD64461 config HD64461
...@@ -73,4 +79,5 @@ config HD64465_IRQ ...@@ -73,4 +79,5 @@ config HD64465_IRQ
Do not change this unless you know what you are doing. Do not change this unless you know what you are doing.
endmenu
/* /*
* $Id: io.c,v 1.5 2004/02/01 19:46:04 lethal Exp $ * $Id: io.c,v 1.6 2004/03/16 00:07:50 lethal Exp $
* Copyright (C) 2000 YAEGASHI Takeshi * Copyright (C) 2000 YAEGASHI Takeshi
* Typical I/O routines for HD64461 system. * Typical I/O routines for HD64461 system.
*/ */
...@@ -8,6 +8,8 @@ ...@@ -8,6 +8,8 @@
#include <asm/io.h> #include <asm/io.h>
#include <asm/hd64461/hd64461.h> #include <asm/hd64461/hd64461.h>
#define MEM_BASE (CONFIG_HD64461_IOBASE - HD64461_STBCR)
static __inline__ unsigned long PORT2ADDR(unsigned long port) static __inline__ unsigned long PORT2ADDR(unsigned long port)
{ {
/* 16550A: HD64461 internal */ /* 16550A: HD64461 internal */
...@@ -36,7 +38,9 @@ static __inline__ unsigned long PORT2ADDR(unsigned long port) ...@@ -36,7 +38,9 @@ static __inline__ unsigned long PORT2ADDR(unsigned long port)
#endif #endif
/* ??? */ /* ??? */
if (port < 0x10000) return 0xa0000000 + port; if (port < 0xf000) return 0xa0000000 + port;
/* PCMCIA channel 0, I/O (0xba000000) */
if (port < 0x10000) return 0xba000000 + port - 0xf000;
/* HD64461 internal devices (0xb0000000) */ /* HD64461 internal devices (0xb0000000) */
if (port < 0x20000) return CONFIG_HD64461_IOBASE + port - 0x10000; if (port < 0x20000) return CONFIG_HD64461_IOBASE + port - 0x10000;
...@@ -140,3 +144,14 @@ void hd64461_outsl(unsigned long port, const void *buffer, unsigned long count) ...@@ -140,3 +144,14 @@ void hd64461_outsl(unsigned long port, const void *buffer, unsigned long count)
const unsigned long *buf=buffer; const unsigned long *buf=buffer;
while(count--) *addr=*buf++; while(count--) *addr=*buf++;
} }
unsigned short hd64461_readw(unsigned long addr)
{
return *(volatile unsigned short*)(MEM_BASE+addr);
}
void hd64461_writew(unsigned short b, unsigned long addr)
{
*(volatile unsigned short*)(MEM_BASE+addr) = b;
}
/* /*
* $Id: setup.c,v 1.4 2003/08/03 03:05:10 lethal Exp $ * $Id: setup.c,v 1.5 2004/03/16 00:07:50 lethal Exp $
* Copyright (C) 2000 YAEGASHI Takeshi * Copyright (C) 2000 YAEGASHI Takeshi
* Hitachi HD64461 companion chip support * Hitachi HD64461 companion chip support
*/ */
#include <linux/config.h> #include <linux/config.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/module.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/param.h> #include <linux/param.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
...@@ -30,7 +31,6 @@ static void disable_hd64461_irq(unsigned int irq) ...@@ -30,7 +31,6 @@ static void disable_hd64461_irq(unsigned int irq)
local_irq_restore(flags); local_irq_restore(flags);
} }
static void enable_hd64461_irq(unsigned int irq) static void enable_hd64461_irq(unsigned int irq)
{ {
unsigned long flags; unsigned long flags;
...@@ -44,7 +44,6 @@ static void enable_hd64461_irq(unsigned int irq) ...@@ -44,7 +44,6 @@ static void enable_hd64461_irq(unsigned int irq)
local_irq_restore(flags); local_irq_restore(flags);
} }
static void mask_and_ack_hd64461(unsigned int irq) static void mask_and_ack_hd64461(unsigned int irq)
{ {
disable_hd64461_irq(irq); disable_hd64461_irq(irq);
...@@ -54,27 +53,23 @@ static void mask_and_ack_hd64461(unsigned int irq) ...@@ -54,27 +53,23 @@ static void mask_and_ack_hd64461(unsigned int irq)
#endif #endif
} }
static void end_hd64461_irq(unsigned int irq) static void end_hd64461_irq(unsigned int irq)
{ {
if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS))) if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
enable_hd64461_irq(irq); enable_hd64461_irq(irq);
} }
static unsigned int startup_hd64461_irq(unsigned int irq) static unsigned int startup_hd64461_irq(unsigned int irq)
{ {
enable_hd64461_irq(irq); enable_hd64461_irq(irq);
return 0; return 0;
} }
static void shutdown_hd64461_irq(unsigned int irq) static void shutdown_hd64461_irq(unsigned int irq)
{ {
disable_hd64461_irq(irq); disable_hd64461_irq(irq);
} }
static struct hw_interrupt_type hd64461_irq_type = { static struct hw_interrupt_type hd64461_irq_type = {
.typename = "HD64461-IRQ", .typename = "HD64461-IRQ",
.startup = startup_hd64461_irq, .startup = startup_hd64461_irq,
...@@ -85,7 +80,6 @@ static struct hw_interrupt_type hd64461_irq_type = { ...@@ -85,7 +80,6 @@ static struct hw_interrupt_type hd64461_irq_type = {
.end = end_hd64461_irq, .end = end_hd64461_irq,
}; };
static irqreturn_t hd64461_interrupt(int irq, void *dev_id, struct pt_regs *regs) static irqreturn_t hd64461_interrupt(int irq, void *dev_id, struct pt_regs *regs)
{ {
printk(KERN_INFO printk(KERN_INFO
...@@ -95,23 +89,52 @@ static irqreturn_t hd64461_interrupt(int irq, void *dev_id, struct pt_regs *regs ...@@ -95,23 +89,52 @@ static irqreturn_t hd64461_interrupt(int irq, void *dev_id, struct pt_regs *regs
return IRQ_NONE; return IRQ_NONE;
} }
static struct {
int (*func) (int, void *);
void *dev;
} hd64461_demux[HD64461_IRQ_NUM];
void hd64461_register_irq_demux(int irq,
int (*demux) (int irq, void *dev), void *dev)
{
hd64461_demux[irq - HD64461_IRQBASE].func = demux;
hd64461_demux[irq - HD64461_IRQBASE].dev = dev;
}
EXPORT_SYMBOL(hd64461_register_irq_demux);
void hd64461_unregister_irq_demux(int irq)
{
hd64461_demux[irq - HD64461_IRQBASE].func = 0;
}
EXPORT_SYMBOL(hd64461_unregister_irq_demux);
int hd64461_irq_demux(int irq) int hd64461_irq_demux(int irq)
{ {
if (irq == CONFIG_HD64461_IRQ) { if (irq == CONFIG_HD64461_IRQ) {
unsigned short bit; unsigned short bit;
unsigned short nirr = inw(HD64461_NIRR); unsigned short nirr = inw(HD64461_NIRR);
unsigned short nimr = inw(HD64461_NIMR); unsigned short nimr = inw(HD64461_NIMR);
int i;
nirr &= ~nimr; nirr &= ~nimr;
for (bit = 1, irq = 0; irq < 16; bit <<= 1, irq++) for (bit = 1, i = 0; i < 16; bit <<= 1, i++)
if (nirr & bit) break; if (nirr & bit)
if (irq == 16) irq = CONFIG_HD64461_IRQ; break;
else irq += HD64461_IRQBASE; if (i == 16)
irq = CONFIG_HD64461_IRQ;
else {
irq = HD64461_IRQBASE + i;
if (hd64461_demux[i].func != 0) {
irq = hd64461_demux[i].func(irq, hd64461_demux[i].dev);
}
}
} }
return __irq_demux(irq); return __irq_demux(irq);
} }
static struct irqaction irq0 = { hd64461_interrupt, SA_INTERRUPT, 0, "HD64461", NULL, NULL}; static struct irqaction irq0 = { hd64461_interrupt, SA_INTERRUPT, 0, "HD64461", NULL, NULL };
int __init setup_hd64461(void) int __init setup_hd64461(void)
{ {
...@@ -120,9 +143,10 @@ int __init setup_hd64461(void) ...@@ -120,9 +143,10 @@ int __init setup_hd64461(void)
if (!MACH_HD64461) if (!MACH_HD64461)
return 0; return 0;
printk(KERN_INFO "HD64461 configured at 0x%x on irq %d(mapped into %d to %d)\n", printk(KERN_INFO
CONFIG_HD64461_IOBASE, CONFIG_HD64461_IRQ, "HD64461 configured at 0x%x on irq %d(mapped into %d to %d)\n",
HD64461_IRQBASE, HD64461_IRQBASE+15); CONFIG_HD64461_IOBASE, CONFIG_HD64461_IRQ, HD64461_IRQBASE,
HD64461_IRQBASE + 15);
#if defined(CONFIG_CPU_SUBTYPE_SH7709) /* Should be at processor specific part.. */ #if defined(CONFIG_CPU_SUBTYPE_SH7709) /* Should be at processor specific part.. */
outw(0x2240, INTC_ICR1); outw(0x2240, INTC_ICR1);
......
/* $Id: cf-enabler.c,v 1.3 2003/05/04 19:29:52 lethal Exp $ /* $Id: cf-enabler.c,v 1.4 2004/02/22 22:44:36 kkojima Exp $
* *
* linux/drivers/block/cf-enabler.c * linux/drivers/block/cf-enabler.c
* *
...@@ -88,7 +88,7 @@ static int __init cf_init_default(void) ...@@ -88,7 +88,7 @@ static int __init cf_init_default(void)
} }
#if defined(CONFIG_SH_SOLUTION_ENGINE) #if defined(CONFIG_SH_SOLUTION_ENGINE)
#include <asm/hitachi_se.h> #include <asm/se/se.h>
/* /*
* SolutionEngine * SolutionEngine
......
...@@ -196,6 +196,7 @@ void __init init_IRQ(void) ...@@ -196,6 +196,7 @@ void __init init_IRQ(void)
#endif #endif
make_ipr_irq(TIMER_IRQ, TIMER_IPR_ADDR, TIMER_IPR_POS, TIMER_PRIORITY); make_ipr_irq(TIMER_IRQ, TIMER_IPR_ADDR, TIMER_IPR_POS, TIMER_PRIORITY);
make_ipr_irq(TIMER1_IRQ, TIMER1_IPR_ADDR, TIMER1_IPR_POS, TIMER1_PRIORITY);
make_ipr_irq(RTC_IRQ, RTC_IPR_ADDR, RTC_IPR_POS, RTC_PRIORITY); make_ipr_irq(RTC_IRQ, RTC_IPR_ADDR, RTC_IPR_POS, RTC_PRIORITY);
#ifdef SCI_ERI_IRQ #ifdef SCI_ERI_IRQ
......
...@@ -3,13 +3,13 @@ ...@@ -3,13 +3,13 @@
* *
* General management API for SH-4 integrated Store Queues * General management API for SH-4 integrated Store Queues
* *
* Copyright (C) 2001, 2002, 2003 Paul Mundt * Copyright (C) 2001, 2002, 2003, 2004 Paul Mundt
* Copyright (C) 2001, 2002 M. R. Brown * Copyright (C) 2001, 2002 M. R. Brown
* *
* Some of this code has been adopted directly from the old arch/sh/mm/sq.c * Some of this code has been adopted directly from the old arch/sh/mm/sq.c
* hack that was part of the LinuxDC project. For all intensive purposes, this * hack that was part of the LinuxDC project. For all intents and purposes,
* is a completely new interface that really doesn't have much in common with * this is a completely new interface that really doesn't have much in common
* the old zone-based approach at all. Infact, I'm only listing it here for * with the old zone-based approach at all. In fact, it's only listed here for
* general completeness. * general completeness.
* *
* This file is subject to the terms and conditions of the GNU General Public * This file is subject to the terms and conditions of the GNU General Public
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <linux/list.h> #include <linux/list.h>
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <linux/miscdevice.h> #include <linux/miscdevice.h>
#include <linux/vmalloc.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/page.h> #include <asm/page.h>
...@@ -31,6 +32,9 @@ ...@@ -31,6 +32,9 @@
#include <asm/cpu/sq.h> #include <asm/cpu/sq.h>
static LIST_HEAD(sq_mapping_list); static LIST_HEAD(sq_mapping_list);
static spinlock_t sq_mapping_lock = SPIN_LOCK_UNLOCKED;
extern struct vm_struct *__get_vm_area(unsigned long size, unsigned long flags, unsigned long start, unsigned long end);
/** /**
* sq_flush - Flush (prefetch) the store queue cache * sq_flush - Flush (prefetch) the store queue cache
...@@ -42,7 +46,7 @@ static LIST_HEAD(sq_mapping_list); ...@@ -42,7 +46,7 @@ static LIST_HEAD(sq_mapping_list);
*/ */
inline void sq_flush(void *addr) inline void sq_flush(void *addr)
{ {
__asm__ __volatile__ ("pref @%0": "=r" (addr) : : "memory"); __asm__ __volatile__ ("pref @%0" : : "r" (addr) : "memory");
} }
/** /**
...@@ -57,13 +61,17 @@ inline void sq_flush(void *addr) ...@@ -57,13 +61,17 @@ inline void sq_flush(void *addr)
void sq_flush_range(unsigned long start, unsigned int len) void sq_flush_range(unsigned long start, unsigned int len)
{ {
volatile unsigned long *sq = (unsigned long *)start; volatile unsigned long *sq = (unsigned long *)start;
unsigned long dummy;
/* Flush the queues */ /* Flush the queues */
for (len >>= 5; len--; sq += 8) for (len >>= 5; len--; sq += 8)
sq_flush((void *)sq); sq_flush((void *)sq);
/* Wait for completion */ /* Wait for completion */
sq = (volatile unsigned long *)start; dummy = ctrl_inl(P4SEG_STORE_QUE);
ctrl_outl(0, P4SEG_STORE_QUE + 0);
ctrl_outl(0, P4SEG_STORE_QUE + 8);
} }
static struct sq_mapping *__sq_alloc_mapping(unsigned long virt, unsigned long phys, unsigned long size, const char *name) static struct sq_mapping *__sq_alloc_mapping(unsigned long virt, unsigned long phys, unsigned long size, const char *name)
...@@ -81,7 +89,7 @@ static struct sq_mapping *__sq_alloc_mapping(unsigned long virt, unsigned long p ...@@ -81,7 +89,7 @@ static struct sq_mapping *__sq_alloc_mapping(unsigned long virt, unsigned long p
map->sq_addr = virt; map->sq_addr = virt;
map->addr = phys; map->addr = phys;
map->size = size; map->size = size + 1;
map->name = name; map->name = name;
list_add(&map->list, &sq_mapping_list); list_add(&map->list, &sq_mapping_list);
...@@ -128,24 +136,20 @@ static unsigned long __sq_get_next_addr(void) ...@@ -128,24 +136,20 @@ static unsigned long __sq_get_next_addr(void)
*/ */
static struct sq_mapping *__sq_remap(struct sq_mapping *map) static struct sq_mapping *__sq_remap(struct sq_mapping *map)
{ {
/* unsigned long flags, pteh, ptel;
* First check the MMU status.. struct vm_struct *vma;
*/ pgprot_t pgprot;
#ifndef CONFIG_MMU
/* /*
* Without an MMU (or with it turned off), this is much more * Without an MMU (or with it turned off), this is much more
* straightforward, as we can just load up each queue's QACR with * straightforward, as we can just load up each queue's QACR with
* the physical address appropriately masked. * the physical address appropriately masked.
*/ */
ctrl_outl(((map->addr >> 26) << 2) & 0x1c, SQ_QACR0); ctrl_outl(((map->addr >> 26) << 2) & 0x1c, SQ_QACR0);
ctrl_outl(((map->addr >> 26) << 2) & 0x1c, SQ_QACR1); ctrl_outl(((map->addr >> 26) << 2) & 0x1c, SQ_QACR1);
#else
unsigned long flags, pteh, ptel;
pgprot_t pgprot;
pgd_t *pgd;
pmd_t *pmd;
pte_t *pte;
#ifdef CONFIG_MMU
/* /*
* With an MMU on the other hand, things are slightly more involved. * With an MMU on the other hand, things are slightly more involved.
* Namely, we have to have a direct mapping between the SQ addr and * Namely, we have to have a direct mapping between the SQ addr and
...@@ -161,7 +165,7 @@ static struct sq_mapping *__sq_remap(struct sq_mapping *map) ...@@ -161,7 +165,7 @@ static struct sq_mapping *__sq_remap(struct sq_mapping *map)
* We could also probably get by without explicitly setting PTEA, but * We could also probably get by without explicitly setting PTEA, but
* we do it here just for good measure. * we do it here just for good measure.
*/ */
local_irq_save(flags); spin_lock_irqsave(&sq_mapping_lock, flags);
pteh = map->sq_addr; pteh = map->sq_addr;
ctrl_outl((pteh & MMU_VPN_MASK) | get_asid(), MMU_PTEH); ctrl_outl((pteh & MMU_VPN_MASK) | get_asid(), MMU_PTEH);
...@@ -177,6 +181,8 @@ static struct sq_mapping *__sq_remap(struct sq_mapping *map) ...@@ -177,6 +181,8 @@ static struct sq_mapping *__sq_remap(struct sq_mapping *map)
__asm__ __volatile__ ("ldtlb" : : : "memory"); __asm__ __volatile__ ("ldtlb" : : : "memory");
spin_unlock_irqrestore(&sq_mapping_lock, flags);
/* /*
* Next, we need to map ourselves in the kernel page table, so that * Next, we need to map ourselves in the kernel page table, so that
* future accesses after a TLB flush will be handled when we take a * future accesses after a TLB flush will be handled when we take a
...@@ -188,31 +194,17 @@ static struct sq_mapping *__sq_remap(struct sq_mapping *map) ...@@ -188,31 +194,17 @@ static struct sq_mapping *__sq_remap(struct sq_mapping *map)
* writeout before we hit the TLB flush, we do it anyways. This way * writeout before we hit the TLB flush, we do it anyways. This way
* we at least save ourselves the initial page fault overhead. * we at least save ourselves the initial page fault overhead.
*/ */
pgd = pgd_offset_k(map->sq_addr); vma = __get_vm_area(map->size, VM_ALLOC, map->sq_addr, SQ_ADDRMAX);
if (!vma)
spin_lock(&init_mm.page_table_lock); return ERR_PTR(-ENOMEM);
pmd = pmd_alloc(&init_mm, pgd, map->sq_addr); vma->phys_addr = map->addr;
if (!pmd)
goto out;
pte = pte_alloc_map(&init_mm, pmd, map->sq_addr); if (remap_area_pages((unsigned long)vma->addr, vma->phys_addr,
if (!pte) map->size, pgprot_val(pgprot))) {
goto out; vunmap(vma->addr);
if (!pte_none(*pte)) { return NULL;
pte_unmap(pte);
goto out;
} }
set_pte(pte, mk_pte(phys_to_page(map->addr), pgprot));
pte_unmap(pte);
out:
spin_unlock(&init_mm.page_table_lock);
sq_flush((void *)pteh);
local_irq_restore(flags);
#endif /* CONFIG_MMU */ #endif /* CONFIG_MMU */
return map; return map;
...@@ -236,11 +228,20 @@ static struct sq_mapping *__sq_remap(struct sq_mapping *map) ...@@ -236,11 +228,20 @@ static struct sq_mapping *__sq_remap(struct sq_mapping *map)
struct sq_mapping *sq_remap(unsigned long phys, unsigned int size, const char *name) struct sq_mapping *sq_remap(unsigned long phys, unsigned int size, const char *name)
{ {
struct sq_mapping *map; struct sq_mapping *map;
unsigned long virt; unsigned long virt, end;
unsigned int psz; unsigned int psz;
/* Don't allow wraparound or zero size */
end = phys + size - 1;
if (!size || end < phys)
return NULL;
/* Don't allow anyone to remap normal memory.. */
if (phys < virt_to_phys(high_memory))
return NULL;
phys &= PAGE_MASK; phys &= PAGE_MASK;
size = PAGE_ALIGN(end + 1) - phys;
virt = __sq_get_next_addr(); virt = __sq_get_next_addr();
psz = (size + (PAGE_SIZE - 1)) / PAGE_SIZE; psz = (size + (PAGE_SIZE - 1)) / PAGE_SIZE;
map = __sq_alloc_mapping(virt, phys, size, name); map = __sq_alloc_mapping(virt, phys, size, name);
...@@ -264,30 +265,8 @@ struct sq_mapping *sq_remap(unsigned long phys, unsigned int size, const char *n ...@@ -264,30 +265,8 @@ struct sq_mapping *sq_remap(unsigned long phys, unsigned int size, const char *n
*/ */
void sq_unmap(struct sq_mapping *map) void sq_unmap(struct sq_mapping *map)
{ {
#ifdef CONFIG_MMU if (map->sq_addr > (unsigned long)high_memory)
pgd_t *pgd; vfree((void *)(map->sq_addr & PAGE_MASK));
pmd_t *pmd;
pte_t *pte;
pgd = pgd_offset_k(map->sq_addr);
pmd = pmd_offset(pgd, map->sq_addr);
if (pmd_none(*pmd))
return;
if (pmd_bad(*pmd)) {
pmd_ERROR(*pmd);
pmd_clear(pmd);
return;
}
pte = pte_offset_kernel(pmd, map->sq_addr);
if (pte_none(*pte) || pte_not_present(*pte))
return;
ptep_get_and_clear(pte);
__flush_tlb_page(get_asid(), map->sq_addr & PAGE_MASK);
#endif
list_del(&map->list); list_del(&map->list);
kfree(map); kfree(map);
...@@ -475,6 +454,7 @@ module_exit(sq_api_exit); ...@@ -475,6 +454,7 @@ module_exit(sq_api_exit);
MODULE_AUTHOR("Paul Mundt <lethal@linux-sh.org>, M. R. Brown <mrbrown@0xd6.org>"); MODULE_AUTHOR("Paul Mundt <lethal@linux-sh.org>, M. R. Brown <mrbrown@0xd6.org>");
MODULE_DESCRIPTION("Simple API for SH-4 integrated Store Queues"); MODULE_DESCRIPTION("Simple API for SH-4 integrated Store Queues");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_ALIAS_MISCDEV(STORE_QUEUE_MINOR);
EXPORT_SYMBOL(sq_remap); EXPORT_SYMBOL(sq_remap);
EXPORT_SYMBOL(sq_unmap); EXPORT_SYMBOL(sq_unmap);
......
/* $Id: entry.S,v 1.34 2004/01/13 05:52:11 kkojima Exp $ /* $Id: entry.S,v 1.35 2004/02/21 14:45:47 lethal Exp $
* *
* linux/arch/sh/entry.S * linux/arch/sh/entry.S
* *
...@@ -1129,9 +1129,6 @@ ENTRY(sys_call_table) ...@@ -1129,9 +1129,6 @@ ENTRY(sys_call_table)
.long sys_utimes .long sys_utimes
.long sys_fadvise64_64_wrapper .long sys_fadvise64_64_wrapper
.long sys_ni_syscall /* Reserved for vserver */ .long sys_ni_syscall /* Reserved for vserver */
.rept NR_syscalls-(.-sys_call_table)/4
.long sys_ni_syscall .long sys_ni_syscall
.endr
/* End of entry.S */ /* End of entry.S */
...@@ -16,10 +16,11 @@ ...@@ -16,10 +16,11 @@
*/ */
void memcpy_fromio(void * to, unsigned long from, unsigned long count) void memcpy_fromio(void * to, unsigned long from, unsigned long count)
{ {
char *p = to;
while (count) { while (count) {
count--; count--;
*(char *) to = readb(from); *p = readb(from);
((char *) to)++; p++;
from++; from++;
} }
} }
...@@ -30,10 +31,11 @@ void memcpy_fromio(void * to, unsigned long from, unsigned long count) ...@@ -30,10 +31,11 @@ void memcpy_fromio(void * to, unsigned long from, unsigned long count)
*/ */
void memcpy_toio(unsigned long to, const void * from, unsigned long count) void memcpy_toio(unsigned long to, const void * from, unsigned long count)
{ {
const char *p = from;
while (count) { while (count) {
count--; count--;
writeb(*(char *) from, to); writeb(*p, to);
((char *) from)++; p++;
to++; to++;
} }
} }
......
...@@ -55,20 +55,22 @@ int module_frob_arch_sections(Elf_Ehdr *hdr, ...@@ -55,20 +55,22 @@ int module_frob_arch_sections(Elf_Ehdr *hdr,
#define COPY_UNALIGNED_WORD(sw, tw, align) \ #define COPY_UNALIGNED_WORD(sw, tw, align) \
{ \ { \
void *__s = &(sw), *__t = &(tw); \ void *__s = &(sw), *__t = &(tw); \
unsigned short *__s2 = __s, *__t2 = __t; \
unsigned char *__s1 = __s, *__t1 = __t; \
switch ((align)) \ switch ((align)) \
{ \ { \
case 0: \ case 0: \
*(unsigned long *) __t = *(unsigned long *) __s; \ *(unsigned long *) __t = *(unsigned long *) __s; \
break; \ break; \
case 2: \ case 2: \
*((unsigned short *) __t)++ = *((unsigned short *) __s)++; \ *__t2++ = *__s2++; \
*((unsigned short *) __t) = *((unsigned short *) __s); \ *__t2 = *__s2; \
break; \ break; \
default: \ default: \
*((unsigned char *) __t)++ = *((unsigned char *) __s)++; \ *__t1++ = *__s1++; \
*((unsigned char *) __t)++ = *((unsigned char *) __s)++; \ *__t1++ = *__s1++; \
*((unsigned char *) __t)++ = *((unsigned char *) __s)++; \ *__t1++ = *__s1++; \
*((unsigned char *) __t) = *((unsigned char *) __s); \ *__t1 = *__s1; \
break; \ break; \
} \ } \
} }
......
/* $Id: process.c,v 1.25 2004/01/13 05:52:11 kkojima Exp $ /* $Id: process.c,v 1.26 2004/02/06 14:14:14 kkojima Exp $
* *
* linux/arch/sh/kernel/process.c * linux/arch/sh/kernel/process.c
* *
...@@ -254,6 +254,13 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp, ...@@ -254,6 +254,13 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
struct task_struct *p, struct pt_regs *regs) struct task_struct *p, struct pt_regs *regs)
{ {
struct pt_regs *childregs; struct pt_regs *childregs;
#if defined(CONFIG_CPU_SH4)
struct task_struct *tsk = current;
unlazy_fpu(tsk, regs);
p->thread.fpu = tsk->thread.fpu;
p->used_math = tsk->used_math;
#endif
childregs = ((struct pt_regs *) childregs = ((struct pt_regs *)
(THREAD_SIZE + (unsigned long) p->thread_info) (THREAD_SIZE + (unsigned long) p->thread_info)
...@@ -279,16 +286,6 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp, ...@@ -279,16 +286,6 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
p->thread.ubc_pc = 0; p->thread.ubc_pc = 0;
#if defined(CONFIG_CPU_SH4)
{
struct task_struct *tsk = current;
unlazy_fpu(tsk, regs);
p->thread.fpu = tsk->thread.fpu;
p->used_math = tsk->used_math;
clear_ti_thread_flag(p->thread_info, TIF_USEDFPU);
}
#endif
return 0; return 0;
} }
......
...@@ -113,3 +113,5 @@ EXPORT_SYMBOL(__down_trylock); ...@@ -113,3 +113,5 @@ EXPORT_SYMBOL(__down_trylock);
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
EXPORT_SYMBOL(synchronize_irq); EXPORT_SYMBOL(synchronize_irq);
#endif #endif
EXPORT_SYMBOL(csum_partial);
...@@ -44,7 +44,7 @@ asmlinkage int sys_pipe(unsigned long r4, unsigned long r5, ...@@ -44,7 +44,7 @@ asmlinkage int sys_pipe(unsigned long r4, unsigned long r5,
return error; return error;
} }
#if defined(CONFIG_CPU_SH4) #if defined(HAVE_ARCH_UNMAPPED_AREA)
/* /*
* To avoid cache alias, we map the shard page with same color. * To avoid cache alias, we map the shard page with same color.
*/ */
...@@ -53,7 +53,9 @@ asmlinkage int sys_pipe(unsigned long r4, unsigned long r5, ...@@ -53,7 +53,9 @@ asmlinkage int sys_pipe(unsigned long r4, unsigned long r5,
unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr,
unsigned long len, unsigned long pgoff, unsigned long flags) unsigned long len, unsigned long pgoff, unsigned long flags)
{ {
struct mm_struct *mm = current->mm;
struct vm_area_struct *vma; struct vm_area_struct *vma;
unsigned long start_addr;
if (flags & MAP_FIXED) { if (flags & MAP_FIXED) {
/* We do not accept a shared mapping if it would violate /* We do not accept a shared mapping if it would violate
...@@ -66,20 +68,44 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, ...@@ -66,20 +68,44 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr,
if (len > TASK_SIZE) if (len > TASK_SIZE)
return -ENOMEM; return -ENOMEM;
if (!addr)
addr = TASK_UNMAPPED_BASE;
if (addr) {
if (flags & MAP_PRIVATE) if (flags & MAP_PRIVATE)
addr = PAGE_ALIGN(addr); addr = PAGE_ALIGN(addr);
else else
addr = COLOUR_ALIGN(addr); addr = COLOUR_ALIGN(addr);
vma = find_vma(mm, addr);
if (TASK_SIZE - len >= addr &&
(!vma || addr + len <= vma->vm_start))
return addr;
}
if (flags & MAP_PRIVATE)
addr = PAGE_ALIGN(mm->free_area_cache);
else
addr = COLOUR_ALIGN(mm->free_area_cache);
start_addr = addr;
for (vma = find_vma(current->mm, addr); ; vma = vma->vm_next) { full_search:
for (vma = find_vma(mm, addr); ; vma = vma->vm_next) {
/* At this point: (!vma || addr < vma->vm_end). */ /* At this point: (!vma || addr < vma->vm_end). */
if (TASK_SIZE - len < addr) if (TASK_SIZE - len < addr) {
/*
* Start a new search - just in case we missed
* some holes.
*/
if (start_addr != TASK_UNMAPPED_BASE) {
start_addr = addr = TASK_UNMAPPED_BASE;
goto full_search;
}
return -ENOMEM; return -ENOMEM;
if (!vma || addr + len <= vma->vm_start) }
if (!vma || addr + len <= vma->vm_start) {
/*
* Remember the place where we stopped the search:
*/
mm->free_area_cache = addr + len;
return addr; return addr;
}
addr = vma->vm_end; addr = vma->vm_end;
if (!(flags & MAP_PRIVATE)) if (!(flags & MAP_PRIVATE))
addr = COLOUR_ALIGN(addr); addr = COLOUR_ALIGN(addr);
......
/* $Id: time.c,v 1.18 2003/10/09 16:28:14 lethal Exp $ /* $Id: time.c,v 1.19 2004/02/27 00:40:48 lethal Exp $
* *
* linux/arch/sh/kernel/time.c * linux/arch/sh/kernel/time.c
* *
...@@ -86,10 +86,14 @@ int (*rtc_set_time)(const time_t) = 0; ...@@ -86,10 +86,14 @@ int (*rtc_set_time)(const time_t) = 0;
#endif #endif
#if defined(CONFIG_CPU_SH3) #if defined(CONFIG_CPU_SH3)
#error "FIXME" static int stc_multipliers[] = { 1, 2, 3, 4, 6, 1, 1, 1 };
static int ifc_table[] = { 1, 2, 4, 1, 3, 1, 1, 1 }; static int stc_values[] = { 0, 1, 4, 2, 5, 0, 0, 0 };
static int pfc_table[] = { 1, 2, 4, 1, 3, 6, 1, 1 }; #define bfc_divisors stc_multipliers
static int stc_table[] = { 1, 2, 4, 8, 3, 6, 1, 1 }; #define bfc_values stc_values
static int ifc_divisors[] = { 1, 2, 3, 4, 1, 1, 1, 1 };
static int ifc_values[] = { 0, 1, 4, 2, 0, 0, 0, 0 };
static int pfc_divisors[] = { 1, 2, 3, 4, 6, 1, 1, 1 };
static int pfc_values[] = { 0, 1, 4, 2, 5, 0, 0, 0 };
#elif defined(CONFIG_CPU_SH4) #elif defined(CONFIG_CPU_SH4)
static int ifc_divisors[] = { 1, 2, 3, 4, 6, 8, 1, 1 }; static int ifc_divisors[] = { 1, 2, 3, 4, 6, 8, 1, 1 };
static int ifc_values[] = { 0, 1, 2, 3, 0, 4, 0, 5 }; static int ifc_values[] = { 0, 1, 2, 3, 0, 4, 0, 5 };
...@@ -398,13 +402,13 @@ void get_current_frequency_divisors(unsigned int *ifc, unsigned int *bfc, unsign ...@@ -398,13 +402,13 @@ void get_current_frequency_divisors(unsigned int *ifc, unsigned int *bfc, unsign
tmp = (frqcr & 0x8000) >> 13; tmp = (frqcr & 0x8000) >> 13;
tmp |= (frqcr & 0x0030) >> 4; tmp |= (frqcr & 0x0030) >> 4;
*bfc = stc_table[tmp]; *bfc = stc_multipliers[tmp];
tmp = (frqcr & 0x4000) >> 12; tmp = (frqcr & 0x4000) >> 12;
tmp |= (frqcr & 0x000c) >> 2; tmp |= (frqcr & 0x000c) >> 2;
*ifc = ifc_table[tmp]; *ifc = ifc_divisors[tmp];
tmp = (frqcr & 0x2000) >> 11; tmp = (frqcr & 0x2000) >> 11;
tmp |= frqcr & 0x0003; tmp |= frqcr & 0x0003;
*pfc = pfc_table[tmp]; *pfc = pfc_divisors[tmp];
#elif defined(CONFIG_CPU_SH4) #elif defined(CONFIG_CPU_SH4)
*ifc = ifc_divisors[(frqcr >> 6) & 0x0007]; *ifc = ifc_divisors[(frqcr >> 6) & 0x0007];
*bfc = bfc_divisors[(frqcr >> 3) & 0x0007]; *bfc = bfc_divisors[(frqcr >> 3) & 0x0007];
......
/* $Id: traps.c,v 1.14 2003/11/14 18:40:10 lethal Exp $ /* $Id: traps.c,v 1.16 2004/03/16 00:10:54 lethal Exp $
* *
* linux/arch/sh/traps.c * linux/arch/sh/traps.c
* *
...@@ -656,6 +656,10 @@ void show_stack(struct task_struct *tsk, unsigned long *sp) ...@@ -656,6 +656,10 @@ void show_stack(struct task_struct *tsk, unsigned long *sp)
unsigned long module_end = VMALLOC_END; unsigned long module_end = VMALLOC_END;
int i = 1; int i = 1;
if (tsk && !sp) {
sp = (unsigned long *)tsk->thread.sp;
}
if (!sp) { if (!sp) {
__asm__ __volatile__ ( __asm__ __volatile__ (
"mov r15, %0\n\t" "mov r15, %0\n\t"
......
/* $Id: cache-sh4.c,v 1.24 2003/10/12 19:40:12 lethal Exp $ /* $Id: cache-sh4.c,v 1.26 2004/02/19 12:47:24 lethal Exp $
* *
* linux/arch/sh/mm/cache-sh4.c * linux/arch/sh/mm/cache-sh4.c
* *
* Copyright (C) 1999, 2000, 2002 Niibe Yutaka * Copyright (C) 1999, 2000, 2002 Niibe Yutaka
* Copyright (C) 2001, 2002, 2003 Paul Mundt * Copyright (C) 2001, 2002, 2003, 2004 Paul Mundt
* Copyright (C) 2003 Richard Curnow
*/ */
#include <linux/config.h> #include <linux/config.h>
...@@ -29,10 +30,20 @@ static void __flush_dcache_all_ex(void); ...@@ -29,10 +30,20 @@ static void __flush_dcache_all_ex(void);
int __init detect_cpu_and_cache_system(void) int __init detect_cpu_and_cache_system(void)
{ {
unsigned long pvr, prr, ccr; unsigned long pvr, prr, ccr, cvr;
unsigned long size;
static unsigned long sizes[16] = {
[1] = (1 << 12),
[2] = (1 << 13),
[4] = (1 << 14),
[8] = (1 << 15),
[9] = (1 << 16)
};
pvr = (ctrl_inl(CCN_PVR) >> 8) & 0xffff; pvr = (ctrl_inl(CCN_PVR) >> 8) & 0xffff;
prr = (ctrl_inl(CCN_PRR) >> 4) & 0xff; prr = (ctrl_inl(CCN_PRR) >> 4) & 0xff;
cvr = (ctrl_inl(CCN_CVR));
/* /*
* Setup some sane SH-4 defaults for the icache * Setup some sane SH-4 defaults for the icache
...@@ -54,6 +65,9 @@ int __init detect_cpu_and_cache_system(void) ...@@ -54,6 +65,9 @@ int __init detect_cpu_and_cache_system(void)
cpu_data->dcache.ways = 1; cpu_data->dcache.ways = 1;
cpu_data->dcache.linesz = L1_CACHE_BYTES; cpu_data->dcache.linesz = L1_CACHE_BYTES;
/* Set the FPU flag, virtually all SH-4's have one */
set_bit(CPU_HAS_FPU, &(cpu_data->flags));
/* /*
* Probe the underlying processor version/revision and * Probe the underlying processor version/revision and
* adjust cpu_data setup accordingly. * adjust cpu_data setup accordingly.
...@@ -68,7 +82,7 @@ int __init detect_cpu_and_cache_system(void) ...@@ -68,7 +82,7 @@ int __init detect_cpu_and_cache_system(void)
/* /*
* FIXME: This is needed for 7750, but do we need it for the * FIXME: This is needed for 7750, but do we need it for the
* 7750S and 7750R too? For now, assume we do.. -- PFM * 7750S too? For now, assume we do.. -- PFM
*/ */
set_bit(CPU_HAS_P2_FLUSH_BUG, &(cpu_data->flags)); set_bit(CPU_HAS_P2_FLUSH_BUG, &(cpu_data->flags));
...@@ -83,12 +97,18 @@ int __init detect_cpu_and_cache_system(void) ...@@ -83,12 +97,18 @@ int __init detect_cpu_and_cache_system(void)
cpu_data->type = CPU_ST40GX1; cpu_data->type = CPU_ST40GX1;
break; break;
case 0x700: case 0x700:
/* XXX: Add proper CVR probing */
cpu_data->type = CPU_SH4_501; cpu_data->type = CPU_SH4_501;
cpu_data->icache.ways = 2;
cpu_data->dcache.ways = 2;
/* No FPU on the SH4-500 series.. */
clear_bit(CPU_HAS_FPU, &(cpu_data->flags));
break; break;
case 0x600: case 0x600:
cpu_data->type = CPU_SH4_202; cpu_data->type = CPU_SH4_202;
/* fall */ cpu_data->icache.ways = 2;
cpu_data->dcache.ways = 2;
break;
case 0x500 ... 0x501: case 0x500 ... 0x501:
switch (prr) { switch (prr) {
case 0x10: cpu_data->type = CPU_SH7750R; break; case 0x10: cpu_data->type = CPU_SH7750R; break;
...@@ -96,9 +116,20 @@ int __init detect_cpu_and_cache_system(void) ...@@ -96,9 +116,20 @@ int __init detect_cpu_and_cache_system(void)
case 0x50: cpu_data->type = CPU_SH7760; break; case 0x50: cpu_data->type = CPU_SH7760; break;
} }
if (cpu_data->type == CPU_SH7750R) cpu_data->icache.ways = 2;
set_bit(CPU_HAS_P2_FLUSH_BUG, &(cpu_data->flags)); cpu_data->dcache.ways = 2;
break;
default:
cpu_data->type = CPU_SH_NONE;
break;
}
/*
* On anything that's not a direct-mapped cache, look to the CVR
* for I/D-cache specifics.
*/
if (cpu_data->dcache.ways > 1) {
jump_to_P2(); jump_to_P2();
ccr = ctrl_inl(CCR); ccr = ctrl_inl(CCR);
...@@ -110,19 +141,17 @@ int __init detect_cpu_and_cache_system(void) ...@@ -110,19 +141,17 @@ int __init detect_cpu_and_cache_system(void)
back_to_P1(); back_to_P1();
cpu_data->icache.ways = 2; size = sizes[(cvr >> 20) & 0xf];
cpu_data->dcache.ways = 2; cpu_data->icache.way_shift = (size >> 1);
cpu_data->icache.entry_mask = ((size >> 2) - (1 << 5));
cpu_data->icache.sets = (size >> 6);
break; size = sizes[(cvr >> 16) & 0xf];
default: cpu_data->dcache.way_shift = (size >> 1);
cpu_data->type = CPU_SH_NONE; cpu_data->dcache.entry_mask = ((size >> 2) - (1 << 5));
break; cpu_data->dcache.sets = (size >> 6);
} }
/* No FPU on the SH4-500 series.. */
if (cpu_data->type != CPU_SH4_501)
set_bit(CPU_HAS_FPU, &(cpu_data->flags));
return 0; return 0;
} }
...@@ -419,7 +448,7 @@ void flush_cache_range(struct vm_area_struct *vma, unsigned long start, ...@@ -419,7 +448,7 @@ void flush_cache_range(struct vm_area_struct *vma, unsigned long start,
} }
pte++; pte++;
p += PAGE_SIZE; p += PAGE_SIZE;
} while (p < end && (unsigned long)pte & PAGE_MASK); } while (p < end && ((unsigned long)pte & ~PAGE_MASK));
pmd++; pmd++;
} while (p < end); } while (p < end);
loop_exit: loop_exit:
......
/* $Id: init.c,v 1.18 2003/10/31 09:26:59 kkojima Exp $ /* $Id: init.c,v 1.19 2004/02/21 04:42:16 kkojima Exp $
* *
* linux/arch/sh/mm/init.c * linux/arch/sh/mm/init.c
* *
...@@ -174,6 +174,7 @@ void __init mem_init(void) ...@@ -174,6 +174,7 @@ void __init mem_init(void)
extern unsigned long empty_zero_page[1024]; extern unsigned long empty_zero_page[1024];
int codesize, reservedpages, datasize, initsize; int codesize, reservedpages, datasize, initsize;
int tmp; int tmp;
extern unsigned long memory_start;
#ifdef CONFIG_MMU #ifdef CONFIG_MMU
high_memory = (void *)__va(MAX_LOW_PFN * PAGE_SIZE); high_memory = (void *)__va(MAX_LOW_PFN * PAGE_SIZE);
...@@ -183,7 +184,7 @@ void __init mem_init(void) ...@@ -183,7 +184,7 @@ void __init mem_init(void)
high_memory = (void *)(memory_end & PAGE_MASK); high_memory = (void *)(memory_end & PAGE_MASK);
#endif #endif
max_mapnr = num_physpages = MAP_NR(high_memory); max_mapnr = num_physpages = MAP_NR(high_memory) - MAP_NR(memory_start);
/* clear the zero-page */ /* clear the zero-page */
memset(empty_zero_page, 0, PAGE_SIZE); memset(empty_zero_page, 0, PAGE_SIZE);
......
/* $Id: ioremap.c,v 1.8 2003/10/09 15:25:42 lethal Exp $ /* $Id: ioremap.c,v 1.9 2004/02/25 04:59:10 lethal Exp $
* *
* arch/sh/mm/ioremap.c * arch/sh/mm/ioremap.c
* *
...@@ -160,5 +160,5 @@ void * p3_ioremap(unsigned long phys_addr, unsigned long size, unsigned long fla ...@@ -160,5 +160,5 @@ void * p3_ioremap(unsigned long phys_addr, unsigned long size, unsigned long fla
void p3_iounmap(void *addr) void p3_iounmap(void *addr)
{ {
if (addr > high_memory) if (addr > high_memory)
return vfree((void *) (PAGE_MASK & (unsigned long) addr)); vfree((void *)(PAGE_MASK & (unsigned long)addr));
} }
...@@ -412,7 +412,7 @@ static int __init sh_wdt_init(void) ...@@ -412,7 +412,7 @@ static int __init sh_wdt_init(void)
return rc; return rc;
} }
rc = misc_register(&sh_wdt_miscdev) rc = misc_register(&sh_wdt_miscdev);
if (rc) { if (rc) {
printk(KERN_ERR PFX "Can't register miscdev on minor=%d (err=%d)\n", printk(KERN_ERR PFX "Can't register miscdev on minor=%d (err=%d)\n",
sh_wdt_miscdev.minor, rc); sh_wdt_miscdev.minor, rc);
......
/* /*
* $Id: maple_keyb.c,v 1.1 2001/11/02 17:27:32 jsimmons Exp $ * $Id: maple_keyb.c,v 1.4 2004/03/22 01:18:15 lethal Exp $
* SEGA Dreamcast keyboard driver * SEGA Dreamcast keyboard driver
* Based on drivers/usb/usbkbd.c * Based on drivers/usb/usbkbd.c
*/ */
...@@ -125,8 +125,11 @@ static int dc_kbd_connect(struct maple_device *dev) ...@@ -125,8 +125,11 @@ static int dc_kbd_connect(struct maple_device *dev)
kbd->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_REP); kbd->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_REP);
init_input_dev(&kbd->dev);
for (i=0; i<255; i++) for (i=0; i<255; i++)
set_bit(dc_kbd_keycode[i], kbd->dev.keybit); set_bit(dc_kbd_keycode[i], kbd->dev.keybit);
clear_bit(0, kbd->dev.keybit); clear_bit(0, kbd->dev.keybit);
kbd->dev.private = kbd; kbd->dev.private = kbd;
...@@ -141,10 +144,7 @@ static int dc_kbd_connect(struct maple_device *dev) ...@@ -141,10 +144,7 @@ static int dc_kbd_connect(struct maple_device *dev)
maple_getcond_callback(dev, dc_kbd_callback, 1, MAPLE_FUNC_KEYBOARD); maple_getcond_callback(dev, dc_kbd_callback, 1, MAPLE_FUNC_KEYBOARD);
printk(KERN_INFO "input%d: keyboard(0x%lx): %s\n", printk(KERN_INFO "input: keyboard(0x%lx): %s\n", data, kbd->dev.name);
kbd->dev.number, data, kbd->dev.name);
MOD_INC_USE_COUNT;
return 0; return 0;
} }
...@@ -155,10 +155,7 @@ static void dc_kbd_disconnect(struct maple_device *dev) ...@@ -155,10 +155,7 @@ static void dc_kbd_disconnect(struct maple_device *dev)
struct dc_kbd *kbd = dev->private_data; struct dc_kbd *kbd = dev->private_data;
input_unregister_device(&kbd->dev); input_unregister_device(&kbd->dev);
kfree(kbd); kfree(kbd);
MOD_DEC_USE_COUNT;
} }
......
/* /*
* $Id: maplemouse.c,v 1.1 2001/11/02 17:27:32 jsimmons Exp $ * $Id: maplemouse.c,v 1.2 2004/03/22 01:18:15 lethal Exp $
* SEGA Dreamcast mouse driver * SEGA Dreamcast mouse driver
* Based on drivers/usb/usbmouse.c * Based on drivers/usb/usbmouse.c
*/ */
...@@ -74,22 +74,21 @@ static int dc_mouse_connect(struct maple_device *dev) ...@@ -74,22 +74,21 @@ static int dc_mouse_connect(struct maple_device *dev)
mouse->dev.keybit[LONG(BTN_MOUSE)] = BIT(BTN_LEFT) | BIT(BTN_RIGHT) | BIT(BTN_MIDDLE); mouse->dev.keybit[LONG(BTN_MOUSE)] = BIT(BTN_LEFT) | BIT(BTN_RIGHT) | BIT(BTN_MIDDLE);
mouse->dev.relbit[0] = BIT(REL_X) | BIT(REL_Y) | BIT(REL_WHEEL); mouse->dev.relbit[0] = BIT(REL_X) | BIT(REL_Y) | BIT(REL_WHEEL);
init_input_dev(&mouse->dev);
mouse->dev.private = mouse; mouse->dev.private = mouse;
mouse->dev.open = dc_mouse_open; mouse->dev.open = dc_mouse_open;
mouse->dev.close = dc_mouse_close; mouse->dev.close = dc_mouse_close;
mouse->dev.event = NULL; mouse->dev.event = NULL;
mouse->dev.name = dev->product_name; mouse->dev.name = dev->product_name;
mouse->dev.idbus = BUS_MAPLE; mouse->dev.id.bustype = BUS_MAPLE;
input_register_device(&mouse->dev); input_register_device(&mouse->dev);
maple_getcond_callback(dev, dc_mouse_callback, 1, MAPLE_FUNC_MOUSE); maple_getcond_callback(dev, dc_mouse_callback, 1, MAPLE_FUNC_MOUSE);
printk(KERN_INFO "input%d: mouse(0x%lx): %s\n", printk(KERN_INFO "input: mouse(0x%lx): %s\n", data, mouse->dev.name);
mouse->dev.number, data, mouse->dev.name);
MOD_INC_USE_COUNT;
return 0; return 0;
} }
...@@ -100,10 +99,7 @@ static void dc_mouse_disconnect(struct maple_device *dev) ...@@ -100,10 +99,7 @@ static void dc_mouse_disconnect(struct maple_device *dev)
struct dc_mouse *mouse = dev->private_data; struct dc_mouse *mouse = dev->private_data;
input_unregister_device(&mouse->dev); input_unregister_device(&mouse->dev);
kfree(mouse); kfree(mouse);
MOD_DEC_USE_COUNT;
} }
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#include <asm/system.h> #include <asm/system.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/hitachi_se.h> #include <asm/se/se.h>
#include <asm/machvec.h> #include <asm/machvec.h>
#ifdef CONFIG_SH_STANDARD_BIOS #ifdef CONFIG_SH_STANDARD_BIOS
#include <asm/sh_bios.h> #include <asm/sh_bios.h>
......
...@@ -37,5 +37,7 @@ ...@@ -37,5 +37,7 @@
#define p3_cache_init() do { } while (0) #define p3_cache_init() do { } while (0)
#define HAVE_ARCH_UNMAPPED_AREA
#endif /* __ASM_CPU_SH3_CACHEFLUSH_H */ #endif /* __ASM_CPU_SH3_CACHEFLUSH_H */
#ifndef __ASM_SH_DAC_H
#define __ASM_SH_DAC_H
/*
* Copyright (C) 2003 Andriy Skulysh
*/
#define DADR0 0xa40000a0
#define DADR1 0xa40000a2
#define DACR 0xa40000a4
#define DACR_DAOE1 0x80
#define DACR_DAOE0 0x40
#define DACR_DAE 0x20
static __inline__ void sh_dac_enable(int channel)
{
unsigned char v;
v = ctrl_inb(DACR);
if(channel) v |= DACR_DAOE1;
else v |= DACR_DAOE0;
ctrl_outb(v,DACR);
}
static __inline__ void sh_dac_disable(int channel)
{
unsigned char v;
v = ctrl_inb(DACR);
if(channel) v &= ~DACR_DAOE1;
else v &= ~DACR_DAOE0;
ctrl_outb(v,DACR);
}
static __inline__ void sh_dac_output(u8 value, int channel)
{
if(channel) ctrl_outb(value,DADR1);
else ctrl_outb(value,DADR0);
}
#endif /* __ASM_SH_DAC_H */
/*
* $Id: io.h,v 1.3 2003/05/04 19:30:14 lethal Exp $
* IO functions for SEGA Dreamcast
*/
#ifndef _ASM_SH_IO_DREAMCAST_H
#define _ASM_SH_IO_DREAMCAST_H
#include <asm/io_generic.h>
unsigned long dreamcast_isa_port2addr(unsigned long offset);
#ifdef __WANT_IO_DEF
# define __inb generic_inb
# define __inw generic_inw
# define __inl generic_inl
# define __outb generic_outb
# define __outw generic_outw
# define __outl generic_outl
# define __inb_p generic_inb_p
# define __inw_p generic_inw
# define __inl_p generic_inl
# define __outb_p generic_outb_p
# define __outw_p generic_outw
# define __outl_p generic_outl
# define __insb generic_insb
# define __insw generic_insw
# define __insl generic_insl
# define __outsb generic_outsb
# define __outsw generic_outsw
# define __outsl generic_outsl
# define __readb generic_readb
# define __readw generic_readw
# define __readl generic_readl
# define __writeb generic_writeb
# define __writew generic_writew
# define __writel generic_writel
# define __isa_port2addr dreamcast_isa_port2addr
# define __ioremap generic_ioremap
# define __iounmap generic_iounmap
#endif
#endif /* _ASM_SH_IO_DREAMCAST_H */
#ifndef __ASM_SH_HD64461 #ifndef __ASM_SH_HD64461
#define __ASM_SH_HD64461 #define __ASM_SH_HD64461
/* /*
* $Id: hd64461.h,v 1.4 2004/02/01 19:46:04 lethal Exp $ * $Id: hd64461.h,v 1.5 2004/03/16 00:07:51 lethal Exp $
* Copyright (C) 2000 YAEGASHI Takeshi * Copyright (C) 2000 YAEGASHI Takeshi
* Hitachi HD64461 companion chip support * Hitachi HD64461 companion chip support
*/ */
#include <linux/config.h> #include <linux/config.h>
/* Constants for PCMCIA mappings */
#define HD64461_PCC_WINDOW 0x01000000
#define HD64461_PCC0_BASE 0xb8000000 /* area 6 */
#define HD64461_PCC0_ATTR (HD64461_PCC0_BASE)
#define HD64461_PCC0_COMM (HD64461_PCC0_BASE+HD64461_PCC_WINDOW)
#define HD64461_PCC0_IO (HD64461_PCC0_BASE+2*HD64461_PCC_WINDOW)
#define HD64461_PCC1_BASE 0xb4000000 /* area 5 */
#define HD64461_PCC1_ATTR (HD64461_PCC1_BASE)
#define HD64461_PCC1_COMM (HD64461_PCC1_BASE+HD64461_PCC_WINDOW)
#define HD64461_STBCR 0x10000 #define HD64461_STBCR 0x10000
#define HD64461_STBCR_CKIO_STBY 0x2000 #define HD64461_STBCR_CKIO_STBY 0x2000
#define HD64461_STBCR_SAFECKE_IST 0x1000 #define HD64461_STBCR_SAFECKE_IST 0x1000
...@@ -21,7 +33,7 @@ ...@@ -21,7 +33,7 @@
#define HD64461_STBCR_STM0ST 0x0008 #define HD64461_STBCR_STM0ST 0x0008
#define HD64461_STBCR_STM1ST 0x0004 #define HD64461_STBCR_STM1ST 0x0004
#define HD64461_STBCR_SIRST 0x0002 #define HD64461_STBCR_SIRST 0x0002
#define HD64461_STBCR_SURTSD 0x0001 #define HD64461_STBCR_SURTST 0x0001
#define HD64461_SYSCR 0x10002 #define HD64461_SYSCR 0x10002
#define HD64461_SCPUCR 0x10004 #define HD64461_SCPUCR 0x10004
...@@ -77,16 +89,74 @@ ...@@ -77,16 +89,74 @@
#define HD64461_BBTROPR 0x11068 #define HD64461_BBTROPR 0x11068
#define HD64461_BBTMDR 0x1106a #define HD64461_BBTMDR 0x1106a
#define HD64461_PCC0ISR 0x12000 /* PC Card Controller Registers */
#define HD64461_PCC0GCR 0x12002 #define HD64461_PCC0ISR 0x12000 /* socket 0 interface status */
#define HD64461_PCC0CSCR 0x12004 #define HD64461_PCC0GCR 0x12002 /* socket 0 general control */
#define HD64461_PCC0CSCIER 0x12006 #define HD64461_PCC0CSCR 0x12004 /* socket 0 card status change */
#define HD64461_PCC0SCR 0x12008 #define HD64461_PCC0CSCIER 0x12006 /* socket 0 card status change interrupt enable */
#define HD64461_PCC1ISR 0x12010 #define HD64461_PCC0SCR 0x12008 /* socket 0 software control */
#define HD64461_PCC1GCR 0x12012 #define HD64461_PCC1ISR 0x12010 /* socket 1 interface status */
#define HD64461_PCC1CSCR 0x12014 #define HD64461_PCC1GCR 0x12012 /* socket 1 general control */
#define HD64461_PCC1CSCIER 0x12016 #define HD64461_PCC1CSCR 0x12014 /* socket 1 card status change */
#define HD64461_PCC1SCR 0x12018 #define HD64461_PCC1CSCIER 0x12016 /* socket 1 card status change interrupt enable */
#define HD64461_PCC1SCR 0x12018 /* socket 1 software control */
/* PCC Interface Status Register */
#define HD64461_PCCISR_READY 0x80 /* card ready */
#define HD64461_PCCISR_MWP 0x40 /* card write-protected */
#define HD64461_PCCISR_VS2 0x20 /* voltage select pin 2 */
#define HD64461_PCCISR_VS1 0x10 /* voltage select pin 1 */
#define HD64461_PCCISR_CD2 0x08 /* card detect 2 */
#define HD64461_PCCISR_CD1 0x04 /* card detect 1 */
#define HD64461_PCCISR_BVD2 0x02 /* battery 1 */
#define HD64461_PCCISR_BVD1 0x01 /* battery 1 */
#define HD64461_PCCISR_PCD_MASK 0x0c /* card detect */
#define HD64461_PCCISR_BVD_MASK 0x03 /* battery voltage */
#define HD64461_PCCISR_BVD_BATGOOD 0x03 /* battery good */
#define HD64461_PCCISR_BVD_BATWARN 0x01 /* battery low warning */
#define HD64461_PCCISR_BVD_BATDEAD1 0x02 /* battery dead */
#define HD64461_PCCISR_BVD_BATDEAD2 0x00 /* battery dead */
/* PCC General Control Register */
#define HD64461_PCCGCR_DRVE 0x80 /* output drive */
#define HD64461_PCCGCR_PCCR 0x40 /* PC card reset */
#define HD64461_PCCGCR_PCCT 0x20 /* PC card type, 1=IO&mem, 0=mem */
#define HD64461_PCCGCR_VCC0 0x10 /* voltage control pin VCC0SEL0 */
#define HD64461_PCCGCR_PMMOD 0x08 /* memory mode */
#define HD64461_PCCGCR_PA25 0x04 /* pin A25 */
#define HD64461_PCCGCR_PA24 0x02 /* pin A24 */
#define HD64461_PCCGCR_REG 0x01 /* pin PCC0REG# */
/* PCC Card Status Change Register */
#define HD64461_PCCCSCR_SCDI 0x80 /* sw card detect intr */
#define HD64461_PCCCSCR_SRV1 0x40 /* reserved */
#define HD64461_PCCCSCR_IREQ 0x20 /* IREQ intr req */
#define HD64461_PCCCSCR_SC 0x10 /* STSCHG (status change) pin */
#define HD64461_PCCCSCR_CDC 0x08 /* CD (card detect) change */
#define HD64461_PCCCSCR_RC 0x04 /* READY change */
#define HD64461_PCCCSCR_BW 0x02 /* battery warning change */
#define HD64461_PCCCSCR_BD 0x01 /* battery dead change */
/* PCC Card Status Change Interrupt Enable Register */
#define HD64461_PCCCSCIER_CRE 0x80 /* change reset enable */
#define HD64461_PCCCSCIER_IREQE_MASK 0x60 /* IREQ enable */
#define HD64461_PCCCSCIER_IREQE_DISABLED 0x00 /* IREQ disabled */
#define HD64461_PCCCSCIER_IREQE_LEVEL 0x20 /* IREQ level-triggered */
#define HD64461_PCCCSCIER_IREQE_FALLING 0x40 /* IREQ falling-edge-trig */
#define HD64461_PCCCSCIER_IREQE_RISING 0x60 /* IREQ rising-edge-trig */
#define HD64461_PCCCSCIER_SCE 0x10 /* status change enable */
#define HD64461_PCCCSCIER_CDE 0x08 /* card detect change enable */
#define HD64461_PCCCSCIER_RE 0x04 /* ready change enable */
#define HD64461_PCCCSCIER_BWE 0x02 /* battery warn change enable */
#define HD64461_PCCCSCIER_BDE 0x01 /* battery dead change enable*/
/* PCC Software Control Register */
#define HD64461_PCCSCR_VCC1 0x02 /* voltage control pin 1 */
#define HD64461_PCCSCR_SWP 0x01 /* write protect */
#define HD64461_P0OCR 0x1202a #define HD64461_P0OCR 0x1202a
#define HD64461_P1OCR 0x1202c #define HD64461_P1OCR 0x1202c
#define HD64461_PGCR 0x1202e #define HD64461_PGCR 0x1202e
...@@ -121,4 +191,13 @@ ...@@ -121,4 +191,13 @@
#define HD64461_IRQBASE OFFCHIP_IRQ_BASE #define HD64461_IRQBASE OFFCHIP_IRQ_BASE
#define HD64461_IRQ_NUM 16 #define HD64461_IRQ_NUM 16
#define HD64461_IRQ_UART (HD64461_IRQBASE+5)
#define HD64461_IRQ_IRDA (HD64461_IRQBASE+6)
#define HD64461_IRQ_TMU1 (HD64461_IRQBASE+9)
#define HD64461_IRQ_TMU0 (HD64461_IRQBASE+10)
#define HD64461_IRQ_GPIO (HD64461_IRQBASE+11)
#define HD64461_IRQ_AFE (HD64461_IRQBASE+12)
#define HD64461_IRQ_PCC1 (HD64461_IRQBASE+13)
#define HD64461_IRQ_PCC0 (HD64461_IRQBASE+14)
#endif #endif
...@@ -23,15 +23,21 @@ extern void hd64461_outl(unsigned int value, unsigned long port); ...@@ -23,15 +23,21 @@ extern void hd64461_outl(unsigned int value, unsigned long port);
extern unsigned char hd64461_inb_p(unsigned long port); extern unsigned char hd64461_inb_p(unsigned long port);
extern void hd64461_outb_p(unsigned char value, unsigned long port); extern void hd64461_outb_p(unsigned char value, unsigned long port);
extern void hd64461_insb(unsigned long port, const void *buffer, unsigned long count); extern void hd64461_insb(unsigned long port, void *addr, unsigned long count);
extern void hd64461_insw(unsigned long port, const void *buffer, unsigned long count); extern void hd64461_insw(unsigned long port, void *addr, unsigned long count);
extern void hd64461_insl(unsigned long port, const void *buffer, unsigned long count); extern void hd64461_insl(unsigned long port, void *addr, unsigned long count);
extern void hd64461_outsb(unsigned long port, const void *buffer, unsigned long count); extern void hd64461_outsb(unsigned long port, const void *buffer, unsigned long count);
extern void hd64461_outsw(unsigned long port, const void *buffer, unsigned long count); extern void hd64461_outsw(unsigned long port, const void *buffer, unsigned long count);
extern void hd64461_outsl(unsigned long port, const void *buffer, unsigned long count); extern void hd64461_outsl(unsigned long port, const void *buffer, unsigned long count);
extern unsigned short hd64461_readw(unsigned long addr);
extern void hd64461_writew(unsigned short b, unsigned long addr);
extern int hd64461_irq_demux(int irq); extern int hd64461_irq_demux(int irq);
extern void hd64461_register_irq_demux(int irq,
int (*demux)(int irq, void *dev), void *dev);
extern void hd64461_unregister_irq_demux(int irq);
#endif /* _ASM_SH_IO_HD64461_H */ #endif /* _ASM_SH_IO_HD64461_H */
#ifndef __ASM_SH_HP6XX_H
#define __ASM_SH_HP6XX_H
/*
* Copyright (C) 2003 Andriy Skulysh
*/
#define DAC_LCD_BRIGHTNESS 0
#define DAC_SPEAKER_VOLUME 1
#define HD64461_GPADR_SPEAKER 0x01
#define HD64461_GPADR_PCMCIA0 (0x02|0x08)
#define HD64461_GPBDR_LCDOFF 0x01
#define HD64461_GPBDR_LED_RED 0x80
#endif /* __ASM_SH_HP6XX_H */
...@@ -30,6 +30,11 @@ ...@@ -30,6 +30,11 @@
#define TIMER_IPR_POS 3 #define TIMER_IPR_POS 3
#define TIMER_PRIORITY 2 #define TIMER_PRIORITY 2
#define TIMER1_IRQ 17
#define TIMER1_IPR_ADDR INTC_IPRA
#define TIMER1_IPR_POS 2
#define TIMER1_PRIORITY 4
#define RTC_IRQ 22 #define RTC_IRQ 22
#define RTC_IPR_ADDR INTC_IPRA #define RTC_IPR_ADDR INTC_IPRA
#define RTC_IPR_POS 0 #define RTC_IPR_POS 0
...@@ -154,7 +159,7 @@ ...@@ -154,7 +159,7 @@
# define OFFCHIP_NR_IRQS 16 # define OFFCHIP_NR_IRQS 16
#else #else
# if defined(CONFIG_HD64461) # if defined(CONFIG_HD64461)
# define OFFCHIP_NR_IRQS 16 # define OFFCHIP_NR_IRQS 18
# elif defined (CONFIG_SH_BIGSUR) /* must be before CONFIG_HD64465 */ # elif defined (CONFIG_SH_BIGSUR) /* must be before CONFIG_HD64465 */
# define OFFCHIP_NR_IRQS 48 # define OFFCHIP_NR_IRQS 48
# elif defined(CONFIG_HD64465) # elif defined(CONFIG_HD64465)
......
...@@ -204,6 +204,8 @@ static inline pgprot_t pgprot_noncached(pgprot_t _prot) ...@@ -204,6 +204,8 @@ static inline pgprot_t pgprot_noncached(pgprot_t _prot)
return __pgprot(prot); return __pgprot(prot);
} }
#define pgprot_writecombine(prot) __pgprot(pgprot_val(prot) & ~_PAGE_CACHABLE)
/* /*
* Conversion functions: convert a page and protection to a page entry, * Conversion functions: convert a page and protection to a page entry,
* and a page entry and page directory to the page they refer to. * and a page entry and page directory to the page they refer to.
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
/* Core Processor Version Register */ /* Core Processor Version Register */
#define CCN_PVR 0xff000030 #define CCN_PVR 0xff000030
#define CCN_CVR 0xff000040
#define CCN_PRR 0xff000044 #define CCN_PRR 0xff000044
/* /*
......
/*
* include/asm-sh/io_sh2000.h
*
* Copyright 2000 Stuart Menefy (stuart.menefy@st.com)
* 2001 SUGIOKA Toshinobu (sugioka@itonet.co.jp)
*
* May be copied or modified under the terms of the GNU General Public
* License. See linux/COPYING for more information.
*
* IO functions for use when we don't know what machine we are on
*/
#ifndef _ASM_SH_IO_SH2000_H
#define _ASM_SH_IO_SH2000_H
#include <asm/io_generic.h>
unsigned long sh2000_isa_port2addr(unsigned long offset);
#ifdef __WANT_IO_DEF
# define __inb generic_inb
# define __inw generic_inw
# define __inl generic_inl
# define __outb generic_outb
# define __outw generic_outw
# define __outl generic_outl
# define __inb_p generic_inb_p
# define __inw_p generic_inw
# define __inl_p generic_inl
# define __outb_p generic_outb_p
# define __outw_p generic_outw
# define __outl_p generic_outl
# define __insb generic_insb
# define __insw generic_insw
# define __insl generic_insl
# define __outsb generic_outsb
# define __outsw generic_outsw
# define __outsl generic_outsl
# define __readb generic_readb
# define __readw generic_readw
# define __readl generic_readl
# define __writeb generic_writeb
# define __writew generic_writew
# define __writel generic_writel
# define __isa_port2addr sh2000_isa_port2addr
# define __ioremap generic_ioremap
# define __iounmap generic_iounmap
#endif
#endif /* _ASM_SH_IO_SH2000_H */
...@@ -7,6 +7,10 @@ ...@@ -7,6 +7,10 @@
struct pt_regs; struct pt_regs;
struct siginfo; struct siginfo;
#ifdef __KERNEL__
/* Most things should be clean enough to redefine this at will, if care
is taken to make libc match. */
#define _NSIG 64 #define _NSIG 64
#define _NSIG_BPW 32 #define _NSIG_BPW 32
#define _NSIG_WORDS (_NSIG / _NSIG_BPW) #define _NSIG_WORDS (_NSIG / _NSIG_BPW)
...@@ -17,6 +21,14 @@ typedef struct { ...@@ -17,6 +21,14 @@ typedef struct {
unsigned long sig[_NSIG_WORDS]; unsigned long sig[_NSIG_WORDS];
} sigset_t; } sigset_t;
#else
/* Here we must cater to libcs that poke about in kernel headers. */
#define NSIG 32
typedef unsigned long sigset_t;
#endif /* __KERNEL__ */
#define SIGHUP 1 #define SIGHUP 1
#define SIGINT 2 #define SIGINT 2
#define SIGQUIT 3 #define SIGQUIT 3
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#define SUN_OPENPROM_MINOR 139 #define SUN_OPENPROM_MINOR 139
#define DMAPI_MINOR 140 /* DMAPI */ #define DMAPI_MINOR 140 /* DMAPI */
#define NVRAM_MINOR 144 #define NVRAM_MINOR 144
#define STORE_QUEUE_MINOR 155
#define I2O_MINOR 166 #define I2O_MINOR 166
#define MICROCODE_MINOR 184 #define MICROCODE_MINOR 184
#define MWAVE_MINOR 219 /* ACP/Mwave Modem */ #define MWAVE_MINOR 219 /* ACP/Mwave Modem */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment