SAMA5D3x-EK demo configuration now supports HSMCI0 and HSMCI1

This commit is contained in:
Gregory Nutt 2013-09-11 09:50:36 -06:00
parent 462dd6936c
commit 7391afb5c2
9 changed files with 177 additions and 58 deletions

View File

@ -2791,7 +2791,7 @@ FAR struct sdio_dev_s *sdio_initialize(int slotno)
#ifdef CONFIG_SAMA5_HSMCI1
if (slotno == 1)
{
/* Select HSMCI0 */
/* Select HSMCI1 */
priv = &g_hsmci1;
@ -2828,7 +2828,7 @@ FAR struct sdio_dev_s *sdio_initialize(int slotno)
#ifdef CONFIG_SAMA5_HSMCI2
if (slotno == 2)
{
/* Select HSMCI0 */
/* Select HSMCI2 */
priv = &g_hsmci2;

View File

@ -989,7 +989,84 @@ Configurations
nsh> cat /mnt/at25/atest.txt
This is a test
6. Support the USB high-speed EHCI device (UDPHS) driver is enabled.
NOTE: It appears that if Linux runs out of NAND, it will destroy the
contents of the AT25.
6. Support for HSMCI car slots. The SAMA5D3x-EK provides a two SD memory
card slots: (1) a full size SD card slot (J7 labeled MCI0), and (2)
a microSD memory card slot (J6 labeled MCI1). The full size SD card
slot connects via HSMCI0; the microSD connects vi HSMCI1. Relevant
configuration settings include:
System Type->ATSAMA5 Peripheral Support
CONFIG_SAMA5_HSMCI0=y : Enable HSMCI0 support
CONFIG_SAMA5_HSMCI1=y : Enable HSMCI1 support
CONFIG_SAMA5_DMAC0=y : DMAC0 is needed by HSMCI0
CONFIG_SAMA5_DMAC1=y : DMAC1 is needed by HSMCI1
System Type
CONFIG_SAMA5_PIO_IRQ=y : PIO interrupts needed
CONFIG_SAMA5_PIOD_IRQ=y : Card detect pins are on PIOD
Device Drivers -> MMC/SD Driver Support
CONFIG_MMCSD=y : Enable MMC/SD support
CONFIG_MMSCD_NSLOTS=1 : One slot per driver instance
CONFIG_MMCSD_HAVECARDDETECT=y : Supports card-detect PIOs
CONFIG_MMCSD_MMCSUPPORT=n : Interferes with some SD cards
CONFIG_MMCSD_SPI=n : No SPI-based MMC/SD support
CONFIG_MMCSD_SDIO=y : SDIO-based MMC/SD support
CONFIG_SDIO_DMA=y : Use SDIO DMA
CONFIG_SDIO_BLOCKSETUP=y : Needs to know block sizes
Library Routines
CONFIG_SCHED_WORKQUEUE=y : Driver needs work queue support
Application Configuration -> NSH Library
CONFIG_NSH_ARCHINIT=y : NSH board-initialization
Using the SD card:
1) After booting, the HSCMI devices will appear as /dev/mmcsd0
and /dev/mmcsd1.
2) If you try mounting an SD card with nothing in the slot, the
mount will fail:
nsh> mount -t vfat /dev/mmcsd1 /mnt/sd1
nsh: mount: mount failed: 19
NSH can be configured to provide errors as strings instead of
numbers. But in this case, only the error number is reported.
The error numbers can be found in nuttx/include/errno.h:
#define ENODEV 19
#define ENODEV_STR "No such device"
So the mount command is saying that there is no device or, more
correctly, that there is no card in the SD card slot.
3) Inserted the SD card. Then the mount should succeed.
nsh> mount -t vfat /dev/mmcsd1 /mnt/sd1
nsh> ls /mnt/sd1
/mnt/sd1:
atest.txt
nsh> cat /mnt/sd1/atest.txt
This is a test
4) Before removing the card, you must umount the file system. This
is equivalent to "ejecting" or "safely removing" the card on
Windows: It flushes any cached data to the card and makes the SD
card unavailable to the applications.
nsh> umount -t /mnt/sd1
It is now safe to remove the card. NuttX provides into callbacks
that can be used by an application to automatically unmount the
volume when it is removed. But those callbacks are not used in
this configuration.
7. Support the USB high-speed EHCI device (UDPHS) driver is enabled.
These are the relevant NuttX configuration settings:
Device Drivers -> USB Device Driver Support
@ -1037,7 +1114,7 @@ Configurations
nsh> msdis
nsh> mount -t vfat /dev/mtdblock0 /mnt/at25
7. The USB high-speed EHCI and the low-/full- OHCI host drivers are supported
8. The USB high-speed EHCI and the low-/full- OHCI host drivers are supported
in this configuration.
Here are the relevant configuration options that enable EHCI support:
@ -1097,7 +1174,7 @@ Configurations
The following features are *not* enabled in the demo configuration but
might be of some use to you:
8. Debugging USB. There is normal console debug output available that
9. Debugging USB. There is normal console debug output available that
can be enabled with CONFIG_DEBUG + CONFIG_DEBUG_USB. However, USB
operation is very time critical and enabling this debug output WILL
interfere with some operation. USB tracing is a less invasive way
@ -1146,8 +1223,14 @@ Configurations
STATUS:
2013-9-6: I have not confirmed this, but it appears that the AT25 does not
retain its formatting across power cycles. I need to study this more.
2013-9-6: The mass storage class is not yet working.
retain its formatting across power cycles. I think that the contents of
the AT25 are destroyed (i.e., reformatted for different use) by Linux when
it runs out of NAND.
2013-9-11: OHCI does not work with EHCI. At present, EHCI receives the
full- or low-speed devices and correctly hands them off to OHCI. But, for
some unknown reason, the connection is lost and the port reverts to EHCI which
returns the port to OHCI. This sequence of connection events occurs
indefinitiely. OHCI does work without EHCI enabled, however.
hello:
This configuration directory, performs the (almost) simplest of all
@ -1398,6 +1481,8 @@ Configurations
CONFIG_MMCSD=y : Enable MMC/SD support
CONFIG_MMSCD_NSLOTS=1 : One slot per driver instance
CONFIG_MMCSD_HAVECARDDETECT=y : Supports card-detect PIOs
CONFIG_MMCSD_MMCSUPPORT=n : Interferes with some SD cards
CONFIG_MMCSD_SPI=n : No SPI-based MMC/SD support
CONFIG_MMCSD_SDIO=y : SDIO-based MMC/SD support
CONFIG_SDIO_DMA=y : Use SDIO DMA
CONFIG_SDIO_BLOCKSETUP=y : Needs to know block sizes
@ -1410,7 +1495,10 @@ Configurations
Using the SD card:
1) If you try mounting an SD card with nothing in the slot, the
1) After booting, the HSCMI devices will appear as /dev/mmcsd0
and /dev/mmcsd1.
2) If you try mounting an SD card with nothing in the slot, the
mount will fail:
nsh> mount -t vfat /dev/mmcsd1 /mnt/sd1
@ -1426,21 +1514,21 @@ Configurations
So the mount command is saying that there is no device or, more
correctly, that there is no card in the SD card slot.
2) Inserted the SD card. Then the mount should succeed.
3) Inserted the SD card. Then the mount should succeed.
nsh> mount -t vfat /dev/mmcsd1 /mnt/sd1
nsh> ls /mnt/sd1
/mnt/sd1:
atest.txt
nsh> cat /mnt/sd1/atest.txt
This is a test
nsh> mount -t vfat /dev/mmcsd1 /mnt/sd1
nsh> ls /mnt/sd1
/mnt/sd1:
atest.txt
nsh> cat /mnt/sd1/atest.txt
This is a test
3) Before removing the card, you must umount the file system. This
is equivalent to "ejecting" or "safely removing" the card on
Windows: It flushes any cached data to the card and makes the SD
card unavailable to the applications.
3) Before removing the card, you must umount the file system. This
is equivalent to "ejecting" or "safely removing" the card on
Windows: It flushes any cached data to the card and makes the SD
card unavailable to the applications.
nsh> mount -t vfat /dev/mmcsd1 /mnt/sd1
nsh> umount -t /mnt/sd1
It is now safe to remove the card. NuttX provides into callbacks
that can be used by an application to automatically unmount the

View File

@ -109,6 +109,8 @@ CONFIG_ARMV7A_TOOLCHAIN_CODESOURCERYW=y
# CONFIG_ARMV7A_TOOLCHAIN_GNU_EABIL is not set
# CONFIG_ARMV7A_TOOLCHAIN_GNU_EABIW is not set
# CONFIG_ARMV7A_TOOLCHAIN_GNU_OABI is not set
CONFIG_SDIO_DMA=y
# CONFIG_SDIO_WIDTH_D1_ONLY is not set
# CONFIG_USBHOST_BULK_DISABLE is not set
# CONFIG_USBHOST_INT_DISABLE is not set
CONFIG_USBHOST_ISOC_DISABLE=y
@ -138,8 +140,8 @@ CONFIG_SAMA5_USART1=y
# CONFIG_SAMA5_TWI0 is not set
# CONFIG_SAMA5_TWI1 is not set
# CONFIG_SAMA5_TWI2 is not set
# CONFIG_SAMA5_HSMCI0 is not set
# CONFIG_SAMA5_HSMCI1 is not set
CONFIG_SAMA5_HSMCI0=y
CONFIG_SAMA5_HSMCI1=y
# CONFIG_SAMA5_HSMCI2 is not set
CONFIG_SAMA5_SPI0=y
# CONFIG_SAMA5_SPI1 is not set
@ -148,7 +150,7 @@ CONFIG_SAMA5_SPI0=y
# CONFIG_SAMA5_PWM is not set
# CONFIG_SAMA5_ADC is not set
CONFIG_SAMA5_DMAC0=y
# CONFIG_SAMA5_DMAC1 is not set
CONFIG_SAMA5_DMAC1=y
CONFIG_SAMA5_UHPHS=y
CONFIG_SAMA5_UDPHS=y
# CONFIG_SAMA5_GMAC is not set
@ -166,7 +168,12 @@ CONFIG_SAMA5_UDPHS=y
# CONFIG_SAMA5_ARM is not set
# CONFIG_SAMA5_FUSE is not set
CONFIG_SAMA5_MPDDRC=y
# CONFIG_SAMA5_PIO_IRQ is not set
CONFIG_SAMA5_PIO_IRQ=y
# CONFIG_SAMA5_PIOA_IRQ is not set
# CONFIG_SAMA5_PIOB_IRQ is not set
# CONFIG_SAMA5_PIOC_IRQ is not set
CONFIG_SAMA5_PIOD_IRQ=y
# CONFIG_SAMA5_PIOE_IRQ is not set
#
# SPI device driver options
@ -174,6 +181,12 @@ CONFIG_SAMA5_MPDDRC=y
CONFIG_SAMA5_SPI_DMA=y
CONFIG_SAMA5_SPI_DMATHRESHOLD=4
#
# HSMCI device driver options
#
# CONFIG_SAMA5_HSMCI_RDPROOF is not set
# CONFIG_SAMA5_HSMCI_WRPROOF is not set
#
# USB High Speed Device Controller driver (DCD) options
#
@ -284,6 +297,7 @@ CONFIG_ARCH_HAVE_BUTTONS=y
# CONFIG_ARCH_BUTTONS is not set
CONFIG_ARCH_HAVE_IRQBUTTONS=y
CONFIG_NSH_MMCSDMINOR=0
CONFIG_NSH_MMCSDSLOTNO=0
#
# Board-Specific Options
@ -380,7 +394,17 @@ CONFIG_SPI_EXCHANGE=y
# CONFIG_BCH is not set
# CONFIG_INPUT is not set
# CONFIG_LCD is not set
# CONFIG_MMCSD is not set
CONFIG_MMCSD=y
CONFIG_MMCSD_NSLOTS=1
# CONFIG_MMCSD_READONLY is not set
# CONFIG_MMCSD_MULTIBLOCK_DISABLE is not set
# CONFIG_MMCSD_MMCSUPPORT is not set
CONFIG_MMCSD_HAVECARDDETECT=y
# CONFIG_MMCSD_SPI is not set
CONFIG_ARCH_HAVE_SDIO=y
CONFIG_MMCSD_SDIO=y
# CONFIG_SDIO_MUXBUS is not set
CONFIG_SDIO_BLOCKSETUP=y
CONFIG_MTD=y
#
@ -480,6 +504,7 @@ CONFIG_HIDKBD_BUFSIZE=64
# CONFIG_HIDKBD_RAWSCANCODES is not set
# CONFIG_HIDKBD_ALLSCANCODES is not set
# CONFIG_HIDKBD_NODEBOUNCE is not set
# CONFIG_USBHOST_TRACE is not set
# CONFIG_WIRELESS is not set
#

View File

@ -56,7 +56,7 @@
#include "sama5d3x-ek.h"
#ifdef CONFIG_MTD_AT25
#ifdef HAVE_AT25
/****************************************************************************
* Pre-Processor Definitions
@ -140,4 +140,4 @@ int sam_at25_initialize(int minor)
return OK;
}
#endif /* HAVE_AT25_MTD */
#endif /* HAVE_AT25 */

View File

@ -84,7 +84,7 @@
#include "sama5d3x-ek.h"
#ifdef HAVE_HSMCI_MTD
#ifdef HAVE_HSMCI
/****************************************************************************
* Pre-Processor Definitions
@ -341,4 +341,4 @@ bool sam_writeprotected(int slotno)
return false;
}
#endif /* HAVE_HSMCI_MTD */
#endif /* HAVE_HSMCI */

View File

@ -86,14 +86,14 @@
int nsh_archinitialize(void)
{
#if defined(HAVE_AT25_MTD) || defined(HAVE_HSMCI_MTD) || defined(HAVE_USBHOST) || \
#if defined(HAVE_AT25) || defined(HAVE_HSMCI) || defined(HAVE_USBHOST) || \
defined(HAVE_USBMONITOR)
int ret;
#endif
/* Initialize the AT25 driver */
#ifdef HAVE_AT25_MTD
#ifdef HAVE_AT25
ret = sam_at25_initialize(AT25_MINOR);
if (ret < 0)
{
@ -102,7 +102,7 @@ int nsh_archinitialize(void)
}
#endif
#ifdef HAVE_HSMCI_MTD
#ifdef HAVE_HSMCI
#ifdef CONFIG_SAMA5_HSMCI0
ret = sam_hsmci_initialize(HSMCI0_SLOTNO, HSMCI0_MINOR);
if (ret < 0)

View File

@ -90,7 +90,7 @@ static struct usbhost_connection_s *g_ehciconn;
/* Overcurrent interrupt handler */
#if defined(HAVE_USBHOST) && defined(CONFIG_SAMA5_PIOD_IRQ)
static xcpt_t g_ochandler;
static xcpt_t *g_ochandler;
#endif
/************************************************************************************
@ -487,6 +487,7 @@ xcpt_t sam_setup_overcurrent(xcpt_t handler)
/* Return the old button handler (so that it can be restored) */
irqrestore(flags);
return oldhandler;
#else

View File

@ -55,13 +55,13 @@
/* Configuration ************************************************************/
#ifndef HAVE_AT25_MTD
#ifndef HAVE_AT25
# error AT25 Serial FLASH not supported
#endif
#ifndef CONFIG_SAMA5_AT25_FTL
# error AT25 FTL support required (CONFIG_SAMA5_AT25_FTL)
# undef HAVE_AT25_MTD
# undef HAVE_AT25
#endif
#ifndef CONFIG_EXAMPLES_USBMSC_DEVMINOR1
@ -70,7 +70,7 @@
#if CONFIG_EXAMPLES_USBMSC_DEVMINOR1 != AT25_MINOR
# error Confusion in the assignment of minor device numbers
# undef HAVE_AT25_MTD
# undef HAVE_AT25
#endif
/* Debug ********************************************************************/
@ -109,7 +109,7 @@ int usbmsc_archinitialize(void)
{
/* Initialize the AT25 MTD driver */
#ifdef HAVE_AT25_MTD
#ifdef HAVE_AT25
int ret = sam_at25_initialize(AT25_MINOR);
if (ret < 0)
{

View File

@ -55,8 +55,8 @@
************************************************************************************/
/* Configuration ************************************************************/
#define HAVE_HSMCI_MTD 1
#define HAVE_AT25_MTD 1
#define HAVE_HSMCI 1
#define HAVE_AT25 1
#define HAVE_USBHOST 1
#define HAVE_USBDEV 1
#define HAVE_USBMONITOR 1
@ -65,28 +65,28 @@
/* Can't support MMC/SD if the card interface(s) are not enable */
#if !defined(CONFIG_SAMA5_HSMCI0) && !defined(CONFIG_SAMA5_HSMCI1)
# undef HAVE_HSMCI_MTD
# undef HAVE_HSMCI
#endif
/* Can't support MMC/SD features if mountpoints are disabled */
#if defined(HAVE_HSMCI_MTD) && defined(CONFIG_DISABLE_MOUNTPOINT)
#if defined(HAVE_HSMCI) && defined(CONFIG_DISABLE_MOUNTPOINT)
# warning Mountpoints disabled. No MMC/SD support
# undef HAVE_HSMCI_MTD
# undef HAVE_HSMCI
#endif
/* We need PIO interrupts on PIOD to support card detect interrupts */
#if defined(HAVE_HSMCI_MTD) && !defined(CONFIG_SAMA5_PIOD_IRQ)
#if defined(HAVE_HSMCI) && !defined(CONFIG_SAMA5_PIOD_IRQ)
# warning PIOD interrupts not enabled. No MMC/SD support.
# undef HAVE_HSMCI_MTD
# undef HAVE_HSMCI
#endif
/* AT25 Serial FLASH */
/* Can't support the AT25 device if it SPI0 or AT25 support are not enabled */
#if !defined(CONFIG_SAMA5_SPI0) || !defined(CONFIG_MTD_AT25)
# undef HAVE_AT25_MTD
# undef HAVE_AT25
#endif
/* Can't support AT25 features if mountpoints are disabled or if we were not
@ -94,7 +94,7 @@
*/
#if defined(CONFIG_DISABLE_MOUNTPOINT) || !defined(CONFIG_SAMA5_AT25_AUTOMOUNT)
# undef HAVE_AT25_MTD
# undef HAVE_AT25
#endif
/* If we are going to mount the AT25, then they user must also have told
@ -102,7 +102,7 @@
*/
#if !defined(CONFIG_SAMA5_AT25_FTL) && !defined(CONFIG_SAMA5_AT25_NXFFS)
# undef HAVE_AT25_MTD
# undef HAVE_AT25
#endif
#if defined(CONFIG_SAMA5_AT25_FTL) && defined(CONFIG_SAMA5_AT25_NXFFS)
@ -111,16 +111,24 @@
# undef CONFIG_SAMA5_AT25_NXFFS
#endif
/* Assign minor device numbers. We basically ignore most of the NSH
* configuration here (NSH SLOTNO ignored completely; NSH minor extended
* to handle more devices).
/* Assign minor device numbers. We will also use MINOR number 0 for the AT25.
* It should appear as /dev/mtdblock0
*/
#ifdef HAVE_AT25
# define AT25_MINOR 0
#endif
/* MMC/SD minor numbers: The NSH device minor extended is extened to support
* two devices. If CONFIG_NSH_MMCSDMINOR is zero, these will be: /dev/mmcsd0
* and /dev/mmcsd1.
*/
#ifndef CONFIG_NSH_MMCSDMINOR
# define CONFIG_NSH_MMCSDMINOR 0
#endif
#ifdef HAVE_HSMCI_MTD
#ifdef HAVE_HSMCI
# define HSMCI0_SLOTNO 0
# define HSMCI1_SLOTNO 1
@ -128,13 +136,10 @@
# ifdef CONFIG_SAMA5_HSMCI0
# define HSMCI0_MINOR CONFIG_NSH_MMCSDMINOR
# define HSMCI1_MINOR (CONFIG_NSH_MMCSDMINOR+1)
# define AT25_MINOR (CONFIG_NSH_MMCSDMINOR+2)
# else
# define HSMCI1_MINOR CONFIG_NSH_MMCSDMINOR
# define AT25_MINOR (CONFIG_NSH_MMCSDMINOR+1)
# endif
#else
# define AT25_MINOR CONFIG_NSH_MMCSDMINOR
#endif
/* USB Host / USB Device */
@ -439,7 +444,7 @@ void sam_sdram_config(void);
*
****************************************************************************/
#ifdef HAVE_AT25_MTD
#ifdef HAVE_AT25
int sam_at25_initialize(int minor);
#endif
@ -451,7 +456,7 @@ int sam_at25_initialize(int minor);
*
****************************************************************************/
#ifdef HAVE_HSMCI_MTD
#ifdef HAVE_HSMCI
int sam_hsmci_initialize(int slotno, int minor);
#endif
@ -463,7 +468,7 @@ int sam_hsmci_initialize(int slotno, int minor);
*
************************************************************************************/
#ifdef HAVE_HSMCI_MTD
#ifdef HAVE_HSMCI
bool sam_cardinserted(int slotno);
#endif
@ -475,7 +480,7 @@ bool sam_cardinserted(int slotno);
*
************************************************************************************/
#ifdef HAVE_HSMCI_MTD
#ifdef HAVE_HSMCI
bool sam_writeprotected(int slotno);
#endif