本文主要是介绍华为网卡支持linux,在openwrt下对华为WA633无线AP的千兆网卡驱动进行支持,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
1.下面是这款AP的全裸图,AP的无线网卡采用了AR9223,PHY采用了博通的BCM5461,主控CPU位octeon+ 500,射频功放采用的是RF5602方案。由于这款CPU并不常见,我至今未在网上找到它的datasheet,导致我们在玩这款AP的过程中遇到了很多困难。
2.Openwrt源码采用的最新的,B...b,内核是Linux-3.10.49
3.在内核里我们可以看到有支持BCM5461的驱动,但是我们选上了之后并不能直接用,因为这块板子上的PHY与CPU间通过MIDO和RGMI两种总线方式(可能描述有误,记不清了)进行数据交互。但是主控芯片上有多个同意的接口供外设使用,但是这块板子上只用了一个,我们必须去确定用的是那个口,然后在内核加载过程中做相应处理。
4.修改内核源码,创建一个新的patch,将所有的改动保存在patch中。
Index: linux-3.10.49/arch/mips/cavium-octeon/executive/cvmx-helper-board.c
===================================================================
--- linux-3.10.49.orig/arch/mips/cavium-octeon/executive/cvmx-helper-board.c2015-11-18 01:28:11.483050038 +0800
+++ linux-3.10.49/arch/mips/cavium-octeon/executive/cvmx-helper-board.c2015-11-18 01:28:11.559050042 +0800
@@ -93,13 +93,8 @@
case CVMX_BOARD_TYPE_CN3010_EVB_HS5:
case CVMX_BOARD_TYPE_CN3005_EVB_HS5:
case CVMX_BOARD_TYPE_CN3020_EVB_HS5:
-/*
- * Port 0 is WAN connected to a PHY, Port 1 is GMII
- * connected to a switch
- */
+/* Port 0 is WAN connected to a PHY:BCM5461(For WA633) */
if (ipd_port == 0)
-return 4;
-else if (ipd_port == 1)
return 9;
else
return -1;
@@ -244,11 +239,8 @@
case CVMX_BOARD_TYPE_CN3005_EVB_HS5:
case CVMX_BOARD_TYPE_CN3020_EVB_HS5:
/* Port 1 on these boards is always Gigabit */
-if (ipd_port == 1) {
-result.s.link_up = 1;
-result.s.full_duplex = 1;
-result.s.speed = 1000;
-return result;
+if (ipd_port == 0) {
+is_broadcom_phy = 1;
}
/* Fall through to the generic code below */
break;
Index: linux-3.10.49/arch/mips/cavium-octeon/executive/cvmx-helper-rgmii.c
===================================================================
--- linux-3.10.49.orig/arch/mips/cavium-octeon/executive/cvmx-helper-rgmii.c2014-07-18 06:58:15.000000000 +0800
+++ linux-3.10.49/arch/mips/cavium-octeon/executive/cvmx-helper-rgmii.c2015-11-18 01:28:11.559050042 +0800
@@ -72,7 +72,7 @@
* On these chips "type" says we're in
* GMII/MII mode. This limits us to 2 ports
*/
-num_ports = 2;
+num_ports = 1;
} else {
cvmx_dprintf("ERROR: Unsupported Octeon model in %s\n",
__func__);
@@ -84,7 +84,7 @@
} else if (OCTEON_IS_MODEL(OCTEON_CN31XX)
|| OCTEON_IS_MODEL(OCTEON_CN30XX)
|| OCTEON_IS_MODEL(OCTEON_CN50XX)) {
-num_ports = 3;
+num_ports = 1;
} else {
cvmx_dprintf("ERROR: Unsupported Octeon model in %s\n",
__func__);
Index: linux-3.10.49/arch/mips/pci/pci-octeon.c
===================================================================
--- linux-3.10.49.orig/arch/mips/pci/pci-octeon.c2014-07-18 06:58:15.000000000 +0800
+++ linux-3.10.49/arch/mips/pci/pci-octeon.c2015-11-20 11:24:27.655865439 +0800
@@ -211,7 +211,7 @@
case CVMX_BOARD_TYPE_EBH3100:
case CVMX_BOARD_TYPE_CN3010_EVB_HS5:
case CVMX_BOARD_TYPE_CN3005_EVB_HS5:
-return "AAABAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
+return "AAAAAAAAAAAAAABAAAAAAAAAAAAAAABA";
case CVMX_BOARD_TYPE_BBGW_REF:
return "AABCD";
case CVMX_BOARD_TYPE_THUNDER:
5.需要改的几个地方,改天贴图,还有内核里必选的几个配置项。
这篇关于华为网卡支持linux,在openwrt下对华为WA633无线AP的千兆网卡驱动进行支持的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!