1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44#include <linux/module.h>
45#include <linux/kernel.h>
46#include <linux/types.h>
47#include <linux/skbuff.h>
48#include <linux/netdevice.h>
49#include <linux/ioport.h>
50#include <linux/delay.h>
51#include <linux/init.h>
52#include <linux/interrupt.h>
53#include <linux/rtnetlink.h>
54#include <linux/serial_reg.h>
55#include <linux/dma-mapping.h>
56#include <linux/pnp.h>
57#include <linux/platform_device.h>
58#include <linux/gfp.h>
59
60#include <asm/io.h>
61#include <asm/dma.h>
62#include <asm/byteorder.h>
63
64#include <linux/spinlock.h>
65#include <linux/pm.h>
66#ifdef CONFIG_PCI
67#include <linux/pci.h>
68#endif
69
70#include <net/irda/wrapper.h>
71#include <net/irda/irda.h>
72#include <net/irda/irda_device.h>
73
74#include "smsc-ircc2.h"
75#include "smsc-sio.h"
76
77
78MODULE_AUTHOR("Daniele Peri <peri@csai.unipa.it>");
79MODULE_DESCRIPTION("SMC IrCC SIR/FIR controller driver");
80MODULE_LICENSE("GPL");
81
82static int smsc_nopnp = 1;
83module_param_named(nopnp, smsc_nopnp, bool, 0);
84MODULE_PARM_DESC(nopnp, "Do not use PNP to detect controller settings, defaults to true");
85
86#define DMA_INVAL 255
87static int ircc_dma = DMA_INVAL;
88module_param(ircc_dma, int, 0);
89MODULE_PARM_DESC(ircc_dma, "DMA channel");
90
91#define IRQ_INVAL 255
92static int ircc_irq = IRQ_INVAL;
93module_param(ircc_irq, int, 0);
94MODULE_PARM_DESC(ircc_irq, "IRQ line");
95
96static int ircc_fir;
97module_param(ircc_fir, int, 0);
98MODULE_PARM_DESC(ircc_fir, "FIR Base Address");
99
100static int ircc_sir;
101module_param(ircc_sir, int, 0);
102MODULE_PARM_DESC(ircc_sir, "SIR Base Address");
103
104static int ircc_cfg;
105module_param(ircc_cfg, int, 0);
106MODULE_PARM_DESC(ircc_cfg, "Configuration register base address");
107
108static int ircc_transceiver;
109module_param(ircc_transceiver, int, 0);
110MODULE_PARM_DESC(ircc_transceiver, "Transceiver type");
111
112
113
114#ifdef CONFIG_PCI
115struct smsc_ircc_subsystem_configuration {
116 unsigned short vendor;
117 unsigned short device;
118 unsigned short subvendor;
119 unsigned short subdevice;
120 unsigned short sir_io;
121 unsigned short fir_io;
122 unsigned char fir_irq;
123 unsigned char fir_dma;
124 unsigned short cfg_base;
125 int (*preconfigure)(struct pci_dev *dev, struct smsc_ircc_subsystem_configuration *conf);
126 const char *name;
127};
128#endif
129
130struct smsc_transceiver {
131 char *name;
132 void (*set_for_speed)(int fir_base, u32 speed);
133 int (*probe)(int fir_base);
134};
135
136struct smsc_chip {
137 char *name;
138 #if 0
139 u8 type;
140 #endif
141 u16 flags;
142 u8 devid;
143 u8 rev;
144};
145
146struct smsc_chip_address {
147 unsigned int cfg_base;
148 unsigned int type;
149};
150
151
152struct smsc_ircc_cb {
153 struct net_device *netdev;
154 struct irlap_cb *irlap;
155
156 chipio_t io;
157 iobuff_t tx_buff;
158 iobuff_t rx_buff;
159 dma_addr_t tx_buff_dma;
160 dma_addr_t rx_buff_dma;
161
162 struct qos_info qos;
163
164 spinlock_t lock;
165
166 __u32 new_speed;
167 __u32 flags;
168
169 int tx_buff_offsets[10];
170 int tx_len;
171
172 int transceiver;
173 struct platform_device *pldev;
174};
175
176
177
178#define SMSC_IRCC2_DRIVER_NAME "smsc-ircc2"
179
180#define SMSC_IRCC2_C_IRDA_FALLBACK_SPEED 9600
181#define SMSC_IRCC2_C_DEFAULT_TRANSCEIVER 1
182#define SMSC_IRCC2_C_NET_TIMEOUT 0
183#define SMSC_IRCC2_C_SIR_STOP 0
184
185static const char *driver_name = SMSC_IRCC2_DRIVER_NAME;
186
187
188
189static int smsc_ircc_open(unsigned int firbase, unsigned int sirbase, u8 dma, u8 irq);
190static int smsc_ircc_present(unsigned int fir_base, unsigned int sir_base);
191static void smsc_ircc_setup_io(struct smsc_ircc_cb *self, unsigned int fir_base, unsigned int sir_base, u8 dma, u8 irq);
192static void smsc_ircc_setup_qos(struct smsc_ircc_cb *self);
193static void smsc_ircc_init_chip(struct smsc_ircc_cb *self);
194static int __exit smsc_ircc_close(struct smsc_ircc_cb *self);
195static int smsc_ircc_dma_receive(struct smsc_ircc_cb *self);
196static void smsc_ircc_dma_receive_complete(struct smsc_ircc_cb *self);
197static void smsc_ircc_sir_receive(struct smsc_ircc_cb *self);
198static netdev_tx_t smsc_ircc_hard_xmit_sir(struct sk_buff *skb,
199 struct net_device *dev);
200static netdev_tx_t smsc_ircc_hard_xmit_fir(struct sk_buff *skb,
201 struct net_device *dev);
202static void smsc_ircc_dma_xmit(struct smsc_ircc_cb *self, int bofs);
203static void smsc_ircc_dma_xmit_complete(struct smsc_ircc_cb *self);
204static void smsc_ircc_change_speed(struct smsc_ircc_cb *self, u32 speed);
205static void smsc_ircc_set_sir_speed(struct smsc_ircc_cb *self, u32 speed);
206static irqreturn_t smsc_ircc_interrupt(int irq, void *dev_id);
207static irqreturn_t smsc_ircc_interrupt_sir(struct net_device *dev);
208static void smsc_ircc_sir_start(struct smsc_ircc_cb *self);
209#if SMSC_IRCC2_C_SIR_STOP
210static void smsc_ircc_sir_stop(struct smsc_ircc_cb *self);
211#endif
212static void smsc_ircc_sir_write_wakeup(struct smsc_ircc_cb *self);
213static int smsc_ircc_sir_write(int iobase, int fifo_size, __u8 *buf, int len);
214static int smsc_ircc_net_open(struct net_device *dev);
215static int smsc_ircc_net_close(struct net_device *dev);
216static int smsc_ircc_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
217#if SMSC_IRCC2_C_NET_TIMEOUT
218static void smsc_ircc_timeout(struct net_device *dev);
219#endif
220static int smsc_ircc_is_receiving(struct smsc_ircc_cb *self);
221static void smsc_ircc_probe_transceiver(struct smsc_ircc_cb *self);
222static void smsc_ircc_set_transceiver_for_speed(struct smsc_ircc_cb *self, u32 speed);
223static void smsc_ircc_sir_wait_hw_transmitter_finish(struct smsc_ircc_cb *self);
224
225
226static int __init smsc_ircc_look_for_chips(void);
227static const struct smsc_chip * __init smsc_ircc_probe(unsigned short cfg_base, u8 reg, const struct smsc_chip *chip, char *type);
228static int __init smsc_superio_flat(const struct smsc_chip *chips, unsigned short cfg_base, char *type);
229static int __init smsc_superio_paged(const struct smsc_chip *chips, unsigned short cfg_base, char *type);
230static int __init smsc_superio_fdc(unsigned short cfg_base);
231static int __init smsc_superio_lpc(unsigned short cfg_base);
232#ifdef CONFIG_PCI
233static int __init preconfigure_smsc_chip(struct smsc_ircc_subsystem_configuration *conf);
234static int __init preconfigure_through_82801(struct pci_dev *dev, struct smsc_ircc_subsystem_configuration *conf);
235static void __init preconfigure_ali_port(struct pci_dev *dev,
236 unsigned short port);
237static int __init preconfigure_through_ali(struct pci_dev *dev, struct smsc_ircc_subsystem_configuration *conf);
238static int __init smsc_ircc_preconfigure_subsystems(unsigned short ircc_cfg,
239 unsigned short ircc_fir,
240 unsigned short ircc_sir,
241 unsigned char ircc_dma,
242 unsigned char ircc_irq);
243#endif
244
245
246
247static void smsc_ircc_set_transceiver_toshiba_sat1800(int fir_base, u32 speed);
248static int smsc_ircc_probe_transceiver_toshiba_sat1800(int fir_base);
249static void smsc_ircc_set_transceiver_smsc_ircc_fast_pin_select(int fir_base, u32 speed);
250static int smsc_ircc_probe_transceiver_smsc_ircc_fast_pin_select(int fir_base);
251static void smsc_ircc_set_transceiver_smsc_ircc_atc(int fir_base, u32 speed);
252static int smsc_ircc_probe_transceiver_smsc_ircc_atc(int fir_base);
253
254
255
256static int smsc_ircc_suspend(struct platform_device *dev, pm_message_t state);
257static int smsc_ircc_resume(struct platform_device *dev);
258
259static struct platform_driver smsc_ircc_driver = {
260 .suspend = smsc_ircc_suspend,
261 .resume = smsc_ircc_resume,
262 .driver = {
263 .name = SMSC_IRCC2_DRIVER_NAME,
264 },
265};
266
267
268
269static struct smsc_transceiver smsc_transceivers[] =
270{
271 { "Toshiba Satellite 1800 (GP data pin select)", smsc_ircc_set_transceiver_toshiba_sat1800, smsc_ircc_probe_transceiver_toshiba_sat1800 },
272 { "Fast pin select", smsc_ircc_set_transceiver_smsc_ircc_fast_pin_select, smsc_ircc_probe_transceiver_smsc_ircc_fast_pin_select },
273 { "ATC IRMode", smsc_ircc_set_transceiver_smsc_ircc_atc, smsc_ircc_probe_transceiver_smsc_ircc_atc },
274 { NULL, NULL }
275};
276#define SMSC_IRCC2_C_NUMBER_OF_TRANSCEIVERS (ARRAY_SIZE(smsc_transceivers) - 1)
277
278
279
280#define KEY55_1 0
281#define KEY55_2 1
282#define NoIRDA 2
283#define SIR 0
284#define FIR 4
285#define SERx4 8
286
287static struct smsc_chip __initdata fdc_chips_flat[] =
288{
289
290 { "37C44", KEY55_1|NoIRDA, 0x00, 0x00 },
291 { "37C665GT", KEY55_2|NoIRDA, 0x65, 0x01 },
292 { "37C665GT", KEY55_2|NoIRDA, 0x66, 0x01 },
293 { "37C669", KEY55_2|SIR|SERx4, 0x03, 0x02 },
294 { "37C669", KEY55_2|SIR|SERx4, 0x04, 0x02 },
295 { "37C78", KEY55_2|NoIRDA, 0x78, 0x00 },
296 { "37N769", KEY55_1|FIR|SERx4, 0x28, 0x00 },
297 { "37N869", KEY55_1|FIR|SERx4, 0x29, 0x00 },
298 { NULL }
299};
300
301static struct smsc_chip __initdata fdc_chips_paged[] =
302{
303
304 { "37B72X", KEY55_1|SIR|SERx4, 0x4c, 0x00 },
305 { "37B77X", KEY55_1|SIR|SERx4, 0x43, 0x00 },
306 { "37B78X", KEY55_1|SIR|SERx4, 0x44, 0x00 },
307 { "37B80X", KEY55_1|SIR|SERx4, 0x42, 0x00 },
308 { "37C67X", KEY55_1|FIR|SERx4, 0x40, 0x00 },
309 { "37C93X", KEY55_2|SIR|SERx4, 0x02, 0x01 },
310 { "37C93XAPM", KEY55_1|SIR|SERx4, 0x30, 0x01 },
311 { "37C93XFR", KEY55_2|FIR|SERx4, 0x03, 0x01 },
312 { "37M707", KEY55_1|SIR|SERx4, 0x42, 0x00 },
313 { "37M81X", KEY55_1|SIR|SERx4, 0x4d, 0x00 },
314 { "37N958FR", KEY55_1|FIR|SERx4, 0x09, 0x04 },
315 { "37N971", KEY55_1|FIR|SERx4, 0x0a, 0x00 },
316 { "37N972", KEY55_1|FIR|SERx4, 0x0b, 0x00 },
317 { NULL }
318};
319
320static struct smsc_chip __initdata lpc_chips_flat[] =
321{
322
323 { "47N227", KEY55_1|FIR|SERx4, 0x5a, 0x00 },
324 { "47N227", KEY55_1|FIR|SERx4, 0x7a, 0x00 },
325 { "47N267", KEY55_1|FIR|SERx4, 0x5e, 0x00 },
326 { NULL }
327};
328
329static struct smsc_chip __initdata lpc_chips_paged[] =
330{
331
332 { "47B27X", KEY55_1|SIR|SERx4, 0x51, 0x00 },
333 { "47B37X", KEY55_1|SIR|SERx4, 0x52, 0x00 },
334 { "47M10X", KEY55_1|SIR|SERx4, 0x59, 0x00 },
335 { "47M120", KEY55_1|NoIRDA|SERx4, 0x5c, 0x00 },
336 { "47M13X", KEY55_1|SIR|SERx4, 0x59, 0x00 },
337 { "47M14X", KEY55_1|SIR|SERx4, 0x5f, 0x00 },
338 { "47N252", KEY55_1|FIR|SERx4, 0x0e, 0x00 },
339 { "47S42X", KEY55_1|SIR|SERx4, 0x57, 0x00 },
340 { NULL }
341};
342
343#define SMSCSIO_TYPE_FDC 1
344#define SMSCSIO_TYPE_LPC 2
345#define SMSCSIO_TYPE_FLAT 4
346#define SMSCSIO_TYPE_PAGED 8
347
348static struct smsc_chip_address __initdata possible_addresses[] =
349{
350 { 0x3f0, SMSCSIO_TYPE_FDC|SMSCSIO_TYPE_FLAT|SMSCSIO_TYPE_PAGED },
351 { 0x370, SMSCSIO_TYPE_FDC|SMSCSIO_TYPE_FLAT|SMSCSIO_TYPE_PAGED },
352 { 0xe0, SMSCSIO_TYPE_FDC|SMSCSIO_TYPE_FLAT|SMSCSIO_TYPE_PAGED },
353 { 0x2e, SMSCSIO_TYPE_LPC|SMSCSIO_TYPE_FLAT|SMSCSIO_TYPE_PAGED },
354 { 0x4e, SMSCSIO_TYPE_LPC|SMSCSIO_TYPE_FLAT|SMSCSIO_TYPE_PAGED },
355 { 0, 0 }
356};
357
358
359
360static struct smsc_ircc_cb *dev_self[] = { NULL, NULL };
361static unsigned short dev_count;
362
363static inline void register_bank(int iobase, int bank)
364{
365 outb(((inb(iobase + IRCC_MASTER) & 0xf0) | (bank & 0x07)),
366 iobase + IRCC_MASTER);
367}
368
369
370static const struct pnp_device_id smsc_ircc_pnp_table[] = {
371 { .id = "SMCf010", .driver_data = 0 },
372
373 { }
374};
375MODULE_DEVICE_TABLE(pnp, smsc_ircc_pnp_table);
376
377static int pnp_driver_registered;
378
379#ifdef CONFIG_PNP
380static int __devinit smsc_ircc_pnp_probe(struct pnp_dev *dev,
381 const struct pnp_device_id *dev_id)
382{
383 unsigned int firbase, sirbase;
384 u8 dma, irq;
385
386 if (!(pnp_port_valid(dev, 0) && pnp_port_valid(dev, 1) &&
387 pnp_dma_valid(dev, 0) && pnp_irq_valid(dev, 0)))
388 return -EINVAL;
389
390 sirbase = pnp_port_start(dev, 0);
391 firbase = pnp_port_start(dev, 1);
392 dma = pnp_dma(dev, 0);
393 irq = pnp_irq(dev, 0);
394
395 if (smsc_ircc_open(firbase, sirbase, dma, irq))
396 return -ENODEV;
397
398 return 0;
399}
400
401static struct pnp_driver smsc_ircc_pnp_driver = {
402 .name = "smsc-ircc2",
403 .id_table = smsc_ircc_pnp_table,
404 .probe = smsc_ircc_pnp_probe,
405};
406#else
407static struct pnp_driver smsc_ircc_pnp_driver;
408#endif
409
410
411
412
413
414
415
416
417
418static int __init smsc_ircc_legacy_probe(void)
419{
420 int ret = 0;
421
422#ifdef CONFIG_PCI
423 if (smsc_ircc_preconfigure_subsystems(ircc_cfg, ircc_fir, ircc_sir, ircc_dma, ircc_irq) < 0) {
424
425 IRDA_ERROR("%s, Preconfiguration failed !\n", driver_name);
426 }
427#endif
428
429 if (ircc_fir > 0 && ircc_sir > 0) {
430 IRDA_MESSAGE(" Overriding FIR address 0x%04x\n", ircc_fir);
431 IRDA_MESSAGE(" Overriding SIR address 0x%04x\n", ircc_sir);
432
433 if (smsc_ircc_open(ircc_fir, ircc_sir, ircc_dma, ircc_irq))
434 ret = -ENODEV;
435 } else {
436 ret = -ENODEV;
437
438
439 if (ircc_cfg > 0) {
440 IRDA_MESSAGE(" Overriding configuration address "
441 "0x%04x\n", ircc_cfg);
442 if (!smsc_superio_fdc(ircc_cfg))
443 ret = 0;
444 if (!smsc_superio_lpc(ircc_cfg))
445 ret = 0;
446 }
447
448 if (smsc_ircc_look_for_chips() > 0)
449 ret = 0;
450 }
451 return ret;
452}
453
454
455
456
457
458
459
460static int __init smsc_ircc_init(void)
461{
462 int ret;
463
464 IRDA_DEBUG(1, "%s\n", __func__);
465
466 ret = platform_driver_register(&smsc_ircc_driver);
467 if (ret) {
468 IRDA_ERROR("%s, Can't register driver!\n", driver_name);
469 return ret;
470 }
471
472 dev_count = 0;
473
474 if (smsc_nopnp || !pnp_platform_devices ||
475 ircc_cfg || ircc_fir || ircc_sir ||
476 ircc_dma != DMA_INVAL || ircc_irq != IRQ_INVAL) {
477 ret = smsc_ircc_legacy_probe();
478 } else {
479 if (pnp_register_driver(&smsc_ircc_pnp_driver) == 0)
480 pnp_driver_registered = 1;
481 }
482
483 if (ret) {
484 if (pnp_driver_registered)
485 pnp_unregister_driver(&smsc_ircc_pnp_driver);
486 platform_driver_unregister(&smsc_ircc_driver);
487 }
488
489 return ret;
490}
491
492static netdev_tx_t smsc_ircc_net_xmit(struct sk_buff *skb,
493 struct net_device *dev)
494{
495 struct smsc_ircc_cb *self = netdev_priv(dev);
496
497 if (self->io.speed > 115200)
498 return smsc_ircc_hard_xmit_fir(skb, dev);
499 else
500 return smsc_ircc_hard_xmit_sir(skb, dev);
501}
502
503static const struct net_device_ops smsc_ircc_netdev_ops = {
504 .ndo_open = smsc_ircc_net_open,
505 .ndo_stop = smsc_ircc_net_close,
506 .ndo_do_ioctl = smsc_ircc_net_ioctl,
507 .ndo_start_xmit = smsc_ircc_net_xmit,
508#if SMSC_IRCC2_C_NET_TIMEOUT
509 .ndo_tx_timeout = smsc_ircc_timeout,
510#endif
511};
512
513
514
515
516
517
518
519static int __devinit smsc_ircc_open(unsigned int fir_base, unsigned int sir_base, u8 dma, u8 irq)
520{
521 struct smsc_ircc_cb *self;
522 struct net_device *dev;
523 int err;
524
525 IRDA_DEBUG(1, "%s\n", __func__);
526
527 err = smsc_ircc_present(fir_base, sir_base);
528 if (err)
529 goto err_out;
530
531 err = -ENOMEM;
532 if (dev_count >= ARRAY_SIZE(dev_self)) {
533 IRDA_WARNING("%s(), too many devices!\n", __func__);
534 goto err_out1;
535 }
536
537
538
539
540 dev = alloc_irdadev(sizeof(struct smsc_ircc_cb));
541 if (!dev) {
542 IRDA_WARNING("%s() can't allocate net device\n", __func__);
543 goto err_out1;
544 }
545
546#if SMSC_IRCC2_C_NET_TIMEOUT
547 dev->watchdog_timeo = HZ * 2;
548#endif
549 dev->netdev_ops = &smsc_ircc_netdev_ops;
550
551 self = netdev_priv(dev);
552 self->netdev = dev;
553
554
555 dev->base_addr = self->io.fir_base = fir_base;
556 dev->irq = self->io.irq = irq;
557
558
559 dev_self[dev_count] = self;
560 spin_lock_init(&self->lock);
561
562 self->rx_buff.truesize = SMSC_IRCC2_RX_BUFF_TRUESIZE;
563 self->tx_buff.truesize = SMSC_IRCC2_TX_BUFF_TRUESIZE;
564
565 self->rx_buff.head =
566 dma_alloc_coherent(NULL, self->rx_buff.truesize,
567 &self->rx_buff_dma, GFP_KERNEL);
568 if (self->rx_buff.head == NULL) {
569 IRDA_ERROR("%s, Can't allocate memory for receive buffer!\n",
570 driver_name);
571 goto err_out2;
572 }
573
574 self->tx_buff.head =
575 dma_alloc_coherent(NULL, self->tx_buff.truesize,
576 &self->tx_buff_dma, GFP_KERNEL);
577 if (self->tx_buff.head == NULL) {
578 IRDA_ERROR("%s, Can't allocate memory for transmit buffer!\n",
579 driver_name);
580 goto err_out3;
581 }
582
583 memset(self->rx_buff.head, 0, self->rx_buff.truesize);
584 memset(self->tx_buff.head, 0, self->tx_buff.truesize);
585
586 self->rx_buff.in_frame = FALSE;
587 self->rx_buff.state = OUTSIDE_FRAME;
588 self->tx_buff.data = self->tx_buff.head;
589 self->rx_buff.data = self->rx_buff.head;
590
591 smsc_ircc_setup_io(self, fir_base, sir_base, dma, irq);
592 smsc_ircc_setup_qos(self);
593 smsc_ircc_init_chip(self);
594
595 if (ircc_transceiver > 0 &&
596 ircc_transceiver < SMSC_IRCC2_C_NUMBER_OF_TRANSCEIVERS)
597 self->transceiver = ircc_transceiver;
598 else
599 smsc_ircc_probe_transceiver(self);
600
601 err = register_netdev(self->netdev);
602 if (err) {
603 IRDA_ERROR("%s, Network device registration failed!\n",
604 driver_name);
605 goto err_out4;
606 }
607
608 self->pldev = platform_device_register_simple(SMSC_IRCC2_DRIVER_NAME,
609 dev_count, NULL, 0);
610 if (IS_ERR(self->pldev)) {
611 err = PTR_ERR(self->pldev);
612 goto err_out5;
613 }
614 platform_set_drvdata(self->pldev, self);
615
616 IRDA_MESSAGE("IrDA: Registered device %s\n", dev->name);
617 dev_count++;
618
619 return 0;
620
621 err_out5:
622 unregister_netdev(self->netdev);
623
624 err_out4:
625 dma_free_coherent(NULL, self->tx_buff.truesize,
626 self->tx_buff.head, self->tx_buff_dma);
627 err_out3:
628 dma_free_coherent(NULL, self->rx_buff.truesize,
629 self->rx_buff.head, self->rx_buff_dma);
630 err_out2:
631 free_netdev(self->netdev);
632 dev_self[dev_count] = NULL;
633 err_out1:
634 release_region(fir_base, SMSC_IRCC2_FIR_CHIP_IO_EXTENT);
635 release_region(sir_base, SMSC_IRCC2_SIR_CHIP_IO_EXTENT);
636 err_out:
637 return err;
638}
639
640
641
642
643
644
645
646static int smsc_ircc_present(unsigned int fir_base, unsigned int sir_base)
647{
648 unsigned char low, high, chip, config, dma, irq, version;
649
650 if (!request_region(fir_base, SMSC_IRCC2_FIR_CHIP_IO_EXTENT,
651 driver_name)) {
652 IRDA_WARNING("%s: can't get fir_base of 0x%03x\n",
653 __func__, fir_base);
654 goto out1;
655 }
656
657 if (!request_region(sir_base, SMSC_IRCC2_SIR_CHIP_IO_EXTENT,
658 driver_name)) {
659 IRDA_WARNING("%s: can't get sir_base of 0x%03x\n",
660 __func__, sir_base);
661 goto out2;
662 }
663
664 register_bank(fir_base, 3);
665
666 high = inb(fir_base + IRCC_ID_HIGH);
667 low = inb(fir_base + IRCC_ID_LOW);
668 chip = inb(fir_base + IRCC_CHIP_ID);
669 version = inb(fir_base + IRCC_VERSION);
670 config = inb(fir_base + IRCC_INTERFACE);
671 dma = config & IRCC_INTERFACE_DMA_MASK;
672 irq = (config & IRCC_INTERFACE_IRQ_MASK) >> 4;
673
674 if (high != 0x10 || low != 0xb8 || (chip != 0xf1 && chip != 0xf2)) {
675 IRDA_WARNING("%s(), addr 0x%04x - no device found!\n",
676 __func__, fir_base);
677 goto out3;
678 }
679 IRDA_MESSAGE("SMsC IrDA Controller found\n IrCC version %d.%d, "
680 "firport 0x%03x, sirport 0x%03x dma=%d, irq=%d\n",
681 chip & 0x0f, version, fir_base, sir_base, dma, irq);
682
683 return 0;
684
685 out3:
686 release_region(sir_base, SMSC_IRCC2_SIR_CHIP_IO_EXTENT);
687 out2:
688 release_region(fir_base, SMSC_IRCC2_FIR_CHIP_IO_EXTENT);
689 out1:
690 return -ENODEV;
691}
692
693
694
695
696
697
698
699static void smsc_ircc_setup_io(struct smsc_ircc_cb *self,
700 unsigned int fir_base, unsigned int sir_base,
701 u8 dma, u8 irq)
702{
703 unsigned char config, chip_dma, chip_irq;
704
705 register_bank(fir_base, 3);
706 config = inb(fir_base + IRCC_INTERFACE);
707 chip_dma = config & IRCC_INTERFACE_DMA_MASK;
708 chip_irq = (config & IRCC_INTERFACE_IRQ_MASK) >> 4;
709
710 self->io.fir_base = fir_base;
711 self->io.sir_base = sir_base;
712 self->io.fir_ext = SMSC_IRCC2_FIR_CHIP_IO_EXTENT;
713 self->io.sir_ext = SMSC_IRCC2_SIR_CHIP_IO_EXTENT;
714 self->io.fifo_size = SMSC_IRCC2_FIFO_SIZE;
715 self->io.speed = SMSC_IRCC2_C_IRDA_FALLBACK_SPEED;
716
717 if (irq != IRQ_INVAL) {
718 if (irq != chip_irq)
719 IRDA_MESSAGE("%s, Overriding IRQ - chip says %d, using %d\n",
720 driver_name, chip_irq, irq);
721 self->io.irq = irq;
722 } else
723 self->io.irq = chip_irq;
724
725 if (dma != DMA_INVAL) {
726 if (dma != chip_dma)
727 IRDA_MESSAGE("%s, Overriding DMA - chip says %d, using %d\n",
728 driver_name, chip_dma, dma);
729 self->io.dma = dma;
730 } else
731 self->io.dma = chip_dma;
732
733}
734
735
736
737
738
739
740
741static void smsc_ircc_setup_qos(struct smsc_ircc_cb *self)
742{
743
744 irda_init_max_qos_capabilies(&self->qos);
745
746 self->qos.baud_rate.bits = IR_9600|IR_19200|IR_38400|IR_57600|
747 IR_115200|IR_576000|IR_1152000|(IR_4000000 << 8);
748
749 self->qos.min_turn_time.bits = SMSC_IRCC2_MIN_TURN_TIME;
750 self->qos.window_size.bits = SMSC_IRCC2_WINDOW_SIZE;
751 irda_qos_bits_to_value(&self->qos);
752}
753
754
755
756
757
758
759
760static void smsc_ircc_init_chip(struct smsc_ircc_cb *self)
761{
762 int iobase = self->io.fir_base;
763
764 register_bank(iobase, 0);
765 outb(IRCC_MASTER_RESET, iobase + IRCC_MASTER);
766 outb(0x00, iobase + IRCC_MASTER);
767
768 register_bank(iobase, 1);
769 outb(((inb(iobase + IRCC_SCE_CFGA) & 0x87) | IRCC_CFGA_IRDA_SIR_A),
770 iobase + IRCC_SCE_CFGA);
771
772#ifdef smsc_669
773 outb(((inb(iobase + IRCC_SCE_CFGB) & 0x3f) | IRCC_CFGB_MUX_COM),
774 iobase + IRCC_SCE_CFGB);
775#else
776 outb(((inb(iobase + IRCC_SCE_CFGB) & 0x3f) | IRCC_CFGB_MUX_IR),
777 iobase + IRCC_SCE_CFGB);
778#endif
779 (void) inb(iobase + IRCC_FIFO_THRESHOLD);
780 outb(SMSC_IRCC2_FIFO_THRESHOLD, iobase + IRCC_FIFO_THRESHOLD);
781
782 register_bank(iobase, 4);
783 outb((inb(iobase + IRCC_CONTROL) & 0x30), iobase + IRCC_CONTROL);
784
785 register_bank(iobase, 0);
786 outb(0, iobase + IRCC_LCR_A);
787
788 smsc_ircc_set_sir_speed(self, SMSC_IRCC2_C_IRDA_FALLBACK_SPEED);
789
790
791 outb(0x00, iobase + IRCC_MASTER);
792}
793
794
795
796
797
798
799
800static int smsc_ircc_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
801{
802 struct if_irda_req *irq = (struct if_irda_req *) rq;
803 struct smsc_ircc_cb *self;
804 unsigned long flags;
805 int ret = 0;
806
807 IRDA_ASSERT(dev != NULL, return -1;);
808
809 self = netdev_priv(dev);
810
811 IRDA_ASSERT(self != NULL, return -1;);
812
813 IRDA_DEBUG(2, "%s(), %s, (cmd=0x%X)\n", __func__, dev->name, cmd);
814
815 switch (cmd) {
816 case SIOCSBANDWIDTH:
817 if (!capable(CAP_NET_ADMIN))
818 ret = -EPERM;
819 else {
820
821
822 spin_lock_irqsave(&self->lock, flags);
823 smsc_ircc_change_speed(self, irq->ifr_baudrate);
824 spin_unlock_irqrestore(&self->lock, flags);
825 }
826 break;
827 case SIOCSMEDIABUSY:
828 if (!capable(CAP_NET_ADMIN)) {
829 ret = -EPERM;
830 break;
831 }
832
833 irda_device_set_media_busy(self->netdev, TRUE);
834 break;
835 case SIOCGRECEIVING:
836 irq->ifr_receiving = smsc_ircc_is_receiving(self);
837 break;
838 #if 0
839 case SIOCSDTRRTS:
840 if (!capable(CAP_NET_ADMIN)) {
841 ret = -EPERM;
842 break;
843 }
844 smsc_ircc_sir_set_dtr_rts(dev, irq->ifr_dtr, irq->ifr_rts);
845 break;
846 #endif
847 default:
848 ret = -EOPNOTSUPP;
849 }
850
851 return ret;
852}
853
854#if SMSC_IRCC2_C_NET_TIMEOUT
855
856
857
858
859
860
861
862static void smsc_ircc_timeout(struct net_device *dev)
863{
864 struct smsc_ircc_cb *self = netdev_priv(dev);
865 unsigned long flags;
866
867 IRDA_WARNING("%s: transmit timed out, changing speed to: %d\n",
868 dev->name, self->io.speed);
869 spin_lock_irqsave(&self->lock, flags);
870 smsc_ircc_sir_start(self);
871 smsc_ircc_change_speed(self, self->io.speed);
872 dev->trans_start = jiffies;
873 netif_wake_queue(dev);
874 spin_unlock_irqrestore(&self->lock, flags);
875}
876#endif
877
878
879
880
881
882
883
884
885static netdev_tx_t smsc_ircc_hard_xmit_sir(struct sk_buff *skb,
886 struct net_device *dev)
887{
888 struct smsc_ircc_cb *self;
889 unsigned long flags;
890 s32 speed;
891
892 IRDA_DEBUG(1, "%s\n", __func__);
893
894 IRDA_ASSERT(dev != NULL, return NETDEV_TX_OK;);
895
896 self = netdev_priv(dev);
897 IRDA_ASSERT(self != NULL, return NETDEV_TX_OK;);
898
899 netif_stop_queue(dev);
900
901
902 spin_lock_irqsave(&self->lock, flags);
903
904
905 speed = irda_get_next_speed(skb);
906 if (speed != self->io.speed && speed != -1) {
907
908 if (!skb->len) {
909
910
911
912
913
914
915
916
917
918 smsc_ircc_sir_wait_hw_transmitter_finish(self);
919 smsc_ircc_change_speed(self, speed);
920 spin_unlock_irqrestore(&self->lock, flags);
921 dev_kfree_skb(skb);
922 return NETDEV_TX_OK;
923 }
924 self->new_speed = speed;
925 }
926
927
928 self->tx_buff.data = self->tx_buff.head;
929
930
931 self->tx_buff.len = async_wrap_skb(skb, self->tx_buff.data,
932 self->tx_buff.truesize);
933
934 dev->stats.tx_bytes += self->tx_buff.len;
935
936
937 outb(UART_IER_THRI, self->io.sir_base + UART_IER);
938
939 spin_unlock_irqrestore(&self->lock, flags);
940
941 dev_kfree_skb(skb);
942
943 return NETDEV_TX_OK;
944}
945
946
947
948
949
950
951
952static void smsc_ircc_set_fir_speed(struct smsc_ircc_cb *self, u32 speed)
953{
954 int fir_base, ir_mode, ctrl, fast;
955
956 IRDA_ASSERT(self != NULL, return;);
957 fir_base = self->io.fir_base;
958
959 self->io.speed = speed;
960
961 switch (speed) {
962 default:
963 case 576000:
964 ir_mode = IRCC_CFGA_IRDA_HDLC;
965 ctrl = IRCC_CRC;
966 fast = 0;
967 IRDA_DEBUG(0, "%s(), handling baud of 576000\n", __func__);
968 break;
969 case 1152000:
970 ir_mode = IRCC_CFGA_IRDA_HDLC;
971 ctrl = IRCC_1152 | IRCC_CRC;
972 fast = IRCC_LCR_A_FAST | IRCC_LCR_A_GP_DATA;
973 IRDA_DEBUG(0, "%s(), handling baud of 1152000\n",
974 __func__);
975 break;
976 case 4000000:
977 ir_mode = IRCC_CFGA_IRDA_4PPM;
978 ctrl = IRCC_CRC;
979 fast = IRCC_LCR_A_FAST;
980 IRDA_DEBUG(0, "%s(), handling baud of 4000000\n",
981 __func__);
982 break;
983 }
984 #if 0
985 Now in tranceiver!
986
987 register_bank(fir_base, 0);
988 outb((inb(fir_base + IRCC_LCR_A) & 0xbf) | fast, fir_base + IRCC_LCR_A);
989 #endif
990
991 register_bank(fir_base, 1);
992 outb(((inb(fir_base + IRCC_SCE_CFGA) & IRCC_SCE_CFGA_BLOCK_CTRL_BITS_MASK) | ir_mode), fir_base + IRCC_SCE_CFGA);
993
994 register_bank(fir_base, 4);
995 outb((inb(fir_base + IRCC_CONTROL) & 0x30) | ctrl, fir_base + IRCC_CONTROL);
996}
997
998
999
1000
1001
1002
1003
1004static void smsc_ircc_fir_start(struct smsc_ircc_cb *self)
1005{
1006 struct net_device *dev;
1007 int fir_base;
1008
1009 IRDA_DEBUG(1, "%s\n", __func__);
1010
1011 IRDA_ASSERT(self != NULL, return;);
1012 dev = self->netdev;
1013 IRDA_ASSERT(dev != NULL, return;);
1014
1015 fir_base = self->io.fir_base;
1016
1017
1018
1019
1020 outb(inb(fir_base + IRCC_LCR_A) | IRCC_LCR_A_FIFO_RESET, fir_base + IRCC_LCR_A);
1021
1022
1023
1024
1025 register_bank(fir_base, 1);
1026
1027
1028#ifdef SMSC_669
1029 outb(((inb(fir_base + IRCC_SCE_CFGB) & 0x3f) | IRCC_CFGB_MUX_COM),
1030 fir_base + IRCC_SCE_CFGB);
1031#else
1032 outb(((inb(fir_base + IRCC_SCE_CFGB) & 0x3f) | IRCC_CFGB_MUX_IR),
1033 fir_base + IRCC_SCE_CFGB);
1034#endif
1035 (void) inb(fir_base + IRCC_FIFO_THRESHOLD);
1036
1037
1038 outb(0, fir_base + IRCC_MASTER);
1039 register_bank(fir_base, 0);
1040 outb(IRCC_IER_ACTIVE_FRAME | IRCC_IER_EOM, fir_base + IRCC_IER);
1041 outb(IRCC_MASTER_INT_EN, fir_base + IRCC_MASTER);
1042}
1043
1044
1045
1046
1047
1048
1049
1050static void smsc_ircc_fir_stop(struct smsc_ircc_cb *self)
1051{
1052 int fir_base;
1053
1054 IRDA_DEBUG(1, "%s\n", __func__);
1055
1056 IRDA_ASSERT(self != NULL, return;);
1057
1058 fir_base = self->io.fir_base;
1059 register_bank(fir_base, 0);
1060
1061 outb(inb(fir_base + IRCC_LCR_B) & IRCC_LCR_B_SIP_ENABLE, fir_base + IRCC_LCR_B);
1062}
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073static void smsc_ircc_change_speed(struct smsc_ircc_cb *self, u32 speed)
1074{
1075 struct net_device *dev;
1076 int last_speed_was_sir;
1077
1078 IRDA_DEBUG(0, "%s() changing speed to: %d\n", __func__, speed);
1079
1080 IRDA_ASSERT(self != NULL, return;);
1081 dev = self->netdev;
1082
1083 last_speed_was_sir = self->io.speed <= SMSC_IRCC2_MAX_SIR_SPEED;
1084
1085 #if 0
1086
1087 speed= 1152000;
1088 self->io.speed = speed;
1089 last_speed_was_sir = 0;
1090 smsc_ircc_fir_start(self);
1091 #endif
1092
1093 if (self->io.speed == 0)
1094 smsc_ircc_sir_start(self);
1095
1096 #if 0
1097 if (!last_speed_was_sir) speed = self->io.speed;
1098 #endif
1099
1100 if (self->io.speed != speed)
1101 smsc_ircc_set_transceiver_for_speed(self, speed);
1102
1103 self->io.speed = speed;
1104
1105 if (speed <= SMSC_IRCC2_MAX_SIR_SPEED) {
1106 if (!last_speed_was_sir) {
1107 smsc_ircc_fir_stop(self);
1108 smsc_ircc_sir_start(self);
1109 }
1110 smsc_ircc_set_sir_speed(self, speed);
1111 } else {
1112 if (last_speed_was_sir) {
1113 #if SMSC_IRCC2_C_SIR_STOP
1114 smsc_ircc_sir_stop(self);
1115 #endif
1116 smsc_ircc_fir_start(self);
1117 }
1118 smsc_ircc_set_fir_speed(self, speed);
1119
1120 #if 0
1121 self->tx_buff.len = 10;
1122 self->tx_buff.data = self->tx_buff.head;
1123
1124 smsc_ircc_dma_xmit(self, 4000);
1125 #endif
1126
1127 smsc_ircc_dma_receive(self);
1128 }
1129
1130 netif_wake_queue(dev);
1131}
1132
1133
1134
1135
1136
1137
1138
1139static void smsc_ircc_set_sir_speed(struct smsc_ircc_cb *self, __u32 speed)
1140{
1141 int iobase;
1142 int fcr;
1143 int lcr;
1144 int divisor;
1145
1146 IRDA_DEBUG(0, "%s(), Setting speed to: %d\n", __func__, speed);
1147
1148 IRDA_ASSERT(self != NULL, return;);
1149 iobase = self->io.sir_base;
1150
1151
1152 self->io.speed = speed;
1153
1154
1155 outb(0, iobase + UART_IER);
1156
1157 divisor = SMSC_IRCC2_MAX_SIR_SPEED / speed;
1158
1159 fcr = UART_FCR_ENABLE_FIFO;
1160
1161
1162
1163
1164
1165
1166 fcr |= self->io.speed < 38400 ?
1167 UART_FCR_TRIGGER_1 : UART_FCR_TRIGGER_14;
1168
1169
1170 lcr = UART_LCR_WLEN8;
1171
1172 outb(UART_LCR_DLAB | lcr, iobase + UART_LCR);
1173 outb(divisor & 0xff, iobase + UART_DLL);
1174 outb(divisor >> 8, iobase + UART_DLM);
1175 outb(lcr, iobase + UART_LCR);
1176 outb(fcr, iobase + UART_FCR);
1177
1178
1179 outb(UART_IER_RLSI | UART_IER_RDI | UART_IER_THRI, iobase + UART_IER);
1180
1181 IRDA_DEBUG(2, "%s() speed changed to: %d\n", __func__, speed);
1182}
1183
1184
1185
1186
1187
1188
1189
1190
1191static netdev_tx_t smsc_ircc_hard_xmit_fir(struct sk_buff *skb,
1192 struct net_device *dev)
1193{
1194 struct smsc_ircc_cb *self;
1195 unsigned long flags;
1196 s32 speed;
1197 int mtt;
1198
1199 IRDA_ASSERT(dev != NULL, return NETDEV_TX_OK;);
1200 self = netdev_priv(dev);
1201 IRDA_ASSERT(self != NULL, return NETDEV_TX_OK;);
1202
1203 netif_stop_queue(dev);
1204
1205
1206 spin_lock_irqsave(&self->lock, flags);
1207
1208
1209 speed = irda_get_next_speed(skb);
1210 if (speed != self->io.speed && speed != -1) {
1211
1212 if (!skb->len) {
1213
1214
1215
1216 smsc_ircc_change_speed(self, speed);
1217 spin_unlock_irqrestore(&self->lock, flags);
1218 dev_kfree_skb(skb);
1219 return NETDEV_TX_OK;
1220 }
1221
1222 self->new_speed = speed;
1223 }
1224
1225 skb_copy_from_linear_data(skb, self->tx_buff.head, skb->len);
1226
1227 self->tx_buff.len = skb->len;
1228 self->tx_buff.data = self->tx_buff.head;
1229
1230 mtt = irda_get_mtt(skb);
1231 if (mtt) {
1232 int bofs;
1233
1234
1235
1236
1237
1238 bofs = mtt * (self->io.speed / 1000) / 8000;
1239 if (bofs > 4095)
1240 bofs = 4095;
1241
1242 smsc_ircc_dma_xmit(self, bofs);
1243 } else {
1244
1245 smsc_ircc_dma_xmit(self, 0);
1246 }
1247
1248 spin_unlock_irqrestore(&self->lock, flags);
1249 dev_kfree_skb(skb);
1250
1251 return NETDEV_TX_OK;
1252}
1253
1254
1255
1256
1257
1258
1259
1260static void smsc_ircc_dma_xmit(struct smsc_ircc_cb *self, int bofs)
1261{
1262 int iobase = self->io.fir_base;
1263 u8 ctrl;
1264
1265 IRDA_DEBUG(3, "%s\n", __func__);
1266#if 1
1267
1268 register_bank(iobase, 0);
1269 outb(0x00, iobase + IRCC_LCR_B);
1270#endif
1271 register_bank(iobase, 1);
1272 outb(inb(iobase + IRCC_SCE_CFGB) & ~IRCC_CFGB_DMA_ENABLE,
1273 iobase + IRCC_SCE_CFGB);
1274
1275 self->io.direction = IO_XMIT;
1276
1277
1278 register_bank(iobase, 4);
1279 outb(bofs & 0xff, iobase + IRCC_BOF_COUNT_LO);
1280 ctrl = inb(iobase + IRCC_CONTROL) & 0xf0;
1281 outb(ctrl | ((bofs >> 8) & 0x0f), iobase + IRCC_BOF_COUNT_HI);
1282
1283
1284 outb(self->tx_buff.len >> 8, iobase + IRCC_TX_SIZE_HI);
1285 outb(self->tx_buff.len & 0xff, iobase + IRCC_TX_SIZE_LO);
1286
1287
1288
1289
1290 register_bank(iobase, 1);
1291 outb(inb(iobase + IRCC_SCE_CFGB) | IRCC_CFGB_DMA_ENABLE |
1292 IRCC_CFGB_DMA_BURST, iobase + IRCC_SCE_CFGB);
1293
1294
1295 irda_setup_dma(self->io.dma, self->tx_buff_dma, self->tx_buff.len,
1296 DMA_TX_MODE);
1297
1298
1299
1300 register_bank(iobase, 0);
1301 outb(IRCC_IER_ACTIVE_FRAME | IRCC_IER_EOM, iobase + IRCC_IER);
1302 outb(IRCC_MASTER_INT_EN, iobase + IRCC_MASTER);
1303
1304
1305 outb(IRCC_LCR_B_SCE_TRANSMIT | IRCC_LCR_B_SIP_ENABLE, iobase + IRCC_LCR_B);
1306}
1307
1308
1309
1310
1311
1312
1313
1314
1315static void smsc_ircc_dma_xmit_complete(struct smsc_ircc_cb *self)
1316{
1317 int iobase = self->io.fir_base;
1318
1319 IRDA_DEBUG(3, "%s\n", __func__);
1320#if 0
1321
1322 register_bank(iobase, 0);
1323 outb(0x00, iobase + IRCC_LCR_B);
1324#endif
1325 register_bank(iobase, 1);
1326 outb(inb(iobase + IRCC_SCE_CFGB) & ~IRCC_CFGB_DMA_ENABLE,
1327 iobase + IRCC_SCE_CFGB);
1328
1329
1330 register_bank(iobase, 0);
1331 if (inb(iobase + IRCC_LSR) & IRCC_LSR_UNDERRUN) {
1332 self->netdev->stats.tx_errors++;
1333 self->netdev->stats.tx_fifo_errors++;
1334
1335
1336 register_bank(iobase, 0);
1337 outb(IRCC_MASTER_ERROR_RESET, iobase + IRCC_MASTER);
1338 outb(0x00, iobase + IRCC_MASTER);
1339 } else {
1340 self->netdev->stats.tx_packets++;
1341 self->netdev->stats.tx_bytes += self->tx_buff.len;
1342 }
1343
1344
1345 if (self->new_speed) {
1346 smsc_ircc_change_speed(self, self->new_speed);
1347 self->new_speed = 0;
1348 }
1349
1350 netif_wake_queue(self->netdev);
1351}
1352
1353
1354
1355
1356
1357
1358
1359
1360static int smsc_ircc_dma_receive(struct smsc_ircc_cb *self)
1361{
1362 int iobase = self->io.fir_base;
1363#if 0
1364
1365 register_bank(iobase, 1);
1366 outb(inb(iobase + IRCC_SCE_CFGB) & ~IRCC_CFGB_DMA_ENABLE,
1367 iobase + IRCC_SCE_CFGB);
1368#endif
1369
1370
1371 register_bank(iobase, 0);
1372 outb(0x00, iobase + IRCC_LCR_B);
1373
1374
1375 register_bank(iobase, 1);
1376 outb(inb(iobase + IRCC_SCE_CFGB) & ~IRCC_CFGB_DMA_ENABLE,
1377 iobase + IRCC_SCE_CFGB);
1378
1379 self->io.direction = IO_RECV;
1380 self->rx_buff.data = self->rx_buff.head;
1381
1382
1383 register_bank(iobase, 4);
1384 outb((2050 >> 8) & 0x0f, iobase + IRCC_RX_SIZE_HI);
1385 outb(2050 & 0xff, iobase + IRCC_RX_SIZE_LO);
1386
1387
1388 irda_setup_dma(self->io.dma, self->rx_buff_dma, self->rx_buff.truesize,
1389 DMA_RX_MODE);
1390
1391
1392 register_bank(iobase, 1);
1393 outb(inb(iobase + IRCC_SCE_CFGB) | IRCC_CFGB_DMA_ENABLE |
1394 IRCC_CFGB_DMA_BURST, iobase + IRCC_SCE_CFGB);
1395
1396
1397 register_bank(iobase, 0);
1398 outb(IRCC_IER_ACTIVE_FRAME | IRCC_IER_EOM, iobase + IRCC_IER);
1399 outb(IRCC_MASTER_INT_EN, iobase + IRCC_MASTER);
1400
1401
1402 register_bank(iobase, 0);
1403 outb(IRCC_LCR_B_SCE_RECEIVE | IRCC_LCR_B_SIP_ENABLE,
1404 iobase + IRCC_LCR_B);
1405
1406 return 0;
1407}
1408
1409
1410
1411
1412
1413
1414
1415static void smsc_ircc_dma_receive_complete(struct smsc_ircc_cb *self)
1416{
1417 struct sk_buff *skb;
1418 int len, msgcnt, lsr;
1419 int iobase = self->io.fir_base;
1420
1421 register_bank(iobase, 0);
1422
1423 IRDA_DEBUG(3, "%s\n", __func__);
1424#if 0
1425
1426 register_bank(iobase, 0);
1427 outb(0x00, iobase + IRCC_LCR_B);
1428#endif
1429 register_bank(iobase, 0);
1430 outb(inb(iobase + IRCC_LSAR) & ~IRCC_LSAR_ADDRESS_MASK, iobase + IRCC_LSAR);
1431 lsr= inb(iobase + IRCC_LSR);
1432 msgcnt = inb(iobase + IRCC_LCR_B) & 0x08;
1433
1434 IRDA_DEBUG(2, "%s: dma count = %d\n", __func__,
1435 get_dma_residue(self->io.dma));
1436
1437 len = self->rx_buff.truesize - get_dma_residue(self->io.dma);
1438
1439
1440 if (lsr & (IRCC_LSR_FRAME_ERROR | IRCC_LSR_CRC_ERROR | IRCC_LSR_SIZE_ERROR)) {
1441 self->netdev->stats.rx_errors++;
1442 if (lsr & IRCC_LSR_FRAME_ERROR)
1443 self->netdev->stats.rx_frame_errors++;
1444 if (lsr & IRCC_LSR_CRC_ERROR)
1445 self->netdev->stats.rx_crc_errors++;
1446 if (lsr & IRCC_LSR_SIZE_ERROR)
1447 self->netdev->stats.rx_length_errors++;
1448 if (lsr & (IRCC_LSR_UNDERRUN | IRCC_LSR_OVERRUN))
1449 self->netdev->stats.rx_length_errors++;
1450 return;
1451 }
1452
1453
1454 len -= self->io.speed < 4000000 ? 2 : 4;
1455
1456 if (len < 2 || len > 2050) {
1457 IRDA_WARNING("%s(), bogus len=%d\n", __func__, len);
1458 return;
1459 }
1460 IRDA_DEBUG(2, "%s: msgcnt = %d, len=%d\n", __func__, msgcnt, len);
1461
1462 skb = dev_alloc_skb(len + 1);
1463 if (!skb) {
1464 IRDA_WARNING("%s(), memory squeeze, dropping frame.\n",
1465 __func__);
1466 return;
1467 }
1468
1469 skb_reserve(skb, 1);
1470
1471 memcpy(skb_put(skb, len), self->rx_buff.data, len);
1472 self->netdev->stats.rx_packets++;
1473 self->netdev->stats.rx_bytes += len;
1474
1475 skb->dev = self->netdev;
1476 skb_reset_mac_header(skb);
1477 skb->protocol = htons(ETH_P_IRDA);
1478 netif_rx(skb);
1479}
1480
1481
1482
1483
1484
1485
1486
1487static void smsc_ircc_sir_receive(struct smsc_ircc_cb *self)
1488{
1489 int boguscount = 0;
1490 int iobase;
1491
1492 IRDA_ASSERT(self != NULL, return;);
1493
1494 iobase = self->io.sir_base;
1495
1496
1497
1498
1499
1500 do {
1501 async_unwrap_char(self->netdev, &self->netdev->stats, &self->rx_buff,
1502 inb(iobase + UART_RX));
1503
1504
1505 if (boguscount++ > 32) {
1506 IRDA_DEBUG(2, "%s(), breaking!\n", __func__);
1507 break;
1508 }
1509 } while (inb(iobase + UART_LSR) & UART_LSR_DR);
1510}
1511
1512
1513
1514
1515
1516
1517
1518
1519static irqreturn_t smsc_ircc_interrupt(int dummy, void *dev_id)
1520{
1521 struct net_device *dev = dev_id;
1522 struct smsc_ircc_cb *self = netdev_priv(dev);
1523 int iobase, iir, lcra, lsr;
1524 irqreturn_t ret = IRQ_NONE;
1525
1526
1527 spin_lock(&self->lock);
1528
1529
1530 if (self->io.speed <= SMSC_IRCC2_MAX_SIR_SPEED) {
1531 ret = smsc_ircc_interrupt_sir(dev);
1532 goto irq_ret_unlock;
1533 }
1534
1535 iobase = self->io.fir_base;
1536
1537 register_bank(iobase, 0);
1538 iir = inb(iobase + IRCC_IIR);
1539 if (iir == 0)
1540 goto irq_ret_unlock;
1541 ret = IRQ_HANDLED;
1542
1543
1544 outb(0, iobase + IRCC_IER);
1545 lcra = inb(iobase + IRCC_LCR_A);
1546 lsr = inb(iobase + IRCC_LSR);
1547
1548 IRDA_DEBUG(2, "%s(), iir = 0x%02x\n", __func__, iir);
1549
1550 if (iir & IRCC_IIR_EOM) {
1551 if (self->io.direction == IO_RECV)
1552 smsc_ircc_dma_receive_complete(self);
1553 else
1554 smsc_ircc_dma_xmit_complete(self);
1555
1556 smsc_ircc_dma_receive(self);
1557 }
1558
1559 if (iir & IRCC_IIR_ACTIVE_FRAME) {
1560
1561 }
1562
1563
1564
1565 register_bank(iobase, 0);
1566 outb(IRCC_IER_ACTIVE_FRAME | IRCC_IER_EOM, iobase + IRCC_IER);
1567
1568 irq_ret_unlock:
1569 spin_unlock(&self->lock);
1570
1571 return ret;
1572}
1573
1574
1575
1576
1577
1578
1579static irqreturn_t smsc_ircc_interrupt_sir(struct net_device *dev)
1580{
1581 struct smsc_ircc_cb *self = netdev_priv(dev);
1582 int boguscount = 0;
1583 int iobase;
1584 int iir, lsr;
1585
1586
1587
1588
1589 iobase = self->io.sir_base;
1590
1591 iir = inb(iobase + UART_IIR) & UART_IIR_ID;
1592 if (iir == 0)
1593 return IRQ_NONE;
1594 while (iir) {
1595
1596 lsr = inb(iobase + UART_LSR);
1597
1598 IRDA_DEBUG(4, "%s(), iir=%02x, lsr=%02x, iobase=%#x\n",
1599 __func__, iir, lsr, iobase);
1600
1601 switch (iir) {
1602 case UART_IIR_RLSI:
1603 IRDA_DEBUG(2, "%s(), RLSI\n", __func__);
1604 break;
1605 case UART_IIR_RDI:
1606
1607 smsc_ircc_sir_receive(self);
1608 break;
1609 case UART_IIR_THRI:
1610 if (lsr & UART_LSR_THRE)
1611
1612 smsc_ircc_sir_write_wakeup(self);
1613 break;
1614 default:
1615 IRDA_DEBUG(0, "%s(), unhandled IIR=%#x\n",
1616 __func__, iir);
1617 break;
1618 }
1619
1620
1621 if (boguscount++ > 100)
1622 break;
1623
1624 iir = inb(iobase + UART_IIR) & UART_IIR_ID;
1625 }
1626
1627 return IRQ_HANDLED;
1628}
1629
1630
1631#if 0
1632
1633
1634
1635
1636
1637
1638static int ircc_is_receiving(struct smsc_ircc_cb *self)
1639{
1640 int status = FALSE;
1641
1642
1643 IRDA_DEBUG(1, "%s\n", __func__);
1644
1645 IRDA_ASSERT(self != NULL, return FALSE;);
1646
1647 IRDA_DEBUG(0, "%s: dma count = %d\n", __func__,
1648 get_dma_residue(self->io.dma));
1649
1650 status = (self->rx_buff.state != OUTSIDE_FRAME);
1651
1652 return status;
1653}
1654#endif
1655
1656static int smsc_ircc_request_irq(struct smsc_ircc_cb *self)
1657{
1658 int error;
1659
1660 error = request_irq(self->io.irq, smsc_ircc_interrupt, 0,
1661 self->netdev->name, self->netdev);
1662 if (error)
1663 IRDA_DEBUG(0, "%s(), unable to allocate irq=%d, err=%d\n",
1664 __func__, self->io.irq, error);
1665
1666 return error;
1667}
1668
1669static void smsc_ircc_start_interrupts(struct smsc_ircc_cb *self)
1670{
1671 unsigned long flags;
1672
1673 spin_lock_irqsave(&self->lock, flags);
1674
1675 self->io.speed = 0;
1676 smsc_ircc_change_speed(self, SMSC_IRCC2_C_IRDA_FALLBACK_SPEED);
1677
1678 spin_unlock_irqrestore(&self->lock, flags);
1679}
1680
1681static void smsc_ircc_stop_interrupts(struct smsc_ircc_cb *self)
1682{
1683 int iobase = self->io.fir_base;
1684 unsigned long flags;
1685
1686 spin_lock_irqsave(&self->lock, flags);
1687
1688 register_bank(iobase, 0);
1689 outb(0, iobase + IRCC_IER);
1690 outb(IRCC_MASTER_RESET, iobase + IRCC_MASTER);
1691 outb(0x00, iobase + IRCC_MASTER);
1692
1693 spin_unlock_irqrestore(&self->lock, flags);
1694}
1695
1696
1697
1698
1699
1700
1701
1702
1703static int smsc_ircc_net_open(struct net_device *dev)
1704{
1705 struct smsc_ircc_cb *self;
1706 char hwname[16];
1707
1708 IRDA_DEBUG(1, "%s\n", __func__);
1709
1710 IRDA_ASSERT(dev != NULL, return -1;);
1711 self = netdev_priv(dev);
1712 IRDA_ASSERT(self != NULL, return 0;);
1713
1714 if (self->io.suspended) {
1715 IRDA_DEBUG(0, "%s(), device is suspended\n", __func__);
1716 return -EAGAIN;
1717 }
1718
1719 if (request_irq(self->io.irq, smsc_ircc_interrupt, 0, dev->name,
1720 (void *) dev)) {
1721 IRDA_DEBUG(0, "%s(), unable to allocate irq=%d\n",
1722 __func__, self->io.irq);
1723 return -EAGAIN;
1724 }
1725
1726 smsc_ircc_start_interrupts(self);
1727
1728
1729
1730 sprintf(hwname, "SMSC @ 0x%03x", self->io.fir_base);
1731
1732
1733
1734
1735
1736 self->irlap = irlap_open(dev, &self->qos, hwname);
1737
1738
1739
1740
1741
1742 if (request_dma(self->io.dma, dev->name)) {
1743 smsc_ircc_net_close(dev);
1744
1745 IRDA_WARNING("%s(), unable to allocate DMA=%d\n",
1746 __func__, self->io.dma);
1747 return -EAGAIN;
1748 }
1749
1750 netif_start_queue(dev);
1751
1752 return 0;
1753}
1754
1755
1756
1757
1758
1759
1760
1761static int smsc_ircc_net_close(struct net_device *dev)
1762{
1763 struct smsc_ircc_cb *self;
1764
1765 IRDA_DEBUG(1, "%s\n", __func__);
1766
1767 IRDA_ASSERT(dev != NULL, return -1;);
1768 self = netdev_priv(dev);
1769 IRDA_ASSERT(self != NULL, return 0;);
1770
1771
1772 netif_stop_queue(dev);
1773
1774
1775 if (self->irlap)
1776 irlap_close(self->irlap);
1777 self->irlap = NULL;
1778
1779 smsc_ircc_stop_interrupts(self);
1780
1781
1782 if (!self->io.suspended)
1783 free_irq(self->io.irq, dev);
1784
1785 disable_dma(self->io.dma);
1786 free_dma(self->io.dma);
1787
1788 return 0;
1789}
1790
1791static int smsc_ircc_suspend(struct platform_device *dev, pm_message_t state)
1792{
1793 struct smsc_ircc_cb *self = platform_get_drvdata(dev);
1794
1795 if (!self->io.suspended) {
1796 IRDA_DEBUG(1, "%s, Suspending\n", driver_name);
1797
1798 rtnl_lock();
1799 if (netif_running(self->netdev)) {
1800 netif_device_detach(self->netdev);
1801 smsc_ircc_stop_interrupts(self);
1802 free_irq(self->io.irq, self->netdev);
1803 disable_dma(self->io.dma);
1804 }
1805 self->io.suspended = 1;
1806 rtnl_unlock();
1807 }
1808
1809 return 0;
1810}
1811
1812static int smsc_ircc_resume(struct platform_device *dev)
1813{
1814 struct smsc_ircc_cb *self = platform_get_drvdata(dev);
1815
1816 if (self->io.suspended) {
1817 IRDA_DEBUG(1, "%s, Waking up\n", driver_name);
1818
1819 rtnl_lock();
1820 smsc_ircc_init_chip(self);
1821 if (netif_running(self->netdev)) {
1822 if (smsc_ircc_request_irq(self)) {
1823
1824
1825
1826
1827 unregister_netdevice(self->netdev);
1828 } else {
1829 enable_dma(self->io.dma);
1830 smsc_ircc_start_interrupts(self);
1831 netif_device_attach(self->netdev);
1832 }
1833 }
1834 self->io.suspended = 0;
1835 rtnl_unlock();
1836 }
1837 return 0;
1838}
1839
1840
1841
1842
1843
1844
1845
1846static int __exit smsc_ircc_close(struct smsc_ircc_cb *self)
1847{
1848 IRDA_DEBUG(1, "%s\n", __func__);
1849
1850 IRDA_ASSERT(self != NULL, return -1;);
1851
1852 platform_device_unregister(self->pldev);
1853
1854
1855 unregister_netdev(self->netdev);
1856
1857 smsc_ircc_stop_interrupts(self);
1858
1859
1860 IRDA_DEBUG(0, "%s(), releasing 0x%03x\n", __func__,
1861 self->io.fir_base);
1862
1863 release_region(self->io.fir_base, self->io.fir_ext);
1864
1865 IRDA_DEBUG(0, "%s(), releasing 0x%03x\n", __func__,
1866 self->io.sir_base);
1867
1868 release_region(self->io.sir_base, self->io.sir_ext);
1869
1870 if (self->tx_buff.head)
1871 dma_free_coherent(NULL, self->tx_buff.truesize,
1872 self->tx_buff.head, self->tx_buff_dma);
1873
1874 if (self->rx_buff.head)
1875 dma_free_coherent(NULL, self->rx_buff.truesize,
1876 self->rx_buff.head, self->rx_buff_dma);
1877
1878 free_netdev(self->netdev);
1879
1880 return 0;
1881}
1882
1883static void __exit smsc_ircc_cleanup(void)
1884{
1885 int i;
1886
1887 IRDA_DEBUG(1, "%s\n", __func__);
1888
1889 for (i = 0; i < 2; i++) {
1890 if (dev_self[i])
1891 smsc_ircc_close(dev_self[i]);
1892 }
1893
1894 if (pnp_driver_registered)
1895 pnp_unregister_driver(&smsc_ircc_pnp_driver);
1896
1897 platform_driver_unregister(&smsc_ircc_driver);
1898}
1899
1900
1901
1902
1903
1904
1905
1906static void smsc_ircc_sir_start(struct smsc_ircc_cb *self)
1907{
1908 struct net_device *dev;
1909 int fir_base, sir_base;
1910
1911 IRDA_DEBUG(3, "%s\n", __func__);
1912
1913 IRDA_ASSERT(self != NULL, return;);
1914 dev = self->netdev;
1915 IRDA_ASSERT(dev != NULL, return;);
1916
1917 fir_base = self->io.fir_base;
1918 sir_base = self->io.sir_base;
1919
1920
1921 outb(IRCC_MASTER_RESET, fir_base + IRCC_MASTER);
1922
1923 #if SMSC_IRCC2_C_SIR_STOP
1924
1925 #endif
1926
1927 register_bank(fir_base, 1);
1928 outb(((inb(fir_base + IRCC_SCE_CFGA) & IRCC_SCE_CFGA_BLOCK_CTRL_BITS_MASK) | IRCC_CFGA_IRDA_SIR_A), fir_base + IRCC_SCE_CFGA);
1929
1930
1931 outb(UART_LCR_WLEN8, sir_base + UART_LCR);
1932 outb((UART_MCR_DTR | UART_MCR_RTS | UART_MCR_OUT2), sir_base + UART_MCR);
1933
1934
1935 outb(UART_IER_RLSI | UART_IER_RDI |UART_IER_THRI, sir_base + UART_IER);
1936
1937 IRDA_DEBUG(3, "%s() - exit\n", __func__);
1938
1939 outb(0x00, fir_base + IRCC_MASTER);
1940}
1941
1942#if SMSC_IRCC2_C_SIR_STOP
1943void smsc_ircc_sir_stop(struct smsc_ircc_cb *self)
1944{
1945 int iobase;
1946
1947 IRDA_DEBUG(3, "%s\n", __func__);
1948 iobase = self->io.sir_base;
1949
1950
1951 outb(0, iobase + UART_MCR);
1952
1953
1954 outb(0, iobase + UART_IER);
1955}
1956#endif
1957
1958
1959
1960
1961
1962
1963
1964
1965static void smsc_ircc_sir_write_wakeup(struct smsc_ircc_cb *self)
1966{
1967 int actual = 0;
1968 int iobase;
1969 int fcr;
1970
1971 IRDA_ASSERT(self != NULL, return;);
1972
1973 IRDA_DEBUG(4, "%s\n", __func__);
1974
1975 iobase = self->io.sir_base;
1976
1977
1978 if (self->tx_buff.len > 0) {
1979
1980 actual = smsc_ircc_sir_write(iobase, self->io.fifo_size,
1981 self->tx_buff.data, self->tx_buff.len);
1982 self->tx_buff.data += actual;
1983 self->tx_buff.len -= actual;
1984 } else {
1985
1986
1987
1988
1989
1990
1991
1992
1993 if (self->new_speed) {
1994 IRDA_DEBUG(5, "%s(), Changing speed to %d.\n",
1995 __func__, self->new_speed);
1996 smsc_ircc_sir_wait_hw_transmitter_finish(self);
1997 smsc_ircc_change_speed(self, self->new_speed);
1998 self->new_speed = 0;
1999 } else {
2000
2001 netif_wake_queue(self->netdev);
2002 }
2003 self->netdev->stats.tx_packets++;
2004
2005 if (self->io.speed <= 115200) {
2006
2007
2008
2009
2010 fcr = UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_RCVR;
2011 fcr |= self->io.speed < 38400 ?
2012 UART_FCR_TRIGGER_1 : UART_FCR_TRIGGER_14;
2013
2014 outb(fcr, iobase + UART_FCR);
2015
2016
2017 outb(UART_IER_RDI, iobase + UART_IER);
2018 }
2019 }
2020}
2021
2022
2023
2024
2025
2026
2027
2028static int smsc_ircc_sir_write(int iobase, int fifo_size, __u8 *buf, int len)
2029{
2030 int actual = 0;
2031
2032
2033 if (!(inb(iobase + UART_LSR) & UART_LSR_THRE)) {
2034 IRDA_WARNING("%s(), failed, fifo not empty!\n", __func__);
2035 return 0;
2036 }
2037
2038
2039 while (fifo_size-- > 0 && actual < len) {
2040
2041 outb(buf[actual], iobase + UART_TX);
2042 actual++;
2043 }
2044 return actual;
2045}
2046
2047
2048
2049
2050
2051
2052
2053static int smsc_ircc_is_receiving(struct smsc_ircc_cb *self)
2054{
2055 return self->rx_buff.state != OUTSIDE_FRAME;
2056}
2057
2058
2059
2060
2061
2062
2063
2064
2065static void smsc_ircc_probe_transceiver(struct smsc_ircc_cb *self)
2066{
2067 unsigned int i;
2068
2069 IRDA_ASSERT(self != NULL, return;);
2070
2071 for (i = 0; smsc_transceivers[i].name != NULL; i++)
2072 if (smsc_transceivers[i].probe(self->io.fir_base)) {
2073 IRDA_MESSAGE(" %s transceiver found\n",
2074 smsc_transceivers[i].name);
2075 self->transceiver= i + 1;
2076 return;
2077 }
2078
2079 IRDA_MESSAGE("No transceiver found. Defaulting to %s\n",
2080 smsc_transceivers[SMSC_IRCC2_C_DEFAULT_TRANSCEIVER].name);
2081
2082 self->transceiver = SMSC_IRCC2_C_DEFAULT_TRANSCEIVER;
2083}
2084
2085
2086
2087
2088
2089
2090
2091
2092static void smsc_ircc_set_transceiver_for_speed(struct smsc_ircc_cb *self, u32 speed)
2093{
2094 unsigned int trx;
2095
2096 trx = self->transceiver;
2097 if (trx > 0)
2098 smsc_transceivers[trx - 1].set_for_speed(self->io.fir_base, speed);
2099}
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124static void smsc_ircc_sir_wait_hw_transmitter_finish(struct smsc_ircc_cb *self)
2125{
2126 int iobase = self->io.sir_base;
2127 int count = SMSC_IRCC2_HW_TRANSMITTER_TIMEOUT_US;
2128
2129
2130 while (count-- > 0 && !(inb(iobase + UART_LSR) & UART_LSR_TEMT))
2131 udelay(1);
2132
2133 if (count < 0)
2134 IRDA_DEBUG(0, "%s(): stuck transmitter\n", __func__);
2135}
2136
2137
2138
2139
2140
2141
2142
2143
2144static int __init smsc_ircc_look_for_chips(void)
2145{
2146 struct smsc_chip_address *address;
2147 char *type;
2148 unsigned int cfg_base, found;
2149
2150 found = 0;
2151 address = possible_addresses;
2152
2153 while (address->cfg_base) {
2154 cfg_base = address->cfg_base;
2155
2156
2157
2158 if (address->type & SMSCSIO_TYPE_FDC) {
2159 type = "FDC";
2160 if (address->type & SMSCSIO_TYPE_FLAT)
2161 if (!smsc_superio_flat(fdc_chips_flat, cfg_base, type))
2162 found++;
2163
2164 if (address->type & SMSCSIO_TYPE_PAGED)
2165 if (!smsc_superio_paged(fdc_chips_paged, cfg_base, type))
2166 found++;
2167 }
2168 if (address->type & SMSCSIO_TYPE_LPC) {
2169 type = "LPC";
2170 if (address->type & SMSCSIO_TYPE_FLAT)
2171 if (!smsc_superio_flat(lpc_chips_flat, cfg_base, type))
2172 found++;
2173
2174 if (address->type & SMSCSIO_TYPE_PAGED)
2175 if (!smsc_superio_paged(lpc_chips_paged, cfg_base, type))
2176 found++;
2177 }
2178 address++;
2179 }
2180 return found;
2181}
2182
2183
2184
2185
2186
2187
2188
2189static int __init smsc_superio_flat(const struct smsc_chip *chips, unsigned short cfgbase, char *type)
2190{
2191 unsigned short firbase, sirbase;
2192 u8 mode, dma, irq;
2193 int ret = -ENODEV;
2194
2195 IRDA_DEBUG(1, "%s\n", __func__);
2196
2197 if (smsc_ircc_probe(cfgbase, SMSCSIOFLAT_DEVICEID_REG, chips, type) == NULL)
2198 return ret;
2199
2200 outb(SMSCSIOFLAT_UARTMODE0C_REG, cfgbase);
2201 mode = inb(cfgbase + 1);
2202
2203
2204
2205 if (!(mode & SMSCSIOFLAT_UART2MODE_VAL_IRDA))
2206 IRDA_WARNING("%s(): IrDA not enabled\n", __func__);
2207
2208 outb(SMSCSIOFLAT_UART2BASEADDR_REG, cfgbase);
2209 sirbase = inb(cfgbase + 1) << 2;
2210
2211
2212 outb(SMSCSIOFLAT_FIRBASEADDR_REG, cfgbase);
2213 firbase = inb(cfgbase + 1) << 3;
2214
2215
2216 outb(SMSCSIOFLAT_FIRDMASELECT_REG, cfgbase);
2217 dma = inb(cfgbase + 1) & SMSCSIOFLAT_FIRDMASELECT_MASK;
2218
2219
2220 outb(SMSCSIOFLAT_UARTIRQSELECT_REG, cfgbase);
2221 irq = inb(cfgbase + 1) & SMSCSIOFLAT_UART2IRQSELECT_MASK;
2222
2223 IRDA_MESSAGE("%s(): fir: 0x%02x, sir: 0x%02x, dma: %02d, irq: %d, mode: 0x%02x\n", __func__, firbase, sirbase, dma, irq, mode);
2224
2225 if (firbase && smsc_ircc_open(firbase, sirbase, dma, irq) == 0)
2226 ret = 0;
2227
2228
2229 outb(SMSCSIO_CFGEXITKEY, cfgbase);
2230
2231 return ret;
2232}
2233
2234
2235
2236
2237
2238
2239
2240static int __init smsc_superio_paged(const struct smsc_chip *chips, unsigned short cfg_base, char *type)
2241{
2242 unsigned short fir_io, sir_io;
2243 int ret = -ENODEV;
2244
2245 IRDA_DEBUG(1, "%s\n", __func__);
2246
2247 if (smsc_ircc_probe(cfg_base, 0x20, chips, type) == NULL)
2248 return ret;
2249
2250
2251 outb(0x07, cfg_base);
2252 outb(0x05, cfg_base + 1);
2253
2254
2255 outb(0x60, cfg_base);
2256 sir_io = inb(cfg_base + 1) << 8;
2257 outb(0x61, cfg_base);
2258 sir_io |= inb(cfg_base + 1);
2259
2260
2261 outb(0x62, cfg_base);
2262 fir_io = inb(cfg_base + 1) << 8;
2263 outb(0x63, cfg_base);
2264 fir_io |= inb(cfg_base + 1);
2265 outb(0x2b, cfg_base);
2266
2267 if (fir_io && smsc_ircc_open(fir_io, sir_io, ircc_dma, ircc_irq) == 0)
2268 ret = 0;
2269
2270
2271 outb(SMSCSIO_CFGEXITKEY, cfg_base);
2272
2273 return ret;
2274}
2275
2276
2277static int __init smsc_access(unsigned short cfg_base, unsigned char reg)
2278{
2279 IRDA_DEBUG(1, "%s\n", __func__);
2280
2281 outb(reg, cfg_base);
2282 return inb(cfg_base) != reg ? -1 : 0;
2283}
2284
2285static const struct smsc_chip * __init smsc_ircc_probe(unsigned short cfg_base, u8 reg, const struct smsc_chip *chip, char *type)
2286{
2287 u8 devid, xdevid, rev;
2288
2289 IRDA_DEBUG(1, "%s\n", __func__);
2290
2291
2292
2293 outb(SMSCSIO_CFGEXITKEY, cfg_base);
2294
2295 if (inb(cfg_base) == SMSCSIO_CFGEXITKEY)
2296 return NULL;
2297
2298 outb(reg, cfg_base);
2299
2300 xdevid = inb(cfg_base + 1);
2301
2302
2303
2304 outb(SMSCSIO_CFGACCESSKEY, cfg_base);
2305
2306 #if 0
2307 if (smsc_access(cfg_base,0x55))
2308 return NULL;
2309 #endif
2310
2311
2312
2313 if (smsc_access(cfg_base, reg))
2314 return NULL;
2315
2316 devid = inb(cfg_base + 1);
2317
2318 if (devid == 0 || devid == 0xff)
2319 return NULL;
2320
2321
2322
2323 if (smsc_access(cfg_base, reg + 1))
2324 return NULL;
2325
2326 rev = inb(cfg_base + 1);
2327
2328 if (rev >= 128)
2329 return NULL;
2330
2331 if (devid == xdevid)
2332 return NULL;
2333
2334
2335
2336 while (chip->devid != devid) {
2337
2338 chip++;
2339
2340 if (chip->name == NULL)
2341 return NULL;
2342 }
2343
2344 IRDA_MESSAGE("found SMC SuperIO Chip (devid=0x%02x rev=%02X base=0x%04x): %s%s\n",
2345 devid, rev, cfg_base, type, chip->name);
2346
2347 if (chip->rev > rev) {
2348 IRDA_MESSAGE("Revision higher than expected\n");
2349 return NULL;
2350 }
2351
2352 if (chip->flags & NoIRDA)
2353 IRDA_MESSAGE("chipset does not support IRDA\n");
2354
2355 return chip;
2356}
2357
2358static int __init smsc_superio_fdc(unsigned short cfg_base)
2359{
2360 int ret = -1;
2361
2362 if (!request_region(cfg_base, 2, driver_name)) {
2363 IRDA_WARNING("%s: can't get cfg_base of 0x%03x\n",
2364 __func__, cfg_base);
2365 } else {
2366 if (!smsc_superio_flat(fdc_chips_flat, cfg_base, "FDC") ||
2367 !smsc_superio_paged(fdc_chips_paged, cfg_base, "FDC"))
2368 ret = 0;
2369
2370 release_region(cfg_base, 2);
2371 }
2372
2373 return ret;
2374}
2375
2376static int __init smsc_superio_lpc(unsigned short cfg_base)
2377{
2378 int ret = -1;
2379
2380 if (!request_region(cfg_base, 2, driver_name)) {
2381 IRDA_WARNING("%s: can't get cfg_base of 0x%03x\n",
2382 __func__, cfg_base);
2383 } else {
2384 if (!smsc_superio_flat(lpc_chips_flat, cfg_base, "LPC") ||
2385 !smsc_superio_paged(lpc_chips_paged, cfg_base, "LPC"))
2386 ret = 0;
2387
2388 release_region(cfg_base, 2);
2389 }
2390 return ret;
2391}
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407#ifdef CONFIG_PCI
2408static struct smsc_ircc_subsystem_configuration subsystem_configurations[] __initdata = {
2409
2410
2411
2412
2413
2414
2415 {
2416
2417 .vendor = PCI_VENDOR_ID_INTEL,
2418 .device = 0x24cc,
2419 .subvendor = 0x103c,
2420 .subdevice = 0x08bc,
2421 .sir_io = 0x02f8,
2422 .fir_io = 0x0130,
2423 .fir_irq = 0x05,
2424 .fir_dma = 0x03,
2425 .cfg_base = 0x004e,
2426 .preconfigure = preconfigure_through_82801,
2427 .name = "HP nx5000 family",
2428 },
2429 {
2430 .vendor = PCI_VENDOR_ID_INTEL,
2431 .device = 0x24cc,
2432 .subvendor = 0x103c,
2433 .subdevice = 0x088c,
2434
2435 .sir_io = 0x02f8,
2436 .fir_io = 0x0130,
2437 .fir_irq = 0x05,
2438 .fir_dma = 0x03,
2439 .cfg_base = 0x004e,
2440 .preconfigure = preconfigure_through_82801,
2441 .name = "HP nc8000 family",
2442 },
2443 {
2444 .vendor = PCI_VENDOR_ID_INTEL,
2445 .device = 0x24cc,
2446 .subvendor = 0x103c,
2447 .subdevice = 0x0890,
2448 .sir_io = 0x02f8,
2449 .fir_io = 0x0130,
2450 .fir_irq = 0x05,
2451 .fir_dma = 0x03,
2452 .cfg_base = 0x004e,
2453 .preconfigure = preconfigure_through_82801,
2454 .name = "HP nc6000 family",
2455 },
2456 {
2457 .vendor = PCI_VENDOR_ID_INTEL,
2458 .device = 0x24cc,
2459 .subvendor = 0x0e11,
2460 .subdevice = 0x0860,
2461
2462 .sir_io = 0x02e8,
2463 .fir_io = 0x02f8,
2464 .fir_irq = 0x07,
2465 .fir_dma = 0x03,
2466 .cfg_base = 0x002e,
2467 .preconfigure = preconfigure_through_82801,
2468 .name = "Compaq x1000 family",
2469 },
2470 {
2471
2472 .vendor = PCI_VENDOR_ID_INTEL,
2473 .device = 0x24c0,
2474 .subvendor = 0x1179,
2475 .subdevice = 0xffff,
2476 .sir_io = 0x03f8,
2477 .fir_io = 0x0130,
2478 .fir_irq = 0x07,
2479 .fir_dma = 0x01,
2480 .cfg_base = 0x002e,
2481 .preconfigure = preconfigure_through_82801,
2482 .name = "Toshiba laptop with Intel 82801DB/DBL LPC bridge",
2483 },
2484 {
2485 .vendor = PCI_VENDOR_ID_INTEL,
2486 .device = 0x248c,
2487 .subvendor = 0x1179,
2488 .subdevice = 0xffff,
2489 .sir_io = 0x03f8,
2490 .fir_io = 0x0130,
2491 .fir_irq = 0x03,
2492 .fir_dma = 0x03,
2493 .cfg_base = 0x002e,
2494 .preconfigure = preconfigure_through_82801,
2495 .name = "Toshiba laptop with Intel 82801CAM ISA bridge",
2496 },
2497 {
2498
2499 .vendor = PCI_VENDOR_ID_INTEL,
2500 .device = 0x24cc,
2501 .subvendor = 0x1179,
2502 .subdevice = 0xffff,
2503 .sir_io = 0x03f8,
2504 .fir_io = 0x0130,
2505 .fir_irq = 0x03,
2506 .fir_dma = 0x03,
2507 .cfg_base = 0x002e,
2508 .preconfigure = preconfigure_through_82801,
2509 .name = "Toshiba laptop with Intel 8281DBM LPC bridge",
2510 },
2511 {
2512
2513 .vendor = PCI_VENDOR_ID_AL,
2514 .device = 0x1533,
2515 .subvendor = 0x1179,
2516 .subdevice = 0xffff,
2517 .sir_io = 0x02e8,
2518 .fir_io = 0x02f8,
2519 .fir_irq = 0x07,
2520 .fir_dma = 0x03,
2521 .cfg_base = 0x002e,
2522 .preconfigure = preconfigure_through_ali,
2523 .name = "Toshiba laptop with ALi ISA bridge",
2524 },
2525 { }
2526};
2527
2528
2529
2530
2531
2532
2533
2534static int __init preconfigure_smsc_chip(struct
2535 smsc_ircc_subsystem_configuration
2536 *conf)
2537{
2538 unsigned short iobase = conf->cfg_base;
2539 unsigned char tmpbyte;
2540
2541 outb(LPC47N227_CFGACCESSKEY, iobase);
2542 outb(SMSCSIOFLAT_DEVICEID_REG, iobase);
2543 tmpbyte = inb(iobase +1);
2544 IRDA_DEBUG(0,
2545 "Detected Chip id: 0x%02x, setting up registers...\n",
2546 tmpbyte);
2547
2548
2549 outb(0x24, iobase);
2550 outb(0x00, iobase + 1);
2551 outb(SMSCSIOFLAT_UART2BASEADDR_REG, iobase);
2552 outb( (conf->sir_io >> 2), iobase + 1);
2553 tmpbyte = inb(iobase + 1);
2554 if (tmpbyte != (conf->sir_io >> 2) ) {
2555 IRDA_WARNING("ERROR: could not configure SIR ioport.\n");
2556 IRDA_WARNING("Try to supply ircc_cfg argument.\n");
2557 return -ENXIO;
2558 }
2559
2560
2561 outb(SMSCSIOFLAT_UARTIRQSELECT_REG, iobase);
2562 tmpbyte = inb(iobase + 1);
2563 tmpbyte &= SMSCSIOFLAT_UART1IRQSELECT_MASK;
2564 tmpbyte |= (conf->fir_irq & SMSCSIOFLAT_UART2IRQSELECT_MASK);
2565 outb(tmpbyte, iobase + 1);
2566 tmpbyte = inb(iobase + 1) & SMSCSIOFLAT_UART2IRQSELECT_MASK;
2567 if (tmpbyte != conf->fir_irq) {
2568 IRDA_WARNING("ERROR: could not configure FIR IRQ channel.\n");
2569 return -ENXIO;
2570 }
2571
2572
2573 outb(SMSCSIOFLAT_FIRBASEADDR_REG, iobase);
2574 outb((conf->fir_io >> 3), iobase + 1);
2575 tmpbyte = inb(iobase + 1);
2576 if (tmpbyte != (conf->fir_io >> 3) ) {
2577 IRDA_WARNING("ERROR: could not configure FIR I/O port.\n");
2578 return -ENXIO;
2579 }
2580
2581
2582 outb(SMSCSIOFLAT_FIRDMASELECT_REG, iobase);
2583 outb((conf->fir_dma & LPC47N227_FIRDMASELECT_MASK), iobase + 1);
2584 tmpbyte = inb(iobase + 1) & LPC47N227_FIRDMASELECT_MASK;
2585 if (tmpbyte != (conf->fir_dma & LPC47N227_FIRDMASELECT_MASK)) {
2586 IRDA_WARNING("ERROR: could not configure FIR DMA channel.\n");
2587 return -ENXIO;
2588 }
2589
2590 outb(SMSCSIOFLAT_UARTMODE0C_REG, iobase);
2591 tmpbyte = inb(iobase + 1);
2592 tmpbyte &= ~SMSCSIOFLAT_UART2MODE_MASK |
2593 SMSCSIOFLAT_UART2MODE_VAL_IRDA;
2594 outb(tmpbyte, iobase + 1);
2595
2596 outb(LPC47N227_APMBOOTDRIVE_REG, iobase);
2597 tmpbyte = inb(iobase + 1);
2598 outb(tmpbyte | LPC47N227_UART2AUTOPWRDOWN_MASK, iobase + 1);
2599
2600
2601 outb(0x0a, iobase);
2602 tmpbyte = inb(iobase + 1);
2603 outb(tmpbyte | 0x40, iobase + 1);
2604
2605 outb(LPC47N227_UART12POWER_REG, iobase);
2606 tmpbyte = inb(iobase + 1);
2607 outb(tmpbyte | LPC47N227_UART2POWERDOWN_MASK, iobase + 1);
2608
2609 outb(LPC47N227_FDCPOWERVALIDCONF_REG, iobase);
2610 tmpbyte = inb(iobase + 1);
2611 outb(tmpbyte | LPC47N227_VALID_MASK, iobase + 1);
2612
2613 outb(LPC47N227_CFGEXITKEY, iobase);
2614
2615 return 0;
2616}
2617
2618
2619#define VID 0x00
2620#define DID 0x02
2621#define PIRQ_A_D_ROUT 0x60
2622#define SIRQ_CNTL 0x64
2623#define PIRQ_E_H_ROUT 0x68
2624#define PCI_DMA_C 0x90
2625
2626#define COM_DEC 0xe0
2627#define GEN1_DEC 0xe4
2628#define LPC_EN 0xe6
2629#define GEN2_DEC 0xec
2630
2631
2632
2633
2634
2635static int __init preconfigure_through_82801(struct pci_dev *dev,
2636 struct
2637 smsc_ircc_subsystem_configuration
2638 *conf)
2639{
2640 unsigned short tmpword;
2641 unsigned char tmpbyte;
2642
2643 IRDA_MESSAGE("Setting up Intel 82801 controller and SMSC device\n");
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662 pci_read_config_byte(dev, COM_DEC, &tmpbyte);
2663 tmpbyte &= 0xf8;
2664 switch(conf->sir_io) {
2665 case 0x3f8:
2666 tmpbyte |= 0x00;
2667 break;
2668 case 0x2f8:
2669 tmpbyte |= 0x01;
2670 break;
2671 case 0x220:
2672 tmpbyte |= 0x02;
2673 break;
2674 case 0x228:
2675 tmpbyte |= 0x03;
2676 break;
2677 case 0x238:
2678 tmpbyte |= 0x04;
2679 break;
2680 case 0x2e8:
2681 tmpbyte |= 0x05;
2682 break;
2683 case 0x338:
2684 tmpbyte |= 0x06;
2685 break;
2686 case 0x3e8:
2687 tmpbyte |= 0x07;
2688 break;
2689 default:
2690 tmpbyte |= 0x01;
2691 }
2692 IRDA_DEBUG(1, "COM_DEC (write): 0x%02x\n", tmpbyte);
2693 pci_write_config_byte(dev, COM_DEC, tmpbyte);
2694
2695
2696 pci_read_config_word(dev, LPC_EN, &tmpword);
2697
2698
2699
2700 switch(conf->cfg_base) {
2701 case 0x04e:
2702 tmpword |= 0x2000;
2703 break;
2704 case 0x02e:
2705 tmpword |= 0x1000;
2706 break;
2707 case 0x062:
2708 tmpword |= 0x0800;
2709 break;
2710 case 0x060:
2711 tmpword |= 0x0400;
2712 break;
2713 default:
2714 IRDA_WARNING("Uncommon I/O base address: 0x%04x\n",
2715 conf->cfg_base);
2716 break;
2717 }
2718 tmpword &= 0xfffd;
2719 tmpword |= 0x0001;
2720 IRDA_DEBUG(1, "LPC_EN (write): 0x%04x\n", tmpword);
2721 pci_write_config_word(dev, LPC_EN, tmpword);
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739 pci_read_config_word(dev, PCI_DMA_C, &tmpword);
2740 switch(conf->fir_dma) {
2741 case 0x07:
2742 tmpword |= 0xc000;
2743 break;
2744 case 0x06:
2745 tmpword |= 0x3000;
2746 break;
2747 case 0x05:
2748 tmpword |= 0x0c00;
2749 break;
2750 case 0x03:
2751 tmpword |= 0x00c0;
2752 break;
2753 case 0x02:
2754 tmpword |= 0x0030;
2755 break;
2756 case 0x01:
2757 tmpword |= 0x000c;
2758 break;
2759 case 0x00:
2760 tmpword |= 0x0003;
2761 break;
2762 default:
2763 break;
2764 }
2765 IRDA_DEBUG(1, "PCI_DMA_C (write): 0x%04x\n", tmpword);
2766 pci_write_config_word(dev, PCI_DMA_C, tmpword);
2767
2768
2769
2770
2771
2772
2773
2774 tmpword = conf->fir_io & 0xfff8;
2775 tmpword |= 0x0001;
2776 IRDA_DEBUG(1, "GEN2_DEC (write): 0x%04x\n", tmpword);
2777 pci_write_config_word(dev, GEN2_DEC, tmpword);
2778
2779
2780 return preconfigure_smsc_chip(conf);
2781}
2782
2783
2784
2785
2786
2787
2788static void __init preconfigure_ali_port(struct pci_dev *dev,
2789 unsigned short port)
2790{
2791 unsigned char reg;
2792
2793 unsigned char mask;
2794 unsigned char tmpbyte;
2795
2796 switch(port) {
2797 case 0x0130:
2798 case 0x0178:
2799 reg = 0xb0;
2800 mask = 0x80;
2801 break;
2802 case 0x03f8:
2803 reg = 0xb4;
2804 mask = 0x80;
2805 break;
2806 case 0x02f8:
2807 reg = 0xb4;
2808 mask = 0x30;
2809 break;
2810 case 0x02e8:
2811 reg = 0xb4;
2812 mask = 0x08;
2813 break;
2814 default:
2815 IRDA_ERROR("Failed to configure unsupported port on ALi 1533 bridge: 0x%04x\n", port);
2816 return;
2817 }
2818
2819 pci_read_config_byte(dev, reg, &tmpbyte);
2820
2821 tmpbyte |= mask;
2822 pci_write_config_byte(dev, reg, tmpbyte);
2823 IRDA_MESSAGE("Activated ALi 1533 ISA bridge port 0x%04x.\n", port);
2824}
2825
2826static int __init preconfigure_through_ali(struct pci_dev *dev,
2827 struct
2828 smsc_ircc_subsystem_configuration
2829 *conf)
2830{
2831
2832 preconfigure_ali_port(dev, conf->sir_io);
2833 preconfigure_ali_port(dev, conf->fir_io);
2834
2835
2836 return preconfigure_smsc_chip(conf);
2837}
2838
2839static int __init smsc_ircc_preconfigure_subsystems(unsigned short ircc_cfg,
2840 unsigned short ircc_fir,
2841 unsigned short ircc_sir,
2842 unsigned char ircc_dma,
2843 unsigned char ircc_irq)
2844{
2845 struct pci_dev *dev = NULL;
2846 unsigned short ss_vendor = 0x0000;
2847 unsigned short ss_device = 0x0000;
2848 int ret = 0;
2849
2850 for_each_pci_dev(dev) {
2851 struct smsc_ircc_subsystem_configuration *conf;
2852
2853
2854
2855
2856
2857
2858
2859 if (dev->subsystem_vendor != 0x0000U) {
2860 ss_vendor = dev->subsystem_vendor;
2861 ss_device = dev->subsystem_device;
2862 }
2863 conf = subsystem_configurations;
2864 for( ; conf->subvendor; conf++) {
2865 if(conf->vendor == dev->vendor &&
2866 conf->device == dev->device &&
2867 conf->subvendor == ss_vendor &&
2868
2869 (conf->subdevice == ss_device ||
2870 conf->subdevice == 0xffff)) {
2871 struct smsc_ircc_subsystem_configuration
2872 tmpconf;
2873
2874 memcpy(&tmpconf, conf,
2875 sizeof(struct smsc_ircc_subsystem_configuration));
2876
2877
2878
2879
2880
2881 if (ircc_cfg != 0)
2882 tmpconf.cfg_base = ircc_cfg;
2883 if (ircc_fir != 0)
2884 tmpconf.fir_io = ircc_fir;
2885 if (ircc_sir != 0)
2886 tmpconf.sir_io = ircc_sir;
2887 if (ircc_dma != DMA_INVAL)
2888 tmpconf.fir_dma = ircc_dma;
2889 if (ircc_irq != IRQ_INVAL)
2890 tmpconf.fir_irq = ircc_irq;
2891
2892 IRDA_MESSAGE("Detected unconfigured %s SMSC IrDA chip, pre-configuring device.\n", conf->name);
2893 if (conf->preconfigure)
2894 ret = conf->preconfigure(dev, &tmpconf);
2895 else
2896 ret = -ENODEV;
2897 }
2898 }
2899 }
2900
2901 return ret;
2902}
2903#endif
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919static void smsc_ircc_set_transceiver_smsc_ircc_atc(int fir_base, u32 speed)
2920{
2921 unsigned long jiffies_now, jiffies_timeout;
2922 u8 val;
2923
2924 jiffies_now = jiffies;
2925 jiffies_timeout = jiffies + SMSC_IRCC2_ATC_PROGRAMMING_TIMEOUT_JIFFIES;
2926
2927
2928 register_bank(fir_base, 4);
2929 outb((inb(fir_base + IRCC_ATC) & IRCC_ATC_MASK) | IRCC_ATC_nPROGREADY|IRCC_ATC_ENABLE,
2930 fir_base + IRCC_ATC);
2931
2932 while ((val = (inb(fir_base + IRCC_ATC) & IRCC_ATC_nPROGREADY)) &&
2933 !time_after(jiffies, jiffies_timeout))
2934 ;
2935
2936 if (val)
2937 IRDA_WARNING("%s(): ATC: 0x%02x\n", __func__,
2938 inb(fir_base + IRCC_ATC));
2939}
2940
2941
2942
2943
2944
2945
2946
2947
2948static int smsc_ircc_probe_transceiver_smsc_ircc_atc(int fir_base)
2949{
2950 return 0;
2951}
2952
2953
2954
2955
2956
2957
2958
2959
2960static void smsc_ircc_set_transceiver_smsc_ircc_fast_pin_select(int fir_base, u32 speed)
2961{
2962 u8 fast_mode;
2963
2964 switch (speed) {
2965 default:
2966 case 576000 :
2967 fast_mode = 0;
2968 break;
2969 case 1152000 :
2970 case 4000000 :
2971 fast_mode = IRCC_LCR_A_FAST;
2972 break;
2973 }
2974 register_bank(fir_base, 0);
2975 outb((inb(fir_base + IRCC_LCR_A) & 0xbf) | fast_mode, fir_base + IRCC_LCR_A);
2976}
2977
2978
2979
2980
2981
2982
2983
2984
2985static int smsc_ircc_probe_transceiver_smsc_ircc_fast_pin_select(int fir_base)
2986{
2987 return 0;
2988}
2989
2990
2991
2992
2993
2994
2995
2996
2997static void smsc_ircc_set_transceiver_toshiba_sat1800(int fir_base, u32 speed)
2998{
2999 u8 fast_mode;
3000
3001 switch (speed) {
3002 default:
3003 case 576000 :
3004 fast_mode = 0;
3005 break;
3006 case 1152000 :
3007 case 4000000 :
3008 fast_mode = IRCC_LCR_A_GP_DATA;
3009 break;
3010
3011 }
3012
3013 register_bank(fir_base, 0);
3014 outb((inb(fir_base + IRCC_LCR_A) & 0xbf) | fast_mode, fir_base + IRCC_LCR_A);
3015}
3016
3017
3018
3019
3020
3021
3022
3023
3024static int smsc_ircc_probe_transceiver_toshiba_sat1800(int fir_base)
3025{
3026 return 0;
3027}
3028
3029
3030module_init(smsc_ircc_init);
3031module_exit(smsc_ircc_cleanup);
3032