aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/generic/files/drivers
diff options
context:
space:
mode:
authorChuanhong Guo <gch981213@gmail.com>2019-01-10 13:05:00 +0800
committerPetr Štetiar <ynezz@true.cz>2019-03-24 01:44:25 +0100
commit15323c4ef8cce5c127c250d93f7ea09a33cb9dd6 (patch)
tree4704e65f776bd6bedbcc1c28781bb8c926f2d772 /target/linux/generic/files/drivers
parent3771176c9ef9b5d231e9019bc0c872dbe3617209 (diff)
downloadupstream-15323c4ef8cce5c127c250d93f7ea09a33cb9dd6.tar.gz
upstream-15323c4ef8cce5c127c250d93f7ea09a33cb9dd6.tar.bz2
upstream-15323c4ef8cce5c127c250d93f7ea09a33cb9dd6.zip
generic: ar8216: move chip id reading into a separate function
for mdio-device probing we still need to read chip id but ar8xxx_chip can be determined using drvdata. We can't distinguish the buggy standalone ar8216 and the builtin ar8216 in ar724x/ar933x using chip id. Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
Diffstat (limited to 'target/linux/generic/files/drivers')
-rw-r--r--target/linux/generic/files/drivers/net/phy/ar8216.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/target/linux/generic/files/drivers/net/phy/ar8216.c b/target/linux/generic/files/drivers/net/phy/ar8216.c
index 2f0be1b8da..2c111c2b81 100644
--- a/target/linux/generic/files/drivers/net/phy/ar8216.c
+++ b/target/linux/generic/files/drivers/net/phy/ar8216.c
@@ -1813,7 +1813,7 @@ static const struct ar8xxx_chip ar8316_chip = {
};
static int
-ar8xxx_id_chip(struct ar8xxx_priv *priv)
+ar8xxx_read_id(struct ar8xxx_priv *priv)
{
u32 val;
u16 id;
@@ -1838,6 +1838,17 @@ ar8xxx_id_chip(struct ar8xxx_priv *priv)
priv->chip_ver = (id & AR8216_CTRL_VERSION) >> AR8216_CTRL_VERSION_S;
priv->chip_rev = (id & AR8216_CTRL_REVISION);
+ return 0;
+}
+
+static int
+ar8xxx_id_chip(struct ar8xxx_priv *priv)
+{
+ int ret;
+
+ ret = ar8xxx_read_id(priv);
+ if(ret)
+ return ret;
switch (priv->chip_ver) {
case AR8XXX_VER_AR8216: