+ priv->chip = UNKNOWN;
+
val = ar8216_mii_read(priv, AR8216_REG_CTRL);
if (val == ~0)
val = ar8216_mii_read(priv, AR8216_REG_CTRL);
if (val == ~0)
id = val & (AR8216_CTRL_REVISION | AR8216_CTRL_VERSION);
for (i = 0; i < AR8X16_PROBE_RETRIES; i++) {
id = val & (AR8216_CTRL_REVISION | AR8216_CTRL_VERSION);
for (i = 0; i < AR8X16_PROBE_RETRIES; i++) {
val = ar8216_mii_read(priv, AR8216_REG_CTRL);
if (val == ~0)
val = ar8216_mii_read(priv, AR8216_REG_CTRL);
if (val == ~0)
t = val & (AR8216_CTRL_REVISION | AR8216_CTRL_VERSION);
if (t != id)
t = val & (AR8216_CTRL_REVISION | AR8216_CTRL_VERSION);
if (t != id)
}
switch (id) {
case 0x0101:
}
switch (id) {
case 0x0101:
+ priv->chip = AR8216;
+ break;
+ priv->chip = AR8236;
+ break;
case 0x1000:
case 0x1001:
case 0x1000:
case 0x1001:
+ priv->chip = AR8316;
+ break;
default:
printk(KERN_DEBUG
"ar8216: Unknown Atheros device [ver=%d, rev=%d, phy_id=%04x%04x]\n",
default:
printk(KERN_DEBUG
"ar8216: Unknown Atheros device [ver=%d, rev=%d, phy_id=%04x%04x]\n",
mdiobus_read(priv->phy->bus, priv->phy->addr, 2),
mdiobus_read(priv->phy->bus, priv->phy->addr, 3));
mdiobus_read(priv->phy->bus, priv->phy->addr, 2),
mdiobus_read(priv->phy->bus, priv->phy->addr, 3));
- priv->chip = ar8216_id_chip(priv);
+ ret = ar8216_id_chip(priv);
+ if (ret)
+ goto err_free_priv;
if (pdev->addr != 0) {
if (priv->chip == AR8316) {
if (pdev->addr != 0) {
if (priv->chip == AR8316) {
ar8216_probe(struct phy_device *pdev)
{
struct ar8216_priv priv;
ar8216_probe(struct phy_device *pdev)
{
struct ar8216_priv priv;
- chip = ar8216_id_chip(&priv);
- if (chip == UNKNOWN)
- return -ENODEV;
-
- return 0;
+ return ar8216_id_chip(&priv);