From 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Sat, 16 Apr 2005 15:20:36 -0700 Subject: Linux-2.6.12-rc2 Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip! --- arch/m68k/amiga/pcmcia.c | 113 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 arch/m68k/amiga/pcmcia.c (limited to 'arch/m68k/amiga/pcmcia.c') diff --git a/arch/m68k/amiga/pcmcia.c b/arch/m68k/amiga/pcmcia.c new file mode 100644 index 000000000000..fc57c6e72acf --- /dev/null +++ b/arch/m68k/amiga/pcmcia.c @@ -0,0 +1,113 @@ +/* +** 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 +#include +#include +#include +#include + +/* 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; +} + + +/* copy a tuple, including tuple header. return nb bytes copied */ +/* be carefull 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; +} + +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; + +} + +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; +} + +void pcmcia_write_enable(void) +{ + gayle.cardstatus = GAYLE_CS_WR|GAYLE_CS_DA; +} + +void pcmcia_write_disable(void) +{ + gayle.cardstatus = 0; +} -- cgit v1.2.3