Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

crypto: caam/qi2 - add support for dpseci_reset()

Add support for dpseci_reset() command for DPSECI objects.
For DPSECI DPAA2 objects with version lower than v5.4 reset command
was broken in MC f/w.

Signed-off-by: Andrei Botila <andrei.botila@nxp.com>
Reviewed-by: Horia Geantă <horia.geanta@nxp.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Andrei Botila and committed by
Herbert Xu
060ce503 7f94adf2

+36
+15
drivers/crypto/caam/caamalg_qi2.c
··· 4697 4697 { 4698 4698 struct device *dev = priv->dev; 4699 4699 struct fsl_mc_device *ls_dev = to_fsl_mc_device(dev); 4700 + int err; 4701 + 4702 + if (DPSECI_VER(priv->major_ver, priv->minor_ver) > DPSECI_VER(5, 3)) { 4703 + err = dpseci_reset(priv->mc_io, 0, ls_dev->mc_handle); 4704 + if (err) 4705 + dev_err(dev, "dpseci_reset() failed\n"); 4706 + } 4700 4707 4701 4708 dpaa2_dpseci_congestion_free(priv); 4702 4709 dpseci_close(priv->mc_io, 0, ls_dev->mc_handle); ··· 4900 4893 } 4901 4894 4902 4895 dev_info(dev, "dpseci v%d.%d\n", priv->major_ver, priv->minor_ver); 4896 + 4897 + if (DPSECI_VER(priv->major_ver, priv->minor_ver) > DPSECI_VER(5, 3)) { 4898 + err = dpseci_reset(priv->mc_io, 0, ls_dev->mc_handle); 4899 + if (err) { 4900 + dev_err(dev, "dpseci_reset() failed\n"); 4901 + goto err_get_vers; 4902 + } 4903 + } 4903 4904 4904 4905 err = dpseci_get_attributes(priv->mc_io, 0, ls_dev->mc_handle, 4905 4906 &priv->dpseci_attr);
+18
drivers/crypto/caam/dpseci.c
··· 104 104 } 105 105 106 106 /** 107 + * dpseci_reset() - Reset the DPSECI, returns the object to initial state 108 + * @mc_io: Pointer to MC portal's I/O object 109 + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' 110 + * @token: Token of DPSECI object 111 + * 112 + * Return: '0' on success, error code otherwise 113 + */ 114 + int dpseci_reset(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token) 115 + { 116 + struct fsl_mc_command cmd = { 0 }; 117 + 118 + cmd.header = mc_encode_cmd_header(DPSECI_CMDID_RESET, 119 + cmd_flags, 120 + token); 121 + return mc_send_command(mc_io, &cmd); 122 + } 123 + 124 + /** 107 125 * dpseci_is_enabled() - Check if the DPSECI is enabled. 108 126 * @mc_io: Pointer to MC portal's I/O object 109 127 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
+2
drivers/crypto/caam/dpseci.h
··· 59 59 60 60 int dpseci_disable(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token); 61 61 62 + int dpseci_reset(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token); 63 + 62 64 int dpseci_is_enabled(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, 63 65 int *en); 64 66
+1
drivers/crypto/caam/dpseci_cmd.h
··· 33 33 #define DPSECI_CMDID_ENABLE DPSECI_CMD_V1(0x002) 34 34 #define DPSECI_CMDID_DISABLE DPSECI_CMD_V1(0x003) 35 35 #define DPSECI_CMDID_GET_ATTR DPSECI_CMD_V1(0x004) 36 + #define DPSECI_CMDID_RESET DPSECI_CMD_V1(0x005) 36 37 #define DPSECI_CMDID_IS_ENABLED DPSECI_CMD_V1(0x006) 37 38 38 39 #define DPSECI_CMDID_SET_RX_QUEUE DPSECI_CMD_V1(0x194)