SAMA5: Add configuration to assign an XDMAC channel to an HSMCI

This commit is contained in:
Gregory Nutt
2014-06-29 08:43:46 -06:00
parent b7fad79a1d
commit 7c8c583722
3 changed files with 90 additions and 15 deletions
+39 -2
View File
@@ -413,13 +413,13 @@ config SAMA5_DMAC1
depends on SAMA5_HAVE_DMA
config SAMA5_XDMAC0
bool "XDMA Controller (XDMAC0)"
bool "XDMA Controller (XDMAC0, always secure)"
default n
select ARCH_DMA
depends on SAMA5_HAVE_XDMA
config SAMA5_XDMAC1
bool "XDMA Controller (XDMAC1)"
bool "XDMA Controller (XDMAC1, never secure)"
default n
select ARCH_DMA
depends on SAMA5_HAVE_XDMA
@@ -2400,6 +2400,43 @@ endif # SAMA5_SSC0 || SAMA5_SSC1
if SAMA5_HSMCI0 || SAMA5_HSMCI1 || SAMA5_HSMCI2
menu "HSMCI device driver options"
if SAMA5_XDMAC0 || SAMA5_XDMAC1
choice
prompt "HSMCI0 XDMAC Selection"
default SAMA5_HSMCI0_XDMAC0 if SAMA5_XDMAC0
default SAMA5_HSMCI0_XDMAC1 if !SAMA5_XDMAC0 && SAMA5_XDMAC1
depends on SAMA5_HSMCI0
config SAMA5_HSMCI0_XDMAC0
bool "XDMAC0 (always secure)"
depends on SAMA5_XDMAC0
config SAMA5_HSMCI0_XDMAC1
bool "XDMAC1 (never secure)"
depends on SAMA5_XDMAC1
endchoice # HSMCI0 XDMAC Selection
choice
prompt "HSMCI1 XDMAC Selection"
default SAMA5_HSMCI1_XDMAC0 if SAMA5_XDMAC0
default SAMA5_HSMCI1_XDMAC1 if !SAMA5_XDMAC0 && SAMA5_XDMAC1
depends on SAMA5_HSMCI1
config SAMA5_HSMCI1_XDMAC0
bool "XDMAC0 (always secure)"
depends on SAMA5_XDMAC0
config SAMA5_HSMCI1_XDMAC1
bool "XDMAC1 (never secure)"
depends on SAMA5_XDMAC1
endchoice # HSMCI1 XDMAC Selection
# There is no HSMCI2 on the platforms that support XDMAC
endif # SAMA5_XDMAC0 || SAMA5_XDMAC1
config SAMA5_HSMCI_RDPROOF
bool "Read Proof Enable"
default n
+2 -2
View File
@@ -384,7 +384,7 @@
#define XDMACH_CDUS_DUBS_MASK (0x00ffffff) /* Bits 0-23: Channel Destination Microblock Stride */
/* XDMA Channel Definitions *************************************************************/
/* XDMA Controller 0 Channel Definitions */
/* XDMA Controller 0 Channel Definitions (always secure) */
#define XDMAC0_CH_HSMCI0 0 /* HSMCI0 Receive/Transmit */
#define XDMAC0_CH_HSMCI1 1 /* HSMCI1 Receive/Transmit */
@@ -433,7 +433,7 @@
#define XDMAC0_CH_CATB_TX 46 /* CATB Transmit */
#define XDMAC0_CH_CATB_RX 47 /* CATB Receive */
/* XDMA Controller 1 Channel Definitions */
/* XDMA Controller 1 Channel Definitions (never secure) */
#define XDMAC1_CH_HSMCI0 0 /* HSMCI0 Receive/Transmit */
#define XDMAC1_CH_HSMCI1 1 /* HSMCI1 Receive/Transmit */
+49 -11
View File
@@ -79,16 +79,54 @@
/* Configuration ************************************************************/
#if defined(CONFIG_SAMA5_HSMCI0) && !defined(CONFIG_SAMA5_DMAC0)
# warning "HSMCI0 support requires CONFIG_SAMA5_DMAC0"
#endif
#if defined(ATSAMA5D3)
/* The SAMA5D3 has three HSMCI blocks: HSMCI0-2. HSMCI0 requires DMAC0
* support, HSMCI1-2 require DMAC1 support.
*/
#if defined(CONFIG_SAMA5_HSMCI1) && !defined(CONFIG_SAMA5_DMAC1)
# warning "HSMCI1 support requires CONFIG_SAMA5_DMAC1"
#endif
# define HSMCI0_DMAC 0
# define HSMCI1_DMAC 1
# define HSMCI2_DMAC 1
#if defined(CONFIG_SAMA5_HSMCI2) && !defined(CONFIG_SAMA5_DMAC1)
# warning "HSMCI2 support requires CONFIG_SAMA5_DMAC1"
# if defined(CONFIG_SAMA5_HSMCI0) && !defined(CONFIG_SAMA5_DMAC0)
# error "HSMCI0 support requires CONFIG_SAMA5_DMAC0"
# endif
# if defined(CONFIG_SAMA5_HSMCI1) && !defined(CONFIG_SAMA5_DMAC1)
# error "HSMCI1 support requires CONFIG_SAMA5_DMAC1"
# endif
# if defined(CONFIG_SAMA5_HSMCI2) && !defined(CONFIG_SAMA5_DMAC1)
# error "HSMCI2 support requires CONFIG_SAMA5_DMAC1"
# endif
#elif defined(ATSAMA5D4)
/* The SAMA5D3 has two HSMCI blocks: HSMCI0-1. They can be driven
* either by XDMAC0 (secure) or XDMAC1 (unsecure).
*/
# if !defined(CONFIG_SAMA5_XDMAC0) && !defined(CONFIG_SAMA5_XDMAC1)
# error HSMCI0/1 require CONFIG_SAMA5_XDMAC0 and/or CONFIG_SAMA5_XDMAC1
# endif
# if defined(CONFIG_SAMA5_XDMAC0) && defined(SAMA5_HSMCI0_XDMAC0)
# define HSMCI0_DMAC 0
# elif defined(CONFIG_SAMA5_XDMAC1)
# define HSMCI0_DMAC 1
# else
# error No valid DMA configuration for HSMCI0
# endif
# if defined(CONFIG_SAMA5_XDMAC0) && defined(SAMA5_HSMCI1_XDMAC0)
# define HSMCI1_DMAC 0
# elif defined(CONFIG_SAMA5_XDMAC1)
# define HSMCI1_DMAC 1
# else
# error No valid DMA configuration for HSMCI1
# endif
#else
# error Unrecognized SAMA5 architecture
#endif
#ifndef CONFIG_SCHED_WORKQUEUE
@@ -2915,7 +2953,7 @@ FAR struct sdio_dev_s *sdio_initialize(int slotno)
/* For DMA channel selection */
dmac = 0;
dmac = HSMCI0_DMAC;
pid = SAM_PID_HSMCI0;
}
else
@@ -2952,7 +2990,7 @@ FAR struct sdio_dev_s *sdio_initialize(int slotno)
/* For DMA channel selection */
dmac = 1;
dmac = HSMCI1_DMAC;
pid = SAM_PID_HSMCI1;
}
else
@@ -2989,7 +3027,7 @@ FAR struct sdio_dev_s *sdio_initialize(int slotno)
/* For DMA channel selection */
dmac = 1;
dmac = HSMCI2_DMAC;
pid = SAM_PID_HSMCI2;
}
else