Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1241388 > unrolled thread
| Started by | Jiri Prchal <jiri.prchal@aksignal.cz> |
|---|---|
| First post | 2015-10-07 13:20 +0200 |
| Last post | 2015-10-07 14:40 +0200 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] misc: eeprom: at25: add Cypress FRAM functionality Jiri Prchal <jiri.prchal@aksignal.cz> - 2015-10-07 13:20 +0200
Re: [PATCH] misc: eeprom: at25: add Cypress FRAM functionality kbuild test robot <lkp@intel.com> - 2015-10-07 13:40 +0200
Re: [PATCH] misc: eeprom: at25: add Cypress FRAM functionality kbuild test robot <lkp@intel.com> - 2015-10-07 14:40 +0200
| From | Jiri Prchal <jiri.prchal@aksignal.cz> |
|---|---|
| Date | 2015-10-07 13:20 +0200 |
| Subject | [PATCH] misc: eeprom: at25: add Cypress FRAM functionality |
| Message-ID | <qgUVk-39p-33@gated-at.bofh.it> |
This patch adds functionality for Cypress FRAMs on SPI bus, such as FM25V05,
FM25V10 etc.
Added to at25 driver:
- reading device ID and choose size and addr len from it
- serial number reading and exporting it to sysfs
- new compatible string
Signed-off-by: Jiri Prchal <jiri.prchal@aksignal.cz>
---
drivers/misc/eeprom/Kconfig | 5 +-
drivers/misc/eeprom/at25.c | 209 +++++++++++++++++++++++++++++++++++++++-----
2 files changed, 192 insertions(+), 22 deletions(-)
diff --git a/drivers/misc/eeprom/Kconfig b/drivers/misc/eeprom/Kconfig
index 04f2e1f..99c7cff 100644
--- a/drivers/misc/eeprom/Kconfig
+++ b/drivers/misc/eeprom/Kconfig
@@ -28,10 +28,11 @@ config EEPROM_AT24
will be called at24.
config EEPROM_AT25
- tristate "SPI EEPROMs from most vendors"
+ tristate "SPI EEPROMs (FRAMs) from most vendors"
depends on SPI && SYSFS
help
- Enable this driver to get read/write support to most SPI EEPROMs,
+ Enable this driver to get read/write support to most SPI EEPROMs
+ and Cypress FRAMs,
after you configure the board init code to know about each eeprom
on your target board.
diff --git a/drivers/misc/eeprom/at25.c b/drivers/misc/eeprom/at25.c
index 0a1af93..60d1d39 100644
--- a/drivers/misc/eeprom/at25.c
+++ b/drivers/misc/eeprom/at25.c
@@ -1,5 +1,6 @@
/*
* at25.c -- support most SPI EEPROMs, such as Atmel AT25 models
+ * and Cypress FRAMs FM25 models
*
* Copyright (C) 2006 David Brownell
*
@@ -19,6 +20,8 @@
#include <linux/spi/spi.h>
#include <linux/spi/eeprom.h>
#include <linux/property.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
/*
* NOTE: this is an *EEPROM* driver. The vagaries of product naming
@@ -34,6 +37,7 @@ struct at25_data {
struct spi_eeprom chip;
struct bin_attribute bin;
unsigned addrlen;
+ int has_sernum;
};
#define AT25_WREN 0x06 /* latch the write enable */
@@ -42,6 +46,9 @@ struct at25_data {
#define AT25_WRSR 0x01 /* write status register */
#define AT25_READ 0x03 /* read byte(s) */
#define AT25_WRITE 0x02 /* write byte(s)/sector */
+#define FM25_SLEEP 0xb9 /* enter sleep mode */
+#define FM25_RDID 0x9f /* read device ID */
+#define FM25_RDSN 0xc3 /* read S/N */
#define AT25_SR_nRDY 0x01 /* nRDY = write-in-progress */
#define AT25_SR_WEN 0x02 /* write enable (latched) */
@@ -51,6 +58,9 @@ struct at25_data {
#define AT25_INSTR_BIT3 0x08 /* Additional address bit in instr */
+#define FM25_ID_LEN 9 /* ID lenght */
+#define FM25_SN_LEN 8 /* serial number lenght */
+
#define EE_MAXADDRLEN 3 /* 24 bit addresses, up to 2 MBytes */
/* Specs often allow 5 msec for a page write, sometimes 20 msec;
@@ -58,6 +68,9 @@ struct at25_data {
*/
#define EE_TIMEOUT 25
+#define IS_EEPROM 0
+#define IS_FRAM 1
+
/*-------------------------------------------------------------------------*/
#define io_limit PAGE_SIZE /* bytes */
@@ -132,6 +145,83 @@ at25_ee_read(
}
static ssize_t
+fm25_id_read(struct at25_data *at25, char *buf)
+{
+ u8 command = FM25_RDID;
+ ssize_t status;
+ struct spi_transfer t[2];
+ struct spi_message m;
+
+ spi_message_init(&m);
+ memset(t, 0, sizeof t);
+
+ t[0].tx_buf = &command;
+ t[0].len = 1;
+ spi_message_add_tail(&t[0], &m);
+
+ t[1].rx_buf = buf;
+ t[1].len = FM25_ID_LEN;
+ spi_message_add_tail(&t[1], &m);
+
+ mutex_lock(&at25->lock);
+
+ status = spi_sync(at25->spi, &m);
+ dev_dbg(&at25->spi->dev,
+ "read %Zd bytes of ID --> %d\n",
+ FM25_ID_LEN, (int) status);
+
+ mutex_unlock(&at25->lock);
+ return status ? status : FM25_ID_LEN;
+}
+
+static ssize_t
+fm25_sernum_read(struct at25_data *at25, char *buf)
+{
+ u8 command = FM25_RDSN;
+ ssize_t status;
+ struct spi_transfer t[2];
+ struct spi_message m;
+
+ spi_message_init(&m);
+ memset(t, 0, sizeof t);
+
+ t[0].tx_buf = &command;
+ t[0].len = 1;
+ spi_message_add_tail(&t[0], &m);
+
+ t[1].rx_buf = buf;
+ t[1].len = FM25_SN_LEN;
+ spi_message_add_tail(&t[1], &m);
+
+ mutex_lock(&at25->lock);
+
+ status = spi_sync(at25->spi, &m);
+ dev_dbg(&at25->spi->dev,
+ "read %Zd bytes of serial number --> %d\n",
+ FM25_SN_LEN, (int) status);
+
+ mutex_unlock(&at25->lock);
+ return status ? status : FM25_SN_LEN;
+}
+
+static ssize_t
+sernum_show(struct device *dev, struct device_attribute *attr, char *buf)
+{
+ char binbuf[FM25_SN_LEN];
+ struct at25_data *at25;
+ int i;
+ char *pbuf = buf;
+
+ at25 = dev_get_drvdata(dev);
+ fm25_sernum_read(at25, binbuf);
+ for (i = 0; i < FM25_SN_LEN; i++)
+ pbuf += sprintf(pbuf, "%02x ", binbuf[i]);
+ sprintf(--pbuf, "\n");
+ return (3 * i);
+}
+static const DEVICE_ATTR_RO(sernum);
+
+static ssize_t
at25_bin_read(struct file *filp, struct kobject *kobj,
struct bin_attribute *bin_attr,
char *buf, loff_t off, size_t count)
@@ -301,12 +391,21 @@ static ssize_t at25_mem_write(struct memory_accessor *mem, const char *buf,
/*-------------------------------------------------------------------------*/
-static int at25_fw_to_chip(struct device *dev, struct spi_eeprom *chip)
+static int at25_fw_to_chip(struct device *dev, struct spi_eeprom *chip,
+ int is_fram)
{
u32 val;
+ char *name;
memset(chip, 0, sizeof(*chip));
- strncpy(chip->name, "at25", sizeof(chip->name));
+ device_property_read_string(dev, "name", &name);
+ strncpy(chip->name, name, sizeof(chip->name));
+
+ if (is_fram) {
+ if (device_property_present(dev, "read-only"))
+ chip->flags |= EE_READONLY;
+ return 0;
+ }
if (device_property_read_u32(dev, "size", &val) == 0 ||
device_property_read_u32(dev, "at25,byte-len", &val) == 0) {
@@ -354,6 +453,13 @@ static int at25_fw_to_chip(struct device *dev, struct spi_eeprom *chip)
return 0;
}
+static const struct of_device_id at25_of_match[] = {
+ { .compatible = "atmel,at25", .data = (const void *)IS_EEPROM },
+ { .compatible = "cypress,fm25", .data = (const void *)IS_FRAM },
+ { }
+};
+MODULE_DEVICE_TABLE(of, at25_of_match);
+
static int at25_probe(struct spi_device *spi)
{
struct at25_data *at25 = NULL;
@@ -361,25 +467,34 @@ static int at25_probe(struct spi_device *spi)
int err;
int sr;
int addrlen;
+ char id[FM25_ID_LEN];
+ const struct of_device_id *match;
+ int is_fram = 0;
+
+ match = of_match_device(of_match_ptr(at25_of_match), &spi->dev);
+ if (match)
+ is_fram = (int)(uintptr_t)match->data;
/* Chip description */
if (!spi->dev.platform_data) {
- err = at25_fw_to_chip(&spi->dev, &chip);
+ err = at25_fw_to_chip(&spi->dev, &chip, is_fram);
if (err)
return err;
} else
chip = *(struct spi_eeprom *)spi->dev.platform_data;
/* For now we only support 8/16/24 bit addressing */
- if (chip.flags & EE_ADDR1)
- addrlen = 1;
- else if (chip.flags & EE_ADDR2)
- addrlen = 2;
- else if (chip.flags & EE_ADDR3)
- addrlen = 3;
- else {
- dev_dbg(&spi->dev, "unsupported address type\n");
- return -EINVAL;
+ if (!is_fram) {
+ if (chip.flags & EE_ADDR1)
+ addrlen = 1;
+ else if (chip.flags & EE_ADDR2)
+ addrlen = 2;
+ else if (chip.flags & EE_ADDR3)
+ addrlen = 3;
+ else {
+ dev_dbg(&spi->dev, "unsupported address type\n");
+ return -EINVAL;
+ }
}
/* Ping the chip ... the status register is pretty portable,
@@ -402,6 +517,56 @@ static int at25_probe(struct spi_device *spi)
spi_set_drvdata(spi, at25);
at25->addrlen = addrlen;
+ if (is_fram) {
+ /* Get ID of chip */
+ fm25_id_read(at25, id);
+ if (id[6] != 0xc2) {
+ dev_err(&spi->dev,
+ "Error: no Cypress FRAM (id %02x)\n", id[6]);
+ return -ENODEV;
+ }
+ /* set size found in ID */
+ switch (id[7]) {
+ case 0x21:
+ at25->chip.byte_len = 16 * 1024;
+ break;
+ case 0x22:
+ at25->chip.byte_len = 32 * 1024;
+ break;
+ case 0x23:
+ at25->chip.byte_len = 64 * 1024;
+ break;
+ case 0x24:
+ at25->chip.byte_len = 128 * 1024;
+ break;
+ case 0x25:
+ at25->chip.byte_len = 256 * 1024;
+ break;
+ default:
+ dev_err(&spi->dev,
+ "Error: unsupported size (id %02x)\n",
+ id[7]);
+ return -ENODEV;
+ break;
+ }
+
+ if (at25->chip.byte_len > 64 * 1024) {
+ at25->addrlen = 3;
+ at25->chip.flags |= EE_ADDR3;
+ }
+ else {
+ at25->addrlen = 2;
+ at25->chip.flags |= EE_ADDR2;
+ }
+
+ if (id[8])
+ at25->has_sernum = 1;
+ else
+ at25->has_sernum = 0;
+
+ at25->chip.page_size = PAGE_SIZE;
+ }
+
/* Export the EEPROM bytes through sysfs, since that's convenient.
* And maybe to other kernel code; it might hold a board's Ethernet
* address, or board-specific calibration data generated on the
@@ -412,7 +577,7 @@ static int at25_probe(struct spi_device *spi)
* security codes, board-specific manufacturing calibrations, etc.
*/
sysfs_bin_attr_init(&at25->bin);
- at25->bin.attr.name = "eeprom";
+ at25->bin.attr.name = is_fram ? "fram" : "eeprom";
at25->bin.attr.mode = S_IRUSR;
at25->bin.read = at25_bin_read;
at25->mem.read = at25_mem_read;
@@ -428,15 +593,23 @@ static int at25_probe(struct spi_device *spi)
if (err)
return err;
+ /* Export the FM25 serial number */
+ if (at25->has_sernum) {
+ err = device_create_file(&spi->dev, &dev_attr_sernum);
+ if (err)
+ return err;
+ }
+
if (chip.setup)
chip.setup(&at25->mem, chip.context);
- dev_info(&spi->dev, "%Zd %s %s eeprom%s, pagesize %u\n",
+ dev_info(&spi->dev, "%Zd %s %s %s%s, pagesize %u\n",
(at25->bin.size < 1024)
? at25->bin.size
: (at25->bin.size / 1024),
(at25->bin.size < 1024) ? "Byte" : "KByte",
at25->chip.name,
+ is_fram ? "fram" : "eeprom",
(chip.flags & EE_READONLY) ? " (readonly)" : "",
at25->chip.page_size);
return 0;
@@ -448,17 +621,13 @@ static int at25_remove(struct spi_device *spi)
at25 = spi_get_drvdata(spi);
sysfs_remove_bin_file(&spi->dev.kobj, &at25->bin);
+ if (at25->has_sernum)
+ device_remove_file(&spi->dev, &dev_attr_sernum);
return 0;
}
/*-------------------------------------------------------------------------*/
-static const struct of_device_id at25_of_match[] = {
- { .compatible = "atmel,at25", },
- { }
-};
-MODULE_DEVICE_TABLE(of, at25_of_match);
-
static struct spi_driver at25_driver = {
.driver = {
.name = "at25",
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | kbuild test robot <lkp@intel.com> |
|---|---|
| Date | 2015-10-07 13:40 +0200 |
| Message-ID | <qgVeF-3vT-5@gated-at.bofh.it> |
| In reply to | #1241388 |
[Multipart message — attachments visible in raw view] — view raw
Hi Jiri,
[auto build test WARNING on v4.3-rc4 -- if it's inappropriate base, please ignore]
config: x86_64-randconfig-x019-201540 (attached as .config)
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
All warnings (new ones prefixed by >>):
In file included from drivers/misc/eeprom/at25.c:17:0:
drivers/misc/eeprom/at25.c: In function 'fm25_id_read':
>> drivers/misc/eeprom/at25.c:170:3: warning: format '%Zd' expects argument of type 'signed size_t', but argument 4 has type 'int' [-Wformat=]
"read %Zd bytes of ID --> %d\n",
^
include/linux/device.h:1180:31: note: in definition of macro 'dev_dbg'
dev_printk(KERN_DEBUG, dev, format, ##arg); \
^
drivers/misc/eeprom/at25.c: In function 'fm25_sernum_read':
drivers/misc/eeprom/at25.c:200:3: warning: format '%Zd' expects argument of type 'signed size_t', but argument 4 has type 'int' [-Wformat=]
"read %Zd bytes of serial number --> %d\n",
^
include/linux/device.h:1180:31: note: in definition of macro 'dev_dbg'
dev_printk(KERN_DEBUG, dev, format, ##arg); \
^
drivers/misc/eeprom/at25.c: In function 'at25_fw_to_chip':
drivers/misc/eeprom/at25.c:401:43: warning: passing argument 3 of 'device_property_read_string' from incompatible pointer type [-Wincompatible-pointer-types]
device_property_read_string(dev, "name", &name);
^
In file included from drivers/misc/eeprom/at25.c:22:0:
include/linux/property.h:41:5: note: expected 'const char **' but argument is of type 'char **'
int device_property_read_string(struct device *dev, const char *propname,
^
vim +170 drivers/misc/eeprom/at25.c
11 */
12
13 #include <linux/kernel.h>
14 #include <linux/module.h>
15 #include <linux/slab.h>
16 #include <linux/delay.h>
> 17 #include <linux/device.h>
18 #include <linux/sched.h>
19
20 #include <linux/spi/spi.h>
21 #include <linux/spi/eeprom.h>
22 #include <linux/property.h>
23 #include <linux/of.h>
24 #include <linux/of_device.h>
25
26 /*
27 * NOTE: this is an *EEPROM* driver. The vagaries of product naming
28 * mean that some AT25 products are EEPROMs, and others are FLASH.
29 * Handle FLASH chips with the drivers/mtd/devices/m25p80.c driver,
30 * not this one!
31 */
32
33 struct at25_data {
34 struct spi_device *spi;
35 struct memory_accessor mem;
36 struct mutex lock;
37 struct spi_eeprom chip;
38 struct bin_attribute bin;
39 unsigned addrlen;
40 int has_sernum;
41 };
42
43 #define AT25_WREN 0x06 /* latch the write enable */
44 #define AT25_WRDI 0x04 /* reset the write enable */
45 #define AT25_RDSR 0x05 /* read status register */
46 #define AT25_WRSR 0x01 /* write status register */
47 #define AT25_READ 0x03 /* read byte(s) */
48 #define AT25_WRITE 0x02 /* write byte(s)/sector */
49 #define FM25_SLEEP 0xb9 /* enter sleep mode */
50 #define FM25_RDID 0x9f /* read device ID */
51 #define FM25_RDSN 0xc3 /* read S/N */
52
53 #define AT25_SR_nRDY 0x01 /* nRDY = write-in-progress */
54 #define AT25_SR_WEN 0x02 /* write enable (latched) */
55 #define AT25_SR_BP0 0x04 /* BP for software writeprotect */
56 #define AT25_SR_BP1 0x08
57 #define AT25_SR_WPEN 0x80 /* writeprotect enable */
58
59 #define AT25_INSTR_BIT3 0x08 /* Additional address bit in instr */
60
61 #define FM25_ID_LEN 9 /* ID lenght */
62 #define FM25_SN_LEN 8 /* serial number lenght */
63
64 #define EE_MAXADDRLEN 3 /* 24 bit addresses, up to 2 MBytes */
65
66 /* Specs often allow 5 msec for a page write, sometimes 20 msec;
67 * it's important to recover from write timeouts.
68 */
69 #define EE_TIMEOUT 25
70
71 #define IS_EEPROM 0
72 #define IS_FRAM 1
73
74 /*-------------------------------------------------------------------------*/
75
76 #define io_limit PAGE_SIZE /* bytes */
77
78 static ssize_t
79 at25_ee_read(
80 struct at25_data *at25,
81 char *buf,
82 unsigned offset,
83 size_t count
84 )
85 {
86 u8 command[EE_MAXADDRLEN + 1];
87 u8 *cp;
88 ssize_t status;
89 struct spi_transfer t[2];
90 struct spi_message m;
91 u8 instr;
92
93 if (unlikely(offset >= at25->bin.size))
94 return 0;
95 if ((offset + count) > at25->bin.size)
96 count = at25->bin.size - offset;
97 if (unlikely(!count))
98 return count;
99
100 cp = command;
101
102 instr = AT25_READ;
103 if (at25->chip.flags & EE_INSTR_BIT3_IS_ADDR)
104 if (offset >= (1U << (at25->addrlen * 8)))
105 instr |= AT25_INSTR_BIT3;
106 *cp++ = instr;
107
108 /* 8/16/24-bit address is written MSB first */
109 switch (at25->addrlen) {
110 default: /* case 3 */
111 *cp++ = offset >> 16;
112 case 2:
113 *cp++ = offset >> 8;
114 case 1:
115 case 0: /* can't happen: for better codegen */
116 *cp++ = offset >> 0;
117 }
118
119 spi_message_init(&m);
120 memset(t, 0, sizeof t);
121
122 t[0].tx_buf = command;
123 t[0].len = at25->addrlen + 1;
124 spi_message_add_tail(&t[0], &m);
125
126 t[1].rx_buf = buf;
127 t[1].len = count;
128 spi_message_add_tail(&t[1], &m);
129
130 mutex_lock(&at25->lock);
131
132 /* Read it all at once.
133 *
134 * REVISIT that's potentially a problem with large chips, if
135 * other devices on the bus need to be accessed regularly or
136 * this chip is clocked very slowly
137 */
138 status = spi_sync(at25->spi, &m);
139 dev_dbg(&at25->spi->dev,
140 "read %Zd bytes at %d --> %d\n",
141 count, offset, (int) status);
142
143 mutex_unlock(&at25->lock);
144 return status ? status : count;
145 }
146
147 static ssize_t
148 fm25_id_read(struct at25_data *at25, char *buf)
149 {
150 u8 command = FM25_RDID;
151 ssize_t status;
152 struct spi_transfer t[2];
153 struct spi_message m;
154
155 spi_message_init(&m);
156 memset(t, 0, sizeof t);
157
158 t[0].tx_buf = &command;
159 t[0].len = 1;
160 spi_message_add_tail(&t[0], &m);
161
162 t[1].rx_buf = buf;
163 t[1].len = FM25_ID_LEN;
164 spi_message_add_tail(&t[1], &m);
165
166 mutex_lock(&at25->lock);
167
168 status = spi_sync(at25->spi, &m);
169 dev_dbg(&at25->spi->dev,
> 170 "read %Zd bytes of ID --> %d\n",
171 FM25_ID_LEN, (int) status);
172
173 mutex_unlock(&at25->lock);
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[toc] | [prev] | [next] | [standalone]
| From | kbuild test robot <lkp@intel.com> |
|---|---|
| Date | 2015-10-07 14:40 +0200 |
| Message-ID | <qgWaL-4Te-25@gated-at.bofh.it> |
| In reply to | #1241388 |
Hi Jiri,
[auto build test WARNING on v4.3-rc4 -- if it's inappropriate base, please ignore]
reproduce:
# apt-get install sparse
make ARCH=x86_64 allmodconfig
make C=1 CF=-D__CHECK_ENDIAN__
sparse warnings: (new ones prefixed by >>)
>> drivers/misc/eeprom/at25.c:401:51: sparse: incorrect type in argument 3 (different modifiers)
drivers/misc/eeprom/at25.c:401:51: expected char const **val
drivers/misc/eeprom/at25.c:401:51: got char **<noident>
In file included from include/linux/printk.h:277:0,
from include/linux/kernel.h:13,
from drivers/misc/eeprom/at25.c:13:
drivers/misc/eeprom/at25.c: In function 'fm25_id_read':
drivers/misc/eeprom/at25.c:170:3: warning: format '%Zd' expects argument of type 'signed size_t', but argument 4 has type 'int' [-Wformat=]
"read %Zd bytes of ID --> %d\n",
^
include/linux/dynamic_debug.h:86:39: note: in definition of macro 'dynamic_dev_dbg'
__dynamic_dev_dbg(&descriptor, dev, fmt, \
^
drivers/misc/eeprom/at25.c:169:2: note: in expansion of macro 'dev_dbg'
dev_dbg(&at25->spi->dev,
^
drivers/misc/eeprom/at25.c: In function 'fm25_sernum_read':
drivers/misc/eeprom/at25.c:200:3: warning: format '%Zd' expects argument of type 'signed size_t', but argument 4 has type 'int' [-Wformat=]
"read %Zd bytes of serial number --> %d\n",
^
include/linux/dynamic_debug.h:86:39: note: in definition of macro 'dynamic_dev_dbg'
__dynamic_dev_dbg(&descriptor, dev, fmt, \
^
drivers/misc/eeprom/at25.c:199:2: note: in expansion of macro 'dev_dbg'
dev_dbg(&at25->spi->dev,
^
drivers/misc/eeprom/at25.c: In function 'at25_fw_to_chip':
drivers/misc/eeprom/at25.c:401:43: warning: passing argument 3 of 'device_property_read_string' from incompatible pointer type [-Wincompatible-pointer-types]
device_property_read_string(dev, "name", &name);
^
In file included from drivers/misc/eeprom/at25.c:22:0:
include/linux/property.h:41:5: note: expected 'const char **' but argument is of type 'char **'
int device_property_read_string(struct device *dev, const char *propname,
^
vim +401 drivers/misc/eeprom/at25.c
385 off_t offset, size_t count)
386 {
387 struct at25_data *at25 = container_of(mem, struct at25_data, mem);
388
389 return at25_ee_write(at25, buf, offset, count);
390 }
391
392 /*-------------------------------------------------------------------------*/
393
394 static int at25_fw_to_chip(struct device *dev, struct spi_eeprom *chip,
395 int is_fram)
396 {
397 u32 val;
398 char *name;
399
400 memset(chip, 0, sizeof(*chip));
> 401 device_property_read_string(dev, "name", &name);
402 strncpy(chip->name, name, sizeof(chip->name));
403
404 if (is_fram) {
405 if (device_property_present(dev, "read-only"))
406 chip->flags |= EE_READONLY;
407 return 0;
408 }
409
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web