diff options
Diffstat (limited to 'arch/arm/mach-omap2/gpmc.c')
-rw-r--r-- | arch/arm/mach-omap2/gpmc.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c index 6af1a5d98e6f..bf6117c32f4b 100644 --- a/arch/arm/mach-omap2/gpmc.c +++ b/arch/arm/mach-omap2/gpmc.c | |||
@@ -714,9 +714,9 @@ static void __devexit gpmc_mem_exit(void) | |||
714 | 714 | ||
715 | } | 715 | } |
716 | 716 | ||
717 | static void __devinit gpmc_mem_init(void) | 717 | static int __devinit gpmc_mem_init(void) |
718 | { | 718 | { |
719 | int cs; | 719 | int cs, rc; |
720 | unsigned long boot_rom_space = 0; | 720 | unsigned long boot_rom_space = 0; |
721 | 721 | ||
722 | /* never allocate the first page, to facilitate bug detection; | 722 | /* never allocate the first page, to facilitate bug detection; |
@@ -736,13 +736,21 @@ static void __devinit gpmc_mem_init(void) | |||
736 | if (!gpmc_cs_mem_enabled(cs)) | 736 | if (!gpmc_cs_mem_enabled(cs)) |
737 | continue; | 737 | continue; |
738 | gpmc_cs_get_memconf(cs, &base, &size); | 738 | gpmc_cs_get_memconf(cs, &base, &size); |
739 | if (gpmc_cs_insert_mem(cs, base, size) < 0) | 739 | rc = gpmc_cs_insert_mem(cs, base, size); |
740 | BUG(); | 740 | if (IS_ERR_VALUE(rc)) { |
741 | while (--cs >= 0) | ||
742 | if (gpmc_cs_mem_enabled(cs)) | ||
743 | gpmc_cs_delete_mem(cs); | ||
744 | return rc; | ||
745 | } | ||
741 | } | 746 | } |
747 | |||
748 | return 0; | ||
742 | } | 749 | } |
743 | 750 | ||
744 | static __devinit int gpmc_probe(struct platform_device *pdev) | 751 | static __devinit int gpmc_probe(struct platform_device *pdev) |
745 | { | 752 | { |
753 | int rc; | ||
746 | u32 l; | 754 | u32 l; |
747 | struct resource *res; | 755 | struct resource *res; |
748 | 756 | ||
@@ -782,7 +790,13 @@ static __devinit int gpmc_probe(struct platform_device *pdev) | |||
782 | dev_info(gpmc_dev, "GPMC revision %d.%d\n", GPMC_REVISION_MAJOR(l), | 790 | dev_info(gpmc_dev, "GPMC revision %d.%d\n", GPMC_REVISION_MAJOR(l), |
783 | GPMC_REVISION_MINOR(l)); | 791 | GPMC_REVISION_MINOR(l)); |
784 | 792 | ||
785 | gpmc_mem_init(); | 793 | rc = gpmc_mem_init(); |
794 | if (IS_ERR_VALUE(rc)) { | ||
795 | clk_disable_unprepare(gpmc_l3_clk); | ||
796 | clk_put(gpmc_l3_clk); | ||
797 | dev_err(gpmc_dev, "failed to reserve memory\n"); | ||
798 | return rc; | ||
799 | } | ||
786 | 800 | ||
787 | if (IS_ERR_VALUE(gpmc_setup_irq())) | 801 | if (IS_ERR_VALUE(gpmc_setup_irq())) |
788 | dev_warn(gpmc_dev, "gpmc_setup_irq failed\n"); | 802 | dev_warn(gpmc_dev, "gpmc_setup_irq failed\n"); |