[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230207060924.265789-3-sai.krishna.potthuri@amd.com>
Date: Tue, 7 Feb 2023 11:39:23 +0530
From: Sai Krishna Potthuri <sai.krishna.potthuri@....com>
To: Mark Brown <broonie@...nel.org>,
Tudor Ambarus <tudor.ambarus@...rochip.com>,
Pratyush Yadav <pratyush@...nel.org>,
"Michael Walle" <michael@...le.cc>,
Miquel Raynal <miquel.raynal@...tlin.com>,
Richard Weinberger <richard@....at>,
Vignesh Raghavendra <vigneshr@...com>
CC: <linux-mtd@...ts.infradead.org>, <linux-spi@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <saikrishna12468@...il.com>,
<git@....com>, Sai Krishna Potthuri <sai.krishna.potthuri@....com>
Subject: [PATCH 2/3] mtd: spi-nor: Add and update device_id field in spi_mem structure
Xilinx Versal Octal SPI controller drivers might require the device id
information to perform the Rx tuning operation. Since there is no common
Tuning Data Pattern defined across all vendors, controllers which requires
Rx tuning to find out the optimal sampling point for data lines, this
device id information will be used as a golden data.
spi-nor core updates the device id information in device_id field
while reading the id of the flash device.
Signed-off-by: Sai Krishna Potthuri <sai.krishna.potthuri@....com>
---
drivers/mtd/spi-nor/core.c | 1 +
include/linux/spi/spi-mem.h | 4 ++++
2 files changed, 5 insertions(+)
diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
index bee8fc4c9f07..9811e74ef3b6 100644
--- a/drivers/mtd/spi-nor/core.c
+++ b/drivers/mtd/spi-nor/core.c
@@ -1644,6 +1644,7 @@ static const struct flash_info *spi_nor_match_id(struct spi_nor *nor,
if (part->id_len &&
!memcmp(part->id, id, part->id_len)) {
nor->manufacturer = manufacturers[i];
+ memcpy(nor->spimem->device_id, id, SPI_NOR_MAX_ID_LEN);
return part;
}
}
diff --git a/include/linux/spi/spi-mem.h b/include/linux/spi/spi-mem.h
index 8e984d75f5b6..e9ae5c1b7391 100644
--- a/include/linux/spi/spi-mem.h
+++ b/include/linux/spi/spi-mem.h
@@ -181,11 +181,14 @@ struct spi_mem_dirmap_desc {
void *priv;
};
+#define SPI_MEM_DEV_MAX_ID_LEN 6
+
/**
* struct spi_mem - describes a SPI memory device
* @spi: the underlying SPI device
* @drvpriv: spi_mem_driver private data
* @name: name of the SPI memory device
+ * @device_id: device id of the SPI memory device
*
* Extra information that describe the SPI memory device and may be needed by
* the controller to properly handle this device should be placed here.
@@ -197,6 +200,7 @@ struct spi_mem {
struct spi_device *spi;
void *drvpriv;
const char *name;
+ u8 device_id[SPI_MEM_DEV_MAX_ID_LEN];
};
/**
--
2.25.1
Powered by blists - more mailing lists