mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Franck Jullien <franck.jullien@gmail.com>
To: barebox@lists.infradead.org
Subject: [PATCH 3/3] [MCI_SPI] Fix endianness error on be target
Date: Thu, 13 Sep 2012 00:28:34 +0200	[thread overview]
Message-ID: <1347488914-7460-3-git-send-email-franck.jullien@gmail.com> (raw)
In-Reply-To: <1347488914-7460-1-git-send-email-franck.jullien@gmail.com>

Use be(xx)_to_cpu function to switch endianness intelligently.

Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
---
 drivers/mci/mci_spi.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/mci/mci_spi.c b/drivers/mci/mci_spi.c
index a659ebb..a771052 100644
--- a/drivers/mci/mci_spi.c
+++ b/drivers/mci/mci_spi.c
@@ -181,7 +181,7 @@ static uint mmc_spi_readdata(struct mmc_spi_host *host, void *xbuf,
 			mmc_spi_readbytes(host, bsize, buf);
 			mmc_spi_readbytes(host, 2, &crc);
 #ifdef CONFIG_MMC_SPI_CRC_ON
-			if (swab16(cyg_crc16(buf, bsize)) != crc) {
+			if (be16_to_cpu(cyg_crc16(buf, bsize)) != crc) {
 				dev_dbg(host->dev, "%s: CRC error\n", __func__);
 				r1 = R1_SPI_COM_CRC;
 				break;
@@ -212,7 +212,7 @@ static uint mmc_spi_writedata(struct mmc_spi_host *host, const void *xbuf,
 
 	while (bcnt--) {
 #ifdef CONFIG_MMC_SPI_CRC_ON
-		crc = swab16(cyg_crc16((u8 *)buf, bsize));
+		crc = be16_to_cpu(cyg_crc16((u8 *)buf, bsize));
 #endif
 		mmc_spi_writebytes(host, 2, tok);
 		mmc_spi_writebytes(host, bsize, (void *)buf);
@@ -291,7 +291,7 @@ static int mmc_spi_request(struct mci_host *mci, struct mci_cmd *cmd, struct mci
 	} else if (cmd->resp_type == MMC_RSP_R2) {
 		r1 = mmc_spi_readdata(host, cmd->response, 1, 16);
 		for (i = 0; i < 4; i++)
-			cmd->response[i] = swab32(cmd->response[i]);
+			cmd->response[i] = be32_to_cpu(cmd->response[i]);
 		dev_dbg(host->dev, "MMC_RSP_R2 -> %x %x %x %x\n", cmd->response[0], cmd->response[1],
 		      cmd->response[2], cmd->response[3]);
 	} else if (!data) {
@@ -299,7 +299,7 @@ static int mmc_spi_request(struct mci_host *mci, struct mci_cmd *cmd, struct mci
 		case SD_CMD_SEND_IF_COND:
 		case MMC_CMD_SPI_READ_OCR:
 			mmc_spi_readbytes(host, 4, cmd->response);
-			cmd->response[0] = swab32(cmd->response[0]);
+			cmd->response[0] = be32_to_cpu(cmd->response[0]);
 			break;
 		}
 	} else {
-- 
1.7.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2012-09-12 22:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-12 22:28 [PATCH 1/3] [OpenRISC] Add __ashrdi3 and remove link to libgcc Franck Jullien
2012-09-12 22:28 ` [PATCH 2/3] Add OpenRISC Image type Franck Jullien
2012-09-12 22:28 ` Franck Jullien [this message]
2012-09-14  6:40 ` [PATCH 1/3] [OpenRISC] Add __ashrdi3 and remove link to libgcc Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1347488914-7460-3-git-send-email-franck.jullien@gmail.com \
    --to=franck.jullien@gmail.com \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox