aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/mtd/onenand/onenand_base.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c
index 67efbc70019..eb94d949644 100644
--- a/drivers/mtd/onenand/onenand_base.c
+++ b/drivers/mtd/onenand/onenand_base.c
@@ -810,8 +810,7 @@ static int onenand_transfer_auto_oob(struct mtd_info *mtd, uint8_t *buf, int col
810 readend += free->offset - lastgap; 810 readend += free->offset - lastgap;
811 lastgap = free->offset + free->length; 811 lastgap = free->offset + free->length;
812 } 812 }
813 this->read_bufferram(mtd, ONENAND_SPARERAM, oob_buf + readcol, 813 this->read_bufferram(mtd, ONENAND_SPARERAM, oob_buf, 0, mtd->oobsize);
814 readcol, readend - readcol);
815 for (free = this->ecclayout->oobfree; free->length; ++free) { 814 for (free = this->ecclayout->oobfree; free->length; ++free) {
816 int free_end = free->offset + free->length; 815 int free_end = free->offset + free->length;
817 if (free->offset < readend && free_end > readcol) { 816 if (free->offset < readend && free_end > readcol) {
@@ -926,13 +925,12 @@ out:
926static int onenand_read_oob(struct mtd_info *mtd, loff_t from, 925static int onenand_read_oob(struct mtd_info *mtd, loff_t from,
927 struct mtd_oob_ops *ops) 926 struct mtd_oob_ops *ops)
928{ 927{
929 switch (ops->mode) 928 switch (ops->mode) {
930 {
931 case MTD_OOB_PLACE: 929 case MTD_OOB_PLACE:
932 case MTD_OOB_AUTO: 930 case MTD_OOB_AUTO:
933 break; 931 break;
934 case MTD_OOB_RAW: 932 case MTD_OOB_RAW:
935 return -EINVAL; /* Not implemented yet */ 933 /* Not implemented yet */
936 default: 934 default:
937 return -EINVAL; 935 return -EINVAL;
938 } 936 }
@@ -1143,7 +1141,6 @@ static int onenand_fill_auto_oob(struct mtd_info *mtd, u_char *oob_buf,
1143 writeend += free->offset - lastgap; 1141 writeend += free->offset - lastgap;
1144 lastgap = free->offset + free->length; 1142 lastgap = free->offset + free->length;
1145 } 1143 }
1146 writeend = mtd->oobsize;
1147 for (free = this->ecclayout->oobfree; free->length; ++free) { 1144 for (free = this->ecclayout->oobfree; free->length; ++free) {
1148 int free_end = free->offset + free->length; 1145 int free_end = free->offset + free->length;
1149 if (free->offset < writeend && free_end > writecol) { 1146 if (free->offset < writeend && free_end > writecol) {
@@ -1264,13 +1261,12 @@ out:
1264static int onenand_write_oob(struct mtd_info *mtd, loff_t to, 1261static int onenand_write_oob(struct mtd_info *mtd, loff_t to,
1265 struct mtd_oob_ops *ops) 1262 struct mtd_oob_ops *ops)
1266{ 1263{
1267 switch (ops->mode) 1264 switch (ops->mode) {
1268 {
1269 case MTD_OOB_PLACE: 1265 case MTD_OOB_PLACE:
1270 case MTD_OOB_AUTO: 1266 case MTD_OOB_AUTO:
1271 break; 1267 break;
1272 case MTD_OOB_RAW: 1268 case MTD_OOB_RAW:
1273 return -EINVAL; /* Not implemented yet */ 1269 /* Not implemented yet */
1274 default: 1270 default:
1275 return -EINVAL; 1271 return -EINVAL;
1276 } 1272 }