16 #include <linux/kernel.h>
17 #include <linux/module.h>
19 #include <linux/netdevice.h>
28 #define DRV_NAME "ems_pcmcia"
35 #define EMS_PCMCIA_MAX_CHAN 2
44 #define EMS_PCMCIA_CAN_CLOCK (16000000 / 2)
54 #define EMS_PCMCIA_OCR (OCR_TX0_PUSHPULL | OCR_TX1_PUSHPULL)
62 #define EMS_PCMCIA_CDR (CDR_CBP | CDR_CLKOUT_MASK)
63 #define EMS_PCMCIA_MEM_SIZE 4096
64 #define EMS_PCMCIA_CAN_BASE_OFFSET 0x100
65 #define EMS_PCMCIA_CAN_CTRL_SIZE 0x80
67 #define EMS_CMD_RESET 0x00
68 #define EMS_CMD_MAP 0x03
69 #define EMS_CMD_UMAP 0x02
72 PCMCIA_DEVICE_PROD_ID123(
"EMS_T_W",
"CPC-Card",
"V2.0", 0xeab1ea23,
73 0xa338573f, 0xe4575800),
105 for (i = 0; i < card->
channels; i++) {
129 ems_pcmcia_write_reg(priv,
REG_MOD, 1);
139 static void ems_pcmcia_del_card(
struct pcmcia_device *pdev)
147 for (i = 0; i < card->
channels; i++) {
169 static int __devinit ems_pcmcia_add_card(
struct pcmcia_device *pdev,
188 goto failure_cleanup;
194 goto failure_cleanup;
208 goto failure_cleanup;
212 priv = netdev_priv(dev);
217 dev->
irq = pdev->irq;
222 if (ems_pcmcia_check_chan(priv)) {
223 priv->
read_reg = ems_pcmcia_read_reg;
234 goto failure_cleanup;
252 ems_pcmcia_del_card(pdev);
259 static int __devinit ems_pcmcia_probe(
struct pcmcia_device *dev)
264 dev->config_flags |= CONF_ENABLE_IRQ;
265 dev->config_index = 1;
266 dev->config_regs = PRESENT_OPTION;
269 dev->resource[0]->end = 16;
270 dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
271 dev->resource[1]->end = 16;
272 dev->resource[1]->flags |= IO_DATA_PATH_WIDTH_16;
276 dev->resource[2]->flags =
277 (WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_CM |
WIN_ENABLE);
278 dev->resource[2]->start = dev->resource[2]->end = 0;
282 dev_err(&dev->dev,
"pcmcia_request_window failed (err=%d)\n",
289 dev_err(&dev->dev,
"pcmcia_map_mem_page failed (err=%d)\n",
296 dev_err(&dev->dev,
"pcmcia_enable_device failed (err=%d)\n",
301 ems_pcmcia_add_card(dev, dev->resource[2]->start);
308 static void ems_pcmcia_remove(
struct pcmcia_device *dev)
310 ems_pcmcia_del_card(dev);
314 static struct pcmcia_driver ems_pcmcia_driver = {
316 .probe = ems_pcmcia_probe,
317 .remove = ems_pcmcia_remove,
318 .id_table = ems_pcmcia_tbl,
321 static int __init ems_pcmcia_init(
void)
327 static void __exit ems_pcmcia_exit(
void)