diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2013-06-17 18:27:25 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2013-06-17 18:27:25 -0600 |
commit | e1bbd1c73b30077b4cb45e05b5b452c2cbda8651 (patch) | |
tree | 1432fb445f7b4f9ea8342b4d201950dca04c6085 | |
parent | 42593d65b9712714bb41326f4b23f6c62cf0b058 (diff) | |
download | px4-nuttx-e1bbd1c73b30077b4cb45e05b5b452c2cbda8651.tar.gz px4-nuttx-e1bbd1c73b30077b4cb45e05b5b452c2cbda8651.tar.bz2 px4-nuttx-e1bbd1c73b30077b4cb45e05b5b452c2cbda8651.zip |
MMC/SD SPI speed field is only used if CONFIG_SPI_OWNBUS is not defined
-rw-r--r-- | nuttx/drivers/mmcsd/mmcsd_spi.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/nuttx/drivers/mmcsd/mmcsd_spi.c b/nuttx/drivers/mmcsd/mmcsd_spi.c index 46d624d3c..bb026954d 100644 --- a/nuttx/drivers/mmcsd/mmcsd_spi.c +++ b/nuttx/drivers/mmcsd/mmcsd_spi.c @@ -158,7 +158,9 @@ struct mmcsd_slot_s uint32_t twrite; /* Card write time */ uint32_t ocr; /* Last 4 bytes of OCR (R3) */ uint32_t r7; /* Last 4 bytes of R7 */ +#ifndef CONFIG_SPI_OWNBUS uint32_t spispeed; /* Speed to use for SPI in data mode */ +#endif }; struct mmcsd_cmdinfo_s @@ -179,6 +181,12 @@ static void mmcsd_semgive(FAR struct mmcsd_slot_s *slot); /* Card SPI interface *******************************************************/ +#ifdef CONFIG_SPI_OWNBUS +static inline void mmcsd_spiinit(FAR struct mmcsd_slot_s *slot); +#else +# define mmcsd_spiinit(slot) +#endif + static int mmcsd_waitready(FAR struct mmcsd_slot_s *slot); static uint32_t mmcsd_sendcmd(FAR struct mmcsd_slot_s *slot, const struct mmcsd_cmdinfo_s *cmd, uint32_t arg); @@ -417,8 +425,6 @@ static inline void mmcsd_spiinit(FAR struct mmcsd_slot_s *slot) SPI_SETMODE(slot->spi, CONFIG_MMCSD_SPIMODE); SPI_SETBITS(slot->spi, 8); } -#else -# define mmcsd_spiinit(slot) #endif /**************************************************************************** @@ -728,7 +734,9 @@ static void mmcsd_decodecsd(FAR struct mmcsd_slot_s *slot, uint8_t *csd) /* Set the actual SPI frequency as close as possible to the max frequency */ +#ifndef CONFIG_SPI_OWNBUS slot->spispeed = frequency; +#endif frequency = SPI_SETFREQUENCY(spi, frequency); /* Now determine the delay to access data */ @@ -1575,7 +1583,9 @@ static int mmcsd_mediainitialize(FAR struct mmcsd_slot_s *slot) /* Clock Freq. Identification Mode < 400kHz */ +#ifndef CONFIG_SPI_OWNBUS slot->spispeed = MMCSD_IDMODE_CLOCK; +#endif SPI_SETFREQUENCY(spi, MMCSD_IDMODE_CLOCK); /* Set the maximum access time out */ @@ -1936,7 +1946,9 @@ int mmcsd_spislotinitialize(int minor, int slotno, FAR struct spi_dev_s *spi) /* Bind the SPI port to the slot */ slot->spi = spi; +#ifndef CONFIG_SPI_OWNBUS slot->spispeed = MMCSD_IDMODE_CLOCK; +#endif /* Get exclusvice access to the SPI bus and make sure that SPI is properly * configured for the MMC/SD card |