Lines Matching +full:network +full:- +full:on +full:- +full:chip
1 // SPDX-License-Identifier: GPL-2.0-only
33 * struct ks8851_net_par - KS8851 Parallel driver private data
40 * The @lock ensures that the chip is protected when certain operations are
42 * of the chip registers are not accessible until the transfer is finished
43 * and the DMA has been de-asserted.
56 * ks8851_lock_par - register access lock
57 * @ks: The chip state
60 * Claim chip register access lock
66 spin_lock_irqsave(&ksp->lock, *flags); in ks8851_lock_par()
70 * ks8851_unlock_par - register access unlock
71 * @ks: The chip state
74 * Release chip register access lock
80 spin_unlock_irqrestore(&ksp->lock, *flags); in ks8851_unlock_par()
84 * ks_check_endian - Check whether endianness of the bus is correct
85 * @ks : The chip information
87 * The KS8851-16MLL EESK pin allows selecting the endianness of the 16bit
98 * If the endian strap on the KS8851-16MLL in incorrect and the chip in ks_check_endian()
100 * of BE[3:0] byte-enable bits is also swapped such that: in ks_check_endian()
103 * Luckily for us, the byte-enable bits are the top four MSbits of in ks_check_endian()
115 * BE[1:0] and this read returns non-zero 0x8872 value. in ks_check_endian()
117 iowrite16(BE3 | BE2 | KS_CIDER, ksp->hw_addr_cmd); in ks_check_endian()
118 cider = ioread16(ksp->hw_addr); in ks_check_endian()
122 netdev_err(ks->netdev, "incorrect EESK endian strap setting\n"); in ks_check_endian()
124 return -EINVAL; in ks_check_endian()
128 * ks8851_wrreg16_par - write 16bit register value to chip
129 * @ks: The chip state
140 ksp->cmd_reg_cache = (u16)reg | ((BE1 | BE0) << (reg & 0x02)); in ks8851_wrreg16_par()
141 iowrite16(ksp->cmd_reg_cache, ksp->hw_addr_cmd); in ks8851_wrreg16_par()
142 iowrite16(val, ksp->hw_addr); in ks8851_wrreg16_par()
146 * ks8851_rdreg16_par - read 16 bit register from chip
147 * @ks: The chip information
150 * Read a 16bit register from the chip, returning the result
156 ksp->cmd_reg_cache = (u16)reg | ((BE1 | BE0) << (reg & 0x02)); in ks8851_rdreg16_par()
157 iowrite16(ksp->cmd_reg_cache, ksp->hw_addr_cmd); in ks8851_rdreg16_par()
158 return ioread16(ksp->hw_addr); in ks8851_rdreg16_par()
162 * ks8851_rdfifo_par - read data from the receive fifo
174 netif_dbg(ks, rx_status, ks->netdev, in ks8851_rdfifo_par()
177 ioread16_rep(ksp->hw_addr, (u16 *)buff + 1, len / 2); in ks8851_rdfifo_par()
181 * ks8851_wrfifo_par - write packet to TX FIFO
184 * @irq: IRQ on completion of the packet.
186 * Send the @txp to the chip. This means creating the relevant packet header
187 * specifying the length of the packet and the other information the chip
188 * needs, such as IRQ on completion. Send the header and the packet data to
195 unsigned int len = ALIGN(txp->len, 4); in ks8851_wrfifo_par()
198 netif_dbg(ks, tx_queued, ks->netdev, "%s: skb %p, %d@%p, irq %d\n", in ks8851_wrfifo_par()
199 __func__, txp, txp->len, txp->data, irq); in ks8851_wrfifo_par()
201 fid = ks->fid++; in ks8851_wrfifo_par()
205 fid |= TXFR_TXIC; /* irq on completion */ in ks8851_wrfifo_par()
207 iowrite16(fid, ksp->hw_addr); in ks8851_wrfifo_par()
208 iowrite16(txp->len, ksp->hw_addr); in ks8851_wrfifo_par()
210 iowrite16_rep(ksp->hw_addr, txp->data, len / 2); in ks8851_wrfifo_par()
219 * ks8851_start_xmit_par - transmit packet
223 * Called by the network layer to transmit the @skb. Queue the packet for
227 * We do this to firstly avoid sleeping with the network device locked,
241 netif_dbg(ks, tx_queued, ks->netdev, in ks8851_start_xmit_par()
242 "%s: skb %p, %d@%p\n", __func__, skb, skb->len, skb->data); in ks8851_start_xmit_par()
248 if (likely(txmir >= skb->len + 12)) { in ks8851_start_xmit_par()
249 ks8851_wrreg16_par(ks, KS_RXQCR, ks->rc_rxqcr | RXQCR_SDA); in ks8851_start_xmit_par()
251 ks8851_wrreg16_par(ks, KS_RXQCR, ks->rc_rxqcr); in ks8851_start_xmit_par()
272 struct device *dev = &pdev->dev; in ks8851_probe_par()
280 return -ENOMEM; in ks8851_probe_par()
284 ks->lock = ks8851_lock_par; in ks8851_probe_par()
285 ks->unlock = ks8851_unlock_par; in ks8851_probe_par()
286 ks->rdreg16 = ks8851_rdreg16_par; in ks8851_probe_par()
287 ks->wrreg16 = ks8851_wrreg16_par; in ks8851_probe_par()
288 ks->rdfifo = ks8851_rdfifo_par; in ks8851_probe_par()
289 ks->wrfifo = ks8851_wrfifo_par; in ks8851_probe_par()
290 ks->start_xmit = ks8851_start_xmit_par; in ks8851_probe_par()
295 ks->rc_ier = STD_IRQ; in ks8851_probe_par()
298 spin_lock_init(&ksp->lock); in ks8851_probe_par()
300 ksp->hw_addr = devm_platform_ioremap_resource(pdev, 0); in ks8851_probe_par()
301 if (IS_ERR(ksp->hw_addr)) in ks8851_probe_par()
302 return PTR_ERR(ksp->hw_addr); in ks8851_probe_par()
304 ksp->hw_addr_cmd = devm_platform_ioremap_resource(pdev, 1); in ks8851_probe_par()
305 if (IS_ERR(ksp->hw_addr_cmd)) in ks8851_probe_par()
306 return PTR_ERR(ksp->hw_addr_cmd); in ks8851_probe_par()
312 netdev->irq = platform_get_irq(pdev, 0); in ks8851_probe_par()
313 if (netdev->irq < 0) in ks8851_probe_par()
314 return netdev->irq; in ks8851_probe_par()
321 ks8851_remove_common(&pdev->dev); in ks8851_remove_par()
325 { .compatible = "micrel,ks8851-mll" },
341 MODULE_DESCRIPTION("KS8851 Network driver");