Changeset 8091


Ignore:
Timestamp:
2007-07-21T13:05:46+02:00 (11 years ago)
Author:
juhosg
Message:

[adm5120] flash driver fixes

File:
1 edited

Legend:

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

    r7971 r8091  
    5151#define MAX_PARSED_PARTS 8 
    5252 
    53 #define MAP_DBG(m, f, a...)     printk(KERN_DEBUG "%s: " f, (m->name) , ## a) 
     53#ifdef ADM5120_FLASH_DEBUG 
     54#define MAP_DBG(m, f, a...)     printk(KERN_INFO "%s: " f, (m->name) , ## a) 
     55#else 
     56#define MAP_DBG(m, f, a...)     do {} while (0) 
     57#endif 
    5458#define MAP_ERR(m, f, a...)     printk(KERN_ERR "%s: " f, (m->name) , ## a) 
    5559#define MAP_INFO(m, f, a...)    printk(KERN_INFO "%s: " f, (m->name) , ## a) 
     
    146150                BUG(); 
    147151 
    148         MAP_DBG(map, "ofs=%lu, switching to bank %u\n", ofs, bank); 
     152        MAP_DBG(map, "switching to bank %u, ofs=%lX\n", bank, ofs); 
    149153        amap->switch_bank(bank); 
    150154} 
     
    191195        ssize_t t; 
    192196 
    193         MAP_DBG(map, "copying %lu byte(s) from %lu to %lX\n", 
    194                 (unsigned long)len, from, (unsigned long)to); 
     197        MAP_DBG(map, "copy_from, to=%lX, from=%lX, len=%lX\n", 
     198                (unsigned long)to, from, (unsigned long)len); 
    195199 
    196200        if (from > amap->chip_size) 
     
    199203        p = (char *)to; 
    200204        while (len > 0) { 
    201                 if (len > BANK_SIZE - (from & BANK_OFFS_MASK)) 
    202                         t = BANK_SIZE - (from & BANK_OFFS_MASK); 
    203                 else 
    204                         t = len; 
    205  
    206                 MAP_DBG(map, "copying %lu byte(s) from %lu to %lX\n", 
     205                t = len; 
     206                if (from < BANK_SIZE && from+len > BANK_SIZE) 
     207                        t = BANK_SIZE-from; 
     208 
     209                FLASH_LOCK(); 
     210                MAP_DBG(map, "copying %lu byte(s) from %lX to %lX\n", 
    207211                        (unsigned long)t, (from & BANK_OFFS_MASK), 
    208212                        (unsigned long)p); 
    209  
    210                 FLASH_LOCK(); 
    211213                adm5120_flash_switchbank(map, from); 
    212                 inline_map_copy_from(map, to, (from & BANK_OFFS_MASK), t); 
     214                inline_map_copy_from(map, p, (from & BANK_OFFS_MASK), t); 
    213215                FLASH_UNLOCK(); 
    214216                p += t; 
Note: See TracChangeset for help on using the changeset viewer.