mtd/nand/fsl_elbc_nand: workaround for hangs on MPC837X
Subsystems (2)
PATCH 1/1 mtd/nand/fsl_elbc_nand: workaround for hangs on MPC837X
Using current driver on the MPC837X CPUs elbc hangs during nand write. Reading last byte helps though (thanks to Scott Wood for the idea).
--- drivers/mtd/nand/fsl_elbc_nand.c | 12 +++++++++++- 1 files changed, 11 insertions(+), 1 deletions(-)
drivers/mtd/nand/fsl_elbc_nand.c +11 -1
@@ -480,7 +480,7 @@ static void fsl_elbc_write_buf(struct mtd_info *mtd, const u8 *buf, int len)struct fsl_elbc_ctrl *ctrl = priv->ctrl;unsigned int bufsize = mtd->writesize + mtd->oobsize; -if (len <0 ) { +if (len <=0 ) {dev_err (ctrl->dev,"write_buf of %d bytes" , len); ctrl->status =0 ;return ;
@@ -495,6 +495,16 @@ static void fsl_elbc_write_buf(struct mtd_info *mtd, const u8 *buf, int len) }memcpy_toio (&ctrl->addr[ctrl->index], buf, len); +#ifdef CONFIG_PPC_MPC837x +/* +* This is workaround for the weird elbc hangs on the MPC837X CPUs, +* Scott Wood says: "...perhaps difference in how long it takes a +* write to make it through the localbus compared to a write to IMMR +* is causing problems, and sync isn't helping for some reason." +* Reading back the last byte helps though. +*/ +in_8 (&ctrl->addr[ctrl->index] + len -1 ); +#endif ctrl->index += len; }
Signature · 1 line
1.5.2.2
Quoted 4 lines · Anton Vorontsov
drivers/mtd/nand/fsl_elbc_nand.c +0
-0@@ -495,6 +495,16 @@ static void fsl_elbc_write_buf(struct mtd_info *mtd, const u8 *buf, int len) }memcpy_toio (&ctrl->addr[ctrl->index], buf, len);
drivers/mtd/nand/fsl_elbc_nand.c static void fsl_elbc_write_buf(struct mtd_info *mtd, const u8 *buf, int len) · line 507
Quoted 10 lines
drivers/mtd/nand/fsl_elbc_nand.c +10
-0+#ifdef CONFIG_PPC_MPC837x +/* +* This is workaround for the weird elbc hangs on the MPC837X CPUs, +* Scott Wood says: "...perhaps difference in how long it takes a +* write to make it through the localbus compared to a write to IMMR +* is causing problems, and sync isn't helping for some reason." +* Reading back the last byte helps though. +*/ +in_8 (&ctrl->addr[ctrl->index] + len -1 ); +#endif
Let's do it regardless of chip -- odds are the issue exists on all implementations, and it's just a function of what frequencies things are running at.
-Scott
PATCH 1/1 mtd/nand/fsl_elbc_nand: workaround for hangs during nand write [was: Re: [PATCH] mtd/nand/fsl_elbc_nand: workaround for hangs on MPC837X]
Quoted 5 lines · Scott Wood
Quoted 4 lines · Anton Vorontsov
(quoted diff) +0
-0@@ -495,6 +495,16 @@ static void fsl_elbc_write_buf(struct mtd_info *mtd, const u8 *buf, int len) }
Quoted 15 lines
Review static void fsl_elbc_write_buf(struct mtd_info *mtd, · line 508
Quoted 11 lines
(quoted diff) +10
-0memcpy_toio(&ctrl->addr[ctrl->index], buf, len); +#ifdef CONFIG_PPC_MPC837x + /* + * This is workaround for the weird elbc hangs on the MPC837X CPUs, + * Scott Wood says: "...perhaps difference in how long it takes a + * write to make it through the localbus compared to a write to IMMR + * is causing problems, and sync isn't helping for some reason." + * Reading back the last byte helps though. + */ + in_8(&ctrl->addr[ctrl->index] + len - 1); +#endifLet's do it regardless of chip -- odds are the issue exists on all implementations, and it's just a function of what frequencies things are running at.
Ok.
- - - -
From: Anton Vorontsov <[email protected]>
Subject: mtd/nand/fsl_elbc_nand: workaround for hangs during nand write
Using current driver elbc sometimes hangs during nand write. Reading back last byte helps though (thanks to Scott Wood for the idea).
--- drivers/mtd/nand/fsl_elbc_nand.c | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-)
drivers/mtd/nand/fsl_elbc_nand.c +10 -1
@@ -480,7 +480,7 @@ static void fsl_elbc_write_buf(struct mtd_info *mtd, const u8 *buf, int len)struct fsl_elbc_ctrl *ctrl = priv->ctrl;unsigned int bufsize = mtd->writesize + mtd->oobsize; -if (len <0 ) { +if (len <=0 ) {dev_err (ctrl->dev,"write_buf of %d bytes" , len); ctrl->status =0 ;return ;
@@ -495,6 +495,15 @@ static void fsl_elbc_write_buf(struct mtd_info *mtd, const u8 *buf, int len) }memcpy_toio (&ctrl->addr[ctrl->index], buf, len); +/* +* This is workaround for the weird elbc hangs during nand write, +* Scott Wood says: "...perhaps difference in how long it takes a +* write to make it through the localbus compared to a write to IMMR +* is causing problems, and sync isn't helping for some reason." +* Reading back the last byte helps though. +*/ +in_8 (&ctrl->addr[ctrl->index] + len -1 ); + ctrl->index += len; }
Signature · 1 line
1.5.2.2
Re: [PATCH] mtd/nand/fsl_elbc_nand: workaround for hangs during nand write [was: Re: [PATCH] mtd/nand/fsl_elbc_nand: workaround for hangs on MPC837X]
Quoted 7 lines · Anton Vorontsov
From: Anton Vorontsov <[email protected]>
Subject: mtd/nand/fsl_elbc_nand: workaround for hangs during nand writeUsing current driver elbc sometimes hangs during nand write. Reading back last byte helps though (thanks to Scott Wood for the idea).
Signed-off-by Anton Vorontsov <[email protected]>
-Scott