From 27e6f14c0e016ecc3ce77322c1a6800b3752f03a Mon Sep 17 00:00:00 2001 From: Viswanath L Date: Mon, 1 Apr 2024 15:02:30 +0000 Subject: [PATCH] nvadsp: AMC and AMISC changes for multi-instance - With multiple ADSPs in use, only one of them may configure AMC, so use amc_not_avlbl flag to skip reg parsing, if not needed - Unify reg enums for ADSP and AON; this means that reg DT prop for AON should have a dummy first entry (against AMC) - Remove adsp_prid from chip data, as AMISC base in reg DT prop will be offset as per the ADSP instance Bug 3682950 Bug 4165898 Change-Id: Ic6068aeeb7bbb3540cad36371a6715f8b43ee8b6 Signed-off-by: Viswanath L Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3106899 Reviewed-by: svcacv Reviewed-by: Dara Ramesh GVS: Gerrit_Virtual_Submit --- drivers/platform/tegra/nvadsp/dev.c | 7 ++++--- drivers/platform/tegra/nvadsp/dev.h | 9 ++------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/platform/tegra/nvadsp/dev.c b/drivers/platform/tegra/nvadsp/dev.c index 86acca01..6606dbb2 100644 --- a/drivers/platform/tegra/nvadsp/dev.c +++ b/drivers/platform/tegra/nvadsp/dev.c @@ -479,7 +479,10 @@ static int __init nvadsp_probe(struct platform_device *pdev) goto out; } - for (iter = 0; iter < drv_data->chip_data->num_regs ; iter++) { + for (iter = 0; iter < APE_MAX_REG; iter++) { + if ((iter == AMC) && drv_data->chip_data->amc_not_avlbl) + continue; + res = platform_get_resource(pdev, IORESOURCE_MEM, iter); if (!res) { dev_err(dev, @@ -653,7 +656,6 @@ static struct nvadsp_chipdata tegrat18x_adsp_chipdata = { .amc_err_war = true, .num_irqs = NVADSP_VIRQ_MAX, - .num_regs = APE_MAX_REG, }; static struct nvadsp_chipdata tegra239_adsp_chipdata = { @@ -686,7 +688,6 @@ static struct nvadsp_chipdata tegra239_adsp_chipdata = { /* Populate Chip ID Major Revision as well */ .chipid_ext = 0x9, .num_irqs = NVADSP_VIRQ_MAX, - .num_regs = APE_MAX_REG, }; static const struct of_device_id nvadsp_of_match[] = { diff --git a/drivers/platform/tegra/nvadsp/dev.h b/drivers/platform/tegra/nvadsp/dev.h index d24acd6f..a27e6f49 100644 --- a/drivers/platform/tegra/nvadsp/dev.h +++ b/drivers/platform/tegra/nvadsp/dev.h @@ -25,15 +25,12 @@ enum { AMC, AMISC, + AO_MISC = AMISC, AHSP, + AON_HSP = AHSP, APE_MAX_REG }; -enum { - AO_MISC, - AON_HSP, - AON_MAX_REG, -}; /* * Note: These enums should be aligned to the adsp_mem node mentioned in the * device tree @@ -159,10 +156,8 @@ struct nvadsp_chipdata { bool amc_err_war; u32 chipid_ext; - u32 adsp_prid; char *adsp_elf; size_t num_irqs; - size_t num_regs; }; /* Maximum number of LOAD MAPPINGS supported */