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

Commit d65a35e9 authored by Mahesh Sivasubramanian's avatar Mahesh Sivasubramanian
Browse files

drivers: qcom: Read command DB address/size from shared location



The command DB address on the RAM could change between builds. The AOP
stores this address in a dictionary that remains consistent for the
duration of a target. Read command DB address from this global location.

Change-Id: I37bfdc801156d14469d9048197b5957e64cf7dd5
Signed-off-by: default avatarMahesh Sivasubramanian <msivasub@codeaurora.org>
parent 7fc1bbb1
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -24,10 +24,12 @@ PROPERTIES:
	Value type: <prop-encoded-array>
	Definition: First element is the base address of shared memory
		Second element is the size of the shared memory region
		Points to the dictionary address that houses the command DB
		start address and the size of the command DB region

Example:

qcom,cmd-db@861e0000 {
	compatible = "qcom,cmd-db";
	reg = <0x861e0000 0x4000>;
	reg = <0xc3f000c 0x8>;
}
+1 −1
Original line number Diff line number Diff line
@@ -2355,7 +2355,7 @@

	cmd_db: qcom,cmd-db@861e0000 {
		compatible = "qcom,cmd-db";
		reg = <0x861e0000 0x4000>;
		reg = <0xc3f000c 8>;
	};

	dcc: dcc_v2@10a2000 {
+16 −6
Original line number Diff line number Diff line
@@ -241,18 +241,28 @@ int cmd_db_get_slave_id(const char *resource_id)

static int cmd_db_dev_probe(struct platform_device *pdev)
{
	struct resource *res;
	struct resource res;
	void __iomem *dict;

	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
	if (!res) {
	dict = of_iomap(pdev->dev.of_node, 0);
	if (!dict) {
		cmd_db_status = -ENOMEM;
		goto failed;
	}

	start_addr = devm_ioremap_resource(&pdev->dev, res);
	/*
	 * Read start address and size of the command DB address from
	 * shared dictionary location
	 */
	res.start = readl_relaxed(dict);
	res.end = res.start + readl_relaxed(dict + 0x4);
	res.flags = IORESOURCE_MEM;
	iounmap(dict);

	start_addr = devm_ioremap_resource(&pdev->dev, &res);

	cmd_db_header = devm_kzalloc(&pdev->dev, sizeof(*cmd_db_header),
			GFP_KERNEL);
	cmd_db_header = devm_kzalloc(&pdev->dev,
			sizeof(*cmd_db_header), GFP_KERNEL);

	if (!cmd_db_header) {
		cmd_db_status = -ENOMEM;