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

Commit 2ab44047 authored by qctecmdr Service's avatar qctecmdr Service Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: camera: icp: Send I/O memory region info to FW"

parents ce9c96e5 054acaa2
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -448,10 +448,10 @@
				};

				iova-mem-region-shared {
					/* Shared region is 100MB long */
					/* Shared region is 150MB long */
					iova-region-name = "shared";
					iova-region-start = <0x7400000>;
					iova-region-len = <0x6400000>;
					iova-region-len = <0x9600000>;
					iova-region-id = <0x1>;
					status = "ok";
				};
@@ -459,17 +459,17 @@
				iova-mem-region-secondary-heap {
					/* Secondary heap region is 1MB long */
					iova-region-name = "secheap";
					iova-region-start = <0xd800000>;
					iova-region-start = <0x10a00000>;
					iova-region-len = <0x100000>;
					iova-region-id = <0x4>;
					status = "ok";
				};

				iova-mem-region-io {
					/* IO region is approximately 3 GB */
					/* IO region is approximately 3.3 GB */
					iova-region-name = "io";
					iova-region-start = <0xda00000>;
					iova-region-len = <0xace00000>;
					iova-region-start = <0x10c00000>;
					iova-region-len = <0xcf300000>;
					iova-region-id = <0x3>;
					status = "ok";
				};
@@ -477,7 +477,7 @@
				iova-mem-qdss-region {
					/* QDSS region is appropriate 1MB */
					iova-region-name = "qdss";
					iova-region-start = <0xd900000>;
					iova-region-start = <0x10b00000>;
					iova-region-len = <0x100000>;
					iova-region-id = <0x5>;
					qdss-phy-addr = <0x16790000>;
+2 −0
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ struct hfi_mem {
 * @sfr_buf: buffer for subsystem failure reason[SFR]
 * @sec_heap: secondary heap hfi memory for firmware
 * @qdss: qdss mapped memory for fw
 * @io_mem: io memory info
 * @icp_base: icp base address
 */
struct hfi_mem_info {
@@ -42,6 +43,7 @@ struct hfi_mem_info {
	struct hfi_mem sec_heap;
	struct hfi_mem shmem;
	struct hfi_mem qdss;
	struct hfi_mem io_mem;
	void __iomem *icp_base;
};

+5 −2
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Copyright (c) 2018, The Linux Foundation. All rights reserved.
 * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
 */

#ifndef _CAM_HFI_REG_H_
@@ -35,8 +35,11 @@
#define HFI_REG_UNCACHED_HEAP_PTR               0x5C
#define HFI_REG_UNCACHED_HEAP_SIZE              0x60
#define HFI_REG_QDSS_IOVA                       0x6C
#define HFI_REG_QDSS_IOVA_SIZE                  0x70
#define HFI_REG_SFR_PTR                         0x68
#define HFI_REG_QDSS_IOVA_SIZE                  0x70
#define HFI_REG_IO_REGION_IOVA                  0x74
#define HFI_REG_IO_REGION_SIZE                  0x78

/* end of ICP CSR registers */

/* flags for ICP CSR registers */
+8 −0
Original line number Diff line number Diff line
@@ -665,6 +665,10 @@ int cam_hfi_resume(struct hfi_mem_info *hfi_mem,
		icp_base + HFI_REG_QDSS_IOVA);
	cam_io_w_mb((uint32_t)hfi_mem->qdss.len,
		icp_base + HFI_REG_QDSS_IOVA_SIZE);
	cam_io_w_mb((uint32_t)hfi_mem->io_mem.iova,
		icp_base + HFI_REG_IO_REGION_IOVA);
	cam_io_w_mb((uint32_t)hfi_mem->io_mem.len,
		icp_base + HFI_REG_IO_REGION_SIZE);

	return rc;
}
@@ -853,6 +857,10 @@ int cam_hfi_init(uint8_t event_driven_mode, struct hfi_mem_info *hfi_mem,
		icp_base + HFI_REG_QDSS_IOVA);
	cam_io_w_mb((uint32_t)hfi_mem->qdss.len,
		icp_base + HFI_REG_QDSS_IOVA_SIZE);
	cam_io_w_mb((uint32_t)hfi_mem->io_mem.iova,
		icp_base + HFI_REG_IO_REGION_IOVA);
	cam_io_w_mb((uint32_t)hfi_mem->io_mem.len,
		icp_base + HFI_REG_IO_REGION_SIZE);

	hw_version = cam_io_r(icp_base + HFI_REG_A5_HW_VERSION);

+38 −0
Original line number Diff line number Diff line
@@ -2177,6 +2177,25 @@ static int cam_icp_allocate_qdss_mem(void)
	return rc;
}

static int cam_icp_get_io_mem_info(void)
{
	int rc;
	size_t len;
	dma_addr_t iova;

	rc = cam_smmu_get_io_region_info(icp_hw_mgr.iommu_hdl,
		&iova, &len);
	if (rc)
		return rc;

	icp_hw_mgr.hfi_mem.io_mem.iova_len = len;
	icp_hw_mgr.hfi_mem.io_mem.iova_start = iova;

	CAM_DBG(CAM_ICP, "iova: %llx, len: %zu", iova, len);

	return rc;
}

static int cam_icp_allocate_hfi_mem(void)
{
	int rc;
@@ -2237,7 +2256,15 @@ static int cam_icp_allocate_hfi_mem(void)
		goto sec_heap_alloc_failed;
	}

	rc = cam_icp_get_io_mem_info();
	if (rc) {
		CAM_ERR(CAM_ICP, "Unable to get I/O region info");
		goto get_io_mem_failed;
	}

	return rc;
get_io_mem_failed:
	cam_mem_mgr_free_memory_region(&icp_hw_mgr.hfi_mem.sec_heap);
sec_heap_alloc_failed:
	cam_mem_mgr_release_mem(&icp_hw_mgr.hfi_mem.sfr_buf);
sfr_buf_alloc_failed:
@@ -2456,6 +2483,14 @@ static int cam_icp_mgr_hfi_resume(struct cam_icp_hw_mgr *hw_mgr)

	hfi_mem.qdss.iova = icp_hw_mgr.hfi_mem.qdss_buf.iova;
	hfi_mem.qdss.len = icp_hw_mgr.hfi_mem.qdss_buf.len;

	hfi_mem.io_mem.iova = icp_hw_mgr.hfi_mem.io_mem.iova_start;
	hfi_mem.io_mem.len = icp_hw_mgr.hfi_mem.io_mem.iova_len;

	CAM_DBG(CAM_ICP, "IO region IOVA = %X length = %lld",
			hfi_mem.io_mem.iova,
			hfi_mem.io_mem.len);

	return cam_hfi_resume(&hfi_mem,
		a5_dev->soc_info.reg_map[A5_SIERRA_BASE].mem_base,
		hw_mgr->a5_jtag_debug);
@@ -2836,6 +2871,9 @@ static int cam_icp_mgr_hfi_init(struct cam_icp_hw_mgr *hw_mgr)
	hfi_mem.qdss.iova = icp_hw_mgr.hfi_mem.qdss_buf.iova;
	hfi_mem.qdss.len = icp_hw_mgr.hfi_mem.qdss_buf.len;

	hfi_mem.io_mem.iova = icp_hw_mgr.hfi_mem.io_mem.iova_start;
	hfi_mem.io_mem.len = icp_hw_mgr.hfi_mem.io_mem.iova_len;

	return cam_hfi_init(0, &hfi_mem,
		a5_dev->soc_info.reg_map[A5_SIERRA_BASE].mem_base,
		hw_mgr->a5_jtag_debug);
Loading