diff options
Diffstat (limited to 'target/linux/ar7')
-rw-r--r-- | target/linux/ar7/Makefile | 2 | ||||
-rw-r--r-- | target/linux/ar7/base-files/etc/config/network | 2 | ||||
-rw-r--r-- | target/linux/ar7/base-files/etc/diag.sh | 26 | ||||
-rw-r--r-- | target/linux/ar7/config-3.3 | 3 | ||||
-rw-r--r-- | target/linux/ar7/image/Makefile | 10 | ||||
-rw-r--r-- | target/linux/ar7/patches-3.3/110-flash.patch | 11 | ||||
-rw-r--r-- | target/linux/ar7/patches-3.3/160-vlynq_try_remote_first.patch | 304 | ||||
-rw-r--r-- | target/linux/ar7/patches-3.3/920-ar7part.patch | 78 | ||||
-rw-r--r-- | target/linux/ar7/patches-3.3/925-actiontec_leds.patch | 95 | ||||
-rw-r--r-- | target/linux/ar7/patches-3.3/972-cpmac_fixup.patch | 126 |
10 files changed, 573 insertions, 84 deletions
diff --git a/target/linux/ar7/Makefile b/target/linux/ar7/Makefile index a712d6d20..da3e25244 100644 --- a/target/linux/ar7/Makefile +++ b/target/linux/ar7/Makefile @@ -17,7 +17,7 @@ LINUX_VERSION:=3.3.8 include $(INCLUDE_DIR)/target.mk DEFAULT_PACKAGES+= kmod-pppoa ppp-mod-pppoa linux-atm atm-tools br2684ctl \ - kmod-acx-mac80211 swconfig hostapd + kmod-acx-mac80211 swconfig wpad-mini define Target/Description Build firmware images for TI AR7 based routers. diff --git a/target/linux/ar7/base-files/etc/config/network b/target/linux/ar7/base-files/etc/config/network index 9ba0e6d29..0576aa437 100644 --- a/target/linux/ar7/base-files/etc/config/network +++ b/target/linux/ar7/base-files/etc/config/network @@ -8,7 +8,7 @@ config interface loopback config interface lan option type bridge - option ifname "eth0 eth1" + option ifname "eth0 eth1 eth0.1 eth0.2" option proto static option ipaddr 192.168.1.1 option netmask 255.255.255.0 diff --git a/target/linux/ar7/base-files/etc/diag.sh b/target/linux/ar7/base-files/etc/diag.sh index b8e4dc874..25ec89934 100644 --- a/target/linux/ar7/base-files/etc/diag.sh +++ b/target/linux/ar7/base-files/etc/diag.sh @@ -1,13 +1,16 @@ #!/bin/sh -# Copyright (C) 2007 OpenWrt.org +# Copyright (C) 2007-2012 OpenWrt.org # This setup gives us 4.5 distinguishable states: # -# Solid OFF: Bootloader running, or kernel hung (timer task stalled) -# Solid ON: Kernel hung (timer task stalled) -# 5Hz blink: preinit -# 10Hz blink: failsafe -# Heartbeat: normal operation +# (1-LED) Solid OFF: Bootloader running, or kernel hung (timer task stalled) +# (1-LED) Solid ON: Kernel hung (timer task stalled) +# (2-LED) Solid RED: Bootloader running, or kernel hung (timer task stalled) +# (2-LED) Solid YELLOW: Kernel hung (timer task stalled) +# 5Hz blink: preinit +# 10Hz blink: failsafe +# (1-LED) Heartbeat: normal operation +# (2-LED) Solid GREEN: normal operation set_state() { case "$1" in @@ -16,6 +19,10 @@ set_state() { echo timer >/sys/class/leds/status/trigger echo 100 >/sys/class/leds/status/delay_on echo 100 >/sys/class/leds/status/delay_off + :; } || [ -d /sys/class/leds/power\:green ] && { + echo timer >/sys/class/leds/power\:green/trigger + echo 100 >/sys/class/leds/power\:green/delay_on + echo 100 >/sys/class/leds/power\:green/delay_off } ;; failsafe) @@ -23,11 +30,18 @@ set_state() { echo timer >/sys/class/leds/status/trigger echo 50 >/sys/class/leds/status/delay_on echo 50 >/sys/class/leds/status/delay_off + :; } || [ -d /sys/class/leds/power\:green ] && { + echo timer >/sys/class/leds/power\:green/trigger + echo 50 >/sys/class/leds/power\:green/delay_on + echo 50 >/sys/class/leds/power\:green/delay_off } ;; done) [ -d /sys/class/leds/status ] && { echo heartbeat >/sys/class/leds/status/trigger + :; } || [ -d /sys/class/leds/power\:green ] && { + echo default-on >/sys/class/leds/power\:green/trigger + echo none >/sys/class/leds/power\:red/trigger } ;; esac diff --git a/target/linux/ar7/config-3.3 b/target/linux/ar7/config-3.3 index 9ba049741..8ff39e2c9 100644 --- a/target/linux/ar7/config-3.3 +++ b/target/linux/ar7/config-3.3 @@ -26,6 +26,7 @@ CONFIG_CSRC_R4K_LIB=y CONFIG_DECOMPRESS_LZMA=y CONFIG_DMA_NONCOHERENT=y CONFIG_EARLY_PRINTK=y +CONFIG_ETHERNET_PACKET_MANGLE=y CONFIG_FIXED_PHY=y CONFIG_GENERIC_ATOMIC64=y CONFIG_GENERIC_CLOCKEVENTS=y @@ -68,6 +69,7 @@ CONFIG_IRQ_FORCED_THREADING=y CONFIG_KALLSYMS=y CONFIG_KERNEL_GZIP=y CONFIG_LEDS_GPIO=y +CONFIG_LEDS_TRIGGER_HEARTBEAT=y CONFIG_MDIO_BOARDINFO=y CONFIG_MIPS=y CONFIG_MIPS_L1_CACHE_SHIFT=5 @@ -76,6 +78,7 @@ CONFIG_MIPS_MT_DISABLED=y CONFIG_MTD_AR7_PARTS=y CONFIG_MTD_CFI_STAA=y CONFIG_MTD_PHYSMAP=y +CONFIG_MVSWITCH_PHY=y CONFIG_NEED_DMA_MAP_STATE=y CONFIG_NEED_PER_CPU_KM=y CONFIG_NO_EXCEPT_FILL=y diff --git a/target/linux/ar7/image/Makefile b/target/linux/ar7/image/Makefile index d27c2e888..6278b3127 100644 --- a/target/linux/ar7/image/Makefile +++ b/target/linux/ar7/image/Makefile @@ -41,7 +41,9 @@ define Image/Prepare $(LOADER_MAKEOPTS) \ clean compile $(OBJCOPY_SREC) $(KDIR)/loader.elf $(KDIR)/loader.srec + $(OBJCOPY_SREC) $(KDIR)/vmlinux.elf $(KDIR)/vmlinux.srec srec2bin $(KDIR)/loader.srec $(KDIR)/loader.bin + srec2bin $(KDIR)/vmlinux.srec $(KDIR)/vmlinux.bin endef define align/jffs2-64k @@ -53,7 +55,6 @@ bs=131072 conv=sync endef define align/squashfs -bs=65536 conv=sync endef define Image/Build/CyberTAN @@ -81,6 +82,10 @@ define Image/Build/EVA $(call prepare_generic_squashfs,$(BIN_DIR)/openwrt-$(2)-$(KERNEL)-$(1).bin) endef +define Image/Build/Initramfs + $(CP) $(KDIR)/vmlinux.bin $(BIN_DIR)/$(IMG_PREFIX)-initramfs.bin +endef + define Image/Build dd if=$(KDIR)/loader.bin $(call align/$(1)) > $(BIN_DIR)/$(IMG_PREFIX)-$(1).bin cat $(KDIR)/root.$(1) >> $(BIN_DIR)/$(IMG_PREFIX)-$(1).bin @@ -104,6 +109,9 @@ define Image/Build # $(call Image/Build/sErCoMm,$(1),jdr454wb,$(1)) $(call Image/Build/EVA,$(1),EVA) $(call Image/Build/Titan,$(1),Titan,Titan,$(1)) +ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y) + $(call Image/Build/Initramfs) +endif endef $(eval $(call BuildImage)) diff --git a/target/linux/ar7/patches-3.3/110-flash.patch b/target/linux/ar7/patches-3.3/110-flash.patch index 58ce7eaa4..80229c104 100644 --- a/target/linux/ar7/patches-3.3/110-flash.patch +++ b/target/linux/ar7/patches-3.3/110-flash.patch @@ -20,3 +20,14 @@ obj-$(CONFIG_MTD_BCM63XX_PARTS) += bcm63xxpart.o obj-$(CONFIG_MTD_MYLOADER_PARTS) += myloader.o +--- a/arch/mips/ar7/platform.c ++++ b/arch/mips/ar7/platform.c +@@ -199,7 +199,7 @@ static struct resource physmap_flash_res + .name = "mem", + .flags = IORESOURCE_MEM, + .start = 0x10000000, +- .end = 0x107fffff, ++ .end = 0x11ffffff, + }; + + static struct physmap_flash_data physmap_flash_data = { diff --git a/target/linux/ar7/patches-3.3/160-vlynq_try_remote_first.patch b/target/linux/ar7/patches-3.3/160-vlynq_try_remote_first.patch index 437bc89d9..1d1310d82 100644 --- a/target/linux/ar7/patches-3.3/160-vlynq_try_remote_first.patch +++ b/target/linux/ar7/patches-3.3/160-vlynq_try_remote_first.patch @@ -1,20 +1,300 @@ --- a/drivers/vlynq/vlynq.c +++ b/drivers/vlynq/vlynq.c -@@ -514,9 +514,14 @@ static int __vlynq_enable_device(struct - !__vlynq_try_external(dev)) - return 0; +@@ -119,20 +119,40 @@ static int vlynq_linked(struct vlynq_dev + return 0; + } + ++static volatile int vlynq_delay_value_new = 0; ++ ++static void vlynq_delay_wait(u32 count) ++{ ++ /* Code adopted from original vlynq driver */ ++ int i = 0; ++ volatile int *ptr = &vlynq_delay_value_new; ++ *ptr = 0; ++ ++ /* We are assuming that the each cycle takes about ++ * 23 assembly instructions. */ ++ for(i = 0; i < (count + 23)/23; i++) ++ *ptr = *ptr + 1; ++} ++ + static void vlynq_reset(struct vlynq_device *dev) + { ++ u32 rtm = readl(&dev->local->revision); ++ ++ rtm = rtm < 0x00010205 || readl(&dev->local->status) & 0x800 == 0 ? ++ 0 : 0x600000; ++ + writel(readl(&dev->local->control) | VLYNQ_CTRL_RESET, + &dev->local->control); + + /* Wait for the devices to finish resetting */ +- msleep(5); ++ vlynq_delay_wait(0xffffff); + + /* Remove reset bit */ +- writel(readl(&dev->local->control) & ~VLYNQ_CTRL_RESET, ++ writel(readl(&dev->local->control) & ~VLYNQ_CTRL_RESET | rtm, + &dev->local->control); + + /* Give some time for the devices to settle */ +- msleep(5); ++ vlynq_delay_wait(0xffffff); + } + + static void vlynq_irq_unmask(struct irq_data *d) +@@ -379,6 +399,61 @@ void vlynq_unregister_driver(struct vlyn + } + EXPORT_SYMBOL(vlynq_unregister_driver); + ++enum vlynq_clk_src { ++ vlynq_clk_external, ++ vlynq_clk_local, ++ vlynq_clk_remote, ++ vlynq_clk_invalid, ++}; ++ ++static int __vlynq_set_clocks(struct vlynq_device *dev, ++ enum vlynq_clk_src clk_dir, ++ int lclk_div, int rclk_div) ++{ ++ u32 reg; ++ ++ if (clk_dir == vlynq_clk_invalid) { ++ printk(KERN_ERR "%s: attempt to set invalid clocking\n", ++ dev_name(&dev->dev)); ++ return -EINVAL; ++ } ++ ++ reg = readl(&dev->local->control); ++ if (readl(&dev->local->revision) < 0x00010205) { ++ if (clk_dir & vlynq_clk_local) ++ reg |= VLYNQ_CTRL_CLOCK_INT; ++ else ++ reg &= ~VLYNQ_CTRL_CLOCK_INT; ++ } ++ reg &= ~VLYNQ_CTRL_CLOCK_MASK; ++ reg |= VLYNQ_CTRL_CLOCK_DIV(lclk_div); ++ writel(reg, &dev->local->control); ++ ++ if (!vlynq_linked(dev)) ++ return -ENODEV; ++ ++ printk(KERN_INFO "%s: local VLYNQ protocol rev. is 0x%08x\n", ++ dev_name(&dev->dev), readl(&dev->local->revision)); ++ printk(KERN_INFO "%s: remote VLYNQ protocol rev. is 0x%08x\n", ++ dev_name(&dev->dev), readl(&dev->remote->revision)); ++ ++ reg = readl(&dev->remote->control); ++ if (readl(&dev->remote->revision) < 0x00010205) { ++ if (clk_dir & vlynq_clk_remote) ++ reg |= VLYNQ_CTRL_CLOCK_INT; ++ else ++ reg &= ~VLYNQ_CTRL_CLOCK_INT; ++ } ++ reg &= ~VLYNQ_CTRL_CLOCK_MASK; ++ reg |= VLYNQ_CTRL_CLOCK_DIV(rclk_div); ++ writel(reg, &dev->remote->control); ++ ++ if (!vlynq_linked(dev)) ++ return -ENODEV; ++ ++ return 0; ++} ++ + /* + * A VLYNQ remote device can clock the VLYNQ bus master + * using a dedicated clock line. In that case, both the +@@ -392,29 +467,16 @@ static int __vlynq_try_remote(struct vly + int i; + + vlynq_reset(dev); +- for (i = dev->dev_id ? vlynq_rdiv2 : vlynq_rdiv8; dev->dev_id ? +- i <= vlynq_rdiv8 : i >= vlynq_rdiv2; +- dev->dev_id ? i++ : i--) { ++ for (i = 0; i <= 7; i++) { + + if (!vlynq_linked(dev)) + break; + +- writel((readl(&dev->remote->control) & +- ~VLYNQ_CTRL_CLOCK_MASK) | +- VLYNQ_CTRL_CLOCK_INT | +- VLYNQ_CTRL_CLOCK_DIV(i - vlynq_rdiv1), +- &dev->remote->control); +- writel((readl(&dev->local->control) +- & ~(VLYNQ_CTRL_CLOCK_INT | +- VLYNQ_CTRL_CLOCK_MASK)) | +- VLYNQ_CTRL_CLOCK_DIV(i - vlynq_rdiv1), +- &dev->local->control); +- +- if (vlynq_linked(dev)) { +- printk(KERN_DEBUG +- "%s: using remote clock divisor %d\n", +- dev_name(&dev->dev), i - vlynq_rdiv1 + 1); +- dev->divisor = i; ++ if (!__vlynq_set_clocks(dev, vlynq_clk_remote, i, i)) { ++ printk(KERN_INFO ++ "%s: using remote clock divisor %d\n", ++ dev_name(&dev->dev), i + 1); ++ dev->divisor = i + vlynq_rdiv1; + return 0; } else { + vlynq_reset(dev); +@@ -433,25 +495,17 @@ static int __vlynq_try_remote(struct vly + */ + static int __vlynq_try_local(struct vlynq_device *dev) + { +- int i; ++ int i, dir = !dev->dev_id; + + vlynq_reset(dev); + +- for (i = dev->dev_id ? vlynq_ldiv2 : vlynq_ldiv8; dev->dev_id ? +- i <= vlynq_ldiv8 : i >= vlynq_ldiv2; +- dev->dev_id ? i++ : i--) { +- +- writel((readl(&dev->local->control) & +- ~VLYNQ_CTRL_CLOCK_MASK) | +- VLYNQ_CTRL_CLOCK_INT | +- VLYNQ_CTRL_CLOCK_DIV(i - vlynq_ldiv1), +- &dev->local->control); +- +- if (vlynq_linked(dev)) { +- printk(KERN_DEBUG +- "%s: using local clock divisor %d\n", +- dev_name(&dev->dev), i - vlynq_ldiv1 + 1); +- dev->divisor = i; ++ for (i = dir ? 7 : 0; dir ? i >= 0 : i <= 7; dir ? i-- : i++) { ++ ++ if (!__vlynq_set_clocks(dev, vlynq_clk_local, i, 0)) { ++ printk(KERN_INFO ++ "%s: using local clock divisor %d\n", ++ dev_name(&dev->dev), i + 1); ++ dev->divisor = i + vlynq_ldiv1; + return 0; + } else { + vlynq_reset(dev); +@@ -473,18 +527,10 @@ static int __vlynq_try_external(struct v + if (!vlynq_linked(dev)) + return -ENODEV; + +- writel((readl(&dev->remote->control) & +- ~VLYNQ_CTRL_CLOCK_INT), +- &dev->remote->control); +- +- writel((readl(&dev->local->control) & +- ~VLYNQ_CTRL_CLOCK_INT), +- &dev->local->control); +- +- if (vlynq_linked(dev)) { +- printk(KERN_DEBUG "%s: using external clock\n", +- dev_name(&dev->dev)); +- dev->divisor = vlynq_div_external; ++ if (!__vlynq_set_clocks(dev, vlynq_clk_external, 0, 0)) { ++ printk(KERN_INFO "%s: using external clock\n", ++ dev_name(&dev->dev)); ++ dev->divisor = vlynq_div_external; + return 0; + } + +@@ -501,24 +547,16 @@ static int __vlynq_enable_device(struct + return result; + + switch (dev->divisor) { +- case vlynq_div_external: + case vlynq_div_auto: + /* When the device is brought from reset it should have clock + * generation negotiated by hardware. + * Check which device is generating clocks and perform setup + * accordingly */ +- if (vlynq_linked(dev) && readl(&dev->remote->control) & +- VLYNQ_CTRL_CLOCK_INT) { +- if (!__vlynq_try_remote(dev) || +- !__vlynq_try_local(dev) || +- !__vlynq_try_external(dev)) +- return 0; +- } else { - if (!__vlynq_try_external(dev) || - !__vlynq_try_local(dev) || - !__vlynq_try_remote(dev)) -+ /* XXX: I don't really know what difference it makes, if the order -+ * of the following calls is changed, but at least in this order -+ * my fritzbox doesn't hang at startup as in -+ * https://dev.openwrt.org/ticket/7324 -+ */ -+ if (!__vlynq_try_remote(dev) || -+ !__vlynq_try_local(dev) || -+ !__vlynq_try_external(dev)) - return 0; +- return 0; +- } ++ if (!__vlynq_try_remote(dev) || !__vlynq_try_local(dev)) ++ return 0; ++ case vlynq_div_external: ++ if (!__vlynq_try_external(dev)) ++ return 0; + break; + case vlynq_ldiv1: + case vlynq_ldiv2: +@@ -528,15 +566,12 @@ static int __vlynq_enable_device(struct + case vlynq_ldiv6: + case vlynq_ldiv7: + case vlynq_ldiv8: +- writel(VLYNQ_CTRL_CLOCK_INT | +- VLYNQ_CTRL_CLOCK_DIV(dev->divisor - +- vlynq_ldiv1), &dev->local->control); +- writel(0, &dev->remote->control); +- if (vlynq_linked(dev)) { +- printk(KERN_DEBUG +- "%s: using local clock divisor %d\n", +- dev_name(&dev->dev), +- dev->divisor - vlynq_ldiv1 + 1); ++ if (!__vlynq_set_clocks(dev, vlynq_clk_local, dev->divisor - ++ vlynq_ldiv1, 0)) { ++ printk(KERN_INFO ++ "%s: using local clock divisor %d\n", ++ dev_name(&dev->dev), ++ dev->divisor - vlynq_ldiv1 + 1); + return 0; + } + break; +@@ -548,20 +583,17 @@ static int __vlynq_enable_device(struct + case vlynq_rdiv6: + case vlynq_rdiv7: + case vlynq_rdiv8: +- writel(0, &dev->local->control); +- writel(VLYNQ_CTRL_CLOCK_INT | +- VLYNQ_CTRL_CLOCK_DIV(dev->divisor - +- vlynq_rdiv1), &dev->remote->control); +- if (vlynq_linked(dev)) { +- printk(KERN_DEBUG +- "%s: using remote clock divisor %d\n", +- dev_name(&dev->dev), +- dev->divisor - vlynq_rdiv1 + 1); ++ if (!__vlynq_set_clocks(dev, vlynq_clk_remote, 0, ++ dev->divisor - vlynq_rdiv1)) { ++ printk(KERN_INFO ++ "%s: using remote clock divisor %d\n", ++ dev_name(&dev->dev), ++ dev->divisor - vlynq_rdiv1 + 1); + return 0; } break; + } +- ++ vlynq_reset(dev); + ops->off(dev); + return -ENODEV; + } +@@ -732,14 +764,14 @@ static int vlynq_probe(struct platform_d + platform_set_drvdata(pdev, dev); + + printk(KERN_INFO "%s: regs 0x%p, irq %d, mem 0x%p\n", +- dev_name(&dev->dev), (void *)dev->regs_start, dev->irq, +- (void *)dev->mem_start); ++ dev_name(&dev->dev), (void *)dev->regs_start, ++ dev->irq, (void *)dev->mem_start); + + dev->dev_id = 0; + dev->divisor = vlynq_div_auto; +- result = __vlynq_enable_device(dev); +- if (result == 0) { ++ if (!__vlynq_enable_device(dev)) { + dev->dev_id = readl(&dev->remote->chip); ++ vlynq_reset(dev); + ((struct plat_vlynq_ops *)(dev->dev.platform_data))->off(dev); + } + if (dev->dev_id) diff --git a/target/linux/ar7/patches-3.3/920-ar7part.patch b/target/linux/ar7/patches-3.3/920-ar7part.patch index 9cbc53786..cbd7f2639 100644 --- a/target/linux/ar7/patches-3.3/920-ar7part.patch +++ b/target/linux/ar7/patches-3.3/920-ar7part.patch @@ -15,7 +15,7 @@ #ifndef SQUASHFS_MAGIC #define SQUASHFS_MAGIC 0x73717368 -@@ -45,6 +48,10 @@ struct ar7_bin_rec { +@@ -45,12 +48,16 @@ struct ar7_bin_rec { unsigned int address; }; @@ -26,23 +26,85 @@ static int create_mtd_partitions(struct mtd_info *master, struct mtd_partition **pparts, struct mtd_part_parser_data *data) + { + struct ar7_bin_rec header; +- unsigned int offset; ++ unsigned int offset, mtd_start, mtd_end; + size_t len; + unsigned int pre_size = master->erasesize, post_size = 0; + unsigned int root_offset = ROOT_OFFSET; @@ -58,6 +65,16 @@ static int create_mtd_partitions(struct int retries = 10; struct mtd_partition *ar7_parts; -+ const char *prod_id ; -+ prod_id = prom_getenv("ProductID"); -+ if(prod_id && -+ (strcmp(prod_id, "CYWL")==0 || -+ strcmp(prod_id, "CYWM")==0 || -+ strcmp(prod_id, "CYLM")==0 || -+ strcmp(prod_id, "CYLL")==0)){ ++ const char *prom_str = prom_getenv("ProductID"); ++ char mtd_name[] = "mtd1"; ++ if(prom_str && ++ (strcmp(prom_str, "CYWL")==0 || ++ strcmp(prom_str, "CYWM")==0 || ++ strcmp(prom_str, "CYLM")==0 || ++ strcmp(prom_str, "CYLL")==0)){ + return create_titan_partitions(master, pparts, data); + } + ar7_parts = kzalloc(sizeof(*ar7_parts) * AR7_PARTS, GFP_KERNEL); if (!ar7_parts) return -ENOMEM; +@@ -86,34 +103,39 @@ static int create_mtd_partitions(struct + + pre_size = offset; + +- if (!ar7_parts[1].offset) { +- ar7_parts[1].offset = master->size - master->erasesize; +- post_size = master->erasesize; +- } +- + switch (header.checksum) { +- case LOADER_MAGIC1: +- while (header.length) { +- offset += sizeof(header) + header.length; +- mtd_read(master, offset, sizeof(header), &len, +- (uint8_t *)&header); +- } +- root_offset = offset + sizeof(header) + 4; +- break; + case LOADER_MAGIC2: ++ for (retries = 0; retries <= 9; retries++) { ++ mtd_name[3] = '0' + retries; ++ prom_str = prom_getenv(mtd_name); ++ if (prom_str == NULL) ++ continue; ++ sscanf(prom_str, "%i,%i", &mtd_start, &mtd_end); ++ if (pre_size == (mtd_start & 0x1ffffff)) { ++ ar7_parts[1].offset = mtd_end &= 0x1ffffff; ++ ar7_parts[1].size = post_size = master->size - mtd_end; ++ break; ++ } ++ } ++ case LOADER_MAGIC1: ++ root_offset = (header.checksum == LOADER_MAGIC1) ? 4 : 0; + while (header.length) { + offset += sizeof(header) + header.length; + mtd_read(master, offset, sizeof(header), &len, + (uint8_t *)&header); + } +- root_offset = offset + sizeof(header) + 4 + 0xff; +- root_offset &= ~(uint32_t)0xff; ++ root_offset += offset + sizeof(header); + break; + default: + printk(KERN_WARNING "Unknown magic: %08x\n", header.checksum); + break; + } + ++ if (!ar7_parts[1].offset) { ++ post_size = master->erasesize; ++ ar7_parts[1].offset = master->size - post_size; ++ } ++ + mtd_read(master, root_offset, sizeof(header), &len, (u8 *)&header); + if (header.checksum != SQUASHFS_MAGIC) { + root_offset += master->erasesize - 1; --- a/drivers/mtd/titanpart.c +++ b/drivers/mtd/titanpart.c @@ -149,7 +149,7 @@ static void titan_add_partition(char * e diff --git a/target/linux/ar7/patches-3.3/925-actiontec_leds.patch b/target/linux/ar7/patches-3.3/925-actiontec_leds.patch new file mode 100644 index 000000000..0203dd01c --- /dev/null +++ b/target/linux/ar7/patches-3.3/925-actiontec_leds.patch @@ -0,0 +1,95 @@ +--- a/arch/mips/ar7/platform.c ++++ b/arch/mips/ar7/platform.c +@@ -462,31 +462,22 @@ static struct gpio_led fb_fon_leds[] = { + }, + }; + +-static struct gpio_led gt701_leds[] = { ++static struct gpio_led actiontec_leds[] = { + { + .name = "inet:green", + .gpio = 13, +- .active_low = 1, +- }, +- { +- .name = "usb", +- .gpio = 12, +- .active_low = 1, + }, + { + .name = "inet:red", + .gpio = 9, +- .active_low = 1, + }, + { +- .name = "power:red", ++ .name = "power:green", + .gpio = 7, +- .active_low = 1, + }, + { +- .name = "power:green", ++ .name = "power:red", + .gpio = 8, +- .active_low = 1, + .default_trigger = "default-on", + }, + { +@@ -494,6 +485,44 @@ static struct gpio_led gt701_leds[] = { + .gpio = 10, + .active_low = 1, + }, ++ { ++ .name = "wifi", ++ .gpio = 6, ++ .active_low = 1, ++ }, ++ { ++ .name = "wifi:red", ++ .gpio = 3, ++ }, ++ { ++ .name = "standby", ++ .gpio = 4, ++ }, ++ { ++ .name = "wps", ++ .gpio = 16, ++ .active_low = 1, ++ }, ++ { ++ .name = "usb", ++ .gpio = 12, ++ .active_low = 1, ++ }, ++ { ++ .name = "voip", ++ .gpio = 15, ++ .active_low = 1, ++ }, ++ { ++ .name = "line1", ++ .gpio = 23, ++ .active_low = 1, ++ }, ++ { ++ .name = "line2", ++ .gpio = 25, ++ .active_low = 1, ++ }, + }; + + static struct gpio_led_platform_data ar7_led_data; +@@ -537,9 +566,9 @@ static void __init detect_leds(void) + } else if (strstr(prid, "CYWM") || strstr(prid, "CYWL")) { + ar7_led_data.num_leds = ARRAY_SIZE(titan_leds); + ar7_led_data.leds = titan_leds; +- } else if (strstr(prid, "GT701")) { +- ar7_led_data.num_leds = ARRAY_SIZE(gt701_leds); +- ar7_led_data.leds = gt701_leds; ++ } else if (strstr(prid, "GT7") || strstr(prid, "PK5000")) { ++ ar7_led_data.num_leds = ARRAY_SIZE(actiontec_leds); ++ ar7_led_data.leds = actiontec_leds; + } + } + diff --git a/target/linux/ar7/patches-3.3/972-cpmac_fixup.patch b/target/linux/ar7/patches-3.3/972-cpmac_fixup.patch index b1eb081c9..456e9b379 100644 --- a/target/linux/ar7/patches-3.3/972-cpmac_fixup.patch +++ b/target/linux/ar7/patches-3.3/972-cpmac_fixup.patch @@ -1,63 +1,46 @@ --- a/arch/mips/ar7/platform.c +++ b/arch/mips/ar7/platform.c -@@ -33,7 +33,6 @@ - #include <linux/string.h> - #include <linux/etherdevice.h> - #include <linux/phy.h> --#include <linux/phy_fixed.h> - #include <linux/gpio.h> - #include <linux/clk.h> - -@@ -248,12 +247,6 @@ static struct resource cpmac_high_res[] - }, - }; - --static struct fixed_phy_status fixed_phy_status __initdata = { -- .link = 1, -- .speed = 100, -- .duplex = 1, --}; -- - static struct plat_cpmac_data cpmac_low_data = { - .reset_bit = 17, - .power_bit = 20, -@@ -680,26 +673,18 @@ static int __init ar7_register_devices(v +@@ -709,26 +709,23 @@ static int __init ar7_register_devices(v } if (ar7_has_high_cpmac()) { -- res = fixed_phy_add(PHY_POLL, cpmac_high.id, &fixed_phy_status); ++ cpmac_get_mac(0, cpmac_high_data.dev_addr); ++ + res = fixed_phy_add(PHY_POLL, cpmac_high.id, &fixed_phy_status); - if (!res) { - cpmac_get_mac(1, cpmac_high_data.dev_addr); -- ++ if (!res) ++ pr_warning("unable to register fixed phy for cpmac-high: %d\n", res); + - res = platform_device_register(&cpmac_high); - if (res) - pr_warning("unable to register cpmac-high: %d\n", res); - } else - pr_warning("unable to add cpmac-high phy: %d\n", res); - } else -- cpmac_low_data.phy_mask = 0xffffffff; -+ cpmac_get_mac(1, cpmac_high_data.dev_addr); - ++ res = platform_device_register(&cpmac_high); ++ if (res) ++ pr_warning("unable to register cpmac-high: %d\n", res); ++ cpmac_get_mac(1, cpmac_low_data.dev_addr); ++ } else { + cpmac_low_data.phy_mask = 0xffffffff; +- - res = fixed_phy_add(PHY_POLL, cpmac_low.id, &fixed_phy_status); - if (!res) { -- cpmac_get_mac(0, cpmac_low_data.dev_addr); + cpmac_get_mac(0, cpmac_low_data.dev_addr); - res = platform_device_register(&cpmac_low); -+ res = platform_device_register(&cpmac_high); - if (res) +- if (res) - pr_warning("unable to register cpmac-low: %d\n", res); -+ pr_warning("unable to register cpmac-high: %d\n", res); - } else +- } else - pr_warning("unable to add cpmac-low phy: %d\n", res); -+ cpmac_low_data.phy_mask = 0xffffffff; -+ -+ cpmac_get_mac(0, cpmac_low_data.dev_addr); ++ } + res = platform_device_register(&cpmac_low); + if (res) + pr_warning("unable to register cpmac-low: %d\n", res); detect_leds(); res = platform_device_register(&ar7_gpio_leds); -@@ -712,8 +697,10 @@ static int __init ar7_register_devices(v +@@ -741,8 +738,10 @@ static int __init ar7_register_devices(v /* Register watchdog only if enabled in hardware */ bootcr = ioremap_nocache(AR7_REGS_DCL, 4); @@ -118,16 +101,7 @@ cpmac_write(priv->regs, CPMAC_MAX_LENGTH, CPMAC_SKB_SIZE); cpmac_write(priv->regs, CPMAC_UNICAST_CLEAR, 0xff); cpmac_write(priv->regs, CPMAC_RX_INT_CLEAR, 0xff); -@@ -1108,8 +1103,6 @@ static const struct net_device_ops cpmac - .ndo_set_mac_address = eth_mac_addr, - }; - --static int external_switch; -- - static int __devinit cpmac_probe(struct platform_device *pdev) - { - int rc, phy_id; -@@ -1121,25 +1114,18 @@ static int __devinit cpmac_probe(struct +@@ -1121,25 +1116,19 @@ static int __devinit cpmac_probe(struct pdata = pdev->dev.platform_data; @@ -152,17 +126,46 @@ + break; } - if (phy_id == PHY_MAX_ADDR) { +- if (phy_id == PHY_MAX_ADDR) { - dev_err(&pdev->dev, "no PHY present, falling back " - "to switch on MDIO bus 0\n"); - strncpy(mdio_bus_id, "fixed-0", MII_BUS_ID_SIZE); /* fixed phys bus */ -- phy_id = pdev->id; -+ printk(KERN_ERR "cpmac: No PHY present\n"); -+ return -ENXIO; ++ if (phy_id == PHY_MAX_ADDR && pdev->id == 1) { ++ printk(KERN_ERR "cpmac: No PHY present, using fixed PHY\n"); + phy_id = pdev->id; ++ strncpy(mdio_bus_id, "fixed-0", MII_BUS_ID_SIZE); } dev = alloc_etherdev_mq(sizeof(*priv), CPMAC_QUEUES); -@@ -1228,6 +1214,7 @@ int __devinit cpmac_init(void) +@@ -1178,6 +1167,13 @@ static int __devinit cpmac_probe(struct + snprintf(priv->phy_name, MII_BUS_ID_SIZE, PHY_ID_FMT, + mdio_bus_id, phy_id); + ++ rc = register_netdev(dev); ++ if (rc) { ++ printk(KERN_ERR "cpmac: error %i registering device %s\n", rc, ++ dev->name); ++ goto fail; ++ } ++ + priv->phy = phy_connect(dev, priv->phy_name, cpmac_adjust_link, 0, + PHY_INTERFACE_MODE_MII); + +@@ -1189,13 +1185,6 @@ static int __devinit cpmac_probe(struct + goto fail; + } + +- rc = register_netdev(dev); +- if (rc) { +- printk(KERN_ERR "cpmac: error %i registering device %s\n", rc, +- dev->name); +- goto fail; +- } +- + if (netif_msg_probe(priv)) { + printk(KERN_INFO + "cpmac: device %s (regs: %p, irq: %d, phy: %s, " +@@ -1228,6 +1217,7 @@ int __devinit cpmac_init(void) { u32 mask; int i, res; @@ -170,7 +173,7 @@ cpmac_mii = mdiobus_alloc(); if (cpmac_mii == NULL) -@@ -1251,14 +1238,14 @@ int __devinit cpmac_init(void) +@@ -1251,31 +1241,51 @@ int __devinit cpmac_init(void) ar7_gpio_disable(26); ar7_gpio_disable(27); @@ -190,14 +193,18 @@ cpmac_mii->reset(cpmac_mii); -@@ -1270,10 +1257,22 @@ int __devinit cpmac_init(void) + for (i = 0; i < 300; i++) { + mask = cpmac_read(cpmac_mii->priv, CPMAC_MDIO_ALIVE); ++ mask &= ar7_is_titan()? ~(0x80000000 | 0x40000000) : ~(0x80000000); + if (mask) + break; + else msleep(10); } - mask &= 0x7fffffff; -+ mask &= ar7_is_titan()? ~(0x80000000 | 0x40000000) : ~(0x80000000); if (mask & (mask - 1)) { -- external_switch = 1; + external_switch = 1; - mask = 0; + if (!ar7_has_high_cpmac()) { + if (ar7_is_titan()) { @@ -215,4 +222,13 @@ + } } ++ if (external_switch) ++ printk(KERN_INFO "EXTERNAL SWITCH!!!\n"); ++ else if (mask) ++ printk(KERN_INFO "EXTERNAL PHY!!!\n"); ++ else ++ printk(KERN_INFO "INTERNAL PHY!!!\n"); ++ if (ar7_is_titan()) + cpmac_mii->phy_mask = ~(mask | 0x80000000 | 0x40000000); + else |