diff options
author | Han Xu <han.xu@nxp.com> | 2018-11-15 15:09:00 -0600 |
---|---|---|
committer | Jason Liu <jason.hui.liu@nxp.com> | 2019-02-12 10:35:19 +0800 |
commit | 89b970b19651ade691cc7cc8fb36b6101ef133e5 (patch) | |
tree | 0fe70b3a2aed22ccb2065c150569c7510cda09ec /drivers/mtd | |
parent | 98a20fb305cb467266aede7c67bf7785808f8811 (diff) |
MLK-20388-1: mtd: fsl-flexspi: use ioremap_wc to handle fspi unaligned access
Use ioremap_wc to handle unaligned flexspi AHB read. Remove the previous
SW alignment handle for neat code.
Signed-off-by: Han Xu <han.xu@nxp.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/spi-nor/fsl-flexspi.c | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/drivers/mtd/spi-nor/fsl-flexspi.c b/drivers/mtd/spi-nor/fsl-flexspi.c index 9519749ec441..8e5edb2cce88 100644 --- a/drivers/mtd/spi-nor/fsl-flexspi.c +++ b/drivers/mtd/spi-nor/fsl-flexspi.c @@ -1060,7 +1060,6 @@ static ssize_t fsl_flexspi_read(struct spi_nor *nor, loff_t from, size_t len, u_char *buf) { struct fsl_flexspi *flex = nor->priv; - int i, j; /* if necessary,ioremap buffer before AHB read, */ if (!flex->ahb_addr) { @@ -1068,7 +1067,7 @@ static ssize_t fsl_flexspi_read(struct spi_nor *nor, loff_t from, flex->memmap_len = len > FLEXSPI_MIN_IOMAP ? len : FLEXSPI_MIN_IOMAP; - flex->ahb_addr = ioremap_nocache( + flex->ahb_addr = ioremap_wc( flex->memmap_phy + flex->memmap_offs, flex->memmap_len); if (!flex->ahb_addr) { @@ -1084,7 +1083,7 @@ static ssize_t fsl_flexspi_read(struct spi_nor *nor, loff_t from, flex->memmap_offs = flex->chip_base_addr + from; flex->memmap_len = len > FLEXSPI_MIN_IOMAP ? len : FLEXSPI_MIN_IOMAP; - flex->ahb_addr = ioremap_nocache( + flex->ahb_addr = ioremap_wc( flex->memmap_phy + flex->memmap_offs, flex->memmap_len); if (!flex->ahb_addr) { @@ -1093,20 +1092,8 @@ static ssize_t fsl_flexspi_read(struct spi_nor *nor, loff_t from, } } - /* For non-8-byte alignment cases */ - if (from % 8) { - j = 8 - (from & 0x7); - for (i = 0; i < j; ++i) { - memcpy(buf + i, flex->ahb_addr + flex->chip_base_addr - + from - flex->memmap_offs + i, 1); - } - memcpy(buf + j, flex->ahb_addr + flex->chip_base_addr + from - - flex->memmap_offs + j, len - j); - } else { - /* Read out the data directly from the AHB buffer.*/ - memcpy(buf, flex->ahb_addr + flex->chip_base_addr + from - - flex->memmap_offs, len); - } + memcpy(buf, flex->ahb_addr + flex->chip_base_addr + from + - flex->memmap_offs, len); return len; } |