aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/boards/landisk/setup.c
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2006-09-27 02:16:42 -0400
committerPaul Mundt <lethal@linux-sh.org>2006-09-27 02:16:42 -0400
commitd7cdc9e8ac82c43fdcd4fde6b5b53d2dcba7f707 (patch)
tree2489b1831a1b5818af0927e4d3c8933bf7d05f31 /arch/sh/boards/landisk/setup.c
parent26ff6c11ef38e08990c1e417c299246e6ab18ff7 (diff)
sh: ioremap() overhaul.
ioremap() overhaul. Add support for transparent PMB mapping, get rid of p3_ioremap(), etc. Also drop ioremap() and iounmap() routines from the machvec, as everyone can use the generic ioremap() API instead. For PCI memory apertures and other special cases, use the pci_iomap() API, as boards are already required to get the mapping right there. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/boards/landisk/setup.c')
-rw-r--r--arch/sh/boards/landisk/setup.c237
1 files changed, 99 insertions, 138 deletions
diff --git a/arch/sh/boards/landisk/setup.c b/arch/sh/boards/landisk/setup.c
index 0c60eaa10ba7..3a795cfb1eda 100644
--- a/arch/sh/boards/landisk/setup.c
+++ b/arch/sh/boards/landisk/setup.c
@@ -1,157 +1,52 @@
1/* 1/*
2 * arch/sh/boards/landisk/setup.c 2 * arch/sh/boards/landisk/setup.c
3 * 3 *
4 * Copyright (C) 2000 Kazumoto Kojima
4 * Copyright (C) 2002 Paul Mundt 5 * Copyright (C) 2002 Paul Mundt
5 * 6 *
6 * May be copied or modified under the terms of the GNU General Public
7 * License. See linux/COPYING for more information.
8 *
9 * Setup code for an unknown machine (internal peripherials only)
10 */
11/*
12 * linux/arch/sh/kernel/setup_landisk.c
13 *
14 * Copyright (C) 2000 Kazumoto Kojima
15 *
16 * I-O DATA Device, Inc. LANDISK Support. 7 * I-O DATA Device, Inc. LANDISK Support.
17 * 8 *
18 * Modified for LANDISK by 9 * Modified for LANDISK by
19 * Atom Create Engineering Co., Ltd. 2002. 10 * Atom Create Engineering Co., Ltd. 2002.
20 */ 11 *
21/*
22 * modifed by kogiidena 12 * modifed by kogiidena
23 * 2005.09.16 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.
24 */ 18 */
25
26#include <linux/config.h> 19#include <linux/config.h>
27#include <linux/init.h> 20#include <linux/init.h>
28#include <linux/irq.h>
29#include <linux/pm.h> 21#include <linux/pm.h>
30 22#include <linux/mm.h>
31#include <linux/hdreg.h>
32#include <linux/ide.h>
33#include <linux/pci.h>
34
35#include <asm/machvec.h> 23#include <asm/machvec.h>
36#include <asm/rtc.h> 24#include <asm/rtc.h>
37#include <asm/machvec_init.h>
38#include <asm/io.h>
39#include <asm/landisk/iodata_landisk.h> 25#include <asm/landisk/iodata_landisk.h>
40#include <asm/landisk/io.h> 26#include <asm/io.h>
41
42#include <linux/mm.h>
43#include <linux/vmalloc.h>
44 27
45extern void (*board_time_init) (void);
46void landisk_time_init(void); 28void landisk_time_init(void);
47extern void init_landisk_IRQ(void); 29void init_landisk_IRQ(void);
48 30
49int landisk_ledparam; 31int landisk_ledparam;
50int landisk_buzzerparam; 32int landisk_buzzerparam;
51int landisk_arch; 33int landisk_arch;
52 34
53/* defined in mm/ioremap.c */ 35/* cycle the led's in the clasic knightrider/sun pattern */
54extern void *p3_ioremap(unsigned long phys_addr, unsigned long size, 36static void heartbeat_landisk(void)
55 unsigned long flags);
56
57/*
58 * Initialize the board
59 */
60
61const char *get_system_type(void)
62{
63 return "LANDISK";
64}
65
66static void landisk_power_off(void)
67{
68 ctrl_outb(0x01, PA_SHUTDOWN);
69}
70
71void check_usl5p(void)
72{
73 volatile unsigned char *p = (volatile unsigned char *)PA_LED;
74 unsigned char tmp1, tmp2;
75 tmp1 = *p;
76 *p = 0x40;
77 tmp2 = *p;
78 *p = tmp1;
79 landisk_arch = (tmp2 == 0x40) ? 1 : 0;
80 if (landisk_arch == 1) { /* arch == usl-5p */
81 landisk_ledparam = 0x00000380;
82 landisk_ledparam |= (tmp1 & 0x07c);
83 } else { /* arch == landisk */
84 landisk_ledparam = 0x02000180;
85 landisk_ledparam |= 0x04;
86 }
87 return;
88}
89
90void __init platform_setup(void)
91{
92
93 landisk_buzzerparam = 0;
94 check_usl5p();
95
96 printk(KERN_INFO "I-O DATA DEVICE, INC. \"LANDISK Series\" support.\n");
97 board_time_init = landisk_time_init;
98 pm_power_off = landisk_power_off;
99
100}
101
102void *area5_io_base;
103void *area6_io_base;
104
105int __init cf_init(void)
106{
107 pgprot_t prot;
108 unsigned long paddrbase, psize;
109
110 /* open I/O area window */
111 paddrbase = virt_to_phys((void *)PA_AREA5_IO);
112 psize = PAGE_SIZE;
113 prot = PAGE_KERNEL_PCC(1, _PAGE_PCC_IO16);
114 area5_io_base = p3_ioremap(paddrbase, psize, prot.pgprot);
115 if (!area5_io_base) {
116 printk("allocate_cf_area : can't open CF I/O window!\n");
117 return -ENOMEM;
118 }
119
120 paddrbase = virt_to_phys((void *)PA_AREA6_IO);
121 psize = PAGE_SIZE;
122 prot = PAGE_KERNEL_PCC(0, _PAGE_PCC_IO16);
123 area6_io_base = p3_ioremap(paddrbase, psize, prot.pgprot);
124 if (!area6_io_base) {
125 printk("allocate_cf_area : can't open HDD I/O window!\n");
126 return -ENOMEM;
127 }
128
129 printk(KERN_INFO "Allocate Area5/6 success.\n");
130
131 /* XXX : do we need attribute and common-memory area also? */
132
133 return 0;
134}
135
136__initcall(cf_init);
137
138#include <linux/sched.h>
139
140/* Cycle the LED's in the clasic knightrider/Sun pattern */
141
142void heartbeat_landisk(void)
143{ 37{
144 static unsigned int cnt = 0, blink = 0x00, period = 25; 38 static unsigned int cnt = 0, blink = 0x00, period = 25;
145 volatile unsigned char *p = (volatile unsigned char *)PA_LED; 39 volatile u8 *p = (volatile u8 *)PA_LED;
146 char data; 40 char data;
147 41
148 if ((landisk_ledparam & 0x080) == 0) { 42 if ((landisk_ledparam & 0x080) == 0)
149 return; 43 return;
150 } 44
151 cnt += 1; 45 cnt += 1;
152 if (cnt < period) { 46
47 if (cnt < period)
153 return; 48 return;
154 } 49
155 cnt = 0; 50 cnt = 0;
156 blink++; 51 blink++;
157 52
@@ -167,17 +62,16 @@ void heartbeat_landisk(void)
167 } 62 }
168 *p = data; 63 *p = data;
169 64
170 if (((landisk_ledparam & 0x007f7f00) == 0) 65 if (((landisk_ledparam & 0x007f7f00) == 0) &&
171 && (landisk_buzzerparam == 0)) { 66 (landisk_buzzerparam == 0))
172 landisk_ledparam &= (~0x0080); 67 landisk_ledparam &= (~0x0080);
173 } 68
174 landisk_buzzerparam >>= 1; 69 landisk_buzzerparam >>= 1;
175} 70}
176 71
177/* 72/*
178 * The Machine Vector 73 * The Machine Vector
179 */ 74 */
180
181struct sh_machine_vector mv_landisk __initmv = { 75struct sh_machine_vector mv_landisk __initmv = {
182 .mv_nr_irqs = 72, 76 .mv_nr_irqs = 72,
183 .mv_inb = landisk_inb, 77 .mv_inb = landisk_inb,
@@ -198,21 +92,88 @@ struct sh_machine_vector mv_landisk __initmv = {
198 .mv_outsb = landisk_outsb, 92 .mv_outsb = landisk_outsb,
199 .mv_outsw = landisk_outsw, 93 .mv_outsw = landisk_outsw,
200 .mv_outsl = landisk_outsl, 94 .mv_outsl = landisk_outsl,
201 .mv_readb = landisk_readb, 95 .mv_ioport_map = landisk_ioport_map,
202 .mv_readw = landisk_readw,
203 .mv_readl = landisk_readl,
204 .mv_writeb = landisk_writeb,
205 .mv_writew = landisk_writew,
206 .mv_writel = landisk_writel,
207 .mv_ioremap = landisk_ioremap,
208 .mv_iounmap = landisk_iounmap,
209 .mv_isa_port2addr = landisk_isa_port2addr,
210 .mv_init_irq = init_landisk_IRQ, 96 .mv_init_irq = init_landisk_IRQ,
211
212#ifdef CONFIG_HEARTBEAT 97#ifdef CONFIG_HEARTBEAT
213 .mv_heartbeat = heartbeat_landisk, 98 .mv_heartbeat = heartbeat_landisk,
214#endif 99#endif
215
216}; 100};
217
218ALIAS_MV(landisk) 101ALIAS_MV(landisk)
102
103const char *get_system_type(void)
104{
105 return "LANDISK";
106}
107
108static void landisk_power_off(void)
109{
110 ctrl_outb(0x01, PA_SHUTDOWN);
111}
112
113static void check_usl5p(void)
114{
115 volatile u8 *p = (volatile u8 *)PA_LED;
116 u8 tmp1, tmp2;
117
118 tmp1 = *p;
119 *p = 0x40;
120 tmp2 = *p;
121 *p = tmp1;
122
123 landisk_arch = (tmp2 == 0x40);
124 if (landisk_arch == 1) {
125 /* arch == usl-5p */
126 landisk_ledparam = 0x00000380;
127 landisk_ledparam |= (tmp1 & 0x07c);
128 } else {
129 /* arch == landisk */
130 landisk_ledparam = 0x02000180;
131 landisk_ledparam |= 0x04;
132 }
133}
134
135void __init platform_setup(void)
136{
137 landisk_buzzerparam = 0;
138 check_usl5p();
139
140 printk(KERN_INFO "I-O DATA DEVICE, INC. \"LANDISK Series\" support.\n");
141 board_time_init = landisk_time_init;
142 pm_power_off = landisk_power_off;
143}
144
145void *area5_io_base;
146void *area6_io_base;
147
148static int __init landisk_cf_init(void)
149{
150 pgprot_t prot;
151 unsigned long paddrbase, psize;
152
153 /* open I/O area window */
154 paddrbase = virt_to_phys((void *)PA_AREA5_IO);
155 psize = PAGE_SIZE;
156 prot = PAGE_KERNEL_PCC(1, _PAGE_PCC_IO16);
157 area5_io_base = p3_ioremap(paddrbase, psize, prot.pgprot);
158 if (!area5_io_base) {
159 printk("allocate_cf_area : can't open CF I/O window!\n");
160 return -ENOMEM;
161 }
162
163 paddrbase = virt_to_phys((void *)PA_AREA6_IO);
164 psize = PAGE_SIZE;
165 prot = PAGE_KERNEL_PCC(0, _PAGE_PCC_IO16);
166 area6_io_base = p3_ioremap(paddrbase, psize, prot.pgprot);
167 if (!area6_io_base) {
168 printk("allocate_cf_area : can't open HDD I/O window!\n");
169 return -ENOMEM;
170 }
171
172 printk(KERN_INFO "Allocate Area5/6 success.\n");
173
174 /* XXX : do we need attribute and common-memory area also? */
175
176 return 0;
177}
178
179__initcall(landisk_cf_init);