aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/adm5120/files/drivers
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2007-10-23 12:31:13 +0000
committerGabor Juhos <juhosg@openwrt.org>2007-10-23 12:31:13 +0000
commit198b1c3e4f865e6b4a63b4f5c38ce666cfbc8c79 (patch)
tree7f45ffd183b263f083bc1a7c5d9e0b2b514ffef6 /target/linux/adm5120/files/drivers
parent211dc4b5a4df5b5960aaed9c5b710f694a5034f2 (diff)
downloadupstream-198b1c3e4f865e6b4a63b4f5c38ce666cfbc8c79.tar.gz
upstream-198b1c3e4f865e6b4a63b4f5c38ce666cfbc8c79.tar.bz2
upstream-198b1c3e4f865e6b4a63b4f5c38ce666cfbc8c79.zip
[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/linux/adm5120/files/drivers')
-rw-r--r--target/linux/adm5120/files/drivers/mtd/maps/adm5120-flash.c18
1 files changed, 12 insertions, 6 deletions
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 e07fb96d26..20f67d625f 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;
}