aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMingjun Zhang <zhang.mingjun@linaro.org>2013-02-02 15:43:38 +0800
committerGuodong Xu <guodong.xu@linaro.org>2013-02-04 10:04:05 +0800
commitbf59a14815c13f58211cb1fb3de6cdc73af2c6a4 (patch)
tree509bff2740e20705536f6a7a37cb798700769732
parent6d4900d8d38d1cf0774235b9f857a21a3a479f4c (diff)
mtd: hs sfc: fix the io reg reading bug
sfc350's io registers don't support byte reading(memcpy may produce byte reading instruction). Using readl instead of memcpy when dealing with the io regsters. Signed-off-by: Mingjun Zhang <zhang.mingjun@linaro.org>
-rw-r--r--drivers/mtd/devices/hs_sfc/hisfc350.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/drivers/mtd/devices/hs_sfc/hisfc350.c b/drivers/mtd/devices/hs_sfc/hisfc350.c
index 252ddb596818..f114a663c314 100644
--- a/drivers/mtd/devices/hs_sfc/hisfc350.c
+++ b/drivers/mtd/devices/hs_sfc/hisfc350.c
@@ -283,6 +283,11 @@ fail:
/*****************************************************************************/
static int hisfc350_read_id(struct hisfc_host *host, u8 cs, u8 *id, int len)
{
+ u32 reg_buf[HISFC350_REG_BUF_SIZE];
+ u8 i, words;
+
+ BUG_ON(len > HISFC350_REG_BUF_SIZE * 4);
+
hisfc_write(HISFC350_CMD_INS, SPI_CMD_RDID);
hisfc_write(HISFC350_CMD_CONFIG,
HISFC350_CMD_CONFIG_SEL_CS(cs)
@@ -293,7 +298,12 @@ static int hisfc350_read_id(struct hisfc_host *host, u8 cs, u8 *id, int len)
hisfc350_wait_cmd_timeout(host);
- memcpy(id, host->io_base + HISFC350_CMD_DATABUF0, len);
+ words = ALIGN(len, 4) / 4;
+
+ for (i = 0; i < words; i++)
+ reg_buf[i] = hisfc_read(HISFC350_CMD_DATABUF0 + i);
+
+ memcpy(id, reg_buf, len);
return 0;
}