Skip to content

Commit 2c59e99

Browse files
shimodaydavem330
authored andcommitted
net: renesas: rswitch: Fix GWTSDIE register handling
Since the GWCA has the TX timestamp feature, this driver should not disable it if one of ports is opened. So, fix it. Reported-by: Phong Hoang <[email protected]> Fixes: 33f5d73 ("net: renesas: rswitch: Improve TX timestamp accuracy") Signed-off-by: Yoshihiro Shimoda <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent e05bb97 commit 2c59e99

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

drivers/net/ethernet/renesas/rswitch.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1441,7 +1441,10 @@ static int rswitch_open(struct net_device *ndev)
14411441
rswitch_enadis_data_irq(rdev->priv, rdev->tx_queue->index, true);
14421442
rswitch_enadis_data_irq(rdev->priv, rdev->rx_queue->index, true);
14431443

1444-
iowrite32(GWCA_TS_IRQ_BIT, rdev->priv->addr + GWTSDIE);
1444+
if (bitmap_empty(rdev->priv->opened_ports, RSWITCH_NUM_PORTS))
1445+
iowrite32(GWCA_TS_IRQ_BIT, rdev->priv->addr + GWTSDIE);
1446+
1447+
bitmap_set(rdev->priv->opened_ports, rdev->port, 1);
14451448

14461449
return 0;
14471450
};
@@ -1452,8 +1455,10 @@ static int rswitch_stop(struct net_device *ndev)
14521455
struct rswitch_gwca_ts_info *ts_info, *ts_info2;
14531456

14541457
netif_tx_stop_all_queues(ndev);
1458+
bitmap_clear(rdev->priv->opened_ports, rdev->port, 1);
14551459

1456-
iowrite32(GWCA_TS_IRQ_BIT, rdev->priv->addr + GWTSDID);
1460+
if (bitmap_empty(rdev->priv->opened_ports, RSWITCH_NUM_PORTS))
1461+
iowrite32(GWCA_TS_IRQ_BIT, rdev->priv->addr + GWTSDID);
14571462

14581463
list_for_each_entry_safe(ts_info, ts_info2, &rdev->priv->gwca.ts_info_list, list) {
14591464
if (ts_info->port != rdev->port)

drivers/net/ethernet/renesas/rswitch.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -998,6 +998,7 @@ struct rswitch_private {
998998
struct rcar_gen4_ptp_private *ptp_priv;
999999

10001000
struct rswitch_device *rdev[RSWITCH_NUM_PORTS];
1001+
DECLARE_BITMAP(opened_ports, RSWITCH_NUM_PORTS);
10011002

10021003
struct rswitch_gwca gwca;
10031004
struct rswitch_etha etha[RSWITCH_NUM_PORTS];

0 commit comments

Comments
 (0)