Fixes from Compex to make OpenWrt run on WP54AG, thanks !

SVN-Revision: 6817
lede-17.01
Florian Fainelli 2007-04-02 09:34:39 +00:00
parent 4b5e7678f6
commit 3c9a0598e9
4 changed files with 103 additions and 7 deletions

View File

@ -117,8 +117,6 @@ CONFIG_INET_TCP_DIAG=y
CONFIG_INET_TUNNEL=y CONFIG_INET_TUNNEL=y
CONFIG_INET_XFRM_TUNNEL=y CONFIG_INET_XFRM_TUNNEL=y
CONFIG_INITRAMFS_SOURCE="" CONFIG_INITRAMFS_SOURCE=""
CONFIG_INOTIFY=y
CONFIG_INOTIFY_USER=y
CONFIG_INPUT=y CONFIG_INPUT=y
# CONFIG_INPUT_EVDEV is not set # CONFIG_INPUT_EVDEV is not set
CONFIG_IOSCHED_CFQ=y CONFIG_IOSCHED_CFQ=y
@ -160,7 +158,7 @@ CONFIG_LEGACY_PTY_COUNT=256
CONFIG_MAGIC_SYSRQ=y CONFIG_MAGIC_SYSRQ=y
# CONFIG_MII is not set # CONFIG_MII is not set
# CONFIG_MINIX_FS is not set # CONFIG_MINIX_FS is not set
CONFIG_MINI_FO=y # CONFIG_MINI_FO is not set
CONFIG_MIPS=y CONFIG_MIPS=y
CONFIG_MIPS_ADM5120=y CONFIG_MIPS_ADM5120=y
CONFIG_MIPS_ADM5120_ENET=y CONFIG_MIPS_ADM5120_ENET=y
@ -199,11 +197,13 @@ CONFIG_MODULE_FORCE_UNLOAD=y
CONFIG_MTD=y CONFIG_MTD=y
# CONFIG_MTD_ABSENT is not set # CONFIG_MTD_ABSENT is not set
CONFIG_MTD_ADM5120=y CONFIG_MTD_ADM5120=y
CONFIG_MTD_BLOCK=y # CONFIG_MTD_BLOCK is not set
# CONFIG_MTD_BLOCK2MTD is not set # CONFIG_MTD_BLOCK2MTD is not set
# CONFIG_MTD_BLOCK_RO is not set
CONFIG_MTD_CFI=y CONFIG_MTD_CFI=y
# CONFIG_MTD_CFI_ADV_OPTIONS is not set # CONFIG_MTD_CFI_ADV_OPTIONS is not set
CONFIG_MTD_CFI_AMDSTD=y CONFIG_MTD_CFI_AMDSTD=y
CONFIG_MTD_CFI_AMDSTD_FORCE_BOTTOM_BOOT=y
CONFIG_MTD_CFI_I1=y CONFIG_MTD_CFI_I1=y
CONFIG_MTD_CFI_I2=y CONFIG_MTD_CFI_I2=y
# CONFIG_MTD_CFI_I4 is not set # CONFIG_MTD_CFI_I4 is not set
@ -213,8 +213,8 @@ CONFIG_MTD_CFI_I2=y
CONFIG_MTD_CFI_UTIL=y CONFIG_MTD_CFI_UTIL=y
CONFIG_MTD_CHAR=y CONFIG_MTD_CHAR=y
CONFIG_MTD_CMDLINE_PARTS=y CONFIG_MTD_CMDLINE_PARTS=y
# CONFIG_MTD_COMPLEX_MAPPINGS is not set CONFIG_MTD_COMPLEX_MAPPINGS=y
CONFIG_MTD_CONCAT=y CONFIG_MTD_CONCAT=m
# CONFIG_MTD_DEBUG is not set # CONFIG_MTD_DEBUG is not set
# CONFIG_MTD_DOC2000 is not set # CONFIG_MTD_DOC2000 is not set
# CONFIG_MTD_DOC2001 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_MAP_BANK_WIDTH_8 is not set
# CONFIG_MTD_MTDRAM is not set # CONFIG_MTD_MTDRAM is not set
CONFIG_MTD_MYLOADER_PARTS=y 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_OBSOLETE_CHIPS is not set
# CONFIG_MTD_ONENAND is not set # CONFIG_MTD_ONENAND is not set
CONFIG_MTD_PARTITIONS=y CONFIG_MTD_PARTITIONS=y
# CONFIG_MTD_PCI is not set
# CONFIG_MTD_PHRAM is not set # CONFIG_MTD_PHRAM is not set
# CONFIG_MTD_PHYSMAP is not set # CONFIG_MTD_PHYSMAP is not set
# CONFIG_MTD_PLATRAM is not set # CONFIG_MTD_PLATRAM is not set

View File

@ -57,6 +57,15 @@ extern int parse_myloader_partitions(struct mtd_info *master,
struct mtd_partition **pparts, struct mtd_partition **pparts,
unsigned long origin); 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_MAGIC 0x30524448 /* "HDR0" */
#define TRX_VERSION 1 #define TRX_VERSION 1
#define TRX_MAX_LEN 0x3A0000 #define TRX_MAX_LEN 0x3A0000
@ -98,6 +107,52 @@ static struct mtd_partition adm5120_cfe_parts[] = {
{ name: NULL, }, { 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 static int __init
find_cfe_size(struct mtd_info *mtd, size_t size) find_cfe_size(struct mtd_info *mtd, size_t size)
{ {
@ -402,6 +457,9 @@ int __init init_adm5120_map(void)
return -EIO; return -EIO;
} }
simple_map_init(&adm5120_map); 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))) { if (!(adm5120_mtd = do_map_probe("cfi_probe", &adm5120_map))) {
printk("Failed to do_map_probe\n"); printk("Failed to do_map_probe\n");

View File

@ -69,7 +69,7 @@ struct adm5120_dma {
u32 status; u32 status;
} __attribute__ ((packed)); } __attribute__ ((packed));
#define ADM5120_DMA_MASK 0x00ffffff #define ADM5120_DMA_MASK 0x01ffffff
#define ADM5120_DMA_OWN 0x80000000 /* buffer owner */ #define ADM5120_DMA_OWN 0x80000000 /* buffer owner */
#define ADM5120_DMA_RINGEND 0x10000000 /* Last in DMA ring */ #define ADM5120_DMA_RINGEND 0x10000000 /* Last in DMA ring */

View File

@ -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 "