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

Commit ee9bfbf3 authored by Archana Sathyakumar's avatar Archana Sathyakumar
Browse files

rpm_logs: Update the reg offset for rpm-logs



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

Change-Id: I5084d9932e312593bb16a9cbe3dd2b42d920d89e
Signed-off-by: default avatarArchana Sathyakumar <asathyak@codeaurora.org>
parent 456e2f55
Loading
Loading
Loading
Loading
+20 −2
Original line number Diff line number Diff line
@@ -12,6 +12,10 @@ The required properties for rpm-log are:
- compatible: "qcom,rpm-log"
- reg: Specifies the base physical address and the size of the RPM
	registers from where ulog is read.
	Second register(optional) specifies the offset of the rpm
	log start address pointer. If the second register is available,
	the offset value read is added to the first register address
	to read the ulog message.
- qcom,rpm-addr-phys: RPM reads physical address of the RPM RAM region
		differently when compared to Apps. Physical address of
		the RPM RAM region is at an offset when seen from Apps.
@@ -30,10 +34,24 @@ The required properties for rpm-log are:
				log length mask is stored.
- qcom,offset-page-indices: Offset from the start of the phy_addr_base where
				index to the writer is stored.
Example:

Example 1:
qcom,rpm-log@fc19dc00 {
	compatible = "qcom,rpm-log";
	reg = <0xfc19dc00 0x2000>,
	reg = <0xfc19dc00 0x2000>;
	qcom,offset-rpm-addr = <0xfc000000>;
	qcom,offset-version = <4>;
	qcom,offset-page-buffer-addr = <36>;
	qcom,offset-log-len = <40>;
	qcom,offset-log-len-mask = <44>;
	qcom,offset-page-indices = <56>;
};

Example 2:
qcom,rpm-log@fc000000 {
	compatible = "qcom,rpm-log";
	reg = <0xfc000000 0x2000>,
		<0xfc190018 0x4>;
	qcom,offset-rpm-addr = <0xfc000000>;
	qcom,offset-version = <4>;
	qcom,offset-page-buffer-addr = <36>;
+18 −2
Original line number Diff line number Diff line
@@ -316,12 +316,14 @@ static int msm_rpm_log_probe(struct platform_device *pdev)
{
	struct dentry *dent;
	struct msm_rpm_log_platform_data *pdata;
	struct resource *res = NULL;
	struct resource *res = NULL, *offset = NULL;
	struct device_node *node = NULL;
	phys_addr_t page_buffer_address, rpm_addr_phys;
	int ret = 0;
	char *key = NULL;
	uint32_t val = 0;
	uint32_t offset_addr = 0;
	void __iomem *phys_ptr = NULL;

	node = pdev->dev.of_node;

@@ -333,11 +335,25 @@ static int msm_rpm_log_probe(struct platform_device *pdev)

		res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
		if (!res) {
			pr_err("%s: could not get resource\n", __func__);
			kfree(pdata);
			return -EINVAL;
		}

		pdata->phys_addr_base = res->start;
		offset = platform_get_resource(pdev, IORESOURCE_MEM, 1);
		if (offset) {
			/* Remap the rpm-log 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);

		pdata->reg_base = ioremap_nocache(pdata->phys_addr_base,