From f094710be7f55e043a9ba628e738a1a3af52dc0d Mon Sep 17 00:00:00 2001 From: Ajay Prathi Date: Fri, 26 Jun 2020 16:38:28 +0530 Subject: [PATCH 1/2] msm: sps: Use iomem attribute for base address Clients may use ioremap api to obtain the bam base address. Add iomem attribute to the base address field in the public SPS structure to avoid type casts. Change-Id: Iba2ec1a9d84c3d57e2ce314ba9dc0b81644db2fb Signed-off-by: Ajay Prathi --- include/linux/msm-sps.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/msm-sps.h b/include/linux/msm-sps.h index 67247dcaa155..773a0be9302b 100644 --- a/include/linux/msm-sps.h +++ b/include/linux/msm-sps.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* - * Copyright (c) 2016-2020, The Linux Foundation. All rights reserved. + * Copyright (c) 2016-2021, The Linux Foundation. All rights reserved. */ /* Smart-Peripheral-Switch (SPS) API. */ @@ -485,7 +485,7 @@ struct sps_bam_props { * */ struct sps_mem_buffer { - void *base; + void __iomem *base; phys_addr_t phys_base; unsigned long iova; u32 size; From c76ce6f8489769c2f18a9c8b870a1cfccb71a514 Mon Sep 17 00:00:00 2001 From: Rama Krishna Phani A Date: Tue, 7 Jul 2020 16:02:33 +0530 Subject: [PATCH 2/2] msm: sps: Correct descriptor fifo address to dump contents Few clients of BAM will use SMMU for data transfers. Assign correct descriptor fifo address for SMMU clients of BAM while dumping contents. Change-Id: I21584e6778315f51cac0d202d41f4c81a56fcbf0 Signed-off-by: Rama Krishna Phani A --- drivers/platform/msm/sps/bam.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/platform/msm/sps/bam.c b/drivers/platform/msm/sps/bam.c index 3c37ffb421df..e99e9e3c2b66 100644 --- a/drivers/platform/msm/sps/bam.c +++ b/drivers/platform/msm/sps/bam.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Copyright (c) 2011-2020, The Linux Foundation. All rights reserved. + * Copyright (c) 2011-2021, The Linux Foundation. All rights reserved. */ /* Bus-Access-Manager (BAM) Hardware manager. */ @@ -2140,13 +2140,16 @@ void print_bam_pipe_desc_fifo(void *virt_addr, u32 pipe_index, u32 option) u32 pipe = pipe_index; u32 desc_fifo_addr; u32 desc_fifo_size; - u32 *desc_fifo; + u32 __iomem *desc_fifo; int i; char desc_info[MAX_MSG_LEN]; + struct sps_bam *dev; if (base == NULL) return; + dev = to_sps_bam_dev(virt_addr); + desc_fifo_addr = bam_read_reg(base, P_DESC_FIFO_ADDR, pipe); desc_fifo_size = bam_read_reg_field(base, P_FIFO_SIZES, pipe, P_DESC_FIFO_SIZE); @@ -2167,7 +2170,14 @@ void print_bam_pipe_desc_fifo(void *virt_addr, u32 pipe_index, u32 option) "BAM_P_DESC_FIFO_SIZE: 0x%x (%d)\n\n", desc_fifo_addr, desc_fifo_size, desc_fifo_size); - desc_fifo = (u32 *) phys_to_virt(desc_fifo_addr); + if (dev->props.options & SPS_BAM_SMMU_EN) { + struct sps_pipe *pipe_indx = dev->pipes[pipe_index]; + + SPS_DUMP("%s", "SMMU is enabled\n"); + desc_fifo = pipe_indx->map->desc.base; + } else { + desc_fifo = (u32 __iomem *) phys_to_virt(desc_fifo_addr); + } if (option == 100) { SPS_DUMP("%s",