Skip to content

Commit 10b6fec

Browse files
minlexxandersson
authored andcommitted
remoteproc: qcom: q6v5-mss: Add support for SDM630/636/660
Snapdragon 630/660 modem subsystem is similar to one in MSM8998 and can almost reuse it's reset sequence. Downstream sources call this q6v5 version "qdsp6v62-1-5" and its code path has additional checks for QDSP6v55_BHS_EN_REST_ACK status [2]. Inspiration is taken from Konrad Dybcio's work in [1], but reworked to use common code path with MSM8996/8998, instead of completely separate "if" block for SDM660. [1] SoMainline@7dd6dd9 [2] https://github.com/MiCode/Xiaomi_Kernel_OpenSource/blob/lavender-q-oss/drivers/soc/qcom/pil-q6v5.c#L393 Co-developed-by: Konrad Dybcio <[email protected]> Signed-off-by: Konrad Dybcio <[email protected]> Signed-off-by: Alexey Minnekhanov <[email protected]> Reviewed-by: Konrad Dybcio <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bjorn Andersson <[email protected]>
1 parent ed50ac2 commit 10b6fec

File tree

1 file changed

+49
-2
lines changed

1 file changed

+49
-2
lines changed

drivers/remoteproc/qcom_q6v5_mss.c

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
#define QDSP6SS_MEM_PWR_CTL 0x0B0
7272
#define QDSP6V6SS_MEM_PWR_CTL 0x034
7373
#define QDSP6SS_STRAP_ACC 0x110
74+
#define QDSP6V62SS_BHS_STATUS 0x0C4
7475

7576
/* AXI Halt Register Offsets */
7677
#define AXI_HALTREQ_REG 0x0
@@ -123,13 +124,15 @@
123124
#define QDSP6v56_CLAMP_QMC_MEM BIT(22)
124125
#define QDSP6SS_XO_CBCR 0x0038
125126
#define QDSP6SS_ACC_OVERRIDE_VAL 0x20
127+
#define QDSP6v55_BHS_EN_REST_ACK BIT(0)
126128

127129
/* QDSP6v65 parameters */
128130
#define QDSP6SS_CORE_CBCR 0x20
129131
#define QDSP6SS_SLEEP 0x3C
130132
#define QDSP6SS_BOOT_CORE_START 0x400
131133
#define QDSP6SS_BOOT_CMD 0x404
132134
#define BOOT_FSM_TIMEOUT 10000
135+
#define BHS_CHECK_MAX_LOOPS 200
133136

134137
struct reg_info {
135138
struct regulator *reg;
@@ -250,6 +253,7 @@ enum {
250253
MSS_MSM8998,
251254
MSS_SC7180,
252255
MSS_SC7280,
256+
MSS_SDM660,
253257
MSS_SDM845,
254258
};
255259

@@ -700,7 +704,8 @@ static int q6v5proc_reset(struct q6v5 *qproc)
700704
} else if (qproc->version == MSS_MSM8909 ||
701705
qproc->version == MSS_MSM8953 ||
702706
qproc->version == MSS_MSM8996 ||
703-
qproc->version == MSS_MSM8998) {
707+
qproc->version == MSS_MSM8998 ||
708+
qproc->version == MSS_SDM660) {
704709

705710
if (qproc->version != MSS_MSM8909 &&
706711
qproc->version != MSS_MSM8953)
@@ -734,6 +739,16 @@ static int q6v5proc_reset(struct q6v5 *qproc)
734739
val |= readl(qproc->reg_base + QDSP6SS_PWR_CTL_REG);
735740
udelay(1);
736741

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");
748+
return -ETIMEDOUT;
749+
}
750+
}
751+
737752
/* Put LDO in bypass mode */
738753
val |= QDSP6v56_LDO_BYP;
739754
writel(val, qproc->reg_base + QDSP6SS_PWR_CTL_REG);
@@ -756,7 +771,7 @@ static int q6v5proc_reset(struct q6v5 *qproc)
756771
mem_pwr_ctl = QDSP6SS_MEM_PWR_CTL;
757772
i = 19;
758773
} else {
759-
/* MSS_MSM8998 */
774+
/* MSS_MSM8998, MSS_SDM660 */
760775
mem_pwr_ctl = QDSP6V6SS_MEM_PWR_CTL;
761776
i = 28;
762777
}
@@ -2199,6 +2214,37 @@ static const struct rproc_hexagon_res sc7280_mss = {
21992214
.version = MSS_SC7280,
22002215
};
22012216

2217+
static const struct rproc_hexagon_res sdm660_mss = {
2218+
.hexagon_mba_image = "mba.mbn",
2219+
.proxy_clk_names = (char*[]){
2220+
"xo",
2221+
"qdss",
2222+
"mem",
2223+
NULL
2224+
},
2225+
.active_clk_names = (char*[]){
2226+
"iface",
2227+
"bus",
2228+
"gpll0_mss",
2229+
"mnoc_axi",
2230+
"snoc_axi",
2231+
NULL
2232+
},
2233+
.proxy_pd_names = (char*[]){
2234+
"cx",
2235+
"mx",
2236+
NULL
2237+
},
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,
2244+
.has_vq6 = false,
2245+
.version = MSS_SDM660,
2246+
};
2247+
22022248
static const struct rproc_hexagon_res sdm845_mss = {
22032249
.hexagon_mba_image = "mba.mbn",
22042250
.proxy_clk_names = (char*[]){
@@ -2481,6 +2527,7 @@ static const struct of_device_id q6v5_of_match[] = {
24812527
{ .compatible = "qcom,msm8998-mss-pil", .data = &msm8998_mss},
24822528
{ .compatible = "qcom,sc7180-mss-pil", .data = &sc7180_mss},
24832529
{ .compatible = "qcom,sc7280-mss-pil", .data = &sc7280_mss},
2530+
{ .compatible = "qcom,sdm660-mss-pil", .data = &sdm660_mss},
24842531
{ .compatible = "qcom,sdm845-mss-pil", .data = &sdm845_mss},
24852532
{ },
24862533
};

0 commit comments

Comments
 (0)