summaryrefslogtreecommitdiffstats
path: root/target
diff options
context:
space:
mode:
authorjuhosg <juhosg@3c298f89-4303-0410-b956-a3cf2f4a3e73>2007-10-23 12:31:13 +0000
committerjuhosg <juhosg@3c298f89-4303-0410-b956-a3cf2f4a3e73>2007-10-23 12:31:13 +0000
commitf9d0822cd1d8e9966c6b76f4d4f65d32abcef61e (patch)
tree7f45ffd183b263f083bc1a7c5d9e0b2b514ffef6 /target
parent72551879bdbbffda5ce54b4ef3085d4ba4806616 (diff)
[adm5120] fix flash driver, it should work on RB150 as well
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@9418 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target')
-rw-r--r--target/linux/adm5120/files/arch/mips/adm5120/boards/mikrotik.c3
-rw-r--r--target/linux/adm5120/files/drivers/mtd/maps/adm5120-flash.c18
-rw-r--r--target/linux/adm5120/files/include/asm-mips/mach-adm5120/adm5120_platform.h1
3 files changed, 16 insertions, 6 deletions
diff --git a/target/linux/adm5120/files/arch/mips/adm5120/boards/mikrotik.c b/target/linux/adm5120/files/arch/mips/adm5120/boards/mikrotik.c
index 1ed420e0c..855ec3afb 100644
--- a/target/linux/adm5120/files/arch/mips/adm5120/boards/mikrotik.c
+++ b/target/linux/adm5120/files/arch/mips/adm5120/boards/mikrotik.c
@@ -140,6 +140,7 @@ static unsigned char rb133c_vlans[6] __initdata = {
static unsigned char rb15x_vlans[6] __initdata = {
/* FIXME: untested */
0x41, 0x42, 0x44, 0x48, 0x50, 0x00
+};
static unsigned char rb192_vlans[6] __initdata = {
/* FIXME: untested */
@@ -261,6 +262,8 @@ static void __init rb150_setup(void)
adm5120_nand_data.ctrl.cmd_ctrl = rb150_nand_cmd_ctrl;
adm5120_nand_data.ctrl.dev_ready = rb150_nand_ready;
+ adm5120_flash0_data.window_size = 512*1024;
+
rb1xx_flash_setup();
rb1xx_mac_setup();
}
diff --git a/target/linux/adm5120/files/drivers/mtd/maps/adm5120-flash.c b/target/linux/adm5120/files/drivers/mtd/maps/adm5120-flash.c
index e07fb96d2..20f67d625 100644
--- a/target/linux/adm5120/files/drivers/mtd/maps/adm5120-flash.c
+++ b/target/linux/adm5120/files/drivers/mtd/maps/adm5120-flash.c
@@ -244,7 +244,7 @@ static int adm5120_flash_initinfo(struct adm5120_flash_info *info,
struct map_info *map = &info->amap.map;
struct adm5120_flash_platform_data *pdata = dev->dev.platform_data;
struct flash_desc *fdesc;
- u32 t;
+ u32 t = 0;
map->name = dev->dev.bus_id;
@@ -255,12 +255,18 @@ static int adm5120_flash_initinfo(struct adm5120_flash_info *info,
fdesc = &flash_descs[dev->id];
- /* get memory window size */
- t = SW_READ_REG(MEMCTRL) >> fdesc->srs_shift;
- t &= MEMCTRL_SRS_MASK;
- info->amap.window_size = flash_sizes[t];
+ if (pdata)
+ info->amap.window_size = pdata->window_size;
+
+ if (info->amap.window_size == 0) {
+ /* get memory window size */
+ t = SW_READ_REG(MEMCTRL) >> fdesc->srs_shift;
+ t &= MEMCTRL_SRS_MASK;
+ info->amap.window_size = flash_sizes[t];
+ }
+
if (info->amap.window_size == 0) {
- MAP_ERR(map, "invalid flash size detected\n");
+ MAP_ERR(map, "unable to determine window size\n");
goto err_out;
}
diff --git a/target/linux/adm5120/files/include/asm-mips/mach-adm5120/adm5120_platform.h b/target/linux/adm5120/files/include/asm-mips/mach-adm5120/adm5120_platform.h
index b20c483b8..f47b10b78 100644
--- a/target/linux/adm5120/files/include/asm-mips/mach-adm5120/adm5120_platform.h
+++ b/target/linux/adm5120/files/include/asm-mips/mach-adm5120/adm5120_platform.h
@@ -39,6 +39,7 @@
struct adm5120_flash_platform_data {
void (*set_vpp)(struct map_info *, int);
void (*switch_bank)(unsigned);
+ u32 window_size;
#ifdef CONFIG_MTD_PARTITIONS
unsigned int nr_parts;
struct mtd_partition *parts;