aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/boards/landisk/setup.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sh/boards/landisk/setup.c')
-rw-r--r--arch/sh/boards/landisk/setup.c177
1 files changed, 177 insertions, 0 deletions
diff --git a/arch/sh/boards/landisk/setup.c b/arch/sh/boards/landisk/setup.c
new file mode 100644
index 000000000000..127b9e020e00
--- /dev/null
+++ b/arch/sh/boards/landisk/setup.c
@@ -0,0 +1,177 @@
1/*
2 * arch/sh/boards/landisk/setup.c
3 *
4 * Copyright (C) 2000 Kazumoto Kojima
5 * Copyright (C) 2002 Paul Mundt
6 *
7 * I-O DATA Device, Inc. LANDISK Support.
8 *
9 * Modified for LANDISK by
10 * Atom Create Engineering Co., Ltd. 2002.
11 *
12 * modifed by kogiidena
13 * 2005.09.16
14 *
15 * This file is subject to the terms and conditions of the GNU General Public
16 * License. See the file "COPYING" in the main directory of this archive
17 * for more details.
18 */
19#include <linux/config.h>
20#include <linux/init.h>
21#include <linux/pm.h>
22#include <linux/mm.h>
23#include <asm/machvec.h>
24#include <asm/rtc.h>
25#include <asm/landisk/iodata_landisk.h>
26#include <asm/io.h>
27
28void landisk_time_init(void);
29void init_landisk_IRQ(void);
30
31int landisk_ledparam;
32int landisk_buzzerparam;
33int landisk_arch;
34
35/* cycle the led's in the clasic knightrider/sun pattern */
36static void heartbeat_landisk(void)
37{
38 static unsigned int cnt = 0, blink = 0x00, period = 25;
39 volatile u8 *p = (volatile u8 *)PA_LED;
40 char data;
41
42 if ((landisk_ledparam & 0x080) == 0)
43 return;
44
45 cnt += 1;
46
47 if (cnt < period)
48 return;
49
50 cnt = 0;
51 blink++;
52
53 data = (blink & 0x01) ? (landisk_ledparam >> 16) : 0;
54 data |= (blink & 0x02) ? (landisk_ledparam >> 8) : 0;
55 data |= landisk_ledparam;
56
57 /* buzzer */
58 if (landisk_buzzerparam & 0x1) {
59 data |= 0x80;
60 } else {
61 data &= 0x7f;
62 }
63 *p = data;
64
65 if (((landisk_ledparam & 0x007f7f00) == 0) &&
66 (landisk_buzzerparam == 0))
67 landisk_ledparam &= (~0x0080);
68
69 landisk_buzzerparam >>= 1;
70}
71
72static void landisk_power_off(void)
73{
74 ctrl_outb(0x01, PA_SHUTDOWN);
75}
76
77static void check_usl5p(void)
78{
79 volatile u8 *p = (volatile u8 *)PA_LED;
80 u8 tmp1, tmp2;
81
82 tmp1 = *p;
83 *p = 0x40;
84 tmp2 = *p;
85 *p = tmp1;
86
87 landisk_arch = (tmp2 == 0x40);
88 if (landisk_arch == 1) {
89 /* arch == usl-5p */
90 landisk_ledparam = 0x00000380;
91 landisk_ledparam |= (tmp1 & 0x07c);
92 } else {
93 /* arch == landisk */
94 landisk_ledparam = 0x02000180;
95 landisk_ledparam |= 0x04;
96 }
97}
98
99void *area5_io_base;
100void *area6_io_base;
101
102static int __init landisk_cf_init(void)
103{
104 pgprot_t prot;
105 unsigned long paddrbase, psize;
106
107 /* open I/O area window */
108 paddrbase = virt_to_phys((void *)PA_AREA5_IO);
109 psize = PAGE_SIZE;
110 prot = PAGE_KERNEL_PCC(1, _PAGE_PCC_IO16);
111 area5_io_base = p3_ioremap(paddrbase, psize, prot.pgprot);
112 if (!area5_io_base) {
113 printk("allocate_cf_area : can't open CF I/O window!\n");
114 return -ENOMEM;
115 }
116
117 paddrbase = virt_to_phys((void *)PA_AREA6_IO);
118 psize = PAGE_SIZE;
119 prot = PAGE_KERNEL_PCC(0, _PAGE_PCC_IO16);
120 area6_io_base = p3_ioremap(paddrbase, psize, prot.pgprot);
121 if (!area6_io_base) {
122 printk("allocate_cf_area : can't open HDD I/O window!\n");
123 return -ENOMEM;
124 }
125
126 printk(KERN_INFO "Allocate Area5/6 success.\n");
127
128 /* XXX : do we need attribute and common-memory area also? */
129
130 return 0;
131}
132
133static void __init landisk_setup(char **cmdline_p)
134{
135 device_initcall(landisk_cf_init);
136
137 landisk_buzzerparam = 0;
138 check_usl5p();
139
140 printk(KERN_INFO "I-O DATA DEVICE, INC. \"LANDISK Series\" support.\n");
141
142 board_time_init = landisk_time_init;
143 pm_power_off = landisk_power_off;
144}
145
146/*
147 * The Machine Vector
148 */
149struct sh_machine_vector mv_landisk __initmv = {
150 .mv_name = "LANDISK",
151 .mv_setup = landisk_setup,
152 .mv_nr_irqs = 72,
153 .mv_inb = landisk_inb,
154 .mv_inw = landisk_inw,
155 .mv_inl = landisk_inl,
156 .mv_outb = landisk_outb,
157 .mv_outw = landisk_outw,
158 .mv_outl = landisk_outl,
159 .mv_inb_p = landisk_inb_p,
160 .mv_inw_p = landisk_inw,
161 .mv_inl_p = landisk_inl,
162 .mv_outb_p = landisk_outb_p,
163 .mv_outw_p = landisk_outw,
164 .mv_outl_p = landisk_outl,
165 .mv_insb = landisk_insb,
166 .mv_insw = landisk_insw,
167 .mv_insl = landisk_insl,
168 .mv_outsb = landisk_outsb,
169 .mv_outsw = landisk_outsw,
170 .mv_outsl = landisk_outsl,
171 .mv_ioport_map = landisk_ioport_map,
172 .mv_init_irq = init_landisk_IRQ,
173#ifdef CONFIG_HEARTBEAT
174 .mv_heartbeat = heartbeat_landisk,
175#endif
176};
177ALIAS_MV(landisk)