diff options
Diffstat (limited to 'drivers/mtd/spi-nor/spi-nor.c')
-rw-r--r-- | drivers/mtd/spi-nor/spi-nor.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c index ae16aa2f6885..c51ee52386a7 100644 --- a/drivers/mtd/spi-nor/spi-nor.c +++ b/drivers/mtd/spi-nor/spi-nor.c | |||
@@ -28,6 +28,8 @@ | |||
28 | 28 | ||
29 | #define JEDEC_MFR(_jedec_id) ((_jedec_id) >> 16) | 29 | #define JEDEC_MFR(_jedec_id) ((_jedec_id) >> 16) |
30 | 30 | ||
31 | static const struct spi_device_id *spi_nor_match_id(const char *name); | ||
32 | |||
31 | /* | 33 | /* |
32 | * Read the status register, returning its value in the location | 34 | * Read the status register, returning its value in the location |
33 | * Return the status register value. | 35 | * Return the status register value. |
@@ -473,7 +475,7 @@ struct flash_info { | |||
473 | * more nor chips. This current list focusses on newer chips, which | 475 | * more nor chips. This current list focusses on newer chips, which |
474 | * have been converging on command sets which including JEDEC ID. | 476 | * have been converging on command sets which including JEDEC ID. |
475 | */ | 477 | */ |
476 | const struct spi_device_id spi_nor_ids[] = { | 478 | static const struct spi_device_id spi_nor_ids[] = { |
477 | /* Atmel -- some are (confusingly) marketed as "DataFlash" */ | 479 | /* Atmel -- some are (confusingly) marketed as "DataFlash" */ |
478 | { "at25fs010", INFO(0x1f6601, 0, 32 * 1024, 4, SECT_4K) }, | 480 | { "at25fs010", INFO(0x1f6601, 0, 32 * 1024, 4, SECT_4K) }, |
479 | { "at25fs040", INFO(0x1f6604, 0, 64 * 1024, 8, SECT_4K) }, | 481 | { "at25fs040", INFO(0x1f6604, 0, 64 * 1024, 8, SECT_4K) }, |
@@ -637,7 +639,6 @@ const struct spi_device_id spi_nor_ids[] = { | |||
637 | { "cat25128", CAT25_INFO(2048, 8, 64, 2, SPI_NOR_NO_ERASE | SPI_NOR_NO_FR) }, | 639 | { "cat25128", CAT25_INFO(2048, 8, 64, 2, SPI_NOR_NO_ERASE | SPI_NOR_NO_FR) }, |
638 | { }, | 640 | { }, |
639 | }; | 641 | }; |
640 | EXPORT_SYMBOL_GPL(spi_nor_ids); | ||
641 | 642 | ||
642 | static const struct spi_device_id *spi_nor_read_id(struct spi_nor *nor) | 643 | static const struct spi_device_id *spi_nor_read_id(struct spi_nor *nor) |
643 | { | 644 | { |
@@ -911,9 +912,9 @@ static int spi_nor_check(struct spi_nor *nor) | |||
911 | return 0; | 912 | return 0; |
912 | } | 913 | } |
913 | 914 | ||
914 | int spi_nor_scan(struct spi_nor *nor, const struct spi_device_id *id, | 915 | int spi_nor_scan(struct spi_nor *nor, const char *name, enum read_mode mode) |
915 | enum read_mode mode) | ||
916 | { | 916 | { |
917 | const struct spi_device_id *id = NULL; | ||
917 | struct flash_info *info; | 918 | struct flash_info *info; |
918 | struct device *dev = nor->dev; | 919 | struct device *dev = nor->dev; |
919 | struct mtd_info *mtd = nor->mtd; | 920 | struct mtd_info *mtd = nor->mtd; |
@@ -925,6 +926,10 @@ int spi_nor_scan(struct spi_nor *nor, const struct spi_device_id *id, | |||
925 | if (ret) | 926 | if (ret) |
926 | return ret; | 927 | return ret; |
927 | 928 | ||
929 | id = spi_nor_match_id(name); | ||
930 | if (!id) | ||
931 | return -ENOENT; | ||
932 | |||
928 | info = (void *)id->driver_data; | 933 | info = (void *)id->driver_data; |
929 | 934 | ||
930 | if (info->jedec_id) { | 935 | if (info->jedec_id) { |
@@ -1113,7 +1118,7 @@ int spi_nor_scan(struct spi_nor *nor, const struct spi_device_id *id, | |||
1113 | } | 1118 | } |
1114 | EXPORT_SYMBOL_GPL(spi_nor_scan); | 1119 | EXPORT_SYMBOL_GPL(spi_nor_scan); |
1115 | 1120 | ||
1116 | const struct spi_device_id *spi_nor_match_id(char *name) | 1121 | static const struct spi_device_id *spi_nor_match_id(const char *name) |
1117 | { | 1122 | { |
1118 | const struct spi_device_id *id = spi_nor_ids; | 1123 | const struct spi_device_id *id = spi_nor_ids; |
1119 | 1124 | ||
@@ -1124,7 +1129,6 @@ const struct spi_device_id *spi_nor_match_id(char *name) | |||
1124 | } | 1129 | } |
1125 | return NULL; | 1130 | return NULL; |
1126 | } | 1131 | } |
1127 | EXPORT_SYMBOL_GPL(spi_nor_match_id); | ||
1128 | 1132 | ||
1129 | MODULE_LICENSE("GPL"); | 1133 | MODULE_LICENSE("GPL"); |
1130 | MODULE_AUTHOR("Huang Shijie <shijie8@gmail.com>"); | 1134 | MODULE_AUTHOR("Huang Shijie <shijie8@gmail.com>"); |