Lines Matching full:ks
60 #define to_ks8851_spi(ks) container_of((ks), struct ks8851_net_spi, ks8851) argument
77 * @ks: The chip state
82 static void ks8851_lock_spi(struct ks8851_net *ks, unsigned long *flags) in ks8851_lock_spi() argument
84 struct ks8851_net_spi *kss = to_ks8851_spi(ks); in ks8851_lock_spi()
91 * @ks: The chip state
96 static void ks8851_unlock_spi(struct ks8851_net *ks, unsigned long *flags) in ks8851_unlock_spi() argument
98 struct ks8851_net_spi *kss = to_ks8851_spi(ks); in ks8851_unlock_spi()
112 * @ks: The chip state
118 static void ks8851_wrreg16_spi(struct ks8851_net *ks, unsigned int reg, in ks8851_wrreg16_spi() argument
121 struct ks8851_net_spi *kss = to_ks8851_spi(ks); in ks8851_wrreg16_spi()
136 netdev_err(ks->netdev, "spi_sync() failed\n"); in ks8851_wrreg16_spi()
141 * @ks: The device state
149 static void ks8851_rdreg(struct ks8851_net *ks, unsigned int op, in ks8851_rdreg() argument
152 struct ks8851_net_spi *kss = to_ks8851_spi(ks); in ks8851_rdreg()
155 __le16 *txb = (__le16 *)ks->txd; in ks8851_rdreg()
156 u8 *trx = ks->rxd; in ks8851_rdreg()
184 netdev_err(ks->netdev, "read: spi_sync() failed\n"); in ks8851_rdreg()
193 * @ks: The chip information
198 static unsigned int ks8851_rdreg16_spi(struct ks8851_net *ks, unsigned int reg) in ks8851_rdreg16_spi() argument
202 ks8851_rdreg(ks, MK_OP(reg & 2 ? 0xC : 0x3, reg), (u8 *)&rx, 2); in ks8851_rdreg16_spi()
208 * @ks: The device state.
215 static void ks8851_rdfifo_spi(struct ks8851_net *ks, u8 *buff, unsigned int len) in ks8851_rdfifo_spi() argument
217 struct ks8851_net_spi *kss = to_ks8851_spi(ks); in ks8851_rdfifo_spi()
223 netif_dbg(ks, rx_status, ks->netdev, in ks8851_rdfifo_spi()
240 netdev_err(ks->netdev, "%s: spi_sync() failed\n", __func__); in ks8851_rdfifo_spi()
245 * @ks: The device state.
254 static void ks8851_wrfifo_spi(struct ks8851_net *ks, struct sk_buff *txp, in ks8851_wrfifo_spi() argument
257 struct ks8851_net_spi *kss = to_ks8851_spi(ks); in ks8851_wrfifo_spi()
263 netif_dbg(ks, tx_queued, ks->netdev, "%s: skb %p, %d@%p, irq %d\n", in ks8851_wrfifo_spi()
266 fid = ks->fid++; in ks8851_wrfifo_spi()
273 ks->txh.txb[1] = KS_SPIOP_TXFIFO; in ks8851_wrfifo_spi()
274 ks->txh.txw[1] = cpu_to_le16(fid); in ks8851_wrfifo_spi()
275 ks->txh.txw[2] = cpu_to_le16(txp->len); in ks8851_wrfifo_spi()
277 xfer->tx_buf = &ks->txh.txb[1]; in ks8851_wrfifo_spi()
288 netdev_err(ks->netdev, "%s: spi_sync() failed\n", __func__); in ks8851_wrfifo_spi()
305 * @ks: The device state
308 static void ks8851_rx_skb_spi(struct ks8851_net *ks, struct sk_buff *skb) in ks8851_rx_skb_spi() argument
325 struct ks8851_net *ks; in ks8851_tx_work() local
331 ks = &kss->ks8851; in ks8851_tx_work()
332 last = skb_queue_empty(&ks->txq); in ks8851_tx_work()
334 ks8851_lock_spi(ks, &flags); in ks8851_tx_work()
337 txb = skb_dequeue(&ks->txq); in ks8851_tx_work()
338 last = skb_queue_empty(&ks->txq); in ks8851_tx_work()
343 ks8851_wrreg16_spi(ks, KS_RXQCR, in ks8851_tx_work()
344 ks->rc_rxqcr | RXQCR_SDA); in ks8851_tx_work()
345 ks8851_wrfifo_spi(ks, txb, last); in ks8851_tx_work()
346 ks8851_wrreg16_spi(ks, KS_RXQCR, ks->rc_rxqcr); in ks8851_tx_work()
347 ks8851_wrreg16_spi(ks, KS_TXQCR, TXQCR_METFE); in ks8851_tx_work()
349 ks8851_done_tx(ks, txb); in ks8851_tx_work()
353 tx_space = ks8851_rdreg16_spi(ks, KS_TXMIR); in ks8851_tx_work()
355 spin_lock(&ks->statelock); in ks8851_tx_work()
356 ks->queued_len -= dequeued_len; in ks8851_tx_work()
357 ks->tx_space = tx_space; in ks8851_tx_work()
358 spin_unlock(&ks->statelock); in ks8851_tx_work()
360 ks8851_unlock_spi(ks, &flags); in ks8851_tx_work()
365 * @ks: The device state
367 static void ks8851_flush_tx_work_spi(struct ks8851_net *ks) in ks8851_flush_tx_work_spi() argument
369 struct ks8851_net_spi *kss = to_ks8851_spi(ks); in ks8851_flush_tx_work_spi()
391 struct ks8851_net *ks = netdev_priv(dev); in ks8851_start_xmit_spi() local
395 kss = to_ks8851_spi(ks); in ks8851_start_xmit_spi()
397 netif_dbg(ks, tx_queued, ks->netdev, in ks8851_start_xmit_spi()
400 spin_lock(&ks->statelock); in ks8851_start_xmit_spi()
402 if (ks->queued_len + needed > ks->tx_space) { in ks8851_start_xmit_spi()
406 ks->queued_len += needed; in ks8851_start_xmit_spi()
407 skb_queue_tail(&ks->txq, skb); in ks8851_start_xmit_spi()
410 spin_unlock(&ks->statelock); in ks8851_start_xmit_spi()
422 struct ks8851_net *ks; in ks8851_probe_spi() local
430 ks = netdev_priv(netdev); in ks8851_probe_spi()
432 ks->lock = ks8851_lock_spi; in ks8851_probe_spi()
433 ks->unlock = ks8851_unlock_spi; in ks8851_probe_spi()
434 ks->rdreg16 = ks8851_rdreg16_spi; in ks8851_probe_spi()
435 ks->wrreg16 = ks8851_wrreg16_spi; in ks8851_probe_spi()
436 ks->rdfifo = ks8851_rdfifo_spi; in ks8851_probe_spi()
437 ks->wrfifo = ks8851_wrfifo_spi; in ks8851_probe_spi()
438 ks->start_xmit = ks8851_start_xmit_spi; in ks8851_probe_spi()
439 ks->rx_skb = ks8851_rx_skb_spi; in ks8851_probe_spi()
440 ks->flush_tx_work = ks8851_flush_tx_work_spi; in ks8851_probe_spi()
448 ks->rc_ier = STD_IRQ; in ks8851_probe_spi()
450 kss = to_ks8851_spi(ks); in ks8851_probe_spi()