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

Commit 0f38bd9e authored by Archana Sathyakumar's avatar Archana Sathyakumar
Browse files

rpm_stats: Update the reg offset for rpm-stats



The base address has changed and not fixed anymore. Read the offset
from the image header and update the base address based on the offset.

Change-Id: I5f51fc320666e4ff16f86735614413f54571bc1c
Signed-off-by: default avatarArchana Sathyakumar <asathyak@codeaurora.org>
parent ee9bfbf3
Loading
Loading
Loading
Loading
+15 −1
Original line number Diff line number Diff line
@@ -9,10 +9,14 @@ The required properties for rpm-stats are:

- compatible: "qcom,rpm-stats"
- reg: The address on the RPM RAM from where stats are read.
	Second register(optional) specifies the offset of the rpm
	stats start address pointer. If the second register is
	available, the offset value read is added to the first
	register address to read the stats.
- reg-names: Name given the register holding address.
- qcom,sleep-stats-version: Version number.

Example:
Example 1:

qcom,rpm-stats@fc19dbd0 {
		compatible = "qcom,rpm-stats";
@@ -20,3 +24,13 @@ qcom,rpm-stats@fc19dbd0 {
		reg-names = "phys_addr_base";
		qcom,sleep-stats-version = <2>;
};

Example 2:

qcom,rpm-stats@fc000000 {
		compatible = "qcom,rpm-stats";
		reg = <0xfc000000 0x1000>,
			<0xfc190014 0x4>;
		reg-names = "phys_addr_base";
		qcom,sleep-stats-version = <2>;
};
+18 −4
Original line number Diff line number Diff line
@@ -315,8 +315,10 @@ static int msm_rpmstats_probe(struct platform_device *pdev)
	struct dentry *dent = NULL;
	struct msm_rpmstats_platform_data *pdata;
	struct msm_rpmstats_platform_data *pd;
	struct resource *res = NULL;
	struct resource *res = NULL, *offset = NULL;
	struct device_node *node = NULL;
	uint32_t offset_addr = 0;
	void __iomem *phys_ptr = NULL;
	int ret = 0;

	if (!pdev)
@@ -328,11 +330,23 @@ static int msm_rpmstats_probe(struct platform_device *pdev)
		return -ENOMEM;

	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);

	if (!res)
		return -EINVAL;

	pdata->phys_addr_base  = res->start;
	offset = platform_get_resource(pdev, IORESOURCE_MEM, 1);
	if (offset) {
		/* Remap the rpm-stats pointer */
		phys_ptr = ioremap_nocache(offset->start, SZ_4);
		if (!phys_ptr) {
			pr_err("%s: Failed to ioremap address: %x\n",
					__func__, offset_addr);
			return -ENODEV;
		}
		offset_addr = readl_relaxed(phys_ptr);
		iounmap(phys_ptr);
	}

	pdata->phys_addr_base  = res->start + offset_addr;

	pdata->phys_size = resource_size(res);
	node = pdev->dev.of_node;