diff options
author | Ley Foon Tan <ley.foon.tan@intel.com> | 2018-09-19 16:27:19 +0800 |
---|---|---|
committer | Jagan Teki <jagan@amarulasolutions.com> | 2019-10-25 00:48:32 +0530 |
commit | e7e05fcb3edb95584e7294099dbf0d28f0f87322 (patch) | |
tree | 93a7816515cbbc7b6efdfff87f10491c51bba77b /drivers/spi/designware_spi.c | |
parent | 2a2174d3da33b9e71a26ecc5d40f1369401275fd (diff) | |
download | u-boot-e7e05fcb3edb95584e7294099dbf0d28f0f87322.tar.gz |
spi: designware_spi: Disable and free clock when remove driver
Disable and free clock when remove driver.
Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com>
Acked-by: Marek Vasut <marex@denx.de>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
Diffstat (limited to 'drivers/spi/designware_spi.c')
-rw-r--r-- | drivers/spi/designware_spi.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/drivers/spi/designware_spi.c b/drivers/spi/designware_spi.c index 7d58cfae55..91e613e9cd 100644 --- a/drivers/spi/designware_spi.c +++ b/drivers/spi/designware_spi.c @@ -518,8 +518,22 @@ 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; + + ret = reset_release_bulk(&priv->resets); + if (ret) + return ret; - return reset_release_bulk(&priv->resets); +#if CONFIG_IS_ENABLED(CLK) + ret = clk_disable(&priv->clk); + if (ret) + return ret; + + ret = clk_free(&priv->clk); + if (ret) + return ret; +#endif + return 0; } static const struct dm_spi_ops dw_spi_ops = { |