1 From cba5c286f3ea34ea4767fc00c705434a00fe2c37 Mon Sep 17 00:00:00 2001
2 From: Imre Kaloz <kaloz@openwrt.org>
3 Date: Thu, 26 Jun 2008 01:58:02 +0200
4 Subject: [PATCH] Add support for the ethernet ports on IXP43x
7 arch/arm/mach-ixp4xx/ixp4xx_npe.c | 6 +++---
8 drivers/net/arm/ixp4xx_eth.c | 13 +++++++++----
9 include/asm-arm/arch-ixp4xx/cpu.h | 2 ++
10 include/asm-arm/arch-ixp4xx/ixp4xx-regs.h | 7 ++++---
11 4 files changed, 18 insertions(+), 10 deletions(-)
13 --- a/arch/arm/mach-ixp4xx/ixp4xx_npe.c
14 +++ b/arch/arm/mach-ixp4xx/ixp4xx_npe.c
16 for (i = 0; i < image->size; i++)
17 image->data[i] = swab32(image->data[i]);
19 - if (!cpu_is_ixp46x() && ((image->id >> 28) & 0xF /* device ID */)) {
20 - print_npe(KERN_INFO, npe, "IXP46x firmware ignored on "
21 + if (cpu_is_ixp42x() && ((image->id >> 28) & 0xF /* device ID */)) {
22 + print_npe(KERN_INFO, npe, "IXP46x/IXP43x firmware ignored on "
27 "revision 0x%X:%X\n", (image->id >> 16) & 0xFF,
28 (image->id >> 8) & 0xFF, image->id & 0xFF);
30 - if (!cpu_is_ixp46x()) {
31 + if (cpu_is_ixp42x()) {
33 instr_size = NPE_A_42X_INSTR_SIZE;
35 --- a/drivers/net/arm/ixp4xx_eth.c
36 +++ b/drivers/net/arm/ixp4xx_eth.c
38 #include <linux/kernel.h>
39 #include <linux/mii.h>
40 #include <linux/platform_device.h>
41 +#include <asm/arch/cpu.h>
42 #include <asm/arch/npe.h>
43 #include <asm/arch/qmgr.h>
45 @@ -1338,12 +1339,16 @@
47 static int __init eth_init_module(void)
49 - if (!(ixp4xx_read_feature_bits() & IXP4XX_FEATURE_NPEB_ETH0))
52 - /* All MII PHY accesses use NPE-B Ethernet registers */
53 spin_lock_init(&mdio_lock);
54 - mdio_regs = (struct eth_regs __iomem *)IXP4XX_EthB_BASE_VIRT;
55 + if (!cpu_is_ixp43x())
56 + /* All MII PHY accesses use NPE-B Ethernet registers */
57 + mdio_regs = (struct eth_regs __iomem *)IXP4XX_EthB_BASE_VIRT;
60 + /* IXP43x lacks NPE-B and uses NPE-C for MII PHY access */
61 + mdio_regs = (struct eth_regs __iomem *)IXP4XX_EthC_BASE_VIRT;
63 __raw_writel(DEFAULT_CORE_CNTRL, &mdio_regs->core_control);
65 return platform_driver_register(&drv);
66 --- a/include/asm-arm/arch-ixp4xx/cpu.h
67 +++ b/include/asm-arm/arch-ixp4xx/cpu.h
69 val &= ~IXP4XX_FEATURE_RESERVED;
71 val &= ~IXP4XX_FEATURE_IXP46X_ONLY;
72 + if (cpu_is_ixp42x())
73 + val &= ~IXP4XX_FEATURE_IXP43X_46X;
77 --- a/include/asm-arm/arch-ixp4xx/ixp4xx-regs.h
78 +++ b/include/asm-arm/arch-ixp4xx/ixp4xx-regs.h
80 #define IXP4XX_FEATURE_XSCALE_MAX_FREQ (3 << 22)
81 #define IXP4XX_FEATURE_RESERVED (0xFF << 24)
83 -#define IXP4XX_FEATURE_IXP46X_ONLY (IXP4XX_FEATURE_ECC_TIMESYNC | \
84 +#define IXP4XX_FEATURE_IXP43X_46X (IXP4XX_FEATURE_ECC_TIMESYNC | \
85 IXP4XX_FEATURE_USB_HOST | \
86 IXP4XX_FEATURE_NPEA_ETH | \
87 - IXP4XX_FEATURE_NPEB_ETH_1_TO_3 | \
88 - IXP4XX_FEATURE_RSA | \
89 IXP4XX_FEATURE_XSCALE_MAX_FREQ)
91 +#define IXP4XX_FEATURE_IXP46X_ONLY (IXP4XX_FEATURE_NPEB_ETH_1_TO_3 | \