Re: [PATCH 1/2] arm64: dts: qcom: sdm845: Add I2C, SPI, and UART9 nodes

2018-06-11 Thread Doug Anderson
Hi,

On Mon, Jun 11, 2018 at 10:01 PM, Bjorn Andersson
 wrote:
> On Thu 07 Jun 13:46 PDT 2018, Douglas Anderson wrote:
>
>> This adds nodes to SDM845-dtsi for all the I2C ports, all the SPI
>> ports, and UART9.  Note that I2C / SPI / UART are a bit strange on
>> sdm845 because each "serial engine" has 4 pins associated with it and
>> depending on which firmware has been loaded into the serial engine
>> (loaded by the BIOS) the serial engine can behave like an I2C port, a
>> SPI port, or a UART.  As per the landed bindings that means that we
>> need to create one node for each possible mode that the port could be
>> in.  With 16 serial engines that means 16 x 3 = 48 nodes.
>>
>> We get away with only creating 33 nodes for now because it seems very
>> likely that SDM845-based boards will actually all use the same UART
>> (UART 9) for debug purposes.  While another UART could be used for
>> something like Bluetooth communication we can cross that path when we
>> come to it.  Some documentation that I saw implied that using a UART
>> for "high speed" communications actually needs yet another different
>> serial engine firmware anyway.
>>
>> Note that quick measurements adding all these nodes adds ~10k of extra
>> space per dtb that they're included with.  If this becomes a problem
>> we may need to think of a different way to structure this so that
>> boards only get the nodes they need (or figure out how to get dtc to
>> strip 'disabled' nodes).  For now it seems OK.
>>
>> These nodes were programmatically generated with a fairly dumb python
>> script.  See http://crosreview.com/1091631 for the source.
>>
>> Signed-off-by: Douglas Anderson 
>
> Reviewed-by: Bjorn Andersson 

Thanks for the review!

One note is that I have since come to find that it might not be so
wise to define the sleep pinctrl state here.  For the SPI driver at
least I dug in and I saw the the sleep state is selected when we're
runtime PMed.  ...and with the currently posted SPI driver that can
happen in some cases even when the chip select is supposed to be kept
low.  For now it's more prudent to keep the "sleep" state out of the
device tree and we can always add it in later.

I'll plan to re-spin the patch on Wednesday (I'm unavailable tomorrow).

For other's reference: I chatted offline with Bjorn offline and this
sounded fine to him.


-Doug


Re: [PATCH 1/2] arm64: dts: qcom: sdm845: Add I2C, SPI, and UART9 nodes

2018-06-11 Thread Bjorn Andersson
On Thu 07 Jun 13:46 PDT 2018, Douglas Anderson wrote:

> This adds nodes to SDM845-dtsi for all the I2C ports, all the SPI
> ports, and UART9.  Note that I2C / SPI / UART are a bit strange on
> sdm845 because each "serial engine" has 4 pins associated with it and
> depending on which firmware has been loaded into the serial engine
> (loaded by the BIOS) the serial engine can behave like an I2C port, a
> SPI port, or a UART.  As per the landed bindings that means that we
> need to create one node for each possible mode that the port could be
> in.  With 16 serial engines that means 16 x 3 = 48 nodes.
> 
> We get away with only creating 33 nodes for now because it seems very
> likely that SDM845-based boards will actually all use the same UART
> (UART 9) for debug purposes.  While another UART could be used for
> something like Bluetooth communication we can cross that path when we
> come to it.  Some documentation that I saw implied that using a UART
> for "high speed" communications actually needs yet another different
> serial engine firmware anyway.
> 
> Note that quick measurements adding all these nodes adds ~10k of extra
> space per dtb that they're included with.  If this becomes a problem
> we may need to think of a different way to structure this so that
> boards only get the nodes they need (or figure out how to get dtc to
> strip 'disabled' nodes).  For now it seems OK.
> 
> These nodes were programmatically generated with a fairly dumb python
> script.  See http://crosreview.com/1091631 for the source.
> 
> Signed-off-by: Douglas Anderson 

Reviewed-by: Bjorn Andersson 

Regards,
Bjorn

> ---
> 
>  arch/arm64/boot/dts/qcom/sdm845.dtsi | 1013 ++
>  1 file changed, 1013 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/qcom/sdm845.dtsi 
> b/arch/arm64/boot/dts/qcom/sdm845.dtsi
> index cdaabeb3c995..2dc5c7dcc9aa 100644
> --- a/arch/arm64/boot/dts/qcom/sdm845.dtsi
> +++ b/arch/arm64/boot/dts/qcom/sdm845.dtsi
> @@ -5,6 +5,7 @@
>   * Copyright (c) 2018, The Linux Foundation. All rights reserved.
>   */
>  
> +#include 
>  #include 
>  
>  / {
> @@ -13,6 +14,41 @@
>   #address-cells = <2>;
>   #size-cells = <2>;
>  
> + aliases {
> + i2c0 = &i2c0;
> + i2c1 = &i2c1;
> + i2c2 = &i2c2;
> + i2c3 = &i2c3;
> + i2c4 = &i2c4;
> + i2c5 = &i2c5;
> + i2c6 = &i2c6;
> + i2c7 = &i2c7;
> + i2c8 = &i2c8;
> + i2c9 = &i2c9;
> + i2c10 = &i2c10;
> + i2c11 = &i2c11;
> + i2c12 = &i2c12;
> + i2c13 = &i2c13;
> + i2c14 = &i2c14;
> + i2c15 = &i2c15;
> + spi0 = &spi0;
> + spi1 = &spi1;
> + spi2 = &spi2;
> + spi3 = &spi3;
> + spi4 = &spi4;
> + spi5 = &spi5;
> + spi6 = &spi6;
> + spi7 = &spi7;
> + spi8 = &spi8;
> + spi9 = &spi9;
> + spi10 = &spi10;
> + spi11 = &spi11;
> + spi12 = &spi12;
> + spi13 = &spi13;
> + spi14 = &spi14;
> + spi15 = &spi15;
> + };
> +
>   chosen { };
>  
>   memory@8000 {
> @@ -206,6 +242,489 @@
>   #power-domain-cells = <1>;
>   };
>  
> + qupv3_id_0: geniqup@8c {
> + compatible = "qcom,geni-se-qup";
> + reg = <0x8c 0x6000>;
> + clock-names = "m-ahb", "s-ahb";
> + clocks = <&gcc GCC_QUPV3_WRAP_0_M_AHB_CLK>,
> +  <&gcc GCC_QUPV3_WRAP_0_S_AHB_CLK>;
> + #address-cells = <1>;
> + #size-cells = <1>;
> + ranges;
> +
> + i2c0: i2c@88 {
> + compatible = "qcom,geni-i2c";
> + reg = <0x88 0x4000>;
> + clock-names = "se";
> + clocks = <&gcc GCC_QUPV3_WRAP0_S0_CLK>;
> + pinctrl-names = "default", "sleep";
> + pinctrl-0 = <&qup_i2c0_default>;
> + pinctrl-1 = <&qup_i2c0_sleep>;
> + interrupts = ;
> + #address-cells = <1>;
> + #size-cells = <0>;
> + status = "disabled";
> + };
> +
> + spi0: spi@88 {
> + compatible = "qcom,geni-spi";
> + reg = <0x88 0x4000>;
> + clock-names = "se";
> + clocks = <&gcc GCC_QUPV3_WRAP0_S0_CLK>;
> + pinctrl-names = "default", "sleep";
> + pinctrl-0 = <&qup_spi0_default>;
> + pinct

[PATCH 1/2] arm64: dts: qcom: sdm845: Add I2C, SPI, and UART9 nodes

2018-06-07 Thread Douglas Anderson
This adds nodes to SDM845-dtsi for all the I2C ports, all the SPI
ports, and UART9.  Note that I2C / SPI / UART are a bit strange on
sdm845 because each "serial engine" has 4 pins associated with it and
depending on which firmware has been loaded into the serial engine
(loaded by the BIOS) the serial engine can behave like an I2C port, a
SPI port, or a UART.  As per the landed bindings that means that we
need to create one node for each possible mode that the port could be
in.  With 16 serial engines that means 16 x 3 = 48 nodes.

We get away with only creating 33 nodes for now because it seems very
likely that SDM845-based boards will actually all use the same UART
(UART 9) for debug purposes.  While another UART could be used for
something like Bluetooth communication we can cross that path when we
come to it.  Some documentation that I saw implied that using a UART
for "high speed" communications actually needs yet another different
serial engine firmware anyway.

Note that quick measurements adding all these nodes adds ~10k of extra
space per dtb that they're included with.  If this becomes a problem
we may need to think of a different way to structure this so that
boards only get the nodes they need (or figure out how to get dtc to
strip 'disabled' nodes).  For now it seems OK.

These nodes were programmatically generated with a fairly dumb python
script.  See http://crosreview.com/1091631 for the source.

Signed-off-by: Douglas Anderson 
---

 arch/arm64/boot/dts/qcom/sdm845.dtsi | 1013 ++
 1 file changed, 1013 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sdm845.dtsi 
b/arch/arm64/boot/dts/qcom/sdm845.dtsi
index cdaabeb3c995..2dc5c7dcc9aa 100644
--- a/arch/arm64/boot/dts/qcom/sdm845.dtsi
+++ b/arch/arm64/boot/dts/qcom/sdm845.dtsi
@@ -5,6 +5,7 @@
  * Copyright (c) 2018, The Linux Foundation. All rights reserved.
  */
 
+#include 
 #include 
 
 / {
@@ -13,6 +14,41 @@
#address-cells = <2>;
#size-cells = <2>;
 
+   aliases {
+   i2c0 = &i2c0;
+   i2c1 = &i2c1;
+   i2c2 = &i2c2;
+   i2c3 = &i2c3;
+   i2c4 = &i2c4;
+   i2c5 = &i2c5;
+   i2c6 = &i2c6;
+   i2c7 = &i2c7;
+   i2c8 = &i2c8;
+   i2c9 = &i2c9;
+   i2c10 = &i2c10;
+   i2c11 = &i2c11;
+   i2c12 = &i2c12;
+   i2c13 = &i2c13;
+   i2c14 = &i2c14;
+   i2c15 = &i2c15;
+   spi0 = &spi0;
+   spi1 = &spi1;
+   spi2 = &spi2;
+   spi3 = &spi3;
+   spi4 = &spi4;
+   spi5 = &spi5;
+   spi6 = &spi6;
+   spi7 = &spi7;
+   spi8 = &spi8;
+   spi9 = &spi9;
+   spi10 = &spi10;
+   spi11 = &spi11;
+   spi12 = &spi12;
+   spi13 = &spi13;
+   spi14 = &spi14;
+   spi15 = &spi15;
+   };
+
chosen { };
 
memory@8000 {
@@ -206,6 +242,489 @@
#power-domain-cells = <1>;
};
 
+   qupv3_id_0: geniqup@8c {
+   compatible = "qcom,geni-se-qup";
+   reg = <0x8c 0x6000>;
+   clock-names = "m-ahb", "s-ahb";
+   clocks = <&gcc GCC_QUPV3_WRAP_0_M_AHB_CLK>,
+<&gcc GCC_QUPV3_WRAP_0_S_AHB_CLK>;
+   #address-cells = <1>;
+   #size-cells = <1>;
+   ranges;
+
+   i2c0: i2c@88 {
+   compatible = "qcom,geni-i2c";
+   reg = <0x88 0x4000>;
+   clock-names = "se";
+   clocks = <&gcc GCC_QUPV3_WRAP0_S0_CLK>;
+   pinctrl-names = "default", "sleep";
+   pinctrl-0 = <&qup_i2c0_default>;
+   pinctrl-1 = <&qup_i2c0_sleep>;
+   interrupts = ;
+   #address-cells = <1>;
+   #size-cells = <0>;
+   status = "disabled";
+   };
+
+   spi0: spi@88 {
+   compatible = "qcom,geni-spi";
+   reg = <0x88 0x4000>;
+   clock-names = "se";
+   clocks = <&gcc GCC_QUPV3_WRAP0_S0_CLK>;
+   pinctrl-names = "default", "sleep";
+   pinctrl-0 = <&qup_spi0_default>;
+   pinctrl-1 = <&qup_spi0_sleep>;
+   interrupts = ;
+   #address-cells = <1>;
+   #size-cells = <0>;
+