dt-bindings: spi: Qualcomm Quad SPI(QSPI) documentation
Subsystems (3)
PATCH v2 1/2 dt-bindings: spi: Qualcomm Quad SPI(QSPI) documentation
From: Girish Mahadevan <[email protected]>
Bindings for Qualcomm Quad SPI used on SoCs such as sdm845.
---
Changes in v2:
- Added commit text
- Removed invalid property
- Updated example to match sdm845 with attached spi-nor
.../bindings/spi/qcom,spi-qcom-qspi.txt | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 Documentation/devicetree/bindings/spi/qcom,spi-qcom-qspi.txt
Documentation/devicetree/bindings/spi/qcom,spi-qcom-qspi.txt new file +36 -0
@@ -0,0 +1,36 @@ +Qualcomm Quad Serial Peripheral Interface (QSPI) + +The QSPI controller allows SPI protocol communication in single, dual, or quad +wire transmission modes for read/write access to slaves such as NOR flash. + +Required properties: +- compatible: Should contain: + "qcom,sdm845-qspi" +- reg: Should contain the base register location and length. +- interrupts: Interrupt number used by the controller. +- clocks: Should contain the core and AHB clock. +- clock-names: Should be "core" for core clock and "iface" for AHB clock. + +SPI slave nodes must be children of the SPI master node and can contain +properties described in Documentation/devicetree/bindings/spi/spi-bus.txt + +Example: + + qspi: qspi@88df000 { + compatible = "qcom,sdm845-qspi"; + reg = <0x88df000 0x600>; + #address-cells = <1>; + #size-cells = <0>; + interrupts = <GIC_SPI 82 IRQ_TYPE_LEVEL_HIGH>; + clock-names = "iface", "core"; + clocks = <&gcc GCC_QSPI_CNOC_PERIPH_AHB_CLK>, + <&gcc GCC_QSPI_CORE_CLK>; + + device@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <25000000>; + spi-tx-bus-width = <2>; + spi-rx-bus-width = <2>; + }; + };
Signature · 1 line
2.19.0.444.g18242da7ef-goog
PATCH v2 2/2 spi: Introduce new driver for Qualcomm QuadSPI controller
From: Girish Mahadevan <[email protected]>
New driver for Qualcomm QuadSPI(QSPI) controller that is used to communicate with slaves such flash memory devices. The QSPI controller can operate in 2 or 4 wire mode but only supports SPI Mode 0 and SPI Mode 3. The controller can also operate in Single or Dual data rate modes.
---
Changes in v2:
- Addressed formatting feedback
- Squashed bug fixes and features from Doug
- Now uses transfer_one_message instead of mem_ops
- Fixed suspend/resume
- Added spinlocks
drivers/spi/Kconfig | 6 + drivers/spi/Makefile | 1 + drivers/spi/spi-qcom-qspi.c | 608 ++++++++++++++++++++++++++++++++++++ 3 files changed, 615 insertions(+) create mode 100644 drivers/spi/spi-qcom-qspi.c
drivers/spi/Kconfig +6 -0
@@ -549,6 +549,12 @@ config SPI_RSPI help SPI driver for Renesas RSPI and QSPI blocks. +config SPI_QCOM_QSPI + tristate "QTI QPSPI controller" + depends on ARCH_QCOM + help + QSPI(Quad SPI) driver for Qualcomm QSPI controller. + config SPI_QUP tristate "Qualcomm SPI controller with QUP interface" depends on ARCH_QCOM || (ARM && COMPILE_TEST)
drivers/spi/Makefile +1 -0
@@ -112,3 +112,4 @@ obj-$(CONFIG_SPI_ZYNQMP_GQSPI) += spi-zynqmp-gqspi.o # SPI slave protocol handlers obj-$(CONFIG_SPI_SLAVE_TIME) += spi-slave-time.o obj-$(CONFIG_SPI_SLAVE_SYSTEM_CONTROL) += spi-slave-system-control.o +obj-$(CONFIG_SPI_QCOM_QSPI) += spi-qcom-qspi.o
drivers/spi/spi-qcom-qspi.c new file +608 -0
608 lines not on this page · raw message
Signature · 1 line
2.19.0.444.g18242da7ef-goog
Re: [PATCH v2 2/2] spi: Introduce new driver for Qualcomm QuadSPI controller
Hi,
Just curious:
drivers/spi/Kconfig config SPI_RSPI · line 553
Quoted 10 lines · Ryan Case
drivers/spi/Kconfig +2
-0@@ -549,6 +549,12 @@ config SPI_RSPI help SPI driver for Renesas RSPI and QSPI blocks. +config SPI_QCOM_QSPI + tristate "QTI QPSPI controller"
Is that QPSPI correct?
This is the only place that QPSPI or PSPI is used in this patch.
Quoted 7 lines
drivers/spi/Kconfig +4
-0+ depends on ARCH_QCOM + help + QSPI(Quad SPI) driver for Qualcomm QSPI controller. + config SPI_QUP tristate "Qualcomm SPI controller with QUP interface" depends on ARCH_QCOM || (ARM && COMPILE_TEST)
Signature · 1 line
~Randy
Re: [PATCH v2 2/2] spi: Introduce new driver for Qualcomm QuadSPI controller
Quoted 9 lines · Randy Dunlap
Quoted 8 lines · Ryan Case
drivers/spi/Kconfig +0
-0@@ -549,6 +549,12 @@ config SPI_RSPI help SPI driver for Renesas RSPI and QSPI blocks.
Quoted 6 lines
drivers/spi/Kconfig config SPI_RSPI · line 553
Quoted 2 lines
drivers/spi/Kconfig +2
-0+config SPI_QCOM_QSPI + tristate "QTI QPSPI controller"Is that QPSPI correct?
This is the only place that QPSPI or PSPI is used in this patch.
Thanks Randy, that is a typo. I'll fix this in the next revision in a day or two pending further feedback.
Mark Brown
maintainerRe: [PATCH v2 2/2] spi: Introduce new driver for Qualcomm QuadSPI controller
In reply to Ryan Casedrivers/spi/spi-qcom-qspi.c line 315
Quoted 8 lines · Ryan Case
drivers/spi/spi-qcom-qspi.c new file +7
-0+static int qcom_qspi_setup (struct spi_device *spi) +{ +/* +* Ensure that the configuration goes through by reading back +* a register from the IO space. +*/ + mstr_cfg =readl (ctrl->base +MSTR_CONFIG );
Your setup() function shouldn't be affecting the status of the hardware for any other SPI devices using the controller, otherwise it might disturb an active transfer. prepare_message() is typically the best place to do this stuff.
Otherwise this looks good.
Quoting Ryan Case (2018-09-20 15:40:54)
Quoted 6 lines
Documentation/devicetree/bindings/spi/qcom,spi-qcom-qspi.txt new file +0
-0
Documentation/devicetree/bindings/spi/qcom,spi-qcom-qspi.txt line 8
Quoted 8 lines
Documentation/devicetree/bindings/spi/qcom,spi-qcom-qspi.txt new file +8
-0@@ -0,0 +1,36 @@ +Qualcomm Quad Serial Peripheral Interface (QSPI) + +The QSPI controller allows SPI protocol communication in single, dual, or quad +wire transmission modes for read/write access to slaves such as NOR flash. + +Required properties: +- compatible: Should contain: + "qcom,sdm845-qspi"
Does someone have a more generic compatible string that can be added here to indicate the type of quad SPI controller this is? I really doubt this is a one-off hardware block for the specific SDM845 SoC.
Quoted 5 lines
Documentation/devicetree/bindings/spi/qcom,spi-qcom-qspi.txt new file +5
-0+- reg: Should contain the base register location and length. +- interrupts: Interrupt number used by the controller. +- clocks: Should contain the core and AHB clock. +- clock-names: Should be "core" for core clock and "iface" for AHB clock. +
Mark Brown
maintainerQuoted 9 lines · Stephen Boyd
Quoting Ryan Case (2018-09-20 15:40:54)
Documentation/devicetree/bindings/spi/qcom,spi-qcom-qspi.txt line 8
Quoted 3 lines
Documentation/devicetree/bindings/spi/qcom,spi-qcom-qspi.txt new file +3
-0+Required properties: +- compatible: Should contain: + "qcom,sdm845-qspi"Does someone have a more generic compatible string that can be added here to indicate the type of quad SPI controller this is? I really doubt this is a one-off hardware block for the specific SDM845 SoC.
The idiom for DT is supposed to be to use only device specific names unfortunately.
Quoted 11 lines · Mark Brown
Quoted 7 lines · Stephen Boyd
Quoting Ryan Case (2018-09-20 15:40:54)
Documentation/devicetree/bindings/spi/qcom,spi-qcom-qspi.txt line 8
Quoted 3 lines
Documentation/devicetree/bindings/spi/qcom,spi-qcom-qspi.txt new file +3
-0+Required properties: +- compatible: Should contain: + "qcom,sdm845-qspi"Does someone have a more generic compatible string that can be added here to indicate the type of quad SPI controller this is? I really doubt this is a one-off hardware block for the specific SDM845 SoC.
The idiom for DT is supposed to be to use only device specific names unfortunately.
Basically the "first" device the driver can control has it's specific name used as the generic string. This is used in place of some internal codename for the core.
Then a newer device will have "foo,XYZ200", "foo,XYZ100" as compatible, where the 100 was the first device and the 200 is new one. Maybe the driver cares, or will care, about what device this or maybe it can drive the device fine without needing to know more than the generic.
Hi,
Quoted 12 lines · Stephen Boyd
Quoting Ryan Case (2018-09-20 15:40:54)
Quoted 10 lines
Documentation/devicetree/bindings/spi/qcom,spi-qcom-qspi.txt new file +4
-0@@ -0,0 +1,36 @@ +Qualcomm Quad Serial Peripheral Interface (QSPI) + +The QSPI controller allows SPI protocol communication in single, dual, or quad +wire transmission modes for read/write access to slaves such as NOR flash.
Quoted 8 lines
Documentation/devicetree/bindings/spi/qcom,spi-qcom-qspi.txt line 8
Quoted 4 lines
Documentation/devicetree/bindings/spi/qcom,spi-qcom-qspi.txt new file +4
-0+ +Required properties: +- compatible: Should contain: + "qcom,sdm845-qspi"Does someone have a more generic compatible string that can be added here to indicate the type of quad SPI controller this is? I really doubt this is a one-off hardware block for the specific SDM845 SoC.
The compatible string used to be "qcom,qspi-v1". ...but Rob Herring requested [1] "an SoC specific compatible string". While we could do a compatible string like:
"qcom,sdm845-qspi", "qcom,qspi-v1".
I'm curious if that buys us anything. From all my previous experience with device tree it is fine to name a compatible string for a component based on the first SoC that used it. If we later find that this is also used in an "msm1234" we could always later do the compatible string for that device as:
"qcom, msm1234-qspi", "qcom,sdm845-qspi"
...and we don't need to try to come up with a generic name. Obviously, though, I'll cede to whatever Rob says here though.
-Doug
[1] http://lkml.kernel.org/r/20180716222721.GA12854@rob-hp-laptop
Quoted 6 lines
Quoted 6 lines
Documentation/devicetree/bindings/spi/qcom,spi-qcom-qspi.txt new file +5
-0+- reg: Should contain the base register location and length. +- interrupts: Interrupt number used by the controller. +- clocks: Should contain the core and AHB clock. +- clock-names: Should be "core" for core clock and "iface" for AHB clock. +
Quoting Doug Anderson (2018-09-21 10:40:14)
Quoted 36 lines
Hi,
Quoted 12 lines · Stephen Boyd
Quoting Ryan Case (2018-09-20 15:40:54)
Quoted 10 lines
Documentation/devicetree/bindings/spi/qcom,spi-qcom-qspi.txt new file +4
-0@@ -0,0 +1,36 @@ +Qualcomm Quad Serial Peripheral Interface (QSPI) + +The QSPI controller allows SPI protocol communication in single, dual, or quad +wire transmission modes for read/write access to slaves such as NOR flash.Quoted 8 lines
Documentation/devicetree/bindings/spi/qcom,spi-qcom-qspi.txt line 8
Quoted 4 lines
Documentation/devicetree/bindings/spi/qcom,spi-qcom-qspi.txt new file +4
-0+ +Required properties: +- compatible: Should contain: + "qcom,sdm845-qspi"Does someone have a more generic compatible string that can be added here to indicate the type of quad SPI controller this is? I really doubt this is a one-off hardware block for the specific SDM845 SoC.
The compatible string used to be "qcom,qspi-v1". ...but Rob Herring requested [1] "an SoC specific compatible string". While we could do a compatible string like:
"qcom,sdm845-qspi", "qcom,qspi-v1".
I'm curious if that buys us anything. From all my previous experience with device tree it is fine to name a compatible string for a component based on the first SoC that used it. If we later find that this is also used in an "msm1234" we could always later do the compatible string for that device as:
Quoted 5 lines
"qcom, msm1234-qspi", "qcom,sdm845-qspi"
...and we don't need to try to come up with a generic name. Obviously, though, I'll cede to whatever Rob says here though.
It seems that everybody has misunderstood my email. Let me try to clarify.
I'm not saying to replace the sdm845 qspi compatible with a generic one. I'm recommending that a generic one is added in addition to the SoC specific one. That way, we get to put the generic compatible string in the driver and not need to update the driver compatible string array each time a new SoC comes out with a new compatible string.
If it turns out later that we need to handle some bug in that specific SoC compatible string then we're good to go and we can handle it by matching the more specific SoC version compatible.
Stephen
Quoted 53 lines · Stephen Boyd
Quoting Doug Anderson (2018-09-21 10:40:14)
Quoted 36 lines
Hi,
Quoted 12 lines · Stephen Boyd
Quoting Ryan Case (2018-09-20 15:40:54)
Quoted 10 lines
Documentation/devicetree/bindings/spi/qcom,spi-qcom-qspi.txt new file +4
-0@@ -0,0 +1,36 @@ +Qualcomm Quad Serial Peripheral Interface (QSPI) + +The QSPI controller allows SPI protocol communication in single, dual, or quad +wire transmission modes for read/write access to slaves such as NOR flash.Quoted 8 lines
Documentation/devicetree/bindings/spi/qcom,spi-qcom-qspi.txt line 8
Quoted 4 lines
Documentation/devicetree/bindings/spi/qcom,spi-qcom-qspi.txt new file +4
-0+ +Required properties: +- compatible: Should contain: + "qcom,sdm845-qspi"Does someone have a more generic compatible string that can be added here to indicate the type of quad SPI controller this is? I really doubt this is a one-off hardware block for the specific SDM845 SoC.
The compatible string used to be "qcom,qspi-v1". ...but Rob Herring requested [1] "an SoC specific compatible string". While we could do a compatible string like:
"qcom,sdm845-qspi", "qcom,qspi-v1".
I'm curious if that buys us anything. From all my previous experience with device tree it is fine to name a compatible string for a component based on the first SoC that used it. If we later find that this is also used in an "msm1234" we could always later do the compatible string for that device as:
Quoted 5 lines
"qcom, msm1234-qspi", "qcom,sdm845-qspi"
...and we don't need to try to come up with a generic name. Obviously, though, I'll cede to whatever Rob says here though.
It seems that everybody has misunderstood my email. Let me try to clarify.
I'm not saying to replace the sdm845 qspi compatible with a generic one. I'm recommending that a generic one is added in addition to the SoC specific one. That way, we get to put the generic compatible string in the driver and not need to update the driver compatible string array each time a new SoC comes out with a new compatible string.
Quoted 3 lines
If it turns out later that we need to handle some bug in that specific SoC compatible string then we're good to go and we can handle it by matching the more specific SoC version compatible.
I don't think I misunderstood. I was suggesting that I believe that the device tree way is to use the first SoC as the generic one. In other words to support sdm845 and msm1234, we do:
A)
on sdm845: "qcom,sdm845-qspi"
on msm1234 (later): "qcom, msm1234-qspi", "qcom,sdm845-qspi"
What you are suggesting (I think) is:
B)
on sdm845: "qcom,sdm845-qspi", "qcom,qspi-v1" on msm1234 (later): "qcom, msm1234-qspi", "qcom,qspi-v1"
If Rob likes B) better then it's fine with me, it was just my understanding that A) was the suggested way to do things (even if it is decidedly non-symmetric).
NOTE: Even with A) there's no need to update the driver for msm1234 since it has the fallback to sdm845.
-Doug
Mark Brown
maintainerQuoted 9 lines · Stephen Boyd
It seems that everybody has misunderstood my email. Let me try to clarify.
I'm not saying to replace the sdm845 qspi compatible with a generic one. I'm recommending that a generic one is added in addition to the SoC specific one. That way, we get to put the generic compatible string in the driver and not need to update the driver compatible string array each time a new SoC comes out with a new compatible string.
Quoted 3 lines
If it turns out later that we need to handle some bug in that specific SoC compatible string then we're good to go and we can handle it by matching the more specific SoC version compatible.
Right, the policy is generally not to have these strings at all. IIRC the argument is that they tend to either become unclear as the marketing and technology changes.
Quoting Mark Brown (2018-09-21 11:51:06)
Quoted 11 lines · Stephen Boyd
Quoted 9 lines
It seems that everybody has misunderstood my email. Let me try to clarify.
I'm not saying to replace the sdm845 qspi compatible with a generic one. I'm recommending that a generic one is added in addition to the SoC specific one. That way, we get to put the generic compatible string in the driver and not need to update the driver compatible string array each time a new SoC comes out with a new compatible string.
Quoted 7 lines
Quoted 3 lines
If it turns out later that we need to handle some bug in that specific SoC compatible string then we're good to go and we can handle it by matching the more specific SoC version compatible.
Right, the policy is generally not to have these strings at all. IIRC the argument is that they tend to either become unclear as the marketing and technology changes.
Where is this policy documented? Is it on the list somewhere or written in Documentation/devicetree/? From my read of Rob's comment in the previous version of this patch, all that was asked was to add another compatible string for the specific SoC.
I find the approach of picking the first SoC that the driver works on to be obtuse. I don't want to be reading some SoC DTS and see another SoC marketing number in the compatible string because it makes it confusing to explain to someone that yes these different SoCs are related to each other, but no, that SoC isn't this SoC. Sure it all works and everything is technically fine, but my aesthetically pleasing alarms go off and I don't see any particular downside to having two compatibles.
The upside is that things aren't confusing and drivers don't get continual SoC churn updates because the compatible describes the SoC (qcom,sdm845-qspi) and the programming model (qcom,qspi-v1).
Hi,
Quoted 17 lines · Stephen Boyd
Quoting Mark Brown (2018-09-21 11:51:06)
Quoted 15 lines · Stephen Boyd
Quoted 13 lines
It seems that everybody has misunderstood my email. Let me try to clarify.
I'm not saying to replace the sdm845 qspi compatible with a generic one. I'm recommending that a generic one is added in addition to the SoC specific one. That way, we get to put the generic compatible string in the driver and not need to update the driver compatible string array each time a new SoC comes out with a new compatible string.
If it turns out later that we need to handle some bug in that specific SoC compatible string then we're good to go and we can handle it by matching the more specific SoC version compatible.
Quoted 6 lines
Quoted 3 lines
Right, the policy is generally not to have these strings at all. IIRC the argument is that they tend to either become unclear as the marketing and technology changes.
Where is this policy documented? Is it on the list somewhere or written in
Documentation/devicetree/?
I don't of it being documented anywhere, but it's what I've been told before. I spent a bit of time to find a specific example but I couldn't. As with a lot of device tree stuff it historically has been a bunch of word-of-mouth type stuff. It does look like people are moving towards a more formal spec at
<https://github.com/devicetree-org/devicetree-specification/> but it doesn't include this guideline.
Quoted 12 lines
From my read of Rob's comment in the
previous version of this patch, all that was asked was to add another compatible string for the specific SoC.I find the approach of picking the first SoC that the driver works on to be obtuse. I don't want to be reading some SoC DTS and see another SoC marketing number in the compatible string because it makes it confusing to explain to someone that yes these different SoCs are related to each other, but no, that SoC isn't this SoC. Sure it all works and everything is technically fine, but my aesthetically pleasing alarms go off and I don't see any particular downside to having two compatibles.
Quoted 3 lines
The upside is that things aren't confusing and drivers don't get continual SoC churn updates because the compatible describes the SoC (qcom,sdm845-qspi) and the programming model (qcom,qspi-v1).
IIUC previous suggestions about just naming it based on the first SoC was due to the difficulty of coming up with a good generic name to give something. For instance you definitely wouldn't want to name it "qcom-qspi-sdm8xx" because you have no idea what future SoCs will be numbered.
In the case here calling it "qcom,qspi-v1" is better than that and if Rob gives the thumbs up then I won't object to it. In general though looking at other device tree bindings this doesn't seem like a thing commonly done. Perhaps if we decide it's useful here we should start suggesting it everywhere...
-Doug
-Doug
Quoted 5 lines · Doug Anderson
IIUC previous suggestions about just naming it based on the first SoC was due to the difficulty of coming up with a good generic name to give something. For instance you definitely wouldn't want to name it "qcom-qspi-sdm8xx" because you have no idea what future SoCs will be numbered.
And the hypothetical sdm899 might use a non-compatible device that uses a different driver, and that really makes "qcom-qspi-sdm8xx" look dumb.
Quoted 6 lines
In the case here calling it "qcom,qspi-v1" is better than that and if Rob gives the thumbs up then I won't object to it. In general though looking at other device tree bindings this doesn't seem like a thing commonly done. Perhaps if we decide it's useful here we should start suggesting it everywhere...
It would help if the programming model or IP core name or whatever this is using was mentioned in the public reference manual for the SoC. Then is a lot more clear that a number of different SoCs all have the same quad spi controller inside them.
Usually it's not like that. The RMs just say, "it's got a SPI master with these registers." What SoCs use the same IP module, which different? When did they make a new version? The silicon vendors don't tell you this. So any name we make up for the IP module likely doesn't match reality.
Hi,
Quoted 23 lines · Trent Piepho
Quoted 5 lines · Doug Anderson
IIUC previous suggestions about just naming it based on the first SoC was due to the difficulty of coming up with a good generic name to give something. For instance you definitely wouldn't want to name it "qcom-qspi-sdm8xx" because you have no idea what future SoCs will be numbered.
And the hypothetical sdm899 might use a non-compatible device that uses a different driver, and that really makes "qcom-qspi-sdm8xx" look dumb.
Quoted 6 lines
In the case here calling it "qcom,qspi-v1" is better than that and if Rob gives the thumbs up then I won't object to it. In general though looking at other device tree bindings this doesn't seem like a thing commonly done. Perhaps if we decide it's useful here we should start suggesting it everywhere...
It would help if the programming model or IP core name or whatever this is using was mentioned in the public reference manual for the SoC. Then is a lot more clear that a number of different SoCs all have the same quad spi controller inside them.
Quoted 5 lines
Usually it's not like that. The RMs just say, "it's got a SPI master with these registers." What SoCs use the same IP module, which different? When did they make a new version? The silicon vendors don't tell you this. So any name we make up for the IP module likely doesn't match reality.
Note that Rob did recently give a positive review to a similar binding. See:
https://lore.kernel.org/patchwork/patch/979432/
Specifically the text from that binding was:
+ Qcom SoCs must contain, as below, SoC-specific compatibles + along with "qcom,smmu-v2": + "qcom,msm8996-smmu-v2", "qcom,smmu-v2", + "qcom,sdm845-smmu-v2", "qcom,smmu-v2".
Given Rob's positive review there, it seems like it would be fine to do:
"qcom,sdm845-qspi", "qcom,qspi-v1".
NOTE: In our case we don't need the "-v1" in SoC-specific case since there's only one Quad SPI driver there. As I understand it the reason we needed the -v2 in the SoC-specific case for the SMMU was that there are two totally different SMMUs in SDM845. You can see history in the v15 patch <https://lore.kernel.org/patchwork/patch/977888/>
-Doug