diff --git a/Documentation/devicetree/bindings/remoteproc/qcom,milos-pas.yaml b/Documentation/devicetree/bindings/remoteproc/qcom,milos-pas.yaml index c47d97004b33..e5cce0d05fc6 100644 --- a/Documentation/devicetree/bindings/remoteproc/qcom,milos-pas.yaml +++ b/Documentation/devicetree/bindings/remoteproc/qcom,milos-pas.yaml @@ -16,6 +16,7 @@ description: properties: compatible: enum: + - qcom,eliza-adsp-pas - qcom,milos-adsp-pas - qcom,milos-cdsp-pas - qcom,milos-mpss-pas @@ -69,6 +70,7 @@ allOf: properties: compatible: enum: + - qcom,eliza-adsp-pas - qcom,milos-adsp-pas - qcom,milos-cdsp-pas then: @@ -89,6 +91,7 @@ allOf: compatible: contains: enum: + - qcom,eliza-adsp-pas - qcom,milos-adsp-pas then: properties: diff --git a/Documentation/devicetree/bindings/remoteproc/qcom,msm8916-mss-pil.yaml b/Documentation/devicetree/bindings/remoteproc/qcom,msm8916-mss-pil.yaml index c179b560572b..faf2712e3d27 100644 --- a/Documentation/devicetree/bindings/remoteproc/qcom,msm8916-mss-pil.yaml +++ b/Documentation/devicetree/bindings/remoteproc/qcom,msm8916-mss-pil.yaml @@ -17,10 +17,14 @@ properties: compatible: oneOf: - enum: + - qcom,mdm9607-mss-pil - qcom,msm8226-mss-pil - qcom,msm8909-mss-pil - qcom,msm8916-mss-pil + - qcom,msm8917-mss-pil - qcom,msm8926-mss-pil + - qcom,msm8937-mss-pil + - qcom,msm8940-mss-pil - qcom,msm8953-mss-pil - qcom,msm8974-mss-pil @@ -89,7 +93,7 @@ properties: description: PLL proxy supply (control handed over after startup) mss-supply: - description: MSS power domain supply (only valid for qcom,msm8974-mss-pil) + description: MSS power domain supply resets: items: @@ -137,7 +141,6 @@ properties: - description: MPSS reserved region firmware-name: - $ref: /schemas/types.yaml#/definitions/string-array items: - description: Name of MBA firmware - description: Name of modem firmware @@ -226,8 +229,12 @@ allOf: compatible: contains: enum: + - qcom,mdm9607-mss-pil - qcom,msm8909-mss-pil - qcom,msm8916-mss-pil + - qcom,msm8917-mss-pil + - qcom,msm8937-mss-pil + - qcom,msm8940-mss-pil then: properties: power-domains: @@ -271,6 +278,9 @@ allOf: contains: enum: - qcom,msm8926-mss-pil + - qcom,msm8917-mss-pil + - qcom,msm8937-mss-pil + - qcom,msm8940-mss-pil - qcom,msm8974-mss-pil then: required: diff --git a/Documentation/devicetree/bindings/remoteproc/qcom,msm8996-mss-pil.yaml b/Documentation/devicetree/bindings/remoteproc/qcom,msm8996-mss-pil.yaml index 4d2055f283ac..1b65813cc8ad 100644 --- a/Documentation/devicetree/bindings/remoteproc/qcom,msm8996-mss-pil.yaml +++ b/Documentation/devicetree/bindings/remoteproc/qcom,msm8996-mss-pil.yaml @@ -126,7 +126,6 @@ properties: - description: Metadata reserved region firmware-name: - $ref: /schemas/types.yaml#/definitions/string-array items: - description: Name of MBA firmware - description: Name of modem firmware diff --git a/Documentation/devicetree/bindings/remoteproc/qcom,sa8775p-pas.yaml b/Documentation/devicetree/bindings/remoteproc/qcom,sa8775p-pas.yaml index 188a25194000..bcd2bcf96e24 100644 --- a/Documentation/devicetree/bindings/remoteproc/qcom,sa8775p-pas.yaml +++ b/Documentation/devicetree/bindings/remoteproc/qcom,sa8775p-pas.yaml @@ -51,7 +51,6 @@ properties: description: Reference to the AOSS side-channel message RAM. firmware-name: - $ref: /schemas/types.yaml#/definitions/string-array items: - description: Firmware name of the Hexagon core diff --git a/Documentation/devicetree/bindings/remoteproc/qcom,sc7180-mss-pil.yaml b/Documentation/devicetree/bindings/remoteproc/qcom,sc7180-mss-pil.yaml index b1402bef0ebe..7c9accac92d0 100644 --- a/Documentation/devicetree/bindings/remoteproc/qcom,sc7180-mss-pil.yaml +++ b/Documentation/devicetree/bindings/remoteproc/qcom,sc7180-mss-pil.yaml @@ -98,7 +98,6 @@ properties: - description: metadata reserved region firmware-name: - $ref: /schemas/types.yaml#/definitions/string-array items: - description: Name of MBA firmware - description: Name of modem firmware diff --git a/Documentation/devicetree/bindings/remoteproc/qcom,sc7280-mss-pil.yaml b/Documentation/devicetree/bindings/remoteproc/qcom,sc7280-mss-pil.yaml index 005cb21732af..f349c303fa07 100644 --- a/Documentation/devicetree/bindings/remoteproc/qcom,sc7280-mss-pil.yaml +++ b/Documentation/devicetree/bindings/remoteproc/qcom,sc7280-mss-pil.yaml @@ -98,7 +98,6 @@ properties: - description: metadata reserved region firmware-name: - $ref: /schemas/types.yaml#/definitions/string-array items: - description: Name of MBA firmware - description: Name of modem firmware diff --git a/Documentation/devicetree/bindings/remoteproc/qcom,sc8280xp-pas.yaml b/Documentation/devicetree/bindings/remoteproc/qcom,sc8280xp-pas.yaml index 5dbda3a55047..8227527c1d77 100644 --- a/Documentation/devicetree/bindings/remoteproc/qcom,sc8280xp-pas.yaml +++ b/Documentation/devicetree/bindings/remoteproc/qcom,sc8280xp-pas.yaml @@ -42,7 +42,7 @@ properties: description: Reference to the reserved-memory for the Hexagon core firmware-name: - $ref: /schemas/types.yaml#/definitions/string + maxItems: 1 description: Firmware name for the Hexagon core required: diff --git a/Documentation/devicetree/bindings/remoteproc/qcom,sdx55-pas.yaml b/Documentation/devicetree/bindings/remoteproc/qcom,sdx55-pas.yaml index 5d463272165f..8c4abde74915 100644 --- a/Documentation/devicetree/bindings/remoteproc/qcom,sdx55-pas.yaml +++ b/Documentation/devicetree/bindings/remoteproc/qcom,sdx55-pas.yaml @@ -56,7 +56,7 @@ properties: smd-edge: false firmware-name: - $ref: /schemas/types.yaml#/definitions/string + maxItems: 1 description: Firmware name for the Hexagon core required: diff --git a/Documentation/devicetree/bindings/remoteproc/qcom,sm8550-pas.yaml b/Documentation/devicetree/bindings/remoteproc/qcom,sm8550-pas.yaml index 11b056d6a480..1e4db0c9fcf9 100644 --- a/Documentation/devicetree/bindings/remoteproc/qcom,sm8550-pas.yaml +++ b/Documentation/devicetree/bindings/remoteproc/qcom,sm8550-pas.yaml @@ -28,8 +28,16 @@ properties: - qcom,x1e80100-adsp-pas - qcom,x1e80100-cdsp-pas - items: - - const: qcom,sm8750-adsp-pas + - enum: + - qcom,glymur-adsp-pas + - qcom,kaanapali-adsp-pas + - qcom,sm8750-adsp-pas - const: qcom,sm8550-adsp-pas + - items: + - enum: + - qcom,glymur-cdsp-pas + - qcom,kaanapali-cdsp-pas + - const: qcom,sm8550-cdsp-pas - items: - const: qcom,sm8750-cdsp-pas - const: qcom,sm8650-cdsp-pas @@ -52,7 +60,6 @@ properties: smd-edge: false firmware-name: - $ref: /schemas/types.yaml#/definitions/string-array items: - description: Firmware name of the Hexagon core - description: Firmware name of the Hexagon Devicetree @@ -95,6 +102,10 @@ allOf: compatible: contains: enum: + - qcom,glymur-adsp-pas + - qcom,glymur-cdsp-pas + - qcom,kaanapali-adsp-pas + - qcom,kaanapali-cdsp-pas - qcom,sm8750-adsp-pas then: properties: diff --git a/Documentation/devicetree/bindings/remoteproc/ti,k3-r5f-rproc.yaml b/Documentation/devicetree/bindings/remoteproc/ti,k3-r5f-rproc.yaml index a927551356e6..775e9b3a1938 100644 --- a/Documentation/devicetree/bindings/remoteproc/ti,k3-r5f-rproc.yaml +++ b/Documentation/devicetree/bindings/remoteproc/ti,k3-r5f-rproc.yaml @@ -154,17 +154,44 @@ patternProperties: memory-region: description: | phandle to the reserved memory nodes to be associated with the - remoteproc device. There should be at least two reserved memory nodes - defined. The reserved memory nodes should be carveout nodes, and - should be defined with a "no-map" property as per the bindings in + remoteproc device. There should be two reserved memory nodes defined + for the basic layout or 6 partitions for a detailed layout. The + reserved memory nodes should be carveout nodes, and should be defined + with a "no-map" property as per the bindings in Documentation/devicetree/bindings/reserved-memory/reserved-memory.txt - minItems: 2 - maxItems: 8 - items: - - description: region used for dynamic DMA allocations like vrings and - vring buffers - - description: region reserved for firmware image sections - additionalItems: true + oneOf: + - description: Basic layout + items: + - description: region used for dynamic DMA allocations like vrings and + vring buffers + - description: region reserved for firmware image sections + - description: Detailed layout + items: + - description: region used for dynamic DMA allocations like vrings and + vring buffers + - description: region reserved for IPC resources + - description: LPM FS stub binary + - description: LPM metadata + - description: LPM FS context data and reserved sections + - description: DM RM/PM trace and firmware code/data + + memory-region-names: + description: | + Names for the memory regions specified in the memory-region property. + The names must correspond with the entries in memory-region. + oneOf: + - description: Basic layout + items: + - const: dma + - const: firmware + - description: Detailed layout + items: + - const: dma + - const: ipc + - const: lpm-stub + - const: lpm-metadata + - const: lpm-context + - const: dm-firmware # Optional properties: # -------------------- @@ -218,6 +245,13 @@ patternProperties: - resets - firmware-name + if: + required: + - memory-region + then: + required: + - memory-region-names + unevaluatedProperties: false allOf: @@ -321,6 +355,7 @@ examples: mboxes = <&mailbox0 &mbox_mcu_r5fss0_core0>; memory-region = <&mcu_r5fss0_core0_dma_memory_region>, <&mcu_r5fss0_core0_memory_region>; + memory-region-names = "dma", "firmware"; sram = <&mcu_r5fss0_core0_sram>; }; diff --git a/drivers/remoteproc/da8xx_remoteproc.c b/drivers/remoteproc/da8xx_remoteproc.c index e418a2bf5d2e..23fca7176539 100644 --- a/drivers/remoteproc/da8xx_remoteproc.c +++ b/drivers/remoteproc/da8xx_remoteproc.c @@ -57,11 +57,10 @@ struct da8xx_rproc_mem { * @mem: internal memory regions data * @num_mems: number of internal memory regions * @dsp_clk: placeholder for platform's DSP clk - * @ack_fxn: chip-specific ack function for ack'ing irq + * @dsp_reset: control for local reset * @irq_data: ack_fxn function parameter * @chipsig: virt ptr to DSP interrupt registers (CHIPSIG & CHIPSIG_CLR) * @bootreg: virt ptr to DSP boot address register (HOST1CFG) - * @irq: irq # used by this instance */ struct da8xx_rproc { struct rproc *rproc; @@ -69,11 +68,9 @@ struct da8xx_rproc { int num_mems; struct clk *dsp_clk; struct reset_control *dsp_reset; - void (*ack_fxn)(struct irq_data *data); struct irq_data *irq_data; void __iomem *chipsig; void __iomem *bootreg; - int irq; }; /** @@ -122,7 +119,7 @@ static irqreturn_t da8xx_rproc_callback(int irq, void *p) * we need to ack it after taking down the level else we'll * be called again immediately after returning. */ - drproc->ack_fxn(drproc->irq_data); + drproc->irq_data->chip->irq_ack(drproc->irq_data); return IRQ_WAKE_THREAD; } @@ -245,45 +242,9 @@ static int da8xx_rproc_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct da8xx_rproc *drproc; struct rproc *rproc; - struct irq_data *irq_data; - struct clk *dsp_clk; - struct reset_control *dsp_reset; - void __iomem *chipsig; - void __iomem *bootreg; int irq; int ret; - irq = platform_get_irq(pdev, 0); - if (irq < 0) - return irq; - - irq_data = irq_get_irq_data(irq); - if (!irq_data) - return dev_err_probe(dev, -EINVAL, "irq_get_irq_data(%d): NULL\n", irq); - - bootreg = devm_platform_ioremap_resource_byname(pdev, "host1cfg"); - if (IS_ERR(bootreg)) - return PTR_ERR(bootreg); - - chipsig = devm_platform_ioremap_resource_byname(pdev, "chipsig"); - if (IS_ERR(chipsig)) - return PTR_ERR(chipsig); - - dsp_clk = devm_clk_get(dev, NULL); - if (IS_ERR(dsp_clk)) - return dev_err_probe(dev, PTR_ERR(dsp_clk), "clk_get error\n"); - - dsp_reset = devm_reset_control_get_exclusive(dev, NULL); - if (IS_ERR(dsp_reset)) - return dev_err_probe(dev, PTR_ERR(dsp_reset), "unable to get reset control\n"); - - if (dev->of_node) { - ret = of_reserved_mem_device_init(dev); - if (ret) - return dev_err_probe(dev, ret, "device does not have specific CMA pool\n"); - devm_add_action_or_reset(&pdev->dev, da8xx_rproc_mem_release, &pdev->dev); - } - rproc = devm_rproc_alloc(dev, "dsp", &da8xx_rproc_ops, da8xx_fw_name, sizeof(*drproc)); if (!rproc) @@ -294,43 +255,63 @@ static int da8xx_rproc_probe(struct platform_device *pdev) drproc = rproc->priv; drproc->rproc = rproc; - drproc->dsp_clk = dsp_clk; - drproc->dsp_reset = dsp_reset; rproc->has_iommu = false; + drproc->dsp_clk = devm_clk_get(dev, NULL); + if (IS_ERR(drproc->dsp_clk)) + return dev_err_probe(dev, PTR_ERR(drproc->dsp_clk), "clk_get error\n"); + + drproc->dsp_reset = devm_reset_control_get_exclusive(dev, NULL); + if (IS_ERR(drproc->dsp_reset)) + return dev_err_probe(dev, PTR_ERR(drproc->dsp_reset), + "unable to get reset control\n"); + + if (dev->of_node) { + ret = of_reserved_mem_device_init(dev); + if (ret) + return dev_err_probe(dev, ret, "device does not have specific CMA pool\n"); + devm_add_action_or_reset(&pdev->dev, da8xx_rproc_mem_release, &pdev->dev); + } + ret = da8xx_rproc_get_internal_memories(pdev, drproc); if (ret) return ret; + irq = platform_get_irq(pdev, 0); + if (irq < 0) + return irq; + + drproc->irq_data = irq_get_irq_data(irq); + if (!drproc->irq_data) + return dev_err_probe(dev, -EINVAL, "irq_get_irq_data(%d): NULL\n", irq); + + drproc->chipsig = devm_platform_ioremap_resource_byname(pdev, "chipsig"); + if (IS_ERR(drproc->chipsig)) + return PTR_ERR(drproc->chipsig); + + drproc->bootreg = devm_platform_ioremap_resource_byname(pdev, "host1cfg"); + if (IS_ERR(drproc->bootreg)) + return PTR_ERR(drproc->bootreg); + /* everything the ISR needs is now setup, so hook it up */ ret = devm_request_threaded_irq(dev, irq, da8xx_rproc_callback, handle_event, 0, "da8xx-remoteproc", rproc); - if (ret) { - dev_err(dev, "devm_request_threaded_irq error: %d\n", ret); - return ret; - } + if (ret) + return dev_err_probe(dev, ret, "devm_request_threaded_irq error\n"); /* * rproc_add() can end up enabling the DSP's clk with the DSP * *not* in reset, but da8xx_rproc_start() needs the DSP to be * held in reset at the time it is called. */ - ret = reset_control_assert(dsp_reset); + ret = reset_control_assert(drproc->dsp_reset); if (ret) return ret; - drproc->chipsig = chipsig; - drproc->bootreg = bootreg; - drproc->ack_fxn = irq_data->chip->irq_ack; - drproc->irq_data = irq_data; - drproc->irq = irq; - ret = devm_rproc_add(dev, rproc); - if (ret) { - dev_err(dev, "rproc_add failed: %d\n", ret); - return ret; - } + if (ret) + return dev_err_probe(dev, ret, "rproc_add failed\n"); return 0; } diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c index 8c8ddbf995a4..0dd80e688b0e 100644 --- a/drivers/remoteproc/imx_rproc.c +++ b/drivers/remoteproc/imx_rproc.c @@ -812,7 +812,7 @@ static int imx_rproc_addr_init(struct imx_rproc *priv, /* Not use resource version, because we might share region */ priv->mem[b].cpu_addr = devm_ioremap_resource_wc(&pdev->dev, &res); - if (!priv->mem[b].cpu_addr) { + if (IS_ERR(priv->mem[b].cpu_addr)) { dev_err(dev, "failed to remap %pr\n", &res); return -ENOMEM; } @@ -1007,7 +1007,11 @@ static int imx_rproc_mmio_detect_mode(struct rproc *rproc) } priv->regmap = regmap; - regmap_attach_dev(dev, regmap, &config); + ret = regmap_attach_dev(dev, regmap, &config); + if (ret) { + dev_err(dev, "regmap attach failed\n"); + return ret; + } if (priv->gpr) { ret = regmap_read(priv->gpr, dcfg->gpr_reg, &val); diff --git a/drivers/remoteproc/keystone_remoteproc.c b/drivers/remoteproc/keystone_remoteproc.c index 4d6550b48567..e7fde5509786 100644 --- a/drivers/remoteproc/keystone_remoteproc.c +++ b/drivers/remoteproc/keystone_remoteproc.c @@ -173,35 +173,16 @@ static int keystone_rproc_start(struct rproc *rproc) INIT_WORK(&ksproc->workqueue, handle_event); - ret = request_irq(ksproc->irq_ring, keystone_rproc_vring_interrupt, 0, - dev_name(ksproc->dev), ksproc); - if (ret) { - dev_err(ksproc->dev, "failed to enable vring interrupt, ret = %d\n", - ret); - goto out; - } - - ret = request_irq(ksproc->irq_fault, keystone_rproc_exception_interrupt, - 0, dev_name(ksproc->dev), ksproc); - if (ret) { - dev_err(ksproc->dev, "failed to enable exception interrupt, ret = %d\n", - ret); - goto free_vring_irq; - } + enable_irq(ksproc->irq_ring); + enable_irq(ksproc->irq_fault); ret = keystone_rproc_dsp_boot(ksproc, rproc->bootaddr); - if (ret) - goto free_exc_irq; + if (ret) { + flush_work(&ksproc->workqueue); + return ret; + } return 0; - -free_exc_irq: - free_irq(ksproc->irq_fault, ksproc); -free_vring_irq: - free_irq(ksproc->irq_ring, ksproc); - flush_work(&ksproc->workqueue); -out: - return ret; } /* @@ -215,8 +196,8 @@ static int keystone_rproc_stop(struct rproc *rproc) struct keystone_rproc *ksproc = rproc->priv; keystone_rproc_dsp_reset(ksproc); - free_irq(ksproc->irq_fault, ksproc); - free_irq(ksproc->irq_ring, ksproc); + disable_irq(ksproc->irq_fault); + disable_irq(ksproc->irq_ring); flush_work(&ksproc->workqueue); return 0; @@ -427,10 +408,18 @@ static int keystone_rproc_probe(struct platform_device *pdev) ksproc->irq_ring = platform_get_irq_byname(pdev, "vring"); if (ksproc->irq_ring < 0) return ksproc->irq_ring; + ret = devm_request_irq(dev, ksproc->irq_ring, keystone_rproc_vring_interrupt, + IRQF_NO_AUTOEN, dev_name(dev), ksproc); + if (ret) + return dev_err_probe(dev, ret, "failed to request vring interrupt\n"); ksproc->irq_fault = platform_get_irq_byname(pdev, "exception"); if (ksproc->irq_fault < 0) return ksproc->irq_fault; + ret = devm_request_irq(dev, ksproc->irq_fault, keystone_rproc_exception_interrupt, + IRQF_NO_AUTOEN, dev_name(dev), ksproc); + if (ret) + return dev_err_probe(dev, ret, "failed to enable exception interrupt\n"); ksproc->kick_gpio = devm_gpiod_get(dev, "kick", GPIOD_ASIS); ret = PTR_ERR_OR_ZERO(ksproc->kick_gpio); diff --git a/drivers/remoteproc/pru_rproc.c b/drivers/remoteproc/pru_rproc.c index 5e3eb7b86a0e..a4636c7bc6b7 100644 --- a/drivers/remoteproc/pru_rproc.c +++ b/drivers/remoteproc/pru_rproc.c @@ -1003,11 +1003,9 @@ static int pru_rproc_probe(struct platform_device *pdev) if (!data) return -ENODEV; - ret = of_property_read_string(np, "firmware-name", &fw_name); - if (ret) { - dev_err(dev, "unable to retrieve firmware-name %d\n", ret); - return ret; - } + ret = rproc_of_parse_firmware(dev, 0, &fw_name); + if (ret) + return dev_err_probe(dev, ret, "unable to retrieve firmware-name\n"); rproc = devm_rproc_alloc(dev, pdev->name, &pru_rproc_ops, fw_name, sizeof(*pru)); @@ -1080,14 +1078,6 @@ static int pru_rproc_probe(struct platform_device *pdev) return 0; } -static void pru_rproc_remove(struct platform_device *pdev) -{ - struct device *dev = &pdev->dev; - struct rproc *rproc = platform_get_drvdata(pdev); - - dev_dbg(dev, "%s: removing rproc %s\n", __func__, rproc->name); -} - static const struct pru_private_data pru_data = { .type = PRU_TYPE_PRU, }; @@ -1133,7 +1123,6 @@ static struct platform_driver pru_rproc_driver = { .suppress_bind_attrs = true, }, .probe = pru_rproc_probe, - .remove = pru_rproc_remove, }; module_platform_driver(pru_rproc_driver); diff --git a/drivers/remoteproc/qcom_common.c b/drivers/remoteproc/qcom_common.c index 6c31140268ac..fd2b6824ad26 100644 --- a/drivers/remoteproc/qcom_common.c +++ b/drivers/remoteproc/qcom_common.c @@ -28,7 +28,6 @@ #define to_ssr_subdev(d) container_of(d, struct qcom_rproc_ssr, subdev) #define to_pdm_subdev(d) container_of(d, struct qcom_rproc_pdm, subdev) -#define MAX_NUM_OF_SS 10 #define MAX_REGION_NAME_LENGTH 16 #define SBL_MINIDUMP_SMEM_ID 602 #define MINIDUMP_REGION_VALID ('V' << 24 | 'A' << 16 | 'L' << 8 | 'I' << 0) @@ -80,7 +79,7 @@ struct minidump_global_toc { __le32 status; __le32 md_revision; __le32 enabled; - struct minidump_subsystem subsystems[MAX_NUM_OF_SS]; + struct minidump_subsystem subsystems[]; }; struct qcom_ssr_subsystem { @@ -151,9 +150,11 @@ void qcom_minidump(struct rproc *rproc, unsigned int minidump_id, int ret; struct minidump_subsystem *subsystem; struct minidump_global_toc *toc; + unsigned int num_ss; + size_t toc_size; /* Get Global minidump ToC*/ - toc = qcom_smem_get(QCOM_SMEM_HOST_ANY, SBL_MINIDUMP_SMEM_ID, NULL); + toc = qcom_smem_get(QCOM_SMEM_HOST_ANY, SBL_MINIDUMP_SMEM_ID, &toc_size); /* check if global table pointer exists and init is set */ if (IS_ERR(toc) || !toc->status) { @@ -161,6 +162,16 @@ void qcom_minidump(struct rproc *rproc, unsigned int minidump_id, return; } + /* Derive the number of subsystems from the actual SMEM item size */ + num_ss = (toc_size - offsetof(struct minidump_global_toc, subsystems)) / + sizeof(struct minidump_subsystem); + + if (minidump_id >= num_ss) { + dev_err(&rproc->dev, "Minidump id %d is out of range: %d\n", + minidump_id, num_ss); + return; + } + /* Get subsystem table of contents using the minidump id */ subsystem = &toc->subsystems[minidump_id]; diff --git a/drivers/remoteproc/qcom_q6v5_mss.c b/drivers/remoteproc/qcom_q6v5_mss.c index 91940977ca89..ae78f5c7c1b6 100644 --- a/drivers/remoteproc/qcom_q6v5_mss.c +++ b/drivers/remoteproc/qcom_q6v5_mss.c @@ -124,6 +124,7 @@ #define QDSP6v56_CLAMP_QMC_MEM BIT(22) #define QDSP6SS_XO_CBCR 0x0038 #define QDSP6SS_ACC_OVERRIDE_VAL 0x20 +#define QDSP6SS_ACC_OVERRIDE_VAL_9607 0x80800000 #define QDSP6v55_BHS_EN_REST_ACK BIT(0) /* QDSP6v65 parameters */ @@ -162,6 +163,7 @@ struct rproc_hexagon_res { char **proxy_pd_names; int version; bool need_mem_protection; + bool need_pas_mem_setup; bool has_alt_reset; bool has_mba_logs; bool has_spare_reg; @@ -240,6 +242,7 @@ struct q6v5 { struct qcom_sysmon *sysmon; struct platform_device *bam_dmux; bool need_mem_protection; + bool need_pas_mem_setup; bool has_alt_reset; bool has_mba_logs; bool has_spare_reg; @@ -254,10 +257,14 @@ struct q6v5 { }; enum { + MSS_MDM9607, MSS_MSM8226, MSS_MSM8909, MSS_MSM8916, + MSS_MSM8917, MSS_MSM8926, + MSS_MSM8937, + MSS_MSM8940, MSS_MSM8953, MSS_MSM8974, MSS_MSM8996, @@ -745,15 +752,25 @@ static int q6v5proc_reset(struct q6v5 *qproc) return ret; } goto pbl_wait; - } else if (qproc->version == MSS_MSM8909 || + } else if (qproc->version == MSS_MDM9607 || + qproc->version == MSS_MSM8909 || + qproc->version == MSS_MSM8917 || + qproc->version == MSS_MSM8937 || + qproc->version == MSS_MSM8940 || qproc->version == MSS_MSM8953 || qproc->version == MSS_MSM8996 || qproc->version == MSS_MSM8998 || qproc->version == MSS_SDM660) { - if (qproc->version != MSS_MSM8909 && - qproc->version != MSS_MSM8953) - /* Override the ACC value if required */ + /* Override the ACC value if required */ + if (qproc->version == MSS_MDM9607 || + qproc->version == MSS_MSM8917 || + qproc->version == MSS_MSM8937 || + qproc->version == MSS_MSM8940) + writel(QDSP6SS_ACC_OVERRIDE_VAL_9607, + qproc->reg_base + QDSP6SS_STRAP_ACC); + else if (qproc->version != MSS_MSM8909 && + qproc->version != MSS_MSM8953) writel(QDSP6SS_ACC_OVERRIDE_VAL, qproc->reg_base + QDSP6SS_STRAP_ACC); @@ -799,6 +816,7 @@ static int q6v5proc_reset(struct q6v5 *qproc) if (qproc->version != MSS_MSM8909) { int mem_pwr_ctl; + int reverse; /* Deassert QDSP6 compiler memory clamp */ val = readl(qproc->reg_base + QDSP6SS_PWR_CTL_REG); @@ -810,17 +828,37 @@ static int q6v5proc_reset(struct q6v5 *qproc) writel(val, qproc->reg_base + QDSP6SS_PWR_CTL_REG); /* Turn on L1, L2, ETB and JU memories 1 at a time */ - if (qproc->version == MSS_MSM8953 || + if (qproc->version == MSS_MSM8940 || + qproc->version == MSS_MSM8953 || qproc->version == MSS_MSM8996) { mem_pwr_ctl = QDSP6SS_MEM_PWR_CTL; i = 19; + reverse = 0; + } else if (qproc->version == MSS_MDM9607 || + qproc->version == MSS_MSM8917 || + qproc->version == MSS_MSM8937) { + mem_pwr_ctl = QDSP6SS_MEM_PWR_CTL; + i = 19; + /* + * Set first 5 bits in reverse to avoid + * "inrush current" issues. + */ + reverse = 6; } else { /* MSS_MSM8998, MSS_SDM660 */ mem_pwr_ctl = QDSP6V6SS_MEM_PWR_CTL; i = 28; + reverse = 0; } + val = readl(qproc->reg_base + mem_pwr_ctl); - for (; i >= 0; i--) { + for (; i >= reverse; i--) { + val |= BIT(i); + writel(val, qproc->reg_base + mem_pwr_ctl); + val = readl(qproc->reg_base + mem_pwr_ctl); + udelay(1); + } + for (i = 0; i < reverse; i++) { val |= BIT(i); writel(val, qproc->reg_base + mem_pwr_ctl); /* @@ -828,7 +866,7 @@ static int q6v5proc_reset(struct q6v5 *qproc) * wait for 1us for both memory peripheral and data * array to turn on. */ - val |= readl(qproc->reg_base + mem_pwr_ctl); + val = readl(qproc->reg_base + mem_pwr_ctl); udelay(1); } } else { @@ -1441,7 +1479,7 @@ static int q6v5_mpss_load(struct q6v5 *qproc) max_addr = ALIGN(phdr->p_paddr + phdr->p_memsz, SZ_4K); } - if (qproc->version == MSS_MSM8953) { + if (qproc->need_pas_mem_setup) { ret = qcom_scm_pas_mem_setup(MPSS_PAS_ID, qproc->mpss_phys, qproc->mpss_size); if (ret) { dev_err(qproc->dev, @@ -2224,6 +2262,7 @@ static const struct rproc_hexagon_res sc7180_mss = { NULL }, .need_mem_protection = true, + .need_pas_mem_setup = false, .has_alt_reset = false, .has_mba_logs = true, .has_spare_reg = true, @@ -2253,6 +2292,7 @@ static const struct rproc_hexagon_res sc7280_mss = { NULL }, .need_mem_protection = true, + .need_pas_mem_setup = false, .has_alt_reset = false, .has_mba_logs = true, .has_spare_reg = false, @@ -2285,6 +2325,7 @@ static const struct rproc_hexagon_res sdm660_mss = { NULL }, .need_mem_protection = true, + .need_pas_mem_setup = false, .has_alt_reset = false, .has_mba_logs = false, .has_spare_reg = false, @@ -2321,6 +2362,7 @@ static const struct rproc_hexagon_res sdm845_mss = { NULL }, .need_mem_protection = true, + .need_pas_mem_setup = false, .has_alt_reset = true, .has_mba_logs = false, .has_spare_reg = false, @@ -2353,6 +2395,7 @@ static const struct rproc_hexagon_res msm8998_mss = { NULL }, .need_mem_protection = true, + .need_pas_mem_setup = false, .has_alt_reset = false, .has_mba_logs = false, .has_spare_reg = false, @@ -2392,6 +2435,7 @@ static const struct rproc_hexagon_res msm8996_mss = { NULL }, .need_mem_protection = true, + .need_pas_mem_setup = false, .has_alt_reset = false, .has_mba_logs = false, .has_spare_reg = false, @@ -2402,6 +2446,41 @@ static const struct rproc_hexagon_res msm8996_mss = { .version = MSS_MSM8996, }; +static const struct rproc_hexagon_res mdm9607_mss = { + .hexagon_mba_image = "mba.mbn", + .proxy_supply = (struct qcom_mss_reg_res[]) { + { + .supply = "pll", + .uA = 100000, + }, + {} + }, + .proxy_clk_names = (char*[]){ + "xo", + NULL + }, + .active_clk_names = (char*[]){ + "iface", + "bus", + "mem", + NULL + }, + .proxy_pd_names = (char*[]){ + "mx", + "cx", + NULL + }, + .need_mem_protection = false, + .has_alt_reset = false, + .has_mba_logs = false, + .has_spare_reg = false, + .has_qaccept_regs = false, + .has_ext_bhs_reg = false, + .has_ext_cntl_regs = false, + .has_vq6 = false, + .version = MSS_MDM9607, +}; + static const struct rproc_hexagon_res msm8909_mss = { .hexagon_mba_image = "mba.mbn", .proxy_supply = (struct qcom_mss_reg_res[]) { @@ -2427,6 +2506,7 @@ static const struct rproc_hexagon_res msm8909_mss = { NULL }, .need_mem_protection = false, + .need_pas_mem_setup = false, .has_alt_reset = false, .has_mba_logs = false, .has_spare_reg = false, @@ -2473,6 +2553,7 @@ static const struct rproc_hexagon_res msm8916_mss = { NULL }, .need_mem_protection = false, + .need_pas_mem_setup = false, .has_alt_reset = false, .has_mba_logs = false, .has_spare_reg = false, @@ -2483,6 +2564,138 @@ static const struct rproc_hexagon_res msm8916_mss = { .version = MSS_MSM8916, }; +static const struct rproc_hexagon_res msm8917_mss = { + .hexagon_mba_image = "mba.mbn", + .proxy_supply = (struct qcom_mss_reg_res[]) { + { + .supply = "pll", + .uA = 100000, + }, + {} + }, + .active_supply = (struct qcom_mss_reg_res[]) { + { + .supply = "mss", + .uV = 1050000, + .uA = 100000, + }, + {} + }, + .proxy_clk_names = (char*[]){ + "xo", + NULL + }, + .active_clk_names = (char*[]){ + "iface", + "bus", + "mem", + NULL + }, + .proxy_pd_names = (char*[]) { + "cx", + "mx", + NULL + }, + .need_mem_protection = false, + .need_pas_mem_setup = false, + .has_alt_reset = false, + .has_mba_logs = false, + .has_spare_reg = false, + .has_qaccept_regs = false, + .has_ext_bhs_reg = false, + .has_ext_cntl_regs = false, + .has_vq6 = false, + .version = MSS_MSM8917, +}; + +static const struct rproc_hexagon_res msm8937_mss = { + .hexagon_mba_image = "mba.mbn", + .proxy_supply = (struct qcom_mss_reg_res[]) { + { + .supply = "pll", + .uA = 100000, + }, + {} + }, + .active_supply = (struct qcom_mss_reg_res[]) { + { + .supply = "mss", + .uV = 1050000, + .uA = 100000, + }, + {} + }, + .proxy_clk_names = (char*[]){ + "xo", + NULL + }, + .active_clk_names = (char*[]){ + "iface", + "bus", + "mem", + NULL + }, + .proxy_pd_names = (char*[]) { + "cx", + "mx", + NULL + }, + .need_mem_protection = false, + .need_pas_mem_setup = true, + .has_alt_reset = false, + .has_mba_logs = false, + .has_spare_reg = false, + .has_qaccept_regs = false, + .has_ext_bhs_reg = false, + .has_ext_cntl_regs = false, + .has_vq6 = false, + .version = MSS_MSM8937, +}; + +static const struct rproc_hexagon_res msm8940_mss = { + .hexagon_mba_image = "mba.mbn", + .proxy_supply = (struct qcom_mss_reg_res[]) { + { + .supply = "pll", + .uA = 100000, + }, + {} + }, + .active_supply = (struct qcom_mss_reg_res[]) { + { + .supply = "mss", + .uV = 1050000, + .uA = 100000, + }, + {} + }, + .proxy_clk_names = (char*[]){ + "xo", + NULL + }, + .active_clk_names = (char*[]){ + "iface", + "bus", + "mem", + NULL + }, + .proxy_pd_names = (char*[]) { + "cx", + "mx", + NULL + }, + .need_mem_protection = false, + .need_pas_mem_setup = true, + .has_alt_reset = false, + .has_mba_logs = false, + .has_spare_reg = false, + .has_qaccept_regs = false, + .has_ext_bhs_reg = false, + .has_ext_cntl_regs = false, + .has_vq6 = false, + .version = MSS_MSM8940, +}; + static const struct rproc_hexagon_res msm8953_mss = { .hexagon_mba_image = "mba.mbn", .proxy_supply = (struct qcom_mss_reg_res[]) { @@ -2509,6 +2722,7 @@ static const struct rproc_hexagon_res msm8953_mss = { NULL }, .need_mem_protection = false, + .need_pas_mem_setup = true, .has_alt_reset = false, .has_mba_logs = false, .has_spare_reg = false, @@ -2562,6 +2776,7 @@ static const struct rproc_hexagon_res msm8974_mss = { NULL }, .need_mem_protection = false, + .need_pas_mem_setup = false, .has_alt_reset = false, .has_mba_logs = false, .has_spare_reg = false, @@ -2600,6 +2815,7 @@ static const struct rproc_hexagon_res msm8226_mss = { NULL }, .need_mem_protection = false, + .need_pas_mem_setup = false, .has_alt_reset = false, .has_mba_logs = false, .has_spare_reg = false, @@ -2646,6 +2862,7 @@ static const struct rproc_hexagon_res msm8926_mss = { NULL }, .need_mem_protection = false, + .need_pas_mem_setup = false, .has_alt_reset = false, .has_mba_logs = false, .has_spare_reg = false, @@ -2657,19 +2874,23 @@ static const struct rproc_hexagon_res msm8926_mss = { }; static const struct of_device_id q6v5_of_match[] = { - { .compatible = "qcom,q6v5-pil", .data = &msm8916_mss}, - { .compatible = "qcom,msm8226-mss-pil", .data = &msm8226_mss}, - { .compatible = "qcom,msm8909-mss-pil", .data = &msm8909_mss}, - { .compatible = "qcom,msm8916-mss-pil", .data = &msm8916_mss}, - { .compatible = "qcom,msm8926-mss-pil", .data = &msm8926_mss}, - { .compatible = "qcom,msm8953-mss-pil", .data = &msm8953_mss}, - { .compatible = "qcom,msm8974-mss-pil", .data = &msm8974_mss}, - { .compatible = "qcom,msm8996-mss-pil", .data = &msm8996_mss}, - { .compatible = "qcom,msm8998-mss-pil", .data = &msm8998_mss}, - { .compatible = "qcom,sc7180-mss-pil", .data = &sc7180_mss}, - { .compatible = "qcom,sc7280-mss-pil", .data = &sc7280_mss}, - { .compatible = "qcom,sdm660-mss-pil", .data = &sdm660_mss}, - { .compatible = "qcom,sdm845-mss-pil", .data = &sdm845_mss}, + { .compatible = "qcom,q6v5-pil", .data = &msm8916_mss }, + { .compatible = "qcom,mdm9607-mss-pil", .data = &mdm9607_mss }, + { .compatible = "qcom,msm8226-mss-pil", .data = &msm8226_mss }, + { .compatible = "qcom,msm8909-mss-pil", .data = &msm8909_mss }, + { .compatible = "qcom,msm8916-mss-pil", .data = &msm8916_mss }, + { .compatible = "qcom,msm8917-mss-pil", .data = &msm8917_mss }, + { .compatible = "qcom,msm8926-mss-pil", .data = &msm8926_mss }, + { .compatible = "qcom,msm8937-mss-pil", .data = &msm8937_mss }, + { .compatible = "qcom,msm8940-mss-pil", .data = &msm8940_mss }, + { .compatible = "qcom,msm8953-mss-pil", .data = &msm8953_mss }, + { .compatible = "qcom,msm8974-mss-pil", .data = &msm8974_mss }, + { .compatible = "qcom,msm8996-mss-pil", .data = &msm8996_mss }, + { .compatible = "qcom,msm8998-mss-pil", .data = &msm8998_mss }, + { .compatible = "qcom,sc7180-mss-pil", .data = &sc7180_mss }, + { .compatible = "qcom,sc7280-mss-pil", .data = &sc7280_mss }, + { .compatible = "qcom,sdm660-mss-pil", .data = &sdm660_mss }, + { .compatible = "qcom,sdm845-mss-pil", .data = &sdm845_mss }, { }, }; MODULE_DEVICE_TABLE(of, q6v5_of_match); diff --git a/drivers/remoteproc/qcom_q6v5_pas.c b/drivers/remoteproc/qcom_q6v5_pas.c index 46204da046fa..da27d1d3c9da 100644 --- a/drivers/remoteproc/qcom_q6v5_pas.c +++ b/drivers/remoteproc/qcom_q6v5_pas.c @@ -1531,78 +1531,79 @@ static const struct qcom_pas_data sm8750_mpss_resource = { }; static const struct of_device_id qcom_pas_of_match[] = { - { .compatible = "qcom,milos-adsp-pas", .data = &sm8550_adsp_resource}, - { .compatible = "qcom,milos-cdsp-pas", .data = &milos_cdsp_resource}, - { .compatible = "qcom,milos-mpss-pas", .data = &sm8450_mpss_resource}, - { .compatible = "qcom,milos-wpss-pas", .data = &sc7280_wpss_resource}, - { .compatible = "qcom,msm8226-adsp-pil", .data = &msm8996_adsp_resource}, - { .compatible = "qcom,msm8953-adsp-pil", .data = &msm8996_adsp_resource}, - { .compatible = "qcom,msm8974-adsp-pil", .data = &msm8996_adsp_resource}, - { .compatible = "qcom,msm8996-adsp-pil", .data = &msm8996_adsp_resource}, - { .compatible = "qcom,msm8996-slpi-pil", .data = &msm8996_slpi_resource_init}, - { .compatible = "qcom,msm8998-adsp-pas", .data = &msm8996_adsp_resource}, - { .compatible = "qcom,msm8998-slpi-pas", .data = &msm8996_slpi_resource_init}, + { .compatible = "qcom,eliza-adsp-pas", .data = &sm8550_adsp_resource }, + { .compatible = "qcom,milos-adsp-pas", .data = &sm8550_adsp_resource }, + { .compatible = "qcom,milos-cdsp-pas", .data = &milos_cdsp_resource }, + { .compatible = "qcom,milos-mpss-pas", .data = &sm8450_mpss_resource }, + { .compatible = "qcom,milos-wpss-pas", .data = &sc7280_wpss_resource }, + { .compatible = "qcom,msm8226-adsp-pil", .data = &msm8996_adsp_resource }, + { .compatible = "qcom,msm8953-adsp-pil", .data = &msm8996_adsp_resource }, + { .compatible = "qcom,msm8974-adsp-pil", .data = &msm8996_adsp_resource }, + { .compatible = "qcom,msm8996-adsp-pil", .data = &msm8996_adsp_resource }, + { .compatible = "qcom,msm8996-slpi-pil", .data = &msm8996_slpi_resource_init }, + { .compatible = "qcom,msm8998-adsp-pas", .data = &msm8996_adsp_resource }, + { .compatible = "qcom,msm8998-slpi-pas", .data = &msm8996_slpi_resource_init }, { .compatible = "qcom,qcs404-adsp-pas", .data = &adsp_resource_init }, { .compatible = "qcom,qcs404-cdsp-pas", .data = &cdsp_resource_init }, { .compatible = "qcom,qcs404-wcss-pas", .data = &wcss_resource_init }, - { .compatible = "qcom,sa8775p-adsp-pas", .data = &sa8775p_adsp_resource}, - { .compatible = "qcom,sa8775p-cdsp0-pas", .data = &sa8775p_cdsp0_resource}, - { .compatible = "qcom,sa8775p-cdsp1-pas", .data = &sa8775p_cdsp1_resource}, - { .compatible = "qcom,sa8775p-gpdsp0-pas", .data = &sa8775p_gpdsp0_resource}, - { .compatible = "qcom,sa8775p-gpdsp1-pas", .data = &sa8775p_gpdsp1_resource}, - { .compatible = "qcom,sar2130p-adsp-pas", .data = &sm8350_adsp_resource}, - { .compatible = "qcom,sc7180-adsp-pas", .data = &sm8250_adsp_resource}, - { .compatible = "qcom,sc7180-mpss-pas", .data = &mpss_resource_init}, - { .compatible = "qcom,sc7280-adsp-pas", .data = &sm8350_adsp_resource}, - { .compatible = "qcom,sc7280-cdsp-pas", .data = &sm6350_cdsp_resource}, - { .compatible = "qcom,sc7280-mpss-pas", .data = &mpss_resource_init}, - { .compatible = "qcom,sc7280-wpss-pas", .data = &sc7280_wpss_resource}, - { .compatible = "qcom,sc8180x-adsp-pas", .data = &sm8150_adsp_resource}, - { .compatible = "qcom,sc8180x-cdsp-pas", .data = &sm8150_cdsp_resource}, - { .compatible = "qcom,sc8180x-mpss-pas", .data = &sc8180x_mpss_resource}, - { .compatible = "qcom,sc8280xp-adsp-pas", .data = &sm8250_adsp_resource}, - { .compatible = "qcom,sc8280xp-nsp0-pas", .data = &sc8280xp_nsp0_resource}, - { .compatible = "qcom,sc8280xp-nsp1-pas", .data = &sc8280xp_nsp1_resource}, - { .compatible = "qcom,sdm660-adsp-pas", .data = &adsp_resource_init}, - { .compatible = "qcom,sdm660-cdsp-pas", .data = &cdsp_resource_init}, - { .compatible = "qcom,sdm845-adsp-pas", .data = &sdm845_adsp_resource_init}, - { .compatible = "qcom,sdm845-cdsp-pas", .data = &sdm845_cdsp_resource_init}, - { .compatible = "qcom,sdm845-slpi-pas", .data = &sdm845_slpi_resource_init}, - { .compatible = "qcom,sdx55-mpss-pas", .data = &sdx55_mpss_resource}, - { .compatible = "qcom,sdx75-mpss-pas", .data = &sm8650_mpss_resource}, - { .compatible = "qcom,sm6115-adsp-pas", .data = &adsp_resource_init}, - { .compatible = "qcom,sm6115-cdsp-pas", .data = &cdsp_resource_init}, - { .compatible = "qcom,sm6115-mpss-pas", .data = &sc8180x_mpss_resource}, - { .compatible = "qcom,sm6350-adsp-pas", .data = &sm6350_adsp_resource}, - { .compatible = "qcom,sm6350-cdsp-pas", .data = &sm6350_cdsp_resource}, - { .compatible = "qcom,sm6350-mpss-pas", .data = &mpss_resource_init}, - { .compatible = "qcom,sm6375-adsp-pas", .data = &sm6350_adsp_resource}, - { .compatible = "qcom,sm6375-cdsp-pas", .data = &sm8150_cdsp_resource}, - { .compatible = "qcom,sm6375-mpss-pas", .data = &sm6375_mpss_resource}, - { .compatible = "qcom,sm8150-adsp-pas", .data = &sm8150_adsp_resource}, - { .compatible = "qcom,sm8150-cdsp-pas", .data = &sm8150_cdsp_resource}, - { .compatible = "qcom,sm8150-mpss-pas", .data = &mpss_resource_init}, - { .compatible = "qcom,sm8150-slpi-pas", .data = &sdm845_slpi_resource_init}, - { .compatible = "qcom,sm8250-adsp-pas", .data = &sm8250_adsp_resource}, - { .compatible = "qcom,sm8250-cdsp-pas", .data = &sm8250_cdsp_resource}, - { .compatible = "qcom,sm8250-slpi-pas", .data = &sdm845_slpi_resource_init}, - { .compatible = "qcom,sm8350-adsp-pas", .data = &sm8350_adsp_resource}, - { .compatible = "qcom,sm8350-cdsp-pas", .data = &sm8350_cdsp_resource}, - { .compatible = "qcom,sm8350-slpi-pas", .data = &sdm845_slpi_resource_init}, - { .compatible = "qcom,sm8350-mpss-pas", .data = &mpss_resource_init}, - { .compatible = "qcom,sm8450-adsp-pas", .data = &sm8350_adsp_resource}, - { .compatible = "qcom,sm8450-cdsp-pas", .data = &sm8350_cdsp_resource}, - { .compatible = "qcom,sm8450-slpi-pas", .data = &sdm845_slpi_resource_init}, - { .compatible = "qcom,sm8450-mpss-pas", .data = &sm8450_mpss_resource}, - { .compatible = "qcom,sm8550-adsp-pas", .data = &sm8550_adsp_resource}, - { .compatible = "qcom,sm8550-cdsp-pas", .data = &sm8550_cdsp_resource}, - { .compatible = "qcom,sm8550-mpss-pas", .data = &sm8550_mpss_resource}, - { .compatible = "qcom,sm8650-adsp-pas", .data = &sm8550_adsp_resource}, - { .compatible = "qcom,sm8650-cdsp-pas", .data = &sm8650_cdsp_resource}, - { .compatible = "qcom,sm8650-mpss-pas", .data = &sm8650_mpss_resource}, - { .compatible = "qcom,sm8750-mpss-pas", .data = &sm8750_mpss_resource}, - { .compatible = "qcom,x1e80100-adsp-pas", .data = &x1e80100_adsp_resource}, - { .compatible = "qcom,x1e80100-cdsp-pas", .data = &x1e80100_cdsp_resource}, + { .compatible = "qcom,sa8775p-adsp-pas", .data = &sa8775p_adsp_resource }, + { .compatible = "qcom,sa8775p-cdsp0-pas", .data = &sa8775p_cdsp0_resource }, + { .compatible = "qcom,sa8775p-cdsp1-pas", .data = &sa8775p_cdsp1_resource }, + { .compatible = "qcom,sa8775p-gpdsp0-pas", .data = &sa8775p_gpdsp0_resource }, + { .compatible = "qcom,sa8775p-gpdsp1-pas", .data = &sa8775p_gpdsp1_resource }, + { .compatible = "qcom,sar2130p-adsp-pas", .data = &sm8350_adsp_resource }, + { .compatible = "qcom,sc7180-adsp-pas", .data = &sm8250_adsp_resource }, + { .compatible = "qcom,sc7180-mpss-pas", .data = &mpss_resource_init }, + { .compatible = "qcom,sc7280-adsp-pas", .data = &sm8350_adsp_resource }, + { .compatible = "qcom,sc7280-cdsp-pas", .data = &sm6350_cdsp_resource }, + { .compatible = "qcom,sc7280-mpss-pas", .data = &mpss_resource_init }, + { .compatible = "qcom,sc7280-wpss-pas", .data = &sc7280_wpss_resource }, + { .compatible = "qcom,sc8180x-adsp-pas", .data = &sm8150_adsp_resource }, + { .compatible = "qcom,sc8180x-cdsp-pas", .data = &sm8150_cdsp_resource }, + { .compatible = "qcom,sc8180x-mpss-pas", .data = &sc8180x_mpss_resource }, + { .compatible = "qcom,sc8280xp-adsp-pas", .data = &sm8250_adsp_resource }, + { .compatible = "qcom,sc8280xp-nsp0-pas", .data = &sc8280xp_nsp0_resource }, + { .compatible = "qcom,sc8280xp-nsp1-pas", .data = &sc8280xp_nsp1_resource }, + { .compatible = "qcom,sdm660-adsp-pas", .data = &adsp_resource_init }, + { .compatible = "qcom,sdm660-cdsp-pas", .data = &cdsp_resource_init }, + { .compatible = "qcom,sdm845-adsp-pas", .data = &sdm845_adsp_resource_init }, + { .compatible = "qcom,sdm845-cdsp-pas", .data = &sdm845_cdsp_resource_init }, + { .compatible = "qcom,sdm845-slpi-pas", .data = &sdm845_slpi_resource_init }, + { .compatible = "qcom,sdx55-mpss-pas", .data = &sdx55_mpss_resource }, + { .compatible = "qcom,sdx75-mpss-pas", .data = &sm8650_mpss_resource }, + { .compatible = "qcom,sm6115-adsp-pas", .data = &adsp_resource_init }, + { .compatible = "qcom,sm6115-cdsp-pas", .data = &cdsp_resource_init }, + { .compatible = "qcom,sm6115-mpss-pas", .data = &sc8180x_mpss_resource }, + { .compatible = "qcom,sm6350-adsp-pas", .data = &sm6350_adsp_resource }, + { .compatible = "qcom,sm6350-cdsp-pas", .data = &sm6350_cdsp_resource }, + { .compatible = "qcom,sm6350-mpss-pas", .data = &mpss_resource_init }, + { .compatible = "qcom,sm6375-adsp-pas", .data = &sm6350_adsp_resource }, + { .compatible = "qcom,sm6375-cdsp-pas", .data = &sm8150_cdsp_resource }, + { .compatible = "qcom,sm6375-mpss-pas", .data = &sm6375_mpss_resource }, + { .compatible = "qcom,sm8150-adsp-pas", .data = &sm8150_adsp_resource }, + { .compatible = "qcom,sm8150-cdsp-pas", .data = &sm8150_cdsp_resource }, + { .compatible = "qcom,sm8150-mpss-pas", .data = &mpss_resource_init }, + { .compatible = "qcom,sm8150-slpi-pas", .data = &sdm845_slpi_resource_init }, + { .compatible = "qcom,sm8250-adsp-pas", .data = &sm8250_adsp_resource }, + { .compatible = "qcom,sm8250-cdsp-pas", .data = &sm8250_cdsp_resource }, + { .compatible = "qcom,sm8250-slpi-pas", .data = &sdm845_slpi_resource_init }, + { .compatible = "qcom,sm8350-adsp-pas", .data = &sm8350_adsp_resource }, + { .compatible = "qcom,sm8350-cdsp-pas", .data = &sm8350_cdsp_resource }, + { .compatible = "qcom,sm8350-slpi-pas", .data = &sdm845_slpi_resource_init }, + { .compatible = "qcom,sm8350-mpss-pas", .data = &mpss_resource_init }, + { .compatible = "qcom,sm8450-adsp-pas", .data = &sm8350_adsp_resource }, + { .compatible = "qcom,sm8450-cdsp-pas", .data = &sm8350_cdsp_resource }, + { .compatible = "qcom,sm8450-slpi-pas", .data = &sdm845_slpi_resource_init }, + { .compatible = "qcom,sm8450-mpss-pas", .data = &sm8450_mpss_resource }, + { .compatible = "qcom,sm8550-adsp-pas", .data = &sm8550_adsp_resource }, + { .compatible = "qcom,sm8550-cdsp-pas", .data = &sm8550_cdsp_resource }, + { .compatible = "qcom,sm8550-mpss-pas", .data = &sm8550_mpss_resource }, + { .compatible = "qcom,sm8650-adsp-pas", .data = &sm8550_adsp_resource }, + { .compatible = "qcom,sm8650-cdsp-pas", .data = &sm8650_cdsp_resource }, + { .compatible = "qcom,sm8650-mpss-pas", .data = &sm8650_mpss_resource }, + { .compatible = "qcom,sm8750-mpss-pas", .data = &sm8750_mpss_resource }, + { .compatible = "qcom,x1e80100-adsp-pas", .data = &x1e80100_adsp_resource }, + { .compatible = "qcom,x1e80100-cdsp-pas", .data = &x1e80100_cdsp_resource }, { }, }; MODULE_DEVICE_TABLE(of, qcom_pas_of_match); diff --git a/drivers/remoteproc/qcom_sysmon.c b/drivers/remoteproc/qcom_sysmon.c index 3ceec1fd6d99..913e3b750a86 100644 --- a/drivers/remoteproc/qcom_sysmon.c +++ b/drivers/remoteproc/qcom_sysmon.c @@ -677,7 +677,7 @@ struct qcom_sysmon *qcom_add_sysmon_subdev(struct rproc *rproc, return ERR_PTR(ret); } - qmi_add_lookup(&sysmon->qmi, 43, 0, 0); + qmi_add_lookup(&sysmon->qmi, QMI_SERVICE_ID_SSCTL, 0, 0); sysmon->subdev.prepare = sysmon_prepare; sysmon->subdev.start = sysmon_start; diff --git a/drivers/remoteproc/remoteproc_internal.h b/drivers/remoteproc/remoteproc_internal.h index 0cd09e67ac14..0a5e15744b1d 100644 --- a/drivers/remoteproc/remoteproc_internal.h +++ b/drivers/remoteproc/remoteproc_internal.h @@ -218,7 +218,7 @@ bool rproc_u64_fit_in_size_t(u64 val) if (sizeof(size_t) == sizeof(u64)) return true; - return (val <= (size_t) -1); + return val <= SIZE_MAX; } #endif /* REMOTEPROC_INTERNAL_H */ diff --git a/drivers/remoteproc/ti_k3_common.c b/drivers/remoteproc/ti_k3_common.c index 32aa954dc5be..3cb8ae5d72f6 100644 --- a/drivers/remoteproc/ti_k3_common.c +++ b/drivers/remoteproc/ti_k3_common.c @@ -513,7 +513,7 @@ int k3_reserved_mem_init(struct k3_rproc *kproc) kproc->rmem[i].dev_addr = (u32)res.start; kproc->rmem[i].size = resource_size(&res); kproc->rmem[i].cpu_addr = devm_ioremap_resource_wc(dev, &res); - if (!kproc->rmem[i].cpu_addr) { + if (IS_ERR(kproc->rmem[i].cpu_addr)) { dev_err(dev, "failed to map reserved memory#%d at %pR\n", i + 1, &res); return -ENOMEM; diff --git a/drivers/remoteproc/xlnx_r5_remoteproc.c b/drivers/remoteproc/xlnx_r5_remoteproc.c index b71ce69afe9f..50a9974f3202 100644 --- a/drivers/remoteproc/xlnx_r5_remoteproc.c +++ b/drivers/remoteproc/xlnx_r5_remoteproc.c @@ -232,17 +232,19 @@ static void zynqmp_r5_mb_rx_cb(struct mbox_client *cl, void *msg) ipi = container_of(cl, struct mbox_info, mbox_cl); - /* copy data from ipi buffer to r5_core */ + /* copy data from ipi buffer to r5_core if IPI is buffered. */ ipi_msg = (struct zynqmp_ipi_message *)msg; - buf_msg = (struct zynqmp_ipi_message *)ipi->rx_mc_buf; - len = ipi_msg->len; - if (len > IPI_BUF_LEN_MAX) { - dev_warn(cl->dev, "msg size exceeded than %d\n", - IPI_BUF_LEN_MAX); - len = IPI_BUF_LEN_MAX; + if (ipi_msg) { + buf_msg = (struct zynqmp_ipi_message *)ipi->rx_mc_buf; + len = ipi_msg->len; + if (len > IPI_BUF_LEN_MAX) { + dev_warn(cl->dev, "msg size exceeded than %d\n", + IPI_BUF_LEN_MAX); + len = IPI_BUF_LEN_MAX; + } + buf_msg->len = len; + memcpy(buf_msg->data, ipi_msg->data, len); } - buf_msg->len = len; - memcpy(buf_msg->data, ipi_msg->data, len); /* received and processed interrupt ack */ if (mbox_send_message(ipi->rx_chan, NULL) < 0) @@ -265,6 +267,10 @@ static struct mbox_info *zynqmp_r5_setup_mbox(struct device *cdev) struct mbox_client *mbox_cl; struct mbox_info *ipi; + if (!of_property_present(dev_of_node(cdev), "mboxes") || + !of_property_present(dev_of_node(cdev), "mbox-names")) + return NULL; + ipi = kzalloc_obj(*ipi); if (!ipi) return NULL; @@ -1005,7 +1011,7 @@ static int zynqmp_r5_get_sram_banks(struct zynqmp_r5_core *r5_core) } /* Get SRAM device address */ - ret = of_property_read_reg(sram_np, i, &abs_addr, &size); + ret = of_property_read_reg(sram_np, 0, &abs_addr, &size); if (ret) { dev_err(dev, "failed to get reg property\n"); goto fail_sram_get; @@ -1484,6 +1490,8 @@ static void zynqmp_r5_remoteproc_shutdown(struct platform_device *pdev) dev_err(cluster->dev, "failed to %s rproc %d\n", rproc_state_str, rproc->index); } + + zynqmp_r5_free_mbox(r5_core->ipi); } }