generic: rtl8366: add setup to rtl8366_smi_ops struct
authorGabor Juhos <juhosg@openwrt.org>
Thu, 15 Jul 2010 13:05:21 +0000 (13:05 +0000)
committerGabor Juhos <juhosg@openwrt.org>
Thu, 15 Jul 2010 13:05:21 +0000 (13:05 +0000)
SVN-Revision: 22196

target/linux/generic/files/drivers/net/phy/rtl8366_smi.c
target/linux/generic/files/drivers/net/phy/rtl8366_smi.h
target/linux/generic/files/drivers/net/phy/rtl8366rb.c
target/linux/generic/files/drivers/net/phy/rtl8366s.c

index ac8862ced6fc1d27894669b2b01f2d1fac06c032..c7e03901db06b91835f0c94c6a38cdc10617b089 100644 (file)
@@ -790,6 +790,12 @@ int rtl8366_smi_init(struct rtl8366_smi *smi)
                goto err_free_sck;
        }
 
+       err = smi->ops->setup(smi);
+       if (err) {
+               dev_err(smi->parent, "chip setup failed, err=%d\n", err);
+               goto err_free_sck;
+       }
+
        err = rtl8366_smi_mii_init(smi);
        if (err)
                goto err_free_sck;
index 775f95935e124211437fb825fa3d47cef54c7191..86517c97ce7f645821ff1ba84048334dcbf3548b 100644 (file)
@@ -69,6 +69,7 @@ struct rtl8366_vlan_4k {
 
 struct rtl8366_smi_ops {
        int     (*detect)(struct rtl8366_smi *smi);
+       int     (*setup)(struct rtl8366_smi *smi);
 
        int     (*mii_read)(struct mii_bus *bus, int addr, int reg);
        int     (*mii_write)(struct mii_bus *bus, int addr, int reg, u16 val);
index aa0b4a0b71d8bcc430b643b1505f8d25cab69de0..984f3861f7a46cf52aba7978b51a8dc99d19e685 100644 (file)
@@ -1103,6 +1103,8 @@ static int rtl8366rb_detect(struct rtl8366_smi *smi)
 
 static struct rtl8366_smi_ops rtl8366rb_smi_ops = {
        .detect         = rtl8366rb_detect,
+       .setup          = rtl8366rb_setup,
+
        .mii_read       = rtl8366rb_mii_read,
        .mii_write      = rtl8366rb_mii_write,
 
@@ -1154,10 +1156,6 @@ static int __init rtl8366rb_probe(struct platform_device *pdev)
 
        platform_set_drvdata(pdev, smi);
 
-       err = rtl8366rb_setup(smi);
-       if (err)
-               goto err_clear_drvdata;
-
        err = rtl8366rb_switch_init(smi);
        if (err)
                goto err_clear_drvdata;
index 6f3fdd5092e3454acc8b8a716acb6e8e0a631466..34fd188595f6ee370aa385120128b70f2755286f 100644 (file)
@@ -1130,6 +1130,8 @@ static int rtl8366s_detect(struct rtl8366_smi *smi)
 
 static struct rtl8366_smi_ops rtl8366s_smi_ops = {
        .detect         = rtl8366s_detect,
+       .setup          = rtl8366s_setup,
+
        .mii_read       = rtl8366s_mii_read,
        .mii_write      = rtl8366s_mii_write,
 
@@ -1181,10 +1183,6 @@ static int __init rtl8366s_probe(struct platform_device *pdev)
 
        platform_set_drvdata(pdev, smi);
 
-       err = rtl8366s_setup(smi);
-       if (err)
-               goto err_clear_drvdata;
-
        err = rtl8366s_switch_init(smi);
        if (err)
                goto err_clear_drvdata;