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

Commit 2d293162 authored by Sahitya Tummala's avatar Sahitya Tummala
Browse files

mtd: msm_qpic_nand: Changes to read boot config register



The resources (such as clocks) needed to enable/probe for NAND
are not available on eMMC based builds. Hence, enabling NAND
will cause boot-up failure on eMMC based builds. To avoid this,
fail NAND driver probe if the boot device used is not NAND.

Change-Id: I9fd83511efb6d413c5cd9f64357a8554f585aa6b
Signed-off-by: default avatarSahitya Tummala <stummala@codeaurora.org>
parent be05b187
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -19,6 +19,9 @@ This is now completely optional as the partition information is avaialble from
bootloader.

Optional properties:
- reg : boot_cfg. This is needed only on the targets where both NAND and eMMC
  devices are supported. On eMMC based builds, NAND cannot be enabled by
  default due to the absence of some of its required resources.
- reg : The partition offset and size
- label : The label / name for this partition.
- read-only: This parameter, if present, indicates that this partition
@@ -36,9 +39,11 @@ Examples:
	qcom,nand@f9af0000 {
		compatible = "qcom,msm-nand";
		reg = <0xf9af0000 0x1000>,
		      <0xf9ac4000 0x8000>;
		      <0xf9ac4000 0x8000>,
		      <0x5e02c 0x4>;
		reg-names = "nand_phys",
			    "bam_phys";
			    "bam_phys",
			    "boot_cfg";
		qcom,reg-adjustment-offset = <0x4000>;

		interrupts = <0 279 0>;
+23 −0
Original line number Diff line number Diff line
@@ -3344,6 +3344,9 @@ static int msm_nand_parse_smem_ptable(int *nr_parts)
}
#endif

#define BOOT_DEV_MASK 0x1E
#define BOOT_DEV_NAND 0x4

/*
 * This function gets called when its device named msm-nand is added to
 * device tree .dts file with all its resources such as physical addresses
@@ -3361,6 +3364,26 @@ static int msm_nand_probe(struct platform_device *pdev)
	int i, err, nr_parts;
	struct device *dev;
	u32 adjustment_offset;
	void __iomem *boot_cfg_base;
	u32 boot_dev;

	res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
						"boot_cfg");
	if (res && res->start) {
		boot_cfg_base = devm_ioremap(&pdev->dev, res->start,
						resource_size(res));
		if (!boot_cfg_base) {
			pr_err("ioremap() failed for addr 0x%x size 0x%x\n",
				res->start, resource_size(res));
			return -ENOMEM;
		}
		boot_dev = (readl_relaxed(boot_cfg_base) & BOOT_DEV_MASK) >> 1;
		if (boot_dev != BOOT_DEV_NAND) {
			pr_err("disabling nand as boot device (%x) is not NAND\n",
					boot_dev);
			return -ENODEV;
		}
	}
	/*
	 * The partition information can also be passed from kernel command
	 * line. Also, the MTD core layer supports adding the whole device as