blob: 9015f6a6e845cfa4e24e37bcd8f8ba07678fe649 [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 */
56int probe_82802ab(struct flashchip *flash);
57int erase_82802ab(struct flashchip *flash);
58int write_82802ab(struct flashchip *flash, uint8_t *buf);
59
60/* am29f040b.c */
61int probe_29f040b(struct flashchip *flash);
62int erase_29f040b(struct flashchip *flash);
63int write_29f040b(struct flashchip *flash, uint8_t *buf);
64
65/* pm29f002.c */
66int write_pm29f002(struct flashchip *flash, uint8_t *buf);
67
68/* en29f002a.c */
69int probe_en29f002a(struct flashchip *flash);
70int erase_en29f002a(struct flashchip *flash);
71int write_en29f002a(struct flashchip *flash, uint8_t *buf);
72
73/* jedec.c */
74uint8_t oddparity(uint8_t val);
75void toggle_ready_jedec(chipaddr dst);
76void data_polling_jedec(chipaddr dst, uint8_t data);
77void start_program_jedec(chipaddr bios);
78int write_byte_program_jedec(chipaddr bios, uint8_t *src,
79 chipaddr dst);
80int probe_jedec(struct flashchip *flash);
81int erase_chip_jedec(struct flashchip *flash);
82int write_jedec(struct flashchip *flash, uint8_t *buf);
83int write_jedec_1(struct flashchip *flash, uint8_t *buf);
84int erase_sector_jedec(struct flashchip *flash, unsigned int page, unsigned int pagesize);
85int erase_block_jedec(struct flashchip *flash, unsigned int page, unsigned int blocksize);
86int write_sector_jedec(chipaddr bios, uint8_t *src,
87 chipaddr dst, unsigned int page_size);
88
89/* m29f002.c */
90int erase_m29f002(struct flashchip *flash);
91int write_m29f002t(struct flashchip *flash, uint8_t *buf);
92int write_m29f002b(struct flashchip *flash, uint8_t *buf);
93
94/* m29f400bt.c */
95int probe_m29f400bt(struct flashchip *flash);
96int erase_m29f400bt(struct flashchip *flash);
97int block_erase_m29f400bt(struct flashchip *flash, int start, int len);
98int write_m29f400bt(struct flashchip *flash, uint8_t *buf);
99int write_coreboot_m29f400bt(struct flashchip *flash, uint8_t *buf);
100void toggle_ready_m29f400bt(chipaddr dst);
101void data_polling_m29f400bt(chipaddr dst, uint8_t data);
102void protect_m29f400bt(chipaddr bios);
103void write_page_m29f400bt(chipaddr bios, uint8_t *src,
104 chipaddr dst, int page_size);
105
106/* mx29f002.c */
107int probe_29f002(struct flashchip *flash);
108int erase_29f002(struct flashchip *flash);
109int write_29f002(struct flashchip *flash, uint8_t *buf);
110
111/* pm49fl00x.c */
112int probe_49fl00x(struct flashchip *flash);
113int erase_49fl00x(struct flashchip *flash);
114int write_49fl00x(struct flashchip *flash, uint8_t *buf);
115
116/* sharplhf00l04.c */
117int probe_lhf00l04(struct flashchip *flash);
118int erase_lhf00l04(struct flashchip *flash);
119int write_lhf00l04(struct flashchip *flash, uint8_t *buf);
120void toggle_ready_lhf00l04(chipaddr dst);
121void data_polling_lhf00l04(chipaddr dst, uint8_t data);
122void protect_lhf00l04(chipaddr bios);
123
124/* sst28sf040.c */
125int probe_28sf040(struct flashchip *flash);
126int erase_28sf040(struct flashchip *flash);
127int write_28sf040(struct flashchip *flash, uint8_t *buf);
128
129/* sst39sf020.c */
130int probe_39sf020(struct flashchip *flash);
131int write_39sf020(struct flashchip *flash, uint8_t *buf);
132
133/* sst49lf040.c */
134int erase_49lf040(struct flashchip *flash);
135int write_49lf040(struct flashchip *flash, uint8_t *buf);
136
137/* sst49lfxxxc.c */
138int probe_49lfxxxc(struct flashchip *flash);
139int erase_49lfxxxc(struct flashchip *flash);
140int write_49lfxxxc(struct flashchip *flash, uint8_t *buf);
141
142/* sst_fwhub.c */
143int probe_sst_fwhub(struct flashchip *flash);
144int erase_sst_fwhub(struct flashchip *flash);
145int erase_sst_fwhub_block(struct flashchip *flash, unsigned int offset, unsigned int page_size);
146int write_sst_fwhub(struct flashchip *flash, uint8_t *buf);
147
148/* w39v040c.c */
149int probe_w39v040c(struct flashchip *flash);
150int erase_w39v040c(struct flashchip *flash);
151int write_w39v040c(struct flashchip *flash, uint8_t *buf);
152
153/* w39V080fa.c */
154int probe_winbond_fwhub(struct flashchip *flash);
155int erase_winbond_fwhub(struct flashchip *flash);
156int write_winbond_fwhub(struct flashchip *flash, uint8_t *buf);
157
158/* w29ee011.c */
159int probe_w29ee011(struct flashchip *flash);
160
161/* w49f002u.c */
162int write_49f002(struct flashchip *flash, uint8_t *buf);
163
164/* stm50flw0x0x.c */
165int probe_stm50flw0x0x(struct flashchip *flash);
166int erase_stm50flw0x0x(struct flashchip *flash);
167int write_stm50flw0x0x(struct flashchip *flash, uint8_t *buf);
168
169#endif /* !__CHIPDRIVERS_H__ */