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

Commit eba92f48 authored by Pradeep P V K's avatar Pradeep P V K
Browse files

mtd: msm_qpic_nand: Add boot_a and boot_b access to APPS



The existing code logic, checks for partitions that have
access to apps by name "boot". This logic may not work
if the boot partition name changes, let's say as boot_a/b.

So, get the active boot partition details by reading the
new kernel command line parameter "part.activeboot=" and
use this partition page offset address to read the ONFI
parameter page. If active boot partition details are
not found, fallback to legacy code.

Change-Id: I7c7071ccfc687f2e03bd9209a3c7260fb131ff10
Signed-off-by: default avatarPradeep P V K <quic_pragalla@quicinc.com>
parent 811eb4ca
Loading
Loading
Loading
Loading
+24 −7
Original line number Diff line number Diff line
@@ -19,8 +19,24 @@
#define SMEM_AARM_PARTITION_TABLE 9
#define SMEM_APPS 0
#define ONE_CODEWORD_SIZE 516
#define ACTIVE_BOOT_PART_MAX 30

static struct device *dev_node;
static char active_boot_part[ACTIVE_BOOT_PART_MAX] = "boot";

/*
 * Function to get the active boot partition information
 * from kernel command line during system boot.
 */
#ifndef MODULE
static int __init get_active_boot_part(char *str)
{
	strlcpy(active_boot_part, str, ACTIVE_BOOT_PART_MAX);
	return 0;
}

__setup("part.activeboot=", get_active_boot_part);
#endif

/*
 * Get the DMA memory for requested amount of size. It returns the pointer
@@ -798,24 +814,25 @@ static int msm_nand_flash_onfi_probe(struct msm_nand_info *info)

	memset(&data, 0, sizeof(struct msm_nand_flash_onfi_data));

	/*
	 * Lookup the partition to which apps has access to
	 * As a part of FR53657, add support for boot_a
	 * and boot_b partitions.
	/* Lookup the partition to which apps has access to
	 *
	 * active_boot_part value gets updated to either kernel command line
	 * parameter "part.activeboot=" value (if present) or hold the default
	 * "boot" value.
	 */
	for (i = 0; i < FLASH_PTABLE_MAX_PARTS_V4; i++) {
		if (mtd_part[i].name && (!strcmp("boot", mtd_part[i].name) ||
					!strcmp("boot_a", mtd_part[i].name) ||
					!strcmp("boot_b", mtd_part[i].name))) {
		if (mtd_part[i].name && !strcmp(active_boot_part, mtd_part[i].name)) {
			page_address = mtd_part[i].offset << 6;
			break;
		}
	}

	if (!page_address) {
		pr_err("%s: no apps partition found in smem\n", __func__);
		ret = -EPERM;
		goto free_dma;
	}

	data.cfg.cmd = MSM_NAND_CMD_PAGE_READ_ONFI;
	data.exec = 1;
	data.cfg.addr0 = (page_address << 16) |