diff options
Diffstat (limited to 'drivers/mtd/devices/spear_smi.c')
-rw-r--r-- | drivers/mtd/devices/spear_smi.c | 41 |
1 files changed, 6 insertions, 35 deletions
diff --git a/drivers/mtd/devices/spear_smi.c b/drivers/mtd/devices/spear_smi.c index f2016b5f59b6..f7f34fd1a3e5 100644 --- a/drivers/mtd/devices/spear_smi.c +++ b/drivers/mtd/devices/spear_smi.c | |||
@@ -149,21 +149,6 @@ static struct flash_device flash_devices[] = { | |||
149 | FLASH_ID("mac 25l6405" , 0xd8, 0x001720C2, 0x100, 0x10000, 0x800000), | 149 | FLASH_ID("mac 25l6405" , 0xd8, 0x001720C2, 0x100, 0x10000, 0x800000), |
150 | }; | 150 | }; |
151 | 151 | ||
152 | /* These partitions would be used if platform doesn't pass one */ | ||
153 | static struct mtd_partition part_info_8M[] = { | ||
154 | DEFINE_PARTS("Xloader", 0x00, 0x10000), | ||
155 | DEFINE_PARTS("UBoot", MTDPART_OFS_APPEND, 0x40000), | ||
156 | DEFINE_PARTS("Kernel", MTDPART_OFS_APPEND, 0x2C0000), | ||
157 | DEFINE_PARTS("Root File System", MTDPART_OFS_APPEND, MTDPART_SIZ_FULL), | ||
158 | }; | ||
159 | |||
160 | static struct mtd_partition part_info_16M[] = { | ||
161 | DEFINE_PARTS("Xloader", 0x00, 0x40000), | ||
162 | DEFINE_PARTS("UBoot", MTDPART_OFS_APPEND, 0x100000), | ||
163 | DEFINE_PARTS("Kernel", MTDPART_OFS_APPEND, 0x300000), | ||
164 | DEFINE_PARTS("Root File System", MTDPART_OFS_APPEND, MTDPART_SIZ_FULL), | ||
165 | }; | ||
166 | |||
167 | /* Define spear specific structures */ | 152 | /* Define spear specific structures */ |
168 | 153 | ||
169 | struct spear_snor_flash; | 154 | struct spear_snor_flash; |
@@ -769,8 +754,8 @@ static int spear_smi_setup_banks(struct platform_device *pdev, u32 bank) | |||
769 | struct spear_smi_flash_info *flash_info; | 754 | struct spear_smi_flash_info *flash_info; |
770 | struct spear_smi_plat_data *pdata; | 755 | struct spear_smi_plat_data *pdata; |
771 | struct spear_snor_flash *flash; | 756 | struct spear_snor_flash *flash; |
772 | struct mtd_partition *parts; | 757 | struct mtd_partition *parts = NULL; |
773 | int count; | 758 | int count = 0; |
774 | int flash_index; | 759 | int flash_index; |
775 | int ret = 0; | 760 | int ret = 0; |
776 | 761 | ||
@@ -834,28 +819,14 @@ static int spear_smi_setup_banks(struct platform_device *pdev, u32 bank) | |||
834 | if (flash_info->partitions) { | 819 | if (flash_info->partitions) { |
835 | parts = flash_info->partitions; | 820 | parts = flash_info->partitions; |
836 | count = flash_info->nr_partitions; | 821 | count = flash_info->nr_partitions; |
837 | } else { | ||
838 | /* choose from default ones */ | ||
839 | switch (flash->mtd.size) { | ||
840 | case 0x800000:/* 8MB */ | ||
841 | parts = part_info_8M; | ||
842 | count = ARRAY_SIZE(part_info_8M); | ||
843 | break; | ||
844 | case 0x1000000:/* 16MB */ | ||
845 | parts = part_info_16M; | ||
846 | count = ARRAY_SIZE(part_info_16M); | ||
847 | break; | ||
848 | default: | ||
849 | dev_err(&pdev->dev, "undefined partition\n"); | ||
850 | ret = ENODEV; | ||
851 | goto err_map; | ||
852 | } | ||
853 | } | 822 | } |
854 | ret = mtd_device_parse_register(&flash->mtd, NULL, NULL, parts, count); | 823 | ret = mtd_device_parse_register(&flash->mtd, NULL, NULL, parts, count); |
855 | if (ret) | 824 | if (ret) { |
856 | dev_err(&dev->pdev->dev, "Err MTD partition=%d\n", ret); | 825 | dev_err(&dev->pdev->dev, "Err MTD partition=%d\n", ret); |
826 | goto err_map; | ||
827 | } | ||
857 | 828 | ||
858 | return ret; | 829 | return 0; |
859 | 830 | ||
860 | err_map: | 831 | err_map: |
861 | iounmap(flash->base_addr); | 832 | iounmap(flash->base_addr); |