Loading Documentation/devicetree/bindings/arm/msm/mdm-modem.txt +9 −0 Original line number Diff line number Diff line Loading @@ -114,6 +114,15 @@ Optional driver parameters: - qcom,mdm-statusline-not-a-powersource: Boolean. If set, status line to esoc device is not a power source. - qcom,mdm-userspace-handle-shutdown: Boolean. If set, userspace handles shutdown requests. - qcom,shutdown-timeout-ms: graceful shutdown timeout in milliseconds. This interval is the time needed for the external modem to gracefully shutdown after the host sends a shutdown command. The value depends on how long it takes for the high level OS in the external modem to shutdown gracefully. The default value is 10000 milliseconds. - qcom,reset-time-ms: time it takes for the external modem to forcefully reset in milliseconds. This interval is the time it takes to toggle the reset of an external modem by holding down the reset pin. The value depends on the external modem's power management boot options. The default value is 203 milliseconds. Example: mdm0: qcom,mdm0 { Loading arch/arm/boot/dts/qcom/msm8996-cv2x.dtsi +2 −0 Original line number Diff line number Diff line Loading @@ -374,6 +374,8 @@ qcom,mdm-statusline-not-a-powersource; qcom,mdm-userspace-handle-shutdown; qcom,pil-force-shutdown; qcom,shutdown-timeout-ms = <30000>; qcom,reset-time-ms = <16203>; status = "okay"; }; Loading drivers/esoc/esoc-mdm-4x.c +7 −1 Original line number Diff line number Diff line Loading @@ -220,7 +220,7 @@ static int mdm_cmd_exe(enum esoc_cmd cmd, struct esoc_clink *esoc) } dev_dbg(mdm->dev, "Waiting for status gpio go low\n"); status_down = false; end_time = jiffies + msecs_to_jiffies(10000); end_time = jiffies + msecs_to_jiffies(mdm->shutdown_timeout_ms); while (time_before(jiffies, end_time)) { if (gpio_get_value(MDM_GPIO(mdm, MDM2AP_STATUS)) == 0) { Loading Loading @@ -1084,6 +1084,12 @@ static int mdm9x55_setup_hw(struct mdm_ctrl *mdm, &esoc->link_info); if (ret) dev_info(mdm->dev, "esoc link info missing\n"); ret = of_property_read_u32(node, "qcom,shutdown-timeout-ms", &mdm->shutdown_timeout_ms); if (ret) mdm->shutdown_timeout_ms = DEF_SHUTDOWN_TIMEOUT; esoc->clink_ops = clink_ops; esoc->parent = mdm->dev; esoc->owner = THIS_MODULE; Loading drivers/esoc/esoc-mdm-pon.c +27 −3 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ static int mdm9x55_toggle_soft_reset(struct mdm_ctrl *mdm, bool atomic) { int soft_reset_direction_assert = 0, soft_reset_direction_de_assert = 1; uint32_t reset_time_us = mdm->reset_time_ms * 1000; if (mdm->soft_reset_inverted) { soft_reset_direction_assert = 1; Loading @@ -52,9 +53,9 @@ static int mdm9x55_toggle_soft_reset(struct mdm_ctrl *mdm, bool atomic) * Allow PS hold assert to be detected */ if (!atomic) usleep_range(203000, 300000); usleep_range(reset_time_us, reset_time_us + 100000); else mdelay(203); mdelay(mdm->reset_time_ms); gpio_direction_output(MDM_GPIO(mdm, AP2MDM_SOFT_RESET), soft_reset_direction_de_assert); return 0; Loading Loading @@ -212,6 +213,29 @@ static int apq8096_pon_dt_init(struct mdm_ctrl *mdm) return 0; } static int mdm9x55_pon_dt_init(struct mdm_ctrl *mdm) { int val; struct device_node *node = mdm->dev->of_node; enum of_gpio_flags flags = OF_GPIO_ACTIVE_LOW; val = of_property_read_u32(node, "qcom,reset-time-ms", &mdm->reset_time_ms); if (val) mdm->reset_time_ms = DEF_MDM9X55_RESET_TIME; val = of_get_named_gpio_flags(node, "qcom,ap2mdm-soft-reset-gpio", 0, &flags); if (val >= 0) { MDM_GPIO(mdm, AP2MDM_SOFT_RESET) = val; if (flags & OF_GPIO_ACTIVE_LOW) mdm->soft_reset_inverted = 1; return 0; } else return -EIO; } static int mdm4x_pon_dt_init(struct mdm_ctrl *mdm) { int val; Loading Loading @@ -290,7 +314,7 @@ struct mdm_pon_ops mdm9x55_pon_ops = { .soft_reset = mdm9x55_toggle_soft_reset, .poff_force = mdm9x55_power_down, .cold_reset = mdm9x55_cold_reset, .dt_init = mdm4x_pon_dt_init, .dt_init = mdm9x55_pon_dt_init, .setup = mdm4x_pon_setup, }; Loading drivers/esoc/esoc-mdm.h +4 −0 Original line number Diff line number Diff line Loading @@ -43,6 +43,8 @@ #define MDM_MODEM_TIMEOUT 3000 #define DEF_RAMDUMP_TIMEOUT 120000 #define DEF_RAMDUMP_DELAY 2000 #define DEF_SHUTDOWN_TIMEOUT 10000 #define DEF_MDM9X55_RESET_TIME 203 #define RD_BUF_SIZE 100 #define SFR_MAX_RETRIES 10 #define SFR_RETRY_INTERVAL 1000 Loading Loading @@ -96,6 +98,8 @@ struct mdm_ctrl { bool debug_fail; unsigned int dump_timeout_ms; unsigned int ramdump_delay_ms; unsigned int shutdown_timeout_ms; unsigned int reset_time_ms; struct esoc_clink *esoc; bool get_restart_reason; unsigned long irq_mask; Loading Loading
Documentation/devicetree/bindings/arm/msm/mdm-modem.txt +9 −0 Original line number Diff line number Diff line Loading @@ -114,6 +114,15 @@ Optional driver parameters: - qcom,mdm-statusline-not-a-powersource: Boolean. If set, status line to esoc device is not a power source. - qcom,mdm-userspace-handle-shutdown: Boolean. If set, userspace handles shutdown requests. - qcom,shutdown-timeout-ms: graceful shutdown timeout in milliseconds. This interval is the time needed for the external modem to gracefully shutdown after the host sends a shutdown command. The value depends on how long it takes for the high level OS in the external modem to shutdown gracefully. The default value is 10000 milliseconds. - qcom,reset-time-ms: time it takes for the external modem to forcefully reset in milliseconds. This interval is the time it takes to toggle the reset of an external modem by holding down the reset pin. The value depends on the external modem's power management boot options. The default value is 203 milliseconds. Example: mdm0: qcom,mdm0 { Loading
arch/arm/boot/dts/qcom/msm8996-cv2x.dtsi +2 −0 Original line number Diff line number Diff line Loading @@ -374,6 +374,8 @@ qcom,mdm-statusline-not-a-powersource; qcom,mdm-userspace-handle-shutdown; qcom,pil-force-shutdown; qcom,shutdown-timeout-ms = <30000>; qcom,reset-time-ms = <16203>; status = "okay"; }; Loading
drivers/esoc/esoc-mdm-4x.c +7 −1 Original line number Diff line number Diff line Loading @@ -220,7 +220,7 @@ static int mdm_cmd_exe(enum esoc_cmd cmd, struct esoc_clink *esoc) } dev_dbg(mdm->dev, "Waiting for status gpio go low\n"); status_down = false; end_time = jiffies + msecs_to_jiffies(10000); end_time = jiffies + msecs_to_jiffies(mdm->shutdown_timeout_ms); while (time_before(jiffies, end_time)) { if (gpio_get_value(MDM_GPIO(mdm, MDM2AP_STATUS)) == 0) { Loading Loading @@ -1084,6 +1084,12 @@ static int mdm9x55_setup_hw(struct mdm_ctrl *mdm, &esoc->link_info); if (ret) dev_info(mdm->dev, "esoc link info missing\n"); ret = of_property_read_u32(node, "qcom,shutdown-timeout-ms", &mdm->shutdown_timeout_ms); if (ret) mdm->shutdown_timeout_ms = DEF_SHUTDOWN_TIMEOUT; esoc->clink_ops = clink_ops; esoc->parent = mdm->dev; esoc->owner = THIS_MODULE; Loading
drivers/esoc/esoc-mdm-pon.c +27 −3 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ static int mdm9x55_toggle_soft_reset(struct mdm_ctrl *mdm, bool atomic) { int soft_reset_direction_assert = 0, soft_reset_direction_de_assert = 1; uint32_t reset_time_us = mdm->reset_time_ms * 1000; if (mdm->soft_reset_inverted) { soft_reset_direction_assert = 1; Loading @@ -52,9 +53,9 @@ static int mdm9x55_toggle_soft_reset(struct mdm_ctrl *mdm, bool atomic) * Allow PS hold assert to be detected */ if (!atomic) usleep_range(203000, 300000); usleep_range(reset_time_us, reset_time_us + 100000); else mdelay(203); mdelay(mdm->reset_time_ms); gpio_direction_output(MDM_GPIO(mdm, AP2MDM_SOFT_RESET), soft_reset_direction_de_assert); return 0; Loading Loading @@ -212,6 +213,29 @@ static int apq8096_pon_dt_init(struct mdm_ctrl *mdm) return 0; } static int mdm9x55_pon_dt_init(struct mdm_ctrl *mdm) { int val; struct device_node *node = mdm->dev->of_node; enum of_gpio_flags flags = OF_GPIO_ACTIVE_LOW; val = of_property_read_u32(node, "qcom,reset-time-ms", &mdm->reset_time_ms); if (val) mdm->reset_time_ms = DEF_MDM9X55_RESET_TIME; val = of_get_named_gpio_flags(node, "qcom,ap2mdm-soft-reset-gpio", 0, &flags); if (val >= 0) { MDM_GPIO(mdm, AP2MDM_SOFT_RESET) = val; if (flags & OF_GPIO_ACTIVE_LOW) mdm->soft_reset_inverted = 1; return 0; } else return -EIO; } static int mdm4x_pon_dt_init(struct mdm_ctrl *mdm) { int val; Loading Loading @@ -290,7 +314,7 @@ struct mdm_pon_ops mdm9x55_pon_ops = { .soft_reset = mdm9x55_toggle_soft_reset, .poff_force = mdm9x55_power_down, .cold_reset = mdm9x55_cold_reset, .dt_init = mdm4x_pon_dt_init, .dt_init = mdm9x55_pon_dt_init, .setup = mdm4x_pon_setup, }; Loading
drivers/esoc/esoc-mdm.h +4 −0 Original line number Diff line number Diff line Loading @@ -43,6 +43,8 @@ #define MDM_MODEM_TIMEOUT 3000 #define DEF_RAMDUMP_TIMEOUT 120000 #define DEF_RAMDUMP_DELAY 2000 #define DEF_SHUTDOWN_TIMEOUT 10000 #define DEF_MDM9X55_RESET_TIME 203 #define RD_BUF_SIZE 100 #define SFR_MAX_RETRIES 10 #define SFR_RETRY_INTERVAL 1000 Loading Loading @@ -96,6 +98,8 @@ struct mdm_ctrl { bool debug_fail; unsigned int dump_timeout_ms; unsigned int ramdump_delay_ms; unsigned int shutdown_timeout_ms; unsigned int reset_time_ms; struct esoc_clink *esoc; bool get_restart_reason; unsigned long irq_mask; Loading