Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 332691
b: refs/heads/master
c: d1f55c6
h: refs/heads/master
i:
  332689: 4eb24ae
  332687: 368ace9
v: v3
  • Loading branch information
Alexander Shiyan authored and David Woodhouse committed Sep 29, 2012
1 parent 7fa5b95 commit 1c39f96
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4cacbe226f39061f3e6730a08e3323e04a0de03f
refs/heads/master: d1f55c680e5d021e7066f4461dd678d42af18898
19 changes: 11 additions & 8 deletions trunk/drivers/mtd/maps/autcpu12-nvram.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,16 @@ struct map_info autcpu12_sram_map = {

static int __init init_autcpu12_sram (void)
{
int err, save0, save1;
map_word tmp, save0, save1;
int err;

autcpu12_sram_map.virt = ioremap(0x12000000, SZ_128K);
if (!autcpu12_sram_map.virt) {
printk("Failed to ioremap autcpu12 NV-RAM space\n");
err = -EIO;
goto out;
}
simple_map_init(&autcpu_sram_map);
simple_map_init(&autcpu12_sram_map);

/*
* Check for 32K/128K
Expand All @@ -61,20 +62,22 @@ static int __init init_autcpu12_sram (void)
* Read and check result on ofs 0x0
* Restore contents
*/
save0 = map_read32(&autcpu12_sram_map,0);
save1 = map_read32(&autcpu12_sram_map,0x10000);
map_write32(&autcpu12_sram_map,~save0,0x10000);
save0 = map_read(&autcpu12_sram_map, 0);
save1 = map_read(&autcpu12_sram_map, 0x10000);
tmp.x[0] = ~save0.x[0];
map_write(&autcpu12_sram_map, tmp, 0x10000);
/* if we find this pattern on 0x0, we have 32K size
* restore contents and exit
*/
if ( map_read32(&autcpu12_sram_map,0) != save0) {
map_write32(&autcpu12_sram_map,save0,0x0);
tmp = map_read(&autcpu12_sram_map, 0);
if (!map_word_equal(&autcpu12_sram_map, tmp, save0)) {
map_write(&autcpu12_sram_map, save0, 0x0);
goto map;
}
/* We have a 128K found, restore 0x10000 and set size
* to 128K
*/
map_write32(&autcpu12_sram_map,save1,0x10000);
map_write(&autcpu12_sram_map, save1, 0x10000);
autcpu12_sram_map.size = SZ_128K;

map:
Expand Down

0 comments on commit 1c39f96

Please sign in to comment.