• Home
  • Raw
  • Download

Lines Matching refs:self

86 static int via_ircc_close(struct via_ircc_cb *self);
87 static int via_ircc_dma_receive(struct via_ircc_cb *self);
88 static int via_ircc_dma_receive_complete(struct via_ircc_cb *self,
94 static void via_hw_init(struct via_ircc_cb *self);
95 static void via_ircc_change_speed(struct via_ircc_cb *self, __u32 baud);
97 static int via_ircc_is_receiving(struct via_ircc_cb *self);
106 static int RxTimerHandler(struct via_ircc_cb *self, int iobase);
107 static void hwreset(struct via_ircc_cb *self);
108 static int via_ircc_dma_xmit(struct via_ircc_cb *self, u16 iobase);
109 static int upload_rxdata(struct via_ircc_cb *self, int iobase);
322 struct via_ircc_cb *self; in via_ircc_open() local
335 self = netdev_priv(dev); in via_ircc_open()
336 self->netdev = dev; in via_ircc_open()
337 spin_lock_init(&self->lock); in via_ircc_open()
344 dev_self[i] = self; in via_ircc_open()
345 self->index = i; in via_ircc_open()
347 self->io.cfg_base = info->cfg_base; in via_ircc_open()
348 self->io.fir_base = info->fir_base; in via_ircc_open()
349 self->io.irq = info->irq; in via_ircc_open()
350 self->io.fir_ext = CHIP_IO_EXTENT; in via_ircc_open()
351 self->io.dma = info->dma; in via_ircc_open()
352 self->io.dma2 = info->dma2; in via_ircc_open()
353 self->io.fifo_size = 32; in via_ircc_open()
354 self->chip_id = id; in via_ircc_open()
355 self->st_fifo.len = 0; in via_ircc_open()
356 self->RxDataReady = 0; in via_ircc_open()
359 if (!request_region(self->io.fir_base, self->io.fir_ext, driver_name)) { in via_ircc_open()
361 __func__, self->io.fir_base); in via_ircc_open()
367 irda_init_max_qos_capabilies(&self->qos); in via_ircc_open()
371 dongle_id = via_ircc_read_dongle_id(self->io.fir_base); in via_ircc_open()
372 self->io.dongle_id = dongle_id; in via_ircc_open()
376 switch( self->io.dongle_id ){ in via_ircc_open()
378 self->qos.baud_rate.bits = in via_ircc_open()
383 self->qos.baud_rate.bits = in via_ircc_open()
395 self->qos.min_turn_time.bits = qos_mtt_bits; in via_ircc_open()
396 irda_qos_bits_to_value(&self->qos); in via_ircc_open()
399 self->rx_buff.truesize = 14384 + 2048; in via_ircc_open()
400 self->tx_buff.truesize = 14384 + 2048; in via_ircc_open()
403 self->rx_buff.head = in via_ircc_open()
404 dma_alloc_coherent(NULL, self->rx_buff.truesize, in via_ircc_open()
405 &self->rx_buff_dma, GFP_KERNEL); in via_ircc_open()
406 if (self->rx_buff.head == NULL) { in via_ircc_open()
410 memset(self->rx_buff.head, 0, self->rx_buff.truesize); in via_ircc_open()
412 self->tx_buff.head = in via_ircc_open()
413 dma_alloc_coherent(NULL, self->tx_buff.truesize, in via_ircc_open()
414 &self->tx_buff_dma, GFP_KERNEL); in via_ircc_open()
415 if (self->tx_buff.head == NULL) { in via_ircc_open()
419 memset(self->tx_buff.head, 0, self->tx_buff.truesize); in via_ircc_open()
421 self->rx_buff.in_frame = FALSE; in via_ircc_open()
422 self->rx_buff.state = OUTSIDE_FRAME; in via_ircc_open()
423 self->tx_buff.data = self->tx_buff.head; in via_ircc_open()
424 self->rx_buff.data = self->rx_buff.head; in via_ircc_open()
427 self->tx_fifo.len = self->tx_fifo.ptr = self->tx_fifo.free = 0; in via_ircc_open()
428 self->tx_fifo.tail = self->tx_buff.head; in via_ircc_open()
444 self->io.speed = 9600; in via_ircc_open()
445 via_hw_init(self); in via_ircc_open()
448 dma_free_coherent(NULL, self->tx_buff.truesize, in via_ircc_open()
449 self->tx_buff.head, self->tx_buff_dma); in via_ircc_open()
451 dma_free_coherent(NULL, self->rx_buff.truesize, in via_ircc_open()
452 self->rx_buff.head, self->rx_buff_dma); in via_ircc_open()
454 release_region(self->io.fir_base, self->io.fir_ext); in via_ircc_open()
467 static int via_ircc_close(struct via_ircc_cb *self) in via_ircc_close() argument
473 IRDA_ASSERT(self != NULL, return -1;); in via_ircc_close()
475 iobase = self->io.fir_base; in via_ircc_close()
479 unregister_netdev(self->netdev); in via_ircc_close()
483 __func__, self->io.fir_base); in via_ircc_close()
484 release_region(self->io.fir_base, self->io.fir_ext); in via_ircc_close()
485 if (self->tx_buff.head) in via_ircc_close()
486 dma_free_coherent(NULL, self->tx_buff.truesize, in via_ircc_close()
487 self->tx_buff.head, self->tx_buff_dma); in via_ircc_close()
488 if (self->rx_buff.head) in via_ircc_close()
489 dma_free_coherent(NULL, self->rx_buff.truesize, in via_ircc_close()
490 self->rx_buff.head, self->rx_buff_dma); in via_ircc_close()
491 dev_self[self->index] = NULL; in via_ircc_close()
493 free_netdev(self->netdev); in via_ircc_close()
505 static void via_hw_init(struct via_ircc_cb *self) in via_hw_init() argument
507 int iobase = self->io.fir_base; in via_hw_init()
547 self->io.speed = 9600; in via_hw_init()
548 self->st_fifo.len = 0; in via_hw_init()
550 via_ircc_change_dongle_speed(iobase, self->io.speed, in via_hw_init()
551 self->io.dongle_id); in via_hw_init()
717 static void via_ircc_change_speed(struct via_ircc_cb *self, __u32 speed) in via_ircc_change_speed() argument
719 struct net_device *dev = self->netdev; in via_ircc_change_speed()
723 iobase = self->io.fir_base; in via_ircc_change_speed()
725 self->io.speed = speed; in via_ircc_change_speed()
778 via_ircc_change_dongle_speed(iobase, speed, self->io.dongle_id); in via_ircc_change_speed()
802 via_ircc_dma_receive(self); in via_ircc_change_speed()
819 struct via_ircc_cb *self; in via_ircc_hard_xmit_sir() local
824 self = netdev_priv(dev); in via_ircc_hard_xmit_sir()
825 IRDA_ASSERT(self != NULL, return 0;); in via_ircc_hard_xmit_sir()
826 iobase = self->io.fir_base; in via_ircc_hard_xmit_sir()
831 if ((speed != self->io.speed) && (speed != -1)) { in via_ircc_hard_xmit_sir()
834 via_ircc_change_speed(self, speed); in via_ircc_hard_xmit_sir()
839 self->new_speed = speed; in via_ircc_hard_xmit_sir()
849 spin_lock_irqsave(&self->lock, flags); in via_ircc_hard_xmit_sir()
850 self->tx_buff.data = self->tx_buff.head; in via_ircc_hard_xmit_sir()
851 self->tx_buff.len = in via_ircc_hard_xmit_sir()
852 async_wrap_skb(skb, self->tx_buff.data, in via_ircc_hard_xmit_sir()
853 self->tx_buff.truesize); in via_ircc_hard_xmit_sir()
855 dev->stats.tx_bytes += self->tx_buff.len; in via_ircc_hard_xmit_sir()
857 SetBaudRate(iobase, self->io.speed); in via_ircc_hard_xmit_sir()
875 irda_setup_dma(self->io.dma, self->tx_buff_dma, self->tx_buff.len, in via_ircc_hard_xmit_sir()
878 SetSendByte(iobase, self->tx_buff.len); in via_ircc_hard_xmit_sir()
883 spin_unlock_irqrestore(&self->lock, flags); in via_ircc_hard_xmit_sir()
891 struct via_ircc_cb *self; in via_ircc_hard_xmit_fir() local
896 self = netdev_priv(dev); in via_ircc_hard_xmit_fir()
897 iobase = self->io.fir_base; in via_ircc_hard_xmit_fir()
899 if (self->st_fifo.len) in via_ircc_hard_xmit_fir()
901 if (self->chip_id == 0x3076) in via_ircc_hard_xmit_fir()
907 if ((speed != self->io.speed) && (speed != -1)) { in via_ircc_hard_xmit_fir()
909 via_ircc_change_speed(self, speed); in via_ircc_hard_xmit_fir()
914 self->new_speed = speed; in via_ircc_hard_xmit_fir()
916 spin_lock_irqsave(&self->lock, flags); in via_ircc_hard_xmit_fir()
917 self->tx_fifo.queue[self->tx_fifo.free].start = self->tx_fifo.tail; in via_ircc_hard_xmit_fir()
918 self->tx_fifo.queue[self->tx_fifo.free].len = skb->len; in via_ircc_hard_xmit_fir()
920 self->tx_fifo.tail += skb->len; in via_ircc_hard_xmit_fir()
923 self->tx_fifo.queue[self->tx_fifo.free].start, skb->len); in via_ircc_hard_xmit_fir()
924 self->tx_fifo.len++; in via_ircc_hard_xmit_fir()
925 self->tx_fifo.free++; in via_ircc_hard_xmit_fir()
927 via_ircc_dma_xmit(self, iobase); in via_ircc_hard_xmit_fir()
932 spin_unlock_irqrestore(&self->lock, flags); in via_ircc_hard_xmit_fir()
937 static int via_ircc_dma_xmit(struct via_ircc_cb *self, u16 iobase) in via_ircc_dma_xmit() argument
940 self->io.direction = IO_XMIT; in via_ircc_dma_xmit()
952 irda_setup_dma(self->io.dma, in via_ircc_dma_xmit()
953 ((u8 *)self->tx_fifo.queue[self->tx_fifo.ptr].start - in via_ircc_dma_xmit()
954 self->tx_buff.head) + self->tx_buff_dma, in via_ircc_dma_xmit()
955 self->tx_fifo.queue[self->tx_fifo.ptr].len, DMA_TX_MODE); in via_ircc_dma_xmit()
957 __func__, self->tx_fifo.ptr, in via_ircc_dma_xmit()
958 self->tx_fifo.queue[self->tx_fifo.ptr].len, in via_ircc_dma_xmit()
959 self->tx_fifo.len); in via_ircc_dma_xmit()
961 SetSendByte(iobase, self->tx_fifo.queue[self->tx_fifo.ptr].len); in via_ircc_dma_xmit()
975 static int via_ircc_dma_xmit_complete(struct via_ircc_cb *self) in via_ircc_dma_xmit_complete() argument
983 iobase = self->io.fir_base; in via_ircc_dma_xmit_complete()
990 self->netdev->stats.tx_errors++; in via_ircc_dma_xmit_complete()
991 self->netdev->stats.tx_fifo_errors++; in via_ircc_dma_xmit_complete()
992 hwreset(self); in via_ircc_dma_xmit_complete()
995 self->netdev->stats.tx_packets++; in via_ircc_dma_xmit_complete()
1000 if (self->new_speed) { in via_ircc_dma_xmit_complete()
1001 via_ircc_change_speed(self, self->new_speed); in via_ircc_dma_xmit_complete()
1002 self->new_speed = 0; in via_ircc_dma_xmit_complete()
1007 if (self->tx_fifo.len) { in via_ircc_dma_xmit_complete()
1008 self->tx_fifo.len--; in via_ircc_dma_xmit_complete()
1009 self->tx_fifo.ptr++; in via_ircc_dma_xmit_complete()
1015 self->tx_fifo.len, self->tx_fifo.ptr, self->tx_fifo.free); in via_ircc_dma_xmit_complete()
1025 self->tx_fifo.len = self->tx_fifo.ptr = self->tx_fifo.free = 0; in via_ircc_dma_xmit_complete()
1026 self->tx_fifo.tail = self->tx_buff.head; in via_ircc_dma_xmit_complete()
1033 netif_wake_queue(self->netdev); in via_ircc_dma_xmit_complete()
1044 static int via_ircc_dma_receive(struct via_ircc_cb *self) in via_ircc_dma_receive() argument
1048 iobase = self->io.fir_base; in via_ircc_dma_receive()
1052 self->tx_fifo.len = self->tx_fifo.ptr = self->tx_fifo.free = 0; in via_ircc_dma_receive()
1053 self->tx_fifo.tail = self->tx_buff.head; in via_ircc_dma_receive()
1054 self->RxDataReady = 0; in via_ircc_dma_receive()
1055 self->io.direction = IO_RECV; in via_ircc_dma_receive()
1056 self->rx_buff.data = self->rx_buff.head; in via_ircc_dma_receive()
1057 self->st_fifo.len = self->st_fifo.pending_bytes = 0; in via_ircc_dma_receive()
1058 self->st_fifo.tail = self->st_fifo.head = 0; in via_ircc_dma_receive()
1073 irda_setup_dma(self->io.dma2, self->rx_buff_dma, in via_ircc_dma_receive()
1074 self->rx_buff.truesize, DMA_RX_MODE); in via_ircc_dma_receive()
1088 static int via_ircc_dma_receive_complete(struct via_ircc_cb *self, in via_ircc_dma_receive_complete() argument
1096 iobase = self->io.fir_base; in via_ircc_dma_receive_complete()
1097 st_fifo = &self->st_fifo; in via_ircc_dma_receive_complete()
1099 if (self->io.speed < 4000000) { //Speed below FIR in via_ircc_dma_receive_complete()
1100 len = GetRecvByte(iobase, self); in via_ircc_dma_receive_complete()
1107 if (self->chip_id == 0x3076) { in via_ircc_dma_receive_complete()
1109 skb->data[i] = self->rx_buff.data[i * 2]; in via_ircc_dma_receive_complete()
1111 if (self->chip_id == 0x3096) { in via_ircc_dma_receive_complete()
1114 self->rx_buff.data[i]; in via_ircc_dma_receive_complete()
1118 self->rx_buff.data += len; in via_ircc_dma_receive_complete()
1119 self->netdev->stats.rx_bytes += len; in via_ircc_dma_receive_complete()
1120 self->netdev->stats.rx_packets++; in via_ircc_dma_receive_complete()
1121 skb->dev = self->netdev; in via_ircc_dma_receive_complete()
1129 len = GetRecvByte(iobase, self); in via_ircc_dma_receive_complete()
1134 __func__, len, RxCurCount(iobase, self), in via_ircc_dma_receive_complete()
1135 self->RxLastCount); in via_ircc_dma_receive_complete()
1136 hwreset(self); in via_ircc_dma_receive_complete()
1141 st_fifo->len, len - 4, RxCurCount(iobase, self)); in via_ircc_dma_receive_complete()
1150 self->RxDataReady = 0; in via_ircc_dma_receive_complete()
1179 || (self->rx_buff.data == NULL) || (len < 6)) { in via_ircc_dma_receive_complete()
1180 self->netdev->stats.rx_dropped++; in via_ircc_dma_receive_complete()
1186 skb_copy_to_linear_data(skb, self->rx_buff.data, len - 4); in via_ircc_dma_receive_complete()
1188 len - 4, self->rx_buff.data); in via_ircc_dma_receive_complete()
1191 self->rx_buff.data += len; in via_ircc_dma_receive_complete()
1192 self->netdev->stats.rx_bytes += len; in via_ircc_dma_receive_complete()
1193 self->netdev->stats.rx_packets++; in via_ircc_dma_receive_complete()
1194 skb->dev = self->netdev; in via_ircc_dma_receive_complete()
1208 static int upload_rxdata(struct via_ircc_cb *self, int iobase) in upload_rxdata() argument
1213 st_fifo = &self->st_fifo; in upload_rxdata()
1215 len = GetRecvByte(iobase, self); in upload_rxdata()
1220 self->netdev->stats.rx_dropped++; in upload_rxdata()
1226 self->netdev->stats.rx_dropped++; in upload_rxdata()
1231 skb_copy_to_linear_data(skb, self->rx_buff.data, len - 4 + 1); in upload_rxdata()
1237 self->rx_buff.data += len; in upload_rxdata()
1238 self->netdev->stats.rx_bytes += len; in upload_rxdata()
1239 self->netdev->stats.rx_packets++; in upload_rxdata()
1240 skb->dev = self->netdev; in upload_rxdata()
1258 static int RxTimerHandler(struct via_ircc_cb *self, int iobase) in RxTimerHandler() argument
1265 st_fifo = &self->st_fifo; in RxTimerHandler()
1267 if (CkRxRecv(iobase, self)) { in RxTimerHandler()
1269 self->RetryCount = 0; in RxTimerHandler()
1271 self->RxDataReady++; in RxTimerHandler()
1274 self->RetryCount++; in RxTimerHandler()
1276 if ((self->RetryCount >= 1) || in RxTimerHandler()
1277 ((st_fifo->pending_bytes + 2048) > self->rx_buff.truesize) in RxTimerHandler()
1294 || (self->rx_buff.data == NULL) || (len < 6)) { in RxTimerHandler()
1295 self->netdev->stats.rx_dropped++; in RxTimerHandler()
1300 skb_copy_to_linear_data(skb, self->rx_buff.data, len - 4); in RxTimerHandler()
1306 self->rx_buff.data += len; in RxTimerHandler()
1307 self->netdev->stats.rx_bytes += len; in RxTimerHandler()
1308 self->netdev->stats.rx_packets++; in RxTimerHandler()
1309 skb->dev = self->netdev; in RxTimerHandler()
1314 self->RetryCount = 0; in RxTimerHandler()
1326 && (RxCurCount(iobase, self) != self->RxLastCount)) { in RxTimerHandler()
1327 upload_rxdata(self, iobase); in RxTimerHandler()
1328 if (irda_device_txqueue_empty(self->netdev)) in RxTimerHandler()
1329 via_ircc_dma_receive(self); in RxTimerHandler()
1349 struct via_ircc_cb *self = netdev_priv(dev); in via_ircc_interrupt() local
1353 iobase = self->io.fir_base; in via_ircc_interrupt()
1354 spin_lock(&self->lock); in via_ircc_interrupt()
1365 self->EventFlag.TimeOut++; in via_ircc_interrupt()
1367 if (self->io.direction == IO_XMIT) { in via_ircc_interrupt()
1368 via_ircc_dma_xmit(self, iobase); in via_ircc_interrupt()
1370 if (self->io.direction == IO_RECV) { in via_ircc_interrupt()
1374 if (self->RxDataReady > 30) { in via_ircc_interrupt()
1375 hwreset(self); in via_ircc_interrupt()
1376 if (irda_device_txqueue_empty(self->netdev)) { in via_ircc_interrupt()
1377 via_ircc_dma_receive(self); in via_ircc_interrupt()
1380 RxTimerHandler(self, iobase); in via_ircc_interrupt()
1395 self->EventFlag.EOMessage++; // read and will auto clean in via_ircc_interrupt()
1396 if (via_ircc_dma_xmit_complete(self)) { in via_ircc_interrupt()
1398 (self->netdev)) { in via_ircc_interrupt()
1399 via_ircc_dma_receive(self); in via_ircc_interrupt()
1402 self->EventFlag.Unknown++; in via_ircc_interrupt()
1424 if (via_ircc_dma_receive_complete(self, iobase)) { in via_ircc_interrupt()
1426 via_ircc_dma_receive(self); in via_ircc_interrupt()
1432 RxCurCount(iobase, self), in via_ircc_interrupt()
1433 self->RxLastCount); in via_ircc_interrupt()
1441 hwreset(self); //F01 in via_ircc_interrupt()
1443 via_ircc_dma_receive(self); in via_ircc_interrupt()
1447 spin_unlock(&self->lock); in via_ircc_interrupt()
1451 static void hwreset(struct via_ircc_cb *self) in hwreset() argument
1454 iobase = self->io.fir_base; in hwreset()
1479 via_ircc_change_speed(self, self->io.speed); in hwreset()
1481 self->st_fifo.len = 0; in hwreset()
1490 static int via_ircc_is_receiving(struct via_ircc_cb *self) in via_ircc_is_receiving() argument
1495 IRDA_ASSERT(self != NULL, return FALSE;); in via_ircc_is_receiving()
1497 iobase = self->io.fir_base; in via_ircc_is_receiving()
1498 if (CkRxRecv(iobase, self)) in via_ircc_is_receiving()
1515 struct via_ircc_cb *self; in via_ircc_net_open() local
1522 self = netdev_priv(dev); in via_ircc_net_open()
1524 IRDA_ASSERT(self != NULL, return 0;); in via_ircc_net_open()
1525 iobase = self->io.fir_base; in via_ircc_net_open()
1526 if (request_irq(self->io.irq, via_ircc_interrupt, 0, dev->name, dev)) { in via_ircc_net_open()
1528 self->io.irq); in via_ircc_net_open()
1535 if (request_dma(self->io.dma, dev->name)) { in via_ircc_net_open()
1537 self->io.dma); in via_ircc_net_open()
1538 free_irq(self->io.irq, self); in via_ircc_net_open()
1541 if (self->io.dma2 != self->io.dma) { in via_ircc_net_open()
1542 if (request_dma(self->io.dma2, dev->name)) { in via_ircc_net_open()
1544 driver_name, self->io.dma2); in via_ircc_net_open()
1545 free_irq(self->io.irq, self); in via_ircc_net_open()
1546 free_dma(self->io.dma); in via_ircc_net_open()
1558 via_ircc_dma_receive(self); in via_ircc_net_open()
1568 self->irlap = irlap_open(dev, &self->qos, hwname); in via_ircc_net_open()
1570 self->RxLastCount = 0; in via_ircc_net_open()
1583 struct via_ircc_cb *self; in via_ircc_net_close() local
1589 self = netdev_priv(dev); in via_ircc_net_close()
1590 IRDA_ASSERT(self != NULL, return 0;); in via_ircc_net_close()
1595 if (self->irlap) in via_ircc_net_close()
1596 irlap_close(self->irlap); in via_ircc_net_close()
1597 self->irlap = NULL; in via_ircc_net_close()
1598 iobase = self->io.fir_base; in via_ircc_net_close()
1601 DisableDmaChannel(self->io.dma); in via_ircc_net_close()
1605 free_irq(self->io.irq, dev); in via_ircc_net_close()
1606 free_dma(self->io.dma); in via_ircc_net_close()
1607 if (self->io.dma2 != self->io.dma) in via_ircc_net_close()
1608 free_dma(self->io.dma2); in via_ircc_net_close()
1623 struct via_ircc_cb *self; in via_ircc_net_ioctl() local
1628 self = netdev_priv(dev); in via_ircc_net_ioctl()
1629 IRDA_ASSERT(self != NULL, return -1;); in via_ircc_net_ioctl()
1633 spin_lock_irqsave(&self->lock, flags); in via_ircc_net_ioctl()
1640 via_ircc_change_speed(self, irq->ifr_baudrate); in via_ircc_net_ioctl()
1647 irda_device_set_media_busy(self->netdev, TRUE); in via_ircc_net_ioctl()
1650 irq->ifr_receiving = via_ircc_is_receiving(self); in via_ircc_net_ioctl()
1656 spin_unlock_irqrestore(&self->lock, flags); in via_ircc_net_ioctl()