mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] mfd: atmel-flexcom: Driver refresh
@ 2024-12-27  7:39 Alexander Shiyan
  0 siblings, 0 replies; only message in thread
From: Alexander Shiyan @ 2024-12-27  7:39 UTC (permalink / raw)
  To: barebox; +Cc: Alexander Shiyan

Replace dev_request_mem_resource() with dev_platform_get_and_ioremap_resource(),
clk_get() + clk_enable() with clk_get_enabled()
and use dev_err_probe() as driver refresh.

Signed-off-by: Alexander Shiyan <eagle.alexander923@gmail.com>
---
 drivers/mfd/atmel-flexcom.c | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/drivers/mfd/atmel-flexcom.c b/drivers/mfd/atmel-flexcom.c
index 58e94c4889..11daeafc5f 100644
--- a/drivers/mfd/atmel-flexcom.c
+++ b/drivers/mfd/atmel-flexcom.c
@@ -22,7 +22,7 @@
 
 static int atmel_flexcom_probe(struct device *dev)
 {
-	struct resource *res;
+	void __iomem *base;
 	struct clk *clk;
 	u32 opmode;
 	int err;
@@ -35,17 +35,13 @@ static int atmel_flexcom_probe(struct device *dev)
 	if (opmode < ATMEL_FLEXCOM_MODE_USART || opmode > ATMEL_FLEXCOM_MODE_TWI)
 		return -EINVAL;
 
-	res = dev_request_mem_resource(dev, 0);
-	if (IS_ERR(res))
-		return PTR_ERR(res);
+	base = dev_platform_get_and_ioremap_resource(dev, 0, NULL);
+	if (IS_ERR(base))
+		return dev_err_probe(dev, PTR_ERR(base), "Could not get memory region\n");
 
-	clk = clk_get(dev, NULL);
+	clk = clk_get_enabled(dev, NULL);
 	if (IS_ERR(clk))
-		return PTR_ERR(clk);
-
-	err = clk_enable(clk);
-	if (err)
-		return err;
+		return dev_err_probe(dev, PTR_ERR(clk), "Can't get clk\n");
 
 	/*
 	 * Set the Operating Mode in the Mode Register: only the selected device
@@ -53,7 +49,7 @@ static int atmel_flexcom_probe(struct device *dev)
 	 * inaccessible and are read as zero. Also the external I/O lines of the
 	 * Flexcom are muxed to reach the selected device.
 	 */
-	writel(FLEX_MR_OPMODE(opmode), IOMEM(res->start) + FLEX_MR);
+	writel(FLEX_MR_OPMODE(opmode), base + FLEX_MR);
 
 	clk_disable(clk);
 
-- 
2.39.1




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-12-27  7:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-12-27  7:39 [PATCH] mfd: atmel-flexcom: Driver refresh Alexander Shiyan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox