these patches are slight modification of Fiach Antaw's original gs2_support.diff he used to successfully port GlobeSurfer 2
i have changed boardtype and boardrev variables to the ones of globesurfer3. Index: target/linux/brcm47xx/image/lzma-loader/src/decompress.c =================================================================== --- target/linux/brcm47xx/image/lzma-loader/src/decompress.c (revision 35832) +++ target/linux/brcm47xx/image/lzma-loader/src/decompress.c (working copy) @@ -90,6 +90,9 @@ #define EDIMAX_PS_HEADER_MAGIC 0x36315350 /* "PS16" */ #define EDIMAX_PS_HEADER_LEN 0xc /* 12 bytes long for edimax header */ +#define OPENRG_HEADER_MAGIC 0xBEBAEDFE /* 'FEEDBABE' */ +#define OPENRG_HEADER_LEN 0x94 + /* beyound the image end, size not known in advance */ extern unsigned char workspace[]; @@ -139,11 +142,14 @@ /* look for trx header, 32-bit data access */ for (data = ((unsigned char *) KSEG1ADDR(BCM4710_FLASH)); ((struct trx_header *)data)->magic != TRX_MAGIC && - ((struct trx_header *)data)->magic != EDIMAX_PS_HEADER_MAGIC; + ((struct trx_header *)data)->magic != EDIMAX_PS_HEADER_MAGIC && + ((struct trx_header *)data)->magic != OPENRG_HEADER_MAGIC; data += 65536); if (((struct trx_header *)data)->magic == EDIMAX_PS_HEADER_MAGIC) data += EDIMAX_PS_HEADER_LEN; + if (((struct trx_header *)data)->magic == OPENRG_HEADER_MAGIC) + data += OPENRG_HEADER_LEN; /* compressed kernel is in the partition 0 or 1 */ if (((struct trx_header *)data)->offsets[1] > 65536) data += ((struct trx_header *)data)->offsets[0]; Index: target/linux/brcm47xx/base-files/etc/init.d/netconfig =================================================================== --- target/linux/brcm47xx/base-files/etc/init.d/netconfig (revision 35832) +++ target/linux/brcm47xx/base-files/etc/init.d/netconfig (working copy) @@ -225,6 +225,12 @@ c["vlan1ports"] = "" c["vlan2ports"] = "" } + if (model == "Option GlobeSurfer III") { + c["lan_ifname"] = "eth0.1" + c["wan_ifname"] = "" + c["vlan1ports"] = "0 1 2 3 4 5u" + c["vlan2ports"] = "" + } if (c["vlan1ports"] || c["vlan2ports"]) { print "#### VLAN configuration " Index: target/linux/brcm47xx/patches-3.6/260-MIPS-BCM47XX-add-board-detection.patch =================================================================== --- target/linux/brcm47xx/patches-3.6/260-MIPS-BCM47XX-add-board-detection.patch (revision 35832) +++ target/linux/brcm47xx/patches-3.6/260-MIPS-BCM47XX-add-board-detection.patch (working copy) @@ -8,7 +8,7 @@ obj-$(CONFIG_BCM47XX_SSB) += wgt634u.o --- /dev/null +++ b/arch/mips/bcm47xx/board.c -@@ -0,0 +1,223 @@ +@@ -0,0 +1,236 @@ +#include <linux/export.h> +#include <linux/string.h> +#include <bcm47xx_board.h> @@ -127,6 +127,11 @@ + { {0}, 0}, +}; + ++static const struct bcm47xx_board_type_list bcm47xx_board_list_board_type_rev[] = { ++ {{BCM47XX_BOARD_OPTION_GS3, "Option GlobeSurfer III"}, "0x048e","0x10"}, ++ { {0}, 0}, ++}; ++ +static const struct bcm47xx_board_type bcm47xx_board_unknown[] = { + {BCM47XX_BOARD_UNKNOWN, "Unknown Board"}, +}; @@ -200,6 +205,14 @@ + return &e->board; + } + } ++ ++ if (bcm47xx_nvram_getenv("boardtype", buf1, sizeof(buf1)) >= 0 && ++ bcm47xx_nvram_getenv("boardrev", buf2, sizeof(buf2)) >= 0) { ++ for (e = bcm47xx_board_list_board_type_rev; e->value1; e++) { ++ if (!strcmp(buf1, e->value1) && !strcmp(buf2, e->value2)) ++ return &e->board; ++ } ++ } + return bcm47xx_board_unknown; +} + @@ -234,7 +247,7 @@ +EXPORT_SYMBOL(bcm47xx_board_get_name); --- /dev/null +++ b/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h -@@ -0,0 +1,91 @@ +@@ -0,0 +1,93 @@ +#ifndef __BCM47XX_BOARD_H +#define __BCM47XX_BOARD_H + @@ -315,6 +328,8 @@ + BCM47XX_BOARD_NETGEAR_WNR3500V2VC, + BCM47XX_BOARD_NETGEAR_WNR834BV2, + ++ BCM47XX_BOARD_OPTION_GS3, ++ + /* TODO */ + BCM47XX_BOARD_SIMPLETECH_SIMPLESHARE, + Index: target/linux/brcm47xx/patches-3.6/050-mtd-add-bcm47xx-part-parser.patch =================================================================== --- target/linux/brcm47xx/patches-3.6/050-mtd-add-bcm47xx-part-parser.patch (revision 35832) +++ target/linux/brcm47xx/patches-3.6/050-mtd-add-bcm47xx-part-parser.patch (working copy) @@ -26,7 +26,7 @@ obj-$(CONFIG_MTD_CHAR) += mtdchar.o --- /dev/null +++ b/drivers/mtd/bcm47xxpart.c -@@ -0,0 +1,504 @@ +@@ -0,0 +1,560 @@ +/* + * Copyright (C) 2006 Felix Fietkau <n...@openwrt.org> + * Copyright (C) 2005 Waldemar Brodkorb <w...@openwrt.org> @@ -106,6 +106,24 @@ +#define EDIMAX_PS_HEADER_MAGIC 0x36315350 /* "PS16" */ +#define EDIMAX_PS_HEADER_LEN 0xc /* 12 bytes long for edimax header */ + ++/* similarly, OpenRG-based boards use additional headers ++ * as part of their flash partitioning scheme, ++ * which unfortunately include a checksum and length field ++ */ ++ ++/* Note: All fields are in big-endian */ ++struct openrg_header { ++ u32 magic; /* 0xFEEDBABE */ ++ u32 len; /* Length of file excluding header */ ++ u32 checksum; /* 32-bit sum of all bytes in file and header, excluding checksum */ ++ u32 counter; /* Unknown */ ++ u32 start_offset; /* Unknown */ ++ u8 name[0x80]; /* Names the file for the CFE flash_layout command */ ++}; ++ ++#define OPENRG_HEADER_MAGIC be32_to_cpu(0xFEEDBABE) ++#define OPENRG_HEADER_LEN sizeof(struct openrg_header) ++ +#define NVRAM_SPACE 0x8000 + +static int @@ -140,6 +158,13 @@ + } else { + pr_notice("Found edimax header\n"); + } ++ } else if (le32_to_cpu(trx->magic) == OPENRG_HEADER_MAGIC) { ++ if (mtd_read(mtd, off + OPENRG_HEADER_LEN, ++ sizeof(buf), &len, buf) || len != sizeof(buf)) { ++ continue; ++ } else { ++ pr_notice("Found OpenRG header\n"); ++ } + } + + /* found a TRX header */ @@ -259,11 +284,12 @@ +find_root(struct mtd_info *mtd, struct mtd_partition *part) +{ + struct trx_header trx, *trx2; ++ struct openrg_header *org; + unsigned char buf[512], *block; + int off, blocksize, trxoff = 0; -+ u32 i, crc = ~0; ++ u32 i, j, sum = 0, crc = ~0; + size_t len; -+ bool edimax = false; ++ bool openrg = false; + + blocksize = mtd->erasesize; + if (blocksize < 0x10000) @@ -279,7 +305,7 @@ + len != sizeof(trx)) + continue; + -+ /* found an edimax header */ ++ /* found an edimax/OpenRG header */ + if (le32_to_cpu(trx.magic) == EDIMAX_PS_HEADER_MAGIC) { + /* read the correct trx header */ + if (mtd_read(mtd, off + EDIMAX_PS_HEADER_LEN, @@ -288,8 +314,19 @@ + continue; + } else { + pr_notice("Found an edimax ps header\n"); -+ edimax = true; ++ trxoff = EDIMAX_PS_HEADER_LEN; + } ++ } else if (le32_to_cpu(trx.magic) == OPENRG_HEADER_MAGIC) { ++ /* read the correct trx header */ ++ if (mtd_read(mtd, off + OPENRG_HEADER_LEN, ++ sizeof(trx), &len, (char *) &trx) || ++ len != sizeof(trx)) { ++ continue; ++ } else { ++ pr_notice("Found an OpenRG header\n"); ++ openrg = true; ++ trxoff = OPENRG_HEADER_LEN; ++ } + } + + /* found a TRX header */ @@ -299,11 +336,8 @@ + part->size = le32_to_cpu(trx.len); + + part->size -= part->offset; ++ off += trxoff; + part->offset += off; -+ if (edimax) { -+ off += EDIMAX_PS_HEADER_LEN; -+ trxoff = EDIMAX_PS_HEADER_LEN; -+ } + + goto found; + } @@ -333,6 +367,13 @@ + if (mtd_read(mtd, off + i, sizeof(buf), &len, buf) || len != sizeof(buf)) + return 0; + crc = crc32_le(crc, buf, min(sizeof(buf), trx.len - i)); ++ ++ /* Also generate the openrg header checksum if needed */ ++ if (openrg) { ++ for (j = 0; j < min(sizeof(buf), trx.len - i); j++) { ++ sum += buf[j]; ++ } ++ } + } + trx.crc32 = crc; + @@ -350,6 +391,21 @@ + + /* Write updated trx header to the flash */ + memcpy(block + trxoff, &trx, sizeof(trx)); ++ ++ /* fix OpenRG length and checksum */ ++ if (openrg) { ++ pr_notice("Fixing OpenRG header.\n"); ++ org = (struct openrg_header *)block; ++ org->len = cpu_to_be32(trx.len); ++ org->checksum = 0; ++ ++ /* Update the openrg checksum with TRX and openrg header values */ ++ for (i = 0; i < OPENRG_HEADER_LEN + (u32)&(((struct trx_header *)NULL)->flag_version); i++) { ++ sum += block[i]; ++ } ++ org->checksum = cpu_to_be32(sum); ++ } ++ + if (mtd->_unlock) + mtd->_unlock(mtd, off - trxoff, mtd->erasesize); + erase_write(mtd, off - trxoff, mtd->erasesize, block); Index: target/linux/brcm47xx/patches-3.8/260-MIPS-BCM47XX-add-board-detection.patch =================================================================== --- target/linux/brcm47xx/patches-3.8/260-MIPS-BCM47XX-add-board-detection.patch (revision 35832) +++ target/linux/brcm47xx/patches-3.8/260-MIPS-BCM47XX-add-board-detection.patch (working copy) @@ -127,6 +127,11 @@ + { {0}, 0}, +}; + ++static const struct bcm47xx_board_type_list bcm47xx_board_list_boardtype_rev[] = { ++ {{BCM47XX_BOARD_OPTION_GS3, "Option GlobeSurfer III"}, "0x048e", "0x10"}, ++ { {0}, 0}, ++}; ++ +static const struct bcm47xx_board_type bcm47xx_board_unknown[] = { + {BCM47XX_BOARD_UNKNOWN, "Unknown Board"}, +}; @@ -200,6 +205,14 @@ + return &e->board; + } + } ++ ++ if (bcm47xx_nvram_getenv("boardtype", buf1, sizeof(buf1)) >= 0 && ++ bcm47xx_nvram_getenv("bootrev", buf2, sizeof(buf2)) >= 0) { ++ for (e = bcm47xx_board_list_boardtype_rev; e->value1; e++) { ++ if (!strcmp(buf1, e->value1) && !strcmp(buf2, e->value2)) ++ return &e->board; ++ } ++ } + return bcm47xx_board_unknown; +} + @@ -315,6 +328,8 @@ + BCM47XX_BOARD_NETGEAR_WNR3500V2VC, + BCM47XX_BOARD_NETGEAR_WNR834BV2, + ++ BCM47XX_BOARD_OPTION_GS3, ++ + /* TODO */ + BCM47XX_BOARD_SIMPLETECH_SIMPLESHARE, + Index: package/broadcom-diag/src/diag.c =================================================================== --- package/broadcom-diag/src/diag.c (revision 35832) +++ package/broadcom-diag/src/diag.c (working copy) @@ -154,6 +154,9 @@ /* Edimax */ PS1208MFG, + + /* Option */ + GS3, }; static void __init bcm4780_init(void) { @@ -194,6 +197,19 @@ bcm47xx_gpio_out(pin, pin); } +static void __init option_gs3_init(void) { + /* unset pin 7 (disables LCD) */ + int pin = 1 << 7; + bcm47xx_gpio_outen(pin, pin); + bcm47xx_gpio_control(pin, 0); + bcm47xx_gpio_out(pin, 0); + /* unset pin 9 (enables 3G modem) */ + pin = 1 << 9; + bcm47xx_gpio_outen(pin, pin); + bcm47xx_gpio_control(pin, 0); + bcm47xx_gpio_out(pin, 0); +} + static struct platform_t __initdata platforms[] = { /* Linksys */ [WAP54GV1] = { @@ -1090,6 +1106,26 @@ { .name = "wlan", .gpio = 1 << 0, .polarity = NORMAL }, }, }, + /* Option */ + [GS3] = { + .name = "Option GlobeSurfer III", + .buttons = { + /* The power button latches/toggles, but apparently doesn't do so mechanically */ + { .name = "power", .gpio = 1 << 12 }, + { .name = "display", .gpio = 1 << 14 }, + { .name = "umts", .gpio = 1 << 15 }, + /* So far I haven't been able to figure out how the reset button works */ + }, + .leds = { + /* There are no LEDs on this device */ + }, + /* Also of note: + * GPIO 7 enables/disables the LCD + * GPIO 9 enables/disables the modem + * We use a custom init routine to enable the modem and (for now) disable the LCD. + */ + .platform_init = option_gs3_init, + }, }; static struct platform_t __init *platform_detect_legacy(void) @@ -1333,6 +1369,8 @@ return &platforms[WNDR3400V1]; case BCM47XX_BOARD_NETGEAR_WNDR3700V3: return &platforms[WNDR3700V3]; + case BCM47XX_BOARD_OPTION_GS3: + return &platforms[GS3]; case BCM47XX_BOARD_UNKNOWN: case BCM47XX_BOARD_NON: printk(MODULE_NAME ": unknown board found, try legacy detect\n");
_______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel