net: rk29_vmac: support rk30
author黄涛 <huangtao@rock-chips.com>
Mon, 7 May 2012 12:15:24 +0000 (20:15 +0800)
committer黄涛 <huangtao@rock-chips.com>
Mon, 7 May 2012 12:24:16 +0000 (20:24 +0800)
drivers/net/rk29_vmac.c
drivers/net/rk29_vmac.h

index 7cf2285c70ce5f8150bf27aac7cdff46695b93c9..95e79e45e27461277641ea23b67f868fd090ef24 100755 (executable)
@@ -1044,8 +1044,16 @@ int vmac_open(struct net_device *dev)
                \r
        //set rmii ref clock 50MHz\r
        mac_clk = clk_get(NULL, "mac_ref_div");\r
+       if (IS_ERR(mac_clk))\r
+               mac_clk = NULL;\r
        arm_clk = clk_get(NULL, "arm_pll");\r
-       mac_parent = clk_get_parent(mac_clk);\r
+       if (IS_ERR(arm_clk))\r
+               arm_clk = NULL;\r
+       if (mac_clk) {\r
+               mac_parent = clk_get_parent(mac_clk);\r
+               if (IS_ERR(mac_parent))\r
+                       mac_parent = NULL;\r
+       }\r
        if (arm_clk && mac_parent && (arm_clk == mac_parent))\r
                wake_lock(&idlelock);\r
        \r
@@ -1184,8 +1192,16 @@ int vmac_close(struct net_device *dev)
 \r
        //clock close\r
        mac_clk = clk_get(NULL, "mac_ref_div");\r
-       mac_parent = clk_get_parent(mac_clk);   \r
+       if (IS_ERR(mac_clk))\r
+               mac_clk = NULL;\r
+       if (mac_clk) {\r
+               mac_parent = clk_get_parent(mac_clk);\r
+               if (IS_ERR(mac_parent))\r
+                       mac_parent = NULL;\r
+       }\r
        arm_clk = clk_get(NULL, "arm_pll");\r
+       if (IS_ERR(arm_clk))\r
+               arm_clk = NULL;\r
 \r
        if (arm_clk && mac_parent && (arm_clk == mac_parent))\r
                wake_unlock(&idlelock);\r
index a1f67c07fb37f8b4e3791df1b69392e0af2f5735..25692a0dee8bc980f2330a8e307d4cc2ba291ee4 100755 (executable)
 #define VMAC_VERSION           "1.0"\r
 \r
 /* Buffer descriptors */\r
+#ifdef CONFIG_ARCH_RK29\r
 #define TX_BDT_LEN             16    /* Number of receive BD's */\r
+#else\r
+#define TX_BDT_LEN             255   /* Number of receive BD's */\r
+#endif\r
 #define RX_BDT_LEN             255   /* Number of transmit BD's */\r
 \r
 /* BD poll rate, in 1024 cycles. @100Mhz: x * 1024 cy * 10ns = 1ms */\r