Lines Matching refs:ks
58 #define to_ks8851_spi(ks) container_of((ks), struct ks8851_net_spi, ks8851) argument
80 static void ks8851_lock_spi(struct ks8851_net *ks, unsigned long *flags) in ks8851_lock_spi() argument
82 struct ks8851_net_spi *kss = to_ks8851_spi(ks); in ks8851_lock_spi()
94 static void ks8851_unlock_spi(struct ks8851_net *ks, unsigned long *flags) in ks8851_unlock_spi() argument
96 struct ks8851_net_spi *kss = to_ks8851_spi(ks); in ks8851_unlock_spi()
116 static void ks8851_wrreg16_spi(struct ks8851_net *ks, unsigned int reg, in ks8851_wrreg16_spi() argument
119 struct ks8851_net_spi *kss = to_ks8851_spi(ks); in ks8851_wrreg16_spi()
134 netdev_err(ks->netdev, "spi_sync() failed\n"); in ks8851_wrreg16_spi()
147 static void ks8851_rdreg(struct ks8851_net *ks, unsigned int op, in ks8851_rdreg() argument
150 struct ks8851_net_spi *kss = to_ks8851_spi(ks); in ks8851_rdreg()
153 __le16 *txb = (__le16 *)ks->txd; in ks8851_rdreg()
154 u8 *trx = ks->rxd; in ks8851_rdreg()
182 netdev_err(ks->netdev, "read: spi_sync() failed\n"); in ks8851_rdreg()
196 static unsigned int ks8851_rdreg16_spi(struct ks8851_net *ks, unsigned int reg) in ks8851_rdreg16_spi() argument
200 ks8851_rdreg(ks, MK_OP(reg & 2 ? 0xC : 0x3, reg), (u8 *)&rx, 2); in ks8851_rdreg16_spi()
213 static void ks8851_rdfifo_spi(struct ks8851_net *ks, u8 *buff, unsigned int len) in ks8851_rdfifo_spi() argument
215 struct ks8851_net_spi *kss = to_ks8851_spi(ks); in ks8851_rdfifo_spi()
221 netif_dbg(ks, rx_status, ks->netdev, in ks8851_rdfifo_spi()
238 netdev_err(ks->netdev, "%s: spi_sync() failed\n", __func__); in ks8851_rdfifo_spi()
252 static void ks8851_wrfifo_spi(struct ks8851_net *ks, struct sk_buff *txp, in ks8851_wrfifo_spi() argument
255 struct ks8851_net_spi *kss = to_ks8851_spi(ks); in ks8851_wrfifo_spi()
261 netif_dbg(ks, tx_queued, ks->netdev, "%s: skb %p, %d@%p, irq %d\n", in ks8851_wrfifo_spi()
264 fid = ks->fid++; in ks8851_wrfifo_spi()
271 ks->txh.txb[1] = KS_SPIOP_TXFIFO; in ks8851_wrfifo_spi()
272 ks->txh.txw[1] = cpu_to_le16(fid); in ks8851_wrfifo_spi()
273 ks->txh.txw[2] = cpu_to_le16(txp->len); in ks8851_wrfifo_spi()
275 xfer->tx_buf = &ks->txh.txb[1]; in ks8851_wrfifo_spi()
286 netdev_err(ks->netdev, "%s: spi_sync() failed\n", __func__); in ks8851_wrfifo_spi()
294 static void ks8851_rx_skb_spi(struct ks8851_net *ks, struct sk_buff *skb) in ks8851_rx_skb_spi() argument
309 struct ks8851_net *ks; in ks8851_tx_work() local
315 ks = &kss->ks8851; in ks8851_tx_work()
316 last = skb_queue_empty(&ks->txq); in ks8851_tx_work()
318 ks8851_lock_spi(ks, &flags); in ks8851_tx_work()
321 txb = skb_dequeue(&ks->txq); in ks8851_tx_work()
322 last = skb_queue_empty(&ks->txq); in ks8851_tx_work()
325 ks8851_wrreg16_spi(ks, KS_RXQCR, in ks8851_tx_work()
326 ks->rc_rxqcr | RXQCR_SDA); in ks8851_tx_work()
327 ks8851_wrfifo_spi(ks, txb, last); in ks8851_tx_work()
328 ks8851_wrreg16_spi(ks, KS_RXQCR, ks->rc_rxqcr); in ks8851_tx_work()
329 ks8851_wrreg16_spi(ks, KS_TXQCR, TXQCR_METFE); in ks8851_tx_work()
331 ks8851_done_tx(ks, txb); in ks8851_tx_work()
335 ks8851_unlock_spi(ks, &flags); in ks8851_tx_work()
342 static void ks8851_flush_tx_work_spi(struct ks8851_net *ks) in ks8851_flush_tx_work_spi() argument
344 struct ks8851_net_spi *kss = to_ks8851_spi(ks); in ks8851_flush_tx_work_spi()
378 struct ks8851_net *ks = netdev_priv(dev); in ks8851_start_xmit_spi() local
382 kss = to_ks8851_spi(ks); in ks8851_start_xmit_spi()
384 netif_dbg(ks, tx_queued, ks->netdev, in ks8851_start_xmit_spi()
387 spin_lock(&ks->statelock); in ks8851_start_xmit_spi()
389 if (needed > ks->tx_space) { in ks8851_start_xmit_spi()
393 ks->tx_space -= needed; in ks8851_start_xmit_spi()
394 skb_queue_tail(&ks->txq, skb); in ks8851_start_xmit_spi()
397 spin_unlock(&ks->statelock); in ks8851_start_xmit_spi()
408 struct ks8851_net *ks; in ks8851_probe_spi() local
416 ks = netdev_priv(netdev); in ks8851_probe_spi()
418 ks->lock = ks8851_lock_spi; in ks8851_probe_spi()
419 ks->unlock = ks8851_unlock_spi; in ks8851_probe_spi()
420 ks->rdreg16 = ks8851_rdreg16_spi; in ks8851_probe_spi()
421 ks->wrreg16 = ks8851_wrreg16_spi; in ks8851_probe_spi()
422 ks->rdfifo = ks8851_rdfifo_spi; in ks8851_probe_spi()
423 ks->wrfifo = ks8851_wrfifo_spi; in ks8851_probe_spi()
424 ks->start_xmit = ks8851_start_xmit_spi; in ks8851_probe_spi()
425 ks->rx_skb = ks8851_rx_skb_spi; in ks8851_probe_spi()
426 ks->flush_tx_work = ks8851_flush_tx_work_spi; in ks8851_probe_spi()
434 ks->rc_ier = STD_IRQ; in ks8851_probe_spi()
436 kss = to_ks8851_spi(ks); in ks8851_probe_spi()