From: Bryan Brattlof <bb@ti.com> To: "Rafael J. Wysocki" <rafael@kernel.org>, Daniel Lezcano <daniel.lezcano@linaro.org>, Amit Kucheria <amitk@kernel.org>, Zhang Rui <rui.zhang@intel.com>, Rob Herring <robh+dt@kernel.org>, Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>, Nishanth Menon <nm@ti.com>, Vignesh Raghavendra <vigneshr@ti.com>, Tero Kristo <kristo@kernel.org> Cc: Keerthy <j-keerthy@ti.com>, Linux PM <linux-pm@vger.kernel.org>, Device Trees <devicetree@vger.kernel.org>, LKML <linux-kernel@vger.kernel.org>, LKML ARM <linux-arm-kernel@lists.infradead.org>, Bryan Brattlof <bb@ti.com> Subject: [PATCH v2 04/11] thermal: k3_j72xx_bandgap: map fuse_base only for erratum workaround Date: Tue, 25 Oct 2022 14:15:08 -0500 [thread overview] Message-ID: <20221025191515.9151-5-bb@ti.com> (raw) In-Reply-To: <20221025191515.9151-1-bb@ti.com> Some of TI's J721E SoCs require a software trimming procedure for the temperature monitors to function properly. To determine if a particular J721E is not affected by this erratum, both bits in the WKUP_SPARE_FUSE0 region must be set. Other SoCs, not affected by this erratum, will not need this region. Map the 'fuse_base' region only when the erratum fix is needed. Signed-off-by: Bryan Brattlof <bb@ti.com> --- drivers/thermal/k3_j72xx_bandgap.c | 37 ++++++++++++++++++------------ 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/drivers/thermal/k3_j72xx_bandgap.c b/drivers/thermal/k3_j72xx_bandgap.c index 71bf65e6afaed..031ea1091909a 100644 --- a/drivers/thermal/k3_j72xx_bandgap.c +++ b/drivers/thermal/k3_j72xx_bandgap.c @@ -386,15 +386,32 @@ static int k3_j72xx_bandgap_probe(struct platform_device *pdev) if (IS_ERR(bgp->cfg2_base)) return PTR_ERR(bgp->cfg2_base); - res = platform_get_resource(pdev, IORESOURCE_MEM, 2); - 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) workaround_needed = driver_data->has_errata_i2128; + /* + * Some of TI's J721E SoCs require a software trimming procedure + * for the temperature monitors to function properly. To determine + * if this particular SoC is NOT affected, both bits in the + * WKUP_SPARE_FUSE0[31:30] will be set (0xC0000000) indicating + * when software trimming should NOT be applied. + * + * https://www.ti.com/lit/er/sprz455c/sprz455c.pdf + */ + if (workaround_needed) { + res = platform_get_resource(pdev, IORESOURCE_MEM, 2); + fuse_base = devm_ioremap_resource(dev, res); + if (IS_ERR(fuse_base)) + return PTR_ERR(fuse_base); + + if ((readl(fuse_base) & 0xc0000000) == 0xc0000000) + workaround_needed = false; + } + + dev_dbg(bgp->dev, "Work around %sneeded\n", + workaround_needed ? "" : "not "); + pm_runtime_enable(dev); ret = pm_runtime_get_sync(dev); if (ret < 0) { @@ -427,13 +444,6 @@ static int k3_j72xx_bandgap_probe(struct platform_device *pdev) goto err_free_ref_table; } - /* Workaround not needed if bit30/bit31 is set even for J721e */ - if (workaround_needed && (readl(fuse_base + 0x0) & 0xc0000000) == 0xc0000000) - workaround_needed = false; - - dev_dbg(bgp->dev, "Work around %sneeded\n", - workaround_needed ? "" : "not "); - if (!workaround_needed) init_table(5, ref_table, golden_factors); else @@ -501,9 +511,6 @@ static int k3_j72xx_bandgap_probe(struct platform_device *pdev) */ kfree(ref_table); - if (workaround_needed) - devm_iounmap(dev, fuse_base); - return 0; err_free_ref_table: -- 2.38.1
WARNING: multiple messages have this Message-ID (diff)
From: Bryan Brattlof <bb@ti.com> To: "Rafael J. Wysocki" <rafael@kernel.org>, Daniel Lezcano <daniel.lezcano@linaro.org>, Amit Kucheria <amitk@kernel.org>, Zhang Rui <rui.zhang@intel.com>, Rob Herring <robh+dt@kernel.org>, Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>, Nishanth Menon <nm@ti.com>, Vignesh Raghavendra <vigneshr@ti.com>, Tero Kristo <kristo@kernel.org> Cc: Keerthy <j-keerthy@ti.com>, Linux PM <linux-pm@vger.kernel.org>, Device Trees <devicetree@vger.kernel.org>, LKML <linux-kernel@vger.kernel.org>, LKML ARM <linux-arm-kernel@lists.infradead.org>, Bryan Brattlof <bb@ti.com> Subject: [PATCH v2 04/11] thermal: k3_j72xx_bandgap: map fuse_base only for erratum workaround Date: Tue, 25 Oct 2022 14:15:08 -0500 [thread overview] Message-ID: <20221025191515.9151-5-bb@ti.com> (raw) In-Reply-To: <20221025191515.9151-1-bb@ti.com> Some of TI's J721E SoCs require a software trimming procedure for the temperature monitors to function properly. To determine if a particular J721E is not affected by this erratum, both bits in the WKUP_SPARE_FUSE0 region must be set. Other SoCs, not affected by this erratum, will not need this region. Map the 'fuse_base' region only when the erratum fix is needed. Signed-off-by: Bryan Brattlof <bb@ti.com> --- drivers/thermal/k3_j72xx_bandgap.c | 37 ++++++++++++++++++------------ 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/drivers/thermal/k3_j72xx_bandgap.c b/drivers/thermal/k3_j72xx_bandgap.c index 71bf65e6afaed..031ea1091909a 100644 --- a/drivers/thermal/k3_j72xx_bandgap.c +++ b/drivers/thermal/k3_j72xx_bandgap.c @@ -386,15 +386,32 @@ static int k3_j72xx_bandgap_probe(struct platform_device *pdev) if (IS_ERR(bgp->cfg2_base)) return PTR_ERR(bgp->cfg2_base); - res = platform_get_resource(pdev, IORESOURCE_MEM, 2); - 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) workaround_needed = driver_data->has_errata_i2128; + /* + * Some of TI's J721E SoCs require a software trimming procedure + * for the temperature monitors to function properly. To determine + * if this particular SoC is NOT affected, both bits in the + * WKUP_SPARE_FUSE0[31:30] will be set (0xC0000000) indicating + * when software trimming should NOT be applied. + * + * https://www.ti.com/lit/er/sprz455c/sprz455c.pdf + */ + if (workaround_needed) { + res = platform_get_resource(pdev, IORESOURCE_MEM, 2); + fuse_base = devm_ioremap_resource(dev, res); + if (IS_ERR(fuse_base)) + return PTR_ERR(fuse_base); + + if ((readl(fuse_base) & 0xc0000000) == 0xc0000000) + workaround_needed = false; + } + + dev_dbg(bgp->dev, "Work around %sneeded\n", + workaround_needed ? "" : "not "); + pm_runtime_enable(dev); ret = pm_runtime_get_sync(dev); if (ret < 0) { @@ -427,13 +444,6 @@ static int k3_j72xx_bandgap_probe(struct platform_device *pdev) goto err_free_ref_table; } - /* Workaround not needed if bit30/bit31 is set even for J721e */ - if (workaround_needed && (readl(fuse_base + 0x0) & 0xc0000000) == 0xc0000000) - workaround_needed = false; - - dev_dbg(bgp->dev, "Work around %sneeded\n", - workaround_needed ? "" : "not "); - if (!workaround_needed) init_table(5, ref_table, golden_factors); else @@ -501,9 +511,6 @@ static int k3_j72xx_bandgap_probe(struct platform_device *pdev) */ kfree(ref_table); - if (workaround_needed) - devm_iounmap(dev, fuse_base); - return 0; err_free_ref_table: -- 2.38.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2022-10-25 19:15 UTC|newest] Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-10-25 19:15 [PATCH v2 00/11] enable VTM node for all TI's K3 SoCs Bryan Brattlof 2022-10-25 19:15 ` Bryan Brattlof 2022-10-25 19:15 ` [PATCH v2 01/11] thermal: k3_j72xx_bandgap: simplify k3_thermal_get_temp() function Bryan Brattlof 2022-10-25 19:15 ` Bryan Brattlof 2022-10-25 19:15 ` [PATCH v2 02/11] thermal: k3_j72xx_bandgap: use bool for i2128 erratum flag Bryan Brattlof 2022-10-25 19:15 ` Bryan Brattlof 2022-10-25 19:15 ` [PATCH v2 03/11] thermal: k3_j72xx_bandgap: remove fuse_base from structure Bryan Brattlof 2022-10-25 19:15 ` Bryan Brattlof 2022-10-25 19:15 ` Bryan Brattlof [this message] 2022-10-25 19:15 ` [PATCH v2 04/11] thermal: k3_j72xx_bandgap: map fuse_base only for erratum workaround Bryan Brattlof 2022-10-25 19:42 ` Bryan Brattlof 2022-10-25 19:42 ` Bryan Brattlof 2022-10-25 19:15 ` [PATCH v2 05/11] dt-bindings: thermal: k3-j72xx: elaborate on binding description Bryan Brattlof 2022-10-25 19:15 ` Bryan Brattlof 2022-10-26 14:54 ` Krzysztof Kozlowski 2022-10-26 14:54 ` Krzysztof Kozlowski 2022-10-25 19:15 ` [PATCH v2 06/11] dt-bindings: thermal: k3-j72xx: conditionally require efuse reg range Bryan Brattlof 2022-10-25 19:15 ` Bryan Brattlof 2022-10-26 14:55 ` Krzysztof Kozlowski 2022-10-26 14:55 ` Krzysztof Kozlowski 2022-10-25 19:15 ` [PATCH v2 07/11] arm64: dts: ti: k3-am64-main: add VTM node Bryan Brattlof 2022-10-25 19:15 ` Bryan Brattlof 2022-10-25 19:15 ` [PATCH v2 08/11] arm64: dts: ti: k3-am62-wakeup: " Bryan Brattlof 2022-10-25 19:15 ` Bryan Brattlof 2022-10-25 19:15 ` [PATCH v2 09/11] arm64: dts: ti: k3-j721e-mcu-wakeup: " Bryan Brattlof 2022-10-25 19:15 ` Bryan Brattlof 2022-10-25 19:15 ` [PATCH v2 10/11] arm64: dts: ti: k3-j721s2-mcu-wakeup: " Bryan Brattlof 2022-10-25 19:15 ` Bryan Brattlof 2022-10-25 19:15 ` [PATCH v2 11/11] arm64: dts: ti: k3-j7200-mcu-wakeup: " Bryan Brattlof 2022-10-25 19:15 ` Bryan Brattlof
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20221025191515.9151-5-bb@ti.com \ --to=bb@ti.com \ --cc=amitk@kernel.org \ --cc=daniel.lezcano@linaro.org \ --cc=devicetree@vger.kernel.org \ --cc=j-keerthy@ti.com \ --cc=kristo@kernel.org \ --cc=krzysztof.kozlowski+dt@linaro.org \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-pm@vger.kernel.org \ --cc=nm@ti.com \ --cc=rafael@kernel.org \ --cc=robh+dt@kernel.org \ --cc=rui.zhang@intel.com \ --cc=vigneshr@ti.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.