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