ar71xx: add sysupgrade support for Ubiquiti XM boards
[openwrt.git] / target / linux / ixp4xx / patches-2.6.28 / 204-npe_driver_ixp43x_support.patch
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
5
6 ---
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(-)
12
13 --- a/arch/arm/mach-ixp4xx/ixp4xx_npe.c
14 +++ b/arch/arm/mach-ixp4xx/ixp4xx_npe.c
15 @@ -575,8 +575,8 @@ int npe_load_firmware(struct npe *npe, c
16 for (i = 0; i < image->size; i++)
17 image->data[i] = swab32(image->data[i]);
18
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 "
23 "IXP42x\n");
24 goto err;
25 }
26 @@ -598,7 +598,7 @@ int npe_load_firmware(struct npe *npe, c
27 "revision 0x%X:%X\n", (image->id >> 16) & 0xFF,
28 (image->id >> 8) & 0xFF, image->id & 0xFF);
29
30 - if (!cpu_is_ixp46x()) {
31 + if (cpu_is_ixp42x()) {
32 if (!npe->id)
33 instr_size = NPE_A_42X_INSTR_SIZE;
34 else
35 --- a/drivers/net/arm/ixp4xx_eth.c
36 +++ b/drivers/net/arm/ixp4xx_eth.c
37 @@ -32,6 +32,7 @@
38 #include <linux/kernel.h>
39 #include <linux/mii.h>
40 #include <linux/platform_device.h>
41 +#include <mach/cpu.h>
42 #include <mach/npe.h>
43 #include <mach/qmgr.h>
44
45 @@ -1337,12 +1338,16 @@ static struct platform_driver drv = {
46
47 static int __init eth_init_module(void)
48 {
49 - if (!(ixp4xx_read_feature_bits() & IXP4XX_FEATURE_NPEB_ETH0))
50 - return -ENOSYS;
51
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;
58 +
59 + else
60 + /* IXP43x lacks NPE-B and uses NPE-C for MII PHY access */
61 + mdio_regs = (struct eth_regs __iomem *)IXP4XX_EthC_BASE_VIRT;
62 +
63 __raw_writel(DEFAULT_CORE_CNTRL, &mdio_regs->core_control);
64
65 return platform_driver_register(&drv);
66 --- a/arch/arm/mach-ixp4xx/include/mach/cpu.h
67 +++ b/arch/arm/mach-ixp4xx/include/mach/cpu.h
68 @@ -35,6 +35,8 @@ static inline u32 ixp4xx_read_feature_bi
69 val &= ~IXP4XX_FEATURE_RESERVED;
70 if (!cpu_is_ixp46x())
71 val &= ~IXP4XX_FEATURE_IXP46X_ONLY;
72 + if (cpu_is_ixp42x())
73 + val &= ~IXP4XX_FEATURE_IXP43X_46X;
74
75 return val;
76 }
77 --- a/arch/arm/mach-ixp4xx/include/mach/ixp4xx-regs.h
78 +++ b/arch/arm/mach-ixp4xx/include/mach/ixp4xx-regs.h
79 @@ -628,11 +628,12 @@
80 #define IXP4XX_FEATURE_XSCALE_MAX_FREQ (3 << 22)
81 #define IXP4XX_FEATURE_RESERVED (0xFF << 24)
82
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)
90
91 +#define IXP4XX_FEATURE_IXP46X_ONLY (IXP4XX_FEATURE_NPEB_ETH_1_TO_3 | \
92 + IXP4XX_FEATURE_RSA)
93 +
94 #endif
This page took 0.044135 seconds and 5 git commands to generate.