28
28
#include <linux/of_irq.h>
29
29
#include <linux/of_mdio.h>
30
30
#include <linux/of_net.h>
31
- #include <linux/platform_device.h>
32
31
#include <linux/pm_runtime.h>
33
32
#include <linux/slab.h>
34
33
#include <linux/spinlock.h>
41
40
NETIF_MSG_RX_ERR | \
42
41
NETIF_MSG_TX_ERR)
43
42
44
- static int ravb_wait (struct net_device * ndev , enum ravb_reg reg , u32 mask ,
45
- u32 value )
43
+ int ravb_wait (struct net_device * ndev , enum ravb_reg reg , u32 mask , u32 value )
46
44
{
47
45
int i ;
48
46
@@ -763,6 +761,9 @@ static irqreturn_t ravb_interrupt(int irq, void *dev_id)
763
761
result = IRQ_HANDLED ;
764
762
}
765
763
764
+ if (iss & ISS_CGIS )
765
+ result = ravb_ptp_interrupt (ndev );
766
+
766
767
mmiowb ();
767
768
spin_unlock (& priv -> lock );
768
769
return result ;
@@ -1103,6 +1104,8 @@ static int ravb_set_ringparam(struct net_device *ndev,
1103
1104
1104
1105
if (netif_running (ndev )) {
1105
1106
netif_device_detach (ndev );
1107
+ /* Stop PTP Clock driver */
1108
+ ravb_ptp_stop (ndev );
1106
1109
/* Wait for DMA stopping */
1107
1110
error = ravb_stop_dma (ndev );
1108
1111
if (error ) {
@@ -1132,6 +1135,9 @@ static int ravb_set_ringparam(struct net_device *ndev,
1132
1135
1133
1136
ravb_emac_init (ndev );
1134
1137
1138
+ /* Initialise PTP Clock driver */
1139
+ ravb_ptp_init (ndev , priv -> pdev );
1140
+
1135
1141
netif_device_attach (ndev );
1136
1142
}
1137
1143
@@ -1141,6 +1147,8 @@ static int ravb_set_ringparam(struct net_device *ndev,
1141
1147
static int ravb_get_ts_info (struct net_device * ndev ,
1142
1148
struct ethtool_ts_info * info )
1143
1149
{
1150
+ struct ravb_private * priv = netdev_priv (ndev );
1151
+
1144
1152
info -> so_timestamping =
1145
1153
SOF_TIMESTAMPING_TX_SOFTWARE |
1146
1154
SOF_TIMESTAMPING_RX_SOFTWARE |
@@ -1153,7 +1161,7 @@ static int ravb_get_ts_info(struct net_device *ndev,
1153
1161
(1 << HWTSTAMP_FILTER_NONE ) |
1154
1162
(1 << HWTSTAMP_FILTER_PTP_V2_L2_EVENT ) |
1155
1163
(1 << HWTSTAMP_FILTER_ALL );
1156
- info -> phc_index = -1 ;
1164
+ info -> phc_index = ptp_clock_index ( priv -> ptp . clock ) ;
1157
1165
1158
1166
return 0 ;
1159
1167
}
@@ -1195,15 +1203,21 @@ static int ravb_open(struct net_device *ndev)
1195
1203
goto out_free_irq ;
1196
1204
ravb_emac_init (ndev );
1197
1205
1206
+ /* Initialise PTP Clock driver */
1207
+ ravb_ptp_init (ndev , priv -> pdev );
1208
+
1198
1209
netif_tx_start_all_queues (ndev );
1199
1210
1200
1211
/* PHY control start */
1201
1212
error = ravb_phy_start (ndev );
1202
1213
if (error )
1203
- goto out_free_irq ;
1214
+ goto out_ptp_stop ;
1204
1215
1205
1216
return 0 ;
1206
1217
1218
+ out_ptp_stop :
1219
+ /* Stop PTP Clock driver */
1220
+ ravb_ptp_stop (ndev );
1207
1221
out_free_irq :
1208
1222
free_irq (ndev -> irq , ndev );
1209
1223
out_napi_off :
@@ -1235,6 +1249,9 @@ static void ravb_tx_timeout_work(struct work_struct *work)
1235
1249
1236
1250
netif_tx_stop_all_queues (ndev );
1237
1251
1252
+ /* Stop PTP Clock driver */
1253
+ ravb_ptp_stop (ndev );
1254
+
1238
1255
/* Wait for DMA stopping */
1239
1256
ravb_stop_dma (ndev );
1240
1257
@@ -1245,6 +1262,9 @@ static void ravb_tx_timeout_work(struct work_struct *work)
1245
1262
ravb_dmac_init (ndev );
1246
1263
ravb_emac_init (ndev );
1247
1264
1265
+ /* Initialise PTP Clock driver */
1266
+ ravb_ptp_init (ndev , priv -> pdev );
1267
+
1248
1268
netif_tx_start_all_queues (ndev );
1249
1269
}
1250
1270
@@ -1409,6 +1429,9 @@ static int ravb_close(struct net_device *ndev)
1409
1429
ravb_write (ndev , 0 , RIC2 );
1410
1430
ravb_write (ndev , 0 , TIC );
1411
1431
1432
+ /* Stop PTP Clock driver */
1433
+ ravb_ptp_stop (ndev );
1434
+
1412
1435
/* Set the config mode to stop the AVB-DMAC's processes */
1413
1436
if (ravb_stop_dma (ndev ) < 0 )
1414
1437
netdev_err (ndev ,
0 commit comments