All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] spi: qup: Fixes and new version support
@ 2014-05-13 21:34 ` Andy Gross
  0 siblings, 0 replies; 34+ messages in thread
From: Andy Gross @ 2014-05-13 21:34 UTC (permalink / raw)
  To: Mark Brown
  Cc: linux-spi, linux-arm-msm, linux-arm-kernel, linux-kernel,
	Ivan T. Ivanov, Bjorn Andersson, Andy Gross

This set of patches provides a few fixes for the SPI QUP driver and support for
an earlier version of the QUP.

The first patch removes the use of the controller's own chip select
functionality.  The user should instead use GPIOs and make use of the SPI core's
GPIO chip select feature.

The second patch fixes the calculation that determines whether the FIFO or BLOCK
mode is used.  SPI transactions greater than 16 bytes but less than FIFO size
were failing.

The third patch addresses failures during probing of slave devices that required
SPI transactions.  The spi_register_master needs to be called after the runtime
pm is initialized.

The last patch adds support for V1.1.1 of the QUP.  This version of the
controller is present in earlier devices (APQ8064, IPQ8064, and MSM8960).

Andy Gross (4):
  spi: qup: Remove chip select function
  spi: qup: Correct selection of FIFO/Block mode
  spi: qup: Fix order of spi_register_master
  spi: qup: Add support for v1.1.1

 .../devicetree/bindings/spi/qcom,spi-qup.txt       |    6 ++
 drivers/spi/spi-qup.c                              |   75 ++++++++------------
 2 files changed, 37 insertions(+), 44 deletions(-)

-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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

* [PATCH 0/4] spi: qup: Fixes and new version support
@ 2014-05-13 21:34 ` Andy Gross
  0 siblings, 0 replies; 34+ messages in thread
From: Andy Gross @ 2014-05-13 21:34 UTC (permalink / raw)
  To: linux-arm-kernel

This set of patches provides a few fixes for the SPI QUP driver and support for
an earlier version of the QUP.

The first patch removes the use of the controller's own chip select
functionality.  The user should instead use GPIOs and make use of the SPI core's
GPIO chip select feature.

The second patch fixes the calculation that determines whether the FIFO or BLOCK
mode is used.  SPI transactions greater than 16 bytes but less than FIFO size
were failing.

The third patch addresses failures during probing of slave devices that required
SPI transactions.  The spi_register_master needs to be called after the runtime
pm is initialized.

The last patch adds support for V1.1.1 of the QUP.  This version of the
controller is present in earlier devices (APQ8064, IPQ8064, and MSM8960).

Andy Gross (4):
  spi: qup: Remove chip select function
  spi: qup: Correct selection of FIFO/Block mode
  spi: qup: Fix order of spi_register_master
  spi: qup: Add support for v1.1.1

 .../devicetree/bindings/spi/qcom,spi-qup.txt       |    6 ++
 drivers/spi/spi-qup.c                              |   75 ++++++++------------
 2 files changed, 37 insertions(+), 44 deletions(-)

-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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

* [PATCH 1/4] spi: qup: Remove chip select function
  2014-05-13 21:34 ` Andy Gross
  (?)
@ 2014-05-13 21:34     ` Andy Gross
  -1 siblings, 0 replies; 34+ messages in thread
From: Andy Gross @ 2014-05-13 21:34 UTC (permalink / raw)
  To: Mark Brown
  Cc: linux-spi-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Ivan T. Ivanov,
	Bjorn Andersson, Andy Gross

This patch removes the chip select function.  Chip select should instead be
supported using GPIOs, defining the DT entry "cs-gpios", and letting the SPI
core assert/deassert the chip select as it sees fit.

Signed-off-by: Andy Gross <agross-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
---
 .../devicetree/bindings/spi/qcom,spi-qup.txt       |    6 +++++
 drivers/spi/spi-qup.c                              |   28 ++------------------
 2 files changed, 8 insertions(+), 26 deletions(-)

diff --git a/Documentation/devicetree/bindings/spi/qcom,spi-qup.txt b/Documentation/devicetree/bindings/spi/qcom,spi-qup.txt
index b82a268..bee6ff2 100644
--- a/Documentation/devicetree/bindings/spi/qcom,spi-qup.txt
+++ b/Documentation/devicetree/bindings/spi/qcom,spi-qup.txt
@@ -23,6 +23,12 @@ Optional properties:
 - spi-max-frequency: Specifies maximum SPI clock frequency,
                      Units - Hz. Definition as per
                      Documentation/devicetree/bindings/spi/spi-bus.txt
+- num-cs:	total number of chipselects
+- cs-gpios:	should specify GPIOs used for chipselects.
+		The gpios will be referred to as reg = <index> in the SPI child
+		nodes.  If unspecified, a single SPI device without a chip
+		select can be used.
+
 
 SPI slave nodes must be children of the SPI master node and can contain
 properties described in Documentation/devicetree/bindings/spi/spi-bus.txt
diff --git a/drivers/spi/spi-qup.c b/drivers/spi/spi-qup.c
index b032e88..ea7017b 100644
--- a/drivers/spi/spi-qup.c
+++ b/drivers/spi/spi-qup.c
@@ -18,7 +18,9 @@
 #include <linux/io.h>
 #include <linux/list.h>
 #include <linux/module.h>
+#include <linux/gpio.h>
 #include <linux/of.h>
+#include <linux/of_gpio.h>
 #include <linux/platform_device.h>
 #include <linux/pm_runtime.h>
 #include <linux/spi/spi.h>
@@ -424,31 +426,6 @@ static int spi_qup_io_config(struct spi_device *spi, struct spi_transfer *xfer)
 	return 0;
 }
 
-static void spi_qup_set_cs(struct spi_device *spi, bool enable)
-{
-	struct spi_qup *controller = spi_master_get_devdata(spi->master);
-
-	u32 iocontol, mask;
-
-	iocontol = readl_relaxed(controller->base + SPI_IO_CONTROL);
-
-	/* Disable auto CS toggle and use manual */
-	iocontol &= ~SPI_IO_C_MX_CS_MODE;
-	iocontol |= SPI_IO_C_FORCE_CS;
-
-	iocontol &= ~SPI_IO_C_CS_SELECT_MASK;
-	iocontol |= SPI_IO_C_CS_SELECT(spi->chip_select);
-
-	mask = SPI_IO_C_CS_N_POLARITY_0 << spi->chip_select;
-
-	if (enable)
-		iocontol |= mask;
-	else
-		iocontol &= ~mask;
-
-	writel_relaxed(iocontol, controller->base + SPI_IO_CONTROL);
-}
-
 static int spi_qup_transfer_one(struct spi_master *master,
 			      struct spi_device *spi,
 			      struct spi_transfer *xfer)
@@ -576,7 +553,6 @@ static int spi_qup_probe(struct platform_device *pdev)
 	master->num_chipselect = SPI_NUM_CHIPSELECTS;
 	master->bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 32);
 	master->max_speed_hz = max_freq;
-	master->set_cs = spi_qup_set_cs;
 	master->transfer_one = spi_qup_transfer_one;
 	master->dev.of_node = pdev->dev.of_node;
 	master->auto_runtime_pm = true;
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH 1/4] spi: qup: Remove chip select function
@ 2014-05-13 21:34     ` Andy Gross
  0 siblings, 0 replies; 34+ messages in thread
From: Andy Gross @ 2014-05-13 21:34 UTC (permalink / raw)
  To: Mark Brown
  Cc: linux-spi, linux-arm-msm, linux-arm-kernel, linux-kernel,
	Ivan T. Ivanov, Bjorn Andersson, Andy Gross

This patch removes the chip select function.  Chip select should instead be
supported using GPIOs, defining the DT entry "cs-gpios", and letting the SPI
core assert/deassert the chip select as it sees fit.

Signed-off-by: Andy Gross <agross@codeaurora.org>
---
 .../devicetree/bindings/spi/qcom,spi-qup.txt       |    6 +++++
 drivers/spi/spi-qup.c                              |   28 ++------------------
 2 files changed, 8 insertions(+), 26 deletions(-)

diff --git a/Documentation/devicetree/bindings/spi/qcom,spi-qup.txt b/Documentation/devicetree/bindings/spi/qcom,spi-qup.txt
index b82a268..bee6ff2 100644
--- a/Documentation/devicetree/bindings/spi/qcom,spi-qup.txt
+++ b/Documentation/devicetree/bindings/spi/qcom,spi-qup.txt
@@ -23,6 +23,12 @@ Optional properties:
 - spi-max-frequency: Specifies maximum SPI clock frequency,
                      Units - Hz. Definition as per
                      Documentation/devicetree/bindings/spi/spi-bus.txt
+- num-cs:	total number of chipselects
+- cs-gpios:	should specify GPIOs used for chipselects.
+		The gpios will be referred to as reg = <index> in the SPI child
+		nodes.  If unspecified, a single SPI device without a chip
+		select can be used.
+
 
 SPI slave nodes must be children of the SPI master node and can contain
 properties described in Documentation/devicetree/bindings/spi/spi-bus.txt
diff --git a/drivers/spi/spi-qup.c b/drivers/spi/spi-qup.c
index b032e88..ea7017b 100644
--- a/drivers/spi/spi-qup.c
+++ b/drivers/spi/spi-qup.c
@@ -18,7 +18,9 @@
 #include <linux/io.h>
 #include <linux/list.h>
 #include <linux/module.h>
+#include <linux/gpio.h>
 #include <linux/of.h>
+#include <linux/of_gpio.h>
 #include <linux/platform_device.h>
 #include <linux/pm_runtime.h>
 #include <linux/spi/spi.h>
@@ -424,31 +426,6 @@ static int spi_qup_io_config(struct spi_device *spi, struct spi_transfer *xfer)
 	return 0;
 }
 
-static void spi_qup_set_cs(struct spi_device *spi, bool enable)
-{
-	struct spi_qup *controller = spi_master_get_devdata(spi->master);
-
-	u32 iocontol, mask;
-
-	iocontol = readl_relaxed(controller->base + SPI_IO_CONTROL);
-
-	/* Disable auto CS toggle and use manual */
-	iocontol &= ~SPI_IO_C_MX_CS_MODE;
-	iocontol |= SPI_IO_C_FORCE_CS;
-
-	iocontol &= ~SPI_IO_C_CS_SELECT_MASK;
-	iocontol |= SPI_IO_C_CS_SELECT(spi->chip_select);
-
-	mask = SPI_IO_C_CS_N_POLARITY_0 << spi->chip_select;
-
-	if (enable)
-		iocontol |= mask;
-	else
-		iocontol &= ~mask;
-
-	writel_relaxed(iocontol, controller->base + SPI_IO_CONTROL);
-}
-
 static int spi_qup_transfer_one(struct spi_master *master,
 			      struct spi_device *spi,
 			      struct spi_transfer *xfer)
@@ -576,7 +553,6 @@ static int spi_qup_probe(struct platform_device *pdev)
 	master->num_chipselect = SPI_NUM_CHIPSELECTS;
 	master->bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 32);
 	master->max_speed_hz = max_freq;
-	master->set_cs = spi_qup_set_cs;
 	master->transfer_one = spi_qup_transfer_one;
 	master->dev.of_node = pdev->dev.of_node;
 	master->auto_runtime_pm = true;
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation


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

* [PATCH 1/4] spi: qup: Remove chip select function
@ 2014-05-13 21:34     ` Andy Gross
  0 siblings, 0 replies; 34+ messages in thread
From: Andy Gross @ 2014-05-13 21:34 UTC (permalink / raw)
  To: linux-arm-kernel

This patch removes the chip select function.  Chip select should instead be
supported using GPIOs, defining the DT entry "cs-gpios", and letting the SPI
core assert/deassert the chip select as it sees fit.

Signed-off-by: Andy Gross <agross@codeaurora.org>
---
 .../devicetree/bindings/spi/qcom,spi-qup.txt       |    6 +++++
 drivers/spi/spi-qup.c                              |   28 ++------------------
 2 files changed, 8 insertions(+), 26 deletions(-)

diff --git a/Documentation/devicetree/bindings/spi/qcom,spi-qup.txt b/Documentation/devicetree/bindings/spi/qcom,spi-qup.txt
index b82a268..bee6ff2 100644
--- a/Documentation/devicetree/bindings/spi/qcom,spi-qup.txt
+++ b/Documentation/devicetree/bindings/spi/qcom,spi-qup.txt
@@ -23,6 +23,12 @@ Optional properties:
 - spi-max-frequency: Specifies maximum SPI clock frequency,
                      Units - Hz. Definition as per
                      Documentation/devicetree/bindings/spi/spi-bus.txt
+- num-cs:	total number of chipselects
+- cs-gpios:	should specify GPIOs used for chipselects.
+		The gpios will be referred to as reg = <index> in the SPI child
+		nodes.  If unspecified, a single SPI device without a chip
+		select can be used.
+
 
 SPI slave nodes must be children of the SPI master node and can contain
 properties described in Documentation/devicetree/bindings/spi/spi-bus.txt
diff --git a/drivers/spi/spi-qup.c b/drivers/spi/spi-qup.c
index b032e88..ea7017b 100644
--- a/drivers/spi/spi-qup.c
+++ b/drivers/spi/spi-qup.c
@@ -18,7 +18,9 @@
 #include <linux/io.h>
 #include <linux/list.h>
 #include <linux/module.h>
+#include <linux/gpio.h>
 #include <linux/of.h>
+#include <linux/of_gpio.h>
 #include <linux/platform_device.h>
 #include <linux/pm_runtime.h>
 #include <linux/spi/spi.h>
@@ -424,31 +426,6 @@ static int spi_qup_io_config(struct spi_device *spi, struct spi_transfer *xfer)
 	return 0;
 }
 
-static void spi_qup_set_cs(struct spi_device *spi, bool enable)
-{
-	struct spi_qup *controller = spi_master_get_devdata(spi->master);
-
-	u32 iocontol, mask;
-
-	iocontol = readl_relaxed(controller->base + SPI_IO_CONTROL);
-
-	/* Disable auto CS toggle and use manual */
-	iocontol &= ~SPI_IO_C_MX_CS_MODE;
-	iocontol |= SPI_IO_C_FORCE_CS;
-
-	iocontol &= ~SPI_IO_C_CS_SELECT_MASK;
-	iocontol |= SPI_IO_C_CS_SELECT(spi->chip_select);
-
-	mask = SPI_IO_C_CS_N_POLARITY_0 << spi->chip_select;
-
-	if (enable)
-		iocontol |= mask;
-	else
-		iocontol &= ~mask;
-
-	writel_relaxed(iocontol, controller->base + SPI_IO_CONTROL);
-}
-
 static int spi_qup_transfer_one(struct spi_master *master,
 			      struct spi_device *spi,
 			      struct spi_transfer *xfer)
@@ -576,7 +553,6 @@ static int spi_qup_probe(struct platform_device *pdev)
 	master->num_chipselect = SPI_NUM_CHIPSELECTS;
 	master->bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 32);
 	master->max_speed_hz = max_freq;
-	master->set_cs = spi_qup_set_cs;
 	master->transfer_one = spi_qup_transfer_one;
 	master->dev.of_node = pdev->dev.of_node;
 	master->auto_runtime_pm = true;
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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

* [PATCH 2/4] spi: qup: Correct selection of FIFO/Block mode
  2014-05-13 21:34 ` Andy Gross
  (?)
@ 2014-05-13 21:34     ` Andy Gross
  -1 siblings, 0 replies; 34+ messages in thread
From: Andy Gross @ 2014-05-13 21:34 UTC (permalink / raw)
  To: Mark Brown
  Cc: linux-spi-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Ivan T. Ivanov,
	Bjorn Andersson, Andy Gross

This patch fixes the calculation for determining whether to use FIFO or BLOCK
mode.

Signed-off-by: Andy Gross <agross-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
---
 drivers/spi/spi-qup.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/spi-qup.c b/drivers/spi/spi-qup.c
index ea7017b..57b65e9 100644
--- a/drivers/spi/spi-qup.c
+++ b/drivers/spi/spi-qup.c
@@ -289,7 +289,7 @@ static irqreturn_t spi_qup_qup_irq(int irq, void *dev_id)
 	writel_relaxed(opflags, controller->base + QUP_OPERATIONAL);
 
 	if (!xfer) {
-		dev_err_ratelimited(controller->dev, "unexpected irq %x08 %x08 %x08\n",
+		dev_err_ratelimited(controller->dev, "unexpected irq %08x %08x %08x\n",
 				    qup_err, spi_err, opflags);
 		return IRQ_HANDLED;
 	}
@@ -368,7 +368,7 @@ static int spi_qup_io_config(struct spi_device *spi, struct spi_transfer *xfer)
 	n_words = xfer->len / w_size;
 	controller->w_size = w_size;
 
-	if (n_words <= controller->in_fifo_sz) {
+	if (n_words <= (controller->in_fifo_sz / sizeof(u32))) {
 		mode = QUP_IO_M_MODE_FIFO;
 		writel_relaxed(n_words, controller->base + QUP_MX_READ_CNT);
 		writel_relaxed(n_words, controller->base + QUP_MX_WRITE_CNT);
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH 2/4] spi: qup: Correct selection of FIFO/Block mode
@ 2014-05-13 21:34     ` Andy Gross
  0 siblings, 0 replies; 34+ messages in thread
From: Andy Gross @ 2014-05-13 21:34 UTC (permalink / raw)
  To: Mark Brown
  Cc: linux-spi, linux-arm-msm, linux-arm-kernel, linux-kernel,
	Ivan T. Ivanov, Bjorn Andersson, Andy Gross

This patch fixes the calculation for determining whether to use FIFO or BLOCK
mode.

Signed-off-by: Andy Gross <agross@codeaurora.org>
---
 drivers/spi/spi-qup.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/spi-qup.c b/drivers/spi/spi-qup.c
index ea7017b..57b65e9 100644
--- a/drivers/spi/spi-qup.c
+++ b/drivers/spi/spi-qup.c
@@ -289,7 +289,7 @@ static irqreturn_t spi_qup_qup_irq(int irq, void *dev_id)
 	writel_relaxed(opflags, controller->base + QUP_OPERATIONAL);
 
 	if (!xfer) {
-		dev_err_ratelimited(controller->dev, "unexpected irq %x08 %x08 %x08\n",
+		dev_err_ratelimited(controller->dev, "unexpected irq %08x %08x %08x\n",
 				    qup_err, spi_err, opflags);
 		return IRQ_HANDLED;
 	}
@@ -368,7 +368,7 @@ static int spi_qup_io_config(struct spi_device *spi, struct spi_transfer *xfer)
 	n_words = xfer->len / w_size;
 	controller->w_size = w_size;
 
-	if (n_words <= controller->in_fifo_sz) {
+	if (n_words <= (controller->in_fifo_sz / sizeof(u32))) {
 		mode = QUP_IO_M_MODE_FIFO;
 		writel_relaxed(n_words, controller->base + QUP_MX_READ_CNT);
 		writel_relaxed(n_words, controller->base + QUP_MX_WRITE_CNT);
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation


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

* [PATCH 2/4] spi: qup: Correct selection of FIFO/Block mode
@ 2014-05-13 21:34     ` Andy Gross
  0 siblings, 0 replies; 34+ messages in thread
From: Andy Gross @ 2014-05-13 21:34 UTC (permalink / raw)
  To: linux-arm-kernel

This patch fixes the calculation for determining whether to use FIFO or BLOCK
mode.

Signed-off-by: Andy Gross <agross@codeaurora.org>
---
 drivers/spi/spi-qup.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/spi-qup.c b/drivers/spi/spi-qup.c
index ea7017b..57b65e9 100644
--- a/drivers/spi/spi-qup.c
+++ b/drivers/spi/spi-qup.c
@@ -289,7 +289,7 @@ static irqreturn_t spi_qup_qup_irq(int irq, void *dev_id)
 	writel_relaxed(opflags, controller->base + QUP_OPERATIONAL);
 
 	if (!xfer) {
-		dev_err_ratelimited(controller->dev, "unexpected irq %x08 %x08 %x08\n",
+		dev_err_ratelimited(controller->dev, "unexpected irq %08x %08x %08x\n",
 				    qup_err, spi_err, opflags);
 		return IRQ_HANDLED;
 	}
@@ -368,7 +368,7 @@ static int spi_qup_io_config(struct spi_device *spi, struct spi_transfer *xfer)
 	n_words = xfer->len / w_size;
 	controller->w_size = w_size;
 
-	if (n_words <= controller->in_fifo_sz) {
+	if (n_words <= (controller->in_fifo_sz / sizeof(u32))) {
 		mode = QUP_IO_M_MODE_FIFO;
 		writel_relaxed(n_words, controller->base + QUP_MX_READ_CNT);
 		writel_relaxed(n_words, controller->base + QUP_MX_WRITE_CNT);
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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

* [PATCH 3/4] spi: qup: Fix order of spi_register_master
  2014-05-13 21:34 ` Andy Gross
@ 2014-05-13 21:34   ` Andy Gross
  -1 siblings, 0 replies; 34+ messages in thread
From: Andy Gross @ 2014-05-13 21:34 UTC (permalink / raw)
  To: Mark Brown
  Cc: linux-spi, linux-arm-msm, linux-arm-kernel, linux-kernel,
	Ivan T. Ivanov, Bjorn Andersson, Andy Gross

This patch moves the devm_spi_register_master below the initialization of the
runtime_pm.  If done in the wrong order, the spi_register_master fails if any
probed slave devices issue SPI transactions.

Signed-off-by: Andy Gross <agross@codeaurora.org>
---
 drivers/spi/spi-qup.c |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/spi/spi-qup.c b/drivers/spi/spi-qup.c
index 57b65e9..b518b51 100644
--- a/drivers/spi/spi-qup.c
+++ b/drivers/spi/spi-qup.c
@@ -616,16 +616,19 @@ static int spi_qup_probe(struct platform_device *pdev)
 	if (ret)
 		goto error;
 
-	ret = devm_spi_register_master(dev, master);
-	if (ret)
-		goto error;
-
 	pm_runtime_set_autosuspend_delay(dev, MSEC_PER_SEC);
 	pm_runtime_use_autosuspend(dev);
 	pm_runtime_set_active(dev);
 	pm_runtime_enable(dev);
+
+	ret = devm_spi_register_master(dev, master);
+	if (ret)
+		goto disable_pm;
+
 	return 0;
 
+disable_pm:
+	pm_runtime_disable(&pdev->dev);
 error:
 	clk_disable_unprepare(cclk);
 	clk_disable_unprepare(iclk);
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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

* [PATCH 3/4] spi: qup: Fix order of spi_register_master
@ 2014-05-13 21:34   ` Andy Gross
  0 siblings, 0 replies; 34+ messages in thread
From: Andy Gross @ 2014-05-13 21:34 UTC (permalink / raw)
  To: linux-arm-kernel

This patch moves the devm_spi_register_master below the initialization of the
runtime_pm.  If done in the wrong order, the spi_register_master fails if any
probed slave devices issue SPI transactions.

Signed-off-by: Andy Gross <agross@codeaurora.org>
---
 drivers/spi/spi-qup.c |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/spi/spi-qup.c b/drivers/spi/spi-qup.c
index 57b65e9..b518b51 100644
--- a/drivers/spi/spi-qup.c
+++ b/drivers/spi/spi-qup.c
@@ -616,16 +616,19 @@ static int spi_qup_probe(struct platform_device *pdev)
 	if (ret)
 		goto error;
 
-	ret = devm_spi_register_master(dev, master);
-	if (ret)
-		goto error;
-
 	pm_runtime_set_autosuspend_delay(dev, MSEC_PER_SEC);
 	pm_runtime_use_autosuspend(dev);
 	pm_runtime_set_active(dev);
 	pm_runtime_enable(dev);
+
+	ret = devm_spi_register_master(dev, master);
+	if (ret)
+		goto disable_pm;
+
 	return 0;
 
+disable_pm:
+	pm_runtime_disable(&pdev->dev);
 error:
 	clk_disable_unprepare(cclk);
 	clk_disable_unprepare(iclk);
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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

* [PATCH 4/4] spi: qup: Add support for v1.1.1
  2014-05-13 21:34 ` Andy Gross
  (?)
@ 2014-05-13 21:34     ` Andy Gross
  -1 siblings, 0 replies; 34+ messages in thread
From: Andy Gross @ 2014-05-13 21:34 UTC (permalink / raw)
  To: Mark Brown
  Cc: linux-spi-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Ivan T. Ivanov,
	Bjorn Andersson, Andy Gross

This patch adds support for v1.1.1 of the SPI QUP controller.

Signed-off-by: Andy Gross <agross-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
---
 drivers/spi/spi-qup.c |   32 ++++++++++++++++++++------------
 1 file changed, 20 insertions(+), 12 deletions(-)

diff --git a/drivers/spi/spi-qup.c b/drivers/spi/spi-qup.c
index b518b51..abad630 100644
--- a/drivers/spi/spi-qup.c
+++ b/drivers/spi/spi-qup.c
@@ -144,6 +144,7 @@ struct spi_qup {
 	int			w_size;	/* bytes per SPI word */
 	int			tx_bytes;
 	int			rx_bytes;
+	int			qup_v1;
 };
 
 
@@ -422,7 +423,9 @@ static int spi_qup_io_config(struct spi_device *spi, struct spi_transfer *xfer)
 	config |= QUP_CONFIG_SPI_MODE;
 	writel_relaxed(config, controller->base + QUP_CONFIG);
 
-	writel_relaxed(0, controller->base + QUP_OPERATIONAL_MASK);
+	/* only write to OPERATIONAL_MASK when register is present */
+	if (!controller->qup_v1)
+		writel_relaxed(0, controller->base + QUP_OPERATIONAL_MASK);
 	return 0;
 }
 
@@ -488,7 +491,7 @@ static int spi_qup_probe(struct platform_device *pdev)
 	struct resource *res;
 	struct device *dev;
 	void __iomem *base;
-	u32 data, max_freq, iomode;
+	u32 data = 0, max_freq, iomode;
 	int ret, irq, size;
 
 	dev = &pdev->dev;
@@ -531,15 +534,6 @@ static int spi_qup_probe(struct platform_device *pdev)
 		return ret;
 	}
 
-	data = readl_relaxed(base + QUP_HW_VERSION);
-
-	if (data < QUP_HW_VERSION_2_1_1) {
-		clk_disable_unprepare(cclk);
-		clk_disable_unprepare(iclk);
-		dev_err(dev, "v.%08x is not supported\n", data);
-		return -ENXIO;
-	}
-
 	master = spi_alloc_master(dev, sizeof(struct spi_qup));
 	if (!master) {
 		clk_disable_unprepare(cclk);
@@ -567,6 +561,10 @@ static int spi_qup_probe(struct platform_device *pdev)
 	controller->cclk = cclk;
 	controller->irq = irq;
 
+	/* set v1 flag if device is version 1 */
+	if (of_device_is_compatible(dev->of_node, "qcom,spi-qup-v1.1.1"))
+		controller->qup_v1 = 1;
+
 	spin_lock_init(&controller->lock);
 	init_completion(&controller->done);
 
@@ -604,10 +602,19 @@ static int spi_qup_probe(struct platform_device *pdev)
 
 	writel_relaxed(0, base + QUP_OPERATIONAL);
 	writel_relaxed(0, base + QUP_IO_M_MODES);
-	writel_relaxed(0, base + QUP_OPERATIONAL_MASK);
+
+	if (!controller->qup_v1)
+		writel_relaxed(0, base + QUP_OPERATIONAL_MASK);
+
 	writel_relaxed(SPI_ERROR_CLK_UNDER_RUN | SPI_ERROR_CLK_OVER_RUN,
 		       base + SPI_ERROR_FLAGS_EN);
 
+	/* if earlier version of the QUP, disable INPUT_OVERRUN */
+	if (controller->qup_v1)
+		writel_relaxed(QUP_ERROR_OUTPUT_OVER_RUN |
+			QUP_ERROR_INPUT_UNDER_RUN | QUP_ERROR_OUTPUT_UNDER_RUN,
+			base + QUP_ERROR_FLAGS_EN);
+
 	writel_relaxed(0, base + SPI_CONFIG);
 	writel_relaxed(SPI_IO_C_NO_TRI_STATE, base + SPI_IO_CONTROL);
 
@@ -729,6 +736,7 @@ static int spi_qup_remove(struct platform_device *pdev)
 }
 
 static struct of_device_id spi_qup_dt_match[] = {
+	{ .compatible = "qcom,spi-qup-v1.1.1", },
 	{ .compatible = "qcom,spi-qup-v2.1.1", },
 	{ .compatible = "qcom,spi-qup-v2.2.1", },
 	{ }
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH 4/4] spi: qup: Add support for v1.1.1
@ 2014-05-13 21:34     ` Andy Gross
  0 siblings, 0 replies; 34+ messages in thread
From: Andy Gross @ 2014-05-13 21:34 UTC (permalink / raw)
  To: Mark Brown
  Cc: linux-spi, linux-arm-msm, linux-arm-kernel, linux-kernel,
	Ivan T. Ivanov, Bjorn Andersson, Andy Gross

This patch adds support for v1.1.1 of the SPI QUP controller.

Signed-off-by: Andy Gross <agross@codeaurora.org>
---
 drivers/spi/spi-qup.c |   32 ++++++++++++++++++++------------
 1 file changed, 20 insertions(+), 12 deletions(-)

diff --git a/drivers/spi/spi-qup.c b/drivers/spi/spi-qup.c
index b518b51..abad630 100644
--- a/drivers/spi/spi-qup.c
+++ b/drivers/spi/spi-qup.c
@@ -144,6 +144,7 @@ struct spi_qup {
 	int			w_size;	/* bytes per SPI word */
 	int			tx_bytes;
 	int			rx_bytes;
+	int			qup_v1;
 };
 
 
@@ -422,7 +423,9 @@ static int spi_qup_io_config(struct spi_device *spi, struct spi_transfer *xfer)
 	config |= QUP_CONFIG_SPI_MODE;
 	writel_relaxed(config, controller->base + QUP_CONFIG);
 
-	writel_relaxed(0, controller->base + QUP_OPERATIONAL_MASK);
+	/* only write to OPERATIONAL_MASK when register is present */
+	if (!controller->qup_v1)
+		writel_relaxed(0, controller->base + QUP_OPERATIONAL_MASK);
 	return 0;
 }
 
@@ -488,7 +491,7 @@ static int spi_qup_probe(struct platform_device *pdev)
 	struct resource *res;
 	struct device *dev;
 	void __iomem *base;
-	u32 data, max_freq, iomode;
+	u32 data = 0, max_freq, iomode;
 	int ret, irq, size;
 
 	dev = &pdev->dev;
@@ -531,15 +534,6 @@ static int spi_qup_probe(struct platform_device *pdev)
 		return ret;
 	}
 
-	data = readl_relaxed(base + QUP_HW_VERSION);
-
-	if (data < QUP_HW_VERSION_2_1_1) {
-		clk_disable_unprepare(cclk);
-		clk_disable_unprepare(iclk);
-		dev_err(dev, "v.%08x is not supported\n", data);
-		return -ENXIO;
-	}
-
 	master = spi_alloc_master(dev, sizeof(struct spi_qup));
 	if (!master) {
 		clk_disable_unprepare(cclk);
@@ -567,6 +561,10 @@ static int spi_qup_probe(struct platform_device *pdev)
 	controller->cclk = cclk;
 	controller->irq = irq;
 
+	/* set v1 flag if device is version 1 */
+	if (of_device_is_compatible(dev->of_node, "qcom,spi-qup-v1.1.1"))
+		controller->qup_v1 = 1;
+
 	spin_lock_init(&controller->lock);
 	init_completion(&controller->done);
 
@@ -604,10 +602,19 @@ static int spi_qup_probe(struct platform_device *pdev)
 
 	writel_relaxed(0, base + QUP_OPERATIONAL);
 	writel_relaxed(0, base + QUP_IO_M_MODES);
-	writel_relaxed(0, base + QUP_OPERATIONAL_MASK);
+
+	if (!controller->qup_v1)
+		writel_relaxed(0, base + QUP_OPERATIONAL_MASK);
+
 	writel_relaxed(SPI_ERROR_CLK_UNDER_RUN | SPI_ERROR_CLK_OVER_RUN,
 		       base + SPI_ERROR_FLAGS_EN);
 
+	/* if earlier version of the QUP, disable INPUT_OVERRUN */
+	if (controller->qup_v1)
+		writel_relaxed(QUP_ERROR_OUTPUT_OVER_RUN |
+			QUP_ERROR_INPUT_UNDER_RUN | QUP_ERROR_OUTPUT_UNDER_RUN,
+			base + QUP_ERROR_FLAGS_EN);
+
 	writel_relaxed(0, base + SPI_CONFIG);
 	writel_relaxed(SPI_IO_C_NO_TRI_STATE, base + SPI_IO_CONTROL);
 
@@ -729,6 +736,7 @@ static int spi_qup_remove(struct platform_device *pdev)
 }
 
 static struct of_device_id spi_qup_dt_match[] = {
+	{ .compatible = "qcom,spi-qup-v1.1.1", },
 	{ .compatible = "qcom,spi-qup-v2.1.1", },
 	{ .compatible = "qcom,spi-qup-v2.2.1", },
 	{ }
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation


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

* [PATCH 4/4] spi: qup: Add support for v1.1.1
@ 2014-05-13 21:34     ` Andy Gross
  0 siblings, 0 replies; 34+ messages in thread
From: Andy Gross @ 2014-05-13 21:34 UTC (permalink / raw)
  To: linux-arm-kernel

This patch adds support for v1.1.1 of the SPI QUP controller.

Signed-off-by: Andy Gross <agross@codeaurora.org>
---
 drivers/spi/spi-qup.c |   32 ++++++++++++++++++++------------
 1 file changed, 20 insertions(+), 12 deletions(-)

diff --git a/drivers/spi/spi-qup.c b/drivers/spi/spi-qup.c
index b518b51..abad630 100644
--- a/drivers/spi/spi-qup.c
+++ b/drivers/spi/spi-qup.c
@@ -144,6 +144,7 @@ struct spi_qup {
 	int			w_size;	/* bytes per SPI word */
 	int			tx_bytes;
 	int			rx_bytes;
+	int			qup_v1;
 };
 
 
@@ -422,7 +423,9 @@ static int spi_qup_io_config(struct spi_device *spi, struct spi_transfer *xfer)
 	config |= QUP_CONFIG_SPI_MODE;
 	writel_relaxed(config, controller->base + QUP_CONFIG);
 
-	writel_relaxed(0, controller->base + QUP_OPERATIONAL_MASK);
+	/* only write to OPERATIONAL_MASK when register is present */
+	if (!controller->qup_v1)
+		writel_relaxed(0, controller->base + QUP_OPERATIONAL_MASK);
 	return 0;
 }
 
@@ -488,7 +491,7 @@ static int spi_qup_probe(struct platform_device *pdev)
 	struct resource *res;
 	struct device *dev;
 	void __iomem *base;
-	u32 data, max_freq, iomode;
+	u32 data = 0, max_freq, iomode;
 	int ret, irq, size;
 
 	dev = &pdev->dev;
@@ -531,15 +534,6 @@ static int spi_qup_probe(struct platform_device *pdev)
 		return ret;
 	}
 
-	data = readl_relaxed(base + QUP_HW_VERSION);
-
-	if (data < QUP_HW_VERSION_2_1_1) {
-		clk_disable_unprepare(cclk);
-		clk_disable_unprepare(iclk);
-		dev_err(dev, "v.%08x is not supported\n", data);
-		return -ENXIO;
-	}
-
 	master = spi_alloc_master(dev, sizeof(struct spi_qup));
 	if (!master) {
 		clk_disable_unprepare(cclk);
@@ -567,6 +561,10 @@ static int spi_qup_probe(struct platform_device *pdev)
 	controller->cclk = cclk;
 	controller->irq = irq;
 
+	/* set v1 flag if device is version 1 */
+	if (of_device_is_compatible(dev->of_node, "qcom,spi-qup-v1.1.1"))
+		controller->qup_v1 = 1;
+
 	spin_lock_init(&controller->lock);
 	init_completion(&controller->done);
 
@@ -604,10 +602,19 @@ static int spi_qup_probe(struct platform_device *pdev)
 
 	writel_relaxed(0, base + QUP_OPERATIONAL);
 	writel_relaxed(0, base + QUP_IO_M_MODES);
-	writel_relaxed(0, base + QUP_OPERATIONAL_MASK);
+
+	if (!controller->qup_v1)
+		writel_relaxed(0, base + QUP_OPERATIONAL_MASK);
+
 	writel_relaxed(SPI_ERROR_CLK_UNDER_RUN | SPI_ERROR_CLK_OVER_RUN,
 		       base + SPI_ERROR_FLAGS_EN);
 
+	/* if earlier version of the QUP, disable INPUT_OVERRUN */
+	if (controller->qup_v1)
+		writel_relaxed(QUP_ERROR_OUTPUT_OVER_RUN |
+			QUP_ERROR_INPUT_UNDER_RUN | QUP_ERROR_OUTPUT_UNDER_RUN,
+			base + QUP_ERROR_FLAGS_EN);
+
 	writel_relaxed(0, base + SPI_CONFIG);
 	writel_relaxed(SPI_IO_C_NO_TRI_STATE, base + SPI_IO_CONTROL);
 
@@ -729,6 +736,7 @@ static int spi_qup_remove(struct platform_device *pdev)
 }
 
 static struct of_device_id spi_qup_dt_match[] = {
+	{ .compatible = "qcom,spi-qup-v1.1.1", },
 	{ .compatible = "qcom,spi-qup-v2.1.1", },
 	{ .compatible = "qcom,spi-qup-v2.2.1", },
 	{ }
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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

* Re: [PATCH 4/4] spi: qup: Add support for v1.1.1
  2014-05-13 21:34     ` Andy Gross
  (?)
@ 2014-05-13 22:08         ` Stephen Boyd
  -1 siblings, 0 replies; 34+ messages in thread
From: Stephen Boyd @ 2014-05-13 22:08 UTC (permalink / raw)
  To: Andy Gross
  Cc: Mark Brown, linux-spi-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Ivan T. Ivanov,
	Bjorn Andersson

On 05/13, Andy Gross wrote:
> @@ -488,7 +491,7 @@ static int spi_qup_probe(struct platform_device *pdev)
>  	struct resource *res;
>  	struct device *dev;
>  	void __iomem *base;
> -	u32 data, max_freq, iomode;
> +	u32 data = 0, max_freq, iomode;

It looks like data is unused? But actually it's used to print a
version out and now it will always print version 0. Perhaps that
printk needs an update?

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 4/4] spi: qup: Add support for v1.1.1
@ 2014-05-13 22:08         ` Stephen Boyd
  0 siblings, 0 replies; 34+ messages in thread
From: Stephen Boyd @ 2014-05-13 22:08 UTC (permalink / raw)
  To: Andy Gross
  Cc: Mark Brown, linux-spi, linux-arm-msm, linux-arm-kernel,
	linux-kernel, Ivan T. Ivanov, Bjorn Andersson

On 05/13, Andy Gross wrote:
> @@ -488,7 +491,7 @@ static int spi_qup_probe(struct platform_device *pdev)
>  	struct resource *res;
>  	struct device *dev;
>  	void __iomem *base;
> -	u32 data, max_freq, iomode;
> +	u32 data = 0, max_freq, iomode;

It looks like data is unused? But actually it's used to print a
version out and now it will always print version 0. Perhaps that
printk needs an update?

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation

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

* [PATCH 4/4] spi: qup: Add support for v1.1.1
@ 2014-05-13 22:08         ` Stephen Boyd
  0 siblings, 0 replies; 34+ messages in thread
From: Stephen Boyd @ 2014-05-13 22:08 UTC (permalink / raw)
  To: linux-arm-kernel

On 05/13, Andy Gross wrote:
> @@ -488,7 +491,7 @@ static int spi_qup_probe(struct platform_device *pdev)
>  	struct resource *res;
>  	struct device *dev;
>  	void __iomem *base;
> -	u32 data, max_freq, iomode;
> +	u32 data = 0, max_freq, iomode;

It looks like data is unused? But actually it's used to print a
version out and now it will always print version 0. Perhaps that
printk needs an update?

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation

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

* Re: [PATCH 4/4] spi: qup: Add support for v1.1.1
  2014-05-13 22:08         ` Stephen Boyd
  (?)
@ 2014-05-13 22:20             ` Andy Gross
  -1 siblings, 0 replies; 34+ messages in thread
From: Andy Gross @ 2014-05-13 22:20 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Mark Brown, linux-spi-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Ivan T. Ivanov,
	Bjorn Andersson

On Tue, May 13, 2014 at 03:08:45PM -0700, Stephen Boyd wrote:
> On 05/13, Andy Gross wrote:
> > @@ -488,7 +491,7 @@ static int spi_qup_probe(struct platform_device *pdev)
> >  	struct resource *res;
> >  	struct device *dev;
> >  	void __iomem *base;
> > -	u32 data, max_freq, iomode;
> > +	u32 data = 0, max_freq, iomode;
> 
> It looks like data is unused? But actually it's used to print a
> version out and now it will always print version 0. Perhaps that
> printk needs an update?

ACK!  I thought I killed that.  I'll fix that.

-- 
sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 4/4] spi: qup: Add support for v1.1.1
@ 2014-05-13 22:20             ` Andy Gross
  0 siblings, 0 replies; 34+ messages in thread
From: Andy Gross @ 2014-05-13 22:20 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Mark Brown, linux-spi, linux-arm-msm, linux-arm-kernel,
	linux-kernel, Ivan T. Ivanov, Bjorn Andersson

On Tue, May 13, 2014 at 03:08:45PM -0700, Stephen Boyd wrote:
> On 05/13, Andy Gross wrote:
> > @@ -488,7 +491,7 @@ static int spi_qup_probe(struct platform_device *pdev)
> >  	struct resource *res;
> >  	struct device *dev;
> >  	void __iomem *base;
> > -	u32 data, max_freq, iomode;
> > +	u32 data = 0, max_freq, iomode;
> 
> It looks like data is unused? But actually it's used to print a
> version out and now it will always print version 0. Perhaps that
> printk needs an update?

ACK!  I thought I killed that.  I'll fix that.

-- 
sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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

* [PATCH 4/4] spi: qup: Add support for v1.1.1
@ 2014-05-13 22:20             ` Andy Gross
  0 siblings, 0 replies; 34+ messages in thread
From: Andy Gross @ 2014-05-13 22:20 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, May 13, 2014 at 03:08:45PM -0700, Stephen Boyd wrote:
> On 05/13, Andy Gross wrote:
> > @@ -488,7 +491,7 @@ static int spi_qup_probe(struct platform_device *pdev)
> >  	struct resource *res;
> >  	struct device *dev;
> >  	void __iomem *base;
> > -	u32 data, max_freq, iomode;
> > +	u32 data = 0, max_freq, iomode;
> 
> It looks like data is unused? But actually it's used to print a
> version out and now it will always print version 0. Perhaps that
> printk needs an update?

ACK!  I thought I killed that.  I'll fix that.

-- 
sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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

* Re: [PATCH 2/4] spi: qup: Correct selection of FIFO/Block mode
  2014-05-13 21:34     ` Andy Gross
@ 2014-05-14 15:17       ` Mark Brown
  -1 siblings, 0 replies; 34+ messages in thread
From: Mark Brown @ 2014-05-14 15:17 UTC (permalink / raw)
  To: Andy Gross
  Cc: linux-spi, linux-arm-msm, linux-arm-kernel, linux-kernel,
	Ivan T. Ivanov, Bjorn Andersson

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

On Tue, May 13, 2014 at 04:34:42PM -0500, Andy Gross wrote:
> This patch fixes the calculation for determining whether to use FIFO or BLOCK
> mode.

Applied, thanks.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* [PATCH 2/4] spi: qup: Correct selection of FIFO/Block mode
@ 2014-05-14 15:17       ` Mark Brown
  0 siblings, 0 replies; 34+ messages in thread
From: Mark Brown @ 2014-05-14 15:17 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, May 13, 2014 at 04:34:42PM -0500, Andy Gross wrote:
> This patch fixes the calculation for determining whether to use FIFO or BLOCK
> mode.

Applied, thanks.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140514/ea7dfec3/attachment.sig>

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

* Re: [PATCH 2/4] spi: qup: Correct selection of FIFO/Block mode
  2014-05-13 21:34     ` Andy Gross
  (?)
@ 2014-05-19  7:31         ` Ivan T. Ivanov
  -1 siblings, 0 replies; 34+ messages in thread
From: Ivan T. Ivanov @ 2014-05-19  7:31 UTC (permalink / raw)
  To: Andy Gross
  Cc: Mark Brown, linux-spi-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Bjorn Andersson

On Tue, 2014-05-13 at 16:34 -0500, Andy Gross wrote:
> This patch fixes the calculation for determining whether to use FIFO or BLOCK
> mode.

<snip>

> @@ -368,7 +368,7 @@ static int spi_qup_io_config(struct spi_device *spi, struct spi_transfer *xfer)
>  	n_words = xfer->len / w_size;
>  	controller->w_size = w_size;
>  
> -	if (n_words <= controller->in_fifo_sz) {
> +	if (n_words <= (controller->in_fifo_sz / sizeof(u32))) {

Wouldn't be better to divide by w_size? Probably will not make
too much difference, but..

>  		mode = QUP_IO_M_MODE_FIFO;

Regards,
Ivan

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 2/4] spi: qup: Correct selection of FIFO/Block mode
@ 2014-05-19  7:31         ` Ivan T. Ivanov
  0 siblings, 0 replies; 34+ messages in thread
From: Ivan T. Ivanov @ 2014-05-19  7:31 UTC (permalink / raw)
  To: Andy Gross
  Cc: Mark Brown, linux-spi, linux-arm-msm, linux-arm-kernel,
	linux-kernel, Bjorn Andersson

On Tue, 2014-05-13 at 16:34 -0500, Andy Gross wrote:
> This patch fixes the calculation for determining whether to use FIFO or BLOCK
> mode.

<snip>

> @@ -368,7 +368,7 @@ static int spi_qup_io_config(struct spi_device *spi, struct spi_transfer *xfer)
>  	n_words = xfer->len / w_size;
>  	controller->w_size = w_size;
>  
> -	if (n_words <= controller->in_fifo_sz) {
> +	if (n_words <= (controller->in_fifo_sz / sizeof(u32))) {

Wouldn't be better to divide by w_size? Probably will not make
too much difference, but..

>  		mode = QUP_IO_M_MODE_FIFO;

Regards,
Ivan


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

* [PATCH 2/4] spi: qup: Correct selection of FIFO/Block mode
@ 2014-05-19  7:31         ` Ivan T. Ivanov
  0 siblings, 0 replies; 34+ messages in thread
From: Ivan T. Ivanov @ 2014-05-19  7:31 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, 2014-05-13 at 16:34 -0500, Andy Gross wrote:
> This patch fixes the calculation for determining whether to use FIFO or BLOCK
> mode.

<snip>

> @@ -368,7 +368,7 @@ static int spi_qup_io_config(struct spi_device *spi, struct spi_transfer *xfer)
>  	n_words = xfer->len / w_size;
>  	controller->w_size = w_size;
>  
> -	if (n_words <= controller->in_fifo_sz) {
> +	if (n_words <= (controller->in_fifo_sz / sizeof(u32))) {

Wouldn't be better to divide by w_size? Probably will not make
too much difference, but..

>  		mode = QUP_IO_M_MODE_FIFO;

Regards,
Ivan

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

* Re: [PATCH 1/4] spi: qup: Remove chip select function
  2014-05-13 21:34     ` Andy Gross
@ 2014-05-19  8:07       ` Ivan T. Ivanov
  -1 siblings, 0 replies; 34+ messages in thread
From: Ivan T. Ivanov @ 2014-05-19  8:07 UTC (permalink / raw)
  To: Andy Gross
  Cc: Mark Brown, linux-spi, linux-arm-msm, linux-arm-kernel,
	linux-kernel, Bjorn Andersson


Hi Andy,

On Tue, 2014-05-13 at 16:34 -0500, Andy Gross wrote:
> This patch removes the chip select function.  Chip select should instead be
> supported using GPIOs, defining the DT entry "cs-gpios", and letting the SPI
> core assert/deassert the chip select as it sees fit.
> 
> Signed-off-by: Andy Gross <agross@codeaurora.org>

<snip>

> +- num-cs:	total number of chipselects

My understanding is that "num-cs" have to be parsed by
master driver, not by core SPI driver.

> -
> -	/* Disable auto CS toggle and use manual */
> -	iocontol &= ~SPI_IO_C_MX_CS_MODE;

Probably we should keep this?

Regards,
Ivan

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

* [PATCH 1/4] spi: qup: Remove chip select function
@ 2014-05-19  8:07       ` Ivan T. Ivanov
  0 siblings, 0 replies; 34+ messages in thread
From: Ivan T. Ivanov @ 2014-05-19  8:07 UTC (permalink / raw)
  To: linux-arm-kernel


Hi Andy,

On Tue, 2014-05-13 at 16:34 -0500, Andy Gross wrote:
> This patch removes the chip select function.  Chip select should instead be
> supported using GPIOs, defining the DT entry "cs-gpios", and letting the SPI
> core assert/deassert the chip select as it sees fit.
> 
> Signed-off-by: Andy Gross <agross@codeaurora.org>

<snip>

> +- num-cs:	total number of chipselects

My understanding is that "num-cs" have to be parsed by
master driver, not by core SPI driver.

> -
> -	/* Disable auto CS toggle and use manual */
> -	iocontol &= ~SPI_IO_C_MX_CS_MODE;

Probably we should keep this?

Regards,
Ivan

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

* Re: [PATCH 4/4] spi: qup: Add support for v1.1.1
  2014-05-13 21:34     ` Andy Gross
@ 2014-05-19  8:10       ` Ivan T. Ivanov
  -1 siblings, 0 replies; 34+ messages in thread
From: Ivan T. Ivanov @ 2014-05-19  8:10 UTC (permalink / raw)
  To: Andy Gross
  Cc: Mark Brown, Bjorn Andersson, linux-arm-msm, linux-kernel,
	linux-spi, linux-arm-kernel

On Tue, 2014-05-13 at 16:34 -0500, Andy Gross wrote:
> This patch adds support for v1.1.1 of the SPI QUP controller.
> 
> Signed-off-by: Andy Gross <agross@codeaurora.org>

Except Stephen comment this looks fine. Thank you.

Acked-by: Ivan T. Ivanov <iivanov@mm-sol.com>

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

* [PATCH 4/4] spi: qup: Add support for v1.1.1
@ 2014-05-19  8:10       ` Ivan T. Ivanov
  0 siblings, 0 replies; 34+ messages in thread
From: Ivan T. Ivanov @ 2014-05-19  8:10 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, 2014-05-13 at 16:34 -0500, Andy Gross wrote:
> This patch adds support for v1.1.1 of the SPI QUP controller.
> 
> Signed-off-by: Andy Gross <agross@codeaurora.org>

Except Stephen comment this looks fine. Thank you.

Acked-by: Ivan T. Ivanov <iivanov@mm-sol.com>

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

* Re: [PATCH 3/4] spi: qup: Fix order of spi_register_master
  2014-05-13 21:34   ` Andy Gross
  (?)
@ 2014-05-19  8:51       ` Ivan T. Ivanov
  -1 siblings, 0 replies; 34+ messages in thread
From: Ivan T. Ivanov @ 2014-05-19  8:51 UTC (permalink / raw)
  To: Andy Gross
  Cc: Mark Brown, Bjorn Andersson,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-spi-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On Tue, 2014-05-13 at 16:34 -0500, Andy Gross wrote:
> This patch moves the devm_spi_register_master below the initialization of the
> runtime_pm.  If done in the wrong order, the spi_register_master fails if any
> probed slave devices issue SPI transactions.
> 
> Signed-off-by: Andy Gross <agross-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>

Thank you.

Acked-by: Ivan T. Ivanov <iivanov-NEYub+7Iv8PQT0dZR+AlfA@public.gmane.org>

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 3/4] spi: qup: Fix order of spi_register_master
@ 2014-05-19  8:51       ` Ivan T. Ivanov
  0 siblings, 0 replies; 34+ messages in thread
From: Ivan T. Ivanov @ 2014-05-19  8:51 UTC (permalink / raw)
  To: Andy Gross
  Cc: Mark Brown, Bjorn Andersson, linux-arm-msm, linux-kernel,
	linux-spi, linux-arm-kernel

On Tue, 2014-05-13 at 16:34 -0500, Andy Gross wrote:
> This patch moves the devm_spi_register_master below the initialization of the
> runtime_pm.  If done in the wrong order, the spi_register_master fails if any
> probed slave devices issue SPI transactions.
> 
> Signed-off-by: Andy Gross <agross@codeaurora.org>

Thank you.

Acked-by: Ivan T. Ivanov <iivanov@mm-sol.com>


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

* [PATCH 3/4] spi: qup: Fix order of spi_register_master
@ 2014-05-19  8:51       ` Ivan T. Ivanov
  0 siblings, 0 replies; 34+ messages in thread
From: Ivan T. Ivanov @ 2014-05-19  8:51 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, 2014-05-13 at 16:34 -0500, Andy Gross wrote:
> This patch moves the devm_spi_register_master below the initialization of the
> runtime_pm.  If done in the wrong order, the spi_register_master fails if any
> probed slave devices issue SPI transactions.
> 
> Signed-off-by: Andy Gross <agross@codeaurora.org>

Thank you.

Acked-by: Ivan T. Ivanov <iivanov@mm-sol.com>

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

* Re: [PATCH 1/4] spi: qup: Remove chip select function
  2014-05-19  8:07       ` Ivan T. Ivanov
  (?)
@ 2014-06-12  4:02         ` Andy Gross
  -1 siblings, 0 replies; 34+ messages in thread
From: Andy Gross @ 2014-06-12  4:02 UTC (permalink / raw)
  To: Ivan T. Ivanov
  Cc: Mark Brown, linux-spi-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Bjorn Andersson

On Mon, May 19, 2014 at 11:07:38AM +0300, Ivan T. Ivanov wrote:
<snip>
 
> > +- num-cs:	total number of chipselects
> 
> My understanding is that "num-cs" have to be parsed by
> master driver, not by core SPI driver.

Right.  I need to parse it and check vs the max cs and use that value to set the
master->num_chipselect

> 
> > -
> > -	/* Disable auto CS toggle and use manual */
> > -	iocontol &= ~SPI_IO_C_MX_CS_MODE;
> 
> Probably we should keep this?

Actually this is cleared in the probe during the initial settings of IO_CONTROL.
So this isn't necessary.


-- 
sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 1/4] spi: qup: Remove chip select function
@ 2014-06-12  4:02         ` Andy Gross
  0 siblings, 0 replies; 34+ messages in thread
From: Andy Gross @ 2014-06-12  4:02 UTC (permalink / raw)
  To: Ivan T. Ivanov
  Cc: Mark Brown, linux-spi, linux-arm-msm, linux-arm-kernel,
	linux-kernel, Bjorn Andersson

On Mon, May 19, 2014 at 11:07:38AM +0300, Ivan T. Ivanov wrote:
<snip>
 
> > +- num-cs:	total number of chipselects
> 
> My understanding is that "num-cs" have to be parsed by
> master driver, not by core SPI driver.

Right.  I need to parse it and check vs the max cs and use that value to set the
master->num_chipselect

> 
> > -
> > -	/* Disable auto CS toggle and use manual */
> > -	iocontol &= ~SPI_IO_C_MX_CS_MODE;
> 
> Probably we should keep this?

Actually this is cleared in the probe during the initial settings of IO_CONTROL.
So this isn't necessary.


-- 
sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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

* [PATCH 1/4] spi: qup: Remove chip select function
@ 2014-06-12  4:02         ` Andy Gross
  0 siblings, 0 replies; 34+ messages in thread
From: Andy Gross @ 2014-06-12  4:02 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, May 19, 2014 at 11:07:38AM +0300, Ivan T. Ivanov wrote:
<snip>
 
> > +- num-cs:	total number of chipselects
> 
> My understanding is that "num-cs" have to be parsed by
> master driver, not by core SPI driver.

Right.  I need to parse it and check vs the max cs and use that value to set the
master->num_chipselect

> 
> > -
> > -	/* Disable auto CS toggle and use manual */
> > -	iocontol &= ~SPI_IO_C_MX_CS_MODE;
> 
> Probably we should keep this?

Actually this is cleared in the probe during the initial settings of IO_CONTROL.
So this isn't necessary.


-- 
sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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

end of thread, other threads:[~2014-06-12  4:02 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-13 21:34 [PATCH 0/4] spi: qup: Fixes and new version support Andy Gross
2014-05-13 21:34 ` Andy Gross
     [not found] ` <1400016884-9568-1-git-send-email-agross-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2014-05-13 21:34   ` [PATCH 1/4] spi: qup: Remove chip select function Andy Gross
2014-05-13 21:34     ` Andy Gross
2014-05-13 21:34     ` Andy Gross
2014-05-19  8:07     ` Ivan T. Ivanov
2014-05-19  8:07       ` Ivan T. Ivanov
2014-06-12  4:02       ` Andy Gross
2014-06-12  4:02         ` Andy Gross
2014-06-12  4:02         ` Andy Gross
2014-05-13 21:34   ` [PATCH 2/4] spi: qup: Correct selection of FIFO/Block mode Andy Gross
2014-05-13 21:34     ` Andy Gross
2014-05-13 21:34     ` Andy Gross
2014-05-14 15:17     ` Mark Brown
2014-05-14 15:17       ` Mark Brown
     [not found]     ` <1400016884-9568-3-git-send-email-agross-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2014-05-19  7:31       ` Ivan T. Ivanov
2014-05-19  7:31         ` Ivan T. Ivanov
2014-05-19  7:31         ` Ivan T. Ivanov
2014-05-13 21:34   ` [PATCH 4/4] spi: qup: Add support for v1.1.1 Andy Gross
2014-05-13 21:34     ` Andy Gross
2014-05-13 21:34     ` Andy Gross
     [not found]     ` <1400016884-9568-5-git-send-email-agross-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2014-05-13 22:08       ` Stephen Boyd
2014-05-13 22:08         ` Stephen Boyd
2014-05-13 22:08         ` Stephen Boyd
     [not found]         ` <20140513220845.GH20486-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2014-05-13 22:20           ` Andy Gross
2014-05-13 22:20             ` Andy Gross
2014-05-13 22:20             ` Andy Gross
2014-05-19  8:10     ` Ivan T. Ivanov
2014-05-19  8:10       ` Ivan T. Ivanov
2014-05-13 21:34 ` [PATCH 3/4] spi: qup: Fix order of spi_register_master Andy Gross
2014-05-13 21:34   ` Andy Gross
     [not found]   ` <1400016884-9568-4-git-send-email-agross-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2014-05-19  8:51     ` Ivan T. Ivanov
2014-05-19  8:51       ` Ivan T. Ivanov
2014-05-19  8:51       ` Ivan T. Ivanov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.