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

Commit 8d7ca491 authored by Karthik Anantha Ram's avatar Karthik Anantha Ram Committed by Gerrit - the friendly Code Review server
Browse files

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



Send I/O memory region start addr and len for ICP
context bank to FW as part of hfi_init

Change-Id: Ia1daf673eb580f533719eb65f7d63cebf7728b5f
Signed-off-by: default avatarKarthik Anantha Ram <kartanan@codeaurora.org>
parent df9877d5
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
/* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -38,6 +38,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 {
@@ -49,6 +50,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
/* Copyright (c) 2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -42,8 +42,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 */
+9 −1
Original line number Diff line number Diff line
/* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -632,6 +632,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;
}
@@ -820,6 +824,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
@@ -2182,6 +2182,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;
@@ -2242,7 +2261,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:
@@ -2461,6 +2488,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);
@@ -2841,6 +2876,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);
+4 −1
Original line number Diff line number Diff line
/* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -80,6 +80,8 @@
 * @fw_buf: Memory info of firmware
 * @qdss_buf: Memory info of qdss
 * @sfr_buf: Memory info for sfr buffer
 * @shmem: Memory info for shared region
 * @io_mem: Memory info for io region
 */
struct icp_hfi_mem_info {
	struct cam_mem_mgr_memory_desc qtbl;
@@ -91,6 +93,7 @@ struct icp_hfi_mem_info {
	struct cam_mem_mgr_memory_desc qdss_buf;
	struct cam_mem_mgr_memory_desc sfr_buf;
	struct cam_smmu_region_info shmem;
	struct cam_smmu_region_info io_mem;
};

/**
Loading