* [PATCH][2.4] Update NEC VRC4171's base functions for VR4100 series
@ 2004-01-13 15:57 Yoichi Yuasa
2004-01-15 11:30 ` Ralf Baechle
0 siblings, 1 reply; 2+ messages in thread
From: Yoichi Yuasa @ 2004-01-13 15:57 UTC (permalink / raw)
To: Ralf Baechle; +Cc: yuasa, linux-mips
Hello Ralf,
I updated the patch for VRC4171's base functions.
The VRC4171 is companion chip for NEC VR4111 and VR4121.
This patch exists for linux_2_4 tag of linux-mips.org CVS.
Please apply this patch.
Yoichi
diff -urN -X dontdiff linux-orig/arch/mips/config-shared.in linux/arch/mips/config-shared.in
--- linux-orig/arch/mips/config-shared.in Sun Jan 11 10:17:13 2004
+++ linux/arch/mips/config-shared.in Tue Jan 13 23:04:31 2004
@@ -56,6 +56,9 @@
bool 'Support for Globespan IVR board' CONFIG_MIPS_IVR
bool 'Support for Hewlett Packard LaserJet board' CONFIG_HP_LASERJET
bool 'Support for IBM WorkPad z50' CONFIG_IBM_WORKPAD
+if [ "$CONFIG_IBM_WORKPAD" = "y" ]; then
+ tristate ' NEC VRC4171 support' CONFIG_VRC4171
+fi
bool 'Support for LASAT Networks platforms' CONFIG_LASAT
if [ "$CONFIG_LASAT" = "y" ]; then
tristate ' PICVUE LCD display driver' CONFIG_PICVUE
diff -urN -X dontdiff linux-orig/arch/mips/vr41xx/common/Makefile linux/arch/mips/vr41xx/common/Makefile
--- linux-orig/arch/mips/vr41xx/common/Makefile Wed Dec 3 01:37:03 2003
+++ linux/arch/mips/vr41xx/common/Makefile Tue Jan 13 23:04:31 2004
@@ -14,10 +14,11 @@
obj-y := bcu.o cmu.o giu.o icu.o int-handler.o ksyms.o reset.o rtc.o
-export-objs := ksyms.o vrc4173.o
+export-objs := ksyms.o vrc4171.o vrc4173.o
obj-$(CONFIG_PCI) += pciu.o
obj-$(CONFIG_SERIAL) += serial.o
+obj-$(CONFIG_VRC4171) += vrc4171.o
obj-$(CONFIG_VRC4173) += vrc4173.o
obj-$(subst m,y,$(CONFIG_IDE)) += ide.o
diff -urN -X dontdiff linux-orig/arch/mips/vr41xx/common/vrc4171.c linux/arch/mips/vr41xx/common/vrc4171.c
--- linux-orig/arch/mips/vr41xx/common/vrc4171.c Thu Jan 1 09:00:00 1970
+++ linux/arch/mips/vr41xx/common/vrc4171.c Tue Jan 13 23:04:31 2004
@@ -0,0 +1,106 @@
+/*
+ * vrc4171.c, NEC VRC4171 base driver.
+ *
+ * Copyright (C) 2003 Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+#include <linux/init.h>
+#include <linux/ioport.h>
+#include <linux/module.h>
+#include <linux/types.h>
+
+#include <asm/io.h>
+#include <asm/vr41xx/vrc4171.h>
+
+MODULE_DESCRIPTION("NEC VRC4171 base driver");
+MODULE_AUTHOR("Yoichi Yuasa <yuasa@hh.iij4u.or.jp>");
+MODULE_LICENSE("GPL");
+
+EXPORT_SYMBOL_GPL(vrc4171_get_irq_status);
+EXPORT_SYMBOL_GPL(vrc4171_set_multifunction_pin);
+
+#define CONFIGURATION1 0x05fe
+ #define SLOTB_CONFIG 0xc000
+ #define SLOTB_NONE 0x0000
+ #define SLOTB_PCCARD 0x4000
+ #define SLOTB_CF 0x8000
+ #define SLOTB_FLASHROM 0xc000
+
+#define CONFIGURATION2 0x05fc
+#define INTERRUPT_STATUS 0x05fa
+#define PCS_CONTROL 0x05ee
+#define GPIO_DATA PCS_CONTROL
+#define PCS0_UPPER_START 0x05ec
+#define PCS0_LOWER_START 0x05ea
+#define PCS0_UPPER_STOP 0x05e8
+#define PCS0_LOWER_STOP 0x05e6
+#define PCS1_UPPER_START 0x05e4
+#define PCS1_LOWER_START 0x05e2
+#define PCS1_UPPER_STOP 0x05de
+#define PCS1_LOWER_STOP 0x05dc
+
+#define VRC4171_REGS_BASE PCS1_LOWER_STOP
+#define VRC4171_REGS_SIZE 0x24
+
+uint16_t vrc4171_get_irq_status(void)
+{
+ return inw(INTERRUPT_STATUS);
+}
+
+void vrc4171_set_multifunction_pin(int config)
+{
+ uint16_t config1;
+
+ config1 = inw(CONFIGURATION1);
+ config1 &= ~SLOTB_CONFIG;
+
+ switch (config) {
+ case SLOTB_IS_NONE:
+ config1 |= SLOTB_NONE;
+ break;
+ case SLOTB_IS_PCCARD:
+ config1 |= SLOTB_PCCARD;
+ break;
+ case SLOTB_IS_CF:
+ config1 |= SLOTB_CF;
+ break;
+ case SLOTB_IS_FLASHROM:
+ config1 |= SLOTB_FLASHROM;
+ break;
+ default:
+ break;
+ }
+
+ outw(config1, CONFIGURATION1);
+}
+
+static int __devinit vrc4171_init(void)
+{
+ if (request_region(VRC4171_REGS_BASE, VRC4171_REGS_SIZE, "NEC VRC4171") == NULL)
+ return -EBUSY;
+
+ printk(KERN_INFO "NEC VRC4171 base driver\n");
+
+ return 0;
+}
+
+static void __devexit vrc4171_exit(void)
+{
+ release_region(VRC4171_REGS_BASE, VRC4171_REGS_SIZE);
+}
+
+module_init(vrc4171_init);
+module_exit(vrc4171_exit);
diff -urN -X dontdiff linux-orig/include/asm-mips/vr41xx/vrc4171.h linux/include/asm-mips/vr41xx/vrc4171.h
--- linux-orig/include/asm-mips/vr41xx/vrc4171.h Thu Jan 1 09:00:00 1970
+++ linux/include/asm-mips/vr41xx/vrc4171.h Tue Jan 13 23:04:31 2004
@@ -0,0 +1,43 @@
+/*
+ * vrc4171.h, Include file for NEC VRC4171.
+ *
+ * Copyright (C) 2003 Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+#ifndef __NEC_VRC4171_H
+#define __NEC_VRC4171_H
+
+/*
+ * Configuration 1
+ */
+enum {
+ SLOTB_IS_NONE,
+ SLOTB_IS_PCCARD,
+ SLOTB_IS_CF,
+ SLOTB_IS_FLASHROM
+};
+
+extern void vrc4171_set_multifunction_pin(int config);
+
+/*
+ * Interrupt Status Mask
+ */
+#define IRQ_A 0x02
+#define IRQ_B 0x04
+
+extern uint16_t vrc4171_get_irq_status(void);
+
+#endif /* __NEC_VRC4171_H */
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-01-15 11:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-01-13 15:57 [PATCH][2.4] Update NEC VRC4171's base functions for VR4100 series Yoichi Yuasa
2004-01-15 11:30 ` Ralf Baechle
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox