Lines Matching refs:qca
66 struct qcauart *qca = serdev_device_get_drvdata(serdev); in qca_tty_receive() local
67 struct net_device *netdev = qca->net_dev; in qca_tty_receive()
71 if (!qca->rx_skb) { in qca_tty_receive()
72 qca->rx_skb = netdev_alloc_skb_ip_align(netdev, in qca_tty_receive()
75 if (!qca->rx_skb) { in qca_tty_receive()
85 retcode = qcafrm_fsm_decode(&qca->frm_handle, in qca_tty_receive()
86 qca->rx_skb->data, in qca_tty_receive()
87 skb_tailroom(qca->rx_skb), in qca_tty_receive()
107 skb_put(qca->rx_skb, retcode); in qca_tty_receive()
108 qca->rx_skb->protocol = eth_type_trans( in qca_tty_receive()
109 qca->rx_skb, qca->rx_skb->dev); in qca_tty_receive()
110 skb_checksum_none_assert(qca->rx_skb); in qca_tty_receive()
111 netif_rx(qca->rx_skb); in qca_tty_receive()
112 qca->rx_skb = netdev_alloc_skb_ip_align(netdev, in qca_tty_receive()
115 if (!qca->rx_skb) { in qca_tty_receive()
129 struct qcauart *qca = container_of(work, struct qcauart, tx_work); in qcauart_transmit() local
130 struct net_device_stats *n_stats = &qca->net_dev->stats; in qcauart_transmit()
133 spin_lock_bh(&qca->lock); in qcauart_transmit()
136 if (!netif_running(qca->net_dev)) { in qcauart_transmit()
137 spin_unlock_bh(&qca->lock); in qcauart_transmit()
141 if (qca->tx_left <= 0) { in qcauart_transmit()
146 spin_unlock_bh(&qca->lock); in qcauart_transmit()
147 netif_wake_queue(qca->net_dev); in qcauart_transmit()
151 written = serdev_device_write_buf(qca->serdev, qca->tx_head, in qcauart_transmit()
152 qca->tx_left); in qcauart_transmit()
154 qca->tx_left -= written; in qcauart_transmit()
155 qca->tx_head += written; in qcauart_transmit()
157 spin_unlock_bh(&qca->lock); in qcauart_transmit()
165 struct qcauart *qca = serdev_device_get_drvdata(serdev); in qca_tty_wakeup() local
167 schedule_work(&qca->tx_work); in qca_tty_wakeup()
177 struct qcauart *qca = netdev_priv(dev); in qcauart_netdev_open() local
179 netif_start_queue(qca->net_dev); in qcauart_netdev_open()
186 struct qcauart *qca = netdev_priv(dev); in qcauart_netdev_close() local
189 flush_work(&qca->tx_work); in qcauart_netdev_close()
191 spin_lock_bh(&qca->lock); in qcauart_netdev_close()
192 qca->tx_left = 0; in qcauart_netdev_close()
193 spin_unlock_bh(&qca->lock); in qcauart_netdev_close()
202 struct qcauart *qca = netdev_priv(dev); in qcauart_netdev_xmit() local
207 spin_lock(&qca->lock); in qcauart_netdev_xmit()
209 WARN_ON(qca->tx_left); in qcauart_netdev_xmit()
212 spin_unlock(&qca->lock); in qcauart_netdev_xmit()
213 netdev_warn(qca->net_dev, "xmit: iface is down\n"); in qcauart_netdev_xmit()
217 pos = qca->tx_buffer; in qcauart_netdev_xmit()
234 netif_stop_queue(qca->net_dev); in qcauart_netdev_xmit()
236 written = serdev_device_write_buf(qca->serdev, qca->tx_buffer, in qcauart_netdev_xmit()
237 pos - qca->tx_buffer); in qcauart_netdev_xmit()
239 qca->tx_left = (pos - qca->tx_buffer) - written; in qcauart_netdev_xmit()
240 qca->tx_head = qca->tx_buffer + written; in qcauart_netdev_xmit()
243 spin_unlock(&qca->lock); in qcauart_netdev_xmit()
253 struct qcauart *qca = netdev_priv(dev); in qcauart_netdev_tx_timeout() local
255 netdev_info(qca->net_dev, "Transmit timeout at %ld, latency %ld\n", in qcauart_netdev_tx_timeout()
263 struct qcauart *qca = netdev_priv(dev); in qcauart_netdev_init() local
271 qca->tx_buffer = devm_kmalloc(&qca->serdev->dev, len, GFP_KERNEL); in qcauart_netdev_init()
272 if (!qca->tx_buffer) in qcauart_netdev_init()
275 qca->rx_skb = netdev_alloc_skb_ip_align(qca->net_dev, in qcauart_netdev_init()
276 qca->net_dev->mtu + in qcauart_netdev_init()
278 if (!qca->rx_skb) in qcauart_netdev_init()
286 struct qcauart *qca = netdev_priv(dev); in qcauart_netdev_uninit() local
288 dev_kfree_skb(qca->rx_skb); in qcauart_netdev_uninit()
325 struct qcauart *qca; in qca_uart_probe() local
335 qca = netdev_priv(qcauart_dev); in qca_uart_probe()
336 if (!qca) { in qca_uart_probe()
341 qca->net_dev = qcauart_dev; in qca_uart_probe()
342 qca->serdev = serdev; in qca_uart_probe()
343 qcafrm_fsm_init_uart(&qca->frm_handle); in qca_uart_probe()
345 spin_lock_init(&qca->lock); in qca_uart_probe()
346 INIT_WORK(&qca->tx_work, qcauart_transmit); in qca_uart_probe()
350 ret = of_get_ethdev_address(serdev->dev.of_node, qca->net_dev); in qca_uart_probe()
352 eth_hw_addr_random(qca->net_dev); in qca_uart_probe()
354 qca->net_dev->dev_addr); in qca_uart_probe()
357 netif_carrier_on(qca->net_dev); in qca_uart_probe()
358 serdev_device_set_drvdata(serdev, qca); in qca_uart_probe()
378 cancel_work_sync(&qca->tx_work); in qca_uart_probe()
391 struct qcauart *qca = serdev_device_get_drvdata(serdev); in qca_uart_remove() local
393 unregister_netdev(qca->net_dev); in qca_uart_remove()
397 cancel_work_sync(&qca->tx_work); in qca_uart_remove()
399 free_netdev(qca->net_dev); in qca_uart_remove()