SD on Sure board should work in SPI mode2 as well
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4800 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
06b75bc957
commit
6f976ec46b
@ -357,6 +357,7 @@ CONFIG_DEBUG_SCHED=n
|
||||
CONFIG_DEBUG_USB=n
|
||||
CONFIG_DEBUG_FS=n
|
||||
CONFIG_DEBUG_SPI=n
|
||||
CONFIG_SPI_REGDEBUG=n
|
||||
|
||||
CONFIG_HAVE_CXX=n
|
||||
CONFIG_HAVE_CXXINITIALIZE=n
|
||||
@ -380,7 +381,7 @@ CONFIG_FDCLONE_DISABLE=n
|
||||
CONFIG_FDCLONE_STDIO=n
|
||||
CONFIG_SDCLONE_DISABLE=y
|
||||
CONFIG_SCHED_WORKQUEUE=n
|
||||
CONFIG_SCHED_WORKPRIORITY=50
|
||||
CONFIG_SCHED_WORKPRIORITY=192
|
||||
CONFIG_SCHED_WORKPERIOD=(50*1000)
|
||||
CONFIG_SCHED_WORKSTACKSIZE=1024
|
||||
CONFIG_SIG_SIGWORK=4
|
||||
|
@ -69,7 +69,7 @@
|
||||
# define CONFIG_NSH_MMCSDSPIPORTNO 2
|
||||
# endif
|
||||
# if !defined(CONFIG_NSH_MMCSDSLOTNO) || CONFIG_NSH_MMCSDSLOTNO != 0
|
||||
# error "The Sure PIC32MX MMC/SD is only one slot (0)"
|
||||
# error "The Sure PIC32MX MMC/SD has only one slot (0)"
|
||||
# undef CONFIG_NSH_MMCSDSLOTNO
|
||||
# define CONFIG_NSH_MMCSDSLOTNO 0
|
||||
# endif
|
||||
@ -200,13 +200,13 @@ static int nsh_waiter(int argc, char *argv[])
|
||||
#ifdef CONFIG_NSH_HAVEMMCSD
|
||||
static int nsh_sdinitialize(void)
|
||||
{
|
||||
FAR struct spi_dev_s *ssp;
|
||||
FAR struct spi_dev_s *spi;
|
||||
int ret;
|
||||
|
||||
/* Get the SPI port */
|
||||
|
||||
ssp = up_spiinitialize(CONFIG_NSH_MMCSDSPIPORTNO);
|
||||
if (!ssp)
|
||||
spi = up_spiinitialize(CONFIG_NSH_MMCSDSPIPORTNO);
|
||||
if (!spi)
|
||||
{
|
||||
message("nsh_archinitialize: Failed to initialize SPI port %d\n",
|
||||
CONFIG_NSH_MMCSDSPIPORTNO);
|
||||
@ -217,10 +217,19 @@ static int nsh_sdinitialize(void)
|
||||
message("Successfully initialized SPI port %d\n",
|
||||
CONFIG_NSH_MMCSDSPIPORTNO);
|
||||
|
||||
/* The SPI should be in 8-bit (default) and mode2: CKP=1, CKE=0.
|
||||
* The MMC/SD driver will control the SPI frequency. WARNING:
|
||||
* this is not the right way to do this... this should be done
|
||||
* the MMC/SD driver: Other device on SPI1 may need other mode
|
||||
* settings.
|
||||
*/
|
||||
|
||||
SPI_SETMODE(spi, SPIDEV_MODE2);
|
||||
|
||||
/* Bind the SPI port to the slot */
|
||||
|
||||
ret = mmcsd_spislotinitialize(CONFIG_NSH_MMCSDMINOR,
|
||||
CONFIG_NSH_MMCSDSLOTNO, ssp);
|
||||
CONFIG_NSH_MMCSDSLOTNO, spi);
|
||||
if (ret < 0)
|
||||
{
|
||||
message("nsh_sdinitialize: "
|
||||
|
Loading…
Reference in New Issue
Block a user