~vcs-imports/qemu/git

« back to all changes in this revision

Viewing changes to hw/nand.c

  • Committer: ths
  • Date: 2007-10-08 12:45:38 UTC
  • Revision ID: git-v1:450d4ff553af32fc9d83fef20d7106b0151526b8
CRIS disassembler, originally from binutils, by Edgar E. Iglesias.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3356 c046a42c-6fe2-441c-8c8c-71466251a162

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
 
12
12
#ifndef NAND_IO
13
13
 
14
 
# include "hw.h"
15
 
# include "flash.h"
16
 
# include "block.h"
17
 
/* FIXME: Pass block device as an argument.  */
18
 
# include "sysemu.h"
 
14
# include "vl.h"
19
15
 
20
16
# define NAND_CMD_READ0         0x00
21
17
# define NAND_CMD_READ1         0x01
106
102
# include "nand.c"
107
103
 
108
104
/* Information based on Linux drivers/mtd/nand/nand_ids.c */
109
 
static const struct nand_info_s {
 
105
struct nand_info_s {
110
106
    int size;
111
107
    int width;
112
108
    int page_shift;
319
315
    return 0;
320
316
}
321
317
 
 
318
static int nand_iid = 0;
 
319
 
322
320
/*
323
321
 * Chip inputs are CLE, ALE, CE, WP, GND and eight I/O pins.  Chip
324
322
 * outputs are R/B and eight I/O pins.
442
440
{
443
441
    int pagesize;
444
442
    struct nand_flash_s *s;
445
 
    int index;
446
443
 
447
444
    if (nand_flash_ids[chip_id].size == 0) {
448
445
        cpu_abort(cpu_single_env, "%s: Unsupported NAND chip ID.\n",
450
447
    }
451
448
 
452
449
    s = (struct nand_flash_s *) qemu_mallocz(sizeof(struct nand_flash_s));
453
 
    index = drive_get_index(IF_MTD, 0, 0);
454
 
    if (index != -1)
455
 
        s->bdrv = drives_table[index].bdrv;
 
450
    s->bdrv = mtd_bdrv;
456
451
    s->manf_id = manf_id;
457
452
    s->chip_id = chip_id;
458
453
    s->size = nand_flash_ids[s->chip_id].size << 20;
493
488
        s->storage = (uint8_t *) memset(qemu_malloc(s->pages * pagesize),
494
489
                        0xff, s->pages * pagesize);
495
490
 
496
 
    register_savevm("nand", -1, 0, nand_save, nand_load, s);
 
491
    register_savevm("nand", nand_iid ++, 0, nand_save, nand_load, s);
497
492
 
498
493
    return s;
499
494
}