2012-12-06 12:15:58 +01:00
|
|
|
#ifndef HW_FLASH_H
|
2016-06-29 15:29:06 +02:00
|
|
|
#define HW_FLASH_H
|
2012-12-06 12:15:58 +01:00
|
|
|
|
2007-11-17 18:14:51 +01:00
|
|
|
/* NOR flash devices */
|
2011-08-04 14:55:30 +02:00
|
|
|
|
2012-12-17 18:19:49 +01:00
|
|
|
#include "exec/memory.h"
|
2011-08-04 14:55:30 +02:00
|
|
|
|
2016-06-22 14:24:48 +02:00
|
|
|
#define TYPE_CFI_PFLASH01 "cfi.pflash01"
|
|
|
|
#define TYPE_CFI_PFLASH02 "cfi.pflash02"
|
|
|
|
|
2009-10-01 23:12:16 +02:00
|
|
|
typedef struct pflash_t pflash_t;
|
2007-11-17 18:14:51 +01:00
|
|
|
|
2007-12-10 01:28:27 +01:00
|
|
|
/* pflash_cfi01.c */
|
2012-10-23 12:30:10 +02:00
|
|
|
pflash_t *pflash_cfi01_register(hwaddr base,
|
2011-08-04 14:55:30 +02:00
|
|
|
DeviceState *qdev, const char *name,
|
2012-10-23 12:30:10 +02:00
|
|
|
hwaddr size,
|
2014-10-07 13:59:18 +02:00
|
|
|
BlockBackend *blk,
|
2007-12-10 01:28:27 +01:00
|
|
|
uint32_t sector_len, int nb_blocs, int width,
|
|
|
|
uint16_t id0, uint16_t id1,
|
2011-08-25 21:39:18 +02:00
|
|
|
uint16_t id2, uint16_t id3, int be);
|
2007-12-10 01:28:27 +01:00
|
|
|
|
|
|
|
/* pflash_cfi02.c */
|
2012-10-23 12:30:10 +02:00
|
|
|
pflash_t *pflash_cfi02_register(hwaddr base,
|
2011-08-04 14:55:30 +02:00
|
|
|
DeviceState *qdev, const char *name,
|
2012-10-23 12:30:10 +02:00
|
|
|
hwaddr size,
|
2014-10-07 13:59:18 +02:00
|
|
|
BlockBackend *blk, uint32_t sector_len,
|
2008-04-17 01:45:36 +02:00
|
|
|
int nb_blocs, int nb_mappings, int width,
|
2007-12-10 01:28:27 +01:00
|
|
|
uint16_t id0, uint16_t id1,
|
2008-04-17 01:37:15 +02:00
|
|
|
uint16_t id2, uint16_t id3,
|
2011-08-25 21:39:18 +02:00
|
|
|
uint16_t unlock_addr0, uint16_t unlock_addr1,
|
|
|
|
int be);
|
2007-11-17 18:14:51 +01:00
|
|
|
|
2011-08-04 14:55:30 +02:00
|
|
|
MemoryRegion *pflash_cfi01_get_memory(pflash_t *fl);
|
|
|
|
|
2007-11-17 18:14:51 +01:00
|
|
|
/* nand.c */
|
2014-10-07 13:59:18 +02:00
|
|
|
DeviceState *nand_init(BlockBackend *blk, int manf_id, int chip_id);
|
2011-07-29 17:35:24 +02:00
|
|
|
void nand_setpins(DeviceState *dev, uint8_t cle, uint8_t ale,
|
2010-12-03 01:39:22 +01:00
|
|
|
uint8_t ce, uint8_t wp, uint8_t gnd);
|
2011-07-29 17:35:24 +02:00
|
|
|
void nand_getpins(DeviceState *dev, int *rb);
|
|
|
|
void nand_setio(DeviceState *dev, uint32_t value);
|
|
|
|
uint32_t nand_getio(DeviceState *dev);
|
|
|
|
uint32_t nand_getbuswidth(DeviceState *dev);
|
2007-11-17 18:14:51 +01:00
|
|
|
|
|
|
|
#define NAND_MFR_TOSHIBA 0x98
|
|
|
|
#define NAND_MFR_SAMSUNG 0xec
|
|
|
|
#define NAND_MFR_FUJITSU 0x04
|
|
|
|
#define NAND_MFR_NATIONAL 0x8f
|
|
|
|
#define NAND_MFR_RENESAS 0x07
|
|
|
|
#define NAND_MFR_STMICRO 0x20
|
|
|
|
#define NAND_MFR_HYNIX 0xad
|
|
|
|
#define NAND_MFR_MICRON 0x2c
|
|
|
|
|
2008-04-14 23:57:44 +02:00
|
|
|
/* onenand.c */
|
2011-08-28 18:22:17 +02:00
|
|
|
void *onenand_raw_otp(DeviceState *onenand_device);
|
2008-04-14 23:57:44 +02:00
|
|
|
|
2007-11-17 18:14:51 +01:00
|
|
|
/* ecc.c */
|
2009-05-10 02:44:56 +02:00
|
|
|
typedef struct {
|
2007-11-17 18:14:51 +01:00
|
|
|
uint8_t cp; /* Column parity */
|
|
|
|
uint16_t lp[2]; /* Line parity */
|
|
|
|
uint16_t count;
|
2009-05-10 02:44:56 +02:00
|
|
|
} ECCState;
|
2007-11-17 18:14:51 +01:00
|
|
|
|
2009-05-10 02:44:56 +02:00
|
|
|
uint8_t ecc_digest(ECCState *s, uint8_t sample);
|
|
|
|
void ecc_reset(ECCState *s);
|
2011-01-21 11:12:11 +01:00
|
|
|
extern VMStateDescription vmstate_ecc_state;
|
2012-12-06 12:15:58 +01:00
|
|
|
|
|
|
|
#endif
|