diff options
Diffstat (limited to 'arch/arm/mach-omap2/gpmc.c')
-rw-r--r-- | arch/arm/mach-omap2/gpmc.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c index ab43755364f5..9fe8c949305c 100644 --- a/arch/arm/mach-omap2/gpmc.c +++ b/arch/arm/mach-omap2/gpmc.c | |||
@@ -501,7 +501,7 @@ static int gpmc_cs_delete_mem(int cs) | |||
501 | int r; | 501 | int r; |
502 | 502 | ||
503 | spin_lock(&gpmc_mem_lock); | 503 | spin_lock(&gpmc_mem_lock); |
504 | r = release_resource(&gpmc_cs_mem[cs]); | 504 | r = release_resource(res); |
505 | res->start = 0; | 505 | res->start = 0; |
506 | res->end = 0; | 506 | res->end = 0; |
507 | spin_unlock(&gpmc_mem_lock); | 507 | spin_unlock(&gpmc_mem_lock); |
@@ -527,6 +527,14 @@ static int gpmc_cs_remap(int cs, u32 base) | |||
527 | pr_err("%s: requested chip-select is disabled\n", __func__); | 527 | pr_err("%s: requested chip-select is disabled\n", __func__); |
528 | return -ENODEV; | 528 | return -ENODEV; |
529 | } | 529 | } |
530 | |||
531 | /* | ||
532 | * Make sure we ignore any device offsets from the GPMC partition | ||
533 | * allocated for the chip select and that the new base confirms | ||
534 | * to the GPMC 16MB minimum granularity. | ||
535 | */ | ||
536 | base &= ~(SZ_16M - 1); | ||
537 | |||
530 | gpmc_cs_get_memconf(cs, &old_base, &size); | 538 | gpmc_cs_get_memconf(cs, &old_base, &size); |
531 | if (base == old_base) | 539 | if (base == old_base) |
532 | return 0; | 540 | return 0; |
@@ -586,6 +594,8 @@ EXPORT_SYMBOL(gpmc_cs_request); | |||
586 | 594 | ||
587 | void gpmc_cs_free(int cs) | 595 | void gpmc_cs_free(int cs) |
588 | { | 596 | { |
597 | struct resource *res = &gpmc_cs_mem[cs]; | ||
598 | |||
589 | spin_lock(&gpmc_mem_lock); | 599 | spin_lock(&gpmc_mem_lock); |
590 | if (cs >= gpmc_cs_num || cs < 0 || !gpmc_cs_reserved(cs)) { | 600 | if (cs >= gpmc_cs_num || cs < 0 || !gpmc_cs_reserved(cs)) { |
591 | printk(KERN_ERR "Trying to free non-reserved GPMC CS%d\n", cs); | 601 | printk(KERN_ERR "Trying to free non-reserved GPMC CS%d\n", cs); |
@@ -594,7 +604,8 @@ void gpmc_cs_free(int cs) | |||
594 | return; | 604 | return; |
595 | } | 605 | } |
596 | gpmc_cs_disable_mem(cs); | 606 | gpmc_cs_disable_mem(cs); |
597 | release_resource(&gpmc_cs_mem[cs]); | 607 | if (res->flags) |
608 | release_resource(res); | ||
598 | gpmc_cs_set_reserved(cs, 0); | 609 | gpmc_cs_set_reserved(cs, 0); |
599 | spin_unlock(&gpmc_mem_lock); | 610 | spin_unlock(&gpmc_mem_lock); |
600 | } | 611 | } |