summaryrefslogtreecommitdiffstats
path: root/kernel/arch/m68k/amiga/pcmcia.c
diff options
context:
space:
mode:
authorYunhong Jiang <yunhong.jiang@intel.com>2015-08-04 12:17:53 -0700
committerYunhong Jiang <yunhong.jiang@intel.com>2015-08-04 15:44:42 -0700
commit9ca8dbcc65cfc63d6f5ef3312a33184e1d726e00 (patch)
tree1c9cafbcd35f783a87880a10f85d1a060db1a563 /kernel/arch/m68k/amiga/pcmcia.c
parent98260f3884f4a202f9ca5eabed40b1354c489b29 (diff)
Add the rt linux 4.1.3-rt3 as base
Import the rt linux 4.1.3-rt3 as OPNFV kvm base. It's from git://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git linux-4.1.y-rt and the base is: commit 0917f823c59692d751951bf5ea699a2d1e2f26a2 Author: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Date: Sat Jul 25 12:13:34 2015 +0200 Prepare v4.1.3-rt3 Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> We lose all the git history this way and it's not good. We should apply another opnfv project repo in future. Change-Id: I87543d81c9df70d99c5001fbdf646b202c19f423 Signed-off-by: Yunhong Jiang <yunhong.jiang@intel.com>
Diffstat (limited to 'kernel/arch/m68k/amiga/pcmcia.c')
-rw-r--r--kernel/arch/m68k/amiga/pcmcia.c122
1 files changed, 122 insertions, 0 deletions
diff --git a/kernel/arch/m68k/amiga/pcmcia.c b/kernel/arch/m68k/amiga/pcmcia.c
new file mode 100644
index 000000000..7106f0c36
--- /dev/null
+++ b/kernel/arch/m68k/amiga/pcmcia.c
@@ -0,0 +1,122 @@
+/*
+** asm-m68k/pcmcia.c -- Amiga Linux PCMCIA support
+** most information was found by disassembling card.resource
+** I'm still looking for an official doc !
+**
+** Copyright 1997 by Alain Malek
+**
+** This file is subject to the terms and conditions of the GNU General Public
+** License. See the file COPYING in the main directory of this archive
+** for more details.
+**
+** Created: 12/10/97 by Alain Malek
+*/
+
+#include <linux/types.h>
+#include <linux/jiffies.h>
+#include <linux/timer.h>
+#include <linux/module.h>
+
+#include <asm/amigayle.h>
+#include <asm/amipcmcia.h>
+
+/* gayle config byte for program voltage and access speed */
+static unsigned char cfg_byte = GAYLE_CFG_0V|GAYLE_CFG_150NS;
+
+void pcmcia_reset(void)
+{
+ unsigned long reset_start_time = jiffies;
+ unsigned char b;
+
+ gayle_reset = 0x00;
+ while (time_before(jiffies, reset_start_time + 1*HZ/100));
+ b = gayle_reset;
+}
+EXPORT_SYMBOL(pcmcia_reset);
+
+
+/* copy a tuple, including tuple header. return nb bytes copied */
+/* be careful as this may trigger a GAYLE_IRQ_WR interrupt ! */
+
+int pcmcia_copy_tuple(unsigned char tuple_id, void *tuple, int max_len)
+{
+ unsigned char id, *dest;
+ int cnt, pos, len;
+
+ dest = tuple;
+ pos = 0;
+
+ id = gayle_attribute[pos];
+
+ while((id != CISTPL_END) && (pos < 0x10000)) {
+ len = (int)gayle_attribute[pos+2] + 2;
+ if (id == tuple_id) {
+ len = (len > max_len)?max_len:len;
+ for (cnt = 0; cnt < len; cnt++) {
+ *dest++ = gayle_attribute[pos+(cnt<<1)];
+ }
+
+ return len;
+ }
+ pos += len<<1;
+ id = gayle_attribute[pos];
+ }
+
+ return 0;
+}
+EXPORT_SYMBOL(pcmcia_copy_tuple);
+
+void pcmcia_program_voltage(int voltage)
+{
+ unsigned char v;
+
+ switch (voltage) {
+ case PCMCIA_0V:
+ v = GAYLE_CFG_0V;
+ break;
+ case PCMCIA_5V:
+ v = GAYLE_CFG_5V;
+ break;
+ case PCMCIA_12V:
+ v = GAYLE_CFG_12V;
+ break;
+ default:
+ v = GAYLE_CFG_0V;
+ }
+
+ cfg_byte = (cfg_byte & 0xfc) | v;
+ gayle.config = cfg_byte;
+
+}
+EXPORT_SYMBOL(pcmcia_program_voltage);
+
+void pcmcia_access_speed(int speed)
+{
+ unsigned char s;
+
+ if (speed <= PCMCIA_SPEED_100NS)
+ s = GAYLE_CFG_100NS;
+ else if (speed <= PCMCIA_SPEED_150NS)
+ s = GAYLE_CFG_150NS;
+ else if (speed <= PCMCIA_SPEED_250NS)
+ s = GAYLE_CFG_250NS;
+ else
+ s = GAYLE_CFG_720NS;
+
+ cfg_byte = (cfg_byte & 0xf3) | s;
+ gayle.config = cfg_byte;
+}
+EXPORT_SYMBOL(pcmcia_access_speed);
+
+void pcmcia_write_enable(void)
+{
+ gayle.cardstatus = GAYLE_CS_WR|GAYLE_CS_DA;
+}
+EXPORT_SYMBOL(pcmcia_write_enable);
+
+void pcmcia_write_disable(void)
+{
+ gayle.cardstatus = 0;
+}
+EXPORT_SYMBOL(pcmcia_write_disable);
+