flash.h 19 KB
Newer Older
1
/*
2
 * This file is part of the flashrom project.
3
 *
4 5 6
 * Copyright (C) 2000 Silicon Integrated System Corporation
 * Copyright (C) 2000 Ronald G. Minnich <rminnich@gmail.com>
 * Copyright (C) 2005-2007 coresystems GmbH <stepan@coresystems.de>
7
 * Copyright (C) 2006-2009 Carl-Daniel Hailfinger
8
 *
9 10 11 12
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
13
 *
14 15 16 17
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
18
 *
19 20 21
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
22 23
 */

Ronald G. Minnich's avatar
Ronald G. Minnich committed
24 25 26
#ifndef __FLASH_H__
#define __FLASH_H__ 1

27
#if defined(__GLIBC__)
28
#include <sys/io.h>
29
#endif
30
#include <unistd.h>
31
#include <stdint.h>
32
#include <stdio.h>
33
#include <pci/pci.h>
34

35 36 37 38 39 40 41 42
/* for iopl and outb under Solaris */
#if defined (__sun) && (defined(__i386) || defined(__amd64))
#include <strings.h>
#include <sys/sysi86.h>
#include <sys/psw.h>
#include <asm/sunddi.h>
#endif

Stefan Reinauer's avatar
Stefan Reinauer committed
43 44 45 46
#if (defined(__MACH__) && defined(__APPLE__))
#define __DARWIN__
#endif

47
#if defined(__FreeBSD__) || defined(__DragonFly__)
48 49 50 51 52 53 54 55 56 57
  #include <machine/cpufunc.h>
  #define off64_t off_t
  #define lseek64 lseek
  #define OUTB(x, y) do { u_int tmp = (y); outb(tmp, (x)); } while (0)
  #define OUTW(x, y) do { u_int tmp = (y); outw(tmp, (x)); } while (0)
  #define OUTL(x, y) do { u_int tmp = (y); outl(tmp, (x)); } while (0)
  #define INB(x) __extension__ ({ u_int tmp = (x); inb(tmp); })
  #define INW(x) __extension__ ({ u_int tmp = (x); inw(tmp); })
  #define INL(x) __extension__ ({ u_int tmp = (x); inl(tmp); })
#else
Stefan Reinauer's avatar
Stefan Reinauer committed
58 59 60 61 62
#if defined(__DARWIN__)
    #include <DirectIO/darwinio.h>
    #define off64_t off_t
    #define lseek64 lseek
#endif
63 64 65 66 67 68 69 70 71
#if defined (__sun) && (defined(__i386) || defined(__amd64))
  /* Note different order for outb */
  #define OUTB(x,y) outb(y, x)
  #define OUTW(x,y) outw(y, x)
  #define OUTL(x,y) outl(y, x)
  #define INB  inb
  #define INW  inw
  #define INL  inl
#else
72 73 74 75 76 77 78
  #define OUTB outb
  #define OUTW outw
  #define OUTL outl
  #define INB  inb
  #define INW  inw
  #define INL  inl
#endif
79
#endif
80

81 82
typedef unsigned long chipaddr;

83
extern int programmer;
84 85
#define PROGRAMMER_INTERNAL	0x00
#define PROGRAMMER_DUMMY	0x01
86
#define PROGRAMMER_NIC3COM	0x02
87
#define PROGRAMMER_SATASII	0x03
88
#define PROGRAMMER_IT87SPI	0x04
89 90 91 92 93 94 95 96

struct programmer_entry {
	const char *vendor;
	const char *name;

	int (*init) (void);
	int (*shutdown) (void);

Uwe Hermann's avatar
Uwe Hermann committed
97 98
	void * (*map_flash_region) (const char *descr, unsigned long phys_addr,
				    size_t len);
99 100
	void (*unmap_flash_region) (void *virt_addr, size_t len);

101 102 103
	void (*chip_writeb) (uint8_t val, chipaddr addr);
	void (*chip_writew) (uint16_t val, chipaddr addr);
	void (*chip_writel) (uint32_t val, chipaddr addr);
104
	void (*chip_writen) (uint8_t *buf, chipaddr addr, size_t len);
105 106 107
	uint8_t (*chip_readb) (const chipaddr addr);
	uint16_t (*chip_readw) (const chipaddr addr);
	uint32_t (*chip_readl) (const chipaddr addr);
108
	void (*chip_readn) (uint8_t *buf, const chipaddr addr, size_t len);
109
	void (*delay) (int usecs);
110 111 112 113
};

extern const struct programmer_entry programmer_table[];

114 115 116 117 118 119 120 121
int programmer_init(void);
int programmer_shutdown(void);
void *programmer_map_flash_region(const char *descr, unsigned long phys_addr,
				  size_t len);
void programmer_unmap_flash_region(void *virt_addr, size_t len);
void chip_writeb(uint8_t val, chipaddr addr);
void chip_writew(uint16_t val, chipaddr addr);
void chip_writel(uint32_t val, chipaddr addr);
122
void chip_writen(uint8_t *buf, chipaddr addr, size_t len);
123 124 125
uint8_t chip_readb(const chipaddr addr);
uint16_t chip_readw(const chipaddr addr);
uint32_t chip_readl(const chipaddr addr);
126
void chip_readn(uint8_t *buf, const chipaddr addr, size_t len);
127
void programmer_delay(int usecs);
128

129 130
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))

131
enum chipbustype {
132
	CHIP_BUSTYPE_NONE	= 0,
133 134 135 136 137 138 139 140
	CHIP_BUSTYPE_PARALLEL	= 1 << 0,
	CHIP_BUSTYPE_LPC	= 1 << 1,
	CHIP_BUSTYPE_FWH	= 1 << 2,
	CHIP_BUSTYPE_SPI	= 1 << 3,
	CHIP_BUSTYPE_NONSPI	= CHIP_BUSTYPE_PARALLEL | CHIP_BUSTYPE_LPC | CHIP_BUSTYPE_FWH,
	CHIP_BUSTYPE_UNKNOWN	= CHIP_BUSTYPE_PARALLEL | CHIP_BUSTYPE_LPC | CHIP_BUSTYPE_FWH | CHIP_BUSTYPE_SPI,
};

141
struct flashchip {
142
	const char *vendor;
143
	const char *name;
144 145 146

	enum chipbustype bustype;

147 148
	/*
	 * With 32bit manufacture_id and model_id we can cover IDs up to
149 150 151 152 153
	 * (including) the 4th bank of JEDEC JEP106W Standard Manufacturer's
	 * Identification code.
	 */
	uint32_t manufacture_id;
	uint32_t model_id;
154 155 156 157

	int total_size;
	int page_size;

158 159
	/*
	 * Indicate if flashrom has been tested with this flash chip and if
160 161 162 163
	 * everything worked correctly.
	 */
	uint32_t tested;

Uwe Hermann's avatar
Uwe Hermann committed
164
	int (*probe) (struct flashchip *flash);
165 166 167

	/* Delay after "enter/exit ID mode" commands in microseconds. */
	int probe_timing;
Uwe Hermann's avatar
Uwe Hermann committed
168 169
	int (*erase) (struct flashchip *flash);
	int (*write) (struct flashchip *flash, uint8_t *buf);
170
	int (*read) (struct flashchip *flash, uint8_t *buf, int start, int len);
Ronald G. Minnich's avatar
Ronald G. Minnich committed
171

172
	/* Some flash devices have an additional register space. */
173 174
	chipaddr virtual_memory;
	chipaddr virtual_registers;
175 176
};

177 178
#define TEST_UNTESTED	0

Uwe Hermann's avatar
Uwe Hermann committed
179 180 181 182 183 184 185
#define TEST_OK_PROBE	(1 << 0)
#define TEST_OK_READ	(1 << 1)
#define TEST_OK_ERASE	(1 << 2)
#define TEST_OK_WRITE	(1 << 3)
#define TEST_OK_PR	(TEST_OK_PROBE | TEST_OK_READ)
#define TEST_OK_PRE	(TEST_OK_PROBE | TEST_OK_READ | TEST_OK_ERASE)
#define TEST_OK_PREW	(TEST_OK_PROBE | TEST_OK_READ | TEST_OK_ERASE | TEST_OK_WRITE)
186 187
#define TEST_OK_MASK	0x0f

Uwe Hermann's avatar
Uwe Hermann committed
188 189 190 191 192
#define TEST_BAD_PROBE	(1 << 4)
#define TEST_BAD_READ	(1 << 5)
#define TEST_BAD_ERASE	(1 << 6)
#define TEST_BAD_WRITE	(1 << 7)
#define TEST_BAD_PREW	(TEST_BAD_PROBE | TEST_BAD_READ | TEST_BAD_ERASE | TEST_BAD_WRITE)
193 194
#define TEST_BAD_MASK	0xf0

195 196 197 198 199 200 201 202 203 204
/* Timing used in probe routines. ZERO is -2 to differentiate between an unset
 * field and zero delay.
 * 
 * SPI devices will always have zero delay and ignore this field.
 */
#define TIMING_FIXME	-1
/* this is intentionally same value as fixme */
#define TIMING_IGNORED	-1
#define TIMING_ZERO	-2

205 206
extern struct flashchip flashchips[];

Uwe Hermann's avatar
Uwe Hermann committed
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252
struct penable {
	uint16_t vendor_id;
	uint16_t device_id;
	int status;
	const char *vendor_name;
	const char *device_name;
	int (*doit) (struct pci_dev *dev, const char *name);
};

extern const struct penable chipset_enables[];

struct board_pciid_enable {
	/* Any device, but make it sensible, like the ISA bridge. */
	uint16_t first_vendor;
	uint16_t first_device;
	uint16_t first_card_vendor;
	uint16_t first_card_device;

	/* Any device, but make it sensible, like
	 * the host bridge. May be NULL.
	 */
	uint16_t second_vendor;
	uint16_t second_device;
	uint16_t second_card_vendor;
	uint16_t second_card_device;

	/* The vendor / part name from the coreboot table. */
	const char *lb_vendor;
	const char *lb_part;

	const char *vendor_name;
	const char *board_name;

	int (*enable) (const char *name);
};

extern struct board_pciid_enable board_pciid_enables[];

struct board_info {
	const char *vendor;
	const char *name;
};

extern const struct board_info boards_ok[];
extern const struct board_info boards_bad[];

253
/* udelay.c */
254
void myusec_delay(int usecs);
255
void myusec_calibrate_delay(void);
256

257 258 259
/* pcidev.c */
#define PCI_OK 0
#define PCI_NT 1    /* Not tested */
260

261 262 263
extern uint32_t io_base_addr;
extern struct pci_access *pacc;
extern struct pci_filter filter;
264
extern struct pci_dev *pcidev_dev;
265 266 267 268 269 270 271 272 273 274 275
struct pcidev_status {
	uint16_t vendor_id;
	uint16_t device_id;
	int status;
	const char *vendor_name;
	const char *device_name;
};
uint32_t pcidev_validate(struct pci_dev *dev, struct pcidev_status *devs);
uint32_t pcidev_init(uint16_t vendor_id, struct pcidev_status *devs);
void print_supported_pcidevs(struct pcidev_status *devs);

276
/* board_enable.c */
277 278
void w836xx_ext_enter(uint16_t port);
void w836xx_ext_leave(uint16_t port);
279 280 281
uint8_t sio_read(uint16_t port, uint8_t reg);
void sio_write(uint16_t port, uint8_t reg, uint8_t data);
void sio_mask(uint16_t port, uint8_t reg, uint8_t data, uint8_t mask);
282
int board_flash_enable(const char *vendor, const char *part);
283
void print_supported_boards(void);
284

285
/* chipset_enable.c */
286
extern enum chipbustype buses_supported;
287
int chipset_flash_enable(void);
288
void print_supported_chipsets(void);
289

290 291
extern unsigned long flashbase;

292 293 294 295
/* physmap.c */
void *physmap(const char *descr, unsigned long phys_addr, size_t len);
void physunmap(void *virt_addr, size_t len);

296
/* internal.c */
297 298 299 300
struct pci_dev *pci_dev_find_filter(struct pci_filter filter);
struct pci_dev *pci_dev_find(uint16_t vendor, uint16_t device);
struct pci_dev *pci_card_find(uint16_t vendor, uint16_t device,
			      uint16_t card_vendor, uint16_t card_device);
301
void get_io_perms(void);
302 303
int internal_init(void);
int internal_shutdown(void);
304 305 306 307 308 309
void internal_chip_writeb(uint8_t val, chipaddr addr);
void internal_chip_writew(uint16_t val, chipaddr addr);
void internal_chip_writel(uint32_t val, chipaddr addr);
uint8_t internal_chip_readb(const chipaddr addr);
uint16_t internal_chip_readw(const chipaddr addr);
uint32_t internal_chip_readl(const chipaddr addr);
310
void internal_chip_readn(uint8_t *buf, const chipaddr addr, size_t len);
311 312 313 314 315 316
void mmio_writeb(uint8_t val, void *addr);
void mmio_writew(uint16_t val, void *addr);
void mmio_writel(uint32_t val, void *addr);
uint8_t mmio_readb(void *addr);
uint16_t mmio_readw(void *addr);
uint32_t mmio_readl(void *addr);
317
void internal_delay(int usecs);
318 319
void *fallback_map(const char *descr, unsigned long phys_addr, size_t len);
void fallback_unmap(void *virt_addr, size_t len);
320 321
void fallback_chip_writew(uint16_t val, chipaddr addr);
void fallback_chip_writel(uint32_t val, chipaddr addr);
322
void fallback_chip_writen(uint8_t *buf, chipaddr addr, size_t len);
323 324
uint16_t fallback_chip_readw(const chipaddr addr);
uint32_t fallback_chip_readl(const chipaddr addr);
325
void fallback_chip_readn(uint8_t *buf, const chipaddr addr, size_t len);
326 327 328
#if defined(__FreeBSD__) || defined(__DragonFly__)
extern int io_fd;
#endif
329

330
/* dummyflasher.c */
331
extern char *dummytype;
332 333
int dummy_init(void);
int dummy_shutdown(void);
334 335
void *dummy_map(const char *descr, unsigned long phys_addr, size_t len);
void dummy_unmap(void *virt_addr, size_t len);
336 337 338
void dummy_chip_writeb(uint8_t val, chipaddr addr);
void dummy_chip_writew(uint16_t val, chipaddr addr);
void dummy_chip_writel(uint32_t val, chipaddr addr);
339
void dummy_chip_writen(uint8_t *buf, chipaddr addr, size_t len);
340 341 342
uint8_t dummy_chip_readb(const chipaddr addr);
uint16_t dummy_chip_readw(const chipaddr addr);
uint32_t dummy_chip_readl(const chipaddr addr);
343
void dummy_chip_readn(uint8_t *buf, const chipaddr addr, size_t len);
344 345
int dummy_spi_command(unsigned int writecnt, unsigned int readcnt,
		      const unsigned char *writearr, unsigned char *readarr);
346

347 348 349
/* nic3com.c */
int nic3com_init(void);
int nic3com_shutdown(void);
350 351
void nic3com_chip_writeb(uint8_t val, chipaddr addr);
uint8_t nic3com_chip_readb(const chipaddr addr);
352
extern struct pcidev_status nics_3com[];
353

354 355 356 357 358 359 360
/* satasii.c */
int satasii_init(void);
int satasii_shutdown(void);
void satasii_chip_writeb(uint8_t val, chipaddr addr);
uint8_t satasii_chip_readb(const chipaddr addr);
extern struct pcidev_status satas_sii[];

361
/* flashrom.c */
Uwe Hermann's avatar
Uwe Hermann committed
362 363
extern int verbose;
#define printf_debug(x...) { if (verbose) printf(x); }
364
void map_flash_registers(struct flashchip *flash);
365
int read_memmapped(struct flashchip *flash, uint8_t *buf, int start, int len);
366
int min(int a, int b);
367 368 369
int max(int a, int b);
int check_erased_range(struct flashchip *flash, int start, int len);
int verify_range(struct flashchip *flash, uint8_t *cmpbuf, int start, int len, char *message);
370
extern char *pcidev_bdf;
371 372

/* layout.c */
Peter Stuge's avatar
Peter Stuge committed
373
int show_id(uint8_t *bios, int size, int force);
374 375 376 377
int read_romlayout(char *name);
int find_romentry(char *name);
int handle_romentries(uint8_t *buffer, uint8_t *content);

Uwe Hermann's avatar
Uwe Hermann committed
378
/* cbtable.c */
Stefan Reinauer's avatar
Stefan Reinauer committed
379
int coreboot_init(void);
380 381
extern char *lb_part, *lb_vendor;

382
/* spi.c */
383 384 385 386 387 388 389 390 391 392 393 394
enum spi_controller {
	SPI_CONTROLLER_NONE,
	SPI_CONTROLLER_ICH7,
	SPI_CONTROLLER_ICH9,
	SPI_CONTROLLER_IT87XX,
	SPI_CONTROLLER_SB600,
	SPI_CONTROLLER_VIA,
	SPI_CONTROLLER_WBSIO,
	SPI_CONTROLLER_DUMMY,
};
extern enum spi_controller spi_controller;
extern void *spibar;
395
int probe_spi_rdid(struct flashchip *flash);
396
int probe_spi_rdid4(struct flashchip *flash);
397
int probe_spi_rems(struct flashchip *flash);
398
int probe_spi_res(struct flashchip *flash);
399 400
int spi_command(unsigned int writecnt, unsigned int readcnt,
		const unsigned char *writearr, unsigned char *readarr);
401 402
int spi_write_enable(void);
int spi_write_disable(void);
403
int spi_chip_erase_60(struct flashchip *flash);
404
int spi_chip_erase_c7(struct flashchip *flash);
405
int spi_chip_erase_60_c7(struct flashchip *flash);
406
int spi_chip_erase_d8(struct flashchip *flash);
407 408
int spi_block_erase_52(const struct flashchip *flash, unsigned long addr);
int spi_block_erase_d8(const struct flashchip *flash, unsigned long addr);
409
int spi_chip_write_1(struct flashchip *flash, uint8_t *buf);
410
int spi_chip_write_256(struct flashchip *flash, uint8_t *buf);
411
int spi_chip_read(struct flashchip *flash, uint8_t *buf, int start, int len);
412
uint8_t spi_read_status_register(void);
413
int spi_disable_blockprotect(void);
414
void spi_byte_program(int address, uint8_t byte);
415
int spi_nbyte_program(int address, uint8_t *bytes, int len);
416
int spi_nbyte_read(int address, uint8_t *bytes, int len);
417
int spi_read_chunked(struct flashchip *flash, uint8_t *buf, int start, int len, int chunksize);
418
int spi_aai_write(struct flashchip *flash, uint8_t *buf);
419
uint32_t spi_get_valid_read_addr(void);
420

421
/* 82802ab.c */
Uwe Hermann's avatar
Uwe Hermann committed
422 423 424
int probe_82802ab(struct flashchip *flash);
int erase_82802ab(struct flashchip *flash);
int write_82802ab(struct flashchip *flash, uint8_t *buf);
425 426

/* am29f040b.c */
Uwe Hermann's avatar
Uwe Hermann committed
427 428 429
int probe_29f040b(struct flashchip *flash);
int erase_29f040b(struct flashchip *flash);
int write_29f040b(struct flashchip *flash, uint8_t *buf);
430 431 432

/* pm29f002.c */
int write_pm29f002(struct flashchip *flash, uint8_t *buf);
433 434 435 436 437

/* en29f002a.c */
int probe_en29f002a(struct flashchip *flash);
int erase_en29f002a(struct flashchip *flash);
int write_en29f002a(struct flashchip *flash, uint8_t *buf);
438

439
/* ichspi.c */
440
int ich_init_opcodes(void);
441 442
int ich_spi_command(unsigned int writecnt, unsigned int readcnt,
		    const unsigned char *writearr, unsigned char *readarr);
443
int ich_spi_read(struct flashchip *flash, uint8_t *buf, int start, int len);
444
int ich_spi_write_256(struct flashchip *flash, uint8_t * buf);
445

446 447
/* it87spi.c */
extern uint16_t it8716f_flashport;
448 449
void enter_conf_mode_ite(uint16_t port);
void exit_conf_mode_ite(uint16_t port);
450
int it87spi_init(void);
451
int it87xx_probe_spi_flash(const char *name);
452 453
int it8716f_spi_command(unsigned int writecnt, unsigned int readcnt,
			const unsigned char *writearr, unsigned char *readarr);
454
int it8716f_spi_chip_read(struct flashchip *flash, uint8_t *buf, int start, int len);
455 456
int it8716f_spi_chip_write_1(struct flashchip *flash, uint8_t *buf);
int it8716f_spi_chip_write_256(struct flashchip *flash, uint8_t *buf);
457

458 459 460
/* sb600spi.c */
int sb600_spi_command(unsigned int writecnt, unsigned int readcnt,
		      const unsigned char *writearr, unsigned char *readarr);
461
int sb600_spi_read(struct flashchip *flash, uint8_t *buf, int start, int len);
462
int sb600_spi_write_1(struct flashchip *flash, uint8_t *buf);
463
uint8_t sb600_read_status_register(void);
464
extern uint8_t *sb600_spibar;
465

466
/* jedec.c */
467
uint8_t oddparity(uint8_t val);
468 469 470 471 472 473
void toggle_ready_jedec(chipaddr dst);
void data_polling_jedec(chipaddr dst, uint8_t data);
void unprotect_jedec(chipaddr bios);
void protect_jedec(chipaddr bios);
int write_byte_program_jedec(chipaddr bios, uint8_t *src,
			     chipaddr dst);
Uwe Hermann's avatar
Uwe Hermann committed
474 475 476
int probe_jedec(struct flashchip *flash);
int erase_chip_jedec(struct flashchip *flash);
int write_jedec(struct flashchip *flash, uint8_t *buf);
477 478
int erase_sector_jedec(struct flashchip *flash, unsigned int page, int pagesize);
int erase_block_jedec(struct flashchip *flash, unsigned int page, int blocksize);
479 480
int write_sector_jedec(chipaddr bios, uint8_t *src,
		       chipaddr dst, unsigned int page_size);
481

Peter Stuge's avatar
Peter Stuge committed
482 483 484 485 486
/* m29f002.c */
int erase_m29f002(struct flashchip *flash);
int write_m29f002t(struct flashchip *flash, uint8_t *buf);
int write_m29f002b(struct flashchip *flash, uint8_t *buf);

487
/* m29f400bt.c */
Uwe Hermann's avatar
Uwe Hermann committed
488 489
int probe_m29f400bt(struct flashchip *flash);
int erase_m29f400bt(struct flashchip *flash);
490
int block_erase_m29f400bt(struct flashchip *flash, int start, int len);
Uwe Hermann's avatar
Uwe Hermann committed
491
int write_m29f400bt(struct flashchip *flash, uint8_t *buf);
Stefan Reinauer's avatar
Stefan Reinauer committed
492
int write_coreboot_m29f400bt(struct flashchip *flash, uint8_t *buf);
493 494 495 496 497
void toggle_ready_m29f400bt(chipaddr dst);
void data_polling_m29f400bt(chipaddr dst, uint8_t data);
void protect_m29f400bt(chipaddr bios);
void write_page_m29f400bt(chipaddr bios, uint8_t *src,
			  chipaddr dst, int page_size);
498 499

/* mx29f002.c */
Uwe Hermann's avatar
Uwe Hermann committed
500 501 502
int probe_29f002(struct flashchip *flash);
int erase_29f002(struct flashchip *flash);
int write_29f002(struct flashchip *flash, uint8_t *buf);
503

504 505 506 507
/* pm49fl00x.c */
int probe_49fl00x(struct flashchip *flash);
int erase_49fl00x(struct flashchip *flash);
int write_49fl00x(struct flashchip *flash, uint8_t *buf);
508 509

/* sharplhf00l04.c */
Uwe Hermann's avatar
Uwe Hermann committed
510 511 512
int probe_lhf00l04(struct flashchip *flash);
int erase_lhf00l04(struct flashchip *flash);
int write_lhf00l04(struct flashchip *flash, uint8_t *buf);
513 514 515
void toggle_ready_lhf00l04(chipaddr dst);
void data_polling_lhf00l04(chipaddr dst, uint8_t data);
void protect_lhf00l04(chipaddr bios);
516 517

/* sst28sf040.c */
Uwe Hermann's avatar
Uwe Hermann committed
518 519 520
int probe_28sf040(struct flashchip *flash);
int erase_28sf040(struct flashchip *flash);
int write_28sf040(struct flashchip *flash, uint8_t *buf);
521 522

/* sst39sf020.c */
Uwe Hermann's avatar
Uwe Hermann committed
523 524
int probe_39sf020(struct flashchip *flash);
int write_39sf020(struct flashchip *flash, uint8_t *buf);
525 526

/* sst49lf040.c */
Uwe Hermann's avatar
Uwe Hermann committed
527 528
int erase_49lf040(struct flashchip *flash);
int write_49lf040(struct flashchip *flash, uint8_t *buf);
529 530

/* sst49lfxxxc.c */
Uwe Hermann's avatar
Uwe Hermann committed
531 532 533
int probe_49lfxxxc(struct flashchip *flash);
int erase_49lfxxxc(struct flashchip *flash);
int write_49lfxxxc(struct flashchip *flash, uint8_t *buf);
534 535

/* sst_fwhub.c */
Uwe Hermann's avatar
Uwe Hermann committed
536 537 538
int probe_sst_fwhub(struct flashchip *flash);
int erase_sst_fwhub(struct flashchip *flash);
int write_sst_fwhub(struct flashchip *flash, uint8_t *buf);
539

540 541 542 543 544
/* w39v040c.c */
int probe_w39v040c(struct flashchip *flash);
int erase_w39v040c(struct flashchip *flash);
int write_w39v040c(struct flashchip *flash, uint8_t *buf);

545 546 547 548 549
/* w39V080fa.c */
int probe_winbond_fwhub(struct flashchip *flash);
int erase_winbond_fwhub(struct flashchip *flash);
int write_winbond_fwhub(struct flashchip *flash, uint8_t *buf);

550
/* w29ee011.c */
Uwe Hermann's avatar
Uwe Hermann committed
551
int probe_w29ee011(struct flashchip *flash);
552

553
/* w49f002u.c */
Uwe Hermann's avatar
Uwe Hermann committed
554
int write_49f002(struct flashchip *flash, uint8_t *buf);
555

Peter Stuge's avatar
Peter Stuge committed
556 557
/* wbsio_spi.c */
int wbsio_check_for_spi(const char *name);
Uwe Hermann's avatar
Uwe Hermann committed
558 559
int wbsio_spi_command(unsigned int writecnt, unsigned int readcnt,
		      const unsigned char *writearr, unsigned char *readarr);
560
int wbsio_spi_read(struct flashchip *flash, uint8_t *buf, int start, int len);
561
int wbsio_spi_write_1(struct flashchip *flash, uint8_t *buf);
Peter Stuge's avatar
Peter Stuge committed
562

563 564 565 566
/* stm50flw0x0x.c */
int probe_stm50flw0x0x(struct flashchip *flash);
int erase_stm50flw0x0x(struct flashchip *flash);
int write_stm50flw0x0x(struct flashchip *flash, uint8_t *buf);
567

568
#endif				/* !__FLASH_H__ */