summaryrefslogtreecommitdiff
path: root/package
diff options
context:
space:
mode:
authorwbx <wbx@3c298f89-4303-0410-b956-a3cf2f4a3e73>2005-03-21 17:29:30 +0000
committerwbx <wbx@3c298f89-4303-0410-b956-a3cf2f4a3e73>2005-03-21 17:29:30 +0000
commit8412946f34a13e0213bc4495a3cab3edacb30881 (patch)
tree59f216329ab6fa3a2f2eb8e00543797c4e13f11e /package
parent24a035d1b5f146957f1615b2636851a969cf5dd3 (diff)
parallel port support, found via google. tested by fenrir
git-svn-id: svn://svn.openwrt.org/openwrt/trunk/openwrt@412 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package')
-rw-r--r--package/linux/Makefile1
-rw-r--r--package/linux/kernel-patches/023-drivers_parport_Makefile.bz2bin0 -> 305 bytes
-rw-r--r--package/linux/kernel-patches/024-drivers_parport_Config_in.bz2bin0 -> 391 bytes
-rw-r--r--package/linux/kernel-source/drivers/parport/parport_splink.c345
-rw-r--r--package/linux/linux.config82
5 files changed, 349 insertions, 79 deletions
diff --git a/package/linux/Makefile b/package/linux/Makefile
index 6ed9837500..5c74d39eb2 100644
--- a/package/linux/Makefile
+++ b/package/linux/Makefile
@@ -68,6 +68,7 @@ $(eval $(call KMOD_template,USB,usb,\
,CONFIG_USB))
$(eval $(call KMOD_template,LP,lp,\
$(MODULES_DIR)/kernel/drivers/parport/parport.o \
+ $(MODULES_DIR)/kernel/drivers/parport/parport_splink.o \
$(MODULES_DIR)/kernel/drivers/char/lp.o \
,CONFIG_PARPORT))
$(eval $(call KMOD_template,VFAT,vfat,\
diff --git a/package/linux/kernel-patches/023-drivers_parport_Makefile.bz2 b/package/linux/kernel-patches/023-drivers_parport_Makefile.bz2
new file mode 100644
index 0000000000..aae55970a3
--- /dev/null
+++ b/package/linux/kernel-patches/023-drivers_parport_Makefile.bz2
Binary files differ
diff --git a/package/linux/kernel-patches/024-drivers_parport_Config_in.bz2 b/package/linux/kernel-patches/024-drivers_parport_Config_in.bz2
new file mode 100644
index 0000000000..7cc9529f26
--- /dev/null
+++ b/package/linux/kernel-patches/024-drivers_parport_Config_in.bz2
Binary files differ
diff --git a/package/linux/kernel-source/drivers/parport/parport_splink.c b/package/linux/kernel-source/drivers/parport/parport_splink.c
new file mode 100644
index 0000000000..0f5a81b85d
--- /dev/null
+++ b/package/linux/kernel-source/drivers/parport/parport_splink.c
@@ -0,0 +1,345 @@
+/* Low-level parallel port routines for the ASUS WL-500g built-in port
+ *
+ * Author: Nuno Grilo <nuno.grilo@netcabo.pt>
+ * Based on parport_pc source
+ */
+
+#include <linux/config.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/ioport.h>
+#include <linux/kernel.h>
+#include <linux/slab.h>
+#include <linux/parport.h>
+#include <linux/parport_pc.h>
+
+#define SPLINK_ADDRESS 0xBF800010
+
+#undef DEBUG
+
+#ifdef DEBUG
+#define DPRINTK printk
+#else
+#define DPRINTK(stuff...)
+#endif
+
+
+/* __parport_splink_frob_control differs from parport_splink_frob_control in that
+ * it doesn't do any extra masking. */
+static __inline__ unsigned char __parport_splink_frob_control (struct parport *p,
+ unsigned char mask,
+ unsigned char val)
+{
+ struct parport_pc_private *priv = p->physport->private_data;
+ unsigned char *io = (unsigned char *) p->base;
+ unsigned char ctr = priv->ctr;
+#ifdef DEBUG_PARPORT
+ printk (KERN_DEBUG
+ "__parport_splink_frob_control(%02x,%02x): %02x -> %02x\n",
+ mask, val, ctr, ((ctr & ~mask) ^ val) & priv->ctr_writable);
+#endif
+ ctr = (ctr & ~mask) ^ val;
+ ctr &= priv->ctr_writable; /* only write writable bits. */
+ *(io+2) = ctr;
+ priv->ctr = ctr; /* Update soft copy */
+ return ctr;
+}
+
+
+
+static void parport_splink_data_forward (struct parport *p)
+{
+ DPRINTK(KERN_DEBUG "parport_splink: parport_data_forward called\n");
+ __parport_splink_frob_control (p, 0x20, 0);
+}
+
+static void parport_splink_data_reverse (struct parport *p)
+{
+ DPRINTK(KERN_DEBUG "parport_splink: parport_data_forward called\n");
+ __parport_splink_frob_control (p, 0x20, 0x20);
+}
+
+/*
+static void parport_splink_interrupt(int irq, void *dev_id, struct pt_regs *regs)
+{
+ DPRINTK(KERN_DEBUG "parport_splink: IRQ handler called\n");
+ parport_generic_irq(irq, (struct parport *) dev_id, regs);
+}
+*/
+
+static void parport_splink_enable_irq(struct parport *p)
+{
+ DPRINTK(KERN_DEBUG "parport_splink: parport_splink_enable_irq called\n");
+ __parport_splink_frob_control (p, 0x10, 0x10);
+}
+
+static void parport_splink_disable_irq(struct parport *p)
+{
+ DPRINTK(KERN_DEBUG "parport_splink: parport_splink_disable_irq called\n");
+ __parport_splink_frob_control (p, 0x10, 0);
+}
+
+static void parport_splink_init_state(struct pardevice *dev, struct parport_state *s)
+{
+ DPRINTK(KERN_DEBUG "parport_splink: parport_splink_init_state called\n");
+ s->u.pc.ctr = 0xc | (dev->irq_func ? 0x10 : 0x0);
+ if (dev->irq_func &&
+ dev->port->irq != PARPORT_IRQ_NONE)
+ /* Set ackIntEn */
+ s->u.pc.ctr |= 0x10;
+}
+
+static void parport_splink_save_state(struct parport *p, struct parport_state *s)
+{
+ const struct parport_pc_private *priv = p->physport->private_data;
+ DPRINTK(KERN_DEBUG "parport_splink: parport_splink_save_state called\n");
+ s->u.pc.ctr = priv->ctr;
+}
+
+static void parport_splink_restore_state(struct parport *p, struct parport_state *s)
+{
+ struct parport_pc_private *priv = p->physport->private_data;
+ unsigned char *io = (unsigned char *) p->base;
+ unsigned char ctr = s->u.pc.ctr;
+
+ DPRINTK(KERN_DEBUG "parport_splink: parport_splink_restore_state called\n");
+ *(io+2) = ctr;
+ priv->ctr = ctr;
+}
+
+static void parport_splink_setup_interrupt(void) {
+ return;
+}
+
+static void parport_splink_write_data(struct parport *p, unsigned char d) {
+ DPRINTK(KERN_DEBUG "parport_splink: write data called\n");
+ unsigned char *io = (unsigned char *) p->base;
+ *io = d;
+}
+
+static unsigned char parport_splink_read_data(struct parport *p) {
+ DPRINTK(KERN_DEBUG "parport_splink: read data called\n");
+ unsigned char *io = (unsigned char *) p->base;
+ return *io;
+}
+
+static void parport_splink_write_control(struct parport *p, unsigned char d)
+{
+ const unsigned char wm = (PARPORT_CONTROL_STROBE |
+ PARPORT_CONTROL_AUTOFD |
+ PARPORT_CONTROL_INIT |
+ PARPORT_CONTROL_SELECT);
+
+ DPRINTK(KERN_DEBUG "parport_splink: write control called\n");
+ /* Take this out when drivers have adapted to the newer interface. */
+ if (d & 0x20) {
+ printk (KERN_DEBUG "%s (%s): use data_reverse for this!\n",
+ p->name, p->cad->name);
+ parport_splink_data_reverse (p);
+ }
+
+ __parport_splink_frob_control (p, wm, d & wm);
+}
+
+static unsigned char parport_splink_read_control(struct parport *p)
+{
+ const unsigned char wm = (PARPORT_CONTROL_STROBE |
+ PARPORT_CONTROL_AUTOFD |
+ PARPORT_CONTROL_INIT |
+ PARPORT_CONTROL_SELECT);
+ DPRINTK(KERN_DEBUG "parport_splink: read control called\n");
+ const struct parport_pc_private *priv = p->physport->private_data;
+ return priv->ctr & wm; /* Use soft copy */
+}
+
+static unsigned char parport_splink_frob_control (struct parport *p, unsigned char mask,
+ unsigned char val)
+{
+ const unsigned char wm = (PARPORT_CONTROL_STROBE |
+ PARPORT_CONTROL_AUTOFD |
+ PARPORT_CONTROL_INIT |
+ PARPORT_CONTROL_SELECT);
+
+ DPRINTK(KERN_DEBUG "parport_splink: frob control called\n");
+ /* Take this out when drivers have adapted to the newer interface. */
+ if (mask & 0x20) {
+ printk (KERN_DEBUG "%s (%s): use data_%s for this!\n",
+ p->name, p->cad->name,
+ (val & 0x20) ? "reverse" : "forward");
+ if (val & 0x20)
+ parport_splink_data_reverse (p);
+ else
+ parport_splink_data_forward (p);
+ }
+
+ /* Restrict mask and val to control lines. */
+ mask &= wm;
+ val &= wm;
+
+ return __parport_splink_frob_control (p, mask, val);
+}
+
+static unsigned char parport_splink_read_status(struct parport *p)
+{
+ DPRINTK(KERN_DEBUG "parport_splink: read status called\n");
+ unsigned char *io = (unsigned char *) p->base;
+ return *(io+1);
+}
+
+static void parport_splink_inc_use_count(void)
+{
+#ifdef MODULE
+ MOD_INC_USE_COUNT;
+#endif
+}
+
+static void parport_splink_dec_use_count(void)
+{
+#ifdef MODULE
+ MOD_DEC_USE_COUNT;
+#endif
+}
+
+static struct parport_operations parport_splink_ops =
+{
+ parport_splink_write_data,
+ parport_splink_read_data,
+
+ parport_splink_write_control,
+ parport_splink_read_control,
+ parport_splink_frob_control,
+
+ parport_splink_read_status,
+
+ parport_splink_enable_irq,
+ parport_splink_disable_irq,
+
+ parport_splink_data_forward,
+ parport_splink_data_reverse,
+
+ parport_splink_init_state,
+ parport_splink_save_state,
+ parport_splink_restore_state,
+
+ parport_splink_inc_use_count,
+ parport_splink_dec_use_count,
+
+ parport_ieee1284_epp_write_data,
+ parport_ieee1284_epp_read_data,
+ parport_ieee1284_epp_write_addr,
+ parport_ieee1284_epp_read_addr,
+
+ parport_ieee1284_ecp_write_data,
+ parport_ieee1284_ecp_read_data,
+ parport_ieee1284_ecp_write_addr,
+
+ parport_ieee1284_write_compat,
+ parport_ieee1284_read_nibble,
+ parport_ieee1284_read_byte,
+};
+
+/* --- Initialisation code -------------------------------- */
+
+static struct parport *parport_splink_probe_port (unsigned long int base)
+{
+ struct parport_pc_private *priv;
+ struct parport_operations *ops;
+ struct parport *p;
+
+ if (check_mem_region(base, 3)) {
+ printk (KERN_DEBUG "parport (0x%lx): iomem region not available\n", base);
+ return NULL;
+ }
+ priv = kmalloc (sizeof (struct parport_pc_private), GFP_KERNEL);
+ if (!priv) {
+ printk (KERN_DEBUG "parport (0x%lx): no memory!\n", base);
+ return NULL;
+ }
+ ops = kmalloc (sizeof (struct parport_operations), GFP_KERNEL);
+ if (!ops) {
+ printk (KERN_DEBUG "parport (0x%lx): no memory for ops!\n",
+ base);
+ kfree (priv);
+ return NULL;
+ }
+ memcpy (ops, &parport_splink_ops, sizeof (struct parport_operations));
+ priv->ctr = 0xc;
+ priv->ctr_writable = 0xff;
+
+ if (!(p = parport_register_port(base, PARPORT_IRQ_NONE,
+ PARPORT_DMA_NONE, ops))) {
+ printk (KERN_DEBUG "parport (0x%lx): registration failed!\n",
+ base);
+ kfree (priv);
+ kfree (ops);
+ return NULL;
+ }
+
+ p->modes = PARPORT_MODE_PCSPP | PARPORT_MODE_SAFEININT;
+ p->size = (p->modes & PARPORT_MODE_EPP)?8:3;
+ p->private_data = priv;
+
+ parport_proc_register(p);
+ request_mem_region (p->base, 3, p->name);
+
+ /* Done probing. Now put the port into a sensible start-up state. */
+ parport_splink_write_data(p, 0);
+ parport_splink_data_forward (p);
+
+ /* Now that we've told the sharing engine about the port, and
+ found out its characteristics, let the high-level drivers
+ know about it. */
+ parport_announce_port (p);
+
+ DPRINTK(KERN_DEBUG "parport (0x%lx): init ok!\n",
+ base);
+ return p;
+}
+
+static void parport_splink_unregister_port(struct parport *p) {
+ struct parport_pc_private *priv = p->private_data;
+ struct parport_operations *ops = p->ops;
+
+ if (p->irq != PARPORT_IRQ_NONE)
+ free_irq(p->irq, p);
+ release_mem_region(p->base, 3);
+ parport_proc_unregister(p);
+ kfree (priv);
+ parport_unregister_port(p);
+ kfree (ops);
+}
+
+
+int parport_splink_init(void)
+{
+ int ret;
+
+ DPRINTK(KERN_DEBUG "parport_splink init called\n");
+ parport_splink_setup_interrupt();
+ ret = !parport_splink_probe_port(SPLINK_ADDRESS);
+
+ return ret;
+}
+
+void parport_splink_cleanup(void) {
+ struct parport *p = parport_enumerate(), *tmp;
+ DPRINTK(KERN_DEBUG "parport_splink cleanup called\n");
+ if (p->size) {
+ if (p->modes & PARPORT_MODE_PCSPP) {
+ while(p) {
+ tmp = p->next;
+ parport_splink_unregister_port(p);
+ p = tmp;
+ }
+ }
+ }
+}
+
+MODULE_AUTHOR("Nuno Grilo <nuno.grilo@netcabo.pt>");
+MODULE_DESCRIPTION("Parport Driver for ASUS WL-500g router builtin Port");
+MODULE_SUPPORTED_DEVICE("ASUS WL-500g builtin Parallel Port");
+MODULE_LICENSE("GPL");
+
+module_init(parport_splink_init)
+module_exit(parport_splink_cleanup)
+
diff --git a/package/linux/linux.config b/package/linux/linux.config
index 5efd0e030a..31900bb6e9 100644
--- a/package/linux/linux.config
+++ b/package/linux/linux.config
@@ -1,5 +1,5 @@
#
-# Automatically generated make config: don't edit
+# Automatically generated by make menuconfig: don't edit
#
CONFIG_MIPS=y
CONFIG_MIPS32=y
@@ -181,10 +181,6 @@ CONFIG_MTD_PARTITIONS=y
# CONFIG_MTD_CONCAT is not set
# CONFIG_MTD_REDBOOT_PARTS is not set
# CONFIG_MTD_CMDLINE_PARTS is not set
-
-#
-# User Modules And Translation Layers
-#
CONFIG_MTD_CHAR=y
CONFIG_MTD_BLOCK=y
# CONFIG_FTL is not set
@@ -250,10 +246,6 @@ CONFIG_MTD_SFLASH=y
# CONFIG_MTD_SLRAM is not set
# CONFIG_MTD_MTDRAM is not set
# CONFIG_MTD_BLKMTD is not set
-
-#
-# Disk-On-Chip Device Drivers
-#
# CONFIG_MTD_DOC1000 is not set
# CONFIG_MTD_DOC2000 is not set
# CONFIG_MTD_DOC2001 is not set
@@ -268,12 +260,8 @@ CONFIG_MTD_SFLASH=y
# Parallel port support
#
CONFIG_PARPORT=m
-CONFIG_PARPORT_PC=m
-CONFIG_PARPORT_PC_CML1=m
-# CONFIG_PARPORT_SERIAL is not set
-# CONFIG_PARPORT_PC_FIFO is not set
-# CONFIG_PARPORT_PC_SUPERIO is not set
-# CONFIG_PARPORT_PC_PCMCIA is not set
+# CONFIG_PARPORT_PC is not set
+CONFIG_PARPORT_SPLINK=m
# CONFIG_PARPORT_AMIGA is not set
# CONFIG_PARPORT_MFC3 is not set
# CONFIG_PARPORT_ATARI is not set
@@ -437,10 +425,6 @@ CONFIG_IP6_NF_TARGET_MARK=m
# CONFIG_IP_SCTP is not set
# CONFIG_ATM is not set
CONFIG_VLAN_8021Q=y
-
-#
-#
-#
# CONFIG_IPX is not set
# CONFIG_ATALK is not set
# CONFIG_DECNET is not set
@@ -525,20 +509,12 @@ CONFIG_NET_CLS_POLICE=y
# SCSI support
#
CONFIG_SCSI=m
-
-#
-# SCSI support type (disk, tape, CD-ROM)
-#
CONFIG_BLK_DEV_SD=m
CONFIG_SD_EXTRA_DEVS=5
# CONFIG_CHR_DEV_ST is not set
# CONFIG_CHR_DEV_OSST is not set
# CONFIG_BLK_DEV_SR is not set
CONFIG_CHR_DEV_SG=m
-
-#
-# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
-#
# CONFIG_SCSI_DEBUG_QUEUES is not set
# CONFIG_SCSI_MULTI_LUN is not set
# CONFIG_SCSI_CONSTANTS is not set
@@ -780,14 +756,6 @@ CONFIG_PRINTER=m
# Joysticks
#
# CONFIG_INPUT_GAMEPORT is not set
-
-#
-# Input core support is needed for gameports
-#
-
-#
-# Input core support is needed for joysticks
-#
# CONFIG_QIC02_TAPE is not set
# CONFIG_IPMI_HANDLER is not set
# CONFIG_IPMI_PANIC_EVENT is not set
@@ -1016,24 +984,12 @@ CONFIG_NLS_DEFAULT="iso8859-1"
#
CONFIG_USB=m
# CONFIG_USB_DEBUG is not set
-
-#
-# Miscellaneous USB options
-#
CONFIG_USB_DEVICEFS=y
# CONFIG_USB_BANDWIDTH is not set
-
-#
-# USB Host Controller Drivers
-#
# CONFIG_USB_EHCI_HCD is not set
# CONFIG_USB_UHCI is not set
# CONFIG_USB_UHCI_ALT is not set
CONFIG_USB_OHCI=m
-
-#
-# USB Device Class drivers
-#
# CONFIG_USB_AUDIO is not set
# CONFIG_USB_EMI26 is not set
# CONFIG_USB_BLUETOOTH is not set
@@ -1050,15 +1006,7 @@ CONFIG_USB_STORAGE_SDDR55=y
CONFIG_USB_STORAGE_JUMPSHOT=y
# CONFIG_USB_ACM is not set
CONFIG_USB_PRINTER=m
-
-#
-# USB Human Interface Devices (HID)
-#
# CONFIG_USB_HID is not set
-
-#
-# Input core support is needed for USB HID input layer or HIDBP support
-#
# CONFIG_USB_HIDINPUT is not set
# CONFIG_USB_HIDDEV is not set
# CONFIG_USB_KBD is not set
@@ -1067,47 +1015,23 @@ CONFIG_USB_PRINTER=m
# CONFIG_USB_WACOM is not set
# CONFIG_USB_KBTAB is not set
# CONFIG_USB_POWERMATE is not set
-
-#
-# USB Imaging devices
-#
# CONFIG_USB_DC2XX is not set
# CONFIG_USB_MDC800 is not set
# CONFIG_USB_SCANNER is not set
# CONFIG_USB_MICROTEK is not set
# CONFIG_USB_HPUSBSCSI is not set
-
-#
-# USB Multimedia devices
-#
-
-#
-# Video4Linux support is needed for USB Multimedia device support
-#
-
-#
-# USB Network adaptors
-#
# CONFIG_USB_PEGASUS is not set
# CONFIG_USB_RTL8150 is not set
# CONFIG_USB_KAWETH is not set
# CONFIG_USB_CATC is not set
# CONFIG_USB_CDCETHER is not set
# CONFIG_USB_USBNET is not set
-
-#
-# USB port drivers
-#
# CONFIG_USB_USS720 is not set
#
# USB Serial Converter support
#
# CONFIG_USB_SERIAL is not set
-
-#
-# USB Miscellaneous drivers
-#
# CONFIG_USB_RIO500 is not set
# CONFIG_USB_AUERSWALD is not set
# CONFIG_USB_TIGL is not set