blob: af22abf247b5629cdb678e60fc08b3aced495e08 [file] [log] [blame]
Carl-Daniel Hailfinger5d5c0722009-12-14 03:32:24 +00001/*
2 * This file is part of the flashrom project.
3 *
4 * Copyright (C) 2009 Carl-Daniel Hailfinger
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 *
19 *
20 * Header file for flash chip drivers. Included from flash.h.
21 * As a general rule, every function listed here should take a pointer to
22 * struct flashchip as first parameter.
23 */
24
25#ifndef __CHIPDRIVERS_H__
26#define __CHIPDRIVERS_H__ 1
27
28/* spi.c, should probably be in spi_chip.c */
29int probe_spi_rdid(struct flashchip *flash);
30int probe_spi_rdid4(struct flashchip *flash);
31int probe_spi_rems(struct flashchip *flash);
32int probe_spi_res(struct flashchip *flash);
33int spi_write_enable(void);
34int spi_write_disable(void);
35int spi_chip_erase_60(struct flashchip *flash);
36int spi_chip_erase_c7(struct flashchip *flash);
37int spi_chip_erase_60_c7(struct flashchip *flash);
38int spi_chip_erase_d8(struct flashchip *flash);
39int spi_block_erase_20(struct flashchip *flash, unsigned int addr, unsigned int blocklen);
40int spi_block_erase_52(struct flashchip *flash, unsigned int addr, unsigned int blocklen);
41int spi_block_erase_d8(struct flashchip *flash, unsigned int addr, unsigned int blocklen);
42int spi_block_erase_60(struct flashchip *flash, unsigned int addr, unsigned int blocklen);
43int spi_block_erase_c7(struct flashchip *flash, unsigned int addr, unsigned int blocklen);
44int spi_chip_write_1(struct flashchip *flash, uint8_t *buf);
45int spi_chip_write_256(struct flashchip *flash, uint8_t *buf);
46int spi_chip_read(struct flashchip *flash, uint8_t *buf, int start, int len);
47uint8_t spi_read_status_register(void);
48int spi_disable_blockprotect(void);
49int spi_byte_program(int addr, uint8_t byte);
50int spi_nbyte_program(int addr, uint8_t *bytes, int len);
51int spi_nbyte_read(int addr, uint8_t *bytes, int len);
52int spi_read_chunked(struct flashchip *flash, uint8_t *buf, int start, int len, int chunksize);
53int spi_aai_write(struct flashchip *flash, uint8_t *buf);
54
55/* 82802ab.c */
Carl-Daniel Hailfingeraca1dce2010-01-07 21:23:45 +000056uint8_t wait_82802ab(chipaddr bios);
Carl-Daniel Hailfinger5d5c0722009-12-14 03:32:24 +000057int probe_82802ab(struct flashchip *flash);
58int erase_82802ab(struct flashchip *flash);
59int write_82802ab(struct flashchip *flash, uint8_t *buf);
60
61/* am29f040b.c */
62int probe_29f040b(struct flashchip *flash);
63int erase_29f040b(struct flashchip *flash);
Sean Nelson72a9a022009-12-22 22:15:33 +000064int erase_sector_29f040b(struct flashchip *flash, unsigned int blockaddr, unsigned int blocksize);
65int erase_chip_29f040b(struct flashchip *flash, unsigned int blockaddr, unsigned int blocksize);
Carl-Daniel Hailfinger5d5c0722009-12-14 03:32:24 +000066int write_29f040b(struct flashchip *flash, uint8_t *buf);
67
68/* pm29f002.c */
69int write_pm29f002(struct flashchip *flash, uint8_t *buf);
70
71/* en29f002a.c */
72int probe_en29f002a(struct flashchip *flash);
73int erase_en29f002a(struct flashchip *flash);
74int write_en29f002a(struct flashchip *flash, uint8_t *buf);
75
76/* jedec.c */
77uint8_t oddparity(uint8_t val);
78void toggle_ready_jedec(chipaddr dst);
79void data_polling_jedec(chipaddr dst, uint8_t data);
Carl-Daniel Hailfinger5d5c0722009-12-14 03:32:24 +000080int write_byte_program_jedec(chipaddr bios, uint8_t *src,
81 chipaddr dst);
82int probe_jedec(struct flashchip *flash);
83int erase_chip_jedec(struct flashchip *flash);
84int write_jedec(struct flashchip *flash, uint8_t *buf);
85int write_jedec_1(struct flashchip *flash, uint8_t *buf);
86int erase_sector_jedec(struct flashchip *flash, unsigned int page, unsigned int pagesize);
87int erase_block_jedec(struct flashchip *flash, unsigned int page, unsigned int blocksize);
Sean Nelson72a9a022009-12-22 22:15:33 +000088int erase_chip_block_jedec(struct flashchip *flash, unsigned int page, unsigned int blocksize);
Sean Nelsonc57a9202010-01-04 17:15:23 +000089int write_sector_jedec_common(struct flashchip *flash, uint8_t *src, chipaddr dst, unsigned int page_size, unsigned int mask);
Carl-Daniel Hailfinger5d5c0722009-12-14 03:32:24 +000090
91/* m29f002.c */
92int erase_m29f002(struct flashchip *flash);
93int write_m29f002t(struct flashchip *flash, uint8_t *buf);
94int write_m29f002b(struct flashchip *flash, uint8_t *buf);
95
96/* m29f400bt.c */
97int probe_m29f400bt(struct flashchip *flash);
98int erase_m29f400bt(struct flashchip *flash);
Sean Nelson6b11ad22009-12-23 17:05:59 +000099int block_erase_m29f400bt(struct flashchip *flash, unsigned int start, unsigned int len);
100int block_erase_chip_m29f400bt(struct flashchip *flash, unsigned int start, unsigned int len);
Carl-Daniel Hailfinger5d5c0722009-12-14 03:32:24 +0000101int write_m29f400bt(struct flashchip *flash, uint8_t *buf);
102int write_coreboot_m29f400bt(struct flashchip *flash, uint8_t *buf);
Carl-Daniel Hailfinger5d5c0722009-12-14 03:32:24 +0000103void protect_m29f400bt(chipaddr bios);
104void write_page_m29f400bt(chipaddr bios, uint8_t *src,
105 chipaddr dst, int page_size);
106
107/* mx29f002.c */
108int probe_29f002(struct flashchip *flash);
109int erase_29f002(struct flashchip *flash);
Sean Nelson6b11ad22009-12-23 17:05:59 +0000110int erase_chip_29f002(struct flashchip *flash, unsigned int addr, unsigned int blocklen);
111int erase_sector_29f002(struct flashchip *flash, unsigned int address, unsigned int blocklen);
Carl-Daniel Hailfinger5d5c0722009-12-14 03:32:24 +0000112int write_29f002(struct flashchip *flash, uint8_t *buf);
113
114/* pm49fl00x.c */
115int probe_49fl00x(struct flashchip *flash);
116int erase_49fl00x(struct flashchip *flash);
117int write_49fl00x(struct flashchip *flash, uint8_t *buf);
118
119/* sharplhf00l04.c */
120int probe_lhf00l04(struct flashchip *flash);
Carl-Daniel Hailfingeraca1dce2010-01-07 21:23:45 +0000121int erase_lhf00l04_block(struct flashchip *flash, unsigned int blockaddr, unsigned int blocklen);
Carl-Daniel Hailfinger5d5c0722009-12-14 03:32:24 +0000122int write_lhf00l04(struct flashchip *flash, uint8_t *buf);
Carl-Daniel Hailfinger5d5c0722009-12-14 03:32:24 +0000123void protect_lhf00l04(chipaddr bios);
124
125/* sst28sf040.c */
126int probe_28sf040(struct flashchip *flash);
127int erase_28sf040(struct flashchip *flash);
128int write_28sf040(struct flashchip *flash, uint8_t *buf);
129
130/* sst39sf020.c */
131int probe_39sf020(struct flashchip *flash);
132int write_39sf020(struct flashchip *flash, uint8_t *buf);
133
134/* sst49lf040.c */
135int erase_49lf040(struct flashchip *flash);
136int write_49lf040(struct flashchip *flash, uint8_t *buf);
137
138/* sst49lfxxxc.c */
139int probe_49lfxxxc(struct flashchip *flash);
140int erase_49lfxxxc(struct flashchip *flash);
141int write_49lfxxxc(struct flashchip *flash, uint8_t *buf);
142
143/* sst_fwhub.c */
144int probe_sst_fwhub(struct flashchip *flash);
145int erase_sst_fwhub(struct flashchip *flash);
146int erase_sst_fwhub_block(struct flashchip *flash, unsigned int offset, unsigned int page_size);
147int write_sst_fwhub(struct flashchip *flash, uint8_t *buf);
148
149/* w39v040c.c */
150int probe_w39v040c(struct flashchip *flash);
151int erase_w39v040c(struct flashchip *flash);
152int write_w39v040c(struct flashchip *flash, uint8_t *buf);
153
154/* w39V080fa.c */
155int probe_winbond_fwhub(struct flashchip *flash);
156int erase_winbond_fwhub(struct flashchip *flash);
157int write_winbond_fwhub(struct flashchip *flash, uint8_t *buf);
158
159/* w29ee011.c */
160int probe_w29ee011(struct flashchip *flash);
161
162/* w49f002u.c */
163int write_49f002(struct flashchip *flash, uint8_t *buf);
164
165/* stm50flw0x0x.c */
166int probe_stm50flw0x0x(struct flashchip *flash);
167int erase_stm50flw0x0x(struct flashchip *flash);
168int write_stm50flw0x0x(struct flashchip *flash, uint8_t *buf);
169
170#endif /* !__CHIPDRIVERS_H__ */