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

ARM: AT91SAM9G45: same platform data structure for all crypto peripherals

Only AES use DMA in AT91SAM9G45 (TDES and SHA use PDC).

However latest Atmel TDES and SHA IP releases use DMA instead of PDC.
--> Atmel TDES and SHA drivers need DMA platform data for those IP releases.

Goal of this patch is to use the same platform data structure for all Atmel
crypto peripherals. This structure contains information about DMA interface.

Signed-off-by: Nicolas Royer <nicolas@eukrea.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Acked-by: Eric Bénard <eric@eukrea.com>
Tested-by: Eric Bénard <eric@eukrea.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Nicolas Royer and committed by
Herbert Xu
6150f3bc ca81a1a1

+28 -30
+6 -8
arch/arm/mach-at91/at91sam9g45_devices.c
··· 18 18 #include <linux/platform_device.h> 19 19 #include <linux/i2c-gpio.h> 20 20 #include <linux/atmel-mci.h> 21 - #include <linux/platform_data/atmel-aes.h> 21 + #include <linux/platform_data/crypto-atmel.h> 22 22 23 23 #include <linux/platform_data/at91_adc.h> 24 24 ··· 1900 1900 * -------------------------------------------------------------------- */ 1901 1901 1902 1902 #if defined(CONFIG_CRYPTO_DEV_ATMEL_AES) || defined(CONFIG_CRYPTO_DEV_ATMEL_AES_MODULE) 1903 - static struct aes_platform_data aes_data; 1903 + static struct crypto_platform_data aes_data; 1904 + static struct crypto_dma_data alt_atslave; 1904 1905 static u64 aes_dmamask = DMA_BIT_MASK(32); 1905 1906 1906 1907 static struct resource aes_resources[] = { ··· 1932 1931 static void __init at91_add_device_aes(void) 1933 1932 { 1934 1933 struct at_dma_slave *atslave; 1935 - struct aes_dma_data *alt_atslave; 1936 - 1937 - alt_atslave = kzalloc(sizeof(struct aes_dma_data), GFP_KERNEL); 1938 1934 1939 1935 /* DMA TX slave channel configuration */ 1940 - atslave = &alt_atslave->txdata; 1936 + atslave = &alt_atslave.txdata; 1941 1937 atslave->dma_dev = &at_hdmac_device.dev; 1942 1938 atslave->cfg = ATC_FIFOCFG_ENOUGHSPACE | ATC_SRC_H2SEL_HW | 1943 1939 ATC_SRC_PER(AT_DMA_ID_AES_RX); 1944 1940 1945 1941 /* DMA RX slave channel configuration */ 1946 - atslave = &alt_atslave->rxdata; 1942 + atslave = &alt_atslave.rxdata; 1947 1943 atslave->dma_dev = &at_hdmac_device.dev; 1948 1944 atslave->cfg = ATC_FIFOCFG_ENOUGHSPACE | ATC_DST_H2SEL_HW | 1949 1945 ATC_DST_PER(AT_DMA_ID_AES_TX); 1950 1946 1951 - aes_data.dma_slave = alt_atslave; 1947 + aes_data.dma_slave = &alt_atslave; 1952 1948 platform_device_register(&at91sam9g45_aes_device); 1953 1949 } 1954 1950 #else
-22
include/linux/platform_data/atmel-aes.h
··· 1 - #ifndef __LINUX_ATMEL_AES_H 2 - #define __LINUX_ATMEL_AES_H 3 - 4 - #include <linux/platform_data/dma-atmel.h> 5 - 6 - /** 7 - * struct aes_dma_data - DMA data for AES 8 - */ 9 - struct aes_dma_data { 10 - struct at_dma_slave txdata; 11 - struct at_dma_slave rxdata; 12 - }; 13 - 14 - /** 15 - * struct aes_platform_data - board-specific AES configuration 16 - * @dma_slave: DMA slave interface to use in data transfers. 17 - */ 18 - struct aes_platform_data { 19 - struct aes_dma_data *dma_slave; 20 - }; 21 - 22 - #endif /* __LINUX_ATMEL_AES_H */
+22
include/linux/platform_data/crypto-atmel.h
··· 1 + #ifndef __LINUX_CRYPTO_ATMEL_H 2 + #define __LINUX_CRYPTO_ATMEL_H 3 + 4 + #include <linux/platform_data/dma-atmel.h> 5 + 6 + /** 7 + * struct crypto_dma_data - DMA data for AES/TDES/SHA 8 + */ 9 + struct crypto_dma_data { 10 + struct at_dma_slave txdata; 11 + struct at_dma_slave rxdata; 12 + }; 13 + 14 + /** 15 + * struct crypto_platform_data - board-specific AES/TDES/SHA configuration 16 + * @dma_slave: DMA slave interface to use in data transfers. 17 + */ 18 + struct crypto_platform_data { 19 + struct crypto_dma_data *dma_slave; 20 + }; 21 + 22 + #endif /* __LINUX_CRYPTO_ATMEL_H */