[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250109090325.595475-3-ivo.ivanov.ivanov1@gmail.com>
Date: Thu, 9 Jan 2025 11:03:23 +0200
From: Ivaylo Ivanov <ivo.ivanov.ivanov1@...il.com>
To: Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk@...nel.org>,
Conor Dooley <conor+dt@...nel.org>,
Alim Akhtar <alim.akhtar@...sung.com>,
Sam Protsenko <semen.protsenko@...aro.org>,
Peter Griffin <peter.griffin@...aro.org>
Cc: devicetree@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
linux-samsung-soc@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH v5 2/4] soc: samsung: usi: add a routine for unconfiguring the ip
Add a devm_add_action_or_reset() routine for unconfiguring the USI IP
block whenever the device gets removed.
Signed-off-by: Ivaylo Ivanov <ivo.ivanov.ivanov1@...il.com>
---
drivers/soc/samsung/exynos-usi.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/drivers/soc/samsung/exynos-usi.c b/drivers/soc/samsung/exynos-usi.c
index 114352695..4b84f481b 100644
--- a/drivers/soc/samsung/exynos-usi.c
+++ b/drivers/soc/samsung/exynos-usi.c
@@ -174,6 +174,23 @@ static int exynos_usi_configure(struct exynos_usi *usi)
return 0;
}
+static void exynos_usi_unconfigure(void *data)
+{
+ struct exynos_usi *usi = data;
+ u32 val;
+
+ /* Make sure that we've stopped providing the clock to USI IP */
+ val = readl(usi->regs + USI_OPTION);
+ val &= ~USI_OPTION_CLKREQ_ON;
+ val |= ~USI_OPTION_CLKSTOP_ON;
+ writel(val, usi->regs + USI_OPTION);
+
+ /* Set USI block state to reset */
+ val = readl(usi->regs + USI_CON);
+ val |= USI_CON_RESET;
+ writel(val, usi->regs + USI_CON);
+}
+
static int exynos_usi_parse_dt(struct device_node *np, struct exynos_usi *usi)
{
int ret;
@@ -251,6 +268,10 @@ static int exynos_usi_probe(struct platform_device *pdev)
return PTR_ERR(usi->regs);
}
+ ret = devm_add_action_or_reset(&pdev->dev, exynos_usi_unconfigure, usi);
+ if (ret)
+ return ret;
+
ret = exynos_usi_configure(usi);
if (ret)
return ret;
--
2.43.0
Powered by blists - more mailing lists