diff options
author | Rafał Miłecki <zajec5@gmail.com> | 2014-09-28 16:36:54 -0400 |
---|---|---|
committer | Brian Norris <computersforpeace@gmail.com> | 2014-09-28 18:27:03 -0400 |
commit | 32f1b7c8352fd33d41bcec3cfb054ccdcfd40a42 (patch) | |
tree | 2d00a33a1d12b52cc13d4be89e4072973d27e771 /drivers/mtd/spi-nor | |
parent | 57cf26c1b28572976c57f6dec9818be38bf37cbb (diff) |
mtd: move support for struct flash_platform_data into m25p80
This "type" seems to be an extra hint for m25p80 about the flash. Some
archs register flash_platform_data with "name" set to "m25p80" and then
with a real flash name set in "type". It seems to be a trick specific
to the m25p80 so let's move it out of spi-nor.
Btw switch to the spi_nor_match_id instead of iterating spi_nor_ids.
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Diffstat (limited to 'drivers/mtd/spi-nor')
-rw-r--r-- | drivers/mtd/spi-nor/spi-nor.c | 28 |
1 files changed, 1 insertions, 27 deletions
diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c index 11459f6cee50..ae16aa2f6885 100644 --- a/drivers/mtd/spi-nor/spi-nor.c +++ b/drivers/mtd/spi-nor/spi-nor.c | |||
@@ -915,7 +915,6 @@ int spi_nor_scan(struct spi_nor *nor, const struct spi_device_id *id, | |||
915 | enum read_mode mode) | 915 | enum read_mode mode) |
916 | { | 916 | { |
917 | struct flash_info *info; | 917 | struct flash_info *info; |
918 | struct flash_platform_data *data; | ||
919 | struct device *dev = nor->dev; | 918 | struct device *dev = nor->dev; |
920 | struct mtd_info *mtd = nor->mtd; | 919 | struct mtd_info *mtd = nor->mtd; |
921 | struct device_node *np = dev->of_node; | 920 | struct device_node *np = dev->of_node; |
@@ -926,28 +925,6 @@ int spi_nor_scan(struct spi_nor *nor, const struct spi_device_id *id, | |||
926 | if (ret) | 925 | if (ret) |
927 | return ret; | 926 | return ret; |
928 | 927 | ||
929 | /* Platform data helps sort out which chip type we have, as | ||
930 | * well as how this board partitions it. If we don't have | ||
931 | * a chip ID, try the JEDEC id commands; they'll work for most | ||
932 | * newer chips, even if we don't recognize the particular chip. | ||
933 | */ | ||
934 | data = dev_get_platdata(dev); | ||
935 | if (data && data->type) { | ||
936 | const struct spi_device_id *plat_id; | ||
937 | |||
938 | for (i = 0; i < ARRAY_SIZE(spi_nor_ids) - 1; i++) { | ||
939 | plat_id = &spi_nor_ids[i]; | ||
940 | if (strcmp(data->type, plat_id->name)) | ||
941 | continue; | ||
942 | break; | ||
943 | } | ||
944 | |||
945 | if (i < ARRAY_SIZE(spi_nor_ids) - 1) | ||
946 | id = plat_id; | ||
947 | else | ||
948 | dev_warn(dev, "unrecognized id %s\n", data->type); | ||
949 | } | ||
950 | |||
951 | info = (void *)id->driver_data; | 928 | info = (void *)id->driver_data; |
952 | 929 | ||
953 | if (info->jedec_id) { | 930 | if (info->jedec_id) { |
@@ -985,11 +962,8 @@ int spi_nor_scan(struct spi_nor *nor, const struct spi_device_id *id, | |||
985 | write_sr(nor, 0); | 962 | write_sr(nor, 0); |
986 | } | 963 | } |
987 | 964 | ||
988 | if (data && data->name) | 965 | if (!mtd->name) |
989 | mtd->name = data->name; | ||
990 | else | ||
991 | mtd->name = dev_name(dev); | 966 | mtd->name = dev_name(dev); |
992 | |||
993 | mtd->type = MTD_NORFLASH; | 967 | mtd->type = MTD_NORFLASH; |
994 | mtd->writesize = 1; | 968 | mtd->writesize = 1; |
995 | mtd->flags = MTD_CAP_NORFLASH; | 969 | mtd->flags = MTD_CAP_NORFLASH; |