Lines Matching defs:ks

58 #define to_ks8851_spi(ks) container_of((ks), struct ks8851_net_spi, ks8851)
75 * @ks: The chip state
80 static void ks8851_lock_spi(struct ks8851_net *ks, unsigned long *flags)
82 struct ks8851_net_spi *kss = to_ks8851_spi(ks);
89 * @ks: The chip state
94 static void ks8851_unlock_spi(struct ks8851_net *ks, unsigned long *flags)
96 struct ks8851_net_spi *kss = to_ks8851_spi(ks);
110 * @ks: The chip state
116 static void ks8851_wrreg16_spi(struct ks8851_net *ks, unsigned int reg,
119 struct ks8851_net_spi *kss = to_ks8851_spi(ks);
134 netdev_err(ks->netdev, "spi_sync() failed\n");
139 * @ks: The device state
147 static void ks8851_rdreg(struct ks8851_net *ks, unsigned int op,
150 struct ks8851_net_spi *kss = to_ks8851_spi(ks);
153 __le16 *txb = (__le16 *)ks->txd;
154 u8 *trx = ks->rxd;
182 netdev_err(ks->netdev, "read: spi_sync() failed\n");
191 * @ks: The chip information
196 static unsigned int ks8851_rdreg16_spi(struct ks8851_net *ks, unsigned int reg)
200 ks8851_rdreg(ks, MK_OP(reg & 2 ? 0xC : 0x3, reg), (u8 *)&rx, 2);
206 * @ks: The device state.
213 static void ks8851_rdfifo_spi(struct ks8851_net *ks, u8 *buff, unsigned int len)
215 struct ks8851_net_spi *kss = to_ks8851_spi(ks);
221 netif_dbg(ks, rx_status, ks->netdev,
238 netdev_err(ks->netdev, "%s: spi_sync() failed\n", __func__);
243 * @ks: The device state.
252 static void ks8851_wrfifo_spi(struct ks8851_net *ks, struct sk_buff *txp,
255 struct ks8851_net_spi *kss = to_ks8851_spi(ks);
261 netif_dbg(ks, tx_queued, ks->netdev, "%s: skb %p, %d@%p, irq %d\n",
264 fid = ks->fid++;
271 ks->txh.txb[1] = KS_SPIOP_TXFIFO;
272 ks->txh.txw[1] = cpu_to_le16(fid);
273 ks->txh.txw[2] = cpu_to_le16(txp->len);
275 xfer->tx_buf = &ks->txh.txb[1];
286 netdev_err(ks->netdev, "%s: spi_sync() failed\n", __func__);
303 * @ks: The device state
306 static void ks8851_rx_skb_spi(struct ks8851_net *ks, struct sk_buff *skb)
323 struct ks8851_net *ks;
329 ks = &kss->ks8851;
330 last = skb_queue_empty(&ks->txq);
332 ks8851_lock_spi(ks, &flags);
335 txb = skb_dequeue(&ks->txq);
336 last = skb_queue_empty(&ks->txq);
341 ks8851_wrreg16_spi(ks, KS_RXQCR,
342 ks->rc_rxqcr | RXQCR_SDA);
343 ks8851_wrfifo_spi(ks, txb, last);
344 ks8851_wrreg16_spi(ks, KS_RXQCR, ks->rc_rxqcr);
345 ks8851_wrreg16_spi(ks, KS_TXQCR, TXQCR_METFE);
347 ks8851_done_tx(ks, txb);
351 tx_space = ks8851_rdreg16_spi(ks, KS_TXMIR);
353 spin_lock(&ks->statelock);
354 ks->queued_len -= dequeued_len;
355 ks->tx_space = tx_space;
356 spin_unlock(&ks->statelock);
358 ks8851_unlock_spi(ks, &flags);
363 * @ks: The device state
365 static void ks8851_flush_tx_work_spi(struct ks8851_net *ks)
367 struct ks8851_net_spi *kss = to_ks8851_spi(ks);
389 struct ks8851_net *ks = netdev_priv(dev);
393 kss = to_ks8851_spi(ks);
395 netif_dbg(ks, tx_queued, ks->netdev,
398 spin_lock(&ks->statelock);
400 if (ks->queued_len + needed > ks->tx_space) {
404 ks->queued_len += needed;
405 skb_queue_tail(&ks->txq, skb);
408 spin_unlock(&ks->statelock);
420 struct ks8851_net *ks;
429 ks = &kss->ks8851;
431 ks->lock = ks8851_lock_spi;
432 ks->unlock = ks8851_unlock_spi;
433 ks->rdreg16 = ks8851_rdreg16_spi;
434 ks->wrreg16 = ks8851_wrreg16_spi;
435 ks->rdfifo = ks8851_rdfifo_spi;
436 ks->wrfifo = ks8851_wrfifo_spi;
437 ks->start_xmit = ks8851_start_xmit_spi;
438 ks->rx_skb = ks8851_rx_skb_spi;
439 ks->flush_tx_work = ks8851_flush_tx_work_spi;
447 ks->rc_ier = STD_IRQ;