summaryrefslogtreecommitdiffstats
path: root/meta/recipes-kernel/linux/linux-2.6.23/cm-x270/0003-cm-x270-ide.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-kernel/linux/linux-2.6.23/cm-x270/0003-cm-x270-ide.patch')
-rw-r--r--meta/recipes-kernel/linux/linux-2.6.23/cm-x270/0003-cm-x270-ide.patch186
1 files changed, 186 insertions, 0 deletions
diff --git a/meta/recipes-kernel/linux/linux-2.6.23/cm-x270/0003-cm-x270-ide.patch b/meta/recipes-kernel/linux/linux-2.6.23/cm-x270/0003-cm-x270-ide.patch
new file mode 100644
index 0000000000..0ff115efc8
--- /dev/null
+++ b/meta/recipes-kernel/linux/linux-2.6.23/cm-x270/0003-cm-x270-ide.patch
@@ -0,0 +1,186 @@
1From f260d5fa4c99cd7df949e6408af59807f8ccf224 Mon Sep 17 00:00:00 2001
2From: Cliff Brake <cbrake@happy.dev.bec-systems.com>
3Date: Fri, 20 Jul 2007 18:59:39 -0400
4Subject: [PATCH] cm-x270-ide
5
6---
7 drivers/ide/Kconfig | 8 +++
8 drivers/ide/arm/Makefile | 1 +
9 drivers/ide/arm/cm-x270-ide.c | 135 +++++++++++++++++++++++++++++++++++++++++
10 3 files changed, 144 insertions(+), 0 deletions(-)
11 create mode 100644 drivers/ide/arm/cm-x270-ide.c
12
13diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig
14index b1a9b81..7de4155 100644
15--- a/drivers/ide/Kconfig
16+++ b/drivers/ide/Kconfig
17@@ -864,6 +864,14 @@ config BLK_DEV_IDE_BAST
18 Say Y here if you want to support the onboard IDE channels on the
19 Simtec BAST or the Thorcom VR1000
20
21+config BLK_DEV_IDE_CM_X270
22+ tristate "CompuLab CM-X270 IDE support"
23+ depends on ARM && (MACH_ARMCORE)
24+ help
25+ Say Y here if you want to support the onboard IDE channels on the
26+ CompuLab CM-X270 module
27+
28+
29 config BLK_DEV_GAYLE
30 bool "Amiga Gayle IDE interface support"
31 depends on AMIGA
32diff --git a/drivers/ide/arm/Makefile b/drivers/ide/arm/Makefile
33index 6a78f07..e5cadb7 100644
34--- a/drivers/ide/arm/Makefile
35+++ b/drivers/ide/arm/Makefile
36@@ -2,5 +2,6 @@
37 obj-$(CONFIG_BLK_DEV_IDE_ICSIDE) += icside.o
38 obj-$(CONFIG_BLK_DEV_IDE_RAPIDE) += rapide.o
39 obj-$(CONFIG_BLK_DEV_IDE_BAST) += bast-ide.o
40+obj-$(CONFIG_BLK_DEV_IDE_CM_X270) += cm-x270-ide.o
41
42 EXTRA_CFLAGS := -Idrivers/ide
43diff --git a/drivers/ide/arm/cm-x270-ide.c b/drivers/ide/arm/cm-x270-ide.c
44new file mode 100644
45index 0000000..a8b15aa
46--- /dev/null
47+++ b/drivers/ide/arm/cm-x270-ide.c
48@@ -0,0 +1,135 @@
49+/* linux/drivers/ide/arm/cm-x270-ide.c
50+ *
51+ * Copyright (c) 2006 CompuLab, Ltd
52+ * Mike Rapoport <mike@compulab.co.il>
53+ *
54+ * Based on linux/drivers/ide/arm/bast-ide.c
55+ * Copyright (c) 2003-2004 Simtec Electronics
56+ * Ben Dooks <ben@simtec.co.uk>
57+ *
58+ * This program is free software; you can redistribute it and/or modify
59+ * it under the terms of the GNU General Public License version 2 as
60+ * published by the Free Software Foundation.
61+ *
62+ */
63+
64+#include <linux/module.h>
65+#include <linux/errno.h>
66+#include <linux/ide.h>
67+#include <linux/init.h>
68+#include <linux/irq.h>
69+
70+#include <asm/mach-types.h>
71+
72+#include <asm/io.h>
73+#include <asm/arch/pxa-regs.h>
74+#include <asm/arch/cm-x270.h>
75+
76+#define CMX270_SB270_IDECS0_VIRT (CMX270_IDE104_VIRT + (1<<24) + (1<<25))
77+#define CMX270_SB270_IDECS1_VIRT (CMX270_IDE104_VIRT + (1<<25))
78+#define CMX270_ATX_IDECS0_VIRT (CMX270_IDE104_VIRT + (1<<25))
79+#define CMX270_ATX_IDECS1_VIRT (CMX270_IDE104_VIRT + (1<<25) + (1<<22))
80+
81+/* list of registered interfaces */
82+static ide_hwif_t *ifs[1];
83+
84+static int __init
85+cmx270_ide_register(unsigned int base, unsigned int aux, int irq,
86+ ide_hwif_t **hwif)
87+{
88+ hw_regs_t hw;
89+
90+ memset(&hw, 0, sizeof(hw));
91+
92+ if(!base || !aux) return -EINVAL;
93+
94+ printk(KERN_DEBUG "%s: base = %08x, aux = %08x\n", __FUNCTION__,
95+ base, aux);
96+
97+ /* Different mappings for local bus IDE and PCMCIA IDE */
98+ if(base == CMX270_SB270_IDECS0_VIRT) {
99+ hw.io_ports[IDE_DATA_OFFSET] = base + 0;
100+ hw.io_ports[IDE_ERROR_OFFSET] = base + (0x1<<3);
101+ hw.io_ports[IDE_NSECTOR_OFFSET]= base + (0x2<<3);
102+ hw.io_ports[IDE_SECTOR_OFFSET]= base + (0x3<<3);
103+ hw.io_ports[IDE_LCYL_OFFSET]= base + (0x4<<3);
104+ hw.io_ports[IDE_HCYL_OFFSET]= base + (0x5<<3);
105+ hw.io_ports[IDE_SELECT_OFFSET]= base + (0x6<<3);
106+ hw.io_ports[IDE_STATUS_OFFSET]= base + (0x7<<3);
107+ hw.io_ports[IDE_CONTROL_OFFSET] = aux+(0x6<<3);
108+ }
109+ else if (base == CMX270_ATX_IDECS0_VIRT) { /* atx base */
110+ hw.io_ports[IDE_DATA_OFFSET] = base + 0;
111+ hw.io_ports[IDE_ERROR_OFFSET] = base + 8;
112+ hw.io_ports[IDE_NSECTOR_OFFSET]= base + 2;
113+ hw.io_ports[IDE_SECTOR_OFFSET]= base + 10;
114+ hw.io_ports[IDE_LCYL_OFFSET]= base + 4;
115+ hw.io_ports[IDE_HCYL_OFFSET]= base + 12;
116+ hw.io_ports[IDE_SELECT_OFFSET]= base + 6; //6;
117+ hw.io_ports[IDE_STATUS_OFFSET]= base + 14;
118+ hw.io_ports[IDE_CONTROL_OFFSET] = (aux+0x6);
119+ } else {
120+ printk(KERN_DEBUG "%s: registering wrong IDE i/f\n", __FUNCTION__);
121+ hw.io_ports[IDE_DATA_OFFSET] = base + 8;
122+ hw.io_ports[IDE_ERROR_OFFSET] = base + 13;
123+ hw.io_ports[IDE_NSECTOR_OFFSET] = base + 2;
124+ hw.io_ports[IDE_SECTOR_OFFSET] = base + 3;
125+ hw.io_ports[IDE_LCYL_OFFSET] = base + 4;
126+ hw.io_ports[IDE_HCYL_OFFSET] = base + 5;
127+ hw.io_ports[IDE_SELECT_OFFSET] = base + 6;
128+ hw.io_ports[IDE_STATUS_OFFSET] = base + 7;
129+ hw.io_ports[IDE_CONTROL_OFFSET] = aux;
130+ }
131+
132+ hw.irq = irq;
133+
134+ return ide_register_hw(&hw, hwif);
135+}
136+
137+static int __init cmx270_ide_init(void)
138+{
139+ int retval = 0;
140+
141+ if (!(machine_is_armcore()))
142+ goto out;
143+
144+ printk("CM-X270: initializing IDE interface\n");
145+
146+ MSC1 = 0x7ffc7ff4;
147+
148+ /* Interrupts on rising edge: lines are inverted before they get to
149+ the PXA */
150+ pxa_gpio_mode(IRQ_TO_GPIO(CMX270_IDE_IRQ));
151+
152+ /* try SB-X270 */
153+ set_irq_type(CMX270_IDE_IRQ, IRQ_TYPE_EDGE_RISING);
154+ retval = cmx270_ide_register(CMX270_SB270_IDECS0_VIRT,
155+ CMX270_SB270_IDECS1_VIRT,
156+ CMX270_IDE_IRQ, &ifs[0]);
157+ if (retval >= 0) {
158+ printk(KERN_DEBUG "%s: found IDE interface on SB-X270\n",
159+ __FUNCTION__);
160+ goto out;
161+ }
162+
163+ /* SB-X270 detection failed, try ATX */
164+ set_irq_type(CMX270_IDE_IRQ, IRQ_TYPE_EDGE_FALLING);
165+ retval = cmx270_ide_register(CMX270_ATX_IDECS0_VIRT,
166+ CMX270_ATX_IDECS1_VIRT,
167+ CMX270_IDE_IRQ, &ifs[0]);
168+
169+ if ( retval >= 0 ) {
170+ printk(KERN_DEBUG "%s: found IDE interface on ATX\n",
171+ __FUNCTION__);
172+ goto out;
173+ }
174+
175+ out:
176+ return retval;
177+}
178+
179+module_init(cmx270_ide_init);
180+
181+MODULE_AUTHOR("CompuLab");
182+MODULE_LICENSE("GPL");
183+MODULE_DESCRIPTION("CompuLab CM-X270 IDE driver");
184--
1851.5.1.6
186