2023-02-01 09:06:22

by Poovendhan Selvaraj

[permalink] [raw]
Subject: [PATCH V2 0/5] Enable crashdump collection support for IPQ9574

Crashdump collection is enabled based on the DLOAD bit in the TCSR register.
This bit is set during bootup and cleared during shutdown. During crash,
dload bit is not cleared, due to which uboot starts crashdump collection.

This patch series adds the support for crashdump collection.

This series depends on the below patch set.
https://lore.kernel.org/linux-arm-msm/[email protected]/

Changes in V2:
- rebased on linux-next/master
- dropped co-developed by tag wherever applicable
- V1 can be found at
https://lore.kernel.org/linux-arm-kernel/[email protected]/

Poovendhan Selvaraj (5):
dt-bindings: scm: Add compatible for IPQ9574
arm64: dts: Add support for Crashdump collection on IPQ9574
firmware: scm: Modify only the DLOAD bit in TCSR register for download
mode
arm64: defconfig: Enable scm download mode config for IPQ9574 SoC.
dt-bindings: tcsr: Add compatible for IPQ9574

.../bindings/firmware/qcom,scm.yaml | 1 +
.../devicetree/bindings/mfd/qcom,tcsr.yaml | 1 +
arch/arm64/boot/dts/qcom/ipq9574.dtsi | 26 ++++++++++++++++++-
arch/arm64/configs/defconfig | 1 +
drivers/firmware/qcom_scm.c | 12 ++++++---
5 files changed, 36 insertions(+), 5 deletions(-)


base-commit: 80bd9028fecadae4e8e3a278cd32d74badc2a6e0
--
2.17.1



2023-02-01 09:06:37

by Poovendhan Selvaraj

[permalink] [raw]
Subject: [PATCH V2 1/5] dt-bindings: scm: Add compatible for IPQ9574

Add the scm compatible string for IPQ9574 SoC

Co-developed-by: Anusha Rao <[email protected]>
Signed-off-by: Anusha Rao <[email protected]>
Co-developed-by: Kathiravan Thirumoorthy <[email protected]>
Signed-off-by: Kathiravan Thirumoorthy <[email protected]>
Signed-off-by: Poovendhan Selvaraj <[email protected]>
---
Documentation/devicetree/bindings/firmware/qcom,scm.yaml | 1 +
1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/firmware/qcom,scm.yaml b/Documentation/devicetree/bindings/firmware/qcom,scm.yaml
index 4193492ba73e..82120b98af56 100644
--- a/Documentation/devicetree/bindings/firmware/qcom,scm.yaml
+++ b/Documentation/devicetree/bindings/firmware/qcom,scm.yaml
@@ -27,6 +27,7 @@ properties:
- qcom,scm-ipq6018
- qcom,scm-ipq806x
- qcom,scm-ipq8074
+ - qcom,scm-ipq9574
- qcom,scm-mdm9607
- qcom,scm-msm8226
- qcom,scm-msm8660
--
2.17.1


2023-02-01 09:06:55

by Poovendhan Selvaraj

[permalink] [raw]
Subject: [PATCH V2 2/5] arm64: dts: Add support for Crashdump collection on IPQ9574

Enable Crashdump collection in ipq9574

Co-developed-by: Anusha Rao <[email protected]>
Signed-off-by: Anusha Rao <[email protected]>
Co-developed-by: Kathiravan Thirumoorthy <[email protected]>
Signed-off-by: Kathiravan Thirumoorthy <[email protected]>
Signed-off-by: Poovendhan Selvaraj <[email protected]>
---
arch/arm64/boot/dts/qcom/ipq9574.dtsi | 26 +++++++++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/qcom/ipq9574.dtsi b/arch/arm64/boot/dts/qcom/ipq9574.dtsi
index a425b1865129..3b615acedfd5 100644
--- a/arch/arm64/boot/dts/qcom/ipq9574.dtsi
+++ b/arch/arm64/boot/dts/qcom/ipq9574.dtsi
@@ -81,6 +81,13 @@
reg = <0x0 0x40000000 0x0 0x0>;
};

+ firmware {
+ scm {
+ compatible = "qcom,scm-ipq9574", "qcom,scm";
+ qcom,dload-mode = <&tcsr_boot_misc 0>;
+ };
+ };
+
pmu {
compatible = "arm,cortex-a73-pmu";
interrupts = <GIC_PPI 7 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>;
@@ -95,11 +102,17 @@
#address-cells = <2>;
#size-cells = <2>;
ranges;
-
tz_region: tz@4a600000 {
reg = <0x0 0x4a600000 0x0 0x400000>;
no-map;
};
+
+ smem@4aa00000 {
+ compatible = "qcom,smem";
+ reg = <0x0 0x4aa00000 0x0 0x00100000>;
+ hwlocks = <&tcsr_mutex 0>;
+ no-map;
+ };
};

soc: soc@0 {
@@ -150,6 +163,17 @@
#power-domain-cells = <1>;
};

+ tcsr_mutex: hwlock@1905000 {
+ compatible = "qcom,tcsr-mutex";
+ reg = <0x01905000 0x8000>;
+ #hwlock-cells = <1>;
+ };
+
+ tcsr_boot_misc: syscon@193d100 {
+ ompatible = "qcom,tcsr-ipq9574", "syscon";
+ reg = <0x0193d100 0x4>;
+ };
+
sdhc_1: mmc@7804000 {
compatible = "qcom,ipq9574-sdhci", "qcom,sdhci-msm-v5";
reg = <0x07804000 0x1000>, <0x07805000 0x1000>;
--
2.17.1


2023-02-01 09:07:38

by Poovendhan Selvaraj

[permalink] [raw]
Subject: [PATCH V2 3/5] firmware: scm: Modify only the DLOAD bit in TCSR register for download mode

Add support to read-modify-write TCSR register to modify only DLOAD bit.

Co-developed-by: Anusha Rao <[email protected]>
Signed-off-by: Anusha Rao <[email protected]>
Co-developed-by: Kathiravan Thirumoorthy <[email protected]>
Signed-off-by: Kathiravan Thirumoorthy <[email protected]>
Signed-off-by: Poovendhan Selvaraj <[email protected]>
---
drivers/firmware/qcom_scm.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/firmware/qcom_scm.c b/drivers/firmware/qcom_scm.c
index 2000323722bf..e3435587a72d 100644
--- a/drivers/firmware/qcom_scm.c
+++ b/drivers/firmware/qcom_scm.c
@@ -407,7 +407,7 @@ int qcom_scm_set_remote_state(u32 state, u32 id)
}
EXPORT_SYMBOL(qcom_scm_set_remote_state);

-static int __qcom_scm_set_dload_mode(struct device *dev, bool enable)
+static int __qcom_scm_set_dload_mode(struct device *dev, u32 val, bool enable)
{
struct qcom_scm_desc desc = {
.svc = QCOM_SCM_SVC_BOOT,
@@ -417,7 +417,7 @@ static int __qcom_scm_set_dload_mode(struct device *dev, bool enable)
.owner = ARM_SMCCC_OWNER_SIP,
};

- desc.args[1] = enable ? QCOM_SCM_BOOT_SET_DLOAD_MODE : 0;
+ desc.args[1] = enable ? val | QCOM_SCM_BOOT_SET_DLOAD_MODE : 0;

return qcom_scm_call_atomic(__scm->dev, &desc, NULL);
}
@@ -426,15 +426,19 @@ static void qcom_scm_set_download_mode(bool enable)
{
bool avail;
int ret = 0;
+ u32 dload_addr_val;

avail = __qcom_scm_is_call_available(__scm->dev,
QCOM_SCM_SVC_BOOT,
QCOM_SCM_BOOT_SET_DLOAD_MODE);
+ ret = qcom_scm_io_readl(__scm->dload_mode_addr, &dload_addr_val);
+
if (avail) {
- ret = __qcom_scm_set_dload_mode(__scm->dev, enable);
+ ret = __qcom_scm_set_dload_mode(__scm->dev, dload_addr_val, enable);
} else if (__scm->dload_mode_addr) {
ret = qcom_scm_io_writel(__scm->dload_mode_addr,
- enable ? QCOM_SCM_BOOT_SET_DLOAD_MODE : 0);
+ enable ? dload_addr_val |
+ QCOM_SCM_BOOT_SET_DLOAD_MODE : 0);
} else {
dev_err(__scm->dev,
"No available mechanism for setting download mode\n");
--
2.17.1


2023-02-01 09:07:52

by Poovendhan Selvaraj

[permalink] [raw]
Subject: [PATCH V2 4/5] arm64: defconfig: Enable scm download mode config for IPQ9574 SoC.

Enables scm download mode config.

Signed-off-by: Poovendhan Selvaraj <[email protected]>
---
arch/arm64/configs/defconfig | 1 +
1 file changed, 1 insertion(+)

diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
index 5d6a54deef02..eb2709af1d11 100644
--- a/arch/arm64/configs/defconfig
+++ b/arch/arm64/configs/defconfig
@@ -256,6 +256,7 @@ CONFIG_ARM_SCPI_PROTOCOL=y
CONFIG_RASPBERRYPI_FIRMWARE=y
CONFIG_INTEL_STRATIX10_SERVICE=y
CONFIG_INTEL_STRATIX10_RSU=m
+CONFIG_QCOM_SCM_DOWNLOAD_MODE_DEFAULT=y
CONFIG_EFI_CAPSULE_LOADER=y
CONFIG_IMX_SCU=y
CONFIG_IMX_SCU_PD=y
--
2.17.1


2023-02-01 09:07:57

by Poovendhan Selvaraj

[permalink] [raw]
Subject: [PATCH V2 5/5] dt-bindings: tcsr: Add compatible for IPQ9574

Add the tcsr compatible string for IPQ9574 SoC

Signed-off-by: Poovendhan Selvaraj <[email protected]>
---
Documentation/devicetree/bindings/mfd/qcom,tcsr.yaml | 1 +
1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/mfd/qcom,tcsr.yaml b/Documentation/devicetree/bindings/mfd/qcom,tcsr.yaml
index d463fb47278f..8cd0005fc8c7 100644
--- a/Documentation/devicetree/bindings/mfd/qcom,tcsr.yaml
+++ b/Documentation/devicetree/bindings/mfd/qcom,tcsr.yaml
@@ -30,6 +30,7 @@ properties:
- qcom,tcsr-apq8084
- qcom,tcsr-ipq6018
- qcom,tcsr-ipq8064
+ - qcom,tcsr-ipq9574
- qcom,tcsr-mdm9615
- qcom,tcsr-msm8226
- qcom,tcsr-msm8660
--
2.17.1


2023-02-01 09:29:33

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH V2 1/5] dt-bindings: scm: Add compatible for IPQ9574

On 01/02/2023 10:05, Poovendhan Selvaraj wrote:
> Add the scm compatible string for IPQ9574 SoC
>
> Co-developed-by: Anusha Rao <[email protected]>
> Signed-off-by: Anusha Rao <[email protected]>
> Co-developed-by: Kathiravan Thirumoorthy <[email protected]>
> Signed-off-by: Kathiravan Thirumoorthy <[email protected]>
> Signed-off-by: Poovendhan Selvaraj <[email protected]>

I don't think this improved. This patch adds one line with one value -
one new compatible. Are you sure that three people were working on
exactly that line and that compatible? Especially that it is essentially
copy-paste of other compatibles so there is nothing to work on here?

Best regards,
Krzysztof


2023-02-01 09:30:56

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH V2 4/5] arm64: defconfig: Enable scm download mode config for IPQ9574 SoC.

On 01/02/2023 10:05, Poovendhan Selvaraj wrote:
> Enables scm download mode config.

Subject: drop full stop.

This patch misses explanation why it is needed and why it should be
enabled for all SoCs.

>
> Signed-off-by: Poovendhan Selvaraj <[email protected]>
> ---

Best regards,
Krzysztof


2023-02-01 09:31:08

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH V2 5/5] dt-bindings: tcsr: Add compatible for IPQ9574

On 01/02/2023 10:05, Poovendhan Selvaraj wrote:
> Add the tcsr compatible string for IPQ9574 SoC
>
> Signed-off-by: Poovendhan Selvaraj <[email protected]>
> ---


Acked-by: Krzysztof Kozlowski <[email protected]>

Best regards,
Krzysztof


2023-02-01 10:07:08

by Lee Jones

[permalink] [raw]
Subject: Re: [PATCH V2 5/5] dt-bindings: tcsr: Add compatible for IPQ9574

On Wed, 01 Feb 2023, Poovendhan Selvaraj wrote:

> Add the tcsr compatible string for IPQ9574 SoC
>
> Signed-off-by: Poovendhan Selvaraj <[email protected]>
> ---
> Documentation/devicetree/bindings/mfd/qcom,tcsr.yaml | 1 +
> 1 file changed, 1 insertion(+)

Nit: Subject should be "dt-bindings: mfd: ..."

> diff --git a/Documentation/devicetree/bindings/mfd/qcom,tcsr.yaml b/Documentation/devicetree/bindings/mfd/qcom,tcsr.yaml
> index d463fb47278f..8cd0005fc8c7 100644
> --- a/Documentation/devicetree/bindings/mfd/qcom,tcsr.yaml
> +++ b/Documentation/devicetree/bindings/mfd/qcom,tcsr.yaml
> @@ -30,6 +30,7 @@ properties:
> - qcom,tcsr-apq8084
> - qcom,tcsr-ipq6018
> - qcom,tcsr-ipq8064
> + - qcom,tcsr-ipq9574
> - qcom,tcsr-mdm9615
> - qcom,tcsr-msm8226
> - qcom,tcsr-msm8660
> --
> 2.17.1
>

--
Lee Jones [李琼斯]

2023-02-01 11:12:15

by Poovendhan Selvaraj

[permalink] [raw]
Subject: Re: [PATCH V2 5/5] dt-bindings: tcsr: Add compatible for IPQ9574


On 2/1/2023 3:36 PM, Lee Jones wrote:
> On Wed, 01 Feb 2023, Poovendhan Selvaraj wrote:
>
>> Add the tcsr compatible string for IPQ9574 SoC
>>
>> Signed-off-by: Poovendhan Selvaraj <[email protected]>
>> ---
>> Documentation/devicetree/bindings/mfd/qcom,tcsr.yaml | 1 +
>> 1 file changed, 1 insertion(+)
> Nit: Subject should be "dt-bindings: mfd: ..."
Sure, Okay.

Regards,
Poovendhan S

>> diff --git a/Documentation/devicetree/bindings/mfd/qcom,tcsr.yaml b/Documentation/devicetree/bindings/mfd/qcom,tcsr.yaml
>> index d463fb47278f..8cd0005fc8c7 100644
>> --- a/Documentation/devicetree/bindings/mfd/qcom,tcsr.yaml
>> +++ b/Documentation/devicetree/bindings/mfd/qcom,tcsr.yaml
>> @@ -30,6 +30,7 @@ properties:
>> - qcom,tcsr-apq8084
>> - qcom,tcsr-ipq6018
>> - qcom,tcsr-ipq8064
>> + - qcom,tcsr-ipq9574
>> - qcom,tcsr-mdm9615
>> - qcom,tcsr-msm8226
>> - qcom,tcsr-msm8660
>> --
>> 2.17.1
>>

2023-02-01 11:16:33

by Poovendhan Selvaraj

[permalink] [raw]
Subject: Re: [PATCH V2 1/5] dt-bindings: scm: Add compatible for IPQ9574


On 2/1/2023 2:59 PM, Krzysztof Kozlowski wrote:
> On 01/02/2023 10:05, Poovendhan Selvaraj wrote:
>> Add the scm compatible string for IPQ9574 SoC
>>
>> Co-developed-by: Anusha Rao <[email protected]>
>> Signed-off-by: Anusha Rao <[email protected]>
>> Co-developed-by: Kathiravan Thirumoorthy <[email protected]>
>> Signed-off-by: Kathiravan Thirumoorthy <[email protected]>
>> Signed-off-by: Poovendhan Selvaraj <[email protected]>
> I don't think this improved. This patch adds one line with one value -
> one new compatible. Are you sure that three people were working on
> exactly that line and that compatible? Especially that it is essentially
> copy-paste of other compatibles so there is nothing to work on here?
Sorry, missed it here. Will address in V3.

Regards,
Poovendhan S
> Best regards,
> Krzysztof
>

2023-02-01 12:01:50

by Srinivas Kandagatla

[permalink] [raw]
Subject: Re: [PATCH V2 3/5] firmware: scm: Modify only the DLOAD bit in TCSR register for download mode



On 01/02/2023 09:05, Poovendhan Selvaraj wrote:
> Add support to read-modify-write TCSR register to modify only DLOAD bit.
>
> Co-developed-by: Anusha Rao <[email protected]>
> Signed-off-by: Anusha Rao <[email protected]>
> Co-developed-by: Kathiravan Thirumoorthy <[email protected]>
> Signed-off-by: Kathiravan Thirumoorthy <[email protected]>
> Signed-off-by: Poovendhan Selvaraj <[email protected]>
> ---
> drivers/firmware/qcom_scm.c | 12 ++++++++----
> 1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/firmware/qcom_scm.c b/drivers/firmware/qcom_scm.c
> index 2000323722bf..e3435587a72d 100644
> --- a/drivers/firmware/qcom_scm.c
> +++ b/drivers/firmware/qcom_scm.c
> @@ -407,7 +407,7 @@ int qcom_scm_set_remote_state(u32 state, u32 id)
> }
> EXPORT_SYMBOL(qcom_scm_set_remote_state);
>
> -static int __qcom_scm_set_dload_mode(struct device *dev, bool enable)
> +static int __qcom_scm_set_dload_mode(struct device *dev, u32 val, bool enable)
> {
> struct qcom_scm_desc desc = {
> .svc = QCOM_SCM_SVC_BOOT,
> @@ -417,7 +417,7 @@ static int __qcom_scm_set_dload_mode(struct device *dev, bool enable)
> .owner = ARM_SMCCC_OWNER_SIP,
> };
>
> - desc.args[1] = enable ? QCOM_SCM_BOOT_SET_DLOAD_MODE : 0;
> + desc.args[1] = enable ? val | QCOM_SCM_BOOT_SET_DLOAD_MODE : 0;


It is not read-modify-write when enable == false, its just writing 0.

Is this intentional?


>
> return qcom_scm_call_atomic(__scm->dev, &desc, NULL);
> }
> @@ -426,15 +426,19 @@ static void qcom_scm_set_download_mode(bool enable)
> {
> bool avail;
> int ret = 0;
> + u32 dload_addr_val;
>
> avail = __qcom_scm_is_call_available(__scm->dev,
> QCOM_SCM_SVC_BOOT,
> QCOM_SCM_BOOT_SET_DLOAD_MODE);
> + ret = qcom_scm_io_readl(__scm->dload_mode_addr, &dload_addr_val);
> +
> if (avail) {
> - ret = __qcom_scm_set_dload_mode(__scm->dev, enable);
> + ret = __qcom_scm_set_dload_mode(__scm->dev, dload_addr_val, enable);
> } else if (__scm->dload_mode_addr) {
> ret = qcom_scm_io_writel(__scm->dload_mode_addr,
> - enable ? QCOM_SCM_BOOT_SET_DLOAD_MODE : 0);
> + enable ? dload_addr_val |
> + QCOM_SCM_BOOT_SET_DLOAD_MODE : 0);

same here.


--srini

> } else {
> dev_err(__scm->dev,
> "No available mechanism for setting download mode\n");

2023-02-06 05:07:36

by Poovendhan Selvaraj

[permalink] [raw]
Subject: Re: [PATCH V2 4/5] arm64: defconfig: Enable scm download mode config for IPQ9574 SoC.


On 2/1/2023 3:00 PM, Krzysztof Kozlowski wrote:
> On 01/02/2023 10:05, Poovendhan Selvaraj wrote:
>> Enables scm download mode config.
> Subject: drop full stop.
>
> This patch misses explanation why it is needed and why it should be
> enabled for all SoCs.

Sure, will address this in next patch series.

Regards,
Poovendhan S

>
>> Signed-off-by: Poovendhan Selvaraj <[email protected]>
>> ---
> Best regards,
> Krzysztof
>