Commit dd3c0987 authored by LEROY Christophe's avatar LEROY Christophe Committed by Herbert Xu

crypto: talitos - adapt interrupts and reset functions to SEC1

This patch adapts the interrupts handling and reset function for
SEC1. On SEC1, registers are almost similar to SEC2+, but bits
are sometimes located at different places. So we need to define
TALITOS1 and TALITOS2 versions of some fields, and manage according
to whether it is SEC1 or SEC2.

On SEC1, only one interrupt vector is dedicated to the SEC, so only
interrupt_4ch is needed.

On SEC1, interrupts are enabled by clearing related bits in IMR,
while on SEC2, interrupts are enabled by seting the bits in IMR.

SEC1 also performs parity verification in the DES Unit. We have
to disable this feature because the test vectors provided in
the kernel have parity errors.

In reset functions, only SEC2 supports continuation after error.
For SEC1, we have to reset in all cases.

For errors handling, SEC2+ names have been kept, but displayed
text have been amended to reflect exact meaning on SEC1.
Signed-off-by: default avatarChristophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 5fa7fa14
This diff is collapsed.
...@@ -188,26 +188,38 @@ static inline bool has_ftr_sec1(struct talitos_private *priv) ...@@ -188,26 +188,38 @@ static inline bool has_ftr_sec1(struct talitos_private *priv)
* TALITOS_xxx_LO addresses point to the low data bits (32-63) of the register * TALITOS_xxx_LO addresses point to the low data bits (32-63) of the register
*/ */
#define ISR1_FORMAT(x) (((x) << 28) | ((x) << 16))
#define ISR2_FORMAT(x) (((x) << 4) | (x))
/* global register offset addresses */ /* global register offset addresses */
#define TALITOS_MCR 0x1030 /* master control register */ #define TALITOS_MCR 0x1030 /* master control register */
#define TALITOS_MCR_RCA0 (1 << 15) /* remap channel 0 */ #define TALITOS_MCR_RCA0 (1 << 15) /* remap channel 0 */
#define TALITOS_MCR_RCA1 (1 << 14) /* remap channel 1 */ #define TALITOS_MCR_RCA1 (1 << 14) /* remap channel 1 */
#define TALITOS_MCR_RCA2 (1 << 13) /* remap channel 2 */ #define TALITOS_MCR_RCA2 (1 << 13) /* remap channel 2 */
#define TALITOS_MCR_RCA3 (1 << 12) /* remap channel 3 */ #define TALITOS_MCR_RCA3 (1 << 12) /* remap channel 3 */
#define TALITOS_MCR_SWR 0x1 /* s/w reset */ #define TALITOS1_MCR_SWR 0x1000000 /* s/w reset */
#define TALITOS2_MCR_SWR 0x1 /* s/w reset */
#define TALITOS_MCR_LO 0x1034 #define TALITOS_MCR_LO 0x1034
#define TALITOS_IMR 0x1008 /* interrupt mask register */ #define TALITOS_IMR 0x1008 /* interrupt mask register */
#define TALITOS_IMR_INIT 0x100ff /* enable channel IRQs */ /* enable channel IRQs */
#define TALITOS_IMR_DONE 0x00055 /* done IRQs */ #define TALITOS1_IMR_INIT ISR1_FORMAT(0xf)
#define TALITOS1_IMR_DONE ISR1_FORMAT(0x5) /* done IRQs */
/* enable channel IRQs */
#define TALITOS2_IMR_INIT (ISR2_FORMAT(0xf) | 0x10000)
#define TALITOS2_IMR_DONE ISR1_FORMAT(0x5) /* done IRQs */
#define TALITOS_IMR_LO 0x100C #define TALITOS_IMR_LO 0x100C
#define TALITOS_IMR_LO_INIT 0x20000 /* allow RNGU error IRQs */ #define TALITOS1_IMR_LO_INIT 0x2000000 /* allow RNGU error IRQs */
#define TALITOS2_IMR_LO_INIT 0x20000 /* allow RNGU error IRQs */
#define TALITOS_ISR 0x1010 /* interrupt status register */ #define TALITOS_ISR 0x1010 /* interrupt status register */
#define TALITOS_ISR_4CHERR 0xaa /* 4 channel errors mask */ #define TALITOS1_ISR_4CHERR ISR1_FORMAT(0xa) /* 4 ch errors mask */
#define TALITOS_ISR_4CHDONE 0x55 /* 4 channel done mask */ #define TALITOS1_ISR_4CHDONE ISR1_FORMAT(0x5) /* 4 ch done mask */
#define TALITOS_ISR_CH_0_2_ERR 0x22 /* channels 0, 2 errors mask */ #define TALITOS1_ISR_TEA_ERR 0x00000040
#define TALITOS_ISR_CH_0_2_DONE 0x11 /* channels 0, 2 done mask */ #define TALITOS2_ISR_4CHERR ISR2_FORMAT(0xa) /* 4 ch errors mask */
#define TALITOS_ISR_CH_1_3_ERR 0x88 /* channels 1, 3 errors mask */ #define TALITOS2_ISR_4CHDONE ISR2_FORMAT(0x5) /* 4 ch done mask */
#define TALITOS_ISR_CH_1_3_DONE 0x44 /* channels 1, 3 done mask */ #define TALITOS2_ISR_CH_0_2_ERR ISR2_FORMAT(0x2) /* ch 0, 2 err mask */
#define TALITOS2_ISR_CH_0_2_DONE ISR2_FORMAT(0x1) /* ch 0, 2 done mask */
#define TALITOS2_ISR_CH_1_3_ERR ISR2_FORMAT(0x8) /* ch 1, 3 err mask */
#define TALITOS2_ISR_CH_1_3_DONE ISR2_FORMAT(0x4) /* ch 1, 3 done mask */
#define TALITOS_ISR_LO 0x1014 #define TALITOS_ISR_LO 0x1014
#define TALITOS_ICR 0x1018 /* interrupt clear register */ #define TALITOS_ICR 0x1018 /* interrupt clear register */
#define TALITOS_ICR_LO 0x101C #define TALITOS_ICR_LO 0x101C
...@@ -219,14 +231,15 @@ static inline bool has_ftr_sec1(struct talitos_private *priv) ...@@ -219,14 +231,15 @@ static inline bool has_ftr_sec1(struct talitos_private *priv)
/* channel configuration register */ /* channel configuration register */
#define TALITOS_CCCR 0x8 #define TALITOS_CCCR 0x8
#define TALITOS_CCCR_CONT 0x2 /* channel continue */ #define TALITOS2_CCCR_CONT 0x2 /* channel continue on SEC2 */
#define TALITOS_CCCR_RESET 0x1 /* channel reset */ #define TALITOS2_CCCR_RESET 0x1 /* channel reset on SEC2 */
#define TALITOS_CCCR_LO 0xc #define TALITOS_CCCR_LO 0xc
#define TALITOS_CCCR_LO_IWSE 0x80 /* chan. ICCR writeback enab. */ #define TALITOS_CCCR_LO_IWSE 0x80 /* chan. ICCR writeback enab. */
#define TALITOS_CCCR_LO_EAE 0x20 /* extended address enable */ #define TALITOS_CCCR_LO_EAE 0x20 /* extended address enable */
#define TALITOS_CCCR_LO_CDWE 0x10 /* chan. done writeback enab. */ #define TALITOS_CCCR_LO_CDWE 0x10 /* chan. done writeback enab. */
#define TALITOS_CCCR_LO_NT 0x4 /* notification type */ #define TALITOS_CCCR_LO_NT 0x4 /* notification type */
#define TALITOS_CCCR_LO_CDIE 0x2 /* channel done IRQ enable */ #define TALITOS_CCCR_LO_CDIE 0x2 /* channel done IRQ enable */
#define TALITOS1_CCCR_LO_RESET 0x1 /* channel reset on SEC1 */
/* CCPSR: channel pointer status register */ /* CCPSR: channel pointer status register */
#define TALITOS_CCPSR 0x10 #define TALITOS_CCPSR 0x10
...@@ -298,6 +311,8 @@ static inline bool has_ftr_sec1(struct talitos_private *priv) ...@@ -298,6 +311,8 @@ static inline bool has_ftr_sec1(struct talitos_private *priv)
#define TALITOS_EUICR_LO 0x3c #define TALITOS_EUICR_LO 0x3c
#define TALITOS_EU_FIFO 0x800 /* output FIFO */ #define TALITOS_EU_FIFO 0x800 /* output FIFO */
#define TALITOS_EU_FIFO_LO 0x804 /* output FIFO */ #define TALITOS_EU_FIFO_LO 0x804 /* output FIFO */
/* DES unit */
#define TALITOS1_DEUICR_KPE 0x00200000 /* Key Parity Error */
/* message digest unit */ /* message digest unit */
#define TALITOS_MDEUICR_LO_ICE 0x4000 /* integrity check IRQ enable */ #define TALITOS_MDEUICR_LO_ICE 0x4000 /* integrity check IRQ enable */
/* random number unit */ /* random number unit */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment