The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] misc: eeprom: at25: add Cypress FRAM functionality
@ 2015-10-07 11:16 Jiri Prchal
  2015-10-07 11:34 ` kbuild test robot
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Jiri Prchal @ 2015-10-07 11:16 UTC (permalink / raw)
  To: gregkh, srinivas.kandagatla, maxime.ripard, rafael.j.wysocki,
	mika.westerberg, grant.likely, linux-kernel
  Cc: Jiri Prchal

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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] misc: eeprom: at25: add Cypress FRAM functionality
  2015-10-07 11:16 [PATCH] misc: eeprom: at25: add Cypress FRAM functionality Jiri Prchal
@ 2015-10-07 11:34 ` kbuild test robot
  2015-10-07 11:37 ` kbuild test robot
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: kbuild test robot @ 2015-10-07 11:34 UTC (permalink / raw)
  To: Jiri Prchal
  Cc: kbuild-all, gregkh, srinivas.kandagatla, maxime.ripard,
	rafael.j.wysocki, mika.westerberg, grant.likely, linux-kernel,
	Jiri Prchal

[-- Attachment #1: Type: text/plain, Size: 4733 bytes --]

Hi Jiri,

[auto build test WARNING on v4.3-rc4 -- if it's inappropriate base, please ignore]

config: sparc64-allyesconfig (attached as .config)
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=sparc64 

All warnings (new ones prefixed by >>):

   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':
>> include/linux/dynamic_debug.h:64:16: warning: format '%Zd' expects argument of type 'signed size_t', but argument 4 has type 'int' [-Wformat=]
     static struct _ddebug  __aligned(8)   \
                   ^
   include/linux/dynamic_debug.h:84:2: note: in expansion of macro 'DEFINE_DYNAMIC_DEBUG_METADATA'
     DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt);  \
     ^
   include/linux/device.h:1171:2: note: in expansion of macro 'dynamic_dev_dbg'
     dynamic_dev_dbg(dev, format, ##__VA_ARGS__); \
     ^
   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':
>> include/linux/dynamic_debug.h:64:16: warning: format '%Zd' expects argument of type 'signed size_t', but argument 4 has type 'int' [-Wformat=]
     static struct _ddebug  __aligned(8)   \
                   ^
   include/linux/dynamic_debug.h:84:2: note: in expansion of macro 'DEFINE_DYNAMIC_DEBUG_METADATA'
     DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt);  \
     ^
   include/linux/device.h:1171:2: note: in expansion of macro 'dynamic_dev_dbg'
     dynamic_dev_dbg(dev, format, ##__VA_ARGS__); \
     ^
   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:2: warning: passing argument 3 of 'device_property_read_string' from incompatible pointer type
     device_property_read_string(dev, "name", &name);
     ^
   In file included from include/linux/of.h:26:0,
                    from arch/sparc/include/asm/openprom.h:14,
                    from arch/sparc/include/asm/device.h:9,
                    from include/linux/device.h:30,
                    from drivers/misc/eeprom/at25.c:17:
   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 +64 include/linux/dynamic_debug.h

b48420c1 Jim Cromie  2012-04-27  48  					const char *modname);
b48420c1 Jim Cromie  2012-04-27  49  
cbc46635 Joe Perches 2011-08-11  50  struct device;
cbc46635 Joe Perches 2011-08-11  51  
b9075fa9 Joe Perches 2011-10-31  52  extern __printf(3, 4)
906d2015 Joe Perches 2014-09-24  53  void __dynamic_dev_dbg(struct _ddebug *descriptor, const struct device *dev,
b9075fa9 Joe Perches 2011-10-31  54  		       const char *fmt, ...);
cbc46635 Joe Perches 2011-08-11  55  
ffa10cb4 Jason Baron 2011-08-11  56  struct net_device;
ffa10cb4 Jason Baron 2011-08-11  57  
b9075fa9 Joe Perches 2011-10-31  58  extern __printf(3, 4)
906d2015 Joe Perches 2014-09-24  59  void __dynamic_netdev_dbg(struct _ddebug *descriptor,
ffa10cb4 Jason Baron 2011-08-11  60  			  const struct net_device *dev,
b9075fa9 Joe Perches 2011-10-31  61  			  const char *fmt, ...);
ffa10cb4 Jason Baron 2011-08-11  62  
07613b0b Jason Baron 2011-10-04  63  #define DEFINE_DYNAMIC_DEBUG_METADATA(name, fmt)		\
c0d2af63 Joe Perches 2012-10-18 @64  	static struct _ddebug  __aligned(8)			\
07613b0b Jason Baron 2011-10-04  65  	__attribute__((section("__verbose"))) name = {		\
07613b0b Jason Baron 2011-10-04  66  		.modname = KBUILD_MODNAME,			\
07613b0b Jason Baron 2011-10-04  67  		.function = __func__,				\
07613b0b Jason Baron 2011-10-04  68  		.filename = __FILE__,				\
07613b0b Jason Baron 2011-10-04  69  		.format = (fmt),				\
07613b0b Jason Baron 2011-10-04  70  		.lineno = __LINE__,				\
07613b0b Jason Baron 2011-10-04  71  		.flags =  _DPRINTK_FLAGS_DEFAULT,		\
07613b0b Jason Baron 2011-10-04  72  	}

:::::: The code at line 64 was first introduced by commit
:::::: c0d2af637863940b1a4fb208224ca7acb905c39f dynamic_debug: Remove unnecessary __used

:::::: TO: Joe Perches <joe@perches.com>
:::::: CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 43733 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] misc: eeprom: at25: add Cypress FRAM functionality
  2015-10-07 11:16 [PATCH] misc: eeprom: at25: add Cypress FRAM functionality Jiri Prchal
  2015-10-07 11:34 ` kbuild test robot
@ 2015-10-07 11:37 ` kbuild test robot
  2015-10-07 11:40 ` kbuild test robot
  2015-10-07 12:38 ` kbuild test robot
  3 siblings, 0 replies; 5+ messages in thread
From: kbuild test robot @ 2015-10-07 11:37 UTC (permalink / raw)
  To: Jiri Prchal
  Cc: kbuild-all, gregkh, srinivas.kandagatla, maxime.ripard,
	rafael.j.wysocki, mika.westerberg, grant.likely, linux-kernel,
	Jiri Prchal

[-- Attachment #1: Type: text/plain, Size: 7012 bytes --]

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

[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 18806 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] misc: eeprom: at25: add Cypress FRAM functionality
  2015-10-07 11:16 [PATCH] misc: eeprom: at25: add Cypress FRAM functionality Jiri Prchal
  2015-10-07 11:34 ` kbuild test robot
  2015-10-07 11:37 ` kbuild test robot
@ 2015-10-07 11:40 ` kbuild test robot
  2015-10-07 12:38 ` kbuild test robot
  3 siblings, 0 replies; 5+ messages in thread
From: kbuild test robot @ 2015-10-07 11:40 UTC (permalink / raw)
  To: Jiri Prchal
  Cc: kbuild-all, gregkh, srinivas.kandagatla, maxime.ripard,
	rafael.j.wysocki, mika.westerberg, grant.likely, linux-kernel,
	Jiri Prchal

[-- Attachment #1: Type: text/plain, Size: 15045 bytes --]

Hi Jiri,

[auto build test WARNING on v4.3-rc4 -- if it's inappropriate base, please ignore]

config: i386-randconfig-s1-201540 (attached as .config)
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings

All warnings (new ones prefixed by >>):

   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,
        ^
   drivers/misc/eeprom/at25.c: In function 'at25_probe':
>> drivers/misc/eeprom/at25.c:518:16: warning: 'addrlen' may be used uninitialized in this function [-Wmaybe-uninitialized]
     at25->addrlen = addrlen;
                   ^

vim +/addrlen +518 drivers/misc/eeprom/at25.c

411f4400b drivers/misc/eeprom/at25.c Jiri Prchal                2015-10-07  395  			   int is_fram)
d6ae0d578 drivers/misc/eeprom/at25.c David Daney                2012-08-22  396  {
d6ae0d578 drivers/misc/eeprom/at25.c David Daney                2012-08-22  397  	u32 val;
411f4400b drivers/misc/eeprom/at25.c Jiri Prchal                2015-10-07  398  	char *name;
d6ae0d578 drivers/misc/eeprom/at25.c David Daney                2012-08-22  399  
d6ae0d578 drivers/misc/eeprom/at25.c David Daney                2012-08-22  400  	memset(chip, 0, sizeof(*chip));
411f4400b drivers/misc/eeprom/at25.c Jiri Prchal                2015-10-07 @401  	device_property_read_string(dev, "name", &name);
411f4400b drivers/misc/eeprom/at25.c Jiri Prchal                2015-10-07  402  	strncpy(chip->name, name, sizeof(chip->name));
411f4400b drivers/misc/eeprom/at25.c Jiri Prchal                2015-10-07  403  
411f4400b drivers/misc/eeprom/at25.c Jiri Prchal                2015-10-07  404  	if (is_fram) {
411f4400b drivers/misc/eeprom/at25.c Jiri Prchal                2015-10-07  405  		if (device_property_present(dev, "read-only"))
411f4400b drivers/misc/eeprom/at25.c Jiri Prchal                2015-10-07  406  			chip->flags |= EE_READONLY;
411f4400b drivers/misc/eeprom/at25.c Jiri Prchal                2015-10-07  407  		return 0;
411f4400b drivers/misc/eeprom/at25.c Jiri Prchal                2015-10-07  408  	}
d6ae0d578 drivers/misc/eeprom/at25.c David Daney                2012-08-22  409  
f60e70749 drivers/misc/eeprom/at25.c Mika Westerberg            2014-10-21  410  	if (device_property_read_u32(dev, "size", &val) == 0 ||
f60e70749 drivers/misc/eeprom/at25.c Mika Westerberg            2014-10-21  411  	    device_property_read_u32(dev, "at25,byte-len", &val) == 0) {
d6ae0d578 drivers/misc/eeprom/at25.c David Daney                2012-08-22  412  		chip->byte_len = val;
d6ae0d578 drivers/misc/eeprom/at25.c David Daney                2012-08-22  413  	} else {
d6ae0d578 drivers/misc/eeprom/at25.c David Daney                2012-08-22  414  		dev_err(dev, "Error: missing \"size\" property\n");
d6ae0d578 drivers/misc/eeprom/at25.c David Daney                2012-08-22  415  		return -ENODEV;
d6ae0d578 drivers/misc/eeprom/at25.c David Daney                2012-08-22  416  	}
d6ae0d578 drivers/misc/eeprom/at25.c David Daney                2012-08-22  417  
f60e70749 drivers/misc/eeprom/at25.c Mika Westerberg            2014-10-21  418  	if (device_property_read_u32(dev, "pagesize", &val) == 0 ||
f60e70749 drivers/misc/eeprom/at25.c Mika Westerberg            2014-10-21  419  	    device_property_read_u32(dev, "at25,page-size", &val) == 0) {
d6ae0d578 drivers/misc/eeprom/at25.c David Daney                2012-08-22  420  		chip->page_size = (u16)val;
d6ae0d578 drivers/misc/eeprom/at25.c David Daney                2012-08-22  421  	} else {
d6ae0d578 drivers/misc/eeprom/at25.c David Daney                2012-08-22  422  		dev_err(dev, "Error: missing \"pagesize\" property\n");
d6ae0d578 drivers/misc/eeprom/at25.c David Daney                2012-08-22  423  		return -ENODEV;
d6ae0d578 drivers/misc/eeprom/at25.c David Daney                2012-08-22  424  	}
d6ae0d578 drivers/misc/eeprom/at25.c David Daney                2012-08-22  425  
f60e70749 drivers/misc/eeprom/at25.c Mika Westerberg            2014-10-21  426  	if (device_property_read_u32(dev, "at25,addr-mode", &val) == 0) {
d6ae0d578 drivers/misc/eeprom/at25.c David Daney                2012-08-22  427  		chip->flags = (u16)val;
d6ae0d578 drivers/misc/eeprom/at25.c David Daney                2012-08-22  428  	} else {
f60e70749 drivers/misc/eeprom/at25.c Mika Westerberg            2014-10-21  429  		if (device_property_read_u32(dev, "address-width", &val)) {
d6ae0d578 drivers/misc/eeprom/at25.c David Daney                2012-08-22  430  			dev_err(dev,
d6ae0d578 drivers/misc/eeprom/at25.c David Daney                2012-08-22  431  				"Error: missing \"address-width\" property\n");
d6ae0d578 drivers/misc/eeprom/at25.c David Daney                2012-08-22  432  			return -ENODEV;
d6ae0d578 drivers/misc/eeprom/at25.c David Daney                2012-08-22  433  		}
d6ae0d578 drivers/misc/eeprom/at25.c David Daney                2012-08-22  434  		switch (val) {
d6ae0d578 drivers/misc/eeprom/at25.c David Daney                2012-08-22  435  		case 8:
d6ae0d578 drivers/misc/eeprom/at25.c David Daney                2012-08-22  436  			chip->flags |= EE_ADDR1;
d6ae0d578 drivers/misc/eeprom/at25.c David Daney                2012-08-22  437  			break;
d6ae0d578 drivers/misc/eeprom/at25.c David Daney                2012-08-22  438  		case 16:
d6ae0d578 drivers/misc/eeprom/at25.c David Daney                2012-08-22  439  			chip->flags |= EE_ADDR2;
d6ae0d578 drivers/misc/eeprom/at25.c David Daney                2012-08-22  440  			break;
d6ae0d578 drivers/misc/eeprom/at25.c David Daney                2012-08-22  441  		case 24:
d6ae0d578 drivers/misc/eeprom/at25.c David Daney                2012-08-22  442  			chip->flags |= EE_ADDR3;
d6ae0d578 drivers/misc/eeprom/at25.c David Daney                2012-08-22  443  			break;
d6ae0d578 drivers/misc/eeprom/at25.c David Daney                2012-08-22  444  		default:
d6ae0d578 drivers/misc/eeprom/at25.c David Daney                2012-08-22  445  			dev_err(dev,
d6ae0d578 drivers/misc/eeprom/at25.c David Daney                2012-08-22  446  				"Error: bad \"address-width\" property: %u\n",
d6ae0d578 drivers/misc/eeprom/at25.c David Daney                2012-08-22  447  				val);
d6ae0d578 drivers/misc/eeprom/at25.c David Daney                2012-08-22  448  			return -ENODEV;
d6ae0d578 drivers/misc/eeprom/at25.c David Daney                2012-08-22  449  		}
f60e70749 drivers/misc/eeprom/at25.c Mika Westerberg            2014-10-21  450  		if (device_property_present(dev, "read-only"))
d6ae0d578 drivers/misc/eeprom/at25.c David Daney                2012-08-22  451  			chip->flags |= EE_READONLY;
d6ae0d578 drivers/misc/eeprom/at25.c David Daney                2012-08-22  452  	}
d6ae0d578 drivers/misc/eeprom/at25.c David Daney                2012-08-22  453  	return 0;
d6ae0d578 drivers/misc/eeprom/at25.c David Daney                2012-08-22  454  }
d6ae0d578 drivers/misc/eeprom/at25.c David Daney                2012-08-22  455  
411f4400b drivers/misc/eeprom/at25.c Jiri Prchal                2015-10-07  456  static const struct of_device_id at25_of_match[] = {
411f4400b drivers/misc/eeprom/at25.c Jiri Prchal                2015-10-07  457  	{ .compatible = "atmel,at25", .data = (const void *)IS_EEPROM },
411f4400b drivers/misc/eeprom/at25.c Jiri Prchal                2015-10-07  458  	{ .compatible = "cypress,fm25", .data = (const void *)IS_FRAM },
411f4400b drivers/misc/eeprom/at25.c Jiri Prchal                2015-10-07  459  	{ }
411f4400b drivers/misc/eeprom/at25.c Jiri Prchal                2015-10-07  460  };
411f4400b drivers/misc/eeprom/at25.c Jiri Prchal                2015-10-07  461  MODULE_DEVICE_TABLE(of, at25_of_match);
411f4400b drivers/misc/eeprom/at25.c Jiri Prchal                2015-10-07  462  
b587b13a4 drivers/spi/at25.c         David Brownell             2007-02-12  463  static int at25_probe(struct spi_device *spi)
b587b13a4 drivers/spi/at25.c         David Brownell             2007-02-12  464  {
b587b13a4 drivers/spi/at25.c         David Brownell             2007-02-12  465  	struct at25_data	*at25 = NULL;
002176db8 drivers/misc/eeprom/at25.c Alexandre Pereira da Silva 2012-06-14  466  	struct spi_eeprom	chip;
b587b13a4 drivers/spi/at25.c         David Brownell             2007-02-12  467  	int			err;
b587b13a4 drivers/spi/at25.c         David Brownell             2007-02-12  468  	int			sr;
b587b13a4 drivers/spi/at25.c         David Brownell             2007-02-12  469  	int			addrlen;
411f4400b drivers/misc/eeprom/at25.c Jiri Prchal                2015-10-07  470  	char			id[FM25_ID_LEN];
411f4400b drivers/misc/eeprom/at25.c Jiri Prchal                2015-10-07  471  	const struct of_device_id *match;
411f4400b drivers/misc/eeprom/at25.c Jiri Prchal                2015-10-07  472  	int			is_fram = 0;
411f4400b drivers/misc/eeprom/at25.c Jiri Prchal                2015-10-07  473  
411f4400b drivers/misc/eeprom/at25.c Jiri Prchal                2015-10-07  474  	match = of_match_device(of_match_ptr(at25_of_match), &spi->dev);
411f4400b drivers/misc/eeprom/at25.c Jiri Prchal                2015-10-07  475  	if (match)
411f4400b drivers/misc/eeprom/at25.c Jiri Prchal                2015-10-07  476  		is_fram = (int)(uintptr_t)match->data;
b587b13a4 drivers/spi/at25.c         David Brownell             2007-02-12  477  
b587b13a4 drivers/spi/at25.c         David Brownell             2007-02-12  478  	/* Chip description */
002176db8 drivers/misc/eeprom/at25.c Alexandre Pereira da Silva 2012-06-14  479  	if (!spi->dev.platform_data) {
411f4400b drivers/misc/eeprom/at25.c Jiri Prchal                2015-10-07  480  		err = at25_fw_to_chip(&spi->dev, &chip, is_fram);
d6ae0d578 drivers/misc/eeprom/at25.c David Daney                2012-08-22  481  		if (err)
01fe7b43e drivers/misc/eeprom/at25.c Nikolay Balandin           2013-05-28  482  			return err;
002176db8 drivers/misc/eeprom/at25.c Alexandre Pereira da Silva 2012-06-14  483  	} else
002176db8 drivers/misc/eeprom/at25.c Alexandre Pereira da Silva 2012-06-14  484  		chip = *(struct spi_eeprom *)spi->dev.platform_data;
b587b13a4 drivers/spi/at25.c         David Brownell             2007-02-12  485  
b587b13a4 drivers/spi/at25.c         David Brownell             2007-02-12  486  	/* For now we only support 8/16/24 bit addressing */
411f4400b drivers/misc/eeprom/at25.c Jiri Prchal                2015-10-07  487  	if (!is_fram) {
002176db8 drivers/misc/eeprom/at25.c Alexandre Pereira da Silva 2012-06-14  488  		if (chip.flags & EE_ADDR1)
b587b13a4 drivers/spi/at25.c         David Brownell             2007-02-12  489  			addrlen = 1;
002176db8 drivers/misc/eeprom/at25.c Alexandre Pereira da Silva 2012-06-14  490  		else if (chip.flags & EE_ADDR2)
b587b13a4 drivers/spi/at25.c         David Brownell             2007-02-12  491  			addrlen = 2;
002176db8 drivers/misc/eeprom/at25.c Alexandre Pereira da Silva 2012-06-14  492  		else if (chip.flags & EE_ADDR3)
b587b13a4 drivers/spi/at25.c         David Brownell             2007-02-12  493  			addrlen = 3;
b587b13a4 drivers/spi/at25.c         David Brownell             2007-02-12  494  		else {
b587b13a4 drivers/spi/at25.c         David Brownell             2007-02-12  495  			dev_dbg(&spi->dev, "unsupported address type\n");
01fe7b43e drivers/misc/eeprom/at25.c Nikolay Balandin           2013-05-28  496  			return -EINVAL;
b587b13a4 drivers/spi/at25.c         David Brownell             2007-02-12  497  		}
411f4400b drivers/misc/eeprom/at25.c Jiri Prchal                2015-10-07  498  	}
b587b13a4 drivers/spi/at25.c         David Brownell             2007-02-12  499  
b587b13a4 drivers/spi/at25.c         David Brownell             2007-02-12  500  	/* Ping the chip ... the status register is pretty portable,
b587b13a4 drivers/spi/at25.c         David Brownell             2007-02-12  501  	 * unlike probing manufacturer IDs.  We do expect that system
b587b13a4 drivers/spi/at25.c         David Brownell             2007-02-12  502  	 * firmware didn't write it in the past few milliseconds!
b587b13a4 drivers/spi/at25.c         David Brownell             2007-02-12  503  	 */
b587b13a4 drivers/spi/at25.c         David Brownell             2007-02-12  504  	sr = spi_w8r8(spi, AT25_RDSR);
b587b13a4 drivers/spi/at25.c         David Brownell             2007-02-12  505  	if (sr < 0 || sr & AT25_SR_nRDY) {
c6ca97d26 drivers/spi/at25.c         Atsushi Nemoto             2007-03-16  506  		dev_dbg(&spi->dev, "rdsr --> %d (%02x)\n", sr, sr);
01fe7b43e drivers/misc/eeprom/at25.c Nikolay Balandin           2013-05-28  507  		return -ENXIO;
b587b13a4 drivers/spi/at25.c         David Brownell             2007-02-12  508  	}
b587b13a4 drivers/spi/at25.c         David Brownell             2007-02-12  509  
01fe7b43e drivers/misc/eeprom/at25.c Nikolay Balandin           2013-05-28  510  	at25 = devm_kzalloc(&spi->dev, sizeof(struct at25_data), GFP_KERNEL);
01fe7b43e drivers/misc/eeprom/at25.c Nikolay Balandin           2013-05-28  511  	if (!at25)
01fe7b43e drivers/misc/eeprom/at25.c Nikolay Balandin           2013-05-28  512  		return -ENOMEM;
b587b13a4 drivers/spi/at25.c         David Brownell             2007-02-12  513  
b587b13a4 drivers/spi/at25.c         David Brownell             2007-02-12  514  	mutex_init(&at25->lock);
002176db8 drivers/misc/eeprom/at25.c Alexandre Pereira da Silva 2012-06-14  515  	at25->chip = chip;
b587b13a4 drivers/spi/at25.c         David Brownell             2007-02-12  516  	at25->spi = spi_dev_get(spi);
41ddcf67b drivers/misc/eeprom/at25.c Jingoo Han                 2013-04-05  517  	spi_set_drvdata(spi, at25);
b587b13a4 drivers/spi/at25.c         David Brownell             2007-02-12 @518  	at25->addrlen = addrlen;
b587b13a4 drivers/spi/at25.c         David Brownell             2007-02-12  519  
411f4400b drivers/misc/eeprom/at25.c Jiri Prchal                2015-10-07  520  	if (is_fram) {
411f4400b drivers/misc/eeprom/at25.c Jiri Prchal                2015-10-07  521  		/* Get ID of chip */

:::::: The code at line 518 was first introduced by commit
:::::: b587b13a4f670ebae79ae6259cf44328455e4e69 [PATCH] SPI eeprom driver

:::::: TO: David Brownell <david-b@pacbell.net>
:::::: CC: Linus Torvalds <torvalds@woody.linux-foundation.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 17963 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] misc: eeprom: at25: add Cypress FRAM functionality
  2015-10-07 11:16 [PATCH] misc: eeprom: at25: add Cypress FRAM functionality Jiri Prchal
                   ` (2 preceding siblings ...)
  2015-10-07 11:40 ` kbuild test robot
@ 2015-10-07 12:38 ` kbuild test robot
  3 siblings, 0 replies; 5+ messages in thread
From: kbuild test robot @ 2015-10-07 12:38 UTC (permalink / raw)
  To: Jiri Prchal
  Cc: kbuild-all, gregkh, srinivas.kandagatla, maxime.ripard,
	rafael.j.wysocki, mika.westerberg, grant.likely, linux-kernel,
	Jiri Prchal

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-10-07 12:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-07 11:16 [PATCH] misc: eeprom: at25: add Cypress FRAM functionality Jiri Prchal
2015-10-07 11:34 ` kbuild test robot
2015-10-07 11:37 ` kbuild test robot
2015-10-07 11:40 ` kbuild test robot
2015-10-07 12:38 ` kbuild test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox