You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
Merge master.kernel.org:/pub/scm/linux/kernel/git/lethal/sh-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/lethal/sh-2.6: (38 commits) sh: R7785RP board updates. sh: Update r7780rp defconfig. sh: Add die chain notifiers. sh: Fix APM emulation on hp6xx. sh: Wire up more IRQs for SH7709. sh: Solution Engine 7722 board support. sh: Fix r7780rp build. sh: kdump support. sh: Move clock reporting to its own proc entry. sh: Solution Engine SH7705 board and CPU updates. serial: sh-sci: Fix module clock refcount for serial console. serial: sh-sci: Fix module clock refcounting. sh: SH7722 clock framework support. sh: hp6xx pata_platform support. sh: Obey CONFIG_HZ for HZ definition. sh: Fix fstatat64() syscall. sh: se7780 PCI support. sh: SH7780 Solution Engine board support. sh: Add a dummy SH-4 PCIC fixup. sh: Tidy up L-BOX area5 addresses. ...
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
Clock framework on SuperH architecture
|
||||
|
||||
The framework on SH extends existing API by the function clk_set_rate_ex,
|
||||
which prototype is as follows:
|
||||
|
||||
clk_set_rate_ex (struct clk *clk, unsigned long rate, int algo_id)
|
||||
|
||||
The algo_id parameter is used to specify algorithm used to recalculate clocks,
|
||||
adjanced to clock, specified as first argument. It is assumed that algo_id==0
|
||||
means no changes to adjanced clock
|
||||
|
||||
Internally, the clk_set_rate_ex forwards request to clk->ops->set_rate method,
|
||||
if it is present in ops structure. The method should set the clock rate and adjust
|
||||
all needed clocks according to the passed algo_id.
|
||||
Exact values for algo_id are machine-dependend. For the sh7722, the following
|
||||
values are defined:
|
||||
|
||||
NO_CHANGE = 0,
|
||||
IUS_N1_N1, /* I:U = N:1, U:Sh = N:1 */
|
||||
IUS_322, /* I:U:Sh = 3:2:2 */
|
||||
IUS_522, /* I:U:Sh = 5:2:2 */
|
||||
IUS_N11, /* I:U:Sh = N:1:1 */
|
||||
SB_N1, /* Sh:B = N:1 */
|
||||
SB3_N1, /* Sh:B3 = N:1 */
|
||||
SB3_32, /* Sh:B3 = 3:2 */
|
||||
SB3_43, /* Sh:B3 = 4:3 */
|
||||
SB3_54, /* Sh:B3 = 5:4 */
|
||||
BP_N1, /* B:P = N:1 */
|
||||
IP_N1 /* I:P = N:1 */
|
||||
|
||||
Each of these constants means relation between clocks that can be set via the FRQCR
|
||||
register
|
||||
@@ -1,6 +1,6 @@
|
||||
Linux Magic System Request Key Hacks
|
||||
Documentation for sysrq.c
|
||||
Last update: 2007-JAN-06
|
||||
Last update: 2007-MAR-14
|
||||
|
||||
* What is the magic SysRq key?
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
@@ -75,7 +75,7 @@ On all - write a character to /proc/sysrq-trigger. e.g.:
|
||||
|
||||
'f' - Will call oom_kill to kill a memory hog process.
|
||||
|
||||
'g' - Used by kgdb on ppc platforms.
|
||||
'g' - Used by kgdb on ppc and sh platforms.
|
||||
|
||||
'h' - Will display help (actually any other key than those listed
|
||||
above will display help. but 'h' is easy to remember :-)
|
||||
|
||||
+65
-32
@@ -22,6 +22,10 @@ config RWSEM_GENERIC_SPINLOCK
|
||||
config RWSEM_XCHGADD_ALGORITHM
|
||||
bool
|
||||
|
||||
config GENERIC_BUG
|
||||
def_bool y
|
||||
depends on BUG
|
||||
|
||||
config GENERIC_FIND_NEXT_BIT
|
||||
bool
|
||||
default y
|
||||
@@ -88,6 +92,14 @@ config SH_SOLUTION_ENGINE
|
||||
Select SolutionEngine if configuring for a Hitachi SH7709
|
||||
or SH7750 evaluation board.
|
||||
|
||||
config SH_7722_SOLUTION_ENGINE
|
||||
bool "SolutionEngine7722"
|
||||
select SOLUTION_ENGINE
|
||||
select CPU_SUBTYPE_SH7722
|
||||
help
|
||||
Select 7722 SolutionEngine if configuring for a Hitachi SH772
|
||||
evaluation board.
|
||||
|
||||
config SH_7751_SOLUTION_ENGINE
|
||||
bool "SolutionEngine7751"
|
||||
select SOLUTION_ENGINE
|
||||
@@ -95,6 +107,14 @@ config SH_7751_SOLUTION_ENGINE
|
||||
help
|
||||
Select 7751 SolutionEngine if configuring for a Hitachi SH7751
|
||||
evaluation board.
|
||||
|
||||
config SH_7780_SOLUTION_ENGINE
|
||||
bool "SolutionEngine7780"
|
||||
select SOLUTION_ENGINE
|
||||
select CPU_SUBTYPE_SH7780
|
||||
help
|
||||
Select 7780 SolutionEngine if configuring for a Renesas SH7780
|
||||
evaluation board.
|
||||
|
||||
config SH_7300_SOLUTION_ENGINE
|
||||
bool "SolutionEngine7300"
|
||||
@@ -193,12 +213,8 @@ config SH_RTS7751R2D
|
||||
Select RTS7751R2D if configuring for a Renesas Technology
|
||||
Sales SH-Graphics board.
|
||||
|
||||
config SH_R7780RP
|
||||
bool "R7780RP-1"
|
||||
select CPU_SUBTYPE_SH7780
|
||||
help
|
||||
Select R7780RP-1 if configuring for a Renesas Solutions
|
||||
HIGHLANDER board.
|
||||
config SH_HIGHLANDER
|
||||
bool "Highlander"
|
||||
|
||||
config SH_EDOSK7705
|
||||
bool "EDOSK7705"
|
||||
@@ -243,6 +259,12 @@ config SH_7619_SOLUTION_ENGINE
|
||||
help
|
||||
Select 7619 SolutionEngine if configuring for a Hitachi SH7619
|
||||
evaluation board.
|
||||
|
||||
config SH_LBOX_RE2
|
||||
bool "L-BOX RE2"
|
||||
select CPU_SUBTYPE_SH7751R
|
||||
help
|
||||
Select L-BOX RE2 if configuring for the NTT COMWARE L-BOX RE2.
|
||||
|
||||
config SH_UNKNOWN
|
||||
bool "BareCPU"
|
||||
@@ -258,6 +280,10 @@ config SH_UNKNOWN
|
||||
|
||||
endchoice
|
||||
|
||||
source "arch/sh/boards/renesas/hs7751rvoip/Kconfig"
|
||||
source "arch/sh/boards/renesas/rts7751r2d/Kconfig"
|
||||
source "arch/sh/boards/renesas/r7780rp/Kconfig"
|
||||
|
||||
source "arch/sh/mm/Kconfig"
|
||||
|
||||
config CF_ENABLER
|
||||
@@ -366,6 +392,16 @@ config SH_STORE_QUEUES
|
||||
Selecting this option will enable an in-kernel API for manipulating
|
||||
the store queues integrated in the SH-4 processors.
|
||||
|
||||
config SPECULATIVE_EXECUTION
|
||||
bool "Speculative subroutine return"
|
||||
depends on CPU_SUBTYPE_SH7780 && EXPERIMENTAL
|
||||
help
|
||||
This enables support for a speculative instruction fetch for
|
||||
subroutine return. There are various pitfalls associated with
|
||||
this, as outlined in the SH7780 hardware manual.
|
||||
|
||||
If unsure, say N.
|
||||
|
||||
config CPU_HAS_INTEVT
|
||||
bool
|
||||
|
||||
@@ -398,8 +434,9 @@ config CPU_HAS_PTEA
|
||||
|
||||
endmenu
|
||||
|
||||
menu "Timer support"
|
||||
depends on !GENERIC_TIME
|
||||
menu "Timer and clock configuration"
|
||||
|
||||
if !GENERIC_TIME
|
||||
|
||||
config SH_TMU
|
||||
bool "TMU timer support"
|
||||
@@ -422,17 +459,11 @@ config SH_MTU2
|
||||
help
|
||||
This enables the use of the MTU2 as the system timer.
|
||||
|
||||
endmenu
|
||||
|
||||
source "arch/sh/boards/renesas/hs7751rvoip/Kconfig"
|
||||
|
||||
source "arch/sh/boards/renesas/rts7751r2d/Kconfig"
|
||||
|
||||
source "arch/sh/boards/renesas/r7780rp/Kconfig"
|
||||
endif
|
||||
|
||||
config SH_TIMER_IRQ
|
||||
int
|
||||
default "28" if CPU_SUBTYPE_SH7780
|
||||
default "28" if CPU_SUBTYPE_SH7780 || CPU_SUBTYPE_SH7785
|
||||
default "86" if CPU_SUBTYPE_SH7619
|
||||
default "140" if CPU_SUBTYPE_SH7206
|
||||
default "16"
|
||||
@@ -462,7 +493,8 @@ config SH_PCLK_FREQ
|
||||
default "33333333" if CPU_SUBTYPE_SH7300 || CPU_SUBTYPE_SH7770 || \
|
||||
CPU_SUBTYPE_SH7760 || CPU_SUBTYPE_SH7705 || \
|
||||
CPU_SUBTYPE_SH7206
|
||||
default "50000000" if CPU_SUBTYPE_SH7750 || CPU_SUBTYPE_SH7780
|
||||
default "50000000" if CPU_SUBTYPE_SH7750 || CPU_SUBTYPE_SH7780 || \
|
||||
CPU_SUBTYPE_SH7785
|
||||
default "60000000" if CPU_SUBTYPE_SH7751
|
||||
default "66000000" if CPU_SUBTYPE_SH4_202
|
||||
help
|
||||
@@ -477,6 +509,8 @@ config SH_CLK_MD
|
||||
help
|
||||
MD2 - MD0 pin setting.
|
||||
|
||||
endmenu
|
||||
|
||||
menu "CPU Frequency scaling"
|
||||
|
||||
source "drivers/cpufreq/Kconfig"
|
||||
@@ -495,21 +529,6 @@ config SH_CPU_FREQ
|
||||
|
||||
endmenu
|
||||
|
||||
source "arch/sh/drivers/dma/Kconfig"
|
||||
|
||||
source "arch/sh/cchips/Kconfig"
|
||||
|
||||
config HEARTBEAT
|
||||
bool "Heartbeat LED"
|
||||
depends on SH_MPC1211 || SH_SH03 || \
|
||||
SOLUTION_ENGINE || \
|
||||
SH_RTS7751R2D || SH_SH4202_MICRODEV || SH_LANDISK || \
|
||||
SH_R7780RP
|
||||
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.
|
||||
|
||||
source "arch/sh/drivers/Kconfig"
|
||||
|
||||
endmenu
|
||||
@@ -540,6 +559,20 @@ config KEXEC
|
||||
support. As of this writing the exact hardware interface is
|
||||
strongly in flux, so no good recommendation can be made.
|
||||
|
||||
config CRASH_DUMP
|
||||
bool "kernel crash dumps (EXPERIMENTAL)"
|
||||
depends on EXPERIMENTAL
|
||||
help
|
||||
Generate crash dump after being started by kexec.
|
||||
This should be normally only set in special crash dump kernels
|
||||
which are loaded in the main kernel with kexec-tools into
|
||||
a specially reserved region and then later executed after
|
||||
a crash by kdump/kexec. The crash dump kernel must be compiled
|
||||
to a memory address not used by the main kernel using
|
||||
MEMORY_START.
|
||||
|
||||
For more details see Documentation/kdump/kdump.txt
|
||||
|
||||
config SMP
|
||||
bool "Symmetric multi-processing support"
|
||||
---help---
|
||||
|
||||
+8
-12
@@ -33,6 +33,7 @@ config EARLY_SCIF_CONSOLE_PORT
|
||||
default "0xffe00000" if CPU_SUBTYPE_SH7780
|
||||
default "0xfffe9800" if CPU_SUBTYPE_SH7206
|
||||
default "0xf8420000" if CPU_SUBTYPE_SH7619
|
||||
default "0xa4400000" if CPU_SUBTYPE_SH7712 || CPU_SUBTYPE_SH7705
|
||||
default "0xffe80000" if CPU_SH4
|
||||
|
||||
config EARLY_PRINTK
|
||||
@@ -77,16 +78,17 @@ config 4KSTACKS
|
||||
on the VM subsystem for higher order allocations. This option
|
||||
will also use IRQ stacks to compensate for the reduced stackspace.
|
||||
|
||||
config KGDB
|
||||
config SH_KGDB
|
||||
bool "Include KGDB kernel debugger"
|
||||
select FRAME_POINTER
|
||||
select DEBUG_INFO
|
||||
help
|
||||
Include in-kernel hooks for kgdb, the Linux kernel source level
|
||||
debugger. See <http://kgdb.sourceforge.net/> for more information.
|
||||
Unless you are intending to debug the kernel, say N here.
|
||||
|
||||
menu "KGDB configuration options"
|
||||
depends on KGDB
|
||||
depends on SH_KGDB
|
||||
|
||||
config MORE_COMPILE_OPTIONS
|
||||
bool "Add any additional compile options"
|
||||
@@ -103,22 +105,16 @@ config KGDB_NMI
|
||||
bool "Enter KGDB on NMI"
|
||||
default n
|
||||
|
||||
config KGDB_THREAD
|
||||
bool "Include KGDB thread support"
|
||||
default y
|
||||
|
||||
config SH_KGDB_CONSOLE
|
||||
bool "Console messages through GDB"
|
||||
depends on !SERIAL_SH_SCI_CONSOLE
|
||||
select SERIAL_CORE_CONSOLE
|
||||
default n
|
||||
|
||||
config KGDB_SYSRQ
|
||||
bool "Allow SysRq 'G' to enter KGDB"
|
||||
default y
|
||||
|
||||
config KGDB_KERNEL_ASSERTS
|
||||
bool "Include KGDB kernel assertions"
|
||||
default n
|
||||
|
||||
comment "Serial port setup"
|
||||
|
||||
config KGDB_DEFPORT
|
||||
@@ -131,7 +127,7 @@ config KGDB_DEFBAUD
|
||||
|
||||
choice
|
||||
prompt "Parity"
|
||||
depends on KGDB
|
||||
depends on SH_KGDB
|
||||
default KGDB_DEFPARITY_N
|
||||
|
||||
config KGDB_DEFPARITY_N
|
||||
@@ -147,7 +143,7 @@ endchoice
|
||||
|
||||
choice
|
||||
prompt "Data bits"
|
||||
depends on KGDB
|
||||
depends on SH_KGDB
|
||||
default KGDB_DEFBITS_8
|
||||
|
||||
config KGDB_DEFBITS_8
|
||||
|
||||
+4
-2
@@ -47,7 +47,6 @@ cflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -ml
|
||||
cflags-y += $(call as-option,-Wa$(comma)-isa=$(isa-y),) -ffreestanding
|
||||
|
||||
cflags-$(CONFIG_SH_DSP) += -Wa,-dsp
|
||||
cflags-$(CONFIG_SH_KGDB) += -g
|
||||
|
||||
cflags-$(CONFIG_MORE_COMPILE_OPTIONS) += \
|
||||
$(shell echo $(CONFIG_COMPILE_OPTIONS) | sed -e 's/"//g')
|
||||
@@ -89,7 +88,9 @@ core-$(CONFIG_SH_FPU_EMU) += arch/sh/math-emu/
|
||||
|
||||
# Boards
|
||||
machdir-$(CONFIG_SH_SOLUTION_ENGINE) := se/770x
|
||||
machdir-$(CONFIG_SH_7722_SOLUTION_ENGINE) := se/7722
|
||||
machdir-$(CONFIG_SH_7751_SOLUTION_ENGINE) := se/7751
|
||||
machdir-$(CONFIG_SH_7780_SOLUTION_ENGINE) := se/7780
|
||||
machdir-$(CONFIG_SH_7300_SOLUTION_ENGINE) := se/7300
|
||||
machdir-$(CONFIG_SH_7343_SOLUTION_ENGINE) := se/7343
|
||||
machdir-$(CONFIG_SH_73180_SOLUTION_ENGINE) := se/73180
|
||||
@@ -103,7 +104,7 @@ machdir-$(CONFIG_SH_HS7751RVOIP) := renesas/hs7751rvoip
|
||||
machdir-$(CONFIG_SH_RTS7751R2D) := renesas/rts7751r2d
|
||||
machdir-$(CONFIG_SH_7751_SYSTEMH) := renesas/systemh
|
||||
machdir-$(CONFIG_SH_EDOSK7705) := renesas/edosk7705
|
||||
machdir-$(CONFIG_SH_R7780RP) := renesas/r7780rp
|
||||
machdir-$(CONFIG_SH_HIGHLANDER) := renesas/r7780rp
|
||||
machdir-$(CONFIG_SH_7710VOIPGW) := renesas/sh7710voipgw
|
||||
machdir-$(CONFIG_SH_SH4202_MICRODEV) := superh/microdev
|
||||
machdir-$(CONFIG_SH_LANDISK) := landisk
|
||||
@@ -111,6 +112,7 @@ machdir-$(CONFIG_SH_TITAN) := titan
|
||||
machdir-$(CONFIG_SH_SHMIN) := shmin
|
||||
machdir-$(CONFIG_SH_7206_SOLUTION_ENGINE) := se/7206
|
||||
machdir-$(CONFIG_SH_7619_SOLUTION_ENGINE) := se/7619
|
||||
machdir-$(CONFIG_SH_LBOX_RE2) := lboxre2
|
||||
machdir-$(CONFIG_SH_UNKNOWN) := unknown
|
||||
|
||||
incdir-y := $(notdir $(machdir-y))
|
||||
|
||||
@@ -2,6 +2,6 @@
|
||||
# Makefile for the HP6xx specific parts of the kernel
|
||||
#
|
||||
|
||||
obj-y := setup.o
|
||||
obj-y := setup.o
|
||||
obj-$(CONFIG_PM) += pm.o pm_wakeup.o
|
||||
obj-$(CONFIG_APM) += hp6xx_apm.o
|
||||
obj-$(CONFIG_APM_EMULATION) += hp6xx_apm.o
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
* linux/arch/sh/boards/hp6xx/setup.c
|
||||
*
|
||||
* Copyright (C) 2002 Andriy Skulysh
|
||||
* Copyright (C) 2007 Kristoffer Ericson <Kristoffer_e1@hotmail.com>
|
||||
*
|
||||
* May be copied or modified under the terms of the GNU General Public
|
||||
* License. See linux/COPYING for more information.
|
||||
@@ -10,6 +11,7 @@
|
||||
*/
|
||||
#include <linux/types.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <asm/hd64461.h>
|
||||
#include <asm/io.h>
|
||||
#include <asm/irq.h>
|
||||
@@ -19,6 +21,40 @@
|
||||
#define SCPCR 0xa4000116
|
||||
#define SCPDR 0xa4000136
|
||||
|
||||
/* CF Slot */
|
||||
static struct resource cf_ide_resources[] = {
|
||||
[0] = {
|
||||
.start = 0x15000000 + 0x1f0,
|
||||
.end = 0x15000000 + 0x1f0 + 0x08 - 0x01,
|
||||
.flags = IORESOURCE_MEM,
|
||||
},
|
||||
[1] = {
|
||||
.start = 0x15000000 + 0x1fe,
|
||||
.end = 0x15000000 + 0x1fe + 0x01,
|
||||
.flags = IORESOURCE_MEM,
|
||||
},
|
||||
[2] = {
|
||||
.start = 93,
|
||||
.flags = IORESOURCE_IRQ,
|
||||
},
|
||||
};
|
||||
|
||||
static struct platform_device cf_ide_device = {
|
||||
.name = "pata_platform",
|
||||
.id = -1,
|
||||
.num_resources = ARRAY_SIZE(cf_ide_resources),
|
||||
.resource = cf_ide_resources,
|
||||
};
|
||||
|
||||
static struct platform_device *hp6xx_devices[] __initdata = {
|
||||
&cf_ide_device,
|
||||
};
|
||||
|
||||
static int __init hp6xx_devices_setup(void)
|
||||
{
|
||||
return platform_add_devices(hp6xx_devices, ARRAY_SIZE(hp6xx_devices));
|
||||
}
|
||||
|
||||
static void __init hp6xx_setup(char **cmdline_p)
|
||||
{
|
||||
u8 v8;
|
||||
@@ -60,41 +96,12 @@ static void __init hp6xx_setup(char **cmdline_p)
|
||||
v |= SCPCR_TS_ENABLE;
|
||||
ctrl_outw(v, SCPCR);
|
||||
}
|
||||
device_initcall(hp6xx_devices_setup);
|
||||
|
||||
/*
|
||||
* XXX: This is stupid, we should have a generic machine vector for the cchips
|
||||
* and just wrap the platform setup code in to this, as it's the only thing
|
||||
* that ends up being different.
|
||||
*/
|
||||
struct sh_machine_vector mv_hp6xx __initmv = {
|
||||
.mv_name = "hp6xx",
|
||||
.mv_setup = hp6xx_setup,
|
||||
.mv_nr_irqs = HD64461_IRQBASE + HD64461_IRQ_NUM,
|
||||
|
||||
.mv_inb = hd64461_inb,
|
||||
.mv_inw = hd64461_inw,
|
||||
.mv_inl = hd64461_inl,
|
||||
.mv_outb = hd64461_outb,
|
||||
.mv_outw = hd64461_outw,
|
||||
.mv_outl = hd64461_outl,
|
||||
|
||||
.mv_inb_p = hd64461_inb_p,
|
||||
.mv_inw_p = hd64461_inw,
|
||||
.mv_inl_p = hd64461_inl,
|
||||
.mv_outb_p = hd64461_outb_p,
|
||||
.mv_outw_p = hd64461_outw,
|
||||
.mv_outl_p = hd64461_outl,
|
||||
|
||||
.mv_insb = hd64461_insb,
|
||||
.mv_insw = hd64461_insw,
|
||||
.mv_insl = hd64461_insl,
|
||||
.mv_outsb = hd64461_outsb,
|
||||
.mv_outsw = hd64461_outsw,
|
||||
.mv_outsl = hd64461_outsl,
|
||||
|
||||
.mv_readw = hd64461_readw,
|
||||
.mv_writew = hd64461_writew,
|
||||
|
||||
.mv_irq_demux = hd64461_irq_demux,
|
||||
};
|
||||
ALIAS_MV(hp6xx)
|
||||
|
||||
@@ -2,4 +2,4 @@
|
||||
# Makefile for I-O DATA DEVICE, INC. "LANDISK Series"
|
||||
#
|
||||
|
||||
obj-y := setup.o io.o irq.o rtc.o landisk_pwb.o
|
||||
obj-y := setup.o irq.o psw.o gio.o
|
||||
|
||||
@@ -0,0 +1,167 @@
|
||||
/*
|
||||
* arch/sh/boards/landisk/gio.c - driver for landisk
|
||||
*
|
||||
* This driver will also support the I-O DATA Device, Inc. LANDISK Board.
|
||||
* LANDISK and USL-5P Button, LED and GIO driver drive function.
|
||||
*
|
||||
* Copylight (C) 2006 kogiidena
|
||||
* Copylight (C) 2002 Atom Create Engineering Co., Ltd. *
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU General Public
|
||||
* License. See the file "COPYING" in the main directory of this archive
|
||||
* for more details.
|
||||
*
|
||||
*/
|
||||
#include <linux/module.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/kdev_t.h>
|
||||
#include <linux/cdev.h>
|
||||
#include <linux/fs.h>
|
||||
#include <asm/io.h>
|
||||
#include <asm/uaccess.h>
|
||||
#include <asm/landisk/gio.h>
|
||||
#include <asm/landisk/iodata_landisk.h>
|
||||
|
||||
#define DEVCOUNT 4
|
||||
#define GIO_MINOR 2 /* GIO minor no. */
|
||||
|
||||
static dev_t dev;
|
||||
static struct cdev *cdev_p;
|
||||
static int openCnt;
|
||||
|
||||
static int gio_open(struct inode *inode, struct file *filp)
|
||||
{
|
||||
int minor;
|
||||
|
||||
minor = MINOR(inode->i_rdev);
|
||||
if (minor < DEVCOUNT) {
|
||||
if (openCnt > 0) {
|
||||
return -EALREADY;
|
||||
} else {
|
||||
openCnt++;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
static int gio_close(struct inode *inode, struct file *filp)
|
||||
{
|
||||
int minor;
|
||||
|
||||
minor = MINOR(inode->i_rdev);
|
||||
if (minor < DEVCOUNT) {
|
||||
openCnt--;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int gio_ioctl(struct inode *inode, struct file *filp,
|
||||
unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
unsigned int data;
|
||||
static unsigned int addr = 0;
|
||||
|
||||
if (cmd & 0x01) { /* write */
|
||||
if (copy_from_user(&data, (int *)arg, sizeof(int))) {
|
||||
return -EFAULT;
|
||||
}
|
||||
}
|
||||
|
||||
switch (cmd) {
|
||||
case GIODRV_IOCSGIOSETADDR: /* addres set */
|
||||
addr = data;
|
||||
break;
|
||||
|
||||
case GIODRV_IOCSGIODATA1: /* write byte */
|
||||
ctrl_outb((unsigned char)(0x0ff & data), addr);
|
||||
break;
|
||||
|
||||
case GIODRV_IOCSGIODATA2: /* write word */
|
||||
if (addr & 0x01) {
|
||||
return -EFAULT;
|
||||
}
|
||||
ctrl_outw((unsigned short int)(0x0ffff & data), addr);
|
||||
break;
|
||||
|
||||
case GIODRV_IOCSGIODATA4: /* write long */
|
||||
if (addr & 0x03) {
|
||||
return -EFAULT;
|
||||
}
|
||||
ctrl_outl(data, addr);
|
||||
break;
|
||||
|
||||
case GIODRV_IOCGGIODATA1: /* read byte */
|
||||
data = ctrl_inb(addr);
|
||||
break;
|
||||
|
||||
case GIODRV_IOCGGIODATA2: /* read word */
|
||||
if (addr & 0x01) {
|
||||
return -EFAULT;
|
||||
}
|
||||
data = ctrl_inw(addr);
|
||||
break;
|
||||
|
||||
case GIODRV_IOCGGIODATA4: /* read long */
|
||||
if (addr & 0x03) {
|
||||
return -EFAULT;
|
||||
}
|
||||
data = ctrl_inl(addr);
|
||||
break;
|
||||
default:
|
||||
return -EFAULT;
|
||||
break;
|
||||
}
|
||||
|
||||
if ((cmd & 0x01) == 0) { /* read */
|
||||
if (copy_to_user((int *)arg, &data, sizeof(int))) {
|
||||
return -EFAULT;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct file_operations gio_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = gio_open, /* open */
|
||||
.release = gio_close, /* release */
|
||||
.ioctl = gio_ioctl, /* ioctl */
|
||||
};
|
||||
|
||||
static int __init gio_init(void)
|
||||
{
|
||||
int error;
|
||||
|
||||
printk(KERN_INFO "gio: driver initialized\n");
|
||||
|
||||
openCnt = 0;
|
||||
|
||||
if ((error = alloc_chrdev_region(&dev, 0, DEVCOUNT, "gio")) < 0) {
|
||||
printk(KERN_ERR
|
||||
"gio: Couldn't alloc_chrdev_region, error=%d\n",
|
||||
error);
|
||||
return 1;
|
||||
}
|
||||
|
||||
cdev_p = cdev_alloc();
|
||||
cdev_p->ops = &gio_fops;
|
||||
error = cdev_add(cdev_p, dev, DEVCOUNT);
|
||||
if (error) {
|
||||
printk(KERN_ERR
|
||||
"gio: Couldn't cdev_add, error=%d\n", error);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void __exit gio_exit(void)
|
||||
{
|
||||
cdev_del(cdev_p);
|
||||
unregister_chrdev_region(dev, DEVCOUNT);
|
||||
}
|
||||
|
||||
module_init(gio_init);
|
||||
module_exit(gio_exit);
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
@@ -1,250 +0,0 @@
|
||||
/*
|
||||
* arch/sh/boards/landisk/io.c
|
||||
*
|
||||
* Copyright (C) 2001 Ian da Silva, Jeremy Siegel
|
||||
* Based largely on io_se.c.
|
||||
*
|
||||
* I/O routine for I-O Data Device, Inc. LANDISK.
|
||||
*
|
||||
* Initial version only to support LAN access; some
|
||||
* placeholder code from io_landisk.c left in with the
|
||||
* expectation of later SuperIO and PCMCIA access.
|
||||
*/
|
||||
/*
|
||||
* modifed by kogiidena
|
||||
* 2005.03.03
|
||||
*/
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/pci.h>
|
||||
#include <asm/landisk/iodata_landisk.h>
|
||||
#include <asm/addrspace.h>
|
||||
#include <asm/io.h>
|
||||
|
||||
extern void *area5_io_base; /* Area 5 I/O Base address */
|
||||
extern void *area6_io_base; /* Area 6 I/O Base address */
|
||||
|
||||
static inline unsigned long port2adr(unsigned int port)
|
||||
{
|
||||
if ((0x1f0 <= port && port < 0x1f8) || port == 0x3f6)
|
||||
if (port == 0x3f6)
|
||||
return ((unsigned long)area5_io_base + 0x2c);
|
||||
else
|
||||
return ((unsigned long)area5_io_base + PA_PIDE_OFFSET +
|
||||
((port - 0x1f0) << 1));
|
||||
else if ((0x170 <= port && port < 0x178) || port == 0x376)
|
||||
if (port == 0x376)
|
||||
return ((unsigned long)area6_io_base + 0x2c);
|
||||
else
|
||||
return ((unsigned long)area6_io_base + PA_SIDE_OFFSET +
|
||||
((port - 0x170) << 1));
|
||||
else
|
||||
maybebadio((unsigned long)port);
|
||||
|
||||
return port;
|
||||
}
|
||||
|
||||
/*
|
||||
* General outline: remap really low stuff [eventually] to SuperIO,
|
||||
* stuff in PCI IO space (at or above window at pci.h:PCIBIOS_MIN_IO)
|
||||
* is mapped through the PCI IO window. Stuff with high bits (PXSEG)
|
||||
* should be way beyond the window, and is used w/o translation for
|
||||
* compatibility.
|
||||
*/
|
||||
u8 landisk_inb(unsigned long port)
|
||||
{
|
||||
if (PXSEG(port))
|
||||
return ctrl_inb(port);
|
||||
else if (is_pci_ioaddr(port))
|
||||
return ctrl_inb(pci_ioaddr(port));
|
||||
|
||||
return ctrl_inw(port2adr(port)) & 0xff;
|
||||
}
|
||||
|
||||
u8 landisk_inb_p(unsigned long port)
|
||||
{
|
||||
u8 v;
|
||||
|
||||
if (PXSEG(port))
|
||||
v = ctrl_inb(port);
|
||||
else if (is_pci_ioaddr(port))
|
||||
v = ctrl_inb(pci_ioaddr(port));
|
||||
else
|
||||
v = ctrl_inw(port2adr(port)) & 0xff;
|
||||
|
||||
ctrl_delay();
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
u16 landisk_inw(unsigned long port)
|
||||
{
|
||||
if (PXSEG(port))
|
||||
return ctrl_inw(port);
|
||||
else if (is_pci_ioaddr(port))
|
||||
return ctrl_inw(pci_ioaddr(port));
|
||||
else
|
||||
maybebadio(port);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
u32 landisk_inl(unsigned long port)
|
||||
{
|
||||
if (PXSEG(port))
|
||||
return ctrl_inl(port);
|
||||
else if (is_pci_ioaddr(port))
|
||||
return ctrl_inl(pci_ioaddr(port));
|
||||
else
|
||||
maybebadio(port);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void landisk_outb(u8 value, unsigned long port)
|
||||
{
|
||||
if (PXSEG(port))
|
||||
ctrl_outb(value, port);
|
||||
else if (is_pci_ioaddr(port))
|
||||
ctrl_outb(value, pci_ioaddr(port));
|
||||
else
|
||||
ctrl_outw(value, port2adr(port));
|
||||
}
|
||||
|
||||
void landisk_outb_p(u8 value, unsigned long port)
|
||||
{
|
||||
if (PXSEG(port))
|
||||
ctrl_outb(value, port);
|
||||
else if (is_pci_ioaddr(port))
|
||||
ctrl_outb(value, pci_ioaddr(port));
|
||||
else
|
||||
ctrl_outw(value, port2adr(port));
|
||||
ctrl_delay();
|
||||
}
|
||||
|
||||
void landisk_outw(u16 value, unsigned long port)
|
||||
{
|
||||
if (PXSEG(port))
|
||||
ctrl_outw(value, port);
|
||||
else if (is_pci_ioaddr(port))
|
||||
ctrl_outw(value, pci_ioaddr(port));
|
||||
else
|
||||
maybebadio(port);
|
||||
}
|
||||
|
||||
void landisk_outl(u32 value, unsigned long port)
|
||||
{
|
||||
if (PXSEG(port))
|
||||
ctrl_outl(value, port);
|
||||
else if (is_pci_ioaddr(port))
|
||||
ctrl_outl(value, pci_ioaddr(port));
|
||||
else
|
||||
maybebadio(port);
|
||||
}
|
||||
|
||||
void landisk_insb(unsigned long port, void *dst, unsigned long count)
|
||||
{
|
||||
volatile u16 *p;
|
||||
u8 *buf = dst;
|
||||
|
||||
if (PXSEG(port)) {
|
||||
while (count--)
|
||||
*buf++ = *(volatile u8 *)port;
|
||||
} else if (is_pci_ioaddr(port)) {
|
||||
volatile u8 *bp = (volatile u8 *)pci_ioaddr(port);
|
||||
|
||||
while (count--)
|
||||
*buf++ = *bp;
|
||||
} else {
|
||||
p = (volatile u16 *)port2adr(port);
|
||||
while (count--)
|
||||
*buf++ = *p & 0xff;
|
||||
}
|
||||
}
|
||||
|
||||
void landisk_insw(unsigned long port, void *dst, unsigned long count)
|
||||
{
|
||||
volatile u16 *p;
|
||||
u16 *buf = dst;
|
||||
|
||||
if (PXSEG(port))
|
||||
p = (volatile u16 *)port;
|
||||
else if (is_pci_ioaddr(port))
|
||||
p = (volatile u16 *)pci_ioaddr(port);
|
||||
else
|
||||
p = (volatile u16 *)port2adr(port);
|
||||
while (count--)
|
||||
*buf++ = *p;
|
||||
}
|
||||
|
||||
void landisk_insl(unsigned long port, void *dst, unsigned long count)
|
||||
{
|
||||
u32 *buf = dst;
|
||||
|
||||
if (is_pci_ioaddr(port)) {
|
||||
volatile u32 *p = (volatile u32 *)pci_ioaddr(port);
|
||||
|
||||
while (count--)
|
||||
*buf++ = *p;
|
||||
} else
|
||||
maybebadio(port);
|
||||
}
|
||||
|
||||
void landisk_outsb(unsigned long port, const void *src, unsigned long count)
|
||||
{
|
||||
volatile u16 *p;
|
||||
const u8 *buf = src;
|
||||
|
||||
if (PXSEG(port))
|
||||
while (count--)
|
||||
ctrl_outb(*buf++, port);
|
||||
else if (is_pci_ioaddr(port)) {
|
||||
volatile u8 *bp = (volatile u8 *)pci_ioaddr(port);
|
||||
|
||||
while (count--)
|
||||
*bp = *buf++;
|
||||
} else {
|
||||
p = (volatile u16 *)port2adr(port);
|
||||
while (count--)
|
||||
*p = *buf++;
|
||||
}
|
||||
}
|
||||
|
||||
void landisk_outsw(unsigned long port, const void *src, unsigned long count)
|
||||
{
|
||||
volatile u16 *p;
|
||||
const u16 *buf = src;
|
||||
|
||||
if (PXSEG(port))
|
||||
p = (volatile u16 *)port;
|
||||
else if (is_pci_ioaddr(port))
|
||||
p = (volatile u16 *)pci_ioaddr(port);
|
||||
else
|
||||
p = (volatile u16 *)port2adr(port);
|
||||
|
||||
while (count--)
|
||||
*p = *buf++;
|
||||
}
|
||||
|
||||
void landisk_outsl(unsigned long port, const void *src, unsigned long count)
|
||||
{
|
||||
const u32 *buf = src;
|
||||
|
||||
if (is_pci_ioaddr(port)) {
|
||||
volatile u32 *p = (volatile u32 *)pci_ioaddr(port);
|
||||
|
||||
while (count--)
|
||||
*p = *buf++;
|
||||
} else
|
||||
maybebadio(port);
|
||||
}
|
||||
|
||||
void __iomem *landisk_ioport_map(unsigned long port, unsigned int size)
|
||||
{
|
||||
if (PXSEG(port))
|
||||
return (void __iomem *)port;
|
||||
else if (is_pci_ioaddr(port))
|
||||
return (void __iomem *)pci_ioaddr(port);
|
||||
|
||||
return (void __iomem *)port2adr(port);
|
||||
}
|
||||
@@ -1,18 +1,16 @@
|
||||
/*
|
||||
* arch/sh/boards/landisk/irq.c
|
||||
*
|
||||
* I-O DATA Device, Inc. LANDISK Support
|
||||
*
|
||||
* Copyright (C) 2005-2007 kogiidena
|
||||
*
|
||||
* Copyright (C) 2001 Ian da Silva, Jeremy Siegel
|
||||
* Based largely on io_se.c.
|
||||
*
|
||||
* I/O routine for I-O Data Device, Inc. LANDISK.
|
||||
*
|
||||
* Initial version only to support LAN access; some
|
||||
* placeholder code from io_landisk.c left in with the
|
||||
* expectation of later SuperIO and PCMCIA access.
|
||||
*/
|
||||
/*
|
||||
* modified by kogiidena
|
||||
* 2005.03.03
|
||||
* This file is subject to the terms and conditions of the GNU General Public
|
||||
* License. See the file "COPYING" in the main directory of this archive
|
||||
* for more details.
|
||||
*/
|
||||
#include <linux/init.h>
|
||||
#include <linux/irq.h>
|
||||
@@ -20,71 +18,27 @@
|
||||
#include <linux/io.h>
|
||||
#include <asm/landisk/iodata_landisk.h>
|
||||
|
||||
static void enable_landisk_irq(unsigned int irq);
|
||||
static void disable_landisk_irq(unsigned int irq);
|
||||
|
||||
/* shutdown is same as "disable" */
|
||||
#define shutdown_landisk_irq disable_landisk_irq
|
||||
|
||||
static void ack_landisk_irq(unsigned int irq);
|
||||
static void end_landisk_irq(unsigned int irq);
|
||||
|
||||
static unsigned int startup_landisk_irq(unsigned int irq)
|
||||
{
|
||||
enable_landisk_irq(irq);
|
||||
return 0; /* never anything pending */
|
||||
}
|
||||
|
||||
static void disable_landisk_irq(unsigned int irq)
|
||||
{
|
||||
unsigned char val;
|
||||
unsigned char mask = 0xff ^ (0x01 << (irq - 5));
|
||||
|
||||
/* Set the priority in IPR to 0 */
|
||||
val = ctrl_inb(PA_IMASK);
|
||||
val &= mask;
|
||||
ctrl_outb(val, PA_IMASK);
|
||||
ctrl_outb(ctrl_inb(PA_IMASK) & mask, PA_IMASK);
|
||||
}
|
||||
|
||||
static void enable_landisk_irq(unsigned int irq)
|
||||
{
|
||||
unsigned char val;
|
||||
unsigned char value = (0x01 << (irq - 5));
|
||||
|
||||
/* Set priority in IPR back to original value */
|
||||
val = ctrl_inb(PA_IMASK);
|
||||
val |= value;
|
||||
ctrl_outb(val, PA_IMASK);
|
||||
ctrl_outb(ctrl_inb(PA_IMASK) | value, PA_IMASK);
|
||||
}
|
||||
|
||||
static void ack_landisk_irq(unsigned int irq)
|
||||
{
|
||||
disable_landisk_irq(irq);
|
||||
}
|
||||
|
||||
static void end_landisk_irq(unsigned int irq)
|
||||
{
|
||||
if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
|
||||
enable_landisk_irq(irq);
|
||||
}
|
||||
|
||||
static struct hw_interrupt_type landisk_irq_type = {
|
||||
.typename = "LANDISK IRQ",
|
||||
.startup = startup_landisk_irq,
|
||||
.shutdown = shutdown_landisk_irq,
|
||||
.enable = enable_landisk_irq,
|
||||
.disable = disable_landisk_irq,
|
||||
.ack = ack_landisk_irq,
|
||||
.end = end_landisk_irq
|
||||
static struct irq_chip landisk_irq_chip __read_mostly = {
|
||||
.name = "LANDISK",
|
||||
.mask = disable_landisk_irq,
|
||||
.unmask = enable_landisk_irq,
|
||||
.mask_ack = disable_landisk_irq,
|
||||
};
|
||||
|
||||
static void make_landisk_irq(unsigned int irq)
|
||||
{
|
||||
disable_irq_nosync(irq);
|
||||
irq_desc[irq].chip = &landisk_irq_type;
|
||||
disable_landisk_irq(irq);
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize IRQ setting
|
||||
*/
|
||||
@@ -92,6 +46,11 @@ void __init init_landisk_IRQ(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 5; i < 14; i++)
|
||||
make_landisk_irq(i);
|
||||
for (i = 5; i < 14; i++) {
|
||||
disable_irq_nosync(i);
|
||||
set_irq_chip_and_handler_name(i, &landisk_irq_chip,
|
||||
handle_level_irq, "level");
|
||||
enable_landisk_irq(i);
|
||||
}
|
||||
ctrl_outb(0x00, PA_PWRINT_CLR);
|
||||
}
|
||||
|
||||
@@ -1,346 +0,0 @@
|
||||
/*
|
||||
* arch/sh/boards/landisk/landisk_pwb.c -- driver for the Power control switch.
|
||||
*
|
||||
* This driver will also support the I-O DATA Device, Inc. LANDISK Board.
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU General Public
|
||||
* License. See the file "COPYING" in the main directory of this archive
|
||||
* for more details.
|
||||
*
|
||||
* Copylight (C) 2002 Atom Create Engineering Co., Ltd.
|
||||
*
|
||||
* LED control drive function added by kogiidena
|
||||
*/
|
||||
#include <linux/module.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/signal.h>
|
||||
#include <linux/major.h>
|
||||
#include <linux/poll.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/timer.h>
|
||||
#include <linux/interrupt.h>
|
||||
|
||||
#include <asm/system.h>
|
||||
#include <asm/io.h>
|
||||
#include <asm/irq.h>
|
||||
#include <asm/uaccess.h>
|
||||
#include <asm/landisk/iodata_landisk.h>
|
||||
|
||||
#define SHUTDOWN_BTN_MINOR 1 /* Shutdown button device minor no. */
|
||||
#define LED_MINOR 21 /* LED minor no. */
|
||||
#define BTN_MINOR 22 /* BUTTON minor no. */
|
||||
#define GIO_MINOR 40 /* GIO minor no. */
|
||||
|
||||
static int openCnt;
|
||||
static int openCntLED;
|
||||
static int openCntGio;
|
||||
static int openCntBtn;
|
||||
static int landisk_btn;
|
||||
static int landisk_btnctrlpid;
|
||||
/*
|
||||
* Functions prototypes
|
||||
*/
|
||||
|
||||
static int gio_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
|
||||
unsigned long arg);
|
||||
|
||||
static int swdrv_open(struct inode *inode, struct file *filp)
|
||||
{
|
||||
int minor;
|
||||
|
||||
minor = MINOR(inode->i_rdev);
|
||||
filp->private_data = (void *)minor;
|
||||
|
||||
if (minor == SHUTDOWN_BTN_MINOR) {
|
||||
if (openCnt > 0) {
|
||||
return -EALREADY;
|
||||
} else {
|
||||
openCnt++;
|
||||
return 0;
|
||||
}
|
||||
} else if (minor == LED_MINOR) {
|
||||
if (openCntLED > 0) {
|
||||
return -EALREADY;
|
||||
} else {
|
||||
openCntLED++;
|
||||
return 0;
|
||||
}
|
||||
} else if (minor == BTN_MINOR) {
|
||||
if (openCntBtn > 0) {
|
||||
return -EALREADY;
|
||||
} else {
|
||||
openCntBtn++;
|
||||
return 0;
|
||||
}
|
||||
} else if (minor == GIO_MINOR) {
|
||||
if (openCntGio > 0) {
|
||||
return -EALREADY;
|
||||
} else {
|
||||
openCntGio++;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return -ENOENT;
|
||||
|
||||
}
|
||||
|
||||
static int swdrv_close(struct inode *inode, struct file *filp)
|
||||
{
|
||||
int minor;
|
||||
|
||||
minor = MINOR(inode->i_rdev);
|
||||
if (minor == SHUTDOWN_BTN_MINOR) {
|
||||
openCnt--;
|
||||
} else if (minor == LED_MINOR) {
|
||||
openCntLED--;
|
||||
} else if (minor == BTN_MINOR) {
|
||||
openCntBtn--;
|
||||
} else if (minor == GIO_MINOR) {
|
||||
openCntGio--;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int swdrv_read(struct file *filp, char *buff, size_t count,
|
||||
loff_t * ppos)
|
||||
{
|
||||
int minor;
|
||||
minor = (int)(filp->private_data);
|
||||
|
||||
if (!access_ok(VERIFY_WRITE, (void *)buff, count))
|
||||
return -EFAULT;
|
||||
|
||||
if (minor == SHUTDOWN_BTN_MINOR) {
|
||||
if (landisk_btn & 0x10) {
|
||||
put_user(1, buff);
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int swdrv_write(struct file *filp, const char *buff, size_t count,
|
||||
loff_t * ppos)
|
||||
{
|
||||
int minor;
|
||||
minor = (int)(filp->private_data);
|
||||
|
||||
if (minor == SHUTDOWN_BTN_MINOR) {
|
||||
return count;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
static irqreturn_t sw_interrupt(int irq, void *dev_id)
|
||||
{
|
||||
landisk_btn = (0x0ff & (~ctrl_inb(PA_STATUS)));
|
||||
disable_irq(IRQ_BUTTON);
|
||||
disable_irq(IRQ_POWER);
|
||||
ctrl_outb(0x00, PA_PWRINT_CLR);
|
||||
|
||||
if (landisk_btnctrlpid != 0) {
|
||||
kill_proc(landisk_btnctrlpid, SIGUSR1, 1);
|
||||
landisk_btnctrlpid = 0;
|
||||
}
|
||||
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
static const struct file_operations swdrv_fops = {
|
||||
.read = swdrv_read, /* read */
|
||||
.write = swdrv_write, /* write */
|
||||
.open = swdrv_open, /* open */
|
||||
.release = swdrv_close, /* release */
|
||||
.ioctl = gio_ioctl, /* ioctl */
|
||||
|
||||
};
|
||||
|
||||
static char banner[] __initdata =
|
||||
KERN_INFO "LANDISK and USL-5P Button, LED and GIO driver initialized\n";
|
||||
|
||||
int __init swdrv_init(void)
|
||||
{
|
||||
int error;
|
||||
|
||||
printk("%s", banner);
|
||||
|
||||
openCnt = 0;
|
||||
openCntLED = 0;
|
||||
openCntBtn = 0;
|
||||
openCntGio = 0;
|
||||
landisk_btn = 0;
|
||||
landisk_btnctrlpid = 0;
|
||||
|
||||
if ((error = register_chrdev(SHUTDOWN_BTN_MAJOR, "swdrv", &swdrv_fops))) {
|
||||
printk(KERN_ERR
|
||||
"Button, LED and GIO driver:Couldn't register driver, error=%d\n",
|
||||
error);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (request_irq(IRQ_POWER, sw_interrupt, 0, "SHUTDOWNSWITCH", NULL)) {
|
||||
printk(KERN_ERR "Unable to get IRQ 11.\n");
|
||||
return 1;
|
||||
}
|
||||
if (request_irq(IRQ_BUTTON, sw_interrupt, 0, "USL-5P BUTTON", NULL)) {
|
||||
printk(KERN_ERR "Unable to get IRQ 12.\n");
|
||||
return 1;
|
||||
}
|
||||
ctrl_outb(0x00, PA_PWRINT_CLR);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
module_init(swdrv_init);
|
||||
|
||||
/*
|
||||
* gio driver
|
||||
*
|
||||
*/
|
||||
|
||||
#include <asm/landisk/gio.h>
|
||||
|
||||
static int gio_ioctl(struct inode *inode, struct file *filp,
|
||||
unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
int minor;
|
||||
unsigned int data, mask;
|
||||
static unsigned int addr = 0;
|
||||
|
||||
minor = (int)(filp->private_data);
|
||||
|
||||
/* access control */
|
||||
if (minor == GIO_MINOR) {
|
||||
;
|
||||
} else if (minor == LED_MINOR) {
|
||||
if (((cmd & 0x0ff) >= 9) && ((cmd & 0x0ff) < 20)) {
|
||||
;
|
||||
} else {
|
||||
return -EINVAL;
|
||||
}
|
||||
} else if (minor == BTN_MINOR) {
|
||||
if (((cmd & 0x0ff) >= 20) && ((cmd & 0x0ff) < 30)) {
|
||||
;
|
||||
} else {
|
||||
return -EINVAL;
|
||||
}
|
||||
} else {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (cmd & 0x01) { /* write */
|
||||
if (copy_from_user(&data, (int *)arg, sizeof(int))) {
|
||||
return -EFAULT;
|
||||
}
|
||||
}
|
||||
|
||||
switch (cmd) {
|
||||
case GIODRV_IOCSGIOSETADDR: /* addres set */
|
||||
addr = data;
|
||||
break;
|
||||
|
||||
case GIODRV_IOCSGIODATA1: /* write byte */
|
||||
ctrl_outb((unsigned char)(0x0ff & data), addr);
|
||||
break;
|
||||
|
||||
case GIODRV_IOCSGIODATA2: /* write word */
|
||||
if (addr & 0x01) {
|
||||
return -EFAULT;
|
||||
}
|
||||
ctrl_outw((unsigned short int)(0x0ffff & data), addr);
|
||||
break;
|
||||
|
||||
case GIODRV_IOCSGIODATA4: /* write long */
|
||||
if (addr & 0x03) {
|
||||
return -EFAULT;
|
||||
}
|
||||
ctrl_outl(data, addr);
|
||||
break;
|
||||
|
||||
case GIODRV_IOCGGIODATA1: /* read byte */
|
||||
data = ctrl_inb(addr);
|
||||
break;
|
||||
|
||||
case GIODRV_IOCGGIODATA2: /* read word */
|
||||
if (addr & 0x01) {
|
||||
return -EFAULT;
|
||||
}
|
||||
data = ctrl_inw(addr);
|
||||
break;
|
||||
|
||||
case GIODRV_IOCGGIODATA4: /* read long */
|
||||
if (addr & 0x03) {
|
||||
return -EFAULT;
|
||||
}
|
||||
data = ctrl_inl(addr);
|
||||
break;
|
||||
case GIODRV_IOCSGIO_LED: /* write */
|
||||
mask = ((data & 0x00ffffff) << 8)
|
||||
| ((data & 0x0000ffff) << 16)
|
||||
| ((data & 0x000000ff) << 24);
|
||||
landisk_ledparam = data & (~mask);
|
||||
if (landisk_arch == 0) { /* arch == landisk */
|
||||
landisk_ledparam &= 0x03030303;
|
||||
mask = (~(landisk_ledparam >> 22)) & 0x000c;
|
||||
landisk_ledparam |= mask;
|
||||
} else { /* arch == usl-5p */
|
||||
mask = (landisk_ledparam >> 24) & 0x0001;
|
||||
landisk_ledparam |= mask;
|
||||
landisk_ledparam &= 0x007f7f7f;
|
||||
}
|
||||
landisk_ledparam |= 0x80;
|
||||
break;
|
||||
case GIODRV_IOCGGIO_LED: /* read */
|
||||
data = landisk_ledparam;
|
||||
if (landisk_arch == 0) { /* arch == landisk */
|
||||
data &= 0x03030303;
|
||||
} else { /* arch == usl-5p */
|
||||
;
|
||||
}
|
||||
data &= (~0x080);
|
||||
break;
|
||||
case GIODRV_IOCSGIO_BUZZER: /* write */
|
||||
landisk_buzzerparam = data;
|
||||
landisk_ledparam |= 0x80;
|
||||
break;
|
||||
case GIODRV_IOCGGIO_LANDISK: /* read */
|
||||
data = landisk_arch & 0x01;
|
||||
break;
|
||||
case GIODRV_IOCGGIO_BTN: /* read */
|
||||
data = (0x0ff & ctrl_inb(PA_PWRINT_CLR));
|
||||
data <<= 8;
|
||||
data |= (0x0ff & ctrl_inb(PA_IMASK));
|
||||
data <<= 8;
|
||||
data |= (0x0ff & landisk_btn);
|
||||
data <<= 8;
|
||||
data |= (0x0ff & (~ctrl_inb(PA_STATUS)));
|
||||
break;
|
||||
case GIODRV_IOCSGIO_BTNPID: /* write */
|
||||
landisk_btnctrlpid = data;
|
||||
landisk_btn = 0;
|
||||
if (irq_desc[IRQ_BUTTON].depth) {
|
||||
enable_irq(IRQ_BUTTON);
|
||||
}
|
||||
if (irq_desc[IRQ_POWER].depth) {
|
||||
enable_irq(IRQ_POWER);
|
||||
}
|
||||
break;
|
||||
case GIODRV_IOCGGIO_BTNPID: /* read */
|
||||
data = landisk_btnctrlpid;
|
||||
break;
|
||||
default:
|
||||
return -EFAULT;
|
||||
break;
|
||||
}
|
||||
|
||||
if ((cmd & 0x01) == 0) { /* read */
|
||||
if (copy_to_user((int *)arg, &data, sizeof(int))) {
|
||||
return -EFAULT;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,143 @@
|
||||
/*
|
||||
* arch/sh/boards/landisk/psw.c
|
||||
*
|
||||
* push switch support for LANDISK and USL-5P
|
||||
*
|
||||
* Copyright (C) 2006-2007 Paul Mundt
|
||||
* Copyright (C) 2007 kogiidena
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU General Public
|
||||
* License. See the file "COPYING" in the main directory of this archive
|
||||
* for more details.
|
||||
*/
|
||||
#include <linux/io.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <asm/landisk/iodata_landisk.h>
|
||||
#include <asm/push-switch.h>
|
||||
|
||||
static irqreturn_t psw_irq_handler(int irq, void *arg)
|
||||
{
|
||||
struct platform_device *pdev = arg;
|
||||
struct push_switch *psw = platform_get_drvdata(pdev);
|
||||
struct push_switch_platform_info *psw_info = pdev->dev.platform_data;
|
||||
unsigned int sw_value;
|
||||
int ret = 0;
|
||||
|
||||
sw_value = (0x0ff & (~ctrl_inb(PA_STATUS)));
|
||||
|
||||
/* Nothing to do if there's no state change */
|
||||
if (psw->state) {
|
||||
ret = 1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* Figure out who raised it */
|
||||
if (sw_value & (1 << psw_info->bit)) {
|
||||
psw->state = 1;
|
||||
mod_timer(&psw->debounce, jiffies + 50);
|
||||
ret = 1;
|
||||
}
|
||||
|
||||
out:
|
||||
/* Clear the switch IRQs */
|
||||
ctrl_outb(0x00, PA_PWRINT_CLR);
|
||||
|
||||
return IRQ_RETVAL(ret);
|
||||
}
|
||||
|
||||
static struct resource psw_power_resources[] = {
|
||||
[0] = {
|
||||
.start = IRQ_POWER,
|
||||
.flags = IORESOURCE_IRQ,
|
||||
},
|
||||
};
|
||||
|
||||
static struct resource psw_usl5p_resources[] = {
|
||||
[0] = {
|
||||
.start = IRQ_BUTTON,
|
||||
.flags = IORESOURCE_IRQ,
|
||||
},
|
||||
};
|
||||
|
||||
static struct push_switch_platform_info psw_power_platform_data = {
|
||||
.name = "psw_power",
|
||||
.bit = 4,
|
||||
.irq_flags = IRQF_SHARED,
|
||||
.irq_handler = psw_irq_handler,
|
||||
};
|
||||
|
||||
static struct push_switch_platform_info psw1_platform_data = {
|
||||
.name = "psw1",
|
||||
.bit = 0,
|
||||
.irq_flags = IRQF_SHARED,
|
||||
.irq_handler = psw_irq_handler,
|
||||
};
|
||||
|
||||
static struct push_switch_platform_info psw2_platform_data = {
|
||||
.name = "psw2",
|
||||
.bit = 2,
|
||||
.irq_flags = IRQF_SHARED,
|
||||
.irq_handler = psw_irq_handler,
|
||||
};
|
||||
|
||||
static struct push_switch_platform_info psw3_platform_data = {
|
||||
.name = "psw3",
|
||||
.bit = 1,
|
||||
.irq_flags = IRQF_SHARED,
|
||||
.irq_handler = psw_irq_handler,
|
||||
};
|
||||
|
||||
static struct platform_device psw_power_switch_device = {
|
||||
.name = "push-switch",
|
||||
.id = 0,
|
||||
.num_resources = ARRAY_SIZE(psw_power_resources),
|
||||
.resource = psw_power_resources,
|
||||
.dev = {
|
||||
.platform_data = &psw_power_platform_data,
|
||||
},
|
||||
};
|
||||
|
||||
static struct platform_device psw1_switch_device = {
|
||||
.name = "push-switch",
|
||||
.id = 1,
|
||||
.num_resources = ARRAY_SIZE(psw_usl5p_resources),
|
||||
.resource = psw_usl5p_resources,
|
||||
.dev = {
|
||||
.platform_data = &psw1_platform_data,
|
||||
},
|
||||
};
|
||||
|
||||
static struct platform_device psw2_switch_device = {
|
||||
.name = "push-switch",
|
||||
.id = 2,
|
||||
.num_resources = ARRAY_SIZE(psw_usl5p_resources),
|
||||
.resource = psw_usl5p_resources,
|
||||
.dev = {
|
||||
.platform_data = &psw2_platform_data,
|
||||
},
|
||||
};
|
||||
|
||||
static struct platform_device psw3_switch_device = {
|
||||
.name = "push-switch",
|
||||
.id = 3,
|
||||
.num_resources = ARRAY_SIZE(psw_usl5p_resources),
|
||||
.resource = psw_usl5p_resources,
|
||||
.dev = {
|
||||
.platform_data = &psw3_platform_data,
|
||||
},
|
||||
};
|
||||
|
||||
static struct platform_device *psw_devices[] = {
|
||||
&psw_power_switch_device,
|
||||
&psw1_switch_device,
|
||||
&psw2_switch_device,
|
||||
&psw3_switch_device,
|
||||
};
|
||||
|
||||
static int __init psw_init(void)
|
||||
{
|
||||
return platform_add_devices(psw_devices, ARRAY_SIZE(psw_devices));
|
||||
}
|
||||
module_init(psw_init);
|
||||
@@ -1,91 +0,0 @@
|
||||
/*
|
||||
* arch/sh/boards/landisk/rtc.c -- RTC support
|
||||
*
|
||||
* Copyright (C) 2000 Philipp Rumpf <prumpf@tux.org>
|
||||
* Copyright (C) 1999 Tetsuya Okada & Niibe Yutaka
|
||||
*/
|
||||
/*
|
||||
* modifed by kogiidena
|
||||
* 2005.09.16
|
||||
*/
|
||||
#include <linux/init.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/time.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/bcd.h>
|
||||
#include <asm/rtc.h>
|
||||
|
||||
extern spinlock_t rtc_lock;
|
||||
|
||||
extern void
|
||||
rs5c313_set_cmos_time(unsigned int BCD_yr, unsigned int BCD_mon,
|
||||
unsigned int BCD_day, unsigned int BCD_hr,
|
||||
unsigned int BCD_min, unsigned int BCD_sec);
|
||||
|
||||
extern unsigned long
|
||||
rs5c313_get_cmos_time(unsigned int *BCD_yr, unsigned int *BCD_mon,
|
||||
unsigned int *BCD_day, unsigned int *BCD_hr,
|
||||
unsigned int *BCD_min, unsigned int *BCD_sec);
|
||||
|
||||
void landisk_rtc_gettimeofday(struct timespec *tv)
|
||||
{
|
||||
unsigned int BCD_yr, BCD_mon, BCD_day, BCD_hr, BCD_min, BCD_sec;
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&rtc_lock, flags);
|
||||
tv->tv_sec = rs5c313_get_cmos_time
|
||||
(&BCD_yr, &BCD_mon, &BCD_day, &BCD_hr, &BCD_min, &BCD_sec);
|
||||
tv->tv_nsec = 0;
|
||||
spin_unlock_irqrestore(&rtc_lock, flags);
|
||||
}
|
||||
|
||||
int landisk_rtc_settimeofday(const time_t secs)
|
||||
{
|
||||
int retval = 0;
|
||||
int real_seconds, real_minutes, cmos_minutes;
|
||||
unsigned long flags;
|
||||
unsigned long nowtime = secs;
|
||||
unsigned int BCD_yr, BCD_mon, BCD_day, BCD_hr, BCD_min, BCD_sec;
|
||||
|
||||
spin_lock_irqsave(&rtc_lock, flags);
|
||||
|
||||
rs5c313_get_cmos_time
|
||||
(&BCD_yr, &BCD_mon, &BCD_day, &BCD_hr, &BCD_min, &BCD_sec);
|
||||
cmos_minutes = BCD_min;
|
||||
BCD_TO_BIN(cmos_minutes);
|
||||
|
||||
/*
|
||||
* since we're only adjusting minutes and seconds,
|
||||
* don't interfere with hour overflow. This avoids
|
||||
* messing with unknown time zones but requires your
|
||||
* RTC not to be off by more than 15 minutes
|
||||
*/
|
||||
real_seconds = nowtime % 60;
|
||||
real_minutes = nowtime / 60;
|
||||
if (((abs(real_minutes - cmos_minutes) + 15) / 30) & 1)
|
||||
real_minutes += 30; /* correct for half hour time zone */
|
||||
real_minutes %= 60;
|
||||
|
||||
if (abs(real_minutes - cmos_minutes) < 30) {
|
||||
BIN_TO_BCD(real_seconds);
|
||||
BIN_TO_BCD(real_minutes);
|
||||
rs5c313_set_cmos_time(BCD_yr, BCD_mon, BCD_day, BCD_hr,
|
||||
real_minutes, real_seconds);
|
||||
} else {
|
||||
printk(KERN_WARNING
|
||||
"set_rtc_time: can't update from %d to %d\n",
|
||||
cmos_minutes, real_minutes);
|
||||
retval = -1;
|
||||
}
|
||||
|
||||
spin_unlock_irqrestore(&rtc_lock, flags);
|
||||
return retval;
|
||||
}
|
||||
|
||||
void landisk_time_init(void)
|
||||
{
|
||||
rtc_sh_get_time = landisk_rtc_gettimeofday;
|
||||
rtc_sh_set_time = landisk_rtc_settimeofday;
|
||||
}
|
||||
+42
-119
@@ -1,144 +1,90 @@
|
||||
/*
|
||||
* arch/sh/boards/landisk/setup.c
|
||||
*
|
||||
* Copyright (C) 2000 Kazumoto Kojima
|
||||
* Copyright (C) 2002 Paul Mundt
|
||||
*
|
||||
* I-O DATA Device, Inc. LANDISK Support.
|
||||
*
|
||||
* Modified for LANDISK by
|
||||
* Atom Create Engineering Co., Ltd. 2002.
|
||||
*
|
||||
* modifed by kogiidena
|
||||
* 2005.09.16
|
||||
* Copyright (C) 2000 Kazumoto Kojima
|
||||
* Copyright (C) 2002 Paul Mundt
|
||||
* Copylight (C) 2002 Atom Create Engineering Co., Ltd.
|
||||
* Copyright (C) 2005-2007 kogiidena
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU General Public
|
||||
* License. See the file "COPYING" in the main directory of this archive
|
||||
* for more details.
|
||||
*/
|
||||
#include <linux/init.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/pata_platform.h>
|
||||
#include <linux/pm.h>
|
||||
#include <linux/mm.h>
|
||||
#include <asm/machvec.h>
|
||||
#include <asm/rtc.h>
|
||||
#include <asm/landisk/iodata_landisk.h>
|
||||
#include <asm/io.h>
|
||||
|
||||
void landisk_time_init(void);
|
||||
void init_landisk_IRQ(void);
|
||||
|
||||
int landisk_ledparam;
|
||||
int landisk_buzzerparam;
|
||||
int landisk_arch;
|
||||
|
||||
/* cycle the led's in the clasic knightrider/sun pattern */
|
||||
static void heartbeat_landisk(void)
|
||||
{
|
||||
static unsigned int cnt = 0, blink = 0x00, period = 25;
|
||||
volatile u8 *p = (volatile u8 *)PA_LED;
|
||||
char data;
|
||||
|
||||
if ((landisk_ledparam & 0x080) == 0)
|
||||
return;
|
||||
|
||||
cnt += 1;
|
||||
|
||||
if (cnt < period)
|
||||
return;
|
||||
|
||||
cnt = 0;
|
||||
blink++;
|
||||
|
||||
data = (blink & 0x01) ? (landisk_ledparam >> 16) : 0;
|
||||
data |= (blink & 0x02) ? (landisk_ledparam >> 8) : 0;
|
||||
data |= landisk_ledparam;
|
||||
|
||||
/* buzzer */
|
||||
if (landisk_buzzerparam & 0x1) {
|
||||
data |= 0x80;
|
||||
} else {
|
||||
data &= 0x7f;
|
||||
}
|
||||
*p = data;
|
||||
|
||||
if (((landisk_ledparam & 0x007f7f00) == 0) &&
|
||||
(landisk_buzzerparam == 0))
|
||||
landisk_ledparam &= (~0x0080);
|
||||
|
||||
landisk_buzzerparam >>= 1;
|
||||
}
|
||||
|
||||
static void landisk_power_off(void)
|
||||
{
|
||||
ctrl_outb(0x01, PA_SHUTDOWN);
|
||||
}
|
||||
|
||||
static void check_usl5p(void)
|
||||
{
|
||||
volatile u8 *p = (volatile u8 *)PA_LED;
|
||||
u8 tmp1, tmp2;
|
||||
static struct resource cf_ide_resources[3];
|
||||
|
||||
tmp1 = *p;
|
||||
*p = 0x40;
|
||||
tmp2 = *p;
|
||||
*p = tmp1;
|
||||
static struct pata_platform_info pata_info = {
|
||||
.ioport_shift = 1,
|
||||
};
|
||||
|
||||
landisk_arch = (tmp2 == 0x40);
|
||||
if (landisk_arch == 1) {
|
||||
/* arch == usl-5p */
|
||||
landisk_ledparam = 0x00000380;
|
||||
landisk_ledparam |= (tmp1 & 0x07c);
|
||||
} else {
|
||||
/* arch == landisk */
|
||||
landisk_ledparam = 0x02000180;
|
||||
landisk_ledparam |= 0x04;
|
||||
}
|
||||
}
|
||||
static struct platform_device cf_ide_device = {
|
||||
.name = "pata_platform",
|
||||
.id = -1,
|
||||
.num_resources = ARRAY_SIZE(cf_ide_resources),
|
||||
.resource = cf_ide_resources,
|
||||
.dev = {
|
||||
.platform_data = &pata_info,
|
||||
},
|
||||
};
|
||||
|
||||
void *area5_io_base;
|
||||
void *area6_io_base;
|
||||
static struct platform_device *landisk_devices[] __initdata = {
|
||||
&cf_ide_device,
|
||||
};
|
||||
|
||||
static int __init landisk_cf_init(void)
|
||||
static int __init landisk_devices_setup(void)
|
||||
{
|
||||
pgprot_t prot;
|
||||
unsigned long paddrbase, psize;
|
||||
unsigned long paddrbase;
|
||||
void *cf_ide_base;
|
||||
|
||||
/* open I/O area window */
|
||||
paddrbase = virt_to_phys((void *)PA_AREA5_IO);
|
||||
psize = PAGE_SIZE;
|
||||
prot = PAGE_KERNEL_PCC(1, _PAGE_PCC_IO16);
|
||||
area5_io_base = p3_ioremap(paddrbase, psize, prot.pgprot);
|
||||
if (!area5_io_base) {
|
||||
cf_ide_base = p3_ioremap(paddrbase, PAGE_SIZE, prot.pgprot);
|
||||
if (!cf_ide_base) {
|
||||
printk("allocate_cf_area : can't open CF I/O window!\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
paddrbase = virt_to_phys((void *)PA_AREA6_IO);
|
||||
psize = PAGE_SIZE;
|
||||
prot = PAGE_KERNEL_PCC(0, _PAGE_PCC_IO16);
|
||||
area6_io_base = p3_ioremap(paddrbase, psize, prot.pgprot);
|
||||
if (!area6_io_base) {
|
||||
printk("allocate_cf_area : can't open HDD I/O window!\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
/* IDE cmd address : 0x1f0-0x1f7 and 0x3f6 */
|
||||
cf_ide_resources[0].start = (unsigned long)cf_ide_base + 0x40;
|
||||
cf_ide_resources[0].end = (unsigned long)cf_ide_base + 0x40 + 0x0f;
|
||||
cf_ide_resources[0].flags = IORESOURCE_IO;
|
||||
cf_ide_resources[1].start = (unsigned long)cf_ide_base + 0x2c;
|
||||
cf_ide_resources[1].end = (unsigned long)cf_ide_base + 0x2c + 0x03;
|
||||
cf_ide_resources[1].flags = IORESOURCE_IO;
|
||||
cf_ide_resources[2].start = IRQ_FATA;
|
||||
cf_ide_resources[2].flags = IORESOURCE_IRQ;
|
||||
|
||||
printk(KERN_INFO "Allocate Area5/6 success.\n");
|
||||
|
||||
/* XXX : do we need attribute and common-memory area also? */
|
||||
|
||||
return 0;
|
||||
return platform_add_devices(landisk_devices,
|
||||
ARRAY_SIZE(landisk_devices));
|
||||
}
|
||||
|
||||
__initcall(landisk_devices_setup);
|
||||
|
||||
static void __init landisk_setup(char **cmdline_p)
|
||||
{
|
||||
device_initcall(landisk_cf_init);
|
||||
|
||||
landisk_buzzerparam = 0;
|
||||
check_usl5p();
|
||||
/* LED ON */
|
||||
ctrl_outb(ctrl_inb(PA_LED) | 0x03, PA_LED);
|
||||
|
||||
printk(KERN_INFO "I-O DATA DEVICE, INC. \"LANDISK Series\" support.\n");
|
||||
|
||||
board_time_init = landisk_time_init;
|
||||
pm_power_off = landisk_power_off;
|
||||
}
|
||||
|
||||
@@ -148,29 +94,6 @@ static void __init landisk_setup(char **cmdline_p)
|
||||
struct sh_machine_vector mv_landisk __initmv = {
|
||||
.mv_name = "LANDISK",
|
||||
.mv_setup = landisk_setup,
|
||||
.mv_nr_irqs = 72,
|
||||
.mv_inb = landisk_inb,
|
||||
.mv_inw = landisk_inw,
|
||||
.mv_inl = landisk_inl,
|
||||
.mv_outb = landisk_outb,
|
||||
.mv_outw = landisk_outw,
|
||||
.mv_outl = landisk_outl,
|
||||
.mv_inb_p = landisk_inb_p,
|
||||
.mv_inw_p = landisk_inw,
|
||||
.mv_inl_p = landisk_inl,
|
||||
.mv_outb_p = landisk_outb_p,
|
||||
.mv_outw_p = landisk_outw,
|
||||
.mv_outl_p = landisk_outl,
|
||||
.mv_insb = landisk_insb,
|
||||
.mv_insw = landisk_insw,
|
||||
.mv_insl = landisk_insl,
|
||||
.mv_outsb = landisk_outsb,
|
||||
.mv_outsw = landisk_outsw,
|
||||
.mv_outsl = landisk_outsl,
|
||||
.mv_ioport_map = landisk_ioport_map,
|
||||
.mv_init_irq = init_landisk_IRQ,
|
||||
#ifdef CONFIG_HEARTBEAT
|
||||
.mv_heartbeat = heartbeat_landisk,
|
||||
#endif
|
||||
};
|
||||
ALIAS_MV(landisk)
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
#
|
||||
# Makefile for the L-BOX RE2 specific parts of the kernel
|
||||
# Copyright (c) 2007 Nobuhiro Iwamatsu
|
||||
|
||||
obj-y := setup.o irq.o
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* linux/arch/sh/boards/lboxre2/irq.c
|
||||
*
|
||||
* Copyright (C) 2007 Nobuhiro Iwamatsu
|
||||
*
|
||||
* NTT COMWARE L-BOX RE2 Support.
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU General Public
|
||||
* License. See the file "COPYING" in the main directory of this archive
|
||||
* for more details.
|
||||
*
|
||||
*/
|
||||
#include <linux/init.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/irq.h>
|
||||
#include <asm/irq.h>
|
||||
#include <asm/io.h>
|
||||
#include <asm/lboxre2.h>
|
||||
|
||||
/*
|
||||
* Initialize IRQ setting
|
||||
*/
|
||||
void __init init_lboxre2_IRQ(void)
|
||||
{
|
||||
make_imask_irq(IRQ_CF1);
|
||||
make_imask_irq(IRQ_CF0);
|
||||
make_imask_irq(IRQ_INTD);
|
||||
make_imask_irq(IRQ_ETH1);
|
||||
make_imask_irq(IRQ_ETH0);
|
||||
make_imask_irq(IRQ_INTA);
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
* linux/arch/sh/boards/lbox/setup.c
|
||||
*
|
||||
* Copyright (C) 2007 Nobuhiro Iwamatsu
|
||||
*
|
||||
* NTT COMWARE L-BOX RE2 Support
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU General Public
|
||||
* License. See the file "COPYING" in the main directory of this archive
|
||||
* for more details.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <linux/init.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/pata_platform.h>
|
||||
#include <asm/machvec.h>
|
||||
#include <asm/addrspace.h>
|
||||
#include <asm/lboxre2.h>
|
||||
#include <asm/io.h>
|
||||
|
||||
static struct resource cf_ide_resources[] = {
|
||||
[0] = {
|
||||
.start = 0x1f0,
|
||||
.end = 0x1f0 + 8 ,
|
||||
.flags = IORESOURCE_IO,
|
||||
},
|
||||
[1] = {
|
||||
.start = 0x1f0 + 0x206,
|
||||
.end = 0x1f0 +8 + 0x206 + 8,
|
||||
.flags = IORESOURCE_IO,
|
||||
},
|
||||
[2] = {
|
||||
.start = IRQ_CF0,
|
||||
.flags = IORESOURCE_IRQ,
|
||||
},
|
||||
};
|
||||
|
||||
static struct platform_device cf_ide_device = {
|
||||
.name = "pata_platform",
|
||||
.id = -1,
|
||||
.num_resources = ARRAY_SIZE(cf_ide_resources),
|
||||
.resource = cf_ide_resources,
|
||||
};
|
||||
|
||||
static struct platform_device *lboxre2_devices[] __initdata = {
|
||||
&cf_ide_device,
|
||||
};
|
||||
|
||||
static int __init lboxre2_devices_setup(void)
|
||||
{
|
||||
u32 cf0_io_base; /* Boot CF base address */
|
||||
pgprot_t prot;
|
||||
unsigned long paddrbase, psize;
|
||||
|
||||
/* open I/O area window */
|
||||
paddrbase = virt_to_phys((void*)PA_AREA5_IO);
|
||||
psize = PAGE_SIZE;
|
||||
prot = PAGE_KERNEL_PCC( 1 , _PAGE_PCC_IO16);
|
||||
cf0_io_base = (u32)p3_ioremap(paddrbase, psize, prot.pgprot);
|
||||
if (!cf0_io_base) {
|
||||
printk(KERN_ERR "%s : can't open CF I/O window!\n" , __func__ );
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
cf_ide_resources[0].start += cf0_io_base ;
|
||||
cf_ide_resources[0].end += cf0_io_base ;
|
||||
cf_ide_resources[1].start += cf0_io_base ;
|
||||
cf_ide_resources[1].end += cf0_io_base ;
|
||||
|
||||
return platform_add_devices(lboxre2_devices,
|
||||
ARRAY_SIZE(lboxre2_devices));
|
||||
|
||||
}
|
||||
device_initcall(lboxre2_devices_setup);
|
||||
|
||||
/*
|
||||
* The Machine Vector
|
||||
*/
|
||||
struct sh_machine_vector mv_lboxre2 __initmv = {
|
||||
.mv_name = "L-BOX RE2",
|
||||
.mv_nr_irqs = 72,
|
||||
.mv_init_irq = init_lboxre2_IRQ,
|
||||
};
|
||||
ALIAS_MV(lboxre2)
|
||||
@@ -1,14 +1,24 @@
|
||||
if SH_R7780RP
|
||||
if SH_HIGHLANDER
|
||||
|
||||
menu "R7780RP options"
|
||||
choice
|
||||
prompt "Highlander options"
|
||||
default SH_R7780MP
|
||||
|
||||
config SH_R7780RP
|
||||
bool "R7780RP-1 board support"
|
||||
select CPU_SUBTYPE_SH7780
|
||||
|
||||
config SH_R7780MP
|
||||
bool "R7780MP board support"
|
||||
default y
|
||||
select CPU_SUBTYPE_SH7780
|
||||
help
|
||||
Selecting this option will enable support for the mass-production
|
||||
version of the R7780RP. If in doubt, say Y.
|
||||
|
||||
endmenu
|
||||
config SH_R7785RP
|
||||
bool "R7785RP board support"
|
||||
select CPU_SUBTYPE_SH7785
|
||||
|
||||
endchoice
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# Makefile for the R7780RP-1 specific parts of the kernel
|
||||
#
|
||||
|
||||
obj-y := setup.o irq.o
|
||||
|
||||
irqinit-y := irq-r7780rp.o
|
||||
irqinit-$(CONFIG_SH_R7785RP) := irq-r7785rp.o
|
||||
obj-$(CONFIG_PUSH_SWITCH) += psw.o
|
||||
obj-y := setup.o irq.o $(irqinit-y)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user