ixp400-eth: change to use maclist MAC values in 1.5
authorJohn Bowler <jbowler@nslu2-linux.org>
Tue, 29 Nov 2005 09:25:50 +0000 (09:25 +0000)
committerOpenEmbedded Project <openembedded-devel@lists.openembedded.org>
Tue, 29 Nov 2005 09:25:50 +0000 (09:25 +0000)
ixp4xx-csr: remove single PHY configuration options in 2.1

packages/ixp425-eth/ixp400-eth-1.5/mac-address.patch [new file with mode: 0644]
packages/ixp425-eth/ixp400-eth_1.5.bb
packages/ixp4xx/ixp4xx-csr_2.1.bb

diff --git a/packages/ixp425-eth/ixp400-eth-1.5/mac-address.patch b/packages/ixp425-eth/ixp400-eth-1.5/mac-address.patch
new file mode 100644 (file)
index 0000000..bd16124
--- /dev/null
@@ -0,0 +1,120 @@
+--- ./ixp400_eth.c.base        2005-11-28 23:59:34.476404165 -0800
++++ ./ixp400_eth.c     2005-11-29 00:42:44.587389574 -0800
+@@ -23,10 +23,10 @@
+  * This driver is written and optimized for Intel Xscale technology.
+  *
+  * SETUP NOTES:
+- * By default, this driver uses predefined MAC addresses.
+- * These are set in global var 'default_mac_addr' in this file.
+- * If required, these can be changed at run-time using
+- * the 'ifconfig' tool.
++ * By default, this driver uses MAC addresses from maclist, if
++ * these are not available the kernel api to randomly generate
++ * a locally assigned MAC address is used.  The MAC can be
++ * overridden with ifconfig if absolutely necessary.
+  *
+  * Example - to set ixp0 MAC address to 00:02:B3:66:88:AA, 
+  * run ifconfig with the following arguments:
+@@ -64,6 +64,7 @@
+ #include <linux/sysctl.h>
+ #include <linux/unistd.h>
+ #include <linux/version.h>
++#include <net/maclist.h>
+ #if KERNEL_VERSION(2,6,0) <= LINUX_VERSION_CODE
+ #include <linux/workqueue.h>
+@@ -130,6 +131,8 @@ static int dev_max_count = 1; /* only NP
+ static int dev_max_count = 2; /* only NPEB and NPEC */
+ #elif defined (CONFIG_ARCH_IXDP465) || defined(CONFIG_MACH_IXDP465)
+ static int dev_max_count = 3; /* all NPEs are used */
++#else
++static int dev_max_count = -1;/* use maclist_count */
+ #endif
+ #ifndef CONFIG_IXP400_NAPI
+@@ -621,21 +624,6 @@ static phy_cfg_t default_phy_cfg[] =
+ #endif
+ };
+-/* Default MAC addresses for EthAcc Ports 1 and 2 (using Intel MAC prefix) 
+- * Default is 
+- *   IX_ETH_PORT_1 -> MAC 00:02:b3:01:01:01
+- *   IX_ETH_PORT_2 -> MAC 00:02:b3:02:02:02
+- *   IX_ETH_PORT_3 -> MAC 00:02:b3:03:03:03
+-*/
+-static IxEthAccMacAddr default_mac_addr[] =
+-{
+-    {{0x00, 0x02, 0xB3, 0x01, 0x01, 0x01}}  /* EthAcc Port 0 */
+-    ,{{0x00, 0x02, 0xB3, 0x02, 0x02, 0x02}} /* EthAcc Port 1 */
+-#if defined (CONFIG_ARCH_IXDP465) || defined(CONFIG_MACH_IXDP465)
+-    ,{{0x00, 0x02, 0xB3, 0x03, 0x03, 0x03}} /* EthAcc Port 2 */
+-#endif
+-};
+-
+ /* Default mapping of  NpeImageIds for EthAcc Ports 
+  * Default is 
+  *   IX_ETH_PORT_1 -> IX_ETH_NPE_B
+@@ -3337,28 +3325,13 @@ static int __devinit dev_eth_probe(struc
+     /* Defines the unicast MAC address
+      *
+-     * Here is a good place to read a board-specific MAC address
+-     * from a non-volatile memory, e.g. an external eeprom.
+-     * 
+-     * This memcpy uses a default MAC address from this
+-     * source code.
+-     *
+-     * This can be overriden later by the (optional) command
+-     *
+-     *     ifconfig ixp0 ether 0002b3010101
+-     *
++     * The code reads from the maclist API.
+      */
++    if (maclist_read((u8(*)[6])&ndev->dev_addr, priv->port_id) ||
++                  !is_valid_ether_addr(ndev->dev_addr))
++          random_ether_addr(ndev->dev_addr);
+-    memcpy(ndev->dev_addr, 
+-         &default_mac_addr[priv->port_id].macAddress,
+-         IX_IEEE803_MAC_ADDRESS_SIZE);
+-
+-    /* possibly remove this test and the message when a valid MAC address 
+-     * is not hardcoded in the driver source code. 
+-     */
+-    if (is_valid_ether_addr(ndev->dev_addr))
+-    {
+-      P_WARN("Use default MAC address %2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x for port %d\n",
++    P_INFO("Use MAC address %2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x for port %d\n",
+              (unsigned)ndev->dev_addr[0],
+              (unsigned)ndev->dev_addr[1],
+              (unsigned)ndev->dev_addr[2],
+@@ -3366,7 +3339,6 @@ static int __devinit dev_eth_probe(struc
+              (unsigned)ndev->dev_addr[4],
+              (unsigned)ndev->dev_addr[5],
+              priv->port_id);
+-    }
+     
+     /* Set/update the internal packet size 
+      * This can be overriden later by the command
+@@ -3584,12 +3556,15 @@ static int __init ixp400_eth_init(void)
+     TRACE;
+-    /* check module parameter range */
+-    if (dev_max_count == 0 || dev_max_count > IX_ETH_ACC_NUMBER_OF_PORTS)
+-    {
+-      P_ERROR("Number of ports supported is dev_max_count <= %d\n", IX_ETH_ACC_NUMBER_OF_PORTS);
+-      return -1;
+-    }
++    /* fix dev_max_count to maclist_count - the actual number of
++     * available MACs
++     */
++    if (dev_max_count <= 0)
++          dev_max_count = maclist_count();
++    if (dev_max_count <= 0)
++          dev_max_count = 1;
++    else if (dev_max_count > IX_ETH_ACC_NUMBER_OF_PORTS)
++          dev_max_count = IX_ETH_ACC_NUMBER_OF_PORTS;
+     TRACE;
index 86fef76..24eb358 100644 (file)
@@ -12,9 +12,10 @@ SRC_URI += "file://2.6.15.patch;patch=1"
 SRC_URI += "file://device-name.patch;patch=1"
 SRC_URI += "file://poll-controller.patch;patch=1"
 SRC_URI += "file://le.patch;patch=1"
+SRC_URI += "file://mac-address.patch;patch=1"
 SRC_URI += "file://debug.patch;patch=1"
 
-PR = "r0"
+PR = "r1"
 
 DEPENDS = "ixp4xx-csr"
 RDEPENDS = "ixp4xx-csr"
@@ -51,7 +52,7 @@ EXTRA_OEMAKE = "'PWD=${S}' \
                'IXP4XX_CSR_DIR=${STAGING_INCDIR}/linux/ixp4xx-csr' \
                'IXP4XX_CSR_SYMVERS=${IXP4XX_CSR_SYMVERS}' \
                'OSAL_DIR=${OSAL_DIR}' \
-               'IX_CFLAGS=-DIX_UTOPIAMODE=0 -DIX_MPHYSINGLEPORT=1 -DCONFIG_IXP400_ETH_NPEB_ONLY=1 ${IX_ENSURE} ${DEVICE_NAME} -DIX_COMPONENT_NAME=-1' \
+               'IX_CFLAGS=-DIX_UTOPIAMODE=0 -DIX_MPHYSINGLEPORT=1 ${IX_ENSURE} ${DEVICE_NAME} -DIX_COMPONENT_NAME=-1' \
                'LINUX_SRC=${STAGING_KERNEL_DIR}' \
                'LINUX_CROSS_COMPILE=${HOST_PREFIX}' \
                "
@@ -67,7 +68,7 @@ do_compile_append () {
                ${CONFIG_MODVERSIONS:+-m} \
                ${CONFIG_MODULE_SRCVERSION_ALL:+-a} \
                -i '${STAGING_KERNEL_DIR}/ixp400-csr.symvers' \
-               ixp400_eth.o >&2 | egrep .
+               ixp400_eth.o 2>&1 | egrep .
        then
                echo "MODPOST errors - see above"
                return 1
index f8b29f1..a00fbae 100644 (file)
@@ -34,7 +34,7 @@ SRC_URI += "file://le.patch;patch=1"
 
 DEPENDS = "ixp-osal"
 S = "${WORKDIR}/ixp400_xscale_sw"
-PR = "r1"
+PR = "r2"
 
 COMPATIBLE_HOST = "^arm.*-linux.*"
 
@@ -69,9 +69,9 @@ EXTRA_OEMAKE = "'AR=${AR}' \
                '${IX_TARGET}_COMPONENTS=${COMPONENTS}' \
                '${IX_TARGET}_CODELETS_COMPONENTS=${CODELETS_COMPONENTS}' \
                'IX_DEVICE=ixp42X' \
-               'IX_MPHY=1' \
-               'IX_MPHYSINGLEPORT=1' \
                'IX_INCLUDE_MICROCODE=1' \
+               'IX_UTOPIAMODE=0' \
+               'IX_MPHYSINGLEPORT=1' \
                ${IX_ENSURE} \
                'LINUX_SRC=${STAGING_KERNEL_DIR}' \
                'LINUX_CROSS_COMPILE=${HOST_PREFIX}' \