Lines Matching +full:r8a779g0 +full:- +full:ethertsn
1 // SPDX-License-Identifier: GPL-2.0
3 /* Renesas Ethernet-TSN device driver
10 #include <linux/dma-mapping.h>
69 return ioread32(priv->base + reg); in rtsn_read()
74 iowrite32(data, priv->base + reg); in rtsn_write()
88 return readl_poll_timeout(priv->base + reg, val, in rtsn_reg_wait()
106 struct rcar_gen4_ptp_private *ptp_priv = priv->ptp_priv; in rtsn_get_timestamp()
108 ptp_priv->info.gettime64(&ptp_priv->info, ts); in rtsn_get_timestamp()
119 for (; priv->cur_tx - priv->dirty_tx > 0; priv->dirty_tx++) { in rtsn_tx_free()
120 entry = priv->dirty_tx % priv->num_tx_ring; in rtsn_tx_free()
121 desc = &priv->tx_ring[entry]; in rtsn_tx_free()
122 if (free_txed_only && (desc->die_dt & DT_MASK) != DT_FEMPTY) in rtsn_tx_free()
126 size = le16_to_cpu(desc->info_ds) & TX_DS; in rtsn_tx_free()
127 skb = priv->tx_skb[entry]; in rtsn_tx_free()
129 if (skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) { in rtsn_tx_free()
138 dma_unmap_single(ndev->dev.parent, in rtsn_tx_free()
139 le32_to_cpu(desc->dptr), in rtsn_tx_free()
141 dev_kfree_skb_any(priv->tx_skb[entry]); in rtsn_tx_free()
144 priv->stats.tx_packets++; in rtsn_tx_free()
145 priv->stats.tx_bytes += size; in rtsn_tx_free()
148 desc->die_dt = DT_EEMPTY; in rtsn_tx_free()
151 desc = &priv->tx_ring[priv->num_tx_ring]; in rtsn_tx_free()
152 desc->die_dt = DT_LINK; in rtsn_tx_free()
165 get_ts = priv->ptp_priv->tstamp_rx_ctrl & in rtsn_rx()
168 ndescriptors = priv->dirty_rx + priv->num_rx_ring - priv->cur_rx; in rtsn_rx()
171 const unsigned int entry = priv->cur_rx % priv->num_rx_ring; in rtsn_rx()
172 struct rtsn_ext_ts_desc *desc = &priv->rx_ring[entry]; in rtsn_rx()
182 if ((desc->die_dt & DT_MASK) == DT_FEMPTY) in rtsn_rx()
186 pkt_len = le16_to_cpu(desc->info_ds) & RX_DS; in rtsn_rx()
188 skb = priv->rx_skb[entry]; in rtsn_rx()
189 priv->rx_skb[entry] = NULL; in rtsn_rx()
190 dma_addr = le32_to_cpu(desc->dptr); in rtsn_rx()
191 dma_unmap_single(ndev->dev.parent, dma_addr, PKT_BUF_SZ, in rtsn_rx()
202 ts.tv_sec = (u64)le32_to_cpu(desc->ts_sec); in rtsn_rx()
203 ts.tv_nsec = le32_to_cpu(desc->ts_nsec & cpu_to_le32(0x3fffffff)); in rtsn_rx()
205 shhwtstamps->hwtstamp = timespec64_to_ktime(ts); in rtsn_rx()
209 skb->protocol = eth_type_trans(skb, ndev); in rtsn_rx()
210 napi_gro_receive(&priv->napi, skb); in rtsn_rx()
213 priv->stats.rx_packets++; in rtsn_rx()
214 priv->stats.rx_bytes += pkt_len; in rtsn_rx()
217 priv->cur_rx++; in rtsn_rx()
222 for (; priv->cur_rx - priv->dirty_rx > 0; priv->dirty_rx++) { in rtsn_rx()
223 const unsigned int entry = priv->dirty_rx % priv->num_rx_ring; in rtsn_rx()
224 struct rtsn_ext_ts_desc *desc = &priv->rx_ring[entry]; in rtsn_rx()
228 desc->info_ds = cpu_to_le16(PKT_BUF_SZ); in rtsn_rx()
230 if (!priv->rx_skb[entry]) { in rtsn_rx()
231 skb = napi_alloc_skb(&priv->napi, in rtsn_rx()
232 PKT_BUF_SZ + RTSN_ALIGN - 1); in rtsn_rx()
236 dma_addr = dma_map_single(ndev->dev.parent, skb->data, in rtsn_rx()
237 le16_to_cpu(desc->info_ds), in rtsn_rx()
239 if (dma_mapping_error(ndev->dev.parent, dma_addr)) in rtsn_rx()
240 desc->info_ds = cpu_to_le16(0); in rtsn_rx()
241 desc->dptr = cpu_to_le32(dma_addr); in rtsn_rx()
243 priv->rx_skb[entry] = skb; in rtsn_rx()
247 desc->die_dt = DT_FEMPTY | D_DIE; in rtsn_rx()
250 priv->rx_ring[priv->num_rx_ring].die_dt = DT_LINK; in rtsn_rx()
262 ndev = napi->dev; in rtsn_poll()
269 spin_lock_irqsave(&priv->lock, flags); in rtsn_poll()
272 spin_unlock_irqrestore(&priv->lock, flags); in rtsn_poll()
274 /* Re-enable TX/RX interrupts */ in rtsn_poll()
276 spin_lock_irqsave(&priv->lock, flags); in rtsn_poll()
278 spin_unlock_irqrestore(&priv->lock, flags); in rtsn_poll()
286 struct device *dev = &priv->pdev->dev; in rtsn_desc_alloc()
289 priv->tx_desc_bat_size = sizeof(struct rtsn_desc) * TX_NUM_CHAINS; in rtsn_desc_alloc()
290 priv->tx_desc_bat = dma_alloc_coherent(dev, priv->tx_desc_bat_size, in rtsn_desc_alloc()
291 &priv->tx_desc_bat_dma, in rtsn_desc_alloc()
294 if (!priv->tx_desc_bat) in rtsn_desc_alloc()
295 return -ENOMEM; in rtsn_desc_alloc()
298 priv->tx_desc_bat[i].die_dt = DT_EOS; in rtsn_desc_alloc()
300 priv->rx_desc_bat_size = sizeof(struct rtsn_desc) * RX_NUM_CHAINS; in rtsn_desc_alloc()
301 priv->rx_desc_bat = dma_alloc_coherent(dev, priv->rx_desc_bat_size, in rtsn_desc_alloc()
302 &priv->rx_desc_bat_dma, in rtsn_desc_alloc()
305 if (!priv->rx_desc_bat) in rtsn_desc_alloc()
306 return -ENOMEM; in rtsn_desc_alloc()
309 priv->rx_desc_bat[i].die_dt = DT_EOS; in rtsn_desc_alloc()
316 if (priv->tx_desc_bat) in rtsn_desc_free()
317 dma_free_coherent(&priv->pdev->dev, priv->tx_desc_bat_size, in rtsn_desc_free()
318 priv->tx_desc_bat, priv->tx_desc_bat_dma); in rtsn_desc_free()
319 priv->tx_desc_bat = NULL; in rtsn_desc_free()
321 if (priv->rx_desc_bat) in rtsn_desc_free()
322 dma_free_coherent(&priv->pdev->dev, priv->rx_desc_bat_size, in rtsn_desc_free()
323 priv->rx_desc_bat, priv->rx_desc_bat_dma); in rtsn_desc_free()
324 priv->rx_desc_bat = NULL; in rtsn_desc_free()
329 struct device *dev = &priv->pdev->dev; in rtsn_chain_free()
332 sizeof(struct rtsn_ext_desc) * (priv->num_tx_ring + 1), in rtsn_chain_free()
333 priv->tx_ring, priv->tx_desc_dma); in rtsn_chain_free()
334 priv->tx_ring = NULL; in rtsn_chain_free()
337 sizeof(struct rtsn_ext_ts_desc) * (priv->num_rx_ring + 1), in rtsn_chain_free()
338 priv->rx_ring, priv->rx_desc_dma); in rtsn_chain_free()
339 priv->rx_ring = NULL; in rtsn_chain_free()
341 kfree(priv->tx_skb); in rtsn_chain_free()
342 priv->tx_skb = NULL; in rtsn_chain_free()
344 kfree(priv->rx_skb); in rtsn_chain_free()
345 priv->rx_skb = NULL; in rtsn_chain_free()
350 struct net_device *ndev = priv->ndev; in rtsn_chain_init()
354 priv->num_tx_ring = tx_size; in rtsn_chain_init()
355 priv->num_rx_ring = rx_size; in rtsn_chain_init()
357 priv->tx_skb = kcalloc(tx_size, sizeof(*priv->tx_skb), GFP_KERNEL); in rtsn_chain_init()
358 priv->rx_skb = kcalloc(rx_size, sizeof(*priv->rx_skb), GFP_KERNEL); in rtsn_chain_init()
360 if (!priv->rx_skb || !priv->tx_skb) in rtsn_chain_init()
364 skb = netdev_alloc_skb(ndev, PKT_BUF_SZ + RTSN_ALIGN - 1); in rtsn_chain_init()
368 priv->rx_skb[i] = skb; in rtsn_chain_init()
372 priv->tx_ring = dma_alloc_coherent(ndev->dev.parent, in rtsn_chain_init()
374 &priv->tx_desc_dma, GFP_KERNEL); in rtsn_chain_init()
375 priv->rx_ring = dma_alloc_coherent(ndev->dev.parent, in rtsn_chain_init()
377 &priv->rx_desc_dma, GFP_KERNEL); in rtsn_chain_init()
379 if (!priv->tx_ring || !priv->rx_ring) in rtsn_chain_init()
386 return -ENOMEM; in rtsn_chain_init()
391 struct net_device *ndev = priv->ndev; in rtsn_chain_format()
398 priv->cur_tx = 0; in rtsn_chain_format()
399 priv->cur_rx = 0; in rtsn_chain_format()
400 priv->dirty_rx = 0; in rtsn_chain_format()
401 priv->dirty_tx = 0; in rtsn_chain_format()
404 memset(priv->tx_ring, 0, sizeof(*tx_desc) * priv->num_tx_ring); in rtsn_chain_format()
405 for (i = 0, tx_desc = priv->tx_ring; i < priv->num_tx_ring; i++, tx_desc++) in rtsn_chain_format()
406 tx_desc->die_dt = DT_EEMPTY | D_DIE; in rtsn_chain_format()
408 tx_desc->dptr = cpu_to_le32((u32)priv->tx_desc_dma); in rtsn_chain_format()
409 tx_desc->die_dt = DT_LINK; in rtsn_chain_format()
411 bat_desc = &priv->tx_desc_bat[TX_CHAIN_IDX]; in rtsn_chain_format()
412 bat_desc->die_dt = DT_LINK; in rtsn_chain_format()
413 bat_desc->dptr = cpu_to_le32((u32)priv->tx_desc_dma); in rtsn_chain_format()
416 memset(priv->rx_ring, 0, sizeof(*rx_desc) * priv->num_rx_ring); in rtsn_chain_format()
417 for (i = 0, rx_desc = priv->rx_ring; i < priv->num_rx_ring; i++, rx_desc++) { in rtsn_chain_format()
418 dma_addr = dma_map_single(ndev->dev.parent, in rtsn_chain_format()
419 priv->rx_skb[i]->data, PKT_BUF_SZ, in rtsn_chain_format()
421 if (!dma_mapping_error(ndev->dev.parent, dma_addr)) in rtsn_chain_format()
422 rx_desc->info_ds = cpu_to_le16(PKT_BUF_SZ); in rtsn_chain_format()
423 rx_desc->dptr = cpu_to_le32((u32)dma_addr); in rtsn_chain_format()
424 rx_desc->die_dt = DT_FEMPTY | D_DIE; in rtsn_chain_format()
426 rx_desc->dptr = cpu_to_le32((u32)priv->rx_desc_dma); in rtsn_chain_format()
427 rx_desc->die_dt = DT_LINK; in rtsn_chain_format()
429 bat_desc = &priv->rx_desc_bat[RX_CHAIN_IDX]; in rtsn_chain_format()
430 bat_desc->die_dt = DT_LINK; in rtsn_chain_format()
431 bat_desc->dptr = cpu_to_le32((u32)priv->rx_desc_dma); in rtsn_chain_format()
464 return -ETIMEDOUT; in rtsn_wait_mode()
474 netdev_err(priv->ndev, "Failed to switch operation mode\n"); in rtsn_change_mode()
493 spin_lock(&priv->lock); in rtsn_irq()
500 if (napi_schedule_prep(&priv->napi)) { in rtsn_irq()
504 __napi_schedule(&priv->napi); in rtsn_irq()
510 spin_unlock(&priv->lock); in rtsn_irq()
522 name = devm_kasprintf(&priv->pdev->dev, GFP_KERNEL, "%s:%s", in rtsn_request_irq()
523 priv->ndev->name, ch); in rtsn_request_irq()
525 return -ENOMEM; in rtsn_request_irq()
529 netdev_err(priv->ndev, "Cannot request IRQ %s\n", name); in rtsn_request_irq()
536 free_irq(priv->tx_data_irq, priv); in rtsn_free_irqs()
537 free_irq(priv->rx_data_irq, priv); in rtsn_free_irqs()
544 priv->rx_data_irq = platform_get_irq_byname(priv->pdev, "rx"); in rtsn_request_irqs()
545 if (priv->rx_data_irq < 0) in rtsn_request_irqs()
546 return priv->rx_data_irq; in rtsn_request_irqs()
548 priv->tx_data_irq = platform_get_irq_byname(priv->pdev, "tx"); in rtsn_request_irqs()
549 if (priv->tx_data_irq < 0) in rtsn_request_irqs()
550 return priv->tx_data_irq; in rtsn_request_irqs()
552 ret = rtsn_request_irq(priv->tx_data_irq, rtsn_irq, 0, priv, "tx"); in rtsn_request_irqs()
556 ret = rtsn_request_irq(priv->rx_data_irq, rtsn_irq, 0, priv, "rx"); in rtsn_request_irqs()
558 free_irq(priv->tx_data_irq, priv); in rtsn_request_irqs()
567 reset_control_reset(priv->reset); in rtsn_reset()
589 rtsn_write(priv, TATLS1, priv->tx_desc_bat_dma + TX_CHAIN_ADDR_OFFSET); in rtsn_axibmi_init()
599 rtsn_write(priv, RATLS1, priv->rx_desc_bat_dma + RX_CHAIN_ADDR_OFFSET); in rtsn_axibmi_init()
627 ret = of_get_phy_mode(priv->pdev->dev.of_node, &priv->iface); in rtsn_get_phy_params()
631 switch (priv->iface) { in rtsn_get_phy_params()
633 priv->speed = 100; in rtsn_get_phy_params()
639 priv->speed = 1000; in rtsn_get_phy_params()
642 return -EOPNOTSUPP; in rtsn_get_phy_params()
652 switch (priv->iface) { in rtsn_set_phy_interface()
673 switch (priv->speed) { in rtsn_set_rate()
692 const u8 *mac_addr = priv->ndev->dev_addr; in rtsn_rmac_init()
753 struct rtsn_private *priv = bus->priv; in rtsn_mii_access()
786 struct platform_device *pdev = priv->pdev; in rtsn_mdio_alloc()
787 struct device *dev = &pdev->dev; in rtsn_mdio_alloc()
794 return -ENOMEM; in rtsn_mdio_alloc()
796 mdio_node = of_get_child_by_name(dev->of_node, "mdio"); in rtsn_mdio_alloc()
798 ret = -ENODEV; in rtsn_mdio_alloc()
815 mii->name = "rtsn_mii"; in rtsn_mdio_alloc()
816 snprintf(mii->id, MII_BUS_ID_SIZE, "%s-%x", in rtsn_mdio_alloc()
817 pdev->name, pdev->id); in rtsn_mdio_alloc()
818 mii->priv = priv; in rtsn_mdio_alloc()
819 mii->read = rtsn_mii_read; in rtsn_mdio_alloc()
820 mii->write = rtsn_mii_write; in rtsn_mdio_alloc()
821 mii->parent = dev; in rtsn_mdio_alloc()
828 priv->mii = mii; in rtsn_mdio_alloc()
839 mdiobus_unregister(priv->mii); in rtsn_mdio_free()
840 mdiobus_free(priv->mii); in rtsn_mdio_free()
841 priv->mii = NULL; in rtsn_mdio_free()
847 struct phy_device *phydev = ndev->phydev; in rtsn_adjust_link()
851 spin_lock_irqsave(&priv->lock, flags); in rtsn_adjust_link()
853 if (phydev->link) { in rtsn_adjust_link()
854 if (phydev->speed != priv->speed) { in rtsn_adjust_link()
856 priv->speed = phydev->speed; in rtsn_adjust_link()
859 if (!priv->link) { in rtsn_adjust_link()
861 priv->link = phydev->link; in rtsn_adjust_link()
863 } else if (priv->link) { in rtsn_adjust_link()
865 priv->link = 0; in rtsn_adjust_link()
866 priv->speed = 0; in rtsn_adjust_link()
897 spin_unlock_irqrestore(&priv->lock, flags); in rtsn_adjust_link()
905 struct device_node *np = priv->ndev->dev.parent->of_node; in rtsn_phy_init()
909 priv->link = 0; in rtsn_phy_init()
911 phy = of_parse_phandle(np, "phy-handle", 0); in rtsn_phy_init()
913 return -ENOENT; in rtsn_phy_init()
915 phydev = of_phy_connect(priv->ndev, phy, rtsn_adjust_link, 0, in rtsn_phy_init()
916 priv->iface); in rtsn_phy_init()
919 return -ENOENT; in rtsn_phy_init()
921 /* Only support full-duplex mode */ in rtsn_phy_init()
933 phy_disconnect(priv->ndev->phydev); in rtsn_phy_deinit()
934 priv->ndev->phydev = NULL; in rtsn_phy_deinit()
1018 napi_enable(&priv->napi); in rtsn_open()
1022 napi_disable(&priv->napi); in rtsn_open()
1026 phy_start(ndev->phydev); in rtsn_open()
1037 phy_stop(priv->ndev->phydev); in rtsn_stop()
1038 napi_disable(&priv->napi); in rtsn_stop()
1054 spin_lock_irqsave(&priv->lock, flags); in rtsn_start_xmit()
1057 if (skb->len >= TX_DS) { in rtsn_start_xmit()
1058 priv->stats.tx_dropped++; in rtsn_start_xmit()
1059 priv->stats.tx_errors++; in rtsn_start_xmit()
1064 if (priv->cur_tx - priv->dirty_tx > priv->num_tx_ring) { in rtsn_start_xmit()
1073 dma_addr = dma_map_single(ndev->dev.parent, skb->data, skb->len, in rtsn_start_xmit()
1075 if (dma_mapping_error(ndev->dev.parent, dma_addr)) { in rtsn_start_xmit()
1080 entry = priv->cur_tx % priv->num_tx_ring; in rtsn_start_xmit()
1081 priv->tx_skb[entry] = skb; in rtsn_start_xmit()
1082 desc = &priv->tx_ring[entry]; in rtsn_start_xmit()
1083 desc->dptr = cpu_to_le32(dma_addr); in rtsn_start_xmit()
1084 desc->info_ds = cpu_to_le16(skb->len); in rtsn_start_xmit()
1085 desc->info1 = cpu_to_le64(skb->len); in rtsn_start_xmit()
1087 if (skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) { in rtsn_start_xmit()
1088 skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS; in rtsn_start_xmit()
1089 priv->ts_tag++; in rtsn_start_xmit()
1090 desc->info_ds |= cpu_to_le16(TXC); in rtsn_start_xmit()
1091 desc->info = priv->ts_tag; in rtsn_start_xmit()
1097 desc->die_dt = DT_FSINGLE | D_DIE; in rtsn_start_xmit()
1098 priv->cur_tx++; in rtsn_start_xmit()
1103 spin_unlock_irqrestore(&priv->lock, flags); in rtsn_start_xmit()
1111 *storage = priv->stats; in rtsn_get_stats64()
1117 return -ENODEV; in rtsn_do_ioctl()
1129 return -ENODEV; in rtsn_hwtstamp_get()
1132 ptp_priv = priv->ptp_priv; in rtsn_hwtstamp_get()
1134 config->flags = 0; in rtsn_hwtstamp_get()
1136 config->tx_type = in rtsn_hwtstamp_get()
1137 ptp_priv->tstamp_tx_ctrl ? HWTSTAMP_TX_ON : HWTSTAMP_TX_OFF; in rtsn_hwtstamp_get()
1139 switch (ptp_priv->tstamp_rx_ctrl & RCAR_GEN4_RXTSTAMP_TYPE) { in rtsn_hwtstamp_get()
1141 config->rx_filter = HWTSTAMP_FILTER_PTP_V2_L2_EVENT; in rtsn_hwtstamp_get()
1144 config->rx_filter = HWTSTAMP_FILTER_ALL; in rtsn_hwtstamp_get()
1147 config->rx_filter = HWTSTAMP_FILTER_NONE; in rtsn_hwtstamp_get()
1164 return -ENODEV; in rtsn_hwtstamp_set()
1167 ptp_priv = priv->ptp_priv; in rtsn_hwtstamp_set()
1169 if (config->flags) in rtsn_hwtstamp_set()
1170 return -EINVAL; in rtsn_hwtstamp_set()
1172 switch (config->tx_type) { in rtsn_hwtstamp_set()
1180 return -ERANGE; in rtsn_hwtstamp_set()
1183 switch (config->rx_filter) { in rtsn_hwtstamp_set()
1192 config->rx_filter = HWTSTAMP_FILTER_ALL; in rtsn_hwtstamp_set()
1198 ptp_priv->tstamp_tx_ctrl = tstamp_tx_ctrl; in rtsn_hwtstamp_set()
1199 ptp_priv->tstamp_rx_ctrl = tstamp_rx_ctrl; in rtsn_hwtstamp_set()
1221 info->phc_index = ptp_clock_index(priv->ptp_priv->clock); in rtsn_get_ts_info()
1222 info->so_timestamping = SOF_TIMESTAMPING_TX_SOFTWARE | in rtsn_get_ts_info()
1226 info->tx_types = BIT(HWTSTAMP_TX_OFF) | BIT(HWTSTAMP_TX_ON); in rtsn_get_ts_info()
1227 info->rx_filters = BIT(HWTSTAMP_FILTER_NONE) | BIT(HWTSTAMP_FILTER_ALL); in rtsn_get_ts_info()
1241 { .compatible = "renesas,r8a779g0-ethertsn", },
1257 return -ENOMEM; in rtsn_probe()
1260 priv->pdev = pdev; in rtsn_probe()
1261 priv->ndev = ndev; in rtsn_probe()
1262 priv->ptp_priv = rcar_gen4_ptp_alloc(pdev); in rtsn_probe()
1264 spin_lock_init(&priv->lock); in rtsn_probe()
1267 priv->clk = devm_clk_get(&pdev->dev, NULL); in rtsn_probe()
1268 if (IS_ERR(priv->clk)) { in rtsn_probe()
1269 ret = PTR_ERR(priv->clk); in rtsn_probe()
1273 priv->reset = devm_reset_control_get(&pdev->dev, NULL); in rtsn_probe()
1274 if (IS_ERR(priv->reset)) { in rtsn_probe()
1275 ret = PTR_ERR(priv->reset); in rtsn_probe()
1281 dev_err(&pdev->dev, "Can't find tsnes resource\n"); in rtsn_probe()
1282 ret = -EINVAL; in rtsn_probe()
1286 priv->base = devm_ioremap_resource(&pdev->dev, res); in rtsn_probe()
1287 if (IS_ERR(priv->base)) { in rtsn_probe()
1288 ret = PTR_ERR(priv->base); in rtsn_probe()
1292 SET_NETDEV_DEV(ndev, &pdev->dev); in rtsn_probe()
1294 ndev->features = NETIF_F_RXCSUM; in rtsn_probe()
1295 ndev->hw_features = NETIF_F_RXCSUM; in rtsn_probe()
1296 ndev->base_addr = res->start; in rtsn_probe()
1297 ndev->netdev_ops = &rtsn_netdev_ops; in rtsn_probe()
1298 ndev->ethtool_ops = &rtsn_ethtool_ops; in rtsn_probe()
1302 dev_err(&pdev->dev, "Can't find gptp resource\n"); in rtsn_probe()
1303 ret = -EINVAL; in rtsn_probe()
1307 priv->ptp_priv->addr = devm_ioremap_resource(&pdev->dev, res); in rtsn_probe()
1308 if (IS_ERR(priv->ptp_priv->addr)) { in rtsn_probe()
1309 ret = PTR_ERR(priv->ptp_priv->addr); in rtsn_probe()
1317 pm_runtime_enable(&pdev->dev); in rtsn_probe()
1318 pm_runtime_get_sync(&pdev->dev); in rtsn_probe()
1320 netif_napi_add(ndev, &priv->napi, rtsn_poll); in rtsn_probe()
1322 rtsn_parse_mac_address(pdev->dev.of_node, ndev); in rtsn_probe()
1324 dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); in rtsn_probe()
1326 device_set_wakeup_capable(&pdev->dev, 1); in rtsn_probe()
1328 ret = rcar_gen4_ptp_register(priv->ptp_priv, RCAR_GEN4_PTP_REG_LAYOUT, in rtsn_probe()
1329 clk_get_rate(priv->clk)); in rtsn_probe()
1341 netdev_info(ndev, "MAC address %pM\n", ndev->dev_addr); in rtsn_probe()
1348 rcar_gen4_ptp_unregister(priv->ptp_priv); in rtsn_probe()
1350 netif_napi_del(&priv->napi); in rtsn_probe()
1352 pm_runtime_put_sync(&pdev->dev); in rtsn_probe()
1353 pm_runtime_disable(&pdev->dev); in rtsn_probe()
1364 unregister_netdev(priv->ndev); in rtsn_remove()
1366 rcar_gen4_ptp_unregister(priv->ptp_priv); in rtsn_remove()
1368 netif_napi_del(&priv->napi); in rtsn_remove()
1370 pm_runtime_put_sync(&pdev->dev); in rtsn_remove()
1371 pm_runtime_disable(&pdev->dev); in rtsn_remove()
1373 free_netdev(priv->ndev); in rtsn_remove()
1387 MODULE_DESCRIPTION("Renesas Ethernet-TSN device driver");