ARM: AT91SAM9G45: same platform data structure for all crypto peripherals
PATCH 2/5 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.
--- arch/arm/mach-at91/at91sam9g45_devices.c | 8 ++++---- include/linux/platform_data/atmel-aes.h | 22 ---------------------- include/linux/platform_data/crypto-atmel.h | 22 ++++++++++++++++++++++ 3 files changed, 26 insertions(+), 26 deletions(-) delete mode 100644 include/linux/platform_data/atmel-aes.h create mode 100644 include/linux/platform_data/crypto-atmel.h
arch/arm/mach-at91/at91sam9g45_devices.c +4 -4
@@ -18,7 +18,7 @@#include <linux/platform_device.h> #include <linux/i2c-gpio.h> #include <linux/atmel-mci.h> -#include <linux/platform_data/atmel-aes.h> +#include <linux/platform_data/crypto-atmel.h> #include <linux/platform_data/at91_adc.h>
@@ -1900,7 +1900,7 @@ static void __init at91_add_device_tdes(void) {}* -------------------------------------------------------------------- */ #if defined(CONFIG_CRYPTO_DEV_ATMEL_AES ) || defined(CONFIG_CRYPTO_DEV_ATMEL_AES_MODULE ) -static struct aes_platform_data aes_data; +static struct crypto_platform_data aes_data;static u64 aes_dmamask =DMA_BIT_MASK (32 ); static struct resource aes_resources[] = {
@@ -1931,9 +1931,9 @@ static struct platform_device at91sam9g45_aes_device = {static void __init at91_add_device_aes (void ) {struct at_dma_slave *atslave; -struct aes_dma_data *alt_atslave; +struct crypto_dma_data *alt_atslave; - alt_atslave =kzalloc (sizeof (struct aes_dma_data ),GFP_KERNEL ); + alt_atslave =kzalloc (sizeof (struct crypto_dma_data ),GFP_KERNEL );/* DMA TX slave channel configuration */ atslave = &alt_atslave->txdata;
include/linux/platform_data/atmel-aes.h deleted +0 -22
@@ -1,22 +0,0 @@ -#ifndef __LINUX_ATMEL_AES_H -#define __LINUX_ATMEL_AES_H - -#include <linux/platform_data/dma-atmel.h> - -/** -* struct aes_dma_data - DMA data for AES -*/ -struct aes_dma_data { -struct at_dma_slave txdata; -struct at_dma_slave rxdata; -}; - -/** -* struct aes_platform_data - board-specific AES configuration -* @dma_slave: DMA slave interface to use in data transfers. -*/ -struct aes_platform_data { -struct aes_dma_data *dma_slave; -}; - -#endif /* __LINUX_ATMEL_AES_H */
include/linux/platform_data/crypto-atmel.h new file +22 -0
@@ -0,0 +1,22 @@ +#ifndef __LINUX_CRYPTO_ATMEL_H +#define __LINUX_CRYPTO_ATMEL_H + +#include <linux/platform_data/dma-atmel.h> + +/** +* struct crypto_dma_data - DMA data for AES/TDES/SHA +*/ +struct crypto_dma_data { +struct at_dma_slave txdata; +struct at_dma_slave rxdata; +}; + +/** +* struct crypto_platform_data - board-specific AES/TDES/SHA configuration +* @dma_slave: DMA slave interface to use in data transfers. +*/ +struct crypto_platform_data { +struct crypto_dma_data *dma_slave; +}; + +#endif /* __LINUX_CRYPTO_ATMEL_H */
Signature · 1 line
1.7.6.5
Quoted 43 lines · Nicolas Royer
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 <[email protected]>Acked-by Nicolas Ferre <[email protected]>Acked-by Eric B?nard <[email protected]>Tested-by Eric B?nard <[email protected]>--- arch/arm/mach-at91/at91sam9g45_devices.c | 8 ++++---- include/linux/platform_data/atmel-aes.h | 22 ---------------------- include/linux/platform_data/crypto-atmel.h | 22 ++++++++++++++++++++++ 3 files changed, 26 insertions(+), 26 deletions(-) delete mode 100644 include/linux/platform_data/atmel-aes.h create mode 100644 include/linux/platform_data/crypto-atmel.harch/arm/mach-at91/at91sam9g45_devices.c +2
-2@@ -18,7 +18,7 @@#include <linux/platform_device.h> #include <linux/i2c-gpio.h> #include <linux/atmel-mci.h> -#include <linux/platform_data/atmel-aes.h> +#include <linux/platform_data/crypto-atmel.h> #include <linux/platform_data/at91_adc.h> @@ -1900,7 +1900,7 @@ static void __init at91_add_device_tdes(void) {}* -------------------------------------------------------------------- */ #if defined(CONFIG_CRYPTO_DEV_ATMEL_AES ) || defined(CONFIG_CRYPTO_DEV_ATMEL_AES_MODULE ) -static struct aes_platform_data aes_data; +static struct crypto_platform_data aes_data;static u64 aes_dmamask =DMA_BIT_MASK (32 ); static struct resource aes_resources[] = {
arch/arm/mach-at91/at91sam9g45_devices.c static struct platform_device at91sam9g45_aes_device = { · line 1936
Quoted 8 lines
arch/arm/mach-at91/at91sam9g45_devices.c +2
-2@@ -1931,9 +1931,9 @@ static struct platform_device at91sam9g45_aes_device = {static void __init at91_add_device_aes (void ) {struct at_dma_slave *atslave; -struct aes_dma_data *alt_atslave; +struct crypto_dma_data *alt_atslave; - alt_atslave =kzalloc (sizeof (struct aes_dma_data ),GFP_KERNEL ); + alt_atslave =kzalloc (sizeof (struct crypto_dma_data ),GFP_KERNEL );
we do not check the result of kzalloc ouch
and why we allocate it?
Best Regards,
J.
J.
Hi Jean-Christophe,
Le Wed, 7 Nov 2012 16:26:15 +0100,
Jean-Christophe PLAGNIOL-VILLARD <[email protected]> a ?crit :
Quoted 7 lines
Quoted 7 lines
arch/arm/mach-at91/at91sam9g45_devices.c +1
-1@@ -1931,9 +1931,9 @@ static struct platform_device at91sam9g45_aes_device = {static void __init at91_add_device_aes (void ) {struct at_dma_slave *atslave; -struct aes_dma_data *alt_atslave; +struct crypto_dma_data *alt_atslave;
Quoted 6 lines
arch/arm/mach-at91/at91sam9g45_devices.c static struct platform_device at91sam9g45_aes_device = { · line 1936
Quoted 2 lines
arch/arm/mach-at91/at91sam9g45_devices.c +1
-1- alt_atslave =kzalloc (sizeof (struct aes_dma_data ),GFP_KERNEL ); + alt_atslave =kzalloc (sizeof (struct crypto_dma_data ),GFP_KERNEL );we do not check the result of kzalloc ouch
and why we allocate it?
for both remarks : that's the way it's done in at91_add_device_mci since 75305d768d296a07fd02df9af3e5de326df1c72e
A v2 will follow (and also a fix for at91_add_device_mci).
Eric
PATCH v2 2/5 ARM: AT91SAM9G45: same platform data structure for all crypto peripherals
In reply to Jean-Christophe PLAGNIOL-VILLARDOnly 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.
---
v2 : check kzalloc return value.
arch/arm/mach-at91/at91sam9g45_devices.c | 10 ++++++---- include/linux/platform_data/atmel-aes.h | 22 ---------------------- include/linux/platform_data/crypto-atmel.h | 22 ++++++++++++++++++++++ 3 files changed, 28 insertions(+), 26 deletions(-) delete mode 100644 include/linux/platform_data/atmel-aes.h create mode 100644 include/linux/platform_data/crypto-atmel.h
arch/arm/mach-at91/at91sam9g45_devices.c +6 -4
@@ -18,7 +18,7 @@#include <linux/platform_device.h> #include <linux/i2c-gpio.h> #include <linux/atmel-mci.h> -#include <linux/platform_data/atmel-aes.h> +#include <linux/platform_data/crypto-atmel.h> #include <linux/platform_data/at91_adc.h>
@@ -1900,7 +1900,7 @@ static void __init at91_add_device_tdes(void) {}* -------------------------------------------------------------------- */ #if defined(CONFIG_CRYPTO_DEV_ATMEL_AES ) || defined(CONFIG_CRYPTO_DEV_ATMEL_AES_MODULE ) -static struct aes_platform_data aes_data; +static struct crypto_platform_data aes_data;static u64 aes_dmamask =DMA_BIT_MASK (32 ); static struct resource aes_resources[] = {
@@ -1931,9 +1931,11 @@ static struct platform_device at91sam9g45_aes_device = {static void __init at91_add_device_aes (void ) {struct at_dma_slave *atslave; -struct aes_dma_data *alt_atslave; +struct crypto_dma_data *alt_atslave; - alt_atslave =kzalloc (sizeof (struct aes_dma_data ),GFP_KERNEL ); + alt_atslave =kzalloc (sizeof (struct crypto_dma_data ),GFP_KERNEL ); +if (!alt_atslave) +panic ("Unable to allocate memory for AES crypto_dma_data structure\n" );/* DMA TX slave channel configuration */ atslave = &alt_atslave->txdata;
include/linux/platform_data/atmel-aes.h deleted +0 -22
@@ -1,22 +0,0 @@ -#ifndef __LINUX_ATMEL_AES_H -#define __LINUX_ATMEL_AES_H - -#include <linux/platform_data/dma-atmel.h> - -/** -* struct aes_dma_data - DMA data for AES -*/ -struct aes_dma_data { -struct at_dma_slave txdata; -struct at_dma_slave rxdata; -}; - -/** -* struct aes_platform_data - board-specific AES configuration -* @dma_slave: DMA slave interface to use in data transfers. -*/ -struct aes_platform_data { -struct aes_dma_data *dma_slave; -}; - -#endif /* __LINUX_ATMEL_AES_H */
include/linux/platform_data/crypto-atmel.h new file +22 -0
@@ -0,0 +1,22 @@ +#ifndef __LINUX_CRYPTO_ATMEL_H +#define __LINUX_CRYPTO_ATMEL_H + +#include <linux/platform_data/dma-atmel.h> + +/** +* struct crypto_dma_data - DMA data for AES/TDES/SHA +*/ +struct crypto_dma_data { +struct at_dma_slave txdata; +struct at_dma_slave rxdata; +}; + +/** +* struct crypto_platform_data - board-specific AES/TDES/SHA configuration +* @dma_slave: DMA slave interface to use in data transfers. +*/ +struct crypto_platform_data { +struct crypto_dma_data *dma_slave; +}; + +#endif /* __LINUX_CRYPTO_ATMEL_H */
Signature · 1 line
1.7.6.5
Quoted 45 lines · Nicolas Royer
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 <[email protected]>Acked-by Nicolas Ferre <[email protected]>Acked-by Eric B?nard <[email protected]>Tested-by Eric B?nard <[email protected]>---
v2 : check kzalloc return value.arch/arm/mach-at91/at91sam9g45_devices.c | 10 ++++++---- include/linux/platform_data/atmel-aes.h | 22 ---------------------- include/linux/platform_data/crypto-atmel.h | 22 ++++++++++++++++++++++ 3 files changed, 28 insertions(+), 26 deletions(-) delete mode 100644 include/linux/platform_data/atmel-aes.h create mode 100644 include/linux/platform_data/crypto-atmel.harch/arm/mach-at91/at91sam9g45_devices.c +2
-2@@ -18,7 +18,7 @@#include <linux/platform_device.h> #include <linux/i2c-gpio.h> #include <linux/atmel-mci.h> -#include <linux/platform_data/atmel-aes.h> +#include <linux/platform_data/crypto-atmel.h> #include <linux/platform_data/at91_adc.h> @@ -1900,7 +1900,7 @@ static void __init at91_add_device_tdes(void) {}* -------------------------------------------------------------------- */ #if defined(CONFIG_CRYPTO_DEV_ATMEL_AES ) || defined(CONFIG_CRYPTO_DEV_ATMEL_AES_MODULE ) -static struct aes_platform_data aes_data; +static struct crypto_platform_data aes_data;static u64 aes_dmamask =DMA_BIT_MASK (32 ); static struct resource aes_resources[] = {
arch/arm/mach-at91/at91sam9g45_devices.c static struct platform_device at91sam9g45_aes_device = { · line 1936
Quoted 8 lines
arch/arm/mach-at91/at91sam9g45_devices.c +2
-2@@ -1931,9 +1931,11 @@ static struct platform_device at91sam9g45_aes_device = {static void __init at91_add_device_aes (void ) {struct at_dma_slave *atslave; -struct aes_dma_data *alt_atslave; +struct crypto_dma_data *alt_atslave; - alt_atslave =kzalloc (sizeof (struct aes_dma_data ),GFP_KERNEL ); + alt_atslave =kzalloc (sizeof (struct crypto_dma_data ),GFP_KERNEL );
I still not understand why we need to allocate it
just declare it as static
Best Regards,
J.
Hi Jean-Christophe,
Le Wed, 7 Nov 2012 17:45:23 +0100,
Jean-Christophe PLAGNIOL-VILLARD <[email protected]> a ?crit :
Quoted 16 lines
Quoted 16 lines
arch/arm/mach-at91/at91sam9g45_devices.c +2
-2@@ -1900,7 +1900,7 @@ static void __init at91_add_device_tdes(void) {}* -------------------------------------------------------------------- */ #if defined(CONFIG_CRYPTO_DEV_ATMEL_AES ) || defined(CONFIG_CRYPTO_DEV_ATMEL_AES_MODULE ) -static struct aes_platform_data aes_data; +static struct crypto_platform_data aes_data;static u64 aes_dmamask =DMA_BIT_MASK (32 ); static struct resource aes_resources[] = {@@ -1931,9 +1931,11 @@ static struct platform_device at91sam9g45_aes_device = {static void __init at91_add_device_aes (void ) {struct at_dma_slave *atslave; -struct aes_dma_data *alt_atslave; +struct crypto_dma_data *alt_atslave;
Quoted 6 lines
arch/arm/mach-at91/at91sam9g45_devices.c static struct platform_device at91sam9g45_aes_device = { · line 1936
Quoted 2 lines
arch/arm/mach-at91/at91sam9g45_devices.c +1
-1- alt_atslave =kzalloc (sizeof (struct aes_dma_data ),GFP_KERNEL ); + alt_atslave =kzalloc (sizeof (struct crypto_dma_data ),GFP_KERNEL );I still not understand why we need to allocate it
just declare it as static
last time we had some data static and you asked to alloc them (and didn't bother to answer why you required that :
http://lkml.indiana.edu/hypermail/linux/kernel/1207.0/02779.html ), now you ask to declare static something which is allocated (and that's already done this way for the mci) : may you please explain why so that we get it the right way for next time ?
Thanks
Eric
Quoted 24 lines · Eric B?nard
Hi Jean-Christophe,
Le Wed, 7 Nov 2012 17:45:23 +0100,
Jean-Christophe PLAGNIOL-VILLARD <[email protected]> a ?crit :Quoted 20 lines
Quoted 10 lines
arch/arm/mach-at91/at91sam9g45_devices.c +1
-1@@ -1900,7 +1900,7 @@ static void __init at91_add_device_tdes(void) {}* -------------------------------------------------------------------- */ #if defined(CONFIG_CRYPTO_DEV_ATMEL_AES ) || defined(CONFIG_CRYPTO_DEV_ATMEL_AES_MODULE ) -static struct aes_platform_data aes_data; +static struct crypto_platform_data aes_data;static u64 aes_dmamask =DMA_BIT_MASK (32 ); static struct resource aes_resources[] = {arch/arm/mach-at91/at91sam9g45_devices.c static struct platform_device at91sam9g45_aes_device = { · line 1936
Quoted 8 lines
arch/arm/mach-at91/at91sam9g45_devices.c +2
-2@@ -1931,9 +1931,11 @@ static struct platform_device at91sam9g45_aes_device = {static void __init at91_add_device_aes (void ) {struct at_dma_slave *atslave; -struct aes_dma_data *alt_atslave; +struct crypto_dma_data *alt_atslave; - alt_atslave =kzalloc (sizeof (struct aes_dma_data ),GFP_KERNEL ); + alt_atslave =kzalloc (sizeof (struct crypto_dma_data ),GFP_KERNEL );I still not understand why we need to allocate it
Quoted 8 lines
Quoted 2 lines
just declare it as static
last time we had some data static and you asked to alloc them (and didn't bother to answer why you required that :
http://lkml.indiana.edu/hypermail/linux/kernel/1207.0/02779.html ), now you ask to declare static something which is allocated (and that's already done this way for the mci) : may you please explain why so that we get it the right way for next time ?
in the driver yes we write multi instance and generic code but in the platfrom I do not see why
Best Regards,
J.
PATCH v3 2/5 ARM: AT91SAM9G45: same platform data structure for all crypto peripherals
In reply to Jean-Christophe PLAGNIOL-VILLARDOnly 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.
---
v2 : check kzalloc return value.
v3 : alt_atslave structure declared as static.
arch/arm/mach-at91/at91sam9g45_devices.c | 14 ++++++-------- include/linux/platform_data/atmel-aes.h | 22 ---------------------- include/linux/platform_data/crypto-atmel.h | 22 ++++++++++++++++++++++ 3 files changed, 28 insertions(+), 30 deletions(-) delete mode 100644 include/linux/platform_data/atmel-aes.h create mode 100644 include/linux/platform_data/crypto-atmel.h
arch/arm/mach-at91/at91sam9g45_devices.c +6 -8
@@ -18,7 +18,7 @@#include <linux/platform_device.h> #include <linux/i2c-gpio.h> #include <linux/atmel-mci.h> -#include <linux/platform_data/atmel-aes.h> +#include <linux/platform_data/crypto-atmel.h> #include <linux/platform_data/at91_adc.h>
@@ -1900,7 +1900,8 @@ static void __init at91_add_device_tdes(void) {}* -------------------------------------------------------------------- */ #if defined(CONFIG_CRYPTO_DEV_ATMEL_AES ) || defined(CONFIG_CRYPTO_DEV_ATMEL_AES_MODULE ) -static struct aes_platform_data aes_data; +static struct crypto_platform_data aes_data; +static struct crypto_dma_data alt_atslave;static u64 aes_dmamask =DMA_BIT_MASK (32 ); static struct resource aes_resources[] = {
@@ -1931,23 +1932,20 @@ static struct platform_device at91sam9g45_aes_device = {static void __init at91_add_device_aes (void ) {struct at_dma_slave *atslave; -struct aes_dma_data *alt_atslave; - - alt_atslave =kzalloc (sizeof (struct aes_dma_data ),GFP_KERNEL );/* DMA TX slave channel configuration */ - atslave = &alt_atslave->txdata; + atslave = &alt_atslave.txdata; atslave->dma_dev = &at_hdmac_device.dev; atslave->cfg =ATC_FIFOCFG_ENOUGHSPACE |ATC_SRC_H2SEL_HW |ATC_SRC_PER (AT_DMA_ID_AES_RX );/* DMA RX slave channel configuration */ - atslave = &alt_atslave->rxdata; + atslave = &alt_atslave.rxdata; atslave->dma_dev = &at_hdmac_device.dev; atslave->cfg =ATC_FIFOCFG_ENOUGHSPACE |ATC_DST_H2SEL_HW |ATC_DST_PER (AT_DMA_ID_AES_TX ); - aes_data.dma_slave = alt_atslave; + aes_data.dma_slave = &alt_atslave;platform_device_register (&at91sam9g45_aes_device); }#else
include/linux/platform_data/atmel-aes.h deleted +0 -22
@@ -1,22 +0,0 @@ -#ifndef __LINUX_ATMEL_AES_H -#define __LINUX_ATMEL_AES_H - -#include <linux/platform_data/dma-atmel.h> - -/** -* struct aes_dma_data - DMA data for AES -*/ -struct aes_dma_data { -struct at_dma_slave txdata; -struct at_dma_slave rxdata; -}; - -/** -* struct aes_platform_data - board-specific AES configuration -* @dma_slave: DMA slave interface to use in data transfers. -*/ -struct aes_platform_data { -struct aes_dma_data *dma_slave; -}; - -#endif /* __LINUX_ATMEL_AES_H */
include/linux/platform_data/crypto-atmel.h new file +22 -0
@@ -0,0 +1,22 @@ +#ifndef __LINUX_CRYPTO_ATMEL_H +#define __LINUX_CRYPTO_ATMEL_H + +#include <linux/platform_data/dma-atmel.h> + +/** +* struct crypto_dma_data - DMA data for AES/TDES/SHA +*/ +struct crypto_dma_data { +struct at_dma_slave txdata; +struct at_dma_slave rxdata; +}; + +/** +* struct crypto_platform_data - board-specific AES/TDES/SHA configuration +* @dma_slave: DMA slave interface to use in data transfers. +*/ +struct crypto_platform_data { +struct crypto_dma_data *dma_slave; +}; + +#endif /* __LINUX_CRYPTO_ATMEL_H */
Signature · 1 line
1.7.6.5