diff options
author | kaloz <kaloz@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2008-07-12 02:02:58 +0000 |
---|---|---|
committer | kaloz <kaloz@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2008-07-12 02:02:58 +0000 |
commit | 451089be3aca7436f86ada90a39e450dc4ad7874 (patch) | |
tree | 6870fa2b5548592459151c5a5d25ceef5e45892d /target/linux/ixp4xx | |
parent | 08c3d434a7d03a4e3ae146be2c27a3b49699fd3d (diff) |
nuke most of the old ixp4xx patchsets
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@11778 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/ixp4xx')
123 files changed, 0 insertions, 33849 deletions
diff --git a/target/linux/ixp4xx/patches-2.6.23/001-kexec_atags.patch b/target/linux/ixp4xx/patches-2.6.23/001-kexec_atags.patch deleted file mode 100644 index f4f60c9494..0000000000 --- a/target/linux/ixp4xx/patches-2.6.23/001-kexec_atags.patch +++ /dev/null @@ -1,122 +0,0 @@ -Index: linux-2.6.23.17/arch/arm/kernel/relocate_kernel.S -=================================================================== ---- linux-2.6.23.17.orig/arch/arm/kernel/relocate_kernel.S -+++ linux-2.6.23.17/arch/arm/kernel/relocate_kernel.S -@@ -7,6 +7,23 @@ - .globl relocate_new_kernel - relocate_new_kernel: - -+ /* Move boot params back to where the kernel expects them */ -+ -+ ldr r0,kexec_boot_params_address -+ teq r0,#0 -+ beq 8f -+ -+ ldr r1,kexec_boot_params_copy -+ mov r6,#KEXEC_BOOT_PARAMS_SIZE/4 -+7: -+ ldr r5,[r1],#4 -+ str r5,[r0],#4 -+ subs r6,r6,#1 -+ bne 7b -+ -+8: -+ /* Boot params moved, now go on with the kernel */ -+ - ldr r0,kexec_indirection_page - ldr r1,kexec_start_address - -@@ -50,7 +67,7 @@ relocate_new_kernel: - mov lr,r1 - mov r0,#0 - ldr r1,kexec_mach_type -- mov r2,#0 -+ ldr r2,kexec_boot_params_address - mov pc,lr - - .globl kexec_start_address -@@ -65,6 +82,16 @@ kexec_indirection_page: - kexec_mach_type: - .long 0x0 - -+ /* phy addr where new kernel will expect to find boot params */ -+ .globl kexec_boot_params_address -+kexec_boot_params_address: -+ .long 0x0 -+ -+ /* phy addr where old kernel put a copy of orig boot params */ -+ .globl kexec_boot_params_copy -+kexec_boot_params_copy: -+ .long 0x0 -+ - relocate_new_kernel_end: - - .globl relocate_new_kernel_size -Index: linux-2.6.23.17/arch/arm/kernel/setup.c -=================================================================== ---- linux-2.6.23.17.orig/arch/arm/kernel/setup.c -+++ linux-2.6.23.17/arch/arm/kernel/setup.c -@@ -24,6 +24,7 @@ - #include <linux/interrupt.h> - #include <linux/smp.h> - #include <linux/fs.h> -+#include <linux/kexec.h> - - #include <asm/cpu.h> - #include <asm/elf.h> -@@ -770,6 +771,23 @@ static int __init customize_machine(void - } - arch_initcall(customize_machine); - -+#ifdef CONFIG_KEXEC -+ -+/* Physical addr of where the boot params should be for this machine */ -+extern unsigned long kexec_boot_params_address; -+ -+/* Physical addr of the buffer into which the boot params are copied */ -+extern unsigned long kexec_boot_params_copy; -+ -+/* Pointer to the boot params buffer, for manipulation and display */ -+unsigned long kexec_boot_params; -+EXPORT_SYMBOL(kexec_boot_params); -+ -+/* The buffer itself - make sure it is sized correctly */ -+static unsigned long kexec_boot_params_buf[(KEXEC_BOOT_PARAMS_SIZE + 3) / 4]; -+ -+#endif -+ - void __init setup_arch(char **cmdline_p) - { - struct tag *tags = (struct tag *)&init_tags; -@@ -788,6 +806,18 @@ void __init setup_arch(char **cmdline_p) - else if (mdesc->boot_params) - tags = phys_to_virt(mdesc->boot_params); - -+#ifdef CONFIG_KEXEC -+ kexec_boot_params_copy = virt_to_phys(kexec_boot_params_buf); -+ kexec_boot_params = (unsigned long)kexec_boot_params_buf; -+ if (__atags_pointer) { -+ kexec_boot_params_address = __atags_pointer; -+ memcpy((void *)kexec_boot_params, tags, KEXEC_BOOT_PARAMS_SIZE); -+ } else if (mdesc->boot_params) { -+ kexec_boot_params_address = mdesc->boot_params; -+ memcpy((void *)kexec_boot_params, tags, KEXEC_BOOT_PARAMS_SIZE); -+ } -+#endif -+ - /* - * If we have the old style parameters, convert them to - * a tag list. -Index: linux-2.6.23.17/include/asm-arm/kexec.h -=================================================================== ---- linux-2.6.23.17.orig/include/asm-arm/kexec.h -+++ linux-2.6.23.17/include/asm-arm/kexec.h -@@ -14,6 +14,8 @@ - - #define KEXEC_ARCH KEXEC_ARCH_ARM - -+#define KEXEC_BOOT_PARAMS_SIZE 1536 -+ - #ifndef __ASSEMBLY__ - - struct kimage; diff --git a/target/linux/ixp4xx/patches-2.6.23/012-velocity_BE.patch b/target/linux/ixp4xx/patches-2.6.23/012-velocity_BE.patch deleted file mode 100644 index 40a7215dcc..0000000000 --- a/target/linux/ixp4xx/patches-2.6.23/012-velocity_BE.patch +++ /dev/null @@ -1,928 +0,0 @@ -Index: linux-2.6.23.17/drivers/net/via-velocity.c -=================================================================== ---- linux-2.6.23.17.orig/drivers/net/via-velocity.c -+++ linux-2.6.23.17/drivers/net/via-velocity.c -@@ -96,11 +96,31 @@ MODULE_AUTHOR("VIA Networking Technologi - MODULE_LICENSE("GPL"); - MODULE_DESCRIPTION("VIA Networking Velocity Family Gigabit Ethernet Adapter Driver"); - -+/* Valid values for vdebug (additive, this is a bitmask): -+ * 0x00 => off -+ * 0x01 => always on -+ * 0x02 => additional detail on tx (rx, too, if anyone implements same) -+ * 0x04 => detail the initialization process -+ * 0x08 => spot debug detail; to be used as developers see fit -+ */ -+static int vdebug = 0; -+ -+/* HAIL - these macros are for the normal 0x01-type tracing... */ -+#define HAIL(S) \ -+ if (vdebug&1) printk(KERN_NOTICE "%s\n", (S)); -+#define HAILS(S,T) \ -+ if (vdebug&1) printk(KERN_NOTICE "%s -> status=0x%x\n", (S), (T)); -+ - #define VELOCITY_PARAM(N,D) \ - static int N[MAX_UNITS]=OPTION_DEFAULT;\ - module_param_array(N, int, NULL, 0); \ - MODULE_PARM_DESC(N, D); - -+#define VELO_DEBUG_MIN 0 -+#define VELO_DEBUG_MAX 255 -+#define VELO_DEBUG_DEF 0 -+VELOCITY_PARAM(velo_debug, "Debug level"); -+ - #define RX_DESC_MIN 64 - #define RX_DESC_MAX 255 - #define RX_DESC_DEF 64 -@@ -385,12 +405,12 @@ static void __devinit velocity_set_int_o - if (val == -1) - *opt = def; - else if (val < min || val > max) { -- VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: the value of parameter %s is invalid, the valid range is (%d-%d)\n", -- devname, name, min, max); -+ VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "via-velocity: the value of parameter %s is invalid, the valid range is (%d-%d)\n", -+ name, min, max); - *opt = def; - } else { -- VELOCITY_PRT(MSG_LEVEL_INFO, KERN_INFO "%s: set value of parameter %s to %d\n", -- devname, name, val); -+ VELOCITY_PRT(MSG_LEVEL_INFO, KERN_INFO "via-velocity: set value of parameter %s to %d\n", -+ name, val); - *opt = val; - } - } -@@ -415,12 +435,12 @@ static void __devinit velocity_set_bool_ - if (val == -1) - *opt |= (def ? flag : 0); - else if (val < 0 || val > 1) { -- printk(KERN_NOTICE "%s: the value of parameter %s is invalid, the valid range is (0-1)\n", -- devname, name); -+ printk(KERN_NOTICE "via-velocity: the value of parameter %s is invalid, the valid range is (0-1)\n", -+ name); - *opt |= (def ? flag : 0); - } else { -- printk(KERN_INFO "%s: set parameter %s to %s\n", -- devname, name, val ? "TRUE" : "FALSE"); -+ printk(KERN_INFO "via-velocity: set parameter %s to %s\n", -+ name, val ? "TRUE" : "FALSE"); - *opt |= (val ? flag : 0); - } - } -@@ -438,6 +458,7 @@ static void __devinit velocity_set_bool_ - static void __devinit velocity_get_options(struct velocity_opt *opts, int index, char *devname) - { - -+ velocity_set_int_opt(&opts->velo_debug, velo_debug[index], VELO_DEBUG_MIN, VELO_DEBUG_MAX, VELO_DEBUG_DEF, "velo_debug", devname); - velocity_set_int_opt(&opts->rx_thresh, rx_thresh[index], RX_THRESH_MIN, RX_THRESH_MAX, RX_THRESH_DEF, "rx_thresh", devname); - velocity_set_int_opt(&opts->DMA_length, DMA_length[index], DMA_LENGTH_MIN, DMA_LENGTH_MAX, DMA_LENGTH_DEF, "DMA_length", devname); - velocity_set_int_opt(&opts->numrx, RxDescriptors[index], RX_DESC_MIN, RX_DESC_MAX, RX_DESC_DEF, "RxDescriptors", devname); -@@ -452,6 +473,7 @@ static void __devinit velocity_get_optio - velocity_set_int_opt((int *) &opts->wol_opts, wol_opts[index], WOL_OPT_MIN, WOL_OPT_MAX, WOL_OPT_DEF, "Wake On Lan options", devname); - velocity_set_int_opt((int *) &opts->int_works, int_works[index], INT_WORKS_MIN, INT_WORKS_MAX, INT_WORKS_DEF, "Interrupt service works", devname); - opts->numrx = (opts->numrx & ~3); -+ vdebug = opts->velo_debug; - } - - /** -@@ -466,6 +488,8 @@ static void velocity_init_cam_filter(str - { - struct mac_regs __iomem * regs = vptr->mac_regs; - -+ HAIL("velocity_init_cam_filter"); -+ - /* Turn on MCFG_PQEN, turn off MCFG_RTGOPT */ - WORD_REG_BITS_SET(MCFG_PQEN, MCFG_RTGOPT, ®s->MCFG); - WORD_REG_BITS_ON(MCFG_VIDFR, ®s->MCFG); -@@ -484,14 +508,12 @@ static void velocity_init_cam_filter(str - WORD_REG_BITS_ON(MCFG_RTGOPT, ®s->MCFG); - - mac_set_cam(regs, 0, (u8 *) & (vptr->options.vid), VELOCITY_VLAN_ID_CAM); -- vptr->vCAMmask[0] |= 1; -- mac_set_cam_mask(regs, vptr->vCAMmask, VELOCITY_VLAN_ID_CAM); - } else { - u16 temp = 0; - mac_set_cam(regs, 0, (u8 *) &temp, VELOCITY_VLAN_ID_CAM); -- temp = 1; -- mac_set_cam_mask(regs, (u8 *) &temp, VELOCITY_VLAN_ID_CAM); - } -+ vptr->vCAMmask[0] |= 1; -+ mac_set_cam_mask(regs, vptr->vCAMmask, VELOCITY_VLAN_ID_CAM); - } - - /** -@@ -508,13 +530,15 @@ static void velocity_rx_reset(struct vel - struct mac_regs __iomem * regs = vptr->mac_regs; - int i; - -+ HAIL("velocity_rx_reset"); - vptr->rd_dirty = vptr->rd_filled = vptr->rd_curr = 0; - - /* - * Init state, all RD entries belong to the NIC - */ - for (i = 0; i < vptr->options.numrx; ++i) -- vptr->rd_ring[i].rdesc0.owner = OWNED_BY_NIC; -+ /* vptr->rd_ring[i].rdesc0.owner = OWNED_BY_NIC; BE */ -+ vptr->rd_ring[i].rdesc0 |= cpu_to_le32(BE_OWNED_BY_NIC); /* BE */ - - writew(vptr->options.numrx, ®s->RBRDU); - writel(vptr->rd_pool_dma, ®s->RDBaseLo); -@@ -537,12 +561,15 @@ static void velocity_init_registers(stru - struct mac_regs __iomem * regs = vptr->mac_regs; - int i, mii_status; - -+ if (vdebug&5) printk(KERN_NOTICE "velocity_init_registers: entering\n"); -+ - mac_wol_reset(regs); - - switch (type) { - case VELOCITY_INIT_RESET: - case VELOCITY_INIT_WOL: - -+ if (vdebug&4) printk(KERN_NOTICE "velocity_init_registers: RESET or WOL\n"); - netif_stop_queue(vptr->dev); - - /* -@@ -570,12 +597,13 @@ static void velocity_init_registers(stru - - case VELOCITY_INIT_COLD: - default: -+ if (vdebug&4) printk(KERN_NOTICE "velocity_init_registers: COLD or default\n"); - /* - * Do reset - */ - velocity_soft_reset(vptr); -+ if (vdebug&4) printk(KERN_NOTICE "velocity_init_registers: soft reset complete.\n"); - mdelay(5); -- - mac_eeprom_reload(regs); - for (i = 0; i < 6; i++) { - writeb(vptr->dev->dev_addr[i], &(regs->PAR[i])); -@@ -593,11 +621,16 @@ static void velocity_init_registers(stru - */ - BYTE_REG_BITS_SET(CFGB_OFSET, (CFGB_CRANDOM | CFGB_CAP | CFGB_MBA | CFGB_BAKOPT), ®s->CFGB); - -+ if (vdebug&4) printk(KERN_NOTICE "velocity_init_registers: Initializing CAM filter\n"); - /* - * Init CAM filter - */ -+ if (vdebug&8) printk(KERN_NOTICE "velocity: spot debug: about to init CAM filters\n"); -+ mdelay(5); /* MJW - ARM processors, kernel 2.6.19 - this fixes oopses and hangs */ - velocity_init_cam_filter(vptr); -+ if (vdebug&8) printk(KERN_NOTICE "velocity: spot debug: init CAM filters complete\n"); - -+ if (vdebug&4) printk(KERN_NOTICE "velocity_init_registers: Setting packet filter\n"); - /* - * Set packet filter: Receive directed and broadcast address - */ -@@ -607,10 +640,12 @@ static void velocity_init_registers(stru - * Enable MII auto-polling - */ - enable_mii_autopoll(regs); -+ if (vdebug&4) printk(KERN_NOTICE "velocity_init_registers: enable_mii_autopoll complete.\n"); - - vptr->int_mask = INT_MASK_DEF; - -- writel(cpu_to_le32(vptr->rd_pool_dma), ®s->RDBaseLo); -+ /* writel(cpu_to_le32(vptr->rd_pool_dma), ®s->RDBaseLo); BE */ -+ writel((vptr->rd_pool_dma), ®s->RDBaseLo); /* BE */ - writew(vptr->options.numrx - 1, ®s->RDCSize); - mac_rx_queue_run(regs); - mac_rx_queue_wake(regs); -@@ -618,10 +653,13 @@ static void velocity_init_registers(stru - writew(vptr->options.numtx - 1, ®s->TDCSize); - - for (i = 0; i < vptr->num_txq; i++) { -- writel(cpu_to_le32(vptr->td_pool_dma[i]), &(regs->TDBaseLo[i])); -+ /* writel(cpu_to_le32(vptr->td_pool_dma[i]), &(regs->TDBaseLo[i])); BE */ -+ writel((vptr->td_pool_dma[i]), &(regs->TDBaseLo[i])); /* BE */ - mac_tx_queue_run(regs, i); - } - -+ if (vdebug&4) printk(KERN_NOTICE "velocity_init_registers: DMA settings complete.\n"); -+ - init_flow_control_register(vptr); - - writel(CR0_STOP, ®s->CR0Clr); -@@ -640,8 +678,10 @@ static void velocity_init_registers(stru - - enable_flow_control_ability(vptr); - mac_hw_mibs_init(regs); -+ if (vdebug&4) printk(KERN_NOTICE "velocity_init_registers: Set interrupt mask\n"); - mac_write_int_mask(vptr->int_mask, regs); - mac_clear_isr(regs); -+ if (vdebug&4) printk(KERN_NOTICE "velocity_init_registers: complete.\n"); - - } - } -@@ -659,6 +699,7 @@ static int velocity_soft_reset(struct ve - struct mac_regs __iomem * regs = vptr->mac_regs; - int i = 0; - -+ HAIL("velocity_soft_reset"); - writel(CR0_SFRST, ®s->CR0Set); - - for (i = 0; i < W_MAX_TIMEOUT; i++) { -@@ -722,6 +763,7 @@ static int __devinit velocity_found1(str - VELOCITY_FULL_DRV_NAM, VELOCITY_VERSION); - printk(KERN_INFO "Copyright (c) 2002, 2003 VIA Networking Technologies, Inc.\n"); - printk(KERN_INFO "Copyright (c) 2004 Red Hat Inc.\n"); -+ printk(KERN_INFO "BE support, misc. fixes MJW 01Jan2007 - may be unstable\n"); - first = 0; - } - -@@ -934,6 +976,7 @@ static int velocity_init_rings(struct ve - dma_addr_t pool_dma; - u8 *pool; - -+ HAIL("velocity_init_rings"); - /* - * Allocate all RD/TD rings a single pool - */ -@@ -996,6 +1039,7 @@ static int velocity_init_rings(struct ve - static void velocity_free_rings(struct velocity_info *vptr) - { - int size; -+ HAIL("velocity_free_rings"); - - size = vptr->options.numrx * sizeof(struct rx_desc) + - vptr->options.numtx * sizeof(struct tx_desc) * vptr->num_txq; -@@ -1012,6 +1056,7 @@ static inline void velocity_give_many_rx - struct mac_regs __iomem *regs = vptr->mac_regs; - int avail, dirty, unusable; - -+ HAIL("velocity_give_many_rx_descs"); - /* - * RD number must be equal to 4X per hardware spec - * (programming guide rev 1.20, p.13) -@@ -1025,7 +1070,8 @@ static inline void velocity_give_many_rx - dirty = vptr->rd_dirty - unusable; - for (avail = vptr->rd_filled & 0xfffc; avail; avail--) { - dirty = (dirty > 0) ? dirty - 1 : vptr->options.numrx - 1; -- vptr->rd_ring[dirty].rdesc0.owner = OWNED_BY_NIC; -+ /* vptr->rd_ring[dirty].rdesc0.owner = OWNED_BY_NIC; BE */ -+ vptr->rd_ring[dirty].rdesc0 |= cpu_to_le32(BE_OWNED_BY_NIC); /* BE */ - } - - writew(vptr->rd_filled & 0xfffc, ®s->RBRDU); -@@ -1035,12 +1081,14 @@ static inline void velocity_give_many_rx - static int velocity_rx_refill(struct velocity_info *vptr) - { - int dirty = vptr->rd_dirty, done = 0, ret = 0; -+ HAIL("velocity_rx_refill"); - - do { - struct rx_desc *rd = vptr->rd_ring + dirty; - - /* Fine for an all zero Rx desc at init time as well */ -- if (rd->rdesc0.owner == OWNED_BY_NIC) -+ /* if (rd->rdesc0.owner == OWNED_BY_NIC) BE */ -+ if (rd->rdesc0 & cpu_to_le32(BE_OWNED_BY_NIC)) /* BE */ - break; - - if (!vptr->rd_info[dirty].skb) { -@@ -1075,6 +1123,7 @@ static int velocity_init_rd_ring(struct - unsigned int rsize = sizeof(struct velocity_rd_info) * - vptr->options.numrx; - -+ HAIL("velocity_init_rd_ring"); - vptr->rd_info = kmalloc(rsize, GFP_KERNEL); - if(vptr->rd_info == NULL) - goto out; -@@ -1104,6 +1153,7 @@ static void velocity_free_rd_ring(struct - { - int i; - -+ HAIL("velocity_free_rd_ring"); - if (vptr->rd_info == NULL) - return; - -@@ -1145,6 +1195,7 @@ static int velocity_init_td_ring(struct - unsigned int tsize = sizeof(struct velocity_td_info) * - vptr->options.numtx; - -+ HAIL("velocity_init_td_ring"); - /* Init the TD ring entries */ - for (j = 0; j < vptr->num_txq; j++) { - curr = vptr->td_pool_dma[j]; -@@ -1181,6 +1232,7 @@ static void velocity_free_td_ring_entry( - struct velocity_td_info * td_info = &(vptr->td_infos[q][n]); - int i; - -+ HAIL("velocity_free_td_ring_entry"); - if (td_info == NULL) - return; - -@@ -1210,6 +1262,7 @@ static void velocity_free_td_ring(struct - { - int i, j; - -+ HAIL("velocity_free_td_ring"); - for (j = 0; j < vptr->num_txq; j++) { - if (vptr->td_infos[j] == NULL) - continue; -@@ -1237,34 +1290,42 @@ static int velocity_rx_srv(struct veloci - struct net_device_stats *stats = &vptr->stats; - int rd_curr = vptr->rd_curr; - int works = 0; -+ u16 wRSR; /* BE */ - -+ HAILS("velocity_rx_srv", status); - do { - struct rx_desc *rd = vptr->rd_ring + rd_curr; - - if (!vptr->rd_info[rd_curr].skb) - break; - -- if (rd->rdesc0.owner == OWNED_BY_NIC) -+ /* if (rd->rdesc0.owner == OWNED_BY_NIC) BE */ -+ if (rd->rdesc0 & cpu_to_le32(BE_OWNED_BY_NIC)) /* BE */ - break; - - rmb(); - -+ wRSR = (u16)(cpu_to_le32(rd->rdesc0)); /* BE */ - /* - * Don't drop CE or RL error frame although RXOK is off - */ -- if ((rd->rdesc0.RSR & RSR_RXOK) || (!(rd->rdesc0.RSR & RSR_RXOK) && (rd->rdesc0.RSR & (RSR_CE | RSR_RL)))) { -+ /* if ((rd->rdesc0.RSR & RSR_RXOK) || (!(rd->rdesc0.RSR & RSR_RXOK) && (rd->rdesc0.RSR & (RSR_CE | RSR_RL)))) { BE */ -+ if ((wRSR & RSR_RXOK) || (!(wRSR & RSR_RXOK) && (wRSR & (RSR_CE | RSR_RL)))) { /* BE */ - if (velocity_receive_frame(vptr, rd_curr) < 0) - stats->rx_dropped++; - } else { -- if (rd->rdesc0.RSR & RSR_CRC) -+ /* if (rd->rdesc0.RSR & RSR_CRC) BE */ -+ if (wRSR & RSR_CRC) /* BE */ - stats->rx_crc_errors++; -- if (rd->rdesc0.RSR & RSR_FAE) -+ /* if (rd->rdesc0.RSR & RSR_FAE) BE */ -+ if (wRSR & RSR_FAE) /* BE */ - stats->rx_frame_errors++; - - stats->rx_dropped++; - } - -- rd->inten = 1; -+ /* rd->inten = 1; BE */ -+ rd->ltwo |= cpu_to_le32(BE_INT_ENABLE); /* BE */ - - vptr->dev->last_rx = jiffies; - -@@ -1295,13 +1356,21 @@ static int velocity_rx_srv(struct veloci - - static inline void velocity_rx_csum(struct rx_desc *rd, struct sk_buff *skb) - { -+ u8 bCSM; -+ HAIL("velocity_rx_csum"); - skb->ip_summed = CHECKSUM_NONE; - -- if (rd->rdesc1.CSM & CSM_IPKT) { -- if (rd->rdesc1.CSM & CSM_IPOK) { -- if ((rd->rdesc1.CSM & CSM_TCPKT) || -- (rd->rdesc1.CSM & CSM_UDPKT)) { -- if (!(rd->rdesc1.CSM & CSM_TUPOK)) { -+// if (rd->rdesc1.CSM & CSM_IPKT) { -+// if (rd->rdesc1.CSM & CSM_IPOK) { -+// if ((rd->rdesc1.CSM & CSM_TCPKT) || -+// (rd->rdesc1.CSM & CSM_UDPKT)) { -+// if (!(rd->rdesc1.CSM & CSM_TUPOK)) { -+ bCSM = (u8)(cpu_to_le32(rd->rdesc1) >> 16); /* BE */ -+ if (bCSM & CSM_IPKT) { -+ if (bCSM & CSM_IPOK) { -+ if ((bCSM & CSM_TCPKT) || -+ (bCSM & CSM_UDPKT)) { -+ if (!(bCSM & CSM_TUPOK)) { /* BE */ - return; - } - } -@@ -1327,9 +1396,11 @@ static inline int velocity_rx_copy(struc - { - int ret = -1; - -+ HAIL("velocity_rx_copy"); - if (pkt_size < rx_copybreak) { - struct sk_buff *new_skb; - -+ HAIL("velocity_rx_copy (working...)"); - new_skb = dev_alloc_skb(pkt_size + 2); - if (new_skb) { - new_skb->dev = vptr->dev; -@@ -1360,10 +1431,12 @@ static inline int velocity_rx_copy(struc - static inline void velocity_iph_realign(struct velocity_info *vptr, - struct sk_buff *skb, int pkt_size) - { -+ HAIL("velocity_iph_realign"); - /* FIXME - memmove ? */ - if (vptr->flags & VELOCITY_FLAGS_IP_ALIGN) { - int i; - -+ HAIL("velocity_iph_realign (working...)"); - for (i = pkt_size; i >= 0; i--) - *(skb->data + i + 2) = *(skb->data + i); - skb_reserve(skb, 2); -@@ -1382,19 +1455,27 @@ static inline void velocity_iph_realign( - static int velocity_receive_frame(struct velocity_info *vptr, int idx) - { - void (*pci_action)(struct pci_dev *, dma_addr_t, size_t, int); -+ u16 pkt_len; /* BE */ -+ u16 wRSR; /* BE */ -+ struct sk_buff *skb; - struct net_device_stats *stats = &vptr->stats; - struct velocity_rd_info *rd_info = &(vptr->rd_info[idx]); - struct rx_desc *rd = &(vptr->rd_ring[idx]); -- int pkt_len = rd->rdesc0.len; -- struct sk_buff *skb; -+ /* int pkt_len = rd->rdesc0.len BE */; -+ -+ pkt_len = ((cpu_to_le32(rd->rdesc0) >> 16) & 0x00003FFFUL); /* BE */ -+ wRSR = (u16)(cpu_to_le32(rd->rdesc0)); /* BE */ - -- if (rd->rdesc0.RSR & (RSR_STP | RSR_EDP)) { -+ HAIL("velocity_receive_frame"); -+ /* if (rd->rdesc0.RSR & (RSR_STP | RSR_EDP)) { BE */ -+ if (wRSR & (RSR_STP | RSR_EDP)) { /* BE */ - VELOCITY_PRT(MSG_LEVEL_VERBOSE, KERN_ERR " %s : the received frame span multple RDs.\n", vptr->dev->name); - stats->rx_length_errors++; - return -EINVAL; - } - -- if (rd->rdesc0.RSR & RSR_MAR) -+ /* if (rd->rdesc0.RSR & RSR_MAR) BE */ -+ if (wRSR & RSR_MAR) /* BE */ - vptr->stats.multicast++; - - skb = rd_info->skb; -@@ -1407,7 +1488,8 @@ static int velocity_receive_frame(struct - */ - - if (vptr->flags & VELOCITY_FLAGS_VAL_PKT_LEN) { -- if (rd->rdesc0.RSR & RSR_RL) { -+ /* if (rd->rdesc0.RSR & RSR_RL) { BE */ -+ if (wRSR & RSR_RL) { /* BE */ - stats->rx_length_errors++; - return -EINVAL; - } -@@ -1451,6 +1533,7 @@ static int velocity_alloc_rx_buf(struct - struct rx_desc *rd = &(vptr->rd_ring[idx]); - struct velocity_rd_info *rd_info = &(vptr->rd_info[idx]); - -+ HAIL("velocity_alloc_rx_buf"); - rd_info->skb = dev_alloc_skb(vptr->rx_buf_sz + 64); - if (rd_info->skb == NULL) - return -ENOMEM; -@@ -1468,10 +1551,14 @@ static int velocity_alloc_rx_buf(struct - */ - - *((u32 *) & (rd->rdesc0)) = 0; -- rd->len = cpu_to_le32(vptr->rx_buf_sz); -- rd->inten = 1; -+ /* rd->len = cpu_to_le32(vptr->rx_buf_sz); BE */ -+ /* rd->inten = 1; BE */ - rd->pa_low = cpu_to_le32(rd_info->skb_dma); -- rd->pa_high = 0; -+ /* rd->pa_high = 0; BE */ -+ rd->ltwo &= cpu_to_le32(0xC000FFFFUL); /* BE */ -+ rd->ltwo |= cpu_to_le32((vptr->rx_buf_sz << 16)); /* BE */ -+ rd->ltwo |= cpu_to_le32(BE_INT_ENABLE); /* BE */ -+ rd->ltwo &= cpu_to_le32(0xFFFF0000UL); /* BE */ - return 0; - } - -@@ -1492,9 +1579,11 @@ static int velocity_tx_srv(struct veloci - int full = 0; - int idx; - int works = 0; -+ u16 wTSR; /* BE */ - struct velocity_td_info *tdinfo; - struct net_device_stats *stats = &vptr->stats; - -+ HAILS("velocity_tx_srv", status); - for (qnum = 0; qnum < vptr->num_txq; qnum++) { - for (idx = vptr->td_tail[qnum]; vptr->td_used[qnum] > 0; - idx = (idx + 1) % vptr->options.numtx) { -@@ -1505,22 +1594,29 @@ static int velocity_tx_srv(struct veloci - td = &(vptr->td_rings[qnum][idx]); - tdinfo = &(vptr->td_infos[qnum][idx]); - -- if (td->tdesc0.owner == OWNED_BY_NIC) -+ /* if (td->tdesc0.owner == OWNED_BY_NIC) BE */ -+ if (td->tdesc0 & cpu_to_le32(BE_OWNED_BY_NIC)) /* BE */ - break; - - if ((works++ > 15)) - break; - -- if (td->tdesc0.TSR & TSR0_TERR) { -+ wTSR = (u16)cpu_to_le32(td->tdesc0); -+ /* if (td->tdesc0.TSR & TSR0_TERR) { BE */ -+ if (wTSR & TSR0_TERR) { /* BE */ - stats->tx_errors++; - stats->tx_dropped++; -- if (td->tdesc0.TSR & TSR0_CDH) -+ /* if (td->tdesc0.TSR & TSR0_CDH) BE */ -+ if (wTSR & TSR0_CDH) /* BE */ - stats->tx_heartbeat_errors++; -- if (td->tdesc0.TSR & TSR0_CRS) -+ /* if (td->tdesc0.TSR & TSR0_CRS) BE */ -+ if (wTSR & TSR0_CRS) /* BE */ - stats->tx_carrier_errors++; -- if (td->tdesc0.TSR & TSR0_ABT) -+ /* if (td->tdesc0.TSR & TSR0_ABT) BE */ -+ if (wTSR & TSR0_ABT) /* BE */ - stats->tx_aborted_errors++; -- if (td->tdesc0.TSR & TSR0_OWC) -+ /* if (td->tdesc0.TSR & TSR0_OWC) BE */ -+ if (wTSR & TSR0_OWC) /* BE */ - stats->tx_window_errors++; - } else { - stats->tx_packets++; -@@ -1609,6 +1705,7 @@ static void velocity_print_link_status(s - - static void velocity_error(struct velocity_info *vptr, int status) - { -+ HAILS("velocity_error", status); - - if (status & ISR_TXSTLI) { - struct mac_regs __iomem * regs = vptr->mac_regs; -@@ -1698,6 +1795,7 @@ static void velocity_free_tx_buf(struct - struct sk_buff *skb = tdinfo->skb; - int i; - -+ HAIL("velocity_free_tx_buf"); - /* - * Don't unmap the pre-allocated tx_bufs - */ -@@ -1901,6 +1999,7 @@ static int velocity_xmit(struct sk_buff - struct velocity_td_info *tdinfo; - unsigned long flags; - int index; -+ u32 lbufsz; /* BE */ - - int pktlen = skb->len; - -@@ -1917,9 +2016,18 @@ static int velocity_xmit(struct sk_buff - td_ptr = &(vptr->td_rings[qnum][index]); - tdinfo = &(vptr->td_infos[qnum][index]); - -- td_ptr->tdesc1.TCPLS = TCPLS_NORMAL; -- td_ptr->tdesc1.TCR = TCR0_TIC; -- td_ptr->td_buf[0].queue = 0; -+ td_ptr->tdesc0 = 0x00000000UL; /* BE */ -+ td_ptr->tdesc1 = 0x00000000UL; /* BE */ -+ -+ /* td_ptr->tdesc1.TCPLS = TCPLS_NORMAL; BE */ -+ td_ptr->tdesc1 &= cpu_to_le32(0xfcffffffUL); /* BE */ -+ td_ptr->tdesc1 |= cpu_to_le32(((u32)TCPLS_NORMAL) << 24); /* BE */ -+ -+ /* td_ptr->tdesc1.TCR = TCR0_TIC; BE */ -+ td_ptr->tdesc1 |= cpu_to_le32(BE_TCR_TIC); /* BE */ -+ -+ /* td_ptr->td_buf[0].queue = 0; BE */ -+ td_ptr->td_buf[0].ltwo &= cpu_to_le32(~BE_QUEUE_ENABLE); /* BE */ - - /* - * Pad short frames. -@@ -1931,20 +2039,36 @@ static int velocity_xmit(struct sk_buff - memset(tdinfo->buf + skb->len, 0, ETH_ZLEN - skb->len); - tdinfo->skb = skb; - tdinfo->skb_dma[0] = tdinfo->buf_dma; -- td_ptr->tdesc0.pktsize = pktlen; -+ /* td_ptr->tdesc0.pktsize = pktlen; */ -+ td_ptr->tdesc0 &= cpu_to_le32(0xc000ffffUL); /* BE */ -+ lbufsz = pktlen; /* Assign, and make sure it's unsigned 32 bits - BE */ -+ lbufsz = lbufsz << 16; /* BE - shift over */ -+ td_ptr->tdesc0 |= cpu_to_le32(lbufsz); /* BE */ -+ - td_ptr->td_buf[0].pa_low = cpu_to_le32(tdinfo->skb_dma[0]); -- td_ptr->td_buf[0].pa_high = 0; -- td_ptr->td_buf[0].bufsize = td_ptr->tdesc0.pktsize; -+ /* td_ptr->td_buf[0].pa_high = 0; */ -+ /* td_ptr->td_buf[0].bufsize = td_ptr->tdesc0.pktsize; */ -+ td_ptr->td_buf[0].ltwo = cpu_to_le32(lbufsz); /* BE */ - tdinfo->nskb_dma = 1; -- td_ptr->tdesc1.CMDZ = 2; -+ /* td_ptr->tdesc1.CMDZ = 2; */ -+ td_ptr->tdesc1 &= cpu_to_le32(0x0fffffffUL); /* BE */ -+ td_ptr->tdesc1 |= cpu_to_le32(((u32)0x2) << 28); /* BE */ - } else - #ifdef VELOCITY_ZERO_COPY_SUPPORT -+ /* -+ * BE - NOTE on the VELOCITY_ZERO_COPY_SUPPORT: -+ * This block of code has NOT been patched up for BE support, as -+ * it is certainly broken -- if it compiles at all. Since the BE -+ * fixes depend on the broken code, attempts to convert to BE support -+ * would almost certainly confuse more than help. -+ */ - if (skb_shinfo(skb)->nr_frags > 0) { - int nfrags = skb_shinfo(skb)->nr_frags; - tdinfo->skb = skb; - if (nfrags > 6) { - skb_copy_from_linear_data(skb, tdinfo->buf, skb->len); - tdinfo->skb_dma[0] = tdinfo->buf_dma; -+ /* BE: Er, exactly what value are we assigning in this next line? */ - td_ptr->tdesc0.pktsize = - td_ptr->td_buf[0].pa_low = cpu_to_le32(tdinfo->skb_dma[0]); - td_ptr->td_buf[0].pa_high = 0; -@@ -1961,6 +2085,7 @@ static int velocity_xmit(struct sk_buff - /* FIXME: support 48bit DMA later */ - td_ptr->td_buf[i].pa_low = cpu_to_le32(tdinfo->skb_dma); - td_ptr->td_buf[i].pa_high = 0; -+ /* BE: This next line can't be right: */ - td_ptr->td_buf[i].bufsize = skb->len->skb->data_len; - - for (i = 0; i < nfrags; i++) { -@@ -1978,7 +2103,7 @@ static int velocity_xmit(struct sk_buff - } - - } else --#endif -+#endif /* (broken) VELOCITY_ZERO_COPY_SUPPORT */ - { - /* - * Map the linear network buffer into PCI space and -@@ -1986,19 +2111,30 @@ static int velocity_xmit(struct sk_buff - */ - tdinfo->skb = skb; - tdinfo->skb_dma[0] = pci_map_single(vptr->pdev, skb->data, pktlen, PCI_DMA_TODEVICE); -- td_ptr->tdesc0.pktsize = pktlen; -+ /* td_ptr->tdesc0.pktsize = pktlen; BE */ -+ td_ptr->tdesc0 &= cpu_to_le32(0xc000ffffUL); /* BE */ -+ lbufsz = pktlen; /* Assign, and make sure it's unsigned 32 bits - BE */ -+ lbufsz = lbufsz << 16; /* BE */ -+ td_ptr->tdesc0 |= cpu_to_le32(lbufsz); /* BE */ - td_ptr->td_buf[0].pa_low = cpu_to_le32(tdinfo->skb_dma[0]); -- td_ptr->td_buf[0].pa_high = 0; -- td_ptr->td_buf[0].bufsize = td_ptr->tdesc0.pktsize; -+ /* td_ptr->td_buf[0].pa_high = 0; BE */ -+ /* td_ptr->td_buf[0].bufsize = td_ptr->tdesc0.pktsize; BE */ -+ td_ptr->td_buf[0].ltwo = cpu_to_le32(lbufsz); /* BE */ -+ - tdinfo->nskb_dma = 1; -- td_ptr->tdesc1.CMDZ = 2; -+ /* td_ptr->tdesc1.CMDZ = 2; BE */ -+ td_ptr->tdesc1 &= cpu_to_le32(0x0fffffffUL); /* BE */ -+ td_ptr->tdesc1 |= cpu_to_le32(((u32)0x2) << 28);/* BE */ - } - - if (vptr->flags & VELOCITY_FLAGS_TAGGING) { -- td_ptr->tdesc1.pqinf.VID = (vptr->options.vid & 0xfff); -- td_ptr->tdesc1.pqinf.priority = 0; -- td_ptr->tdesc1.pqinf.CFI = 0; -- td_ptr->tdesc1.TCR |= TCR0_VETAG; -+ /* td_ptr->tdesc1.pqinf.priority = 0; BE */ -+ /* td_ptr->tdesc1.pqinf.CFI = 0; BE */ -+ td_ptr->tdesc1 &= cpu_to_le32(0xFFFF0000UL); /* BE */ -+ /* td_ptr->tdesc1.pqinf.VID = (vptr->options.vid & 0xfff); BE */ -+ td_ptr->tdesc1 |= cpu_to_le32((vptr->options.vid & 0xfff)); /* BE */ -+ /* td_ptr->tdesc1.TCR |= TCR0_VETAG; BE */ -+ td_ptr->tdesc1 |= cpu_to_le32(BE_TCR_VETAG); /* BE */ - } - - /* -@@ -2008,26 +2144,34 @@ static int velocity_xmit(struct sk_buff - && (skb->ip_summed == CHECKSUM_PARTIAL)) { - const struct iphdr *ip = ip_hdr(skb); - if (ip->protocol == IPPROTO_TCP) -- td_ptr->tdesc1.TCR |= TCR0_TCPCK; -+ /* td_ptr->tdesc1.TCR |= TCR0_TCPCK; BE */ -+ td_ptr->tdesc1 |= cpu_to_le32(BE_TCR_TCPCK); /* BE */ - else if (ip->protocol == IPPROTO_UDP) -- td_ptr->tdesc1.TCR |= (TCR0_UDPCK); -- td_ptr->tdesc1.TCR |= TCR0_IPCK; -- } -+ /* td_ptr->tdesc1.TCR |= (TCR0_UDPCK); BE */ -+ td_ptr->tdesc1 |= cpu_to_le32(BE_TCR_UDPCK); /* BE */ -+ /* td_ptr->tdesc1.TCR |= TCR0_IPCK; BE */ -+ td_ptr->tdesc1 |= cpu_to_le32(BE_TCR_IPCK); /* BE */ -+ } - { - - int prev = index - 1; - - if (prev < 0) - prev = vptr->options.numtx - 1; -- td_ptr->tdesc0.owner = OWNED_BY_NIC; -+ /* td_ptr->tdesc0.owner = OWNED_BY_NIC; BE */ -+ td_ptr->tdesc0 |= cpu_to_le32(BE_OWNED_BY_NIC); /* BE */ - vptr->td_used[qnum]++; - vptr->td_curr[qnum] = (index + 1) % vptr->options.numtx; - - if (AVAIL_TD(vptr, qnum) < 1) - netif_stop_queue(dev); - -- td_ptr = &(vptr->td_rings[qnum][prev]); -- td_ptr->td_buf[0].queue = 1; -+ td_ptr = &(vptr->td_rings[qnum][prev]); -+ /* td_ptr->td_buf[0].queue = 1; BE */ -+ td_ptr->td_buf[0].ltwo |= cpu_to_le32(BE_QUEUE_ENABLE); /* BE */ -+ if (vdebug&2) printk(KERN_NOTICE "velocity_xmit: (%s) len=%d idx=%d tdesc0=0x%x tdesc1=0x%x ltwo=0x%x\n", -+ (pktlen<ETH_ZLEN) ? "short" : "normal", pktlen, index, -+ td_ptr->tdesc0, td_ptr->tdesc1, td_ptr->td_buf[0].ltwo); - mac_tx_queue_wake(vptr->mac_regs, qnum); - } - dev->trans_start = jiffies; -@@ -2053,7 +2197,7 @@ static int velocity_intr(int irq, void * - u32 isr_status; - int max_count = 0; - -- -+ HAIL("velocity_intr"); - spin_lock(&vptr->lock); - isr_status = mac_read_isr(vptr->mac_regs); - -@@ -2072,7 +2216,10 @@ static int velocity_intr(int irq, void * - - while (isr_status != 0) { - mac_write_isr(vptr->mac_regs, isr_status); -- if (isr_status & (~(ISR_PRXI | ISR_PPRXI | ISR_PTXI | ISR_PPTXI))) -+ HAILS("velocity_intr",isr_status); -+ /* MJW - velocity_error is ALWAYS called; need to mask off some other flags */ -+ /* if (isr_status & (~(ISR_PRXI | ISR_PPRXI | ISR_PTXI | ISR_PPTXI))) */ -+ if (isr_status & (~(ISR_PRXI | ISR_PPRXI | ISR_PTXI | ISR_PPTXI | ISR_PTX0I | ISR_ISR0))) - velocity_error(vptr, isr_status); - if (isr_status & (ISR_PRXI | ISR_PPRXI)) - max_count += velocity_rx_srv(vptr, isr_status); -@@ -2110,6 +2257,7 @@ static void velocity_set_multi(struct ne - int i; - struct dev_mc_list *mclist; - -+ HAIL("velocity_set_multi"); - if (dev->flags & IFF_PROMISC) { /* Set promiscuous. */ - writel(0xffffffff, ®s->MARCAM[0]); - writel(0xffffffff, ®s->MARCAM[4]); -@@ -2153,6 +2301,7 @@ static struct net_device_stats *velocity - { - struct velocity_info *vptr = netdev_priv(dev); - -+ HAIL("net_device_stats"); - /* If the hardware is down, don't touch MII */ - if(!netif_running(dev)) - return &vptr->stats; -@@ -2197,6 +2346,7 @@ static int velocity_ioctl(struct net_dev - struct velocity_info *vptr = netdev_priv(dev); - int ret; - -+ HAIL("velocity_ioctl"); - /* If we are asked for information and the device is power - saving then we need to bring the device back up to talk to it */ - -@@ -2415,6 +2565,7 @@ static int velocity_mii_read(struct mac_ - { - u16 ww; - -+ HAIL("velocity_mii_read"); - /* - * Disable MIICR_MAUTO, so that mii addr can be set normally - */ -@@ -2451,6 +2602,7 @@ static int velocity_mii_write(struct mac - { - u16 ww; - -+ HAIL("velocity_mii_write"); - /* - * Disable MIICR_MAUTO, so that mii addr can be set normally - */ -Index: linux-2.6.23.17/drivers/net/via-velocity.h -=================================================================== ---- linux-2.6.23.17.orig/drivers/net/via-velocity.h -+++ linux-2.6.23.17/drivers/net/via-velocity.h -@@ -196,64 +196,70 @@ - * Receive descriptor - */ - --struct rdesc0 { -- u16 RSR; /* Receive status */ -- u16 len:14; /* Received packet length */ -- u16 reserved:1; -- u16 owner:1; /* Who owns this buffer ? */ --}; -- --struct rdesc1 { -- u16 PQTAG; -- u8 CSM; -- u8 IPKT; --}; -+//struct rdesc0 { -+// u16 RSR; /* Receive status */ -+// u16 len:14; /* Received packet length */ -+// u16 reserved:1; -+// u16 owner:1; /* Who owns this buffer ? */ -+//}; -+ -+//struct rdesc1 { -+// u16 PQTAG; -+// u8 CSM; -+// u8 IPKT; -+//}; - - struct rx_desc { -- struct rdesc0 rdesc0; -- struct rdesc1 rdesc1; -+// struct rdesc0 rdesc0; -+// struct rdesc1 rdesc1; -+ u32 rdesc0; -+ u32 rdesc1; - u32 pa_low; /* Low 32 bit PCI address */ -- u16 pa_high; /* Next 16 bit PCI address (48 total) */ -- u16 len:15; /* Frame size */ -- u16 inten:1; /* Enable interrupt */ -+// u16 pa_high; /* Next 16 bit PCI address (48 total) */ -+// u16 len:15; /* Frame size */ -+// u16 inten:1; /* Enable interrupt */ -+ u32 ltwo; - } __attribute__ ((__packed__)); - - /* - * Transmit descriptor - */ - --struct tdesc0 { -- u16 TSR; /* Transmit status register */ -- u16 pktsize:14; /* Size of frame */ -- u16 reserved:1; -- u16 owner:1; /* Who owns the buffer */ --}; -- --struct pqinf { /* Priority queue info */ -- u16 VID:12; -- u16 CFI:1; -- u16 priority:3; --} __attribute__ ((__packed__)); -- --struct tdesc1 { -- struct pqinf pqinf; -- u8 TCR; -- u8 TCPLS:2; -- u8 reserved:2; -- u8 CMDZ:4; --} __attribute__ ((__packed__)); -+//struct tdesc0 { -+// u16 TSR; /* Transmit status register */ -+// u16 pktsize:14; /* Size of frame */ -+// u16 reserved:1; -+// u16 owner:1; /* Who owns the buffer */ -+//}; -+ -+//struct pqinf { /* Priority queue info */ -+// u16 VID:12; -+// u16 CFI:1; -+// u16 priority:3; -+//} __attribute__ ((__packed__)); -+ -+//struct tdesc1 { -+// struct pqinf pqinf; -+// u8 TCR; -+// u8 TCPLS:2; -+// u8 reserved:2; -+// u8 CMDZ:4; -+//} __attribute__ ((__packed__)); - - struct td_buf { - u32 pa_low; -- u16 pa_high; -- u16 bufsize:14; -- u16 reserved:1; -- u16 queue:1; -+// u16 pa_high; -+// u16 bufsize:14; -+// u16 reserved:1; -+// u16 queue:1; -+ u32 ltwo; - } __attribute__ ((__packed__)); - - struct tx_desc { -- struct tdesc0 tdesc0; -- struct tdesc1 tdesc1; -+// struct tdesc0 tdesc0; -+// struct tdesc1 tdesc1; -+ u32 tdesc0; -+ u32 tdesc1; - struct td_buf td_buf[7]; - }; - -@@ -279,6 +285,16 @@ enum velocity_owner { - OWNED_BY_NIC = 1 - }; - -+/* Constants added for the BE fixes */ -+#define BE_OWNED_BY_NIC 0x80000000UL -+#define BE_INT_ENABLE 0x80000000UL -+#define BE_QUEUE_ENABLE 0x80000000UL -+#define BE_TCR_TIC 0x00800000UL -+#define BE_TCR_VETAG 0x00200000UL -+#define BE_TCR_TCPCK 0x00040000UL -+#define BE_TCR_UDPCK 0x00080000UL -+#define BE_TCR_IPCK 0x00100000UL -+ - - /* - * MAC registers and macros. -@@ -1698,6 +1714,7 @@ enum velocity_flow_cntl_type { - }; - - struct velocity_opt { -+ int velo_debug; /* debug flag */ - int numrx; /* Number of RX descriptors */ - int numtx; /* Number of TX descriptors */ - enum speed_opt spd_dpx; /* Media link mode */ diff --git a/target/linux/ixp4xx/patches-2.6.23/016-dsmg600_auto_power_on.patch b/target/linux/ixp4xx/patches-2.6.23/016-dsmg600_auto_power_on.patch deleted file mode 100644 index b0aee75dd4..0000000000 --- a/target/linux/ixp4xx/patches-2.6.23/016-dsmg600_auto_power_on.patch +++ /dev/null @@ -1,111 +0,0 @@ -Upgrade the power and reset button handling for the DSMG600: - * Remove the superfluous declaration of ctrl_alt_del(). - * Convert GPIO and IRQ handling to use the <asm/gpio.h> api. - * Perform the reset on the release of the power button, so that - NAS devices which have been set to auto-power-on (by bridging - the power button) do not continuously power cycle. - * Remove all superflous constants from dsmg600.h - -Signed-off-by: Rod Whitby <rod@whitby.id.au> - ---- - arch/arm/mach-ixp4xx/dsmg600-power.c | 24 ++++++++++++++---------- - include/asm-arm/arch-ixp4xx/dsmg600.h | 7 +------ - 2 files changed, 15 insertions(+), 16 deletions(-) - -Index: linux-2.6.23.17/arch/arm/mach-ixp4xx/dsmg600-power.c -=================================================================== ---- linux-2.6.23.17.orig/arch/arm/mach-ixp4xx/dsmg600-power.c -+++ linux-2.6.23.17/arch/arm/mach-ixp4xx/dsmg600-power.c -@@ -26,10 +26,9 @@ - #include <linux/jiffies.h> - #include <linux/timer.h> - -+#include <asm/gpio.h> - #include <asm/mach-types.h> - --extern void ctrl_alt_del(void); -- - /* This is used to make sure the power-button pusher is serious. The button - * must be held until the value of this counter reaches zero. - */ -@@ -47,9 +46,16 @@ static void dsmg600_power_handler(unsign - * state of the power button. - */ - -- if (*IXP4XX_GPIO_GPINR & DSMG600_PB_BM) { -+ if (gpio_get_value(DSMG600_PB_GPIO)) { - - /* IO Pin is 1 (button pushed) */ -+ if (power_button_countdown > 0) { -+ power_button_countdown--; -+ } -+ -+ } else { -+ -+ /* Done on button release, to allow for auto-power-on mods. */ - if (power_button_countdown == 0) { - /* Signal init to do the ctrlaltdel action, this will bypass - * init if it hasn't started and do a kernel_restart. -@@ -58,11 +64,9 @@ static void dsmg600_power_handler(unsign - - /* Change the state of the power LED to "blink" */ - gpio_line_set(DSMG600_LED_PWR_GPIO, IXP4XX_GPIO_LOW); -+ } else { -+ power_button_countdown = PBUTTON_HOLDDOWN_COUNT; - } -- power_button_countdown--; -- -- } else { -- power_button_countdown = PBUTTON_HOLDDOWN_COUNT; - } - - mod_timer(&dsmg600_power_timer, jiffies + msecs_to_jiffies(500)); -@@ -81,12 +85,12 @@ static int __init dsmg600_power_init(voi - if (!(machine_is_dsmg600())) - return 0; - -- if (request_irq(DSMG600_RB_IRQ, &dsmg600_reset_handler, -+ if (request_irq(gpio_to_irq(DSMG600_RB_GPIO), &dsmg600_reset_handler, - IRQF_DISABLED | IRQF_TRIGGER_LOW, "DSM-G600 reset button", - NULL) < 0) { - - printk(KERN_DEBUG "Reset Button IRQ %d not available\n", -- DSMG600_RB_IRQ); -+ gpio_to_irq(DSMG600_RB_GPIO)); - - return -EIO; - } -@@ -114,7 +118,7 @@ static void __exit dsmg600_power_exit(vo - - del_timer_sync(&dsmg600_power_timer); - -- free_irq(DSMG600_RB_IRQ, NULL); -+ free_irq(gpio_to_irq(DSMG600_RB_GPIO), NULL); - } - - module_init(dsmg600_power_init); -Index: linux-2.6.23.17/include/asm-arm/arch-ixp4xx/dsmg600.h -=================================================================== ---- linux-2.6.23.17.orig/include/asm-arm/arch-ixp4xx/dsmg600.h -+++ linux-2.6.23.17/include/asm-arm/arch-ixp4xx/dsmg600.h -@@ -40,18 +40,13 @@ - /* Buttons */ - - #define DSMG600_PB_GPIO 15 /* power button */ --#define DSMG600_PB_BM (1L << DSMG600_PB_GPIO) -- - #define DSMG600_RB_GPIO 3 /* reset button */ - --#define DSMG600_RB_IRQ IRQ_IXP4XX_GPIO3 -+/* Power control */ - - #define DSMG600_PO_GPIO 2 /* power off */ - - /* LEDs */ - - #define DSMG600_LED_PWR_GPIO 0 --#define DSMG600_LED_PWR_BM (1L << DSMG600_LED_PWR_GPIO) -- - #define DSMG600_LED_WLAN_GPIO 14 --#define DSMG600_LED_WLAN_BM (1L << DSMG600_LED_WLAN_GPIO) diff --git a/target/linux/ixp4xx/patches-2.6.23/017-nas100d_auto_power_on.patch b/target/linux/ixp4xx/patches-2.6.23/017-nas100d_auto_power_on.patch deleted file mode 100644 index bf6bc078ae..0000000000 --- a/target/linux/ixp4xx/patches-2.6.23/017-nas100d_auto_power_on.patch +++ /dev/null @@ -1,188 +0,0 @@ -Upgrade the power and reset button handling for the NAS100D: - * Convert GPIO and IRQ handling to use the <asm/gpio.h> api. - * Perform the reset only after the power button has been held down - for at least two seconds. Do the reset on the release of the power - button, so that NAS devices which have been set to auto-power-on (by - bridging the power button) do not continuously power cycle. - * Remove all superflous constants from nas100d.h - * Add LED constants to nas100d.h while we're there. -Also, update the board LED setup code to use constants. - -Signed-off-by: Rod Whitby <rod@whitby.id.au> - -Index: linux-2.6.23.17/arch/arm/mach-ixp4xx/nas100d-power.c -=================================================================== ---- linux-2.6.23.17.orig/arch/arm/mach-ixp4xx/nas100d-power.c -+++ linux-2.6.23.17/arch/arm/mach-ixp4xx/nas100d-power.c -@@ -21,15 +21,61 @@ - #include <linux/irq.h> - #include <linux/module.h> - #include <linux/reboot.h> -+#include <linux/jiffies.h> -+#include <linux/timer.h> - -+#include <asm/gpio.h> - #include <asm/mach-types.h> - --static irqreturn_t nas100d_reset_handler(int irq, void *dev_id) -+extern void ctrl_alt_del(void); -+ -+/* This is used to make sure the power-button pusher is serious. The button -+ * must be held until the value of this counter reaches zero. -+ */ -+static volatile int power_button_countdown; -+ -+/* Must hold the button down for at least this many counts to be processed */ -+#define PBUTTON_HOLDDOWN_COUNT 4 /* 2 secs */ -+ -+static void nas100d_power_handler(unsigned long data); -+static DEFINE_TIMER(nas100d_power_timer, nas100d_power_handler, 0, 0); -+ -+static void nas100d_power_handler(unsigned long data) - { -- /* Signal init to do the ctrlaltdel action, this will bypass init if -- * it hasn't started and do a kernel_restart. -+ /* This routine is called twice per second to check the -+ * state of the power button. - */ -- ctrl_alt_del(); -+ -+ if (gpio_get_value(NAS100D_PB_GPIO)) { -+ -+ /* IO Pin is 1 (button pushed) */ -+ if (power_button_countdown > 0) { -+ power_button_countdown--; -+ } -+ -+ } else { -+ -+ /* Done on button release, to allow for auto-power-on mods. */ -+ if (power_button_countdown == 0) { -+ /* Signal init to do the ctrlaltdel action, this will bypass -+ * init if it hasn't started and do a kernel_restart. -+ */ -+ ctrl_alt_del(); -+ -+ /* Change the state of the power LED to "blink" */ -+ gpio_line_set(NAS100D_LED_PWR_GPIO, IXP4XX_GPIO_LOW); -+ } else { -+ power_button_countdown = PBUTTON_HOLDDOWN_COUNT; -+ } -+ } -+ -+ mod_timer(&nas100d_power_timer, jiffies + msecs_to_jiffies(500)); -+} -+ -+static irqreturn_t nas100d_reset_handler(int irq, void *dev_id) -+{ -+ /* This is the paper-clip reset, it shuts the machine down directly. */ -+ machine_power_off(); - - return IRQ_HANDLED; - } -@@ -39,17 +85,30 @@ static int __init nas100d_power_init(voi - if (!(machine_is_nas100d())) - return 0; - -- set_irq_type(NAS100D_RB_IRQ, IRQT_LOW); -+ set_irq_type(gpio_to_irq(NAS100D_RB_GPIO), IRQT_LOW); - -- if (request_irq(NAS100D_RB_IRQ, &nas100d_reset_handler, -+ if (request_irq(gpio_to_irq(NAS100D_RB_GPIO), &nas100d_reset_handler, - IRQF_DISABLED, "NAS100D reset button", NULL) < 0) { - - printk(KERN_DEBUG "Reset Button IRQ %d not available\n", -- NAS100D_RB_IRQ); -+ gpio_to_irq(NAS100D_RB_GPIO)); - - return -EIO; - } - -+ /* The power button on the Iomega NAS100d is on GPIO 14, but -+ * it cannot handle interrupts on that GPIO line. So we'll -+ * have to poll it with a kernel timer. -+ */ -+ -+ /* Make sure that the power button GPIO is set up as an input */ -+ gpio_line_config(NAS100D_PB_GPIO, IXP4XX_GPIO_IN); -+ -+ /* Set the initial value for the power button IRQ handler */ -+ power_button_countdown = PBUTTON_HOLDDOWN_COUNT; -+ -+ mod_timer(&nas100d_power_timer, jiffies + msecs_to_jiffies(500)); -+ - return 0; - } - -@@ -58,7 +117,9 @@ static void __exit nas100d_power_exit(vo - if (!(machine_is_nas100d())) - return; - -- free_irq(NAS100D_RB_IRQ, NULL); -+ del_timer_sync(&nas100d_power_timer); -+ -+ free_irq(gpio_to_irq(NAS100D_RB_GPIO), NULL); - } - - module_init(nas100d_power_init); -Index: linux-2.6.23.17/include/asm-arm/arch-ixp4xx/nas100d.h -=================================================================== ---- linux-2.6.23.17.orig/include/asm-arm/arch-ixp4xx/nas100d.h -+++ linux-2.6.23.17/include/asm-arm/arch-ixp4xx/nas100d.h -@@ -38,15 +38,15 @@ - - /* Buttons */ - --#define NAS100D_PB_GPIO 14 --#define NAS100D_RB_GPIO 4 -+#define NAS100D_PB_GPIO 14 /* power button */ -+#define NAS100D_RB_GPIO 4 /* reset button */ -+ -+/* Power control */ -+ - #define NAS100D_PO_GPIO 12 /* power off */ - --#define NAS100D_PB_IRQ IRQ_IXP4XX_GPIO14 --#define NAS100D_RB_IRQ IRQ_IXP4XX_GPIO4 -+/* LEDs */ - --/* --#define NAS100D_PB_BM (1L << NAS100D_PB_GPIO) --#define NAS100D_PO_BM (1L << NAS100D_PO_GPIO) --#define NAS100D_RB_BM (1L << NAS100D_RB_GPIO) --*/ -+#define NAS100D_LED_WLAN_GPIO 0 -+#define NAS100D_LED_DISK_GPIO 3 -+#define NAS100D_LED_PWR_GPIO 15 -Index: linux-2.6.23.17/arch/arm/mach-ixp4xx/nas100d-setup.c -=================================================================== ---- linux-2.6.23.17.orig/arch/arm/mach-ixp4xx/nas100d-setup.c -+++ linux-2.6.23.17/arch/arm/mach-ixp4xx/nas100d-setup.c -@@ -42,20 +42,20 @@ static struct platform_device nas100d_fl - static struct resource nas100d_led_resources[] = { - { - .name = "wlan", /* green led */ -- .start = 0, -- .end = 0, -+ .start = NAS100D_LED_WLAN_GPIO, -+ .end = NAS100D_LED_WLAN_GPIO, - .flags = IXP4XX_GPIO_LOW, - }, - { -- .name = "ready", /* blue power led (off is flashing!) */ -- .start = 15, -- .end = 15, -+ .name = "power", /* blue power led (off is flashing!) */ -+ .start = NAS100D_LED_PWR_GPIO, -+ .end = NAS100D_LED_PWR_GPIO, - .flags = IXP4XX_GPIO_LOW, - }, - { - .name = "disk", /* yellow led */ -- .start = 3, -- .end = 3, -+ .start = NAS100D_LED_DISK_GPIO, -+ .end = NAS100D_LED_DISK_GPIO, - .flags = IXP4XX_GPIO_LOW, - }, - }; diff --git a/target/linux/ixp4xx/patches-2.6.23/020-ixp4xx_i2c_gpio.patch b/target/linux/ixp4xx/patches-2.6.23/020-ixp4xx_i2c_gpio.patch deleted file mode 100644 index 89d39903c5..0000000000 --- a/target/linux/ixp4xx/patches-2.6.23/020-ixp4xx_i2c_gpio.patch +++ /dev/null @@ -1,232 +0,0 @@ -Migrate all ixp4xx devices to the bitbanging I2C bus driver utilizing -the arch-neutral GPIO API (linux/i2c-gpio.h). - -Tested by the nslu2-linux and openwrt projects in public firmware releases. - -Acked-by: Rod Whitby <rod@whitby.id.au> -Signed-off-by: Michael-Luke Jones <mlj28@cam.ac.uk> - -Index: linux-2.6.23.17/arch/arm/mach-ixp4xx/nslu2-setup.c -=================================================================== ---- linux-2.6.23.17.orig/arch/arm/mach-ixp4xx/nslu2-setup.c -+++ linux-2.6.23.17/arch/arm/mach-ixp4xx/nslu2-setup.c -@@ -18,6 +18,7 @@ - #include <linux/serial.h> - #include <linux/serial_8250.h> - #include <linux/leds.h> -+#include <linux/i2c-gpio.h> - - #include <asm/mach-types.h> - #include <asm/mach/arch.h> -@@ -41,7 +42,7 @@ static struct platform_device nslu2_flas - .resource = &nslu2_flash_resource, - }; - --static struct ixp4xx_i2c_pins nslu2_i2c_gpio_pins = { -+static struct i2c_gpio_platform_data nslu2_i2c_gpio_data = { - .sda_pin = NSLU2_SDA_PIN, - .scl_pin = NSLU2_SCL_PIN, - }; -@@ -82,11 +83,12 @@ static struct platform_device nslu2_leds - }; - #endif - --static struct platform_device nslu2_i2c_controller = { -- .name = "IXP4XX-I2C", -+static struct platform_device nslu2_i2c_gpio = { -+ .name = "i2c-gpio", - .id = 0, -- .dev.platform_data = &nslu2_i2c_gpio_pins, -- .num_resources = 0, -+ .dev = { -+ .platform_data = &nslu2_i2c_gpio_data, -+ }, - }; - - static struct platform_device nslu2_beeper = { -@@ -139,7 +141,7 @@ static struct platform_device nslu2_uart - }; - - static struct platform_device *nslu2_devices[] __initdata = { -- &nslu2_i2c_controller, -+ &nslu2_i2c_gpio, - &nslu2_flash, - &nslu2_beeper, - #ifdef CONFIG_LEDS_IXP4XX -Index: linux-2.6.23.17/arch/arm/mach-ixp4xx/nas100d-setup.c -=================================================================== ---- linux-2.6.23.17.orig/arch/arm/mach-ixp4xx/nas100d-setup.c -+++ linux-2.6.23.17/arch/arm/mach-ixp4xx/nas100d-setup.c -@@ -16,6 +16,7 @@ - #include <linux/serial.h> - #include <linux/serial_8250.h> - #include <linux/leds.h> -+#include <linux/i2c-gpio.h> - - #include <asm/mach-types.h> - #include <asm/mach/arch.h> -@@ -68,16 +69,17 @@ static struct platform_device nas100d_le - }; - #endif - --static struct ixp4xx_i2c_pins nas100d_i2c_gpio_pins = { -+static struct i2c_gpio_platform_data nas100d_i2c_gpio_data = { - .sda_pin = NAS100D_SDA_PIN, - .scl_pin = NAS100D_SCL_PIN, - }; - --static struct platform_device nas100d_i2c_controller = { -- .name = "IXP4XX-I2C", -+static struct platform_device nas100d_i2c_gpio = { -+ .name = "i2c-gpio", - .id = 0, -- .dev.platform_data = &nas100d_i2c_gpio_pins, -- .num_resources = 0, -+ .dev = { -+ .platform_data = &nas100d_i2c_gpio_data, -+ }, - }; - - static struct resource nas100d_uart_resources[] = { -@@ -124,7 +126,7 @@ static struct platform_device nas100d_ua - }; - - static struct platform_device *nas100d_devices[] __initdata = { -- &nas100d_i2c_controller, -+ &nas100d_i2c_gpio, - &nas100d_flash, - #ifdef CONFIG_LEDS_IXP4XX - &nas100d_leds, -Index: linux-2.6.23.17/arch/arm/mach-ixp4xx/avila-setup.c -=================================================================== ---- linux-2.6.23.17.orig/arch/arm/mach-ixp4xx/avila-setup.c -+++ linux-2.6.23.17/arch/arm/mach-ixp4xx/avila-setup.c -@@ -18,6 +18,7 @@ - #include <linux/tty.h> - #include <linux/serial_8250.h> - #include <linux/slab.h> -+#include <linux/i2c-gpio.h> - - #include <asm/types.h> - #include <asm/setup.h> -@@ -47,18 +48,17 @@ static struct platform_device avila_flas - .resource = &avila_flash_resource, - }; - --static struct ixp4xx_i2c_pins avila_i2c_gpio_pins = { -+static struct i2c_gpio_platform_data avila_i2c_gpio_data = { - .sda_pin = AVILA_SDA_PIN, - .scl_pin = AVILA_SCL_PIN, - }; - --static struct platform_device avila_i2c_controller = { -- .name = "IXP4XX-I2C", -+static struct platform_device avila_i2c_gpio = { -+ .name = "i2c-gpio", - .id = 0, -- .dev = { -- .platform_data = &avila_i2c_gpio_pins, -+ .dev = { -+ .platform_data = &avila_i2c_gpio_data, - }, -- .num_resources = 0 - }; - - static struct resource avila_uart_resources[] = { -@@ -133,7 +133,7 @@ static struct platform_device avila_pata - }; - - static struct platform_device *avila_devices[] __initdata = { -- &avila_i2c_controller, -+ &avila_i2c_gpio, - &avila_flash, - &avila_uart - }; -Index: linux-2.6.23.17/arch/arm/mach-ixp4xx/dsmg600-setup.c -=================================================================== ---- linux-2.6.23.17.orig/arch/arm/mach-ixp4xx/dsmg600-setup.c -+++ linux-2.6.23.17/arch/arm/mach-ixp4xx/dsmg600-setup.c -@@ -14,6 +14,7 @@ - #include <linux/kernel.h> - #include <linux/serial.h> - #include <linux/serial_8250.h> -+#include <linux/i2c-gpio.h> - - #include <asm/mach-types.h> - #include <asm/mach/arch.h> -@@ -37,15 +38,17 @@ static struct platform_device dsmg600_fl - .resource = &dsmg600_flash_resource, - }; - --static struct ixp4xx_i2c_pins dsmg600_i2c_gpio_pins = { -+static struct i2c_gpio_platform_data dsmg600_i2c_gpio_data = { - .sda_pin = DSMG600_SDA_PIN, - .scl_pin = DSMG600_SCL_PIN, - }; - --static struct platform_device dsmg600_i2c_controller = { -- .name = "IXP4XX-I2C", -+static struct platform_device dsmg600_i2c_gpio = { -+ .name = "i2c-gpio", - .id = 0, -- .dev.platform_data = &dsmg600_i2c_gpio_pins, -+ .dev = { -+ .platform_data = &dsmg600_i2c_gpio_data, -+ }, - }; - - #ifdef CONFIG_LEDS_CLASS -@@ -116,7 +119,7 @@ static struct platform_device dsmg600_ua - }; - - static struct platform_device *dsmg600_devices[] __initdata = { -- &dsmg600_i2c_controller, -+ &dsmg600_i2c_gpio, - &dsmg600_flash, - }; - -Index: linux-2.6.23.17/arch/arm/mach-ixp4xx/ixdp425-setup.c -=================================================================== ---- linux-2.6.23.17.orig/arch/arm/mach-ixp4xx/ixdp425-setup.c -+++ linux-2.6.23.17/arch/arm/mach-ixp4xx/ixdp425-setup.c -@@ -15,6 +15,7 @@ - #include <linux/tty.h> - #include <linux/serial_8250.h> - #include <linux/slab.h> -+#include <linux/i2c-gpio.h> - #include <linux/io.h> - #include <linux/mtd/mtd.h> - #include <linux/mtd/nand.h> -@@ -120,18 +121,17 @@ static struct platform_device ixdp425_fl - }; - #endif /* CONFIG_MTD_NAND_PLATFORM */ - --static struct ixp4xx_i2c_pins ixdp425_i2c_gpio_pins = { -+static struct i2c_gpio_platform_data ixdp425_i2c_gpio_data = { - .sda_pin = IXDP425_SDA_PIN, - .scl_pin = IXDP425_SCL_PIN, - }; - --static struct platform_device ixdp425_i2c_controller = { -- .name = "IXP4XX-I2C", -+static struct platform_device ixdp425_i2c_gpio = { -+ .name = "i2c-gpio", - .id = 0, -- .dev = { -- .platform_data = &ixdp425_i2c_gpio_pins, -+ .dev = { -+ .platform_data = &ixdp425_i2c_gpio_data, - }, -- .num_resources = 0 - }; - - static struct resource ixdp425_uart_resources[] = { -@@ -178,7 +178,7 @@ static struct platform_device ixdp425_ua - }; - - static struct platform_device *ixdp425_devices[] __initdata = { -- &ixdp425_i2c_controller, -+ &ixdp425_i2c_gpio, - &ixdp425_flash, - #if defined(CONFIG_MTD_NAND_PLATFORM) || \ - defined(CONFIG_MTD_NAND_PLATFORM_MODULE) diff --git a/target/linux/ixp4xx/patches-2.6.23/030-ixp4xx_fsg_board_support.patch b/target/linux/ixp4xx/patches-2.6.23/030-ixp4xx_fsg_board_support.patch deleted file mode 100644 index d3f2f94a29..0000000000 --- a/target/linux/ixp4xx/patches-2.6.23/030-ixp4xx_fsg_board_support.patch +++ /dev/null @@ -1,793 +0,0 @@ -Index: linux-2.6.23.17/arch/arm/mach-ixp4xx/fsg-pci.c -=================================================================== ---- /dev/null -+++ linux-2.6.23.17/arch/arm/mach-ixp4xx/fsg-pci.c -@@ -0,0 +1,71 @@ -+/* -+ * arch/arch/mach-ixp4xx/fsg-pci.c -+ * -+ * FSG board-level PCI initialization -+ * -+ * Author: Rod Whitby <rod@whitby.id.au> -+ * Maintainer: http://www.nslu2-linux.org/ -+ * -+ * based on ixdp425-pci.c: -+ * Copyright (C) 2002 Intel Corporation. -+ * Copyright (C) 2003-2004 MontaVista Software, Inc. -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ * -+ */ -+ -+#include <linux/pci.h> -+#include <linux/init.h> -+#include <linux/irq.h> -+ -+#include <asm/mach/pci.h> -+#include <asm/mach-types.h> -+ -+void __init fsg_pci_preinit(void) -+{ -+ set_irq_type(IRQ_FSG_PCI_INTA, IRQT_LOW); -+ set_irq_type(IRQ_FSG_PCI_INTB, IRQT_LOW); -+ set_irq_type(IRQ_FSG_PCI_INTC, IRQT_LOW); -+ -+ ixp4xx_pci_preinit(); -+} -+ -+static int __init fsg_map_irq(struct pci_dev *dev, u8 slot, u8 pin) -+{ -+ static int pci_irq_table[FSG_PCI_IRQ_LINES] = { -+ IRQ_FSG_PCI_INTC, -+ IRQ_FSG_PCI_INTB, -+ IRQ_FSG_PCI_INTA, -+ }; -+ -+ int irq = -1; -+ slot = slot - 11; -+ -+ if (slot >= 1 && slot <= FSG_PCI_MAX_DEV && -+ pin >= 1 && pin <= FSG_PCI_IRQ_LINES) { -+ irq = pci_irq_table[(slot - 1)]; -+ } -+ printk("%s: Mapped slot %d pin %d to IRQ %d\n", __FUNCTION__,slot, pin, irq); -+ -+ return irq; -+} -+ -+struct hw_pci fsg_pci __initdata = { -+ .nr_controllers = 1, -+ .preinit = fsg_pci_preinit, -+ .swizzle = pci_std_swizzle, -+ .setup = ixp4xx_setup, -+ .scan = ixp4xx_scan_bus, -+ .map_irq = fsg_map_irq, -+}; -+ -+int __init fsg_pci_init(void) -+{ -+ if (machine_is_fsg()) -+ pci_common_init(&fsg_pci); -+ return 0; -+} -+ -+subsys_initcall(fsg_pci_init); -Index: linux-2.6.23.17/arch/arm/mach-ixp4xx/fsg-setup.c -=================================================================== ---- /dev/null -+++ linux-2.6.23.17/arch/arm/mach-ixp4xx/fsg-setup.c -@@ -0,0 +1,220 @@ -+/* -+ * arch/arm/mach-ixp4xx/fsg-setup.c -+ * -+ * FSG board-setup -+ * -+ * based ixdp425-setup.c: -+ * Copyright (C) 2003-2004 MontaVista Software, Inc. -+ * -+ * Author: Rod Whitby <rod@whitby.id.au> -+ * Maintainers: http://www.nslu2-linux.org/ -+ * -+ */ -+ -+#include <linux/kernel.h> -+#include <linux/serial.h> -+#include <linux/serial_8250.h> -+#include <linux/leds.h> -+#include <linux/reboot.h> -+#include <linux/i2c-gpio.h> -+ -+#include <asm/mach-types.h> -+#include <asm/mach/arch.h> -+#include <asm/mach/flash.h> -+#include <asm/io.h> -+ -+static struct flash_platform_data fsg_flash_data = { -+ .map_name = "cfi_probe", -+ .width = 2, -+}; -+ -+static struct resource fsg_flash_resource = { -+ .flags = IORESOURCE_MEM, -+}; -+ -+static struct platform_device fsg_flash = { -+ .name = "IXP4XX-Flash", -+ .id = 0, -+ .dev.platform_data = &fsg_flash_data, -+ .num_resources = 1, -+ .resource = &fsg_flash_resource, -+}; -+ -+static struct i2c_gpio_platform_data fsg_i2c_gpio_data = { -+ .sda_pin = FSG_SDA_PIN, -+ .scl_pin = FSG_SCL_PIN, -+}; -+ -+static struct platform_device fsg_i2c_gpio = { -+ .name = "i2c-gpio", -+ .id = 0, -+ .dev = { -+ .platform_data = &fsg_i2c_gpio_data, -+ }, -+}; -+ -+static struct resource fsg_uart_resources[] = { -+ { -+ .start = IXP4XX_UART1_BASE_PHYS, -+ .end = IXP4XX_UART1_BASE_PHYS + 0x0fff, -+ .flags = IORESOURCE_MEM, -+ }, -+ { -+ .start = IXP4XX_UART2_BASE_PHYS, -+ .end = IXP4XX_UART2_BASE_PHYS + 0x0fff, -+ .flags = IORESOURCE_MEM, -+ } -+}; -+ -+static struct plat_serial8250_port fsg_uart_data[] = { -+ { -+ .mapbase = IXP4XX_UART1_BASE_PHYS, -+ .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET, -+ .irq = IRQ_IXP4XX_UART1, -+ .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, -+ .iotype = UPIO_MEM, -+ .regshift = 2, -+ .uartclk = IXP4XX_UART_XTAL, -+ }, -+ { -+ .mapbase = IXP4XX_UART2_BASE_PHYS, -+ .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET, -+ .irq = IRQ_IXP4XX_UART2, -+ .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, -+ .iotype = UPIO_MEM, -+ .regshift = 2, -+ .uartclk = IXP4XX_UART_XTAL, -+ }, -+ { } -+}; -+ -+static struct platform_device fsg_uart = { -+ .name = "serial8250", -+ .id = PLAT8250_DEV_PLATFORM, -+ .dev.platform_data = fsg_uart_data, -+ .num_resources = ARRAY_SIZE(fsg_uart_resources), -+ .resource = fsg_uart_resources, -+}; -+ -+static struct platform_device fsg_leds = { -+ .name = "fsg-led", -+ .id = -1, -+}; -+ -+/* Built-in 10/100 Ethernet MAC interfaces */ -+static struct eth_plat_info fsg_plat_eth[] = { -+ { -+ .phy = 5, -+ .rxq = 3, -+ .txreadyq = 20, -+ }, { -+ .phy = 4, -+ .rxq = 4, -+ .txreadyq = 21, -+ } -+}; -+ -+static struct platform_device fsg_eth[] = { -+ { -+ .name = "ixp4xx_eth", -+ .id = IXP4XX_ETH_NPEB, -+ .dev.platform_data = fsg_plat_eth, -+ }, { -+ .name = "ixp4xx_eth", -+ .id = IXP4XX_ETH_NPEC, -+ .dev.platform_data = fsg_plat_eth + 1, -+ } -+}; -+ -+static struct platform_device *fsg_devices[] __initdata = { -+ &fsg_i2c_gpio, -+ &fsg_flash, -+ &fsg_leds, -+ &fsg_eth[0], -+ &fsg_eth[1], -+}; -+ -+static void fsg_power_off(void) -+{ -+ printk("Restarting system.\n"); -+ machine_restart(NULL); -+} -+ -+static void __init fsg_init(void) -+{ -+ uint8_t __iomem *f; -+ int i; -+ -+ ixp4xx_sys_init(); -+ -+ pm_power_off = fsg_power_off; -+ -+ fsg_flash_resource.start = IXP4XX_EXP_BUS_BASE(0); -+ fsg_flash_resource.end = -+ IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1; -+ -+ *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE; -+ *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0; -+ -+ /* Configure CS2 for operation, 8bit and writable */ -+ *IXP4XX_EXP_CS2 = 0xbfff0002; -+ -+ /* This is only useful on a modified machine, but it is valuable -+ * to have it first in order to see debug messages, and so that -+ * it does *not* get removed if platform_add_devices fails! -+ */ -+ (void)platform_device_register(&fsg_uart); -+ -+ platform_add_devices(fsg_devices, ARRAY_SIZE(fsg_devices)); -+ -+ -+ /* -+ * Map in a portion of the flash and read the MAC addresses. -+ * 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), 0x400000))) { -+#ifdef __ARMEB__ -+ for (i = 0; i < 6; i++) { -+ fsg_plat_eth[0].hwaddr[i] = readb(f + 0x3C0422 + i); -+ fsg_plat_eth[1].hwaddr[i] = readb(f + 0x3C043B + i); -+ } -+#else -+ fsg_plat_eth[0].hwaddr[0] = readb(f + 0x3C0422 + 3); -+ fsg_plat_eth[0].hwaddr[1] = readb(f + 0x3C0422 + 2); -+ fsg_plat_eth[0].hwaddr[2] = readb(f + 0x3C0422 + 1); -+ fsg_plat_eth[0].hwaddr[3] = readb(f + 0x3C0422 + 0); -+ fsg_plat_eth[0].hwaddr[4] = readb(f + 0x3C0422 + 7); -+ fsg_plat_eth[0].hwaddr[5] = readb(f + 0x3C0422 + 6); -+ -+ fsg_plat_eth[1].hwaddr[0] = readb(f + 0x3C0422 + 3); -+ fsg_plat_eth[1].hwaddr[1] = readb(f + 0x3C0422 + 2); -+ fsg_plat_eth[1].hwaddr[2] = readb(f + 0x3C0422 + 1); -+ fsg_plat_eth[1].hwaddr[3] = readb(f + 0x3C0422 + 0); -+ fsg_plat_eth[1].hwaddr[4] = readb(f + 0x3C0422 + 7); -+ fsg_plat_eth[1].hwaddr[5] = readb(f + 0x3C0422 + 6); -+#endif -+ iounmap(f); -+ } -+ printk(KERN_INFO "FSG: Using MAC address %.2x:%.2x:%.2x:%.2x:%.2x:%.2x for port 0\n", -+ fsg_plat_eth[0].hwaddr[0], fsg_plat_eth[0].hwaddr[1], -+ fsg_plat_eth[0].hwaddr[2], fsg_plat_eth[0].hwaddr[3], -+ fsg_plat_eth[0].hwaddr[4], fsg_plat_eth[0].hwaddr[5]); -+ printk(KERN_INFO "FSG: Using MAC address %.2x:%.2x:%.2x:%.2x:%.2x:%.2x for port 1\n", -+ fsg_plat_eth[1].hwaddr[0], fsg_plat_eth[1].hwaddr[1], -+ fsg_plat_eth[1].hwaddr[2], fsg_plat_eth[1].hwaddr[3], -+ fsg_plat_eth[1].hwaddr[4], fsg_plat_eth[1].hwaddr[5]); -+ -+} -+ -+MACHINE_START(FSG, "Freecom FSG-3") -+ /* Maintainer: www.nslu2-linux.org */ -+ .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, -+ .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, -+ .map_io = ixp4xx_map_io, -+ .init_irq = ixp4xx_init_irq, -+ .timer = &ixp4xx_timer, -+ .boot_params = 0x0100, -+ .init_machine = fsg_init, -+MACHINE_END -+ -Index: linux-2.6.23.17/arch/arm/mach-ixp4xx/Kconfig -=================================================================== ---- linux-2.6.23.17.orig/arch/arm/mach-ixp4xx/Kconfig -+++ linux-2.6.23.17/arch/arm/mach-ixp4xx/Kconfig -@@ -125,6 +125,15 @@ config ARCH_IXDP4XX - depends on ARCH_IXDP425 || MACH_IXDP465 || MACH_KIXRP435 - default y - -+config MACH_FSG -+ bool -+ prompt "Freecom FSG-3" -+ select PCI -+ help -+ Say 'Y' here if you want your kernel to support Freecom's -+ FSG-3 device. For more information on this platform, -+ see http://www.nslu2-linux.org/wiki/FSG3/HomePage -+ - # - # Certain registers and IRQs are only enabled if supporting IXP465 CPUs - # -Index: linux-2.6.23.17/arch/arm/mach-ixp4xx/Makefile -=================================================================== ---- linux-2.6.23.17.orig/arch/arm/mach-ixp4xx/Makefile -+++ linux-2.6.23.17/arch/arm/mach-ixp4xx/Makefile -@@ -15,6 +15,7 @@ obj-pci-$(CONFIG_MACH_NAS100D) += nas10 - obj-pci-$(CONFIG_MACH_DSMG600) += dsmg600-pci.o - obj-pci-$(CONFIG_MACH_GATEWAY7001) += gateway7001-pci.o - obj-pci-$(CONFIG_MACH_WG302V2) += wg302v2-pci.o -+obj-pci-$(CONFIG_MACH_FSG) += fsg-pci.o - - obj-y += common.o - -@@ -28,5 +29,6 @@ obj-$(CONFIG_MACH_NAS100D) += nas100d-se - obj-$(CONFIG_MACH_DSMG600) += dsmg600-setup.o dsmg600-power.o - obj-$(CONFIG_MACH_GATEWAY7001) += gateway7001-setup.o - obj-$(CONFIG_MACH_WG302V2) += wg302v2-setup.o -+obj-$(CONFIG_MACH_FSG) += fsg-setup.o fsg-power.o - - obj-$(CONFIG_PCI) += $(obj-pci-$(CONFIG_PCI)) common-pci.o -Index: linux-2.6.23.17/include/asm-arm/arch-ixp4xx/fsg.h -=================================================================== ---- /dev/null -+++ linux-2.6.23.17/include/asm-arm/arch-ixp4xx/fsg.h -@@ -0,0 +1,50 @@ -+/* -+ * include/asm-arm/arch-ixp4xx/fsg.h -+ * -+ * Freecom FSG-3 platform specific definitions -+ * -+ * Author: Rod Whitby <rod@whitby.id.au> -+ * Author: Tomasz Chmielewski <mangoo@wpkg.org> -+ * Maintainers: http://www.nslu2-linux.org -+ * -+ * Based on coyote.h by -+ * Copyright 2004 (c) MontaVista, Software, Inc. -+ * -+ * This file is licensed under the terms of the GNU General Public -+ * License version 2. This program is licensed "as is" without any -+ * warranty of any kind, whether express or implied. -+ */ -+ -+#ifndef __ASM_ARCH_HARDWARE_H__ -+#error "Do not include this directly, instead #include <asm/hardware.h>" -+#endif -+ -+#define FSG_SDA_PIN 12 -+#define FSG_SCL_PIN 13 -+ -+/* -+ * FSG PCI IRQs -+ */ -+#define FSG_PCI_MAX_DEV 3 -+#define FSG_PCI_IRQ_LINES 3 -+ -+ -+/* PCI controller GPIO to IRQ pin mappings */ -+#define FSG_PCI_INTA_PIN 6 -+#define FSG_PCI_INTB_PIN 7 -+#define FSG_PCI_INTC_PIN 5 -+ -+/* Buttons */ -+ -+#define FSG_SB_GPIO 4 /* sync button */ -+#define FSG_RB_GPIO 9 /* reset button */ -+#define FSG_UB_GPIO 10 /* usb button */ -+ -+/* LEDs */ -+ -+#define FSG_LED_WLAN_BIT 0 -+#define FSG_LED_WAN_BIT 1 -+#define FSG_LED_SATA_BIT 2 -+#define FSG_LED_USB_BIT 4 -+#define FSG_LED_RING_BIT 5 -+#define FSG_LED_SYNC_BIT 7 -Index: linux-2.6.23.17/include/asm-arm/arch-ixp4xx/hardware.h -=================================================================== ---- linux-2.6.23.17.orig/include/asm-arm/arch-ixp4xx/hardware.h -+++ linux-2.6.23.17/include/asm-arm/arch-ixp4xx/hardware.h -@@ -45,5 +45,6 @@ - #include "nslu2.h" - #include "nas100d.h" - #include "dsmg600.h" -+#include "fsg.h" - - #endif /* _ASM_ARCH_HARDWARE_H */ -Index: linux-2.6.23.17/include/asm-arm/arch-ixp4xx/irqs.h -=================================================================== ---- linux-2.6.23.17.orig/include/asm-arm/arch-ixp4xx/irqs.h -+++ linux-2.6.23.17/include/asm-arm/arch-ixp4xx/irqs.h -@@ -128,4 +128,11 @@ - #define IRQ_DSMG600_PCI_INTE IRQ_IXP4XX_GPIO7 - #define IRQ_DSMG600_PCI_INTF IRQ_IXP4XX_GPIO6 - -+/* -+ * Freecom FSG-3 Board IRQs -+ */ -+#define IRQ_FSG_PCI_INTA IRQ_IXP4XX_GPIO6 -+#define IRQ_FSG_PCI_INTB IRQ_IXP4XX_GPIO7 -+#define IRQ_FSG_PCI_INTC IRQ_IXP4XX_GPIO5 -+ - #endif -Index: linux-2.6.23.17/arch/arm/mach-ixp4xx/fsg-power.c -=================================================================== ---- /dev/null -+++ linux-2.6.23.17/arch/arm/mach-ixp4xx/fsg-power.c -@@ -0,0 +1,89 @@ -+/* -+ * arch/arm/mach-ixp4xx/fsg-power.c -+ * -+ * FSG Power/Reset driver -+ * -+ * Copyright (C) 2008 Rod Whitby <rod@whitby.id.au> -+ * -+ * based on nslu2-power.c -+ * Copyright (C) 2005 Tower Technologies -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ * -+ */ -+ -+#include <linux/module.h> -+#include <linux/reboot.h> -+#include <linux/interrupt.h> -+#include <linux/irq.h> -+#include <linux/jiffies.h> -+#include <linux/timer.h> -+ -+#include <asm/gpio.h> -+#include <asm/mach-types.h> -+ -+static irqreturn_t fsg_power_handler(int irq, void *dev_id) -+{ -+ /* Signal init to do the ctrlaltdel action, this will bypass init if -+ * it hasn't started and do a kernel_restart. -+ */ -+ ctrl_alt_del(); -+ -+ return IRQ_HANDLED; -+} -+ -+static irqreturn_t fsg_reset_handler(int irq, void *dev_id) -+{ -+ /* This is the paper-clip reset, it shuts the machine down directly. -+ */ -+ machine_power_off(); -+ -+ return IRQ_HANDLED; -+} -+ -+static int __init fsg_power_init(void) -+{ -+ if (!(machine_is_fsg())) -+ return 0; -+ -+ set_irq_type(gpio_to_irq(FSG_RB_GPIO), IRQT_LOW); -+ set_irq_type(gpio_to_irq(FSG_SB_GPIO), IRQT_LOW); -+ -+ if (request_irq(gpio_to_irq(FSG_RB_GPIO), &fsg_reset_handler, -+ IRQF_DISABLED, "FSG reset button", NULL) < 0) { -+ -+ printk(KERN_DEBUG "Reset Button IRQ %d not available\n", -+ gpio_to_irq(FSG_RB_GPIO)); -+ -+ return -EIO; -+ } -+ -+ if (request_irq(gpio_to_irq(FSG_SB_GPIO), &fsg_power_handler, -+ IRQF_DISABLED, "FSG power button", NULL) < 0) { -+ -+ printk(KERN_DEBUG "Power Button IRQ %d not available\n", -+ gpio_to_irq(FSG_SB_GPIO)); -+ -+ return -EIO; -+ } -+ -+ return 0; -+} -+ -+static void __exit fsg_power_exit(void) -+{ -+ if (!(machine_is_fsg())) -+ return; -+ -+ free_irq(gpio_to_irq(FSG_SB_GPIO), NULL); -+ free_irq(gpio_to_irq(FSG_RB_GPIO), NULL); -+} -+ -+module_init(fsg_power_init); -+module_exit(fsg_power_exit); -+ -+MODULE_AUTHOR("Rod Whitby <rod@whitby.id.au>"); -+MODULE_DESCRIPTION("FSG Power/Reset driver"); -+MODULE_LICENSE("GPL"); -Index: linux-2.6.23.17/drivers/leds/Kconfig -=================================================================== ---- linux-2.6.23.17.orig/drivers/leds/Kconfig -+++ linux-2.6.23.17/drivers/leds/Kconfig -@@ -48,6 +48,12 @@ config LEDS_IXP4XX - particular board must have LEDs and they must be connected - to the GPIO lines. If unsure, say Y. - -+config LEDS_FSG -+ tristate "LED Support for the Freecom FSG-3" -+ depends on LEDS_CLASS && MACH_FSG -+ help -+ This option enables support for the LEDs on the Freecom FSG-3. -+ - config LEDS_TOSA - tristate "LED Support for the Sharp SL-6000 series" - depends on LEDS_CLASS && PXA_SHARPSL -Index: linux-2.6.23.17/drivers/leds/Makefile -=================================================================== ---- linux-2.6.23.17.orig/drivers/leds/Makefile -+++ linux-2.6.23.17/drivers/leds/Makefile -@@ -9,6 +9,7 @@ obj-$(CONFIG_LEDS_CORGI) += leds-corgi. - obj-$(CONFIG_LEDS_LOCOMO) += leds-locomo.o - obj-$(CONFIG_LEDS_SPITZ) += leds-spitz.o - obj-$(CONFIG_LEDS_IXP4XX) += leds-ixp4xx-gpio.o -+obj-$(CONFIG_LEDS_FSG) += leds-fsg.o - obj-$(CONFIG_LEDS_TOSA) += leds-tosa.o - obj-$(CONFIG_LEDS_S3C24XX) += leds-s3c24xx.o - obj-$(CONFIG_LEDS_AMS_DELTA) += leds-ams-delta.o -Index: linux-2.6.23.17/drivers/leds/leds-fsg.c -=================================================================== ---- /dev/null -+++ linux-2.6.23.17/drivers/leds/leds-fsg.c -@@ -0,0 +1,243 @@ -+/* -+ * LED Driver for the Freecom FSG-3 -+ * -+ * Copyright (c) 2008 Rod Whitby <rod@whitby.id.au> -+ * -+ * Author: Rod Whitby <rod@whitby.id.au> -+ * -+ * Based on leds-spitz.c -+ * Copyright 2005-2006 Openedhand Ltd. -+ * Author: Richard Purdie <rpurdie@openedhand.com> -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ * -+ */ -+ -+#include <linux/kernel.h> -+#include <linux/init.h> -+#include <linux/platform_device.h> -+#include <linux/leds.h> -+#include <asm/arch/hardware.h> -+#include <asm/io.h> -+ -+static short __iomem *latch_address; -+static unsigned short latch_value; -+ -+ -+static void fsg_led_wlan_set(struct led_classdev *led_cdev, enum led_brightness value) -+{ -+ if (value) { -+ latch_value &= ~(1 << FSG_LED_WLAN_BIT); -+ *latch_address = latch_value; -+ } -+ else { -+ latch_value |= (1 << FSG_LED_WLAN_BIT); -+ *latch_address = latch_value; -+ } -+} -+ -+static void fsg_led_wan_set(struct led_classdev *led_cdev, enum led_brightness value) -+{ -+ if (value) { -+ latch_value &= ~(1 << FSG_LED_WAN_BIT); -+ *latch_address = latch_value; -+ } -+ else { -+ latch_value |= (1 << FSG_LED_WAN_BIT); -+ *latch_address = latch_value; -+ } -+} -+ -+static void fsg_led_sata_set(struct led_classdev *led_cdev, enum led_brightness value) -+{ -+ if (value) { -+ latch_value &= ~(1 << FSG_LED_SATA_BIT); -+ *latch_address = latch_value; -+ } -+ else { -+ latch_value |= (1 << FSG_LED_SATA_BIT); -+ *latch_address = latch_value; -+ } -+} -+ -+static void fsg_led_usb_set(struct led_classdev *led_cdev, enum led_brightness value) -+{ -+ if (value) { -+ latch_value &= ~(1 << FSG_LED_USB_BIT); -+ *latch_address = latch_value; -+ } -+ else { -+ latch_value |= (1 << FSG_LED_USB_BIT); -+ *latch_address = latch_value; -+ } -+} -+ -+static void fsg_led_sync_set(struct led_classdev *led_cdev, enum led_brightness value) -+{ -+ if (value) { -+ latch_value &= ~(1 << FSG_LED_SYNC_BIT); -+ *latch_address = latch_value; -+ } -+ else { -+ latch_value |= (1 << FSG_LED_SYNC_BIT); -+ *latch_address = latch_value; -+ } -+} -+ -+static void fsg_led_ring_set(struct led_classdev *led_cdev, enum led_brightness value) -+{ -+ if (value) { -+ latch_value &= ~(1 << FSG_LED_RING_BIT); -+ *latch_address = latch_value; -+ } -+ else { -+ latch_value |= (1 << FSG_LED_RING_BIT); -+ *latch_address = latch_value; -+ } -+} -+ -+ -+ -+static struct led_classdev fsg_wlan_led = { -+ .name = "fsg:wlan", -+ .brightness_set = fsg_led_wlan_set, -+}; -+ -+static struct led_classdev fsg_wan_led = { -+ .name = "fsg:wan", -+ .brightness_set = fsg_led_wan_set, -+}; -+ -+static struct led_classdev fsg_sata_led = { -+ .name = "fsg:sata", -+ .brightness_set = fsg_led_sata_set, -+}; -+ -+static struct led_classdev fsg_usb_led = { -+ .name = "fsg:usb", -+ .brightness_set = fsg_led_usb_set, -+}; -+ -+static struct led_classdev fsg_sync_led = { -+ .name = "fsg:sync", -+ .brightness_set = fsg_led_sync_set, -+}; -+ -+static struct led_classdev fsg_ring_led = { -+ .name = "fsg:ring", -+ .brightness_set = fsg_led_ring_set, -+}; -+ -+ -+ -+#ifdef CONFIG_PM -+static int fsg_led_suspend(struct platform_device *dev, pm_message_t state) -+{ -+ led_classdev_suspend(&fsg_wlan_led); -+ led_classdev_suspend(&fsg_wan_led); -+ led_classdev_suspend(&fsg_sata_led); -+ led_classdev_suspend(&fsg_usb_led); -+ led_classdev_suspend(&fsg_sync_led); -+ led_classdev_suspend(&fsg_ring_led); -+ return 0; -+} -+ -+static int fsg_led_resume(struct platform_device *dev) -+{ -+ led_classdev_resume(&fsg_wlan_led); -+ led_classdev_resume(&fsg_wan_led); -+ led_classdev_resume(&fsg_sata_led); -+ led_classdev_resume(&fsg_usb_led); -+ led_classdev_resume(&fsg_sync_led); -+ led_classdev_resume(&fsg_ring_led); -+ return 0; -+} -+#endif -+ -+ -+static int fsg_led_probe(struct platform_device *pdev) -+{ -+ int ret; -+ -+ /* FIXME: Need to work out how to handle failure below */ -+ -+ ret = led_classdev_register(&pdev->dev, &fsg_wlan_led); -+ if (ret < 0) -+ return ret; -+ -+ ret = led_classdev_register(&pdev->dev, &fsg_wan_led); -+ if (ret < 0) -+ return ret; -+ -+ ret = led_classdev_register(&pdev->dev, &fsg_sata_led); -+ if (ret < 0) -+ return ret; -+ -+ ret = led_classdev_register(&pdev->dev, &fsg_usb_led); -+ if (ret < 0) -+ return ret; -+ -+ ret = led_classdev_register(&pdev->dev, &fsg_sync_led); -+ if (ret < 0) -+ return ret; -+ -+ ret = led_classdev_register(&pdev->dev, &fsg_ring_led); -+ if (ret < 0) -+ return ret; -+ -+ return ret; -+} -+ -+static int fsg_led_remove(struct platform_device *pdev) -+{ -+ led_classdev_unregister(&fsg_wlan_led); -+ led_classdev_unregister(&fsg_wan_led); -+ led_classdev_unregister(&fsg_sata_led); -+ led_classdev_unregister(&fsg_usb_led); -+ led_classdev_unregister(&fsg_sync_led); -+ led_classdev_unregister(&fsg_ring_led); -+ -+ return 0; -+} -+ -+ -+static struct platform_driver fsg_led_driver = { -+ .probe = fsg_led_probe, -+ .remove = fsg_led_remove, -+#ifdef CONFIG_PM -+ .suspend = fsg_led_suspend, -+ .resume = fsg_led_resume, -+#endif -+ .driver = { -+ .name = "fsg-led", -+ }, -+}; -+ -+ -+static int __init fsg_led_init(void) -+{ -+ /* Map the LED chip select address space */ -+ latch_address = (unsigned short *) ioremap(IXP4XX_EXP_BUS_BASE(2), 512); -+ if (!latch_address) -+ return -ENOMEM; -+ latch_value = 0xffff; -+ *latch_address = latch_value; -+ /* FIXME: We leak memory if the next line fails */ -+ return platform_driver_register(&fsg_led_driver); -+} -+ -+static void __exit fsg_led_exit(void) -+{ -+ platform_driver_unregister(&fsg_led_driver); -+ iounmap(latch_address); -+} -+ -+ -+module_init(fsg_led_init); -+module_exit(fsg_led_exit); -+ -+MODULE_AUTHOR("Rod Whitby <rod@whitby.id.au>"); -+MODULE_DESCRIPTION("Freecom FSG-3 LED driver"); -+MODULE_LICENSE("GPL"); diff --git a/target/linux/ixp4xx/patches-2.6.23/031-ixp4xx-net-drivers-nslu2.patch b/target/linux/ixp4xx/patches-2.6.23/031-ixp4xx-net-drivers-nslu2.patch deleted file mode 100644 index cd500a5cb2..0000000000 --- a/target/linux/ixp4xx/patches-2.6.23/031-ixp4xx-net-drivers-nslu2.patch +++ /dev/null @@ -1,88 +0,0 @@ -Index: linux-2.6.23.17/arch/arm/mach-ixp4xx/nslu2-setup.c -=================================================================== ---- linux-2.6.23.17.orig/arch/arm/mach-ixp4xx/nslu2-setup.c -+++ linux-2.6.23.17/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_dev - #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") diff --git a/target/linux/ixp4xx/patches-2.6.23/032-ixp4xx-net-drivers-nas100d.patch b/target/linux/ixp4xx/patches-2.6.23/032-ixp4xx-net-drivers-nas100d.patch deleted file mode 100644 index 656c83ebe3..0000000000 --- a/target/linux/ixp4xx/patches-2.6.23/032-ixp4xx-net-drivers-nas100d.patch +++ /dev/null @@ -1,87 +0,0 @@ -Index: linux-2.6.23.17/arch/arm/mach-ixp4xx/nas100d-setup.c -=================================================================== ---- linux-2.6.23.17.orig/arch/arm/mach-ixp4xx/nas100d-setup.c -+++ linux-2.6.23.17/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_ua - .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") diff --git a/target/linux/ixp4xx/patches-2.6.23/090-increase_entropy_pools.patch b/target/linux/ixp4xx/patches-2.6.23/090-increase_entropy_pools.patch deleted file mode 100644 index 333f481bf2..0000000000 --- a/target/linux/ixp4xx/patches-2.6.23/090-increase_entropy_pools.patch +++ /dev/null @@ -1,17 +0,0 @@ -Index: linux-2.6.23.17/drivers/char/random.c -=================================================================== ---- linux-2.6.23.17.orig/drivers/char/random.c -+++ linux-2.6.23.17/drivers/char/random.c -@@ -248,9 +248,9 @@ - /* - * Configuration information - */ --#define INPUT_POOL_WORDS 128 --#define OUTPUT_POOL_WORDS 32 --#define SEC_XFER_SIZE 512 -+#define INPUT_POOL_WORDS 256 -+#define OUTPUT_POOL_WORDS 64 -+#define SEC_XFER_SIZE 1024 - - /* - * The minimum number of bits of entropy before we wake up a read on diff --git a/target/linux/ixp4xx/patches-2.6.23/091-nslu2_rtc_fixup.patch b/target/linux/ixp4xx/patches-2.6.23/091-nslu2_rtc_fixup.patch deleted file mode 100644 index 0facc598ad..0000000000 --- a/target/linux/ixp4xx/patches-2.6.23/091-nslu2_rtc_fixup.patch +++ /dev/null @@ -1,56 +0,0 @@ -Index: linux-2.6.23.17/arch/arm/mach-ixp4xx/nslu2-setup.c -=================================================================== ---- linux-2.6.23.17.orig/arch/arm/mach-ixp4xx/nslu2-setup.c -+++ linux-2.6.23.17/arch/arm/mach-ixp4xx/nslu2-setup.c -@@ -20,6 +20,7 @@ - #include <linux/leds.h> - #include <linux/i2c-gpio.h> - -+#include <asm/setup.h> - #include <asm/mach-types.h> - #include <asm/mach/arch.h> - #include <asm/mach/flash.h> -@@ -192,6 +193,35 @@ static struct sys_timer nslu2_timer = { - .init = nslu2_timer_init, - }; - -+static char nslu2_rtc_probe[] __initdata = "rtc-isl1208.ignore=0,0x6f rtc-x1205.probe=0,0x6f "; -+ -+static void __init nslu2_fixup(struct machine_desc *desc, -+ struct tag *tags, char **cmdline, struct meminfo *mi) -+{ -+ struct tag *t = tags; -+ char *p = *cmdline; -+ -+ /* Find the end of the tags table, taking note of any cmdline tag. */ -+ for (; t->hdr.size; t = tag_next(t)) { -+ if (t->hdr.tag == ATAG_CMDLINE) { -+ p = t->u.cmdline.cmdline; -+ } -+ } -+ -+ /* Overwrite the end of the table with a new cmdline tag. */ -+ t->hdr.tag = ATAG_CMDLINE; -+ t->hdr.size = (sizeof (struct tag_header) + -+ strlen(nslu2_rtc_probe) + strlen(p) + 1 + 4) >> 2; -+ strlcpy(t->u.cmdline.cmdline, nslu2_rtc_probe, COMMAND_LINE_SIZE); -+ strlcpy(t->u.cmdline.cmdline + strlen(nslu2_rtc_probe), p, -+ COMMAND_LINE_SIZE - strlen(nslu2_rtc_probe)); -+ -+ /* Terminate the table. */ -+ t = tag_next(t); -+ t->hdr.tag = ATAG_NONE; -+ t->hdr.size = 0; -+} -+ - static void __init nslu2_init(void) - { - uint8_t __iomem *f; -@@ -247,6 +277,7 @@ MACHINE_START(NSLU2, "Linksys NSLU2") - .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, - .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xFFFC, - .boot_params = 0x00000100, -+ .fixup = nslu2_fixup, - .map_io = ixp4xx_map_io, - .init_irq = ixp4xx_init_irq, - .timer = &nslu2_timer, diff --git a/target/linux/ixp4xx/patches-2.6.23/092-nas100d_rtc_fixup.patch b/target/linux/ixp4xx/patches-2.6.23/092-nas100d_rtc_fixup.patch deleted file mode 100644 index 00a51bc31a..0000000000 --- a/target/linux/ixp4xx/patches-2.6.23/092-nas100d_rtc_fixup.patch +++ /dev/null @@ -1,56 +0,0 @@ -Index: linux-2.6.23.17/arch/arm/mach-ixp4xx/nas100d-setup.c -=================================================================== ---- linux-2.6.23.17.orig/arch/arm/mach-ixp4xx/nas100d-setup.c -+++ linux-2.6.23.17/arch/arm/mach-ixp4xx/nas100d-setup.c -@@ -18,6 +18,7 @@ - #include <linux/leds.h> - #include <linux/i2c-gpio.h> - -+#include <asm/setup.h> - #include <asm/mach-types.h> - #include <asm/mach/arch.h> - #include <asm/mach/flash.h> -@@ -163,6 +164,35 @@ static void nas100d_power_off(void) - gpio_line_set(NAS100D_PO_GPIO, IXP4XX_GPIO_HIGH); - } - -+static char nas100d_rtc_probe[] __initdata = "rtc-pcf8563.probe=0,0x51 "; -+ -+static void __init nas100d_fixup(struct machine_desc *desc, -+ struct tag *tags, char **cmdline, struct meminfo *mi) -+{ -+ struct tag *t = tags; -+ char *p = *cmdline; -+ -+ /* Find the end of the tags table, taking note of any cmdline tag. */ -+ for (; t->hdr.size; t = tag_next(t)) { -+ if (t->hdr.tag == ATAG_CMDLINE) { -+ p = t->u.cmdline.cmdline; -+ } -+ } -+ -+ /* Overwrite the end of the table with a new cmdline tag. */ -+ t->hdr.tag = ATAG_CMDLINE; -+ t->hdr.size = (sizeof (struct tag_header) + -+ strlen(nas100d_rtc_probe) + strlen(p) + 1 + 4) >> 2; -+ strlcpy(t->u.cmdline.cmdline, nas100d_rtc_probe, COMMAND_LINE_SIZE); -+ strlcpy(t->u.cmdline.cmdline + strlen(nas100d_rtc_probe), p, -+ COMMAND_LINE_SIZE - strlen(nas100d_rtc_probe)); -+ -+ /* Terminate the table. */ -+ t = tag_next(t); -+ t->hdr.tag = ATAG_NONE; -+ t->hdr.size = 0; -+} -+ - static void __init nas100d_init(void) - { - uint8_t __iomem *f; -@@ -221,6 +251,7 @@ MACHINE_START(NAS100D, "Iomega NAS 100d" - .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, - .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xFFFC, - .boot_params = 0x00000100, -+ .fixup = nas100d_fixup, - .map_io = ixp4xx_map_io, - .init_irq = ixp4xx_init_irq, - .timer = &ixp4xx_timer, diff --git a/target/linux/ixp4xx/patches-2.6.23/095-dsmg600_rtc_fixup.patch b/target/linux/ixp4xx/patches-2.6.23/095-dsmg600_rtc_fixup.patch deleted file mode 100644 index b46c2947e4..0000000000 --- a/target/linux/ixp4xx/patches-2.6.23/095-dsmg600_rtc_fixup.patch +++ /dev/null @@ -1,56 +0,0 @@ -Index: linux-2.6.23.17/arch/arm/mach-ixp4xx/dsmg600-setup.c -=================================================================== ---- linux-2.6.23.17.orig/arch/arm/mach-ixp4xx/dsmg600-setup.c -+++ linux-2.6.23.17/arch/arm/mach-ixp4xx/dsmg600-setup.c -@@ -16,6 +16,7 @@ - #include <linux/serial_8250.h> - #include <linux/i2c-gpio.h> - -+#include <asm/setup.h> - #include <asm/mach-types.h> - #include <asm/mach/arch.h> - #include <asm/mach/flash.h> -@@ -145,6 +146,35 @@ static struct sys_timer dsmg600_timer = - .init = dsmg600_timer_init, - }; - -+static char dsmg600_rtc_probe[] __initdata = "rtc-pcf8563.probe=0,0x51 "; -+ -+static void __init dsmg600_fixup(struct machine_desc *desc, -+ struct tag *tags, char **cmdline, struct meminfo *mi) -+{ -+ struct tag *t = tags; -+ char *p = *cmdline; -+ -+ /* Find the end of the tags table, taking note of any cmdline tag. */ -+ for (; t->hdr.size; t = tag_next(t)) { -+ if (t->hdr.tag == ATAG_CMDLINE) { -+ p = t->u.cmdline.cmdline; -+ } -+ } -+ -+ /* Overwrite the end of the table with a new cmdline tag. */ -+ t->hdr.tag = ATAG_CMDLINE; -+ t->hdr.size = (sizeof (struct tag_header) + -+ strlen(dsmg600_rtc_probe) + strlen(p) + 1 + 4) >> 2; -+ strlcpy(t->u.cmdline.cmdline, dsmg600_rtc_probe, COMMAND_LINE_SIZE); -+ strlcpy(t->u.cmdline.cmdline + strlen(dsmg600_rtc_probe), p, -+ COMMAND_LINE_SIZE - strlen(dsmg600_rtc_probe)); -+ -+ /* Terminate the table. */ -+ t = tag_next(t); -+ t->hdr.tag = ATAG_NONE; -+ t->hdr.size = 0; -+} -+ - static void __init dsmg600_init(void) - { - ixp4xx_sys_init(); -@@ -177,6 +207,7 @@ MACHINE_START(DSMG600, "D-Link DSM-G600 - .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, - .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xFFFC, - .boot_params = 0x00000100, -+ .fixup = dsmg600_fixup, - .map_io = ixp4xx_map_io, - .init_irq = ixp4xx_init_irq, - .timer = &dsmg600_timer, diff --git a/target/linux/ixp4xx/patches-2.6.23/096-kexec_cmdline.patch b/target/linux/ixp4xx/patches-2.6.23/096-kexec_cmdline.patch deleted file mode 100644 index d27a785789..0000000000 --- a/target/linux/ixp4xx/patches-2.6.23/096-kexec_cmdline.patch +++ /dev/null @@ -1,179 +0,0 @@ -Index: linux-2.6.23.17/kernel/ksysfs.c -=================================================================== ---- linux-2.6.23.17.orig/kernel/ksysfs.c -+++ linux-2.6.23.17/kernel/ksysfs.c -@@ -49,6 +49,165 @@ KERNEL_ATTR_RW(uevent_helper); - #endif - - #ifdef CONFIG_KEXEC -+ -+#include <asm/setup.h> -+ -+extern unsigned long kexec_boot_params; -+ -+char kexec_cmdline[COMMAND_LINE_SIZE] = ""; -+ -+static void -+replace_cmdline_tag(void) -+{ -+ char *t; -+ struct tag *real; -+ struct tag *copy; -+ struct tag *rend; -+ int i; -+ -+/* TODO: check the return params */ -+ t = kmalloc(KEXEC_BOOT_PARAMS_SIZE + COMMAND_LINE_SIZE, GFP_KERNEL); -+ memset((void *)t, 0, KEXEC_BOOT_PARAMS_SIZE + COMMAND_LINE_SIZE); -+ -+/* TODO: validate that the boot params are ATAGS, in fact */ -+ -+ copy = (struct tag *)t; -+ real = (struct tag *)kexec_boot_params; -+ rend = (struct tag *)(kexec_boot_params + KEXEC_BOOT_PARAMS_SIZE); -+ while ((real->hdr.size) && (real < rend)) { -+ if (real->hdr.tag != ATAG_CMDLINE) { -+ memcpy((void *)copy, (void *)real, real->hdr.size * 4); -+ copy = tag_next(copy); -+ } -+ real = tag_next(real); -+ } -+ -+/* TODO: validate that we have enough space in the buffer */ -+ -+ i = strlen(kexec_cmdline); -+ if (i) { -+ copy->hdr.tag = ATAG_CMDLINE; -+ copy->hdr.size = (sizeof(struct tag_header) + i + 1 + 4) >> 2; -+ strcpy(copy->u.cmdline.cmdline, kexec_cmdline); -+ copy = tag_next(copy); -+ } -+ -+ copy->hdr.tag = ATAG_NONE; /* Empty tag ends list */ -+ copy->hdr.size = 0; /* zero length */ -+ -+/* TODO: validate that the temporary buffer isn't too full */ -+ -+ memcpy((void *)kexec_boot_params, (void *)t, KEXEC_BOOT_PARAMS_SIZE); -+ -+ kfree(t); /* Don't forget to free the big buffer we used */ -+} -+ -+static ssize_t kexec_cmdline_show(struct kset *kset, char *page) -+{ -+ return sprintf(page, "%s\n", kexec_cmdline); -+} -+ -+static ssize_t kexec_cmdline_store(struct kset *kset, const char *page, -+ size_t count) -+{ -+ if ((count + 1) > COMMAND_LINE_SIZE) -+ count = COMMAND_LINE_SIZE; -+ memcpy(kexec_cmdline, page, count); -+ kexec_cmdline[count] = '\0'; -+ if (count && (kexec_cmdline[count - 1] == '\n')) -+ kexec_cmdline[count - 1] = '\0'; -+ replace_cmdline_tag(); -+ return count; -+} -+KERNEL_ATTR_RW(kexec_cmdline); -+ -+static ssize_t kexec_boot_params_show(struct kset *kset, char *page) -+{ -+ unsigned long *p; -+ char buf[PAGE_SIZE]; -+ int keep_doing; -+ -+ p = (unsigned long *)kexec_boot_params; -+ -+ /* if this doesn't look like atags, just print first few words */ -+ if (p[1] != ATAG_CORE) -+ return sprintf(page, "0x%lx 0x%lx 0x%lx 0x%lx\n", -+ p[0], p[1], p[2], p[3]); -+ -+ /* carefully walk the atag list, and print out the structure */ -+ keep_doing = 1; -+ do { -+ switch (p[1]) { -+ case ATAG_CORE: -+ /* watch out, core tag is permitted to be empty */ -+ if (p[0] == 5) -+ sprintf(buf, -+ "CORE flg=%ld pgsz=%ld rdev=0x%lx\n", -+ p[2], p[3], p[4]); -+ else -+ sprintf(buf,"CORE\n"); -+ break; -+ case ATAG_MEM: -+ sprintf(buf,"MEM %ldM@0x%lx\n", p[2] / (1024 * 1024), -+ p[3]); -+ break; -+ case ATAG_VIDEOTEXT: -+ sprintf(buf,"VIDEOTEXT sz=%ld\n", p[0]); -+ break; -+ case ATAG_RAMDISK: -+ sprintf(buf,"RAMDISK prmpt=%ld %ldK@0x%lx\n", -+ p[2], p[3], p[4]); -+ break; -+ case ATAG_INITRD2: -+ sprintf(buf,"INITRD2 %ldK@0x%lx\n", p[3] / 1024, p[2]); -+ break; -+ case ATAG_SERIAL: -+ sprintf(buf,"SERIAL high=0x%08lx low=0x%08lx\n", -+ p[3], p[2]); -+ break; -+ case ATAG_REVISION: -+ sprintf(buf,"REVISION rev=%ld\n", p[2]); -+ break; -+ case ATAG_VIDEOLFB: -+ sprintf(buf,"VIDEOLFB sz=%ld\n", p[0]); -+ break; -+ case ATAG_CMDLINE: -+ sprintf(buf,"CMD \"%s\"\n", (char *)&p[2]); -+ break; -+ case ATAG_NONE: -+ sprintf(buf,"NONE\n"); -+ keep_doing = 0; -+ break; -+ default: -+ sprintf(buf,"-unknown- sz=%ld\n", p[0]); -+ break; -+ } -+ -+ /* carefully add to page */ -+ if ((strlen(buf) + strlen(page)) < PAGE_SIZE) { -+ strcat(page, buf); -+ } else { -+ keep_doing = 0; -+ } -+ -+ /* stop when we encounter a header length of 0 */ -+ if (p[0] == 0) -+ keep_doing = 0; -+ -+ /* go to the next tag */ -+ p += p[0]; -+ -+ /* stop if we walked off the end of the buffer */ -+ if (p > (unsigned long *)(kexec_boot_params + -+ KEXEC_BOOT_PARAMS_SIZE)) -+ keep_doing = 0; -+ -+ } while (keep_doing); -+ -+ return (strlen(page)); -+} -+KERNEL_ATTR_RO(kexec_boot_params); -+ - static ssize_t kexec_loaded_show(struct kset *kset, char *page) - { - return sprintf(page, "%d\n", !!kexec_image); -@@ -95,6 +254,8 @@ static struct attribute * kernel_attrs[] - #ifdef CONFIG_KEXEC - &kexec_loaded_attr.attr, - &kexec_crash_loaded_attr.attr, -+ &kexec_cmdline_attr.attr, -+ &kexec_boot_params_attr.attr, - #endif - NULL - }; diff --git a/target/linux/ixp4xx/patches-2.6.23/100-gateway7001_mac_plat_info.patch b/target/linux/ixp4xx/patches-2.6.23/100-gateway7001_mac_plat_info.patch deleted file mode 100644 index 915e501bce..0000000000 --- a/target/linux/ixp4xx/patches-2.6.23/100-gateway7001_mac_plat_info.patch +++ /dev/null @@ -1,42 +0,0 @@ -Index: linux-2.6.23.17/arch/arm/mach-ixp4xx/gateway7001-setup.c -=================================================================== ---- linux-2.6.23.17.orig/arch/arm/mach-ixp4xx/gateway7001-setup.c -+++ linux-2.6.23.17/arch/arm/mach-ixp4xx/gateway7001-setup.c -@@ -76,9 +76,36 @@ static struct platform_device gateway700 - .resource = &gateway7001_uart_resource, - }; - -+/* Built-in 10/100 Ethernet MAC interfaces */ -+static struct eth_plat_info gateway7001_plat_eth[] = { -+ { -+ .phy = 1, -+ .rxq = 3, -+ .txreadyq = 20, -+ }, { -+ .phy = 2, -+ .rxq = 4, -+ .txreadyq = 21, -+ } -+}; -+ -+static struct platform_device gateway7001_eth[] = { -+ { -+ .name = "ixp4xx_eth", -+ .id = IXP4XX_ETH_NPEB, -+ .dev.platform_data = gateway7001_plat_eth, -+ }, { -+ .name = "ixp4xx_eth", -+ .id = IXP4XX_ETH_NPEC, -+ .dev.platform_data = gateway7001_plat_eth + 1, -+ } -+}; -+ - static struct platform_device *gateway7001_devices[] __initdata = { - &gateway7001_flash, -- &gateway7001_uart -+ &gateway7001_uart, -+ &gateway7001_eth[0], -+ &gateway7001_eth[1], - }; - - static void __init gateway7001_init(void) diff --git a/target/linux/ixp4xx/patches-2.6.23/101-wg302_mac_plat_info.patch b/target/linux/ixp4xx/patches-2.6.23/101-wg302_mac_plat_info.patch deleted file mode 100644 index af638b0d0b..0000000000 --- a/target/linux/ixp4xx/patches-2.6.23/101-wg302_mac_plat_info.patch +++ /dev/null @@ -1,32 +0,0 @@ -Index: linux-2.6.23.17/arch/arm/mach-ixp4xx/wg302v2-setup.c -=================================================================== ---- linux-2.6.23.17.orig/arch/arm/mach-ixp4xx/wg302v2-setup.c -+++ linux-2.6.23.17/arch/arm/mach-ixp4xx/wg302v2-setup.c -@@ -77,9 +77,27 @@ static struct platform_device wg302v2_ua - .resource = &wg302v2_uart_resource, - }; - -+/* Built-in 10/100 Ethernet MAC interfaces */ -+static struct eth_plat_info wg302_plat_eth[] = { -+ { -+ .phy = 8, -+ .rxq = 3, -+ .txreadyq = 20, -+ } -+}; -+ -+static struct platform_device wg302_eth[] = { -+ { -+ .name = "ixp4xx_eth", -+ .id = IXP4XX_ETH_NPEB, -+ .dev.platform_data = wg302_plat_eth, -+ } -+}; -+ - static struct platform_device *wg302v2_devices[] __initdata = { - &wg302v2_flash, - &wg302v2_uart, -+ &wg302_eth[0], - }; - - static void __init wg302v2_init(void) diff --git a/target/linux/ixp4xx/patches-2.6.23/110-pronghorn_metro_support.patch b/target/linux/ixp4xx/patches-2.6.23/110-pronghorn_metro_support.patch deleted file mode 100644 index 1d6baae5b9..0000000000 --- a/target/linux/ixp4xx/patches-2.6.23/110-pronghorn_metro_support.patch +++ /dev/null @@ -1,297 +0,0 @@ -Index: linux-2.6.23.17/arch/arm/mach-ixp4xx/Kconfig -=================================================================== ---- linux-2.6.23.17.orig/arch/arm/mach-ixp4xx/Kconfig -+++ linux-2.6.23.17/arch/arm/mach-ixp4xx/Kconfig -@@ -57,6 +57,14 @@ config MACH_WG302V2 - WG302 v2 or WAG302 v2 Access Points. For more information - on this platform, see http://openwrt.org - -+config MACH_PRONGHORNMETRO -+ bool "Pronghorn Metro" -+ select PCI -+ help -+ Say 'Y' here if you want your kernel to support the ADI -+ Engineering Pronghorn Metro Platform. For more -+ information on this platform, see <file:Documentation/arm/IXP4xx>. -+ - config ARCH_IXDP425 - bool "IXDP425" - help -Index: linux-2.6.23.17/arch/arm/mach-ixp4xx/Makefile -=================================================================== ---- linux-2.6.23.17.orig/arch/arm/mach-ixp4xx/Makefile -+++ linux-2.6.23.17/arch/arm/mach-ixp4xx/Makefile -@@ -16,6 +16,7 @@ obj-pci-$(CONFIG_MACH_DSMG600) += dsmg6 - obj-pci-$(CONFIG_MACH_GATEWAY7001) += gateway7001-pci.o - obj-pci-$(CONFIG_MACH_WG302V2) += wg302v2-pci.o - obj-pci-$(CONFIG_MACH_FSG) += fsg-pci.o -+obj-pci-$(CONFIG_MACH_PRONGHORNMETRO) += pronghornmetro-pci.o - - obj-y += common.o - -@@ -30,5 +31,6 @@ obj-$(CONFIG_MACH_DSMG600) += dsmg6 - obj-$(CONFIG_MACH_GATEWAY7001) += gateway7001-setup.o - obj-$(CONFIG_MACH_WG302V2) += wg302v2-setup.o - obj-$(CONFIG_MACH_FSG) += fsg-setup.o fsg-power.o -+obj-$(CONFIG_MACH_PRONGHORNMETRO) += pronghornmetro-setup.o - - obj-$(CONFIG_PCI) += $(obj-pci-$(CONFIG_PCI)) common-pci.o -Index: linux-2.6.23.17/arch/arm/mach-ixp4xx/pronghornmetro-pci.c -=================================================================== ---- /dev/null -+++ linux-2.6.23.17/arch/arm/mach-ixp4xx/pronghornmetro-pci.c -@@ -0,0 +1,74 @@ -+/* -+ * arch/arch/mach-ixp4xx/pronghornmetro-pci.c -+ * -+ * PCI setup routines for ADI Engineering Pronghorn Metro -+ * -+ * Copyright (C) 2007 Imre Kaloz <kaloz@openwrt.org> -+ * -+ * based on coyote-pci.c: -+ * Copyright (C) 2002 Jungo Software Technologies. -+ * Copyright (C) 2003 MontaVista Softwrae, Inc. -+ * -+ * Maintainer: Imre Kaloz <kaloz@openwrt.org> -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ * -+ */ -+ -+#include <linux/kernel.h> -+#include <linux/pci.h> -+#include <linux/init.h> -+#include <linux/irq.h> -+ -+#include <asm/mach-types.h> -+#include <asm/hardware.h> -+#include <asm/irq.h> -+ -+#include <asm/mach/pci.h> -+ -+extern void ixp4xx_pci_preinit(void); -+extern int ixp4xx_setup(int nr, struct pci_sys_data *sys); -+extern struct pci_bus *ixp4xx_scan_bus(int nr, struct pci_sys_data *sys); -+ -+void __init pronghornmetro_pci_preinit(void) -+{ -+ set_irq_type(IRQ_IXP4XX_GPIO4, IRQT_LOW); -+ set_irq_type(IRQ_IXP4XX_GPIO6, IRQT_LOW); -+ set_irq_type(IRQ_IXP4XX_GPIO11, IRQT_LOW); -+ set_irq_type(IRQ_IXP4XX_GPIO1, IRQT_LOW); -+ -+ ixp4xx_pci_preinit(); -+} -+ -+static int __init pronghornmetro_map_irq(struct pci_dev *dev, u8 slot, u8 pin) -+{ -+ if (slot == 13) -+ return IRQ_IXP4XX_GPIO4; -+ else if (slot == 14) -+ return IRQ_IXP4XX_GPIO6; -+ else if (slot == 15) -+ return IRQ_IXP4XX_GPIO11; -+ else if (slot == 16) -+ return IRQ_IXP4XX_GPIO1; -+ else return -1; -+} -+ -+struct hw_pci pronghornmetro_pci __initdata = { -+ .nr_controllers = 1, -+ .preinit = pronghornmetro_pci_preinit, -+ .swizzle = pci_std_swizzle, -+ .setup = ixp4xx_setup, -+ .scan = ixp4xx_scan_bus, -+ .map_irq = pronghornmetro_map_irq, -+}; -+ -+int __init pronghornmetro_pci_init(void) -+{ -+ if (machine_is_pronghorn_metro()) -+ pci_common_init(&pronghornmetro_pci); -+ return 0; -+} -+ -+subsys_initcall(pronghornmetro_pci_init); -Index: linux-2.6.23.17/arch/arm/mach-ixp4xx/pronghornmetro-setup.c -=================================================================== ---- /dev/null -+++ linux-2.6.23.17/arch/arm/mach-ixp4xx/pronghornmetro-setup.c -@@ -0,0 +1,147 @@ -+/* -+ * arch/arm/mach-ixp4xx/pronghornmetro-setup.c -+ * -+ * Board setup for the ADI Engineering Pronghorn Metro -+ * -+ * Copyright (C) 2007 Imre Kaloz <Kaloz@openwrt.org> -+ * -+ * based on coyote-setup.c: -+ * Copyright (C) 2003-2005 MontaVista Software, Inc. -+ * -+ * Author: Imre Kaloz <Kaloz@openwrt.org> -+ */ -+ -+#include <linux/kernel.h> -+#include <linux/init.h> -+#include <linux/device.h> -+#include <linux/serial.h> -+#include <linux/tty.h> -+#include <linux/serial_8250.h> -+#include <linux/slab.h> -+ -+#include <asm/types.h> -+#include <asm/setup.h> -+#include <asm/memory.h> -+#include <asm/hardware.h> -+#include <asm/irq.h> -+#include <asm/mach-types.h> -+#include <asm/mach/arch.h> -+#include <asm/mach/flash.h> -+ -+static struct flash_platform_data pronghornmetro_flash_data = { -+ .map_name = "cfi_probe", -+ .width = 2, -+}; -+ -+static struct resource pronghornmetro_flash_resource = { -+ .flags = IORESOURCE_MEM, -+}; -+ -+static struct platform_device pronghornmetro_flash = { -+ .name = "IXP4XX-Flash", -+ .id = 0, -+ .dev = { -+ .platform_data = &pronghornmetro_flash_data, -+ }, -+ .num_resources = 1, -+ .resource = &pronghornmetro_flash_resource, -+}; -+ -+static struct resource pronghornmetro_uart_resource = { -+ .start = IXP4XX_UART2_BASE_PHYS, -+ .end = IXP4XX_UART2_BASE_PHYS + 0x0fff, -+ .flags = IORESOURCE_MEM, -+}; -+ -+static struct plat_serial8250_port pronghornmetro_uart_data[] = { -+ { -+ .mapbase = IXP4XX_UART2_BASE_PHYS, -+ .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET, -+ .irq = IRQ_IXP4XX_UART2, -+ .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, -+ .iotype = UPIO_MEM, -+ .regshift = 2, -+ .uartclk = IXP4XX_UART_XTAL, -+ }, -+ { }, -+}; -+ -+static struct platform_device pronghornmetro_uart = { -+ .name = "serial8250", -+ .id = PLAT8250_DEV_PLATFORM, -+ .dev = { -+ .platform_data = pronghornmetro_uart_data, -+ }, -+ .num_resources = 1, -+ .resource = &pronghornmetro_uart_resource, -+}; -+ -+static struct resource pronghornmetro_pata_resources[] = { -+ { -+ .flags = IORESOURCE_MEM -+ }, -+ { -+ .flags = IORESOURCE_MEM, -+ }, -+ { -+ .name = "intrq", -+ .start = IRQ_IXP4XX_GPIO0, -+ .end = IRQ_IXP4XX_GPIO0, -+ .flags = IORESOURCE_IRQ, -+ }, -+}; -+ -+static struct ixp4xx_pata_data pronghornmetro_pata_data = { -+ .cs0_bits = 0xbfff0043, -+ .cs1_bits = 0xbfff0043, -+}; -+ -+static struct platform_device pronghornmetro_pata = { -+ .name = "pata_ixp4xx_cf", -+ .id = 0, -+ .dev.platform_data = &pronghornmetro_pata_data, -+ .num_resources = ARRAY_SIZE(pronghornmetro_pata_resources), -+ .resource = pronghornmetro_pata_resources, -+}; -+ -+static struct platform_device *pronghornmetro_devices[] __initdata = { -+ &pronghornmetro_flash, -+ &pronghornmetro_uart, -+}; -+ -+static void __init pronghornmetro_init(void) -+{ -+ ixp4xx_sys_init(); -+ -+ pronghornmetro_flash_resource.start = IXP4XX_EXP_BUS_BASE(0); -+ pronghornmetro_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_16M - 1; -+ -+ *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE; -+ *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0; -+ -+ platform_add_devices(pronghornmetro_devices, ARRAY_SIZE(pronghornmetro_devices)); -+ -+ pronghornmetro_pata_resources[0].start = IXP4XX_EXP_BUS_BASE(1); -+ pronghornmetro_pata_resources[0].end = IXP4XX_EXP_BUS_END(1); -+ -+ pronghornmetro_pata_resources[1].start = IXP4XX_EXP_BUS_BASE(2); -+ pronghornmetro_pata_resources[1].end = IXP4XX_EXP_BUS_END(2); -+ -+ pronghornmetro_pata_data.cs0_cfg = IXP4XX_EXP_CS1; -+ pronghornmetro_pata_data.cs1_cfg = IXP4XX_EXP_CS2; -+ -+ platform_device_register(&pronghornmetro_pata); -+} -+ -+#ifdef CONFIG_MACH_PRONGHORNMETRO -+MACHINE_START(PRONGHORNMETRO, "ADI Engineering Pronghorn Metro") -+ /* Maintainer: Imre Kaloz <kaloz@openwrt.org> */ -+ .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, -+ .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, -+ .map_io = ixp4xx_map_io, -+ .init_irq = ixp4xx_init_irq, -+ .timer = &ixp4xx_timer, -+ .boot_params = 0x0100, -+ .init_machine = pronghornmetro_init, -+MACHINE_END -+#endif -Index: linux-2.6.23.17/Documentation/arm/IXP4xx -=================================================================== ---- linux-2.6.23.17.orig/Documentation/arm/IXP4xx -+++ linux-2.6.23.17/Documentation/arm/IXP4xx -@@ -111,6 +111,9 @@ http://www.adiengineering.com/productsCo - the platform has two mini-PCI slots used for 802.11[bga] cards. - Finally, there is an IDE port hanging off the expansion bus. - -+ADI Engineering Pronghorn Metro Platform -+http://www.adiengineering.com/php-bin/ecomm4/productDisplay.php?category_id=30&product_id=85 -+ - Gateworks Avila Network Platform - http://www.gateworks.com/avila_sbc.htm - -Index: linux-2.6.23.17/include/asm-arm/arch-ixp4xx/uncompress.h -=================================================================== ---- linux-2.6.23.17.orig/include/asm-arm/arch-ixp4xx/uncompress.h -+++ linux-2.6.23.17/include/asm-arm/arch-ixp4xx/uncompress.h -@@ -41,7 +41,8 @@ static __inline__ void __arch_decomp_set - * Some boards are using UART2 as console - */ - if (machine_is_adi_coyote() || machine_is_gtwx5715() || -- machine_is_gateway7001() || machine_is_wg302v2()) -+ machine_is_gateway7001() || machine_is_wg302v2() || -+ machine_is_pronghorn_metro()) - uart_base = (volatile u32*) IXP4XX_UART2_BASE_PHYS; - else - uart_base = (volatile u32*) IXP4XX_UART1_BASE_PHYS; diff --git a/target/linux/ixp4xx/patches-2.6.23/111-pronghorn_metro_mac_plat_info.patch b/target/linux/ixp4xx/patches-2.6.23/111-pronghorn_metro_mac_plat_info.patch deleted file mode 100644 index 50e93da854..0000000000 --- a/target/linux/ixp4xx/patches-2.6.23/111-pronghorn_metro_mac_plat_info.patch +++ /dev/null @@ -1,41 +0,0 @@ -Index: linux-2.6.23.17/arch/arm/mach-ixp4xx/pronghornmetro-setup.c -=================================================================== ---- linux-2.6.23.17.orig/arch/arm/mach-ixp4xx/pronghornmetro-setup.c -+++ linux-2.6.23.17/arch/arm/mach-ixp4xx/pronghornmetro-setup.c -@@ -104,9 +104,36 @@ static struct platform_device pronghornm - .resource = pronghornmetro_pata_resources, - }; - -+/* Built-in 10/100 Ethernet MAC interfaces */ -+static struct eth_plat_info pronghornmetro_plat_eth[] = { -+ { -+ .phy = 0, -+ .rxq = 3, -+ .txreadyq = 20, -+ }, { -+ .phy = 1, -+ .rxq = 4, -+ .txreadyq = 21, -+ } -+}; -+ -+static struct platform_device pronghornmetro_eth[] = { -+ { -+ .name = "ixp4xx_eth", -+ .id = IXP4XX_ETH_NPEB, -+ .dev.platform_data = pronghornmetro_plat_eth, -+ }, { -+ .name = "ixp4xx_eth", -+ .id = IXP4XX_ETH_NPEC, -+ .dev.platform_data = pronghornmetro_plat_eth + 1, -+ } -+}; -+ - static struct platform_device *pronghornmetro_devices[] __initdata = { - &pronghornmetro_flash, - &pronghornmetro_uart, -+ &pronghornmetro_eth[0], -+ &pronghornmetro_eth[1], - }; - - static void __init pronghornmetro_init(void) diff --git a/target/linux/ixp4xx/patches-2.6.23/120-compex_support.patch b/target/linux/ixp4xx/patches-2.6.23/120-compex_support.patch deleted file mode 100644 index a51225bdd0..0000000000 --- a/target/linux/ixp4xx/patches-2.6.23/120-compex_support.patch +++ /dev/null @@ -1,189 +0,0 @@ -Index: linux-2.6.23.17/arch/arm/mach-ixp4xx/Kconfig -=================================================================== ---- linux-2.6.23.17.orig/arch/arm/mach-ixp4xx/Kconfig -+++ linux-2.6.23.17/arch/arm/mach-ixp4xx/Kconfig -@@ -65,6 +65,14 @@ config MACH_PRONGHORNMETRO - Engineering Pronghorn Metro Platform. For more - information on this platform, see <file:Documentation/arm/IXP4xx>. - -+config MACH_COMPEX -+ bool "Compex WP18 / NP18A" -+ select PCI -+ help -+ Say 'Y' here if you want your kernel to support Compex' -+ WP18 or NP18A boards. For more information on this -+ platform, see http://openwrt.org -+ - config ARCH_IXDP425 - bool "IXDP425" - help -Index: linux-2.6.23.17/arch/arm/mach-ixp4xx/Makefile -=================================================================== ---- linux-2.6.23.17.orig/arch/arm/mach-ixp4xx/Makefile -+++ linux-2.6.23.17/arch/arm/mach-ixp4xx/Makefile -@@ -17,6 +17,7 @@ obj-pci-$(CONFIG_MACH_GATEWAY7001) += ga - obj-pci-$(CONFIG_MACH_WG302V2) += wg302v2-pci.o - obj-pci-$(CONFIG_MACH_FSG) += fsg-pci.o - obj-pci-$(CONFIG_MACH_PRONGHORNMETRO) += pronghornmetro-pci.o -+obj-pci-$(CONFIG_MACH_COMPEX) += ixdp425-pci.o - - obj-y += common.o - -@@ -32,5 +33,6 @@ obj-$(CONFIG_MACH_GATEWAY7001) += gatewa - obj-$(CONFIG_MACH_WG302V2) += wg302v2-setup.o - obj-$(CONFIG_MACH_FSG) += fsg-setup.o fsg-power.o - obj-$(CONFIG_MACH_PRONGHORNMETRO) += pronghornmetro-setup.o -+obj-$(CONFIG_MACH_COMPEX) += compex-setup.o - - obj-$(CONFIG_PCI) += $(obj-pci-$(CONFIG_PCI)) common-pci.o -Index: linux-2.6.23.17/arch/arm/mach-ixp4xx/compex-setup.c -=================================================================== ---- /dev/null -+++ linux-2.6.23.17/arch/arm/mach-ixp4xx/compex-setup.c -@@ -0,0 +1,120 @@ -+/* -+ * arch/arm/mach-ixp4xx/compex-setup.c -+ * -+ * Ccompex WP18 / NP18A board-setup -+ * -+ * Copyright (C) 2007 Imre Kaloz <Kaloz@openwrt.org> -+ * -+ * based on ixdp425-setup.c: -+ * Copyright (C) 2003-2005 MontaVista Software, Inc. -+ * -+ * Author: Imre Kaloz <Kaloz@openwrt.org> -+ */ -+ -+#include <linux/kernel.h> -+#include <linux/init.h> -+#include <linux/device.h> -+#include <linux/serial.h> -+#include <linux/tty.h> -+#include <linux/serial_8250.h> -+#include <linux/slab.h> -+ -+#include <asm/types.h> -+#include <asm/setup.h> -+#include <asm/memory.h> -+#include <asm/hardware.h> -+#include <asm/mach-types.h> -+#include <asm/irq.h> -+#include <asm/mach/arch.h> -+#include <asm/mach/flash.h> -+ -+static struct flash_platform_data compex_flash_data = { -+ .map_name = "cfi_probe", -+ .width = 2, -+}; -+ -+static struct resource compex_flash_resource = { -+ .flags = IORESOURCE_MEM, -+}; -+ -+static struct platform_device compex_flash = { -+ .name = "IXP4XX-Flash", -+ .id = 0, -+ .dev = { -+ .platform_data = &compex_flash_data, -+ }, -+ .num_resources = 1, -+ .resource = &compex_flash_resource, -+}; -+ -+static struct resource compex_uart_resources[] = { -+ { -+ .start = IXP4XX_UART1_BASE_PHYS, -+ .end = IXP4XX_UART1_BASE_PHYS + 0x0fff, -+ .flags = IORESOURCE_MEM -+ }, -+ { -+ .start = IXP4XX_UART2_BASE_PHYS, -+ .end = IXP4XX_UART2_BASE_PHYS + 0x0fff, -+ .flags = IORESOURCE_MEM -+ } -+}; -+ -+static struct plat_serial8250_port compex_uart_data[] = { -+ { -+ .mapbase = IXP4XX_UART1_BASE_PHYS, -+ .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET, -+ .irq = IRQ_IXP4XX_UART1, -+ .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, -+ .iotype = UPIO_MEM, -+ .regshift = 2, -+ .uartclk = IXP4XX_UART_XTAL, -+ }, -+ { -+ .mapbase = IXP4XX_UART2_BASE_PHYS, -+ .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET, -+ .irq = IRQ_IXP4XX_UART2, -+ .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, -+ .iotype = UPIO_MEM, -+ .regshift = 2, -+ .uartclk = IXP4XX_UART_XTAL, -+ }, -+ { }, -+}; -+ -+static struct platform_device compex_uart = { -+ .name = "serial8250", -+ .id = PLAT8250_DEV_PLATFORM, -+ .dev.platform_data = compex_uart_data, -+ .num_resources = 2, -+ .resource = compex_uart_resources, -+}; -+ -+static struct platform_device *compex_devices[] __initdata = { -+ &compex_flash, -+ &compex_uart -+}; -+ -+static void __init compex_init(void) -+{ -+ ixp4xx_sys_init(); -+ -+ compex_flash_resource.start = IXP4XX_EXP_BUS_BASE(0); -+ compex_flash_resource.end = -+ IXP4XX_EXP_BUS_BASE(0) + SZ_32M - 1; -+ -+ platform_add_devices(compex_devices, ARRAY_SIZE(compex_devices)); -+} -+ -+#ifdef CONFIG_MACH_COMPEX -+MACHINE_START(COMPEX, "Compex WP18 / NP18A") -+ /* Maintainer: Imre Kaloz <Kaloz@openwrt.org> */ -+ .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, -+ .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, -+ .map_io = ixp4xx_map_io, -+ .init_irq = ixp4xx_init_irq, -+ .timer = &ixp4xx_timer, -+ .boot_params = 0x0100, -+ .init_machine = compex_init, -+MACHINE_END -+#endif -Index: linux-2.6.23.17/arch/arm/mach-ixp4xx/ixdp425-pci.c -=================================================================== ---- linux-2.6.23.17.orig/arch/arm/mach-ixp4xx/ixdp425-pci.c -+++ linux-2.6.23.17/arch/arm/mach-ixp4xx/ixdp425-pci.c -@@ -66,7 +66,7 @@ struct hw_pci ixdp425_pci __initdata = { - int __init ixdp425_pci_init(void) - { - if (machine_is_ixdp425() || machine_is_ixcdp1100() || -- machine_is_ixdp465() || machine_is_kixrp435()) -+ machine_is_ixdp465() || machine_is_kixrp435() || machine_is_compex()) - pci_common_init(&ixdp425_pci); - return 0; - } -Index: linux-2.6.23.17/arch/arm/tools/mach-types -=================================================================== ---- linux-2.6.23.17.orig/arch/arm/tools/mach-types -+++ linux-2.6.23.17/arch/arm/tools/mach-types -@@ -1278,7 +1278,7 @@ oiab MACH_OIAB OIAB 1269 - smdk6400 MACH_SMDK6400 SMDK6400 1270 - nokia_n800 MACH_NOKIA_N800 NOKIA_N800 1271 - greenphone MACH_GREENPHONE GREENPHONE 1272 --compex42x MACH_COMPEXWP18 COMPEXWP18 1273 -+compex MACH_COMPEX COMPEX 1273 - xmate MACH_XMATE XMATE 1274 - energizer MACH_ENERGIZER ENERGIZER 1275 - ime1 MACH_IME1 IME1 1276 diff --git a/target/linux/ixp4xx/patches-2.6.23/121-compex_mac_plat_info.patch b/target/linux/ixp4xx/patches-2.6.23/121-compex_mac_plat_info.patch deleted file mode 100644 index f7ff4619c8..0000000000 --- a/target/linux/ixp4xx/patches-2.6.23/121-compex_mac_plat_info.patch +++ /dev/null @@ -1,42 +0,0 @@ -Index: linux-2.6.23.17/arch/arm/mach-ixp4xx/compex-setup.c -=================================================================== ---- linux-2.6.23.17.orig/arch/arm/mach-ixp4xx/compex-setup.c -+++ linux-2.6.23.17/arch/arm/mach-ixp4xx/compex-setup.c -@@ -90,9 +90,36 @@ static struct platform_device compex_uar - .resource = compex_uart_resources, - }; - -+/* Built-in 10/100 Ethernet MAC interfaces */ -+static struct eth_plat_info compex_plat_eth[] = { -+ { -+ .phy = -1, -+ .rxq = 3, -+ .txreadyq = 20, -+ }, { -+ .phy = 3, -+ .rxq = 4, -+ .txreadyq = 21, -+ } -+}; -+ -+static struct platform_device compex_eth[] = { -+ { -+ .name = "ixp4xx_eth", -+ .id = IXP4XX_ETH_NPEB, -+ .dev.platform_data = compex_plat_eth, -+ }, { -+ .name = "ixp4xx_eth", -+ .id = IXP4XX_ETH_NPEC, -+ .dev.platform_data = compex_plat_eth + 1, -+ } -+}; -+ - static struct platform_device *compex_devices[] __initdata = { - &compex_flash, -- &compex_uart -+ &compex_uart, -+ &compex_eth[0], -+ &compex_eth[1], - }; - - static void __init compex_init(void) diff --git a/target/linux/ixp4xx/patches-2.6.23/130-wrt300nv2_support.patch b/target/linux/ixp4xx/patches-2.6.23/130-wrt300nv2_support.patch deleted file mode 100644 index 1dcc85bb2e..0000000000 --- a/target/linux/ixp4xx/patches-2.6.23/130-wrt300nv2_support.patch +++ /dev/null @@ -1,234 +0,0 @@ -Index: linux-2.6.23.17/arch/arm/mach-ixp4xx/Kconfig -=================================================================== ---- linux-2.6.23.17.orig/arch/arm/mach-ixp4xx/Kconfig -+++ linux-2.6.23.17/arch/arm/mach-ixp4xx/Kconfig -@@ -73,6 +73,14 @@ config MACH_COMPEX - WP18 or NP18A boards. For more information on this - platform, see http://openwrt.org - -+config MACH_WRT300NV2 -+ bool "Linksys WRT300N v2" -+ select PCI -+ help -+ Say 'Y' here if you want your kernel to support Linksys' -+ WRT300N v2 router. For more information on this -+ platform, see http://openwrt.org -+ - config ARCH_IXDP425 - bool "IXDP425" - help -Index: linux-2.6.23.17/arch/arm/mach-ixp4xx/Makefile -=================================================================== ---- linux-2.6.23.17.orig/arch/arm/mach-ixp4xx/Makefile -+++ linux-2.6.23.17/arch/arm/mach-ixp4xx/Makefile -@@ -18,6 +18,7 @@ obj-pci-$(CONFIG_MACH_WG302V2) += wg302 - obj-pci-$(CONFIG_MACH_FSG) += fsg-pci.o - obj-pci-$(CONFIG_MACH_PRONGHORNMETRO) += pronghornmetro-pci.o - obj-pci-$(CONFIG_MACH_COMPEX) += ixdp425-pci.o -+obj-pci-$(CONFIG_MACH_WRT300NV2) += wrt300nv2-pci.o - - obj-y += common.o - -@@ -34,5 +35,6 @@ obj-$(CONFIG_MACH_WG302V2) += wg302v2-se - obj-$(CONFIG_MACH_FSG) += fsg-setup.o fsg-power.o - obj-$(CONFIG_MACH_PRONGHORNMETRO) += pronghornmetro-setup.o - obj-$(CONFIG_MACH_COMPEX) += compex-setup.o -+obj-$(CONFIG_MACH_WRT300NV2) += wrt300nv2-setup.o - - obj-$(CONFIG_PCI) += $(obj-pci-$(CONFIG_PCI)) common-pci.o -Index: linux-2.6.23.17/arch/arm/mach-ixp4xx/wrt300nv2-pci.c -=================================================================== ---- /dev/null -+++ linux-2.6.23.17/arch/arm/mach-ixp4xx/wrt300nv2-pci.c -@@ -0,0 +1,65 @@ -+/* -+ * arch/arch/mach-ixp4xx/wrt300nv2-pci.c -+ * -+ * PCI setup routines for Linksys WRT300N v2 -+ * -+ * Copyright (C) 2007 Imre Kaloz <kaloz@openwrt.org> -+ * -+ * based on coyote-pci.c: -+ * Copyright (C) 2002 Jungo Software Technologies. -+ * Copyright (C) 2003 MontaVista Softwrae, Inc. -+ * -+ * Maintainer: Imre Kaloz <kaloz@openwrt.org> -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ * -+ */ -+ -+#include <linux/kernel.h> -+#include <linux/pci.h> -+#include <linux/init.h> -+#include <linux/irq.h> -+ -+#include <asm/mach-types.h> -+#include <asm/hardware.h> -+#include <asm/irq.h> -+ -+#include <asm/mach/pci.h> -+ -+extern void ixp4xx_pci_preinit(void); -+extern int ixp4xx_setup(int nr, struct pci_sys_data *sys); -+extern struct pci_bus *ixp4xx_scan_bus(int nr, struct pci_sys_data *sys); -+ -+void __init wrt300nv2_pci_preinit(void) -+{ -+ set_irq_type(IRQ_IXP4XX_GPIO8, IRQT_LOW); -+ -+ ixp4xx_pci_preinit(); -+} -+ -+static int __init wrt300nv2_map_irq(struct pci_dev *dev, u8 slot, u8 pin) -+{ -+ if (slot == 1) -+ return IRQ_IXP4XX_GPIO8; -+ else return -1; -+} -+ -+struct hw_pci wrt300nv2_pci __initdata = { -+ .nr_controllers = 1, -+ .preinit = wrt300nv2_pci_preinit, -+ .swizzle = pci_std_swizzle, -+ .setup = ixp4xx_setup, -+ .scan = ixp4xx_scan_bus, -+ .map_irq = wrt300nv2_map_irq, -+}; -+ -+int __init wrt300nv2_pci_init(void) -+{ -+ if (machine_is_wrt300nv2()) -+ pci_common_init(&wrt300nv2_pci); -+ return 0; -+} -+ -+subsys_initcall(wrt300nv2_pci_init); -Index: linux-2.6.23.17/arch/arm/mach-ixp4xx/wrt300nv2-setup.c -=================================================================== ---- /dev/null -+++ linux-2.6.23.17/arch/arm/mach-ixp4xx/wrt300nv2-setup.c -@@ -0,0 +1,108 @@ -+/* -+ * arch/arm/mach-ixp4xx/wrt300nv2-setup.c -+ * -+ * Board setup for the Linksys WRT300N v2 -+ * -+ * Copyright (C) 2007 Imre Kaloz <Kaloz@openwrt.org> -+ * -+ * based on coyote-setup.c: -+ * Copyright (C) 2003-2005 MontaVista Software, Inc. -+ * -+ * Author: Imre Kaloz <Kaloz@openwrt.org> -+ */ -+ -+#include <linux/kernel.h> -+#include <linux/init.h> -+#include <linux/device.h> -+#include <linux/serial.h> -+#include <linux/tty.h> -+#include <linux/serial_8250.h> -+#include <linux/slab.h> -+ -+#include <asm/types.h> -+#include <asm/setup.h> -+#include <asm/memory.h> -+#include <asm/hardware.h> -+#include <asm/irq.h> -+#include <asm/mach-types.h> -+#include <asm/mach/arch.h> -+#include <asm/mach/flash.h> -+ -+static struct flash_platform_data wrt300nv2_flash_data = { -+ .map_name = "cfi_probe", -+ .width = 2, -+}; -+ -+static struct resource wrt300nv2_flash_resource = { -+ .flags = IORESOURCE_MEM, -+}; -+ -+static struct platform_device wrt300nv2_flash = { -+ .name = "IXP4XX-Flash", -+ .id = 0, -+ .dev = { -+ .platform_data = &wrt300nv2_flash_data, -+ }, -+ .num_resources = 1, -+ .resource = &wrt300nv2_flash_resource, -+}; -+ -+static struct resource wrt300nv2_uart_resource = { -+ .start = IXP4XX_UART2_BASE_PHYS, -+ .end = IXP4XX_UART2_BASE_PHYS + 0x0fff, -+ .flags = IORESOURCE_MEM, -+}; -+ -+static struct plat_serial8250_port wrt300nv2_uart_data[] = { -+ { -+ .mapbase = IXP4XX_UART2_BASE_PHYS, -+ .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET, -+ .irq = IRQ_IXP4XX_UART2, -+ .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, -+ .iotype = UPIO_MEM, -+ .regshift = 2, -+ .uartclk = IXP4XX_UART_XTAL, -+ }, -+ { }, -+}; -+ -+static struct platform_device wrt300nv2_uart = { -+ .name = "serial8250", -+ .id = PLAT8250_DEV_PLATFORM, -+ .dev = { -+ .platform_data = wrt300nv2_uart_data, -+ }, -+ .num_resources = 1, -+ .resource = &wrt300nv2_uart_resource, -+}; -+ -+static struct platform_device *wrt300nv2_devices[] __initdata = { -+ &wrt300nv2_flash, -+ &wrt300nv2_uart -+}; -+ -+static void __init wrt300nv2_init(void) -+{ -+ ixp4xx_sys_init(); -+ -+ wrt300nv2_flash_resource.start = IXP4XX_EXP_BUS_BASE(0); -+ wrt300nv2_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_32M - 1; -+ -+ *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE; -+ *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0; -+ -+ platform_add_devices(wrt300nv2_devices, ARRAY_SIZE(wrt300nv2_devices)); -+} -+ -+#ifdef CONFIG_MACH_WRT300NV2 -+MACHINE_START(WRT300NV2, "Linksys WRT300N v2") -+ /* Maintainer: Imre Kaloz <kaloz@openwrt.org> */ -+ .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, -+ .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, -+ .map_io = ixp4xx_map_io, -+ .init_irq = ixp4xx_init_irq, -+ .timer = &ixp4xx_timer, -+ .boot_params = 0x0100, -+ .init_machine = wrt300nv2_init, -+MACHINE_END -+#endif -Index: linux-2.6.23.17/include/asm-arm/arch-ixp4xx/uncompress.h -=================================================================== ---- linux-2.6.23.17.orig/include/asm-arm/arch-ixp4xx/uncompress.h -+++ linux-2.6.23.17/include/asm-arm/arch-ixp4xx/uncompress.h -@@ -42,7 +42,7 @@ static __inline__ void __arch_decomp_set - */ - if (machine_is_adi_coyote() || machine_is_gtwx5715() || - machine_is_gateway7001() || machine_is_wg302v2() || -- machine_is_pronghorn_metro()) -+ machine_is_pronghorn_metro() || machine_is_wrt300nv2()) - uart_base = (volatile u32*) IXP4XX_UART2_BASE_PHYS; - else - uart_base = (volatile u32*) IXP4XX_UART1_BASE_PHYS; diff --git a/target/linux/ixp4xx/patches-2.6.23/131-wrt300nv2_mac_plat_info.patch b/target/linux/ixp4xx/patches-2.6.23/131-wrt300nv2_mac_plat_info.patch deleted file mode 100644 index c4e52f9f3b..0000000000 --- a/target/linux/ixp4xx/patches-2.6.23/131-wrt300nv2_mac_plat_info.patch +++ /dev/null @@ -1,42 +0,0 @@ -Index: linux-2.6.23.17/arch/arm/mach-ixp4xx/wrt300nv2-setup.c -=================================================================== ---- linux-2.6.23.17.orig/arch/arm/mach-ixp4xx/wrt300nv2-setup.c -+++ linux-2.6.23.17/arch/arm/mach-ixp4xx/wrt300nv2-setup.c -@@ -76,9 +76,36 @@ static struct platform_device wrt300nv2_ - .resource = &wrt300nv2_uart_resource, - }; - -+/* Built-in 10/100 Ethernet MAC interfaces */ -+static struct eth_plat_info wrt300nv2_plat_eth[] = { -+ { -+ .phy = -1, -+ .rxq = 3, -+ .txreadyq = 20, -+ }, { -+ .phy = 1, -+ .rxq = 4, -+ .txreadyq = 21, -+ } -+}; -+ -+static struct platform_device wrt300nv2_eth[] = { -+ { -+ .name = "ixp4xx_eth", -+ .id = IXP4XX_ETH_NPEB, -+ .dev.platform_data = wrt300nv2_plat_eth, -+ }, { -+ .name = "ixp4xx_eth", -+ .id = IXP4XX_ETH_NPEC, -+ .dev.platform_data = wrt300nv2_plat_eth + 1, -+ } -+}; -+ - static struct platform_device *wrt300nv2_devices[] __initdata = { - &wrt300nv2_flash, -- &wrt300nv2_uart -+ &wrt300nv2_uart, -+ &wrt300nv2_eth[0], -+ &wrt300nv2_eth[1], - }; - - static void __init wrt300nv2_init(void) diff --git a/target/linux/ixp4xx/patches-2.6.23/140-sidewinder_support.patch b/target/linux/ixp4xx/patches-2.6.23/140-sidewinder_support.patch deleted file mode 100644 index 024eb6198e..0000000000 --- a/target/linux/ixp4xx/patches-2.6.23/140-sidewinder_support.patch +++ /dev/null @@ -1,243 +0,0 @@ -Index: linux-2.6.23.17/arch/arm/mach-ixp4xx/Kconfig -=================================================================== ---- linux-2.6.23.17.orig/arch/arm/mach-ixp4xx/Kconfig -+++ linux-2.6.23.17/arch/arm/mach-ixp4xx/Kconfig -@@ -65,6 +65,14 @@ config MACH_PRONGHORNMETRO - Engineering Pronghorn Metro Platform. For more - information on this platform, see <file:Documentation/arm/IXP4xx>. - -+config MACH_SIDEWINDER -+ bool "Sidewinder" -+ select PCI -+ help -+ Say 'Y' here if you want your kernel to support the ADI -+ Engineering Sidewinder Platform. For more -+ information on this platform, see <file:Documentation/arm/IXP4xx>. -+ - config MACH_COMPEX - bool "Compex WP18 / NP18A" - select PCI -@@ -163,7 +171,7 @@ config MACH_FSG - # - config CPU_IXP46X - bool -- depends on MACH_IXDP465 -+ depends on MACH_IXDP465 || MACH_SIDEWINDER - default y - - config CPU_IXP43X -Index: linux-2.6.23.17/arch/arm/mach-ixp4xx/Makefile -=================================================================== ---- linux-2.6.23.17.orig/arch/arm/mach-ixp4xx/Makefile -+++ linux-2.6.23.17/arch/arm/mach-ixp4xx/Makefile -@@ -19,6 +19,7 @@ obj-pci-$(CONFIG_MACH_FSG) += fsg-pci.o - obj-pci-$(CONFIG_MACH_PRONGHORNMETRO) += pronghornmetro-pci.o - obj-pci-$(CONFIG_MACH_COMPEX) += ixdp425-pci.o - obj-pci-$(CONFIG_MACH_WRT300NV2) += wrt300nv2-pci.o -+obj-pci-$(CONFIG_MACH_SIDEWINDER) += sidewinder-pci.o - - obj-y += common.o - -@@ -36,5 +37,6 @@ obj-$(CONFIG_MACH_FSG) += fsg-setup.o f - obj-$(CONFIG_MACH_PRONGHORNMETRO) += pronghornmetro-setup.o - obj-$(CONFIG_MACH_COMPEX) += compex-setup.o - obj-$(CONFIG_MACH_WRT300NV2) += wrt300nv2-setup.o -+obj-$(CONFIG_MACH_SIDEWINDER) += sidewinder-setup.o - - obj-$(CONFIG_PCI) += $(obj-pci-$(CONFIG_PCI)) common-pci.o -Index: linux-2.6.23.17/arch/arm/mach-ixp4xx/sidewinder-pci.c -=================================================================== ---- /dev/null -+++ linux-2.6.23.17/arch/arm/mach-ixp4xx/sidewinder-pci.c -@@ -0,0 +1,71 @@ -+/* -+ * arch/arch/mach-ixp4xx/pronghornmetro-pci.c -+ * -+ * PCI setup routines for ADI Engineering Sidewinder -+ * -+ * Copyright (C) 2007 Imre Kaloz <kaloz@openwrt.org> -+ * -+ * based on coyote-pci.c: -+ * Copyright (C) 2002 Jungo Software Technologies. -+ * Copyright (C) 2003 MontaVista Softwrae, Inc. -+ * -+ * Maintainer: Imre Kaloz <kaloz@openwrt.org> -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ * -+ */ -+ -+#include <linux/kernel.h> -+#include <linux/pci.h> -+#include <linux/init.h> -+#include <linux/irq.h> -+ -+#include <asm/mach-types.h> -+#include <asm/hardware.h> -+#include <asm/irq.h> -+ -+#include <asm/mach/pci.h> -+ -+extern void ixp4xx_pci_preinit(void); -+extern int ixp4xx_setup(int nr, struct pci_sys_data *sys); -+extern struct pci_bus *ixp4xx_scan_bus(int nr, struct pci_sys_data *sys); -+ -+void __init sidewinder_pci_preinit(void) -+{ -+ set_irq_type(IRQ_IXP4XX_GPIO11, IRQT_LOW); -+ set_irq_type(IRQ_IXP4XX_GPIO10, IRQT_LOW); -+ set_irq_type(IRQ_IXP4XX_GPIO9, IRQT_LOW); -+ -+ ixp4xx_pci_preinit(); -+} -+ -+static int __init sidewinder_map_irq(struct pci_dev *dev, u8 slot, u8 pin) -+{ -+ if (slot == 1) -+ return IRQ_IXP4XX_GPIO11; -+ else if (slot == 2) -+ return IRQ_IXP4XX_GPIO10; -+ else if (slot == 3) -+ return IRQ_IXP4XX_GPIO9; -+ else return -1; -+} -+ -+struct hw_pci sidewinder_pci __initdata = { -+ .nr_controllers = 1, -+ .preinit = sidewinder_pci_preinit, -+ .swizzle = pci_std_swizzle, -+ .setup = ixp4xx_setup, -+ .scan = ixp4xx_scan_bus, -+ .map_irq = sidewinder_map_irq, -+}; -+ -+int __init sidewinder_pci_init(void) -+{ -+ if (machine_is_sidewinder()) -+ pci_common_init(&sidewinder_pci); -+ return 0; -+} -+ -+subsys_initcall(sidewinder_pci_init); -Index: linux-2.6.23.17/arch/arm/mach-ixp4xx/sidewinder-setup.c -=================================================================== ---- /dev/null -+++ linux-2.6.23.17/arch/arm/mach-ixp4xx/sidewinder-setup.c -@@ -0,0 +1,115 @@ -+/* -+ * arch/arm/mach-ixp4xx/sidewinder-setup.c -+ * -+ * Board setup for the ADI Engineering Sidewinder -+ * -+ * Copyright (C) 2007 Imre Kaloz <Kaloz@openwrt.org> -+ * -+ * based on coyote-setup.c: -+ * Copyright (C) 2003-2005 MontaVista Software, Inc. -+ * -+ * Author: Imre Kaloz <Kaloz@openwrt.org> -+ */ -+ -+#include <linux/kernel.h> -+#include <linux/serial.h> -+#include <linux/serial_8250.h> -+ -+#include <asm/mach-types.h> -+#include <asm/mach/arch.h> -+#include <asm/mach/flash.h> -+ -+static struct flash_platform_data sidewinder_flash_data = { -+ .map_name = "cfi_probe", -+ .width = 2, -+}; -+ -+static struct resource sidewinder_flash_resource = { -+ .flags = IORESOURCE_MEM, -+}; -+ -+static struct platform_device sidewinder_flash = { -+ .name = "IXP4XX-Flash", -+ .id = 0, -+ .dev = { -+ .platform_data = &sidewinder_flash_data, -+ }, -+ .num_resources = 1, -+ .resource = &sidewinder_flash_resource, -+}; -+ -+static struct resource sidewinder_uart_resources[] = { -+ { -+ .start = IXP4XX_UART1_BASE_PHYS, -+ .end = IXP4XX_UART1_BASE_PHYS + 0x0fff, -+ .flags = IORESOURCE_MEM, -+ }, -+ { -+ .start = IXP4XX_UART2_BASE_PHYS, -+ .end = IXP4XX_UART2_BASE_PHYS + 0x0fff, -+ .flags = IORESOURCE_MEM, -+ } -+}; -+ -+static struct plat_serial8250_port sidewinder_uart_data[] = { -+ { -+ .mapbase = IXP4XX_UART1_BASE_PHYS, -+ .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET, -+ .irq = IRQ_IXP4XX_UART1, -+ .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, -+ .iotype = UPIO_MEM, -+ .regshift = 2, -+ .uartclk = IXP4XX_UART_XTAL, -+ }, -+ { -+ .mapbase = IXP4XX_UART2_BASE_PHYS, -+ .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET, -+ .irq = IRQ_IXP4XX_UART2, -+ .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, -+ .iotype = UPIO_MEM, -+ .regshift = 2, -+ .uartclk = IXP4XX_UART_XTAL, -+ }, -+ { }, -+}; -+ -+static struct platform_device sidewinder_uart = { -+ .name = "serial8250", -+ .id = PLAT8250_DEV_PLATFORM, -+ .dev = { -+ .platform_data = sidewinder_uart_data, -+ }, -+ .num_resources = ARRAY_SIZE(sidewinder_uart_resources), -+ .resource = sidewinder_uart_resources, -+}; -+ -+static struct platform_device *sidewinder_devices[] __initdata = { -+ &sidewinder_flash, -+ &sidewinder_uart, -+}; -+ -+static void __init sidewinder_init(void) -+{ -+ ixp4xx_sys_init(); -+ -+ sidewinder_flash_resource.start = IXP4XX_EXP_BUS_BASE(0); -+ sidewinder_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_64M - 1; -+ -+ *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE; -+ *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0; -+ -+ platform_add_devices(sidewinder_devices, ARRAY_SIZE(sidewinder_devices)); -+} -+ -+#ifdef CONFIG_MACH_SIDEWINDER -+MACHINE_START(SIDEWINDER, "ADI Engineering Sidewinder") -+ /* Maintainer: Imre Kaloz <kaloz@openwrt.org> */ -+ .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, -+ .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, -+ .map_io = ixp4xx_map_io, -+ .init_irq = ixp4xx_init_irq, -+ .timer = &ixp4xx_timer, -+ .boot_params = 0x0100, -+ .init_machine = sidewinder_init, -+MACHINE_END -+#endif diff --git a/target/linux/ixp4xx/patches-2.6.23/150-lanready_ap1000_support.patch b/target/linux/ixp4xx/patches-2.6.23/150-lanready_ap1000_support.patch deleted file mode 100644 index 8e0bf60288..0000000000 --- a/target/linux/ixp4xx/patches-2.6.23/150-lanready_ap1000_support.patch +++ /dev/null @@ -1,217 +0,0 @@ -Index: linux-2.6.23.17/arch/arm/mach-ixp4xx/ap1000-setup.c -=================================================================== ---- /dev/null -+++ linux-2.6.23.17/arch/arm/mach-ixp4xx/ap1000-setup.c -@@ -0,0 +1,151 @@ -+/* -+ * arch/arm/mach-ixp4xx/ap1000-setup.c -+ * -+ * Lanready AP-1000 -+ * -+ * Copyright (C) 2007 Imre Kaloz <Kaloz@openwrt.org> -+ * -+ * based on ixdp425-setup.c: -+ * Copyright (C) 2003-2005 MontaVista Software, Inc. -+ * -+ * Author: Imre Kaloz <Kaloz@openwrt.org> -+ */ -+ -+#include <linux/kernel.h> -+#include <linux/init.h> -+#include <linux/device.h> -+#include <linux/serial.h> -+#include <linux/tty.h> -+#include <linux/serial_8250.h> -+#include <linux/slab.h> -+ -+#include <asm/types.h> -+#include <asm/setup.h> -+#include <asm/memory.h> -+#include <asm/hardware.h> -+#include <asm/mach-types.h> -+#include <asm/irq.h> -+#include <asm/mach/arch.h> -+#include <asm/mach/flash.h> -+ -+static struct flash_platform_data ap1000_flash_data = { -+ .map_name = "cfi_probe", -+ .width = 2, -+}; -+ -+static struct resource ap1000_flash_resource = { -+ .flags = IORESOURCE_MEM, -+}; -+ -+static struct platform_device ap1000_flash = { -+ .name = "IXP4XX-Flash", -+ .id = 0, -+ .dev = { -+ .platform_data = &ap1000_flash_data, -+ }, -+ .num_resources = 1, -+ .resource = &ap1000_flash_resource, -+}; -+ -+static struct resource ap1000_uart_resources[] = { -+ { -+ .start = IXP4XX_UART1_BASE_PHYS, -+ .end = IXP4XX_UART1_BASE_PHYS + 0x0fff, -+ .flags = IORESOURCE_MEM -+ }, -+ { -+ .start = IXP4XX_UART2_BASE_PHYS, -+ .end = IXP4XX_UART2_BASE_PHYS + 0x0fff, -+ .flags = IORESOURCE_MEM -+ } -+}; -+ -+static struct plat_serial8250_port ap1000_uart_data[] = { -+ { -+ .mapbase = IXP4XX_UART1_BASE_PHYS, -+ .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET, -+ .irq = IRQ_IXP4XX_UART1, -+ .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, -+ .iotype = UPIO_MEM, -+ .regshift = 2, -+ .uartclk = IXP4XX_UART_XTAL, -+ }, -+ { -+ .mapbase = IXP4XX_UART2_BASE_PHYS, -+ .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET, -+ .irq = IRQ_IXP4XX_UART2, -+ .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, -+ .iotype = UPIO_MEM, -+ .regshift = 2, -+ .uartclk = IXP4XX_UART_XTAL, -+ }, -+ { }, -+}; -+ -+static struct platform_device ap1000_uart = { -+ .name = "serial8250", -+ .id = PLAT8250_DEV_PLATFORM, -+ .dev.platform_data = ap1000_uart_data, -+ .num_resources = 2, -+ .resource = ap1000_uart_resources -+}; -+ -+static struct platform_device *ap1000_devices[] __initdata = { -+ &ap1000_flash, -+ &ap1000_uart -+}; -+ -+static char ap1000_mem_fixup[] __initdata = "mem=64M "; -+ -+static void __init ap1000_fixup(struct machine_desc *desc, -+ struct tag *tags, char **cmdline, struct meminfo *mi) -+ -+{ -+ struct tag *t = tags; -+ char *p = *cmdline; -+ -+ /* Find the end of the tags table, taking note of any cmdline tag. */ -+ for (; t->hdr.size; t = tag_next(t)) { -+ if (t->hdr.tag == ATAG_CMDLINE) { -+ p = t->u.cmdline.cmdline; -+ } -+ } -+ -+ /* Overwrite the end of the table with a new cmdline tag. */ -+ t->hdr.tag = ATAG_CMDLINE; -+ t->hdr.size = (sizeof (struct tag_header) + -+ strlen(ap1000_mem_fixup) + strlen(p) + 1 + 4) >> 2; -+ strlcpy(t->u.cmdline.cmdline, ap1000_mem_fixup, COMMAND_LINE_SIZE); -+ strlcpy(t->u.cmdline.cmdline + strlen(ap1000_mem_fixup), p, -+ COMMAND_LINE_SIZE - strlen(ap1000_mem_fixup)); -+ -+ /* Terminate the table. */ -+ t = tag_next(t); -+ t->hdr.tag = ATAG_NONE; -+ t->hdr.size = 0; -+} -+ -+static void __init ap1000_init(void) -+{ -+ ixp4xx_sys_init(); -+ -+ ap1000_flash_resource.start = IXP4XX_EXP_BUS_BASE(0); -+ ap1000_flash_resource.end = -+ IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1; -+ -+ platform_add_devices(ap1000_devices, ARRAY_SIZE(ap1000_devices)); -+} -+ -+#ifdef CONFIG_MACH_AP1000 -+MACHINE_START(AP1000, "Lanready AP-1000") -+ /* Maintainer: Imre Kaloz <Kaloz@openwrt.org> */ -+ .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, -+ .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, -+ .fixup = ap1000_fixup, -+ .map_io = ixp4xx_map_io, -+ .init_irq = ixp4xx_init_irq, -+ .timer = &ixp4xx_timer, -+ .boot_params = 0x0100, -+ .init_machine = ap1000_init, -+MACHINE_END -+#endif -Index: linux-2.6.23.17/arch/arm/mach-ixp4xx/ixdp425-pci.c -=================================================================== ---- linux-2.6.23.17.orig/arch/arm/mach-ixp4xx/ixdp425-pci.c -+++ linux-2.6.23.17/arch/arm/mach-ixp4xx/ixdp425-pci.c -@@ -66,7 +66,8 @@ struct hw_pci ixdp425_pci __initdata = { - int __init ixdp425_pci_init(void) - { - if (machine_is_ixdp425() || machine_is_ixcdp1100() || -- machine_is_ixdp465() || machine_is_kixrp435() || machine_is_compex()) -+ machine_is_ixdp465() || machine_is_kixrp435() || -+ machine_is_compex() || machine_is_ap1000()) - pci_common_init(&ixdp425_pci); - return 0; - } -Index: linux-2.6.23.17/arch/arm/mach-ixp4xx/Kconfig -=================================================================== ---- linux-2.6.23.17.orig/arch/arm/mach-ixp4xx/Kconfig -+++ linux-2.6.23.17/arch/arm/mach-ixp4xx/Kconfig -@@ -89,6 +89,14 @@ config MACH_WRT300NV2 - WRT300N v2 router. For more information on this - platform, see http://openwrt.org - -+config MACH_AP1000 -+ bool "Lanready AP-1000" -+ select PCI -+ help -+ Say 'Y' here if you want your kernel to support Lanready's -+ AP1000 board. For more information on this -+ platform, see http://openwrt.org -+ - config ARCH_IXDP425 - bool "IXDP425" - help -Index: linux-2.6.23.17/arch/arm/mach-ixp4xx/Makefile -=================================================================== ---- linux-2.6.23.17.orig/arch/arm/mach-ixp4xx/Makefile -+++ linux-2.6.23.17/arch/arm/mach-ixp4xx/Makefile -@@ -20,6 +20,7 @@ obj-pci-$(CONFIG_MACH_PRONGHORNMETRO) += - obj-pci-$(CONFIG_MACH_COMPEX) += ixdp425-pci.o - obj-pci-$(CONFIG_MACH_WRT300NV2) += wrt300nv2-pci.o - obj-pci-$(CONFIG_MACH_SIDEWINDER) += sidewinder-pci.o -+obj-pci-$(CONFIG_MACH_AP1000) += ixdp425-pci.o - - obj-y += common.o - -@@ -38,5 +39,6 @@ obj-$(CONFIG_MACH_PRONGHORNMETRO) += pro - obj-$(CONFIG_MACH_COMPEX) += compex-setup.o - obj-$(CONFIG_MACH_WRT300NV2) += wrt300nv2-setup.o - obj-$(CONFIG_MACH_SIDEWINDER) += sidewinder-setup.o -+obj-$(CONFIG_MACH_AP1000) += ap1000-setup.o - - obj-$(CONFIG_PCI) += $(obj-pci-$(CONFIG_PCI)) common-pci.o -Index: linux-2.6.23.17/arch/arm/tools/mach-types -=================================================================== ---- linux-2.6.23.17.orig/arch/arm/tools/mach-types -+++ linux-2.6.23.17/arch/arm/tools/mach-types -@@ -1367,3 +1367,4 @@ db88f5281 MACH_DB88F5281 DB88F5281 13 - csb726 MACH_CSB726 CSB726 1359 - tik27 MACH_TIK27 TIK27 1360 - mx_uc7420 MACH_MX_UC7420 MX_UC7420 1361 -+ap1000 MACH_AP1000 AP1000 1543 diff --git a/target/linux/ixp4xx/patches-2.6.23/151-lanready_ap1000_mac_plat_info.patch b/target/linux/ixp4xx/patches-2.6.23/151-lanready_ap1000_mac_plat_info.patch deleted file mode 100644 index 7ad022d32f..0000000000 --- a/target/linux/ixp4xx/patches-2.6.23/151-lanready_ap1000_mac_plat_info.patch +++ /dev/null @@ -1,42 +0,0 @@ -Index: linux-2.6.23.17/arch/arm/mach-ixp4xx/ap1000-setup.c -=================================================================== ---- linux-2.6.23.17.orig/arch/arm/mach-ixp4xx/ap1000-setup.c -+++ linux-2.6.23.17/arch/arm/mach-ixp4xx/ap1000-setup.c -@@ -90,9 +90,36 @@ static struct platform_device ap1000_uar - .resource = ap1000_uart_resources - }; - -+/* Built-in 10/100 Ethernet MAC interfaces */ -+static struct eth_plat_info ap1000_plat_eth[] = { -+ { -+ .phy = 4, -+ .rxq = 3, -+ .txreadyq = 20, -+ }, { -+ .phy = 5, -+ .rxq = 4, -+ .txreadyq = 21, -+ } -+}; -+ -+static struct platform_device ap1000_eth[] = { -+ { -+ .name = "ixp4xx_eth", -+ .id = IXP4XX_ETH_NPEB, -+ .dev.platform_data = ap1000_plat_eth, -+ }, { -+ .name = "ixp4xx_eth", -+ .id = IXP4XX_ETH_NPEC, -+ .dev.platform_data = ap1000_plat_eth + 1, -+ } -+}; -+ - static struct platform_device *ap1000_devices[] __initdata = { - &ap1000_flash, -- &ap1000_uart -+ &ap1000_uart, -+ &ap1000_eth[0], -+ &ap1000_eth[1], - }; - - static char ap1000_mem_fixup[] __initdata = "mem=64M "; diff --git a/target/linux/ixp4xx/patches-2.6.23/160-wg302v1_support.patch b/target/linux/ixp4xx/patches-2.6.23/160-wg302v1_support.patch deleted file mode 100644 index 590a751348..0000000000 --- a/target/linux/ixp4xx/patches-2.6.23/160-wg302v1_support.patch +++ /dev/null @@ -1,221 +0,0 @@ -Index: linux-2.6.23.17/arch/arm/mach-ixp4xx/Kconfig -=================================================================== ---- linux-2.6.23.17.orig/arch/arm/mach-ixp4xx/Kconfig -+++ linux-2.6.23.17/arch/arm/mach-ixp4xx/Kconfig -@@ -49,6 +49,14 @@ config MACH_GATEWAY7001 - 7001 Access Point. For more information on this platform, - see http://openwrt.org - -+config MACH_WG302V1 -+ bool "Netgear WG302 v1 / WAG302 v1" -+ select PCI -+ help -+ Say 'Y' here if you want your kernel to support Netgear's -+ WG302 v1 or WAG302 v1 Access Points. For more information -+ on this platform, see http://openwrt.org -+ - config MACH_WG302V2 - bool "Netgear WG302 v2 / WAG302 v2" - select PCI -Index: linux-2.6.23.17/arch/arm/mach-ixp4xx/Makefile -=================================================================== ---- linux-2.6.23.17.orig/arch/arm/mach-ixp4xx/Makefile -+++ linux-2.6.23.17/arch/arm/mach-ixp4xx/Makefile -@@ -14,6 +14,7 @@ obj-pci-$(CONFIG_MACH_NSLU2) += nslu2-p - obj-pci-$(CONFIG_MACH_NAS100D) += nas100d-pci.o - obj-pci-$(CONFIG_MACH_DSMG600) += dsmg600-pci.o - obj-pci-$(CONFIG_MACH_GATEWAY7001) += gateway7001-pci.o -+obj-pci-$(CONFIG_MACH_WG302V1) += wg302v1-pci.o - obj-pci-$(CONFIG_MACH_WG302V2) += wg302v2-pci.o - obj-pci-$(CONFIG_MACH_FSG) += fsg-pci.o - obj-pci-$(CONFIG_MACH_PRONGHORNMETRO) += pronghornmetro-pci.o -@@ -33,6 +34,7 @@ obj-$(CONFIG_MACH_NSLU2) += nslu2-setup. - obj-$(CONFIG_MACH_NAS100D) += nas100d-setup.o nas100d-power.o - obj-$(CONFIG_MACH_DSMG600) += dsmg600-setup.o dsmg600-power.o - obj-$(CONFIG_MACH_GATEWAY7001) += gateway7001-setup.o -+obj-$(CONFIG_MACH_WG302V1) += wg302v1-setup.o - obj-$(CONFIG_MACH_WG302V2) += wg302v2-setup.o - obj-$(CONFIG_MACH_FSG) += fsg-setup.o fsg-power.o - obj-$(CONFIG_MACH_PRONGHORNMETRO) += pronghornmetro-setup.o -Index: linux-2.6.23.17/arch/arm/mach-ixp4xx/wg302v1-pci.c -=================================================================== ---- /dev/null -+++ linux-2.6.23.17/arch/arm/mach-ixp4xx/wg302v1-pci.c -@@ -0,0 +1,63 @@ -+/* -+ * arch/arch/mach-ixp4xx/wg302v1-pci.c -+ * -+ * PCI setup routines for the Netgear WG302 v1 and WAG302 v1 -+ * -+ * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org> -+ * -+ * based on coyote-pci.c: -+ * Copyright (C) 2002 Jungo Software Technologies. -+ * Copyright (C) 2003 MontaVista Software, Inc. -+ * -+ * Maintainer: Imre Kaloz <kaloz@openwrt.org> -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ * -+ */ -+ -+#include <linux/kernel.h> -+#include <linux/pci.h> -+#include <linux/init.h> -+#include <linux/irq.h> -+ -+#include <asm/mach-types.h> -+#include <asm/hardware.h> -+ -+#include <asm/mach/pci.h> -+ -+void __init wg302v1_pci_preinit(void) -+{ -+ set_irq_type(IRQ_IXP4XX_GPIO8, IRQT_LOW); -+ set_irq_type(IRQ_IXP4XX_GPIO10, IRQT_LOW); -+ -+ ixp4xx_pci_preinit(); -+} -+ -+static int __init wg302v1_map_irq(struct pci_dev *dev, u8 slot, u8 pin) -+{ -+ if (slot == 1) -+ return IRQ_IXP4XX_GPIO8; -+ else if (slot == 2) -+ return IRQ_IXP4XX_GPIO10; -+ else return -1; -+} -+ -+struct hw_pci wg302v1_pci __initdata = { -+ .nr_controllers = 1, -+ .preinit = wg302v1_pci_preinit, -+ .swizzle = pci_std_swizzle, -+ .setup = ixp4xx_setup, -+ .scan = ixp4xx_scan_bus, -+ .map_irq = wg302v1_map_irq, -+}; -+ -+int __init wg302v1_pci_init(void) -+{ -+ if (machine_is_wg302v1()) -+ pci_common_init(&wg302v1_pci); -+ return 0; -+} -+ -+subsys_initcall(wg302v1_pci_init); -Index: linux-2.6.23.17/arch/arm/mach-ixp4xx/wg302v1-setup.c -=================================================================== ---- /dev/null -+++ linux-2.6.23.17/arch/arm/mach-ixp4xx/wg302v1-setup.c -@@ -0,0 +1,109 @@ -+/* -+ * arch/arm/mach-ixp4xx/wg302v1-setup.c -+ * -+ * Board setup for the Netgear WG302 v1 and WAG302 v1 -+ * -+ * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org> -+ * -+ * based on coyote-setup.c: -+ * Copyright (C) 2003-2005 MontaVista Software, Inc. -+ * -+ * Author: Imre Kaloz <kaloz@openwrt.org> -+ * -+ */ -+ -+#include <linux/kernel.h> -+#include <linux/init.h> -+#include <linux/device.h> -+#include <linux/serial.h> -+#include <linux/tty.h> -+#include <linux/serial_8250.h> -+#include <linux/slab.h> -+ -+#include <asm/types.h> -+#include <asm/setup.h> -+#include <asm/memory.h> -+#include <asm/hardware.h> -+#include <asm/irq.h> -+#include <asm/mach-types.h> -+#include <asm/mach/arch.h> -+#include <asm/mach/flash.h> -+ -+static struct flash_platform_data wg302v1_flash_data = { -+ .map_name = "cfi_probe", -+ .width = 2, -+}; -+ -+static struct resource wg302v1_flash_resource = { -+ .flags = IORESOURCE_MEM, -+}; -+ -+static struct platform_device wg302v1_flash = { -+ .name = "IXP4XX-Flash", -+ .id = 0, -+ .dev = { -+ .platform_data = &wg302v1_flash_data, -+ }, -+ .num_resources = 1, -+ .resource = &wg302v1_flash_resource, -+}; -+ -+static struct resource wg302v1_uart_resource = { -+ .start = IXP4XX_UART1_BASE_PHYS, -+ .end = IXP4XX_UART1_BASE_PHYS + 0x0fff, -+ .flags = IORESOURCE_MEM, -+}; -+ -+static struct plat_serial8250_port wg302v1_uart_data[] = { -+ { -+ .mapbase = IXP4XX_UART1_BASE_PHYS, -+ .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET, -+ .irq = IRQ_IXP4XX_UART1, -+ .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, -+ .iotype = UPIO_MEM, -+ .regshift = 2, -+ .uartclk = IXP4XX_UART_XTAL, -+ }, -+ { }, -+}; -+ -+static struct platform_device wg302v1_uart = { -+ .name = "serial8250", -+ .id = PLAT8250_DEV_PLATFORM, -+ .dev = { -+ .platform_data = wg302v1_uart_data, -+ }, -+ .num_resources = 1, -+ .resource = &wg302v1_uart_resource, -+}; -+ -+static struct platform_device *wg302v1_devices[] __initdata = { -+ &wg302v1_flash, -+ &wg302v1_uart, -+}; -+ -+static void __init wg302v1_init(void) -+{ -+ ixp4xx_sys_init(); -+ -+ wg302v1_flash_resource.start = IXP4XX_EXP_BUS_BASE(0); -+ wg302v1_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_32M - 1; -+ -+ *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE; -+ *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0; -+ -+ platform_add_devices(wg302v1_devices, ARRAY_SIZE(wg302v1_devices)); -+} -+ -+#ifdef CONFIG_MACH_WG302V1 -+MACHINE_START(WG302V1, "Netgear WG302 v1 / WAG302 v1") -+ /* Maintainer: Imre Kaloz <kaloz@openwrt.org> */ -+ .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, -+ .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, -+ .map_io = ixp4xx_map_io, -+ .init_irq = ixp4xx_init_irq, -+ .timer = &ixp4xx_timer, -+ .boot_params = 0x0100, -+ .init_machine = wg302v1_init, -+MACHINE_END -+#endif diff --git a/target/linux/ixp4xx/patches-2.6.23/161-wg302v1_mac_plat_info.patch b/target/linux/ixp4xx/patches-2.6.23/161-wg302v1_mac_plat_info.patch deleted file mode 100644 index 608f036a28..0000000000 --- a/target/linux/ixp4xx/patches-2.6.23/161-wg302v1_mac_plat_info.patch +++ /dev/null @@ -1,32 +0,0 @@ -Index: linux-2.6.23.17/arch/arm/mach-ixp4xx/wg302v1-setup.c -=================================================================== ---- linux-2.6.23.17.orig/arch/arm/mach-ixp4xx/wg302v1-setup.c -+++ linux-2.6.23.17/arch/arm/mach-ixp4xx/wg302v1-setup.c -@@ -77,9 +77,27 @@ static struct platform_device wg302v1_ua - .resource = &wg302v1_uart_resource, - }; - -+/* Built-in 10/100 Ethernet MAC interfaces */ -+static struct eth_plat_info wg302_plat_eth[] = { -+ { -+ .phy = 30, -+ .rxq = 3, -+ .txreadyq = 20, -+ } -+}; -+ -+static struct platform_device wg302_eth[] = { -+ { -+ .name = "ixp4xx_eth", -+ .id = IXP4XX_ETH_NPEB, -+ .dev.platform_data = wg302_plat_eth, -+ } -+}; -+ - static struct platform_device *wg302v1_devices[] __initdata = { - &wg302v1_flash, - &wg302v1_uart, -+ &wg302_eth[0], - }; - - static void __init wg302v1_init(void) diff --git a/target/linux/ixp4xx/patches-2.6.23/162-wg302v1_mem_fixup.patch b/target/linux/ixp4xx/patches-2.6.23/162-wg302v1_mem_fixup.patch deleted file mode 100644 index 71a2e7ff85..0000000000 --- a/target/linux/ixp4xx/patches-2.6.23/162-wg302v1_mem_fixup.patch +++ /dev/null @@ -1,49 +0,0 @@ -Index: linux-2.6.23.17/arch/arm/mach-ixp4xx/wg302v1-setup.c -=================================================================== ---- linux-2.6.23.17.orig/arch/arm/mach-ixp4xx/wg302v1-setup.c -+++ linux-2.6.23.17/arch/arm/mach-ixp4xx/wg302v1-setup.c -@@ -100,6 +100,36 @@ static struct platform_device *wg302v1_d - &wg302_eth[0], - }; - -+static char wg302v1_mem_fixup[] __initdata = "mem=32M "; -+ -+static void __init wg302v1_fixup(struct machine_desc *desc, -+ struct tag *tags, char **cmdline, struct meminfo *mi) -+ -+{ -+ struct tag *t = tags; -+ char *p = *cmdline; -+ -+ /* Find the end of the tags table, taking note of any cmdline tag. */ -+ for (; t->hdr.size; t = tag_next(t)) { -+ if (t->hdr.tag == ATAG_CMDLINE) { -+ p = t->u.cmdline.cmdline; -+ } -+ } -+ -+ /* Overwrite the end of the table with a new cmdline tag. */ -+ t->hdr.tag = ATAG_CMDLINE; -+ t->hdr.size = (sizeof (struct tag_header) + -+ strlen(wg302v1_mem_fixup) + strlen(p) + 1 + 4) >> 2; -+ strlcpy(t->u.cmdline.cmdline, wg302v1_mem_fixup, COMMAND_LINE_SIZE); -+ strlcpy(t->u.cmdline.cmdline + strlen(wg302v1_mem_fixup), p, -+ COMMAND_LINE_SIZE - strlen(wg302v1_mem_fixup)); -+ -+ /* Terminate the table. */ -+ t = tag_next(t); -+ t->hdr.tag = ATAG_NONE; -+ t->hdr.size = 0; -+} -+ - static void __init wg302v1_init(void) - { - ixp4xx_sys_init(); -@@ -118,6 +148,7 @@ MACHINE_START(WG302V1, "Netgear WG302 v1 - /* Maintainer: Imre Kaloz <kaloz@openwrt.org> */ - .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, - .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, -+ .fixup = wg302v1_fixup, - .map_io = ixp4xx_map_io, - .init_irq = ixp4xx_init_irq, - .timer = &ixp4xx_timer, diff --git a/target/linux/ixp4xx/patches-2.6.23/200-npe_driver.patch b/target/linux/ixp4xx/patches-2.6.23/200-npe_driver.patch deleted file mode 100644 index 6e9aaa97a3..0000000000 --- a/target/linux/ixp4xx/patches-2.6.23/200-npe_driver.patch +++ /dev/null @@ -1,4044 +0,0 @@ -Index: linux-2.6.23.17/arch/arm/kernel/setup.c -=================================================================== ---- linux-2.6.23.17.orig/arch/arm/kernel/setup.c -+++ linux-2.6.23.17/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); - -Index: linux-2.6.23.17/arch/arm/mach-ixp4xx/Kconfig -=================================================================== ---- linux-2.6.23.17.orig/arch/arm/mach-ixp4xx/Kconfig -+++ linux-2.6.23.17/arch/arm/mach-ixp4xx/Kconfig -@@ -246,6 +246,20 @@ config IXP4XX_INDIRECT_PCI - need to use the indirect method instead. If you don't know - what you need, leave this option unselected. - -+config IXP4XX_QMGR -+ tristate "IXP4xx Queue Manager support" -+ help -+ This driver supports IXP4xx built-in hardware queue manager -+ and is automatically selected by Ethernet and HSS drivers. -+ -+config IXP4XX_NPE -+ tristate "IXP4xx Network Processor Engine support" -+ select HOTPLUG -+ select FW_LOADER -+ help -+ This driver supports IXP4xx built-in network coprocessors -+ and is automatically selected by Ethernet and HSS drivers. -+ - endmenu - - endif -Index: linux-2.6.23.17/arch/arm/mach-ixp4xx/Makefile -=================================================================== ---- linux-2.6.23.17.orig/arch/arm/mach-ixp4xx/Makefile -+++ linux-2.6.23.17/arch/arm/mach-ixp4xx/Makefile -@@ -44,3 +44,5 @@ obj-$(CONFIG_MACH_SIDEWINDER) += sidewin - obj-$(CONFIG_MACH_AP1000) += ap1000-setup.o - - obj-$(CONFIG_PCI) += $(obj-pci-$(CONFIG_PCI)) common-pci.o -+obj-$(CONFIG_IXP4XX_QMGR) += ixp4xx_qmgr.o -+obj-$(CONFIG_IXP4XX_NPE) += ixp4xx_npe.o -Index: linux-2.6.23.17/arch/arm/mach-ixp4xx/ixdp425-setup.c -=================================================================== ---- linux-2.6.23.17.orig/arch/arm/mach-ixp4xx/ixdp425-setup.c -+++ linux-2.6.23.17/arch/arm/mach-ixp4xx/ixdp425-setup.c -@@ -177,6 +177,31 @@ static struct platform_device ixdp425_ua - .resource = ixdp425_uart_resources - }; - -+/* Built-in 10/100 Ethernet MAC interfaces */ -+static struct eth_plat_info ixdp425_plat_eth[] = { -+ { -+ .phy = 0, -+ .rxq = 3, -+ .txreadyq = 20, -+ }, { -+ .phy = 1, -+ .rxq = 4, -+ .txreadyq = 21, -+ } -+}; -+ -+static struct platform_device ixdp425_eth[] = { -+ { -+ .name = "ixp4xx_eth", -+ .id = IXP4XX_ETH_NPEB, -+ .dev.platform_data = ixdp425_plat_eth, -+ }, { -+ .name = "ixp4xx_eth", -+ .id = IXP4XX_ETH_NPEC, -+ .dev.platform_data = ixdp425_plat_eth + 1, -+ } -+}; -+ - static struct platform_device *ixdp425_devices[] __initdata = { - &ixdp425_i2c_gpio, - &ixdp425_flash, -@@ -184,7 +209,9 @@ static struct platform_device *ixdp425_d - defined(CONFIG_MTD_NAND_PLATFORM_MODULE) - &ixdp425_flash_nand, - #endif -- &ixdp425_uart -+ &ixdp425_uart, -+ &ixdp425_eth[0], -+ &ixdp425_eth[1], - }; - - static void __init ixdp425_init(void) -Index: linux-2.6.23.17/arch/arm/mach-ixp4xx/ixp4xx_npe.c -=================================================================== ---- /dev/null -+++ linux-2.6.23.17/arch/arm/mach-ixp4xx/ixp4xx_npe.c -@@ -0,0 +1,741 @@ -+/* -+ * Intel IXP4xx Network Processor Engine driver for Linux -+ * -+ * Copyright (C) 2007 Krzysztof Halasa <khc@pm.waw.pl> -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of version 2 of the GNU General Public License -+ * as published by the Free Software Foundation. -+ * -+ * The code is based on publicly available information: -+ * - Intel IXP4xx Developer's Manual and other e-papers -+ * - Intel IXP400 Access Library Software (BSD license) -+ * - previous works by Christian Hohnstaedt <chohnstaedt@innominate.com> -+ * Thanks, Christian. -+ */ -+ -+#include <linux/delay.h> -+#include <linux/dma-mapping.h> -+#include <linux/firmware.h> -+#include <linux/io.h> -+#include <linux/kernel.h> -+#include <linux/module.h> -+#include <linux/slab.h> -+#include <asm/arch/npe.h> -+ -+#define DEBUG_MSG 0 -+#define DEBUG_FW 0 -+ -+#define NPE_COUNT 3 -+#define MAX_RETRIES 1000 /* microseconds */ -+#define NPE_42X_DATA_SIZE 0x800 /* in dwords */ -+#define NPE_46X_DATA_SIZE 0x1000 -+#define NPE_A_42X_INSTR_SIZE 0x1000 -+#define NPE_B_AND_C_42X_INSTR_SIZE 0x800 -+#define NPE_46X_INSTR_SIZE 0x1000 -+#define REGS_SIZE 0x1000 -+ -+#define NPE_PHYS_REG 32 -+ -+#define FW_MAGIC 0xFEEDF00D -+#define FW_BLOCK_TYPE_INSTR 0x0 -+#define FW_BLOCK_TYPE_DATA 0x1 -+#define FW_BLOCK_TYPE_EOF 0xF -+ -+/* NPE exec status (read) and command (write) */ -+#define CMD_NPE_STEP 0x01 -+#define CMD_NPE_START 0x02 -+#define CMD_NPE_STOP 0x03 -+#define CMD_NPE_CLR_PIPE 0x04 -+#define CMD_CLR_PROFILE_CNT 0x0C -+#define CMD_RD_INS_MEM 0x10 /* instruction memory */ -+#define CMD_WR_INS_MEM 0x11 -+#define CMD_RD_DATA_MEM 0x12 /* data memory */ -+#define CMD_WR_DATA_MEM 0x13 -+#define CMD_RD_ECS_REG 0x14 /* exec access register */ -+#define CMD_WR_ECS_REG 0x15 -+ -+#define STAT_RUN 0x80000000 -+#define STAT_STOP 0x40000000 -+#define STAT_CLEAR 0x20000000 -+#define STAT_ECS_K 0x00800000 /* pipeline clean */ -+ -+#define NPE_STEVT 0x1B -+#define NPE_STARTPC 0x1C -+#define NPE_REGMAP 0x1E -+#define NPE_CINDEX 0x1F -+ -+#define INSTR_WR_REG_SHORT 0x0000C000 -+#define INSTR_WR_REG_BYTE 0x00004000 -+#define INSTR_RD_FIFO 0x0F888220 -+#define INSTR_RESET_MBOX 0x0FAC8210 -+ -+#define ECS_BG_CTXT_REG_0 0x00 /* Background Executing Context */ -+#define ECS_BG_CTXT_REG_1 0x01 /* Stack level */ -+#define ECS_BG_CTXT_REG_2 0x02 -+#define ECS_PRI_1_CTXT_REG_0 0x04 /* Priority 1 Executing Context */ -+#define ECS_PRI_1_CTXT_REG_1 0x05 /* Stack level */ -+#define ECS_PRI_1_CTXT_REG_2 0x06 -+#define ECS_PRI_2_CTXT_REG_0 0x08 /* Priority 2 Executing Context */ -+#define ECS_PRI_2_CTXT_REG_1 0x09 /* Stack level */ -+#define ECS_PRI_2_CTXT_REG_2 0x0A -+#define ECS_DBG_CTXT_REG_0 0x0C /* Debug Executing Context */ -+#define ECS_DBG_CTXT_REG_1 0x0D /* Stack level */ -+#define ECS_DBG_CTXT_REG_2 0x0E -+#define ECS_INSTRUCT_REG 0x11 /* NPE Instruction Register */ -+ -+#define ECS_REG_0_ACTIVE 0x80000000 /* all levels */ -+#define ECS_REG_0_NEXTPC_MASK 0x1FFF0000 /* BG/PRI1/PRI2 levels */ -+#define ECS_REG_0_LDUR_BITS 8 -+#define ECS_REG_0_LDUR_MASK 0x00000700 /* all levels */ -+#define ECS_REG_1_CCTXT_BITS 16 -+#define ECS_REG_1_CCTXT_MASK 0x000F0000 /* all levels */ -+#define ECS_REG_1_SELCTXT_BITS 0 -+#define ECS_REG_1_SELCTXT_MASK 0x0000000F /* all levels */ -+#define ECS_DBG_REG_2_IF 0x00100000 /* debug level */ -+#define ECS_DBG_REG_2_IE 0x00080000 /* debug level */ -+ -+/* NPE watchpoint_fifo register bit */ -+#define WFIFO_VALID 0x80000000 -+ -+/* NPE messaging_status register bit definitions */ -+#define MSGSTAT_OFNE 0x00010000 /* OutFifoNotEmpty */ -+#define MSGSTAT_IFNF 0x00020000 /* InFifoNotFull */ -+#define MSGSTAT_OFNF 0x00040000 /* OutFifoNotFull */ -+#define MSGSTAT_IFNE 0x00080000 /* InFifoNotEmpty */ -+#define MSGSTAT_MBINT 0x00100000 /* Mailbox interrupt */ -+#define MSGSTAT_IFINT 0x00200000 /* InFifo interrupt */ -+#define MSGSTAT_OFINT 0x00400000 /* OutFifo interrupt */ -+#define MSGSTAT_WFINT 0x00800000 /* WatchFifo interrupt */ -+ -+/* NPE messaging_control register bit definitions */ -+#define MSGCTL_OUT_FIFO 0x00010000 /* enable output FIFO */ -+#define MSGCTL_IN_FIFO 0x00020000 /* enable input FIFO */ -+#define MSGCTL_OUT_FIFO_WRITE 0x01000000 /* enable FIFO + WRITE */ -+#define MSGCTL_IN_FIFO_WRITE 0x02000000 -+ -+/* NPE mailbox_status value for reset */ -+#define RESET_MBOX_STAT 0x0000F0F0 -+ -+const char *npe_names[] = { "NPE-A", "NPE-B", "NPE-C" }; -+ -+#define print_npe(pri, npe, fmt, ...) \ -+ printk(pri "%s: " fmt, npe_name(npe), ## __VA_ARGS__) -+ -+#if DEBUG_MSG -+#define debug_msg(npe, fmt, ...) \ -+ print_npe(KERN_DEBUG, npe, fmt, ## __VA_ARGS__) -+#else -+#define debug_msg(npe, fmt, ...) -+#endif -+ -+static struct { -+ u32 reg, val; -+} ecs_reset[] = { -+ { ECS_BG_CTXT_REG_0, 0xA0000000 }, -+ { ECS_BG_CTXT_REG_1, 0x01000000 }, -+ { ECS_BG_CTXT_REG_2, 0x00008000 }, -+ { ECS_PRI_1_CTXT_REG_0, 0x20000080 }, -+ { ECS_PRI_1_CTXT_REG_1, 0x01000000 }, -+ { ECS_PRI_1_CTXT_REG_2, 0x00008000 }, -+ { ECS_PRI_2_CTXT_REG_0, 0x20000080 }, -+ { ECS_PRI_2_CTXT_REG_1, 0x01000000 }, -+ { ECS_PRI_2_CTXT_REG_2, 0x00008000 }, -+ { ECS_DBG_CTXT_REG_0, 0x20000000 }, -+ { ECS_DBG_CTXT_REG_1, 0x00000000 }, -+ { ECS_DBG_CTXT_REG_2, 0x001E0000 }, -+ { ECS_INSTRUCT_REG, 0x1003C00F }, -+}; -+ -+static struct npe npe_tab[NPE_COUNT] = { -+ { -+ .id = 0, -+ .regs = (struct npe_regs __iomem *)IXP4XX_NPEA_BASE_VIRT, -+ .regs_phys = IXP4XX_NPEA_BASE_PHYS, -+ }, { -+ .id = 1, -+ .regs = (struct npe_regs __iomem *)IXP4XX_NPEB_BASE_VIRT, -+ .regs_phys = IXP4XX_NPEB_BASE_PHYS, -+ }, { -+ .id = 2, -+ .regs = (struct npe_regs __iomem *)IXP4XX_NPEC_BASE_VIRT, -+ .regs_phys = IXP4XX_NPEC_BASE_PHYS, -+ } -+}; -+ -+int npe_running(struct npe *npe) -+{ -+ return (__raw_readl(&npe->regs->exec_status_cmd) & STAT_RUN) != 0; -+} -+ -+static void npe_cmd_write(struct npe *npe, u32 addr, int cmd, u32 data) -+{ -+ __raw_writel(data, &npe->regs->exec_data); -+ __raw_writel(addr, &npe->regs->exec_addr); -+ __raw_writel(cmd, &npe->regs->exec_status_cmd); -+} -+ -+static u32 npe_cmd_read(struct npe *npe, u32 addr, int cmd) -+{ -+ __raw_writel(addr, &npe->regs->exec_addr); -+ __raw_writel(cmd, &npe->regs->exec_status_cmd); -+ /* Iintroduce extra read cycles after issuing read command to NPE -+ so that we read the register after the NPE has updated it. -+ This is to overcome race condition between XScale and NPE */ -+ __raw_readl(&npe->regs->exec_data); -+ __raw_readl(&npe->regs->exec_data); -+ return __raw_readl(&npe->regs->exec_data); -+} -+ -+static void npe_clear_active(struct npe *npe, u32 reg) -+{ -+ u32 val = npe_cmd_read(npe, reg, CMD_RD_ECS_REG); -+ npe_cmd_write(npe, reg, CMD_WR_ECS_REG, val & ~ECS_REG_0_ACTIVE); -+} -+ -+static void npe_start(struct npe *npe) -+{ -+ /* ensure only Background Context Stack Level is active */ -+ npe_clear_active(npe, ECS_PRI_1_CTXT_REG_0); -+ npe_clear_active(npe, ECS_PRI_2_CTXT_REG_0); -+ npe_clear_active(npe, ECS_DBG_CTXT_REG_0); -+ -+ __raw_writel(CMD_NPE_CLR_PIPE, &npe->regs->exec_status_cmd); -+ __raw_writel(CMD_NPE_START, &npe->regs->exec_status_cmd); -+} -+ -+static void npe_stop(struct npe *npe) -+{ -+ __raw_writel(CMD_NPE_STOP, &npe->regs->exec_status_cmd); -+ __raw_writel(CMD_NPE_CLR_PIPE, &npe->regs->exec_status_cmd); /*FIXME?*/ -+} -+ -+static int __must_check npe_debug_instr(struct npe *npe, u32 instr, u32 ctx, -+ u32 ldur) -+{ -+ u32 wc; -+ int i; -+ -+ /* set the Active bit, and the LDUR, in the debug level */ -+ npe_cmd_write(npe, ECS_DBG_CTXT_REG_0, CMD_WR_ECS_REG, -+ ECS_REG_0_ACTIVE | (ldur << ECS_REG_0_LDUR_BITS)); -+ -+ /* set CCTXT at ECS DEBUG L3 to specify in which context to execute -+ the instruction, and set SELCTXT at ECS DEBUG Level to specify -+ which context store to access. -+ Debug ECS Level Reg 1 has form 0x000n000n, where n = context number -+ */ -+ npe_cmd_write(npe, ECS_DBG_CTXT_REG_1, CMD_WR_ECS_REG, -+ (ctx << ECS_REG_1_CCTXT_BITS) | -+ (ctx << ECS_REG_1_SELCTXT_BITS)); -+ -+ /* clear the pipeline */ -+ __raw_writel(CMD_NPE_CLR_PIPE, &npe->regs->exec_status_cmd); -+ -+ /* load NPE instruction into the instruction register */ -+ npe_cmd_write(npe, ECS_INSTRUCT_REG, CMD_WR_ECS_REG, instr); -+ -+ /* we need this value later to wait for completion of NPE execution -+ step */ -+ wc = __raw_readl(&npe->regs->watch_count); -+ -+ /* issue a Step One command via the Execution Control register */ -+ __raw_writel(CMD_NPE_STEP, &npe->regs->exec_status_cmd); -+ -+ /* Watch Count register increments when NPE completes an instruction */ -+ for (i = 0; i < MAX_RETRIES; i++) { -+ if (wc != __raw_readl(&npe->regs->watch_count)) -+ return 0; -+ udelay(1); -+ } -+ -+ print_npe(KERN_ERR, npe, "reset: npe_debug_instr(): timeout\n"); -+ return -ETIMEDOUT; -+} -+ -+static int __must_check npe_logical_reg_write8(struct npe *npe, u32 addr, -+ u8 val, u32 ctx) -+{ -+ /* here we build the NPE assembler instruction: mov8 d0, #0 */ -+ u32 instr = INSTR_WR_REG_BYTE | /* OpCode */ -+ addr << 9 | /* base Operand */ -+ (val & 0x1F) << 4 | /* lower 5 bits to immediate data */ -+ (val & ~0x1F) << (18 - 5);/* higher 3 bits to CoProc instr. */ -+ return npe_debug_instr(npe, instr, ctx, 1); /* execute it */ -+} -+ -+static int __must_check npe_logical_reg_write16(struct npe *npe, u32 addr, -+ u16 val, u32 ctx) -+{ -+ /* here we build the NPE assembler instruction: mov16 d0, #0 */ -+ u32 instr = INSTR_WR_REG_SHORT | /* OpCode */ -+ addr << 9 | /* base Operand */ -+ (val & 0x1F) << 4 | /* lower 5 bits to immediate data */ -+ (val & ~0x1F) << (18 - 5);/* higher 11 bits to CoProc instr. */ -+ return npe_debug_instr(npe, instr, ctx, 1); /* execute it */ -+} -+ -+static int __must_check npe_logical_reg_write32(struct npe *npe, u32 addr, -+ u32 val, u32 ctx) -+{ -+ /* write in 16 bit steps first the high and then the low value */ -+ if (npe_logical_reg_write16(npe, addr, val >> 16, ctx)) -+ return -ETIMEDOUT; -+ return npe_logical_reg_write16(npe, addr + 2, val & 0xFFFF, ctx); -+} -+ -+static int npe_reset(struct npe *npe) -+{ -+ u32 val, ctl, exec_count, ctx_reg2; -+ int i; -+ -+ ctl = (__raw_readl(&npe->regs->messaging_control) | 0x3F000000) & -+ 0x3F3FFFFF; -+ -+ /* disable parity interrupt */ -+ __raw_writel(ctl & 0x3F00FFFF, &npe->regs->messaging_control); -+ -+ /* pre exec - debug instruction */ -+ /* turn off the halt bit by clearing Execution Count register. */ -+ exec_count = __raw_readl(&npe->regs->exec_count); -+ __raw_writel(0, &npe->regs->exec_count); -+ /* ensure that IF and IE are on (temporarily), so that we don't end up -+ stepping forever */ -+ ctx_reg2 = npe_cmd_read(npe, ECS_DBG_CTXT_REG_2, CMD_RD_ECS_REG); -+ npe_cmd_write(npe, ECS_DBG_CTXT_REG_2, CMD_WR_ECS_REG, ctx_reg2 | -+ ECS_DBG_REG_2_IF | ECS_DBG_REG_2_IE); -+ -+ /* clear the FIFOs */ -+ while (__raw_readl(&npe->regs->watchpoint_fifo) & WFIFO_VALID) -+ ; -+ while (__raw_readl(&npe->regs->messaging_status) & MSGSTAT_OFNE) -+ /* read from the outFIFO until empty */ -+ print_npe(KERN_DEBUG, npe, "npe_reset: read FIFO = 0x%X\n", -+ __raw_readl(&npe->regs->in_out_fifo)); -+ -+ while (__raw_readl(&npe->regs->messaging_status) & MSGSTAT_IFNE) -+ /* step execution of the NPE intruction to read inFIFO using -+ the Debug Executing Context stack */ -+ if (npe_debug_instr(npe, INSTR_RD_FIFO, 0, 0)) -+ return -ETIMEDOUT; -+ -+ /* reset the mailbox reg from the XScale side */ -+ __raw_writel(RESET_MBOX_STAT, &npe->regs->mailbox_status); -+ /* from NPE side */ -+ if (npe_debug_instr(npe, INSTR_RESET_MBOX, 0, 0)) -+ return -ETIMEDOUT; -+ -+ /* Reset the physical registers in the NPE register file */ -+ for (val = 0; val < NPE_PHYS_REG; val++) { -+ if (npe_logical_reg_write16(npe, NPE_REGMAP, val >> 1, 0)) -+ return -ETIMEDOUT; -+ /* address is either 0 or 4 */ -+ if (npe_logical_reg_write32(npe, (val & 1) * 4, 0, 0)) -+ return -ETIMEDOUT; -+ } -+ -+ /* Reset the context store = each context's Context Store registers */ -+ -+ /* Context 0 has no STARTPC. Instead, this value is used to set NextPC -+ for Background ECS, to set where NPE starts executing code */ -+ val = npe_cmd_read(npe, ECS_BG_CTXT_REG_0, CMD_RD_ECS_REG); -+ val &= ~ECS_REG_0_NEXTPC_MASK; -+ val |= (0 /* NextPC */ << 16) & ECS_REG_0_NEXTPC_MASK; -+ npe_cmd_write(npe, ECS_BG_CTXT_REG_0, CMD_WR_ECS_REG, val); -+ -+ for (i = 0; i < 16; i++) { -+ if (i) { /* Context 0 has no STEVT nor STARTPC */ -+ /* STEVT = off, 0x80 */ -+ if (npe_logical_reg_write8(npe, NPE_STEVT, 0x80, i)) -+ return -ETIMEDOUT; -+ if (npe_logical_reg_write16(npe, NPE_STARTPC, 0, i)) -+ return -ETIMEDOUT; -+ } -+ /* REGMAP = d0->p0, d8->p2, d16->p4 */ -+ if (npe_logical_reg_write16(npe, NPE_REGMAP, 0x820, i)) -+ return -ETIMEDOUT; -+ if (npe_logical_reg_write8(npe, NPE_CINDEX, 0, i)) -+ return -ETIMEDOUT; -+ } -+ -+ /* post exec */ -+ /* clear active bit in debug level */ -+ npe_cmd_write(npe, ECS_DBG_CTXT_REG_0, CMD_WR_ECS_REG, 0); -+ /* clear the pipeline */ -+ __raw_writel(CMD_NPE_CLR_PIPE, &npe->regs->exec_status_cmd); -+ /* restore previous values */ -+ __raw_writel(exec_count, &npe->regs->exec_count); -+ npe_cmd_write(npe, ECS_DBG_CTXT_REG_2, CMD_WR_ECS_REG, ctx_reg2); -+ -+ /* write reset values to Execution Context Stack registers */ -+ for (val = 0; val < ARRAY_SIZE(ecs_reset); val++) -+ npe_cmd_write(npe, ecs_reset[val].reg, CMD_WR_ECS_REG, -+ ecs_reset[val].val); -+ -+ /* clear the profile counter */ -+ __raw_writel(CMD_CLR_PROFILE_CNT, &npe->regs->exec_status_cmd); -+ -+ __raw_writel(0, &npe->regs->exec_count); -+ __raw_writel(0, &npe->regs->action_points[0]); -+ __raw_writel(0, &npe->regs->action_points[1]); -+ __raw_writel(0, &npe->regs->action_points[2]); -+ __raw_writel(0, &npe->regs->action_points[3]); -+ __raw_writel(0, &npe->regs->watch_count); -+ -+ val = ixp4xx_read_feature_bits(); -+ /* reset the NPE */ -+ ixp4xx_write_feature_bits(val & -+ ~(IXP4XX_FEATURE_RESET_NPEA << npe->id)); -+ for (i = 0; i < MAX_RETRIES; i++) { -+ if (!(ixp4xx_read_feature_bits() & -+ (IXP4XX_FEATURE_RESET_NPEA << npe->id))) -+ break; /* reset completed */ -+ udelay(1); -+ } -+ if (i == MAX_RETRIES) -+ return -ETIMEDOUT; -+ -+ /* deassert reset */ -+ ixp4xx_write_feature_bits(val | -+ (IXP4XX_FEATURE_RESET_NPEA << npe->id)); -+ for (i = 0; i < MAX_RETRIES; i++) { -+ if (ixp4xx_read_feature_bits() & -+ (IXP4XX_FEATURE_RESET_NPEA << npe->id)) -+ break; /* NPE is back alive */ -+ udelay(1); -+ } -+ if (i == MAX_RETRIES) -+ return -ETIMEDOUT; -+ -+ npe_stop(npe); -+ -+ /* restore NPE configuration bus Control Register - parity settings */ -+ __raw_writel(ctl, &npe->regs->messaging_control); -+ return 0; -+} -+ -+ -+int npe_send_message(struct npe *npe, const void *msg, const char *what) -+{ -+ const u32 *send = msg; -+ int cycles = 0; -+ -+ debug_msg(npe, "Trying to send message %s [%08X:%08X]\n", -+ what, send[0], send[1]); -+ -+ if (__raw_readl(&npe->regs->messaging_status) & MSGSTAT_IFNE) { -+ debug_msg(npe, "NPE input FIFO not empty\n"); -+ return -EIO; -+ } -+ -+ __raw_writel(send[0], &npe->regs->in_out_fifo); -+ -+ if (!(__raw_readl(&npe->regs->messaging_status) & MSGSTAT_IFNF)) { -+ debug_msg(npe, "NPE input FIFO full\n"); -+ return -EIO; -+ } -+ -+ __raw_writel(send[1], &npe->regs->in_out_fifo); -+ -+ while ((cycles < MAX_RETRIES) && -+ (__raw_readl(&npe->regs->messaging_status) & MSGSTAT_IFNE)) { -+ udelay(1); -+ cycles++; -+ } -+ -+ if (cycles == MAX_RETRIES) { -+ debug_msg(npe, "Timeout sending message\n"); -+ return -ETIMEDOUT; -+ } -+ -+ debug_msg(npe, "Sending a message took %i cycles\n", cycles); -+ return 0; -+} -+ -+int npe_recv_message(struct npe *npe, void *msg, const char *what) -+{ -+ u32 *recv = msg; -+ int cycles = 0, cnt = 0; -+ -+ debug_msg(npe, "Trying to receive message %s\n", what); -+ -+ while (cycles < MAX_RETRIES) { -+ if (__raw_readl(&npe->regs->messaging_status) & MSGSTAT_OFNE) { -+ recv[cnt++] = __raw_readl(&npe->regs->in_out_fifo); -+ if (cnt == 2) -+ break; -+ } else { -+ udelay(1); -+ cycles++; -+ } -+ } -+ -+ switch(cnt) { -+ case 1: -+ debug_msg(npe, "Received [%08X]\n", recv[0]); -+ break; -+ case 2: -+ debug_msg(npe, "Received [%08X:%08X]\n", recv[0], recv[1]); -+ break; -+ } -+ -+ if (cycles == MAX_RETRIES) { -+ debug_msg(npe, "Timeout waiting for message\n"); -+ return -ETIMEDOUT; -+ } -+ -+ debug_msg(npe, "Receiving a message took %i cycles\n", cycles); -+ return 0; -+} -+ -+int npe_send_recv_message(struct npe *npe, void *msg, const char *what) -+{ -+ int result; -+ u32 *send = msg, recv[2]; -+ -+ if ((result = npe_send_message(npe, msg, what)) != 0) -+ return result; -+ if ((result = npe_recv_message(npe, recv, what)) != 0) -+ return result; -+ -+ if ((recv[0] != send[0]) || (recv[1] != send[1])) { -+ debug_msg(npe, "Message %s: unexpected message received\n", -+ what); -+ return -EIO; -+ } -+ return 0; -+} -+ -+ -+int npe_load_firmware(struct npe *npe, const char *name, struct device *dev) -+{ -+ const struct firmware *fw_entry; -+ -+ struct dl_block { -+ u32 type; -+ u32 offset; -+ } *blk; -+ -+ struct dl_image { -+ u32 magic; -+ u32 id; -+ u32 size; -+ union { -+ u32 data[0]; -+ struct dl_block blocks[0]; -+ }; -+ } *image; -+ -+ struct dl_codeblock { -+ u32 npe_addr; -+ u32 size; -+ u32 data[0]; -+ } *cb; -+ -+ int i, j, err, data_size, instr_size, blocks, table_end; -+ u32 cmd; -+ -+ if ((err = request_firmware(&fw_entry, name, dev)) != 0) -+ return err; -+ -+ err = -EINVAL; -+ if (fw_entry->size < sizeof(struct dl_image)) { -+ print_npe(KERN_ERR, npe, "incomplete firmware file\n"); -+ goto err; -+ } -+ image = (struct dl_image*)fw_entry->data; -+ -+#if DEBUG_FW -+ print_npe(KERN_DEBUG, npe, "firmware: %08X %08X %08X (0x%X bytes)\n", -+ image->magic, image->id, image->size, image->size * 4); -+#endif -+ -+ if (image->magic == swab32(FW_MAGIC)) { /* swapped file */ -+ image->id = swab32(image->id); -+ image->size = swab32(image->size); -+ } else if (image->magic != FW_MAGIC) { -+ print_npe(KERN_ERR, npe, "bad firmware file magic: 0x%X\n", -+ image->magic); -+ goto err; -+ } -+ if ((image->size * 4 + sizeof(struct dl_image)) != fw_entry->size) { -+ print_npe(KERN_ERR, npe, -+ "inconsistent size of firmware file\n"); -+ goto err; -+ } -+ if (((image->id >> 24) & 0xF /* NPE ID */) != npe->id) { -+ print_npe(KERN_ERR, npe, "firmware file NPE ID mismatch\n"); -+ goto err; -+ } -+ if (image->magic == swab32(FW_MAGIC)) -+ for (i = 0; i < image->size; i++) -+ image->data[i] = swab32(image->data[i]); -+ -+ if (!cpu_is_ixp46x() && ((image->id >> 28) & 0xF /* device ID */)) { -+ print_npe(KERN_INFO, npe, "IXP46x firmware ignored on " -+ "IXP42x\n"); -+ goto err; -+ } -+ -+ if (npe_running(npe)) { -+ print_npe(KERN_INFO, npe, "unable to load firmware, NPE is " -+ "already running\n"); -+ err = -EBUSY; -+ goto err; -+ } -+#if 0 -+ npe_stop(npe); -+ npe_reset(npe); -+#endif -+ -+ print_npe(KERN_INFO, npe, "firmware functionality 0x%X, " -+ "revision 0x%X:%X\n", (image->id >> 16) & 0xFF, -+ (image->id >> 8) & 0xFF, image->id & 0xFF); -+ -+ if (!cpu_is_ixp46x()) { -+ if (!npe->id) -+ instr_size = NPE_A_42X_INSTR_SIZE; -+ else -+ instr_size = NPE_B_AND_C_42X_INSTR_SIZE; -+ data_size = NPE_42X_DATA_SIZE; -+ } else { -+ instr_size = NPE_46X_INSTR_SIZE; -+ data_size = NPE_46X_DATA_SIZE; -+ } -+ -+ for (blocks = 0; blocks * sizeof(struct dl_block) / 4 < image->size; -+ blocks++) -+ if (image->blocks[blocks].type == FW_BLOCK_TYPE_EOF) -+ break; -+ if (blocks * sizeof(struct dl_block) / 4 >= image->size) { -+ print_npe(KERN_INFO, npe, "firmware EOF block marker not " -+ "found\n"); -+ goto err; -+ } -+ -+#if DEBUG_FW -+ print_npe(KERN_DEBUG, npe, "%i firmware blocks found\n", blocks); -+#endif -+ -+ table_end = blocks * sizeof(struct dl_block) / 4 + 1 /* EOF marker */; -+ for (i = 0, blk = image->blocks; i < blocks; i++, blk++) { -+ if (blk->offset > image->size - sizeof(struct dl_codeblock) / 4 -+ || blk->offset < table_end) { -+ print_npe(KERN_INFO, npe, "invalid offset 0x%X of " -+ "firmware block #%i\n", blk->offset, i); -+ goto err; -+ } -+ -+ cb = (struct dl_codeblock*)&image->data[blk->offset]; -+ if (blk->type == FW_BLOCK_TYPE_INSTR) { -+ if (cb->npe_addr + cb->size > instr_size) -+ goto too_big; -+ cmd = CMD_WR_INS_MEM; -+ } else if (blk->type == FW_BLOCK_TYPE_DATA) { -+ if (cb->npe_addr + cb->size > data_size) -+ goto too_big; -+ cmd = CMD_WR_DATA_MEM; -+ } else { -+ print_npe(KERN_INFO, npe, "invalid firmware block #%i " -+ "type 0x%X\n", i, blk->type); -+ goto err; -+ } -+ if (blk->offset + sizeof(*cb) / 4 + cb->size > image->size) { -+ print_npe(KERN_INFO, npe, "firmware block #%i doesn't " -+ "fit in firmware image: type %c, start 0x%X," -+ " length 0x%X\n", i, -+ blk->type == FW_BLOCK_TYPE_INSTR ? 'I' : 'D', -+ cb->npe_addr, cb->size); -+ goto err; -+ } -+ -+ for (j = 0; j < cb->size; j++) -+ npe_cmd_write(npe, cb->npe_addr + j, cmd, cb->data[j]); -+ } -+ -+ npe_start(npe); -+ if (!npe_running(npe)) -+ print_npe(KERN_ERR, npe, "unable to start\n"); -+ release_firmware(fw_entry); -+ return 0; -+ -+too_big: -+ print_npe(KERN_INFO, npe, "firmware block #%i doesn't fit in NPE " -+ "memory: type %c, start 0x%X, length 0x%X\n", i, -+ blk->type == FW_BLOCK_TYPE_INSTR ? 'I' : 'D', -+ cb->npe_addr, cb->size); -+err: -+ release_firmware(fw_entry); -+ return err; -+} -+ -+ -+struct npe *npe_request(int id) -+{ -+ if (id < NPE_COUNT) -+ if (npe_tab[id].valid) -+ if (try_module_get(THIS_MODULE)) -+ return &npe_tab[id]; -+ return NULL; -+} -+ -+void npe_release(struct npe *npe) -+{ -+ module_put(THIS_MODULE); -+} -+ -+ -+static int __init npe_init_module(void) -+{ -+ -+ int i, found = 0; -+ -+ for (i = 0; i < NPE_COUNT; i++) { -+ struct npe *npe = &npe_tab[i]; -+ if (!(ixp4xx_read_feature_bits() & -+ (IXP4XX_FEATURE_RESET_NPEA << i))) -+ continue; /* NPE already disabled or not present */ -+ if (!(npe->mem_res = request_mem_region(npe->regs_phys, -+ REGS_SIZE, -+ npe_name(npe)))) { -+ print_npe(KERN_ERR, npe, -+ "failed to request memory region\n"); -+ continue; -+ } -+ -+ if (npe_reset(npe)) -+ continue; -+ npe->valid = 1; -+ found++; -+ } -+ -+ if (!found) -+ return -ENOSYS; -+ return 0; -+} -+ -+static void __exit npe_cleanup_module(void) -+{ -+ int i; -+ -+ for (i = 0; i < NPE_COUNT; i++) -+ if (npe_tab[i].mem_res) { -+ npe_reset(&npe_tab[i]); -+ release_resource(npe_tab[i].mem_res); -+ } -+} -+ -+module_init(npe_init_module); -+module_exit(npe_cleanup_module); -+ -+MODULE_AUTHOR("Krzysztof Halasa"); -+MODULE_LICENSE("GPL v2"); -+ -+EXPORT_SYMBOL(npe_names); -+EXPORT_SYMBOL(npe_running); -+EXPORT_SYMBOL(npe_request); -+EXPORT_SYMBOL(npe_release); -+EXPORT_SYMBOL(npe_load_firmware); -+EXPORT_SYMBOL(npe_send_message); -+EXPORT_SYMBOL(npe_recv_message); -+EXPORT_SYMBOL(npe_send_recv_message); -Index: linux-2.6.23.17/arch/arm/mach-ixp4xx/ixp4xx_qmgr.c -=================================================================== ---- /dev/null -+++ linux-2.6.23.17/arch/arm/mach-ixp4xx/ixp4xx_qmgr.c -@@ -0,0 +1,274 @@ -+/* -+ * Intel IXP4xx Queue Manager driver for Linux -+ * -+ * Copyright (C) 2007 Krzysztof Halasa <khc@pm.waw.pl> -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of version 2 of the GNU General Public License -+ * as published by the Free Software Foundation. -+ */ -+ -+#include <linux/ioport.h> -+#include <linux/interrupt.h> -+#include <linux/kernel.h> -+#include <linux/module.h> -+#include <asm/arch/qmgr.h> -+ -+#define DEBUG 0 -+ -+struct qmgr_regs __iomem *qmgr_regs; -+static struct resource *mem_res; -+static spinlock_t qmgr_lock; -+static u32 used_sram_bitmap[4]; /* 128 16-dword pages */ -+static void (*irq_handlers[HALF_QUEUES])(void *pdev); -+static void *irq_pdevs[HALF_QUEUES]; -+ -+void qmgr_set_irq(unsigned int queue, int src, -+ void (*handler)(void *pdev), void *pdev) -+{ -+ u32 __iomem *reg = &qmgr_regs->irqsrc[queue / 8]; /* 8 queues / u32 */ -+ int bit = (queue % 8) * 4; /* 3 bits + 1 reserved bit per queue */ -+ unsigned long flags; -+ -+ src &= 7; -+ spin_lock_irqsave(&qmgr_lock, flags); -+ __raw_writel((__raw_readl(reg) & ~(7 << bit)) | (src << bit), reg); -+ irq_handlers[queue] = handler; -+ irq_pdevs[queue] = pdev; -+ spin_unlock_irqrestore(&qmgr_lock, flags); -+} -+ -+ -+static irqreturn_t qmgr_irq1(int irq, void *pdev) -+{ -+ int i; -+ u32 val = __raw_readl(&qmgr_regs->irqstat[0]); -+ __raw_writel(val, &qmgr_regs->irqstat[0]); /* ACK */ -+ -+ for (i = 0; i < HALF_QUEUES; i++) -+ if (val & (1 << i)) -+ irq_handlers[i](irq_pdevs[i]); -+ -+ return val ? IRQ_HANDLED : 0; -+} -+ -+ -+void qmgr_enable_irq(unsigned int queue) -+{ -+ unsigned long flags; -+ -+ spin_lock_irqsave(&qmgr_lock, flags); -+ __raw_writel(__raw_readl(&qmgr_regs->irqen[0]) | (1 << queue), -+ &qmgr_regs->irqen[0]); -+ spin_unlock_irqrestore(&qmgr_lock, flags); -+} -+ -+void qmgr_disable_irq(unsigned int queue) -+{ -+ unsigned long flags; -+ -+ spin_lock_irqsave(&qmgr_lock, flags); -+ __raw_writel(__raw_readl(&qmgr_regs->irqen[0]) & ~(1 << queue), -+ &qmgr_regs->irqen[0]); -+ spin_unlock_irqrestore(&qmgr_lock, flags); -+} -+ -+static inline void shift_mask(u32 *mask) -+{ -+ mask[3] = mask[3] << 1 | mask[2] >> 31; -+ mask[2] = mask[2] << 1 | mask[1] >> 31; -+ mask[1] = mask[1] << 1 | mask[0] >> 31; -+ mask[0] <<= 1; -+} -+ -+int qmgr_request_queue(unsigned int queue, unsigned int len /* dwords */, -+ unsigned int nearly_empty_watermark, -+ unsigned int nearly_full_watermark) -+{ -+ u32 cfg, addr = 0, mask[4]; /* in 16-dwords */ -+ int err; -+ -+ if (queue >= HALF_QUEUES) -+ return -ERANGE; -+ -+ if ((nearly_empty_watermark | nearly_full_watermark) & ~7) -+ return -EINVAL; -+ -+ switch (len) { -+ case 16: -+ cfg = 0 << 24; -+ mask[0] = 0x1; -+ break; -+ case 32: -+ cfg = 1 << 24; -+ mask[0] = 0x3; -+ break; -+ case 64: -+ cfg = 2 << 24; -+ mask[0] = 0xF; -+ break; -+ case 128: -+ cfg = 3 << 24; -+ mask[0] = 0xFF; -+ break; -+ default: -+ return -EINVAL; -+ } -+ -+ cfg |= nearly_empty_watermark << 26; -+ cfg |= nearly_full_watermark << 29; -+ len /= 16; /* in 16-dwords: 1, 2, 4 or 8 */ -+ mask[1] = mask[2] = mask[3] = 0; -+ -+ if (!try_module_get(THIS_MODULE)) -+ return -ENODEV; -+ -+ spin_lock_irq(&qmgr_lock); -+ if (__raw_readl(&qmgr_regs->sram[queue])) { -+ err = -EBUSY; -+ goto err; -+ } -+ -+ while (1) { -+ if (!(used_sram_bitmap[0] & mask[0]) && -+ !(used_sram_bitmap[1] & mask[1]) && -+ !(used_sram_bitmap[2] & mask[2]) && -+ !(used_sram_bitmap[3] & mask[3])) -+ break; /* found free space */ -+ -+ addr++; -+ shift_mask(mask); -+ if (addr + len > ARRAY_SIZE(qmgr_regs->sram)) { -+ printk(KERN_ERR "qmgr: no free SRAM space for" -+ " queue %i\n", queue); -+ err = -ENOMEM; -+ goto err; -+ } -+ } -+ -+ used_sram_bitmap[0] |= mask[0]; -+ used_sram_bitmap[1] |= mask[1]; -+ used_sram_bitmap[2] |= mask[2]; -+ used_sram_bitmap[3] |= mask[3]; -+ __raw_writel(cfg | (addr << 14), &qmgr_regs->sram[queue]); -+ spin_unlock_irq(&qmgr_lock); -+ -+#if DEBUG -+ printk(KERN_DEBUG "qmgr: requested queue %i, addr = 0x%02X\n", -+ queue, addr); -+#endif -+ return 0; -+ -+err: -+ spin_unlock_irq(&qmgr_lock); -+ module_put(THIS_MODULE); -+ return err; -+} -+ -+void qmgr_release_queue(unsigned int queue) -+{ -+ u32 cfg, addr, mask[4]; -+ -+ BUG_ON(queue >= HALF_QUEUES); /* not in valid range */ -+ -+ spin_lock_irq(&qmgr_lock); -+ cfg = __raw_readl(&qmgr_regs->sram[queue]); -+ addr = (cfg >> 14) & 0xFF; -+ -+ BUG_ON(!addr); /* not requested */ -+ -+ switch ((cfg >> 24) & 3) { -+ case 0: mask[0] = 0x1; break; -+ case 1: mask[0] = 0x3; break; -+ case 2: mask[0] = 0xF; break; -+ case 3: mask[0] = 0xFF; break; -+ } -+ -+ while (addr--) -+ shift_mask(mask); -+ -+ __raw_writel(0, &qmgr_regs->sram[queue]); -+ -+ used_sram_bitmap[0] &= ~mask[0]; -+ used_sram_bitmap[1] &= ~mask[1]; -+ used_sram_bitmap[2] &= ~mask[2]; -+ used_sram_bitmap[3] &= ~mask[3]; -+ irq_handlers[queue] = NULL; /* catch IRQ bugs */ -+ spin_unlock_irq(&qmgr_lock); -+ -+ module_put(THIS_MODULE); -+#if DEBUG -+ printk(KERN_DEBUG "qmgr: released queue %i\n", queue); -+#endif -+} -+ -+static int qmgr_init(void) -+{ -+ int i, err; -+ mem_res = request_mem_region(IXP4XX_QMGR_BASE_PHYS, -+ IXP4XX_QMGR_REGION_SIZE, -+ "IXP4xx Queue Manager"); -+ if (mem_res == NULL) -+ return -EBUSY; -+ -+ qmgr_regs = ioremap(IXP4XX_QMGR_BASE_PHYS, IXP4XX_QMGR_REGION_SIZE); -+ if (qmgr_regs == NULL) { -+ err = -ENOMEM; -+ goto error_map; -+ } -+ -+ /* reset qmgr registers */ -+ for (i = 0; i < 4; i++) { -+ __raw_writel(0x33333333, &qmgr_regs->stat1[i]); -+ __raw_writel(0, &qmgr_regs->irqsrc[i]); -+ } -+ for (i = 0; i < 2; i++) { -+ __raw_writel(0, &qmgr_regs->stat2[i]); -+ __raw_writel(0xFFFFFFFF, &qmgr_regs->irqstat[i]); /* clear */ -+ __raw_writel(0, &qmgr_regs->irqen[i]); -+ } -+ -+ for (i = 0; i < QUEUES; i++) -+ __raw_writel(0, &qmgr_regs->sram[i]); -+ -+ err = request_irq(IRQ_IXP4XX_QM1, qmgr_irq1, 0, -+ "IXP4xx Queue Manager", NULL); -+ if (err) { -+ printk(KERN_ERR "qmgr: failed to request IRQ%i\n", -+ IRQ_IXP4XX_QM1); -+ goto error_irq; -+ } -+ -+ used_sram_bitmap[0] = 0xF; /* 4 first pages reserved for config */ -+ spin_lock_init(&qmgr_lock); -+ -+ printk(KERN_INFO "IXP4xx Queue Manager initialized.\n"); -+ return 0; -+ -+error_irq: -+ iounmap(qmgr_regs); -+error_map: -+ release_mem_region(IXP4XX_QMGR_BASE_PHYS, IXP4XX_QMGR_REGION_SIZE); -+ return err; -+} -+ -+static void qmgr_remove(void) -+{ -+ free_irq(IRQ_IXP4XX_QM1, NULL); -+ synchronize_irq(IRQ_IXP4XX_QM1); -+ iounmap(qmgr_regs); -+ release_mem_region(IXP4XX_QMGR_BASE_PHYS, IXP4XX_QMGR_REGION_SIZE); -+} -+ -+module_init(qmgr_init); -+module_exit(qmgr_remove); -+ -+MODULE_LICENSE("GPL v2"); -+MODULE_AUTHOR("Krzysztof Halasa"); -+ -+EXPORT_SYMBOL(qmgr_regs); -+EXPORT_SYMBOL(qmgr_set_irq); -+EXPORT_SYMBOL(qmgr_enable_irq); -+EXPORT_SYMBOL(qmgr_disable_irq); -+EXPORT_SYMBOL(qmgr_request_queue); -+EXPORT_SYMBOL(qmgr_release_queue); -Index: linux-2.6.23.17/drivers/net/arm/Kconfig -=================================================================== ---- linux-2.6.23.17.orig/drivers/net/arm/Kconfig -+++ linux-2.6.23.17/drivers/net/arm/Kconfig -@@ -47,3 +47,13 @@ config EP93XX_ETH - help - This is a driver for the ethernet hardware included in EP93xx CPUs. - Say Y if you are building a kernel for EP93xx based devices. -+ -+config IXP4XX_ETH -+ tristate "IXP4xx Ethernet support" -+ depends on NET_ETHERNET && ARM && ARCH_IXP4XX -+ select IXP4XX_NPE -+ select IXP4XX_QMGR -+ select MII -+ help -+ Say Y here if you want to use built-in Ethernet ports -+ on IXP4xx processor. -Index: linux-2.6.23.17/drivers/net/arm/Makefile -=================================================================== ---- linux-2.6.23.17.orig/drivers/net/arm/Makefile -+++ linux-2.6.23.17/drivers/net/arm/Makefile -@@ -9,3 +9,4 @@ obj-$(CONFIG_ARM_ETHER3) += ether3.o - obj-$(CONFIG_ARM_ETHER1) += ether1.o - obj-$(CONFIG_ARM_AT91_ETHER) += at91_ether.o - obj-$(CONFIG_EP93XX_ETH) += ep93xx_eth.o -+obj-$(CONFIG_IXP4XX_ETH) += ixp4xx_eth.o -Index: linux-2.6.23.17/drivers/net/arm/ixp4xx_eth.c -=================================================================== ---- /dev/null -+++ linux-2.6.23.17/drivers/net/arm/ixp4xx_eth.c -@@ -0,0 +1,1259 @@ -+/* -+ * Intel IXP4xx Ethernet driver for Linux -+ * -+ * Copyright (C) 2007 Krzysztof Halasa <khc@pm.waw.pl> -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of version 2 of the GNU General Public License -+ * as published by the Free Software Foundation. -+ * -+ * Ethernet port config (0x00 is not present on IXP42X): -+ * -+ * logical port 0x00 0x10 0x20 -+ * NPE 0 (NPE-A) 1 (NPE-B) 2 (NPE-C) -+ * physical PortId 2 0 1 -+ * TX queue 23 24 25 -+ * RX-free queue 26 27 28 -+ * TX-done queue is always 31, per-port RX and TX-ready queues are configurable -+ * -+ * -+ * Queue entries: -+ * bits 0 -> 1 - NPE ID (RX and TX-done) -+ * bits 0 -> 2 - priority (TX, per 802.1D) -+ * bits 3 -> 4 - port ID (user-set?) -+ * bits 5 -> 31 - physical descriptor address -+ */ -+ -+#include <linux/delay.h> -+#include <linux/dma-mapping.h> -+#include <linux/dmapool.h> -+#include <linux/etherdevice.h> -+#include <linux/io.h> -+#include <linux/kernel.h> -+#include <linux/mii.h> -+#include <linux/platform_device.h> -+#include <asm/arch/npe.h> -+#include <asm/arch/qmgr.h> -+ -+#define DEBUG_QUEUES 0 -+#define DEBUG_DESC 0 -+#define DEBUG_RX 0 -+#define DEBUG_TX 0 -+#define DEBUG_PKT_BYTES 0 -+#define DEBUG_MDIO 0 -+#define DEBUG_CLOSE 0 -+ -+#define DRV_NAME "ixp4xx_eth" -+ -+#define MAX_NPES 3 -+ -+#define RX_DESCS 64 /* also length of all RX queues */ -+#define TX_DESCS 16 /* also length of all TX queues */ -+#define TXDONE_QUEUE_LEN 64 /* dwords */ -+ -+#define POOL_ALLOC_SIZE (sizeof(struct desc) * (RX_DESCS + TX_DESCS)) -+#define REGS_SIZE 0x1000 -+#define MAX_MRU 1536 /* 0x600 */ -+ -+#define MDIO_INTERVAL (3 * HZ) -+#define MAX_MDIO_RETRIES 100 /* microseconds, typically 30 cycles */ -+#define MAX_MII_RESET_RETRIES 100 /* mdio_read() cycles, typically 4 */ -+#define MAX_CLOSE_WAIT 1000 /* microseconds, typically 2-3 cycles */ -+ -+#define NPE_ID(port_id) ((port_id) >> 4) -+#define PHYSICAL_ID(port_id) ((NPE_ID(port_id) + 2) % 3) -+#define TX_QUEUE(port_id) (NPE_ID(port_id) + 23) -+#define RXFREE_QUEUE(port_id) (NPE_ID(port_id) + 26) -+#define TXDONE_QUEUE 31 -+ -+/* TX Control Registers */ -+#define TX_CNTRL0_TX_EN 0x01 -+#define TX_CNTRL0_HALFDUPLEX 0x02 -+#define TX_CNTRL0_RETRY 0x04 -+#define TX_CNTRL0_PAD_EN 0x08 -+#define TX_CNTRL0_APPEND_FCS 0x10 -+#define TX_CNTRL0_2DEFER 0x20 -+#define TX_CNTRL0_RMII 0x40 /* reduced MII */ -+#define TX_CNTRL1_RETRIES 0x0F /* 4 bits */ -+ -+/* RX Control Registers */ -+#define RX_CNTRL0_RX_EN 0x01 -+#define RX_CNTRL0_PADSTRIP_EN 0x02 -+#define RX_CNTRL0_SEND_FCS 0x04 -+#define RX_CNTRL0_PAUSE_EN 0x08 -+#define RX_CNTRL0_LOOP_EN 0x10 -+#define RX_CNTRL0_ADDR_FLTR_EN 0x20 -+#define RX_CNTRL0_RX_RUNT_EN 0x40 -+#define RX_CNTRL0_BCAST_DIS 0x80 -+#define RX_CNTRL1_DEFER_EN 0x01 -+ -+/* Core Control Register */ -+#define CORE_RESET 0x01 -+#define CORE_RX_FIFO_FLUSH 0x02 -+#define CORE_TX_FIFO_FLUSH 0x04 -+#define CORE_SEND_JAM 0x08 -+#define CORE_MDC_EN 0x10 /* MDIO using NPE-B ETH-0 only */ -+ -+#define DEFAULT_TX_CNTRL0 (TX_CNTRL0_TX_EN | TX_CNTRL0_RETRY | \ -+ TX_CNTRL0_PAD_EN | TX_CNTRL0_APPEND_FCS | \ -+ TX_CNTRL0_2DEFER) -+#define DEFAULT_RX_CNTRL0 RX_CNTRL0_RX_EN -+#define DEFAULT_CORE_CNTRL CORE_MDC_EN -+ -+ -+/* NPE message codes */ -+#define NPE_GETSTATUS 0x00 -+#define NPE_EDB_SETPORTADDRESS 0x01 -+#define NPE_EDB_GETMACADDRESSDATABASE 0x02 -+#define NPE_EDB_SETMACADDRESSSDATABASE 0x03 -+#define NPE_GETSTATS 0x04 -+#define NPE_RESETSTATS 0x05 -+#define NPE_SETMAXFRAMELENGTHS 0x06 -+#define NPE_VLAN_SETRXTAGMODE 0x07 -+#define NPE_VLAN_SETDEFAULTRXVID 0x08 -+#define NPE_VLAN_SETPORTVLANTABLEENTRY 0x09 -+#define NPE_VLAN_SETPORTVLANTABLERANGE 0x0A -+#define NPE_VLAN_SETRXQOSENTRY 0x0B -+#define NPE_VLAN_SETPORTIDEXTRACTIONMODE 0x0C -+#define NPE_STP_SETBLOCKINGSTATE 0x0D -+#define NPE_FW_SETFIREWALLMODE 0x0E -+#define NPE_PC_SETFRAMECONTROLDURATIONID 0x0F -+#define NPE_PC_SETAPMACTABLE 0x11 -+#define NPE_SETLOOPBACK_MODE 0x12 -+#define NPE_PC_SETBSSIDTABLE 0x13 -+#define NPE_ADDRESS_FILTER_CONFIG 0x14 -+#define NPE_APPENDFCSCONFIG 0x15 -+#define NPE_NOTIFY_MAC_RECOVERY_DONE 0x16 -+#define NPE_MAC_RECOVERY_START 0x17 -+ -+ -+#ifdef __ARMEB__ -+typedef struct sk_buff buffer_t; -+#define free_buffer dev_kfree_skb -+#define free_buffer_irq dev_kfree_skb_irq -+#else -+typedef void buffer_t; -+#define free_buffer kfree -+#define free_buffer_irq kfree -+#endif -+ -+struct eth_regs { -+ u32 tx_control[2], __res1[2]; /* 000 */ -+ u32 rx_control[2], __res2[2]; /* 010 */ -+ u32 random_seed, __res3[3]; /* 020 */ -+ u32 partial_empty_threshold, __res4; /* 030 */ -+ u32 partial_full_threshold, __res5; /* 038 */ -+ u32 tx_start_bytes, __res6[3]; /* 040 */ -+ u32 tx_deferral, rx_deferral,__res7[2]; /* 050 */ -+ u32 tx_2part_deferral[2], __res8[2]; /* 060 */ -+ u32 slot_time, __res9[3]; /* 070 */ -+ u32 mdio_command[4]; /* 080 */ -+ u32 mdio_status[4]; /* 090 */ -+ u32 mcast_mask[6], __res10[2]; /* 0A0 */ -+ u32 mcast_addr[6], __res11[2]; /* 0C0 */ -+ u32 int_clock_threshold, __res12[3]; /* 0E0 */ -+ u32 hw_addr[6], __res13[61]; /* 0F0 */ -+ u32 core_control; /* 1FC */ -+}; -+ -+struct port { -+ struct resource *mem_res; -+ struct eth_regs __iomem *regs; -+ struct npe *npe; -+ struct net_device *netdev; -+ struct net_device_stats stat; -+ struct mii_if_info mii; -+ struct delayed_work mdio_thread; -+ struct eth_plat_info *plat; -+ buffer_t *rx_buff_tab[RX_DESCS], *tx_buff_tab[TX_DESCS]; -+ struct desc *desc_tab; /* coherent */ -+ u32 desc_tab_phys; -+ int id; /* logical port ID */ -+ u16 mii_bmcr; -+}; -+ -+/* NPE message structure */ -+struct msg { -+#ifdef __ARMEB__ -+ u8 cmd, eth_id, byte2, byte3; -+ u8 byte4, byte5, byte6, byte7; -+#else -+ u8 byte3, byte2, eth_id, cmd; -+ u8 byte7, byte6, byte5, byte4; -+#endif -+}; -+ -+/* Ethernet packet descriptor */ -+struct desc { -+ u32 next; /* pointer to next buffer, unused */ -+ -+#ifdef __ARMEB__ -+ u16 buf_len; /* buffer length */ -+ u16 pkt_len; /* packet length */ -+ u32 data; /* pointer to data buffer in RAM */ -+ u8 dest_id; -+ u8 src_id; -+ u16 flags; -+ u8 qos; -+ u8 padlen; -+ u16 vlan_tci; -+#else -+ u16 pkt_len; /* packet length */ -+ u16 buf_len; /* buffer length */ -+ u32 data; /* pointer to data buffer in RAM */ -+ u16 flags; -+ u8 src_id; -+ u8 dest_id; -+ u16 vlan_tci; -+ u8 padlen; -+ u8 qos; -+#endif -+ -+#ifdef __ARMEB__ -+ u8 dst_mac_0, dst_mac_1, dst_mac_2, dst_mac_3; -+ u8 dst_mac_4, dst_mac_5, src_mac_0, src_mac_1; -+ u8 src_mac_2, src_mac_3, src_mac_4, src_mac_5; -+#else -+ u8 dst_mac_3, dst_mac_2, dst_mac_1, dst_mac_0; -+ u8 src_mac_1, src_mac_0, dst_mac_5, dst_mac_4; -+ u8 src_mac_5, src_mac_4, src_mac_3, src_mac_2; -+#endif -+}; -+ -+ -+#define rx_desc_phys(port, n) ((port)->desc_tab_phys + \ -+ (n) * sizeof(struct desc)) -+#define rx_desc_ptr(port, n) (&(port)->desc_tab[n]) -+ -+#define tx_desc_phys(port, n) ((port)->desc_tab_phys + \ -+ ((n) + RX_DESCS) * sizeof(struct desc)) -+#define tx_desc_ptr(port, n) (&(port)->desc_tab[(n) + RX_DESCS]) -+ -+#ifndef __ARMEB__ -+static inline void memcpy_swab32(u32 *dest, u32 *src, int cnt) -+{ -+ int i; -+ for (i = 0; i < cnt; i++) -+ dest[i] = swab32(src[i]); -+} -+#endif -+ -+static spinlock_t mdio_lock; -+static struct eth_regs __iomem *mdio_regs; /* mdio command and status only */ -+static int ports_open; -+static struct port *npe_port_tab[MAX_NPES]; -+static struct dma_pool *dma_pool; -+ -+ -+static u16 mdio_cmd(struct net_device *dev, int phy_id, int location, -+ int write, u16 cmd) -+{ -+ int cycles = 0; -+ -+ if (__raw_readl(&mdio_regs->mdio_command[3]) & 0x80) { -+ printk(KERN_ERR "%s: MII not ready to transmit\n", dev->name); -+ return 0; -+ } -+ -+ if (write) { -+ __raw_writel(cmd & 0xFF, &mdio_regs->mdio_command[0]); -+ __raw_writel(cmd >> 8, &mdio_regs->mdio_command[1]); -+ } -+ __raw_writel(((phy_id << 5) | location) & 0xFF, -+ &mdio_regs->mdio_command[2]); -+ __raw_writel((phy_id >> 3) | (write << 2) | 0x80 /* GO */, -+ &mdio_regs->mdio_command[3]); -+ -+ while ((cycles < MAX_MDIO_RETRIES) && -+ (__raw_readl(&mdio_regs->mdio_command[3]) & 0x80)) { -+ udelay(1); -+ cycles++; -+ } -+ -+ if (cycles == MAX_MDIO_RETRIES) { -+ printk(KERN_ERR "%s: MII write failed\n", dev->name); -+ return 0; -+ } -+ -+#if DEBUG_MDIO -+ printk(KERN_DEBUG "%s: mdio_cmd() took %i cycles\n", dev->name, -+ cycles); -+#endif -+ -+ if (write) -+ return 0; -+ -+ if (__raw_readl(&mdio_regs->mdio_status[3]) & 0x80) { -+ printk(KERN_ERR "%s: MII read failed\n", dev->name); -+ return 0; -+ } -+ -+ return (__raw_readl(&mdio_regs->mdio_status[0]) & 0xFF) | -+ (__raw_readl(&mdio_regs->mdio_status[1]) << 8); -+} -+ -+static int mdio_read(struct net_device *dev, int phy_id, int location) -+{ -+ unsigned long flags; -+ u16 val; -+ -+ spin_lock_irqsave(&mdio_lock, flags); -+ val = mdio_cmd(dev, phy_id, location, 0, 0); -+ spin_unlock_irqrestore(&mdio_lock, flags); -+ return val; -+} -+ -+static void mdio_write(struct net_device *dev, int phy_id, int location, -+ int val) -+{ -+ unsigned long flags; -+ -+ spin_lock_irqsave(&mdio_lock, flags); -+ mdio_cmd(dev, phy_id, location, 1, val); -+ spin_unlock_irqrestore(&mdio_lock, flags); -+} -+ -+static void phy_reset(struct net_device *dev, int phy_id) -+{ -+ struct port *port = netdev_priv(dev); -+ int cycles = 0; -+ -+ mdio_write(dev, phy_id, MII_BMCR, port->mii_bmcr | BMCR_RESET); -+ -+ while (cycles < MAX_MII_RESET_RETRIES) { -+ if (!(mdio_read(dev, phy_id, MII_BMCR) & BMCR_RESET)) { -+#if DEBUG_MDIO -+ printk(KERN_DEBUG "%s: phy_reset() took %i cycles\n", -+ dev->name, cycles); -+#endif -+ return; -+ } -+ udelay(1); -+ cycles++; -+ } -+ -+ printk(KERN_ERR "%s: MII reset failed\n", dev->name); -+} -+ -+static void eth_set_duplex(struct port *port) -+{ -+ if (port->mii.full_duplex) -+ __raw_writel(DEFAULT_TX_CNTRL0 & ~TX_CNTRL0_HALFDUPLEX, -+ &port->regs->tx_control[0]); -+ else -+ __raw_writel(DEFAULT_TX_CNTRL0 | TX_CNTRL0_HALFDUPLEX, -+ &port->regs->tx_control[0]); -+} -+ -+ -+static void phy_check_media(struct port *port, int init) -+{ -+ if (mii_check_media(&port->mii, 1, init)) -+ eth_set_duplex(port); -+ if (port->mii.force_media) { /* mii_check_media() doesn't work */ -+ struct net_device *dev = port->netdev; -+ int cur_link = mii_link_ok(&port->mii); -+ int prev_link = netif_carrier_ok(dev); -+ -+ if (!prev_link && cur_link) { -+ printk(KERN_INFO "%s: link up\n", dev->name); -+ netif_carrier_on(dev); -+ } else if (prev_link && !cur_link) { -+ printk(KERN_INFO "%s: link down\n", dev->name); -+ netif_carrier_off(dev); -+ } -+ } -+} -+ -+ -+static void mdio_thread(struct work_struct *work) -+{ -+ struct port *port = container_of(work, struct port, mdio_thread.work); -+ -+ phy_check_media(port, 0); -+ schedule_delayed_work(&port->mdio_thread, MDIO_INTERVAL); -+} -+ -+ -+static inline void debug_pkt(struct net_device *dev, const char *func, -+ u8 *data, int len) -+{ -+#if DEBUG_PKT_BYTES -+ int i; -+ -+ printk(KERN_DEBUG "%s: %s(%i) ", dev->name, func, len); -+ for (i = 0; i < len; i++) { -+ if (i >= DEBUG_PKT_BYTES) -+ break; -+ printk("%s%02X", -+ ((i == 6) || (i == 12) || (i >= 14)) ? " " : "", -+ data[i]); -+ } -+ printk("\n"); -+#endif -+} -+ -+ -+static inline void debug_desc(u32 phys, struct desc *desc) -+{ -+#if DEBUG_DESC -+ printk(KERN_DEBUG "%X: %X %3X %3X %08X %2X < %2X %4X %X" -+ " %X %X %02X%02X%02X%02X%02X%02X < %02X%02X%02X%02X%02X%02X\n", -+ phys, desc->next, desc->buf_len, desc->pkt_len, -+ desc->data, desc->dest_id, desc->src_id, desc->flags, -+ desc->qos, desc->padlen, desc->vlan_tci, -+ desc->dst_mac_0, desc->dst_mac_1, desc->dst_mac_2, -+ desc->dst_mac_3, desc->dst_mac_4, desc->dst_mac_5, -+ desc->src_mac_0, desc->src_mac_1, desc->src_mac_2, -+ desc->src_mac_3, desc->src_mac_4, desc->src_mac_5); -+#endif -+} -+ -+static inline void debug_queue(unsigned int queue, int is_get, u32 phys) -+{ -+#if DEBUG_QUEUES -+ static struct { -+ int queue; -+ char *name; -+ } names[] = { -+ { TX_QUEUE(0x10), "TX#0 " }, -+ { TX_QUEUE(0x20), "TX#1 " }, -+ { TX_QUEUE(0x00), "TX#2 " }, -+ { RXFREE_QUEUE(0x10), "RX-free#0 " }, -+ { RXFREE_QUEUE(0x20), "RX-free#1 " }, -+ { RXFREE_QUEUE(0x00), "RX-free#2 " }, -+ { TXDONE_QUEUE, "TX-done " }, -+ }; -+ int i; -+ -+ for (i = 0; i < ARRAY_SIZE(names); i++) -+ if (names[i].queue == queue) -+ break; -+ -+ printk(KERN_DEBUG "Queue %i %s%s %X\n", queue, -+ i < ARRAY_SIZE(names) ? names[i].name : "", -+ is_get ? "->" : "<-", phys); -+#endif -+} -+ -+static inline u32 queue_get_entry(unsigned int queue) -+{ -+ u32 phys = qmgr_get_entry(queue); -+ debug_queue(queue, 1, phys); -+ return phys; -+} -+ -+static inline int queue_get_desc(unsigned int queue, struct port *port, -+ int is_tx) -+{ -+ u32 phys, tab_phys, n_desc; -+ struct desc *tab; -+ -+ if (!(phys = queue_get_entry(queue))) -+ return -1; -+ -+ phys &= ~0x1F; /* mask out non-address bits */ -+ tab_phys = is_tx ? tx_desc_phys(port, 0) : rx_desc_phys(port, 0); -+ tab = is_tx ? tx_desc_ptr(port, 0) : rx_desc_ptr(port, 0); -+ n_desc = (phys - tab_phys) / sizeof(struct desc); -+ BUG_ON(n_desc >= (is_tx ? TX_DESCS : RX_DESCS)); -+ debug_desc(phys, &tab[n_desc]); -+ BUG_ON(tab[n_desc].next); -+ return n_desc; -+} -+ -+static inline void queue_put_desc(unsigned int queue, u32 phys, -+ struct desc *desc) -+{ -+ debug_queue(queue, 0, phys); -+ debug_desc(phys, desc); -+ BUG_ON(phys & 0x1F); -+ qmgr_put_entry(queue, phys); -+ BUG_ON(qmgr_stat_overflow(queue)); -+} -+ -+ -+static inline void dma_unmap_tx(struct port *port, struct desc *desc) -+{ -+#ifdef __ARMEB__ -+ dma_unmap_single(&port->netdev->dev, desc->data, -+ desc->buf_len, DMA_TO_DEVICE); -+#else -+ dma_unmap_single(&port->netdev->dev, desc->data & ~3, -+ ALIGN((desc->data & 3) + desc->buf_len, 4), -+ DMA_TO_DEVICE); -+#endif -+} -+ -+ -+static void eth_rx_irq(void *pdev) -+{ -+ struct net_device *dev = pdev; -+ struct port *port = netdev_priv(dev); -+ -+#if DEBUG_RX -+ printk(KERN_DEBUG "%s: eth_rx_irq\n", dev->name); -+#endif -+ qmgr_disable_irq(port->plat->rxq); -+ netif_rx_schedule(dev); -+} -+ -+static int eth_poll(struct net_device *dev, int *budget) -+{ -+ struct port *port = netdev_priv(dev); -+ unsigned int rxq = port->plat->rxq, rxfreeq = RXFREE_QUEUE(port->id); -+ int quota = dev->quota, received = 0; -+ -+#if DEBUG_RX -+ printk(KERN_DEBUG "%s: eth_poll\n", dev->name); -+#endif -+ -+ while (quota) { -+ struct sk_buff *skb; -+ struct desc *desc; -+ int n; -+#ifdef __ARMEB__ -+ struct sk_buff *temp; -+ u32 phys; -+#endif -+ -+ if ((n = queue_get_desc(rxq, port, 0)) < 0) { -+ dev->quota -= received; /* No packet received */ -+ *budget -= received; -+ received = 0; -+#if DEBUG_RX -+ printk(KERN_DEBUG "%s: eth_poll netif_rx_complete\n", -+ dev->name); -+#endif -+ netif_rx_complete(dev); -+ qmgr_enable_irq(rxq); -+ if (!qmgr_stat_empty(rxq) && -+ netif_rx_reschedule(dev, 0)) { -+#if DEBUG_RX -+ printk(KERN_DEBUG "%s: eth_poll" -+ " netif_rx_reschedule successed\n", -+ dev->name); -+#endif -+ qmgr_disable_irq(rxq); -+ continue; -+ } -+#if DEBUG_RX -+ printk(KERN_DEBUG "%s: eth_poll all done\n", -+ dev->name); -+#endif -+ return 0; /* all work done */ -+ } -+ -+ desc = rx_desc_ptr(port, n); -+ -+#ifdef __ARMEB__ -+ if ((skb = netdev_alloc_skb(dev, MAX_MRU)) != NULL) { -+ phys = dma_map_single(&dev->dev, skb->data, -+ MAX_MRU, DMA_FROM_DEVICE); -+ if (dma_mapping_error(phys)) { -+ dev_kfree_skb(skb); -+ skb = NULL; -+ } -+ } -+#else -+ skb = netdev_alloc_skb(dev, desc->pkt_len); -+#endif -+ -+ if (!skb) { -+ port->stat.rx_dropped++; -+ /* put the desc back on RX-ready queue */ -+ desc->buf_len = MAX_MRU; -+ desc->pkt_len = 0; -+ queue_put_desc(rxfreeq, rx_desc_phys(port, n), desc); -+ continue; -+ } -+ -+ /* process received frame */ -+#ifdef __ARMEB__ -+ temp = skb; -+ skb = port->rx_buff_tab[n]; -+ dma_unmap_single(&dev->dev, desc->data, -+ MAX_MRU, DMA_FROM_DEVICE); -+#else -+ dma_sync_single(&dev->dev, desc->data, -+ MAX_MRU, DMA_FROM_DEVICE); -+ memcpy_swab32((u32 *)skb->data, (u32 *)port->rx_buff_tab[n], -+ ALIGN(desc->pkt_len, 4) / 4); -+#endif -+ skb_put(skb, desc->pkt_len); -+ -+ debug_pkt(dev, "eth_poll", skb->data, skb->len); -+ -+ skb->protocol = eth_type_trans(skb, dev); -+ dev->last_rx = jiffies; -+ port->stat.rx_packets++; -+ port->stat.rx_bytes += skb->len; -+ netif_receive_skb(skb); -+ -+ /* put the new buffer on RX-free queue */ -+#ifdef __ARMEB__ -+ port->rx_buff_tab[n] = temp; -+ desc->data = phys; -+#endif -+ desc->buf_len = MAX_MRU; -+ desc->pkt_len = 0; -+ queue_put_desc(rxfreeq, rx_desc_phys(port, n), desc); -+ quota--; -+ received++; -+ } -+ dev->quota -= received; -+ *budget -= received; -+#if DEBUG_RX -+ printk(KERN_DEBUG "eth_poll(): end, not all work done\n"); -+#endif -+ return 1; /* not all work done */ -+} -+ -+ -+static void eth_txdone_irq(void *unused) -+{ -+ u32 phys; -+ -+#if DEBUG_TX -+ printk(KERN_DEBUG DRV_NAME ": eth_txdone_irq\n"); -+#endif -+ while ((phys = queue_get_entry(TXDONE_QUEUE)) != 0) { -+ u32 npe_id, n_desc; -+ struct port *port; -+ struct desc *desc; -+ int start; -+ -+ npe_id = phys & 3; -+ BUG_ON(npe_id >= MAX_NPES); -+ port = npe_port_tab[npe_id]; -+ BUG_ON(!port); -+ phys &= ~0x1F; /* mask out non-address bits */ -+ n_desc = (phys - tx_desc_phys(port, 0)) / sizeof(struct desc); -+ BUG_ON(n_desc >= TX_DESCS); -+ desc = tx_desc_ptr(port, n_desc); -+ debug_desc(phys, desc); -+ -+ if (port->tx_buff_tab[n_desc]) { /* not the draining packet */ -+ port->stat.tx_packets++; -+ port->stat.tx_bytes += desc->pkt_len; -+ -+ dma_unmap_tx(port, desc); -+#if DEBUG_TX -+ printk(KERN_DEBUG "%s: eth_txdone_irq free %p\n", -+ port->netdev->name, port->tx_buff_tab[n_desc]); -+#endif -+ free_buffer_irq(port->tx_buff_tab[n_desc]); -+ port->tx_buff_tab[n_desc] = NULL; -+ } -+ -+ start = qmgr_stat_empty(port->plat->txreadyq); -+ queue_put_desc(port->plat->txreadyq, phys, desc); -+ if (start) { -+#if DEBUG_TX -+ printk(KERN_DEBUG "%s: eth_txdone_irq xmit ready\n", -+ port->netdev->name); -+#endif -+ netif_wake_queue(port->netdev); -+ } -+ } -+} -+ -+static int eth_xmit(struct sk_buff *skb, struct net_device *dev) -+{ -+ struct port *port = netdev_priv(dev); -+ unsigned int txreadyq = port->plat->txreadyq; -+ int len, offset, bytes, n; -+ void *mem; -+ u32 phys; -+ struct desc *desc; -+ -+#if DEBUG_TX -+ printk(KERN_DEBUG "%s: eth_xmit\n", dev->name); -+#endif -+ -+ if (unlikely(skb->len > MAX_MRU)) { -+ dev_kfree_skb(skb); -+ port->stat.tx_errors++; -+ return NETDEV_TX_OK; -+ } -+ -+ debug_pkt(dev, "eth_xmit", skb->data, skb->len); -+ -+ len = skb->len; -+#ifdef __ARMEB__ -+ offset = 0; /* no need to keep alignment */ -+ bytes = len; -+ mem = skb->data; -+#else -+ offset = (int)skb->data & 3; /* keep 32-bit alignment */ -+ bytes = ALIGN(offset + len, 4); -+ if (!(mem = kmalloc(bytes, GFP_ATOMIC))) { -+ dev_kfree_skb(skb); -+ port->stat.tx_dropped++; -+ return NETDEV_TX_OK; -+ } -+ memcpy_swab32(mem, (u32 *)((int)skb->data & ~3), bytes / 4); -+ dev_kfree_skb(skb); -+#endif -+ -+ phys = dma_map_single(&dev->dev, mem, bytes, DMA_TO_DEVICE); -+ if (dma_mapping_error(phys)) { -+#ifdef __ARMEB__ -+ dev_kfree_skb(skb); -+#else -+ kfree(mem); -+#endif -+ port->stat.tx_dropped++; -+ return NETDEV_TX_OK; -+ } -+ -+ n = queue_get_desc(txreadyq, port, 1); -+ BUG_ON(n < 0); -+ desc = tx_desc_ptr(port, n); -+ -+#ifdef __ARMEB__ -+ port->tx_buff_tab[n] = skb; -+#else -+ port->tx_buff_tab[n] = mem; -+#endif -+ desc->data = phys + offset; -+ desc->buf_len = desc->pkt_len = len; -+ -+ /* NPE firmware pads short frames with zeros internally */ -+ wmb(); -+ queue_put_desc(TX_QUEUE(port->id), tx_desc_phys(port, n), desc); -+ dev->trans_start = jiffies; -+ -+ if (qmgr_stat_empty(txreadyq)) { -+#if DEBUG_TX -+ printk(KERN_DEBUG "%s: eth_xmit queue full\n", dev->name); -+#endif -+ netif_stop_queue(dev); -+ /* we could miss TX ready interrupt */ -+ if (!qmgr_stat_empty(txreadyq)) { -+#if DEBUG_TX -+ printk(KERN_DEBUG "%s: eth_xmit ready again\n", -+ dev->name); -+#endif -+ netif_wake_queue(dev); -+ } -+ } -+ -+#if DEBUG_TX -+ printk(KERN_DEBUG "%s: eth_xmit end\n", dev->name); -+#endif -+ return NETDEV_TX_OK; -+} -+ -+ -+static struct net_device_stats *eth_stats(struct net_device *dev) -+{ -+ struct port *port = netdev_priv(dev); -+ return &port->stat; -+} -+ -+static void eth_set_mcast_list(struct net_device *dev) -+{ -+ struct port *port = netdev_priv(dev); -+ struct dev_mc_list *mclist = dev->mc_list; -+ u8 diffs[ETH_ALEN], *addr; -+ int cnt = dev->mc_count, i; -+ -+ if ((dev->flags & IFF_PROMISC) || !mclist || !cnt) { -+ __raw_writel(DEFAULT_RX_CNTRL0 & ~RX_CNTRL0_ADDR_FLTR_EN, -+ &port->regs->rx_control[0]); -+ return; -+ } -+ -+ memset(diffs, 0, ETH_ALEN); -+ addr = mclist->dmi_addr; /* first MAC address */ -+ -+ while (--cnt && (mclist = mclist->next)) -+ for (i = 0; i < ETH_ALEN; i++) -+ diffs[i] |= addr[i] ^ mclist->dmi_addr[i]; -+ -+ for (i = 0; i < ETH_ALEN; i++) { -+ __raw_writel(addr[i], &port->regs->mcast_addr[i]); -+ __raw_writel(~diffs[i], &port->regs->mcast_mask[i]); -+ } -+ -+ __raw_writel(DEFAULT_RX_CNTRL0 | RX_CNTRL0_ADDR_FLTR_EN, -+ &port->regs->rx_control[0]); -+} -+ -+ -+static int eth_ioctl(struct net_device *dev, struct ifreq *req, int cmd) -+{ -+ struct port *port = netdev_priv(dev); -+ unsigned int duplex_chg; -+ int err; -+ -+ if (!netif_running(dev)) -+ return -EINVAL; -+ err = generic_mii_ioctl(&port->mii, if_mii(req), cmd, &duplex_chg); -+ if (duplex_chg) -+ eth_set_duplex(port); -+ return err; -+} -+ -+ -+static int request_queues(struct port *port) -+{ -+ int err; -+ -+ err = qmgr_request_queue(RXFREE_QUEUE(port->id), RX_DESCS, 0, 0); -+ if (err) -+ return err; -+ -+ err = qmgr_request_queue(port->plat->rxq, RX_DESCS, 0, 0); -+ if (err) -+ goto rel_rxfree; -+ -+ err = qmgr_request_queue(TX_QUEUE(port->id), TX_DESCS, 0, 0); -+ if (err) -+ goto rel_rx; -+ -+ err = qmgr_request_queue(port->plat->txreadyq, TX_DESCS, 0, 0); -+ if (err) -+ goto rel_tx; -+ -+ /* TX-done queue handles skbs sent out by the NPEs */ -+ if (!ports_open) { -+ err = qmgr_request_queue(TXDONE_QUEUE, TXDONE_QUEUE_LEN, 0, 0); -+ if (err) -+ goto rel_txready; -+ } -+ return 0; -+ -+rel_txready: -+ qmgr_release_queue(port->plat->txreadyq); -+rel_tx: -+ qmgr_release_queue(TX_QUEUE(port->id)); -+rel_rx: -+ qmgr_release_queue(port->plat->rxq); -+rel_rxfree: -+ qmgr_release_queue(RXFREE_QUEUE(port->id)); -+ printk(KERN_DEBUG "%s: unable to request hardware queues\n", -+ port->netdev->name); -+ return err; -+} -+ -+static void release_queues(struct port *port) -+{ -+ qmgr_release_queue(RXFREE_QUEUE(port->id)); -+ qmgr_release_queue(port->plat->rxq); -+ qmgr_release_queue(TX_QUEUE(port->id)); -+ qmgr_release_queue(port->plat->txreadyq); -+ -+ if (!ports_open) -+ qmgr_release_queue(TXDONE_QUEUE); -+} -+ -+static int init_queues(struct port *port) -+{ -+ int i; -+ -+ if (!ports_open) -+ if (!(dma_pool = dma_pool_create(DRV_NAME, NULL, -+ POOL_ALLOC_SIZE, 32, 0))) -+ return -ENOMEM; -+ -+ if (!(port->desc_tab = dma_pool_alloc(dma_pool, GFP_KERNEL, -+ &port->desc_tab_phys))) -+ return -ENOMEM; -+ memset(port->desc_tab, 0, POOL_ALLOC_SIZE); -+ memset(port->rx_buff_tab, 0, sizeof(port->rx_buff_tab)); /* tables */ -+ memset(port->tx_buff_tab, 0, sizeof(port->tx_buff_tab)); -+ -+ /* Setup RX buffers */ -+ for (i = 0; i < RX_DESCS; i++) { -+ struct desc *desc = rx_desc_ptr(port, i); -+ buffer_t *buff; -+ void *data; -+#ifdef __ARMEB__ -+ if (!(buff = netdev_alloc_skb(port->netdev, MAX_MRU))) -+ return -ENOMEM; -+ data = buff->data; -+#else -+ if (!(buff = kmalloc(MAX_MRU, GFP_KERNEL))) -+ return -ENOMEM; -+ data = buff; -+#endif -+ desc->buf_len = MAX_MRU; -+ desc->data = dma_map_single(&port->netdev->dev, data, -+ MAX_MRU, DMA_FROM_DEVICE); -+ if (dma_mapping_error(desc->data)) { -+ free_buffer(buff); -+ return -EIO; -+ } -+ port->rx_buff_tab[i] = buff; -+ } -+ -+ return 0; -+} -+ -+static void destroy_queues(struct port *port) -+{ -+ int i; -+ -+ if (port->desc_tab) { -+ for (i = 0; i < RX_DESCS; i++) { -+ struct desc *desc = rx_desc_ptr(port, i); -+ buffer_t *buff = port->rx_buff_tab[i]; -+ if (buff) { -+ dma_unmap_single(&port->netdev->dev, -+ desc->data, MAX_MRU, -+ DMA_FROM_DEVICE); -+ free_buffer(buff); -+ } -+ } -+ for (i = 0; i < TX_DESCS; i++) { -+ struct desc *desc = tx_desc_ptr(port, i); -+ buffer_t *buff = port->tx_buff_tab[i]; -+ if (buff) { -+ dma_unmap_tx(port, desc); -+ free_buffer(buff); -+ } -+ } -+ dma_pool_free(dma_pool, port->desc_tab, port->desc_tab_phys); -+ port->desc_tab = NULL; -+ } -+ -+ if (!ports_open && dma_pool) { -+ dma_pool_destroy(dma_pool); -+ dma_pool = NULL; -+ } -+} -+ -+static int eth_open(struct net_device *dev) -+{ -+ struct port *port = netdev_priv(dev); -+ struct npe *npe = port->npe; -+ struct msg msg; -+ int i, err; -+ -+ if (!npe_running(npe)) { -+ err = npe_load_firmware(npe, npe_name(npe), &dev->dev); -+ if (err) -+ return err; -+ -+ if (npe_recv_message(npe, &msg, "ETH_GET_STATUS")) { -+ printk(KERN_ERR "%s: %s not responding\n", dev->name, -+ npe_name(npe)); -+ return -EIO; -+ } -+ } -+ -+ mdio_write(dev, port->plat->phy, MII_BMCR, port->mii_bmcr); -+ -+ memset(&msg, 0, sizeof(msg)); -+ msg.cmd = NPE_VLAN_SETRXQOSENTRY; -+ msg.eth_id = port->id; -+ msg.byte5 = port->plat->rxq | 0x80; -+ msg.byte7 = port->plat->rxq << 4; -+ for (i = 0; i < 8; i++) { -+ msg.byte3 = i; -+ if (npe_send_recv_message(port->npe, &msg, "ETH_SET_RXQ")) -+ return -EIO; -+ } -+ -+ msg.cmd = NPE_EDB_SETPORTADDRESS; -+ msg.eth_id = PHYSICAL_ID(port->id); -+ msg.byte2 = dev->dev_addr[0]; -+ msg.byte3 = dev->dev_addr[1]; -+ msg.byte4 = dev->dev_addr[2]; -+ msg.byte5 = dev->dev_addr[3]; -+ msg.byte6 = dev->dev_addr[4]; -+ msg.byte7 = dev->dev_addr[5]; -+ if (npe_send_recv_message(port->npe, &msg, "ETH_SET_MAC")) -+ return -EIO; -+ -+ memset(&msg, 0, sizeof(msg)); -+ msg.cmd = NPE_FW_SETFIREWALLMODE; -+ msg.eth_id = port->id; -+ if (npe_send_recv_message(port->npe, &msg, "ETH_SET_FIREWALL_MODE")) -+ return -EIO; -+ -+ if ((err = request_queues(port)) != 0) -+ return err; -+ -+ if ((err = init_queues(port)) != 0) { -+ destroy_queues(port); -+ release_queues(port); -+ return err; -+ } -+ -+ for (i = 0; i < ETH_ALEN; i++) -+ __raw_writel(dev->dev_addr[i], &port->regs->hw_addr[i]); -+ __raw_writel(0x08, &port->regs->random_seed); -+ __raw_writel(0x12, &port->regs->partial_empty_threshold); -+ __raw_writel(0x30, &port->regs->partial_full_threshold); -+ __raw_writel(0x08, &port->regs->tx_start_bytes); -+ __raw_writel(0x15, &port->regs->tx_deferral); -+ __raw_writel(0x08, &port->regs->tx_2part_deferral[0]); -+ __raw_writel(0x07, &port->regs->tx_2part_deferral[1]); -+ __raw_writel(0x80, &port->regs->slot_time); -+ __raw_writel(0x01, &port->regs->int_clock_threshold); -+ -+ /* Populate queues with buffers, no failure after this point */ -+ for (i = 0; i < TX_DESCS; i++) -+ queue_put_desc(port->plat->txreadyq, -+ tx_desc_phys(port, i), tx_desc_ptr(port, i)); -+ -+ for (i = 0; i < RX_DESCS; i++) -+ queue_put_desc(RXFREE_QUEUE(port->id), -+ rx_desc_phys(port, i), rx_desc_ptr(port, i)); -+ -+ __raw_writel(TX_CNTRL1_RETRIES, &port->regs->tx_control[1]); -+ __raw_writel(DEFAULT_TX_CNTRL0, &port->regs->tx_control[0]); -+ __raw_writel(0, &port->regs->rx_control[1]); -+ __raw_writel(DEFAULT_RX_CNTRL0, &port->regs->rx_control[0]); -+ -+ phy_check_media(port, 1); -+ eth_set_mcast_list(dev); -+ netif_start_queue(dev); -+ schedule_delayed_work(&port->mdio_thread, MDIO_INTERVAL); -+ -+ qmgr_set_irq(port->plat->rxq, QUEUE_IRQ_SRC_NOT_EMPTY, -+ eth_rx_irq, dev); -+ if (!ports_open) { -+ qmgr_set_irq(TXDONE_QUEUE, QUEUE_IRQ_SRC_NOT_EMPTY, -+ eth_txdone_irq, NULL); -+ qmgr_enable_irq(TXDONE_QUEUE); -+ } -+ ports_open++; -+ netif_rx_schedule(dev); /* we may already have RX data, enables IRQ */ -+ return 0; -+} -+ -+static int eth_close(struct net_device *dev) -+{ -+ struct port *port = netdev_priv(dev); -+ struct msg msg; -+ int buffs = RX_DESCS; /* allocated RX buffers */ -+ int i; -+ -+ ports_open--; -+ qmgr_disable_irq(port->plat->rxq); -+ netif_stop_queue(dev); -+ -+ while (queue_get_desc(RXFREE_QUEUE(port->id), port, 0) >= 0) -+ buffs--; -+ -+ memset(&msg, 0, sizeof(msg)); -+ msg.cmd = NPE_SETLOOPBACK_MODE; -+ msg.eth_id = port->id; -+ msg.byte3 = 1; -+ if (npe_send_recv_message(port->npe, &msg, "ETH_ENABLE_LOOPBACK")) -+ printk(KERN_CRIT "%s: unable to enable loopback\n", dev->name); -+ -+ i = 0; -+ do { /* drain RX buffers */ -+ while (queue_get_desc(port->plat->rxq, port, 0) >= 0) -+ buffs--; -+ if (!buffs) -+ break; -+ if (qmgr_stat_empty(TX_QUEUE(port->id))) { -+ /* we have to inject some packet */ -+ struct desc *desc; -+ u32 phys; -+ int n = queue_get_desc(port->plat->txreadyq, port, 1); -+ BUG_ON(n < 0); -+ desc = tx_desc_ptr(port, n); -+ phys = tx_desc_phys(port, n); -+ desc->buf_len = desc->pkt_len = 1; -+ wmb(); -+ queue_put_desc(TX_QUEUE(port->id), phys, desc); -+ } -+ udelay(1); -+ } while (++i < MAX_CLOSE_WAIT); -+ -+ if (buffs) -+ printk(KERN_CRIT "%s: unable to drain RX queue, %i buffer(s)" -+ " left in NPE\n", dev->name, buffs); -+#if DEBUG_CLOSE -+ if (!buffs) -+ printk(KERN_DEBUG "Draining RX queue took %i cycles\n", i); -+#endif -+ -+ buffs = TX_DESCS; -+ while (queue_get_desc(TX_QUEUE(port->id), port, 1) >= 0) -+ buffs--; /* cancel TX */ -+ -+ i = 0; -+ do { -+ while (queue_get_desc(port->plat->txreadyq, port, 1) >= 0) -+ buffs--; -+ if (!buffs) -+ break; -+ } while (++i < MAX_CLOSE_WAIT); -+ -+ if (buffs) -+ printk(KERN_CRIT "%s: unable to drain TX queue, %i buffer(s) " -+ "left in NPE\n", dev->name, buffs); -+#if DEBUG_CLOSE -+ if (!buffs) -+ printk(KERN_DEBUG "Draining TX queues took %i cycles\n", i); -+#endif -+ -+ msg.byte3 = 0; -+ if (npe_send_recv_message(port->npe, &msg, "ETH_DISABLE_LOOPBACK")) -+ printk(KERN_CRIT "%s: unable to disable loopback\n", -+ dev->name); -+ -+ port->mii_bmcr = mdio_read(dev, port->plat->phy, MII_BMCR) & -+ ~(BMCR_RESET | BMCR_PDOWN); /* may have been altered */ -+ mdio_write(dev, port->plat->phy, MII_BMCR, -+ port->mii_bmcr | BMCR_PDOWN); -+ -+ if (!ports_open) -+ qmgr_disable_irq(TXDONE_QUEUE); -+ cancel_rearming_delayed_work(&port->mdio_thread); -+ destroy_queues(port); -+ release_queues(port); -+ return 0; -+} -+ -+static int __devinit eth_init_one(struct platform_device *pdev) -+{ -+ struct port *port; -+ struct net_device *dev; -+ struct eth_plat_info *plat = pdev->dev.platform_data; -+ u32 regs_phys; -+ int err; -+ -+ if (!(dev = alloc_etherdev(sizeof(struct port)))) -+ return -ENOMEM; -+ -+ SET_MODULE_OWNER(dev); -+ SET_NETDEV_DEV(dev, &pdev->dev); -+ port = netdev_priv(dev); -+ port->netdev = dev; -+ port->id = pdev->id; -+ -+ switch (port->id) { -+ case IXP4XX_ETH_NPEA: -+ port->regs = (struct eth_regs __iomem *)IXP4XX_EthA_BASE_VIRT; -+ regs_phys = IXP4XX_EthA_BASE_PHYS; -+ break; -+ case IXP4XX_ETH_NPEB: -+ port->regs = (struct eth_regs __iomem *)IXP4XX_EthB_BASE_VIRT; -+ regs_phys = IXP4XX_EthB_BASE_PHYS; -+ break; -+ case IXP4XX_ETH_NPEC: -+ port->regs = (struct eth_regs __iomem *)IXP4XX_EthC_BASE_VIRT; -+ regs_phys = IXP4XX_EthC_BASE_PHYS; -+ break; -+ default: -+ err = -ENOSYS; -+ goto err_free; -+ } -+ -+ dev->open = eth_open; -+ dev->hard_start_xmit = eth_xmit; -+ dev->poll = eth_poll; -+ dev->stop = eth_close; -+ dev->get_stats = eth_stats; -+ dev->do_ioctl = eth_ioctl; -+ dev->set_multicast_list = eth_set_mcast_list; -+ dev->weight = 16; -+ dev->tx_queue_len = 100; -+ -+ if (!(port->npe = npe_request(NPE_ID(port->id)))) { -+ err = -EIO; -+ goto err_free; -+ } -+ -+ if (register_netdev(dev)) { -+ err = -EIO; -+ goto err_npe_rel; -+ } -+ -+ port->mem_res = request_mem_region(regs_phys, REGS_SIZE, dev->name); -+ if (!port->mem_res) { -+ err = -EBUSY; -+ goto err_unreg; -+ } -+ -+ port->plat = plat; -+ npe_port_tab[NPE_ID(port->id)] = port; -+ memcpy(dev->dev_addr, plat->hwaddr, ETH_ALEN); -+ -+ platform_set_drvdata(pdev, dev); -+ -+ __raw_writel(DEFAULT_CORE_CNTRL | CORE_RESET, -+ &port->regs->core_control); -+ udelay(50); -+ __raw_writel(DEFAULT_CORE_CNTRL, &port->regs->core_control); -+ udelay(50); -+ -+ port->mii.dev = dev; -+ port->mii.mdio_read = mdio_read; -+ port->mii.mdio_write = mdio_write; -+ port->mii.phy_id = plat->phy; -+ port->mii.phy_id_mask = 0x1F; -+ port->mii.reg_num_mask = 0x1F; -+ -+ printk(KERN_INFO "%s: MII PHY %i on %s\n", dev->name, plat->phy, -+ npe_name(port->npe)); -+ -+ phy_reset(dev, plat->phy); -+ port->mii_bmcr = mdio_read(dev, plat->phy, MII_BMCR) & -+ ~(BMCR_RESET | BMCR_PDOWN); -+ mdio_write(dev, plat->phy, MII_BMCR, port->mii_bmcr | BMCR_PDOWN); -+ -+ INIT_DELAYED_WORK(&port->mdio_thread, mdio_thread); -+ return 0; -+ -+err_unreg: -+ unregister_netdev(dev); -+err_npe_rel: -+ npe_release(port->npe); -+err_free: -+ free_netdev(dev); -+ return err; -+} -+ -+static int __devexit eth_remove_one(struct platform_device *pdev) -+{ -+ struct net_device *dev = platform_get_drvdata(pdev); -+ struct port *port = netdev_priv(dev); -+ -+ unregister_netdev(dev); -+ npe_port_tab[NPE_ID(port->id)] = NULL; -+ platform_set_drvdata(pdev, NULL); -+ npe_release(port->npe); -+ release_resource(port->mem_res); -+ free_netdev(dev); -+ return 0; -+} -+ -+static struct platform_driver drv = { -+ .driver.name = DRV_NAME, -+ .probe = eth_init_one, -+ .remove = eth_remove_one, -+}; -+ -+static int __init eth_init_module(void) -+{ -+ if (!(ixp4xx_read_feature_bits() & IXP4XX_FEATURE_NPEB_ETH0)) -+ return -ENOSYS; -+ -+ /* All MII PHY accesses use NPE-B Ethernet registers */ -+ spin_lock_init(&mdio_lock); -+ mdio_regs = (struct eth_regs __iomem *)IXP4XX_EthB_BASE_VIRT; -+ __raw_writel(DEFAULT_CORE_CNTRL, &mdio_regs->core_control); -+ -+ return platform_driver_register(&drv); -+} -+ -+static void __exit eth_cleanup_module(void) -+{ -+ platform_driver_unregister(&drv); -+} -+ -+MODULE_AUTHOR("Krzysztof Halasa"); -+MODULE_DESCRIPTION("Intel IXP4xx Ethernet driver"); -+MODULE_LICENSE("GPL v2"); -+module_init(eth_init_module); -+module_exit(eth_cleanup_module); -Index: linux-2.6.23.17/drivers/net/wan/Kconfig -=================================================================== ---- linux-2.6.23.17.orig/drivers/net/wan/Kconfig -+++ linux-2.6.23.17/drivers/net/wan/Kconfig -@@ -334,6 +334,15 @@ config DSCC4_PCI_RST - - Say Y if your card supports this feature. - -+config IXP4XX_HSS -+ tristate "IXP4xx HSS (synchronous serial port) support" -+ depends on HDLC && ARM && ARCH_IXP4XX -+ select IXP4XX_NPE -+ select IXP4XX_QMGR -+ help -+ Say Y here if you want to use built-in HSS ports -+ on IXP4xx processor. -+ - config DLCI - tristate "Frame Relay DLCI support" - ---help--- -Index: linux-2.6.23.17/drivers/net/wan/Makefile -=================================================================== ---- linux-2.6.23.17.orig/drivers/net/wan/Makefile -+++ linux-2.6.23.17/drivers/net/wan/Makefile -@@ -42,6 +42,7 @@ obj-$(CONFIG_C101) += c101.o - obj-$(CONFIG_WANXL) += wanxl.o - obj-$(CONFIG_PCI200SYN) += pci200syn.o - obj-$(CONFIG_PC300TOO) += pc300too.o -+obj-$(CONFIG_IXP4XX_HSS) += ixp4xx_hss.o - - clean-files := wanxlfw.inc - $(obj)/wanxl.o: $(obj)/wanxlfw.inc -Index: linux-2.6.23.17/drivers/net/wan/ixp4xx_hss.c -=================================================================== ---- /dev/null -+++ linux-2.6.23.17/drivers/net/wan/ixp4xx_hss.c -@@ -0,0 +1,1270 @@ -+/* -+ * Intel IXP4xx HSS (synchronous serial port) driver for Linux -+ * -+ * Copyright (C) 2007 Krzysztof Halasa <khc@pm.waw.pl> -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of version 2 of the GNU General Public License -+ * as published by the Free Software Foundation. -+ */ -+ -+#include <linux/dma-mapping.h> -+#include <linux/dmapool.h> -+#include <linux/io.h> -+#include <linux/kernel.h> -+#include <linux/hdlc.h> -+#include <linux/platform_device.h> -+#include <asm/arch/npe.h> -+#include <asm/arch/qmgr.h> -+ -+#define DEBUG_QUEUES 0 -+#define DEBUG_DESC 0 -+#define DEBUG_RX 0 -+#define DEBUG_TX 0 -+#define DEBUG_PKT_BYTES 0 -+#define DEBUG_CLOSE 0 -+ -+#define DRV_NAME "ixp4xx_hss" -+ -+#define PKT_EXTRA_FLAGS 0 /* orig 1 */ -+#define FRAME_SYNC_OFFSET 0 /* unused, channelized only */ -+#define FRAME_SYNC_SIZE 1024 -+#define PKT_NUM_PIPES 1 /* 1, 2 or 4 */ -+#define PKT_PIPE_FIFO_SIZEW 4 /* total 4 dwords per HSS */ -+ -+#define RX_DESCS 16 /* also length of all RX queues */ -+#define TX_DESCS 16 /* also length of all TX queues */ -+ -+#define POOL_ALLOC_SIZE (sizeof(struct desc) * (RX_DESCS + TX_DESCS)) -+#define RX_SIZE (HDLC_MAX_MRU + 4) /* NPE needs more space */ -+#define MAX_CLOSE_WAIT 1000 /* microseconds */ -+ -+/* Queue IDs */ -+#define HSS0_CHL_RXTRIG_QUEUE 12 /* orig size = 32 dwords */ -+#define HSS0_PKT_RX_QUEUE 13 /* orig size = 32 dwords */ -+#define HSS0_PKT_TX0_QUEUE 14 /* orig size = 16 dwords */ -+#define HSS0_PKT_TX1_QUEUE 15 -+#define HSS0_PKT_TX2_QUEUE 16 -+#define HSS0_PKT_TX3_QUEUE 17 -+#define HSS0_PKT_RXFREE0_QUEUE 18 /* orig size = 16 dwords */ -+#define HSS0_PKT_RXFREE1_QUEUE 19 -+#define HSS0_PKT_RXFREE2_QUEUE 20 -+#define HSS0_PKT_RXFREE3_QUEUE 21 -+#define HSS0_PKT_TXDONE_QUEUE 22 /* orig size = 64 dwords */ -+ -+#define HSS1_CHL_RXTRIG_QUEUE 10 -+#define HSS1_PKT_RX_QUEUE 0 -+#define HSS1_PKT_TX0_QUEUE 5 -+#define HSS1_PKT_TX1_QUEUE 6 -+#define HSS1_PKT_TX2_QUEUE 7 -+#define HSS1_PKT_TX3_QUEUE 8 -+#define HSS1_PKT_RXFREE0_QUEUE 1 -+#define HSS1_PKT_RXFREE1_QUEUE 2 -+#define HSS1_PKT_RXFREE2_QUEUE 3 -+#define HSS1_PKT_RXFREE3_QUEUE 4 -+#define HSS1_PKT_TXDONE_QUEUE 9 -+ -+#define NPE_PKT_MODE_HDLC 0 -+#define NPE_PKT_MODE_RAW 1 -+#define NPE_PKT_MODE_56KMODE 2 -+#define NPE_PKT_MODE_56KENDIAN_MSB 4 -+ -+/* PKT_PIPE_HDLC_CFG_WRITE flags */ -+#define PKT_HDLC_IDLE_ONES 0x1 /* default = flags */ -+#define PKT_HDLC_CRC_32 0x2 /* default = CRC-16 */ -+#define PKT_HDLC_MSB_ENDIAN 0x4 /* default = LE */ -+ -+ -+/* hss_config, PCRs */ -+/* Frame sync sampling, default = active low */ -+#define PCR_FRM_SYNC_ACTIVE_HIGH 0x40000000 -+#define PCR_FRM_SYNC_FALLINGEDGE 0x80000000 -+#define PCR_FRM_SYNC_RISINGEDGE 0xC0000000 -+ -+/* Frame sync pin: input (default) or output generated off a given clk edge */ -+#define PCR_FRM_SYNC_OUTPUT_FALLING 0x20000000 -+#define PCR_FRM_SYNC_OUTPUT_RISING 0x30000000 -+ -+/* Frame and data clock sampling on edge, default = falling */ -+#define PCR_FCLK_EDGE_RISING 0x08000000 -+#define PCR_DCLK_EDGE_RISING 0x04000000 -+ -+/* Clock direction, default = input */ -+#define PCR_SYNC_CLK_DIR_OUTPUT 0x02000000 -+ -+/* Generate/Receive frame pulses, default = enabled */ -+#define PCR_FRM_PULSE_DISABLED 0x01000000 -+ -+ /* Data rate is full (default) or half the configured clk speed */ -+#define PCR_HALF_CLK_RATE 0x00200000 -+ -+/* Invert data between NPE and HSS FIFOs? (default = no) */ -+#define PCR_DATA_POLARITY_INVERT 0x00100000 -+ -+/* TX/RX endianness, default = LSB */ -+#define PCR_MSB_ENDIAN 0x00080000 -+ -+/* Normal (default) / open drain mode (TX only) */ -+#define PCR_TX_PINS_OPEN_DRAIN 0x00040000 -+ -+/* No framing bit transmitted and expected on RX? (default = framing bit) */ -+#define PCR_SOF_NO_FBIT 0x00020000 -+ -+/* Drive data pins? */ -+#define PCR_TX_DATA_ENABLE 0x00010000 -+ -+/* Voice 56k type: drive the data pins low (default), high, high Z */ -+#define PCR_TX_V56K_HIGH 0x00002000 -+#define PCR_TX_V56K_HIGH_IMP 0x00004000 -+ -+/* Unassigned type: drive the data pins low (default), high, high Z */ -+#define PCR_TX_UNASS_HIGH 0x00000800 -+#define PCR_TX_UNASS_HIGH_IMP 0x00001000 -+ -+/* T1 @ 1.544MHz only: Fbit dictated in FIFO (default) or high Z */ -+#define PCR_TX_FB_HIGH_IMP 0x00000400 -+ -+/* 56k data endiannes - which bit unused: high (default) or low */ -+#define PCR_TX_56KE_BIT_0_UNUSED 0x00000200 -+ -+/* 56k data transmission type: 32/8 bit data (default) or 56K data */ -+#define PCR_TX_56KS_56K_DATA 0x00000100 -+ -+/* hss_config, cCR */ -+/* Number of packetized clients, default = 1 */ -+#define CCR_NPE_HFIFO_2_HDLC 0x04000000 -+#define CCR_NPE_HFIFO_3_OR_4HDLC 0x08000000 -+ -+/* default = no loopback */ -+#define CCR_LOOPBACK 0x02000000 -+ -+/* HSS number, default = 0 (first) */ -+#define CCR_SECOND_HSS 0x01000000 -+ -+ -+/* hss_config, clkCR: main:10, num:10, denom:12 */ -+#define CLK42X_SPEED_EXP ((0x3FF << 22) | ( 2 << 12) | 15) /*65 KHz*/ -+ -+#define CLK42X_SPEED_512KHZ (( 130 << 22) | ( 2 << 12) | 15) -+#define CLK42X_SPEED_1536KHZ (( 43 << 22) | ( 18 << 12) | 47) -+#define CLK42X_SPEED_1544KHZ (( 43 << 22) | ( 33 << 12) | 192) -+#define CLK42X_SPEED_2048KHZ (( 32 << 22) | ( 34 << 12) | 63) -+#define CLK42X_SPEED_4096KHZ (( 16 << 22) | ( 34 << 12) | 127) -+#define CLK42X_SPEED_8192KHZ (( 8 << 22) | ( 34 << 12) | 255) -+ -+#define CLK46X_SPEED_512KHZ (( 130 << 22) | ( 24 << 12) | 127) -+#define CLK46X_SPEED_1536KHZ (( 43 << 22) | (152 << 12) | 383) -+#define CLK46X_SPEED_1544KHZ (( 43 << 22) | ( 66 << 12) | 385) -+#define CLK46X_SPEED_2048KHZ (( 32 << 22) | (280 << 12) | 511) -+#define CLK46X_SPEED_4096KHZ (( 16 << 22) | (280 << 12) | 1023) -+#define CLK46X_SPEED_8192KHZ (( 8 << 22) | (280 << 12) | 2047) -+ -+ -+/* hss_config, LUT entries */ -+#define TDMMAP_UNASSIGNED 0 -+#define TDMMAP_HDLC 1 /* HDLC - packetized */ -+#define TDMMAP_VOICE56K 2 /* Voice56K - 7-bit channelized */ -+#define TDMMAP_VOICE64K 3 /* Voice64K - 8-bit channelized */ -+ -+#define TIMESLOTS 128 -+#define LUT_BITS 2 -+ -+/* offsets into HSS config */ -+#define HSS_CONFIG_TX_PCR 0x00 -+#define HSS_CONFIG_RX_PCR 0x04 -+#define HSS_CONFIG_CORE_CR 0x08 -+#define HSS_CONFIG_CLOCK_CR 0x0C -+#define HSS_CONFIG_TX_FCR 0x10 -+#define HSS_CONFIG_RX_FCR 0x14 -+#define HSS_CONFIG_TX_LUT 0x18 -+#define HSS_CONFIG_RX_LUT 0x38 -+ -+ -+/* NPE command codes */ -+/* writes the ConfigWord value to the location specified by offset */ -+#define PORT_CONFIG_WRITE 0x40 -+ -+/* triggers the NPE to load the contents of the configuration table */ -+#define PORT_CONFIG_LOAD 0x41 -+ -+/* triggers the NPE to return an HssErrorReadResponse message */ -+#define PORT_ERROR_READ 0x42 -+ -+/* reset NPE internal status and enable the HssChannelized operation */ -+#define CHAN_FLOW_ENABLE 0x43 -+#define CHAN_FLOW_DISABLE 0x44 -+#define CHAN_IDLE_PATTERN_WRITE 0x45 -+#define CHAN_NUM_CHANS_WRITE 0x46 -+#define CHAN_RX_BUF_ADDR_WRITE 0x47 -+#define CHAN_RX_BUF_CFG_WRITE 0x48 -+#define CHAN_TX_BLK_CFG_WRITE 0x49 -+#define CHAN_TX_BUF_ADDR_WRITE 0x4A -+#define CHAN_TX_BUF_SIZE_WRITE 0x4B -+#define CHAN_TSLOTSWITCH_ENABLE 0x4C -+#define CHAN_TSLOTSWITCH_DISABLE 0x4D -+ -+/* downloads the gainWord value for a timeslot switching channel associated -+ with bypassNum */ -+#define CHAN_TSLOTSWITCH_GCT_DOWNLOAD 0x4E -+ -+/* triggers the NPE to reset internal status and enable the HssPacketized -+ operation for the flow specified by pPipe */ -+#define PKT_PIPE_FLOW_ENABLE 0x50 -+#define PKT_PIPE_FLOW_DISABLE 0x51 -+#define PKT_NUM_PIPES_WRITE 0x52 -+#define PKT_PIPE_FIFO_SIZEW_WRITE 0x53 -+#define PKT_PIPE_HDLC_CFG_WRITE 0x54 -+#define PKT_PIPE_IDLE_PATTERN_WRITE 0x55 -+#define PKT_PIPE_RX_SIZE_WRITE 0x56 -+#define PKT_PIPE_MODE_WRITE 0x57 -+ -+/* HDLC packet status values - desc->status */ -+#define ERR_SHUTDOWN 1 /* stop or shutdown occurrance */ -+#define ERR_HDLC_ALIGN 2 /* HDLC alignment error */ -+#define ERR_HDLC_FCS 3 /* HDLC Frame Check Sum error */ -+#define ERR_RXFREE_Q_EMPTY 4 /* RX-free queue became empty while receiving -+ this packet (if buf_len < pkt_len) */ -+#define ERR_HDLC_TOO_LONG 5 /* HDLC frame size too long */ -+#define ERR_HDLC_ABORT 6 /* abort sequence received */ -+#define ERR_DISCONNECTING 7 /* disconnect is in progress */ -+ -+ -+#ifdef __ARMEB__ -+typedef struct sk_buff buffer_t; -+#define free_buffer dev_kfree_skb -+#define free_buffer_irq dev_kfree_skb_irq -+#else -+typedef void buffer_t; -+#define free_buffer kfree -+#define free_buffer_irq kfree -+#endif -+ -+struct port { -+ struct npe *npe; -+ struct net_device *netdev; -+ struct hss_plat_info *plat; -+ buffer_t *rx_buff_tab[RX_DESCS], *tx_buff_tab[TX_DESCS]; -+ struct desc *desc_tab; /* coherent */ -+ u32 desc_tab_phys; -+ int id; -+ unsigned int clock_type, clock_rate, loopback; -+ u8 hdlc_cfg; -+}; -+ -+/* NPE message structure */ -+struct msg { -+#ifdef __ARMEB__ -+ u8 cmd, unused, hss_port, index; -+ union { -+ struct { u8 data8a, data8b, data8c, data8d; }; -+ struct { u16 data16a, data16b; }; -+ struct { u32 data32; }; -+ }; -+#else -+ u8 index, hss_port, unused, cmd; -+ union { -+ struct { u8 data8d, data8c, data8b, data8a; }; -+ struct { u16 data16b, data16a; }; -+ struct { u32 data32; }; -+ }; -+#endif -+}; -+ -+/* HDLC packet descriptor */ -+struct desc { -+ u32 next; /* pointer to next buffer, unused */ -+ -+#ifdef __ARMEB__ -+ u16 buf_len; /* buffer length */ -+ u16 pkt_len; /* packet length */ -+ u32 data; /* pointer to data buffer in RAM */ -+ u8 status; -+ u8 error_count; -+ u16 __reserved; -+#else -+ u16 pkt_len; /* packet length */ -+ u16 buf_len; /* buffer length */ -+ u32 data; /* pointer to data buffer in RAM */ -+ u16 __reserved; -+ u8 error_count; -+ u8 status; -+#endif -+ u32 __reserved1[4]; -+}; -+ -+ -+#define rx_desc_phys(port, n) ((port)->desc_tab_phys + \ -+ (n) * sizeof(struct desc)) -+#define rx_desc_ptr(port, n) (&(port)->desc_tab[n]) -+ -+#define tx_desc_phys(port, n) ((port)->desc_tab_phys + \ -+ ((n) + RX_DESCS) * sizeof(struct desc)) -+#define tx_desc_ptr(port, n) (&(port)->desc_tab[(n) + RX_DESCS]) -+ -+/***************************************************************************** -+ * global variables -+ ****************************************************************************/ -+ -+static int ports_open; -+static struct dma_pool *dma_pool; -+ -+static const struct { -+ int tx, txdone, rx, rxfree; -+}queue_ids[2] = {{ HSS0_PKT_TX0_QUEUE, HSS0_PKT_TXDONE_QUEUE, -+ HSS0_PKT_RX_QUEUE, HSS0_PKT_RXFREE0_QUEUE }, -+ { HSS1_PKT_TX0_QUEUE, HSS1_PKT_TXDONE_QUEUE, -+ HSS1_PKT_RX_QUEUE, HSS1_PKT_RXFREE0_QUEUE }, -+}; -+ -+/***************************************************************************** -+ * utility functions -+ ****************************************************************************/ -+ -+static inline struct port* dev_to_port(struct net_device *dev) -+{ -+ return dev_to_hdlc(dev)->priv; -+} -+ -+#ifndef __ARMEB__ -+static inline void memcpy_swab32(u32 *dest, u32 *src, int cnt) -+{ -+ int i; -+ for (i = 0; i < cnt; i++) -+ dest[i] = swab32(src[i]); -+} -+#endif -+ -+static inline void debug_pkt(struct net_device *dev, const char *func, -+ u8 *data, int len) -+{ -+#if DEBUG_PKT_BYTES -+ int i; -+ -+ printk(KERN_DEBUG "%s: %s(%i) ", dev->name, func, len); -+ for (i = 0; i < len; i++) { -+ if (i >= DEBUG_PKT_BYTES) -+ break; -+ printk("%s%02X", !(i % 4) ? " " : "", data[i]); -+ } -+ printk("\n"); -+#endif -+} -+ -+ -+static inline void debug_desc(u32 phys, struct desc *desc) -+{ -+#if DEBUG_DESC -+ printk(KERN_DEBUG "%X: %X %3X %3X %08X %X %X\n", -+ phys, desc->next, desc->buf_len, desc->pkt_len, -+ desc->data, desc->status, desc->error_count); -+#endif -+} -+ -+static inline void debug_queue(unsigned int queue, int is_get, u32 phys) -+{ -+#if DEBUG_QUEUES -+ static struct { -+ int queue; -+ char *name; -+ } names[] = { -+ { HSS0_PKT_TX0_QUEUE, "TX#0 " }, -+ { HSS0_PKT_TXDONE_QUEUE, "TX-done#0 " }, -+ { HSS0_PKT_RX_QUEUE, "RX#0 " }, -+ { HSS0_PKT_RXFREE0_QUEUE, "RX-free#0 " }, -+ { HSS1_PKT_TX0_QUEUE, "TX#1 " }, -+ { HSS1_PKT_TXDONE_QUEUE, "TX-done#1 " }, -+ { HSS1_PKT_RX_QUEUE, "RX#1 " }, -+ { HSS1_PKT_RXFREE0_QUEUE, "RX-free#1 " }, -+ }; -+ int i; -+ -+ for (i = 0; i < ARRAY_SIZE(names); i++) -+ if (names[i].queue == queue) -+ break; -+ -+ printk(KERN_DEBUG "Queue %i %s%s %X\n", queue, -+ i < ARRAY_SIZE(names) ? names[i].name : "", -+ is_get ? "->" : "<-", phys); -+#endif -+} -+ -+static inline u32 queue_get_entry(unsigned int queue) -+{ -+ u32 phys = qmgr_get_entry(queue); -+ debug_queue(queue, 1, phys); -+ return phys; -+} -+ -+static inline int queue_get_desc(unsigned int queue, struct port *port, -+ int is_tx) -+{ -+ u32 phys, tab_phys, n_desc; -+ struct desc *tab; -+ -+ if (!(phys = queue_get_entry(queue))) -+ return -1; -+ -+ BUG_ON(phys & 0x1F); -+ tab_phys = is_tx ? tx_desc_phys(port, 0) : rx_desc_phys(port, 0); -+ tab = is_tx ? tx_desc_ptr(port, 0) : rx_desc_ptr(port, 0); -+ n_desc = (phys - tab_phys) / sizeof(struct desc); -+ BUG_ON(n_desc >= (is_tx ? TX_DESCS : RX_DESCS)); -+ debug_desc(phys, &tab[n_desc]); -+ BUG_ON(tab[n_desc].next); -+ return n_desc; -+} -+ -+static inline void queue_put_desc(unsigned int queue, u32 phys, -+ struct desc *desc) -+{ -+ debug_queue(queue, 0, phys); -+ debug_desc(phys, desc); -+ BUG_ON(phys & 0x1F); -+ qmgr_put_entry(queue, phys); -+ BUG_ON(qmgr_stat_overflow(queue)); -+} -+ -+ -+static inline void dma_unmap_tx(struct port *port, struct desc *desc) -+{ -+#ifdef __ARMEB__ -+ dma_unmap_single(&port->netdev->dev, desc->data, -+ desc->buf_len, DMA_TO_DEVICE); -+#else -+ dma_unmap_single(&port->netdev->dev, desc->data & ~3, -+ ALIGN((desc->data & 3) + desc->buf_len, 4), -+ DMA_TO_DEVICE); -+#endif -+} -+ -+ -+static void hss_hdlc_set_carrier(void *pdev, int carrier) -+{ -+ struct net_device *dev = pdev; -+ if (carrier) -+ netif_carrier_on(dev); -+ else -+ netif_carrier_off(dev); -+} -+ -+static void hss_hdlc_rx_irq(void *pdev) -+{ -+ struct net_device *dev = pdev; -+ struct port *port = dev_to_port(dev); -+ -+#if DEBUG_RX -+ printk(KERN_DEBUG "%s: hss_hdlc_rx_irq\n", dev->name); -+#endif -+ qmgr_disable_irq(queue_ids[port->id].rx); -+ netif_rx_schedule(dev); -+} -+ -+static int hss_hdlc_poll(struct net_device *dev, int *budget) -+{ -+ struct port *port = dev_to_port(dev); -+ unsigned int rxq = queue_ids[port->id].rx; -+ unsigned int rxfreeq = queue_ids[port->id].rxfree; -+ struct net_device_stats *stats = hdlc_stats(dev); -+ int quota = dev->quota, received = 0; -+ -+#if DEBUG_RX -+ printk(KERN_DEBUG "%s: hss_hdlc_poll\n", dev->name); -+#endif -+ -+ while (quota) { -+ struct sk_buff *skb; -+ struct desc *desc; -+ int n; -+#ifdef __ARMEB__ -+ struct sk_buff *temp; -+ u32 phys; -+#endif -+ -+ if ((n = queue_get_desc(rxq, port, 0)) < 0) { -+ dev->quota -= received; /* No packet received */ -+ *budget -= received; -+ received = 0; -+#if DEBUG_RX -+ printk(KERN_DEBUG "%s: hss_hdlc_poll" -+ " netif_rx_complete\n", dev->name); -+#endif -+ netif_rx_complete(dev); -+ qmgr_enable_irq(rxq); -+ if (!qmgr_stat_empty(rxq) && -+ netif_rx_reschedule(dev, 0)) { -+#if DEBUG_RX -+ printk(KERN_DEBUG "%s: hss_hdlc_poll" -+ " netif_rx_reschedule successed\n", -+ dev->name); -+#endif -+ qmgr_disable_irq(rxq); -+ continue; -+ } -+#if DEBUG_RX -+ printk(KERN_DEBUG "%s: hss_hdlc_poll all done\n", -+ dev->name); -+#endif -+ return 0; /* all work done */ -+ } -+ -+ desc = rx_desc_ptr(port, n); -+ -+ if (desc->error_count) /* FIXME - remove printk */ -+ printk(KERN_DEBUG "%s: hss_hdlc_poll status 0x%02X" -+ " errors %u\n", dev->name, desc->status, -+ desc->error_count); -+ -+ skb = NULL; -+ switch (desc->status) { -+ case 0: -+#ifdef __ARMEB__ -+ if ((skb = netdev_alloc_skb(dev, RX_SIZE)) != NULL) { -+ phys = dma_map_single(&dev->dev, skb->data, -+ RX_SIZE, -+ DMA_FROM_DEVICE); -+ if (dma_mapping_error(phys)) { -+ dev_kfree_skb(skb); -+ skb = NULL; -+ } -+ } -+#else -+ skb = netdev_alloc_skb(dev, desc->pkt_len); -+#endif -+ if (!skb) -+ stats->rx_dropped++; -+ break; -+ case ERR_HDLC_ALIGN: -+ case ERR_HDLC_ABORT: -+ stats->rx_frame_errors++; -+ stats->rx_errors++; -+ break; -+ case ERR_HDLC_FCS: -+ stats->rx_crc_errors++; -+ stats->rx_errors++; -+ break; -+ case ERR_HDLC_TOO_LONG: -+ stats->rx_length_errors++; -+ stats->rx_errors++; -+ break; -+ default: /* FIXME - remove printk */ -+ printk(KERN_ERR "%s: hss_hdlc_poll: status 0x%02X" -+ " errors %u\n", dev->name, desc->status, -+ desc->error_count); -+ stats->rx_errors++; -+ } -+ -+ if (!skb) { -+ /* put the desc back on RX-ready queue */ -+ desc->buf_len = RX_SIZE; -+ desc->pkt_len = desc->status = 0; -+ queue_put_desc(rxfreeq, rx_desc_phys(port, n), desc); -+ continue; -+ } -+ -+ /* process received frame */ -+#ifdef __ARMEB__ -+ temp = skb; -+ skb = port->rx_buff_tab[n]; -+ dma_unmap_single(&dev->dev, desc->data, -+ RX_SIZE, DMA_FROM_DEVICE); -+#else -+ dma_sync_single(&dev->dev, desc->data, -+ RX_SIZE, DMA_FROM_DEVICE); -+ memcpy_swab32((u32 *)skb->data, (u32 *)port->rx_buff_tab[n], -+ ALIGN(desc->pkt_len, 4) / 4); -+#endif -+ skb_put(skb, desc->pkt_len); -+ -+ debug_pkt(dev, "hss_hdlc_poll", skb->data, skb->len); -+ -+ skb->protocol = hdlc_type_trans(skb, dev); -+ dev->last_rx = jiffies; -+ stats->rx_packets++; -+ stats->rx_bytes += skb->len; -+ netif_receive_skb(skb); -+ -+ /* put the new buffer on RX-free queue */ -+#ifdef __ARMEB__ -+ port->rx_buff_tab[n] = temp; -+ desc->data = phys; -+#endif -+ desc->buf_len = RX_SIZE; -+ desc->pkt_len = 0; -+ queue_put_desc(rxfreeq, rx_desc_phys(port, n), desc); -+ quota--; -+ received++; -+ } -+ dev->quota -= received; -+ *budget -= received; -+#if DEBUG_RX -+ printk(KERN_DEBUG "hss_hdlc_poll: end, not all work done\n"); -+#endif -+ return 1; /* not all work done */ -+} -+ -+ -+static void hss_hdlc_txdone_irq(void *pdev) -+{ -+ struct net_device *dev = pdev; -+ struct port *port = dev_to_port(dev); -+ struct net_device_stats *stats = hdlc_stats(dev); -+ int n_desc; -+ -+#if DEBUG_TX -+ printk(KERN_DEBUG DRV_NAME ": hss_hdlc_txdone_irq\n"); -+#endif -+ while ((n_desc = queue_get_desc(queue_ids[port->id].txdone, -+ port, 1)) >= 0) { -+ struct desc *desc; -+ int start; -+ -+ desc = tx_desc_ptr(port, n_desc); -+ -+ stats->tx_packets++; -+ stats->tx_bytes += desc->pkt_len; -+ -+ dma_unmap_tx(port, desc); -+#if DEBUG_TX -+ printk(KERN_DEBUG "%s: hss_hdlc_txdone_irq free %p\n", -+ port->netdev->name, port->tx_buff_tab[n_desc]); -+#endif -+ free_buffer_irq(port->tx_buff_tab[n_desc]); -+ port->tx_buff_tab[n_desc] = NULL; -+ -+ start = qmgr_stat_empty(port->plat->txreadyq); -+ queue_put_desc(port->plat->txreadyq, -+ tx_desc_phys(port, n_desc), desc); -+ if (start) { -+#if DEBUG_TX -+ printk(KERN_DEBUG "%s: hss_hdlc_txdone_irq xmit" -+ " ready\n", port->netdev->name); -+#endif -+ netif_wake_queue(port->netdev); -+ } -+ } -+} -+ -+static int hss_hdlc_xmit(struct sk_buff *skb, struct net_device *dev) -+{ -+ struct port *port = dev_to_port(dev); -+ struct net_device_stats *stats = hdlc_stats(dev); -+ unsigned int txreadyq = port->plat->txreadyq; -+ int len, offset, bytes, n; -+ void *mem; -+ u32 phys; -+ struct desc *desc; -+ -+#if DEBUG_TX -+ printk(KERN_DEBUG "%s: hss_hdlc_xmit\n", dev->name); -+#endif -+ -+ if (unlikely(skb->len > HDLC_MAX_MRU)) { -+ dev_kfree_skb(skb); -+ stats->tx_errors++; -+ return NETDEV_TX_OK; -+ } -+ -+ debug_pkt(dev, "hss_hdlc_xmit", skb->data, skb->len); -+ -+ len = skb->len; -+#ifdef __ARMEB__ -+ offset = 0; /* no need to keep alignment */ -+ bytes = len; -+ mem = skb->data; -+#else -+ offset = (int)skb->data & 3; /* keep 32-bit alignment */ -+ bytes = ALIGN(offset + len, 4); -+ if (!(mem = kmalloc(bytes, GFP_ATOMIC))) { -+ dev_kfree_skb(skb); -+ stats->tx_dropped++; -+ return NETDEV_TX_OK; -+ } -+ memcpy_swab32(mem, (u32 *)((int)skb->data & ~3), bytes / 4); -+ dev_kfree_skb(skb); -+#endif -+ -+ phys = dma_map_single(&dev->dev, mem, bytes, DMA_TO_DEVICE); -+ if (dma_mapping_error(phys)) { -+#ifdef __ARMEB__ -+ dev_kfree_skb(skb); -+#else -+ kfree(mem); -+#endif -+ stats->tx_dropped++; -+ return NETDEV_TX_OK; -+ } -+ -+ n = queue_get_desc(txreadyq, port, 1); -+ BUG_ON(n < 0); -+ desc = tx_desc_ptr(port, n); -+ -+#ifdef __ARMEB__ -+ port->tx_buff_tab[n] = skb; -+#else -+ port->tx_buff_tab[n] = mem; -+#endif -+ desc->data = phys + offset; -+ desc->buf_len = desc->pkt_len = len; -+ -+ wmb(); -+ queue_put_desc(queue_ids[port->id].tx, tx_desc_phys(port, n), desc); -+ dev->trans_start = jiffies; -+ -+ if (qmgr_stat_empty(txreadyq)) { -+#if DEBUG_TX -+ printk(KERN_DEBUG "%s: hss_hdlc_xmit queue full\n", dev->name); -+#endif -+ netif_stop_queue(dev); -+ /* we could miss TX ready interrupt */ -+ if (!qmgr_stat_empty(txreadyq)) { -+#if DEBUG_TX -+ printk(KERN_DEBUG "%s: hss_hdlc_xmit ready again\n", -+ dev->name); -+#endif -+ netif_wake_queue(dev); -+ } -+ } -+ -+#if DEBUG_TX -+ printk(KERN_DEBUG "%s: hss_hdlc_xmit end\n", dev->name); -+#endif -+ return NETDEV_TX_OK; -+} -+ -+ -+static int request_hdlc_queues(struct port *port) -+{ -+ int err; -+ -+ err = qmgr_request_queue(queue_ids[port->id].rxfree, RX_DESCS, 0, 0); -+ if (err) -+ return err; -+ -+ err = qmgr_request_queue(queue_ids[port->id].rx, RX_DESCS, 0, 0); -+ if (err) -+ goto rel_rxfree; -+ -+ err = qmgr_request_queue(queue_ids[port->id].tx, TX_DESCS, 0, 0); -+ if (err) -+ goto rel_rx; -+ -+ err = qmgr_request_queue(port->plat->txreadyq, TX_DESCS, 0, 0); -+ if (err) -+ goto rel_tx; -+ -+ err = qmgr_request_queue(queue_ids[port->id].txdone, TX_DESCS, 0, 0); -+ if (err) -+ goto rel_txready; -+ return 0; -+ -+rel_txready: -+ qmgr_release_queue(port->plat->txreadyq); -+rel_tx: -+ qmgr_release_queue(queue_ids[port->id].tx); -+rel_rx: -+ qmgr_release_queue(queue_ids[port->id].rx); -+rel_rxfree: -+ qmgr_release_queue(queue_ids[port->id].rxfree); -+ printk(KERN_DEBUG "%s: unable to request hardware queues\n", -+ port->netdev->name); -+ return err; -+} -+ -+static void release_hdlc_queues(struct port *port) -+{ -+ qmgr_release_queue(queue_ids[port->id].rxfree); -+ qmgr_release_queue(queue_ids[port->id].rx); -+ qmgr_release_queue(queue_ids[port->id].txdone); -+ qmgr_release_queue(queue_ids[port->id].tx); -+ qmgr_release_queue(port->plat->txreadyq); -+} -+ -+static int init_hdlc_queues(struct port *port) -+{ -+ int i; -+ -+ if (!ports_open) -+ if (!(dma_pool = dma_pool_create(DRV_NAME, NULL, -+ POOL_ALLOC_SIZE, 32, 0))) -+ return -ENOMEM; -+ -+ if (!(port->desc_tab = dma_pool_alloc(dma_pool, GFP_KERNEL, -+ &port->desc_tab_phys))) -+ return -ENOMEM; -+ memset(port->desc_tab, 0, POOL_ALLOC_SIZE); -+ memset(port->rx_buff_tab, 0, sizeof(port->rx_buff_tab)); /* tables */ -+ memset(port->tx_buff_tab, 0, sizeof(port->tx_buff_tab)); -+ -+ /* Setup RX buffers */ -+ for (i = 0; i < RX_DESCS; i++) { -+ struct desc *desc = rx_desc_ptr(port, i); -+ buffer_t *buff; -+ void *data; -+#ifdef __ARMEB__ -+ if (!(buff = netdev_alloc_skb(port->netdev, RX_SIZE))) -+ return -ENOMEM; -+ data = buff->data; -+#else -+ if (!(buff = kmalloc(RX_SIZE, GFP_KERNEL))) -+ return -ENOMEM; -+ data = buff; -+#endif -+ desc->buf_len = RX_SIZE; -+ desc->data = dma_map_single(&port->netdev->dev, data, -+ RX_SIZE, DMA_FROM_DEVICE); -+ if (dma_mapping_error(desc->data)) { -+ free_buffer(buff); -+ return -EIO; -+ } -+ port->rx_buff_tab[i] = buff; -+ } -+ -+ return 0; -+} -+ -+static void destroy_hdlc_queues(struct port *port) -+{ -+ int i; -+ -+ if (port->desc_tab) { -+ for (i = 0; i < RX_DESCS; i++) { -+ struct desc *desc = rx_desc_ptr(port, i); -+ buffer_t *buff = port->rx_buff_tab[i]; -+ if (buff) { -+ dma_unmap_single(&port->netdev->dev, -+ desc->data, RX_SIZE, -+ DMA_FROM_DEVICE); -+ free_buffer(buff); -+ } -+ } -+ for (i = 0; i < TX_DESCS; i++) { -+ struct desc *desc = tx_desc_ptr(port, i); -+ buffer_t *buff = port->tx_buff_tab[i]; -+ if (buff) { -+ dma_unmap_tx(port, desc); -+ free_buffer(buff); -+ } -+ } -+ dma_pool_free(dma_pool, port->desc_tab, port->desc_tab_phys); -+ port->desc_tab = NULL; -+ } -+ -+ if (!ports_open && dma_pool) { -+ dma_pool_destroy(dma_pool); -+ dma_pool = NULL; -+ } -+} -+ -+static int hss_hdlc_open(struct net_device *dev) -+{ -+ struct port *port = dev_to_port(dev); -+ struct npe *npe = port->npe; -+ struct msg msg; -+ int i, err; -+ -+ if (!npe_running(npe)) { -+ err = npe_load_firmware(npe, npe_name(npe), &dev->dev); -+ if (err) -+ return err; -+ } -+ -+ if ((err = hdlc_open(dev)) != 0) -+ return err; -+ -+ if (port->plat->open) -+ if ((err = port->plat->open(port->id, port->netdev, -+ hss_hdlc_set_carrier)) != 0) -+ goto err_hdlc_close; -+ -+ /* HSS main configuration */ -+ memset(&msg, 0, sizeof(msg)); -+ msg.cmd = PORT_CONFIG_WRITE; -+ msg.hss_port = port->id; -+ msg.index = 0; /* offset in HSS config */ -+ -+ msg.data32 = PCR_FRM_PULSE_DISABLED | -+ PCR_SOF_NO_FBIT | -+ PCR_MSB_ENDIAN | -+ PCR_TX_DATA_ENABLE; -+ -+ if (port->clock_type == CLOCK_INT) -+ msg.data32 |= PCR_SYNC_CLK_DIR_OUTPUT; -+ -+ if ((err = npe_send_message(npe, &msg, "HSS_SET_TX_PCR") != 0)) -+ goto err_plat_close; /* 0: TX PCR */ -+ -+ msg.index = 4; -+ msg.data32 ^= PCR_TX_DATA_ENABLE | PCR_DCLK_EDGE_RISING; -+ if ((err = npe_send_message(npe, &msg, "HSS_SET_RX_PCR") != 0)) -+ goto err_plat_close; /* 4: RX PCR */ -+ -+ msg.index = 8; -+ msg.data32 = (port->loopback ? CCR_LOOPBACK : 0) | -+ (port->id ? CCR_SECOND_HSS : 0); -+ if ((err = npe_send_message(npe, &msg, "HSS_SET_CORE_CR") != 0)) -+ goto err_plat_close; /* 8: Core CR */ -+ -+ msg.index = 12; -+ msg.data32 = CLK42X_SPEED_2048KHZ /* FIXME */; -+ if ((err = npe_send_message(npe, &msg, "HSS_SET_CLK_CR") != 0)) -+ goto err_plat_close; /* 12: CLK CR */ -+ -+ msg.data32 = (FRAME_SYNC_OFFSET << 16) | (FRAME_SYNC_SIZE - 1); -+ msg.index = 16; -+ if ((err = npe_send_message(npe, &msg, "HSS_SET_TX_FCR") != 0)) -+ goto err_plat_close; /* 16: TX FCR */ -+ -+ msg.index = 20; -+ if ((err = npe_send_message(npe, &msg, "HSS_SET_RX_FCR") != 0)) -+ goto err_plat_close; /* 20: RX FCR */ -+ -+ msg.data32 = 0; /* Fill LUT with HDLC timeslots */ -+ for (i = 0; i < 32 / LUT_BITS; i++) -+ msg.data32 |= TDMMAP_HDLC << (LUT_BITS * i); -+ -+ for (i = 0; i < 2 /* TX and RX */ * TIMESLOTS * LUT_BITS / 8; i += 4) { -+ msg.index = 24 + i; /* 24 - 55: TX LUT, 56 - 87: RX LUT */ -+ if ((err = npe_send_message(npe, &msg, "HSS_SET_LUT") != 0)) -+ goto err_plat_close; -+ } -+ -+ /* HDLC mode configuration */ -+ memset(&msg, 0, sizeof(msg)); -+ msg.cmd = PKT_NUM_PIPES_WRITE; -+ msg.hss_port = port->id; -+ msg.data8a = PKT_NUM_PIPES; -+ if ((err = npe_send_message(npe, &msg, "HSS_SET_PKT_PIPES") != 0)) -+ goto err_plat_close; -+ -+ memset(&msg, 0, sizeof(msg)); -+ msg.cmd = PKT_PIPE_FIFO_SIZEW_WRITE; -+ msg.hss_port = port->id; -+ msg.data8a = PKT_PIPE_FIFO_SIZEW; -+ if ((err = npe_send_message(npe, &msg, "HSS_SET_PKT_FIFO") != 0)) -+ goto err_plat_close; -+ -+ memset(&msg, 0, sizeof(msg)); -+ msg.cmd = PKT_PIPE_IDLE_PATTERN_WRITE; -+ msg.hss_port = port->id; -+ msg.data32 = 0x7F7F7F7F; -+ if ((err = npe_send_message(npe, &msg, "HSS_SET_PKT_IDLE") != 0)) -+ goto err_plat_close; -+ -+ memset(&msg, 0, sizeof(msg)); -+ msg.cmd = PORT_CONFIG_LOAD; -+ msg.hss_port = port->id; -+ if ((err = npe_send_message(npe, &msg, "HSS_LOAD_CONFIG") != 0)) -+ goto err_plat_close; -+ if ((err = npe_recv_message(npe, &msg, "HSS_LOAD_CONFIG") != 0)) -+ goto err_plat_close; -+ -+ /* HSS_LOAD_CONFIG for port #1 returns port_id = #4 */ -+ if (msg.cmd != PORT_CONFIG_LOAD || msg.data32) { -+ printk(KERN_DEBUG "%s: unexpected message received in" -+ " response to HSS_LOAD_CONFIG\n", npe_name(npe)); -+ err = EIO; -+ goto err_plat_close; -+ } -+ -+ memset(&msg, 0, sizeof(msg)); -+ msg.cmd = PKT_PIPE_HDLC_CFG_WRITE; -+ msg.hss_port = port->id; -+ msg.data8a = port->hdlc_cfg; /* rx_cfg */ -+ msg.data8b = port->hdlc_cfg | (PKT_EXTRA_FLAGS << 3); /* tx_cfg */ -+ if ((err = npe_send_message(npe, &msg, "HSS_SET_HDLC_CFG") != 0)) -+ goto err_plat_close; -+ -+ memset(&msg, 0, sizeof(msg)); -+ msg.cmd = PKT_PIPE_MODE_WRITE; -+ msg.hss_port = port->id; -+ msg.data8a = NPE_PKT_MODE_HDLC; -+ /* msg.data8b = inv_mask */ -+ /* msg.data8c = or_mask */ -+ if ((err = npe_send_message(npe, &msg, "HSS_SET_PKT_MODE") != 0)) -+ goto err_plat_close; -+ -+ memset(&msg, 0, sizeof(msg)); -+ msg.cmd = PKT_PIPE_RX_SIZE_WRITE; -+ msg.hss_port = port->id; -+ msg.data16a = HDLC_MAX_MRU; -+ if ((err = npe_send_message(npe, &msg, "HSS_SET_PKT_RX_SIZE") != 0)) -+ goto err_plat_close; -+ -+ if ((err = request_hdlc_queues(port)) != 0) -+ goto err_plat_close; -+ -+ if ((err = init_hdlc_queues(port)) != 0) -+ goto err_destroy_queues; -+ -+ memset(&msg, 0, sizeof(msg)); -+ msg.cmd = PKT_PIPE_FLOW_ENABLE; -+ msg.hss_port = port->id; -+ if ((err = npe_send_message(npe, &msg, "HSS_ENABLE_PKT_PIPE") != 0)) -+ goto err_destroy_queues; -+ -+ /* Populate queues with buffers, no failure after this point */ -+ for (i = 0; i < TX_DESCS; i++) -+ queue_put_desc(port->plat->txreadyq, -+ tx_desc_phys(port, i), tx_desc_ptr(port, i)); -+ -+ for (i = 0; i < RX_DESCS; i++) -+ queue_put_desc(queue_ids[port->id].rxfree, -+ rx_desc_phys(port, i), rx_desc_ptr(port, i)); -+ -+ netif_start_queue(dev); -+ -+ qmgr_set_irq(queue_ids[port->id].rx, QUEUE_IRQ_SRC_NOT_EMPTY, -+ hss_hdlc_rx_irq, dev); -+ -+ qmgr_set_irq(queue_ids[port->id].txdone, QUEUE_IRQ_SRC_NOT_EMPTY, -+ hss_hdlc_txdone_irq, dev); -+ qmgr_enable_irq(queue_ids[port->id].txdone); -+ -+ ports_open++; -+ netif_rx_schedule(dev); /* we may already have RX data, enables IRQ */ -+ return 0; -+ -+err_destroy_queues: -+ destroy_hdlc_queues(port); -+ release_hdlc_queues(port); -+err_plat_close: -+ if (port->plat->close) -+ port->plat->close(port->id, port->netdev); -+err_hdlc_close: -+ hdlc_close(dev); -+ return err; -+} -+ -+static int hss_hdlc_close(struct net_device *dev) -+{ -+ struct port *port = dev_to_port(dev); -+ struct npe *npe = port->npe; -+ struct msg msg; -+ int buffs = RX_DESCS; /* allocated RX buffers */ -+ int i; -+ -+ ports_open--; -+ qmgr_disable_irq(queue_ids[port->id].rx); -+ netif_stop_queue(dev); -+ -+ memset(&msg, 0, sizeof(msg)); -+ msg.cmd = PKT_PIPE_FLOW_DISABLE; -+ msg.hss_port = port->id; -+ if (npe_send_message(npe, &msg, "HSS_DISABLE_PKT_PIPE")) { -+ printk(KERN_CRIT "HSS-%i: unable to stop HDLC flow\n", -+ port->id); -+ /* The upper level would ignore the error anyway */ -+ } -+ -+ while (queue_get_desc(queue_ids[port->id].rxfree, port, 0) >= 0) -+ buffs--; -+ while (queue_get_desc(queue_ids[port->id].rx, port, 0) >= 0) -+ buffs--; -+ -+ if (buffs) -+ printk(KERN_CRIT "%s: unable to drain RX queue, %i buffer(s)" -+ " left in NPE\n", dev->name, buffs); -+ -+ buffs = TX_DESCS; -+ while (queue_get_desc(queue_ids[port->id].tx, port, 1) >= 0) -+ buffs--; /* cancel TX */ -+ -+ i = 0; -+ do { -+ while (queue_get_desc(port->plat->txreadyq, port, 1) >= 0) -+ buffs--; -+ if (!buffs) -+ break; -+ } while (++i < MAX_CLOSE_WAIT); -+ -+ if (buffs) -+ printk(KERN_CRIT "%s: unable to drain TX queue, %i buffer(s) " -+ "left in NPE\n", dev->name, buffs); -+#if DEBUG_CLOSE -+ if (!buffs) -+ printk(KERN_DEBUG "Draining TX queues took %i cycles\n", i); -+#endif -+ qmgr_disable_irq(queue_ids[port->id].txdone); -+ destroy_hdlc_queues(port); -+ release_hdlc_queues(port); -+ -+ if (port->plat->close) -+ port->plat->close(port->id, port->netdev); -+ hdlc_close(dev); -+ return 0; -+} -+ -+ -+static int hss_hdlc_attach(struct net_device *dev, unsigned short encoding, -+ unsigned short parity) -+{ -+ struct port *port = dev_to_port(dev); -+ -+ if (encoding != ENCODING_NRZ) -+ return -EINVAL; -+ -+ switch(parity) { -+ case PARITY_CRC16_PR1_CCITT: -+ port->hdlc_cfg = 0; -+ return 0; -+ -+ case PARITY_CRC32_PR1_CCITT: -+ port->hdlc_cfg = PKT_HDLC_CRC_32; -+ return 0; -+ -+ default: -+ return -EINVAL; -+ } -+} -+ -+ -+static int hss_hdlc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) -+{ -+ const size_t size = sizeof(sync_serial_settings); -+ sync_serial_settings new_line; -+ int clk; -+ sync_serial_settings __user *line = ifr->ifr_settings.ifs_ifsu.sync; -+ struct port *port = dev_to_port(dev); -+ -+ if (cmd != SIOCWANDEV) -+ return hdlc_ioctl(dev, ifr, cmd); -+ -+ switch(ifr->ifr_settings.type) { -+ case IF_GET_IFACE: -+ ifr->ifr_settings.type = IF_IFACE_V35; -+ if (ifr->ifr_settings.size < size) { -+ ifr->ifr_settings.size = size; /* data size wanted */ -+ return -ENOBUFS; -+ } -+ memset(&new_line, 0, sizeof(new_line)); -+ new_line.clock_type = port->clock_type; -+ new_line.clock_rate = port->clock_rate; -+ new_line.loopback = port->loopback; -+ if (copy_to_user(line, &new_line, size)) -+ return -EFAULT; -+ return 0; -+ -+ case IF_IFACE_SYNC_SERIAL: -+ case IF_IFACE_V35: -+ if(!capable(CAP_NET_ADMIN)) -+ return -EPERM; -+ if (dev->flags & IFF_UP) -+ return -EBUSY; /* Cannot change parameters when open */ -+ -+ if (copy_from_user(&new_line, line, size)) -+ return -EFAULT; -+ -+ clk = new_line.clock_type; -+ if (port->plat->set_clock) -+ clk = port->plat->set_clock(port->id, clk); -+ -+ if (clk != CLOCK_EXT && clk != CLOCK_INT) -+ return -EINVAL; /* No such clock setting */ -+ -+ if (new_line.loopback != 0 && new_line.loopback != 1) -+ return -EINVAL; -+ -+ port->clock_type = clk; /* Update settings */ -+ port->clock_rate = new_line.clock_rate; -+ port->loopback = new_line.loopback; -+ return 0; -+ -+ default: -+ return hdlc_ioctl(dev, ifr, cmd); -+ } -+} -+ -+ -+static int __devinit hss_init_one(struct platform_device *pdev) -+{ -+ struct port *port; -+ struct net_device *dev; -+ hdlc_device *hdlc; -+ int err; -+ -+ if ((port = kzalloc(sizeof(*port), GFP_KERNEL)) == NULL) -+ return -ENOMEM; -+ platform_set_drvdata(pdev, port); -+ port->id = pdev->id; -+ -+ if ((port->npe = npe_request(0)) == NULL) { -+ err = -ENOSYS; -+ goto err_free; -+ } -+ -+ port->plat = pdev->dev.platform_data; -+ if ((port->netdev = dev = alloc_hdlcdev(port)) == NULL) { -+ err = -ENOMEM; -+ goto err_plat; -+ } -+ -+ SET_MODULE_OWNER(net); -+ SET_NETDEV_DEV(dev, &pdev->dev); -+ hdlc = dev_to_hdlc(dev); -+ hdlc->attach = hss_hdlc_attach; -+ hdlc->xmit = hss_hdlc_xmit; -+ dev->open = hss_hdlc_open; -+ dev->poll = hss_hdlc_poll; -+ dev->stop = hss_hdlc_close; -+ dev->do_ioctl = hss_hdlc_ioctl; -+ dev->weight = 16; -+ dev->tx_queue_len = 100; -+ port->clock_type = CLOCK_EXT; -+ port->clock_rate = 2048000; -+ -+ if (register_hdlc_device(dev)) { -+ printk(KERN_ERR "HSS-%i: unable to register HDLC device\n", -+ port->id); -+ err = -ENOBUFS; -+ goto err_free_netdev; -+ } -+ printk(KERN_INFO "%s: HSS-%i\n", dev->name, port->id); -+ return 0; -+ -+err_free_netdev: -+ free_netdev(dev); -+err_plat: -+ npe_release(port->npe); -+ platform_set_drvdata(pdev, NULL); -+err_free: -+ kfree(port); -+ return err; -+} -+ -+static int __devexit hss_remove_one(struct platform_device *pdev) -+{ -+ struct port *port = platform_get_drvdata(pdev); -+ -+ unregister_hdlc_device(port->netdev); -+ free_netdev(port->netdev); -+ npe_release(port->npe); -+ platform_set_drvdata(pdev, NULL); -+ kfree(port); -+ return 0; -+} -+ -+static struct platform_driver drv = { -+ .driver.name = DRV_NAME, -+ .probe = hss_init_one, -+ .remove = hss_remove_one, -+}; -+ -+static int __init hss_init_module(void) -+{ -+ if ((ixp4xx_read_feature_bits() & -+ (IXP4XX_FEATURE_HDLC | IXP4XX_FEATURE_HSS)) != -+ (IXP4XX_FEATURE_HDLC | IXP4XX_FEATURE_HSS)) -+ return -ENOSYS; -+ return platform_driver_register(&drv); -+} -+ -+static void __exit hss_cleanup_module(void) -+{ -+ platform_driver_unregister(&drv); -+} -+ -+MODULE_AUTHOR("Krzysztof Halasa"); -+MODULE_DESCRIPTION("Intel IXP4xx HSS driver"); -+MODULE_LICENSE("GPL v2"); -+module_init(hss_init_module); -+module_exit(hss_cleanup_module); -Index: linux-2.6.23.17/include/asm-arm/arch-ixp4xx/cpu.h -=================================================================== ---- linux-2.6.23.17.orig/include/asm-arm/arch-ixp4xx/cpu.h -+++ linux-2.6.23.17/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 */ -Index: linux-2.6.23.17/include/asm-arm/arch-ixp4xx/hardware.h -=================================================================== ---- linux-2.6.23.17.orig/include/asm-arm/arch-ixp4xx/hardware.h -+++ linux-2.6.23.17/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" - -Index: linux-2.6.23.17/include/asm-arm/arch-ixp4xx/ixp4xx-regs.h -=================================================================== ---- linux-2.6.23.17.orig/include/asm-arm/arch-ixp4xx/ixp4xx-regs.h -+++ linux-2.6.23.17/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 -Index: linux-2.6.23.17/include/asm-arm/arch-ixp4xx/npe.h -=================================================================== ---- /dev/null -+++ linux-2.6.23.17/include/asm-arm/arch-ixp4xx/npe.h -@@ -0,0 +1,39 @@ -+#ifndef __IXP4XX_NPE_H -+#define __IXP4XX_NPE_H -+ -+#include <linux/kernel.h> -+ -+extern const char *npe_names[]; -+ -+struct npe_regs { -+ u32 exec_addr, exec_data, exec_status_cmd, exec_count; -+ u32 action_points[4]; -+ u32 watchpoint_fifo, watch_count; -+ u32 profile_count; -+ u32 messaging_status, messaging_control; -+ u32 mailbox_status, /*messaging_*/ in_out_fifo; -+}; -+ -+struct npe { -+ struct resource *mem_res; -+ struct npe_regs __iomem *regs; -+ u32 regs_phys; -+ int id; -+ int valid; -+}; -+ -+ -+static inline const char *npe_name(struct npe *npe) -+{ -+ return npe_names[npe->id]; -+} -+ -+int npe_running(struct npe *npe); -+int npe_send_message(struct npe *npe, const void *msg, const char *what); -+int npe_recv_message(struct npe *npe, void *msg, const char *what); -+int npe_send_recv_message(struct npe *npe, void *msg, const char *what); -+int npe_load_firmware(struct npe *npe, const char *name, struct device *dev); -+struct npe *npe_request(int id); -+void npe_release(struct npe *npe); -+ -+#endif /* __IXP4XX_NPE_H */ -Index: linux-2.6.23.17/include/asm-arm/arch-ixp4xx/platform.h -=================================================================== ---- linux-2.6.23.17.orig/include/asm-arm/arch-ixp4xx/platform.h -+++ linux-2.6.23.17/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 -Index: linux-2.6.23.17/include/asm-arm/arch-ixp4xx/qmgr.h -=================================================================== ---- /dev/null -+++ linux-2.6.23.17/include/asm-arm/arch-ixp4xx/qmgr.h -@@ -0,0 +1,126 @@ -+/* -+ * Copyright (C) 2007 Krzysztof Halasa <khc@pm.waw.pl> -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of version 2 of the GNU General Public License -+ * as published by the Free Software Foundation. -+ */ -+ -+#ifndef IXP4XX_QMGR_H -+#define IXP4XX_QMGR_H -+ -+#include <linux/io.h> -+#include <linux/kernel.h> -+ -+#define HALF_QUEUES 32 -+#define QUEUES 64 /* only 32 lower queues currently supported */ -+#define MAX_QUEUE_LENGTH 4 /* in dwords */ -+ -+#define QUEUE_STAT1_EMPTY 1 /* queue status bits */ -+#define QUEUE_STAT1_NEARLY_EMPTY 2 -+#define QUEUE_STAT1_NEARLY_FULL 4 -+#define QUEUE_STAT1_FULL 8 -+#define QUEUE_STAT2_UNDERFLOW 1 -+#define QUEUE_STAT2_OVERFLOW 2 -+ -+#define QUEUE_WATERMARK_0_ENTRIES 0 -+#define QUEUE_WATERMARK_1_ENTRY 1 -+#define QUEUE_WATERMARK_2_ENTRIES 2 -+#define QUEUE_WATERMARK_4_ENTRIES 3 -+#define QUEUE_WATERMARK_8_ENTRIES 4 -+#define QUEUE_WATERMARK_16_ENTRIES 5 -+#define QUEUE_WATERMARK_32_ENTRIES 6 -+#define QUEUE_WATERMARK_64_ENTRIES 7 -+ -+/* queue interrupt request conditions */ -+#define QUEUE_IRQ_SRC_EMPTY 0 -+#define QUEUE_IRQ_SRC_NEARLY_EMPTY 1 -+#define QUEUE_IRQ_SRC_NEARLY_FULL 2 -+#define QUEUE_IRQ_SRC_FULL 3 -+#define QUEUE_IRQ_SRC_NOT_EMPTY 4 -+#define QUEUE_IRQ_SRC_NOT_NEARLY_EMPTY 5 -+#define QUEUE_IRQ_SRC_NOT_NEARLY_FULL 6 -+#define QUEUE_IRQ_SRC_NOT_FULL 7 -+ -+struct qmgr_regs { -+ u32 acc[QUEUES][MAX_QUEUE_LENGTH]; /* 0x000 - 0x3FF */ -+ u32 stat1[4]; /* 0x400 - 0x40F */ -+ u32 stat2[2]; /* 0x410 - 0x417 */ -+ u32 statne_h; /* 0x418 - queue nearly empty */ -+ u32 statf_h; /* 0x41C - queue full */ -+ u32 irqsrc[4]; /* 0x420 - 0x42F IRC source */ -+ u32 irqen[2]; /* 0x430 - 0x437 IRQ enabled */ -+ u32 irqstat[2]; /* 0x438 - 0x43F - IRQ access only */ -+ u32 reserved[1776]; -+ u32 sram[2048]; /* 0x2000 - 0x3FFF - config and buffer */ -+}; -+ -+void qmgr_set_irq(unsigned int queue, int src, -+ void (*handler)(void *pdev), void *pdev); -+void qmgr_enable_irq(unsigned int queue); -+void qmgr_disable_irq(unsigned int queue); -+ -+/* request_ and release_queue() must be called from non-IRQ context */ -+int qmgr_request_queue(unsigned int queue, unsigned int len /* dwords */, -+ unsigned int nearly_empty_watermark, -+ unsigned int nearly_full_watermark); -+void qmgr_release_queue(unsigned int queue); -+ -+ -+static inline void qmgr_put_entry(unsigned int queue, u32 val) -+{ -+ extern struct qmgr_regs __iomem *qmgr_regs; -+ __raw_writel(val, &qmgr_regs->acc[queue][0]); -+} -+ -+static inline u32 qmgr_get_entry(unsigned int queue) -+{ -+ extern struct qmgr_regs __iomem *qmgr_regs; -+ return __raw_readl(&qmgr_regs->acc[queue][0]); -+} -+ -+static inline int qmgr_get_stat1(unsigned int queue) -+{ -+ extern struct qmgr_regs __iomem *qmgr_regs; -+ return (__raw_readl(&qmgr_regs->stat1[queue >> 3]) -+ >> ((queue & 7) << 2)) & 0xF; -+} -+ -+static inline int qmgr_get_stat2(unsigned int queue) -+{ -+ extern struct qmgr_regs __iomem *qmgr_regs; -+ return (__raw_readl(&qmgr_regs->stat2[queue >> 4]) -+ >> ((queue & 0xF) << 1)) & 0x3; -+} -+ -+static inline int qmgr_stat_empty(unsigned int queue) -+{ -+ return !!(qmgr_get_stat1(queue) & QUEUE_STAT1_EMPTY); -+} -+ -+static inline int qmgr_stat_nearly_empty(unsigned int queue) -+{ -+ return !!(qmgr_get_stat1(queue) & QUEUE_STAT1_NEARLY_EMPTY); -+} -+ -+static inline int qmgr_stat_nearly_full(unsigned int queue) -+{ -+ return !!(qmgr_get_stat1(queue) & QUEUE_STAT1_NEARLY_FULL); -+} -+ -+static inline int qmgr_stat_full(unsigned int queue) -+{ -+ return !!(qmgr_get_stat1(queue) & QUEUE_STAT1_FULL); -+} -+ -+static inline int qmgr_stat_underflow(unsigned int queue) -+{ -+ return !!(qmgr_get_stat2(queue) & QUEUE_STAT2_UNDERFLOW); -+} -+ -+static inline int qmgr_stat_overflow(unsigned int queue) -+{ -+ return !!(qmgr_get_stat2(queue) & QUEUE_STAT2_OVERFLOW); -+} -+ -+#endif -Index: linux-2.6.23.17/include/asm-arm/arch-ixp4xx/uncompress.h -=================================================================== ---- linux-2.6.23.17.orig/include/asm-arm/arch-ixp4xx/uncompress.h -+++ linux-2.6.23.17/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> - diff --git a/target/linux/ixp4xx/patches-2.6.23/201-npe_driver_print_license_location.patch b/target/linux/ixp4xx/patches-2.6.23/201-npe_driver_print_license_location.patch deleted file mode 100644 index c986227866..0000000000 --- a/target/linux/ixp4xx/patches-2.6.23/201-npe_driver_print_license_location.patch +++ /dev/null @@ -1,13 +0,0 @@ -Index: linux-2.6.23.17/arch/arm/mach-ixp4xx/ixp4xx_npe.c -=================================================================== ---- linux-2.6.23.17.orig/arch/arm/mach-ixp4xx/ixp4xx_npe.c -+++ linux-2.6.23.17/arch/arm/mach-ixp4xx/ixp4xx_npe.c -@@ -588,6 +588,8 @@ int npe_load_firmware(struct npe *npe, c - npe_reset(npe); - #endif - -+ print_npe(KERN_INFO, npe, "firmware's license can be found in /usr/share/doc/LICENSE.IPL\n"); -+ - print_npe(KERN_INFO, npe, "firmware functionality 0x%X, " - "revision 0x%X:%X\n", (image->id >> 16) & 0xFF, - (image->id >> 8) & 0xFF, image->id & 0xFF); diff --git a/target/linux/ixp4xx/patches-2.6.23/202-npe_driver_no_phy.patch b/target/linux/ixp4xx/patches-2.6.23/202-npe_driver_no_phy.patch deleted file mode 100644 index b3c9ca0246..0000000000 --- a/target/linux/ixp4xx/patches-2.6.23/202-npe_driver_no_phy.patch +++ /dev/null @@ -1,42 +0,0 @@ -Index: linux-2.6.23.17/drivers/net/arm/ixp4xx_eth.c -=================================================================== ---- linux-2.6.23.17.orig/drivers/net/arm/ixp4xx_eth.c -+++ linux-2.6.23.17/drivers/net/arm/ixp4xx_eth.c -@@ -297,6 +297,27 @@ static int mdio_read(struct net_device * - unsigned long flags; - u16 val; - -+ /* For boards that use a switch chip (eg. Marvell 88E6060) */ -+ if ( phy_id < 0 || phy_id > 31 ) { -+ switch (location) { -+ case MII_BMCR: -+ val = 0x3100; -+ break; -+ case MII_BMSR: -+ val = 0x406d; -+ break; -+ case MII_ADVERTISE: -+ val = 0x0101; -+ break; -+ case MII_LPA: -+ val = 0x4101; -+ break; -+ default: -+ val = 0; -+ break; -+ } -+ return val; -+ } - spin_lock_irqsave(&mdio_lock, flags); - val = mdio_cmd(dev, phy_id, location, 0, 0); - spin_unlock_irqrestore(&mdio_lock, flags); -@@ -308,6 +329,9 @@ static void mdio_write(struct net_device - { - unsigned long flags; - -+ if ( phy_id < 0 || phy_id > 31 ) { -+ return; -+ } - spin_lock_irqsave(&mdio_lock, flags); - mdio_cmd(dev, phy_id, location, 1, val); - spin_unlock_irqrestore(&mdio_lock, flags); diff --git a/target/linux/ixp4xx/patches-2.6.23/294-eeprom_new_notifier.patch b/target/linux/ixp4xx/patches-2.6.23/294-eeprom_new_notifier.patch deleted file mode 100644 index f91e7784ff..0000000000 --- a/target/linux/ixp4xx/patches-2.6.23/294-eeprom_new_notifier.patch +++ /dev/null @@ -1,190 +0,0 @@ -Index: linux-2.6.23.17/drivers/i2c/chips/eeprom.c -=================================================================== ---- linux-2.6.23.17.orig/drivers/i2c/chips/eeprom.c -+++ linux-2.6.23.17/drivers/i2c/chips/eeprom.c -@@ -33,6 +33,8 @@ - #include <linux/jiffies.h> - #include <linux/i2c.h> - #include <linux/mutex.h> -+#include <linux/notifier.h> -+#include <linux/eeprom.h> - - /* Addresses to scan */ - static unsigned short normal_i2c[] = { 0x50, 0x51, 0x52, 0x53, 0x54, -@@ -41,26 +43,7 @@ static unsigned short normal_i2c[] = { 0 - /* Insmod parameters */ - I2C_CLIENT_INSMOD_1(eeprom); - -- --/* Size of EEPROM in bytes */ --#define EEPROM_SIZE 256 -- --/* possible types of eeprom devices */ --enum eeprom_nature { -- UNKNOWN, -- VAIO, --}; -- --/* Each client has this additional data */ --struct eeprom_data { -- struct i2c_client client; -- struct mutex update_lock; -- u8 valid; /* bitfield, bit!=0 if slice is valid */ -- unsigned long last_updated[8]; /* In jiffies, 8 slices */ -- u8 data[EEPROM_SIZE]; /* Register values */ -- enum eeprom_nature nature; --}; -- -+ATOMIC_NOTIFIER_HEAD(eeprom_chain); - - static int eeprom_attach_adapter(struct i2c_adapter *adapter); - static int eeprom_detect(struct i2c_adapter *adapter, int address, int kind); -@@ -198,6 +181,7 @@ static int eeprom_detect(struct i2c_adap - data->valid = 0; - mutex_init(&data->update_lock); - data->nature = UNKNOWN; -+ data->attr = &eeprom_attr; - - /* Tell the I2C layer a new client has arrived */ - if ((err = i2c_attach_client(new_client))) -@@ -225,6 +209,9 @@ static int eeprom_detect(struct i2c_adap - if (err) - goto exit_detach; - -+ /* call the notifier chain */ -+ atomic_notifier_call_chain(&eeprom_chain, EEPROM_REGISTER, data); -+ - return 0; - - exit_detach: -@@ -250,6 +237,41 @@ static int eeprom_detach_client(struct i - return 0; - } - -+/** -+ * register_eeprom_notifier - register a 'user' of EEPROM devices. -+ * @nb: pointer to notifier info structure -+ * -+ * Registers a callback function to be called upon detection -+ * of an EEPROM device. Detection invokes the 'add' callback -+ * with the kobj of the mutex and a bin_attribute which allows -+ * read from the EEPROM. The intention is that the notifier -+ * will be able to read system configuration from the notifier. -+ * -+ * Only EEPROMs detected *after* the addition of the notifier -+ * are notified. I.e. EEPROMs already known to the system -+ * will not be notified - add the notifier from board level -+ * code! -+ */ -+int register_eeprom_notifier(struct notifier_block *nb) -+{ -+ return atomic_notifier_chain_register(&eeprom_chain, nb); -+} -+ -+/** -+ * unregister_eeprom_notifier - unregister a 'user' of EEPROM devices. -+ * @old: pointer to notifier info structure -+ * -+ * Removes a callback function from the list of 'users' to be -+ * notified upon detection of EEPROM devices. -+ */ -+int unregister_eeprom_notifier(struct notifier_block *nb) -+{ -+ return atomic_notifier_chain_unregister(&eeprom_chain, nb); -+} -+ -+EXPORT_SYMBOL_GPL(register_eeprom_notifier); -+EXPORT_SYMBOL_GPL(unregister_eeprom_notifier); -+ - static int __init eeprom_init(void) - { - return i2c_add_driver(&eeprom_driver); -Index: linux-2.6.23.17/include/linux/eeprom.h -=================================================================== ---- /dev/null -+++ linux-2.6.23.17/include/linux/eeprom.h -@@ -0,0 +1,71 @@ -+#ifndef _LINUX_EEPROM_H -+#define _LINUX_EEPROM_H -+/* -+ * EEPROM notifier header -+ * -+ * Copyright (C) 2006 John Bowler -+ */ -+ -+/* -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+ */ -+ -+#ifndef __KERNEL__ -+#error This is a kernel header -+#endif -+ -+#include <linux/list.h> -+#include <linux/kobject.h> -+#include <linux/sysfs.h> -+ -+/* Size of EEPROM in bytes */ -+#define EEPROM_SIZE 256 -+ -+/* possible types of eeprom devices */ -+enum eeprom_nature { -+ UNKNOWN, -+ VAIO, -+}; -+ -+/* Each client has this additional data */ -+struct eeprom_data { -+ struct i2c_client client; -+ struct mutex update_lock; -+ u8 valid; /* bitfield, bit!=0 if slice is valid */ -+ unsigned long last_updated[8]; /* In jiffies, 8 slices */ -+ u8 data[EEPROM_SIZE]; /* Register values */ -+ enum eeprom_nature nature; -+ struct bin_attribute *attr; -+}; -+ -+/* -+ * This is very basic. -+ * -+ * If an EEPROM is detected on the I2C bus (this only works for -+ * I2C EEPROMs) the notifier chain is called with -+ * both the I2C information and the kobject for the sysfs -+ * device which has been registers. It is then possible to -+ * read from the device via the bin_attribute::read method -+ * to extract configuration information. -+ * -+ * Register the notifier in the board level code, there is no -+ * need to unregister it but you can if you want (it will save -+ * a little bit or kernel memory to do so). -+ */ -+ -+extern int register_eeprom_notifier(struct notifier_block *nb); -+extern int unregister_eeprom_notifier(struct notifier_block *nb); -+ -+#endif /* _LINUX_EEPROM_H */ -Index: linux-2.6.23.17/include/linux/notifier.h -=================================================================== ---- linux-2.6.23.17.orig/include/linux/notifier.h -+++ linux-2.6.23.17/include/linux/notifier.h -@@ -231,5 +231,8 @@ static inline int notifier_to_errno(int - #define PM_SUSPEND_PREPARE 0x0003 /* Going to suspend the system */ - #define PM_POST_SUSPEND 0x0004 /* Suspend finished */ - -+/* eeprom notifier chain */ -+#define EEPROM_REGISTER 0x0001 -+ - #endif /* __KERNEL__ */ - #endif /* _LINUX_NOTIFIER_H */ diff --git a/target/linux/ixp4xx/patches-2.6.23/296-avila_mac_plat_info.patch b/target/linux/ixp4xx/patches-2.6.23/296-avila_mac_plat_info.patch deleted file mode 100644 index dfaf7ffa3d..0000000000 --- a/target/linux/ixp4xx/patches-2.6.23/296-avila_mac_plat_info.patch +++ /dev/null @@ -1,43 +0,0 @@ -Index: linux-2.6.23.17/arch/arm/mach-ixp4xx/avila-setup.c -=================================================================== ---- linux-2.6.23.17.orig/arch/arm/mach-ixp4xx/avila-setup.c -+++ linux-2.6.23.17/arch/arm/mach-ixp4xx/avila-setup.c -@@ -132,10 +132,37 @@ static struct platform_device avila_pata - .resource = avila_pata_resources, - }; - -+/* Built-in 10/100 Ethernet MAC interfaces */ -+static struct eth_plat_info avila_plat_eth[] = { -+ { -+ .phy = 0, -+ .rxq = 3, -+ .txreadyq = 20, -+ }, { -+ .phy = 1, -+ .rxq = 4, -+ .txreadyq = 21, -+ } -+}; -+ -+static struct platform_device avila_eth[] = { -+ { -+ .name = "ixp4xx_eth", -+ .id = IXP4XX_ETH_NPEB, -+ .dev.platform_data = avila_plat_eth, -+ }, { -+ .name = "ixp4xx_eth", -+ .id = IXP4XX_ETH_NPEC, -+ .dev.platform_data = avila_plat_eth + 1, -+ } -+}; -+ - static struct platform_device *avila_devices[] __initdata = { - &avila_i2c_gpio, - &avila_flash, -- &avila_uart -+ &avila_uart, -+ &avila_eth[0], -+ &avila_eth[1], - }; - - static void __init avila_init(void) diff --git a/target/linux/ixp4xx/patches-2.6.23/298-avila_rtc_fixup.patch b/target/linux/ixp4xx/patches-2.6.23/298-avila_rtc_fixup.patch deleted file mode 100644 index 4bee2044fb..0000000000 --- a/target/linux/ixp4xx/patches-2.6.23/298-avila_rtc_fixup.patch +++ /dev/null @@ -1,56 +0,0 @@ -Index: linux-2.6.23.17/arch/arm/mach-ixp4xx/avila-setup.c -=================================================================== ---- linux-2.6.23.17.orig/arch/arm/mach-ixp4xx/avila-setup.c -+++ linux-2.6.23.17/arch/arm/mach-ixp4xx/avila-setup.c -@@ -165,6 +165,35 @@ static struct platform_device *avila_dev - &avila_eth[1], - }; - -+static char avila_rtc_probe[] __initdata = "rtc-ds1672.probe=0,0x68 "; -+ -+static void __init avila_fixup(struct machine_desc *desc, -+ struct tag *tags, char **cmdline, struct meminfo *mi) -+{ -+ struct tag *t = tags; -+ char *p = *cmdline; -+ -+ /* Find the end of the tags table, taking note of any cmdline tag. */ -+ for (; t->hdr.size; t = tag_next(t)) { -+ if (t->hdr.tag == ATAG_CMDLINE) { -+ p = t->u.cmdline.cmdline; -+ } -+ } -+ -+ /* Overwrite the end of the table with a new cmdline tag. */ -+ t->hdr.tag = ATAG_CMDLINE; -+ t->hdr.size = (sizeof (struct tag_header) + -+ strlen(avila_rtc_probe) + strlen(p) + 1 + 4) >> 2; -+ strlcpy(t->u.cmdline.cmdline, avila_rtc_probe, COMMAND_LINE_SIZE); -+ strlcpy(t->u.cmdline.cmdline + strlen(avila_rtc_probe), p, -+ COMMAND_LINE_SIZE - strlen(avila_rtc_probe)); -+ -+ /* Terminate the table. */ -+ t = tag_next(t); -+ t->hdr.tag = ATAG_NONE; -+ t->hdr.size = 0; -+} -+ - static void __init avila_init(void) - { - ixp4xx_sys_init(); -@@ -192,6 +221,7 @@ MACHINE_START(AVILA, "Gateworks Avila Ne - /* Maintainer: Deepak Saxena <dsaxena@plexity.net> */ - .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, - .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, -+ .fixup = avila_fixup, - .map_io = ixp4xx_map_io, - .init_irq = ixp4xx_init_irq, - .timer = &ixp4xx_timer, -@@ -209,6 +239,7 @@ MACHINE_START(LOFT, "Giant Shoulder Inc - /* Maintainer: Tom Billman <kernel@giantshoulderinc.com> */ - .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, - .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, -+ .fixup = avila_fixup, - .map_io = ixp4xx_map_io, - .init_irq = ixp4xx_init_irq, - .timer = &ixp4xx_timer, diff --git a/target/linux/ixp4xx/patches-2.6.23/300-avila_fetch_mac.patch b/target/linux/ixp4xx/patches-2.6.23/300-avila_fetch_mac.patch deleted file mode 100644 index 7303399e56..0000000000 --- a/target/linux/ixp4xx/patches-2.6.23/300-avila_fetch_mac.patch +++ /dev/null @@ -1,72 +0,0 @@ -Index: linux-2.6.23.17/arch/arm/mach-ixp4xx/avila-setup.c -=================================================================== ---- linux-2.6.23.17.orig/arch/arm/mach-ixp4xx/avila-setup.c -+++ linux-2.6.23.17/arch/arm/mach-ixp4xx/avila-setup.c -@@ -14,10 +14,18 @@ - #include <linux/kernel.h> - #include <linux/init.h> - #include <linux/device.h> -+#include <linux/if_ether.h> -+#include <linux/socket.h> -+#include <linux/netdevice.h> - #include <linux/serial.h> - #include <linux/tty.h> - #include <linux/serial_8250.h> - #include <linux/slab.h> -+#ifdef CONFIG_SENSORS_EEPROM -+# include <linux/i2c.h> -+# include <linux/eeprom.h> -+#endif -+ - #include <linux/i2c-gpio.h> - - #include <asm/types.h> -@@ -194,9 +202,48 @@ static void __init avila_fixup(struct ma - t->hdr.size = 0; - } - -+#ifdef CONFIG_SENSORS_EEPROM -+static int loft_eeprom_do(struct notifier_block *self, unsigned long event, void *t) -+{ -+ struct eeprom_data *data = t; -+ struct sockaddr address; -+ struct net_device * netdev ; -+ -+ char macs[12]; -+ -+ /* The MACs are the first 12 bytes in the eeprom at address 0x51 */ -+ if (event == EEPROM_REGISTER && data->client.addr == 0x51) { -+ data->attr->read(&data->client.dev.kobj, data->attr, macs, 0, 12); -+ /*eth0*/ -+ /* using dev_get_by_name here is really ugly and can cause -+ * confusion if other ethernet devices are present. FIXME */ -+ -+ memcpy(address.sa_data, macs, ETH_ALEN); -+ memcpy(&avila_plat_eth[0].hwaddr, macs, ETH_ALEN); -+ if ( (netdev = dev_get_by_name("eth0")) ) -+ netdev->set_mac_address(netdev, &address); -+ -+ /*same for eth1*/ -+ memcpy(address.sa_data, macs + ETH_ALEN, ETH_ALEN); -+ memcpy(&avila_plat_eth[1].hwaddr, macs + ETH_ALEN, ETH_ALEN); -+ if ( (netdev = dev_get_by_name("eth1")) ) -+ netdev->set_mac_address(netdev, &address); -+ } -+ -+ return NOTIFY_DONE; -+} -+ -+static struct notifier_block loft_eeprom_notifier = { -+ .notifier_call = loft_eeprom_do -+}; -+#endif -+ - static void __init avila_init(void) - { - ixp4xx_sys_init(); -+#ifdef CONFIG_SENSORS_EEPROM -+ register_eeprom_notifier(&loft_eeprom_notifier); -+#endif - - avila_flash_resource.start = IXP4XX_EXP_BUS_BASE(0); - avila_flash_resource.end = diff --git a/target/linux/ixp4xx/patches-2.6.23/301-avila_led.patch b/target/linux/ixp4xx/patches-2.6.23/301-avila_led.patch deleted file mode 100644 index f4b56a0ea9..0000000000 --- a/target/linux/ixp4xx/patches-2.6.23/301-avila_led.patch +++ /dev/null @@ -1,50 +0,0 @@ -Index: linux-2.6.23.17/arch/arm/mach-ixp4xx/avila-setup.c -=================================================================== ---- linux-2.6.23.17.orig/arch/arm/mach-ixp4xx/avila-setup.c -+++ linux-2.6.23.17/arch/arm/mach-ixp4xx/avila-setup.c -@@ -165,12 +165,34 @@ static struct platform_device avila_eth[ - } - }; - -+#ifdef CONFIG_LEDS_IXP4XX -+static struct resource avila_led_resources[] = { -+ { -+ .name = "user", -+ .start = AVILA_LED_USER_GPIO, -+ .end = AVILA_LED_USER_GPIO, -+ .flags = IXP4XX_GPIO_LOW, -+ }, -+}; -+ -+static struct platform_device avila_leds = { -+ .name = "IXP4XX-GPIO-LED", -+ .id = -1, -+ .num_resources = ARRAY_SIZE(avila_led_resources), -+ .resource = avila_led_resources, -+}; -+#endif -+ -+ - static struct platform_device *avila_devices[] __initdata = { - &avila_i2c_gpio, - &avila_flash, - &avila_uart, - &avila_eth[0], - &avila_eth[1], -+#ifdef CONFIG_LEDS_IXP4XX -+ &avila_leds, -+#endif - }; - - static char avila_rtc_probe[] __initdata = "rtc-ds1672.probe=0,0x68 "; -Index: linux-2.6.23.17/include/asm-arm/arch-ixp4xx/avila.h -=================================================================== ---- linux-2.6.23.17.orig/include/asm-arm/arch-ixp4xx/avila.h -+++ linux-2.6.23.17/include/asm-arm/arch-ixp4xx/avila.h -@@ -36,4 +36,5 @@ - #define AVILA_PCI_INTC_PIN 9 - #define AVILA_PCI_INTD_PIN 8 - -- -+/* User LED */ -+#define AVILA_LED_USER_GPIO 3 diff --git a/target/linux/ixp4xx/patches-2.6.23/302-gpio_device.patch b/target/linux/ixp4xx/patches-2.6.23/302-gpio_device.patch deleted file mode 100644 index a1f0ee45b8..0000000000 --- a/target/linux/ixp4xx/patches-2.6.23/302-gpio_device.patch +++ /dev/null @@ -1,49 +0,0 @@ -Index: linux-2.6.23.17/arch/arm/mach-ixp4xx/avila-setup.c -=================================================================== ---- linux-2.6.23.17.orig/arch/arm/mach-ixp4xx/avila-setup.c -+++ linux-2.6.23.17/arch/arm/mach-ixp4xx/avila-setup.c -@@ -183,6 +183,23 @@ static struct platform_device avila_leds - }; - #endif - -+#ifdef CONFIG_GPIO_DEVICE -+static struct resource avila_gpio_resources[] = { -+ { -+ .name = "gpio", -+ .start = AVILA_GPIO_MASK, -+ .end = AVILA_GPIO_MASK, -+ .flags = 0, -+ }, -+}; -+ -+static struct platform_device avila_gpio = { -+ .name = "GPIODEV", -+ .id = -1, -+ .num_resources = ARRAY_SIZE(avila_gpio_resources), -+ .resource = avila_gpio_resources, -+}; -+#endif - - static struct platform_device *avila_devices[] __initdata = { - &avila_i2c_gpio, -@@ -193,6 +210,9 @@ static struct platform_device *avila_dev - #ifdef CONFIG_LEDS_IXP4XX - &avila_leds, - #endif -+#ifdef CONFIG_GPIO_DEVICE -+ &avila_gpio, -+#endif - }; - - static char avila_rtc_probe[] __initdata = "rtc-ds1672.probe=0,0x68 "; -Index: linux-2.6.23.17/include/asm-arm/arch-ixp4xx/avila.h -=================================================================== ---- linux-2.6.23.17.orig/include/asm-arm/arch-ixp4xx/avila.h -+++ linux-2.6.23.17/include/asm-arm/arch-ixp4xx/avila.h -@@ -38,3 +38,6 @@ - - /* User LED */ - #define AVILA_LED_USER_GPIO 3 -+ -+/* gpio mask used by platform device */ -+#define AVILA_GPIO_MASK (1 << 1) | (1 << 3) | (1 << 5) | (1 << 7) | (1 << 9) diff --git a/target/linux/ixp4xx/patches-2.6.23/400-dmabounce.patch b/target/linux/ixp4xx/patches-2.6.23/400-dmabounce.patch deleted file mode 100644 index cd7b05856a..0000000000 --- a/target/linux/ixp4xx/patches-2.6.23/400-dmabounce.patch +++ /dev/null @@ -1,31 +0,0 @@ -Index: linux-2.6.23.17/arch/arm/common/dmabounce.c -=================================================================== ---- linux-2.6.23.17.orig/arch/arm/common/dmabounce.c -+++ linux-2.6.23.17/arch/arm/common/dmabounce.c -@@ -116,6 +116,10 @@ alloc_safe_buffer(struct dmabounce_devic - } else if (size <= device_info->large.size) { - pool = &device_info->large; - } else { -+#ifdef CONFIG_DMABOUNCE_DEBUG -+ printk(KERN_INFO "A dma bounce buffer outside the pool size was requested. Requested size was 0x%08X\nThe calling code was :\n", size); -+ dump_stack(); -+#endif - pool = NULL; - } - -Index: linux-2.6.23.17/arch/arm/mach-ixp4xx/Kconfig -=================================================================== ---- linux-2.6.23.17.orig/arch/arm/mach-ixp4xx/Kconfig -+++ linux-2.6.23.17/arch/arm/mach-ixp4xx/Kconfig -@@ -220,6 +220,11 @@ config DMABOUNCE - default y - depends on PCI - -+config DMABOUNCE_DEBUG -+ bool "Enable DMABounce debuging" -+ default n -+ depends on DMABOUNCE -+ - config IXP4XX_INDIRECT_PCI - bool "Use indirect PCI memory access" - depends on PCI diff --git a/target/linux/ixp4xx/patches-2.6.23/401-avila_pci_dev.patch b/target/linux/ixp4xx/patches-2.6.23/401-avila_pci_dev.patch deleted file mode 100644 index 8971bb2099..0000000000 --- a/target/linux/ixp4xx/patches-2.6.23/401-avila_pci_dev.patch +++ /dev/null @@ -1,13 +0,0 @@ -Index: linux-2.6.23.17/include/asm-arm/arch-ixp4xx/avila.h -=================================================================== ---- linux-2.6.23.17.orig/include/asm-arm/arch-ixp4xx/avila.h -+++ linux-2.6.23.17/include/asm-arm/arch-ixp4xx/avila.h -@@ -25,7 +25,7 @@ - /* - * AVILA PCI IRQs - */ --#define AVILA_PCI_MAX_DEV 4 -+#define AVILA_PCI_MAX_DEV 6 - #define LOFT_PCI_MAX_DEV 6 - #define AVILA_PCI_IRQ_LINES 4 - diff --git a/target/linux/ixp4xx/patches-2.6.24/010-rtc_new_style.patch b/target/linux/ixp4xx/patches-2.6.24/010-rtc_new_style.patch deleted file mode 100644 index 2293b8b02f..0000000000 --- a/target/linux/ixp4xx/patches-2.6.24/010-rtc_new_style.patch +++ /dev/null @@ -1,1032 +0,0 @@ ---- - drivers/rtc/rtc-isl1208.c | 357 +++++++++++++++++++++------------------------- - 1 file changed, 170 insertions(+), 187 deletions(-) - -Index: linux-2.6.24.7/drivers/rtc/rtc-isl1208.c -=================================================================== ---- linux-2.6.24.7.orig/drivers/rtc/rtc-isl1208.c -+++ linux-2.6.24.7/drivers/rtc/rtc-isl1208.c -@@ -15,16 +15,15 @@ - #include <linux/bcd.h> - #include <linux/rtc.h> - --#define DRV_NAME "isl1208" --#define DRV_VERSION "0.2" -+#define DRV_VERSION "0.3" - - /* Register map */ - /* rtc section */ - #define ISL1208_REG_SC 0x00 - #define ISL1208_REG_MN 0x01 - #define ISL1208_REG_HR 0x02 --#define ISL1208_REG_HR_MIL (1<<7) /* 24h/12h mode */ --#define ISL1208_REG_HR_PM (1<<5) /* PM/AM bit in 12h mode */ -+#define ISL1208_REG_HR_MIL (1<<7) /* 24h/12h mode */ -+#define ISL1208_REG_HR_PM (1<<5) /* PM/AM bit in 12h mode */ - #define ISL1208_REG_DT 0x03 - #define ISL1208_REG_MO 0x04 - #define ISL1208_REG_YR 0x05 -@@ -33,14 +32,14 @@ - - /* control/status section */ - #define ISL1208_REG_SR 0x07 --#define ISL1208_REG_SR_ARST (1<<7) /* auto reset */ --#define ISL1208_REG_SR_XTOSCB (1<<6) /* crystal oscillator */ --#define ISL1208_REG_SR_WRTC (1<<4) /* write rtc */ --#define ISL1208_REG_SR_ALM (1<<2) /* alarm */ --#define ISL1208_REG_SR_BAT (1<<1) /* battery */ --#define ISL1208_REG_SR_RTCF (1<<0) /* rtc fail */ -+#define ISL1208_REG_SR_ARST (1<<7) /* auto reset */ -+#define ISL1208_REG_SR_XTOSCB (1<<6) /* crystal oscillator */ -+#define ISL1208_REG_SR_WRTC (1<<4) /* write rtc */ -+#define ISL1208_REG_SR_ALM (1<<2) /* alarm */ -+#define ISL1208_REG_SR_BAT (1<<1) /* battery */ -+#define ISL1208_REG_SR_RTCF (1<<0) /* rtc fail */ - #define ISL1208_REG_INT 0x08 --#define ISL1208_REG_09 0x09 /* reserved */ -+#define ISL1208_REG_09 0x09 /* reserved */ - #define ISL1208_REG_ATR 0x0a - #define ISL1208_REG_DTR 0x0b - -@@ -58,35 +57,18 @@ - #define ISL1208_REG_USR2 0x13 - #define ISL1208_USR_SECTION_LEN 2 - --/* i2c configuration */ --#define ISL1208_I2C_ADDR 0xde -- --static unsigned short normal_i2c[] = { -- ISL1208_I2C_ADDR>>1, I2C_CLIENT_END --}; --I2C_CLIENT_INSMOD; /* defines addr_data */ -- --static int isl1208_attach_adapter(struct i2c_adapter *adapter); --static int isl1208_detach_client(struct i2c_client *client); -- --static struct i2c_driver isl1208_driver = { -- .driver = { -- .name = DRV_NAME, -- }, -- .id = I2C_DRIVERID_ISL1208, -- .attach_adapter = &isl1208_attach_adapter, -- .detach_client = &isl1208_detach_client, --}; -+static struct i2c_driver isl1208_driver; - - /* block read */ - static int - isl1208_i2c_read_regs(struct i2c_client *client, u8 reg, u8 buf[], -- unsigned len) -+ unsigned len) - { - u8 reg_addr[1] = { reg }; - struct i2c_msg msgs[2] = { -- { client->addr, client->flags, sizeof(reg_addr), reg_addr }, -- { client->addr, client->flags | I2C_M_RD, len, buf } -+ {client->addr, client->flags, sizeof(reg_addr), reg_addr} -+ , -+ {client->addr, client->flags | I2C_M_RD, len, buf} - }; - int ret; - -@@ -103,15 +85,14 @@ isl1208_i2c_read_regs(struct i2c_client - /* block write */ - static int - isl1208_i2c_set_regs(struct i2c_client *client, u8 reg, u8 const buf[], -- unsigned len) -+ unsigned len) - { - u8 i2c_buf[ISL1208_REG_USR2 + 2]; - struct i2c_msg msgs[1] = { -- { client->addr, client->flags, len + 1, i2c_buf } -+ {client->addr, client->flags, len + 1, i2c_buf} - }; - int ret; - -- BUG_ON(len == 0); - BUG_ON(reg > ISL1208_REG_USR2); - BUG_ON(reg + len > ISL1208_REG_USR2 + 1); - -@@ -125,7 +106,8 @@ isl1208_i2c_set_regs(struct i2c_client * - } - - /* simple check to see wether we have a isl1208 */ --static int isl1208_i2c_validate_client(struct i2c_client *client) -+static int -+isl1208_i2c_validate_client(struct i2c_client *client) - { - u8 regs[ISL1208_RTC_SECTION_LEN] = { 0, }; - u8 zero_mask[ISL1208_RTC_SECTION_LEN] = { -@@ -139,24 +121,29 @@ static int isl1208_i2c_validate_client(s - return ret; - - for (i = 0; i < ISL1208_RTC_SECTION_LEN; ++i) { -- if (regs[i] & zero_mask[i]) /* check if bits are cleared */ -+ if (regs[i] & zero_mask[i]) /* check if bits are cleared */ - return -ENODEV; - } - - return 0; - } - --static int isl1208_i2c_get_sr(struct i2c_client *client) -+static int -+isl1208_i2c_get_sr(struct i2c_client *client) - { -- return i2c_smbus_read_byte_data(client, ISL1208_REG_SR) == -1 ? -EIO:0; -+ int sr = i2c_smbus_read_byte_data(client, ISL1208_REG_SR); -+ if (sr < 0) -+ return -EIO; -+ -+ return sr; - } - --static int isl1208_i2c_get_atr(struct i2c_client *client) -+static int -+isl1208_i2c_get_atr(struct i2c_client *client) - { - int atr = i2c_smbus_read_byte_data(client, ISL1208_REG_ATR); -- - if (atr < 0) -- return -EIO; -+ return atr; - - /* The 6bit value in the ATR register controls the load - * capacitance C_load * in steps of 0.25pF -@@ -169,51 +156,54 @@ static int isl1208_i2c_get_atr(struct i2 - * - */ - -- atr &= 0x3f; /* mask out lsb */ -- atr ^= 1<<5; /* invert 6th bit */ -- atr += 2*9; /* add offset of 4.5pF; unit[atr] = 0.25pF */ -+ atr &= 0x3f; /* mask out lsb */ -+ atr ^= 1 << 5; /* invert 6th bit */ -+ atr += 2 * 9; /* add offset of 4.5pF; unit[atr] = 0.25pF */ - - return atr; - } - --static int isl1208_i2c_get_dtr(struct i2c_client *client) -+static int -+isl1208_i2c_get_dtr(struct i2c_client *client) - { - int dtr = i2c_smbus_read_byte_data(client, ISL1208_REG_DTR); -- - if (dtr < 0) - return -EIO; - - /* dtr encodes adjustments of {-60,-40,-20,0,20,40,60} ppm */ -- dtr = ((dtr & 0x3) * 20) * (dtr & (1<<2) ? -1 : 1); -+ dtr = ((dtr & 0x3) * 20) * (dtr & (1 << 2) ? -1 : 1); - - return dtr; - } - --static int isl1208_i2c_get_usr(struct i2c_client *client) -+static int -+isl1208_i2c_get_usr(struct i2c_client *client) - { - u8 buf[ISL1208_USR_SECTION_LEN] = { 0, }; - int ret; - -- ret = isl1208_i2c_read_regs (client, ISL1208_REG_USR1, buf, -- ISL1208_USR_SECTION_LEN); -+ ret = isl1208_i2c_read_regs(client, ISL1208_REG_USR1, buf, -+ ISL1208_USR_SECTION_LEN); - if (ret < 0) - return ret; - - return (buf[1] << 8) | buf[0]; - } - --static int isl1208_i2c_set_usr(struct i2c_client *client, u16 usr) -+static int -+isl1208_i2c_set_usr(struct i2c_client *client, u16 usr) - { - u8 buf[ISL1208_USR_SECTION_LEN]; - - buf[0] = usr & 0xff; - buf[1] = (usr >> 8) & 0xff; - -- return isl1208_i2c_set_regs (client, ISL1208_REG_USR1, buf, -- ISL1208_USR_SECTION_LEN); -+ return isl1208_i2c_set_regs(client, ISL1208_REG_USR1, buf, -+ ISL1208_USR_SECTION_LEN); - } - --static int isl1208_rtc_proc(struct device *dev, struct seq_file *seq) -+static int -+isl1208_rtc_proc(struct device *dev, struct seq_file *seq) - { - struct i2c_client *const client = to_i2c_client(dev); - int sr, dtr, atr, usr; -@@ -230,20 +220,19 @@ static int isl1208_rtc_proc(struct devic - (sr & ISL1208_REG_SR_ALM) ? " ALM" : "", - (sr & ISL1208_REG_SR_WRTC) ? " WRTC" : "", - (sr & ISL1208_REG_SR_XTOSCB) ? " XTOSCB" : "", -- (sr & ISL1208_REG_SR_ARST) ? " ARST" : "", -- sr); -+ (sr & ISL1208_REG_SR_ARST) ? " ARST" : "", sr); - - seq_printf(seq, "batt_status\t: %s\n", - (sr & ISL1208_REG_SR_RTCF) ? "bad" : "okay"); - - dtr = isl1208_i2c_get_dtr(client); -- if (dtr >= 0 -1) -+ if (dtr >= 0 - 1) - seq_printf(seq, "digital_trim\t: %d ppm\n", dtr); - - atr = isl1208_i2c_get_atr(client); - if (atr >= 0) - seq_printf(seq, "analog_trim\t: %d.%.2d pF\n", -- atr>>2, (atr&0x3)*25); -+ atr >> 2, (atr & 0x3) * 25); - - usr = isl1208_i2c_get_usr(client); - if (usr >= 0) -@@ -252,9 +241,8 @@ static int isl1208_rtc_proc(struct devic - return 0; - } - -- --static int isl1208_i2c_read_time(struct i2c_client *client, -- struct rtc_time *tm) -+static int -+isl1208_i2c_read_time(struct i2c_client *client, struct rtc_time *tm) - { - int sr; - u8 regs[ISL1208_RTC_SECTION_LEN] = { 0, }; -@@ -274,27 +262,30 @@ static int isl1208_i2c_read_time(struct - - tm->tm_sec = BCD2BIN(regs[ISL1208_REG_SC]); - tm->tm_min = BCD2BIN(regs[ISL1208_REG_MN]); -- { /* HR field has a more complex interpretation */ -+ -+ /* HR field has a more complex interpretation */ -+ { - const u8 _hr = regs[ISL1208_REG_HR]; -- if (_hr & ISL1208_REG_HR_MIL) /* 24h format */ -+ if (_hr & ISL1208_REG_HR_MIL) /* 24h format */ - tm->tm_hour = BCD2BIN(_hr & 0x3f); -- else { // 12h format -+ else { -+ /* 12h format */ - tm->tm_hour = BCD2BIN(_hr & 0x1f); -- if (_hr & ISL1208_REG_HR_PM) /* PM flag set */ -+ if (_hr & ISL1208_REG_HR_PM) /* PM flag set */ - tm->tm_hour += 12; - } - } - - tm->tm_mday = BCD2BIN(regs[ISL1208_REG_DT]); -- tm->tm_mon = BCD2BIN(regs[ISL1208_REG_MO]) - 1; /* rtc starts at 1 */ -+ tm->tm_mon = BCD2BIN(regs[ISL1208_REG_MO]) - 1; /* rtc starts at 1 */ - tm->tm_year = BCD2BIN(regs[ISL1208_REG_YR]) + 100; - tm->tm_wday = BCD2BIN(regs[ISL1208_REG_DW]); - - return 0; - } - --static int isl1208_i2c_read_alarm(struct i2c_client *client, -- struct rtc_wkalrm *alarm) -+static int -+isl1208_i2c_read_alarm(struct i2c_client *client, struct rtc_wkalrm *alarm) - { - struct rtc_time *const tm = &alarm->time; - u8 regs[ISL1208_ALARM_SECTION_LEN] = { 0, }; -@@ -307,7 +298,7 @@ static int isl1208_i2c_read_alarm(struct - } - - sr = isl1208_i2c_read_regs(client, ISL1208_REG_SCA, regs, -- ISL1208_ALARM_SECTION_LEN); -+ ISL1208_ALARM_SECTION_LEN); - if (sr < 0) { - dev_err(&client->dev, "%s: reading alarm section failed\n", - __func__); -@@ -315,23 +306,25 @@ static int isl1208_i2c_read_alarm(struct - } - - /* MSB of each alarm register is an enable bit */ -- tm->tm_sec = BCD2BIN(regs[ISL1208_REG_SCA-ISL1208_REG_SCA] & 0x7f); -- tm->tm_min = BCD2BIN(regs[ISL1208_REG_MNA-ISL1208_REG_SCA] & 0x7f); -- tm->tm_hour = BCD2BIN(regs[ISL1208_REG_HRA-ISL1208_REG_SCA] & 0x3f); -- tm->tm_mday = BCD2BIN(regs[ISL1208_REG_DTA-ISL1208_REG_SCA] & 0x3f); -- tm->tm_mon = BCD2BIN(regs[ISL1208_REG_MOA-ISL1208_REG_SCA] & 0x1f)-1; -- tm->tm_wday = BCD2BIN(regs[ISL1208_REG_DWA-ISL1208_REG_SCA] & 0x03); -+ tm->tm_sec = BCD2BIN(regs[ISL1208_REG_SCA - ISL1208_REG_SCA] & 0x7f); -+ tm->tm_min = BCD2BIN(regs[ISL1208_REG_MNA - ISL1208_REG_SCA] & 0x7f); -+ tm->tm_hour = BCD2BIN(regs[ISL1208_REG_HRA - ISL1208_REG_SCA] & 0x3f); -+ tm->tm_mday = BCD2BIN(regs[ISL1208_REG_DTA - ISL1208_REG_SCA] & 0x3f); -+ tm->tm_mon = -+ BCD2BIN(regs[ISL1208_REG_MOA - ISL1208_REG_SCA] & 0x1f) - 1; -+ tm->tm_wday = BCD2BIN(regs[ISL1208_REG_DWA - ISL1208_REG_SCA] & 0x03); - - return 0; - } - --static int isl1208_rtc_read_time(struct device *dev, struct rtc_time *tm) -+static int -+isl1208_rtc_read_time(struct device *dev, struct rtc_time *tm) - { - return isl1208_i2c_read_time(to_i2c_client(dev), tm); - } - --static int isl1208_i2c_set_time(struct i2c_client *client, -- struct rtc_time const *tm) -+static int -+isl1208_i2c_set_time(struct i2c_client *client, struct rtc_time const *tm) - { - int sr; - u8 regs[ISL1208_RTC_SECTION_LEN] = { 0, }; -@@ -353,7 +346,7 @@ static int isl1208_i2c_set_time(struct i - } - - /* set WRTC */ -- sr = i2c_smbus_write_byte_data (client, ISL1208_REG_SR, -+ sr = i2c_smbus_write_byte_data(client, ISL1208_REG_SR, - sr | ISL1208_REG_SR_WRTC); - if (sr < 0) { - dev_err(&client->dev, "%s: writing SR failed\n", __func__); -@@ -369,7 +362,7 @@ static int isl1208_i2c_set_time(struct i - } - - /* clear WRTC again */ -- sr = i2c_smbus_write_byte_data (client, ISL1208_REG_SR, -+ sr = i2c_smbus_write_byte_data(client, ISL1208_REG_SR, - sr & ~ISL1208_REG_SR_WRTC); - if (sr < 0) { - dev_err(&client->dev, "%s: writing SR failed\n", __func__); -@@ -380,70 +373,69 @@ static int isl1208_i2c_set_time(struct i - } - - --static int isl1208_rtc_set_time(struct device *dev, struct rtc_time *tm) -+static int -+isl1208_rtc_set_time(struct device *dev, struct rtc_time *tm) - { - return isl1208_i2c_set_time(to_i2c_client(dev), tm); - } - --static int isl1208_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alarm) -+static int -+isl1208_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alarm) - { - return isl1208_i2c_read_alarm(to_i2c_client(dev), alarm); - } - - static const struct rtc_class_ops isl1208_rtc_ops = { -- .proc = isl1208_rtc_proc, -- .read_time = isl1208_rtc_read_time, -- .set_time = isl1208_rtc_set_time, -- .read_alarm = isl1208_rtc_read_alarm, -- //.set_alarm = isl1208_rtc_set_alarm, -+ .proc = isl1208_rtc_proc, -+ .read_time = isl1208_rtc_read_time, -+ .set_time = isl1208_rtc_set_time, -+ .read_alarm = isl1208_rtc_read_alarm, -+ /*.set_alarm = isl1208_rtc_set_alarm, */ - }; - - /* sysfs interface */ - --static ssize_t isl1208_sysfs_show_atrim(struct device *dev, -- struct device_attribute *attr, -- char *buf) -+static ssize_t -+isl1208_sysfs_show_atrim(struct device *dev, -+ struct device_attribute *attr, char *buf) - { -- int atr; -- -- atr = isl1208_i2c_get_atr(to_i2c_client(dev)); -+ int atr = isl1208_i2c_get_atr(to_i2c_client(dev)); - if (atr < 0) - return atr; - -- return sprintf(buf, "%d.%.2d pF\n", atr>>2, (atr&0x3)*25); -+ return sprintf(buf, "%d.%.2d pF\n", atr >> 2, (atr & 0x3) * 25); - } -+ - static DEVICE_ATTR(atrim, S_IRUGO, isl1208_sysfs_show_atrim, NULL); - --static ssize_t isl1208_sysfs_show_dtrim(struct device *dev, -- struct device_attribute *attr, -- char *buf) -+static ssize_t -+isl1208_sysfs_show_dtrim(struct device *dev, -+ struct device_attribute *attr, char *buf) - { -- int dtr; -- -- dtr = isl1208_i2c_get_dtr(to_i2c_client(dev)); -+ int dtr = isl1208_i2c_get_dtr(to_i2c_client(dev)); - if (dtr < 0) - return dtr; - - return sprintf(buf, "%d ppm\n", dtr); - } -+ - static DEVICE_ATTR(dtrim, S_IRUGO, isl1208_sysfs_show_dtrim, NULL); - --static ssize_t isl1208_sysfs_show_usr(struct device *dev, -- struct device_attribute *attr, -- char *buf) -+static ssize_t -+isl1208_sysfs_show_usr(struct device *dev, -+ struct device_attribute *attr, char *buf) - { -- int usr; -- -- usr = isl1208_i2c_get_usr(to_i2c_client(dev)); -+ int usr = isl1208_i2c_get_usr(to_i2c_client(dev)); - if (usr < 0) - return usr; - - return sprintf(buf, "0x%.4x\n", usr); - } - --static ssize_t isl1208_sysfs_store_usr(struct device *dev, -- struct device_attribute *attr, -- const char *buf, size_t count) -+static ssize_t -+isl1208_sysfs_store_usr(struct device *dev, -+ struct device_attribute *attr, -+ const char *buf, size_t count) - { - int usr = -1; - -@@ -460,124 +452,116 @@ static ssize_t isl1208_sysfs_store_usr(s - - return isl1208_i2c_set_usr(to_i2c_client(dev), usr) ? -EIO : count; - } -+ - static DEVICE_ATTR(usr, S_IRUGO | S_IWUSR, isl1208_sysfs_show_usr, - isl1208_sysfs_store_usr); - - static int --isl1208_probe(struct i2c_adapter *adapter, int addr, int kind) -+isl1208_sysfs_register(struct device *dev) - { -- int rc = 0; -- struct i2c_client *new_client = NULL; -- struct rtc_device *rtc = NULL; -+ int err; -+ -+ err = device_create_file(dev, &dev_attr_atrim); -+ if (err) -+ return err; - -- if (!i2c_check_functionality(adapter, I2C_FUNC_I2C)) { -- rc = -ENODEV; -- goto failout; -+ err = device_create_file(dev, &dev_attr_dtrim); -+ if (err) { -+ device_remove_file(dev, &dev_attr_atrim); -+ return err; - } - -- new_client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); -- if (new_client == NULL) { -- rc = -ENOMEM; -- goto failout; -+ err = device_create_file(dev, &dev_attr_usr); -+ if (err) { -+ device_remove_file(dev, &dev_attr_atrim); -+ device_remove_file(dev, &dev_attr_dtrim); - } - -- new_client->addr = addr; -- new_client->adapter = adapter; -- new_client->driver = &isl1208_driver; -- new_client->flags = 0; -- strcpy(new_client->name, DRV_NAME); -+ return 0; -+} - -- if (kind < 0) { -- rc = isl1208_i2c_validate_client(new_client); -- if (rc < 0) -- goto failout; -- } -+static int -+isl1208_sysfs_unregister(struct device *dev) -+{ -+ device_remove_file(dev, &dev_attr_atrim); -+ device_remove_file(dev, &dev_attr_atrim); -+ device_remove_file(dev, &dev_attr_usr); -+ -+ return 0; -+} -+ -+static int -+isl1208_probe(struct i2c_client *client) -+{ -+ int rc = 0; -+ struct rtc_device *rtc; - -- rc = i2c_attach_client(new_client); -- if (rc < 0) -- goto failout; -+ if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) -+ return -ENODEV; - -- dev_info(&new_client->dev, -+ if (isl1208_i2c_validate_client(client) < 0) -+ return -ENODEV; -+ -+ dev_info(&client->dev, - "chip found, driver version " DRV_VERSION "\n"); - - rtc = rtc_device_register(isl1208_driver.driver.name, -- &new_client->dev, -- &isl1208_rtc_ops, THIS_MODULE); -- -- if (IS_ERR(rtc)) { -- rc = PTR_ERR(rtc); -- goto failout_detach; -- } -+ &client->dev, &isl1208_rtc_ops, -+ THIS_MODULE); -+ if (IS_ERR(rtc)) -+ return PTR_ERR(rtc); - -- i2c_set_clientdata(new_client, rtc); -+ i2c_set_clientdata(client, rtc); - -- rc = isl1208_i2c_get_sr(new_client); -+ rc = isl1208_i2c_get_sr(client); - if (rc < 0) { -- dev_err(&new_client->dev, "reading status failed\n"); -- goto failout_unregister; -+ dev_err(&client->dev, "reading status failed\n"); -+ goto exit_unregister; - } - - if (rc & ISL1208_REG_SR_RTCF) -- dev_warn(&new_client->dev, "rtc power failure detected, " -+ dev_warn(&client->dev, "rtc power failure detected, " - "please set clock.\n"); - -- rc = device_create_file(&new_client->dev, &dev_attr_atrim); -- if (rc < 0) -- goto failout_unregister; -- rc = device_create_file(&new_client->dev, &dev_attr_dtrim); -- if (rc < 0) -- goto failout_atrim; -- rc = device_create_file(&new_client->dev, &dev_attr_usr); -- if (rc < 0) -- goto failout_dtrim; -+ rc = isl1208_sysfs_register(&client->dev); -+ if (rc) -+ goto exit_unregister; - - return 0; - -- failout_dtrim: -- device_remove_file(&new_client->dev, &dev_attr_dtrim); -- failout_atrim: -- device_remove_file(&new_client->dev, &dev_attr_atrim); -- failout_unregister: -+ exit_unregister: - rtc_device_unregister(rtc); -- failout_detach: -- i2c_detach_client(new_client); -- failout: -- kfree(new_client); -- return rc; --} - --static int --isl1208_attach_adapter (struct i2c_adapter *adapter) --{ -- return i2c_probe(adapter, &addr_data, isl1208_probe); -+ return rc; - } - - static int --isl1208_detach_client(struct i2c_client *client) -+isl1208_remove(struct i2c_client *client) - { -- int rc; -- struct rtc_device *const rtc = i2c_get_clientdata(client); -- -- if (rtc) -- rtc_device_unregister(rtc); /* do we need to kfree? */ -- -- rc = i2c_detach_client(client); -- if (rc) -- return rc; -+ struct rtc_device *rtc = i2c_get_clientdata(client); - -- kfree(client); -+ isl1208_sysfs_unregister(&client->dev); -+ rtc_device_unregister(rtc); - - return 0; - } - --/* module management */ -+static struct i2c_driver isl1208_driver = { -+ .driver = { -+ .name = "rtc-isl1208", -+ }, -+ .probe = isl1208_probe, -+ .remove = isl1208_remove, -+}; - --static int __init isl1208_init(void) -+static int __init -+isl1208_init(void) - { - return i2c_add_driver(&isl1208_driver); - } - --static void __exit isl1208_exit(void) -+static void __exit -+isl1208_exit(void) - { - i2c_del_driver(&isl1208_driver); - } -Index: linux-2.6.24.7/drivers/rtc/rtc-pcf8563.c -=================================================================== ---- linux-2.6.24.7.orig/drivers/rtc/rtc-pcf8563.c -+++ linux-2.6.24.7/drivers/rtc/rtc-pcf8563.c -@@ -18,17 +18,7 @@ - #include <linux/bcd.h> - #include <linux/rtc.h> - --#define DRV_VERSION "0.4.2" -- --/* Addresses to scan: none -- * This chip cannot be reliably autodetected. An empty eeprom -- * located at 0x51 will pass the validation routine due to -- * the way the registers are implemented. -- */ --static unsigned short normal_i2c[] = { I2C_CLIENT_END }; -- --/* Module parameters */ --I2C_CLIENT_INSMOD; -+#define DRV_VERSION "0.4.3" - - #define PCF8563_REG_ST1 0x00 /* status */ - #define PCF8563_REG_ST2 0x01 -@@ -53,8 +43,10 @@ I2C_CLIENT_INSMOD; - #define PCF8563_SC_LV 0x80 /* low voltage */ - #define PCF8563_MO_C 0x80 /* century */ - -+static struct i2c_driver pcf8563_driver; -+ - struct pcf8563 { -- struct i2c_client client; -+ struct rtc_device *rtc; - /* - * The meaning of MO_C bit varies by the chip type. - * From PCF8563 datasheet: this bit is toggled when the years -@@ -72,16 +64,13 @@ struct pcf8563 { - int c_polarity; /* 0: MO_C=1 means 19xx, otherwise MO_C=1 means 20xx */ - }; - --static int pcf8563_probe(struct i2c_adapter *adapter, int address, int kind); --static int pcf8563_detach(struct i2c_client *client); -- - /* - * In the routines that deal directly with the pcf8563 hardware, we use - * rtc_time -- month 0-11, hour 0-23, yr = calendar year-epoch. - */ - static int pcf8563_get_datetime(struct i2c_client *client, struct rtc_time *tm) - { -- struct pcf8563 *pcf8563 = container_of(client, struct pcf8563, client); -+ struct pcf8563 *pcf8563 = i2c_get_clientdata(client); - unsigned char buf[13] = { PCF8563_REG_ST1 }; - - struct i2c_msg msgs[] = { -@@ -138,7 +127,7 @@ static int pcf8563_get_datetime(struct i - - static int pcf8563_set_datetime(struct i2c_client *client, struct rtc_time *tm) - { -- struct pcf8563 *pcf8563 = container_of(client, struct pcf8563, client); -+ struct pcf8563 *pcf8563 = i2c_get_clientdata(client); - int i, err; - unsigned char buf[9]; - -@@ -257,100 +246,66 @@ static const struct rtc_class_ops pcf856 - .set_time = pcf8563_rtc_set_time, - }; - --static int pcf8563_attach(struct i2c_adapter *adapter) --{ -- return i2c_probe(adapter, &addr_data, pcf8563_probe); --} -- --static struct i2c_driver pcf8563_driver = { -- .driver = { -- .name = "pcf8563", -- }, -- .id = I2C_DRIVERID_PCF8563, -- .attach_adapter = &pcf8563_attach, -- .detach_client = &pcf8563_detach, --}; -- --static int pcf8563_probe(struct i2c_adapter *adapter, int address, int kind) -+static int pcf8563_probe(struct i2c_client *client) - { - struct pcf8563 *pcf8563; -- struct i2c_client *client; -- struct rtc_device *rtc; - - int err = 0; - -- dev_dbg(&adapter->dev, "%s\n", __FUNCTION__); -+ dev_dbg(&client->dev, "%s\n", __FUNCTION__); - -- if (!i2c_check_functionality(adapter, I2C_FUNC_I2C)) { -- err = -ENODEV; -- goto exit; -- } -+ if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) -+ return -ENODEV; - -- if (!(pcf8563 = kzalloc(sizeof(struct pcf8563), GFP_KERNEL))) { -- err = -ENOMEM; -- goto exit; -- } -- -- client = &pcf8563->client; -- client->addr = address; -- client->driver = &pcf8563_driver; -- client->adapter = adapter; -- -- strlcpy(client->name, pcf8563_driver.driver.name, I2C_NAME_SIZE); -+ if (!(pcf8563 = kzalloc(sizeof(struct pcf8563), GFP_KERNEL))) -+ return -ENOMEM; - - /* Verify the chip is really an PCF8563 */ -- if (kind < 0) { -- if (pcf8563_validate_client(client) < 0) { -- err = -ENODEV; -- goto exit_kfree; -- } -- } -- -- /* Inform the i2c layer */ -- if ((err = i2c_attach_client(client))) -+ if (pcf8563_validate_client(client) < 0) { -+ err = -ENODEV; - goto exit_kfree; -+ } - - dev_info(&client->dev, "chip found, driver version " DRV_VERSION "\n"); - -- rtc = rtc_device_register(pcf8563_driver.driver.name, &client->dev, -+ pcf8563->rtc = rtc_device_register(pcf8563_driver.driver.name, &client->dev, - &pcf8563_rtc_ops, THIS_MODULE); - -- if (IS_ERR(rtc)) { -- err = PTR_ERR(rtc); -- goto exit_detach; -+ if (IS_ERR(pcf8563->rtc)) { -+ err = PTR_ERR(pcf8563->rtc); -+ goto exit_kfree; - } - -- i2c_set_clientdata(client, rtc); -+ i2c_set_clientdata(client, pcf8563); - - return 0; - --exit_detach: -- i2c_detach_client(client); -- - exit_kfree: - kfree(pcf8563); - --exit: - return err; - } - --static int pcf8563_detach(struct i2c_client *client) -+static int pcf8563_remove(struct i2c_client *client) - { -- struct pcf8563 *pcf8563 = container_of(client, struct pcf8563, client); -- int err; -- struct rtc_device *rtc = i2c_get_clientdata(client); -+ struct pcf8563 *pcf8563 = i2c_get_clientdata(client); - -- if (rtc) -- rtc_device_unregister(rtc); -- -- if ((err = i2c_detach_client(client))) -- return err; -+ if (pcf8563->rtc) -+ rtc_device_unregister(pcf8563->rtc); - - kfree(pcf8563); - - return 0; - } - -+static struct i2c_driver pcf8563_driver = { -+ .driver = { -+ .name = "rtc-pcf8563", -+ }, -+ .probe = pcf8563_probe, -+ .remove = pcf8563_remove, -+}; -+ - static int __init pcf8563_init(void) - { - return i2c_add_driver(&pcf8563_driver); -Index: linux-2.6.24.7/drivers/rtc/rtc-x1205.c -=================================================================== ---- linux-2.6.24.7.orig/drivers/rtc/rtc-x1205.c -+++ linux-2.6.24.7/drivers/rtc/rtc-x1205.c -@@ -22,20 +22,7 @@ - #include <linux/rtc.h> - #include <linux/delay.h> - --#define DRV_VERSION "1.0.7" -- --/* Addresses to scan: none. This chip is located at -- * 0x6f and uses a two bytes register addressing. -- * Two bytes need to be written to read a single register, -- * while most other chips just require one and take the second -- * one as the data to be written. To prevent corrupting -- * unknown chips, the user must explicitly set the probe parameter. -- */ -- --static unsigned short normal_i2c[] = { I2C_CLIENT_END }; -- --/* Insmod parameters */ --I2C_CLIENT_INSMOD; -+#define DRV_VERSION "1.0.8" - - /* offsets into CCR area */ - -@@ -91,19 +78,7 @@ I2C_CLIENT_INSMOD; - - #define X1205_HR_MIL 0x80 /* Set in ccr.hour for 24 hr mode */ - --/* Prototypes */ --static int x1205_attach(struct i2c_adapter *adapter); --static int x1205_detach(struct i2c_client *client); --static int x1205_probe(struct i2c_adapter *adapter, int address, int kind); -- --static struct i2c_driver x1205_driver = { -- .driver = { -- .name = "x1205", -- }, -- .id = I2C_DRIVERID_X1205, -- .attach_adapter = &x1205_attach, -- .detach_client = &x1205_detach, --}; -+static struct i2c_driver x1205_driver; - - /* - * In the routines that deal directly with the x1205 hardware, we use -@@ -497,58 +472,51 @@ static ssize_t x1205_sysfs_show_dtrim(st - } - static DEVICE_ATTR(dtrim, S_IRUGO, x1205_sysfs_show_dtrim, NULL); - --static int x1205_attach(struct i2c_adapter *adapter) -+static int x1205_sysfs_register(struct device *dev) -+{ -+ int err; -+ -+ err = device_create_file(dev, &dev_attr_atrim); -+ if (err) -+ return err; -+ -+ err = device_create_file(dev, &dev_attr_dtrim); -+ if (err) -+ device_remove_file(dev, &dev_attr_atrim); -+ -+ return err; -+} -+ -+static void x1205_sysfs_unregister(struct device *dev) - { -- return i2c_probe(adapter, &addr_data, x1205_probe); -+ device_remove_file(dev, &dev_attr_atrim); -+ device_remove_file(dev, &dev_attr_dtrim); - } - --static int x1205_probe(struct i2c_adapter *adapter, int address, int kind) -+ -+static int x1205_probe(struct i2c_client *client) - { - int err = 0; - unsigned char sr; -- struct i2c_client *client; - struct rtc_device *rtc; - -- dev_dbg(&adapter->dev, "%s\n", __FUNCTION__); -+ dev_dbg(&client->dev, "%s\n", __FUNCTION__); - -- if (!i2c_check_functionality(adapter, I2C_FUNC_I2C)) { -- err = -ENODEV; -- goto exit; -+ if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { -+ return -ENODEV; - } - -- if (!(client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL))) { -- err = -ENOMEM; -- goto exit; -+ if (x1205_validate_client(client) < 0) { -+ return -ENODEV; - } - -- /* I2C client */ -- client->addr = address; -- client->driver = &x1205_driver; -- client->adapter = adapter; -- -- strlcpy(client->name, x1205_driver.driver.name, I2C_NAME_SIZE); -- -- /* Verify the chip is really an X1205 */ -- if (kind < 0) { -- if (x1205_validate_client(client) < 0) { -- err = -ENODEV; -- goto exit_kfree; -- } -- } -- -- /* Inform the i2c layer */ -- if ((err = i2c_attach_client(client))) -- goto exit_kfree; -- - dev_info(&client->dev, "chip found, driver version " DRV_VERSION "\n"); - - rtc = rtc_device_register(x1205_driver.driver.name, &client->dev, - &x1205_rtc_ops, THIS_MODULE); - -- if (IS_ERR(rtc)) { -- err = PTR_ERR(rtc); -- goto exit_detach; -- } -+ if (IS_ERR(rtc)) -+ return PTR_ERR(rtc); - - i2c_set_clientdata(client, rtc); - -@@ -565,45 +533,35 @@ static int x1205_probe(struct i2c_adapte - else - dev_err(&client->dev, "couldn't read status\n"); - -- err = device_create_file(&client->dev, &dev_attr_atrim); -- if (err) goto exit_devreg; -- err = device_create_file(&client->dev, &dev_attr_dtrim); -- if (err) goto exit_atrim; -+ err = x1205_sysfs_register(&client->dev); -+ if (err) -+ goto exit_devreg; - - return 0; - --exit_atrim: -- device_remove_file(&client->dev, &dev_attr_atrim); -- - exit_devreg: - rtc_device_unregister(rtc); - --exit_detach: -- i2c_detach_client(client); -- --exit_kfree: -- kfree(client); -- --exit: - return err; - } - --static int x1205_detach(struct i2c_client *client) -+static int x1205_remove(struct i2c_client *client) - { -- int err; - struct rtc_device *rtc = i2c_get_clientdata(client); - -- if (rtc) -- rtc_device_unregister(rtc); -- -- if ((err = i2c_detach_client(client))) -- return err; -- -- kfree(client); -- -+ rtc_device_unregister(rtc); -+ x1205_sysfs_unregister(&client->dev); - return 0; - } - -+static struct i2c_driver x1205_driver = { -+ .driver = { -+ .name = "rtc-x1205", -+ }, -+ .probe = x1205_probe, -+ .remove = x1205_remove, -+}; -+ - static int __init x1205_init(void) - { - return i2c_add_driver(&x1205_driver); diff --git a/target/linux/ixp4xx/patches-2.6.24/014_ixp4xx_i2c_gpio.patch b/target/linux/ixp4xx/patches-2.6.24/014_ixp4xx_i2c_gpio.patch deleted file mode 100644 index 98eb72adb4..0000000000 --- a/target/linux/ixp4xx/patches-2.6.24/014_ixp4xx_i2c_gpio.patch +++ /dev/null @@ -1,232 +0,0 @@ -Migrate all ixp4xx devices to the bitbanging I2C bus driver utilizing -the arch-neutral GPIO API (linux/i2c-gpio.h). - -Tested by the nslu2-linux and openwrt projects in public firmware releases. - -Acked-by: Rod Whitby <rod@whitby.id.au> -Signed-off-by: Michael-Luke Jones <mlj28@cam.ac.uk> - -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/nslu2-setup.c -=================================================================== ---- linux-2.6.24.7.orig/arch/arm/mach-ixp4xx/nslu2-setup.c -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/nslu2-setup.c -@@ -18,6 +18,7 @@ - #include <linux/serial.h> - #include <linux/serial_8250.h> - #include <linux/leds.h> -+#include <linux/i2c-gpio.h> - - #include <asm/mach-types.h> - #include <asm/mach/arch.h> -@@ -41,7 +42,7 @@ static struct platform_device nslu2_flas - .resource = &nslu2_flash_resource, - }; - --static struct ixp4xx_i2c_pins nslu2_i2c_gpio_pins = { -+static struct i2c_gpio_platform_data nslu2_i2c_gpio_data = { - .sda_pin = NSLU2_SDA_PIN, - .scl_pin = NSLU2_SCL_PIN, - }; -@@ -82,11 +83,12 @@ static struct platform_device nslu2_leds - }; - #endif - --static struct platform_device nslu2_i2c_controller = { -- .name = "IXP4XX-I2C", -+static struct platform_device nslu2_i2c_gpio = { -+ .name = "i2c-gpio", - .id = 0, -- .dev.platform_data = &nslu2_i2c_gpio_pins, -- .num_resources = 0, -+ .dev = { -+ .platform_data = &nslu2_i2c_gpio_data, -+ }, - }; - - static struct platform_device nslu2_beeper = { -@@ -139,7 +141,7 @@ static struct platform_device nslu2_uart - }; - - static struct platform_device *nslu2_devices[] __initdata = { -- &nslu2_i2c_controller, -+ &nslu2_i2c_gpio, - &nslu2_flash, - &nslu2_beeper, - #ifdef CONFIG_LEDS_IXP4XX -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/nas100d-setup.c -=================================================================== ---- linux-2.6.24.7.orig/arch/arm/mach-ixp4xx/nas100d-setup.c -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/nas100d-setup.c -@@ -16,6 +16,7 @@ - #include <linux/serial.h> - #include <linux/serial_8250.h> - #include <linux/leds.h> -+#include <linux/i2c-gpio.h> - - #include <asm/mach-types.h> - #include <asm/mach/arch.h> -@@ -68,16 +69,17 @@ static struct platform_device nas100d_le - }; - #endif - --static struct ixp4xx_i2c_pins nas100d_i2c_gpio_pins = { -+static struct i2c_gpio_platform_data nas100d_i2c_gpio_data = { - .sda_pin = NAS100D_SDA_PIN, - .scl_pin = NAS100D_SCL_PIN, - }; - --static struct platform_device nas100d_i2c_controller = { -- .name = "IXP4XX-I2C", -+static struct platform_device nas100d_i2c_gpio = { -+ .name = "i2c-gpio", - .id = 0, -- .dev.platform_data = &nas100d_i2c_gpio_pins, -- .num_resources = 0, -+ .dev = { -+ .platform_data = &nas100d_i2c_gpio_data, -+ }, - }; - - static struct resource nas100d_uart_resources[] = { -@@ -124,7 +126,7 @@ static struct platform_device nas100d_ua - }; - - static struct platform_device *nas100d_devices[] __initdata = { -- &nas100d_i2c_controller, -+ &nas100d_i2c_gpio, - &nas100d_flash, - #ifdef CONFIG_LEDS_IXP4XX - &nas100d_leds, -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/avila-setup.c -=================================================================== ---- linux-2.6.24.7.orig/arch/arm/mach-ixp4xx/avila-setup.c -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/avila-setup.c -@@ -18,6 +18,7 @@ - #include <linux/tty.h> - #include <linux/serial_8250.h> - #include <linux/slab.h> -+#include <linux/i2c-gpio.h> - - #include <asm/types.h> - #include <asm/setup.h> -@@ -47,18 +48,17 @@ static struct platform_device avila_flas - .resource = &avila_flash_resource, - }; - --static struct ixp4xx_i2c_pins avila_i2c_gpio_pins = { -+static struct i2c_gpio_platform_data avila_i2c_gpio_data = { - .sda_pin = AVILA_SDA_PIN, - .scl_pin = AVILA_SCL_PIN, - }; - --static struct platform_device avila_i2c_controller = { -- .name = "IXP4XX-I2C", -+static struct platform_device avila_i2c_gpio = { -+ .name = "i2c-gpio", - .id = 0, -- .dev = { -- .platform_data = &avila_i2c_gpio_pins, -+ .dev = { -+ .platform_data = &avila_i2c_gpio_data, - }, -- .num_resources = 0 - }; - - static struct resource avila_uart_resources[] = { -@@ -133,7 +133,7 @@ static struct platform_device avila_pata - }; - - static struct platform_device *avila_devices[] __initdata = { -- &avila_i2c_controller, -+ &avila_i2c_gpio, - &avila_flash, - &avila_uart - }; -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/dsmg600-setup.c -=================================================================== ---- linux-2.6.24.7.orig/arch/arm/mach-ixp4xx/dsmg600-setup.c -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/dsmg600-setup.c -@@ -14,6 +14,7 @@ - #include <linux/kernel.h> - #include <linux/serial.h> - #include <linux/serial_8250.h> -+#include <linux/i2c-gpio.h> - - #include <asm/mach-types.h> - #include <asm/mach/arch.h> -@@ -37,15 +38,17 @@ static struct platform_device dsmg600_fl - .resource = &dsmg600_flash_resource, - }; - --static struct ixp4xx_i2c_pins dsmg600_i2c_gpio_pins = { -+static struct i2c_gpio_platform_data dsmg600_i2c_gpio_data = { - .sda_pin = DSMG600_SDA_PIN, - .scl_pin = DSMG600_SCL_PIN, - }; - --static struct platform_device dsmg600_i2c_controller = { -- .name = "IXP4XX-I2C", -+static struct platform_device dsmg600_i2c_gpio = { -+ .name = "i2c-gpio", - .id = 0, -- .dev.platform_data = &dsmg600_i2c_gpio_pins, -+ .dev = { -+ .platform_data = &dsmg600_i2c_gpio_data, -+ }, - }; - - #ifdef CONFIG_LEDS_CLASS -@@ -116,7 +119,7 @@ static struct platform_device dsmg600_ua - }; - - static struct platform_device *dsmg600_devices[] __initdata = { -- &dsmg600_i2c_controller, -+ &dsmg600_i2c_gpio, - &dsmg600_flash, - }; - -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/ixdp425-setup.c -=================================================================== ---- linux-2.6.24.7.orig/arch/arm/mach-ixp4xx/ixdp425-setup.c -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/ixdp425-setup.c -@@ -15,6 +15,7 @@ - #include <linux/tty.h> - #include <linux/serial_8250.h> - #include <linux/slab.h> -+#include <linux/i2c-gpio.h> - #include <linux/io.h> - #include <linux/mtd/mtd.h> - #include <linux/mtd/nand.h> -@@ -120,18 +121,17 @@ static struct platform_device ixdp425_fl - }; - #endif /* CONFIG_MTD_NAND_PLATFORM */ - --static struct ixp4xx_i2c_pins ixdp425_i2c_gpio_pins = { -+static struct i2c_gpio_platform_data ixdp425_i2c_gpio_data = { - .sda_pin = IXDP425_SDA_PIN, - .scl_pin = IXDP425_SCL_PIN, - }; - --static struct platform_device ixdp425_i2c_controller = { -- .name = "IXP4XX-I2C", -+static struct platform_device ixdp425_i2c_gpio = { -+ .name = "i2c-gpio", - .id = 0, -- .dev = { -- .platform_data = &ixdp425_i2c_gpio_pins, -+ .dev = { -+ .platform_data = &ixdp425_i2c_gpio_data, - }, -- .num_resources = 0 - }; - - static struct resource ixdp425_uart_resources[] = { -@@ -178,7 +178,7 @@ static struct platform_device ixdp425_ua - }; - - static struct platform_device *ixdp425_devices[] __initdata = { -- &ixdp425_i2c_controller, -+ &ixdp425_i2c_gpio, - &ixdp425_flash, - #if defined(CONFIG_MTD_NAND_PLATFORM) || \ - defined(CONFIG_MTD_NAND_PLATFORM_MODULE) diff --git a/target/linux/ixp4xx/patches-2.6.24/015-ixp4xx_update_defconfig.patch b/target/linux/ixp4xx/patches-2.6.24/015-ixp4xx_update_defconfig.patch deleted file mode 100644 index 21f6964698..0000000000 --- a/target/linux/ixp4xx/patches-2.6.24/015-ixp4xx_update_defconfig.patch +++ /dev/null @@ -1,1724 +0,0 @@ -From 9882d8cedd79d23e939fa5f6017253f63fc97821 Mon Sep 17 00:00:00 2001 -From: Rod Whitby <rod@whitby.id.au> -Date: Tue, 29 Jan 2008 09:41:10 +1030 -Subject: ixp4xx: Update ixp4xx_defconfig, enabling all supported boards (Patch #4766) - -This updates the defconfig for the ixp4xx machine in arch/arm/config -taking all the defaults, with the following additions: - -1) Enable support for the nslu2, loft, gateway7001, wg302v2, - dsmg600, and gtwx5715 boards. -2) Enable EABI, OABI, HOTPLUG and FW_LOADER. -3) Enable the RTC subsystem, with drivers for the RTC chips on the - nslu2 (x1205) and nas100d/dsmg600 (pcf8563) boards. -4) Enable the LEDS subsystem to support the nslu2, nas100d and - dsmg600 boards. Enable the ixp4xx beeper driver. -5) Enable the USB subsystem, USB host driver support and USB mass - storage support (required for boot disk on nslu2 board). -6) Enable the ATA subsystem, with drivers for the nas100d/dsmg600 - (pata_artop) and avila (ixp4xx_cf) boards. - -Signed-off-by: Rod Whitby <rod@whitby.id.au> -Acked-by: Lennert Buytenhek <buytenh@wantstofly.org> - -PATCH FOLLOWS -KernelVersion: 2.6.24-git5 - -Index: linux-2.6.24.7/arch/arm/configs/ixp4xx_defconfig -=================================================================== ---- linux-2.6.24.7.orig/arch/arm/configs/ixp4xx_defconfig -+++ linux-2.6.24.7/arch/arm/configs/ixp4xx_defconfig -@@ -1,69 +1,96 @@ - # - # Automatically generated make config: don't edit --# Linux kernel version: 2.6.15 --# Tue Jan 3 03:20:40 2006 -+# Linux kernel version: 2.6.24-rc8 -+# Wed Jan 23 17:26:16 2008 - # - CONFIG_ARM=y -+CONFIG_SYS_SUPPORTS_APM_EMULATION=y -+CONFIG_GENERIC_GPIO=y -+CONFIG_GENERIC_TIME=y -+CONFIG_GENERIC_CLOCKEVENTS=y - CONFIG_MMU=y --CONFIG_UID16=y -+# CONFIG_NO_IOPORT is not set -+CONFIG_GENERIC_HARDIRQS=y -+CONFIG_STACKTRACE_SUPPORT=y -+CONFIG_LOCKDEP_SUPPORT=y -+CONFIG_TRACE_IRQFLAGS_SUPPORT=y -+CONFIG_HARDIRQS_SW_RESEND=y -+CONFIG_GENERIC_IRQ_PROBE=y - CONFIG_RWSEM_GENERIC_SPINLOCK=y -+# CONFIG_ARCH_HAS_ILOG2_U32 is not set -+# CONFIG_ARCH_HAS_ILOG2_U64 is not set -+CONFIG_GENERIC_HWEIGHT=y - CONFIG_GENERIC_CALIBRATE_DELAY=y -+CONFIG_ZONE_DMA=y -+CONFIG_VECTORS_BASE=0xffff0000 -+CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" - - # --# Code maturity level options -+# General setup - # - CONFIG_EXPERIMENTAL=y --CONFIG_CLEAN_COMPILE=y - CONFIG_BROKEN_ON_SMP=y - CONFIG_INIT_ENV_ARG_LIMIT=32 -- --# --# General setup --# - CONFIG_LOCALVERSION="" - CONFIG_LOCALVERSION_AUTO=y - CONFIG_SWAP=y - CONFIG_SYSVIPC=y -+CONFIG_SYSVIPC_SYSCTL=y - # CONFIG_POSIX_MQUEUE is not set - CONFIG_BSD_PROCESS_ACCT=y - # CONFIG_BSD_PROCESS_ACCT_V3 is not set --CONFIG_SYSCTL=y -+# CONFIG_TASKSTATS is not set -+# CONFIG_USER_NS is not set -+# CONFIG_PID_NS is not set - # CONFIG_AUDIT is not set --# CONFIG_HOTPLUG is not set --CONFIG_KOBJECT_UEVENT=y - # CONFIG_IKCONFIG is not set -+CONFIG_LOG_BUF_SHIFT=14 -+# CONFIG_CGROUPS is not set -+CONFIG_FAIR_GROUP_SCHED=y -+CONFIG_FAIR_USER_SCHED=y -+# CONFIG_FAIR_CGROUP_SCHED is not set -+CONFIG_SYSFS_DEPRECATED=y -+# CONFIG_RELAY is not set -+CONFIG_BLK_DEV_INITRD=y - CONFIG_INITRAMFS_SOURCE="" - CONFIG_CC_OPTIMIZE_FOR_SIZE=y -+CONFIG_SYSCTL=y - CONFIG_EMBEDDED=y -+CONFIG_UID16=y -+CONFIG_SYSCTL_SYSCALL=y - CONFIG_KALLSYMS=y - # CONFIG_KALLSYMS_ALL is not set - # CONFIG_KALLSYMS_EXTRA_PASS is not set -+CONFIG_HOTPLUG=y - CONFIG_PRINTK=y - CONFIG_BUG=y -+CONFIG_ELF_CORE=y - CONFIG_BASE_FULL=y - CONFIG_FUTEX=y -+CONFIG_ANON_INODES=y - CONFIG_EPOLL=y -+CONFIG_SIGNALFD=y -+CONFIG_EVENTFD=y - CONFIG_SHMEM=y --CONFIG_CC_ALIGN_FUNCTIONS=0 --CONFIG_CC_ALIGN_LABELS=0 --CONFIG_CC_ALIGN_LOOPS=0 --CONFIG_CC_ALIGN_JUMPS=0 -+CONFIG_VM_EVENT_COUNTERS=y -+CONFIG_SLUB_DEBUG=y -+# CONFIG_SLAB is not set -+CONFIG_SLUB=y -+# CONFIG_SLOB is not set -+CONFIG_SLABINFO=y -+CONFIG_RT_MUTEXES=y - # CONFIG_TINY_SHMEM is not set - CONFIG_BASE_SMALL=0 -- --# --# Loadable module support --# - CONFIG_MODULES=y - # CONFIG_MODULE_UNLOAD is not set --CONFIG_OBSOLETE_MODPARM=y - CONFIG_MODVERSIONS=y - # CONFIG_MODULE_SRCVERSION_ALL is not set - CONFIG_KMOD=y -- --# --# Block layer --# -+CONFIG_BLOCK=y -+# CONFIG_LBD is not set -+# CONFIG_BLK_DEV_IO_TRACE is not set -+# CONFIG_LSF is not set -+# CONFIG_BLK_DEV_BSG is not set - - # - # IO Schedulers -@@ -81,28 +108,39 @@ CONFIG_DEFAULT_IOSCHED="anticipatory" - # - # System Type - # -+# CONFIG_ARCH_AAEC2000 is not set -+# CONFIG_ARCH_INTEGRATOR is not set -+# CONFIG_ARCH_REALVIEW is not set -+# CONFIG_ARCH_VERSATILE is not set -+# CONFIG_ARCH_AT91 is not set - # CONFIG_ARCH_CLPS7500 is not set - # CONFIG_ARCH_CLPS711X is not set - # CONFIG_ARCH_CO285 is not set - # CONFIG_ARCH_EBSA110 is not set -+# CONFIG_ARCH_EP93XX is not set - # CONFIG_ARCH_FOOTBRIDGE is not set --# CONFIG_ARCH_INTEGRATOR is not set --# CONFIG_ARCH_IOP3XX is not set --CONFIG_ARCH_IXP4XX=y -+# CONFIG_ARCH_NETX is not set -+# CONFIG_ARCH_H720X is not set -+# CONFIG_ARCH_IMX is not set -+# CONFIG_ARCH_IOP13XX is not set -+# CONFIG_ARCH_IOP32X is not set -+# CONFIG_ARCH_IOP33X is not set -+# CONFIG_ARCH_IXP23XX is not set - # CONFIG_ARCH_IXP2000 is not set -+CONFIG_ARCH_IXP4XX=y - # CONFIG_ARCH_L7200 is not set -+# CONFIG_ARCH_KS8695 is not set -+# CONFIG_ARCH_NS9XXX is not set -+# CONFIG_ARCH_MXC is not set -+# CONFIG_ARCH_PNX4008 is not set - # CONFIG_ARCH_PXA is not set - # CONFIG_ARCH_RPC is not set - # CONFIG_ARCH_SA1100 is not set - # CONFIG_ARCH_S3C2410 is not set - # CONFIG_ARCH_SHARK is not set - # CONFIG_ARCH_LH7A40X is not set -+# CONFIG_ARCH_DAVINCI is not set - # CONFIG_ARCH_OMAP is not set --# CONFIG_ARCH_VERSATILE is not set --# CONFIG_ARCH_REALVIEW is not set --# CONFIG_ARCH_IMX is not set --# CONFIG_ARCH_H720X is not set --# CONFIG_ARCH_AAEC2000 is not set - CONFIG_ARCH_SUPPORTS_BIG_ENDIAN=y - - # -@@ -112,8 +150,12 @@ CONFIG_ARCH_SUPPORTS_BIG_ENDIAN=y - # - # IXP4xx Platforms - # --CONFIG_ARCH_AVILA=y -+CONFIG_MACH_NSLU2=y -+CONFIG_MACH_AVILA=y -+CONFIG_MACH_LOFT=y - CONFIG_ARCH_ADI_COYOTE=y -+CONFIG_MACH_GATEWAY7001=y -+CONFIG_MACH_WG302V2=y - CONFIG_ARCH_IXDP425=y - CONFIG_MACH_IXDPG425=y - CONFIG_MACH_IXDP465=y -@@ -121,17 +163,27 @@ CONFIG_MACH_KIXRP435=y - CONFIG_ARCH_IXCDP1100=y - CONFIG_ARCH_PRPMC1100=y - CONFIG_MACH_NAS100D=y -+CONFIG_MACH_DSMG600=y - CONFIG_ARCH_IXDP4XX=y - CONFIG_CPU_IXP46X=y - CONFIG_CPU_IXP43X=y --# CONFIG_MACH_GTWX5715 is not set -+CONFIG_MACH_GTWX5715=y - - # - # IXP4xx Options - # -+CONFIG_DMABOUNCE=y - # CONFIG_IXP4XX_INDIRECT_PCI is not set - - # -+# Boot options -+# -+ -+# -+# Power management -+# -+ -+# - # Processor Type - # - CONFIG_CPU_32=y -@@ -140,33 +192,40 @@ CONFIG_CPU_32v5=y - CONFIG_CPU_ABRT_EV5T=y - CONFIG_CPU_CACHE_VIVT=y - CONFIG_CPU_TLB_V4WBI=y -+CONFIG_CPU_CP15=y -+CONFIG_CPU_CP15_MMU=y - - # - # Processor Features - # - # CONFIG_ARM_THUMB is not set - CONFIG_CPU_BIG_ENDIAN=y -+# CONFIG_CPU_DCACHE_DISABLE is not set -+# CONFIG_OUTER_CACHE is not set -+# CONFIG_IWMMXT is not set - CONFIG_XSCALE_PMU=y --CONFIG_DMABOUNCE=y - - # - # Bus support - # --CONFIG_ISA_DMA_API=y - CONFIG_PCI=y --CONFIG_PCI_LEGACY_PROC=y -+CONFIG_PCI_SYSCALL=y -+# CONFIG_ARCH_SUPPORTS_MSI is not set -+CONFIG_PCI_LEGACY=y - # CONFIG_PCI_DEBUG is not set -- --# --# PCCARD (PCMCIA/CardBus) support --# - # CONFIG_PCCARD is not set - - # - # Kernel Features - # -+# CONFIG_TICK_ONESHOT is not set -+# CONFIG_NO_HZ is not set -+# CONFIG_HIGH_RES_TIMERS is not set -+CONFIG_GENERIC_CLOCKEVENTS_BUILD=y - # CONFIG_PREEMPT is not set --# CONFIG_NO_IDLE_HZ is not set -+CONFIG_HZ=100 -+CONFIG_AEABI=y -+CONFIG_OABI_COMPAT=y - # CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set - CONFIG_SELECT_MEMORY_MODEL=y - CONFIG_FLATMEM_MANUAL=y -@@ -175,7 +234,12 @@ CONFIG_FLATMEM_MANUAL=y - CONFIG_FLATMEM=y - CONFIG_FLAT_NODE_MEM_MAP=y - # CONFIG_SPARSEMEM_STATIC is not set -+# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set - CONFIG_SPLIT_PTLOCK_CPUS=4096 -+# CONFIG_RESOURCES_64BIT is not set -+CONFIG_ZONE_DMA_FLAG=1 -+CONFIG_BOUNCE=y -+CONFIG_VIRT_TO_BUS=y - CONFIG_ALIGNMENT_TRAP=y - - # -@@ -185,6 +249,7 @@ CONFIG_ZBOOT_ROM_TEXT=0x0 - CONFIG_ZBOOT_ROM_BSS=0x0 - CONFIG_CMDLINE="console=ttyS0,115200 ip=bootp root=/dev/nfs" - # CONFIG_XIP_KERNEL is not set -+# CONFIG_KEXEC is not set - - # - # Floating point emulation -@@ -203,13 +268,12 @@ CONFIG_FPE_NWFPE=y - CONFIG_BINFMT_ELF=y - # CONFIG_BINFMT_AOUT is not set - # CONFIG_BINFMT_MISC is not set --# CONFIG_ARTHUR is not set - - # - # Power management options - # - # CONFIG_PM is not set --# CONFIG_APM is not set -+CONFIG_SUSPEND_UP_POSSIBLE=y - - # - # Networking -@@ -219,11 +283,13 @@ CONFIG_NET=y - # - # Networking options - # --CONFIG_PACKET=m -+CONFIG_PACKET=y - CONFIG_PACKET_MMAP=y - CONFIG_UNIX=y - CONFIG_XFRM=y - # CONFIG_XFRM_USER is not set -+# CONFIG_XFRM_SUB_POLICY is not set -+# CONFIG_XFRM_MIGRATE is not set - # CONFIG_NET_KEY is not set - CONFIG_INET=y - CONFIG_IP_MULTICAST=y -@@ -232,9 +298,7 @@ CONFIG_ASK_IP_FIB_HASH=y - # CONFIG_IP_FIB_TRIE is not set - CONFIG_IP_FIB_HASH=y - CONFIG_IP_MULTIPLE_TABLES=y --CONFIG_IP_ROUTE_FWMARK=y - CONFIG_IP_ROUTE_MULTIPATH=y --# CONFIG_IP_ROUTE_MULTIPATH_CACHED is not set - CONFIG_IP_ROUTE_VERBOSE=y - CONFIG_IP_PNP=y - CONFIG_IP_PNP_DHCP=y -@@ -251,15 +315,18 @@ CONFIG_SYN_COOKIES=y - # CONFIG_INET_AH is not set - # CONFIG_INET_ESP is not set - # CONFIG_INET_IPCOMP is not set --CONFIG_INET_TUNNEL=m -+# CONFIG_INET_XFRM_TUNNEL is not set -+# CONFIG_INET_TUNNEL is not set -+CONFIG_INET_XFRM_MODE_TRANSPORT=y -+CONFIG_INET_XFRM_MODE_TUNNEL=y -+CONFIG_INET_XFRM_MODE_BEET=y -+# CONFIG_INET_LRO is not set - CONFIG_INET_DIAG=y - CONFIG_INET_TCP_DIAG=y - # CONFIG_TCP_CONG_ADVANCED is not set --CONFIG_TCP_CONG_BIC=y -- --# --# IP: Virtual Server Configuration --# -+CONFIG_TCP_CONG_CUBIC=y -+CONFIG_DEFAULT_TCP_CONG="cubic" -+# CONFIG_TCP_MD5SIG is not set - CONFIG_IP_VS=m - CONFIG_IP_VS_DEBUG=y - CONFIG_IP_VS_TAB_BITS=12 -@@ -290,6 +357,9 @@ CONFIG_IP_VS_SH=m - # IPVS application helper - # - # CONFIG_IPV6 is not set -+# CONFIG_INET6_XFRM_TUNNEL is not set -+# CONFIG_INET6_TUNNEL is not set -+# CONFIG_NETWORK_SECMARK is not set - CONFIG_NETFILTER=y - # CONFIG_NETFILTER_DEBUG is not set - CONFIG_BRIDGE_NETFILTER=y -@@ -298,70 +368,57 @@ CONFIG_BRIDGE_NETFILTER=y - # Core Netfilter Configuration - # - # CONFIG_NETFILTER_NETLINK is not set -+# CONFIG_NF_CONNTRACK_ENABLED is not set -+# CONFIG_NF_CONNTRACK is not set -+CONFIG_NETFILTER_XTABLES=m -+# CONFIG_NETFILTER_XT_TARGET_CLASSIFY is not set -+# CONFIG_NETFILTER_XT_TARGET_DSCP is not set -+# CONFIG_NETFILTER_XT_TARGET_MARK is not set -+# CONFIG_NETFILTER_XT_TARGET_NFQUEUE is not set -+# CONFIG_NETFILTER_XT_TARGET_NFLOG is not set -+# CONFIG_NETFILTER_XT_TARGET_TCPMSS is not set -+# CONFIG_NETFILTER_XT_MATCH_COMMENT is not set -+# CONFIG_NETFILTER_XT_MATCH_DCCP is not set -+# CONFIG_NETFILTER_XT_MATCH_DSCP is not set -+# CONFIG_NETFILTER_XT_MATCH_ESP is not set -+# CONFIG_NETFILTER_XT_MATCH_LENGTH is not set -+# CONFIG_NETFILTER_XT_MATCH_LIMIT is not set -+# CONFIG_NETFILTER_XT_MATCH_MAC is not set -+# CONFIG_NETFILTER_XT_MATCH_MARK is not set -+# CONFIG_NETFILTER_XT_MATCH_POLICY is not set -+# CONFIG_NETFILTER_XT_MATCH_MULTIPORT is not set -+# CONFIG_NETFILTER_XT_MATCH_PHYSDEV is not set -+# CONFIG_NETFILTER_XT_MATCH_PKTTYPE is not set -+# CONFIG_NETFILTER_XT_MATCH_QUOTA is not set -+# CONFIG_NETFILTER_XT_MATCH_REALM is not set -+# CONFIG_NETFILTER_XT_MATCH_SCTP is not set -+# CONFIG_NETFILTER_XT_MATCH_STATISTIC is not set -+# CONFIG_NETFILTER_XT_MATCH_STRING is not set -+# CONFIG_NETFILTER_XT_MATCH_TCPMSS is not set -+# CONFIG_NETFILTER_XT_MATCH_TIME is not set -+# CONFIG_NETFILTER_XT_MATCH_U32 is not set -+# CONFIG_NETFILTER_XT_MATCH_HASHLIMIT is not set - - # - # IP: Netfilter Configuration - # --CONFIG_IP_NF_CONNTRACK=m --# CONFIG_IP_NF_CT_ACCT is not set --# CONFIG_IP_NF_CONNTRACK_MARK is not set --# CONFIG_IP_NF_CONNTRACK_EVENTS is not set --# CONFIG_IP_NF_CT_PROTO_SCTP is not set --CONFIG_IP_NF_FTP=m --CONFIG_IP_NF_IRC=m --# CONFIG_IP_NF_NETBIOS_NS is not set --# CONFIG_IP_NF_TFTP is not set --# CONFIG_IP_NF_AMANDA is not set --# CONFIG_IP_NF_PPTP is not set - CONFIG_IP_NF_QUEUE=m - CONFIG_IP_NF_IPTABLES=m --CONFIG_IP_NF_MATCH_LIMIT=m - # CONFIG_IP_NF_MATCH_IPRANGE is not set --CONFIG_IP_NF_MATCH_MAC=m --# CONFIG_IP_NF_MATCH_PKTTYPE is not set --CONFIG_IP_NF_MATCH_MARK=m --CONFIG_IP_NF_MATCH_MULTIPORT=m - CONFIG_IP_NF_MATCH_TOS=m - # CONFIG_IP_NF_MATCH_RECENT is not set - # CONFIG_IP_NF_MATCH_ECN is not set --# CONFIG_IP_NF_MATCH_DSCP is not set --CONFIG_IP_NF_MATCH_AH_ESP=m --CONFIG_IP_NF_MATCH_LENGTH=m -+# CONFIG_IP_NF_MATCH_AH is not set - CONFIG_IP_NF_MATCH_TTL=m --CONFIG_IP_NF_MATCH_TCPMSS=m --# CONFIG_IP_NF_MATCH_HELPER is not set --CONFIG_IP_NF_MATCH_STATE=m --# CONFIG_IP_NF_MATCH_CONNTRACK is not set - CONFIG_IP_NF_MATCH_OWNER=m --# CONFIG_IP_NF_MATCH_PHYSDEV is not set - # CONFIG_IP_NF_MATCH_ADDRTYPE is not set --# CONFIG_IP_NF_MATCH_REALM is not set --# CONFIG_IP_NF_MATCH_SCTP is not set --# CONFIG_IP_NF_MATCH_DCCP is not set --# CONFIG_IP_NF_MATCH_COMMENT is not set --# CONFIG_IP_NF_MATCH_HASHLIMIT is not set --# CONFIG_IP_NF_MATCH_STRING is not set - CONFIG_IP_NF_FILTER=m - CONFIG_IP_NF_TARGET_REJECT=m - CONFIG_IP_NF_TARGET_LOG=m - CONFIG_IP_NF_TARGET_ULOG=m --CONFIG_IP_NF_TARGET_TCPMSS=m --# CONFIG_IP_NF_TARGET_NFQUEUE is not set --CONFIG_IP_NF_NAT=m --CONFIG_IP_NF_NAT_NEEDED=y --CONFIG_IP_NF_TARGET_MASQUERADE=m --CONFIG_IP_NF_TARGET_REDIRECT=m --# CONFIG_IP_NF_TARGET_NETMAP is not set --# CONFIG_IP_NF_TARGET_SAME is not set --CONFIG_IP_NF_NAT_SNMP_BASIC=m --CONFIG_IP_NF_NAT_IRC=m --CONFIG_IP_NF_NAT_FTP=m - CONFIG_IP_NF_MANGLE=m - CONFIG_IP_NF_TARGET_TOS=m - # CONFIG_IP_NF_TARGET_ECN is not set --# CONFIG_IP_NF_TARGET_DSCP is not set --CONFIG_IP_NF_TARGET_MARK=m --# CONFIG_IP_NF_TARGET_CLASSIFY is not set - # CONFIG_IP_NF_TARGET_TTL is not set - # CONFIG_IP_NF_RAW is not set - CONFIG_IP_NF_ARPTABLES=m -@@ -372,16 +429,9 @@ CONFIG_IP_NF_ARPFILTER=m - # Bridge: Netfilter Configuration - # - # CONFIG_BRIDGE_NF_EBTABLES is not set -- --# --# DCCP Configuration (EXPERIMENTAL) --# - # CONFIG_IP_DCCP is not set -- --# --# SCTP Configuration (EXPERIMENTAL) --# - # CONFIG_IP_SCTP is not set -+# CONFIG_TIPC is not set - CONFIG_ATM=y - CONFIG_ATM_CLIP=y - # CONFIG_ATM_CLIP_NO_ICMP is not set -@@ -397,25 +447,17 @@ CONFIG_LLC=m - CONFIG_IPX=m - # CONFIG_IPX_INTERN is not set - CONFIG_ATALK=m --CONFIG_DEV_APPLETALK=y -+CONFIG_DEV_APPLETALK=m - CONFIG_IPDDP=m - CONFIG_IPDDP_ENCAP=y - CONFIG_IPDDP_DECAP=y - CONFIG_X25=m - CONFIG_LAPB=m --# CONFIG_NET_DIVERT is not set - CONFIG_ECONET=m - CONFIG_ECONET_AUNUDP=y - CONFIG_ECONET_NATIVE=y - CONFIG_WAN_ROUTER=m -- --# --# QoS and/or fair queueing --# - CONFIG_NET_SCHED=y --CONFIG_NET_SCH_CLK_JIFFIES=y --# CONFIG_NET_SCH_CLK_GETTIMEOFDAY is not set --# CONFIG_NET_SCH_CLK_CPU is not set - - # - # Queueing/Scheduling -@@ -425,6 +467,7 @@ CONFIG_NET_SCH_HTB=m - # CONFIG_NET_SCH_HFSC is not set - # CONFIG_NET_SCH_ATM is not set - CONFIG_NET_SCH_PRIO=m -+# CONFIG_NET_SCH_RR is not set - CONFIG_NET_SCH_RED=m - CONFIG_NET_SCH_SFQ=m - CONFIG_NET_SCH_TEQL=m -@@ -449,10 +492,17 @@ CONFIG_NET_CLS_U32=m - CONFIG_NET_CLS_RSVP=m - CONFIG_NET_CLS_RSVP6=m - # CONFIG_NET_EMATCH is not set --# CONFIG_NET_CLS_ACT is not set -+CONFIG_NET_CLS_ACT=y -+CONFIG_NET_ACT_POLICE=y -+# CONFIG_NET_ACT_GACT is not set -+# CONFIG_NET_ACT_MIRRED is not set -+# CONFIG_NET_ACT_IPT is not set -+# CONFIG_NET_ACT_NAT is not set -+# CONFIG_NET_ACT_PEDIT is not set -+# CONFIG_NET_ACT_SIMP is not set - CONFIG_NET_CLS_POLICE=y - # CONFIG_NET_CLS_IND is not set --CONFIG_NET_ESTIMATOR=y -+CONFIG_NET_SCH_FIFO=y - - # - # Network testing -@@ -461,7 +511,18 @@ CONFIG_NET_PKTGEN=m - # CONFIG_HAMRADIO is not set - # CONFIG_IRDA is not set - # CONFIG_BT is not set -+# CONFIG_AF_RXRPC is not set -+CONFIG_FIB_RULES=y -+ -+# -+# Wireless -+# -+# CONFIG_CFG80211 is not set -+# CONFIG_WIRELESS_EXT is not set -+# CONFIG_MAC80211 is not set - # CONFIG_IEEE80211 is not set -+# CONFIG_RFKILL is not set -+# CONFIG_NET_9P is not set - - # - # Device Drivers -@@ -470,19 +531,14 @@ CONFIG_NET_PKTGEN=m - # - # Generic Driver Options - # -+CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" - CONFIG_STANDALONE=y - CONFIG_PREVENT_FIRMWARE_BUILD=y --# CONFIG_FW_LOADER is not set -+CONFIG_FW_LOADER=y - # CONFIG_DEBUG_DRIVER is not set -- --# --# Connector - unified userspace <-> kernelspace linker --# -+# CONFIG_DEBUG_DEVRES is not set -+# CONFIG_SYS_HYPERVISOR is not set - # CONFIG_CONNECTOR is not set -- --# --# Memory Technology Devices (MTD) --# - CONFIG_MTD=y - # CONFIG_MTD_DEBUG is not set - # CONFIG_MTD_CONCAT is not set -@@ -498,11 +554,14 @@ CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK=-1 - # User Modules And Translation Layers - # - CONFIG_MTD_CHAR=y -+CONFIG_MTD_BLKDEVS=y - CONFIG_MTD_BLOCK=y - # CONFIG_FTL is not set - # CONFIG_NFTL is not set - # CONFIG_INFTL is not set - # CONFIG_RFD_FTL is not set -+# CONFIG_SSFDC is not set -+# CONFIG_MTD_OOPS is not set - - # - # RAM/ROM/Flash chip drivers -@@ -528,7 +587,6 @@ CONFIG_MTD_CFI_UTIL=y - # CONFIG_MTD_RAM is not set - # CONFIG_MTD_ROM is not set - # CONFIG_MTD_ABSENT is not set --# CONFIG_MTD_XIP is not set - - # - # Mapping drivers for chip access -@@ -538,6 +596,7 @@ CONFIG_MTD_COMPLEX_MAPPINGS=y - # CONFIG_MTD_ARM_INTEGRATOR is not set - CONFIG_MTD_IXP4XX=y - # CONFIG_MTD_PCI is not set -+# CONFIG_MTD_INTEL_VR_NOR is not set - # CONFIG_MTD_PLATRAM is not set - - # -@@ -547,7 +606,6 @@ CONFIG_MTD_IXP4XX=y - # CONFIG_MTD_SLRAM is not set - # CONFIG_MTD_PHRAM is not set - # CONFIG_MTD_MTDRAM is not set --# CONFIG_MTD_BLKMTD is not set - # CONFIG_MTD_BLOCK2MTD is not set - - # -@@ -556,33 +614,24 @@ CONFIG_MTD_IXP4XX=y - # CONFIG_MTD_DOC2000 is not set - # CONFIG_MTD_DOC2001 is not set - # CONFIG_MTD_DOC2001PLUS is not set -- --# --# NAND Flash Device Drivers --# - CONFIG_MTD_NAND=m - # CONFIG_MTD_NAND_VERIFY_WRITE is not set -+# CONFIG_MTD_NAND_ECC_SMC is not set -+# CONFIG_MTD_NAND_MUSEUM_IDS is not set - CONFIG_MTD_NAND_IDS=m - # CONFIG_MTD_NAND_DISKONCHIP is not set -+# CONFIG_MTD_NAND_CAFE is not set - # CONFIG_MTD_NAND_NANDSIM is not set -- --# --# OneNAND Flash Device Drivers --# -+# CONFIG_MTD_NAND_PLATFORM is not set -+# CONFIG_MTD_ALAUDA is not set - # CONFIG_MTD_ONENAND is not set - - # --# Parallel port support -+# UBI - Unsorted block images - # -+# CONFIG_MTD_UBI is not set - # CONFIG_PARPORT is not set -- --# --# Plug and Play support --# -- --# --# Block devices --# -+CONFIG_BLK_DEV=y - # CONFIG_BLK_CPQ_DA is not set - # CONFIG_BLK_CPQ_CISS_DA is not set - # CONFIG_BLK_DEV_DAC960 is not set -@@ -592,17 +641,20 @@ CONFIG_BLK_DEV_LOOP=y - # CONFIG_BLK_DEV_CRYPTOLOOP is not set - # CONFIG_BLK_DEV_NBD is not set - # CONFIG_BLK_DEV_SX8 is not set -+# CONFIG_BLK_DEV_UB is not set - CONFIG_BLK_DEV_RAM=y - CONFIG_BLK_DEV_RAM_COUNT=16 - CONFIG_BLK_DEV_RAM_SIZE=8192 --CONFIG_BLK_DEV_INITRD=y -+CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 - # CONFIG_CDROM_PKTCDVD is not set - # CONFIG_ATA_OVER_ETH is not set -- --# --# ATA/ATAPI/MFM/RLL support --# -+CONFIG_MISC_DEVICES=y -+# CONFIG_PHANTOM is not set -+# CONFIG_EEPROM_93CX6 is not set -+# CONFIG_SGI_IOC4 is not set -+# CONFIG_TIFM_CORE is not set - CONFIG_IDE=y -+CONFIG_IDE_MAX_HWIFS=4 - CONFIG_BLK_DEV_IDE=y - - # -@@ -614,24 +666,28 @@ CONFIG_BLK_DEV_IDEDISK=y - # CONFIG_BLK_DEV_IDECD is not set - # CONFIG_BLK_DEV_IDETAPE is not set - # CONFIG_BLK_DEV_IDEFLOPPY is not set -+# CONFIG_BLK_DEV_IDESCSI is not set - # CONFIG_IDE_TASK_IOCTL is not set -+CONFIG_IDE_PROC_FS=y - - # - # IDE chipset support/bugfixes - # - CONFIG_IDE_GENERIC=y -+# CONFIG_BLK_DEV_PLATFORM is not set -+ -+# -+# PCI IDE chipsets support -+# - CONFIG_BLK_DEV_IDEPCI=y - # CONFIG_IDEPCI_SHARE_IRQ is not set -+CONFIG_IDEPCI_PCIBUS_ORDER=y - # CONFIG_BLK_DEV_OFFBOARD is not set - # CONFIG_BLK_DEV_GENERIC is not set - # CONFIG_BLK_DEV_OPTI621 is not set --# CONFIG_BLK_DEV_SL82C105 is not set - CONFIG_BLK_DEV_IDEDMA_PCI=y --# CONFIG_BLK_DEV_IDEDMA_FORCED is not set --# CONFIG_IDEDMA_PCI_AUTO is not set - # CONFIG_BLK_DEV_AEC62XX is not set - # CONFIG_BLK_DEV_ALI15X3 is not set --# CONFIG_BLK_DEV_AMD74XX is not set - CONFIG_BLK_DEV_CMD64X=y - # CONFIG_BLK_DEV_TRIFLEX is not set - # CONFIG_BLK_DEV_CY82C693 is not set -@@ -639,93 +695,162 @@ CONFIG_BLK_DEV_CMD64X=y - # CONFIG_BLK_DEV_CS5530 is not set - # CONFIG_BLK_DEV_HPT34X is not set - CONFIG_BLK_DEV_HPT366=y -+# CONFIG_BLK_DEV_JMICRON is not set - # CONFIG_BLK_DEV_SC1200 is not set - # CONFIG_BLK_DEV_PIIX is not set -+# CONFIG_BLK_DEV_IT8213 is not set - # CONFIG_BLK_DEV_IT821X is not set - # CONFIG_BLK_DEV_NS87415 is not set - # CONFIG_BLK_DEV_PDC202XX_OLD is not set - CONFIG_BLK_DEV_PDC202XX_NEW=y --# CONFIG_PDC202XX_FORCE is not set - # CONFIG_BLK_DEV_SVWKS is not set - # CONFIG_BLK_DEV_SIIMAGE is not set -+# CONFIG_BLK_DEV_SL82C105 is not set - # CONFIG_BLK_DEV_SLC90E66 is not set - # CONFIG_BLK_DEV_TRM290 is not set - # CONFIG_BLK_DEV_VIA82CXXX is not set -+# CONFIG_BLK_DEV_TC86C001 is not set - # CONFIG_IDE_ARM is not set - CONFIG_BLK_DEV_IDEDMA=y --# CONFIG_IDEDMA_IVB is not set --# CONFIG_IDEDMA_AUTO is not set -+CONFIG_IDE_ARCH_OBSOLETE_INIT=y - # CONFIG_BLK_DEV_HD is not set - - # - # SCSI device support - # - # CONFIG_RAID_ATTRS is not set --# CONFIG_SCSI is not set -- --# --# Multi-device support (RAID and LVM) --# -+CONFIG_SCSI=y -+CONFIG_SCSI_DMA=y -+# CONFIG_SCSI_TGT is not set -+# CONFIG_SCSI_NETLINK is not set -+# CONFIG_SCSI_PROC_FS is not set -+ -+# -+# SCSI support type (disk, tape, CD-ROM) -+# -+CONFIG_BLK_DEV_SD=y -+# CONFIG_CHR_DEV_ST is not set -+# CONFIG_CHR_DEV_OSST is not set -+# CONFIG_BLK_DEV_SR is not set -+# CONFIG_CHR_DEV_SG is not set -+# CONFIG_CHR_DEV_SCH is not set -+ -+# -+# Some SCSI devices (e.g. CD jukebox) support multiple LUNs -+# -+# CONFIG_SCSI_MULTI_LUN is not set -+# CONFIG_SCSI_CONSTANTS is not set -+# CONFIG_SCSI_LOGGING is not set -+# CONFIG_SCSI_SCAN_ASYNC is not set -+CONFIG_SCSI_WAIT_SCAN=m -+ -+# -+# SCSI Transports -+# -+# CONFIG_SCSI_SPI_ATTRS is not set -+# CONFIG_SCSI_FC_ATTRS is not set -+# CONFIG_SCSI_ISCSI_ATTRS is not set -+# CONFIG_SCSI_SAS_LIBSAS is not set -+# CONFIG_SCSI_SRP_ATTRS is not set -+# CONFIG_SCSI_LOWLEVEL is not set -+CONFIG_ATA=y -+# CONFIG_ATA_NONSTANDARD is not set -+# CONFIG_SATA_AHCI is not set -+# CONFIG_SATA_SVW is not set -+# CONFIG_ATA_PIIX is not set -+# CONFIG_SATA_MV is not set -+# CONFIG_SATA_NV is not set -+# CONFIG_PDC_ADMA is not set -+# CONFIG_SATA_QSTOR is not set -+# CONFIG_SATA_PROMISE is not set -+# CONFIG_SATA_SX4 is not set -+# CONFIG_SATA_SIL is not set -+# CONFIG_SATA_SIL24 is not set -+# CONFIG_SATA_SIS is not set -+# CONFIG_SATA_ULI is not set -+# CONFIG_SATA_VIA is not set -+# CONFIG_SATA_VITESSE is not set -+# CONFIG_SATA_INIC162X is not set -+# CONFIG_PATA_ALI is not set -+# CONFIG_PATA_AMD is not set -+CONFIG_PATA_ARTOP=y -+# CONFIG_PATA_ATIIXP is not set -+# CONFIG_PATA_CMD640_PCI is not set -+# CONFIG_PATA_CMD64X is not set -+# CONFIG_PATA_CS5520 is not set -+# CONFIG_PATA_CS5530 is not set -+# CONFIG_PATA_CYPRESS is not set -+# CONFIG_PATA_EFAR is not set -+# CONFIG_ATA_GENERIC is not set -+# CONFIG_PATA_HPT366 is not set -+# CONFIG_PATA_HPT37X is not set -+# CONFIG_PATA_HPT3X2N is not set -+# CONFIG_PATA_HPT3X3 is not set -+# CONFIG_PATA_IT821X is not set -+# CONFIG_PATA_IT8213 is not set -+# CONFIG_PATA_JMICRON is not set -+# CONFIG_PATA_TRIFLEX is not set -+# CONFIG_PATA_MARVELL is not set -+# CONFIG_PATA_MPIIX is not set -+# CONFIG_PATA_OLDPIIX is not set -+# CONFIG_PATA_NETCELL is not set -+# CONFIG_PATA_NS87410 is not set -+# CONFIG_PATA_NS87415 is not set -+# CONFIG_PATA_OPTI is not set -+# CONFIG_PATA_OPTIDMA is not set -+# CONFIG_PATA_PDC_OLD is not set -+# CONFIG_PATA_RADISYS is not set -+# CONFIG_PATA_RZ1000 is not set -+# CONFIG_PATA_SC1200 is not set -+# CONFIG_PATA_SERVERWORKS is not set -+# CONFIG_PATA_PDC2027X is not set -+# CONFIG_PATA_SIL680 is not set -+# CONFIG_PATA_SIS is not set -+# CONFIG_PATA_VIA is not set -+# CONFIG_PATA_WINBOND is not set -+# CONFIG_PATA_PLATFORM is not set -+CONFIG_PATA_IXP4XX_CF=y - # CONFIG_MD is not set -- --# --# Fusion MPT device support --# - # CONFIG_FUSION is not set - - # - # IEEE 1394 (FireWire) support - # -+# CONFIG_FIREWIRE is not set - # CONFIG_IEEE1394 is not set -- --# --# I2O device support --# - # CONFIG_I2O is not set -- --# --# Network device support --# - CONFIG_NETDEVICES=y -+# CONFIG_NETDEVICES_MULTIQUEUE is not set -+# CONFIG_IFB is not set - CONFIG_DUMMY=y - # CONFIG_BONDING is not set -+# CONFIG_MACVLAN is not set - # CONFIG_EQUALIZER is not set - # CONFIG_TUN is not set -- --# --# ARCnet devices --# -+# CONFIG_VETH is not set - # CONFIG_ARCNET is not set -- --# --# PHY device support --# - # CONFIG_PHYLIB is not set -- --# --# Ethernet (10 or 100Mbit) --# - CONFIG_NET_ETHERNET=y - CONFIG_MII=y -+# CONFIG_AX88796 is not set - # CONFIG_HAPPYMEAL is not set - # CONFIG_SUNGEM is not set - # CONFIG_CASSINI is not set - # CONFIG_NET_VENDOR_3COM is not set - # CONFIG_SMC91X is not set - # CONFIG_DM9000 is not set -- --# --# Tulip family network device support --# - # CONFIG_NET_TULIP is not set - # CONFIG_HP100 is not set -+# CONFIG_IBM_NEW_EMAC_ZMII is not set -+# CONFIG_IBM_NEW_EMAC_RGMII is not set -+# CONFIG_IBM_NEW_EMAC_TAH is not set -+# CONFIG_IBM_NEW_EMAC_EMAC4 is not set - CONFIG_NET_PCI=y - # CONFIG_PCNET32 is not set - # CONFIG_AMD8111_ETH is not set - # CONFIG_ADAPTEC_STARFIRE is not set - # CONFIG_B44 is not set - # CONFIG_FORCEDETH is not set --# CONFIG_DGRS is not set - CONFIG_EEPRO100=y - # CONFIG_E100 is not set - # CONFIG_FEALNX is not set -@@ -738,93 +863,75 @@ CONFIG_EEPRO100=y - # CONFIG_SUNDANCE is not set - # CONFIG_TLAN is not set - # CONFIG_VIA_RHINE is not set -- --# --# Ethernet (1000 Mbit) --# -+# CONFIG_SC92031 is not set -+CONFIG_NETDEV_1000=y - # CONFIG_ACENIC is not set - # CONFIG_DL2K is not set - # CONFIG_E1000 is not set -+# CONFIG_E1000E is not set -+# CONFIG_IP1000 is not set - # CONFIG_NS83820 is not set - # CONFIG_HAMACHI is not set - # CONFIG_YELLOWFIN is not set - # CONFIG_R8169 is not set - # CONFIG_SIS190 is not set - # CONFIG_SKGE is not set -+# CONFIG_SKY2 is not set - # CONFIG_SK98LIN is not set - # CONFIG_VIA_VELOCITY is not set - # CONFIG_TIGON3 is not set - # CONFIG_BNX2 is not set -- --# --# Ethernet (10000 Mbit) --# -+# CONFIG_QLA3XXX is not set -+# CONFIG_ATL1 is not set -+CONFIG_NETDEV_10000=y - # CONFIG_CHELSIO_T1 is not set -+# CONFIG_CHELSIO_T3 is not set -+# CONFIG_IXGBE is not set - # CONFIG_IXGB is not set - # CONFIG_S2IO is not set -- --# --# Token Ring devices --# -+# CONFIG_MYRI10GE is not set -+# CONFIG_NETXEN_NIC is not set -+# CONFIG_NIU is not set -+# CONFIG_MLX4_CORE is not set -+# CONFIG_TEHUTI is not set - # CONFIG_TR is not set - - # --# Wireless LAN (non-hamradio) --# --CONFIG_NET_RADIO=y -- --# --# Obsolete Wireless cards support (pre-802.11) --# --# CONFIG_STRIP is not set -- --# --# Wireless 802.11b ISA/PCI cards support -+# Wireless LAN - # --# CONFIG_AIRO is not set --CONFIG_HERMES=y --# CONFIG_PLX_HERMES is not set --# CONFIG_TMD_HERMES is not set --# CONFIG_NORTEL_HERMES is not set --CONFIG_PCI_HERMES=y --# CONFIG_ATMEL is not set -+# CONFIG_WLAN_PRE80211 is not set -+# CONFIG_WLAN_80211 is not set - - # --# Prism GT/Duette 802.11(a/b/g) PCI/Cardbus support --# --# CONFIG_PRISM54 is not set --# CONFIG_HOSTAP is not set --CONFIG_NET_WIRELESS=y -- --# --# Wan interfaces -+# USB Network Adapters - # -+# CONFIG_USB_CATC is not set -+# CONFIG_USB_KAWETH is not set -+# CONFIG_USB_PEGASUS is not set -+# CONFIG_USB_RTL8150 is not set -+# CONFIG_USB_USBNET is not set - CONFIG_WAN=y --# CONFIG_DSCC4 is not set - # CONFIG_LANMEDIA is not set --# CONFIG_SYNCLINK_SYNCPPP is not set - CONFIG_HDLC=m --CONFIG_HDLC_RAW=y -+CONFIG_HDLC_RAW=m - # CONFIG_HDLC_RAW_ETH is not set --CONFIG_HDLC_CISCO=y --CONFIG_HDLC_FR=y --CONFIG_HDLC_PPP=y --CONFIG_HDLC_X25=y -+CONFIG_HDLC_CISCO=m -+CONFIG_HDLC_FR=m -+CONFIG_HDLC_PPP=m -+CONFIG_HDLC_X25=m - # CONFIG_PCI200SYN is not set - # CONFIG_WANXL is not set - # CONFIG_PC300 is not set -+# CONFIG_PC300TOO is not set - # CONFIG_FARSYNC is not set -+# CONFIG_DSCC4 is not set - CONFIG_DLCI=m --CONFIG_DLCI_COUNT=24 - CONFIG_DLCI_MAX=8 --CONFIG_WAN_ROUTER_DRIVERS=y -+CONFIG_WAN_ROUTER_DRIVERS=m - # CONFIG_CYCLADES_SYNC is not set - # CONFIG_LAPBETHER is not set - # CONFIG_X25_ASY is not set -- --# --# ATM drivers --# -+CONFIG_ATM_DRIVERS=y - # CONFIG_ATM_DUMMY is not set - CONFIG_ATM_TCP=m - # CONFIG_ATM_LANAI is not set -@@ -842,20 +949,19 @@ CONFIG_ATM_TCP=m - # CONFIG_HIPPI is not set - # CONFIG_PPP is not set - # CONFIG_SLIP is not set -+# CONFIG_NET_FC is not set - # CONFIG_SHAPER is not set - # CONFIG_NETCONSOLE is not set - # CONFIG_NETPOLL is not set - # CONFIG_NET_POLL_CONTROLLER is not set -- --# --# ISDN subsystem --# - # CONFIG_ISDN is not set - - # - # Input device support - # - CONFIG_INPUT=y -+# CONFIG_INPUT_FF_MEMLESS is not set -+# CONFIG_INPUT_POLLDEV is not set - - # - # Userland interfaces -@@ -865,7 +971,6 @@ CONFIG_INPUT_MOUSEDEV_PSAUX=y - CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 - CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 - # CONFIG_INPUT_JOYDEV is not set --# CONFIG_INPUT_TSDEV is not set - # CONFIG_INPUT_EVDEV is not set - # CONFIG_INPUT_EVBUG is not set - -@@ -875,8 +980,16 @@ CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 - # CONFIG_INPUT_KEYBOARD is not set - # CONFIG_INPUT_MOUSE is not set - # CONFIG_INPUT_JOYSTICK is not set -+# CONFIG_INPUT_TABLET is not set - # CONFIG_INPUT_TOUCHSCREEN is not set --# CONFIG_INPUT_MISC is not set -+CONFIG_INPUT_MISC=y -+CONFIG_INPUT_IXP4XX_BEEPER=y -+# CONFIG_INPUT_ATI_REMOTE is not set -+# CONFIG_INPUT_ATI_REMOTE2 is not set -+# CONFIG_INPUT_KEYSPAN_REMOTE is not set -+# CONFIG_INPUT_POWERMATE is not set -+# CONFIG_INPUT_YEALINK is not set -+# CONFIG_INPUT_UINPUT is not set - - # - # Hardware I/O ports -@@ -895,7 +1008,9 @@ CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 - # - CONFIG_SERIAL_8250=y - CONFIG_SERIAL_8250_CONSOLE=y -+CONFIG_SERIAL_8250_PCI=y - CONFIG_SERIAL_8250_NR_UARTS=2 -+CONFIG_SERIAL_8250_RUNTIME_UARTS=2 - # CONFIG_SERIAL_8250_EXTENDED is not set - - # -@@ -907,51 +1022,17 @@ CONFIG_SERIAL_CORE_CONSOLE=y - CONFIG_UNIX98_PTYS=y - CONFIG_LEGACY_PTYS=y - CONFIG_LEGACY_PTY_COUNT=256 -- --# --# IPMI --# - # CONFIG_IPMI_HANDLER is not set -- --# --# Watchdog Cards --# --CONFIG_WATCHDOG=y --# CONFIG_WATCHDOG_NOWAYOUT is not set -- --# --# Watchdog Device Drivers --# --# CONFIG_SOFT_WATCHDOG is not set --CONFIG_IXP4XX_WATCHDOG=y -- --# --# PCI-based Watchdog Cards --# --# CONFIG_PCIPCWATCHDOG is not set --# CONFIG_WDTPCI is not set -+CONFIG_HW_RANDOM=m -+CONFIG_HW_RANDOM_IXP4XX=m - # CONFIG_NVRAM is not set --# CONFIG_RTC is not set --# CONFIG_DTLK is not set - # CONFIG_R3964 is not set - # CONFIG_APPLICOM is not set -- --# --# Ftape, the floppy tape device driver --# --# CONFIG_DRM is not set - # CONFIG_RAW_DRIVER is not set -- --# --# TPM devices --# - # CONFIG_TCG_TPM is not set --# CONFIG_TELCLOCK is not set -- --# --# I2C support --# -+CONFIG_DEVPORT=y - CONFIG_I2C=y -+CONFIG_I2C_BOARDINFO=y - CONFIG_I2C_CHARDEV=y - - # -@@ -969,57 +1050,68 @@ CONFIG_I2C_ALGOBIT=y - # CONFIG_I2C_ALI15X3 is not set - # CONFIG_I2C_AMD756 is not set - # CONFIG_I2C_AMD8111 is not set -+# CONFIG_I2C_GPIO is not set - # CONFIG_I2C_I801 is not set - # CONFIG_I2C_I810 is not set - # CONFIG_I2C_PIIX4 is not set - # CONFIG_I2C_IOP3XX is not set - CONFIG_I2C_IXP4XX=y - # CONFIG_I2C_NFORCE2 is not set -+# CONFIG_I2C_OCORES is not set - # CONFIG_I2C_PARPORT_LIGHT is not set - # CONFIG_I2C_PROSAVAGE is not set - # CONFIG_I2C_SAVAGE4 is not set --# CONFIG_SCx200_ACB is not set -+# CONFIG_I2C_SIMTEC is not set - # CONFIG_I2C_SIS5595 is not set - # CONFIG_I2C_SIS630 is not set - # CONFIG_I2C_SIS96X is not set -+# CONFIG_I2C_TAOS_EVM is not set - # CONFIG_I2C_STUB is not set -+# CONFIG_I2C_TINY_USB is not set - # CONFIG_I2C_VIA is not set - # CONFIG_I2C_VIAPRO is not set - # CONFIG_I2C_VOODOO3 is not set --# CONFIG_I2C_PCA_ISA is not set - - # - # Miscellaneous I2C Chip support - # - # CONFIG_SENSORS_DS1337 is not set - # CONFIG_SENSORS_DS1374 is not set -+# CONFIG_DS1682 is not set - CONFIG_SENSORS_EEPROM=y - # CONFIG_SENSORS_PCF8574 is not set - # CONFIG_SENSORS_PCA9539 is not set - # CONFIG_SENSORS_PCF8591 is not set --# CONFIG_SENSORS_RTC8564 is not set - # CONFIG_SENSORS_MAX6875 is not set --# CONFIG_RTC_X1205_I2C is not set -+# CONFIG_SENSORS_TSL2550 is not set - # CONFIG_I2C_DEBUG_CORE is not set - # CONFIG_I2C_DEBUG_ALGO is not set - # CONFIG_I2C_DEBUG_BUS is not set - # CONFIG_I2C_DEBUG_CHIP is not set - - # --# Hardware Monitoring support -+# SPI support - # -+# CONFIG_SPI is not set -+# CONFIG_SPI_MASTER is not set -+# CONFIG_W1 is not set -+# CONFIG_POWER_SUPPLY is not set - CONFIG_HWMON=y - # CONFIG_HWMON_VID is not set -+# CONFIG_SENSORS_AD7418 is not set - # CONFIG_SENSORS_ADM1021 is not set - # CONFIG_SENSORS_ADM1025 is not set - # CONFIG_SENSORS_ADM1026 is not set -+# CONFIG_SENSORS_ADM1029 is not set - # CONFIG_SENSORS_ADM1031 is not set - # CONFIG_SENSORS_ADM9240 is not set --# CONFIG_SENSORS_ASB100 is not set -+# CONFIG_SENSORS_ADT7470 is not set - # CONFIG_SENSORS_ATXP1 is not set - # CONFIG_SENSORS_DS1621 is not set --# CONFIG_SENSORS_FSCHER is not set --# CONFIG_SENSORS_FSCPOS is not set -+# CONFIG_SENSORS_I5K_AMB is not set -+# CONFIG_SENSORS_F71805F is not set -+# CONFIG_SENSORS_F71882FG is not set -+# CONFIG_SENSORS_F75375S is not set - # CONFIG_SENSORS_GL518SM is not set - # CONFIG_SENSORS_GL520SM is not set - # CONFIG_SENSORS_IT87 is not set -@@ -1033,67 +1125,268 @@ CONFIG_HWMON=y - # CONFIG_SENSORS_LM87 is not set - # CONFIG_SENSORS_LM90 is not set - # CONFIG_SENSORS_LM92 is not set -+# CONFIG_SENSORS_LM93 is not set - # CONFIG_SENSORS_MAX1619 is not set -+# CONFIG_SENSORS_MAX6650 is not set - # CONFIG_SENSORS_PC87360 is not set -+# CONFIG_SENSORS_PC87427 is not set - # CONFIG_SENSORS_SIS5595 is not set -+# CONFIG_SENSORS_DME1737 is not set - # CONFIG_SENSORS_SMSC47M1 is not set -+# CONFIG_SENSORS_SMSC47M192 is not set - # CONFIG_SENSORS_SMSC47B397 is not set -+# CONFIG_SENSORS_THMC50 is not set - # CONFIG_SENSORS_VIA686A is not set -+# CONFIG_SENSORS_VT1211 is not set -+# CONFIG_SENSORS_VT8231 is not set - # CONFIG_SENSORS_W83781D is not set -+# CONFIG_SENSORS_W83791D is not set - # CONFIG_SENSORS_W83792D is not set -+# CONFIG_SENSORS_W83793 is not set - # CONFIG_SENSORS_W83L785TS is not set - # CONFIG_SENSORS_W83627HF is not set - # CONFIG_SENSORS_W83627EHF is not set - # CONFIG_HWMON_DEBUG_CHIP is not set -+CONFIG_WATCHDOG=y -+# CONFIG_WATCHDOG_NOWAYOUT is not set - - # --# Misc devices -+# Watchdog Device Drivers - # -+# CONFIG_SOFT_WATCHDOG is not set -+CONFIG_IXP4XX_WATCHDOG=y - - # --# Multimedia Capabilities Port drivers -+# PCI-based Watchdog Cards - # -+# CONFIG_PCIPCWATCHDOG is not set -+# CONFIG_WDTPCI is not set - - # --# Multimedia devices -+# USB-based Watchdog Cards - # --# CONFIG_VIDEO_DEV is not set -+# CONFIG_USBPCWATCHDOG is not set -+ -+# -+# Sonics Silicon Backplane -+# -+CONFIG_SSB_POSSIBLE=y -+# CONFIG_SSB is not set -+ -+# -+# Multifunction device drivers -+# -+# CONFIG_MFD_SM501 is not set - - # --# Digital Video Broadcasting Devices -+# Multimedia devices - # --# CONFIG_DVB is not set -+# CONFIG_VIDEO_DEV is not set -+# CONFIG_DVB_CORE is not set -+CONFIG_DAB=y -+# CONFIG_USB_DABUSB is not set - - # - # Graphics support - # -+# CONFIG_DRM is not set -+# CONFIG_VGASTATE is not set -+# CONFIG_VIDEO_OUTPUT_CONTROL is not set - # CONFIG_FB is not set -+# CONFIG_BACKLIGHT_LCD_SUPPORT is not set -+ -+# -+# Display device support -+# -+# CONFIG_DISPLAY_SUPPORT is not set - - # - # Sound - # - # CONFIG_SOUND is not set -+CONFIG_HID_SUPPORT=y -+CONFIG_HID=y -+# CONFIG_HID_DEBUG is not set -+# CONFIG_HIDRAW is not set - - # --# USB support --# -+# USB Input Devices -+# -+CONFIG_USB_HID=y -+# CONFIG_USB_HIDINPUT_POWERBOOK is not set -+# CONFIG_HID_FF is not set -+# CONFIG_USB_HIDDEV is not set -+CONFIG_USB_SUPPORT=y - CONFIG_USB_ARCH_HAS_HCD=y - CONFIG_USB_ARCH_HAS_OHCI=y --# CONFIG_USB is not set -+CONFIG_USB_ARCH_HAS_EHCI=y -+CONFIG_USB=y -+# CONFIG_USB_DEBUG is not set -+ -+# -+# Miscellaneous USB options -+# -+CONFIG_USB_DEVICEFS=y -+# CONFIG_USB_DEVICE_CLASS is not set -+# CONFIG_USB_DYNAMIC_MINORS is not set -+# CONFIG_USB_OTG is not set -+ -+# -+# USB Host Controller Drivers -+# -+CONFIG_USB_EHCI_HCD=y -+# CONFIG_USB_EHCI_SPLIT_ISO is not set -+# CONFIG_USB_EHCI_ROOT_HUB_TT is not set -+# CONFIG_USB_EHCI_TT_NEWSCHED is not set -+# CONFIG_USB_ISP116X_HCD is not set -+CONFIG_USB_OHCI_HCD=y -+# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set -+# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set -+CONFIG_USB_OHCI_LITTLE_ENDIAN=y -+CONFIG_USB_UHCI_HCD=y -+# CONFIG_USB_SL811_HCD is not set -+# CONFIG_USB_R8A66597_HCD is not set -+ -+# -+# USB Device Class drivers -+# -+# CONFIG_USB_ACM is not set -+# CONFIG_USB_PRINTER is not set - - # - # NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' - # - - # -+# may also be needed; see USB_STORAGE Help for more information -+# -+CONFIG_USB_STORAGE=y -+# CONFIG_USB_STORAGE_DEBUG is not set -+# CONFIG_USB_STORAGE_DATAFAB is not set -+# CONFIG_USB_STORAGE_FREECOM is not set -+# CONFIG_USB_STORAGE_ISD200 is not set -+# CONFIG_USB_STORAGE_DPCM is not set -+# CONFIG_USB_STORAGE_USBAT is not set -+# CONFIG_USB_STORAGE_SDDR09 is not set -+# CONFIG_USB_STORAGE_SDDR55 is not set -+# CONFIG_USB_STORAGE_JUMPSHOT is not set -+# CONFIG_USB_STORAGE_ALAUDA is not set -+# CONFIG_USB_STORAGE_KARMA is not set -+# CONFIG_USB_LIBUSUAL is not set -+ -+# -+# USB Imaging devices -+# -+# CONFIG_USB_MDC800 is not set -+# CONFIG_USB_MICROTEK is not set -+# CONFIG_USB_MON is not set -+ -+# -+# USB port drivers -+# -+ -+# -+# USB Serial Converter support -+# -+# CONFIG_USB_SERIAL is not set -+ -+# -+# USB Miscellaneous drivers -+# -+# CONFIG_USB_EMI62 is not set -+# CONFIG_USB_EMI26 is not set -+# CONFIG_USB_ADUTUX is not set -+# CONFIG_USB_AUERSWALD is not set -+# CONFIG_USB_RIO500 is not set -+# CONFIG_USB_LEGOTOWER is not set -+# CONFIG_USB_LCD is not set -+# CONFIG_USB_BERRY_CHARGE is not set -+# CONFIG_USB_LED is not set -+# CONFIG_USB_CYPRESS_CY7C63 is not set -+# CONFIG_USB_CYTHERM is not set -+# CONFIG_USB_PHIDGET is not set -+# CONFIG_USB_IDMOUSE is not set -+# CONFIG_USB_FTDI_ELAN is not set -+# CONFIG_USB_APPLEDISPLAY is not set -+# CONFIG_USB_SISUSBVGA is not set -+# CONFIG_USB_LD is not set -+# CONFIG_USB_TRANCEVIBRATOR is not set -+# CONFIG_USB_IOWARRIOR is not set -+# CONFIG_USB_TEST is not set -+ -+# -+# USB DSL modem support -+# -+# CONFIG_USB_ATM is not set -+ -+# - # USB Gadget Support - # - # CONFIG_USB_GADGET is not set -+# CONFIG_MMC is not set -+CONFIG_NEW_LEDS=y -+CONFIG_LEDS_CLASS=y - - # --# MMC/SD Card support -+# LED drivers -+# -+CONFIG_LEDS_IXP4XX=y -+# CONFIG_LEDS_GPIO is not set -+ -+# -+# LED Triggers -+# -+CONFIG_LEDS_TRIGGERS=y -+CONFIG_LEDS_TRIGGER_TIMER=y -+CONFIG_LEDS_TRIGGER_IDE_DISK=y -+CONFIG_LEDS_TRIGGER_HEARTBEAT=y -+CONFIG_RTC_LIB=y -+CONFIG_RTC_CLASS=y -+CONFIG_RTC_HCTOSYS=y -+CONFIG_RTC_HCTOSYS_DEVICE="rtc0" -+# CONFIG_RTC_DEBUG is not set -+ -+# -+# RTC interfaces -+# -+CONFIG_RTC_INTF_SYSFS=y -+CONFIG_RTC_INTF_PROC=y -+CONFIG_RTC_INTF_DEV=y -+# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set -+# CONFIG_RTC_DRV_TEST is not set -+ -+# -+# I2C RTC drivers -+# -+# CONFIG_RTC_DRV_DS1307 is not set -+# CONFIG_RTC_DRV_DS1374 is not set -+# CONFIG_RTC_DRV_DS1672 is not set -+# CONFIG_RTC_DRV_MAX6900 is not set -+# CONFIG_RTC_DRV_RS5C372 is not set -+# CONFIG_RTC_DRV_ISL1208 is not set -+CONFIG_RTC_DRV_X1205=y -+CONFIG_RTC_DRV_PCF8563=y -+# CONFIG_RTC_DRV_PCF8583 is not set -+# CONFIG_RTC_DRV_M41T80 is not set -+ -+# -+# SPI RTC drivers -+# -+ -+# -+# Platform RTC drivers -+# -+# CONFIG_RTC_DRV_CMOS is not set -+# CONFIG_RTC_DRV_DS1553 is not set -+# CONFIG_RTC_DRV_STK17TA8 is not set -+# CONFIG_RTC_DRV_DS1742 is not set -+# CONFIG_RTC_DRV_M48T86 is not set -+# CONFIG_RTC_DRV_M48T59 is not set -+# CONFIG_RTC_DRV_V3020 is not set -+ -+# -+# on-CPU RTC drivers - # --# CONFIG_MMC is not set - - # - # File systems -@@ -1107,16 +1400,19 @@ CONFIG_EXT3_FS=y - CONFIG_EXT3_FS_XATTR=y - CONFIG_EXT3_FS_POSIX_ACL=y - # CONFIG_EXT3_FS_SECURITY is not set -+# CONFIG_EXT4DEV_FS is not set - CONFIG_JBD=y --# CONFIG_JBD_DEBUG is not set - CONFIG_FS_MBCACHE=y - # CONFIG_REISERFS_FS is not set - # CONFIG_JFS_FS is not set - CONFIG_FS_POSIX_ACL=y - # CONFIG_XFS_FS is not set -+# CONFIG_GFS2_FS is not set -+# CONFIG_OCFS2_FS is not set - # CONFIG_MINIX_FS is not set - # CONFIG_ROMFS_FS is not set - CONFIG_INOTIFY=y -+CONFIG_INOTIFY_USER=y - # CONFIG_QUOTA is not set - CONFIG_DNOTIFY=y - # CONFIG_AUTOFS_FS is not set -@@ -1140,11 +1436,12 @@ CONFIG_DNOTIFY=y - # Pseudo filesystems - # - CONFIG_PROC_FS=y -+CONFIG_PROC_SYSCTL=y - CONFIG_SYSFS=y - CONFIG_TMPFS=y -+# CONFIG_TMPFS_POSIX_ACL is not set - # CONFIG_HUGETLB_PAGE is not set --CONFIG_RAMFS=y --# CONFIG_RELAYFS_FS is not set -+# CONFIG_CONFIGFS_FS is not set - - # - # Miscellaneous filesystems -@@ -1156,13 +1453,15 @@ CONFIG_RAMFS=y - # CONFIG_BEFS_FS is not set - # CONFIG_BFS_FS is not set - # CONFIG_EFS_FS is not set --# CONFIG_JFFS_FS is not set - CONFIG_JFFS2_FS=y - CONFIG_JFFS2_FS_DEBUG=0 - CONFIG_JFFS2_FS_WRITEBUFFER=y -+# CONFIG_JFFS2_FS_WBUF_VERIFY is not set - # CONFIG_JFFS2_SUMMARY is not set -+# CONFIG_JFFS2_FS_XATTR is not set - # CONFIG_JFFS2_COMPRESSION_OPTIONS is not set - CONFIG_JFFS2_ZLIB=y -+# CONFIG_JFFS2_LZO is not set - CONFIG_JFFS2_RTIME=y - # CONFIG_JFFS2_RUBIN is not set - # CONFIG_CRAMFS is not set -@@ -1171,10 +1470,7 @@ CONFIG_JFFS2_RTIME=y - # CONFIG_QNX4FS_FS is not set - # CONFIG_SYSV_FS is not set - # CONFIG_UFS_FS is not set -- --# --# Network File Systems --# -+CONFIG_NETWORK_FILESYSTEMS=y - CONFIG_NFS_FS=y - CONFIG_NFS_V3=y - # CONFIG_NFS_V3_ACL is not set -@@ -1186,6 +1482,7 @@ CONFIG_LOCKD=y - CONFIG_LOCKD_V4=y - CONFIG_NFS_COMMON=y - CONFIG_SUNRPC=y -+# CONFIG_SUNRPC_BIND34 is not set - # CONFIG_RPCSEC_GSS_KRB5 is not set - # CONFIG_RPCSEC_GSS_SPKM3 is not set - # CONFIG_SMB_FS is not set -@@ -1193,7 +1490,6 @@ CONFIG_SUNRPC=y - # CONFIG_NCP_FS is not set - # CONFIG_CODA_FS is not set - # CONFIG_AFS_FS is not set --# CONFIG_9P_FS is not set - - # - # Partition Types -@@ -1213,37 +1509,53 @@ CONFIG_MSDOS_PARTITION=y - # CONFIG_SGI_PARTITION is not set - # CONFIG_ULTRIX_PARTITION is not set - # CONFIG_SUN_PARTITION is not set -+# CONFIG_KARMA_PARTITION is not set - # CONFIG_EFI_PARTITION is not set -- --# --# Native Language Support --# -+# CONFIG_SYSV68_PARTITION is not set - # CONFIG_NLS is not set -- --# --# Profiling support --# -+# CONFIG_DLM is not set -+CONFIG_INSTRUMENTATION=y - # CONFIG_PROFILING is not set -+# CONFIG_MARKERS is not set - - # - # Kernel hacking - # - # CONFIG_PRINTK_TIME is not set --CONFIG_DEBUG_KERNEL=y -+CONFIG_ENABLE_WARN_DEPRECATED=y -+CONFIG_ENABLE_MUST_CHECK=y - CONFIG_MAGIC_SYSRQ=y --CONFIG_LOG_BUF_SHIFT=14 -+# CONFIG_UNUSED_SYMBOLS is not set -+# CONFIG_DEBUG_FS is not set -+# CONFIG_HEADERS_CHECK is not set -+CONFIG_DEBUG_KERNEL=y -+# CONFIG_DEBUG_SHIRQ is not set - CONFIG_DETECT_SOFTLOCKUP=y -+CONFIG_SCHED_DEBUG=y - # CONFIG_SCHEDSTATS is not set --# CONFIG_DEBUG_SLAB is not set -+# CONFIG_TIMER_STATS is not set -+# CONFIG_SLUB_DEBUG_ON is not set -+# CONFIG_DEBUG_RT_MUTEXES is not set -+# CONFIG_RT_MUTEX_TESTER is not set - # CONFIG_DEBUG_SPINLOCK is not set -+# CONFIG_DEBUG_MUTEXES is not set -+# CONFIG_DEBUG_LOCK_ALLOC is not set -+# CONFIG_PROVE_LOCKING is not set -+# CONFIG_LOCK_STAT is not set - # CONFIG_DEBUG_SPINLOCK_SLEEP is not set -+# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set - # CONFIG_DEBUG_KOBJECT is not set - CONFIG_DEBUG_BUGVERBOSE=y - # CONFIG_DEBUG_INFO is not set --# CONFIG_DEBUG_FS is not set - # CONFIG_DEBUG_VM is not set -+# CONFIG_DEBUG_LIST is not set -+# CONFIG_DEBUG_SG is not set - CONFIG_FRAME_POINTER=y -+CONFIG_FORCED_INLINING=y -+# CONFIG_BOOT_PRINTK_DELAY is not set - # CONFIG_RCU_TORTURE_TEST is not set -+# CONFIG_FAULT_INJECTION is not set -+# CONFIG_SAMPLES is not set - # CONFIG_DEBUG_USER is not set - CONFIG_DEBUG_ERRORS=y - CONFIG_DEBUG_LL=y -@@ -1254,22 +1566,22 @@ CONFIG_DEBUG_LL=y - # - # CONFIG_KEYS is not set - # CONFIG_SECURITY is not set -- --# --# Cryptographic options --# -+# CONFIG_SECURITY_FILE_CAPABILITIES is not set - # CONFIG_CRYPTO is not set - - # --# Hardware crypto devices --# -- --# - # Library routines - # -+CONFIG_BITREVERSE=y - # CONFIG_CRC_CCITT is not set - # CONFIG_CRC16 is not set -+# CONFIG_CRC_ITU_T is not set - CONFIG_CRC32=y -+# CONFIG_CRC7 is not set - # CONFIG_LIBCRC32C is not set - CONFIG_ZLIB_INFLATE=y - CONFIG_ZLIB_DEFLATE=y -+CONFIG_PLIST=y -+CONFIG_HAS_IOMEM=y -+CONFIG_HAS_IOPORT=y -+CONFIG_HAS_DMA=y diff --git a/target/linux/ixp4xx/patches-2.6.24/016-dsmg600_auto_power_on.patch b/target/linux/ixp4xx/patches-2.6.24/016-dsmg600_auto_power_on.patch deleted file mode 100644 index a95da08a0e..0000000000 --- a/target/linux/ixp4xx/patches-2.6.24/016-dsmg600_auto_power_on.patch +++ /dev/null @@ -1,122 +0,0 @@ -From 67e494e3e03ef807255f084800d8658b89ff5fec Mon Sep 17 00:00:00 2001 -From: Rod Whitby <rod@whitby.id.au> -Date: Tue, 29 Jan 2008 10:00:25 +1030 -Subject: ixp4xx: Button updates for the dsmg600 board (Patch #4769) - - * Remove the superfluous declaration of ctrl_alt_del(). - * Convert GPIO and IRQ handling to use the <asm/gpio.h> api. - * Perform the reset on the release of the power button, so that - NAS devices which have been set to auto-power-on (by solder - bridging the power button) do not continuously power cycle. - * Remove all superflous constants from dsmg600.h - -Signed-off-by: Rod Whitby <rod@whitby.id.au> -Acked-by: Lennert Buytenhek <buytenh@wantstofly.org> - -PATCH FOLLOWS -KernelVersion: 2.6.24-git5 - -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/dsmg600-power.c -=================================================================== ---- linux-2.6.24.7.orig/arch/arm/mach-ixp4xx/dsmg600-power.c -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/dsmg600-power.c -@@ -26,14 +26,13 @@ - #include <linux/jiffies.h> - #include <linux/timer.h> - -+#include <asm/gpio.h> - #include <asm/mach-types.h> - --extern void ctrl_alt_del(void); -- - /* This is used to make sure the power-button pusher is serious. The button - * must be held until the value of this counter reaches zero. - */ --static volatile int power_button_countdown; -+static int power_button_countdown; - - /* Must hold the button down for at least this many counts to be processed */ - #define PBUTTON_HOLDDOWN_COUNT 4 /* 2 secs */ -@@ -47,22 +46,27 @@ static void dsmg600_power_handler(unsign - * state of the power button. - */ - -- if (*IXP4XX_GPIO_GPINR & DSMG600_PB_BM) { -+ if (gpio_get_value(DSMG600_PB_GPIO)) { - - /* IO Pin is 1 (button pushed) */ -+ if (power_button_countdown > 0) -+ power_button_countdown--; -+ -+ } else { -+ -+ /* Done on button release, to allow for auto-power-on mods. */ - if (power_button_countdown == 0) { -- /* Signal init to do the ctrlaltdel action, this will bypass -- * init if it hasn't started and do a kernel_restart. -+ /* Signal init to do the ctrlaltdel action, -+ * this will bypass init if it hasn't started -+ * and do a kernel_restart. - */ - ctrl_alt_del(); - - /* Change the state of the power LED to "blink" */ - gpio_line_set(DSMG600_LED_PWR_GPIO, IXP4XX_GPIO_LOW); -+ } else { -+ power_button_countdown = PBUTTON_HOLDDOWN_COUNT; - } -- power_button_countdown--; -- -- } else { -- power_button_countdown = PBUTTON_HOLDDOWN_COUNT; - } - - mod_timer(&dsmg600_power_timer, jiffies + msecs_to_jiffies(500)); -@@ -81,12 +85,12 @@ static int __init dsmg600_power_init(voi - if (!(machine_is_dsmg600())) - return 0; - -- if (request_irq(DSMG600_RB_IRQ, &dsmg600_reset_handler, -+ if (request_irq(gpio_to_irq(DSMG600_RB_GPIO), &dsmg600_reset_handler, - IRQF_DISABLED | IRQF_TRIGGER_LOW, "DSM-G600 reset button", - NULL) < 0) { - - printk(KERN_DEBUG "Reset Button IRQ %d not available\n", -- DSMG600_RB_IRQ); -+ gpio_to_irq(DSMG600_RB_GPIO)); - - return -EIO; - } -@@ -114,7 +118,7 @@ static void __exit dsmg600_power_exit(vo - - del_timer_sync(&dsmg600_power_timer); - -- free_irq(DSMG600_RB_IRQ, NULL); -+ free_irq(gpio_to_irq(DSMG600_RB_GPIO), NULL); - } - - module_init(dsmg600_power_init); -Index: linux-2.6.24.7/include/asm-arm/arch-ixp4xx/dsmg600.h -=================================================================== ---- linux-2.6.24.7.orig/include/asm-arm/arch-ixp4xx/dsmg600.h -+++ linux-2.6.24.7/include/asm-arm/arch-ixp4xx/dsmg600.h -@@ -40,18 +40,13 @@ - /* Buttons */ - - #define DSMG600_PB_GPIO 15 /* power button */ --#define DSMG600_PB_BM (1L << DSMG600_PB_GPIO) -- - #define DSMG600_RB_GPIO 3 /* reset button */ - --#define DSMG600_RB_IRQ IRQ_IXP4XX_GPIO3 -+/* Power control */ - - #define DSMG600_PO_GPIO 2 /* power off */ - - /* LEDs */ - - #define DSMG600_LED_PWR_GPIO 0 --#define DSMG600_LED_PWR_BM (1L << DSMG600_LED_PWR_GPIO) -- - #define DSMG600_LED_WLAN_GPIO 14 --#define DSMG600_LED_WLAN_BM (1L << DSMG600_LED_WLAN_GPIO) diff --git a/target/linux/ixp4xx/patches-2.6.24/017-nas100d_auto_power_on.patch b/target/linux/ixp4xx/patches-2.6.24/017-nas100d_auto_power_on.patch deleted file mode 100644 index 3c66cb45fe..0000000000 --- a/target/linux/ixp4xx/patches-2.6.24/017-nas100d_auto_power_on.patch +++ /dev/null @@ -1,194 +0,0 @@ -From 6261e59795d861f21f63878944900a3da713348c Mon Sep 17 00:00:00 2001 -From: Rod Whitby <rod@whitby.id.au> -Date: Tue, 29 Jan 2008 09:53:46 +1030 -Subject: ixp4xx: Button and LED updates for the nas100d board (Patch #4768) - - * Convert GPIO and IRQ handling to use the <asm/gpio.h> api. - * Perform the reset only after the power button has been held down - for at least two seconds. Do the reset on the release of the power - button, so that NAS devices which have been set to auto-power-on (by - solder bridging the power button) do not continuously power cycle. - * Remove all superflous constants from nas100d.h - * Add LED constants to nas100d.h while we're there. - * Update the board LED setup code to use those constants. - -Signed-off-by: Rod Whitby <rod@whitby.id.au> -Acked-by: Lennert Buytenhek <buytenh@wantstofly.org> - -PATCH FOLLOWS -KernelVersion: 2.6.24-git5 - -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/nas100d-power.c -=================================================================== ---- linux-2.6.24.7.orig/arch/arm/mach-ixp4xx/nas100d-power.c -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/nas100d-power.c -@@ -21,15 +21,59 @@ - #include <linux/irq.h> - #include <linux/module.h> - #include <linux/reboot.h> -+#include <linux/jiffies.h> -+#include <linux/timer.h> - -+#include <asm/gpio.h> - #include <asm/mach-types.h> - --static irqreturn_t nas100d_reset_handler(int irq, void *dev_id) -+/* This is used to make sure the power-button pusher is serious. The button -+ * must be held until the value of this counter reaches zero. -+ */ -+static int power_button_countdown; -+ -+/* Must hold the button down for at least this many counts to be processed */ -+#define PBUTTON_HOLDDOWN_COUNT 4 /* 2 secs */ -+ -+static void nas100d_power_handler(unsigned long data); -+static DEFINE_TIMER(nas100d_power_timer, nas100d_power_handler, 0, 0); -+ -+static void nas100d_power_handler(unsigned long data) - { -- /* Signal init to do the ctrlaltdel action, this will bypass init if -- * it hasn't started and do a kernel_restart. -+ /* This routine is called twice per second to check the -+ * state of the power button. - */ -- ctrl_alt_del(); -+ -+ if (gpio_get_value(NAS100D_PB_GPIO)) { -+ -+ /* IO Pin is 1 (button pushed) */ -+ if (power_button_countdown > 0) -+ power_button_countdown--; -+ -+ } else { -+ -+ /* Done on button release, to allow for auto-power-on mods. */ -+ if (power_button_countdown == 0) { -+ /* Signal init to do the ctrlaltdel action, -+ * this will bypass init if it hasn't started -+ * and do a kernel_restart. -+ */ -+ ctrl_alt_del(); -+ -+ /* Change the state of the power LED to "blink" */ -+ gpio_line_set(NAS100D_LED_PWR_GPIO, IXP4XX_GPIO_LOW); -+ } else { -+ power_button_countdown = PBUTTON_HOLDDOWN_COUNT; -+ } -+ } -+ -+ mod_timer(&nas100d_power_timer, jiffies + msecs_to_jiffies(500)); -+} -+ -+static irqreturn_t nas100d_reset_handler(int irq, void *dev_id) -+{ -+ /* This is the paper-clip reset, it shuts the machine down directly. */ -+ machine_power_off(); - - return IRQ_HANDLED; - } -@@ -39,17 +83,30 @@ static int __init nas100d_power_init(voi - if (!(machine_is_nas100d())) - return 0; - -- set_irq_type(NAS100D_RB_IRQ, IRQT_LOW); -+ set_irq_type(gpio_to_irq(NAS100D_RB_GPIO), IRQT_LOW); - -- if (request_irq(NAS100D_RB_IRQ, &nas100d_reset_handler, -+ if (request_irq(gpio_to_irq(NAS100D_RB_GPIO), &nas100d_reset_handler, - IRQF_DISABLED, "NAS100D reset button", NULL) < 0) { - - printk(KERN_DEBUG "Reset Button IRQ %d not available\n", -- NAS100D_RB_IRQ); -+ gpio_to_irq(NAS100D_RB_GPIO)); - - return -EIO; - } - -+ /* The power button on the Iomega NAS100d is on GPIO 14, but -+ * it cannot handle interrupts on that GPIO line. So we'll -+ * have to poll it with a kernel timer. -+ */ -+ -+ /* Make sure that the power button GPIO is set up as an input */ -+ gpio_line_config(NAS100D_PB_GPIO, IXP4XX_GPIO_IN); -+ -+ /* Set the initial value for the power button IRQ handler */ -+ power_button_countdown = PBUTTON_HOLDDOWN_COUNT; -+ -+ mod_timer(&nas100d_power_timer, jiffies + msecs_to_jiffies(500)); -+ - return 0; - } - -@@ -58,7 +115,9 @@ static void __exit nas100d_power_exit(vo - if (!(machine_is_nas100d())) - return; - -- free_irq(NAS100D_RB_IRQ, NULL); -+ del_timer_sync(&nas100d_power_timer); -+ -+ free_irq(gpio_to_irq(NAS100D_RB_GPIO), NULL); - } - - module_init(nas100d_power_init); -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/nas100d-setup.c -=================================================================== ---- linux-2.6.24.7.orig/arch/arm/mach-ixp4xx/nas100d-setup.c -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/nas100d-setup.c -@@ -43,20 +43,20 @@ static struct platform_device nas100d_fl - static struct resource nas100d_led_resources[] = { - { - .name = "wlan", /* green led */ -- .start = 0, -- .end = 0, -+ .start = NAS100D_LED_WLAN_GPIO, -+ .end = NAS100D_LED_WLAN_GPIO, - .flags = IXP4XX_GPIO_LOW, - }, - { -- .name = "ready", /* blue power led (off is flashing!) */ -- .start = 15, -- .end = 15, -+ .name = "power", /* blue power led (off=flashing) */ -+ .start = NAS100D_LED_PWR_GPIO, -+ .end = NAS100D_LED_PWR_GPIO, - .flags = IXP4XX_GPIO_LOW, - }, - { - .name = "disk", /* yellow led */ -- .start = 3, -- .end = 3, -+ .start = NAS100D_LED_DISK_GPIO, -+ .end = NAS100D_LED_DISK_GPIO, - .flags = IXP4XX_GPIO_LOW, - }, - }; -Index: linux-2.6.24.7/include/asm-arm/arch-ixp4xx/nas100d.h -=================================================================== ---- linux-2.6.24.7.orig/include/asm-arm/arch-ixp4xx/nas100d.h -+++ linux-2.6.24.7/include/asm-arm/arch-ixp4xx/nas100d.h -@@ -38,15 +38,15 @@ - - /* Buttons */ - --#define NAS100D_PB_GPIO 14 --#define NAS100D_RB_GPIO 4 -+#define NAS100D_PB_GPIO 14 /* power button */ -+#define NAS100D_RB_GPIO 4 /* reset button */ -+ -+/* Power control */ -+ - #define NAS100D_PO_GPIO 12 /* power off */ - --#define NAS100D_PB_IRQ IRQ_IXP4XX_GPIO14 --#define NAS100D_RB_IRQ IRQ_IXP4XX_GPIO4 -+/* LEDs */ - --/* --#define NAS100D_PB_BM (1L << NAS100D_PB_GPIO) --#define NAS100D_PO_BM (1L << NAS100D_PO_GPIO) --#define NAS100D_RB_BM (1L << NAS100D_RB_GPIO) --*/ -+#define NAS100D_LED_WLAN_GPIO 0 -+#define NAS100D_LED_DISK_GPIO 3 -+#define NAS100D_LED_PWR_GPIO 15 diff --git a/target/linux/ixp4xx/patches-2.6.24/020-ixp4xx_rtc_info.patch b/target/linux/ixp4xx/patches-2.6.24/020-ixp4xx_rtc_info.patch deleted file mode 100644 index 60a3c28c1d..0000000000 --- a/target/linux/ixp4xx/patches-2.6.24/020-ixp4xx_rtc_info.patch +++ /dev/null @@ -1,119 +0,0 @@ -From 88721db37ead2212a54c1392e2e65bae78d2604b Mon Sep 17 00:00:00 2001 -From: Rod Whitby <rod@whitby.id.au> -Date: Tue, 29 Jan 2008 10:05:48 +1030 -Subject: ixp4xx: Register nslu2 rtc i2c_board_info (Patch #4772) - -Register the i2c board info related to the RTC chip on the nslu2 board -to allow it to be found automatically on boot. - -Signed-off-by: Rod Whitby <rod@whitby.id.au> -Signed-off-by: Alessandro Zummo <a.zummo@towertech.it> - -PATCH FOLLOWS -KernelVersion: 2.6.24-git5 - -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/nslu2-setup.c -=================================================================== ---- linux-2.6.24.7.orig/arch/arm/mach-ixp4xx/nslu2-setup.c -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/nslu2-setup.c -@@ -18,6 +18,7 @@ - #include <linux/serial.h> - #include <linux/serial_8250.h> - #include <linux/leds.h> -+#include <linux/i2c.h> - #include <linux/i2c-gpio.h> - - #include <asm/mach-types.h> -@@ -47,6 +48,12 @@ static struct i2c_gpio_platform_data nsl - .scl_pin = NSLU2_SCL_PIN, - }; - -+static struct i2c_board_info __initdata nslu2_i2c_board_info [] = { -+ { -+ I2C_BOARD_INFO("rtc-x1205", 0x6f), -+ }, -+}; -+ - #ifdef CONFIG_LEDS_IXP4XX - static struct resource nslu2_led_resources[] = { - { -@@ -183,6 +190,9 @@ static void __init nslu2_init(void) - - pm_power_off = nslu2_power_off; - -+ i2c_register_board_info(0, nslu2_i2c_board_info, -+ ARRAY_SIZE(nslu2_i2c_board_info)); -+ - /* - * This is only useful on a modified machine, but it is valuable - * to have it first in order to see debug messages, and so that -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/nas100d-setup.c -=================================================================== ---- linux-2.6.24.7.orig/arch/arm/mach-ixp4xx/nas100d-setup.c -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/nas100d-setup.c -@@ -16,6 +16,7 @@ - #include <linux/serial.h> - #include <linux/serial_8250.h> - #include <linux/leds.h> -+#include <linux/i2c.h> - #include <linux/i2c-gpio.h> - - #include <asm/mach-types.h> -@@ -39,6 +40,12 @@ static struct platform_device nas100d_fl - .resource = &nas100d_flash_resource, - }; - -+static struct i2c_board_info __initdata nas100d_i2c_board_info [] = { -+ { -+ I2C_BOARD_INFO("rtc-pcf8563", 0x51), -+ }, -+}; -+ - #ifdef CONFIG_LEDS_IXP4XX - static struct resource nas100d_led_resources[] = { - { -@@ -157,6 +164,9 @@ static void __init nas100d_init(void) - - pm_power_off = nas100d_power_off; - -+ i2c_register_board_info(0, nas100d_i2c_board_info, -+ ARRAY_SIZE(nas100d_i2c_board_info)); -+ - /* - * This is only useful on a modified machine, but it is valuable - * to have it first in order to see debug messages, and so that -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/dsmg600-setup.c -=================================================================== ---- linux-2.6.24.7.orig/arch/arm/mach-ixp4xx/dsmg600-setup.c -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/dsmg600-setup.c -@@ -14,6 +14,7 @@ - #include <linux/kernel.h> - #include <linux/serial.h> - #include <linux/serial_8250.h> -+#include <linux/i2c.h> - #include <linux/i2c-gpio.h> - - #include <asm/mach-types.h> -@@ -51,6 +52,12 @@ static struct platform_device dsmg600_i2 - }, - }; - -+static struct i2c_board_info __initdata dsmg600_i2c_board_info [] = { -+ { -+ I2C_BOARD_INFO("rtc-pcf8563", 0x51), -+ }, -+}; -+ - #ifdef CONFIG_LEDS_CLASS - static struct resource dsmg600_led_resources[] = { - { -@@ -158,6 +165,9 @@ static void __init dsmg600_init(void) - - pm_power_off = dsmg600_power_off; - -+ i2c_register_board_info(0, dsmg600_i2c_board_info, -+ ARRAY_SIZE(dsmg600_i2c_board_info)); -+ - /* The UART is required on the DSM-G600 (Redboot cannot use the - * NIC) -- do it here so that it does *not* get removed if - * platform_add_devices fails! diff --git a/target/linux/ixp4xx/patches-2.6.24/021-ixp4xx_use_leds_gpio.patch b/target/linux/ixp4xx/patches-2.6.24/021-ixp4xx_use_leds_gpio.patch deleted file mode 100644 index 58c6ad9e3d..0000000000 --- a/target/linux/ixp4xx/patches-2.6.24/021-ixp4xx_use_leds_gpio.patch +++ /dev/null @@ -1,239 +0,0 @@ -From 383256474f2ba043bdb57a657f9d786df88780f1 Mon Sep 17 00:00:00 2001 -From: Rod Whitby <rod@whitby.id.au> -Date: Tue, 29 Jan 2008 17:17:29 +1030 -Subject: ixp4xx: Use leds-gpio driver instead of IXP4XX-GPIO-LED driver - -These are the only three boards to use the IXP4XX-GPIO-LED driver, and -they can all use the new leds-gpio driver instead with no change in -functionality. - -Signed-off-by: Rod Whitby <rod@whitby.id.au> --- -PATCH FOLLOWS -KernelVersion: v2.6.24-1915-gc9b12e6 - -Index: linux-2.6.24.7/arch/arm/configs/ixp4xx_defconfig -=================================================================== ---- linux-2.6.24.7.orig/arch/arm/configs/ixp4xx_defconfig -+++ linux-2.6.24.7/arch/arm/configs/ixp4xx_defconfig -@@ -1330,8 +1330,8 @@ CONFIG_LEDS_CLASS=y - # - # LED drivers - # --CONFIG_LEDS_IXP4XX=y --# CONFIG_LEDS_GPIO is not set -+# CONFIG_LEDS_IXP4XX is not set -+CONFIG_LEDS_GPIO=y - - # - # LED Triggers -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/dsmg600-setup.c -=================================================================== ---- linux-2.6.24.7.orig/arch/arm/mach-ixp4xx/dsmg600-setup.c -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/dsmg600-setup.c -@@ -14,6 +14,7 @@ - #include <linux/kernel.h> - #include <linux/serial.h> - #include <linux/serial_8250.h> -+#include <linux/leds.h> - #include <linux/i2c.h> - #include <linux/i2c-gpio.h> - -@@ -58,29 +59,28 @@ static struct i2c_board_info __initdata - }, - }; - --#ifdef CONFIG_LEDS_CLASS --static struct resource dsmg600_led_resources[] = { -+static struct gpio_led dsmg600_led_pins[] = { - { -- .name = "power", -- .start = DSMG600_LED_PWR_GPIO, -- .end = DSMG600_LED_PWR_GPIO, -- .flags = IXP4XX_GPIO_HIGH, -+ .name = "power", -+ .gpio = DSMG600_LED_PWR_GPIO, - }, - { -- .name = "wlan", -- .start = DSMG600_LED_WLAN_GPIO, -- .end = DSMG600_LED_WLAN_GPIO, -- .flags = IXP4XX_GPIO_LOW, -+ .name = "wlan", -+ .gpio = DSMG600_LED_WLAN_GPIO, -+ .active_low = true, - }, - }; - -+static struct gpio_led_platform_data dsmg600_led_data = { -+ .num_leds = ARRAY_SIZE(dsmg600_led_pins), -+ .leds = dsmg600_led_pins, -+}; -+ - static struct platform_device dsmg600_leds = { -- .name = "IXP4XX-GPIO-LED", -- .id = -1, -- .num_resources = ARRAY_SIZE(dsmg600_led_resources), -- .resource = dsmg600_led_resources, -+ .name = "leds-gpio", -+ .id = -1, -+ .dev.platform_data = &dsmg600_led_data, - }; --#endif - - static struct resource dsmg600_uart_resources[] = { - { -@@ -128,6 +128,7 @@ static struct platform_device dsmg600_ua - static struct platform_device *dsmg600_devices[] __initdata = { - &dsmg600_i2c_gpio, - &dsmg600_flash, -+ &dsmg600_leds, - }; - - static void dsmg600_power_off(void) -@@ -175,11 +176,6 @@ static void __init dsmg600_init(void) - (void)platform_device_register(&dsmg600_uart); - - platform_add_devices(dsmg600_devices, ARRAY_SIZE(dsmg600_devices)); -- --#ifdef CONFIG_LEDS_CLASS -- /* We don't care whether or not this works. */ -- (void)platform_device_register(&dsmg600_leds); --#endif - } - - MACHINE_START(DSMG600, "D-Link DSM-G600 RevA") -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/nas100d-setup.c -=================================================================== ---- linux-2.6.24.7.orig/arch/arm/mach-ixp4xx/nas100d-setup.c -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/nas100d-setup.c -@@ -46,35 +46,34 @@ static struct i2c_board_info __initdata - }, - }; - --#ifdef CONFIG_LEDS_IXP4XX --static struct resource nas100d_led_resources[] = { -+static struct gpio_led nas100d_led_pins[] = { - { - .name = "wlan", /* green led */ -- .start = NAS100D_LED_WLAN_GPIO, -- .end = NAS100D_LED_WLAN_GPIO, -- .flags = IXP4XX_GPIO_LOW, -+ .gpio = NAS100D_LED_WLAN_GPIO, -+ .active_low = true, - }, - { - .name = "power", /* blue power led (off=flashing) */ -- .start = NAS100D_LED_PWR_GPIO, -- .end = NAS100D_LED_PWR_GPIO, -- .flags = IXP4XX_GPIO_LOW, -+ .gpio = NAS100D_LED_PWR_GPIO, -+ .active_low = true, - }, - { - .name = "disk", /* yellow led */ -- .start = NAS100D_LED_DISK_GPIO, -- .end = NAS100D_LED_DISK_GPIO, -- .flags = IXP4XX_GPIO_LOW, -+ .gpio = NAS100D_LED_DISK_GPIO, -+ .active_low = true, - }, - }; - -+static struct gpio_led_platform_data nas100d_led_data = { -+ .num_leds = ARRAY_SIZE(nas100d_led_pins), -+ .leds = nas100d_led_pins, -+}; -+ - static struct platform_device nas100d_leds = { -- .name = "IXP4XX-GPIO-LED", -+ .name = "leds-gpio", - .id = -1, -- .num_resources = ARRAY_SIZE(nas100d_led_resources), -- .resource = nas100d_led_resources, -+ .dev.platform_data = &nas100d_led_data, - }; --#endif - - static struct i2c_gpio_platform_data nas100d_i2c_gpio_data = { - .sda_pin = NAS100D_SDA_PIN, -@@ -135,9 +134,7 @@ static struct platform_device nas100d_ua - static struct platform_device *nas100d_devices[] __initdata = { - &nas100d_i2c_gpio, - &nas100d_flash, --#ifdef CONFIG_LEDS_IXP4XX - &nas100d_leds, --#endif - }; - - static void nas100d_power_off(void) -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/nslu2-setup.c -=================================================================== ---- linux-2.6.24.7.orig/arch/arm/mach-ixp4xx/nslu2-setup.c -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/nslu2-setup.c -@@ -54,41 +54,37 @@ static struct i2c_board_info __initdata - }, - }; - --#ifdef CONFIG_LEDS_IXP4XX --static struct resource nslu2_led_resources[] = { -+static struct gpio_led nslu2_led_pins[] = { - { - .name = "ready", /* green led */ -- .start = NSLU2_LED_GRN_GPIO, -- .end = NSLU2_LED_GRN_GPIO, -- .flags = IXP4XX_GPIO_HIGH, -+ .gpio = NSLU2_LED_GRN_GPIO, - }, - { - .name = "status", /* red led */ -- .start = NSLU2_LED_RED_GPIO, -- .end = NSLU2_LED_RED_GPIO, -- .flags = IXP4XX_GPIO_HIGH, -+ .gpio = NSLU2_LED_RED_GPIO, - }, - { - .name = "disk-1", -- .start = NSLU2_LED_DISK1_GPIO, -- .end = NSLU2_LED_DISK1_GPIO, -- .flags = IXP4XX_GPIO_LOW, -+ .gpio = NSLU2_LED_DISK1_GPIO, -+ .active_low = true, - }, - { - .name = "disk-2", -- .start = NSLU2_LED_DISK2_GPIO, -- .end = NSLU2_LED_DISK2_GPIO, -- .flags = IXP4XX_GPIO_LOW, -+ .gpio = NSLU2_LED_DISK2_GPIO, -+ .active_low = true, - }, - }; - -+static struct gpio_led_platform_data nslu2_led_data = { -+ .num_leds = ARRAY_SIZE(nslu2_led_pins), -+ .leds = nslu2_led_pins, -+}; -+ - static struct platform_device nslu2_leds = { -- .name = "IXP4XX-GPIO-LED", -+ .name = "leds-gpio", - .id = -1, -- .num_resources = ARRAY_SIZE(nslu2_led_resources), -- .resource = nslu2_led_resources, -+ .dev.platform_data = &nslu2_led_data, - }; --#endif - - static struct platform_device nslu2_i2c_gpio = { - .name = "i2c-gpio", -@@ -151,9 +147,7 @@ static struct platform_device *nslu2_dev - &nslu2_i2c_gpio, - &nslu2_flash, - &nslu2_beeper, --#ifdef CONFIG_LEDS_IXP4XX - &nslu2_leds, --#endif - }; - - static void nslu2_power_off(void) diff --git a/target/linux/ixp4xx/patches-2.6.24/030-ixp4xx_fsg_board_support.patch b/target/linux/ixp4xx/patches-2.6.24/030-ixp4xx_fsg_board_support.patch deleted file mode 100644 index bf77df7b58..0000000000 --- a/target/linux/ixp4xx/patches-2.6.24/030-ixp4xx_fsg_board_support.patch +++ /dev/null @@ -1,772 +0,0 @@ -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/Kconfig -=================================================================== ---- linux-2.6.24.7.orig/arch/arm/mach-ixp4xx/Kconfig -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/Kconfig -@@ -125,6 +125,15 @@ config ARCH_IXDP4XX - depends on ARCH_IXDP425 || MACH_IXDP465 || MACH_KIXRP435 - default y - -+config MACH_FSG -+ bool -+ prompt "Freecom FSG-3" -+ select PCI -+ help -+ Say 'Y' here if you want your kernel to support Freecom's -+ FSG-3 device. For more information on this platform, -+ see http://www.nslu2-linux.org/wiki/FSG3/HomePage -+ - # - # Certain registers and IRQs are only enabled if supporting IXP465 CPUs - # -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/Makefile -=================================================================== ---- linux-2.6.24.7.orig/arch/arm/mach-ixp4xx/Makefile -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/Makefile -@@ -15,6 +15,7 @@ obj-pci-$(CONFIG_MACH_NAS100D) += nas10 - obj-pci-$(CONFIG_MACH_DSMG600) += dsmg600-pci.o - obj-pci-$(CONFIG_MACH_GATEWAY7001) += gateway7001-pci.o - obj-pci-$(CONFIG_MACH_WG302V2) += wg302v2-pci.o -+obj-pci-$(CONFIG_MACH_FSG) += fsg-pci.o - - obj-y += common.o - -@@ -28,5 +29,6 @@ obj-$(CONFIG_MACH_NAS100D) += nas100d-se - obj-$(CONFIG_MACH_DSMG600) += dsmg600-setup.o dsmg600-power.o - obj-$(CONFIG_MACH_GATEWAY7001) += gateway7001-setup.o - obj-$(CONFIG_MACH_WG302V2) += wg302v2-setup.o -+obj-$(CONFIG_MACH_FSG) += fsg-setup.o - - obj-$(CONFIG_PCI) += $(obj-pci-$(CONFIG_PCI)) common-pci.o -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/fsg-pci.c -=================================================================== ---- /dev/null -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/fsg-pci.c -@@ -0,0 +1,71 @@ -+/* -+ * arch/arch/mach-ixp4xx/fsg-pci.c -+ * -+ * FSG board-level PCI initialization -+ * -+ * Author: Rod Whitby <rod@whitby.id.au> -+ * Maintainer: http://www.nslu2-linux.org/ -+ * -+ * based on ixdp425-pci.c: -+ * Copyright (C) 2002 Intel Corporation. -+ * Copyright (C) 2003-2004 MontaVista Software, Inc. -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ * -+ */ -+ -+#include <linux/pci.h> -+#include <linux/init.h> -+#include <linux/irq.h> -+ -+#include <asm/mach/pci.h> -+#include <asm/mach-types.h> -+ -+void __init fsg_pci_preinit(void) -+{ -+ set_irq_type(IRQ_FSG_PCI_INTA, IRQT_LOW); -+ set_irq_type(IRQ_FSG_PCI_INTB, IRQT_LOW); -+ set_irq_type(IRQ_FSG_PCI_INTC, IRQT_LOW); -+ -+ ixp4xx_pci_preinit(); -+} -+ -+static int __init fsg_map_irq(struct pci_dev *dev, u8 slot, u8 pin) -+{ -+ static int pci_irq_table[FSG_PCI_IRQ_LINES] = { -+ IRQ_FSG_PCI_INTC, -+ IRQ_FSG_PCI_INTB, -+ IRQ_FSG_PCI_INTA, -+ }; -+ -+ int irq = -1; -+ slot = slot - 11; -+ -+ if (slot >= 1 && slot <= FSG_PCI_MAX_DEV && -+ pin >= 1 && pin <= FSG_PCI_IRQ_LINES) -+ irq = pci_irq_table[(slot - 1)]; -+ printk(KERN_INFO "%s: Mapped slot %d pin %d to IRQ %d\n", -+ __func__, slot, pin, irq); -+ -+ return irq; -+} -+ -+struct hw_pci fsg_pci __initdata = { -+ .nr_controllers = 1, -+ .preinit = fsg_pci_preinit, -+ .swizzle = pci_std_swizzle, -+ .setup = ixp4xx_setup, -+ .scan = ixp4xx_scan_bus, -+ .map_irq = fsg_map_irq, -+}; -+ -+int __init fsg_pci_init(void) -+{ -+ if (machine_is_fsg()) -+ pci_common_init(&fsg_pci); -+ return 0; -+} -+ -+subsys_initcall(fsg_pci_init); -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/fsg-setup.c -=================================================================== ---- /dev/null -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/fsg-setup.c -@@ -0,0 +1,275 @@ -+/* -+ * arch/arm/mach-ixp4xx/fsg-setup.c -+ * -+ * FSG board-setup -+ * -+ * Copyright (C) 2008 Rod Whitby <rod@whitby.id.au> -+ * -+ * based on ixdp425-setup.c: -+ * Copyright (C) 2003-2004 MontaVista Software, Inc. -+ * based on nslu2-power.c -+ * Copyright (C) 2005 Tower Technologies -+ * -+ * Author: Rod Whitby <rod@whitby.id.au> -+ * Maintainers: http://www.nslu2-linux.org/ -+ * -+ */ -+ -+#include <linux/if_ether.h> -+#include <linux/irq.h> -+#include <linux/serial.h> -+#include <linux/serial_8250.h> -+#include <linux/leds.h> -+#include <linux/reboot.h> -+#include <linux/i2c.h> -+#include <linux/i2c-gpio.h> -+ -+#include <asm/mach-types.h> -+#include <asm/mach/arch.h> -+#include <asm/mach/flash.h> -+#include <asm/io.h> -+#include <asm/gpio.h> -+ -+static struct flash_platform_data fsg_flash_data = { -+ .map_name = "cfi_probe", -+ .width = 2, -+}; -+ -+static struct resource fsg_flash_resource = { -+ .flags = IORESOURCE_MEM, -+}; -+ -+static struct platform_device fsg_flash = { -+ .name = "IXP4XX-Flash", -+ .id = 0, -+ .dev.platform_data = &fsg_flash_data, -+ .num_resources = 1, -+ .resource = &fsg_flash_resource, -+}; -+ -+static struct i2c_gpio_platform_data fsg_i2c_gpio_data = { -+ .sda_pin = FSG_SDA_PIN, -+ .scl_pin = FSG_SCL_PIN, -+}; -+ -+static struct platform_device fsg_i2c_gpio = { -+ .name = "i2c-gpio", -+ .id = 0, -+ .dev = { -+ .platform_data = &fsg_i2c_gpio_data, -+ }, -+}; -+ -+static struct i2c_board_info __initdata fsg_i2c_board_info [] = { -+ { -+ I2C_BOARD_INFO("rtc-isl1208", 0x6f), -+ }, -+}; -+ -+static struct resource fsg_uart_resources[] = { -+ { -+ .start = IXP4XX_UART1_BASE_PHYS, -+ .end = IXP4XX_UART1_BASE_PHYS + 0x0fff, -+ .flags = IORESOURCE_MEM, -+ }, -+ { -+ .start = IXP4XX_UART2_BASE_PHYS, -+ .end = IXP4XX_UART2_BASE_PHYS + 0x0fff, -+ .flags = IORESOURCE_MEM, -+ } -+}; -+ -+static struct plat_serial8250_port fsg_uart_data[] = { -+ { -+ .mapbase = IXP4XX_UART1_BASE_PHYS, -+ .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET, -+ .irq = IRQ_IXP4XX_UART1, -+ .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, -+ .iotype = UPIO_MEM, -+ .regshift = 2, -+ .uartclk = IXP4XX_UART_XTAL, -+ }, -+ { -+ .mapbase = IXP4XX_UART2_BASE_PHYS, -+ .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET, -+ .irq = IRQ_IXP4XX_UART2, -+ .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, -+ .iotype = UPIO_MEM, -+ .regshift = 2, -+ .uartclk = IXP4XX_UART_XTAL, -+ }, -+ { } -+}; -+ -+static struct platform_device fsg_uart = { -+ .name = "serial8250", -+ .id = PLAT8250_DEV_PLATFORM, -+ .dev.platform_data = fsg_uart_data, -+ .num_resources = ARRAY_SIZE(fsg_uart_resources), -+ .resource = fsg_uart_resources, -+}; -+ -+static struct platform_device fsg_leds = { -+ .name = "fsg-led", -+ .id = -1, -+}; -+ -+/* Built-in 10/100 Ethernet MAC interfaces */ -+static struct eth_plat_info fsg_plat_eth[] = { -+ { -+ .phy = 5, -+ .rxq = 3, -+ .txreadyq = 20, -+ }, { -+ .phy = 4, -+ .rxq = 4, -+ .txreadyq = 21, -+ } -+}; -+ -+static struct platform_device fsg_eth[] = { -+ { -+ .name = "ixp4xx_eth", -+ .id = IXP4XX_ETH_NPEB, -+ .dev.platform_data = fsg_plat_eth, -+ }, { -+ .name = "ixp4xx_eth", -+ .id = IXP4XX_ETH_NPEC, -+ .dev.platform_data = fsg_plat_eth + 1, -+ } -+}; -+ -+static struct platform_device *fsg_devices[] __initdata = { -+ &fsg_i2c_gpio, -+ &fsg_flash, -+ &fsg_leds, -+ &fsg_eth[0], -+ &fsg_eth[1], -+}; -+ -+static void fsg_power_off(void) -+{ -+ printk(KERN_INFO "Restarting system.\n"); -+ machine_restart(NULL); -+} -+ -+static irqreturn_t fsg_power_handler(int irq, void *dev_id) -+{ -+ /* Signal init to do the ctrlaltdel action, this will bypass init if -+ * it hasn't started and do a kernel_restart. -+ */ -+ ctrl_alt_del(); -+ -+ return IRQ_HANDLED; -+} -+ -+static irqreturn_t fsg_reset_handler(int irq, void *dev_id) -+{ -+ /* This is the paper-clip reset, it shuts the machine down directly. -+ */ -+ machine_power_off(); -+ -+ return IRQ_HANDLED; -+} -+ -+static void __init fsg_init(void) -+{ -+ DECLARE_MAC_BUF(mac_buf); -+ uint8_t __iomem *f; -+ int i; -+ -+ ixp4xx_sys_init(); -+ -+ fsg_flash_resource.start = IXP4XX_EXP_BUS_BASE(0); -+ fsg_flash_resource.end = -+ IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1; -+ -+ *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE; -+ *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0; -+ -+ /* Configure CS2 for operation, 8bit and writable */ -+ *IXP4XX_EXP_CS2 = 0xbfff0002; -+ -+ i2c_register_board_info(0, fsg_i2c_board_info, -+ ARRAY_SIZE(fsg_i2c_board_info)); -+ -+ /* This is only useful on a modified machine, but it is valuable -+ * to have it first in order to see debug messages, and so that -+ * it does *not* get removed if platform_add_devices fails! -+ */ -+ (void)platform_device_register(&fsg_uart); -+ -+ platform_add_devices(fsg_devices, ARRAY_SIZE(fsg_devices)); -+ -+ pm_power_off = fsg_power_off; -+ -+ set_irq_type(gpio_to_irq(FSG_RB_GPIO), IRQT_LOW); -+ if (request_irq(gpio_to_irq(FSG_RB_GPIO), &fsg_reset_handler, -+ IRQF_DISABLED, "FSG reset button", NULL) < 0) { -+ -+ printk(KERN_DEBUG "Reset Button IRQ %d not available\n", -+ gpio_to_irq(FSG_RB_GPIO)); -+ } -+ -+ set_irq_type(gpio_to_irq(FSG_SB_GPIO), IRQT_LOW); -+ if (request_irq(gpio_to_irq(FSG_SB_GPIO), &fsg_power_handler, -+ IRQF_DISABLED, "FSG power button", NULL) < 0) { -+ -+ printk(KERN_DEBUG "Power Button IRQ %d not available\n", -+ gpio_to_irq(FSG_SB_GPIO)); -+ } -+ -+ /* -+ * Map in a portion of the flash and read the MAC addresses. -+ * Since it is stored in BE in the flash itself, we need to -+ * byteswap it if we're in LE mode. -+ */ -+ f = ioremap(IXP4XX_EXP_BUS_BASE(0), 0x400000); -+ if (f) { -+#ifdef __ARMEB__ -+ for (i = 0; i < 6; i++) { -+ fsg_plat_eth[0].hwaddr[i] = readb(f + 0x3C0422 + i); -+ fsg_plat_eth[1].hwaddr[i] = readb(f + 0x3C043B + i); -+ } -+#else -+ -+ /* -+ Endian-swapped reads from unaligned addresses are -+ required to extract the two MACs from the big-endian -+ Redboot config area in flash. -+ */ -+ -+ fsg_plat_eth[0].hwaddr[0] = readb(f + 0x3C0421); -+ fsg_plat_eth[0].hwaddr[1] = readb(f + 0x3C0420); -+ fsg_plat_eth[0].hwaddr[2] = readb(f + 0x3C0427); -+ fsg_plat_eth[0].hwaddr[3] = readb(f + 0x3C0426); -+ fsg_plat_eth[0].hwaddr[4] = readb(f + 0x3C0425); -+ fsg_plat_eth[0].hwaddr[5] = readb(f + 0x3C0424); -+ -+ fsg_plat_eth[1].hwaddr[0] = readb(f + 0x3C0439); -+ fsg_plat_eth[1].hwaddr[1] = readb(f + 0x3C043F); -+ fsg_plat_eth[1].hwaddr[2] = readb(f + 0x3C043E); -+ fsg_plat_eth[1].hwaddr[3] = readb(f + 0x3C043D); -+ fsg_plat_eth[1].hwaddr[4] = readb(f + 0x3C043C); -+ fsg_plat_eth[1].hwaddr[5] = readb(f + 0x3C0443); -+#endif -+ iounmap(f); -+ } -+ printk(KERN_INFO "FSG: Using MAC address %s for port 0\n", -+ print_mac(mac_buf, fsg_plat_eth[0].hwaddr)); -+ printk(KERN_INFO "FSG: Using MAC address %s for port 1\n", -+ print_mac(mac_buf, fsg_plat_eth[1].hwaddr)); -+ -+} -+ -+MACHINE_START(FSG, "Freecom FSG-3") -+ /* Maintainer: www.nslu2-linux.org */ -+ .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, -+ .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, -+ .map_io = ixp4xx_map_io, -+ .init_irq = ixp4xx_init_irq, -+ .timer = &ixp4xx_timer, -+ .boot_params = 0x0100, -+ .init_machine = fsg_init, -+MACHINE_END -+ -Index: linux-2.6.24.7/include/asm-arm/arch-ixp4xx/fsg.h -=================================================================== ---- /dev/null -+++ linux-2.6.24.7/include/asm-arm/arch-ixp4xx/fsg.h -@@ -0,0 +1,50 @@ -+/* -+ * include/asm-arm/arch-ixp4xx/fsg.h -+ * -+ * Freecom FSG-3 platform specific definitions -+ * -+ * Author: Rod Whitby <rod@whitby.id.au> -+ * Author: Tomasz Chmielewski <mangoo@wpkg.org> -+ * Maintainers: http://www.nslu2-linux.org -+ * -+ * Based on coyote.h by -+ * Copyright 2004 (c) MontaVista, Software, Inc. -+ * -+ * This file is licensed under the terms of the GNU General Public -+ * License version 2. This program is licensed "as is" without any -+ * warranty of any kind, whether express or implied. -+ */ -+ -+#ifndef __ASM_ARCH_HARDWARE_H__ -+#error "Do not include this directly, instead #include <asm/hardware.h>" -+#endif -+ -+#define FSG_SDA_PIN 12 -+#define FSG_SCL_PIN 13 -+ -+/* -+ * FSG PCI IRQs -+ */ -+#define FSG_PCI_MAX_DEV 3 -+#define FSG_PCI_IRQ_LINES 3 -+ -+ -+/* PCI controller GPIO to IRQ pin mappings */ -+#define FSG_PCI_INTA_PIN 6 -+#define FSG_PCI_INTB_PIN 7 -+#define FSG_PCI_INTC_PIN 5 -+ -+/* Buttons */ -+ -+#define FSG_SB_GPIO 4 /* sync button */ -+#define FSG_RB_GPIO 9 /* reset button */ -+#define FSG_UB_GPIO 10 /* usb button */ -+ -+/* LEDs */ -+ -+#define FSG_LED_WLAN_BIT 0 -+#define FSG_LED_WAN_BIT 1 -+#define FSG_LED_SATA_BIT 2 -+#define FSG_LED_USB_BIT 4 -+#define FSG_LED_RING_BIT 5 -+#define FSG_LED_SYNC_BIT 7 -Index: linux-2.6.24.7/include/asm-arm/arch-ixp4xx/hardware.h -=================================================================== ---- linux-2.6.24.7.orig/include/asm-arm/arch-ixp4xx/hardware.h -+++ linux-2.6.24.7/include/asm-arm/arch-ixp4xx/hardware.h -@@ -45,5 +45,6 @@ - #include "nslu2.h" - #include "nas100d.h" - #include "dsmg600.h" -+#include "fsg.h" - - #endif /* _ASM_ARCH_HARDWARE_H */ -Index: linux-2.6.24.7/include/asm-arm/arch-ixp4xx/irqs.h -=================================================================== ---- linux-2.6.24.7.orig/include/asm-arm/arch-ixp4xx/irqs.h -+++ linux-2.6.24.7/include/asm-arm/arch-ixp4xx/irqs.h -@@ -128,4 +128,11 @@ - #define IRQ_DSMG600_PCI_INTE IRQ_IXP4XX_GPIO7 - #define IRQ_DSMG600_PCI_INTF IRQ_IXP4XX_GPIO6 - -+/* -+ * Freecom FSG-3 Board IRQs -+ */ -+#define IRQ_FSG_PCI_INTA IRQ_IXP4XX_GPIO6 -+#define IRQ_FSG_PCI_INTB IRQ_IXP4XX_GPIO7 -+#define IRQ_FSG_PCI_INTC IRQ_IXP4XX_GPIO5 -+ - #endif -Index: linux-2.6.24.7/drivers/leds/Kconfig -=================================================================== ---- linux-2.6.24.7.orig/drivers/leds/Kconfig -+++ linux-2.6.24.7/drivers/leds/Kconfig -@@ -48,6 +48,12 @@ config LEDS_IXP4XX - particular board must have LEDs and they must be connected - to the GPIO lines. If unsure, say Y. - -+config LEDS_FSG -+ tristate "LED Support for the Freecom FSG-3" -+ depends on LEDS_CLASS && MACH_FSG -+ help -+ This option enables support for the LEDs on the Freecom FSG-3. -+ - config LEDS_TOSA - tristate "LED Support for the Sharp SL-6000 series" - depends on LEDS_CLASS && PXA_SHARPSL -Index: linux-2.6.24.7/drivers/leds/Makefile -=================================================================== ---- linux-2.6.24.7.orig/drivers/leds/Makefile -+++ linux-2.6.24.7/drivers/leds/Makefile -@@ -20,6 +20,7 @@ obj-$(CONFIG_LEDS_COBALT_QUBE) += leds- - obj-$(CONFIG_LEDS_COBALT_RAQ) += leds-cobalt-raq.o - obj-$(CONFIG_LEDS_GPIO) += leds-gpio.o - obj-$(CONFIG_LEDS_CM_X270) += leds-cm-x270.o -+obj-$(CONFIG_LEDS_FSG) += leds-fsg.o - - # LED Triggers - obj-$(CONFIG_LEDS_TRIGGER_TIMER) += ledtrig-timer.o -Index: linux-2.6.24.7/drivers/leds/leds-fsg.c -=================================================================== ---- /dev/null -+++ linux-2.6.24.7/drivers/leds/leds-fsg.c -@@ -0,0 +1,261 @@ -+/* -+ * LED Driver for the Freecom FSG-3 -+ * -+ * Copyright (c) 2008 Rod Whitby <rod@whitby.id.au> -+ * -+ * Author: Rod Whitby <rod@whitby.id.au> -+ * -+ * Based on leds-spitz.c -+ * Copyright 2005-2006 Openedhand Ltd. -+ * Author: Richard Purdie <rpurdie@openedhand.com> -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ * -+ */ -+ -+#include <linux/kernel.h> -+#include <linux/init.h> -+#include <linux/platform_device.h> -+#include <linux/leds.h> -+#include <asm/arch/hardware.h> -+#include <asm/io.h> -+ -+static short __iomem *latch_address; -+static unsigned short latch_value; -+ -+ -+static void fsg_led_wlan_set(struct led_classdev *led_cdev, -+ enum led_brightness value) -+{ -+ if (value) { -+ latch_value &= ~(1 << FSG_LED_WLAN_BIT); -+ *latch_address = latch_value; -+ } else { -+ latch_value |= (1 << FSG_LED_WLAN_BIT); -+ *latch_address = latch_value; -+ } -+} -+ -+static void fsg_led_wan_set(struct led_classdev *led_cdev, -+ enum led_brightness value) -+{ -+ if (value) { -+ latch_value &= ~(1 << FSG_LED_WAN_BIT); -+ *latch_address = latch_value; -+ } else { -+ latch_value |= (1 << FSG_LED_WAN_BIT); -+ *latch_address = latch_value; -+ } -+} -+ -+static void fsg_led_sata_set(struct led_classdev *led_cdev, -+ enum led_brightness value) -+{ -+ if (value) { -+ latch_value &= ~(1 << FSG_LED_SATA_BIT); -+ *latch_address = latch_value; -+ } else { -+ latch_value |= (1 << FSG_LED_SATA_BIT); -+ *latch_address = latch_value; -+ } -+} -+ -+static void fsg_led_usb_set(struct led_classdev *led_cdev, -+ enum led_brightness value) -+{ -+ if (value) { -+ latch_value &= ~(1 << FSG_LED_USB_BIT); -+ *latch_address = latch_value; -+ } else { -+ latch_value |= (1 << FSG_LED_USB_BIT); -+ *latch_address = latch_value; -+ } -+} -+ -+static void fsg_led_sync_set(struct led_classdev *led_cdev, -+ enum led_brightness value) -+{ -+ if (value) { -+ latch_value &= ~(1 << FSG_LED_SYNC_BIT); -+ *latch_address = latch_value; -+ } else { -+ latch_value |= (1 << FSG_LED_SYNC_BIT); -+ *latch_address = latch_value; -+ } -+} -+ -+static void fsg_led_ring_set(struct led_classdev *led_cdev, -+ enum led_brightness value) -+{ -+ if (value) { -+ latch_value &= ~(1 << FSG_LED_RING_BIT); -+ *latch_address = latch_value; -+ } else { -+ latch_value |= (1 << FSG_LED_RING_BIT); -+ *latch_address = latch_value; -+ } -+} -+ -+ -+ -+static struct led_classdev fsg_wlan_led = { -+ .name = "fsg:blue:wlan", -+ .brightness_set = fsg_led_wlan_set, -+}; -+ -+static struct led_classdev fsg_wan_led = { -+ .name = "fsg:blue:wan", -+ .brightness_set = fsg_led_wan_set, -+}; -+ -+static struct led_classdev fsg_sata_led = { -+ .name = "fsg:blue:sata", -+ .brightness_set = fsg_led_sata_set, -+}; -+ -+static struct led_classdev fsg_usb_led = { -+ .name = "fsg:blue:usb", -+ .brightness_set = fsg_led_usb_set, -+}; -+ -+static struct led_classdev fsg_sync_led = { -+ .name = "fsg:blue:sync", -+ .brightness_set = fsg_led_sync_set, -+}; -+ -+static struct led_classdev fsg_ring_led = { -+ .name = "fsg:blue:ring", -+ .brightness_set = fsg_led_ring_set, -+}; -+ -+ -+ -+#ifdef CONFIG_PM -+static int fsg_led_suspend(struct platform_device *dev, pm_message_t state) -+{ -+ led_classdev_suspend(&fsg_wlan_led); -+ led_classdev_suspend(&fsg_wan_led); -+ led_classdev_suspend(&fsg_sata_led); -+ led_classdev_suspend(&fsg_usb_led); -+ led_classdev_suspend(&fsg_sync_led); -+ led_classdev_suspend(&fsg_ring_led); -+ return 0; -+} -+ -+static int fsg_led_resume(struct platform_device *dev) -+{ -+ led_classdev_resume(&fsg_wlan_led); -+ led_classdev_resume(&fsg_wan_led); -+ led_classdev_resume(&fsg_sata_led); -+ led_classdev_resume(&fsg_usb_led); -+ led_classdev_resume(&fsg_sync_led); -+ led_classdev_resume(&fsg_ring_led); -+ return 0; -+} -+#endif -+ -+ -+static int fsg_led_probe(struct platform_device *pdev) -+{ -+ int ret; -+ -+ ret = led_classdev_register(&pdev->dev, &fsg_wlan_led); -+ if (ret < 0) -+ goto failwlan; -+ -+ ret = led_classdev_register(&pdev->dev, &fsg_wan_led); -+ if (ret < 0) -+ goto failwan; -+ -+ ret = led_classdev_register(&pdev->dev, &fsg_sata_led); -+ if (ret < 0) -+ goto failsata; -+ -+ ret = led_classdev_register(&pdev->dev, &fsg_usb_led); -+ if (ret < 0) -+ goto failusb; -+ -+ ret = led_classdev_register(&pdev->dev, &fsg_sync_led); -+ if (ret < 0) -+ goto failsync; -+ -+ ret = led_classdev_register(&pdev->dev, &fsg_ring_led); -+ if (ret < 0) -+ goto failring; -+ -+ /* Map the LED chip select address space */ -+ latch_address = (unsigned short *) ioremap(IXP4XX_EXP_BUS_BASE(2), 512); -+ if (!latch_address) { -+ ret = -ENOMEM; -+ goto failremap; -+ } -+ -+ latch_value = 0xffff; -+ *latch_address = latch_value; -+ -+ return ret; -+ -+ failremap: -+ led_classdev_unregister(&fsg_ring_led); -+ failring: -+ led_classdev_unregister(&fsg_sync_led); -+ failsync: -+ led_classdev_unregister(&fsg_usb_led); -+ failusb: -+ led_classdev_unregister(&fsg_sata_led); -+ failsata: -+ led_classdev_unregister(&fsg_wan_led); -+ failwan: -+ led_classdev_unregister(&fsg_wlan_led); -+ failwlan: -+ -+ return ret; -+} -+ -+static int fsg_led_remove(struct platform_device *pdev) -+{ -+ iounmap(latch_address); -+ -+ led_classdev_unregister(&fsg_wlan_led); -+ led_classdev_unregister(&fsg_wan_led); -+ led_classdev_unregister(&fsg_sata_led); -+ led_classdev_unregister(&fsg_usb_led); -+ led_classdev_unregister(&fsg_sync_led); -+ led_classdev_unregister(&fsg_ring_led); -+ -+ return 0; -+} -+ -+ -+static struct platform_driver fsg_led_driver = { -+ .probe = fsg_led_probe, -+ .remove = fsg_led_remove, -+#ifdef CONFIG_PM -+ .suspend = fsg_led_suspend, -+ .resume = fsg_led_resume, -+#endif -+ .driver = { -+ .name = "fsg-led", -+ }, -+}; -+ -+ -+static int __init fsg_led_init(void) -+{ -+ return platform_driver_register(&fsg_led_driver); -+} -+ -+static void __exit fsg_led_exit(void) -+{ -+ platform_driver_unregister(&fsg_led_driver); -+} -+ -+ -+module_init(fsg_led_init); -+module_exit(fsg_led_exit); -+ -+MODULE_AUTHOR("Rod Whitby <rod@whitby.id.au>"); -+MODULE_DESCRIPTION("Freecom FSG-3 LED driver"); -+MODULE_LICENSE("GPL"); diff --git a/target/linux/ixp4xx/patches-2.6.24/031-nslu2_nas100d_ethernet_support.patch b/target/linux/ixp4xx/patches-2.6.24/031-nslu2_nas100d_ethernet_support.patch deleted file mode 100644 index f9e74c43fb..0000000000 --- a/target/linux/ixp4xx/patches-2.6.24/031-nslu2_nas100d_ethernet_support.patch +++ /dev/null @@ -1,232 +0,0 @@ -From af66bd3b3324d51f0c43b7672b7a0563db425377 Mon Sep 17 00:00:00 2001 -From: Rod Whitby <rod@whitby.id.au> -Date: Tue, 29 Jan 2008 10:03:19 +1030 -Subject: ixp4xx: Ethernet support for the nslu2 and nas100d boards - -Enables the new ixp4xx qmgr and npe drivers in ixp4xx_defconfig. - -Sets up the corresponding platform data for the nslu2 and nas100d -boards, and reads the ethernet MAC address from the internal flash. - -Tested on both little-endian and big-endian kernels. - -Signed-off-by: Rod Whitby <rod@whitby.id.au> -Signed-off-by: Michael Westerhof <mwester@dls.net> -Tested-by: Tom King <tom@websb.net> - -PATCH FOLLOWS -KernelVersion: v2.6.24-1916-g3832564 - -Index: linux-2.6.24.7/arch/arm/configs/ixp4xx_defconfig -=================================================================== ---- linux-2.6.24.7.orig/arch/arm/configs/ixp4xx_defconfig -+++ linux-2.6.24.7/arch/arm/configs/ixp4xx_defconfig -@@ -1,7 +1,7 @@ - # - # Automatically generated make config: don't edit --# Linux kernel version: 2.6.24-rc8 --# Wed Jan 23 17:26:16 2008 -+# Linux kernel version: 2.6.24 -+# Sun Jan 27 07:33:38 2008 - # - CONFIG_ARM=y - CONFIG_SYS_SUPPORTS_APM_EMULATION=y -@@ -174,6 +174,8 @@ CONFIG_MACH_GTWX5715=y - # - CONFIG_DMABOUNCE=y - # CONFIG_IXP4XX_INDIRECT_PCI is not set -+CONFIG_IXP4XX_QMGR=y -+CONFIG_IXP4XX_NPE=y - - # - # Boot options -@@ -832,6 +834,7 @@ CONFIG_DUMMY=y - # CONFIG_PHYLIB is not set - CONFIG_NET_ETHERNET=y - CONFIG_MII=y -+CONFIG_IXP4XX_ETH=y - # CONFIG_AX88796 is not set - # CONFIG_HAPPYMEAL is not set - # CONFIG_SUNGEM is not set -@@ -925,6 +928,7 @@ CONFIG_HDLC_X25=m - # CONFIG_PC300TOO is not set - # CONFIG_FARSYNC is not set - # CONFIG_DSCC4 is not set -+# CONFIG_IXP4XX_HSS is not set - CONFIG_DLCI=m - CONFIG_DLCI_MAX=8 - CONFIG_WAN_ROUTER_DRIVERS=m -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/nas100d-setup.c -=================================================================== ---- linux-2.6.24.7.orig/arch/arm/mach-ixp4xx/nas100d-setup.c -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/nas100d-setup.c -@@ -12,6 +12,7 @@ - * - */ - -+#include <linux/if_ether.h> - #include <linux/kernel.h> - #include <linux/serial.h> - #include <linux/serial_8250.h> -@@ -22,6 +23,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", -@@ -131,10 +133,28 @@ static struct platform_device nas100d_ua - .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, - &nas100d_leds, -+ &nas100d_eth[0], - }; - - static void nas100d_power_off(void) -@@ -150,6 +170,10 @@ static void nas100d_power_off(void) - - static void __init nas100d_init(void) - { -+ DECLARE_MAC_BUF(mac_buf); -+ uint8_t __iomem *f; -+ int i; -+ - ixp4xx_sys_init(); - - /* gpio 14 and 15 are _not_ clocks */ -@@ -172,6 +196,25 @@ 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. -+ */ -+ f = ioremap(IXP4XX_EXP_BUS_BASE(0), 0x1000000); -+ if (f) { -+ for (i = 0; i < 6; i++) -+#ifdef __ARMEB__ -+ nas100d_plat_eth[0].hwaddr[i] = readb(f + 0xFC0FD8 + i); -+#else -+ nas100d_plat_eth[0].hwaddr[i] = readb(f + 0xFC0FD8 + (i^3)); -+#endif -+ iounmap(f); -+ } -+ printk(KERN_INFO "NAS100D: Using MAC address %s for port 0\n", -+ print_mac(mac_buf, nas100d_plat_eth[0].hwaddr)); -+ - } - - MACHINE_START(NAS100D, "Iomega NAS 100d") -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/nslu2-setup.c -=================================================================== ---- linux-2.6.24.7.orig/arch/arm/mach-ixp4xx/nslu2-setup.c -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/nslu2-setup.c -@@ -14,6 +14,7 @@ - * Changed to conform to new style __init ixdp425 kas11 10/22/04 - */ - -+#include <linux/if_ether.h> - #include <linux/kernel.h> - #include <linux/serial.h> - #include <linux/serial_8250.h> -@@ -25,6 +26,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", -@@ -143,11 +145,29 @@ 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, - &nslu2_beeper, - &nslu2_leds, -+ &nslu2_eth[0], - }; - - static void nslu2_power_off(void) -@@ -176,6 +196,10 @@ static struct sys_timer nslu2_timer = { - - static void __init nslu2_init(void) - { -+ DECLARE_MAC_BUF(mac_buf); -+ uint8_t __iomem *f; -+ int i; -+ - ixp4xx_sys_init(); - - nslu2_flash_resource.start = IXP4XX_EXP_BUS_BASE(0); -@@ -195,6 +219,26 @@ 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. -+ */ -+ f = ioremap(IXP4XX_EXP_BUS_BASE(0), 0x40000); -+ if (f) { -+ for (i = 0; i < 6; i++) -+#ifdef __ARMEB__ -+ nslu2_plat_eth[0].hwaddr[i] = readb(f + 0x3FFB0 + i); -+#else -+ nslu2_plat_eth[0].hwaddr[i] = readb(f + 0x3FFB0 + (i^3)); -+#endif -+ iounmap(f); -+ } -+ printk(KERN_INFO "NSLU2: Using MAC address %s for port 0\n", -+ print_mac(mac_buf, nslu2_plat_eth[0].hwaddr)); -+ - } - - MACHINE_START(NSLU2, "Linksys NSLU2") diff --git a/target/linux/ixp4xx/patches-2.6.24/032-subsume_power_files.patch b/target/linux/ixp4xx/patches-2.6.24/032-subsume_power_files.patch deleted file mode 100644 index b32d055ad7..0000000000 --- a/target/linux/ixp4xx/patches-2.6.24/032-subsume_power_files.patch +++ /dev/null @@ -1,819 +0,0 @@ -From: Rod Whitby <rod@whitby.id.au> -Subject: ixp4xx: Merge nslu2-power.c into nslu2-setup.c (Patch #4807) - -There is no reason to have power control in a separate file from the -board setup code. Merge it back into the board setup file, removing -superfluous header includes and removing superfluous constants from -the machine header file. - -Signed-off-by: Rod Whitby <rod@whitby.id.au> --- -PATCH FOLLOWS -KernelVersion: v2.6.24-1917-gaf66bd3 - -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/Makefile -=================================================================== ---- linux-2.6.24.7.orig/arch/arm/mach-ixp4xx/Makefile -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/Makefile -@@ -24,9 +24,9 @@ obj-$(CONFIG_MACH_AVILA) += avila-setup. - obj-$(CONFIG_MACH_IXDPG425) += coyote-setup.o - obj-$(CONFIG_ARCH_ADI_COYOTE) += coyote-setup.o - obj-$(CONFIG_MACH_GTWX5715) += gtwx5715-setup.o --obj-$(CONFIG_MACH_NSLU2) += nslu2-setup.o nslu2-power.o --obj-$(CONFIG_MACH_NAS100D) += nas100d-setup.o nas100d-power.o --obj-$(CONFIG_MACH_DSMG600) += dsmg600-setup.o dsmg600-power.o -+obj-$(CONFIG_MACH_NSLU2) += nslu2-setup.o -+obj-$(CONFIG_MACH_NAS100D) += nas100d-setup.o -+obj-$(CONFIG_MACH_DSMG600) += dsmg600-setup.o - obj-$(CONFIG_MACH_GATEWAY7001) += gateway7001-setup.o - obj-$(CONFIG_MACH_WG302V2) += wg302v2-setup.o - obj-$(CONFIG_MACH_FSG) += fsg-setup.o -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/nslu2-power.c -=================================================================== ---- linux-2.6.24.7.orig/arch/arm/mach-ixp4xx/nslu2-power.c -+++ /dev/null -@@ -1,92 +0,0 @@ --/* -- * arch/arm/mach-ixp4xx/nslu2-power.c -- * -- * NSLU2 Power/Reset driver -- * -- * Copyright (C) 2005 Tower Technologies -- * -- * based on nslu2-io.c -- * Copyright (C) 2004 Karen Spearel -- * -- * Author: Alessandro Zummo <a.zummo@towertech.it> -- * Maintainers: http://www.nslu2-linux.org/ -- * -- * This program is free software; you can redistribute it and/or modify -- * it under the terms of the GNU General Public License version 2 as -- * published by the Free Software Foundation. -- * -- */ -- --#include <linux/module.h> --#include <linux/reboot.h> --#include <linux/irq.h> --#include <linux/interrupt.h> --#include <linux/reboot.h> -- --#include <asm/mach-types.h> -- --static irqreturn_t nslu2_power_handler(int irq, void *dev_id) --{ -- /* Signal init to do the ctrlaltdel action, this will bypass init if -- * it hasn't started and do a kernel_restart. -- */ -- ctrl_alt_del(); -- -- return IRQ_HANDLED; --} -- --static irqreturn_t nslu2_reset_handler(int irq, void *dev_id) --{ -- /* This is the paper-clip reset, it shuts the machine down directly. -- */ -- machine_power_off(); -- -- return IRQ_HANDLED; --} -- --static int __init nslu2_power_init(void) --{ -- if (!(machine_is_nslu2())) -- return 0; -- -- *IXP4XX_GPIO_GPISR = 0x20400000; /* read the 2 irqs to clr */ -- -- set_irq_type(NSLU2_RB_IRQ, IRQT_LOW); -- set_irq_type(NSLU2_PB_IRQ, IRQT_HIGH); -- -- if (request_irq(NSLU2_RB_IRQ, &nslu2_reset_handler, -- IRQF_DISABLED, "NSLU2 reset button", NULL) < 0) { -- -- printk(KERN_DEBUG "Reset Button IRQ %d not available\n", -- NSLU2_RB_IRQ); -- -- return -EIO; -- } -- -- if (request_irq(NSLU2_PB_IRQ, &nslu2_power_handler, -- IRQF_DISABLED, "NSLU2 power button", NULL) < 0) { -- -- printk(KERN_DEBUG "Power Button IRQ %d not available\n", -- NSLU2_PB_IRQ); -- -- return -EIO; -- } -- -- return 0; --} -- --static void __exit nslu2_power_exit(void) --{ -- if (!(machine_is_nslu2())) -- return; -- -- free_irq(NSLU2_RB_IRQ, NULL); -- free_irq(NSLU2_PB_IRQ, NULL); --} -- --module_init(nslu2_power_init); --module_exit(nslu2_power_exit); -- --MODULE_AUTHOR("Alessandro Zummo <a.zummo@towertech.it>"); --MODULE_DESCRIPTION("NSLU2 Power/Reset driver"); --MODULE_LICENSE("GPL"); -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/nslu2-setup.c -=================================================================== ---- linux-2.6.24.7.orig/arch/arm/mach-ixp4xx/nslu2-setup.c -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/nslu2-setup.c -@@ -3,22 +3,26 @@ - * - * NSLU2 board-setup - * -- * based ixdp425-setup.c: -+ * Copyright (C) 2008 Rod Whitby <rod@whitby.id.au> -+ * -+ * based on ixdp425-setup.c: - * Copyright (C) 2003-2004 MontaVista Software, Inc. -+ * based on nslu2-power.c: -+ * Copyright (C) 2005 Tower Technologies - * - * Author: Mark Rakes <mrakes at mac.com> - * Author: Rod Whitby <rod@whitby.id.au> -+ * Author: Alessandro Zummo <a.zummo@towertech.it> - * Maintainers: http://www.nslu2-linux.org/ - * -- * Fixed missing init_time in MACHINE_START kas11 10/22/04 -- * Changed to conform to new style __init ixdp425 kas11 10/22/04 - */ - - #include <linux/if_ether.h> --#include <linux/kernel.h> -+#include <linux/irq.h> - #include <linux/serial.h> - #include <linux/serial_8250.h> - #include <linux/leds.h> -+#include <linux/reboot.h> - #include <linux/i2c.h> - #include <linux/i2c-gpio.h> - -@@ -27,6 +31,7 @@ - #include <asm/mach/flash.h> - #include <asm/mach/time.h> - #include <asm/io.h> -+#include <asm/gpio.h> - - static struct flash_platform_data nslu2_flash_data = { - .map_name = "cfi_probe", -@@ -181,6 +186,25 @@ static void nslu2_power_off(void) - gpio_line_set(NSLU2_PO_GPIO, IXP4XX_GPIO_HIGH); - } - -+static irqreturn_t nslu2_power_handler(int irq, void *dev_id) -+{ -+ /* Signal init to do the ctrlaltdel action, this will bypass init if -+ * it hasn't started and do a kernel_restart. -+ */ -+ ctrl_alt_del(); -+ -+ return IRQ_HANDLED; -+} -+ -+static irqreturn_t nslu2_reset_handler(int irq, void *dev_id) -+{ -+ /* This is the paper-clip reset, it shuts the machine down directly. -+ */ -+ machine_power_off(); -+ -+ return IRQ_HANDLED; -+} -+ - static void __init nslu2_timer_init(void) - { - /* The xtal on this machine is non-standard. */ -@@ -206,8 +230,6 @@ static void __init nslu2_init(void) - nslu2_flash_resource.end = - IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1; - -- pm_power_off = nslu2_power_off; -- - i2c_register_board_info(0, nslu2_i2c_board_info, - ARRAY_SIZE(nslu2_i2c_board_info)); - -@@ -220,6 +242,23 @@ static void __init nslu2_init(void) - - platform_add_devices(nslu2_devices, ARRAY_SIZE(nslu2_devices)); - -+ pm_power_off = nslu2_power_off; -+ -+ if (request_irq(gpio_to_irq(NSLU2_RB_GPIO), &nslu2_reset_handler, -+ IRQF_DISABLED | IRQF_TRIGGER_LOW, -+ "NSLU2 reset button", NULL) < 0) { -+ -+ printk(KERN_DEBUG "Reset Button IRQ %d not available\n", -+ gpio_to_irq(NSLU2_RB_GPIO)); -+ } -+ -+ if (request_irq(gpio_to_irq(NSLU2_PB_GPIO), &nslu2_power_handler, -+ IRQF_DISABLED | IRQF_TRIGGER_HIGH, -+ "NSLU2 power button", NULL) < 0) { -+ -+ printk(KERN_DEBUG "Power Button IRQ %d not available\n", -+ gpio_to_irq(NSLU2_PB_GPIO)); -+ } - - /* - * Map in a portion of the flash and read the MAC address. -Index: linux-2.6.24.7/include/asm-arm/arch-ixp4xx/nslu2.h -=================================================================== ---- linux-2.6.24.7.orig/include/asm-arm/arch-ixp4xx/nslu2.h -+++ linux-2.6.24.7/include/asm-arm/arch-ixp4xx/nslu2.h -@@ -39,34 +39,17 @@ - - /* Buttons */ - --#define NSLU2_PB_GPIO 5 -+#define NSLU2_PB_GPIO 5 /* power button */ - #define NSLU2_PO_GPIO 8 /* power off */ --#define NSLU2_RB_GPIO 12 -- --#define NSLU2_PB_IRQ IRQ_IXP4XX_GPIO5 --#define NSLU2_RB_IRQ IRQ_IXP4XX_GPIO12 -- --#define NSLU2_PB_BM (1L << NSLU2_PB_GPIO) --#define NSLU2_PO_BM (1L << NSLU2_PO_GPIO) --#define NSLU2_RB_BM (1L << NSLU2_RB_GPIO) -+#define NSLU2_RB_GPIO 12 /* reset button */ - - /* Buzzer */ - - #define NSLU2_GPIO_BUZZ 4 --#define NSLU2_BZ_BM (1L << NSLU2_GPIO_BUZZ) - - /* LEDs */ - - #define NSLU2_LED_RED_GPIO 0 - #define NSLU2_LED_GRN_GPIO 1 -- --#define NSLU2_LED_RED_BM (1L << NSLU2_LED_RED_GPIO) --#define NSLU2_LED_GRN_BM (1L << NSLU2_LED_GRN_GPIO) -- - #define NSLU2_LED_DISK1_GPIO 3 - #define NSLU2_LED_DISK2_GPIO 2 -- --#define NSLU2_LED_DISK1_BM (1L << NSLU2_LED_DISK1_GPIO) --#define NSLU2_LED_DISK2_BM (1L << NSLU2_LED_DISK2_GPIO) -- -- -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/nas100d-power.c -=================================================================== ---- linux-2.6.24.7.orig/arch/arm/mach-ixp4xx/nas100d-power.c -+++ /dev/null -@@ -1,128 +0,0 @@ --/* -- * arch/arm/mach-ixp4xx/nas100d-power.c -- * -- * NAS 100d Power/Reset driver -- * -- * Copyright (C) 2005 Tower Technologies -- * -- * based on nas100d-io.c -- * Copyright (C) 2004 Karen Spearel -- * -- * Author: Alessandro Zummo <a.zummo@towertech.it> -- * Maintainers: http://www.nslu2-linux.org/ -- * -- * This program is free software; you can redistribute it and/or modify -- * it under the terms of the GNU General Public License version 2 as -- * published by the Free Software Foundation. -- * -- */ -- --#include <linux/interrupt.h> --#include <linux/irq.h> --#include <linux/module.h> --#include <linux/reboot.h> --#include <linux/jiffies.h> --#include <linux/timer.h> -- --#include <asm/gpio.h> --#include <asm/mach-types.h> -- --/* This is used to make sure the power-button pusher is serious. The button -- * must be held until the value of this counter reaches zero. -- */ --static int power_button_countdown; -- --/* Must hold the button down for at least this many counts to be processed */ --#define PBUTTON_HOLDDOWN_COUNT 4 /* 2 secs */ -- --static void nas100d_power_handler(unsigned long data); --static DEFINE_TIMER(nas100d_power_timer, nas100d_power_handler, 0, 0); -- --static void nas100d_power_handler(unsigned long data) --{ -- /* This routine is called twice per second to check the -- * state of the power button. -- */ -- -- if (gpio_get_value(NAS100D_PB_GPIO)) { -- -- /* IO Pin is 1 (button pushed) */ -- if (power_button_countdown > 0) -- power_button_countdown--; -- -- } else { -- -- /* Done on button release, to allow for auto-power-on mods. */ -- if (power_button_countdown == 0) { -- /* Signal init to do the ctrlaltdel action, -- * this will bypass init if it hasn't started -- * and do a kernel_restart. -- */ -- ctrl_alt_del(); -- -- /* Change the state of the power LED to "blink" */ -- gpio_line_set(NAS100D_LED_PWR_GPIO, IXP4XX_GPIO_LOW); -- } else { -- power_button_countdown = PBUTTON_HOLDDOWN_COUNT; -- } -- } -- -- mod_timer(&nas100d_power_timer, jiffies + msecs_to_jiffies(500)); --} -- --static irqreturn_t nas100d_reset_handler(int irq, void *dev_id) --{ -- /* This is the paper-clip reset, it shuts the machine down directly. */ -- machine_power_off(); -- -- return IRQ_HANDLED; --} -- --static int __init nas100d_power_init(void) --{ -- if (!(machine_is_nas100d())) -- return 0; -- -- set_irq_type(gpio_to_irq(NAS100D_RB_GPIO), IRQT_LOW); -- -- if (request_irq(gpio_to_irq(NAS100D_RB_GPIO), &nas100d_reset_handler, -- IRQF_DISABLED, "NAS100D reset button", NULL) < 0) { -- -- printk(KERN_DEBUG "Reset Button IRQ %d not available\n", -- gpio_to_irq(NAS100D_RB_GPIO)); -- -- return -EIO; -- } -- -- /* The power button on the Iomega NAS100d is on GPIO 14, but -- * it cannot handle interrupts on that GPIO line. So we'll -- * have to poll it with a kernel timer. -- */ -- -- /* Make sure that the power button GPIO is set up as an input */ -- gpio_line_config(NAS100D_PB_GPIO, IXP4XX_GPIO_IN); -- -- /* Set the initial value for the power button IRQ handler */ -- power_button_countdown = PBUTTON_HOLDDOWN_COUNT; -- -- mod_timer(&nas100d_power_timer, jiffies + msecs_to_jiffies(500)); -- -- return 0; --} -- --static void __exit nas100d_power_exit(void) --{ -- if (!(machine_is_nas100d())) -- return; -- -- del_timer_sync(&nas100d_power_timer); -- -- free_irq(gpio_to_irq(NAS100D_RB_GPIO), NULL); --} -- --module_init(nas100d_power_init); --module_exit(nas100d_power_exit); -- --MODULE_AUTHOR("Alessandro Zummo <a.zummo@towertech.it>"); --MODULE_DESCRIPTION("NAS100D Power/Reset driver"); --MODULE_LICENSE("GPL"); -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/nas100d-setup.c -=================================================================== ---- linux-2.6.24.7.orig/arch/arm/mach-ixp4xx/nas100d-setup.c -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/nas100d-setup.c -@@ -3,8 +3,14 @@ - * - * NAS 100d board-setup - * -- * based ixdp425-setup.c: -+ * Copyright (C) 2008 Rod Whitby <rod@whitby.id.au> -+ * -+ * based on ixdp425-setup.c: - * Copyright (C) 2003-2004 MontaVista Software, Inc. -+ * based on nas100d-power.c: -+ * Copyright (C) 2005 Tower Technologies -+ * based on nas100d-io.c -+ * Copyright (C) 2004 Karen Spearel - * - * Author: Alessandro Zummo <a.zummo@towertech.it> - * Author: Rod Whitby <rod@whitby.id.au> -@@ -13,10 +19,13 @@ - */ - - #include <linux/if_ether.h> --#include <linux/kernel.h> -+#include <linux/irq.h> -+#include <linux/jiffies.h> -+#include <linux/timer.h> - #include <linux/serial.h> - #include <linux/serial_8250.h> - #include <linux/leds.h> -+#include <linux/reboot.h> - #include <linux/i2c.h> - #include <linux/i2c-gpio.h> - -@@ -24,6 +33,7 @@ - #include <asm/mach/arch.h> - #include <asm/mach/flash.h> - #include <asm/io.h> -+#include <asm/gpio.h> - - static struct flash_platform_data nas100d_flash_data = { - .map_name = "cfi_probe", -@@ -168,6 +178,57 @@ static void nas100d_power_off(void) - gpio_line_set(NAS100D_PO_GPIO, IXP4XX_GPIO_HIGH); - } - -+/* This is used to make sure the power-button pusher is serious. The button -+ * must be held until the value of this counter reaches zero. -+ */ -+static int power_button_countdown; -+ -+/* Must hold the button down for at least this many counts to be processed */ -+#define PBUTTON_HOLDDOWN_COUNT 4 /* 2 secs */ -+ -+static void nas100d_power_handler(unsigned long data); -+static DEFINE_TIMER(nas100d_power_timer, nas100d_power_handler, 0, 0); -+ -+static void nas100d_power_handler(unsigned long data) -+{ -+ /* This routine is called twice per second to check the -+ * state of the power button. -+ */ -+ -+ if (gpio_get_value(NAS100D_PB_GPIO)) { -+ -+ /* IO Pin is 1 (button pushed) */ -+ if (power_button_countdown > 0) -+ power_button_countdown--; -+ -+ } else { -+ -+ /* Done on button release, to allow for auto-power-on mods. */ -+ if (power_button_countdown == 0) { -+ /* Signal init to do the ctrlaltdel action, -+ * this will bypass init if it hasn't started -+ * and do a kernel_restart. -+ */ -+ ctrl_alt_del(); -+ -+ /* Change the state of the power LED to "blink" */ -+ gpio_line_set(NAS100D_LED_PWR_GPIO, IXP4XX_GPIO_LOW); -+ } else { -+ power_button_countdown = PBUTTON_HOLDDOWN_COUNT; -+ } -+ } -+ -+ mod_timer(&nas100d_power_timer, jiffies + msecs_to_jiffies(500)); -+} -+ -+static irqreturn_t nas100d_reset_handler(int irq, void *dev_id) -+{ -+ /* This is the paper-clip reset, it shuts the machine down directly. */ -+ machine_power_off(); -+ -+ return IRQ_HANDLED; -+} -+ - static void __init nas100d_init(void) - { - DECLARE_MAC_BUF(mac_buf); -@@ -183,8 +244,6 @@ static void __init nas100d_init(void) - nas100d_flash_resource.end = - IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1; - -- pm_power_off = nas100d_power_off; -- - i2c_register_board_info(0, nas100d_i2c_board_info, - ARRAY_SIZE(nas100d_i2c_board_info)); - -@@ -197,6 +256,29 @@ static void __init nas100d_init(void) - - platform_add_devices(nas100d_devices, ARRAY_SIZE(nas100d_devices)); - -+ pm_power_off = nas100d_power_off; -+ -+ if (request_irq(gpio_to_irq(NAS100D_RB_GPIO), &nas100d_reset_handler, -+ IRQF_DISABLED | IRQF_TRIGGER_LOW, -+ "NAS100D reset button", NULL) < 0) { -+ -+ printk(KERN_DEBUG "Reset Button IRQ %d not available\n", -+ gpio_to_irq(NAS100D_RB_GPIO)); -+ } -+ -+ /* The power button on the Iomega NAS100d is on GPIO 14, but -+ * it cannot handle interrupts on that GPIO line. So we'll -+ * have to poll it with a kernel timer. -+ */ -+ -+ /* Make sure that the power button GPIO is set up as an input */ -+ gpio_line_config(NAS100D_PB_GPIO, IXP4XX_GPIO_IN); -+ -+ /* Set the initial value for the power button IRQ handler */ -+ power_button_countdown = PBUTTON_HOLDDOWN_COUNT; -+ -+ mod_timer(&nas100d_power_timer, jiffies + msecs_to_jiffies(500)); -+ - /* - * 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 -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/dsmg600-power.c -=================================================================== ---- linux-2.6.24.7.orig/arch/arm/mach-ixp4xx/dsmg600-power.c -+++ /dev/null -@@ -1,129 +0,0 @@ --/* -- * arch/arm/mach-ixp4xx/dsmg600-power.c -- * -- * DSM-G600 Power/Reset driver -- * Author: Michael Westerhof <mwester@dls.net> -- * -- * Based on nslu2-power.c -- * Copyright (C) 2005 Tower Technologies -- * Author: Alessandro Zummo <a.zummo@towertech.it> -- * -- * which was based on nslu2-io.c -- * Copyright (C) 2004 Karen Spearel -- * -- * Maintainers: http://www.nslu2-linux.org/ -- * -- * This program is free software; you can redistribute it and/or modify -- * it under the terms of the GNU General Public License version 2 as -- * published by the Free Software Foundation. -- * -- */ -- --#include <linux/module.h> --#include <linux/reboot.h> --#include <linux/interrupt.h> --#include <linux/irq.h> --#include <linux/jiffies.h> --#include <linux/timer.h> -- --#include <asm/gpio.h> --#include <asm/mach-types.h> -- --/* This is used to make sure the power-button pusher is serious. The button -- * must be held until the value of this counter reaches zero. -- */ --static int power_button_countdown; -- --/* Must hold the button down for at least this many counts to be processed */ --#define PBUTTON_HOLDDOWN_COUNT 4 /* 2 secs */ -- --static void dsmg600_power_handler(unsigned long data); --static DEFINE_TIMER(dsmg600_power_timer, dsmg600_power_handler, 0, 0); -- --static void dsmg600_power_handler(unsigned long data) --{ -- /* This routine is called twice per second to check the -- * state of the power button. -- */ -- -- if (gpio_get_value(DSMG600_PB_GPIO)) { -- -- /* IO Pin is 1 (button pushed) */ -- if (power_button_countdown > 0) -- power_button_countdown--; -- -- } else { -- -- /* Done on button release, to allow for auto-power-on mods. */ -- if (power_button_countdown == 0) { -- /* Signal init to do the ctrlaltdel action, -- * this will bypass init if it hasn't started -- * and do a kernel_restart. -- */ -- ctrl_alt_del(); -- -- /* Change the state of the power LED to "blink" */ -- gpio_line_set(DSMG600_LED_PWR_GPIO, IXP4XX_GPIO_LOW); -- } else { -- power_button_countdown = PBUTTON_HOLDDOWN_COUNT; -- } -- } -- -- mod_timer(&dsmg600_power_timer, jiffies + msecs_to_jiffies(500)); --} -- --static irqreturn_t dsmg600_reset_handler(int irq, void *dev_id) --{ -- /* This is the paper-clip reset, it shuts the machine down directly. */ -- machine_power_off(); -- -- return IRQ_HANDLED; --} -- --static int __init dsmg600_power_init(void) --{ -- if (!(machine_is_dsmg600())) -- return 0; -- -- if (request_irq(gpio_to_irq(DSMG600_RB_GPIO), &dsmg600_reset_handler, -- IRQF_DISABLED | IRQF_TRIGGER_LOW, "DSM-G600 reset button", -- NULL) < 0) { -- -- printk(KERN_DEBUG "Reset Button IRQ %d not available\n", -- gpio_to_irq(DSMG600_RB_GPIO)); -- -- return -EIO; -- } -- -- /* The power button on the D-Link DSM-G600 is on GPIO 15, but -- * it cannot handle interrupts on that GPIO line. So we'll -- * have to poll it with a kernel timer. -- */ -- -- /* Make sure that the power button GPIO is set up as an input */ -- gpio_line_config(DSMG600_PB_GPIO, IXP4XX_GPIO_IN); -- -- /* Set the initial value for the power button IRQ handler */ -- power_button_countdown = PBUTTON_HOLDDOWN_COUNT; -- -- mod_timer(&dsmg600_power_timer, jiffies + msecs_to_jiffies(500)); -- -- return 0; --} -- --static void __exit dsmg600_power_exit(void) --{ -- if (!(machine_is_dsmg600())) -- return; -- -- del_timer_sync(&dsmg600_power_timer); -- -- free_irq(gpio_to_irq(DSMG600_RB_GPIO), NULL); --} -- --module_init(dsmg600_power_init); --module_exit(dsmg600_power_exit); -- --MODULE_AUTHOR("Michael Westerhof <mwester@dls.net>"); --MODULE_DESCRIPTION("DSM-G600 Power/Reset driver"); --MODULE_LICENSE("GPL"); -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/dsmg600-setup.c -=================================================================== ---- linux-2.6.24.7.orig/arch/arm/mach-ixp4xx/dsmg600-setup.c -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/dsmg600-setup.c -@@ -1,20 +1,29 @@ - /* - * DSM-G600 board-setup - * -+ * Copyright (C) 2008 Rod Whitby <rod@whitby.id.au> - * Copyright (C) 2006 Tower Technologies -- * Author: Alessandro Zummo <a.zummo@towertech.it> - * -- * based ixdp425-setup.c: -+ * based on ixdp425-setup.c: - * Copyright (C) 2003-2004 MontaVista Software, Inc. -+ * based on nslu2-power.c: -+ * Copyright (C) 2005 Tower Technologies -+ * based on nslu2-io.c: -+ * Copyright (C) 2004 Karen Spearel - * - * Author: Alessandro Zummo <a.zummo@towertech.it> -+ * Author: Michael Westerhof <mwester@dls.net> -+ * Author: Rod Whitby <rod@whitby.id.au> - * Maintainers: http://www.nslu2-linux.org/ - */ - --#include <linux/kernel.h> -+#include <linux/irq.h> -+#include <linux/jiffies.h> -+#include <linux/timer.h> - #include <linux/serial.h> - #include <linux/serial_8250.h> - #include <linux/leds.h> -+#include <linux/reboot.h> - #include <linux/i2c.h> - #include <linux/i2c-gpio.h> - -@@ -22,6 +31,7 @@ - #include <asm/mach/arch.h> - #include <asm/mach/flash.h> - #include <asm/mach/time.h> -+#include <asm/gpio.h> - - static struct flash_platform_data dsmg600_flash_data = { - .map_name = "cfi_probe", -@@ -140,6 +150,57 @@ static void dsmg600_power_off(void) - gpio_line_set(DSMG600_PO_GPIO, IXP4XX_GPIO_HIGH); - } - -+/* This is used to make sure the power-button pusher is serious. The button -+ * must be held until the value of this counter reaches zero. -+ */ -+static int power_button_countdown; -+ -+/* Must hold the button down for at least this many counts to be processed */ -+#define PBUTTON_HOLDDOWN_COUNT 4 /* 2 secs */ -+ -+static void dsmg600_power_handler(unsigned long data); -+static DEFINE_TIMER(dsmg600_power_timer, dsmg600_power_handler, 0, 0); -+ -+static void dsmg600_power_handler(unsigned long data) -+{ -+ /* This routine is called twice per second to check the -+ * state of the power button. -+ */ -+ -+ if (gpio_get_value(DSMG600_PB_GPIO)) { -+ -+ /* IO Pin is 1 (button pushed) */ -+ if (power_button_countdown > 0) -+ power_button_countdown--; -+ -+ } else { -+ -+ /* Done on button release, to allow for auto-power-on mods. */ -+ if (power_button_countdown == 0) { -+ /* Signal init to do the ctrlaltdel action, -+ * this will bypass init if it hasn't started -+ * and do a kernel_restart. -+ */ -+ ctrl_alt_del(); -+ -+ /* Change the state of the power LED to "blink" */ -+ gpio_line_set(DSMG600_LED_PWR_GPIO, IXP4XX_GPIO_LOW); -+ } else { -+ power_button_countdown = PBUTTON_HOLDDOWN_COUNT; -+ } -+ } -+ -+ mod_timer(&dsmg600_power_timer, jiffies + msecs_to_jiffies(500)); -+} -+ -+static irqreturn_t dsmg600_reset_handler(int irq, void *dev_id) -+{ -+ /* This is the paper-clip reset, it shuts the machine down directly. */ -+ machine_power_off(); -+ -+ return IRQ_HANDLED; -+} -+ - static void __init dsmg600_timer_init(void) - { - /* The xtal on this machine is non-standard. */ -@@ -164,8 +225,6 @@ static void __init dsmg600_init(void) - dsmg600_flash_resource.end = - IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1; - -- pm_power_off = dsmg600_power_off; -- - i2c_register_board_info(0, dsmg600_i2c_board_info, - ARRAY_SIZE(dsmg600_i2c_board_info)); - -@@ -176,6 +235,29 @@ static void __init dsmg600_init(void) - (void)platform_device_register(&dsmg600_uart); - - platform_add_devices(dsmg600_devices, ARRAY_SIZE(dsmg600_devices)); -+ -+ pm_power_off = dsmg600_power_off; -+ -+ if (request_irq(gpio_to_irq(DSMG600_RB_GPIO), &dsmg600_reset_handler, -+ IRQF_DISABLED | IRQF_TRIGGER_LOW, -+ "DSM-G600 reset button", NULL) < 0) { -+ -+ printk(KERN_DEBUG "Reset Button IRQ %d not available\n", -+ gpio_to_irq(DSMG600_RB_GPIO)); -+ } -+ -+ /* The power button on the D-Link DSM-G600 is on GPIO 15, but -+ * it cannot handle interrupts on that GPIO line. So we'll -+ * have to poll it with a kernel timer. -+ */ -+ -+ /* Make sure that the power button GPIO is set up as an input */ -+ gpio_line_config(DSMG600_PB_GPIO, IXP4XX_GPIO_IN); -+ -+ /* Set the initial value for the power button IRQ handler */ -+ power_button_countdown = PBUTTON_HOLDDOWN_COUNT; -+ -+ mod_timer(&dsmg600_power_timer, jiffies + msecs_to_jiffies(500)); - } - - MACHINE_START(DSMG600, "D-Link DSM-G600 RevA") diff --git a/target/linux/ixp4xx/patches-2.6.24/033-velocity_be.patch b/target/linux/ixp4xx/patches-2.6.24/033-velocity_be.patch deleted file mode 100644 index 854de9e76c..0000000000 --- a/target/linux/ixp4xx/patches-2.6.24/033-velocity_be.patch +++ /dev/null @@ -1,899 +0,0 @@ -Index: linux-2.6.24.7/drivers/net/via-velocity.c -=================================================================== ---- linux-2.6.24.7.orig/drivers/net/via-velocity.c -+++ linux-2.6.24.7/drivers/net/via-velocity.c -@@ -254,11 +254,31 @@ MODULE_AUTHOR("VIA Networking Technologi - MODULE_LICENSE("GPL"); - MODULE_DESCRIPTION("VIA Networking Velocity Family Gigabit Ethernet Adapter Driver"); - -+/* Valid values for vdebug (additive, this is a bitmask): -+ * 0x00 => off -+ * 0x01 => always on -+ * 0x02 => additional detail on tx (rx, too, if anyone implements same) -+ * 0x04 => detail the initialization process -+ * 0x08 => spot debug detail; to be used as developers see fit -+ */ -+static int vdebug = 0; -+ -+/* HAIL - these macros are for the normal 0x01-type tracing... */ -+#define HAIL(S) \ -+ if (vdebug&1) printk(KERN_NOTICE "%s\n", (S)); -+#define HAILS(S,T) \ -+ if (vdebug&1) printk(KERN_NOTICE "%s -> status=0x%x\n", (S), (T)); -+ - #define VELOCITY_PARAM(N,D) \ - static int N[MAX_UNITS]=OPTION_DEFAULT;\ - module_param_array(N, int, NULL, 0); \ - MODULE_PARM_DESC(N, D); - -+#define VELO_DEBUG_MIN 0 -+#define VELO_DEBUG_MAX 255 -+#define VELO_DEBUG_DEF 0 -+VELOCITY_PARAM(velo_debug, "Debug level"); -+ - #define RX_DESC_MIN 64 - #define RX_DESC_MAX 255 - #define RX_DESC_DEF 64 -@@ -557,12 +577,12 @@ static void __devinit velocity_set_bool_ - if (val == -1) - *opt |= (def ? flag : 0); - else if (val < 0 || val > 1) { -- printk(KERN_NOTICE "%s: the value of parameter %s is invalid, the valid range is (0-1)\n", -- devname, name); -+ printk(KERN_NOTICE "via-velocity: the value of parameter %s is invalid, the valid range is (0-1)\n", -+ name); - *opt |= (def ? flag : 0); - } else { -- printk(KERN_INFO "%s: set parameter %s to %s\n", -- devname, name, val ? "TRUE" : "FALSE"); -+ printk(KERN_INFO "via-velocity: set parameter %s to %s\n", -+ name, val ? "TRUE" : "FALSE"); - *opt |= (val ? flag : 0); - } - } -@@ -580,6 +600,7 @@ static void __devinit velocity_set_bool_ - static void __devinit velocity_get_options(struct velocity_opt *opts, int index, char *devname) - { - -+ velocity_set_int_opt(&opts->velo_debug, velo_debug[index], VELO_DEBUG_MIN, VELO_DEBUG_MAX, VELO_DEBUG_DEF, "velo_debug", devname); - velocity_set_int_opt(&opts->rx_thresh, rx_thresh[index], RX_THRESH_MIN, RX_THRESH_MAX, RX_THRESH_DEF, "rx_thresh", devname); - velocity_set_int_opt(&opts->DMA_length, DMA_length[index], DMA_LENGTH_MIN, DMA_LENGTH_MAX, DMA_LENGTH_DEF, "DMA_length", devname); - velocity_set_int_opt(&opts->numrx, RxDescriptors[index], RX_DESC_MIN, RX_DESC_MAX, RX_DESC_DEF, "RxDescriptors", devname); -@@ -593,6 +614,7 @@ static void __devinit velocity_get_optio - velocity_set_int_opt((int *) &opts->wol_opts, wol_opts[index], WOL_OPT_MIN, WOL_OPT_MAX, WOL_OPT_DEF, "Wake On Lan options", devname); - velocity_set_int_opt((int *) &opts->int_works, int_works[index], INT_WORKS_MIN, INT_WORKS_MAX, INT_WORKS_DEF, "Interrupt service works", devname); - opts->numrx = (opts->numrx & ~3); -+ vdebug = opts->velo_debug; - } - - /** -@@ -608,6 +630,8 @@ static void velocity_init_cam_filter(str - struct mac_regs __iomem * regs = vptr->mac_regs; - unsigned short vid; - -+ HAIL("velocity_init_cam_filter"); -+ - /* Turn on MCFG_PQEN, turn off MCFG_RTGOPT */ - WORD_REG_BITS_SET(MCFG_PQEN, MCFG_RTGOPT, ®s->MCFG); - WORD_REG_BITS_ON(MCFG_VIDFR, ®s->MCFG); -@@ -636,8 +660,10 @@ static void velocity_init_cam_filter(str - } else { - u16 temp = 0; - mac_set_vlan_cam(regs, 0, (u8 *) &temp); -- temp = 1; -- mac_set_vlan_cam_mask(regs, (u8 *) &temp); -+ /* temp = 1; BE */ -+ /* mac_set_vlan_cam_mask(regs, (u8 *) &temp); BE */ -+ vptr->vCAMmask[0] |= 1; /* BE */ -+ mac_set_vlan_cam_mask(regs, vptr->vCAMmask); /* BE */ - } - } - -@@ -675,13 +701,15 @@ static void velocity_rx_reset(struct vel - struct mac_regs __iomem * regs = vptr->mac_regs; - int i; - -+ HAIL("velocity_rx_reset"); - vptr->rd_dirty = vptr->rd_filled = vptr->rd_curr = 0; - - /* - * Init state, all RD entries belong to the NIC - */ - for (i = 0; i < vptr->options.numrx; ++i) -- vptr->rd_ring[i].rdesc0.owner = OWNED_BY_NIC; -+ /* vptr->rd_ring[i].rdesc0.owner = OWNED_BY_NIC; BE */ -+ vptr->rd_ring[i].rdesc0 |= cpu_to_le32(BE_OWNED_BY_NIC); /* BE */ - - writew(vptr->options.numrx, ®s->RBRDU); - writel(vptr->rd_pool_dma, ®s->RDBaseLo); -@@ -704,12 +732,15 @@ static void velocity_init_registers(stru - struct mac_regs __iomem * regs = vptr->mac_regs; - int i, mii_status; - -+ if (vdebug&5) printk(KERN_NOTICE "velocity_init_registers: entering\n"); -+ - mac_wol_reset(regs); - - switch (type) { - case VELOCITY_INIT_RESET: - case VELOCITY_INIT_WOL: - -+ if (vdebug&4) printk(KERN_NOTICE "velocity_init_registers: RESET or WOL\n"); - netif_stop_queue(vptr->dev); - - /* -@@ -737,12 +768,13 @@ static void velocity_init_registers(stru - - case VELOCITY_INIT_COLD: - default: -+ if (vdebug&4) printk(KERN_NOTICE "velocity_init_registers: COLD or default\n"); - /* - * Do reset - */ - velocity_soft_reset(vptr); -+ if (vdebug&4) printk(KERN_NOTICE "velocity_init_registers: soft reset complete.\n"); - mdelay(5); -- - mac_eeprom_reload(regs); - for (i = 0; i < 6; i++) { - writeb(vptr->dev->dev_addr[i], &(regs->PAR[i])); -@@ -760,11 +792,16 @@ static void velocity_init_registers(stru - */ - BYTE_REG_BITS_SET(CFGB_OFSET, (CFGB_CRANDOM | CFGB_CAP | CFGB_MBA | CFGB_BAKOPT), ®s->CFGB); - -+ if (vdebug&4) printk(KERN_NOTICE "velocity_init_registers: Initializing CAM filter\n"); - /* - * Init CAM filter - */ -+ if (vdebug&8) printk(KERN_NOTICE "velocity: spot debug: about to init CAM filters\n"); -+ mdelay(5); /* MJW - ARM processors, kernel 2.6.19 - this fixes oopses and hangs */ - velocity_init_cam_filter(vptr); -+ if (vdebug&8) printk(KERN_NOTICE "velocity: spot debug: init CAM filters complete\n"); - -+ if (vdebug&4) printk(KERN_NOTICE "velocity_init_registers: Setting packet filter\n"); - /* - * Set packet filter: Receive directed and broadcast address - */ -@@ -774,10 +811,12 @@ static void velocity_init_registers(stru - * Enable MII auto-polling - */ - enable_mii_autopoll(regs); -+ if (vdebug&4) printk(KERN_NOTICE "velocity_init_registers: enable_mii_autopoll complete.\n"); - - vptr->int_mask = INT_MASK_DEF; - -- writel(cpu_to_le32(vptr->rd_pool_dma), ®s->RDBaseLo); -+ /* writel(cpu_to_le32(vptr->rd_pool_dma), ®s->RDBaseLo); BE */ -+ writel((vptr->rd_pool_dma), ®s->RDBaseLo); /* BE */ - writew(vptr->options.numrx - 1, ®s->RDCSize); - mac_rx_queue_run(regs); - mac_rx_queue_wake(regs); -@@ -785,10 +824,13 @@ static void velocity_init_registers(stru - writew(vptr->options.numtx - 1, ®s->TDCSize); - - for (i = 0; i < vptr->num_txq; i++) { -- writel(cpu_to_le32(vptr->td_pool_dma[i]), &(regs->TDBaseLo[i])); -+ /* writel(cpu_to_le32(vptr->td_pool_dma[i]), &(regs->TDBaseLo[i])); BE */ -+ writel((vptr->td_pool_dma[i]), &(regs->TDBaseLo[i])); /* BE */ - mac_tx_queue_run(regs, i); - } - -+ if (vdebug&4) printk(KERN_NOTICE "velocity_init_registers: DMA settings complete.\n"); -+ - init_flow_control_register(vptr); - - writel(CR0_STOP, ®s->CR0Clr); -@@ -807,8 +849,10 @@ static void velocity_init_registers(stru - - enable_flow_control_ability(vptr); - mac_hw_mibs_init(regs); -+ if (vdebug&4) printk(KERN_NOTICE "velocity_init_registers: Set interrupt mask\n"); - mac_write_int_mask(vptr->int_mask, regs); - mac_clear_isr(regs); -+ if (vdebug&4) printk(KERN_NOTICE "velocity_init_registers: complete.\n"); - - } - } -@@ -826,6 +870,7 @@ static int velocity_soft_reset(struct ve - struct mac_regs __iomem * regs = vptr->mac_regs; - int i = 0; - -+ HAIL("velocity_soft_reset"); - writel(CR0_SFRST, ®s->CR0Set); - - for (i = 0; i < W_MAX_TIMEOUT; i++) { -@@ -888,6 +933,7 @@ static int __devinit velocity_found1(str - VELOCITY_FULL_DRV_NAM, VELOCITY_VERSION); - printk(KERN_INFO "Copyright (c) 2002, 2003 VIA Networking Technologies, Inc.\n"); - printk(KERN_INFO "Copyright (c) 2004 Red Hat Inc.\n"); -+ printk(KERN_INFO "BE support, misc. fixes MJW 01Jan2007 - may be unstable\n"); - first = 0; - } - -@@ -1104,6 +1150,7 @@ static int velocity_init_rings(struct ve - dma_addr_t pool_dma; - u8 *pool; - -+ HAIL("velocity_init_rings"); - /* - * Allocate all RD/TD rings a single pool - */ -@@ -1166,6 +1213,7 @@ static int velocity_init_rings(struct ve - static void velocity_free_rings(struct velocity_info *vptr) - { - int size; -+ HAIL("velocity_free_rings"); - - size = vptr->options.numrx * sizeof(struct rx_desc) + - vptr->options.numtx * sizeof(struct tx_desc) * vptr->num_txq; -@@ -1182,6 +1230,7 @@ static inline void velocity_give_many_rx - struct mac_regs __iomem *regs = vptr->mac_regs; - int avail, dirty, unusable; - -+ HAIL("velocity_give_many_rx_descs"); - /* - * RD number must be equal to 4X per hardware spec - * (programming guide rev 1.20, p.13) -@@ -1195,7 +1244,8 @@ static inline void velocity_give_many_rx - dirty = vptr->rd_dirty - unusable; - for (avail = vptr->rd_filled & 0xfffc; avail; avail--) { - dirty = (dirty > 0) ? dirty - 1 : vptr->options.numrx - 1; -- vptr->rd_ring[dirty].rdesc0.owner = OWNED_BY_NIC; -+ /* vptr->rd_ring[dirty].rdesc0.owner = OWNED_BY_NIC; BE */ -+ vptr->rd_ring[dirty].rdesc0 |= cpu_to_le32(BE_OWNED_BY_NIC); /* BE */ - } - - writew(vptr->rd_filled & 0xfffc, ®s->RBRDU); -@@ -1205,12 +1255,14 @@ static inline void velocity_give_many_rx - static int velocity_rx_refill(struct velocity_info *vptr) - { - int dirty = vptr->rd_dirty, done = 0, ret = 0; -+ HAIL("velocity_rx_refill"); - - do { - struct rx_desc *rd = vptr->rd_ring + dirty; - - /* Fine for an all zero Rx desc at init time as well */ -- if (rd->rdesc0.owner == OWNED_BY_NIC) -+ /* if (rd->rdesc0.owner == OWNED_BY_NIC) BE */ -+ if (rd->rdesc0 & cpu_to_le32(BE_OWNED_BY_NIC)) /* BE */ - break; - - if (!vptr->rd_info[dirty].skb) { -@@ -1244,6 +1296,7 @@ static int velocity_init_rd_ring(struct - int ret; - int mtu = vptr->dev->mtu; - -+ HAIL("velocity_init_rd_ring"); - vptr->rx_buf_sz = (mtu <= ETH_DATA_LEN) ? PKT_BUF_SZ : mtu + 32; - - vptr->rd_info = kcalloc(vptr->options.numrx, -@@ -1275,6 +1328,7 @@ static void velocity_free_rd_ring(struct - { - int i; - -+ HAIL("velocity_free_rd_ring"); - if (vptr->rd_info == NULL) - return; - -@@ -1314,6 +1368,7 @@ static int velocity_init_td_ring(struct - struct tx_desc *td; - struct velocity_td_info *td_info; - -+ HAIL("velocity_init_td_ring"); - /* Init the TD ring entries */ - for (j = 0; j < vptr->num_txq; j++) { - curr = vptr->td_pool_dma[j]; -@@ -1350,6 +1405,7 @@ static void velocity_free_td_ring_entry( - struct velocity_td_info * td_info = &(vptr->td_infos[q][n]); - int i; - -+ HAIL("velocity_free_td_ring_entry"); - if (td_info == NULL) - return; - -@@ -1379,6 +1435,7 @@ static void velocity_free_td_ring(struct - { - int i, j; - -+ HAIL("velocity_free_td_ring"); - for (j = 0; j < vptr->num_txq; j++) { - if (vptr->td_infos[j] == NULL) - continue; -@@ -1406,34 +1463,42 @@ static int velocity_rx_srv(struct veloci - struct net_device_stats *stats = &vptr->stats; - int rd_curr = vptr->rd_curr; - int works = 0; -+ u16 wRSR; /* BE */ - -+ HAILS("velocity_rx_srv", status); - do { - struct rx_desc *rd = vptr->rd_ring + rd_curr; - - if (!vptr->rd_info[rd_curr].skb) - break; - -- if (rd->rdesc0.owner == OWNED_BY_NIC) -+ /* if (rd->rdesc0.owner == OWNED_BY_NIC) BE */ -+ if (rd->rdesc0 & cpu_to_le32(BE_OWNED_BY_NIC)) /* BE */ - break; - - rmb(); - -+ wRSR = (u16)(cpu_to_le32(rd->rdesc0)); /* BE */ - /* - * Don't drop CE or RL error frame although RXOK is off - */ -- if ((rd->rdesc0.RSR & RSR_RXOK) || (!(rd->rdesc0.RSR & RSR_RXOK) && (rd->rdesc0.RSR & (RSR_CE | RSR_RL)))) { -+ /* if ((rd->rdesc0.RSR & RSR_RXOK) || (!(rd->rdesc0.RSR & RSR_RXOK) && (rd->rdesc0.RSR & (RSR_CE | RSR_RL)))) { BE */ -+ if ((wRSR & RSR_RXOK) || (!(wRSR & RSR_RXOK) && (wRSR & (RSR_CE | RSR_RL)))) { /* BE */ - if (velocity_receive_frame(vptr, rd_curr) < 0) - stats->rx_dropped++; - } else { -- if (rd->rdesc0.RSR & RSR_CRC) -+ /* if (rd->rdesc0.RSR & RSR_CRC) BE */ -+ if (wRSR & RSR_CRC) /* BE */ - stats->rx_crc_errors++; -- if (rd->rdesc0.RSR & RSR_FAE) -+ /* if (rd->rdesc0.RSR & RSR_FAE) BE */ -+ if (wRSR & RSR_FAE) /* BE */ - stats->rx_frame_errors++; - - stats->rx_dropped++; - } - -- rd->inten = 1; -+ /* rd->inten = 1; BE */ -+ rd->ltwo |= cpu_to_le32(BE_INT_ENABLE); /* BE */ - - vptr->dev->last_rx = jiffies; - -@@ -1464,13 +1529,21 @@ static int velocity_rx_srv(struct veloci - - static inline void velocity_rx_csum(struct rx_desc *rd, struct sk_buff *skb) - { -+ u8 bCSM; -+ HAIL("velocity_rx_csum"); - skb->ip_summed = CHECKSUM_NONE; - -- if (rd->rdesc1.CSM & CSM_IPKT) { -- if (rd->rdesc1.CSM & CSM_IPOK) { -- if ((rd->rdesc1.CSM & CSM_TCPKT) || -- (rd->rdesc1.CSM & CSM_UDPKT)) { -- if (!(rd->rdesc1.CSM & CSM_TUPOK)) { -+// if (rd->rdesc1.CSM & CSM_IPKT) { -+// if (rd->rdesc1.CSM & CSM_IPOK) { -+// if ((rd->rdesc1.CSM & CSM_TCPKT) || -+// (rd->rdesc1.CSM & CSM_UDPKT)) { -+// if (!(rd->rdesc1.CSM & CSM_TUPOK)) { -+ bCSM = (u8)(cpu_to_le32(rd->rdesc1) >> 16); /* BE */ -+ if (bCSM & CSM_IPKT) { -+ if (bCSM & CSM_IPOK) { -+ if ((bCSM & CSM_TCPKT) || -+ (bCSM & CSM_UDPKT)) { -+ if (!(bCSM & CSM_TUPOK)) { /* BE */ - return; - } - } -@@ -1496,9 +1569,11 @@ static inline int velocity_rx_copy(struc - { - int ret = -1; - -+ HAIL("velocity_rx_copy"); - if (pkt_size < rx_copybreak) { - struct sk_buff *new_skb; - -+ HAIL("velocity_rx_copy (working...)"); - new_skb = dev_alloc_skb(pkt_size + 2); - if (new_skb) { - new_skb->dev = vptr->dev; -@@ -1529,10 +1604,12 @@ static inline int velocity_rx_copy(struc - static inline void velocity_iph_realign(struct velocity_info *vptr, - struct sk_buff *skb, int pkt_size) - { -+ HAIL("velocity_iph_realign"); - /* FIXME - memmove ? */ - if (vptr->flags & VELOCITY_FLAGS_IP_ALIGN) { - int i; - -+ HAIL("velocity_iph_realign (working...)"); - for (i = pkt_size; i >= 0; i--) - *(skb->data + i + 2) = *(skb->data + i); - skb_reserve(skb, 2); -@@ -1551,19 +1628,27 @@ static inline void velocity_iph_realign( - static int velocity_receive_frame(struct velocity_info *vptr, int idx) - { - void (*pci_action)(struct pci_dev *, dma_addr_t, size_t, int); -+ u16 pkt_len; /* BE */ -+ u16 wRSR; /* BE */ -+ struct sk_buff *skb; - struct net_device_stats *stats = &vptr->stats; - struct velocity_rd_info *rd_info = &(vptr->rd_info[idx]); - struct rx_desc *rd = &(vptr->rd_ring[idx]); -- int pkt_len = rd->rdesc0.len; -- struct sk_buff *skb; -+ /* int pkt_len = rd->rdesc0.len BE */; -+ -+ pkt_len = ((cpu_to_le32(rd->rdesc0) >> 16) & 0x00003FFFUL); /* BE */ -+ wRSR = (u16)(cpu_to_le32(rd->rdesc0)); /* BE */ - -- if (rd->rdesc0.RSR & (RSR_STP | RSR_EDP)) { -+ HAIL("velocity_receive_frame"); -+ /* if (rd->rdesc0.RSR & (RSR_STP | RSR_EDP)) { BE */ -+ if (wRSR & (RSR_STP | RSR_EDP)) { /* BE */ - VELOCITY_PRT(MSG_LEVEL_VERBOSE, KERN_ERR " %s : the received frame span multple RDs.\n", vptr->dev->name); - stats->rx_length_errors++; - return -EINVAL; - } - -- if (rd->rdesc0.RSR & RSR_MAR) -+ /* if (rd->rdesc0.RSR & RSR_MAR) BE */ -+ if (wRSR & RSR_MAR) /* BE */ - vptr->stats.multicast++; - - skb = rd_info->skb; -@@ -1576,7 +1661,8 @@ static int velocity_receive_frame(struct - */ - - if (vptr->flags & VELOCITY_FLAGS_VAL_PKT_LEN) { -- if (rd->rdesc0.RSR & RSR_RL) { -+ /* if (rd->rdesc0.RSR & RSR_RL) { BE */ -+ if (wRSR & RSR_RL) { /* BE */ - stats->rx_length_errors++; - return -EINVAL; - } -@@ -1620,6 +1706,7 @@ static int velocity_alloc_rx_buf(struct - struct rx_desc *rd = &(vptr->rd_ring[idx]); - struct velocity_rd_info *rd_info = &(vptr->rd_info[idx]); - -+ HAIL("velocity_alloc_rx_buf"); - rd_info->skb = dev_alloc_skb(vptr->rx_buf_sz + 64); - if (rd_info->skb == NULL) - return -ENOMEM; -@@ -1637,10 +1724,14 @@ static int velocity_alloc_rx_buf(struct - */ - - *((u32 *) & (rd->rdesc0)) = 0; -- rd->len = cpu_to_le32(vptr->rx_buf_sz); -- rd->inten = 1; -+ /* rd->len = cpu_to_le32(vptr->rx_buf_sz); BE */ -+ /* rd->inten = 1; BE */ - rd->pa_low = cpu_to_le32(rd_info->skb_dma); -- rd->pa_high = 0; -+ /* rd->pa_high = 0; BE */ -+ rd->ltwo &= cpu_to_le32(0xC000FFFFUL); /* BE */ -+ rd->ltwo |= cpu_to_le32((vptr->rx_buf_sz << 16)); /* BE */ -+ rd->ltwo |= cpu_to_le32(BE_INT_ENABLE); /* BE */ -+ rd->ltwo &= cpu_to_le32(0xFFFF0000UL); /* BE */ - return 0; - } - -@@ -1661,9 +1752,11 @@ static int velocity_tx_srv(struct veloci - int full = 0; - int idx; - int works = 0; -+ u16 wTSR; /* BE */ - struct velocity_td_info *tdinfo; - struct net_device_stats *stats = &vptr->stats; - -+ HAILS("velocity_tx_srv", status); - for (qnum = 0; qnum < vptr->num_txq; qnum++) { - for (idx = vptr->td_tail[qnum]; vptr->td_used[qnum] > 0; - idx = (idx + 1) % vptr->options.numtx) { -@@ -1674,22 +1767,29 @@ static int velocity_tx_srv(struct veloci - td = &(vptr->td_rings[qnum][idx]); - tdinfo = &(vptr->td_infos[qnum][idx]); - -- if (td->tdesc0.owner == OWNED_BY_NIC) -+ /* if (td->tdesc0.owner == OWNED_BY_NIC) BE */ -+ if (td->tdesc0 & cpu_to_le32(BE_OWNED_BY_NIC)) /* BE */ - break; - - if ((works++ > 15)) - break; - -- if (td->tdesc0.TSR & TSR0_TERR) { -+ wTSR = (u16)cpu_to_le32(td->tdesc0); -+ /* if (td->tdesc0.TSR & TSR0_TERR) { BE */ -+ if (wTSR & TSR0_TERR) { /* BE */ - stats->tx_errors++; - stats->tx_dropped++; -- if (td->tdesc0.TSR & TSR0_CDH) -+ /* if (td->tdesc0.TSR & TSR0_CDH) BE */ -+ if (wTSR & TSR0_CDH) /* BE */ - stats->tx_heartbeat_errors++; -- if (td->tdesc0.TSR & TSR0_CRS) -+ /* if (td->tdesc0.TSR & TSR0_CRS) BE */ -+ if (wTSR & TSR0_CRS) /* BE */ - stats->tx_carrier_errors++; -- if (td->tdesc0.TSR & TSR0_ABT) -+ /* if (td->tdesc0.TSR & TSR0_ABT) BE */ -+ if (wTSR & TSR0_ABT) /* BE */ - stats->tx_aborted_errors++; -- if (td->tdesc0.TSR & TSR0_OWC) -+ /* if (td->tdesc0.TSR & TSR0_OWC) BE */ -+ if (wTSR & TSR0_OWC) /* BE */ - stats->tx_window_errors++; - } else { - stats->tx_packets++; -@@ -1778,6 +1878,7 @@ static void velocity_print_link_status(s - - static void velocity_error(struct velocity_info *vptr, int status) - { -+ HAILS("velocity_error", status); - - if (status & ISR_TXSTLI) { - struct mac_regs __iomem * regs = vptr->mac_regs; -@@ -1867,6 +1968,7 @@ static void velocity_free_tx_buf(struct - struct sk_buff *skb = tdinfo->skb; - int i; - -+ HAIL("velocity_free_tx_buf"); - /* - * Don't unmap the pre-allocated tx_bufs - */ -@@ -2067,6 +2169,7 @@ static int velocity_xmit(struct sk_buff - struct velocity_td_info *tdinfo; - unsigned long flags; - int index; -+ u32 lbufsz; /* BE */ - - int pktlen = skb->len; - -@@ -2083,9 +2186,18 @@ static int velocity_xmit(struct sk_buff - td_ptr = &(vptr->td_rings[qnum][index]); - tdinfo = &(vptr->td_infos[qnum][index]); - -- td_ptr->tdesc1.TCPLS = TCPLS_NORMAL; -- td_ptr->tdesc1.TCR = TCR0_TIC; -- td_ptr->td_buf[0].queue = 0; -+ td_ptr->tdesc0 = 0x00000000UL; /* BE */ -+ td_ptr->tdesc1 = 0x00000000UL; /* BE */ -+ -+ /* td_ptr->tdesc1.TCPLS = TCPLS_NORMAL; BE */ -+ td_ptr->tdesc1 &= cpu_to_le32(0xfcffffffUL); /* BE */ -+ td_ptr->tdesc1 |= cpu_to_le32(((u32)TCPLS_NORMAL) << 24); /* BE */ -+ -+ /* td_ptr->tdesc1.TCR = TCR0_TIC; BE */ -+ td_ptr->tdesc1 |= cpu_to_le32(BE_TCR_TIC); /* BE */ -+ -+ /* td_ptr->td_buf[0].queue = 0; BE */ -+ td_ptr->td_buf[0].ltwo &= cpu_to_le32(~BE_QUEUE_ENABLE); /* BE */ - - /* - * Pad short frames. -@@ -2097,20 +2209,36 @@ static int velocity_xmit(struct sk_buff - memset(tdinfo->buf + skb->len, 0, ETH_ZLEN - skb->len); - tdinfo->skb = skb; - tdinfo->skb_dma[0] = tdinfo->buf_dma; -- td_ptr->tdesc0.pktsize = pktlen; -+ /* td_ptr->tdesc0.pktsize = pktlen; */ -+ td_ptr->tdesc0 &= cpu_to_le32(0xc000ffffUL); /* BE */ -+ lbufsz = pktlen; /* Assign, and make sure it's unsigned 32 bits - BE */ -+ lbufsz = lbufsz << 16; /* BE - shift over */ -+ td_ptr->tdesc0 |= cpu_to_le32(lbufsz); /* BE */ -+ - td_ptr->td_buf[0].pa_low = cpu_to_le32(tdinfo->skb_dma[0]); -- td_ptr->td_buf[0].pa_high = 0; -- td_ptr->td_buf[0].bufsize = td_ptr->tdesc0.pktsize; -+ /* td_ptr->td_buf[0].pa_high = 0; */ -+ /* td_ptr->td_buf[0].bufsize = td_ptr->tdesc0.pktsize; */ -+ td_ptr->td_buf[0].ltwo = cpu_to_le32(lbufsz); /* BE */ - tdinfo->nskb_dma = 1; -- td_ptr->tdesc1.CMDZ = 2; -+ /* td_ptr->tdesc1.CMDZ = 2; */ -+ td_ptr->tdesc1 &= cpu_to_le32(0x0fffffffUL); /* BE */ -+ td_ptr->tdesc1 |= cpu_to_le32(((u32)0x2) << 28); /* BE */ - } else - #ifdef VELOCITY_ZERO_COPY_SUPPORT -+ /* -+ * BE - NOTE on the VELOCITY_ZERO_COPY_SUPPORT: -+ * This block of code has NOT been patched up for BE support, as -+ * it is certainly broken -- if it compiles at all. Since the BE -+ * fixes depend on the broken code, attempts to convert to BE support -+ * would almost certainly confuse more than help. -+ */ - if (skb_shinfo(skb)->nr_frags > 0) { - int nfrags = skb_shinfo(skb)->nr_frags; - tdinfo->skb = skb; - if (nfrags > 6) { - skb_copy_from_linear_data(skb, tdinfo->buf, skb->len); - tdinfo->skb_dma[0] = tdinfo->buf_dma; -+ /* BE: Er, exactly what value are we assigning in this next line? */ - td_ptr->tdesc0.pktsize = - td_ptr->td_buf[0].pa_low = cpu_to_le32(tdinfo->skb_dma[0]); - td_ptr->td_buf[0].pa_high = 0; -@@ -2127,6 +2255,7 @@ static int velocity_xmit(struct sk_buff - /* FIXME: support 48bit DMA later */ - td_ptr->td_buf[i].pa_low = cpu_to_le32(tdinfo->skb_dma); - td_ptr->td_buf[i].pa_high = 0; -+ /* BE: This next line can't be right: */ - td_ptr->td_buf[i].bufsize = skb->len->skb->data_len; - - for (i = 0; i < nfrags; i++) { -@@ -2144,7 +2273,7 @@ static int velocity_xmit(struct sk_buff - } - - } else --#endif -+#endif /* (broken) VELOCITY_ZERO_COPY_SUPPORT */ - { - /* - * Map the linear network buffer into PCI space and -@@ -2152,19 +2281,29 @@ static int velocity_xmit(struct sk_buff - */ - tdinfo->skb = skb; - tdinfo->skb_dma[0] = pci_map_single(vptr->pdev, skb->data, pktlen, PCI_DMA_TODEVICE); -- td_ptr->tdesc0.pktsize = pktlen; -+ /* td_ptr->tdesc0.pktsize = pktlen; BE */ -+ td_ptr->tdesc0 &= cpu_to_le32(0xc000ffffUL); /* BE */ -+ lbufsz = pktlen; /* Assign, and make sure it's unsigned 32 bits - BE */ -+ lbufsz = lbufsz << 16; /* BE */ -+ td_ptr->tdesc0 |= cpu_to_le32(lbufsz); /* BE */ - td_ptr->td_buf[0].pa_low = cpu_to_le32(tdinfo->skb_dma[0]); -- td_ptr->td_buf[0].pa_high = 0; -- td_ptr->td_buf[0].bufsize = td_ptr->tdesc0.pktsize; -+ /* td_ptr->td_buf[0].pa_high = 0; BE */ -+ /* td_ptr->td_buf[0].bufsize = td_ptr->tdesc0.pktsize; BE */ -+ td_ptr->td_buf[0].ltwo = cpu_to_le32(lbufsz); /* BE */ - tdinfo->nskb_dma = 1; -- td_ptr->tdesc1.CMDZ = 2; -+ /* td_ptr->tdesc1.CMDZ = 2; BE */ -+ td_ptr->tdesc1 &= cpu_to_le32(0x0fffffffUL); /* BE */ -+ td_ptr->tdesc1 |= cpu_to_le32(((u32)0x2) << 28); /* BE */ - } - - if (vptr->vlgrp && vlan_tx_tag_present(skb)) { -- td_ptr->tdesc1.pqinf.VID = vlan_tx_tag_get(skb); -- td_ptr->tdesc1.pqinf.priority = 0; -- td_ptr->tdesc1.pqinf.CFI = 0; -- td_ptr->tdesc1.TCR |= TCR0_VETAG; -+ /* td_ptr->tdesc1.pqinf.VID = vlan_tx_tag_get(skb); BE */ -+ /* td_ptr->tdesc1.pqinf.priority = 0; BE */ -+ /* td_ptr->tdesc1.pqinf.CFI = 0; BE */ -+ /* td_ptr->tdesc1.TCR |= TCR0_VETAG; BE */ -+ td_ptr->tdesc1 &= cpu_to_le32(0xFFFF0000UL); /* BE */ -+ td_ptr->tdesc1 |= cpu_to_le32(vlan_tx_tag_get(skb)); /* BE */ -+ td_ptr->tdesc1 |= cpu_to_le32(BE_TCR_VETAG); /* BE */ - } - - /* -@@ -2174,26 +2313,34 @@ static int velocity_xmit(struct sk_buff - && (skb->ip_summed == CHECKSUM_PARTIAL)) { - const struct iphdr *ip = ip_hdr(skb); - if (ip->protocol == IPPROTO_TCP) -- td_ptr->tdesc1.TCR |= TCR0_TCPCK; -+ /* td_ptr->tdesc1.TCR |= TCR0_TCPCK; BE */ -+ td_ptr->tdesc1 |= cpu_to_le32(BE_TCR_TCPCK); /* BE */ - else if (ip->protocol == IPPROTO_UDP) -- td_ptr->tdesc1.TCR |= (TCR0_UDPCK); -- td_ptr->tdesc1.TCR |= TCR0_IPCK; -- } -+ /* td_ptr->tdesc1.TCR |= (TCR0_UDPCK); BE */ -+ td_ptr->tdesc1 |= cpu_to_le32(BE_TCR_UDPCK); /* BE */ -+ /* td_ptr->tdesc1.TCR |= TCR0_IPCK; BE */ -+ td_ptr->tdesc1 |= cpu_to_le32(BE_TCR_IPCK); /* BE */ -+ } - { - - int prev = index - 1; - - if (prev < 0) - prev = vptr->options.numtx - 1; -- td_ptr->tdesc0.owner = OWNED_BY_NIC; -+ /* td_ptr->tdesc0.owner = OWNED_BY_NIC; BE */ -+ td_ptr->tdesc0 |= cpu_to_le32(BE_OWNED_BY_NIC); /* BE */ - vptr->td_used[qnum]++; - vptr->td_curr[qnum] = (index + 1) % vptr->options.numtx; - - if (AVAIL_TD(vptr, qnum) < 1) - netif_stop_queue(dev); - -- td_ptr = &(vptr->td_rings[qnum][prev]); -- td_ptr->td_buf[0].queue = 1; -+ td_ptr = &(vptr->td_rings[qnum][prev]); -+ /* td_ptr->td_buf[0].queue = 1; BE */ -+ td_ptr->td_buf[0].ltwo |= cpu_to_le32(BE_QUEUE_ENABLE); /* BE */ -+ if (vdebug&2) printk(KERN_NOTICE "velocity_xmit: (%s) len=%d idx=%d tdesc0=0x%x tdesc1=0x%x ltwo=0x%x\n", -+ (pktlen<ETH_ZLEN) ? "short" : "normal", pktlen, index, -+ td_ptr->tdesc0, td_ptr->tdesc1, td_ptr->td_buf[0].ltwo); - mac_tx_queue_wake(vptr->mac_regs, qnum); - } - dev->trans_start = jiffies; -@@ -2219,7 +2366,7 @@ static int velocity_intr(int irq, void * - u32 isr_status; - int max_count = 0; - -- -+ HAIL("velocity_intr"); - spin_lock(&vptr->lock); - isr_status = mac_read_isr(vptr->mac_regs); - -@@ -2238,7 +2385,10 @@ static int velocity_intr(int irq, void * - - while (isr_status != 0) { - mac_write_isr(vptr->mac_regs, isr_status); -- if (isr_status & (~(ISR_PRXI | ISR_PPRXI | ISR_PTXI | ISR_PPTXI))) -+ HAILS("velocity_intr",isr_status); -+ /* MJW - velocity_error is ALWAYS called; need to mask off some other flags */ -+ /* if (isr_status & (~(ISR_PRXI | ISR_PPRXI | ISR_PTXI | ISR_PPTXI))) */ -+ if (isr_status & (~(ISR_PRXI | ISR_PPRXI | ISR_PTXI | ISR_PPTXI | ISR_PTX0I | ISR_ISR0))) - velocity_error(vptr, isr_status); - if (isr_status & (ISR_PRXI | ISR_PPRXI)) - max_count += velocity_rx_srv(vptr, isr_status); -@@ -2276,6 +2426,7 @@ static void velocity_set_multi(struct ne - int i; - struct dev_mc_list *mclist; - -+ HAIL("velocity_set_multi"); - if (dev->flags & IFF_PROMISC) { /* Set promiscuous. */ - writel(0xffffffff, ®s->MARCAM[0]); - writel(0xffffffff, ®s->MARCAM[4]); -@@ -2319,6 +2470,7 @@ static struct net_device_stats *velocity - { - struct velocity_info *vptr = netdev_priv(dev); - -+ HAIL("net_device_stats"); - /* If the hardware is down, don't touch MII */ - if(!netif_running(dev)) - return &vptr->stats; -@@ -2363,6 +2515,7 @@ static int velocity_ioctl(struct net_dev - struct velocity_info *vptr = netdev_priv(dev); - int ret; - -+ HAIL("velocity_ioctl"); - /* If we are asked for information and the device is power - saving then we need to bring the device back up to talk to it */ - -@@ -2581,6 +2734,8 @@ static int velocity_mii_read(struct mac_ - { - u16 ww; - -+ HAIL("velocity_mii_read"); -+ HAIL("velocity_mii_write"); - /* - * Disable MIICR_MAUTO, so that mii addr can be set normally - */ -Index: linux-2.6.24.7/drivers/net/via-velocity.h -=================================================================== ---- linux-2.6.24.7.orig/drivers/net/via-velocity.h -+++ linux-2.6.24.7/drivers/net/via-velocity.h -@@ -196,64 +196,70 @@ - * Receive descriptor - */ - --struct rdesc0 { -- u16 RSR; /* Receive status */ -- u16 len:14; /* Received packet length */ -- u16 reserved:1; -- u16 owner:1; /* Who owns this buffer ? */ --}; -- --struct rdesc1 { -- u16 PQTAG; -- u8 CSM; -- u8 IPKT; --}; -+//struct rdesc0 { -+// u16 RSR; /* Receive status */ -+// u16 len:14; /* Received packet length */ -+// u16 reserved:1; -+// u16 owner:1; /* Who owns this buffer ? */ -+//}; -+ -+//struct rdesc1 { -+// u16 PQTAG; -+// u8 CSM; -+// u8 IPKT; -+//}; - - struct rx_desc { -- struct rdesc0 rdesc0; -- struct rdesc1 rdesc1; -+// struct rdesc0 rdesc0; -+// struct rdesc1 rdesc1; -+ u32 rdesc0; -+ u32 rdesc1; - u32 pa_low; /* Low 32 bit PCI address */ -- u16 pa_high; /* Next 16 bit PCI address (48 total) */ -- u16 len:15; /* Frame size */ -- u16 inten:1; /* Enable interrupt */ -+// u16 pa_high; /* Next 16 bit PCI address (48 total) */ -+// u16 len:15; /* Frame size */ -+// u16 inten:1; /* Enable interrupt */ -+ u32 ltwo; - } __attribute__ ((__packed__)); - - /* - * Transmit descriptor - */ - --struct tdesc0 { -- u16 TSR; /* Transmit status register */ -- u16 pktsize:14; /* Size of frame */ -- u16 reserved:1; -- u16 owner:1; /* Who owns the buffer */ --}; -- --struct pqinf { /* Priority queue info */ -- u16 VID:12; -- u16 CFI:1; -- u16 priority:3; --} __attribute__ ((__packed__)); -- --struct tdesc1 { -- struct pqinf pqinf; -- u8 TCR; -- u8 TCPLS:2; -- u8 reserved:2; -- u8 CMDZ:4; --} __attribute__ ((__packed__)); -+//struct tdesc0 { -+// u16 TSR; /* Transmit status register */ -+// u16 pktsize:14; /* Size of frame */ -+// u16 reserved:1; -+// u16 owner:1; /* Who owns the buffer */ -+//}; -+ -+//struct pqinf { /* Priority queue info */ -+// u16 VID:12; -+// u16 CFI:1; -+// u16 priority:3; -+//} __attribute__ ((__packed__)); -+ -+//struct tdesc1 { -+// struct pqinf pqinf; -+// u8 TCR; -+// u8 TCPLS:2; -+// u8 reserved:2; -+// u8 CMDZ:4; -+//} __attribute__ ((__packed__)); - - struct td_buf { - u32 pa_low; -- u16 pa_high; -- u16 bufsize:14; -- u16 reserved:1; -- u16 queue:1; -+// u16 pa_high; -+// u16 bufsize:14; -+// u16 reserved:1; -+// u16 queue:1; -+ u32 ltwo; - } __attribute__ ((__packed__)); - - struct tx_desc { -- struct tdesc0 tdesc0; -- struct tdesc1 tdesc1; -+// struct tdesc0 tdesc0; -+// struct tdesc1 tdesc1; -+ u32 tdesc0; -+ u32 tdesc1; - struct td_buf td_buf[7]; - }; - -@@ -279,6 +285,16 @@ enum velocity_owner { - OWNED_BY_NIC = 1 - }; - -+/* Constants added for the BE fixes */ -+#define BE_OWNED_BY_NIC 0x80000000UL -+#define BE_INT_ENABLE 0x80000000UL -+#define BE_QUEUE_ENABLE 0x80000000UL -+#define BE_TCR_TIC 0x00800000UL -+#define BE_TCR_VETAG 0x00200000UL -+#define BE_TCR_TCPCK 0x00040000UL -+#define BE_TCR_UDPCK 0x00080000UL -+#define BE_TCR_IPCK 0x00100000UL -+ - - /* - * MAC registers and macros. -@@ -1512,6 +1528,7 @@ enum velocity_flow_cntl_type { - }; - - struct velocity_opt { -+ int velo_debug; /* debug flag */ - int numrx; /* Number of RX descriptors */ - int numtx; /* Number of TX descriptors */ - enum speed_opt spd_dpx; /* Media link mode */ diff --git a/target/linux/ixp4xx/patches-2.6.24/090-increase_entropy_pools.patch b/target/linux/ixp4xx/patches-2.6.24/090-increase_entropy_pools.patch deleted file mode 100644 index 4c8e553aeb..0000000000 --- a/target/linux/ixp4xx/patches-2.6.24/090-increase_entropy_pools.patch +++ /dev/null @@ -1,17 +0,0 @@ -Index: linux-2.6.24.7/drivers/char/random.c -=================================================================== ---- linux-2.6.24.7.orig/drivers/char/random.c -+++ linux-2.6.24.7/drivers/char/random.c -@@ -248,9 +248,9 @@ - /* - * Configuration information - */ --#define INPUT_POOL_WORDS 128 --#define OUTPUT_POOL_WORDS 32 --#define SEC_XFER_SIZE 512 -+#define INPUT_POOL_WORDS 256 -+#define OUTPUT_POOL_WORDS 64 -+#define SEC_XFER_SIZE 1024 - - /* - * The minimum number of bits of entropy before we wake up a read on diff --git a/target/linux/ixp4xx/patches-2.6.24/100-gateway7001_mac_plat_info.patch b/target/linux/ixp4xx/patches-2.6.24/100-gateway7001_mac_plat_info.patch deleted file mode 100644 index 770923926d..0000000000 --- a/target/linux/ixp4xx/patches-2.6.24/100-gateway7001_mac_plat_info.patch +++ /dev/null @@ -1,42 +0,0 @@ -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/gateway7001-setup.c -=================================================================== ---- linux-2.6.24.7.orig/arch/arm/mach-ixp4xx/gateway7001-setup.c -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/gateway7001-setup.c -@@ -76,9 +76,36 @@ static struct platform_device gateway700 - .resource = &gateway7001_uart_resource, - }; - -+/* Built-in 10/100 Ethernet MAC interfaces */ -+static struct eth_plat_info gateway7001_plat_eth[] = { -+ { -+ .phy = 1, -+ .rxq = 3, -+ .txreadyq = 20, -+ }, { -+ .phy = 2, -+ .rxq = 4, -+ .txreadyq = 21, -+ } -+}; -+ -+static struct platform_device gateway7001_eth[] = { -+ { -+ .name = "ixp4xx_eth", -+ .id = IXP4XX_ETH_NPEB, -+ .dev.platform_data = gateway7001_plat_eth, -+ }, { -+ .name = "ixp4xx_eth", -+ .id = IXP4XX_ETH_NPEC, -+ .dev.platform_data = gateway7001_plat_eth + 1, -+ } -+}; -+ - static struct platform_device *gateway7001_devices[] __initdata = { - &gateway7001_flash, -- &gateway7001_uart -+ &gateway7001_uart, -+ &gateway7001_eth[0], -+ &gateway7001_eth[1], - }; - - static void __init gateway7001_init(void) diff --git a/target/linux/ixp4xx/patches-2.6.24/101-wg302_mac_plat_info.patch b/target/linux/ixp4xx/patches-2.6.24/101-wg302_mac_plat_info.patch deleted file mode 100644 index 971ac35957..0000000000 --- a/target/linux/ixp4xx/patches-2.6.24/101-wg302_mac_plat_info.patch +++ /dev/null @@ -1,32 +0,0 @@ -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/wg302v2-setup.c -=================================================================== ---- linux-2.6.24.7.orig/arch/arm/mach-ixp4xx/wg302v2-setup.c -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/wg302v2-setup.c -@@ -77,9 +77,27 @@ static struct platform_device wg302v2_ua - .resource = &wg302v2_uart_resource, - }; - -+/* Built-in 10/100 Ethernet MAC interfaces */ -+static struct eth_plat_info wg302_plat_eth[] = { -+ { -+ .phy = 8, -+ .rxq = 3, -+ .txreadyq = 20, -+ } -+}; -+ -+static struct platform_device wg302_eth[] = { -+ { -+ .name = "ixp4xx_eth", -+ .id = IXP4XX_ETH_NPEB, -+ .dev.platform_data = wg302_plat_eth, -+ } -+}; -+ - static struct platform_device *wg302v2_devices[] __initdata = { - &wg302v2_flash, - &wg302v2_uart, -+ &wg302_eth[0], - }; - - static void __init wg302v2_init(void) diff --git a/target/linux/ixp4xx/patches-2.6.24/110-pronghorn_metro_support.patch b/target/linux/ixp4xx/patches-2.6.24/110-pronghorn_metro_support.patch deleted file mode 100644 index 7b49a769ea..0000000000 --- a/target/linux/ixp4xx/patches-2.6.24/110-pronghorn_metro_support.patch +++ /dev/null @@ -1,297 +0,0 @@ -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/Kconfig -=================================================================== ---- linux-2.6.24.7.orig/arch/arm/mach-ixp4xx/Kconfig -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/Kconfig -@@ -57,6 +57,14 @@ config MACH_WG302V2 - WG302 v2 or WAG302 v2 Access Points. For more information - on this platform, see http://openwrt.org - -+config MACH_PRONGHORNMETRO -+ bool "Pronghorn Metro" -+ select PCI -+ help -+ Say 'Y' here if you want your kernel to support the ADI -+ Engineering Pronghorn Metro Platform. For more -+ information on this platform, see <file:Documentation/arm/IXP4xx>. -+ - config ARCH_IXDP425 - bool "IXDP425" - help -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/Makefile -=================================================================== ---- linux-2.6.24.7.orig/arch/arm/mach-ixp4xx/Makefile -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/Makefile -@@ -16,6 +16,7 @@ obj-pci-$(CONFIG_MACH_DSMG600) += dsmg6 - obj-pci-$(CONFIG_MACH_GATEWAY7001) += gateway7001-pci.o - obj-pci-$(CONFIG_MACH_WG302V2) += wg302v2-pci.o - obj-pci-$(CONFIG_MACH_FSG) += fsg-pci.o -+obj-pci-$(CONFIG_MACH_PRONGHORNMETRO) += pronghornmetro-pci.o - - obj-y += common.o - -@@ -30,5 +31,6 @@ obj-$(CONFIG_MACH_DSMG600) += dsmg6 - obj-$(CONFIG_MACH_GATEWAY7001) += gateway7001-setup.o - obj-$(CONFIG_MACH_WG302V2) += wg302v2-setup.o - obj-$(CONFIG_MACH_FSG) += fsg-setup.o -+obj-$(CONFIG_MACH_PRONGHORNMETRO) += pronghornmetro-setup.o - - obj-$(CONFIG_PCI) += $(obj-pci-$(CONFIG_PCI)) common-pci.o -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/pronghornmetro-pci.c -=================================================================== ---- /dev/null -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/pronghornmetro-pci.c -@@ -0,0 +1,74 @@ -+/* -+ * arch/arch/mach-ixp4xx/pronghornmetro-pci.c -+ * -+ * PCI setup routines for ADI Engineering Pronghorn Metro -+ * -+ * Copyright (C) 2007 Imre Kaloz <kaloz@openwrt.org> -+ * -+ * based on coyote-pci.c: -+ * Copyright (C) 2002 Jungo Software Technologies. -+ * Copyright (C) 2003 MontaVista Softwrae, Inc. -+ * -+ * Maintainer: Imre Kaloz <kaloz@openwrt.org> -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ * -+ */ -+ -+#include <linux/kernel.h> -+#include <linux/pci.h> -+#include <linux/init.h> -+#include <linux/irq.h> -+ -+#include <asm/mach-types.h> -+#include <asm/hardware.h> -+#include <asm/irq.h> -+ -+#include <asm/mach/pci.h> -+ -+extern void ixp4xx_pci_preinit(void); -+extern int ixp4xx_setup(int nr, struct pci_sys_data *sys); -+extern struct pci_bus *ixp4xx_scan_bus(int nr, struct pci_sys_data *sys); -+ -+void __init pronghornmetro_pci_preinit(void) -+{ -+ set_irq_type(IRQ_IXP4XX_GPIO4, IRQT_LOW); -+ set_irq_type(IRQ_IXP4XX_GPIO6, IRQT_LOW); -+ set_irq_type(IRQ_IXP4XX_GPIO11, IRQT_LOW); -+ set_irq_type(IRQ_IXP4XX_GPIO1, IRQT_LOW); -+ -+ ixp4xx_pci_preinit(); -+} -+ -+static int __init pronghornmetro_map_irq(struct pci_dev *dev, u8 slot, u8 pin) -+{ -+ if (slot == 13) -+ return IRQ_IXP4XX_GPIO4; -+ else if (slot == 14) -+ return IRQ_IXP4XX_GPIO6; -+ else if (slot == 15) -+ return IRQ_IXP4XX_GPIO11; -+ else if (slot == 16) -+ return IRQ_IXP4XX_GPIO1; -+ else return -1; -+} -+ -+struct hw_pci pronghornmetro_pci __initdata = { -+ .nr_controllers = 1, -+ .preinit = pronghornmetro_pci_preinit, -+ .swizzle = pci_std_swizzle, -+ .setup = ixp4xx_setup, -+ .scan = ixp4xx_scan_bus, -+ .map_irq = pronghornmetro_map_irq, -+}; -+ -+int __init pronghornmetro_pci_init(void) -+{ -+ if (machine_is_pronghorn_metro()) -+ pci_common_init(&pronghornmetro_pci); -+ return 0; -+} -+ -+subsys_initcall(pronghornmetro_pci_init); -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/pronghornmetro-setup.c -=================================================================== ---- /dev/null -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/pronghornmetro-setup.c -@@ -0,0 +1,147 @@ -+/* -+ * arch/arm/mach-ixp4xx/pronghornmetro-setup.c -+ * -+ * Board setup for the ADI Engineering Pronghorn Metro -+ * -+ * Copyright (C) 2007 Imre Kaloz <Kaloz@openwrt.org> -+ * -+ * based on coyote-setup.c: -+ * Copyright (C) 2003-2005 MontaVista Software, Inc. -+ * -+ * Author: Imre Kaloz <Kaloz@openwrt.org> -+ */ -+ -+#include <linux/kernel.h> -+#include <linux/init.h> -+#include <linux/device.h> -+#include <linux/serial.h> -+#include <linux/tty.h> -+#include <linux/serial_8250.h> -+#include <linux/slab.h> -+ -+#include <asm/types.h> -+#include <asm/setup.h> -+#include <asm/memory.h> -+#include <asm/hardware.h> -+#include <asm/irq.h> -+#include <asm/mach-types.h> -+#include <asm/mach/arch.h> -+#include <asm/mach/flash.h> -+ -+static struct flash_platform_data pronghornmetro_flash_data = { -+ .map_name = "cfi_probe", -+ .width = 2, -+}; -+ -+static struct resource pronghornmetro_flash_resource = { -+ .flags = IORESOURCE_MEM, -+}; -+ -+static struct platform_device pronghornmetro_flash = { -+ .name = "IXP4XX-Flash", -+ .id = 0, -+ .dev = { -+ .platform_data = &pronghornmetro_flash_data, -+ }, -+ .num_resources = 1, -+ .resource = &pronghornmetro_flash_resource, -+}; -+ -+static struct resource pronghornmetro_uart_resource = { -+ .start = IXP4XX_UART2_BASE_PHYS, -+ .end = IXP4XX_UART2_BASE_PHYS + 0x0fff, -+ .flags = IORESOURCE_MEM, -+}; -+ -+static struct plat_serial8250_port pronghornmetro_uart_data[] = { -+ { -+ .mapbase = IXP4XX_UART2_BASE_PHYS, -+ .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET, -+ .irq = IRQ_IXP4XX_UART2, -+ .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, -+ .iotype = UPIO_MEM, -+ .regshift = 2, -+ .uartclk = IXP4XX_UART_XTAL, -+ }, -+ { }, -+}; -+ -+static struct platform_device pronghornmetro_uart = { -+ .name = "serial8250", -+ .id = PLAT8250_DEV_PLATFORM, -+ .dev = { -+ .platform_data = pronghornmetro_uart_data, -+ }, -+ .num_resources = 1, -+ .resource = &pronghornmetro_uart_resource, -+}; -+ -+static struct resource pronghornmetro_pata_resources[] = { -+ { -+ .flags = IORESOURCE_MEM -+ }, -+ { -+ .flags = IORESOURCE_MEM, -+ }, -+ { -+ .name = "intrq", -+ .start = IRQ_IXP4XX_GPIO0, -+ .end = IRQ_IXP4XX_GPIO0, -+ .flags = IORESOURCE_IRQ, -+ }, -+}; -+ -+static struct ixp4xx_pata_data pronghornmetro_pata_data = { -+ .cs0_bits = 0xbfff0043, -+ .cs1_bits = 0xbfff0043, -+}; -+ -+static struct platform_device pronghornmetro_pata = { -+ .name = "pata_ixp4xx_cf", -+ .id = 0, -+ .dev.platform_data = &pronghornmetro_pata_data, -+ .num_resources = ARRAY_SIZE(pronghornmetro_pata_resources), -+ .resource = pronghornmetro_pata_resources, -+}; -+ -+static struct platform_device *pronghornmetro_devices[] __initdata = { -+ &pronghornmetro_flash, -+ &pronghornmetro_uart, -+}; -+ -+static void __init pronghornmetro_init(void) -+{ -+ ixp4xx_sys_init(); -+ -+ pronghornmetro_flash_resource.start = IXP4XX_EXP_BUS_BASE(0); -+ pronghornmetro_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_16M - 1; -+ -+ *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE; -+ *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0; -+ -+ platform_add_devices(pronghornmetro_devices, ARRAY_SIZE(pronghornmetro_devices)); -+ -+ pronghornmetro_pata_resources[0].start = IXP4XX_EXP_BUS_BASE(1); -+ pronghornmetro_pata_resources[0].end = IXP4XX_EXP_BUS_END(1); -+ -+ pronghornmetro_pata_resources[1].start = IXP4XX_EXP_BUS_BASE(2); -+ pronghornmetro_pata_resources[1].end = IXP4XX_EXP_BUS_END(2); -+ -+ pronghornmetro_pata_data.cs0_cfg = IXP4XX_EXP_CS1; -+ pronghornmetro_pata_data.cs1_cfg = IXP4XX_EXP_CS2; -+ -+ platform_device_register(&pronghornmetro_pata); -+} -+ -+#ifdef CONFIG_MACH_PRONGHORNMETRO -+MACHINE_START(PRONGHORNMETRO, "ADI Engineering Pronghorn Metro") -+ /* Maintainer: Imre Kaloz <kaloz@openwrt.org> */ -+ .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, -+ .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, -+ .map_io = ixp4xx_map_io, -+ .init_irq = ixp4xx_init_irq, -+ .timer = &ixp4xx_timer, -+ .boot_params = 0x0100, -+ .init_machine = pronghornmetro_init, -+MACHINE_END -+#endif -Index: linux-2.6.24.7/Documentation/arm/IXP4xx -=================================================================== ---- linux-2.6.24.7.orig/Documentation/arm/IXP4xx -+++ linux-2.6.24.7/Documentation/arm/IXP4xx -@@ -111,6 +111,9 @@ http://www.adiengineering.com/productsCo - the platform has two mini-PCI slots used for 802.11[bga] cards. - Finally, there is an IDE port hanging off the expansion bus. - -+ADI Engineering Pronghorn Metro Platform -+http://www.adiengineering.com/php-bin/ecomm4/productDisplay.php?category_id=30&product_id=85 -+ - Gateworks Avila Network Platform - http://www.gateworks.com/avila_sbc.htm - -Index: linux-2.6.24.7/include/asm-arm/arch-ixp4xx/uncompress.h -=================================================================== ---- linux-2.6.24.7.orig/include/asm-arm/arch-ixp4xx/uncompress.h -+++ linux-2.6.24.7/include/asm-arm/arch-ixp4xx/uncompress.h -@@ -41,7 +41,8 @@ static __inline__ void __arch_decomp_set - * Some boards are using UART2 as console - */ - if (machine_is_adi_coyote() || machine_is_gtwx5715() || -- machine_is_gateway7001() || machine_is_wg302v2()) -+ machine_is_gateway7001() || machine_is_wg302v2() || -+ machine_is_pronghorn_metro()) - uart_base = (volatile u32*) IXP4XX_UART2_BASE_PHYS; - else - uart_base = (volatile u32*) IXP4XX_UART1_BASE_PHYS; diff --git a/target/linux/ixp4xx/patches-2.6.24/111-pronghorn_metro_mac_plat_info.patch b/target/linux/ixp4xx/patches-2.6.24/111-pronghorn_metro_mac_plat_info.patch deleted file mode 100644 index 2a82c92317..0000000000 --- a/target/linux/ixp4xx/patches-2.6.24/111-pronghorn_metro_mac_plat_info.patch +++ /dev/null @@ -1,41 +0,0 @@ -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/pronghornmetro-setup.c -=================================================================== ---- linux-2.6.24.7.orig/arch/arm/mach-ixp4xx/pronghornmetro-setup.c -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/pronghornmetro-setup.c -@@ -104,9 +104,36 @@ static struct platform_device pronghornm - .resource = pronghornmetro_pata_resources, - }; - -+/* Built-in 10/100 Ethernet MAC interfaces */ -+static struct eth_plat_info pronghornmetro_plat_eth[] = { -+ { -+ .phy = 0, -+ .rxq = 3, -+ .txreadyq = 20, -+ }, { -+ .phy = 1, -+ .rxq = 4, -+ .txreadyq = 21, -+ } -+}; -+ -+static struct platform_device pronghornmetro_eth[] = { -+ { -+ .name = "ixp4xx_eth", -+ .id = IXP4XX_ETH_NPEB, -+ .dev.platform_data = pronghornmetro_plat_eth, -+ }, { -+ .name = "ixp4xx_eth", -+ .id = IXP4XX_ETH_NPEC, -+ .dev.platform_data = pronghornmetro_plat_eth + 1, -+ } -+}; -+ - static struct platform_device *pronghornmetro_devices[] __initdata = { - &pronghornmetro_flash, - &pronghornmetro_uart, -+ &pronghornmetro_eth[0], -+ &pronghornmetro_eth[1], - }; - - static void __init pronghornmetro_init(void) diff --git a/target/linux/ixp4xx/patches-2.6.24/120-compex_support.patch b/target/linux/ixp4xx/patches-2.6.24/120-compex_support.patch deleted file mode 100644 index 9dd5fe7855..0000000000 --- a/target/linux/ixp4xx/patches-2.6.24/120-compex_support.patch +++ /dev/null @@ -1,189 +0,0 @@ -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/Kconfig -=================================================================== ---- linux-2.6.24.7.orig/arch/arm/mach-ixp4xx/Kconfig -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/Kconfig -@@ -65,6 +65,14 @@ config MACH_PRONGHORNMETRO - Engineering Pronghorn Metro Platform. For more - information on this platform, see <file:Documentation/arm/IXP4xx>. - -+config MACH_COMPEX -+ bool "Compex WP18 / NP18A" -+ select PCI -+ help -+ Say 'Y' here if you want your kernel to support Compex' -+ WP18 or NP18A boards. For more information on this -+ platform, see http://openwrt.org -+ - config ARCH_IXDP425 - bool "IXDP425" - help -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/Makefile -=================================================================== ---- linux-2.6.24.7.orig/arch/arm/mach-ixp4xx/Makefile -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/Makefile -@@ -17,6 +17,7 @@ obj-pci-$(CONFIG_MACH_GATEWAY7001) += ga - obj-pci-$(CONFIG_MACH_WG302V2) += wg302v2-pci.o - obj-pci-$(CONFIG_MACH_FSG) += fsg-pci.o - obj-pci-$(CONFIG_MACH_PRONGHORNMETRO) += pronghornmetro-pci.o -+obj-pci-$(CONFIG_MACH_COMPEX) += ixdp425-pci.o - - obj-y += common.o - -@@ -32,5 +33,6 @@ obj-$(CONFIG_MACH_GATEWAY7001) += gatewa - obj-$(CONFIG_MACH_WG302V2) += wg302v2-setup.o - obj-$(CONFIG_MACH_FSG) += fsg-setup.o - obj-$(CONFIG_MACH_PRONGHORNMETRO) += pronghornmetro-setup.o -+obj-$(CONFIG_MACH_COMPEX) += compex-setup.o - - obj-$(CONFIG_PCI) += $(obj-pci-$(CONFIG_PCI)) common-pci.o -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/compex-setup.c -=================================================================== ---- /dev/null -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/compex-setup.c -@@ -0,0 +1,120 @@ -+/* -+ * arch/arm/mach-ixp4xx/compex-setup.c -+ * -+ * Ccompex WP18 / NP18A board-setup -+ * -+ * Copyright (C) 2007 Imre Kaloz <Kaloz@openwrt.org> -+ * -+ * based on ixdp425-setup.c: -+ * Copyright (C) 2003-2005 MontaVista Software, Inc. -+ * -+ * Author: Imre Kaloz <Kaloz@openwrt.org> -+ */ -+ -+#include <linux/kernel.h> -+#include <linux/init.h> -+#include <linux/device.h> -+#include <linux/serial.h> -+#include <linux/tty.h> -+#include <linux/serial_8250.h> -+#include <linux/slab.h> -+ -+#include <asm/types.h> -+#include <asm/setup.h> -+#include <asm/memory.h> -+#include <asm/hardware.h> -+#include <asm/mach-types.h> -+#include <asm/irq.h> -+#include <asm/mach/arch.h> -+#include <asm/mach/flash.h> -+ -+static struct flash_platform_data compex_flash_data = { -+ .map_name = "cfi_probe", -+ .width = 2, -+}; -+ -+static struct resource compex_flash_resource = { -+ .flags = IORESOURCE_MEM, -+}; -+ -+static struct platform_device compex_flash = { -+ .name = "IXP4XX-Flash", -+ .id = 0, -+ .dev = { -+ .platform_data = &compex_flash_data, -+ }, -+ .num_resources = 1, -+ .resource = &compex_flash_resource, -+}; -+ -+static struct resource compex_uart_resources[] = { -+ { -+ .start = IXP4XX_UART1_BASE_PHYS, -+ .end = IXP4XX_UART1_BASE_PHYS + 0x0fff, -+ .flags = IORESOURCE_MEM -+ }, -+ { -+ .start = IXP4XX_UART2_BASE_PHYS, -+ .end = IXP4XX_UART2_BASE_PHYS + 0x0fff, -+ .flags = IORESOURCE_MEM -+ } -+}; -+ -+static struct plat_serial8250_port compex_uart_data[] = { -+ { -+ .mapbase = IXP4XX_UART1_BASE_PHYS, -+ .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET, -+ .irq = IRQ_IXP4XX_UART1, -+ .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, -+ .iotype = UPIO_MEM, -+ .regshift = 2, -+ .uartclk = IXP4XX_UART_XTAL, -+ }, -+ { -+ .mapbase = IXP4XX_UART2_BASE_PHYS, -+ .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET, -+ .irq = IRQ_IXP4XX_UART2, -+ .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, -+ .iotype = UPIO_MEM, -+ .regshift = 2, -+ .uartclk = IXP4XX_UART_XTAL, -+ }, -+ { }, -+}; -+ -+static struct platform_device compex_uart = { -+ .name = "serial8250", -+ .id = PLAT8250_DEV_PLATFORM, -+ .dev.platform_data = compex_uart_data, -+ .num_resources = 2, -+ .resource = compex_uart_resources, -+}; -+ -+static struct platform_device *compex_devices[] __initdata = { -+ &compex_flash, -+ &compex_uart -+}; -+ -+static void __init compex_init(void) -+{ -+ ixp4xx_sys_init(); -+ -+ compex_flash_resource.start = IXP4XX_EXP_BUS_BASE(0); -+ compex_flash_resource.end = -+ IXP4XX_EXP_BUS_BASE(0) + SZ_32M - 1; -+ -+ platform_add_devices(compex_devices, ARRAY_SIZE(compex_devices)); -+} -+ -+#ifdef CONFIG_MACH_COMPEX -+MACHINE_START(COMPEX, "Compex WP18 / NP18A") -+ /* Maintainer: Imre Kaloz <Kaloz@openwrt.org> */ -+ .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, -+ .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, -+ .map_io = ixp4xx_map_io, -+ .init_irq = ixp4xx_init_irq, -+ .timer = &ixp4xx_timer, -+ .boot_params = 0x0100, -+ .init_machine = compex_init, -+MACHINE_END -+#endif -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/ixdp425-pci.c -=================================================================== ---- linux-2.6.24.7.orig/arch/arm/mach-ixp4xx/ixdp425-pci.c -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/ixdp425-pci.c -@@ -66,7 +66,7 @@ struct hw_pci ixdp425_pci __initdata = { - int __init ixdp425_pci_init(void) - { - if (machine_is_ixdp425() || machine_is_ixcdp1100() || -- machine_is_ixdp465() || machine_is_kixrp435()) -+ machine_is_ixdp465() || machine_is_kixrp435() || machine_is_compex()) - pci_common_init(&ixdp425_pci); - return 0; - } -Index: linux-2.6.24.7/arch/arm/tools/mach-types -=================================================================== ---- linux-2.6.24.7.orig/arch/arm/tools/mach-types -+++ linux-2.6.24.7/arch/arm/tools/mach-types -@@ -1276,7 +1276,7 @@ oiab MACH_OIAB OIAB 1269 - smdk6400 MACH_SMDK6400 SMDK6400 1270 - nokia_n800 MACH_NOKIA_N800 NOKIA_N800 1271 - greenphone MACH_GREENPHONE GREENPHONE 1272 --compex42x MACH_COMPEXWP18 COMPEXWP18 1273 -+compex MACH_COMPEX COMPEX 1273 - xmate MACH_XMATE XMATE 1274 - energizer MACH_ENERGIZER ENERGIZER 1275 - ime1 MACH_IME1 IME1 1276 diff --git a/target/linux/ixp4xx/patches-2.6.24/121-compex_mac_plat_info.patch b/target/linux/ixp4xx/patches-2.6.24/121-compex_mac_plat_info.patch deleted file mode 100644 index 915fdcc00b..0000000000 --- a/target/linux/ixp4xx/patches-2.6.24/121-compex_mac_plat_info.patch +++ /dev/null @@ -1,42 +0,0 @@ -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/compex-setup.c -=================================================================== ---- linux-2.6.24.7.orig/arch/arm/mach-ixp4xx/compex-setup.c -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/compex-setup.c -@@ -90,9 +90,36 @@ static struct platform_device compex_uar - .resource = compex_uart_resources, - }; - -+/* Built-in 10/100 Ethernet MAC interfaces */ -+static struct eth_plat_info compex_plat_eth[] = { -+ { -+ .phy = -1, -+ .rxq = 3, -+ .txreadyq = 20, -+ }, { -+ .phy = 3, -+ .rxq = 4, -+ .txreadyq = 21, -+ } -+}; -+ -+static struct platform_device compex_eth[] = { -+ { -+ .name = "ixp4xx_eth", -+ .id = IXP4XX_ETH_NPEB, -+ .dev.platform_data = compex_plat_eth, -+ }, { -+ .name = "ixp4xx_eth", -+ .id = IXP4XX_ETH_NPEC, -+ .dev.platform_data = compex_plat_eth + 1, -+ } -+}; -+ - static struct platform_device *compex_devices[] __initdata = { - &compex_flash, -- &compex_uart -+ &compex_uart, -+ &compex_eth[0], -+ &compex_eth[1], - }; - - static void __init compex_init(void) diff --git a/target/linux/ixp4xx/patches-2.6.24/130-wrt300nv2_support.patch b/target/linux/ixp4xx/patches-2.6.24/130-wrt300nv2_support.patch deleted file mode 100644 index 59d94dc1d8..0000000000 --- a/target/linux/ixp4xx/patches-2.6.24/130-wrt300nv2_support.patch +++ /dev/null @@ -1,234 +0,0 @@ -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/Kconfig -=================================================================== ---- linux-2.6.24.7.orig/arch/arm/mach-ixp4xx/Kconfig -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/Kconfig -@@ -73,6 +73,14 @@ config MACH_COMPEX - WP18 or NP18A boards. For more information on this - platform, see http://openwrt.org - -+config MACH_WRT300NV2 -+ bool "Linksys WRT300N v2" -+ select PCI -+ help -+ Say 'Y' here if you want your kernel to support Linksys' -+ WRT300N v2 router. For more information on this -+ platform, see http://openwrt.org -+ - config ARCH_IXDP425 - bool "IXDP425" - help -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/Makefile -=================================================================== ---- linux-2.6.24.7.orig/arch/arm/mach-ixp4xx/Makefile -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/Makefile -@@ -18,6 +18,7 @@ obj-pci-$(CONFIG_MACH_WG302V2) += wg302 - obj-pci-$(CONFIG_MACH_FSG) += fsg-pci.o - obj-pci-$(CONFIG_MACH_PRONGHORNMETRO) += pronghornmetro-pci.o - obj-pci-$(CONFIG_MACH_COMPEX) += ixdp425-pci.o -+obj-pci-$(CONFIG_MACH_WRT300NV2) += wrt300nv2-pci.o - - obj-y += common.o - -@@ -34,5 +35,6 @@ obj-$(CONFIG_MACH_WG302V2) += wg302v2-se - obj-$(CONFIG_MACH_FSG) += fsg-setup.o - obj-$(CONFIG_MACH_PRONGHORNMETRO) += pronghornmetro-setup.o - obj-$(CONFIG_MACH_COMPEX) += compex-setup.o -+obj-$(CONFIG_MACH_WRT300NV2) += wrt300nv2-setup.o - - obj-$(CONFIG_PCI) += $(obj-pci-$(CONFIG_PCI)) common-pci.o -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/wrt300nv2-pci.c -=================================================================== ---- /dev/null -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/wrt300nv2-pci.c -@@ -0,0 +1,65 @@ -+/* -+ * arch/arch/mach-ixp4xx/wrt300nv2-pci.c -+ * -+ * PCI setup routines for Linksys WRT300N v2 -+ * -+ * Copyright (C) 2007 Imre Kaloz <kaloz@openwrt.org> -+ * -+ * based on coyote-pci.c: -+ * Copyright (C) 2002 Jungo Software Technologies. -+ * Copyright (C) 2003 MontaVista Softwrae, Inc. -+ * -+ * Maintainer: Imre Kaloz <kaloz@openwrt.org> -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ * -+ */ -+ -+#include <linux/kernel.h> -+#include <linux/pci.h> -+#include <linux/init.h> -+#include <linux/irq.h> -+ -+#include <asm/mach-types.h> -+#include <asm/hardware.h> -+#include <asm/irq.h> -+ -+#include <asm/mach/pci.h> -+ -+extern void ixp4xx_pci_preinit(void); -+extern int ixp4xx_setup(int nr, struct pci_sys_data *sys); -+extern struct pci_bus *ixp4xx_scan_bus(int nr, struct pci_sys_data *sys); -+ -+void __init wrt300nv2_pci_preinit(void) -+{ -+ set_irq_type(IRQ_IXP4XX_GPIO8, IRQT_LOW); -+ -+ ixp4xx_pci_preinit(); -+} -+ -+static int __init wrt300nv2_map_irq(struct pci_dev *dev, u8 slot, u8 pin) -+{ -+ if (slot == 1) -+ return IRQ_IXP4XX_GPIO8; -+ else return -1; -+} -+ -+struct hw_pci wrt300nv2_pci __initdata = { -+ .nr_controllers = 1, -+ .preinit = wrt300nv2_pci_preinit, -+ .swizzle = pci_std_swizzle, -+ .setup = ixp4xx_setup, -+ .scan = ixp4xx_scan_bus, -+ .map_irq = wrt300nv2_map_irq, -+}; -+ -+int __init wrt300nv2_pci_init(void) -+{ -+ if (machine_is_wrt300nv2()) -+ pci_common_init(&wrt300nv2_pci); -+ return 0; -+} -+ -+subsys_initcall(wrt300nv2_pci_init); -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/wrt300nv2-setup.c -=================================================================== ---- /dev/null -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/wrt300nv2-setup.c -@@ -0,0 +1,108 @@ -+/* -+ * arch/arm/mach-ixp4xx/wrt300nv2-setup.c -+ * -+ * Board setup for the Linksys WRT300N v2 -+ * -+ * Copyright (C) 2007 Imre Kaloz <Kaloz@openwrt.org> -+ * -+ * based on coyote-setup.c: -+ * Copyright (C) 2003-2005 MontaVista Software, Inc. -+ * -+ * Author: Imre Kaloz <Kaloz@openwrt.org> -+ */ -+ -+#include <linux/kernel.h> -+#include <linux/init.h> -+#include <linux/device.h> -+#include <linux/serial.h> -+#include <linux/tty.h> -+#include <linux/serial_8250.h> -+#include <linux/slab.h> -+ -+#include <asm/types.h> -+#include <asm/setup.h> -+#include <asm/memory.h> -+#include <asm/hardware.h> -+#include <asm/irq.h> -+#include <asm/mach-types.h> -+#include <asm/mach/arch.h> -+#include <asm/mach/flash.h> -+ -+static struct flash_platform_data wrt300nv2_flash_data = { -+ .map_name = "cfi_probe", -+ .width = 2, -+}; -+ -+static struct resource wrt300nv2_flash_resource = { -+ .flags = IORESOURCE_MEM, -+}; -+ -+static struct platform_device wrt300nv2_flash = { -+ .name = "IXP4XX-Flash", -+ .id = 0, -+ .dev = { -+ .platform_data = &wrt300nv2_flash_data, -+ }, -+ .num_resources = 1, -+ .resource = &wrt300nv2_flash_resource, -+}; -+ -+static struct resource wrt300nv2_uart_resource = { -+ .start = IXP4XX_UART2_BASE_PHYS, -+ .end = IXP4XX_UART2_BASE_PHYS + 0x0fff, -+ .flags = IORESOURCE_MEM, -+}; -+ -+static struct plat_serial8250_port wrt300nv2_uart_data[] = { -+ { -+ .mapbase = IXP4XX_UART2_BASE_PHYS, -+ .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET, -+ .irq = IRQ_IXP4XX_UART2, -+ .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, -+ .iotype = UPIO_MEM, -+ .regshift = 2, -+ .uartclk = IXP4XX_UART_XTAL, -+ }, -+ { }, -+}; -+ -+static struct platform_device wrt300nv2_uart = { -+ .name = "serial8250", -+ .id = PLAT8250_DEV_PLATFORM, -+ .dev = { -+ .platform_data = wrt300nv2_uart_data, -+ }, -+ .num_resources = 1, -+ .resource = &wrt300nv2_uart_resource, -+}; -+ -+static struct platform_device *wrt300nv2_devices[] __initdata = { -+ &wrt300nv2_flash, -+ &wrt300nv2_uart -+}; -+ -+static void __init wrt300nv2_init(void) -+{ -+ ixp4xx_sys_init(); -+ -+ wrt300nv2_flash_resource.start = IXP4XX_EXP_BUS_BASE(0); -+ wrt300nv2_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_32M - 1; -+ -+ *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE; -+ *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0; -+ -+ platform_add_devices(wrt300nv2_devices, ARRAY_SIZE(wrt300nv2_devices)); -+} -+ -+#ifdef CONFIG_MACH_WRT300NV2 -+MACHINE_START(WRT300NV2, "Linksys WRT300N v2") -+ /* Maintainer: Imre Kaloz <kaloz@openwrt.org> */ -+ .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, -+ .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, -+ .map_io = ixp4xx_map_io, -+ .init_irq = ixp4xx_init_irq, -+ .timer = &ixp4xx_timer, -+ .boot_params = 0x0100, -+ .init_machine = wrt300nv2_init, -+MACHINE_END -+#endif -Index: linux-2.6.24.7/include/asm-arm/arch-ixp4xx/uncompress.h -=================================================================== ---- linux-2.6.24.7.orig/include/asm-arm/arch-ixp4xx/uncompress.h -+++ linux-2.6.24.7/include/asm-arm/arch-ixp4xx/uncompress.h -@@ -42,7 +42,7 @@ static __inline__ void __arch_decomp_set - */ - if (machine_is_adi_coyote() || machine_is_gtwx5715() || - machine_is_gateway7001() || machine_is_wg302v2() || -- machine_is_pronghorn_metro()) -+ machine_is_pronghorn_metro() || machine_is_wrt300nv2()) - uart_base = (volatile u32*) IXP4XX_UART2_BASE_PHYS; - else - uart_base = (volatile u32*) IXP4XX_UART1_BASE_PHYS; diff --git a/target/linux/ixp4xx/patches-2.6.24/131-wrt300nv2_mac_plat_info.patch b/target/linux/ixp4xx/patches-2.6.24/131-wrt300nv2_mac_plat_info.patch deleted file mode 100644 index 8fb2b61b1d..0000000000 --- a/target/linux/ixp4xx/patches-2.6.24/131-wrt300nv2_mac_plat_info.patch +++ /dev/null @@ -1,42 +0,0 @@ -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/wrt300nv2-setup.c -=================================================================== ---- linux-2.6.24.7.orig/arch/arm/mach-ixp4xx/wrt300nv2-setup.c -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/wrt300nv2-setup.c -@@ -76,9 +76,36 @@ static struct platform_device wrt300nv2_ - .resource = &wrt300nv2_uart_resource, - }; - -+/* Built-in 10/100 Ethernet MAC interfaces */ -+static struct eth_plat_info wrt300nv2_plat_eth[] = { -+ { -+ .phy = -1, -+ .rxq = 3, -+ .txreadyq = 20, -+ }, { -+ .phy = 1, -+ .rxq = 4, -+ .txreadyq = 21, -+ } -+}; -+ -+static struct platform_device wrt300nv2_eth[] = { -+ { -+ .name = "ixp4xx_eth", -+ .id = IXP4XX_ETH_NPEB, -+ .dev.platform_data = wrt300nv2_plat_eth, -+ }, { -+ .name = "ixp4xx_eth", -+ .id = IXP4XX_ETH_NPEC, -+ .dev.platform_data = wrt300nv2_plat_eth + 1, -+ } -+}; -+ - static struct platform_device *wrt300nv2_devices[] __initdata = { - &wrt300nv2_flash, -- &wrt300nv2_uart -+ &wrt300nv2_uart, -+ &wrt300nv2_eth[0], -+ &wrt300nv2_eth[1], - }; - - static void __init wrt300nv2_init(void) diff --git a/target/linux/ixp4xx/patches-2.6.24/140-sidewinder_support.patch b/target/linux/ixp4xx/patches-2.6.24/140-sidewinder_support.patch deleted file mode 100644 index ed86422c75..0000000000 --- a/target/linux/ixp4xx/patches-2.6.24/140-sidewinder_support.patch +++ /dev/null @@ -1,243 +0,0 @@ -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/Kconfig -=================================================================== ---- linux-2.6.24.7.orig/arch/arm/mach-ixp4xx/Kconfig -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/Kconfig -@@ -65,6 +65,14 @@ config MACH_PRONGHORNMETRO - Engineering Pronghorn Metro Platform. For more - information on this platform, see <file:Documentation/arm/IXP4xx>. - -+config MACH_SIDEWINDER -+ bool "Sidewinder" -+ select PCI -+ help -+ Say 'Y' here if you want your kernel to support the ADI -+ Engineering Sidewinder Platform. For more -+ information on this platform, see <file:Documentation/arm/IXP4xx>. -+ - config MACH_COMPEX - bool "Compex WP18 / NP18A" - select PCI -@@ -163,7 +171,7 @@ config MACH_FSG - # - config CPU_IXP46X - bool -- depends on MACH_IXDP465 -+ depends on MACH_IXDP465 || MACH_SIDEWINDER - default y - - config CPU_IXP43X -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/Makefile -=================================================================== ---- linux-2.6.24.7.orig/arch/arm/mach-ixp4xx/Makefile -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/Makefile -@@ -19,6 +19,7 @@ obj-pci-$(CONFIG_MACH_FSG) += fsg-pci.o - obj-pci-$(CONFIG_MACH_PRONGHORNMETRO) += pronghornmetro-pci.o - obj-pci-$(CONFIG_MACH_COMPEX) += ixdp425-pci.o - obj-pci-$(CONFIG_MACH_WRT300NV2) += wrt300nv2-pci.o -+obj-pci-$(CONFIG_MACH_SIDEWINDER) += sidewinder-pci.o - - obj-y += common.o - -@@ -36,5 +37,6 @@ obj-$(CONFIG_MACH_FSG) += fsg-setup.o - obj-$(CONFIG_MACH_PRONGHORNMETRO) += pronghornmetro-setup.o - obj-$(CONFIG_MACH_COMPEX) += compex-setup.o - obj-$(CONFIG_MACH_WRT300NV2) += wrt300nv2-setup.o -+obj-$(CONFIG_MACH_SIDEWINDER) += sidewinder-setup.o - - obj-$(CONFIG_PCI) += $(obj-pci-$(CONFIG_PCI)) common-pci.o -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/sidewinder-pci.c -=================================================================== ---- /dev/null -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/sidewinder-pci.c -@@ -0,0 +1,71 @@ -+/* -+ * arch/arch/mach-ixp4xx/pronghornmetro-pci.c -+ * -+ * PCI setup routines for ADI Engineering Sidewinder -+ * -+ * Copyright (C) 2007 Imre Kaloz <kaloz@openwrt.org> -+ * -+ * based on coyote-pci.c: -+ * Copyright (C) 2002 Jungo Software Technologies. -+ * Copyright (C) 2003 MontaVista Softwrae, Inc. -+ * -+ * Maintainer: Imre Kaloz <kaloz@openwrt.org> -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ * -+ */ -+ -+#include <linux/kernel.h> -+#include <linux/pci.h> -+#include <linux/init.h> -+#include <linux/irq.h> -+ -+#include <asm/mach-types.h> -+#include <asm/hardware.h> -+#include <asm/irq.h> -+ -+#include <asm/mach/pci.h> -+ -+extern void ixp4xx_pci_preinit(void); -+extern int ixp4xx_setup(int nr, struct pci_sys_data *sys); -+extern struct pci_bus *ixp4xx_scan_bus(int nr, struct pci_sys_data *sys); -+ -+void __init sidewinder_pci_preinit(void) -+{ -+ set_irq_type(IRQ_IXP4XX_GPIO11, IRQT_LOW); -+ set_irq_type(IRQ_IXP4XX_GPIO10, IRQT_LOW); -+ set_irq_type(IRQ_IXP4XX_GPIO9, IRQT_LOW); -+ -+ ixp4xx_pci_preinit(); -+} -+ -+static int __init sidewinder_map_irq(struct pci_dev *dev, u8 slot, u8 pin) -+{ -+ if (slot == 1) -+ return IRQ_IXP4XX_GPIO11; -+ else if (slot == 2) -+ return IRQ_IXP4XX_GPIO10; -+ else if (slot == 3) -+ return IRQ_IXP4XX_GPIO9; -+ else return -1; -+} -+ -+struct hw_pci sidewinder_pci __initdata = { -+ .nr_controllers = 1, -+ .preinit = sidewinder_pci_preinit, -+ .swizzle = pci_std_swizzle, -+ .setup = ixp4xx_setup, -+ .scan = ixp4xx_scan_bus, -+ .map_irq = sidewinder_map_irq, -+}; -+ -+int __init sidewinder_pci_init(void) -+{ -+ if (machine_is_sidewinder()) -+ pci_common_init(&sidewinder_pci); -+ return 0; -+} -+ -+subsys_initcall(sidewinder_pci_init); -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/sidewinder-setup.c -=================================================================== ---- /dev/null -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/sidewinder-setup.c -@@ -0,0 +1,115 @@ -+/* -+ * arch/arm/mach-ixp4xx/sidewinder-setup.c -+ * -+ * Board setup for the ADI Engineering Sidewinder -+ * -+ * Copyright (C) 2007 Imre Kaloz <Kaloz@openwrt.org> -+ * -+ * based on coyote-setup.c: -+ * Copyright (C) 2003-2005 MontaVista Software, Inc. -+ * -+ * Author: Imre Kaloz <Kaloz@openwrt.org> -+ */ -+ -+#include <linux/kernel.h> -+#include <linux/serial.h> -+#include <linux/serial_8250.h> -+ -+#include <asm/mach-types.h> -+#include <asm/mach/arch.h> -+#include <asm/mach/flash.h> -+ -+static struct flash_platform_data sidewinder_flash_data = { -+ .map_name = "cfi_probe", -+ .width = 2, -+}; -+ -+static struct resource sidewinder_flash_resource = { -+ .flags = IORESOURCE_MEM, -+}; -+ -+static struct platform_device sidewinder_flash = { -+ .name = "IXP4XX-Flash", -+ .id = 0, -+ .dev = { -+ .platform_data = &sidewinder_flash_data, -+ }, -+ .num_resources = 1, -+ .resource = &sidewinder_flash_resource, -+}; -+ -+static struct resource sidewinder_uart_resources[] = { -+ { -+ .start = IXP4XX_UART1_BASE_PHYS, -+ .end = IXP4XX_UART1_BASE_PHYS + 0x0fff, -+ .flags = IORESOURCE_MEM, -+ }, -+ { -+ .start = IXP4XX_UART2_BASE_PHYS, -+ .end = IXP4XX_UART2_BASE_PHYS + 0x0fff, -+ .flags = IORESOURCE_MEM, -+ } -+}; -+ -+static struct plat_serial8250_port sidewinder_uart_data[] = { -+ { -+ .mapbase = IXP4XX_UART1_BASE_PHYS, -+ .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET, -+ .irq = IRQ_IXP4XX_UART1, -+ .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, -+ .iotype = UPIO_MEM, -+ .regshift = 2, -+ .uartclk = IXP4XX_UART_XTAL, -+ }, -+ { -+ .mapbase = IXP4XX_UART2_BASE_PHYS, -+ .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET, -+ .irq = IRQ_IXP4XX_UART2, -+ .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, -+ .iotype = UPIO_MEM, -+ .regshift = 2, -+ .uartclk = IXP4XX_UART_XTAL, -+ }, -+ { }, -+}; -+ -+static struct platform_device sidewinder_uart = { -+ .name = "serial8250", -+ .id = PLAT8250_DEV_PLATFORM, -+ .dev = { -+ .platform_data = sidewinder_uart_data, -+ }, -+ .num_resources = ARRAY_SIZE(sidewinder_uart_resources), -+ .resource = sidewinder_uart_resources, -+}; -+ -+static struct platform_device *sidewinder_devices[] __initdata = { -+ &sidewinder_flash, -+ &sidewinder_uart, -+}; -+ -+static void __init sidewinder_init(void) -+{ -+ ixp4xx_sys_init(); -+ -+ sidewinder_flash_resource.start = IXP4XX_EXP_BUS_BASE(0); -+ sidewinder_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_64M - 1; -+ -+ *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE; -+ *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0; -+ -+ platform_add_devices(sidewinder_devices, ARRAY_SIZE(sidewinder_devices)); -+} -+ -+#ifdef CONFIG_MACH_SIDEWINDER -+MACHINE_START(SIDEWINDER, "ADI Engineering Sidewinder") -+ /* Maintainer: Imre Kaloz <kaloz@openwrt.org> */ -+ .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, -+ .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, -+ .map_io = ixp4xx_map_io, -+ .init_irq = ixp4xx_init_irq, -+ .timer = &ixp4xx_timer, -+ .boot_params = 0x0100, -+ .init_machine = sidewinder_init, -+MACHINE_END -+#endif diff --git a/target/linux/ixp4xx/patches-2.6.24/150-lanready_ap1000_support.patch b/target/linux/ixp4xx/patches-2.6.24/150-lanready_ap1000_support.patch deleted file mode 100644 index aae2669bf2..0000000000 --- a/target/linux/ixp4xx/patches-2.6.24/150-lanready_ap1000_support.patch +++ /dev/null @@ -1,208 +0,0 @@ -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/ap1000-setup.c -=================================================================== ---- /dev/null -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/ap1000-setup.c -@@ -0,0 +1,151 @@ -+/* -+ * arch/arm/mach-ixp4xx/ap1000-setup.c -+ * -+ * Lanready AP-1000 -+ * -+ * Copyright (C) 2007 Imre Kaloz <Kaloz@openwrt.org> -+ * -+ * based on ixdp425-setup.c: -+ * Copyright (C) 2003-2005 MontaVista Software, Inc. -+ * -+ * Author: Imre Kaloz <Kaloz@openwrt.org> -+ */ -+ -+#include <linux/kernel.h> -+#include <linux/init.h> -+#include <linux/device.h> -+#include <linux/serial.h> -+#include <linux/tty.h> -+#include <linux/serial_8250.h> -+#include <linux/slab.h> -+ -+#include <asm/types.h> -+#include <asm/setup.h> -+#include <asm/memory.h> -+#include <asm/hardware.h> -+#include <asm/mach-types.h> -+#include <asm/irq.h> -+#include <asm/mach/arch.h> -+#include <asm/mach/flash.h> -+ -+static struct flash_platform_data ap1000_flash_data = { -+ .map_name = "cfi_probe", -+ .width = 2, -+}; -+ -+static struct resource ap1000_flash_resource = { -+ .flags = IORESOURCE_MEM, -+}; -+ -+static struct platform_device ap1000_flash = { -+ .name = "IXP4XX-Flash", -+ .id = 0, -+ .dev = { -+ .platform_data = &ap1000_flash_data, -+ }, -+ .num_resources = 1, -+ .resource = &ap1000_flash_resource, -+}; -+ -+static struct resource ap1000_uart_resources[] = { -+ { -+ .start = IXP4XX_UART1_BASE_PHYS, -+ .end = IXP4XX_UART1_BASE_PHYS + 0x0fff, -+ .flags = IORESOURCE_MEM -+ }, -+ { -+ .start = IXP4XX_UART2_BASE_PHYS, -+ .end = IXP4XX_UART2_BASE_PHYS + 0x0fff, -+ .flags = IORESOURCE_MEM -+ } -+}; -+ -+static struct plat_serial8250_port ap1000_uart_data[] = { -+ { -+ .mapbase = IXP4XX_UART1_BASE_PHYS, -+ .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET, -+ .irq = IRQ_IXP4XX_UART1, -+ .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, -+ .iotype = UPIO_MEM, -+ .regshift = 2, -+ .uartclk = IXP4XX_UART_XTAL, -+ }, -+ { -+ .mapbase = IXP4XX_UART2_BASE_PHYS, -+ .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET, -+ .irq = IRQ_IXP4XX_UART2, -+ .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, -+ .iotype = UPIO_MEM, -+ .regshift = 2, -+ .uartclk = IXP4XX_UART_XTAL, -+ }, -+ { }, -+}; -+ -+static struct platform_device ap1000_uart = { -+ .name = "serial8250", -+ .id = PLAT8250_DEV_PLATFORM, -+ .dev.platform_data = ap1000_uart_data, -+ .num_resources = 2, -+ .resource = ap1000_uart_resources -+}; -+ -+static struct platform_device *ap1000_devices[] __initdata = { -+ &ap1000_flash, -+ &ap1000_uart -+}; -+ -+static char ap1000_mem_fixup[] __initdata = "mem=64M "; -+ -+static void __init ap1000_fixup(struct machine_desc *desc, -+ struct tag *tags, char **cmdline, struct meminfo *mi) -+ -+{ -+ struct tag *t = tags; -+ char *p = *cmdline; -+ -+ /* Find the end of the tags table, taking note of any cmdline tag. */ -+ for (; t->hdr.size; t = tag_next(t)) { -+ if (t->hdr.tag == ATAG_CMDLINE) { -+ p = t->u.cmdline.cmdline; -+ } -+ } -+ -+ /* Overwrite the end of the table with a new cmdline tag. */ -+ t->hdr.tag = ATAG_CMDLINE; -+ t->hdr.size = (sizeof (struct tag_header) + -+ strlen(ap1000_mem_fixup) + strlen(p) + 1 + 4) >> 2; -+ strlcpy(t->u.cmdline.cmdline, ap1000_mem_fixup, COMMAND_LINE_SIZE); -+ strlcpy(t->u.cmdline.cmdline + strlen(ap1000_mem_fixup), p, -+ COMMAND_LINE_SIZE - strlen(ap1000_mem_fixup)); -+ -+ /* Terminate the table. */ -+ t = tag_next(t); -+ t->hdr.tag = ATAG_NONE; -+ t->hdr.size = 0; -+} -+ -+static void __init ap1000_init(void) -+{ -+ ixp4xx_sys_init(); -+ -+ ap1000_flash_resource.start = IXP4XX_EXP_BUS_BASE(0); -+ ap1000_flash_resource.end = -+ IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1; -+ -+ platform_add_devices(ap1000_devices, ARRAY_SIZE(ap1000_devices)); -+} -+ -+#ifdef CONFIG_MACH_AP1000 -+MACHINE_START(AP1000, "Lanready AP-1000") -+ /* Maintainer: Imre Kaloz <Kaloz@openwrt.org> */ -+ .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, -+ .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, -+ .fixup = ap1000_fixup, -+ .map_io = ixp4xx_map_io, -+ .init_irq = ixp4xx_init_irq, -+ .timer = &ixp4xx_timer, -+ .boot_params = 0x0100, -+ .init_machine = ap1000_init, -+MACHINE_END -+#endif -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/ixdp425-pci.c -=================================================================== ---- linux-2.6.24.7.orig/arch/arm/mach-ixp4xx/ixdp425-pci.c -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/ixdp425-pci.c -@@ -66,7 +66,8 @@ struct hw_pci ixdp425_pci __initdata = { - int __init ixdp425_pci_init(void) - { - if (machine_is_ixdp425() || machine_is_ixcdp1100() || -- machine_is_ixdp465() || machine_is_kixrp435() || machine_is_compex()) -+ machine_is_ixdp465() || machine_is_kixrp435() || -+ machine_is_compex() || machine_is_ap1000()) - pci_common_init(&ixdp425_pci); - return 0; - } -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/Kconfig -=================================================================== ---- linux-2.6.24.7.orig/arch/arm/mach-ixp4xx/Kconfig -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/Kconfig -@@ -89,6 +89,14 @@ config MACH_WRT300NV2 - WRT300N v2 router. For more information on this - platform, see http://openwrt.org - -+config MACH_AP1000 -+ bool "Lanready AP-1000" -+ select PCI -+ help -+ Say 'Y' here if you want your kernel to support Lanready's -+ AP1000 board. For more information on this -+ platform, see http://openwrt.org -+ - config ARCH_IXDP425 - bool "IXDP425" - help -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/Makefile -=================================================================== ---- linux-2.6.24.7.orig/arch/arm/mach-ixp4xx/Makefile -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/Makefile -@@ -20,6 +20,7 @@ obj-pci-$(CONFIG_MACH_PRONGHORNMETRO) += - obj-pci-$(CONFIG_MACH_COMPEX) += ixdp425-pci.o - obj-pci-$(CONFIG_MACH_WRT300NV2) += wrt300nv2-pci.o - obj-pci-$(CONFIG_MACH_SIDEWINDER) += sidewinder-pci.o -+obj-pci-$(CONFIG_MACH_AP1000) += ixdp425-pci.o - - obj-y += common.o - -@@ -38,5 +39,6 @@ obj-$(CONFIG_MACH_PRONGHORNMETRO) += pro - obj-$(CONFIG_MACH_COMPEX) += compex-setup.o - obj-$(CONFIG_MACH_WRT300NV2) += wrt300nv2-setup.o - obj-$(CONFIG_MACH_SIDEWINDER) += sidewinder-setup.o -+obj-$(CONFIG_MACH_AP1000) += ap1000-setup.o - - obj-$(CONFIG_PCI) += $(obj-pci-$(CONFIG_PCI)) common-pci.o diff --git a/target/linux/ixp4xx/patches-2.6.24/151-lanready_ap1000_mac_plat_info.patch b/target/linux/ixp4xx/patches-2.6.24/151-lanready_ap1000_mac_plat_info.patch deleted file mode 100644 index 6178b5f2e3..0000000000 --- a/target/linux/ixp4xx/patches-2.6.24/151-lanready_ap1000_mac_plat_info.patch +++ /dev/null @@ -1,43 +0,0 @@ -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/ap1000-setup.c -=================================================================== ---- linux-2.6.24.7.orig/arch/arm/mach-ixp4xx/ap1000-setup.c -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/ap1000-setup.c -@@ -90,9 +90,37 @@ static struct platform_device ap1000_uar - .resource = ap1000_uart_resources - }; - -+/* Built-in 10/100 Ethernet MAC interfaces */ -+static struct eth_plat_info ap1000_plat_eth[] = { -+ { -+ .phy = IXP4XX_ETH_PHY_MAX_ADDR, -+ .phy_mask = 0x1e, -+ .rxq = 3, -+ .txreadyq = 20, -+ }, { -+ .phy = 5, -+ .rxq = 4, -+ .txreadyq = 21, -+ } -+}; -+ -+static struct platform_device ap1000_eth[] = { -+ { -+ .name = "ixp4xx_eth", -+ .id = IXP4XX_ETH_NPEB, -+ .dev.platform_data = ap1000_plat_eth, -+ }, { -+ .name = "ixp4xx_eth", -+ .id = IXP4XX_ETH_NPEC, -+ .dev.platform_data = ap1000_plat_eth + 1, -+ } -+}; -+ - static struct platform_device *ap1000_devices[] __initdata = { - &ap1000_flash, -- &ap1000_uart -+ &ap1000_uart, -+ &ap1000_eth[0], -+ &ap1000_eth[1], - }; - - static char ap1000_mem_fixup[] __initdata = "mem=64M "; diff --git a/target/linux/ixp4xx/patches-2.6.24/160-wg302v1_support.patch b/target/linux/ixp4xx/patches-2.6.24/160-wg302v1_support.patch deleted file mode 100644 index 72bea002c3..0000000000 --- a/target/linux/ixp4xx/patches-2.6.24/160-wg302v1_support.patch +++ /dev/null @@ -1,221 +0,0 @@ -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/Kconfig -=================================================================== ---- linux-2.6.24.7.orig/arch/arm/mach-ixp4xx/Kconfig -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/Kconfig -@@ -49,6 +49,14 @@ config MACH_GATEWAY7001 - 7001 Access Point. For more information on this platform, - see http://openwrt.org - -+config MACH_WG302V1 -+ bool "Netgear WG302 v1 / WAG302 v1" -+ select PCI -+ help -+ Say 'Y' here if you want your kernel to support Netgear's -+ WG302 v1 or WAG302 v1 Access Points. For more information -+ on this platform, see http://openwrt.org -+ - config MACH_WG302V2 - bool "Netgear WG302 v2 / WAG302 v2" - select PCI -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/Makefile -=================================================================== ---- linux-2.6.24.7.orig/arch/arm/mach-ixp4xx/Makefile -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/Makefile -@@ -14,6 +14,7 @@ obj-pci-$(CONFIG_MACH_NSLU2) += nslu2-p - obj-pci-$(CONFIG_MACH_NAS100D) += nas100d-pci.o - obj-pci-$(CONFIG_MACH_DSMG600) += dsmg600-pci.o - obj-pci-$(CONFIG_MACH_GATEWAY7001) += gateway7001-pci.o -+obj-pci-$(CONFIG_MACH_WG302V1) += wg302v1-pci.o - obj-pci-$(CONFIG_MACH_WG302V2) += wg302v2-pci.o - obj-pci-$(CONFIG_MACH_FSG) += fsg-pci.o - obj-pci-$(CONFIG_MACH_PRONGHORNMETRO) += pronghornmetro-pci.o -@@ -33,6 +34,7 @@ obj-$(CONFIG_MACH_NSLU2) += nslu2-setup. - obj-$(CONFIG_MACH_NAS100D) += nas100d-setup.o - obj-$(CONFIG_MACH_DSMG600) += dsmg600-setup.o - obj-$(CONFIG_MACH_GATEWAY7001) += gateway7001-setup.o -+obj-$(CONFIG_MACH_WG302V1) += wg302v1-setup.o - obj-$(CONFIG_MACH_WG302V2) += wg302v2-setup.o - obj-$(CONFIG_MACH_FSG) += fsg-setup.o - obj-$(CONFIG_MACH_PRONGHORNMETRO) += pronghornmetro-setup.o -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/wg302v1-pci.c -=================================================================== ---- /dev/null -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/wg302v1-pci.c -@@ -0,0 +1,63 @@ -+/* -+ * arch/arch/mach-ixp4xx/wg302v1-pci.c -+ * -+ * PCI setup routines for the Netgear WG302 v1 and WAG302 v1 -+ * -+ * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org> -+ * -+ * based on coyote-pci.c: -+ * Copyright (C) 2002 Jungo Software Technologies. -+ * Copyright (C) 2003 MontaVista Software, Inc. -+ * -+ * Maintainer: Imre Kaloz <kaloz@openwrt.org> -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ * -+ */ -+ -+#include <linux/kernel.h> -+#include <linux/pci.h> -+#include <linux/init.h> -+#include <linux/irq.h> -+ -+#include <asm/mach-types.h> -+#include <asm/hardware.h> -+ -+#include <asm/mach/pci.h> -+ -+void __init wg302v1_pci_preinit(void) -+{ -+ set_irq_type(IRQ_IXP4XX_GPIO8, IRQT_LOW); -+ set_irq_type(IRQ_IXP4XX_GPIO10, IRQT_LOW); -+ -+ ixp4xx_pci_preinit(); -+} -+ -+static int __init wg302v1_map_irq(struct pci_dev *dev, u8 slot, u8 pin) -+{ -+ if (slot == 1) -+ return IRQ_IXP4XX_GPIO8; -+ else if (slot == 2) -+ return IRQ_IXP4XX_GPIO10; -+ else return -1; -+} -+ -+struct hw_pci wg302v1_pci __initdata = { -+ .nr_controllers = 1, -+ .preinit = wg302v1_pci_preinit, -+ .swizzle = pci_std_swizzle, -+ .setup = ixp4xx_setup, -+ .scan = ixp4xx_scan_bus, -+ .map_irq = wg302v1_map_irq, -+}; -+ -+int __init wg302v1_pci_init(void) -+{ -+ if (machine_is_wg302v1()) -+ pci_common_init(&wg302v1_pci); -+ return 0; -+} -+ -+subsys_initcall(wg302v1_pci_init); -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/wg302v1-setup.c -=================================================================== ---- /dev/null -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/wg302v1-setup.c -@@ -0,0 +1,109 @@ -+/* -+ * arch/arm/mach-ixp4xx/wg302v1-setup.c -+ * -+ * Board setup for the Netgear WG302 v1 and WAG302 v1 -+ * -+ * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org> -+ * -+ * based on coyote-setup.c: -+ * Copyright (C) 2003-2005 MontaVista Software, Inc. -+ * -+ * Author: Imre Kaloz <kaloz@openwrt.org> -+ * -+ */ -+ -+#include <linux/kernel.h> -+#include <linux/init.h> -+#include <linux/device.h> -+#include <linux/serial.h> -+#include <linux/tty.h> -+#include <linux/serial_8250.h> -+#include <linux/slab.h> -+ -+#include <asm/types.h> -+#include <asm/setup.h> -+#include <asm/memory.h> -+#include <asm/hardware.h> -+#include <asm/irq.h> -+#include <asm/mach-types.h> -+#include <asm/mach/arch.h> -+#include <asm/mach/flash.h> -+ -+static struct flash_platform_data wg302v1_flash_data = { -+ .map_name = "cfi_probe", -+ .width = 2, -+}; -+ -+static struct resource wg302v1_flash_resource = { -+ .flags = IORESOURCE_MEM, -+}; -+ -+static struct platform_device wg302v1_flash = { -+ .name = "IXP4XX-Flash", -+ .id = 0, -+ .dev = { -+ .platform_data = &wg302v1_flash_data, -+ }, -+ .num_resources = 1, -+ .resource = &wg302v1_flash_resource, -+}; -+ -+static struct resource wg302v1_uart_resource = { -+ .start = IXP4XX_UART1_BASE_PHYS, -+ .end = IXP4XX_UART1_BASE_PHYS + 0x0fff, -+ .flags = IORESOURCE_MEM, -+}; -+ -+static struct plat_serial8250_port wg302v1_uart_data[] = { -+ { -+ .mapbase = IXP4XX_UART1_BASE_PHYS, -+ .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET, -+ .irq = IRQ_IXP4XX_UART1, -+ .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, -+ .iotype = UPIO_MEM, -+ .regshift = 2, -+ .uartclk = IXP4XX_UART_XTAL, -+ }, -+ { }, -+}; -+ -+static struct platform_device wg302v1_uart = { -+ .name = "serial8250", -+ .id = PLAT8250_DEV_PLATFORM, -+ .dev = { -+ .platform_data = wg302v1_uart_data, -+ }, -+ .num_resources = 1, -+ .resource = &wg302v1_uart_resource, -+}; -+ -+static struct platform_device *wg302v1_devices[] __initdata = { -+ &wg302v1_flash, -+ &wg302v1_uart, -+}; -+ -+static void __init wg302v1_init(void) -+{ -+ ixp4xx_sys_init(); -+ -+ wg302v1_flash_resource.start = IXP4XX_EXP_BUS_BASE(0); -+ wg302v1_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_32M - 1; -+ -+ *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE; -+ *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0; -+ -+ platform_add_devices(wg302v1_devices, ARRAY_SIZE(wg302v1_devices)); -+} -+ -+#ifdef CONFIG_MACH_WG302V1 -+MACHINE_START(WG302V1, "Netgear WG302 v1 / WAG302 v1") -+ /* Maintainer: Imre Kaloz <kaloz@openwrt.org> */ -+ .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, -+ .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, -+ .map_io = ixp4xx_map_io, -+ .init_irq = ixp4xx_init_irq, -+ .timer = &ixp4xx_timer, -+ .boot_params = 0x0100, -+ .init_machine = wg302v1_init, -+MACHINE_END -+#endif diff --git a/target/linux/ixp4xx/patches-2.6.24/161-wg302v1_mac_plat_info.patch b/target/linux/ixp4xx/patches-2.6.24/161-wg302v1_mac_plat_info.patch deleted file mode 100644 index 2d56cc8847..0000000000 --- a/target/linux/ixp4xx/patches-2.6.24/161-wg302v1_mac_plat_info.patch +++ /dev/null @@ -1,32 +0,0 @@ -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/wg302v1-setup.c -=================================================================== ---- linux-2.6.24.7.orig/arch/arm/mach-ixp4xx/wg302v1-setup.c -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/wg302v1-setup.c -@@ -77,9 +77,27 @@ static struct platform_device wg302v1_ua - .resource = &wg302v1_uart_resource, - }; - -+/* Built-in 10/100 Ethernet MAC interfaces */ -+static struct eth_plat_info wg302_plat_eth[] = { -+ { -+ .phy = 30, -+ .rxq = 3, -+ .txreadyq = 20, -+ } -+}; -+ -+static struct platform_device wg302_eth[] = { -+ { -+ .name = "ixp4xx_eth", -+ .id = IXP4XX_ETH_NPEB, -+ .dev.platform_data = wg302_plat_eth, -+ } -+}; -+ - static struct platform_device *wg302v1_devices[] __initdata = { - &wg302v1_flash, - &wg302v1_uart, -+ &wg302_eth[0], - }; - - static void __init wg302v1_init(void) diff --git a/target/linux/ixp4xx/patches-2.6.24/162-wg302v1_mem_fixup.patch b/target/linux/ixp4xx/patches-2.6.24/162-wg302v1_mem_fixup.patch deleted file mode 100644 index 5c8024a0e1..0000000000 --- a/target/linux/ixp4xx/patches-2.6.24/162-wg302v1_mem_fixup.patch +++ /dev/null @@ -1,49 +0,0 @@ -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/wg302v1-setup.c -=================================================================== ---- linux-2.6.24.7.orig/arch/arm/mach-ixp4xx/wg302v1-setup.c -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/wg302v1-setup.c -@@ -100,6 +100,36 @@ static struct platform_device *wg302v1_d - &wg302_eth[0], - }; - -+static char wg302v1_mem_fixup[] __initdata = "mem=32M "; -+ -+static void __init wg302v1_fixup(struct machine_desc *desc, -+ struct tag *tags, char **cmdline, struct meminfo *mi) -+ -+{ -+ struct tag *t = tags; -+ char *p = *cmdline; -+ -+ /* Find the end of the tags table, taking note of any cmdline tag. */ -+ for (; t->hdr.size; t = tag_next(t)) { -+ if (t->hdr.tag == ATAG_CMDLINE) { -+ p = t->u.cmdline.cmdline; -+ } -+ } -+ -+ /* Overwrite the end of the table with a new cmdline tag. */ -+ t->hdr.tag = ATAG_CMDLINE; -+ t->hdr.size = (sizeof (struct tag_header) + -+ strlen(wg302v1_mem_fixup) + strlen(p) + 1 + 4) >> 2; -+ strlcpy(t->u.cmdline.cmdline, wg302v1_mem_fixup, COMMAND_LINE_SIZE); -+ strlcpy(t->u.cmdline.cmdline + strlen(wg302v1_mem_fixup), p, -+ COMMAND_LINE_SIZE - strlen(wg302v1_mem_fixup)); -+ -+ /* Terminate the table. */ -+ t = tag_next(t); -+ t->hdr.tag = ATAG_NONE; -+ t->hdr.size = 0; -+} -+ - static void __init wg302v1_init(void) - { - ixp4xx_sys_init(); -@@ -118,6 +148,7 @@ MACHINE_START(WG302V1, "Netgear WG302 v1 - /* Maintainer: Imre Kaloz <kaloz@openwrt.org> */ - .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, - .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, -+ .fixup = wg302v1_fixup, - .map_io = ixp4xx_map_io, - .init_irq = ixp4xx_init_irq, - .timer = &ixp4xx_timer, diff --git a/target/linux/ixp4xx/patches-2.6.24/170-ixdpg425_mac_plat_info.patch b/target/linux/ixp4xx/patches-2.6.24/170-ixdpg425_mac_plat_info.patch deleted file mode 100644 index 9026870287..0000000000 --- a/target/linux/ixp4xx/patches-2.6.24/170-ixdpg425_mac_plat_info.patch +++ /dev/null @@ -1,43 +0,0 @@ -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/coyote-setup.c -=================================================================== ---- linux-2.6.24.7.orig/arch/arm/mach-ixp4xx/coyote-setup.c -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/coyote-setup.c -@@ -73,9 +73,37 @@ static struct platform_device coyote_uar - .resource = &coyote_uart_resource, - }; - -+/* Built-in 10/100 Ethernet MAC interfaces */ -+static struct eth_plat_info ixdpg425_plat_eth[] = { -+ { -+ .phy = 5, -+ .rxq = 3, -+ .txreadyq = 20, -+ }, { -+ .phy = 4, -+ .rxq = 4, -+ .txreadyq = 21, -+ } -+}; -+ -+static struct platform_device ixdpg425_eth[] = { -+ { -+ .name = "ixp4xx_eth", -+ .id = IXP4XX_ETH_NPEB, -+ .dev.platform_data = ixdpg425_plat_eth, -+ }, { -+ .name = "ixp4xx_eth", -+ .id = IXP4XX_ETH_NPEC, -+ .dev.platform_data = ixdpg425_plat_eth + 1, -+ } -+}; -+ -+ - static struct platform_device *coyote_devices[] __initdata = { - &coyote_flash, -- &coyote_uart -+ &coyote_uart, -+ &ixdpg425_eth[0], -+ &ixdpg425_eth[1], - }; - - static void __init coyote_init(void) diff --git a/target/linux/ixp4xx/patches-2.6.24/180-tw5334_support.patch b/target/linux/ixp4xx/patches-2.6.24/180-tw5334_support.patch deleted file mode 100644 index a8c24f4e14..0000000000 --- a/target/linux/ixp4xx/patches-2.6.24/180-tw5334_support.patch +++ /dev/null @@ -1,293 +0,0 @@ -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/Kconfig -=================================================================== ---- linux-2.6.24.7.orig/arch/arm/mach-ixp4xx/Kconfig -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/Kconfig -@@ -150,6 +150,14 @@ config ARCH_PRPMC1100 - PrPCM1100 Processor Mezanine Module. For more information on - this platform, see <file:Documentation/arm/IXP4xx>. - -+config MACH_TW5334 -+ bool "Titan Wireless TW-533-4" -+ select PCI -+ help -+ Say 'Y' here if you want your kernel to support the Titan -+ Wireless TW533-4. For more information on this platform, -+ see http://openwrt.org -+ - config MACH_NAS100D - bool - prompt "NAS100D" -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/Makefile -=================================================================== ---- linux-2.6.24.7.orig/arch/arm/mach-ixp4xx/Makefile -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/Makefile -@@ -22,6 +22,7 @@ obj-pci-$(CONFIG_MACH_COMPEX) += ixdp42 - obj-pci-$(CONFIG_MACH_WRT300NV2) += wrt300nv2-pci.o - obj-pci-$(CONFIG_MACH_SIDEWINDER) += sidewinder-pci.o - obj-pci-$(CONFIG_MACH_AP1000) += ixdp425-pci.o -+obj-pci-$(CONFIG_MACH_TW5334) += tw5334-pci.o - - obj-y += common.o - -@@ -42,5 +43,6 @@ obj-$(CONFIG_MACH_COMPEX) += compex-setu - obj-$(CONFIG_MACH_WRT300NV2) += wrt300nv2-setup.o - obj-$(CONFIG_MACH_SIDEWINDER) += sidewinder-setup.o - obj-$(CONFIG_MACH_AP1000) += ap1000-setup.o -+obj-$(CONFIG_MACH_TW5334) += tw5334-setup.o - - obj-$(CONFIG_PCI) += $(obj-pci-$(CONFIG_PCI)) common-pci.o -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/tw5334-setup.c -=================================================================== ---- /dev/null -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/tw5334-setup.c -@@ -0,0 +1,162 @@ -+/* -+ * arch/arm/mach-ixp4xx/tw5334-setup.c -+ * -+ * Board setup for the Titan Wireless TW-533-4 -+ * -+ * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org> -+ * -+ * based on coyote-setup.c: -+ * Copyright (C) 2003-2005 MontaVista Software, Inc. -+ * -+ * Author: Imre Kaloz <Kaloz@openwrt.org> -+ */ -+ -+#include <linux/if_ether.h> -+#include <linux/kernel.h> -+#include <linux/init.h> -+#include <linux/device.h> -+#include <linux/serial.h> -+#include <linux/tty.h> -+#include <linux/serial_8250.h> -+#include <linux/slab.h> -+ -+#include <asm/types.h> -+#include <asm/setup.h> -+#include <asm/memory.h> -+#include <asm/hardware.h> -+#include <asm/irq.h> -+#include <asm/mach-types.h> -+#include <asm/mach/arch.h> -+#include <asm/mach/flash.h> -+ -+static struct flash_platform_data tw5334_flash_data = { -+ .map_name = "cfi_probe", -+ .width = 2, -+}; -+ -+static struct resource tw5334_flash_resource = { -+ .flags = IORESOURCE_MEM, -+}; -+ -+static struct platform_device tw5334_flash = { -+ .name = "IXP4XX-Flash", -+ .id = 0, -+ .dev = { -+ .platform_data = &tw5334_flash_data, -+ }, -+ .num_resources = 1, -+ .resource = &tw5334_flash_resource, -+}; -+ -+static struct resource tw5334_uart_resource = { -+ .start = IXP4XX_UART2_BASE_PHYS, -+ .end = IXP4XX_UART2_BASE_PHYS + 0x0fff, -+ .flags = IORESOURCE_MEM, -+}; -+ -+static struct plat_serial8250_port tw5334_uart_data[] = { -+ { -+ .mapbase = IXP4XX_UART2_BASE_PHYS, -+ .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET, -+ .irq = IRQ_IXP4XX_UART2, -+ .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, -+ .iotype = UPIO_MEM, -+ .regshift = 2, -+ .uartclk = IXP4XX_UART_XTAL, -+ }, -+ { }, -+}; -+ -+static struct platform_device tw5334_uart = { -+ .name = "serial8250", -+ .id = PLAT8250_DEV_PLATFORM, -+ .dev = { -+ .platform_data = tw5334_uart_data, -+ }, -+ .num_resources = 1, -+ .resource = &tw5334_uart_resource, -+}; -+ -+/* Built-in 10/100 Ethernet MAC interfaces */ -+static struct eth_plat_info tw5334_plat_eth[] = { -+ { -+ .phy = 0, -+ .rxq = 3, -+ .txreadyq = 20, -+ }, { -+ .phy = 1, -+ .rxq = 4, -+ .txreadyq = 21, -+ } -+}; -+ -+static struct platform_device tw5334_eth[] = { -+ { -+ .name = "ixp4xx_eth", -+ .id = IXP4XX_ETH_NPEB, -+ .dev.platform_data = tw5334_plat_eth, -+ }, { -+ .name = "ixp4xx_eth", -+ .id = IXP4XX_ETH_NPEC, -+ .dev.platform_data = tw5334_plat_eth + 1, -+ } -+}; -+ -+static struct platform_device *tw5334_devices[] __initdata = { -+ &tw5334_flash, -+ &tw5334_uart, -+ &tw5334_eth[0], -+ &tw5334_eth[1], -+}; -+ -+static void __init tw5334_init(void) -+{ -+ DECLARE_MAC_BUF(mac_buf); -+ uint8_t __iomem *f; -+ int i; -+ -+ ixp4xx_sys_init(); -+ -+ tw5334_flash_resource.start = IXP4XX_EXP_BUS_BASE(0); -+ tw5334_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_32M - 1; -+ -+ *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE; -+ *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0; -+ -+ platform_add_devices(tw5334_devices, ARRAY_SIZE(tw5334_devices)); -+ -+ /* -+ * Map in a portion of the flash and read the MAC addresses. -+ * Since it is stored in BE in the flash itself, we need to -+ * byteswap it if we're in LE mode. -+ */ -+ f = ioremap(IXP4XX_EXP_BUS_BASE(0), 0x1000000); -+ if (f) { -+ for (i = 0; i < 6; i++) -+#ifdef __ARMEB__ -+ tw5334_plat_eth[0].hwaddr[i] = readb(f + 0xFC0422 + i); -+ tw5334_plat_eth[1].hwaddr[i] = readb(f + 0xFC043B + i); -+#else -+ tw5334_plat_eth[0].hwaddr[i] = readb(f + 0xFC0422 + (i^3)); -+ tw5334_plat_eth[1].hwaddr[i] = readb(f + 0xFC043B + (i^3)); -+#endif -+ iounmap(f); -+ } -+ printk(KERN_INFO "TW-533-4: Using MAC address %s for port 0\n", -+ print_mac(mac_buf, tw5334_plat_eth[0].hwaddr)); -+ printk(KERN_INFO "TW-533-4: Using MAC address %s for port 1\n", -+ print_mac(mac_buf, tw5334_plat_eth[1].hwaddr)); -+} -+ -+#ifdef CONFIG_MACH_TW5334 -+MACHINE_START(TW5334, "Titan Wireless TW-533-4") -+ /* Maintainer: Imre Kaloz <kaloz@openwrt.org> */ -+ .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, -+ .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, -+ .map_io = ixp4xx_map_io, -+ .init_irq = ixp4xx_init_irq, -+ .timer = &ixp4xx_timer, -+ .boot_params = 0x0100, -+ .init_machine = tw5334_init, -+MACHINE_END -+#endif -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/tw5334-pci.c -=================================================================== ---- /dev/null -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/tw5334-pci.c -@@ -0,0 +1,69 @@ -+/* -+ * arch/arch/mach-ixp4xx/tw5334-pci.c -+ * -+ * PCI setup routines for the Titan Wireless TW-533-4 -+ * -+ * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org> -+ * -+ * based on coyote-pci.c: -+ * Copyright (C) 2002 Jungo Software Technologies. -+ * Copyright (C) 2003 MontaVista Softwrae, Inc. -+ * -+ * Maintainer: Imre Kaloz <kaloz@openwrt.org> -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ * -+ */ -+ -+#include <linux/kernel.h> -+#include <linux/pci.h> -+#include <linux/init.h> -+#include <linux/irq.h> -+ -+#include <asm/mach-types.h> -+#include <asm/hardware.h> -+ -+#include <asm/mach/pci.h> -+ -+void __init tw5334_pci_preinit(void) -+{ -+ set_irq_type(IRQ_IXP4XX_GPIO6, IRQT_LOW); -+ set_irq_type(IRQ_IXP4XX_GPIO2, IRQT_LOW); -+ set_irq_type(IRQ_IXP4XX_GPIO1, IRQT_LOW); -+ set_irq_type(IRQ_IXP4XX_GPIO0, IRQT_LOW); -+ -+ ixp4xx_pci_preinit(); -+} -+ -+static int __init tw5334_map_irq(struct pci_dev *dev, u8 slot, u8 pin) -+{ -+ if (slot == 12) -+ return IRQ_IXP4XX_GPIO6; -+ else if (slot == 13) -+ return IRQ_IXP4XX_GPIO2; -+ else if (slot == 14) -+ return IRQ_IXP4XX_GPIO1; -+ else if (slot == 15) -+ return IRQ_IXP4XX_GPIO0; -+ else return -1; -+} -+ -+struct hw_pci tw5334_pci __initdata = { -+ .nr_controllers = 1, -+ .preinit = tw5334_pci_preinit, -+ .swizzle = pci_std_swizzle, -+ .setup = ixp4xx_setup, -+ .scan = ixp4xx_scan_bus, -+ .map_irq = tw5334_map_irq, -+}; -+ -+int __init tw5334_pci_init(void) -+{ -+ if (machine_is_tw5334()) -+ pci_common_init(&tw5334_pci); -+ return 0; -+} -+ -+subsys_initcall(tw5334_pci_init); -Index: linux-2.6.24.7/include/asm-arm/arch-ixp4xx/uncompress.h -=================================================================== ---- linux-2.6.24.7.orig/include/asm-arm/arch-ixp4xx/uncompress.h -+++ linux-2.6.24.7/include/asm-arm/arch-ixp4xx/uncompress.h -@@ -42,7 +42,8 @@ static __inline__ void __arch_decomp_set - */ - if (machine_is_adi_coyote() || machine_is_gtwx5715() || - machine_is_gateway7001() || machine_is_wg302v2() || -- machine_is_pronghorn_metro() || machine_is_wrt300nv2()) -+ machine_is_pronghorn_metro() || machine_is_wrt300nv2() || -+ machine_is_tw5334()) - uart_base = (volatile u32*) IXP4XX_UART2_BASE_PHYS; - else - uart_base = (volatile u32*) IXP4XX_UART1_BASE_PHYS; diff --git a/target/linux/ixp4xx/patches-2.6.24/190-cambria_support.patch b/target/linux/ixp4xx/patches-2.6.24/190-cambria_support.patch deleted file mode 100644 index 9c8d0e07e7..0000000000 --- a/target/linux/ixp4xx/patches-2.6.24/190-cambria_support.patch +++ /dev/null @@ -1,395 +0,0 @@ -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/Kconfig -=================================================================== ---- linux-2.6.24.7.orig/arch/arm/mach-ixp4xx/Kconfig -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/Kconfig -@@ -25,6 +25,14 @@ config MACH_AVILA - Avila Network Platform. For more information on this platform, - see <file:Documentation/arm/IXP4xx>. - -+config MACH_CAMBRIA -+ bool "Cambria" -+ select PCI -+ help -+ Say 'Y' here if you want your kernel to support the Gateworks -+ Cambria series. For more information on this platform, -+ see <file:Documentation/arm/IXP4xx>. -+ - config MACH_LOFT - bool "Loft" - depends on MACH_AVILA -@@ -200,7 +208,7 @@ config CPU_IXP46X - - config CPU_IXP43X - bool -- depends on MACH_KIXRP435 -+ depends on MACH_KIXRP435 || MACH_CAMBRIA - default y - - config MACH_GTWX5715 -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/Makefile -=================================================================== ---- linux-2.6.24.7.orig/arch/arm/mach-ixp4xx/Makefile -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/Makefile -@@ -7,6 +7,7 @@ obj-pci-n := - - obj-pci-$(CONFIG_ARCH_IXDP4XX) += ixdp425-pci.o - obj-pci-$(CONFIG_MACH_AVILA) += avila-pci.o -+obj-pci-$(CONFIG_MACH_CAMBRIA) += cambria-pci.o - obj-pci-$(CONFIG_MACH_IXDPG425) += ixdpg425-pci.o - obj-pci-$(CONFIG_ARCH_ADI_COYOTE) += coyote-pci.o - obj-pci-$(CONFIG_MACH_GTWX5715) += gtwx5715-pci.o -@@ -28,6 +29,7 @@ obj-y += common.o - - obj-$(CONFIG_ARCH_IXDP4XX) += ixdp425-setup.o - obj-$(CONFIG_MACH_AVILA) += avila-setup.o -+obj-$(CONFIG_MACH_CAMBRIA) += cambria-setup.o - obj-$(CONFIG_MACH_IXDPG425) += coyote-setup.o - obj-$(CONFIG_ARCH_ADI_COYOTE) += coyote-setup.o - obj-$(CONFIG_MACH_GTWX5715) += gtwx5715-setup.o -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/cambria-pci.c -=================================================================== ---- /dev/null -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/cambria-pci.c -@@ -0,0 +1,74 @@ -+/* -+ * arch/arch/mach-ixp4xx/cambria-pci.c -+ * -+ * PCI setup routines for Gateworks Cambria series -+ * -+ * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org> -+ * -+ * based on coyote-pci.c: -+ * Copyright (C) 2002 Jungo Software Technologies. -+ * Copyright (C) 2003 MontaVista Softwrae, Inc. -+ * -+ * Maintainer: Imre Kaloz <kaloz@openwrt.org> -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ * -+ */ -+ -+#include <linux/kernel.h> -+#include <linux/pci.h> -+#include <linux/init.h> -+#include <linux/irq.h> -+ -+#include <asm/mach-types.h> -+#include <asm/hardware.h> -+#include <asm/irq.h> -+ -+#include <asm/mach/pci.h> -+ -+extern void ixp4xx_pci_preinit(void); -+extern int ixp4xx_setup(int nr, struct pci_sys_data *sys); -+extern struct pci_bus *ixp4xx_scan_bus(int nr, struct pci_sys_data *sys); -+ -+void __init cambria_pci_preinit(void) -+{ -+ set_irq_type(IRQ_IXP4XX_GPIO11, IRQT_LOW); -+ set_irq_type(IRQ_IXP4XX_GPIO10, IRQT_LOW); -+ set_irq_type(IRQ_IXP4XX_GPIO9, IRQT_LOW); -+ set_irq_type(IRQ_IXP4XX_GPIO8, IRQT_LOW); -+ -+ ixp4xx_pci_preinit(); -+} -+ -+static int __init cambria_map_irq(struct pci_dev *dev, u8 slot, u8 pin) -+{ -+ if (slot == 1) -+ return IRQ_IXP4XX_GPIO11; -+ else if (slot == 2) -+ return IRQ_IXP4XX_GPIO10; -+ else if (slot == 3) -+ return IRQ_IXP4XX_GPIO9; -+ else if (slot == 4) -+ return IRQ_IXP4XX_GPIO8; -+ else return -1; -+} -+ -+struct hw_pci cambria_pci __initdata = { -+ .nr_controllers = 1, -+ .preinit = cambria_pci_preinit, -+ .swizzle = pci_std_swizzle, -+ .setup = ixp4xx_setup, -+ .scan = ixp4xx_scan_bus, -+ .map_irq = cambria_map_irq, -+}; -+ -+int __init cambria_pci_init(void) -+{ -+ if (machine_is_cambria()) -+ pci_common_init(&cambria_pci); -+ return 0; -+} -+ -+subsys_initcall(cambria_pci_init); -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/cambria-setup.c -=================================================================== ---- /dev/null -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/cambria-setup.c -@@ -0,0 +1,250 @@ -+/* -+ * arch/arm/mach-ixp4xx/cambria-setup.c -+ * -+ * Board setup for the Gateworks Cambria series -+ * -+ * Copyright (C) 2008 Imre Kaloz <Kaloz@openwrt.org> -+ * -+ * based on coyote-setup.c: -+ * Copyright (C) 2003-2005 MontaVista Software, Inc. -+ * -+ * Author: Imre Kaloz <Kaloz@openwrt.org> -+ */ -+ -+#include <linux/kernel.h> -+#include <linux/init.h> -+#include <linux/device.h> -+#include <linux/if_ether.h> -+#include <linux/socket.h> -+#include <linux/netdevice.h> -+#include <linux/serial.h> -+#include <linux/tty.h> -+#include <linux/serial_8250.h> -+#include <linux/slab.h> -+#ifdef CONFIG_SENSORS_EEPROM -+# include <linux/i2c.h> -+# include <linux/eeprom.h> -+#endif -+ -+#include <linux/i2c-gpio.h> -+#include <asm/types.h> -+#include <asm/setup.h> -+#include <asm/memory.h> -+#include <asm/hardware.h> -+#include <asm/irq.h> -+#include <asm/mach-types.h> -+#include <asm/mach/arch.h> -+#include <asm/mach/flash.h> -+ -+static struct flash_platform_data cambria_flash_data = { -+ .map_name = "cfi_probe", -+ .width = 2, -+}; -+ -+static struct resource cambria_flash_resource = { -+ .flags = IORESOURCE_MEM, -+}; -+ -+static struct platform_device cambria_flash = { -+ .name = "IXP4XX-Flash", -+ .id = 0, -+ .dev = { -+ .platform_data = &cambria_flash_data, -+ }, -+ .num_resources = 1, -+ .resource = &cambria_flash_resource, -+}; -+ -+static struct i2c_gpio_platform_data cambria_i2c_gpio_data = { -+ .sda_pin = 7, -+ .scl_pin = 6, -+}; -+ -+static struct platform_device cambria_i2c_gpio = { -+ .name = "i2c-gpio", -+ .id = 0, -+ .dev = { -+ .platform_data = &cambria_i2c_gpio_data, -+ }, -+}; -+ -+static struct resource cambria_uart_resource = { -+ .start = IXP4XX_UART1_BASE_PHYS, -+ .end = IXP4XX_UART1_BASE_PHYS + 0x0fff, -+ .flags = IORESOURCE_MEM, -+}; -+ -+static struct plat_serial8250_port cambria_uart_data[] = { -+ { -+ .mapbase = IXP4XX_UART1_BASE_PHYS, -+ .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET, -+ .irq = IRQ_IXP4XX_UART1, -+ .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, -+ .iotype = UPIO_MEM, -+ .regshift = 2, -+ .uartclk = IXP4XX_UART_XTAL, -+ }, -+ { }, -+}; -+ -+static struct platform_device cambria_uart = { -+ .name = "serial8250", -+ .id = PLAT8250_DEV_PLATFORM, -+ .dev = { -+ .platform_data = cambria_uart_data, -+ }, -+ .num_resources = 1, -+ .resource = &cambria_uart_resource, -+}; -+ -+static struct resource cambria_pata_resources[] = { -+ { -+ .flags = IORESOURCE_MEM -+ }, -+ { -+ .flags = IORESOURCE_MEM, -+ }, -+ { -+ .name = "intrq", -+ .start = IRQ_IXP4XX_GPIO12, -+ .end = IRQ_IXP4XX_GPIO12, -+ .flags = IORESOURCE_IRQ, -+ }, -+}; -+ -+static struct ixp4xx_pata_data cambria_pata_data = { -+ .cs0_bits = 0xbfff3c03, -+ .cs1_bits = 0xbfff3c03, -+}; -+ -+static struct platform_device cambria_pata = { -+ .name = "pata_ixp4xx_cf", -+ .id = 0, -+ .dev.platform_data = &cambria_pata_data, -+ .num_resources = ARRAY_SIZE(cambria_pata_resources), -+ .resource = cambria_pata_resources, -+}; -+ -+static struct eth_plat_info cambria_plat_eth[] = { -+ { -+ .phy = 2, -+ .rxq = 4, -+ .txreadyq = 21, -+ }, { -+ .phy = 1, -+ .rxq = 2, -+ .txreadyq = 19, -+ } -+}; -+ -+static struct platform_device cambria_eth[] = { -+ { -+ .name = "ixp4xx_eth", -+ .id = IXP4XX_ETH_NPEC, -+ .dev.platform_data = cambria_plat_eth, -+ }, { -+ .name = "ixp4xx_eth", -+ .id = IXP4XX_ETH_NPEA, -+ .dev.platform_data = cambria_plat_eth + 1, -+ } -+}; -+ -+#ifdef CONFIG_LEDS_IXP4XX -+static struct platform_device cambria_leds_pld = { -+ .name = "IXP4XX-PLD-LED", -+ .id = -1, -+ .num_resources = 0, -+}; -+ -+static struct platform_device cambria_leds_mem = { -+ .name = "IXP4XX-MEM-LED", -+ .id = -1, -+ .num_resources = 0, -+}; -+#endif -+ -+static struct platform_device *cambria_devices[] __initdata = { -+ &cambria_i2c_gpio, -+ &cambria_flash, -+ &cambria_uart, -+#ifdef CONFIG_LEDS_IXP4XX -+ &cambria_leds_pld, -+ &cambria_leds_mem, -+#endif -+ &cambria_eth[0], -+ &cambria_eth[1], -+}; -+ -+#ifdef CONFIG_SENSORS_EEPROM -+static int cambria_eeprom_do(struct notifier_block *self, unsigned long event, void *t) -+{ -+ struct eeprom_data *data = t; -+ struct sockaddr address; -+ struct net_device * netdev; -+ -+ char macs[12]; -+ -+ /* The MACs are the first 12 bytes in the eeprom at address 0x51 */ -+ if (event == EEPROM_REGISTER && data->client.addr == 0x51) { -+ data->attr->read(&data->client.dev.kobj, data->attr, macs, 0, 12); -+ /* eth0 */ -+ memcpy(address.sa_data, macs, ETH_ALEN); -+ memcpy(&cambria_plat_eth[0].hwaddr, macs, ETH_ALEN); -+ if ( (netdev = dev_get_by_name(&init_net, "eth0")) ) -+ netdev->set_mac_address(netdev, &address); -+ -+ /* eth1 */ -+ memcpy(address.sa_data, macs + ETH_ALEN, ETH_ALEN); -+ memcpy(&cambria_plat_eth[1].hwaddr, macs + ETH_ALEN, ETH_ALEN); -+ if ( (netdev = dev_get_by_name(&init_net, "eth1")) ) -+ netdev->set_mac_address(netdev, &address); -+ } -+ -+ return NOTIFY_DONE; -+} -+ -+static struct notifier_block cambria_eeprom_notifier = { -+ .notifier_call = cambria_eeprom_do -+}; -+#endif -+ -+static void __init cambria_init(void) -+{ -+ ixp4xx_sys_init(); -+ -+#ifdef CONFIG_SENSORS_EEPROM -+ register_eeprom_notifier(&cambria_eeprom_notifier); -+#endif -+ -+ cambria_flash_resource.start = IXP4XX_EXP_BUS_BASE(0); -+ cambria_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_32M - 1; -+ -+ *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE; -+ *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0; -+ -+ platform_add_devices(cambria_devices, ARRAY_SIZE(cambria_devices)); -+ -+ cambria_pata_resources[0].start = 0x53e00000; -+ cambria_pata_resources[0].end = 0x53e3ffff; -+ -+ cambria_pata_resources[1].start = 0x53e40000; -+ cambria_pata_resources[1].end = 0x53e7ffff; -+ -+ cambria_pata_data.cs0_cfg = IXP4XX_EXP_CS3; -+ cambria_pata_data.cs1_cfg = IXP4XX_EXP_CS3; -+ -+ platform_device_register(&cambria_pata); -+} -+ -+#ifdef CONFIG_MACH_CAMBRIA -+MACHINE_START(CAMBRIA, "Gateworks Cambria series") -+ /* Maintainer: Imre Kaloz <kaloz@openwrt.org> */ -+ .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, -+ .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, -+ .map_io = ixp4xx_map_io, -+ .init_irq = ixp4xx_init_irq, -+ .timer = &ixp4xx_timer, -+ .boot_params = 0x0100, -+ .init_machine = cambria_init, -+MACHINE_END -+#endif -Index: linux-2.6.24.7/include/asm-arm/arch-ixp4xx/hardware.h -=================================================================== ---- linux-2.6.24.7.orig/include/asm-arm/arch-ixp4xx/hardware.h -+++ linux-2.6.24.7/include/asm-arm/arch-ixp4xx/hardware.h -@@ -18,7 +18,7 @@ - #define __ASM_ARCH_HARDWARE_H__ - - #define PCIBIOS_MIN_IO 0x00001000 --#define PCIBIOS_MIN_MEM (cpu_is_ixp43x() ? 0x40000000 : 0x48000000) -+#define PCIBIOS_MIN_MEM (cpu_is_ixp43x() ? 0x48000000 : 0x48000000) - - /* - * We override the standard dma-mask routines for bouncing. diff --git a/target/linux/ixp4xx/patches-2.6.24/200-npe_driver.patch b/target/linux/ixp4xx/patches-2.6.24/200-npe_driver.patch deleted file mode 100644 index 97ff757e03..0000000000 --- a/target/linux/ixp4xx/patches-2.6.24/200-npe_driver.patch +++ /dev/null @@ -1,4036 +0,0 @@ -Index: linux-2.6.24.7/drivers/net/arm/Kconfig -=================================================================== ---- linux-2.6.24.7.orig/drivers/net/arm/Kconfig -+++ linux-2.6.24.7/drivers/net/arm/Kconfig -@@ -47,3 +47,13 @@ config EP93XX_ETH - help - This is a driver for the ethernet hardware included in EP93xx CPUs. - Say Y if you are building a kernel for EP93xx based devices. -+ -+config IXP4XX_ETH -+ tristate "IXP4xx Ethernet support" -+ depends on NET_ETHERNET && ARM && ARCH_IXP4XX -+ select IXP4XX_NPE -+ select IXP4XX_QMGR -+ select MII -+ help -+ Say Y here if you want to use built-in Ethernet ports -+ on IXP4xx processor. -Index: linux-2.6.24.7/drivers/net/arm/Makefile -=================================================================== ---- linux-2.6.24.7.orig/drivers/net/arm/Makefile -+++ linux-2.6.24.7/drivers/net/arm/Makefile -@@ -9,3 +9,4 @@ obj-$(CONFIG_ARM_ETHER3) += ether3.o - obj-$(CONFIG_ARM_ETHER1) += ether1.o - obj-$(CONFIG_ARM_AT91_ETHER) += at91_ether.o - obj-$(CONFIG_EP93XX_ETH) += ep93xx_eth.o -+obj-$(CONFIG_IXP4XX_ETH) += ixp4xx_eth.o -Index: linux-2.6.24.7/drivers/net/arm/ixp4xx_eth.c -=================================================================== ---- /dev/null -+++ linux-2.6.24.7/drivers/net/arm/ixp4xx_eth.c -@@ -0,0 +1,1261 @@ -+/* -+ * Intel IXP4xx Ethernet driver for Linux -+ * -+ * Copyright (C) 2007 Krzysztof Halasa <khc@pm.waw.pl> -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of version 2 of the GNU General Public License -+ * as published by the Free Software Foundation. -+ * -+ * Ethernet port config (0x00 is not present on IXP42X): -+ * -+ * logical port 0x00 0x10 0x20 -+ * NPE 0 (NPE-A) 1 (NPE-B) 2 (NPE-C) -+ * physical PortId 2 0 1 -+ * TX queue 23 24 25 -+ * RX-free queue 26 27 28 -+ * TX-done queue is always 31, per-port RX and TX-ready queues are configurable -+ * -+ * -+ * Queue entries: -+ * bits 0 -> 1 - NPE ID (RX and TX-done) -+ * bits 0 -> 2 - priority (TX, per 802.1D) -+ * bits 3 -> 4 - port ID (user-set?) -+ * bits 5 -> 31 - physical descriptor address -+ */ -+ -+#include <linux/delay.h> -+#include <linux/dma-mapping.h> -+#include <linux/dmapool.h> -+#include <linux/etherdevice.h> -+#include <linux/io.h> -+#include <linux/kernel.h> -+#include <linux/mii.h> -+#include <linux/platform_device.h> -+#include <asm/arch/npe.h> -+#include <asm/arch/qmgr.h> -+ -+#define DEBUG_QUEUES 0 -+#define DEBUG_DESC 0 -+#define DEBUG_RX 0 -+#define DEBUG_TX 0 -+#define DEBUG_PKT_BYTES 0 -+#define DEBUG_MDIO 0 -+#define DEBUG_CLOSE 0 -+ -+#define DRV_NAME "ixp4xx_eth" -+ -+#define MAX_NPES 3 -+ -+#define RX_DESCS 64 /* also length of all RX queues */ -+#define TX_DESCS 16 /* also length of all TX queues */ -+#define TXDONE_QUEUE_LEN 64 /* dwords */ -+ -+#define POOL_ALLOC_SIZE (sizeof(struct desc) * (RX_DESCS + TX_DESCS)) -+#define REGS_SIZE 0x1000 -+#define MAX_MRU 1536 /* 0x600 */ -+ -+#define MDIO_INTERVAL (3 * HZ) -+#define MAX_MDIO_RETRIES 100 /* microseconds, typically 30 cycles */ -+#define MAX_MII_RESET_RETRIES 100 /* mdio_read() cycles, typically 4 */ -+#define MAX_CLOSE_WAIT 1000 /* microseconds, typically 2-3 cycles */ -+ -+#define NPE_ID(port_id) ((port_id) >> 4) -+#define PHYSICAL_ID(port_id) ((NPE_ID(port_id) + 2) % 3) -+#define TX_QUEUE(port_id) (NPE_ID(port_id) + 23) -+#define RXFREE_QUEUE(port_id) (NPE_ID(port_id) + 26) -+#define TXDONE_QUEUE 31 -+ -+#define ETH_NAPI_WEIGHT 16 -+ -+/* TX Control Registers */ -+#define TX_CNTRL0_TX_EN 0x01 -+#define TX_CNTRL0_HALFDUPLEX 0x02 -+#define TX_CNTRL0_RETRY 0x04 -+#define TX_CNTRL0_PAD_EN 0x08 -+#define TX_CNTRL0_APPEND_FCS 0x10 -+#define TX_CNTRL0_2DEFER 0x20 -+#define TX_CNTRL0_RMII 0x40 /* reduced MII */ -+#define TX_CNTRL1_RETRIES 0x0F /* 4 bits */ -+ -+/* RX Control Registers */ -+#define RX_CNTRL0_RX_EN 0x01 -+#define RX_CNTRL0_PADSTRIP_EN 0x02 -+#define RX_CNTRL0_SEND_FCS 0x04 -+#define RX_CNTRL0_PAUSE_EN 0x08 -+#define RX_CNTRL0_LOOP_EN 0x10 -+#define RX_CNTRL0_ADDR_FLTR_EN 0x20 -+#define RX_CNTRL0_RX_RUNT_EN 0x40 -+#define RX_CNTRL0_BCAST_DIS 0x80 -+#define RX_CNTRL1_DEFER_EN 0x01 -+ -+/* Core Control Register */ -+#define CORE_RESET 0x01 -+#define CORE_RX_FIFO_FLUSH 0x02 -+#define CORE_TX_FIFO_FLUSH 0x04 -+#define CORE_SEND_JAM 0x08 -+#define CORE_MDC_EN 0x10 /* MDIO using NPE-B ETH-0 only */ -+ -+#define DEFAULT_TX_CNTRL0 (TX_CNTRL0_TX_EN | TX_CNTRL0_RETRY | \ -+ TX_CNTRL0_PAD_EN | TX_CNTRL0_APPEND_FCS | \ -+ TX_CNTRL0_2DEFER) -+#define DEFAULT_RX_CNTRL0 RX_CNTRL0_RX_EN -+#define DEFAULT_CORE_CNTRL CORE_MDC_EN -+ -+ -+/* NPE message codes */ -+#define NPE_GETSTATUS 0x00 -+#define NPE_EDB_SETPORTADDRESS 0x01 -+#define NPE_EDB_GETMACADDRESSDATABASE 0x02 -+#define NPE_EDB_SETMACADDRESSSDATABASE 0x03 -+#define NPE_GETSTATS 0x04 -+#define NPE_RESETSTATS 0x05 -+#define NPE_SETMAXFRAMELENGTHS 0x06 -+#define NPE_VLAN_SETRXTAGMODE 0x07 -+#define NPE_VLAN_SETDEFAULTRXVID 0x08 -+#define NPE_VLAN_SETPORTVLANTABLEENTRY 0x09 -+#define NPE_VLAN_SETPORTVLANTABLERANGE 0x0A -+#define NPE_VLAN_SETRXQOSENTRY 0x0B -+#define NPE_VLAN_SETPORTIDEXTRACTIONMODE 0x0C -+#define NPE_STP_SETBLOCKINGSTATE 0x0D -+#define NPE_FW_SETFIREWALLMODE 0x0E -+#define NPE_PC_SETFRAMECONTROLDURATIONID 0x0F -+#define NPE_PC_SETAPMACTABLE 0x11 -+#define NPE_SETLOOPBACK_MODE 0x12 -+#define NPE_PC_SETBSSIDTABLE 0x13 -+#define NPE_ADDRESS_FILTER_CONFIG 0x14 -+#define NPE_APPENDFCSCONFIG 0x15 -+#define NPE_NOTIFY_MAC_RECOVERY_DONE 0x16 -+#define NPE_MAC_RECOVERY_START 0x17 -+ -+ -+#ifdef __ARMEB__ -+typedef struct sk_buff buffer_t; -+#define free_buffer dev_kfree_skb -+#define free_buffer_irq dev_kfree_skb_irq -+#else -+typedef void buffer_t; -+#define free_buffer kfree -+#define free_buffer_irq kfree -+#endif -+ -+struct eth_regs { -+ u32 tx_control[2], __res1[2]; /* 000 */ -+ u32 rx_control[2], __res2[2]; /* 010 */ -+ u32 random_seed, __res3[3]; /* 020 */ -+ u32 partial_empty_threshold, __res4; /* 030 */ -+ u32 partial_full_threshold, __res5; /* 038 */ -+ u32 tx_start_bytes, __res6[3]; /* 040 */ -+ u32 tx_deferral, rx_deferral,__res7[2]; /* 050 */ -+ u32 tx_2part_deferral[2], __res8[2]; /* 060 */ -+ u32 slot_time, __res9[3]; /* 070 */ -+ u32 mdio_command[4]; /* 080 */ -+ u32 mdio_status[4]; /* 090 */ -+ u32 mcast_mask[6], __res10[2]; /* 0A0 */ -+ u32 mcast_addr[6], __res11[2]; /* 0C0 */ -+ u32 int_clock_threshold, __res12[3]; /* 0E0 */ -+ u32 hw_addr[6], __res13[61]; /* 0F0 */ -+ u32 core_control; /* 1FC */ -+}; -+ -+struct port { -+ struct resource *mem_res; -+ struct eth_regs __iomem *regs; -+ struct npe *npe; -+ struct net_device *netdev; -+ struct napi_struct napi; -+ struct net_device_stats stat; -+ struct mii_if_info mii; -+ struct delayed_work mdio_thread; -+ struct eth_plat_info *plat; -+ buffer_t *rx_buff_tab[RX_DESCS], *tx_buff_tab[TX_DESCS]; -+ struct desc *desc_tab; /* coherent */ -+ u32 desc_tab_phys; -+ int id; /* logical port ID */ -+ u16 mii_bmcr; -+}; -+ -+/* NPE message structure */ -+struct msg { -+#ifdef __ARMEB__ -+ u8 cmd, eth_id, byte2, byte3; -+ u8 byte4, byte5, byte6, byte7; -+#else -+ u8 byte3, byte2, eth_id, cmd; -+ u8 byte7, byte6, byte5, byte4; -+#endif -+}; -+ -+/* Ethernet packet descriptor */ -+struct desc { -+ u32 next; /* pointer to next buffer, unused */ -+ -+#ifdef __ARMEB__ -+ u16 buf_len; /* buffer length */ -+ u16 pkt_len; /* packet length */ -+ u32 data; /* pointer to data buffer in RAM */ -+ u8 dest_id; -+ u8 src_id; -+ u16 flags; -+ u8 qos; -+ u8 padlen; -+ u16 vlan_tci; -+#else -+ u16 pkt_len; /* packet length */ -+ u16 buf_len; /* buffer length */ -+ u32 data; /* pointer to data buffer in RAM */ -+ u16 flags; -+ u8 src_id; -+ u8 dest_id; -+ u16 vlan_tci; -+ u8 padlen; -+ u8 qos; -+#endif -+ -+#ifdef __ARMEB__ -+ u8 dst_mac_0, dst_mac_1, dst_mac_2, dst_mac_3; -+ u8 dst_mac_4, dst_mac_5, src_mac_0, src_mac_1; -+ u8 src_mac_2, src_mac_3, src_mac_4, src_mac_5; -+#else -+ u8 dst_mac_3, dst_mac_2, dst_mac_1, dst_mac_0; -+ u8 src_mac_1, src_mac_0, dst_mac_5, dst_mac_4; -+ u8 src_mac_5, src_mac_4, src_mac_3, src_mac_2; -+#endif -+}; -+ -+ -+#define rx_desc_phys(port, n) ((port)->desc_tab_phys + \ -+ (n) * sizeof(struct desc)) -+#define rx_desc_ptr(port, n) (&(port)->desc_tab[n]) -+ -+#define tx_desc_phys(port, n) ((port)->desc_tab_phys + \ -+ ((n) + RX_DESCS) * sizeof(struct desc)) -+#define tx_desc_ptr(port, n) (&(port)->desc_tab[(n) + RX_DESCS]) -+ -+#ifndef __ARMEB__ -+static inline void memcpy_swab32(u32 *dest, u32 *src, int cnt) -+{ -+ int i; -+ for (i = 0; i < cnt; i++) -+ dest[i] = swab32(src[i]); -+} -+#endif -+ -+static spinlock_t mdio_lock; -+static struct eth_regs __iomem *mdio_regs; /* mdio command and status only */ -+static int ports_open; -+static struct port *npe_port_tab[MAX_NPES]; -+static struct dma_pool *dma_pool; -+ -+ -+static u16 mdio_cmd(struct net_device *dev, int phy_id, int location, -+ int write, u16 cmd) -+{ -+ int cycles = 0; -+ -+ if (__raw_readl(&mdio_regs->mdio_command[3]) & 0x80) { -+ printk(KERN_ERR "%s: MII not ready to transmit\n", dev->name); -+ return 0; -+ } -+ -+ if (write) { -+ __raw_writel(cmd & 0xFF, &mdio_regs->mdio_command[0]); -+ __raw_writel(cmd >> 8, &mdio_regs->mdio_command[1]); -+ } -+ __raw_writel(((phy_id << 5) | location) & 0xFF, -+ &mdio_regs->mdio_command[2]); -+ __raw_writel((phy_id >> 3) | (write << 2) | 0x80 /* GO */, -+ &mdio_regs->mdio_command[3]); -+ -+ while ((cycles < MAX_MDIO_RETRIES) && -+ (__raw_readl(&mdio_regs->mdio_command[3]) & 0x80)) { -+ udelay(1); -+ cycles++; -+ } -+ -+ if (cycles == MAX_MDIO_RETRIES) { -+ printk(KERN_ERR "%s: MII write failed\n", dev->name); -+ return 0; -+ } -+ -+#if DEBUG_MDIO -+ printk(KERN_DEBUG "%s: mdio_cmd() took %i cycles\n", dev->name, -+ cycles); -+#endif -+ -+ if (write) -+ return 0; -+ -+ if (__raw_readl(&mdio_regs->mdio_status[3]) & 0x80) { -+ printk(KERN_ERR "%s: MII read failed\n", dev->name); -+ return 0; -+ } -+ -+ return (__raw_readl(&mdio_regs->mdio_status[0]) & 0xFF) | -+ (__raw_readl(&mdio_regs->mdio_status[1]) << 8); -+} -+ -+static int mdio_read(struct net_device *dev, int phy_id, int location) -+{ -+ unsigned long flags; -+ u16 val; -+ -+ spin_lock_irqsave(&mdio_lock, flags); -+ val = mdio_cmd(dev, phy_id, location, 0, 0); -+ spin_unlock_irqrestore(&mdio_lock, flags); -+ return val; -+} -+ -+static void mdio_write(struct net_device *dev, int phy_id, int location, -+ int val) -+{ -+ unsigned long flags; -+ -+ spin_lock_irqsave(&mdio_lock, flags); -+ mdio_cmd(dev, phy_id, location, 1, val); -+ spin_unlock_irqrestore(&mdio_lock, flags); -+} -+ -+static void phy_reset(struct net_device *dev, int phy_id) -+{ -+ struct port *port = netdev_priv(dev); -+ int cycles = 0; -+ -+ mdio_write(dev, phy_id, MII_BMCR, port->mii_bmcr | BMCR_RESET); -+ -+ while (cycles < MAX_MII_RESET_RETRIES) { -+ if (!(mdio_read(dev, phy_id, MII_BMCR) & BMCR_RESET)) { -+#if DEBUG_MDIO -+ printk(KERN_DEBUG "%s: phy_reset() took %i cycles\n", -+ dev->name, cycles); -+#endif -+ return; -+ } -+ udelay(1); -+ cycles++; -+ } -+ -+ printk(KERN_ERR "%s: MII reset failed\n", dev->name); -+} -+ -+static void eth_set_duplex(struct port *port) -+{ -+ if (port->mii.full_duplex) -+ __raw_writel(DEFAULT_TX_CNTRL0 & ~TX_CNTRL0_HALFDUPLEX, -+ &port->regs->tx_control[0]); -+ else -+ __raw_writel(DEFAULT_TX_CNTRL0 | TX_CNTRL0_HALFDUPLEX, -+ &port->regs->tx_control[0]); -+} -+ -+ -+static void phy_check_media(struct port *port, int init) -+{ -+ if (mii_check_media(&port->mii, 1, init)) -+ eth_set_duplex(port); -+ if (port->mii.force_media) { /* mii_check_media() doesn't work */ -+ struct net_device *dev = port->netdev; -+ int cur_link = mii_link_ok(&port->mii); -+ int prev_link = netif_carrier_ok(dev); -+ -+ if (!prev_link && cur_link) { -+ printk(KERN_INFO "%s: link up\n", dev->name); -+ netif_carrier_on(dev); -+ } else if (prev_link && !cur_link) { -+ printk(KERN_INFO "%s: link down\n", dev->name); -+ netif_carrier_off(dev); -+ } -+ } -+} -+ -+ -+static void mdio_thread(struct work_struct *work) -+{ -+ struct port *port = container_of(work, struct port, mdio_thread.work); -+ -+ phy_check_media(port, 0); -+ schedule_delayed_work(&port->mdio_thread, MDIO_INTERVAL); -+} -+ -+ -+static inline void debug_pkt(struct net_device *dev, const char *func, -+ u8 *data, int len) -+{ -+#if DEBUG_PKT_BYTES -+ int i; -+ -+ printk(KERN_DEBUG "%s: %s(%i) ", dev->name, func, len); -+ for (i = 0; i < len; i++) { -+ if (i >= DEBUG_PKT_BYTES) -+ break; -+ printk("%s%02X", -+ ((i == 6) || (i == 12) || (i >= 14)) ? " " : "", -+ data[i]); -+ } -+ printk("\n"); -+#endif -+} -+ -+ -+static inline void debug_desc(u32 phys, struct desc *desc) -+{ -+#if DEBUG_DESC -+ printk(KERN_DEBUG "%X: %X %3X %3X %08X %2X < %2X %4X %X" -+ " %X %X %02X%02X%02X%02X%02X%02X < %02X%02X%02X%02X%02X%02X\n", -+ phys, desc->next, desc->buf_len, desc->pkt_len, -+ desc->data, desc->dest_id, desc->src_id, desc->flags, -+ desc->qos, desc->padlen, desc->vlan_tci, -+ desc->dst_mac_0, desc->dst_mac_1, desc->dst_mac_2, -+ desc->dst_mac_3, desc->dst_mac_4, desc->dst_mac_5, -+ desc->src_mac_0, desc->src_mac_1, desc->src_mac_2, -+ desc->src_mac_3, desc->src_mac_4, desc->src_mac_5); -+#endif -+} -+ -+static inline void debug_queue(unsigned int queue, int is_get, u32 phys) -+{ -+#if DEBUG_QUEUES -+ static struct { -+ int queue; -+ char *name; -+ } names[] = { -+ { TX_QUEUE(0x10), "TX#0 " }, -+ { TX_QUEUE(0x20), "TX#1 " }, -+ { TX_QUEUE(0x00), "TX#2 " }, -+ { RXFREE_QUEUE(0x10), "RX-free#0 " }, -+ { RXFREE_QUEUE(0x20), "RX-free#1 " }, -+ { RXFREE_QUEUE(0x00), "RX-free#2 " }, -+ { TXDONE_QUEUE, "TX-done " }, -+ }; -+ int i; -+ -+ for (i = 0; i < ARRAY_SIZE(names); i++) -+ if (names[i].queue == queue) -+ break; -+ -+ printk(KERN_DEBUG "Queue %i %s%s %X\n", queue, -+ i < ARRAY_SIZE(names) ? names[i].name : "", -+ is_get ? "->" : "<-", phys); -+#endif -+} -+ -+static inline u32 queue_get_entry(unsigned int queue) -+{ -+ u32 phys = qmgr_get_entry(queue); -+ debug_queue(queue, 1, phys); -+ return phys; -+} -+ -+static inline int queue_get_desc(unsigned int queue, struct port *port, -+ int is_tx) -+{ -+ u32 phys, tab_phys, n_desc; -+ struct desc *tab; -+ -+ if (!(phys = queue_get_entry(queue))) -+ return -1; -+ -+ phys &= ~0x1F; /* mask out non-address bits */ -+ tab_phys = is_tx ? tx_desc_phys(port, 0) : rx_desc_phys(port, 0); -+ tab = is_tx ? tx_desc_ptr(port, 0) : rx_desc_ptr(port, 0); -+ n_desc = (phys - tab_phys) / sizeof(struct desc); -+ BUG_ON(n_desc >= (is_tx ? TX_DESCS : RX_DESCS)); -+ debug_desc(phys, &tab[n_desc]); -+ BUG_ON(tab[n_desc].next); -+ return n_desc; -+} -+ -+static inline void queue_put_desc(unsigned int queue, u32 phys, -+ struct desc *desc) -+{ -+ debug_queue(queue, 0, phys); -+ debug_desc(phys, desc); -+ BUG_ON(phys & 0x1F); -+ qmgr_put_entry(queue, phys); -+ BUG_ON(qmgr_stat_overflow(queue)); -+} -+ -+ -+static inline void dma_unmap_tx(struct port *port, struct desc *desc) -+{ -+#ifdef __ARMEB__ -+ dma_unmap_single(&port->netdev->dev, desc->data, -+ desc->buf_len, DMA_TO_DEVICE); -+#else -+ dma_unmap_single(&port->netdev->dev, desc->data & ~3, -+ ALIGN((desc->data & 3) + desc->buf_len, 4), -+ DMA_TO_DEVICE); -+#endif -+} -+ -+ -+static void eth_rx_irq(void *pdev) -+{ -+ struct net_device *dev = pdev; -+ struct port *port = netdev_priv(dev); -+ -+#if DEBUG_RX -+ printk(KERN_DEBUG "%s: eth_rx_irq\n", dev->name); -+#endif -+ qmgr_disable_irq(port->plat->rxq); -+ netif_rx_schedule(dev, &port->napi); -+} -+ -+static int eth_poll(struct napi_struct *napi, int budget) -+{ -+ struct port *port = container_of(napi, struct port, napi); -+ struct net_device *dev = port->netdev; -+ unsigned int rxq = port->plat->rxq, rxfreeq = RXFREE_QUEUE(port->id); -+ int received = 0; -+ -+#if DEBUG_RX -+ printk(KERN_DEBUG "%s: eth_poll\n", dev->name); -+#endif -+ -+ while (received < budget) { -+ struct sk_buff *skb; -+ struct desc *desc; -+ int n; -+#ifdef __ARMEB__ -+ struct sk_buff *temp; -+ u32 phys; -+#endif -+ -+ if ((n = queue_get_desc(rxq, port, 0)) < 0) { -+ received = 0; /* No packet received */ -+#if DEBUG_RX -+ printk(KERN_DEBUG "%s: eth_poll netif_rx_complete\n", -+ dev->name); -+#endif -+ netif_rx_complete(dev, &port->napi); -+ qmgr_enable_irq(rxq); -+ if (!qmgr_stat_empty(rxq) && -+ netif_rx_reschedule(dev, &port->napi)) { -+#if DEBUG_RX -+ printk(KERN_DEBUG "%s: eth_poll" -+ " netif_rx_reschedule successed\n", -+ dev->name); -+#endif -+ qmgr_disable_irq(rxq); -+ continue; -+ } -+#if DEBUG_RX -+ printk(KERN_DEBUG "%s: eth_poll all done\n", -+ dev->name); -+#endif -+ return 0; /* all work done */ -+ } -+ -+ desc = rx_desc_ptr(port, n); -+ -+#ifdef __ARMEB__ -+ if ((skb = netdev_alloc_skb(dev, MAX_MRU)) != NULL) { -+ phys = dma_map_single(&dev->dev, skb->data, -+ MAX_MRU, DMA_FROM_DEVICE); -+ if (dma_mapping_error(phys)) { -+ dev_kfree_skb(skb); -+ skb = NULL; -+ } -+ } -+#else -+ skb = netdev_alloc_skb(dev, desc->pkt_len); -+#endif -+ -+ if (!skb) { -+ port->stat.rx_dropped++; -+ /* put the desc back on RX-ready queue */ -+ desc->buf_len = MAX_MRU; -+ desc->pkt_len = 0; -+ queue_put_desc(rxfreeq, rx_desc_phys(port, n), desc); -+ continue; -+ } -+ -+ /* process received frame */ -+#ifdef __ARMEB__ -+ temp = skb; -+ skb = port->rx_buff_tab[n]; -+ dma_unmap_single(&dev->dev, desc->data, -+ MAX_MRU, DMA_FROM_DEVICE); -+#else -+ dma_sync_single(&dev->dev, desc->data, -+ MAX_MRU, DMA_FROM_DEVICE); -+ memcpy_swab32((u32 *)skb->data, (u32 *)port->rx_buff_tab[n], -+ ALIGN(desc->pkt_len, 4) / 4); -+#endif -+ skb_put(skb, desc->pkt_len); -+ -+ debug_pkt(dev, "eth_poll", skb->data, skb->len); -+ -+ skb->protocol = eth_type_trans(skb, dev); -+ dev->last_rx = jiffies; -+ port->stat.rx_packets++; -+ port->stat.rx_bytes += skb->len; -+ netif_receive_skb(skb); -+ -+ /* put the new buffer on RX-free queue */ -+#ifdef __ARMEB__ -+ port->rx_buff_tab[n] = temp; -+ desc->data = phys; -+#endif -+ desc->buf_len = MAX_MRU; -+ desc->pkt_len = 0; -+ queue_put_desc(rxfreeq, rx_desc_phys(port, n), desc); -+ received++; -+ } -+ -+#if DEBUG_RX -+ printk(KERN_DEBUG "eth_poll(): end, not all work done\n"); -+#endif -+ return received; /* not all work done */ -+} -+ -+ -+static void eth_txdone_irq(void *unused) -+{ -+ u32 phys; -+ -+#if DEBUG_TX -+ printk(KERN_DEBUG DRV_NAME ": eth_txdone_irq\n"); -+#endif -+ while ((phys = queue_get_entry(TXDONE_QUEUE)) != 0) { -+ u32 npe_id, n_desc; -+ struct port *port; -+ struct desc *desc; -+ int start; -+ -+ npe_id = phys & 3; -+ BUG_ON(npe_id >= MAX_NPES); -+ port = npe_port_tab[npe_id]; -+ BUG_ON(!port); -+ phys &= ~0x1F; /* mask out non-address bits */ -+ n_desc = (phys - tx_desc_phys(port, 0)) / sizeof(struct desc); -+ BUG_ON(n_desc >= TX_DESCS); -+ desc = tx_desc_ptr(port, n_desc); -+ debug_desc(phys, desc); -+ -+ if (port->tx_buff_tab[n_desc]) { /* not the draining packet */ -+ port->stat.tx_packets++; -+ port->stat.tx_bytes += desc->pkt_len; -+ -+ dma_unmap_tx(port, desc); -+#if DEBUG_TX -+ printk(KERN_DEBUG "%s: eth_txdone_irq free %p\n", -+ port->netdev->name, port->tx_buff_tab[n_desc]); -+#endif -+ free_buffer_irq(port->tx_buff_tab[n_desc]); -+ port->tx_buff_tab[n_desc] = NULL; -+ } -+ -+ start = qmgr_stat_empty(port->plat->txreadyq); -+ queue_put_desc(port->plat->txreadyq, phys, desc); -+ if (start) { -+#if DEBUG_TX -+ printk(KERN_DEBUG "%s: eth_txdone_irq xmit ready\n", -+ port->netdev->name); -+#endif -+ netif_wake_queue(port->netdev); -+ } -+ } -+} -+ -+static int eth_xmit(struct sk_buff *skb, struct net_device *dev) -+{ -+ struct port *port = netdev_priv(dev); -+ unsigned int txreadyq = port->plat->txreadyq; -+ int len, offset, bytes, n; -+ void *mem; -+ u32 phys; -+ struct desc *desc; -+ -+#if DEBUG_TX -+ printk(KERN_DEBUG "%s: eth_xmit\n", dev->name); -+#endif -+ -+ if (unlikely(skb->len > MAX_MRU)) { -+ dev_kfree_skb(skb); -+ port->stat.tx_errors++; -+ return NETDEV_TX_OK; -+ } -+ -+ debug_pkt(dev, "eth_xmit", skb->data, skb->len); -+ -+ len = skb->len; -+#ifdef __ARMEB__ -+ offset = 0; /* no need to keep alignment */ -+ bytes = len; -+ mem = skb->data; -+#else -+ offset = (int)skb->data & 3; /* keep 32-bit alignment */ -+ bytes = ALIGN(offset + len, 4); -+ if (!(mem = kmalloc(bytes, GFP_ATOMIC))) { -+ dev_kfree_skb(skb); -+ port->stat.tx_dropped++; -+ return NETDEV_TX_OK; -+ } -+ memcpy_swab32(mem, (u32 *)((int)skb->data & ~3), bytes / 4); -+ dev_kfree_skb(skb); -+#endif -+ -+ phys = dma_map_single(&dev->dev, mem, bytes, DMA_TO_DEVICE); -+ if (dma_mapping_error(phys)) { -+#ifdef __ARMEB__ -+ dev_kfree_skb(skb); -+#else -+ kfree(mem); -+#endif -+ port->stat.tx_dropped++; -+ return NETDEV_TX_OK; -+ } -+ -+ n = queue_get_desc(txreadyq, port, 1); -+ BUG_ON(n < 0); -+ desc = tx_desc_ptr(port, n); -+ -+#ifdef __ARMEB__ -+ port->tx_buff_tab[n] = skb; -+#else -+ port->tx_buff_tab[n] = mem; -+#endif -+ desc->data = phys + offset; -+ desc->buf_len = desc->pkt_len = len; -+ -+ /* NPE firmware pads short frames with zeros internally */ -+ wmb(); -+ queue_put_desc(TX_QUEUE(port->id), tx_desc_phys(port, n), desc); -+ dev->trans_start = jiffies; -+ -+ if (qmgr_stat_empty(txreadyq)) { -+#if DEBUG_TX -+ printk(KERN_DEBUG "%s: eth_xmit queue full\n", dev->name); -+#endif -+ netif_stop_queue(dev); -+ /* we could miss TX ready interrupt */ -+ if (!qmgr_stat_empty(txreadyq)) { -+#if DEBUG_TX -+ printk(KERN_DEBUG "%s: eth_xmit ready again\n", -+ dev->name); -+#endif -+ netif_wake_queue(dev); -+ } -+ } -+ -+#if DEBUG_TX -+ printk(KERN_DEBUG "%s: eth_xmit end\n", dev->name); -+#endif -+ return NETDEV_TX_OK; -+} -+ -+ -+static struct net_device_stats *eth_stats(struct net_device *dev) -+{ -+ struct port *port = netdev_priv(dev); -+ return &port->stat; -+} -+ -+static void eth_set_mcast_list(struct net_device *dev) -+{ -+ struct port *port = netdev_priv(dev); -+ struct dev_mc_list *mclist = dev->mc_list; -+ u8 diffs[ETH_ALEN], *addr; -+ int cnt = dev->mc_count, i; -+ -+ if ((dev->flags & IFF_PROMISC) || !mclist || !cnt) { -+ __raw_writel(DEFAULT_RX_CNTRL0 & ~RX_CNTRL0_ADDR_FLTR_EN, -+ &port->regs->rx_control[0]); -+ return; -+ } -+ -+ memset(diffs, 0, ETH_ALEN); -+ addr = mclist->dmi_addr; /* first MAC address */ -+ -+ while (--cnt && (mclist = mclist->next)) -+ for (i = 0; i < ETH_ALEN; i++) -+ diffs[i] |= addr[i] ^ mclist->dmi_addr[i]; -+ -+ for (i = 0; i < ETH_ALEN; i++) { -+ __raw_writel(addr[i], &port->regs->mcast_addr[i]); -+ __raw_writel(~diffs[i], &port->regs->mcast_mask[i]); -+ } -+ -+ __raw_writel(DEFAULT_RX_CNTRL0 | RX_CNTRL0_ADDR_FLTR_EN, -+ &port->regs->rx_control[0]); -+} -+ -+ -+static int eth_ioctl(struct net_device *dev, struct ifreq *req, int cmd) -+{ -+ struct port *port = netdev_priv(dev); -+ unsigned int duplex_chg; -+ int err; -+ -+ if (!netif_running(dev)) -+ return -EINVAL; -+ err = generic_mii_ioctl(&port->mii, if_mii(req), cmd, &duplex_chg); -+ if (duplex_chg) -+ eth_set_duplex(port); -+ return err; -+} -+ -+ -+static int request_queues(struct port *port) -+{ -+ int err; -+ -+ err = qmgr_request_queue(RXFREE_QUEUE(port->id), RX_DESCS, 0, 0); -+ if (err) -+ return err; -+ -+ err = qmgr_request_queue(port->plat->rxq, RX_DESCS, 0, 0); -+ if (err) -+ goto rel_rxfree; -+ -+ err = qmgr_request_queue(TX_QUEUE(port->id), TX_DESCS, 0, 0); -+ if (err) -+ goto rel_rx; -+ -+ err = qmgr_request_queue(port->plat->txreadyq, TX_DESCS, 0, 0); -+ if (err) -+ goto rel_tx; -+ -+ /* TX-done queue handles skbs sent out by the NPEs */ -+ if (!ports_open) { -+ err = qmgr_request_queue(TXDONE_QUEUE, TXDONE_QUEUE_LEN, 0, 0); -+ if (err) -+ goto rel_txready; -+ } -+ return 0; -+ -+rel_txready: -+ qmgr_release_queue(port->plat->txreadyq); -+rel_tx: -+ qmgr_release_queue(TX_QUEUE(port->id)); -+rel_rx: -+ qmgr_release_queue(port->plat->rxq); -+rel_rxfree: -+ qmgr_release_queue(RXFREE_QUEUE(port->id)); -+ printk(KERN_DEBUG "%s: unable to request hardware queues\n", -+ port->netdev->name); -+ return err; -+} -+ -+static void release_queues(struct port *port) -+{ -+ qmgr_release_queue(RXFREE_QUEUE(port->id)); -+ qmgr_release_queue(port->plat->rxq); -+ qmgr_release_queue(TX_QUEUE(port->id)); -+ qmgr_release_queue(port->plat->txreadyq); -+ -+ if (!ports_open) -+ qmgr_release_queue(TXDONE_QUEUE); -+} -+ -+static int init_queues(struct port *port) -+{ -+ int i; -+ -+ if (!ports_open) -+ if (!(dma_pool = dma_pool_create(DRV_NAME, NULL, -+ POOL_ALLOC_SIZE, 32, 0))) -+ return -ENOMEM; -+ -+ if (!(port->desc_tab = dma_pool_alloc(dma_pool, GFP_KERNEL, -+ &port->desc_tab_phys))) -+ return -ENOMEM; -+ memset(port->desc_tab, 0, POOL_ALLOC_SIZE); -+ memset(port->rx_buff_tab, 0, sizeof(port->rx_buff_tab)); /* tables */ -+ memset(port->tx_buff_tab, 0, sizeof(port->tx_buff_tab)); -+ -+ /* Setup RX buffers */ -+ for (i = 0; i < RX_DESCS; i++) { -+ struct desc *desc = rx_desc_ptr(port, i); -+ buffer_t *buff; -+ void *data; -+#ifdef __ARMEB__ -+ if (!(buff = netdev_alloc_skb(port->netdev, MAX_MRU))) -+ return -ENOMEM; -+ data = buff->data; -+#else -+ if (!(buff = kmalloc(MAX_MRU, GFP_KERNEL))) -+ return -ENOMEM; -+ data = buff; -+#endif -+ desc->buf_len = MAX_MRU; -+ desc->data = dma_map_single(&port->netdev->dev, data, -+ MAX_MRU, DMA_FROM_DEVICE); -+ if (dma_mapping_error(desc->data)) { -+ free_buffer(buff); -+ return -EIO; -+ } -+ port->rx_buff_tab[i] = buff; -+ } -+ -+ return 0; -+} -+ -+static void destroy_queues(struct port *port) -+{ -+ int i; -+ -+ if (port->desc_tab) { -+ for (i = 0; i < RX_DESCS; i++) { -+ struct desc *desc = rx_desc_ptr(port, i); -+ buffer_t *buff = port->rx_buff_tab[i]; -+ if (buff) { -+ dma_unmap_single(&port->netdev->dev, -+ desc->data, MAX_MRU, -+ DMA_FROM_DEVICE); -+ free_buffer(buff); -+ } -+ } -+ for (i = 0; i < TX_DESCS; i++) { -+ struct desc *desc = tx_desc_ptr(port, i); -+ buffer_t *buff = port->tx_buff_tab[i]; -+ if (buff) { -+ dma_unmap_tx(port, desc); -+ free_buffer(buff); -+ } -+ } -+ dma_pool_free(dma_pool, port->desc_tab, port->desc_tab_phys); -+ port->desc_tab = NULL; -+ } -+ -+ if (!ports_open && dma_pool) { -+ dma_pool_destroy(dma_pool); -+ dma_pool = NULL; -+ } -+} -+ -+static int eth_open(struct net_device *dev) -+{ -+ struct port *port = netdev_priv(dev); -+ struct npe *npe = port->npe; -+ struct msg msg; -+ int i, err; -+ -+ if (!npe_running(npe)) { -+ err = npe_load_firmware(npe, npe_name(npe), &dev->dev); -+ if (err) -+ return err; -+ -+ if (npe_recv_message(npe, &msg, "ETH_GET_STATUS")) { -+ printk(KERN_ERR "%s: %s not responding\n", dev->name, -+ npe_name(npe)); -+ return -EIO; -+ } -+ } -+ -+ mdio_write(dev, port->plat->phy, MII_BMCR, port->mii_bmcr); -+ -+ memset(&msg, 0, sizeof(msg)); -+ msg.cmd = NPE_VLAN_SETRXQOSENTRY; -+ msg.eth_id = port->id; -+ msg.byte5 = port->plat->rxq | 0x80; -+ msg.byte7 = port->plat->rxq << 4; -+ for (i = 0; i < 8; i++) { -+ msg.byte3 = i; -+ if (npe_send_recv_message(port->npe, &msg, "ETH_SET_RXQ")) -+ return -EIO; -+ } -+ -+ msg.cmd = NPE_EDB_SETPORTADDRESS; -+ msg.eth_id = PHYSICAL_ID(port->id); -+ msg.byte2 = dev->dev_addr[0]; -+ msg.byte3 = dev->dev_addr[1]; -+ msg.byte4 = dev->dev_addr[2]; -+ msg.byte5 = dev->dev_addr[3]; -+ msg.byte6 = dev->dev_addr[4]; -+ msg.byte7 = dev->dev_addr[5]; -+ if (npe_send_recv_message(port->npe, &msg, "ETH_SET_MAC")) -+ return -EIO; -+ -+ memset(&msg, 0, sizeof(msg)); -+ msg.cmd = NPE_FW_SETFIREWALLMODE; -+ msg.eth_id = port->id; -+ if (npe_send_recv_message(port->npe, &msg, "ETH_SET_FIREWALL_MODE")) -+ return -EIO; -+ -+ if ((err = request_queues(port)) != 0) -+ return err; -+ -+ if ((err = init_queues(port)) != 0) { -+ destroy_queues(port); -+ release_queues(port); -+ return err; -+ } -+ -+ for (i = 0; i < ETH_ALEN; i++) -+ __raw_writel(dev->dev_addr[i], &port->regs->hw_addr[i]); -+ __raw_writel(0x08, &port->regs->random_seed); -+ __raw_writel(0x12, &port->regs->partial_empty_threshold); -+ __raw_writel(0x30, &port->regs->partial_full_threshold); -+ __raw_writel(0x08, &port->regs->tx_start_bytes); -+ __raw_writel(0x15, &port->regs->tx_deferral); -+ __raw_writel(0x08, &port->regs->tx_2part_deferral[0]); -+ __raw_writel(0x07, &port->regs->tx_2part_deferral[1]); -+ __raw_writel(0x80, &port->regs->slot_time); -+ __raw_writel(0x01, &port->regs->int_clock_threshold); -+ -+ /* Populate queues with buffers, no failure after this point */ -+ for (i = 0; i < TX_DESCS; i++) -+ queue_put_desc(port->plat->txreadyq, -+ tx_desc_phys(port, i), tx_desc_ptr(port, i)); -+ -+ for (i = 0; i < RX_DESCS; i++) -+ queue_put_desc(RXFREE_QUEUE(port->id), -+ rx_desc_phys(port, i), rx_desc_ptr(port, i)); -+ -+ __raw_writel(TX_CNTRL1_RETRIES, &port->regs->tx_control[1]); -+ __raw_writel(DEFAULT_TX_CNTRL0, &port->regs->tx_control[0]); -+ __raw_writel(0, &port->regs->rx_control[1]); -+ __raw_writel(DEFAULT_RX_CNTRL0, &port->regs->rx_control[0]); -+ -+ napi_enable(&port->napi); /* check location of this call */ -+ -+ phy_check_media(port, 1); -+ eth_set_mcast_list(dev); -+ netif_start_queue(dev); -+ schedule_delayed_work(&port->mdio_thread, MDIO_INTERVAL); -+ -+ qmgr_set_irq(port->plat->rxq, QUEUE_IRQ_SRC_NOT_EMPTY, -+ eth_rx_irq, dev); -+ if (!ports_open) { -+ qmgr_set_irq(TXDONE_QUEUE, QUEUE_IRQ_SRC_NOT_EMPTY, -+ eth_txdone_irq, NULL); -+ qmgr_enable_irq(TXDONE_QUEUE); -+ } -+ ports_open++; -+ netif_rx_schedule(dev, &port->napi); /* we may already have RX data, enables IRQ */ -+ return 0; -+} -+ -+static int eth_close(struct net_device *dev) -+{ -+ struct port *port = netdev_priv(dev); -+ struct msg msg; -+ int buffs = RX_DESCS; /* allocated RX buffers */ -+ int i; -+ -+ ports_open--; -+ qmgr_disable_irq(port->plat->rxq); -+ netif_stop_queue(dev); -+ -+ while (queue_get_desc(RXFREE_QUEUE(port->id), port, 0) >= 0) -+ buffs--; -+ -+ memset(&msg, 0, sizeof(msg)); -+ msg.cmd = NPE_SETLOOPBACK_MODE; -+ msg.eth_id = port->id; -+ msg.byte3 = 1; -+ if (npe_send_recv_message(port->npe, &msg, "ETH_ENABLE_LOOPBACK")) -+ printk(KERN_CRIT "%s: unable to enable loopback\n", dev->name); -+ -+ i = 0; -+ do { /* drain RX buffers */ -+ while (queue_get_desc(port->plat->rxq, port, 0) >= 0) -+ buffs--; -+ if (!buffs) -+ break; -+ if (qmgr_stat_empty(TX_QUEUE(port->id))) { -+ /* we have to inject some packet */ -+ struct desc *desc; -+ u32 phys; -+ int n = queue_get_desc(port->plat->txreadyq, port, 1); -+ BUG_ON(n < 0); -+ desc = tx_desc_ptr(port, n); -+ phys = tx_desc_phys(port, n); -+ desc->buf_len = desc->pkt_len = 1; -+ wmb(); -+ queue_put_desc(TX_QUEUE(port->id), phys, desc); -+ } -+ udelay(1); -+ } while (++i < MAX_CLOSE_WAIT); -+ -+ if (buffs) -+ printk(KERN_CRIT "%s: unable to drain RX queue, %i buffer(s)" -+ " left in NPE\n", dev->name, buffs); -+#if DEBUG_CLOSE -+ if (!buffs) -+ printk(KERN_DEBUG "Draining RX queue took %i cycles\n", i); -+#endif -+ -+ buffs = TX_DESCS; -+ while (queue_get_desc(TX_QUEUE(port->id), port, 1) >= 0) -+ buffs--; /* cancel TX */ -+ -+ i = 0; -+ do { -+ while (queue_get_desc(port->plat->txreadyq, port, 1) >= 0) -+ buffs--; -+ if (!buffs) -+ break; -+ } while (++i < MAX_CLOSE_WAIT); -+ -+ if (buffs) -+ printk(KERN_CRIT "%s: unable to drain TX queue, %i buffer(s) " -+ "left in NPE\n", dev->name, buffs); -+#if DEBUG_CLOSE -+ if (!buffs) -+ printk(KERN_DEBUG "Draining TX queues took %i cycles\n", i); -+#endif -+ -+ msg.byte3 = 0; -+ if (npe_send_recv_message(port->npe, &msg, "ETH_DISABLE_LOOPBACK")) -+ printk(KERN_CRIT "%s: unable to disable loopback\n", -+ dev->name); -+ -+ port->mii_bmcr = mdio_read(dev, port->plat->phy, MII_BMCR) & -+ ~(BMCR_RESET | BMCR_PDOWN); /* may have been altered */ -+ mdio_write(dev, port->plat->phy, MII_BMCR, -+ port->mii_bmcr | BMCR_PDOWN); -+ -+ if (!ports_open) -+ qmgr_disable_irq(TXDONE_QUEUE); -+ cancel_rearming_delayed_work(&port->mdio_thread); -+ napi_disable(&port->napi); -+ destroy_queues(port); -+ release_queues(port); -+ return 0; -+} -+ -+static int __devinit eth_init_one(struct platform_device *pdev) -+{ -+ struct port *port; -+ struct net_device *dev; -+ struct eth_plat_info *plat = pdev->dev.platform_data; -+ u32 regs_phys; -+ int err; -+ -+ if (!(dev = alloc_etherdev(sizeof(struct port)))) -+ return -ENOMEM; -+ -+ SET_NETDEV_DEV(dev, &pdev->dev); -+ port = netdev_priv(dev); -+ port->netdev = dev; -+ port->id = pdev->id; -+ -+ switch (port->id) { -+ case IXP4XX_ETH_NPEA: -+ port->regs = (struct eth_regs __iomem *)IXP4XX_EthA_BASE_VIRT; -+ regs_phys = IXP4XX_EthA_BASE_PHYS; -+ break; -+ case IXP4XX_ETH_NPEB: -+ port->regs = (struct eth_regs __iomem *)IXP4XX_EthB_BASE_VIRT; -+ regs_phys = IXP4XX_EthB_BASE_PHYS; -+ break; -+ case IXP4XX_ETH_NPEC: -+ port->regs = (struct eth_regs __iomem *)IXP4XX_EthC_BASE_VIRT; -+ regs_phys = IXP4XX_EthC_BASE_PHYS; -+ break; -+ default: -+ err = -ENOSYS; -+ goto err_free; -+ } -+ -+ dev->open = eth_open; -+ dev->hard_start_xmit = eth_xmit; -+ dev->stop = eth_close; -+ dev->get_stats = eth_stats; -+ dev->do_ioctl = eth_ioctl; -+ dev->set_multicast_list = eth_set_mcast_list; -+ dev->tx_queue_len = 100; -+ -+ netif_napi_add(dev, &port->napi, eth_poll, ETH_NAPI_WEIGHT); -+ -+ if (!(port->npe = npe_request(NPE_ID(port->id)))) { -+ err = -EIO; -+ goto err_free; -+ } -+ -+ if (register_netdev(dev)) { -+ err = -EIO; -+ goto err_npe_rel; -+ } -+ -+ port->mem_res = request_mem_region(regs_phys, REGS_SIZE, dev->name); -+ if (!port->mem_res) { -+ err = -EBUSY; -+ goto err_unreg; -+ } -+ -+ port->plat = plat; -+ npe_port_tab[NPE_ID(port->id)] = port; -+ memcpy(dev->dev_addr, plat->hwaddr, ETH_ALEN); -+ -+ platform_set_drvdata(pdev, dev); -+ -+ __raw_writel(DEFAULT_CORE_CNTRL | CORE_RESET, -+ &port->regs->core_control); -+ udelay(50); -+ __raw_writel(DEFAULT_CORE_CNTRL, &port->regs->core_control); -+ udelay(50); -+ -+ port->mii.dev = dev; -+ port->mii.mdio_read = mdio_read; -+ port->mii.mdio_write = mdio_write; -+ port->mii.phy_id = plat->phy; -+ port->mii.phy_id_mask = 0x1F; -+ port->mii.reg_num_mask = 0x1F; -+ -+ printk(KERN_INFO "%s: MII PHY %i on %s\n", dev->name, plat->phy, -+ npe_name(port->npe)); -+ -+ phy_reset(dev, plat->phy); -+ port->mii_bmcr = mdio_read(dev, plat->phy, MII_BMCR) & -+ ~(BMCR_RESET | BMCR_PDOWN); -+ mdio_write(dev, plat->phy, MII_BMCR, port->mii_bmcr | BMCR_PDOWN); -+ -+ INIT_DELAYED_WORK(&port->mdio_thread, mdio_thread); -+ return 0; -+ -+err_unreg: -+ unregister_netdev(dev); -+err_npe_rel: -+ npe_release(port->npe); -+err_free: -+ free_netdev(dev); -+ return err; -+} -+ -+static int __devexit eth_remove_one(struct platform_device *pdev) -+{ -+ struct net_device *dev = platform_get_drvdata(pdev); -+ struct port *port = netdev_priv(dev); -+ -+ unregister_netdev(dev); -+ npe_port_tab[NPE_ID(port->id)] = NULL; -+ platform_set_drvdata(pdev, NULL); -+ npe_release(port->npe); -+ release_resource(port->mem_res); -+ free_netdev(dev); -+ return 0; -+} -+ -+static struct platform_driver drv = { -+ .driver.name = DRV_NAME, -+ .probe = eth_init_one, -+ .remove = eth_remove_one, -+}; -+ -+static int __init eth_init_module(void) -+{ -+ if (!(ixp4xx_read_feature_bits() & IXP4XX_FEATURE_NPEB_ETH0)) -+ return -ENOSYS; -+ -+ /* All MII PHY accesses use NPE-B Ethernet registers */ -+ spin_lock_init(&mdio_lock); -+ mdio_regs = (struct eth_regs __iomem *)IXP4XX_EthB_BASE_VIRT; -+ __raw_writel(DEFAULT_CORE_CNTRL, &mdio_regs->core_control); -+ -+ return platform_driver_register(&drv); -+} -+ -+static void __exit eth_cleanup_module(void) -+{ -+ platform_driver_unregister(&drv); -+} -+ -+MODULE_AUTHOR("Krzysztof Halasa"); -+MODULE_DESCRIPTION("Intel IXP4xx Ethernet driver"); -+MODULE_LICENSE("GPL v2"); -+module_init(eth_init_module); -+module_exit(eth_cleanup_module); -Index: linux-2.6.24.7/drivers/net/wan/Kconfig -=================================================================== ---- linux-2.6.24.7.orig/drivers/net/wan/Kconfig -+++ linux-2.6.24.7/drivers/net/wan/Kconfig -@@ -334,6 +334,15 @@ config DSCC4_PCI_RST - - Say Y if your card supports this feature. - -+config IXP4XX_HSS -+ tristate "IXP4xx HSS (synchronous serial port) support" -+ depends on HDLC && ARM && ARCH_IXP4XX -+ select IXP4XX_NPE -+ select IXP4XX_QMGR -+ help -+ Say Y here if you want to use built-in HSS ports -+ on IXP4xx processor. -+ - config DLCI - tristate "Frame Relay DLCI support" - ---help--- -Index: linux-2.6.24.7/drivers/net/wan/Makefile -=================================================================== ---- linux-2.6.24.7.orig/drivers/net/wan/Makefile -+++ linux-2.6.24.7/drivers/net/wan/Makefile -@@ -42,6 +42,7 @@ obj-$(CONFIG_C101) += c101.o - obj-$(CONFIG_WANXL) += wanxl.o - obj-$(CONFIG_PCI200SYN) += pci200syn.o - obj-$(CONFIG_PC300TOO) += pc300too.o -+obj-$(CONFIG_IXP4XX_HSS) += ixp4xx_hss.o - - clean-files := wanxlfw.inc - $(obj)/wanxl.o: $(obj)/wanxlfw.inc -Index: linux-2.6.24.7/drivers/net/wan/ixp4xx_hss.c -=================================================================== ---- /dev/null -+++ linux-2.6.24.7/drivers/net/wan/ixp4xx_hss.c -@@ -0,0 +1,1270 @@ -+/* -+ * Intel IXP4xx HSS (synchronous serial port) driver for Linux -+ * -+ * Copyright (C) 2007 Krzysztof Halasa <khc@pm.waw.pl> -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of version 2 of the GNU General Public License -+ * as published by the Free Software Foundation. -+ */ -+ -+#include <linux/dma-mapping.h> -+#include <linux/dmapool.h> -+#include <linux/io.h> -+#include <linux/kernel.h> -+#include <linux/hdlc.h> -+#include <linux/platform_device.h> -+#include <asm/arch/npe.h> -+#include <asm/arch/qmgr.h> -+ -+#define DEBUG_QUEUES 0 -+#define DEBUG_DESC 0 -+#define DEBUG_RX 0 -+#define DEBUG_TX 0 -+#define DEBUG_PKT_BYTES 0 -+#define DEBUG_CLOSE 0 -+ -+#define DRV_NAME "ixp4xx_hss" -+ -+#define PKT_EXTRA_FLAGS 0 /* orig 1 */ -+#define FRAME_SYNC_OFFSET 0 /* unused, channelized only */ -+#define FRAME_SYNC_SIZE 1024 -+#define PKT_NUM_PIPES 1 /* 1, 2 or 4 */ -+#define PKT_PIPE_FIFO_SIZEW 4 /* total 4 dwords per HSS */ -+ -+#define RX_DESCS 16 /* also length of all RX queues */ -+#define TX_DESCS 16 /* also length of all TX queues */ -+ -+#define POOL_ALLOC_SIZE (sizeof(struct desc) * (RX_DESCS + TX_DESCS)) -+#define RX_SIZE (HDLC_MAX_MRU + 4) /* NPE needs more space */ -+#define MAX_CLOSE_WAIT 1000 /* microseconds */ -+ -+/* Queue IDs */ -+#define HSS0_CHL_RXTRIG_QUEUE 12 /* orig size = 32 dwords */ -+#define HSS0_PKT_RX_QUEUE 13 /* orig size = 32 dwords */ -+#define HSS0_PKT_TX0_QUEUE 14 /* orig size = 16 dwords */ -+#define HSS0_PKT_TX1_QUEUE 15 -+#define HSS0_PKT_TX2_QUEUE 16 -+#define HSS0_PKT_TX3_QUEUE 17 -+#define HSS0_PKT_RXFREE0_QUEUE 18 /* orig size = 16 dwords */ -+#define HSS0_PKT_RXFREE1_QUEUE 19 -+#define HSS0_PKT_RXFREE2_QUEUE 20 -+#define HSS0_PKT_RXFREE3_QUEUE 21 -+#define HSS0_PKT_TXDONE_QUEUE 22 /* orig size = 64 dwords */ -+ -+#define HSS1_CHL_RXTRIG_QUEUE 10 -+#define HSS1_PKT_RX_QUEUE 0 -+#define HSS1_PKT_TX0_QUEUE 5 -+#define HSS1_PKT_TX1_QUEUE 6 -+#define HSS1_PKT_TX2_QUEUE 7 -+#define HSS1_PKT_TX3_QUEUE 8 -+#define HSS1_PKT_RXFREE0_QUEUE 1 -+#define HSS1_PKT_RXFREE1_QUEUE 2 -+#define HSS1_PKT_RXFREE2_QUEUE 3 -+#define HSS1_PKT_RXFREE3_QUEUE 4 -+#define HSS1_PKT_TXDONE_QUEUE 9 -+ -+#define NPE_PKT_MODE_HDLC 0 -+#define NPE_PKT_MODE_RAW 1 -+#define NPE_PKT_MODE_56KMODE 2 -+#define NPE_PKT_MODE_56KENDIAN_MSB 4 -+ -+/* PKT_PIPE_HDLC_CFG_WRITE flags */ -+#define PKT_HDLC_IDLE_ONES 0x1 /* default = flags */ -+#define PKT_HDLC_CRC_32 0x2 /* default = CRC-16 */ -+#define PKT_HDLC_MSB_ENDIAN 0x4 /* default = LE */ -+ -+ -+/* hss_config, PCRs */ -+/* Frame sync sampling, default = active low */ -+#define PCR_FRM_SYNC_ACTIVE_HIGH 0x40000000 -+#define PCR_FRM_SYNC_FALLINGEDGE 0x80000000 -+#define PCR_FRM_SYNC_RISINGEDGE 0xC0000000 -+ -+/* Frame sync pin: input (default) or output generated off a given clk edge */ -+#define PCR_FRM_SYNC_OUTPUT_FALLING 0x20000000 -+#define PCR_FRM_SYNC_OUTPUT_RISING 0x30000000 -+ -+/* Frame and data clock sampling on edge, default = falling */ -+#define PCR_FCLK_EDGE_RISING 0x08000000 -+#define PCR_DCLK_EDGE_RISING 0x04000000 -+ -+/* Clock direction, default = input */ -+#define PCR_SYNC_CLK_DIR_OUTPUT 0x02000000 -+ -+/* Generate/Receive frame pulses, default = enabled */ -+#define PCR_FRM_PULSE_DISABLED 0x01000000 -+ -+ /* Data rate is full (default) or half the configured clk speed */ -+#define PCR_HALF_CLK_RATE 0x00200000 -+ -+/* Invert data between NPE and HSS FIFOs? (default = no) */ -+#define PCR_DATA_POLARITY_INVERT 0x00100000 -+ -+/* TX/RX endianness, default = LSB */ -+#define PCR_MSB_ENDIAN 0x00080000 -+ -+/* Normal (default) / open drain mode (TX only) */ -+#define PCR_TX_PINS_OPEN_DRAIN 0x00040000 -+ -+/* No framing bit transmitted and expected on RX? (default = framing bit) */ -+#define PCR_SOF_NO_FBIT 0x00020000 -+ -+/* Drive data pins? */ -+#define PCR_TX_DATA_ENABLE 0x00010000 -+ -+/* Voice 56k type: drive the data pins low (default), high, high Z */ -+#define PCR_TX_V56K_HIGH 0x00002000 -+#define PCR_TX_V56K_HIGH_IMP 0x00004000 -+ -+/* Unassigned type: drive the data pins low (default), high, high Z */ -+#define PCR_TX_UNASS_HIGH 0x00000800 -+#define PCR_TX_UNASS_HIGH_IMP 0x00001000 -+ -+/* T1 @ 1.544MHz only: Fbit dictated in FIFO (default) or high Z */ -+#define PCR_TX_FB_HIGH_IMP 0x00000400 -+ -+/* 56k data endiannes - which bit unused: high (default) or low */ -+#define PCR_TX_56KE_BIT_0_UNUSED 0x00000200 -+ -+/* 56k data transmission type: 32/8 bit data (default) or 56K data */ -+#define PCR_TX_56KS_56K_DATA 0x00000100 -+ -+/* hss_config, cCR */ -+/* Number of packetized clients, default = 1 */ -+#define CCR_NPE_HFIFO_2_HDLC 0x04000000 -+#define CCR_NPE_HFIFO_3_OR_4HDLC 0x08000000 -+ -+/* default = no loopback */ -+#define CCR_LOOPBACK 0x02000000 -+ -+/* HSS number, default = 0 (first) */ -+#define CCR_SECOND_HSS 0x01000000 -+ -+ -+/* hss_config, clkCR: main:10, num:10, denom:12 */ -+#define CLK42X_SPEED_EXP ((0x3FF << 22) | ( 2 << 12) | 15) /*65 KHz*/ -+ -+#define CLK42X_SPEED_512KHZ (( 130 << 22) | ( 2 << 12) | 15) -+#define CLK42X_SPEED_1536KHZ (( 43 << 22) | ( 18 << 12) | 47) -+#define CLK42X_SPEED_1544KHZ (( 43 << 22) | ( 33 << 12) | 192) -+#define CLK42X_SPEED_2048KHZ (( 32 << 22) | ( 34 << 12) | 63) -+#define CLK42X_SPEED_4096KHZ (( 16 << 22) | ( 34 << 12) | 127) -+#define CLK42X_SPEED_8192KHZ (( 8 << 22) | ( 34 << 12) | 255) -+ -+#define CLK46X_SPEED_512KHZ (( 130 << 22) | ( 24 << 12) | 127) -+#define CLK46X_SPEED_1536KHZ (( 43 << 22) | (152 << 12) | 383) -+#define CLK46X_SPEED_1544KHZ (( 43 << 22) | ( 66 << 12) | 385) -+#define CLK46X_SPEED_2048KHZ (( 32 << 22) | (280 << 12) | 511) -+#define CLK46X_SPEED_4096KHZ (( 16 << 22) | (280 << 12) | 1023) -+#define CLK46X_SPEED_8192KHZ (( 8 << 22) | (280 << 12) | 2047) -+ -+ -+/* hss_config, LUT entries */ -+#define TDMMAP_UNASSIGNED 0 -+#define TDMMAP_HDLC 1 /* HDLC - packetized */ -+#define TDMMAP_VOICE56K 2 /* Voice56K - 7-bit channelized */ -+#define TDMMAP_VOICE64K 3 /* Voice64K - 8-bit channelized */ -+ -+#define TIMESLOTS 128 -+#define LUT_BITS 2 -+ -+/* offsets into HSS config */ -+#define HSS_CONFIG_TX_PCR 0x00 -+#define HSS_CONFIG_RX_PCR 0x04 -+#define HSS_CONFIG_CORE_CR 0x08 -+#define HSS_CONFIG_CLOCK_CR 0x0C -+#define HSS_CONFIG_TX_FCR 0x10 -+#define HSS_CONFIG_RX_FCR 0x14 -+#define HSS_CONFIG_TX_LUT 0x18 -+#define HSS_CONFIG_RX_LUT 0x38 -+ -+ -+/* NPE command codes */ -+/* writes the ConfigWord value to the location specified by offset */ -+#define PORT_CONFIG_WRITE 0x40 -+ -+/* triggers the NPE to load the contents of the configuration table */ -+#define PORT_CONFIG_LOAD 0x41 -+ -+/* triggers the NPE to return an HssErrorReadResponse message */ -+#define PORT_ERROR_READ 0x42 -+ -+/* reset NPE internal status and enable the HssChannelized operation */ -+#define CHAN_FLOW_ENABLE 0x43 -+#define CHAN_FLOW_DISABLE 0x44 -+#define CHAN_IDLE_PATTERN_WRITE 0x45 -+#define CHAN_NUM_CHANS_WRITE 0x46 -+#define CHAN_RX_BUF_ADDR_WRITE 0x47 -+#define CHAN_RX_BUF_CFG_WRITE 0x48 -+#define CHAN_TX_BLK_CFG_WRITE 0x49 -+#define CHAN_TX_BUF_ADDR_WRITE 0x4A -+#define CHAN_TX_BUF_SIZE_WRITE 0x4B -+#define CHAN_TSLOTSWITCH_ENABLE 0x4C -+#define CHAN_TSLOTSWITCH_DISABLE 0x4D -+ -+/* downloads the gainWord value for a timeslot switching channel associated -+ with bypassNum */ -+#define CHAN_TSLOTSWITCH_GCT_DOWNLOAD 0x4E -+ -+/* triggers the NPE to reset internal status and enable the HssPacketized -+ operation for the flow specified by pPipe */ -+#define PKT_PIPE_FLOW_ENABLE 0x50 -+#define PKT_PIPE_FLOW_DISABLE 0x51 -+#define PKT_NUM_PIPES_WRITE 0x52 -+#define PKT_PIPE_FIFO_SIZEW_WRITE 0x53 -+#define PKT_PIPE_HDLC_CFG_WRITE 0x54 -+#define PKT_PIPE_IDLE_PATTERN_WRITE 0x55 -+#define PKT_PIPE_RX_SIZE_WRITE 0x56 -+#define PKT_PIPE_MODE_WRITE 0x57 -+ -+/* HDLC packet status values - desc->status */ -+#define ERR_SHUTDOWN 1 /* stop or shutdown occurrance */ -+#define ERR_HDLC_ALIGN 2 /* HDLC alignment error */ -+#define ERR_HDLC_FCS 3 /* HDLC Frame Check Sum error */ -+#define ERR_RXFREE_Q_EMPTY 4 /* RX-free queue became empty while receiving -+ this packet (if buf_len < pkt_len) */ -+#define ERR_HDLC_TOO_LONG 5 /* HDLC frame size too long */ -+#define ERR_HDLC_ABORT 6 /* abort sequence received */ -+#define ERR_DISCONNECTING 7 /* disconnect is in progress */ -+ -+ -+#ifdef __ARMEB__ -+typedef struct sk_buff buffer_t; -+#define free_buffer dev_kfree_skb -+#define free_buffer_irq dev_kfree_skb_irq -+#else -+typedef void buffer_t; -+#define free_buffer kfree -+#define free_buffer_irq kfree -+#endif -+ -+struct port { -+ struct npe *npe; -+ struct net_device *netdev; -+ struct hss_plat_info *plat; -+ buffer_t *rx_buff_tab[RX_DESCS], *tx_buff_tab[TX_DESCS]; -+ struct desc *desc_tab; /* coherent */ -+ u32 desc_tab_phys; -+ int id; -+ unsigned int clock_type, clock_rate, loopback; -+ u8 hdlc_cfg; -+}; -+ -+/* NPE message structure */ -+struct msg { -+#ifdef __ARMEB__ -+ u8 cmd, unused, hss_port, index; -+ union { -+ struct { u8 data8a, data8b, data8c, data8d; }; -+ struct { u16 data16a, data16b; }; -+ struct { u32 data32; }; -+ }; -+#else -+ u8 index, hss_port, unused, cmd; -+ union { -+ struct { u8 data8d, data8c, data8b, data8a; }; -+ struct { u16 data16b, data16a; }; -+ struct { u32 data32; }; -+ }; -+#endif -+}; -+ -+/* HDLC packet descriptor */ -+struct desc { -+ u32 next; /* pointer to next buffer, unused */ -+ -+#ifdef __ARMEB__ -+ u16 buf_len; /* buffer length */ -+ u16 pkt_len; /* packet length */ -+ u32 data; /* pointer to data buffer in RAM */ -+ u8 status; -+ u8 error_count; -+ u16 __reserved; -+#else -+ u16 pkt_len; /* packet length */ -+ u16 buf_len; /* buffer length */ -+ u32 data; /* pointer to data buffer in RAM */ -+ u16 __reserved; -+ u8 error_count; -+ u8 status; -+#endif -+ u32 __reserved1[4]; -+}; -+ -+ -+#define rx_desc_phys(port, n) ((port)->desc_tab_phys + \ -+ (n) * sizeof(struct desc)) -+#define rx_desc_ptr(port, n) (&(port)->desc_tab[n]) -+ -+#define tx_desc_phys(port, n) ((port)->desc_tab_phys + \ -+ ((n) + RX_DESCS) * sizeof(struct desc)) -+#define tx_desc_ptr(port, n) (&(port)->desc_tab[(n) + RX_DESCS]) -+ -+/***************************************************************************** -+ * global variables -+ ****************************************************************************/ -+ -+static int ports_open; -+static struct dma_pool *dma_pool; -+ -+static const struct { -+ int tx, txdone, rx, rxfree; -+}queue_ids[2] = {{ HSS0_PKT_TX0_QUEUE, HSS0_PKT_TXDONE_QUEUE, -+ HSS0_PKT_RX_QUEUE, HSS0_PKT_RXFREE0_QUEUE }, -+ { HSS1_PKT_TX0_QUEUE, HSS1_PKT_TXDONE_QUEUE, -+ HSS1_PKT_RX_QUEUE, HSS1_PKT_RXFREE0_QUEUE }, -+}; -+ -+/***************************************************************************** -+ * utility functions -+ ****************************************************************************/ -+ -+static inline struct port* dev_to_port(struct net_device *dev) -+{ -+ return dev_to_hdlc(dev)->priv; -+} -+ -+#ifndef __ARMEB__ -+static inline void memcpy_swab32(u32 *dest, u32 *src, int cnt) -+{ -+ int i; -+ for (i = 0; i < cnt; i++) -+ dest[i] = swab32(src[i]); -+} -+#endif -+ -+static inline void debug_pkt(struct net_device *dev, const char *func, -+ u8 *data, int len) -+{ -+#if DEBUG_PKT_BYTES -+ int i; -+ -+ printk(KERN_DEBUG "%s: %s(%i) ", dev->name, func, len); -+ for (i = 0; i < len; i++) { -+ if (i >= DEBUG_PKT_BYTES) -+ break; -+ printk("%s%02X", !(i % 4) ? " " : "", data[i]); -+ } -+ printk("\n"); -+#endif -+} -+ -+ -+static inline void debug_desc(u32 phys, struct desc *desc) -+{ -+#if DEBUG_DESC -+ printk(KERN_DEBUG "%X: %X %3X %3X %08X %X %X\n", -+ phys, desc->next, desc->buf_len, desc->pkt_len, -+ desc->data, desc->status, desc->error_count); -+#endif -+} -+ -+static inline void debug_queue(unsigned int queue, int is_get, u32 phys) -+{ -+#if DEBUG_QUEUES -+ static struct { -+ int queue; -+ char *name; -+ } names[] = { -+ { HSS0_PKT_TX0_QUEUE, "TX#0 " }, -+ { HSS0_PKT_TXDONE_QUEUE, "TX-done#0 " }, -+ { HSS0_PKT_RX_QUEUE, "RX#0 " }, -+ { HSS0_PKT_RXFREE0_QUEUE, "RX-free#0 " }, -+ { HSS1_PKT_TX0_QUEUE, "TX#1 " }, -+ { HSS1_PKT_TXDONE_QUEUE, "TX-done#1 " }, -+ { HSS1_PKT_RX_QUEUE, "RX#1 " }, -+ { HSS1_PKT_RXFREE0_QUEUE, "RX-free#1 " }, -+ }; -+ int i; -+ -+ for (i = 0; i < ARRAY_SIZE(names); i++) -+ if (names[i].queue == queue) -+ break; -+ -+ printk(KERN_DEBUG "Queue %i %s%s %X\n", queue, -+ i < ARRAY_SIZE(names) ? names[i].name : "", -+ is_get ? "->" : "<-", phys); -+#endif -+} -+ -+static inline u32 queue_get_entry(unsigned int queue) -+{ -+ u32 phys = qmgr_get_entry(queue); -+ debug_queue(queue, 1, phys); -+ return phys; -+} -+ -+static inline int queue_get_desc(unsigned int queue, struct port *port, -+ int is_tx) -+{ -+ u32 phys, tab_phys, n_desc; -+ struct desc *tab; -+ -+ if (!(phys = queue_get_entry(queue))) -+ return -1; -+ -+ BUG_ON(phys & 0x1F); -+ tab_phys = is_tx ? tx_desc_phys(port, 0) : rx_desc_phys(port, 0); -+ tab = is_tx ? tx_desc_ptr(port, 0) : rx_desc_ptr(port, 0); -+ n_desc = (phys - tab_phys) / sizeof(struct desc); -+ BUG_ON(n_desc >= (is_tx ? TX_DESCS : RX_DESCS)); -+ debug_desc(phys, &tab[n_desc]); -+ BUG_ON(tab[n_desc].next); -+ return n_desc; -+} -+ -+static inline void queue_put_desc(unsigned int queue, u32 phys, -+ struct desc *desc) -+{ -+ debug_queue(queue, 0, phys); -+ debug_desc(phys, desc); -+ BUG_ON(phys & 0x1F); -+ qmgr_put_entry(queue, phys); -+ BUG_ON(qmgr_stat_overflow(queue)); -+} -+ -+ -+static inline void dma_unmap_tx(struct port *port, struct desc *desc) -+{ -+#ifdef __ARMEB__ -+ dma_unmap_single(&port->netdev->dev, desc->data, -+ desc->buf_len, DMA_TO_DEVICE); -+#else -+ dma_unmap_single(&port->netdev->dev, desc->data & ~3, -+ ALIGN((desc->data & 3) + desc->buf_len, 4), -+ DMA_TO_DEVICE); -+#endif -+} -+ -+ -+static void hss_hdlc_set_carrier(void *pdev, int carrier) -+{ -+ struct net_device *dev = pdev; -+ if (carrier) -+ netif_carrier_on(dev); -+ else -+ netif_carrier_off(dev); -+} -+ -+static void hss_hdlc_rx_irq(void *pdev) -+{ -+ struct net_device *dev = pdev; -+ struct port *port = dev_to_port(dev); -+ -+#if DEBUG_RX -+ printk(KERN_DEBUG "%s: hss_hdlc_rx_irq\n", dev->name); -+#endif -+ qmgr_disable_irq(queue_ids[port->id].rx); -+ netif_rx_schedule(dev); -+} -+ -+static int hss_hdlc_poll(struct net_device *dev, int *budget) -+{ -+ struct port *port = dev_to_port(dev); -+ unsigned int rxq = queue_ids[port->id].rx; -+ unsigned int rxfreeq = queue_ids[port->id].rxfree; -+ struct net_device_stats *stats = hdlc_stats(dev); -+ int quota = dev->quota, received = 0; -+ -+#if DEBUG_RX -+ printk(KERN_DEBUG "%s: hss_hdlc_poll\n", dev->name); -+#endif -+ -+ while (quota) { -+ struct sk_buff *skb; -+ struct desc *desc; -+ int n; -+#ifdef __ARMEB__ -+ struct sk_buff *temp; -+ u32 phys; -+#endif -+ -+ if ((n = queue_get_desc(rxq, port, 0)) < 0) { -+ dev->quota -= received; /* No packet received */ -+ *budget -= received; -+ received = 0; -+#if DEBUG_RX -+ printk(KERN_DEBUG "%s: hss_hdlc_poll" -+ " netif_rx_complete\n", dev->name); -+#endif -+ netif_rx_complete(dev); -+ qmgr_enable_irq(rxq); -+ if (!qmgr_stat_empty(rxq) && -+ netif_rx_reschedule(dev, 0)) { -+#if DEBUG_RX -+ printk(KERN_DEBUG "%s: hss_hdlc_poll" -+ " netif_rx_reschedule successed\n", -+ dev->name); -+#endif -+ qmgr_disable_irq(rxq); -+ continue; -+ } -+#if DEBUG_RX -+ printk(KERN_DEBUG "%s: hss_hdlc_poll all done\n", -+ dev->name); -+#endif -+ return 0; /* all work done */ -+ } -+ -+ desc = rx_desc_ptr(port, n); -+ -+ if (desc->error_count) /* FIXME - remove printk */ -+ printk(KERN_DEBUG "%s: hss_hdlc_poll status 0x%02X" -+ " errors %u\n", dev->name, desc->status, -+ desc->error_count); -+ -+ skb = NULL; -+ switch (desc->status) { -+ case 0: -+#ifdef __ARMEB__ -+ if ((skb = netdev_alloc_skb(dev, RX_SIZE)) != NULL) { -+ phys = dma_map_single(&dev->dev, skb->data, -+ RX_SIZE, -+ DMA_FROM_DEVICE); -+ if (dma_mapping_error(phys)) { -+ dev_kfree_skb(skb); -+ skb = NULL; -+ } -+ } -+#else -+ skb = netdev_alloc_skb(dev, desc->pkt_len); -+#endif -+ if (!skb) -+ stats->rx_dropped++; -+ break; -+ case ERR_HDLC_ALIGN: -+ case ERR_HDLC_ABORT: -+ stats->rx_frame_errors++; -+ stats->rx_errors++; -+ break; -+ case ERR_HDLC_FCS: -+ stats->rx_crc_errors++; -+ stats->rx_errors++; -+ break; -+ case ERR_HDLC_TOO_LONG: -+ stats->rx_length_errors++; -+ stats->rx_errors++; -+ break; -+ default: /* FIXME - remove printk */ -+ printk(KERN_ERR "%s: hss_hdlc_poll: status 0x%02X" -+ " errors %u\n", dev->name, desc->status, -+ desc->error_count); -+ stats->rx_errors++; -+ } -+ -+ if (!skb) { -+ /* put the desc back on RX-ready queue */ -+ desc->buf_len = RX_SIZE; -+ desc->pkt_len = desc->status = 0; -+ queue_put_desc(rxfreeq, rx_desc_phys(port, n), desc); -+ continue; -+ } -+ -+ /* process received frame */ -+#ifdef __ARMEB__ -+ temp = skb; -+ skb = port->rx_buff_tab[n]; -+ dma_unmap_single(&dev->dev, desc->data, -+ RX_SIZE, DMA_FROM_DEVICE); -+#else -+ dma_sync_single(&dev->dev, desc->data, -+ RX_SIZE, DMA_FROM_DEVICE); -+ memcpy_swab32((u32 *)skb->data, (u32 *)port->rx_buff_tab[n], -+ ALIGN(desc->pkt_len, 4) / 4); -+#endif -+ skb_put(skb, desc->pkt_len); -+ -+ debug_pkt(dev, "hss_hdlc_poll", skb->data, skb->len); -+ -+ skb->protocol = hdlc_type_trans(skb, dev); -+ dev->last_rx = jiffies; -+ stats->rx_packets++; -+ stats->rx_bytes += skb->len; -+ netif_receive_skb(skb); -+ -+ /* put the new buffer on RX-free queue */ -+#ifdef __ARMEB__ -+ port->rx_buff_tab[n] = temp; -+ desc->data = phys; -+#endif -+ desc->buf_len = RX_SIZE; -+ desc->pkt_len = 0; -+ queue_put_desc(rxfreeq, rx_desc_phys(port, n), desc); -+ quota--; -+ received++; -+ } -+ dev->quota -= received; -+ *budget -= received; -+#if DEBUG_RX -+ printk(KERN_DEBUG "hss_hdlc_poll: end, not all work done\n"); -+#endif -+ return 1; /* not all work done */ -+} -+ -+ -+static void hss_hdlc_txdone_irq(void *pdev) -+{ -+ struct net_device *dev = pdev; -+ struct port *port = dev_to_port(dev); -+ struct net_device_stats *stats = hdlc_stats(dev); -+ int n_desc; -+ -+#if DEBUG_TX -+ printk(KERN_DEBUG DRV_NAME ": hss_hdlc_txdone_irq\n"); -+#endif -+ while ((n_desc = queue_get_desc(queue_ids[port->id].txdone, -+ port, 1)) >= 0) { -+ struct desc *desc; -+ int start; -+ -+ desc = tx_desc_ptr(port, n_desc); -+ -+ stats->tx_packets++; -+ stats->tx_bytes += desc->pkt_len; -+ -+ dma_unmap_tx(port, desc); -+#if DEBUG_TX -+ printk(KERN_DEBUG "%s: hss_hdlc_txdone_irq free %p\n", -+ port->netdev->name, port->tx_buff_tab[n_desc]); -+#endif -+ free_buffer_irq(port->tx_buff_tab[n_desc]); -+ port->tx_buff_tab[n_desc] = NULL; -+ -+ start = qmgr_stat_empty(port->plat->txreadyq); -+ queue_put_desc(port->plat->txreadyq, -+ tx_desc_phys(port, n_desc), desc); -+ if (start) { -+#if DEBUG_TX -+ printk(KERN_DEBUG "%s: hss_hdlc_txdone_irq xmit" -+ " ready\n", port->netdev->name); -+#endif -+ netif_wake_queue(port->netdev); -+ } -+ } -+} -+ -+static int hss_hdlc_xmit(struct sk_buff *skb, struct net_device *dev) -+{ -+ struct port *port = dev_to_port(dev); -+ struct net_device_stats *stats = hdlc_stats(dev); -+ unsigned int txreadyq = port->plat->txreadyq; -+ int len, offset, bytes, n; -+ void *mem; -+ u32 phys; -+ struct desc *desc; -+ -+#if DEBUG_TX -+ printk(KERN_DEBUG "%s: hss_hdlc_xmit\n", dev->name); -+#endif -+ -+ if (unlikely(skb->len > HDLC_MAX_MRU)) { -+ dev_kfree_skb(skb); -+ stats->tx_errors++; -+ return NETDEV_TX_OK; -+ } -+ -+ debug_pkt(dev, "hss_hdlc_xmit", skb->data, skb->len); -+ -+ len = skb->len; -+#ifdef __ARMEB__ -+ offset = 0; /* no need to keep alignment */ -+ bytes = len; -+ mem = skb->data; -+#else -+ offset = (int)skb->data & 3; /* keep 32-bit alignment */ -+ bytes = ALIGN(offset + len, 4); -+ if (!(mem = kmalloc(bytes, GFP_ATOMIC))) { -+ dev_kfree_skb(skb); -+ stats->tx_dropped++; -+ return NETDEV_TX_OK; -+ } -+ memcpy_swab32(mem, (u32 *)((int)skb->data & ~3), bytes / 4); -+ dev_kfree_skb(skb); -+#endif -+ -+ phys = dma_map_single(&dev->dev, mem, bytes, DMA_TO_DEVICE); -+ if (dma_mapping_error(phys)) { -+#ifdef __ARMEB__ -+ dev_kfree_skb(skb); -+#else -+ kfree(mem); -+#endif -+ stats->tx_dropped++; -+ return NETDEV_TX_OK; -+ } -+ -+ n = queue_get_desc(txreadyq, port, 1); -+ BUG_ON(n < 0); -+ desc = tx_desc_ptr(port, n); -+ -+#ifdef __ARMEB__ -+ port->tx_buff_tab[n] = skb; -+#else -+ port->tx_buff_tab[n] = mem; -+#endif -+ desc->data = phys + offset; -+ desc->buf_len = desc->pkt_len = len; -+ -+ wmb(); -+ queue_put_desc(queue_ids[port->id].tx, tx_desc_phys(port, n), desc); -+ dev->trans_start = jiffies; -+ -+ if (qmgr_stat_empty(txreadyq)) { -+#if DEBUG_TX -+ printk(KERN_DEBUG "%s: hss_hdlc_xmit queue full\n", dev->name); -+#endif -+ netif_stop_queue(dev); -+ /* we could miss TX ready interrupt */ -+ if (!qmgr_stat_empty(txreadyq)) { -+#if DEBUG_TX -+ printk(KERN_DEBUG "%s: hss_hdlc_xmit ready again\n", -+ dev->name); -+#endif -+ netif_wake_queue(dev); -+ } -+ } -+ -+#if DEBUG_TX -+ printk(KERN_DEBUG "%s: hss_hdlc_xmit end\n", dev->name); -+#endif -+ return NETDEV_TX_OK; -+} -+ -+ -+static int request_hdlc_queues(struct port *port) -+{ -+ int err; -+ -+ err = qmgr_request_queue(queue_ids[port->id].rxfree, RX_DESCS, 0, 0); -+ if (err) -+ return err; -+ -+ err = qmgr_request_queue(queue_ids[port->id].rx, RX_DESCS, 0, 0); -+ if (err) -+ goto rel_rxfree; -+ -+ err = qmgr_request_queue(queue_ids[port->id].tx, TX_DESCS, 0, 0); -+ if (err) -+ goto rel_rx; -+ -+ err = qmgr_request_queue(port->plat->txreadyq, TX_DESCS, 0, 0); -+ if (err) -+ goto rel_tx; -+ -+ err = qmgr_request_queue(queue_ids[port->id].txdone, TX_DESCS, 0, 0); -+ if (err) -+ goto rel_txready; -+ return 0; -+ -+rel_txready: -+ qmgr_release_queue(port->plat->txreadyq); -+rel_tx: -+ qmgr_release_queue(queue_ids[port->id].tx); -+rel_rx: -+ qmgr_release_queue(queue_ids[port->id].rx); -+rel_rxfree: -+ qmgr_release_queue(queue_ids[port->id].rxfree); -+ printk(KERN_DEBUG "%s: unable to request hardware queues\n", -+ port->netdev->name); -+ return err; -+} -+ -+static void release_hdlc_queues(struct port *port) -+{ -+ qmgr_release_queue(queue_ids[port->id].rxfree); -+ qmgr_release_queue(queue_ids[port->id].rx); -+ qmgr_release_queue(queue_ids[port->id].txdone); -+ qmgr_release_queue(queue_ids[port->id].tx); -+ qmgr_release_queue(port->plat->txreadyq); -+} -+ -+static int init_hdlc_queues(struct port *port) -+{ -+ int i; -+ -+ if (!ports_open) -+ if (!(dma_pool = dma_pool_create(DRV_NAME, NULL, -+ POOL_ALLOC_SIZE, 32, 0))) -+ return -ENOMEM; -+ -+ if (!(port->desc_tab = dma_pool_alloc(dma_pool, GFP_KERNEL, -+ &port->desc_tab_phys))) -+ return -ENOMEM; -+ memset(port->desc_tab, 0, POOL_ALLOC_SIZE); -+ memset(port->rx_buff_tab, 0, sizeof(port->rx_buff_tab)); /* tables */ -+ memset(port->tx_buff_tab, 0, sizeof(port->tx_buff_tab)); -+ -+ /* Setup RX buffers */ -+ for (i = 0; i < RX_DESCS; i++) { -+ struct desc *desc = rx_desc_ptr(port, i); -+ buffer_t *buff; -+ void *data; -+#ifdef __ARMEB__ -+ if (!(buff = netdev_alloc_skb(port->netdev, RX_SIZE))) -+ return -ENOMEM; -+ data = buff->data; -+#else -+ if (!(buff = kmalloc(RX_SIZE, GFP_KERNEL))) -+ return -ENOMEM; -+ data = buff; -+#endif -+ desc->buf_len = RX_SIZE; -+ desc->data = dma_map_single(&port->netdev->dev, data, -+ RX_SIZE, DMA_FROM_DEVICE); -+ if (dma_mapping_error(desc->data)) { -+ free_buffer(buff); -+ return -EIO; -+ } -+ port->rx_buff_tab[i] = buff; -+ } -+ -+ return 0; -+} -+ -+static void destroy_hdlc_queues(struct port *port) -+{ -+ int i; -+ -+ if (port->desc_tab) { -+ for (i = 0; i < RX_DESCS; i++) { -+ struct desc *desc = rx_desc_ptr(port, i); -+ buffer_t *buff = port->rx_buff_tab[i]; -+ if (buff) { -+ dma_unmap_single(&port->netdev->dev, -+ desc->data, RX_SIZE, -+ DMA_FROM_DEVICE); -+ free_buffer(buff); -+ } -+ } -+ for (i = 0; i < TX_DESCS; i++) { -+ struct desc *desc = tx_desc_ptr(port, i); -+ buffer_t *buff = port->tx_buff_tab[i]; -+ if (buff) { -+ dma_unmap_tx(port, desc); -+ free_buffer(buff); -+ } -+ } -+ dma_pool_free(dma_pool, port->desc_tab, port->desc_tab_phys); -+ port->desc_tab = NULL; -+ } -+ -+ if (!ports_open && dma_pool) { -+ dma_pool_destroy(dma_pool); -+ dma_pool = NULL; -+ } -+} -+ -+static int hss_hdlc_open(struct net_device *dev) -+{ -+ struct port *port = dev_to_port(dev); -+ struct npe *npe = port->npe; -+ struct msg msg; -+ int i, err; -+ -+ if (!npe_running(npe)) { -+ err = npe_load_firmware(npe, npe_name(npe), &dev->dev); -+ if (err) -+ return err; -+ } -+ -+ if ((err = hdlc_open(dev)) != 0) -+ return err; -+ -+ if (port->plat->open) -+ if ((err = port->plat->open(port->id, port->netdev, -+ hss_hdlc_set_carrier)) != 0) -+ goto err_hdlc_close; -+ -+ /* HSS main configuration */ -+ memset(&msg, 0, sizeof(msg)); -+ msg.cmd = PORT_CONFIG_WRITE; -+ msg.hss_port = port->id; -+ msg.index = 0; /* offset in HSS config */ -+ -+ msg.data32 = PCR_FRM_PULSE_DISABLED | -+ PCR_SOF_NO_FBIT | -+ PCR_MSB_ENDIAN | -+ PCR_TX_DATA_ENABLE; -+ -+ if (port->clock_type == CLOCK_INT) -+ msg.data32 |= PCR_SYNC_CLK_DIR_OUTPUT; -+ -+ if ((err = npe_send_message(npe, &msg, "HSS_SET_TX_PCR") != 0)) -+ goto err_plat_close; /* 0: TX PCR */ -+ -+ msg.index = 4; -+ msg.data32 ^= PCR_TX_DATA_ENABLE | PCR_DCLK_EDGE_RISING; -+ if ((err = npe_send_message(npe, &msg, "HSS_SET_RX_PCR") != 0)) -+ goto err_plat_close; /* 4: RX PCR */ -+ -+ msg.index = 8; -+ msg.data32 = (port->loopback ? CCR_LOOPBACK : 0) | -+ (port->id ? CCR_SECOND_HSS : 0); -+ if ((err = npe_send_message(npe, &msg, "HSS_SET_CORE_CR") != 0)) -+ goto err_plat_close; /* 8: Core CR */ -+ -+ msg.index = 12; -+ msg.data32 = CLK42X_SPEED_2048KHZ /* FIXME */; -+ if ((err = npe_send_message(npe, &msg, "HSS_SET_CLK_CR") != 0)) -+ goto err_plat_close; /* 12: CLK CR */ -+ -+ msg.data32 = (FRAME_SYNC_OFFSET << 16) | (FRAME_SYNC_SIZE - 1); -+ msg.index = 16; -+ if ((err = npe_send_message(npe, &msg, "HSS_SET_TX_FCR") != 0)) -+ goto err_plat_close; /* 16: TX FCR */ -+ -+ msg.index = 20; -+ if ((err = npe_send_message(npe, &msg, "HSS_SET_RX_FCR") != 0)) -+ goto err_plat_close; /* 20: RX FCR */ -+ -+ msg.data32 = 0; /* Fill LUT with HDLC timeslots */ -+ for (i = 0; i < 32 / LUT_BITS; i++) -+ msg.data32 |= TDMMAP_HDLC << (LUT_BITS * i); -+ -+ for (i = 0; i < 2 /* TX and RX */ * TIMESLOTS * LUT_BITS / 8; i += 4) { -+ msg.index = 24 + i; /* 24 - 55: TX LUT, 56 - 87: RX LUT */ -+ if ((err = npe_send_message(npe, &msg, "HSS_SET_LUT") != 0)) -+ goto err_plat_close; -+ } -+ -+ /* HDLC mode configuration */ -+ memset(&msg, 0, sizeof(msg)); -+ msg.cmd = PKT_NUM_PIPES_WRITE; -+ msg.hss_port = port->id; -+ msg.data8a = PKT_NUM_PIPES; -+ if ((err = npe_send_message(npe, &msg, "HSS_SET_PKT_PIPES") != 0)) -+ goto err_plat_close; -+ -+ memset(&msg, 0, sizeof(msg)); -+ msg.cmd = PKT_PIPE_FIFO_SIZEW_WRITE; -+ msg.hss_port = port->id; -+ msg.data8a = PKT_PIPE_FIFO_SIZEW; -+ if ((err = npe_send_message(npe, &msg, "HSS_SET_PKT_FIFO") != 0)) -+ goto err_plat_close; -+ -+ memset(&msg, 0, sizeof(msg)); -+ msg.cmd = PKT_PIPE_IDLE_PATTERN_WRITE; -+ msg.hss_port = port->id; -+ msg.data32 = 0x7F7F7F7F; -+ if ((err = npe_send_message(npe, &msg, "HSS_SET_PKT_IDLE") != 0)) -+ goto err_plat_close; -+ -+ memset(&msg, 0, sizeof(msg)); -+ msg.cmd = PORT_CONFIG_LOAD; -+ msg.hss_port = port->id; -+ if ((err = npe_send_message(npe, &msg, "HSS_LOAD_CONFIG") != 0)) -+ goto err_plat_close; -+ if ((err = npe_recv_message(npe, &msg, "HSS_LOAD_CONFIG") != 0)) -+ goto err_plat_close; -+ -+ /* HSS_LOAD_CONFIG for port #1 returns port_id = #4 */ -+ if (msg.cmd != PORT_CONFIG_LOAD || msg.data32) { -+ printk(KERN_DEBUG "%s: unexpected message received in" -+ " response to HSS_LOAD_CONFIG\n", npe_name(npe)); -+ err = EIO; -+ goto err_plat_close; -+ } -+ -+ memset(&msg, 0, sizeof(msg)); -+ msg.cmd = PKT_PIPE_HDLC_CFG_WRITE; -+ msg.hss_port = port->id; -+ msg.data8a = port->hdlc_cfg; /* rx_cfg */ -+ msg.data8b = port->hdlc_cfg | (PKT_EXTRA_FLAGS << 3); /* tx_cfg */ -+ if ((err = npe_send_message(npe, &msg, "HSS_SET_HDLC_CFG") != 0)) -+ goto err_plat_close; -+ -+ memset(&msg, 0, sizeof(msg)); -+ msg.cmd = PKT_PIPE_MODE_WRITE; -+ msg.hss_port = port->id; -+ msg.data8a = NPE_PKT_MODE_HDLC; -+ /* msg.data8b = inv_mask */ -+ /* msg.data8c = or_mask */ -+ if ((err = npe_send_message(npe, &msg, "HSS_SET_PKT_MODE") != 0)) -+ goto err_plat_close; -+ -+ memset(&msg, 0, sizeof(msg)); -+ msg.cmd = PKT_PIPE_RX_SIZE_WRITE; -+ msg.hss_port = port->id; -+ msg.data16a = HDLC_MAX_MRU; -+ if ((err = npe_send_message(npe, &msg, "HSS_SET_PKT_RX_SIZE") != 0)) -+ goto err_plat_close; -+ -+ if ((err = request_hdlc_queues(port)) != 0) -+ goto err_plat_close; -+ -+ if ((err = init_hdlc_queues(port)) != 0) -+ goto err_destroy_queues; -+ -+ memset(&msg, 0, sizeof(msg)); -+ msg.cmd = PKT_PIPE_FLOW_ENABLE; -+ msg.hss_port = port->id; -+ if ((err = npe_send_message(npe, &msg, "HSS_ENABLE_PKT_PIPE") != 0)) -+ goto err_destroy_queues; -+ -+ /* Populate queues with buffers, no failure after this point */ -+ for (i = 0; i < TX_DESCS; i++) -+ queue_put_desc(port->plat->txreadyq, -+ tx_desc_phys(port, i), tx_desc_ptr(port, i)); -+ -+ for (i = 0; i < RX_DESCS; i++) -+ queue_put_desc(queue_ids[port->id].rxfree, -+ rx_desc_phys(port, i), rx_desc_ptr(port, i)); -+ -+ netif_start_queue(dev); -+ -+ qmgr_set_irq(queue_ids[port->id].rx, QUEUE_IRQ_SRC_NOT_EMPTY, -+ hss_hdlc_rx_irq, dev); -+ -+ qmgr_set_irq(queue_ids[port->id].txdone, QUEUE_IRQ_SRC_NOT_EMPTY, -+ hss_hdlc_txdone_irq, dev); -+ qmgr_enable_irq(queue_ids[port->id].txdone); -+ -+ ports_open++; -+ netif_rx_schedule(dev); /* we may already have RX data, enables IRQ */ -+ return 0; -+ -+err_destroy_queues: -+ destroy_hdlc_queues(port); -+ release_hdlc_queues(port); -+err_plat_close: -+ if (port->plat->close) -+ port->plat->close(port->id, port->netdev); -+err_hdlc_close: -+ hdlc_close(dev); -+ return err; -+} -+ -+static int hss_hdlc_close(struct net_device *dev) -+{ -+ struct port *port = dev_to_port(dev); -+ struct npe *npe = port->npe; -+ struct msg msg; -+ int buffs = RX_DESCS; /* allocated RX buffers */ -+ int i; -+ -+ ports_open--; -+ qmgr_disable_irq(queue_ids[port->id].rx); -+ netif_stop_queue(dev); -+ -+ memset(&msg, 0, sizeof(msg)); -+ msg.cmd = PKT_PIPE_FLOW_DISABLE; -+ msg.hss_port = port->id; -+ if (npe_send_message(npe, &msg, "HSS_DISABLE_PKT_PIPE")) { -+ printk(KERN_CRIT "HSS-%i: unable to stop HDLC flow\n", -+ port->id); -+ /* The upper level would ignore the error anyway */ -+ } -+ -+ while (queue_get_desc(queue_ids[port->id].rxfree, port, 0) >= 0) -+ buffs--; -+ while (queue_get_desc(queue_ids[port->id].rx, port, 0) >= 0) -+ buffs--; -+ -+ if (buffs) -+ printk(KERN_CRIT "%s: unable to drain RX queue, %i buffer(s)" -+ " left in NPE\n", dev->name, buffs); -+ -+ buffs = TX_DESCS; -+ while (queue_get_desc(queue_ids[port->id].tx, port, 1) >= 0) -+ buffs--; /* cancel TX */ -+ -+ i = 0; -+ do { -+ while (queue_get_desc(port->plat->txreadyq, port, 1) >= 0) -+ buffs--; -+ if (!buffs) -+ break; -+ } while (++i < MAX_CLOSE_WAIT); -+ -+ if (buffs) -+ printk(KERN_CRIT "%s: unable to drain TX queue, %i buffer(s) " -+ "left in NPE\n", dev->name, buffs); -+#if DEBUG_CLOSE -+ if (!buffs) -+ printk(KERN_DEBUG "Draining TX queues took %i cycles\n", i); -+#endif -+ qmgr_disable_irq(queue_ids[port->id].txdone); -+ destroy_hdlc_queues(port); -+ release_hdlc_queues(port); -+ -+ if (port->plat->close) -+ port->plat->close(port->id, port->netdev); -+ hdlc_close(dev); -+ return 0; -+} -+ -+ -+static int hss_hdlc_attach(struct net_device *dev, unsigned short encoding, -+ unsigned short parity) -+{ -+ struct port *port = dev_to_port(dev); -+ -+ if (encoding != ENCODING_NRZ) -+ return -EINVAL; -+ -+ switch(parity) { -+ case PARITY_CRC16_PR1_CCITT: -+ port->hdlc_cfg = 0; -+ return 0; -+ -+ case PARITY_CRC32_PR1_CCITT: -+ port->hdlc_cfg = PKT_HDLC_CRC_32; -+ return 0; -+ -+ default: -+ return -EINVAL; -+ } -+} -+ -+ -+static int hss_hdlc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) -+{ -+ const size_t size = sizeof(sync_serial_settings); -+ sync_serial_settings new_line; -+ int clk; -+ sync_serial_settings __user *line = ifr->ifr_settings.ifs_ifsu.sync; -+ struct port *port = dev_to_port(dev); -+ -+ if (cmd != SIOCWANDEV) -+ return hdlc_ioctl(dev, ifr, cmd); -+ -+ switch(ifr->ifr_settings.type) { -+ case IF_GET_IFACE: -+ ifr->ifr_settings.type = IF_IFACE_V35; -+ if (ifr->ifr_settings.size < size) { -+ ifr->ifr_settings.size = size; /* data size wanted */ -+ return -ENOBUFS; -+ } -+ memset(&new_line, 0, sizeof(new_line)); -+ new_line.clock_type = port->clock_type; -+ new_line.clock_rate = port->clock_rate; -+ new_line.loopback = port->loopback; -+ if (copy_to_user(line, &new_line, size)) -+ return -EFAULT; -+ return 0; -+ -+ case IF_IFACE_SYNC_SERIAL: -+ case IF_IFACE_V35: -+ if(!capable(CAP_NET_ADMIN)) -+ return -EPERM; -+ if (dev->flags & IFF_UP) -+ return -EBUSY; /* Cannot change parameters when open */ -+ -+ if (copy_from_user(&new_line, line, size)) -+ return -EFAULT; -+ -+ clk = new_line.clock_type; -+ if (port->plat->set_clock) -+ clk = port->plat->set_clock(port->id, clk); -+ -+ if (clk != CLOCK_EXT && clk != CLOCK_INT) -+ return -EINVAL; /* No such clock setting */ -+ -+ if (new_line.loopback != 0 && new_line.loopback != 1) -+ return -EINVAL; -+ -+ port->clock_type = clk; /* Update settings */ -+ port->clock_rate = new_line.clock_rate; -+ port->loopback = new_line.loopback; -+ return 0; -+ -+ default: -+ return hdlc_ioctl(dev, ifr, cmd); -+ } -+} -+ -+ -+static int __devinit hss_init_one(struct platform_device *pdev) -+{ -+ struct port *port; -+ struct net_device *dev; -+ hdlc_device *hdlc; -+ int err; -+ -+ if ((port = kzalloc(sizeof(*port), GFP_KERNEL)) == NULL) -+ return -ENOMEM; -+ platform_set_drvdata(pdev, port); -+ port->id = pdev->id; -+ -+ if ((port->npe = npe_request(0)) == NULL) { -+ err = -ENOSYS; -+ goto err_free; -+ } -+ -+ port->plat = pdev->dev.platform_data; -+ if ((port->netdev = dev = alloc_hdlcdev(port)) == NULL) { -+ err = -ENOMEM; -+ goto err_plat; -+ } -+ -+ SET_MODULE_OWNER(net); -+ SET_NETDEV_DEV(dev, &pdev->dev); -+ hdlc = dev_to_hdlc(dev); -+ hdlc->attach = hss_hdlc_attach; -+ hdlc->xmit = hss_hdlc_xmit; -+ dev->open = hss_hdlc_open; -+ dev->poll = hss_hdlc_poll; -+ dev->stop = hss_hdlc_close; -+ dev->do_ioctl = hss_hdlc_ioctl; -+ dev->weight = 16; -+ dev->tx_queue_len = 100; -+ port->clock_type = CLOCK_EXT; -+ port->clock_rate = 2048000; -+ -+ if (register_hdlc_device(dev)) { -+ printk(KERN_ERR "HSS-%i: unable to register HDLC device\n", -+ port->id); -+ err = -ENOBUFS; -+ goto err_free_netdev; -+ } -+ printk(KERN_INFO "%s: HSS-%i\n", dev->name, port->id); -+ return 0; -+ -+err_free_netdev: -+ free_netdev(dev); -+err_plat: -+ npe_release(port->npe); -+ platform_set_drvdata(pdev, NULL); -+err_free: -+ kfree(port); -+ return err; -+} -+ -+static int __devexit hss_remove_one(struct platform_device *pdev) -+{ -+ struct port *port = platform_get_drvdata(pdev); -+ -+ unregister_hdlc_device(port->netdev); -+ free_netdev(port->netdev); -+ npe_release(port->npe); -+ platform_set_drvdata(pdev, NULL); -+ kfree(port); -+ return 0; -+} -+ -+static struct platform_driver drv = { -+ .driver.name = DRV_NAME, -+ .probe = hss_init_one, -+ .remove = hss_remove_one, -+}; -+ -+static int __init hss_init_module(void) -+{ -+ if ((ixp4xx_read_feature_bits() & -+ (IXP4XX_FEATURE_HDLC | IXP4XX_FEATURE_HSS)) != -+ (IXP4XX_FEATURE_HDLC | IXP4XX_FEATURE_HSS)) -+ return -ENOSYS; -+ return platform_driver_register(&drv); -+} -+ -+static void __exit hss_cleanup_module(void) -+{ -+ platform_driver_unregister(&drv); -+} -+ -+MODULE_AUTHOR("Krzysztof Halasa"); -+MODULE_DESCRIPTION("Intel IXP4xx HSS driver"); -+MODULE_LICENSE("GPL v2"); -+module_init(hss_init_module); -+module_exit(hss_cleanup_module); -Index: linux-2.6.24.7/include/asm-arm/arch-ixp4xx/ixp4xx-regs.h -=================================================================== ---- linux-2.6.24.7.orig/include/asm-arm/arch-ixp4xx/ixp4xx-regs.h -+++ linux-2.6.24.7/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 -Index: linux-2.6.24.7/include/asm-arm/arch-ixp4xx/cpu.h -=================================================================== ---- linux-2.6.24.7.orig/include/asm-arm/arch-ixp4xx/cpu.h -+++ linux-2.6.24.7/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 */ -Index: linux-2.6.24.7/include/asm-arm/arch-ixp4xx/hardware.h -=================================================================== ---- linux-2.6.24.7.orig/include/asm-arm/arch-ixp4xx/hardware.h -+++ linux-2.6.24.7/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" - -Index: linux-2.6.24.7/include/asm-arm/arch-ixp4xx/uncompress.h -=================================================================== ---- linux-2.6.24.7.orig/include/asm-arm/arch-ixp4xx/uncompress.h -+++ linux-2.6.24.7/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> - -Index: linux-2.6.24.7/arch/arm/kernel/setup.c -=================================================================== ---- linux-2.6.24.7.orig/arch/arm/kernel/setup.c -+++ linux-2.6.24.7/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); - -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/Kconfig -=================================================================== ---- linux-2.6.24.7.orig/arch/arm/mach-ixp4xx/Kconfig -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/Kconfig -@@ -262,6 +262,20 @@ config IXP4XX_INDIRECT_PCI - need to use the indirect method instead. If you don't know - what you need, leave this option unselected. - -+config IXP4XX_QMGR -+ tristate "IXP4xx Queue Manager support" -+ help -+ This driver supports IXP4xx built-in hardware queue manager -+ and is automatically selected by Ethernet and HSS drivers. -+ -+config IXP4XX_NPE -+ tristate "IXP4xx Network Processor Engine support" -+ select HOTPLUG -+ select FW_LOADER -+ help -+ This driver supports IXP4xx built-in network coprocessors -+ and is automatically selected by Ethernet and HSS drivers. -+ - endmenu - - endif -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/Makefile -=================================================================== ---- linux-2.6.24.7.orig/arch/arm/mach-ixp4xx/Makefile -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/Makefile -@@ -48,3 +48,5 @@ obj-$(CONFIG_MACH_AP1000) += ap1000-setu - obj-$(CONFIG_MACH_TW5334) += tw5334-setup.o - - obj-$(CONFIG_PCI) += $(obj-pci-$(CONFIG_PCI)) common-pci.o -+obj-$(CONFIG_IXP4XX_QMGR) += ixp4xx_qmgr.o -+obj-$(CONFIG_IXP4XX_NPE) += ixp4xx_npe.o -Index: linux-2.6.24.7/include/asm-arm/arch-ixp4xx/qmgr.h -=================================================================== ---- /dev/null -+++ linux-2.6.24.7/include/asm-arm/arch-ixp4xx/qmgr.h -@@ -0,0 +1,126 @@ -+/* -+ * Copyright (C) 2007 Krzysztof Halasa <khc@pm.waw.pl> -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of version 2 of the GNU General Public License -+ * as published by the Free Software Foundation. -+ */ -+ -+#ifndef IXP4XX_QMGR_H -+#define IXP4XX_QMGR_H -+ -+#include <linux/io.h> -+#include <linux/kernel.h> -+ -+#define HALF_QUEUES 32 -+#define QUEUES 64 /* only 32 lower queues currently supported */ -+#define MAX_QUEUE_LENGTH 4 /* in dwords */ -+ -+#define QUEUE_STAT1_EMPTY 1 /* queue status bits */ -+#define QUEUE_STAT1_NEARLY_EMPTY 2 -+#define QUEUE_STAT1_NEARLY_FULL 4 -+#define QUEUE_STAT1_FULL 8 -+#define QUEUE_STAT2_UNDERFLOW 1 -+#define QUEUE_STAT2_OVERFLOW 2 -+ -+#define QUEUE_WATERMARK_0_ENTRIES 0 -+#define QUEUE_WATERMARK_1_ENTRY 1 -+#define QUEUE_WATERMARK_2_ENTRIES 2 -+#define QUEUE_WATERMARK_4_ENTRIES 3 -+#define QUEUE_WATERMARK_8_ENTRIES 4 -+#define QUEUE_WATERMARK_16_ENTRIES 5 -+#define QUEUE_WATERMARK_32_ENTRIES 6 -+#define QUEUE_WATERMARK_64_ENTRIES 7 -+ -+/* queue interrupt request conditions */ -+#define QUEUE_IRQ_SRC_EMPTY 0 -+#define QUEUE_IRQ_SRC_NEARLY_EMPTY 1 -+#define QUEUE_IRQ_SRC_NEARLY_FULL 2 -+#define QUEUE_IRQ_SRC_FULL 3 -+#define QUEUE_IRQ_SRC_NOT_EMPTY 4 -+#define QUEUE_IRQ_SRC_NOT_NEARLY_EMPTY 5 -+#define QUEUE_IRQ_SRC_NOT_NEARLY_FULL 6 -+#define QUEUE_IRQ_SRC_NOT_FULL 7 -+ -+struct qmgr_regs { -+ u32 acc[QUEUES][MAX_QUEUE_LENGTH]; /* 0x000 - 0x3FF */ -+ u32 stat1[4]; /* 0x400 - 0x40F */ -+ u32 stat2[2]; /* 0x410 - 0x417 */ -+ u32 statne_h; /* 0x418 - queue nearly empty */ -+ u32 statf_h; /* 0x41C - queue full */ -+ u32 irqsrc[4]; /* 0x420 - 0x42F IRC source */ -+ u32 irqen[2]; /* 0x430 - 0x437 IRQ enabled */ -+ u32 irqstat[2]; /* 0x438 - 0x43F - IRQ access only */ -+ u32 reserved[1776]; -+ u32 sram[2048]; /* 0x2000 - 0x3FFF - config and buffer */ -+}; -+ -+void qmgr_set_irq(unsigned int queue, int src, -+ void (*handler)(void *pdev), void *pdev); -+void qmgr_enable_irq(unsigned int queue); -+void qmgr_disable_irq(unsigned int queue); -+ -+/* request_ and release_queue() must be called from non-IRQ context */ -+int qmgr_request_queue(unsigned int queue, unsigned int len /* dwords */, -+ unsigned int nearly_empty_watermark, -+ unsigned int nearly_full_watermark); -+void qmgr_release_queue(unsigned int queue); -+ -+ -+static inline void qmgr_put_entry(unsigned int queue, u32 val) -+{ -+ extern struct qmgr_regs __iomem *qmgr_regs; -+ __raw_writel(val, &qmgr_regs->acc[queue][0]); -+} -+ -+static inline u32 qmgr_get_entry(unsigned int queue) -+{ -+ extern struct qmgr_regs __iomem *qmgr_regs; -+ return __raw_readl(&qmgr_regs->acc[queue][0]); -+} -+ -+static inline int qmgr_get_stat1(unsigned int queue) -+{ -+ extern struct qmgr_regs __iomem *qmgr_regs; -+ return (__raw_readl(&qmgr_regs->stat1[queue >> 3]) -+ >> ((queue & 7) << 2)) & 0xF; -+} -+ -+static inline int qmgr_get_stat2(unsigned int queue) -+{ -+ extern struct qmgr_regs __iomem *qmgr_regs; -+ return (__raw_readl(&qmgr_regs->stat2[queue >> 4]) -+ >> ((queue & 0xF) << 1)) & 0x3; -+} -+ -+static inline int qmgr_stat_empty(unsigned int queue) -+{ -+ return !!(qmgr_get_stat1(queue) & QUEUE_STAT1_EMPTY); -+} -+ -+static inline int qmgr_stat_nearly_empty(unsigned int queue) -+{ -+ return !!(qmgr_get_stat1(queue) & QUEUE_STAT1_NEARLY_EMPTY); -+} -+ -+static inline int qmgr_stat_nearly_full(unsigned int queue) -+{ -+ return !!(qmgr_get_stat1(queue) & QUEUE_STAT1_NEARLY_FULL); -+} -+ -+static inline int qmgr_stat_full(unsigned int queue) -+{ -+ return !!(qmgr_get_stat1(queue) & QUEUE_STAT1_FULL); -+} -+ -+static inline int qmgr_stat_underflow(unsigned int queue) -+{ -+ return !!(qmgr_get_stat2(queue) & QUEUE_STAT2_UNDERFLOW); -+} -+ -+static inline int qmgr_stat_overflow(unsigned int queue) -+{ -+ return !!(qmgr_get_stat2(queue) & QUEUE_STAT2_OVERFLOW); -+} -+ -+#endif -Index: linux-2.6.24.7/include/asm-arm/arch-ixp4xx/npe.h -=================================================================== ---- /dev/null -+++ linux-2.6.24.7/include/asm-arm/arch-ixp4xx/npe.h -@@ -0,0 +1,39 @@ -+#ifndef __IXP4XX_NPE_H -+#define __IXP4XX_NPE_H -+ -+#include <linux/kernel.h> -+ -+extern const char *npe_names[]; -+ -+struct npe_regs { -+ u32 exec_addr, exec_data, exec_status_cmd, exec_count; -+ u32 action_points[4]; -+ u32 watchpoint_fifo, watch_count; -+ u32 profile_count; -+ u32 messaging_status, messaging_control; -+ u32 mailbox_status, /*messaging_*/ in_out_fifo; -+}; -+ -+struct npe { -+ struct resource *mem_res; -+ struct npe_regs __iomem *regs; -+ u32 regs_phys; -+ int id; -+ int valid; -+}; -+ -+ -+static inline const char *npe_name(struct npe *npe) -+{ -+ return npe_names[npe->id]; -+} -+ -+int npe_running(struct npe *npe); -+int npe_send_message(struct npe *npe, const void *msg, const char *what); -+int npe_recv_message(struct npe *npe, void *msg, const char *what); -+int npe_send_recv_message(struct npe *npe, void *msg, const char *what); -+int npe_load_firmware(struct npe *npe, const char *name, struct device *dev); -+struct npe *npe_request(int id); -+void npe_release(struct npe *npe); -+ -+#endif /* __IXP4XX_NPE_H */ -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/ixp4xx_qmgr.c -=================================================================== ---- /dev/null -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/ixp4xx_qmgr.c -@@ -0,0 +1,274 @@ -+/* -+ * Intel IXP4xx Queue Manager driver for Linux -+ * -+ * Copyright (C) 2007 Krzysztof Halasa <khc@pm.waw.pl> -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of version 2 of the GNU General Public License -+ * as published by the Free Software Foundation. -+ */ -+ -+#include <linux/ioport.h> -+#include <linux/interrupt.h> -+#include <linux/kernel.h> -+#include <linux/module.h> -+#include <asm/arch/qmgr.h> -+ -+#define DEBUG 0 -+ -+struct qmgr_regs __iomem *qmgr_regs; -+static struct resource *mem_res; -+static spinlock_t qmgr_lock; -+static u32 used_sram_bitmap[4]; /* 128 16-dword pages */ -+static void (*irq_handlers[HALF_QUEUES])(void *pdev); -+static void *irq_pdevs[HALF_QUEUES]; -+ -+void qmgr_set_irq(unsigned int queue, int src, -+ void (*handler)(void *pdev), void *pdev) -+{ -+ u32 __iomem *reg = &qmgr_regs->irqsrc[queue / 8]; /* 8 queues / u32 */ -+ int bit = (queue % 8) * 4; /* 3 bits + 1 reserved bit per queue */ -+ unsigned long flags; -+ -+ src &= 7; -+ spin_lock_irqsave(&qmgr_lock, flags); -+ __raw_writel((__raw_readl(reg) & ~(7 << bit)) | (src << bit), reg); -+ irq_handlers[queue] = handler; -+ irq_pdevs[queue] = pdev; -+ spin_unlock_irqrestore(&qmgr_lock, flags); -+} -+ -+ -+static irqreturn_t qmgr_irq1(int irq, void *pdev) -+{ -+ int i; -+ u32 val = __raw_readl(&qmgr_regs->irqstat[0]); -+ __raw_writel(val, &qmgr_regs->irqstat[0]); /* ACK */ -+ -+ for (i = 0; i < HALF_QUEUES; i++) -+ if (val & (1 << i)) -+ irq_handlers[i](irq_pdevs[i]); -+ -+ return val ? IRQ_HANDLED : 0; -+} -+ -+ -+void qmgr_enable_irq(unsigned int queue) -+{ -+ unsigned long flags; -+ -+ spin_lock_irqsave(&qmgr_lock, flags); -+ __raw_writel(__raw_readl(&qmgr_regs->irqen[0]) | (1 << queue), -+ &qmgr_regs->irqen[0]); -+ spin_unlock_irqrestore(&qmgr_lock, flags); -+} -+ -+void qmgr_disable_irq(unsigned int queue) -+{ -+ unsigned long flags; -+ -+ spin_lock_irqsave(&qmgr_lock, flags); -+ __raw_writel(__raw_readl(&qmgr_regs->irqen[0]) & ~(1 << queue), -+ &qmgr_regs->irqen[0]); -+ spin_unlock_irqrestore(&qmgr_lock, flags); -+} -+ -+static inline void shift_mask(u32 *mask) -+{ -+ mask[3] = mask[3] << 1 | mask[2] >> 31; -+ mask[2] = mask[2] << 1 | mask[1] >> 31; -+ mask[1] = mask[1] << 1 | mask[0] >> 31; -+ mask[0] <<= 1; -+} -+ -+int qmgr_request_queue(unsigned int queue, unsigned int len /* dwords */, -+ unsigned int nearly_empty_watermark, -+ unsigned int nearly_full_watermark) -+{ -+ u32 cfg, addr = 0, mask[4]; /* in 16-dwords */ -+ int err; -+ -+ if (queue >= HALF_QUEUES) -+ return -ERANGE; -+ -+ if ((nearly_empty_watermark | nearly_full_watermark) & ~7) -+ return -EINVAL; -+ -+ switch (len) { -+ case 16: -+ cfg = 0 << 24; -+ mask[0] = 0x1; -+ break; -+ case 32: -+ cfg = 1 << 24; -+ mask[0] = 0x3; -+ break; -+ case 64: -+ cfg = 2 << 24; -+ mask[0] = 0xF; -+ break; -+ case 128: -+ cfg = 3 << 24; -+ mask[0] = 0xFF; -+ break; -+ default: -+ return -EINVAL; -+ } -+ -+ cfg |= nearly_empty_watermark << 26; -+ cfg |= nearly_full_watermark << 29; -+ len /= 16; /* in 16-dwords: 1, 2, 4 or 8 */ -+ mask[1] = mask[2] = mask[3] = 0; -+ -+ if (!try_module_get(THIS_MODULE)) -+ return -ENODEV; -+ -+ spin_lock_irq(&qmgr_lock); -+ if (__raw_readl(&qmgr_regs->sram[queue])) { -+ err = -EBUSY; -+ goto err; -+ } -+ -+ while (1) { -+ if (!(used_sram_bitmap[0] & mask[0]) && -+ !(used_sram_bitmap[1] & mask[1]) && -+ !(used_sram_bitmap[2] & mask[2]) && -+ !(used_sram_bitmap[3] & mask[3])) -+ break; /* found free space */ -+ -+ addr++; -+ shift_mask(mask); -+ if (addr + len > ARRAY_SIZE(qmgr_regs->sram)) { -+ printk(KERN_ERR "qmgr: no free SRAM space for" -+ " queue %i\n", queue); -+ err = -ENOMEM; -+ goto err; -+ } -+ } -+ -+ used_sram_bitmap[0] |= mask[0]; -+ used_sram_bitmap[1] |= mask[1]; -+ used_sram_bitmap[2] |= mask[2]; -+ used_sram_bitmap[3] |= mask[3]; -+ __raw_writel(cfg | (addr << 14), &qmgr_regs->sram[queue]); -+ spin_unlock_irq(&qmgr_lock); -+ -+#if DEBUG -+ printk(KERN_DEBUG "qmgr: requested queue %i, addr = 0x%02X\n", -+ queue, addr); -+#endif -+ return 0; -+ -+err: -+ spin_unlock_irq(&qmgr_lock); -+ module_put(THIS_MODULE); -+ return err; -+} -+ -+void qmgr_release_queue(unsigned int queue) -+{ -+ u32 cfg, addr, mask[4]; -+ -+ BUG_ON(queue >= HALF_QUEUES); /* not in valid range */ -+ -+ spin_lock_irq(&qmgr_lock); -+ cfg = __raw_readl(&qmgr_regs->sram[queue]); -+ addr = (cfg >> 14) & 0xFF; -+ -+ BUG_ON(!addr); /* not requested */ -+ -+ switch ((cfg >> 24) & 3) { -+ case 0: mask[0] = 0x1; break; -+ case 1: mask[0] = 0x3; break; -+ case 2: mask[0] = 0xF; break; -+ case 3: mask[0] = 0xFF; break; -+ } -+ -+ while (addr--) -+ shift_mask(mask); -+ -+ __raw_writel(0, &qmgr_regs->sram[queue]); -+ -+ used_sram_bitmap[0] &= ~mask[0]; -+ used_sram_bitmap[1] &= ~mask[1]; -+ used_sram_bitmap[2] &= ~mask[2]; -+ used_sram_bitmap[3] &= ~mask[3]; -+ irq_handlers[queue] = NULL; /* catch IRQ bugs */ -+ spin_unlock_irq(&qmgr_lock); -+ -+ module_put(THIS_MODULE); -+#if DEBUG -+ printk(KERN_DEBUG "qmgr: released queue %i\n", queue); -+#endif -+} -+ -+static int qmgr_init(void) -+{ -+ int i, err; -+ mem_res = request_mem_region(IXP4XX_QMGR_BASE_PHYS, -+ IXP4XX_QMGR_REGION_SIZE, -+ "IXP4xx Queue Manager"); -+ if (mem_res == NULL) -+ return -EBUSY; -+ -+ qmgr_regs = ioremap(IXP4XX_QMGR_BASE_PHYS, IXP4XX_QMGR_REGION_SIZE); -+ if (qmgr_regs == NULL) { -+ err = -ENOMEM; -+ goto error_map; -+ } -+ -+ /* reset qmgr registers */ -+ for (i = 0; i < 4; i++) { -+ __raw_writel(0x33333333, &qmgr_regs->stat1[i]); -+ __raw_writel(0, &qmgr_regs->irqsrc[i]); -+ } -+ for (i = 0; i < 2; i++) { -+ __raw_writel(0, &qmgr_regs->stat2[i]); -+ __raw_writel(0xFFFFFFFF, &qmgr_regs->irqstat[i]); /* clear */ -+ __raw_writel(0, &qmgr_regs->irqen[i]); -+ } -+ -+ for (i = 0; i < QUEUES; i++) -+ __raw_writel(0, &qmgr_regs->sram[i]); -+ -+ err = request_irq(IRQ_IXP4XX_QM1, qmgr_irq1, 0, -+ "IXP4xx Queue Manager", NULL); -+ if (err) { -+ printk(KERN_ERR "qmgr: failed to request IRQ%i\n", -+ IRQ_IXP4XX_QM1); -+ goto error_irq; -+ } -+ -+ used_sram_bitmap[0] = 0xF; /* 4 first pages reserved for config */ -+ spin_lock_init(&qmgr_lock); -+ -+ printk(KERN_INFO "IXP4xx Queue Manager initialized.\n"); -+ return 0; -+ -+error_irq: -+ iounmap(qmgr_regs); -+error_map: -+ release_mem_region(IXP4XX_QMGR_BASE_PHYS, IXP4XX_QMGR_REGION_SIZE); -+ return err; -+} -+ -+static void qmgr_remove(void) -+{ -+ free_irq(IRQ_IXP4XX_QM1, NULL); -+ synchronize_irq(IRQ_IXP4XX_QM1); -+ iounmap(qmgr_regs); -+ release_mem_region(IXP4XX_QMGR_BASE_PHYS, IXP4XX_QMGR_REGION_SIZE); -+} -+ -+module_init(qmgr_init); -+module_exit(qmgr_remove); -+ -+MODULE_LICENSE("GPL v2"); -+MODULE_AUTHOR("Krzysztof Halasa"); -+ -+EXPORT_SYMBOL(qmgr_regs); -+EXPORT_SYMBOL(qmgr_set_irq); -+EXPORT_SYMBOL(qmgr_enable_irq); -+EXPORT_SYMBOL(qmgr_disable_irq); -+EXPORT_SYMBOL(qmgr_request_queue); -+EXPORT_SYMBOL(qmgr_release_queue); -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/ixp4xx_npe.c -=================================================================== ---- /dev/null -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/ixp4xx_npe.c -@@ -0,0 +1,741 @@ -+/* -+ * Intel IXP4xx Network Processor Engine driver for Linux -+ * -+ * Copyright (C) 2007 Krzysztof Halasa <khc@pm.waw.pl> -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of version 2 of the GNU General Public License -+ * as published by the Free Software Foundation. -+ * -+ * The code is based on publicly available information: -+ * - Intel IXP4xx Developer's Manual and other e-papers -+ * - Intel IXP400 Access Library Software (BSD license) -+ * - previous works by Christian Hohnstaedt <chohnstaedt@innominate.com> -+ * Thanks, Christian. -+ */ -+ -+#include <linux/delay.h> -+#include <linux/dma-mapping.h> -+#include <linux/firmware.h> -+#include <linux/io.h> -+#include <linux/kernel.h> -+#include <linux/module.h> -+#include <linux/slab.h> -+#include <asm/arch/npe.h> -+ -+#define DEBUG_MSG 0 -+#define DEBUG_FW 0 -+ -+#define NPE_COUNT 3 -+#define MAX_RETRIES 1000 /* microseconds */ -+#define NPE_42X_DATA_SIZE 0x800 /* in dwords */ -+#define NPE_46X_DATA_SIZE 0x1000 -+#define NPE_A_42X_INSTR_SIZE 0x1000 -+#define NPE_B_AND_C_42X_INSTR_SIZE 0x800 -+#define NPE_46X_INSTR_SIZE 0x1000 -+#define REGS_SIZE 0x1000 -+ -+#define NPE_PHYS_REG 32 -+ -+#define FW_MAGIC 0xFEEDF00D -+#define FW_BLOCK_TYPE_INSTR 0x0 -+#define FW_BLOCK_TYPE_DATA 0x1 -+#define FW_BLOCK_TYPE_EOF 0xF -+ -+/* NPE exec status (read) and command (write) */ -+#define CMD_NPE_STEP 0x01 -+#define CMD_NPE_START 0x02 -+#define CMD_NPE_STOP 0x03 -+#define CMD_NPE_CLR_PIPE 0x04 -+#define CMD_CLR_PROFILE_CNT 0x0C -+#define CMD_RD_INS_MEM 0x10 /* instruction memory */ -+#define CMD_WR_INS_MEM 0x11 -+#define CMD_RD_DATA_MEM 0x12 /* data memory */ -+#define CMD_WR_DATA_MEM 0x13 -+#define CMD_RD_ECS_REG 0x14 /* exec access register */ -+#define CMD_WR_ECS_REG 0x15 -+ -+#define STAT_RUN 0x80000000 -+#define STAT_STOP 0x40000000 -+#define STAT_CLEAR 0x20000000 -+#define STAT_ECS_K 0x00800000 /* pipeline clean */ -+ -+#define NPE_STEVT 0x1B -+#define NPE_STARTPC 0x1C -+#define NPE_REGMAP 0x1E -+#define NPE_CINDEX 0x1F -+ -+#define INSTR_WR_REG_SHORT 0x0000C000 -+#define INSTR_WR_REG_BYTE 0x00004000 -+#define INSTR_RD_FIFO 0x0F888220 -+#define INSTR_RESET_MBOX 0x0FAC8210 -+ -+#define ECS_BG_CTXT_REG_0 0x00 /* Background Executing Context */ -+#define ECS_BG_CTXT_REG_1 0x01 /* Stack level */ -+#define ECS_BG_CTXT_REG_2 0x02 -+#define ECS_PRI_1_CTXT_REG_0 0x04 /* Priority 1 Executing Context */ -+#define ECS_PRI_1_CTXT_REG_1 0x05 /* Stack level */ -+#define ECS_PRI_1_CTXT_REG_2 0x06 -+#define ECS_PRI_2_CTXT_REG_0 0x08 /* Priority 2 Executing Context */ -+#define ECS_PRI_2_CTXT_REG_1 0x09 /* Stack level */ -+#define ECS_PRI_2_CTXT_REG_2 0x0A -+#define ECS_DBG_CTXT_REG_0 0x0C /* Debug Executing Context */ -+#define ECS_DBG_CTXT_REG_1 0x0D /* Stack level */ -+#define ECS_DBG_CTXT_REG_2 0x0E -+#define ECS_INSTRUCT_REG 0x11 /* NPE Instruction Register */ -+ -+#define ECS_REG_0_ACTIVE 0x80000000 /* all levels */ -+#define ECS_REG_0_NEXTPC_MASK 0x1FFF0000 /* BG/PRI1/PRI2 levels */ -+#define ECS_REG_0_LDUR_BITS 8 -+#define ECS_REG_0_LDUR_MASK 0x00000700 /* all levels */ -+#define ECS_REG_1_CCTXT_BITS 16 -+#define ECS_REG_1_CCTXT_MASK 0x000F0000 /* all levels */ -+#define ECS_REG_1_SELCTXT_BITS 0 -+#define ECS_REG_1_SELCTXT_MASK 0x0000000F /* all levels */ -+#define ECS_DBG_REG_2_IF 0x00100000 /* debug level */ -+#define ECS_DBG_REG_2_IE 0x00080000 /* debug level */ -+ -+/* NPE watchpoint_fifo register bit */ -+#define WFIFO_VALID 0x80000000 -+ -+/* NPE messaging_status register bit definitions */ -+#define MSGSTAT_OFNE 0x00010000 /* OutFifoNotEmpty */ -+#define MSGSTAT_IFNF 0x00020000 /* InFifoNotFull */ -+#define MSGSTAT_OFNF 0x00040000 /* OutFifoNotFull */ -+#define MSGSTAT_IFNE 0x00080000 /* InFifoNotEmpty */ -+#define MSGSTAT_MBINT 0x00100000 /* Mailbox interrupt */ -+#define MSGSTAT_IFINT 0x00200000 /* InFifo interrupt */ -+#define MSGSTAT_OFINT 0x00400000 /* OutFifo interrupt */ -+#define MSGSTAT_WFINT 0x00800000 /* WatchFifo interrupt */ -+ -+/* NPE messaging_control register bit definitions */ -+#define MSGCTL_OUT_FIFO 0x00010000 /* enable output FIFO */ -+#define MSGCTL_IN_FIFO 0x00020000 /* enable input FIFO */ -+#define MSGCTL_OUT_FIFO_WRITE 0x01000000 /* enable FIFO + WRITE */ -+#define MSGCTL_IN_FIFO_WRITE 0x02000000 -+ -+/* NPE mailbox_status value for reset */ -+#define RESET_MBOX_STAT 0x0000F0F0 -+ -+const char *npe_names[] = { "NPE-A", "NPE-B", "NPE-C" }; -+ -+#define print_npe(pri, npe, fmt, ...) \ -+ printk(pri "%s: " fmt, npe_name(npe), ## __VA_ARGS__) -+ -+#if DEBUG_MSG -+#define debug_msg(npe, fmt, ...) \ -+ print_npe(KERN_DEBUG, npe, fmt, ## __VA_ARGS__) -+#else -+#define debug_msg(npe, fmt, ...) -+#endif -+ -+static struct { -+ u32 reg, val; -+} ecs_reset[] = { -+ { ECS_BG_CTXT_REG_0, 0xA0000000 }, -+ { ECS_BG_CTXT_REG_1, 0x01000000 }, -+ { ECS_BG_CTXT_REG_2, 0x00008000 }, -+ { ECS_PRI_1_CTXT_REG_0, 0x20000080 }, -+ { ECS_PRI_1_CTXT_REG_1, 0x01000000 }, -+ { ECS_PRI_1_CTXT_REG_2, 0x00008000 }, -+ { ECS_PRI_2_CTXT_REG_0, 0x20000080 }, -+ { ECS_PRI_2_CTXT_REG_1, 0x01000000 }, -+ { ECS_PRI_2_CTXT_REG_2, 0x00008000 }, -+ { ECS_DBG_CTXT_REG_0, 0x20000000 }, -+ { ECS_DBG_CTXT_REG_1, 0x00000000 }, -+ { ECS_DBG_CTXT_REG_2, 0x001E0000 }, -+ { ECS_INSTRUCT_REG, 0x1003C00F }, -+}; -+ -+static struct npe npe_tab[NPE_COUNT] = { -+ { -+ .id = 0, -+ .regs = (struct npe_regs __iomem *)IXP4XX_NPEA_BASE_VIRT, -+ .regs_phys = IXP4XX_NPEA_BASE_PHYS, -+ }, { -+ .id = 1, -+ .regs = (struct npe_regs __iomem *)IXP4XX_NPEB_BASE_VIRT, -+ .regs_phys = IXP4XX_NPEB_BASE_PHYS, -+ }, { -+ .id = 2, -+ .regs = (struct npe_regs __iomem *)IXP4XX_NPEC_BASE_VIRT, -+ .regs_phys = IXP4XX_NPEC_BASE_PHYS, -+ } -+}; -+ -+int npe_running(struct npe *npe) -+{ -+ return (__raw_readl(&npe->regs->exec_status_cmd) & STAT_RUN) != 0; -+} -+ -+static void npe_cmd_write(struct npe *npe, u32 addr, int cmd, u32 data) -+{ -+ __raw_writel(data, &npe->regs->exec_data); -+ __raw_writel(addr, &npe->regs->exec_addr); -+ __raw_writel(cmd, &npe->regs->exec_status_cmd); -+} -+ -+static u32 npe_cmd_read(struct npe *npe, u32 addr, int cmd) -+{ -+ __raw_writel(addr, &npe->regs->exec_addr); -+ __raw_writel(cmd, &npe->regs->exec_status_cmd); -+ /* Iintroduce extra read cycles after issuing read command to NPE -+ so that we read the register after the NPE has updated it. -+ This is to overcome race condition between XScale and NPE */ -+ __raw_readl(&npe->regs->exec_data); -+ __raw_readl(&npe->regs->exec_data); -+ return __raw_readl(&npe->regs->exec_data); -+} -+ -+static void npe_clear_active(struct npe *npe, u32 reg) -+{ -+ u32 val = npe_cmd_read(npe, reg, CMD_RD_ECS_REG); -+ npe_cmd_write(npe, reg, CMD_WR_ECS_REG, val & ~ECS_REG_0_ACTIVE); -+} -+ -+static void npe_start(struct npe *npe) -+{ -+ /* ensure only Background Context Stack Level is active */ -+ npe_clear_active(npe, ECS_PRI_1_CTXT_REG_0); -+ npe_clear_active(npe, ECS_PRI_2_CTXT_REG_0); -+ npe_clear_active(npe, ECS_DBG_CTXT_REG_0); -+ -+ __raw_writel(CMD_NPE_CLR_PIPE, &npe->regs->exec_status_cmd); -+ __raw_writel(CMD_NPE_START, &npe->regs->exec_status_cmd); -+} -+ -+static void npe_stop(struct npe *npe) -+{ -+ __raw_writel(CMD_NPE_STOP, &npe->regs->exec_status_cmd); -+ __raw_writel(CMD_NPE_CLR_PIPE, &npe->regs->exec_status_cmd); /*FIXME?*/ -+} -+ -+static int __must_check npe_debug_instr(struct npe *npe, u32 instr, u32 ctx, -+ u32 ldur) -+{ -+ u32 wc; -+ int i; -+ -+ /* set the Active bit, and the LDUR, in the debug level */ -+ npe_cmd_write(npe, ECS_DBG_CTXT_REG_0, CMD_WR_ECS_REG, -+ ECS_REG_0_ACTIVE | (ldur << ECS_REG_0_LDUR_BITS)); -+ -+ /* set CCTXT at ECS DEBUG L3 to specify in which context to execute -+ the instruction, and set SELCTXT at ECS DEBUG Level to specify -+ which context store to access. -+ Debug ECS Level Reg 1 has form 0x000n000n, where n = context number -+ */ -+ npe_cmd_write(npe, ECS_DBG_CTXT_REG_1, CMD_WR_ECS_REG, -+ (ctx << ECS_REG_1_CCTXT_BITS) | -+ (ctx << ECS_REG_1_SELCTXT_BITS)); -+ -+ /* clear the pipeline */ -+ __raw_writel(CMD_NPE_CLR_PIPE, &npe->regs->exec_status_cmd); -+ -+ /* load NPE instruction into the instruction register */ -+ npe_cmd_write(npe, ECS_INSTRUCT_REG, CMD_WR_ECS_REG, instr); -+ -+ /* we need this value later to wait for completion of NPE execution -+ step */ -+ wc = __raw_readl(&npe->regs->watch_count); -+ -+ /* issue a Step One command via the Execution Control register */ -+ __raw_writel(CMD_NPE_STEP, &npe->regs->exec_status_cmd); -+ -+ /* Watch Count register increments when NPE completes an instruction */ -+ for (i = 0; i < MAX_RETRIES; i++) { -+ if (wc != __raw_readl(&npe->regs->watch_count)) -+ return 0; -+ udelay(1); -+ } -+ -+ print_npe(KERN_ERR, npe, "reset: npe_debug_instr(): timeout\n"); -+ return -ETIMEDOUT; -+} -+ -+static int __must_check npe_logical_reg_write8(struct npe *npe, u32 addr, -+ u8 val, u32 ctx) -+{ -+ /* here we build the NPE assembler instruction: mov8 d0, #0 */ -+ u32 instr = INSTR_WR_REG_BYTE | /* OpCode */ -+ addr << 9 | /* base Operand */ -+ (val & 0x1F) << 4 | /* lower 5 bits to immediate data */ -+ (val & ~0x1F) << (18 - 5);/* higher 3 bits to CoProc instr. */ -+ return npe_debug_instr(npe, instr, ctx, 1); /* execute it */ -+} -+ -+static int __must_check npe_logical_reg_write16(struct npe *npe, u32 addr, -+ u16 val, u32 ctx) -+{ -+ /* here we build the NPE assembler instruction: mov16 d0, #0 */ -+ u32 instr = INSTR_WR_REG_SHORT | /* OpCode */ -+ addr << 9 | /* base Operand */ -+ (val & 0x1F) << 4 | /* lower 5 bits to immediate data */ -+ (val & ~0x1F) << (18 - 5);/* higher 11 bits to CoProc instr. */ -+ return npe_debug_instr(npe, instr, ctx, 1); /* execute it */ -+} -+ -+static int __must_check npe_logical_reg_write32(struct npe *npe, u32 addr, -+ u32 val, u32 ctx) -+{ -+ /* write in 16 bit steps first the high and then the low value */ -+ if (npe_logical_reg_write16(npe, addr, val >> 16, ctx)) -+ return -ETIMEDOUT; -+ return npe_logical_reg_write16(npe, addr + 2, val & 0xFFFF, ctx); -+} -+ -+static int npe_reset(struct npe *npe) -+{ -+ u32 val, ctl, exec_count, ctx_reg2; -+ int i; -+ -+ ctl = (__raw_readl(&npe->regs->messaging_control) | 0x3F000000) & -+ 0x3F3FFFFF; -+ -+ /* disable parity interrupt */ -+ __raw_writel(ctl & 0x3F00FFFF, &npe->regs->messaging_control); -+ -+ /* pre exec - debug instruction */ -+ /* turn off the halt bit by clearing Execution Count register. */ -+ exec_count = __raw_readl(&npe->regs->exec_count); -+ __raw_writel(0, &npe->regs->exec_count); -+ /* ensure that IF and IE are on (temporarily), so that we don't end up -+ stepping forever */ -+ ctx_reg2 = npe_cmd_read(npe, ECS_DBG_CTXT_REG_2, CMD_RD_ECS_REG); -+ npe_cmd_write(npe, ECS_DBG_CTXT_REG_2, CMD_WR_ECS_REG, ctx_reg2 | -+ ECS_DBG_REG_2_IF | ECS_DBG_REG_2_IE); -+ -+ /* clear the FIFOs */ -+ while (__raw_readl(&npe->regs->watchpoint_fifo) & WFIFO_VALID) -+ ; -+ while (__raw_readl(&npe->regs->messaging_status) & MSGSTAT_OFNE) -+ /* read from the outFIFO until empty */ -+ print_npe(KERN_DEBUG, npe, "npe_reset: read FIFO = 0x%X\n", -+ __raw_readl(&npe->regs->in_out_fifo)); -+ -+ while (__raw_readl(&npe->regs->messaging_status) & MSGSTAT_IFNE) -+ /* step execution of the NPE intruction to read inFIFO using -+ the Debug Executing Context stack */ -+ if (npe_debug_instr(npe, INSTR_RD_FIFO, 0, 0)) -+ return -ETIMEDOUT; -+ -+ /* reset the mailbox reg from the XScale side */ -+ __raw_writel(RESET_MBOX_STAT, &npe->regs->mailbox_status); -+ /* from NPE side */ -+ if (npe_debug_instr(npe, INSTR_RESET_MBOX, 0, 0)) -+ return -ETIMEDOUT; -+ -+ /* Reset the physical registers in the NPE register file */ -+ for (val = 0; val < NPE_PHYS_REG; val++) { -+ if (npe_logical_reg_write16(npe, NPE_REGMAP, val >> 1, 0)) -+ return -ETIMEDOUT; -+ /* address is either 0 or 4 */ -+ if (npe_logical_reg_write32(npe, (val & 1) * 4, 0, 0)) -+ return -ETIMEDOUT; -+ } -+ -+ /* Reset the context store = each context's Context Store registers */ -+ -+ /* Context 0 has no STARTPC. Instead, this value is used to set NextPC -+ for Background ECS, to set where NPE starts executing code */ -+ val = npe_cmd_read(npe, ECS_BG_CTXT_REG_0, CMD_RD_ECS_REG); -+ val &= ~ECS_REG_0_NEXTPC_MASK; -+ val |= (0 /* NextPC */ << 16) & ECS_REG_0_NEXTPC_MASK; -+ npe_cmd_write(npe, ECS_BG_CTXT_REG_0, CMD_WR_ECS_REG, val); -+ -+ for (i = 0; i < 16; i++) { -+ if (i) { /* Context 0 has no STEVT nor STARTPC */ -+ /* STEVT = off, 0x80 */ -+ if (npe_logical_reg_write8(npe, NPE_STEVT, 0x80, i)) -+ return -ETIMEDOUT; -+ if (npe_logical_reg_write16(npe, NPE_STARTPC, 0, i)) -+ return -ETIMEDOUT; -+ } -+ /* REGMAP = d0->p0, d8->p2, d16->p4 */ -+ if (npe_logical_reg_write16(npe, NPE_REGMAP, 0x820, i)) -+ return -ETIMEDOUT; -+ if (npe_logical_reg_write8(npe, NPE_CINDEX, 0, i)) -+ return -ETIMEDOUT; -+ } -+ -+ /* post exec */ -+ /* clear active bit in debug level */ -+ npe_cmd_write(npe, ECS_DBG_CTXT_REG_0, CMD_WR_ECS_REG, 0); -+ /* clear the pipeline */ -+ __raw_writel(CMD_NPE_CLR_PIPE, &npe->regs->exec_status_cmd); -+ /* restore previous values */ -+ __raw_writel(exec_count, &npe->regs->exec_count); -+ npe_cmd_write(npe, ECS_DBG_CTXT_REG_2, CMD_WR_ECS_REG, ctx_reg2); -+ -+ /* write reset values to Execution Context Stack registers */ -+ for (val = 0; val < ARRAY_SIZE(ecs_reset); val++) -+ npe_cmd_write(npe, ecs_reset[val].reg, CMD_WR_ECS_REG, -+ ecs_reset[val].val); -+ -+ /* clear the profile counter */ -+ __raw_writel(CMD_CLR_PROFILE_CNT, &npe->regs->exec_status_cmd); -+ -+ __raw_writel(0, &npe->regs->exec_count); -+ __raw_writel(0, &npe->regs->action_points[0]); -+ __raw_writel(0, &npe->regs->action_points[1]); -+ __raw_writel(0, &npe->regs->action_points[2]); -+ __raw_writel(0, &npe->regs->action_points[3]); -+ __raw_writel(0, &npe->regs->watch_count); -+ -+ val = ixp4xx_read_feature_bits(); -+ /* reset the NPE */ -+ ixp4xx_write_feature_bits(val & -+ ~(IXP4XX_FEATURE_RESET_NPEA << npe->id)); -+ for (i = 0; i < MAX_RETRIES; i++) { -+ if (!(ixp4xx_read_feature_bits() & -+ (IXP4XX_FEATURE_RESET_NPEA << npe->id))) -+ break; /* reset completed */ -+ udelay(1); -+ } -+ if (i == MAX_RETRIES) -+ return -ETIMEDOUT; -+ -+ /* deassert reset */ -+ ixp4xx_write_feature_bits(val | -+ (IXP4XX_FEATURE_RESET_NPEA << npe->id)); -+ for (i = 0; i < MAX_RETRIES; i++) { -+ if (ixp4xx_read_feature_bits() & -+ (IXP4XX_FEATURE_RESET_NPEA << npe->id)) -+ break; /* NPE is back alive */ -+ udelay(1); -+ } -+ if (i == MAX_RETRIES) -+ return -ETIMEDOUT; -+ -+ npe_stop(npe); -+ -+ /* restore NPE configuration bus Control Register - parity settings */ -+ __raw_writel(ctl, &npe->regs->messaging_control); -+ return 0; -+} -+ -+ -+int npe_send_message(struct npe *npe, const void *msg, const char *what) -+{ -+ const u32 *send = msg; -+ int cycles = 0; -+ -+ debug_msg(npe, "Trying to send message %s [%08X:%08X]\n", -+ what, send[0], send[1]); -+ -+ if (__raw_readl(&npe->regs->messaging_status) & MSGSTAT_IFNE) { -+ debug_msg(npe, "NPE input FIFO not empty\n"); -+ return -EIO; -+ } -+ -+ __raw_writel(send[0], &npe->regs->in_out_fifo); -+ -+ if (!(__raw_readl(&npe->regs->messaging_status) & MSGSTAT_IFNF)) { -+ debug_msg(npe, "NPE input FIFO full\n"); -+ return -EIO; -+ } -+ -+ __raw_writel(send[1], &npe->regs->in_out_fifo); -+ -+ while ((cycles < MAX_RETRIES) && -+ (__raw_readl(&npe->regs->messaging_status) & MSGSTAT_IFNE)) { -+ udelay(1); -+ cycles++; -+ } -+ -+ if (cycles == MAX_RETRIES) { -+ debug_msg(npe, "Timeout sending message\n"); -+ return -ETIMEDOUT; -+ } -+ -+ debug_msg(npe, "Sending a message took %i cycles\n", cycles); -+ return 0; -+} -+ -+int npe_recv_message(struct npe *npe, void *msg, const char *what) -+{ -+ u32 *recv = msg; -+ int cycles = 0, cnt = 0; -+ -+ debug_msg(npe, "Trying to receive message %s\n", what); -+ -+ while (cycles < MAX_RETRIES) { -+ if (__raw_readl(&npe->regs->messaging_status) & MSGSTAT_OFNE) { -+ recv[cnt++] = __raw_readl(&npe->regs->in_out_fifo); -+ if (cnt == 2) -+ break; -+ } else { -+ udelay(1); -+ cycles++; -+ } -+ } -+ -+ switch(cnt) { -+ case 1: -+ debug_msg(npe, "Received [%08X]\n", recv[0]); -+ break; -+ case 2: -+ debug_msg(npe, "Received [%08X:%08X]\n", recv[0], recv[1]); -+ break; -+ } -+ -+ if (cycles == MAX_RETRIES) { -+ debug_msg(npe, "Timeout waiting for message\n"); -+ return -ETIMEDOUT; -+ } -+ -+ debug_msg(npe, "Receiving a message took %i cycles\n", cycles); -+ return 0; -+} -+ -+int npe_send_recv_message(struct npe *npe, void *msg, const char *what) -+{ -+ int result; -+ u32 *send = msg, recv[2]; -+ -+ if ((result = npe_send_message(npe, msg, what)) != 0) -+ return result; -+ if ((result = npe_recv_message(npe, recv, what)) != 0) -+ return result; -+ -+ if ((recv[0] != send[0]) || (recv[1] != send[1])) { -+ debug_msg(npe, "Message %s: unexpected message received\n", -+ what); -+ return -EIO; -+ } -+ return 0; -+} -+ -+ -+int npe_load_firmware(struct npe *npe, const char *name, struct device *dev) -+{ -+ const struct firmware *fw_entry; -+ -+ struct dl_block { -+ u32 type; -+ u32 offset; -+ } *blk; -+ -+ struct dl_image { -+ u32 magic; -+ u32 id; -+ u32 size; -+ union { -+ u32 data[0]; -+ struct dl_block blocks[0]; -+ }; -+ } *image; -+ -+ struct dl_codeblock { -+ u32 npe_addr; -+ u32 size; -+ u32 data[0]; -+ } *cb; -+ -+ int i, j, err, data_size, instr_size, blocks, table_end; -+ u32 cmd; -+ -+ if ((err = request_firmware(&fw_entry, name, dev)) != 0) -+ return err; -+ -+ err = -EINVAL; -+ if (fw_entry->size < sizeof(struct dl_image)) { -+ print_npe(KERN_ERR, npe, "incomplete firmware file\n"); -+ goto err; -+ } -+ image = (struct dl_image*)fw_entry->data; -+ -+#if DEBUG_FW -+ print_npe(KERN_DEBUG, npe, "firmware: %08X %08X %08X (0x%X bytes)\n", -+ image->magic, image->id, image->size, image->size * 4); -+#endif -+ -+ if (image->magic == swab32(FW_MAGIC)) { /* swapped file */ -+ image->id = swab32(image->id); -+ image->size = swab32(image->size); -+ } else if (image->magic != FW_MAGIC) { -+ print_npe(KERN_ERR, npe, "bad firmware file magic: 0x%X\n", -+ image->magic); -+ goto err; -+ } -+ if ((image->size * 4 + sizeof(struct dl_image)) != fw_entry->size) { -+ print_npe(KERN_ERR, npe, -+ "inconsistent size of firmware file\n"); -+ goto err; -+ } -+ if (((image->id >> 24) & 0xF /* NPE ID */) != npe->id) { -+ print_npe(KERN_ERR, npe, "firmware file NPE ID mismatch\n"); -+ goto err; -+ } -+ if (image->magic == swab32(FW_MAGIC)) -+ for (i = 0; i < image->size; i++) -+ image->data[i] = swab32(image->data[i]); -+ -+ if (!cpu_is_ixp46x() && ((image->id >> 28) & 0xF /* device ID */)) { -+ print_npe(KERN_INFO, npe, "IXP46x firmware ignored on " -+ "IXP42x\n"); -+ goto err; -+ } -+ -+ if (npe_running(npe)) { -+ print_npe(KERN_INFO, npe, "unable to load firmware, NPE is " -+ "already running\n"); -+ err = -EBUSY; -+ goto err; -+ } -+#if 0 -+ npe_stop(npe); -+ npe_reset(npe); -+#endif -+ -+ print_npe(KERN_INFO, npe, "firmware functionality 0x%X, " -+ "revision 0x%X:%X\n", (image->id >> 16) & 0xFF, -+ (image->id >> 8) & 0xFF, image->id & 0xFF); -+ -+ if (!cpu_is_ixp46x()) { -+ if (!npe->id) -+ instr_size = NPE_A_42X_INSTR_SIZE; -+ else -+ instr_size = NPE_B_AND_C_42X_INSTR_SIZE; -+ data_size = NPE_42X_DATA_SIZE; -+ } else { -+ instr_size = NPE_46X_INSTR_SIZE; -+ data_size = NPE_46X_DATA_SIZE; -+ } -+ -+ for (blocks = 0; blocks * sizeof(struct dl_block) / 4 < image->size; -+ blocks++) -+ if (image->blocks[blocks].type == FW_BLOCK_TYPE_EOF) -+ break; -+ if (blocks * sizeof(struct dl_block) / 4 >= image->size) { -+ print_npe(KERN_INFO, npe, "firmware EOF block marker not " -+ "found\n"); -+ goto err; -+ } -+ -+#if DEBUG_FW -+ print_npe(KERN_DEBUG, npe, "%i firmware blocks found\n", blocks); -+#endif -+ -+ table_end = blocks * sizeof(struct dl_block) / 4 + 1 /* EOF marker */; -+ for (i = 0, blk = image->blocks; i < blocks; i++, blk++) { -+ if (blk->offset > image->size - sizeof(struct dl_codeblock) / 4 -+ || blk->offset < table_end) { -+ print_npe(KERN_INFO, npe, "invalid offset 0x%X of " -+ "firmware block #%i\n", blk->offset, i); -+ goto err; -+ } -+ -+ cb = (struct dl_codeblock*)&image->data[blk->offset]; -+ if (blk->type == FW_BLOCK_TYPE_INSTR) { -+ if (cb->npe_addr + cb->size > instr_size) -+ goto too_big; -+ cmd = CMD_WR_INS_MEM; -+ } else if (blk->type == FW_BLOCK_TYPE_DATA) { -+ if (cb->npe_addr + cb->size > data_size) -+ goto too_big; -+ cmd = CMD_WR_DATA_MEM; -+ } else { -+ print_npe(KERN_INFO, npe, "invalid firmware block #%i " -+ "type 0x%X\n", i, blk->type); -+ goto err; -+ } -+ if (blk->offset + sizeof(*cb) / 4 + cb->size > image->size) { -+ print_npe(KERN_INFO, npe, "firmware block #%i doesn't " -+ "fit in firmware image: type %c, start 0x%X," -+ " length 0x%X\n", i, -+ blk->type == FW_BLOCK_TYPE_INSTR ? 'I' : 'D', -+ cb->npe_addr, cb->size); -+ goto err; -+ } -+ -+ for (j = 0; j < cb->size; j++) -+ npe_cmd_write(npe, cb->npe_addr + j, cmd, cb->data[j]); -+ } -+ -+ npe_start(npe); -+ if (!npe_running(npe)) -+ print_npe(KERN_ERR, npe, "unable to start\n"); -+ release_firmware(fw_entry); -+ return 0; -+ -+too_big: -+ print_npe(KERN_INFO, npe, "firmware block #%i doesn't fit in NPE " -+ "memory: type %c, start 0x%X, length 0x%X\n", i, -+ blk->type == FW_BLOCK_TYPE_INSTR ? 'I' : 'D', -+ cb->npe_addr, cb->size); -+err: -+ release_firmware(fw_entry); -+ return err; -+} -+ -+ -+struct npe *npe_request(int id) -+{ -+ if (id < NPE_COUNT) -+ if (npe_tab[id].valid) -+ if (try_module_get(THIS_MODULE)) -+ return &npe_tab[id]; -+ return NULL; -+} -+ -+void npe_release(struct npe *npe) -+{ -+ module_put(THIS_MODULE); -+} -+ -+ -+static int __init npe_init_module(void) -+{ -+ -+ int i, found = 0; -+ -+ for (i = 0; i < NPE_COUNT; i++) { -+ struct npe *npe = &npe_tab[i]; -+ if (!(ixp4xx_read_feature_bits() & -+ (IXP4XX_FEATURE_RESET_NPEA << i))) -+ continue; /* NPE already disabled or not present */ -+ if (!(npe->mem_res = request_mem_region(npe->regs_phys, -+ REGS_SIZE, -+ npe_name(npe)))) { -+ print_npe(KERN_ERR, npe, -+ "failed to request memory region\n"); -+ continue; -+ } -+ -+ if (npe_reset(npe)) -+ continue; -+ npe->valid = 1; -+ found++; -+ } -+ -+ if (!found) -+ return -ENOSYS; -+ return 0; -+} -+ -+static void __exit npe_cleanup_module(void) -+{ -+ int i; -+ -+ for (i = 0; i < NPE_COUNT; i++) -+ if (npe_tab[i].mem_res) { -+ npe_reset(&npe_tab[i]); -+ release_resource(npe_tab[i].mem_res); -+ } -+} -+ -+module_init(npe_init_module); -+module_exit(npe_cleanup_module); -+ -+MODULE_AUTHOR("Krzysztof Halasa"); -+MODULE_LICENSE("GPL v2"); -+ -+EXPORT_SYMBOL(npe_names); -+EXPORT_SYMBOL(npe_running); -+EXPORT_SYMBOL(npe_request); -+EXPORT_SYMBOL(npe_release); -+EXPORT_SYMBOL(npe_load_firmware); -+EXPORT_SYMBOL(npe_send_message); -+EXPORT_SYMBOL(npe_recv_message); -+EXPORT_SYMBOL(npe_send_recv_message); -Index: linux-2.6.24.7/include/asm-arm/arch-ixp4xx/platform.h -=================================================================== ---- linux-2.6.24.7.orig/include/asm-arm/arch-ixp4xx/platform.h -+++ linux-2.6.24.7/include/asm-arm/arch-ixp4xx/platform.h -@@ -102,6 +102,27 @@ struct ixp4xx_pata_data { - - struct sys_timer; - -+#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; -+}; -+ - /* - * Frequency of clock used for primary clocksource - */ -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/ixdp425-setup.c -=================================================================== ---- linux-2.6.24.7.orig/arch/arm/mach-ixp4xx/ixdp425-setup.c -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/ixdp425-setup.c -@@ -177,6 +177,31 @@ static struct platform_device ixdp425_ua - .resource = ixdp425_uart_resources - }; - -+/* Built-in 10/100 Ethernet MAC interfaces */ -+static struct eth_plat_info ixdp425_plat_eth[] = { -+ { -+ .phy = 0, -+ .rxq = 3, -+ .txreadyq = 20, -+ }, { -+ .phy = 1, -+ .rxq = 4, -+ .txreadyq = 21, -+ } -+}; -+ -+static struct platform_device ixdp425_eth[] = { -+ { -+ .name = "ixp4xx_eth", -+ .id = IXP4XX_ETH_NPEB, -+ .dev.platform_data = ixdp425_plat_eth, -+ }, { -+ .name = "ixp4xx_eth", -+ .id = IXP4XX_ETH_NPEC, -+ .dev.platform_data = ixdp425_plat_eth + 1, -+ } -+}; -+ - static struct platform_device *ixdp425_devices[] __initdata = { - &ixdp425_i2c_gpio, - &ixdp425_flash, -@@ -184,7 +209,9 @@ static struct platform_device *ixdp425_d - defined(CONFIG_MTD_NAND_PLATFORM_MODULE) - &ixdp425_flash_nand, - #endif -- &ixdp425_uart -+ &ixdp425_uart, -+ &ixdp425_eth[0], -+ &ixdp425_eth[1], - }; - - static void __init ixdp425_init(void) diff --git a/target/linux/ixp4xx/patches-2.6.24/201-npe_driver_print_license_location.patch b/target/linux/ixp4xx/patches-2.6.24/201-npe_driver_print_license_location.patch deleted file mode 100644 index 53cad0dc84..0000000000 --- a/target/linux/ixp4xx/patches-2.6.24/201-npe_driver_print_license_location.patch +++ /dev/null @@ -1,13 +0,0 @@ -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/ixp4xx_npe.c -=================================================================== ---- linux-2.6.24.7.orig/arch/arm/mach-ixp4xx/ixp4xx_npe.c -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/ixp4xx_npe.c -@@ -588,6 +588,8 @@ int npe_load_firmware(struct npe *npe, c - npe_reset(npe); - #endif - -+ print_npe(KERN_INFO, npe, "firmware's license can be found in /usr/share/doc/LICENSE.IPL\n"); -+ - print_npe(KERN_INFO, npe, "firmware functionality 0x%X, " - "revision 0x%X:%X\n", (image->id >> 16) & 0xFF, - (image->id >> 8) & 0xFF, image->id & 0xFF); diff --git a/target/linux/ixp4xx/patches-2.6.24/202-npe_driver_switch_support.patch b/target/linux/ixp4xx/patches-2.6.24/202-npe_driver_switch_support.patch deleted file mode 100644 index 1604743850..0000000000 --- a/target/linux/ixp4xx/patches-2.6.24/202-npe_driver_switch_support.patch +++ /dev/null @@ -1,252 +0,0 @@ -Index: linux-2.6.24.7/drivers/net/arm/ixp4xx_eth.c -=================================================================== ---- linux-2.6.24.7.orig/drivers/net/arm/ixp4xx_eth.c -+++ linux-2.6.24.7/drivers/net/arm/ixp4xx_eth.c -@@ -165,14 +165,15 @@ struct port { - struct net_device *netdev; - struct napi_struct napi; - struct net_device_stats stat; -- struct mii_if_info mii; -+ struct mii_if_info mii[IXP4XX_ETH_PHY_MAX_ADDR]; - struct delayed_work mdio_thread; - struct eth_plat_info *plat; - buffer_t *rx_buff_tab[RX_DESCS], *tx_buff_tab[TX_DESCS]; - struct desc *desc_tab; /* coherent */ - u32 desc_tab_phys; - int id; /* logical port ID */ -- u16 mii_bmcr; -+ u16 mii_bmcr[IXP4XX_ETH_PHY_MAX_ADDR]; -+ int phy_count; - }; - - /* NPE message structure */ -@@ -316,13 +317,14 @@ static void mdio_write(struct net_device - spin_unlock_irqrestore(&mdio_lock, flags); - } - --static void phy_reset(struct net_device *dev, int phy_id) -+static void phy_reset(struct net_device *dev, int idx) - { - struct port *port = netdev_priv(dev); -+ int phy_id = port->mii[idx].phy_id; - int cycles = 0; - -- mdio_write(dev, phy_id, MII_BMCR, port->mii_bmcr | BMCR_RESET); -- -+ mdio_write(dev, phy_id, MII_BMCR, port->mii_bmcr[idx] | BMCR_RESET); -+ - while (cycles < MAX_MII_RESET_RETRIES) { - if (!(mdio_read(dev, phy_id, MII_BMCR) & BMCR_RESET)) { - #if DEBUG_MDIO -@@ -335,12 +337,12 @@ static void phy_reset(struct net_device - cycles++; - } - -- printk(KERN_ERR "%s: MII reset failed\n", dev->name); -+ printk(KERN_ERR "%s: MII reset failed on PHY%2d\n", dev->name, phy_id); - } - --static void eth_set_duplex(struct port *port) -+static void eth_set_duplex(struct port *port, int full_duplex) - { -- if (port->mii.full_duplex) -+ if (full_duplex) - __raw_writel(DEFAULT_TX_CNTRL0 & ~TX_CNTRL0_HALFDUPLEX, - &port->regs->tx_control[0]); - else -@@ -348,7 +350,7 @@ static void eth_set_duplex(struct port * - &port->regs->tx_control[0]); - } - -- -+#if 0 - static void phy_check_media(struct port *port, int init) - { - if (mii_check_media(&port->mii, 1, init)) -@@ -367,7 +369,63 @@ static void phy_check_media(struct port - } - } - } -+#else -+static void phy_update_link(struct net_device *dev, int link) -+{ -+ int prev_link = netif_carrier_ok(dev); -+ -+ if (!prev_link && link) { -+ printk(KERN_INFO "%s: link up\n", dev->name); -+ netif_carrier_on(dev); -+ } else if (prev_link && !link) { -+ printk(KERN_INFO "%s: link down\n", dev->name); -+ netif_carrier_off(dev); -+ } -+} -+ -+static void phy_check_media(struct port *port, int init) -+{ -+ struct net_device *dev = port->netdev; -+ -+ if (port->phy_count == 1) { -+ struct mii_if_info *mii = &port->mii[0]; -+ -+ if (mii_check_media(mii, 1, init)) -+ eth_set_duplex(port, mii->full_duplex); -+ -+ if (mii->force_media) /* mii_check_media() doesn't work */ -+ phy_update_link(dev, mii_link_ok(mii)); -+ } else { -+ int cur_link = 0; -+ int i; -+ -+ if (init) -+ eth_set_duplex(port, 1); -+ -+ for (i = 0; i < port->phy_count; i++) -+ cur_link |= mii_link_ok(&port->mii[i]); -+ -+ phy_update_link(dev, cur_link); -+ } -+} -+#endif - -+static void phy_power_down(struct net_device *dev, int idx) -+{ -+ struct port *port = netdev_priv(dev); -+ int phy_id = port->mii[idx].phy_id; -+ -+ port->mii_bmcr[idx] = mdio_read(dev, phy_id, MII_BMCR) & -+ ~(BMCR_RESET | BMCR_PDOWN); -+ mdio_write(dev, phy_id, MII_BMCR, port->mii_bmcr[idx] | BMCR_PDOWN); -+} -+ -+static void phy_power_up(struct net_device *dev, int idx) -+{ -+ struct port *port = netdev_priv(dev); -+ -+ mdio_write(dev, port->mii[idx].phy_id, MII_BMCR, port->mii_bmcr[idx]); -+} - - static void mdio_thread(struct work_struct *work) - { -@@ -790,9 +848,12 @@ static int eth_ioctl(struct net_device * - - if (!netif_running(dev)) - return -EINVAL; -- err = generic_mii_ioctl(&port->mii, if_mii(req), cmd, &duplex_chg); -+ if (port->phy_count != 1) -+ return -EOPNOTSUPP; -+ -+ err = generic_mii_ioctl(&port->mii[0], if_mii(req), cmd, &duplex_chg); - if (duplex_chg) -- eth_set_duplex(port); -+ eth_set_duplex(port, port->mii[0].full_duplex); - return err; - } - -@@ -944,7 +1005,8 @@ static int eth_open(struct net_device *d - } - } - -- mdio_write(dev, port->plat->phy, MII_BMCR, port->mii_bmcr); -+ for (i = 0; i < port->phy_count; i++) -+ phy_power_up(dev, i); - - memset(&msg, 0, sizeof(msg)); - msg.cmd = NPE_VLAN_SETRXQOSENTRY; -@@ -1103,10 +1165,8 @@ static int eth_close(struct net_device * - printk(KERN_CRIT "%s: unable to disable loopback\n", - dev->name); - -- port->mii_bmcr = mdio_read(dev, port->plat->phy, MII_BMCR) & -- ~(BMCR_RESET | BMCR_PDOWN); /* may have been altered */ -- mdio_write(dev, port->plat->phy, MII_BMCR, -- port->mii_bmcr | BMCR_PDOWN); -+ for (i = 0; i < port->phy_count; i++) -+ phy_power_down(dev, i); - - if (!ports_open) - qmgr_disable_irq(TXDONE_QUEUE); -@@ -1117,6 +1177,42 @@ static int eth_close(struct net_device * - return 0; - } - -+static void eth_add_phy(struct net_device *dev, int phy_id) -+{ -+ struct port *port = netdev_priv(dev); -+ int i; -+ -+ i = port->phy_count++; -+ -+ port->mii[i].dev = dev; -+ port->mii[i].mdio_read = mdio_read; -+ port->mii[i].mdio_write = mdio_write; -+ port->mii[i].phy_id = phy_id; -+ port->mii[i].phy_id_mask = 0x1F; -+ port->mii[i].reg_num_mask = 0x1F; -+ -+ printk(KERN_INFO "%s: MII PHY %i on %s\n", dev->name, phy_id, -+ npe_name(port->npe)); -+ -+ phy_reset(dev, i); -+ phy_power_down(dev, i); -+} -+ -+static void eth_init_mii(struct net_device *dev) -+{ -+ struct port *port = netdev_priv(dev); -+ -+ if (port->plat->phy < IXP4XX_ETH_PHY_MAX_ADDR) { -+ eth_add_phy(dev, port->plat->phy); -+ } else { -+ int i; -+ for (i = 0; i < IXP4XX_ETH_PHY_MAX_ADDR; i++) -+ if (port->plat->phy_mask & (1U << i)) -+ eth_add_phy(dev, i); -+ } -+ -+} -+ - static int __devinit eth_init_one(struct platform_device *pdev) - { - struct port *port; -@@ -1189,20 +1285,7 @@ static int __devinit eth_init_one(struct - __raw_writel(DEFAULT_CORE_CNTRL, &port->regs->core_control); - udelay(50); - -- port->mii.dev = dev; -- port->mii.mdio_read = mdio_read; -- port->mii.mdio_write = mdio_write; -- port->mii.phy_id = plat->phy; -- port->mii.phy_id_mask = 0x1F; -- port->mii.reg_num_mask = 0x1F; -- -- printk(KERN_INFO "%s: MII PHY %i on %s\n", dev->name, plat->phy, -- npe_name(port->npe)); -- -- phy_reset(dev, plat->phy); -- port->mii_bmcr = mdio_read(dev, plat->phy, MII_BMCR) & -- ~(BMCR_RESET | BMCR_PDOWN); -- mdio_write(dev, plat->phy, MII_BMCR, port->mii_bmcr | BMCR_PDOWN); -+ eth_init_mii(dev); - - INIT_DELAYED_WORK(&port->mdio_thread, mdio_thread); - return 0; -Index: linux-2.6.24.7/include/asm-arm/arch-ixp4xx/platform.h -=================================================================== ---- linux-2.6.24.7.orig/include/asm-arm/arch-ixp4xx/platform.h -+++ linux-2.6.24.7/include/asm-arm/arch-ixp4xx/platform.h -@@ -106,12 +106,15 @@ struct sys_timer; - #define IXP4XX_ETH_NPEB 0x10 - #define IXP4XX_ETH_NPEC 0x20 - -+#define IXP4XX_ETH_PHY_MAX_ADDR 32 -+ - /* 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]; -+ u32 phy_mask; - }; - - /* Information about built-in HSS (synchronous serial) interfaces */ diff --git a/target/linux/ixp4xx/patches-2.6.24/203-npe_driver_phy_reset_autoneg.patch b/target/linux/ixp4xx/patches-2.6.24/203-npe_driver_phy_reset_autoneg.patch deleted file mode 100644 index 0788ce3338..0000000000 --- a/target/linux/ixp4xx/patches-2.6.24/203-npe_driver_phy_reset_autoneg.patch +++ /dev/null @@ -1,44 +0,0 @@ -Index: linux-2.6.24.7/drivers/net/arm/ixp4xx_eth.c -=================================================================== ---- linux-2.6.24.7.orig/drivers/net/arm/ixp4xx_eth.c -+++ linux-2.6.24.7/drivers/net/arm/ixp4xx_eth.c -@@ -322,8 +322,12 @@ static void phy_reset(struct net_device - struct port *port = netdev_priv(dev); - int phy_id = port->mii[idx].phy_id; - int cycles = 0; -+ u16 bmcr; - -- mdio_write(dev, phy_id, MII_BMCR, port->mii_bmcr[idx] | BMCR_RESET); -+ /* reset the PHY */ -+ bmcr = mdio_read(dev, phy_id, MII_BMCR); -+ bmcr |= BMCR_ANENABLE; -+ mdio_write(dev, phy_id, MII_BMCR, bmcr | BMCR_RESET); - - while (cycles < MAX_MII_RESET_RETRIES) { - if (!(mdio_read(dev, phy_id, MII_BMCR) & BMCR_RESET)) { -@@ -331,13 +335,23 @@ static void phy_reset(struct net_device - printk(KERN_DEBUG "%s: phy_reset() took %i cycles\n", - dev->name, cycles); - #endif -- return; -+ break; - } - udelay(1); - cycles++; - } - -- printk(KERN_ERR "%s: MII reset failed on PHY%2d\n", dev->name, phy_id); -+ if (cycles == MAX_MII_RESET_RETRIES) { -+ printk(KERN_ERR "%s: MII reset failed on PHY%2d\n", dev->name, -+ phy_id); -+ return; -+ } -+ -+ /* restart auto negotiation */ -+ bmcr = mdio_read(dev, phy_id, MII_BMCR); -+ bmcr |= (BMCR_ANENABLE | BMCR_ANRESTART); -+ mdio_write(dev, phy_id, MII_BMCR, bmcr); -+ - } - - static void eth_set_duplex(struct port *port, int full_duplex) diff --git a/target/linux/ixp4xx/patches-2.6.24/204-npe_driver_ixp43x_support.patch b/target/linux/ixp4xx/patches-2.6.24/204-npe_driver_ixp43x_support.patch deleted file mode 100644 index 1bd576d896..0000000000 --- a/target/linux/ixp4xx/patches-2.6.24/204-npe_driver_ixp43x_support.patch +++ /dev/null @@ -1,90 +0,0 @@ -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/ixp4xx_npe.c -=================================================================== ---- linux-2.6.24.7.orig/arch/arm/mach-ixp4xx/ixp4xx_npe.c -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/ixp4xx_npe.c -@@ -571,8 +571,8 @@ int npe_load_firmware(struct npe *npe, c - for (i = 0; i < image->size; i++) - image->data[i] = swab32(image->data[i]); - -- if (!cpu_is_ixp46x() && ((image->id >> 28) & 0xF /* device ID */)) { -- print_npe(KERN_INFO, npe, "IXP46x firmware ignored on " -+ if (cpu_is_ixp42x() && ((image->id >> 28) & 0xF /* device ID */)) { -+ print_npe(KERN_INFO, npe, "IXP46x/IXP43x firmware ignored on " - "IXP42x\n"); - goto err; - } -@@ -594,7 +594,7 @@ int npe_load_firmware(struct npe *npe, c - "revision 0x%X:%X\n", (image->id >> 16) & 0xFF, - (image->id >> 8) & 0xFF, image->id & 0xFF); - -- if (!cpu_is_ixp46x()) { -+ if (cpu_is_ixp42x()) { - if (!npe->id) - instr_size = NPE_A_42X_INSTR_SIZE; - else -Index: linux-2.6.24.7/drivers/net/arm/ixp4xx_eth.c -=================================================================== ---- linux-2.6.24.7.orig/drivers/net/arm/ixp4xx_eth.c -+++ linux-2.6.24.7/drivers/net/arm/ixp4xx_eth.c -@@ -32,6 +32,7 @@ - #include <linux/kernel.h> - #include <linux/mii.h> - #include <linux/platform_device.h> -+#include <asm/arch/cpu.h> - #include <asm/arch/npe.h> - #include <asm/arch/qmgr.h> - -@@ -1335,12 +1336,16 @@ static struct platform_driver drv = { - - static int __init eth_init_module(void) - { -- if (!(ixp4xx_read_feature_bits() & IXP4XX_FEATURE_NPEB_ETH0)) -- return -ENOSYS; - -- /* All MII PHY accesses use NPE-B Ethernet registers */ - spin_lock_init(&mdio_lock); -- mdio_regs = (struct eth_regs __iomem *)IXP4XX_EthB_BASE_VIRT; -+ if (!cpu_is_ixp43x()) -+ /* All MII PHY accesses use NPE-B Ethernet registers */ -+ mdio_regs = (struct eth_regs __iomem *)IXP4XX_EthB_BASE_VIRT; -+ -+ else -+ /* IXP43x lacks NPE-B and uses NPE-C for MII PHY access */ -+ mdio_regs = (struct eth_regs __iomem *)IXP4XX_EthC_BASE_VIRT; -+ - __raw_writel(DEFAULT_CORE_CNTRL, &mdio_regs->core_control); - - return platform_driver_register(&drv); -Index: linux-2.6.24.7/include/asm-arm/arch-ixp4xx/cpu.h -=================================================================== ---- linux-2.6.24.7.orig/include/asm-arm/arch-ixp4xx/cpu.h -+++ linux-2.6.24.7/include/asm-arm/arch-ixp4xx/cpu.h -@@ -34,6 +34,8 @@ static inline u32 ixp4xx_read_feature_bi - val &= ~IXP4XX_FEATURE_RESERVED; - if (!cpu_is_ixp46x()) - val &= ~IXP4XX_FEATURE_IXP46X_ONLY; -+ if (cpu_is_ixp42x()) -+ val &= ~IXP4XX_FEATURE_IXP43X_46X; - - return val; - } -Index: linux-2.6.24.7/include/asm-arm/arch-ixp4xx/ixp4xx-regs.h -=================================================================== ---- linux-2.6.24.7.orig/include/asm-arm/arch-ixp4xx/ixp4xx-regs.h -+++ linux-2.6.24.7/include/asm-arm/arch-ixp4xx/ixp4xx-regs.h -@@ -628,11 +628,12 @@ - #define IXP4XX_FEATURE_XSCALE_MAX_FREQ (3 << 22) - #define IXP4XX_FEATURE_RESERVED (0xFF << 24) - --#define IXP4XX_FEATURE_IXP46X_ONLY (IXP4XX_FEATURE_ECC_TIMESYNC | \ -+#define IXP4XX_FEATURE_IXP43X_46X (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) - -+#define IXP4XX_FEATURE_IXP46X_ONLY (IXP4XX_FEATURE_NPEB_ETH_1_TO_3 | \ -+ IXP4XX_FEATURE_RSA) -+ - #endif diff --git a/target/linux/ixp4xx/patches-2.6.24/250-compex_switch_support.patch b/target/linux/ixp4xx/patches-2.6.24/250-compex_switch_support.patch deleted file mode 100644 index 2fb31c4af9..0000000000 --- a/target/linux/ixp4xx/patches-2.6.24/250-compex_switch_support.patch +++ /dev/null @@ -1,14 +0,0 @@ -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/compex-setup.c -=================================================================== ---- linux-2.6.24.7.orig/arch/arm/mach-ixp4xx/compex-setup.c -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/compex-setup.c -@@ -93,7 +93,8 @@ static struct platform_device compex_uar - /* Built-in 10/100 Ethernet MAC interfaces */ - static struct eth_plat_info compex_plat_eth[] = { - { -- .phy = -1, -+ .phy = IXP4XX_ETH_PHY_MAX_ADDR, -+ .phy_mask = 0xf0000, /* port 0-4 of the Marvell switch */ - .rxq = 3, - .txreadyq = 20, - }, { diff --git a/target/linux/ixp4xx/patches-2.6.24/294-eeprom_new_notifier.patch b/target/linux/ixp4xx/patches-2.6.24/294-eeprom_new_notifier.patch deleted file mode 100644 index d95c94d04b..0000000000 --- a/target/linux/ixp4xx/patches-2.6.24/294-eeprom_new_notifier.patch +++ /dev/null @@ -1,190 +0,0 @@ -Index: linux-2.6.24.7/drivers/i2c/chips/eeprom.c -=================================================================== ---- linux-2.6.24.7.orig/drivers/i2c/chips/eeprom.c -+++ linux-2.6.24.7/drivers/i2c/chips/eeprom.c -@@ -33,6 +33,8 @@ - #include <linux/jiffies.h> - #include <linux/i2c.h> - #include <linux/mutex.h> -+#include <linux/notifier.h> -+#include <linux/eeprom.h> - - /* Addresses to scan */ - static unsigned short normal_i2c[] = { 0x50, 0x51, 0x52, 0x53, 0x54, -@@ -41,26 +43,7 @@ static unsigned short normal_i2c[] = { 0 - /* Insmod parameters */ - I2C_CLIENT_INSMOD_1(eeprom); - -- --/* Size of EEPROM in bytes */ --#define EEPROM_SIZE 256 -- --/* possible types of eeprom devices */ --enum eeprom_nature { -- UNKNOWN, -- VAIO, --}; -- --/* Each client has this additional data */ --struct eeprom_data { -- struct i2c_client client; -- struct mutex update_lock; -- u8 valid; /* bitfield, bit!=0 if slice is valid */ -- unsigned long last_updated[8]; /* In jiffies, 8 slices */ -- u8 data[EEPROM_SIZE]; /* Register values */ -- enum eeprom_nature nature; --}; -- -+ATOMIC_NOTIFIER_HEAD(eeprom_chain); - - static int eeprom_attach_adapter(struct i2c_adapter *adapter); - static int eeprom_detect(struct i2c_adapter *adapter, int address, int kind); -@@ -198,6 +181,7 @@ static int eeprom_detect(struct i2c_adap - data->valid = 0; - mutex_init(&data->update_lock); - data->nature = UNKNOWN; -+ data->attr = &eeprom_attr; - - /* Tell the I2C layer a new client has arrived */ - if ((err = i2c_attach_client(new_client))) -@@ -225,6 +209,9 @@ static int eeprom_detect(struct i2c_adap - if (err) - goto exit_detach; - -+ /* call the notifier chain */ -+ atomic_notifier_call_chain(&eeprom_chain, EEPROM_REGISTER, data); -+ - return 0; - - exit_detach: -@@ -250,6 +237,41 @@ static int eeprom_detach_client(struct i - return 0; - } - -+/** -+ * register_eeprom_notifier - register a 'user' of EEPROM devices. -+ * @nb: pointer to notifier info structure -+ * -+ * Registers a callback function to be called upon detection -+ * of an EEPROM device. Detection invokes the 'add' callback -+ * with the kobj of the mutex and a bin_attribute which allows -+ * read from the EEPROM. The intention is that the notifier -+ * will be able to read system configuration from the notifier. -+ * -+ * Only EEPROMs detected *after* the addition of the notifier -+ * are notified. I.e. EEPROMs already known to the system -+ * will not be notified - add the notifier from board level -+ * code! -+ */ -+int register_eeprom_notifier(struct notifier_block *nb) -+{ -+ return atomic_notifier_chain_register(&eeprom_chain, nb); -+} -+ -+/** -+ * unregister_eeprom_notifier - unregister a 'user' of EEPROM devices. -+ * @old: pointer to notifier info structure -+ * -+ * Removes a callback function from the list of 'users' to be -+ * notified upon detection of EEPROM devices. -+ */ -+int unregister_eeprom_notifier(struct notifier_block *nb) -+{ -+ return atomic_notifier_chain_unregister(&eeprom_chain, nb); -+} -+ -+EXPORT_SYMBOL_GPL(register_eeprom_notifier); -+EXPORT_SYMBOL_GPL(unregister_eeprom_notifier); -+ - static int __init eeprom_init(void) - { - return i2c_add_driver(&eeprom_driver); -Index: linux-2.6.24.7/include/linux/eeprom.h -=================================================================== ---- /dev/null -+++ linux-2.6.24.7/include/linux/eeprom.h -@@ -0,0 +1,71 @@ -+#ifndef _LINUX_EEPROM_H -+#define _LINUX_EEPROM_H -+/* -+ * EEPROM notifier header -+ * -+ * Copyright (C) 2006 John Bowler -+ */ -+ -+/* -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+ */ -+ -+#ifndef __KERNEL__ -+#error This is a kernel header -+#endif -+ -+#include <linux/list.h> -+#include <linux/kobject.h> -+#include <linux/sysfs.h> -+ -+/* Size of EEPROM in bytes */ -+#define EEPROM_SIZE 256 -+ -+/* possible types of eeprom devices */ -+enum eeprom_nature { -+ UNKNOWN, -+ VAIO, -+}; -+ -+/* Each client has this additional data */ -+struct eeprom_data { -+ struct i2c_client client; -+ struct mutex update_lock; -+ u8 valid; /* bitfield, bit!=0 if slice is valid */ -+ unsigned long last_updated[8]; /* In jiffies, 8 slices */ -+ u8 data[EEPROM_SIZE]; /* Register values */ -+ enum eeprom_nature nature; -+ struct bin_attribute *attr; -+}; -+ -+/* -+ * This is very basic. -+ * -+ * If an EEPROM is detected on the I2C bus (this only works for -+ * I2C EEPROMs) the notifier chain is called with -+ * both the I2C information and the kobject for the sysfs -+ * device which has been registers. It is then possible to -+ * read from the device via the bin_attribute::read method -+ * to extract configuration information. -+ * -+ * Register the notifier in the board level code, there is no -+ * need to unregister it but you can if you want (it will save -+ * a little bit or kernel memory to do so). -+ */ -+ -+extern int register_eeprom_notifier(struct notifier_block *nb); -+extern int unregister_eeprom_notifier(struct notifier_block *nb); -+ -+#endif /* _LINUX_EEPROM_H */ -Index: linux-2.6.24.7/include/linux/notifier.h -=================================================================== ---- linux-2.6.24.7.orig/include/linux/notifier.h -+++ linux-2.6.24.7/include/linux/notifier.h -@@ -248,5 +248,8 @@ extern struct blocking_notifier_head reb - #define VT_WRITE 0x0003 /* A char got output */ - #define VT_UPDATE 0x0004 /* A bigger update occurred */ - -+/* eeprom notifier chain */ -+#define EEPROM_REGISTER 0x0001 -+ - #endif /* __KERNEL__ */ - #endif /* _LINUX_NOTIFIER_H */ diff --git a/target/linux/ixp4xx/patches-2.6.24/296-avila_mac_plat_info.patch b/target/linux/ixp4xx/patches-2.6.24/296-avila_mac_plat_info.patch deleted file mode 100644 index 3fdb52f04e..0000000000 --- a/target/linux/ixp4xx/patches-2.6.24/296-avila_mac_plat_info.patch +++ /dev/null @@ -1,45 +0,0 @@ -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/avila-setup.c -=================================================================== ---- linux-2.6.24.7.orig/arch/arm/mach-ixp4xx/avila-setup.c -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/avila-setup.c -@@ -132,6 +132,31 @@ static struct platform_device avila_pata - .resource = avila_pata_resources, - }; - -+/* Built-in 10/100 Ethernet MAC interfaces */ -+static struct eth_plat_info avila_npeb_data = { -+ .phy = 0, -+ .rxq = 3, -+ .txreadyq = 20, -+}; -+ -+static struct eth_plat_info avila_npec_data = { -+ .phy = 1, -+ .rxq = 4, -+ .txreadyq = 21, -+}; -+ -+static struct platform_device avila_npeb_device = { -+ .name = "ixp4xx_eth", -+ .id = IXP4XX_ETH_NPEB, -+ .dev.platform_data = &avila_npeb_data, -+}; -+ -+static struct platform_device avila_npec_device = { -+ .name = "ixp4xx_eth", -+ .id = IXP4XX_ETH_NPEC, -+ .dev.platform_data = &avila_npec_data, -+}; -+ - static struct platform_device *avila_devices[] __initdata = { - &avila_i2c_gpio, - &avila_flash, -@@ -159,6 +184,8 @@ static void __init avila_init(void) - - platform_device_register(&avila_pata); - -+ platform_device_register(avila_npeb_device); -+ platform_device_register(avila_npec_device); - } - - MACHINE_START(AVILA, "Gateworks Avila Network Platform") diff --git a/target/linux/ixp4xx/patches-2.6.24/300-avila_fetch_mac.patch b/target/linux/ixp4xx/patches-2.6.24/300-avila_fetch_mac.patch deleted file mode 100644 index a266cced02..0000000000 --- a/target/linux/ixp4xx/patches-2.6.24/300-avila_fetch_mac.patch +++ /dev/null @@ -1,229 +0,0 @@ -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/avila-setup.c -=================================================================== ---- linux-2.6.24.7.orig/arch/arm/mach-ixp4xx/avila-setup.c -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/avila-setup.c -@@ -14,10 +14,18 @@ - #include <linux/kernel.h> - #include <linux/init.h> - #include <linux/device.h> -+#include <linux/if_ether.h> -+#include <linux/socket.h> -+#include <linux/netdevice.h> - #include <linux/serial.h> - #include <linux/tty.h> - #include <linux/serial_8250.h> - #include <linux/slab.h> -+#ifdef CONFIG_SENSORS_EEPROM -+# include <linux/i2c.h> -+# include <linux/eeprom.h> -+#endif -+ - #include <linux/i2c-gpio.h> - - #include <asm/types.h> -@@ -29,6 +37,13 @@ - #include <asm/mach/arch.h> - #include <asm/mach/flash.h> - -+struct avila_board_info { -+ unsigned char *model; -+ void (* setup)(void); -+}; -+ -+static struct avila_board_info *avila_info __initdata; -+ - static struct flash_platform_data avila_flash_data = { - .map_name = "cfi_probe", - .width = 2, -@@ -163,10 +178,160 @@ static struct platform_device *avila_dev - &avila_uart - }; - -+static void __init avila_gw23xx_setup(void) -+{ -+ platform_device_register(&avila_npeb_device); -+ platform_device_register(&avila_npec_device); -+} -+ -+#ifdef CONFIG_SENSORS_EEPROM -+static void __init avila_gw2342_setup(void) -+{ -+ platform_device_register(&avila_npeb_device); -+ platform_device_register(&avila_npec_device); -+} -+ -+static void __init avila_gw2345_setup(void) -+{ -+ avila_npeb_data.phy = IXP4XX_ETH_PHY_MAX_ADDR; -+ avila_npeb_data.phy_mask = 0x1e; /* ports 1-4 of the KS8995 switch */ -+ platform_device_register(&avila_npeb_device); -+ -+ avila_npec_data.phy = 5; /* port 5 of the KS8995 switch */ -+ platform_device_register(&avila_npec_device); -+} -+ -+static void __init avila_gw2347_setup(void) -+{ -+ platform_device_register(&avila_npeb_device); -+} -+ -+static void __init avila_gw2348_setup(void) -+{ -+ platform_device_register(&avila_npeb_device); -+ platform_device_register(&avila_npec_device); -+} -+ -+static void __init avila_gw2353_setup(void) -+{ -+ platform_device_register(&avila_npeb_device); -+} -+ -+static void __init avila_gw2355_setup(void) -+{ -+ avila_npeb_data.phy = IXP4XX_ETH_PHY_MAX_ADDR; -+ avila_npeb_data.phy_mask = 0x1e; /* ports 1-4 of the KS8995 switch */ -+ platform_device_register(&avila_npeb_device); -+ -+ avila_npec_data.phy = 16; -+ platform_device_register(&avila_npec_device); -+} -+ -+static void __init avila_gw2357_setup(void) -+{ -+ platform_device_register(&avila_npeb_device); -+} -+ -+static struct avila_board_info avila_boards[] __initdata = { -+ { -+ .model = "GW2342", -+ .setup = avila_gw2342_setup, -+ }, { -+ .model = "GW2345", -+ .setup = avila_gw2345_setup, -+ }, { -+ .model = "GW2347", -+ .setup = avila_gw2347_setup, -+ }, { -+ .model = "GW2348", -+ .setup = avila_gw2348_setup, -+ }, { -+ .model = "GW2353", -+ .setup = avila_gw2353_setup, -+ }, { -+ .model = "GW2355", -+ .setup = avila_gw2355_setup, -+ }, { -+ .model = "GW2357", -+ .setup = avila_gw2357_setup, -+ } -+}; -+ -+static struct avila_board_info * __init avila_find_board_info(char *model) -+{ -+ int i; -+ -+ for (i = 0; i < ARRAY_SIZE(avila_boards); i++) { -+ struct avila_board_info *info = &avila_boards[i]; -+ if (strncmp(info->model, model, strlen(info->model)) == 0) -+ return info; -+ } -+ -+ return NULL; -+} -+ -+struct avila_eeprom_header { -+ unsigned char mac0[ETH_ALEN]; -+ unsigned char mac1[ETH_ALEN]; -+ unsigned char res0[4]; -+ unsigned char magic[2]; -+ unsigned char config[14]; -+ unsigned char model[16]; -+}; -+ -+static int __init avila_eeprom_notify(struct notifier_block *self, -+ unsigned long event, void *t) -+{ -+ struct eeprom_data *ee = t; -+ struct avila_eeprom_header hdr; -+ -+ if (avila_info) -+ return NOTIFY_DONE; -+ -+ /* The eeprom is at address 0x51 */ -+ if (event != EEPROM_REGISTER || ee->client.addr != 0x51) -+ return NOTIFY_DONE; -+ -+ ee->attr->read(&ee->client.dev.kobj, ee->attr, (char *)&hdr, -+ 0, sizeof(hdr)); -+ -+ if (hdr.magic[0] != 'G' || hdr.magic[1] != 'W') -+ return NOTIFY_DONE; -+ -+ memcpy(&avila_npeb_data.hwaddr, hdr.mac0, ETH_ALEN); -+ memcpy(&avila_npec_data.hwaddr, hdr.mac1, ETH_ALEN); -+ -+ avila_info = avila_find_board_info(hdr.model); -+ -+ return NOTIFY_OK; -+} -+ -+static struct notifier_block avila_eeprom_notifier __initdata = { -+ .notifier_call = avila_eeprom_notify -+}; -+ -+static void __init avila_register_eeprom_notifier(void) -+{ -+ register_eeprom_notifier(&avila_eeprom_notifier); -+} -+ -+static void __init avila_unregister_eeprom_notifier(void) -+{ -+ unregister_eeprom_notifier(&avila_eeprom_notifier); -+} -+#else /* CONFIG_SENSORS_EEPROM */ -+static inline void avila_register_eeprom_notifier(void) {}; -+static inline void avila_unregister_eeprom_notifier(void) {}; -+#endif /* CONFIG_SENSORS_EEPROM */ -+ - static void __init avila_init(void) - { - ixp4xx_sys_init(); - -+ /* -+ * These devices are present on all Avila models and don't need any -+ * model specific setup. -+ */ - avila_flash_resource.start = IXP4XX_EXP_BUS_BASE(0); - avila_flash_resource.end = - IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1; -@@ -184,9 +349,28 @@ static void __init avila_init(void) - - platform_device_register(&avila_pata); - -- platform_device_register(avila_npeb_device); -- platform_device_register(avila_npec_device); -+ avila_register_eeprom_notifier(); -+} -+ -+static int __init avila_model_setup(void) -+{ -+ if (!machine_is_avila()) -+ return 0; -+ -+ if (avila_info) { -+ printk(KERN_DEBUG "Running on Gateworks Avila %s\n", -+ avila_info->model); -+ avila_info->setup(); -+ } else { -+ printk(KERN_INFO "Unknown/missing Avila model number" -+ " -- defaults will be used\n"); -+ avila_gw23xx_setup(); -+ } -+ -+ avila_unregister_eeprom_notifier(); -+ return 0; - } -+late_initcall(avila_model_setup); - - MACHINE_START(AVILA, "Gateworks Avila Network Platform") - /* Maintainer: Deepak Saxena <dsaxena@plexity.net> */ diff --git a/target/linux/ixp4xx/patches-2.6.24/301-avila_led.patch b/target/linux/ixp4xx/patches-2.6.24/301-avila_led.patch deleted file mode 100644 index 81282fac9a..0000000000 --- a/target/linux/ixp4xx/patches-2.6.24/301-avila_led.patch +++ /dev/null @@ -1,116 +0,0 @@ -Index: linux-2.6.24.7/include/asm-arm/arch-ixp4xx/avila.h -=================================================================== ---- linux-2.6.24.7.orig/include/asm-arm/arch-ixp4xx/avila.h -+++ linux-2.6.24.7/include/asm-arm/arch-ixp4xx/avila.h -@@ -36,4 +36,6 @@ - #define AVILA_PCI_INTC_PIN 9 - #define AVILA_PCI_INTD_PIN 8 - -- -+/* User LEDs */ -+#define AVILA_GW23XX_LED_USER_GPIO 3 -+#define AVILA_GW23X7_LED_USER_GPIO 4 -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/avila-setup.c -=================================================================== ---- linux-2.6.24.7.orig/arch/arm/mach-ixp4xx/avila-setup.c -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/avila-setup.c -@@ -26,6 +26,7 @@ - # include <linux/eeprom.h> - #endif - -+#include <linux/leds.h> - #include <linux/i2c-gpio.h> - - #include <asm/types.h> -@@ -172,6 +173,25 @@ static struct platform_device avila_npec - .dev.platform_data = &avila_npec_data, - }; - -+static struct gpio_led avila_leds[] = { -+ { -+ .name = "user", /* green led */ -+ .gpio = AVILA_GW23XX_LED_USER_GPIO, -+ .active_low = 1, -+ } -+}; -+ -+static struct gpio_led_platform_data avila_leds_data = { -+ .num_leds = 1, -+ .leds = avila_leds, -+}; -+ -+static struct platform_device avila_leds_device = { -+ .name = "leds-gpio", -+ .id = -1, -+ .dev.platform_data = &avila_leds_data, -+}; -+ - static struct platform_device *avila_devices[] __initdata = { - &avila_i2c_gpio, - &avila_flash, -@@ -182,6 +202,8 @@ static void __init avila_gw23xx_setup(vo - { - platform_device_register(&avila_npeb_device); - platform_device_register(&avila_npec_device); -+ -+ platform_device_register(&avila_leds_device); - } - - #ifdef CONFIG_SENSORS_EEPROM -@@ -189,6 +211,8 @@ static void __init avila_gw2342_setup(vo - { - platform_device_register(&avila_npeb_device); - platform_device_register(&avila_npec_device); -+ -+ platform_device_register(&avila_leds_device); - } - - static void __init avila_gw2345_setup(void) -@@ -199,22 +223,30 @@ static void __init avila_gw2345_setup(vo - - avila_npec_data.phy = 5; /* port 5 of the KS8995 switch */ - platform_device_register(&avila_npec_device); -+ -+ platform_device_register(&avila_leds_device); - } - - static void __init avila_gw2347_setup(void) - { - platform_device_register(&avila_npeb_device); -+ -+ avila_leds[0].gpio = AVILA_GW23X7_LED_USER_GPIO; -+ platform_device_register(&avila_leds_device); - } - - static void __init avila_gw2348_setup(void) - { - platform_device_register(&avila_npeb_device); - platform_device_register(&avila_npec_device); -+ -+ platform_device_register(&avila_leds_device); - } - - static void __init avila_gw2353_setup(void) - { - platform_device_register(&avila_npeb_device); -+ platform_device_register(&avila_leds_device); - } - - static void __init avila_gw2355_setup(void) -@@ -225,11 +257,16 @@ static void __init avila_gw2355_setup(vo - - avila_npec_data.phy = 16; - platform_device_register(&avila_npec_device); -+ -+ platform_device_register(&avila_leds_device); - } - - static void __init avila_gw2357_setup(void) - { - platform_device_register(&avila_npeb_device); -+ -+ avila_leds[0].gpio = AVILA_GW23X7_LED_USER_GPIO; -+ platform_device_register(&avila_leds_device); - } - - static struct avila_board_info avila_boards[] __initdata = { diff --git a/target/linux/ixp4xx/patches-2.6.24/302-avila_gpio_device.patch b/target/linux/ixp4xx/patches-2.6.24/302-avila_gpio_device.patch deleted file mode 100644 index eb14f7db11..0000000000 --- a/target/linux/ixp4xx/patches-2.6.24/302-avila_gpio_device.patch +++ /dev/null @@ -1,45 +0,0 @@ -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/avila-setup.c -=================================================================== ---- linux-2.6.24.7.orig/arch/arm/mach-ixp4xx/avila-setup.c -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/avila-setup.c -@@ -192,10 +192,28 @@ static struct platform_device avila_leds - .dev.platform_data = &avila_leds_data, - }; - -+static struct resource avila_gpio_resources[] = { -+ { -+ .name = "gpio", -+ /* FIXME: gpio mask should be model specific */ -+ .start = AVILA_GPIO_MASK, -+ .end = AVILA_GPIO_MASK, -+ .flags = 0, -+ }, -+}; -+ -+static struct platform_device avila_gpio = { -+ .name = "GPIODEV", -+ .id = -1, -+ .num_resources = ARRAY_SIZE(avila_gpio_resources), -+ .resource = avila_gpio_resources, -+}; -+ - static struct platform_device *avila_devices[] __initdata = { - &avila_i2c_gpio, - &avila_flash, -- &avila_uart -+ &avila_uart, -+ &avila_gpio, - }; - - static void __init avila_gw23xx_setup(void) -Index: linux-2.6.24.7/include/asm-arm/arch-ixp4xx/avila.h -=================================================================== ---- linux-2.6.24.7.orig/include/asm-arm/arch-ixp4xx/avila.h -+++ linux-2.6.24.7/include/asm-arm/arch-ixp4xx/avila.h -@@ -39,3 +39,6 @@ - /* User LEDs */ - #define AVILA_GW23XX_LED_USER_GPIO 3 - #define AVILA_GW23X7_LED_USER_GPIO 4 -+ -+/* gpio mask used by platform device */ -+#define AVILA_GPIO_MASK (1 << 1) | (1 << 3) | (1 << 5) | (1 << 7) | (1 << 9) diff --git a/target/linux/ixp4xx/patches-2.6.24/303-avila_gw23x7_phy_quirk.patch b/target/linux/ixp4xx/patches-2.6.24/303-avila_gw23x7_phy_quirk.patch deleted file mode 100644 index 089cff9b90..0000000000 --- a/target/linux/ixp4xx/patches-2.6.24/303-avila_gw23x7_phy_quirk.patch +++ /dev/null @@ -1,52 +0,0 @@ -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/avila-setup.c -=================================================================== ---- linux-2.6.24.7.orig/arch/arm/mach-ixp4xx/avila-setup.c -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/avila-setup.c -@@ -247,6 +247,7 @@ static void __init avila_gw2345_setup(vo - - static void __init avila_gw2347_setup(void) - { -+ avila_npeb_data.quirks |= IXP4XX_ETH_QUIRK_GW23X7; - platform_device_register(&avila_npeb_device); - - avila_leds[0].gpio = AVILA_GW23X7_LED_USER_GPIO; -@@ -281,6 +282,7 @@ static void __init avila_gw2355_setup(vo - - static void __init avila_gw2357_setup(void) - { -+ avila_npeb_data.quirks |= IXP4XX_ETH_QUIRK_GW23X7; - platform_device_register(&avila_npeb_device); - - avila_leds[0].gpio = AVILA_GW23X7_LED_USER_GPIO; -Index: linux-2.6.24.7/drivers/net/arm/ixp4xx_eth.c -=================================================================== ---- linux-2.6.24.7.orig/drivers/net/arm/ixp4xx_eth.c -+++ linux-2.6.24.7/drivers/net/arm/ixp4xx_eth.c -@@ -348,6 +348,14 @@ static void phy_reset(struct net_device - return; - } - -+ if (port->plat->quirks & IXP4XX_ETH_QUIRK_GW23X7) { -+ mdio_write(dev, 1, 0x19, -+ (mdio_read(dev, 1, 0x19) & 0xfffe) | 0x8000); -+ -+ printk(KERN_DEBUG "%s: phy_id of the DP83848 changed to 0\n", -+ dev->name); -+ } -+ - /* restart auto negotiation */ - bmcr = mdio_read(dev, phy_id, MII_BMCR); - bmcr |= (BMCR_ANENABLE | BMCR_ANRESTART); -Index: linux-2.6.24.7/include/asm-arm/arch-ixp4xx/platform.h -=================================================================== ---- linux-2.6.24.7.orig/include/asm-arm/arch-ixp4xx/platform.h -+++ linux-2.6.24.7/include/asm-arm/arch-ixp4xx/platform.h -@@ -115,6 +115,8 @@ struct eth_plat_info { - u8 txreadyq; - u8 hwaddr[6]; - u32 phy_mask; -+ u32 quirks; -+#define IXP4XX_ETH_QUIRK_GW23X7 0x00000001 - }; - - /* Information about built-in HSS (synchronous serial) interfaces */ diff --git a/target/linux/ixp4xx/patches-2.6.24/400-dmabounce.patch b/target/linux/ixp4xx/patches-2.6.24/400-dmabounce.patch deleted file mode 100644 index 8beb971fad..0000000000 --- a/target/linux/ixp4xx/patches-2.6.24/400-dmabounce.patch +++ /dev/null @@ -1,31 +0,0 @@ -Index: linux-2.6.24.7/arch/arm/common/dmabounce.c -=================================================================== ---- linux-2.6.24.7.orig/arch/arm/common/dmabounce.c -+++ linux-2.6.24.7/arch/arm/common/dmabounce.c -@@ -117,6 +117,10 @@ alloc_safe_buffer(struct dmabounce_devic - } else if (size <= device_info->large.size) { - pool = &device_info->large; - } else { -+#ifdef CONFIG_DMABOUNCE_DEBUG -+ printk(KERN_INFO "A dma bounce buffer outside the pool size was requested. Requested size was 0x%08X\nThe calling code was :\n", size); -+ dump_stack(); -+#endif - pool = NULL; - } - -Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/Kconfig -=================================================================== ---- linux-2.6.24.7.orig/arch/arm/mach-ixp4xx/Kconfig -+++ linux-2.6.24.7/arch/arm/mach-ixp4xx/Kconfig -@@ -236,6 +236,11 @@ config DMABOUNCE - default y - depends on PCI - -+config DMABOUNCE_DEBUG -+ bool "Enable DMABounce debuging" -+ default n -+ depends on DMABOUNCE -+ - config IXP4XX_INDIRECT_PCI - bool "Use indirect PCI memory access" - depends on PCI diff --git a/target/linux/ixp4xx/patches-2.6.24/401-avila_pci_dev.patch b/target/linux/ixp4xx/patches-2.6.24/401-avila_pci_dev.patch deleted file mode 100644 index 726c22f270..0000000000 --- a/target/linux/ixp4xx/patches-2.6.24/401-avila_pci_dev.patch +++ /dev/null @@ -1,13 +0,0 @@ -Index: linux-2.6.24.7/include/asm-arm/arch-ixp4xx/avila.h -=================================================================== ---- linux-2.6.24.7.orig/include/asm-arm/arch-ixp4xx/avila.h -+++ linux-2.6.24.7/include/asm-arm/arch-ixp4xx/avila.h -@@ -25,7 +25,7 @@ - /* - * AVILA PCI IRQs - */ --#define AVILA_PCI_MAX_DEV 4 -+#define AVILA_PCI_MAX_DEV 6 - #define LOFT_PCI_MAX_DEV 6 - #define AVILA_PCI_IRQ_LINES 4 - diff --git a/target/linux/ixp4xx/patches-2.6.24/402-ixp4xx_ehci_backport.patch b/target/linux/ixp4xx/patches-2.6.24/402-ixp4xx_ehci_backport.patch deleted file mode 100644 index f898c55d30..0000000000 --- a/target/linux/ixp4xx/patches-2.6.24/402-ixp4xx_ehci_backport.patch +++ /dev/null @@ -1,220 +0,0 @@ -Index: linux-2.6.24.7/drivers/usb/host/ehci.h -=================================================================== ---- linux-2.6.24.7.orig/drivers/usb/host/ehci.h -+++ linux-2.6.24.7/drivers/usb/host/ehci.h -@@ -730,6 +730,11 @@ ehci_port_speed(struct ehci_hcd *ehci, u - #define writel_be(val, addr) out_be32((__force unsigned *)addr, val) - #endif - -+#if defined(CONFIG_ARM) && defined(CONFIG_ARCH_IXP4XX) -+#define readl_be(addr) __raw_readl((__force unsigned *)addr) -+#define writel_be(val, addr) __raw_writel(val, (__force unsigned *)addr) -+#endif -+ - static inline unsigned int ehci_readl(const struct ehci_hcd *ehci, - __u32 __iomem * regs) - { -Index: linux-2.6.24.7/drivers/usb/host/ehci-hcd.c -=================================================================== ---- linux-2.6.24.7.orig/drivers/usb/host/ehci-hcd.c -+++ linux-2.6.24.7/drivers/usb/host/ehci-hcd.c -@@ -964,6 +964,11 @@ MODULE_LICENSE ("GPL"); - #define PLATFORM_DRIVER ehci_ppc_soc_driver - #endif - -+#ifdef CONFIG_ARCH_IXP4XX -+#include "ehci-ixp4xx.c" -+#define PLATFORM_DRIVER ixp4xx_ehci_driver -+#endif -+ - #if !defined(PCI_DRIVER) && !defined(PLATFORM_DRIVER) && \ - !defined(PS3_SYSTEM_BUS_DRIVER) - #error "missing bus glue for ehci-hcd" -Index: linux-2.6.24.7/drivers/usb/host/ehci-ixp4xx.c -=================================================================== ---- /dev/null -+++ linux-2.6.24.7/drivers/usb/host/ehci-ixp4xx.c -@@ -0,0 +1,152 @@ -+/* -+ * IXP4XX EHCI Host Controller Driver -+ * -+ * Author: Vladimir Barinov <vbarinov@ru.mvista.com> -+ * -+ * Based on "ehci-fsl.c" by Randy Vinson <rvinson@mvista.com> -+ * -+ * 2007 (c) MontaVista Software, Inc. This file is licensed under -+ * the terms of the GNU General Public License version 2. This program -+ * is licensed "as is" without any warranty of any kind, whether express -+ * or implied. -+ */ -+ -+#include <linux/platform_device.h> -+ -+static int ixp4xx_ehci_init(struct usb_hcd *hcd) -+{ -+ struct ehci_hcd *ehci = hcd_to_ehci(hcd); -+ int retval = 0; -+ -+ ehci->big_endian_desc = 1; -+ ehci->big_endian_mmio = 1; -+ -+ ehci->caps = hcd->regs + 0x100; -+ ehci->regs = hcd->regs + 0x100 -+ + HC_LENGTH(ehci_readl(ehci, &ehci->caps->hc_capbase)); -+ ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params); -+ -+ ehci->is_tdi_rh_tt = 1; -+ ehci_reset(ehci); -+ -+ retval = ehci_init(hcd); -+ if (retval) -+ return retval; -+ -+ ehci_port_power(ehci, 0); -+ -+ return retval; -+} -+ -+static const struct hc_driver ixp4xx_ehci_hc_driver = { -+ .description = hcd_name, -+ .product_desc = "IXP4XX EHCI Host Controller", -+ .hcd_priv_size = sizeof(struct ehci_hcd), -+ .irq = ehci_irq, -+ .flags = HCD_MEMORY | HCD_USB2, -+ .reset = ixp4xx_ehci_init, -+ .start = ehci_run, -+ .stop = ehci_stop, -+ .shutdown = ehci_shutdown, -+ .urb_enqueue = ehci_urb_enqueue, -+ .urb_dequeue = ehci_urb_dequeue, -+ .endpoint_disable = ehci_endpoint_disable, -+ .get_frame_number = ehci_get_frame, -+ .hub_status_data = ehci_hub_status_data, -+ .hub_control = ehci_hub_control, -+#if defined(CONFIG_PM) -+ .bus_suspend = ehci_bus_suspend, -+ .bus_resume = ehci_bus_resume, -+#endif -+}; -+ -+static int ixp4xx_ehci_probe(struct platform_device *pdev) -+{ -+ struct usb_hcd *hcd; -+ const struct hc_driver *driver = &ixp4xx_ehci_hc_driver; -+ struct resource *res; -+ int irq; -+ int retval; -+ -+ if (usb_disabled()) -+ return -ENODEV; -+ -+ res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); -+ if (!res) { -+ dev_err(&pdev->dev, -+ "Found HC with no IRQ. Check %s setup!\n", -+ pdev->dev.bus_id); -+ return -ENODEV; -+ } -+ irq = res->start; -+ -+ hcd = usb_create_hcd(driver, &pdev->dev, pdev->dev.bus_id); -+ if (!hcd) { -+ retval = -ENOMEM; -+ goto fail_create_hcd; -+ } -+ -+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); -+ if (!res) { -+ dev_err(&pdev->dev, -+ "Found HC with no register addr. Check %s setup!\n", -+ pdev->dev.bus_id); -+ retval = -ENODEV; -+ goto fail_request_resource; -+ } -+ hcd->rsrc_start = res->start; -+ hcd->rsrc_len = res->end - res->start + 1; -+ -+ if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, -+ driver->description)) { -+ dev_dbg(&pdev->dev, "controller already in use\n"); -+ retval = -EBUSY; -+ goto fail_request_resource; -+ } -+ -+ hcd->regs = ioremap_nocache(hcd->rsrc_start, hcd->rsrc_len); -+ if (hcd->regs == NULL) { -+ dev_dbg(&pdev->dev, "error mapping memory\n"); -+ retval = -EFAULT; -+ goto fail_ioremap; -+ } -+ -+ retval = usb_add_hcd(hcd, irq, IRQF_SHARED); -+ if (retval) -+ goto fail_add_hcd; -+ -+ return retval; -+ -+fail_add_hcd: -+ iounmap(hcd->regs); -+fail_ioremap: -+ release_mem_region(hcd->rsrc_start, hcd->rsrc_len); -+fail_request_resource: -+ usb_put_hcd(hcd); -+fail_create_hcd: -+ dev_err(&pdev->dev, "init %s fail, %d\n", pdev->dev.bus_id, retval); -+ return retval; -+} -+ -+static int ixp4xx_ehci_remove(struct platform_device *pdev) -+{ -+ struct usb_hcd *hcd = platform_get_drvdata(pdev); -+ -+ usb_remove_hcd(hcd); -+ iounmap(hcd->regs); -+ release_mem_region(hcd->rsrc_start, hcd->rsrc_len); -+ usb_put_hcd(hcd); -+ -+ return 0; -+} -+ -+MODULE_ALIAS("platform:ixp4xx-ehci"); -+ -+static struct platform_driver ixp4xx_ehci_driver = { -+ .probe = ixp4xx_ehci_probe, -+ .remove = ixp4xx_ehci_remove, -+ .driver = { -+ .name = "ixp4xx-ehci", -+// .bus = &platform_bus_type -+ }, -+}; -Index: linux-2.6.24.7/drivers/usb/host/Kconfig -=================================================================== ---- linux-2.6.24.7.orig/drivers/usb/host/Kconfig -+++ linux-2.6.24.7/drivers/usb/host/Kconfig -@@ -69,12 +69,12 @@ config USB_EHCI_TT_NEWSCHED - - config USB_EHCI_BIG_ENDIAN_MMIO - bool -- depends on USB_EHCI_HCD && (PPC_CELLEB || PPC_PS3 || 440EPX) -+ depends on USB_EHCI_HCD && (PPC_CELLEB || PPC_PS3 || 440EPX || ARCH_IXP4XX) - default y - - config USB_EHCI_BIG_ENDIAN_DESC - bool -- depends on USB_EHCI_HCD && 440EPX -+ depends on USB_EHCI_HCD && (440EPX || ARCH_IXP4XX) - default y - - config USB_EHCI_FSL -Index: linux-2.6.24.7/drivers/usb/Kconfig -=================================================================== ---- linux-2.6.24.7.orig/drivers/usb/Kconfig -+++ linux-2.6.24.7/drivers/usb/Kconfig -@@ -49,6 +49,7 @@ config USB_ARCH_HAS_EHCI - boolean - default y if PPC_83xx - default y if SOC_AU1200 -+ default y if ARCH_IXP4XX - default PCI - - # ARM SA1111 chips have a non-PCI based "OHCI-compatible" USB host interface. diff --git a/target/linux/ixp4xx/patches-2.6.24/900-include_bitops_h_from_arch_io_h.patch b/target/linux/ixp4xx/patches-2.6.24/900-include_bitops_h_from_arch_io_h.patch deleted file mode 100644 index 15e09aa7e9..0000000000 --- a/target/linux/ixp4xx/patches-2.6.24/900-include_bitops_h_from_arch_io_h.patch +++ /dev/null @@ -1,13 +0,0 @@ -Index: linux-2.6.24.7/include/asm-arm/arch-ixp4xx/io.h -=================================================================== ---- linux-2.6.24.7.orig/include/asm-arm/arch-ixp4xx/io.h -+++ linux-2.6.24.7/include/asm-arm/arch-ixp4xx/io.h -@@ -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 diff --git a/target/linux/ixp4xx/patches/050-dsmg600_upstream_support.patch b/target/linux/ixp4xx/patches/050-dsmg600_upstream_support.patch deleted file mode 100644 index 5f27aa7999..0000000000 --- a/target/linux/ixp4xx/patches/050-dsmg600_upstream_support.patch +++ /dev/null @@ -1,551 +0,0 @@ -This patch adds support for the D-Link DSM-G600 Rev A. -This is an ARM XScale IXP4xx system relatively similar to -the NSLU2 and NAS-100D already supported by mainline. An -important difference is Gigabit Ethernet support using -the Via Velocity chipset. - -This patch is the combined work of Michael Westerhof and -Alessandro Zummo, with contributions from Michael-Luke -Jones. This version addresses review comments from rmk -and Deepak Saxena. - -Signed-off-by: Michael-Luke Jones <mlj28@cam.ac.uk> -Signed-off-by: Alessandro Zummo <a.zummo@towertech.it> -Signed-off-by: Michael Westerhof <mwester@dls.net> - ---- - arch/arm/mach-ixp4xx/Kconfig | 9 + - arch/arm/mach-ixp4xx/Makefile | 2 - arch/arm/mach-ixp4xx/dsmg600-pci.c | 74 +++++++++++++ - arch/arm/mach-ixp4xx/dsmg600-power.c | 130 ++++++++++++++++++++++++ - arch/arm/mach-ixp4xx/dsmg600-setup.c | 175 +++++++++++++++++++++++++++++++++ - include/asm-arm/arch-ixp4xx/dsmg600.h | 57 ++++++++++ - include/asm-arm/arch-ixp4xx/hardware.h | 1 - include/asm-arm/arch-ixp4xx/irqs.h | 10 + - 8 files changed, 458 insertions(+) - -Index: linux-2.6.21.7/arch/arm/mach-ixp4xx/Kconfig -=================================================================== ---- linux-2.6.21.7.orig/arch/arm/mach-ixp4xx/Kconfig -+++ linux-2.6.21.7/arch/arm/mach-ixp4xx/Kconfig -@@ -89,6 +89,15 @@ config MACH_NAS100D - NAS 100d device. For more information on this platform, - see http://www.nslu2-linux.org/wiki/NAS100d/HomePage - -+config MACH_DSMG600 -+ bool -+ prompt "D-Link DSM-G600 RevA" -+ select PCI -+ help -+ Say 'Y' here if you want your kernel to support D-Link's -+ DSM-G600 RevA device. For more information on this platform, -+ see http://www.nslu2-linux.org/wiki/DSMG600/HomePage -+ - # - # Avila and IXDP share the same source for now. Will change in future - # -Index: linux-2.6.21.7/arch/arm/mach-ixp4xx/Makefile -=================================================================== ---- linux-2.6.21.7.orig/arch/arm/mach-ixp4xx/Makefile -+++ linux-2.6.21.7/arch/arm/mach-ixp4xx/Makefile -@@ -12,6 +12,7 @@ obj-pci-$(CONFIG_ARCH_ADI_COYOTE) += coy - obj-pci-$(CONFIG_MACH_GTWX5715) += gtwx5715-pci.o - obj-pci-$(CONFIG_MACH_NSLU2) += nslu2-pci.o - obj-pci-$(CONFIG_MACH_NAS100D) += nas100d-pci.o -+obj-pci-$(CONFIG_MACH_DSMG600) += dsmg600-pci.o - - obj-y += common.o - -@@ -22,5 +23,6 @@ obj-$(CONFIG_ARCH_ADI_COYOTE) += coyote- - obj-$(CONFIG_MACH_GTWX5715) += gtwx5715-setup.o - obj-$(CONFIG_MACH_NSLU2) += nslu2-setup.o nslu2-power.o - obj-$(CONFIG_MACH_NAS100D) += nas100d-setup.o nas100d-power.o -+obj-$(CONFIG_MACH_DSMG600) += dsmg600-setup.o dsmg600-power.o - - obj-$(CONFIG_PCI) += $(obj-pci-$(CONFIG_PCI)) common-pci.o -Index: linux-2.6.21.7/arch/arm/mach-ixp4xx/dsmg600-pci.c -=================================================================== ---- /dev/null -+++ linux-2.6.21.7/arch/arm/mach-ixp4xx/dsmg600-pci.c -@@ -0,0 +1,74 @@ -+/* -+ * DSM-G600 board-level PCI initialization -+ * -+ * Copyright (C) 2006 Tower Technologies -+ * Author: Alessandro Zummo <a.zummo@towertech.it> -+ * -+ * based on ixdp425-pci.c: -+ * Copyright (C) 2002 Intel Corporation. -+ * Copyright (C) 2003-2004 MontaVista Software, Inc. -+ * -+ * Maintainer: http://www.nslu2-linux.org/ -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ * -+ */ -+ -+#include <linux/pci.h> -+#include <linux/init.h> -+#include <linux/irq.h> -+ -+#include <asm/mach/pci.h> -+#include <asm/mach-types.h> -+ -+void __init dsmg600_pci_preinit(void) -+{ -+ set_irq_type(IRQ_DSMG600_PCI_INTA, IRQT_LOW); -+ set_irq_type(IRQ_DSMG600_PCI_INTB, IRQT_LOW); -+ set_irq_type(IRQ_DSMG600_PCI_INTC, IRQT_LOW); -+ set_irq_type(IRQ_DSMG600_PCI_INTD, IRQT_LOW); -+ set_irq_type(IRQ_DSMG600_PCI_INTE, IRQT_LOW); -+ set_irq_type(IRQ_DSMG600_PCI_INTF, IRQT_LOW); -+ -+ ixp4xx_pci_preinit(); -+} -+ -+static int __init dsmg600_map_irq(struct pci_dev *dev, u8 slot, u8 pin) -+{ -+ static int pci_irq_table[DSMG600_PCI_MAX_DEV][DSMG600_PCI_IRQ_LINES] = -+ { -+ { IRQ_DSMG600_PCI_INTE, -1, -1 }, -+ { IRQ_DSMG600_PCI_INTA, -1, -1 }, -+ { IRQ_DSMG600_PCI_INTB, IRQ_DSMG600_PCI_INTC, IRQ_DSMG600_PCI_INTD }, -+ { IRQ_DSMG600_PCI_INTF, -1, -1 }, -+ }; -+ -+ int irq = -1; -+ -+ if (slot >= 1 && slot <= DSMG600_PCI_MAX_DEV && -+ pin >= 1 && pin <= DSMG600_PCI_IRQ_LINES) -+ irq = pci_irq_table[slot-1][pin-1]; -+ -+ return irq; -+} -+ -+struct hw_pci __initdata dsmg600_pci = { -+ .nr_controllers = 1, -+ .preinit = dsmg600_pci_preinit, -+ .swizzle = pci_std_swizzle, -+ .setup = ixp4xx_setup, -+ .scan = ixp4xx_scan_bus, -+ .map_irq = dsmg600_map_irq, -+}; -+ -+int __init dsmg600_pci_init(void) -+{ -+ if (machine_is_dsmg600()) -+ pci_common_init(&dsmg600_pci); -+ -+ return 0; -+} -+ -+subsys_initcall(dsmg600_pci_init); -Index: linux-2.6.21.7/arch/arm/mach-ixp4xx/dsmg600-power.c -=================================================================== ---- /dev/null -+++ linux-2.6.21.7/arch/arm/mach-ixp4xx/dsmg600-power.c -@@ -0,0 +1,130 @@ -+/* -+ * arch/arm/mach-ixp4xx/dsmg600-power.c -+ * -+ * DSM-G600 Power/Reset driver -+ * Author: Michael Westerhof <mwester@dls.net> -+ * -+ * Based on nslu2-power.c -+ * Copyright (C) 2005 Tower Technologies -+ * Author: Alessandro Zummo <a.zummo@towertech.it> -+ * -+ * which was based on nslu2-io.c -+ * Copyright (C) 2004 Karen Spearel -+ * -+ * Maintainers: http://www.nslu2-linux.org/ -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ * -+ */ -+ -+#include <linux/module.h> -+#include <linux/reboot.h> -+#include <linux/interrupt.h> -+#include <linux/irq.h> -+#include <linux/jiffies.h> -+#include <linux/timer.h> -+ -+#include <asm/mach-types.h> -+ -+extern void ctrl_alt_del(void); -+ -+/* This is used to make sure the power-button pusher is serious. The button -+ * must be held until the value of this counter reaches zero. -+ */ -+static volatile int power_button_countdown; -+ -+/* Must hold the button down for at least this many counts to be processed */ -+#define PBUTTON_HOLDDOWN_COUNT 4 /* 2 secs */ -+ -+static void dsmg600_power_handler(unsigned long data); -+static DEFINE_TIMER(dsmg600_power_timer, dsmg600_power_handler, 0, 0); -+ -+static void dsmg600_power_handler(unsigned long data) -+{ -+ /* This routine is called twice per second to check the -+ * state of the power button. -+ */ -+ -+ if (*IXP4XX_GPIO_GPINR & DSMG600_PB_BM) { -+ -+ /* IO Pin is 1 (button pushed) */ -+ if (power_button_countdown > 0) { -+ power_button_countdown--; -+ } -+ -+ } else { -+ -+ /* Done on button release, to allow for auto-power-on mods. */ -+ if (power_button_countdown == 0) { -+ /* Signal init to do the ctrlaltdel action, this will bypass -+ * init if it hasn't started and do a kernel_restart. -+ */ -+ ctrl_alt_del(); -+ -+ /* Change the state of the power LED to "blink" */ -+ gpio_line_set(DSMG600_LED_PWR_GPIO, IXP4XX_GPIO_LOW); -+ } else { -+ power_button_countdown = PBUTTON_HOLDDOWN_COUNT; -+ } -+ } -+ -+ mod_timer(&dsmg600_power_timer, jiffies + msecs_to_jiffies(500)); -+} -+ -+static irqreturn_t dsmg600_reset_handler(int irq, void *dev_id) -+{ -+ /* This is the paper-clip reset, it shuts the machine down directly. */ -+ machine_power_off(); -+ -+ return IRQ_HANDLED; -+} -+ -+static int __init dsmg600_power_init(void) -+{ -+ if (!(machine_is_dsmg600())) -+ return 0; -+ -+ if (request_irq(DSMG600_RB_IRQ, &dsmg600_reset_handler, -+ IRQF_DISABLED | IRQF_TRIGGER_LOW, "DSM-G600 reset button", -+ NULL) < 0) { -+ -+ printk(KERN_DEBUG "Reset Button IRQ %d not available\n", -+ DSMG600_RB_IRQ); -+ -+ return -EIO; -+ } -+ -+ /* The power button on the D-Link DSM-G600 is on GPIO 15, but -+ * it cannot handle interrupts on that GPIO line. So we'll -+ * have to poll it with a kernel timer. -+ */ -+ -+ /* Make sure that the power button GPIO is set up as an input */ -+ gpio_line_config(DSMG600_PB_GPIO, IXP4XX_GPIO_IN); -+ -+ /* Set the initial value for the power button IRQ handler */ -+ power_button_countdown = PBUTTON_HOLDDOWN_COUNT; -+ -+ mod_timer(&dsmg600_power_timer, jiffies + msecs_to_jiffies(500)); -+ -+ return 0; -+} -+ -+static void __exit dsmg600_power_exit(void) -+{ -+ if (!(machine_is_dsmg600())) -+ return; -+ -+ del_timer_sync(&dsmg600_power_timer); -+ -+ free_irq(DSMG600_RB_IRQ, NULL); -+} -+ -+module_init(dsmg600_power_init); -+module_exit(dsmg600_power_exit); -+ -+MODULE_AUTHOR("Michael Westerhof <mwester@dls.net>"); -+MODULE_DESCRIPTION("DSM-G600 Power/Reset driver"); -+MODULE_LICENSE("GPL"); -Index: linux-2.6.21.7/arch/arm/mach-ixp4xx/dsmg600-setup.c -=================================================================== ---- /dev/null -+++ linux-2.6.21.7/arch/arm/mach-ixp4xx/dsmg600-setup.c -@@ -0,0 +1,175 @@ -+/* -+ * DSM-G600 board-setup -+ * -+ * Copyright (C) 2006 Tower Technologies -+ * Author: Alessandro Zummo <a.zummo@towertech.it> -+ * -+ * based ixdp425-setup.c: -+ * Copyright (C) 2003-2004 MontaVista Software, Inc. -+ * -+ * Author: Alessandro Zummo <a.zummo@towertech.it> -+ * Maintainers: http://www.nslu2-linux.org/ -+ */ -+ -+#include <linux/kernel.h> -+#include <linux/serial.h> -+#include <linux/serial_8250.h> -+ -+#include <asm/mach-types.h> -+#include <asm/mach/arch.h> -+#include <asm/mach/flash.h> -+ -+static struct flash_platform_data dsmg600_flash_data = { -+ .map_name = "cfi_probe", -+ .width = 2, -+}; -+ -+static struct resource dsmg600_flash_resource = { -+ .flags = IORESOURCE_MEM, -+}; -+ -+static struct platform_device dsmg600_flash = { -+ .name = "IXP4XX-Flash", -+ .id = 0, -+ .dev.platform_data = &dsmg600_flash_data, -+ .num_resources = 1, -+ .resource = &dsmg600_flash_resource, -+}; -+ -+static struct ixp4xx_i2c_pins dsmg600_i2c_gpio_pins = { -+ .sda_pin = DSMG600_SDA_PIN, -+ .scl_pin = DSMG600_SCL_PIN, -+}; -+ -+static struct platform_device dsmg600_i2c_controller = { -+ .name = "IXP4XX-I2C", -+ .id = 0, -+ .dev.platform_data = &dsmg600_i2c_gpio_pins, -+}; -+ -+#ifdef CONFIG_LEDS_CLASS -+static struct resource dsmg600_led_resources[] = { -+ { -+ .name = "power", -+ .start = DSMG600_LED_PWR_GPIO, -+ .end = DSMG600_LED_PWR_GPIO, -+ .flags = IXP4XX_GPIO_HIGH, -+ }, -+ { -+ .name = "wlan", -+ .start = DSMG600_LED_WLAN_GPIO, -+ .end = DSMG600_LED_WLAN_GPIO, -+ .flags = IXP4XX_GPIO_LOW, -+ }, -+}; -+ -+static struct platform_device dsmg600_leds = { -+ .name = "IXP4XX-GPIO-LED", -+ .id = -1, -+ .num_resources = ARRAY_SIZE(dsmg600_led_resources), -+ .resource = dsmg600_led_resources, -+}; -+#endif -+ -+static struct resource dsmg600_uart_resources[] = { -+ { -+ .start = IXP4XX_UART1_BASE_PHYS, -+ .end = IXP4XX_UART1_BASE_PHYS + 0x0fff, -+ .flags = IORESOURCE_MEM, -+ }, -+ { -+ .start = IXP4XX_UART2_BASE_PHYS, -+ .end = IXP4XX_UART2_BASE_PHYS + 0x0fff, -+ .flags = IORESOURCE_MEM, -+ } -+}; -+ -+static struct plat_serial8250_port dsmg600_uart_data[] = { -+ { -+ .mapbase = IXP4XX_UART1_BASE_PHYS, -+ .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET, -+ .irq = IRQ_IXP4XX_UART1, -+ .flags = UPF_BOOT_AUTOCONF, -+ .iotype = UPIO_MEM, -+ .regshift = 2, -+ .uartclk = IXP4XX_UART_XTAL, -+ }, -+ { -+ .mapbase = IXP4XX_UART2_BASE_PHYS, -+ .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET, -+ .irq = IRQ_IXP4XX_UART2, -+ .flags = UPF_BOOT_AUTOCONF, -+ .iotype = UPIO_MEM, -+ .regshift = 2, -+ .uartclk = IXP4XX_UART_XTAL, -+ }, -+ { } -+}; -+ -+static struct platform_device dsmg600_uart = { -+ .name = "serial8250", -+ .id = PLAT8250_DEV_PLATFORM, -+ .dev.platform_data = dsmg600_uart_data, -+ .num_resources = ARRAY_SIZE(dsmg600_uart_resources), -+ .resource = dsmg600_uart_resources, -+}; -+ -+static struct platform_device *dsmg600_devices[] __initdata = { -+ &dsmg600_i2c_controller, -+ &dsmg600_flash, -+}; -+ -+static void dsmg600_power_off(void) -+{ -+ /* enable the pwr cntl gpio */ -+ gpio_line_config(DSMG600_PO_GPIO, IXP4XX_GPIO_OUT); -+ -+ /* poweroff */ -+ gpio_line_set(DSMG600_PO_GPIO, IXP4XX_GPIO_HIGH); -+} -+ -+static void __init dsmg600_init(void) -+{ -+ ixp4xx_sys_init(); -+ -+ /* Make sure that GPIO14 and GPIO15 are not used as clocks */ -+ *IXP4XX_GPIO_GPCLKR = 0; -+ -+ dsmg600_flash_resource.start = IXP4XX_EXP_BUS_BASE(0); -+ dsmg600_flash_resource.end = -+ IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1; -+ -+ pm_power_off = dsmg600_power_off; -+ -+ /* The UART is required on the DSM-G600 (Redboot cannot use the -+ * NIC) -- do it here so that it does *not* get removed if -+ * platform_add_devices fails! -+ */ -+ (void)platform_device_register(&dsmg600_uart); -+ -+ platform_add_devices(dsmg600_devices, ARRAY_SIZE(dsmg600_devices)); -+ -+#ifdef CONFIG_LEDS_CLASS -+ /* We don't care whether or not this works. */ -+ (void)platform_device_register(&dsmg600_leds); -+#endif -+} -+ -+static void __init dsmg600_fixup(struct machine_desc *desc, -+ struct tag *tags, char **cmdline, struct meminfo *mi) -+{ -+ /* The xtal on this machine is non-standard. */ -+ ixp4xx_timer_freq = DSMG600_FREQ; -+} -+ -+MACHINE_START(DSMG600, "D-Link DSM-G600 RevA") -+ /* Maintainer: www.nslu2-linux.org */ -+ .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, -+ .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xFFFC, -+ .boot_params = 0x00000100, -+ .fixup = dsmg600_fixup, -+ .map_io = ixp4xx_map_io, -+ .init_irq = ixp4xx_init_irq, -+ .timer = &ixp4xx_timer, -+ .init_machine = dsmg600_init, -+MACHINE_END -Index: linux-2.6.21.7/include/asm-arm/arch-ixp4xx/dsmg600.h -=================================================================== ---- /dev/null -+++ linux-2.6.21.7/include/asm-arm/arch-ixp4xx/dsmg600.h -@@ -0,0 +1,57 @@ -+/* -+ * DSM-G600 platform specific definitions -+ * -+ * Copyright (C) 2006 Tower Technologies -+ * Author: Alessandro Zummo <a.zummo@towertech.it> -+ * -+ * based on ixdp425.h: -+ * Copyright 2004 (C) MontaVista, Software, Inc. -+ * -+ * This file is licensed under the terms of the GNU General Public -+ * License version 2. This program is licensed "as is" without any -+ * warranty of any kind, whether express or implied. -+ */ -+ -+#ifndef __ASM_ARCH_HARDWARE_H__ -+#error "Do not include this directly, instead #include <asm/hardware.h>" -+#endif -+ -+#define DSMG600_SDA_PIN 5 -+#define DSMG600_SCL_PIN 4 -+ -+/* -+ * DSMG600 PCI IRQs -+ */ -+#define DSMG600_PCI_MAX_DEV 4 -+#define DSMG600_PCI_IRQ_LINES 3 -+ -+ -+/* PCI controller GPIO to IRQ pin mappings */ -+#define DSMG600_PCI_INTA_PIN 11 -+#define DSMG600_PCI_INTB_PIN 10 -+#define DSMG600_PCI_INTC_PIN 9 -+#define DSMG600_PCI_INTD_PIN 8 -+#define DSMG600_PCI_INTE_PIN 7 -+#define DSMG600_PCI_INTF_PIN 6 -+ -+/* DSM-G600 Timer Setting */ -+#define DSMG600_FREQ 66000000 -+ -+/* Buttons */ -+ -+#define DSMG600_PB_GPIO 15 /* power button */ -+#define DSMG600_PB_BM (1L << DSMG600_PB_GPIO) -+ -+#define DSMG600_RB_GPIO 3 /* reset button */ -+ -+#define DSMG600_RB_IRQ IRQ_IXP4XX_GPIO3 -+ -+#define DSMG600_PO_GPIO 2 /* power off */ -+ -+/* LEDs */ -+ -+#define DSMG600_LED_PWR_GPIO 0 -+#define DSMG600_LED_PWR_BM (1L << DSMG600_LED_PWR_GPIO) -+ -+#define DSMG600_LED_WLAN_GPIO 14 -+#define DSMG600_LED_WLAN_BM (1L << DSMG600_LED_WLAN_GPIO) -Index: linux-2.6.21.7/include/asm-arm/arch-ixp4xx/hardware.h -=================================================================== ---- linux-2.6.21.7.orig/include/asm-arm/arch-ixp4xx/hardware.h -+++ linux-2.6.21.7/include/asm-arm/arch-ixp4xx/hardware.h -@@ -47,5 +47,6 @@ extern unsigned int processor_id; - #include "prpmc1100.h" - #include "nslu2.h" - #include "nas100d.h" -+#include "dsmg600.h" - - #endif /* _ASM_ARCH_HARDWARE_H */ -Index: linux-2.6.21.7/include/asm-arm/arch-ixp4xx/irqs.h -=================================================================== ---- linux-2.6.21.7.orig/include/asm-arm/arch-ixp4xx/irqs.h -+++ linux-2.6.21.7/include/asm-arm/arch-ixp4xx/irqs.h -@@ -118,4 +118,14 @@ - #define IRQ_NAS100D_PCI_INTD IRQ_IXP4XX_GPIO8 - #define IRQ_NAS100D_PCI_INTE IRQ_IXP4XX_GPIO7 - -+/* -+ * D-Link DSM-G600 RevA board IRQs -+ */ -+#define IRQ_DSMG600_PCI_INTA IRQ_IXP4XX_GPIO11 -+#define IRQ_DSMG600_PCI_INTB IRQ_IXP4XX_GPIO10 -+#define IRQ_DSMG600_PCI_INTC IRQ_IXP4XX_GPIO9 -+#define IRQ_DSMG600_PCI_INTD IRQ_IXP4XX_GPIO8 -+#define IRQ_DSMG600_PCI_INTE IRQ_IXP4XX_GPIO7 -+#define IRQ_DSMG600_PCI_INTF IRQ_IXP4XX_GPIO6 -+ - #endif diff --git a/target/linux/ixp4xx/patches/070-ixp4xx_freq_fixup.patch b/target/linux/ixp4xx/patches/070-ixp4xx_freq_fixup.patch deleted file mode 100644 index 297571283d..0000000000 --- a/target/linux/ixp4xx/patches/070-ixp4xx_freq_fixup.patch +++ /dev/null @@ -1,131 +0,0 @@ -This patch is required as the frequency fixup in nslu2_init does not -run sufficiently early in the boot sequence to take effect. In -addition the dsmg600 setup code behaviour has been improved such -that a 'fixup' routine is avoided. - -Signed-off-by: Michael-Luke Jones <mlj28@cam.ac.uk> - -Index: linux-2.6.21.7/arch/arm/mach-ixp4xx/nslu2-setup.c -=================================================================== ---- linux-2.6.21.7.orig/arch/arm/mach-ixp4xx/nslu2-setup.c -+++ linux-2.6.21.7/arch/arm/mach-ixp4xx/nslu2-setup.c -@@ -22,6 +22,7 @@ - #include <asm/mach-types.h> - #include <asm/mach/arch.h> - #include <asm/mach/flash.h> -+#include <asm/mach/time.h> - - static struct flash_platform_data nslu2_flash_data = { - .map_name = "cfi_probe", -@@ -157,10 +158,21 @@ static void nslu2_power_off(void) - gpio_line_set(NSLU2_PO_GPIO, IXP4XX_GPIO_HIGH); - } - --static void __init nslu2_init(void) -+static void __init nslu2_timer_init(void) - { -- ixp4xx_timer_freq = NSLU2_FREQ; -+ /* The xtal on this machine is non-standard. */ -+ ixp4xx_timer_freq = NSLU2_FREQ; -+ -+ /* Call standard timer_init function. */ -+ ixp4xx_timer_init(); -+} - -+static struct sys_timer nslu2_timer = { -+ .init = nslu2_timer_init, -+}; -+ -+static void __init nslu2_init(void) -+{ - ixp4xx_sys_init(); - - nslu2_flash_resource.start = IXP4XX_EXP_BUS_BASE(0); -@@ -185,6 +197,6 @@ MACHINE_START(NSLU2, "Linksys NSLU2") - .boot_params = 0x00000100, - .map_io = ixp4xx_map_io, - .init_irq = ixp4xx_init_irq, -- .timer = &ixp4xx_timer, -+ .timer = &nslu2_timer, - .init_machine = nslu2_init, - MACHINE_END -Index: linux-2.6.21.7/arch/arm/mach-ixp4xx/common.c -=================================================================== ---- linux-2.6.21.7.orig/arch/arm/mach-ixp4xx/common.c -+++ linux-2.6.21.7/arch/arm/mach-ixp4xx/common.c -@@ -269,7 +269,7 @@ static struct irqaction ixp4xx_timer_irq - .handler = ixp4xx_timer_interrupt, - }; - --static void __init ixp4xx_timer_init(void) -+void __init ixp4xx_timer_init(void) - { - /* Clear Pending Interrupt by writing '1' to it */ - *IXP4XX_OSST = IXP4XX_OSST_TIMER_1_PEND; -Index: linux-2.6.21.7/include/asm-arm/arch-ixp4xx/platform.h -=================================================================== ---- linux-2.6.21.7.orig/include/asm-arm/arch-ixp4xx/platform.h -+++ linux-2.6.21.7/include/asm-arm/arch-ixp4xx/platform.h -@@ -113,6 +113,7 @@ extern unsigned long ixp4xx_timer_freq; - extern void ixp4xx_map_io(void); - extern void ixp4xx_init_irq(void); - extern void ixp4xx_sys_init(void); -+extern void ixp4xx_timer_init(void); - extern struct sys_timer ixp4xx_timer; - extern void ixp4xx_pci_preinit(void); - struct pci_sys_data; -Index: linux-2.6.21.7/arch/arm/mach-ixp4xx/dsmg600-setup.c -=================================================================== ---- linux-2.6.21.7.orig/arch/arm/mach-ixp4xx/dsmg600-setup.c -+++ linux-2.6.21.7/arch/arm/mach-ixp4xx/dsmg600-setup.c -@@ -18,6 +18,7 @@ - #include <asm/mach-types.h> - #include <asm/mach/arch.h> - #include <asm/mach/flash.h> -+#include <asm/mach/time.h> - - static struct flash_platform_data dsmg600_flash_data = { - .map_name = "cfi_probe", -@@ -128,6 +129,19 @@ static void dsmg600_power_off(void) - gpio_line_set(DSMG600_PO_GPIO, IXP4XX_GPIO_HIGH); - } - -+static void __init dsmg600_timer_init(void) -+{ -+ /* The xtal on this machine is non-standard. */ -+ ixp4xx_timer_freq = DSMG600_FREQ; -+ -+ /* Call standard timer_init function. */ -+ ixp4xx_timer_init(); -+} -+ -+static struct sys_timer dsmg600_timer = { -+ .init = dsmg600_timer_init, -+}; -+ - static void __init dsmg600_init(void) - { - ixp4xx_sys_init(); -@@ -155,21 +169,13 @@ static void __init dsmg600_init(void) - #endif - } - --static void __init dsmg600_fixup(struct machine_desc *desc, -- struct tag *tags, char **cmdline, struct meminfo *mi) --{ -- /* The xtal on this machine is non-standard. */ -- ixp4xx_timer_freq = DSMG600_FREQ; --} -- - MACHINE_START(DSMG600, "D-Link DSM-G600 RevA") - /* Maintainer: www.nslu2-linux.org */ - .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, - .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xFFFC, - .boot_params = 0x00000100, -- .fixup = dsmg600_fixup, - .map_io = ixp4xx_map_io, - .init_irq = ixp4xx_init_irq, -- .timer = &ixp4xx_timer, -+ .timer = &dsmg600_timer, - .init_machine = dsmg600_init, - MACHINE_END diff --git a/target/linux/ixp4xx/patches/080-trivial_nslu2_nas100d_cleanup.patch b/target/linux/ixp4xx/patches/080-trivial_nslu2_nas100d_cleanup.patch deleted file mode 100644 index 13ae639826..0000000000 --- a/target/linux/ixp4xx/patches/080-trivial_nslu2_nas100d_cleanup.patch +++ /dev/null @@ -1,196 +0,0 @@ -This trivial patch updates the nslu2 and nas-100d headers to -remove pointless GPIO defines, and updates nslu2-setup.c -accordingly. In addition minor style cleanups to some comments -are included. - -Signed-off-by: Michael-Luke Jones <mlj28@cam.ac.uk> - -Index: linux-2.6.21.7/arch/arm/mach-ixp4xx/nslu2-setup.c -=================================================================== ---- linux-2.6.21.7.orig/arch/arm/mach-ixp4xx/nslu2-setup.c -+++ linux-2.6.21.7/arch/arm/mach-ixp4xx/nslu2-setup.c -@@ -50,26 +50,26 @@ static struct ixp4xx_i2c_pins nslu2_i2c_ - static struct resource nslu2_led_resources[] = { - { - .name = "ready", /* green led */ -- .start = NSLU2_LED_GRN, -- .end = NSLU2_LED_GRN, -+ .start = NSLU2_LED_GRN_GPIO, -+ .end = NSLU2_LED_GRN_GPIO, - .flags = IXP4XX_GPIO_HIGH, - }, - { - .name = "status", /* red led */ -- .start = NSLU2_LED_RED, -- .end = NSLU2_LED_RED, -+ .start = NSLU2_LED_RED_GPIO, -+ .end = NSLU2_LED_RED_GPIO, - .flags = IXP4XX_GPIO_HIGH, - }, - { - .name = "disk-1", -- .start = NSLU2_LED_DISK1, -- .end = NSLU2_LED_DISK1, -+ .start = NSLU2_LED_DISK1_GPIO, -+ .end = NSLU2_LED_DISK1_GPIO, - .flags = IXP4XX_GPIO_LOW, - }, - { - .name = "disk-2", -- .start = NSLU2_LED_DISK2, -- .end = NSLU2_LED_DISK2, -+ .start = NSLU2_LED_DISK2_GPIO, -+ .end = NSLU2_LED_DISK2_GPIO, - .flags = IXP4XX_GPIO_LOW, - }, - }; -@@ -181,7 +181,8 @@ static void __init nslu2_init(void) - - pm_power_off = nslu2_power_off; - -- /* This is only useful on a modified machine, but it is valuable -+ /* -+ * This is only useful on a modified machine, but it is valuable - * to have it first in order to see debug messages, and so that - * it does *not* get removed if platform_add_devices fails! - */ -Index: linux-2.6.21.7/include/asm-arm/arch-ixp4xx/nslu2.h -=================================================================== ---- linux-2.6.21.7.orig/include/asm-arm/arch-ixp4xx/nslu2.h -+++ linux-2.6.21.7/include/asm-arm/arch-ixp4xx/nslu2.h -@@ -9,7 +9,7 @@ - * based on ixdp425.h: - * Copyright 2004 (c) MontaVista, Software, Inc. - * -- * This file is licensed under the terms of the GNU General Public -+ * This file is licensed under the terms of the GNU General Public - * License version 2. This program is licensed "as is" without any - * warranty of any kind, whether express or implied. - */ -@@ -34,36 +34,14 @@ - #define NSLU2_PCI_INTC_PIN 9 - #define NSLU2_PCI_INTD_PIN 8 - -- - /* NSLU2 Timer */ - #define NSLU2_FREQ 66000000 --#define NSLU2_CLOCK_TICK_RATE (((NSLU2_FREQ / HZ & ~IXP4XX_OST_RELOAD_MASK) + 1) * HZ) --#define NSLU2_CLOCK_TICKS_PER_USEC ((NSLU2_CLOCK_TICK_RATE + USEC_PER_SEC/2) / USEC_PER_SEC) -- --/* GPIO */ -- --#define NSLU2_GPIO0 0 --#define NSLU2_GPIO1 1 --#define NSLU2_GPIO2 2 --#define NSLU2_GPIO3 3 --#define NSLU2_GPIO4 4 --#define NSLU2_GPIO5 5 --#define NSLU2_GPIO6 6 --#define NSLU2_GPIO7 7 --#define NSLU2_GPIO8 8 --#define NSLU2_GPIO9 9 --#define NSLU2_GPIO10 10 --#define NSLU2_GPIO11 11 --#define NSLU2_GPIO12 12 --#define NSLU2_GPIO13 13 --#define NSLU2_GPIO14 14 --#define NSLU2_GPIO15 15 - - /* Buttons */ - --#define NSLU2_PB_GPIO NSLU2_GPIO5 --#define NSLU2_PO_GPIO NSLU2_GPIO8 /* power off */ --#define NSLU2_RB_GPIO NSLU2_GPIO12 -+#define NSLU2_PB_GPIO 5 -+#define NSLU2_PO_GPIO 8 /* power off */ -+#define NSLU2_RB_GPIO 12 - - #define NSLU2_PB_IRQ IRQ_IXP4XX_GPIO5 - #define NSLU2_RB_IRQ IRQ_IXP4XX_GPIO12 -@@ -79,16 +57,16 @@ - - /* LEDs */ - --#define NSLU2_LED_RED NSLU2_GPIO0 --#define NSLU2_LED_GRN NSLU2_GPIO1 -+#define NSLU2_LED_RED_GPIO 0 -+#define NSLU2_LED_GRN_GPIO 1 - --#define NSLU2_LED_RED_BM (1L << NSLU2_LED_RED) --#define NSLU2_LED_GRN_BM (1L << NSLU2_LED_GRN) -+#define NSLU2_LED_RED_BM (1L << NSLU2_LED_RED_GPIO) -+#define NSLU2_LED_GRN_BM (1L << NSLU2_LED_GRN_GPIO) - --#define NSLU2_LED_DISK1 NSLU2_GPIO3 --#define NSLU2_LED_DISK2 NSLU2_GPIO2 -+#define NSLU2_LED_DISK1_GPIO 3 -+#define NSLU2_LED_DISK2_GPIO 2 - --#define NSLU2_LED_DISK1_BM (1L << NSLU2_GPIO2) --#define NSLU2_LED_DISK2_BM (1L << NSLU2_GPIO3) -+#define NSLU2_LED_DISK1_BM (1L << NSLU2_LED_DISK1_GPIO) -+#define NSLU2_LED_DISK2_BM (1L << NSLU2_LED_DISK2_GPIO) - - -Index: linux-2.6.21.7/include/asm-arm/arch-ixp4xx/nas100d.h -=================================================================== ---- linux-2.6.21.7.orig/include/asm-arm/arch-ixp4xx/nas100d.h -+++ linux-2.6.21.7/include/asm-arm/arch-ixp4xx/nas100d.h -@@ -10,7 +10,7 @@ - * based on ixdp425.h: - * Copyright 2004 (c) MontaVista, Software, Inc. - * -- * This file is licensed under the terms of the GNU General Public -+ * This file is licensed under the terms of the GNU General Public - * License version 2. This program is licensed "as is" without any - * warranty of any kind, whether express or implied. - */ -@@ -36,31 +36,11 @@ - #define NAS100D_PCI_INTD_PIN 8 - #define NAS100D_PCI_INTE_PIN 7 - --/* GPIO */ -- --#define NAS100D_GPIO0 0 --#define NAS100D_GPIO1 1 --#define NAS100D_GPIO2 2 --#define NAS100D_GPIO3 3 --#define NAS100D_GPIO4 4 --#define NAS100D_GPIO5 5 --#define NAS100D_GPIO6 6 --#define NAS100D_GPIO7 7 --#define NAS100D_GPIO8 8 --#define NAS100D_GPIO9 9 --#define NAS100D_GPIO10 10 --#define NAS100D_GPIO11 11 --#define NAS100D_GPIO12 12 --#define NAS100D_GPIO13 13 --#define NAS100D_GPIO14 14 --#define NAS100D_GPIO15 15 -- -- - /* Buttons */ - --#define NAS100D_PB_GPIO NAS100D_GPIO14 --#define NAS100D_RB_GPIO NAS100D_GPIO4 --#define NAS100D_PO_GPIO NAS100D_GPIO12 /* power off */ -+#define NAS100D_PB_GPIO 14 -+#define NAS100D_RB_GPIO 4 -+#define NAS100D_PO_GPIO 12 /* power off */ - - #define NAS100D_PB_IRQ IRQ_IXP4XX_GPIO14 - #define NAS100D_RB_IRQ IRQ_IXP4XX_GPIO4 -Index: linux-2.6.21.7/arch/arm/mach-ixp4xx/nas100d-setup.c -=================================================================== ---- linux-2.6.21.7.orig/arch/arm/mach-ixp4xx/nas100d-setup.c -+++ linux-2.6.21.7/arch/arm/mach-ixp4xx/nas100d-setup.c -@@ -155,7 +155,8 @@ static void __init nas100d_init(void) - - pm_power_off = nas100d_power_off; - -- /* This is only useful on a modified machine, but it is valuable -+ /* -+ * This is only useful on a modified machine, but it is valuable - * to have it first in order to see debug messages, and so that - * it does *not* get removed if platform_add_devices fails! - */ diff --git a/target/linux/ixp4xx/patches/100-npe_driver.patch b/target/linux/ixp4xx/patches/100-npe_driver.patch deleted file mode 100644 index 987e349827..0000000000 --- a/target/linux/ixp4xx/patches/100-npe_driver.patch +++ /dev/null @@ -1,4878 +0,0 @@ -Index: linux-2.6.21.7/Documentation/networking/ixp4xx/IxNpeMicrocode.h -=================================================================== ---- /dev/null -+++ linux-2.6.21.7/Documentation/networking/ixp4xx/IxNpeMicrocode.h -@@ -0,0 +1,143 @@ -+/* -+ * IxNpeMicrocode.h - Headerfile for compiling the Intel microcode C file -+ * -+ * Copyright (C) 2006 Christian Hohnstaedt <chohnstaedt@innominate.com> -+ * -+ * This file is released under the GPLv2 -+ * -+ * -+ * compile with -+ * -+ * gcc -Wall IxNpeMicrocode.c -o IxNpeMicrocode -+ * -+ * Executing the resulting binary on your build-host creates the -+ * "NPE-[ABC].xxxxxxxx" files containing the selected microcode -+ * -+ * fetch the IxNpeMicrocode.c from the Intel Access Library. -+ * It will include this header. -+ * -+ * select Images for every NPE from the following -+ * (used C++ comments for easy uncommenting ....) -+ */ -+ -+// #define IX_NPEDL_NPEIMAGE_NPEA_ETH_SPAN_MASK_FIREWALL_VLAN_QOS_HDR_CONV_EXTMIB -+// #define IX_NPEDL_NPEIMAGE_NPEA_ETH_SPAN_VLAN_QOS_HDR_CONV_EXTMIB -+// #define IX_NPEDL_NPEIMAGE_NPEA_ETH_LEARN_FILTER_SPAN_MASK_FIREWALL_VLAN_QOS_EXTMIB -+// #define IX_NPEDL_NPEIMAGE_NPEA_HSS_TSLOT_SWITCH -+// #define IX_NPEDL_NPEIMAGE_NPEA_ETH_SPAN_FIREWALL_VLAN_QOS_HDR_CONV -+// #define IX_NPEDL_NPEIMAGE_NPEA_ETH_LEARN_FILTER_SPAN_FIREWALL_VLAN_QOS -+// #define IX_NPEDL_NPEIMAGE_NPEA_ETH_LEARN_FILTER_SPAN_FIREWALL -+// #define IX_NPEDL_NPEIMAGE_NPEA_HSS_2_PORT -+// #define IX_NPEDL_NPEIMAGE_NPEA_DMA -+// #define IX_NPEDL_NPEIMAGE_NPEA_ATM_MPHY_12_PORT -+// #define IX_NPEDL_NPEIMAGE_NPEA_HSS0_ATM_MPHY_1_PORT -+// #define IX_NPEDL_NPEIMAGE_NPEA_HSS0_ATM_SPHY_1_PORT -+// #define IX_NPEDL_NPEIMAGE_NPEA_HSS0 -+// #define IX_NPEDL_NPEIMAGE_NPEA_WEP -+ -+ -+// #define IX_NPEDL_NPEIMAGE_NPEB_ETH_SPAN_MASK_FIREWALL_VLAN_QOS_HDR_CONV_EXTMIB -+//#define IX_NPEDL_NPEIMAGE_NPEB_ETH_SPAN_VLAN_QOS_HDR_CONV_EXTMIB -+// #define IX_NPEDL_NPEIMAGE_NPEB_ETH_LEARN_FILTER_SPAN_MASK_FIREWALL_VLAN_QOS_EXTMIB -+// #define IX_NPEDL_NPEIMAGE_NPEB_DMA -+// #define IX_NPEDL_NPEIMAGE_NPEB_ETH_SPAN_FIREWALL_VLAN_QOS_HDR_CONV -+// #define IX_NPEDL_NPEIMAGE_NPEB_ETH_LEARN_FILTER_SPAN_FIREWALL_VLAN_QOS -+ #define IX_NPEDL_NPEIMAGE_NPEB_ETH_LEARN_FILTER_SPAN_FIREWALL -+ -+ -+// #define IX_NPEDL_NPEIMAGE_NPEC_ETH_SPAN_MASK_FIREWALL_VLAN_QOS_HDR_CONV_EXTMIB -+// #define IX_NPEDL_NPEIMAGE_NPEC_ETH_SPAN_VLAN_QOS_HDR_CONV_EXTMIB -+// #define IX_NPEDL_NPEIMAGE_NPEC_ETH_LEARN_FILTER_SPAN_MASK_FIREWALL_VLAN_QOS_EXTMIB -+// #define IX_NPEDL_NPEIMAGE_NPEC_DMA -+// #define IX_NPEDL_NPEIMAGE_NPEC_CRYPTO_AES_ETH_LEARN_FILTER_SPAN -+// #define IX_NPEDL_NPEIMAGE_NPEC_CRYPTO_AES_ETH_LEARN_FILTER_FIREWALL -+ #define IX_NPEDL_NPEIMAGE_NPEC_CRYPTO_AES_CCM_ETH -+// #define IX_NPEDL_NPEIMAGE_NPEC_CRYPTO_ETH_LEARN_FILTER_SPAN_FIREWALL -+// #define IX_NPEDL_NPEIMAGE_NPEC_ETH_SPAN_FIREWALL_VLAN_QOS_HDR_CONV -+// #define IX_NPEDL_NPEIMAGE_NPEC_ETH_LEARN_FILTER_SPAN_FIREWALL_VLAN_QOS -+// #define IX_NPEDL_NPEIMAGE_NPEC_ETH_LEARN_FILTER_SPAN_FIREWALL -+ -+ -+#include <stdio.h> -+#include <unistd.h> -+#include <stdlib.h> -+#include <netinet/in.h> -+#include <sys/types.h> -+#include <sys/stat.h> -+#include <fcntl.h> -+#include <errno.h> -+#include <endian.h> -+#include <byteswap.h> -+#include <string.h> -+ -+#if __BYTE_ORDER == __LITTLE_ENDIAN -+#define to_le32(x) (x) -+#define to_be32(x) bswap_32(x) -+#else -+#define to_be32(x) (x) -+#define to_le32(x) bswap_32(x) -+#endif -+ -+struct dl_image { -+ unsigned magic; -+ unsigned id; -+ unsigned size; -+ unsigned data[0]; -+}; -+ -+const unsigned IxNpeMicrocode_array[]; -+ -+int main(int argc, char *argv[]) -+{ -+ struct dl_image *image = (struct dl_image *)IxNpeMicrocode_array; -+ int imgsiz, i, fd, cnt; -+ const unsigned *arrayptr = IxNpeMicrocode_array; -+ const char *names[] = { "IXP425", "IXP465", "unknown" }; -+ int bigendian = 1; -+ -+ if (argc > 1) { -+ if (!strcmp(argv[1], "-le")) -+ bigendian = 0; -+ else if (!strcmp(argv[1], "-be")) -+ bigendian = 1; -+ else { -+ printf("Usage: %s <-le|-be>\n", argv[0]); -+ return EXIT_FAILURE; -+ } -+ } -+ -+ for (image = (struct dl_image *)arrayptr, cnt=0; -+ (image->id != 0xfeedf00d) && (image->magic == 0xfeedf00d); -+ image = (struct dl_image *)(arrayptr), cnt++) -+ { -+ unsigned char field[4]; -+ imgsiz = image->size + 3; -+ *(unsigned*)field = to_be32(image->id); -+ char filename[40], slnk[10]; -+ -+ sprintf(filename, "NPE-%c.%08x", (field[0] & 0xf) + 'A', -+ image->id); -+ sprintf(slnk, "NPE-%c", (field[0] & 0xf) + 'A'); -+ printf("Writing image: %s.NPE_%c Func: %2x Rev: %02x.%02x " -+ "Size: %5d to: '%s'\n", -+ names[field[0] >> 4], (field[0] & 0xf) + 'A', -+ field[1], field[2], field[3], imgsiz*4, filename); -+ fd = open(filename, O_CREAT | O_RDWR | O_TRUNC, 0644); -+ if (fd >= 0) { -+ for (i=0; i<imgsiz; i++) { -+ *(unsigned*)field = bigendian ? -+ to_be32(arrayptr[i]) : -+ to_le32(arrayptr[i]); -+ write(fd, field, sizeof(field)); -+ } -+ close(fd); -+ unlink(slnk); -+ symlink(filename, slnk); -+ } else { -+ perror(filename); -+ } -+ arrayptr += imgsiz; -+ } -+ close(fd); -+ return 0; -+} -Index: linux-2.6.21.7/Documentation/networking/ixp4xx/README -=================================================================== ---- /dev/null -+++ linux-2.6.21.7/Documentation/networking/ixp4xx/README -@@ -0,0 +1,62 @@ -+Informations about the Networking Driver using the IXP4XX CPU internal NPEs -+and Queue manager. -+ -+If this driver is used, the IAL (Intel Access Library) must not be loaded. -+However, the IAL may be loaded, if this Modules are unloaded: -+ ixp4xx_npe.ko, ixp4xx_qmgr.ko ixp4xx_mac.ko -+ -+This also means that HW crypto accelleration does NOT work when using this -+driver, unless I have finished my crypto driver for NPE-C -+ -+ -+Adoption to your custom board: -+------------------------------ -+use "arch/arm/mach-ixp4xx/ixdp425-setup.c" as template: -+ -+in "static struct mac_plat_info" adopt the entry "phy_id" to your needs -+(Ask your hardware designer about the PHY id) -+ -+The order of "&mac0" and "&mac1" in the "struct platform_device" -+determines which of them becomes eth0 and eth1 -+ -+ -+The Microcode: -+--------------- -+Solution 1) -+ Configure "CONFIG_HOTPLUG" and "CONFIG_FW_LOADER" and configure -+ IXP4XX_NPE as module. -+ The default hotplug script will load the Firmware from -+ /usr/lib/hotplug/firmware/NPE-[ABC] -+ see Documentation/firmware_class/hotplug-script -+ -+ You should take care, that $ACTION is "add" and $SUBSYSTEM is "firmware" -+ to avoid unnessecary calls: -+ test $ACTION = "remove" -o $SUBSYSTEM != "firmware" && exit -+ -+Solution 2) -+ create a char-dev: "mknod /dev/misc/npe c 10 184" -+ cat the Microcode into it: -+ cat /usr/lib/hotplug/firmware/NPE-* > /dev/misc/npe -+ This also works if the driver is linked to the kernel -+ -+ Having a mix of both (e.g. solution 1 for NPE-B and solution 2 for NPE-C) -+ is perfectly ok and works. -+ -+ The state of the NPEs can be seen and changed at: -+ /sys/bus/platform/devices/ixp4xx_npe.X/state -+ -+ -+Obtaining the Microcode: -+------------------------ -+1) IxNpeMicrocode.h in this directory: -+ Download IPL_IXP400NPELIBRARYWITHCRYPTO-2_1.ZIP from Intel -+ It unpacks the Microcode IxNpeMicrocode.c -+ Read the Licence ! -+ Compile it with "gcc -Wall IxNpeMicrocode.c -o IxNpeMicrocode" on your host. -+ The resulting images can be moved to "/usr/lib/hotplug/firmware" -+ -+2) mc_grab.c in this directory: -+ Compile and execute it either on the host or on the target -+ to grab the microcode from a binary image like the RedBoot bootloader. -+ -+ -Index: linux-2.6.21.7/Documentation/networking/ixp4xx/mc_grab.c -=================================================================== ---- /dev/null -+++ linux-2.6.21.7/Documentation/networking/ixp4xx/mc_grab.c -@@ -0,0 +1,97 @@ -+/* -+ * mc_grab.c - grabs IXP4XX microcode from a binary datastream -+ * e.g. The redboot bootloader.... -+ * -+ * usage: mc_grab 1010200 2010200 < /dev/mtd/0 > /dev/misc/npe -+ * -+ * Copyright (C) 2006 Christian Hohnstaedt <chohnstaedt@innominate.com> -+ * -+ * This file is released under the GPLv2 -+ */ -+ -+ -+#include <stdlib.h> -+#include <stdio.h> -+#include <unistd.h> -+#include <netinet/in.h> -+#include <sys/types.h> -+#include <sys/stat.h> -+#include <fcntl.h> -+#include <errno.h> -+#include <string.h> -+ -+#define MAX_IMG 6 -+ -+static void print_mc_info(unsigned id, int siz) -+{ -+ unsigned char buf[sizeof(unsigned)]; -+ *(unsigned*)buf = id; -+ unsigned idx; -+ const char *names[] = { "IXP425", "IXP465", "unknown" }; -+ -+ idx = (buf[0] >> 4) < 2 ? (buf[0] >> 4) : 2; -+ -+ fprintf(stderr, "Device: %s:NPE_%c Func: %2x Rev: %02x.%02x " -+ "Size: %5d bytes ID:%08x\n", names[idx], (buf[0] & 0xf)+'A', -+ buf[1], buf[2], buf[3], siz*4, ntohl(id)); -+} -+ -+int main(int argc, char *argv[]) -+{ -+ int i,j; -+ unsigned char buf[sizeof(unsigned)]; -+ unsigned magic = htonl(0xfeedf00d); -+ unsigned id, my_ids[MAX_IMG+1], siz, sizbe; -+ int ret=1, verbose=0; -+ -+ for (i=0, j=0; i<argc-1 && j<MAX_IMG; i++) { -+ if (!strcmp(argv[i+1], "-v")) -+ verbose = 1; -+ else -+ my_ids[j++] = htonl(strtoul(argv[i+1], NULL, 16)); -+ } -+ my_ids[j] = 0; -+ if (my_ids[0] == 0 && !verbose) { -+ fprintf(stderr, "Usage: %s <-v> [ID1] [ID2] [IDn]\n", argv[0]); -+ return 1; -+ } -+ -+ while ((ret=read(0, buf, sizeof(unsigned))) == sizeof(unsigned)) { -+ if (*(unsigned*)buf != magic) -+ continue; -+ if ((ret=read(0, buf, sizeof(unsigned))) != sizeof(unsigned) ) -+ break; -+ id = *(unsigned*)buf; -+ -+ if (read(0, buf, sizeof(siz)) != sizeof(siz) ) -+ break; -+ sizbe = *(unsigned*)buf; -+ siz = ntohl(sizbe); -+ -+ if (verbose) -+ print_mc_info(id, siz); -+ -+ for(i=0; my_ids[i]; i++) -+ if (id == my_ids[i]) -+ break; -+ if (!my_ids[i]) -+ continue; -+ -+ if (!verbose) -+ print_mc_info(id, siz); -+ -+ write(1, &magic, sizeof(magic)); -+ write(1, &id, sizeof(id)); -+ write(1, &sizbe, sizeof(sizbe)); -+ for (i=0; i<siz; i++) { -+ if (read(0, buf, sizeof(unsigned)) != sizeof(unsigned)) -+ break; -+ write(1, buf, sizeof(unsigned)); -+ } -+ if (i != siz) -+ break; -+ } -+ if (ret) -+ fprintf(stderr, "Error reading Microcode\n"); -+ return ret; -+} -Index: linux-2.6.21.7/arch/arm/mach-ixp4xx/common.c -=================================================================== ---- linux-2.6.21.7.orig/arch/arm/mach-ixp4xx/common.c -+++ linux-2.6.21.7/arch/arm/mach-ixp4xx/common.c -@@ -357,6 +357,90 @@ static struct platform_device *ixp46x_de - &ixp46x_i2c_controller - }; - -+static struct npe_plat_data npea = { -+ .name = "NPE-A", -+ .data_size = 0x800, -+ .inst_size = 0x1000, -+ .id = 0, -+}; -+ -+static struct npe_plat_data npeb = { -+ .name = "NPE-B", -+ .data_size = 0x800, -+ .inst_size = 0x800, -+ .id = 1, -+}; -+ -+static struct npe_plat_data npec = { -+ .name = "NPE-C", -+ .data_size = 0x800, -+ .inst_size = 0x800, -+ .id = 2, -+}; -+ -+static struct resource res_npea = { -+ .start = IXP4XX_NPEA_BASE_PHYS, -+ .end = IXP4XX_NPEA_BASE_PHYS + 0xfff, -+ .flags = IORESOURCE_MEM, -+}; -+ -+static struct resource res_npeb = { -+ .start = IXP4XX_NPEB_BASE_PHYS, -+ .end = IXP4XX_NPEB_BASE_PHYS + 0xfff, -+ .flags = IORESOURCE_MEM, -+}; -+ -+static struct resource res_npec = { -+ .start = IXP4XX_NPEC_BASE_PHYS, -+ .end = IXP4XX_NPEC_BASE_PHYS + 0xfff, -+ .flags = IORESOURCE_MEM, -+}; -+ -+static struct platform_device dev_npea = { -+ .name = "ixp4xx_npe", -+ .id = 0, -+ .dev.platform_data = &npea, -+ .num_resources = 1, -+ .resource = &res_npea, -+}; -+ -+static struct platform_device dev_npeb = { -+ .name = "ixp4xx_npe", -+ .id = 1, -+ .dev.platform_data = &npeb, -+ .num_resources = 1, -+ .resource = &res_npeb, -+}; -+ -+static struct platform_device dev_npec = { -+ .name = "ixp4xx_npe", -+ .id = 2, -+ .dev.platform_data = &npec, -+ .num_resources = 1, -+ .resource = &res_npec, -+}; -+ -+/* QMGR */ -+static struct resource res_qmgr[] = { -+{ -+ .start = IXP4XX_QMGR_BASE_PHYS, -+ .end = IXP4XX_QMGR_BASE_PHYS + IXP4XX_QMGR_REGION_SIZE -1, -+ .flags = IORESOURCE_MEM, -+}, { -+ .start = IRQ_IXP4XX_QM1, -+ .flags = IORESOURCE_IRQ, -+} }; -+ -+static struct platform_device qmgr = { -+ .name = "ixp4xx_qmgr", -+ .id = 0, -+ .dev = { -+ .coherent_dma_mask = DMA_32BIT_MASK, -+ }, -+ .num_resources = ARRAY_SIZE(res_qmgr), -+ .resource = res_qmgr, -+}; -+ - unsigned long ixp4xx_exp_bus_size; - EXPORT_SYMBOL(ixp4xx_exp_bus_size); - -@@ -378,8 +462,19 @@ void __init ixp4xx_sys_init(void) - break; - } - } -+ npeb.inst_size = 0x1000; -+ npec.inst_size = 0x1000; - } - -+ platform_device_register(&qmgr); -+ -+ if (ix_fuse() & IX_FUSE_NPEA) -+ platform_device_register(&dev_npea); -+ if (ix_fuse() & IX_FUSE_NPEB) -+ platform_device_register(&dev_npeb); -+ if (ix_fuse() & IX_FUSE_NPEC) -+ platform_device_register(&dev_npec); -+ - printk("IXP4xx: Using %luMiB expansion bus window size\n", - ixp4xx_exp_bus_size >> 20); - } -Index: linux-2.6.21.7/arch/arm/mach-ixp4xx/ixdp425-setup.c -=================================================================== ---- linux-2.6.21.7.orig/arch/arm/mach-ixp4xx/ixdp425-setup.c -+++ linux-2.6.21.7/arch/arm/mach-ixp4xx/ixdp425-setup.c -@@ -101,10 +101,59 @@ static struct platform_device ixdp425_ua - .resource = ixdp425_uart_resources - }; - -+/* MACs */ -+static struct resource res_mac0 = { -+ .start = IXP4XX_EthB_BASE_PHYS, -+ .end = IXP4XX_EthB_BASE_PHYS + 0x1ff, -+ .flags = IORESOURCE_MEM, -+}; -+ -+static struct resource res_mac1 = { -+ .start = IXP4XX_EthC_BASE_PHYS, -+ .end = IXP4XX_EthC_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, -+ .rxdoneq_id = 4, -+}; -+ -+static struct mac_plat_info plat_mac1 = { -+ .npe_id = 2, -+ .phy_id = 1, -+ .eth_id = 1, -+ .rxq_id = 28, -+ .txq_id = 25, -+ .rxdoneq_id = 5, -+}; -+ -+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 mac1 = { -+ .name = "ixp4xx_mac", -+ .id = 1, -+ .dev.platform_data = &plat_mac1, -+ .num_resources = 1, -+ .resource = &res_mac1, -+}; -+ - static struct platform_device *ixdp425_devices[] __initdata = { - &ixdp425_i2c_controller, - &ixdp425_flash, -- &ixdp425_uart -+ &ixdp425_uart, -+ &mac0, -+ &mac1, - }; - - static void __init ixdp425_init(void) -Index: linux-2.6.21.7/drivers/net/Kconfig -=================================================================== ---- linux-2.6.21.7.orig/drivers/net/Kconfig -+++ linux-2.6.21.7/drivers/net/Kconfig -@@ -324,6 +324,8 @@ config MACB - - source "drivers/net/arm/Kconfig" - -+source "drivers/net/ixp4xx/Kconfig" -+ - config MACE - tristate "MACE (Power Mac ethernet) support" - depends on NET_ETHERNET && PPC_PMAC && PPC32 -Index: linux-2.6.21.7/drivers/net/Makefile -=================================================================== ---- linux-2.6.21.7.orig/drivers/net/Makefile -+++ linux-2.6.21.7/drivers/net/Makefile -@@ -213,6 +213,7 @@ obj-$(CONFIG_HAMRADIO) += hamradio/ - obj-$(CONFIG_IRDA) += irda/ - obj-$(CONFIG_ETRAX_ETHERNET) += cris/ - obj-$(CONFIG_ENP2611_MSF_NET) += ixp2000/ -+obj-$(CONFIG_IXP4XX_NPE) += ixp4xx/ - - obj-$(CONFIG_NETCONSOLE) += netconsole.o - -Index: linux-2.6.21.7/drivers/net/ixp4xx/Kconfig -=================================================================== ---- /dev/null -+++ linux-2.6.21.7/drivers/net/ixp4xx/Kconfig -@@ -0,0 +1,48 @@ -+config IXP4XX_QMGR -+ tristate "IXP4xx Queue Manager support" -+ depends on ARCH_IXP4XX -+ depends on NET_ETHERNET -+ help -+ The IXP4XX Queue manager is a configurable hardware ringbuffer. -+ It is used by the NPEs to exchange data from and to the CPU. -+ You can either use this OR the Intel Access Library (IAL) -+ -+config IXP4XX_NPE -+ tristate "IXP4xx NPE support" -+ depends on ARCH_IXP4XX -+ depends on NET_ETHERNET -+ help -+ The IXP4XX NPE driver supports the 3 CPU co-processors called -+ "Network Processing Engines" (NPE). It adds support fo downloading -+ the Microcode (firmware) via Hotplug or character-special-device. -+ More about this at: Documentation/networking/ixp4xx/README. -+ You can either use this OR the Intel Access Library (IAL) -+ -+config IXP4XX_FW_LOAD -+ bool "Use Firmware hotplug for Microcode download" -+ depends on IXP4XX_NPE -+ select HOTPLUG -+ select FW_LOADER -+ help -+ The default hotplug script will load the Firmware from -+ /usr/lib/hotplug/firmware/NPE-[ABC] -+ see Documentation/firmware_class/hotplug-script -+ -+config IXP4XX_MAC -+ tristate "IXP4xx MAC support" -+ depends on IXP4XX_NPE -+ depends on IXP4XX_QMGR -+ depends on NET_ETHERNET -+ select MII -+ help -+ The IXP4XX MAC driver supports the MACs on the IXP4XX CPUs. -+ There are 2 on ixp425 and up to 5 on ixdp465. -+ You can either use this OR the Intel Access Library (IAL) -+ -+config IXP4XX_CRYPTO -+ tristate "IXP4xx crypto support" -+ depends on IXP4XX_NPE -+ depends on IXP4XX_QMGR -+ help -+ This driver is a generic NPE-crypto access layer. -+ You need additional code in OCF for example. -Index: linux-2.6.21.7/drivers/net/ixp4xx/Makefile -=================================================================== ---- /dev/null -+++ linux-2.6.21.7/drivers/net/ixp4xx/Makefile -@@ -0,0 +1,7 @@ -+obj-$(CONFIG_IXP4XX_QMGR) += ixp4xx_qmgr.o -+obj-$(CONFIG_IXP4XX_NPE) += ixp4xx_npe.o -+obj-$(CONFIG_IXP4XX_MAC) += ixp4xx_mac.o -+obj-$(CONFIG_IXP4XX_CRYPTO) += ixp4xx_crypto.o -+ -+ixp4xx_npe-objs := ucode_dl.o npe_mh.o npe.o -+ixp4xx_mac-objs := mac_driver.o phy.o -Index: linux-2.6.21.7/drivers/net/ixp4xx/ixp4xx_crypto.c -=================================================================== ---- /dev/null -+++ linux-2.6.21.7/drivers/net/ixp4xx/ixp4xx_crypto.c -@@ -0,0 +1,851 @@ -+/* -+ * ixp4xx_crypto.c - interface to the HW crypto -+ * -+ * Copyright (C) 2006 Christian Hohnstaedt <chohnstaedt@innominate.com> -+ * -+ * This file is released under the GPLv2 -+ */ -+ -+#include <linux/ixp_qmgr.h> -+#include <linux/ixp_npe.h> -+#include <linux/dma-mapping.h> -+#include <linux/dmapool.h> -+#include <linux/device.h> -+#include <linux/delay.h> -+#include <linux/slab.h> -+#include <linux/kernel.h> -+#include <linux/ixp_crypto.h> -+ -+#define SEND_QID 29 -+#define RECV_QID 30 -+ -+#define NPE_ID 2 /* NPE C */ -+ -+#define QUEUE_SIZE 64 -+#define MY_VERSION "0.0.1" -+ -+/* local head for all sa_ctx */ -+static struct ix_sa_master sa_master; -+ -+static const struct ix_hash_algo _hash_algos[] = { -+{ -+ .name = "MD5", -+ .cfgword = 0xAA010004, -+ .digest_len = 16, -+ .icv = "\x01\x23\x45\x67\x89\xAB\xCD\xEF" -+ "\xFE\xDC\xBA\x98\x76\x54\x32\x10", -+ .type = HASH_TYPE_MD5, -+},{ -+ .name = "SHA1", -+ .cfgword = 0x00000005, -+ .digest_len = 20, -+ .icv = "\x67\x45\x23\x01\xEF\xCD\xAB\x89\x98\xBA" -+ "\xDC\xFE\x10\x32\x54\x76\xC3\xD2\xE1\xF0", -+ .type = HASH_TYPE_SHA1, -+#if 0 -+},{ -+ .name = "CBC MAC", -+ .digest_len = 64, -+ .aad_len = 48, -+ .type = HASH_TYPE_CBCMAC, -+#endif -+} }; -+ -+static const struct ix_cipher_algo _cipher_algos[] = { -+{ -+ .name = "DES ECB", -+ .cfgword_enc = CIPH_ENCR | MOD_DES | MOD_ECB | KEYLEN_192, -+ .cfgword_dec = CIPH_DECR | MOD_DES | MOD_ECB | KEYLEN_192, -+ .block_len = 8, -+ .type = CIPHER_TYPE_DES, -+ .mode = CIPHER_MODE_ECB, -+},{ -+ .name = "DES CBC", -+ .cfgword_enc = CIPH_ENCR | MOD_DES | MOD_CBC_ENC | KEYLEN_192, -+ .cfgword_dec = CIPH_DECR | MOD_DES | MOD_CBC_DEC | KEYLEN_192, -+ .iv_len = 8, -+ .block_len = 8, -+ .type = CIPHER_TYPE_DES, -+ .mode = CIPHER_MODE_CBC, -+},{ -+ .name = "3DES ECB", -+ .cfgword_enc = CIPH_ENCR | MOD_TDEA3 | MOD_ECB | KEYLEN_192, -+ .cfgword_dec = CIPH_DECR | MOD_TDEA3 | MOD_ECB | KEYLEN_192, -+ .block_len = 8, -+ .type = CIPHER_TYPE_3DES, -+ .mode = CIPHER_MODE_ECB, -+},{ -+ .name = "3DES CBC", -+ .cfgword_enc = CIPH_ENCR | MOD_TDEA3 | MOD_CBC_ENC | KEYLEN_192, -+ .cfgword_dec = CIPH_DECR | MOD_TDEA3 | MOD_CBC_DEC | KEYLEN_192, -+ .iv_len = 8, -+ .block_len = 8, -+ .type = CIPHER_TYPE_3DES, -+ .mode = CIPHER_MODE_CBC, -+},{ -+ .name = "AES ECB", -+ .cfgword_enc = CIPH_ENCR | ALGO_AES | MOD_ECB, -+ .cfgword_dec = CIPH_DECR | ALGO_AES | MOD_ECB, -+ .block_len = 16, -+ .type = CIPHER_TYPE_AES, -+ .mode = CIPHER_MODE_ECB, -+},{ -+ .name = "AES CBC", -+ .cfgword_enc = CIPH_ENCR | ALGO_AES | MOD_CBC_ENC, -+ .cfgword_dec = CIPH_DECR | ALGO_AES | MOD_CBC_DEC, -+ .block_len = 16, -+ .iv_len = 16, -+ .type = CIPHER_TYPE_AES, -+ .mode = CIPHER_MODE_CBC, -+},{ -+ .name = "AES CTR", -+ .cfgword_enc = CIPH_ENCR | ALGO_AES | MOD_CTR, -+ .cfgword_dec = CIPH_ENCR | ALGO_AES | MOD_CTR, -+ .block_len = 16, -+ .iv_len = 16, -+ .type = CIPHER_TYPE_AES, -+ .mode = CIPHER_MODE_CTR, -+#if 0 -+},{ -+ .name = "AES CCM", -+ .cfgword_enc = CIPH_ENCR | ALGO_AES | MOD_CCM_ENC, -+ .cfgword_dec = CIPH_ENCR | ALGO_AES | MOD_CCM_DEC, -+ .block_len = 16, -+ .iv_len = 16, -+ .type = CIPHER_TYPE_AES, -+ .mode = CIPHER_MODE_CCM, -+#endif -+} }; -+ -+const struct ix_hash_algo *ix_hash_by_id(int type) -+{ -+ int i; -+ -+ for(i=0; i<ARRAY_SIZE(_hash_algos); i++) { -+ if (_hash_algos[i].type == type) -+ return _hash_algos + i; -+ } -+ return NULL; -+} -+ -+const struct ix_cipher_algo *ix_cipher_by_id(int type, int mode) -+{ -+ int i; -+ -+ for(i=0; i<ARRAY_SIZE(_cipher_algos); i++) { -+ if (_cipher_algos[i].type==type && _cipher_algos[i].mode==mode) -+ return _cipher_algos + i; -+ } -+ return NULL; -+} -+ -+static void irqcb_recv(struct qm_queue *queue); -+ -+static int init_sa_master(struct ix_sa_master *master) -+{ -+ struct npe_info *npe; -+ int ret = -ENODEV; -+ -+ if (! (ix_fuse() & (IX_FUSE_HASH | IX_FUSE_AES | IX_FUSE_DES))) { -+ printk(KERN_ERR "ixp_crypto: No HW crypto available\n"); -+ return ret; -+ } -+ memset(master, 0, sizeof(struct ix_sa_master)); -+ master->npe_dev = get_npe_by_id(NPE_ID); -+ if (! master->npe_dev) -+ goto err; -+ -+ npe = dev_get_drvdata(master->npe_dev); -+ -+ if (npe_status(npe) & IX_NPEDL_EXCTL_STATUS_RUN) { -+ switch (npe->img_info[1]) { -+ case 4: -+ printk(KERN_INFO "Crypto AES avaialable\n"); -+ break; -+ case 5: -+ printk(KERN_INFO "Crypto AES and CCM avaialable\n"); -+ break; -+ default: -+ printk(KERN_WARNING "Current microcode for %s has no" -+ " crypto capabilities\n", npe->plat->name); -+ break; -+ } -+ } -+ rwlock_init(&master->lock); -+ master->dmapool = dma_pool_create("ixp4xx_crypto", master->npe_dev, -+ sizeof(struct npe_crypt_cont), 32, 0); -+ if (!master->dmapool) { -+ ret = -ENOMEM; -+ goto err; -+ } -+ master->sendq = request_queue(SEND_QID, QUEUE_SIZE); -+ if (IS_ERR(master->sendq)) { -+ printk(KERN_ERR "ixp4xx_crypto: Error requesting Q: %d\n", -+ SEND_QID); -+ ret = PTR_ERR(master->sendq); -+ goto err; -+ } -+ master->recvq = request_queue(RECV_QID, QUEUE_SIZE); -+ if (IS_ERR(master->recvq)) { -+ printk(KERN_ERR "ixp4xx_crypto: Error requesting Q: %d\n", -+ RECV_QID); -+ ret = PTR_ERR(master->recvq); -+ release_queue(master->sendq); -+ goto err; -+ } -+ -+ master->recvq->irq_cb = irqcb_recv; -+ queue_set_watermarks(master->recvq, 0, 0); -+ queue_set_irq_src(master->recvq, Q_IRQ_ID_NOT_E); -+ queue_enable_irq(master->recvq); -+ printk(KERN_INFO "ixp4xx_crypto " MY_VERSION " registered successfully\n"); -+ -+ return 0; -+err: -+ if (master->dmapool) -+ dma_pool_destroy(master->dmapool); -+ if (! master->npe_dev) -+ put_device(master->npe_dev); -+ return ret; -+ -+} -+ -+static void release_sa_master(struct ix_sa_master *master) -+{ -+ struct npe_crypt_cont *cont; -+ unsigned long flags; -+ -+ write_lock_irqsave(&master->lock, flags); -+ while (master->pool) { -+ cont = master->pool; -+ master->pool = cont->next; -+ dma_pool_free(master->dmapool, cont, cont->phys); -+ master->pool_size--; -+ } -+ write_unlock_irqrestore(&master->lock, flags); -+ if (master->pool_size) { -+ printk(KERN_ERR "ixp4xx_crypto: %d items lost from DMA pool\n", -+ master->pool_size); -+ } -+ -+ dma_pool_destroy(master->dmapool); -+ release_queue(master->sendq); -+ release_queue(master->recvq); -+ return_npe_dev(master->npe_dev); -+} -+ -+static struct npe_crypt_cont *ix_sa_get_cont(struct ix_sa_master *master) -+{ -+ unsigned long flags; -+ struct npe_crypt_cont *cont; -+ dma_addr_t handle; -+ -+ write_lock_irqsave(&master->lock, flags); -+ if (!master->pool) { -+ cont = dma_pool_alloc(master->dmapool, GFP_ATOMIC, &handle); -+ if (cont) { -+ master->pool_size++; -+ cont->phys = handle; -+ cont->virt = cont; -+ } -+ } else { -+ cont = master->pool; -+ master->pool = cont->next; -+ } -+ write_unlock_irqrestore(&master->lock, flags); -+ return cont; -+} -+ -+static void -+ix_sa_return_cont(struct ix_sa_master *master,struct npe_crypt_cont *cont) -+{ -+ unsigned long flags; -+ -+ write_lock_irqsave(&master->lock, flags); -+ cont->next = master->pool; -+ master->pool = cont; -+ write_unlock_irqrestore(&master->lock, flags); -+} -+ -+static void free_sa_dir(struct ix_sa_ctx *sa_ctx, struct ix_sa_dir *dir) -+{ -+ memset(dir->npe_ctx, 0, NPE_CTX_LEN); -+ dma_pool_free(sa_ctx->master->dmapool, dir->npe_ctx, -+ dir->npe_ctx_phys); -+} -+ -+static void ix_sa_ctx_destroy(struct ix_sa_ctx *sa_ctx) -+{ -+ BUG_ON(sa_ctx->state != STATE_UNLOADING); -+ free_sa_dir(sa_ctx, &sa_ctx->encrypt); -+ free_sa_dir(sa_ctx, &sa_ctx->decrypt); -+ kfree(sa_ctx); -+ module_put(THIS_MODULE); -+} -+ -+static void recv_pack(struct qm_queue *queue, u32 phys) -+{ -+ struct ix_sa_ctx *sa_ctx; -+ struct npe_crypt_cont *cr_cont; -+ struct npe_cont *cont; -+ int failed; -+ -+ failed = phys & 0x1; -+ phys &= ~0x3; -+ -+ cr_cont = dma_to_virt(queue->dev, phys); -+ cr_cont = cr_cont->virt; -+ sa_ctx = cr_cont->ctl.crypt.sa_ctx; -+ -+ phys = npe_to_cpu32(cr_cont->ctl.crypt.src_buf); -+ if (phys) { -+ cont = dma_to_virt(queue->dev, phys); -+ cont = cont->virt; -+ } else { -+ cont = NULL; -+ } -+ if (cr_cont->ctl.crypt.oper_type == OP_PERFORM) { -+ dma_unmap_single(sa_ctx->master->npe_dev, -+ cont->eth.phys_addr, -+ cont->eth.buf_len, -+ DMA_BIDIRECTIONAL); -+ if (sa_ctx->perf_cb) -+ sa_ctx->perf_cb(sa_ctx, cont->data, failed); -+ qmgr_return_cont(dev_get_drvdata(queue->dev), cont); -+ ix_sa_return_cont(sa_ctx->master, cr_cont); -+ if (atomic_dec_and_test(&sa_ctx->use_cnt)) -+ ix_sa_ctx_destroy(sa_ctx); -+ return; -+ } -+ -+ /* We are registering */ -+ switch (cr_cont->ctl.crypt.mode) { -+ case NPE_OP_HASH_GEN_ICV: -+ /* 1 out of 2 HMAC preparation operations completed */ -+ dma_unmap_single(sa_ctx->master->npe_dev, -+ cont->eth.phys_addr, -+ cont->eth.buf_len, -+ DMA_TO_DEVICE); -+ kfree(cont->data); -+ qmgr_return_cont(dev_get_drvdata(queue->dev), cont); -+ break; -+ case NPE_OP_ENC_GEN_KEY: -+ memcpy(sa_ctx->decrypt.npe_ctx + sizeof(u32), -+ sa_ctx->rev_aes->ctl.rev_aes_key + sizeof(u32), -+ sa_ctx->c_key.len); -+ /* REV AES data not needed anymore, free it */ -+ ix_sa_return_cont(sa_ctx->master, sa_ctx->rev_aes); -+ sa_ctx->rev_aes = NULL; -+ break; -+ default: -+ printk(KERN_ERR "Unknown crypt-register mode: %x\n", -+ cr_cont->ctl.crypt.mode); -+ -+ } -+ if (cr_cont->ctl.crypt.oper_type == OP_REG_DONE) { -+ if (sa_ctx->state == STATE_UNREGISTERED) -+ sa_ctx->state = STATE_REGISTERED; -+ if (sa_ctx->reg_cb) -+ sa_ctx->reg_cb(sa_ctx, failed); -+ } -+ ix_sa_return_cont(sa_ctx->master, cr_cont); -+ if (atomic_dec_and_test(&sa_ctx->use_cnt)) -+ ix_sa_ctx_destroy(sa_ctx); -+} -+ -+static void irqcb_recv(struct qm_queue *queue) -+{ -+ u32 phys; -+ -+ queue_ack_irq(queue); -+ while ((phys = queue_get_entry(queue))) -+ recv_pack(queue, phys); -+} -+ -+static int init_sa_dir(struct ix_sa_ctx *sa_ctx, struct ix_sa_dir *dir) -+{ -+ dir->npe_ctx = dma_pool_alloc(sa_ctx->master->dmapool, -+ sa_ctx->gfp_flags, &dir->npe_ctx_phys); -+ if (!dir->npe_ctx) { -+ return 1; -+ } -+ memset(dir->npe_ctx, 0, NPE_CTX_LEN); -+ return 0; -+} -+ -+struct ix_sa_ctx *ix_sa_ctx_new(int priv_len, gfp_t flags) -+{ -+ struct ix_sa_ctx *sa_ctx; -+ struct ix_sa_master *master = &sa_master; -+ struct npe_info *npe = dev_get_drvdata(master->npe_dev); -+ -+ /* first check if Microcode was downloaded into this NPE */ -+ if (!( npe_status(npe) & IX_NPEDL_EXCTL_STATUS_RUN)) { -+ printk(KERN_ERR "%s not running\n", npe->plat->name); -+ return NULL; -+ } -+ switch (npe->img_info[1]) { -+ case 4: -+ case 5: -+ break; -+ default: -+ /* No crypto Microcode */ -+ return NULL; -+ } -+ if (!try_module_get(THIS_MODULE)) { -+ return NULL; -+ } -+ -+ sa_ctx = kzalloc(sizeof(struct ix_sa_ctx) + priv_len, flags); -+ if (!sa_ctx) { -+ goto err_put; -+ } -+ -+ sa_ctx->master = master; -+ sa_ctx->gfp_flags = flags; -+ -+ if (init_sa_dir(sa_ctx, &sa_ctx->encrypt)) -+ goto err_free; -+ if (init_sa_dir(sa_ctx, &sa_ctx->decrypt)) { -+ free_sa_dir(sa_ctx, &sa_ctx->encrypt); -+ goto err_free; -+ } -+ if (priv_len) -+ sa_ctx->priv = sa_ctx + 1; -+ -+ atomic_set(&sa_ctx->use_cnt, 1); -+ return sa_ctx; -+ -+err_free: -+ kfree(sa_ctx); -+err_put: -+ module_put(THIS_MODULE); -+ return NULL; -+} -+ -+void ix_sa_ctx_free(struct ix_sa_ctx *sa_ctx) -+{ -+ sa_ctx->state = STATE_UNLOADING; -+ if (atomic_dec_and_test(&sa_ctx->use_cnt)) -+ ix_sa_ctx_destroy(sa_ctx); -+ else -+ printk("ix_sa_ctx_free -> delayed: %p %d\n", -+ sa_ctx, atomic_read(&sa_ctx->use_cnt)); -+} -+ -+/* http://www.ietf.org/rfc/rfc2104.txt */ -+#define HMAC_IPAD_VALUE 0x36 -+#define HMAC_OPAD_VALUE 0x5C -+#define PAD_BLOCKLEN 64 -+ -+static int register_chain_var(struct ix_sa_ctx *sa_ctx, -+ unsigned char *pad, u32 target, int init_len, u32 ctx_addr, int oper) -+{ -+ struct npe_crypt_cont *cr_cont; -+ struct npe_cont *cont; -+ -+ cr_cont = ix_sa_get_cont(sa_ctx->master); -+ if (!cr_cont) -+ return -ENOMEM; -+ -+ cr_cont->ctl.crypt.sa_ctx = sa_ctx; -+ cr_cont->ctl.crypt.auth_offs = 0; -+ cr_cont->ctl.crypt.auth_len =cpu_to_npe16(PAD_BLOCKLEN); -+ cr_cont->ctl.crypt.crypto_ctx = cpu_to_npe32(ctx_addr); -+ -+ cont = qmgr_get_cont(dev_get_drvdata(sa_ctx->master->sendq->dev)); -+ if (!cont) { -+ ix_sa_return_cont(sa_ctx->master, cr_cont); -+ return -ENOMEM; -+ } -+ -+ cont->data = pad; -+ cont->eth.next = 0; -+ cont->eth.buf_len = cpu_to_npe16(PAD_BLOCKLEN); -+ cont->eth.pkt_len = 0; -+ -+ cont->eth.phys_addr = cpu_to_npe32(dma_map_single( -+ sa_ctx->master->npe_dev, pad, PAD_BLOCKLEN, DMA_TO_DEVICE)); -+ -+ cr_cont->ctl.crypt.src_buf = cpu_to_npe32(cont->phys); -+ cr_cont->ctl.crypt.oper_type = oper; -+ -+ cr_cont->ctl.crypt.addr.icv = cpu_to_npe32(target); -+ cr_cont->ctl.crypt.mode = NPE_OP_HASH_GEN_ICV; -+ cr_cont->ctl.crypt.init_len = init_len; -+ -+ atomic_inc(&sa_ctx->use_cnt); -+ queue_put_entry(sa_ctx->master->sendq, cr_cont->phys); -+ if (queue_stat(sa_ctx->master->sendq) == 2) { /* overflow */ -+ atomic_dec(&sa_ctx->use_cnt); -+ qmgr_return_cont(dev_get_drvdata(sa_ctx->master->sendq->dev), -+ cont); -+ ix_sa_return_cont(sa_ctx->master, cr_cont); -+ return -ENOMEM; -+ } -+ return 0; -+} -+ -+/* Return value -+ * 0 if nothing registered, -+ * 1 if something registered and -+ * < 0 on error -+ */ -+static int ix_sa_ctx_setup_auth(struct ix_sa_ctx *sa_ctx, -+ const struct ix_hash_algo *algo, int len, int oper, int encrypt) -+{ -+ unsigned char *ipad, *opad; -+ u32 itarget, otarget, ctx_addr; -+ unsigned char *cinfo; -+ int init_len, i, ret = 0; -+ struct qm_qmgr *qmgr; -+ struct ix_sa_dir *dir; -+ u32 cfgword; -+ -+ dir = encrypt ? &sa_ctx->encrypt : &sa_ctx->decrypt; -+ cinfo = dir->npe_ctx + dir->npe_ctx_idx; -+ -+ qmgr = dev_get_drvdata(sa_ctx->master->sendq->dev); -+ -+ cinfo = dir->npe_ctx + dir->npe_ctx_idx; -+ sa_ctx->h_algo = algo; -+ -+ if (!algo) { -+ dir->npe_mode |= NPE_OP_HMAC_DISABLE; -+ return 0; -+ } -+ if (algo->type == HASH_TYPE_CBCMAC) { -+ dir->npe_mode |= NPE_OP_CCM_ENABLE | NPE_OP_HMAC_DISABLE; -+ return 0; -+ } -+ if (sa_ctx->h_key.len > 64 || sa_ctx->h_key.len < algo->digest_len) -+ return -EINVAL; -+ if (len > algo->digest_len || (len % 4)) -+ return -EINVAL; -+ if (!len) -+ len = algo->digest_len; -+ -+ sa_ctx->digest_len = len; -+ -+ /* write cfg word to cryptinfo */ -+ cfgword = algo->cfgword | ((len/4) << 8); -+ *(u32*)cinfo = cpu_to_be32(cfgword); -+ cinfo += sizeof(cfgword); -+ -+ /* write ICV to cryptinfo */ -+ memcpy(cinfo, algo->icv, algo->digest_len); -+ cinfo += algo->digest_len; -+ -+ itarget = dir->npe_ctx_phys + dir->npe_ctx_idx -+ + sizeof(algo->cfgword); -+ otarget = itarget + algo->digest_len; -+ -+ opad = kzalloc(PAD_BLOCKLEN, sa_ctx->gfp_flags | GFP_DMA); -+ if (!opad) { -+ return -ENOMEM; -+ } -+ ipad = kzalloc(PAD_BLOCKLEN, sa_ctx->gfp_flags | GFP_DMA); -+ if (!ipad) { -+ kfree(opad); -+ return -ENOMEM; -+ } -+ memcpy(ipad, sa_ctx->h_key.key, sa_ctx->h_key.len); -+ memcpy(opad, sa_ctx->h_key.key, sa_ctx->h_key.len); -+ for (i = 0; i < PAD_BLOCKLEN; i++) { -+ ipad[i] ^= HMAC_IPAD_VALUE; -+ opad[i] ^= HMAC_OPAD_VALUE; -+ } -+ init_len = cinfo - (dir->npe_ctx + dir->npe_ctx_idx); -+ ctx_addr = dir->npe_ctx_phys + dir->npe_ctx_idx; -+ -+ dir->npe_ctx_idx += init_len; -+ dir->npe_mode |= NPE_OP_HASH_ENABLE; -+ -+ if (!encrypt) -+ dir->npe_mode |= NPE_OP_HASH_VERIFY; -+ -+ /* register first chainvar */ -+ ret = register_chain_var(sa_ctx, opad, otarget, -+ init_len, ctx_addr, OP_REGISTER); -+ if (ret) { -+ kfree(ipad); -+ kfree(opad); -+ return ret; -+ } -+ -+ /* register second chainvar */ -+ ret = register_chain_var(sa_ctx, ipad, itarget, -+ init_len, ctx_addr, oper); -+ if (ret) { -+ kfree(ipad); -+ return ret; -+ } -+ -+ return 1; -+} -+ -+static int gen_rev_aes_key(struct ix_sa_ctx *sa_ctx, -+ u32 keylen_cfg, int cipher_op) -+{ -+ unsigned char *cinfo; -+ struct npe_crypt_cont *cr_cont; -+ -+ keylen_cfg |= CIPH_ENCR | ALGO_AES | MOD_ECB; -+ sa_ctx->rev_aes = ix_sa_get_cont(sa_ctx->master); -+ if (!sa_ctx->rev_aes) -+ return -ENOMEM; -+ -+ cinfo = sa_ctx->rev_aes->ctl.rev_aes_key; -+ *(u32*)cinfo = cpu_to_be32(keylen_cfg); -+ cinfo += sizeof(keylen_cfg); -+ -+ memcpy(cinfo, sa_ctx->c_key.key, sa_ctx->c_key.len); -+ -+ cr_cont = ix_sa_get_cont(sa_ctx->master); -+ if (!cr_cont) { -+ ix_sa_return_cont(sa_ctx->master, sa_ctx->rev_aes); -+ sa_ctx->rev_aes = NULL; -+ return -ENOMEM; -+ } -+ cr_cont->ctl.crypt.sa_ctx = sa_ctx; -+ cr_cont->ctl.crypt.oper_type = cipher_op; -+ -+ cr_cont->ctl.crypt.crypt_offs = 0; -+ cr_cont->ctl.crypt.crypt_len = cpu_to_npe16(AES_BLOCK128); -+ cr_cont->ctl.crypt.addr.rev_aes = cpu_to_npe32( -+ sa_ctx->rev_aes->phys + sizeof(keylen_cfg)); -+ -+ cr_cont->ctl.crypt.src_buf = 0; -+ cr_cont->ctl.crypt.crypto_ctx = cpu_to_npe32(sa_ctx->rev_aes->phys); -+ cr_cont->ctl.crypt.mode = NPE_OP_ENC_GEN_KEY; -+ cr_cont->ctl.crypt.init_len = sa_ctx->decrypt.npe_ctx_idx; -+ -+ atomic_inc(&sa_ctx->use_cnt); -+ queue_put_entry(sa_ctx->master->sendq, cr_cont->phys); -+ if (queue_stat(sa_ctx->master->sendq) == 2) { /* overflow */ -+ atomic_dec(&sa_ctx->use_cnt); -+ ix_sa_return_cont(sa_ctx->master, cr_cont); -+ ix_sa_return_cont(sa_ctx->master, sa_ctx->rev_aes); -+ sa_ctx->rev_aes = NULL; -+ return -ENOMEM; -+ } -+ -+ return 1; -+} -+ -+/* Return value -+ * 0 if nothing registered, -+ * 1 if something registered and -+ * < 0 on error -+ */ -+static int ix_sa_ctx_setup_cipher(struct ix_sa_ctx *sa_ctx, -+ const struct ix_cipher_algo *algo, int cipher_op, int encrypt) -+{ -+ unsigned char *cinfo; -+ int keylen, init_len; -+ u32 cipher_cfg; -+ u32 keylen_cfg = 0; -+ struct ix_sa_dir *dir; -+ -+ dir = encrypt ? &sa_ctx->encrypt : &sa_ctx->decrypt; -+ cinfo = dir->npe_ctx + dir->npe_ctx_idx; -+ -+ sa_ctx->c_algo = algo; -+ -+ if (!algo) -+ return 0; -+ -+ if (algo->type == CIPHER_TYPE_DES && sa_ctx->c_key.len != 8) -+ return -EINVAL; -+ -+ if (algo->type == CIPHER_TYPE_3DES && sa_ctx->c_key.len != 24) -+ return -EINVAL; -+ -+ keylen = 24; -+ -+ if (encrypt) { -+ cipher_cfg = algo->cfgword_enc; -+ dir->npe_mode |= NPE_OP_CRYPT_ENCRYPT; -+ } else { -+ cipher_cfg = algo->cfgword_dec; -+ } -+ if (algo->type == CIPHER_TYPE_AES) { -+ switch (sa_ctx->c_key.len) { -+ case 16: keylen_cfg = MOD_AES128 | KEYLEN_128; break; -+ case 24: keylen_cfg = MOD_AES192 | KEYLEN_192; break; -+ case 32: keylen_cfg = MOD_AES256 | KEYLEN_256; break; -+ default: return -EINVAL; -+ } -+ keylen = sa_ctx->c_key.len; -+ cipher_cfg |= keylen_cfg; -+ } -+ -+ /* write cfg word to cryptinfo */ -+ *(u32*)cinfo = cpu_to_be32(cipher_cfg); -+ cinfo += sizeof(cipher_cfg); -+ -+ /* write cipher key to cryptinfo */ -+ memcpy(cinfo, sa_ctx->c_key.key, sa_ctx->c_key.len); -+ cinfo += keylen; -+ -+ init_len = cinfo - (dir->npe_ctx + dir->npe_ctx_idx); -+ dir->npe_ctx_idx += init_len; -+ -+ dir->npe_mode |= NPE_OP_CRYPT_ENABLE; -+ -+ if (algo->type == CIPHER_TYPE_AES && !encrypt) { -+ return gen_rev_aes_key(sa_ctx, keylen_cfg, cipher_op); -+ } -+ -+ return 0; -+} -+ -+/* returns 0 on OK, <0 on error and 1 on overflow */ -+int ix_sa_crypto_perform(struct ix_sa_ctx *sa_ctx, u8 *data, void *ptr, -+ int datalen, int c_offs, int c_len, int a_offs, int a_len, -+ int hmac, char *iv, int encrypt) -+{ -+ struct npe_crypt_cont *cr_cont; -+ struct npe_cont *cont; -+ u32 data_phys; -+ int ret = -ENOMEM; -+ struct ix_sa_dir *dir; -+ -+ dir = encrypt ? &sa_ctx->encrypt : &sa_ctx->decrypt; -+ -+ if (sa_ctx->state != STATE_REGISTERED) -+ return -ENOENT; -+ -+ cr_cont = ix_sa_get_cont(sa_ctx->master); -+ if (!cr_cont) -+ return ret; -+ -+ cr_cont->ctl.crypt.sa_ctx = sa_ctx; -+ cr_cont->ctl.crypt.crypto_ctx = cpu_to_npe32(dir->npe_ctx_phys); -+ cr_cont->ctl.crypt.oper_type = OP_PERFORM; -+ cr_cont->ctl.crypt.mode = dir->npe_mode; -+ cr_cont->ctl.crypt.init_len = dir->npe_ctx_idx; -+ -+ if (sa_ctx->c_algo) { -+ cr_cont->ctl.crypt.crypt_offs = cpu_to_npe16(c_offs); -+ cr_cont->ctl.crypt.crypt_len = cpu_to_npe16(c_len); -+ if (sa_ctx->c_algo->iv_len) { -+ if (!iv) { -+ ret = -EINVAL; -+ goto err_cr; -+ } -+ memcpy(cr_cont->ctl.crypt.iv, iv, -+ sa_ctx->c_algo->iv_len); -+ } -+ } -+ -+ if (sa_ctx->h_algo) { -+ /* prepare hashing */ -+ cr_cont->ctl.crypt.auth_offs = cpu_to_npe16(a_offs); -+ cr_cont->ctl.crypt.auth_len = cpu_to_npe16(a_len); -+ } -+ -+ data_phys = dma_map_single(sa_ctx->master->npe_dev, -+ data, datalen, DMA_BIDIRECTIONAL); -+ if (hmac) -+ cr_cont->ctl.crypt.addr.icv = cpu_to_npe32(data_phys + hmac); -+ -+ /* Prepare the data ptr */ -+ cont = qmgr_get_cont(dev_get_drvdata(sa_ctx->master->sendq->dev)); -+ if (!cont) { -+ goto err_unmap; -+ } -+ -+ cont->data = ptr; -+ cont->eth.next = 0; -+ cont->eth.buf_len = cpu_to_npe16(datalen); -+ cont->eth.pkt_len = 0; -+ -+ cont->eth.phys_addr = cpu_to_npe32(data_phys); -+ cr_cont->ctl.crypt.src_buf = cpu_to_npe32(cont->phys); -+ -+ atomic_inc(&sa_ctx->use_cnt); -+ queue_put_entry(sa_ctx->master->sendq, cr_cont->phys); -+ if (queue_stat(sa_ctx->master->sendq) != 2) { -+ return 0; -+ } -+ -+ /* overflow */ -+ printk("%s: Overflow\n", __FUNCTION__); -+ ret = -EAGAIN; -+ atomic_dec(&sa_ctx->use_cnt); -+ qmgr_return_cont(dev_get_drvdata(sa_ctx->master->sendq->dev), cont); -+ -+err_unmap: -+ dma_unmap_single(sa_ctx->master->npe_dev, data_phys, datalen, -+ DMA_BIDIRECTIONAL); -+err_cr: -+ ix_sa_return_cont(sa_ctx->master, cr_cont); -+ -+ return ret; -+} -+ -+int ix_sa_ctx_setup_cipher_auth(struct ix_sa_ctx *sa_ctx, -+ const struct ix_cipher_algo *cipher, -+ const struct ix_hash_algo *auth, int len) -+{ -+ int ret = 0, sum = 0; -+ int cipher_op; -+ -+ if (sa_ctx->state != STATE_UNREGISTERED) -+ return -ENOENT; -+ -+ atomic_inc(&sa_ctx->use_cnt); -+ -+ cipher_op = auth ? OP_REGISTER : OP_REG_DONE; -+ if ((ret = ix_sa_ctx_setup_cipher(sa_ctx, cipher, OP_REGISTER, 1)) < 0) -+ goto out; -+ sum += ret; -+ if ((ret = ix_sa_ctx_setup_cipher(sa_ctx, cipher, cipher_op, 0)) < 0) -+ goto out; -+ sum += ret; -+ if ((ret = ix_sa_ctx_setup_auth(sa_ctx, auth, len, OP_REGISTER, 1)) < 0) -+ goto out; -+ sum += ret; -+ if ((ret = ix_sa_ctx_setup_auth(sa_ctx, auth, len, OP_REG_DONE, 0)) < 0) -+ goto out; -+ sum += ret; -+ -+ /* Nothing registered ? -+ * Ok, then we are done and call the callback here. -+ */ -+ if (!sum) { -+ if (sa_ctx->state == STATE_UNREGISTERED) -+ sa_ctx->state = STATE_REGISTERED; -+ if (sa_ctx->reg_cb) -+ sa_ctx->reg_cb(sa_ctx, 0); -+ } -+out: -+ atomic_dec(&sa_ctx->use_cnt); -+ return ret; -+} -+ -+static int __init init_crypto(void) -+{ -+ return init_sa_master(&sa_master); -+} -+ -+static void __exit finish_crypto(void) -+{ -+ release_sa_master(&sa_master); -+} -+ -+MODULE_LICENSE("GPL"); -+MODULE_AUTHOR("Christian Hohnstaedt <chohnstaedt@innominate.com>"); -+ -+EXPORT_SYMBOL(ix_hash_by_id); -+EXPORT_SYMBOL(ix_cipher_by_id); -+ -+EXPORT_SYMBOL(ix_sa_ctx_new); -+EXPORT_SYMBOL(ix_sa_ctx_free); -+EXPORT_SYMBOL(ix_sa_ctx_setup_cipher_auth); -+EXPORT_SYMBOL(ix_sa_crypto_perform); -+ -+module_init(init_crypto); -+module_exit(finish_crypto); -+ -Index: linux-2.6.21.7/drivers/net/ixp4xx/ixp4xx_qmgr.c -=================================================================== ---- /dev/null -+++ linux-2.6.21.7/drivers/net/ixp4xx/ixp4xx_qmgr.c -@@ -0,0 +1,474 @@ -+/* -+ * qmgr.c - reimplementation of the queue configuration interface. -+ * -+ * Copyright (C) 2006 Christian Hohnstaedt <chohnstaedt@innominate.com> -+ * -+ * This file is released under the GPLv2 -+ */ -+ -+#include <linux/kernel.h> -+#include <linux/module.h> -+#include <linux/platform_device.h> -+#include <linux/fs.h> -+#include <linux/init.h> -+#include <linux/slab.h> -+#include <linux/dmapool.h> -+#include <linux/interrupt.h> -+#include <linux/err.h> -+#include <linux/delay.h> -+#include <asm/uaccess.h> -+#include <asm/io.h> -+ -+#include <linux/ixp_qmgr.h> -+#include <linux/ixp_npe.h> -+ -+#define IXQMGR_VERSION "IXP4XX Q Manager 0.2.1" -+ -+static struct device *qmgr_dev = NULL; -+ -+static int poll_freq = 4000; -+static int poll_enable = 0; -+static u32 timer_countup_ticks; -+ -+module_param(poll_freq, int, 0644); -+module_param(poll_enable, int, 0644); -+ -+int queue_len(struct qm_queue *queue) -+{ -+ struct qm_qmgr *qmgr = dev_get_drvdata(queue->dev); -+ int diff, offs; -+ u32 val; -+ -+ offs = queue->id/8 + QUE_LOW_STAT0; -+ val = *(qmgr->addr + IX_QMGR_QCFG_BASE + queue->id); -+ -+ diff = (val - (val >> 7)) & 0x7f; -+ if (!diff) { -+ /* diff == 0 means either empty or full, must look at STAT0 */ -+ if ((*(qmgr->addr + offs) >> ((queue->id % 8)*4)) & 0x04) -+ diff = queue->len; -+ } -+ return diff; -+} -+ -+static int request_pool(struct device *dev, int count) -+{ -+ int i; -+ struct npe_cont *cont; -+ struct qm_qmgr *qmgr = dev_get_drvdata(dev); -+ dma_addr_t handle; -+ -+ for (i=0; i<count; i++) { -+ cont = dma_pool_alloc(qmgr->dmapool, GFP_KERNEL, &handle); -+ if (!cont) { -+ return -ENOMEM; -+ } -+ cont->phys = handle; -+ cont->virt = cont; -+ write_lock(&qmgr->lock); -+ cont->next = qmgr->pool; -+ qmgr->pool = cont; -+ write_unlock(&qmgr->lock); -+ } -+ return 0; -+} -+ -+static int free_pool(struct device *dev, int count) -+{ -+ int i; -+ struct npe_cont *cont; -+ struct qm_qmgr *qmgr = dev_get_drvdata(dev); -+ -+ for (i=0; i<count; i++) { -+ write_lock(&qmgr->lock); -+ cont = qmgr->pool; -+ if (!cont) { -+ write_unlock(&qmgr->lock); -+ return -1; -+ } -+ qmgr->pool = cont->next; -+ write_unlock(&qmgr->lock); -+ dma_pool_free(qmgr->dmapool, cont, cont->phys); -+ } -+ return 0; -+} -+ -+static int get_free_qspace(struct qm_qmgr *qmgr, int len) -+{ -+ int words = (qmgr->res->end - qmgr->res->start + 1) / 4 - -+ IX_QMGR_SRAM_SPACE; -+ int i,q; -+ -+ for (i=0; i<words; i+=len) { -+ for (q=0; q<MAX_QUEUES; q++) { -+ struct qm_queue *qu = qmgr->queues[q]; -+ if (!qu) -+ continue; -+ if ((qu->addr + qu->len > i) && (qu->addr < i + len)) -+ break; -+ } -+ if (q == MAX_QUEUES) { -+ /* we have a free address */ -+ return i; -+ } -+ } -+ return -1; -+} -+ -+static inline int _log2(int x) -+{ -+ int r=0; -+ while(x>>=1) -+ r++; -+ return r; -+} -+ -+/* -+ * 32bit Config registers at IX_QMGR_QUECONFIG_BASE_OFFSET[Qid] -+ * 0 - 6 WRPTR Word offset to baseaddr (index 0 .. BSIZE-1) -+ * 7 -13 RDPTR '' -+ * 14 -21 BADDR baseaddr = (offset to IX_QMGR_QUEBUFFER_SPACE_OFFSET) >> 6 -+ * 22 -23 ESIZE entrySizeInWords (always 00 because entrySizeInWords==1) -+ * 24 -25 BSIZE qSizeInWords 00=16,01=32,10=64,11=128 -+ * 26 -28 NE nearly empty -+ * 29 -31 NF nearly full -+ */ -+static int conf_q_regs(struct qm_queue *queue) -+{ -+ int bsize = _log2(queue->len/16); -+ int baddr = queue->addr + IX_QMGR_QCFG_SIZE; -+ -+ /* +2, because baddr is in words and not in bytes */ -+ queue_write_cfg_reg(queue, (bsize << 24) | (baddr<<(14-6+2)) ); -+ -+ return 0; -+} -+ -+static void pmu_timer_restart(void) -+{ -+ unsigned long flags; -+ -+ local_irq_save(flags); -+ -+ __asm__(" mcr p14,0,%0,c1,c1,0\n" /* write current counter */ -+ : : "r" (timer_countup_ticks)); -+ -+ __asm__(" mrc p14,0,r1,c4,c1,0; " /* get int enable register */ -+ " orr r1,r1,#1; " -+ " mcr p14,0,r1,c5,c1,0; " /* clear overflow */ -+ " mcr p14,0,r1,c4,c1,0\n" /* enable interrupts */ -+ : : : "r1"); -+ -+ local_irq_restore(flags); -+} -+ -+static void pmu_timer_init(void) -+{ -+ u32 controlRegisterMask = -+ BIT(0) | /* enable counters */ -+ BIT(2); /* reset clock counter; */ -+ -+ /* -+ * Compute the number of xscale cycles needed between each -+ * PMU IRQ. This is done from the result of an OS calibration loop. -+ * -+ * For 533MHz CPU, 533000000 tick/s / 4000 times/sec = 138250 -+ * 4000 times/sec = 37 mbufs/interrupt at line rate -+ * The pmu timer is reset to -138250 = 0xfffde3f6, to trigger an IRQ -+ * when this up counter overflows. -+ * -+ * The multiplication gives a number of instructions per second. -+ * which is close to the processor frequency, and then close to the -+ * PMU clock rate. -+ * -+ * 2 is the number of instructions per loop -+ * -+ */ -+ -+ timer_countup_ticks = - ((loops_per_jiffy * HZ * 2) / poll_freq); -+ -+ /* enable the CCNT (clock count) timer from the PMU */ -+ __asm__(" mcr p14,0,%0,c0,c1,0\n" -+ : : "r" (controlRegisterMask)); -+} -+ -+static void pmu_timer_disable(void) -+{ -+ unsigned long flags; -+ -+ local_irq_save(flags); -+ -+ __asm__(" mrc p14,0,r1,c4,c1,0; " /* get int enable register */ -+ " and r1,r1,#0x1e; " -+ " mcr p14,0,r1,c4,c1,0\n" /* disable interrupts */ -+ : : : "r1"); -+ local_irq_restore(flags); -+} -+ -+void queue_set_watermarks(struct qm_queue *queue, unsigned ne, unsigned nf) -+{ -+ u32 val; -+ /* calculate the register values -+ * 0->0, 1->1, 2->2, 4->3, 8->4 16->5...*/ -+ ne = _log2(ne<<1) & 0x7; -+ nf = _log2(nf<<1) & 0x7; -+ -+ /* Mask out old watermarks */ -+ val = queue_read_cfg_reg(queue) & ~0xfc000000; -+ queue_write_cfg_reg(queue, val | (ne << 26) | (nf << 29)); -+} -+ -+int queue_set_irq_src(struct qm_queue *queue, int flag) -+{ -+ struct qm_qmgr *qmgr = dev_get_drvdata(queue->dev); -+ u32 reg; -+ int offs, bitoffs; -+ -+ /* Q 0-7 are in REG0, 8-15 are in REG1, etc. They occupy 4 bits/Q */ -+ offs = queue->id/8 + INT0_SRC_SELREG0; -+ bitoffs = (queue->id % 8)*4; -+ -+ reg = *(qmgr->addr + offs) & ~(0xf << bitoffs); -+ *(qmgr->addr + offs) = reg | (flag << bitoffs); -+ -+ return 0; -+} -+ -+static irqreturn_t irq_qm1(int irq, void *dev_id) -+{ -+ struct qm_qmgr *qmgr = dev_id; -+ int offs, reg; -+ struct qm_queue *queue; -+ -+ if (poll_enable) -+ pmu_timer_restart(); -+ -+ reg = *(qmgr->addr + QUE_INT_REG0); -+ while(reg) { -+ /* -+ * count leading zeros. "offs" gets -+ * the amount of leading 0 in "reg" -+ */ -+ asm ("clz %0, %1;" : "=r"(offs) : "r"(reg)); -+ offs = 31 - offs; -+ reg &= ~(1 << offs); -+ queue = qmgr->queues[offs]; -+ if (likely(queue)) { -+ if (likely(queue->irq_cb)) { -+ queue->irq_cb(queue); -+ } else { -+ printk(KERN_ERR "Missing callback for Q %d\n", -+ offs); -+ } -+ } else { -+ printk(KERN_ERR "IRQ for unregistered Q %d\n", offs); -+ } -+ } -+ return IRQ_HANDLED; -+} -+ -+struct qm_queue *request_queue(int qid, int len) -+{ -+ int ram; -+ struct qm_qmgr *qmgr; -+ struct qm_queue *queue; -+ -+ if (!qmgr_dev) -+ return ERR_PTR(-ENODEV); -+ -+ if ((qid < 0) || (qid > MAX_QUEUES)) -+ return ERR_PTR(-ERANGE); -+ -+ switch (len) { -+ case 16: -+ case 32: -+ case 64: -+ case 128: break; -+ default : return ERR_PTR(-EINVAL); -+ } -+ -+ qmgr = dev_get_drvdata(qmgr_dev); -+ -+ if (qmgr->queues[qid]) { -+ /* not an error, just in use already */ -+ return NULL; -+ } -+ if ((ram = get_free_qspace(qmgr, len)) < 0) { -+ printk(KERN_ERR "No free SRAM space for this queue\n"); -+ return ERR_PTR(-ENOMEM); -+ } -+ if (!(queue = kzalloc(sizeof(struct qm_queue), GFP_KERNEL))) -+ return ERR_PTR(-ENOMEM); -+ -+ if (!try_module_get(THIS_MODULE)) { -+ kfree(queue); -+ return ERR_PTR(-ENODEV); -+ } -+ -+ queue->addr = ram; -+ queue->len = len; -+ queue->id = qid; -+ queue->dev = get_device(qmgr_dev); -+ queue->acc_reg = qmgr->addr + (4 * qid); -+ qmgr->queues[qid] = queue; -+ if (request_pool(qmgr_dev, len)) { -+ printk(KERN_ERR "Failed to request DMA pool of Q %d\n", qid); -+ } -+ -+ conf_q_regs(queue); -+ return queue; -+} -+ -+void release_queue(struct qm_queue *queue) -+{ -+ struct qm_qmgr *qmgr = dev_get_drvdata(queue->dev); -+ -+ BUG_ON(qmgr->queues[queue->id] != queue); -+ qmgr->queues[queue->id] = NULL; -+ -+ if (free_pool(queue->dev, queue->len)) { -+ printk(KERN_ERR "Failed to release DMA pool of Q %d\n", -+ queue->id); -+ } -+ queue_disable_irq(queue); -+ queue_write_cfg_reg(queue, 0); -+ -+ module_put(THIS_MODULE); -+ put_device(queue->dev); -+ kfree(queue); -+} -+ -+ -+ -+ -+static int qmgr_probe(struct platform_device *pdev) -+{ -+ struct resource *res; -+ struct qm_qmgr *qmgr; -+ int size, ret=0, i; -+ -+ if (!(res = platform_get_resource(pdev, IORESOURCE_MEM, 0))) -+ return -EIO; -+ -+ if ((i = platform_get_irq(pdev, 0)) < 0) -+ return -EIO; -+ -+ if (!(qmgr = kzalloc(sizeof(struct qm_qmgr), GFP_KERNEL))) -+ return -ENOMEM; -+ -+ qmgr->irq = i; -+ size = res->end - res->start +1; -+ qmgr->res = request_mem_region(res->start, size, "ixp_qmgr"); -+ if (!qmgr->res) { -+ ret = -EBUSY; -+ goto out_free; -+ } -+ -+ qmgr->addr = ioremap(res->start, size); -+ if (!qmgr->addr) { -+ ret = -ENOMEM; -+ goto out_rel; -+ } -+ -+ /* Reset Q registers */ -+ for (i=0; i<4; i++) -+ *(qmgr->addr + QUE_LOW_STAT0 +i) = 0x33333333; -+ for (i=0; i<10; i++) -+ *(qmgr->addr + QUE_UO_STAT0 +i) = 0x0; -+ for (i=0; i<4; i++) -+ *(qmgr->addr + INT0_SRC_SELREG0 +i) = 0x0; -+ for (i=0; i<2; i++) { -+ *(qmgr->addr + QUE_IE_REG0 +i) = 0x00; -+ *(qmgr->addr + QUE_INT_REG0 +i) = 0xffffffff; -+ } -+ for (i=0; i<64; i++) { -+ *(qmgr->addr + IX_QMGR_QCFG_BASE + i) = 0x0; -+ } -+ -+ if (poll_enable) { -+ pmu_timer_init(); -+ qmgr->irq = IRQ_IXP4XX_XSCALE_PMU; -+ } -+ ret = request_irq(qmgr->irq, irq_qm1, SA_SHIRQ | SA_INTERRUPT, -+ "qmgr", qmgr); -+ if (ret) { -+ printk(KERN_ERR "Failed to request IRQ(%d)\n", qmgr->irq); -+ ret = -EIO; -+ goto out_rel; -+ } -+ if (poll_enable) -+ pmu_timer_restart(); -+ -+ rwlock_init(&qmgr->lock); -+ qmgr->dmapool = dma_pool_create("qmgr", &pdev->dev, -+ sizeof(struct npe_cont), 32, 0); -+ platform_set_drvdata(pdev, qmgr); -+ -+ qmgr_dev = &pdev->dev; -+ -+ printk(KERN_INFO IXQMGR_VERSION " initialized.\n"); -+ -+ return 0; -+ -+out_rel: -+ release_resource(qmgr->res); -+out_free: -+ kfree(qmgr); -+ return ret; -+} -+ -+static int qmgr_remove(struct platform_device *pdev) -+{ -+ struct qm_qmgr *qmgr = platform_get_drvdata(pdev); -+ int i; -+ -+ for (i=0; i<MAX_QUEUES; i++) { -+ if (qmgr->queues[i]) { -+ printk(KERN_ERR "WARNING Unreleased Q: %d\n", i); -+ release_queue(qmgr->queues[i]); -+ } -+ } -+ -+ if (poll_enable) -+ pmu_timer_disable(); -+ -+ synchronize_irq (qmgr->irq); -+ free_irq(qmgr->irq, qmgr); -+ -+ dma_pool_destroy(qmgr->dmapool); -+ iounmap(qmgr->addr); -+ release_resource(qmgr->res); -+ platform_set_drvdata(pdev, NULL); -+ qmgr_dev = NULL; -+ kfree(qmgr); -+ return 0; -+} -+ -+static struct platform_driver ixp4xx_qmgr = { -+ .driver.name = "ixp4xx_qmgr", -+ .probe = qmgr_probe, -+ .remove = qmgr_remove, -+}; -+ -+ -+static int __init init_qmgr(void) -+{ -+ return platform_driver_register(&ixp4xx_qmgr); -+} -+ -+static void __exit finish_qmgr(void) -+{ -+ platform_driver_unregister(&ixp4xx_qmgr); -+} -+ -+module_init(init_qmgr); -+module_exit(finish_qmgr); -+ -+MODULE_LICENSE("GPL"); -+MODULE_AUTHOR("Christian Hohnstaedt <chohnstaedt@innominate.com>"); -+ -+EXPORT_SYMBOL(request_queue); -+EXPORT_SYMBOL(release_queue); -+EXPORT_SYMBOL(queue_set_irq_src); -+EXPORT_SYMBOL(queue_set_watermarks); -+EXPORT_SYMBOL(queue_len); -Index: linux-2.6.21.7/drivers/net/ixp4xx/mac.h -=================================================================== ---- /dev/null -+++ linux-2.6.21.7/drivers/net/ixp4xx/mac.h -@@ -0,0 +1,275 @@ -+/* -+ * Copyright (C) 2002-2006 Christian Hohnstaedt <chohnstaedt@innominate.com> -+ * -+ * This file is released under the GPLv2 -+ */ -+ -+#include <linux/resource.h> -+#include <linux/netdevice.h> -+#include <linux/io.h> -+#include <linux/mii.h> -+#include <linux/workqueue.h> -+#include <asm/hardware.h> -+#include <linux/ixp_qmgr.h> -+ -+/* 32 bit offsets to be added to u32 *pointers */ -+#define MAC_TX_CNTRL1 0x00 // 0x000 -+#define MAC_TX_CNTRL2 0x01 // 0x004 -+#define MAC_RX_CNTRL1 0x04 // 0x010 -+#define MAC_RX_CNTRL2 0x05 // 0x014 -+#define MAC_RANDOM_SEED 0x08 // 0x020 -+#define MAC_THRESH_P_EMPTY 0x0c // 0x030 -+#define MAC_THRESH_P_FULL 0x0e // 0x038 -+#define MAC_BUF_SIZE_TX 0x10 // 0x040 -+#define MAC_TX_DEFER 0x14 // 0x050 -+#define MAC_RX_DEFER 0x15 // 0x054 -+#define MAC_TX_TWO_DEFER_1 0x18 // 0x060 -+#define MAC_TX_TWO_DEFER_2 0x19 // 0x064 -+#define MAC_SLOT_TIME 0x1c // 0x070 -+#define MAC_MDIO_CMD 0x20 // 0x080 4 registers 0x20 - 0x23 -+#define MAC_MDIO_STS 0x24 // 0x090 4 registers 0x24 - 0x27 -+#define MAC_ADDR_MASK 0x28 // 0x0A0 6 registers 0x28 - 0x2d -+#define MAC_ADDR 0x30 // 0x0C0 6 registers 0x30 - 0x35 -+#define MAC_INT_CLK_THRESH 0x38 // 0x0E0 1 register -+#define MAC_UNI_ADDR 0x3c // 0x0F0 6 registers 0x3c - 0x41 -+#define MAC_CORE_CNTRL 0x7f // 0x1fC -+ -+/* TX Control Register 1*/ -+ -+#define TX_CNTRL1_TX_EN BIT(0) -+#define TX_CNTRL1_DUPLEX BIT(1) -+#define TX_CNTRL1_RETRY BIT(2) -+#define TX_CNTRL1_PAD_EN BIT(3) -+#define TX_CNTRL1_FCS_EN BIT(4) -+#define TX_CNTRL1_2DEFER BIT(5) -+#define TX_CNTRL1_RMII BIT(6) -+ -+/* TX Control Register 2 */ -+#define TX_CNTRL2_RETRIES_MASK 0xf -+ -+/* RX Control Register 1 */ -+#define RX_CNTRL1_RX_EN BIT(0) -+#define RX_CNTRL1_PADSTRIP_EN BIT(1) -+#define RX_CNTRL1_CRC_EN BIT(2) -+#define RX_CNTRL1_PAUSE_EN BIT(3) -+#define RX_CNTRL1_LOOP_EN BIT(4) -+#define RX_CNTRL1_ADDR_FLTR_EN BIT(5) -+#define RX_CNTRL1_RX_RUNT_EN BIT(6) -+#define RX_CNTRL1_BCAST_DIS BIT(7) -+ -+/* RX Control Register 2 */ -+#define RX_CNTRL2_DEFER_EN BIT(0) -+ -+/* Core Control Register */ -+#define CORE_RESET BIT(0) -+#define CORE_RX_FIFO_FLUSH BIT(1) -+#define CORE_TX_FIFO_FLUSH BIT(2) -+#define CORE_SEND_JAM BIT(3) -+#define CORE_MDC_EN BIT(4) -+ -+/* Definitions for MII access routines*/ -+ -+#define MII_REG_SHL 16 -+#define MII_ADDR_SHL 21 -+ -+#define MII_GO BIT(31) -+#define MII_WRITE BIT(26) -+#define MII_READ_FAIL BIT(31) -+ -+#define MII_TIMEOUT_10TH_SECS 5 -+#define MII_10TH_SEC_IN_MILLIS 100 -+ -+/* -+ * -+ * Default values -+ * -+ */ -+ -+#define MAC_DEF_MSG_ENABLE (NETIF_MSG_DRV | NETIF_MSG_PROBE | NETIF_MSG_LINK) -+ -+#define MAC_TX_CNTRL1_DEFAULT (\ -+ TX_CNTRL1_TX_EN | \ -+ TX_CNTRL1_RETRY | \ -+ TX_CNTRL1_FCS_EN | \ -+ TX_CNTRL1_2DEFER | \ -+ TX_CNTRL1_PAD_EN ) -+ -+#define MAC_TX_MAX_RETRIES_DEFAULT 0x0f -+ -+#define MAC_RX_CNTRL1_DEFAULT ( \ -+ RX_CNTRL1_PADSTRIP_EN | \ -+ RX_CNTRL1_CRC_EN | \ -+ RX_CNTRL1_RX_EN ) -+ -+#define MAC_RX_CNTRL2_DEFAULT 0x0 -+#define MAC_TX_CNTRL2_DEFAULT TX_CNTRL2_RETRIES_MASK -+ -+/* Thresholds determined by NPE firmware FS */ -+#define MAC_THRESH_P_EMPTY_DEFAULT 0x12 -+#define MAC_THRESH_P_FULL_DEFAULT 0x30 -+ -+/* Number of bytes that must be in the tx fifo before -+ * transmission commences */ -+#define MAC_BUF_SIZE_TX_DEFAULT 0x8 -+ -+/* One-part deferral values */ -+#define MAC_TX_DEFER_DEFAULT 0x15 -+#define MAC_RX_DEFER_DEFAULT 0x16 -+ -+/* Two-part deferral values... */ -+#define MAC_TX_TWO_DEFER_1_DEFAULT 0x08 -+#define MAC_TX_TWO_DEFER_2_DEFAULT 0x07 -+ -+/* This value applies to MII */ -+#define MAC_SLOT_TIME_DEFAULT 0x80 -+ -+/* This value applies to RMII */ -+#define MAC_SLOT_TIME_RMII_DEFAULT 0xFF -+ -+#define MAC_ADDR_MASK_DEFAULT 0xFF -+ -+#define MAC_INT_CLK_THRESH_DEFAULT 0x1 -+/* The following is a value chosen at random */ -+#define MAC_RANDOM_SEED_DEFAULT 0x8 -+ -+/* By default we must configure the MAC to generate the MDC clock*/ -+#define CORE_DEFAULT (CORE_MDC_EN) -+ -+/* End of Intel provided register information */ -+ -+extern int -+mdio_read_register(struct net_device *dev, int phy_addr, int phy_reg); -+extern void -+mdio_write_register(struct net_device *dev, int phy_addr, int phy_reg, int val); -+extern void init_mdio(struct net_device *dev, int phy_id); -+ -+struct mac_info { -+ u32 __iomem *addr; -+ struct resource *res; -+ struct device *npe_dev; -+ struct net_device *netdev; -+ struct qm_qmgr *qmgr; -+ struct qm_queue *rxq; -+ struct qm_queue *txq; -+ struct qm_queue *rxdoneq; -+ u32 irqflags; -+ struct net_device_stats stat; -+ struct mii_if_info mii; -+ struct delayed_work mdio_thread; -+ int rxq_pkt; -+ int txq_pkt; -+ int unloading; -+ struct mac_plat_info *plat; -+ int npe_stat_num; -+ spinlock_t rx_lock; -+ u32 msg_enable; -+}; -+ -+static inline void mac_write_reg(struct mac_info *mac, int offset, u32 val) -+{ -+ *(mac->addr + offset) = val; -+} -+static inline u32 mac_read_reg(struct mac_info *mac, int offset) -+{ -+ return *(mac->addr + offset); -+} -+static inline void mac_set_regbit(struct mac_info *mac, int offset, u32 bit) -+{ -+ mac_write_reg(mac, offset, mac_read_reg(mac, offset) | bit); -+} -+static inline void mac_reset_regbit(struct mac_info *mac, int offset, u32 bit) -+{ -+ mac_write_reg(mac, offset, mac_read_reg(mac, offset) & ~bit); -+} -+ -+static inline void mac_mdio_cmd_write(struct mac_info *mac, u32 cmd) -+{ -+ int i; -+ for(i=0; i<4; i++) { -+ mac_write_reg(mac, MAC_MDIO_CMD + i, cmd & 0xff); -+ cmd >>=8; -+ } -+} -+ -+#define mac_mdio_cmd_read(mac) mac_mdio_read((mac), MAC_MDIO_CMD) -+#define mac_mdio_status_read(mac) mac_mdio_read((mac), MAC_MDIO_STS) -+static inline u32 mac_mdio_read(struct mac_info *mac, int offset) -+{ -+ int i; -+ u32 data = 0; -+ for(i=0; i<4; i++) { -+ data |= (mac_read_reg(mac, offset + i) & 0xff) << (i*8); -+ } -+ return data; -+} -+ -+static inline u32 mdio_cmd(int phy_addr, int phy_reg) -+{ -+ return phy_addr << MII_ADDR_SHL | -+ phy_reg << MII_REG_SHL | -+ MII_GO; -+} -+ -+#define MAC_REG_LIST { \ -+ MAC_TX_CNTRL1, MAC_TX_CNTRL2, \ -+ MAC_RX_CNTRL1, MAC_RX_CNTRL2, \ -+ MAC_RANDOM_SEED, MAC_THRESH_P_EMPTY, MAC_THRESH_P_FULL, \ -+ MAC_BUF_SIZE_TX, MAC_TX_DEFER, MAC_RX_DEFER, \ -+ MAC_TX_TWO_DEFER_1, MAC_TX_TWO_DEFER_2, MAC_SLOT_TIME, \ -+ MAC_ADDR_MASK +0, MAC_ADDR_MASK +1, MAC_ADDR_MASK +2, \ -+ MAC_ADDR_MASK +3, MAC_ADDR_MASK +4, MAC_ADDR_MASK +5, \ -+ MAC_ADDR +0, MAC_ADDR +1, MAC_ADDR +2, \ -+ MAC_ADDR +3, MAC_ADDR +4, MAC_ADDR +5, \ -+ MAC_INT_CLK_THRESH, \ -+ MAC_UNI_ADDR +0, MAC_UNI_ADDR +1, MAC_UNI_ADDR +2, \ -+ MAC_UNI_ADDR +3, MAC_UNI_ADDR +4, MAC_UNI_ADDR +5, \ -+ MAC_CORE_CNTRL \ -+} -+ -+#define NPE_STAT_NUM 34 -+#define NPE_STAT_NUM_BASE 22 -+#define NPE_Q_STAT_NUM 4 -+ -+#define NPE_Q_STAT_STRINGS \ -+ {"RX ready to use queue len "}, \ -+ {"RX received queue len "}, \ -+ {"TX to be send queue len "}, \ -+ {"TX done queue len "}, -+ -+#define NPE_STAT_STRINGS \ -+ {"StatsAlignmentErrors "}, \ -+ {"StatsFCSErrors "}, \ -+ {"StatsInternalMacReceiveErrors "}, \ -+ {"RxOverrunDiscards "}, \ -+ {"RxLearnedEntryDiscards "}, \ -+ {"RxLargeFramesDiscards "}, \ -+ {"RxSTPBlockedDiscards "}, \ -+ {"RxVLANTypeFilterDiscards "}, \ -+ {"RxVLANIdFilterDiscards "}, \ -+ {"RxInvalidSourceDiscards "}, \ -+ {"RxBlackListDiscards "}, \ -+ {"RxWhiteListDiscards "}, \ -+ {"RxUnderflowEntryDiscards "}, \ -+ {"StatsSingleCollisionFrames "}, \ -+ {"StatsMultipleCollisionFrames "}, \ -+ {"StatsDeferredTransmissions "}, \ -+ {"StatsLateCollisions "}, \ -+ {"StatsExcessiveCollsions "}, \ -+ {"StatsInternalMacTransmitErrors"}, \ -+ {"StatsCarrierSenseErrors "}, \ -+ {"TxLargeFrameDiscards "}, \ -+ {"TxVLANIdFilterDiscards "}, \ -+\ -+ {"RxValidFramesTotalOctets "}, \ -+ {"RxUcastPkts "}, \ -+ {"RxBcastPkts "}, \ -+ {"RxMcastPkts "}, \ -+ {"RxPkts64Octets "}, \ -+ {"RxPkts65to127Octets "}, \ -+ {"RxPkts128to255Octets "}, \ -+ {"RxPkts256to511Octets "}, \ -+ {"RxPkts512to1023Octets "}, \ -+ {"RxPkts1024to1518Octets "}, \ -+ {"RxInternalNPEReceiveErrors "}, \ -+ {"TxInternalNPETransmitErrors "} -+ -Index: linux-2.6.21.7/drivers/net/ixp4xx/mac_driver.c -=================================================================== ---- /dev/null -+++ linux-2.6.21.7/drivers/net/ixp4xx/mac_driver.c -@@ -0,0 +1,850 @@ -+/* -+ * mac_driver.c - provide a network interface for each MAC -+ * -+ * Copyright (C) 2006 Christian Hohnstaedt <chohnstaedt@innominate.com> -+ * -+ * This file is released under the GPLv2 -+ */ -+ -+#include <linux/kernel.h> -+#include <linux/module.h> -+#include <linux/platform_device.h> -+#include <linux/netdevice.h> -+#include <linux/etherdevice.h> -+#include <linux/ethtool.h> -+#include <linux/slab.h> -+#include <linux/delay.h> -+#include <linux/err.h> -+#include <linux/dma-mapping.h> -+#include <linux/workqueue.h> -+#include <asm/io.h> -+#include <asm/irq.h> -+ -+ -+#include <linux/ixp_qmgr.h> -+#include <linux/ixp_npe.h> -+#include "mac.h" -+ -+#define MDIO_INTERVAL (3*HZ) -+#define RX_QUEUE_PREFILL 64 -+#define TX_QUEUE_PREFILL 16 -+ -+#define IXMAC_NAME "ixp4xx_mac" -+#define IXMAC_VERSION "0.3.1" -+ -+#define MAC_DEFAULT_REG(mac, name) \ -+ mac_write_reg(mac, MAC_ ## name, MAC_ ## name ## _DEFAULT) -+ -+#define TX_DONE_QID 31 -+ -+#define DMA_ALLOC_SIZE 2048 -+#define DMA_HDR_SIZE (sizeof(struct npe_cont)) -+#define DMA_BUF_SIZE (DMA_ALLOC_SIZE - DMA_HDR_SIZE) -+ -+/* Since the NPEs use 1 Return Q for sent frames, we need a device -+ * independent return Q. We call it tx_doneq. -+ * It will be initialized during module load and uninitialized -+ * during module unload. Evil hack, but there is no choice :-( -+ */ -+ -+static struct qm_queue *tx_doneq = NULL; -+static int debug = -1; -+module_param(debug, int, 0); -+ -+static int init_buffer(struct qm_queue *queue, int count) -+{ -+ int i; -+ struct npe_cont *cont; -+ -+ for (i=0; i<count; i++) { -+ cont = kmalloc(DMA_ALLOC_SIZE, GFP_KERNEL | GFP_DMA); -+ if (!cont) -+ goto err; -+ -+ cont->phys = dma_map_single(queue->dev, cont, DMA_ALLOC_SIZE, -+ DMA_BIDIRECTIONAL); -+ if (dma_mapping_error(cont->phys)) -+ goto err; -+ -+ cont->data = cont+1; -+ /* now the buffer is on a 32 bit boundary. -+ * we add 2 bytes for good alignment to SKB */ -+ cont->data+=2; -+ cont->eth.next = 0; -+ cont->eth.buf_len = cpu_to_npe16(DMA_BUF_SIZE); -+ cont->eth.pkt_len = 0; -+ /* also add 2 alignment bytes from cont->data*/ -+ cont->eth.phys_addr = cpu_to_npe32(cont->phys+ DMA_HDR_SIZE+ 2); -+ -+ dma_sync_single(queue->dev, cont->phys, DMA_HDR_SIZE, -+ DMA_TO_DEVICE); -+ -+ queue_put_entry(queue, cont->phys); -+ if (queue_stat(queue) == 2) { /* overflow */ -+ dma_unmap_single(queue->dev, cont->phys, DMA_ALLOC_SIZE, -+ DMA_BIDIRECTIONAL); -+ goto err; -+ } -+ } -+ return i; -+err: -+ if (cont) -+ kfree(cont); -+ return i; -+} -+ -+static int destroy_buffer(struct qm_queue *queue, int count) -+{ -+ u32 phys; -+ int i; -+ struct npe_cont *cont; -+ -+ for (i=0; i<count; i++) { -+ phys = queue_get_entry(queue) & ~0xf; -+ if (!phys) -+ break; -+ dma_unmap_single(queue->dev, phys, DMA_ALLOC_SIZE, -+ DMA_BIDIRECTIONAL); -+ cont = dma_to_virt(queue->dev, phys); -+ kfree(cont); -+ } -+ return i; -+} -+ -+static void mac_init(struct mac_info *mac) -+{ -+ MAC_DEFAULT_REG(mac, TX_CNTRL2); -+ MAC_DEFAULT_REG(mac, RANDOM_SEED); -+ MAC_DEFAULT_REG(mac, THRESH_P_EMPTY); -+ MAC_DEFAULT_REG(mac, THRESH_P_FULL); -+ MAC_DEFAULT_REG(mac, TX_DEFER); -+ MAC_DEFAULT_REG(mac, TX_TWO_DEFER_1); -+ MAC_DEFAULT_REG(mac, TX_TWO_DEFER_2); -+ MAC_DEFAULT_REG(mac, SLOT_TIME); -+ MAC_DEFAULT_REG(mac, INT_CLK_THRESH); -+ MAC_DEFAULT_REG(mac, BUF_SIZE_TX); -+ MAC_DEFAULT_REG(mac, TX_CNTRL1); -+ MAC_DEFAULT_REG(mac, RX_CNTRL1); -+} -+ -+static void mac_set_uniaddr(struct net_device *dev) -+{ -+ int i; -+ struct mac_info *mac = netdev_priv(dev); -+ struct npe_info *npe = dev_get_drvdata(mac->npe_dev); -+ -+ /* check for multicast */ -+ if (dev->dev_addr[0] & 1) -+ return; -+ -+ npe_mh_setportaddr(npe, mac->plat, dev->dev_addr); -+ npe_mh_disable_firewall(npe, mac->plat); -+ for (i=0; i<dev->addr_len; i++) -+ mac_write_reg(mac, MAC_UNI_ADDR + i, dev->dev_addr[i]); -+} -+ -+static void update_duplex_mode(struct net_device *dev) -+{ -+ struct mac_info *mac = netdev_priv(dev); -+ if (netif_msg_link(mac)) { -+ printk(KERN_DEBUG "Link of %s is %s-duplex\n", dev->name, -+ mac->mii.full_duplex ? "full" : "half"); -+ } -+ if (mac->mii.full_duplex) { -+ mac_reset_regbit(mac, MAC_TX_CNTRL1, TX_CNTRL1_DUPLEX); -+ } else { -+ mac_set_regbit(mac, MAC_TX_CNTRL1, TX_CNTRL1_DUPLEX); -+ } -+} -+ -+static int media_check(struct net_device *dev, int init) -+{ -+ struct mac_info *mac = netdev_priv(dev); -+ -+ if (mii_check_media(&mac->mii, netif_msg_link(mac), init)) { -+ update_duplex_mode(dev); -+ return 1; -+ } -+ return 0; -+} -+ -+static void get_npe_stats(struct mac_info *mac, u32 *buf, int len, int reset) -+{ -+ struct npe_info *npe = dev_get_drvdata(mac->npe_dev); -+ u32 phys; -+ -+ memset(buf, len, 0); -+ phys = dma_map_single(mac->npe_dev, buf, len, DMA_BIDIRECTIONAL); -+ npe_mh_get_stats(npe, mac->plat, phys, reset); -+ dma_unmap_single(mac->npe_dev, phys, len, DMA_BIDIRECTIONAL); -+} -+ -+static void irqcb_recv(struct qm_queue *queue) -+{ -+ struct net_device *dev = queue->cb_data; -+ -+ queue_ack_irq(queue); -+ queue_disable_irq(queue); -+ if (netif_running(dev)) -+ netif_rx_schedule(dev); -+} -+ -+int ix_recv(struct net_device *dev, int *budget, struct qm_queue *queue) -+{ -+ struct mac_info *mac = netdev_priv(dev); -+ struct sk_buff *skb; -+ u32 phys; -+ struct npe_cont *cont; -+ -+ while (*budget > 0 && netif_running(dev) ) { -+ int len; -+ phys = queue_get_entry(queue) & ~0xf; -+ if (!phys) -+ break; -+ dma_sync_single(queue->dev, phys, DMA_HDR_SIZE, -+ DMA_FROM_DEVICE); -+ cont = dma_to_virt(queue->dev, phys); -+ len = npe_to_cpu16(cont->eth.pkt_len) -4; /* strip FCS */ -+ -+ if (unlikely(netif_msg_rx_status(mac))) { -+ printk(KERN_DEBUG "%s: RX packet size: %u\n", -+ dev->name, len); -+ queue_state(mac->rxq); -+ queue_state(mac->rxdoneq); -+ } -+ skb = dev_alloc_skb(len + 2); -+ if (likely(skb)) { -+ skb->dev = dev; -+ skb_reserve(skb, 2); -+ dma_sync_single(queue->dev, cont->eth.phys_addr, len, -+ DMA_FROM_DEVICE); -+#ifdef CONFIG_NPE_ADDRESS_COHERENT -+ /* swap the payload of the SKB */ -+ { -+ u32 *t = (u32*)(skb->data-2); -+ u32 *s = (u32*)(cont->data-2); -+ int i, j = (len+5)/4; -+ for (i=0; i<j; i++) -+ t[i] = cpu_to_be32(s[i]); -+ } -+#else -+ eth_copy_and_sum(skb, cont->data, len, 0); -+#endif -+ skb_put(skb, len); -+ skb->protocol = eth_type_trans(skb, dev); -+ dev->last_rx = jiffies; -+ netif_receive_skb(skb); -+ mac->stat.rx_packets++; -+ mac->stat.rx_bytes += skb->len; -+ } else { -+ mac->stat.rx_dropped++; -+ } -+ cont->eth.buf_len = cpu_to_npe16(DMA_BUF_SIZE); -+ cont->eth.pkt_len = 0; -+ dma_sync_single(queue->dev, phys, DMA_HDR_SIZE, DMA_TO_DEVICE); -+ queue_put_entry(mac->rxq, phys); -+ dev->quota--; -+ (*budget)--; -+ } -+ -+ return !budget; -+} -+ -+static int ix_poll(struct net_device *dev, int *budget) -+{ -+ struct mac_info *mac = netdev_priv(dev); -+ struct qm_queue *queue = mac->rxdoneq; -+ -+ for (;;) { -+ if (ix_recv(dev, budget, queue)) -+ return 1; -+ netif_rx_complete(dev); -+ queue_enable_irq(queue); -+ if (!queue_len(queue)) -+ break; -+ queue_disable_irq(queue); -+ if (netif_rx_reschedule(dev, 0)) -+ break; -+ } -+ return 0; -+} -+ -+static void ixmac_set_rx_mode (struct net_device *dev) -+{ -+ struct mac_info *mac = netdev_priv(dev); -+ struct dev_mc_list *mclist; -+ u8 aset[dev->addr_len], aclear[dev->addr_len]; -+ int i,j; -+ -+ if (dev->flags & IFF_PROMISC) { -+ mac_reset_regbit(mac, MAC_RX_CNTRL1, RX_CNTRL1_ADDR_FLTR_EN); -+ } else { -+ mac_set_regbit(mac, MAC_RX_CNTRL1, RX_CNTRL1_ADDR_FLTR_EN); -+ -+ mclist = dev->mc_list; -+ memset(aset, 0xff, dev->addr_len); -+ memset(aclear, 0x00, dev->addr_len); -+ for (i = 0; mclist && i < dev->mc_count; i++) { -+ for (j=0; j< dev->addr_len; j++) { -+ aset[j] &= mclist->dmi_addr[j]; -+ aclear[j] |= mclist->dmi_addr[j]; -+ } -+ mclist = mclist->next; -+ } -+ for (j=0; j< dev->addr_len; j++) { -+ aclear[j] = aset[j] | ~aclear[j]; -+ } -+ for (i=0; i<dev->addr_len; i++) { -+ mac_write_reg(mac, MAC_ADDR + i, aset[i]); -+ mac_write_reg(mac, MAC_ADDR_MASK + i, aclear[i]); -+ } -+ } -+} -+ -+static int ixmac_open (struct net_device *dev) -+{ -+ struct mac_info *mac = netdev_priv(dev); -+ struct npe_info *npe = dev_get_drvdata(mac->npe_dev); -+ u32 buf[NPE_STAT_NUM]; -+ int i; -+ u32 phys; -+ -+ /* first check if the NPE is up and running */ -+ if (!( npe_status(npe) & IX_NPEDL_EXCTL_STATUS_RUN)) { -+ printk(KERN_ERR "%s: %s not running\n", dev->name, -+ npe->plat->name); -+ return -EIO; -+ } -+ if (npe_mh_status(npe)) { -+ printk(KERN_ERR "%s: %s not responding\n", dev->name, -+ npe->plat->name); -+ return -EIO; -+ } -+ mac->txq_pkt += init_buffer(mac->txq, TX_QUEUE_PREFILL - mac->txq_pkt); -+ mac->rxq_pkt += init_buffer(mac->rxq, RX_QUEUE_PREFILL - mac->rxq_pkt); -+ -+ queue_enable_irq(mac->rxdoneq); -+ -+ /* drain all buffers from then RX-done-q to make the IRQ happen */ -+ while ((phys = queue_get_entry(mac->rxdoneq) & ~0xf)) { -+ struct npe_cont *cont; -+ cont = dma_to_virt(mac->rxdoneq->dev, phys); -+ cont->eth.buf_len = cpu_to_npe16(DMA_BUF_SIZE); -+ cont->eth.pkt_len = 0; -+ dma_sync_single(mac->rxdoneq->dev, phys, DMA_HDR_SIZE, -+ DMA_TO_DEVICE); -+ queue_put_entry(mac->rxq, phys); -+ } -+ mac_init(mac); -+ npe_mh_set_rxqid(npe, mac->plat, mac->plat->rxdoneq_id); -+ get_npe_stats(mac, buf, sizeof(buf), 1); /* reset stats */ -+ get_npe_stats(mac, buf, sizeof(buf), 0); -+ /* -+ * if the extended stats contain random values -+ * the NPE image lacks extendet statistic counters -+ */ -+ for (i=NPE_STAT_NUM_BASE; i<NPE_STAT_NUM; i++) { -+ if (buf[i] >10000) -+ break; -+ } -+ mac->npe_stat_num = i<NPE_STAT_NUM ? NPE_STAT_NUM_BASE : NPE_STAT_NUM; -+ mac->npe_stat_num += NPE_Q_STAT_NUM; -+ -+ mac_set_uniaddr(dev); -+ media_check(dev, 1); -+ ixmac_set_rx_mode(dev); -+ netif_start_queue(dev); -+ schedule_delayed_work(&mac->mdio_thread, MDIO_INTERVAL); -+ if (netif_msg_ifup(mac)) { -+ printk(KERN_DEBUG "%s: open " IXMAC_NAME -+ " RX queue %d bufs, TX queue %d bufs\n", -+ dev->name, mac->rxq_pkt, mac->txq_pkt); -+ } -+ return 0; -+} -+ -+static int ixmac_start_xmit (struct sk_buff *skb, struct net_device *dev) -+{ -+ struct mac_info *mac = netdev_priv(dev); -+ struct npe_cont *cont; -+ u32 phys; -+ struct qm_queue *queue = mac->txq; -+ -+ if (unlikely(skb->len > DMA_BUF_SIZE)) { -+ dev_kfree_skb(skb); -+ mac->stat.tx_errors++; -+ return NETDEV_TX_OK; -+ } -+ phys = queue_get_entry(tx_doneq) & ~0xf; -+ if (!phys) -+ goto busy; -+ cont = dma_to_virt(queue->dev, phys); -+#ifdef CONFIG_NPE_ADDRESS_COHERENT -+ /* swap the payload of the SKB */ -+ { -+ u32 *s = (u32*)(skb->data-2); -+ u32 *t = (u32*)(cont->data-2); -+ int i,j = (skb->len+5) / 4; -+ for (i=0; i<j; i++) -+ t[i] = cpu_to_be32(s[i]); -+ } -+#else -+ //skb_copy_and_csum_dev(skb, cont->data); -+ memcpy(cont->data, skb->data, skb->len); -+#endif -+ cont->eth.buf_len = cpu_to_npe16(DMA_BUF_SIZE); -+ cont->eth.pkt_len = cpu_to_npe16(skb->len); -+ /* disable VLAN functions in NPE image for now */ -+ cont->eth.flags = 0; -+ dma_sync_single(queue->dev, phys, skb->len + DMA_HDR_SIZE, -+ DMA_TO_DEVICE); -+ queue_put_entry(queue, phys); -+ if (queue_stat(queue) == 2) { /* overflow */ -+ queue_put_entry(tx_doneq, phys); -+ goto busy; -+ } -+ dev_kfree_skb(skb); -+ -+ mac->stat.tx_packets++; -+ mac->stat.tx_bytes += skb->len; -+ dev->trans_start = jiffies; -+ if (netif_msg_tx_queued(mac)) { -+ printk(KERN_DEBUG "%s: TX packet size %u\n", -+ dev->name, skb->len); -+ queue_state(mac->txq); -+ queue_state(tx_doneq); -+ } -+ return NETDEV_TX_OK; -+busy: -+ return NETDEV_TX_BUSY; -+} -+ -+static int ixmac_close (struct net_device *dev) -+{ -+ struct mac_info *mac = netdev_priv(dev); -+ -+ netif_stop_queue (dev); -+ queue_disable_irq(mac->rxdoneq); -+ -+ mac->txq_pkt -= destroy_buffer(tx_doneq, mac->txq_pkt); -+ mac->rxq_pkt -= destroy_buffer(mac->rxq, mac->rxq_pkt); -+ -+ cancel_rearming_delayed_work(&(mac->mdio_thread)); -+ -+ if (netif_msg_ifdown(mac)) { -+ printk(KERN_DEBUG "%s: close " IXMAC_NAME -+ " RX queue %d bufs, TX queue %d bufs\n", -+ dev->name, mac->rxq_pkt, mac->txq_pkt); -+ } -+ return 0; -+} -+ -+static int ixmac_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) -+{ -+ struct mac_info *mac = netdev_priv(dev); -+ int rc, duplex_changed; -+ -+ if (!netif_running(dev)) -+ return -EINVAL; -+ if (!try_module_get(THIS_MODULE)) -+ return -ENODEV; -+ rc = generic_mii_ioctl(&mac->mii, if_mii(rq), cmd, &duplex_changed); -+ module_put(THIS_MODULE); -+ if (duplex_changed) -+ update_duplex_mode(dev); -+ return rc; -+} -+ -+static struct net_device_stats *ixmac_stats (struct net_device *dev) -+{ -+ struct mac_info *mac = netdev_priv(dev); -+ return &mac->stat; -+} -+ -+static void ixmac_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) -+{ -+ struct mac_info *mac = netdev_priv(dev); -+ struct npe_info *npe = dev_get_drvdata(mac->npe_dev); -+ -+ strcpy(info->driver, IXMAC_NAME); -+ strcpy(info->version, IXMAC_VERSION); -+ if (npe_status(npe) & IX_NPEDL_EXCTL_STATUS_RUN) { -+ snprintf(info->fw_version, 32, "%d.%d func [%d]", -+ npe->img_info[2], npe->img_info[3], npe->img_info[1]); -+ } -+ strncpy(info->bus_info, npe->plat->name, ETHTOOL_BUSINFO_LEN); -+} -+ -+static int ixmac_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) -+{ -+ struct mac_info *mac = netdev_priv(dev); -+ mii_ethtool_gset(&mac->mii, cmd); -+ return 0; -+} -+ -+static int ixmac_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) -+{ -+ struct mac_info *mac = netdev_priv(dev); -+ int rc; -+ rc = mii_ethtool_sset(&mac->mii, cmd); -+ return rc; -+} -+ -+static int ixmac_nway_reset(struct net_device *dev) -+{ -+ struct mac_info *mac = netdev_priv(dev); -+ return mii_nway_restart(&mac->mii); -+} -+ -+static u32 ixmac_get_link(struct net_device *dev) -+{ -+ struct mac_info *mac = netdev_priv(dev); -+ return mii_link_ok(&mac->mii); -+} -+ -+static const int mac_reg_list[] = MAC_REG_LIST; -+ -+static int ixmac_get_regs_len(struct net_device *dev) -+{ -+ return ARRAY_SIZE(mac_reg_list); -+} -+ -+static void -+ixmac_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *regbuf) -+{ -+ int i; -+ struct mac_info *mac = netdev_priv(dev); -+ u8 *buf = regbuf; -+ -+ for (i=0; i<regs->len; i++) { -+ buf[i] = mac_read_reg(mac, mac_reg_list[i]); -+ } -+} -+ -+static struct { -+ const char str[ETH_GSTRING_LEN]; -+} ethtool_stats_keys[NPE_STAT_NUM + NPE_Q_STAT_NUM] = { -+ NPE_Q_STAT_STRINGS -+ NPE_STAT_STRINGS -+}; -+ -+static void ixmac_get_strings(struct net_device *dev, u32 stringset, u8 *data) -+{ -+ struct mac_info *mac = netdev_priv(dev); -+ memcpy(data, ethtool_stats_keys, mac->npe_stat_num * ETH_GSTRING_LEN); -+} -+ -+static int ixmac_get_stats_count(struct net_device *dev) -+{ -+ struct mac_info *mac = netdev_priv(dev); -+ return mac->npe_stat_num; -+} -+ -+static u32 ixmac_get_msglevel(struct net_device *dev) -+{ -+ struct mac_info *mac = netdev_priv(dev); -+ return mac->msg_enable; -+} -+ -+static void ixmac_set_msglevel(struct net_device *dev, u32 datum) -+{ -+ struct mac_info *mac = netdev_priv(dev); -+ mac->msg_enable = datum; -+} -+ -+static void ixmac_get_ethtool_stats(struct net_device *dev, -+ struct ethtool_stats *stats, u64 *data) -+{ -+ int i; -+ struct mac_info *mac = netdev_priv(dev); -+ u32 buf[NPE_STAT_NUM]; -+ -+ data[0] = queue_len(mac->rxq); -+ data[1] = queue_len(mac->rxdoneq); -+ data[2] = queue_len(mac->txq); -+ data[3] = queue_len(tx_doneq); -+ -+ get_npe_stats(mac, buf, sizeof(buf), 0); -+ -+ for (i=0; i<stats->n_stats-4; i++) { -+ data[i+4] = npe_to_cpu32(buf[i]); -+ } -+} -+ -+static struct ethtool_ops ixmac_ethtool_ops = { -+ .get_drvinfo = ixmac_get_drvinfo, -+ .get_settings = ixmac_get_settings, -+ .set_settings = ixmac_set_settings, -+ .nway_reset = ixmac_nway_reset, -+ .get_link = ixmac_get_link, -+ .get_msglevel = ixmac_get_msglevel, -+ .set_msglevel = ixmac_set_msglevel, -+ .get_regs_len = ixmac_get_regs_len, -+ .get_regs = ixmac_get_regs, -+ .get_perm_addr = ethtool_op_get_perm_addr, -+ .get_strings = ixmac_get_strings, -+ .get_stats_count = ixmac_get_stats_count, -+ .get_ethtool_stats = ixmac_get_ethtool_stats, -+}; -+ -+static void mac_mdio_thread(struct work_struct *work) -+{ -+ struct mac_info *mac = container_of(work, struct mac_info, -+ mdio_thread.work); -+ struct net_device *dev = mac->netdev; -+ -+ media_check(dev, 0); -+ schedule_delayed_work(&mac->mdio_thread, MDIO_INTERVAL); -+} -+ -+static int mac_probe(struct platform_device *pdev) -+{ -+ struct resource *res; -+ struct mac_info *mac; -+ struct net_device *dev; -+ struct npe_info *npe; -+ struct mac_plat_info *plat = pdev->dev.platform_data; -+ int size, ret; -+ -+ if (!(res = platform_get_resource(pdev, IORESOURCE_MEM, 0))) { -+ return -EIO; -+ } -+ if (!(dev = alloc_etherdev (sizeof(struct mac_info)))) { -+ return -ENOMEM; -+ } -+ SET_MODULE_OWNER(dev); -+ SET_NETDEV_DEV(dev, &pdev->dev); -+ mac = netdev_priv(dev); -+ mac->netdev = dev; -+ -+ size = res->end - res->start +1; -+ mac->res = request_mem_region(res->start, size, IXMAC_NAME); -+ if (!mac->res) { -+ ret = -EBUSY; -+ goto out_free; -+ } -+ -+ mac->addr = ioremap(res->start, size); -+ if (!mac->addr) { -+ ret = -ENOMEM; -+ goto out_rel; -+ } -+ -+ dev->open = ixmac_open; -+ dev->hard_start_xmit = ixmac_start_xmit; -+ dev->poll = ix_poll; -+ dev->stop = ixmac_close; -+ dev->get_stats = ixmac_stats; -+ dev->do_ioctl = ixmac_ioctl; -+ dev->set_multicast_list = ixmac_set_rx_mode; -+ dev->ethtool_ops = &ixmac_ethtool_ops; -+ -+ dev->weight = 16; -+ dev->tx_queue_len = 100; -+ -+ mac->npe_dev = get_npe_by_id(plat->npe_id); -+ if (!mac->npe_dev) { -+ ret = -EIO; -+ goto out_unmap; -+ } -+ npe = dev_get_drvdata(mac->npe_dev); -+ -+ mac->rxq = request_queue(plat->rxq_id, 128); -+ if (IS_ERR(mac->rxq)) { -+ printk(KERN_ERR "Error requesting Q: %d\n", plat->rxq_id); -+ ret = -EBUSY; -+ goto out_putmod; -+ } -+ mac->txq = request_queue(plat->txq_id, 128); -+ if (IS_ERR(mac->txq)) { -+ printk(KERN_ERR "Error requesting Q: %d\n", plat->txq_id); -+ ret = -EBUSY; -+ goto out_putmod; -+ } -+ mac->rxdoneq = request_queue(plat->rxdoneq_id, 128); -+ if (IS_ERR(mac->rxdoneq)) { -+ printk(KERN_ERR "Error requesting Q: %d\n", plat->rxdoneq_id); -+ ret = -EBUSY; -+ goto out_putmod; -+ } -+ mac->rxdoneq->irq_cb = irqcb_recv; -+ mac->rxdoneq->cb_data = dev; -+ queue_set_watermarks(mac->rxdoneq, 0, 0); -+ queue_set_irq_src(mac->rxdoneq, Q_IRQ_ID_NOT_E); -+ -+ mac->qmgr = dev_get_drvdata(mac->rxq->dev); -+ if (register_netdev (dev)) { -+ ret = -EIO; -+ goto out_putmod; -+ } -+ -+ mac->plat = plat; -+ mac->npe_stat_num = NPE_STAT_NUM_BASE; -+ mac->msg_enable = netif_msg_init(debug, MAC_DEF_MSG_ENABLE); -+ -+ platform_set_drvdata(pdev, dev); -+ -+ mac_write_reg(mac, MAC_CORE_CNTRL, CORE_RESET); -+ udelay(500); -+ mac_write_reg(mac, MAC_CORE_CNTRL, CORE_MDC_EN); -+ -+ init_mdio(dev, plat->phy_id); -+ -+ 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); -+ -+ return 0; -+ -+out_putmod: -+ if (mac->rxq) -+ release_queue(mac->rxq); -+ if (mac->txq) -+ release_queue(mac->txq); -+ if (mac->rxdoneq) -+ release_queue(mac->rxdoneq); -+ module_put(mac->npe_dev->driver->owner); -+out_unmap: -+ iounmap(mac->addr); -+out_rel: -+ release_resource(mac->res); -+out_free: -+ kfree(mac); -+ return ret; -+} -+ -+static void drain_npe(struct mac_info *mac) -+{ -+ struct npe_info *npe = dev_get_drvdata(mac->npe_dev); -+ struct npe_cont *cont; -+ u32 phys; -+ int loop = 0; -+ -+ /* Now there are some skb hold by the NPE. -+ * We switch the MAC in loopback mode and send a pseudo packet -+ * that will be returned by the NPE in its last SKB. -+ * We will also try to isolate the PHY to keep the packets internal. -+ */ -+ -+ if (mac->txq_pkt <2) -+ mac->txq_pkt += init_buffer(tx_doneq, 5); -+ -+ if (npe_status(npe) & IX_NPEDL_EXCTL_STATUS_RUN) { -+ mac_reset_regbit(mac, MAC_CORE_CNTRL, CORE_MDC_EN); -+ mac_set_regbit(mac, MAC_RX_CNTRL1, RX_CNTRL1_LOOP_EN); -+ -+ npe_mh_npe_loopback_mode(npe, mac->plat, 1); -+ mdelay(200); -+ -+ while (mac->rxq_pkt && loop++ < 2000 ) { -+ phys = queue_get_entry(tx_doneq) & ~0xf; -+ if (!phys) -+ break; -+ cont = dma_to_virt(queue->dev, phys); -+ /* actually the packets should never leave the system, -+ * but if they do, they shall contain 0s instead of -+ * intresting random data.... -+ */ -+ memset(cont->data, 0, 64); -+ cont->eth.pkt_len = 64; -+ dma_sync_single(mac->txq->dev, phys, 64 + DMA_HDR_SIZE, -+ DMA_TO_DEVICE); -+ queue_put_entry(mac->txq, phys); -+ if (queue_stat(mac->txq) == 2) { /* overflow */ -+ queue_put_entry(tx_doneq, phys); -+ break; -+ } -+ mdelay(1); -+ mac->rxq_pkt -= destroy_buffer(mac->rxdoneq, -+ mac->rxq_pkt); -+ } -+ npe_mh_npe_loopback_mode(npe, mac->plat, 0); -+ } -+ /* Flush MAC TX fifo to drain the bogus packages */ -+ mac_set_regbit(mac, MAC_CORE_CNTRL, CORE_TX_FIFO_FLUSH); -+ mac_reset_regbit(mac, MAC_RX_CNTRL1, RX_CNTRL1_RX_EN); -+ mac_reset_regbit(mac, MAC_TX_CNTRL1, TX_CNTRL1_TX_EN); -+ mac_reset_regbit(mac, MAC_RX_CNTRL1, RX_CNTRL1_LOOP_EN); -+ mac_reset_regbit(mac, MAC_CORE_CNTRL, CORE_TX_FIFO_FLUSH); -+ mac_reset_regbit(mac, MAC_CORE_CNTRL, CORE_TX_FIFO_FLUSH); -+} -+ -+static int mac_remove(struct platform_device *pdev) -+{ -+ struct net_device* dev = platform_get_drvdata(pdev); -+ struct mac_info *mac = netdev_priv(dev); -+ -+ unregister_netdev(dev); -+ -+ mac->rxq_pkt -= destroy_buffer(mac->rxq, mac->rxq_pkt); -+ if (mac->rxq_pkt) -+ drain_npe(mac); -+ -+ mac->txq_pkt -= destroy_buffer(mac->txq, mac->txq_pkt); -+ mac->txq_pkt -= destroy_buffer(tx_doneq, mac->txq_pkt); -+ -+ if (mac->rxq_pkt || mac->txq_pkt) -+ printk("Buffers lost in NPE: RX:%d, TX:%d\n", -+ mac->rxq_pkt, mac->txq_pkt); -+ -+ release_queue(mac->txq); -+ release_queue(mac->rxq); -+ release_queue(mac->rxdoneq); -+ -+ flush_scheduled_work(); -+ return_npe_dev(mac->npe_dev); -+ -+ iounmap(mac->addr); -+ release_resource(mac->res); -+ platform_set_drvdata(pdev, NULL); -+ free_netdev(dev); -+ return 0; -+} -+ -+static struct platform_driver ixp4xx_mac = { -+ .driver.name = IXMAC_NAME, -+ .probe = mac_probe, -+ .remove = mac_remove, -+}; -+ -+static int __init init_mac(void) -+{ -+ /* The TX done Queue handles skbs sent out by the NPE */ -+ tx_doneq = request_queue(TX_DONE_QID, 128); -+ if (IS_ERR(tx_doneq)) { -+ printk(KERN_ERR "Error requesting Q: %d\n", TX_DONE_QID); -+ return -EBUSY; -+ } -+ return platform_driver_register(&ixp4xx_mac); -+} -+ -+static void __exit finish_mac(void) -+{ -+ platform_driver_unregister(&ixp4xx_mac); -+ if (tx_doneq) { -+ release_queue(tx_doneq); -+ } -+} -+ -+module_init(init_mac); -+module_exit(finish_mac); -+ -+MODULE_LICENSE("GPL"); -+MODULE_AUTHOR("Christian Hohnstaedt <chohnstaedt@innominate.com>"); -+ -Index: linux-2.6.21.7/drivers/net/ixp4xx/npe.c -=================================================================== ---- /dev/null -+++ linux-2.6.21.7/drivers/net/ixp4xx/npe.c -@@ -0,0 +1,291 @@ -+ -+#include <linux/ixp_npe.h> -+#include <asm/hardware.h> -+ -+#define RESET_NPE_PARITY 0x0800 -+#define PARITY_BIT_MASK 0x3F00FFFF -+#define CONFIG_CTRL_REG_MASK 0x3F3FFFFF -+#define MAX_RETRIES 1000000 -+#define NPE_PHYS_REG 32 -+#define RESET_MBST_VAL 0x0000F0F0 -+#define NPE_REGMAP 0x0000001E -+#define INSTR_WR_REG_SHORT 0x0000C000 -+#define INSTR_WR_REG_BYTE 0x00004000 -+#define MASK_ECS_REG_0_NEXTPC 0x1FFF0000 -+ -+#define INSTR_RD_FIFO 0x0F888220 -+#define INSTR_RESET_MBOX 0x0FAC8210 -+ -+#define ECS_REG_0_LDUR 8 -+#define ECS_REG_1_CCTXT 16 -+#define ECS_REG_1_SELCTXT 0 -+ -+#define ECS_BG_CTXT_REG_0 0x00 -+#define ECS_BG_CTXT_REG_1 0x01 -+#define ECS_BG_CTXT_REG_2 0x02 -+#define ECS_PRI_1_CTXT_REG_0 0x04 -+#define ECS_PRI_1_CTXT_REG_1 0x05 -+#define ECS_PRI_1_CTXT_REG_2 0x06 -+#define ECS_PRI_2_CTXT_REG_0 0x08 -+#define ECS_PRI_2_CTXT_REG_1 0x09 -+#define ECS_PRI_2_CTXT_REG_2 0x0A -+#define ECS_DBG_CTXT_REG_0 0x0C -+#define ECS_DBG_CTXT_REG_1 0x0D -+#define ECS_DBG_CTXT_REG_2 0x0E -+#define ECS_INSTRUCT_REG 0x11 -+ -+#define ECS_BG_CTXT_REG_0_RESET 0xA0000000 -+#define ECS_BG_CTXT_REG_1_RESET 0x01000000 -+#define ECS_BG_CTXT_REG_2_RESET 0x00008000 -+#define ECS_PRI_1_CTXT_REG_0_RESET 0x20000080 -+#define ECS_PRI_1_CTXT_REG_1_RESET 0x01000000 -+#define ECS_PRI_1_CTXT_REG_2_RESET 0x00008000 -+#define ECS_PRI_2_CTXT_REG_0_RESET 0x20000080 -+#define ECS_PRI_2_CTXT_REG_1_RESET 0x01000000 -+#define ECS_PRI_2_CTXT_REG_2_RESET 0x00008000 -+#define ECS_DBG_CTXT_REG_0_RESET 0x20000000 -+#define ECS_DBG_CTXT_REG_1_RESET 0x00000000 -+#define ECS_DBG_CTXT_REG_2_RESET 0x001E0000 -+#define ECS_INSTRUCT_REG_RESET 0x1003C00F -+ -+static struct { u32 reg; u32 val; } ecs_reset[] = -+{ -+ { ECS_BG_CTXT_REG_0, ECS_BG_CTXT_REG_0_RESET }, -+ { ECS_BG_CTXT_REG_1, ECS_BG_CTXT_REG_1_RESET }, -+ { ECS_BG_CTXT_REG_2, ECS_BG_CTXT_REG_2_RESET }, -+ { ECS_PRI_1_CTXT_REG_0, ECS_PRI_1_CTXT_REG_0_RESET }, -+ { ECS_PRI_1_CTXT_REG_1, ECS_PRI_1_CTXT_REG_1_RESET }, -+ { ECS_PRI_1_CTXT_REG_2, ECS_PRI_1_CTXT_REG_2_RESET }, -+ { ECS_PRI_2_CTXT_REG_0, ECS_PRI_2_CTXT_REG_0_RESET }, -+ { ECS_PRI_2_CTXT_REG_1, ECS_PRI_2_CTXT_REG_1_RESET }, -+ { ECS_PRI_2_CTXT_REG_2, ECS_PRI_2_CTXT_REG_2_RESET }, -+ { ECS_DBG_CTXT_REG_0, ECS_DBG_CTXT_REG_0_RESET }, -+ { ECS_DBG_CTXT_REG_1, ECS_DBG_CTXT_REG_1_RESET }, -+ { ECS_DBG_CTXT_REG_2, ECS_DBG_CTXT_REG_2_RESET }, -+ { ECS_INSTRUCT_REG, ECS_INSTRUCT_REG_RESET } -+}; -+ -+/* actually I have no idea what I'm doing here !! -+ * I only rewrite the "reset" sequence the way Intel does it. -+ */ -+ -+static void npe_debg_preexec(struct npe_info *npe) -+{ -+ u32 r = IX_NPEDL_MASK_ECS_DBG_REG_2_IF | IX_NPEDL_MASK_ECS_DBG_REG_2_IE; -+ -+ npe->exec_count = npe_reg_read(npe, IX_NPEDL_REG_OFFSET_EXCT); -+ npe_reg_write(npe, IX_NPEDL_REG_OFFSET_EXCT, 0); -+ npe->ctx_reg2 = npe_read_ecs_reg(npe, ECS_DBG_CTXT_REG_2); -+ npe_write_ecs_reg(npe, ECS_DBG_CTXT_REG_2, npe->ctx_reg2 | r); -+} -+ -+static void npe_debg_postexec(struct npe_info *npe) -+{ -+ npe_write_ecs_reg(npe, ECS_DBG_CTXT_REG_0, 0); -+ npe_write_exctl(npe, IX_NPEDL_EXCTL_CMD_NPE_CLR_PIPE); -+ npe_reg_write(npe, IX_NPEDL_REG_OFFSET_EXCT, npe->exec_count); -+ npe_write_ecs_reg(npe, ECS_DBG_CTXT_REG_2, npe->ctx_reg2); -+} -+ -+static int -+npe_debg_inst_exec(struct npe_info *npe, u32 instr, u32 ctx, u32 ldur) -+{ -+ u32 regval, wc; -+ int c = 0; -+ -+ regval = IX_NPEDL_MASK_ECS_REG_0_ACTIVE | -+ (ldur << ECS_REG_0_LDUR); -+ npe_write_ecs_reg(npe, ECS_DBG_CTXT_REG_0 , regval); -+ /* set CCTXT at ECS DEBUG L3 to specify in which context -+ * to execute the instruction -+ */ -+ regval = (ctx << ECS_REG_1_CCTXT) | -+ (ctx << ECS_REG_1_SELCTXT); -+ npe_write_ecs_reg(npe, ECS_DBG_CTXT_REG_1, regval); -+ -+ /* clear the pipeline */ -+ npe_write_exctl(npe, IX_NPEDL_EXCTL_CMD_NPE_CLR_PIPE); -+ -+ /* load NPE instruction into the instruction register */ -+ npe_write_ecs_reg(npe, ECS_INSTRUCT_REG, instr); -+ /* we need this value later to wait for -+ * completion of NPE execution step -+ */ -+ wc = npe_reg_read(npe, IX_NPEDL_REG_OFFSET_WC); -+ npe_write_exctl(npe, IX_NPEDL_EXCTL_CMD_NPE_STEP); -+ -+ /* Watch Count register increments when NPE completes an instruction */ -+ while (wc == npe_reg_read(npe, IX_NPEDL_REG_OFFSET_WC) && -+ ++c < MAX_RETRIES); -+ -+ if (c >= MAX_RETRIES) { -+ printk(KERN_ERR "%s reset:npe_debg_inst_exec(): Timeout\n", -+ npe->plat->name); -+ return 1; -+ } -+ return 0; -+} -+ -+static int npe_logical_reg_write8(struct npe_info *npe, u32 addr, u32 val) -+{ -+ u32 instr; -+ val &= 0xff; -+ /* here we build the NPE assembler instruction: -+ * mov8 d0, #0 */ -+ instr = INSTR_WR_REG_BYTE | /* OpCode */ -+ addr << 9 | /* base Operand */ -+ (val & 0x1f) << 4 | /* lower 5 bits to immediate data */ -+ (val & ~0x1f) << (18-5);/* higher 3 bits to CoProc instr. */ -+ /* and execute it */ -+ return npe_debg_inst_exec(npe, instr, 0, 1); -+} -+ -+static int npe_logical_reg_write16(struct npe_info *npe, u32 addr, u32 val) -+{ -+ u32 instr; -+ /* here we build the NPE assembler instruction: -+ * mov16 d0, #0 */ -+ val &= 0xffff; -+ instr = INSTR_WR_REG_SHORT | /* OpCode */ -+ addr << 9 | /* base Operand */ -+ (val & 0x1f) << 4 | /* lower 5 bits to immediate data */ -+ (val & ~0x1f) << (18-5);/* higher 11 bits to CoProc instr. */ -+ /* and execute it */ -+ return npe_debg_inst_exec(npe, instr, 0, 1); -+} -+ -+static int npe_logical_reg_write32(struct npe_info *npe, u32 addr, u32 val) -+{ -+ /* write in 16 bit steps first the high and then the low value */ -+ npe_logical_reg_write16(npe, addr, val >> 16); -+ return npe_logical_reg_write16(npe, addr+2, val & 0xffff); -+} -+ -+void npe_reset(struct npe_info *npe) -+{ -+ u32 reg, cfg_ctrl; -+ int i; -+ struct { u32 reset; int addr; int size; } ctx_reg[] = { -+ { 0x80, 0x1b, 8 }, -+ { 0, 0x1c, 16 }, -+ { 0x820, 0x1e, 16 }, -+ { 0, 0x1f, 8 } -+ }, *cr; -+ -+ cfg_ctrl = npe_reg_read(npe, IX_NPEDL_REG_OFFSET_CTL); -+ cfg_ctrl |= 0x3F000000; -+ /* disable the parity interrupt */ -+ npe_reg_write(npe, IX_NPEDL_REG_OFFSET_CTL, cfg_ctrl & PARITY_BIT_MASK); -+ -+ npe_debg_preexec(npe); -+ -+ /* clear the FIFOs */ -+ while (npe_reg_read(npe, IX_NPEDL_REG_OFFSET_WFIFO) == -+ IX_NPEDL_MASK_WFIFO_VALID); -+ while (npe_reg_read(npe, IX_NPEDL_REG_OFFSET_STAT) == -+ IX_NPEDL_MASK_STAT_OFNE) -+ { -+ u32 reg; -+ reg = npe_reg_read(npe, IX_NPEDL_REG_OFFSET_FIFO); -+ printk("%s reset: Read FIFO:=%x\n", npe->plat->name, reg); -+ } -+ while (npe_reg_read(npe, IX_NPEDL_REG_OFFSET_STAT) == -+ IX_NPEDL_MASK_STAT_IFNE) { -+ npe_debg_inst_exec(npe, INSTR_RD_FIFO, 0, 0); -+ } -+ -+ /* Reset the mailbox reg */ -+ npe_reg_write(npe, IX_NPEDL_REG_OFFSET_MBST, RESET_MBST_VAL); -+ npe_debg_inst_exec(npe, INSTR_RESET_MBOX, 0, 0); -+ -+ /* Reset the physical registers in the NPE register file */ -+ for (i=0; i<NPE_PHYS_REG; i++) { -+ npe_logical_reg_write16(npe, NPE_REGMAP, i >> 1); -+ npe_logical_reg_write32(npe, (i&1) *4, 0); -+ } -+ -+ /* Reset the context store. Iterate over the 16 ctx s */ -+ for(i=0; i<16; i++) { -+ for (reg=0; reg<4; reg++) { -+ /* There is no (STEVT) register for Context 0. -+ * ignore if register=0 and ctx=0 */ -+ if (!(reg || i)) -+ continue; -+ /* Context 0 has no STARTPC. Instead, this value is -+ * used to set NextPC for Background ECS, -+ * to set where NPE starts executing code -+ */ -+ if (!i && reg==1) { -+ u32 r; -+ r = npe_read_ecs_reg(npe, ECS_BG_CTXT_REG_0); -+ r &= ~MASK_ECS_REG_0_NEXTPC; -+ r |= (cr->reset << 16) & MASK_ECS_REG_0_NEXTPC; -+ continue; -+ } -+ cr = ctx_reg + reg; -+ switch (cr->size) { -+ case 8: -+ npe_logical_reg_write8(npe, cr->addr, -+ cr->reset); -+ break; -+ case 16: -+ npe_logical_reg_write16(npe, cr->addr, -+ cr->reset); -+ } -+ } -+ } -+ npe_debg_postexec(npe); -+ -+ for (i=0; i< ARRAY_SIZE(ecs_reset); i++) { -+ npe_write_ecs_reg(npe, ecs_reset[i].reg, ecs_reset[i].val); -+ } -+ npe_write_exctl(npe, IX_NPEDL_EXCTL_CMD_CLR_PROFILE_CNT); -+ -+ for (i=IX_NPEDL_REG_OFFSET_EXCT; i<=IX_NPEDL_REG_OFFSET_AP3; i+=4) { -+ npe_reg_write(npe, i, 0); -+ } -+ -+ npe_reg_write(npe, IX_NPEDL_REG_OFFSET_WC, 0); -+ -+ reg = *IXP4XX_EXP_CFG2; -+ reg |= 0x800 << npe->plat->id; /* IX_FUSE_NPE[ABC] */ -+ *IXP4XX_EXP_CFG2 = reg; -+ reg &= ~(0x800 << npe->plat->id); /* IX_FUSE_NPE[ABC] */ -+ *IXP4XX_EXP_CFG2 = reg; -+ -+ npe_stop(npe); -+ -+ npe_reg_write(npe, IX_NPEDL_REG_OFFSET_CTL, -+ cfg_ctrl & CONFIG_CTRL_REG_MASK); -+ npe->loaded = 0; -+} -+ -+ -+void npe_stop(struct npe_info *npe) -+{ -+ npe_write_exctl(npe, IX_NPEDL_EXCTL_CMD_NPE_STOP); -+ npe_write_exctl(npe, IX_NPEDL_EXCTL_CMD_NPE_CLR_PIPE); -+} -+ -+static void npe_reset_active(struct npe_info *npe, u32 reg) -+{ -+ u32 regval; -+ -+ regval = npe_read_ecs_reg(npe, reg); -+ regval &= ~IX_NPEDL_MASK_ECS_REG_0_ACTIVE; -+ npe_write_ecs_reg(npe, reg, regval); -+} -+ -+void npe_start(struct npe_info *npe) -+{ -+ npe_reset_active(npe, IX_NPEDL_ECS_PRI_1_CTXT_REG_0); -+ npe_reset_active(npe, IX_NPEDL_ECS_PRI_2_CTXT_REG_0); -+ npe_reset_active(npe, IX_NPEDL_ECS_DBG_CTXT_REG_0); -+ -+ npe_write_exctl(npe, IX_NPEDL_EXCTL_CMD_NPE_CLR_PIPE); -+ npe_write_exctl(npe, IX_NPEDL_EXCTL_CMD_NPE_START); -+} -+ -+EXPORT_SYMBOL(npe_stop); -+EXPORT_SYMBOL(npe_start); -+EXPORT_SYMBOL(npe_reset); -Index: linux-2.6.21.7/drivers/net/ixp4xx/npe_mh.c -=================================================================== ---- /dev/null -+++ linux-2.6.21.7/drivers/net/ixp4xx/npe_mh.c -@@ -0,0 +1,170 @@ -+/* -+ * npe_mh.c - NPE message handler. -+ * -+ * Copyright (C) 2006 Christian Hohnstaedt <chohnstaedt@innominate.com> -+ * -+ * This file is released under the GPLv2 -+ */ -+ -+#include <linux/ixp_npe.h> -+#include <linux/slab.h> -+ -+#define MAX_RETRY 200 -+ -+struct npe_mh_msg { -+ union { -+ u8 byte[8]; /* Very desciptive name, I know ... */ -+ u32 data[2]; -+ } u; -+}; -+ -+/* -+ * The whole code in this function must be reworked. -+ * It is in a state that works but is not rock solid -+ */ -+static int send_message(struct npe_info *npe, struct npe_mh_msg *msg) -+{ -+ int i,j; -+ u32 send[2], recv[2]; -+ -+ for (i=0; i<2; i++) -+ send[i] = be32_to_cpu(msg->u.data[i]); -+ -+ if ((npe_reg_read(npe, IX_NPEDL_REG_OFFSET_STAT) & -+ IX_NPEMH_NPE_STAT_IFNE)) -+ return -1; -+ -+ npe_reg_write(npe, IX_NPEDL_REG_OFFSET_FIFO, send[0]); -+ for(i=0; i<MAX_RETRY; i++) { -+ /* if the IFNF status bit is unset then the inFIFO is full */ -+ if (npe_reg_read(npe, IX_NPEDL_REG_OFFSET_STAT) & -+ IX_NPEMH_NPE_STAT_IFNF) -+ break; -+ } -+ if (i>=MAX_RETRY) -+ return -1; -+ npe_reg_write(npe, IX_NPEDL_REG_OFFSET_FIFO, send[1]); -+ i=0; -+ while (!(npe_reg_read(npe, IX_NPEDL_REG_OFFSET_STAT) & -+ IX_NPEMH_NPE_STAT_OFNE)) { -+ if (i++>MAX_RETRY) { -+ printk("Waiting for Output FIFO NotEmpty failed\n"); -+ return -1; -+ } -+ } -+ //printk("Output FIFO Not Empty. Loops: %d\n", i); -+ j=0; -+ while (npe_reg_read(npe, IX_NPEDL_REG_OFFSET_STAT) & -+ IX_NPEMH_NPE_STAT_OFNE) { -+ recv[j&1] = npe_reg_read(npe,IX_NPEDL_REG_OFFSET_FIFO); -+ j++; -+ } -+ if ((recv[0] != send[0]) || (recv[1] != send[1])) { -+ if (send[0] || send[1]) { -+ /* all CMDs return the complete message as answer, -+ * only GETSTATUS returns the ImageID of the NPE -+ */ -+ printk("Unexpected answer: " -+ "Send %08x:%08x Ret %08x:%08x\n", -+ send[0], send[1], recv[0], recv[1]); -+ } -+ } -+ return 0; -+} -+ -+#define CMD 0 -+#define PORT 1 -+#define MAC 2 -+ -+#define IX_ETHNPE_NPE_GETSTATUS 0x00 -+#define IX_ETHNPE_EDB_SETPORTADDRESS 0x01 -+#define IX_ETHNPE_GETSTATS 0x04 -+#define IX_ETHNPE_RESETSTATS 0x05 -+#define IX_ETHNPE_FW_SETFIREWALLMODE 0x0E -+#define IX_ETHNPE_VLAN_SETRXQOSENTRY 0x0B -+#define IX_ETHNPE_SETLOOPBACK_MODE 0x12 -+ -+#define logical_id(mp) (((mp)->npe_id << 4) | ((mp)->port_id & 0xf)) -+ -+int npe_mh_status(struct npe_info *npe) -+{ -+ struct npe_mh_msg msg; -+ -+ memset(&msg, 0, sizeof(msg)); -+ msg.u.byte[CMD] = IX_ETHNPE_NPE_GETSTATUS; -+ return send_message(npe, &msg); -+} -+ -+int npe_mh_setportaddr(struct npe_info *npe, struct mac_plat_info *mp, -+ u8 *macaddr) -+{ -+ struct npe_mh_msg msg; -+ -+ msg.u.byte[CMD] = IX_ETHNPE_EDB_SETPORTADDRESS; -+ msg.u.byte[PORT] = mp->eth_id; -+ memcpy(msg.u.byte + MAC, macaddr, 6); -+ -+ return send_message(npe, &msg); -+} -+ -+int npe_mh_disable_firewall(struct npe_info *npe, struct mac_plat_info *mp) -+{ -+ struct npe_mh_msg msg; -+ -+ memset(&msg, 0, sizeof(msg)); -+ msg.u.byte[CMD] = IX_ETHNPE_FW_SETFIREWALLMODE; -+ msg.u.byte[PORT] = logical_id(mp); -+ -+ return send_message(npe, &msg); -+} -+ -+int npe_mh_npe_loopback_mode(struct npe_info *npe, struct mac_plat_info *mp, -+ int enable) -+{ -+ struct npe_mh_msg msg; -+ -+ memset(&msg, 0, sizeof(msg)); -+ msg.u.byte[CMD] = IX_ETHNPE_SETLOOPBACK_MODE; -+ msg.u.byte[PORT] = logical_id(mp); -+ msg.u.byte[3] = enable ? 1 : 0; -+ -+ return send_message(npe, &msg); -+} -+ -+int npe_mh_set_rxqid(struct npe_info *npe, struct mac_plat_info *mp, int qid) -+{ -+ struct npe_mh_msg msg; -+ int i, ret; -+ -+ memset(&msg, 0, sizeof(msg)); -+ msg.u.byte[CMD] = IX_ETHNPE_VLAN_SETRXQOSENTRY; -+ msg.u.byte[PORT] = logical_id(mp); -+ msg.u.byte[5] = qid | 0x80; -+ msg.u.byte[7] = qid<<4; -+ for(i=0; i<8; i++) { -+ msg.u.byte[3] = i; -+ if ((ret = send_message(npe, &msg))) -+ return ret; -+ } -+ return 0; -+} -+ -+int npe_mh_get_stats(struct npe_info *npe, struct mac_plat_info *mp, u32 phys, -+ int reset) -+{ -+ struct npe_mh_msg msg; -+ memset(&msg, 0, sizeof(msg)); -+ msg.u.byte[CMD] = reset ? IX_ETHNPE_RESETSTATS : IX_ETHNPE_GETSTATS; -+ msg.u.byte[PORT] = logical_id(mp); -+ msg.u.data[1] = cpu_to_npe32(cpu_to_be32(phys)); -+ -+ return send_message(npe, &msg); -+} -+ -+ -+EXPORT_SYMBOL(npe_mh_status); -+EXPORT_SYMBOL(npe_mh_setportaddr); -+EXPORT_SYMBOL(npe_mh_disable_firewall); -+EXPORT_SYMBOL(npe_mh_set_rxqid); -+EXPORT_SYMBOL(npe_mh_npe_loopback_mode); -+EXPORT_SYMBOL(npe_mh_get_stats); -Index: linux-2.6.21.7/drivers/net/ixp4xx/phy.c -=================================================================== ---- /dev/null -+++ linux-2.6.21.7/drivers/net/ixp4xx/phy.c -@@ -0,0 +1,113 @@ -+/* -+ * phy.c - MDIO functions and mii initialisation -+ * -+ * Copyright (C) 2006 Christian Hohnstaedt <chohnstaedt@innominate.com> -+ * -+ * This file is released under the GPLv2 -+ */ -+ -+ -+#include <linux/mutex.h> -+#include "mac.h" -+ -+#define MAX_PHYS (1<<5) -+ -+/* -+ * We must always use the same MAC for acessing the MDIO -+ * We may not use each MAC for its PHY :-( -+ */ -+ -+static struct net_device *phy_dev = NULL; -+static struct mutex mtx; -+ -+/* here we remember if the PHY is alive, to avoid log dumping */ -+static int phy_works[MAX_PHYS]; -+ -+int mdio_read_register(struct net_device *dev, int phy_addr, int phy_reg) -+{ -+ struct mac_info *mac; -+ u32 cmd, reg; -+ int cnt = 0; -+ -+ if (!phy_dev) -+ return 0; -+ -+ mac = netdev_priv(phy_dev); -+ cmd = mdio_cmd(phy_addr, phy_reg); -+ mutex_lock_interruptible(&mtx); -+ mac_mdio_cmd_write(mac, cmd); -+ while((cmd = mac_mdio_cmd_read(mac)) & MII_GO) { -+ if (++cnt >= 100) { -+ printk("%s: PHY[%d] access failed\n", -+ dev->name, phy_addr); -+ break; -+ } -+ schedule(); -+ } -+ reg = mac_mdio_status_read(mac); -+ mutex_unlock(&mtx); -+ if (reg & MII_READ_FAIL) { -+ if (phy_works[phy_addr]) { -+ printk("%s: PHY[%d] unresponsive\n", -+ dev->name, phy_addr); -+ } -+ reg = 0; -+ phy_works[phy_addr] = 0; -+ } else { -+ if ( !phy_works[phy_addr]) { -+ printk("%s: PHY[%d] responsive again\n", -+ dev->name, phy_addr); -+ } -+ phy_works[phy_addr] = 1; -+ } -+ return reg & 0xffff; -+} -+ -+void -+mdio_write_register(struct net_device *dev, int phy_addr, int phy_reg, int val) -+{ -+ struct mac_info *mac; -+ u32 cmd; -+ int cnt=0; -+ -+ if (!phy_dev) -+ return; -+ -+ mac = netdev_priv(phy_dev); -+ cmd = mdio_cmd(phy_addr, phy_reg) | MII_WRITE | val; -+ -+ mutex_lock_interruptible(&mtx); -+ mac_mdio_cmd_write(mac, cmd); -+ while((cmd = mac_mdio_cmd_read(mac)) & MII_GO) { -+ if (++cnt >= 100) { -+ printk("%s: PHY[%d] access failed\n", -+ dev->name, phy_addr); -+ break; -+ } -+ schedule(); -+ } -+ mutex_unlock(&mtx); -+} -+ -+void init_mdio(struct net_device *dev, int phy_id) -+{ -+ struct mac_info *mac = netdev_priv(dev); -+ int i; -+ -+ /* All phy operations should use the same MAC -+ * (my experience) -+ */ -+ if (mac->plat->eth_id == 0) { -+ mutex_init(&mtx); -+ phy_dev = dev; -+ for (i=0; i<MAX_PHYS; i++) -+ phy_works[i] = 1; -+ } -+ mac->mii.dev = dev; -+ mac->mii.phy_id = phy_id; -+ mac->mii.phy_id_mask = MAX_PHYS - 1; -+ mac->mii.reg_num_mask = 0x1f; -+ mac->mii.mdio_read = mdio_read_register; -+ mac->mii.mdio_write = mdio_write_register; -+} -+ -Index: linux-2.6.21.7/drivers/net/ixp4xx/ucode_dl.c -=================================================================== ---- /dev/null -+++ linux-2.6.21.7/drivers/net/ixp4xx/ucode_dl.c -@@ -0,0 +1,479 @@ -+/* -+ * ucode_dl.c - provide an NPE device and a char-dev for microcode download -+ * -+ * Copyright (C) 2006 Christian Hohnstaedt <chohnstaedt@innominate.com> -+ * -+ * This file is released under the GPLv2 -+ */ -+ -+#include <linux/kernel.h> -+#include <linux/module.h> -+#include <linux/miscdevice.h> -+#include <linux/platform_device.h> -+#include <linux/fs.h> -+#include <linux/init.h> -+#include <linux/slab.h> -+#include <linux/firmware.h> -+#include <linux/dma-mapping.h> -+#include <linux/byteorder/swab.h> -+#include <asm/uaccess.h> -+#include <asm/io.h> -+ -+#include <linux/ixp_npe.h> -+ -+#define IXNPE_VERSION "IXP4XX NPE driver Version 0.3.0" -+ -+#define DL_MAGIC 0xfeedf00d -+#define DL_MAGIC_SWAP 0x0df0edfe -+ -+#define EOF_BLOCK 0xf -+#define IMG_SIZE(image) (((image)->size * sizeof(u32)) + \ -+ sizeof(struct dl_image)) -+ -+#define BT_INSTR 0 -+#define BT_DATA 1 -+ -+enum blk_type { -+ instruction, -+ data, -+}; -+ -+struct dl_block { -+ u32 type; -+ u32 offset; -+}; -+ -+struct dl_image { -+ u32 magic; -+ u32 id; -+ u32 size; -+ union { -+ u32 data[0]; -+ struct dl_block block[0]; -+ } u; -+}; -+ -+struct dl_codeblock { -+ u32 npe_addr; -+ u32 size; -+ u32 data[0]; -+}; -+ -+static struct platform_driver ixp4xx_npe_driver; -+ -+static int match_by_npeid(struct device *dev, void *id) -+{ -+ struct npe_info *npe = dev_get_drvdata(dev); -+ if (!npe->plat) -+ return 0; -+ return (npe->plat->id == *(int*)id); -+} -+ -+struct device *get_npe_by_id(int id) -+{ -+ struct device *dev = driver_find_device(&ixp4xx_npe_driver.driver, -+ NULL, &id, match_by_npeid); -+ if (dev) { -+ struct npe_info *npe = dev_get_drvdata(dev); -+ if (!try_module_get(THIS_MODULE)) { -+ put_device(dev); -+ return NULL; -+ } -+ npe->usage++; -+ } -+ return dev; -+} -+ -+void return_npe_dev(struct device *dev) -+{ -+ struct npe_info *npe = dev_get_drvdata(dev); -+ put_device(dev); -+ module_put(THIS_MODULE); -+ npe->usage--; -+} -+ -+static int -+download_block(struct npe_info *npe, struct dl_codeblock *cb, unsigned type) -+{ -+ int i; -+ int cmd; -+ -+ switch (type) { -+ case BT_DATA: -+ cmd = IX_NPEDL_EXCTL_CMD_WR_DATA_MEM; -+ if (cb->npe_addr + cb->size > npe->plat->data_size) { -+ printk(KERN_INFO "Data size too large: %d+%d > %d\n", -+ cb->npe_addr, cb->size, npe->plat->data_size); -+ return -EIO; -+ } -+ break; -+ case BT_INSTR: -+ cmd = IX_NPEDL_EXCTL_CMD_WR_INS_MEM; -+ if (cb->npe_addr + cb->size > npe->plat->inst_size) { -+ printk(KERN_INFO "Instr size too large: %d+%d > %d\n", -+ cb->npe_addr, cb->size, npe->plat->inst_size); -+ return -EIO; -+ } -+ break; -+ default: -+ printk(KERN_INFO "Unknown CMD: %d\n", type); -+ return -EIO; -+ } -+ -+ for (i=0; i < cb->size; i++) { -+ npe_write_cmd(npe, cb->npe_addr + i, cb->data[i], cmd); -+ } -+ -+ return 0; -+} -+ -+static int store_npe_image(struct dl_image *image, struct device *dev) -+{ -+ struct dl_block *blk; -+ struct dl_codeblock *cb; -+ struct npe_info *npe; -+ int ret=0; -+ -+ if (!dev) { -+ dev = get_npe_by_id( (image->id >> 24) & 0xf); -+ return_npe_dev(dev); -+ } -+ if (!dev) -+ return -ENODEV; -+ -+ npe = dev_get_drvdata(dev); -+ if (npe->loaded && (npe->usage > 0)) { -+ printk(KERN_INFO "Cowardly refusing to reload an Image " -+ "into the used and running %s\n", npe->plat->name); -+ return 0; /* indicate success anyway... */ -+ } -+ if (!cpu_is_ixp46x() && ((image->id >> 28) & 0xf)) { -+ printk(KERN_INFO "IXP46x NPE image ignored on IXP42x\n"); -+ return -EIO; -+ } -+ -+ npe_stop(npe); -+ npe_reset(npe); -+ -+ for (blk = image->u.block; blk->type != EOF_BLOCK; blk++) { -+ if (blk->offset > image->size) { -+ printk(KERN_INFO "Block offset out of range\n"); -+ return -EIO; -+ } -+ cb = (struct dl_codeblock*)&image->u.data[blk->offset]; -+ if (blk->offset + cb->size + 2 > image->size) { -+ printk(KERN_INFO "Codeblock size out of range\n"); -+ return -EIO; -+ } -+ if ((ret = download_block(npe, cb, blk->type))) -+ return ret; -+ } -+ *(u32*)npe->img_info = cpu_to_be32(image->id); -+ npe_start(npe); -+ -+ printk(KERN_INFO "Image loaded to %s Func:%x, Rel: %x:%x, Status: %x\n", -+ npe->plat->name, npe->img_info[1], npe->img_info[2], -+ npe->img_info[3], npe_status(npe)); -+ if (npe_mh_status(npe)) { -+ printk(KERN_ERR "%s not responding\n", npe->plat->name); -+ } -+ npe->loaded = 1; -+ return 0; -+} -+ -+static int ucode_open(struct inode *inode, struct file *file) -+{ -+ file->private_data = kmalloc(sizeof(struct dl_image), GFP_KERNEL); -+ if (!file->private_data) -+ return -ENOMEM; -+ return 0; -+} -+ -+static int ucode_close(struct inode *inode, struct file *file) -+{ -+ kfree(file->private_data); -+ return 0; -+} -+ -+static ssize_t ucode_write(struct file *file, const char __user *buf, -+ size_t count, loff_t *ppos) -+{ -+ union { -+ char *data; -+ struct dl_image *image; -+ } u; -+ const char __user *cbuf = buf; -+ -+ u.data = file->private_data; -+ -+ while (count) { -+ int len; -+ if (*ppos < sizeof(struct dl_image)) { -+ len = sizeof(struct dl_image) - *ppos; -+ len = len > count ? count : len; -+ if (copy_from_user(u.data + *ppos, cbuf, len)) -+ return -EFAULT; -+ count -= len; -+ *ppos += len; -+ cbuf += len; -+ continue; -+ } else if (*ppos == sizeof(struct dl_image)) { -+ void *data; -+ if (u.image->magic == DL_MAGIC_SWAP) { -+ printk(KERN_INFO "swapped image found\n"); -+ u.image->id = swab32(u.image->id); -+ u.image->size = swab32(u.image->size); -+ } else if (u.image->magic != DL_MAGIC) { -+ printk(KERN_INFO "Bad magic:%x\n", -+ u.image->magic); -+ return -EFAULT; -+ } -+ len = IMG_SIZE(u.image); -+ data = kmalloc(len, GFP_KERNEL); -+ if (!data) -+ return -ENOMEM; -+ memcpy(data, u.data, *ppos); -+ kfree(u.data); -+ u.data = (char*)data; -+ file->private_data = data; -+ } -+ len = IMG_SIZE(u.image) - *ppos; -+ len = len > count ? count : len; -+ if (copy_from_user(u.data + *ppos, cbuf, len)) -+ return -EFAULT; -+ count -= len; -+ *ppos += len; -+ cbuf += len; -+ if (*ppos == IMG_SIZE(u.image)) { -+ int ret, i; -+ *ppos = 0; -+ if (u.image->magic == DL_MAGIC_SWAP) { -+ for (i=0; i<u.image->size; i++) { -+ u.image->u.data[i] = -+ swab32(u.image->u.data[i]); -+ } -+ u.image->magic = swab32(u.image->magic); -+ } -+ ret = store_npe_image(u.image, NULL); -+ if (ret) { -+ printk(KERN_INFO "Error in NPE image: %x\n", -+ u.image->id); -+ return ret; -+ } -+ } -+ } -+ return (cbuf-buf); -+} -+ -+static void npe_firmware_probe(struct device *dev) -+{ -+#if (defined(CONFIG_FW_LOADER) || defined(CONFIG_FW_LOADER_MODULE)) \ -+ && defined(MODULE) -+ const struct firmware *fw_entry; -+ struct npe_info *npe = dev_get_drvdata(dev); -+ struct dl_image *image; -+ int ret = -1, i; -+ -+ if (request_firmware(&fw_entry, npe->plat->name, dev) != 0) { -+ return; -+ } -+ image = (struct dl_image*)fw_entry->data; -+ /* Sanity checks */ -+ if (fw_entry->size < sizeof(struct dl_image)) { -+ printk(KERN_ERR "Firmware error: too small\n"); -+ goto out; -+ } -+ if (image->magic == DL_MAGIC_SWAP) { -+ printk(KERN_INFO "swapped image found\n"); -+ image->id = swab32(image->id); -+ image->size = swab32(image->size); -+ } else if (image->magic != DL_MAGIC) { -+ printk(KERN_ERR "Bad magic:%x\n", image->magic); -+ goto out; -+ } -+ if (IMG_SIZE(image) != fw_entry->size) { -+ printk(KERN_ERR "Firmware error: bad size\n"); -+ goto out; -+ } -+ if (((image->id >> 24) & 0xf) != npe->plat->id) { -+ printk(KERN_ERR "NPE id missmatch\n"); -+ goto out; -+ } -+ if (image->magic == DL_MAGIC_SWAP) { -+ for (i=0; i<image->size; i++) { -+ image->u.data[i] = swab32(image->u.data[i]); -+ } -+ image->magic = swab32(image->magic); -+ } -+ -+ ret = store_npe_image(image, dev); -+out: -+ if (ret) { -+ printk(KERN_ERR "Error downloading Firmware for %s\n", -+ npe->plat->name); -+ } -+ release_firmware(fw_entry); -+#endif -+} -+ -+static void disable_npe_irq(struct npe_info *npe) -+{ -+ u32 reg; -+ reg = npe_reg_read(npe, IX_NPEDL_REG_OFFSET_CTL); -+ reg &= ~(IX_NPEMH_NPE_CTL_OFE | IX_NPEMH_NPE_CTL_IFE); -+ reg |= IX_NPEMH_NPE_CTL_OFEWE | IX_NPEMH_NPE_CTL_IFEWE; -+ npe_reg_write(npe, IX_NPEDL_REG_OFFSET_CTL, reg); -+} -+ -+static ssize_t show_npe_state(struct device *dev, struct device_attribute *attr, -+ char *buf) -+{ -+ struct npe_info *npe = dev_get_drvdata(dev); -+ -+ strcpy(buf, npe_status(npe) & IX_NPEDL_EXCTL_STATUS_RUN ? -+ "start\n" : "stop\n"); -+ return strlen(buf); -+} -+ -+static ssize_t set_npe_state(struct device *dev, struct device_attribute *attr, -+ const char *buf, size_t count) -+{ -+ struct npe_info *npe = dev_get_drvdata(dev); -+ -+ if (npe->usage) { -+ printk("%s in use: read-only\n", npe->plat->name); -+ return count; -+ } -+ if (!strncmp(buf, "start", 5)) { -+ npe_start(npe); -+ } -+ if (!strncmp(buf, "stop", 4)) { -+ npe_stop(npe); -+ } -+ if (!strncmp(buf, "reset", 5)) { -+ npe_stop(npe); -+ npe_reset(npe); -+ } -+ return count; -+} -+ -+static DEVICE_ATTR(state, S_IRUGO | S_IWUSR, show_npe_state, set_npe_state); -+ -+static int npe_probe(struct platform_device *pdev) -+{ -+ struct resource *res; -+ struct npe_info *npe; -+ struct npe_plat_data *plat = pdev->dev.platform_data; -+ int err, size, ret=0; -+ -+ if (!(res = platform_get_resource(pdev, IORESOURCE_MEM, 0))) -+ return -EIO; -+ -+ if (!(npe = kzalloc(sizeof(struct npe_info), GFP_KERNEL))) -+ return -ENOMEM; -+ -+ size = res->end - res->start +1; -+ npe->res = request_mem_region(res->start, size, plat->name); -+ if (!npe->res) { -+ ret = -EBUSY; -+ printk(KERN_ERR "Failed to get memregion(%x, %x)\n", -+ res->start, size); -+ goto out_free; -+ } -+ -+ npe->addr = ioremap(res->start, size); -+ if (!npe->addr) { -+ ret = -ENOMEM; -+ printk(KERN_ERR "Failed to ioremap(%x, %x)\n", -+ res->start, size); -+ goto out_rel; -+ } -+ -+ pdev->dev.coherent_dma_mask = DMA_32BIT_MASK; -+ -+ platform_set_drvdata(pdev, npe); -+ -+ err = device_create_file(&pdev->dev, &dev_attr_state); -+ if (err) -+ goto out_rel; -+ -+ npe->plat = plat; -+ disable_npe_irq(npe); -+ npe->usage = 0; -+ npe_reset(npe); -+ npe_firmware_probe(&pdev->dev); -+ -+ return 0; -+ -+out_rel: -+ release_resource(npe->res); -+out_free: -+ kfree(npe); -+ return ret; -+} -+ -+static struct file_operations ucode_dl_fops = { -+ .owner = THIS_MODULE, -+ .write = ucode_write, -+ .open = ucode_open, -+ .release = ucode_close, -+}; -+ -+static struct miscdevice ucode_dl_dev = { -+ .minor = MICROCODE_MINOR, -+ .name = "ixp4xx_ucode", -+ .fops = &ucode_dl_fops, -+}; -+ -+static int npe_remove(struct platform_device *pdev) -+{ -+ struct npe_info *npe = platform_get_drvdata(pdev); -+ -+ device_remove_file(&pdev->dev, &dev_attr_state); -+ -+ iounmap(npe->addr); -+ release_resource(npe->res); -+ kfree(npe); -+ return 0; -+} -+ -+static struct platform_driver ixp4xx_npe_driver = { -+ .driver = { -+ .name = "ixp4xx_npe", -+ .owner = THIS_MODULE, -+ }, -+ .probe = npe_probe, -+ .remove = npe_remove, -+}; -+ -+static int __init init_npedriver(void) -+{ -+ int ret; -+ if ((ret = misc_register(&ucode_dl_dev))){ -+ printk(KERN_ERR "Failed to register misc device %d\n", -+ MICROCODE_MINOR); -+ return ret; -+ } -+ if ((ret = platform_driver_register(&ixp4xx_npe_driver))) -+ misc_deregister(&ucode_dl_dev); -+ else -+ printk(KERN_INFO IXNPE_VERSION " initialized\n"); -+ -+ return ret; -+ -+} -+ -+static void __exit finish_npedriver(void) -+{ -+ misc_deregister(&ucode_dl_dev); -+ platform_driver_unregister(&ixp4xx_npe_driver); -+} -+ -+module_init(init_npedriver); -+module_exit(finish_npedriver); -+ -+MODULE_LICENSE("GPL"); -+MODULE_AUTHOR("Christian Hohnstaedt <chohnstaedt@innominate.com>"); -+ -+EXPORT_SYMBOL(get_npe_by_id); -+EXPORT_SYMBOL(return_npe_dev); -Index: linux-2.6.21.7/include/asm-arm/arch-ixp4xx/ixp4xx-regs.h -=================================================================== ---- linux-2.6.21.7.orig/include/asm-arm/arch-ixp4xx/ixp4xx-regs.h -+++ linux-2.6.21.7/include/asm-arm/arch-ixp4xx/ixp4xx-regs.h -@@ -22,6 +22,8 @@ - #ifndef _ASM_ARM_IXP4XX_H_ - #define _ASM_ARM_IXP4XX_H_ - -+#include "npe_regs.h" -+ - /* - * IXP4xx Linux Memory Map: - * -@@ -44,6 +46,12 @@ - */ - - /* -+ * PCI Memory Space -+ */ -+#define IXP4XX_PCIMEM_BASE_PHYS (0x48000000) -+#define IXP4XX_PCIMEM_REGION_SIZE (0x04000000) -+#define IXP4XX_PCIMEM_BAR_SIZE (0x01000000) -+/* - * Queue Manager - */ - #define IXP4XX_QMGR_BASE_PHYS (0x60000000) -@@ -322,7 +330,13 @@ - #define PCI_ATPDMA0_LENADDR_OFFSET 0x48 - #define PCI_ATPDMA1_AHBADDR_OFFSET 0x4C - #define PCI_ATPDMA1_PCIADDR_OFFSET 0x50 --#define PCI_ATPDMA1_LENADDR_OFFSET 0x54 -+#define PCI_ATPDMA1_LENADDR_OFFSET 0x54 -+#define PCI_PTADMA0_AHBADDR_OFFSET 0x58 -+#define PCI_PTADMA0_PCIADDR_OFFSET 0x5c -+#define PCI_PTADMA0_LENADDR_OFFSET 0x60 -+#define PCI_PTADMA1_AHBADDR_OFFSET 0x64 -+#define PCI_PTADMA1_PCIADDR_OFFSET 0x68 -+#define PCI_PTADMA1_LENADDR_OFFSET 0x6c - - /* - * PCI Control/Status Registers -@@ -351,6 +365,12 @@ - #define PCI_ATPDMA1_AHBADDR IXP4XX_PCI_CSR(PCI_ATPDMA1_AHBADDR_OFFSET) - #define PCI_ATPDMA1_PCIADDR IXP4XX_PCI_CSR(PCI_ATPDMA1_PCIADDR_OFFSET) - #define PCI_ATPDMA1_LENADDR IXP4XX_PCI_CSR(PCI_ATPDMA1_LENADDR_OFFSET) -+#define PCI_PTADMA0_AHBADDR IXP4XX_PCI_CSR(PCI_PTADMA0_AHBADDR_OFFSET) -+#define PCI_PTADMA0_PCIADDR IXP4XX_PCI_CSR(PCI_PTADMA0_PCIADDR_OFFSET) -+#define PCI_PTADMA0_LENADDR IXP4XX_PCI_CSR(PCI_PTADMA0_LENADDR_OFFSET) -+#define PCI_PTADMA1_AHBADDR IXP4XX_PCI_CSR(PCI_PTADMA1_AHBADDR_OFFSET) -+#define PCI_PTADMA1_PCIADDR IXP4XX_PCI_CSR(PCI_PTADMA1_PCIADDR_OFFSET) -+#define PCI_PTADMA1_LENADDR IXP4XX_PCI_CSR(PCI_PTADMA1_LENADDR_OFFSET) - - /* - * PCI register values and bit definitions -@@ -607,6 +627,34 @@ - - #define DCMD_LENGTH 0x01fff /* length mask (max = 8K - 1) */ - -+ -+/* Fuse Bits of IXP_EXP_CFG2 */ -+#define IX_FUSE_RCOMP (1 << 0) -+#define IX_FUSE_USB (1 << 1) -+#define IX_FUSE_HASH (1 << 2) -+#define IX_FUSE_AES (1 << 3) -+#define IX_FUSE_DES (1 << 4) -+#define IX_FUSE_HDLC (1 << 5) -+#define IX_FUSE_AAL (1 << 6) -+#define IX_FUSE_HSS (1 << 7) -+#define IX_FUSE_UTOPIA (1 << 8) -+#define IX_FUSE_ETH0 (1 << 9) -+#define IX_FUSE_ETH1 (1 << 10) -+#define IX_FUSE_NPEA (1 << 11) -+#define IX_FUSE_NPEB (1 << 12) -+#define IX_FUSE_NPEC (1 << 13) -+#define IX_FUSE_PCI (1 << 14) -+#define IX_FUSE_ECC (1 << 15) -+#define IX_FUSE_UTOPIA_PHY_LIMIT (3 << 16) -+#define IX_FUSE_USB_HOST (1 << 18) -+#define IX_FUSE_NPEA_ETH (1 << 19) -+#define IX_FUSE_NPEB_ETH (1 << 20) -+#define IX_FUSE_RSA (1 << 21) -+#define IX_FUSE_XSCALE_MAX_FREQ (3 << 22) -+ -+#define IX_FUSE_IXP46X_ONLY IX_FUSE_XSCALE_MAX_FREQ | IX_FUSE_RSA | \ -+ IX_FUSE_NPEB_ETH | IX_FUSE_NPEA_ETH | IX_FUSE_USB_HOST | IX_FUSE_ECC -+ - #ifndef __ASSEMBLY__ - static inline int cpu_is_ixp46x(void) - { -@@ -620,6 +668,15 @@ static inline int cpu_is_ixp46x(void) - #endif - return 0; - } -+ -+static inline u32 ix_fuse(void) -+{ -+ unsigned int fuses = ~(*IXP4XX_EXP_CFG2); -+ if (!cpu_is_ixp46x()) -+ fuses &= ~IX_FUSE_IXP46X_ONLY; -+ -+ return fuses; -+} - #endif - - #endif -Index: linux-2.6.21.7/include/asm-arm/arch-ixp4xx/npe_regs.h -=================================================================== ---- /dev/null -+++ linux-2.6.21.7/include/asm-arm/arch-ixp4xx/npe_regs.h -@@ -0,0 +1,82 @@ -+#ifndef NPE_REGS_H -+#define NPE_REGS_H -+ -+/* Execution Address */ -+#define IX_NPEDL_REG_OFFSET_EXAD 0x00 -+/* Execution Data */ -+#define IX_NPEDL_REG_OFFSET_EXDATA 0x04 -+/* Execution Control */ -+#define IX_NPEDL_REG_OFFSET_EXCTL 0x08 -+/* Execution Count */ -+#define IX_NPEDL_REG_OFFSET_EXCT 0x0C -+/* Action Point 0 */ -+#define IX_NPEDL_REG_OFFSET_AP0 0x10 -+/* Action Point 1 */ -+#define IX_NPEDL_REG_OFFSET_AP1 0x14 -+/* Action Point 2 */ -+#define IX_NPEDL_REG_OFFSET_AP2 0x18 -+/* Action Point 3 */ -+#define IX_NPEDL_REG_OFFSET_AP3 0x1C -+/* Watchpoint FIFO */ -+#define IX_NPEDL_REG_OFFSET_WFIFO 0x20 -+/* Watch Count */ -+#define IX_NPEDL_REG_OFFSET_WC 0x24 -+/* Profile Count */ -+#define IX_NPEDL_REG_OFFSET_PROFCT 0x28 -+ -+/* Messaging Status */ -+#define IX_NPEDL_REG_OFFSET_STAT 0x2C -+/* Messaging Control */ -+#define IX_NPEDL_REG_OFFSET_CTL 0x30 -+/* Mailbox Status */ -+#define IX_NPEDL_REG_OFFSET_MBST 0x34 -+/* messaging in/out FIFO */ -+#define IX_NPEDL_REG_OFFSET_FIFO 0x38 -+ -+ -+#define IX_NPEDL_MASK_ECS_DBG_REG_2_IF 0x00100000 -+#define IX_NPEDL_MASK_ECS_DBG_REG_2_IE 0x00080000 -+#define IX_NPEDL_MASK_ECS_REG_0_ACTIVE 0x80000000 -+ -+#define IX_NPEDL_EXCTL_CMD_NPE_STEP 0x01 -+#define IX_NPEDL_EXCTL_CMD_NPE_START 0x02 -+#define IX_NPEDL_EXCTL_CMD_NPE_STOP 0x03 -+#define IX_NPEDL_EXCTL_CMD_NPE_CLR_PIPE 0x04 -+#define IX_NPEDL_EXCTL_CMD_CLR_PROFILE_CNT 0x0C -+#define IX_NPEDL_EXCTL_CMD_RD_INS_MEM 0x10 -+#define IX_NPEDL_EXCTL_CMD_WR_INS_MEM 0x11 -+#define IX_NPEDL_EXCTL_CMD_RD_DATA_MEM 0x12 -+#define IX_NPEDL_EXCTL_CMD_WR_DATA_MEM 0x13 -+#define IX_NPEDL_EXCTL_CMD_RD_ECS_REG 0x14 -+#define IX_NPEDL_EXCTL_CMD_WR_ECS_REG 0x15 -+ -+#define IX_NPEDL_EXCTL_STATUS_RUN 0x80000000 -+#define IX_NPEDL_EXCTL_STATUS_STOP 0x40000000 -+#define IX_NPEDL_EXCTL_STATUS_CLEAR 0x20000000 -+ -+#define IX_NPEDL_MASK_WFIFO_VALID 0x80000000 -+#define IX_NPEDL_MASK_STAT_OFNE 0x00010000 -+#define IX_NPEDL_MASK_STAT_IFNE 0x00080000 -+ -+#define IX_NPEDL_ECS_DBG_CTXT_REG_0 0x0C -+#define IX_NPEDL_ECS_PRI_1_CTXT_REG_0 0x04 -+#define IX_NPEDL_ECS_PRI_2_CTXT_REG_0 0x08 -+ -+/* NPE control register bit definitions */ -+#define IX_NPEMH_NPE_CTL_OFE (1 << 16) /**< OutFifoEnable */ -+#define IX_NPEMH_NPE_CTL_IFE (1 << 17) /**< InFifoEnable */ -+#define IX_NPEMH_NPE_CTL_OFEWE (1 << 24) /**< OutFifoEnableWriteEnable */ -+#define IX_NPEMH_NPE_CTL_IFEWE (1 << 25) /**< InFifoEnableWriteEnable */ -+ -+/* NPE status register bit definitions */ -+#define IX_NPEMH_NPE_STAT_OFNE (1 << 16) /**< OutFifoNotEmpty */ -+#define IX_NPEMH_NPE_STAT_IFNF (1 << 17) /**< InFifoNotFull */ -+#define IX_NPEMH_NPE_STAT_OFNF (1 << 18) /**< OutFifoNotFull */ -+#define IX_NPEMH_NPE_STAT_IFNE (1 << 19) /**< InFifoNotEmpty */ -+#define IX_NPEMH_NPE_STAT_MBINT (1 << 20) /**< Mailbox interrupt */ -+#define IX_NPEMH_NPE_STAT_IFINT (1 << 21) /**< InFifo interrupt */ -+#define IX_NPEMH_NPE_STAT_OFINT (1 << 22) /**< OutFifo interrupt */ -+#define IX_NPEMH_NPE_STAT_WFINT (1 << 23) /**< WatchFifo interrupt */ -+ -+#endif -+ -Index: linux-2.6.21.7/include/asm-arm/arch-ixp4xx/platform.h -=================================================================== ---- linux-2.6.21.7.orig/include/asm-arm/arch-ixp4xx/platform.h -+++ linux-2.6.21.7/include/asm-arm/arch-ixp4xx/platform.h -@@ -86,6 +86,25 @@ struct ixp4xx_i2c_pins { - unsigned long scl_pin; - }; - -+struct npe_plat_data { -+ const char *name; -+ int data_size; -+ int inst_size; -+ int id; /* Node ID */ -+}; -+ -+struct mac_plat_info { -+ int npe_id; /* Node ID of the NPE for this port */ -+ int port_id; /* Port ID for NPE-B @ ixp465 */ -+ int eth_id; /* Physical ID */ -+ int phy_id; /* ID of the connected PHY (PCB/platform dependent) */ -+ int rxq_id; /* Queue ID of the RX-free q */ -+ int rxdoneq_id; /* where incoming packets are returned */ -+ int txq_id; /* Where to push the outgoing packets */ -+ unsigned char hwaddr[6]; /* Desired hardware address */ -+ -+}; -+ - /* - * This structure provide a means for the board setup code - * to give information to th pata_ixp4xx driver. It is -Index: linux-2.6.21.7/include/linux/ixp_crypto.h -=================================================================== ---- /dev/null -+++ linux-2.6.21.7/include/linux/ixp_crypto.h -@@ -0,0 +1,192 @@ -+ -+#ifndef IX_CRYPTO_H -+#define IX_CRYPTO_H -+ -+#define MAX_KEYLEN 64 -+#define NPE_CTX_LEN 80 -+#define AES_BLOCK128 16 -+ -+#define NPE_OP_HASH_GEN_ICV 0x50 -+#define NPE_OP_ENC_GEN_KEY 0xc9 -+ -+ -+#define NPE_OP_HASH_VERIFY 0x01 -+#define NPE_OP_CCM_ENABLE 0x04 -+#define NPE_OP_CRYPT_ENABLE 0x08 -+#define NPE_OP_HASH_ENABLE 0x10 -+#define NPE_OP_NOT_IN_PLACE 0x20 -+#define NPE_OP_HMAC_DISABLE 0x40 -+#define NPE_OP_CRYPT_ENCRYPT 0x80 -+ -+#define MOD_ECB 0x0000 -+#define MOD_CTR 0x1000 -+#define MOD_CBC_ENC 0x2000 -+#define MOD_CBC_DEC 0x3000 -+#define MOD_CCM_ENC 0x4000 -+#define MOD_CCM_DEC 0x5000 -+ -+#define ALGO_AES 0x0800 -+#define CIPH_DECR 0x0000 -+#define CIPH_ENCR 0x0400 -+ -+#define MOD_DES 0x0000 -+#define MOD_TDEA2 0x0100 -+#define MOD_TDEA3 0x0200 -+#define MOD_AES128 0x0000 -+#define MOD_AES192 0x0100 -+#define MOD_AES256 0x0200 -+ -+#define KEYLEN_128 4 -+#define KEYLEN_192 6 -+#define KEYLEN_256 8 -+ -+#define CIPHER_TYPE_NULL 0 -+#define CIPHER_TYPE_DES 1 -+#define CIPHER_TYPE_3DES 2 -+#define CIPHER_TYPE_AES 3 -+ -+#define CIPHER_MODE_ECB 1 -+#define CIPHER_MODE_CTR 2 -+#define CIPHER_MODE_CBC 3 -+#define CIPHER_MODE_CCM 4 -+ -+#define HASH_TYPE_NULL 0 -+#define HASH_TYPE_MD5 1 -+#define HASH_TYPE_SHA1 2 -+#define HASH_TYPE_CBCMAC 3 -+ -+#define OP_REG_DONE 1 -+#define OP_REGISTER 2 -+#define OP_PERFORM 3 -+ -+#define STATE_UNREGISTERED 0 -+#define STATE_REGISTERED 1 -+#define STATE_UNLOADING 2 -+ -+struct crypt_ctl { -+#ifndef CONFIG_NPE_ADDRESS_COHERENT -+ u8 mode; /* NPE operation */ -+ u8 init_len; -+ u16 reserved; -+#else -+ u16 reserved; -+ u8 init_len; -+ u8 mode; /* NPE operation */ -+#endif -+ u8 iv[16]; /* IV for CBC mode or CTR IV for CTR mode */ -+ union { -+ u32 icv; -+ u32 rev_aes; -+ } addr; -+ u32 src_buf; -+ u32 dest_buf; -+#ifndef CONFIG_NPE_ADDRESS_COHERENT -+ u16 auth_offs; /* Authentication start offset */ -+ u16 auth_len; /* Authentication data length */ -+ u16 crypt_offs; /* Cryption start offset */ -+ u16 crypt_len; /* Cryption data length */ -+#else -+ u16 auth_len; /* Authentication data length */ -+ u16 auth_offs; /* Authentication start offset */ -+ u16 crypt_len; /* Cryption data length */ -+ u16 crypt_offs; /* Cryption start offset */ -+#endif -+ u32 aadAddr; /* Additional Auth Data Addr for CCM mode */ -+ u32 crypto_ctx; /* NPE Crypto Param structure address */ -+ -+ /* Used by Host */ -+ struct ix_sa_ctx *sa_ctx; -+ int oper_type; -+}; -+ -+struct npe_crypt_cont { -+ union { -+ struct crypt_ctl crypt; -+ u8 rev_aes_key[NPE_CTX_LEN]; -+ } ctl; -+ struct npe_crypt_cont *next; -+ struct npe_crypt_cont *virt; -+ dma_addr_t phys; -+}; -+ -+struct ix_hash_algo { -+ char *name; -+ u32 cfgword; -+ int digest_len; -+ int aad_len; -+ unsigned char *icv; -+ int type; -+}; -+ -+struct ix_cipher_algo { -+ char *name; -+ u32 cfgword_enc; -+ u32 cfgword_dec; -+ int block_len; -+ int iv_len; -+ int type; -+ int mode; -+}; -+ -+struct ix_key { -+ u8 key[MAX_KEYLEN]; -+ int len; -+}; -+ -+struct ix_sa_master { -+ struct device *npe_dev; -+ struct qm_queue *sendq; -+ struct qm_queue *recvq; -+ struct dma_pool *dmapool; -+ struct npe_crypt_cont *pool; -+ int pool_size; -+ rwlock_t lock; -+}; -+ -+struct ix_sa_dir { -+ unsigned char *npe_ctx; -+ dma_addr_t npe_ctx_phys; -+ int npe_ctx_idx; -+ u8 npe_mode; -+}; -+ -+struct ix_sa_ctx { -+ struct list_head list; -+ struct ix_sa_master *master; -+ -+ const struct ix_hash_algo *h_algo; -+ const struct ix_cipher_algo *c_algo; -+ struct ix_key c_key; -+ struct ix_key h_key; -+ -+ int digest_len; -+ -+ struct ix_sa_dir encrypt; -+ struct ix_sa_dir decrypt; -+ -+ struct npe_crypt_cont *rev_aes; -+ gfp_t gfp_flags; -+ -+ int state; -+ void *priv; -+ -+ void(*reg_cb)(struct ix_sa_ctx*, int); -+ void(*perf_cb)(struct ix_sa_ctx*, void*, int); -+ atomic_t use_cnt; -+}; -+ -+const struct ix_hash_algo *ix_hash_by_id(int type); -+const struct ix_cipher_algo *ix_cipher_by_id(int type, int mode); -+ -+struct ix_sa_ctx *ix_sa_ctx_new(int priv_len, gfp_t flags); -+void ix_sa_ctx_free(struct ix_sa_ctx *sa_ctx); -+ -+int ix_sa_crypto_perform(struct ix_sa_ctx *sa_ctx, u8 *data, void *ptr, -+ int datalen, int c_offs, int c_len, int a_offs, int a_len, -+ int hmac, char *iv, int encrypt); -+ -+int ix_sa_ctx_setup_cipher_auth(struct ix_sa_ctx *sa_ctx, -+ const struct ix_cipher_algo *cipher, -+ const struct ix_hash_algo *auth, int len); -+ -+#endif -Index: linux-2.6.21.7/include/linux/ixp_npe.h -=================================================================== ---- /dev/null -+++ linux-2.6.21.7/include/linux/ixp_npe.h -@@ -0,0 +1,117 @@ -+/* -+ * Copyright (C) 2006 Christian Hohnstaedt <chohnstaedt@innominate.com> -+ * -+ * This file is released under the GPLv2 -+ */ -+ -+#ifndef NPE_DEVICE_H -+#define NPE_DEVICE_H -+ -+#include <linux/miscdevice.h> -+#include <asm/hardware.h> -+ -+#ifdef __ARMEB__ -+#undef CONFIG_NPE_ADDRESS_COHERENT -+#else -+#define CONFIG_NPE_ADDRESS_COHERENT -+#endif -+ -+#if defined(__ARMEB__) || defined (CONFIG_NPE_ADDRESS_COHERENT) -+#define npe_to_cpu32(x) (x) -+#define npe_to_cpu16(x) (x) -+#define cpu_to_npe32(x) (x) -+#define cpu_to_npe16(x) (x) -+#else -+#error NPE_DATA_COHERENT -+#define NPE_DATA_COHERENT -+#define npe_to_cpu32(x) be32_to_cpu(x) -+#define npe_to_cpu16(x) be16_to_cpu(x) -+#define cpu_to_npe32(x) cpu_to_be32(x) -+#define cpu_to_npe16(x) cpu_to_be16(x) -+#endif -+ -+ -+struct npe_info { -+ struct resource *res; -+ void __iomem *addr; -+ struct npe_plat_data *plat; -+ u8 img_info[4]; -+ int usage; -+ int loaded; -+ u32 exec_count; -+ u32 ctx_reg2; -+}; -+ -+ -+static inline void npe_reg_write(struct npe_info *npe, u32 reg, u32 val) -+{ -+ *(volatile u32*)((u8*)(npe->addr) + reg) = val; -+} -+ -+static inline u32 npe_reg_read(struct npe_info *npe, u32 reg) -+{ -+ return *(volatile u32*)((u8*)(npe->addr) + reg); -+} -+ -+static inline u32 npe_status(struct npe_info *npe) -+{ -+ return npe_reg_read(npe, IX_NPEDL_REG_OFFSET_EXCTL); -+} -+ -+/* ixNpeDlNpeMgrCommandIssue */ -+static inline void npe_write_exctl(struct npe_info *npe, u32 cmd) -+{ -+ npe_reg_write(npe, IX_NPEDL_REG_OFFSET_EXCTL, cmd); -+} -+/* ixNpeDlNpeMgrWriteCommandIssue */ -+static inline void -+npe_write_cmd(struct npe_info *npe, u32 addr, u32 data, int cmd) -+{ -+ npe_reg_write(npe, IX_NPEDL_REG_OFFSET_EXDATA, data); -+ npe_reg_write(npe, IX_NPEDL_REG_OFFSET_EXAD, addr); -+ npe_reg_write(npe, IX_NPEDL_REG_OFFSET_EXCTL, cmd); -+} -+/* ixNpeDlNpeMgrReadCommandIssue */ -+static inline u32 -+npe_read_cmd(struct npe_info *npe, u32 addr, int cmd) -+{ -+ npe_reg_write(npe, IX_NPEDL_REG_OFFSET_EXAD, addr); -+ npe_reg_write(npe, IX_NPEDL_REG_OFFSET_EXCTL, cmd); -+ /* Intel reads the data twice - so do we... */ -+ npe_reg_read(npe, IX_NPEDL_REG_OFFSET_EXDATA); -+ return npe_reg_read(npe, IX_NPEDL_REG_OFFSET_EXDATA); -+} -+ -+/* ixNpeDlNpeMgrExecAccRegWrite */ -+static inline void npe_write_ecs_reg(struct npe_info *npe, u32 addr, u32 data) -+{ -+ npe_write_cmd(npe, addr, data, IX_NPEDL_EXCTL_CMD_WR_ECS_REG); -+} -+/* ixNpeDlNpeMgrExecAccRegRead */ -+static inline u32 npe_read_ecs_reg(struct npe_info *npe, u32 addr) -+{ -+ return npe_read_cmd(npe, addr, IX_NPEDL_EXCTL_CMD_RD_ECS_REG); -+} -+ -+extern void npe_stop(struct npe_info *npe); -+extern void npe_start(struct npe_info *npe); -+extern void npe_reset(struct npe_info *npe); -+ -+extern struct device *get_npe_by_id(int id); -+extern void return_npe_dev(struct device *dev); -+ -+/* NPE Messages */ -+extern int -+npe_mh_status(struct npe_info *npe); -+extern int -+npe_mh_setportaddr(struct npe_info *npe, struct mac_plat_info *mp, u8 *macaddr); -+extern int -+npe_mh_disable_firewall(struct npe_info *npe, struct mac_plat_info *mp); -+extern int -+npe_mh_set_rxqid(struct npe_info *npe, struct mac_plat_info *mp, int qid); -+extern int -+npe_mh_npe_loopback_mode(struct npe_info *npe, struct mac_plat_info *mp, int enable); -+extern int -+npe_mh_get_stats(struct npe_info *npe, struct mac_plat_info *mp, u32 phys, int reset); -+ -+#endif -Index: linux-2.6.21.7/include/linux/ixp_qmgr.h -=================================================================== ---- /dev/null -+++ linux-2.6.21.7/include/linux/ixp_qmgr.h -@@ -0,0 +1,202 @@ -+/* -+ * Copyright (C) 2006 Christian Hohnstaedt <chohnstaedt@innominate.com> -+ * -+ * This file is released under the GPLv2 -+ */ -+ -+#ifndef IX_QMGR_H -+#define IX_QMGR_H -+ -+#include <linux/skbuff.h> -+#include <linux/list.h> -+#include <linux/if_ether.h> -+#include <linux/spinlock.h> -+#include <linux/platform_device.h> -+#include <linux/ixp_npe.h> -+#include <asm/atomic.h> -+ -+/* All offsets are in 32bit words */ -+#define QUE_LOW_STAT0 0x100 /* 4x Status of the 32 lower queues 0-31 */ -+#define QUE_UO_STAT0 0x104 /* 2x Underflow/Overflow status bits*/ -+#define QUE_UPP_STAT0 0x106 /* 2x Status of thew 32 upper queues 32-63 */ -+#define INT0_SRC_SELREG0 0x108 /* 4x */ -+#define QUE_IE_REG0 0x10c /* 2x */ -+#define QUE_INT_REG0 0x10e /* 2x IRQ reg, write 1 to reset IRQ */ -+ -+#define IX_QMGR_QCFG_BASE 0x800 -+#define IX_QMGR_QCFG_SIZE 0x40 -+#define IX_QMGR_SRAM_SPACE (IX_QMGR_QCFG_BASE + IX_QMGR_QCFG_SIZE) -+ -+#define MAX_QUEUES 32 /* first, we only support the lower 32 queues */ -+#define MAX_NPES 3 -+ -+enum { -+ Q_IRQ_ID_E = 0, /* Queue Empty due to last read */ -+ Q_IRQ_ID_NE, /* Queue Nearly Empty due to last read */ -+ Q_IRQ_ID_NF, /* Queue Nearly Full due to last write */ -+ Q_IRQ_ID_F, /* Queue Full due to last write */ -+ Q_IRQ_ID_NOT_E, /* Queue Not Empty due to last write */ -+ Q_IRQ_ID_NOT_NE, /* Queue Not Nearly Empty due to last write */ -+ Q_IRQ_ID_NOT_NF, /* Queue Not Nearly Full due to last read */ -+ Q_IRQ_ID_NOT_F /* Queue Not Full due to last read */ -+}; -+ -+extern struct qm_queue *request_queue(int qid, int len); -+extern void release_queue(struct qm_queue *queue); -+extern int queue_set_irq_src(struct qm_queue *queue, int flag); -+extern void queue_set_watermarks(struct qm_queue *, unsigned ne, unsigned nf); -+extern int queue_len(struct qm_queue *queue); -+ -+struct qm_qmgr; -+struct qm_queue; -+ -+typedef void(*queue_cb)(struct qm_queue *); -+ -+struct qm_queue { -+ int addr; /* word offset from IX_QMGR_SRAM_SPACE */ -+ int len; /* size in words */ -+ int id; /* Q Id */ -+ u32 __iomem *acc_reg; -+ struct device *dev; -+ atomic_t use; -+ queue_cb irq_cb; -+ void *cb_data; -+}; -+ -+#ifndef CONFIG_NPE_ADDRESS_COHERENT -+struct eth_ctl { -+ u32 next; -+ u16 buf_len; -+ u16 pkt_len; -+ u32 phys_addr; -+ u8 dest_id; -+ u8 src_id; -+ u16 flags; -+ u8 qos; -+ u8 padlen; -+ u16 vlan_tci; -+ u8 dest_mac[ETH_ALEN]; -+ u8 src_mac[ETH_ALEN]; -+}; -+ -+#else -+struct eth_ctl { -+ u32 next; -+ u16 pkt_len; -+ u16 buf_len; -+ u32 phys_addr; -+ u16 flags; -+ u8 src_id; -+ u8 dest_id; -+ u16 vlan_tci; -+ u8 padlen; -+ u8 qos; -+ u8 dest_mac[ETH_ALEN]; -+ u8 src_mac[ETH_ALEN]; -+}; -+#endif -+ -+struct npe_cont { -+ struct eth_ctl eth; -+ void *data; -+ struct npe_cont *next; -+ struct npe_cont *virt; -+ dma_addr_t phys; -+}; -+ -+struct qm_qmgr { -+ u32 __iomem *addr; -+ struct resource *res; -+ struct qm_queue *queues[MAX_QUEUES]; -+ rwlock_t lock; -+ struct npe_cont *pool; -+ struct dma_pool *dmapool; -+ int irq; -+}; -+ -+static inline void queue_write_cfg_reg(struct qm_queue *queue, u32 val) -+{ -+ struct qm_qmgr *qmgr = dev_get_drvdata(queue->dev); -+ *(qmgr->addr + IX_QMGR_QCFG_BASE + queue->id) = val; -+} -+static inline u32 queue_read_cfg_reg(struct qm_queue *queue) -+{ -+ struct qm_qmgr *qmgr = dev_get_drvdata(queue->dev); -+ return *(qmgr->addr + IX_QMGR_QCFG_BASE + queue->id); -+} -+ -+static inline void queue_ack_irq(struct qm_queue *queue) -+{ -+ struct qm_qmgr *qmgr = dev_get_drvdata(queue->dev); -+ *(qmgr->addr + QUE_INT_REG0) = 1 << queue->id; -+} -+ -+static inline void queue_enable_irq(struct qm_queue *queue) -+{ -+ struct qm_qmgr *qmgr = dev_get_drvdata(queue->dev); -+ *(qmgr->addr + QUE_IE_REG0) |= 1 << queue->id; -+} -+ -+static inline void queue_disable_irq(struct qm_queue *queue) -+{ -+ struct qm_qmgr *qmgr = dev_get_drvdata(queue->dev); -+ *(qmgr->addr + QUE_IE_REG0) &= ~(1 << queue->id); -+} -+ -+static inline void queue_put_entry(struct qm_queue *queue, u32 entry) -+{ -+ *(queue->acc_reg) = npe_to_cpu32(entry); -+} -+ -+static inline u32 queue_get_entry(struct qm_queue *queue) -+{ -+ return cpu_to_npe32(*queue->acc_reg); -+} -+ -+static inline struct npe_cont *qmgr_get_cont(struct qm_qmgr *qmgr) -+{ -+ unsigned long flags; -+ struct npe_cont *cont; -+ -+ if (!qmgr->pool) -+ return NULL; -+ write_lock_irqsave(&qmgr->lock, flags); -+ cont = qmgr->pool; -+ qmgr->pool = cont->next; -+ write_unlock_irqrestore(&qmgr->lock, flags); -+ return cont; -+} -+ -+static inline void qmgr_return_cont(struct qm_qmgr *qmgr,struct npe_cont *cont) -+{ -+ unsigned long flags; -+ -+ write_lock_irqsave(&qmgr->lock, flags); -+ cont->next = qmgr->pool; -+ qmgr->pool = cont; -+ write_unlock_irqrestore(&qmgr->lock, flags); -+} -+ -+static inline int queue_stat(struct qm_queue *queue) -+{ -+ struct qm_qmgr *qmgr = dev_get_drvdata(queue->dev); -+ u32 reg = *(qmgr->addr + QUE_UO_STAT0 + (queue->id >> 4)); -+ return (reg >> (queue->id & 0xf) << 1) & 3; -+} -+ -+/* Prints the queue state, which is very, very helpfull for debugging */ -+static inline void queue_state(struct qm_queue *queue) -+{ -+ u32 val=0, lstat=0; -+ int offs; -+ struct qm_qmgr *qmgr = dev_get_drvdata(queue->dev); -+ -+ offs = queue->id/8 + QUE_LOW_STAT0; -+ val = *(qmgr->addr + IX_QMGR_QCFG_BASE + queue->id); -+ lstat = (*(qmgr->addr + offs) >> ((queue->id % 8)*4)) & 0x0f; -+ -+ printk("Qid[%02d]: Wptr=%4x, Rptr=%4x, diff=%4x, Stat:%x\n", queue->id, -+ val&0x7f, (val>>7) &0x7f, (val - (val >> 7)) & 0x7f, lstat); -+} -+ -+#endif diff --git a/target/linux/ixp4xx/patches/110-ixp4xx_net_driver_fix_mac_handling.patch b/target/linux/ixp4xx/patches/110-ixp4xx_net_driver_fix_mac_handling.patch deleted file mode 100644 index 6adf4995ba..0000000000 --- a/target/linux/ixp4xx/patches/110-ixp4xx_net_driver_fix_mac_handling.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- - drivers/net/ixp4xx/mac_driver.c | 24 ++++++++++-------------- - 1 file changed, 10 insertions(+), 14 deletions(-) - -Index: linux-2.6.21.7/drivers/net/ixp4xx/mac_driver.c -=================================================================== ---- linux-2.6.21.7.orig/drivers/net/ixp4xx/mac_driver.c -+++ linux-2.6.21.7/drivers/net/ixp4xx/mac_driver.c -@@ -842,7 +842,7 @@ static void __exit finish_mac(void) - } - } - --module_init(init_mac); -+late_initcall(init_mac); - module_exit(finish_mac); - - MODULE_LICENSE("GPL"); diff --git a/target/linux/ixp4xx/patches/139-ixp4xx_net_driver_mtd_load_fw.patch b/target/linux/ixp4xx/patches/139-ixp4xx_net_driver_mtd_load_fw.patch deleted file mode 100644 index 9ed1b42fe7..0000000000 --- a/target/linux/ixp4xx/patches/139-ixp4xx_net_driver_mtd_load_fw.patch +++ /dev/null @@ -1,392 +0,0 @@ ---- - drivers/net/ixp4xx/Kconfig | 10 + - drivers/net/ixp4xx/Makefile | 1 - drivers/net/ixp4xx/npe_ucode.c | 185 +++++++++++++++++++++++++++++++++ - drivers/net/ixp4xx/ucode_dl.c | 43 ++++--- - include/asm-arm/arch-ixp4xx/platform.h | 19 +++ - include/linux/ixp_npe.h | 1 - 6 files changed, 239 insertions(+), 20 deletions(-) - -Index: linux-2.6.21.7/drivers/net/ixp4xx/Kconfig -=================================================================== ---- linux-2.6.21.7.orig/drivers/net/ixp4xx/Kconfig -+++ linux-2.6.21.7/drivers/net/ixp4xx/Kconfig -@@ -11,6 +11,7 @@ config IXP4XX_NPE - tristate "IXP4xx NPE support" - depends on ARCH_IXP4XX - depends on NET_ETHERNET -+ select CRC16 - help - The IXP4XX NPE driver supports the 3 CPU co-processors called - "Network Processing Engines" (NPE). It adds support fo downloading -@@ -18,7 +19,7 @@ config IXP4XX_NPE - More about this at: Documentation/networking/ixp4xx/README. - You can either use this OR the Intel Access Library (IAL) - --config IXP4XX_FW_LOAD -+config IXP4XX_NPE_FW_LOAD - bool "Use Firmware hotplug for Microcode download" - depends on IXP4XX_NPE - select HOTPLUG -@@ -28,6 +29,13 @@ config IXP4XX_FW_LOAD - /usr/lib/hotplug/firmware/NPE-[ABC] - see Documentation/firmware_class/hotplug-script - -+config IXP4XX_NPE_FW_MTD -+ bool "Load firmware from an mtd partition" -+ depends on IXP4XX_NPE && MTD_IXP4XX -+ help -+ With this option, the driver will search for -+ the firmware into an MTD partition. -+ - config IXP4XX_MAC - tristate "IXP4xx MAC support" - depends on IXP4XX_NPE -Index: linux-2.6.21.7/drivers/net/ixp4xx/Makefile -=================================================================== ---- linux-2.6.21.7.orig/drivers/net/ixp4xx/Makefile -+++ linux-2.6.21.7/drivers/net/ixp4xx/Makefile -@@ -1,5 +1,6 @@ - obj-$(CONFIG_IXP4XX_QMGR) += ixp4xx_qmgr.o - obj-$(CONFIG_IXP4XX_NPE) += ixp4xx_npe.o -+obj-$(CONFIG_IXP4XX_NPE_FW_MTD) += npe_ucode.o - obj-$(CONFIG_IXP4XX_MAC) += ixp4xx_mac.o - obj-$(CONFIG_IXP4XX_CRYPTO) += ixp4xx_crypto.o - -Index: linux-2.6.21.7/drivers/net/ixp4xx/npe_ucode.c -=================================================================== ---- /dev/null -+++ linux-2.6.21.7/drivers/net/ixp4xx/npe_ucode.c -@@ -0,0 +1,185 @@ -+/* -+ * Provide an NPE platform device for microcode handling -+ * -+ * Copyright (C) 2006 Christian Hohnstaedt <chohnstaedt@innominate.com> -+ * -+ * This file is released under the GPLv2 -+ */ -+ -+#include <linux/kernel.h> -+#include <linux/platform_device.h> -+#include <linux/init.h> -+#include <linux/slab.h> -+#include <linux/firmware.h> -+#include <linux/mtd/mtd.h> -+ -+#include <linux/ixp_npe.h> -+ -+#define DL_MAGIC 0xfeedf00d -+#define DL_MAGIC_SWAP 0x0df0edfe -+ -+#define IMG_SIZE(image) (((image)->size * sizeof(u32)) + \ -+ sizeof(struct dl_image)) -+ -+#define IMG_REV_MAJOR(id) (((id) >> 8) & 0x0f) -+#define IMG_REV_MINOR(id) ((id) & 0x0f) -+#define IMG_FUNC(id) (((id) >> 16) & 0xff) -+#define IMG_NPE(id) (((id) >> 24) & 0x0f) -+#define IMG_IXP(id) (((id) >> 28) & 0x0f) -+ -+static struct platform_driver ixp4xx_npe_ucode_driver; -+static unsigned char *partition_name = NULL; -+ -+static void print_image_info(u32 id, u32 offset, u32 size) -+{ -+ unsigned char idx; -+ const char *names[] = { "IXP425", "IXP465", "unknown" }; -+ -+ idx = IMG_IXP(id) < 2 ? IMG_IXP(id) : 2; -+ -+ printk(KERN_INFO "npe: found at 0x%x, %s/NPE-%c func: %02x, rev: %x.%x, " -+ "size: %5d, id: %08x\n", offset, names[idx], IMG_NPE(id) + 'A', -+ IMG_FUNC(id), IMG_REV_MAJOR(id), IMG_REV_MINOR(id), size, id); -+} -+ -+void npe_swap_image(struct dl_image *image) -+{ -+ unsigned int i; -+ -+ image->magic = swab32(image->magic); -+ image->id = swab32(image->id); -+ image->size = swab32(image->size); -+ -+ for (i = 0; i < image->size; i++) -+ image->u.data[i] = swab32(image->u.data[i]); -+} -+ -+static void npe_find_microcode(struct mtd_info *mtd) -+{ -+ u32 buf; -+ u32 magic = htonl(DL_MAGIC); -+ u32 id, size; -+ size_t retlen; -+ int err; -+ unsigned int offset = 0; -+ -+ printk("npe: searching for firmware...\n"); -+ -+ while (offset < mtd->size) { -+ -+ err = mtd->read(mtd, offset, 4, &retlen, (u_char *) &buf); -+ offset += retlen; -+ -+ if (buf != magic) -+ continue; -+ -+ err = mtd->read(mtd, offset, 4, &retlen, (u_char *) &id); -+ offset += retlen; -+ -+ if (id == magic) -+ break; -+ -+ id = ntohl(id); -+ -+ err = mtd->read(mtd, offset, 4, &retlen, (u_char *) &size); -+ offset += retlen; -+ -+ size = (ntohl(size) * 4) + 12; -+ -+ print_image_info(id, offset - 12, size); -+ -+ if (size < 24000 && ( IMG_FUNC(id) == 0x01 || IMG_FUNC(id) == 0x00) || IMG_FUNC(id) == 0x05 ) { // XXX fix size/detection -+ -+ struct dl_image *image = kmalloc(size, GFP_KERNEL); -+ -+ /* we are going to load it, rewind offset */ -+ offset -= 12; -+ -+ if (image) { -+ err = mtd->read(mtd, offset, size, &retlen, (u_char *) image); -+ -+ if (err == 0 && retlen == size) { -+ if (image->magic == DL_MAGIC_SWAP) -+ npe_swap_image(image); -+ -+ store_npe_image(image, NULL); -+ } else { -+ printk(KERN_ERR "unable to read firmware\n"); -+ } -+ -+ kfree(image); -+ } -+ -+ offset += size; -+ } -+ } -+} -+ -+static void npe_flash_add(struct mtd_info *mtd) -+{ -+ if (partition_name == NULL) -+ return; -+ -+ if (strcmp(mtd->name, partition_name) == 0) { -+ npe_find_microcode(mtd); -+ } -+} -+ -+static void npe_flash_remove(struct mtd_info *mtd) { -+} -+ -+static struct mtd_notifier npe_flash_notifier = { -+ .add = npe_flash_add, -+ .remove = npe_flash_remove, -+}; -+ -+static int npe_ucode_probe(struct platform_device *pdev) -+{ -+ struct npe_ucode_platform_data *data = pdev->dev.platform_data; -+ -+ if (partition_name) -+ return -EEXIST; -+ -+ if (data && data->mtd_partition) { -+ partition_name = data->mtd_partition; -+ return 0; -+ } -+ -+ return -EINVAL; -+} -+ -+static int npe_ucode_remove(struct platform_device *pdev) -+{ -+ return 0; -+} -+ -+static struct platform_driver ixp4xx_npe_ucode_driver = { -+ .driver = { -+ .name = "ixp4xx_npe_ucode", -+ .owner = THIS_MODULE, -+ }, -+ .probe = npe_ucode_probe, -+ .remove = npe_ucode_remove, -+}; -+ -+static int __init npe_ucode_init(void) -+{ -+ int ret; -+ -+ ret = platform_driver_register(&ixp4xx_npe_ucode_driver); -+ register_mtd_user(&npe_flash_notifier); -+ -+ return ret; -+} -+ -+static void __exit npe_ucode_exit(void) -+{ -+ unregister_mtd_user(&npe_flash_notifier); -+ platform_driver_unregister(&ixp4xx_npe_ucode_driver); -+} -+ -+module_init(npe_ucode_init); -+module_exit(npe_ucode_exit); -+ -+MODULE_LICENSE("GPL"); -+MODULE_AUTHOR("Alessandro Zummo <a.zummo@towertech.it>"); -Index: linux-2.6.21.7/drivers/net/ixp4xx/ucode_dl.c -=================================================================== ---- linux-2.6.21.7.orig/drivers/net/ixp4xx/ucode_dl.c -+++ linux-2.6.21.7/drivers/net/ixp4xx/ucode_dl.c -@@ -16,6 +16,7 @@ - #include <linux/firmware.h> - #include <linux/dma-mapping.h> - #include <linux/byteorder/swab.h> -+#include <linux/crc16.h> - #include <asm/uaccess.h> - #include <asm/io.h> - -@@ -26,6 +27,12 @@ - #define DL_MAGIC 0xfeedf00d - #define DL_MAGIC_SWAP 0x0df0edfe - -+#define IMG_REV_MAJOR(id) (((id) >> 8) & 0x0f) -+#define IMG_REV_MINOR(id) ((id) & 0x0f) -+#define IMG_FUNC(id) (((id) >> 16) & 0xff) -+#define IMG_NPE(id) (((id) >> 24) & 0x0f) -+#define IMG_IXP(id) (((id) >> 28) & 0x0f) -+ - #define EOF_BLOCK 0xf - #define IMG_SIZE(image) (((image)->size * sizeof(u32)) + \ - sizeof(struct dl_image)) -@@ -38,21 +45,6 @@ enum blk_type { - data, - }; - --struct dl_block { -- u32 type; -- u32 offset; --}; -- --struct dl_image { -- u32 magic; -- u32 id; -- u32 size; -- union { -- u32 data[0]; -- struct dl_block block[0]; -- } u; --}; -- - struct dl_codeblock { - u32 npe_addr; - u32 size; -@@ -127,20 +119,33 @@ download_block(struct npe_info *npe, str - return 0; - } - --static int store_npe_image(struct dl_image *image, struct device *dev) -+int store_npe_image(struct dl_image *image, struct device *dev) - { - struct dl_block *blk; - struct dl_codeblock *cb; - struct npe_info *npe; - int ret=0; -+ u16 crc; - - if (!dev) { -- dev = get_npe_by_id( (image->id >> 24) & 0xf); -+ dev = get_npe_by_id(IMG_NPE(image->id)); - return_npe_dev(dev); - } - if (!dev) - return -ENODEV; - -+ if (image->size > 24000) { // XXX fix max size -+ printk(KERN_ERR "npe: firmware too large\n"); -+ return -EFBIG; -+ } -+ -+ if (IMG_REV_MAJOR(image->id) != 2) { -+ printk(KERN_ERR "npe: only revision 2 is supported at this time\n"); -+ return -EINVAL; -+ } -+ -+ crc = crc16(0, (u8 *) image, IMG_SIZE(image)); -+ - npe = dev_get_drvdata(dev); - if (npe->loaded && (npe->usage > 0)) { - printk(KERN_INFO "Cowardly refusing to reload an Image " -@@ -267,8 +272,7 @@ static ssize_t ucode_write(struct file * - - static void npe_firmware_probe(struct device *dev) - { --#if (defined(CONFIG_FW_LOADER) || defined(CONFIG_FW_LOADER_MODULE)) \ -- && defined(MODULE) -+#ifdef CONFIG_IXP4XX_NPE_FW_LOADER - const struct firmware *fw_entry; - struct npe_info *npe = dev_get_drvdata(dev); - struct dl_image *image; -@@ -477,3 +481,4 @@ MODULE_AUTHOR("Christian Hohnstaedt <cho - - EXPORT_SYMBOL(get_npe_by_id); - EXPORT_SYMBOL(return_npe_dev); -+EXPORT_SYMBOL(store_npe_image); -Index: linux-2.6.21.7/include/asm-arm/arch-ixp4xx/platform.h -=================================================================== ---- linux-2.6.21.7.orig/include/asm-arm/arch-ixp4xx/platform.h -+++ linux-2.6.21.7/include/asm-arm/arch-ixp4xx/platform.h -@@ -86,6 +86,21 @@ struct ixp4xx_i2c_pins { - unsigned long scl_pin; - }; - -+struct dl_block { -+ u32 type; -+ u32 offset; -+}; -+ -+struct dl_image { -+ u32 magic; -+ u32 id; -+ u32 size; -+ union { -+ u32 data[0]; -+ struct dl_block block[0]; -+ } u; -+}; -+ - struct npe_plat_data { - const char *name; - int data_size; -@@ -105,6 +120,10 @@ struct mac_plat_info { - - }; - -+struct npe_ucode_platform_data { -+ unsigned char *mtd_partition; -+}; -+ - /* - * This structure provide a means for the board setup code - * to give information to th pata_ixp4xx driver. It is -Index: linux-2.6.21.7/include/linux/ixp_npe.h -=================================================================== ---- linux-2.6.21.7.orig/include/linux/ixp_npe.h -+++ linux-2.6.21.7/include/linux/ixp_npe.h -@@ -99,6 +99,7 @@ extern void npe_reset(struct npe_info *n - - extern struct device *get_npe_by_id(int id); - extern void return_npe_dev(struct device *dev); -+extern int store_npe_image(struct dl_image *image, struct device *dev); - - /* NPE Messages */ - extern int diff --git a/target/linux/ixp4xx/patches/140-ixp4xx_net_driver_no_phy.patch b/target/linux/ixp4xx/patches/140-ixp4xx_net_driver_no_phy.patch deleted file mode 100644 index fcff63a19a..0000000000 --- a/target/linux/ixp4xx/patches/140-ixp4xx_net_driver_no_phy.patch +++ /dev/null @@ -1,74 +0,0 @@ -Index: linux-2.6.21.7/drivers/net/ixp4xx/mac_driver.c -=================================================================== ---- linux-2.6.21.7.orig/drivers/net/ixp4xx/mac_driver.c -+++ linux-2.6.21.7/drivers/net/ixp4xx/mac_driver.c -@@ -161,6 +161,16 @@ static int media_check(struct net_device - { - struct mac_info *mac = netdev_priv(dev); - -+ if ( mac->mii.phy_id < 0 ) { -+ if ( init ) { -+ netif_carrier_on(mac->mii.dev); -+ mac->mii.full_duplex = 1; -+ update_duplex_mode(dev); -+ return 1; -+ } -+ return 0; -+ } -+ - if (mii_check_media(&mac->mii, netif_msg_link(mac), init)) { - update_duplex_mode(dev); - return 1; -@@ -448,7 +458,12 @@ static int ixmac_ioctl(struct net_device - return -EINVAL; - if (!try_module_get(THIS_MODULE)) - return -ENODEV; -- rc = generic_mii_ioctl(&mac->mii, if_mii(rq), cmd, &duplex_changed); -+ if ( mac->mii.phy_id < 0 ) { -+ duplex_changed = 0; -+ rc = -EOPNOTSUPP; -+ } else { -+ rc = generic_mii_ioctl(&mac->mii, if_mii(rq), cmd, &duplex_changed); -+ } - module_put(THIS_MODULE); - if (duplex_changed) - update_duplex_mode(dev); -@@ -478,6 +493,9 @@ static void ixmac_get_drvinfo(struct net - static int ixmac_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) - { - struct mac_info *mac = netdev_priv(dev); -+ if ( mac->mii.phy_id < 0 ) { -+ return 0; -+ } - mii_ethtool_gset(&mac->mii, cmd); - return 0; - } -@@ -486,6 +504,9 @@ static int ixmac_set_settings(struct net - { - struct mac_info *mac = netdev_priv(dev); - int rc; -+ if ( mac->mii.phy_id < 0 ) { -+ return -EOPNOTSUPP; -+ } - rc = mii_ethtool_sset(&mac->mii, cmd); - return rc; - } -@@ -493,12 +514,18 @@ static int ixmac_set_settings(struct net - static int ixmac_nway_reset(struct net_device *dev) - { - struct mac_info *mac = netdev_priv(dev); -+ if ( mac->mii.phy_id < 0 ) { -+ return -EOPNOTSUPP; -+ } - return mii_nway_restart(&mac->mii); - } - - static u32 ixmac_get_link(struct net_device *dev) - { - struct mac_info *mac = netdev_priv(dev); -+ if ( mac->mii.phy_id < 0 ) { -+ return 1; -+ } - return mii_link_ok(&mac->mii); - } - diff --git a/target/linux/ixp4xx/patches/141-nslu2_setup_mac.patch b/target/linux/ixp4xx/patches/141-nslu2_setup_mac.patch deleted file mode 100644 index 5d72f06987..0000000000 --- a/target/linux/ixp4xx/patches/141-nslu2_setup_mac.patch +++ /dev/null @@ -1,42 +0,0 @@ -Index: linux-2.6.21.7/arch/arm/mach-ixp4xx/nslu2-setup.c -=================================================================== ---- linux-2.6.21.7.orig/arch/arm/mach-ixp4xx/nslu2-setup.c -+++ linux-2.6.21.7/arch/arm/mach-ixp4xx/nslu2-setup.c -@@ -138,6 +138,29 @@ 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, -+ .rxdoneq_id = 4, -+}; -+ -+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_controller, - &nslu2_flash, -@@ -145,6 +168,7 @@ static struct platform_device *nslu2_dev - #ifdef CONFIG_LEDS_IXP4XX - &nslu2_leds, - #endif -+ &mac0 - }; - - static void nslu2_power_off(void) diff --git a/target/linux/ixp4xx/patches/142-nas100d_setup_mac.patch b/target/linux/ixp4xx/patches/142-nas100d_setup_mac.patch deleted file mode 100644 index 023dd6c52b..0000000000 --- a/target/linux/ixp4xx/patches/142-nas100d_setup_mac.patch +++ /dev/null @@ -1,41 +0,0 @@ -Index: linux-2.6.21.7/arch/arm/mach-ixp4xx/nas100d-setup.c -=================================================================== ---- linux-2.6.21.7.orig/arch/arm/mach-ixp4xx/nas100d-setup.c -+++ linux-2.6.21.7/arch/arm/mach-ixp4xx/nas100d-setup.c -@@ -123,12 +123,36 @@ static struct platform_device nas100d_ua - .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, -+ .rxdoneq_id = 4, -+}; -+ -+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_controller, - &nas100d_flash, - #ifdef CONFIG_LEDS_IXP4XX - &nas100d_leds, - #endif -+ &mac0 - }; - - static void nas100d_power_off(void) diff --git a/target/linux/ixp4xx/patches/143-nslu2_mtd_microcode.patch b/target/linux/ixp4xx/patches/143-nslu2_mtd_microcode.patch deleted file mode 100644 index 764254486c..0000000000 --- a/target/linux/ixp4xx/patches/143-nslu2_mtd_microcode.patch +++ /dev/null @@ -1,35 +0,0 @@ ---- - arch/arm/mach-ixp4xx/nslu2-setup.c | 13 ++++++++++++- - 1 file changed, 12 insertions(+), 1 deletion(-) - -Index: linux-2.6.21.7/arch/arm/mach-ixp4xx/nslu2-setup.c -=================================================================== ---- linux-2.6.21.7.orig/arch/arm/mach-ixp4xx/nslu2-setup.c -+++ linux-2.6.21.7/arch/arm/mach-ixp4xx/nslu2-setup.c -@@ -161,6 +161,16 @@ static struct platform_device mac0 = { - .resource = &res_mac0, - }; - -+struct npe_ucode_platform_data nslu2_npe_ucode_data = { -+ .mtd_partition = "FIS directory", -+}; -+ -+static struct platform_device nslu2_npe_ucode = { -+ .name = "ixp4xx_npe_ucode", -+ .id = 0, -+ .dev.platform_data = &nslu2_npe_ucode_data, -+}; -+ - static struct platform_device *nslu2_devices[] __initdata = { - &nslu2_i2c_controller, - &nslu2_flash, -@@ -168,7 +178,8 @@ static struct platform_device *nslu2_dev - #ifdef CONFIG_LEDS_IXP4XX - &nslu2_leds, - #endif -- &mac0 -+ &mac0, -+ &nslu2_npe_ucode, - }; - - static void nslu2_power_off(void) diff --git a/target/linux/ixp4xx/patches/144-nas100d_mtd_microcode.patch b/target/linux/ixp4xx/patches/144-nas100d_mtd_microcode.patch deleted file mode 100644 index 836ed412a3..0000000000 --- a/target/linux/ixp4xx/patches/144-nas100d_mtd_microcode.patch +++ /dev/null @@ -1,34 +0,0 @@ ---- - arch/arm/mach-ixp4xx/nas100d-setup.c | 13 ++++++++++++- - 1 file changed, 12 insertions(+), 1 deletion(-) - -Index: linux-2.6.21.7/arch/arm/mach-ixp4xx/nas100d-setup.c -=================================================================== ---- linux-2.6.21.7.orig/arch/arm/mach-ixp4xx/nas100d-setup.c -+++ linux-2.6.21.7/arch/arm/mach-ixp4xx/nas100d-setup.c -@@ -146,13 +146,24 @@ static struct platform_device mac0 = { - .resource = &res_mac0, - }; - -+struct npe_ucode_platform_data nas100d_npe_ucode_data = { -+ .mtd_partition = "microcode", -+}; -+ -+static struct platform_device nas100d_npe_ucode = { -+ .name = "ixp4xx_npe_ucode", -+ .id = 0, -+ .dev.platform_data = &nas100d_npe_ucode_data, -+}; -+ - static struct platform_device *nas100d_devices[] __initdata = { - &nas100d_i2c_controller, - &nas100d_flash, - #ifdef CONFIG_LEDS_IXP4XX - &nas100d_leds, - #endif -- &mac0 -+ &mac0, -+ &nas100d_npe_ucode, - }; - - static void nas100d_power_off(void) diff --git a/target/linux/ixp4xx/patches/152-nas100d_mtd_load_mac.patch b/target/linux/ixp4xx/patches/152-nas100d_mtd_load_mac.patch deleted file mode 100644 index 1adb3fdb96..0000000000 --- a/target/linux/ixp4xx/patches/152-nas100d_mtd_load_mac.patch +++ /dev/null @@ -1,56 +0,0 @@ ---- - arch/arm/mach-ixp4xx/nas100d-setup.c | 27 +++++++++++++++++++++++++++ - 1 file changed, 27 insertions(+) - -Index: linux-2.6.21.7/arch/arm/mach-ixp4xx/nas100d-setup.c -=================================================================== ---- linux-2.6.21.7.orig/arch/arm/mach-ixp4xx/nas100d-setup.c -+++ linux-2.6.21.7/arch/arm/mach-ixp4xx/nas100d-setup.c -@@ -16,6 +16,7 @@ - #include <linux/serial.h> - #include <linux/serial_8250.h> - #include <linux/leds.h> -+#include <linux/mtd/mtd.h> - - #include <asm/mach-types.h> - #include <asm/mach/arch.h> -@@ -166,6 +167,30 @@ static struct platform_device *nas100d_d - &nas100d_npe_ucode, - }; - -+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. */ -@@ -198,6 +223,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") diff --git a/target/linux/ixp4xx/patches/153-nslu2_mtd_load_mac.patch b/target/linux/ixp4xx/patches/153-nslu2_mtd_load_mac.patch deleted file mode 100644 index a290cf6709..0000000000 --- a/target/linux/ixp4xx/patches/153-nslu2_mtd_load_mac.patch +++ /dev/null @@ -1,56 +0,0 @@ ---- - arch/arm/mach-ixp4xx/nslu2-setup.c | 27 +++++++++++++++++++++++++++ - 1 file changed, 27 insertions(+) - -Index: linux-2.6.21.7/arch/arm/mach-ixp4xx/nslu2-setup.c -=================================================================== ---- linux-2.6.21.7.orig/arch/arm/mach-ixp4xx/nslu2-setup.c -+++ linux-2.6.21.7/arch/arm/mach-ixp4xx/nslu2-setup.c -@@ -18,6 +18,7 @@ - #include <linux/serial.h> - #include <linux/serial_8250.h> - #include <linux/leds.h> -+#include <linux/mtd/mtd.h> - - #include <asm/mach-types.h> - #include <asm/mach/arch.h> -@@ -182,6 +183,30 @@ static struct platform_device *nslu2_dev - &nslu2_npe_ucode, - }; - -+static void nslu2_flash_add(struct mtd_info *mtd) -+{ -+ if (strcmp(mtd->name, "RedBoot") == 0) { -+ size_t retlen; -+ u_char mac[6]; -+ -+ 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 nslu2_power_off(void) - { - /* This causes the box to drop the power and go dead. */ -@@ -224,6 +249,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") diff --git a/target/linux/ixp4xx/patches/160-nas100d_artop_temp_fix.patch b/target/linux/ixp4xx/patches/160-nas100d_artop_temp_fix.patch deleted file mode 100644 index e93600e5f1..0000000000 --- a/target/linux/ixp4xx/patches/160-nas100d_artop_temp_fix.patch +++ /dev/null @@ -1,49 +0,0 @@ -From: Alan Cox <alan@redhat.com> -To: Alessandro Zummo <alessandro.zummo@towertech.it> -Cc: Jeff Garzik <jgarzik@redhat.com>, Alan Cox <alan@redhat.com> -Subject: Re: drivers/ata/pata_artop.c -Date: Sun, 15 Oct 2006 14:25:16 -0400 -User-Agent: Mutt/1.4.1i - -On Sun, Oct 15, 2006 at 07:18:31PM +0200, Alessandro Zummo wrote: -> In the discovery phase there's a lot of time spent in the detection -> of the second port. - -The error recovery is a bit determined right now - Tejun's been doing some -work on SRST behaviour and also for the worst cases polled detect so it -should come out ok - -> What's the correct way to inform the driver -> to avoid checking the second port? - -Set the number of ports to 1 in your own tree for now. The real fix is -not to go poking at pata ports if the ret is 0xFF - ---- - drivers/ata/pata_artop.c | 6 ++++++ - 1 file changed, 6 insertions(+) - -Index: linux-2.6.21.7/drivers/ata/pata_artop.c -=================================================================== ---- linux-2.6.21.7.orig/drivers/ata/pata_artop.c -+++ linux-2.6.21.7/drivers/ata/pata_artop.c -@@ -26,6 +26,7 @@ - #include <scsi/scsi_host.h> - #include <linux/libata.h> - #include <linux/ata.h> -+#include <asm/mach-types.h> - - #define DRV_NAME "pata_artop" - #define DRV_VERSION "0.4.2" -@@ -469,6 +470,11 @@ static int artop_init_one (struct pci_de - pci_read_config_byte(pdev, 0x4a, ®); - pci_write_config_byte(pdev, 0x4a, (reg & ~0x01) | 0x80); - -+ /* NAS100D workaround */ -+#ifdef CONFIG_MACH_NAS100D -+ if (machine_is_nas100d()) -+ ports = 1; -+#endif - } - - BUG_ON(info == NULL); diff --git a/target/linux/ixp4xx/patches/178-via_velocity_bigendian.patch b/target/linux/ixp4xx/patches/178-via_velocity_bigendian.patch deleted file mode 100644 index 169a53703c..0000000000 --- a/target/linux/ixp4xx/patches/178-via_velocity_bigendian.patch +++ /dev/null @@ -1,927 +0,0 @@ -Index: linux-2.6.21.7/drivers/net/via-velocity.c -=================================================================== ---- linux-2.6.21.7.orig/drivers/net/via-velocity.c -+++ linux-2.6.21.7/drivers/net/via-velocity.c -@@ -96,11 +96,31 @@ MODULE_AUTHOR("VIA Networking Technologi - MODULE_LICENSE("GPL"); - MODULE_DESCRIPTION("VIA Networking Velocity Family Gigabit Ethernet Adapter Driver"); - -+/* Valid values for vdebug (additive, this is a bitmask): -+ * 0x00 => off -+ * 0x01 => always on -+ * 0x02 => additional detail on tx (rx, too, if anyone implements same) -+ * 0x04 => detail the initialization process -+ * 0x08 => spot debug detail; to be used as developers see fit -+ */ -+static int vdebug = 0; -+ -+/* HAIL - these macros are for the normal 0x01-type tracing... */ -+#define HAIL(S) \ -+ if (vdebug&1) printk(KERN_NOTICE "%s\n", (S)); -+#define HAILS(S,T) \ -+ if (vdebug&1) printk(KERN_NOTICE "%s -> status=0x%x\n", (S), (T)); -+ - #define VELOCITY_PARAM(N,D) \ - static int N[MAX_UNITS]=OPTION_DEFAULT;\ - module_param_array(N, int, NULL, 0); \ - MODULE_PARM_DESC(N, D); - -+#define VELO_DEBUG_MIN 0 -+#define VELO_DEBUG_MAX 255 -+#define VELO_DEBUG_DEF 0 -+VELOCITY_PARAM(velo_debug, "Debug level"); -+ - #define RX_DESC_MIN 64 - #define RX_DESC_MAX 255 - #define RX_DESC_DEF 64 -@@ -385,12 +405,12 @@ static void __devinit velocity_set_int_o - if (val == -1) - *opt = def; - else if (val < min || val > max) { -- VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: the value of parameter %s is invalid, the valid range is (%d-%d)\n", -- devname, name, min, max); -+ VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "via-velocity: the value of parameter %s is invalid, the valid range is (%d-%d)\n", -+ name, min, max); - *opt = def; - } else { -- VELOCITY_PRT(MSG_LEVEL_INFO, KERN_INFO "%s: set value of parameter %s to %d\n", -- devname, name, val); -+ VELOCITY_PRT(MSG_LEVEL_INFO, KERN_INFO "via-velocity: set value of parameter %s to %d\n", -+ name, val); - *opt = val; - } - } -@@ -415,12 +435,12 @@ static void __devinit velocity_set_bool_ - if (val == -1) - *opt |= (def ? flag : 0); - else if (val < 0 || val > 1) { -- printk(KERN_NOTICE "%s: the value of parameter %s is invalid, the valid range is (0-1)\n", -- devname, name); -+ printk(KERN_NOTICE "via-velocity: the value of parameter %s is invalid, the valid range is (0-1)\n", -+ name); - *opt |= (def ? flag : 0); - } else { -- printk(KERN_INFO "%s: set parameter %s to %s\n", -- devname, name, val ? "TRUE" : "FALSE"); -+ printk(KERN_INFO "via-velocity: set parameter %s to %s\n", -+ name, val ? "TRUE" : "FALSE"); - *opt |= (val ? flag : 0); - } - } -@@ -438,6 +458,7 @@ static void __devinit velocity_set_bool_ - static void __devinit velocity_get_options(struct velocity_opt *opts, int index, char *devname) - { - -+ velocity_set_int_opt(&opts->velo_debug, velo_debug[index], VELO_DEBUG_MIN, VELO_DEBUG_MAX, VELO_DEBUG_DEF, "velo_debug", devname); - velocity_set_int_opt(&opts->rx_thresh, rx_thresh[index], RX_THRESH_MIN, RX_THRESH_MAX, RX_THRESH_DEF, "rx_thresh", devname); - velocity_set_int_opt(&opts->DMA_length, DMA_length[index], DMA_LENGTH_MIN, DMA_LENGTH_MAX, DMA_LENGTH_DEF, "DMA_length", devname); - velocity_set_int_opt(&opts->numrx, RxDescriptors[index], RX_DESC_MIN, RX_DESC_MAX, RX_DESC_DEF, "RxDescriptors", devname); -@@ -452,6 +473,7 @@ static void __devinit velocity_get_optio - velocity_set_int_opt((int *) &opts->wol_opts, wol_opts[index], WOL_OPT_MIN, WOL_OPT_MAX, WOL_OPT_DEF, "Wake On Lan options", devname); - velocity_set_int_opt((int *) &opts->int_works, int_works[index], INT_WORKS_MIN, INT_WORKS_MAX, INT_WORKS_DEF, "Interrupt service works", devname); - opts->numrx = (opts->numrx & ~3); -+ vdebug = opts->velo_debug; - } - - /** -@@ -466,6 +488,8 @@ static void velocity_init_cam_filter(str - { - struct mac_regs __iomem * regs = vptr->mac_regs; - -+ HAIL("velocity_init_cam_filter"); -+ - /* Turn on MCFG_PQEN, turn off MCFG_RTGOPT */ - WORD_REG_BITS_SET(MCFG_PQEN, MCFG_RTGOPT, ®s->MCFG); - WORD_REG_BITS_ON(MCFG_VIDFR, ®s->MCFG); -@@ -484,14 +508,12 @@ static void velocity_init_cam_filter(str - WORD_REG_BITS_ON(MCFG_RTGOPT, ®s->MCFG); - - mac_set_cam(regs, 0, (u8 *) & (vptr->options.vid), VELOCITY_VLAN_ID_CAM); -- vptr->vCAMmask[0] |= 1; -- mac_set_cam_mask(regs, vptr->vCAMmask, VELOCITY_VLAN_ID_CAM); - } else { - u16 temp = 0; - mac_set_cam(regs, 0, (u8 *) &temp, VELOCITY_VLAN_ID_CAM); -- temp = 1; -- mac_set_cam_mask(regs, (u8 *) &temp, VELOCITY_VLAN_ID_CAM); - } -+ vptr->vCAMmask[0] |= 1; -+ mac_set_cam_mask(regs, vptr->vCAMmask, VELOCITY_VLAN_ID_CAM); - } - - /** -@@ -508,13 +530,15 @@ static void velocity_rx_reset(struct vel - struct mac_regs __iomem * regs = vptr->mac_regs; - int i; - -+ HAIL("velocity_rx_reset"); - vptr->rd_dirty = vptr->rd_filled = vptr->rd_curr = 0; - - /* - * Init state, all RD entries belong to the NIC - */ - for (i = 0; i < vptr->options.numrx; ++i) -- vptr->rd_ring[i].rdesc0.owner = OWNED_BY_NIC; -+ /* vptr->rd_ring[i].rdesc0.owner = OWNED_BY_NIC; BE */ -+ vptr->rd_ring[i].rdesc0 |= cpu_to_le32(BE_OWNED_BY_NIC); /* BE */ - - writew(vptr->options.numrx, ®s->RBRDU); - writel(vptr->rd_pool_dma, ®s->RDBaseLo); -@@ -537,12 +561,15 @@ static void velocity_init_registers(stru - struct mac_regs __iomem * regs = vptr->mac_regs; - int i, mii_status; - -+ if (vdebug&5) printk(KERN_NOTICE "velocity_init_registers: entering\n"); -+ - mac_wol_reset(regs); - - switch (type) { - case VELOCITY_INIT_RESET: - case VELOCITY_INIT_WOL: - -+ if (vdebug&4) printk(KERN_NOTICE "velocity_init_registers: RESET or WOL\n"); - netif_stop_queue(vptr->dev); - - /* -@@ -570,12 +597,13 @@ static void velocity_init_registers(stru - - case VELOCITY_INIT_COLD: - default: -+ if (vdebug&4) printk(KERN_NOTICE "velocity_init_registers: COLD or default\n"); - /* - * Do reset - */ - velocity_soft_reset(vptr); -+ if (vdebug&4) printk(KERN_NOTICE "velocity_init_registers: soft reset complete.\n"); - mdelay(5); -- - mac_eeprom_reload(regs); - for (i = 0; i < 6; i++) { - writeb(vptr->dev->dev_addr[i], &(regs->PAR[i])); -@@ -593,11 +621,16 @@ static void velocity_init_registers(stru - */ - BYTE_REG_BITS_SET(CFGB_OFSET, (CFGB_CRANDOM | CFGB_CAP | CFGB_MBA | CFGB_BAKOPT), ®s->CFGB); - -+ if (vdebug&4) printk(KERN_NOTICE "velocity_init_registers: Initializing CAM filter\n"); - /* - * Init CAM filter - */ -+ if (vdebug&8) printk(KERN_NOTICE "velocity: spot debug: about to init CAM filters\n"); -+ mdelay(5); /* MJW - ARM processors, kernel 2.6.19 - this fixes oopses and hangs */ - velocity_init_cam_filter(vptr); -+ if (vdebug&8) printk(KERN_NOTICE "velocity: spot debug: init CAM filters complete\n"); - -+ if (vdebug&4) printk(KERN_NOTICE "velocity_init_registers: Setting packet filter\n"); - /* - * Set packet filter: Receive directed and broadcast address - */ -@@ -607,10 +640,12 @@ static void velocity_init_registers(stru - * Enable MII auto-polling - */ - enable_mii_autopoll(regs); -+ if (vdebug&4) printk(KERN_NOTICE "velocity_init_registers: enable_mii_autopoll complete.\n"); - - vptr->int_mask = INT_MASK_DEF; - -- writel(cpu_to_le32(vptr->rd_pool_dma), ®s->RDBaseLo); -+ /* writel(cpu_to_le32(vptr->rd_pool_dma), ®s->RDBaseLo); BE */ -+ writel((vptr->rd_pool_dma), ®s->RDBaseLo); /* BE */ - writew(vptr->options.numrx - 1, ®s->RDCSize); - mac_rx_queue_run(regs); - mac_rx_queue_wake(regs); -@@ -618,10 +653,13 @@ static void velocity_init_registers(stru - writew(vptr->options.numtx - 1, ®s->TDCSize); - - for (i = 0; i < vptr->num_txq; i++) { -- writel(cpu_to_le32(vptr->td_pool_dma[i]), &(regs->TDBaseLo[i])); -+ /* writel(cpu_to_le32(vptr->td_pool_dma[i]), &(regs->TDBaseLo[i])); BE */ -+ writel((vptr->td_pool_dma[i]), &(regs->TDBaseLo[i])); /* BE */ - mac_tx_queue_run(regs, i); - } - -+ if (vdebug&4) printk(KERN_NOTICE "velocity_init_registers: DMA settings complete.\n"); -+ - init_flow_control_register(vptr); - - writel(CR0_STOP, ®s->CR0Clr); -@@ -640,8 +678,10 @@ static void velocity_init_registers(stru - - enable_flow_control_ability(vptr); - mac_hw_mibs_init(regs); -+ if (vdebug&4) printk(KERN_NOTICE "velocity_init_registers: Set interrupt mask\n"); - mac_write_int_mask(vptr->int_mask, regs); - mac_clear_isr(regs); -+ if (vdebug&4) printk(KERN_NOTICE "velocity_init_registers: complete.\n"); - - } - } -@@ -659,6 +699,7 @@ static int velocity_soft_reset(struct ve - struct mac_regs __iomem * regs = vptr->mac_regs; - int i = 0; - -+ HAIL("velocity_soft_reset"); - writel(CR0_SFRST, ®s->CR0Set); - - for (i = 0; i < W_MAX_TIMEOUT; i++) { -@@ -722,6 +763,7 @@ static int __devinit velocity_found1(str - VELOCITY_FULL_DRV_NAM, VELOCITY_VERSION); - printk(KERN_INFO "Copyright (c) 2002, 2003 VIA Networking Technologies, Inc.\n"); - printk(KERN_INFO "Copyright (c) 2004 Red Hat Inc.\n"); -+ printk(KERN_INFO "BE support, misc. fixes MJW 01Jan2007 - may be unstable\n"); - first = 0; - } - -@@ -935,6 +977,7 @@ static int velocity_init_rings(struct ve - dma_addr_t pool_dma; - u8 *pool; - -+ HAIL("velocity_init_rings"); - /* - * Allocate all RD/TD rings a single pool - */ -@@ -997,6 +1040,7 @@ static int velocity_init_rings(struct ve - static void velocity_free_rings(struct velocity_info *vptr) - { - int size; -+ HAIL("velocity_free_rings"); - - size = vptr->options.numrx * sizeof(struct rx_desc) + - vptr->options.numtx * sizeof(struct tx_desc) * vptr->num_txq; -@@ -1013,6 +1057,7 @@ static inline void velocity_give_many_rx - struct mac_regs __iomem *regs = vptr->mac_regs; - int avail, dirty, unusable; - -+ HAIL("velocity_give_many_rx_descs"); - /* - * RD number must be equal to 4X per hardware spec - * (programming guide rev 1.20, p.13) -@@ -1026,7 +1071,8 @@ static inline void velocity_give_many_rx - dirty = vptr->rd_dirty - unusable; - for (avail = vptr->rd_filled & 0xfffc; avail; avail--) { - dirty = (dirty > 0) ? dirty - 1 : vptr->options.numrx - 1; -- vptr->rd_ring[dirty].rdesc0.owner = OWNED_BY_NIC; -+ /* vptr->rd_ring[dirty].rdesc0.owner = OWNED_BY_NIC; BE */ -+ vptr->rd_ring[dirty].rdesc0 |= cpu_to_le32(BE_OWNED_BY_NIC); /* BE */ - } - - writew(vptr->rd_filled & 0xfffc, ®s->RBRDU); -@@ -1036,12 +1082,14 @@ static inline void velocity_give_many_rx - static int velocity_rx_refill(struct velocity_info *vptr) - { - int dirty = vptr->rd_dirty, done = 0, ret = 0; -+ HAIL("velocity_rx_refill"); - - do { - struct rx_desc *rd = vptr->rd_ring + dirty; - - /* Fine for an all zero Rx desc at init time as well */ -- if (rd->rdesc0.owner == OWNED_BY_NIC) -+ /* if (rd->rdesc0.owner == OWNED_BY_NIC) BE */ -+ if (rd->rdesc0 & cpu_to_le32(BE_OWNED_BY_NIC)) /* BE */ - break; - - if (!vptr->rd_info[dirty].skb) { -@@ -1076,6 +1124,7 @@ static int velocity_init_rd_ring(struct - unsigned int rsize = sizeof(struct velocity_rd_info) * - vptr->options.numrx; - -+ HAIL("velocity_init_rd_ring"); - vptr->rd_info = kmalloc(rsize, GFP_KERNEL); - if(vptr->rd_info == NULL) - goto out; -@@ -1105,6 +1154,7 @@ static void velocity_free_rd_ring(struct - { - int i; - -+ HAIL("velocity_free_rd_ring"); - if (vptr->rd_info == NULL) - return; - -@@ -1146,6 +1196,7 @@ static int velocity_init_td_ring(struct - unsigned int tsize = sizeof(struct velocity_td_info) * - vptr->options.numtx; - -+ HAIL("velocity_init_td_ring"); - /* Init the TD ring entries */ - for (j = 0; j < vptr->num_txq; j++) { - curr = vptr->td_pool_dma[j]; -@@ -1182,6 +1233,7 @@ static void velocity_free_td_ring_entry( - struct velocity_td_info * td_info = &(vptr->td_infos[q][n]); - int i; - -+ HAIL("velocity_free_td_ring_entry"); - if (td_info == NULL) - return; - -@@ -1211,6 +1263,7 @@ static void velocity_free_td_ring(struct - { - int i, j; - -+ HAIL("velocity_free_td_ring"); - for (j = 0; j < vptr->num_txq; j++) { - if (vptr->td_infos[j] == NULL) - continue; -@@ -1238,34 +1291,42 @@ static int velocity_rx_srv(struct veloci - struct net_device_stats *stats = &vptr->stats; - int rd_curr = vptr->rd_curr; - int works = 0; -+ u16 wRSR; /* BE */ - -+ HAILS("velocity_rx_srv", status); - do { - struct rx_desc *rd = vptr->rd_ring + rd_curr; - - if (!vptr->rd_info[rd_curr].skb) - break; - -- if (rd->rdesc0.owner == OWNED_BY_NIC) -+ /* if (rd->rdesc0.owner == OWNED_BY_NIC) BE */ -+ if (rd->rdesc0 & cpu_to_le32(BE_OWNED_BY_NIC)) /* BE */ - break; - - rmb(); - -+ wRSR = (u16)(cpu_to_le32(rd->rdesc0)); /* BE */ - /* - * Don't drop CE or RL error frame although RXOK is off - */ -- if ((rd->rdesc0.RSR & RSR_RXOK) || (!(rd->rdesc0.RSR & RSR_RXOK) && (rd->rdesc0.RSR & (RSR_CE | RSR_RL)))) { -+ /* if ((rd->rdesc0.RSR & RSR_RXOK) || (!(rd->rdesc0.RSR & RSR_RXOK) && (rd->rdesc0.RSR & (RSR_CE | RSR_RL)))) { BE */ -+ if ((wRSR & RSR_RXOK) || (!(wRSR & RSR_RXOK) && (wRSR & (RSR_CE | RSR_RL)))) { /* BE */ - if (velocity_receive_frame(vptr, rd_curr) < 0) - stats->rx_dropped++; - } else { -- if (rd->rdesc0.RSR & RSR_CRC) -+ /* if (rd->rdesc0.RSR & RSR_CRC) BE */ -+ if (wRSR & RSR_CRC) /* BE */ - stats->rx_crc_errors++; -- if (rd->rdesc0.RSR & RSR_FAE) -+ /* if (rd->rdesc0.RSR & RSR_FAE) BE */ -+ if (wRSR & RSR_FAE) /* BE */ - stats->rx_frame_errors++; - - stats->rx_dropped++; - } - -- rd->inten = 1; -+ /* rd->inten = 1; BE */ -+ rd->ltwo |= cpu_to_le32(BE_INT_ENABLE); /* BE */ - - vptr->dev->last_rx = jiffies; - -@@ -1296,13 +1357,21 @@ static int velocity_rx_srv(struct veloci - - static inline void velocity_rx_csum(struct rx_desc *rd, struct sk_buff *skb) - { -+ u8 bCSM; -+ HAIL("velocity_rx_csum"); - skb->ip_summed = CHECKSUM_NONE; - -- if (rd->rdesc1.CSM & CSM_IPKT) { -- if (rd->rdesc1.CSM & CSM_IPOK) { -- if ((rd->rdesc1.CSM & CSM_TCPKT) || -- (rd->rdesc1.CSM & CSM_UDPKT)) { -- if (!(rd->rdesc1.CSM & CSM_TUPOK)) { -+// if (rd->rdesc1.CSM & CSM_IPKT) { -+// if (rd->rdesc1.CSM & CSM_IPOK) { -+// if ((rd->rdesc1.CSM & CSM_TCPKT) || -+// (rd->rdesc1.CSM & CSM_UDPKT)) { -+// if (!(rd->rdesc1.CSM & CSM_TUPOK)) { -+ bCSM = (u8)(cpu_to_le32(rd->rdesc1) >> 16); /* BE */ -+ if (bCSM & CSM_IPKT) { -+ if (bCSM & CSM_IPOK) { -+ if ((bCSM & CSM_TCPKT) || -+ (bCSM & CSM_UDPKT)) { -+ if (!(bCSM & CSM_TUPOK)) { /* BE */ - return; - } - } -@@ -1328,9 +1397,11 @@ static inline int velocity_rx_copy(struc - { - int ret = -1; - -+ HAIL("velocity_rx_copy"); - if (pkt_size < rx_copybreak) { - struct sk_buff *new_skb; - -+ HAIL("velocity_rx_copy (working...)"); - new_skb = dev_alloc_skb(pkt_size + 2); - if (new_skb) { - new_skb->dev = vptr->dev; -@@ -1360,10 +1431,12 @@ static inline int velocity_rx_copy(struc - static inline void velocity_iph_realign(struct velocity_info *vptr, - struct sk_buff *skb, int pkt_size) - { -+ HAIL("velocity_iph_realign"); - /* FIXME - memmove ? */ - if (vptr->flags & VELOCITY_FLAGS_IP_ALIGN) { - int i; - -+ HAIL("velocity_iph_realign (working...)"); - for (i = pkt_size; i >= 0; i--) - *(skb->data + i + 2) = *(skb->data + i); - skb_reserve(skb, 2); -@@ -1382,19 +1455,27 @@ static inline void velocity_iph_realign( - static int velocity_receive_frame(struct velocity_info *vptr, int idx) - { - void (*pci_action)(struct pci_dev *, dma_addr_t, size_t, int); -+ u16 pkt_len; /* BE */ -+ u16 wRSR; /* BE */ -+ struct sk_buff *skb; - struct net_device_stats *stats = &vptr->stats; - struct velocity_rd_info *rd_info = &(vptr->rd_info[idx]); - struct rx_desc *rd = &(vptr->rd_ring[idx]); -- int pkt_len = rd->rdesc0.len; -- struct sk_buff *skb; -+ /* int pkt_len = rd->rdesc0.len BE */; -+ -+ pkt_len = ((cpu_to_le32(rd->rdesc0) >> 16) & 0x00003FFFUL); /* BE */ -+ wRSR = (u16)(cpu_to_le32(rd->rdesc0)); /* BE */ - -- if (rd->rdesc0.RSR & (RSR_STP | RSR_EDP)) { -+ HAIL("velocity_receive_frame"); -+ /* if (rd->rdesc0.RSR & (RSR_STP | RSR_EDP)) { BE */ -+ if (wRSR & (RSR_STP | RSR_EDP)) { /* BE */ - VELOCITY_PRT(MSG_LEVEL_VERBOSE, KERN_ERR " %s : the received frame span multple RDs.\n", vptr->dev->name); - stats->rx_length_errors++; - return -EINVAL; - } - -- if (rd->rdesc0.RSR & RSR_MAR) -+ /* if (rd->rdesc0.RSR & RSR_MAR) BE */ -+ if (wRSR & RSR_MAR) /* BE */ - vptr->stats.multicast++; - - skb = rd_info->skb; -@@ -1408,7 +1489,8 @@ static int velocity_receive_frame(struct - */ - - if (vptr->flags & VELOCITY_FLAGS_VAL_PKT_LEN) { -- if (rd->rdesc0.RSR & RSR_RL) { -+ /* if (rd->rdesc0.RSR & RSR_RL) { BE */ -+ if (wRSR & RSR_RL) { /* BE */ - stats->rx_length_errors++; - return -EINVAL; - } -@@ -1452,6 +1534,7 @@ static int velocity_alloc_rx_buf(struct - struct rx_desc *rd = &(vptr->rd_ring[idx]); - struct velocity_rd_info *rd_info = &(vptr->rd_info[idx]); - -+ HAIL("velocity_alloc_rx_buf"); - rd_info->skb = dev_alloc_skb(vptr->rx_buf_sz + 64); - if (rd_info->skb == NULL) - return -ENOMEM; -@@ -1469,10 +1552,14 @@ static int velocity_alloc_rx_buf(struct - */ - - *((u32 *) & (rd->rdesc0)) = 0; -- rd->len = cpu_to_le32(vptr->rx_buf_sz); -- rd->inten = 1; -+ /* rd->len = cpu_to_le32(vptr->rx_buf_sz); BE */ -+ /* rd->inten = 1; BE */ - rd->pa_low = cpu_to_le32(rd_info->skb_dma); -- rd->pa_high = 0; -+ /* rd->pa_high = 0; BE */ -+ rd->ltwo &= cpu_to_le32(0xC000FFFFUL); /* BE */ -+ rd->ltwo |= cpu_to_le32((vptr->rx_buf_sz << 16)); /* BE */ -+ rd->ltwo |= cpu_to_le32(BE_INT_ENABLE); /* BE */ -+ rd->ltwo &= cpu_to_le32(0xFFFF0000UL); /* BE */ - return 0; - } - -@@ -1493,9 +1580,11 @@ static int velocity_tx_srv(struct veloci - int full = 0; - int idx; - int works = 0; -+ u16 wTSR; /* BE */ - struct velocity_td_info *tdinfo; - struct net_device_stats *stats = &vptr->stats; - -+ HAILS("velocity_tx_srv", status); - for (qnum = 0; qnum < vptr->num_txq; qnum++) { - for (idx = vptr->td_tail[qnum]; vptr->td_used[qnum] > 0; - idx = (idx + 1) % vptr->options.numtx) { -@@ -1506,22 +1595,29 @@ static int velocity_tx_srv(struct veloci - td = &(vptr->td_rings[qnum][idx]); - tdinfo = &(vptr->td_infos[qnum][idx]); - -- if (td->tdesc0.owner == OWNED_BY_NIC) -+ /* if (td->tdesc0.owner == OWNED_BY_NIC) BE */ -+ if (td->tdesc0 & cpu_to_le32(BE_OWNED_BY_NIC)) /* BE */ - break; - - if ((works++ > 15)) - break; - -- if (td->tdesc0.TSR & TSR0_TERR) { -+ wTSR = (u16)cpu_to_le32(td->tdesc0); -+ /* if (td->tdesc0.TSR & TSR0_TERR) { BE */ -+ if (wTSR & TSR0_TERR) { /* BE */ - stats->tx_errors++; - stats->tx_dropped++; -- if (td->tdesc0.TSR & TSR0_CDH) -+ /* if (td->tdesc0.TSR & TSR0_CDH) BE */ -+ if (wTSR & TSR0_CDH) /* BE */ - stats->tx_heartbeat_errors++; -- if (td->tdesc0.TSR & TSR0_CRS) -+ /* if (td->tdesc0.TSR & TSR0_CRS) BE */ -+ if (wTSR & TSR0_CRS) /* BE */ - stats->tx_carrier_errors++; -- if (td->tdesc0.TSR & TSR0_ABT) -+ /* if (td->tdesc0.TSR & TSR0_ABT) BE */ -+ if (wTSR & TSR0_ABT) /* BE */ - stats->tx_aborted_errors++; -- if (td->tdesc0.TSR & TSR0_OWC) -+ /* if (td->tdesc0.TSR & TSR0_OWC) BE */ -+ if (wTSR & TSR0_OWC) /* BE */ - stats->tx_window_errors++; - } else { - stats->tx_packets++; -@@ -1610,6 +1706,7 @@ static void velocity_print_link_status(s - - static void velocity_error(struct velocity_info *vptr, int status) - { -+ HAILS("velocity_error", status); - - if (status & ISR_TXSTLI) { - struct mac_regs __iomem * regs = vptr->mac_regs; -@@ -1699,6 +1796,7 @@ static void velocity_free_tx_buf(struct - struct sk_buff *skb = tdinfo->skb; - int i; - -+ HAIL("velocity_free_tx_buf"); - /* - * Don't unmap the pre-allocated tx_bufs - */ -@@ -1902,6 +2000,7 @@ static int velocity_xmit(struct sk_buff - struct velocity_td_info *tdinfo; - unsigned long flags; - int index; -+ u32 lbufsz; /* BE */ - - int pktlen = skb->len; - -@@ -1918,9 +2017,18 @@ static int velocity_xmit(struct sk_buff - td_ptr = &(vptr->td_rings[qnum][index]); - tdinfo = &(vptr->td_infos[qnum][index]); - -- td_ptr->tdesc1.TCPLS = TCPLS_NORMAL; -- td_ptr->tdesc1.TCR = TCR0_TIC; -- td_ptr->td_buf[0].queue = 0; -+ td_ptr->tdesc0 = 0x00000000UL; /* BE */ -+ td_ptr->tdesc1 = 0x00000000UL; /* BE */ -+ -+ /* td_ptr->tdesc1.TCPLS = TCPLS_NORMAL; BE */ -+ td_ptr->tdesc1 &= cpu_to_le32(0xfcffffffUL); /* BE */ -+ td_ptr->tdesc1 |= cpu_to_le32(((u32)TCPLS_NORMAL) << 24); /* BE */ -+ -+ /* td_ptr->tdesc1.TCR = TCR0_TIC; BE */ -+ td_ptr->tdesc1 |= cpu_to_le32(BE_TCR_TIC); /* BE */ -+ -+ /* td_ptr->td_buf[0].queue = 0; BE */ -+ td_ptr->td_buf[0].ltwo &= cpu_to_le32(~BE_QUEUE_ENABLE); /* BE */ - - /* - * Pad short frames. -@@ -1932,20 +2040,35 @@ static int velocity_xmit(struct sk_buff - memset(tdinfo->buf + skb->len, 0, ETH_ZLEN - skb->len); - tdinfo->skb = skb; - tdinfo->skb_dma[0] = tdinfo->buf_dma; -- td_ptr->tdesc0.pktsize = pktlen; -+ /* td_ptr->tdesc0.pktsize = pktlen; */ -+ td_ptr->tdesc0 &= cpu_to_le32(0xc000ffffUL); /* BE */ -+ lbufsz = pktlen; /* Assign, and make sure it's unsigned 32 bits - BE */ -+ lbufsz = lbufsz << 16; /* BE - shift over */ -+ td_ptr->tdesc0 |= cpu_to_le32(lbufsz); /* BE */ - td_ptr->td_buf[0].pa_low = cpu_to_le32(tdinfo->skb_dma[0]); -- td_ptr->td_buf[0].pa_high = 0; -- td_ptr->td_buf[0].bufsize = td_ptr->tdesc0.pktsize; -+ /* td_ptr->td_buf[0].pa_high = 0; */ -+ /* td_ptr->td_buf[0].bufsize = td_ptr->tdesc0.pktsize; */ -+ td_ptr->td_buf[0].ltwo = cpu_to_le32(lbufsz); /* BE */ - tdinfo->nskb_dma = 1; -- td_ptr->tdesc1.CMDZ = 2; -+ /* td_ptr->tdesc1.CMDZ = 2; */ -+ td_ptr->tdesc1 &= cpu_to_le32(0x0fffffffUL); /* BE */ -+ td_ptr->tdesc1 |= cpu_to_le32(((u32)0x2) << 28); /* BE */ - } else - #ifdef VELOCITY_ZERO_COPY_SUPPORT -+ /* -+ * BE - NOTE on the VELOCITY_ZERO_COPY_SUPPORT: -+ * This block of code has NOT been patched up for BE support, as -+ * it is certainly broken -- if it compiles at all. Since the BE -+ * fixes depend on the broken code, attempts to convert to BE support -+ * would almost certainly confuse more than help. -+ */ - if (skb_shinfo(skb)->nr_frags > 0) { - int nfrags = skb_shinfo(skb)->nr_frags; - tdinfo->skb = skb; - if (nfrags > 6) { - memcpy(tdinfo->buf, skb->data, skb->len); - tdinfo->skb_dma[0] = tdinfo->buf_dma; -+ /* BE: Er, exactly what value are we assigning in this next line? */ - td_ptr->tdesc0.pktsize = - td_ptr->td_buf[0].pa_low = cpu_to_le32(tdinfo->skb_dma[0]); - td_ptr->td_buf[0].pa_high = 0; -@@ -1962,6 +2085,7 @@ static int velocity_xmit(struct sk_buff - /* FIXME: support 48bit DMA later */ - td_ptr->td_buf[i].pa_low = cpu_to_le32(tdinfo->skb_dma); - td_ptr->td_buf[i].pa_high = 0; -+ /* BE: This next line can't be right: */ - td_ptr->td_buf[i].bufsize = skb->len->skb->data_len; - - for (i = 0; i < nfrags; i++) { -@@ -1979,7 +2103,7 @@ static int velocity_xmit(struct sk_buff - } - - } else --#endif -+#endif /* (broken) VELOCITY_ZERO_COPY_SUPPORT */ - { - /* - * Map the linear network buffer into PCI space and -@@ -1987,19 +2111,30 @@ static int velocity_xmit(struct sk_buff - */ - tdinfo->skb = skb; - tdinfo->skb_dma[0] = pci_map_single(vptr->pdev, skb->data, pktlen, PCI_DMA_TODEVICE); -- td_ptr->tdesc0.pktsize = pktlen; -+ /* td_ptr->tdesc0.pktsize = pktlen; BE */ -+ td_ptr->tdesc0 &= cpu_to_le32(0xc000ffffUL); /* BE */ -+ lbufsz = pktlen; /* Assign, and make sure it's unsigned 32 bits - BE */ -+ lbufsz = lbufsz << 16; /* BE */ -+ td_ptr->tdesc0 |= cpu_to_le32(lbufsz); /* BE */ - td_ptr->td_buf[0].pa_low = cpu_to_le32(tdinfo->skb_dma[0]); -- td_ptr->td_buf[0].pa_high = 0; -- td_ptr->td_buf[0].bufsize = td_ptr->tdesc0.pktsize; -+ /* td_ptr->td_buf[0].pa_high = 0; BE */ -+ /* td_ptr->td_buf[0].bufsize = td_ptr->tdesc0.pktsize; BE */ -+ td_ptr->td_buf[0].ltwo = cpu_to_le32(lbufsz); /* BE */ -+ - tdinfo->nskb_dma = 1; -- td_ptr->tdesc1.CMDZ = 2; -+ /* td_ptr->tdesc1.CMDZ = 2; BE */ -+ td_ptr->tdesc1 &= cpu_to_le32(0x0fffffffUL); /* BE */ -+ td_ptr->tdesc1 |= cpu_to_le32(((u32)0x2) << 28);/* BE */ - } - - if (vptr->flags & VELOCITY_FLAGS_TAGGING) { -- td_ptr->tdesc1.pqinf.VID = (vptr->options.vid & 0xfff); -- td_ptr->tdesc1.pqinf.priority = 0; -- td_ptr->tdesc1.pqinf.CFI = 0; -- td_ptr->tdesc1.TCR |= TCR0_VETAG; -+ /* td_ptr->tdesc1.pqinf.priority = 0; BE */ -+ /* td_ptr->tdesc1.pqinf.CFI = 0; BE */ -+ td_ptr->tdesc1 &= cpu_to_le32(0xFFFF0000UL); /* BE */ -+ /* td_ptr->tdesc1.pqinf.VID = (vptr->options.vid & 0xfff); BE */ -+ td_ptr->tdesc1 |= cpu_to_le32((vptr->options.vid & 0xfff)); /* BE */ -+ /* td_ptr->tdesc1.TCR |= TCR0_VETAG; BE */ -+ td_ptr->tdesc1 |= cpu_to_le32(BE_TCR_VETAG); /* BE */ - } - - /* -@@ -2009,26 +2144,34 @@ static int velocity_xmit(struct sk_buff - && (skb->ip_summed == CHECKSUM_PARTIAL)) { - struct iphdr *ip = skb->nh.iph; - if (ip->protocol == IPPROTO_TCP) -- td_ptr->tdesc1.TCR |= TCR0_TCPCK; -+ /* td_ptr->tdesc1.TCR |= TCR0_TCPCK; BE */ -+ td_ptr->tdesc1 |= cpu_to_le32(BE_TCR_TCPCK); /* BE */ - else if (ip->protocol == IPPROTO_UDP) -- td_ptr->tdesc1.TCR |= (TCR0_UDPCK); -- td_ptr->tdesc1.TCR |= TCR0_IPCK; -- } -+ /* td_ptr->tdesc1.TCR |= (TCR0_UDPCK); BE */ -+ td_ptr->tdesc1 |= cpu_to_le32(BE_TCR_UDPCK); /* BE */ -+ /* td_ptr->tdesc1.TCR |= TCR0_IPCK; BE */ -+ td_ptr->tdesc1 |= cpu_to_le32(BE_TCR_IPCK); /* BE */ -+ } - { - - int prev = index - 1; - - if (prev < 0) - prev = vptr->options.numtx - 1; -- td_ptr->tdesc0.owner = OWNED_BY_NIC; -+ /* td_ptr->tdesc0.owner = OWNED_BY_NIC; BE */ -+ td_ptr->tdesc0 |= cpu_to_le32(BE_OWNED_BY_NIC); /* BE */ - vptr->td_used[qnum]++; - vptr->td_curr[qnum] = (index + 1) % vptr->options.numtx; - - if (AVAIL_TD(vptr, qnum) < 1) - netif_stop_queue(dev); - -- td_ptr = &(vptr->td_rings[qnum][prev]); -- td_ptr->td_buf[0].queue = 1; -+ td_ptr = &(vptr->td_rings[qnum][prev]); -+ /* td_ptr->td_buf[0].queue = 1; BE */ -+ td_ptr->td_buf[0].ltwo |= cpu_to_le32(BE_QUEUE_ENABLE); /* BE */ -+ if (vdebug&2) printk(KERN_NOTICE "velocity_xmit: (%s) len=%d idx=%d tdesc0=0x%x tdesc1=0x%x ltwo=0x%x\n", -+ (pktlen<ETH_ZLEN) ? "short" : "normal", pktlen, index, -+ td_ptr->tdesc0, td_ptr->tdesc1, td_ptr->td_buf[0].ltwo); - mac_tx_queue_wake(vptr->mac_regs, qnum); - } - dev->trans_start = jiffies; -@@ -2054,7 +2197,7 @@ static int velocity_intr(int irq, void * - u32 isr_status; - int max_count = 0; - -- -+ HAIL("velocity_intr"); - spin_lock(&vptr->lock); - isr_status = mac_read_isr(vptr->mac_regs); - -@@ -2073,7 +2216,10 @@ static int velocity_intr(int irq, void * - - while (isr_status != 0) { - mac_write_isr(vptr->mac_regs, isr_status); -- if (isr_status & (~(ISR_PRXI | ISR_PPRXI | ISR_PTXI | ISR_PPTXI))) -+ HAILS("velocity_intr",isr_status); -+ /* MJW - velocity_error is ALWAYS called; need to mask off some other flags */ -+ /* if (isr_status & (~(ISR_PRXI | ISR_PPRXI | ISR_PTXI | ISR_PPTXI))) */ -+ if (isr_status & (~(ISR_PRXI | ISR_PPRXI | ISR_PTXI | ISR_PPTXI | ISR_PTX0I | ISR_ISR0))) - velocity_error(vptr, isr_status); - if (isr_status & (ISR_PRXI | ISR_PPRXI)) - max_count += velocity_rx_srv(vptr, isr_status); -@@ -2111,6 +2257,7 @@ static void velocity_set_multi(struct ne - int i; - struct dev_mc_list *mclist; - -+ HAIL("velocity_set_multi"); - if (dev->flags & IFF_PROMISC) { /* Set promiscuous. */ - writel(0xffffffff, ®s->MARCAM[0]); - writel(0xffffffff, ®s->MARCAM[4]); -@@ -2154,6 +2301,7 @@ static struct net_device_stats *velocity - { - struct velocity_info *vptr = netdev_priv(dev); - -+ HAIL("net_device_stats"); - /* If the hardware is down, don't touch MII */ - if(!netif_running(dev)) - return &vptr->stats; -@@ -2198,6 +2346,7 @@ static int velocity_ioctl(struct net_dev - struct velocity_info *vptr = netdev_priv(dev); - int ret; - -+ HAIL("velocity_ioctl"); - /* If we are asked for information and the device is power - saving then we need to bring the device back up to talk to it */ - -@@ -2416,6 +2565,7 @@ static int velocity_mii_read(struct mac_ - { - u16 ww; - -+ HAIL("velocity_mii_read"); - /* - * Disable MIICR_MAUTO, so that mii addr can be set normally - */ -@@ -2452,6 +2602,7 @@ static int velocity_mii_write(struct mac - { - u16 ww; - -+ HAIL("velocity_mii_write"); - /* - * Disable MIICR_MAUTO, so that mii addr can be set normally - */ -Index: linux-2.6.21.7/drivers/net/via-velocity.h -=================================================================== ---- linux-2.6.21.7.orig/drivers/net/via-velocity.h -+++ linux-2.6.21.7/drivers/net/via-velocity.h -@@ -196,64 +196,70 @@ - * Receive descriptor - */ - --struct rdesc0 { -- u16 RSR; /* Receive status */ -- u16 len:14; /* Received packet length */ -- u16 reserved:1; -- u16 owner:1; /* Who owns this buffer ? */ --}; -- --struct rdesc1 { -- u16 PQTAG; -- u8 CSM; -- u8 IPKT; --}; -+//struct rdesc0 { -+// u16 RSR; /* Receive status */ -+// u16 len:14; /* Received packet length */ -+// u16 reserved:1; -+// u16 owner:1; /* Who owns this buffer ? */ -+//}; -+ -+//struct rdesc1 { -+// u16 PQTAG; -+// u8 CSM; -+// u8 IPKT; -+//}; - - struct rx_desc { -- struct rdesc0 rdesc0; -- struct rdesc1 rdesc1; -+// struct rdesc0 rdesc0; -+// struct rdesc1 rdesc1; -+ u32 rdesc0; -+ u32 rdesc1; - u32 pa_low; /* Low 32 bit PCI address */ -- u16 pa_high; /* Next 16 bit PCI address (48 total) */ -- u16 len:15; /* Frame size */ -- u16 inten:1; /* Enable interrupt */ -+// u16 pa_high; /* Next 16 bit PCI address (48 total) */ -+// u16 len:15; /* Frame size */ -+// u16 inten:1; /* Enable interrupt */ -+ u32 ltwo; - } __attribute__ ((__packed__)); - - /* - * Transmit descriptor - */ - --struct tdesc0 { -- u16 TSR; /* Transmit status register */ -- u16 pktsize:14; /* Size of frame */ -- u16 reserved:1; -- u16 owner:1; /* Who owns the buffer */ --}; -- --struct pqinf { /* Priority queue info */ -- u16 VID:12; -- u16 CFI:1; -- u16 priority:3; --} __attribute__ ((__packed__)); -- --struct tdesc1 { -- struct pqinf pqinf; -- u8 TCR; -- u8 TCPLS:2; -- u8 reserved:2; -- u8 CMDZ:4; --} __attribute__ ((__packed__)); -+//struct tdesc0 { -+// u16 TSR; /* Transmit status register */ -+// u16 pktsize:14; /* Size of frame */ -+// u16 reserved:1; -+// u16 owner:1; /* Who owns the buffer */ -+//}; -+ -+//struct pqinf { /* Priority queue info */ -+// u16 VID:12; -+// u16 CFI:1; -+// u16 priority:3; -+//} __attribute__ ((__packed__)); -+ -+//struct tdesc1 { -+// struct pqinf pqinf; -+// u8 TCR; -+// u8 TCPLS:2; -+// u8 reserved:2; -+// u8 CMDZ:4; -+//} __attribute__ ((__packed__)); - - struct td_buf { - u32 pa_low; -- u16 pa_high; -- u16 bufsize:14; -- u16 reserved:1; -- u16 queue:1; -+// u16 pa_high; -+// u16 bufsize:14; -+// u16 reserved:1; -+// u16 queue:1; -+ u32 ltwo; - } __attribute__ ((__packed__)); - - struct tx_desc { -- struct tdesc0 tdesc0; -- struct tdesc1 tdesc1; -+// struct tdesc0 tdesc0; -+// struct tdesc1 tdesc1; -+ u32 tdesc0; -+ u32 tdesc1; - struct td_buf td_buf[7]; - }; - -@@ -279,6 +285,16 @@ enum velocity_owner { - OWNED_BY_NIC = 1 - }; - -+/* Constants added for the BE fixes */ -+#define BE_OWNED_BY_NIC 0x80000000UL -+#define BE_INT_ENABLE 0x80000000UL -+#define BE_QUEUE_ENABLE 0x80000000UL -+#define BE_TCR_TIC 0x00800000UL -+#define BE_TCR_VETAG 0x00200000UL -+#define BE_TCR_TCPCK 0x00040000UL -+#define BE_TCR_UDPCK 0x00080000UL -+#define BE_TCR_IPCK 0x00100000UL -+ - - /* - * MAC registers and macros. -@@ -1698,6 +1714,7 @@ enum velocity_flow_cntl_type { - }; - - struct velocity_opt { -+ int velo_debug; /* debug flag */ - int numrx; /* Number of RX descriptors */ - int numtx; /* Number of TX descriptors */ - enum speed_opt spd_dpx; /* Media link mode */ diff --git a/target/linux/ixp4xx/patches/185-nslu2_rtc_fixup.patch b/target/linux/ixp4xx/patches/185-nslu2_rtc_fixup.patch deleted file mode 100644 index 59d3e702fb..0000000000 --- a/target/linux/ixp4xx/patches/185-nslu2_rtc_fixup.patch +++ /dev/null @@ -1,54 +0,0 @@ -Index: linux-2.6.21.7/arch/arm/mach-ixp4xx/nslu2-setup.c -=================================================================== ---- linux-2.6.21.7.orig/arch/arm/mach-ixp4xx/nslu2-setup.c -+++ linux-2.6.21.7/arch/arm/mach-ixp4xx/nslu2-setup.c -@@ -20,6 +20,7 @@ - #include <linux/leds.h> - #include <linux/mtd/mtd.h> - -+#include <asm/setup.h> - #include <asm/mach-types.h> - #include <asm/mach/arch.h> - #include <asm/mach/flash.h> -@@ -253,11 +254,41 @@ static void __init nslu2_init(void) - register_mtd_user(&nslu2_flash_notifier); - } - -+static char nslu2_rtc_probe[] __initdata = "rtc-x1205.probe=0,0x6f "; -+ -+static void __init nslu2_fixup(struct machine_desc *desc, -+ struct tag *tags, char **cmdline, struct meminfo *mi) -+{ -+ struct tag *t = tags; -+ char *p = *cmdline; -+ -+ /* Find the end of the tags table, taking note of any cmdline tag. */ -+ for (; t->hdr.size; t = tag_next(t)) { -+ if (t->hdr.tag == ATAG_CMDLINE) { -+ p = t->u.cmdline.cmdline; -+ } -+ } -+ -+ /* Overwrite the end of the table with a new cmdline tag. */ -+ t->hdr.tag = ATAG_CMDLINE; -+ t->hdr.size = (sizeof (struct tag_header) + -+ strlen(nslu2_rtc_probe) + strlen(p) + 1 + 4) >> 2; -+ strlcpy(t->u.cmdline.cmdline, nslu2_rtc_probe, COMMAND_LINE_SIZE); -+ strlcpy(t->u.cmdline.cmdline + strlen(nslu2_rtc_probe), p, -+ COMMAND_LINE_SIZE - strlen(nslu2_rtc_probe)); -+ -+ /* Terminate the table. */ -+ t = tag_next(t); -+ t->hdr.tag = ATAG_NONE; -+ t->hdr.size = 0; -+} -+ - MACHINE_START(NSLU2, "Linksys NSLU2") - /* Maintainer: www.nslu2-linux.org */ - .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, - .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xFFFC, - .boot_params = 0x00000100, -+ .fixup = nslu2_fixup, - .map_io = ixp4xx_map_io, - .init_irq = ixp4xx_init_irq, - .timer = &nslu2_timer, diff --git a/target/linux/ixp4xx/patches/186-nas100d_rtc_fixup.patch b/target/linux/ixp4xx/patches/186-nas100d_rtc_fixup.patch deleted file mode 100644 index f15b64f5f4..0000000000 --- a/target/linux/ixp4xx/patches/186-nas100d_rtc_fixup.patch +++ /dev/null @@ -1,55 +0,0 @@ -Index: linux-2.6.21.7/arch/arm/mach-ixp4xx/nas100d-setup.c -=================================================================== ---- linux-2.6.21.7.orig/arch/arm/mach-ixp4xx/nas100d-setup.c -+++ linux-2.6.21.7/arch/arm/mach-ixp4xx/nas100d-setup.c -@@ -18,6 +18,7 @@ - #include <linux/leds.h> - #include <linux/mtd/mtd.h> - -+#include <asm/setup.h> - #include <asm/mach-types.h> - #include <asm/mach/arch.h> - #include <asm/mach/flash.h> -@@ -227,11 +228,42 @@ static void __init nas100d_init(void) - register_mtd_user(&nas100d_flash_notifier); - } - -+static char nas100d_rtc_probe[] __initdata = "rtc-pcf8563.probe=0,0x51 "; -+ -+static void __init nas100d_fixup(struct machine_desc *desc, -+ struct tag *tags, char **cmdline, struct meminfo *mi) -+{ -+ struct tag *t = tags; -+ char *p = *cmdline; -+ -+ /* Find the end of the tags table, taking note of any cmdline tag. */ -+ for (; t->hdr.size; t = tag_next(t)) { -+ if (t->hdr.tag == ATAG_CMDLINE) { -+ p = t->u.cmdline.cmdline; -+ } -+ } -+ -+ /* Overwrite the end of the table with a new cmdline tag. */ -+ t->hdr.tag = ATAG_CMDLINE; -+ t->hdr.size = -+ (sizeof (struct tag_header) + -+ strlen(nas100d_rtc_probe) + strlen(p) + 1 + 4) >> 2; -+ strlcpy(t->u.cmdline.cmdline, nas100d_rtc_probe, COMMAND_LINE_SIZE); -+ strlcpy(t->u.cmdline.cmdline + strlen(nas100d_rtc_probe), p, -+ COMMAND_LINE_SIZE - strlen(nas100d_rtc_probe)); -+ -+ /* Terminate the table. */ -+ t = tag_next(t); -+ t->hdr.tag = ATAG_NONE; -+ t->hdr.size = 0; -+} -+ - MACHINE_START(NAS100D, "Iomega NAS 100d") - /* Maintainer: www.nslu2-linux.org */ - .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, - .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xFFFC, - .boot_params = 0x00000100, -+ .fixup = nas100d_fixup, - .map_io = ixp4xx_map_io, - .init_irq = ixp4xx_init_irq, - .timer = &ixp4xx_timer, diff --git a/target/linux/ixp4xx/patches/187-dsmg600_rtc_fixup.patch b/target/linux/ixp4xx/patches/187-dsmg600_rtc_fixup.patch deleted file mode 100644 index 8993a9e17b..0000000000 --- a/target/linux/ixp4xx/patches/187-dsmg600_rtc_fixup.patch +++ /dev/null @@ -1,57 +0,0 @@ -Index: linux-2.6.21.7/arch/arm/mach-ixp4xx/dsmg600-setup.c -=================================================================== ---- linux-2.6.21.7.orig/arch/arm/mach-ixp4xx/dsmg600-setup.c -+++ linux-2.6.21.7/arch/arm/mach-ixp4xx/dsmg600-setup.c -@@ -15,6 +15,7 @@ - #include <linux/serial.h> - #include <linux/serial_8250.h> - -+#include <asm/setup.h> - #include <asm/mach-types.h> - #include <asm/mach/arch.h> - #include <asm/mach/flash.h> -@@ -142,6 +143,36 @@ static struct sys_timer dsmg600_timer = - .init = dsmg600_timer_init, - }; - -+static char dsmg600_rtc_probe[] __initdata = "rtc-pcf8563.probe=0,0x51 "; -+ -+static void __init dsmg600_fixup(struct machine_desc *desc, -+ struct tag *tags, char **cmdline, struct meminfo *mi) -+{ -+ struct tag *t = tags; -+ char *p = *cmdline; -+ -+ /* Find the end of the tags table, taking note of any cmdline tag. */ -+ for (; t->hdr.size; t = tag_next(t)) { -+ if (t->hdr.tag == ATAG_CMDLINE) { -+ p = t->u.cmdline.cmdline; -+ } -+ } -+ -+ /* Overwrite the end of the table with a new cmdline tag. */ -+ t->hdr.tag = ATAG_CMDLINE; -+ t->hdr.size = -+ (sizeof (struct tag_header) + -+ strlen(dsmg600_rtc_probe) + strlen(p) + 1 + 4) >> 2; -+ strlcpy(t->u.cmdline.cmdline, dsmg600_rtc_probe, COMMAND_LINE_SIZE); -+ strlcpy(t->u.cmdline.cmdline + strlen(dsmg600_rtc_probe), p, -+ COMMAND_LINE_SIZE - strlen(dsmg600_rtc_probe)); -+ -+ /* Terminate the table. */ -+ t = tag_next(t); -+ t->hdr.tag = ATAG_NONE; -+ t->hdr.size = 0; -+} -+ - static void __init dsmg600_init(void) - { - ixp4xx_sys_init(); -@@ -174,6 +205,7 @@ MACHINE_START(DSMG600, "D-Link DSM-G600 - .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, - .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xFFFC, - .boot_params = 0x00000100, -+ .fixup = dsmg600_fixup, - .map_io = ixp4xx_map_io, - .init_irq = ixp4xx_init_irq, - .timer = &dsmg600_timer, diff --git a/target/linux/ixp4xx/patches/200-gateway_7001.patch b/target/linux/ixp4xx/patches/200-gateway_7001.patch deleted file mode 100644 index 509b24a248..0000000000 --- a/target/linux/ixp4xx/patches/200-gateway_7001.patch +++ /dev/null @@ -1,256 +0,0 @@ -Index: linux-2.6.21.7/arch/arm/boot/compressed/head-xscale.S -=================================================================== ---- linux-2.6.21.7.orig/arch/arm/boot/compressed/head-xscale.S -+++ linux-2.6.21.7/arch/arm/boot/compressed/head-xscale.S -@@ -46,6 +46,11 @@ __XScale_start: - orr r7, r7, #(MACH_TYPE_GTWX5715 & 0xff00) - #endif - -+#ifdef CONFIG_MACH_GATEWAY7001 -+ mov r7, #(MACH_TYPE_GATEWAY7001 & 0xff) -+ orr r7, r7, #(MACH_TYPE_GATEWAY7001 & 0xff00) -+#endif -+ - #ifdef CONFIG_ARCH_IXP2000 - mov r1, #-1 - mov r0, #0xd6000000 -Index: linux-2.6.21.7/arch/arm/mach-ixp4xx/gateway7001-pci.c -=================================================================== ---- /dev/null -+++ linux-2.6.21.7/arch/arm/mach-ixp4xx/gateway7001-pci.c -@@ -0,0 +1,68 @@ -+/* -+ * arch/arch/mach-ixp4xx/gateway7001-pci.c -+ * -+ * PCI setup routines for Gateway 7001 -+ * -+ * Copyright (C) 2006 Imre Kaloz <kaloz@openwrt.org> -+ * -+ * based on coyote-pci.c: -+ * Copyright (C) 2002 Jungo Software Technologies. -+ * Copyright (C) 2003 MontaVista Softwrae, Inc. -+ * -+ * Maintainer: Imre Kaloz <kaloz@openwrt.org> -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ * -+ */ -+ -+#include <linux/kernel.h> -+#include <linux/pci.h> -+#include <linux/init.h> -+#include <linux/irq.h> -+ -+#include <asm/mach-types.h> -+#include <asm/hardware.h> -+#include <asm/irq.h> -+ -+#include <asm/mach/pci.h> -+ -+extern void ixp4xx_pci_preinit(void); -+extern int ixp4xx_setup(int nr, struct pci_sys_data *sys); -+extern struct pci_bus *ixp4xx_scan_bus(int nr, struct pci_sys_data *sys); -+ -+void __init gateway7001_pci_preinit(void) -+{ -+ set_irq_type(IRQ_IXP4XX_GPIO10, IRQT_LOW); -+ set_irq_type(IRQ_IXP4XX_GPIO11, IRQT_LOW); -+ -+ ixp4xx_pci_preinit(); -+} -+ -+static int __init gateway7001_map_irq(struct pci_dev *dev, u8 slot, u8 pin) -+{ -+ if (slot == 1) -+ return IRQ_IXP4XX_GPIO11; -+ else if (slot == 2) -+ return IRQ_IXP4XX_GPIO10; -+ else return -1; -+} -+ -+struct hw_pci gateway7001_pci __initdata = { -+ .nr_controllers = 1, -+ .preinit = gateway7001_pci_preinit, -+ .swizzle = pci_std_swizzle, -+ .setup = ixp4xx_setup, -+ .scan = ixp4xx_scan_bus, -+ .map_irq = gateway7001_map_irq, -+}; -+ -+int __init gateway7001_pci_init(void) -+{ -+ if (machine_is_gateway7001()) -+ pci_common_init(&gateway7001_pci); -+ return 0; -+} -+ -+subsys_initcall(gateway7001_pci_init); -Index: linux-2.6.21.7/arch/arm/mach-ixp4xx/gateway7001-setup.c -=================================================================== ---- /dev/null -+++ linux-2.6.21.7/arch/arm/mach-ixp4xx/gateway7001-setup.c -@@ -0,0 +1,108 @@ -+/* -+ * arch/arm/mach-ixp4xx/gateway7001-setup.c -+ * -+ * Board setup for the Gateway 7001 board -+ * -+ * Copyright (C) 2006 Imre Kaloz <Kaloz@openwrt.org> -+ * -+ * based on coyote-setup.c: -+ * Copyright (C) 2003-2005 MontaVista Software, Inc. -+ * -+ * Author: Imre Kaloz <Kaloz@openwrt.org> -+ */ -+ -+#include <linux/kernel.h> -+#include <linux/init.h> -+#include <linux/device.h> -+#include <linux/serial.h> -+#include <linux/tty.h> -+#include <linux/serial_8250.h> -+#include <linux/slab.h> -+ -+#include <asm/types.h> -+#include <asm/setup.h> -+#include <asm/memory.h> -+#include <asm/hardware.h> -+#include <asm/irq.h> -+#include <asm/mach-types.h> -+#include <asm/mach/arch.h> -+#include <asm/mach/flash.h> -+ -+static struct flash_platform_data gateway7001_flash_data = { -+ .map_name = "cfi_probe", -+ .width = 2, -+}; -+ -+static struct resource gateway7001_flash_resource = { -+ .flags = IORESOURCE_MEM, -+}; -+ -+static struct platform_device gateway7001_flash = { -+ .name = "IXP4XX-Flash", -+ .id = 0, -+ .dev = { -+ .platform_data = &gateway7001_flash_data, -+ }, -+ .num_resources = 1, -+ .resource = &gateway7001_flash_resource, -+}; -+ -+static struct resource gateway7001_uart_resource = { -+ .start = IXP4XX_UART2_BASE_PHYS, -+ .end = IXP4XX_UART2_BASE_PHYS + 0x0fff, -+ .flags = IORESOURCE_MEM, -+}; -+ -+static struct plat_serial8250_port gateway7001_uart_data[] = { -+ { -+ .mapbase = IXP4XX_UART2_BASE_PHYS, -+ .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET, -+ .irq = IRQ_IXP4XX_UART2, -+ .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, -+ .iotype = UPIO_MEM, -+ .regshift = 2, -+ .uartclk = IXP4XX_UART_XTAL, -+ }, -+ { }, -+}; -+ -+static struct platform_device gateway7001_uart = { -+ .name = "serial8250", -+ .id = PLAT8250_DEV_PLATFORM, -+ .dev = { -+ .platform_data = gateway7001_uart_data, -+ }, -+ .num_resources = 1, -+ .resource = &gateway7001_uart_resource, -+}; -+ -+static struct platform_device *gateway7001_devices[] __initdata = { -+ &gateway7001_flash, -+ &gateway7001_uart -+}; -+ -+static void __init gateway7001_init(void) -+{ -+ ixp4xx_sys_init(); -+ -+ gateway7001_flash_resource.start = IXP4XX_EXP_BUS_BASE(0); -+ gateway7001_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_32M - 1; -+ -+ *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE; -+ *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0; -+ -+ platform_add_devices(gateway7001_devices, ARRAY_SIZE(gateway7001_devices)); -+} -+ -+#ifdef CONFIG_MACH_GATEWAY7001 -+MACHINE_START(GATEWAY7001, "Gateway 7001 AP") -+ /* Maintainer: Imre Kaloz <kaloz@openwrt.org> */ -+ .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, -+ .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, -+ .map_io = ixp4xx_map_io, -+ .init_irq = ixp4xx_init_irq, -+ .timer = &ixp4xx_timer, -+ .boot_params = 0x0100, -+ .init_machine = gateway7001_init, -+MACHINE_END -+#endif -Index: linux-2.6.21.7/arch/arm/mach-ixp4xx/Kconfig -=================================================================== ---- linux-2.6.21.7.orig/arch/arm/mach-ixp4xx/Kconfig -+++ linux-2.6.21.7/arch/arm/mach-ixp4xx/Kconfig -@@ -41,6 +41,14 @@ config ARCH_ADI_COYOTE - Engineering Coyote Gateway Reference Platform. For more - information on this platform, see <file:Documentation/arm/IXP4xx>. - -+config MACH_GATEWAY7001 -+ bool "Gateway 7001" -+ select PCI -+ help -+ Say 'Y' here if you want your kernel to support Gateway's -+ 7001 Access Point. For more information on this platform, -+ see http://openwrt.org -+ - config ARCH_IXDP425 - bool "IXDP425" - help -Index: linux-2.6.21.7/arch/arm/mach-ixp4xx/Makefile -=================================================================== ---- linux-2.6.21.7.orig/arch/arm/mach-ixp4xx/Makefile -+++ linux-2.6.21.7/arch/arm/mach-ixp4xx/Makefile -@@ -13,6 +13,7 @@ obj-pci-$(CONFIG_MACH_GTWX5715) += gtwx - obj-pci-$(CONFIG_MACH_NSLU2) += nslu2-pci.o - obj-pci-$(CONFIG_MACH_NAS100D) += nas100d-pci.o - obj-pci-$(CONFIG_MACH_DSMG600) += dsmg600-pci.o -+obj-pci-$(CONFIG_MACH_GATEWAY7001) += gateway7001-pci.o - - obj-y += common.o - -@@ -24,5 +25,6 @@ obj-$(CONFIG_MACH_GTWX5715) += gtwx5715- - obj-$(CONFIG_MACH_NSLU2) += nslu2-setup.o nslu2-power.o - obj-$(CONFIG_MACH_NAS100D) += nas100d-setup.o nas100d-power.o - obj-$(CONFIG_MACH_DSMG600) += dsmg600-setup.o dsmg600-power.o -+obj-$(CONFIG_MACH_GATEWAY7001) += gateway7001-setup.o - - obj-$(CONFIG_PCI) += $(obj-pci-$(CONFIG_PCI)) common-pci.o -Index: linux-2.6.21.7/include/asm-arm/arch-ixp4xx/uncompress.h -=================================================================== ---- linux-2.6.21.7.orig/include/asm-arm/arch-ixp4xx/uncompress.h -+++ linux-2.6.21.7/include/asm-arm/arch-ixp4xx/uncompress.h -@@ -38,9 +38,9 @@ static void flush(void) - static __inline__ void __arch_decomp_setup(unsigned long arch_id) - { - /* -- * Coyote and gtwx5715 only have UART2 connected -+ * Some boards are using UART2 as console - */ -- if (machine_is_adi_coyote() || machine_is_gtwx5715()) -+ if (machine_is_adi_coyote() || machine_is_gtwx5715() || machine_is_gateway7001()) - uart_base = (volatile u32*) IXP4XX_UART2_BASE_PHYS; - else - uart_base = (volatile u32*) IXP4XX_UART1_BASE_PHYS; diff --git a/target/linux/ixp4xx/patches/210-gateway_7001_setup_mac.patch b/target/linux/ixp4xx/patches/210-gateway_7001_setup_mac.patch deleted file mode 100644 index fb84d51376..0000000000 --- a/target/linux/ixp4xx/patches/210-gateway_7001_setup_mac.patch +++ /dev/null @@ -1,63 +0,0 @@ -Index: linux-2.6.21.7/arch/arm/mach-ixp4xx/gateway7001-setup.c -=================================================================== ---- linux-2.6.21.7.orig/arch/arm/mach-ixp4xx/gateway7001-setup.c -+++ linux-2.6.21.7/arch/arm/mach-ixp4xx/gateway7001-setup.c -@@ -76,9 +76,57 @@ static struct platform_device gateway700 - .resource = &gateway7001_uart_resource, - }; - -+static struct resource res_mac0 = { -+ .start = IXP4XX_EthB_BASE_PHYS, -+ .end = IXP4XX_EthB_BASE_PHYS + 0x1ff, -+ .flags = IORESOURCE_MEM, -+}; -+ -+static struct resource res_mac1 = { -+ .start = IXP4XX_EthC_BASE_PHYS, -+ .end = IXP4XX_EthC_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, -+ .rxdoneq_id = 4, -+}; -+ -+static struct mac_plat_info plat_mac1 = { -+ .npe_id = 2, -+ .phy_id = 2, -+ .eth_id = 1, -+ .rxq_id = 28, -+ .txq_id = 25, -+ .rxdoneq_id = 5, -+}; -+ -+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 mac1 = { -+ .name = "ixp4xx_mac", -+ .id = 1, -+ .dev.platform_data = &plat_mac1, -+ .num_resources = 1, -+ .resource = &res_mac1, -+}; -+ - static struct platform_device *gateway7001_devices[] __initdata = { - &gateway7001_flash, -- &gateway7001_uart -+ &gateway7001_uart, -+ &mac0, -+ &mac1, - }; - - static void __init gateway7001_init(void) diff --git a/target/linux/ixp4xx/patches/212-gateway_7001_mtd_microcode.patch b/target/linux/ixp4xx/patches/212-gateway_7001_mtd_microcode.patch deleted file mode 100644 index 2e24f6cead..0000000000 --- a/target/linux/ixp4xx/patches/212-gateway_7001_mtd_microcode.patch +++ /dev/null @@ -1,69 +0,0 @@ -Index: linux-2.6.21.7/arch/arm/mach-ixp4xx/gateway7001-setup.c -=================================================================== ---- linux-2.6.21.7.orig/arch/arm/mach-ixp4xx/gateway7001-setup.c -+++ linux-2.6.21.7/arch/arm/mach-ixp4xx/gateway7001-setup.c -@@ -16,6 +16,7 @@ - #include <linux/device.h> - #include <linux/serial.h> - #include <linux/tty.h> -+#include <linux/mtd/mtd.h> - #include <linux/serial_8250.h> - #include <linux/slab.h> - -@@ -122,11 +123,48 @@ static struct platform_device mac1 = { - .resource = &res_mac1, - }; - -+struct npe_ucode_platform_data gateway7001_npe_ucode_data = { -+ .mtd_partition = "microcode", -+}; -+ -+static struct platform_device gateway7001_npe_ucode = { -+ .name = "ixp4xx_npe_ucode", -+ .id = 0, -+ .dev.platform_data = &gateway7001_npe_ucode_data, -+}; -+ - static struct platform_device *gateway7001_devices[] __initdata = { - &gateway7001_flash, - &gateway7001_uart, - &mac0, - &mac1, -+ &gateway7001_npe_ucode, -+}; -+ -+static void gateway7001_flash_add(struct mtd_info *mtd) -+{ -+ if (strcmp(mtd->name, "RedBoot config") == 0) { -+ size_t retlen; -+ u_char mac0[6], mac1[6]; -+ if (mtd->read(mtd, 0x0422, 6, &retlen, mac0) == 0 && retlen == 6) { -+ printk(KERN_INFO "gateway 7001 mac0: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n", -+ mac0[0], mac0[1], mac0[2], mac0[3], mac0[4], mac0[5]); -+ memcpy(plat_mac0.hwaddr, mac0, 6); -+ } -+ if (mtd->read(mtd, 0x043B, 6, &retlen, mac1) == 0 && retlen == 6) { -+ printk(KERN_INFO "gateway 7001 mac1: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n", -+ mac1[0], mac1[1], mac1[2], mac1[3], mac1[4], mac1[5]); -+ memcpy(plat_mac1.hwaddr, mac1, 6); -+ } -+ } -+} -+ -+static void gateway7001_flash_remove(struct mtd_info *mtd) { -+} -+ -+static struct mtd_notifier gateway7001_flash_notifier = { -+ .add = gateway7001_flash_add, -+ .remove = gateway7001_flash_remove, - }; - - static void __init gateway7001_init(void) -@@ -140,6 +178,7 @@ static void __init gateway7001_init(void - *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0; - - platform_add_devices(gateway7001_devices, ARRAY_SIZE(gateway7001_devices)); -+ register_mtd_user(&gateway7001_flash_notifier); - } - - #ifdef CONFIG_MACH_GATEWAY7001 diff --git a/target/linux/ixp4xx/patches/300-wg302v2.patch b/target/linux/ixp4xx/patches/300-wg302v2.patch deleted file mode 100644 index e0f0c21f69..0000000000 --- a/target/linux/ixp4xx/patches/300-wg302v2.patch +++ /dev/null @@ -1,236 +0,0 @@ -Index: linux-2.6.21.7/arch/arm/mach-ixp4xx/Kconfig -=================================================================== ---- linux-2.6.21.7.orig/arch/arm/mach-ixp4xx/Kconfig -+++ linux-2.6.21.7/arch/arm/mach-ixp4xx/Kconfig -@@ -49,6 +49,14 @@ config MACH_GATEWAY7001 - 7001 Access Point. For more information on this platform, - see http://openwrt.org - -+config MACH_WG302V2 -+ bool "Netgear WG302 v2 / WAG302 v2" -+ select PCI -+ help -+ Say 'Y' here if you want your kernel to support Netgear's -+ WG302 v2 or WAG302 v2 Access Points. For more information -+ on this platform, see http://openwrt.org -+ - config ARCH_IXDP425 - bool "IXDP425" - help -Index: linux-2.6.21.7/arch/arm/mach-ixp4xx/Makefile -=================================================================== ---- linux-2.6.21.7.orig/arch/arm/mach-ixp4xx/Makefile -+++ linux-2.6.21.7/arch/arm/mach-ixp4xx/Makefile -@@ -14,6 +14,7 @@ obj-pci-$(CONFIG_MACH_NSLU2) += nslu2-p - obj-pci-$(CONFIG_MACH_NAS100D) += nas100d-pci.o - obj-pci-$(CONFIG_MACH_DSMG600) += dsmg600-pci.o - obj-pci-$(CONFIG_MACH_GATEWAY7001) += gateway7001-pci.o -+obj-pci-$(CONFIG_MACH_WG302V2) += wg302v2-pci.o - - obj-y += common.o - -@@ -26,5 +27,6 @@ obj-$(CONFIG_MACH_NSLU2) += nslu2-setup. - obj-$(CONFIG_MACH_NAS100D) += nas100d-setup.o nas100d-power.o - obj-$(CONFIG_MACH_DSMG600) += dsmg600-setup.o dsmg600-power.o - obj-$(CONFIG_MACH_GATEWAY7001) += gateway7001-setup.o -+obj-$(CONFIG_MACH_WG302V2) += wg302v2-setup.o - - obj-$(CONFIG_PCI) += $(obj-pci-$(CONFIG_PCI)) common-pci.o -Index: linux-2.6.21.7/arch/arm/mach-ixp4xx/wg302v2-pci.c -=================================================================== ---- /dev/null -+++ linux-2.6.21.7/arch/arm/mach-ixp4xx/wg302v2-pci.c -@@ -0,0 +1,68 @@ -+/* -+ * arch/arch/mach-ixp4xx/wg302v2-pci.c -+ * -+ * PCI setup routines for the Netgear WG302 v2 and WAG302 v2 -+ * -+ * Copyright (C) 2006 Imre Kaloz <kaloz@openwrt.org> -+ * -+ * based on coyote-pci.c: -+ * Copyright (C) 2002 Jungo Software Technologies. -+ * Copyright (C) 2003 MontaVista Software, Inc. -+ * -+ * Maintainer: Imre Kaloz <kaloz@openwrt.org> -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ * -+ */ -+ -+#include <linux/kernel.h> -+#include <linux/pci.h> -+#include <linux/init.h> -+#include <linux/irq.h> -+ -+#include <asm/mach-types.h> -+#include <asm/hardware.h> -+#include <asm/irq.h> -+ -+#include <asm/mach/pci.h> -+ -+extern void ixp4xx_pci_preinit(void); -+extern int ixp4xx_setup(int nr, struct pci_sys_data *sys); -+extern struct pci_bus *ixp4xx_scan_bus(int nr, struct pci_sys_data *sys); -+ -+void __init wg302v2_pci_preinit(void) -+{ -+ set_irq_type(IRQ_IXP4XX_GPIO8, IRQT_LOW); -+ set_irq_type(IRQ_IXP4XX_GPIO9, IRQT_LOW); -+ -+ ixp4xx_pci_preinit(); -+} -+ -+static int __init wg302v2_map_irq(struct pci_dev *dev, u8 slot, u8 pin) -+{ -+ if (slot == 1) -+ return IRQ_IXP4XX_GPIO8; -+ else if (slot == 2) -+ return IRQ_IXP4XX_GPIO9; -+ else return -1; -+} -+ -+struct hw_pci wg302v2_pci __initdata = { -+ .nr_controllers = 1, -+ .preinit = wg302v2_pci_preinit, -+ .swizzle = pci_std_swizzle, -+ .setup = ixp4xx_setup, -+ .scan = ixp4xx_scan_bus, -+ .map_irq = wg302v2_map_irq, -+}; -+ -+int __init wg302v2_pci_init(void) -+{ -+ if (machine_is_wg302v2()) -+ pci_common_init(&wg302v2_pci); -+ return 0; -+} -+ -+subsys_initcall(wg302v2_pci_init); -Index: linux-2.6.21.7/arch/arm/mach-ixp4xx/wg302v2-setup.c -=================================================================== ---- /dev/null -+++ linux-2.6.21.7/arch/arm/mach-ixp4xx/wg302v2-setup.c -@@ -0,0 +1,107 @@ -+/* -+ * arch/arm/mach-ixp4xx/wg302-setup.c -+ * -+ * Board setup for the Netgear WG302 v2 and WAG302 v2 -+ * -+ * based on coyote-setup.c: -+ * Copyright (C) 2003-2005 MontaVista Software, Inc. -+ * -+ * Maintainer: Imre Kaloz <kaloz@openwrt.org> -+ * -+ */ -+ -+#include <linux/kernel.h> -+#include <linux/init.h> -+#include <linux/device.h> -+#include <linux/serial.h> -+#include <linux/tty.h> -+#include <linux/serial_8250.h> -+#include <linux/slab.h> -+ -+#include <asm/types.h> -+#include <asm/setup.h> -+#include <asm/memory.h> -+#include <asm/hardware.h> -+#include <asm/irq.h> -+#include <asm/mach-types.h> -+#include <asm/mach/arch.h> -+#include <asm/mach/flash.h> -+ -+static struct flash_platform_data wg302v2_flash_data = { -+ .map_name = "cfi_probe", -+ .width = 2, -+}; -+ -+static struct resource wg302v2_flash_resource = { -+ .flags = IORESOURCE_MEM, -+}; -+ -+static struct platform_device wg302v2_flash = { -+ .name = "IXP4XX-Flash", -+ .id = 0, -+ .dev = { -+ .platform_data = &wg302v2_flash_data, -+ }, -+ .num_resources = 1, -+ .resource = &wg302v2_flash_resource, -+}; -+ -+static struct resource wg302v2_uart_resource = { -+ .start = IXP4XX_UART2_BASE_PHYS, -+ .end = IXP4XX_UART2_BASE_PHYS + 0x0fff, -+ .flags = IORESOURCE_MEM, -+}; -+ -+static struct plat_serial8250_port wg302v2_uart_data[] = { -+ { -+ .mapbase = IXP4XX_UART2_BASE_PHYS, -+ .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET, -+ .irq = IRQ_IXP4XX_UART2, -+ .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, -+ .iotype = UPIO_MEM, -+ .regshift = 2, -+ .uartclk = IXP4XX_UART_XTAL, -+ }, -+ { }, -+}; -+ -+static struct platform_device wg302v2_uart = { -+ .name = "serial8250", -+ .id = PLAT8250_DEV_PLATFORM, -+ .dev = { -+ .platform_data = wg302v2_uart_data, -+ }, -+ .num_resources = 1, -+ .resource = &wg302v2_uart_resource, -+}; -+ -+static struct platform_device *wg302v2_devices[] __initdata = { -+ &wg302v2_flash, -+ &wg302v2_uart, -+}; -+ -+static void __init wg302v2_init(void) -+{ -+ ixp4xx_sys_init(); -+ -+ wg302v2_flash_resource.start = IXP4XX_EXP_BUS_BASE(0); -+ wg302v2_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_32M - 1; -+ -+ *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE; -+ *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0; -+ -+ platform_add_devices(wg302v2_devices, ARRAY_SIZE(wg302v2_devices)); -+} -+ -+#ifdef CONFIG_MACH_WG302V2 -+MACHINE_START(WG302V2, "Netgear WG302 v2 / WAG302 v2") -+ /* Maintainer: Imre Kaloz <kaloz@openwrt.org> */ -+ .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, -+ .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, -+ .map_io = ixp4xx_map_io, -+ .init_irq = ixp4xx_init_irq, -+ .timer = &ixp4xx_timer, -+ .boot_params = 0x0100, -+ .init_machine = wg302v2_init, -+MACHINE_END -+#endif -Index: linux-2.6.21.7/include/asm-arm/arch-ixp4xx/uncompress.h -=================================================================== ---- linux-2.6.21.7.orig/include/asm-arm/arch-ixp4xx/uncompress.h -+++ linux-2.6.21.7/include/asm-arm/arch-ixp4xx/uncompress.h -@@ -40,7 +40,7 @@ static __inline__ void __arch_decomp_set - /* - * Some boards are using UART2 as console - */ -- if (machine_is_adi_coyote() || machine_is_gtwx5715() || machine_is_gateway7001()) -+ if (machine_is_adi_coyote() || machine_is_gtwx5715() || machine_is_gateway7001() || machine_is_wg302v2()) - uart_base = (volatile u32*) IXP4XX_UART2_BASE_PHYS; - else - uart_base = (volatile u32*) IXP4XX_UART1_BASE_PHYS; diff --git a/target/linux/ixp4xx/patches/310-wg302v2_setup_mac.patch b/target/linux/ixp4xx/patches/310-wg302v2_setup_mac.patch deleted file mode 100644 index c12c5fe771..0000000000 --- a/target/linux/ixp4xx/patches/310-wg302v2_setup_mac.patch +++ /dev/null @@ -1,38 +0,0 @@ -Index: linux-2.6.21.7/arch/arm/mach-ixp4xx/wg302v2-setup.c -=================================================================== ---- linux-2.6.21.7.orig/arch/arm/mach-ixp4xx/wg302v2-setup.c -+++ linux-2.6.21.7/arch/arm/mach-ixp4xx/wg302v2-setup.c -@@ -75,9 +75,33 @@ static struct platform_device wg302v2_ua - .resource = &wg302v2_uart_resource, - }; - -+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 = 8, -+ .eth_id = 0, -+ .rxq_id = 27, -+ .txq_id = 24, -+ .rxdoneq_id = 4, -+}; -+ -+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 *wg302v2_devices[] __initdata = { - &wg302v2_flash, - &wg302v2_uart, -+ &mac0, - }; - - static void __init wg302v2_init(void) diff --git a/target/linux/ixp4xx/patches/400-pronghorn_metro.patch b/target/linux/ixp4xx/patches/400-pronghorn_metro.patch deleted file mode 100644 index 035ccf6bd1..0000000000 --- a/target/linux/ixp4xx/patches/400-pronghorn_metro.patch +++ /dev/null @@ -1,257 +0,0 @@ -Index: linux-2.6.21.7/Documentation/arm/IXP4xx -=================================================================== ---- linux-2.6.21.7.orig/Documentation/arm/IXP4xx -+++ linux-2.6.21.7/Documentation/arm/IXP4xx -@@ -111,6 +111,9 @@ http://www.adiengineering.com/productsCo - the platform has two mini-PCI slots used for 802.11[bga] cards. - Finally, there is an IDE port hanging off the expansion bus. - -+ADI Engineering Pronghorn Metro Platform -+http://www.adiengineering.com/php-bin/ecomm4/productDisplay.php?category_id=30&product_id=85 -+ - Gateworks Avila Network Platform - http://www.gateworks.com/avila_sbc.htm - -Index: linux-2.6.21.7/arch/arm/mach-ixp4xx/Kconfig -=================================================================== ---- linux-2.6.21.7.orig/arch/arm/mach-ixp4xx/Kconfig -+++ linux-2.6.21.7/arch/arm/mach-ixp4xx/Kconfig -@@ -57,6 +57,14 @@ config MACH_WG302V2 - WG302 v2 or WAG302 v2 Access Points. For more information - on this platform, see http://openwrt.org - -+config MACH_PRONGHORNMETRO -+ bool "Pronghorn Metro" -+ select PCI -+ help -+ Say 'Y' here if you want your kernel to support the ADI -+ Engineering Pronghorn Metro Platform. For more -+ information on this platform, see <file:Documentation/arm/IXP4xx>. -+ - config ARCH_IXDP425 - bool "IXDP425" - help -Index: linux-2.6.21.7/arch/arm/mach-ixp4xx/Makefile -=================================================================== ---- linux-2.6.21.7.orig/arch/arm/mach-ixp4xx/Makefile -+++ linux-2.6.21.7/arch/arm/mach-ixp4xx/Makefile -@@ -15,6 +15,7 @@ obj-pci-$(CONFIG_MACH_NAS100D) += nas10 - obj-pci-$(CONFIG_MACH_DSMG600) += dsmg600-pci.o - obj-pci-$(CONFIG_MACH_GATEWAY7001) += gateway7001-pci.o - obj-pci-$(CONFIG_MACH_WG302V2) += wg302v2-pci.o -+obj-pci-$(CONFIG_MACH_PRONGHORNMETRO) += pronghornmetro-pci.o - - obj-y += common.o - -@@ -28,5 +29,6 @@ obj-$(CONFIG_MACH_NAS100D) += nas100d-se - obj-$(CONFIG_MACH_DSMG600) += dsmg600-setup.o dsmg600-power.o - obj-$(CONFIG_MACH_GATEWAY7001) += gateway7001-setup.o - obj-$(CONFIG_MACH_WG302V2) += wg302v2-setup.o -+obj-$(CONFIG_MACH_PRONGHORNMETRO) += pronghornmetro-setup.o - - obj-$(CONFIG_PCI) += $(obj-pci-$(CONFIG_PCI)) common-pci.o -Index: linux-2.6.21.7/arch/arm/mach-ixp4xx/pronghornmetro-pci.c -=================================================================== ---- /dev/null -+++ linux-2.6.21.7/arch/arm/mach-ixp4xx/pronghornmetro-pci.c -@@ -0,0 +1,74 @@ -+/* -+ * arch/arch/mach-ixp4xx/pronghornmetro-pci.c -+ * -+ * PCI setup routines for ADI Engineering Pronghorn Metro -+ * -+ * Copyright (C) 2007 Imre Kaloz <kaloz@openwrt.org> -+ * -+ * based on coyote-pci.c: -+ * Copyright (C) 2002 Jungo Software Technologies. -+ * Copyright (C) 2003 MontaVista Softwrae, Inc. -+ * -+ * Maintainer: Imre Kaloz <kaloz@openwrt.org> -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ * -+ */ -+ -+#include <linux/kernel.h> -+#include <linux/pci.h> -+#include <linux/init.h> -+#include <linux/irq.h> -+ -+#include <asm/mach-types.h> -+#include <asm/hardware.h> -+#include <asm/irq.h> -+ -+#include <asm/mach/pci.h> -+ -+extern void ixp4xx_pci_preinit(void); -+extern int ixp4xx_setup(int nr, struct pci_sys_data *sys); -+extern struct pci_bus *ixp4xx_scan_bus(int nr, struct pci_sys_data *sys); -+ -+void __init pronghornmetro_pci_preinit(void) -+{ -+ set_irq_type(IRQ_IXP4XX_GPIO4, IRQT_LOW); -+ set_irq_type(IRQ_IXP4XX_GPIO6, IRQT_LOW); -+ set_irq_type(IRQ_IXP4XX_GPIO11, IRQT_LOW); -+ set_irq_type(IRQ_IXP4XX_GPIO1, IRQT_LOW); -+ -+ ixp4xx_pci_preinit(); -+} -+ -+static int __init pronghornmetro_map_irq(struct pci_dev *dev, u8 slot, u8 pin) -+{ -+ if (slot == 13) -+ return IRQ_IXP4XX_GPIO4; -+ else if (slot == 14) -+ return IRQ_IXP4XX_GPIO6; -+ else if (slot == 15) -+ return IRQ_IXP4XX_GPIO11; -+ else if (slot == 16) -+ return IRQ_IXP4XX_GPIO1; -+ else return -1; -+} -+ -+struct hw_pci pronghornmetro_pci __initdata = { -+ .nr_controllers = 1, -+ .preinit = pronghornmetro_pci_preinit, -+ .swizzle = pci_std_swizzle, -+ .setup = ixp4xx_setup, -+ .scan = ixp4xx_scan_bus, -+ .map_irq = pronghornmetro_map_irq, -+}; -+ -+int __init pronghornmetro_pci_init(void) -+{ -+ if (machine_is_pronghorn_metro()) -+ pci_common_init(&pronghornmetro_pci); -+ return 0; -+} -+ -+subsys_initcall(pronghornmetro_pci_init); -Index: linux-2.6.21.7/arch/arm/mach-ixp4xx/pronghornmetro-setup.c -=================================================================== ---- /dev/null -+++ linux-2.6.21.7/arch/arm/mach-ixp4xx/pronghornmetro-setup.c -@@ -0,0 +1,108 @@ -+/* -+ * arch/arm/mach-ixp4xx/pronghornmetro-setup.c -+ * -+ * Board setup for the ADI Engineering Pronghorn Metro -+ * -+ * Copyright (C) 2007 Imre Kaloz <Kaloz@openwrt.org> -+ * -+ * based on coyote-setup.c: -+ * Copyright (C) 2003-2005 MontaVista Software, Inc. -+ * -+ * Author: Imre Kaloz <Kaloz@openwrt.org> -+ */ -+ -+#include <linux/kernel.h> -+#include <linux/init.h> -+#include <linux/device.h> -+#include <linux/serial.h> -+#include <linux/tty.h> -+#include <linux/serial_8250.h> -+#include <linux/slab.h> -+ -+#include <asm/types.h> -+#include <asm/setup.h> -+#include <asm/memory.h> -+#include <asm/hardware.h> -+#include <asm/irq.h> -+#include <asm/mach-types.h> -+#include <asm/mach/arch.h> -+#include <asm/mach/flash.h> -+ -+static struct flash_platform_data pronghornmetro_flash_data = { -+ .map_name = "cfi_probe", -+ .width = 2, -+}; -+ -+static struct resource pronghornmetro_flash_resource = { -+ .flags = IORESOURCE_MEM, -+}; -+ -+static struct platform_device pronghornmetro_flash = { -+ .name = "IXP4XX-Flash", -+ .id = 0, -+ .dev = { -+ .platform_data = &pronghornmetro_flash_data, -+ }, -+ .num_resources = 1, -+ .resource = &pronghornmetro_flash_resource, -+}; -+ -+static struct resource pronghornmetro_uart_resource = { -+ .start = IXP4XX_UART2_BASE_PHYS, -+ .end = IXP4XX_UART2_BASE_PHYS + 0x0fff, -+ .flags = IORESOURCE_MEM, -+}; -+ -+static struct plat_serial8250_port pronghornmetro_uart_data[] = { -+ { -+ .mapbase = IXP4XX_UART2_BASE_PHYS, -+ .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET, -+ .irq = IRQ_IXP4XX_UART2, -+ .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, -+ .iotype = UPIO_MEM, -+ .regshift = 2, -+ .uartclk = IXP4XX_UART_XTAL, -+ }, -+ { }, -+}; -+ -+static struct platform_device pronghornmetro_uart = { -+ .name = "serial8250", -+ .id = PLAT8250_DEV_PLATFORM, -+ .dev = { -+ .platform_data = pronghornmetro_uart_data, -+ }, -+ .num_resources = 1, -+ .resource = &pronghornmetro_uart_resource, -+}; -+ -+static struct platform_device *pronghornmetro_devices[] __initdata = { -+ &pronghornmetro_flash, -+ &pronghornmetro_uart, -+}; -+ -+static void __init pronghornmetro_init(void) -+{ -+ ixp4xx_sys_init(); -+ -+ pronghornmetro_flash_resource.start = IXP4XX_EXP_BUS_BASE(0); -+ pronghornmetro_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_16M - 1; -+ -+ *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE; -+ *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0; -+ -+ platform_add_devices(pronghornmetro_devices, ARRAY_SIZE(pronghornmetro_devices)); -+} -+ -+#ifdef CONFIG_MACH_PRONGHORNMETRO -+MACHINE_START(PRONGHORNMETRO, "ADI Engineering Pronghorn Metro") -+ /* Maintainer: Imre Kaloz <kaloz@openwrt.org> */ -+ .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, -+ .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, -+ .map_io = ixp4xx_map_io, -+ .init_irq = ixp4xx_init_irq, -+ .timer = &ixp4xx_timer, -+ .boot_params = 0x0100, -+ .init_machine = pronghornmetro_init, -+MACHINE_END -+#endif -Index: linux-2.6.21.7/include/asm-arm/arch-ixp4xx/uncompress.h -=================================================================== ---- linux-2.6.21.7.orig/include/asm-arm/arch-ixp4xx/uncompress.h -+++ linux-2.6.21.7/include/asm-arm/arch-ixp4xx/uncompress.h -@@ -40,7 +40,7 @@ static __inline__ void __arch_decomp_set - /* - * Some boards are using UART2 as console - */ -- if (machine_is_adi_coyote() || machine_is_gtwx5715() || machine_is_gateway7001() || machine_is_wg302v2()) -+ if (machine_is_adi_coyote() || machine_is_gtwx5715() || machine_is_gateway7001() || machine_is_wg302v2() || machine_is_pronghorn_metro()) - uart_base = (volatile u32*) IXP4XX_UART2_BASE_PHYS; - else - uart_base = (volatile u32*) IXP4XX_UART1_BASE_PHYS; diff --git a/target/linux/ixp4xx/patches/410-pronghorn_metro_setup_mac.patch b/target/linux/ixp4xx/patches/410-pronghorn_metro_setup_mac.patch deleted file mode 100644 index 146baa464c..0000000000 --- a/target/linux/ixp4xx/patches/410-pronghorn_metro_setup_mac.patch +++ /dev/null @@ -1,62 +0,0 @@ -Index: linux-2.6.21.7/arch/arm/mach-ixp4xx/pronghornmetro-setup.c -=================================================================== ---- linux-2.6.21.7.orig/arch/arm/mach-ixp4xx/pronghornmetro-setup.c -+++ linux-2.6.21.7/arch/arm/mach-ixp4xx/pronghornmetro-setup.c -@@ -76,9 +76,57 @@ static struct platform_device pronghornm - .resource = &pronghornmetro_uart_resource, - }; - -+static struct resource res_mac0 = { -+ .start = IXP4XX_EthB_BASE_PHYS, -+ .end = IXP4XX_EthB_BASE_PHYS + 0x1ff, -+ .flags = IORESOURCE_MEM, -+}; -+ -+static struct resource res_mac1 = { -+ .start = IXP4XX_EthC_BASE_PHYS, -+ .end = IXP4XX_EthC_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, -+ .rxdoneq_id = 4, -+}; -+ -+static struct mac_plat_info plat_mac1 = { -+ .npe_id = 2, -+ .phy_id = 1, -+ .eth_id = 1, -+ .rxq_id = 28, -+ .txq_id = 25, -+ .rxdoneq_id = 5, -+}; -+ -+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 mac1 = { -+ .name = "ixp4xx_mac", -+ .id = 1, -+ .dev.platform_data = &plat_mac1, -+ .num_resources = 1, -+ .resource = &res_mac1, -+}; -+ - static struct platform_device *pronghornmetro_devices[] __initdata = { - &pronghornmetro_flash, - &pronghornmetro_uart, -+ &mac0, -+ &mac1, - }; - - static void __init pronghornmetro_init(void) diff --git a/target/linux/ixp4xx/patches/420-pronghorn_metro_mtd_microcode.patch b/target/linux/ixp4xx/patches/420-pronghorn_metro_mtd_microcode.patch deleted file mode 100644 index 1308fc1e05..0000000000 --- a/target/linux/ixp4xx/patches/420-pronghorn_metro_mtd_microcode.patch +++ /dev/null @@ -1,56 +0,0 @@ -Index: linux-2.6.21.7/arch/arm/mach-ixp4xx/pronghornmetro-setup.c -=================================================================== ---- linux-2.6.21.7.orig/arch/arm/mach-ixp4xx/pronghornmetro-setup.c -+++ linux-2.6.21.7/arch/arm/mach-ixp4xx/pronghornmetro-setup.c -@@ -17,6 +17,7 @@ - #include <linux/serial.h> - #include <linux/tty.h> - #include <linux/serial_8250.h> -+#include <linux/mtd/mtd.h> - #include <linux/slab.h> - - #include <asm/types.h> -@@ -122,11 +123,34 @@ static struct platform_device mac1 = { - .resource = &res_mac1, - }; - -+struct npe_ucode_platform_data pronghornmetro_npe_ucode_data = { -+ .mtd_partition = "RedBoot", -+}; -+ -+static struct platform_device pronghornmetro_npe_ucode = { -+ .name = "ixp4xx_npe_ucode", -+ .id = 0, -+ .dev.platform_data = &pronghornmetro_npe_ucode_data, -+}; -+ - static struct platform_device *pronghornmetro_devices[] __initdata = { - &pronghornmetro_flash, - &pronghornmetro_uart, - &mac0, - &mac1, -+ &pronghornmetro_npe_ucode, -+}; -+ -+static void pronghornmetro_flash_add(struct mtd_info *mtd) -+{ -+} -+ -+static void pronghornmetro_flash_remove(struct mtd_info *mtd) { -+} -+ -+static struct mtd_notifier pronghornmetro_flash_notifier = { -+ .add = pronghornmetro_flash_add, -+ .remove = pronghornmetro_flash_remove, - }; - - static void __init pronghornmetro_init(void) -@@ -140,6 +164,8 @@ static void __init pronghornmetro_init(v - *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0; - - platform_add_devices(pronghornmetro_devices, ARRAY_SIZE(pronghornmetro_devices)); -+ -+ register_mtd_user(&pronghornmetro_flash_notifier); - } - - #ifdef CONFIG_MACH_PRONGHORNMETRO diff --git a/target/linux/ixp4xx/patches/430-pronghorn_metro_cf.patch b/target/linux/ixp4xx/patches/430-pronghorn_metro_cf.patch deleted file mode 100644 index be5e7a5f98..0000000000 --- a/target/linux/ixp4xx/patches/430-pronghorn_metro_cf.patch +++ /dev/null @@ -1,58 +0,0 @@ -Index: linux-2.6.21.7/arch/arm/mach-ixp4xx/pronghornmetro-setup.c -=================================================================== ---- linux-2.6.21.7.orig/arch/arm/mach-ixp4xx/pronghornmetro-setup.c -+++ linux-2.6.21.7/arch/arm/mach-ixp4xx/pronghornmetro-setup.c -@@ -77,6 +77,35 @@ static struct platform_device pronghornm - .resource = &pronghornmetro_uart_resource, - }; - -+static struct resource pronghornmetro_pata_resources[] = { -+ { -+ .flags = IORESOURCE_MEM -+ }, -+ { -+ .flags = IORESOURCE_MEM, -+ }, -+ { -+ .name = "intrq", -+ .start = IRQ_IXP4XX_GPIO0, -+ .end = IRQ_IXP4XX_GPIO0, -+ .flags = IORESOURCE_IRQ, -+ }, -+}; -+ -+static struct ixp4xx_pata_data pronghornmetro_pata_data = { -+ .cs0_bits = 0xbfff0043, -+ .cs1_bits = 0xbfff0043, -+}; -+ -+static struct platform_device pronghornmetro_pata = { -+ .name = "pata_ixp4xx_cf", -+ .id = 0, -+ .dev.platform_data = &pronghornmetro_pata_data, -+ .num_resources = ARRAY_SIZE(pronghornmetro_pata_resources), -+ .resource = pronghornmetro_pata_resources, -+}; -+ -+ - static struct resource res_mac0 = { - .start = IXP4XX_EthB_BASE_PHYS, - .end = IXP4XX_EthB_BASE_PHYS + 0x1ff, -@@ -165,6 +194,17 @@ static void __init pronghornmetro_init(v - - platform_add_devices(pronghornmetro_devices, ARRAY_SIZE(pronghornmetro_devices)); - -+ pronghornmetro_pata_resources[0].start = IXP4XX_EXP_BUS_BASE(1); -+ pronghornmetro_pata_resources[0].end = IXP4XX_EXP_BUS_END(1); -+ -+ pronghornmetro_pata_resources[1].start = IXP4XX_EXP_BUS_BASE(2); -+ pronghornmetro_pata_resources[1].end = IXP4XX_EXP_BUS_END(2); -+ -+ pronghornmetro_pata_data.cs0_cfg = IXP4XX_EXP_CS1; -+ pronghornmetro_pata_data.cs1_cfg = IXP4XX_EXP_CS2; -+ -+ platform_device_register(&pronghornmetro_pata); -+ - register_mtd_user(&pronghornmetro_flash_notifier); - } - diff --git a/target/linux/ixp4xx/patches/500-compex.patch b/target/linux/ixp4xx/patches/500-compex.patch deleted file mode 100644 index 284a892a51..0000000000 --- a/target/linux/ixp4xx/patches/500-compex.patch +++ /dev/null @@ -1,189 +0,0 @@ -Index: linux-2.6.21.7/arch/arm/mach-ixp4xx/compex-setup.c -=================================================================== ---- /dev/null -+++ linux-2.6.21.7/arch/arm/mach-ixp4xx/compex-setup.c -@@ -0,0 +1,120 @@ -+/* -+ * arch/arm/mach-ixp4xx/compex-setup.c -+ * -+ * Ccompex WP18 / NP18A board-setup -+ * -+ * Copyright (C) 2007 Imre Kaloz <Kaloz@openwrt.org> -+ * -+ * based on ixdp425-setup.c: -+ * Copyright (C) 2003-2005 MontaVista Software, Inc. -+ * -+ * Author: Imre Kaloz <Kaloz@openwrt.org> -+ */ -+ -+#include <linux/kernel.h> -+#include <linux/init.h> -+#include <linux/device.h> -+#include <linux/serial.h> -+#include <linux/tty.h> -+#include <linux/serial_8250.h> -+#include <linux/slab.h> -+ -+#include <asm/types.h> -+#include <asm/setup.h> -+#include <asm/memory.h> -+#include <asm/hardware.h> -+#include <asm/mach-types.h> -+#include <asm/irq.h> -+#include <asm/mach/arch.h> -+#include <asm/mach/flash.h> -+ -+static struct flash_platform_data compex_flash_data = { -+ .map_name = "cfi_probe", -+ .width = 2, -+}; -+ -+static struct resource compex_flash_resource = { -+ .flags = IORESOURCE_MEM, -+}; -+ -+static struct platform_device compex_flash = { -+ .name = "IXP4XX-Flash", -+ .id = 0, -+ .dev = { -+ .platform_data = &compex_flash_data, -+ }, -+ .num_resources = 1, -+ .resource = &compex_flash_resource, -+}; -+ -+static struct resource compex_uart_resources[] = { -+ { -+ .start = IXP4XX_UART1_BASE_PHYS, -+ .end = IXP4XX_UART1_BASE_PHYS + 0x0fff, -+ .flags = IORESOURCE_MEM -+ }, -+ { -+ .start = IXP4XX_UART2_BASE_PHYS, -+ .end = IXP4XX_UART2_BASE_PHYS + 0x0fff, -+ .flags = IORESOURCE_MEM -+ } -+}; -+ -+static struct plat_serial8250_port compex_uart_data[] = { -+ { -+ .mapbase = IXP4XX_UART1_BASE_PHYS, -+ .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET, -+ .irq = IRQ_IXP4XX_UART1, -+ .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, -+ .iotype = UPIO_MEM, -+ .regshift = 2, -+ .uartclk = IXP4XX_UART_XTAL, -+ }, -+ { -+ .mapbase = IXP4XX_UART2_BASE_PHYS, -+ .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET, -+ .irq = IRQ_IXP4XX_UART2, -+ .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, -+ .iotype = UPIO_MEM, -+ .regshift = 2, -+ .uartclk = IXP4XX_UART_XTAL, -+ }, -+ { }, -+}; -+ -+static struct platform_device compex_uart = { -+ .name = "serial8250", -+ .id = PLAT8250_DEV_PLATFORM, -+ .dev.platform_data = compex_uart_data, -+ .num_resources = 2, -+ .resource = compex_uart_resources -+}; -+ -+static struct platform_device *compex_devices[] __initdata = { -+ &compex_flash, -+ &compex_uart -+}; -+ -+static void __init compex_init(void) -+{ -+ ixp4xx_sys_init(); -+ -+ compex_flash_resource.start = IXP4XX_EXP_BUS_BASE(0); -+ compex_flash_resource.end = -+ IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1; -+ -+ platform_add_devices(compex_devices, ARRAY_SIZE(compex_devices)); -+} -+ -+#ifdef CONFIG_MACH_COMPEX -+MACHINE_START(COMPEX, "Compex WP18 / NP18A") -+ /* Maintainer: Imre Kaloz <Kaloz@openwrt.org> */ -+ .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, -+ .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, -+ .map_io = ixp4xx_map_io, -+ .init_irq = ixp4xx_init_irq, -+ .timer = &ixp4xx_timer, -+ .boot_params = 0x0100, -+ .init_machine = compex_init, -+MACHINE_END -+#endif -Index: linux-2.6.21.7/arch/arm/mach-ixp4xx/ixdp425-pci.c -=================================================================== ---- linux-2.6.21.7.orig/arch/arm/mach-ixp4xx/ixdp425-pci.c -+++ linux-2.6.21.7/arch/arm/mach-ixp4xx/ixdp425-pci.c -@@ -66,7 +66,7 @@ struct hw_pci ixdp425_pci __initdata = { - int __init ixdp425_pci_init(void) - { - if (machine_is_ixdp425() || machine_is_ixcdp1100() || -- machine_is_ixdp465()) -+ machine_is_ixdp465() || machine_is_compex()) - pci_common_init(&ixdp425_pci); - return 0; - } -Index: linux-2.6.21.7/arch/arm/mach-ixp4xx/Kconfig -=================================================================== ---- linux-2.6.21.7.orig/arch/arm/mach-ixp4xx/Kconfig -+++ linux-2.6.21.7/arch/arm/mach-ixp4xx/Kconfig -@@ -65,6 +65,14 @@ config MACH_PRONGHORNMETRO - Engineering Pronghorn Metro Platform. For more - information on this platform, see <file:Documentation/arm/IXP4xx>. - -+config MACH_COMPEX -+ bool "Compex WP18 / NP18A" -+ select PCI -+ help -+ Say 'Y' here if you want your kernel to support Compex' -+ WP18 or NP18A boards. For more information on this -+ platform, see http://openwrt.org -+ - config ARCH_IXDP425 - bool "IXDP425" - help -Index: linux-2.6.21.7/arch/arm/mach-ixp4xx/Makefile -=================================================================== ---- linux-2.6.21.7.orig/arch/arm/mach-ixp4xx/Makefile -+++ linux-2.6.21.7/arch/arm/mach-ixp4xx/Makefile -@@ -16,6 +16,7 @@ obj-pci-$(CONFIG_MACH_DSMG600) += dsmg6 - obj-pci-$(CONFIG_MACH_GATEWAY7001) += gateway7001-pci.o - obj-pci-$(CONFIG_MACH_WG302V2) += wg302v2-pci.o - obj-pci-$(CONFIG_MACH_PRONGHORNMETRO) += pronghornmetro-pci.o -+obj-pci-$(CONFIG_MACH_COMPEX) += ixdp425-pci.o - - obj-y += common.o - -@@ -30,5 +31,6 @@ obj-$(CONFIG_MACH_DSMG600) += dsmg6 - obj-$(CONFIG_MACH_GATEWAY7001) += gateway7001-setup.o - obj-$(CONFIG_MACH_WG302V2) += wg302v2-setup.o - obj-$(CONFIG_MACH_PRONGHORNMETRO) += pronghornmetro-setup.o -+obj-$(CONFIG_MACH_COMPEX) += compex-setup.o - - obj-$(CONFIG_PCI) += $(obj-pci-$(CONFIG_PCI)) common-pci.o -Index: linux-2.6.21.7/arch/arm/tools/mach-types -=================================================================== ---- linux-2.6.21.7.orig/arch/arm/tools/mach-types -+++ linux-2.6.21.7/arch/arm/tools/mach-types -@@ -1278,7 +1278,7 @@ oiab MACH_OIAB OIAB 1269 - smdk6400 MACH_SMDK6400 SMDK6400 1270 - nokia_n800 MACH_NOKIA_N800 NOKIA_N800 1271 - greenphone MACH_GREENPHONE GREENPHONE 1272 --compex42x MACH_COMPEXWP18 COMPEXWP18 1273 -+compex MACH_COMPEX COMPEX 1273 - xmate MACH_XMATE XMATE 1274 - energizer MACH_ENERGIZER ENERGIZER 1275 - ime1 MACH_IME1 IME1 1276 diff --git a/target/linux/ixp4xx/patches/510-compex_setup_mac.patch b/target/linux/ixp4xx/patches/510-compex_setup_mac.patch deleted file mode 100644 index d8f73852b8..0000000000 --- a/target/linux/ixp4xx/patches/510-compex_setup_mac.patch +++ /dev/null @@ -1,63 +0,0 @@ -Index: linux-2.6.21.7/arch/arm/mach-ixp4xx/compex-setup.c -=================================================================== ---- linux-2.6.21.7.orig/arch/arm/mach-ixp4xx/compex-setup.c -+++ linux-2.6.21.7/arch/arm/mach-ixp4xx/compex-setup.c -@@ -90,9 +90,57 @@ static struct platform_device compex_uar - .resource = compex_uart_resources - }; - -+static struct resource res_mac0 = { -+ .start = IXP4XX_EthB_BASE_PHYS, -+ .end = IXP4XX_EthB_BASE_PHYS + 0x1ff, -+ .flags = IORESOURCE_MEM, -+}; -+ -+static struct resource res_mac1 = { -+ .start = IXP4XX_EthC_BASE_PHYS, -+ .end = IXP4XX_EthC_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, -+ .rxdoneq_id = 4, -+}; -+ -+static struct mac_plat_info plat_mac1 = { -+ .npe_id = 2, -+ .phy_id = 3, -+ .eth_id = 1, -+ .rxq_id = 28, -+ .txq_id = 25, -+ .rxdoneq_id = 5, -+}; -+ -+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 mac1 = { -+ .name = "ixp4xx_mac", -+ .id = 1, -+ .dev.platform_data = &plat_mac1, -+ .num_resources = 1, -+ .resource = &res_mac1, -+}; -+ - static struct platform_device *compex_devices[] __initdata = { - &compex_flash, -- &compex_uart -+ &compex_uart, -+ &mac0, -+ &mac1, - }; - - static void __init compex_init(void) diff --git a/target/linux/ixp4xx/patches/520-compex_mtd_microcode.patch b/target/linux/ixp4xx/patches/520-compex_mtd_microcode.patch deleted file mode 100644 index c330ed1908..0000000000 --- a/target/linux/ixp4xx/patches/520-compex_mtd_microcode.patch +++ /dev/null @@ -1,56 +0,0 @@ -Index: linux-2.6.21.7/arch/arm/mach-ixp4xx/compex-setup.c -=================================================================== ---- linux-2.6.21.7.orig/arch/arm/mach-ixp4xx/compex-setup.c -+++ linux-2.6.21.7/arch/arm/mach-ixp4xx/compex-setup.c -@@ -17,6 +17,7 @@ - #include <linux/serial.h> - #include <linux/tty.h> - #include <linux/serial_8250.h> -+#include <linux/mtd/mtd.h> - #include <linux/slab.h> - - #include <asm/types.h> -@@ -136,11 +137,34 @@ static struct platform_device mac1 = { - .resource = &res_mac1, - }; - -+struct npe_ucode_platform_data compex_npe_ucode_data = { -+ .mtd_partition = "RedBoot", -+}; -+ -+static struct platform_device compex_npe_ucode = { -+ .name = "ixp4xx_npe_ucode", -+ .id = 0, -+ .dev.platform_data = &compex_npe_ucode_data, -+}; -+ - static struct platform_device *compex_devices[] __initdata = { - &compex_flash, - &compex_uart, - &mac0, - &mac1, -+ &compex_npe_ucode, -+}; -+ -+static void compex_flash_add(struct mtd_info *mtd) -+{ -+} -+ -+static void compex_flash_remove(struct mtd_info *mtd) { -+} -+ -+static struct mtd_notifier compex_flash_notifier = { -+ .add = compex_flash_add, -+ .remove = compex_flash_remove, - }; - - static void __init compex_init(void) -@@ -152,6 +176,8 @@ static void __init compex_init(void) - IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1; - - platform_add_devices(compex_devices, ARRAY_SIZE(compex_devices)); -+ -+ register_mtd_user(&compex_flash_notifier); - } - - #ifdef CONFIG_MACH_COMPEX diff --git a/target/linux/ixp4xx/patches/600-wrt300nv2.patch b/target/linux/ixp4xx/patches/600-wrt300nv2.patch deleted file mode 100644 index 39e1dd0b9e..0000000000 --- a/target/linux/ixp4xx/patches/600-wrt300nv2.patch +++ /dev/null @@ -1,234 +0,0 @@ -Index: linux-2.6.21.7/arch/arm/mach-ixp4xx/Kconfig -=================================================================== ---- linux-2.6.21.7.orig/arch/arm/mach-ixp4xx/Kconfig -+++ linux-2.6.21.7/arch/arm/mach-ixp4xx/Kconfig -@@ -73,6 +73,14 @@ config MACH_COMPEX - WP18 or NP18A boards. For more information on this - platform, see http://openwrt.org - -+config MACH_WRT300NV2 -+ bool "Linksys WRT300N v2" -+ select PCI -+ help -+ Say 'Y' here if you want your kernel to support Linksys' -+ WRT300N v2 router. For more information on this -+ platform, see http://openwrt.org -+ - config ARCH_IXDP425 - bool "IXDP425" - help -Index: linux-2.6.21.7/arch/arm/mach-ixp4xx/Makefile -=================================================================== ---- linux-2.6.21.7.orig/arch/arm/mach-ixp4xx/Makefile -+++ linux-2.6.21.7/arch/arm/mach-ixp4xx/Makefile -@@ -17,6 +17,7 @@ obj-pci-$(CONFIG_MACH_GATEWAY7001) += ga - obj-pci-$(CONFIG_MACH_WG302V2) += wg302v2-pci.o - obj-pci-$(CONFIG_MACH_PRONGHORNMETRO) += pronghornmetro-pci.o - obj-pci-$(CONFIG_MACH_COMPEX) += ixdp425-pci.o -+obj-pci-$(CONFIG_MACH_WRT300NV2) += wrt300nv2-pci.o - - obj-y += common.o - -@@ -32,5 +33,6 @@ obj-$(CONFIG_MACH_GATEWAY7001) += gatewa - obj-$(CONFIG_MACH_WG302V2) += wg302v2-setup.o - obj-$(CONFIG_MACH_PRONGHORNMETRO) += pronghornmetro-setup.o - obj-$(CONFIG_MACH_COMPEX) += compex-setup.o -+obj-$(CONFIG_MACH_WRT300NV2) += wrt300nv2-setup.o - - obj-$(CONFIG_PCI) += $(obj-pci-$(CONFIG_PCI)) common-pci.o -Index: linux-2.6.21.7/arch/arm/mach-ixp4xx/wrt300nv2-pci.c -=================================================================== ---- /dev/null -+++ linux-2.6.21.7/arch/arm/mach-ixp4xx/wrt300nv2-pci.c -@@ -0,0 +1,65 @@ -+/* -+ * arch/arch/mach-ixp4xx/wrt300nv2-pci.c -+ * -+ * PCI setup routines for Linksys WRT300N v2 -+ * -+ * Copyright (C) 2007 Imre Kaloz <kaloz@openwrt.org> -+ * -+ * based on coyote-pci.c: -+ * Copyright (C) 2002 Jungo Software Technologies. -+ * Copyright (C) 2003 MontaVista Softwrae, Inc. -+ * -+ * Maintainer: Imre Kaloz <kaloz@openwrt.org> -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ * -+ */ -+ -+#include <linux/kernel.h> -+#include <linux/pci.h> -+#include <linux/init.h> -+#include <linux/irq.h> -+ -+#include <asm/mach-types.h> -+#include <asm/hardware.h> -+#include <asm/irq.h> -+ -+#include <asm/mach/pci.h> -+ -+extern void ixp4xx_pci_preinit(void); -+extern int ixp4xx_setup(int nr, struct pci_sys_data *sys); -+extern struct pci_bus *ixp4xx_scan_bus(int nr, struct pci_sys_data *sys); -+ -+void __init wrt300nv2_pci_preinit(void) -+{ -+ set_irq_type(IRQ_IXP4XX_GPIO8, IRQT_LOW); -+ -+ ixp4xx_pci_preinit(); -+} -+ -+static int __init wrt300nv2_map_irq(struct pci_dev *dev, u8 slot, u8 pin) -+{ -+ if (slot == 1) -+ return IRQ_IXP4XX_GPIO8; -+ else return -1; -+} -+ -+struct hw_pci wrt300nv2_pci __initdata = { -+ .nr_controllers = 1, -+ .preinit = wrt300nv2_pci_preinit, -+ .swizzle = pci_std_swizzle, -+ .setup = ixp4xx_setup, -+ .scan = ixp4xx_scan_bus, -+ .map_irq = wrt300nv2_map_irq, -+}; -+ -+int __init wrt300nv2_pci_init(void) -+{ -+ if (machine_is_wrt300nv2()) -+ pci_common_init(&wrt300nv2_pci); -+ return 0; -+} -+ -+subsys_initcall(wrt300nv2_pci_init); -Index: linux-2.6.21.7/arch/arm/mach-ixp4xx/wrt300nv2-setup.c -=================================================================== ---- /dev/null -+++ linux-2.6.21.7/arch/arm/mach-ixp4xx/wrt300nv2-setup.c -@@ -0,0 +1,108 @@ -+/* -+ * arch/arm/mach-ixp4xx/wrt300nv2-setup.c -+ * -+ * Board setup for the Linksys WRT300N v2 -+ * -+ * Copyright (C) 2007 Imre Kaloz <Kaloz@openwrt.org> -+ * -+ * based on coyote-setup.c: -+ * Copyright (C) 2003-2005 MontaVista Software, Inc. -+ * -+ * Author: Imre Kaloz <Kaloz@openwrt.org> -+ */ -+ -+#include <linux/kernel.h> -+#include <linux/init.h> -+#include <linux/device.h> -+#include <linux/serial.h> -+#include <linux/tty.h> -+#include <linux/serial_8250.h> -+#include <linux/slab.h> -+ -+#include <asm/types.h> -+#include <asm/setup.h> -+#include <asm/memory.h> -+#include <asm/hardware.h> -+#include <asm/irq.h> -+#include <asm/mach-types.h> -+#include <asm/mach/arch.h> -+#include <asm/mach/flash.h> -+ -+static struct flash_platform_data wrt300nv2_flash_data = { -+ .map_name = "cfi_probe", -+ .width = 2, -+}; -+ -+static struct resource wrt300nv2_flash_resource = { -+ .flags = IORESOURCE_MEM, -+}; -+ -+static struct platform_device wrt300nv2_flash = { -+ .name = "IXP4XX-Flash", -+ .id = 0, -+ .dev = { -+ .platform_data = &wrt300nv2_flash_data, -+ }, -+ .num_resources = 1, -+ .resource = &wrt300nv2_flash_resource, -+}; -+ -+static struct resource wrt300nv2_uart_resource = { -+ .start = IXP4XX_UART2_BASE_PHYS, -+ .end = IXP4XX_UART2_BASE_PHYS + 0x0fff, -+ .flags = IORESOURCE_MEM, -+}; -+ -+static struct plat_serial8250_port wrt300nv2_uart_data[] = { -+ { -+ .mapbase = IXP4XX_UART2_BASE_PHYS, -+ .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET, -+ .irq = IRQ_IXP4XX_UART2, -+ .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, -+ .iotype = UPIO_MEM, -+ .regshift = 2, -+ .uartclk = IXP4XX_UART_XTAL, -+ }, -+ { }, -+}; -+ -+static struct platform_device wrt300nv2_uart = { -+ .name = "serial8250", -+ .id = PLAT8250_DEV_PLATFORM, -+ .dev = { -+ .platform_data = wrt300nv2_uart_data, -+ }, -+ .num_resources = 1, -+ .resource = &wrt300nv2_uart_resource, -+}; -+ -+static struct platform_device *wrt300nv2_devices[] __initdata = { -+ &wrt300nv2_flash, -+ &wrt300nv2_uart -+}; -+ -+static void __init wrt300nv2_init(void) -+{ -+ ixp4xx_sys_init(); -+ -+ wrt300nv2_flash_resource.start = IXP4XX_EXP_BUS_BASE(0); -+ wrt300nv2_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_32M - 1; -+ -+ *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE; -+ *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0; -+ -+ platform_add_devices(wrt300nv2_devices, ARRAY_SIZE(wrt300nv2_devices)); -+} -+ -+#ifdef CONFIG_MACH_WRT300NV2 -+MACHINE_START(WRT300NV2, "Linksys WRT300N v2") -+ /* Maintainer: Imre Kaloz <kaloz@openwrt.org> */ -+ .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, -+ .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, -+ .map_io = ixp4xx_map_io, -+ .init_irq = ixp4xx_init_irq, -+ .timer = &ixp4xx_timer, -+ .boot_params = 0x0100, -+ .init_machine = wrt300nv2_init, -+MACHINE_END -+#endif -Index: linux-2.6.21.7/include/asm-arm/arch-ixp4xx/uncompress.h -=================================================================== ---- linux-2.6.21.7.orig/include/asm-arm/arch-ixp4xx/uncompress.h -+++ linux-2.6.21.7/include/asm-arm/arch-ixp4xx/uncompress.h -@@ -40,7 +40,7 @@ static __inline__ void __arch_decomp_set - /* - * Some boards are using UART2 as console - */ -- if (machine_is_adi_coyote() || machine_is_gtwx5715() || machine_is_gateway7001() || machine_is_wg302v2() || machine_is_pronghorn_metro()) -+ if (machine_is_adi_coyote() || machine_is_gtwx5715() || machine_is_gateway7001() || machine_is_wg302v2() || machine_is_pronghorn_metro() || machine_is_wrt300nv2()) - uart_base = (volatile u32*) IXP4XX_UART2_BASE_PHYS; - else - uart_base = (volatile u32*) IXP4XX_UART1_BASE_PHYS; diff --git a/target/linux/ixp4xx/patches/610-wrt300nv2_setup_mac.patch b/target/linux/ixp4xx/patches/610-wrt300nv2_setup_mac.patch deleted file mode 100644 index bbc76072ce..0000000000 --- a/target/linux/ixp4xx/patches/610-wrt300nv2_setup_mac.patch +++ /dev/null @@ -1,63 +0,0 @@ -Index: linux-2.6.21.7/arch/arm/mach-ixp4xx/wrt300nv2-setup.c -=================================================================== ---- linux-2.6.21.7.orig/arch/arm/mach-ixp4xx/wrt300nv2-setup.c -+++ linux-2.6.21.7/arch/arm/mach-ixp4xx/wrt300nv2-setup.c -@@ -76,9 +76,57 @@ static struct platform_device wrt300nv2_ - .resource = &wrt300nv2_uart_resource, - }; - -+static struct resource res_mac0 = { -+ .start = IXP4XX_EthB_BASE_PHYS, -+ .end = IXP4XX_EthB_BASE_PHYS + 0x1ff, -+ .flags = IORESOURCE_MEM, -+}; -+ -+static struct resource res_mac1 = { -+ .start = IXP4XX_EthC_BASE_PHYS, -+ .end = IXP4XX_EthC_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, -+ .rxdoneq_id = 4, -+}; -+ -+static struct mac_plat_info plat_mac1 = { -+ .npe_id = 2, -+ .phy_id = 1, -+ .eth_id = 1, -+ .rxq_id = 28, -+ .txq_id = 25, -+ .rxdoneq_id = 5, -+}; -+ -+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 mac1 = { -+ .name = "ixp4xx_mac", -+ .id = 1, -+ .dev.platform_data = &plat_mac1, -+ .num_resources = 1, -+ .resource = &res_mac1, -+}; -+ - static struct platform_device *wrt300nv2_devices[] __initdata = { - &wrt300nv2_flash, -- &wrt300nv2_uart -+ &wrt300nv2_uart, -+ &mac0, -+ &mac1, - }; - - static void __init wrt300nv2_init(void) diff --git a/target/linux/ixp4xx/patches/720-avila_setup_mac.patch b/target/linux/ixp4xx/patches/720-avila_setup_mac.patch deleted file mode 100644 index 66270f0735..0000000000 --- a/target/linux/ixp4xx/patches/720-avila_setup_mac.patch +++ /dev/null @@ -1,70 +0,0 @@ ---- - arch/arm/mach-ixp4xx/avila-setup.c | 50 ++++++++++++++++++++++++++++++++++++- - 1 file changed, 49 insertions(+), 1 deletion(-) - -Index: linux-2.6.21.7/arch/arm/mach-ixp4xx/avila-setup.c -=================================================================== ---- linux-2.6.21.7.orig/arch/arm/mach-ixp4xx/avila-setup.c -+++ linux-2.6.21.7/arch/arm/mach-ixp4xx/avila-setup.c -@@ -132,10 +132,60 @@ static struct platform_device avila_pata - .resource = avila_pata_resources, - }; - -+/* MACs */ -+static struct resource res_mac0 = { -+ .start = IXP4XX_EthB_BASE_PHYS, -+ .end = IXP4XX_EthB_BASE_PHYS + 0x1ff, -+ .flags = IORESOURCE_MEM, -+}; -+ -+static struct resource res_mac1 = { -+ .start = IXP4XX_EthC_BASE_PHYS, -+ .end = IXP4XX_EthC_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, -+ .rxdoneq_id = 4, -+}; -+ -+static struct mac_plat_info plat_mac1 = { -+ .npe_id = 2, -+ .phy_id = 1, -+ .eth_id = 1, -+ .rxq_id = 28, -+ .txq_id = 25, -+ .rxdoneq_id = 5, -+}; -+ -+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 mac1 = { -+ .name = "ixp4xx_mac", -+ .id = 1, -+ .dev.platform_data = &plat_mac1, -+ .num_resources = 1, -+ .resource = &res_mac1, -+}; -+ - static struct platform_device *avila_devices[] __initdata = { - &avila_i2c_controller, - &avila_flash, -- &avila_uart -+ &avila_uart, -+ &mac0, -+ &mac1, -+ - }; - - static void __init avila_init(void) diff --git a/target/linux/ixp4xx/patches/740-avila_loft_mac_platform.patch b/target/linux/ixp4xx/patches/740-avila_loft_mac_platform.patch deleted file mode 100644 index 87d0892ec8..0000000000 --- a/target/linux/ixp4xx/patches/740-avila_loft_mac_platform.patch +++ /dev/null @@ -1,50 +0,0 @@ -Index: linux-2.6.21.7/arch/arm/mach-ixp4xx/avila-setup.c -=================================================================== ---- linux-2.6.21.7.orig/arch/arm/mach-ixp4xx/avila-setup.c -+++ linux-2.6.21.7/arch/arm/mach-ixp4xx/avila-setup.c -@@ -18,6 +18,10 @@ - #include <linux/tty.h> - #include <linux/serial_8250.h> - #include <linux/slab.h> -+#ifdef CONFIG_SENSORS_EEPROM -+#include <linux/i2c.h> -+#include <linux/eeprom.h> -+#endif - - #include <asm/types.h> - #include <asm/setup.h> -@@ -188,9 +192,34 @@ static struct platform_device *avila_dev - - }; - -+#ifdef CONFIG_SENSORS_EEPROM -+static int loft_eeprom_do(struct notifier_block *self, unsigned long event, void *t) -+{ -+ struct eeprom_data *data = t; -+ -+ char macs[12]; -+ -+ /* The MACs are the first 12 bytes in the eeprom at address 0x51 */ -+ if (event == EEPROM_REGISTER && data->client.addr == 0x51) { -+ data->attr->read(&data->client.dev.kobj, macs, 0, 12); -+ memcpy(&plat_mac0.hwaddr, macs, 6); -+ memcpy(&plat_mac1.hwaddr, macs + 6, 6); -+ } -+ -+ return NOTIFY_DONE; -+} -+ -+static struct notifier_block loft_eeprom_notifier = { -+ .notifier_call = loft_eeprom_do -+}; -+#endif -+ - static void __init avila_init(void) - { - ixp4xx_sys_init(); -+#ifdef CONFIG_SENSORS_EEPROM -+ register_eeprom_notifier(&loft_eeprom_notifier); -+#endif - - avila_flash_resource.start = IXP4XX_EXP_BUS_BASE(0); - avila_flash_resource.end = diff --git a/target/linux/ixp4xx/patches/750-avila_mtd_microcode.patch b/target/linux/ixp4xx/patches/750-avila_mtd_microcode.patch deleted file mode 100644 index 2973a22835..0000000000 --- a/target/linux/ixp4xx/patches/750-avila_mtd_microcode.patch +++ /dev/null @@ -1,29 +0,0 @@ -Index: linux-2.6.21.7/arch/arm/mach-ixp4xx/avila-setup.c -=================================================================== ---- linux-2.6.21.7.orig/arch/arm/mach-ixp4xx/avila-setup.c -+++ linux-2.6.21.7/arch/arm/mach-ixp4xx/avila-setup.c -@@ -183,13 +183,23 @@ static struct platform_device mac1 = { - .resource = &res_mac1, - }; - -+struct npe_ucode_platform_data avila_npe_ucode_data = { -+ .mtd_partition = "RedBoot", -+}; -+ -+static struct platform_device avila_npe_ucode = { -+ .name = "ixp4xx_npe_ucode", -+ .id = 0, -+ .dev.platform_data = &avila_npe_ucode_data, -+}; -+ - static struct platform_device *avila_devices[] __initdata = { - &avila_i2c_controller, - &avila_flash, - &avila_uart, - &mac0, - &mac1, -- -+ &avila_npe_ucode, - }; - - #ifdef CONFIG_SENSORS_EEPROM diff --git a/target/linux/ixp4xx/patches/800-eeprom_new_notifier.patch b/target/linux/ixp4xx/patches/800-eeprom_new_notifier.patch deleted file mode 100644 index d10153ef81..0000000000 --- a/target/linux/ixp4xx/patches/800-eeprom_new_notifier.patch +++ /dev/null @@ -1,201 +0,0 @@ -Add EEPROM notifiers - -These help board level code by allowing a callback when EEPROMs are -loaded, this permits system level configuration to be loaded from the -EEPROM. This is particularly useful when the ethernet MAC ids are -stored in EEPROM and when the ethernet hardware is generic (so it -has no board level knowledge), then the MACs can be loaded into -the 'maclist' code and read out by the ethernet config. - -Signed-off-by: John Bowler <jbowler@acm.org> - -Index: linux-2.6.21.7/drivers/i2c/chips/eeprom.c -=================================================================== ---- linux-2.6.21.7.orig/drivers/i2c/chips/eeprom.c -+++ linux-2.6.21.7/drivers/i2c/chips/eeprom.c -@@ -33,6 +33,8 @@ - #include <linux/jiffies.h> - #include <linux/i2c.h> - #include <linux/mutex.h> -+#include <linux/notifier.h> -+#include <linux/eeprom.h> - - /* Addresses to scan */ - static unsigned short normal_i2c[] = { 0x50, 0x51, 0x52, 0x53, 0x54, -@@ -41,26 +43,7 @@ static unsigned short normal_i2c[] = { 0 - /* Insmod parameters */ - I2C_CLIENT_INSMOD_1(eeprom); - -- --/* Size of EEPROM in bytes */ --#define EEPROM_SIZE 256 -- --/* possible types of eeprom devices */ --enum eeprom_nature { -- UNKNOWN, -- VAIO, --}; -- --/* Each client has this additional data */ --struct eeprom_data { -- struct i2c_client client; -- struct mutex update_lock; -- u8 valid; /* bitfield, bit!=0 if slice is valid */ -- unsigned long last_updated[8]; /* In jiffies, 8 slices */ -- u8 data[EEPROM_SIZE]; /* Register values */ -- enum eeprom_nature nature; --}; -- -+ATOMIC_NOTIFIER_HEAD(eeprom_chain); - - static int eeprom_attach_adapter(struct i2c_adapter *adapter); - static int eeprom_detect(struct i2c_adapter *adapter, int address, int kind); -@@ -189,6 +172,7 @@ static int eeprom_detect(struct i2c_adap - data->valid = 0; - mutex_init(&data->update_lock); - data->nature = UNKNOWN; -+ data->attr = &eeprom_attr; - - /* Tell the I2C layer a new client has arrived */ - if ((err = i2c_attach_client(new_client))) -@@ -212,6 +196,9 @@ static int eeprom_detect(struct i2c_adap - if (err) - goto exit_detach; - -+ /* call the notifier chain */ -+ atomic_notifier_call_chain(&eeprom_chain, EEPROM_REGISTER, data); -+ - return 0; - - exit_detach: -@@ -237,6 +224,41 @@ static int eeprom_detach_client(struct i - return 0; - } - -+/** -+ * register_eeprom_notifier - register a 'user' of EEPROM devices. -+ * @nb: pointer to notifier info structure -+ * -+ * Registers a callback function to be called upon detection -+ * of an EEPROM device. Detection invokes the 'add' callback -+ * with the kobj of the mutex and a bin_attribute which allows -+ * read from the EEPROM. The intention is that the notifier -+ * will be able to read system configuration from the notifier. -+ * -+ * Only EEPROMs detected *after* the addition of the notifier -+ * are notified. I.e. EEPROMs already known to the system -+ * will not be notified - add the notifier from board level -+ * code! -+ */ -+int register_eeprom_notifier(struct notifier_block *nb) -+{ -+ return atomic_notifier_chain_register(&eeprom_chain, nb); -+} -+ -+/** -+ * unregister_eeprom_notifier - unregister a 'user' of EEPROM devices. -+ * @old: pointer to notifier info structure -+ * -+ * Removes a callback function from the list of 'users' to be -+ * notified upon detection of EEPROM devices. -+ */ -+int unregister_eeprom_notifier(struct notifier_block *nb) -+{ -+ return atomic_notifier_chain_unregister(&eeprom_chain, nb); -+} -+ -+EXPORT_SYMBOL_GPL(register_eeprom_notifier); -+EXPORT_SYMBOL_GPL(unregister_eeprom_notifier); -+ - static int __init eeprom_init(void) - { - return i2c_add_driver(&eeprom_driver); -Index: linux-2.6.21.7/include/linux/eeprom.h -=================================================================== ---- /dev/null -+++ linux-2.6.21.7/include/linux/eeprom.h -@@ -0,0 +1,71 @@ -+#ifndef _LINUX_EEPROM_H -+#define _LINUX_EEPROM_H -+/* -+ * $Id: 45-eeprom-new-notifier.patch,v 1.2 2006/03/27 11:10:19 azummo Exp $ -+ * -+ * Copyright (C) 2006 John Bowler -+ */ -+ -+/* -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+ */ -+ -+#ifndef __KERNEL__ -+#error This is a kernel header -+#endif -+ -+#include <linux/list.h> -+#include <linux/kobject.h> -+#include <linux/sysfs.h> -+ -+/* Size of EEPROM in bytes */ -+#define EEPROM_SIZE 256 -+ -+/* possible types of eeprom devices */ -+enum eeprom_nature { -+ UNKNOWN, -+ VAIO, -+}; -+ -+/* Each client has this additional data */ -+struct eeprom_data { -+ struct i2c_client client; -+ struct mutex update_lock; -+ u8 valid; /* bitfield, bit!=0 if slice is valid */ -+ unsigned long last_updated[8]; /* In jiffies, 8 slices */ -+ u8 data[EEPROM_SIZE]; /* Register values */ -+ enum eeprom_nature nature; -+ struct bin_attribute *attr; -+}; -+ -+/* -+ * This is very basic. -+ * -+ * If an EEPROM is detected on the I2C bus (this only works for -+ * I2C EEPROMs) the notifier chain is called with -+ * both the I2C information and the kobject for the sysfs -+ * device which has been registers. It is then possible to -+ * read from the device via the bin_attribute::read method -+ * to extract configuration information. -+ * -+ * Register the notifier in the board level code, there is no -+ * need to unregister it but you can if you want (it will save -+ * a little bit or kernel memory to do so). -+ */ -+ -+extern int register_eeprom_notifier(struct notifier_block *nb); -+extern int unregister_eeprom_notifier(struct notifier_block *nb); -+ -+#endif /* _LINUX_EEPROM_H */ -Index: linux-2.6.21.7/include/linux/notifier.h -=================================================================== ---- linux-2.6.21.7.orig/include/linux/notifier.h -+++ linux-2.6.21.7/include/linux/notifier.h -@@ -187,5 +187,8 @@ extern int srcu_notifier_call_chain(stru - #define CPU_DOWN_FAILED 0x0006 /* CPU (unsigned)v NOT going down */ - #define CPU_DEAD 0x0007 /* CPU (unsigned)v dead */ - -+/* eeprom notifier chain */ -+#define EEPROM_REGISTER 0x0001 -+ - #endif /* __KERNEL__ */ - #endif /* _LINUX_NOTIFIER_H */ diff --git a/target/linux/ixp4xx/patches/900-no_loader_workaround.patch b/target/linux/ixp4xx/patches/900-no_loader_workaround.patch deleted file mode 100644 index cb6a531759..0000000000 --- a/target/linux/ixp4xx/patches/900-no_loader_workaround.patch +++ /dev/null @@ -1,20 +0,0 @@ -Index: linux-2.6.21.7/arch/arm/boot/compressed/head-xscale.S -=================================================================== ---- linux-2.6.21.7.orig/arch/arm/boot/compressed/head-xscale.S -+++ linux-2.6.21.7/arch/arm/boot/compressed/head-xscale.S -@@ -41,6 +41,7 @@ __XScale_start: - mov r7, #MACH_TYPE_COTULLA_IDP - #endif - -+/* let the arm-magic.sh script do the dirty work - #ifdef CONFIG_MACH_GTWX5715 - mov r7, #(MACH_TYPE_GTWX5715 & 0xff) - orr r7, r7, #(MACH_TYPE_GTWX5715 & 0xff00) -@@ -50,6 +51,7 @@ __XScale_start: - mov r7, #(MACH_TYPE_GATEWAY7001 & 0xff) - orr r7, r7, #(MACH_TYPE_GATEWAY7001 & 0xff00) - #endif -+ */ - - #ifdef CONFIG_ARCH_IXP2000 - mov r1, #-1 diff --git a/target/linux/ixp4xx/patches/996-fsg3_support.patch b/target/linux/ixp4xx/patches/996-fsg3_support.patch deleted file mode 100644 index 987abdfc71..0000000000 --- a/target/linux/ixp4xx/patches/996-fsg3_support.patch +++ /dev/null @@ -1,433 +0,0 @@ -Index: linux-2.6.21.7/arch/arm/mach-ixp4xx/fsg-pci.c -=================================================================== ---- /dev/null -+++ linux-2.6.21.7/arch/arm/mach-ixp4xx/fsg-pci.c -@@ -0,0 +1,71 @@ -+/* -+ * arch/arch/mach-ixp4xx/fsg-pci.c -+ * -+ * FSG board-level PCI initialization -+ * -+ * Author: Rod Whitby <rod@whitby.id.au> -+ * Maintainer: http://www.nslu2-linux.org/ -+ * -+ * based on ixdp425-pci.c: -+ * Copyright (C) 2002 Intel Corporation. -+ * Copyright (C) 2003-2004 MontaVista Software, Inc. -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ * -+ */ -+ -+#include <linux/pci.h> -+#include <linux/init.h> -+#include <linux/irq.h> -+ -+#include <asm/mach/pci.h> -+#include <asm/mach-types.h> -+ -+void __init fsg_pci_preinit(void) -+{ -+ set_irq_type(IRQ_FSG_PCI_INTA, IRQT_LOW); -+ set_irq_type(IRQ_FSG_PCI_INTB, IRQT_LOW); -+ set_irq_type(IRQ_FSG_PCI_INTC, IRQT_LOW); -+ -+ ixp4xx_pci_preinit(); -+} -+ -+static int __init fsg_map_irq(struct pci_dev *dev, u8 slot, u8 pin) -+{ -+ static int pci_irq_table[FSG_PCI_IRQ_LINES] = { -+ IRQ_FSG_PCI_INTC, -+ IRQ_FSG_PCI_INTB, -+ IRQ_FSG_PCI_INTA, -+ }; -+ -+ int irq = -1; -+ slot = slot - 11; -+ -+ if (slot >= 1 && slot <= FSG_PCI_MAX_DEV && -+ pin >= 1 && pin <= FSG_PCI_IRQ_LINES) { -+ irq = pci_irq_table[(slot - 1)]; -+ } -+ printk("%s: Mapped slot %d pin %d to IRQ %d\n", __FUNCTION__,slot, pin, irq); -+ -+ return irq; -+} -+ -+struct hw_pci fsg_pci __initdata = { -+ .nr_controllers = 1, -+ .preinit = fsg_pci_preinit, -+ .swizzle = pci_std_swizzle, -+ .setup = ixp4xx_setup, -+ .scan = ixp4xx_scan_bus, -+ .map_irq = fsg_map_irq, -+}; -+ -+int __init fsg_pci_init(void) -+{ -+ if (machine_is_fsg()) -+ pci_common_init(&fsg_pci); -+ return 0; -+} -+ -+subsys_initcall(fsg_pci_init); -Index: linux-2.6.21.7/arch/arm/mach-ixp4xx/fsg-setup.c -=================================================================== ---- /dev/null -+++ linux-2.6.21.7/arch/arm/mach-ixp4xx/fsg-setup.c -@@ -0,0 +1,223 @@ -+/* -+ * arch/arm/mach-ixp4xx/fsg-setup.c -+ * -+ * FSG board-setup -+ * -+ * based ixdp425-setup.c: -+ * Copyright (C) 2003-2004 MontaVista Software, Inc. -+ * -+ * Author: Rod Whitby <rod@whitby.id.au> -+ * Maintainers: http://www.nslu2-linux.org/ -+ * -+ */ -+ -+#include <linux/kernel.h> -+#include <linux/serial.h> -+#include <linux/serial_8250.h> -+#include <linux/leds.h> -+#include <linux/mtd/mtd.h> -+ -+#include <asm/mach-types.h> -+#include <asm/mach/arch.h> -+#include <asm/mach/flash.h> -+ -+static struct flash_platform_data fsg_flash_data = { -+ .map_name = "cfi_probe", -+ .width = 2, -+}; -+ -+static struct resource fsg_flash_resource = { -+ .flags = IORESOURCE_MEM, -+}; -+ -+static struct platform_device fsg_flash = { -+ .name = "IXP4XX-Flash", -+ .id = 0, -+ .dev.platform_data = &fsg_flash_data, -+ .num_resources = 1, -+ .resource = &fsg_flash_resource, -+}; -+ -+static struct ixp4xx_i2c_pins fsg_i2c_gpio_pins = { -+ .sda_pin = FSG_SDA_PIN, -+ .scl_pin = FSG_SCL_PIN, -+}; -+ -+static struct platform_device fsg_i2c_controller = { -+ .name = "IXP4XX-I2C", -+ .id = 0, -+ .dev.platform_data = &fsg_i2c_gpio_pins, -+ .num_resources = 0, -+}; -+ -+static struct resource fsg_uart_resources[] = { -+ { -+ .start = IXP4XX_UART1_BASE_PHYS, -+ .end = IXP4XX_UART1_BASE_PHYS + 0x0fff, -+ .flags = IORESOURCE_MEM, -+ }, -+ { -+ .start = IXP4XX_UART2_BASE_PHYS, -+ .end = IXP4XX_UART2_BASE_PHYS + 0x0fff, -+ .flags = IORESOURCE_MEM, -+ } -+}; -+ -+static struct plat_serial8250_port fsg_uart_data[] = { -+ { -+ .mapbase = IXP4XX_UART1_BASE_PHYS, -+ .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET, -+ .irq = IRQ_IXP4XX_UART1, -+ .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, -+ .iotype = UPIO_MEM, -+ .regshift = 2, -+ .uartclk = IXP4XX_UART_XTAL, -+ }, -+ { -+ .mapbase = IXP4XX_UART2_BASE_PHYS, -+ .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET, -+ .irq = IRQ_IXP4XX_UART2, -+ .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, -+ .iotype = UPIO_MEM, -+ .regshift = 2, -+ .uartclk = IXP4XX_UART_XTAL, -+ }, -+ { } -+}; -+ -+static struct platform_device fsg_uart = { -+ .name = "serial8250", -+ .id = PLAT8250_DEV_PLATFORM, -+ .dev.platform_data = fsg_uart_data, -+ .num_resources = ARRAY_SIZE(fsg_uart_resources), -+ .resource = fsg_uart_resources, -+}; -+ -+/* Built-in 10/100 Ethernet MAC interfaces */ -+static struct resource res_mac0 = { -+ .start = IXP4XX_EthB_BASE_PHYS, -+ .end = IXP4XX_EthB_BASE_PHYS + 0x1ff, -+ .flags = IORESOURCE_MEM, -+}; -+ -+static struct resource res_mac1 = { -+ .start = IXP4XX_EthC_BASE_PHYS, -+ .end = IXP4XX_EthC_BASE_PHYS + 0x1ff, -+ .flags = IORESOURCE_MEM, -+}; -+ -+static struct mac_plat_info plat_mac0 = { -+ .npe_id = 1, -+ .phy_id = 5, -+ .eth_id = 0, -+ .rxq_id = 27, -+ .txq_id = 24, -+ .rxdoneq_id = 4, -+}; -+ -+static struct mac_plat_info plat_mac1 = { -+ .npe_id = 2, -+ .phy_id = 4, -+ .eth_id = 1, -+ .rxq_id = 28, -+ .txq_id = 25, -+ .rxdoneq_id = 5, -+}; -+ -+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 mac1 = { -+ .name = "ixp4xx_mac", -+ .id = 1, -+ .dev.platform_data = &plat_mac1, -+ .num_resources = 1, -+ .resource = &res_mac1, -+}; -+ -+struct npe_ucode_platform_data fsg_npe_ucode_data = { -+ .mtd_partition = "microcode", -+}; -+ -+static struct platform_device fsg_npe_ucode = { -+ .name = "ixp4xx_npe_ucode", -+ .id = 0, -+ .dev.platform_data = &fsg_npe_ucode_data, -+}; -+ -+static struct platform_device *fsg_devices[] __initdata = { -+ &fsg_i2c_controller, -+ &fsg_flash, -+ &mac0, -+ &mac1, -+ &fsg_npe_ucode, -+}; -+ -+static void fsg_flash_add(struct mtd_info *mtd) -+{ -+ if (strcmp(mtd->name, "RedBoot config") == 0) { -+ size_t retlen; -+ u_char mac[6]; -+ -+ if (mtd->read(mtd, 0x0422, 6, &retlen, mac) == 0 && retlen == 6) { -+ printk(KERN_INFO "eth0 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); -+ mac[5]++; -+ printk(KERN_INFO "eth1 mac: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n", -+ mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); -+ memcpy(plat_mac1.hwaddr, mac, 6); -+ } else { -+ printk(KERN_ERR "fsg mac: read failed\n"); -+ } -+ } -+} -+ -+static void fsg_flash_remove(struct mtd_info *mtd) { -+} -+ -+static struct mtd_notifier fsg_flash_notifier = { -+ .add = fsg_flash_add, -+ .remove = fsg_flash_remove, -+}; -+ -+static void __init fsg_init(void) -+{ -+ ixp4xx_sys_init(); -+ -+ fsg_flash_resource.start = IXP4XX_EXP_BUS_BASE(0); -+ fsg_flash_resource.end = -+ IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1; -+ -+ *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE; -+ *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0; -+ -+ /* Configure CS2 for operation, 8bit and writable */ -+ *IXP4XX_EXP_CS2 = 0xbfff0002; -+ -+ /* This is only useful on a modified machine, but it is valuable -+ * to have it first in order to see debug messages, and so that -+ * it does *not* get removed if platform_add_devices fails! -+ */ -+ (void)platform_device_register(&fsg_uart); -+ -+ platform_add_devices(fsg_devices, ARRAY_SIZE(fsg_devices)); -+ -+ register_mtd_user(&fsg_flash_notifier); -+} -+ -+MACHINE_START(FSG, "Freecom FSG-3") -+ .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, -+ .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, -+ .map_io = ixp4xx_map_io, -+ .init_irq = ixp4xx_init_irq, -+ .timer = &ixp4xx_timer, -+ .boot_params = 0x0100, -+ .init_machine = fsg_init, -+MACHINE_END -+ -Index: linux-2.6.21.7/include/asm-arm/arch-ixp4xx/fsg.h -=================================================================== ---- /dev/null -+++ linux-2.6.21.7/include/asm-arm/arch-ixp4xx/fsg.h -@@ -0,0 +1,58 @@ -+/* -+ * include/asm-arm/arch-ixp4xx/fsg.h -+ * -+ * Freecom FSG-3 platform specific definitions -+ * -+ * Author: Rod Whitby <rod@whitby.id.au> -+ * Author: Tomasz Chmielewski <mangoo@wpkg.org> -+ * Maintainers: http://www.nslu2-linux.org -+ * -+ * Based on coyote.h by -+ * Copyright 2004 (c) MontaVista, Software, Inc. -+ * -+ * This file is licensed under the terms of the GNU General Public -+ * License version 2. This program is licensed "as is" without any -+ * warranty of any kind, whether express or implied. -+ */ -+ -+#ifndef __ASM_ARCH_HARDWARE_H__ -+#error "Do not include this directly, instead #include <asm/hardware.h>" -+#endif -+ -+#define FSG_SDA_PIN 12 -+#define FSG_SCL_PIN 13 -+ -+/* -+ * FSG PCI IRQs -+ */ -+#define FSG_PCI_MAX_DEV 3 -+#define FSG_PCI_IRQ_LINES 3 -+ -+ -+/* PCI controller GPIO to IRQ pin mappings */ -+#define FSG_PCI_INTA_PIN 6 -+#define FSG_PCI_INTB_PIN 7 -+#define FSG_PCI_INTC_PIN 5 -+ -+/* Buttons */ -+ -+#define FSG_SB_GPIO 4 -+#define FSG_RB_GPIO 9 -+#define FSG_UB_GPIO 10 -+ -+#define FSG_SB_IRQ IRQ_IXP4XX_GPIO4 -+#define FSG_RB_IRQ IRQ_IXP4XX_GPIO9 -+#define FSG_UB_IRQ IRQ_IXP4XX_GPIO10 -+ -+#define FSG_SB_BM (1L << FSG_SB_GPIO) -+#define FSG_RB_BM (1L << FSG_RB_GPIO) -+#define FSG_UB_BM (1L << FSG_UB_GPIO) -+ -+/* LEDs */ -+ -+#define FSG_LED_RING_BIT 0 -+#define FSG_LED_SYNC_BIT 1 -+#define FSG_LED_USB_BIT 2 -+#define FSG_LED_SATA_BIT 3 -+#define FSG_LED_WAN_BIT 4 -+#define FSG_LED_WLAN_BIT 5 -Index: linux-2.6.21.7/include/asm-arm/arch-ixp4xx/hardware.h -=================================================================== ---- linux-2.6.21.7.orig/include/asm-arm/arch-ixp4xx/hardware.h -+++ linux-2.6.21.7/include/asm-arm/arch-ixp4xx/hardware.h -@@ -48,5 +48,6 @@ extern unsigned int processor_id; - #include "nslu2.h" - #include "nas100d.h" - #include "dsmg600.h" -+#include "fsg.h" - - #endif /* _ASM_ARCH_HARDWARE_H */ -Index: linux-2.6.21.7/include/asm-arm/arch-ixp4xx/irqs.h -=================================================================== ---- linux-2.6.21.7.orig/include/asm-arm/arch-ixp4xx/irqs.h -+++ linux-2.6.21.7/include/asm-arm/arch-ixp4xx/irqs.h -@@ -128,4 +128,11 @@ - #define IRQ_DSMG600_PCI_INTE IRQ_IXP4XX_GPIO7 - #define IRQ_DSMG600_PCI_INTF IRQ_IXP4XX_GPIO6 - -+/* -+ * Freecom FSG-3 board IRQs -+ */ -+#define IRQ_FSG_PCI_INTA IRQ_IXP4XX_GPIO6 -+#define IRQ_FSG_PCI_INTB IRQ_IXP4XX_GPIO7 -+#define IRQ_FSG_PCI_INTC IRQ_IXP4XX_GPIO5 -+ - #endif -Index: linux-2.6.21.7/arch/arm/mach-ixp4xx/Makefile -=================================================================== ---- linux-2.6.21.7.orig/arch/arm/mach-ixp4xx/Makefile -+++ linux-2.6.21.7/arch/arm/mach-ixp4xx/Makefile -@@ -13,6 +13,7 @@ obj-pci-$(CONFIG_MACH_GTWX5715) += gtwx - obj-pci-$(CONFIG_MACH_NSLU2) += nslu2-pci.o - obj-pci-$(CONFIG_MACH_NAS100D) += nas100d-pci.o - obj-pci-$(CONFIG_MACH_DSMG600) += dsmg600-pci.o -+obj-pci-$(CONFIG_MACH_FSG) += fsg-pci.o - obj-pci-$(CONFIG_MACH_GATEWAY7001) += gateway7001-pci.o - obj-pci-$(CONFIG_MACH_WG302V2) += wg302v2-pci.o - obj-pci-$(CONFIG_MACH_PRONGHORNMETRO) += pronghornmetro-pci.o -@@ -29,6 +30,7 @@ obj-$(CONFIG_MACH_GTWX5715) += gtwx5715- - obj-$(CONFIG_MACH_NSLU2) += nslu2-setup.o nslu2-power.o - obj-$(CONFIG_MACH_NAS100D) += nas100d-setup.o nas100d-power.o - obj-$(CONFIG_MACH_DSMG600) += dsmg600-setup.o dsmg600-power.o -+obj-$(CONFIG_MACH_FSG) += fsg-setup.o - obj-$(CONFIG_MACH_GATEWAY7001) += gateway7001-setup.o - obj-$(CONFIG_MACH_WG302V2) += wg302v2-setup.o - obj-$(CONFIG_MACH_PRONGHORNMETRO) += pronghornmetro-setup.o -Index: linux-2.6.21.7/arch/arm/mach-ixp4xx/Kconfig -=================================================================== ---- linux-2.6.21.7.orig/arch/arm/mach-ixp4xx/Kconfig -+++ linux-2.6.21.7/arch/arm/mach-ixp4xx/Kconfig -@@ -138,6 +138,14 @@ config MACH_DSMG600 - DSM-G600 RevA device. For more information on this platform, - see http://www.nslu2-linux.org/wiki/DSMG600/HomePage - -+config MACH_FSG -+ bool -+ prompt "Freecom FSG-3" -+ help -+ Say 'Y' here if you want your kernel to support Freecom's -+ FSG-3 device. For more information on this -+ platform see http://www.openfsg.com/ -+ - # - # Avila and IXDP share the same source for now. Will change in future - # diff --git a/target/linux/ixp4xx/patches/997-fsg3_buttons.patch b/target/linux/ixp4xx/patches/997-fsg3_buttons.patch deleted file mode 100644 index 1b8d8cf5ff..0000000000 --- a/target/linux/ixp4xx/patches/997-fsg3_buttons.patch +++ /dev/null @@ -1,191 +0,0 @@ ---- - arch/arm/mach-ixp4xx/Makefile | 2 - arch/arm/mach-ixp4xx/fsg-power.c | 168 +++++++++++++++++++++++++++++++++++++++ - 2 files changed, 169 insertions(+), 1 deletion(-) - -Index: linux-2.6.21.7/arch/arm/mach-ixp4xx/fsg-power.c -=================================================================== ---- /dev/null -+++ linux-2.6.21.7/arch/arm/mach-ixp4xx/fsg-power.c -@@ -0,0 +1,168 @@ -+/* -+ * arch/arm/mach-ixp4xx/fsg-power.c -+ * -+ * FSG buttons driver -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ * -+ */ -+ -+#include <linux/module.h> -+#include <linux/reboot.h> -+#include <linux/irq.h> -+#include <linux/interrupt.h> -+#include <asm/mach-types.h> -+#include <linux/kernel.h> -+ -+struct event_t { -+ struct work_struct wq; -+ char *button_name; -+ int action; -+}; -+ -+static void hotplug_button(struct event_t *event) -+{ -+ static char buf[128]; -+ char *argv[3], *envp[6], *action; -+ int i; -+ -+ i = 0; -+ argv[i++] = "/sbin/hotplug"; -+ argv[i++] = "button"; -+ argv[i] = 0; -+ -+ i = 0; -+ /* minimal command environment */ -+ envp [i++] = "HOME=/"; -+ envp [i++] = "PATH=/sbin:/bin:/usr/sbin:/usr/bin"; -+ envp [i++] = "SUBSYSTEM=button"; -+ -+ snprintf(buf, 128, "BUTTON=%s", event->button_name); -+ envp [i++] = buf; -+ -+ action = event->action ? "released" : "pressed"; -+ snprintf(buf, 128, "ACTION=%s", action); -+ envp [i++] = buf; -+ -+ envp [i] = 0; -+ -+ // create hotplug event -+ call_usermodehelper (argv[0], argv, envp, 0); -+ -+ //destroy event structure -+ kfree(event); -+} -+ -+static irqreturn_t fsg_sync_button_handler(int irq, void *dev_id) -+{ -+ int holdkey; -+ struct event_t *event; -+ -+ //check button status -+ gpio_line_get(FSG_SB_GPIO, &holdkey); -+ -+ //create event -+ if ((event = (struct event_t *)kzalloc (sizeof(struct event_t), GFP_ATOMIC))) { -+ event->action = holdkey; -+ event->button_name = "sync"; -+ -+ INIT_WORK(&event->wq, (void *)(void *)hotplug_button); -+ schedule_work(&event->wq); -+ } -+ -+ return IRQ_HANDLED; -+} -+ -+static irqreturn_t fsg_reset_button_handler(int irq, void *dev_id) -+{ -+ int holdkey; -+ struct event_t *event; -+ -+ //check button status -+ gpio_line_get(FSG_RB_GPIO, &holdkey); -+ -+ //create event -+ if ((event = (struct event_t *)kzalloc (sizeof(struct event_t), GFP_ATOMIC))) { -+ event->action = holdkey; -+ event->button_name = "reset"; -+ -+ INIT_WORK(&event->wq, (void *)(void *)hotplug_button); -+ schedule_work(&event->wq); -+ } -+ -+ return IRQ_HANDLED; -+} -+ -+static irqreturn_t fsg_unplug_button_handler(int irq, void *dev_id) -+{ -+ int holdkey; -+ struct event_t *event; -+ -+ //check button status -+ gpio_line_get(FSG_UB_GPIO, &holdkey); -+ -+ //create event -+ if ((event = (struct event_t *)kzalloc (sizeof(struct event_t), GFP_ATOMIC))) { -+ event->action = holdkey; -+ event->button_name = "unplug"; -+ -+ INIT_WORK(&event->wq, (void *)(void *)hotplug_button); -+ schedule_work(&event->wq); -+ } -+ -+ return IRQ_HANDLED; -+} -+ -+static int __init fsg_buttons_init(void) -+{ -+ if (!(machine_is_fsg())) -+ return 0; -+ -+ /* Configure interrupt input for SYNC button */ -+ set_irq_type(FSG_SB_IRQ, IRQT_BOTHEDGE); -+ if (request_irq(FSG_SB_IRQ, &fsg_sync_button_handler, IRQF_DISABLED, "SYNC", NULL) < 0) { -+ printk(KERN_DEBUG "SYNC button IRQ %d not available\n", FSG_SB_IRQ); -+ return -EIO; -+ } -+ else -+ printk("SYNC button registered on IRQ%d\n", FSG_SB_IRQ); -+ -+ /* Configure interrupt input for RESET button */ -+ set_irq_type(FSG_RB_IRQ, IRQT_BOTHEDGE); -+ if (request_irq(FSG_RB_IRQ, &fsg_reset_button_handler, IRQF_DISABLED, "RESET", NULL) < 0) { -+ printk(KERN_DEBUG "RESET button IRQ %d not available\n", FSG_RB_IRQ); -+ return -EIO; -+ } -+ else -+ printk("RESET button registered on IRQ%d\n", FSG_RB_IRQ); -+ -+ /* Configure interrupt input for UNPLUG button */ -+ set_irq_type(FSG_UB_IRQ, IRQT_BOTHEDGE); -+ if (request_irq(FSG_UB_IRQ, &fsg_unplug_button_handler, IRQF_DISABLED, "RESET", NULL) < 0) { -+ printk(KERN_DEBUG "UNPLUG button IRQ %d not available\n", FSG_UB_IRQ); -+ return -EIO; -+ } -+ else -+ printk("UNPLUG button registered on IRQ%d\n", FSG_UB_IRQ); -+ -+ return 0; -+} -+ -+static void __exit fsg_buttons_exit(void) -+{ -+ if (!(machine_is_fsg())) -+ return; -+ -+ free_irq(FSG_SB_IRQ, NULL); -+ free_irq(FSG_RB_IRQ, NULL); -+ free_irq(FSG_UB_IRQ, NULL); -+} -+ -+module_init(fsg_buttons_init); -+module_exit(fsg_buttons_exit); -+ -+MODULE_AUTHOR("Zintis Petersons <Zintis.Petersons@e-mail.lv>"); -+MODULE_DESCRIPTION("FSG buttons driver"); -+MODULE_LICENSE("GPL"); -Index: linux-2.6.21.7/arch/arm/mach-ixp4xx/Makefile -=================================================================== ---- linux-2.6.21.7.orig/arch/arm/mach-ixp4xx/Makefile -+++ linux-2.6.21.7/arch/arm/mach-ixp4xx/Makefile -@@ -30,7 +30,7 @@ obj-$(CONFIG_MACH_GTWX5715) += gtwx5715- - obj-$(CONFIG_MACH_NSLU2) += nslu2-setup.o nslu2-power.o - obj-$(CONFIG_MACH_NAS100D) += nas100d-setup.o nas100d-power.o - obj-$(CONFIG_MACH_DSMG600) += dsmg600-setup.o dsmg600-power.o --obj-$(CONFIG_MACH_FSG) += fsg-setup.o -+obj-$(CONFIG_MACH_FSG) += fsg-setup.o fsg-power.o - obj-$(CONFIG_MACH_GATEWAY7001) += gateway7001-setup.o - obj-$(CONFIG_MACH_WG302V2) += wg302v2-setup.o - obj-$(CONFIG_MACH_PRONGHORNMETRO) += pronghornmetro-setup.o diff --git a/target/linux/ixp4xx/patches/998-VT6421.patch b/target/linux/ixp4xx/patches/998-VT6421.patch deleted file mode 100644 index a7f28e9355..0000000000 --- a/target/linux/ixp4xx/patches/998-VT6421.patch +++ /dev/null @@ -1,21 +0,0 @@ -I think that I've found and fixed the problem. There is a copy/paste bug in -vt6421_set_dma_mode() function which causes wrong values to be written to -PATA_UDMA_TIMING register. - - -This patch fixes a copy/paste bug that breaks DMA modes on VT6421 PATA port. - -Signed-off-by: Ondrej Zary <linux@rain...> -Index: linux-2.6.21.7/drivers/ata/sata_via.c -=================================================================== ---- linux-2.6.21.7.orig/drivers/ata/sata_via.c -+++ linux-2.6.21.7/drivers/ata/sata_via.c -@@ -380,7 +380,7 @@ static void vt6421_set_dma_mode(struct a - { - struct pci_dev *pdev = to_pci_dev(ap->host->dev); - static const u8 udma_bits[] = { 0xEE, 0xE8, 0xE6, 0xE4, 0xE2, 0xE1, 0xE0, 0xE0 }; -- pci_write_config_byte(pdev, PATA_UDMA_TIMING, udma_bits[adev->pio_mode - XFER_UDMA_0]); -+ pci_write_config_byte(pdev, PATA_UDMA_TIMING, udma_bits[adev->dma_mode - XFER_UDMA_0]); - } - - static int vt6421_port_start(struct ata_port *ap) |