linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v5 0/5] Add memory mapped read support for ti-qspi
@ 2015-12-11  4:09 Vignesh R
  2015-12-11  4:09 ` [PATCH v5 1/5] spi: introduce accelerated read support for spi flash devices Vignesh R
                   ` (6 more replies)
  0 siblings, 7 replies; 20+ messages in thread
From: Vignesh R @ 2015-12-11  4:09 UTC (permalink / raw)
  To: Tony Lindgren, Brian Norris, Mark Brown
  Cc: Rob Herring, Russell King, hramrach, devicetree, linux-kernel,
	linux-omap, linux-arm-kernel, linux-mtd, linux-spi, Vignesh R

Changes since v4:
Use syscon to access system control module register in ti-qspi driver.

Changes since v3:
Rework to introduce spi_flash_read_message struct.
Support different opcode/addr/data formats as per Brian's suggestion
here: https://lkml.org/lkml/2015/11/11/454

Changes since v2:
Remove mmap_lock_mutex.
Optimize enable/disable of mmap mode.

Changes since v1:
Introduce API in SPI core that MTD flash driver can call for mmap read
instead of directly calling spi-master driver callback. This API makes
sure that SPI core msg queue is locked during mmap transfers.
v1: https://lkml.org/lkml/2015/9/4/103


Cover letter:

This patch series adds support for memory mapped read port of ti-qspi.
ti-qspi has a special memory mapped port through which SPI flash
memories can be accessed directly via SoC specific memory region.

First patch adds a method to pass flash specific information like read
opcode, dummy bytes etc and to request mmap read. Second patch
implements mmap read method in ti-qspi driver. Patch 3 adapts m25p80 to
use mmap read method before trying normal SPI transfer. Patch 4 and 5
add memory map region DT entries for DRA7xx and AM43xx SoCs.

This patch series is based on the discussions here:
http://www.spinics.net/lists/linux-spi/msg04796.html

Tested on DRA74 EVM and AM437x-SK.
Read performance increases from ~100kB/s to ~2.5MB/s.

Vignesh R (5):
  spi: introduce accelerated read support for spi flash devices
  spi: spi-ti-qspi: add mmap mode read support
  mtd: devices: m25p80: add support for mmap read request
  ARM: dts: DRA7: add entry for qspi mmap region
  ARM: dts: AM4372: add entry for qspi mmap region

 Documentation/devicetree/bindings/spi/ti_qspi.txt |  22 +++-
 arch/arm/boot/dts/am4372.dtsi                     |   4 +-
 arch/arm/boot/dts/dra7.dtsi                       |   6 +-
 drivers/mtd/devices/m25p80.c                      |  20 ++++
 drivers/spi/spi-ti-qspi.c                         | 139 +++++++++++++++++-----
 drivers/spi/spi.c                                 |  45 +++++++
 include/linux/spi/spi.h                           |  41 +++++++
 7 files changed, 243 insertions(+), 34 deletions(-)

-- 
2.6.3


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

* [PATCH v5 1/5] spi: introduce accelerated read support for spi flash devices
  2015-12-11  4:09 [PATCH v5 0/5] Add memory mapped read support for ti-qspi Vignesh R
@ 2015-12-11  4:09 ` Vignesh R
  2015-12-11  4:09 ` [PATCH v5 2/5] spi: spi-ti-qspi: add mmap mode read support Vignesh R
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 20+ messages in thread
From: Vignesh R @ 2015-12-11  4:09 UTC (permalink / raw)
  To: Tony Lindgren, Brian Norris, Mark Brown
  Cc: Rob Herring, Russell King, hramrach, devicetree, linux-kernel,
	linux-omap, linux-arm-kernel, linux-mtd, linux-spi, Vignesh R

In addition to providing direct access to SPI bus, some spi controller
hardwares (like ti-qspi) provide special port (like memory mapped port)
that are optimized to improve SPI flash read performance.
This means the controller can automatically send the SPI signals
required to read data from the SPI flash device.
For this, SPI controller needs to know flash specific information like
read command to use, dummy bytes and address width.

Introduce spi_flash_read() interface to support accelerated read
over SPI flash devices. SPI master drivers can implement this callback to
support interfaces such as memory mapped read etc. m25p80 flash driver
and other flash drivers can call this make use of such interfaces. The
interface should only be used with SPI flashes and cannot be used with
other SPI devices.

Signed-off-by: Vignesh R <vigneshr@ti.com>
---

v5: No changes.

 drivers/spi/spi.c       | 45 +++++++++++++++++++++++++++++++++++++++++++++
 include/linux/spi/spi.h | 41 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 86 insertions(+)

diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index e2415be209d5..cc2b54139352 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -1134,6 +1134,7 @@ static void __spi_pump_messages(struct spi_master *master, bool in_kthread)
 		}
 	}
 
+	mutex_lock(&master->bus_lock_mutex);
 	trace_spi_message_start(master->cur_msg);
 
 	if (master->prepare_message) {
@@ -1143,6 +1144,7 @@ static void __spi_pump_messages(struct spi_master *master, bool in_kthread)
 				"failed to prepare message: %d\n", ret);
 			master->cur_msg->status = ret;
 			spi_finalize_current_message(master);
+			mutex_unlock(&master->bus_lock_mutex);
 			return;
 		}
 		master->cur_msg_prepared = true;
@@ -1152,6 +1154,7 @@ static void __spi_pump_messages(struct spi_master *master, bool in_kthread)
 	if (ret) {
 		master->cur_msg->status = ret;
 		spi_finalize_current_message(master);
+		mutex_unlock(&master->bus_lock_mutex);
 		return;
 	}
 
@@ -1159,8 +1162,10 @@ static void __spi_pump_messages(struct spi_master *master, bool in_kthread)
 	if (ret) {
 		dev_err(&master->dev,
 			"failed to transfer one message from queue\n");
+		mutex_unlock(&master->bus_lock_mutex);
 		return;
 	}
+	mutex_unlock(&master->bus_lock_mutex);
 }
 
 /**
@@ -2327,6 +2332,46 @@ int spi_async_locked(struct spi_device *spi, struct spi_message *message)
 EXPORT_SYMBOL_GPL(spi_async_locked);
 
 
+int spi_flash_read(struct spi_device *spi,
+		   struct spi_flash_read_message *msg)
+
+{
+	struct spi_master *master = spi->master;
+	int ret;
+
+	if ((msg->opcode_nbits == SPI_NBITS_DUAL ||
+	     msg->addr_nbits == SPI_NBITS_DUAL) &&
+	    !(spi->mode & (SPI_TX_DUAL | SPI_TX_QUAD)))
+		return -EINVAL;
+	if ((msg->opcode_nbits == SPI_NBITS_QUAD ||
+	     msg->addr_nbits == SPI_NBITS_QUAD) &&
+	    !(spi->mode & SPI_TX_QUAD))
+		return -EINVAL;
+	if (msg->data_nbits == SPI_NBITS_DUAL &&
+	    !(spi->mode & (SPI_RX_DUAL | SPI_RX_QUAD)))
+		return -EINVAL;
+	if (msg->data_nbits == SPI_NBITS_QUAD &&
+	    !(spi->mode &  SPI_RX_QUAD))
+		return -EINVAL;
+
+	if (master->auto_runtime_pm) {
+		ret = pm_runtime_get_sync(master->dev.parent);
+		if (ret < 0) {
+			dev_err(&master->dev, "Failed to power device: %d\n",
+				ret);
+			return ret;
+		}
+	}
+	mutex_lock(&master->bus_lock_mutex);
+	ret = master->spi_flash_read(spi, msg);
+	mutex_unlock(&master->bus_lock_mutex);
+	if (master->auto_runtime_pm)
+		pm_runtime_put(master->dev.parent);
+
+	return ret;
+}
+EXPORT_SYMBOL_GPL(spi_flash_read);
+
 /*-------------------------------------------------------------------------*/
 
 /* Utility methods for SPI master protocol drivers, layered on
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index cce80e6dc7d1..246d7d519f3f 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -25,6 +25,7 @@
 struct dma_chan;
 struct spi_master;
 struct spi_transfer;
+struct spi_flash_read_message;
 
 /*
  * INTERFACES between SPI master-side drivers and SPI infrastructure.
@@ -361,6 +362,8 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv)
  * @handle_err: the subsystem calls the driver to handle an error that occurs
  *		in the generic implementation of transfer_one_message().
  * @unprepare_message: undo any work done by prepare_message().
+ * @spi_flash_read: to support spi-controller hardwares that provide
+ *                  accelerated interface to read from flash devices.
  * @cs_gpios: Array of GPIOs to use as chip select lines; one per CS
  *	number. Any individual value may be -ENOENT for CS lines that
  *	are not GPIOs (driven by the SPI controller itself).
@@ -507,6 +510,8 @@ struct spi_master {
 			       struct spi_message *message);
 	int (*unprepare_message)(struct spi_master *master,
 				 struct spi_message *message);
+	int (*spi_flash_read)(struct  spi_device *spi,
+			      struct spi_flash_read_message *msg);
 
 	/*
 	 * These hooks are for drivers that use a generic implementation
@@ -999,6 +1004,42 @@ static inline ssize_t spi_w8r16be(struct spi_device *spi, u8 cmd)
 	return be16_to_cpu(result);
 }
 
+/**
+ * struct spi_flash_read_message - flash specific information for
+ * spi-masters that provide accelerated flash read interfaces
+ * @buf: buffer to read data
+ * @from: offset within the flash from where data is to be read
+ * @len: length of data to be read
+ * @retlen: actual length of data read
+ * @read_opcode: read_opcode to be used to communicate with flash
+ * @addr_width: number of address bytes
+ * @dummy_bytes: number of dummy bytes
+ * @opcode_nbits: number of lines to send opcode
+ * @addr_nbits: number of lines to send address
+ * @data_nbits: number of lines for data
+ */
+struct spi_flash_read_message {
+	void *buf;
+	loff_t from;
+	size_t len;
+	size_t retlen;
+	u8 read_opcode;
+	u8 addr_width;
+	u8 dummy_bytes;
+	u8 opcode_nbits;
+	u8 addr_nbits;
+	u8 data_nbits;
+};
+
+/* SPI core interface for flash read support */
+static inline bool spi_flash_read_supported(struct spi_device *spi)
+{
+	return spi->master->spi_flash_read ? true : false;
+}
+
+int spi_flash_read(struct spi_device *spi,
+		   struct spi_flash_read_message *msg);
+
 /*---------------------------------------------------------------------------*/
 
 /*
-- 
2.6.3


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

* [PATCH v5 2/5] spi: spi-ti-qspi: add mmap mode read support
  2015-12-11  4:09 [PATCH v5 0/5] Add memory mapped read support for ti-qspi Vignesh R
  2015-12-11  4:09 ` [PATCH v5 1/5] spi: introduce accelerated read support for spi flash devices Vignesh R
@ 2015-12-11  4:09 ` Vignesh R
  2015-12-11  4:09 ` [PATCH v5 3/5] mtd: devices: m25p80: add support for mmap read request Vignesh R
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 20+ messages in thread
From: Vignesh R @ 2015-12-11  4:09 UTC (permalink / raw)
  To: Tony Lindgren, Brian Norris, Mark Brown
  Cc: Rob Herring, Russell King, hramrach, devicetree, linux-kernel,
	linux-omap, linux-arm-kernel, linux-mtd, linux-spi, Vignesh R

ti-qspi controller provides mmap port to read data from SPI flashes.
mmap port is enabled in QSPI_SPI_SWITCH_REG. ctrl module register may
also need to be accessed for some SoCs. The QSPI_SPI_SETUP_REGx needs to
be populated with flash specific information like read opcode, read
mode(quad, dual, normal), address width and dummy bytes. Once,
controller is in mmap mode, the whole flash memory is available as a
memory region at SoC specific address. This region can be accessed using
normal memcpy() (or mem-to-mem dma copy). The ti-qspi controller hardware
will internally communicate with SPI flash over SPI bus and get the
requested data.

Implement spi_flash_read() callback to support mmap read over SPI
flash devices. With this, the read throughput increases from ~100kB/s to
~2.5 MB/s.

Signed-off-by: Vignesh R <vigneshr@ti.com>
---

v5:
 * use syscon to access ctrl_mod register.

 drivers/spi/spi-ti-qspi.c | 139 ++++++++++++++++++++++++++++++++++++----------
 1 file changed, 110 insertions(+), 29 deletions(-)

diff --git a/drivers/spi/spi-ti-qspi.c b/drivers/spi/spi-ti-qspi.c
index 64318fcfacf2..eac3c960b2de 100644
--- a/drivers/spi/spi-ti-qspi.c
+++ b/drivers/spi/spi-ti-qspi.c
@@ -31,6 +31,8 @@
 #include <linux/of.h>
 #include <linux/of_device.h>
 #include <linux/pinctrl/consumer.h>
+#include <linux/mfd/syscon.h>
+#include <linux/regmap.h>
 
 #include <linux/spi/spi.h>
 
@@ -44,8 +46,9 @@ struct ti_qspi {
 
 	struct spi_master	*master;
 	void __iomem            *base;
-	void __iomem            *ctrl_base;
 	void __iomem            *mmap_base;
+	struct regmap		*ctrl_base;
+	unsigned int		ctrl_reg;
 	struct clk		*fclk;
 	struct device           *dev;
 
@@ -55,7 +58,7 @@ struct ti_qspi {
 	u32 cmd;
 	u32 dc;
 
-	bool ctrl_mod;
+	bool mmap_enabled;
 };
 
 #define QSPI_PID			(0x0)
@@ -65,11 +68,8 @@ struct ti_qspi {
 #define QSPI_SPI_CMD_REG		(0x48)
 #define QSPI_SPI_STATUS_REG		(0x4c)
 #define QSPI_SPI_DATA_REG		(0x50)
-#define QSPI_SPI_SETUP0_REG		(0x54)
+#define QSPI_SPI_SETUP_REG(n)		((0x54 + 4 * n))
 #define QSPI_SPI_SWITCH_REG		(0x64)
-#define QSPI_SPI_SETUP1_REG		(0x58)
-#define QSPI_SPI_SETUP2_REG		(0x5c)
-#define QSPI_SPI_SETUP3_REG		(0x60)
 #define QSPI_SPI_DATA_REG_1		(0x68)
 #define QSPI_SPI_DATA_REG_2		(0x6c)
 #define QSPI_SPI_DATA_REG_3		(0x70)
@@ -109,6 +109,17 @@ struct ti_qspi {
 
 #define QSPI_AUTOSUSPEND_TIMEOUT         2000
 
+#define MEM_CS_EN(n)			((n + 1) << 8)
+#define MEM_CS_MASK			(7 << 8)
+
+#define MM_SWITCH			0x1
+
+#define QSPI_SETUP_RD_NORMAL		(0x0 << 12)
+#define QSPI_SETUP_RD_DUAL		(0x1 << 12)
+#define QSPI_SETUP_RD_QUAD		(0x3 << 12)
+#define QSPI_SETUP_ADDR_SHIFT		8
+#define QSPI_SETUP_DUMMY_SHIFT		10
+
 static inline unsigned long ti_qspi_read(struct ti_qspi *qspi,
 		unsigned long reg)
 {
@@ -366,6 +377,72 @@ static int qspi_transfer_msg(struct ti_qspi *qspi, struct spi_transfer *t)
 	return 0;
 }
 
+static void ti_qspi_enable_memory_map(struct spi_device *spi)
+{
+	struct ti_qspi  *qspi = spi_master_get_devdata(spi->master);
+
+	ti_qspi_write(qspi, MM_SWITCH, QSPI_SPI_SWITCH_REG);
+	if (qspi->ctrl_base) {
+		regmap_update_bits(qspi->ctrl_base, qspi->ctrl_reg,
+				   MEM_CS_EN(spi->chip_select),
+				   MEM_CS_MASK);
+	}
+	qspi->mmap_enabled = true;
+}
+
+static void ti_qspi_disable_memory_map(struct spi_device *spi)
+{
+	struct ti_qspi  *qspi = spi_master_get_devdata(spi->master);
+
+	ti_qspi_write(qspi, 0, QSPI_SPI_SWITCH_REG);
+	if (qspi->ctrl_base)
+		regmap_update_bits(qspi->ctrl_base, qspi->ctrl_reg,
+				   0, MEM_CS_MASK);
+	qspi->mmap_enabled = false;
+}
+
+static void ti_qspi_setup_mmap_read(struct spi_device *spi,
+				    struct spi_flash_read_message *msg)
+{
+	struct ti_qspi  *qspi = spi_master_get_devdata(spi->master);
+	u32 memval = msg->read_opcode;
+
+	switch (msg->data_nbits) {
+	case SPI_NBITS_QUAD:
+		memval |= QSPI_SETUP_RD_QUAD;
+		break;
+	case SPI_NBITS_DUAL:
+		memval |= QSPI_SETUP_RD_DUAL;
+		break;
+	default:
+		memval |= QSPI_SETUP_RD_NORMAL;
+		break;
+	}
+	memval |= ((msg->addr_width - 1) << QSPI_SETUP_ADDR_SHIFT |
+		   msg->dummy_bytes << QSPI_SETUP_DUMMY_SHIFT);
+	ti_qspi_write(qspi, memval,
+		      QSPI_SPI_SETUP_REG(spi->chip_select));
+}
+
+static int ti_qspi_spi_flash_read(struct  spi_device *spi,
+				  struct spi_flash_read_message *msg)
+{
+	struct ti_qspi *qspi = spi_master_get_devdata(spi->master);
+	int ret = 0;
+
+	mutex_lock(&qspi->list_lock);
+
+	if (!qspi->mmap_enabled)
+		ti_qspi_enable_memory_map(spi);
+	ti_qspi_setup_mmap_read(spi, msg);
+	memcpy_fromio(msg->buf, qspi->mmap_base + msg->from, msg->len);
+	msg->retlen = msg->len;
+
+	mutex_unlock(&qspi->list_lock);
+
+	return ret;
+}
+
 static int ti_qspi_start_transfer_one(struct spi_master *master,
 		struct spi_message *m)
 {
@@ -398,6 +475,9 @@ static int ti_qspi_start_transfer_one(struct spi_master *master,
 
 	mutex_lock(&qspi->list_lock);
 
+	if (qspi->mmap_enabled)
+		ti_qspi_disable_memory_map(spi);
+
 	list_for_each_entry(t, &m->transfers, transfer_list) {
 		qspi->cmd |= QSPI_WLEN(t->bits_per_word);
 
@@ -441,7 +521,7 @@ static int ti_qspi_probe(struct platform_device *pdev)
 {
 	struct  ti_qspi *qspi;
 	struct spi_master *master;
-	struct resource         *r, *res_ctrl, *res_mmap;
+	struct resource         *r, *res_mmap;
 	struct device_node *np = pdev->dev.of_node;
 	u32 max_freq;
 	int ret = 0, num_cs, irq;
@@ -487,16 +567,6 @@ static int ti_qspi_probe(struct platform_device *pdev)
 		}
 	}
 
-	res_ctrl = platform_get_resource_byname(pdev,
-			IORESOURCE_MEM, "qspi_ctrlmod");
-	if (res_ctrl == NULL) {
-		res_ctrl = platform_get_resource(pdev, IORESOURCE_MEM, 2);
-		if (res_ctrl == NULL) {
-			dev_dbg(&pdev->dev,
-				"control module resources not required\n");
-		}
-	}
-
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0) {
 		dev_err(&pdev->dev, "no irq resource?\n");
@@ -511,20 +581,31 @@ static int ti_qspi_probe(struct platform_device *pdev)
 		goto free_master;
 	}
 
-	if (res_ctrl) {
-		qspi->ctrl_mod = true;
-		qspi->ctrl_base = devm_ioremap_resource(&pdev->dev, res_ctrl);
-		if (IS_ERR(qspi->ctrl_base)) {
-			ret = PTR_ERR(qspi->ctrl_base);
-			goto free_master;
-		}
-	}
-
 	if (res_mmap) {
-		qspi->mmap_base = devm_ioremap_resource(&pdev->dev, res_mmap);
+		qspi->mmap_base = devm_ioremap_resource(&pdev->dev,
+							res_mmap);
+		master->spi_flash_read = ti_qspi_spi_flash_read;
 		if (IS_ERR(qspi->mmap_base)) {
-			ret = PTR_ERR(qspi->mmap_base);
-			goto free_master;
+			dev_err(&pdev->dev,
+				"falling back to PIO mode\n");
+			master->spi_flash_read = NULL;
+		}
+	}
+	qspi->mmap_enabled = false;
+
+	if (of_property_read_bool(np, "syscon-chipselects")) {
+		qspi->ctrl_base =
+		syscon_regmap_lookup_by_phandle(np,
+						"syscon-chipselects");
+		if (IS_ERR(qspi->ctrl_base))
+			return PTR_ERR(qspi->ctrl_base);
+		ret = of_property_read_u32_index(np,
+						 "syscon-chipselects",
+						 1, &qspi->ctrl_reg);
+		if (ret) {
+			dev_err(&pdev->dev,
+				"couldn't get ctrl_mod reg index\n");
+			return ret;
 		}
 	}
 
-- 
2.6.3


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

* [PATCH v5 3/5] mtd: devices: m25p80: add support for mmap read request
  2015-12-11  4:09 [PATCH v5 0/5] Add memory mapped read support for ti-qspi Vignesh R
  2015-12-11  4:09 ` [PATCH v5 1/5] spi: introduce accelerated read support for spi flash devices Vignesh R
  2015-12-11  4:09 ` [PATCH v5 2/5] spi: spi-ti-qspi: add mmap mode read support Vignesh R
@ 2015-12-11  4:09 ` Vignesh R
  2016-02-09 19:36   ` Mark Brown
  2015-12-11  4:09 ` [PATCH v5 4/5] ARM: dts: DRA7: add entry for qspi mmap region Vignesh R
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 20+ messages in thread
From: Vignesh R @ 2015-12-11  4:09 UTC (permalink / raw)
  To: Tony Lindgren, Brian Norris, Mark Brown
  Cc: Rob Herring, Russell King, hramrach, devicetree, linux-kernel,
	linux-omap, linux-arm-kernel, linux-mtd, linux-spi, Vignesh R

Certain spi controllers may provide accelerated interface to read from
m25p80 type flash devices. This interface provides better read
performance than regular SPI interface.
Call spi_flash_read(), if supported, to make use of such interface.

Signed-off-by: Vignesh R <vigneshr@ti.com>
---

v5: No changes

 drivers/mtd/devices/m25p80.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index fe9ceb7b5405..00094a668c62 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -131,6 +131,26 @@ static int m25p80_read(struct spi_nor *nor, loff_t from, size_t len,
 	/* convert the dummy cycles to the number of bytes */
 	dummy /= 8;
 
+	if (spi_flash_read_supported(spi)) {
+		struct spi_flash_read_message msg;
+		int ret;
+
+		msg.buf = buf;
+		msg.from = from;
+		msg.len = len;
+		msg.read_opcode = nor->read_opcode;
+		msg.addr_width = nor->addr_width;
+		msg.dummy_bytes = dummy;
+		/* TODO: Support other combinations */
+		msg.opcode_nbits = SPI_NBITS_SINGLE;
+		msg.addr_nbits = SPI_NBITS_SINGLE;
+		msg.data_nbits = m25p80_rx_nbits(nor);
+
+		ret = spi_flash_read(spi, &msg);
+		*retlen = msg.retlen;
+		return ret;
+	}
+
 	spi_message_init(&m);
 	memset(t, 0, (sizeof t));
 
-- 
2.6.3


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

* [PATCH v5 4/5] ARM: dts: DRA7: add entry for qspi mmap region
  2015-12-11  4:09 [PATCH v5 0/5] Add memory mapped read support for ti-qspi Vignesh R
                   ` (2 preceding siblings ...)
  2015-12-11  4:09 ` [PATCH v5 3/5] mtd: devices: m25p80: add support for mmap read request Vignesh R
@ 2015-12-11  4:09 ` Vignesh R
  2015-12-11 15:09   ` Rob Herring
  2015-12-11  4:10 ` [PATCH v5 5/5] ARM: dts: AM4372: " Vignesh R
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 20+ messages in thread
From: Vignesh R @ 2015-12-11  4:09 UTC (permalink / raw)
  To: Tony Lindgren, Brian Norris, Mark Brown
  Cc: Rob Herring, Russell King, hramrach, devicetree, linux-kernel,
	linux-omap, linux-arm-kernel, linux-mtd, linux-spi, Vignesh R

Add qspi memory mapped region entries for DRA7xx based SoCs. Also,
update the binding documents for the controller to document this change.

Signed-off-by: Vignesh R <vigneshr@ti.com>
---

v5: use syscon to access scm register.

 Documentation/devicetree/bindings/spi/ti_qspi.txt | 17 +++++++++++++++++
 arch/arm/boot/dts/dra7.dtsi                       |  6 ++++--
 2 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/spi/ti_qspi.txt b/Documentation/devicetree/bindings/spi/ti_qspi.txt
index 601a360531a5..809c3f334316 100644
--- a/Documentation/devicetree/bindings/spi/ti_qspi.txt
+++ b/Documentation/devicetree/bindings/spi/ti_qspi.txt
@@ -15,6 +15,10 @@ Recommended properties:
 - spi-max-frequency: Definition as per
                      Documentation/devicetree/bindings/spi/spi-bus.txt
 
+Optional properties:
+- syscon-chipselects: Handle to system control region contains QSPI
+		      chipselect register and offset of that register.
+
 Example:
 
 qspi: qspi@4b300000 {
@@ -26,3 +30,16 @@ qspi: qspi@4b300000 {
 	spi-max-frequency = <25000000>;
 	ti,hwmods = "qspi";
 };
+
+For dra7xx:
+qspi: qspi@4b300000 {
+	compatible = "ti,dra7xxx-qspi";
+	reg = <0x4b300000 0x100>,
+	      <0x5c000000 0x4000000>,
+	reg-names = "qspi_base", "qspi_mmap";
+	syscon-chipselects = <&scm_conf 0x558>;
+	#address-cells = <1>;
+	#size-cells = <0>;
+	spi-max-frequency = <48000000>;
+	ti,hwmods = "qspi";
+};
diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
index fe99231cbde5..be91c7781c07 100644
--- a/arch/arm/boot/dts/dra7.dtsi
+++ b/arch/arm/boot/dts/dra7.dtsi
@@ -1153,8 +1153,10 @@
 
 		qspi: qspi@4b300000 {
 			compatible = "ti,dra7xxx-qspi";
-			reg = <0x4b300000 0x100>;
-			reg-names = "qspi_base";
+			reg = <0x4b300000 0x100>,
+			      <0x5c000000 0x4000000>;
+			reg-names = "qspi_base", "qspi_mmap";
+			syscon-chipselects = <&scm_conf 0x558>;
 			#address-cells = <1>;
 			#size-cells = <0>;
 			ti,hwmods = "qspi";
-- 
2.6.3


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

* [PATCH v5 5/5] ARM: dts: AM4372: add entry for qspi mmap region
  2015-12-11  4:09 [PATCH v5 0/5] Add memory mapped read support for ti-qspi Vignesh R
                   ` (3 preceding siblings ...)
  2015-12-11  4:09 ` [PATCH v5 4/5] ARM: dts: DRA7: add entry for qspi mmap region Vignesh R
@ 2015-12-11  4:10 ` Vignesh R
  2015-12-21 12:03 ` [PATCH v5 0/5] Add memory mapped read support for ti-qspi Vignesh R
  2016-01-05  5:20 ` Vignesh R
  6 siblings, 0 replies; 20+ messages in thread
From: Vignesh R @ 2015-12-11  4:10 UTC (permalink / raw)
  To: Tony Lindgren, Brian Norris, Mark Brown
  Cc: Rob Herring, Russell King, hramrach, devicetree, linux-kernel,
	linux-omap, linux-arm-kernel, linux-mtd, linux-spi, Vignesh R

Add qspi memory mapped region entries for AM43xx based SoCs. Also,
update the binding documents for the controller to document this change.

Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Vignesh R <vigneshr@ti.com>
---

v5: No changes.

 Documentation/devicetree/bindings/spi/ti_qspi.txt | 5 +++--
 arch/arm/boot/dts/am4372.dtsi                     | 4 +++-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/spi/ti_qspi.txt b/Documentation/devicetree/bindings/spi/ti_qspi.txt
index 809c3f334316..cc8304aa64ac 100644
--- a/Documentation/devicetree/bindings/spi/ti_qspi.txt
+++ b/Documentation/devicetree/bindings/spi/ti_qspi.txt
@@ -21,9 +21,10 @@ Optional properties:
 
 Example:
 
+For am4372:
 qspi: qspi@4b300000 {
-	compatible = "ti,dra7xxx-qspi";
-	reg = <0x47900000 0x100>, <0x30000000 0x3ffffff>;
+	compatible = "ti,am4372-qspi";
+	reg = <0x47900000 0x100>, <0x30000000 0x4000000>;
 	reg-names = "qspi_base", "qspi_mmap";
 	#address-cells = <1>;
 	#size-cells = <0>;
diff --git a/arch/arm/boot/dts/am4372.dtsi b/arch/arm/boot/dts/am4372.dtsi
index d83ff9c9701e..e32d164102d1 100644
--- a/arch/arm/boot/dts/am4372.dtsi
+++ b/arch/arm/boot/dts/am4372.dtsi
@@ -963,7 +963,9 @@
 
 		qspi: qspi@47900000 {
 			compatible = "ti,am4372-qspi";
-			reg = <0x47900000 0x100>;
+			reg = <0x47900000 0x100>,
+			      <0x30000000 0x4000000>;
+			reg-names = "qspi_base", "qspi_mmap";
 			#address-cells = <1>;
 			#size-cells = <0>;
 			ti,hwmods = "qspi";
-- 
2.6.3


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

* Re: [PATCH v5 4/5] ARM: dts: DRA7: add entry for qspi mmap region
  2015-12-11  4:09 ` [PATCH v5 4/5] ARM: dts: DRA7: add entry for qspi mmap region Vignesh R
@ 2015-12-11 15:09   ` Rob Herring
  2015-12-17 18:45     ` Tony Lindgren
  0 siblings, 1 reply; 20+ messages in thread
From: Rob Herring @ 2015-12-11 15:09 UTC (permalink / raw)
  To: Vignesh R
  Cc: Tony Lindgren, Brian Norris, Mark Brown, Russell King, hramrach,
	devicetree, linux-kernel, linux-omap, linux-arm-kernel,
	linux-mtd, linux-spi

On Fri, Dec 11, 2015 at 09:39:59AM +0530, Vignesh R wrote:
> Add qspi memory mapped region entries for DRA7xx based SoCs. Also,
> update the binding documents for the controller to document this change.
> 
> Signed-off-by: Vignesh R <vigneshr@ti.com>

Acked-by: Rob Herring <robh@kernel.org>

> ---
> 
> v5: use syscon to access scm register.
> 
>  Documentation/devicetree/bindings/spi/ti_qspi.txt | 17 +++++++++++++++++
>  arch/arm/boot/dts/dra7.dtsi                       |  6 ++++--
>  2 files changed, 21 insertions(+), 2 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/spi/ti_qspi.txt b/Documentation/devicetree/bindings/spi/ti_qspi.txt
> index 601a360531a5..809c3f334316 100644
> --- a/Documentation/devicetree/bindings/spi/ti_qspi.txt
> +++ b/Documentation/devicetree/bindings/spi/ti_qspi.txt
> @@ -15,6 +15,10 @@ Recommended properties:
>  - spi-max-frequency: Definition as per
>                       Documentation/devicetree/bindings/spi/spi-bus.txt
>  
> +Optional properties:
> +- syscon-chipselects: Handle to system control region contains QSPI
> +		      chipselect register and offset of that register.
> +
>  Example:
>  
>  qspi: qspi@4b300000 {
> @@ -26,3 +30,16 @@ qspi: qspi@4b300000 {
>  	spi-max-frequency = <25000000>;
>  	ti,hwmods = "qspi";
>  };
> +
> +For dra7xx:
> +qspi: qspi@4b300000 {
> +	compatible = "ti,dra7xxx-qspi";
> +	reg = <0x4b300000 0x100>,
> +	      <0x5c000000 0x4000000>,
> +	reg-names = "qspi_base", "qspi_mmap";
> +	syscon-chipselects = <&scm_conf 0x558>;
> +	#address-cells = <1>;
> +	#size-cells = <0>;
> +	spi-max-frequency = <48000000>;
> +	ti,hwmods = "qspi";
> +};
> diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
> index fe99231cbde5..be91c7781c07 100644
> --- a/arch/arm/boot/dts/dra7.dtsi
> +++ b/arch/arm/boot/dts/dra7.dtsi
> @@ -1153,8 +1153,10 @@
>  
>  		qspi: qspi@4b300000 {
>  			compatible = "ti,dra7xxx-qspi";
> -			reg = <0x4b300000 0x100>;
> -			reg-names = "qspi_base";
> +			reg = <0x4b300000 0x100>,
> +			      <0x5c000000 0x4000000>;
> +			reg-names = "qspi_base", "qspi_mmap";
> +			syscon-chipselects = <&scm_conf 0x558>;
>  			#address-cells = <1>;
>  			#size-cells = <0>;
>  			ti,hwmods = "qspi";
> -- 
> 2.6.3
> 

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

* Re: [PATCH v5 4/5] ARM: dts: DRA7: add entry for qspi mmap region
  2015-12-11 15:09   ` Rob Herring
@ 2015-12-17 18:45     ` Tony Lindgren
  2015-12-18  5:50       ` Vignesh R
  0 siblings, 1 reply; 20+ messages in thread
From: Tony Lindgren @ 2015-12-17 18:45 UTC (permalink / raw)
  To: Rob Herring
  Cc: Vignesh R, Brian Norris, Mark Brown, Russell King, hramrach,
	devicetree, linux-kernel, linux-omap, linux-arm-kernel,
	linux-mtd, linux-spi

* Rob Herring <robh@kernel.org> [151211 07:10]:
> On Fri, Dec 11, 2015 at 09:39:59AM +0530, Vignesh R wrote:
> > Add qspi memory mapped region entries for DRA7xx based SoCs. Also,
> > update the binding documents for the controller to document this change.
> > 
> > Signed-off-by: Vignesh R <vigneshr@ti.com>
> 
> Acked-by: Rob Herring <robh@kernel.org>

Vignes, are patches 4 and 5 safe to apply separately already or
do things break if we do that?

Regards,

Tony

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

* Re: [PATCH v5 4/5] ARM: dts: DRA7: add entry for qspi mmap region
  2015-12-17 18:45     ` Tony Lindgren
@ 2015-12-18  5:50       ` Vignesh R
  2015-12-18 16:42         ` Tony Lindgren
  0 siblings, 1 reply; 20+ messages in thread
From: Vignesh R @ 2015-12-18  5:50 UTC (permalink / raw)
  To: Tony Lindgren, Rob Herring
  Cc: Brian Norris, Mark Brown, Russell King, hramrach, devicetree,
	linux-kernel, linux-omap, linux-arm-kernel, linux-mtd, linux-spi



On 12/18/2015 12:15 AM, Tony Lindgren wrote:
> * Rob Herring <robh@kernel.org> [151211 07:10]:
>> On Fri, Dec 11, 2015 at 09:39:59AM +0530, Vignesh R wrote:
>>> Add qspi memory mapped region entries for DRA7xx based SoCs. Also,
>>> update the binding documents for the controller to document this change.
>>>
>>> Signed-off-by: Vignesh R <vigneshr@ti.com>
>>
>> Acked-by: Rob Herring <robh@kernel.org>
> 
> Vignes, are patches 4 and 5 safe to apply separately already or
> do things break if we do that?

Yes, 4 and 5 can be applied separately w/o driver changes.

-- 
Regards
Vignesh

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

* Re: [PATCH v5 4/5] ARM: dts: DRA7: add entry for qspi mmap region
  2015-12-18  5:50       ` Vignesh R
@ 2015-12-18 16:42         ` Tony Lindgren
  0 siblings, 0 replies; 20+ messages in thread
From: Tony Lindgren @ 2015-12-18 16:42 UTC (permalink / raw)
  To: Vignesh R
  Cc: Rob Herring, Brian Norris, Mark Brown, Russell King, hramrach,
	devicetree, linux-kernel, linux-omap, linux-arm-kernel,
	linux-mtd, linux-spi

* Vignesh R <vigneshr@ti.com> [151217 21:51]:
> 
> 
> On 12/18/2015 12:15 AM, Tony Lindgren wrote:
> > * Rob Herring <robh@kernel.org> [151211 07:10]:
> >> On Fri, Dec 11, 2015 at 09:39:59AM +0530, Vignesh R wrote:
> >>> Add qspi memory mapped region entries for DRA7xx based SoCs. Also,
> >>> update the binding documents for the controller to document this change.
> >>>
> >>> Signed-off-by: Vignesh R <vigneshr@ti.com>
> >>
> >> Acked-by: Rob Herring <robh@kernel.org>
> > 
> > Vignes, are patches 4 and 5 safe to apply separately already or
> > do things break if we do that?
> 
> Yes, 4 and 5 can be applied separately w/o driver changes.

OK picking 4 and 5 into omap-for-v4.5/dt thanks.

Tony

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

* Re: [PATCH v5 0/5] Add memory mapped read support for ti-qspi
  2015-12-11  4:09 [PATCH v5 0/5] Add memory mapped read support for ti-qspi Vignesh R
                   ` (4 preceding siblings ...)
  2015-12-11  4:10 ` [PATCH v5 5/5] ARM: dts: AM4372: " Vignesh R
@ 2015-12-21 12:03 ` Vignesh R
  2016-01-05  5:20 ` Vignesh R
  6 siblings, 0 replies; 20+ messages in thread
From: Vignesh R @ 2015-12-21 12:03 UTC (permalink / raw)
  To: Tony Lindgren, Brian Norris, Mark Brown
  Cc: Rob Herring, Russell King, hramrach, devicetree, linux-kernel,
	linux-omap, linux-arm-kernel, linux-mtd, linux-spi



On 12/11/2015 09:39 AM, Vignesh R wrote:
> Changes since v4:
> Use syscon to access system control module register in ti-qspi driver.
> 
> Changes since v3:
> Rework to introduce spi_flash_read_message struct.
> Support different opcode/addr/data formats as per Brian's suggestion
> here: https://lkml.org/lkml/2015/11/11/454
> 

Gentle Ping on the series...


> Changes since v2:
> Remove mmap_lock_mutex.
> Optimize enable/disable of mmap mode.
> 
> Changes since v1:
> Introduce API in SPI core that MTD flash driver can call for mmap read
> instead of directly calling spi-master driver callback. This API makes
> sure that SPI core msg queue is locked during mmap transfers.
> v1: https://lkml.org/lkml/2015/9/4/103
> 
> 
> Cover letter:
> 
> This patch series adds support for memory mapped read port of ti-qspi.
> ti-qspi has a special memory mapped port through which SPI flash
> memories can be accessed directly via SoC specific memory region.
> 
> First patch adds a method to pass flash specific information like read
> opcode, dummy bytes etc and to request mmap read. Second patch
> implements mmap read method in ti-qspi driver. Patch 3 adapts m25p80 to
> use mmap read method before trying normal SPI transfer. Patch 4 and 5
> add memory map region DT entries for DRA7xx and AM43xx SoCs.
> 
> This patch series is based on the discussions here:
> http://www.spinics.net/lists/linux-spi/msg04796.html
> 
> Tested on DRA74 EVM and AM437x-SK.
> Read performance increases from ~100kB/s to ~2.5MB/s.
> 
> Vignesh R (5):
>   spi: introduce accelerated read support for spi flash devices
>   spi: spi-ti-qspi: add mmap mode read support
>   mtd: devices: m25p80: add support for mmap read request
>   ARM: dts: DRA7: add entry for qspi mmap region
>   ARM: dts: AM4372: add entry for qspi mmap region
> 
>  Documentation/devicetree/bindings/spi/ti_qspi.txt |  22 +++-
>  arch/arm/boot/dts/am4372.dtsi                     |   4 +-
>  arch/arm/boot/dts/dra7.dtsi                       |   6 +-
>  drivers/mtd/devices/m25p80.c                      |  20 ++++
>  drivers/spi/spi-ti-qspi.c                         | 139 +++++++++++++++++-----
>  drivers/spi/spi.c                                 |  45 +++++++
>  include/linux/spi/spi.h                           |  41 +++++++
>  7 files changed, 243 insertions(+), 34 deletions(-)
> 

-- 
Regards
Vignesh

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

* Re: [PATCH v5 0/5] Add memory mapped read support for ti-qspi
  2015-12-11  4:09 [PATCH v5 0/5] Add memory mapped read support for ti-qspi Vignesh R
                   ` (5 preceding siblings ...)
  2015-12-21 12:03 ` [PATCH v5 0/5] Add memory mapped read support for ti-qspi Vignesh R
@ 2016-01-05  5:20 ` Vignesh R
  2016-01-05 18:19   ` Mark Brown
  6 siblings, 1 reply; 20+ messages in thread
From: Vignesh R @ 2016-01-05  5:20 UTC (permalink / raw)
  To: Tony Lindgren, Brian Norris, Mark Brown
  Cc: Rob Herring, Russell King, hramrach, devicetree, linux-kernel,
	linux-omap, linux-arm-kernel, linux-mtd, linux-spi

Hi Brian,

On 12/11/2015 09:39 AM, Vignesh R wrote:
> Changes since v4:
> Use syscon to access system control module register in ti-qspi driver.
> 

Gentle ping...
Are you ok with MTD side changes of this patch series?

> Changes since v3:
> Rework to introduce spi_flash_read_message struct.
> Support different opcode/addr/data formats as per Brian's suggestion
> here: https://lkml.org/lkml/2015/11/11/454
> 
> Changes since v2:
> Remove mmap_lock_mutex.
> Optimize enable/disable of mmap mode.
> 
> Changes since v1:
> Introduce API in SPI core that MTD flash driver can call for mmap read
> instead of directly calling spi-master driver callback. This API makes
> sure that SPI core msg queue is locked during mmap transfers.
> v1: https://lkml.org/lkml/2015/9/4/103
> 
> 
> Cover letter:
> 
> This patch series adds support for memory mapped read port of ti-qspi.
> ti-qspi has a special memory mapped port through which SPI flash
> memories can be accessed directly via SoC specific memory region.
> 
> First patch adds a method to pass flash specific information like read
> opcode, dummy bytes etc and to request mmap read. Second patch
> implements mmap read method in ti-qspi driver. Patch 3 adapts m25p80 to
> use mmap read method before trying normal SPI transfer. Patch 4 and 5
> add memory map region DT entries for DRA7xx and AM43xx SoCs.
> 
> This patch series is based on the discussions here:
> http://www.spinics.net/lists/linux-spi/msg04796.html
> 
> Tested on DRA74 EVM and AM437x-SK.
> Read performance increases from ~100kB/s to ~2.5MB/s.
> 
> Vignesh R (5):
>   spi: introduce accelerated read support for spi flash devices
>   spi: spi-ti-qspi: add mmap mode read support
>   mtd: devices: m25p80: add support for mmap read request
>   ARM: dts: DRA7: add entry for qspi mmap region
>   ARM: dts: AM4372: add entry for qspi mmap region
> 
>  Documentation/devicetree/bindings/spi/ti_qspi.txt |  22 +++-
>  arch/arm/boot/dts/am4372.dtsi                     |   4 +-
>  arch/arm/boot/dts/dra7.dtsi                       |   6 +-
>  drivers/mtd/devices/m25p80.c                      |  20 ++++
>  drivers/spi/spi-ti-qspi.c                         | 139 +++++++++++++++++-----
>  drivers/spi/spi.c                                 |  45 +++++++
>  include/linux/spi/spi.h                           |  41 +++++++
>  7 files changed, 243 insertions(+), 34 deletions(-)
> 

-- 
Regards
Vignesh

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

* Re: [PATCH v5 0/5] Add memory mapped read support for ti-qspi
  2016-01-05  5:20 ` Vignesh R
@ 2016-01-05 18:19   ` Mark Brown
  0 siblings, 0 replies; 20+ messages in thread
From: Mark Brown @ 2016-01-05 18:19 UTC (permalink / raw)
  To: Vignesh R
  Cc: Tony Lindgren, Brian Norris, Rob Herring, Russell King, hramrach,
	devicetree, linux-kernel, linux-omap, linux-arm-kernel,
	linux-mtd, linux-spi

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

On Tue, Jan 05, 2016 at 10:50:42AM +0530, Vignesh R wrote:
> Hi Brian,
> 
> On 12/11/2015 09:39 AM, Vignesh R wrote:
> > Changes since v4:
> > Use syscon to access system control module register in ti-qspi driver.
> > 
> 
> Gentle ping...
> Are you ok with MTD side changes of this patch series?

Please don't send content free pings and please allow a reasonable time
for review (we've just had the Christmas vacation...).

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

* Re: [PATCH v5 3/5] mtd: devices: m25p80: add support for mmap read request
  2015-12-11  4:09 ` [PATCH v5 3/5] mtd: devices: m25p80: add support for mmap read request Vignesh R
@ 2016-02-09 19:36   ` Mark Brown
  2016-02-11  5:33     ` Vignesh R
  0 siblings, 1 reply; 20+ messages in thread
From: Mark Brown @ 2016-02-09 19:36 UTC (permalink / raw)
  To: Vignesh R
  Cc: Tony Lindgren, Brian Norris, Rob Herring, Russell King, hramrach,
	devicetree, linux-kernel, linux-omap, linux-arm-kernel,
	linux-mtd, linux-spi

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

On Fri, Dec 11, 2015 at 09:39:58AM +0530, Vignesh R wrote:

> +	if (spi_flash_read_supported(spi)) {
> +		struct spi_flash_read_message msg;
> +		int ret;
> +
> +		msg.buf = buf;
> +		msg.from = from;
> +		msg.len = len;
> +		msg.read_opcode = nor->read_opcode;
> +		msg.addr_width = nor->addr_width;
> +		msg.dummy_bytes = dummy;
> +		/* TODO: Support other combinations */
> +		msg.opcode_nbits = SPI_NBITS_SINGLE;
> +		msg.addr_nbits = SPI_NBITS_SINGLE;
> +		msg.data_nbits = m25p80_rx_nbits(nor);
> +
> +		ret = spi_flash_read(spi, &msg);
> +		*retlen = msg.retlen;
> +		return ret;

Looking at this I can't help but think that spi_flash_read() ought to
have the stub in rather than the caller.  But given that we're pretty
much only ever expecting one user I'm not 100% sure it actually matters.
Anyway, I applied the first two patches.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

* Re: [PATCH v5 3/5] mtd: devices: m25p80: add support for mmap read request
  2016-02-09 19:36   ` Mark Brown
@ 2016-02-11  5:33     ` Vignesh R
  2016-02-12 22:37       ` Mark Brown
  0 siblings, 1 reply; 20+ messages in thread
From: Vignesh R @ 2016-02-11  5:33 UTC (permalink / raw)
  To: Mark Brown
  Cc: Tony Lindgren, Brian Norris, Rob Herring, Russell King, hramrach,
	devicetree, linux-kernel, linux-omap, linux-arm-kernel,
	linux-mtd, linux-spi



On 02/10/2016 01:06 AM, Mark Brown wrote:
> On Fri, Dec 11, 2015 at 09:39:58AM +0530, Vignesh R wrote:
> 
>> +	if (spi_flash_read_supported(spi)) {
>> +		struct spi_flash_read_message msg;
>> +		int ret;
>> +
>> +		msg.buf = buf;
>> +		msg.from = from;
>> +		msg.len = len;
>> +		msg.read_opcode = nor->read_opcode;
>> +		msg.addr_width = nor->addr_width;
>> +		msg.dummy_bytes = dummy;
>> +		/* TODO: Support other combinations */
>> +		msg.opcode_nbits = SPI_NBITS_SINGLE;
>> +		msg.addr_nbits = SPI_NBITS_SINGLE;
>> +		msg.data_nbits = m25p80_rx_nbits(nor);
>> +
>> +		ret = spi_flash_read(spi, &msg);
>> +		*retlen = msg.retlen;
>> +		return ret;
> 
> Looking at this I can't help but think that spi_flash_read() ought to
> have the stub in rather than the caller.  But given that we're pretty
> much only ever expecting one user I'm not 100% sure it actually matters.

Well, my initial patch set passed long list of arguments to
spi_flash_read(), but Brian suggested to use struct[1] in order to avoid
unnecessary churn when things need changed in the API.


[1] https://lkml.org/lkml/2015/11/11/454

-- 
Regards
Vignesh

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

* Re: [PATCH v5 3/5] mtd: devices: m25p80: add support for mmap read request
  2016-02-11  5:33     ` Vignesh R
@ 2016-02-12 22:37       ` Mark Brown
  2016-02-16  8:00         ` Vignesh R
  0 siblings, 1 reply; 20+ messages in thread
From: Mark Brown @ 2016-02-12 22:37 UTC (permalink / raw)
  To: Vignesh R
  Cc: Tony Lindgren, Brian Norris, Rob Herring, Russell King, hramrach,
	devicetree, linux-kernel, linux-omap, linux-arm-kernel,
	linux-mtd, linux-spi

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

On Thu, Feb 11, 2016 at 11:03:50AM +0530, Vignesh R wrote:
> On 02/10/2016 01:06 AM, Mark Brown wrote:
> > On Fri, Dec 11, 2015 at 09:39:58AM +0530, Vignesh R wrote:

> >> +	if (spi_flash_read_supported(spi)) {
> >> +		struct spi_flash_read_message msg;
> >> +		int ret;

> > Looking at this I can't help but think that spi_flash_read() ought to
> > have the stub in rather than the caller.  But given that we're pretty
> > much only ever expecting one user I'm not 100% sure it actually matters.

> Well, my initial patch set passed long list of arguments to
> spi_flash_read(), but Brian suggested to use struct[1] in order to avoid
> unnecessary churn when things need changed in the API.

I don't see what that has to do with my point?

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

* Re: [PATCH v5 3/5] mtd: devices: m25p80: add support for mmap read request
  2016-02-12 22:37       ` Mark Brown
@ 2016-02-16  8:00         ` Vignesh R
  2016-02-16 12:38           ` Mark Brown
  0 siblings, 1 reply; 20+ messages in thread
From: Vignesh R @ 2016-02-16  8:00 UTC (permalink / raw)
  To: Mark Brown
  Cc: Tony Lindgren, Brian Norris, Rob Herring, Russell King, hramrach,
	devicetree, linux-kernel, linux-omap, linux-arm-kernel,
	linux-mtd, linux-spi



On 02/13/2016 04:07 AM, Mark Brown wrote:
> On Thu, Feb 11, 2016 at 11:03:50AM +0530, Vignesh R wrote:
>> On 02/10/2016 01:06 AM, Mark Brown wrote:
>>> On Fri, Dec 11, 2015 at 09:39:58AM +0530, Vignesh R wrote:
> 
>>>> +	if (spi_flash_read_supported(spi)) {
>>>> +		struct spi_flash_read_message msg;
>>>> +		int ret;
> 
>>> Looking at this I can't help but think that spi_flash_read() ought to
>>> have the stub in rather than the caller.  But given that we're pretty
>>> much only ever expecting one user I'm not 100% sure it actually matters.
> 
>> Well, my initial patch set passed long list of arguments to
>> spi_flash_read(), but Brian suggested to use struct[1] in order to avoid
>> unnecessary churn when things need changed in the API.
> 
> I don't see what that has to do with my point?
> 

AFAIU, your previous comment was to move initialization of
spi_flash_read_message struct to spi_flash_read(). This would mean
sending long list of arguments to spi_flash_read() which needs to be
updated whenever an argument needs to be added/deleted (in future).
Instead passing around a struct would be much easier in case of
adding/removing parameters.
Please correct me if I misunderstood your comment?

-- 
Regards
Vignesh

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

* Re: [PATCH v5 3/5] mtd: devices: m25p80: add support for mmap read request
  2016-02-16  8:00         ` Vignesh R
@ 2016-02-16 12:38           ` Mark Brown
  2016-02-17 16:11             ` R, Vignesh
  0 siblings, 1 reply; 20+ messages in thread
From: Mark Brown @ 2016-02-16 12:38 UTC (permalink / raw)
  To: Vignesh R
  Cc: Tony Lindgren, Brian Norris, Rob Herring, Russell King, hramrach,
	devicetree, linux-kernel, linux-omap, linux-arm-kernel,
	linux-mtd, linux-spi

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

On Tue, Feb 16, 2016 at 01:30:49PM +0530, Vignesh R wrote:
> On 02/13/2016 04:07 AM, Mark Brown wrote:
> > On Thu, Feb 11, 2016 at 11:03:50AM +0530, Vignesh R wrote:
> >> On 02/10/2016 01:06 AM, Mark Brown wrote:

> >>> Looking at this I can't help but think that spi_flash_read() ought to
> >>> have the stub in rather than the caller.  But given that we're pretty
> >>> much only ever expecting one user I'm not 100% sure it actually matters.

> >> Well, my initial patch set passed long list of arguments to
> >> spi_flash_read(), but Brian suggested to use struct[1] in order to avoid
> >> unnecessary churn when things need changed in the API.

> > I don't see what that has to do with my point?

> AFAIU, your previous comment was to move initialization of
> spi_flash_read_message struct to spi_flash_read(). This would mean

No, not at all.  I'm talking about how we handle the case where we don't
have hardware support for this and need to implement it in software -
currently that's in a separate place to the place where we call the
driver.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

* Re: [PATCH v5 3/5] mtd: devices: m25p80: add support for mmap read request
  2016-02-16 12:38           ` Mark Brown
@ 2016-02-17 16:11             ` R, Vignesh
  2016-02-24 12:21               ` Vignesh R
  0 siblings, 1 reply; 20+ messages in thread
From: R, Vignesh @ 2016-02-17 16:11 UTC (permalink / raw)
  To: Mark Brown
  Cc: Tony Lindgren, Brian Norris, Rob Herring, Russell King, hramrach,
	devicetree, linux-kernel, linux-omap, linux-arm-kernel,
	linux-mtd, linux-spi



On 02/16/2016 06:08 PM, Mark Brown wrote:
> On Tue, Feb 16, 2016 at 01:30:49PM +0530, Vignesh R wrote:
>> On 02/13/2016 04:07 AM, Mark Brown wrote:
>>> On Thu, Feb 11, 2016 at 11:03:50AM +0530, Vignesh R wrote:
>>>> On 02/10/2016 01:06 AM, Mark Brown wrote:
> 
>>>>> Looking at this I can't help but think that spi_flash_read() ought to
>>>>> have the stub in rather than the caller.  But given that we're pretty
>>>>> much only ever expecting one user I'm not 100% sure it actually matters.
> 
>>>> Well, my initial patch set passed long list of arguments to
>>>> spi_flash_read(), but Brian suggested to use struct[1] in order to avoid
>>>> unnecessary churn when things need changed in the API.
> 
>>> I don't see what that has to do with my point?
> 
>> AFAIU, your previous comment was to move initialization of
>> spi_flash_read_message struct to spi_flash_read(). This would mean
> 
> No, not at all.  I'm talking about how we handle the case where we don't
> have hardware support for this and need to implement it in software -
> currently that's in a separate place to the place where we call the
> driver.
> 

Yeah, but AFAIK, hardware accelerated read support is applicable for
m25p80 flashes only, I doubt whether spi_flash_read() will be used by
other types. I felt keeping the software implementation in m25p80_read()
will be consistent with m25p80_write().


-- 
Regards
Vignesh

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

* Re: [PATCH v5 3/5] mtd: devices: m25p80: add support for mmap read request
  2016-02-17 16:11             ` R, Vignesh
@ 2016-02-24 12:21               ` Vignesh R
  0 siblings, 0 replies; 20+ messages in thread
From: Vignesh R @ 2016-02-24 12:21 UTC (permalink / raw)
  To: Mark Brown
  Cc: Tony Lindgren, Brian Norris, Rob Herring, Russell King, hramrach,
	devicetree, linux-kernel, linux-omap, linux-arm-kernel,
	linux-mtd, linux-spi



On 02/17/2016 09:41 PM, R, Vignesh wrote:
> 
> 
> On 02/16/2016 06:08 PM, Mark Brown wrote:
>> On Tue, Feb 16, 2016 at 01:30:49PM +0530, Vignesh R wrote:
>>> On 02/13/2016 04:07 AM, Mark Brown wrote:
>>>> On Thu, Feb 11, 2016 at 11:03:50AM +0530, Vignesh R wrote:
>>>>> On 02/10/2016 01:06 AM, Mark Brown wrote:
>>
>>>>>> Looking at this I can't help but think that spi_flash_read() ought to
>>>>>> have the stub in rather than the caller.  But given that we're pretty
>>>>>> much only ever expecting one user I'm not 100% sure it actually matters.
>>
>>>>> Well, my initial patch set passed long list of arguments to
>>>>> spi_flash_read(), but Brian suggested to use struct[1] in order to avoid
>>>>> unnecessary churn when things need changed in the API.
>>
>>>> I don't see what that has to do with my point?
>>
>>> AFAIU, your previous comment was to move initialization of
>>> spi_flash_read_message struct to spi_flash_read(). This would mean
>>
>> No, not at all.  I'm talking about how we handle the case where we don't
>> have hardware support for this and need to implement it in software -
>> currently that's in a separate place to the place where we call the
>> driver.
>>
> 
> Yeah, but AFAIK, hardware accelerated read support is applicable for
> m25p80 flashes only, I doubt whether spi_flash_read() will be used by
> other types. I felt keeping the software implementation in m25p80_read()
> will be consistent with m25p80_write().

Is there any further work required on the patch? If not, what's the plan
to merge this patch?

-- 
Regards
Vignesh

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

end of thread, other threads:[~2016-02-24 12:21 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-11  4:09 [PATCH v5 0/5] Add memory mapped read support for ti-qspi Vignesh R
2015-12-11  4:09 ` [PATCH v5 1/5] spi: introduce accelerated read support for spi flash devices Vignesh R
2015-12-11  4:09 ` [PATCH v5 2/5] spi: spi-ti-qspi: add mmap mode read support Vignesh R
2015-12-11  4:09 ` [PATCH v5 3/5] mtd: devices: m25p80: add support for mmap read request Vignesh R
2016-02-09 19:36   ` Mark Brown
2016-02-11  5:33     ` Vignesh R
2016-02-12 22:37       ` Mark Brown
2016-02-16  8:00         ` Vignesh R
2016-02-16 12:38           ` Mark Brown
2016-02-17 16:11             ` R, Vignesh
2016-02-24 12:21               ` Vignesh R
2015-12-11  4:09 ` [PATCH v5 4/5] ARM: dts: DRA7: add entry for qspi mmap region Vignesh R
2015-12-11 15:09   ` Rob Herring
2015-12-17 18:45     ` Tony Lindgren
2015-12-18  5:50       ` Vignesh R
2015-12-18 16:42         ` Tony Lindgren
2015-12-11  4:10 ` [PATCH v5 5/5] ARM: dts: AM4372: " Vignesh R
2015-12-21 12:03 ` [PATCH v5 0/5] Add memory mapped read support for ti-qspi Vignesh R
2016-01-05  5:20 ` Vignesh R
2016-01-05 18:19   ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).