Update ADSP pil loader driver for SC7280 platforms.
Changes since V7:
-- Drop out of reset time out patch.
-- Remove redundant clocks in dt bindings.
-- Fix dt compilation error in dt bindings.
Changes since V6:
-- Update dt-bindings with glink-edge
-- Add qcom,qmp property.
-- Update parse firmware callback.
-- Update commit message.
-- Update smmu map and unmap function names.
-- Revert adsp_ops const change.
-- Move iommu check to within smmu map/unmap functions.
Changes since V5:
-- Remove adsp_rproc_unmap_smmu, adsp_of_unmap_smmu, adsp_of_map_smmu and
adsp_rproc_map_smmu functions.
-- Remove find_loaded_rsc_table call back initialization.
-- Rename adsp_sandbox_needed to has_iommu.
-- Update parse_fw callback in rproc ops.
-- Remove qcom,adsp-memory-regions property in dt-bindings.
-- Change adsp binary extension name.
Changes since V4:
-- Update halt registers description in dt bindings.
-- Update Memory sandboxing with proper APIs for resource
allocation and free.
Changes since V3:
-- Rename is_adsp_sb_needed to adsp_sandbox_needed.
-- Update sc7280 compatible name entry in sorted order.
-- Add smmu unmapping in error case and in adsp stop.
-- Revert converting sdm845 dt bindings to generic and
create new dt bindings for sc7280.
Changes since V2:
-- Generated patch with -M flag.
-- Add Clock property in dt bindings.
-- Add qcom,adsp-memory-regions property.
-- Add is_adsp_sb_needed flag instead of is_wpss.
-- Initialize is_adsp_sb_needed flag.
-- Remove empty proxy pds array.
-- Replace platform_bus_type with adsp->dev->bus.
-- Use API of_parse_phandle_with_args() instead of
of_parse_phandle_with_fixed_args().
-- Replace adsp->is_wpss with adsp->is_adsp.
-- Update error handling in adsp_start().
Changes since V1:
-- Change reg property maxItems to minItems and update description.
-- Fix typo errors.
Srinivasa Rao Mandadapu (7):
dt-bindings: remoteproc: qcom: Add SC7280 ADSP support
remoteproc: qcom: Add flag in adsp private data structure
remoteproc: qcom: Add compatible name for SC7280 ADSP
remoteproc: qcom: Update rproc parse firmware callback
remoteproc: qcom: Replace hard coded values with macros
remoteproc: qcom: Add efuse evb selection control
remoteproc: qcom: Add support for memory sandbox
.../bindings/remoteproc/qcom,sc7280-adsp-pil.yaml | 207 +++++++++++++++++++++
drivers/remoteproc/qcom_q6v5_adsp.c | 124 +++++++++++-
2 files changed, 327 insertions(+), 4 deletions(-)
create mode 100644 Documentation/devicetree/bindings/remoteproc/qcom,sc7280-adsp-pil.yaml
--
2.7.4
Update adsp pil data and compatible name for loading ADSP
binary on SC7280 based platforms.
Signed-off-by: Srinivasa Rao Mandadapu <[email protected]>
Reviewed-by: Stephen Boyd <[email protected]>
---
Changes since V5:
-- Rename adsp_sandbox_needed to has_iommu.
-- Change adsp binary extension name.
Changes since V3:
-- Rename is_adsp_sb_needed to adsp_sandbox_needed.
-- Update sc7280 compatible name entry in sorted order.
Changes since V2:
-- Initialize is_adsp_sb_needed flag.
-- Remove empty proxy pds array.
drivers/remoteproc/qcom_q6v5_adsp.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/drivers/remoteproc/qcom_q6v5_adsp.c b/drivers/remoteproc/qcom_q6v5_adsp.c
index fa2ccac..02d17b4 100644
--- a/drivers/remoteproc/qcom_q6v5_adsp.c
+++ b/drivers/remoteproc/qcom_q6v5_adsp.c
@@ -702,6 +702,21 @@ static const struct adsp_pil_data adsp_resource_init = {
},
};
+static const struct adsp_pil_data adsp_sc7280_resource_init = {
+ .crash_reason_smem = 423,
+ .firmware_name = "adsp.pbn",
+ .load_state = "adsp",
+ .ssr_name = "lpass",
+ .sysmon_name = "adsp",
+ .ssctl_id = 0x14,
+ .has_iommu = true,
+ .auto_boot = true,
+ .clk_ids = (const char*[]) {
+ "gcc_cfg_noc_lpass", NULL
+ },
+ .num_clks = 1,
+};
+
static const struct adsp_pil_data cdsp_resource_init = {
.crash_reason_smem = 601,
.firmware_name = "cdsp.mdt",
@@ -740,6 +755,7 @@ static const struct adsp_pil_data wpss_resource_init = {
static const struct of_device_id adsp_of_match[] = {
{ .compatible = "qcom,qcs404-cdsp-pil", .data = &cdsp_resource_init },
+ { .compatible = "qcom,sc7280-adsp-pil", .data = &adsp_sc7280_resource_init },
{ .compatible = "qcom,sc7280-wpss-pil", .data = &wpss_resource_init },
{ .compatible = "qcom,sdm845-adsp-pil", .data = &adsp_resource_init },
{ },
--
2.7.4
Add efuse evb selection control and enable it for starting ADSP.
Signed-off-by: Srinivasa Rao Mandadapu <[email protected]>
Reviewed-by: Stephen Boyd <[email protected]>
Reviewed-by: Sibi Sankar <[email protected]>
---
Changes since V5:
-- Split devm_platform_ioremap_resource_byname function.
drivers/remoteproc/qcom_q6v5_adsp.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/drivers/remoteproc/qcom_q6v5_adsp.c b/drivers/remoteproc/qcom_q6v5_adsp.c
index 80c8169..e463fbc 100644
--- a/drivers/remoteproc/qcom_q6v5_adsp.c
+++ b/drivers/remoteproc/qcom_q6v5_adsp.c
@@ -56,6 +56,7 @@
#define LPASS_BOOT_CORE_START BIT(0)
#define LPASS_BOOT_CMD_START BIT(0)
+#define LPASS_EFUSE_Q6SS_EVB_SEL 0x0
struct adsp_pil_data {
int crash_reason_smem;
@@ -86,6 +87,7 @@ struct qcom_adsp {
struct clk_bulk_data *clks;
void __iomem *qdsp6ss_base;
+ void __iomem *lpass_efuse;
struct reset_control *pdc_sync_reset;
struct reset_control *restart;
@@ -368,6 +370,9 @@ static int adsp_start(struct rproc *rproc)
/* Program boot address */
writel(adsp->mem_phys >> 4, adsp->qdsp6ss_base + RST_EVB_REG);
+ if (adsp->lpass_efuse)
+ writel(LPASS_EFUSE_Q6SS_EVB_SEL, adsp->lpass_efuse);
+
/* De-assert QDSP6 stop core. QDSP6 will execute after out of reset */
writel(LPASS_BOOT_CORE_START, adsp->qdsp6ss_base + CORE_START_REG);
@@ -534,6 +539,7 @@ static int adsp_init_reset(struct qcom_adsp *adsp)
static int adsp_init_mmio(struct qcom_adsp *adsp,
struct platform_device *pdev)
{
+ struct resource *efuse_region;
struct device_node *syscon;
int ret;
@@ -543,6 +549,17 @@ static int adsp_init_mmio(struct qcom_adsp *adsp,
return PTR_ERR(adsp->qdsp6ss_base);
}
+ efuse_region = platform_get_resource(pdev, IORESOURCE_MEM, 1);
+ if (!efuse_region) {
+ adsp->lpass_efuse = NULL;
+ dev_dbg(adsp->dev, "failed to get efuse memory region\n");
+ } else {
+ adsp->lpass_efuse = devm_ioremap_resource(&pdev->dev, efuse_region);
+ if (IS_ERR(adsp->lpass_efuse)) {
+ dev_err(adsp->dev, "failed to map efuse registers\n");
+ return PTR_ERR(adsp->lpass_efuse);
+ }
+ }
syscon = of_parse_phandle(pdev->dev.of_node, "qcom,halt-regs", 0);
if (!syscon) {
dev_err(&pdev->dev, "failed to parse qcom,halt-regs\n");
--
2.7.4
Change parse_fw callback in rproc ops from qcom_register_dump_segments
to local function such that, it can perform coredump segments registration
and it can parse section header in memory sandboxing required platforms.
Signed-off-by: Srinivasa Rao Mandadapu <[email protected]>
---
Changes since V6:
-- Update parse firmware callback.
drivers/remoteproc/qcom_q6v5_adsp.c | 23 ++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)
diff --git a/drivers/remoteproc/qcom_q6v5_adsp.c b/drivers/remoteproc/qcom_q6v5_adsp.c
index 02d17b4..9ea10b7 100644
--- a/drivers/remoteproc/qcom_q6v5_adsp.c
+++ b/drivers/remoteproc/qcom_q6v5_adsp.c
@@ -440,6 +440,27 @@ static void *adsp_da_to_va(struct rproc *rproc, u64 da, size_t len, bool *is_iom
return adsp->mem_region + offset;
}
+static int adsp_parse_firmware(struct rproc *rproc, const struct firmware *fw)
+{
+ struct qcom_adsp *adsp = rproc->priv;
+ int ret;
+
+ ret = qcom_register_dump_segments(rproc, fw);
+ if (ret) {
+ dev_err(&rproc->dev, "Error in registering dump segments\n");
+ return ret;
+ }
+
+ if (adsp->has_iommu) {
+ ret = rproc_elf_load_rsc_table(rproc, fw);
+ if (ret) {
+ dev_err(&rproc->dev, "Error in loading resource table\n");
+ return ret;
+ }
+ }
+ return 0;
+}
+
static unsigned long adsp_panic(struct rproc *rproc)
{
struct qcom_adsp *adsp = rproc->priv;
@@ -451,7 +472,7 @@ static const struct rproc_ops adsp_ops = {
.start = adsp_start,
.stop = adsp_stop,
.da_to_va = adsp_da_to_va,
- .parse_fw = qcom_register_dump_segments,
+ .parse_fw = adsp_parse_firmware,
.load = adsp_load,
.panic = adsp_panic,
};
--
2.7.4
Add flag in qcom_adsp private data structure and initialize
it to distinguish ADSP modules, which has iommu requirement,
for using iommu selectively.
Signed-off-by: Srinivasa Rao Mandadapu <[email protected]>
Reviewed-by: Stephen Boyd <[email protected]>
Reviewed-by: Sibi Sankar <[email protected]>
---
Changes since V6:
-- Update commit message.
Changes since V5:
-- Rename adsp_sandbox_needed to has_iommu.
Changes since V3:
-- Rename is_adsp_sb_needed to adsp_sandbox_needed.
Changes since V2:
-- Add is_adsp_sb_needed flag instead of is_wpss.
drivers/remoteproc/qcom_q6v5_adsp.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/remoteproc/qcom_q6v5_adsp.c b/drivers/remoteproc/qcom_q6v5_adsp.c
index 2f3b9f5..fa2ccac 100644
--- a/drivers/remoteproc/qcom_q6v5_adsp.c
+++ b/drivers/remoteproc/qcom_q6v5_adsp.c
@@ -62,6 +62,7 @@ struct adsp_pil_data {
const char *sysmon_name;
int ssctl_id;
bool is_wpss;
+ bool has_iommu;
bool auto_boot;
const char **clk_ids;
@@ -99,6 +100,7 @@ struct qcom_adsp {
phys_addr_t mem_reloc;
void *mem_region;
size_t mem_size;
+ bool has_iommu;
struct device *proxy_pds[QCOM_Q6V5_RPROC_PROXY_PD_MAX];
size_t proxy_pd_count;
@@ -596,12 +598,15 @@ static int adsp_probe(struct platform_device *pdev)
}
rproc->auto_boot = desc->auto_boot;
+ rproc->has_iommu = desc->has_iommu;
rproc_coredump_set_elf_info(rproc, ELFCLASS32, EM_NONE);
adsp = (struct qcom_adsp *)rproc->priv;
adsp->dev = &pdev->dev;
adsp->rproc = rproc;
adsp->info_name = desc->sysmon_name;
+ adsp->has_iommu = desc->has_iommu;
+
platform_set_drvdata(pdev, adsp);
if (desc->is_wpss)
--
2.7.4
Replace hard coded values of QDSP6 boot control reg params
with appropriate macro names.
Signed-off-by: Srinivasa Rao Mandadapu <[email protected]>
Reviewed-by: Dmitry Baryshkov <[email protected]>
Reviewed-by: Stephen Boyd <[email protected]>
Reviewed-by: Sibi Sankar <[email protected]>
---
drivers/remoteproc/qcom_q6v5_adsp.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/remoteproc/qcom_q6v5_adsp.c b/drivers/remoteproc/qcom_q6v5_adsp.c
index 9ea10b7..80c8169 100644
--- a/drivers/remoteproc/qcom_q6v5_adsp.c
+++ b/drivers/remoteproc/qcom_q6v5_adsp.c
@@ -54,6 +54,9 @@
#define QCOM_Q6V5_RPROC_PROXY_PD_MAX 3
+#define LPASS_BOOT_CORE_START BIT(0)
+#define LPASS_BOOT_CMD_START BIT(0)
+
struct adsp_pil_data {
int crash_reason_smem;
const char *firmware_name;
@@ -366,10 +369,10 @@ static int adsp_start(struct rproc *rproc)
writel(adsp->mem_phys >> 4, adsp->qdsp6ss_base + RST_EVB_REG);
/* De-assert QDSP6 stop core. QDSP6 will execute after out of reset */
- writel(0x1, adsp->qdsp6ss_base + CORE_START_REG);
+ writel(LPASS_BOOT_CORE_START, adsp->qdsp6ss_base + CORE_START_REG);
/* Trigger boot FSM to start QDSP6 */
- writel(0x1, adsp->qdsp6ss_base + BOOT_CMD_REG);
+ writel(LPASS_BOOT_CMD_START, adsp->qdsp6ss_base + BOOT_CMD_REG);
/* Wait for core to come out of reset */
ret = readl_poll_timeout(adsp->qdsp6ss_base + BOOT_STATUS_REG,
--
2.7.4
On 23/09/2022 15:05, Srinivasa Rao Mandadapu wrote:
> Add efuse evb selection control and enable it for starting ADSP.
>
> Signed-off-by: Srinivasa Rao Mandadapu <[email protected]>
> Reviewed-by: Stephen Boyd <[email protected]>
> Reviewed-by: Sibi Sankar <[email protected]>
> ---
Thank you for your patch. There is something to discuss/improve.
> @@ -543,6 +549,17 @@ static int adsp_init_mmio(struct qcom_adsp *adsp,
> return PTR_ERR(adsp->qdsp6ss_base);
> }
>
> + efuse_region = platform_get_resource(pdev, IORESOURCE_MEM, 1);
> + if (!efuse_region) {
> + adsp->lpass_efuse = NULL;
> + dev_dbg(adsp->dev, "failed to get efuse memory region\n");
> + } else {
This needs bindings updates in all users.
Best regards,
Krzysztof
On 9/23/2022 10:55 PM, Krzysztof Kozlowski wrote:
Thanks for Your time Krzyszto!!!
> On 23/09/2022 15:05, Srinivasa Rao Mandadapu wrote:
>> Add efuse evb selection control and enable it for starting ADSP.
>>
>> Signed-off-by: Srinivasa Rao Mandadapu <[email protected]>
>> Reviewed-by: Stephen Boyd <[email protected]>
>> Reviewed-by: Sibi Sankar <[email protected]>
>> ---
> Thank you for your patch. There is something to discuss/improve.
>
>> @@ -543,6 +549,17 @@ static int adsp_init_mmio(struct qcom_adsp *adsp,
>> return PTR_ERR(adsp->qdsp6ss_base);
>> }
>>
>> + efuse_region = platform_get_resource(pdev, IORESOURCE_MEM, 1);
>> + if (!efuse_region) {
>> + adsp->lpass_efuse = NULL;
>> + dev_dbg(adsp->dev, "failed to get efuse memory region\n");
>> + } else {
> This needs bindings updates in all users.
Actually this is being used in SC7280 platform only. I am not sure if it
applicable for other platforms.
If required, it can be posted as new series after this series got main
lined.
>
> Best regards,
> Krzysztof
>