* mmc spi fixes @ 2011-11-28 8:40 Sascha Hauer 2011-11-28 8:40 ` [PATCH 1/2] mmc spi: add missing dependency on SPI Sascha Hauer 2011-11-28 8:40 ` [PATCH 2/2] mmc spi: compile fix Sascha Hauer 0 siblings, 2 replies; 4+ messages in thread From: Sascha Hauer @ 2011-11-28 8:40 UTC (permalink / raw) To: barebox Two compile fixes for the newly merged mmc over spi support. Sascha Hauer (2): mmc spi: add missing dependency on SPI mmc spi: compile fix drivers/mci/Kconfig | 1 + drivers/mci/mci_spi.c | 29 ++++++++++++----------------- 2 files changed, 13 insertions(+), 17 deletions(-) _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] mmc spi: add missing dependency on SPI 2011-11-28 8:40 mmc spi fixes Sascha Hauer @ 2011-11-28 8:40 ` Sascha Hauer 2011-11-28 8:40 ` [PATCH 2/2] mmc spi: compile fix Sascha Hauer 1 sibling, 0 replies; 4+ messages in thread From: Sascha Hauer @ 2011-11-28 8:40 UTC (permalink / raw) To: barebox Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> --- drivers/mci/Kconfig | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/drivers/mci/Kconfig b/drivers/mci/Kconfig index 00c28f1..897aa4d 100644 --- a/drivers/mci/Kconfig +++ b/drivers/mci/Kconfig @@ -81,6 +81,7 @@ config MCI_ATMEL config MCI_SPI bool "MMC/SD over SPI" + depends on SPI help Some systems access MMC/SD/SDIO cards using a SPI controller instead of using a "native" MMC/SD/SDIO controller. This has a -- 1.7.7.1 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2/2] mmc spi: compile fix 2011-11-28 8:40 mmc spi fixes Sascha Hauer 2011-11-28 8:40 ` [PATCH 1/2] mmc spi: add missing dependency on SPI Sascha Hauer @ 2011-11-28 8:40 ` Sascha Hauer 2011-11-28 8:47 ` Franck JULLIEN 1 sibling, 1 reply; 4+ messages in thread From: Sascha Hauer @ 2011-11-28 8:40 UTC (permalink / raw) To: barebox Without CRC support the mmc spi driver fails to compile with the following: drivers/mci/mci_spi.c:74:18: error: static declaration of 'crc7' follows non-static declaration Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> --- drivers/mci/mci_spi.c | 29 ++++++++++++----------------- 1 files changed, 12 insertions(+), 17 deletions(-) diff --git a/drivers/mci/mci_spi.c b/drivers/mci/mci_spi.c index 124e49b..653910b 100644 --- a/drivers/mci/mci_spi.c +++ b/drivers/mci/mci_spi.c @@ -64,23 +64,6 @@ #define RTOUT 3000000 /* 1 sec */ #define WTOUT 3000000 /* 1 sec */ -#ifndef CONFIG_MMC_SPI_CRC_ON -/* Note that while the CRC, in general, is ignored in SPI mode, the very first - * command must be followed by a valid CRC, since the card is not yet in SPI mode. - * The CRC byte for a CMD0 command with a zero argument is a constant 0x4A. For - * simplicity, this CRC byte is always sent with every command. - */ - -static inline u8 crc7(u8 crc, const u8 *buffer, size_t len) -{ - /* This is the crc7 value for a CMD0 command with a zero argument. - * It'll be left shifted and ored with '1' in mmc_spi_command_send - * to give 0x95 (also known as the CMD0 constant CRC value...) - */ - return 0x4A; -} -#endif - struct mmc_spi_host { struct mci_host mci; struct spi_device *spi; @@ -141,6 +124,14 @@ mmc_spi_writebytes(struct mmc_spi_host *host, unsigned len, void *data) return status; } +/* + * Note that while the CRC, in general, is ignored in SPI mode, the very first + * command must be followed by a valid CRC, since the card is not yet in SPI mode. + * The CRC byte for a CMD0 command with a zero argument is a constant 0x4A. For + * simplicity, this CRC byte is always sent with every command. + */ +#define MMC_SPI_CMD0_CRC ((0x4a << 1) | 0x1) + static int mmc_spi_command_send(struct mmc_spi_host *host, struct mci_cmd *cmd) { uint8_t r1; @@ -153,7 +144,11 @@ static int mmc_spi_command_send(struct mmc_spi_host *host, struct mci_cmd *cmd) command[3] = cmd->cmdarg >> 16; command[4] = cmd->cmdarg >> 8; command[5] = cmd->cmdarg; +#ifdef CONFIG_MMC_SPI_CRC_ON command[6] = (crc7(0, &command[1], 5) << 1) | 0x01; +#else + command[6] = MMC_SPI_CMD0_CRC; +#endif mmc_spi_writebytes(host, 7, command); -- 1.7.7.1 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] mmc spi: compile fix 2011-11-28 8:40 ` [PATCH 2/2] mmc spi: compile fix Sascha Hauer @ 2011-11-28 8:47 ` Franck JULLIEN 0 siblings, 0 replies; 4+ messages in thread From: Franck JULLIEN @ 2011-11-28 8:47 UTC (permalink / raw) To: Sascha Hauer, barebox 2011/11/28 Sascha Hauer <s.hauer@pengutronix.de>: > Without CRC support the mmc spi driver fails to compile with > the following: > > drivers/mci/mci_spi.c:74:18: error: static declaration of 'crc7' follows non-static declaration > > Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> > --- > drivers/mci/mci_spi.c | 29 ++++++++++++----------------- > 1 files changed, 12 insertions(+), 17 deletions(-) > > diff --git a/drivers/mci/mci_spi.c b/drivers/mci/mci_spi.c > index 124e49b..653910b 100644 > --- a/drivers/mci/mci_spi.c > +++ b/drivers/mci/mci_spi.c > @@ -64,23 +64,6 @@ > #define RTOUT 3000000 /* 1 sec */ > #define WTOUT 3000000 /* 1 sec */ > > -#ifndef CONFIG_MMC_SPI_CRC_ON > -/* Note that while the CRC, in general, is ignored in SPI mode, the very first > - * command must be followed by a valid CRC, since the card is not yet in SPI mode. > - * The CRC byte for a CMD0 command with a zero argument is a constant 0x4A. For > - * simplicity, this CRC byte is always sent with every command. > - */ > - > -static inline u8 crc7(u8 crc, const u8 *buffer, size_t len) > -{ > - /* This is the crc7 value for a CMD0 command with a zero argument. > - * It'll be left shifted and ored with '1' in mmc_spi_command_send > - * to give 0x95 (also known as the CMD0 constant CRC value...) > - */ > - return 0x4A; > -} > -#endif > - > struct mmc_spi_host { > struct mci_host mci; > struct spi_device *spi; > @@ -141,6 +124,14 @@ mmc_spi_writebytes(struct mmc_spi_host *host, unsigned len, void *data) > return status; > } > > +/* > + * Note that while the CRC, in general, is ignored in SPI mode, the very first > + * command must be followed by a valid CRC, since the card is not yet in SPI mode. > + * The CRC byte for a CMD0 command with a zero argument is a constant 0x4A. For > + * simplicity, this CRC byte is always sent with every command. > + */ > +#define MMC_SPI_CMD0_CRC ((0x4a << 1) | 0x1) > + > static int mmc_spi_command_send(struct mmc_spi_host *host, struct mci_cmd *cmd) > { > uint8_t r1; > @@ -153,7 +144,11 @@ static int mmc_spi_command_send(struct mmc_spi_host *host, struct mci_cmd *cmd) > command[3] = cmd->cmdarg >> 16; > command[4] = cmd->cmdarg >> 8; > command[5] = cmd->cmdarg; > +#ifdef CONFIG_MMC_SPI_CRC_ON > command[6] = (crc7(0, &command[1], 5) << 1) | 0x01; > +#else > + command[6] = MMC_SPI_CMD0_CRC; > +#endif > > mmc_spi_writebytes(host, 7, command); > > -- > 1.7.7.1 > Sorry for that one. I did test it but should have missed something.... _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-11-28 8:47 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2011-11-28 8:40 mmc spi fixes Sascha Hauer 2011-11-28 8:40 ` [PATCH 1/2] mmc spi: add missing dependency on SPI Sascha Hauer 2011-11-28 8:40 ` [PATCH 2/2] mmc spi: compile fix Sascha Hauer 2011-11-28 8:47 ` Franck JULLIEN
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox