mirror of
https://github.com/FEX-Emu/linux.git
synced 2025-01-02 23:30:04 +00:00
crypto: caam - fix ERA retrieval function
SEC ERA has to be retrieved by reading the "fsl,sec-era" property from the device tree. This property is updated/filled in by u-boot. Signed-off-by: Alex Porosanu <alexandru.porosanu@freescale.com> Reviewed-by: Horia Geanta <horia.geanta@freescale.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
d167b6e1fb
commit
883619a931
@ -14,7 +14,6 @@
|
|||||||
#include "jr.h"
|
#include "jr.h"
|
||||||
#include "desc_constr.h"
|
#include "desc_constr.h"
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
#include "ctrl.h"
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Descriptor to instantiate RNG State Handle 0 in normal mode and
|
* Descriptor to instantiate RNG State Handle 0 in normal mode and
|
||||||
@ -352,32 +351,17 @@ static void kick_trng(struct platform_device *pdev, int ent_delay)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* caam_get_era() - Return the ERA of the SEC on SoC, based
|
* caam_get_era() - Return the ERA of the SEC on SoC, based
|
||||||
* on the SEC_VID register.
|
* on "sec-era" propery in the DTS. This property is updated by u-boot.
|
||||||
* Returns the ERA number (1..4) or -ENOTSUPP if the ERA is unknown.
|
|
||||||
* @caam_id - the value of the SEC_VID register
|
|
||||||
**/
|
**/
|
||||||
int caam_get_era(u64 caam_id)
|
int caam_get_era(void)
|
||||||
{
|
{
|
||||||
struct sec_vid *sec_vid = (struct sec_vid *)&caam_id;
|
struct device_node *caam_node;
|
||||||
static const struct {
|
for_each_compatible_node(caam_node, NULL, "fsl,sec-v4.0") {
|
||||||
u16 ip_id;
|
const uint32_t *prop = (uint32_t *)of_get_property(caam_node,
|
||||||
u8 maj_rev;
|
"fsl,sec-era",
|
||||||
u8 era;
|
NULL);
|
||||||
} caam_eras[] = {
|
return prop ? *prop : -ENOTSUPP;
|
||||||
{0x0A10, 1, 1},
|
}
|
||||||
{0x0A10, 2, 2},
|
|
||||||
{0x0A12, 1, 3},
|
|
||||||
{0x0A14, 1, 3},
|
|
||||||
{0x0A14, 2, 4},
|
|
||||||
{0x0A16, 1, 4},
|
|
||||||
{0x0A11, 1, 4}
|
|
||||||
};
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(caam_eras); i++)
|
|
||||||
if (caam_eras[i].ip_id == sec_vid->ip_id &&
|
|
||||||
caam_eras[i].maj_rev == sec_vid->maj_rev)
|
|
||||||
return caam_eras[i].era;
|
|
||||||
|
|
||||||
return -ENOTSUPP;
|
return -ENOTSUPP;
|
||||||
}
|
}
|
||||||
@ -551,7 +535,7 @@ static int caam_probe(struct platform_device *pdev)
|
|||||||
|
|
||||||
/* Report "alive" for developer to see */
|
/* Report "alive" for developer to see */
|
||||||
dev_info(dev, "device ID = 0x%016llx (Era %d)\n", caam_id,
|
dev_info(dev, "device ID = 0x%016llx (Era %d)\n", caam_id,
|
||||||
caam_get_era(caam_id));
|
caam_get_era());
|
||||||
dev_info(dev, "job rings = %d, qi = %d\n",
|
dev_info(dev, "job rings = %d, qi = %d\n",
|
||||||
ctrlpriv->total_jobrs, ctrlpriv->qi_present);
|
ctrlpriv->total_jobrs, ctrlpriv->qi_present);
|
||||||
|
|
||||||
|
@ -8,6 +8,6 @@
|
|||||||
#define CTRL_H
|
#define CTRL_H
|
||||||
|
|
||||||
/* Prototypes for backend-level services exposed to APIs */
|
/* Prototypes for backend-level services exposed to APIs */
|
||||||
int caam_get_era(u64 caam_id);
|
int caam_get_era(void);
|
||||||
|
|
||||||
#endif /* CTRL_H */
|
#endif /* CTRL_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user