diff options
author | Florian Fainelli <florian@openwrt.org> | 2007-04-02 09:34:39 +0000 |
---|---|---|
committer | Florian Fainelli <florian@openwrt.org> | 2007-04-02 09:34:39 +0000 |
commit | 3c9a0598e9c42a27150b6a936fee029b6b8be0aa (patch) | |
tree | 56e79058fb481180cd366429c9a98fa079e12810 /target/linux/adm5120-2.6 | |
parent | 4b5e7678f6cbf43e8ed8188bb17ca0f4087b090f (diff) | |
download | upstream-3c9a0598e9c42a27150b6a936fee029b6b8be0aa.tar.gz upstream-3c9a0598e9c42a27150b6a936fee029b6b8be0aa.tar.bz2 upstream-3c9a0598e9c42a27150b6a936fee029b6b8be0aa.zip |
Fixes from Compex to make OpenWrt run on WP54AG, thanks !
SVN-Revision: 6817
Diffstat (limited to 'target/linux/adm5120-2.6')
4 files changed, 103 insertions, 7 deletions
diff --git a/target/linux/adm5120-2.6/config/default b/target/linux/adm5120-2.6/config/default index 93304bcf34..cf45c9fd7e 100644 --- a/target/linux/adm5120-2.6/config/default +++ b/target/linux/adm5120-2.6/config/default @@ -117,8 +117,6 @@ CONFIG_INET_TCP_DIAG=y CONFIG_INET_TUNNEL=y CONFIG_INET_XFRM_TUNNEL=y CONFIG_INITRAMFS_SOURCE="" -CONFIG_INOTIFY=y -CONFIG_INOTIFY_USER=y CONFIG_INPUT=y # CONFIG_INPUT_EVDEV is not set CONFIG_IOSCHED_CFQ=y @@ -160,7 +158,7 @@ CONFIG_LEGACY_PTY_COUNT=256 CONFIG_MAGIC_SYSRQ=y # CONFIG_MII is not set # CONFIG_MINIX_FS is not set -CONFIG_MINI_FO=y +# CONFIG_MINI_FO is not set CONFIG_MIPS=y CONFIG_MIPS_ADM5120=y CONFIG_MIPS_ADM5120_ENET=y @@ -199,11 +197,13 @@ CONFIG_MODULE_FORCE_UNLOAD=y CONFIG_MTD=y # CONFIG_MTD_ABSENT is not set CONFIG_MTD_ADM5120=y -CONFIG_MTD_BLOCK=y +# CONFIG_MTD_BLOCK is not set # CONFIG_MTD_BLOCK2MTD is not set +# CONFIG_MTD_BLOCK_RO is not set CONFIG_MTD_CFI=y # CONFIG_MTD_CFI_ADV_OPTIONS is not set CONFIG_MTD_CFI_AMDSTD=y +CONFIG_MTD_CFI_AMDSTD_FORCE_BOTTOM_BOOT=y CONFIG_MTD_CFI_I1=y CONFIG_MTD_CFI_I2=y # CONFIG_MTD_CFI_I4 is not set @@ -213,8 +213,8 @@ CONFIG_MTD_CFI_I2=y CONFIG_MTD_CFI_UTIL=y CONFIG_MTD_CHAR=y CONFIG_MTD_CMDLINE_PARTS=y -# CONFIG_MTD_COMPLEX_MAPPINGS is not set -CONFIG_MTD_CONCAT=y +CONFIG_MTD_COMPLEX_MAPPINGS=y +CONFIG_MTD_CONCAT=m # CONFIG_MTD_DEBUG is not set # CONFIG_MTD_DOC2000 is not set # CONFIG_MTD_DOC2001 is not set @@ -229,9 +229,16 @@ CONFIG_MTD_MAP_BANK_WIDTH_4=y # CONFIG_MTD_MAP_BANK_WIDTH_8 is not set # CONFIG_MTD_MTDRAM is not set CONFIG_MTD_MYLOADER_PARTS=y +CONFIG_MTD_NAND=y +# CONFIG_MTD_NAND_DISKONCHIP is not set +# CONFIG_MTD_NAND_ECC_SMC is not set +CONFIG_MTD_NAND_IDS=y +# CONFIG_MTD_NAND_NANDSIM is not set +CONFIG_MTD_NAND_VERIFY_WRITE=y # CONFIG_MTD_OBSOLETE_CHIPS is not set # CONFIG_MTD_ONENAND is not set CONFIG_MTD_PARTITIONS=y +# CONFIG_MTD_PCI is not set # CONFIG_MTD_PHRAM is not set # CONFIG_MTD_PHYSMAP is not set # CONFIG_MTD_PLATRAM is not set diff --git a/target/linux/adm5120-2.6/files/drivers/mtd/maps/adm5120_mtd.c b/target/linux/adm5120-2.6/files/drivers/mtd/maps/adm5120_mtd.c index 426ab67c82..df506d7fa8 100644 --- a/target/linux/adm5120-2.6/files/drivers/mtd/maps/adm5120_mtd.c +++ b/target/linux/adm5120-2.6/files/drivers/mtd/maps/adm5120_mtd.c @@ -57,6 +57,15 @@ extern int parse_myloader_partitions(struct mtd_info *master, struct mtd_partition **pparts, unsigned long origin); +/* Macros for switching flash bank + ADM5120 only support 2MB flash address space + so GPIO5 is used as A20 + */ +#define GPIO_IO ((volatile unsigned long *)0xb20000b8) +#define FLASH_A20_GPIO 5 +#define FLASH_BOUNDARY 0x200000 + + #define TRX_MAGIC 0x30524448 /* "HDR0" */ #define TRX_VERSION 1 #define TRX_MAX_LEN 0x3A0000 @@ -98,6 +107,52 @@ static struct mtd_partition adm5120_cfe_parts[] = { { name: NULL, }, }; + +static void flash_switch_bank(unsigned long addr) +{ + unsigned long val; + + /* Set GPIO as output */ + val = *GPIO_IO | (1 << (FLASH_A20_GPIO+16)); + if ( addr & FLASH_BOUNDARY ) { + val |= 1 << (FLASH_A20_GPIO + 24); + } else { + val &= ~(1 << (FLASH_A20_GPIO + 24)); + } + *GPIO_IO = val; +} + +static map_word adm5120_map_read(struct map_info *map, unsigned long ofs) +{ + flash_switch_bank(ofs); + return inline_map_read(map, ofs); +} + +static void adm5120_map_write(struct map_info *map, const map_word datum, unsigned long ofs) +{ + flash_switch_bank(ofs); + inline_map_write(map, datum, ofs); +} + +static void adm5120_map_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len) +{ + ssize_t tmp; + + if (from < FLASH_BOUNDARY) { + tmp = (len < (FLASH_BOUNDARY - from)) ? len : (FLASH_BOUNDARY - from); + flash_switch_bank(0); + inline_map_copy_from(map, to, from, tmp); + to = (void *)((char *)to + tmp); + from += tmp; + len -= tmp; + } + if (len > 0) { + flash_switch_bank(FLASH_BOUNDARY); + inline_map_copy_from(map, to, from, len); + } + +} + static int __init find_cfe_size(struct mtd_info *mtd, size_t size) { @@ -402,6 +457,9 @@ int __init init_adm5120_map(void) return -EIO; } simple_map_init(&adm5120_map); + adm5120_map.read = adm5120_map_read; + adm5120_map.write = adm5120_map_write; + adm5120_map.copy_from = adm5120_map_copy_from; if (!(adm5120_mtd = do_map_probe("cfi_probe", &adm5120_map))) { printk("Failed to do_map_probe\n"); diff --git a/target/linux/adm5120-2.6/files/drivers/net/adm5120sw.h b/target/linux/adm5120-2.6/files/drivers/net/adm5120sw.h index 09ef9fe394..19388a9064 100644 --- a/target/linux/adm5120-2.6/files/drivers/net/adm5120sw.h +++ b/target/linux/adm5120-2.6/files/drivers/net/adm5120sw.h @@ -69,7 +69,7 @@ struct adm5120_dma { u32 status; } __attribute__ ((packed)); -#define ADM5120_DMA_MASK 0x00ffffff +#define ADM5120_DMA_MASK 0x01ffffff #define ADM5120_DMA_OWN 0x80000000 /* buffer owner */ #define ADM5120_DMA_RINGEND 0x10000000 /* Last in DMA ring */ diff --git a/target/linux/adm5120-2.6/patches/101-mtd-mxflash.patch b/target/linux/adm5120-2.6/patches/101-mtd-mxflash.patch new file mode 100755 index 0000000000..754a91e09f --- /dev/null +++ b/target/linux/adm5120-2.6/patches/101-mtd-mxflash.patch @@ -0,0 +1,31 @@ +--- linux-2.6.19.2/drivers/mtd/chips/Kconfig.old 2007-01-11 03:10:36.000000000 +0800 ++++ linux-2.6.19.2/drivers/mtd/chips/Kconfig 2007-03-29 14:43:32.000000000 +0800 +@@ -199,6 +199,14 @@ + provides support for one of those command sets, used on chips + including the AMD Am29LV320. + ++config MTD_CFI_AMDSTD_FORCE_BOTTOM_BOOT ++ bool "Force bottom boot for Macronix flash chips" ++ depends on MTD_CFI_AMDSTD ++ help ++ Some Macronix flash chips have wrong CFI info, and the driver may ++ detect the type incorrectly. Select this if the chip part number ++ ends with BTC. ++ + config MTD_CFI_STAA + tristate "Support for ST (Advanced Architecture) flash chips" + depends on MTD_GEN_PROBE +--- linux-2.6.19.2/drivers/mtd/chips/cfi_cmdset_0002.c.old 2007-03-22 16:14:56.000000000 +0800 ++++ linux-2.6.19.2/drivers/mtd/chips/cfi_cmdset_0002.c 2007-03-29 14:07:28.000000000 +0800 +@@ -320,6 +320,11 @@ + cfi_tell_features(extp); + #endif + ++#ifdef CONFIG_MTD_CFI_AMDSTD_FORCE_BOTTOM_BOOT ++ extp->TopBottom = 2; ++ bootloc = extp->TopBottom; ++#endif ++ + bootloc = extp->TopBottom; + if ((bootloc != 2) && (bootloc != 3)) { + printk(KERN_WARNING "%s: CFI does not contain boot " |