Lines Matching refs:qca

51 	struct qcauart *qca = serdev_device_get_drvdata(serdev);  in qca_tty_receive()  local
52 struct net_device *netdev = qca->net_dev; in qca_tty_receive()
56 if (!qca->rx_skb) { in qca_tty_receive()
57 qca->rx_skb = netdev_alloc_skb_ip_align(netdev, in qca_tty_receive()
60 if (!qca->rx_skb) { in qca_tty_receive()
70 retcode = qcafrm_fsm_decode(&qca->frm_handle, in qca_tty_receive()
71 qca->rx_skb->data, in qca_tty_receive()
72 skb_tailroom(qca->rx_skb), in qca_tty_receive()
92 skb_put(qca->rx_skb, retcode); in qca_tty_receive()
93 qca->rx_skb->protocol = eth_type_trans( in qca_tty_receive()
94 qca->rx_skb, qca->rx_skb->dev); in qca_tty_receive()
95 skb_checksum_none_assert(qca->rx_skb); in qca_tty_receive()
96 netif_rx(qca->rx_skb); in qca_tty_receive()
97 qca->rx_skb = netdev_alloc_skb_ip_align(netdev, in qca_tty_receive()
100 if (!qca->rx_skb) { in qca_tty_receive()
114 struct qcauart *qca = container_of(work, struct qcauart, tx_work); in qcauart_transmit() local
115 struct net_device_stats *n_stats = &qca->net_dev->stats; in qcauart_transmit()
118 spin_lock_bh(&qca->lock); in qcauart_transmit()
121 if (!netif_running(qca->net_dev)) { in qcauart_transmit()
122 spin_unlock_bh(&qca->lock); in qcauart_transmit()
126 if (qca->tx_left <= 0) { in qcauart_transmit()
131 spin_unlock_bh(&qca->lock); in qcauart_transmit()
132 netif_wake_queue(qca->net_dev); in qcauart_transmit()
136 written = serdev_device_write_buf(qca->serdev, qca->tx_head, in qcauart_transmit()
137 qca->tx_left); in qcauart_transmit()
139 qca->tx_left -= written; in qcauart_transmit()
140 qca->tx_head += written; in qcauart_transmit()
142 spin_unlock_bh(&qca->lock); in qcauart_transmit()
150 struct qcauart *qca = serdev_device_get_drvdata(serdev); in qca_tty_wakeup() local
152 schedule_work(&qca->tx_work); in qca_tty_wakeup()
162 struct qcauart *qca = netdev_priv(dev); in qcauart_netdev_open() local
164 netif_start_queue(qca->net_dev); in qcauart_netdev_open()
171 struct qcauart *qca = netdev_priv(dev); in qcauart_netdev_close() local
174 flush_work(&qca->tx_work); in qcauart_netdev_close()
176 spin_lock_bh(&qca->lock); in qcauart_netdev_close()
177 qca->tx_left = 0; in qcauart_netdev_close()
178 spin_unlock_bh(&qca->lock); in qcauart_netdev_close()
187 struct qcauart *qca = netdev_priv(dev); in qcauart_netdev_xmit() local
192 spin_lock(&qca->lock); in qcauart_netdev_xmit()
194 WARN_ON(qca->tx_left); in qcauart_netdev_xmit()
197 spin_unlock(&qca->lock); in qcauart_netdev_xmit()
198 netdev_warn(qca->net_dev, "xmit: iface is down\n"); in qcauart_netdev_xmit()
202 pos = qca->tx_buffer; in qcauart_netdev_xmit()
219 netif_stop_queue(qca->net_dev); in qcauart_netdev_xmit()
221 written = serdev_device_write_buf(qca->serdev, qca->tx_buffer, in qcauart_netdev_xmit()
222 pos - qca->tx_buffer); in qcauart_netdev_xmit()
224 qca->tx_left = (pos - qca->tx_buffer) - written; in qcauart_netdev_xmit()
225 qca->tx_head = qca->tx_buffer + written; in qcauart_netdev_xmit()
228 spin_unlock(&qca->lock); in qcauart_netdev_xmit()
238 struct qcauart *qca = netdev_priv(dev); in qcauart_netdev_tx_timeout() local
240 netdev_info(qca->net_dev, "Transmit timeout at %ld, latency %ld\n", in qcauart_netdev_tx_timeout()
248 struct qcauart *qca = netdev_priv(dev); in qcauart_netdev_init() local
256 qca->tx_buffer = devm_kmalloc(&qca->serdev->dev, len, GFP_KERNEL); in qcauart_netdev_init()
257 if (!qca->tx_buffer) in qcauart_netdev_init()
260 qca->rx_skb = netdev_alloc_skb_ip_align(qca->net_dev, in qcauart_netdev_init()
261 qca->net_dev->mtu + in qcauart_netdev_init()
263 if (!qca->rx_skb) in qcauart_netdev_init()
271 struct qcauart *qca = netdev_priv(dev); in qcauart_netdev_uninit() local
273 dev_kfree_skb(qca->rx_skb); in qcauart_netdev_uninit()
310 struct qcauart *qca; in qca_uart_probe() local
320 qca = netdev_priv(qcauart_dev); in qca_uart_probe()
321 if (!qca) { in qca_uart_probe()
326 qca->net_dev = qcauart_dev; in qca_uart_probe()
327 qca->serdev = serdev; in qca_uart_probe()
328 qcafrm_fsm_init_uart(&qca->frm_handle); in qca_uart_probe()
330 spin_lock_init(&qca->lock); in qca_uart_probe()
331 INIT_WORK(&qca->tx_work, qcauart_transmit); in qca_uart_probe()
335 ret = of_get_ethdev_address(serdev->dev.of_node, qca->net_dev); in qca_uart_probe()
337 eth_hw_addr_random(qca->net_dev); in qca_uart_probe()
339 qca->net_dev->dev_addr); in qca_uart_probe()
342 netif_carrier_on(qca->net_dev); in qca_uart_probe()
343 serdev_device_set_drvdata(serdev, qca); in qca_uart_probe()
363 cancel_work_sync(&qca->tx_work); in qca_uart_probe()
376 struct qcauart *qca = serdev_device_get_drvdata(serdev); in qca_uart_remove() local
378 unregister_netdev(qca->net_dev); in qca_uart_remove()
382 cancel_work_sync(&qca->tx_work); in qca_uart_remove()
384 free_netdev(qca->net_dev); in qca_uart_remove()