Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 274909
b: refs/heads/master
c: b94e757
h: refs/heads/master
i:
  274907: c27128c
v: v3
  • Loading branch information
Shawn Guo authored and Artem Bityutskiy committed Sep 11, 2011
1 parent 44b62ff commit 1461d2d
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f3c8cfc237927cc095e8bcb1e3794cfa76390bab
refs/heads/master: b94e757c4b3aafa52f8b82efed8660427a8d2880
14 changes: 14 additions & 0 deletions trunk/Documentation/devicetree/bindings/mtd/atmel-dataflash.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
* Atmel Data Flash

Required properties:
- compatible : "atmel,<model>", "atmel,<series>", "atmel,dataflash".

Example:

flash@1 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "atmel,at45db321d", "atmel,at45", "atmel,dataflash";
spi-max-frequency = <25000000>;
reg = <1>;
};
18 changes: 16 additions & 2 deletions trunk/drivers/mtd/devices/mtd_dataflash.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@
#include <linux/mutex.h>
#include <linux/err.h>
#include <linux/math64.h>
#include <linux/of.h>
#include <linux/of_device.h>

#include <linux/spi/spi.h>
#include <linux/spi/flash.h>

#include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h>


/*
* DataFlash is a kind of SPI flash. Most AT45 chips have two buffers in
* each chip, which may be used for double buffered I/O; but this driver
Expand Down Expand Up @@ -98,6 +99,16 @@ struct dataflash {
struct mtd_info mtd;
};

#ifdef CONFIG_OF
static const struct of_device_id dataflash_dt_ids[] = {
{ .compatible = "atmel,at45", },
{ .compatible = "atmel,dataflash", },
{ /* sentinel */ }
};
#else
#define dataflash_dt_ids NULL
#endif

/* ......................................................................... */

/*
Expand Down Expand Up @@ -634,6 +645,7 @@ add_dataflash_otp(struct spi_device *spi, char *name,
{
struct dataflash *priv;
struct mtd_info *device;
struct mtd_part_parser_data ppdata;
struct flash_platform_data *pdata = spi->dev.platform_data;
char *otp_tag = "";
int err = 0;
Expand Down Expand Up @@ -675,7 +687,8 @@ add_dataflash_otp(struct spi_device *spi, char *name,
pagesize, otp_tag);
dev_set_drvdata(&spi->dev, priv);

err = mtd_device_parse_register(device, NULL, 0,
ppdata.of_node = spi->dev.of_node;
err = mtd_device_parse_register(device, NULL, &ppdata,
pdata ? pdata->parts : NULL,
pdata ? pdata->nr_parts : 0);

Expand Down Expand Up @@ -926,6 +939,7 @@ static struct spi_driver dataflash_driver = {
.name = "mtd_dataflash",
.bus = &spi_bus_type,
.owner = THIS_MODULE,
.of_match_table = dataflash_dt_ids,
},

.probe = dataflash_probe,
Expand Down

0 comments on commit 1461d2d

Please sign in to comment.