aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
diff options
context:
space:
mode:
authorGiuseppe CAVALLARO <peppe.cavallaro@st.com>2011-09-01 21:51:40 +0000
committerDavid S. Miller <davem@davemloft.net>2011-09-15 15:40:01 -0400
commitf0b9d7865a95fdcb18319a678c616156be74cdfb (patch)
treeabd9c2d3314ebbed1c5a57489e42b70cfebed013 /drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
parentstmmac: export DMA TX/RX rings via debugfs (v3) (diff)
downloadlinux-dev-f0b9d7865a95fdcb18319a678c616156be74cdfb.tar.xz
linux-dev-f0b9d7865a95fdcb18319a678c616156be74cdfb.zip
stmmac: rework the code to get the Synopsys ID (v3)
The Synopsys ID is now passed from the MAC core to the main. This info will be used for managing the HW cap register (supported in the new GMAC generations). Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to '')
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_main.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index caaad7b14621..eb210ca2497b 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -763,6 +763,23 @@ static void stmmac_mmc_setup(struct stmmac_priv *priv)
memset(&priv->mmc, 0, sizeof(struct stmmac_counters));
}
+static u32 stmmac_get_synopsys_id(struct stmmac_priv *priv)
+{
+ u32 hwid = priv->hw->synopsys_uid;
+
+ /* Only check valid Synopsys Id because old MAC chips
+ * have no HW registers where get the ID */
+ if (likely(hwid)) {
+ u32 uid = ((hwid & 0x0000ff00) >> 8);
+ u32 synid = (hwid & 0x000000ff);
+
+ pr_info("STMMAC - user ID: 0x%x, Synopsys ID: 0x%x\n",
+ uid, synid);
+
+ return synid;
+ }
+ return 0;
+}
/**
* stmmac_open - open entry point of the driver
* @dev : pointer to the device structure.
@@ -835,7 +852,8 @@ static int stmmac_open(struct net_device *dev)
/* Initialize the MAC Core */
priv->hw->mac->core_init(priv->ioaddr);
- priv->rx_coe = priv->hw->mac->rx_coe(priv->ioaddr);
+ stmmac_get_synopsys_id(priv);
+
if (priv->rx_coe)
pr_info("stmmac: Rx Checksum Offload Engine supported\n");
if (priv->plat->tx_coe)