Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 956d8e87 authored by QCTECMDR Service's avatar QCTECMDR Service Committed by Gerrit - the friendly Code Review server
Browse files

Merge "power: reset: qcom-dload-mode: nodump mode error handling"

parents 9c3cd852 cef04508
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -207,6 +207,25 @@ void qcom_scm_set_download_mode(enum qcom_download_mode mode,
}
EXPORT_SYMBOL(qcom_scm_set_download_mode);

int qcom_scm_get_download_mode(unsigned int *mode, phys_addr_t tcsr_boot_misc)
{
	int ret = -EINVAL;
	struct device *dev = __scm ? __scm->dev : NULL;

	if (tcsr_boot_misc || (__scm && __scm->dload_mode_addr)) {
		ret = qcom_scm_io_readl(tcsr_boot_misc ? : __scm->dload_mode_addr, mode);
	} else {
		dev_err(dev,
			"No available mechanism for getting download mode\n");
	}

	if (ret)
		dev_err(dev, "failed to get download mode: %d\n", ret);

	return ret;
}
EXPORT_SYMBOL_GPL(qcom_scm_get_download_mode);

int qcom_scm_config_cpu_errata(void)
{
	return __qcom_scm_config_cpu_errata(__scm->dev);
+15 −0
Original line number Diff line number Diff line
@@ -219,6 +219,17 @@ static ssize_t dload_mode_store(struct kobject *kobj,
				const char *buf, size_t count)
{
	enum qcom_download_mode mode;
#ifdef CONFIG_POWER_RESET_QCOM_DOWNLOAD_MODE_NODUMP
	int temp;

	dump_mode = qcom_scm_get_download_mode(&temp, 0) ? dump_mode : temp;

	if (dump_mode == QCOM_DOWNLOAD_NODUMP) {
		pr_err("%s: Current dump mode already set: nodump\n", __func__);
		pr_err("%s: Changing dump mode now is not allowed, reboot the device\n", __func__);
		return -EINVAL;
	}
#endif

	if (sysfs_streq(buf, "full"))
		mode = QCOM_DOWNLOAD_FULLDUMP;
@@ -234,7 +245,11 @@ static ssize_t dload_mode_store(struct kobject *kobj,
#endif
	else {
		pr_err("Invalid dump mode request...\n");
#ifdef CONFIG_POWER_RESET_QCOM_DOWNLOAD_MODE_NODUMP
		pr_err("Supported dumps: 'full', 'mini', 'both' or 'nodump'\n");
#else
		pr_err("Supported dumps: 'full', 'mini', or 'both'\n");
#endif
		return -EINVAL;
	}

+3 −0
Original line number Diff line number Diff line
@@ -95,6 +95,7 @@ extern int qcom_scm_set_remote_state(u32 state, u32 id);
extern int qcom_scm_spin_cpu(void);
extern void qcom_scm_set_download_mode(enum qcom_download_mode mode,
				       phys_addr_t tcsr_boot_misc);
extern int qcom_scm_get_download_mode(unsigned int *mode, phys_addr_t tcsr_boot_misc);
extern int qcom_scm_config_cpu_errata(void);
extern void qcom_scm_phy_update_scm_level_shifter(u32 val);
extern bool qcom_scm_pas_supported(u32 peripheral);
@@ -244,6 +245,8 @@ static inline u32 qcom_scm_set_remote_state(u32 state, u32 id)
static inline int qcom_scm_spin_cpu(void) { return -ENODEV; }
static inline void qcom_scm_set_download_mode(enum qcom_download_mode mode,
		phys_addr_t tcsr_boot_misc) {}
static inline int qcom_scm_get_download_mode(unsigned int *mode,
		phys_addr_t tcsr_boot_misc) {}
static inline int qcom_scm_config_cpu_errata(void)
		{ return -ENODEV; }
static inline void qcom_scm_phy_update_scm_level_shifter(u32 val) {}