Changeset 8135


Ignore:
Timestamp:
2007-07-23T21:51:49+02:00 (11 years ago)
Author:
juhosg
Message:

[adm5120] cosmetic changes in flash driver

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/target/linux/adm5120-2.6/files/drivers/mtd/maps/adm5120-flash.c

    r8091 r8135  
    6262        struct map_info map; 
    6363        void            (*switch_bank)(unsigned); 
    64         unsigned long   chip_size; 
     64        unsigned long   window_size; 
    6565}; 
    6666 
     
    159159        map_word ret; 
    160160 
    161         MAP_DBG(map, "reading from ofs %lu\n", ofs); 
    162  
    163         if (ofs >= amap->chip_size) 
     161        MAP_DBG(map, "reading from ofs %lX\n", ofs); 
     162 
     163        if (ofs >= amap->window_size) 
    164164                return map_word_ff(map); 
    165165 
    166166        FLASH_LOCK(); 
    167167        adm5120_flash_switchbank(map, ofs); 
    168         ret = inline_map_read(map, (ofs & BANK_OFFS_MASK)); 
     168        ret = inline_map_read(map, (ofs & (amap->window_size-1))); 
    169169        FLASH_UNLOCK(); 
    170170 
     
    177177        struct adm5120_map_info *amap = map_to_amap(map); 
    178178 
    179         MAP_DBG(map,"writing to ofs %lu\n", ofs); 
    180  
    181         if (ofs > amap->chip_size) 
     179        MAP_DBG(map,"writing to ofs %lX\n", ofs); 
     180 
     181        if (ofs > amap->window_size) 
    182182                return; 
    183183 
    184184        FLASH_LOCK(); 
    185185        adm5120_flash_switchbank(map, ofs); 
    186         inline_map_write(map, datum, (ofs & BANK_OFFS_MASK)); 
     186        inline_map_write(map, datum, (ofs & (amap->window_size-1))); 
    187187        FLASH_UNLOCK(); 
    188188} 
     
    198198                (unsigned long)to, from, (unsigned long)len); 
    199199 
    200         if (from > amap->chip_size) 
     200        if (from > amap->window_size) 
    201201                return; 
    202202 
     
    204204        while (len > 0) { 
    205205                t = len; 
    206                 if (from < BANK_SIZE && from+len > BANK_SIZE) 
     206                if ((from < BANK_SIZE) && ((from+len) > BANK_SIZE)) 
    207207                        t = BANK_SIZE-from; 
    208208 
    209209                FLASH_LOCK(); 
    210210                MAP_DBG(map, "copying %lu byte(s) from %lX to %lX\n", 
    211                         (unsigned long)t, (from & BANK_OFFS_MASK), 
     211                        (unsigned long)t, (from & (amap->window_size-1)), 
    212212                        (unsigned long)p); 
    213213                adm5120_flash_switchbank(map, from); 
    214                 inline_map_copy_from(map, p, (from & BANK_OFFS_MASK), t); 
     214                inline_map_copy_from(map, p, (from & (amap->window_size-1)), t); 
    215215                FLASH_UNLOCK(); 
    216216                p += t; 
     
    268268        t = SWITCH_READ(SWITCH_REG_MEMCTRL) >> fdesc->srs_shift; 
    269269        t &= MEMCTRL_SRS_MASK; 
    270         info->amap.chip_size = flash_sizes[t]; 
    271         if (info->amap.chip_size == 0) { 
     270        info->amap.window_size = flash_sizes[t]; 
     271        if (info->amap.window_size == 0) { 
    272272                MAP_ERR(map, "invalid flash size detected\n"); 
    273273                goto err_out; 
     
    299299        MAP_INFO(map, "probing at 0x%lX, size:%ldKiB, width:%d bits\n", 
    300300                (unsigned long)map->phys, 
    301                 (unsigned long)info->amap.chip_size >> 10, 
     301                (unsigned long)info->amap.window_size >> 10, 
    302302                map->bankwidth*8); 
    303303 
     
    317317 
    318318        if (info->amap.switch_bank) { 
    319                 info->amap.chip_size = info->mtd->size; 
     319                info->amap.window_size = info->mtd->size; 
    320320                return; 
    321321        } 
     
    325325                (unsigned long)info->mtd->size >> 10); 
    326326 
    327         info->mtd->size = info->amap.chip_size; 
     327        info->mtd->size = info->amap.window_size; 
    328328} 
    329329 
     
    472472        adm5120_flash_initbanks(info); 
    473473 
    474         if (info->mtd->size < info->amap.chip_size) { 
     474        if (info->mtd->size < info->amap.window_size) { 
    475475                /* readjust resources */ 
    476476                iounmap(map->virt); 
     
    478478                kfree(info->res); 
    479479 
    480                 info->amap.chip_size = info->mtd->size; 
     480                info->amap.window_size = info->mtd->size; 
    481481                map->size = info->mtd->size; 
    482482                MAP_INFO(map, "reducing map size to %ldKiB\n", 
Note: See TracChangeset for help on using the changeset viewer.