#define ENETC_CBDR_TIMEOUT 1000 /* usecs */
-/* PTP driver exports */
-extern int enetc_phc_index;
-
/* SI common */
u32 enetc_port_mac_rd(struct enetc_si *si, u32 reg);
void enetc_port_mac_wr(struct enetc_si *si, u32 reg, u32 val);
return 0;
}
-static int enetc4_get_phc_index_by_pdev(struct enetc_si *si)
+static int enetc_get_phc_index_by_pdev(struct enetc_si *si)
{
struct pci_bus *bus = si->pdev->bus;
struct pci_dev *timer_pdev;
int phc_index;
switch (si->revision) {
+ case ENETC_REV_1_0:
+ devfn = PCI_DEVFN(0, 4);
+ break;
case ENETC_REV_4_1:
devfn = PCI_DEVFN(24, 0);
break;
return phc_index;
}
-static int enetc4_get_phc_index(struct enetc_si *si)
+static int enetc_get_phc_index(struct enetc_si *si)
{
struct device_node *np = si->pdev->dev.of_node;
struct device_node *timer_np;
int phc_index;
if (!np)
- return enetc4_get_phc_index_by_pdev(si);
+ return enetc_get_phc_index_by_pdev(si);
timer_np = of_parse_phandle(np, "ptp-timer", 0);
if (!timer_np)
- return enetc4_get_phc_index_by_pdev(si);
+ return enetc_get_phc_index_by_pdev(si);
phc_index = ptp_clock_index_by_of_node(timer_np);
of_node_put(timer_np);
{
struct enetc_ndev_priv *priv = netdev_priv(ndev);
struct enetc_si *si = priv->si;
- int *phc_idx;
if (!enetc_ptp_clock_is_enabled(si))
goto timestamp_tx_sw;
- if (is_enetc_rev1(si)) {
- phc_idx = symbol_get(enetc_phc_index);
- if (phc_idx) {
- info->phc_index = *phc_idx;
- symbol_put(enetc_phc_index);
- }
- } else {
- info->phc_index = enetc4_get_phc_index(si);
- if (info->phc_index < 0)
- goto timestamp_tx_sw;
- }
+ info->phc_index = enetc_get_phc_index(si);
+ if (info->phc_index < 0)
+ goto timestamp_tx_sw;
enetc_get_ts_generic_info(ndev, info);
#include "enetc.h"
-int enetc_phc_index = -1;
-EXPORT_SYMBOL_GPL(enetc_phc_index);
-
static struct ptp_clock_info enetc_ptp_caps = {
.owner = THIS_MODULE,
.name = "ENETC PTP clock",
if (err)
goto err_no_clock;
- enetc_phc_index = ptp_qoriq->phc_index;
pci_set_drvdata(pdev, ptp_qoriq);
return 0;
{
struct ptp_qoriq *ptp_qoriq = pci_get_drvdata(pdev);
- enetc_phc_index = -1;
ptp_qoriq_free(ptp_qoriq);
pci_free_irq_vectors(pdev);
kfree(ptp_qoriq);