* [PATCH 0/2] mtd: fsl-quadspi: Update hwcap based on mode provided in dtsi file
@ 2018-01-25 7:21 Yogesh Gaur
[not found] ` <1516864917-31969-1-git-send-email-yogeshnarayan.gaur-3arQi8VN3Tc@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Yogesh Gaur @ 2018-01-25 7:21 UTC (permalink / raw)
To: linux-mtd, devicetree, robh, mark.rutland, shawnguo
Cc: boris.brezillon, Yogesh Gaur, prabhakar.kushwaha, suresh.gupta,
cyrille.pitchen, han.xu, computersforpeace, festevam,
linux-arm-kernel
This patch-set added support to update hwcap of FSL QUADSPI controller
by reading values from the device tree files.
Updated the fsl-quadspi binding by adding spi-tx-bus-width,
spi-rx-bus-width binding needed to define mode of operation.
Depends on
https://patchwork.ozlabs.org/project/linux-mtd/list/?series=25286
Yogesh Gaur (2):
Documentation: binding: Update fsl-quadspi binding
mtd: fsl-quadspi: Update hwcap based on mode provided in dtsi file
.../devicetree/bindings/mtd/fsl-quadspi.txt | 4 ++
drivers/mtd/spi-nor/fsl-quadspi.c | 46 ++++++++++++++++++++--
2 files changed, 47 insertions(+), 3 deletions(-)
--
1.9.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/2] Documentation: binding: Update fsl-quadspi binding
[not found] ` <1516864917-31969-1-git-send-email-yogeshnarayan.gaur-3arQi8VN3Tc@public.gmane.org>
@ 2018-01-25 7:21 ` Yogesh Gaur
2018-01-25 7:21 ` [PATCH 2/2] mtd: fsl-quadspi: Update hwcap based on mode provided in dtsi file Yogesh Gaur
1 sibling, 0 replies; 3+ messages in thread
From: Yogesh Gaur @ 2018-01-25 7:21 UTC (permalink / raw)
To: linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
devicetree-u79uwXL29TY76Z2rM5mHXA, robh-DgEjT+Ai2ygdnm+yROfE0A,
mark.rutland-5wv7dgnIgG8, shawnguo-DgEjT+Ai2ygdnm+yROfE0A
Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
cyrille.pitchen-yU5RGvR974pGWvitb5QawA,
computersforpeace-Re5JQEeQqe8AvxtiuMwx3w, han.xu-3arQi8VN3Tc,
festevam-Re5JQEeQqe8AvxtiuMwx3w, prabhakar.kushwaha-3arQi8VN3Tc,
suresh.gupta-3arQi8VN3Tc, Yogesh Gaur
QuadSPI controller supports Single, dual, quad modes of operation.
Mode is controlled via either RCW or the on-board connection to flash.
spi-tx-bus-width, spi-rx-bus-width binding added to define mode
of operation. Definition of these binding are standard as defined
in Documentation/devicetree/bindings/spi/spi-bus.txt.
Signed-off-by: Prabhakar Kushwaha <prabhakar.kushwaha-3arQi8VN3Tc@public.gmane.org>
Signed-off-by: Yogesh Gaur <yogeshnarayan.gaur-3arQi8VN3Tc@public.gmane.org>
---
Documentation/devicetree/bindings/mtd/fsl-quadspi.txt | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/Documentation/devicetree/bindings/mtd/fsl-quadspi.txt b/Documentation/devicetree/bindings/mtd/fsl-quadspi.txt
index c34aa6f..13a903e 100644
--- a/Documentation/devicetree/bindings/mtd/fsl-quadspi.txt
+++ b/Documentation/devicetree/bindings/mtd/fsl-quadspi.txt
@@ -23,6 +23,10 @@ Optional properties:
bus, you should enable this property.
(Please check the board's schematic.)
- big-endian : That means the IP register is big endian
+ - spi-tx-bus-width - Definition as per
+ Documentation/devicetree/bindings/spi/spi-bus.txt
+ - spi-rx-bus-width - Definition as per
+ Documentation/devicetree/bindings/spi/spi-bus.txt
Example:
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe devicetree" 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] 3+ messages in thread
* [PATCH 2/2] mtd: fsl-quadspi: Update hwcap based on mode provided in dtsi file
[not found] ` <1516864917-31969-1-git-send-email-yogeshnarayan.gaur-3arQi8VN3Tc@public.gmane.org>
2018-01-25 7:21 ` [PATCH 1/2] Documentation: binding: Update fsl-quadspi binding Yogesh Gaur
@ 2018-01-25 7:21 ` Yogesh Gaur
1 sibling, 0 replies; 3+ messages in thread
From: Yogesh Gaur @ 2018-01-25 7:21 UTC (permalink / raw)
To: linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
devicetree-u79uwXL29TY76Z2rM5mHXA, robh-DgEjT+Ai2ygdnm+yROfE0A,
mark.rutland-5wv7dgnIgG8, shawnguo-DgEjT+Ai2ygdnm+yROfE0A
Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
cyrille.pitchen-yU5RGvR974pGWvitb5QawA,
computersforpeace-Re5JQEeQqe8AvxtiuMwx3w, han.xu-3arQi8VN3Tc,
festevam-Re5JQEeQqe8AvxtiuMwx3w, prabhakar.kushwaha-3arQi8VN3Tc,
suresh.gupta-3arQi8VN3Tc, Yogesh Gaur
FSL QuadSPI controller supports Single, dual, quad modes of operation.
Mode information is available via "spi-tx-bus-width" and
"spi-rx-bus-width" nodes of device tree.
Update read hwcap capability by reading "spi-rx-bus-width".
Update write hwcap capability by reading "spi-tx-bus-width".
If value not provided in device tree file, then fallback to default
mode i.e. SNOR_HWCAPS_READ_1_1_4 and SNOR_HWCAPS_PP.
Signed-off-by: Prabhakar Kushwaha <prabhakar.kushwaha-3arQi8VN3Tc@public.gmane.org>
Signed-off-by: Yogesh Gaur <yogeshnarayan.gaur-3arQi8VN3Tc@public.gmane.org>
---
drivers/mtd/spi-nor/fsl-quadspi.c | 46 ++++++++++++++++++++++++++++++++++++---
1 file changed, 43 insertions(+), 3 deletions(-)
diff --git a/drivers/mtd/spi-nor/fsl-quadspi.c b/drivers/mtd/spi-nor/fsl-quadspi.c
index 11389d8..ff98e5a 100644
--- a/drivers/mtd/spi-nor/fsl-quadspi.c
+++ b/drivers/mtd/spi-nor/fsl-quadspi.c
@@ -979,8 +979,8 @@ static void fsl_qspi_unprep(struct spi_nor *nor, enum spi_nor_ops ops)
static int fsl_qspi_probe(struct platform_device *pdev)
{
- const struct spi_nor_hwcaps hwcaps = {
- .mask = SNOR_HWCAPS_READ_1_1_4 |
+ struct spi_nor_hwcaps hwcaps = {
+ .mask = SNOR_HWCAPS_READ_FAST |
SNOR_HWCAPS_PP,
};
struct device_node *np = pdev->dev.of_node;
@@ -989,7 +989,7 @@ static int fsl_qspi_probe(struct platform_device *pdev)
struct resource *res;
struct spi_nor *nor;
struct mtd_info *mtd;
- int ret, i = 0;
+ int ret, i = 0, value;
q = devm_kzalloc(dev, sizeof(*q), GFP_KERNEL);
if (!q)
@@ -1037,6 +1037,46 @@ static int fsl_qspi_probe(struct platform_device *pdev)
goto clk_failed;
}
+ if (!of_property_read_u32(np, "spi-rx-bus-width", &value)) {
+ switch (value) {
+ case 1:
+ hwcaps.mask |= SNOR_HWCAPS_READ |
+ SNOR_HWCAPS_READ_FAST;
+ break;
+ case 2:
+ hwcaps.mask |= SNOR_HWCAPS_READ_1_1_2 |
+ SNOR_HWCAPS_READ_1_2_2;
+ break;
+ case 4:
+ hwcaps.mask |= SNOR_HWCAPS_READ_1_1_4 |
+ SNOR_HWCAPS_READ_1_4_4;
+ break;
+ default:
+ dev_err(dev,
+ "spi-rx-bus-width %d not supported\n",
+ value);
+ break;
+ }
+ } else
+ hwcaps.mask |= SNOR_HWCAPS_READ_1_1_4;
+
+ if (!of_property_read_u32(np, "spi-tx-bus-width", &value)) {
+ switch (value) {
+ case 1:
+ hwcaps.mask |= SNOR_HWCAPS_PP;
+ break;
+ case 4:
+ hwcaps.mask |= SNOR_HWCAPS_PP_1_1_4 |
+ SNOR_HWCAPS_PP_1_4_4;
+ break;
+ default:
+ dev_err(dev,
+ "spi-tx-bus-width %d not supported\n",
+ value);
+ break;
+ }
+ }
+
/* find the irq */
ret = platform_get_irq(pdev, 0);
if (ret < 0) {
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe devicetree" 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] 3+ messages in thread
end of thread, other threads:[~2018-01-25 7:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-25 7:21 [PATCH 0/2] mtd: fsl-quadspi: Update hwcap based on mode provided in dtsi file Yogesh Gaur
[not found] ` <1516864917-31969-1-git-send-email-yogeshnarayan.gaur-3arQi8VN3Tc@public.gmane.org>
2018-01-25 7:21 ` [PATCH 1/2] Documentation: binding: Update fsl-quadspi binding Yogesh Gaur
2018-01-25 7:21 ` [PATCH 2/2] mtd: fsl-quadspi: Update hwcap based on mode provided in dtsi file Yogesh Gaur
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).