crypto: ux500/cryp - Prepare clock before enabling it

If we fail to prepare the ux500-cryp clock before enabling it the
platform will fail to boot. Here we insure this happens.

Cc: David S. Miller <davem@davemloft.net>
Cc: Andreas Westin <andreas.westin@stericsson.com>
Cc: linux-crypto@vger.kernel.org
Acked-by: Herbert Xu <herbert@gondor.apana.org.au>
Acked-by: Ulf Hansson <ulf.hansson@linaro.org>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
Lee Jones 2013-05-15 10:51:38 +01:00 коммит произвёл Linus Walleij
Родитель 4db17745c2
Коммит 8703ffdd90
1 изменённых файлов: 11 добавлений и 1 удалений

Просмотреть файл

@ -1458,11 +1458,17 @@ static int ux500_cryp_probe(struct platform_device *pdev)
goto out_regulator; goto out_regulator;
} }
ret = clk_prepare(device_data->clk);
if (ret) {
dev_err(dev, "[%s]: clk_prepare() failed!", __func__);
goto out_clk;
}
/* Enable device power (and clock) */ /* Enable device power (and clock) */
ret = cryp_enable_power(device_data->dev, device_data, false); ret = cryp_enable_power(device_data->dev, device_data, false);
if (ret) { if (ret) {
dev_err(dev, "[%s]: cryp_enable_power() failed!", __func__); dev_err(dev, "[%s]: cryp_enable_power() failed!", __func__);
goto out_clk; goto out_clk_unprepare;
} }
cryp_error = cryp_check(device_data); cryp_error = cryp_check(device_data);
@ -1523,6 +1529,9 @@ static int ux500_cryp_probe(struct platform_device *pdev)
out_power: out_power:
cryp_disable_power(device_data->dev, device_data, false); cryp_disable_power(device_data->dev, device_data, false);
out_clk_unprepare:
clk_unprepare(device_data->clk);
out_clk: out_clk:
clk_put(device_data->clk); clk_put(device_data->clk);
@ -1593,6 +1602,7 @@ static int ux500_cryp_remove(struct platform_device *pdev)
dev_err(&pdev->dev, "[%s]: cryp_disable_power() failed", dev_err(&pdev->dev, "[%s]: cryp_disable_power() failed",
__func__); __func__);
clk_unprepare(device_data->clk);
clk_put(device_data->clk); clk_put(device_data->clk);
regulator_put(device_data->pwr_regulator); regulator_put(device_data->pwr_regulator);