flashrom 

flashrom Svn Source Tree

Root/trunk/chipdrivers.h

1/*
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 flashctx as first parameter.
23 */
24
25#ifndef __CHIPDRIVERS_H__
26#define __CHIPDRIVERS_H__ 1
27
28#include "flash.h"/* for chipaddr and flashctx */
29
30/* spi.c */
31int spi_aai_write(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len);
32int spi_chip_write_256(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len);
33int spi_chip_read(struct flashctx *flash, uint8_t *buf, unsigned int start, int unsigned len);
34
35/* spi25.c */
36int probe_spi_rdid(struct flashctx *flash);
37int probe_spi_rdid4(struct flashctx *flash);
38int probe_spi_rems(struct flashctx *flash);
39int probe_spi_res1(struct flashctx *flash);
40int probe_spi_res2(struct flashctx *flash);
41int probe_spi_res3(struct flashctx *flash);
42int probe_spi_at25f(struct flashctx *flash);
43int spi_write_enable(struct flashctx *flash);
44int spi_write_disable(struct flashctx *flash);
45int spi_block_erase_20(struct flashctx *flash, unsigned int addr, unsigned int blocklen);
46int spi_block_erase_50(struct flashctx *flash, unsigned int addr, unsigned int blocklen);
47int spi_block_erase_52(struct flashctx *flash, unsigned int addr, unsigned int blocklen);
48int spi_block_erase_60(struct flashctx *flash, unsigned int addr, unsigned int blocklen);
49int spi_block_erase_62(struct flashctx *flash, unsigned int addr, unsigned int blocklen);
50int spi_block_erase_81(struct flashctx *flash, unsigned int addr, unsigned int blocklen);
51int spi_block_erase_c4(struct flashctx *flash, unsigned int addr, unsigned int blocklen);
52int spi_block_erase_c7(struct flashctx *flash, unsigned int addr, unsigned int blocklen);
53int spi_block_erase_d7(struct flashctx *flash, unsigned int addr, unsigned int blocklen);
54int spi_block_erase_d8(struct flashctx *flash, unsigned int addr, unsigned int blocklen);
55int spi_block_erase_db(struct flashctx *flash, unsigned int addr, unsigned int blocklen);
56erasefunc_t *spi_get_erasefn_from_opcode(uint8_t opcode);
57int spi_chip_write_1(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len);
58int spi_byte_program(struct flashctx *flash, unsigned int addr, uint8_t databyte);
59int spi_nbyte_program(struct flashctx *flash, unsigned int addr, const uint8_t *bytes, unsigned int len);
60int spi_nbyte_read(struct flashctx *flash, unsigned int addr, uint8_t *bytes, unsigned int len);
61int spi_read_chunked(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len, unsigned int chunksize);
62int spi_write_chunked(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len, unsigned int chunksize);
63
64/* spi25_statusreg.c */
65uint8_t spi_read_status_register(struct flashctx *flash);
66int spi_write_status_register(struct flashctx *flash, int status);
67void spi_prettyprint_status_register_bit(uint8_t status, int bit);
68int spi_prettyprint_status_register_plain(struct flashctx *flash);
69int spi_prettyprint_status_register_default_welwip(struct flashctx *flash);
70int spi_prettyprint_status_register_bp1_srwd(struct flashctx *flash);
71int spi_prettyprint_status_register_bp2_srwd(struct flashctx *flash);
72int spi_prettyprint_status_register_bp3_srwd(struct flashctx *flash);
73int spi_prettyprint_status_register_bp4_srwd(struct flashctx *flash);
74int spi_prettyprint_status_register_bp2_bpl(struct flashctx *flash);
75int spi_prettyprint_status_register_bp2_tb_bpl(struct flashctx *flash);
76int spi_disable_blockprotect(struct flashctx *flash);
77int spi_disable_blockprotect_bp1_srwd(struct flashctx *flash);
78int spi_disable_blockprotect_bp2_srwd(struct flashctx *flash);
79int spi_disable_blockprotect_bp3_srwd(struct flashctx *flash);
80int spi_disable_blockprotect_bp4_srwd(struct flashctx *flash);
81int spi_prettyprint_status_register_amic_a25l032(struct flashctx *flash);
82int spi_prettyprint_status_register_at25df(struct flashctx *flash);
83int spi_prettyprint_status_register_at25df_sec(struct flashctx *flash);
84int spi_prettyprint_status_register_at25f(struct flashctx *flash);
85int spi_prettyprint_status_register_at25f512a(struct flashctx *flash);
86int spi_prettyprint_status_register_at25f512b(struct flashctx *flash);
87int spi_prettyprint_status_register_at25f4096(struct flashctx *flash);
88int spi_prettyprint_status_register_at25fs010(struct flashctx *flash);
89int spi_prettyprint_status_register_at25fs040(struct flashctx *flash);
90int spi_prettyprint_status_register_at26df081a(struct flashctx *flash);
91int spi_disable_blockprotect_at2x_global_unprotect(struct flashctx *flash);
92int spi_disable_blockprotect_at2x_global_unprotect_sec(struct flashctx *flash);
93int spi_disable_blockprotect_at25f(struct flashctx *flash);
94int spi_disable_blockprotect_at25f512a(struct flashctx *flash);
95int spi_disable_blockprotect_at25f512b(struct flashctx *flash);
96int spi_disable_blockprotect_at25fs010(struct flashctx *flash);
97int spi_disable_blockprotect_at25fs040(struct flashctx *flash);
98int spi_prettyprint_status_register_en25s_wp(struct flashctx *flash);
99int spi_prettyprint_status_register_n25q(struct flashctx *flash);
100int spi_disable_blockprotect_n25q(struct flashctx *flash);
101int spi_prettyprint_status_register_bp2_ep_srwd(struct flashctx *flash);
102int spi_disable_blockprotect_bp2_ep_srwd(struct flashctx *flash);
103int spi_prettyprint_status_register_sst25(struct flashctx *flash);
104int spi_prettyprint_status_register_sst25vf016(struct flashctx *flash);
105int spi_prettyprint_status_register_sst25vf040b(struct flashctx *flash);
106
107/* sfdp.c */
108int probe_spi_sfdp(struct flashctx *flash);
109
110/* opaque.c */
111int probe_opaque(struct flashctx *flash);
112int read_opaque(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len);
113int write_opaque(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len);
114int erase_opaque(struct flashctx *flash, unsigned int blockaddr, unsigned int blocklen);
115
116/* at45db.c */
117int probe_spi_at45db(struct flashctx *flash);
118int spi_prettyprint_status_register_at45db(struct flashctx *flash);
119int spi_disable_blockprotect_at45db(struct flashctx *flash);
120int spi_read_at45db(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len);
121int spi_read_at45db_e8(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len);
122int spi_write_at45db(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len);
123int spi_erase_at45db_page(struct flashctx *flash, unsigned int addr, unsigned int blocklen);
124int spi_erase_at45db_block(struct flashctx *flash, unsigned int addr, unsigned int blocklen);
125int spi_erase_at45db_sector(struct flashctx *flash, unsigned int addr, unsigned int blocklen);
126int spi_erase_at45db_chip(struct flashctx *flash, unsigned int addr, unsigned int blocklen);
127int spi_erase_at45cs_sector(struct flashctx *flash, unsigned int addr, unsigned int blocklen);
128
129/* 82802ab.c */
130uint8_t wait_82802ab(struct flashctx *flash);
131int probe_82802ab(struct flashctx *flash);
132int erase_block_82802ab(struct flashctx *flash, unsigned int page, unsigned int pagesize);
133int write_82802ab(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len);
134void print_status_82802ab(uint8_t status);
135int unlock_28f004s5(struct flashctx *flash);
136int unlock_lh28f008bjt(struct flashctx *flash);
137
138/* jedec.c */
139uint8_t oddparity(uint8_t val);
140void toggle_ready_jedec(const struct flashctx *flash, chipaddr dst);
141void data_polling_jedec(const struct flashctx *flash, chipaddr dst, uint8_t data);
142int probe_jedec(struct flashctx *flash);
143int probe_jedec_29gl(struct flashctx *flash);
144int write_jedec(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len);
145int write_jedec_1(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len);
146int erase_sector_jedec(struct flashctx *flash, unsigned int page, unsigned int pagesize);
147int erase_block_jedec(struct flashctx *flash, unsigned int page, unsigned int blocksize);
148int erase_chip_block_jedec(struct flashctx *flash, unsigned int page, unsigned int blocksize);
149
150int unlock_regspace2_uniform_32k(struct flashctx *flash);
151int unlock_regspace2_uniform_64k(struct flashctx *flash);
152int unlock_regspace2_block_eraser_0(struct flashctx *flash);
153int unlock_regspace2_block_eraser_1(struct flashctx *flash);
154int printlock_regspace2_uniform_64k(struct flashctx *flash);
155int printlock_regspace2_block_eraser_0(struct flashctx *flash);
156int printlock_regspace2_block_eraser_1(struct flashctx *flash);
157
158/* sst28sf040.c */
159int erase_chip_28sf040(struct flashctx *flash, unsigned int addr, unsigned int blocklen);
160int erase_sector_28sf040(struct flashctx *flash, unsigned int address, unsigned int sector_size);
161int write_28sf040(struct flashctx *flash, const uint8_t *buf,unsigned int start, unsigned int len);
162int unprotect_28sf040(struct flashctx *flash);
163int protect_28sf040(struct flashctx *flash);
164
165/* sst49lfxxxc.c */
166int erase_sector_49lfxxxc(struct flashctx *flash, unsigned int address, unsigned int sector_size);
167
168/* sst_fwhub.c */
169int printlock_sst_fwhub(struct flashctx *flash);
170int unlock_sst_fwhub(struct flashctx *flash);
171
172/* w39.c */
173int printlock_w39f010(struct flashctx * flash);
174int printlock_w39l010(struct flashctx * flash);
175int printlock_w39l020(struct flashctx * flash);
176int printlock_w39l040(struct flashctx * flash);
177int printlock_w39v040a(struct flashctx *flash);
178int printlock_w39v040b(struct flashctx *flash);
179int printlock_w39v040c(struct flashctx *flash);
180int printlock_w39v040fa(struct flashctx *flash);
181int printlock_w39v040fb(struct flashctx *flash);
182int printlock_w39v040fc(struct flashctx *flash);
183int printlock_w39v080a(struct flashctx *flash);
184int printlock_w39v080fa(struct flashctx *flash);
185int printlock_w39v080fa_dual(struct flashctx *flash);
186int printlock_at49f(struct flashctx *flash);
187
188/* w29ee011.c */
189int probe_w29ee011(struct flashctx *flash);
190
191/* stm50.c */
192int erase_sector_stm50(struct flashctx *flash, unsigned int block, unsigned int blocksize);
193
194/* en29lv640b.c */
195int probe_en29lv640b(struct flashctx *flash);
196int write_en29lv640b(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len);
197
198#endif /* !__CHIPDRIVERS_H__ */

Archive Download this file

Revision: HEAD