mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 23:32:14 +00:00
crypto: caam - fix LS1021A support on ARMv7 multiplatform kernel
When built using multi_v7_defconfig, driver does not work on LS1021A:
[...]
caam 1700000.crypto: can't identify CAAM ipg clk: -2
caam: probe of 1700000.crypto failed with error -2
[...]
It turns out we have to detect at runtime whether driver is running
on an i.MX platform or not.
Cc: <stable@vger.kernel.org>
Fixes: 6c3af95593
("crypto: caam - add support for LS1021A")
Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
3e1166b94e
commit
c056d910f0
3 changed files with 39 additions and 44 deletions
|
@ -7,6 +7,7 @@
|
|||
#include <linux/device.h>
|
||||
#include <linux/of_address.h>
|
||||
#include <linux/of_irq.h>
|
||||
#include <linux/sys_soc.h>
|
||||
|
||||
#include "compat.h"
|
||||
#include "regs.h"
|
||||
|
@ -19,6 +20,8 @@ bool caam_little_end;
|
|||
EXPORT_SYMBOL(caam_little_end);
|
||||
bool caam_dpaa2;
|
||||
EXPORT_SYMBOL(caam_dpaa2);
|
||||
bool caam_imx;
|
||||
EXPORT_SYMBOL(caam_imx);
|
||||
|
||||
#ifdef CONFIG_CAAM_QI
|
||||
#include "qi.h"
|
||||
|
@ -28,19 +31,11 @@ EXPORT_SYMBOL(caam_dpaa2);
|
|||
* i.MX targets tend to have clock control subsystems that can
|
||||
* enable/disable clocking to our device.
|
||||
*/
|
||||
#ifdef CONFIG_CRYPTO_DEV_FSL_CAAM_IMX
|
||||
static inline struct clk *caam_drv_identify_clk(struct device *dev,
|
||||
char *clk_name)
|
||||
{
|
||||
return devm_clk_get(dev, clk_name);
|
||||
return caam_imx ? devm_clk_get(dev, clk_name) : NULL;
|
||||
}
|
||||
#else
|
||||
static inline struct clk *caam_drv_identify_clk(struct device *dev,
|
||||
char *clk_name)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Descriptor to instantiate RNG State Handle 0 in normal mode and
|
||||
|
@ -430,6 +425,10 @@ static int caam_probe(struct platform_device *pdev)
|
|||
{
|
||||
int ret, ring, gen_sk, ent_delay = RTSDCTL_ENT_DLY_MIN;
|
||||
u64 caam_id;
|
||||
static const struct soc_device_attribute imx_soc[] = {
|
||||
{.family = "Freescale i.MX"},
|
||||
{},
|
||||
};
|
||||
struct device *dev;
|
||||
struct device_node *nprop, *np;
|
||||
struct caam_ctrl __iomem *ctrl;
|
||||
|
@ -451,6 +450,8 @@ static int caam_probe(struct platform_device *pdev)
|
|||
dev_set_drvdata(dev, ctrlpriv);
|
||||
nprop = pdev->dev.of_node;
|
||||
|
||||
caam_imx = (bool)soc_device_match(imx_soc);
|
||||
|
||||
/* Enable clocking */
|
||||
clk = caam_drv_identify_clk(&pdev->dev, "ipg");
|
||||
if (IS_ERR(clk)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue