From patchwork Tue Oct 11 23:17:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan Brattlof X-Patchwork-Id: 13004535 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0E4CBC4332F for ; Tue, 11 Oct 2022 23:22:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=wiUmlUUSp0GL/tp/KbTYDu35/dhqQsPsm+cjXe+nwbU=; b=ndQePOLDOpht3y nCMjuZBLa22wrHz3GsU+ml/92KOTPmLc3OXOq9EV2mfDaTRhFK9yc6Mv6GWhXju5suj08SchGaExT xwbzuGqWE0vqnojwcx0Pmk/huXX64NdsP1TwuAm4ndLNtvMP0IA4J66EgKe+NFp5dgdDoqtm8VQed PByaYpdYO4g63jKoYDDJD13FaeAw/PDWk7AbbImh7CvYrLeekvWYmacyC4FtvKQpRbIhtsgY3S+8B Ab2yUAmmD9xqsAoHrZRnJGGoKE6XZArgkQsVZHYySPg/vMbEfYJ8q9khSiF/uyGu7u/kELWLI4eQ8 671f2+kjjg5rLtHVMSJA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oiOYV-006ABY-Uh; Tue, 11 Oct 2022 23:21:00 +0000 Received: from lelv0142.ext.ti.com ([198.47.23.249]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oiOW0-00691e-Eq for linux-arm-kernel@lists.infradead.org; Tue, 11 Oct 2022 23:18:28 +0000 Received: from fllv0034.itg.ti.com ([10.64.40.246]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 29BNI0HB038190; Tue, 11 Oct 2022 18:18:00 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1665530280; bh=tm3z2ruXgbRd25DHbTSqLokW/IIzhIxMr7pZxOkJ4kM=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=nMwx00Y9f+7VzCZH0yS0osyjXQ2uUnk+phyExdkTB3rkkOBw1YosH8CGlCwMeL/8z on3zitfsqP6QNWKFbmH2w5ZZsPEmzVa+pz/rsKpi82bI95sd6JmUS4U9Y7JsFxZrEC dE4hL7qrnselRT6HPEiIw5B036nAJPuTgGk+1b+Q= Received: from DFLE104.ent.ti.com (dfle104.ent.ti.com [10.64.6.25]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 29BNI0Ym130127 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 11 Oct 2022 18:18:00 -0500 Received: from DFLE103.ent.ti.com (10.64.6.24) by DFLE104.ent.ti.com (10.64.6.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.6; Tue, 11 Oct 2022 18:17:59 -0500 Received: from fllv0040.itg.ti.com (10.64.41.20) by DFLE103.ent.ti.com (10.64.6.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.6 via Frontend Transport; Tue, 11 Oct 2022 18:17:59 -0500 Received: from localhost (ileaxei01-snat.itg.ti.com [10.180.69.5]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id 29BNHxjc088353; Tue, 11 Oct 2022 18:17:59 -0500 From: Bryan Brattlof To: Rob Herring , Krzysztof Kozlowski CC: "Rafael J. Wysocki" , Daniel Lezcano , Amit Kucheria , Zhang Rui , Nishanth Menon , Vignesh Raghavendra , Tero Kristo , Keerthy , Linux Thermal , Linux Device Tree , LKML , Linux ARM , Bryan Brattlof Subject: [PATCH 03/11] thermal: k3_j72xx_bandgap: remove fuse_base from structure Date: Tue, 11 Oct 2022 18:17:19 -0500 Message-ID: <20221011231727.8090-4-bb@ti.com> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221011231727.8090-1-bb@ti.com> References: <20221011231727.8090-1-bb@ti.com> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3420; h=from:subject; bh=STl+ZBG+9rtQI0+MEWUEPVK+EEoCmb9xPWHIkya++N4=; b=owNCWmg5MUFZJlNZdBYa3QAAX////vf7wz+wv7rirXcqv776Fak+6+7nr+/fYkzr/bdbzf6wARkU OIeo09Q00PSAGmg0NAA0xGTTQD0gaAAAAyAaaNAMjQZPUG0jRoPSaZPIaZRBhNDJiGCNMQ0DAjQNMj CGjQyaMjQ0whiaMjEwjRhMho0GQBpoGmQNAyEPUPIjTTRtQeo09QDQeoNANGmQNHpDRo2kNGgB5Q0A AA0AaDaIeoDIPUGjJtRoBBYoFdSeZAoppCccHOL5IuWQMVxO8y2I4PQGkBIDrAaM0WsOv+jbzzG3yl jX0AP5yjHMocMRxkp6pvpoQZGbJJLMGrlrVtiHqAXSnXDB4Q5wIq/KxaZMK9vWEWYUnp+t1z8uDsD/ r8B6o+Ggp8Us03L4gZ1suTJXfevmgGwuBmvHZ3EN7nWkDKRqBIAK32pEPo1y3pLAcIiGXGA0dRyDBN Unk5zHV8IqWnsdmzxmBpkM1dHDaGCOiRL2Lx0MIOgIC/HHvGslZRn+K55UNxqE81c3WN4XD99WKdqr PeVs1A5+rSZv2LYhsGjl+E+C2jhahd0hPi36fP23hCxMVHgQMwar/PUB6I24kjndooL62UvpipS7Rk pU/X0cgXQM3ZHRByiUuhAAAJm9nteOFKbRLWfJli0hGEBBUIuRzjn+LuSKcKEg6Cw1ug== X-Developer-Key: i=bb@ti.com; a=openpgp; fpr=D3D177E40A38DF4D1853FEEF41B90D5D71D56CE0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221011_161824_652129_96025BDD X-CRM114-Status: GOOD ( 19.16 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 'fuse_base' is only needed during the initial probe function to provide a software trimming method for some devices effected by TI's i2128 erratum. Not all devices that use this hardware device will need to map this eFuse region. Remove fuse_base from the main k3_j72xx_bandgap structure Signed-off-by: Bryan Brattlof --- drivers/thermal/k3_j72xx_bandgap.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/thermal/k3_j72xx_bandgap.c b/drivers/thermal/k3_j72xx_bandgap.c index b9d20026771a5..99df62295a11f 100644 --- a/drivers/thermal/k3_j72xx_bandgap.c +++ b/drivers/thermal/k3_j72xx_bandgap.c @@ -177,7 +177,6 @@ struct k3_j72xx_bandgap { struct device *dev; void __iomem *base; void __iomem *cfg2_base; - void __iomem *fuse_base; struct k3_thermal_data *ts_data[K3_VTM_MAX_NUM_TS]; }; @@ -276,7 +275,7 @@ static int k3_j72xx_bandgap_temp_to_adc_code(int temp) } static void get_efuse_values(int id, struct k3_thermal_data *data, int *err, - struct k3_j72xx_bandgap *bgp) + void __iomem *fuse_base) { int i, tmp, pow; int ct_offsets[5][K3_VTM_CORRECTION_TEMP_CNT] = { @@ -298,16 +297,16 @@ static void get_efuse_values(int id, struct k3_thermal_data *data, int *err, /* Extract the offset value using bit-mask */ if (ct_offsets[id][i] == -1 && i == 1) { /* 25C offset Case of Sensor 2 split between 2 regs */ - tmp = (readl(bgp->fuse_base + 0x8) & 0xE0000000) >> (29); - tmp |= ((readl(bgp->fuse_base + 0xC) & 0x1F) << 3); + tmp = (readl(fuse_base + 0x8) & 0xE0000000) >> (29); + tmp |= ((readl(fuse_base + 0xC) & 0x1F) << 3); pow = tmp & 0x80; } else if (ct_offsets[id][i] == -1 && i == 2) { /* 125C Case of Sensor 3 split between 2 regs */ - tmp = (readl(bgp->fuse_base + 0x4) & 0xF8000000) >> (27); - tmp |= ((readl(bgp->fuse_base + 0x8) & 0xF) << 5); + tmp = (readl(fuse_base + 0x4) & 0xF8000000) >> (27); + tmp |= ((readl(fuse_base + 0x8) & 0xF) << 5); pow = tmp & 0x100; } else { - tmp = readl(bgp->fuse_base + ct_offsets[id][i]); + tmp = readl(fuse_base + ct_offsets[id][i]); tmp &= ct_bm[id][i]; tmp = tmp >> __ffs(ct_bm[id][i]); @@ -356,6 +355,7 @@ static int k3_j72xx_bandgap_probe(struct platform_device *pdev) struct thermal_zone_device *ti_thermal; int *ref_table; struct err_values err_vals; + void __iomem *fuse_base; const s64 golden_factors[] = { -490019999999999936, @@ -387,9 +387,9 @@ static int k3_j72xx_bandgap_probe(struct platform_device *pdev) return PTR_ERR(bgp->cfg2_base); res = platform_get_resource(pdev, IORESOURCE_MEM, 2); - bgp->fuse_base = devm_ioremap_resource(dev, res); - if (IS_ERR(bgp->fuse_base)) - return PTR_ERR(bgp->fuse_base); + fuse_base = devm_ioremap_resource(dev, res); + if (IS_ERR(fuse_base)) + return PTR_ERR(fuse_base); driver_data = of_device_get_match_data(dev); if (driver_data) @@ -428,7 +428,7 @@ static int k3_j72xx_bandgap_probe(struct platform_device *pdev) } /* Workaround not needed if bit30/bit31 is set even for J721e */ - if (workaround_needed && (readl(bgp->fuse_base + 0x0) & 0xc0000000) == 0xc0000000) + if (workaround_needed && (readl(fuse_base + 0x0) & 0xc0000000) == 0xc0000000) workaround_needed = false; dev_dbg(bgp->dev, "Work around %sneeded\n",