Hi,
This is my first time using the mailing lists so my apologies if the
format isn't correct. Over a year ago I started getting the old OpenIXP
patches to work on OpenWRT, as they used a very old version of the code.
I got most of the way there but then had to stop for matters outside of
my control. I posted numerous times on ticket 684 (as disavowed), and
never managed to upload any of the new patches.
Anyhow, below are a set of patches to get OpenWRT to boot on the WRV54G.
There are still some outstanding issues though (which I am trying to
work on now) that I would be greatful for any assistance on. These
patches need to go into target/linux/ixp4xx/patches-2.6.26/
Firstly, the jffs2 partition is no longer expanded to fit the flash once
it has booted. In the old svn a program called jffs2root was used to do
the resizing, in a newer SVN it seemed that it was done automatically
upon first boot. In the latest svn (r13325) it does not, and so there is
no free space available. I'm looking into this atm as im sure it had
something to do with the preinit file last time.
Secondly, there is no control for the LED's at the front at present. I
still need to move two of the patches across, but the format of the
2.6.26 kernel files seems to have changed significantly. Hopefully this
one shouldn't be too much of a problem.
Thirdly, there are issues creating the firmware header. A program named
wrv-bin needs to be used to bundle together the header, the kernel and
the jffs2 root. To build this you need to have libssl-dev installed on
your system, and not within the openwrt tree. Hopefully someone knows a
way around this. Also, the header is now prebuilt, as GCC4 and above
seemed to produce different code from the ASM file, which failed to work
on the device.
Finally, and this is where someone with some very good knowledge of
OpenWRT would come in, to get it to work you have to enable
CONFIG_ARCH_GTWX5715 in the kernel config file, which can be done with
target/linux/ixp4xx/config-2.6.27, however that makes changes to some of
that I think will buggar up other IXP boards. Is there some way of
enabling this in the menuconfig? I plan to add a profile in there for
the WRV54G, but am not 100% sure if it can enable this option.
Hopefully some of you guys/girls out there can help/advise on the points
above. My apologies for the extremely long delay in this work.
Stuart
--- linux-2.6.26/include/asm-arm/arch-ixp4xx/debug-macro.S 2008-11-25
14:05:05.000000000 +0000
+++ linux-2.6.26/include/asm-arm/arch-ixp4xx/debug-macro.S 2008-11-25
14:06:57.000000000 +0000
@@ -16,8 +16,13 @@
moveq \rx, #0xc8000000
movne \rx, #0xff000000
orrne \rx, \rx, #0x00b00000
- add \rx,\rx,#3 @ Uart regs are at off set of
3 if
+ add \rx, \rx, #3 @ Uart regs are at off set of
3 if
@ byte writes used - Big Endian.
+
+#if defined(CONFIG_MACH_GTWX5715)
+ add \rx\rx, #0x1000 @ Second UART on GTWX5715
(WRV54G)
+#endif
+
.endm
#define UART_SHIFT 2
--- linux-2.6.26/arch/arm/mach-ixp4xx/gtwx5715-pci.c 2008-11-25
14:08:59.000000000 +0000
+++ linux-2.6.26/arch/arm/mach-ixp4xx/gtwx5715-pci.c 2008-11-25
14:12:29.000000000 +0000
@@ -53,17 +53,21 @@ void __init gtwx5715_pci_preinit(void)
static int __init gtwx5715_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
{
int rc;
+ // Fixup for WRV54G with two mini-pci slots
static int gtwx5715_irqmap
[GTWX5715_PCI_SLOT_COUNT]
[GTWX5715_PCI_INT_PIN_COUNT] = {
- {GTWX5715_PCI_SLOT0_INTA_IRQ, GTWX5715_PCI_SLOT0_INTB_IRQ},
- {GTWX5715_PCI_SLOT1_INTA_IRQ, GTWX5715_PCI_SLOT1_INTB_IRQ},
-};
+ {GTWX5715_PCI_SLOT0_INTA_IRQ, GTWX5715_PCI_SLOT0_INTB_IRQ,
+ GTWX5715_PCI_SLOT0_INTA_IRQ, GTWX5715_PCI_SLOT0_INTB_IRQ,},
+ {GTWX5715_PCI_SLOT1_INTA_IRQ, GTWX5715_PCI_SLOT1_INTB_IRQ,
+ GTWX5715_PCI_SLOT1_INTA_IRQ, GTWX5715_PCI_SLOT1_INTB_IRQ,},
+ };
- if (slot >= GTWX5715_PCI_SLOT_COUNT ||
+ // Fixup for WRV54G with two mini-pci slots
+ if (slot > GTWX5715_PCI_SLOT_COUNT ||
pin >= GTWX5715_PCI_INT_PIN_COUNT) rc = -1;
else
- rc = gtwx5715_irqmap[slot][pin-1];
+ rc = gtwx5715_irqmap[slot & (GTWX5715_PCI_SLOT_COUNT-1)][pin-1];
printk("%s: Mapped slot %d pin %d to IRQ %d\n", __func__, slot, pin,
rc);
return(rc);
--- linux-2.6.26/include/asm-arm/arch-ixp4xx/ixp4xx-regs.h 2008-11-25
14:54:43.000000000 +0000
+++ linux-2.6.26/include/asm-arm/arch-ixp4xx/ixp4xx-regs.h 2008-11-25
15:00:20.000000000 +0000
@@ -72,10 +72,27 @@
* This is basically a remap of UART1 into a region that is section
* aligned so that it * can be used with the low-level debug code.
*/
+// Fixup for GTWX5715 (WRV54G)
+#ifdef CONFIG_MACH_GTWX5715
+#define IXP4XX_DEBUG_UART_BASE_PHYS (0xC8001000)
+#define IXP4XX_DEBUG_UART_BASE_VIRT (0xffb01000)
+#else
#define IXP4XX_DEBUG_UART_BASE_PHYS (0xC8000000)
#define IXP4XX_DEBUG_UART_BASE_VIRT (0xffb00000)
+#endif
#define IXP4XX_DEBUG_UART_REGION_SIZE (0x00001000)
+/*
+ * Expansion Bus 'lives' at either base1 or base 2 depending on the value of
+ * Exp Bus config registers:
+ * Setting bit 31 of IXP425_EXP_CFG0 puts SDRAM at zero,
+ * and The expansion bus to IXP425_EXP_BUS_BASE2
+ */
+#ifdef CONFIG_MACH_GTWX5715
+#define IXP4XX_EXP_BUS_BASE1_PHYS (0x00000000)
+#define IXP4XX_EXP_BUS_BASE2_PHYS (0x50000000)
+#endif
+
#define IXP4XX_EXP_CS0_OFFSET 0x00
#define IXP4XX_EXP_CS1_OFFSET 0x04
#define IXP4XX_EXP_CS2_OFFSET 0x08
--- linux-2.6.26/drivers/mtd/maps/ixp4xx.c 2008-11-25 14:28:38.000000000
+0000
+++ linux-2.6.26/drivers/mtd/maps/ixp4xx.c 2008-11-25 14:42:21.000000000
+0000
@@ -151,7 +151,102 @@ struct ixp4xx_flash_info {
struct resource *res;
};
-static const char *probes[] = { "RedBoot", "cmdlinepart", NULL };
+// Fixup for GTWX5715 (WRV54G)
+#if defined (CONFIG_MACH_GTWX5715)
+#define SECTION_MAGIC 0xfeedbabe
+
+struct section_header {
+ __u32 magic; /* feedbabe */
+ __u32 size; /* Length of file excluding header */
+ __u32 checksum; /* checksum from magic to end of file */
+ __u32 counter; /* write counter */
+ __u32 offset; /* offset */
+ char name[128]; /* name of the section */
+};
+
+struct loader_header {
+ __u32 startup_code[4];
+ __u32 code_offset;
+ __u32 rootfs_size;
+ __u32 atag_list_start;
+ __u32 atag_list_dest;
+ __u32 atag_list_size;
+ __u32 linux_zimage_start;
+ __u32 linux_zimage_dest;
+ __u32 linux_zimage_size;
+};
+
+struct image_header {
+ struct section_header sh;
+ struct loader_header lh;
+};
+
+#define PART_rg_boot 0
+#define PART_boot 1
+#define PART_rootfs 2
+#define PART_linux 3
+#define PART_rg_conf 4
+#define PART_nvram 5
+#define PART_kernel 6
+
+static struct mtd_partition gtwx5715_parts[] = {
+ { name: "rg_boot", offset: 0x00000000, size: 0x00140000, mask_flags:
MTD_WRITEABLE, },
+ { name: "boot", offset: 0x00140000, size: 0x00020000, mask_flags: 0,
},
+ { name: "rootfs", offset: 0x00160000, size: 0xFFFFFFFF, mask_flags: 0,
},
+ { name: "linux", offset: 0xFFFFFFFF, size: 0xFFFFFFFF, mask_flags: 0,
},
+ { name: "rg_conf", offset: 0x006C0000, size: 0x00020000, mask_flags:
MTD_WRITEABLE, },
+ { name: "nvram", offset: 0x006E0000, size: 0x00020000, mask_flags: 0,
},
+ { name: "kernel", offset: 0x00700000, size: 0x00100000, mask_flags: 0,
},
+};
+
+static int init_mtd_partitions( struct mtd_info *mtd, struct mtd_partition
**ppartitions )
+{
+ int err, new_layout, num_parts;
+ struct mtd_partition* parts;
+ struct image_header ihdr;
+ size_t len;
+
+ if( 0 != (err = mtd->read( mtd, gtwx5715_parts[PART_boot].offset,
sizeof(ihdr), &len, (void*)&ihdr )) )
+ return -err;
+ if( len != sizeof(ihdr) )
+ return -ENXIO;
+ if( ihdr.sh.magic != SECTION_MAGIC )
+ return -ENXIO;
+
+ new_layout = ihdr.sh.size <= sizeof(struct loader_header) ? 1 : 0;
+ num_parts = 7;
+
+ if( !(parts = kmalloc( num_parts * sizeof(struct mtd_partition),
GFP_KERNEL )) )
+ {
+ printk(KERN_ERR "IXP4XXFlash: out of memory\n");
+ return -ENOMEM;
+ }
+
+ memcpy( parts, gtwx5715_parts, sizeof(gtwx5715_parts) );
+
+ if( new_layout )
+ {
+ parts[PART_rootfs].size = parts[PART_rg_conf].offset -
parts[PART_rootfs].offset;
+ parts[PART_linux].offset = parts[PART_boot].offset;
+ parts[PART_linux].size = parts[PART_rg_conf].offset -
parts[PART_linux].offset;
+ }
+ else
+ {
+ parts[PART_rootfs].size = ihdr.lh.rootfs_size;
+ parts[PART_linux].offset = parts[PART_rootfs].offset +
parts[PART_rootfs].size;
+ parts[PART_linux].size = parts[PART_rg_conf].offset -
parts[PART_linux].offset;
+ parts[PART_linux].name = "OpenWRT";
+ }
+
+ *ppartitions = parts;
+
+ return num_parts;
+}
+#else
+ static const char *probes[] = { "RedBoot", "cmdlinepart", NULL };
+#endif
+
+// End of GTWX5715 Fixup (WRV54G)
static int ixp4xx_flash_remove(struct platform_device *dev)
{
@@ -253,7 +348,12 @@ static int ixp4xx_flash_probe(struct pla
/* Use the fast version */
info->map.write = ixp4xx_write16,
+ // Fixup for GTWX5715 (WRV54G)
+#if defined (CONFIG_MACH_GTWX5715)
+ err = init_mtd_partitions(info->mtd, &info->partitions);
+#else
err = parse_mtd_partitions(info->mtd, probes, &info->partitions,
dev->resource->start);
+#endif
if (err > 0) {
err = add_mtd_partitions(info->mtd, info->partitions, err);
if(err)
--- linux-2.6.26/include/asm-arm/arch-ixp4xx/gtwx5715.h 2008-11-25
14:43:57.000000000 +0000
+++ linux-2.6.26/include/asm-arm/arch-ixp4xx/gtwx5715.h 2008-11-25
14:44:21.000000000 +0000
@@ -78,7 +78,7 @@ SLOT 1 11 10
#define GTWX5715_PCI_SLOT1_INTB_IRQ GTWX5715_GPIO10_IRQ
#define GTWX5715_PCI_SLOT_COUNT 2
-#define GTWX5715_PCI_INT_PIN_COUNT 2
+#define GTWX5715_PCI_INT_PIN_COUNT 4
/*
* GPIO 5,6,7 and12 are hard wired to the Kendin KS8995M Switch
_______________________________________________
openwrt-devel mailing list
[email protected]
http://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel