mbox series

[v3,0/9] Add support for sm6115,4250 and OnePlus Nord N100

Message ID 20220910143213.477261-1-iskren.chernev@gmail.com
Headers show
Series Add support for sm6115,4250 and OnePlus Nord N100 | expand

Message

Iskren Chernev Sept. 10, 2022, 2:32 p.m. UTC
Changes from v2
---------------
v2: https://lore.kernel.org/all/20220903174150.3566935-1-iskren.chernev@gmail.com/
- fix ufs bindings to follow sdm845
- drop nvmem, firmware, reserved-range patches (merged)
- add patch that fixes sm6115-dwc3 bindings (4/9)
- add patch that fixes qcom,sm6115-sdhci bindings (5/9)
- add patch that fixes qcom,sm6115-qmp-ufs-phy bindings (6/9)
- drop dynamic reserved memory regions
- drop clock-output-names
- drop frequency for timer
- fix mmc pinctrl regression in v2
- move board clock freqs in relative scope
- fix indentation to please Konrad
- reorder some DT props (reg, status, compatible)

Changes from v1
---------------
v1: https://lore.kernel.org/all/20220901072414.1923075-1-iskren.chernev@gmail.com/
- merge dtsi patches in one
- fix ufs binding (allow ice register)
- fix dt schema issues (to the best of my ability)
- add a few necessary bindings (compats)
- some comments on remaining schema issues after commit msg (patch 7 and 9)

This series adds support for sm6115 (clocks, pinctrl, usb, ufs, sdhc),
sm4250 (mostly empty shell on top of sm6115) and finally basic OnePlus Nord
N100 (codename billie2), including the above mentiond items plus simple
framebuffer.

Please note that this series depends on [1] (driver compat and bindings).

[1] https://lore.kernel.org/linux-devicetree/20220815100952.23795-1-a39.skl@gmail.com/

Iskren Chernev (9):
  dt-bindings: ufs: qcom: Add sm6115 binding
  dt-bindings: arm: cpus: Add kryo240 compatible
  dt-bindings: arm: qcom: Add compatible for oneplus,billie2 phone
  dt-bindings: usb: qcom,dwc3: Fix SM6115 clocks, irqs
  dt-bindings: mmc: sdhci-msm: Add pinctrl-1 property
  dt-bindings: phy: qcom,qmp-ufs: Fix SM6115 clocks, regs
  arm64: dts: qcom: sm6115: Add basic soc dtsi
  arm64: dts: qcom: sm4250: Add soc dtsi
  arm64: dts: qcom: sm4250: Add support for oneplus-billie2

 .../devicetree/bindings/arm/cpus.yaml         |   1 +
 .../devicetree/bindings/arm/qcom.yaml         |   7 +
 .../devicetree/bindings/mmc/sdhci-msm.yaml    |   4 +
 .../bindings/phy/qcom,qmp-ufs-phy.yaml        |   3 +-
 .../devicetree/bindings/ufs/qcom,ufs.yaml     |  26 +
 .../devicetree/bindings/usb/qcom,dwc3.yaml    |   3 +-
 arch/arm64/boot/dts/qcom/Makefile             |   1 +
 .../boot/dts/qcom/sm4250-oneplus-billie2.dts  | 241 +++++
 arch/arm64/boot/dts/qcom/sm4250.dtsi          |  38 +
 arch/arm64/boot/dts/qcom/sm6115.dtsi          | 857 ++++++++++++++++++
 10 files changed, 1179 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm64/boot/dts/qcom/sm4250-oneplus-billie2.dts
 create mode 100644 arch/arm64/boot/dts/qcom/sm4250.dtsi
 create mode 100644 arch/arm64/boot/dts/qcom/sm6115.dtsi

Comments

Krzysztof Kozlowski Sept. 11, 2022, 8:40 a.m. UTC | #1
On 10/09/2022 16:32, Iskren Chernev wrote:
> Add support for Qualcomm SM6115 SoC. This includes:
> - GCC
> - Pinctrl
> - RPM (CC+PD)
> - USB
> - MMC
> - UFS
> 
> Signed-off-by: Iskren Chernev <iskren.chernev@gmail.com>
> ---
> pending issues with dtschema:
> - for some reason, using pinctrl phandles (in mmc) breaks the pinctrl
>   schema (4 times)
>       .output/arch/arm64/boot/dts/qcom/sm4250-oneplus-billie2.dtb: pinctrl@500000: sdc1-on-state: 'oneOf' conditional failed, one must be fixed:
>             'pins' is a required property
>             'clk', 'cmd', 'data', 'rclk' do not match any of the regexes: 'pinctrl-[0-9]+'
>             [[26]] is not of type 'object'
>             From schema: /home/iskren/src/pmos/linux-postmarketos/Documentation/devicetree/bindings/pinctrl/qcom,sm6115-pinctrl.yaml

It's the same as 06367559766b7c9bd96d2baef8bfc5a9bb451e25. I propose to
fix it the same way. I can do a biger change for all pinctrls, so here
you would need to add "-pins" prefix to entries (see patch
4fcdaf4b0320f93d0ccb4d36b795ed258fb07b27).



Best regards,
Krzysztof
Krzysztof Kozlowski Sept. 11, 2022, 10:07 a.m. UTC | #2
On 11/09/2022 11:09, Iskren Chernev wrote:
> 
> 
> On 9/11/22 11:40, Krzysztof Kozlowski wrote:
>> On 10/09/2022 16:32, Iskren Chernev wrote:
>>> Add support for Qualcomm SM6115 SoC. This includes:
>>> - GCC
>>> - Pinctrl
>>> - RPM (CC+PD)
>>> - USB
>>> - MMC
>>> - UFS
>>>
>>> Signed-off-by: Iskren Chernev <iskren.chernev@gmail.com>
>>> ---
>>> pending issues with dtschema:
>>> - for some reason, using pinctrl phandles (in mmc) breaks the pinctrl
>>>   schema (4 times)
>>>       .output/arch/arm64/boot/dts/qcom/sm4250-oneplus-billie2.dtb: pinctrl@500000: sdc1-on-state: 'oneOf' conditional failed, one must be fixed:
>>>             'pins' is a required property
>>>             'clk', 'cmd', 'data', 'rclk' do not match any of the regexes: 'pinctrl-[0-9]+'
>>>             [[26]] is not of type 'object'
>>>             From schema: /home/iskren/src/pmos/linux-postmarketos/Documentation/devicetree/bindings/pinctrl/qcom,sm6115-pinctrl.yaml
>>
>> It's the same as 06367559766b7c9bd96d2baef8bfc5a9bb451e25. I propose to
>> fix it the same way. I can do a biger change for all pinctrls, so here
>> you would need to add "-pins" prefix to entries (see patch
>> 4fcdaf4b0320f93d0ccb4d36b795ed258fb07b27).
> 
> OK, that makes sense. One thing that is a bit odd -- the current pattern
> "(pinconf|-pins)$" matches anything that ends in pinconf OR -pins (so it could
> be sth-pinconf). 

Yeah, I am fixing it to ^(pinconf|.*-pins)$

> Also, if you only have a single block, isn't the idea to just
> list it in the -states node.  I mean we either force everybody to nest with
> a pinconf, or we allow -pins for nested stuff and directly in -state for the
> non-nested. Just my 2c.

I didn't get this one... We allow exactly this, don't we (in PMIC GPIOs)?


Best regards,
Krzysztof
Krzysztof Kozlowski Sept. 11, 2022, 10:26 a.m. UTC | #3
On 11/09/2022 12:22, Iskren Chernev wrote:
>         basic-state { // this matches the first state in oneOf
>             pins: "gpio1";
>             funciton: "normal";
>         };
> 
>         nested-state {
>             some-pins { // this matches the second state in oneOf
>                 pins: "gpio1";
>                 funciton: "normal";
>             };
>             other-pins {
>                 pins: "gpio2"
>                 funciton: "normal";
>             };
>         }
> 
>         // but also, matching second state in oneOf
>         nested-basic-state {
>             pinconf {
>                 pins: "gpio1";
>                 funciton: "normal";
>             };
>         };
>     };
> 
> So I'm saying, we should either choose basic-state and nested-state, in which
> case we don't need the "^pinconf$" variant, or we can have nested-state and
> nested-basic-state, in which case we don't need the 1st case of the oneOf.

Ah, I get it.

> 
> Otherwise people have to choose between basic-state and nested-basic-state,
> which are equivalent in semantics.

Yeah, I can drop pinconf. I put it in the PMIC because it was used, but
I don't find it for TLMM pinctrl nodes.

> 
> On a tangent -- why specifying the .* regex of pinctrl subnodes has effect on
> pinctrl references in other nodes. I.e I don't understand why this fix fixes
> the issue (but it does).

Because it works on DTB and finds linux,phandle. This might be some bug
in dtschema, but anyway better to have a bit stricter patterns in bindings.


Best regards,
Krzysztof
Bjorn Andersson Sept. 13, 2022, 9:30 p.m. UTC | #4
On Sat, Sep 10, 2022 at 05:32:13PM +0300, Iskren Chernev wrote:
> Add initial support for OnePlus Nord N100, based on SM4250. Currently
> working:
> - boots
> - usb
> - buildin flash storage (UFS)
> - SD card reader
> 
> Signed-off-by: Iskren Chernev <iskren.chernev@gmail.com>
> ---
>  arch/arm64/boot/dts/qcom/Makefile             |   1 +
>  .../boot/dts/qcom/sm4250-oneplus-billie2.dts  | 241 ++++++++++++++++++
>  2 files changed, 242 insertions(+)
>  create mode 100644 arch/arm64/boot/dts/qcom/sm4250-oneplus-billie2.dts
> 
> diff --git a/arch/arm64/boot/dts/qcom/Makefile b/arch/arm64/boot/dts/qcom/Makefile
> index f4126f7e7640..5d2570b600e0 100644
> --- a/arch/arm64/boot/dts/qcom/Makefile
> +++ b/arch/arm64/boot/dts/qcom/Makefile
> @@ -137,6 +137,7 @@ dtb-$(CONFIG_ARCH_QCOM)	+= sdm845-xiaomi-polaris.dtb
>  dtb-$(CONFIG_ARCH_QCOM)	+= sdm845-shift-axolotl.dtb
>  dtb-$(CONFIG_ARCH_QCOM)	+= sdm850-lenovo-yoga-c630.dtb
>  dtb-$(CONFIG_ARCH_QCOM)	+= sdm850-samsung-w737.dtb
> +dtb-$(CONFIG_ARCH_QCOM)	+= sm4250-oneplus-billie2.dtb
>  dtb-$(CONFIG_ARCH_QCOM)	+= sm6125-sony-xperia-seine-pdx201.dtb
>  dtb-$(CONFIG_ARCH_QCOM)	+= sm6350-sony-xperia-lena-pdx213.dtb
>  dtb-$(CONFIG_ARCH_QCOM)	+= sm7225-fairphone-fp4.dtb
> diff --git a/arch/arm64/boot/dts/qcom/sm4250-oneplus-billie2.dts b/arch/arm64/boot/dts/qcom/sm4250-oneplus-billie2.dts
> new file mode 100644
> index 000000000000..b9094f1efca0
> --- /dev/null
> +++ b/arch/arm64/boot/dts/qcom/sm4250-oneplus-billie2.dts
> @@ -0,0 +1,241 @@
> +// SPDX-License-Identifier: GPL-2.0-only

Would it be possible for you to dual license this?

> +/*
> + * Copyright (c) 2021, Iskren Chernev <iskren.chernev@gmail.com>
> + */
> +
> +/dts-v1/;
> +
> +#include "sm4250.dtsi"
> +
> +/ {
> +	model = "OnePlus Nord N100";
> +	compatible = "oneplus,billie2", "qcom,sm4250";
> +
> +	/* required for bootloader to select correct board */
> +	qcom,msm-id = <0x1a1 0x10000 0x1bc 0x10000>;
> +	qcom,board-id = <0x1000b 0x00>;
> +
> +	aliases {
> +	};
> +
> +	chosen {
> +		#address-cells = <2>;
> +		#size-cells = <2>;
> +		ranges;
> +
> +		stdout-path = "framebuffer0";
> +
> +		framebuffer0: framebuffer@9d400000 {
> +			compatible = "simple-framebuffer";
> +			reg = <0 0x5c000000 0 (1600 * 720 * 4)>;
> +			width = <720>;
> +			height = <1600>;
> +			stride = <(720 * 4)>;
> +			format = "a8r8g8b8";
> +		};
> +	};
> +};
> +
> +&xo_board {
> +	clock-frequency = <19200000>;
> +};
> +
> +&sleep_clk {
> +	clock-frequency = <32764>;
> +};
> +
> +&reserved_memory {

As the number of nodes grow it would be nice if these were sorted
alphabetically.

> +	bootloader_log_mem: memory@5fff7000 {
> +		reg = <0x00 0x5fff7000 0x00 0x8000>;
> +		no-map;
> +	};
> +
> +	ramoops@cbe00000 {
> +		compatible = "ramoops";
> +		reg = <0x0 0xcbe00000 0x0 0x400000>;
> +		record-size = <0x40000>;
> +		pmsg-size = <0x200000>;
> +		console-size = <0x40000>;
> +		ftrace-size = <0x40000>;
> +	};
> +
> +	param_mem: memory@cc200000 {
> +		reg = <0x00 0xcc200000 0x00 0x100000>;
> +		no-map;
> +	};
> +
> +	mtp_mem: memory@cc300000 {
> +		reg = <0x00 0xcc300000 0x00 0xb00000>;
> +		no-map;
> +	};
> +};
> +
> +&usb3 {
> +	status = "okay";
> +};
[..]
> +&rpm_requests {
> +	regulators-0 {

Is there a reason why you don't call this node pm6125-regulators ?

> +		compatible = "qcom,rpm-pm6125-regulators";
> +
> +		vreg_s6a: s6 {
> +			regulator-min-microvolt = <320000>;
> +			regulator-max-microvolt = <1456000>;
> +		};
[..]
> +		vreg_l24a: l24 {
> +			regulator-min-microvolt = <2704000>;
> +			regulator-max-microvolt = <3544000>;
> +		};

Just as a heads up, by not ensuring that your regulators are in
high-power-mode you risk seeing brown-outs - something we keep running
into for e.g. SD-cards.

Regards,
Bjorn

> +	};
> +};
> -- 
> 2.37.2
>
Bjorn Andersson Sept. 13, 2022, 9:38 p.m. UTC | #5
On Sat, Sep 10, 2022 at 05:32:11PM +0300, Iskren Chernev wrote:
[..]
> diff --git a/arch/arm64/boot/dts/qcom/sm6115.dtsi b/arch/arm64/boot/dts/qcom/sm6115.dtsi
[..]
> +
> +	smem {
> +		compatible = "qcom,smem";

Please move the compatible, qcom,rpm-msg-ram and hwlocks into the
&smem_mem node.

> +		memory-region = <&smem_mem>;
> +		qcom,rpm-msg-ram = <&rpm_msg_ram>;
> +		hwlocks = <&tcsr_mutex 3>;
> +	};
> +
> +	soc: soc {

I expect that you should be told that you're missing a @0 on your soc.

> +		compatible = "simple-bus";
> +		#address-cells = <1>;
> +		#size-cells = <1>;
> +		ranges = <0 0 0 0xffffffff>;
> +
> +		tlmm: pinctrl@500000 {

Please sort your nodes based on address, followed by node name
alphabetically, followed by label.

> +			compatible = "qcom,sm6115-tlmm";
> +			reg = <0x500000 0x400000>, <0x900000 0x400000>, <0xd00000 0x400000>;

Please pad your address to 8 digits, to make it faster to see if the
sort order makes sense.

> +			reg-names = "west", "south", "east";
> +			interrupts = <GIC_SPI 227 IRQ_TYPE_LEVEL_HIGH>;
> +			gpio-controller;
> +			gpio-ranges = <&tlmm 0 0 121>;
> +			#gpio-cells = <2>;
> +			interrupt-controller;
> +			#interrupt-cells = <2>;
> +
[..]
> +	};
> +
> +	timer {
> +		compatible = "arm,armv8-timer";
> +		interrupts = <GIC_PPI 1 0xf08>,
> +			     <GIC_PPI 2 0xf08>,
> +			     <GIC_PPI 3 0xf08>,
> +			     <GIC_PPI 0 0xf08>;

Please use (GIC_CPU_MASK_SIMPLE(8) | IRQ_TYPE_LEVEL_LOW) for your flags.

Regards,
Bjorn
Ulf Hansson Sept. 14, 2022, 2 p.m. UTC | #6
On Sat, 10 Sept 2022 at 16:32, Iskren Chernev <iskren.chernev@gmail.com> wrote:
>
> Most mmc blocks contain two pinctrls, default and sleep. But then
> dt-schema complains about pinctrl-1 not being defined.
>
> Signed-off-by: Iskren Chernev <iskren.chernev@gmail.com>

Applied for next, thanks!

Kind regards
Uffe


> ---
>  Documentation/devicetree/bindings/mmc/sdhci-msm.yaml | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/mmc/sdhci-msm.yaml b/Documentation/devicetree/bindings/mmc/sdhci-msm.yaml
> index a792fa5574a0..775476d7f9f0 100644
> --- a/Documentation/devicetree/bindings/mmc/sdhci-msm.yaml
> +++ b/Documentation/devicetree/bindings/mmc/sdhci-msm.yaml
> @@ -97,6 +97,10 @@ properties:
>      description:
>        Should specify pin control groups used for this controller.
>
> +  pinctrl-1:
> +    description:
> +      Should specify sleep pin control groups used for this controller.
> +
>    resets:
>      maxItems: 1
>
> --
> 2.37.2
>
Krzysztof Kozlowski Sept. 15, 2022, 2:37 p.m. UTC | #7
On 13/09/2022 22:30, Bjorn Andersson wrote:
> On Sat, Sep 10, 2022 at 05:32:13PM +0300, Iskren Chernev wrote:
>> Add initial support for OnePlus Nord N100, based on SM4250. Currently
>> working:
>> - boots
>> - usb
>> - buildin flash storage (UFS)
>> - SD card reader
>>
>> Signed-off-by: Iskren Chernev <iskren.chernev@gmail.com>
>> ---
>>  arch/arm64/boot/dts/qcom/Makefile             |   1 +
>>  .../boot/dts/qcom/sm4250-oneplus-billie2.dts  | 241 ++++++++++++++++++
>>  2 files changed, 242 insertions(+)
>>  create mode 100644 arch/arm64/boot/dts/qcom/sm4250-oneplus-billie2.dts
>>
>> diff --git a/arch/arm64/boot/dts/qcom/Makefile b/arch/arm64/boot/dts/qcom/Makefile
>> index f4126f7e7640..5d2570b600e0 100644
>> --- a/arch/arm64/boot/dts/qcom/Makefile
>> +++ b/arch/arm64/boot/dts/qcom/Makefile
>> @@ -137,6 +137,7 @@ dtb-$(CONFIG_ARCH_QCOM)	+= sdm845-xiaomi-polaris.dtb
>>  dtb-$(CONFIG_ARCH_QCOM)	+= sdm845-shift-axolotl.dtb
>>  dtb-$(CONFIG_ARCH_QCOM)	+= sdm850-lenovo-yoga-c630.dtb
>>  dtb-$(CONFIG_ARCH_QCOM)	+= sdm850-samsung-w737.dtb
>> +dtb-$(CONFIG_ARCH_QCOM)	+= sm4250-oneplus-billie2.dtb
>>  dtb-$(CONFIG_ARCH_QCOM)	+= sm6125-sony-xperia-seine-pdx201.dtb
>>  dtb-$(CONFIG_ARCH_QCOM)	+= sm6350-sony-xperia-lena-pdx213.dtb
>>  dtb-$(CONFIG_ARCH_QCOM)	+= sm7225-fairphone-fp4.dtb
>> diff --git a/arch/arm64/boot/dts/qcom/sm4250-oneplus-billie2.dts b/arch/arm64/boot/dts/qcom/sm4250-oneplus-billie2.dts
>> new file mode 100644
>> index 000000000000..b9094f1efca0
>> --- /dev/null
>> +++ b/arch/arm64/boot/dts/qcom/sm4250-oneplus-billie2.dts
>> @@ -0,0 +1,241 @@
>> +// SPDX-License-Identifier: GPL-2.0-only
> 
> Would it be possible for you to dual license this?
> 
>> +/*
>> + * Copyright (c) 2021, Iskren Chernev <iskren.chernev@gmail.com>
>> + */
>> +
>> +/dts-v1/;
>> +
>> +#include "sm4250.dtsi"
>> +
>> +/ {
>> +	model = "OnePlus Nord N100";
>> +	compatible = "oneplus,billie2", "qcom,sm4250";
>> +
>> +	/* required for bootloader to select correct board */
>> +	qcom,msm-id = <0x1a1 0x10000 0x1bc 0x10000>;
>> +	qcom,board-id = <0x1000b 0x00>;
>> +
>> +	aliases {
>> +	};
>> +
>> +	chosen {
>> +		#address-cells = <2>;
>> +		#size-cells = <2>;
>> +		ranges;
>> +
>> +		stdout-path = "framebuffer0";
>> +
>> +		framebuffer0: framebuffer@9d400000 {
>> +			compatible = "simple-framebuffer";
>> +			reg = <0 0x5c000000 0 (1600 * 720 * 4)>;
>> +			width = <720>;
>> +			height = <1600>;
>> +			stride = <(720 * 4)>;
>> +			format = "a8r8g8b8";
>> +		};
>> +	};
>> +};
>> +
>> +&xo_board {
>> +	clock-frequency = <19200000>;
>> +};
>> +
>> +&sleep_clk {
>> +	clock-frequency = <32764>;
>> +};
>> +
>> +&reserved_memory {
> 
> As the number of nodes grow it would be nice if these were sorted
> alphabetically.
> 
>> +	bootloader_log_mem: memory@5fff7000 {
>> +		reg = <0x00 0x5fff7000 0x00 0x8000>;
>> +		no-map;
>> +	};
>> +
>> +	ramoops@cbe00000 {
>> +		compatible = "ramoops";
>> +		reg = <0x0 0xcbe00000 0x0 0x400000>;
>> +		record-size = <0x40000>;
>> +		pmsg-size = <0x200000>;
>> +		console-size = <0x40000>;
>> +		ftrace-size = <0x40000>;
>> +	};
>> +
>> +	param_mem: memory@cc200000 {
>> +		reg = <0x00 0xcc200000 0x00 0x100000>;
>> +		no-map;
>> +	};
>> +
>> +	mtp_mem: memory@cc300000 {
>> +		reg = <0x00 0xcc300000 0x00 0xb00000>;
>> +		no-map;
>> +	};
>> +};
>> +
>> +&usb3 {
>> +	status = "okay";
>> +};
> [..]
>> +&rpm_requests {
>> +	regulators-0 {
> 
> Is there a reason why you don't call this node pm6125-regulators ?

It's the follow up of:
https://lore.kernel.org/all/20220901093243.134288-1-krzysztof.kozlowski@linaro.org/

Node names should be rather generic, so just regulators.


Best regards,
Krzysztof