77 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
79 #include <linux/module.h>
80 #include <linux/kernel.h>
81 #include <linux/sched.h>
82 #include <linux/slab.h>
83 #include <linux/poll.h>
87 #include <linux/hdlc.h>
88 #include <linux/errno.h>
90 #include <linux/netdevice.h>
93 #include <linux/device.h>
96 #include <asm/byteorder.h>
103 #define COSA_MAX_ID_STRING 128
106 #define COSA_MAX_NAME (sizeof("cosaXXXcXXX")+1)
140 #define COSA_FW_RESET (1<<0)
141 #define COSA_FW_DOWNLOAD (1<<1)
142 #define COSA_FW_START (1<<2)
179 static int cosa_major = 117;
186 #define CARD_MINOR_BITS 4
195 #define DRIVER_RX_READY 0x0001
196 #define DRIVER_TX_READY 0x0002
197 #define DRIVER_TXMAP_SHIFT 2
198 #define DRIVER_TXMAP_MASK 0x0c
208 #define COSA_MTU 2000
210 #undef DEBUG_DATA //1
211 #undef DEBUG_IRQS //1
214 #define TX_TIMEOUT (5*HZ)
220 #ifdef COSA_ISA_AUTOPROBE
221 static int io[
MAX_CARDS+1] = { 0x220, 0x228, 0x210, 0x218, 0, };
223 static int dma[
MAX_CARDS+1] = { 1, 7, 1, 7, 1, 7, 1, 7, 0, };
229 static int irq[
MAX_CARDS+1] = { -1, -1, -1, -1, -1, -1, 0, };
232 static struct class *cosa_class;
249 #define cosa_outb outb_p
250 #define cosa_outw outw_p
251 #define cosa_inb inb_p
252 #define cosa_inw inw_p
254 #define cosa_outb outb
255 #define cosa_outw outw
260 #define is_8bit(cosa) (!(cosa->datareg & 0x08))
262 #define cosa_getstatus(cosa) (cosa_inb(cosa->statusreg))
263 #define cosa_putstatus(cosa, stat) (cosa_outb(stat, cosa->statusreg))
264 #define cosa_getdata16(cosa) (cosa_inw(cosa->datareg))
265 #define cosa_getdata8(cosa) (cosa_inb(cosa->datareg))
266 #define cosa_putdata16(cosa, dt) (cosa_outw(dt, cosa->datareg))
267 #define cosa_putdata8(cosa, dt) (cosa_outb(dt, cosa->datareg))
270 static int cosa_probe(
int ioaddr,
int irq,
int dma);
276 static void cosa_kick(
struct cosa_data *cosa);
280 static int cosa_net_attach(
struct net_device *
dev,
unsigned short encoding,
281 unsigned short parity);
284 static void cosa_net_timeout(
struct net_device *
d);
296 char __user *
buf,
size_t count, loff_t *ppos);
298 const char __user *
buf,
size_t count, loff_t *ppos);
302 static long cosa_chardev_ioctl(
struct file *
file,
unsigned int cmd,
304 #ifdef COSA_FASYNC_WORKING
314 .unlocked_ioctl = cosa_chardev_ioctl,
316 .release = cosa_release,
317 #ifdef COSA_FASYNC_WORKING
318 .fasync = cosa_fasync,
324 static int cosa_reset(
struct cosa_data *cosa);
326 static int cosa_readmem(
struct cosa_data *cosa,
void __user *
a);
331 static int readmem(
struct cosa_data *cosa,
char __user *
data,
int addr,
int len);
332 static int cosa_reset_and_read_id(
struct cosa_data *cosa,
char *
id);
335 static int get_wait_data(
struct cosa_data *cosa);
337 static int puthexnumber(
struct cosa_data *cosa,
int number);
338 static void put_driver_status(
struct cosa_data *cosa);
339 static void put_driver_status_nolock(
struct cosa_data *cosa);
342 static irqreturn_t cosa_interrupt(
int irq,
void *cosa);
347 static void debug_data_out(
struct cosa_data *cosa,
int data);
348 static void debug_data_cmd(
struct cosa_data *cosa,
int data);
360 static int __init cosa_init(
void)
364 if (cosa_major > 0) {
365 if (register_chrdev(cosa_major,
"cosa", &cosa_fops)) {
366 pr_warn(
"unable to get major %d\n", cosa_major);
371 if (!(cosa_major=register_chrdev(0,
"cosa", &cosa_fops))) {
372 pr_warn(
"unable to register chardev\n");
378 cosa_cards[i].
num = -1;
380 cosa_probe(
io[i], irq[i],
dma[i]);
383 unregister_chrdev(cosa_major,
"cosa");
388 if (IS_ERR(cosa_class)) {
389 err = PTR_ERR(cosa_class);
392 for (i = 0; i < nr_cards; i++)
399 unregister_chrdev(cosa_major,
"cosa");
405 static void __exit cosa_exit(
void)
410 for (i = 0; i < nr_cards; i++)
414 for (cosa = cosa_cards; nr_cards--; cosa++) {
428 unregister_chrdev(cosa_major,
"cosa");
433 .ndo_open = cosa_net_open,
434 .ndo_stop = cosa_net_close,
437 .ndo_do_ioctl = cosa_net_ioctl,
438 .ndo_tx_timeout = cosa_net_timeout,
441 static int cosa_probe(
int base,
int irq,
int dma)
443 struct cosa_data *cosa = cosa_cards+nr_cards;
450 if ((irq >= 0 && irq < 2) || irq > 15 || (irq < 10 && irq > 7)) {
451 pr_info(
"invalid IRQ %d\n", irq);
456 if (base < 0x100 || base > 0x3ff || base & 0x7) {
457 pr_info(
"invalid I/O address 0x%x\n", base);
461 if (dma < 0 || dma == 4 || dma > 7) {
462 pr_info(
"invalid DMA %d\n", dma);
467 if (((base & 0x8) && dma < 4) || (!(base & 0x8) && dma > 3)) {
468 pr_info(
"8/16 bit base and DMA mismatch (base=0x%x, dma=%d)\n",
481 if (cosa_reset_and_read_id(cosa, cosa->
id_string) < 0) {
494 #ifndef COSA_ISA_AUTOPROBE
495 pr_info(
"valid signature not found at 0x%x\n", base);
528 pr_info(
"multiple interrupts obtained (%d, board at 0x%x)\n",
534 pr_info(
"no interrupt obtained (board at 0x%x)\n",
541 cosa->
num = nr_cards;
577 sema_init(&chan->
wsem, 1);
584 dev_to_hdlc(chan->
netdev)->attach = cosa_net_attach;
585 dev_to_hdlc(chan->
netdev)->xmit = cosa_net_tx;
586 chan->
netdev->netdev_ops = &cosa_ops;
588 chan->
netdev->base_addr = chan->
cosa->datareg;
593 "register_hdlc_device() failed\n");
599 pr_info(
"cosa%d: %s (%s at 0x%x irq %d dma %d), %d channels\n",
619 pr_notice(
"cosa%d: allocating resources failed\n", cosa->
num);
626 static int cosa_net_attach(
struct net_device *dev,
unsigned short encoding,
627 unsigned short parity)
634 static int cosa_net_open(
struct net_device *dev)
641 pr_notice(
"%s: start the firmware first (status %d)\n",
642 chan->
cosa->name, chan->
cosa->firmware_status);
646 if (chan->
usage != 0) {
647 pr_warn(
"%s: cosa_net_open called with usage count %d\n",
649 spin_unlock_irqrestore(&chan->
cosa->lock, flags);
653 chan->
tx_done = cosa_net_tx_done;
654 chan->
rx_done = cosa_net_rx_done;
657 spin_unlock_irqrestore(&chan->
cosa->lock, flags);
664 spin_unlock_irqrestore(&chan->
cosa->lock, flags);
668 netif_start_queue(dev);
669 cosa_enable_rx(chan);
678 netif_stop_queue(dev);
681 cosa_start_tx(chan, skb->
data, skb->
len);
685 static void cosa_net_timeout(
struct net_device *dev)
690 chan->
netdev->stats.rx_errors++;
691 chan->
netdev->stats.rx_missed_errors++;
693 chan->
netdev->stats.tx_errors++;
694 chan->
netdev->stats.tx_aborted_errors++;
696 cosa_kick(chan->
cosa);
698 dev_kfree_skb(chan->
tx_skb);
701 netif_wake_queue(dev);
704 static int cosa_net_close(
struct net_device *dev)
709 netif_stop_queue(dev);
711 cosa_disable_rx(chan);
723 spin_unlock_irqrestore(&chan->
cosa->lock, flags);
734 chan->
rx_skb = dev_alloc_skb(size);
736 pr_notice(
"%s: Memory squeeze, dropping packet\n", chan->
name);
737 chan->
netdev->stats.rx_dropped++;
747 pr_warn(
"%s: rx_done with empty skb!\n", chan->
name);
748 chan->
netdev->stats.rx_errors++;
749 chan->
netdev->stats.rx_frame_errors++;
754 skb_reset_mac_header(chan->
rx_skb);
755 chan->
netdev->stats.rx_packets++;
756 chan->
netdev->stats.rx_bytes += chan->
cosa->rxsize;
763 static int cosa_net_tx_done(
struct channel_data *chan,
int size)
766 pr_warn(
"%s: tx_done with empty skb!\n", chan->
name);
767 chan->
netdev->stats.tx_errors++;
768 chan->
netdev->stats.tx_aborted_errors++;
773 chan->
netdev->stats.tx_packets++;
775 netif_wake_queue(chan->
netdev);
782 char __user *
buf,
size_t count, loff_t *ppos)
791 pr_notice(
"%s: start the firmware first (status %d)\n",
805 cosa_enable_rx(chan);
810 spin_unlock_irqrestore(&cosa->
lock, flags);
817 spin_unlock_irqrestore(&cosa->
lock, flags);
826 spin_unlock_irqrestore(&cosa->
lock, flags);
837 static char *chrdev_setup_rx(
struct channel_data *chan,
int size)
856 static ssize_t cosa_write(
struct file *file,
857 const char __user *buf,
size_t count, loff_t *ppos)
866 pr_notice(
"%s: start the firmware first (status %d)\n",
878 pr_notice(
"%s: cosa_write() OOM - dropping packet\n",
889 cosa_start_tx(chan, kbuf, count);
895 spin_unlock_irqrestore(&cosa->
lock, flags);
903 spin_unlock_irqrestore(&cosa->
lock, flags);
911 spin_unlock_irqrestore(&cosa->
lock, flags);
916 static int chrdev_tx_done(
struct channel_data *chan,
int size)
927 static unsigned int cosa_poll(
struct file *file,
poll_table *
poll)
929 pr_info(
"cosa_poll is here\n");
933 static int cosa_open(
struct inode *
inode,
struct file *file)
949 if ((n=iminor(file->
f_path.dentry->d_inode)
954 chan = cosa->
chan +
n;
960 if (chan->
usage < 0) {
961 spin_unlock_irqrestore(&cosa->
lock, flags);
968 chan->
tx_done = chrdev_tx_done;
970 chan->
rx_done = chrdev_rx_done;
971 spin_unlock_irqrestore(&cosa->
lock, flags);
977 static int cosa_release(
struct inode *inode,
struct file *file)
983 cosa = channel->
cosa;
987 spin_unlock_irqrestore(&cosa->
lock, flags);
991 #ifdef COSA_FASYNC_WORKING
995 static int cosa_fasync(
struct inode *inode,
struct file *file,
int on)
997 int port = iminor(inode);
1010 static inline int cosa_reset(
struct cosa_data *cosa)
1013 if (cosa->
usage > 1)
1014 pr_info(
"cosa%d: WARNING: reset requested with cosa->usage > 1 (%d). Odd things may happen.\n",
1017 if (cosa_reset_and_read_id(cosa, idstring) < 0) {
1021 pr_info(
"cosa%d: resetting device: %s\n", cosa->
num, idstring);
1032 if (cosa->
usage > 1)
1033 pr_info(
"%s: WARNING: download of microcode requested with cosa->usage > 1 (%d). Odd things may happen.\n",
1036 pr_notice(
"%s: reset the card first (status %d)\n",
1055 pr_notice(
"cosa%d: microcode download failed: %d\n",
1059 pr_info(
"cosa%d: downloading microcode - 0x%04x bytes at 0x%04x\n",
1060 cosa->
num,
d.len,
d.addr);
1066 static inline int cosa_readmem(
struct cosa_data *cosa,
void __user *arg)
1071 if (cosa->
usage > 1)
1072 pr_info(
"cosa%d: WARNING: readmem requested with cosa->usage > 1 (%d). Odd things may happen.\n",
1075 pr_notice(
"%s: reset the card first (status %d)\n",
1086 i = readmem(cosa,
d.code,
d.len,
d.addr);
1088 pr_notice(
"cosa%d: reading memory failed: %d\n", cosa->
num, i);
1091 pr_info(
"cosa%d: reading card memory - 0x%04x bytes at 0x%04x\n",
1092 cosa->
num,
d.len,
d.addr);
1102 if (cosa->
usage > 1)
1103 pr_info(
"cosa%d: WARNING: start microcode requested with cosa->usage > 1 (%d). Odd things may happen.\n",
1108 pr_notice(
"%s: download the microcode and/or reset the card first (status %d)\n",
1113 if ((i=startmicrocode(cosa, address)) < 0) {
1114 pr_notice(
"cosa%d: start microcode at 0x%04x failed: %d\n",
1115 cosa->
num, address, i);
1118 pr_info(
"cosa%d: starting microcode at 0x%04x\n", cosa->
num, address);
1125 static inline int cosa_getidstr(
struct cosa_data *cosa,
char __user *
string)
1134 static inline int cosa_gettype(
struct cosa_data *cosa,
char __user *
string)
1142 static int cosa_ioctl_common(
struct cosa_data *cosa,
1150 return cosa_reset(cosa);
1154 return cosa_start(cosa, arg);
1163 return cosa_readmem(cosa, argp);
1165 return cosa_gettype(cosa, argp);
1167 return cosa_getidstr(cosa, argp);
1187 static int cosa_net_ioctl(
struct net_device *dev,
struct ifreq *ifr,
int cmd)
1191 rv = cosa_ioctl_common(chan->
cosa, chan, cmd,
1192 (
unsigned long)ifr->ifr_data);
1198 static long cosa_chardev_ioctl(
struct file *file,
unsigned int cmd,
1206 cosa = channel->
cosa;
1207 ret = cosa_ioctl_common(cosa, channel, cmd, arg);
1224 put_driver_status(cosa);
1232 put_driver_status(cosa);
1241 static int cosa_start_tx(
struct channel_data *chan,
char *buf,
int len)
1244 unsigned long flags;
1248 pr_info(
"cosa%dc%d: starting tx(0x%x)",
1249 chan->
cosa->num, chan->
num, len);
1250 for (i=0; i<len; i++)
1251 pr_cont(
" %02x", buf[i]&0xff);
1259 spin_unlock_irqrestore(&cosa->
lock, flags);
1263 put_driver_status(cosa);
1268 static void put_driver_status(
struct cosa_data *cosa)
1270 unsigned long flags;
1284 debug_status_out(cosa, SR_RX_INT_ENA);
1292 debug_status_out(cosa, 0);
1297 debug_data_cmd(cosa, status);
1300 spin_unlock_irqrestore(&cosa->
lock, flags);
1303 static void put_driver_status_nolock(
struct cosa_data *cosa)
1310 &DRIVER_TXMAP_MASK : 0);
1315 debug_status_out(cosa, SR_RX_INT_ENA);
1321 debug_status_out(cosa, 0);
1327 debug_data_cmd(cosa, status);
1336 static void cosa_kick(
struct cosa_data *cosa)
1339 char *
s =
"(probably) IRQ";
1346 pr_info(
"%s: %s timeout - restarting\n", cosa->
name, s);
1352 clear_dma_ff(cosa->
dma);
1363 put_driver_status_nolock(cosa);
1364 spin_unlock_irqrestore(&cosa->
lock, flags);
1372 static int cosa_dma_able(
struct channel_data *chan,
char *buf,
int len)
1375 unsigned long b = (
unsigned long)buf;
1378 if ((b^ (b+len)) & 0x10000) {
1380 pr_info(
"%s: packet spanning a 64k boundary\n",
1402 if (put_wait_data(cosa,
'w') == -1)
return -1;
1403 if ((i=get_wait_data(cosa)) !=
'w') {
printk(
"dnld: 0x%04x\n",i);
return -2;}
1404 if (get_wait_data(cosa) !=
'=')
return -3;
1406 if (puthexnumber(cosa, address) < 0)
return -4;
1407 if (put_wait_data(cosa,
' ') == -1)
return -10;
1408 if (get_wait_data(cosa) !=
' ')
return -11;
1409 if (get_wait_data(cosa) !=
'=')
return -12;
1411 if (puthexnumber(cosa, address+length-1) < 0)
return -13;
1412 if (put_wait_data(cosa,
' ') == -1)
return -18;
1413 if (get_wait_data(cosa) !=
' ')
return -19;
1417 #ifndef SRP_DOWNLOAD_AT_BOOT
1423 if (put_wait_data(cosa, c) == -1)
1428 if (get_wait_data(cosa) !=
'\r')
return -21;
1429 if (get_wait_data(cosa) !=
'\n')
return -22;
1430 if (get_wait_data(cosa) !=
'.')
return -23;
1443 static int startmicrocode(
struct cosa_data *cosa,
int address)
1445 if (put_wait_data(cosa,
'g') == -1)
return -1;
1446 if (get_wait_data(cosa) !=
'g')
return -2;
1447 if (get_wait_data(cosa) !=
'=')
return -3;
1449 if (puthexnumber(cosa, address) < 0)
return -4;
1450 if (put_wait_data(cosa,
'\r') == -1)
return -5;
1452 if (get_wait_data(cosa) !=
'\r')
return -6;
1453 if (get_wait_data(cosa) !=
'\r')
return -7;
1454 if (get_wait_data(cosa) !=
'\n')
return -8;
1455 if (get_wait_data(cosa) !=
'\r')
return -9;
1456 if (get_wait_data(cosa) !=
'\n')
return -10;
1472 static int readmem(
struct cosa_data *cosa,
char __user *microcode,
int length,
int address)
1474 if (put_wait_data(cosa,
'r') == -1)
return -1;
1475 if ((get_wait_data(cosa)) !=
'r')
return -2;
1476 if ((get_wait_data(cosa)) !=
'=')
return -3;
1478 if (puthexnumber(cosa, address) < 0)
return -4;
1479 if (put_wait_data(cosa,
' ') == -1)
return -5;
1480 if (get_wait_data(cosa) !=
' ')
return -6;
1481 if (get_wait_data(cosa) !=
'=')
return -7;
1483 if (puthexnumber(cosa, address+length-1) < 0)
return -8;
1484 if (put_wait_data(cosa,
' ') == -1)
return -9;
1485 if (get_wait_data(cosa) !=
' ')
return -10;
1490 if ((i=get_wait_data(cosa)) == -1) {
1491 pr_info(
"0x%04x bytes remaining\n", length);
1504 if (get_wait_data(cosa) !=
'\r')
return -21;
1505 if (get_wait_data(cosa) !=
'\n')
return -22;
1506 if (get_wait_data(cosa) !=
'.')
return -23;
1517 static int cosa_reset_and_read_id(
struct cosa_data *cosa,
char *idstring)
1542 if ((
curr = get_wait_data(cosa)) == -1) {
1547 idstring[
id++] =
curr;
1548 if (
curr == 0x2e && prev ==
'\n')
1552 idstring[
id] =
'\0';
1564 static int get_wait_data(
struct cosa_data *cosa)
1574 pr_info(
"get_wait_data returning after %d retries\n",
1582 pr_info(
"timeout in get_wait_data (status 0x%x)\n",
1600 pr_info(
"Putdata: %d retries\n", 999-retries);
1609 pr_info(
"cosa%d: timeout in put_wait_data (status 0x%x)\n",
1620 static int puthexnumber(
struct cosa_data *cosa,
int number)
1626 sprintf(temp,
"%04X", number);
1627 for (i=0; i<4; i++) {
1628 if (put_wait_data(cosa, temp[i]) == -1) {
1629 pr_notice(
"cosa%d: puthexnumber failed to write byte %d\n",
1633 if (get_wait_data(cosa) != temp[i]) {
1634 pr_notice(
"cosa%d: puthexhumber failed to read echo of byte %d\n",
1676 static inline void tx_interrupt(
struct cosa_data *cosa,
int status)
1680 pr_info(
"cosa%d: SR_DOWN_REQUEST status=0x%04x\n", cosa->
num, status);
1688 pr_warn(
"%s: No channel wants data in TX IRQ. Expect DMA timeout.\n",
1690 put_driver_status_nolock(cosa);
1692 spin_unlock_irqrestore(&cosa->
lock, flags);
1709 "to not-ready channel %d\n",
1731 ((cosa->
txsize >> 8) & 0x1f));
1733 debug_status_out(cosa, SR_TX_INT_ENA);
1734 debug_data_out(cosa, ((cosa->
txchan << 5) & 0xe0)|
1735 ((cosa->
txsize >> 8) & 0x1f));
1741 spin_unlock_irqrestore(&cosa->
lock, flags);
1748 debug_status_out(cosa, 0);
1749 debug_data_out(cosa, cosa->
txsize&0xff);
1755 | (cosa->
txsize & 0x1fff));
1757 debug_status_out(cosa, SR_TX_INT_ENA);
1758 debug_data_out(cosa, ((cosa->
txchan<<13) & 0xe000)
1759 | (cosa->
txsize & 0x1fff));
1761 debug_status_out(cosa, 0);
1775 if (count > 1000)
break;
1778 pr_info(
"ready after %d loops\n", count);
1784 if (count > 1000)
break;
1787 pr_info(
"ready after %d loops\n", count);
1797 clear_dma_ff(cosa->
dma);
1806 debug_status_out(cosa, SR_TX_DMA_ENA|SR_USR_INT_ENA);
1808 spin_unlock_irqrestore(&cosa->
lock, flags);
1811 static inline void rx_interrupt(
struct cosa_data *cosa,
int status)
1813 unsigned long flags;
1815 pr_info(
"cosa%d: SR_UP_REQUEST\n", cosa->
num);
1824 put_driver_status_nolock(cosa);
1827 debug_data_in(cosa, cosa->
rxsize >> 8);
1829 spin_unlock_irqrestore(&cosa->
lock, flags);
1835 debug_data_in(cosa, cosa->
rxsize & 0xff);
1838 pr_info(
"cosa%d: receive rxsize = (0x%04x)\n",
1845 debug_data_in(cosa, cosa->
rxsize);
1848 pr_info(
"cosa%d: receive rxsize = (0x%04x)\n",
1853 pr_warn(
"%s: rx for unknown channel (0x%04x)\n",
1855 spin_unlock_irqrestore(&cosa->
lock, flags);
1860 spin_unlock_irqrestore(&cosa->
lock, flags);
1863 if (cosa->
rxchan->setup_rx)
1868 pr_info(
"cosa%d: rejecting packet on channel %d\n",
1876 clear_dma_ff(cosa->
dma);
1888 if (!
is_8bit(cosa) && (status & SR_TX_RDY))
1891 debug_status_out(cosa, SR_RX_DMA_ENA|SR_USR_INT_ENA);
1892 if (!
is_8bit(cosa) && (status & SR_TX_RDY))
1895 spin_unlock_irqrestore(&cosa->
lock, flags);
1898 static inline void eot_interrupt(
struct cosa_data *cosa,
int status)
1904 clear_dma_ff(cosa->
dma);
1915 pr_info(
"cosa%dc%d: done rx(0x%x)",
1917 for (i=0; i<cosa->
rxsize; i++)
1927 if (cosa->
rxchan->rx_done)
1931 pr_notice(
"cosa%d: unexpected EOT interrupt\n", cosa->
num);
1941 put_driver_status_nolock(cosa);
1942 spin_unlock_irqrestore(&cosa->
lock, flags);
1945 static irqreturn_t cosa_interrupt(
int irq,
void *cosa_)
1953 pr_info(
"cosa%d: got IRQ, status 0x%02x\n", cosa->
num, status & 0xff);
1956 debug_status_in(cosa, status);
1958 switch (status & SR_CMD_FROM_SRP_MASK) {
1959 case SR_DOWN_REQUEST:
1960 tx_interrupt(cosa, status);
1963 rx_interrupt(cosa, status);
1965 case SR_END_OF_TRANSFER:
1966 eot_interrupt(cosa, status);
1970 if (count++ < 100) {
1974 pr_info(
"cosa%d: unknown status 0x%02x in IRQ after %d retries\n",
1975 cosa->
num, status & 0xff, count);
1979 pr_info(
"%s: %d-times got unknown status in IRQ\n",
1996 static void debug_status_in(
struct cosa_data *cosa,
int status)
1999 switch (status & SR_CMD_FROM_SRP_MASK) {
2003 case SR_DOWN_REQUEST:
2006 case SR_END_OF_TRANSFER:
2013 pr_info(
"%s: IO: status -> 0x%02x (%s%s%s%s)\n",
2016 status & SR_USR_RQ ?
"USR_RQ|" :
"",
2017 status & SR_TX_RDY ?
"TX_RDY|" :
"",
2018 status & SR_RX_RDY ?
"RX_RDY|" :
"",
2022 static void debug_status_out(
struct cosa_data *cosa,
int status)
2024 pr_info(
"%s: IO: status <- 0x%02x (%s%s%s%s%s%s)\n",
2027 status & SR_RX_DMA_ENA ?
"RXDMA|" :
"!rxdma|",
2028 status & SR_TX_DMA_ENA ?
"TXDMA|" :
"!txdma|",
2029 status &
SR_RST ?
"RESET|" :
"",
2030 status & SR_USR_INT_ENA ?
"USRINT|" :
"!usrint|",
2031 status & SR_TX_INT_ENA ?
"TXINT|" :
"!txint|",
2032 status & SR_RX_INT_ENA ?
"RXINT" :
"!rxint");
2035 static void debug_data_in(
struct cosa_data *cosa,
int data)
2037 pr_info(
"%s: IO: data -> 0x%04x\n", cosa->
name, data);
2040 static void debug_data_out(
struct cosa_data *cosa,
int data)
2042 pr_info(
"%s: IO: data <- 0x%04x\n", cosa->
name, data);
2045 static void debug_data_cmd(
struct cosa_data *cosa,
int data)
2047 pr_info(
"%s: IO: data <- 0x%04x (%s|%s)\n",
2049 data & SR_RDY_RCV ?
"RX_RDY" :
"!rx_rdy",
2050 data & SR_RDY_SND ?
"TX_RDY" :
"!tx_rdy");