2 * vrc4171.c, NEC VRC4171 base driver.
4 * Copyright (C) 2003 Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 #include <linux/init.h>
21 #include <linux/ioport.h>
22 #include <linux/module.h>
23 #include <linux/types.h>
26 #include <asm/vr41xx/vrc4171.h>
28 MODULE_DESCRIPTION("NEC VRC4171 base driver");
29 MODULE_AUTHOR("Yoichi Yuasa <yuasa@hh.iij4u.or.jp>");
30 MODULE_LICENSE("GPL");
32 EXPORT_SYMBOL_GPL(vrc4171_get_irq_status);
33 EXPORT_SYMBOL_GPL(vrc4171_set_multifunction_pin);
35 #define CONFIGURATION1 0x05fe
36 #define SLOTB_CONFIG 0xc000
37 #define SLOTB_NONE 0x0000
38 #define SLOTB_PCCARD 0x4000
39 #define SLOTB_CF 0x8000
40 #define SLOTB_FLASHROM 0xc000
42 #define CONFIGURATION2 0x05fc
43 #define INTERRUPT_STATUS 0x05fa
44 #define PCS_CONTROL 0x05ee
45 #define GPIO_DATA PCS_CONTROL
46 #define PCS0_UPPER_START 0x05ec
47 #define PCS0_LOWER_START 0x05ea
48 #define PCS0_UPPER_STOP 0x05e8
49 #define PCS0_LOWER_STOP 0x05e6
50 #define PCS1_UPPER_START 0x05e4
51 #define PCS1_LOWER_START 0x05e2
52 #define PCS1_UPPER_STOP 0x05de
53 #define PCS1_LOWER_STOP 0x05dc
55 #define VRC4171_REGS_BASE PCS1_LOWER_STOP
56 #define VRC4171_REGS_SIZE 0x24
58 uint16_t vrc4171_get_irq_status(void)
60 return inw(INTERRUPT_STATUS);
63 void vrc4171_set_multifunction_pin(int config)
67 config1 = inw(CONFIGURATION1);
68 config1 &= ~SLOTB_CONFIG;
72 config1 |= SLOTB_NONE;
75 config1 |= SLOTB_PCCARD;
80 case SLOTB_IS_FLASHROM:
81 config1 |= SLOTB_FLASHROM;
87 outw(config1, CONFIGURATION1);
90 static int __devinit vrc4171_init(void)
92 if (request_region(VRC4171_REGS_BASE, VRC4171_REGS_SIZE, "NEC VRC4171") == NULL)
95 printk(KERN_INFO "NEC VRC4171 base driver\n");
100 static void __devexit vrc4171_exit(void)
102 release_region(VRC4171_REGS_BASE, VRC4171_REGS_SIZE);
105 module_init(vrc4171_init);
106 module_exit(vrc4171_exit);