blob: e262c2d18c1d63ed962d01ed6e0ba463fe1a9615 [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);
Sean Nelson5643c072010-01-19 03:23:07 +000041int spi_block_erase_d7(struct flashchip *flash, unsigned int addr, unsigned int blocklen);
Carl-Daniel Hailfinger5d5c0722009-12-14 03:32:24 +000042int spi_block_erase_d8(struct flashchip *flash, unsigned int addr, unsigned int blocklen);
43int spi_block_erase_60(struct flashchip *flash, unsigned int addr, unsigned int blocklen);
44int spi_block_erase_c7(struct flashchip *flash, unsigned int addr, unsigned int blocklen);
45int spi_chip_write_1(struct flashchip *flash, uint8_t *buf);
46int spi_chip_write_256(struct flashchip *flash, uint8_t *buf);
47int spi_chip_read(struct flashchip *flash, uint8_t *buf, int start, int len);
48uint8_t spi_read_status_register(void);
49int spi_disable_blockprotect(void);
Michael Karcher4e2fb0e2010-01-12 23:29:26 +000050int spi_byte_program(int addr, uint8_t databyte);
Carl-Daniel Hailfinger5d5c0722009-12-14 03:32:24 +000051int spi_nbyte_program(int addr, uint8_t *bytes, int len);
52int spi_nbyte_read(int addr, uint8_t *bytes, int len);
53int spi_read_chunked(struct flashchip *flash, uint8_t *buf, int start, int len, int chunksize);
54int spi_aai_write(struct flashchip *flash, uint8_t *buf);
55
56/* 82802ab.c */
Carl-Daniel Hailfingeraca1dce2010-01-07 21:23:45 +000057uint8_t wait_82802ab(chipaddr bios);
Carl-Daniel Hailfinger5d5c0722009-12-14 03:32:24 +000058int probe_82802ab(struct flashchip *flash);
59int erase_82802ab(struct flashchip *flash);
Sean Nelson54596372010-01-09 05:30:14 +000060int erase_82802ab_block(struct flashchip *flash, unsigned int page, unsigned int pagesize);
Carl-Daniel Hailfinger5d5c0722009-12-14 03:32:24 +000061int write_82802ab(struct flashchip *flash, uint8_t *buf);
62
63/* am29f040b.c */
64int probe_29f040b(struct flashchip *flash);
65int erase_29f040b(struct flashchip *flash);
Sean Nelson72a9a022009-12-22 22:15:33 +000066int erase_sector_29f040b(struct flashchip *flash, unsigned int blockaddr, unsigned int blocksize);
67int erase_chip_29f040b(struct flashchip *flash, unsigned int blockaddr, unsigned int blocksize);
Carl-Daniel Hailfinger5d5c0722009-12-14 03:32:24 +000068int write_29f040b(struct flashchip *flash, uint8_t *buf);
69
70/* pm29f002.c */
71int write_pm29f002(struct flashchip *flash, uint8_t *buf);
72
73/* en29f002a.c */
74int probe_en29f002a(struct flashchip *flash);
75int erase_en29f002a(struct flashchip *flash);
76int write_en29f002a(struct flashchip *flash, uint8_t *buf);
77
78/* jedec.c */
79uint8_t oddparity(uint8_t val);
80void toggle_ready_jedec(chipaddr dst);
81void data_polling_jedec(chipaddr dst, uint8_t data);
Carl-Daniel Hailfinger5d5c0722009-12-14 03:32:24 +000082int write_byte_program_jedec(chipaddr bios, uint8_t *src,
83 chipaddr dst);
84int probe_jedec(struct flashchip *flash);
85int erase_chip_jedec(struct flashchip *flash);
86int write_jedec(struct flashchip *flash, uint8_t *buf);
87int write_jedec_1(struct flashchip *flash, uint8_t *buf);
88int erase_sector_jedec(struct flashchip *flash, unsigned int page, unsigned int pagesize);
89int erase_block_jedec(struct flashchip *flash, unsigned int page, unsigned int blocksize);
Sean Nelson72a9a022009-12-22 22:15:33 +000090int erase_chip_block_jedec(struct flashchip *flash, unsigned int page, unsigned int blocksize);
Sean Nelsonc57a9202010-01-04 17:15:23 +000091int 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 +000092
93/* m29f002.c */
94int erase_m29f002(struct flashchip *flash);
95int write_m29f002t(struct flashchip *flash, uint8_t *buf);
96int write_m29f002b(struct flashchip *flash, uint8_t *buf);
97
98/* m29f400bt.c */
99int probe_m29f400bt(struct flashchip *flash);
100int erase_m29f400bt(struct flashchip *flash);
Sean Nelson6b11ad22009-12-23 17:05:59 +0000101int block_erase_m29f400bt(struct flashchip *flash, unsigned int start, unsigned int len);
102int block_erase_chip_m29f400bt(struct flashchip *flash, unsigned int start, unsigned int len);
Carl-Daniel Hailfinger5d5c0722009-12-14 03:32:24 +0000103int write_m29f400bt(struct flashchip *flash, uint8_t *buf);
104int write_coreboot_m29f400bt(struct flashchip *flash, uint8_t *buf);
Carl-Daniel Hailfinger5d5c0722009-12-14 03:32:24 +0000105void protect_m29f400bt(chipaddr bios);
106void write_page_m29f400bt(chipaddr bios, uint8_t *src,
107 chipaddr dst, int page_size);
108
109/* mx29f002.c */
110int probe_29f002(struct flashchip *flash);
111int erase_29f002(struct flashchip *flash);
Sean Nelson6b11ad22009-12-23 17:05:59 +0000112int erase_chip_29f002(struct flashchip *flash, unsigned int addr, unsigned int blocklen);
113int erase_sector_29f002(struct flashchip *flash, unsigned int address, unsigned int blocklen);
Carl-Daniel Hailfinger5d5c0722009-12-14 03:32:24 +0000114int write_29f002(struct flashchip *flash, uint8_t *buf);
115
116/* pm49fl00x.c */
117int probe_49fl00x(struct flashchip *flash);
118int erase_49fl00x(struct flashchip *flash);
119int write_49fl00x(struct flashchip *flash, uint8_t *buf);
Sean Nelson6e0b9122010-02-19 00:52:10 +0000120int unlock_49fl00x(struct flashchip *flash);
Carl-Daniel Hailfinger5d5c0722009-12-14 03:32:24 +0000121
122/* sharplhf00l04.c */
123int probe_lhf00l04(struct flashchip *flash);
Carl-Daniel Hailfingeraca1dce2010-01-07 21:23:45 +0000124int erase_lhf00l04_block(struct flashchip *flash, unsigned int blockaddr, unsigned int blocklen);
Carl-Daniel Hailfinger5d5c0722009-12-14 03:32:24 +0000125int write_lhf00l04(struct flashchip *flash, uint8_t *buf);
Carl-Daniel Hailfinger5d5c0722009-12-14 03:32:24 +0000126void protect_lhf00l04(chipaddr bios);
127
128/* sst28sf040.c */
129int probe_28sf040(struct flashchip *flash);
Sean Nelson51c83fb2010-01-20 20:55:53 +0000130int erase_chip_28sf040(struct flashchip *flash, unsigned int addr, unsigned int blocklen);
131int erase_sector_28sf040(struct flashchip *flash, unsigned int address, unsigned int sector_size);
Carl-Daniel Hailfinger5d5c0722009-12-14 03:32:24 +0000132int write_28sf040(struct flashchip *flash, uint8_t *buf);
133
134/* sst39sf020.c */
135int probe_39sf020(struct flashchip *flash);
136int write_39sf020(struct flashchip *flash, uint8_t *buf);
137
138/* sst49lf040.c */
139int erase_49lf040(struct flashchip *flash);
140int write_49lf040(struct flashchip *flash, uint8_t *buf);
141
142/* sst49lfxxxc.c */
143int probe_49lfxxxc(struct flashchip *flash);
144int erase_49lfxxxc(struct flashchip *flash);
Sean Nelson51c83fb2010-01-20 20:55:53 +0000145int erase_sector_49lfxxxc(struct flashchip *flash, unsigned int address, unsigned int sector_size);
146int erase_block_49lfxxxc(struct flashchip *flash, unsigned int address, unsigned int sector_size);
147int erase_chip_49lfxxxc(struct flashchip *flash, unsigned int addr, unsigned int blocksize);
Carl-Daniel Hailfinger5d5c0722009-12-14 03:32:24 +0000148int write_49lfxxxc(struct flashchip *flash, uint8_t *buf);
Sean Nelson6e0b9122010-02-19 00:52:10 +0000149int unlock_49lfxxxc(struct flashchip *flash);
Carl-Daniel Hailfinger5d5c0722009-12-14 03:32:24 +0000150
151/* sst_fwhub.c */
152int probe_sst_fwhub(struct flashchip *flash);
153int erase_sst_fwhub(struct flashchip *flash);
154int erase_sst_fwhub_block(struct flashchip *flash, unsigned int offset, unsigned int page_size);
Sean Nelson51c83fb2010-01-20 20:55:53 +0000155int erase_sst_fwhub_sector(struct flashchip *flash, unsigned int offset, unsigned int page_size);
Carl-Daniel Hailfinger5d5c0722009-12-14 03:32:24 +0000156int write_sst_fwhub(struct flashchip *flash, uint8_t *buf);
157
158/* w39v040c.c */
159int probe_w39v040c(struct flashchip *flash);
160int erase_w39v040c(struct flashchip *flash);
161int write_w39v040c(struct flashchip *flash, uint8_t *buf);
Sean Nelson6e0b9122010-02-19 00:52:10 +0000162int printlock_w39v040c(struct flashchip *flash);
Carl-Daniel Hailfinger5d5c0722009-12-14 03:32:24 +0000163
164/* w39V080fa.c */
165int probe_winbond_fwhub(struct flashchip *flash);
166int erase_winbond_fwhub(struct flashchip *flash);
167int write_winbond_fwhub(struct flashchip *flash, uint8_t *buf);
Sean Nelson6e0b9122010-02-19 00:52:10 +0000168int unlock_winbond_fwhub(struct flashchip *flash);
Carl-Daniel Hailfinger5d5c0722009-12-14 03:32:24 +0000169
170/* w29ee011.c */
171int probe_w29ee011(struct flashchip *flash);
172
173/* w49f002u.c */
174int write_49f002(struct flashchip *flash, uint8_t *buf);
175
176/* stm50flw0x0x.c */
177int probe_stm50flw0x0x(struct flashchip *flash);
178int erase_stm50flw0x0x(struct flashchip *flash);
Sean Nelson56358aa2010-01-19 16:08:51 +0000179int erase_block_stm50flw0x0x(struct flashchip *flash, unsigned int block, unsigned int blocksize);
180int erase_sector_stm50flw0x0x(struct flashchip *flash, unsigned int block, unsigned int blocksize);
181int erase_chip_stm50flw0x0x(struct flashchip *flash, unsigned int addr, unsigned int blocklen);
Carl-Daniel Hailfinger5d5c0722009-12-14 03:32:24 +0000182int write_stm50flw0x0x(struct flashchip *flash, uint8_t *buf);
183
184#endif /* !__CHIPDRIVERS_H__ */