summaryrefslogtreecommitdiff
path: root/drivers/mtd/nand/nand_spl_simple.c
diff options
context:
space:
mode:
authorScott Wood <oss@buserror.net>2016-05-30 13:57:56 -0500
committerScott Wood <oss@buserror.net>2016-06-03 20:27:48 -0500
commit17cb4b8f327eb983cef7c510fcf77f1635a00e48 (patch)
treebbe2c31df8189cfb1e02a60e6ca803509169f71d /drivers/mtd/nand/nand_spl_simple.c
parentb616d9b0a708eb90eb474e1b6ec6dfe4c48a1678 (diff)
downloadu-boot-imx-17cb4b8f327eb983cef7c510fcf77f1635a00e48.zip
u-boot-imx-17cb4b8f327eb983cef7c510fcf77f1635a00e48.tar.gz
u-boot-imx-17cb4b8f327eb983cef7c510fcf77f1635a00e48.tar.bz2
mtd: nand: Add+use mtd_to/from_nand and nand_get/set_controller_data
These functions are part of the Linux 4.6 sync. They are being added before the main sync patch in order to make it easier to address the issue across all NAND drivers (many/most of which do not closely track their Linux counterparts) separately from other merge issues. Signed-off-by: Scott Wood <oss@buserror.net>
Diffstat (limited to 'drivers/mtd/nand/nand_spl_simple.c')
-rw-r--r--drivers/mtd/nand/nand_spl_simple.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/mtd/nand/nand_spl_simple.c b/drivers/mtd/nand/nand_spl_simple.c
index bc6a09a..b023e00 100644
--- a/drivers/mtd/nand/nand_spl_simple.c
+++ b/drivers/mtd/nand/nand_spl_simple.c
@@ -26,7 +26,7 @@ static struct nand_chip nand_chip;
static int nand_command(int block, int page, uint32_t offs,
u8 cmd)
{
- struct nand_chip *this = mtd->priv();
+ struct nand_chip *this = mtd_to_nand(mtd);
int page_addr = page + block * CONFIG_SYS_NAND_PAGE_COUNT;
while (!this->dev_ready(mtd))
@@ -63,7 +63,7 @@ static int nand_command(int block, int page, uint32_t offs,
static int nand_command(int block, int page, uint32_t offs,
u8 cmd)
{
- struct nand_chip *this = mtd->priv;
+ struct nand_chip *this = mtd_to_nand(mtd);
int page_addr = page + block * CONFIG_SYS_NAND_PAGE_COUNT;
void (*hwctrl)(struct mtd_info *mtd, int cmd,
unsigned int ctrl) = this->cmd_ctrl;
@@ -114,7 +114,7 @@ static int nand_command(int block, int page, uint32_t offs,
static int nand_is_bad_block(int block)
{
- struct nand_chip *this = mtd->priv;
+ struct nand_chip *this = mtd_to_nand(mtd);
u_char bb_data[2];
nand_command(block, 0, CONFIG_SYS_NAND_BAD_BLOCK_POS,
@@ -139,7 +139,7 @@ static int nand_is_bad_block(int block)
#if defined(CONFIG_SYS_NAND_HW_ECC_OOBFIRST)
static int nand_read_page(int block, int page, uchar *dst)
{
- struct nand_chip *this = mtd->priv;
+ struct nand_chip *this = mtd_to_nand(mtd);
u_char ecc_calc[ECCTOTAL];
u_char ecc_code[ECCTOTAL];
u_char oob_data[CONFIG_SYS_NAND_OOBSIZE];
@@ -170,7 +170,7 @@ static int nand_read_page(int block, int page, uchar *dst)
#else
static int nand_read_page(int block, int page, void *dst)
{
- struct nand_chip *this = mtd->priv;
+ struct nand_chip *this = mtd_to_nand(mtd);
u_char ecc_calc[ECCTOTAL];
u_char ecc_code[ECCTOTAL];
u_char oob_data[CONFIG_SYS_NAND_OOBSIZE];
@@ -250,7 +250,6 @@ void nand_init(void)
* Init board specific nand support
*/
mtd = &nand_chip.mtd;
- mtd->priv = &nand_chip;
nand_chip.IO_ADDR_R = nand_chip.IO_ADDR_W =
(void __iomem *)CONFIG_SYS_NAND_BASE;
board_nand_init(&nand_chip);