mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-10 14:19:09 -04:00
Merge "power: reset: qcom-dload-mode: Add support for EDL over PCIe"
This commit is contained in:
commit
aaa533fbc7
2 changed files with 34 additions and 2 deletions
|
|
@ -39,6 +39,7 @@ static bool enable_dump =
|
|||
IS_ENABLED(CONFIG_POWER_RESET_QCOM_DOWNLOAD_MODE_DEFAULT);
|
||||
static enum qcom_download_mode current_download_mode = QCOM_DOWNLOAD_NODUMP;
|
||||
static enum qcom_download_mode dump_mode = QCOM_DOWNLOAD_FULLDUMP;
|
||||
static bool early_pcie_init_enable;
|
||||
|
||||
static int set_download_mode(enum qcom_download_mode mode)
|
||||
{
|
||||
|
|
@ -262,8 +263,10 @@ static int qcom_dload_reboot(struct notifier_block *this, unsigned long event,
|
|||
set_download_mode(QCOM_DOWNLOAD_NODUMP);
|
||||
|
||||
if (cmd) {
|
||||
if (!strcmp(cmd, "edl"))
|
||||
set_download_mode(QCOM_DOWNLOAD_EDL);
|
||||
if (!strcmp(cmd, "edl")) {
|
||||
early_pcie_init_enable ? set_download_mode(QCOM_EDLOAD_PCI_MODE)
|
||||
: set_download_mode(QCOM_DOWNLOAD_EDL);
|
||||
}
|
||||
else if (!strcmp(cmd, "qcom_dload"))
|
||||
msm_enable_dump_mode(true);
|
||||
}
|
||||
|
|
@ -311,6 +314,33 @@ static void store_kaslr_offset(void)
|
|||
static void store_kaslr_offset(void) {}
|
||||
#endif /* CONFIG_RANDOMIZE_BASE */
|
||||
|
||||
static void check_pci_edl(struct device_node *np)
|
||||
{
|
||||
void __iomem *mem;
|
||||
uint32_t read_val;
|
||||
int ret_l, ret_h, l, h, mask_value;
|
||||
|
||||
mem = of_iomap(np, 0);
|
||||
if (!mem) {
|
||||
pr_info("Unable to map memory for DT property: %s\n", np->name);
|
||||
return;
|
||||
}
|
||||
|
||||
read_val = __raw_readl(mem);
|
||||
ret_l = of_property_read_u32_index(np, "qcom,boot-config-shift", 0, &l);
|
||||
ret_h = of_property_read_u32_index(np, "qcom,boot-config-shift", 1, &h);
|
||||
|
||||
if (!ret_l && !ret_h) {
|
||||
mask_value = (read_val >> l) & GENMASK(h - l, 0);
|
||||
if (mask_value == 5 || mask_value == 7) {
|
||||
early_pcie_init_enable = true;
|
||||
pr_info("Setting up EDL mode to PCIE\n");
|
||||
}
|
||||
}
|
||||
|
||||
iounmap(mem);
|
||||
}
|
||||
|
||||
static int qcom_dload_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct qcom_dload *poweroff;
|
||||
|
|
@ -340,6 +370,7 @@ static int qcom_dload_probe(struct platform_device *pdev)
|
|||
|
||||
poweroff->dload_dest_addr = map_prop_mem("qcom,msm-imem-dload-type");
|
||||
store_kaslr_offset();
|
||||
check_pci_edl(pdev->dev.of_node);
|
||||
|
||||
msm_enable_dump_mode(enable_dump);
|
||||
if (!enable_dump)
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
enum qcom_download_mode {
|
||||
QCOM_DOWNLOAD_NODUMP = 0x00,
|
||||
QCOM_DOWNLOAD_EDL = 0x01,
|
||||
QCOM_EDLOAD_PCI_MODE = 0X04,
|
||||
QCOM_DOWNLOAD_FULLDUMP = 0x10,
|
||||
QCOM_DOWNLOAD_MINIDUMP = 0x20,
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue