Commit 4454406e authored by Aaron Sierra's avatar Aaron Sierra Committed by Brian Norris

mtd: fsl_ifc_nand: Use void type for IFC buffer

The IFC buffer is accessed via 8-bit and 16-bit accessors. Changing
the 'addr' member of 'struct fsl_ifc_nand_ctrl' from 'u8 __iomem *' to
'void __iomem *' eliminates the need for explicit casts when the
16-bit accessors are used.
Signed-off-by: default avatarAaron Sierra <asierra@xes-inc.com>
Signed-off-by: default avatarBrian Norris <computersforpeace@gmail.com>
parent 555b8d12
...@@ -56,7 +56,7 @@ struct fsl_ifc_nand_ctrl { ...@@ -56,7 +56,7 @@ struct fsl_ifc_nand_ctrl {
struct nand_hw_control controller; struct nand_hw_control controller;
struct fsl_ifc_mtd *chips[FSL_IFC_BANK_COUNT]; struct fsl_ifc_mtd *chips[FSL_IFC_BANK_COUNT];
u8 __iomem *addr; /* Address of assigned IFC buffer */ void __iomem *addr; /* Address of assigned IFC buffer */
unsigned int page; /* Last page written to / read from */ unsigned int page; /* Last page written to / read from */
unsigned int read_bytes;/* Number of bytes read during command */ unsigned int read_bytes;/* Number of bytes read during command */
unsigned int column; /* Saved column from SEQIN */ unsigned int column; /* Saved column from SEQIN */
...@@ -636,7 +636,7 @@ static void fsl_ifc_write_buf(struct mtd_info *mtd, const u8 *buf, int len) ...@@ -636,7 +636,7 @@ static void fsl_ifc_write_buf(struct mtd_info *mtd, const u8 *buf, int len)
len = bufsize - ifc_nand_ctrl->index; len = bufsize - ifc_nand_ctrl->index;
} }
memcpy_toio(&ifc_nand_ctrl->addr[ifc_nand_ctrl->index], buf, len); memcpy_toio(ifc_nand_ctrl->addr + ifc_nand_ctrl->index, buf, len);
ifc_nand_ctrl->index += len; ifc_nand_ctrl->index += len;
} }
...@@ -648,13 +648,16 @@ static uint8_t fsl_ifc_read_byte(struct mtd_info *mtd) ...@@ -648,13 +648,16 @@ static uint8_t fsl_ifc_read_byte(struct mtd_info *mtd)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd->priv;
struct fsl_ifc_mtd *priv = chip->priv; struct fsl_ifc_mtd *priv = chip->priv;
unsigned int offset;
/* /*
* If there are still bytes in the IFC buffer, then use the * If there are still bytes in the IFC buffer, then use the
* next byte. * next byte.
*/ */
if (ifc_nand_ctrl->index < ifc_nand_ctrl->read_bytes) if (ifc_nand_ctrl->index < ifc_nand_ctrl->read_bytes) {
return in_8(&ifc_nand_ctrl->addr[ifc_nand_ctrl->index++]); offset = ifc_nand_ctrl->index++;
return in_8(ifc_nand_ctrl->addr + offset);
}
dev_err(priv->dev, "%s: beyond end of buffer\n", __func__); dev_err(priv->dev, "%s: beyond end of buffer\n", __func__);
return ERR_BYTE; return ERR_BYTE;
...@@ -675,8 +678,7 @@ static uint8_t fsl_ifc_read_byte16(struct mtd_info *mtd) ...@@ -675,8 +678,7 @@ static uint8_t fsl_ifc_read_byte16(struct mtd_info *mtd)
* next byte. * next byte.
*/ */
if (ifc_nand_ctrl->index < ifc_nand_ctrl->read_bytes) { if (ifc_nand_ctrl->index < ifc_nand_ctrl->read_bytes) {
data = in_be16((uint16_t __iomem *)&ifc_nand_ctrl-> data = in_be16(ifc_nand_ctrl->addr + ifc_nand_ctrl->index);
addr[ifc_nand_ctrl->index]);
ifc_nand_ctrl->index += 2; ifc_nand_ctrl->index += 2;
return (uint8_t) data; return (uint8_t) data;
} }
...@@ -701,7 +703,7 @@ static void fsl_ifc_read_buf(struct mtd_info *mtd, u8 *buf, int len) ...@@ -701,7 +703,7 @@ static void fsl_ifc_read_buf(struct mtd_info *mtd, u8 *buf, int len)
avail = min((unsigned int)len, avail = min((unsigned int)len,
ifc_nand_ctrl->read_bytes - ifc_nand_ctrl->index); ifc_nand_ctrl->read_bytes - ifc_nand_ctrl->index);
memcpy_fromio(buf, &ifc_nand_ctrl->addr[ifc_nand_ctrl->index], avail); memcpy_fromio(buf, ifc_nand_ctrl->addr + ifc_nand_ctrl->index, avail);
ifc_nand_ctrl->index += avail; ifc_nand_ctrl->index += avail;
if (len > avail) if (len > avail)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment