1 // SPDX-License-Identifier: GPL-2.0-only
3 * Qualcomm self-authenticating modem subsystem remoteproc driver
5 * Copyright (C) 2016 Linaro Ltd.
6 * Copyright (C) 2014 Sony Mobile Communications AB
7 * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
10 #include <linux/clk.h>
11 #include <linux/delay.h>
12 #include <linux/devcoredump.h>
13 #include <linux/dma-mapping.h>
14 #include <linux/interrupt.h>
15 #include <linux/kernel.h>
16 #include <linux/mfd/syscon.h>
17 #include <linux/module.h>
19 #include <linux/of_reserved_mem.h>
20 #include <linux/of_platform.h>
21 #include <linux/platform_device.h>
22 #include <linux/pm_domain.h>
23 #include <linux/pm_runtime.h>
24 #include <linux/regmap.h>
25 #include <linux/regulator/consumer.h>
26 #include <linux/remoteproc.h>
27 #include <linux/reset.h>
28 #include <linux/soc/qcom/mdt_loader.h>
29 #include <linux/iopoll.h>
30 #include <linux/slab.h>
32 #include "remoteproc_internal.h"
33 #include "qcom_common.h"
34 #include "qcom_pil_info.h"
35 #include "qcom_q6v5.h"
37 #include <linux/firmware/qcom/qcom_scm.h>
39 #define MPSS_CRASH_REASON_SMEM 421
41 #define MBA_LOG_SIZE SZ_4K
45 /* RMB Status Register Values */
46 #define RMB_PBL_SUCCESS 0x1
48 #define RMB_MBA_XPU_UNLOCKED 0x1
49 #define RMB_MBA_XPU_UNLOCKED_SCRIBBLED 0x2
50 #define RMB_MBA_META_DATA_AUTH_SUCCESS 0x3
51 #define RMB_MBA_AUTH_COMPLETE 0x4
53 /* PBL/MBA interface registers */
54 #define RMB_MBA_IMAGE_REG 0x00
55 #define RMB_PBL_STATUS_REG 0x04
56 #define RMB_MBA_COMMAND_REG 0x08
57 #define RMB_MBA_STATUS_REG 0x0C
58 #define RMB_PMI_META_DATA_REG 0x10
59 #define RMB_PMI_CODE_START_REG 0x14
60 #define RMB_PMI_CODE_LENGTH_REG 0x18
61 #define RMB_MBA_MSS_STATUS 0x40
62 #define RMB_MBA_ALT_RESET 0x44
64 #define RMB_CMD_META_DATA_READY 0x1
65 #define RMB_CMD_LOAD_READY 0x2
67 /* QDSP6SS Register Offsets */
68 #define QDSP6SS_RESET_REG 0x014
69 #define QDSP6SS_GFMUX_CTL_REG 0x020
70 #define QDSP6SS_PWR_CTL_REG 0x030
71 #define QDSP6SS_MEM_PWR_CTL 0x0B0
72 #define QDSP6V6SS_MEM_PWR_CTL 0x034
73 #define QDSP6SS_STRAP_ACC 0x110
74 #define QDSP6V62SS_BHS_STATUS 0x0C4
76 /* AXI Halt Register Offsets */
77 #define AXI_HALTREQ_REG 0x0
78 #define AXI_HALTACK_REG 0x4
79 #define AXI_IDLE_REG 0x8
80 #define AXI_GATING_VALID_OVERRIDE BIT(0)
82 #define HALT_ACK_TIMEOUT_US 100000
84 /* QACCEPT Register Offsets */
85 #define QACCEPT_ACCEPT_REG 0x0
86 #define QACCEPT_ACTIVE_REG 0x4
87 #define QACCEPT_DENY_REG 0x8
88 #define QACCEPT_REQ_REG 0xC
90 #define QACCEPT_TIMEOUT_US 50
93 #define Q6SS_STOP_CORE BIT(0)
94 #define Q6SS_CORE_ARES BIT(1)
95 #define Q6SS_BUS_ARES_ENABLE BIT(2)
98 #define Q6SS_CBCR_CLKEN BIT(0)
99 #define Q6SS_CBCR_CLKOFF BIT(31)
100 #define Q6SS_CBCR_TIMEOUT_US 200
102 /* QDSP6SS_GFMUX_CTL */
103 #define Q6SS_CLK_ENABLE BIT(1)
105 /* QDSP6SS_PWR_CTL */
106 #define Q6SS_L2DATA_SLP_NRET_N_0 BIT(0)
107 #define Q6SS_L2DATA_SLP_NRET_N_1 BIT(1)
108 #define Q6SS_L2DATA_SLP_NRET_N_2 BIT(2)
109 #define Q6SS_L2TAG_SLP_NRET_N BIT(16)
110 #define Q6SS_ETB_SLP_NRET_N BIT(17)
111 #define Q6SS_L2DATA_STBY_N BIT(18)
112 #define Q6SS_SLP_RET_N BIT(19)
113 #define Q6SS_CLAMP_IO BIT(20)
114 #define QDSS_BHS_ON BIT(21)
115 #define QDSS_LDO_BYP BIT(22)
117 /* QDSP6v55 parameters */
118 #define QDSP6V55_MEM_BITS GENMASK(16, 8)
120 /* QDSP6v56 parameters */
121 #define QDSP6v56_LDO_BYP BIT(25)
122 #define QDSP6v56_BHS_ON BIT(24)
123 #define QDSP6v56_CLAMP_WL BIT(21)
124 #define QDSP6v56_CLAMP_QMC_MEM BIT(22)
125 #define QDSP6SS_XO_CBCR 0x0038
126 #define QDSP6SS_ACC_OVERRIDE_VAL 0x20
127 #define QDSP6v55_BHS_EN_REST_ACK BIT(0)
129 /* QDSP6v65 parameters */
130 #define QDSP6SS_CORE_CBCR 0x20
131 #define QDSP6SS_SLEEP 0x3C
132 #define QDSP6SS_BOOT_CORE_START 0x400
133 #define QDSP6SS_BOOT_CMD 0x404
134 #define BOOT_FSM_TIMEOUT 10000
135 #define BHS_CHECK_MAX_LOOPS 200
138 struct regulator *reg;
143 struct qcom_mss_reg_res {
149 struct rproc_hexagon_res {
150 const char *hexagon_mba_image;
151 struct qcom_mss_reg_res *proxy_supply;
152 struct qcom_mss_reg_res *fallback_proxy_supply;
153 struct qcom_mss_reg_res *active_supply;
154 char **proxy_clk_names;
155 char **reset_clk_names;
156 char **active_clk_names;
157 char **proxy_pd_names;
159 bool need_mem_protection;
163 bool has_qaccept_regs;
164 bool has_ext_cntl_regs;
172 void __iomem *reg_base;
173 void __iomem *rmb_base;
175 struct regmap *halt_map;
176 struct regmap *conn_map;
193 struct reset_control *mss_restart;
194 struct reset_control *pdc_reset;
196 struct qcom_q6v5 q6v5;
198 struct clk *active_clks[8];
199 struct clk *reset_clks[4];
200 struct clk *proxy_clks[4];
201 struct device *proxy_pds[3];
202 int active_clk_count;
207 struct reg_info active_regs[1];
208 struct reg_info proxy_regs[1];
209 struct reg_info fallback_proxy_regs[2];
210 int active_reg_count;
212 int fallback_proxy_reg_count;
214 bool dump_mba_loaded;
215 size_t current_dump_size;
216 size_t total_dump_size;
218 phys_addr_t mba_phys;
222 phys_addr_t mdata_phys;
225 phys_addr_t mpss_phys;
226 phys_addr_t mpss_reloc;
229 struct qcom_rproc_glink glink_subdev;
230 struct qcom_rproc_subdev smd_subdev;
231 struct qcom_rproc_ssr ssr_subdev;
232 struct qcom_sysmon *sysmon;
233 struct platform_device *bam_dmux;
234 bool need_mem_protection;
238 bool has_qaccept_regs;
239 bool has_ext_cntl_regs;
243 const char *hexagon_mdt_image;
260 static int q6v5_regulator_init(struct device *dev, struct reg_info *regs,
261 const struct qcom_mss_reg_res *reg_res)
269 for (i = 0; reg_res[i].supply; i++) {
270 regs[i].reg = devm_regulator_get(dev, reg_res[i].supply);
271 if (IS_ERR(regs[i].reg)) {
272 rc = PTR_ERR(regs[i].reg);
273 if (rc != -EPROBE_DEFER)
274 dev_err(dev, "Failed to get %s\n regulator",
279 regs[i].uV = reg_res[i].uV;
280 regs[i].uA = reg_res[i].uA;
286 static int q6v5_regulator_enable(struct q6v5 *qproc,
287 struct reg_info *regs, int count)
292 for (i = 0; i < count; i++) {
293 if (regs[i].uV > 0) {
294 ret = regulator_set_voltage(regs[i].reg,
295 regs[i].uV, INT_MAX);
298 "Failed to request voltage for %d.\n",
304 if (regs[i].uA > 0) {
305 ret = regulator_set_load(regs[i].reg,
309 "Failed to set regulator mode\n");
314 ret = regulator_enable(regs[i].reg);
316 dev_err(qproc->dev, "Regulator enable failed\n");
323 for (; i >= 0; i--) {
325 regulator_set_voltage(regs[i].reg, 0, INT_MAX);
328 regulator_set_load(regs[i].reg, 0);
330 regulator_disable(regs[i].reg);
336 static void q6v5_regulator_disable(struct q6v5 *qproc,
337 struct reg_info *regs, int count)
341 for (i = 0; i < count; i++) {
343 regulator_set_voltage(regs[i].reg, 0, INT_MAX);
346 regulator_set_load(regs[i].reg, 0);
348 regulator_disable(regs[i].reg);
352 static int q6v5_clk_enable(struct device *dev,
353 struct clk **clks, int count)
358 for (i = 0; i < count; i++) {
359 rc = clk_prepare_enable(clks[i]);
361 dev_err(dev, "Clock enable failed\n");
368 for (i--; i >= 0; i--)
369 clk_disable_unprepare(clks[i]);
374 static void q6v5_clk_disable(struct device *dev,
375 struct clk **clks, int count)
379 for (i = 0; i < count; i++)
380 clk_disable_unprepare(clks[i]);
383 static int q6v5_pds_enable(struct q6v5 *qproc, struct device **pds,
389 for (i = 0; i < pd_count; i++) {
390 dev_pm_genpd_set_performance_state(pds[i], INT_MAX);
391 ret = pm_runtime_get_sync(pds[i]);
393 pm_runtime_put_noidle(pds[i]);
394 dev_pm_genpd_set_performance_state(pds[i], 0);
395 goto unroll_pd_votes;
402 for (i--; i >= 0; i--) {
403 dev_pm_genpd_set_performance_state(pds[i], 0);
404 pm_runtime_put(pds[i]);
410 static void q6v5_pds_disable(struct q6v5 *qproc, struct device **pds,
415 for (i = 0; i < pd_count; i++) {
416 dev_pm_genpd_set_performance_state(pds[i], 0);
417 pm_runtime_put(pds[i]);
421 static int q6v5_xfer_mem_ownership(struct q6v5 *qproc, u64 *current_perm,
422 bool local, bool remote, phys_addr_t addr,
425 struct qcom_scm_vmperm next[2];
428 if (!qproc->need_mem_protection)
431 if (local == !!(*current_perm & BIT(QCOM_SCM_VMID_HLOS)) &&
432 remote == !!(*current_perm & BIT(QCOM_SCM_VMID_MSS_MSA)))
436 next[perms].vmid = QCOM_SCM_VMID_HLOS;
437 next[perms].perm = QCOM_SCM_PERM_RWX;
442 next[perms].vmid = QCOM_SCM_VMID_MSS_MSA;
443 next[perms].perm = QCOM_SCM_PERM_RW;
447 return qcom_scm_assign_mem(addr, ALIGN(size, SZ_4K),
448 current_perm, next, perms);
451 static void q6v5_debug_policy_load(struct q6v5 *qproc, void *mba_region)
453 const struct firmware *dp_fw;
455 if (request_firmware_direct(&dp_fw, "msadp", qproc->dev))
458 if (SZ_1M + dp_fw->size <= qproc->mba_size) {
459 memcpy(mba_region + SZ_1M, dp_fw->data, dp_fw->size);
460 qproc->dp_size = dp_fw->size;
463 release_firmware(dp_fw);
466 static int q6v5_load(struct rproc *rproc, const struct firmware *fw)
468 struct q6v5 *qproc = rproc->priv;
471 /* MBA is restricted to a maximum size of 1M */
472 if (fw->size > qproc->mba_size || fw->size > SZ_1M) {
473 dev_err(qproc->dev, "MBA firmware load failed\n");
477 mba_region = memremap(qproc->mba_phys, qproc->mba_size, MEMREMAP_WC);
479 dev_err(qproc->dev, "unable to map memory region: %pa+%zx\n",
480 &qproc->mba_phys, qproc->mba_size);
484 memcpy(mba_region, fw->data, fw->size);
485 q6v5_debug_policy_load(qproc, mba_region);
486 memunmap(mba_region);
491 static int q6v5_reset_assert(struct q6v5 *qproc)
495 if (qproc->has_alt_reset) {
496 reset_control_assert(qproc->pdc_reset);
497 ret = reset_control_reset(qproc->mss_restart);
498 reset_control_deassert(qproc->pdc_reset);
499 } else if (qproc->has_spare_reg) {
501 * When the AXI pipeline is being reset with the Q6 modem partly
502 * operational there is possibility of AXI valid signal to
503 * glitch, leading to spurious transactions and Q6 hangs. A work
504 * around is employed by asserting the AXI_GATING_VALID_OVERRIDE
505 * BIT before triggering Q6 MSS reset. AXI_GATING_VALID_OVERRIDE
506 * is withdrawn post MSS assert followed by a MSS deassert,
507 * while holding the PDC reset.
509 reset_control_assert(qproc->pdc_reset);
510 regmap_update_bits(qproc->conn_map, qproc->conn_box,
511 AXI_GATING_VALID_OVERRIDE, 1);
512 reset_control_assert(qproc->mss_restart);
513 reset_control_deassert(qproc->pdc_reset);
514 regmap_update_bits(qproc->conn_map, qproc->conn_box,
515 AXI_GATING_VALID_OVERRIDE, 0);
516 ret = reset_control_deassert(qproc->mss_restart);
517 } else if (qproc->has_ext_cntl_regs) {
518 regmap_write(qproc->conn_map, qproc->rscc_disable, 0);
519 reset_control_assert(qproc->pdc_reset);
520 reset_control_assert(qproc->mss_restart);
521 reset_control_deassert(qproc->pdc_reset);
522 ret = reset_control_deassert(qproc->mss_restart);
524 ret = reset_control_assert(qproc->mss_restart);
530 static int q6v5_reset_deassert(struct q6v5 *qproc)
534 if (qproc->has_alt_reset) {
535 reset_control_assert(qproc->pdc_reset);
536 writel(1, qproc->rmb_base + RMB_MBA_ALT_RESET);
537 ret = reset_control_reset(qproc->mss_restart);
538 writel(0, qproc->rmb_base + RMB_MBA_ALT_RESET);
539 reset_control_deassert(qproc->pdc_reset);
540 } else if (qproc->has_spare_reg || qproc->has_ext_cntl_regs) {
541 ret = reset_control_reset(qproc->mss_restart);
543 ret = reset_control_deassert(qproc->mss_restart);
549 static int q6v5_rmb_pbl_wait(struct q6v5 *qproc, int ms)
551 unsigned long timeout;
554 timeout = jiffies + msecs_to_jiffies(ms);
556 val = readl(qproc->rmb_base + RMB_PBL_STATUS_REG);
560 if (time_after(jiffies, timeout))
569 static int q6v5_rmb_mba_wait(struct q6v5 *qproc, u32 status, int ms)
572 unsigned long timeout;
575 timeout = jiffies + msecs_to_jiffies(ms);
577 val = readl(qproc->rmb_base + RMB_MBA_STATUS_REG);
583 else if (status && val == status)
586 if (time_after(jiffies, timeout))
595 static void q6v5_dump_mba_logs(struct q6v5 *qproc)
597 struct rproc *rproc = qproc->rproc;
601 if (!qproc->has_mba_logs)
604 if (q6v5_xfer_mem_ownership(qproc, &qproc->mba_perm, true, false, qproc->mba_phys,
608 mba_region = memremap(qproc->mba_phys, qproc->mba_size, MEMREMAP_WC);
612 data = vmalloc(MBA_LOG_SIZE);
614 memcpy(data, mba_region, MBA_LOG_SIZE);
615 dev_coredumpv(&rproc->dev, data, MBA_LOG_SIZE, GFP_KERNEL);
617 memunmap(mba_region);
620 static int q6v5proc_reset(struct q6v5 *qproc)
626 if (qproc->version == MSS_SDM845) {
627 val = readl(qproc->reg_base + QDSP6SS_SLEEP);
628 val |= Q6SS_CBCR_CLKEN;
629 writel(val, qproc->reg_base + QDSP6SS_SLEEP);
631 ret = readl_poll_timeout(qproc->reg_base + QDSP6SS_SLEEP,
632 val, !(val & Q6SS_CBCR_CLKOFF), 1,
633 Q6SS_CBCR_TIMEOUT_US);
635 dev_err(qproc->dev, "QDSP6SS Sleep clock timed out\n");
639 /* De-assert QDSP6 stop core */
640 writel(1, qproc->reg_base + QDSP6SS_BOOT_CORE_START);
641 /* Trigger boot FSM */
642 writel(1, qproc->reg_base + QDSP6SS_BOOT_CMD);
644 ret = readl_poll_timeout(qproc->rmb_base + RMB_MBA_MSS_STATUS,
645 val, (val & BIT(0)) != 0, 10, BOOT_FSM_TIMEOUT);
647 dev_err(qproc->dev, "Boot FSM failed to complete.\n");
648 /* Reset the modem so that boot FSM is in reset state */
649 q6v5_reset_deassert(qproc);
654 } else if (qproc->version == MSS_SC7180 || qproc->version == MSS_SC7280) {
655 val = readl(qproc->reg_base + QDSP6SS_SLEEP);
656 val |= Q6SS_CBCR_CLKEN;
657 writel(val, qproc->reg_base + QDSP6SS_SLEEP);
659 ret = readl_poll_timeout(qproc->reg_base + QDSP6SS_SLEEP,
660 val, !(val & Q6SS_CBCR_CLKOFF), 1,
661 Q6SS_CBCR_TIMEOUT_US);
663 dev_err(qproc->dev, "QDSP6SS Sleep clock timed out\n");
667 /* Turn on the XO clock needed for PLL setup */
668 val = readl(qproc->reg_base + QDSP6SS_XO_CBCR);
669 val |= Q6SS_CBCR_CLKEN;
670 writel(val, qproc->reg_base + QDSP6SS_XO_CBCR);
672 ret = readl_poll_timeout(qproc->reg_base + QDSP6SS_XO_CBCR,
673 val, !(val & Q6SS_CBCR_CLKOFF), 1,
674 Q6SS_CBCR_TIMEOUT_US);
676 dev_err(qproc->dev, "QDSP6SS XO clock timed out\n");
680 /* Configure Q6 core CBCR to auto-enable after reset sequence */
681 val = readl(qproc->reg_base + QDSP6SS_CORE_CBCR);
682 val |= Q6SS_CBCR_CLKEN;
683 writel(val, qproc->reg_base + QDSP6SS_CORE_CBCR);
685 /* De-assert the Q6 stop core signal */
686 writel(1, qproc->reg_base + QDSP6SS_BOOT_CORE_START);
688 /* Wait for 10 us for any staggering logic to settle */
689 usleep_range(10, 20);
691 /* Trigger the boot FSM to start the Q6 out-of-reset sequence */
692 writel(1, qproc->reg_base + QDSP6SS_BOOT_CMD);
694 /* Poll the MSS_STATUS for FSM completion */
695 ret = readl_poll_timeout(qproc->rmb_base + RMB_MBA_MSS_STATUS,
696 val, (val & BIT(0)) != 0, 10, BOOT_FSM_TIMEOUT);
698 dev_err(qproc->dev, "Boot FSM failed to complete.\n");
699 /* Reset the modem so that boot FSM is in reset state */
700 q6v5_reset_deassert(qproc);
704 } else if (qproc->version == MSS_MSM8909 ||
705 qproc->version == MSS_MSM8953 ||
706 qproc->version == MSS_MSM8996 ||
707 qproc->version == MSS_MSM8998 ||
708 qproc->version == MSS_SDM660) {
710 if (qproc->version != MSS_MSM8909 &&
711 qproc->version != MSS_MSM8953)
712 /* Override the ACC value if required */
713 writel(QDSP6SS_ACC_OVERRIDE_VAL,
714 qproc->reg_base + QDSP6SS_STRAP_ACC);
716 /* Assert resets, stop core */
717 val = readl(qproc->reg_base + QDSP6SS_RESET_REG);
718 val |= Q6SS_CORE_ARES | Q6SS_BUS_ARES_ENABLE | Q6SS_STOP_CORE;
719 writel(val, qproc->reg_base + QDSP6SS_RESET_REG);
721 /* BHS require xo cbcr to be enabled */
722 val = readl(qproc->reg_base + QDSP6SS_XO_CBCR);
723 val |= Q6SS_CBCR_CLKEN;
724 writel(val, qproc->reg_base + QDSP6SS_XO_CBCR);
726 /* Read CLKOFF bit to go low indicating CLK is enabled */
727 ret = readl_poll_timeout(qproc->reg_base + QDSP6SS_XO_CBCR,
728 val, !(val & Q6SS_CBCR_CLKOFF), 1,
729 Q6SS_CBCR_TIMEOUT_US);
732 "xo cbcr enabling timed out (rc:%d)\n", ret);
735 /* Enable power block headswitch and wait for it to stabilize */
736 val = readl(qproc->reg_base + QDSP6SS_PWR_CTL_REG);
737 val |= QDSP6v56_BHS_ON;
738 writel(val, qproc->reg_base + QDSP6SS_PWR_CTL_REG);
739 val |= readl(qproc->reg_base + QDSP6SS_PWR_CTL_REG);
742 if (qproc->version == MSS_SDM660) {
743 ret = readl_relaxed_poll_timeout(qproc->reg_base + QDSP6V62SS_BHS_STATUS,
744 i, (i & QDSP6v55_BHS_EN_REST_ACK),
745 1, BHS_CHECK_MAX_LOOPS);
746 if (ret == -ETIMEDOUT) {
747 dev_err(qproc->dev, "BHS_EN_REST_ACK not set!\n");
752 /* Put LDO in bypass mode */
753 val |= QDSP6v56_LDO_BYP;
754 writel(val, qproc->reg_base + QDSP6SS_PWR_CTL_REG);
756 if (qproc->version != MSS_MSM8909) {
759 /* Deassert QDSP6 compiler memory clamp */
760 val = readl(qproc->reg_base + QDSP6SS_PWR_CTL_REG);
761 val &= ~QDSP6v56_CLAMP_QMC_MEM;
762 writel(val, qproc->reg_base + QDSP6SS_PWR_CTL_REG);
764 /* Deassert memory peripheral sleep and L2 memory standby */
765 val |= Q6SS_L2DATA_STBY_N | Q6SS_SLP_RET_N;
766 writel(val, qproc->reg_base + QDSP6SS_PWR_CTL_REG);
768 /* Turn on L1, L2, ETB and JU memories 1 at a time */
769 if (qproc->version == MSS_MSM8953 ||
770 qproc->version == MSS_MSM8996) {
771 mem_pwr_ctl = QDSP6SS_MEM_PWR_CTL;
774 /* MSS_MSM8998, MSS_SDM660 */
775 mem_pwr_ctl = QDSP6V6SS_MEM_PWR_CTL;
778 val = readl(qproc->reg_base + mem_pwr_ctl);
779 for (; i >= 0; i--) {
781 writel(val, qproc->reg_base + mem_pwr_ctl);
783 * Read back value to ensure the write is done then
784 * wait for 1us for both memory peripheral and data
787 val |= readl(qproc->reg_base + mem_pwr_ctl);
791 /* Turn on memories */
792 val = readl(qproc->reg_base + QDSP6SS_PWR_CTL_REG);
793 val |= Q6SS_SLP_RET_N | Q6SS_L2DATA_STBY_N |
794 Q6SS_ETB_SLP_NRET_N | QDSP6V55_MEM_BITS;
795 writel(val, qproc->reg_base + QDSP6SS_PWR_CTL_REG);
797 /* Turn on L2 banks 1 at a time */
798 for (i = 0; i <= 7; i++) {
800 writel(val, qproc->reg_base + QDSP6SS_PWR_CTL_REG);
804 /* Remove word line clamp */
805 val = readl(qproc->reg_base + QDSP6SS_PWR_CTL_REG);
806 val &= ~QDSP6v56_CLAMP_WL;
807 writel(val, qproc->reg_base + QDSP6SS_PWR_CTL_REG);
809 /* Assert resets, stop core */
810 val = readl(qproc->reg_base + QDSP6SS_RESET_REG);
811 val |= Q6SS_CORE_ARES | Q6SS_BUS_ARES_ENABLE | Q6SS_STOP_CORE;
812 writel(val, qproc->reg_base + QDSP6SS_RESET_REG);
814 /* Enable power block headswitch and wait for it to stabilize */
815 val = readl(qproc->reg_base + QDSP6SS_PWR_CTL_REG);
816 val |= QDSS_BHS_ON | QDSS_LDO_BYP;
817 writel(val, qproc->reg_base + QDSP6SS_PWR_CTL_REG);
818 val |= readl(qproc->reg_base + QDSP6SS_PWR_CTL_REG);
821 * Turn on memories. L2 banks should be done individually
822 * to minimize inrush current.
824 val = readl(qproc->reg_base + QDSP6SS_PWR_CTL_REG);
825 val |= Q6SS_SLP_RET_N | Q6SS_L2TAG_SLP_NRET_N |
826 Q6SS_ETB_SLP_NRET_N | Q6SS_L2DATA_STBY_N;
827 writel(val, qproc->reg_base + QDSP6SS_PWR_CTL_REG);
828 val |= Q6SS_L2DATA_SLP_NRET_N_2;
829 writel(val, qproc->reg_base + QDSP6SS_PWR_CTL_REG);
830 val |= Q6SS_L2DATA_SLP_NRET_N_1;
831 writel(val, qproc->reg_base + QDSP6SS_PWR_CTL_REG);
832 val |= Q6SS_L2DATA_SLP_NRET_N_0;
833 writel(val, qproc->reg_base + QDSP6SS_PWR_CTL_REG);
835 /* Remove IO clamp */
836 val &= ~Q6SS_CLAMP_IO;
837 writel(val, qproc->reg_base + QDSP6SS_PWR_CTL_REG);
839 /* Bring core out of reset */
840 val = readl(qproc->reg_base + QDSP6SS_RESET_REG);
841 val &= ~Q6SS_CORE_ARES;
842 writel(val, qproc->reg_base + QDSP6SS_RESET_REG);
844 /* Turn on core clock */
845 val = readl(qproc->reg_base + QDSP6SS_GFMUX_CTL_REG);
846 val |= Q6SS_CLK_ENABLE;
847 writel(val, qproc->reg_base + QDSP6SS_GFMUX_CTL_REG);
849 /* Start core execution */
850 val = readl(qproc->reg_base + QDSP6SS_RESET_REG);
851 val &= ~Q6SS_STOP_CORE;
852 writel(val, qproc->reg_base + QDSP6SS_RESET_REG);
855 /* Wait for PBL status */
856 ret = q6v5_rmb_pbl_wait(qproc, 1000);
857 if (ret == -ETIMEDOUT) {
858 dev_err(qproc->dev, "PBL boot timed out\n");
859 } else if (ret != RMB_PBL_SUCCESS) {
860 dev_err(qproc->dev, "PBL returned unexpected status %d\n", ret);
869 static int q6v5proc_enable_qchannel(struct q6v5 *qproc, struct regmap *map, u32 offset)
874 if (!qproc->has_qaccept_regs)
877 if (qproc->has_ext_cntl_regs) {
878 regmap_write(qproc->conn_map, qproc->rscc_disable, 0);
879 regmap_write(qproc->conn_map, qproc->force_clk_on, 1);
881 ret = regmap_read_poll_timeout(qproc->halt_map, qproc->axim1_clk_off, val,
882 !val, 1, Q6SS_CBCR_TIMEOUT_US);
884 dev_err(qproc->dev, "failed to enable axim1 clock\n");
889 regmap_write(map, offset + QACCEPT_REQ_REG, 1);
891 /* Wait for accept */
892 ret = regmap_read_poll_timeout(map, offset + QACCEPT_ACCEPT_REG, val, val, 5,
895 dev_err(qproc->dev, "qchannel enable failed\n");
902 static void q6v5proc_disable_qchannel(struct q6v5 *qproc, struct regmap *map, u32 offset)
905 unsigned int val, retry;
906 unsigned int nretry = 10;
907 bool takedown_complete = false;
909 if (!qproc->has_qaccept_regs)
912 while (!takedown_complete && nretry) {
915 /* Wait for active transactions to complete */
916 regmap_read_poll_timeout(map, offset + QACCEPT_ACTIVE_REG, val, !val, 5,
919 /* Request Q-channel transaction takedown */
920 regmap_write(map, offset + QACCEPT_REQ_REG, 0);
923 * If the request is denied, reset the Q-channel takedown request,
924 * wait for active transactions to complete and retry takedown.
930 ret = regmap_read(map, offset + QACCEPT_DENY_REG, &val);
932 regmap_write(map, offset + QACCEPT_REQ_REG, 1);
936 ret = regmap_read(map, offset + QACCEPT_ACCEPT_REG, &val);
938 takedown_complete = true;
947 /* Rely on mss_restart to clear out pending transactions on takedown failure */
948 if (!takedown_complete)
949 dev_err(qproc->dev, "qchannel takedown failed\n");
952 static void q6v5proc_halt_axi_port(struct q6v5 *qproc,
953 struct regmap *halt_map,
959 /* Check if we're already idle */
960 ret = regmap_read(halt_map, offset + AXI_IDLE_REG, &val);
964 /* Assert halt request */
965 regmap_write(halt_map, offset + AXI_HALTREQ_REG, 1);
968 regmap_read_poll_timeout(halt_map, offset + AXI_HALTACK_REG, val,
969 val, 1000, HALT_ACK_TIMEOUT_US);
971 ret = regmap_read(halt_map, offset + AXI_IDLE_REG, &val);
973 dev_err(qproc->dev, "port failed halt\n");
975 /* Clear halt request (port will remain halted until reset) */
976 regmap_write(halt_map, offset + AXI_HALTREQ_REG, 0);
979 static int q6v5_mpss_init_image(struct q6v5 *qproc, const struct firmware *fw,
982 unsigned long dma_attrs = DMA_ATTR_FORCE_CONTIGUOUS;
991 metadata = qcom_mdt_read_metadata(fw, &size, fw_name, qproc->dev);
992 if (IS_ERR(metadata))
993 return PTR_ERR(metadata);
995 if (qproc->mdata_phys) {
996 if (size > qproc->mdata_size) {
998 dev_err(qproc->dev, "metadata size outside memory range\n");
1002 phys = qproc->mdata_phys;
1003 ptr = memremap(qproc->mdata_phys, size, MEMREMAP_WC);
1006 dev_err(qproc->dev, "unable to map memory region: %pa+%zx\n",
1007 &qproc->mdata_phys, size);
1011 ptr = dma_alloc_attrs(qproc->dev, size, &phys, GFP_KERNEL, dma_attrs);
1014 dev_err(qproc->dev, "failed to allocate mdt buffer\n");
1019 memcpy(ptr, metadata, size);
1021 if (qproc->mdata_phys)
1024 /* Hypervisor mapping to access metadata by modem */
1025 mdata_perm = BIT(QCOM_SCM_VMID_HLOS);
1026 ret = q6v5_xfer_mem_ownership(qproc, &mdata_perm, false, true,
1030 "assigning Q6 access to metadata failed: %d\n", ret);
1032 goto free_dma_attrs;
1035 writel(phys, qproc->rmb_base + RMB_PMI_META_DATA_REG);
1036 writel(RMB_CMD_META_DATA_READY, qproc->rmb_base + RMB_MBA_COMMAND_REG);
1038 ret = q6v5_rmb_mba_wait(qproc, RMB_MBA_META_DATA_AUTH_SUCCESS, 1000);
1039 if (ret == -ETIMEDOUT)
1040 dev_err(qproc->dev, "MPSS header authentication timed out\n");
1042 dev_err(qproc->dev, "MPSS header authentication failed: %d\n", ret);
1044 /* Metadata authentication done, remove modem access */
1045 xferop_ret = q6v5_xfer_mem_ownership(qproc, &mdata_perm, true, false,
1048 dev_warn(qproc->dev,
1049 "mdt buffer not reclaimed system may become unstable\n");
1052 if (!qproc->mdata_phys)
1053 dma_free_attrs(qproc->dev, size, ptr, phys, dma_attrs);
1057 return ret < 0 ? ret : 0;
1060 static bool q6v5_phdr_valid(const struct elf32_phdr *phdr)
1062 if (phdr->p_type != PT_LOAD)
1065 if ((phdr->p_flags & QCOM_MDT_TYPE_MASK) == QCOM_MDT_TYPE_HASH)
1074 static int q6v5_mba_load(struct q6v5 *qproc)
1078 bool mba_load_err = false;
1080 ret = qcom_q6v5_prepare(&qproc->q6v5);
1084 ret = q6v5_pds_enable(qproc, qproc->proxy_pds, qproc->proxy_pd_count);
1086 dev_err(qproc->dev, "failed to enable proxy power domains\n");
1090 ret = q6v5_regulator_enable(qproc, qproc->fallback_proxy_regs,
1091 qproc->fallback_proxy_reg_count);
1093 dev_err(qproc->dev, "failed to enable fallback proxy supplies\n");
1094 goto disable_proxy_pds;
1097 ret = q6v5_regulator_enable(qproc, qproc->proxy_regs,
1098 qproc->proxy_reg_count);
1100 dev_err(qproc->dev, "failed to enable proxy supplies\n");
1101 goto disable_fallback_proxy_reg;
1104 ret = q6v5_clk_enable(qproc->dev, qproc->proxy_clks,
1105 qproc->proxy_clk_count);
1107 dev_err(qproc->dev, "failed to enable proxy clocks\n");
1108 goto disable_proxy_reg;
1111 ret = q6v5_regulator_enable(qproc, qproc->active_regs,
1112 qproc->active_reg_count);
1114 dev_err(qproc->dev, "failed to enable supplies\n");
1115 goto disable_proxy_clk;
1118 ret = q6v5_clk_enable(qproc->dev, qproc->reset_clks,
1119 qproc->reset_clk_count);
1121 dev_err(qproc->dev, "failed to enable reset clocks\n");
1125 ret = q6v5_reset_deassert(qproc);
1127 dev_err(qproc->dev, "failed to deassert mss restart\n");
1128 goto disable_reset_clks;
1131 ret = q6v5_clk_enable(qproc->dev, qproc->active_clks,
1132 qproc->active_clk_count);
1134 dev_err(qproc->dev, "failed to enable clocks\n");
1138 ret = q6v5proc_enable_qchannel(qproc, qproc->halt_map, qproc->qaccept_axi);
1140 dev_err(qproc->dev, "failed to enable axi bridge\n");
1141 goto disable_active_clks;
1145 * Some versions of the MBA firmware will upon boot wipe the MPSS region as well, so provide
1146 * the Q6 access to this region.
1148 ret = q6v5_xfer_mem_ownership(qproc, &qproc->mpss_perm, false, true,
1149 qproc->mpss_phys, qproc->mpss_size);
1151 dev_err(qproc->dev, "assigning Q6 access to mpss memory failed: %d\n", ret);
1152 goto disable_active_clks;
1155 /* Assign MBA image access in DDR to q6 */
1156 ret = q6v5_xfer_mem_ownership(qproc, &qproc->mba_perm, false, true,
1157 qproc->mba_phys, qproc->mba_size);
1160 "assigning Q6 access to mba memory failed: %d\n", ret);
1161 goto disable_active_clks;
1164 writel(qproc->mba_phys, qproc->rmb_base + RMB_MBA_IMAGE_REG);
1165 if (qproc->dp_size) {
1166 writel(qproc->mba_phys + SZ_1M, qproc->rmb_base + RMB_PMI_CODE_START_REG);
1167 writel(qproc->dp_size, qproc->rmb_base + RMB_PMI_CODE_LENGTH_REG);
1170 ret = q6v5proc_reset(qproc);
1174 if (qproc->has_mba_logs)
1175 qcom_pil_info_store("mba", qproc->mba_phys, MBA_LOG_SIZE);
1177 ret = q6v5_rmb_mba_wait(qproc, 0, 5000);
1178 if (ret == -ETIMEDOUT) {
1179 dev_err(qproc->dev, "MBA boot timed out\n");
1180 goto halt_axi_ports;
1181 } else if (ret != RMB_MBA_XPU_UNLOCKED &&
1182 ret != RMB_MBA_XPU_UNLOCKED_SCRIBBLED) {
1183 dev_err(qproc->dev, "MBA returned unexpected status %d\n", ret);
1185 goto halt_axi_ports;
1188 qproc->dump_mba_loaded = true;
1192 q6v5proc_halt_axi_port(qproc, qproc->halt_map, qproc->halt_q6);
1194 q6v5proc_halt_axi_port(qproc, qproc->halt_map, qproc->halt_vq6);
1195 q6v5proc_halt_axi_port(qproc, qproc->halt_map, qproc->halt_modem);
1196 q6v5proc_halt_axi_port(qproc, qproc->halt_map, qproc->halt_nc);
1197 q6v5proc_disable_qchannel(qproc, qproc->halt_map, qproc->qaccept_mdm);
1198 q6v5proc_disable_qchannel(qproc, qproc->halt_map, qproc->qaccept_cx);
1199 q6v5proc_disable_qchannel(qproc, qproc->halt_map, qproc->qaccept_axi);
1200 mba_load_err = true;
1202 xfermemop_ret = q6v5_xfer_mem_ownership(qproc, &qproc->mba_perm, true,
1203 false, qproc->mba_phys,
1205 if (xfermemop_ret) {
1207 "Failed to reclaim mba buffer, system may become unstable\n");
1208 } else if (mba_load_err) {
1209 q6v5_dump_mba_logs(qproc);
1212 disable_active_clks:
1213 q6v5_clk_disable(qproc->dev, qproc->active_clks,
1214 qproc->active_clk_count);
1216 q6v5_reset_assert(qproc);
1218 q6v5_clk_disable(qproc->dev, qproc->reset_clks,
1219 qproc->reset_clk_count);
1221 q6v5_regulator_disable(qproc, qproc->active_regs,
1222 qproc->active_reg_count);
1224 q6v5_clk_disable(qproc->dev, qproc->proxy_clks,
1225 qproc->proxy_clk_count);
1227 q6v5_regulator_disable(qproc, qproc->proxy_regs,
1228 qproc->proxy_reg_count);
1229 disable_fallback_proxy_reg:
1230 q6v5_regulator_disable(qproc, qproc->fallback_proxy_regs,
1231 qproc->fallback_proxy_reg_count);
1233 q6v5_pds_disable(qproc, qproc->proxy_pds, qproc->proxy_pd_count);
1235 qcom_q6v5_unprepare(&qproc->q6v5);
1240 static void q6v5_mba_reclaim(struct q6v5 *qproc)
1245 qproc->dump_mba_loaded = false;
1248 q6v5proc_halt_axi_port(qproc, qproc->halt_map, qproc->halt_q6);
1250 q6v5proc_halt_axi_port(qproc, qproc->halt_map, qproc->halt_vq6);
1251 q6v5proc_halt_axi_port(qproc, qproc->halt_map, qproc->halt_modem);
1252 q6v5proc_halt_axi_port(qproc, qproc->halt_map, qproc->halt_nc);
1253 if (qproc->version == MSS_MSM8996) {
1255 * To avoid high MX current during LPASS/MSS restart.
1257 val = readl(qproc->reg_base + QDSP6SS_PWR_CTL_REG);
1258 val |= Q6SS_CLAMP_IO | QDSP6v56_CLAMP_WL |
1259 QDSP6v56_CLAMP_QMC_MEM;
1260 writel(val, qproc->reg_base + QDSP6SS_PWR_CTL_REG);
1263 if (qproc->has_ext_cntl_regs) {
1264 regmap_write(qproc->conn_map, qproc->rscc_disable, 1);
1266 ret = regmap_read_poll_timeout(qproc->halt_map, qproc->axim1_clk_off, val,
1267 !val, 1, Q6SS_CBCR_TIMEOUT_US);
1269 dev_err(qproc->dev, "failed to enable axim1 clock\n");
1271 ret = regmap_read_poll_timeout(qproc->halt_map, qproc->crypto_clk_off, val,
1272 !val, 1, Q6SS_CBCR_TIMEOUT_US);
1274 dev_err(qproc->dev, "failed to enable crypto clock\n");
1277 q6v5proc_disable_qchannel(qproc, qproc->halt_map, qproc->qaccept_mdm);
1278 q6v5proc_disable_qchannel(qproc, qproc->halt_map, qproc->qaccept_cx);
1279 q6v5proc_disable_qchannel(qproc, qproc->halt_map, qproc->qaccept_axi);
1281 q6v5_reset_assert(qproc);
1283 q6v5_clk_disable(qproc->dev, qproc->reset_clks,
1284 qproc->reset_clk_count);
1285 q6v5_clk_disable(qproc->dev, qproc->active_clks,
1286 qproc->active_clk_count);
1287 q6v5_regulator_disable(qproc, qproc->active_regs,
1288 qproc->active_reg_count);
1290 /* In case of failure or coredump scenario where reclaiming MBA memory
1291 * could not happen reclaim it here.
1293 ret = q6v5_xfer_mem_ownership(qproc, &qproc->mba_perm, true, false,
1298 ret = qcom_q6v5_unprepare(&qproc->q6v5);
1300 q6v5_pds_disable(qproc, qproc->proxy_pds,
1301 qproc->proxy_pd_count);
1302 q6v5_clk_disable(qproc->dev, qproc->proxy_clks,
1303 qproc->proxy_clk_count);
1304 q6v5_regulator_disable(qproc, qproc->fallback_proxy_regs,
1305 qproc->fallback_proxy_reg_count);
1306 q6v5_regulator_disable(qproc, qproc->proxy_regs,
1307 qproc->proxy_reg_count);
1311 static int q6v5_reload_mba(struct rproc *rproc)
1313 struct q6v5 *qproc = rproc->priv;
1314 const struct firmware *fw;
1317 ret = request_firmware(&fw, rproc->firmware, qproc->dev);
1321 q6v5_load(rproc, fw);
1322 ret = q6v5_mba_load(qproc);
1323 release_firmware(fw);
1328 static int q6v5_mpss_load(struct q6v5 *qproc)
1330 const struct elf32_phdr *phdrs;
1331 const struct elf32_phdr *phdr;
1332 const struct firmware *seg_fw;
1333 const struct firmware *fw;
1334 struct elf32_hdr *ehdr;
1335 phys_addr_t mpss_reloc;
1336 phys_addr_t boot_addr;
1337 phys_addr_t min_addr = PHYS_ADDR_MAX;
1338 phys_addr_t max_addr = 0;
1340 bool relocate = false;
1349 fw_name_len = strlen(qproc->hexagon_mdt_image);
1350 if (fw_name_len <= 4)
1353 fw_name = kstrdup(qproc->hexagon_mdt_image, GFP_KERNEL);
1357 ret = request_firmware(&fw, fw_name, qproc->dev);
1359 dev_err(qproc->dev, "unable to load %s\n", fw_name);
1363 /* Initialize the RMB validator */
1364 writel(0, qproc->rmb_base + RMB_PMI_CODE_LENGTH_REG);
1366 ret = q6v5_mpss_init_image(qproc, fw, qproc->hexagon_mdt_image);
1368 goto release_firmware;
1370 ehdr = (struct elf32_hdr *)fw->data;
1371 phdrs = (struct elf32_phdr *)(ehdr + 1);
1373 for (i = 0; i < ehdr->e_phnum; i++) {
1376 if (!q6v5_phdr_valid(phdr))
1379 if (phdr->p_flags & QCOM_MDT_RELOCATABLE)
1382 if (phdr->p_paddr < min_addr)
1383 min_addr = phdr->p_paddr;
1385 if (phdr->p_paddr + phdr->p_memsz > max_addr)
1386 max_addr = ALIGN(phdr->p_paddr + phdr->p_memsz, SZ_4K);
1389 if (qproc->version == MSS_MSM8953) {
1390 ret = qcom_scm_pas_mem_setup(MPSS_PAS_ID, qproc->mpss_phys, qproc->mpss_size);
1393 "setting up mpss memory failed: %d\n", ret);
1394 goto release_firmware;
1399 * In case of a modem subsystem restart on secure devices, the modem
1400 * memory can be reclaimed only after MBA is loaded.
1402 q6v5_xfer_mem_ownership(qproc, &qproc->mpss_perm, true, false,
1403 qproc->mpss_phys, qproc->mpss_size);
1405 /* Share ownership between Linux and MSS, during segment loading */
1406 ret = q6v5_xfer_mem_ownership(qproc, &qproc->mpss_perm, true, true,
1407 qproc->mpss_phys, qproc->mpss_size);
1410 "assigning Q6 access to mpss memory failed: %d\n", ret);
1412 goto release_firmware;
1415 mpss_reloc = relocate ? min_addr : qproc->mpss_phys;
1416 qproc->mpss_reloc = mpss_reloc;
1417 /* Load firmware segments */
1418 for (i = 0; i < ehdr->e_phnum; i++) {
1421 if (!q6v5_phdr_valid(phdr))
1424 offset = phdr->p_paddr - mpss_reloc;
1425 if (offset < 0 || offset + phdr->p_memsz > qproc->mpss_size) {
1426 dev_err(qproc->dev, "segment outside memory range\n");
1428 goto release_firmware;
1431 if (phdr->p_filesz > phdr->p_memsz) {
1433 "refusing to load segment %d with p_filesz > p_memsz\n",
1436 goto release_firmware;
1439 ptr = memremap(qproc->mpss_phys + offset, phdr->p_memsz, MEMREMAP_WC);
1442 "unable to map memory region: %pa+%zx-%x\n",
1443 &qproc->mpss_phys, offset, phdr->p_memsz);
1444 goto release_firmware;
1447 if (phdr->p_filesz && phdr->p_offset < fw->size) {
1448 /* Firmware is large enough to be non-split */
1449 if (phdr->p_offset + phdr->p_filesz > fw->size) {
1451 "failed to load segment %d from truncated file %s\n",
1455 goto release_firmware;
1458 memcpy(ptr, fw->data + phdr->p_offset, phdr->p_filesz);
1459 } else if (phdr->p_filesz) {
1460 /* Replace "xxx.xxx" with "xxx.bxx" */
1461 sprintf(fw_name + fw_name_len - 3, "b%02d", i);
1462 ret = request_firmware_into_buf(&seg_fw, fw_name, qproc->dev,
1463 ptr, phdr->p_filesz);
1465 dev_err(qproc->dev, "failed to load %s\n", fw_name);
1467 goto release_firmware;
1470 if (seg_fw->size != phdr->p_filesz) {
1472 "failed to load segment %d from truncated file %s\n",
1475 release_firmware(seg_fw);
1477 goto release_firmware;
1480 release_firmware(seg_fw);
1483 if (phdr->p_memsz > phdr->p_filesz) {
1484 memset(ptr + phdr->p_filesz, 0,
1485 phdr->p_memsz - phdr->p_filesz);
1488 size += phdr->p_memsz;
1490 code_length = readl(qproc->rmb_base + RMB_PMI_CODE_LENGTH_REG);
1492 boot_addr = relocate ? qproc->mpss_phys : min_addr;
1493 writel(boot_addr, qproc->rmb_base + RMB_PMI_CODE_START_REG);
1494 writel(RMB_CMD_LOAD_READY, qproc->rmb_base + RMB_MBA_COMMAND_REG);
1496 writel(size, qproc->rmb_base + RMB_PMI_CODE_LENGTH_REG);
1498 ret = readl(qproc->rmb_base + RMB_MBA_STATUS_REG);
1500 dev_err(qproc->dev, "MPSS authentication failed: %d\n",
1502 goto release_firmware;
1506 /* Transfer ownership of modem ddr region to q6 */
1507 ret = q6v5_xfer_mem_ownership(qproc, &qproc->mpss_perm, false, true,
1508 qproc->mpss_phys, qproc->mpss_size);
1511 "assigning Q6 access to mpss memory failed: %d\n", ret);
1513 goto release_firmware;
1516 ret = q6v5_rmb_mba_wait(qproc, RMB_MBA_AUTH_COMPLETE, 10000);
1517 if (ret == -ETIMEDOUT)
1518 dev_err(qproc->dev, "MPSS authentication timed out\n");
1520 dev_err(qproc->dev, "MPSS authentication failed: %d\n", ret);
1522 qcom_pil_info_store("modem", qproc->mpss_phys, qproc->mpss_size);
1525 release_firmware(fw);
1529 return ret < 0 ? ret : 0;
1532 static void qcom_q6v5_dump_segment(struct rproc *rproc,
1533 struct rproc_dump_segment *segment,
1534 void *dest, size_t cp_offset, size_t size)
1537 struct q6v5 *qproc = rproc->priv;
1538 int offset = segment->da - qproc->mpss_reloc;
1541 /* Unlock mba before copying segments */
1542 if (!qproc->dump_mba_loaded) {
1543 ret = q6v5_reload_mba(rproc);
1545 /* Reset ownership back to Linux to copy segments */
1546 ret = q6v5_xfer_mem_ownership(qproc, &qproc->mpss_perm,
1554 ptr = memremap(qproc->mpss_phys + offset + cp_offset, size, MEMREMAP_WC);
1557 memcpy(dest, ptr, size);
1560 memset(dest, 0xff, size);
1563 qproc->current_dump_size += size;
1565 /* Reclaim mba after copying segments */
1566 if (qproc->current_dump_size == qproc->total_dump_size) {
1567 if (qproc->dump_mba_loaded) {
1568 /* Try to reset ownership back to Q6 */
1569 q6v5_xfer_mem_ownership(qproc, &qproc->mpss_perm,
1573 q6v5_mba_reclaim(qproc);
1578 static int q6v5_start(struct rproc *rproc)
1580 struct q6v5 *qproc = rproc->priv;
1584 ret = q6v5_mba_load(qproc);
1588 dev_info(qproc->dev, "MBA booted with%s debug policy, loading mpss\n",
1589 qproc->dp_size ? "" : "out");
1591 ret = q6v5_mpss_load(qproc);
1595 ret = qcom_q6v5_wait_for_start(&qproc->q6v5, msecs_to_jiffies(5000));
1596 if (ret == -ETIMEDOUT) {
1597 dev_err(qproc->dev, "start timed out\n");
1601 xfermemop_ret = q6v5_xfer_mem_ownership(qproc, &qproc->mba_perm, true,
1602 false, qproc->mba_phys,
1606 "Failed to reclaim mba buffer system may become unstable\n");
1608 /* Reset Dump Segment Mask */
1609 qproc->current_dump_size = 0;
1614 q6v5_mba_reclaim(qproc);
1615 q6v5_dump_mba_logs(qproc);
1620 static int q6v5_stop(struct rproc *rproc)
1622 struct q6v5 *qproc = rproc->priv;
1625 ret = qcom_q6v5_request_stop(&qproc->q6v5, qproc->sysmon);
1626 if (ret == -ETIMEDOUT)
1627 dev_err(qproc->dev, "timed out on wait\n");
1629 q6v5_mba_reclaim(qproc);
1634 static int qcom_q6v5_register_dump_segments(struct rproc *rproc,
1635 const struct firmware *mba_fw)
1637 const struct firmware *fw;
1638 const struct elf32_phdr *phdrs;
1639 const struct elf32_phdr *phdr;
1640 const struct elf32_hdr *ehdr;
1641 struct q6v5 *qproc = rproc->priv;
1645 ret = request_firmware(&fw, qproc->hexagon_mdt_image, qproc->dev);
1647 dev_err(qproc->dev, "unable to load %s\n",
1648 qproc->hexagon_mdt_image);
1652 rproc_coredump_set_elf_info(rproc, ELFCLASS32, EM_NONE);
1654 ehdr = (struct elf32_hdr *)fw->data;
1655 phdrs = (struct elf32_phdr *)(ehdr + 1);
1656 qproc->total_dump_size = 0;
1658 for (i = 0; i < ehdr->e_phnum; i++) {
1661 if (!q6v5_phdr_valid(phdr))
1664 ret = rproc_coredump_add_custom_segment(rproc, phdr->p_paddr,
1666 qcom_q6v5_dump_segment,
1671 qproc->total_dump_size += phdr->p_memsz;
1674 release_firmware(fw);
1678 static unsigned long q6v5_panic(struct rproc *rproc)
1680 struct q6v5 *qproc = rproc->priv;
1682 return qcom_q6v5_panic(&qproc->q6v5);
1685 static const struct rproc_ops q6v5_ops = {
1686 .start = q6v5_start,
1688 .parse_fw = qcom_q6v5_register_dump_segments,
1690 .panic = q6v5_panic,
1693 static void qcom_msa_handover(struct qcom_q6v5 *q6v5)
1695 struct q6v5 *qproc = container_of(q6v5, struct q6v5, q6v5);
1697 q6v5_clk_disable(qproc->dev, qproc->proxy_clks,
1698 qproc->proxy_clk_count);
1699 q6v5_regulator_disable(qproc, qproc->proxy_regs,
1700 qproc->proxy_reg_count);
1701 q6v5_regulator_disable(qproc, qproc->fallback_proxy_regs,
1702 qproc->fallback_proxy_reg_count);
1703 q6v5_pds_disable(qproc, qproc->proxy_pds, qproc->proxy_pd_count);
1706 static int q6v5_init_mem(struct q6v5 *qproc, struct platform_device *pdev)
1708 struct of_phandle_args args;
1709 int halt_cell_cnt = 3;
1712 qproc->reg_base = devm_platform_ioremap_resource_byname(pdev, "qdsp6");
1713 if (IS_ERR(qproc->reg_base))
1714 return PTR_ERR(qproc->reg_base);
1716 qproc->rmb_base = devm_platform_ioremap_resource_byname(pdev, "rmb");
1717 if (IS_ERR(qproc->rmb_base))
1718 return PTR_ERR(qproc->rmb_base);
1723 ret = of_parse_phandle_with_fixed_args(pdev->dev.of_node,
1724 "qcom,halt-regs", halt_cell_cnt, 0, &args);
1726 dev_err(&pdev->dev, "failed to parse qcom,halt-regs\n");
1730 qproc->halt_map = syscon_node_to_regmap(args.np);
1731 of_node_put(args.np);
1732 if (IS_ERR(qproc->halt_map))
1733 return PTR_ERR(qproc->halt_map);
1735 qproc->halt_q6 = args.args[0];
1736 qproc->halt_modem = args.args[1];
1737 qproc->halt_nc = args.args[2];
1740 qproc->halt_vq6 = args.args[3];
1742 if (qproc->has_qaccept_regs) {
1743 ret = of_parse_phandle_with_fixed_args(pdev->dev.of_node,
1744 "qcom,qaccept-regs",
1747 dev_err(&pdev->dev, "failed to parse qaccept-regs\n");
1751 qproc->qaccept_mdm = args.args[0];
1752 qproc->qaccept_cx = args.args[1];
1753 qproc->qaccept_axi = args.args[2];
1756 if (qproc->has_ext_cntl_regs) {
1757 ret = of_parse_phandle_with_fixed_args(pdev->dev.of_node,
1761 dev_err(&pdev->dev, "failed to parse ext-regs index 0\n");
1765 qproc->conn_map = syscon_node_to_regmap(args.np);
1766 of_node_put(args.np);
1767 if (IS_ERR(qproc->conn_map))
1768 return PTR_ERR(qproc->conn_map);
1770 qproc->force_clk_on = args.args[0];
1771 qproc->rscc_disable = args.args[1];
1773 ret = of_parse_phandle_with_fixed_args(pdev->dev.of_node,
1777 dev_err(&pdev->dev, "failed to parse ext-regs index 1\n");
1781 qproc->axim1_clk_off = args.args[0];
1782 qproc->crypto_clk_off = args.args[1];
1785 if (qproc->has_spare_reg) {
1786 ret = of_parse_phandle_with_fixed_args(pdev->dev.of_node,
1790 dev_err(&pdev->dev, "failed to parse spare-regs\n");
1794 qproc->conn_map = syscon_node_to_regmap(args.np);
1795 of_node_put(args.np);
1796 if (IS_ERR(qproc->conn_map))
1797 return PTR_ERR(qproc->conn_map);
1799 qproc->conn_box = args.args[0];
1805 static int q6v5_init_clocks(struct device *dev, struct clk **clks,
1813 for (i = 0; clk_names[i]; i++) {
1814 clks[i] = devm_clk_get(dev, clk_names[i]);
1815 if (IS_ERR(clks[i])) {
1816 int rc = PTR_ERR(clks[i]);
1818 if (rc != -EPROBE_DEFER)
1819 dev_err(dev, "Failed to get %s clock\n",
1828 static int q6v5_pds_attach(struct device *dev, struct device **devs,
1838 while (pd_names[num_pds])
1841 for (i = 0; i < num_pds; i++) {
1842 devs[i] = dev_pm_domain_attach_by_name(dev, pd_names[i]);
1843 if (IS_ERR_OR_NULL(devs[i])) {
1844 ret = PTR_ERR(devs[i]) ? : -ENODATA;
1852 for (i--; i >= 0; i--)
1853 dev_pm_domain_detach(devs[i], false);
1858 static void q6v5_pds_detach(struct q6v5 *qproc, struct device **pds,
1863 for (i = 0; i < pd_count; i++)
1864 dev_pm_domain_detach(pds[i], false);
1867 static int q6v5_init_reset(struct q6v5 *qproc)
1869 qproc->mss_restart = devm_reset_control_get_exclusive(qproc->dev,
1871 if (IS_ERR(qproc->mss_restart)) {
1872 dev_err(qproc->dev, "failed to acquire mss restart\n");
1873 return PTR_ERR(qproc->mss_restart);
1876 if (qproc->has_alt_reset || qproc->has_spare_reg || qproc->has_ext_cntl_regs) {
1877 qproc->pdc_reset = devm_reset_control_get_exclusive(qproc->dev,
1879 if (IS_ERR(qproc->pdc_reset)) {
1880 dev_err(qproc->dev, "failed to acquire pdc reset\n");
1881 return PTR_ERR(qproc->pdc_reset);
1888 static int q6v5_alloc_memory_region(struct q6v5 *qproc)
1890 struct device_node *child;
1891 struct reserved_mem *rmem;
1892 struct device_node *node;
1895 * In the absence of mba/mpss sub-child, extract the mba and mpss
1896 * reserved memory regions from device's memory-region property.
1898 child = of_get_child_by_name(qproc->dev->of_node, "mba");
1900 node = of_parse_phandle(qproc->dev->of_node,
1901 "memory-region", 0);
1903 node = of_parse_phandle(child, "memory-region", 0);
1908 dev_err(qproc->dev, "no mba memory-region specified\n");
1912 rmem = of_reserved_mem_lookup(node);
1915 dev_err(qproc->dev, "unable to resolve mba region\n");
1919 qproc->mba_phys = rmem->base;
1920 qproc->mba_size = rmem->size;
1923 node = of_parse_phandle(qproc->dev->of_node,
1924 "memory-region", 1);
1926 child = of_get_child_by_name(qproc->dev->of_node, "mpss");
1927 node = of_parse_phandle(child, "memory-region", 0);
1932 dev_err(qproc->dev, "no mpss memory-region specified\n");
1936 rmem = of_reserved_mem_lookup(node);
1939 dev_err(qproc->dev, "unable to resolve mpss region\n");
1943 qproc->mpss_phys = qproc->mpss_reloc = rmem->base;
1944 qproc->mpss_size = rmem->size;
1947 node = of_parse_phandle(qproc->dev->of_node, "memory-region", 2);
1949 child = of_get_child_by_name(qproc->dev->of_node, "metadata");
1950 node = of_parse_phandle(child, "memory-region", 0);
1957 rmem = of_reserved_mem_lookup(node);
1959 dev_err(qproc->dev, "unable to resolve metadata region\n");
1963 qproc->mdata_phys = rmem->base;
1964 qproc->mdata_size = rmem->size;
1969 static int q6v5_probe(struct platform_device *pdev)
1971 const struct rproc_hexagon_res *desc;
1972 struct device_node *node;
1974 struct rproc *rproc;
1975 const char *mba_image;
1978 desc = of_device_get_match_data(&pdev->dev);
1982 if (desc->need_mem_protection && !qcom_scm_is_available())
1983 return -EPROBE_DEFER;
1985 mba_image = desc->hexagon_mba_image;
1986 ret = of_property_read_string_index(pdev->dev.of_node, "firmware-name",
1988 if (ret < 0 && ret != -EINVAL) {
1989 dev_err(&pdev->dev, "unable to read mba firmware-name\n");
1993 rproc = rproc_alloc(&pdev->dev, pdev->name, &q6v5_ops,
1994 mba_image, sizeof(*qproc));
1996 dev_err(&pdev->dev, "failed to allocate rproc\n");
2000 rproc->auto_boot = false;
2001 rproc_coredump_set_elf_info(rproc, ELFCLASS32, EM_NONE);
2003 qproc = rproc->priv;
2004 qproc->dev = &pdev->dev;
2005 qproc->rproc = rproc;
2006 qproc->hexagon_mdt_image = "modem.mdt";
2007 ret = of_property_read_string_index(pdev->dev.of_node, "firmware-name",
2008 1, &qproc->hexagon_mdt_image);
2009 if (ret < 0 && ret != -EINVAL) {
2010 dev_err(&pdev->dev, "unable to read mpss firmware-name\n");
2014 platform_set_drvdata(pdev, qproc);
2016 qproc->has_qaccept_regs = desc->has_qaccept_regs;
2017 qproc->has_ext_cntl_regs = desc->has_ext_cntl_regs;
2018 qproc->has_vq6 = desc->has_vq6;
2019 qproc->has_spare_reg = desc->has_spare_reg;
2020 ret = q6v5_init_mem(qproc, pdev);
2024 ret = q6v5_alloc_memory_region(qproc);
2028 ret = q6v5_init_clocks(&pdev->dev, qproc->proxy_clks,
2029 desc->proxy_clk_names);
2031 dev_err(&pdev->dev, "Failed to get proxy clocks.\n");
2034 qproc->proxy_clk_count = ret;
2036 ret = q6v5_init_clocks(&pdev->dev, qproc->reset_clks,
2037 desc->reset_clk_names);
2039 dev_err(&pdev->dev, "Failed to get reset clocks.\n");
2042 qproc->reset_clk_count = ret;
2044 ret = q6v5_init_clocks(&pdev->dev, qproc->active_clks,
2045 desc->active_clk_names);
2047 dev_err(&pdev->dev, "Failed to get active clocks.\n");
2050 qproc->active_clk_count = ret;
2052 ret = q6v5_regulator_init(&pdev->dev, qproc->proxy_regs,
2053 desc->proxy_supply);
2055 dev_err(&pdev->dev, "Failed to get proxy regulators.\n");
2058 qproc->proxy_reg_count = ret;
2060 ret = q6v5_regulator_init(&pdev->dev, qproc->active_regs,
2061 desc->active_supply);
2063 dev_err(&pdev->dev, "Failed to get active regulators.\n");
2066 qproc->active_reg_count = ret;
2068 ret = q6v5_pds_attach(&pdev->dev, qproc->proxy_pds,
2069 desc->proxy_pd_names);
2070 /* Fallback to regulators for old device trees */
2071 if (ret == -ENODATA && desc->fallback_proxy_supply) {
2072 ret = q6v5_regulator_init(&pdev->dev,
2073 qproc->fallback_proxy_regs,
2074 desc->fallback_proxy_supply);
2076 dev_err(&pdev->dev, "Failed to get fallback proxy regulators.\n");
2079 qproc->fallback_proxy_reg_count = ret;
2080 } else if (ret < 0) {
2081 dev_err(&pdev->dev, "Failed to init power domains\n");
2084 qproc->proxy_pd_count = ret;
2087 qproc->has_alt_reset = desc->has_alt_reset;
2088 ret = q6v5_init_reset(qproc);
2090 goto detach_proxy_pds;
2092 qproc->version = desc->version;
2093 qproc->need_mem_protection = desc->need_mem_protection;
2094 qproc->has_mba_logs = desc->has_mba_logs;
2096 ret = qcom_q6v5_init(&qproc->q6v5, pdev, rproc, MPSS_CRASH_REASON_SMEM, "modem",
2099 goto detach_proxy_pds;
2101 qproc->mpss_perm = BIT(QCOM_SCM_VMID_HLOS);
2102 qproc->mba_perm = BIT(QCOM_SCM_VMID_HLOS);
2103 qcom_add_glink_subdev(rproc, &qproc->glink_subdev, "mpss");
2104 qcom_add_smd_subdev(rproc, &qproc->smd_subdev);
2105 qcom_add_ssr_subdev(rproc, &qproc->ssr_subdev, "mpss");
2106 qproc->sysmon = qcom_add_sysmon_subdev(rproc, "modem", 0x12);
2107 if (IS_ERR(qproc->sysmon)) {
2108 ret = PTR_ERR(qproc->sysmon);
2109 goto remove_subdevs;
2112 ret = rproc_add(rproc);
2114 goto remove_sysmon_subdev;
2116 node = of_get_compatible_child(pdev->dev.of_node, "qcom,bam-dmux");
2117 qproc->bam_dmux = of_platform_device_create(node, NULL, &pdev->dev);
2122 remove_sysmon_subdev:
2123 qcom_remove_sysmon_subdev(qproc->sysmon);
2125 qcom_remove_ssr_subdev(rproc, &qproc->ssr_subdev);
2126 qcom_remove_smd_subdev(rproc, &qproc->smd_subdev);
2127 qcom_remove_glink_subdev(rproc, &qproc->glink_subdev);
2129 q6v5_pds_detach(qproc, qproc->proxy_pds, qproc->proxy_pd_count);
2136 static void q6v5_remove(struct platform_device *pdev)
2138 struct q6v5 *qproc = platform_get_drvdata(pdev);
2139 struct rproc *rproc = qproc->rproc;
2141 if (qproc->bam_dmux)
2142 of_platform_device_destroy(&qproc->bam_dmux->dev, NULL);
2145 qcom_q6v5_deinit(&qproc->q6v5);
2146 qcom_remove_sysmon_subdev(qproc->sysmon);
2147 qcom_remove_ssr_subdev(rproc, &qproc->ssr_subdev);
2148 qcom_remove_smd_subdev(rproc, &qproc->smd_subdev);
2149 qcom_remove_glink_subdev(rproc, &qproc->glink_subdev);
2151 q6v5_pds_detach(qproc, qproc->proxy_pds, qproc->proxy_pd_count);
2156 static const struct rproc_hexagon_res sc7180_mss = {
2157 .hexagon_mba_image = "mba.mbn",
2158 .proxy_clk_names = (char*[]){
2162 .reset_clk_names = (char*[]){
2168 .active_clk_names = (char*[]){
2173 .proxy_pd_names = (char*[]){
2179 .need_mem_protection = true,
2180 .has_alt_reset = false,
2181 .has_mba_logs = true,
2182 .has_spare_reg = true,
2183 .has_qaccept_regs = false,
2184 .has_ext_cntl_regs = false,
2186 .version = MSS_SC7180,
2189 static const struct rproc_hexagon_res sc7280_mss = {
2190 .hexagon_mba_image = "mba.mbn",
2191 .proxy_clk_names = (char*[]){
2196 .active_clk_names = (char*[]){
2202 .proxy_pd_names = (char*[]){
2207 .need_mem_protection = true,
2208 .has_alt_reset = false,
2209 .has_mba_logs = true,
2210 .has_spare_reg = false,
2211 .has_qaccept_regs = true,
2212 .has_ext_cntl_regs = true,
2214 .version = MSS_SC7280,
2217 static const struct rproc_hexagon_res sdm660_mss = {
2218 .hexagon_mba_image = "mba.mbn",
2219 .proxy_clk_names = (char*[]){
2225 .active_clk_names = (char*[]){
2233 .proxy_pd_names = (char*[]){
2238 .need_mem_protection = true,
2239 .has_alt_reset = false,
2240 .has_mba_logs = false,
2241 .has_spare_reg = false,
2242 .has_qaccept_regs = false,
2243 .has_ext_cntl_regs = false,
2245 .version = MSS_SDM660,
2248 static const struct rproc_hexagon_res sdm845_mss = {
2249 .hexagon_mba_image = "mba.mbn",
2250 .proxy_clk_names = (char*[]){
2255 .reset_clk_names = (char*[]){
2260 .active_clk_names = (char*[]){
2267 .proxy_pd_names = (char*[]){
2273 .need_mem_protection = true,
2274 .has_alt_reset = true,
2275 .has_mba_logs = false,
2276 .has_spare_reg = false,
2277 .has_qaccept_regs = false,
2278 .has_ext_cntl_regs = false,
2280 .version = MSS_SDM845,
2283 static const struct rproc_hexagon_res msm8998_mss = {
2284 .hexagon_mba_image = "mba.mbn",
2285 .proxy_clk_names = (char*[]){
2291 .active_clk_names = (char*[]){
2299 .proxy_pd_names = (char*[]){
2304 .need_mem_protection = true,
2305 .has_alt_reset = false,
2306 .has_mba_logs = false,
2307 .has_spare_reg = false,
2308 .has_qaccept_regs = false,
2309 .has_ext_cntl_regs = false,
2311 .version = MSS_MSM8998,
2314 static const struct rproc_hexagon_res msm8996_mss = {
2315 .hexagon_mba_image = "mba.mbn",
2316 .proxy_supply = (struct qcom_mss_reg_res[]) {
2323 .proxy_clk_names = (char*[]){
2329 .active_clk_names = (char*[]){
2338 .proxy_pd_names = (char*[]){
2343 .need_mem_protection = true,
2344 .has_alt_reset = false,
2345 .has_mba_logs = false,
2346 .has_spare_reg = false,
2347 .has_qaccept_regs = false,
2348 .has_ext_cntl_regs = false,
2350 .version = MSS_MSM8996,
2353 static const struct rproc_hexagon_res msm8909_mss = {
2354 .hexagon_mba_image = "mba.mbn",
2355 .proxy_supply = (struct qcom_mss_reg_res[]) {
2362 .proxy_clk_names = (char*[]){
2366 .active_clk_names = (char*[]){
2372 .proxy_pd_names = (char*[]){
2377 .need_mem_protection = false,
2378 .has_alt_reset = false,
2379 .has_mba_logs = false,
2380 .has_spare_reg = false,
2381 .has_qaccept_regs = false,
2382 .has_ext_cntl_regs = false,
2384 .version = MSS_MSM8909,
2387 static const struct rproc_hexagon_res msm8916_mss = {
2388 .hexagon_mba_image = "mba.mbn",
2389 .proxy_supply = (struct qcom_mss_reg_res[]) {
2396 .fallback_proxy_supply = (struct qcom_mss_reg_res[]) {
2407 .proxy_clk_names = (char*[]){
2411 .active_clk_names = (char*[]){
2417 .proxy_pd_names = (char*[]){
2422 .need_mem_protection = false,
2423 .has_alt_reset = false,
2424 .has_mba_logs = false,
2425 .has_spare_reg = false,
2426 .has_qaccept_regs = false,
2427 .has_ext_cntl_regs = false,
2429 .version = MSS_MSM8916,
2432 static const struct rproc_hexagon_res msm8953_mss = {
2433 .hexagon_mba_image = "mba.mbn",
2434 .proxy_supply = (struct qcom_mss_reg_res[]) {
2441 .proxy_clk_names = (char*[]){
2445 .active_clk_names = (char*[]){
2451 .proxy_pd_names = (char*[]) {
2457 .need_mem_protection = false,
2458 .has_alt_reset = false,
2459 .has_mba_logs = false,
2460 .has_spare_reg = false,
2461 .has_qaccept_regs = false,
2462 .has_ext_cntl_regs = false,
2464 .version = MSS_MSM8953,
2467 static const struct rproc_hexagon_res msm8974_mss = {
2468 .hexagon_mba_image = "mba.b00",
2469 .proxy_supply = (struct qcom_mss_reg_res[]) {
2476 .fallback_proxy_supply = (struct qcom_mss_reg_res[]) {
2487 .active_supply = (struct qcom_mss_reg_res[]) {
2495 .proxy_clk_names = (char*[]){
2499 .active_clk_names = (char*[]){
2505 .proxy_pd_names = (char*[]){
2510 .need_mem_protection = false,
2511 .has_alt_reset = false,
2512 .has_mba_logs = false,
2513 .has_spare_reg = false,
2514 .has_qaccept_regs = false,
2515 .has_ext_cntl_regs = false,
2517 .version = MSS_MSM8974,
2520 static const struct of_device_id q6v5_of_match[] = {
2521 { .compatible = "qcom,q6v5-pil", .data = &msm8916_mss},
2522 { .compatible = "qcom,msm8909-mss-pil", .data = &msm8909_mss},
2523 { .compatible = "qcom,msm8916-mss-pil", .data = &msm8916_mss},
2524 { .compatible = "qcom,msm8953-mss-pil", .data = &msm8953_mss},
2525 { .compatible = "qcom,msm8974-mss-pil", .data = &msm8974_mss},
2526 { .compatible = "qcom,msm8996-mss-pil", .data = &msm8996_mss},
2527 { .compatible = "qcom,msm8998-mss-pil", .data = &msm8998_mss},
2528 { .compatible = "qcom,sc7180-mss-pil", .data = &sc7180_mss},
2529 { .compatible = "qcom,sc7280-mss-pil", .data = &sc7280_mss},
2530 { .compatible = "qcom,sdm660-mss-pil", .data = &sdm660_mss},
2531 { .compatible = "qcom,sdm845-mss-pil", .data = &sdm845_mss},
2534 MODULE_DEVICE_TABLE(of, q6v5_of_match);
2536 static struct platform_driver q6v5_driver = {
2537 .probe = q6v5_probe,
2538 .remove_new = q6v5_remove,
2540 .name = "qcom-q6v5-mss",
2541 .of_match_table = q6v5_of_match,
2544 module_platform_driver(q6v5_driver);
2546 MODULE_DESCRIPTION("Qualcomm Self-authenticating modem remoteproc driver");
2547 MODULE_LICENSE("GPL v2");