@@ -1342,6 +1342,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
13421342 .supports_rgmii = {false, false, true},
13431343 .internal_phy = {true, true, false},
13441344 .gbit_capable = {false, false, true},
1345+ .ptp_capable = true,
13451346 .wr_table = & ksz8563_register_set ,
13461347 .rd_table = & ksz8563_register_set ,
13471348 },
@@ -1553,6 +1554,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
15531554 .internal_phy = {true, true, true, true,
15541555 true, false, false},
15551556 .gbit_capable = {true, true, true, true, true, true, true},
1557+ .ptp_capable = true,
15561558 .wr_table = & ksz9477_register_set ,
15571559 .rd_table = & ksz9477_register_set ,
15581560 },
@@ -1680,6 +1682,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
16801682 .supports_rgmii = {false, false, true},
16811683 .internal_phy = {true, true, false},
16821684 .gbit_capable = {true, true, true},
1685+ .ptp_capable = true,
16831686 },
16841687
16851688 [KSZ8567 ] = {
@@ -1715,6 +1718,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
17151718 true, false, false},
17161719 .gbit_capable = {false, false, false, false, false,
17171720 true, true},
1721+ .ptp_capable = true,
17181722 },
17191723
17201724 [KSZ9567 ] = {
@@ -1747,6 +1751,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
17471751 .internal_phy = {true, true, true, true,
17481752 true, false, false},
17491753 .gbit_capable = {true, true, true, true, true, true, true},
1754+ .ptp_capable = true,
17501755 },
17511756
17521757 [LAN9370 ] = {
@@ -1775,6 +1780,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
17751780 .supports_rmii = {false, false, false, false, true},
17761781 .supports_rgmii = {false, false, false, false, true},
17771782 .internal_phy = {true, true, true, true, false},
1783+ .ptp_capable = true,
17781784 },
17791785
17801786 [LAN9371 ] = {
@@ -1803,6 +1809,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
18031809 .supports_rmii = {false, false, false, false, true, true},
18041810 .supports_rgmii = {false, false, false, false, true, true},
18051811 .internal_phy = {true, true, true, true, false, false},
1812+ .ptp_capable = true,
18061813 },
18071814
18081815 [LAN9372 ] = {
@@ -1835,6 +1842,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
18351842 true, true, false, false},
18361843 .internal_phy = {true, true, true, true,
18371844 false, false, true, true},
1845+ .ptp_capable = true,
18381846 },
18391847
18401848 [LAN9373 ] = {
@@ -1867,6 +1875,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
18671875 true, true, false, false},
18681876 .internal_phy = {true, true, true, false,
18691877 false, false, true, true},
1878+ .ptp_capable = true,
18701879 },
18711880
18721881 [LAN9374 ] = {
@@ -1899,6 +1908,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
18991908 true, true, false, false},
19001909 .internal_phy = {true, true, true, true,
19011910 false, false, true, true},
1911+ .ptp_capable = true,
19021912 },
19031913};
19041914EXPORT_SYMBOL_GPL (ksz_switch_chips );
@@ -2556,16 +2566,21 @@ static int ksz_setup(struct dsa_switch *ds)
25562566 if (ret )
25572567 goto out_girq ;
25582568
2559- ret = ksz_ptp_irq_setup (ds , dp -> index );
2560- if (ret )
2561- goto out_pirq ;
2569+ if (dev -> info -> ptp_capable ) {
2570+ ret = ksz_ptp_irq_setup (ds , dp -> index );
2571+ if (ret )
2572+ goto out_pirq ;
2573+ }
25622574 }
25632575 }
25642576
2565- ret = ksz_ptp_clock_register (ds );
2566- if (ret ) {
2567- dev_err (dev -> dev , "Failed to register PTP clock: %d\n" , ret );
2568- goto out_ptpirq ;
2577+ if (dev -> info -> ptp_capable ) {
2578+ ret = ksz_ptp_clock_register (ds );
2579+ if (ret ) {
2580+ dev_err (dev -> dev , "Failed to register PTP clock: %d\n" ,
2581+ ret );
2582+ goto out_ptpirq ;
2583+ }
25692584 }
25702585
25712586 ret = ksz_mdio_register (dev );
@@ -2585,9 +2600,10 @@ static int ksz_setup(struct dsa_switch *ds)
25852600 return 0 ;
25862601
25872602out_ptp_clock_unregister :
2588- ksz_ptp_clock_unregister (ds );
2603+ if (dev -> info -> ptp_capable )
2604+ ksz_ptp_clock_unregister (ds );
25892605out_ptpirq :
2590- if (dev -> irq > 0 )
2606+ if (dev -> irq > 0 && dev -> info -> ptp_capable )
25912607 dsa_switch_for_each_user_port (dp , dev -> ds )
25922608 ksz_ptp_irq_free (ds , dp -> index );
25932609out_pirq :
@@ -2606,11 +2622,13 @@ static void ksz_teardown(struct dsa_switch *ds)
26062622 struct ksz_device * dev = ds -> priv ;
26072623 struct dsa_port * dp ;
26082624
2609- ksz_ptp_clock_unregister (ds );
2625+ if (dev -> info -> ptp_capable )
2626+ ksz_ptp_clock_unregister (ds );
26102627
26112628 if (dev -> irq > 0 ) {
26122629 dsa_switch_for_each_user_port (dp , dev -> ds ) {
2613- ksz_ptp_irq_free (ds , dp -> index );
2630+ if (dev -> info -> ptp_capable )
2631+ ksz_ptp_irq_free (ds , dp -> index );
26142632
26152633 ksz_irq_free (& dev -> ports [dp -> index ].pirq );
26162634 }
0 commit comments