nftlcore.c (191876729901d0c8dab8a331f9a1e4b73a56457b) nftlcore.c (7014568bad55c20b7ee4f439d78c9e875912d51f)
1/* Linux driver for NAND Flash Translation Layer */
2/* (c) 1999 Machine Vision Holdings, Inc. */
3/* Author: David Woodhouse <dwmw2@infradead.org> */
4/* $Id: nftlcore.c,v 1.98 2005/11/07 11:14:21 gleixner Exp $ */
5
6/*
7 The contents of this file are distributed under the GNU General
8 Public License version 2. The author places no additional

--- 133 unchanged lines hidden (view full) ---

142 struct mtd_oob_ops ops;
143 int res;
144
145 ops.mode = MTD_OOB_PLACE;
146 ops.ooboffs = offs & (mtd->writesize - 1);
147 ops.ooblen = len;
148 ops.oobbuf = buf;
149 ops.datbuf = NULL;
1/* Linux driver for NAND Flash Translation Layer */
2/* (c) 1999 Machine Vision Holdings, Inc. */
3/* Author: David Woodhouse <dwmw2@infradead.org> */
4/* $Id: nftlcore.c,v 1.98 2005/11/07 11:14:21 gleixner Exp $ */
5
6/*
7 The contents of this file are distributed under the GNU General
8 Public License version 2. The author places no additional

--- 133 unchanged lines hidden (view full) ---

142 struct mtd_oob_ops ops;
143 int res;
144
145 ops.mode = MTD_OOB_PLACE;
146 ops.ooboffs = offs & (mtd->writesize - 1);
147 ops.ooblen = len;
148 ops.oobbuf = buf;
149 ops.datbuf = NULL;
150 ops.len = len;
151
152 res = mtd->read_oob(mtd, offs & ~(mtd->writesize - 1), &ops);
150
151 res = mtd->read_oob(mtd, offs & ~(mtd->writesize - 1), &ops);
153 *retlen = ops.retlen;
152 *retlen = ops.oobretlen;
154 return res;
155}
156
157/*
158 * Write oob data to flash
159 */
160int nftl_write_oob(struct mtd_info *mtd, loff_t offs, size_t len,
161 size_t *retlen, uint8_t *buf)
162{
163 struct mtd_oob_ops ops;
164 int res;
165
166 ops.mode = MTD_OOB_PLACE;
167 ops.ooboffs = offs & (mtd->writesize - 1);
168 ops.ooblen = len;
169 ops.oobbuf = buf;
170 ops.datbuf = NULL;
153 return res;
154}
155
156/*
157 * Write oob data to flash
158 */
159int nftl_write_oob(struct mtd_info *mtd, loff_t offs, size_t len,
160 size_t *retlen, uint8_t *buf)
161{
162 struct mtd_oob_ops ops;
163 int res;
164
165 ops.mode = MTD_OOB_PLACE;
166 ops.ooboffs = offs & (mtd->writesize - 1);
167 ops.ooblen = len;
168 ops.oobbuf = buf;
169 ops.datbuf = NULL;
171 ops.len = len;
172
173 res = mtd->write_oob(mtd, offs & ~(mtd->writesize - 1), &ops);
170
171 res = mtd->write_oob(mtd, offs & ~(mtd->writesize - 1), &ops);
174 *retlen = ops.retlen;
172 *retlen = ops.oobretlen;
175 return res;
176}
177
178#ifdef CONFIG_NFTL_RW
179
180/*
181 * Write data and oob to flash
182 */

--- 648 unchanged lines hidden ---
173 return res;
174}
175
176#ifdef CONFIG_NFTL_RW
177
178/*
179 * Write data and oob to flash
180 */

--- 648 unchanged lines hidden ---