2 ** asm-m68k/pcmcia.c -- Amiga Linux PCMCIA support
3 ** most information was found by disassembling card.resource
4 ** I'm still looking for an official doc !
6 ** Copyright 1997 by Alain Malek
8 ** This file is subject to the terms and conditions of the GNU General Public
9 ** License. See the file COPYING in the main directory of this archive
12 ** Created: 12/10/97 by Alain Malek
15 #include <linux/types.h>
16 #include <linux/jiffies.h>
17 #include <linux/timer.h>
18 #include <linux/module.h>
20 #include <asm/amigayle.h>
21 #include <asm/amipcmcia.h>
23 /* gayle config byte for program voltage and access speed */
24 static unsigned char cfg_byte = GAYLE_CFG_0V|GAYLE_CFG_150NS;
26 void pcmcia_reset(void)
28 unsigned long reset_start_time = jiffies;
31 while (time_before(jiffies, reset_start_time + 1*HZ/100));
32 READ_ONCE(gayle_reset);
34 EXPORT_SYMBOL(pcmcia_reset);
37 /* copy a tuple, including tuple header. return nb bytes copied */
38 /* be careful as this may trigger a GAYLE_IRQ_WR interrupt ! */
40 int pcmcia_copy_tuple(unsigned char tuple_id, void *tuple, int max_len)
42 unsigned char id, *dest;
48 id = gayle_attribute[pos];
50 while((id != CISTPL_END) && (pos < 0x10000)) {
51 len = (int)gayle_attribute[pos+2] + 2;
53 len = (len > max_len)?max_len:len;
54 for (cnt = 0; cnt < len; cnt++) {
55 *dest++ = gayle_attribute[pos+(cnt<<1)];
61 id = gayle_attribute[pos];
66 EXPORT_SYMBOL(pcmcia_copy_tuple);
68 void pcmcia_program_voltage(int voltage)
86 cfg_byte = (cfg_byte & 0xfc) | v;
87 gayle.config = cfg_byte;
90 EXPORT_SYMBOL(pcmcia_program_voltage);
92 void pcmcia_access_speed(int speed)
96 if (speed <= PCMCIA_SPEED_100NS)
98 else if (speed <= PCMCIA_SPEED_150NS)
100 else if (speed <= PCMCIA_SPEED_250NS)
105 cfg_byte = (cfg_byte & 0xf3) | s;
106 gayle.config = cfg_byte;
108 EXPORT_SYMBOL(pcmcia_access_speed);
110 void pcmcia_write_enable(void)
112 gayle.cardstatus = GAYLE_CS_WR|GAYLE_CS_DA;
114 EXPORT_SYMBOL(pcmcia_write_enable);
116 void pcmcia_write_disable(void)
118 gayle.cardstatus = 0;
120 EXPORT_SYMBOL(pcmcia_write_disable);