Changeset 16359


Ignore:
Timestamp:
2009-06-06T17:56:03+02:00 (7 years ago)
Author:
juhosg
Message:

[ar71xx] update flash locking code

Location:
trunk/target/linux/ar71xx/files
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/target/linux/ar71xx/files/arch/mips/ar71xx/ar71xx.c

    r16311 r16359  
    1818 
    1919static DEFINE_MUTEX(ar71xx_flash_mutex); 
    20 static int ar71xx_flash_lock_enabled; 
    2120 
    2221void __iomem *ar71xx_ddr_base; 
     
    103102EXPORT_SYMBOL_GPL(ar71xx_ddr_flush); 
    104103 
    105 void  __init ar71xx_flash_lock_enable(void) 
    106 { 
    107         ar71xx_flash_lock_enabled = 1; 
    108 } 
    109  
    110104void ar71xx_flash_acquire(void) 
    111105{ 
    112         if (ar71xx_flash_lock_enabled) 
    113                 mutex_lock(&ar71xx_flash_mutex); 
     106        mutex_lock(&ar71xx_flash_mutex); 
    114107} 
    115108EXPORT_SYMBOL_GPL(ar71xx_flash_acquire); 
     
    117110void ar71xx_flash_release(void) 
    118111{ 
    119         if (ar71xx_flash_lock_enabled) 
    120                 mutex_unlock(&ar71xx_flash_mutex); 
     112        mutex_unlock(&ar71xx_flash_mutex); 
    121113} 
    122114EXPORT_SYMBOL_GPL(ar71xx_flash_release); 
  • trunk/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ap83.c

    r16356 r16359  
    222222static void __init ap83_040_setup(void) 
    223223{ 
    224         ar71xx_flash_lock_enable(); 
     224        ap83_flash_data.is_shared=1; 
    225225        ap83_generic_setup(); 
    226226        platform_device_register(&ap83_040_spi_device); 
  • trunk/target/linux/ar71xx/files/arch/mips/include/asm/mach-ar71xx/ar71xx.h

    r16311 r16359  
    423423#define SPI_IOC_CS_ALL          (SPI_IOC_CS0 | SPI_IOC_CS1 | SPI_IOC_CS2) 
    424424 
    425 void ar71xx_flash_lock_enable(void) __init; 
    426425void ar71xx_flash_acquire(void); 
    427426void ar71xx_flash_release(void); 
  • trunk/target/linux/ar71xx/files/arch/mips/include/asm/mach-ar71xx/platform.h

    r16353 r16359  
    5656struct ar91xx_flash_platform_data { 
    5757        unsigned int            width; 
     58        u8                      is_shared:1; 
    5859#ifdef CONFIG_MTD_PARTITIONS 
    5960        unsigned int            nr_parts; 
  • trunk/target/linux/ar71xx/files/drivers/mtd/maps/ar91xx_flash.c

    r16353 r16359  
    6161} 
    6262 
     63static map_word ar91xx_flash_read_lock(struct map_info *map, unsigned long ofs) 
     64{ 
     65        map_word ret; 
     66 
     67        ar71xx_flash_acquire(); 
     68        ret = ar91xx_flash_read(map, ofs); 
     69        ar71xx_flash_release(); 
     70 
     71        return ret; 
     72} 
     73 
     74static void ar91xx_flash_write_lock(struct map_info *map, map_word d, 
     75                               unsigned long ofs) 
     76{ 
     77        ar71xx_flash_acquire(); 
     78        ar91xx_flash_write(map, d, ofs); 
     79        ar71xx_flash_release(); 
     80} 
     81 
     82static void ar91xx_flash_copy_from_lock(struct map_info *map, void *to, 
     83                                        unsigned long from, ssize_t len) 
     84{ 
     85        ar71xx_flash_acquire(); 
     86        inline_map_copy_from(map, to, from, len); 
     87        ar71xx_flash_release(); 
     88} 
     89 
     90static void ar91xx_flash_copy_to_lock(struct map_info *map, unsigned long to, 
     91                                      const void *from, ssize_t len) 
     92{ 
     93        ar71xx_flash_acquire(); 
     94        inline_map_copy_to(map, to, from, len); 
     95        ar71xx_flash_release(); 
     96} 
     97 
    6398static int ar91xx_flash_remove(struct platform_device *pdev) 
    6499{ 
     
    153188 
    154189        simple_map_init(&info->map); 
    155         info->map.read = ar91xx_flash_read; 
    156         info->map.write = ar91xx_flash_write; 
     190        if (pdata->is_shared) { 
     191                info->map.read = ar91xx_flash_read_lock; 
     192                info->map.write = ar91xx_flash_write_lock; 
     193                info->map.copy_from = ar91xx_flash_copy_from_lock; 
     194                info->map.copy_to = ar91xx_flash_copy_to_lock; 
     195        } else { 
     196                info->map.read = ar91xx_flash_read; 
     197                info->map.write = ar91xx_flash_write; 
     198        } 
    157199 
    158200        probe_type = rom_probe_types; 
Note: See TracChangeset for help on using the changeset viewer.