aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/boards/adx
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /arch/sh/boards/adx
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'arch/sh/boards/adx')
-rw-r--r--arch/sh/boards/adx/Makefile6
-rw-r--r--arch/sh/boards/adx/irq.c31
-rw-r--r--arch/sh/boards/adx/irq_maskreg.c107
-rw-r--r--arch/sh/boards/adx/setup.c56
4 files changed, 200 insertions, 0 deletions
diff --git a/arch/sh/boards/adx/Makefile b/arch/sh/boards/adx/Makefile
new file mode 100644
index 000000000000..5b1c531b3991
--- /dev/null
+++ b/arch/sh/boards/adx/Makefile
@@ -0,0 +1,6 @@
1#
2# Makefile for ADX boards
3#
4
5obj-y := setup.o irq.o irq_maskreq.o
6
diff --git a/arch/sh/boards/adx/irq.c b/arch/sh/boards/adx/irq.c
new file mode 100644
index 000000000000..c6ca409dff98
--- /dev/null
+++ b/arch/sh/boards/adx/irq.c
@@ -0,0 +1,31 @@
1/*
2 * linux/arch/sh/boards/adx/irq.c
3 *
4 * Copyright (C) 2001 A&D Co., Ltd.
5 *
6 * I/O routine and setup routines for A&D ADX Board
7 *
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive
10 * for more details.
11 *
12 */
13
14#include <asm/irq.h>
15
16void init_adx_IRQ(void)
17{
18 int i;
19
20/* printk("init_adx_IRQ()\n");*/
21 /* setup irq_mask_register */
22 irq_mask_register = (unsigned short *)0xa6000008;
23
24 /* cover all external interrupt area by maskreg_irq_type
25 * (Actually, irq15 doesn't exist)
26 */
27 for (i = 0; i < 16; i++) {
28 make_maskreg_irq(i);
29 disable_irq(i);
30 }
31}
diff --git a/arch/sh/boards/adx/irq_maskreg.c b/arch/sh/boards/adx/irq_maskreg.c
new file mode 100644
index 000000000000..ca91bb0f1f5c
--- /dev/null
+++ b/arch/sh/boards/adx/irq_maskreg.c
@@ -0,0 +1,107 @@
1/*
2 * linux/arch/sh/kernel/irq_maskreg.c
3 *
4 * Copyright (C) 2001 A&D Co., Ltd. <http://www.aandd.co.jp>
5 *
6 * This file may be copied or modified under the terms of the GNU
7 * General Public License. See linux/COPYING for more information.
8 *
9 * Interrupt handling for Simple external interrupt mask register
10 *
11 * This is for the machine which have single 16 bit register
12 * for masking external IRQ individually.
13 * Each bit of the register is for masking each interrupt.
14 */
15
16#include <linux/config.h>
17#include <linux/kernel.h>
18#include <linux/init.h>
19#include <linux/irq.h>
20
21#include <asm/system.h>
22#include <asm/io.h>
23#include <asm/machvec.h>
24
25/* address of external interrupt mask register
26 * address must be set prior to use these (maybe in init_XXX_irq())
27 * XXX : is it better to use .config than specifying it in code? */
28unsigned short *irq_mask_register = 0;
29
30/* forward declaration */
31static unsigned int startup_maskreg_irq(unsigned int irq);
32static void shutdown_maskreg_irq(unsigned int irq);
33static void enable_maskreg_irq(unsigned int irq);
34static void disable_maskreg_irq(unsigned int irq);
35static void mask_and_ack_maskreg(unsigned int);
36static void end_maskreg_irq(unsigned int irq);
37
38/* hw_interrupt_type */
39static struct hw_interrupt_type maskreg_irq_type = {
40 " Mask Register",
41 startup_maskreg_irq,
42 shutdown_maskreg_irq,
43 enable_maskreg_irq,
44 disable_maskreg_irq,
45 mask_and_ack_maskreg,
46 end_maskreg_irq
47};
48
49/* actual implementatin */
50static unsigned int startup_maskreg_irq(unsigned int irq)
51{
52 enable_maskreg_irq(irq);
53 return 0; /* never anything pending */
54}
55
56static void shutdown_maskreg_irq(unsigned int irq)
57{
58 disable_maskreg_irq(irq);
59}
60
61static void disable_maskreg_irq(unsigned int irq)
62{
63 if (irq_mask_register) {
64 unsigned long flags;
65 unsigned short val, mask = 0x01 << irq;
66
67 /* Set "irq"th bit */
68 local_irq_save(flags);
69 val = ctrl_inw((unsigned long)irq_mask_register);
70 val |= mask;
71 ctrl_outw(val, (unsigned long)irq_mask_register);
72 local_irq_restore(flags);
73 }
74}
75
76static void enable_maskreg_irq(unsigned int irq)
77{
78 if (irq_mask_register) {
79 unsigned long flags;
80 unsigned short val, mask = ~(0x01 << irq);
81
82 /* Clear "irq"th bit */
83 local_irq_save(flags);
84 val = ctrl_inw((unsigned long)irq_mask_register);
85 val &= mask;
86 ctrl_outw(val, (unsigned long)irq_mask_register);
87 local_irq_restore(flags);
88 }
89}
90
91static void mask_and_ack_maskreg(unsigned int irq)
92{
93 disable_maskreg_irq(irq);
94}
95
96static void end_maskreg_irq(unsigned int irq)
97{
98 if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
99 enable_maskreg_irq(irq);
100}
101
102void make_maskreg_irq(unsigned int irq)
103{
104 disable_irq_nosync(irq);
105 irq_desc[irq].handler = &maskreg_irq_type;
106 disable_maskreg_irq(irq);
107}
diff --git a/arch/sh/boards/adx/setup.c b/arch/sh/boards/adx/setup.c
new file mode 100644
index 000000000000..4938d9592343
--- /dev/null
+++ b/arch/sh/boards/adx/setup.c
@@ -0,0 +1,56 @@
1/*
2 * linux/arch/sh/board/adx/setup.c
3 *
4 * Copyright (C) 2001 A&D Co., Ltd.
5 *
6 * I/O routine and setup routines for A&D ADX Board
7 *
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive
10 * for more details.
11 *
12 */
13
14#include <asm/machvec.h>
15#include <linux/module.h>
16
17extern void init_adx_IRQ(void);
18extern void *cf_io_base;
19
20const char *get_system_type(void)
21{
22 return "A&D ADX";
23}
24
25unsigned long adx_isa_port2addr(unsigned long offset)
26{
27 /* CompactFlash (IDE) */
28 if (((offset >= 0x1f0) && (offset <= 0x1f7)) || (offset == 0x3f6)) {
29 return (unsigned long)cf_io_base + offset;
30 }
31
32 /* eth0 */
33 if ((offset >= 0x300) && (offset <= 0x30f)) {
34 return 0xa5000000 + offset; /* COMM BOARD (AREA1) */
35 }
36
37 return offset + 0xb0000000; /* IOBUS (AREA 4)*/
38}
39
40/*
41 * The Machine Vector
42 */
43
44struct sh_machine_vector mv_adx __initmv = {
45 .mv_nr_irqs = 48,
46 .mv_isa_port2addr = adx_isa_port2addr,
47 .mv_init_irq = init_adx_IRQ,
48};
49ALIAS_MV(adx)
50
51int __init platform_setup(void)
52{
53 /* Nothing to see here .. */
54 return 0;
55}
56