Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions
cryp.h File Reference
#include <linux/completion.h>
#include <linux/dmaengine.h>
#include <linux/klist.h>
#include <linux/mutex.h>

Go to the source code of this file.

Data Structures

struct  cryp_config
 
struct  cryp_protection_config
 
struct  cryp_key_value
 
struct  cryp_init_vector_value
 
struct  cryp_device_context
 
struct  cryp_dma
 
struct  cryp_device_data
 

Macros

#define DEV_DBG_NAME   "crypX crypX:"
 
#define CRYP_KEY_SIZE_128   (0)
 
#define CRYP_KEY_SIZE_192   (1)
 
#define CRYP_KEY_SIZE_256   (2)
 

Enumerations

enum  cryp_crypen { CRYP_CRYPEN_DISABLE = 0, CRYP_CRYPEN_ENABLE = 1 }
 
enum  cryp_start { CRYP_START_DISABLE = 0, CRYP_START_ENABLE = 1 }
 
enum  cryp_init { CRYP_INIT_DISABLE = 0, CRYP_INIT_ENABLE = 1 }
 
enum  cryp_state { CRYP_STATE_DISABLE = 0, CRYP_STATE_ENABLE = 1 }
 
enum  cryp_key_prep { KSE_DISABLED = 0, KSE_ENABLED = 1 }
 
enum  cryp_algo_mode {
  CRYP_ALGO_TDES_ECB, CRYP_ALGO_TDES_CBC, CRYP_ALGO_DES_ECB, CRYP_ALGO_DES_CBC,
  CRYP_ALGO_AES_ECB, CRYP_ALGO_AES_CBC, CRYP_ALGO_AES_CTR, CRYP_ALGO_AES_XTS
}
 
enum  cryp_algorithm_dir { CRYP_ALGORITHM_ENCRYPT, CRYP_ALGORITHM_DECRYPT }
 
enum  cryp_mode { CRYP_MODE_POLLING, CRYP_MODE_INTERRUPT, CRYP_MODE_DMA }
 
enum  cryp_status_id {
  CRYP_STATUS_BUSY = 0x10, CRYP_STATUS_OUTPUT_FIFO_FULL = 0x08, CRYP_STATUS_OUTPUT_FIFO_NOT_EMPTY = 0x04, CRYP_STATUS_INPUT_FIFO_NOT_FULL = 0x02,
  CRYP_STATUS_INPUT_FIFO_EMPTY = 0x01
}
 
enum  cryp_dma_req_type { CRYP_DMA_DISABLE_BOTH, CRYP_DMA_ENABLE_IN_DATA, CRYP_DMA_ENABLE_OUT_DATA, CRYP_DMA_ENABLE_BOTH_DIRECTIONS }
 
enum  cryp_dma_channel { CRYP_DMA_RX = 0, CRYP_DMA_TX }
 
enum  cryp_key_reg_index { CRYP_KEY_REG_1, CRYP_KEY_REG_2, CRYP_KEY_REG_3, CRYP_KEY_REG_4 }
 
enum  cryp_init_vector_index { CRYP_INIT_VECTOR_INDEX_0, CRYP_INIT_VECTOR_INDEX_1 }
 

Functions

void cryp_wait_until_done (struct cryp_device_data *device_data)
 
int cryp_check (struct cryp_device_data *device_data)
 
void cryp_activity (struct cryp_device_data *device_data, enum cryp_crypen cryp_crypen)
 
void cryp_flush_inoutfifo (struct cryp_device_data *device_data)
 
int cryp_set_configuration (struct cryp_device_data *device_data, struct cryp_config *cryp_config, u32 *control_register)
 
void cryp_configure_for_dma (struct cryp_device_data *device_data, enum cryp_dma_req_type dma_req)
 
int cryp_configure_key_values (struct cryp_device_data *device_data, enum cryp_key_reg_index key_reg_index, struct cryp_key_value key_value)
 
int cryp_configure_init_vector (struct cryp_device_data *device_data, enum cryp_init_vector_index init_vector_index, struct cryp_init_vector_value init_vector_value)
 
int cryp_configure_protection (struct cryp_device_data *device_data, struct cryp_protection_config *p_protect_config)
 
void cryp_save_device_context (struct cryp_device_data *device_data, struct cryp_device_context *ctx, int cryp_mode)
 
void cryp_restore_device_context (struct cryp_device_data *device_data, struct cryp_device_context *ctx)
 
int cryp_is_logic_busy (struct cryp_device_data *device_data)
 
int cryp_get_status (struct cryp_device_data *device_data)
 
int cryp_write_indata (struct cryp_device_data *device_data, u32 write_data)
 
int cryp_read_outdata (struct cryp_device_data *device_data, u32 *read_data)
 

Macro Definition Documentation

#define CRYP_KEY_SIZE_128   (0)

Definition at line 52 of file cryp.h.

#define CRYP_KEY_SIZE_192   (1)

Definition at line 53 of file cryp.h.

#define CRYP_KEY_SIZE_256   (2)

Definition at line 54 of file cryp.h.

#define DEV_DBG_NAME   "crypX crypX:"

Copyright (C) ST-Ericsson SA 2010 Author: Shujuan Chen shuju.nosp@m.an.c.nosp@m.hen@s.nosp@m.teri.nosp@m.csson.nosp@m..com for ST-Ericsson. Author: Jonas Linde jonas.nosp@m..lin.nosp@m.de@st.nosp@m.eric.nosp@m.sson..nosp@m.com for ST-Ericsson. Author: Joakim Bech joaki.nosp@m.m.xx.nosp@m..bech.nosp@m.@ste.nosp@m.ricss.nosp@m.on.c.nosp@m.om for ST-Ericsson. Author: Berne Hebark berne.nosp@m..her.nosp@m.bark@.nosp@m.ster.nosp@m.icsso.nosp@m.n.co.nosp@m.m for ST-Ericsson. Author: Niklas Hernaeus nikla.nosp@m.s.he.nosp@m.rnaeu.nosp@m.s@st.nosp@m.erics.nosp@m.son..nosp@m.com for ST-Ericsson. License terms: GNU General Public License (GPL) version 2

Definition at line 19 of file cryp.h.

Enumeration Type Documentation

Enumerator:
CRYP_ALGO_TDES_ECB 
CRYP_ALGO_TDES_CBC 
CRYP_ALGO_DES_ECB 
CRYP_ALGO_DES_CBC 
CRYP_ALGO_AES_ECB 
CRYP_ALGO_AES_CBC 
CRYP_ALGO_AES_CTR 
CRYP_ALGO_AES_XTS 

Definition at line 57 of file cryp.h.

Enumerator:
CRYP_ALGORITHM_ENCRYPT 
CRYP_ALGORITHM_DECRYPT 

Definition at line 69 of file cryp.h.

Enumerator:
CRYP_CRYPEN_DISABLE 
CRYP_CRYPEN_ENABLE 

Definition at line 22 of file cryp.h.

Enumerator:
CRYP_DMA_RX 
CRYP_DMA_TX 

Definition at line 124 of file cryp.h.

Enumerator:
CRYP_DMA_DISABLE_BOTH 
CRYP_DMA_ENABLE_IN_DATA 
CRYP_DMA_ENABLE_OUT_DATA 
CRYP_DMA_ENABLE_BOTH_DIRECTIONS 

Definition at line 117 of file cryp.h.

enum cryp_init
Enumerator:
CRYP_INIT_DISABLE 
CRYP_INIT_ENABLE 

Definition at line 34 of file cryp.h.

Enumerator:
CRYP_INIT_VECTOR_INDEX_0 
CRYP_INIT_VECTOR_INDEX_1 

Definition at line 144 of file cryp.h.

Enumerator:
KSE_DISABLED 
KSE_ENABLED 

Definition at line 46 of file cryp.h.

Enumerator:
CRYP_KEY_REG_1 
CRYP_KEY_REG_2 
CRYP_KEY_REG_3 
CRYP_KEY_REG_4 

Definition at line 130 of file cryp.h.

enum cryp_mode
Enumerator:
CRYP_MODE_POLLING 
CRYP_MODE_INTERRUPT 
CRYP_MODE_DMA 

Definition at line 75 of file cryp.h.

enum cryp_start
Enumerator:
CRYP_START_DISABLE 
CRYP_START_ENABLE 

Definition at line 28 of file cryp.h.

enum cryp_state
Enumerator:
CRYP_STATE_DISABLE 
CRYP_STATE_ENABLE 

Definition at line 40 of file cryp.h.

Enumerator:
CRYP_STATUS_BUSY 
CRYP_STATUS_OUTPUT_FIFO_FULL 
CRYP_STATUS_OUTPUT_FIFO_NOT_EMPTY 
CRYP_STATUS_INPUT_FIFO_NOT_FULL 
CRYP_STATUS_INPUT_FIFO_EMPTY 

Definition at line 108 of file cryp.h.

Function Documentation

void cryp_activity ( struct cryp_device_data device_data,
enum cryp_crypen cryp_crypen   
)

cryp_activity - This routine enables/disable the cryptography function. : Pointer to the device data struct for base address. : Enable/Disable functionality

Definition at line 71 of file cryp.c.

int cryp_check ( struct cryp_device_data device_data)

cryp_check - This routine checks Peripheral and PCell Id : Pointer to the device data struct for base address.

Definition at line 33 of file cryp.c.

void cryp_configure_for_dma ( struct cryp_device_data device_data,
enum cryp_dma_req_type  dma_req 
)

cryp_configure_for_dma - configures the CRYP IP for DMA operation : Pointer to the device data struct for base address. : Specifies the DMA request type value.

Definition at line 198 of file cryp.c.

int cryp_configure_init_vector ( struct cryp_device_data device_data,
enum cryp_init_vector_index  init_vector_index,
struct cryp_init_vector_value  init_vector_value 
)

cryp_configure_init_vector - configures the initialization vector register : Pointer to the device data struct for base address. : Specifies the index of the init vector. : Specifies the value for the init vector.

Definition at line 256 of file cryp.c.

int cryp_configure_key_values ( struct cryp_device_data device_data,
enum cryp_key_reg_index  key_reg_index,
struct cryp_key_value  key_value 
)

cryp_configure_key_values - configures the key values for CRYP operations : Pointer to the device data struct for base address. : Key value index register : The key value struct

Definition at line 211 of file cryp.c.

int cryp_configure_protection ( struct cryp_device_data device_data,
struct cryp_protection_config p_protect_config 
)

cryp_configure_protection - set the protection bits in the CRYP logic. : Pointer to the device data struct for base address. : Pointer to the protection mode and secure mode configuration

Definition at line 166 of file cryp.c.

void cryp_flush_inoutfifo ( struct cryp_device_data device_data)

cryp_flush_inoutfifo - Resets both the input and the output FIFOs : Pointer to the device data struct for base address.

Definition at line 84 of file cryp.c.

int cryp_get_status ( struct cryp_device_data device_data)
int cryp_is_logic_busy ( struct cryp_device_data device_data)

cryp_is_logic_busy - returns the busy status of the CRYP logic : Pointer to the device data struct for base address.

Definition at line 187 of file cryp.c.

int cryp_read_outdata ( struct cryp_device_data device_data,
u32 read_data 
)

cryp_read_outdata - This routine reads the data from the data output register of the CRYP logic : Pointer to the device data struct for base address. : Read the data from the output FIFO.

void cryp_restore_device_context ( struct cryp_device_data device_data,
struct cryp_device_context ctx 
)

cryp_restore_device_context - Restore hardware registers and other device context parameter : Pointer to the device data struct for base address. : Crypto device context

Definition at line 351 of file cryp.c.

void cryp_save_device_context ( struct cryp_device_data device_data,
struct cryp_device_context ctx,
int  cryp_mode 
)

cryp_save_device_context - Store hardware registers and other device context parameter : Pointer to the device data struct for base address. : Crypto device context

Definition at line 291 of file cryp.c.

int cryp_set_configuration ( struct cryp_device_data device_data,
struct cryp_config cryp_config,
u32 control_register 
)

cryp_set_configuration - This routine set the cr CRYP IP : Pointer to the device data struct for base address. : Pointer to the configuration parameter : The control register to be written later on.

Definition at line 112 of file cryp.c.

void cryp_wait_until_done ( struct cryp_device_data device_data)

Copyright (C) ST-Ericsson SA 2010 Author: Shujuan Chen shuju.nosp@m.an.c.nosp@m.hen@s.nosp@m.teri.nosp@m.csson.nosp@m..com for ST-Ericsson. Author: Jonas Linde jonas.nosp@m..lin.nosp@m.de@st.nosp@m.eric.nosp@m.sson..nosp@m.com for ST-Ericsson. Author: Niklas Hernaeus nikla.nosp@m.s.he.nosp@m.rnaeu.nosp@m.s@st.nosp@m.erics.nosp@m.son..nosp@m.com for ST-Ericsson. Author: Joakim Bech joaki.nosp@m.m.xx.nosp@m..bech.nosp@m.@ste.nosp@m.ricss.nosp@m.on.c.nosp@m.om for ST-Ericsson. Author: Berne Hebark berne.nosp@m..her.nosp@m.bark@.nosp@m.ster.nosp@m.icsso.nosp@m.n.co.nosp@m.m for ST-Ericsson. License terms: GNU General Public License (GPL) version 2 cryp_wait_until_done - wait until the device logic is not busy

Definition at line 23 of file cryp.c.

int cryp_write_indata ( struct cryp_device_data device_data,
u32  write_data 
)

cryp_write_indata - This routine writes 32 bit data into the data input register of the cryptography IP. : Pointer to the device data struct for base address. : Data to write.