diff options
-rw-r--r-- | Documentation/devicetree/bindings/mtd/atmel-dataflash.txt | 14 | ||||
-rw-r--r-- | drivers/mtd/devices/mtd_dataflash.c | 18 |
2 files changed, 30 insertions, 2 deletions
diff --git a/Documentation/devicetree/bindings/mtd/atmel-dataflash.txt b/Documentation/devicetree/bindings/mtd/atmel-dataflash.txt new file mode 100644 index 000000000000..ef66ddd01da0 --- /dev/null +++ b/Documentation/devicetree/bindings/mtd/atmel-dataflash.txt | |||
@@ -0,0 +1,14 @@ | |||
1 | * Atmel Data Flash | ||
2 | |||
3 | Required properties: | ||
4 | - compatible : "atmel,<model>", "atmel,<series>", "atmel,dataflash". | ||
5 | |||
6 | Example: | ||
7 | |||
8 | flash@1 { | ||
9 | #address-cells = <1>; | ||
10 | #size-cells = <1>; | ||
11 | compatible = "atmel,at45db321d", "atmel,at45", "atmel,dataflash"; | ||
12 | spi-max-frequency = <25000000>; | ||
13 | reg = <1>; | ||
14 | }; | ||
diff --git a/drivers/mtd/devices/mtd_dataflash.c b/drivers/mtd/devices/mtd_dataflash.c index 8f6b02c43b43..c86fa573c303 100644 --- a/drivers/mtd/devices/mtd_dataflash.c +++ b/drivers/mtd/devices/mtd_dataflash.c | |||
@@ -17,6 +17,8 @@ | |||
17 | #include <linux/mutex.h> | 17 | #include <linux/mutex.h> |
18 | #include <linux/err.h> | 18 | #include <linux/err.h> |
19 | #include <linux/math64.h> | 19 | #include <linux/math64.h> |
20 | #include <linux/of.h> | ||
21 | #include <linux/of_device.h> | ||
20 | 22 | ||
21 | #include <linux/spi/spi.h> | 23 | #include <linux/spi/spi.h> |
22 | #include <linux/spi/flash.h> | 24 | #include <linux/spi/flash.h> |
@@ -24,7 +26,6 @@ | |||
24 | #include <linux/mtd/mtd.h> | 26 | #include <linux/mtd/mtd.h> |
25 | #include <linux/mtd/partitions.h> | 27 | #include <linux/mtd/partitions.h> |
26 | 28 | ||
27 | |||
28 | /* | 29 | /* |
29 | * DataFlash is a kind of SPI flash. Most AT45 chips have two buffers in | 30 | * DataFlash is a kind of SPI flash. Most AT45 chips have two buffers in |
30 | * each chip, which may be used for double buffered I/O; but this driver | 31 | * each chip, which may be used for double buffered I/O; but this driver |
@@ -98,6 +99,16 @@ struct dataflash { | |||
98 | struct mtd_info mtd; | 99 | struct mtd_info mtd; |
99 | }; | 100 | }; |
100 | 101 | ||
102 | #ifdef CONFIG_OF | ||
103 | static const struct of_device_id dataflash_dt_ids[] = { | ||
104 | { .compatible = "atmel,at45", }, | ||
105 | { .compatible = "atmel,dataflash", }, | ||
106 | { /* sentinel */ } | ||
107 | }; | ||
108 | #else | ||
109 | #define dataflash_dt_ids NULL | ||
110 | #endif | ||
111 | |||
101 | /* ......................................................................... */ | 112 | /* ......................................................................... */ |
102 | 113 | ||
103 | /* | 114 | /* |
@@ -634,6 +645,7 @@ add_dataflash_otp(struct spi_device *spi, char *name, | |||
634 | { | 645 | { |
635 | struct dataflash *priv; | 646 | struct dataflash *priv; |
636 | struct mtd_info *device; | 647 | struct mtd_info *device; |
648 | struct mtd_part_parser_data ppdata; | ||
637 | struct flash_platform_data *pdata = spi->dev.platform_data; | 649 | struct flash_platform_data *pdata = spi->dev.platform_data; |
638 | char *otp_tag = ""; | 650 | char *otp_tag = ""; |
639 | int err = 0; | 651 | int err = 0; |
@@ -675,7 +687,8 @@ add_dataflash_otp(struct spi_device *spi, char *name, | |||
675 | pagesize, otp_tag); | 687 | pagesize, otp_tag); |
676 | dev_set_drvdata(&spi->dev, priv); | 688 | dev_set_drvdata(&spi->dev, priv); |
677 | 689 | ||
678 | err = mtd_device_parse_register(device, NULL, 0, | 690 | ppdata.of_node = spi->dev.of_node; |
691 | err = mtd_device_parse_register(device, NULL, &ppdata, | ||
679 | pdata ? pdata->parts : NULL, | 692 | pdata ? pdata->parts : NULL, |
680 | pdata ? pdata->nr_parts : 0); | 693 | pdata ? pdata->nr_parts : 0); |
681 | 694 | ||
@@ -926,6 +939,7 @@ static struct spi_driver dataflash_driver = { | |||
926 | .name = "mtd_dataflash", | 939 | .name = "mtd_dataflash", |
927 | .bus = &spi_bus_type, | 940 | .bus = &spi_bus_type, |
928 | .owner = THIS_MODULE, | 941 | .owner = THIS_MODULE, |
942 | .of_match_table = dataflash_dt_ids, | ||
929 | }, | 943 | }, |
930 | 944 | ||
931 | .probe = dataflash_probe, | 945 | .probe = dataflash_probe, |