arm/ixp4xx: change the network driver from the driver written by

Christian Hohnstaedt to the driver written by Krzysztof Hasala which
has partially been accepted upstream.

svn path=/dists/trunk/linux-2.6/; revision=10201
This commit is contained in:
Gordon Farquharson 2008-01-26 07:59:06 +00:00
parent 15f811c1f1
commit cf71755c86
15 changed files with 2901 additions and 5167 deletions

View File

@ -98,6 +98,8 @@ CONFIG_MACH_NAS100D=y
#
CONFIG_DMABOUNCE=y
# CONFIG_IXP4XX_INDIRECT_PCI is not set
CONFIG_IXP4XX_QMGR=m
CONFIG_IXP4XX_NPE=m
#
# Processor Type
@ -666,11 +668,8 @@ CONFIG_CICADA_PHY=m
#
CONFIG_NET_ETHERNET=y
CONFIG_MII=y
CONFIG_IXP4XX_QMGR=m
CONFIG_IXP4XX_NPE=m
CONFIG_IXP4XX_FW_LOAD=y
CONFIG_IXP4XX_MAC=m
CONFIG_IXP4XX_CRYPTO=m
CONFIG_IXP4XX_ETH=m
# CONFIG_IXP4XX_HSS is not set
# CONFIG_HAPPYMEAL is not set
# CONFIG_SUNGEM is not set
# CONFIG_CASSINI is not set

View File

@ -0,0 +1,11 @@
--- a/include/asm-arm/arch-ixp4xx/io.h 2008-01-06 16:27:29.000000000 -0700
+++ b/include/asm-arm/arch-ixp4xx/io.h 2008-01-13 12:25:54.000000000 -0700
@@ -13,6 +13,8 @@
#ifndef __ASM_ARM_ARCH_IO_H
#define __ASM_ARM_ARCH_IO_H
+#include <linux/bitops.h>
+
#include <asm/hardware.h>
#define IO_SPACE_LIMIT 0xffff0000

View File

@ -0,0 +1,122 @@
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index bf56eb3..dd37901 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -62,6 +62,7 @@ extern int root_mountflags;
extern void _stext, _text, _etext, __data_start, _edata, _end;
unsigned int processor_id;
+EXPORT_SYMBOL(processor_id);
unsigned int __machine_arch_type;
EXPORT_SYMBOL(__machine_arch_type);
diff --git a/include/asm-arm/arch-ixp4xx/cpu.h b/include/asm-arm/arch-ixp4xx/cpu.h
index d2523b3..2fa3d6b 100644
--- a/include/asm-arm/arch-ixp4xx/cpu.h
+++ b/include/asm-arm/arch-ixp4xx/cpu.h
@@ -28,4 +28,19 @@ extern unsigned int processor_id;
#define cpu_is_ixp46x() ((processor_id & IXP4XX_PROCESSOR_ID_MASK) == \
IXP465_PROCESSOR_ID_VALUE)
+static inline u32 ixp4xx_read_feature_bits(void)
+{
+ unsigned int val = ~*IXP4XX_EXP_CFG2;
+ val &= ~IXP4XX_FEATURE_RESERVED;
+ if (!cpu_is_ixp46x())
+ val &= ~IXP4XX_FEATURE_IXP46X_ONLY;
+
+ return val;
+}
+
+static inline void ixp4xx_write_feature_bits(u32 value)
+{
+ *IXP4XX_EXP_CFG2 = ~value;
+}
+
#endif /* _ASM_ARCH_CPU_H */
diff --git a/include/asm-arm/arch-ixp4xx/hardware.h b/include/asm-arm/arch-ixp4xx/hardware.h
index 297ceda..73e8dc3 100644
--- a/include/asm-arm/arch-ixp4xx/hardware.h
+++ b/include/asm-arm/arch-ixp4xx/hardware.h
@@ -27,13 +27,13 @@
#define pcibios_assign_all_busses() 1
+/* Register locations and bits */
+#include "ixp4xx-regs.h"
+
#ifndef __ASSEMBLER__
#include <asm/arch/cpu.h>
#endif
-/* Register locations and bits */
-#include "ixp4xx-regs.h"
-
/* Platform helper functions and definitions */
#include "platform.h"
diff --git a/include/asm-arm/arch-ixp4xx/ixp4xx-regs.h b/include/asm-arm/arch-ixp4xx/ixp4xx-regs.h
index 5d949d7..c704fe8 100644
--- a/include/asm-arm/arch-ixp4xx/ixp4xx-regs.h
+++ b/include/asm-arm/arch-ixp4xx/ixp4xx-regs.h
@@ -15,10 +15,6 @@
*
*/
-#ifndef __ASM_ARCH_HARDWARE_H__
-#error "Do not include this directly, instead #include <asm/hardware.h>"
-#endif
-
#ifndef _ASM_ARM_IXP4XX_H_
#define _ASM_ARM_IXP4XX_H_
@@ -607,4 +603,36 @@
#define DCMD_LENGTH 0x01fff /* length mask (max = 8K - 1) */
+/* "fuse" bits of IXP_EXP_CFG2 */
+#define IXP4XX_FEATURE_RCOMP (1 << 0)
+#define IXP4XX_FEATURE_USB_DEVICE (1 << 1)
+#define IXP4XX_FEATURE_HASH (1 << 2)
+#define IXP4XX_FEATURE_AES (1 << 3)
+#define IXP4XX_FEATURE_DES (1 << 4)
+#define IXP4XX_FEATURE_HDLC (1 << 5)
+#define IXP4XX_FEATURE_AAL (1 << 6)
+#define IXP4XX_FEATURE_HSS (1 << 7)
+#define IXP4XX_FEATURE_UTOPIA (1 << 8)
+#define IXP4XX_FEATURE_NPEB_ETH0 (1 << 9)
+#define IXP4XX_FEATURE_NPEC_ETH (1 << 10)
+#define IXP4XX_FEATURE_RESET_NPEA (1 << 11)
+#define IXP4XX_FEATURE_RESET_NPEB (1 << 12)
+#define IXP4XX_FEATURE_RESET_NPEC (1 << 13)
+#define IXP4XX_FEATURE_PCI (1 << 14)
+#define IXP4XX_FEATURE_ECC_TIMESYNC (1 << 15)
+#define IXP4XX_FEATURE_UTOPIA_PHY_LIMIT (3 << 16)
+#define IXP4XX_FEATURE_USB_HOST (1 << 18)
+#define IXP4XX_FEATURE_NPEA_ETH (1 << 19)
+#define IXP4XX_FEATURE_NPEB_ETH_1_TO_3 (1 << 20)
+#define IXP4XX_FEATURE_RSA (1 << 21)
+#define IXP4XX_FEATURE_XSCALE_MAX_FREQ (3 << 22)
+#define IXP4XX_FEATURE_RESERVED (0xFF << 24)
+
+#define IXP4XX_FEATURE_IXP46X_ONLY (IXP4XX_FEATURE_ECC_TIMESYNC | \
+ IXP4XX_FEATURE_USB_HOST | \
+ IXP4XX_FEATURE_NPEA_ETH | \
+ IXP4XX_FEATURE_NPEB_ETH_1_TO_3 | \
+ IXP4XX_FEATURE_RSA | \
+ IXP4XX_FEATURE_XSCALE_MAX_FREQ)
+
#endif
diff --git a/include/asm-arm/arch-ixp4xx/uncompress.h b/include/asm-arm/arch-ixp4xx/uncompress.h
index f7a35b7..34ef48f 100644
--- a/include/asm-arm/arch-ixp4xx/uncompress.h
+++ b/include/asm-arm/arch-ixp4xx/uncompress.h
@@ -13,7 +13,7 @@
#ifndef _ARCH_UNCOMPRESS_H_
#define _ARCH_UNCOMPRESS_H_
-#include <asm/hardware.h>
+#include "ixp4xx-regs.h"
#include <asm/mach-types.h>
#include <linux/serial_reg.h>

View File

@ -1,42 +0,0 @@
diff --git a/drivers/net/ixp4xx/mac_driver.c b/drivers/net/ixp4xx/mac_driver.c
index f393c3c..03ed8fe 100644
--- a/drivers/net/ixp4xx/mac_driver.c
+++ b/drivers/net/ixp4xx/mac_driver.c
@@ -350,6 +350,16 @@ static int ixmac_open (struct net_device *dev)
mac->npe_stat_num = i<NPE_STAT_NUM ? NPE_STAT_NUM_BASE : NPE_STAT_NUM;
mac->npe_stat_num += NPE_Q_STAT_NUM;
+ /* Only use platform or random if there's currently no device hw addr */
+ if (is_zero_ether_addr(dev->dev_addr)) {
+ if (is_zero_ether_addr(mac->plat->hwaddr)) {
+ random_ether_addr(dev->dev_addr);
+ dev->dev_addr[5] = mac->plat->phy_id;
+ }
+ else
+ memcpy(dev->dev_addr, mac->plat->hwaddr, 6);
+ }
+
mac_set_uniaddr(dev);
media_check(dev, 1);
ixmac_set_rx_mode(dev);
@@ -691,20 +701,6 @@ static int mac_probe(struct platform_device *pdev)
INIT_DELAYED_WORK(&mac->mdio_thread, mac_mdio_thread);
- /* The place of the MAC address is very system dependent.
- * Here we use a random one to be replaced by one of the
- * following commands:
- * "ip link set address 02:03:04:04:04:01 dev eth0"
- * "ifconfig eth0 hw ether 02:03:04:04:04:07"
- */
-
- if (is_zero_ether_addr(plat->hwaddr)) {
- random_ether_addr(dev->dev_addr);
- dev->dev_addr[5] = plat->phy_id;
- }
- else
- memcpy(dev->dev_addr, plat->hwaddr, 6);
-
printk(KERN_INFO IXMAC_NAME " driver " IXMAC_VERSION
": %s on %s with PHY[%d] initialized\n",
dev->name, npe->plat->name, plat->phy_id);

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,44 @@
diff --git a/include/asm-arm/arch-ixp4xx/platform.h b/include/asm-arm/arch-ixp4xx/platform.h
index 2a44d3d..695b9c4 100644
--- a/include/asm-arm/arch-ixp4xx/platform.h
+++ b/include/asm-arm/arch-ixp4xx/platform.h
@@ -77,8 +77,7 @@ extern unsigned long ixp4xx_exp_bus_size;
/*
* The IXP4xx chips do not have an I2C unit, so GPIO lines are just
- * used to
- * Used as platform_data to provide GPIO pin information to the ixp42x
+ * used as platform_data to provide GPIO pin information to the ixp42x
* I2C driver.
*/
struct ixp4xx_i2c_pins {
@@ -86,6 +85,27 @@ struct ixp4xx_i2c_pins {
unsigned long scl_pin;
};
+#define IXP4XX_ETH_NPEA 0x00
+#define IXP4XX_ETH_NPEB 0x10
+#define IXP4XX_ETH_NPEC 0x20
+
+/* Information about built-in Ethernet MAC interfaces */
+struct eth_plat_info {
+ u8 phy; /* MII PHY ID, 0 - 31 */
+ u8 rxq; /* configurable, currently 0 - 31 only */
+ u8 txreadyq;
+ u8 hwaddr[6];
+};
+
+/* Information about built-in HSS (synchronous serial) interfaces */
+struct hss_plat_info {
+ int (*set_clock)(int port, unsigned int clock_type);
+ int (*open)(int port, void *pdev,
+ void (*set_carrier_cb)(void *pdev, int carrier));
+ void (*close)(int port, void *pdev);
+ u8 txreadyq;
+};
+
/*
* This structure provide a means for the board setup code
* to give information to th pata_ixp4xx driver. It is

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,40 +0,0 @@
diff --git a/arch/arm/mach-ixp4xx/nas100d-setup.c b/arch/arm/mach-ixp4xx/nas100d-setup.c
index 54d884f..5ef4c1f 100644
--- a/arch/arm/mach-ixp4xx/nas100d-setup.c
+++ b/arch/arm/mach-ixp4xx/nas100d-setup.c
@@ -125,12 +125,35 @@ static struct platform_device nas100d_uart = {
.resource = nas100d_uart_resources,
};
+static struct resource res_mac0 = {
+ .start = IXP4XX_EthB_BASE_PHYS,
+ .end = IXP4XX_EthB_BASE_PHYS + 0x1ff,
+ .flags = IORESOURCE_MEM,
+};
+
+static struct mac_plat_info plat_mac0 = {
+ .npe_id = 1,
+ .phy_id = 0,
+ .eth_id = 0,
+ .rxq_id = 27,
+ .txq_id = 24,
+};
+
+static struct platform_device mac0 = {
+ .name = "ixp4xx_mac",
+ .id = 0,
+ .dev.platform_data = &plat_mac0,
+ .num_resources = 1,
+ .resource = &res_mac0,
+};
+
static struct platform_device *nas100d_devices[] __initdata = {
&nas100d_i2c_gpio,
&nas100d_flash,
#ifdef CONFIG_LEDS_IXP4XX
&nas100d_leds,
#endif
+ &mac0
};
static void nas100d_power_off(void)

View File

@ -0,0 +1,87 @@
diff --git a/arch/arm/mach-ixp4xx/nas100d-setup.c b/arch/arm/mach-ixp4xx/nas100d-setup.c
index 54d884f..39d7d90 100644
--- a/arch/arm/mach-ixp4xx/nas100d-setup.c
+++ b/arch/arm/mach-ixp4xx/nas100d-setup.c
@@ -21,6 +21,7 @@
#include <asm/mach-types.h>
#include <asm/mach/arch.h>
#include <asm/mach/flash.h>
+#include <asm/io.h>
static struct flash_platform_data nas100d_flash_data = {
.map_name = "cfi_probe",
@@ -125,12 +126,30 @@ static struct platform_device nas100d_uart = {
.resource = nas100d_uart_resources,
};
+/* Built-in 10/100 Ethernet MAC interfaces */
+static struct eth_plat_info nas100d_plat_eth[] = {
+ {
+ .phy = 0,
+ .rxq = 3,
+ .txreadyq = 20,
+ }
+};
+
+static struct platform_device nas100d_eth[] = {
+ {
+ .name = "ixp4xx_eth",
+ .id = IXP4XX_ETH_NPEB,
+ .dev.platform_data = nas100d_plat_eth,
+ }
+};
+
static struct platform_device *nas100d_devices[] __initdata = {
&nas100d_i2c_gpio,
&nas100d_flash,
#ifdef CONFIG_LEDS_IXP4XX
&nas100d_leds,
#endif
+ &nas100d_eth[0],
};
static void nas100d_power_off(void)
@@ -146,6 +165,9 @@ static void nas100d_power_off(void)
static void __init nas100d_init(void)
{
+ uint8_t __iomem *f;
+ int i;
+
ixp4xx_sys_init();
/* gpio 14 and 15 are _not_ clocks */
@@ -165,6 +187,33 @@ static void __init nas100d_init(void)
(void)platform_device_register(&nas100d_uart);
platform_add_devices(nas100d_devices, ARRAY_SIZE(nas100d_devices));
+
+
+ /*
+ * Map in a portion of the flash and read the MAC address.
+ * Since it is stored in BE in the flash itself, we need to
+ * byteswap it if we're in LE mode.
+ */
+ if ((f = ioremap(IXP4XX_EXP_BUS_BASE(0), 0x1000000))) {
+#ifdef __ARMEB__
+ for (i = 0; i < 6; i++) {
+ nas100d_plat_eth[0].hwaddr[i] = readb(f + 0xFC0FD8 + i);
+ }
+#else
+ nas100d_plat_eth[0].hwaddr[0] = readb(f + 0xFC0FD8 + 3);
+ nas100d_plat_eth[0].hwaddr[1] = readb(f + 0xFC0FD8 + 2);
+ nas100d_plat_eth[0].hwaddr[2] = readb(f + 0xFC0FD8 + 1);
+ nas100d_plat_eth[0].hwaddr[3] = readb(f + 0xFC0FD8 + 0);
+ nas100d_plat_eth[0].hwaddr[4] = readb(f + 0xFC0FD8 + 7);
+ nas100d_plat_eth[0].hwaddr[5] = readb(f + 0xFC0FD8 + 6);
+#endif
+ iounmap(f);
+ }
+ printk(KERN_INFO "NAS100D: Using MAC address %.2x:%.2x:%.2x:%.2x:%.2x:%.2x for port 0\n",
+ nas100d_plat_eth[0].hwaddr[0], nas100d_plat_eth[0].hwaddr[1],
+ nas100d_plat_eth[0].hwaddr[2], nas100d_plat_eth[0].hwaddr[3],
+ nas100d_plat_eth[0].hwaddr[4], nas100d_plat_eth[0].hwaddr[5]);
+
}
MACHINE_START(NAS100D, "Iomega NAS 100d")

View File

@ -1,53 +0,0 @@
diff --git a/arch/arm/mach-ixp4xx/nas100d-setup.c b/arch/arm/mach-ixp4xx/nas100d-setup.c
index 5ef4c1f..870ec49 100644
--- a/arch/arm/mach-ixp4xx/nas100d-setup.c
+++ b/arch/arm/mach-ixp4xx/nas100d-setup.c
@@ -17,6 +17,7 @@
#include <linux/serial_8250.h>
#include <linux/leds.h>
#include <linux/i2c-gpio.h>
+#include <linux/mtd/mtd.h>
#include <asm/mach-types.h>
#include <asm/mach/arch.h>
@@ -156,6 +157,31 @@ static struct platform_device *nas100d_devices[] __initdata = {
&mac0
};
+static void nas100d_flash_add(struct mtd_info *mtd)
+{
+ if (strcmp(mtd->name, "RedBoot config") == 0) {
+ size_t retlen;
+ u_char mac[6];
+
+ if (mtd->read(mtd, 0x0FD8, 6, &retlen, mac) == 0 && retlen == 6) {
+ printk(KERN_INFO "nas100d mac: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n",
+ mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
+ memcpy(plat_mac0.hwaddr, mac, 6);
+ } else {
+ printk(KERN_ERR "nas100d mac: read failed\n");
+ }
+ }
+}
+
+static void nas100d_flash_remove(struct mtd_info *mtd)
+{
+}
+
+static struct mtd_notifier nas100d_flash_notifier = {
+ .add = nas100d_flash_add,
+ .remove = nas100d_flash_remove,
+};
+
static void nas100d_power_off(void)
{
/* This causes the box to drop the power and go dead. */
@@ -188,6 +214,8 @@ static void __init nas100d_init(void)
(void)platform_device_register(&nas100d_uart);
platform_add_devices(nas100d_devices, ARRAY_SIZE(nas100d_devices));
+
+ register_mtd_user(&nas100d_flash_notifier);
}
MACHINE_START(NAS100D, "Iomega NAS 100d")

View File

@ -1,41 +0,0 @@
diff --git a/arch/arm/mach-ixp4xx/nslu2-setup.c b/arch/arm/mach-ixp4xx/nslu2-setup.c
index 77277d2..d109e04 100644
--- a/arch/arm/mach-ixp4xx/nslu2-setup.c
+++ b/arch/arm/mach-ixp4xx/nslu2-setup.c
@@ -140,6 +140,28 @@ static struct platform_device nslu2_uart = {
.resource = nslu2_uart_resources,
};
+static struct resource res_mac0 = {
+ .start = IXP4XX_EthB_BASE_PHYS,
+ .end = IXP4XX_EthB_BASE_PHYS + 0x1ff,
+ .flags = IORESOURCE_MEM,
+};
+
+static struct mac_plat_info plat_mac0 = {
+ .npe_id = 1,
+ .phy_id = 1,
+ .eth_id = 0,
+ .rxq_id = 27,
+ .txq_id = 24,
+};
+
+static struct platform_device mac0 = {
+ .name = "ixp4xx_mac",
+ .id = 0,
+ .dev.platform_data = &plat_mac0,
+ .num_resources = 1,
+ .resource = &res_mac0,
+};
+
static struct platform_device *nslu2_devices[] __initdata = {
&nslu2_i2c_gpio,
&nslu2_flash,
@@ -147,6 +169,7 @@ static struct platform_device *nslu2_devices[] __initdata = {
#ifdef CONFIG_LEDS_IXP4XX
&nslu2_leds,
#endif
+ &mac0
};
static void nslu2_power_off(void)

View File

@ -0,0 +1,88 @@
diff --git a/arch/arm/mach-ixp4xx/nslu2-setup.c b/arch/arm/mach-ixp4xx/nslu2-setup.c
index 77277d2..f5e9cf7 100644
--- a/arch/arm/mach-ixp4xx/nslu2-setup.c
+++ b/arch/arm/mach-ixp4xx/nslu2-setup.c
@@ -24,6 +24,7 @@
#include <asm/mach/arch.h>
#include <asm/mach/flash.h>
#include <asm/mach/time.h>
+#include <asm/io.h>
static struct flash_platform_data nslu2_flash_data = {
.map_name = "cfi_probe",
@@ -140,6 +141,23 @@ static struct platform_device nslu2_uart = {
.resource = nslu2_uart_resources,
};
+/* Built-in 10/100 Ethernet MAC interfaces */
+static struct eth_plat_info nslu2_plat_eth[] = {
+ {
+ .phy = 1,
+ .rxq = 3,
+ .txreadyq = 20,
+ }
+};
+
+static struct platform_device nslu2_eth[] = {
+ {
+ .name = "ixp4xx_eth",
+ .id = IXP4XX_ETH_NPEB,
+ .dev.platform_data = nslu2_plat_eth,
+ }
+};
+
static struct platform_device *nslu2_devices[] __initdata = {
&nslu2_i2c_gpio,
&nslu2_flash,
@@ -147,6 +165,7 @@ static struct platform_device *nslu2_devices[] __initdata = {
#ifdef CONFIG_LEDS_IXP4XX
&nslu2_leds,
#endif
+ &nslu2_eth[0],
};
static void nslu2_power_off(void)
@@ -175,6 +194,9 @@ static struct sys_timer nslu2_timer = {
static void __init nslu2_init(void)
{
+ uint8_t __iomem *f;
+ int i;
+
ixp4xx_sys_init();
nslu2_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
@@ -191,6 +213,33 @@ static void __init nslu2_init(void)
(void)platform_device_register(&nslu2_uart);
platform_add_devices(nslu2_devices, ARRAY_SIZE(nslu2_devices));
+
+
+ /*
+ * Map in a portion of the flash and read the MAC address.
+ * Since it is stored in BE in the flash itself, we need to
+ * byteswap it if we're in LE mode.
+ */
+ if ((f = ioremap(IXP4XX_EXP_BUS_BASE(0), 0x40000))) {
+#ifdef __ARMEB__
+ for (i = 0; i < 6; i++) {
+ nslu2_plat_eth[0].hwaddr[i] = readb(f + 0x3FFB0 + i);
+ }
+#else
+ nslu2_plat_eth[0].hwaddr[0] = readb(f + 0x3FFB0 + 3);
+ nslu2_plat_eth[0].hwaddr[1] = readb(f + 0x3FFB0 + 2);
+ nslu2_plat_eth[0].hwaddr[2] = readb(f + 0x3FFB0 + 1);
+ nslu2_plat_eth[0].hwaddr[3] = readb(f + 0x3FFB0 + 0);
+ nslu2_plat_eth[0].hwaddr[4] = readb(f + 0x3FFB0 + 7);
+ nslu2_plat_eth[0].hwaddr[5] = readb(f + 0x3FFB0 + 6);
+#endif
+ iounmap(f);
+ }
+ printk(KERN_INFO "NSLU2: Using MAC address %.2x:%.2x:%.2x:%.2x:%.2x:%.2x for port 0\n",
+ nslu2_plat_eth[0].hwaddr[0], nslu2_plat_eth[0].hwaddr[1],
+ nslu2_plat_eth[0].hwaddr[2], nslu2_plat_eth[0].hwaddr[3],
+ nslu2_plat_eth[0].hwaddr[4], nslu2_plat_eth[0].hwaddr[5]);
+
}
MACHINE_START(NSLU2, "Linksys NSLU2")

View File

@ -1,54 +0,0 @@
diff --git a/arch/arm/mach-ixp4xx/nslu2-setup.c b/arch/arm/mach-ixp4xx/nslu2-setup.c
index d109e04..7e3fa07 100644
--- a/arch/arm/mach-ixp4xx/nslu2-setup.c
+++ b/arch/arm/mach-ixp4xx/nslu2-setup.c
@@ -19,6 +19,7 @@
#include <linux/serial_8250.h>
#include <linux/leds.h>
#include <linux/i2c-gpio.h>
+#include <linux/mtd/mtd.h>
#include <asm/mach-types.h>
#include <asm/mach/arch.h>
@@ -196,6 +197,32 @@ static struct sys_timer nslu2_timer = {
.init = nslu2_timer_init,
};
+static void nslu2_flash_add(struct mtd_info *mtd)
+{
+ if (strcmp(mtd->name, "RedBoot") == 0) {
+ size_t retlen;
+ u_char mac[6];
+
+ /* The MAC is at a known offset... */
+ if (mtd->read(mtd, 0x3FFB0, 6, &retlen, mac) == 0 && retlen == 6) {
+ printk(KERN_INFO "NSLU2 MAC: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n",
+ mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
+ memcpy(&plat_mac0.hwaddr, mac, 6);
+ } else {
+ printk(KERN_ERR "NSLU2 MAC: read failed\n");
+ }
+ }
+}
+
+static void nslu2_flash_remove(struct mtd_info *mtd)
+{
+}
+
+static struct mtd_notifier nslu2_flash_notifier = {
+ .add = nslu2_flash_add,
+ .remove = nslu2_flash_remove,
+};
+
static void __init nslu2_init(void)
{
ixp4xx_sys_init();
@@ -214,6 +241,8 @@ static void __init nslu2_init(void)
(void)platform_device_register(&nslu2_uart);
platform_add_devices(nslu2_devices, ARRAY_SIZE(nslu2_devices));
+
+ register_mtd_user(&nslu2_flash_notifier);
}
MACHINE_START(NSLU2, "Linksys NSLU2")

View File

@ -15,17 +15,18 @@
+ bugfix/powerpc/prep-utah-ide-interrupt.patch
+ bugfix/powerpc/serial.patch
+ bugfix/mips/tulip_mwi_fix.patch
+ features/arm/ixp4xx-npe-driver-0.3.1.patch
+ features/arm/ixp4xx-net-driver-improve-mac-handling.patch
+ features/arm/nslu2-i2c-gpio-driver-support.patch
+ features/arm/ixp4xx-feature-bits.patch
+ features/arm/ixp4xx-npe-and-qmgr.patch
+ features/arm/ixp4xx-net-headers.patch
+ features/arm/ixp4xx-net-drivers.patch
+ features/arm/nas100d-i2c-gpio-driver-support.patch
+ features/arm/nslu2-mac_plat_info.patch
+ features/arm/nas100d-mac_plat_info.patch
+ features/arm/nslu2-setup-mac.patch
+ features/arm/nas100d-setup-mac.patch
+ features/arm/nas100d-net-driver-support.patch
+ features/arm/nslu2-i2c-gpio-driver-support.patch
+ features/arm/nslu2-net-driver-support.patch
+ bugfix/sparc/drivers_net-broken.patch
+ bugfix/ia64/hardcode-arch-script-output.patch
+ bugfix/mips/disable-advansys.patch
+ bugfix/arm/fix-ixp4xx-io_h.patch
+ bugfix/arm/disable-dvb_b2c2_flexcop.patch
+ bugfix/arm/disable-dvb_budget.patch
+ bugfix/arm/disable-netxen_nic.patch