[U-Boot] [PATCH] spi: designware_spi: Disable and free clock when remove driver

Ley Foon Tan ley.foon.tan at intel.com
Fri Sep 7 07:42:29 UTC 2018


Disable and free clock when remove driver.

Signed-off-by: Ley Foon Tan <ley.foon.tan at intel.com>
---
 drivers/spi/designware_spi.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/spi/designware_spi.c b/drivers/spi/designware_spi.c
index 5cca414..f4d36cf 100644
--- a/drivers/spi/designware_spi.c
+++ b/drivers/spi/designware_spi.c
@@ -516,8 +516,20 @@ static int dw_spi_set_mode(struct udevice *bus, uint mode)
 static int dw_spi_remove(struct udevice *bus)
 {
 	struct dw_spi_priv *priv = dev_get_priv(bus);
+	int ret;
 
-	return reset_release_bulk(&priv->resets);
+	ret = reset_release_bulk(&priv->resets);
+	if (ret)
+		return ret;
+
+#if CONFIG_IS_ENABLED(CLK)
+	ret = clk_disable(&priv->clk);
+	if (ret)
+		return ret;
+
+	ret = clk_free(&priv->clk);
+#endif
+	return ret;
 }
 
 static const struct dm_spi_ops dw_spi_ops = {
-- 
2.2.2



More information about the U-Boot mailing list