Commit d9b2c4d0 authored by Linus Torvalds's avatar Linus Torvalds

Merge git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia-2.6: (50 commits)
  pcmcia: rework the irq_req_t typedef
  pcmcia: remove deprecated handle_to_dev() macro
  pcmcia: pcmcia_request_window() doesn't need a pointer to a pointer
  pcmcia: remove unused "window_t" typedef
  pcmcia: move some window-related code to pcmcia_ioctl.c
  pcmcia: Change window_handle_t logic to unsigned long
  pcmcia: Pass struct pcmcia_socket to pcmcia_get_mem_page()
  pcmcia: Pass struct pcmcia_device to pcmcia_map_mem_page()
  pcmcia: Pass struct pcmcia_device to pcmcia_release_window()
  drivers/pcmcia: remove unnecessary kzalloc
  pcmcia: correct handling for Zoomed Video registers in topic.h
  pcmcia: fix printk formats
  pcmcia: autoload module pcmcia
  pcmcia/staging: update comedi drivers
  PCMCIA: stop duplicating pci_irq in soc_pcmcia_socket
  PCMCIA: ss: allow PCI IRQs > 255
  PCMCIA: soc_common: remove 'dev' member from soc_pcmcia_socket
  PCMCIA: soc_common: constify soc_pcmcia_socket ops member
  PCMCIA: sa1111: remove duplicated initializers
  PCMCIA: sa1111: wrap soc_pcmcia_socket to contain sa1111 specific data
  ...
parents 27d16d08 5fa9167a
This file details changes in 2.6 which affect PCMCIA card driver authors: This file details changes in 2.6 which affect PCMCIA card driver authors:
* no cs_error / CS_CHECK / CONFIG_PCMCIA_DEBUG (as of 2.6.33)
Instead of the cs_error() callback or the CS_CHECK() macro, please use
Linux-style checking of return values, and -- if necessary -- debug
messages using "dev_dbg()" or "pr_debug()".
* New CIS tuple access (as of 2.6.33)
Instead of pcmcia_get_{first,next}_tuple(), pcmcia_get_tuple_data() and
pcmcia_parse_tuple(), a driver shall use "pcmcia_get_tuple()" if it is
only interested in one (raw) tuple, or "pcmcia_loop_tuple()" if it is
interested in all tuples of one type. To decode the MAC from CISTPL_FUNCE,
a new helper "pcmcia_get_mac_from_cis()" was added.
* New configuration loop helper (as of 2.6.28) * New configuration loop helper (as of 2.6.28)
By calling pcmcia_loop_config(), a driver can iterate over all available By calling pcmcia_loop_config(), a driver can iterate over all available
configuration options. During a driver's probe() phase, one doesn't need configuration options. During a driver's probe() phase, one doesn't need
......
...@@ -177,9 +177,6 @@ static struct ata_port_operations pcmcia_8bit_port_ops = { ...@@ -177,9 +177,6 @@ static struct ata_port_operations pcmcia_8bit_port_ops = {
.drain_fifo = pcmcia_8bit_drain_fifo, .drain_fifo = pcmcia_8bit_drain_fifo,
}; };
#define CS_CHECK(fn, ret) \
do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
struct pcmcia_config_check { struct pcmcia_config_check {
unsigned long ctl_base; unsigned long ctl_base;
...@@ -252,7 +249,7 @@ static int pcmcia_init_one(struct pcmcia_device *pdev) ...@@ -252,7 +249,7 @@ static int pcmcia_init_one(struct pcmcia_device *pdev)
struct ata_port *ap; struct ata_port *ap;
struct ata_pcmcia_info *info; struct ata_pcmcia_info *info;
struct pcmcia_config_check *stk = NULL; struct pcmcia_config_check *stk = NULL;
int last_ret = 0, last_fn = 0, is_kme = 0, ret = -ENOMEM, p; int is_kme = 0, ret = -ENOMEM, p;
unsigned long io_base, ctl_base; unsigned long io_base, ctl_base;
void __iomem *io_addr, *ctl_addr; void __iomem *io_addr, *ctl_addr;
int n_ports = 1; int n_ports = 1;
...@@ -271,7 +268,6 @@ static int pcmcia_init_one(struct pcmcia_device *pdev) ...@@ -271,7 +268,6 @@ static int pcmcia_init_one(struct pcmcia_device *pdev)
pdev->io.Attributes2 = IO_DATA_PATH_WIDTH_8; pdev->io.Attributes2 = IO_DATA_PATH_WIDTH_8;
pdev->io.IOAddrLines = 3; pdev->io.IOAddrLines = 3;
pdev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; pdev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
pdev->irq.IRQInfo1 = IRQ_LEVEL_ID;
pdev->conf.Attributes = CONF_ENABLE_IRQ; pdev->conf.Attributes = CONF_ENABLE_IRQ;
pdev->conf.IntType = INT_MEMORY_AND_IO; pdev->conf.IntType = INT_MEMORY_AND_IO;
...@@ -296,8 +292,13 @@ static int pcmcia_init_one(struct pcmcia_device *pdev) ...@@ -296,8 +292,13 @@ static int pcmcia_init_one(struct pcmcia_device *pdev)
} }
io_base = pdev->io.BasePort1; io_base = pdev->io.BasePort1;
ctl_base = stk->ctl_base; ctl_base = stk->ctl_base;
CS_CHECK(RequestIRQ, pcmcia_request_irq(pdev, &pdev->irq)); ret = pcmcia_request_irq(pdev, &pdev->irq);
CS_CHECK(RequestConfiguration, pcmcia_request_configuration(pdev, &pdev->conf)); if (ret)
goto failed;
ret = pcmcia_request_configuration(pdev, &pdev->conf);
if (ret)
goto failed;
/* iomap */ /* iomap */
ret = -ENOMEM; ret = -ENOMEM;
...@@ -351,8 +352,6 @@ static int pcmcia_init_one(struct pcmcia_device *pdev) ...@@ -351,8 +352,6 @@ static int pcmcia_init_one(struct pcmcia_device *pdev)
kfree(stk); kfree(stk);
return 0; return 0;
cs_failed:
cs_error(pdev, last_fn, last_ret);
failed: failed:
kfree(stk); kfree(stk);
info->ndev = 0; info->ndev = 0;
......
...@@ -867,11 +867,9 @@ static int bluecard_probe(struct pcmcia_device *link) ...@@ -867,11 +867,9 @@ static int bluecard_probe(struct pcmcia_device *link)
link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
link->io.NumPorts1 = 8; link->io.NumPorts1 = 8;
link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING | IRQ_HANDLE_PRESENT; link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
link->irq.IRQInfo1 = IRQ_LEVEL_ID;
link->irq.Handler = bluecard_interrupt; link->irq.Handler = bluecard_interrupt;
link->irq.Instance = info;
link->conf.Attributes = CONF_ENABLE_IRQ; link->conf.Attributes = CONF_ENABLE_IRQ;
link->conf.IntType = INT_MEMORY_AND_IO; link->conf.IntType = INT_MEMORY_AND_IO;
...@@ -905,22 +903,16 @@ static int bluecard_config(struct pcmcia_device *link) ...@@ -905,22 +903,16 @@ static int bluecard_config(struct pcmcia_device *link)
break; break;
} }
if (i != 0) { if (i != 0)
cs_error(link, RequestIO, i);
goto failed; goto failed;
}
i = pcmcia_request_irq(link, &link->irq); i = pcmcia_request_irq(link, &link->irq);
if (i != 0) { if (i != 0)
cs_error(link, RequestIRQ, i);
link->irq.AssignedIRQ = 0; link->irq.AssignedIRQ = 0;
}
i = pcmcia_request_configuration(link, &link->conf); i = pcmcia_request_configuration(link, &link->conf);
if (i != 0) { if (i != 0)
cs_error(link, RequestConfiguration, i);
goto failed; goto failed;
}
if (bluecard_open(info) != 0) if (bluecard_open(info) != 0)
goto failed; goto failed;
......
...@@ -659,11 +659,9 @@ static int bt3c_probe(struct pcmcia_device *link) ...@@ -659,11 +659,9 @@ static int bt3c_probe(struct pcmcia_device *link)
link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
link->io.NumPorts1 = 8; link->io.NumPorts1 = 8;
link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING | IRQ_HANDLE_PRESENT; link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
link->irq.IRQInfo1 = IRQ_LEVEL_ID;
link->irq.Handler = bt3c_interrupt; link->irq.Handler = bt3c_interrupt;
link->irq.Instance = info;
link->conf.Attributes = CONF_ENABLE_IRQ; link->conf.Attributes = CONF_ENABLE_IRQ;
link->conf.IntType = INT_MEMORY_AND_IO; link->conf.IntType = INT_MEMORY_AND_IO;
...@@ -740,21 +738,16 @@ static int bt3c_config(struct pcmcia_device *link) ...@@ -740,21 +738,16 @@ static int bt3c_config(struct pcmcia_device *link)
goto found_port; goto found_port;
BT_ERR("No usable port range found"); BT_ERR("No usable port range found");
cs_error(link, RequestIO, -ENODEV);
goto failed; goto failed;
found_port: found_port:
i = pcmcia_request_irq(link, &link->irq); i = pcmcia_request_irq(link, &link->irq);
if (i != 0) { if (i != 0)
cs_error(link, RequestIRQ, i);
link->irq.AssignedIRQ = 0; link->irq.AssignedIRQ = 0;
}
i = pcmcia_request_configuration(link, &link->conf); i = pcmcia_request_configuration(link, &link->conf);
if (i != 0) { if (i != 0)
cs_error(link, RequestConfiguration, i);
goto failed; goto failed;
}
if (bt3c_open(info) != 0) if (bt3c_open(info) != 0)
goto failed; goto failed;
......
...@@ -588,11 +588,9 @@ static int btuart_probe(struct pcmcia_device *link) ...@@ -588,11 +588,9 @@ static int btuart_probe(struct pcmcia_device *link)
link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
link->io.NumPorts1 = 8; link->io.NumPorts1 = 8;
link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING | IRQ_HANDLE_PRESENT; link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
link->irq.IRQInfo1 = IRQ_LEVEL_ID;
link->irq.Handler = btuart_interrupt; link->irq.Handler = btuart_interrupt;
link->irq.Instance = info;
link->conf.Attributes = CONF_ENABLE_IRQ; link->conf.Attributes = CONF_ENABLE_IRQ;
link->conf.IntType = INT_MEMORY_AND_IO; link->conf.IntType = INT_MEMORY_AND_IO;
...@@ -669,21 +667,16 @@ static int btuart_config(struct pcmcia_device *link) ...@@ -669,21 +667,16 @@ static int btuart_config(struct pcmcia_device *link)
goto found_port; goto found_port;
BT_ERR("No usable port range found"); BT_ERR("No usable port range found");
cs_error(link, RequestIO, -ENODEV);
goto failed; goto failed;
found_port: found_port:
i = pcmcia_request_irq(link, &link->irq); i = pcmcia_request_irq(link, &link->irq);
if (i != 0) { if (i != 0)
cs_error(link, RequestIRQ, i);
link->irq.AssignedIRQ = 0; link->irq.AssignedIRQ = 0;
}
i = pcmcia_request_configuration(link, &link->conf); i = pcmcia_request_configuration(link, &link->conf);
if (i != 0) { if (i != 0)
cs_error(link, RequestConfiguration, i);
goto failed; goto failed;
}
if (btuart_open(info) != 0) if (btuart_open(info) != 0)
goto failed; goto failed;
......
...@@ -573,11 +573,9 @@ static int dtl1_probe(struct pcmcia_device *link) ...@@ -573,11 +573,9 @@ static int dtl1_probe(struct pcmcia_device *link)
link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
link->io.NumPorts1 = 8; link->io.NumPorts1 = 8;
link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING | IRQ_HANDLE_PRESENT; link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
link->irq.IRQInfo1 = IRQ_LEVEL_ID;
link->irq.Handler = dtl1_interrupt; link->irq.Handler = dtl1_interrupt;
link->irq.Instance = info;
link->conf.Attributes = CONF_ENABLE_IRQ; link->conf.Attributes = CONF_ENABLE_IRQ;
link->conf.IntType = INT_MEMORY_AND_IO; link->conf.IntType = INT_MEMORY_AND_IO;
...@@ -622,16 +620,12 @@ static int dtl1_config(struct pcmcia_device *link) ...@@ -622,16 +620,12 @@ static int dtl1_config(struct pcmcia_device *link)
goto failed; goto failed;
i = pcmcia_request_irq(link, &link->irq); i = pcmcia_request_irq(link, &link->irq);
if (i != 0) { if (i != 0)
cs_error(link, RequestIRQ, i);
link->irq.AssignedIRQ = 0; link->irq.AssignedIRQ = 0;
}
i = pcmcia_request_configuration(link, &link->conf); i = pcmcia_request_configuration(link, &link->conf);
if (i != 0) { if (i != 0)
cs_error(link, RequestConfiguration, i);
goto failed; goto failed;
}
if (dtl1_open(info) != 0) if (dtl1_open(info) != 0)
goto failed; goto failed;
......
...@@ -23,8 +23,6 @@ ...@@ -23,8 +23,6 @@
* All rights reserved. Licensed under dual BSD/GPL license. * All rights reserved. Licensed under dual BSD/GPL license.
*/ */
/* #define PCMCIA_DEBUG 6 */
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/slab.h> #include <linux/slab.h>
...@@ -47,18 +45,17 @@ ...@@ -47,18 +45,17 @@
/* #define ATR_CSUM */ /* #define ATR_CSUM */
#ifdef PCMCIA_DEBUG #define reader_to_dev(x) (&x->p_dev->dev)
#define reader_to_dev(x) (&handle_to_dev(x->p_dev))
static int pc_debug = PCMCIA_DEBUG; /* n (debug level) is ignored */
module_param(pc_debug, int, 0600); /* additional debug output may be enabled by re-compiling with
* CM4000_DEBUG set */
/* #define CM4000_DEBUG */
#define DEBUGP(n, rdr, x, args...) do { \ #define DEBUGP(n, rdr, x, args...) do { \
if (pc_debug >= (n)) \ dev_dbg(reader_to_dev(rdr), "%s:" x, \
dev_printk(KERN_DEBUG, reader_to_dev(rdr), "%s:" x, \
__func__ , ## args); \ __func__ , ## args); \
} while (0) } while (0)
#else
#define DEBUGP(n, rdr, x, args...)
#endif
static char *version = "cm4000_cs.c v2.4.0gm6 - All bugs added by Harald Welte"; static char *version = "cm4000_cs.c v2.4.0gm6 - All bugs added by Harald Welte";
#define T_1SEC (HZ) #define T_1SEC (HZ)
...@@ -174,14 +171,13 @@ static unsigned char fi_di_table[10][14] = { ...@@ -174,14 +171,13 @@ static unsigned char fi_di_table[10][14] = {
/* 9 */ {0x09,0x19,0x29,0x39,0x49,0x59,0x69,0x11,0x11,0x99,0xA9,0xB9,0xC9,0xD9} /* 9 */ {0x09,0x19,0x29,0x39,0x49,0x59,0x69,0x11,0x11,0x99,0xA9,0xB9,0xC9,0xD9}
}; };
#ifndef PCMCIA_DEBUG #ifndef CM4000_DEBUG
#define xoutb outb #define xoutb outb
#define xinb inb #define xinb inb
#else #else
static inline void xoutb(unsigned char val, unsigned short port) static inline void xoutb(unsigned char val, unsigned short port)
{ {
if (pc_debug >= 7) pr_debug("outb(val=%.2x,port=%.4x)\n", val, port);
printk(KERN_DEBUG "outb(val=%.2x,port=%.4x)\n", val, port);
outb(val, port); outb(val, port);
} }
static inline unsigned char xinb(unsigned short port) static inline unsigned char xinb(unsigned short port)
...@@ -189,8 +185,7 @@ static inline unsigned char xinb(unsigned short port) ...@@ -189,8 +185,7 @@ static inline unsigned char xinb(unsigned short port)
unsigned char val; unsigned char val;
val = inb(port); val = inb(port);
if (pc_debug >= 7) pr_debug("%.2x=inb(%.4x)\n", val, port);
printk(KERN_DEBUG "%.2x=inb(%.4x)\n", val, port);
return val; return val;
} }
...@@ -514,12 +509,10 @@ static int set_protocol(struct cm4000_dev *dev, struct ptsreq *ptsreq) ...@@ -514,12 +509,10 @@ static int set_protocol(struct cm4000_dev *dev, struct ptsreq *ptsreq)
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
xoutb(i, REG_BUF_ADDR(iobase)); xoutb(i, REG_BUF_ADDR(iobase));
xoutb(dev->pts[i], REG_BUF_DATA(iobase)); /* buf data */ xoutb(dev->pts[i], REG_BUF_DATA(iobase)); /* buf data */
#ifdef PCMCIA_DEBUG #ifdef CM4000_DEBUG
if (pc_debug >= 5) pr_debug("0x%.2x ", dev->pts[i]);
printk("0x%.2x ", dev->pts[i]);
} }
if (pc_debug >= 5) pr_debug("\n");
printk("\n");
#else #else
} }
#endif #endif
...@@ -579,14 +572,13 @@ static int set_protocol(struct cm4000_dev *dev, struct ptsreq *ptsreq) ...@@ -579,14 +572,13 @@ static int set_protocol(struct cm4000_dev *dev, struct ptsreq *ptsreq)
pts_reply[i] = inb(REG_BUF_DATA(iobase)); pts_reply[i] = inb(REG_BUF_DATA(iobase));
} }
#ifdef PCMCIA_DEBUG #ifdef CM4000_DEBUG
DEBUGP(2, dev, "PTSreply: "); DEBUGP(2, dev, "PTSreply: ");
for (i = 0; i < num_bytes_read; i++) { for (i = 0; i < num_bytes_read; i++) {
if (pc_debug >= 5) pr_debug("0x%.2x ", pts_reply[i]);
printk("0x%.2x ", pts_reply[i]);
} }
printk("\n"); pr_debug("\n");
#endif /* PCMCIA_DEBUG */ #endif /* CM4000_DEBUG */
DEBUGP(5, dev, "Clear Tactive in Flags1\n"); DEBUGP(5, dev, "Clear Tactive in Flags1\n");
xoutb(0x20, REG_FLAGS1(iobase)); xoutb(0x20, REG_FLAGS1(iobase));
...@@ -655,7 +647,7 @@ static void terminate_monitor(struct cm4000_dev *dev) ...@@ -655,7 +647,7 @@ static void terminate_monitor(struct cm4000_dev *dev)
DEBUGP(5, dev, "Delete timer\n"); DEBUGP(5, dev, "Delete timer\n");
del_timer_sync(&dev->timer); del_timer_sync(&dev->timer);
#ifdef PCMCIA_DEBUG #ifdef CM4000_DEBUG
dev->monitor_running = 0; dev->monitor_running = 0;
#endif #endif
...@@ -898,7 +890,7 @@ static void monitor_card(unsigned long p) ...@@ -898,7 +890,7 @@ static void monitor_card(unsigned long p)
DEBUGP(4, dev, "ATR checksum (0x%.2x, should " DEBUGP(4, dev, "ATR checksum (0x%.2x, should "
"be zero) failed\n", dev->atr_csum); "be zero) failed\n", dev->atr_csum);
} }
#ifdef PCMCIA_DEBUG #ifdef CM4000_DEBUG
else if (test_bit(IS_BAD_LENGTH, &dev->flags)) { else if (test_bit(IS_BAD_LENGTH, &dev->flags)) {
DEBUGP(4, dev, "ATR length error\n"); DEBUGP(4, dev, "ATR length error\n");
} else { } else {
...@@ -1415,7 +1407,7 @@ static long cmm_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) ...@@ -1415,7 +1407,7 @@ static long cmm_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
int size; int size;
int rc; int rc;
void __user *argp = (void __user *)arg; void __user *argp = (void __user *)arg;
#ifdef PCMCIA_DEBUG #ifdef CM4000_DEBUG
char *ioctl_names[CM_IOC_MAXNR + 1] = { char *ioctl_names[CM_IOC_MAXNR + 1] = {
[_IOC_NR(CM_IOCGSTATUS)] "CM_IOCGSTATUS", [_IOC_NR(CM_IOCGSTATUS)] "CM_IOCGSTATUS",
[_IOC_NR(CM_IOCGATR)] "CM_IOCGATR", [_IOC_NR(CM_IOCGATR)] "CM_IOCGATR",
...@@ -1423,9 +1415,9 @@ static long cmm_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) ...@@ -1423,9 +1415,9 @@ static long cmm_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
[_IOC_NR(CM_IOCSPTS)] "CM_IOCSPTS", [_IOC_NR(CM_IOCSPTS)] "CM_IOCSPTS",
[_IOC_NR(CM_IOSDBGLVL)] "CM4000_DBGLVL", [_IOC_NR(CM_IOSDBGLVL)] "CM4000_DBGLVL",
}; };
#endif
DEBUGP(3, dev, "cmm_ioctl(device=%d.%d) %s\n", imajor(inode), DEBUGP(3, dev, "cmm_ioctl(device=%d.%d) %s\n", imajor(inode),
iminor(inode), ioctl_names[_IOC_NR(cmd)]); iminor(inode), ioctl_names[_IOC_NR(cmd)]);
#endif
lock_kernel(); lock_kernel();
rc = -ENODEV; rc = -ENODEV;
...@@ -1523,7 +1515,7 @@ static long cmm_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) ...@@ -1523,7 +1515,7 @@ static long cmm_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
} }
case CM_IOCARDOFF: case CM_IOCARDOFF:
#ifdef PCMCIA_DEBUG #ifdef CM4000_DEBUG
DEBUGP(4, dev, "... in CM_IOCARDOFF\n"); DEBUGP(4, dev, "... in CM_IOCARDOFF\n");
if (dev->flags0 & 0x01) { if (dev->flags0 & 0x01) {
DEBUGP(4, dev, " Card inserted\n"); DEBUGP(4, dev, " Card inserted\n");
...@@ -1625,18 +1617,9 @@ static long cmm_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) ...@@ -1625,18 +1617,9 @@ static long cmm_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
} }
break; break;
#ifdef PCMCIA_DEBUG #ifdef CM4000_DEBUG
case CM_IOSDBGLVL: /* set debug log level */ case CM_IOSDBGLVL:
{ rc = -ENOTTY;
int old_pc_debug = 0;
old_pc_debug = pc_debug;
if (copy_from_user(&pc_debug, argp, sizeof(int)))
rc = -EFAULT;
else if (old_pc_debug != pc_debug)
DEBUGP(0, dev, "Changed debug log level "
"to %i\n", pc_debug);
}
break; break;
#endif #endif
default: default:
......
...@@ -17,8 +17,6 @@ ...@@ -17,8 +17,6 @@
* All rights reserved, Dual BSD/GPL Licensed. * All rights reserved, Dual BSD/GPL Licensed.
*/ */
/* #define PCMCIA_DEBUG 6 */
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/slab.h> #include <linux/slab.h>
...@@ -41,18 +39,16 @@ ...@@ -41,18 +39,16 @@
#include "cm4040_cs.h" #include "cm4040_cs.h"
#ifdef PCMCIA_DEBUG #define reader_to_dev(x) (&x->p_dev->dev)
#define reader_to_dev(x) (&handle_to_dev(x->p_dev))
static int pc_debug = PCMCIA_DEBUG; /* n (debug level) is ignored */
module_param(pc_debug, int, 0600); /* additional debug output may be enabled by re-compiling with
* CM4040_DEBUG set */
/* #define CM4040_DEBUG */
#define DEBUGP(n, rdr, x, args...) do { \ #define DEBUGP(n, rdr, x, args...) do { \
if (pc_debug >= (n)) \ dev_dbg(reader_to_dev(rdr), "%s:" x, \
dev_printk(KERN_DEBUG, reader_to_dev(rdr), "%s:" x, \ __func__ , ## args); \
__func__ , ##args); \
} while (0) } while (0)
#else
#define DEBUGP(n, rdr, x, args...)
#endif
static char *version = static char *version =
"OMNIKEY CardMan 4040 v1.1.0gm5 - All bugs added by Harald Welte"; "OMNIKEY CardMan 4040 v1.1.0gm5 - All bugs added by Harald Welte";
...@@ -90,14 +86,13 @@ struct reader_dev { ...@@ -90,14 +86,13 @@ struct reader_dev {
static struct pcmcia_device *dev_table[CM_MAX_DEV]; static struct pcmcia_device *dev_table[CM_MAX_DEV];
#ifndef PCMCIA_DEBUG #ifndef CM4040_DEBUG
#define xoutb outb #define xoutb outb
#define xinb inb #define xinb inb
#else #else
static inline void xoutb(unsigned char val, unsigned short port) static inline void xoutb(unsigned char val, unsigned short port)
{ {
if (pc_debug >= 7) pr_debug("outb(val=%.2x,port=%.4x)\n", val, port);
printk(KERN_DEBUG "outb(val=%.2x,port=%.4x)\n", val, port);
outb(val, port); outb(val, port);
} }
...@@ -106,8 +101,7 @@ static inline unsigned char xinb(unsigned short port) ...@@ -106,8 +101,7 @@ static inline unsigned char xinb(unsigned short port)
unsigned char val; unsigned char val;
val = inb(port); val = inb(port);
if (pc_debug >= 7) pr_debug("%.2x=inb(%.4x)\n", val, port);
printk(KERN_DEBUG "%.2x=inb(%.4x)\n", val, port);
return val; return val;
} }
#endif #endif
...@@ -260,23 +254,22 @@ static ssize_t cm4040_read(struct file *filp, char __user *buf, ...@@ -260,23 +254,22 @@ static ssize_t cm4040_read(struct file *filp, char __user *buf,
return -EIO; return -EIO;
} }
dev->r_buf[i] = xinb(iobase + REG_OFFSET_BULK_IN); dev->r_buf[i] = xinb(iobase + REG_OFFSET_BULK_IN);
#ifdef PCMCIA_DEBUG #ifdef CM4040_DEBUG
if (pc_debug >= 6) pr_debug("%lu:%2x ", i, dev->r_buf[i]);
printk(KERN_DEBUG "%lu:%2x ", i, dev->r_buf[i]);
} }
printk("\n"); pr_debug("\n");
#else #else
} }
#endif #endif
bytes_to_read = 5 + le32_to_cpu(*(__le32 *)&dev->r_buf[1]); bytes_to_read = 5 + le32_to_cpu(*(__le32 *)&dev->r_buf[1]);
DEBUGP(6, dev, "BytesToRead=%lu\n", bytes_to_read); DEBUGP(6, dev, "BytesToRead=%zu\n", bytes_to_read);
min_bytes_to_read = min(count, bytes_to_read + 5); min_bytes_to_read = min(count, bytes_to_read + 5);
min_bytes_to_read = min_t(size_t, min_bytes_to_read, READ_WRITE_BUFFER_SIZE); min_bytes_to_read = min_t(size_t, min_bytes_to_read, READ_WRITE_BUFFER_SIZE);
DEBUGP(6, dev, "Min=%lu\n", min_bytes_to_read); DEBUGP(6, dev, "Min=%zu\n", min_bytes_to_read);
for (i = 0; i < (min_bytes_to_read-5); i++) { for (i = 0; i < (min_bytes_to_read-5); i++) {
rc = wait_for_bulk_in_ready(dev); rc = wait_for_bulk_in_ready(dev);
...@@ -288,11 +281,10 @@ static ssize_t cm4040_read(struct file *filp, char __user *buf, ...@@ -288,11 +281,10 @@ static ssize_t cm4040_read(struct file *filp, char __user *buf,
return -EIO; return -EIO;
} }
dev->r_buf[i+5] = xinb(iobase + REG_OFFSET_BULK_IN); dev->r_buf[i+5] = xinb(iobase + REG_OFFSET_BULK_IN);
#ifdef PCMCIA_DEBUG #ifdef CM4040_DEBUG
if (pc_debug >= 6) pr_debug("%lu:%2x ", i, dev->r_buf[i]);
printk(KERN_DEBUG "%lu:%2x ", i, dev->r_buf[i]);
} }
printk("\n"); pr_debug("\n");
#else #else
} }
#endif #endif
...@@ -547,7 +539,7 @@ static int cm4040_config_check(struct pcmcia_device *p_dev, ...@@ -547,7 +539,7 @@ static int cm4040_config_check(struct pcmcia_device *p_dev,
p_dev->io.IOAddrLines = cfg->io.flags & CISTPL_IO_LINES_MASK; p_dev->io.IOAddrLines = cfg->io.flags & CISTPL_IO_LINES_MASK;
rc = pcmcia_request_io(p_dev, &p_dev->io); rc = pcmcia_request_io(p_dev, &p_dev->io);
dev_printk(KERN_INFO, &handle_to_dev(p_dev), dev_printk(KERN_INFO, &p_dev->dev,
"pcmcia_request_io returned 0x%x\n", rc); "pcmcia_request_io returned 0x%x\n", rc);
return rc; return rc;
} }
...@@ -569,7 +561,7 @@ static int reader_config(struct pcmcia_device *link, int devno) ...@@ -569,7 +561,7 @@ static int reader_config(struct pcmcia_device *link, int devno)
fail_rc = pcmcia_request_configuration(link, &link->conf); fail_rc = pcmcia_request_configuration(link, &link->conf);
if (fail_rc != 0) { if (fail_rc != 0) {
dev_printk(KERN_INFO, &handle_to_dev(link), dev_printk(KERN_INFO, &link->dev,
"pcmcia_request_configuration failed 0x%x\n", "pcmcia_request_configuration failed 0x%x\n",
fail_rc); fail_rc);
goto cs_release; goto cs_release;
......
...@@ -1213,12 +1213,12 @@ static irqreturn_t ipwireless_handle_v2_v3_interrupt(int irq, ...@@ -1213,12 +1213,12 @@ static irqreturn_t ipwireless_handle_v2_v3_interrupt(int irq,
irqreturn_t ipwireless_interrupt(int irq, void *dev_id) irqreturn_t ipwireless_interrupt(int irq, void *dev_id)
{ {
struct ipw_hardware *hw = dev_id; struct ipw_dev *ipw = dev_id;
if (hw->hw_version == HW_VERSION_1) if (ipw->hardware->hw_version == HW_VERSION_1)
return ipwireless_handle_v1_interrupt(irq, hw); return ipwireless_handle_v1_interrupt(irq, ipw->hardware);
else else
return ipwireless_handle_v2_v3_interrupt(irq, hw); return ipwireless_handle_v2_v3_interrupt(irq, ipw->hardware);
} }
static void flush_packets_to_hw(struct ipw_hardware *hw) static void flush_packets_to_hw(struct ipw_hardware *hw)
......
This diff is collapsed.
...@@ -554,7 +554,6 @@ static int mgslpc_probe(struct pcmcia_device *link) ...@@ -554,7 +554,6 @@ static int mgslpc_probe(struct pcmcia_device *link)
/* Interrupt setup */ /* Interrupt setup */
link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
link->irq.IRQInfo1 = IRQ_LEVEL_ID;
link->irq.Handler = NULL; link->irq.Handler = NULL;
link->conf.Attributes = 0; link->conf.Attributes = 0;
...@@ -572,69 +571,51 @@ static int mgslpc_probe(struct pcmcia_device *link) ...@@ -572,69 +571,51 @@ static int mgslpc_probe(struct pcmcia_device *link)
/* Card has been inserted. /* Card has been inserted.
*/ */
#define CS_CHECK(fn, ret) \ static int mgslpc_ioprobe(struct pcmcia_device *p_dev,
do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) cistpl_cftable_entry_t *cfg,
cistpl_cftable_entry_t *dflt,
unsigned int vcc,
void *priv_data)
{
if (cfg->io.nwin > 0) {
p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
if (!(cfg->io.flags & CISTPL_IO_8BIT))
p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16;
if (!(cfg->io.flags & CISTPL_IO_16BIT))
p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
p_dev->io.IOAddrLines = cfg->io.flags & CISTPL_IO_LINES_MASK;
p_dev->io.BasePort1 = cfg->io.win[0].base;
p_dev->io.NumPorts1 = cfg->io.win[0].len;
return pcmcia_request_io(p_dev, &p_dev->io);
}
return -ENODEV;
}
static int mgslpc_config(struct pcmcia_device *link) static int mgslpc_config(struct pcmcia_device *link)
{ {
MGSLPC_INFO *info = link->priv; MGSLPC_INFO *info = link->priv;
tuple_t tuple; int ret;
cisparse_t parse;
int last_fn, last_ret;
u_char buf[64];
cistpl_cftable_entry_t dflt = { 0 };
cistpl_cftable_entry_t *cfg;
if (debug_level >= DEBUG_LEVEL_INFO) if (debug_level >= DEBUG_LEVEL_INFO)
printk("mgslpc_config(0x%p)\n", link); printk("mgslpc_config(0x%p)\n", link);
tuple.Attributes = 0; ret = pcmcia_loop_config(link, mgslpc_ioprobe, NULL);
tuple.TupleData = buf; if (ret != 0)
tuple.TupleDataMax = sizeof(buf); goto failed;
tuple.TupleOffset = 0;
/* get CIS configuration entry */
tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
cfg = &(parse.cftable_entry);
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
CS_CHECK(ParseTuple, pcmcia_parse_tuple(&tuple, &parse));
if (cfg->flags & CISTPL_CFTABLE_DEFAULT) dflt = *cfg;
if (cfg->index == 0)
goto cs_failed;
link->conf.ConfigIndex = cfg->index;
link->conf.Attributes |= CONF_ENABLE_IRQ;
/* IO window settings */
link->io.NumPorts1 = 0;
if ((cfg->io.nwin > 0) || (dflt.io.nwin > 0)) {
cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt.io;
link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
if (!(io->flags & CISTPL_IO_8BIT))
link->io.Attributes1 = IO_DATA_PATH_WIDTH_16;
if (!(io->flags & CISTPL_IO_16BIT))
link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
link->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK;
link->io.BasePort1 = io->win[0].base;
link->io.NumPorts1 = io->win[0].len;
CS_CHECK(RequestIO, pcmcia_request_io(link, &link->io));
}
link->conf.Attributes = CONF_ENABLE_IRQ; link->conf.Attributes = CONF_ENABLE_IRQ;
link->conf.IntType = INT_MEMORY_AND_IO; link->conf.IntType = INT_MEMORY_AND_IO;
link->conf.ConfigIndex = 8; link->conf.ConfigIndex = 8;
link->conf.Present = PRESENT_OPTION; link->conf.Present = PRESENT_OPTION;
link->irq.Attributes |= IRQ_HANDLE_PRESENT;
link->irq.Handler = mgslpc_isr; link->irq.Handler = mgslpc_isr;
link->irq.Instance = info;
CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); ret = pcmcia_request_irq(link, &link->irq);
if (ret)
goto failed;
ret = pcmcia_request_configuration(link, &link->conf);
if (ret)
goto failed;
info->io_base = link->io.BasePort1; info->io_base = link->io.BasePort1;
info->irq_level = link->irq.AssignedIRQ; info->irq_level = link->irq.AssignedIRQ;
...@@ -654,8 +635,7 @@ static int mgslpc_config(struct pcmcia_device *link) ...@@ -654,8 +635,7 @@ static int mgslpc_config(struct pcmcia_device *link)
printk("\n"); printk("\n");
return 0; return 0;
cs_failed: failed:
cs_error(link, last_fn, last_ret);
mgslpc_release((u_long)link); mgslpc_release((u_long)link);
return -ENODEV; return -ENODEV;
} }
......
...@@ -60,15 +60,6 @@ MODULE_AUTHOR("David Hinds <dahinds@users.sourceforge.net>"); ...@@ -60,15 +60,6 @@ MODULE_AUTHOR("David Hinds <dahinds@users.sourceforge.net>");
MODULE_DESCRIPTION("PCMCIA ATA/IDE card driver"); MODULE_DESCRIPTION("PCMCIA ATA/IDE card driver");
MODULE_LICENSE("Dual MPL/GPL"); MODULE_LICENSE("Dual MPL/GPL");
#define INT_MODULE_PARM(n, v) static int n = v; module_param(n, int, 0)
#ifdef CONFIG_PCMCIA_DEBUG
INT_MODULE_PARM(pc_debug, 0);
#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)
#else
#define DEBUG(n, args...)
#endif
/*====================================================================*/ /*====================================================================*/
typedef struct ide_info_t { typedef struct ide_info_t {
...@@ -98,7 +89,7 @@ static int ide_probe(struct pcmcia_device *link) ...@@ -98,7 +89,7 @@ static int ide_probe(struct pcmcia_device *link)
{ {
ide_info_t *info; ide_info_t *info;
DEBUG(0, "ide_attach()\n"); dev_dbg(&link->dev, "ide_attach()\n");
/* Create new ide device */ /* Create new ide device */
info = kzalloc(sizeof(*info), GFP_KERNEL); info = kzalloc(sizeof(*info), GFP_KERNEL);
...@@ -112,7 +103,6 @@ static int ide_probe(struct pcmcia_device *link) ...@@ -112,7 +103,6 @@ static int ide_probe(struct pcmcia_device *link)
link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; link->io.Attributes2 = IO_DATA_PATH_WIDTH_8;
link->io.IOAddrLines = 3; link->io.IOAddrLines = 3;
link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
link->irq.IRQInfo1 = IRQ_LEVEL_ID;
link->conf.Attributes = CONF_ENABLE_IRQ; link->conf.Attributes = CONF_ENABLE_IRQ;
link->conf.IntType = INT_MEMORY_AND_IO; link->conf.IntType = INT_MEMORY_AND_IO;
...@@ -134,7 +124,7 @@ static void ide_detach(struct pcmcia_device *link) ...@@ -134,7 +124,7 @@ static void ide_detach(struct pcmcia_device *link)
ide_hwif_t *hwif = info->host->ports[0]; ide_hwif_t *hwif = info->host->ports[0];
unsigned long data_addr, ctl_addr; unsigned long data_addr, ctl_addr;
DEBUG(0, "ide_detach(0x%p)\n", link); dev_dbg(&link->dev, "ide_detach(0x%p)\n", link);
data_addr = hwif->io_ports.data_addr; data_addr = hwif->io_ports.data_addr;
ctl_addr = hwif->io_ports.ctl_addr; ctl_addr = hwif->io_ports.ctl_addr;
...@@ -217,9 +207,6 @@ static struct ide_host *idecs_register(unsigned long io, unsigned long ctl, ...@@ -217,9 +207,6 @@ static struct ide_host *idecs_register(unsigned long io, unsigned long ctl,
======================================================================*/ ======================================================================*/
#define CS_CHECK(fn, ret) \
do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
struct pcmcia_config_check { struct pcmcia_config_check {
unsigned long ctl_base; unsigned long ctl_base;
int skip_vcc; int skip_vcc;
...@@ -282,11 +269,11 @@ static int ide_config(struct pcmcia_device *link) ...@@ -282,11 +269,11 @@ static int ide_config(struct pcmcia_device *link)
{ {
ide_info_t *info = link->priv; ide_info_t *info = link->priv;
struct pcmcia_config_check *stk = NULL; struct pcmcia_config_check *stk = NULL;
int last_ret = 0, last_fn = 0, is_kme = 0; int ret = 0, is_kme = 0;
unsigned long io_base, ctl_base; unsigned long io_base, ctl_base;
struct ide_host *host; struct ide_host *host;
DEBUG(0, "ide_config(0x%p)\n", link); dev_dbg(&link->dev, "ide_config(0x%p)\n", link);
is_kme = ((link->manf_id == MANFID_KME) && is_kme = ((link->manf_id == MANFID_KME) &&
((link->card_id == PRODID_KME_KXLC005_A) || ((link->card_id == PRODID_KME_KXLC005_A) ||
...@@ -306,8 +293,12 @@ static int ide_config(struct pcmcia_device *link) ...@@ -306,8 +293,12 @@ static int ide_config(struct pcmcia_device *link)
io_base = link->io.BasePort1; io_base = link->io.BasePort1;
ctl_base = stk->ctl_base; ctl_base = stk->ctl_base;
CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); ret = pcmcia_request_irq(link, &link->irq);
CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); if (ret)
goto failed;
ret = pcmcia_request_configuration(link, &link->conf);
if (ret)
goto failed;
/* disable drive interrupts during IDE probe */ /* disable drive interrupts during IDE probe */
outb(0x02, ctl_base); outb(0x02, ctl_base);
...@@ -342,8 +333,6 @@ static int ide_config(struct pcmcia_device *link) ...@@ -342,8 +333,6 @@ static int ide_config(struct pcmcia_device *link)
printk(KERN_NOTICE "ide-cs: ide_config failed memory allocation\n"); printk(KERN_NOTICE "ide-cs: ide_config failed memory allocation\n");
goto failed; goto failed;
cs_failed:
cs_error(link, last_fn, last_ret);
failed: failed:
kfree(stk); kfree(stk);
ide_release(link); ide_release(link);
...@@ -363,7 +352,7 @@ static void ide_release(struct pcmcia_device *link) ...@@ -363,7 +352,7 @@ static void ide_release(struct pcmcia_device *link)
ide_info_t *info = link->priv; ide_info_t *info = link->priv;
struct ide_host *host = info->host; struct ide_host *host = info->host;
DEBUG(0, "ide_release(0x%p)\n", link); dev_dbg(&link->dev, "ide_release(0x%p)\n", link);
if (info->ndev) if (info->ndev)
/* FIXME: if this fails we need to queue the cleanup somehow /* FIXME: if this fails we need to queue the cleanup somehow
......
...@@ -111,8 +111,6 @@ static int avmcs_probe(struct pcmcia_device *p_dev) ...@@ -111,8 +111,6 @@ static int avmcs_probe(struct pcmcia_device *p_dev)
p_dev->irq.Attributes = IRQ_TYPE_EXCLUSIVE; p_dev->irq.Attributes = IRQ_TYPE_EXCLUSIVE;
p_dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED; p_dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED;
p_dev->irq.IRQInfo1 = IRQ_LEVEL_ID;
/* General socket configuration */ /* General socket configuration */
p_dev->conf.Attributes = CONF_ENABLE_IRQ; p_dev->conf.Attributes = CONF_ENABLE_IRQ;
p_dev->conf.IntType = INT_MEMORY_AND_IO; p_dev->conf.IntType = INT_MEMORY_AND_IO;
...@@ -198,7 +196,6 @@ static int avmcs_config(struct pcmcia_device *link) ...@@ -198,7 +196,6 @@ static int avmcs_config(struct pcmcia_device *link)
*/ */
i = pcmcia_request_irq(link, &link->irq); i = pcmcia_request_irq(link, &link->irq);
if (i != 0) { if (i != 0) {
cs_error(link, RequestIRQ, i);
/* undo */ /* undo */
pcmcia_disable_device(link); pcmcia_disable_device(link);
break; break;
...@@ -209,7 +206,6 @@ static int avmcs_config(struct pcmcia_device *link) ...@@ -209,7 +206,6 @@ static int avmcs_config(struct pcmcia_device *link)
*/ */
i = pcmcia_request_configuration(link, &link->conf); i = pcmcia_request_configuration(link, &link->conf);
if (i != 0) { if (i != 0) {
cs_error(link, RequestConfiguration, i);
pcmcia_disable_device(link); pcmcia_disable_device(link);
break; break;
} }
......
...@@ -30,22 +30,6 @@ MODULE_DESCRIPTION("ISDN4Linux: PCMCIA client driver for AVM A1/Fritz!PCMCIA car ...@@ -30,22 +30,6 @@ MODULE_DESCRIPTION("ISDN4Linux: PCMCIA client driver for AVM A1/Fritz!PCMCIA car
MODULE_AUTHOR("Carsten Paeth"); MODULE_AUTHOR("Carsten Paeth");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
/*
All the PCMCIA modules use PCMCIA_DEBUG to control debugging. If
you do not define PCMCIA_DEBUG at all, all the debug code will be
left out. If you compile with PCMCIA_DEBUG=0, the debug code will
be present but disabled -- but it can then be enabled for specific
modules at load time with a 'pc_debug=#' option to insmod.
*/
#ifdef PCMCIA_DEBUG
static int pc_debug = PCMCIA_DEBUG;
module_param(pc_debug, int, 0);
#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args);
static char *version =
"avma1_cs.c 1.00 1998/01/23 10:00:00 (Carsten Paeth)";
#else
#define DEBUG(n, args...)
#endif
/*====================================================================*/ /*====================================================================*/
...@@ -119,7 +103,7 @@ static int avma1cs_probe(struct pcmcia_device *p_dev) ...@@ -119,7 +103,7 @@ static int avma1cs_probe(struct pcmcia_device *p_dev)
{ {
local_info_t *local; local_info_t *local;
DEBUG(0, "avma1cs_attach()\n"); dev_dbg(&p_dev->dev, "avma1cs_attach()\n");
/* Allocate space for private device-specific data */ /* Allocate space for private device-specific data */
local = kzalloc(sizeof(local_info_t), GFP_KERNEL); local = kzalloc(sizeof(local_info_t), GFP_KERNEL);
...@@ -139,8 +123,6 @@ static int avma1cs_probe(struct pcmcia_device *p_dev) ...@@ -139,8 +123,6 @@ static int avma1cs_probe(struct pcmcia_device *p_dev)
p_dev->irq.Attributes = IRQ_TYPE_EXCLUSIVE; p_dev->irq.Attributes = IRQ_TYPE_EXCLUSIVE;
p_dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED; p_dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED;
p_dev->irq.IRQInfo1 = IRQ_LEVEL_ID;
/* General socket configuration */ /* General socket configuration */
p_dev->conf.Attributes = CONF_ENABLE_IRQ; p_dev->conf.Attributes = CONF_ENABLE_IRQ;
p_dev->conf.IntType = INT_MEMORY_AND_IO; p_dev->conf.IntType = INT_MEMORY_AND_IO;
...@@ -161,7 +143,7 @@ static int avma1cs_probe(struct pcmcia_device *p_dev) ...@@ -161,7 +143,7 @@ static int avma1cs_probe(struct pcmcia_device *p_dev)
static void avma1cs_detach(struct pcmcia_device *link) static void avma1cs_detach(struct pcmcia_device *link)
{ {
DEBUG(0, "avma1cs_detach(0x%p)\n", link); dev_dbg(&link->dev, "avma1cs_detach(0x%p)\n", link);
avma1cs_release(link); avma1cs_release(link);
kfree(link->priv); kfree(link->priv);
} /* avma1cs_detach */ } /* avma1cs_detach */
...@@ -203,7 +185,7 @@ static int avma1cs_config(struct pcmcia_device *link) ...@@ -203,7 +185,7 @@ static int avma1cs_config(struct pcmcia_device *link)
dev = link->priv; dev = link->priv;
DEBUG(0, "avma1cs_config(0x%p)\n", link); dev_dbg(&link->dev, "avma1cs_config(0x%p)\n", link);
devname[0] = 0; devname[0] = 0;
if (link->prod_id[1]) if (link->prod_id[1])
...@@ -218,7 +200,6 @@ static int avma1cs_config(struct pcmcia_device *link) ...@@ -218,7 +200,6 @@ static int avma1cs_config(struct pcmcia_device *link)
*/ */
i = pcmcia_request_irq(link, &link->irq); i = pcmcia_request_irq(link, &link->irq);
if (i != 0) { if (i != 0) {
cs_error(link, RequestIRQ, i);
/* undo */ /* undo */
pcmcia_disable_device(link); pcmcia_disable_device(link);
break; break;
...@@ -229,7 +210,6 @@ static int avma1cs_config(struct pcmcia_device *link) ...@@ -229,7 +210,6 @@ static int avma1cs_config(struct pcmcia_device *link)
*/ */
i = pcmcia_request_configuration(link, &link->conf); i = pcmcia_request_configuration(link, &link->conf);
if (i != 0) { if (i != 0) {
cs_error(link, RequestConfiguration, i);
pcmcia_disable_device(link); pcmcia_disable_device(link);
break; break;
} }
...@@ -281,7 +261,7 @@ static void avma1cs_release(struct pcmcia_device *link) ...@@ -281,7 +261,7 @@ static void avma1cs_release(struct pcmcia_device *link)
{ {
local_info_t *local = link->priv; local_info_t *local = link->priv;
DEBUG(0, "avma1cs_release(0x%p)\n", link); dev_dbg(&link->dev, "avma1cs_release(0x%p)\n", link);
/* now unregister function with hisax */ /* now unregister function with hisax */
HiSax_closecard(local->node.minor); HiSax_closecard(local->node.minor);
......
...@@ -57,23 +57,6 @@ MODULE_DESCRIPTION("ISDN4Linux: PCMCIA client driver for Elsa PCM cards"); ...@@ -57,23 +57,6 @@ MODULE_DESCRIPTION("ISDN4Linux: PCMCIA client driver for Elsa PCM cards");
MODULE_AUTHOR("Klaus Lichtenwalder"); MODULE_AUTHOR("Klaus Lichtenwalder");
MODULE_LICENSE("Dual MPL/GPL"); MODULE_LICENSE("Dual MPL/GPL");
/*
All the PCMCIA modules use PCMCIA_DEBUG to control debugging. If
you do not define PCMCIA_DEBUG at all, all the debug code will be
left out. If you compile with PCMCIA_DEBUG=0, the debug code will
be present but disabled -- but it can then be enabled for specific
modules at load time with a 'pc_debug=#' option to insmod.
*/
#ifdef PCMCIA_DEBUG
static int pc_debug = PCMCIA_DEBUG;
module_param(pc_debug, int, 0);
#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args);
static char *version =
"elsa_cs.c $Revision: 1.2.2.4 $ $Date: 2004/01/25 15:07:06 $ (K.Lichtenwalder)";
#else
#define DEBUG(n, args...)
#endif
/*====================================================================*/ /*====================================================================*/
...@@ -142,7 +125,7 @@ static int elsa_cs_probe(struct pcmcia_device *link) ...@@ -142,7 +125,7 @@ static int elsa_cs_probe(struct pcmcia_device *link)
{ {
local_info_t *local; local_info_t *local;
DEBUG(0, "elsa_cs_attach()\n"); dev_dbg(&link->dev, "elsa_cs_attach()\n");
/* Allocate space for private device-specific data */ /* Allocate space for private device-specific data */
local = kzalloc(sizeof(local_info_t), GFP_KERNEL); local = kzalloc(sizeof(local_info_t), GFP_KERNEL);
...@@ -155,7 +138,6 @@ static int elsa_cs_probe(struct pcmcia_device *link) ...@@ -155,7 +138,6 @@ static int elsa_cs_probe(struct pcmcia_device *link)
/* Interrupt setup */ /* Interrupt setup */
link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED; link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED;
link->irq.IRQInfo1 = IRQ_LEVEL_ID|IRQ_SHARE_ID;
link->irq.Handler = NULL; link->irq.Handler = NULL;
/* /*
...@@ -188,7 +170,7 @@ static void elsa_cs_detach(struct pcmcia_device *link) ...@@ -188,7 +170,7 @@ static void elsa_cs_detach(struct pcmcia_device *link)
{ {
local_info_t *info = link->priv; local_info_t *info = link->priv;
DEBUG(0, "elsa_cs_detach(0x%p)\n", link); dev_dbg(&link->dev, "elsa_cs_detach(0x%p)\n", link);
info->busy = 1; info->busy = 1;
elsa_cs_release(link); elsa_cs_release(link);
...@@ -231,30 +213,25 @@ static int elsa_cs_configcheck(struct pcmcia_device *p_dev, ...@@ -231,30 +213,25 @@ static int elsa_cs_configcheck(struct pcmcia_device *p_dev,
static int elsa_cs_config(struct pcmcia_device *link) static int elsa_cs_config(struct pcmcia_device *link)
{ {
local_info_t *dev; local_info_t *dev;
int i, last_fn; int i;
IsdnCard_t icard; IsdnCard_t icard;
DEBUG(0, "elsa_config(0x%p)\n", link); dev_dbg(&link->dev, "elsa_config(0x%p)\n", link);
dev = link->priv; dev = link->priv;
i = pcmcia_loop_config(link, elsa_cs_configcheck, NULL); i = pcmcia_loop_config(link, elsa_cs_configcheck, NULL);
if (i != 0) { if (i != 0)
last_fn = RequestIO; goto failed;
goto cs_failed;
}
i = pcmcia_request_irq(link, &link->irq); i = pcmcia_request_irq(link, &link->irq);
if (i != 0) { if (i != 0) {
link->irq.AssignedIRQ = 0; link->irq.AssignedIRQ = 0;
last_fn = RequestIRQ; goto failed;
goto cs_failed;
} }
i = pcmcia_request_configuration(link, &link->conf); i = pcmcia_request_configuration(link, &link->conf);
if (i != 0) { if (i != 0)
last_fn = RequestConfiguration; goto failed;
goto cs_failed;
}
/* At this point, the dev_node_t structure(s) should be /* At this point, the dev_node_t structure(s) should be
initialized and arranged in a linked list at link->dev. *//* */ initialized and arranged in a linked list at link->dev. *//* */
...@@ -290,8 +267,7 @@ static int elsa_cs_config(struct pcmcia_device *link) ...@@ -290,8 +267,7 @@ static int elsa_cs_config(struct pcmcia_device *link)
((local_info_t*)link->priv)->cardnr = i; ((local_info_t*)link->priv)->cardnr = i;
return 0; return 0;
cs_failed: failed:
cs_error(link, last_fn, i);
elsa_cs_release(link); elsa_cs_release(link);
return -ENODEV; return -ENODEV;
} /* elsa_cs_config */ } /* elsa_cs_config */
...@@ -308,7 +284,7 @@ static void elsa_cs_release(struct pcmcia_device *link) ...@@ -308,7 +284,7 @@ static void elsa_cs_release(struct pcmcia_device *link)
{ {
local_info_t *local = link->priv; local_info_t *local = link->priv;
DEBUG(0, "elsa_cs_release(0x%p)\n", link); dev_dbg(&link->dev, "elsa_cs_release(0x%p)\n", link);
if (local) { if (local) {
if (local->cardnr >= 0) { if (local->cardnr >= 0) {
......
...@@ -57,24 +57,6 @@ MODULE_DESCRIPTION("ISDN4Linux: PCMCIA client driver for Sedlbauer cards"); ...@@ -57,24 +57,6 @@ MODULE_DESCRIPTION("ISDN4Linux: PCMCIA client driver for Sedlbauer cards");
MODULE_AUTHOR("Marcus Niemann"); MODULE_AUTHOR("Marcus Niemann");
MODULE_LICENSE("Dual MPL/GPL"); MODULE_LICENSE("Dual MPL/GPL");
/*
All the PCMCIA modules use PCMCIA_DEBUG to control debugging. If
you do not define PCMCIA_DEBUG at all, all the debug code will be
left out. If you compile with PCMCIA_DEBUG=0, the debug code will
be present but disabled -- but it can then be enabled for specific
modules at load time with a 'pc_debug=#' option to insmod.
*/
#ifdef PCMCIA_DEBUG
static int pc_debug = PCMCIA_DEBUG;
module_param(pc_debug, int, 0);
#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args);
static char *version =
"sedlbauer_cs.c 1.1a 2001/01/28 15:04:04 (M.Niemann)";
#else
#define DEBUG(n, args...)
#endif
/*====================================================================*/ /*====================================================================*/
...@@ -151,7 +133,7 @@ static int sedlbauer_probe(struct pcmcia_device *link) ...@@ -151,7 +133,7 @@ static int sedlbauer_probe(struct pcmcia_device *link)
{ {
local_info_t *local; local_info_t *local;
DEBUG(0, "sedlbauer_attach()\n"); dev_dbg(&link->dev, "sedlbauer_attach()\n");
/* Allocate space for private device-specific data */ /* Allocate space for private device-specific data */
local = kzalloc(sizeof(local_info_t), GFP_KERNEL); local = kzalloc(sizeof(local_info_t), GFP_KERNEL);
...@@ -163,7 +145,6 @@ static int sedlbauer_probe(struct pcmcia_device *link) ...@@ -163,7 +145,6 @@ static int sedlbauer_probe(struct pcmcia_device *link)
/* Interrupt setup */ /* Interrupt setup */
link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED; link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED;
link->irq.IRQInfo1 = IRQ_LEVEL_ID;
link->irq.Handler = NULL; link->irq.Handler = NULL;
/* /*
...@@ -198,7 +179,7 @@ static int sedlbauer_probe(struct pcmcia_device *link) ...@@ -198,7 +179,7 @@ static int sedlbauer_probe(struct pcmcia_device *link)
static void sedlbauer_detach(struct pcmcia_device *link) static void sedlbauer_detach(struct pcmcia_device *link)
{ {
DEBUG(0, "sedlbauer_detach(0x%p)\n", link); dev_dbg(&link->dev, "sedlbauer_detach(0x%p)\n", link);
((local_info_t *)link->priv)->stop = 1; ((local_info_t *)link->priv)->stop = 1;
sedlbauer_release(link); sedlbauer_release(link);
...@@ -214,9 +195,6 @@ static void sedlbauer_detach(struct pcmcia_device *link) ...@@ -214,9 +195,6 @@ static void sedlbauer_detach(struct pcmcia_device *link)
device available to the system. device available to the system.
======================================================================*/ ======================================================================*/
#define CS_CHECK(fn, ret) \
do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
static int sedlbauer_config_check(struct pcmcia_device *p_dev, static int sedlbauer_config_check(struct pcmcia_device *p_dev,
cistpl_cftable_entry_t *cfg, cistpl_cftable_entry_t *cfg,
cistpl_cftable_entry_t *dflt, cistpl_cftable_entry_t *dflt,
...@@ -293,11 +271,11 @@ static int sedlbauer_config_check(struct pcmcia_device *p_dev, ...@@ -293,11 +271,11 @@ static int sedlbauer_config_check(struct pcmcia_device *p_dev,
req->Base = mem->win[0].host_addr; req->Base = mem->win[0].host_addr;
req->Size = mem->win[0].len; req->Size = mem->win[0].len;
req->AccessSpeed = 0; req->AccessSpeed = 0;
if (pcmcia_request_window(&p_dev, req, &p_dev->win) != 0) if (pcmcia_request_window(p_dev, req, &p_dev->win) != 0)
return -ENODEV; return -ENODEV;
map.Page = 0; map.Page = 0;
map.CardOffset = mem->win[0].card_addr; map.CardOffset = mem->win[0].card_addr;
if (pcmcia_map_mem_page(p_dev->win, &map) != 0) if (pcmcia_map_mem_page(p_dev, p_dev->win, &map) != 0)
return -ENODEV; return -ENODEV;
} }
return 0; return 0;
...@@ -309,10 +287,10 @@ static int sedlbauer_config(struct pcmcia_device *link) ...@@ -309,10 +287,10 @@ static int sedlbauer_config(struct pcmcia_device *link)
{ {
local_info_t *dev = link->priv; local_info_t *dev = link->priv;
win_req_t *req; win_req_t *req;
int last_fn, last_ret; int ret;
IsdnCard_t icard; IsdnCard_t icard;
DEBUG(0, "sedlbauer_config(0x%p)\n", link); dev_dbg(&link->dev, "sedlbauer_config(0x%p)\n", link);
req = kzalloc(sizeof(win_req_t), GFP_KERNEL); req = kzalloc(sizeof(win_req_t), GFP_KERNEL);
if (!req) if (!req)
...@@ -330,8 +308,8 @@ static int sedlbauer_config(struct pcmcia_device *link) ...@@ -330,8 +308,8 @@ static int sedlbauer_config(struct pcmcia_device *link)
these things without consulting the CIS, and most client drivers these things without consulting the CIS, and most client drivers
will only use the CIS to fill in implementation-defined details. will only use the CIS to fill in implementation-defined details.
*/ */
last_ret = pcmcia_loop_config(link, sedlbauer_config_check, req); ret = pcmcia_loop_config(link, sedlbauer_config_check, req);
if (last_ret) if (ret)
goto failed; goto failed;
/* /*
...@@ -339,15 +317,20 @@ static int sedlbauer_config(struct pcmcia_device *link) ...@@ -339,15 +317,20 @@ static int sedlbauer_config(struct pcmcia_device *link)
handler to the interrupt, unless the 'Handler' member of the handler to the interrupt, unless the 'Handler' member of the
irq structure is initialized. irq structure is initialized.
*/ */
if (link->conf.Attributes & CONF_ENABLE_IRQ) if (link->conf.Attributes & CONF_ENABLE_IRQ) {
CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); ret = pcmcia_request_irq(link, &link->irq);
if (ret)
goto failed;
}
/* /*
This actually configures the PCMCIA socket -- setting up This actually configures the PCMCIA socket -- setting up
the I/O windows and the interrupt mapping, and putting the the I/O windows and the interrupt mapping, and putting the
card and host interface into "Memory and IO" mode. card and host interface into "Memory and IO" mode.
*/ */
CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); ret = pcmcia_request_configuration(link, &link->conf);
if (ret)
goto failed;
/* /*
At this point, the dev_node_t structure(s) need to be At this point, the dev_node_t structure(s) need to be
...@@ -380,19 +363,18 @@ static int sedlbauer_config(struct pcmcia_device *link) ...@@ -380,19 +363,18 @@ static int sedlbauer_config(struct pcmcia_device *link)
icard.protocol = protocol; icard.protocol = protocol;
icard.typ = ISDN_CTYPE_SEDLBAUER_PCMCIA; icard.typ = ISDN_CTYPE_SEDLBAUER_PCMCIA;
last_ret = hisax_init_pcmcia(link, &(((local_info_t*)link->priv)->stop), &icard); ret = hisax_init_pcmcia(link,
if (last_ret < 0) { &(((local_info_t *)link->priv)->stop), &icard);
if (ret < 0) {
printk(KERN_ERR "sedlbauer_cs: failed to initialize SEDLBAUER PCMCIA %d at i/o %#x\n", printk(KERN_ERR "sedlbauer_cs: failed to initialize SEDLBAUER PCMCIA %d at i/o %#x\n",
last_ret, link->io.BasePort1); ret, link->io.BasePort1);
sedlbauer_release(link); sedlbauer_release(link);
return -ENODEV; return -ENODEV;
} else } else
((local_info_t*)link->priv)->cardnr = last_ret; ((local_info_t *)link->priv)->cardnr = ret;
return 0; return 0;
cs_failed:
cs_error(link, last_fn, last_ret);
failed: failed:
sedlbauer_release(link); sedlbauer_release(link);
return -ENODEV; return -ENODEV;
...@@ -410,7 +392,7 @@ static int sedlbauer_config(struct pcmcia_device *link) ...@@ -410,7 +392,7 @@ static int sedlbauer_config(struct pcmcia_device *link)
static void sedlbauer_release(struct pcmcia_device *link) static void sedlbauer_release(struct pcmcia_device *link)
{ {
local_info_t *local = link->priv; local_info_t *local = link->priv;
DEBUG(0, "sedlbauer_release(0x%p)\n", link); dev_dbg(&link->dev, "sedlbauer_release(0x%p)\n", link);
if (local) { if (local) {
if (local->cardnr >= 0) { if (local->cardnr >= 0) {
......
...@@ -38,23 +38,6 @@ MODULE_DESCRIPTION("ISDN4Linux: PCMCIA client driver for Teles PCMCIA cards"); ...@@ -38,23 +38,6 @@ MODULE_DESCRIPTION("ISDN4Linux: PCMCIA client driver for Teles PCMCIA cards");
MODULE_AUTHOR("Christof Petig, christof.petig@wtal.de, Karsten Keil, kkeil@suse.de"); MODULE_AUTHOR("Christof Petig, christof.petig@wtal.de, Karsten Keil, kkeil@suse.de");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
/*
All the PCMCIA modules use PCMCIA_DEBUG to control debugging. If
you do not define PCMCIA_DEBUG at all, all the debug code will be
left out. If you compile with PCMCIA_DEBUG=0, the debug code will
be present but disabled -- but it can then be enabled for specific
modules at load time with a 'pc_debug=#' option to insmod.
*/
#ifdef PCMCIA_DEBUG
static int pc_debug = PCMCIA_DEBUG;
module_param(pc_debug, int, 0);
#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args);
static char *version =
"teles_cs.c 2.10 2002/07/30 22:23:34 kkeil";
#else
#define DEBUG(n, args...)
#endif
/*====================================================================*/ /*====================================================================*/
...@@ -133,7 +116,7 @@ static int teles_probe(struct pcmcia_device *link) ...@@ -133,7 +116,7 @@ static int teles_probe(struct pcmcia_device *link)
{ {
local_info_t *local; local_info_t *local;
DEBUG(0, "teles_attach()\n"); dev_dbg(&link->dev, "teles_attach()\n");
/* Allocate space for private device-specific data */ /* Allocate space for private device-specific data */
local = kzalloc(sizeof(local_info_t), GFP_KERNEL); local = kzalloc(sizeof(local_info_t), GFP_KERNEL);
...@@ -145,7 +128,6 @@ static int teles_probe(struct pcmcia_device *link) ...@@ -145,7 +128,6 @@ static int teles_probe(struct pcmcia_device *link)
/* Interrupt setup */ /* Interrupt setup */
link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED; link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED;
link->irq.IRQInfo1 = IRQ_LEVEL_ID|IRQ_SHARE_ID;
link->irq.Handler = NULL; link->irq.Handler = NULL;
/* /*
...@@ -178,7 +160,7 @@ static void teles_detach(struct pcmcia_device *link) ...@@ -178,7 +160,7 @@ static void teles_detach(struct pcmcia_device *link)
{ {
local_info_t *info = link->priv; local_info_t *info = link->priv;
DEBUG(0, "teles_detach(0x%p)\n", link); dev_dbg(&link->dev, "teles_detach(0x%p)\n", link);
info->busy = 1; info->busy = 1;
teles_cs_release(link); teles_cs_release(link);
...@@ -221,30 +203,25 @@ static int teles_cs_configcheck(struct pcmcia_device *p_dev, ...@@ -221,30 +203,25 @@ static int teles_cs_configcheck(struct pcmcia_device *p_dev,
static int teles_cs_config(struct pcmcia_device *link) static int teles_cs_config(struct pcmcia_device *link)
{ {
local_info_t *dev; local_info_t *dev;
int i, last_fn; int i;
IsdnCard_t icard; IsdnCard_t icard;
DEBUG(0, "teles_config(0x%p)\n", link); dev_dbg(&link->dev, "teles_config(0x%p)\n", link);
dev = link->priv; dev = link->priv;
i = pcmcia_loop_config(link, teles_cs_configcheck, NULL); i = pcmcia_loop_config(link, teles_cs_configcheck, NULL);
if (i != 0) { if (i != 0)
last_fn = RequestIO;
goto cs_failed; goto cs_failed;
}
i = pcmcia_request_irq(link, &link->irq); i = pcmcia_request_irq(link, &link->irq);
if (i != 0) { if (i != 0) {
link->irq.AssignedIRQ = 0; link->irq.AssignedIRQ = 0;
last_fn = RequestIRQ;
goto cs_failed; goto cs_failed;
} }
i = pcmcia_request_configuration(link, &link->conf); i = pcmcia_request_configuration(link, &link->conf);
if (i != 0) { if (i != 0)
last_fn = RequestConfiguration;
goto cs_failed; goto cs_failed;
}
/* At this point, the dev_node_t structure(s) should be /* At this point, the dev_node_t structure(s) should be
initialized and arranged in a linked list at link->dev. *//* */ initialized and arranged in a linked list at link->dev. *//* */
...@@ -283,7 +260,6 @@ static int teles_cs_config(struct pcmcia_device *link) ...@@ -283,7 +260,6 @@ static int teles_cs_config(struct pcmcia_device *link)
return 0; return 0;
cs_failed: cs_failed:
cs_error(link, last_fn, i);
teles_cs_release(link); teles_cs_release(link);
return -ENODEV; return -ENODEV;
} /* teles_cs_config */ } /* teles_cs_config */
...@@ -300,7 +276,7 @@ static void teles_cs_release(struct pcmcia_device *link) ...@@ -300,7 +276,7 @@ static void teles_cs_release(struct pcmcia_device *link)
{ {
local_info_t *local = link->priv; local_info_t *local = link->priv;
DEBUG(0, "teles_cs_release(0x%p)\n", link); dev_dbg(&link->dev, "teles_cs_release(0x%p)\n", link);
if (local) { if (local) {
if (local->cardnr >= 0) { if (local->cardnr >= 0) {
......
...@@ -118,11 +118,9 @@ static caddr_t remap_window(struct map_info *map, unsigned long to) ...@@ -118,11 +118,9 @@ static caddr_t remap_window(struct map_info *map, unsigned long to)
DEBUG(2, "Remapping window from 0x%8.8x to 0x%8.8x", DEBUG(2, "Remapping window from 0x%8.8x to 0x%8.8x",
dev->offset, mrq.CardOffset); dev->offset, mrq.CardOffset);
mrq.Page = 0; mrq.Page = 0;
ret = pcmcia_map_mem_page(win, &mrq); ret = pcmcia_map_mem_page(dev->p_dev, win, &mrq);
if (ret != 0) { if (ret != 0)
cs_error(dev->p_dev, MapMemPage, ret);
return NULL; return NULL;
}
dev->offset = mrq.CardOffset; dev->offset = mrq.CardOffset;
} }
return dev->win_base + (to & (dev->win_size-1)); return dev->win_base + (to & (dev->win_size-1));
...@@ -327,8 +325,6 @@ static void pcmciamtd_set_vpp(struct map_info *map, int on) ...@@ -327,8 +325,6 @@ static void pcmciamtd_set_vpp(struct map_info *map, int on)
DEBUG(2, "dev = %p on = %d vpp = %d\n", dev, on, dev->vpp); DEBUG(2, "dev = %p on = %d vpp = %d\n", dev, on, dev->vpp);
ret = pcmcia_modify_configuration(link, &mod); ret = pcmcia_modify_configuration(link, &mod);
if (ret != 0)
cs_error(link, ModifyConfiguration, ret);
} }
...@@ -348,91 +344,83 @@ static void pcmciamtd_release(struct pcmcia_device *link) ...@@ -348,91 +344,83 @@ static void pcmciamtd_release(struct pcmcia_device *link)
iounmap(dev->win_base); iounmap(dev->win_base);
dev->win_base = NULL; dev->win_base = NULL;
} }
pcmcia_release_window(link->win); pcmcia_release_window(link, link->win);
} }
pcmcia_disable_device(link); pcmcia_disable_device(link);
} }
static void card_settings(struct pcmciamtd_dev *dev, struct pcmcia_device *link, int *new_name) #ifdef CONFIG_MTD_DEBUG
static int pcmciamtd_cistpl_format(struct pcmcia_device *p_dev,
tuple_t *tuple,
void *priv_data)
{ {
int rc;
tuple_t tuple;
cisparse_t parse; cisparse_t parse;
u_char buf[64];
tuple.Attributes = 0;
tuple.TupleData = (cisdata_t *)buf;
tuple.TupleDataMax = sizeof(buf);
tuple.TupleOffset = 0;
tuple.DesiredTuple = RETURN_FIRST_TUPLE;
rc = pcmcia_get_first_tuple(link, &tuple);
while (rc == 0) {
rc = pcmcia_get_tuple_data(link, &tuple);
if (rc != 0) {
cs_error(link, GetTupleData, rc);
break;
}
rc = pcmcia_parse_tuple(&tuple, &parse);
if (rc != 0) {
cs_error(link, ParseTuple, rc);
break;
}
switch(tuple.TupleCode) { if (!pcmcia_parse_tuple(tuple, &parse)) {
case CISTPL_FORMAT: {
cistpl_format_t *t = &parse.format; cistpl_format_t *t = &parse.format;
(void)t; /* Shut up, gcc */ (void)t; /* Shut up, gcc */
DEBUG(2, "Format type: %u, Error Detection: %u, offset = %u, length =%u", DEBUG(2, "Format type: %u, Error Detection: %u, offset = %u, length =%u",
t->type, t->edc, t->offset, t->length); t->type, t->edc, t->offset, t->length);
break; }
return -ENOSPC;
}
static int pcmciamtd_cistpl_jedec(struct pcmcia_device *p_dev,
tuple_t *tuple,
void *priv_data)
{
cisparse_t parse;
int i;
if (!pcmcia_parse_tuple(tuple, &parse)) {
cistpl_jedec_t *t = &parse.jedec;
for (i = 0; i < t->nid; i++)
DEBUG(2, "JEDEC: 0x%02x 0x%02x", t->id[i].mfr, t->id[i].info);
} }
return -ENOSPC;
}
#endif
case CISTPL_DEVICE: { static int pcmciamtd_cistpl_device(struct pcmcia_device *p_dev,
tuple_t *tuple,
void *priv_data)
{
struct pcmciamtd_dev *dev = priv_data;
cisparse_t parse;
cistpl_device_t *t = &parse.device; cistpl_device_t *t = &parse.device;
int i; int i;
if (pcmcia_parse_tuple(tuple, &parse))
return -EINVAL;
DEBUG(2, "Common memory:"); DEBUG(2, "Common memory:");
dev->pcmcia_map.size = t->dev[0].size; dev->pcmcia_map.size = t->dev[0].size;
for(i = 0; i < t->ndev; i++) { /* from here on: DEBUG only */
for (i = 0; i < t->ndev; i++) {
DEBUG(2, "Region %d, type = %u", i, t->dev[i].type); DEBUG(2, "Region %d, type = %u", i, t->dev[i].type);
DEBUG(2, "Region %d, wp = %u", i, t->dev[i].wp); DEBUG(2, "Region %d, wp = %u", i, t->dev[i].wp);
DEBUG(2, "Region %d, speed = %u ns", i, t->dev[i].speed); DEBUG(2, "Region %d, speed = %u ns", i, t->dev[i].speed);
DEBUG(2, "Region %d, size = %u bytes", i, t->dev[i].size); DEBUG(2, "Region %d, size = %u bytes", i, t->dev[i].size);
} }
break; return 0;
} }
case CISTPL_VERS_1: { static int pcmciamtd_cistpl_geo(struct pcmcia_device *p_dev,
cistpl_vers_1_t *t = &parse.version_1; tuple_t *tuple,
void *priv_data)
{
struct pcmciamtd_dev *dev = priv_data;
cisparse_t parse;
cistpl_device_geo_t *t = &parse.device_geo;
int i; int i;
if(t->ns) {
dev->mtd_name[0] = '\0';
for(i = 0; i < t->ns; i++) {
if(i)
strcat(dev->mtd_name, " ");
strcat(dev->mtd_name, t->str+t->ofs[i]);
}
}
DEBUG(2, "Found name: %s", dev->mtd_name);
break;
}
case CISTPL_JEDEC_C: { if (pcmcia_parse_tuple(tuple, &parse))
cistpl_jedec_t *t = &parse.jedec; return -EINVAL;
int i;
for(i = 0; i < t->nid; i++) {
DEBUG(2, "JEDEC: 0x%02x 0x%02x", t->id[i].mfr, t->id[i].info);
}
break;
}
case CISTPL_DEVICE_GEO: {
cistpl_device_geo_t *t = &parse.device_geo;
int i;
dev->pcmcia_map.bankwidth = t->geo[0].buswidth; dev->pcmcia_map.bankwidth = t->geo[0].buswidth;
for(i = 0; i < t->ngeo; i++) { /* from here on: DEBUG only */
for (i = 0; i < t->ngeo; i++) {
DEBUG(2, "region: %d bankwidth = %u", i, t->geo[i].buswidth); DEBUG(2, "region: %d bankwidth = %u", i, t->geo[i].buswidth);
DEBUG(2, "region: %d erase_block = %u", i, t->geo[i].erase_block); DEBUG(2, "region: %d erase_block = %u", i, t->geo[i].erase_block);
DEBUG(2, "region: %d read_block = %u", i, t->geo[i].read_block); DEBUG(2, "region: %d read_block = %u", i, t->geo[i].read_block);
...@@ -440,15 +428,32 @@ static void card_settings(struct pcmciamtd_dev *dev, struct pcmcia_device *link, ...@@ -440,15 +428,32 @@ static void card_settings(struct pcmciamtd_dev *dev, struct pcmcia_device *link,
DEBUG(2, "region: %d partition = %u", i, t->geo[i].partition); DEBUG(2, "region: %d partition = %u", i, t->geo[i].partition);
DEBUG(2, "region: %d interleave = %u", i, t->geo[i].interleave); DEBUG(2, "region: %d interleave = %u", i, t->geo[i].interleave);
} }
break; return 0;
} }
default:
DEBUG(2, "Unknown tuple code %d", tuple.TupleCode);
}
rc = pcmcia_get_next_tuple(link, &tuple); static void card_settings(struct pcmciamtd_dev *dev, struct pcmcia_device *link, int *new_name)
{
int i;
if (p_dev->prod_id[0]) {
dev->mtd_name[0] = '\0';
for (i = 0; i < 4; i++) {
if (i)
strcat(dev->mtd_name, " ");
if (p_dev->prod_id[i])
strcat(dev->mtd_name, p_dev->prod_id[i]);
}
DEBUG(2, "Found name: %s", dev->mtd_name);
} }
#ifdef CONFIG_MTD_DEBUG
pcmcia_loop_tuple(p_dev, CISTPL_FORMAT, pcmciamtd_cistpl_format, NULL);
pcmcia_loop_tuple(p_dev, CISTPL_JEDEC_C, pcmciamtd_cistpl_jedec, NULL);
#endif
pcmcia_loop_tuple(p_dev, CISTPL_DEVICE, pcmciamtd_cistpl_device, dev);
pcmcia_loop_tuple(p_dev, CISTPL_DEVICE_GEO, pcmciamtd_cistpl_geo, dev);
if(!dev->pcmcia_map.size) if(!dev->pcmcia_map.size)
dev->pcmcia_map.size = MAX_PCMCIA_ADDR; dev->pcmcia_map.size = MAX_PCMCIA_ADDR;
...@@ -481,16 +486,12 @@ static void card_settings(struct pcmciamtd_dev *dev, struct pcmcia_device *link, ...@@ -481,16 +486,12 @@ static void card_settings(struct pcmciamtd_dev *dev, struct pcmcia_device *link,
* MTD device available to the system. * MTD device available to the system.
*/ */
#define CS_CHECK(fn, ret) \
do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
static int pcmciamtd_config(struct pcmcia_device *link) static int pcmciamtd_config(struct pcmcia_device *link)
{ {
struct pcmciamtd_dev *dev = link->priv; struct pcmciamtd_dev *dev = link->priv;
struct mtd_info *mtd = NULL; struct mtd_info *mtd = NULL;
cs_status_t status; cs_status_t status;
win_req_t req; win_req_t req;
int last_ret = 0, last_fn = 0;
int ret; int ret;
int i; int i;
static char *probes[] = { "jedec_probe", "cfi_probe" }; static char *probes[] = { "jedec_probe", "cfi_probe" };
...@@ -529,7 +530,7 @@ static int pcmciamtd_config(struct pcmcia_device *link) ...@@ -529,7 +530,7 @@ static int pcmciamtd_config(struct pcmcia_device *link)
int ret; int ret;
DEBUG(2, "requesting window with size = %dKiB memspeed = %d", DEBUG(2, "requesting window with size = %dKiB memspeed = %d",
req.Size >> 10, req.AccessSpeed); req.Size >> 10, req.AccessSpeed);
ret = pcmcia_request_window(&link, &req, &link->win); ret = pcmcia_request_window(link, &req, &link->win);
DEBUG(2, "ret = %d dev->win_size = %d", ret, dev->win_size); DEBUG(2, "ret = %d dev->win_size = %d", ret, dev->win_size);
if(ret) { if(ret) {
req.Size >>= 1; req.Size >>= 1;
...@@ -577,7 +578,6 @@ static int pcmciamtd_config(struct pcmcia_device *link) ...@@ -577,7 +578,6 @@ static int pcmciamtd_config(struct pcmcia_device *link)
DEBUG(2, "Setting Configuration"); DEBUG(2, "Setting Configuration");
ret = pcmcia_request_configuration(link, &link->conf); ret = pcmcia_request_configuration(link, &link->conf);
if (ret != 0) { if (ret != 0) {
cs_error(link, RequestConfiguration, ret);
if (dev->win_base) { if (dev->win_base) {
iounmap(dev->win_base); iounmap(dev->win_base);
dev->win_base = NULL; dev->win_base = NULL;
...@@ -652,8 +652,7 @@ static int pcmciamtd_config(struct pcmcia_device *link) ...@@ -652,8 +652,7 @@ static int pcmciamtd_config(struct pcmcia_device *link)
link->dev_node = &dev->node; link->dev_node = &dev->node;
return 0; return 0;
cs_failed: failed:
cs_error(link, last_fn, last_ret);
err("CS Error, exiting"); err("CS Error, exiting");
pcmciamtd_release(link); pcmciamtd_release(link);
return -ENODEV; return -ENODEV;
......
...@@ -118,14 +118,6 @@ INT_MODULE_PARM(full_duplex, 0); ...@@ -118,14 +118,6 @@ INT_MODULE_PARM(full_duplex, 0);
/* Autodetect link polarity reversal? */ /* Autodetect link polarity reversal? */
INT_MODULE_PARM(auto_polarity, 1); INT_MODULE_PARM(auto_polarity, 1);
#ifdef PCMCIA_DEBUG
INT_MODULE_PARM(pc_debug, PCMCIA_DEBUG);
#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)
static char *version =
"3c574_cs.c 1.65ac1 2003/04/07 Donald Becker/David Hinds, becker@scyld.com.\n";
#else
#define DEBUG(n, args...)
#endif
/*====================================================================*/ /*====================================================================*/
...@@ -278,7 +270,7 @@ static int tc574_probe(struct pcmcia_device *link) ...@@ -278,7 +270,7 @@ static int tc574_probe(struct pcmcia_device *link)
struct el3_private *lp; struct el3_private *lp;
struct net_device *dev; struct net_device *dev;
DEBUG(0, "3c574_attach()\n"); dev_dbg(&link->dev, "3c574_attach()\n");
/* Create the PC card device object. */ /* Create the PC card device object. */
dev = alloc_etherdev(sizeof(struct el3_private)); dev = alloc_etherdev(sizeof(struct el3_private));
...@@ -291,10 +283,8 @@ static int tc574_probe(struct pcmcia_device *link) ...@@ -291,10 +283,8 @@ static int tc574_probe(struct pcmcia_device *link)
spin_lock_init(&lp->window_lock); spin_lock_init(&lp->window_lock);
link->io.NumPorts1 = 32; link->io.NumPorts1 = 32;
link->io.Attributes1 = IO_DATA_PATH_WIDTH_16; link->io.Attributes1 = IO_DATA_PATH_WIDTH_16;
link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_HANDLE_PRESENT; link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
link->irq.IRQInfo1 = IRQ_LEVEL_ID;
link->irq.Handler = &el3_interrupt; link->irq.Handler = &el3_interrupt;
link->irq.Instance = dev;
link->conf.Attributes = CONF_ENABLE_IRQ; link->conf.Attributes = CONF_ENABLE_IRQ;
link->conf.IntType = INT_MEMORY_AND_IO; link->conf.IntType = INT_MEMORY_AND_IO;
link->conf.ConfigIndex = 1; link->conf.ConfigIndex = 1;
...@@ -319,7 +309,7 @@ static void tc574_detach(struct pcmcia_device *link) ...@@ -319,7 +309,7 @@ static void tc574_detach(struct pcmcia_device *link)
{ {
struct net_device *dev = link->priv; struct net_device *dev = link->priv;
DEBUG(0, "3c574_detach(0x%p)\n", link); dev_dbg(&link->dev, "3c574_detach()\n");
if (link->dev_node) if (link->dev_node)
unregister_netdev(dev); unregister_netdev(dev);
...@@ -335,26 +325,23 @@ static void tc574_detach(struct pcmcia_device *link) ...@@ -335,26 +325,23 @@ static void tc574_detach(struct pcmcia_device *link)
ethernet device available to the system. ethernet device available to the system.
*/ */
#define CS_CHECK(fn, ret) \
do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
static const char *ram_split[] = {"5:3", "3:1", "1:1", "3:5"}; static const char *ram_split[] = {"5:3", "3:1", "1:1", "3:5"};
static int tc574_config(struct pcmcia_device *link) static int tc574_config(struct pcmcia_device *link)
{ {
struct net_device *dev = link->priv; struct net_device *dev = link->priv;
struct el3_private *lp = netdev_priv(dev); struct el3_private *lp = netdev_priv(dev);
tuple_t tuple; int ret, i, j;
__le16 buf[32];
int last_fn, last_ret, i, j;
unsigned int ioaddr; unsigned int ioaddr;
__be16 *phys_addr; __be16 *phys_addr;
char *cardname; char *cardname;
__u32 config; __u32 config;
u8 *buf;
size_t len;
phys_addr = (__be16 *)dev->dev_addr; phys_addr = (__be16 *)dev->dev_addr;
DEBUG(0, "3c574_config(0x%p)\n", link); dev_dbg(&link->dev, "3c574_config()\n");
link->io.IOAddrLines = 16; link->io.IOAddrLines = 16;
for (i = j = 0; j < 0x400; j += 0x20) { for (i = j = 0; j < 0x400; j += 0x20) {
...@@ -363,12 +350,16 @@ static int tc574_config(struct pcmcia_device *link) ...@@ -363,12 +350,16 @@ static int tc574_config(struct pcmcia_device *link)
if (i == 0) if (i == 0)
break; break;
} }
if (i != 0) { if (i != 0)
cs_error(link, RequestIO, i); goto failed;
ret = pcmcia_request_irq(link, &link->irq);
if (ret)
goto failed;
ret = pcmcia_request_configuration(link, &link->conf);
if (ret)
goto failed; goto failed;
}
CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf));
dev->irq = link->irq.AssignedIRQ; dev->irq = link->irq.AssignedIRQ;
dev->base_addr = link->io.BasePort1; dev->base_addr = link->io.BasePort1;
...@@ -378,16 +369,14 @@ static int tc574_config(struct pcmcia_device *link) ...@@ -378,16 +369,14 @@ static int tc574_config(struct pcmcia_device *link)
/* The 3c574 normally uses an EEPROM for configuration info, including /* The 3c574 normally uses an EEPROM for configuration info, including
the hardware address. The future products may include a modem chip the hardware address. The future products may include a modem chip
and put the address in the CIS. */ and put the address in the CIS. */
tuple.Attributes = 0;
tuple.TupleData = (cisdata_t *)buf; len = pcmcia_get_tuple(link, 0x88, &buf);
tuple.TupleDataMax = 64; if (buf && len >= 6) {
tuple.TupleOffset = 0;
tuple.DesiredTuple = 0x88;
if (pcmcia_get_first_tuple(link, &tuple) == 0) {
pcmcia_get_tuple_data(link, &tuple);
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
phys_addr[i] = htons(le16_to_cpu(buf[i])); phys_addr[i] = htons(le16_to_cpu(buf[i * 2]));
kfree(buf);
} else { } else {
kfree(buf); /* 0 < len < 6 */
EL3WINDOW(0); EL3WINDOW(0);
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
phys_addr[i] = htons(read_eeprom(ioaddr, i + 10)); phys_addr[i] = htons(read_eeprom(ioaddr, i + 10));
...@@ -435,7 +424,8 @@ static int tc574_config(struct pcmcia_device *link) ...@@ -435,7 +424,8 @@ static int tc574_config(struct pcmcia_device *link)
mii_status = mdio_read(ioaddr, phy & 0x1f, 1); mii_status = mdio_read(ioaddr, phy & 0x1f, 1);
if (mii_status != 0xffff) { if (mii_status != 0xffff) {
lp->phys = phy & 0x1f; lp->phys = phy & 0x1f;
DEBUG(0, " MII transceiver at index %d, status %x.\n", dev_dbg(&link->dev, " MII transceiver at "
"index %d, status %x.\n",
phy, mii_status); phy, mii_status);
if ((mii_status & 0x0040) == 0) if ((mii_status & 0x0040) == 0)
mii_preamble_required = 1; mii_preamble_required = 1;
...@@ -457,7 +447,7 @@ static int tc574_config(struct pcmcia_device *link) ...@@ -457,7 +447,7 @@ static int tc574_config(struct pcmcia_device *link)
} }
link->dev_node = &lp->node; link->dev_node = &lp->node;
SET_NETDEV_DEV(dev, &handle_to_dev(link)); SET_NETDEV_DEV(dev, &link->dev);
if (register_netdev(dev) != 0) { if (register_netdev(dev) != 0) {
printk(KERN_NOTICE "3c574_cs: register_netdev() failed\n"); printk(KERN_NOTICE "3c574_cs: register_netdev() failed\n");
...@@ -478,8 +468,6 @@ static int tc574_config(struct pcmcia_device *link) ...@@ -478,8 +468,6 @@ static int tc574_config(struct pcmcia_device *link)
return 0; return 0;
cs_failed:
cs_error(link, last_fn, last_ret);
failed: failed:
tc574_release(link); tc574_release(link);
return -ENODEV; return -ENODEV;
...@@ -738,7 +726,7 @@ static int el3_open(struct net_device *dev) ...@@ -738,7 +726,7 @@ static int el3_open(struct net_device *dev)
lp->media.expires = jiffies + HZ; lp->media.expires = jiffies + HZ;
add_timer(&lp->media); add_timer(&lp->media);
DEBUG(2, "%s: opened, status %4.4x.\n", dev_dbg(&link->dev, "%s: opened, status %4.4x.\n",
dev->name, inw(dev->base_addr + EL3_STATUS)); dev->name, inw(dev->base_addr + EL3_STATUS));
return 0; return 0;
...@@ -772,7 +760,7 @@ static void pop_tx_status(struct net_device *dev) ...@@ -772,7 +760,7 @@ static void pop_tx_status(struct net_device *dev)
if (tx_status & 0x30) if (tx_status & 0x30)
tc574_wait_for_completion(dev, TxReset); tc574_wait_for_completion(dev, TxReset);
if (tx_status & 0x38) { if (tx_status & 0x38) {
DEBUG(1, "%s: transmit error: status 0x%02x\n", pr_debug("%s: transmit error: status 0x%02x\n",
dev->name, tx_status); dev->name, tx_status);
outw(TxEnable, ioaddr + EL3_CMD); outw(TxEnable, ioaddr + EL3_CMD);
dev->stats.tx_aborted_errors++; dev->stats.tx_aborted_errors++;
...@@ -788,7 +776,7 @@ static netdev_tx_t el3_start_xmit(struct sk_buff *skb, ...@@ -788,7 +776,7 @@ static netdev_tx_t el3_start_xmit(struct sk_buff *skb,
struct el3_private *lp = netdev_priv(dev); struct el3_private *lp = netdev_priv(dev);
unsigned long flags; unsigned long flags;
DEBUG(3, "%s: el3_start_xmit(length = %ld) called, " pr_debug("%s: el3_start_xmit(length = %ld) called, "
"status %4.4x.\n", dev->name, (long)skb->len, "status %4.4x.\n", dev->name, (long)skb->len,
inw(ioaddr + EL3_STATUS)); inw(ioaddr + EL3_STATUS));
...@@ -827,7 +815,7 @@ static irqreturn_t el3_interrupt(int irq, void *dev_id) ...@@ -827,7 +815,7 @@ static irqreturn_t el3_interrupt(int irq, void *dev_id)
return IRQ_NONE; return IRQ_NONE;
ioaddr = dev->base_addr; ioaddr = dev->base_addr;
DEBUG(3, "%s: interrupt, status %4.4x.\n", pr_debug("%s: interrupt, status %4.4x.\n",
dev->name, inw(ioaddr + EL3_STATUS)); dev->name, inw(ioaddr + EL3_STATUS));
spin_lock(&lp->window_lock); spin_lock(&lp->window_lock);
...@@ -836,7 +824,7 @@ static irqreturn_t el3_interrupt(int irq, void *dev_id) ...@@ -836,7 +824,7 @@ static irqreturn_t el3_interrupt(int irq, void *dev_id)
(IntLatch | RxComplete | RxEarly | StatsFull)) { (IntLatch | RxComplete | RxEarly | StatsFull)) {
if (!netif_device_present(dev) || if (!netif_device_present(dev) ||
((status & 0xe000) != 0x2000)) { ((status & 0xe000) != 0x2000)) {
DEBUG(1, "%s: Interrupt from dead card\n", dev->name); pr_debug("%s: Interrupt from dead card\n", dev->name);
break; break;
} }
...@@ -846,7 +834,7 @@ static irqreturn_t el3_interrupt(int irq, void *dev_id) ...@@ -846,7 +834,7 @@ static irqreturn_t el3_interrupt(int irq, void *dev_id)
work_budget = el3_rx(dev, work_budget); work_budget = el3_rx(dev, work_budget);
if (status & TxAvailable) { if (status & TxAvailable) {
DEBUG(3, " TX room bit was handled.\n"); pr_debug(" TX room bit was handled.\n");
/* There's room in the FIFO for a full-sized packet. */ /* There's room in the FIFO for a full-sized packet. */
outw(AckIntr | TxAvailable, ioaddr + EL3_CMD); outw(AckIntr | TxAvailable, ioaddr + EL3_CMD);
netif_wake_queue(dev); netif_wake_queue(dev);
...@@ -886,7 +874,7 @@ static irqreturn_t el3_interrupt(int irq, void *dev_id) ...@@ -886,7 +874,7 @@ static irqreturn_t el3_interrupt(int irq, void *dev_id)
} }
if (--work_budget < 0) { if (--work_budget < 0) {
DEBUG(0, "%s: Too much work in interrupt, " pr_debug("%s: Too much work in interrupt, "
"status %4.4x.\n", dev->name, status); "status %4.4x.\n", dev->name, status);
/* Clear all interrupts */ /* Clear all interrupts */
outw(AckIntr | 0xFF, ioaddr + EL3_CMD); outw(AckIntr | 0xFF, ioaddr + EL3_CMD);
...@@ -896,7 +884,7 @@ static irqreturn_t el3_interrupt(int irq, void *dev_id) ...@@ -896,7 +884,7 @@ static irqreturn_t el3_interrupt(int irq, void *dev_id)
outw(AckIntr | IntReq | IntLatch, ioaddr + EL3_CMD); outw(AckIntr | IntReq | IntLatch, ioaddr + EL3_CMD);
} }
DEBUG(3, "%s: exiting interrupt, status %4.4x.\n", pr_debug("%s: exiting interrupt, status %4.4x.\n",
dev->name, inw(ioaddr + EL3_STATUS)); dev->name, inw(ioaddr + EL3_STATUS));
spin_unlock(&lp->window_lock); spin_unlock(&lp->window_lock);
...@@ -1003,7 +991,7 @@ static void update_stats(struct net_device *dev) ...@@ -1003,7 +991,7 @@ static void update_stats(struct net_device *dev)
unsigned int ioaddr = dev->base_addr; unsigned int ioaddr = dev->base_addr;
u8 rx, tx, up; u8 rx, tx, up;
DEBUG(2, "%s: updating the statistics.\n", dev->name); pr_debug("%s: updating the statistics.\n", dev->name);
if (inw(ioaddr+EL3_STATUS) == 0xffff) /* No card. */ if (inw(ioaddr+EL3_STATUS) == 0xffff) /* No card. */
return; return;
...@@ -1039,7 +1027,7 @@ static int el3_rx(struct net_device *dev, int worklimit) ...@@ -1039,7 +1027,7 @@ static int el3_rx(struct net_device *dev, int worklimit)
unsigned int ioaddr = dev->base_addr; unsigned int ioaddr = dev->base_addr;
short rx_status; short rx_status;
DEBUG(3, "%s: in rx_packet(), status %4.4x, rx_status %4.4x.\n", pr_debug("%s: in rx_packet(), status %4.4x, rx_status %4.4x.\n",
dev->name, inw(ioaddr+EL3_STATUS), inw(ioaddr+RxStatus)); dev->name, inw(ioaddr+EL3_STATUS), inw(ioaddr+RxStatus));
while (!((rx_status = inw(ioaddr + RxStatus)) & 0x8000) && while (!((rx_status = inw(ioaddr + RxStatus)) & 0x8000) &&
worklimit > 0) { worklimit > 0) {
...@@ -1061,7 +1049,7 @@ static int el3_rx(struct net_device *dev, int worklimit) ...@@ -1061,7 +1049,7 @@ static int el3_rx(struct net_device *dev, int worklimit)
skb = dev_alloc_skb(pkt_len+5); skb = dev_alloc_skb(pkt_len+5);
DEBUG(3, " Receiving packet size %d status %4.4x.\n", pr_debug(" Receiving packet size %d status %4.4x.\n",
pkt_len, rx_status); pkt_len, rx_status);
if (skb != NULL) { if (skb != NULL) {
skb_reserve(skb, 2); skb_reserve(skb, 2);
...@@ -1072,7 +1060,7 @@ static int el3_rx(struct net_device *dev, int worklimit) ...@@ -1072,7 +1060,7 @@ static int el3_rx(struct net_device *dev, int worklimit)
dev->stats.rx_packets++; dev->stats.rx_packets++;
dev->stats.rx_bytes += pkt_len; dev->stats.rx_bytes += pkt_len;
} else { } else {
DEBUG(1, "%s: couldn't allocate a sk_buff of" pr_debug("%s: couldn't allocate a sk_buff of"
" size %d.\n", dev->name, pkt_len); " size %d.\n", dev->name, pkt_len);
dev->stats.rx_dropped++; dev->stats.rx_dropped++;
} }
...@@ -1101,7 +1089,7 @@ static int el3_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) ...@@ -1101,7 +1089,7 @@ static int el3_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
struct mii_ioctl_data *data = if_mii(rq); struct mii_ioctl_data *data = if_mii(rq);
int phy = lp->phys & 0x1f; int phy = lp->phys & 0x1f;
DEBUG(2, "%s: In ioct(%-.6s, %#4.4x) %4.4x %4.4x %4.4x %4.4x.\n", pr_debug("%s: In ioct(%-.6s, %#4.4x) %4.4x %4.4x %4.4x %4.4x.\n",
dev->name, rq->ifr_ifrn.ifrn_name, cmd, dev->name, rq->ifr_ifrn.ifrn_name, cmd,
data->phy_id, data->reg_num, data->val_in, data->val_out); data->phy_id, data->reg_num, data->val_in, data->val_out);
...@@ -1178,7 +1166,7 @@ static int el3_close(struct net_device *dev) ...@@ -1178,7 +1166,7 @@ static int el3_close(struct net_device *dev)
struct el3_private *lp = netdev_priv(dev); struct el3_private *lp = netdev_priv(dev);
struct pcmcia_device *link = lp->p_dev; struct pcmcia_device *link = lp->p_dev;
DEBUG(2, "%s: shutting down ethercard.\n", dev->name); dev_dbg(&link->dev, "%s: shutting down ethercard.\n", dev->name);
if (pcmcia_dev_present(link)) { if (pcmcia_dev_present(link)) {
unsigned long flags; unsigned long flags;
......
...@@ -130,14 +130,6 @@ MODULE_LICENSE("GPL"); ...@@ -130,14 +130,6 @@ MODULE_LICENSE("GPL");
/* Special hook for setting if_port when module is loaded */ /* Special hook for setting if_port when module is loaded */
INT_MODULE_PARM(if_port, 0); INT_MODULE_PARM(if_port, 0);
#ifdef PCMCIA_DEBUG
INT_MODULE_PARM(pc_debug, PCMCIA_DEBUG);
#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)
static char *version =
DRV_NAME ".c " DRV_VERSION " 2001/10/13 00:08:50 (David Hinds)";
#else
#define DEBUG(n, args...)
#endif
/*====================================================================*/ /*====================================================================*/
...@@ -189,7 +181,7 @@ static int tc589_probe(struct pcmcia_device *link) ...@@ -189,7 +181,7 @@ static int tc589_probe(struct pcmcia_device *link)
struct el3_private *lp; struct el3_private *lp;
struct net_device *dev; struct net_device *dev;
DEBUG(0, "3c589_attach()\n"); dev_dbg(&link->dev, "3c589_attach()\n");
/* Create new ethernet device */ /* Create new ethernet device */
dev = alloc_etherdev(sizeof(struct el3_private)); dev = alloc_etherdev(sizeof(struct el3_private));
...@@ -202,10 +194,8 @@ static int tc589_probe(struct pcmcia_device *link) ...@@ -202,10 +194,8 @@ static int tc589_probe(struct pcmcia_device *link)
spin_lock_init(&lp->lock); spin_lock_init(&lp->lock);
link->io.NumPorts1 = 16; link->io.NumPorts1 = 16;
link->io.Attributes1 = IO_DATA_PATH_WIDTH_16; link->io.Attributes1 = IO_DATA_PATH_WIDTH_16;
link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_HANDLE_PRESENT; link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
link->irq.IRQInfo1 = IRQ_LEVEL_ID;
link->irq.Handler = &el3_interrupt; link->irq.Handler = &el3_interrupt;
link->irq.Instance = dev;
link->conf.Attributes = CONF_ENABLE_IRQ; link->conf.Attributes = CONF_ENABLE_IRQ;
link->conf.IntType = INT_MEMORY_AND_IO; link->conf.IntType = INT_MEMORY_AND_IO;
link->conf.ConfigIndex = 1; link->conf.ConfigIndex = 1;
...@@ -231,7 +221,7 @@ static void tc589_detach(struct pcmcia_device *link) ...@@ -231,7 +221,7 @@ static void tc589_detach(struct pcmcia_device *link)
{ {
struct net_device *dev = link->priv; struct net_device *dev = link->priv;
DEBUG(0, "3c589_detach(0x%p)\n", link); dev_dbg(&link->dev, "3c589_detach\n");
if (link->dev_node) if (link->dev_node)
unregister_netdev(dev); unregister_netdev(dev);
...@@ -249,29 +239,20 @@ static void tc589_detach(struct pcmcia_device *link) ...@@ -249,29 +239,20 @@ static void tc589_detach(struct pcmcia_device *link)
======================================================================*/ ======================================================================*/
#define CS_CHECK(fn, ret) \
do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
static int tc589_config(struct pcmcia_device *link) static int tc589_config(struct pcmcia_device *link)
{ {
struct net_device *dev = link->priv; struct net_device *dev = link->priv;
struct el3_private *lp = netdev_priv(dev); struct el3_private *lp = netdev_priv(dev);
tuple_t tuple;
__le16 buf[32];
__be16 *phys_addr; __be16 *phys_addr;
int last_fn, last_ret, i, j, multi = 0, fifo; int ret, i, j, multi = 0, fifo;
unsigned int ioaddr; unsigned int ioaddr;
char *ram_split[] = {"5:3", "3:1", "1:1", "3:5"}; char *ram_split[] = {"5:3", "3:1", "1:1", "3:5"};
u8 *buf;
size_t len;
DEBUG(0, "3c589_config(0x%p)\n", link); dev_dbg(&link->dev, "3c589_config\n");
phys_addr = (__be16 *)dev->dev_addr; phys_addr = (__be16 *)dev->dev_addr;
tuple.Attributes = 0;
tuple.TupleData = (cisdata_t *)buf;
tuple.TupleDataMax = sizeof(buf);
tuple.TupleOffset = 0;
tuple.Attributes = TUPLE_RETURN_COMMON;
/* Is this a 3c562? */ /* Is this a 3c562? */
if (link->manf_id != MANFID_3COM) if (link->manf_id != MANFID_3COM)
printk(KERN_INFO "3c589_cs: hmmm, is this really a " printk(KERN_INFO "3c589_cs: hmmm, is this really a "
...@@ -287,12 +268,16 @@ static int tc589_config(struct pcmcia_device *link) ...@@ -287,12 +268,16 @@ static int tc589_config(struct pcmcia_device *link)
if (i == 0) if (i == 0)
break; break;
} }
if (i != 0) { if (i != 0)
cs_error(link, RequestIO, i); goto failed;
ret = pcmcia_request_irq(link, &link->irq);
if (ret)
goto failed;
ret = pcmcia_request_configuration(link, &link->conf);
if (ret)
goto failed; goto failed;
}
CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf));
dev->irq = link->irq.AssignedIRQ; dev->irq = link->irq.AssignedIRQ;
dev->base_addr = link->io.BasePort1; dev->base_addr = link->io.BasePort1;
...@@ -301,12 +286,13 @@ static int tc589_config(struct pcmcia_device *link) ...@@ -301,12 +286,13 @@ static int tc589_config(struct pcmcia_device *link)
/* The 3c589 has an extra EEPROM for configuration info, including /* The 3c589 has an extra EEPROM for configuration info, including
the hardware address. The 3c562 puts the address in the CIS. */ the hardware address. The 3c562 puts the address in the CIS. */
tuple.DesiredTuple = 0x88; len = pcmcia_get_tuple(link, 0x88, &buf);
if (pcmcia_get_first_tuple(link, &tuple) == 0) { if (buf && len >= 6) {
pcmcia_get_tuple_data(link, &tuple);
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
phys_addr[i] = htons(le16_to_cpu(buf[i])); phys_addr[i] = htons(le16_to_cpu(buf[i*2]));
kfree(buf);
} else { } else {
kfree(buf); /* 0 < len < 6 */
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
phys_addr[i] = htons(read_eeprom(ioaddr, i)); phys_addr[i] = htons(read_eeprom(ioaddr, i));
if (phys_addr[0] == htons(0x6060)) { if (phys_addr[0] == htons(0x6060)) {
...@@ -328,7 +314,7 @@ static int tc589_config(struct pcmcia_device *link) ...@@ -328,7 +314,7 @@ static int tc589_config(struct pcmcia_device *link)
printk(KERN_ERR "3c589_cs: invalid if_port requested\n"); printk(KERN_ERR "3c589_cs: invalid if_port requested\n");
link->dev_node = &lp->node; link->dev_node = &lp->node;
SET_NETDEV_DEV(dev, &handle_to_dev(link)); SET_NETDEV_DEV(dev, &link->dev);
if (register_netdev(dev) != 0) { if (register_netdev(dev) != 0) {
printk(KERN_ERR "3c589_cs: register_netdev() failed\n"); printk(KERN_ERR "3c589_cs: register_netdev() failed\n");
...@@ -347,8 +333,6 @@ static int tc589_config(struct pcmcia_device *link) ...@@ -347,8 +333,6 @@ static int tc589_config(struct pcmcia_device *link)
if_names[dev->if_port]); if_names[dev->if_port]);
return 0; return 0;
cs_failed:
cs_error(link, last_fn, last_ret);
failed: failed:
tc589_release(link); tc589_release(link);
return -ENODEV; return -ENODEV;
...@@ -511,24 +495,8 @@ static void netdev_get_drvinfo(struct net_device *dev, ...@@ -511,24 +495,8 @@ static void netdev_get_drvinfo(struct net_device *dev,
sprintf(info->bus_info, "PCMCIA 0x%lx", dev->base_addr); sprintf(info->bus_info, "PCMCIA 0x%lx", dev->base_addr);
} }
#ifdef PCMCIA_DEBUG
static u32 netdev_get_msglevel(struct net_device *dev)
{
return pc_debug;
}
static void netdev_set_msglevel(struct net_device *dev, u32 level)
{
pc_debug = level;
}
#endif /* PCMCIA_DEBUG */
static const struct ethtool_ops netdev_ethtool_ops = { static const struct ethtool_ops netdev_ethtool_ops = {
.get_drvinfo = netdev_get_drvinfo, .get_drvinfo = netdev_get_drvinfo,
#ifdef PCMCIA_DEBUG
.get_msglevel = netdev_get_msglevel,
.set_msglevel = netdev_set_msglevel,
#endif /* PCMCIA_DEBUG */
}; };
static int el3_config(struct net_device *dev, struct ifmap *map) static int el3_config(struct net_device *dev, struct ifmap *map)
...@@ -563,7 +531,7 @@ static int el3_open(struct net_device *dev) ...@@ -563,7 +531,7 @@ static int el3_open(struct net_device *dev)
lp->media.expires = jiffies + HZ; lp->media.expires = jiffies + HZ;
add_timer(&lp->media); add_timer(&lp->media);
DEBUG(1, "%s: opened, status %4.4x.\n", dev_dbg(&link->dev, "%s: opened, status %4.4x.\n",
dev->name, inw(dev->base_addr + EL3_STATUS)); dev->name, inw(dev->base_addr + EL3_STATUS));
return 0; return 0;
...@@ -596,7 +564,7 @@ static void pop_tx_status(struct net_device *dev) ...@@ -596,7 +564,7 @@ static void pop_tx_status(struct net_device *dev)
if (tx_status & 0x30) if (tx_status & 0x30)
tc589_wait_for_completion(dev, TxReset); tc589_wait_for_completion(dev, TxReset);
if (tx_status & 0x38) { if (tx_status & 0x38) {
DEBUG(1, "%s: transmit error: status 0x%02x\n", pr_debug("%s: transmit error: status 0x%02x\n",
dev->name, tx_status); dev->name, tx_status);
outw(TxEnable, ioaddr + EL3_CMD); outw(TxEnable, ioaddr + EL3_CMD);
dev->stats.tx_aborted_errors++; dev->stats.tx_aborted_errors++;
...@@ -612,7 +580,7 @@ static netdev_tx_t el3_start_xmit(struct sk_buff *skb, ...@@ -612,7 +580,7 @@ static netdev_tx_t el3_start_xmit(struct sk_buff *skb,
struct el3_private *priv = netdev_priv(dev); struct el3_private *priv = netdev_priv(dev);
unsigned long flags; unsigned long flags;
DEBUG(3, "%s: el3_start_xmit(length = %ld) called, " pr_debug("%s: el3_start_xmit(length = %ld) called, "
"status %4.4x.\n", dev->name, (long)skb->len, "status %4.4x.\n", dev->name, (long)skb->len,
inw(ioaddr + EL3_STATUS)); inw(ioaddr + EL3_STATUS));
...@@ -654,14 +622,14 @@ static irqreturn_t el3_interrupt(int irq, void *dev_id) ...@@ -654,14 +622,14 @@ static irqreturn_t el3_interrupt(int irq, void *dev_id)
ioaddr = dev->base_addr; ioaddr = dev->base_addr;
DEBUG(3, "%s: interrupt, status %4.4x.\n", pr_debug("%s: interrupt, status %4.4x.\n",
dev->name, inw(ioaddr + EL3_STATUS)); dev->name, inw(ioaddr + EL3_STATUS));
spin_lock(&lp->lock); spin_lock(&lp->lock);
while ((status = inw(ioaddr + EL3_STATUS)) & while ((status = inw(ioaddr + EL3_STATUS)) &
(IntLatch | RxComplete | StatsFull)) { (IntLatch | RxComplete | StatsFull)) {
if ((status & 0xe000) != 0x2000) { if ((status & 0xe000) != 0x2000) {
DEBUG(1, "%s: interrupt from dead card\n", dev->name); pr_debug("%s: interrupt from dead card\n", dev->name);
handled = 0; handled = 0;
break; break;
} }
...@@ -670,7 +638,7 @@ static irqreturn_t el3_interrupt(int irq, void *dev_id) ...@@ -670,7 +638,7 @@ static irqreturn_t el3_interrupt(int irq, void *dev_id)
el3_rx(dev); el3_rx(dev);
if (status & TxAvailable) { if (status & TxAvailable) {
DEBUG(3, " TX room bit was handled.\n"); pr_debug(" TX room bit was handled.\n");
/* There's room in the FIFO for a full-sized packet. */ /* There's room in the FIFO for a full-sized packet. */
outw(AckIntr | TxAvailable, ioaddr + EL3_CMD); outw(AckIntr | TxAvailable, ioaddr + EL3_CMD);
netif_wake_queue(dev); netif_wake_queue(dev);
...@@ -722,7 +690,7 @@ static irqreturn_t el3_interrupt(int irq, void *dev_id) ...@@ -722,7 +690,7 @@ static irqreturn_t el3_interrupt(int irq, void *dev_id)
lp->last_irq = jiffies; lp->last_irq = jiffies;
spin_unlock(&lp->lock); spin_unlock(&lp->lock);
DEBUG(3, "%s: exiting interrupt, status %4.4x.\n", pr_debug("%s: exiting interrupt, status %4.4x.\n",
dev->name, inw(ioaddr + EL3_STATUS)); dev->name, inw(ioaddr + EL3_STATUS));
return IRQ_RETVAL(handled); return IRQ_RETVAL(handled);
} }
...@@ -833,7 +801,7 @@ static void update_stats(struct net_device *dev) ...@@ -833,7 +801,7 @@ static void update_stats(struct net_device *dev)
{ {
unsigned int ioaddr = dev->base_addr; unsigned int ioaddr = dev->base_addr;
DEBUG(2, "%s: updating the statistics.\n", dev->name); pr_debug("%s: updating the statistics.\n", dev->name);
/* Turn off statistics updates while reading. */ /* Turn off statistics updates while reading. */
outw(StatsDisable, ioaddr + EL3_CMD); outw(StatsDisable, ioaddr + EL3_CMD);
/* Switch to the stats window, and read everything. */ /* Switch to the stats window, and read everything. */
...@@ -861,7 +829,7 @@ static int el3_rx(struct net_device *dev) ...@@ -861,7 +829,7 @@ static int el3_rx(struct net_device *dev)
int worklimit = 32; int worklimit = 32;
short rx_status; short rx_status;
DEBUG(3, "%s: in rx_packet(), status %4.4x, rx_status %4.4x.\n", pr_debug("%s: in rx_packet(), status %4.4x, rx_status %4.4x.\n",
dev->name, inw(ioaddr+EL3_STATUS), inw(ioaddr+RX_STATUS)); dev->name, inw(ioaddr+EL3_STATUS), inw(ioaddr+RX_STATUS));
while (!((rx_status = inw(ioaddr + RX_STATUS)) & 0x8000) && while (!((rx_status = inw(ioaddr + RX_STATUS)) & 0x8000) &&
worklimit > 0) { worklimit > 0) {
...@@ -883,7 +851,7 @@ static int el3_rx(struct net_device *dev) ...@@ -883,7 +851,7 @@ static int el3_rx(struct net_device *dev)
skb = dev_alloc_skb(pkt_len+5); skb = dev_alloc_skb(pkt_len+5);
DEBUG(3, " Receiving packet size %d status %4.4x.\n", pr_debug(" Receiving packet size %d status %4.4x.\n",
pkt_len, rx_status); pkt_len, rx_status);
if (skb != NULL) { if (skb != NULL) {
skb_reserve(skb, 2); skb_reserve(skb, 2);
...@@ -894,7 +862,7 @@ static int el3_rx(struct net_device *dev) ...@@ -894,7 +862,7 @@ static int el3_rx(struct net_device *dev)
dev->stats.rx_packets++; dev->stats.rx_packets++;
dev->stats.rx_bytes += pkt_len; dev->stats.rx_bytes += pkt_len;
} else { } else {
DEBUG(1, "%s: couldn't allocate a sk_buff of" pr_debug("%s: couldn't allocate a sk_buff of"
" size %d.\n", dev->name, pkt_len); " size %d.\n", dev->name, pkt_len);
dev->stats.rx_dropped++; dev->stats.rx_dropped++;
} }
...@@ -935,7 +903,7 @@ static int el3_close(struct net_device *dev) ...@@ -935,7 +903,7 @@ static int el3_close(struct net_device *dev)
struct pcmcia_device *link = lp->p_dev; struct pcmcia_device *link = lp->p_dev;
unsigned int ioaddr = dev->base_addr; unsigned int ioaddr = dev->base_addr;
DEBUG(1, "%s: shutting down ethercard.\n", dev->name); dev_dbg(&link->dev, "%s: shutting down ethercard.\n", dev->name);
if (pcmcia_dev_present(link)) { if (pcmcia_dev_present(link)) {
/* Turn off statistics ASAP. We update dev->stats below. */ /* Turn off statistics ASAP. We update dev->stats below. */
......
...@@ -75,16 +75,6 @@ MODULE_AUTHOR("David Hinds <dahinds@users.sourceforge.net>"); ...@@ -75,16 +75,6 @@ MODULE_AUTHOR("David Hinds <dahinds@users.sourceforge.net>");
MODULE_DESCRIPTION("Asix AX88190 PCMCIA ethernet driver"); MODULE_DESCRIPTION("Asix AX88190 PCMCIA ethernet driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
#ifdef PCMCIA_DEBUG
#define INT_MODULE_PARM(n, v) static int n = v; module_param(n, int, 0)
INT_MODULE_PARM(pc_debug, PCMCIA_DEBUG);
#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)
static char *version =
"axnet_cs.c 1.28 2002/06/29 06:27:37 (David Hinds)";
#else
#define DEBUG(n, args...)
#endif
/*====================================================================*/ /*====================================================================*/
...@@ -167,7 +157,7 @@ static int axnet_probe(struct pcmcia_device *link) ...@@ -167,7 +157,7 @@ static int axnet_probe(struct pcmcia_device *link)
struct net_device *dev; struct net_device *dev;
struct ei_device *ei_local; struct ei_device *ei_local;
DEBUG(0, "axnet_attach()\n"); dev_dbg(&link->dev, "axnet_attach()\n");
dev = alloc_etherdev(sizeof(struct ei_device) + sizeof(axnet_dev_t)); dev = alloc_etherdev(sizeof(struct ei_device) + sizeof(axnet_dev_t));
if (!dev) if (!dev)
...@@ -180,7 +170,6 @@ static int axnet_probe(struct pcmcia_device *link) ...@@ -180,7 +170,6 @@ static int axnet_probe(struct pcmcia_device *link)
info->p_dev = link; info->p_dev = link;
link->priv = dev; link->priv = dev;
link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
link->irq.IRQInfo1 = IRQ_LEVEL_ID;
link->conf.Attributes = CONF_ENABLE_IRQ; link->conf.Attributes = CONF_ENABLE_IRQ;
link->conf.IntType = INT_MEMORY_AND_IO; link->conf.IntType = INT_MEMORY_AND_IO;
...@@ -205,7 +194,7 @@ static void axnet_detach(struct pcmcia_device *link) ...@@ -205,7 +194,7 @@ static void axnet_detach(struct pcmcia_device *link)
{ {
struct net_device *dev = link->priv; struct net_device *dev = link->priv;
DEBUG(0, "axnet_detach(0x%p)\n", link); dev_dbg(&link->dev, "axnet_detach(0x%p)\n", link);
if (link->dev_node) if (link->dev_node)
unregister_netdev(dev); unregister_netdev(dev);
...@@ -272,9 +261,6 @@ static int get_prom(struct pcmcia_device *link) ...@@ -272,9 +261,6 @@ static int get_prom(struct pcmcia_device *link)
======================================================================*/ ======================================================================*/
#define CS_CHECK(fn, ret) \
do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
static int try_io_port(struct pcmcia_device *link) static int try_io_port(struct pcmcia_device *link)
{ {
int j, ret; int j, ret;
...@@ -341,26 +327,29 @@ static int axnet_config(struct pcmcia_device *link) ...@@ -341,26 +327,29 @@ static int axnet_config(struct pcmcia_device *link)
{ {
struct net_device *dev = link->priv; struct net_device *dev = link->priv;
axnet_dev_t *info = PRIV(dev); axnet_dev_t *info = PRIV(dev);
int i, j, j2, last_ret, last_fn; int i, j, j2, ret;
DEBUG(0, "axnet_config(0x%p)\n", link); dev_dbg(&link->dev, "axnet_config(0x%p)\n", link);
/* don't trust the CIS on this; Linksys got it wrong */ /* don't trust the CIS on this; Linksys got it wrong */
link->conf.Present = 0x63; link->conf.Present = 0x63;
last_ret = pcmcia_loop_config(link, axnet_configcheck, NULL); ret = pcmcia_loop_config(link, axnet_configcheck, NULL);
if (last_ret != 0) { if (ret != 0)
cs_error(link, RequestIO, last_ret);
goto failed; goto failed;
}
CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); ret = pcmcia_request_irq(link, &link->irq);
if (ret)
goto failed;
if (link->io.NumPorts2 == 8) { if (link->io.NumPorts2 == 8) {
link->conf.Attributes |= CONF_ENABLE_SPKR; link->conf.Attributes |= CONF_ENABLE_SPKR;
link->conf.Status = CCSR_AUDIO_ENA; link->conf.Status = CCSR_AUDIO_ENA;
} }
CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); ret = pcmcia_request_configuration(link, &link->conf);
if (ret)
goto failed;
dev->irq = link->irq.AssignedIRQ; dev->irq = link->irq.AssignedIRQ;
dev->base_addr = link->io.BasePort1; dev->base_addr = link->io.BasePort1;
...@@ -410,7 +399,7 @@ static int axnet_config(struct pcmcia_device *link) ...@@ -410,7 +399,7 @@ static int axnet_config(struct pcmcia_device *link)
info->phy_id = (i < 32) ? i : -1; info->phy_id = (i < 32) ? i : -1;
link->dev_node = &info->node; link->dev_node = &info->node;
SET_NETDEV_DEV(dev, &handle_to_dev(link)); SET_NETDEV_DEV(dev, &link->dev);
if (register_netdev(dev) != 0) { if (register_netdev(dev) != 0) {
printk(KERN_NOTICE "axnet_cs: register_netdev() failed\n"); printk(KERN_NOTICE "axnet_cs: register_netdev() failed\n");
...@@ -426,14 +415,12 @@ static int axnet_config(struct pcmcia_device *link) ...@@ -426,14 +415,12 @@ static int axnet_config(struct pcmcia_device *link)
dev->base_addr, dev->irq, dev->base_addr, dev->irq,
dev->dev_addr); dev->dev_addr);
if (info->phy_id != -1) { if (info->phy_id != -1) {
DEBUG(0, " MII transceiver at index %d, status %x.\n", info->phy_id, j); dev_dbg(&link->dev, " MII transceiver at index %d, status %x.\n", info->phy_id, j);
} else { } else {
printk(KERN_NOTICE " No MII transceivers found!\n"); printk(KERN_NOTICE " No MII transceivers found!\n");
} }
return 0; return 0;
cs_failed:
cs_error(link, last_fn, last_ret);
failed: failed:
axnet_release(link); axnet_release(link);
return -ENODEV; return -ENODEV;
...@@ -543,7 +530,7 @@ static int axnet_open(struct net_device *dev) ...@@ -543,7 +530,7 @@ static int axnet_open(struct net_device *dev)
struct pcmcia_device *link = info->p_dev; struct pcmcia_device *link = info->p_dev;
unsigned int nic_base = dev->base_addr; unsigned int nic_base = dev->base_addr;
DEBUG(2, "axnet_open('%s')\n", dev->name); dev_dbg(&link->dev, "axnet_open('%s')\n", dev->name);
if (!pcmcia_dev_present(link)) if (!pcmcia_dev_present(link))
return -ENODEV; return -ENODEV;
...@@ -572,7 +559,7 @@ static int axnet_close(struct net_device *dev) ...@@ -572,7 +559,7 @@ static int axnet_close(struct net_device *dev)
axnet_dev_t *info = PRIV(dev); axnet_dev_t *info = PRIV(dev);
struct pcmcia_device *link = info->p_dev; struct pcmcia_device *link = info->p_dev;
DEBUG(2, "axnet_close('%s')\n", dev->name); dev_dbg(&link->dev, "axnet_close('%s')\n", dev->name);
ax_close(dev); ax_close(dev);
free_irq(dev->irq, dev); free_irq(dev->irq, dev);
...@@ -741,10 +728,8 @@ static void block_input(struct net_device *dev, int count, ...@@ -741,10 +728,8 @@ static void block_input(struct net_device *dev, int count,
int xfer_count = count; int xfer_count = count;
char *buf = skb->data; char *buf = skb->data;
#ifdef PCMCIA_DEBUG
if ((ei_debug > 4) && (count != 4)) if ((ei_debug > 4) && (count != 4))
printk(KERN_DEBUG "%s: [bi=%d]\n", dev->name, count+4); pr_debug("%s: [bi=%d]\n", dev->name, count+4);
#endif
outb_p(ring_offset & 0xff, nic_base + EN0_RSARLO); outb_p(ring_offset & 0xff, nic_base + EN0_RSARLO);
outb_p(ring_offset >> 8, nic_base + EN0_RSARHI); outb_p(ring_offset >> 8, nic_base + EN0_RSARHI);
outb_p(E8390_RREAD+E8390_START, nic_base + AXNET_CMD); outb_p(E8390_RREAD+E8390_START, nic_base + AXNET_CMD);
...@@ -762,10 +747,7 @@ static void block_output(struct net_device *dev, int count, ...@@ -762,10 +747,7 @@ static void block_output(struct net_device *dev, int count,
{ {
unsigned int nic_base = dev->base_addr; unsigned int nic_base = dev->base_addr;
#ifdef PCMCIA_DEBUG pr_debug("%s: [bo=%d]\n", dev->name, count);
if (ei_debug > 4)
printk(KERN_DEBUG "%s: [bo=%d]\n", dev->name, count);
#endif
/* Round the count up for word writes. Do we need to do this? /* Round the count up for word writes. Do we need to do this?
What effect will an odd byte count have on the 8390? What effect will an odd byte count have on the 8390?
......
...@@ -53,11 +53,7 @@ ...@@ -53,11 +53,7 @@
#define VERSION "arcnet: COM20020 PCMCIA support loaded.\n" #define VERSION "arcnet: COM20020 PCMCIA support loaded.\n"
#ifdef PCMCIA_DEBUG #ifdef DEBUG
static int pc_debug = PCMCIA_DEBUG;
module_param(pc_debug, int, 0);
#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)
static void regdump(struct net_device *dev) static void regdump(struct net_device *dev)
{ {
...@@ -92,7 +88,6 @@ static void regdump(struct net_device *dev) ...@@ -92,7 +88,6 @@ static void regdump(struct net_device *dev)
#else #else
#define DEBUG(n, args...) do { } while (0)
static inline void regdump(struct net_device *dev) { } static inline void regdump(struct net_device *dev) { }
#endif #endif
...@@ -144,7 +139,7 @@ static int com20020_probe(struct pcmcia_device *p_dev) ...@@ -144,7 +139,7 @@ static int com20020_probe(struct pcmcia_device *p_dev)
struct net_device *dev; struct net_device *dev;
struct arcnet_local *lp; struct arcnet_local *lp;
DEBUG(0, "com20020_attach()\n"); dev_dbg(&p_dev->dev, "com20020_attach()\n");
/* Create new network device */ /* Create new network device */
info = kzalloc(sizeof(struct com20020_dev_t), GFP_KERNEL); info = kzalloc(sizeof(struct com20020_dev_t), GFP_KERNEL);
...@@ -169,11 +164,10 @@ static int com20020_probe(struct pcmcia_device *p_dev) ...@@ -169,11 +164,10 @@ static int com20020_probe(struct pcmcia_device *p_dev)
p_dev->io.NumPorts1 = 16; p_dev->io.NumPorts1 = 16;
p_dev->io.IOAddrLines = 16; p_dev->io.IOAddrLines = 16;
p_dev->irq.Attributes = IRQ_TYPE_EXCLUSIVE; p_dev->irq.Attributes = IRQ_TYPE_EXCLUSIVE;
p_dev->irq.IRQInfo1 = IRQ_LEVEL_ID;
p_dev->conf.Attributes = CONF_ENABLE_IRQ; p_dev->conf.Attributes = CONF_ENABLE_IRQ;
p_dev->conf.IntType = INT_MEMORY_AND_IO; p_dev->conf.IntType = INT_MEMORY_AND_IO;
p_dev->irq.Instance = info->dev = dev; info->dev = dev;
p_dev->priv = info; p_dev->priv = info;
return com20020_config(p_dev); return com20020_config(p_dev);
...@@ -198,12 +192,12 @@ static void com20020_detach(struct pcmcia_device *link) ...@@ -198,12 +192,12 @@ static void com20020_detach(struct pcmcia_device *link)
struct com20020_dev_t *info = link->priv; struct com20020_dev_t *info = link->priv;
struct net_device *dev = info->dev; struct net_device *dev = info->dev;
DEBUG(1,"detach...\n"); dev_dbg(&link->dev, "detach...\n");
DEBUG(0, "com20020_detach(0x%p)\n", link); dev_dbg(&link->dev, "com20020_detach\n");
if (link->dev_node) { if (link->dev_node) {
DEBUG(1,"unregister...\n"); dev_dbg(&link->dev, "unregister...\n");
unregister_netdev(dev); unregister_netdev(dev);
...@@ -218,16 +212,16 @@ static void com20020_detach(struct pcmcia_device *link) ...@@ -218,16 +212,16 @@ static void com20020_detach(struct pcmcia_device *link)
com20020_release(link); com20020_release(link);
/* Unlink device structure, free bits */ /* Unlink device structure, free bits */
DEBUG(1,"unlinking...\n"); dev_dbg(&link->dev, "unlinking...\n");
if (link->priv) if (link->priv)
{ {
dev = info->dev; dev = info->dev;
if (dev) if (dev)
{ {
DEBUG(1,"kfree...\n"); dev_dbg(&link->dev, "kfree...\n");
free_netdev(dev); free_netdev(dev);
} }
DEBUG(1,"kfree2...\n"); dev_dbg(&link->dev, "kfree2...\n");
kfree(info); kfree(info);
} }
...@@ -241,25 +235,22 @@ static void com20020_detach(struct pcmcia_device *link) ...@@ -241,25 +235,22 @@ static void com20020_detach(struct pcmcia_device *link)
======================================================================*/ ======================================================================*/
#define CS_CHECK(fn, ret) \
do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
static int com20020_config(struct pcmcia_device *link) static int com20020_config(struct pcmcia_device *link)
{ {
struct arcnet_local *lp; struct arcnet_local *lp;
com20020_dev_t *info; com20020_dev_t *info;
struct net_device *dev; struct net_device *dev;
int i, last_ret, last_fn; int i, ret;
int ioaddr; int ioaddr;
info = link->priv; info = link->priv;
dev = info->dev; dev = info->dev;
DEBUG(1,"config...\n"); dev_dbg(&link->dev, "config...\n");
DEBUG(0, "com20020_config(0x%p)\n", link); dev_dbg(&link->dev, "com20020_config\n");
DEBUG(1,"arcnet: baseport1 is %Xh\n", link->io.BasePort1); dev_dbg(&link->dev, "baseport1 is %Xh\n", link->io.BasePort1);
i = -ENODEV; i = -ENODEV;
if (!link->io.BasePort1) if (!link->io.BasePort1)
{ {
...@@ -276,26 +267,27 @@ static int com20020_config(struct pcmcia_device *link) ...@@ -276,26 +267,27 @@ static int com20020_config(struct pcmcia_device *link)
if (i != 0) if (i != 0)
{ {
DEBUG(1,"arcnet: requestIO failed totally!\n"); dev_dbg(&link->dev, "requestIO failed totally!\n");
goto failed; goto failed;
} }
ioaddr = dev->base_addr = link->io.BasePort1; ioaddr = dev->base_addr = link->io.BasePort1;
DEBUG(1,"arcnet: got ioaddr %Xh\n", ioaddr); dev_dbg(&link->dev, "got ioaddr %Xh\n", ioaddr);
DEBUG(1,"arcnet: request IRQ %d (%Xh/%Xh)\n", dev_dbg(&link->dev, "request IRQ %d\n",
link->irq.AssignedIRQ, link->irq.AssignedIRQ);
link->irq.IRQInfo1, link->irq.IRQInfo2);
i = pcmcia_request_irq(link, &link->irq); i = pcmcia_request_irq(link, &link->irq);
if (i != 0) if (i != 0)
{ {
DEBUG(1,"arcnet: requestIRQ failed totally!\n"); dev_dbg(&link->dev, "requestIRQ failed totally!\n");
goto failed; goto failed;
} }
dev->irq = link->irq.AssignedIRQ; dev->irq = link->irq.AssignedIRQ;
CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); ret = pcmcia_request_configuration(link, &link->conf);
if (ret)
goto failed;
if (com20020_check(dev)) if (com20020_check(dev))
{ {
...@@ -308,26 +300,25 @@ static int com20020_config(struct pcmcia_device *link) ...@@ -308,26 +300,25 @@ static int com20020_config(struct pcmcia_device *link)
lp->card_flags = ARC_CAN_10MBIT; /* pretend all of them can 10Mbit */ lp->card_flags = ARC_CAN_10MBIT; /* pretend all of them can 10Mbit */
link->dev_node = &info->node; link->dev_node = &info->node;
SET_NETDEV_DEV(dev, &handle_to_dev(link)); SET_NETDEV_DEV(dev, &link->dev);
i = com20020_found(dev, 0); /* calls register_netdev */ i = com20020_found(dev, 0); /* calls register_netdev */
if (i != 0) { if (i != 0) {
DEBUG(1,KERN_NOTICE "com20020_cs: com20020_found() failed\n"); dev_printk(KERN_NOTICE, &link->dev,
"com20020_cs: com20020_found() failed\n");
link->dev_node = NULL; link->dev_node = NULL;
goto failed; goto failed;
} }
strcpy(info->node.dev_name, dev->name); strcpy(info->node.dev_name, dev->name);
DEBUG(1,KERN_INFO "%s: port %#3lx, irq %d\n", dev_dbg(&link->dev,KERN_INFO "%s: port %#3lx, irq %d\n",
dev->name, dev->base_addr, dev->irq); dev->name, dev->base_addr, dev->irq);
return 0; return 0;
cs_failed:
cs_error(link, last_fn, last_ret);
failed: failed:
DEBUG(1,"com20020_config failed...\n"); dev_dbg(&link->dev, "com20020_config failed...\n");
com20020_release(link); com20020_release(link);
return -ENODEV; return -ENODEV;
} /* com20020_config */ } /* com20020_config */
...@@ -342,7 +333,7 @@ static int com20020_config(struct pcmcia_device *link) ...@@ -342,7 +333,7 @@ static int com20020_config(struct pcmcia_device *link)
static void com20020_release(struct pcmcia_device *link) static void com20020_release(struct pcmcia_device *link)
{ {
DEBUG(0, "com20020_release(0x%p)\n", link); dev_dbg(&link->dev, "com20020_release\n");
pcmcia_disable_device(link); pcmcia_disable_device(link);
} }
......
This diff is collapsed.
...@@ -69,17 +69,6 @@ ...@@ -69,17 +69,6 @@
#define PCMCIA #define PCMCIA
#include "../tokenring/ibmtr.c" #include "../tokenring/ibmtr.c"
#ifdef PCMCIA_DEBUG
static int pc_debug = PCMCIA_DEBUG;
module_param(pc_debug, int, 0);
#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)
static char *version =
"ibmtr_cs.c 1.10 1996/01/06 05:19:00 (Steve Kipisz)\n"
" 2.2.7 1999/05/03 12:00:00 (Mike Phillips)\n"
" 2.4.2 2001/30/28 Midnight (Burt Silverman)\n";
#else
#define DEBUG(n, args...)
#endif
/*====================================================================*/ /*====================================================================*/
...@@ -130,6 +119,12 @@ static const struct ethtool_ops netdev_ethtool_ops = { ...@@ -130,6 +119,12 @@ static const struct ethtool_ops netdev_ethtool_ops = {
.get_drvinfo = netdev_get_drvinfo, .get_drvinfo = netdev_get_drvinfo,
}; };
static irqreturn_t ibmtr_interrupt(int irq, void *dev_id) {
ibmtr_dev_t *info = dev_id;
struct net_device *dev = info->dev;
return tok_interrupt(irq, dev);
};
/*====================================================================== /*======================================================================
ibmtr_attach() creates an "instance" of the driver, allocating ibmtr_attach() creates an "instance" of the driver, allocating
...@@ -143,7 +138,7 @@ static int __devinit ibmtr_attach(struct pcmcia_device *link) ...@@ -143,7 +138,7 @@ static int __devinit ibmtr_attach(struct pcmcia_device *link)
ibmtr_dev_t *info; ibmtr_dev_t *info;
struct net_device *dev; struct net_device *dev;
DEBUG(0, "ibmtr_attach()\n"); dev_dbg(&link->dev, "ibmtr_attach()\n");
/* Create new token-ring device */ /* Create new token-ring device */
info = kzalloc(sizeof(*info), GFP_KERNEL); info = kzalloc(sizeof(*info), GFP_KERNEL);
...@@ -161,14 +156,13 @@ static int __devinit ibmtr_attach(struct pcmcia_device *link) ...@@ -161,14 +156,13 @@ static int __devinit ibmtr_attach(struct pcmcia_device *link)
link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
link->io.NumPorts1 = 4; link->io.NumPorts1 = 4;
link->io.IOAddrLines = 16; link->io.IOAddrLines = 16;
link->irq.Attributes = IRQ_TYPE_EXCLUSIVE | IRQ_HANDLE_PRESENT; link->irq.Attributes = IRQ_TYPE_EXCLUSIVE;
link->irq.IRQInfo1 = IRQ_LEVEL_ID; link->irq.Handler = ibmtr_interrupt;
link->irq.Handler = &tok_interrupt;
link->conf.Attributes = CONF_ENABLE_IRQ; link->conf.Attributes = CONF_ENABLE_IRQ;
link->conf.IntType = INT_MEMORY_AND_IO; link->conf.IntType = INT_MEMORY_AND_IO;
link->conf.Present = PRESENT_OPTION; link->conf.Present = PRESENT_OPTION;
link->irq.Instance = info->dev = dev; info->dev = dev;
SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
...@@ -190,7 +184,7 @@ static void ibmtr_detach(struct pcmcia_device *link) ...@@ -190,7 +184,7 @@ static void ibmtr_detach(struct pcmcia_device *link)
struct net_device *dev = info->dev; struct net_device *dev = info->dev;
struct tok_info *ti = netdev_priv(dev); struct tok_info *ti = netdev_priv(dev);
DEBUG(0, "ibmtr_detach(0x%p)\n", link); dev_dbg(&link->dev, "ibmtr_detach\n");
/* /*
* When the card removal interrupt hits tok_interrupt(), * When the card removal interrupt hits tok_interrupt(),
...@@ -217,9 +211,6 @@ static void ibmtr_detach(struct pcmcia_device *link) ...@@ -217,9 +211,6 @@ static void ibmtr_detach(struct pcmcia_device *link)
======================================================================*/ ======================================================================*/
#define CS_CHECK(fn, ret) \
do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
static int __devinit ibmtr_config(struct pcmcia_device *link) static int __devinit ibmtr_config(struct pcmcia_device *link)
{ {
ibmtr_dev_t *info = link->priv; ibmtr_dev_t *info = link->priv;
...@@ -227,9 +218,9 @@ static int __devinit ibmtr_config(struct pcmcia_device *link) ...@@ -227,9 +218,9 @@ static int __devinit ibmtr_config(struct pcmcia_device *link)
struct tok_info *ti = netdev_priv(dev); struct tok_info *ti = netdev_priv(dev);
win_req_t req; win_req_t req;
memreq_t mem; memreq_t mem;
int i, last_ret, last_fn; int i, ret;
DEBUG(0, "ibmtr_config(0x%p)\n", link); dev_dbg(&link->dev, "ibmtr_config\n");
link->conf.ConfigIndex = 0x61; link->conf.ConfigIndex = 0x61;
...@@ -241,11 +232,15 @@ static int __devinit ibmtr_config(struct pcmcia_device *link) ...@@ -241,11 +232,15 @@ static int __devinit ibmtr_config(struct pcmcia_device *link)
if (i != 0) { if (i != 0) {
/* Couldn't get 0xA20-0xA23. Try ALTERNATE at 0xA24-0xA27. */ /* Couldn't get 0xA20-0xA23. Try ALTERNATE at 0xA24-0xA27. */
link->io.BasePort1 = 0xA24; link->io.BasePort1 = 0xA24;
CS_CHECK(RequestIO, pcmcia_request_io(link, &link->io)); ret = pcmcia_request_io(link, &link->io);
if (ret)
goto failed;
} }
dev->base_addr = link->io.BasePort1; dev->base_addr = link->io.BasePort1;
CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); ret = pcmcia_request_irq(link, &link->irq);
if (ret)
goto failed;
dev->irq = link->irq.AssignedIRQ; dev->irq = link->irq.AssignedIRQ;
ti->irq = link->irq.AssignedIRQ; ti->irq = link->irq.AssignedIRQ;
ti->global_int_enable=GLOBAL_INT_ENABLE+((dev->irq==9) ? 2 : dev->irq); ti->global_int_enable=GLOBAL_INT_ENABLE+((dev->irq==9) ? 2 : dev->irq);
...@@ -256,11 +251,15 @@ static int __devinit ibmtr_config(struct pcmcia_device *link) ...@@ -256,11 +251,15 @@ static int __devinit ibmtr_config(struct pcmcia_device *link)
req.Base = 0; req.Base = 0;
req.Size = 0x2000; req.Size = 0x2000;
req.AccessSpeed = 250; req.AccessSpeed = 250;
CS_CHECK(RequestWindow, pcmcia_request_window(&link, &req, &link->win)); ret = pcmcia_request_window(link, &req, &link->win);
if (ret)
goto failed;
mem.CardOffset = mmiobase; mem.CardOffset = mmiobase;
mem.Page = 0; mem.Page = 0;
CS_CHECK(MapMemPage, pcmcia_map_mem_page(link->win, &mem)); ret = pcmcia_map_mem_page(link, link->win, &mem);
if (ret)
goto failed;
ti->mmio = ioremap(req.Base, req.Size); ti->mmio = ioremap(req.Base, req.Size);
/* Allocate the SRAM memory window */ /* Allocate the SRAM memory window */
...@@ -269,17 +268,23 @@ static int __devinit ibmtr_config(struct pcmcia_device *link) ...@@ -269,17 +268,23 @@ static int __devinit ibmtr_config(struct pcmcia_device *link)
req.Base = 0; req.Base = 0;
req.Size = sramsize * 1024; req.Size = sramsize * 1024;
req.AccessSpeed = 250; req.AccessSpeed = 250;
CS_CHECK(RequestWindow, pcmcia_request_window(&link, &req, &info->sram_win_handle)); ret = pcmcia_request_window(link, &req, &info->sram_win_handle);
if (ret)
goto failed;
mem.CardOffset = srambase; mem.CardOffset = srambase;
mem.Page = 0; mem.Page = 0;
CS_CHECK(MapMemPage, pcmcia_map_mem_page(info->sram_win_handle, &mem)); ret = pcmcia_map_mem_page(link, info->sram_win_handle, &mem);
if (ret)
goto failed;
ti->sram_base = mem.CardOffset >> 12; ti->sram_base = mem.CardOffset >> 12;
ti->sram_virt = ioremap(req.Base, req.Size); ti->sram_virt = ioremap(req.Base, req.Size);
ti->sram_phys = req.Base; ti->sram_phys = req.Base;
CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); ret = pcmcia_request_configuration(link, &link->conf);
if (ret)
goto failed;
/* Set up the Token-Ring Controller Configuration Register and /* Set up the Token-Ring Controller Configuration Register and
turn on the card. Check the "Local Area Network Credit Card turn on the card. Check the "Local Area Network Credit Card
...@@ -287,7 +292,7 @@ static int __devinit ibmtr_config(struct pcmcia_device *link) ...@@ -287,7 +292,7 @@ static int __devinit ibmtr_config(struct pcmcia_device *link)
ibmtr_hw_setup(dev, mmiobase); ibmtr_hw_setup(dev, mmiobase);
link->dev_node = &info->node; link->dev_node = &info->node;
SET_NETDEV_DEV(dev, &handle_to_dev(link)); SET_NETDEV_DEV(dev, &link->dev);
i = ibmtr_probe_card(dev); i = ibmtr_probe_card(dev);
if (i != 0) { if (i != 0) {
...@@ -305,8 +310,6 @@ static int __devinit ibmtr_config(struct pcmcia_device *link) ...@@ -305,8 +310,6 @@ static int __devinit ibmtr_config(struct pcmcia_device *link)
dev->dev_addr); dev->dev_addr);
return 0; return 0;
cs_failed:
cs_error(link, last_fn, last_ret);
failed: failed:
ibmtr_release(link); ibmtr_release(link);
return -ENODEV; return -ENODEV;
...@@ -325,12 +328,12 @@ static void ibmtr_release(struct pcmcia_device *link) ...@@ -325,12 +328,12 @@ static void ibmtr_release(struct pcmcia_device *link)
ibmtr_dev_t *info = link->priv; ibmtr_dev_t *info = link->priv;
struct net_device *dev = info->dev; struct net_device *dev = info->dev;
DEBUG(0, "ibmtr_release(0x%p)\n", link); dev_dbg(&link->dev, "ibmtr_release\n");
if (link->win) { if (link->win) {
struct tok_info *ti = netdev_priv(dev); struct tok_info *ti = netdev_priv(dev);
iounmap(ti->mmio); iounmap(ti->mmio);
pcmcia_release_window(info->sram_win_handle); pcmcia_release_window(link, info->sram_win_handle);
} }
pcmcia_disable_device(link); pcmcia_disable_device(link);
} }
......
This diff is collapsed.
...@@ -71,15 +71,6 @@ ...@@ -71,15 +71,6 @@
static const char *if_names[] = { "auto", "10baseT", "10base2"}; static const char *if_names[] = { "auto", "10baseT", "10base2"};
#ifdef PCMCIA_DEBUG
static int pc_debug = PCMCIA_DEBUG;
module_param(pc_debug, int, 0);
#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)
static char *version =
"pcnet_cs.c 1.153 2003/11/09 18:53:09 (David Hinds)";
#else
#define DEBUG(n, args...)
#endif
/*====================================================================*/ /*====================================================================*/
...@@ -265,7 +256,7 @@ static int pcnet_probe(struct pcmcia_device *link) ...@@ -265,7 +256,7 @@ static int pcnet_probe(struct pcmcia_device *link)
pcnet_dev_t *info; pcnet_dev_t *info;
struct net_device *dev; struct net_device *dev;
DEBUG(0, "pcnet_attach()\n"); dev_dbg(&link->dev, "pcnet_attach()\n");
/* Create new ethernet device */ /* Create new ethernet device */
dev = __alloc_ei_netdev(sizeof(pcnet_dev_t)); dev = __alloc_ei_netdev(sizeof(pcnet_dev_t));
...@@ -275,7 +266,6 @@ static int pcnet_probe(struct pcmcia_device *link) ...@@ -275,7 +266,6 @@ static int pcnet_probe(struct pcmcia_device *link)
link->priv = dev; link->priv = dev;
link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
link->irq.IRQInfo1 = IRQ_LEVEL_ID;
link->conf.Attributes = CONF_ENABLE_IRQ; link->conf.Attributes = CONF_ENABLE_IRQ;
link->conf.IntType = INT_MEMORY_AND_IO; link->conf.IntType = INT_MEMORY_AND_IO;
...@@ -297,7 +287,7 @@ static void pcnet_detach(struct pcmcia_device *link) ...@@ -297,7 +287,7 @@ static void pcnet_detach(struct pcmcia_device *link)
{ {
struct net_device *dev = link->priv; struct net_device *dev = link->priv;
DEBUG(0, "pcnet_detach(0x%p)\n", link); dev_dbg(&link->dev, "pcnet_detach\n");
if (link->dev_node) if (link->dev_node)
unregister_netdev(dev); unregister_netdev(dev);
...@@ -326,17 +316,15 @@ static hw_info_t *get_hwinfo(struct pcmcia_device *link) ...@@ -326,17 +316,15 @@ static hw_info_t *get_hwinfo(struct pcmcia_device *link)
req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE;
req.Base = 0; req.Size = 0; req.Base = 0; req.Size = 0;
req.AccessSpeed = 0; req.AccessSpeed = 0;
i = pcmcia_request_window(&link, &req, &link->win); i = pcmcia_request_window(link, &req, &link->win);
if (i != 0) { if (i != 0)
cs_error(link, RequestWindow, i);
return NULL; return NULL;
}
virt = ioremap(req.Base, req.Size); virt = ioremap(req.Base, req.Size);
mem.Page = 0; mem.Page = 0;
for (i = 0; i < NR_INFO; i++) { for (i = 0; i < NR_INFO; i++) {
mem.CardOffset = hw_info[i].offset & ~(req.Size-1); mem.CardOffset = hw_info[i].offset & ~(req.Size-1);
pcmcia_map_mem_page(link->win, &mem); pcmcia_map_mem_page(link, link->win, &mem);
base = &virt[hw_info[i].offset & (req.Size-1)]; base = &virt[hw_info[i].offset & (req.Size-1)];
if ((readb(base+0) == hw_info[i].a0) && if ((readb(base+0) == hw_info[i].a0) &&
(readb(base+2) == hw_info[i].a1) && (readb(base+2) == hw_info[i].a1) &&
...@@ -348,9 +336,7 @@ static hw_info_t *get_hwinfo(struct pcmcia_device *link) ...@@ -348,9 +336,7 @@ static hw_info_t *get_hwinfo(struct pcmcia_device *link)
} }
iounmap(virt); iounmap(virt);
j = pcmcia_release_window(link->win); j = pcmcia_release_window(link, link->win);
if (j != 0)
cs_error(link, ReleaseWindow, j);
return (i < NR_INFO) ? hw_info+i : NULL; return (i < NR_INFO) ? hw_info+i : NULL;
} /* get_hwinfo */ } /* get_hwinfo */
...@@ -495,9 +481,6 @@ static hw_info_t *get_hwired(struct pcmcia_device *link) ...@@ -495,9 +481,6 @@ static hw_info_t *get_hwired(struct pcmcia_device *link)
======================================================================*/ ======================================================================*/
#define CS_CHECK(fn, ret) \
do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
static int try_io_port(struct pcmcia_device *link) static int try_io_port(struct pcmcia_device *link)
{ {
int j, ret; int j, ret;
...@@ -567,19 +550,19 @@ static int pcnet_config(struct pcmcia_device *link) ...@@ -567,19 +550,19 @@ static int pcnet_config(struct pcmcia_device *link)
{ {
struct net_device *dev = link->priv; struct net_device *dev = link->priv;
pcnet_dev_t *info = PRIV(dev); pcnet_dev_t *info = PRIV(dev);
int last_ret, last_fn, start_pg, stop_pg, cm_offset; int ret, start_pg, stop_pg, cm_offset;
int has_shmem = 0; int has_shmem = 0;
hw_info_t *local_hw_info; hw_info_t *local_hw_info;
DEBUG(0, "pcnet_config(0x%p)\n", link); dev_dbg(&link->dev, "pcnet_config\n");
last_ret = pcmcia_loop_config(link, pcnet_confcheck, &has_shmem); ret = pcmcia_loop_config(link, pcnet_confcheck, &has_shmem);
if (last_ret) { if (ret)
cs_error(link, RequestIO, last_ret);
goto failed; goto failed;
}
CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); ret = pcmcia_request_irq(link, &link->irq);
if (ret)
goto failed;
if (link->io.NumPorts2 == 8) { if (link->io.NumPorts2 == 8) {
link->conf.Attributes |= CONF_ENABLE_SPKR; link->conf.Attributes |= CONF_ENABLE_SPKR;
...@@ -589,7 +572,9 @@ static int pcnet_config(struct pcmcia_device *link) ...@@ -589,7 +572,9 @@ static int pcnet_config(struct pcmcia_device *link)
(link->card_id == PRODID_IBM_HOME_AND_AWAY)) (link->card_id == PRODID_IBM_HOME_AND_AWAY))
link->conf.ConfigIndex |= 0x10; link->conf.ConfigIndex |= 0x10;
CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); ret = pcmcia_request_configuration(link, &link->conf);
if (ret)
goto failed;
dev->irq = link->irq.AssignedIRQ; dev->irq = link->irq.AssignedIRQ;
dev->base_addr = link->io.BasePort1; dev->base_addr = link->io.BasePort1;
if (info->flags & HAS_MISC_REG) { if (info->flags & HAS_MISC_REG) {
...@@ -660,7 +645,7 @@ static int pcnet_config(struct pcmcia_device *link) ...@@ -660,7 +645,7 @@ static int pcnet_config(struct pcmcia_device *link)
mii_phy_probe(dev); mii_phy_probe(dev);
link->dev_node = &info->node; link->dev_node = &info->node;
SET_NETDEV_DEV(dev, &handle_to_dev(link)); SET_NETDEV_DEV(dev, &link->dev);
if (register_netdev(dev) != 0) { if (register_netdev(dev) != 0) {
printk(KERN_NOTICE "pcnet_cs: register_netdev() failed\n"); printk(KERN_NOTICE "pcnet_cs: register_netdev() failed\n");
...@@ -687,8 +672,6 @@ static int pcnet_config(struct pcmcia_device *link) ...@@ -687,8 +672,6 @@ static int pcnet_config(struct pcmcia_device *link)
printk(" hw_addr %pM\n", dev->dev_addr); printk(" hw_addr %pM\n", dev->dev_addr);
return 0; return 0;
cs_failed:
cs_error(link, last_fn, last_ret);
failed: failed:
pcnet_release(link); pcnet_release(link);
return -ENODEV; return -ENODEV;
...@@ -706,7 +689,7 @@ static void pcnet_release(struct pcmcia_device *link) ...@@ -706,7 +689,7 @@ static void pcnet_release(struct pcmcia_device *link)
{ {
pcnet_dev_t *info = PRIV(link->priv); pcnet_dev_t *info = PRIV(link->priv);
DEBUG(0, "pcnet_release(0x%p)\n", link); dev_dbg(&link->dev, "pcnet_release\n");
if (info->flags & USE_SHMEM) if (info->flags & USE_SHMEM)
iounmap(info->base); iounmap(info->base);
...@@ -960,7 +943,7 @@ static void mii_phy_probe(struct net_device *dev) ...@@ -960,7 +943,7 @@ static void mii_phy_probe(struct net_device *dev)
phyid = tmp << 16; phyid = tmp << 16;
phyid |= mdio_read(mii_addr, i, MII_PHYID_REG2); phyid |= mdio_read(mii_addr, i, MII_PHYID_REG2);
phyid &= MII_PHYID_REV_MASK; phyid &= MII_PHYID_REV_MASK;
DEBUG(0, "%s: MII at %d is 0x%08x\n", dev->name, i, phyid); pr_debug("%s: MII at %d is 0x%08x\n", dev->name, i, phyid);
if (phyid == AM79C9XX_HOME_PHY) { if (phyid == AM79C9XX_HOME_PHY) {
info->pna_phy = i; info->pna_phy = i;
} else if (phyid != AM79C9XX_ETH_PHY) { } else if (phyid != AM79C9XX_ETH_PHY) {
...@@ -976,7 +959,7 @@ static int pcnet_open(struct net_device *dev) ...@@ -976,7 +959,7 @@ static int pcnet_open(struct net_device *dev)
struct pcmcia_device *link = info->p_dev; struct pcmcia_device *link = info->p_dev;
unsigned int nic_base = dev->base_addr; unsigned int nic_base = dev->base_addr;
DEBUG(2, "pcnet_open('%s')\n", dev->name); dev_dbg(&link->dev, "pcnet_open('%s')\n", dev->name);
if (!pcmcia_dev_present(link)) if (!pcmcia_dev_present(link))
return -ENODEV; return -ENODEV;
...@@ -1008,7 +991,7 @@ static int pcnet_close(struct net_device *dev) ...@@ -1008,7 +991,7 @@ static int pcnet_close(struct net_device *dev)
pcnet_dev_t *info = PRIV(dev); pcnet_dev_t *info = PRIV(dev);
struct pcmcia_device *link = info->p_dev; struct pcmcia_device *link = info->p_dev;
DEBUG(2, "pcnet_close('%s')\n", dev->name); dev_dbg(&link->dev, "pcnet_close('%s')\n", dev->name);
ei_close(dev); ei_close(dev);
free_irq(dev->irq, dev); free_irq(dev->irq, dev);
...@@ -1251,10 +1234,8 @@ static void dma_block_input(struct net_device *dev, int count, ...@@ -1251,10 +1234,8 @@ static void dma_block_input(struct net_device *dev, int count,
int xfer_count = count; int xfer_count = count;
char *buf = skb->data; char *buf = skb->data;
#ifdef PCMCIA_DEBUG
if ((ei_debug > 4) && (count != 4)) if ((ei_debug > 4) && (count != 4))
printk(KERN_DEBUG "%s: [bi=%d]\n", dev->name, count+4); pr_debug("%s: [bi=%d]\n", dev->name, count+4);
#endif
if (ei_status.dmaing) { if (ei_status.dmaing) {
printk(KERN_NOTICE "%s: DMAing conflict in dma_block_input." printk(KERN_NOTICE "%s: DMAing conflict in dma_block_input."
"[DMAstat:%1x][irqlock:%1x]\n", "[DMAstat:%1x][irqlock:%1x]\n",
...@@ -1495,7 +1476,7 @@ static int setup_shmem_window(struct pcmcia_device *link, int start_pg, ...@@ -1495,7 +1476,7 @@ static int setup_shmem_window(struct pcmcia_device *link, int start_pg,
pcnet_dev_t *info = PRIV(dev); pcnet_dev_t *info = PRIV(dev);
win_req_t req; win_req_t req;
memreq_t mem; memreq_t mem;
int i, window_size, offset, last_ret, last_fn; int i, window_size, offset, ret;
window_size = (stop_pg - start_pg) << 8; window_size = (stop_pg - start_pg) << 8;
if (window_size > 32 * 1024) if (window_size > 32 * 1024)
...@@ -1509,13 +1490,17 @@ static int setup_shmem_window(struct pcmcia_device *link, int start_pg, ...@@ -1509,13 +1490,17 @@ static int setup_shmem_window(struct pcmcia_device *link, int start_pg,
req.Attributes |= WIN_USE_WAIT; req.Attributes |= WIN_USE_WAIT;
req.Base = 0; req.Size = window_size; req.Base = 0; req.Size = window_size;
req.AccessSpeed = mem_speed; req.AccessSpeed = mem_speed;
CS_CHECK(RequestWindow, pcmcia_request_window(&link, &req, &link->win)); ret = pcmcia_request_window(link, &req, &link->win);
if (ret)
goto failed;
mem.CardOffset = (start_pg << 8) + cm_offset; mem.CardOffset = (start_pg << 8) + cm_offset;
offset = mem.CardOffset % window_size; offset = mem.CardOffset % window_size;
mem.CardOffset -= offset; mem.CardOffset -= offset;
mem.Page = 0; mem.Page = 0;
CS_CHECK(MapMemPage, pcmcia_map_mem_page(link->win, &mem)); ret = pcmcia_map_mem_page(link, link->win, &mem);
if (ret)
goto failed;
/* Try scribbling on the buffer */ /* Try scribbling on the buffer */
info->base = ioremap(req.Base, window_size); info->base = ioremap(req.Base, window_size);
...@@ -1527,8 +1512,8 @@ static int setup_shmem_window(struct pcmcia_device *link, int start_pg, ...@@ -1527,8 +1512,8 @@ static int setup_shmem_window(struct pcmcia_device *link, int start_pg,
pcnet_reset_8390(dev); pcnet_reset_8390(dev);
if (i != (TX_PAGES<<8)) { if (i != (TX_PAGES<<8)) {
iounmap(info->base); iounmap(info->base);
pcmcia_release_window(link->win); pcmcia_release_window(link, link->win);
info->base = NULL; link->win = NULL; info->base = NULL; link->win = 0;
goto failed; goto failed;
} }
...@@ -1549,8 +1534,6 @@ static int setup_shmem_window(struct pcmcia_device *link, int start_pg, ...@@ -1549,8 +1534,6 @@ static int setup_shmem_window(struct pcmcia_device *link, int start_pg,
info->flags |= USE_SHMEM; info->flags |= USE_SHMEM;
return 0; return 0;
cs_failed:
cs_error(link, last_fn, last_ret);
failed: failed:
return 1; return 1;
} }
...@@ -1788,7 +1771,6 @@ static int __init init_pcnet_cs(void) ...@@ -1788,7 +1771,6 @@ static int __init init_pcnet_cs(void)
static void __exit exit_pcnet_cs(void) static void __exit exit_pcnet_cs(void)
{ {
DEBUG(0, "pcnet_cs: unloading\n");
pcmcia_unregister_driver(&pcnet_driver); pcmcia_unregister_driver(&pcnet_driver);
} }
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -65,35 +65,15 @@ static int __devinit b43_pcmcia_probe(struct pcmcia_device *dev) ...@@ -65,35 +65,15 @@ static int __devinit b43_pcmcia_probe(struct pcmcia_device *dev)
struct ssb_bus *ssb; struct ssb_bus *ssb;
win_req_t win; win_req_t win;
memreq_t mem; memreq_t mem;
tuple_t tuple;
cisparse_t parse;
int err = -ENOMEM; int err = -ENOMEM;
int res = 0; int res = 0;
unsigned char buf[64];
ssb = kzalloc(sizeof(*ssb), GFP_KERNEL); ssb = kzalloc(sizeof(*ssb), GFP_KERNEL);
if (!ssb) if (!ssb)
goto out_error; goto out_error;
err = -ENODEV; err = -ENODEV;
tuple.DesiredTuple = CISTPL_CONFIG;
tuple.Attributes = 0;
tuple.TupleData = buf;
tuple.TupleDataMax = sizeof(buf);
tuple.TupleOffset = 0;
res = pcmcia_get_first_tuple(dev, &tuple);
if (res != 0)
goto err_kfree_ssb;
res = pcmcia_get_tuple_data(dev, &tuple);
if (res != 0)
goto err_kfree_ssb;
res = pcmcia_parse_tuple(&tuple, &parse);
if (res != 0)
goto err_kfree_ssb;
dev->conf.ConfigBase = parse.config.base;
dev->conf.Present = parse.config.rmask[0];
dev->conf.Attributes = CONF_ENABLE_IRQ; dev->conf.Attributes = CONF_ENABLE_IRQ;
dev->conf.IntType = INT_MEMORY_AND_IO; dev->conf.IntType = INT_MEMORY_AND_IO;
...@@ -107,20 +87,18 @@ static int __devinit b43_pcmcia_probe(struct pcmcia_device *dev) ...@@ -107,20 +87,18 @@ static int __devinit b43_pcmcia_probe(struct pcmcia_device *dev)
win.Base = 0; win.Base = 0;
win.Size = SSB_CORE_SIZE; win.Size = SSB_CORE_SIZE;
win.AccessSpeed = 250; win.AccessSpeed = 250;
res = pcmcia_request_window(&dev, &win, &dev->win); res = pcmcia_request_window(dev, &win, &dev->win);
if (res != 0) if (res != 0)
goto err_kfree_ssb; goto err_kfree_ssb;
mem.CardOffset = 0; mem.CardOffset = 0;
mem.Page = 0; mem.Page = 0;
res = pcmcia_map_mem_page(dev->win, &mem); res = pcmcia_map_mem_page(dev, dev->win, &mem);
if (res != 0) if (res != 0)
goto err_disable; goto err_disable;
dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
dev->irq.IRQInfo1 = IRQ_LEVEL_ID;
dev->irq.Handler = NULL; /* The handler is registered later. */ dev->irq.Handler = NULL; /* The handler is registered later. */
dev->irq.Instance = NULL;
res = pcmcia_request_irq(dev, &dev->irq); res = pcmcia_request_irq(dev, &dev->irq);
if (res != 0) if (res != 0)
goto err_disable; goto err_disable;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
#ifndef _INCLUDE_GUARD_PD6729_H_ #ifndef _INCLUDE_GUARD_PD6729_H_
#define _INCLUDE_GUARD_PD6729_H_ #define _INCLUDE_GUARD_PD6729_H_
/* Debuging defines */
#ifdef NOTRACE
#define dprintk(fmt, args...) printk(fmt , ## args)
#else
#define dprintk(fmt, args...) do {} while (0)
#endif
/* Flags for I365_GENCTL */ /* Flags for I365_GENCTL */
#define I365_DF_VS1 0x40 /* DF-step Voltage Sense */ #define I365_DF_VS1 0x40 /* DF-step Voltage Sense */
#define I365_DF_VS2 0x80 #define I365_DF_VS2 0x80
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment