/* * Cryptographic API. * * Support for ATMEL SHA1/SHA256 HW acceleration. * * Copyright (c) 2012 Eukréa Electromatique - ATMEL * Author: Nicolas Royer <nicolas@eukrea.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as published * by the Free Software Foundation. * * Some ideas are from omap-sham.c drivers. */#include<linux/kernel.h>#include<linux/module.h>#include<linux/slab.h>#include<linux/err.h>#include<linux/clk.h>#include<linux/io.h>#include<linux/hw_random.h>#include<linux/platform_device.h>#include<linux/device.h>#include<linux/init.h>#include<linux/errno.h>#include<linux/interrupt.h>#include<linux/irq.h>#include<linux/scatterlist.h>#include<linux/dma-mapping.h>#include<linux/delay.h>#include<linux/crypto.h>#include<linux/cryptohash.h>#include<crypto/scatterwalk.h>#include<crypto/algapi.h>#include<crypto/sha.h>#include<crypto/hash.h>#include<crypto/internal/hash.h>#include<linux/platform_data/crypto-atmel.h>#include"atmel-sha-regs.h"/* SHA flags */#define SHA_FLAGS_BUSY BIT(0)#define SHA_FLAGS_FINAL BIT(1)#define SHA_FLAGS_DMA_ACTIVE BIT(2)#define SHA_FLAGS_OUTPUT_READY BIT(3)#define SHA_FLAGS_INIT BIT(4)#define SHA_FLAGS_CPU BIT(5)#define SHA_FLAGS_DMA_READY BIT(6)#define SHA_FLAGS_FINUP BIT(16)#define SHA_FLAGS_SG BIT(17)#define SHA_FLAGS_SHA1 BIT(18)#define SHA_FLAGS_SHA224 BIT(19)#define SHA_FLAGS_SHA256 BIT(20)#define SHA_FLAGS_SHA384 BIT(21)#define SHA_FLAGS_SHA512 BIT(22)#define SHA_FLAGS_ERROR BIT(23)#define SHA_FLAGS_PAD BIT(24)#define SHA_OP_UPDATE 1#define SHA_OP_FINAL 2#define SHA_BUFFER_LEN PAGE_SIZE#define ATMEL_SHA_DMA_THRESHOLD 56structatmel_sha_caps{boolhas_dma;boolhas_dualbuff;boolhas_sha224;