2 * Flash NAND memory emulation. Based on "16M x 8 Bit NAND Flash
3 * Memory" datasheet for the KM29U128AT / K9F2808U0A chips from
6 * Copyright (c) 2006 Openedhand Ltd.
7 * Written by Andrzej Zaborowski <balrog@zabor.org>
9 * This code is licensed under the GNU GPL v2.
16 # include "blockdev.h"
17 /* FIXME: Pass block device as an argument. */
19 # define NAND_CMD_READ0 0x00
20 # define NAND_CMD_READ1 0x01
21 # define NAND_CMD_READ2 0x50
22 # define NAND_CMD_LPREAD2 0x30
23 # define NAND_CMD_NOSERIALREAD2 0x35
24 # define NAND_CMD_RANDOMREAD1 0x05
25 # define NAND_CMD_RANDOMREAD2 0xe0
26 # define NAND_CMD_READID 0x90
27 # define NAND_CMD_RESET 0xff
28 # define NAND_CMD_PAGEPROGRAM1 0x80
29 # define NAND_CMD_PAGEPROGRAM2 0x10
30 # define NAND_CMD_CACHEPROGRAM2 0x15
31 # define NAND_CMD_BLOCKERASE1 0x60
32 # define NAND_CMD_BLOCKERASE2 0xd0
33 # define NAND_CMD_READSTATUS 0x70
34 # define NAND_CMD_COPYBACKPRG1 0x85
36 # define NAND_IOSTATUS_ERROR (1 << 0)
37 # define NAND_IOSTATUS_PLANE0 (1 << 1)
38 # define NAND_IOSTATUS_PLANE1 (1 << 2)
39 # define NAND_IOSTATUS_PLANE2 (1 << 3)
40 # define NAND_IOSTATUS_PLANE3 (1 << 4)
41 # define NAND_IOSTATUS_BUSY (1 << 6)
42 # define NAND_IOSTATUS_UNPROTCT (1 << 7)
44 # define MAX_PAGE 0x800
47 struct NANDFlashState
{
48 uint8_t manf_id
, chip_id
;
50 int page_shift
, oob_shift
, erase_shift
, addr_shift
;
52 BlockDriverState
*bdrv
;
55 uint8_t cle
, ale
, ce
, wp
, gnd
;
57 uint8_t io
[MAX_PAGE
+ MAX_OOB
+ 0x400];
66 void (*blk_write
)(NANDFlashState
*s
);
67 void (*blk_erase
)(NANDFlashState
*s
);
68 void (*blk_load
)(NANDFlashState
*s
, uint32_t addr
, int offset
);
70 uint32_t ioaddr_vmstate
;
73 # define NAND_NO_AUTOINCR 0x00000001
74 # define NAND_BUSWIDTH_16 0x00000002
75 # define NAND_NO_PADDING 0x00000004
76 # define NAND_CACHEPRG 0x00000008
77 # define NAND_COPYBACK 0x00000010
78 # define NAND_IS_AND 0x00000020
79 # define NAND_4PAGE_ARRAY 0x00000040
80 # define NAND_NO_READRDY 0x00000100
81 # define NAND_SAMSUNG_LP (NAND_NO_PADDING | NAND_COPYBACK)
85 # define PAGE(addr) ((addr) >> ADDR_SHIFT)
86 # define PAGE_START(page) (PAGE(page) * (PAGE_SIZE + OOB_SIZE))
87 # define PAGE_MASK ((1 << ADDR_SHIFT) - 1)
88 # define OOB_SHIFT (PAGE_SHIFT - 5)
89 # define OOB_SIZE (1 << OOB_SHIFT)
90 # define SECTOR(addr) ((addr) >> (9 + ADDR_SHIFT - PAGE_SHIFT))
91 # define SECTOR_OFFSET(addr) ((addr) & ((511 >> PAGE_SHIFT) << 8))
93 # define PAGE_SIZE 256
95 # define PAGE_SECTORS 1
98 # define PAGE_SIZE 512
100 # define PAGE_SECTORS 1
101 # define ADDR_SHIFT 8
103 # define PAGE_SIZE 2048
104 # define PAGE_SHIFT 11
105 # define PAGE_SECTORS 4
106 # define ADDR_SHIFT 16
109 /* Information based on Linux drivers/mtd/nand/nand_ids.c */
110 static const struct {
116 } nand_flash_ids
[0x100] = {
117 [0 ... 0xff] = { 0 },
119 [0x6e] = { 1, 8, 8, 4, 0 },
120 [0x64] = { 2, 8, 8, 4, 0 },
121 [0x6b] = { 4, 8, 9, 4, 0 },
122 [0xe8] = { 1, 8, 8, 4, 0 },
123 [0xec] = { 1, 8, 8, 4, 0 },
124 [0xea] = { 2, 8, 8, 4, 0 },
125 [0xd5] = { 4, 8, 9, 4, 0 },
126 [0xe3] = { 4, 8, 9, 4, 0 },
127 [0xe5] = { 4, 8, 9, 4, 0 },
128 [0xd6] = { 8, 8, 9, 4, 0 },
130 [0x39] = { 8, 8, 9, 4, 0 },
131 [0xe6] = { 8, 8, 9, 4, 0 },
132 [0x49] = { 8, 16, 9, 4, NAND_BUSWIDTH_16
},
133 [0x59] = { 8, 16, 9, 4, NAND_BUSWIDTH_16
},
135 [0x33] = { 16, 8, 9, 5, 0 },
136 [0x73] = { 16, 8, 9, 5, 0 },
137 [0x43] = { 16, 16, 9, 5, NAND_BUSWIDTH_16
},
138 [0x53] = { 16, 16, 9, 5, NAND_BUSWIDTH_16
},
140 [0x35] = { 32, 8, 9, 5, 0 },
141 [0x75] = { 32, 8, 9, 5, 0 },
142 [0x45] = { 32, 16, 9, 5, NAND_BUSWIDTH_16
},
143 [0x55] = { 32, 16, 9, 5, NAND_BUSWIDTH_16
},
145 [0x36] = { 64, 8, 9, 5, 0 },
146 [0x76] = { 64, 8, 9, 5, 0 },
147 [0x46] = { 64, 16, 9, 5, NAND_BUSWIDTH_16
},
148 [0x56] = { 64, 16, 9, 5, NAND_BUSWIDTH_16
},
150 [0x78] = { 128, 8, 9, 5, 0 },
151 [0x39] = { 128, 8, 9, 5, 0 },
152 [0x79] = { 128, 8, 9, 5, 0 },
153 [0x72] = { 128, 16, 9, 5, NAND_BUSWIDTH_16
},
154 [0x49] = { 128, 16, 9, 5, NAND_BUSWIDTH_16
},
155 [0x74] = { 128, 16, 9, 5, NAND_BUSWIDTH_16
},
156 [0x59] = { 128, 16, 9, 5, NAND_BUSWIDTH_16
},
158 [0x71] = { 256, 8, 9, 5, 0 },
161 * These are the new chips with large page size. The pagesize and the
162 * erasesize is determined from the extended id bytes
164 # define LP_OPTIONS (NAND_SAMSUNG_LP | NAND_NO_READRDY | NAND_NO_AUTOINCR)
165 # define LP_OPTIONS16 (LP_OPTIONS | NAND_BUSWIDTH_16)
168 [0xa2] = { 64, 8, 0, 0, LP_OPTIONS
},
169 [0xf2] = { 64, 8, 0, 0, LP_OPTIONS
},
170 [0xb2] = { 64, 16, 0, 0, LP_OPTIONS16
},
171 [0xc2] = { 64, 16, 0, 0, LP_OPTIONS16
},
174 [0xa1] = { 128, 8, 0, 0, LP_OPTIONS
},
175 [0xf1] = { 128, 8, 0, 0, LP_OPTIONS
},
176 [0xb1] = { 128, 16, 0, 0, LP_OPTIONS16
},
177 [0xc1] = { 128, 16, 0, 0, LP_OPTIONS16
},
180 [0xaa] = { 256, 8, 0, 0, LP_OPTIONS
},
181 [0xda] = { 256, 8, 0, 0, LP_OPTIONS
},
182 [0xba] = { 256, 16, 0, 0, LP_OPTIONS16
},
183 [0xca] = { 256, 16, 0, 0, LP_OPTIONS16
},
186 [0xac] = { 512, 8, 0, 0, LP_OPTIONS
},
187 [0xdc] = { 512, 8, 0, 0, LP_OPTIONS
},
188 [0xbc] = { 512, 16, 0, 0, LP_OPTIONS16
},
189 [0xcc] = { 512, 16, 0, 0, LP_OPTIONS16
},
192 [0xa3] = { 1024, 8, 0, 0, LP_OPTIONS
},
193 [0xd3] = { 1024, 8, 0, 0, LP_OPTIONS
},
194 [0xb3] = { 1024, 16, 0, 0, LP_OPTIONS16
},
195 [0xc3] = { 1024, 16, 0, 0, LP_OPTIONS16
},
198 [0xa5] = { 2048, 8, 0, 0, LP_OPTIONS
},
199 [0xd5] = { 2048, 8, 0, 0, LP_OPTIONS
},
200 [0xb5] = { 2048, 16, 0, 0, LP_OPTIONS16
},
201 [0xc5] = { 2048, 16, 0, 0, LP_OPTIONS16
},
204 static void nand_reset(NANDFlashState
*s
)
206 s
->cmd
= NAND_CMD_READ0
;
211 s
->status
&= NAND_IOSTATUS_UNPROTCT
;
214 static void nand_command(NANDFlashState
*s
)
222 case NAND_CMD_READID
:
223 s
->io
[0] = s
->manf_id
;
224 s
->io
[1] = s
->chip_id
;
225 s
->io
[2] = 'Q'; /* Don't-care byte (often 0xa5) */
226 if (nand_flash_ids
[s
->chip_id
].options
& NAND_SAMSUNG_LP
)
227 s
->io
[3] = 0x15; /* Page Size, Block Size, Spare Size.. */
229 s
->io
[3] = 0xc0; /* Multi-plane */
234 case NAND_CMD_RANDOMREAD2
:
235 case NAND_CMD_NOSERIALREAD2
:
236 if (!(nand_flash_ids
[s
->chip_id
].options
& NAND_SAMSUNG_LP
))
238 offset
= s
->addr
& ((1 << s
->addr_shift
) - 1);
239 s
->blk_load(s
, s
->addr
, offset
);
241 s
->iolen
= (1 << s
->page_shift
) - offset
;
243 s
->iolen
= (1 << s
->page_shift
) + (1 << s
->oob_shift
) - offset
;
250 case NAND_CMD_PAGEPROGRAM1
:
255 case NAND_CMD_PAGEPROGRAM2
:
261 case NAND_CMD_BLOCKERASE1
:
264 case NAND_CMD_BLOCKERASE2
:
265 if (nand_flash_ids
[s
->chip_id
].options
& NAND_SAMSUNG_LP
)
275 case NAND_CMD_READSTATUS
:
276 s
->io
[0] = s
->status
;
282 printf("%s: Unknown NAND command 0x%02x\n", __FUNCTION__
, s
->cmd
);
286 static void nand_pre_save(void *opaque
)
288 NANDFlashState
*s
= opaque
;
290 s
->ioaddr_vmstate
= s
->ioaddr
- s
->io
;
293 static int nand_post_load(void *opaque
, int version_id
)
295 NANDFlashState
*s
= opaque
;
297 if (s
->ioaddr_vmstate
> sizeof(s
->io
)) {
300 s
->ioaddr
= s
->io
+ s
->ioaddr_vmstate
;
305 static const VMStateDescription vmstate_nand
= {
308 .minimum_version_id
= 0,
309 .minimum_version_id_old
= 0,
310 .pre_save
= nand_pre_save
,
311 .post_load
= nand_post_load
,
312 .fields
= (VMStateField
[]) {
313 VMSTATE_UINT8(cle
, NANDFlashState
),
314 VMSTATE_UINT8(ale
, NANDFlashState
),
315 VMSTATE_UINT8(ce
, NANDFlashState
),
316 VMSTATE_UINT8(wp
, NANDFlashState
),
317 VMSTATE_UINT8(gnd
, NANDFlashState
),
318 VMSTATE_BUFFER(io
, NANDFlashState
),
319 VMSTATE_UINT32(ioaddr_vmstate
, NANDFlashState
),
320 VMSTATE_INT32(iolen
, NANDFlashState
),
321 VMSTATE_UINT32(cmd
, NANDFlashState
),
322 VMSTATE_UINT32(addr
, NANDFlashState
),
323 VMSTATE_INT32(addrlen
, NANDFlashState
),
324 VMSTATE_INT32(status
, NANDFlashState
),
325 VMSTATE_INT32(offset
, NANDFlashState
),
326 /* XXX: do we want to save s->storage too? */
327 VMSTATE_END_OF_LIST()
332 * Chip inputs are CLE, ALE, CE, WP, GND and eight I/O pins. Chip
333 * outputs are R/B and eight I/O pins.
335 * CE, WP and R/B are active low.
337 void nand_setpins(NANDFlashState
*s
, uint8_t cle
, uint8_t ale
,
338 uint8_t ce
, uint8_t wp
, uint8_t gnd
)
346 s
->status
|= NAND_IOSTATUS_UNPROTCT
;
348 s
->status
&= ~NAND_IOSTATUS_UNPROTCT
;
351 void nand_getpins(NANDFlashState
*s
, int *rb
)
356 void nand_setio(NANDFlashState
*s
, uint8_t value
)
358 if (!s
->ce
&& s
->cle
) {
359 if (nand_flash_ids
[s
->chip_id
].options
& NAND_SAMSUNG_LP
) {
360 if (s
->cmd
== NAND_CMD_READ0
&& value
== NAND_CMD_LPREAD2
)
362 if (value
== NAND_CMD_RANDOMREAD1
) {
363 s
->addr
&= ~((1 << s
->addr_shift
) - 1);
368 if (value
== NAND_CMD_READ0
)
370 else if (value
== NAND_CMD_READ1
) {
372 value
= NAND_CMD_READ0
;
374 else if (value
== NAND_CMD_READ2
) {
375 s
->offset
= 1 << s
->page_shift
;
376 value
= NAND_CMD_READ0
;
381 if (s
->cmd
== NAND_CMD_READSTATUS
||
382 s
->cmd
== NAND_CMD_PAGEPROGRAM2
||
383 s
->cmd
== NAND_CMD_BLOCKERASE1
||
384 s
->cmd
== NAND_CMD_BLOCKERASE2
||
385 s
->cmd
== NAND_CMD_NOSERIALREAD2
||
386 s
->cmd
== NAND_CMD_RANDOMREAD2
||
387 s
->cmd
== NAND_CMD_RESET
)
390 if (s
->cmd
!= NAND_CMD_RANDOMREAD2
) {
396 unsigned int shift
= s
->addrlen
* 8;
397 unsigned int mask
= ~(0xff << shift
);
398 unsigned int v
= value
<< shift
;
400 s
->addr
= (s
->addr
& mask
) | v
;
403 if (s
->addrlen
== 1 && s
->cmd
== NAND_CMD_READID
)
406 if (!(nand_flash_ids
[s
->chip_id
].options
& NAND_SAMSUNG_LP
) &&
408 s
->cmd
== NAND_CMD_READ0
||
409 s
->cmd
== NAND_CMD_PAGEPROGRAM1
))
411 if ((nand_flash_ids
[s
->chip_id
].options
& NAND_SAMSUNG_LP
) &&
413 s
->cmd
== NAND_CMD_READ0
||
414 s
->cmd
== NAND_CMD_PAGEPROGRAM1
))
418 if (!s
->cle
&& !s
->ale
&& s
->cmd
== NAND_CMD_PAGEPROGRAM1
) {
419 if (s
->iolen
< (1 << s
->page_shift
) + (1 << s
->oob_shift
))
420 s
->io
[s
->iolen
++] = value
;
421 } else if (!s
->cle
&& !s
->ale
&& s
->cmd
== NAND_CMD_COPYBACKPRG1
) {
422 if ((s
->addr
& ((1 << s
->addr_shift
) - 1)) <
423 (1 << s
->page_shift
) + (1 << s
->oob_shift
)) {
424 s
->io
[s
->iolen
+ (s
->addr
& ((1 << s
->addr_shift
) - 1))] = value
;
430 uint8_t nand_getio(NANDFlashState
*s
)
434 /* Allow sequential reading */
435 if (!s
->iolen
&& s
->cmd
== NAND_CMD_READ0
) {
436 offset
= (s
->addr
& ((1 << s
->addr_shift
) - 1)) + s
->offset
;
439 s
->blk_load(s
, s
->addr
, offset
);
441 s
->iolen
= (1 << s
->page_shift
) - offset
;
443 s
->iolen
= (1 << s
->page_shift
) + (1 << s
->oob_shift
) - offset
;
446 if (s
->ce
|| s
->iolen
<= 0)
451 return *(s
->ioaddr
++);
454 NANDFlashState
*nand_init(int manf_id
, int chip_id
)
460 if (nand_flash_ids
[chip_id
].size
== 0) {
461 hw_error("%s: Unsupported NAND chip ID.\n", __FUNCTION__
);
464 s
= (NANDFlashState
*) qemu_mallocz(sizeof(NANDFlashState
));
465 dinfo
= drive_get(IF_MTD
, 0, 0);
467 s
->bdrv
= dinfo
->bdrv
;
468 s
->manf_id
= manf_id
;
469 s
->chip_id
= chip_id
;
470 s
->size
= nand_flash_ids
[s
->chip_id
].size
<< 20;
471 if (nand_flash_ids
[s
->chip_id
].options
& NAND_SAMSUNG_LP
) {
475 s
->page_shift
= nand_flash_ids
[s
->chip_id
].page_shift
;
476 s
->erase_shift
= nand_flash_ids
[s
->chip_id
].erase_shift
;
479 switch (1 << s
->page_shift
) {
490 hw_error("%s: Unsupported NAND block size.\n", __FUNCTION__
);
493 pagesize
= 1 << s
->oob_shift
;
495 if (s
->bdrv
&& bdrv_getlength(s
->bdrv
) >=
496 (s
->pages
<< s
->page_shift
) + (s
->pages
<< s
->oob_shift
)) {
502 pagesize
+= 1 << s
->page_shift
;
504 s
->storage
= (uint8_t *) memset(qemu_malloc(s
->pages
* pagesize
),
505 0xff, s
->pages
* pagesize
);
506 /* Give s->ioaddr a sane value in case we save state before it
510 vmstate_register(NULL
, -1, &vmstate_nand
, s
);
515 void nand_done(NANDFlashState
*s
)
519 bdrv_delete(s
->bdrv
);
522 if (!s
->bdrv
|| s
->mem_oob
)
523 qemu_free(s
->storage
);
530 /* Program a single page */
531 static void glue(nand_blk_write_
, PAGE_SIZE
)(NANDFlashState
*s
)
533 uint32_t off
, page
, sector
, soff
;
534 uint8_t iobuf
[(PAGE_SECTORS
+ 2) * 0x200];
535 if (PAGE(s
->addr
) >= s
->pages
)
539 memcpy(s
->storage
+ PAGE_START(s
->addr
) + (s
->addr
& PAGE_MASK
) +
540 s
->offset
, s
->io
, s
->iolen
);
541 } else if (s
->mem_oob
) {
542 sector
= SECTOR(s
->addr
);
543 off
= (s
->addr
& PAGE_MASK
) + s
->offset
;
544 soff
= SECTOR_OFFSET(s
->addr
);
545 if (bdrv_read(s
->bdrv
, sector
, iobuf
, PAGE_SECTORS
) == -1) {
546 printf("%s: read error in sector %i\n", __FUNCTION__
, sector
);
550 memcpy(iobuf
+ (soff
| off
), s
->io
, MIN(s
->iolen
, PAGE_SIZE
- off
));
551 if (off
+ s
->iolen
> PAGE_SIZE
) {
552 page
= PAGE(s
->addr
);
553 memcpy(s
->storage
+ (page
<< OOB_SHIFT
), s
->io
+ PAGE_SIZE
- off
,
554 MIN(OOB_SIZE
, off
+ s
->iolen
- PAGE_SIZE
));
557 if (bdrv_write(s
->bdrv
, sector
, iobuf
, PAGE_SECTORS
) == -1)
558 printf("%s: write error in sector %i\n", __FUNCTION__
, sector
);
560 off
= PAGE_START(s
->addr
) + (s
->addr
& PAGE_MASK
) + s
->offset
;
563 if (bdrv_read(s
->bdrv
, sector
, iobuf
, PAGE_SECTORS
+ 2) == -1) {
564 printf("%s: read error in sector %i\n", __FUNCTION__
, sector
);
568 memcpy(iobuf
+ soff
, s
->io
, s
->iolen
);
570 if (bdrv_write(s
->bdrv
, sector
, iobuf
, PAGE_SECTORS
+ 2) == -1)
571 printf("%s: write error in sector %i\n", __FUNCTION__
, sector
);
576 /* Erase a single block */
577 static void glue(nand_blk_erase_
, PAGE_SIZE
)(NANDFlashState
*s
)
579 uint32_t i
, page
, addr
;
580 uint8_t iobuf
[0x200] = { [0 ... 0x1ff] = 0xff, };
581 addr
= s
->addr
& ~((1 << (ADDR_SHIFT
+ s
->erase_shift
)) - 1);
583 if (PAGE(addr
) >= s
->pages
)
587 memset(s
->storage
+ PAGE_START(addr
),
588 0xff, (PAGE_SIZE
+ OOB_SIZE
) << s
->erase_shift
);
589 } else if (s
->mem_oob
) {
590 memset(s
->storage
+ (PAGE(addr
) << OOB_SHIFT
),
591 0xff, OOB_SIZE
<< s
->erase_shift
);
593 page
= SECTOR(addr
+ (ADDR_SHIFT
+ s
->erase_shift
));
594 for (; i
< page
; i
++)
595 if (bdrv_write(s
->bdrv
, i
, iobuf
, 1) == -1)
596 printf("%s: write error in sector %i\n", __FUNCTION__
, i
);
598 addr
= PAGE_START(addr
);
600 if (bdrv_read(s
->bdrv
, page
, iobuf
, 1) == -1)
601 printf("%s: read error in sector %i\n", __FUNCTION__
, page
);
602 memset(iobuf
+ (addr
& 0x1ff), 0xff, (~addr
& 0x1ff) + 1);
603 if (bdrv_write(s
->bdrv
, page
, iobuf
, 1) == -1)
604 printf("%s: write error in sector %i\n", __FUNCTION__
, page
);
606 memset(iobuf
, 0xff, 0x200);
607 i
= (addr
& ~0x1ff) + 0x200;
608 for (addr
+= ((PAGE_SIZE
+ OOB_SIZE
) << s
->erase_shift
) - 0x200;
609 i
< addr
; i
+= 0x200)
610 if (bdrv_write(s
->bdrv
, i
>> 9, iobuf
, 1) == -1)
611 printf("%s: write error in sector %i\n", __FUNCTION__
, i
>> 9);
614 if (bdrv_read(s
->bdrv
, page
, iobuf
, 1) == -1)
615 printf("%s: read error in sector %i\n", __FUNCTION__
, page
);
616 memset(iobuf
, 0xff, ((addr
- 1) & 0x1ff) + 1);
617 if (bdrv_write(s
->bdrv
, page
, iobuf
, 1) == -1)
618 printf("%s: write error in sector %i\n", __FUNCTION__
, page
);
622 static void glue(nand_blk_load_
, PAGE_SIZE
)(NANDFlashState
*s
,
623 uint32_t addr
, int offset
)
625 if (PAGE(addr
) >= s
->pages
)
630 if (bdrv_read(s
->bdrv
, SECTOR(addr
), s
->io
, PAGE_SECTORS
) == -1)
631 printf("%s: read error in sector %i\n",
632 __FUNCTION__
, SECTOR(addr
));
633 memcpy(s
->io
+ SECTOR_OFFSET(s
->addr
) + PAGE_SIZE
,
634 s
->storage
+ (PAGE(s
->addr
) << OOB_SHIFT
),
636 s
->ioaddr
= s
->io
+ SECTOR_OFFSET(s
->addr
) + offset
;
638 if (bdrv_read(s
->bdrv
, PAGE_START(addr
) >> 9,
639 s
->io
, (PAGE_SECTORS
+ 2)) == -1)
640 printf("%s: read error in sector %i\n",
641 __FUNCTION__
, PAGE_START(addr
) >> 9);
642 s
->ioaddr
= s
->io
+ (PAGE_START(addr
) & 0x1ff) + offset
;
645 memcpy(s
->io
, s
->storage
+ PAGE_START(s
->addr
) +
646 offset
, PAGE_SIZE
+ OOB_SIZE
- offset
);
651 static void glue(nand_init_
, PAGE_SIZE
)(NANDFlashState
*s
)
653 s
->oob_shift
= PAGE_SHIFT
- 5;
654 s
->pages
= s
->size
>> PAGE_SHIFT
;
655 s
->addr_shift
= ADDR_SHIFT
;
657 s
->blk_erase
= glue(nand_blk_erase_
, PAGE_SIZE
);
658 s
->blk_write
= glue(nand_blk_write_
, PAGE_SIZE
);
659 s
->blk_load
= glue(nand_blk_load_
, PAGE_SIZE
);