Commit b6537889 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: (22 commits)
  pcmcia: synclink_cs: fix information leak to userland
  pcmcia: don't call flush_scheduled_work() spuriously
  serial_cs: drop spurious flush_scheduled_work() call
  pcmcia/yenta: guide users in case of problems with O2-bridges
  pcmcia: fix unused function compile warning
  pcmcia: vrc4173_cardu: Fix error path for pci_release_regions and pci_disable_device
  pcmcia: add a few debug statements
  pcmcia: remove obsolete and wrong comments
  pcmcia: avoid messages on module (un)loading
  pcmcia: move driver name to struct pcmcia_driver
  pcmcia: remove the "Finally, report what we've done" message
  pcmcia: use autoconfiguration feature for ioports and iomem
  pcmcia: introduce autoconfiguration feature
  pcmcia: Documentation update
  pcmcia: convert pcmcia_request_configuration to pcmcia_enable_device
  pcmcia: move config_{base,index,regs} to struct pcmcia_device
  pcmcia: simplify IntType
  pcmcia: simplify Status, ExtStatus register access
  pcmcia: remove Pin, Copy configuration register access
  pcmcia: move Vpp setup to struct pcmcia_device
  ...
parents 157b6ceb 5b917a14
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:
* pcmcia_loop_config() and autoconfiguration (as of 2.6.36)
If struct pcmcia_device *p_dev->config_flags is set accordingly,
pcmcia_loop_config() now sets up certain configuration values
automatically, though the driver may still override the settings
in the callback function. The following autoconfiguration options
are provided at the moment:
CONF_AUTO_CHECK_VCC : check for matching Vcc
CONF_AUTO_SET_VPP : set Vpp
CONF_AUTO_AUDIO : auto-enable audio line, if required
CONF_AUTO_SET_IO : set ioport resources (->resource[0,1])
CONF_AUTO_SET_IOMEM : set first iomem resource (->resource[2])
* pcmcia_request_configuration -> pcmcia_enable_device (as of 2.6.36)
pcmcia_request_configuration() got renamed to pcmcia_enable_device(),
as it mirrors pcmcia_disable_device(). Configuration settings are now
stored in struct pcmcia_device, e.g. in the fields config_flags,
config_index, config_base, vpp.
* pcmcia_request_window changes (as of 2.6.36)
Instead of win_req_t, drivers are now requested to fill out
struct pcmcia_device *p_dev->resource[2,3,4,5] for up to four ioport
ranges. After a call to pcmcia_request_window(), the regions found there
are reserved and may be used immediately -- until pcmcia_release_window()
is called.
* pcmcia_request_io changes (as of 2.6.36) * pcmcia_request_io changes (as of 2.6.36)
Instead of io_req_t, drivers are now requested to fill out Instead of io_req_t, drivers are now requested to fill out
struct pcmcia_device *p_dev->resource[0,1] for up to two ioport struct pcmcia_device *p_dev->resource[0,1] for up to two ioport
......
...@@ -34,7 +34,6 @@ ...@@ -34,7 +34,6 @@
#include <linux/ata.h> #include <linux/ata.h>
#include <linux/libata.h> #include <linux/libata.h>
#include <pcmcia/cs.h>
#include <pcmcia/cistpl.h> #include <pcmcia/cistpl.h>
#include <pcmcia/ds.h> #include <pcmcia/ds.h>
#include <pcmcia/cisreg.h> #include <pcmcia/cisreg.h>
...@@ -168,63 +167,26 @@ static struct ata_port_operations pcmcia_8bit_port_ops = { ...@@ -168,63 +167,26 @@ static struct ata_port_operations pcmcia_8bit_port_ops = {
}; };
struct pcmcia_config_check { static int pcmcia_check_one_config(struct pcmcia_device *pdev, void *priv_data)
unsigned long ctl_base;
int skip_vcc;
int is_kme;
};
static int pcmcia_check_one_config(struct pcmcia_device *pdev,
cistpl_cftable_entry_t *cfg,
cistpl_cftable_entry_t *dflt,
unsigned int vcc,
void *priv_data)
{ {
struct pcmcia_config_check *stk = priv_data; int *is_kme = priv_data;
/* Check for matching Vcc, unless we're desperate */ if (!(pdev->resource[0]->flags & IO_DATA_PATH_WIDTH_8)) {
if (!stk->skip_vcc) { pdev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) { pdev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
if (vcc != cfg->vcc.param[CISTPL_POWER_VNOM] / 10000)
return -ENODEV;
} else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) {
if (vcc != dflt->vcc.param[CISTPL_POWER_VNOM] / 10000)
return -ENODEV;
}
} }
pdev->resource[1]->flags &= ~IO_DATA_PATH_WIDTH;
pdev->resource[1]->flags |= IO_DATA_PATH_WIDTH_8;
if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM)) if (pdev->resource[1]->end) {
pdev->conf.Vpp = cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000; pdev->resource[0]->end = 8;
else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM)) pdev->resource[1]->end = (*is_kme) ? 2 : 1;
pdev->conf.Vpp = dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000; } else {
if (pdev->resource[0]->end < 16)
if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
pdev->io_lines = io->flags & CISTPL_IO_LINES_MASK;
pdev->resource[0]->start = io->win[0].base;
if (!(io->flags & CISTPL_IO_16BIT)) {
pdev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
pdev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
}
if (io->nwin == 2) {
pdev->resource[0]->end = 8;
pdev->resource[1]->start = io->win[1].base;
pdev->resource[1]->end = (stk->is_kme) ? 2 : 1;
if (pcmcia_request_io(pdev) != 0)
return -ENODEV;
stk->ctl_base = pdev->resource[1]->start;
} else if ((io->nwin == 1) && (io->win[0].len >= 16)) {
pdev->resource[0]->end = io->win[0].len;
pdev->resource[1]->end = 0;
if (pcmcia_request_io(pdev) != 0)
return -ENODEV;
stk->ctl_base = pdev->resource[0]->start + 0x0e;
} else
return -ENODEV; return -ENODEV;
/* If we've got this far, we're done */
return 0;
} }
return -ENODEV;
return pcmcia_request_io(pdev);
} }
/** /**
...@@ -239,7 +201,6 @@ static int pcmcia_init_one(struct pcmcia_device *pdev) ...@@ -239,7 +201,6 @@ static int pcmcia_init_one(struct pcmcia_device *pdev)
{ {
struct ata_host *host; struct ata_host *host;
struct ata_port *ap; struct ata_port *ap;
struct pcmcia_config_check *stk = NULL;
int 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;
...@@ -247,10 +208,8 @@ static int pcmcia_init_one(struct pcmcia_device *pdev) ...@@ -247,10 +208,8 @@ static int pcmcia_init_one(struct pcmcia_device *pdev)
struct ata_port_operations *ops = &pcmcia_port_ops; struct ata_port_operations *ops = &pcmcia_port_ops;
/* Set up attributes in order to probe card and get resources */ /* Set up attributes in order to probe card and get resources */
pdev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; pdev->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO |
pdev->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; CONF_AUTO_SET_VPP | CONF_AUTO_CHECK_VCC;
pdev->conf.Attributes = CONF_ENABLE_IRQ;
pdev->conf.IntType = INT_MEMORY_AND_IO;
/* See if we have a manufacturer identifier. Use it to set is_kme for /* See if we have a manufacturer identifier. Use it to set is_kme for
vendor quirks */ vendor quirks */
...@@ -258,25 +217,21 @@ static int pcmcia_init_one(struct pcmcia_device *pdev) ...@@ -258,25 +217,21 @@ static int pcmcia_init_one(struct pcmcia_device *pdev)
((pdev->card_id == PRODID_KME_KXLC005_A) || ((pdev->card_id == PRODID_KME_KXLC005_A) ||
(pdev->card_id == PRODID_KME_KXLC005_B))); (pdev->card_id == PRODID_KME_KXLC005_B)));
/* Allocate resoure probing structures */ if (pcmcia_loop_config(pdev, pcmcia_check_one_config, &is_kme)) {
pdev->config_flags &= ~CONF_AUTO_CHECK_VCC;
stk = kzalloc(sizeof(*stk), GFP_KERNEL); if (pcmcia_loop_config(pdev, pcmcia_check_one_config, &is_kme))
if (!stk)
goto out1;
stk->is_kme = is_kme;
stk->skip_vcc = io_base = ctl_base = 0;
if (pcmcia_loop_config(pdev, pcmcia_check_one_config, stk)) {
stk->skip_vcc = 1;
if (pcmcia_loop_config(pdev, pcmcia_check_one_config, stk))
goto failed; /* No suitable config found */ goto failed; /* No suitable config found */
} }
io_base = pdev->resource[0]->start; io_base = pdev->resource[0]->start;
ctl_base = stk->ctl_base; if (pdev->resource[1]->end)
ctl_base = pdev->resource[1]->start;
else
ctl_base = pdev->resource[0]->start + 0x0e;
if (!pdev->irq) if (!pdev->irq)
goto failed; goto failed;
ret = pcmcia_request_configuration(pdev, &pdev->conf); ret = pcmcia_enable_device(pdev);
if (ret) if (ret)
goto failed; goto failed;
...@@ -329,13 +284,10 @@ static int pcmcia_init_one(struct pcmcia_device *pdev) ...@@ -329,13 +284,10 @@ static int pcmcia_init_one(struct pcmcia_device *pdev)
goto failed; goto failed;
pdev->priv = host; pdev->priv = host;
kfree(stk);
return 0; return 0;
failed: failed:
kfree(stk);
pcmcia_disable_device(pdev); pcmcia_disable_device(pdev);
out1:
return ret; return ret;
} }
...@@ -430,9 +382,7 @@ MODULE_DEVICE_TABLE(pcmcia, pcmcia_devices); ...@@ -430,9 +382,7 @@ MODULE_DEVICE_TABLE(pcmcia, pcmcia_devices);
static struct pcmcia_driver pcmcia_driver = { static struct pcmcia_driver pcmcia_driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.drv = { .name = DRV_NAME,
.name = DRV_NAME,
},
.id_table = pcmcia_devices, .id_table = pcmcia_devices,
.probe = pcmcia_init_one, .probe = pcmcia_init_one,
.remove = pcmcia_remove_one, .remove = pcmcia_remove_one,
......
...@@ -39,7 +39,6 @@ ...@@ -39,7 +39,6 @@
#include <linux/skbuff.h> #include <linux/skbuff.h>
#include <linux/io.h> #include <linux/io.h>
#include <pcmcia/cs.h>
#include <pcmcia/cistpl.h> #include <pcmcia/cistpl.h>
#include <pcmcia/ciscode.h> #include <pcmcia/ciscode.h>
#include <pcmcia/ds.h> #include <pcmcia/ds.h>
...@@ -865,8 +864,7 @@ static int bluecard_probe(struct pcmcia_device *link) ...@@ -865,8 +864,7 @@ static int bluecard_probe(struct pcmcia_device *link)
info->p_dev = link; info->p_dev = link;
link->priv = info; link->priv = info;
link->conf.Attributes = CONF_ENABLE_IRQ; link->config_flags |= CONF_ENABLE_IRQ;
link->conf.IntType = INT_MEMORY_AND_IO;
return bluecard_config(link); return bluecard_config(link);
} }
...@@ -886,7 +884,7 @@ static int bluecard_config(struct pcmcia_device *link) ...@@ -886,7 +884,7 @@ static int bluecard_config(struct pcmcia_device *link)
bluecard_info_t *info = link->priv; bluecard_info_t *info = link->priv;
int i, n; int i, n;
link->conf.ConfigIndex = 0x20; link->config_index = 0x20;
link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
link->resource[0]->end = 64; link->resource[0]->end = 64;
...@@ -906,7 +904,7 @@ static int bluecard_config(struct pcmcia_device *link) ...@@ -906,7 +904,7 @@ static int bluecard_config(struct pcmcia_device *link)
if (i != 0) if (i != 0)
goto failed; goto failed;
i = pcmcia_request_configuration(link, &link->conf); i = pcmcia_enable_device(link);
if (i != 0) if (i != 0)
goto failed; goto failed;
...@@ -942,9 +940,7 @@ MODULE_DEVICE_TABLE(pcmcia, bluecard_ids); ...@@ -942,9 +940,7 @@ MODULE_DEVICE_TABLE(pcmcia, bluecard_ids);
static struct pcmcia_driver bluecard_driver = { static struct pcmcia_driver bluecard_driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.drv = { .name = "bluecard_cs",
.name = "bluecard_cs",
},
.probe = bluecard_probe, .probe = bluecard_probe,
.remove = bluecard_detach, .remove = bluecard_detach,
.id_table = bluecard_ids, .id_table = bluecard_ids,
......
...@@ -45,7 +45,6 @@ ...@@ -45,7 +45,6 @@
#include <linux/device.h> #include <linux/device.h>
#include <linux/firmware.h> #include <linux/firmware.h>
#include <pcmcia/cs.h>
#include <pcmcia/cistpl.h> #include <pcmcia/cistpl.h>
#include <pcmcia/ciscode.h> #include <pcmcia/ciscode.h>
#include <pcmcia/ds.h> #include <pcmcia/ds.h>
...@@ -657,11 +656,8 @@ static int bt3c_probe(struct pcmcia_device *link) ...@@ -657,11 +656,8 @@ static int bt3c_probe(struct pcmcia_device *link)
info->p_dev = link; info->p_dev = link;
link->priv = info; link->priv = info;
link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_VPP |
link->resource[0]->end = 8; CONF_AUTO_SET_IO;
link->conf.Attributes = CONF_ENABLE_IRQ;
link->conf.IntType = INT_MEMORY_AND_IO;
return bt3c_config(link); return bt3c_config(link);
} }
...@@ -675,43 +671,41 @@ static void bt3c_detach(struct pcmcia_device *link) ...@@ -675,43 +671,41 @@ static void bt3c_detach(struct pcmcia_device *link)
kfree(info); kfree(info);
} }
static int bt3c_check_config(struct pcmcia_device *p_dev, static int bt3c_check_config(struct pcmcia_device *p_dev, void *priv_data)
cistpl_cftable_entry_t *cf,
cistpl_cftable_entry_t *dflt,
unsigned int vcc,
void *priv_data)
{ {
unsigned long try = (unsigned long) priv_data; int *try = priv_data;
p_dev->io_lines = (try == 0) ? 16 : cf->io.flags & CISTPL_IO_LINES_MASK; if (try == 0)
p_dev->io_lines = 16;
if (cf->vpp1.present & (1 << CISTPL_POWER_VNOM)) if ((p_dev->resource[0]->end != 8) || (p_dev->resource[0]->start == 0))
p_dev->conf.Vpp = cf->vpp1.param[CISTPL_POWER_VNOM] / 10000; return -EINVAL;
if ((cf->io.nwin > 0) && (cf->io.win[0].len == 8) &&
(cf->io.win[0].base != 0)) { p_dev->resource[0]->end = 8;
p_dev->resource[0]->start = cf->io.win[0].base; p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
if (!pcmcia_request_io(p_dev)) p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
return 0;
} return pcmcia_request_io(p_dev);
return -ENODEV;
} }
static int bt3c_check_config_notpicky(struct pcmcia_device *p_dev, static int bt3c_check_config_notpicky(struct pcmcia_device *p_dev,
cistpl_cftable_entry_t *cf,
cistpl_cftable_entry_t *dflt,
unsigned int vcc,
void *priv_data) void *priv_data)
{ {
static unsigned int base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 }; static unsigned int base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 };
int j; int j;
if ((cf->io.nwin > 0) && ((cf->io.flags & CISTPL_IO_LINES_MASK) <= 3)) { if (p_dev->io_lines > 3)
for (j = 0; j < 5; j++) { return -ENODEV;
p_dev->resource[0]->start = base[j];
p_dev->io_lines = base[j] ? 16 : 3; p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
if (!pcmcia_request_io(p_dev)) p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
return 0; p_dev->resource[0]->end = 8;
}
for (j = 0; j < 5; j++) {
p_dev->resource[0]->start = base[j];
p_dev->io_lines = base[j] ? 16 : 3;
if (!pcmcia_request_io(p_dev))
return 0;
} }
return -ENODEV; return -ENODEV;
} }
...@@ -742,7 +736,7 @@ static int bt3c_config(struct pcmcia_device *link) ...@@ -742,7 +736,7 @@ static int bt3c_config(struct pcmcia_device *link)
if (i != 0) if (i != 0)
goto failed; goto failed;
i = pcmcia_request_configuration(link, &link->conf); i = pcmcia_enable_device(link);
if (i != 0) if (i != 0)
goto failed; goto failed;
...@@ -775,9 +769,7 @@ MODULE_DEVICE_TABLE(pcmcia, bt3c_ids); ...@@ -775,9 +769,7 @@ MODULE_DEVICE_TABLE(pcmcia, bt3c_ids);
static struct pcmcia_driver bt3c_driver = { static struct pcmcia_driver bt3c_driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.drv = { .name = "bt3c_cs",
.name = "bt3c_cs",
},
.probe = bt3c_probe, .probe = bt3c_probe,
.remove = bt3c_detach, .remove = bt3c_detach,
.id_table = bt3c_ids, .id_table = bt3c_ids,
......
...@@ -41,7 +41,6 @@ ...@@ -41,7 +41,6 @@
#include <asm/system.h> #include <asm/system.h>
#include <asm/io.h> #include <asm/io.h>
#include <pcmcia/cs.h>
#include <pcmcia/cistpl.h> #include <pcmcia/cistpl.h>
#include <pcmcia/ciscode.h> #include <pcmcia/ciscode.h>
#include <pcmcia/ds.h> #include <pcmcia/ds.h>
...@@ -586,11 +585,8 @@ static int btuart_probe(struct pcmcia_device *link) ...@@ -586,11 +585,8 @@ static int btuart_probe(struct pcmcia_device *link)
info->p_dev = link; info->p_dev = link;
link->priv = info; link->priv = info;
link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_VPP |
link->resource[0]->end = 8; CONF_AUTO_SET_IO;
link->conf.Attributes = CONF_ENABLE_IRQ;
link->conf.IntType = INT_MEMORY_AND_IO;
return btuart_config(link); return btuart_config(link);
} }
...@@ -604,43 +600,41 @@ static void btuart_detach(struct pcmcia_device *link) ...@@ -604,43 +600,41 @@ static void btuart_detach(struct pcmcia_device *link)
kfree(info); kfree(info);
} }
static int btuart_check_config(struct pcmcia_device *p_dev, static int btuart_check_config(struct pcmcia_device *p_dev, void *priv_data)
cistpl_cftable_entry_t *cf,
cistpl_cftable_entry_t *dflt,
unsigned int vcc,
void *priv_data)
{ {
int *try = priv_data; int *try = priv_data;
p_dev->io_lines = (try == 0) ? 16 : cf->io.flags & CISTPL_IO_LINES_MASK; if (try == 0)
p_dev->io_lines = 16;
if (cf->vpp1.present & (1 << CISTPL_POWER_VNOM)) if ((p_dev->resource[0]->end != 8) || (p_dev->resource[0]->start == 0))
p_dev->conf.Vpp = cf->vpp1.param[CISTPL_POWER_VNOM] / 10000; return -EINVAL;
if ((cf->io.nwin > 0) && (cf->io.win[0].len == 8) &&
(cf->io.win[0].base != 0)) { p_dev->resource[0]->end = 8;
p_dev->resource[0]->start = cf->io.win[0].base; p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
if (!pcmcia_request_io(p_dev)) p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
return 0;
} return pcmcia_request_io(p_dev);
return -ENODEV;
} }
static int btuart_check_config_notpicky(struct pcmcia_device *p_dev, static int btuart_check_config_notpicky(struct pcmcia_device *p_dev,
cistpl_cftable_entry_t *cf,
cistpl_cftable_entry_t *dflt,
unsigned int vcc,
void *priv_data) void *priv_data)
{ {
static unsigned int base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 }; static unsigned int base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 };
int j; int j;
if ((cf->io.nwin > 0) && ((cf->io.flags & CISTPL_IO_LINES_MASK) <= 3)) { if (p_dev->io_lines > 3)
for (j = 0; j < 5; j++) { return -ENODEV;
p_dev->resource[0]->start = base[j];
p_dev->io_lines = base[j] ? 16 : 3; p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
if (!pcmcia_request_io(p_dev)) p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
return 0; p_dev->resource[0]->end = 8;
}
for (j = 0; j < 5; j++) {
p_dev->resource[0]->start = base[j];
p_dev->io_lines = base[j] ? 16 : 3;
if (!pcmcia_request_io(p_dev))
return 0;
} }
return -ENODEV; return -ENODEV;
} }
...@@ -671,7 +665,7 @@ static int btuart_config(struct pcmcia_device *link) ...@@ -671,7 +665,7 @@ static int btuart_config(struct pcmcia_device *link)
if (i != 0) if (i != 0)
goto failed; goto failed;
i = pcmcia_request_configuration(link, &link->conf); i = pcmcia_enable_device(link);
if (i != 0) if (i != 0)
goto failed; goto failed;
...@@ -703,9 +697,7 @@ MODULE_DEVICE_TABLE(pcmcia, btuart_ids); ...@@ -703,9 +697,7 @@ MODULE_DEVICE_TABLE(pcmcia, btuart_ids);
static struct pcmcia_driver btuart_driver = { static struct pcmcia_driver btuart_driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.drv = { .name = "btuart_cs",
.name = "btuart_cs",
},
.probe = btuart_probe, .probe = btuart_probe,
.remove = btuart_detach, .remove = btuart_detach,
.id_table = btuart_ids, .id_table = btuart_ids,
......
...@@ -41,7 +41,6 @@ ...@@ -41,7 +41,6 @@
#include <asm/system.h> #include <asm/system.h>
#include <asm/io.h> #include <asm/io.h>
#include <pcmcia/cs.h>
#include <pcmcia/cistpl.h> #include <pcmcia/cistpl.h>
#include <pcmcia/ciscode.h> #include <pcmcia/ciscode.h>
#include <pcmcia/ds.h> #include <pcmcia/ds.h>
...@@ -572,11 +571,7 @@ static int dtl1_probe(struct pcmcia_device *link) ...@@ -572,11 +571,7 @@ static int dtl1_probe(struct pcmcia_device *link)
info->p_dev = link; info->p_dev = link;
link->priv = info; link->priv = info;
link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO;
link->resource[0]->end = 8;
link->conf.Attributes = CONF_ENABLE_IRQ;
link->conf.IntType = INT_MEMORY_AND_IO;
return dtl1_config(link); return dtl1_config(link);
} }
...@@ -591,18 +586,14 @@ static void dtl1_detach(struct pcmcia_device *link) ...@@ -591,18 +586,14 @@ static void dtl1_detach(struct pcmcia_device *link)
kfree(info); kfree(info);
} }
static int dtl1_confcheck(struct pcmcia_device *p_dev, static int dtl1_confcheck(struct pcmcia_device *p_dev, void *priv_data)
cistpl_cftable_entry_t *cf,
cistpl_cftable_entry_t *dflt,
unsigned int vcc,
void *priv_data)
{ {
if ((cf->io.nwin != 1) || (cf->io.win[0].len <= 8)) if ((p_dev->resource[1]->end) || (p_dev->resource[1]->end < 8))
return -ENODEV; return -ENODEV;
p_dev->resource[0]->start = cf->io.win[0].base; p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
p_dev->resource[0]->end = cf->io.win[0].len; /*yo */ p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
p_dev->io_lines = cf->io.flags & CISTPL_IO_LINES_MASK;
return pcmcia_request_io(p_dev); return pcmcia_request_io(p_dev);
} }
...@@ -620,7 +611,7 @@ static int dtl1_config(struct pcmcia_device *link) ...@@ -620,7 +611,7 @@ static int dtl1_config(struct pcmcia_device *link)
if (i != 0) if (i != 0)
goto failed; goto failed;
i = pcmcia_request_configuration(link, &link->conf); i = pcmcia_enable_device(link);
if (i != 0) if (i != 0)
goto failed; goto failed;
...@@ -656,9 +647,7 @@ MODULE_DEVICE_TABLE(pcmcia, dtl1_ids); ...@@ -656,9 +647,7 @@ MODULE_DEVICE_TABLE(pcmcia, dtl1_ids);
static struct pcmcia_driver dtl1_driver = { static struct pcmcia_driver dtl1_driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.drv = { .name = "dtl1_cs",
.name = "dtl1_cs",
},
.probe = dtl1_probe, .probe = dtl1_probe,
.remove = dtl1_detach, .remove = dtl1_detach,
.id_table = dtl1_ids, .id_table = dtl1_ids,
......
...@@ -34,7 +34,6 @@ ...@@ -34,7 +34,6 @@
#include <linux/uaccess.h> #include <linux/uaccess.h>
#include <linux/io.h> #include <linux/io.h>
#include <pcmcia/cs.h>
#include <pcmcia/cistpl.h> #include <pcmcia/cistpl.h>
#include <pcmcia/cisreg.h> #include <pcmcia/cisreg.h>
#include <pcmcia/ciscode.h> #include <pcmcia/ciscode.h>
...@@ -55,8 +54,6 @@ ...@@ -55,8 +54,6 @@
__func__ , ## args); \ __func__ , ## args); \
} while (0) } while (0)
static char *version = "cm4000_cs.c v2.4.0gm6 - All bugs added by Harald Welte";
#define T_1SEC (HZ) #define T_1SEC (HZ)
#define T_10MSEC msecs_to_jiffies(10) #define T_10MSEC msecs_to_jiffies(10)
#define T_20MSEC msecs_to_jiffies(20) #define T_20MSEC msecs_to_jiffies(20)
...@@ -1742,20 +1739,8 @@ static void cmm_cm4000_release(struct pcmcia_device * link) ...@@ -1742,20 +1739,8 @@ static void cmm_cm4000_release(struct pcmcia_device * link)
/*==== Interface to PCMCIA Layer =======================================*/ /*==== Interface to PCMCIA Layer =======================================*/
static int cm4000_config_check(struct pcmcia_device *p_dev, static int cm4000_config_check(struct pcmcia_device *p_dev, void *priv_data)
cistpl_cftable_entry_t *cfg,
cistpl_cftable_entry_t *dflt,
unsigned int vcc,
void *priv_data)
{ {
if (!cfg->io.nwin)
return -ENODEV;
p_dev->resource[0]->start = cfg->io.win[0].base;
p_dev->resource[0]->end = cfg->io.win[0].len;
p_dev->resource[0]->flags |= pcmcia_io_cfg_data_width(cfg->io.flags);
p_dev->io_lines = cfg->io.flags & CISTPL_IO_LINES_MASK;
return pcmcia_request_io(p_dev); return pcmcia_request_io(p_dev);
} }
...@@ -1763,13 +1748,13 @@ static int cm4000_config(struct pcmcia_device * link, int devno) ...@@ -1763,13 +1748,13 @@ static int cm4000_config(struct pcmcia_device * link, int devno)
{ {
struct cm4000_dev *dev; struct cm4000_dev *dev;
link->config_flags |= CONF_AUTO_SET_IO;
/* read the config-tuples */ /* read the config-tuples */
if (pcmcia_loop_config(link, cm4000_config_check, NULL)) if (pcmcia_loop_config(link, cm4000_config_check, NULL))
goto cs_release; goto cs_release;
link->conf.IntType = 00000002; if (pcmcia_enable_device(link))
if (pcmcia_request_configuration(link, &link->conf))
goto cs_release; goto cs_release;
dev = link->priv; dev = link->priv;
...@@ -1829,7 +1814,6 @@ static int cm4000_probe(struct pcmcia_device *link) ...@@ -1829,7 +1814,6 @@ static int cm4000_probe(struct pcmcia_device *link)
dev->p_dev = link; dev->p_dev = link;
link->priv = dev; link->priv = dev;
link->conf.IntType = INT_MEMORY_AND_IO;
dev_table[i] = link; dev_table[i] = link;
init_waitqueue_head(&dev->devq); init_waitqueue_head(&dev->devq);
...@@ -1891,9 +1875,7 @@ MODULE_DEVICE_TABLE(pcmcia, cm4000_ids); ...@@ -1891,9 +1875,7 @@ MODULE_DEVICE_TABLE(pcmcia, cm4000_ids);
static struct pcmcia_driver cm4000_driver = { static struct pcmcia_driver cm4000_driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.drv = { .name = "cm4000_cs",
.name = "cm4000_cs",
},
.probe = cm4000_probe, .probe = cm4000_probe,
.remove = cm4000_detach, .remove = cm4000_detach,
.suspend = cm4000_suspend, .suspend = cm4000_suspend,
...@@ -1905,8 +1887,6 @@ static int __init cmm_init(void) ...@@ -1905,8 +1887,6 @@ static int __init cmm_init(void)
{ {
int rc; int rc;
printk(KERN_INFO "%s\n", version);
cmm_class = class_create(THIS_MODULE, "cardman_4000"); cmm_class = class_create(THIS_MODULE, "cardman_4000");
if (IS_ERR(cmm_class)) if (IS_ERR(cmm_class))
return PTR_ERR(cmm_class); return PTR_ERR(cmm_class);
...@@ -1931,7 +1911,6 @@ static int __init cmm_init(void) ...@@ -1931,7 +1911,6 @@ static int __init cmm_init(void)
static void __exit cmm_exit(void) static void __exit cmm_exit(void)
{ {
printk(KERN_INFO MODULE_NAME ": unloading\n");
pcmcia_unregister_driver(&cm4000_driver); pcmcia_unregister_driver(&cm4000_driver);
unregister_chrdev(major, DEVICE_NAME); unregister_chrdev(major, DEVICE_NAME);
class_destroy(cmm_class); class_destroy(cmm_class);
......
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/io.h> #include <asm/io.h>
#include <pcmcia/cs.h>
#include <pcmcia/cistpl.h> #include <pcmcia/cistpl.h>
#include <pcmcia/cisreg.h> #include <pcmcia/cisreg.h>
#include <pcmcia/ciscode.h> #include <pcmcia/ciscode.h>
...@@ -49,9 +48,6 @@ ...@@ -49,9 +48,6 @@
__func__ , ## args); \ __func__ , ## args); \
} while (0) } while (0)
static char *version =
"OMNIKEY CardMan 4040 v1.1.0gm5 - All bugs added by Harald Welte";
#define CCID_DRIVER_BULK_DEFAULT_TIMEOUT (150*HZ) #define CCID_DRIVER_BULK_DEFAULT_TIMEOUT (150*HZ)
#define CCID_DRIVER_ASYNC_POWERUP_TIMEOUT (35*HZ) #define CCID_DRIVER_ASYNC_POWERUP_TIMEOUT (35*HZ)
#define CCID_DRIVER_MINIMUM_TIMEOUT (3*HZ) #define CCID_DRIVER_MINIMUM_TIMEOUT (3*HZ)
...@@ -516,26 +512,9 @@ static void cm4040_reader_release(struct pcmcia_device *link) ...@@ -516,26 +512,9 @@ static void cm4040_reader_release(struct pcmcia_device *link)
return; return;
} }
static int cm4040_config_check(struct pcmcia_device *p_dev, static int cm4040_config_check(struct pcmcia_device *p_dev, void *priv_data)
cistpl_cftable_entry_t *cfg,
cistpl_cftable_entry_t *dflt,
unsigned int vcc,
void *priv_data)
{ {
int rc; return pcmcia_request_io(p_dev);
if (!cfg->io.nwin)
return -ENODEV;
/* Get the IOaddr */
p_dev->resource[0]->start = cfg->io.win[0].base;
p_dev->resource[0]->end = cfg->io.win[0].len;
p_dev->resource[0]->flags |= pcmcia_io_cfg_data_width(cfg->io.flags);
p_dev->io_lines = cfg->io.flags & CISTPL_IO_LINES_MASK;
rc = pcmcia_request_io(p_dev);
dev_printk(KERN_INFO, &p_dev->dev,
"pcmcia_request_io returned 0x%x\n", rc);
return rc;
} }
...@@ -544,15 +523,15 @@ static int reader_config(struct pcmcia_device *link, int devno) ...@@ -544,15 +523,15 @@ static int reader_config(struct pcmcia_device *link, int devno)
struct reader_dev *dev; struct reader_dev *dev;
int fail_rc; int fail_rc;
link->config_flags |= CONF_AUTO_SET_IO;
if (pcmcia_loop_config(link, cm4040_config_check, NULL)) if (pcmcia_loop_config(link, cm4040_config_check, NULL))
goto cs_release; goto cs_release;
link->conf.IntType = 00000002; fail_rc = pcmcia_enable_device(link);
fail_rc = pcmcia_request_configuration(link, &link->conf);
if (fail_rc != 0) { if (fail_rc != 0) {
dev_printk(KERN_INFO, &link->dev, dev_printk(KERN_INFO, &link->dev,
"pcmcia_request_configuration failed 0x%x\n", "pcmcia_enable_device failed 0x%x\n",
fail_rc); fail_rc);
goto cs_release; goto cs_release;
} }
...@@ -599,7 +578,6 @@ static int reader_probe(struct pcmcia_device *link) ...@@ -599,7 +578,6 @@ static int reader_probe(struct pcmcia_device *link)
link->priv = dev; link->priv = dev;
dev->p_dev = link; dev->p_dev = link;
link->conf.IntType = INT_MEMORY_AND_IO;
dev_table[i] = link; dev_table[i] = link;
init_waitqueue_head(&dev->devq); init_waitqueue_head(&dev->devq);
...@@ -662,9 +640,7 @@ MODULE_DEVICE_TABLE(pcmcia, cm4040_ids); ...@@ -662,9 +640,7 @@ MODULE_DEVICE_TABLE(pcmcia, cm4040_ids);
static struct pcmcia_driver reader_driver = { static struct pcmcia_driver reader_driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.drv = { .name = "cm4040_cs",
.name = "cm4040_cs",
},
.probe = reader_probe, .probe = reader_probe,
.remove = reader_detach, .remove = reader_detach,
.id_table = cm4040_ids, .id_table = cm4040_ids,
...@@ -674,7 +650,6 @@ static int __init cm4040_init(void) ...@@ -674,7 +650,6 @@ static int __init cm4040_init(void)
{ {
int rc; int rc;
printk(KERN_INFO "%s\n", version);
cmx_class = class_create(THIS_MODULE, "cardman_4040"); cmx_class = class_create(THIS_MODULE, "cardman_4040");
if (IS_ERR(cmx_class)) if (IS_ERR(cmx_class))
return PTR_ERR(cmx_class); return PTR_ERR(cmx_class);
...@@ -699,7 +674,6 @@ static int __init cm4040_init(void) ...@@ -699,7 +674,6 @@ static int __init cm4040_init(void)
static void __exit cm4040_exit(void) static void __exit cm4040_exit(void)
{ {
printk(KERN_INFO MODULE_NAME ": unloading\n");
pcmcia_unregister_driver(&reader_driver); pcmcia_unregister_driver(&reader_driver);
unregister_chrdev(major, DEVICE_NAME); unregister_chrdev(major, DEVICE_NAME);
class_destroy(cmx_class); class_destroy(cmx_class);
......
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
#include <pcmcia/device_id.h> #include <pcmcia/device_id.h>
#include <pcmcia/ss.h> #include <pcmcia/ss.h>
#include <pcmcia/ds.h> #include <pcmcia/ds.h>
#include <pcmcia/cs.h>
static struct pcmcia_device_id ipw_ids[] = { static struct pcmcia_device_id ipw_ids[] = {
PCMCIA_DEVICE_MANF_CARD(0x02f2, 0x0100), PCMCIA_DEVICE_MANF_CARD(0x02f2, 0x0100),
...@@ -76,23 +75,18 @@ static void signalled_reboot_callback(void *callback_data) ...@@ -76,23 +75,18 @@ static void signalled_reboot_callback(void *callback_data)
schedule_work(&ipw->work_reboot); schedule_work(&ipw->work_reboot);
} }
static int ipwireless_probe(struct pcmcia_device *p_dev, static int ipwireless_probe(struct pcmcia_device *p_dev, void *priv_data)
cistpl_cftable_entry_t *cfg,
cistpl_cftable_entry_t *dflt,
unsigned int vcc,
void *priv_data)
{ {
struct ipw_dev *ipw = priv_data; struct ipw_dev *ipw = priv_data;
struct resource *io_resource; struct resource *io_resource;
int ret; int ret;
p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
p_dev->resource[0]->start = cfg->io.win[0].base;
p_dev->resource[0]->end = cfg->io.win[0].len;
/* 0x40 causes it to generate level mode interrupts. */ /* 0x40 causes it to generate level mode interrupts. */
/* 0x04 enables IREQ pin. */ /* 0x04 enables IREQ pin. */
p_dev->conf.ConfigIndex = cfg->index | 0x44; p_dev->config_index |= 0x44;
p_dev->io_lines = 16; p_dev->io_lines = 16;
ret = pcmcia_request_io(p_dev); ret = pcmcia_request_io(p_dev);
if (ret) if (ret)
...@@ -102,65 +96,49 @@ static int ipwireless_probe(struct pcmcia_device *p_dev, ...@@ -102,65 +96,49 @@ static int ipwireless_probe(struct pcmcia_device *p_dev,
resource_size(p_dev->resource[0]), resource_size(p_dev->resource[0]),
IPWIRELESS_PCCARD_NAME); IPWIRELESS_PCCARD_NAME);
if (cfg->mem.nwin == 0) p_dev->resource[2]->flags |=
return 0;
ipw->request_common_memory.Attributes =
WIN_DATA_WIDTH_16 | WIN_MEMORY_TYPE_CM | WIN_ENABLE; WIN_DATA_WIDTH_16 | WIN_MEMORY_TYPE_CM | WIN_ENABLE;
ipw->request_common_memory.Base = cfg->mem.win[0].host_addr;
ipw->request_common_memory.Size = cfg->mem.win[0].len;
if (ipw->request_common_memory.Size < 0x1000)
ipw->request_common_memory.Size = 0x1000;
ipw->request_common_memory.AccessSpeed = 0;
ret = pcmcia_request_window(p_dev, &ipw->request_common_memory,
&ipw->handle_common_memory);
ret = pcmcia_request_window(p_dev, p_dev->resource[2], 0);
if (ret != 0) if (ret != 0)
goto exit1; goto exit1;
ret = pcmcia_map_mem_page(p_dev, ipw->handle_common_memory, ret = pcmcia_map_mem_page(p_dev, p_dev->resource[2], p_dev->card_addr);
cfg->mem.win[0].card_addr);
if (ret != 0) if (ret != 0)
goto exit2; goto exit2;
ipw->is_v2_card = cfg->mem.win[0].len == 0x100; ipw->is_v2_card = resource_size(p_dev->resource[2]) == 0x100;
ipw->common_memory = ioremap(ipw->request_common_memory.Base, ipw->attr_memory = ioremap(p_dev->resource[2]->start,
ipw->request_common_memory.Size); resource_size(p_dev->resource[2]));
request_mem_region(ipw->request_common_memory.Base, request_mem_region(p_dev->resource[2]->start,
ipw->request_common_memory.Size, resource_size(p_dev->resource[2]),
IPWIRELESS_PCCARD_NAME); IPWIRELESS_PCCARD_NAME);
ipw->request_attr_memory.Attributes = p_dev->resource[3]->flags |= WIN_DATA_WIDTH_16 | WIN_MEMORY_TYPE_AM |
WIN_DATA_WIDTH_16 | WIN_MEMORY_TYPE_AM | WIN_ENABLE; WIN_ENABLE;
ipw->request_attr_memory.Base = 0; p_dev->resource[3]->end = 0; /* this used to be 0x1000 */
ipw->request_attr_memory.Size = 0; /* this used to be 0x1000 */ ret = pcmcia_request_window(p_dev, p_dev->resource[3], 0);
ipw->request_attr_memory.AccessSpeed = 0;
ret = pcmcia_request_window(p_dev, &ipw->request_attr_memory,
&ipw->handle_attr_memory);
if (ret != 0) if (ret != 0)
goto exit2; goto exit2;
ret = pcmcia_map_mem_page(p_dev, ipw->handle_attr_memory, 0); ret = pcmcia_map_mem_page(p_dev, p_dev->resource[3], 0);
if (ret != 0) if (ret != 0)
goto exit3; goto exit3;
ipw->attr_memory = ioremap(ipw->request_attr_memory.Base, ipw->attr_memory = ioremap(p_dev->resource[3]->start,
ipw->request_attr_memory.Size); resource_size(p_dev->resource[3]));
request_mem_region(ipw->request_attr_memory.Base, request_mem_region(p_dev->resource[3]->start,
ipw->request_attr_memory.Size, IPWIRELESS_PCCARD_NAME); resource_size(p_dev->resource[3]),
IPWIRELESS_PCCARD_NAME);
return 0; return 0;
exit3: exit3:
exit2: exit2:
if (ipw->common_memory) { if (ipw->common_memory) {
release_mem_region(ipw->request_common_memory.Base, release_mem_region(p_dev->resource[2]->start,
ipw->request_common_memory.Size); resource_size(p_dev->resource[2]));
iounmap(ipw->common_memory); iounmap(ipw->common_memory);
} }
exit1: exit1:
...@@ -175,14 +153,13 @@ static int config_ipwireless(struct ipw_dev *ipw) ...@@ -175,14 +153,13 @@ static int config_ipwireless(struct ipw_dev *ipw)
int ret = 0; int ret = 0;
ipw->is_v2_card = 0; ipw->is_v2_card = 0;
link->config_flags |= CONF_AUTO_SET_IO | CONF_AUTO_SET_IOMEM |
CONF_ENABLE_IRQ;
ret = pcmcia_loop_config(link, ipwireless_probe, ipw); ret = pcmcia_loop_config(link, ipwireless_probe, ipw);
if (ret != 0) if (ret != 0)
return ret; return ret;
link->conf.Attributes = CONF_ENABLE_IRQ;
link->conf.IntType = INT_MEMORY_AND_IO;
INIT_WORK(&ipw->work_reboot, signalled_reboot_work); INIT_WORK(&ipw->work_reboot, signalled_reboot_work);
ipwireless_init_hardware_v1(ipw->hardware, link->resource[0]->start, ipwireless_init_hardware_v1(ipw->hardware, link->resource[0]->start,
...@@ -201,13 +178,9 @@ static int config_ipwireless(struct ipw_dev *ipw) ...@@ -201,13 +178,9 @@ static int config_ipwireless(struct ipw_dev *ipw)
(unsigned int) link->irq); (unsigned int) link->irq);
if (ipw->attr_memory && ipw->common_memory) if (ipw->attr_memory && ipw->common_memory)
printk(KERN_INFO IPWIRELESS_PCCARD_NAME printk(KERN_INFO IPWIRELESS_PCCARD_NAME
": attr memory 0x%08lx-0x%08lx, common memory 0x%08lx-0x%08lx\n", ": attr memory %pR, common memory %pR\n",
ipw->request_attr_memory.Base, link->resource[3],
ipw->request_attr_memory.Base link->resource[2]);
+ ipw->request_attr_memory.Size - 1,
ipw->request_common_memory.Base,
ipw->request_common_memory.Base
+ ipw->request_common_memory.Size - 1);
ipw->network = ipwireless_network_create(ipw->hardware); ipw->network = ipwireless_network_create(ipw->hardware);
if (!ipw->network) if (!ipw->network)
...@@ -223,25 +196,23 @@ static int config_ipwireless(struct ipw_dev *ipw) ...@@ -223,25 +196,23 @@ static int config_ipwireless(struct ipw_dev *ipw)
* Do the RequestConfiguration last, because it enables interrupts. * Do the RequestConfiguration last, because it enables interrupts.
* Then we don't get any interrupts before we're ready for them. * Then we don't get any interrupts before we're ready for them.
*/ */
ret = pcmcia_request_configuration(link, &link->conf); ret = pcmcia_enable_device(link);
if (ret != 0) if (ret != 0)
goto exit; goto exit;
return 0; return 0;
exit: exit:
if (ipw->attr_memory) {
release_mem_region(ipw->request_attr_memory.Base,
ipw->request_attr_memory.Size);
iounmap(ipw->attr_memory);
}
if (ipw->common_memory) { if (ipw->common_memory) {
release_mem_region(ipw->request_common_memory.Base, release_mem_region(link->resource[2]->start,
ipw->request_common_memory.Size); resource_size(link->resource[2]));
iounmap(ipw->common_memory); iounmap(ipw->common_memory);
} }
if (ipw->attr_memory) {
release_mem_region(link->resource[3]->start,
resource_size(link->resource[3]));
iounmap(ipw->attr_memory);
}
pcmcia_disable_device(link); pcmcia_disable_device(link);
return -1; return -1;
} }
...@@ -249,13 +220,13 @@ static int config_ipwireless(struct ipw_dev *ipw) ...@@ -249,13 +220,13 @@ static int config_ipwireless(struct ipw_dev *ipw)
static void release_ipwireless(struct ipw_dev *ipw) static void release_ipwireless(struct ipw_dev *ipw)
{ {
if (ipw->common_memory) { if (ipw->common_memory) {
release_mem_region(ipw->request_common_memory.Base, release_mem_region(ipw->link->resource[2]->start,
ipw->request_common_memory.Size); resource_size(ipw->link->resource[2]));
iounmap(ipw->common_memory); iounmap(ipw->common_memory);
} }
if (ipw->attr_memory) { if (ipw->attr_memory) {
release_mem_region(ipw->request_attr_memory.Base, release_mem_region(ipw->link->resource[3]->start,
ipw->request_attr_memory.Size); resource_size(ipw->link->resource[3]));
iounmap(ipw->attr_memory); iounmap(ipw->attr_memory);
} }
pcmcia_disable_device(ipw->link); pcmcia_disable_device(ipw->link);
...@@ -324,7 +295,7 @@ static struct pcmcia_driver me = { ...@@ -324,7 +295,7 @@ static struct pcmcia_driver me = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.probe = ipwireless_attach, .probe = ipwireless_attach,
.remove = ipwireless_detach, .remove = ipwireless_detach,
.drv = { .name = IPWIRELESS_PCCARD_NAME }, .name = IPWIRELESS_PCCARD_NAME,
.id_table = ipw_ids .id_table = ipw_ids
}; };
...@@ -336,9 +307,6 @@ static int __init init_ipwireless(void) ...@@ -336,9 +307,6 @@ static int __init init_ipwireless(void)
{ {
int ret; int ret;
printk(KERN_INFO IPWIRELESS_PCCARD_NAME " "
IPWIRELESS_PCMCIA_VERSION " by " IPWIRELESS_PCMCIA_AUTHOR "\n");
ret = ipwireless_tty_init(); ret = ipwireless_tty_init();
if (ret != 0) if (ret != 0)
return ret; return ret;
...@@ -355,9 +323,6 @@ static int __init init_ipwireless(void) ...@@ -355,9 +323,6 @@ static int __init init_ipwireless(void)
*/ */
static void __exit exit_ipwireless(void) static void __exit exit_ipwireless(void)
{ {
printk(KERN_INFO IPWIRELESS_PCCARD_NAME " "
IPWIRELESS_PCMCIA_VERSION " removed\n");
pcmcia_unregister_driver(&me); pcmcia_unregister_driver(&me);
ipwireless_tty_release(); ipwireless_tty_release();
} }
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/types.h> #include <linux/types.h>
#include <pcmcia/cs.h>
#include <pcmcia/cistpl.h> #include <pcmcia/cistpl.h>
#include <pcmcia/ds.h> #include <pcmcia/ds.h>
...@@ -45,13 +44,9 @@ struct ipw_dev { ...@@ -45,13 +44,9 @@ struct ipw_dev {
struct pcmcia_device *link; struct pcmcia_device *link;
int is_v2_card; int is_v2_card;
window_handle_t handle_attr_memory;
void __iomem *attr_memory; void __iomem *attr_memory;
win_req_t request_attr_memory;
window_handle_t handle_common_memory;
void __iomem *common_memory; void __iomem *common_memory;
win_req_t request_common_memory;
/* Reference to attribute memory, containing CIS data */ /* Reference to attribute memory, containing CIS data */
void *attribute_memory; void *attribute_memory;
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#include <linux/types.h> #include <linux/types.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <pcmcia/cs.h>
#include <pcmcia/cistpl.h> #include <pcmcia/cistpl.h>
#include <pcmcia/ds.h> #include <pcmcia/ds.h>
......
...@@ -70,7 +70,6 @@ ...@@ -70,7 +70,6 @@
#include <linux/workqueue.h> #include <linux/workqueue.h>
#include <linux/hdlc.h> #include <linux/hdlc.h>
#include <pcmcia/cs.h>
#include <pcmcia/cistpl.h> #include <pcmcia/cistpl.h>
#include <pcmcia/cisreg.h> #include <pcmcia/cisreg.h>
#include <pcmcia/ds.h> #include <pcmcia/ds.h>
...@@ -550,9 +549,6 @@ static int mgslpc_probe(struct pcmcia_device *link) ...@@ -550,9 +549,6 @@ static int mgslpc_probe(struct pcmcia_device *link)
/* Initialize the struct pcmcia_device structure */ /* Initialize the struct pcmcia_device structure */
link->conf.Attributes = 0;
link->conf.IntType = INT_MEMORY_AND_IO;
ret = mgslpc_config(link); ret = mgslpc_config(link);
if (ret) if (ret)
return ret; return ret;
...@@ -565,20 +561,8 @@ static int mgslpc_probe(struct pcmcia_device *link) ...@@ -565,20 +561,8 @@ static int mgslpc_probe(struct pcmcia_device *link)
/* Card has been inserted. /* Card has been inserted.
*/ */
static int mgslpc_ioprobe(struct pcmcia_device *p_dev, static int mgslpc_ioprobe(struct pcmcia_device *p_dev, void *priv_data)
cistpl_cftable_entry_t *cfg,
cistpl_cftable_entry_t *dflt,
unsigned int vcc,
void *priv_data)
{ {
if (!cfg->io.nwin)
return -ENODEV;
p_dev->resource[0]->start = cfg->io.win[0].base;
p_dev->resource[0]->end = cfg->io.win[0].len;
p_dev->resource[0]->flags |= pcmcia_io_cfg_data_width(cfg->io.flags);
p_dev->io_lines = cfg->io.flags & CISTPL_IO_LINES_MASK;
return pcmcia_request_io(p_dev); return pcmcia_request_io(p_dev);
} }
...@@ -590,32 +574,24 @@ static int mgslpc_config(struct pcmcia_device *link) ...@@ -590,32 +574,24 @@ static int mgslpc_config(struct pcmcia_device *link)
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);
link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO;
ret = pcmcia_loop_config(link, mgslpc_ioprobe, NULL); ret = pcmcia_loop_config(link, mgslpc_ioprobe, NULL);
if (ret != 0) if (ret != 0)
goto failed; goto failed;
link->conf.Attributes = CONF_ENABLE_IRQ; link->config_index = 8;
link->conf.IntType = INT_MEMORY_AND_IO; link->config_regs = PRESENT_OPTION;
link->conf.ConfigIndex = 8;
link->conf.Present = PRESENT_OPTION;
ret = pcmcia_request_irq(link, mgslpc_isr); ret = pcmcia_request_irq(link, mgslpc_isr);
if (ret) if (ret)
goto failed; goto failed;
ret = pcmcia_request_configuration(link, &link->conf); ret = pcmcia_enable_device(link);
if (ret) if (ret)
goto failed; goto failed;
info->io_base = link->resource[0]->start; info->io_base = link->resource[0]->start;
info->irq_level = link->irq; info->irq_level = link->irq;
dev_info(&link->dev, "index 0x%02x:",
link->conf.ConfigIndex);
if (link->conf.Attributes & CONF_ENABLE_IRQ)
printk(", irq %d", link->irq);
if (link->resource[0])
printk(", io %pR", link->resource[0]);
printk("\n");
return 0; return 0;
failed: failed:
...@@ -2797,9 +2773,7 @@ MODULE_DEVICE_TABLE(pcmcia, mgslpc_ids); ...@@ -2797,9 +2773,7 @@ MODULE_DEVICE_TABLE(pcmcia, mgslpc_ids);
static struct pcmcia_driver mgslpc_driver = { static struct pcmcia_driver mgslpc_driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.drv = { .name = "synclink_cs",
.name = "synclink_cs",
},
.probe = mgslpc_probe, .probe = mgslpc_probe,
.remove = mgslpc_detach, .remove = mgslpc_detach,
.id_table = mgslpc_ids, .id_table = mgslpc_ids,
...@@ -2835,8 +2809,6 @@ static void synclink_cs_cleanup(void) ...@@ -2835,8 +2809,6 @@ static void synclink_cs_cleanup(void)
{ {
int rc; int rc;
printk("Unloading %s: version %s\n", driver_name, driver_version);
while(mgslpc_device_list) while(mgslpc_device_list)
mgslpc_remove_device(mgslpc_device_list); mgslpc_remove_device(mgslpc_device_list);
...@@ -2859,8 +2831,6 @@ static int __init synclink_cs_init(void) ...@@ -2859,8 +2831,6 @@ static int __init synclink_cs_init(void)
BREAKPOINT(); BREAKPOINT();
} }
printk("%s %s\n", driver_name, driver_version);
if ((rc = pcmcia_register_driver(&mgslpc_driver)) < 0) if ((rc = pcmcia_register_driver(&mgslpc_driver)) < 0)
return rc; return rc;
...@@ -4127,6 +4097,8 @@ static int hdlcdev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) ...@@ -4127,6 +4097,8 @@ static int hdlcdev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
if (cmd != SIOCWANDEV) if (cmd != SIOCWANDEV)
return hdlc_ioctl(dev, ifr, cmd); return hdlc_ioctl(dev, ifr, cmd);
memset(&new_line, 0, size);
switch(ifr->ifr_settings.type) { switch(ifr->ifr_settings.type) {
case IF_GET_IFACE: /* return current sync_serial_settings */ case IF_GET_IFACE: /* return current sync_serial_settings */
......
...@@ -43,7 +43,6 @@ ...@@ -43,7 +43,6 @@
#include <asm/io.h> #include <asm/io.h>
#include <asm/system.h> #include <asm/system.h>
#include <pcmcia/cs.h>
#include <pcmcia/cistpl.h> #include <pcmcia/cistpl.h>
#include <pcmcia/ds.h> #include <pcmcia/ds.h>
#include <pcmcia/cisreg.h> #include <pcmcia/cisreg.h>
...@@ -72,17 +71,6 @@ static int ide_config(struct pcmcia_device *); ...@@ -72,17 +71,6 @@ static int ide_config(struct pcmcia_device *);
static void ide_detach(struct pcmcia_device *p_dev); static void ide_detach(struct pcmcia_device *p_dev);
/*======================================================================
ide_attach() creates an "instance" of the driver, allocating
local data structures for one device. The device is registered
with Card Services.
======================================================================*/
static int ide_probe(struct pcmcia_device *link) static int ide_probe(struct pcmcia_device *link)
{ {
ide_info_t *info; ide_info_t *info;
...@@ -97,23 +85,12 @@ static int ide_probe(struct pcmcia_device *link) ...@@ -97,23 +85,12 @@ static int ide_probe(struct pcmcia_device *link)
info->p_dev = link; info->p_dev = link;
link->priv = info; link->priv = info;
link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO |
link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; CONF_AUTO_SET_VPP | CONF_AUTO_CHECK_VCC;
link->conf.Attributes = CONF_ENABLE_IRQ;
link->conf.IntType = INT_MEMORY_AND_IO;
return ide_config(link); return ide_config(link);
} /* ide_attach */ } /* ide_attach */
/*======================================================================
This deletes a driver "instance". The device is de-registered
with Card Services. If it has been released, all local data
structures are freed. Otherwise, the structures will be freed
when the device is released.
======================================================================*/
static void ide_detach(struct pcmcia_device *link) static void ide_detach(struct pcmcia_device *link)
{ {
ide_info_t *info = link->priv; ide_info_t *info = link->priv;
...@@ -187,79 +164,31 @@ static struct ide_host *idecs_register(unsigned long io, unsigned long ctl, ...@@ -187,79 +164,31 @@ static struct ide_host *idecs_register(unsigned long io, unsigned long ctl,
return NULL; return NULL;
} }
/*====================================================================== static int pcmcia_check_one_config(struct pcmcia_device *pdev, void *priv_data)
ide_config() is scheduled to run after a CARD_INSERTION event
is received, to configure the PCMCIA socket, and to make the
ide device available to the system.
======================================================================*/
struct pcmcia_config_check {
unsigned long ctl_base;
int skip_vcc;
int is_kme;
};
static int pcmcia_check_one_config(struct pcmcia_device *pdev,
cistpl_cftable_entry_t *cfg,
cistpl_cftable_entry_t *dflt,
unsigned int vcc,
void *priv_data)
{ {
struct pcmcia_config_check *stk = priv_data; int *is_kme = priv_data;
/* Check for matching Vcc, unless we're desperate */
if (!stk->skip_vcc) {
if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) {
if (vcc != cfg->vcc.param[CISTPL_POWER_VNOM] / 10000)
return -ENODEV;
} else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) {
if (vcc != dflt->vcc.param[CISTPL_POWER_VNOM] / 10000)
return -ENODEV;
}
}
if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM)) if (!(pdev->resource[0]->flags & IO_DATA_PATH_WIDTH_8)) {
pdev->conf.Vpp = cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000; pdev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM)) pdev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
pdev->conf.Vpp = dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000; }
pdev->resource[1]->flags &= ~IO_DATA_PATH_WIDTH;
if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { pdev->resource[1]->flags |= IO_DATA_PATH_WIDTH_8;
cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
pdev->io_lines = io->flags & CISTPL_IO_LINES_MASK; if (pdev->resource[1]->end) {
pdev->resource[0]->end = 8;
pdev->conf.ConfigIndex = cfg->index; pdev->resource[1]->end = (*is_kme) ? 2 : 1;
pdev->resource[0]->start = io->win[0].base; } else {
if (!(io->flags & CISTPL_IO_16BIT)) { if (pdev->resource[0]->end < 16)
pdev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
pdev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
}
if (io->nwin == 2) {
pdev->resource[0]->end = 8;
pdev->resource[1]->start = io->win[1].base;
pdev->resource[1]->end = (stk->is_kme) ? 2 : 1;
if (pcmcia_request_io(pdev) != 0)
return -ENODEV;
stk->ctl_base = pdev->resource[1]->start;
} else if ((io->nwin == 1) && (io->win[0].len >= 16)) {
pdev->resource[0]->end = io->win[0].len;
pdev->resource[1]->end = 0;
if (pcmcia_request_io(pdev) != 0)
return -ENODEV;
stk->ctl_base = pdev->resource[0]->start + 0x0e;
} else
return -ENODEV; return -ENODEV;
/* If we've got this far, we're done */
return 0;
} }
return -ENODEV;
return pcmcia_request_io(pdev);
} }
static int ide_config(struct pcmcia_device *link) 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;
int ret = 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;
...@@ -270,23 +199,21 @@ static int ide_config(struct pcmcia_device *link) ...@@ -270,23 +199,21 @@ static int ide_config(struct pcmcia_device *link)
((link->card_id == PRODID_KME_KXLC005_A) || ((link->card_id == PRODID_KME_KXLC005_A) ||
(link->card_id == PRODID_KME_KXLC005_B))); (link->card_id == PRODID_KME_KXLC005_B)));
stk = kzalloc(sizeof(*stk), GFP_KERNEL); if (pcmcia_loop_config(link, pcmcia_check_one_config, &is_kme)) {
if (!stk) link->config_flags &= ~CONF_AUTO_CHECK_VCC;
goto err_mem; if (pcmcia_loop_config(link, pcmcia_check_one_config, &is_kme))
stk->is_kme = is_kme;
stk->skip_vcc = io_base = ctl_base = 0;
if (pcmcia_loop_config(link, pcmcia_check_one_config, stk)) {
stk->skip_vcc = 1;
if (pcmcia_loop_config(link, pcmcia_check_one_config, stk))
goto failed; /* No suitable config found */ goto failed; /* No suitable config found */
} }
io_base = link->resource[0]->start; io_base = link->resource[0]->start;
ctl_base = stk->ctl_base; if (link->resource[1]->end)
ctl_base = link->resource[1]->start;
else
ctl_base = link->resource[0]->start + 0x0e;
if (!link->irq) if (!link->irq)
goto failed; goto failed;
ret = pcmcia_request_configuration(link, &link->conf);
ret = pcmcia_enable_device(link);
if (ret) if (ret)
goto failed; goto failed;
...@@ -311,29 +238,15 @@ static int ide_config(struct pcmcia_device *link) ...@@ -311,29 +238,15 @@ static int ide_config(struct pcmcia_device *link)
info->host = host; info->host = host;
dev_info(&link->dev, "ide-cs: hd%c: Vpp = %d.%d\n", dev_info(&link->dev, "ide-cs: hd%c: Vpp = %d.%d\n",
'a' + host->ports[0]->index * 2, 'a' + host->ports[0]->index * 2,
link->conf.Vpp / 10, link->conf.Vpp % 10); link->vpp / 10, link->vpp % 10);
kfree(stk);
return 0; return 0;
err_mem:
printk(KERN_NOTICE "ide-cs: ide_config failed memory allocation\n");
goto failed;
failed: failed:
kfree(stk);
ide_release(link); ide_release(link);
return -ENODEV; return -ENODEV;
} /* ide_config */ } /* ide_config */
/*======================================================================
After a card is removed, ide_release() will unregister the net
device, and release the PCMCIA configuration. If the device is
still open, this will be postponed until it is closed.
======================================================================*/
static void ide_release(struct pcmcia_device *link) static void ide_release(struct pcmcia_device *link)
{ {
ide_info_t *info = link->priv; ide_info_t *info = link->priv;
...@@ -359,15 +272,6 @@ static void ide_release(struct pcmcia_device *link) ...@@ -359,15 +272,6 @@ static void ide_release(struct pcmcia_device *link)
} /* ide_release */ } /* ide_release */
/*======================================================================
The card status event handler. Mostly, this schedules other
stuff to run after an event is received. A CARD_REMOVAL event
also sets some flags to discourage the ide drivers from
talking to the ports.
======================================================================*/
static struct pcmcia_device_id ide_ids[] = { static struct pcmcia_device_id ide_ids[] = {
PCMCIA_DEVICE_FUNC_ID(4), PCMCIA_DEVICE_FUNC_ID(4),
PCMCIA_DEVICE_MANF_CARD(0x0000, 0x0000), /* Corsair */ PCMCIA_DEVICE_MANF_CARD(0x0000, 0x0000), /* Corsair */
...@@ -440,9 +344,7 @@ MODULE_DEVICE_TABLE(pcmcia, ide_ids); ...@@ -440,9 +344,7 @@ MODULE_DEVICE_TABLE(pcmcia, ide_ids);
static struct pcmcia_driver ide_cs_driver = { static struct pcmcia_driver ide_cs_driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.drv = { .name = "ide-cs",
.name = "ide-cs",
},
.probe = ide_probe, .probe = ide_probe,
.remove = ide_detach, .remove = ide_detach,
.id_table = ide_ids, .id_table = ide_ids,
......
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
#include <asm/io.h> #include <asm/io.h>
#include <asm/system.h> #include <asm/system.h>
#include <pcmcia/cs.h>
#include <pcmcia/cistpl.h> #include <pcmcia/cistpl.h>
#include <pcmcia/ciscode.h> #include <pcmcia/ciscode.h>
#include <pcmcia/ds.h> #include <pcmcia/ds.h>
...@@ -39,87 +38,32 @@ MODULE_LICENSE("GPL"); ...@@ -39,87 +38,32 @@ MODULE_LICENSE("GPL");
/*====================================================================*/ /*====================================================================*/
/*
The event() function is this driver's Card Services event handler.
It will be called by Card Services when an appropriate card status
event is received. The config() and release() entry points are
used to configure or release a socket, in response to card insertion
and ejection events. They are invoked from the skeleton event
handler.
*/
static int avmcs_config(struct pcmcia_device *link); static int avmcs_config(struct pcmcia_device *link);
static void avmcs_release(struct pcmcia_device *link); static void avmcs_release(struct pcmcia_device *link);
/*
The attach() and detach() entry points are used to create and destroy
"instances" of the driver, where each instance represents everything
needed to manage one actual PCMCIA card.
*/
static void avmcs_detach(struct pcmcia_device *p_dev); static void avmcs_detach(struct pcmcia_device *p_dev);
/*======================================================================
avmcs_attach() creates an "instance" of the driver, allocating
local data structures for one device. The device is registered
with Card Services.
The dev_link structure is initialized, but we don't actually
configure the card at this point -- we wait until we receive a
card insertion event.
======================================================================*/
static int avmcs_probe(struct pcmcia_device *p_dev) static int avmcs_probe(struct pcmcia_device *p_dev)
{ {
/* The io structure describes IO port mapping */
p_dev->resource[0]->end = 16;
p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
/* General socket configuration */ /* General socket configuration */
p_dev->conf.Attributes = CONF_ENABLE_IRQ; p_dev->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO;
p_dev->conf.IntType = INT_MEMORY_AND_IO; p_dev->config_index = 1;
p_dev->conf.ConfigIndex = 1; p_dev->config_regs = PRESENT_OPTION;
p_dev->conf.Present = PRESENT_OPTION;
return avmcs_config(p_dev); return avmcs_config(p_dev);
} /* avmcs_attach */ } /* avmcs_attach */
/*======================================================================
This deletes a driver "instance". The device is de-registered
with Card Services. If it has been released, all local data
structures are freed. Otherwise, the structures will be freed
when the device is released.
======================================================================*/
static void avmcs_detach(struct pcmcia_device *link) static void avmcs_detach(struct pcmcia_device *link)
{ {
avmcs_release(link); avmcs_release(link);
} /* avmcs_detach */ } /* avmcs_detach */
/*====================================================================== static int avmcs_configcheck(struct pcmcia_device *p_dev, void *priv_data)
avmcs_config() is scheduled to run after a CARD_INSERTION event
is received, to configure the PCMCIA socket, and to make the
ethernet device available to the system.
======================================================================*/
static int avmcs_configcheck(struct pcmcia_device *p_dev,
cistpl_cftable_entry_t *cf,
cistpl_cftable_entry_t *dflt,
unsigned int vcc,
void *priv_data)
{ {
if (cf->io.nwin <= 0) p_dev->resource[0]->end = 16;
return -ENODEV; p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
p_dev->resource[0]->start = cf->io.win[0].base;
p_dev->resource[0]->end = cf->io.win[0].len;
return pcmcia_request_io(p_dev); return pcmcia_request_io(p_dev);
} }
...@@ -150,7 +94,7 @@ static int avmcs_config(struct pcmcia_device *link) ...@@ -150,7 +94,7 @@ static int avmcs_config(struct pcmcia_device *link)
/* /*
* configure the PCMCIA socket * configure the PCMCIA socket
*/ */
i = pcmcia_request_configuration(link, &link->conf); i = pcmcia_enable_device(link);
if (i != 0) { if (i != 0) {
pcmcia_disable_device(link); pcmcia_disable_device(link);
break; break;
...@@ -197,13 +141,6 @@ static int avmcs_config(struct pcmcia_device *link) ...@@ -197,13 +141,6 @@ static int avmcs_config(struct pcmcia_device *link)
} /* avmcs_config */ } /* avmcs_config */
/*======================================================================
After a card is removed, avmcs_release() will unregister the net
device, and release the PCMCIA configuration. If the device is
still open, this will be postponed until it is closed.
======================================================================*/
static void avmcs_release(struct pcmcia_device *link) static void avmcs_release(struct pcmcia_device *link)
{ {
...@@ -222,9 +159,7 @@ MODULE_DEVICE_TABLE(pcmcia, avmcs_ids); ...@@ -222,9 +159,7 @@ MODULE_DEVICE_TABLE(pcmcia, avmcs_ids);
static struct pcmcia_driver avmcs_driver = { static struct pcmcia_driver avmcs_driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.drv = { .name = "avm_cs",
.name = "avm_cs",
},
.probe = avmcs_probe, .probe = avmcs_probe,
.remove = avmcs_detach, .remove = avmcs_detach,
.id_table = avmcs_ids, .id_table = avmcs_ids,
......
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
#include <asm/io.h> #include <asm/io.h>
#include <asm/system.h> #include <asm/system.h>
#include <pcmcia/cs.h>
#include <pcmcia/cistpl.h> #include <pcmcia/cistpl.h>
#include <pcmcia/ds.h> #include <pcmcia/ds.h>
#include "hisax_cfg.h" #include "hisax_cfg.h"
...@@ -40,67 +39,22 @@ module_param(isdnprot, int, 0); ...@@ -40,67 +39,22 @@ module_param(isdnprot, int, 0);
/*====================================================================*/ /*====================================================================*/
/*
The event() function is this driver's Card Services event handler.
It will be called by Card Services when an appropriate card status
event is received. The config() and release() entry points are
used to configure or release a socket, in response to card insertion
and ejection events. They are invoked from the skeleton event
handler.
*/
static int avma1cs_config(struct pcmcia_device *link) __devinit ; static int avma1cs_config(struct pcmcia_device *link) __devinit ;
static void avma1cs_release(struct pcmcia_device *link); static void avma1cs_release(struct pcmcia_device *link);
/*
The attach() and detach() entry points are used to create and destroy
"instances" of the driver, where each instance represents everything
needed to manage one actual PCMCIA card.
*/
static void avma1cs_detach(struct pcmcia_device *p_dev) __devexit ; static void avma1cs_detach(struct pcmcia_device *p_dev) __devexit ;
/*======================================================================
avma1cs_attach() creates an "instance" of the driver, allocating
local data structures for one device. The device is registered
with Card Services.
The dev_link structure is initialized, but we don't actually
configure the card at this point -- we wait until we receive a
card insertion event.
======================================================================*/
static int __devinit avma1cs_probe(struct pcmcia_device *p_dev) static int __devinit avma1cs_probe(struct pcmcia_device *p_dev)
{ {
dev_dbg(&p_dev->dev, "avma1cs_attach()\n"); dev_dbg(&p_dev->dev, "avma1cs_attach()\n");
/* The io structure describes IO port mapping */
p_dev->resource[0]->end = 16;
p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
p_dev->resource[1]->end = 16;
p_dev->resource[1]->flags |= IO_DATA_PATH_WIDTH_16;
/* General socket configuration */ /* General socket configuration */
p_dev->conf.Attributes = CONF_ENABLE_IRQ; p_dev->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO;
p_dev->conf.IntType = INT_MEMORY_AND_IO; p_dev->config_index = 1;
p_dev->conf.ConfigIndex = 1; p_dev->config_regs = PRESENT_OPTION;
p_dev->conf.Present = PRESENT_OPTION;
return avma1cs_config(p_dev); return avma1cs_config(p_dev);
} /* avma1cs_attach */ } /* avma1cs_attach */
/*======================================================================
This deletes a driver "instance". The device is de-registered
with Card Services. If it has been released, all local data
structures are freed. Otherwise, the structures will be freed
when the device is released.
======================================================================*/
static void __devexit avma1cs_detach(struct pcmcia_device *link) static void __devexit avma1cs_detach(struct pcmcia_device *link)
{ {
dev_dbg(&link->dev, "avma1cs_detach(0x%p)\n", link); dev_dbg(&link->dev, "avma1cs_detach(0x%p)\n", link);
...@@ -108,26 +62,13 @@ static void __devexit avma1cs_detach(struct pcmcia_device *link) ...@@ -108,26 +62,13 @@ static void __devexit avma1cs_detach(struct pcmcia_device *link)
kfree(link->priv); kfree(link->priv);
} /* avma1cs_detach */ } /* avma1cs_detach */
/*====================================================================== static int avma1cs_configcheck(struct pcmcia_device *p_dev, void *priv_data)
avma1cs_config() is scheduled to run after a CARD_INSERTION event
is received, to configure the PCMCIA socket, and to make the
ethernet device available to the system.
======================================================================*/
static int avma1cs_configcheck(struct pcmcia_device *p_dev,
cistpl_cftable_entry_t *cf,
cistpl_cftable_entry_t *dflt,
unsigned int vcc,
void *priv_data)
{ {
if (cf->io.nwin <= 0) p_dev->resource[0]->end = 16;
return -ENODEV; p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
p_dev->resource[0]->start = cf->io.win[0].base;
p_dev->resource[0]->end = cf->io.win[0].len;
p_dev->io_lines = 5; p_dev->io_lines = 5;
return pcmcia_request_io(p_dev); return pcmcia_request_io(p_dev);
} }
...@@ -161,7 +102,7 @@ static int __devinit avma1cs_config(struct pcmcia_device *link) ...@@ -161,7 +102,7 @@ static int __devinit avma1cs_config(struct pcmcia_device *link)
/* /*
* configure the PCMCIA socket * configure the PCMCIA socket
*/ */
i = pcmcia_request_configuration(link, &link->conf); i = pcmcia_enable_device(link);
if (i != 0) { if (i != 0) {
pcmcia_disable_device(link); pcmcia_disable_device(link);
break; break;
...@@ -175,9 +116,6 @@ static int __devinit avma1cs_config(struct pcmcia_device *link) ...@@ -175,9 +116,6 @@ static int __devinit avma1cs_config(struct pcmcia_device *link)
return -ENODEV; return -ENODEV;
} }
printk(KERN_NOTICE "avma1_cs: checking at i/o %#x, irq %d\n",
(unsigned int) link->resource[0]->start, link->irq);
icard.para[0] = link->irq; icard.para[0] = link->irq;
icard.para[1] = link->resource[0]->start; icard.para[1] = link->resource[0]->start;
icard.protocol = isdnprot; icard.protocol = isdnprot;
...@@ -196,14 +134,6 @@ static int __devinit avma1cs_config(struct pcmcia_device *link) ...@@ -196,14 +134,6 @@ static int __devinit avma1cs_config(struct pcmcia_device *link)
return 0; return 0;
} /* avma1cs_config */ } /* avma1cs_config */
/*======================================================================
After a card is removed, avma1cs_release() will unregister the net
device, and release the PCMCIA configuration. If the device is
still open, this will be postponed until it is closed.
======================================================================*/
static void avma1cs_release(struct pcmcia_device *link) static void avma1cs_release(struct pcmcia_device *link)
{ {
unsigned long minor = (unsigned long) link->priv; unsigned long minor = (unsigned long) link->priv;
...@@ -216,7 +146,6 @@ static void avma1cs_release(struct pcmcia_device *link) ...@@ -216,7 +146,6 @@ static void avma1cs_release(struct pcmcia_device *link)
pcmcia_disable_device(link); pcmcia_disable_device(link);
} /* avma1cs_release */ } /* avma1cs_release */
static struct pcmcia_device_id avma1cs_ids[] = { static struct pcmcia_device_id avma1cs_ids[] = {
PCMCIA_DEVICE_PROD_ID12("AVM", "ISDN A", 0x95d42008, 0xadc9d4bb), PCMCIA_DEVICE_PROD_ID12("AVM", "ISDN A", 0x95d42008, 0xadc9d4bb),
PCMCIA_DEVICE_PROD_ID12("ISDN", "CARD", 0x8d9761c8, 0x01c5aa7b), PCMCIA_DEVICE_PROD_ID12("ISDN", "CARD", 0x8d9761c8, 0x01c5aa7b),
...@@ -226,19 +155,15 @@ MODULE_DEVICE_TABLE(pcmcia, avma1cs_ids); ...@@ -226,19 +155,15 @@ MODULE_DEVICE_TABLE(pcmcia, avma1cs_ids);
static struct pcmcia_driver avma1cs_driver = { static struct pcmcia_driver avma1cs_driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.drv = { .name = "avma1_cs",
.name = "avma1_cs",
},
.probe = avma1cs_probe, .probe = avma1cs_probe,
.remove = __devexit_p(avma1cs_detach), .remove = __devexit_p(avma1cs_detach),
.id_table = avma1cs_ids, .id_table = avma1cs_ids,
}; };
/*====================================================================*/
static int __init init_avma1_cs(void) static int __init init_avma1_cs(void)
{ {
return(pcmcia_register_driver(&avma1cs_driver)); return pcmcia_register_driver(&avma1cs_driver);
} }
static void __exit exit_avma1_cs(void) static void __exit exit_avma1_cs(void)
......
...@@ -46,7 +46,6 @@ ...@@ -46,7 +46,6 @@
#include <asm/io.h> #include <asm/io.h>
#include <asm/system.h> #include <asm/system.h>
#include <pcmcia/cs.h>
#include <pcmcia/cistpl.h> #include <pcmcia/cistpl.h>
#include <pcmcia/cisreg.h> #include <pcmcia/cisreg.h>
#include <pcmcia/ds.h> #include <pcmcia/ds.h>
...@@ -64,26 +63,8 @@ MODULE_LICENSE("Dual MPL/GPL"); ...@@ -64,26 +63,8 @@ MODULE_LICENSE("Dual MPL/GPL");
static int protocol = 2; /* EURO-ISDN Default */ static int protocol = 2; /* EURO-ISDN Default */
module_param(protocol, int, 0); module_param(protocol, int, 0);
/*====================================================================*/
/*
The event() function is this driver's Card Services event handler.
It will be called by Card Services when an appropriate card status
event is received. The config() and release() entry points are
used to configure or release a socket, in response to card insertion
and ejection events. They are invoked from the elsa_cs event
handler.
*/
static int elsa_cs_config(struct pcmcia_device *link) __devinit ; static int elsa_cs_config(struct pcmcia_device *link) __devinit ;
static void elsa_cs_release(struct pcmcia_device *link); static void elsa_cs_release(struct pcmcia_device *link);
/*
The attach() and detach() entry points are used to create and destroy
"instances" of the driver, where each instance represents everything
needed to manage one actual PCMCIA card.
*/
static void elsa_cs_detach(struct pcmcia_device *p_dev) __devexit; static void elsa_cs_detach(struct pcmcia_device *p_dev) __devexit;
typedef struct local_info_t { typedef struct local_info_t {
...@@ -92,18 +73,6 @@ typedef struct local_info_t { ...@@ -92,18 +73,6 @@ typedef struct local_info_t {
int cardnr; int cardnr;
} local_info_t; } local_info_t;
/*======================================================================
elsa_cs_attach() creates an "instance" of the driver, allocatingx
local data structures for one device. The device is registered
with Card Services.
The dev_link structure is initialized, but we don't actually
configure the card at this point -- we wait until we receive a
card insertion event.
======================================================================*/
static int __devinit elsa_cs_probe(struct pcmcia_device *link) static int __devinit elsa_cs_probe(struct pcmcia_device *link)
{ {
local_info_t *local; local_info_t *local;
...@@ -119,31 +88,9 @@ static int __devinit elsa_cs_probe(struct pcmcia_device *link) ...@@ -119,31 +88,9 @@ static int __devinit elsa_cs_probe(struct pcmcia_device *link)
local->cardnr = -1; local->cardnr = -1;
/*
General socket configuration defaults can go here. In this
client, we assume very little, and rely on the CIS for almost
everything. In most clients, many details (i.e., number, sizes,
and attributes of IO windows) are fixed by the nature of the
device, and can be hard-wired here.
*/
link->resource[0]->end = 8;
link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
link->conf.Attributes = CONF_ENABLE_IRQ;
link->conf.IntType = INT_MEMORY_AND_IO;
return elsa_cs_config(link); return elsa_cs_config(link);
} /* elsa_cs_attach */ } /* elsa_cs_attach */
/*======================================================================
This deletes a driver "instance". The device is de-registered
with Card Services. If it has been released, all local data
structures are freed. Otherwise, the structures will be freed
when the device is released.
======================================================================*/
static void __devexit elsa_cs_detach(struct pcmcia_device *link) static void __devexit elsa_cs_detach(struct pcmcia_device *link)
{ {
local_info_t *info = link->priv; local_info_t *info = link->priv;
...@@ -156,27 +103,17 @@ static void __devexit elsa_cs_detach(struct pcmcia_device *link) ...@@ -156,27 +103,17 @@ static void __devexit elsa_cs_detach(struct pcmcia_device *link)
kfree(info); kfree(info);
} /* elsa_cs_detach */ } /* elsa_cs_detach */
/*====================================================================== static int elsa_cs_configcheck(struct pcmcia_device *p_dev, void *priv_data)
elsa_cs_config() is scheduled to run after a CARD_INSERTION event
is received, to configure the PCMCIA socket, and to make the
device available to the system.
======================================================================*/
static int elsa_cs_configcheck(struct pcmcia_device *p_dev,
cistpl_cftable_entry_t *cf,
cistpl_cftable_entry_t *dflt,
unsigned int vcc,
void *priv_data)
{ {
int j; int j;
p_dev->io_lines = 3; p_dev->io_lines = 3;
p_dev->resource[0]->end = 8;
p_dev->resource[0]->flags &= IO_DATA_PATH_WIDTH;
p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
if ((cf->io.nwin > 0) && cf->io.win[0].base) { if ((p_dev->resource[0]->end) && p_dev->resource[0]->start) {
printk(KERN_INFO "(elsa_cs: looks like the 96 model)\n"); printk(KERN_INFO "(elsa_cs: looks like the 96 model)\n");
p_dev->resource[0]->start = cf->io.win[0].base;
if (!pcmcia_request_io(p_dev)) if (!pcmcia_request_io(p_dev))
return 0; return 0;
} else { } else {
...@@ -199,6 +136,8 @@ static int __devinit elsa_cs_config(struct pcmcia_device *link) ...@@ -199,6 +136,8 @@ static int __devinit elsa_cs_config(struct pcmcia_device *link)
dev_dbg(&link->dev, "elsa_config(0x%p)\n", link); dev_dbg(&link->dev, "elsa_config(0x%p)\n", link);
dev = link->priv; dev = link->priv;
link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO;
i = pcmcia_loop_config(link, elsa_cs_configcheck, NULL); i = pcmcia_loop_config(link, elsa_cs_configcheck, NULL);
if (i != 0) if (i != 0)
goto failed; goto failed;
...@@ -206,21 +145,10 @@ static int __devinit elsa_cs_config(struct pcmcia_device *link) ...@@ -206,21 +145,10 @@ static int __devinit elsa_cs_config(struct pcmcia_device *link)
if (!link->irq) if (!link->irq)
goto failed; goto failed;
i = pcmcia_request_configuration(link, &link->conf); i = pcmcia_enable_device(link);
if (i != 0) if (i != 0)
goto failed; goto failed;
/* Finally, report what we've done */
dev_info(&link->dev, "index 0x%02x: ",
link->conf.ConfigIndex);
if (link->conf.Attributes & CONF_ENABLE_IRQ)
printk(", irq %d", link->irq);
if (link->resource[0])
printk(" & %pR", link->resource[0]);
if (link->resource[1])
printk(" & %pR", link->resource[1]);
printk("\n");
icard.para[0] = link->irq; icard.para[0] = link->irq;
icard.para[1] = link->resource[0]->start; icard.para[1] = link->resource[0]->start;
icard.protocol = protocol; icard.protocol = protocol;
...@@ -240,14 +168,6 @@ static int __devinit elsa_cs_config(struct pcmcia_device *link) ...@@ -240,14 +168,6 @@ static int __devinit elsa_cs_config(struct pcmcia_device *link)
return -ENODEV; return -ENODEV;
} /* elsa_cs_config */ } /* elsa_cs_config */
/*======================================================================
After a card is removed, elsa_cs_release() will unregister the net
device, and release the PCMCIA configuration. If the device is
still open, this will be postponed until it is closed.
======================================================================*/
static void elsa_cs_release(struct pcmcia_device *link) static void elsa_cs_release(struct pcmcia_device *link)
{ {
local_info_t *local = link->priv; local_info_t *local = link->priv;
...@@ -291,9 +211,7 @@ MODULE_DEVICE_TABLE(pcmcia, elsa_ids); ...@@ -291,9 +211,7 @@ MODULE_DEVICE_TABLE(pcmcia, elsa_ids);
static struct pcmcia_driver elsa_cs_driver = { static struct pcmcia_driver elsa_cs_driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.drv = { .name = "elsa_cs",
.name = "elsa_cs",
},
.probe = elsa_cs_probe, .probe = elsa_cs_probe,
.remove = __devexit_p(elsa_cs_detach), .remove = __devexit_p(elsa_cs_detach),
.id_table = elsa_ids, .id_table = elsa_ids,
......
...@@ -46,7 +46,6 @@ ...@@ -46,7 +46,6 @@
#include <asm/io.h> #include <asm/io.h>
#include <asm/system.h> #include <asm/system.h>
#include <pcmcia/cs.h>
#include <pcmcia/cistpl.h> #include <pcmcia/cistpl.h>
#include <pcmcia/cisreg.h> #include <pcmcia/cisreg.h>
#include <pcmcia/ds.h> #include <pcmcia/ds.h>
...@@ -64,26 +63,9 @@ MODULE_LICENSE("Dual MPL/GPL"); ...@@ -64,26 +63,9 @@ MODULE_LICENSE("Dual MPL/GPL");
static int protocol = 2; /* EURO-ISDN Default */ static int protocol = 2; /* EURO-ISDN Default */
module_param(protocol, int, 0); module_param(protocol, int, 0);
/*====================================================================*/
/*
The event() function is this driver's Card Services event handler.
It will be called by Card Services when an appropriate card status
event is received. The config() and release() entry points are
used to configure or release a socket, in response to card
insertion and ejection events. They are invoked from the sedlbauer
event handler.
*/
static int sedlbauer_config(struct pcmcia_device *link) __devinit ; static int sedlbauer_config(struct pcmcia_device *link) __devinit ;
static void sedlbauer_release(struct pcmcia_device *link); static void sedlbauer_release(struct pcmcia_device *link);
/*
The attach() and detach() entry points are used to create and destroy
"instances" of the driver, where each instance represents everything
needed to manage one actual PCMCIA card.
*/
static void sedlbauer_detach(struct pcmcia_device *p_dev) __devexit; static void sedlbauer_detach(struct pcmcia_device *p_dev) __devexit;
typedef struct local_info_t { typedef struct local_info_t {
...@@ -92,18 +74,6 @@ typedef struct local_info_t { ...@@ -92,18 +74,6 @@ typedef struct local_info_t {
int cardnr; int cardnr;
} local_info_t; } local_info_t;
/*======================================================================
sedlbauer_attach() creates an "instance" of the driver, allocating
local data structures for one device. The device is registered
with Card Services.
The dev_link structure is initialized, but we don't actually
configure the card at this point -- we wait until we receive a
card insertion event.
======================================================================*/
static int __devinit sedlbauer_probe(struct pcmcia_device *link) static int __devinit sedlbauer_probe(struct pcmcia_device *link)
{ {
local_info_t *local; local_info_t *local;
...@@ -118,35 +88,9 @@ static int __devinit sedlbauer_probe(struct pcmcia_device *link) ...@@ -118,35 +88,9 @@ static int __devinit sedlbauer_probe(struct pcmcia_device *link)
local->p_dev = link; local->p_dev = link;
link->priv = local; link->priv = local;
/*
General socket configuration defaults can go here. In this
client, we assume very little, and rely on the CIS for almost
everything. In most clients, many details (i.e., number, sizes,
and attributes of IO windows) are fixed by the nature of the
device, and can be hard-wired here.
*/
/* from old sedl_cs
*/
/* The io structure describes IO port mapping */
link->resource[0]->end = 8;
link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
link->conf.Attributes = 0;
link->conf.IntType = INT_MEMORY_AND_IO;
return sedlbauer_config(link); return sedlbauer_config(link);
} /* sedlbauer_attach */ } /* sedlbauer_attach */
/*======================================================================
This deletes a driver "instance". The device is de-registered
with Card Services. If it has been released, all local data
structures are freed. Otherwise, the structures will be freed
when the device is released.
======================================================================*/
static void __devexit sedlbauer_detach(struct pcmcia_device *link) static void __devexit sedlbauer_detach(struct pcmcia_device *link)
{ {
dev_dbg(&link->dev, "sedlbauer_detach(0x%p)\n", link); dev_dbg(&link->dev, "sedlbauer_detach(0x%p)\n", link);
...@@ -158,70 +102,15 @@ static void __devexit sedlbauer_detach(struct pcmcia_device *link) ...@@ -158,70 +102,15 @@ static void __devexit sedlbauer_detach(struct pcmcia_device *link)
kfree(link->priv); kfree(link->priv);
} /* sedlbauer_detach */ } /* sedlbauer_detach */
/*====================================================================== static int sedlbauer_config_check(struct pcmcia_device *p_dev, void *priv_data)
sedlbauer_config() is scheduled to run after a CARD_INSERTION event
is received, to configure the PCMCIA socket, and to make the
device available to the system.
======================================================================*/
static int sedlbauer_config_check(struct pcmcia_device *p_dev,
cistpl_cftable_entry_t *cfg,
cistpl_cftable_entry_t *dflt,
unsigned int vcc,
void *priv_data)
{ {
if (cfg->index == 0) if (p_dev->config_index == 0)
return -ENODEV; return -EINVAL;
/* Does this card need audio output? */
if (cfg->flags & CISTPL_CFTABLE_AUDIO) {
p_dev->conf.Attributes |= CONF_ENABLE_SPKR;
p_dev->conf.Status = CCSR_AUDIO_ENA;
}
/* Use power settings for Vcc and Vpp if present */ p_dev->io_lines = 3;
/* Note that the CIS values need to be rescaled */ return pcmcia_request_io(p_dev);
if (cfg->vcc.present & (1<<CISTPL_POWER_VNOM)) {
if (vcc != cfg->vcc.param[CISTPL_POWER_VNOM]/10000)
return -ENODEV;
} else if (dflt->vcc.present & (1<<CISTPL_POWER_VNOM)) {
if (vcc != dflt->vcc.param[CISTPL_POWER_VNOM]/10000)
return -ENODEV;
}
if (cfg->vpp1.present & (1<<CISTPL_POWER_VNOM))
p_dev->conf.Vpp = cfg->vpp1.param[CISTPL_POWER_VNOM]/10000;
else if (dflt->vpp1.present & (1<<CISTPL_POWER_VNOM))
p_dev->conf.Vpp = dflt->vpp1.param[CISTPL_POWER_VNOM]/10000;
p_dev->conf.Attributes |= CONF_ENABLE_IRQ;
/* IO window settings */
p_dev->resource[0]->end = p_dev->resource[1]->end = 0;
if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
p_dev->resource[0]->start = io->win[0].base;
p_dev->resource[0]->end = io->win[0].len;
p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
p_dev->resource[0]->flags |=
pcmcia_io_cfg_data_width(io->flags);
if (io->nwin > 1) {
p_dev->resource[1]->flags = p_dev->resource[0]->flags;
p_dev->resource[1]->start = io->win[1].base;
p_dev->resource[1]->end = io->win[1].len;
}
/* This reserves IO space but doesn't actually enable it */
p_dev->io_lines = 3;
if (pcmcia_request_io(p_dev) != 0)
return -ENODEV;
}
return 0;
} }
static int __devinit sedlbauer_config(struct pcmcia_device *link) static int __devinit sedlbauer_config(struct pcmcia_device *link)
{ {
int ret; int ret;
...@@ -229,44 +118,17 @@ static int __devinit sedlbauer_config(struct pcmcia_device *link) ...@@ -229,44 +118,17 @@ static int __devinit sedlbauer_config(struct pcmcia_device *link)
dev_dbg(&link->dev, "sedlbauer_config(0x%p)\n", link); dev_dbg(&link->dev, "sedlbauer_config(0x%p)\n", link);
/* link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_CHECK_VCC |
In this loop, we scan the CIS for configuration table entries, CONF_AUTO_SET_VPP | CONF_AUTO_AUDIO | CONF_AUTO_SET_IO;
each of which describes a valid card configuration, including
voltage, IO window, memory window, and interrupt settings.
We make no assumptions about the card to be configured: we use
just the information available in the CIS. In an ideal world,
this would work for any PCMCIA card, but it requires a complete
and accurate CIS. In practice, a driver usually "knows" most of
these things without consulting the CIS, and most client drivers
will only use the CIS to fill in implementation-defined details.
*/
ret = pcmcia_loop_config(link, sedlbauer_config_check, NULL); ret = pcmcia_loop_config(link, sedlbauer_config_check, NULL);
if (ret) if (ret)
goto failed; goto failed;
/* ret = pcmcia_enable_device(link);
This actually configures the PCMCIA socket -- setting up
the I/O windows and the interrupt mapping, and putting the
card and host interface into "Memory and IO" mode.
*/
ret = pcmcia_request_configuration(link, &link->conf);
if (ret) if (ret)
goto failed; goto failed;
/* Finally, report what we've done */
dev_info(&link->dev, "index 0x%02x:",
link->conf.ConfigIndex);
if (link->conf.Vpp)
printk(", Vpp %d.%d", link->conf.Vpp/10, link->conf.Vpp%10);
if (link->conf.Attributes & CONF_ENABLE_IRQ)
printk(", irq %d", link->irq);
if (link->resource[0])
printk(" & %pR", link->resource[0]);
if (link->resource[1])
printk(" & %pR", link->resource[1]);
printk("\n");
icard.para[0] = link->irq; icard.para[0] = link->irq;
icard.para[1] = link->resource[0]->start; icard.para[1] = link->resource[0]->start;
icard.protocol = protocol; icard.protocol = protocol;
...@@ -290,14 +152,6 @@ static int __devinit sedlbauer_config(struct pcmcia_device *link) ...@@ -290,14 +152,6 @@ static int __devinit sedlbauer_config(struct pcmcia_device *link)
} /* sedlbauer_config */ } /* sedlbauer_config */
/*======================================================================
After a card is removed, sedlbauer_release() will unregister the
device, and release the PCMCIA configuration. If the device is
still open, this will be postponed until it is closed.
======================================================================*/
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;
...@@ -346,9 +200,7 @@ MODULE_DEVICE_TABLE(pcmcia, sedlbauer_ids); ...@@ -346,9 +200,7 @@ MODULE_DEVICE_TABLE(pcmcia, sedlbauer_ids);
static struct pcmcia_driver sedlbauer_driver = { static struct pcmcia_driver sedlbauer_driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.drv = { .name = "sedlbauer_cs",
.name = "sedlbauer_cs",
},
.probe = sedlbauer_probe, .probe = sedlbauer_probe,
.remove = __devexit_p(sedlbauer_detach), .remove = __devexit_p(sedlbauer_detach),
.id_table = sedlbauer_ids, .id_table = sedlbauer_ids,
......
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
#include <asm/io.h> #include <asm/io.h>
#include <asm/system.h> #include <asm/system.h>
#include <pcmcia/cs.h>
#include <pcmcia/cistpl.h> #include <pcmcia/cistpl.h>
#include <pcmcia/cisreg.h> #include <pcmcia/cisreg.h>
#include <pcmcia/ds.h> #include <pcmcia/ds.h>
...@@ -45,26 +44,8 @@ MODULE_LICENSE("GPL"); ...@@ -45,26 +44,8 @@ MODULE_LICENSE("GPL");
static int protocol = 2; /* EURO-ISDN Default */ static int protocol = 2; /* EURO-ISDN Default */
module_param(protocol, int, 0); module_param(protocol, int, 0);
/*====================================================================*/
/*
The event() function is this driver's Card Services event handler.
It will be called by Card Services when an appropriate card status
event is received. The config() and release() entry points are
used to configure or release a socket, in response to card insertion
and ejection events. They are invoked from the teles_cs event
handler.
*/
static int teles_cs_config(struct pcmcia_device *link) __devinit ; static int teles_cs_config(struct pcmcia_device *link) __devinit ;
static void teles_cs_release(struct pcmcia_device *link); static void teles_cs_release(struct pcmcia_device *link);
/*
The attach() and detach() entry points are used to create and destroy
"instances" of the driver, where each instance represents everything
needed to manage one actual PCMCIA card.
*/
static void teles_detach(struct pcmcia_device *p_dev) __devexit ; static void teles_detach(struct pcmcia_device *p_dev) __devexit ;
typedef struct local_info_t { typedef struct local_info_t {
...@@ -73,18 +54,6 @@ typedef struct local_info_t { ...@@ -73,18 +54,6 @@ typedef struct local_info_t {
int cardnr; int cardnr;
} local_info_t; } local_info_t;
/*======================================================================
teles_attach() creates an "instance" of the driver, allocatingx
local data structures for one device. The device is registered
with Card Services.
The dev_link structure is initialized, but we don't actually
configure the card at this point -- we wait until we receive a
card insertion event.
======================================================================*/
static int __devinit teles_probe(struct pcmcia_device *link) static int __devinit teles_probe(struct pcmcia_device *link)
{ {
local_info_t *local; local_info_t *local;
...@@ -99,31 +68,11 @@ static int __devinit teles_probe(struct pcmcia_device *link) ...@@ -99,31 +68,11 @@ static int __devinit teles_probe(struct pcmcia_device *link)
local->p_dev = link; local->p_dev = link;
link->priv = local; link->priv = local;
/* link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO;
General socket configuration defaults can go here. In this
client, we assume very little, and rely on the CIS for almost
everything. In most clients, many details (i.e., number, sizes,
and attributes of IO windows) are fixed by the nature of the
device, and can be hard-wired here.
*/
link->resource[0]->end = 96;
link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
link->conf.Attributes = CONF_ENABLE_IRQ;
link->conf.IntType = INT_MEMORY_AND_IO;
return teles_cs_config(link); return teles_cs_config(link);
} /* teles_attach */ } /* teles_attach */
/*======================================================================
This deletes a driver "instance". The device is de-registered
with Card Services. If it has been released, all local data
structures are freed. Otherwise, the structures will be freed
when the device is released.
======================================================================*/
static void __devexit teles_detach(struct pcmcia_device *link) static void __devexit teles_detach(struct pcmcia_device *link)
{ {
local_info_t *info = link->priv; local_info_t *info = link->priv;
...@@ -136,27 +85,17 @@ static void __devexit teles_detach(struct pcmcia_device *link) ...@@ -136,27 +85,17 @@ static void __devexit teles_detach(struct pcmcia_device *link)
kfree(info); kfree(info);
} /* teles_detach */ } /* teles_detach */
/*====================================================================== static int teles_cs_configcheck(struct pcmcia_device *p_dev, void *priv_data)
teles_cs_config() is scheduled to run after a CARD_INSERTION event
is received, to configure the PCMCIA socket, and to make the
device available to the system.
======================================================================*/
static int teles_cs_configcheck(struct pcmcia_device *p_dev,
cistpl_cftable_entry_t *cf,
cistpl_cftable_entry_t *dflt,
unsigned int vcc,
void *priv_data)
{ {
int j; int j;
p_dev->io_lines = 5; p_dev->io_lines = 5;
p_dev->resource[0]->end = 96;
p_dev->resource[0]->flags &= IO_DATA_PATH_WIDTH;
p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
if ((cf->io.nwin > 0) && cf->io.win[0].base) { if ((p_dev->resource[0]->end) && p_dev->resource[0]->start) {
printk(KERN_INFO "(teles_cs: looks like the 96 model)\n"); printk(KERN_INFO "(teles_cs: looks like the 96 model)\n");
p_dev->resource[0]->start = cf->io.win[0].base;
if (!pcmcia_request_io(p_dev)) if (!pcmcia_request_io(p_dev))
return 0; return 0;
} else { } else {
...@@ -186,21 +125,10 @@ static int __devinit teles_cs_config(struct pcmcia_device *link) ...@@ -186,21 +125,10 @@ static int __devinit teles_cs_config(struct pcmcia_device *link)
if (!link->irq) if (!link->irq)
goto cs_failed; goto cs_failed;
i = pcmcia_request_configuration(link, &link->conf); i = pcmcia_enable_device(link);
if (i != 0) if (i != 0)
goto cs_failed; goto cs_failed;
/* Finally, report what we've done */
dev_info(&link->dev, "index 0x%02x:",
link->conf.ConfigIndex);
if (link->conf.Attributes & CONF_ENABLE_IRQ)
printk(", irq %d", link->irq);
if (link->resource[0])
printk(" & %pR", link->resource[0]);
if (link->resource[1])
printk(" & %pR", link->resource[1]);
printk("\n");
icard.para[0] = link->irq; icard.para[0] = link->irq;
icard.para[1] = link->resource[0]->start; icard.para[1] = link->resource[0]->start;
icard.protocol = protocol; icard.protocol = protocol;
...@@ -222,14 +150,6 @@ static int __devinit teles_cs_config(struct pcmcia_device *link) ...@@ -222,14 +150,6 @@ static int __devinit teles_cs_config(struct pcmcia_device *link)
return -ENODEV; return -ENODEV;
} /* teles_cs_config */ } /* teles_cs_config */
/*======================================================================
After a card is removed, teles_cs_release() will unregister the net
device, and release the PCMCIA configuration. If the device is
still open, this will be postponed until it is closed.
======================================================================*/
static void teles_cs_release(struct pcmcia_device *link) static void teles_cs_release(struct pcmcia_device *link)
{ {
local_info_t *local = link->priv; local_info_t *local = link->priv;
...@@ -273,9 +193,7 @@ MODULE_DEVICE_TABLE(pcmcia, teles_ids); ...@@ -273,9 +193,7 @@ MODULE_DEVICE_TABLE(pcmcia, teles_ids);
static struct pcmcia_driver teles_cs_driver = { static struct pcmcia_driver teles_cs_driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.drv = { .name = "teles_cs",
.name = "teles_cs",
},
.probe = teles_probe, .probe = teles_probe,
.remove = __devexit_p(teles_detach), .remove = __devexit_p(teles_detach),
.id_table = teles_ids, .id_table = teles_ids,
......
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/scatterlist.h> #include <linux/scatterlist.h>
#include <pcmcia/cs.h>
#include <pcmcia/cistpl.h> #include <pcmcia/cistpl.h>
#include <pcmcia/ds.h> #include <pcmcia/ds.h>
#include <linux/io.h> #include <linux/io.h>
...@@ -536,9 +535,7 @@ static int sdricoh_pcmcia_resume(struct pcmcia_device *link) ...@@ -536,9 +535,7 @@ static int sdricoh_pcmcia_resume(struct pcmcia_device *link)
#endif #endif
static struct pcmcia_driver sdricoh_driver = { static struct pcmcia_driver sdricoh_driver = {
.drv = { .name = DRIVER_NAME,
.name = DRIVER_NAME,
},
.probe = sdricoh_pcmcia_probe, .probe = sdricoh_pcmcia_probe,
.remove = sdricoh_pcmcia_detach, .remove = sdricoh_pcmcia_detach,
.id_table = pcmcia_ids, .id_table = pcmcia_ids,
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
#include <asm/io.h> #include <asm/io.h>
#include <asm/system.h> #include <asm/system.h>
#include <pcmcia/cs.h>
#include <pcmcia/cistpl.h> #include <pcmcia/cistpl.h>
#include <pcmcia/ds.h> #include <pcmcia/ds.h>
...@@ -101,7 +100,7 @@ MODULE_PARM_DESC(mem_type, "Set Memory type (0=Flash, 1=RAM, 2=ROM, default=0)") ...@@ -101,7 +100,7 @@ MODULE_PARM_DESC(mem_type, "Set Memory type (0=Flash, 1=RAM, 2=ROM, default=0)")
static caddr_t remap_window(struct map_info *map, unsigned long to) static caddr_t remap_window(struct map_info *map, unsigned long to)
{ {
struct pcmciamtd_dev *dev = (struct pcmciamtd_dev *)map->map_priv_1; struct pcmciamtd_dev *dev = (struct pcmciamtd_dev *)map->map_priv_1;
window_handle_t win = (window_handle_t)map->map_priv_2; struct resource *win = (struct resource *) map->map_priv_2;
unsigned int offset; unsigned int offset;
int ret; int ret;
...@@ -316,30 +315,19 @@ static void pcmciamtd_set_vpp(struct map_info *map, int on) ...@@ -316,30 +315,19 @@ static void pcmciamtd_set_vpp(struct map_info *map, int on)
{ {
struct pcmciamtd_dev *dev = (struct pcmciamtd_dev *)map->map_priv_1; struct pcmciamtd_dev *dev = (struct pcmciamtd_dev *)map->map_priv_1;
struct pcmcia_device *link = dev->p_dev; struct pcmcia_device *link = dev->p_dev;
modconf_t mod;
int ret;
mod.Attributes = CONF_VPP1_CHANGE_VALID | CONF_VPP2_CHANGE_VALID;
mod.Vcc = 0;
mod.Vpp1 = mod.Vpp2 = on ? dev->vpp : 0;
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); pcmcia_fixup_vpp(link, on ? dev->vpp : 0);
} }
/* After a card is removed, pcmciamtd_release() will unregister the
* device, and release the PCMCIA configuration. If the device is
* still open, this will be postponed until it is closed.
*/
static void pcmciamtd_release(struct pcmcia_device *link) static void pcmciamtd_release(struct pcmcia_device *link)
{ {
struct pcmciamtd_dev *dev = link->priv; struct pcmciamtd_dev *dev = link->priv;
DEBUG(3, "link = 0x%p", link); DEBUG(3, "link = 0x%p", link);
if (link->win) { if (link->resource[2]->end) {
if(dev->win_base) { if(dev->win_base) {
iounmap(dev->win_base); iounmap(dev->win_base);
dev->win_base = NULL; dev->win_base = NULL;
...@@ -482,18 +470,12 @@ static void card_settings(struct pcmciamtd_dev *dev, struct pcmcia_device *p_dev ...@@ -482,18 +470,12 @@ static void card_settings(struct pcmciamtd_dev *dev, struct pcmcia_device *p_dev
} }
/* pcmciamtd_config() is scheduled to run after a CARD_INSERTION event
* is received, to configure the PCMCIA socket, and to make the
* MTD device available to the system.
*/
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;
win_req_t req;
int ret; int ret;
int i; int i, j = 0;
static char *probes[] = { "jedec_probe", "cfi_probe" }; static char *probes[] = { "jedec_probe", "cfi_probe" };
int new_name = 0; int new_name = 0;
...@@ -520,28 +502,34 @@ static int pcmciamtd_config(struct pcmcia_device *link) ...@@ -520,28 +502,34 @@ static int pcmciamtd_config(struct pcmcia_device *link)
* smaller windows until we succeed * smaller windows until we succeed
*/ */
req.Attributes = WIN_MEMORY_TYPE_CM | WIN_ENABLE; link->resource[2]->flags |= WIN_MEMORY_TYPE_CM | WIN_ENABLE;
req.Attributes |= (dev->pcmcia_map.bankwidth == 1) ? WIN_DATA_WIDTH_8 : WIN_DATA_WIDTH_16; link->resource[2]->flags |= (dev->pcmcia_map.bankwidth == 1) ?
req.Base = 0; WIN_DATA_WIDTH_8 : WIN_DATA_WIDTH_16;
req.AccessSpeed = mem_speed; link->resource[2]->start = 0;
link->win = (window_handle_t)link; link->resource[2]->end = (force_size) ? force_size << 20 :
req.Size = (force_size) ? force_size << 20 : MAX_PCMCIA_ADDR; MAX_PCMCIA_ADDR;
dev->win_size = 0; dev->win_size = 0;
do { do {
int ret; int ret;
DEBUG(2, "requesting window with size = %dKiB memspeed = %d", DEBUG(2, "requesting window with size = %luKiB memspeed = %d",
req.Size >> 10, req.AccessSpeed); (unsigned long) resource_size(link->resource[2]) >> 10,
ret = pcmcia_request_window(link, &req, &link->win); mem_speed);
ret = pcmcia_request_window(link, link->resource[2], mem_speed);
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; j++;
link->resource[2]->start = 0;
link->resource[2]->end = (force_size) ?
force_size << 20 : MAX_PCMCIA_ADDR;
link->resource[2]->end >>= j;
} else { } else {
DEBUG(2, "Got window of size %dKiB", req.Size >> 10); DEBUG(2, "Got window of size %luKiB", (unsigned long)
dev->win_size = req.Size; resource_size(link->resource[2]) >> 10);
dev->win_size = resource_size(link->resource[2]);
break; break;
} }
} while(req.Size >= 0x1000); } while (link->resource[2]->end >= 0x1000);
DEBUG(2, "dev->win_size = %d", dev->win_size); DEBUG(2, "dev->win_size = %d", dev->win_size);
...@@ -553,33 +541,31 @@ static int pcmciamtd_config(struct pcmcia_device *link) ...@@ -553,33 +541,31 @@ static int pcmciamtd_config(struct pcmcia_device *link)
DEBUG(1, "Allocated a window of %dKiB", dev->win_size >> 10); DEBUG(1, "Allocated a window of %dKiB", dev->win_size >> 10);
/* Get write protect status */ /* Get write protect status */
DEBUG(2, "window handle = 0x%8.8lx", (unsigned long)link->win); dev->win_base = ioremap(link->resource[2]->start,
dev->win_base = ioremap(req.Base, req.Size); resource_size(link->resource[2]));
if(!dev->win_base) { if(!dev->win_base) {
dev_err(&dev->p_dev->dev, "ioremap(%lu, %u) failed\n", dev_err(&dev->p_dev->dev, "ioremap(%pR) failed\n",
req.Base, req.Size); link->resource[2]);
pcmciamtd_release(link); pcmciamtd_release(link);
return -ENODEV; return -ENODEV;
} }
DEBUG(1, "mapped window dev = %p req.base = 0x%lx base = %p size = 0x%x", DEBUG(1, "mapped window dev = %p @ %pR, base = %p",
dev, req.Base, dev->win_base, req.Size); dev, link->resource[2], dev->win_base);
dev->offset = 0; dev->offset = 0;
dev->pcmcia_map.map_priv_1 = (unsigned long)dev; dev->pcmcia_map.map_priv_1 = (unsigned long)dev;
dev->pcmcia_map.map_priv_2 = (unsigned long)link->win; dev->pcmcia_map.map_priv_2 = (unsigned long)link->resource[2];
dev->vpp = (vpp) ? vpp : link->socket->socket.Vpp; dev->vpp = (vpp) ? vpp : link->socket->socket.Vpp;
link->conf.Attributes = 0;
if(setvpp == 2) { if(setvpp == 2) {
link->conf.Vpp = dev->vpp; link->vpp = dev->vpp;
} else { } else {
link->conf.Vpp = 0; link->vpp = 0;
} }
link->conf.IntType = INT_MEMORY; link->config_index = 0;
link->conf.ConfigIndex = 0;
DEBUG(2, "Setting Configuration"); DEBUG(2, "Setting Configuration");
ret = pcmcia_request_configuration(link, &link->conf); ret = pcmcia_enable_device(link);
if (ret != 0) { if (ret != 0) {
if (dev->win_base) { if (dev->win_base) {
iounmap(dev->win_base); iounmap(dev->win_base);
...@@ -680,12 +666,6 @@ static int pcmciamtd_resume(struct pcmcia_device *dev) ...@@ -680,12 +666,6 @@ static int pcmciamtd_resume(struct pcmcia_device *dev)
} }
/* This deletes a driver "instance". The device is de-registered
* with Card Services. If it has been released, all local data
* structures are freed. Otherwise, the structures will be freed
* when the device is released.
*/
static void pcmciamtd_detach(struct pcmcia_device *link) static void pcmciamtd_detach(struct pcmcia_device *link)
{ {
struct pcmciamtd_dev *dev = link->priv; struct pcmciamtd_dev *dev = link->priv;
...@@ -703,11 +683,6 @@ static void pcmciamtd_detach(struct pcmcia_device *link) ...@@ -703,11 +683,6 @@ static void pcmciamtd_detach(struct pcmcia_device *link)
} }
/* pcmciamtd_attach() creates an "instance" of the driver, allocating
* local data structures for one device. The device is registered
* with Card Services.
*/
static int pcmciamtd_probe(struct pcmcia_device *link) static int pcmciamtd_probe(struct pcmcia_device *link)
{ {
struct pcmciamtd_dev *dev; struct pcmciamtd_dev *dev;
...@@ -720,9 +695,6 @@ static int pcmciamtd_probe(struct pcmcia_device *link) ...@@ -720,9 +695,6 @@ static int pcmciamtd_probe(struct pcmcia_device *link)
dev->p_dev = link; dev->p_dev = link;
link->priv = dev; link->priv = dev;
link->conf.Attributes = 0;
link->conf.IntType = INT_MEMORY;
return pcmciamtd_config(link); return pcmciamtd_config(link);
} }
...@@ -757,9 +729,7 @@ static struct pcmcia_device_id pcmciamtd_ids[] = { ...@@ -757,9 +729,7 @@ static struct pcmcia_device_id pcmciamtd_ids[] = {
MODULE_DEVICE_TABLE(pcmcia, pcmciamtd_ids); MODULE_DEVICE_TABLE(pcmcia, pcmciamtd_ids);
static struct pcmcia_driver pcmciamtd_driver = { static struct pcmcia_driver pcmciamtd_driver = {
.drv = { .name = "pcmciamtd",
.name = "pcmciamtd"
},
.probe = pcmciamtd_probe, .probe = pcmciamtd_probe,
.remove = pcmciamtd_detach, .remove = pcmciamtd_detach,
.owner = THIS_MODULE, .owner = THIS_MODULE,
...@@ -771,8 +741,6 @@ static struct pcmcia_driver pcmciamtd_driver = { ...@@ -771,8 +741,6 @@ static struct pcmcia_driver pcmciamtd_driver = {
static int __init init_pcmciamtd(void) static int __init init_pcmciamtd(void)
{ {
info(DRIVER_DESC);
if(bankwidth && bankwidth != 1 && bankwidth != 2) { if(bankwidth && bankwidth != 1 && bankwidth != 2) {
info("bad bankwidth (%d), using default", bankwidth); info("bad bankwidth (%d), using default", bankwidth);
bankwidth = 2; bankwidth = 2;
......
...@@ -87,7 +87,6 @@ earlier 3Com products. ...@@ -87,7 +87,6 @@ earlier 3Com products.
#include <linux/bitops.h> #include <linux/bitops.h>
#include <linux/mii.h> #include <linux/mii.h>
#include <pcmcia/cs.h>
#include <pcmcia/cistpl.h> #include <pcmcia/cistpl.h>
#include <pcmcia/cisreg.h> #include <pcmcia/cisreg.h>
#include <pcmcia/ciscode.h> #include <pcmcia/ciscode.h>
...@@ -280,25 +279,15 @@ static int tc574_probe(struct pcmcia_device *link) ...@@ -280,25 +279,15 @@ static int tc574_probe(struct pcmcia_device *link)
spin_lock_init(&lp->window_lock); spin_lock_init(&lp->window_lock);
link->resource[0]->end = 32; link->resource[0]->end = 32;
link->resource[0]->flags |= IO_DATA_PATH_WIDTH_16; link->resource[0]->flags |= IO_DATA_PATH_WIDTH_16;
link->conf.Attributes = CONF_ENABLE_IRQ; link->config_flags |= CONF_ENABLE_IRQ;
link->conf.IntType = INT_MEMORY_AND_IO; link->config_index = 1;
link->conf.ConfigIndex = 1;
dev->netdev_ops = &el3_netdev_ops; dev->netdev_ops = &el3_netdev_ops;
SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
dev->watchdog_timeo = TX_TIMEOUT; dev->watchdog_timeo = TX_TIMEOUT;
return tc574_config(link); return tc574_config(link);
} /* tc574_attach */ }
/*
This deletes a driver "instance". The device is de-registered
with Card Services. If it has been released, all local data
structures are freed. Otherwise, the structures will be freed
when the device is released.
*/
static void tc574_detach(struct pcmcia_device *link) static void tc574_detach(struct pcmcia_device *link)
{ {
...@@ -313,12 +302,6 @@ static void tc574_detach(struct pcmcia_device *link) ...@@ -313,12 +302,6 @@ static void tc574_detach(struct pcmcia_device *link)
free_netdev(dev); free_netdev(dev);
} /* tc574_detach */ } /* tc574_detach */
/*
tc574_config() is scheduled to run after a CARD_INSERTION event
is received, to configure the PCMCIA socket, and to make the
ethernet device available to the system.
*/
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)
...@@ -352,7 +335,7 @@ static int tc574_config(struct pcmcia_device *link) ...@@ -352,7 +335,7 @@ static int tc574_config(struct pcmcia_device *link)
if (ret) if (ret)
goto failed; goto failed;
ret = pcmcia_request_configuration(link, &link->conf); ret = pcmcia_enable_device(link);
if (ret) if (ret)
goto failed; goto failed;
...@@ -465,12 +448,6 @@ static int tc574_config(struct pcmcia_device *link) ...@@ -465,12 +448,6 @@ static int tc574_config(struct pcmcia_device *link)
} /* tc574_config */ } /* tc574_config */
/*
After a card is removed, tc574_release() will unregister the net
device, and release the PCMCIA configuration. If the device is
still open, this will be postponed until it is closed.
*/
static void tc574_release(struct pcmcia_device *link) static void tc574_release(struct pcmcia_device *link)
{ {
pcmcia_disable_device(link); pcmcia_disable_device(link);
...@@ -1198,9 +1175,7 @@ MODULE_DEVICE_TABLE(pcmcia, tc574_ids); ...@@ -1198,9 +1175,7 @@ MODULE_DEVICE_TABLE(pcmcia, tc574_ids);
static struct pcmcia_driver tc574_driver = { static struct pcmcia_driver tc574_driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.drv = { .name = "3c574_cs",
.name = "3c574_cs",
},
.probe = tc574_probe, .probe = tc574_probe,
.remove = tc574_detach, .remove = tc574_detach,
.id_table = tc574_ids, .id_table = tc574_ids,
......
...@@ -41,7 +41,6 @@ ...@@ -41,7 +41,6 @@
#include <linux/bitops.h> #include <linux/bitops.h>
#include <linux/jiffies.h> #include <linux/jiffies.h>
#include <pcmcia/cs.h>
#include <pcmcia/cistpl.h> #include <pcmcia/cistpl.h>
#include <pcmcia/cisreg.h> #include <pcmcia/cisreg.h>
#include <pcmcia/ciscode.h> #include <pcmcia/ciscode.h>
...@@ -176,14 +175,6 @@ static const struct ethtool_ops netdev_ethtool_ops; ...@@ -176,14 +175,6 @@ static const struct ethtool_ops netdev_ethtool_ops;
static void tc589_detach(struct pcmcia_device *p_dev); static void tc589_detach(struct pcmcia_device *p_dev);
/*======================================================================
tc589_attach() creates an "instance" of the driver, allocating
local data structures for one device. The device is registered
with Card Services.
======================================================================*/
static const struct net_device_ops el3_netdev_ops = { static const struct net_device_ops el3_netdev_ops = {
.ndo_open = el3_open, .ndo_open = el3_open,
.ndo_stop = el3_close, .ndo_stop = el3_close,
...@@ -216,9 +207,8 @@ static int tc589_probe(struct pcmcia_device *link) ...@@ -216,9 +207,8 @@ static int tc589_probe(struct pcmcia_device *link)
link->resource[0]->end = 16; link->resource[0]->end = 16;
link->resource[0]->flags |= IO_DATA_PATH_WIDTH_16; link->resource[0]->flags |= IO_DATA_PATH_WIDTH_16;
link->conf.Attributes = CONF_ENABLE_IRQ; link->config_flags |= CONF_ENABLE_IRQ;
link->conf.IntType = INT_MEMORY_AND_IO; link->config_index = 1;
link->conf.ConfigIndex = 1;
dev->netdev_ops = &el3_netdev_ops; dev->netdev_ops = &el3_netdev_ops;
dev->watchdog_timeo = TX_TIMEOUT; dev->watchdog_timeo = TX_TIMEOUT;
...@@ -226,16 +216,7 @@ static int tc589_probe(struct pcmcia_device *link) ...@@ -226,16 +216,7 @@ static int tc589_probe(struct pcmcia_device *link)
SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
return tc589_config(link); return tc589_config(link);
} /* tc589_attach */ }
/*======================================================================
This deletes a driver "instance". The device is de-registered
with Card Services. If it has been released, all local data
structures are freed. Otherwise, the structures will be freed
when the device is released.
======================================================================*/
static void tc589_detach(struct pcmcia_device *link) static void tc589_detach(struct pcmcia_device *link)
{ {
...@@ -250,14 +231,6 @@ static void tc589_detach(struct pcmcia_device *link) ...@@ -250,14 +231,6 @@ static void tc589_detach(struct pcmcia_device *link)
free_netdev(dev); free_netdev(dev);
} /* tc589_detach */ } /* tc589_detach */
/*======================================================================
tc589_config() is scheduled to run after a CARD_INSERTION event
is received, to configure the PCMCIA socket, and to make the
ethernet device available to the system.
======================================================================*/
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;
...@@ -294,7 +267,7 @@ static int tc589_config(struct pcmcia_device *link) ...@@ -294,7 +267,7 @@ static int tc589_config(struct pcmcia_device *link)
if (ret) if (ret)
goto failed; goto failed;
ret = pcmcia_request_configuration(link, &link->conf); ret = pcmcia_enable_device(link);
if (ret) if (ret)
goto failed; goto failed;
...@@ -352,14 +325,6 @@ static int tc589_config(struct pcmcia_device *link) ...@@ -352,14 +325,6 @@ static int tc589_config(struct pcmcia_device *link)
return -ENODEV; return -ENODEV;
} /* tc589_config */ } /* tc589_config */
/*======================================================================
After a card is removed, tc589_release() will unregister the net
device, and release the PCMCIA configuration. If the device is
still open, this will be postponed until it is closed.
======================================================================*/
static void tc589_release(struct pcmcia_device *link) static void tc589_release(struct pcmcia_device *link)
{ {
pcmcia_disable_device(link); pcmcia_disable_device(link);
...@@ -955,9 +920,7 @@ MODULE_DEVICE_TABLE(pcmcia, tc589_ids); ...@@ -955,9 +920,7 @@ MODULE_DEVICE_TABLE(pcmcia, tc589_ids);
static struct pcmcia_driver tc589_driver = { static struct pcmcia_driver tc589_driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.drv = { .name = "3c589_cs",
.name = "3c589_cs",
},
.probe = tc589_probe, .probe = tc589_probe,
.remove = tc589_detach, .remove = tc589_detach,
.id_table = tc589_ids, .id_table = tc589_ids,
......
...@@ -39,7 +39,6 @@ ...@@ -39,7 +39,6 @@
#include <linux/mii.h> #include <linux/mii.h>
#include "../8390.h" #include "../8390.h"
#include <pcmcia/cs.h>
#include <pcmcia/cistpl.h> #include <pcmcia/cistpl.h>
#include <pcmcia/ciscode.h> #include <pcmcia/ciscode.h>
#include <pcmcia/ds.h> #include <pcmcia/ds.h>
...@@ -140,14 +139,6 @@ static const struct net_device_ops axnet_netdev_ops = { ...@@ -140,14 +139,6 @@ static const struct net_device_ops axnet_netdev_ops = {
.ndo_validate_addr = eth_validate_addr, .ndo_validate_addr = eth_validate_addr,
}; };
/*======================================================================
axnet_attach() creates an "instance" of the driver, allocating
local data structures for one device. The device is registered
with Card Services.
======================================================================*/
static int axnet_probe(struct pcmcia_device *link) static int axnet_probe(struct pcmcia_device *link)
{ {
axnet_dev_t *info; axnet_dev_t *info;
...@@ -166,8 +157,7 @@ static int axnet_probe(struct pcmcia_device *link) ...@@ -166,8 +157,7 @@ static int axnet_probe(struct pcmcia_device *link)
info = PRIV(dev); info = PRIV(dev);
info->p_dev = link; info->p_dev = link;
link->priv = dev; link->priv = dev;
link->conf.Attributes = CONF_ENABLE_IRQ; link->config_flags |= CONF_ENABLE_IRQ;
link->conf.IntType = INT_MEMORY_AND_IO;
dev->netdev_ops = &axnet_netdev_ops; dev->netdev_ops = &axnet_netdev_ops;
...@@ -177,15 +167,6 @@ static int axnet_probe(struct pcmcia_device *link) ...@@ -177,15 +167,6 @@ static int axnet_probe(struct pcmcia_device *link)
return axnet_config(link); return axnet_config(link);
} /* axnet_attach */ } /* axnet_attach */
/*======================================================================
This deletes a driver "instance". The device is de-registered
with Card Services. If it has been released, all local data
structures are freed. Otherwise, the structures will be freed
when the device is released.
======================================================================*/
static void axnet_detach(struct pcmcia_device *link) static void axnet_detach(struct pcmcia_device *link)
{ {
struct net_device *dev = link->priv; struct net_device *dev = link->priv;
...@@ -231,7 +212,7 @@ static int get_prom(struct pcmcia_device *link) ...@@ -231,7 +212,7 @@ static int get_prom(struct pcmcia_device *link)
}; };
/* Not much of a test, but the alternatives are messy */ /* Not much of a test, but the alternatives are messy */
if (link->conf.ConfigBase != 0x03c0) if (link->config_base != 0x03c0)
return 0; return 0;
axnet_reset_8390(dev); axnet_reset_8390(dev);
...@@ -248,14 +229,6 @@ static int get_prom(struct pcmcia_device *link) ...@@ -248,14 +229,6 @@ static int get_prom(struct pcmcia_device *link)
return 1; return 1;
} /* get_prom */ } /* get_prom */
/*======================================================================
axnet_config() is scheduled to run after a CARD_INSERTION event
is received, to configure the PCMCIA socket, and to make the
ethernet device available to the system.
======================================================================*/
static int try_io_port(struct pcmcia_device *link) static int try_io_port(struct pcmcia_device *link)
{ {
int j, ret; int j, ret;
...@@ -286,35 +259,16 @@ static int try_io_port(struct pcmcia_device *link) ...@@ -286,35 +259,16 @@ static int try_io_port(struct pcmcia_device *link)
} }
} }
static int axnet_configcheck(struct pcmcia_device *p_dev, static int axnet_configcheck(struct pcmcia_device *p_dev, void *priv_data)
cistpl_cftable_entry_t *cfg,
cistpl_cftable_entry_t *dflt,
unsigned int vcc,
void *priv_data)
{ {
int i; if (p_dev->config_index == 0)
cistpl_io_t *io = &cfg->io; return -EINVAL;
if (cfg->index == 0 || cfg->io.nwin == 0) p_dev->config_index = 0x05;
if (p_dev->resource[0]->end + p_dev->resource[1]->end < 32)
return -ENODEV; return -ENODEV;
p_dev->conf.ConfigIndex = 0x05; return try_io_port(p_dev);
/* For multifunction cards, by convention, we configure the
network function with window 0, and serial with window 1 */
if (io->nwin > 1) {
i = (io->win[1].len > io->win[0].len);
p_dev->resource[1]->start = io->win[1-i].base;
p_dev->resource[1]->end = io->win[1-i].len;
} else {
i = p_dev->resource[1]->end = 0;
}
p_dev->resource[0]->start = io->win[i].base;
p_dev->resource[0]->end = io->win[i].len;
p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK;
if (p_dev->resource[0]->end + p_dev->resource[1]->end >= 32)
return try_io_port(p_dev);
return -ENODEV;
} }
static int axnet_config(struct pcmcia_device *link) static int axnet_config(struct pcmcia_device *link)
...@@ -326,20 +280,19 @@ static int axnet_config(struct pcmcia_device *link) ...@@ -326,20 +280,19 @@ static int axnet_config(struct pcmcia_device *link)
dev_dbg(&link->dev, "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->config_regs = 0x63;
link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO;
ret = pcmcia_loop_config(link, axnet_configcheck, NULL); ret = pcmcia_loop_config(link, axnet_configcheck, NULL);
if (ret != 0) if (ret != 0)
goto failed; goto failed;
if (!link->irq) if (!link->irq)
goto failed; goto failed;
if (resource_size(link->resource[1]) == 8)
link->config_flags |= CONF_ENABLE_SPKR;
if (resource_size(link->resource[1]) == 8) { ret = pcmcia_enable_device(link);
link->conf.Attributes |= CONF_ENABLE_SPKR;
link->conf.Status = CCSR_AUDIO_ENA;
}
ret = pcmcia_request_configuration(link, &link->conf);
if (ret) if (ret)
goto failed; goto failed;
...@@ -414,14 +367,6 @@ static int axnet_config(struct pcmcia_device *link) ...@@ -414,14 +367,6 @@ static int axnet_config(struct pcmcia_device *link)
return -ENODEV; return -ENODEV;
} /* axnet_config */ } /* axnet_config */
/*======================================================================
After a card is removed, axnet_release() will unregister the net
device, and release the PCMCIA configuration. If the device is
still open, this will be postponed until it is closed.
======================================================================*/
static void axnet_release(struct pcmcia_device *link) static void axnet_release(struct pcmcia_device *link)
{ {
pcmcia_disable_device(link); pcmcia_disable_device(link);
...@@ -783,9 +728,7 @@ MODULE_DEVICE_TABLE(pcmcia, axnet_ids); ...@@ -783,9 +728,7 @@ MODULE_DEVICE_TABLE(pcmcia, axnet_ids);
static struct pcmcia_driver axnet_cs_driver = { static struct pcmcia_driver axnet_cs_driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.drv = { .name = "axnet_cs",
.name = "axnet_cs",
},
.probe = axnet_probe, .probe = axnet_probe,
.remove = axnet_detach, .remove = axnet_detach,
.id_table = axnet_ids, .id_table = axnet_ids,
......
...@@ -43,7 +43,6 @@ ...@@ -43,7 +43,6 @@
#include <linux/arcdevice.h> #include <linux/arcdevice.h>
#include <linux/com20020.h> #include <linux/com20020.h>
#include <pcmcia/cs.h>
#include <pcmcia/cistpl.h> #include <pcmcia/cistpl.h>
#include <pcmcia/ds.h> #include <pcmcia/ds.h>
...@@ -123,14 +122,6 @@ typedef struct com20020_dev_t { ...@@ -123,14 +122,6 @@ typedef struct com20020_dev_t {
struct net_device *dev; struct net_device *dev;
} com20020_dev_t; } com20020_dev_t;
/*======================================================================
com20020_attach() creates an "instance" of the driver, allocating
local data structures for one device. The device is registered
with Card Services.
======================================================================*/
static int com20020_probe(struct pcmcia_device *p_dev) static int com20020_probe(struct pcmcia_device *p_dev)
{ {
com20020_dev_t *info; com20020_dev_t *info;
...@@ -160,8 +151,7 @@ static int com20020_probe(struct pcmcia_device *p_dev) ...@@ -160,8 +151,7 @@ static int com20020_probe(struct pcmcia_device *p_dev)
p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
p_dev->resource[0]->end = 16; p_dev->resource[0]->end = 16;
p_dev->conf.Attributes = CONF_ENABLE_IRQ; p_dev->config_flags |= CONF_ENABLE_IRQ;
p_dev->conf.IntType = INT_MEMORY_AND_IO;
info->dev = dev; info->dev = dev;
p_dev->priv = info; p_dev->priv = info;
...@@ -174,15 +164,6 @@ static int com20020_probe(struct pcmcia_device *p_dev) ...@@ -174,15 +164,6 @@ static int com20020_probe(struct pcmcia_device *p_dev)
return -ENOMEM; return -ENOMEM;
} /* com20020_attach */ } /* com20020_attach */
/*======================================================================
This deletes a driver "instance". The device is de-registered
with Card Services. If it has been released, all local data
structures are freed. Otherwise, the structures will be freed
when the device is released.
======================================================================*/
static void com20020_detach(struct pcmcia_device *link) static void com20020_detach(struct pcmcia_device *link)
{ {
struct com20020_dev_t *info = link->priv; struct com20020_dev_t *info = link->priv;
...@@ -221,14 +202,6 @@ static void com20020_detach(struct pcmcia_device *link) ...@@ -221,14 +202,6 @@ static void com20020_detach(struct pcmcia_device *link)
} /* com20020_detach */ } /* com20020_detach */
/*======================================================================
com20020_config() is scheduled to run after a CARD_INSERTION event
is received, to configure the PCMCIA socket, and to make the
device available to the system.
======================================================================*/
static int com20020_config(struct pcmcia_device *link) static int com20020_config(struct pcmcia_device *link)
{ {
struct arcnet_local *lp; struct arcnet_local *lp;
...@@ -282,7 +255,7 @@ static int com20020_config(struct pcmcia_device *link) ...@@ -282,7 +255,7 @@ static int com20020_config(struct pcmcia_device *link)
dev->irq = link->irq; dev->irq = link->irq;
ret = pcmcia_request_configuration(link, &link->conf); ret = pcmcia_enable_device(link);
if (ret) if (ret)
goto failed; goto failed;
...@@ -316,14 +289,6 @@ static int com20020_config(struct pcmcia_device *link) ...@@ -316,14 +289,6 @@ static int com20020_config(struct pcmcia_device *link)
return -ENODEV; return -ENODEV;
} /* com20020_config */ } /* com20020_config */
/*======================================================================
After a card is removed, com20020_release() will unregister the net
device, and release the PCMCIA configuration. If the device is
still open, this will be postponed until it is closed.
======================================================================*/
static void com20020_release(struct pcmcia_device *link) static void com20020_release(struct pcmcia_device *link)
{ {
dev_dbg(&link->dev, "com20020_release\n"); dev_dbg(&link->dev, "com20020_release\n");
...@@ -366,9 +331,7 @@ MODULE_DEVICE_TABLE(pcmcia, com20020_ids); ...@@ -366,9 +331,7 @@ MODULE_DEVICE_TABLE(pcmcia, com20020_ids);
static struct pcmcia_driver com20020_cs_driver = { static struct pcmcia_driver com20020_cs_driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.drv = { .name = "com20020_cs",
.name = "com20020_cs",
},
.probe = com20020_probe, .probe = com20020_probe,
.remove = com20020_detach, .remove = com20020_detach,
.id_table = com20020_ids, .id_table = com20020_ids,
......
...@@ -49,7 +49,6 @@ ...@@ -49,7 +49,6 @@
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/crc32.h> #include <linux/crc32.h>
#include <pcmcia/cs.h>
#include <pcmcia/cistpl.h> #include <pcmcia/cistpl.h>
#include <pcmcia/ciscode.h> #include <pcmcia/ciscode.h>
#include <pcmcia/ds.h> #include <pcmcia/ds.h>
...@@ -252,8 +251,7 @@ static int fmvj18x_probe(struct pcmcia_device *link) ...@@ -252,8 +251,7 @@ static int fmvj18x_probe(struct pcmcia_device *link)
link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
/* General socket configuration */ /* General socket configuration */
link->conf.Attributes = CONF_ENABLE_IRQ; link->config_flags |= CONF_ENABLE_IRQ;
link->conf.IntType = INT_MEMORY_AND_IO;
dev->netdev_ops = &fjn_netdev_ops; dev->netdev_ops = &fjn_netdev_ops;
dev->watchdog_timeo = TX_TIMEOUT; dev->watchdog_timeo = TX_TIMEOUT;
...@@ -313,7 +311,7 @@ static int ungermann_try_io_port(struct pcmcia_device *link) ...@@ -313,7 +311,7 @@ static int ungermann_try_io_port(struct pcmcia_device *link)
ret = pcmcia_request_io(link); ret = pcmcia_request_io(link);
if (ret == 0) { if (ret == 0) {
/* calculate ConfigIndex value */ /* calculate ConfigIndex value */
link->conf.ConfigIndex = link->config_index =
((link->resource[0]->start & 0x0f0) >> 3) | 0x22; ((link->resource[0]->start & 0x0f0) >> 3) | 0x22;
return ret; return ret;
} }
...@@ -321,11 +319,7 @@ static int ungermann_try_io_port(struct pcmcia_device *link) ...@@ -321,11 +319,7 @@ static int ungermann_try_io_port(struct pcmcia_device *link)
return ret; /* RequestIO failed */ return ret; /* RequestIO failed */
} }
static int fmvj18x_ioprobe(struct pcmcia_device *p_dev, static int fmvj18x_ioprobe(struct pcmcia_device *p_dev, void *priv_data)
cistpl_cftable_entry_t *cfg,
cistpl_cftable_entry_t *dflt,
unsigned int vcc,
void *priv_data)
{ {
return 0; /* strange, but that's what the code did already before... */ return 0; /* strange, but that's what the code did already before... */
} }
...@@ -362,28 +356,28 @@ static int fmvj18x_config(struct pcmcia_device *link) ...@@ -362,28 +356,28 @@ static int fmvj18x_config(struct pcmcia_device *link)
link->card_id == PRODID_TDK_NP9610 || link->card_id == PRODID_TDK_NP9610 ||
link->card_id == PRODID_TDK_MN3200) { link->card_id == PRODID_TDK_MN3200) {
/* MultiFunction Card */ /* MultiFunction Card */
link->conf.ConfigBase = 0x800; link->config_base = 0x800;
link->conf.ConfigIndex = 0x47; link->config_index = 0x47;
link->resource[1]->end = 8; link->resource[1]->end = 8;
} }
break; break;
case MANFID_NEC: case MANFID_NEC:
cardtype = NEC; /* MultiFunction Card */ cardtype = NEC; /* MultiFunction Card */
link->conf.ConfigBase = 0x800; link->config_base = 0x800;
link->conf.ConfigIndex = 0x47; link->config_index = 0x47;
link->resource[1]->end = 8; link->resource[1]->end = 8;
break; break;
case MANFID_KME: case MANFID_KME:
cardtype = KME; /* MultiFunction Card */ cardtype = KME; /* MultiFunction Card */
link->conf.ConfigBase = 0x800; link->config_base = 0x800;
link->conf.ConfigIndex = 0x47; link->config_index = 0x47;
link->resource[1]->end = 8; link->resource[1]->end = 8;
break; break;
case MANFID_CONTEC: case MANFID_CONTEC:
cardtype = CONTEC; cardtype = CONTEC;
break; break;
case MANFID_FUJITSU: case MANFID_FUJITSU:
if (link->conf.ConfigBase == 0x0fe0) if (link->config_base == 0x0fe0)
cardtype = MBH10302; cardtype = MBH10302;
else if (link->card_id == PRODID_FUJITSU_MBH10302) else if (link->card_id == PRODID_FUJITSU_MBH10302)
/* RATOC REX-5588/9822/4886's PRODID are 0004(=MBH10302), /* RATOC REX-5588/9822/4886's PRODID are 0004(=MBH10302),
...@@ -403,10 +397,10 @@ static int fmvj18x_config(struct pcmcia_device *link) ...@@ -403,10 +397,10 @@ static int fmvj18x_config(struct pcmcia_device *link)
case MANFID_FUJITSU: case MANFID_FUJITSU:
if (link->card_id == PRODID_FUJITSU_MBH10304) { if (link->card_id == PRODID_FUJITSU_MBH10304) {
cardtype = XXX10304; /* MBH10304 with buggy CIS */ cardtype = XXX10304; /* MBH10304 with buggy CIS */
link->conf.ConfigIndex = 0x20; link->config_index = 0x20;
} else { } else {
cardtype = MBH10302; /* NextCom NC5310, etc. */ cardtype = MBH10302; /* NextCom NC5310, etc. */
link->conf.ConfigIndex = 1; link->config_index = 1;
} }
break; break;
case MANFID_UNGERMANN: case MANFID_UNGERMANN:
...@@ -414,7 +408,7 @@ static int fmvj18x_config(struct pcmcia_device *link) ...@@ -414,7 +408,7 @@ static int fmvj18x_config(struct pcmcia_device *link)
break; break;
default: default:
cardtype = MBH10302; cardtype = MBH10302;
link->conf.ConfigIndex = 1; link->config_index = 1;
} }
} }
...@@ -432,7 +426,7 @@ static int fmvj18x_config(struct pcmcia_device *link) ...@@ -432,7 +426,7 @@ static int fmvj18x_config(struct pcmcia_device *link)
ret = pcmcia_request_irq(link, fjn_interrupt); ret = pcmcia_request_irq(link, fjn_interrupt);
if (ret) if (ret)
goto failed; goto failed;
ret = pcmcia_request_configuration(link, &link->conf); ret = pcmcia_enable_device(link);
if (ret) if (ret)
goto failed; goto failed;
...@@ -544,20 +538,18 @@ static int fmvj18x_config(struct pcmcia_device *link) ...@@ -544,20 +538,18 @@ static int fmvj18x_config(struct pcmcia_device *link)
static int fmvj18x_get_hwinfo(struct pcmcia_device *link, u_char *node_id) static int fmvj18x_get_hwinfo(struct pcmcia_device *link, u_char *node_id)
{ {
win_req_t req;
u_char __iomem *base; u_char __iomem *base;
int i, j; int i, j;
/* Allocate a small memory window */ /* Allocate a small memory window */
req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; link->resource[2]->flags |= WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE;
req.Base = 0; req.Size = 0; link->resource[2]->start = 0; link->resource[2]->end = 0;
req.AccessSpeed = 0; i = pcmcia_request_window(link, link->resource[2], 0);
i = pcmcia_request_window(link, &req, &link->win);
if (i != 0) if (i != 0)
return -1; return -1;
base = ioremap(req.Base, req.Size); base = ioremap(link->resource[2]->start, resource_size(link->resource[2]));
pcmcia_map_mem_page(link, link->win, 0); pcmcia_map_mem_page(link, link->resource[2], 0);
/* /*
* MBH10304 CISTPL_FUNCE_LAN_NODE_ID format * MBH10304 CISTPL_FUNCE_LAN_NODE_ID format
...@@ -582,7 +574,7 @@ static int fmvj18x_get_hwinfo(struct pcmcia_device *link, u_char *node_id) ...@@ -582,7 +574,7 @@ static int fmvj18x_get_hwinfo(struct pcmcia_device *link, u_char *node_id)
} }
iounmap(base); iounmap(base);
j = pcmcia_release_window(link, link->win); j = pcmcia_release_window(link, link->resource[2]);
return (i != 0x200) ? 0 : -1; return (i != 0x200) ? 0 : -1;
} /* fmvj18x_get_hwinfo */ } /* fmvj18x_get_hwinfo */
...@@ -590,27 +582,26 @@ static int fmvj18x_get_hwinfo(struct pcmcia_device *link, u_char *node_id) ...@@ -590,27 +582,26 @@ static int fmvj18x_get_hwinfo(struct pcmcia_device *link, u_char *node_id)
static int fmvj18x_setup_mfc(struct pcmcia_device *link) static int fmvj18x_setup_mfc(struct pcmcia_device *link)
{ {
win_req_t req;
int i; int i;
struct net_device *dev = link->priv; struct net_device *dev = link->priv;
unsigned int ioaddr; unsigned int ioaddr;
local_info_t *lp = netdev_priv(dev); local_info_t *lp = netdev_priv(dev);
/* Allocate a small memory window */ /* Allocate a small memory window */
req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; link->resource[3]->flags = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE;
req.Base = 0; req.Size = 0; link->resource[3]->start = link->resource[3]->end = 0;
req.AccessSpeed = 0; i = pcmcia_request_window(link, link->resource[3], 0);
i = pcmcia_request_window(link, &req, &link->win);
if (i != 0) if (i != 0)
return -1; return -1;
lp->base = ioremap(req.Base, req.Size); lp->base = ioremap(link->resource[3]->start,
resource_size(link->resource[3]));
if (lp->base == NULL) { if (lp->base == NULL) {
printk(KERN_NOTICE "fmvj18x_cs: ioremap failed\n"); printk(KERN_NOTICE "fmvj18x_cs: ioremap failed\n");
return -1; return -1;
} }
i = pcmcia_map_mem_page(link, link->win, 0); i = pcmcia_map_mem_page(link, link->resource[3], 0);
if (i != 0) { if (i != 0) {
iounmap(lp->base); iounmap(lp->base);
lp->base = NULL; lp->base = NULL;
...@@ -638,7 +629,6 @@ static void fmvj18x_release(struct pcmcia_device *link) ...@@ -638,7 +629,6 @@ static void fmvj18x_release(struct pcmcia_device *link)
struct net_device *dev = link->priv; struct net_device *dev = link->priv;
local_info_t *lp = netdev_priv(dev); local_info_t *lp = netdev_priv(dev);
u_char __iomem *tmp; u_char __iomem *tmp;
int j;
dev_dbg(&link->dev, "fmvj18x_release\n"); dev_dbg(&link->dev, "fmvj18x_release\n");
...@@ -646,7 +636,6 @@ static void fmvj18x_release(struct pcmcia_device *link) ...@@ -646,7 +636,6 @@ static void fmvj18x_release(struct pcmcia_device *link)
tmp = lp->base; tmp = lp->base;
lp->base = NULL; /* set NULL before iounmap */ lp->base = NULL; /* set NULL before iounmap */
iounmap(tmp); iounmap(tmp);
j = pcmcia_release_window(link, link->win);
} }
pcmcia_disable_device(link); pcmcia_disable_device(link);
...@@ -708,9 +697,7 @@ MODULE_DEVICE_TABLE(pcmcia, fmvj18x_ids); ...@@ -708,9 +697,7 @@ MODULE_DEVICE_TABLE(pcmcia, fmvj18x_ids);
static struct pcmcia_driver fmvj18x_cs_driver = { static struct pcmcia_driver fmvj18x_cs_driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.drv = { .name = "fmvj18x_cs",
.name = "fmvj18x_cs",
},
.probe = fmvj18x_probe, .probe = fmvj18x_probe,
.remove = fmvj18x_detach, .remove = fmvj18x_detach,
.id_table = fmvj18x_ids, .id_table = fmvj18x_ids,
......
...@@ -57,7 +57,6 @@ ...@@ -57,7 +57,6 @@
#include <linux/trdevice.h> #include <linux/trdevice.h>
#include <linux/ibmtr.h> #include <linux/ibmtr.h>
#include <pcmcia/cs.h>
#include <pcmcia/cistpl.h> #include <pcmcia/cistpl.h>
#include <pcmcia/ds.h> #include <pcmcia/ds.h>
...@@ -102,9 +101,8 @@ static void ibmtr_detach(struct pcmcia_device *p_dev); ...@@ -102,9 +101,8 @@ static void ibmtr_detach(struct pcmcia_device *p_dev);
typedef struct ibmtr_dev_t { typedef struct ibmtr_dev_t {
struct pcmcia_device *p_dev; struct pcmcia_device *p_dev;
struct net_device *dev; struct net_device *dev;
window_handle_t sram_win_handle; struct tok_info *ti;
struct tok_info *ti;
} ibmtr_dev_t; } ibmtr_dev_t;
static void netdev_get_drvinfo(struct net_device *dev, static void netdev_get_drvinfo(struct net_device *dev,
...@@ -123,14 +121,6 @@ static irqreturn_t ibmtr_interrupt(int irq, void *dev_id) { ...@@ -123,14 +121,6 @@ static irqreturn_t ibmtr_interrupt(int irq, void *dev_id) {
return tok_interrupt(irq, dev); return tok_interrupt(irq, dev);
}; };
/*======================================================================
ibmtr_attach() creates an "instance" of the driver, allocating
local data structures for one device. The device is registered
with Card Services.
======================================================================*/
static int __devinit ibmtr_attach(struct pcmcia_device *link) static int __devinit ibmtr_attach(struct pcmcia_device *link)
{ {
ibmtr_dev_t *info; ibmtr_dev_t *info;
...@@ -153,9 +143,8 @@ static int __devinit ibmtr_attach(struct pcmcia_device *link) ...@@ -153,9 +143,8 @@ static int __devinit ibmtr_attach(struct pcmcia_device *link)
link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
link->resource[0]->end = 4; link->resource[0]->end = 4;
link->conf.Attributes = CONF_ENABLE_IRQ; link->config_flags |= CONF_ENABLE_IRQ;
link->conf.IntType = INT_MEMORY_AND_IO; link->config_regs = PRESENT_OPTION;
link->conf.Present = PRESENT_OPTION;
info->dev = dev; info->dev = dev;
...@@ -164,15 +153,6 @@ static int __devinit ibmtr_attach(struct pcmcia_device *link) ...@@ -164,15 +153,6 @@ static int __devinit ibmtr_attach(struct pcmcia_device *link)
return ibmtr_config(link); return ibmtr_config(link);
} /* ibmtr_attach */ } /* ibmtr_attach */
/*======================================================================
This deletes a driver "instance". The device is de-registered
with Card Services. If it has been released, all local data
structures are freed. Otherwise, the structures will be freed
when the device is released.
======================================================================*/
static void ibmtr_detach(struct pcmcia_device *link) static void ibmtr_detach(struct pcmcia_device *link)
{ {
struct ibmtr_dev_t *info = link->priv; struct ibmtr_dev_t *info = link->priv;
...@@ -197,26 +177,17 @@ static void ibmtr_detach(struct pcmcia_device *link) ...@@ -197,26 +177,17 @@ static void ibmtr_detach(struct pcmcia_device *link)
kfree(info); kfree(info);
} /* ibmtr_detach */ } /* ibmtr_detach */
/*======================================================================
ibmtr_config() is scheduled to run after a CARD_INSERTION event
is received, to configure the PCMCIA socket, and to make the
token-ring device available to the system.
======================================================================*/
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;
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);
win_req_t req;
int i, ret; int i, ret;
dev_dbg(&link->dev, "ibmtr_config\n"); dev_dbg(&link->dev, "ibmtr_config\n");
link->conf.ConfigIndex = 0x61;
link->io_lines = 16; link->io_lines = 16;
link->config_index = 0x61;
/* Determine if this is PRIMARY or ALTERNATE. */ /* Determine if this is PRIMARY or ALTERNATE. */
...@@ -240,39 +211,39 @@ static int __devinit ibmtr_config(struct pcmcia_device *link) ...@@ -240,39 +211,39 @@ static int __devinit ibmtr_config(struct pcmcia_device *link)
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);
/* Allocate the MMIO memory window */ /* Allocate the MMIO memory window */
req.Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM|WIN_ENABLE; link->resource[2]->flags |= WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM|WIN_ENABLE;
req.Attributes |= WIN_USE_WAIT; link->resource[2]->flags |= WIN_USE_WAIT;
req.Base = 0; link->resource[2]->start = 0;
req.Size = 0x2000; link->resource[2]->end = 0x2000;
req.AccessSpeed = 250; ret = pcmcia_request_window(link, link->resource[2], 250);
ret = pcmcia_request_window(link, &req, &link->win);
if (ret) if (ret)
goto failed; goto failed;
ret = pcmcia_map_mem_page(link, link->win, mmiobase); ret = pcmcia_map_mem_page(link, link->resource[2], mmiobase);
if (ret) if (ret)
goto failed; goto failed;
ti->mmio = ioremap(req.Base, req.Size); ti->mmio = ioremap(link->resource[2]->start,
resource_size(link->resource[2]));
/* Allocate the SRAM memory window */ /* Allocate the SRAM memory window */
req.Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM|WIN_ENABLE; link->resource[3]->flags = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM|WIN_ENABLE;
req.Attributes |= WIN_USE_WAIT; link->resource[3]->flags |= WIN_USE_WAIT;
req.Base = 0; link->resource[3]->start = 0;
req.Size = sramsize * 1024; link->resource[3]->end = sramsize * 1024;
req.AccessSpeed = 250; ret = pcmcia_request_window(link, link->resource[3], 250);
ret = pcmcia_request_window(link, &req, &info->sram_win_handle);
if (ret) if (ret)
goto failed; goto failed;
ret = pcmcia_map_mem_page(link, info->sram_win_handle, srambase); ret = pcmcia_map_mem_page(link, link->resource[3], srambase);
if (ret) if (ret)
goto failed; goto failed;
ti->sram_base = srambase >> 12; ti->sram_base = srambase >> 12;
ti->sram_virt = ioremap(req.Base, req.Size); ti->sram_virt = ioremap(link->resource[3]->start,
ti->sram_phys = req.Base; resource_size(link->resource[3]));
ti->sram_phys = link->resource[3]->start;
ret = pcmcia_request_configuration(link, &link->conf); ret = pcmcia_enable_device(link);
if (ret) if (ret)
goto failed; goto failed;
...@@ -301,14 +272,6 @@ static int __devinit ibmtr_config(struct pcmcia_device *link) ...@@ -301,14 +272,6 @@ static int __devinit ibmtr_config(struct pcmcia_device *link)
return -ENODEV; return -ENODEV;
} /* ibmtr_config */ } /* ibmtr_config */
/*======================================================================
After a card is removed, ibmtr_release() will unregister the net
device, and release the PCMCIA configuration. If the device is
still open, this will be postponed until it is closed.
======================================================================*/
static void ibmtr_release(struct pcmcia_device *link) static void ibmtr_release(struct pcmcia_device *link)
{ {
ibmtr_dev_t *info = link->priv; ibmtr_dev_t *info = link->priv;
...@@ -316,7 +279,7 @@ static void ibmtr_release(struct pcmcia_device *link) ...@@ -316,7 +279,7 @@ static void ibmtr_release(struct pcmcia_device *link)
dev_dbg(&link->dev, "ibmtr_release\n"); dev_dbg(&link->dev, "ibmtr_release\n");
if (link->win) { if (link->resource[2]->end) {
struct tok_info *ti = netdev_priv(dev); struct tok_info *ti = netdev_priv(dev);
iounmap(ti->mmio); iounmap(ti->mmio);
} }
...@@ -398,9 +361,7 @@ MODULE_DEVICE_TABLE(pcmcia, ibmtr_ids); ...@@ -398,9 +361,7 @@ MODULE_DEVICE_TABLE(pcmcia, ibmtr_ids);
static struct pcmcia_driver ibmtr_cs_driver = { static struct pcmcia_driver ibmtr_cs_driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.drv = { .name = "ibmtr_cs",
.name = "ibmtr_cs",
},
.probe = ibmtr_attach, .probe = ibmtr_attach,
.remove = ibmtr_detach, .remove = ibmtr_detach,
.id_table = ibmtr_ids, .id_table = ibmtr_ids,
......
...@@ -146,7 +146,6 @@ Include Files ...@@ -146,7 +146,6 @@ Include Files
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/bitops.h> #include <linux/bitops.h>
#include <pcmcia/cs.h>
#include <pcmcia/cisreg.h> #include <pcmcia/cisreg.h>
#include <pcmcia/cistpl.h> #include <pcmcia/cistpl.h>
#include <pcmcia/ds.h> #include <pcmcia/ds.h>
...@@ -435,13 +434,6 @@ static const struct net_device_ops mace_netdev_ops = { ...@@ -435,13 +434,6 @@ static const struct net_device_ops mace_netdev_ops = {
.ndo_validate_addr = eth_validate_addr, .ndo_validate_addr = eth_validate_addr,
}; };
/* ----------------------------------------------------------------------------
nmclan_attach
Creates an "instance" of the driver, allocating local data
structures for one device. The device is registered with Card
Services.
---------------------------------------------------------------------------- */
static int nmclan_probe(struct pcmcia_device *link) static int nmclan_probe(struct pcmcia_device *link)
{ {
mace_private *lp; mace_private *lp;
...@@ -460,10 +452,9 @@ static int nmclan_probe(struct pcmcia_device *link) ...@@ -460,10 +452,9 @@ static int nmclan_probe(struct pcmcia_device *link)
spin_lock_init(&lp->bank_lock); spin_lock_init(&lp->bank_lock);
link->resource[0]->end = 32; link->resource[0]->end = 32;
link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
link->conf.Attributes = CONF_ENABLE_IRQ; link->config_flags |= CONF_ENABLE_IRQ;
link->conf.IntType = INT_MEMORY_AND_IO; link->config_index = 1;
link->conf.ConfigIndex = 1; link->config_regs = PRESENT_OPTION;
link->conf.Present = PRESENT_OPTION;
lp->tx_free_frames=AM2150_MAX_TX_FRAMES; lp->tx_free_frames=AM2150_MAX_TX_FRAMES;
...@@ -474,14 +465,6 @@ static int nmclan_probe(struct pcmcia_device *link) ...@@ -474,14 +465,6 @@ static int nmclan_probe(struct pcmcia_device *link)
return nmclan_config(link); return nmclan_config(link);
} /* nmclan_attach */ } /* nmclan_attach */
/* ----------------------------------------------------------------------------
nmclan_detach
This deletes a driver "instance". The device is de-registered
with Card Services. If it has been released, all local data
structures are freed. Otherwise, the structures will be freed
when the device is released.
---------------------------------------------------------------------------- */
static void nmclan_detach(struct pcmcia_device *link) static void nmclan_detach(struct pcmcia_device *link)
{ {
struct net_device *dev = link->priv; struct net_device *dev = link->priv;
...@@ -625,13 +608,6 @@ static int mace_init(mace_private *lp, unsigned int ioaddr, char *enet_addr) ...@@ -625,13 +608,6 @@ static int mace_init(mace_private *lp, unsigned int ioaddr, char *enet_addr)
return 0; return 0;
} /* mace_init */ } /* mace_init */
/* ----------------------------------------------------------------------------
nmclan_config
This routine is scheduled to run after a CARD_INSERTION event
is received, to configure the PCMCIA socket, and to make the
ethernet device available to the system.
---------------------------------------------------------------------------- */
static int nmclan_config(struct pcmcia_device *link) static int nmclan_config(struct pcmcia_device *link)
{ {
struct net_device *dev = link->priv; struct net_device *dev = link->priv;
...@@ -650,7 +626,7 @@ static int nmclan_config(struct pcmcia_device *link) ...@@ -650,7 +626,7 @@ static int nmclan_config(struct pcmcia_device *link)
ret = pcmcia_request_exclusive_irq(link, mace_interrupt); ret = pcmcia_request_exclusive_irq(link, mace_interrupt);
if (ret) if (ret)
goto failed; goto failed;
ret = pcmcia_request_configuration(link, &link->conf); ret = pcmcia_enable_device(link);
if (ret) if (ret)
goto failed; goto failed;
...@@ -712,12 +688,6 @@ static int nmclan_config(struct pcmcia_device *link) ...@@ -712,12 +688,6 @@ static int nmclan_config(struct pcmcia_device *link)
return -ENODEV; return -ENODEV;
} /* nmclan_config */ } /* nmclan_config */
/* ----------------------------------------------------------------------------
nmclan_release
After a card is removed, nmclan_release() will unregister the
net device, and release the PCMCIA configuration. If the device
is still open, this will be postponed until it is closed.
---------------------------------------------------------------------------- */
static void nmclan_release(struct pcmcia_device *link) static void nmclan_release(struct pcmcia_device *link)
{ {
dev_dbg(&link->dev, "nmclan_release\n"); dev_dbg(&link->dev, "nmclan_release\n");
...@@ -1535,9 +1505,7 @@ MODULE_DEVICE_TABLE(pcmcia, nmclan_ids); ...@@ -1535,9 +1505,7 @@ MODULE_DEVICE_TABLE(pcmcia, nmclan_ids);
static struct pcmcia_driver nmclan_cs_driver = { static struct pcmcia_driver nmclan_cs_driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.drv = { .name = "nmclan_cs",
.name = "nmclan_cs",
},
.probe = nmclan_probe, .probe = nmclan_probe,
.remove = nmclan_detach, .remove = nmclan_detach,
.id_table = nmclan_ids, .id_table = nmclan_ids,
......
This diff is collapsed.
...@@ -44,7 +44,6 @@ ...@@ -44,7 +44,6 @@
#include <linux/jiffies.h> #include <linux/jiffies.h>
#include <linux/firmware.h> #include <linux/firmware.h>
#include <pcmcia/cs.h>
#include <pcmcia/cistpl.h> #include <pcmcia/cistpl.h>
#include <pcmcia/cisreg.h> #include <pcmcia/cisreg.h>
#include <pcmcia/ciscode.h> #include <pcmcia/ciscode.h>
...@@ -300,14 +299,6 @@ static const struct net_device_ops smc_netdev_ops = { ...@@ -300,14 +299,6 @@ static const struct net_device_ops smc_netdev_ops = {
.ndo_validate_addr = eth_validate_addr, .ndo_validate_addr = eth_validate_addr,
}; };
/*======================================================================
smc91c92_attach() creates an "instance" of the driver, allocating
local data structures for one device. The device is registered
with Card Services.
======================================================================*/
static int smc91c92_probe(struct pcmcia_device *link) static int smc91c92_probe(struct pcmcia_device *link)
{ {
struct smc_private *smc; struct smc_private *smc;
...@@ -324,10 +315,6 @@ static int smc91c92_probe(struct pcmcia_device *link) ...@@ -324,10 +315,6 @@ static int smc91c92_probe(struct pcmcia_device *link)
link->priv = dev; link->priv = dev;
spin_lock_init(&smc->lock); spin_lock_init(&smc->lock);
link->resource[0]->end = 16;
link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
link->conf.Attributes = CONF_ENABLE_IRQ;
link->conf.IntType = INT_MEMORY_AND_IO;
/* The SMC91c92-specific entries in the device structure. */ /* The SMC91c92-specific entries in the device structure. */
dev->netdev_ops = &smc_netdev_ops; dev->netdev_ops = &smc_netdev_ops;
...@@ -343,15 +330,6 @@ static int smc91c92_probe(struct pcmcia_device *link) ...@@ -343,15 +330,6 @@ static int smc91c92_probe(struct pcmcia_device *link)
return smc91c92_config(link); return smc91c92_config(link);
} /* smc91c92_attach */ } /* smc91c92_attach */
/*======================================================================
This deletes a driver "instance". The device is de-registered
with Card Services. If it has been released, all local data
structures are freed. Otherwise, the structures will be freed
when the device is released.
======================================================================*/
static void smc91c92_detach(struct pcmcia_device *link) static void smc91c92_detach(struct pcmcia_device *link)
{ {
struct net_device *dev = link->priv; struct net_device *dev = link->priv;
...@@ -412,26 +390,28 @@ static int mhz_3288_power(struct pcmcia_device *link) ...@@ -412,26 +390,28 @@ static int mhz_3288_power(struct pcmcia_device *link)
mdelay(200); mdelay(200);
/* Now read and write the COR... */ /* Now read and write the COR... */
tmp = readb(smc->base + link->conf.ConfigBase + CISREG_COR); tmp = readb(smc->base + link->config_base + CISREG_COR);
udelay(5); udelay(5);
writeb(tmp, smc->base + link->conf.ConfigBase + CISREG_COR); writeb(tmp, smc->base + link->config_base + CISREG_COR);
return 0; return 0;
} }
static int mhz_mfc_config_check(struct pcmcia_device *p_dev, static int mhz_mfc_config_check(struct pcmcia_device *p_dev, void *priv_data)
cistpl_cftable_entry_t *cf,
cistpl_cftable_entry_t *dflt,
unsigned int vcc,
void *priv_data)
{ {
int k; int k;
p_dev->resource[1]->start = cf->io.win[0].base; p_dev->io_lines = 16;
p_dev->resource[1]->start = p_dev->resource[0]->start;
p_dev->resource[1]->end = 8;
p_dev->resource[1]->flags &= ~IO_DATA_PATH_WIDTH;
p_dev->resource[1]->flags |= IO_DATA_PATH_WIDTH_8;
p_dev->resource[0]->end = 16;
p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
for (k = 0; k < 0x400; k += 0x10) { for (k = 0; k < 0x400; k += 0x10) {
if (k & 0x80) if (k & 0x80)
continue; continue;
p_dev->resource[0]->start = k ^ 0x300; p_dev->resource[0]->start = k ^ 0x300;
p_dev->io_lines = 16;
if (!pcmcia_request_io(p_dev)) if (!pcmcia_request_io(p_dev))
return 0; return 0;
} }
...@@ -442,14 +422,11 @@ static int mhz_mfc_config(struct pcmcia_device *link) ...@@ -442,14 +422,11 @@ static int mhz_mfc_config(struct pcmcia_device *link)
{ {
struct net_device *dev = link->priv; struct net_device *dev = link->priv;
struct smc_private *smc = netdev_priv(dev); struct smc_private *smc = netdev_priv(dev);
win_req_t req;
unsigned int offset; unsigned int offset;
int i; int i;
link->conf.Attributes |= CONF_ENABLE_SPKR; link->config_flags |= CONF_ENABLE_SPKR | CONF_ENABLE_IRQ |
link->conf.Status = CCSR_AUDIO_ENA; CONF_AUTO_SET_IO;
link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8;
link->resource[1]->end = 8;
/* The Megahertz combo cards have modem-like CIS entries, so /* The Megahertz combo cards have modem-like CIS entries, so
we have to explicitly try a bunch of port combinations. */ we have to explicitly try a bunch of port combinations. */
...@@ -459,16 +436,16 @@ static int mhz_mfc_config(struct pcmcia_device *link) ...@@ -459,16 +436,16 @@ static int mhz_mfc_config(struct pcmcia_device *link)
dev->base_addr = link->resource[0]->start; dev->base_addr = link->resource[0]->start;
/* Allocate a memory window, for accessing the ISR */ /* Allocate a memory window, for accessing the ISR */
req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; link->resource[2]->flags = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE;
req.Base = req.Size = 0; link->resource[2]->start = link->resource[2]->end = 0;
req.AccessSpeed = 0; i = pcmcia_request_window(link, link->resource[2], 0);
i = pcmcia_request_window(link, &req, &link->win);
if (i != 0) if (i != 0)
return -ENODEV; return -ENODEV;
smc->base = ioremap(req.Base, req.Size); smc->base = ioremap(link->resource[2]->start,
offset = (smc->manfid == MANFID_MOTOROLA) ? link->conf.ConfigBase : 0; resource_size(link->resource[2]));
i = pcmcia_map_mem_page(link, link->win, offset); offset = (smc->manfid == MANFID_MOTOROLA) ? link->config_base : 0;
i = pcmcia_map_mem_page(link, link->resource[2], offset);
if ((i == 0) && if ((i == 0) &&
(smc->manfid == MANFID_MEGAHERTZ) && (smc->manfid == MANFID_MEGAHERTZ) &&
(smc->cardid == PRODID_MEGAHERTZ_EM3288)) (smc->cardid == PRODID_MEGAHERTZ_EM3288))
...@@ -591,14 +568,12 @@ static int mot_setup(struct pcmcia_device *link) ...@@ -591,14 +568,12 @@ static int mot_setup(struct pcmcia_device *link)
/*====================================================================*/ /*====================================================================*/
static int smc_configcheck(struct pcmcia_device *p_dev, static int smc_configcheck(struct pcmcia_device *p_dev, void *priv_data)
cistpl_cftable_entry_t *cf,
cistpl_cftable_entry_t *dflt,
unsigned int vcc,
void *priv_data)
{ {
p_dev->resource[0]->start = cf->io.win[0].base; p_dev->resource[0]->end = 16;
p_dev->io_lines = cf->io.flags & CISTPL_IO_LINES_MASK; p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
return pcmcia_request_io(p_dev); return pcmcia_request_io(p_dev);
} }
...@@ -607,7 +582,8 @@ static int smc_config(struct pcmcia_device *link) ...@@ -607,7 +582,8 @@ static int smc_config(struct pcmcia_device *link)
struct net_device *dev = link->priv; struct net_device *dev = link->priv;
int i; int i;
link->resource[0]->end = 16; link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO;
i = pcmcia_loop_config(link, smc_configcheck, NULL); i = pcmcia_loop_config(link, smc_configcheck, NULL);
if (!i) if (!i)
dev->base_addr = link->resource[0]->start; dev->base_addr = link->resource[0]->start;
...@@ -640,15 +616,14 @@ static int osi_config(struct pcmcia_device *link) ...@@ -640,15 +616,14 @@ static int osi_config(struct pcmcia_device *link)
static const unsigned int com[4] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8 }; static const unsigned int com[4] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8 };
int i, j; int i, j;
link->conf.Attributes |= CONF_ENABLE_SPKR; link->config_flags |= CONF_ENABLE_SPKR | CONF_ENABLE_IRQ;
link->conf.Status = CCSR_AUDIO_ENA;
link->resource[0]->end = 64; link->resource[0]->end = 64;
link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8;
link->resource[1]->end = 8; link->resource[1]->end = 8;
/* Enable Hard Decode, LAN, Modem */ /* Enable Hard Decode, LAN, Modem */
link->conf.ConfigIndex = 0x23;
link->io_lines = 16; link->io_lines = 16;
link->config_index = 0x23;
for (i = j = 0; j < 4; j++) { for (i = j = 0; j < 4; j++) {
link->resource[1]->start = com[j]; link->resource[1]->start = com[j];
...@@ -658,7 +633,7 @@ static int osi_config(struct pcmcia_device *link) ...@@ -658,7 +633,7 @@ static int osi_config(struct pcmcia_device *link)
} }
if (i != 0) { if (i != 0) {
/* Fallback: turn off hard decode */ /* Fallback: turn off hard decode */
link->conf.ConfigIndex = 0x03; link->config_index = 0x03;
link->resource[1]->end = 0; link->resource[1]->end = 0;
i = pcmcia_request_io(link); i = pcmcia_request_io(link);
} }
...@@ -817,27 +792,16 @@ static int check_sig(struct pcmcia_device *link) ...@@ -817,27 +792,16 @@ static int check_sig(struct pcmcia_device *link)
} }
if (width) { if (width) {
modconf_t mod = {
.Attributes = CONF_IO_CHANGE_WIDTH,
};
printk(KERN_INFO "smc91c92_cs: using 8-bit IO window.\n"); printk(KERN_INFO "smc91c92_cs: using 8-bit IO window.\n");
smc91c92_suspend(link); smc91c92_suspend(link);
pcmcia_modify_configuration(link, &mod); pcmcia_fixup_iowidth(link);
smc91c92_resume(link); smc91c92_resume(link);
return check_sig(link); return check_sig(link);
} }
return -ENODEV; return -ENODEV;
} }
/*======================================================================
smc91c92_config() is scheduled to run after a CARD_INSERTION event
is received, to configure the PCMCIA socket, and to make the
ethernet device available to the system.
======================================================================*/
static int smc91c92_config(struct pcmcia_device *link) static int smc91c92_config(struct pcmcia_device *link)
{ {
struct net_device *dev = link->priv; struct net_device *dev = link->priv;
...@@ -869,7 +833,7 @@ static int smc91c92_config(struct pcmcia_device *link) ...@@ -869,7 +833,7 @@ static int smc91c92_config(struct pcmcia_device *link)
i = pcmcia_request_irq(link, smc_interrupt); i = pcmcia_request_irq(link, smc_interrupt);
if (i) if (i)
goto config_failed; goto config_failed;
i = pcmcia_request_configuration(link, &link->conf); i = pcmcia_enable_device(link);
if (i) if (i)
goto config_failed; goto config_failed;
...@@ -988,18 +952,10 @@ static int smc91c92_config(struct pcmcia_device *link) ...@@ -988,18 +952,10 @@ static int smc91c92_config(struct pcmcia_device *link)
return -ENODEV; return -ENODEV;
} /* smc91c92_config */ } /* smc91c92_config */
/*======================================================================
After a card is removed, smc91c92_release() will unregister the net
device, and release the PCMCIA configuration. If the device is
still open, this will be postponed until it is closed.
======================================================================*/
static void smc91c92_release(struct pcmcia_device *link) static void smc91c92_release(struct pcmcia_device *link)
{ {
dev_dbg(&link->dev, "smc91c92_release\n"); dev_dbg(&link->dev, "smc91c92_release\n");
if (link->win) { if (link->resource[2]->end) {
struct net_device *dev = link->priv; struct net_device *dev = link->priv;
struct smc_private *smc = netdev_priv(dev); struct smc_private *smc = netdev_priv(dev);
iounmap(smc->base); iounmap(smc->base);
...@@ -2101,9 +2057,7 @@ MODULE_DEVICE_TABLE(pcmcia, smc91c92_ids); ...@@ -2101,9 +2057,7 @@ MODULE_DEVICE_TABLE(pcmcia, smc91c92_ids);
static struct pcmcia_driver smc91c92_cs_driver = { static struct pcmcia_driver smc91c92_cs_driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.drv = { .name = "smc91c92_cs",
.name = "smc91c92_cs",
},
.probe = smc91c92_probe, .probe = smc91c92_probe,
.remove = smc91c92_detach, .remove = smc91c92_detach,
.id_table = smc91c92_ids, .id_table = smc91c92_ids,
......
...@@ -82,7 +82,6 @@ ...@@ -82,7 +82,6 @@
#include <linux/bitops.h> #include <linux/bitops.h>
#include <linux/mii.h> #include <linux/mii.h>
#include <pcmcia/cs.h>
#include <pcmcia/cistpl.h> #include <pcmcia/cistpl.h>
#include <pcmcia/cisreg.h> #include <pcmcia/cisreg.h>
#include <pcmcia/ciscode.h> #include <pcmcia/ciscode.h>
...@@ -267,33 +266,11 @@ static unsigned mii_rd(unsigned int ioaddr, u_char phyaddr, u_char phyreg); ...@@ -267,33 +266,11 @@ static unsigned mii_rd(unsigned int ioaddr, u_char phyaddr, u_char phyreg);
static void mii_wr(unsigned int ioaddr, u_char phyaddr, u_char phyreg, static void mii_wr(unsigned int ioaddr, u_char phyaddr, u_char phyreg,
unsigned data, int len); unsigned data, int len);
/*
* The event() function is this driver's Card Services event handler.
* It will be called by Card Services when an appropriate card status
* event is received. The config() and release() entry points are
* used to configure or release a socket, in response to card insertion
* and ejection events. They are invoked from the event handler.
*/
static int has_ce2_string(struct pcmcia_device * link); static int has_ce2_string(struct pcmcia_device * link);
static int xirc2ps_config(struct pcmcia_device * link); static int xirc2ps_config(struct pcmcia_device * link);
static void xirc2ps_release(struct pcmcia_device * link); static void xirc2ps_release(struct pcmcia_device * link);
/****************
* The attach() and detach() entry points are used to create and destroy
* "instances" of the driver, where each instance represents everything
* needed to manage one actual PCMCIA card.
*/
static void xirc2ps_detach(struct pcmcia_device *p_dev); static void xirc2ps_detach(struct pcmcia_device *p_dev);
/****************
* You'll also need to prototype all the functions that will actually
* be used to talk to your device. See 'pcmem_cs' for a good example
* of a fully self-sufficient driver; the other drivers rely more or
* less on other parts of the kernel.
*/
static irqreturn_t xirc2ps_interrupt(int irq, void *dev_id); static irqreturn_t xirc2ps_interrupt(int irq, void *dev_id);
typedef struct local_info_t { typedef struct local_info_t {
...@@ -501,16 +478,6 @@ static const struct net_device_ops netdev_ops = { ...@@ -501,16 +478,6 @@ static const struct net_device_ops netdev_ops = {
.ndo_validate_addr = eth_validate_addr, .ndo_validate_addr = eth_validate_addr,
}; };
/****************
* xirc2ps_attach() creates an "instance" of the driver, allocating
* local data structures for one device. The device is registered
* with Card Services.
*
* The dev_link structure is initialized, but we don't actually
* configure the card at this point -- we wait until we receive a
* card insertion event.
*/
static int static int
xirc2ps_probe(struct pcmcia_device *link) xirc2ps_probe(struct pcmcia_device *link)
{ {
...@@ -529,9 +496,7 @@ xirc2ps_probe(struct pcmcia_device *link) ...@@ -529,9 +496,7 @@ xirc2ps_probe(struct pcmcia_device *link)
link->priv = dev; link->priv = dev;
/* General socket configuration */ /* General socket configuration */
link->conf.Attributes = CONF_ENABLE_IRQ; link->config_index = 1;
link->conf.IntType = INT_MEMORY_AND_IO;
link->conf.ConfigIndex = 1;
/* Fill in card specific entries */ /* Fill in card specific entries */
dev->netdev_ops = &netdev_ops; dev->netdev_ops = &netdev_ops;
...@@ -542,13 +507,6 @@ xirc2ps_probe(struct pcmcia_device *link) ...@@ -542,13 +507,6 @@ xirc2ps_probe(struct pcmcia_device *link)
return xirc2ps_config(link); return xirc2ps_config(link);
} /* xirc2ps_attach */ } /* xirc2ps_attach */
/****************
* This deletes a driver "instance". The device is de-registered
* with Card Services. If it has been released, all local data
* structures are freed. Otherwise, the structures will be freed
* when the device is released.
*/
static void static void
xirc2ps_detach(struct pcmcia_device *link) xirc2ps_detach(struct pcmcia_device *link)
{ {
...@@ -667,44 +625,53 @@ has_ce2_string(struct pcmcia_device * p_dev) ...@@ -667,44 +625,53 @@ has_ce2_string(struct pcmcia_device * p_dev)
} }
static int static int
xirc2ps_config_modem(struct pcmcia_device *p_dev, xirc2ps_config_modem(struct pcmcia_device *p_dev, void *priv_data)
cistpl_cftable_entry_t *cf,
cistpl_cftable_entry_t *dflt,
unsigned int vcc,
void *priv_data)
{ {
unsigned int ioaddr; unsigned int ioaddr;
if (cf->io.nwin > 0 && (cf->io.win[0].base & 0xf) == 8) { if ((p_dev->resource[0]->start & 0xf) == 8)
for (ioaddr = 0x300; ioaddr < 0x400; ioaddr += 0x10) { return -ENODEV;
p_dev->resource[1]->start = cf->io.win[0].base;
p_dev->resource[0]->start = ioaddr; p_dev->resource[0]->end = 16;
if (!pcmcia_request_io(p_dev)) p_dev->resource[1]->end = 8;
return 0; p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
} p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_16;
p_dev->resource[1]->flags &= ~IO_DATA_PATH_WIDTH;
p_dev->resource[1]->flags |= IO_DATA_PATH_WIDTH_8;
p_dev->io_lines = 10;
p_dev->resource[1]->start = p_dev->resource[0]->start;
for (ioaddr = 0x300; ioaddr < 0x400; ioaddr += 0x10) {
p_dev->resource[0]->start = ioaddr;
if (!pcmcia_request_io(p_dev))
return 0;
} }
return -ENODEV; return -ENODEV;
} }
static int static int
xirc2ps_config_check(struct pcmcia_device *p_dev, xirc2ps_config_check(struct pcmcia_device *p_dev, void *priv_data)
cistpl_cftable_entry_t *cf,
cistpl_cftable_entry_t *dflt,
unsigned int vcc,
void *priv_data)
{ {
int *pass = priv_data; int *pass = priv_data;
resource_size_t tmp = p_dev->resource[1]->start;
if (cf->io.nwin > 0 && (cf->io.win[0].base & 0xf) == 8) { tmp += (*pass ? (p_dev->config_index & 0x20 ? -24 : 8)
p_dev->resource[1]->start = cf->io.win[0].base; : (p_dev->config_index & 0x20 ? 8 : -24));
p_dev->resource[0]->start = p_dev->resource[1]->start
+ (*pass ? (cf->index & 0x20 ? -24:8) if ((p_dev->resource[0]->start & 0xf) == 8)
: (cf->index & 0x20 ? 8:-24)); return -ENODEV;
if (!pcmcia_request_io(p_dev))
return 0; p_dev->resource[0]->end = 18;
} p_dev->resource[1]->end = 8;
return -ENODEV; p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_16;
p_dev->resource[1]->flags &= ~IO_DATA_PATH_WIDTH;
p_dev->resource[1]->flags |= IO_DATA_PATH_WIDTH_8;
p_dev->io_lines = 10;
p_dev->resource[1]->start = p_dev->resource[0]->start;
p_dev->resource[0]->start = tmp;
return pcmcia_request_io(p_dev);
} }
...@@ -727,11 +694,6 @@ static int pcmcia_get_mac_ce(struct pcmcia_device *p_dev, ...@@ -727,11 +694,6 @@ static int pcmcia_get_mac_ce(struct pcmcia_device *p_dev,
}; };
/****************
* xirc2ps_config() is scheduled to run after a CARD_INSERTION event
* is received, to configure the PCMCIA socket, and to make the
* ethernet device available to the system.
*/
static int static int
xirc2ps_config(struct pcmcia_device * link) xirc2ps_config(struct pcmcia_device * link)
{ {
...@@ -807,32 +769,24 @@ xirc2ps_config(struct pcmcia_device * link) ...@@ -807,32 +769,24 @@ xirc2ps_config(struct pcmcia_device * link)
goto failure; goto failure;
} }
link->resource[0]->flags |= IO_DATA_PATH_WIDTH_16;
link->io_lines = 10;
if (local->modem) { if (local->modem) {
int pass; int pass;
link->config_flags |= CONF_AUTO_SET_IO;
if (do_sound) {
link->conf.Attributes |= CONF_ENABLE_SPKR;
link->conf.Status |= CCSR_AUDIO_ENA;
}
link->resource[1]->end = 8;
link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8;
if (local->dingo) { if (local->dingo) {
/* Take the Modem IO port from the CIS and scan for a free /* Take the Modem IO port from the CIS and scan for a free
* Ethernet port */ * Ethernet port */
link->resource[0]->end = 16; /* no Mako stuff anymore */
if (!pcmcia_loop_config(link, xirc2ps_config_modem, NULL)) if (!pcmcia_loop_config(link, xirc2ps_config_modem, NULL))
goto port_found; goto port_found;
} else { } else {
link->resource[0]->end = 18;
/* We do 2 passes here: The first one uses the regular mapping and /* We do 2 passes here: The first one uses the regular mapping and
* the second tries again, thereby considering that the 32 ports are * the second tries again, thereby considering that the 32 ports are
* mirrored every 32 bytes. Actually we use a mirrored port for * mirrored every 32 bytes. Actually we use a mirrored port for
* the Mako if (on the first pass) the COR bit 5 is set. * the Mako if (on the first pass) the COR bit 5 is set.
*/ */
for (pass=0; pass < 2; pass++) for (pass=0; pass < 2; pass++)
if (!pcmcia_loop_config(link, xirc2ps_config_check, &pass)) if (!pcmcia_loop_config(link, xirc2ps_config_check,
&pass))
goto port_found; goto port_found;
/* if special option: /* if special option:
* try to configure as Ethernet only. * try to configure as Ethernet only.
...@@ -840,7 +794,9 @@ xirc2ps_config(struct pcmcia_device * link) ...@@ -840,7 +794,9 @@ xirc2ps_config(struct pcmcia_device * link)
} }
printk(KNOT_XIRC "no ports available\n"); printk(KNOT_XIRC "no ports available\n");
} else { } else {
link->io_lines = 10;
link->resource[0]->end = 16; link->resource[0]->end = 16;
link->resource[0]->flags |= IO_DATA_PATH_WIDTH_16;
for (ioaddr = 0x300; ioaddr < 0x400; ioaddr += 0x10) { for (ioaddr = 0x300; ioaddr < 0x400; ioaddr += 0x10) {
link->resource[0]->start = ioaddr; link->resource[0]->start = ioaddr;
if (!(err = pcmcia_request_io(link))) if (!(err = pcmcia_request_io(link)))
...@@ -861,16 +817,14 @@ xirc2ps_config(struct pcmcia_device * link) ...@@ -861,16 +817,14 @@ xirc2ps_config(struct pcmcia_device * link)
if ((err=pcmcia_request_irq(link, xirc2ps_interrupt))) if ((err=pcmcia_request_irq(link, xirc2ps_interrupt)))
goto config_error; goto config_error;
/**************** link->config_flags |= CONF_ENABLE_IRQ;
* This actually configures the PCMCIA socket -- setting up if (do_sound)
* the I/O windows and the interrupt mapping. link->config_flags |= CONF_ENABLE_SPKR;
*/
if ((err=pcmcia_request_configuration(link, &link->conf))) if ((err = pcmcia_enable_device(link)))
goto config_error; goto config_error;
if (local->dingo) { if (local->dingo) {
win_req_t req;
/* Reset the modem's BAR to the correct value /* Reset the modem's BAR to the correct value
* This is necessary because in the RequestConfiguration call, * This is necessary because in the RequestConfiguration call,
* the base address of the ethernet port (BasePort1) is written * the base address of the ethernet port (BasePort1) is written
...@@ -890,14 +844,14 @@ xirc2ps_config(struct pcmcia_device * link) ...@@ -890,14 +844,14 @@ xirc2ps_config(struct pcmcia_device * link)
* is at 0x0800. So we allocate a window into the attribute * is at 0x0800. So we allocate a window into the attribute
* memory and write direct to the CIS registers * memory and write direct to the CIS registers
*/ */
req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; link->resource[2]->flags = WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_AM |
req.Base = req.Size = 0; WIN_ENABLE;
req.AccessSpeed = 0; link->resource[2]->start = link->resource[2]->end = 0;
if ((err = pcmcia_request_window(link, &req, &link->win))) if ((err = pcmcia_request_window(link, link->resource[2], 0)))
goto config_error; goto config_error;
local->dingo_ccr = ioremap(req.Base,0x1000) + 0x0800; local->dingo_ccr = ioremap(link->resource[2]->start, 0x1000) + 0x0800;
if ((err = pcmcia_map_mem_page(link, link->win, 0))) if ((err = pcmcia_map_mem_page(link, link->resource[2], 0)))
goto config_error; goto config_error;
/* Setup the CCRs; there are no infos in the CIS about the Ethernet /* Setup the CCRs; there are no infos in the CIS about the Ethernet
...@@ -978,17 +932,12 @@ xirc2ps_config(struct pcmcia_device * link) ...@@ -978,17 +932,12 @@ xirc2ps_config(struct pcmcia_device * link)
return -ENODEV; return -ENODEV;
} /* xirc2ps_config */ } /* xirc2ps_config */
/****************
* After a card is removed, xirc2ps_release() will unregister the net
* device, and release the PCMCIA configuration. If the device is
* still open, this will be postponed until it is closed.
*/
static void static void
xirc2ps_release(struct pcmcia_device *link) xirc2ps_release(struct pcmcia_device *link)
{ {
dev_dbg(&link->dev, "release\n"); dev_dbg(&link->dev, "release\n");
if (link->win) { if (link->resource[2]->end) {
struct net_device *dev = link->priv; struct net_device *dev = link->priv;
local_info_t *local = netdev_priv(dev); local_info_t *local = netdev_priv(dev);
if (local->dingo) if (local->dingo)
...@@ -1830,9 +1779,7 @@ MODULE_DEVICE_TABLE(pcmcia, xirc2ps_ids); ...@@ -1830,9 +1779,7 @@ MODULE_DEVICE_TABLE(pcmcia, xirc2ps_ids);
static struct pcmcia_driver xirc2ps_cs_driver = { static struct pcmcia_driver xirc2ps_cs_driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.drv = { .name = "xirc2ps_cs",
.name = "xirc2ps_cs",
},
.probe = xirc2ps_probe, .probe = xirc2ps_probe,
.remove = xirc2ps_detach, .remove = xirc2ps_detach,
.id_table = xirc2ps_ids, .id_table = xirc2ps_ids,
......
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
#include <linux/timer.h> #include <linux/timer.h>
#include <linux/netdevice.h> #include <linux/netdevice.h>
#include <pcmcia/cs.h>
#include <pcmcia/cistpl.h> #include <pcmcia/cistpl.h>
#include <pcmcia/cisreg.h> #include <pcmcia/cisreg.h>
#include <pcmcia/ds.h> #include <pcmcia/ds.h>
...@@ -54,58 +53,21 @@ MODULE_SUPPORTED_DEVICE("Aironet 4500, 4800 and Cisco 340 PCMCIA cards"); ...@@ -54,58 +53,21 @@ MODULE_SUPPORTED_DEVICE("Aironet 4500, 4800 and Cisco 340 PCMCIA cards");
/*====================================================================*/ /*====================================================================*/
/*
The event() function is this driver's Card Services event handler.
It will be called by Card Services when an appropriate card status
event is received. The config() and release() entry points are
used to configure or release a socket, in response to card
insertion and ejection events. They are invoked from the airo_cs
event handler.
*/
static int airo_config(struct pcmcia_device *link); static int airo_config(struct pcmcia_device *link);
static void airo_release(struct pcmcia_device *link); static void airo_release(struct pcmcia_device *link);
/*
The attach() and detach() entry points are used to create and destroy
"instances" of the driver, where each instance represents everything
needed to manage one actual PCMCIA card.
*/
static void airo_detach(struct pcmcia_device *p_dev); static void airo_detach(struct pcmcia_device *p_dev);
typedef struct local_info_t { typedef struct local_info_t {
struct net_device *eth_dev; struct net_device *eth_dev;
} local_info_t; } local_info_t;
/*======================================================================
airo_attach() creates an "instance" of the driver, allocating
local data structures for one device. The device is registered
with Card Services.
The dev_link structure is initialized, but we don't actually
configure the card at this point -- we wait until we receive a
card insertion event.
======================================================================*/
static int airo_probe(struct pcmcia_device *p_dev) static int airo_probe(struct pcmcia_device *p_dev)
{ {
local_info_t *local; local_info_t *local;
dev_dbg(&p_dev->dev, "airo_attach()\n"); dev_dbg(&p_dev->dev, "airo_attach()\n");
/*
General socket configuration defaults can go here. In this
client, we assume very little, and rely on the CIS for almost
everything. In most clients, many details (i.e., number, sizes,
and attributes of IO windows) are fixed by the nature of the
device, and can be hard-wired here.
*/
p_dev->conf.Attributes = 0;
p_dev->conf.IntType = INT_MEMORY_AND_IO;
/* 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);
if (!local) { if (!local) {
...@@ -117,15 +79,6 @@ static int airo_probe(struct pcmcia_device *p_dev) ...@@ -117,15 +79,6 @@ static int airo_probe(struct pcmcia_device *p_dev)
return airo_config(p_dev); return airo_config(p_dev);
} /* airo_attach */ } /* airo_attach */
/*======================================================================
This deletes a driver "instance". The device is de-registered
with Card Services. If it has been released, all local data
structures are freed. Otherwise, the structures will be freed
when the device is released.
======================================================================*/
static void airo_detach(struct pcmcia_device *link) static void airo_detach(struct pcmcia_device *link)
{ {
dev_dbg(&link->dev, "airo_detach\n"); dev_dbg(&link->dev, "airo_detach\n");
...@@ -140,60 +93,12 @@ static void airo_detach(struct pcmcia_device *link) ...@@ -140,60 +93,12 @@ static void airo_detach(struct pcmcia_device *link)
kfree(link->priv); kfree(link->priv);
} /* airo_detach */ } /* airo_detach */
/*====================================================================== static int airo_cs_config_check(struct pcmcia_device *p_dev, void *priv_data)
airo_config() is scheduled to run after a CARD_INSERTION event
is received, to configure the PCMCIA socket, and to make the
device available to the system.
======================================================================*/
static int airo_cs_config_check(struct pcmcia_device *p_dev,
cistpl_cftable_entry_t *cfg,
cistpl_cftable_entry_t *dflt,
unsigned int vcc,
void *priv_data)
{ {
if (cfg->index == 0) if (p_dev->config_index == 0)
return -ENODEV; return -EINVAL;
/* Does this card need audio output? */
if (cfg->flags & CISTPL_CFTABLE_AUDIO) {
p_dev->conf.Attributes |= CONF_ENABLE_SPKR;
p_dev->conf.Status = CCSR_AUDIO_ENA;
}
/* Use power settings for Vcc and Vpp if present */
/* Note that the CIS values need to be rescaled */
if (cfg->vpp1.present & (1<<CISTPL_POWER_VNOM))
p_dev->conf.Vpp = cfg->vpp1.param[CISTPL_POWER_VNOM]/10000;
else if (dflt->vpp1.present & (1<<CISTPL_POWER_VNOM))
p_dev->conf.Vpp = dflt->vpp1.param[CISTPL_POWER_VNOM]/10000;
p_dev->conf.Attributes |= CONF_ENABLE_IRQ;
/* IO window settings */
p_dev->resource[0]->end = p_dev->resource[1]->end = 0;
if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
p_dev->resource[0]->flags |=
pcmcia_io_cfg_data_width(io->flags);
p_dev->resource[0]->start = io->win[0].base;
p_dev->resource[0]->end = io->win[0].len;
if (io->nwin > 1) {
p_dev->resource[1]->flags = p_dev->resource[0]->flags;
p_dev->resource[1]->start = io->win[1].base;
p_dev->resource[1]->end = io->win[1].len;
}
}
/* This reserves IO space but doesn't actually enable it */ return pcmcia_request_io(p_dev);
if (pcmcia_request_io(p_dev) != 0)
return -ENODEV;
/* If we got this far, we're cool! */
return 0;
} }
...@@ -206,20 +111,9 @@ static int airo_config(struct pcmcia_device *link) ...@@ -206,20 +111,9 @@ static int airo_config(struct pcmcia_device *link)
dev_dbg(&link->dev, "airo_config\n"); dev_dbg(&link->dev, "airo_config\n");
/* link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_VPP |
* In this loop, we scan the CIS for configuration table CONF_AUTO_AUDIO | CONF_AUTO_SET_IO;
* entries, each of which describes a valid card
* configuration, including voltage, IO window, memory window,
* and interrupt settings.
*
* We make no assumptions about the card to be configured: we
* use just the information available in the CIS. In an ideal
* world, this would work for any PCMCIA card, but it requires
* a complete and accurate CIS. In practice, a driver usually
* "knows" most of these things without consulting the CIS,
* and most client drivers will only use the CIS to fill in
* implementation-defined details.
*/
ret = pcmcia_loop_config(link, airo_cs_config_check, NULL); ret = pcmcia_loop_config(link, airo_cs_config_check, NULL);
if (ret) if (ret)
goto failed; goto failed;
...@@ -227,12 +121,7 @@ static int airo_config(struct pcmcia_device *link) ...@@ -227,12 +121,7 @@ static int airo_config(struct pcmcia_device *link)
if (!link->irq) if (!link->irq)
goto failed; goto failed;
/* ret = pcmcia_enable_device(link);
This actually configures the PCMCIA socket -- setting up
the I/O windows and the interrupt mapping, and putting the
card and host interface into "Memory and IO" mode.
*/
ret = pcmcia_request_configuration(link, &link->conf);
if (ret) if (ret)
goto failed; goto failed;
((local_info_t *)link->priv)->eth_dev = ((local_info_t *)link->priv)->eth_dev =
...@@ -241,17 +130,6 @@ static int airo_config(struct pcmcia_device *link) ...@@ -241,17 +130,6 @@ static int airo_config(struct pcmcia_device *link)
if (!((local_info_t *)link->priv)->eth_dev) if (!((local_info_t *)link->priv)->eth_dev)
goto failed; goto failed;
/* Finally, report what we've done */
dev_info(&link->dev, "index 0x%02x: ",
link->conf.ConfigIndex);
if (link->conf.Vpp)
printk(", Vpp %d.%d", link->conf.Vpp/10, link->conf.Vpp%10);
printk(", irq %d", link->irq);
if (link->resource[0])
printk(" & %pR", link->resource[0]);
if (link->resource[1])
printk(" & %pR", link->resource[1]);
printk("\n");
return 0; return 0;
failed: failed:
...@@ -259,14 +137,6 @@ static int airo_config(struct pcmcia_device *link) ...@@ -259,14 +137,6 @@ static int airo_config(struct pcmcia_device *link)
return -ENODEV; return -ENODEV;
} /* airo_config */ } /* airo_config */
/*======================================================================
After a card is removed, airo_release() will unregister the
device, and release the PCMCIA configuration. If the device is
still open, this will be postponed until it is closed.
======================================================================*/
static void airo_release(struct pcmcia_device *link) static void airo_release(struct pcmcia_device *link)
{ {
dev_dbg(&link->dev, "airo_release\n"); dev_dbg(&link->dev, "airo_release\n");
...@@ -305,9 +175,7 @@ MODULE_DEVICE_TABLE(pcmcia, airo_ids); ...@@ -305,9 +175,7 @@ MODULE_DEVICE_TABLE(pcmcia, airo_ids);
static struct pcmcia_driver airo_driver = { static struct pcmcia_driver airo_driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.drv = { .name = "airo_cs",
.name = "airo_cs",
},
.probe = airo_probe, .probe = airo_probe,
.remove = airo_detach, .remove = airo_detach,
.id_table = airo_ids, .id_table = airo_ids,
...@@ -315,12 +183,12 @@ static struct pcmcia_driver airo_driver = { ...@@ -315,12 +183,12 @@ static struct pcmcia_driver airo_driver = {
.resume = airo_resume, .resume = airo_resume,
}; };
static int airo_cs_init(void) static int __init airo_cs_init(void)
{ {
return pcmcia_register_driver(&airo_driver); return pcmcia_register_driver(&airo_driver);
} }
static void airo_cs_cleanup(void) static void __exit airo_cs_cleanup(void)
{ {
pcmcia_unregister_driver(&airo_driver); pcmcia_unregister_driver(&airo_driver);
} }
......
...@@ -42,7 +42,6 @@ ...@@ -42,7 +42,6 @@
#include <linux/moduleparam.h> #include <linux/moduleparam.h>
#include <linux/device.h> #include <linux/device.h>
#include <pcmcia/cs.h>
#include <pcmcia/cistpl.h> #include <pcmcia/cistpl.h>
#include <pcmcia/cisreg.h> #include <pcmcia/cisreg.h>
#include <pcmcia/ds.h> #include <pcmcia/ds.h>
...@@ -64,58 +63,21 @@ MODULE_SUPPORTED_DEVICE("Atmel at76c50x PCMCIA cards"); ...@@ -64,58 +63,21 @@ MODULE_SUPPORTED_DEVICE("Atmel at76c50x PCMCIA cards");
/*====================================================================*/ /*====================================================================*/
/*
The event() function is this driver's Card Services event handler.
It will be called by Card Services when an appropriate card status
event is received. The config() and release() entry points are
used to configure or release a socket, in response to card
insertion and ejection events. They are invoked from the atmel_cs
event handler.
*/
static int atmel_config(struct pcmcia_device *link); static int atmel_config(struct pcmcia_device *link);
static void atmel_release(struct pcmcia_device *link); static void atmel_release(struct pcmcia_device *link);
/*
The attach() and detach() entry points are used to create and destroy
"instances" of the driver, where each instance represents everything
needed to manage one actual PCMCIA card.
*/
static void atmel_detach(struct pcmcia_device *p_dev); static void atmel_detach(struct pcmcia_device *p_dev);
typedef struct local_info_t { typedef struct local_info_t {
struct net_device *eth_dev; struct net_device *eth_dev;
} local_info_t; } local_info_t;
/*======================================================================
atmel_attach() creates an "instance" of the driver, allocating
local data structures for one device. The device is registered
with Card Services.
The dev_link structure is initialized, but we don't actually
configure the card at this point -- we wait until we receive a
card insertion event.
======================================================================*/
static int atmel_probe(struct pcmcia_device *p_dev) static int atmel_probe(struct pcmcia_device *p_dev)
{ {
local_info_t *local; local_info_t *local;
dev_dbg(&p_dev->dev, "atmel_attach()\n"); dev_dbg(&p_dev->dev, "atmel_attach()\n");
/*
General socket configuration defaults can go here. In this
client, we assume very little, and rely on the CIS for almost
everything. In most clients, many details (i.e., number, sizes,
and attributes of IO windows) are fixed by the nature of the
device, and can be hard-wired here.
*/
p_dev->conf.Attributes = 0;
p_dev->conf.IntType = INT_MEMORY_AND_IO;
/* 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);
if (!local) { if (!local) {
...@@ -127,15 +89,6 @@ static int atmel_probe(struct pcmcia_device *p_dev) ...@@ -127,15 +89,6 @@ static int atmel_probe(struct pcmcia_device *p_dev)
return atmel_config(p_dev); return atmel_config(p_dev);
} /* atmel_attach */ } /* atmel_attach */
/*======================================================================
This deletes a driver "instance". The device is de-registered
with Card Services. If it has been released, all local data
structures are freed. Otherwise, the structures will be freed
when the device is released.
======================================================================*/
static void atmel_detach(struct pcmcia_device *link) static void atmel_detach(struct pcmcia_device *link)
{ {
dev_dbg(&link->dev, "atmel_detach\n"); dev_dbg(&link->dev, "atmel_detach\n");
...@@ -145,14 +98,6 @@ static void atmel_detach(struct pcmcia_device *link) ...@@ -145,14 +98,6 @@ static void atmel_detach(struct pcmcia_device *link)
kfree(link->priv); kfree(link->priv);
} }
/*======================================================================
atmel_config() is scheduled to run after a CARD_INSERTION event
is received, to configure the PCMCIA socket, and to make the
device available to the system.
======================================================================*/
/* Call-back function to interrogate PCMCIA-specific information /* Call-back function to interrogate PCMCIA-specific information
about the current existance of the card */ about the current existance of the card */
static int card_present(void *arg) static int card_present(void *arg)
...@@ -165,47 +110,11 @@ static int card_present(void *arg) ...@@ -165,47 +110,11 @@ static int card_present(void *arg)
return 0; return 0;
} }
static int atmel_config_check(struct pcmcia_device *p_dev, static int atmel_config_check(struct pcmcia_device *p_dev, void *priv_data)
cistpl_cftable_entry_t *cfg,
cistpl_cftable_entry_t *dflt,
unsigned int vcc,
void *priv_data)
{ {
if (cfg->index == 0) if (p_dev->config_index == 0)
return -ENODEV; return -EINVAL;
/* Does this card need audio output? */
if (cfg->flags & CISTPL_CFTABLE_AUDIO) {
p_dev->conf.Attributes |= CONF_ENABLE_SPKR;
p_dev->conf.Status = CCSR_AUDIO_ENA;
}
/* Use power settings for Vcc and Vpp if present */
/* Note that the CIS values need to be rescaled */
if (cfg->vpp1.present & (1<<CISTPL_POWER_VNOM))
p_dev->conf.Vpp = cfg->vpp1.param[CISTPL_POWER_VNOM]/10000;
else if (dflt->vpp1.present & (1<<CISTPL_POWER_VNOM))
p_dev->conf.Vpp = dflt->vpp1.param[CISTPL_POWER_VNOM]/10000;
p_dev->conf.Attributes |= CONF_ENABLE_IRQ;
/* IO window settings */
p_dev->resource[0]->end = p_dev->resource[1]->end = 0;
if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
p_dev->resource[0]->flags |=
pcmcia_io_cfg_data_width(io->flags);
p_dev->resource[0]->start = io->win[0].base;
p_dev->resource[0]->end = io->win[0].len;
if (io->nwin > 1) {
p_dev->resource[1]->flags = p_dev->resource[0]->flags;
p_dev->resource[1]->start = io->win[1].base;
p_dev->resource[1]->end = io->win[1].len;
}
}
/* This reserves IO space but doesn't actually enable it */
return pcmcia_request_io(p_dev); return pcmcia_request_io(p_dev);
} }
...@@ -220,18 +129,9 @@ static int atmel_config(struct pcmcia_device *link) ...@@ -220,18 +129,9 @@ static int atmel_config(struct pcmcia_device *link)
dev_dbg(&link->dev, "atmel_config\n"); dev_dbg(&link->dev, "atmel_config\n");
/* link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_VPP |
In this loop, we scan the CIS for configuration table entries, CONF_AUTO_AUDIO | CONF_AUTO_SET_IO;
each of which describes a valid card configuration, including
voltage, IO window, memory window, and interrupt settings.
We make no assumptions about the card to be configured: we use
just the information available in the CIS. In an ideal world,
this would work for any PCMCIA card, but it requires a complete
and accurate CIS. In practice, a driver usually "knows" most of
these things without consulting the CIS, and most client drivers
will only use the CIS to fill in implementation-defined details.
*/
if (pcmcia_loop_config(link, atmel_config_check, NULL)) if (pcmcia_loop_config(link, atmel_config_check, NULL))
goto failed; goto failed;
...@@ -240,12 +140,7 @@ static int atmel_config(struct pcmcia_device *link) ...@@ -240,12 +140,7 @@ static int atmel_config(struct pcmcia_device *link)
goto failed; goto failed;
} }
/* ret = pcmcia_enable_device(link);
This actually configures the PCMCIA socket -- setting up
the I/O windows and the interrupt mapping, and putting the
card and host interface into "Memory and IO" mode.
*/
ret = pcmcia_request_configuration(link, &link->conf);
if (ret) if (ret)
goto failed; goto failed;
...@@ -267,14 +162,6 @@ static int atmel_config(struct pcmcia_device *link) ...@@ -267,14 +162,6 @@ static int atmel_config(struct pcmcia_device *link)
return -ENODEV; return -ENODEV;
} }
/*======================================================================
After a card is removed, atmel_release() will unregister the
device, and release the PCMCIA configuration. If the device is
still open, this will be postponed until it is closed.
======================================================================*/
static void atmel_release(struct pcmcia_device *link) static void atmel_release(struct pcmcia_device *link)
{ {
struct net_device *dev = ((local_info_t*)link->priv)->eth_dev; struct net_device *dev = ((local_info_t*)link->priv)->eth_dev;
...@@ -353,9 +240,7 @@ MODULE_DEVICE_TABLE(pcmcia, atmel_ids); ...@@ -353,9 +240,7 @@ MODULE_DEVICE_TABLE(pcmcia, atmel_ids);
static struct pcmcia_driver atmel_driver = { static struct pcmcia_driver atmel_driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.drv = { .name = "atmel_cs",
.name = "atmel_cs",
},
.probe = atmel_probe, .probe = atmel_probe,
.remove = atmel_detach, .remove = atmel_detach,
.id_table = atmel_ids, .id_table = atmel_ids,
...@@ -363,12 +248,12 @@ static struct pcmcia_driver atmel_driver = { ...@@ -363,12 +248,12 @@ static struct pcmcia_driver atmel_driver = {
.resume = atmel_resume, .resume = atmel_resume,
}; };
static int atmel_cs_init(void) static int __init atmel_cs_init(void)
{ {
return pcmcia_register_driver(&atmel_driver); return pcmcia_register_driver(&atmel_driver);
} }
static void atmel_cs_cleanup(void) static void __exit atmel_cs_cleanup(void)
{ {
pcmcia_unregister_driver(&atmel_driver); pcmcia_unregister_driver(&atmel_driver);
} }
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
#include <linux/ssb/ssb.h> #include <linux/ssb/ssb.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <pcmcia/cs.h>
#include <pcmcia/cistpl.h> #include <pcmcia/cistpl.h>
#include <pcmcia/ciscode.h> #include <pcmcia/ciscode.h>
#include <pcmcia/ds.h> #include <pcmcia/ds.h>
...@@ -63,7 +62,6 @@ static int b43_pcmcia_resume(struct pcmcia_device *dev) ...@@ -63,7 +62,6 @@ static int b43_pcmcia_resume(struct pcmcia_device *dev)
static int __devinit b43_pcmcia_probe(struct pcmcia_device *dev) static int __devinit b43_pcmcia_probe(struct pcmcia_device *dev)
{ {
struct ssb_bus *ssb; struct ssb_bus *ssb;
win_req_t win;
int err = -ENOMEM; int err = -ENOMEM;
int res = 0; int res = 0;
...@@ -73,30 +71,28 @@ static int __devinit b43_pcmcia_probe(struct pcmcia_device *dev) ...@@ -73,30 +71,28 @@ static int __devinit b43_pcmcia_probe(struct pcmcia_device *dev)
err = -ENODEV; err = -ENODEV;
dev->conf.Attributes = CONF_ENABLE_IRQ; dev->config_flags |= CONF_ENABLE_IRQ;
dev->conf.IntType = INT_MEMORY_AND_IO;
win.Attributes = WIN_ENABLE | WIN_DATA_WIDTH_16 | dev->resource[2]->flags |= WIN_ENABLE | WIN_DATA_WIDTH_16 |
WIN_USE_WAIT; WIN_USE_WAIT;
win.Base = 0; dev->resource[2]->start = 0;
win.Size = SSB_CORE_SIZE; dev->resource[2]->end = SSB_CORE_SIZE;
win.AccessSpeed = 250; res = pcmcia_request_window(dev, dev->resource[2], 250);
res = pcmcia_request_window(dev, &win, &dev->win);
if (res != 0) if (res != 0)
goto err_kfree_ssb; goto err_kfree_ssb;
res = pcmcia_map_mem_page(dev, dev->win, 0); res = pcmcia_map_mem_page(dev, dev->resource[2], 0);
if (res != 0) if (res != 0)
goto err_disable; goto err_disable;
if (!dev->irq) if (!dev->irq)
goto err_disable; goto err_disable;
res = pcmcia_request_configuration(dev, &dev->conf); res = pcmcia_enable_device(dev);
if (res != 0) if (res != 0)
goto err_disable; goto err_disable;
err = ssb_bus_pcmciabus_register(ssb, dev, win.Base); err = ssb_bus_pcmciabus_register(ssb, dev, dev->resource[2]->start);
if (err) if (err)
goto err_disable; goto err_disable;
dev->priv = ssb; dev->priv = ssb;
...@@ -125,9 +121,7 @@ static void __devexit b43_pcmcia_remove(struct pcmcia_device *dev) ...@@ -125,9 +121,7 @@ static void __devexit b43_pcmcia_remove(struct pcmcia_device *dev)
static struct pcmcia_driver b43_pcmcia_driver = { static struct pcmcia_driver b43_pcmcia_driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.drv = { .name = "b43-pcmcia",
.name = "b43-pcmcia",
},
.id_table = b43_pcmcia_tbl, .id_table = b43_pcmcia_tbl,
.probe = b43_pcmcia_probe, .probe = b43_pcmcia_probe,
.remove = __devexit_p(b43_pcmcia_remove), .remove = __devexit_p(b43_pcmcia_remove),
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#include <linux/wireless.h> #include <linux/wireless.h>
#include <net/iw_handler.h> #include <net/iw_handler.h>
#include <pcmcia/cs.h>
#include <pcmcia/cistpl.h> #include <pcmcia/cistpl.h>
#include <pcmcia/cisreg.h> #include <pcmcia/cisreg.h>
#include <pcmcia/ds.h> #include <pcmcia/ds.h>
...@@ -437,7 +436,6 @@ static int hostap_cs_probe(struct pcmcia_device *p_dev) ...@@ -437,7 +436,6 @@ static int hostap_cs_probe(struct pcmcia_device *p_dev)
int ret; int ret;
PDEBUG(DEBUG_HW, "%s: setting Vcc=33 (constant)\n", dev_info); PDEBUG(DEBUG_HW, "%s: setting Vcc=33 (constant)\n", dev_info);
p_dev->conf.IntType = INT_MEMORY_AND_IO;
ret = prism2_config(p_dev); ret = prism2_config(p_dev);
if (ret) { if (ret) {
...@@ -468,74 +466,11 @@ static void prism2_detach(struct pcmcia_device *link) ...@@ -468,74 +466,11 @@ static void prism2_detach(struct pcmcia_device *link)
} }
/* run after a CARD_INSERTION event is received to configure the PCMCIA static int prism2_config_check(struct pcmcia_device *p_dev, void *priv_data)
* socket and make the device available to the system */
static int prism2_config_check(struct pcmcia_device *p_dev,
cistpl_cftable_entry_t *cfg,
cistpl_cftable_entry_t *dflt,
unsigned int vcc,
void *priv_data)
{ {
if (cfg->index == 0) if (p_dev->config_index == 0)
return -ENODEV; return -EINVAL;
PDEBUG(DEBUG_EXTRA, "Checking CFTABLE_ENTRY 0x%02X "
"(default 0x%02X)\n", cfg->index, dflt->index);
/* Does this card need audio output? */
if (cfg->flags & CISTPL_CFTABLE_AUDIO) {
p_dev->conf.Attributes |= CONF_ENABLE_SPKR;
p_dev->conf.Status = CCSR_AUDIO_ENA;
}
/* Use power settings for Vcc and Vpp if present */
/* Note that the CIS values need to be rescaled */
if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) {
if (vcc != cfg->vcc.param[CISTPL_POWER_VNOM] /
10000 && !ignore_cis_vcc) {
PDEBUG(DEBUG_EXTRA, " Vcc mismatch - skipping"
" this entry\n");
return -ENODEV;
}
} else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) {
if (vcc != dflt->vcc.param[CISTPL_POWER_VNOM] /
10000 && !ignore_cis_vcc) {
PDEBUG(DEBUG_EXTRA, " Vcc (default) mismatch "
"- skipping this entry\n");
return -ENODEV;
}
}
if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM))
p_dev->conf.Vpp = cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000;
else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM))
p_dev->conf.Vpp = dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000;
/* Do we need to allocate an interrupt? */
p_dev->conf.Attributes |= CONF_ENABLE_IRQ;
/* IO window settings */
PDEBUG(DEBUG_EXTRA, "IO window settings: cfg->io.nwin=%d "
"dflt->io.nwin=%d\n",
cfg->io.nwin, dflt->io.nwin);
p_dev->resource[0]->end = p_dev->resource[1]->end = 0;
if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
p_dev->resource[0]->flags |=
pcmcia_io_cfg_data_width(io->flags);
p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK;
p_dev->resource[0]->start = io->win[0].base;
p_dev->resource[0]->end = io->win[0].len;
if (io->nwin > 1) {
p_dev->resource[1]->flags = p_dev->resource[0]->flags;
p_dev->resource[1]->start = io->win[1].base;
p_dev->resource[1]->end = io->win[1].len;
}
}
/* This reserves IO space but doesn't actually enable it */
return pcmcia_request_io(p_dev); return pcmcia_request_io(p_dev);
} }
...@@ -557,6 +492,10 @@ static int prism2_config(struct pcmcia_device *link) ...@@ -557,6 +492,10 @@ static int prism2_config(struct pcmcia_device *link)
} }
/* Look for an appropriate configuration table entry in the CIS */ /* Look for an appropriate configuration table entry in the CIS */
link->config_flags |= CONF_AUTO_SET_VPP | CONF_AUTO_AUDIO |
CONF_AUTO_CHECK_VCC | CONF_AUTO_SET_IO | CONF_ENABLE_IRQ;
if (ignore_cis_vcc)
link->config_flags &= ~CONF_AUTO_CHECK_VCC;
ret = pcmcia_loop_config(link, prism2_config_check, NULL); ret = pcmcia_loop_config(link, prism2_config_check, NULL);
if (ret) { if (ret) {
if (!ignore_cis_vcc) if (!ignore_cis_vcc)
...@@ -588,12 +527,7 @@ static int prism2_config(struct pcmcia_device *link) ...@@ -588,12 +527,7 @@ static int prism2_config(struct pcmcia_device *link)
if (ret) if (ret)
goto failed_unlock; goto failed_unlock;
/* ret = pcmcia_enable_device(link);
* This actually configures the PCMCIA socket -- setting up
* the I/O windows and the interrupt mapping, and putting the
* card and host interface into "Memory and IO" mode.
*/
ret = pcmcia_request_configuration(link, &link->conf);
if (ret) if (ret)
goto failed_unlock; goto failed_unlock;
...@@ -602,20 +536,6 @@ static int prism2_config(struct pcmcia_device *link) ...@@ -602,20 +536,6 @@ static int prism2_config(struct pcmcia_device *link)
spin_unlock_irqrestore(&local->irq_init_lock, flags); spin_unlock_irqrestore(&local->irq_init_lock, flags);
/* Finally, report what we've done */
printk(KERN_INFO "%s: index 0x%02x: ",
dev_info, link->conf.ConfigIndex);
if (link->conf.Vpp)
printk(", Vpp %d.%d", link->conf.Vpp / 10,
link->conf.Vpp % 10);
if (link->conf.Attributes & CONF_ENABLE_IRQ)
printk(", irq %d", link->irq);
if (link->resource[0])
printk(" & %pR", link->resource[0]);
if (link->resource[1])
printk(" & %pR", link->resource[1]);
printk("\n");
local->shutdown = 0; local->shutdown = 0;
sandisk_enable_wireless(dev); sandisk_enable_wireless(dev);
...@@ -627,7 +547,7 @@ static int prism2_config(struct pcmcia_device *link) ...@@ -627,7 +547,7 @@ static int prism2_config(struct pcmcia_device *link)
return ret; return ret;
failed_unlock: failed_unlock:
spin_unlock_irqrestore(&local->irq_init_lock, flags); spin_unlock_irqrestore(&local->irq_init_lock, flags);
failed: failed:
kfree(hw_priv); kfree(hw_priv);
prism2_release((u_long)link); prism2_release((u_long)link);
...@@ -779,9 +699,7 @@ MODULE_DEVICE_TABLE(pcmcia, hostap_cs_ids); ...@@ -779,9 +699,7 @@ MODULE_DEVICE_TABLE(pcmcia, hostap_cs_ids);
static struct pcmcia_driver hostap_driver = { static struct pcmcia_driver hostap_driver = {
.drv = { .name = "hostap_cs",
.name = "hostap_cs",
},
.probe = hostap_cs_probe, .probe = hostap_cs_probe,
.remove = prism2_detach, .remove = prism2_detach,
.owner = THIS_MODULE, .owner = THIS_MODULE,
......
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
#include <linux/firmware.h> #include <linux/firmware.h>
#include <linux/netdevice.h> #include <linux/netdevice.h>
#include <pcmcia/cs.h>
#include <pcmcia/cistpl.h> #include <pcmcia/cistpl.h>
#include <pcmcia/ds.h> #include <pcmcia/ds.h>
...@@ -761,15 +760,6 @@ static int if_cs_host_to_card(struct lbs_private *priv, ...@@ -761,15 +760,6 @@ static int if_cs_host_to_card(struct lbs_private *priv,
} }
/********************************************************************/
/* Card Services */
/********************************************************************/
/*
* After a card is removed, if_cs_release() will unregister the
* device, and release the PCMCIA configuration. If the device is
* still open, this will be postponed until it is closed.
*/
static void if_cs_release(struct pcmcia_device *p_dev) static void if_cs_release(struct pcmcia_device *p_dev)
{ {
struct if_cs_card *card = p_dev->priv; struct if_cs_card *card = p_dev->priv;
...@@ -785,31 +775,12 @@ static void if_cs_release(struct pcmcia_device *p_dev) ...@@ -785,31 +775,12 @@ static void if_cs_release(struct pcmcia_device *p_dev)
} }
/* static int if_cs_ioprobe(struct pcmcia_device *p_dev, void *priv_data)
* This creates an "instance" of the driver, allocating local data
* structures for one device. The device is registered with Card
* Services.
*
* The dev_link structure is initialized, but we don't actually
* configure the card at this point -- we wait until we receive a card
* insertion event.
*/
static int if_cs_ioprobe(struct pcmcia_device *p_dev,
cistpl_cftable_entry_t *cfg,
cistpl_cftable_entry_t *dflt,
unsigned int vcc,
void *priv_data)
{ {
p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
p_dev->resource[0]->start = cfg->io.win[0].base;
p_dev->resource[0]->end = cfg->io.win[0].len;
/* Do we need to allocate an interrupt? */
p_dev->conf.Attributes |= CONF_ENABLE_IRQ;
/* IO window settings */ if (p_dev->resource[1]->end) {
if (cfg->io.nwin != 1) {
lbs_pr_err("wrong CIS (check number of IO windows)\n"); lbs_pr_err("wrong CIS (check number of IO windows)\n");
return -ENODEV; return -ENODEV;
} }
...@@ -835,15 +806,13 @@ static int if_cs_probe(struct pcmcia_device *p_dev) ...@@ -835,15 +806,13 @@ static int if_cs_probe(struct pcmcia_device *p_dev)
card->p_dev = p_dev; card->p_dev = p_dev;
p_dev->priv = card; p_dev->priv = card;
p_dev->conf.Attributes = 0; p_dev->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO;
p_dev->conf.IntType = INT_MEMORY_AND_IO;
if (pcmcia_loop_config(p_dev, if_cs_ioprobe, NULL)) { if (pcmcia_loop_config(p_dev, if_cs_ioprobe, NULL)) {
lbs_pr_err("error in pcmcia_loop_config\n"); lbs_pr_err("error in pcmcia_loop_config\n");
goto out1; goto out1;
} }
/* /*
* Allocate an interrupt line. Note that this does not assign * Allocate an interrupt line. Note that this does not assign
* a handler to the interrupt, unless the 'Handler' member of * a handler to the interrupt, unless the 'Handler' member of
...@@ -861,14 +830,9 @@ static int if_cs_probe(struct pcmcia_device *p_dev) ...@@ -861,14 +830,9 @@ static int if_cs_probe(struct pcmcia_device *p_dev)
goto out1; goto out1;
} }
/* ret = pcmcia_enable_device(p_dev);
* This actually configures the PCMCIA socket -- setting up
* the I/O windows and the interrupt mapping, and putting the
* card and host interface into "Memory and IO" mode.
*/
ret = pcmcia_request_configuration(p_dev, &p_dev->conf);
if (ret) { if (ret) {
lbs_pr_err("error in pcmcia_request_configuration\n"); lbs_pr_err("error in pcmcia_enable_device\n");
goto out2; goto out2;
} }
...@@ -962,12 +926,6 @@ static int if_cs_probe(struct pcmcia_device *p_dev) ...@@ -962,12 +926,6 @@ static int if_cs_probe(struct pcmcia_device *p_dev)
} }
/*
* This deletes a driver "instance". The device is de-registered with
* Card Services. If it has been released, all local data structures
* are freed. Otherwise, the structures will be freed when the device
* is released.
*/
static void if_cs_detach(struct pcmcia_device *p_dev) static void if_cs_detach(struct pcmcia_device *p_dev)
{ {
struct if_cs_card *card = p_dev->priv; struct if_cs_card *card = p_dev->priv;
...@@ -1000,9 +958,7 @@ MODULE_DEVICE_TABLE(pcmcia, if_cs_ids); ...@@ -1000,9 +958,7 @@ MODULE_DEVICE_TABLE(pcmcia, if_cs_ids);
static struct pcmcia_driver lbs_driver = { static struct pcmcia_driver lbs_driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.drv = { .name = DRV_NAME,
.name = DRV_NAME,
},
.probe = if_cs_probe, .probe = if_cs_probe,
.remove = if_cs_detach, .remove = if_cs_detach,
.id_table = if_cs_ids, .id_table = if_cs_ids,
......
This diff is collapsed.
This diff is collapsed.
...@@ -46,7 +46,6 @@ ...@@ -46,7 +46,6 @@
#include <linux/ethtool.h> #include <linux/ethtool.h>
#include <linux/ieee80211.h> #include <linux/ieee80211.h>
#include <pcmcia/cs.h>
#include <pcmcia/cistpl.h> #include <pcmcia/cistpl.h>
#include <pcmcia/cisreg.h> #include <pcmcia/cisreg.h>
#include <pcmcia/ds.h> #include <pcmcia/ds.h>
...@@ -169,13 +168,6 @@ static int bc; ...@@ -169,13 +168,6 @@ static int bc;
*/ */
static char *phy_addr = NULL; static char *phy_addr = NULL;
/* A struct pcmcia_device structure has fields for most things that are needed
to keep track of a socket, but there will usually be some device
specific information that also needs to be kept track of. The
'priv' pointer in a struct pcmcia_device structure can be used to point to
a device-specific private data structure, like this.
*/
static unsigned int ray_mem_speed = 500; static unsigned int ray_mem_speed = 500;
/* WARNING: THIS DRIVER IS NOT CAPABLE OF HANDLING MULTIPLE DEVICES! */ /* WARNING: THIS DRIVER IS NOT CAPABLE OF HANDLING MULTIPLE DEVICES! */
...@@ -290,14 +282,6 @@ static const struct net_device_ops ray_netdev_ops = { ...@@ -290,14 +282,6 @@ static const struct net_device_ops ray_netdev_ops = {
.ndo_validate_addr = eth_validate_addr, .ndo_validate_addr = eth_validate_addr,
}; };
/*=============================================================================
ray_attach() creates an "instance" of the driver, allocating
local data structures for one device. The device is registered
with Card Services.
The dev_link structure is initialized, but we don't actually
configure the card at this point -- we wait until we receive a
card insertion event.
=============================================================================*/
static int ray_probe(struct pcmcia_device *p_dev) static int ray_probe(struct pcmcia_device *p_dev)
{ {
ray_dev_t *local; ray_dev_t *local;
...@@ -318,9 +302,8 @@ static int ray_probe(struct pcmcia_device *p_dev) ...@@ -318,9 +302,8 @@ static int ray_probe(struct pcmcia_device *p_dev)
p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
/* General socket configuration */ /* General socket configuration */
p_dev->conf.Attributes = CONF_ENABLE_IRQ; p_dev->config_flags |= CONF_ENABLE_IRQ;
p_dev->conf.IntType = INT_MEMORY_AND_IO; p_dev->config_index = 1;
p_dev->conf.ConfigIndex = 1;
p_dev->priv = dev; p_dev->priv = dev;
...@@ -353,12 +336,6 @@ static int ray_probe(struct pcmcia_device *p_dev) ...@@ -353,12 +336,6 @@ static int ray_probe(struct pcmcia_device *p_dev)
return -ENOMEM; return -ENOMEM;
} /* ray_attach */ } /* ray_attach */
/*=============================================================================
This deletes a driver "instance". The device is de-registered
with Card Services. If it has been released, all local data
structures are freed. Otherwise, the structures will be freed
when the device is released.
=============================================================================*/
static void ray_detach(struct pcmcia_device *link) static void ray_detach(struct pcmcia_device *link)
{ {
struct net_device *dev; struct net_device *dev;
...@@ -381,17 +358,11 @@ static void ray_detach(struct pcmcia_device *link) ...@@ -381,17 +358,11 @@ static void ray_detach(struct pcmcia_device *link)
dev_dbg(&link->dev, "ray_cs ray_detach ending\n"); dev_dbg(&link->dev, "ray_cs ray_detach ending\n");
} /* ray_detach */ } /* ray_detach */
/*=============================================================================
ray_config() is run after a CARD_INSERTION event
is received, to configure the PCMCIA socket, and to make the
ethernet device available to the system.
=============================================================================*/
#define MAX_TUPLE_SIZE 128 #define MAX_TUPLE_SIZE 128
static int ray_config(struct pcmcia_device *link) static int ray_config(struct pcmcia_device *link)
{ {
int ret = 0; int ret = 0;
int i; int i;
win_req_t req;
struct net_device *dev = (struct net_device *)link->priv; struct net_device *dev = (struct net_device *)link->priv;
ray_dev_t *local = netdev_priv(dev); ray_dev_t *local = netdev_priv(dev);
...@@ -412,54 +383,50 @@ static int ray_config(struct pcmcia_device *link) ...@@ -412,54 +383,50 @@ static int ray_config(struct pcmcia_device *link)
goto failed; goto failed;
dev->irq = link->irq; dev->irq = link->irq;
/* This actually configures the PCMCIA socket -- setting up ret = pcmcia_enable_device(link);
the I/O windows and the interrupt mapping.
*/
ret = pcmcia_request_configuration(link, &link->conf);
if (ret) if (ret)
goto failed; goto failed;
/*** Set up 32k window for shared memory (transmit and control) ************/ /*** Set up 32k window for shared memory (transmit and control) ************/
req.Attributes = link->resource[2]->flags |= WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_CM | WIN_ENABLE | WIN_USE_WAIT;
WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_CM | WIN_ENABLE | WIN_USE_WAIT; link->resource[2]->start = 0;
req.Base = 0; link->resource[2]->end = 0x8000;
req.Size = 0x8000; ret = pcmcia_request_window(link, link->resource[2], ray_mem_speed);
req.AccessSpeed = ray_mem_speed;
ret = pcmcia_request_window(link, &req, &link->win);
if (ret) if (ret)
goto failed; goto failed;
ret = pcmcia_map_mem_page(link, link->win, 0); ret = pcmcia_map_mem_page(link, link->resource[2], 0);
if (ret) if (ret)
goto failed; goto failed;
local->sram = ioremap(req.Base, req.Size); local->sram = ioremap(link->resource[2]->start,
resource_size(link->resource[2]));
/*** Set up 16k window for shared memory (receive buffer) ***************/ /*** Set up 16k window for shared memory (receive buffer) ***************/
req.Attributes = link->resource[3]->flags |=
WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_CM | WIN_ENABLE | WIN_USE_WAIT; WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_CM | WIN_ENABLE | WIN_USE_WAIT;
req.Base = 0; link->resource[3]->start = 0;
req.Size = 0x4000; link->resource[3]->end = 0x4000;
req.AccessSpeed = ray_mem_speed; ret = pcmcia_request_window(link, link->resource[3], ray_mem_speed);
ret = pcmcia_request_window(link, &req, &local->rmem_handle);
if (ret) if (ret)
goto failed; goto failed;
ret = pcmcia_map_mem_page(link, local->rmem_handle, 0x8000); ret = pcmcia_map_mem_page(link, link->resource[3], 0x8000);
if (ret) if (ret)
goto failed; goto failed;
local->rmem = ioremap(req.Base, req.Size); local->rmem = ioremap(link->resource[3]->start,
resource_size(link->resource[3]));
/*** Set up window for attribute memory ***********************************/ /*** Set up window for attribute memory ***********************************/
req.Attributes = link->resource[4]->flags |=
WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_AM | WIN_ENABLE | WIN_USE_WAIT; WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_AM | WIN_ENABLE | WIN_USE_WAIT;
req.Base = 0; link->resource[4]->start = 0;
req.Size = 0x1000; link->resource[4]->end = 0x1000;
req.AccessSpeed = ray_mem_speed; ret = pcmcia_request_window(link, link->resource[4], ray_mem_speed);
ret = pcmcia_request_window(link, &req, &local->amem_handle);
if (ret) if (ret)
goto failed; goto failed;
ret = pcmcia_map_mem_page(link, local->amem_handle, 0); ret = pcmcia_map_mem_page(link, link->resource[4], 0);
if (ret) if (ret)
goto failed; goto failed;
local->amem = ioremap(req.Base, req.Size); local->amem = ioremap(link->resource[4]->start,
resource_size(link->resource[4]));
dev_dbg(&link->dev, "ray_config sram=%p\n", local->sram); dev_dbg(&link->dev, "ray_config sram=%p\n", local->sram);
dev_dbg(&link->dev, "ray_config rmem=%p\n", local->rmem); dev_dbg(&link->dev, "ray_config rmem=%p\n", local->rmem);
...@@ -775,11 +742,7 @@ static void join_net(u_long data) ...@@ -775,11 +742,7 @@ static void join_net(u_long data)
local->card_status = CARD_DOING_ACQ; local->card_status = CARD_DOING_ACQ;
} }
/*============================================================================
After a card is removed, ray_release() will unregister the net
device, and release the PCMCIA configuration. If the device is
still open, this will be postponed until it is closed.
=============================================================================*/
static void ray_release(struct pcmcia_device *link) static void ray_release(struct pcmcia_device *link)
{ {
struct net_device *dev = link->priv; struct net_device *dev = link->priv;
...@@ -2847,9 +2810,7 @@ MODULE_DEVICE_TABLE(pcmcia, ray_ids); ...@@ -2847,9 +2810,7 @@ MODULE_DEVICE_TABLE(pcmcia, ray_ids);
static struct pcmcia_driver ray_driver = { static struct pcmcia_driver ray_driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.drv = { .name = "ray_cs",
.name = "ray_cs",
},
.probe = ray_probe, .probe = ray_probe,
.remove = ray_detach, .remove = ray_detach,
.id_table = ray_ids, .id_table = ray_ids,
......
...@@ -25,8 +25,6 @@ struct beacon_rx { ...@@ -25,8 +25,6 @@ struct beacon_rx {
typedef struct ray_dev_t { typedef struct ray_dev_t {
int card_status; int card_status;
int authentication_state; int authentication_state;
window_handle_t amem_handle; /* handle to window for attribute memory */
window_handle_t rmem_handle; /* handle to window for rx buffer on card */
void __iomem *sram; /* pointer to beginning of shared RAM */ void __iomem *sram; /* pointer to beginning of shared RAM */
void __iomem *amem; /* pointer to attribute mem window */ void __iomem *amem; /* pointer to attribute mem window */
void __iomem *rmem; /* pointer to receive buffer window */ void __iomem *rmem; /* pointer to receive buffer window */
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
/* include the world */ /* include the world */
#include <pcmcia/cs.h>
#include <pcmcia/ss.h> #include <pcmcia/ss.h>
#include <pcmcia/cistpl.h> #include <pcmcia/cistpl.h>
#include "cs_internal.h" #include "cs_internal.h"
......
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