Lines Matching refs:lp

71 static u32 _temac_ior_be(struct temac_local *lp, int offset)  in _temac_ior_be()  argument
73 return ioread32be(lp->regs + offset); in _temac_ior_be()
76 static void _temac_iow_be(struct temac_local *lp, int offset, u32 value) in _temac_iow_be() argument
78 return iowrite32be(value, lp->regs + offset); in _temac_iow_be()
81 static u32 _temac_ior_le(struct temac_local *lp, int offset) in _temac_ior_le() argument
83 return ioread32(lp->regs + offset); in _temac_ior_le()
86 static void _temac_iow_le(struct temac_local *lp, int offset, u32 value) in _temac_iow_le() argument
88 return iowrite32(value, lp->regs + offset); in _temac_iow_le()
91 static bool hard_acs_rdy(struct temac_local *lp) in hard_acs_rdy() argument
93 return temac_ior(lp, XTE_RDY0_OFFSET) & XTE_RDY0_HARD_ACS_RDY_MASK; in hard_acs_rdy()
96 static bool hard_acs_rdy_or_timeout(struct temac_local *lp, ktime_t timeout) in hard_acs_rdy_or_timeout() argument
100 return hard_acs_rdy(lp) || ktime_after(cur, timeout); in hard_acs_rdy_or_timeout()
113 int temac_indirect_busywait(struct temac_local *lp) in temac_indirect_busywait() argument
117 spin_until_cond(hard_acs_rdy_or_timeout(lp, timeout)); in temac_indirect_busywait()
118 if (WARN_ON(!hard_acs_rdy(lp))) in temac_indirect_busywait()
128 u32 temac_indirect_in32(struct temac_local *lp, int reg) in temac_indirect_in32() argument
133 spin_lock_irqsave(lp->indirect_lock, flags); in temac_indirect_in32()
134 val = temac_indirect_in32_locked(lp, reg); in temac_indirect_in32()
135 spin_unlock_irqrestore(lp->indirect_lock, flags); in temac_indirect_in32()
146 u32 temac_indirect_in32_locked(struct temac_local *lp, int reg) in temac_indirect_in32_locked() argument
152 if (WARN_ON(temac_indirect_busywait(lp))) in temac_indirect_in32_locked()
155 temac_iow(lp, XTE_CTL0_OFFSET, reg); in temac_indirect_in32_locked()
161 if (WARN_ON(temac_indirect_busywait(lp))) in temac_indirect_in32_locked()
164 return temac_ior(lp, XTE_LSW0_OFFSET); in temac_indirect_in32_locked()
171 void temac_indirect_out32(struct temac_local *lp, int reg, u32 value) in temac_indirect_out32() argument
175 spin_lock_irqsave(lp->indirect_lock, flags); in temac_indirect_out32()
176 temac_indirect_out32_locked(lp, reg, value); in temac_indirect_out32()
177 spin_unlock_irqrestore(lp->indirect_lock, flags); in temac_indirect_out32()
187 void temac_indirect_out32_locked(struct temac_local *lp, int reg, u32 value) in temac_indirect_out32_locked() argument
193 if (WARN_ON(temac_indirect_busywait(lp))) in temac_indirect_out32_locked()
196 temac_iow(lp, XTE_LSW0_OFFSET, value); in temac_indirect_out32_locked()
197 temac_iow(lp, XTE_CTL0_OFFSET, CNTLREG_WRITE_ENABLE_MASK | reg); in temac_indirect_out32_locked()
202 WARN_ON(temac_indirect_busywait(lp)); in temac_indirect_out32_locked()
211 static u32 temac_dma_in32_be(struct temac_local *lp, int reg) in temac_dma_in32_be() argument
213 return ioread32be(lp->sdma_regs + (reg << 2)); in temac_dma_in32_be()
216 static u32 temac_dma_in32_le(struct temac_local *lp, int reg) in temac_dma_in32_le() argument
218 return ioread32(lp->sdma_regs + (reg << 2)); in temac_dma_in32_le()
227 static void temac_dma_out32_be(struct temac_local *lp, int reg, u32 value) in temac_dma_out32_be() argument
229 iowrite32be(value, lp->sdma_regs + (reg << 2)); in temac_dma_out32_be()
232 static void temac_dma_out32_le(struct temac_local *lp, int reg, u32 value) in temac_dma_out32_le() argument
234 iowrite32(value, lp->sdma_regs + (reg << 2)); in temac_dma_out32_le()
246 static u32 temac_dma_dcr_in(struct temac_local *lp, int reg) in temac_dma_dcr_in() argument
248 return dcr_read(lp->sdma_dcrs, reg); in temac_dma_dcr_in()
254 static void temac_dma_dcr_out(struct temac_local *lp, int reg, u32 value) in temac_dma_dcr_out() argument
256 dcr_write(lp->sdma_dcrs, reg, value); in temac_dma_dcr_out()
263 static int temac_dcr_setup(struct temac_local *lp, struct platform_device *op, in temac_dcr_setup() argument
272 lp->sdma_dcrs = dcr_map(np, dcrs, dcr_resource_len(np, 0)); in temac_dcr_setup()
273 lp->dma_in = temac_dma_dcr_in; in temac_dcr_setup()
274 lp->dma_out = temac_dma_dcr_out; in temac_dcr_setup()
288 static int temac_dcr_setup(struct temac_local *lp, struct platform_device *op, in temac_dcr_setup() argument
301 struct temac_local *lp = netdev_priv(ndev); in temac_dma_bd_release() local
305 lp->dma_out(lp, DMA_CONTROL_REG, DMA_CONTROL_RST); in temac_dma_bd_release()
307 for (i = 0; i < lp->rx_bd_num; i++) { in temac_dma_bd_release()
308 if (!lp->rx_skb[i]) in temac_dma_bd_release()
310 dma_unmap_single(ndev->dev.parent, lp->rx_bd_v[i].phys, in temac_dma_bd_release()
312 dev_kfree_skb(lp->rx_skb[i]); in temac_dma_bd_release()
314 if (lp->rx_bd_v) in temac_dma_bd_release()
316 sizeof(*lp->rx_bd_v) * lp->rx_bd_num, in temac_dma_bd_release()
317 lp->rx_bd_v, lp->rx_bd_p); in temac_dma_bd_release()
318 if (lp->tx_bd_v) in temac_dma_bd_release()
320 sizeof(*lp->tx_bd_v) * lp->tx_bd_num, in temac_dma_bd_release()
321 lp->tx_bd_v, lp->tx_bd_p); in temac_dma_bd_release()
329 struct temac_local *lp = netdev_priv(ndev); in temac_dma_bd_init() local
334 lp->rx_skb = devm_kcalloc(&ndev->dev, lp->rx_bd_num, in temac_dma_bd_init()
335 sizeof(*lp->rx_skb), GFP_KERNEL); in temac_dma_bd_init()
336 if (!lp->rx_skb) in temac_dma_bd_init()
341 lp->tx_bd_v = dma_alloc_coherent(ndev->dev.parent, in temac_dma_bd_init()
342 sizeof(*lp->tx_bd_v) * lp->tx_bd_num, in temac_dma_bd_init()
343 &lp->tx_bd_p, GFP_KERNEL); in temac_dma_bd_init()
344 if (!lp->tx_bd_v) in temac_dma_bd_init()
347 lp->rx_bd_v = dma_alloc_coherent(ndev->dev.parent, in temac_dma_bd_init()
348 sizeof(*lp->rx_bd_v) * lp->rx_bd_num, in temac_dma_bd_init()
349 &lp->rx_bd_p, GFP_KERNEL); in temac_dma_bd_init()
350 if (!lp->rx_bd_v) in temac_dma_bd_init()
353 for (i = 0; i < lp->tx_bd_num; i++) { in temac_dma_bd_init()
354 lp->tx_bd_v[i].next = cpu_to_be32(lp->tx_bd_p in temac_dma_bd_init()
355 + sizeof(*lp->tx_bd_v) * ((i + 1) % lp->tx_bd_num)); in temac_dma_bd_init()
358 for (i = 0; i < lp->rx_bd_num; i++) { in temac_dma_bd_init()
359 lp->rx_bd_v[i].next = cpu_to_be32(lp->rx_bd_p in temac_dma_bd_init()
360 + sizeof(*lp->rx_bd_v) * ((i + 1) % lp->rx_bd_num)); in temac_dma_bd_init()
368 lp->rx_skb[i] = skb; in temac_dma_bd_init()
375 lp->rx_bd_v[i].phys = cpu_to_be32(skb_dma_addr); in temac_dma_bd_init()
376 lp->rx_bd_v[i].len = cpu_to_be32(XTE_MAX_JUMBO_FRAME_SIZE); in temac_dma_bd_init()
377 lp->rx_bd_v[i].app0 = cpu_to_be32(STS_CTRL_APP0_IRQONEND); in temac_dma_bd_init()
381 lp->dma_out(lp, TX_CHNL_CTRL, in temac_dma_bd_init()
382 lp->coalesce_delay_tx << 24 | lp->coalesce_count_tx << 16 | in temac_dma_bd_init()
386 lp->dma_out(lp, RX_CHNL_CTRL, in temac_dma_bd_init()
387 lp->coalesce_delay_rx << 24 | lp->coalesce_count_rx << 16 | in temac_dma_bd_init()
393 lp->tx_bd_ci = 0; in temac_dma_bd_init()
394 lp->tx_bd_tail = 0; in temac_dma_bd_init()
395 lp->rx_bd_ci = 0; in temac_dma_bd_init()
396 lp->rx_bd_tail = lp->rx_bd_num - 1; in temac_dma_bd_init()
400 lp->dma_out(lp, RX_CURDESC_PTR, lp->rx_bd_p); in temac_dma_bd_init()
401 lp->dma_out(lp, RX_TAILDESC_PTR, in temac_dma_bd_init()
402 lp->rx_bd_p + (sizeof(*lp->rx_bd_v) * lp->rx_bd_tail)); in temac_dma_bd_init()
405 lp->dma_out(lp, TX_CURDESC_PTR, lp->tx_bd_p); in temac_dma_bd_init()
420 struct temac_local *lp = netdev_priv(ndev); in temac_do_set_mac_address() local
424 spin_lock_irqsave(lp->indirect_lock, flags); in temac_do_set_mac_address()
425 temac_indirect_out32_locked(lp, XTE_UAW0_OFFSET, in temac_do_set_mac_address()
433 temac_indirect_out32_locked(lp, XTE_UAW1_OFFSET, in temac_do_set_mac_address()
436 spin_unlock_irqrestore(lp->indirect_lock, flags); in temac_do_set_mac_address()
461 struct temac_local *lp = netdev_priv(ndev); in temac_set_multicast_list() local
469 temac_indirect_out32(lp, XTE_AFM_OFFSET, XTE_AFM_EPPRM_MASK); in temac_set_multicast_list()
474 spin_lock_irqsave(lp->indirect_lock, flags); in temac_set_multicast_list()
486 temac_indirect_out32_locked(lp, XTE_MAW0_OFFSET, in temac_set_multicast_list()
490 temac_indirect_out32_locked(lp, XTE_MAW1_OFFSET, in temac_set_multicast_list()
498 temac_indirect_out32_locked(lp, XTE_MAW0_OFFSET, 0); in temac_set_multicast_list()
499 temac_indirect_out32_locked(lp, XTE_MAW1_OFFSET, i << 16); in temac_set_multicast_list()
504 if (temac_indirect_in32_locked(lp, XTE_AFM_OFFSET) in temac_set_multicast_list()
506 temac_indirect_out32_locked(lp, XTE_AFM_OFFSET, 0); in temac_set_multicast_list()
510 spin_unlock_irqrestore(lp->indirect_lock, flags); in temac_set_multicast_list()
601 struct temac_local *lp = netdev_priv(ndev); in temac_setoptions() local
606 spin_lock_irqsave(lp->indirect_lock, flags); in temac_setoptions()
608 reg = temac_indirect_in32_locked(lp, tp->reg) & ~tp->m_or; in temac_setoptions()
611 temac_indirect_out32_locked(lp, tp->reg, reg); in temac_setoptions()
615 spin_unlock_irqrestore(lp->indirect_lock, flags); in temac_setoptions()
616 lp->options |= options; in temac_setoptions()
624 struct temac_local *lp = netdev_priv(ndev); in temac_device_reset() local
637 temac_indirect_out32(lp, XTE_RXC1_OFFSET, XTE_RXC1_RXRST_MASK); in temac_device_reset()
639 while (temac_indirect_in32(lp, XTE_RXC1_OFFSET) & XTE_RXC1_RXRST_MASK) { in temac_device_reset()
649 temac_indirect_out32(lp, XTE_TXC_OFFSET, XTE_TXC_TXRST_MASK); in temac_device_reset()
651 while (temac_indirect_in32(lp, XTE_TXC_OFFSET) & XTE_TXC_TXRST_MASK) { in temac_device_reset()
661 spin_lock_irqsave(lp->indirect_lock, flags); in temac_device_reset()
662 val = temac_indirect_in32_locked(lp, XTE_RXC1_OFFSET); in temac_device_reset()
663 temac_indirect_out32_locked(lp, XTE_RXC1_OFFSET, in temac_device_reset()
665 spin_unlock_irqrestore(lp->indirect_lock, flags); in temac_device_reset()
668 lp->dma_out(lp, DMA_CONTROL_REG, DMA_CONTROL_RST); in temac_device_reset()
670 while (lp->dma_in(lp, DMA_CONTROL_REG) & DMA_CONTROL_RST) { in temac_device_reset()
678 lp->dma_out(lp, DMA_CONTROL_REG, DMA_TAIL_ENABLE); in temac_device_reset()
685 spin_lock_irqsave(lp->indirect_lock, flags); in temac_device_reset()
686 temac_indirect_out32_locked(lp, XTE_RXC0_OFFSET, 0); in temac_device_reset()
687 temac_indirect_out32_locked(lp, XTE_RXC1_OFFSET, 0); in temac_device_reset()
688 temac_indirect_out32_locked(lp, XTE_TXC_OFFSET, 0); in temac_device_reset()
689 temac_indirect_out32_locked(lp, XTE_FCC_OFFSET, XTE_FCC_RXFLO_MASK); in temac_device_reset()
690 spin_unlock_irqrestore(lp->indirect_lock, flags); in temac_device_reset()
696 lp->options & ~(XTE_OPTION_TXEN | XTE_OPTION_RXEN)); in temac_device_reset()
702 if (temac_setoptions(ndev, lp->options)) in temac_device_reset()
711 struct temac_local *lp = netdev_priv(ndev); in temac_adjust_link() local
720 if (lp->last_link != link_state) { in temac_adjust_link()
721 spin_lock_irqsave(lp->indirect_lock, flags); in temac_adjust_link()
722 mii_speed = temac_indirect_in32_locked(lp, XTE_EMCFG_OFFSET); in temac_adjust_link()
738 temac_indirect_out32_locked(lp, XTE_EMCFG_OFFSET, mii_speed); in temac_adjust_link()
739 spin_unlock_irqrestore(lp->indirect_lock, flags); in temac_adjust_link()
741 lp->last_link = link_state; in temac_adjust_link()
775 struct temac_local *lp = netdev_priv(ndev); in temac_start_xmit_done() local
780 cur_p = &lp->tx_bd_v[lp->tx_bd_ci]; in temac_start_xmit_done()
807 lp->tx_bd_ci++; in temac_start_xmit_done()
808 if (lp->tx_bd_ci >= lp->tx_bd_num) in temac_start_xmit_done()
809 lp->tx_bd_ci = 0; in temac_start_xmit_done()
811 cur_p = &lp->tx_bd_v[lp->tx_bd_ci]; in temac_start_xmit_done()
821 static inline int temac_check_tx_bd_space(struct temac_local *lp, int num_frag) in temac_check_tx_bd_space() argument
826 tail = lp->tx_bd_tail; in temac_check_tx_bd_space()
827 cur_p = &lp->tx_bd_v[tail]; in temac_check_tx_bd_space()
837 if (tail >= lp->tx_bd_num) in temac_check_tx_bd_space()
840 cur_p = &lp->tx_bd_v[tail]; in temac_check_tx_bd_space()
850 struct temac_local *lp = netdev_priv(ndev); in temac_start_xmit() local
859 cur_p = &lp->tx_bd_v[lp->tx_bd_tail]; in temac_start_xmit()
861 if (temac_check_tx_bd_space(lp, num_frag + 1)) { in temac_start_xmit()
871 if (temac_check_tx_bd_space(lp, num_frag + 1)) in temac_start_xmit()
900 if (++lp->tx_bd_tail >= lp->tx_bd_num) in temac_start_xmit()
901 lp->tx_bd_tail = 0; in temac_start_xmit()
903 cur_p = &lp->tx_bd_v[lp->tx_bd_tail]; in temac_start_xmit()
909 if (--lp->tx_bd_tail < 0) in temac_start_xmit()
910 lp->tx_bd_tail = lp->tx_bd_num - 1; in temac_start_xmit()
911 cur_p = &lp->tx_bd_v[lp->tx_bd_tail]; in temac_start_xmit()
918 if (--lp->tx_bd_tail < 0) in temac_start_xmit()
919 lp->tx_bd_tail = lp->tx_bd_num - 1; in temac_start_xmit()
920 cur_p = &lp->tx_bd_v[lp->tx_bd_tail]; in temac_start_xmit()
941 tail_p = lp->tx_bd_p + sizeof(*lp->tx_bd_v) * lp->tx_bd_tail; in temac_start_xmit()
942 lp->tx_bd_tail++; in temac_start_xmit()
943 if (lp->tx_bd_tail >= lp->tx_bd_num) in temac_start_xmit()
944 lp->tx_bd_tail = 0; in temac_start_xmit()
950 lp->dma_out(lp, TX_TAILDESC_PTR, tail_p); /* DMA start */ in temac_start_xmit()
952 if (temac_check_tx_bd_space(lp, MAX_SKB_FRAGS + 1)) in temac_start_xmit()
958 static int ll_temac_recv_buffers_available(struct temac_local *lp) in ll_temac_recv_buffers_available() argument
962 if (!lp->rx_skb[lp->rx_bd_ci]) in ll_temac_recv_buffers_available()
964 available = 1 + lp->rx_bd_tail - lp->rx_bd_ci; in ll_temac_recv_buffers_available()
966 available += lp->rx_bd_num; in ll_temac_recv_buffers_available()
972 struct temac_local *lp = netdev_priv(ndev); in ll_temac_recv() local
977 spin_lock_irqsave(&lp->rx_lock, flags); in ll_temac_recv()
985 struct cdmac_bd *bd = &lp->rx_bd_v[lp->rx_bd_ci]; in ll_temac_recv()
986 struct sk_buff *skb = lp->rx_skb[lp->rx_bd_ci]; in ll_temac_recv()
1013 if (((lp->temac_features & TEMAC_FEATURE_RX_CSUM) != 0) && in ll_temac_recv()
1028 lp->rx_skb[lp->rx_bd_ci] = NULL; in ll_temac_recv()
1033 rx_bd = lp->rx_bd_ci; in ll_temac_recv()
1034 if (++lp->rx_bd_ci >= lp->rx_bd_num) in ll_temac_recv()
1035 lp->rx_bd_ci = 0; in ll_temac_recv()
1036 } while (rx_bd != lp->rx_bd_tail); in ll_temac_recv()
1047 if (ll_temac_recv_buffers_available(lp) < lp->coalesce_count_rx) in ll_temac_recv()
1048 schedule_delayed_work(&lp->restart_work, HZ / 1000); in ll_temac_recv()
1064 rx_bd = lp->rx_bd_tail + 1; in ll_temac_recv()
1065 if (rx_bd >= lp->rx_bd_num) in ll_temac_recv()
1067 bd = &lp->rx_bd_v[rx_bd]; in ll_temac_recv()
1090 lp->rx_skb[rx_bd] = skb; in ll_temac_recv()
1092 lp->rx_bd_tail = rx_bd; in ll_temac_recv()
1098 lp->dma_out(lp, RX_TAILDESC_PTR, in ll_temac_recv()
1099 lp->rx_bd_p + sizeof(*lp->rx_bd_v) * lp->rx_bd_tail); in ll_temac_recv()
1102 spin_unlock_irqrestore(&lp->rx_lock, flags); in ll_temac_recv()
1110 struct temac_local *lp = container_of(work, struct temac_local, in ll_temac_restart_work_func() local
1112 struct net_device *ndev = lp->ndev; in ll_temac_restart_work_func()
1120 struct temac_local *lp = netdev_priv(ndev); in ll_temac_tx_irq() local
1123 status = lp->dma_in(lp, TX_IRQ_REG); in ll_temac_tx_irq()
1124 lp->dma_out(lp, TX_IRQ_REG, status); in ll_temac_tx_irq()
1127 temac_start_xmit_done(lp->ndev); in ll_temac_tx_irq()
1131 status, lp->dma_in(lp, TX_CHNL_STS)); in ll_temac_tx_irq()
1139 struct temac_local *lp = netdev_priv(ndev); in ll_temac_rx_irq() local
1143 status = lp->dma_in(lp, RX_IRQ_REG); in ll_temac_rx_irq()
1144 lp->dma_out(lp, RX_IRQ_REG, status); in ll_temac_rx_irq()
1147 ll_temac_recv(lp->ndev); in ll_temac_rx_irq()
1151 status, lp->dma_in(lp, RX_CHNL_STS)); in ll_temac_rx_irq()
1158 struct temac_local *lp = netdev_priv(ndev); in temac_open() local
1164 if (lp->phy_node) { in temac_open()
1165 phydev = of_phy_connect(lp->ndev, lp->phy_node, in temac_open()
1168 dev_err(lp->dev, "of_phy_connect() failed\n"); in temac_open()
1172 } else if (strlen(lp->phy_name) > 0) { in temac_open()
1173 phydev = phy_connect(lp->ndev, lp->phy_name, temac_adjust_link, in temac_open()
1174 lp->phy_interface); in temac_open()
1176 dev_err(lp->dev, "phy_connect() failed\n"); in temac_open()
1184 rc = request_irq(lp->tx_irq, ll_temac_tx_irq, 0, ndev->name, ndev); in temac_open()
1187 rc = request_irq(lp->rx_irq, ll_temac_rx_irq, 0, ndev->name, ndev); in temac_open()
1194 free_irq(lp->tx_irq, ndev); in temac_open()
1198 dev_err(lp->dev, "request_irq() failed\n"); in temac_open()
1204 struct temac_local *lp = netdev_priv(ndev); in temac_stop() local
1209 cancel_delayed_work_sync(&lp->restart_work); in temac_stop()
1211 free_irq(lp->tx_irq, ndev); in temac_stop()
1212 free_irq(lp->rx_irq, ndev); in temac_stop()
1226 struct temac_local *lp = netdev_priv(ndev); in temac_poll_controller() local
1228 disable_irq(lp->tx_irq); in temac_poll_controller()
1229 disable_irq(lp->rx_irq); in temac_poll_controller()
1231 ll_temac_rx_irq(lp->tx_irq, ndev); in temac_poll_controller()
1232 ll_temac_tx_irq(lp->rx_irq, ndev); in temac_poll_controller()
1234 enable_irq(lp->tx_irq); in temac_poll_controller()
1235 enable_irq(lp->rx_irq); in temac_poll_controller()
1259 struct temac_local *lp = netdev_priv(ndev); in temac_show_llink_regs() local
1263 len += sprintf(buf + len, "%.8x%s", lp->dma_in(lp, i), in temac_show_llink_regs()
1291 struct temac_local *lp = netdev_priv(ndev); in ll_temac_ethtools_get_ringparam() local
1297 ering->rx_pending = lp->rx_bd_num; in ll_temac_ethtools_get_ringparam()
1300 ering->tx_pending = lp->tx_bd_num; in ll_temac_ethtools_get_ringparam()
1309 struct temac_local *lp = netdev_priv(ndev); in ll_temac_ethtools_set_ringparam() local
1320 lp->rx_bd_num = ering->rx_pending; in ll_temac_ethtools_set_ringparam()
1321 lp->tx_bd_num = ering->tx_pending; in ll_temac_ethtools_set_ringparam()
1331 struct temac_local *lp = netdev_priv(ndev); in ll_temac_ethtools_get_coalesce() local
1333 ec->rx_max_coalesced_frames = lp->coalesce_count_rx; in ll_temac_ethtools_get_coalesce()
1334 ec->tx_max_coalesced_frames = lp->coalesce_count_tx; in ll_temac_ethtools_get_coalesce()
1335 ec->rx_coalesce_usecs = (lp->coalesce_delay_rx * 512) / 100; in ll_temac_ethtools_get_coalesce()
1336 ec->tx_coalesce_usecs = (lp->coalesce_delay_tx * 512) / 100; in ll_temac_ethtools_get_coalesce()
1346 struct temac_local *lp = netdev_priv(ndev); in ll_temac_ethtools_set_coalesce() local
1355 lp->coalesce_count_rx = ec->rx_max_coalesced_frames; in ll_temac_ethtools_set_coalesce()
1357 lp->coalesce_count_tx = ec->tx_max_coalesced_frames; in ll_temac_ethtools_set_coalesce()
1362 lp->coalesce_delay_rx = in ll_temac_ethtools_set_coalesce()
1365 lp->coalesce_delay_tx = in ll_temac_ethtools_set_coalesce()
1389 struct temac_local *lp; in temac_probe() local
1397 ndev = devm_alloc_etherdev(&pdev->dev, sizeof(*lp)); in temac_probe()
1421 lp = netdev_priv(ndev); in temac_probe()
1422 lp->ndev = ndev; in temac_probe()
1423 lp->dev = &pdev->dev; in temac_probe()
1424 lp->options = XTE_OPTION_DEFAULTS; in temac_probe()
1425 lp->rx_bd_num = RX_BD_NUM_DEFAULT; in temac_probe()
1426 lp->tx_bd_num = TX_BD_NUM_DEFAULT; in temac_probe()
1427 spin_lock_init(&lp->rx_lock); in temac_probe()
1428 INIT_DELAYED_WORK(&lp->restart_work, ll_temac_restart_work_func); in temac_probe()
1437 lp->indirect_lock = pdata->indirect_lock; in temac_probe()
1439 lp->indirect_lock = devm_kmalloc(&pdev->dev, in temac_probe()
1440 sizeof(*lp->indirect_lock), in temac_probe()
1442 if (!lp->indirect_lock) in temac_probe()
1444 spin_lock_init(lp->indirect_lock); in temac_probe()
1448 lp->regs = devm_platform_ioremap_resource_byname(pdev, 0); in temac_probe()
1449 if (IS_ERR(lp->regs)) { in temac_probe()
1465 lp->temac_ior = _temac_ior_le; in temac_probe()
1466 lp->temac_iow = _temac_iow_le; in temac_probe()
1468 lp->temac_ior = _temac_ior_be; in temac_probe()
1469 lp->temac_iow = _temac_iow_be; in temac_probe()
1473 lp->temac_features = 0; in temac_probe()
1477 lp->temac_features |= TEMAC_FEATURE_TX_CSUM; in temac_probe()
1480 lp->temac_features |= TEMAC_FEATURE_RX_CSUM; in temac_probe()
1483 lp->temac_features |= TEMAC_FEATURE_TX_CSUM; in temac_probe()
1485 lp->temac_features |= TEMAC_FEATURE_RX_CSUM; in temac_probe()
1487 if (lp->temac_features & TEMAC_FEATURE_TX_CSUM) in temac_probe()
1494 lp->coalesce_delay_tx = 0x10; in temac_probe()
1495 lp->coalesce_count_tx = 0x22; in temac_probe()
1496 lp->coalesce_delay_rx = 0xff; in temac_probe()
1497 lp->coalesce_count_rx = 0x07; in temac_probe()
1513 if (temac_dcr_setup(lp, pdev, dma_np)) { in temac_probe()
1515 lp->sdma_regs = devm_of_iomap(&pdev->dev, dma_np, 0, in temac_probe()
1517 if (IS_ERR(lp->sdma_regs)) { in temac_probe()
1521 return PTR_ERR(lp->sdma_regs); in temac_probe()
1524 lp->dma_in = temac_dma_in32_le; in temac_probe()
1525 lp->dma_out = temac_dma_out32_le; in temac_probe()
1527 lp->dma_in = temac_dma_in32_be; in temac_probe()
1528 lp->dma_out = temac_dma_out32_be; in temac_probe()
1530 dev_dbg(&pdev->dev, "MEM base: %p\n", lp->sdma_regs); in temac_probe()
1534 lp->rx_irq = irq_of_parse_and_map(dma_np, 0); in temac_probe()
1535 lp->tx_irq = irq_of_parse_and_map(dma_np, 1); in temac_probe()
1541 lp->sdma_regs = devm_platform_ioremap_resource(pdev, 1); in temac_probe()
1542 if (IS_ERR(lp->sdma_regs)) { in temac_probe()
1545 return PTR_ERR(lp->sdma_regs); in temac_probe()
1548 lp->dma_in = temac_dma_in32_le; in temac_probe()
1549 lp->dma_out = temac_dma_out32_le; in temac_probe()
1551 lp->dma_in = temac_dma_in32_be; in temac_probe()
1552 lp->dma_out = temac_dma_out32_be; in temac_probe()
1556 lp->rx_irq = platform_get_irq(pdev, 0); in temac_probe()
1557 lp->tx_irq = platform_get_irq(pdev, 1); in temac_probe()
1561 lp->coalesce_delay_tx = pdata->tx_irq_timeout; in temac_probe()
1562 lp->coalesce_count_tx = pdata->tx_irq_count; in temac_probe()
1565 lp->coalesce_delay_rx = pdata->rx_irq_timeout; in temac_probe()
1566 lp->coalesce_count_rx = pdata->rx_irq_count; in temac_probe()
1571 if (lp->rx_irq < 0) in temac_probe()
1572 return dev_err_probe(&pdev->dev, lp->rx_irq, in temac_probe()
1574 if (lp->tx_irq < 0) in temac_probe()
1575 return dev_err_probe(&pdev->dev, lp->tx_irq, in temac_probe()
1590 rc = temac_mdio_setup(lp, pdev); in temac_probe()
1595 lp->phy_node = of_parse_phandle(temac_np, "phy-handle", 0); in temac_probe()
1596 if (lp->phy_node) in temac_probe()
1597 dev_dbg(lp->dev, "using PHY node %pOF\n", temac_np); in temac_probe()
1599 snprintf(lp->phy_name, sizeof(lp->phy_name), in temac_probe()
1600 PHY_ID_FMT, lp->mii_bus->id, pdata->phy_addr); in temac_probe()
1601 lp->phy_interface = pdata->phy_interface; in temac_probe()
1605 rc = sysfs_create_group(&lp->dev->kobj, &temac_attr_group); in temac_probe()
1607 dev_err(lp->dev, "Error creating sysfs files\n"); in temac_probe()
1611 rc = register_netdev(lp->ndev); in temac_probe()
1613 dev_err(lp->dev, "register_netdev() error (%i)\n", rc); in temac_probe()
1620 sysfs_remove_group(&lp->dev->kobj, &temac_attr_group); in temac_probe()
1622 if (lp->phy_node) in temac_probe()
1623 of_node_put(lp->phy_node); in temac_probe()
1624 temac_mdio_teardown(lp); in temac_probe()
1631 struct temac_local *lp = netdev_priv(ndev); in temac_remove() local
1634 sysfs_remove_group(&lp->dev->kobj, &temac_attr_group); in temac_remove()
1635 if (lp->phy_node) in temac_remove()
1636 of_node_put(lp->phy_node); in temac_remove()
1637 temac_mdio_teardown(lp); in temac_remove()