23 #include <linux/module.h>
25 #include <linux/kernel.h>
27 #include <linux/slab.h>
28 #include <linux/types.h>
30 #include <linux/errno.h>
31 #include <linux/ptrace.h>
37 #include <linux/string.h>
38 #include <linux/serial.h>
40 #include <linux/bitops.h>
84 static int dtl1_config(
struct pcmcia_device *
link);
88 #define XMIT_SENDING 1
90 #define XMIT_WAITING 8
93 #define RECV_WAIT_NSH 0
94 #define RECV_WAIT_DATA 1
119 while ((fifo_size-- > 0) && (actual < len)) {
147 unsigned int iobase = info->
p_dev->resource[0]->start;
160 len = dtl1_write(iobase, 32, skb->
data, skb->
len);
162 if (len == skb->
len) {
170 info->
hdev->stat.byte_tx +=
len;
184 for (
i = 0;
i < skb->
len;
i++) {
190 if (((info->
flowmask & 0x07) == 0) && ((flowmask & 0x07) != 0)) {
192 dtl1_write_wakeup(info);
212 iobase = info->
p_dev->resource[0]->start;
215 info->
hdev->stat.byte_rx++;
220 BT_ERR(
"Can't allocate mem for new packet");
227 nsh = (nsh_t *)info->
rx_skb->data;
236 info->
rx_count = nsh->len + (nsh->len & 0x0001);
242 if (nsh->len & 0x0001) {
253 dtl1_control(info, info->
rx_skb);
265 BT_ERR(
"Unknown HCI packet with type 0x%02x received",
bt_cb(info->
rx_skb)->pkt_type);
279 if (boguscount++ > 32)
286 static irqreturn_t dtl1_interrupt(
int irq,
void *dev_inst)
295 if (!info || !info->
hdev)
299 iobase = info->
p_dev->resource[0]->start;
301 spin_lock(&(info->
lock));
321 dtl1_write_wakeup(info);
325 BT_ERR(
"Unhandled IIR=%#x", iir);
330 if (boguscount++ > 100)
342 dtl1_write_wakeup(info);
346 spin_unlock(&(info->
lock));
356 static int dtl1_hci_open(
struct hci_dev *hdev)
364 static int dtl1_hci_flush(
struct hci_dev *hdev)
375 static int dtl1_hci_close(
struct hci_dev *hdev)
380 dtl1_hci_flush(hdev);
386 static int dtl1_hci_send_frame(
struct sk_buff *skb)
394 BT_ERR(
"Frame for unknown HCI device (hdev=NULL)");
398 info = hci_get_drvdata(hdev);
424 skb_reserve(s,
NSHL);
425 skb_copy_from_linear_data(skb,
skb_put(s, skb->
len), skb->
len);
426 if (skb->
len & 0x0001)
433 dtl1_write_wakeup(info);
441 static int dtl1_hci_ioctl(
struct hci_dev *hdev,
unsigned int cmd,
unsigned long arg)
454 unsigned int iobase = info->
p_dev->resource[0]->start;
459 skb_queue_head_init(&(info->
txq));
470 BT_ERR(
"Can't allocate HCI device");
477 hci_set_drvdata(hdev, info);
480 hdev->
open = dtl1_hci_open;
481 hdev->
close = dtl1_hci_close;
482 hdev->
flush = dtl1_hci_flush;
483 hdev->
send = dtl1_hci_send_frame;
484 hdev->
ioctl = dtl1_hci_ioctl;
504 spin_unlock_irqrestore(&(info->
lock), flags);
511 BT_ERR(
"Can't register HCI device");
524 unsigned int iobase = info->
p_dev->resource[0]->start;
530 dtl1_hci_close(hdev);
540 spin_unlock_irqrestore(&(info->
lock), flags);
548 static int dtl1_probe(
struct pcmcia_device *
link)
560 link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO;
562 return dtl1_config(link);
566 static void dtl1_detach(
struct pcmcia_device *link)
574 static int dtl1_confcheck(
struct pcmcia_device *p_dev,
void *priv_data)
576 if ((p_dev->resource[1]->end) || (p_dev->resource[1]->end < 8))
579 p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
580 p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
585 static int dtl1_config(
struct pcmcia_device *link)
591 link->resource[0]->end = 8;
592 ret = pcmcia_loop_config(link, dtl1_confcheck,
NULL);
604 ret = dtl1_open(info);
616 PCMCIA_DEVICE_PROD_ID12(
"Nokia Mobile Phones",
"DTL-1", 0xe1bfdd64, 0xe168480d),
617 PCMCIA_DEVICE_PROD_ID12(
"Nokia Mobile Phones",
"DTL-4", 0xe1bfdd64, 0x9102bc82),
618 PCMCIA_DEVICE_PROD_ID12(
"Socket",
"CF", 0xb38bcc2e, 0x44ebf863),
619 PCMCIA_DEVICE_PROD_ID12(
"Socket",
"CF+ Personal Network Card", 0xb38bcc2e, 0xe732bae3),
624 static struct pcmcia_driver dtl1_driver = {
628 .remove = dtl1_detach,
629 .id_table = dtl1_ids,
632 static int __init init_dtl1_cs(
void)
638 static void __exit exit_dtl1_cs(
void)