Re: [PATCH v3 2/2] crypto: caam - allow retrieving 'era' from register

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 4/11/2018 2:59 PM, Fabio Estevam wrote:
> From: Fabio Estevam <fabio.estevam@xxxxxxx>
> 
> The 'era' information can be retrieved from CAAM registers, so
> introduce a caam_get_era_from_hw() function that gets it via register
> reads in case the 'fsl,sec-era' property is not passed in the device
> tree.
> 
> This function is based on the U-Boot implementation from
> drivers/crypto/fsl/sec.c
> 
> Signed-off-by: Fabio Estevam <fabio.estevam@xxxxxxx>
> ---
> Changes since v2:
> - Use a local struct for the CAAM era ID
> - Only read caam_id_ms only if ccb_id register does not provide era
> - Improve comment on caam_get_era()
> - Return -ENOTSUPP to keep old behavior
> - Put the defines before the relevant fields
> 
>  drivers/crypto/caam/ctrl.c | 56 ++++++++++++++++++++++++++++++++++++++++++----
>  drivers/crypto/caam/regs.h |  6 +++++
>  2 files changed, 58 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/crypto/caam/ctrl.c b/drivers/crypto/caam/ctrl.c
> index bee690a..ab67e97 100644
> --- a/drivers/crypto/caam/ctrl.c
> +++ b/drivers/crypto/caam/ctrl.c
> @@ -396,11 +396,56 @@ static void kick_trng(struct platform_device *pdev, int ent_delay)
>  	clrsetbits_32(&r4tst->rtmctl, RTMCTL_PRGM, RTMCTL_SAMP_MODE_RAW_ES_SC);
>  }
>  
> +static int caam_get_era_from_hw(struct caam_ctrl __iomem *ctrl)
> +{
> +	static const struct {
> +		u16 ip_id;
> +		u8 maj_rev;
> +		u8 era;
> +	} id[] = {
> +		{0x0A10, 1, 1},
> +		{0x0A10, 2, 2},
> +		{0x0A12, 1, 3},
> +		{0x0A14, 1, 3},
> +		{0x0A14, 2, 4},
> +		{0x0A16, 1, 4},
> +		{0x0A10, 3, 4},
> +		{0x0A11, 1, 4},
> +		{0x0A18, 1, 4},
> +		{0x0A11, 2, 5},
> +		{0x0A12, 2, 5},
> +		{0x0A13, 1, 5},
> +		{0x0A1C, 1, 5}
> +	};
> +	u32 ccbvid, id_ms;
> +	u8 maj_rev,era;
Nitpick:         ^^^ space needed

Please run checkpatch before submitting.

Thanks,
Horia




[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]

  Powered by Linux