diff options
Diffstat (limited to 'nuttx/drivers/mmcsd/mmcsd_spi.c')
-rw-r--r-- | nuttx/drivers/mmcsd/mmcsd_spi.c | 49 |
1 files changed, 2 insertions, 47 deletions
diff --git a/nuttx/drivers/mmcsd/mmcsd_spi.c b/nuttx/drivers/mmcsd/mmcsd_spi.c index cadf8bbd8..cd0870616 100644 --- a/nuttx/drivers/mmcsd/mmcsd_spi.c +++ b/nuttx/drivers/mmcsd/mmcsd_spi.c @@ -168,9 +168,6 @@ static void mmcsd_semtake(sem_t *sem); /* Card SPI interface *******************************************************/ -#ifdef CONFIG_MMCSD_SYNCHRONIZE -static inline void mmcsd_synchronize(FAR struct mmcsd_slot_s *slot); -#endif static int mmcsd_waitready(FAR struct mmcsd_slot_s *slot); static uint32 mmcsd_sendcmd(FAR struct mmcsd_slot_s *slot, const struct mmcsd_cmdinfo_s *cmd, uint32 arg); @@ -347,38 +344,6 @@ static void mmcsd_semtake(sem_t *sem) #define mmcsd_semgive(sem) sem_post(sem) /**************************************************************************** - * Name: mmcsd_synchronize - * - * Description: - * Wait until the the card is no longer busy - * - * Assumptions: - * MMC/SD card already selected - * - ****************************************************************************/ - -#ifdef CONFIG_MMCSD_SYNCHRONIZE -static inline void mmcsd_synchronize(FAR struct mmcsd_slot_s *slot) -{ - FAR struct spi_dev_s *spi = slot->spi; - - /* De-select the MMCSD card */ - - SPI_SELECT(spi, SPIDEV_MMCSD, FALSE); - - /* Wait a bit */ - - SPI_SEND(spi, 0xff); - - /* Reselect the card */ - - SPI_SELECT(spi, SPIDEV_MMCSD, TRUE); -} -#else -# define mmcsd_synchronize(slot) /* No synchronization needed */ -#endif - -/**************************************************************************** * Name: mmcsd_waitready * * Description: @@ -848,7 +813,6 @@ static int mmcsd_getcardinfo(FAR struct mmcsd_slot_s *slot, ubyte *buffer, /* Send the CMD9 or CMD10 */ - mmcsd_synchronize(slot); result = mmcsd_sendcmd(slot, cmd, 0); if (result != MMCSD_SPIR1_OK) { @@ -1141,11 +1105,10 @@ static ssize_t mmcsd_read(FAR struct inode *inode, unsigned char *buffer, fvdbg("nbytes=%d byte offset=%d\n", nbytes, offset); } - /* Select the slave and synchronize */ + /* Select the slave */ mmcsd_semtake(&slot->sem); SPI_SELECT(spi, SPIDEV_MMCSD, TRUE); - mmcsd_synchronize(slot); /* Single or multiple block read? */ @@ -1303,11 +1266,10 @@ static ssize_t mmcsd_write(FAR struct inode *inode, const unsigned char *buffer, } mmcsd_dumpbuffer(buffer, nbytes); - /* Select the slave and synchronize */ + /* Select the slave */ mmcsd_semtake(&slot->sem); SPI_SELECT(spi, SPIDEV_MMCSD, TRUE); - mmcsd_synchronize(slot); /* Single or multiple block transfer? */ @@ -1597,11 +1559,9 @@ static int mmcsd_mediainitialize(FAR struct mmcsd_slot_s *slot) do { fvdbg("%d. Send CMD55/ACMD41\n", elapsed); - mmcsd_synchronize(slot); result = mmcsd_sendcmd(slot, &g_cmd55, 0); if (result == MMCSD_SPIR1_IDLESTATE || result == MMCSD_SPIR1_OK) { - mmcsd_synchronize(slot); result = mmcsd_sendcmd(slot, &g_acmd41, 1 << 30); if (result == MMCSD_SPIR1_OK) { @@ -1644,13 +1604,11 @@ static int mmcsd_mediainitialize(FAR struct mmcsd_slot_s *slot) /* Both the MMC card and the SD card support CMD55 */ fvdbg("Send CMD55/ACMD41\n"); - mmcsd_synchronize(slot); result = mmcsd_sendcmd(slot, &g_cmd55, 0); if (result == MMCSD_SPIR1_IDLESTATE || result == MMCSD_SPIR1_OK) { /* But ACMD41 is supported only on SD */ - mmcsd_synchronize(slot); result = mmcsd_sendcmd(slot, &g_acmd41, 0); if (result == MMCSD_SPIR1_IDLESTATE || result == MMCSD_SPIR1_OK) { @@ -1668,11 +1626,9 @@ static int mmcsd_mediainitialize(FAR struct mmcsd_slot_s *slot) if (IS_SD(slot->type)) { fvdbg("%d. Send CMD55/ACMD41\n", elapsed); - mmcsd_synchronize(slot); result = mmcsd_sendcmd(slot, &g_cmd55, 0); if (result == MMCSD_SPIR1_IDLESTATE || result == MMCSD_SPIR1_OK) { - mmcsd_synchronize(slot); result = mmcsd_sendcmd(slot, &g_acmd41, 0); if (result == MMCSD_SPIR1_OK) { @@ -1683,7 +1639,6 @@ static int mmcsd_mediainitialize(FAR struct mmcsd_slot_s *slot) else { fvdbg("%d. Send CMD1\n", i); - mmcsd_synchronize(slot); result = mmcsd_sendcmd(slot, &g_cmd1, 0); if (result == MMCSD_SPIR1_OK) { |