OSDN Git Service

kernel: bump 5.15 to 5.15.36
[immortalwrt/immortalwrt.git] / target / linux / ipq40xx / patches-5.15 / 420-firmware-qcom-scm-disable-SDI.patch
1 --- a/drivers/firmware/qcom_scm.c
2 +++ b/drivers/firmware/qcom_scm.c
3 @@ -404,6 +404,20 @@ static int __qcom_scm_set_dload_mode(str
4         return qcom_scm_call_atomic(__scm->dev, &desc, NULL);
5  }
6  
7 +static int __qcom_scm_disable_sdi(struct device *dev)
8 +{
9 +       struct qcom_scm_desc desc = {
10 +               .svc = QCOM_SCM_SVC_BOOT,
11 +               .cmd = QCOM_SCM_BOOT_CONFIG_SDI,
12 +               .arginfo = QCOM_SCM_ARGS(2),
13 +               .args[0] = 1  /* 1: disable watchdog debug */,
14 +               .args[1] = 0  /* 0: disable SDI */,
15 +               .owner = ARM_SMCCC_OWNER_SIP,
16 +       };
17 +
18 +       return qcom_scm_call(__scm->dev, &desc, NULL);
19 +}
20 +
21  static void qcom_scm_set_download_mode(bool enable)
22  {
23         bool avail;
24 @@ -1314,6 +1328,13 @@ static int qcom_scm_probe(struct platfor
25         if (download_mode)
26                 qcom_scm_set_download_mode(true);
27  
28 +       /*
29 +        * Factory firmware leaves SDI (a debug interface), which prevents
30 +        * clean reboot.
31 +        */
32 +       if (of_machine_is_compatible("google,wifi"))
33 +               __qcom_scm_disable_sdi(__scm->dev);
34 +
35         return 0;
36  }
37  
38 --- a/drivers/firmware/qcom_scm.h
39 +++ b/drivers/firmware/qcom_scm.h
40 @@ -77,6 +77,7 @@ extern int scm_legacy_call(struct device
41  #define QCOM_SCM_SVC_BOOT              0x01
42  #define QCOM_SCM_BOOT_SET_ADDR         0x01
43  #define QCOM_SCM_BOOT_TERMINATE_PC     0x02
44 +#define QCOM_SCM_BOOT_CONFIG_SDI       0x09
45  #define QCOM_SCM_BOOT_SET_DLOAD_MODE   0x10
46  #define QCOM_SCM_BOOT_SET_REMOTE_STATE 0x0a
47  #define QCOM_SCM_FLUSH_FLAG_MASK       0x3