From da9fd56e1e47c7773c8dfc4db445e3d1852d5aa5 Mon Sep 17 00:00:00 2001 From: Jason Jin Date: Tue, 11 Dec 2012 18:25:40 +0800 Subject: Vybrid CAAM driver From Singh Pradip-B09147. Integrate by Jason Jin Signed-off-by: Jason Jin --- drivers/crypto/caam/intern.h | 80 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 77 insertions(+), 3 deletions(-) (limited to 'drivers/crypto/caam/intern.h') diff --git a/drivers/crypto/caam/intern.h b/drivers/crypto/caam/intern.h index a34be01b0b29..83c5adef00f5 100644 --- a/drivers/crypto/caam/intern.h +++ b/drivers/crypto/caam/intern.h @@ -2,7 +2,7 @@ * CAAM/SEC 4.x driver backend * Private/internal definitions between modules * - * Copyright 2008-2011 Freescale Semiconductor, Inc. + * Copyright (C) 2008-2012 Freescale Semiconductor, Inc. * */ @@ -12,6 +12,9 @@ #define JOBR_UNASSIGNED 0 #define JOBR_ASSIGNED 1 +/* Default clock/sample settings for an RNG4 entropy source */ +#define RNG4_ENT_CLOCKS_SAMPLE 1600 + /* Currently comes from Kconfig param as a ^2 (driver-required) */ #define JOBR_DEPTH (1 << CONFIG_CRYPTO_DEV_FSL_CAAM_RINGSIZE) @@ -26,6 +29,23 @@ #define JOBR_INTC_COUNT_THLD 0 #endif +#ifndef CONFIG_OF +#define JR_IRQRES_NAME_ROOT "irq_jr" +#define JR_MEMRES_NAME_ROOT "offset_jr" +#endif + +#ifdef CONFIG_ARM +/* + * FIXME: ARM tree doesn't seem to provide this, ergo it seems to be + * in "platform limbo". Find a better place, perhaps. + */ +static inline void irq_dispose_mapping(unsigned int virq) +{ + return; +} +#endif + + /* * Storage for tracking each in-process entry moving across a ring * Each entry on an output ring needs one of these @@ -75,6 +95,9 @@ struct caam_drv_private { struct caam_deco **deco; /* DECO/CCB views */ struct caam_assurance *ac; struct caam_queue_if *qi; /* QI control region */ + struct snvs_full __iomem *snvs; /* SNVS HP+LP register space */ + dma_addr_t __iomem *sm_base; /* Secure memory storage base */ + u32 sm_size; /* * Detected geometry block. Filled in from device tree if powerpc, @@ -83,6 +106,7 @@ struct caam_drv_private { u8 total_jobrs; /* Total Job Rings in device */ u8 qi_present; /* Nonzero if QI present in device */ int secvio_irq; /* Security violation interrupt number */ + int rng_inst; /* Total instantiated RNGs */ /* which jr allocated to scatterlist crypto */ atomic_t tfm_count ____cacheline_aligned; @@ -90,7 +114,20 @@ struct caam_drv_private { struct device **algapi_jr; /* list of registered crypto algorithms (mk generic context handle?) */ struct list_head alg_list; + /* list of registered hash algorithms (mk generic context handle?) */ + struct list_head hash_list; + +#ifdef CONFIG_ARM + struct clk *caam_clk; +#endif +#ifdef CONFIG_CRYPTO_DEV_FSL_CAAM_SM + struct device *smdev; /* Secure Memory dev */ +#endif + +#ifdef CONFIG_CRYPTO_DEV_FSL_CAAM_SECVIO + struct device *secviodev; +#endif /* * debugfs entries for developer view into driver/device * variables at runtime. @@ -108,6 +145,43 @@ struct caam_drv_private { #endif }; -void caam_jr_algapi_init(struct device *dev); -void caam_jr_algapi_remove(struct device *dev); +/* + * These startup/shutdown functions exist to enable API startup/shutdown + * outside of the OF device detection framework. It's necessary for ARM + * kernels as presently delivered. + * + * Once ARM kernels are shipping with OF support, these functions can + * be re-integrated into the normal probe startup/exit functions, + * and these prototypes can then be removed. + */ +#ifndef CONFIG_OF +void caam_algapi_shutdown(struct platform_device *pdev); +int caam_algapi_startup(struct platform_device *pdev); + +#ifdef CONFIG_CRYPTO_DEV_FSL_CAAM_AHASH_API +int caam_algapi_hash_startup(struct platform_device *pdev); +void caam_algapi_hash_shutdown(struct platform_device *pdev); +#endif + +#ifdef CONFIG_CRYPTO_DEV_FSL_CAAM_RNG_API +int caam_rng_startup(struct platform_device *pdev); +void caam_rng_shutdown(void); +#endif + +#ifdef CONFIG_CRYPTO_DEV_FSL_CAAM_SM +int caam_sm_startup(struct platform_device *pdev); +void caam_sm_shutdown(struct platform_device *pdev); +#endif + +#ifdef CONFIG_CRYPTO_DEV_FSL_CAAM_SM_TEST +int caam_sm_example_init(struct platform_device *pdev); +#endif + +#ifdef CONFIG_CRYPTO_DEV_FSL_CAAM_SECVIO +int caam_secvio_startup(struct platform_device *pdev); +void caam_secvio_shutdown(struct platform_device *pdev); +#endif /* SECVIO */ + +#endif /* CONFIG_OF */ + #endif /* INTERN_H */ -- cgit v1.2.3