summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2013-06-15 17:00:52 -0600
committerGregory Nutt <gnutt@nuttx.org>2013-06-15 17:00:52 -0600
commit1b19a9fffccfd15713798d73b884f3c80a7b1041 (patch)
treebafcf116045ad55e7eb2afefd9e0aa90b64a2985
parentd84fcb39c0ef2675298227c08b45f16be13a78cb (diff)
downloadnuttx-1b19a9fffccfd15713798d73b884f3c80a7b1041.tar.gz
nuttx-1b19a9fffccfd15713798d73b884f3c80a7b1041.tar.bz2
nuttx-1b19a9fffccfd15713798d73b884f3c80a7b1041.zip
SAM MMCSD/SPI related changes
-rw-r--r--nuttx/configs/sam4l-xplained/README.txt6
-rw-r--r--nuttx/configs/sam4l-xplained/src/sam_mmcsd.c2
-rw-r--r--nuttx/drivers/mmcsd/mmcsd_spi.c12
3 files changed, 13 insertions, 7 deletions
diff --git a/nuttx/configs/sam4l-xplained/README.txt b/nuttx/configs/sam4l-xplained/README.txt
index d87a566b3..79b6f5bc8 100644
--- a/nuttx/configs/sam4l-xplained/README.txt
+++ b/nuttx/configs/sam4l-xplained/README.txt
@@ -719,3 +719,9 @@ Configuration sub-directories
Application Configuration -> NSH Library
CONFIG_NSH_ARCHINIT=y : Board has architecture-specific initialization
+
+ NOTE: If you enable the I/O1 this configuration with USART0 as the
+ console and with the I/O1 module in EXT1, you *must* remove UART
+ jumper. Otherwise, you have lookpack on USART0 and NSH will *not*
+ behave very well (since its outgoing prompts also appear as incoming
+ commands).
diff --git a/nuttx/configs/sam4l-xplained/src/sam_mmcsd.c b/nuttx/configs/sam4l-xplained/src/sam_mmcsd.c
index e922b8f9c..be4a334ec 100644
--- a/nuttx/configs/sam4l-xplained/src/sam_mmcsd.c
+++ b/nuttx/configs/sam4l-xplained/src/sam_mmcsd.c
@@ -86,7 +86,6 @@
int sam_sdinitialize(int minor)
{
-#ifdef HAVE_MMCSD
FAR struct spi_dev_s *spi;
int ret;
@@ -118,7 +117,6 @@ int sam_sdinitialize(int minor)
fvdbg("Successfuly bound SPI port %d to MMC/SD slot %d\n",
SAM34_MMCSDSPIPORTNO, SAM34_MMCSDSLOTNO);
-#endif
return OK;
}
diff --git a/nuttx/drivers/mmcsd/mmcsd_spi.c b/nuttx/drivers/mmcsd/mmcsd_spi.c
index 8c4eb4429..71fe5c625 100644
--- a/nuttx/drivers/mmcsd/mmcsd_spi.c
+++ b/nuttx/drivers/mmcsd/mmcsd_spi.c
@@ -348,7 +348,10 @@ static void mmcsd_semtake(FAR struct mmcsd_slot_s *slot)
#ifndef CONFIG_SPI_OWNBUS
(void)SPI_LOCK(slot->spi, true);
- /* Set the frequency, as some other driver could have changed it. */
+ /* Set the frequency, as some other driver could have changed it.
+ * TODO: Also need to restore mode and number-of-bits. Those can also
+ * change from SPI device-to-device.
+ */
SPI_SETFREQUENCY(slot->spi, slot->spispeed);
#endif
@@ -694,9 +697,9 @@ static void mmcsd_decodecsd(FAR struct mmcsd_slot_s *slot, uint8_t *csd)
}
/* Store the value for future use */
-
+
slot->spispeed = frequency;
-
+
/* Set the actual SPI frequency as close as possible to that value */
frequency = SPI_SETFREQUENCY(spi, frequency);
@@ -1253,7 +1256,6 @@ static ssize_t mmcsd_write(FAR struct inode *inode, const unsigned char *buffer,
size_t nbytes;
off_t offset;
uint8_t response;
- int ret;
int i;
fvdbg("start_sector=%d nsectors=%d\n", start_sector, nsectors);
@@ -1394,7 +1396,7 @@ static ssize_t mmcsd_write(FAR struct inode *inode, const unsigned char *buffer,
/* Wait until the card is no longer busy */
- ret = mmcsd_waitready(slot);
+ (void)mmcsd_waitready(slot);
SPI_SELECT(spi, SPIDEV_MMCSD, false);
SPI_SEND(spi, 0xff);
mmcsd_semgive(slot);