blob: 10fd84307796c81864ff1d9a14b2f806d00a7885 [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 *
Carl-Daniel Hailfinger5d5c0722009-12-14 03:32:24 +000015 * Header file for flash chip drivers. Included from flash.h.
16 * As a general rule, every function listed here should take a pointer to
Carl-Daniel Hailfinger63fd9022011-12-14 22:25:15 +000017 * struct flashctx as first parameter.
Carl-Daniel Hailfinger5d5c0722009-12-14 03:32:24 +000018 */
19
20#ifndef __CHIPDRIVERS_H__
21#define __CHIPDRIVERS_H__ 1
22
Carl-Daniel Hailfinger63fd9022011-12-14 22:25:15 +000023#include "flash.h" /* for chipaddr and flashctx */
Stefan Taunera63c7c42011-08-16 12:08:22 +000024
Carl-Daniel Hailfinger532c7172011-11-04 21:35:26 +000025/* opaque.c */
Carl-Daniel Hailfinger63fd9022011-12-14 22:25:15 +000026int probe_opaque(struct flashctx *flash);
27int read_opaque(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len);
Mark Marshallf20b7be2014-05-09 21:16:21 +000028int write_opaque(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len);
Carl-Daniel Hailfinger63fd9022011-12-14 22:25:15 +000029int erase_opaque(struct flashctx *flash, unsigned int blockaddr, unsigned int blocklen);
Carl-Daniel Hailfinger532c7172011-11-04 21:35:26 +000030
Carl-Daniel Hailfinger5d5c0722009-12-14 03:32:24 +000031/* 82802ab.c */
Carl-Daniel Hailfinger63fd9022011-12-14 22:25:15 +000032uint8_t wait_82802ab(struct flashctx *flash);
33int probe_82802ab(struct flashctx *flash);
34int erase_block_82802ab(struct flashctx *flash, unsigned int page, unsigned int pagesize);
Mark Marshallf20b7be2014-05-09 21:16:21 +000035int write_82802ab(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len);
Sean Nelson28accc22010-03-19 18:47:06 +000036void print_status_82802ab(uint8_t status);
Carl-Daniel Hailfinger63fd9022011-12-14 22:25:15 +000037int unlock_28f004s5(struct flashctx *flash);
38int unlock_lh28f008bjt(struct flashctx *flash);
Carl-Daniel Hailfinger5d5c0722009-12-14 03:32:24 +000039
Carl-Daniel Hailfinger5d5c0722009-12-14 03:32:24 +000040/* jedec.c */
41uint8_t oddparity(uint8_t val);
Stefan Tauner0ab1e5d2014-05-29 11:51:24 +000042void toggle_ready_jedec(const struct flashctx *flash, chipaddr dst);
43void data_polling_jedec(const struct flashctx *flash, chipaddr dst, uint8_t data);
Carl-Daniel Hailfinger63fd9022011-12-14 22:25:15 +000044int probe_jedec(struct flashctx *flash);
Stefan Tauner03a9c3c2014-08-03 14:15:14 +000045int probe_jedec_29gl(struct flashctx *flash);
Mark Marshallf20b7be2014-05-09 21:16:21 +000046int write_jedec(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len);
47int write_jedec_1(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len);
Carl-Daniel Hailfinger63fd9022011-12-14 22:25:15 +000048int erase_sector_jedec(struct flashctx *flash, unsigned int page, unsigned int pagesize);
49int erase_block_jedec(struct flashctx *flash, unsigned int page, unsigned int blocksize);
50int erase_chip_block_jedec(struct flashctx *flash, unsigned int page, unsigned int blocksize);
Carl-Daniel Hailfinger5d5c0722009-12-14 03:32:24 +000051
Carl-Daniel Hailfingeref3ac8a2014-08-03 13:05:34 +000052int unlock_regspace2_uniform_32k(struct flashctx *flash);
53int unlock_regspace2_uniform_64k(struct flashctx *flash);
54int unlock_regspace2_block_eraser_0(struct flashctx *flash);
55int unlock_regspace2_block_eraser_1(struct flashctx *flash);
Carl-Daniel Hailfingeref3ac8a2014-08-03 13:05:34 +000056int printlock_regspace2_uniform_64k(struct flashctx *flash);
57int printlock_regspace2_block_eraser_0(struct flashctx *flash);
58int printlock_regspace2_block_eraser_1(struct flashctx *flash);
59
Carl-Daniel Hailfinger5d5c0722009-12-14 03:32:24 +000060/* sst28sf040.c */
Carl-Daniel Hailfinger63fd9022011-12-14 22:25:15 +000061int erase_chip_28sf040(struct flashctx *flash, unsigned int addr, unsigned int blocklen);
62int erase_sector_28sf040(struct flashctx *flash, unsigned int address, unsigned int sector_size);
Edward O'Callaghand1fbc462020-12-19 11:57:30 +110063int write_28sf040(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len);
Carl-Daniel Hailfinger63fd9022011-12-14 22:25:15 +000064int unprotect_28sf040(struct flashctx *flash);
65int protect_28sf040(struct flashctx *flash);
Carl-Daniel Hailfinger5d5c0722009-12-14 03:32:24 +000066
Carl-Daniel Hailfinger5d5c0722009-12-14 03:32:24 +000067/* sst49lfxxxc.c */
Carl-Daniel Hailfinger63fd9022011-12-14 22:25:15 +000068int erase_sector_49lfxxxc(struct flashctx *flash, unsigned int address, unsigned int sector_size);
Carl-Daniel Hailfinger5d5c0722009-12-14 03:32:24 +000069
70/* sst_fwhub.c */
Carl-Daniel Hailfinger63fd9022011-12-14 22:25:15 +000071int printlock_sst_fwhub(struct flashctx *flash);
72int unlock_sst_fwhub(struct flashctx *flash);
Carl-Daniel Hailfinger5d5c0722009-12-14 03:32:24 +000073
Carl-Daniel Hailfinger91882402010-12-05 16:33:59 +000074/* w39.c */
Kyösti Mälkkic31243e2012-10-28 01:50:08 +000075int printlock_w39f010(struct flashctx * flash);
76int printlock_w39l010(struct flashctx * flash);
77int printlock_w39l020(struct flashctx * flash);
Carl-Daniel Hailfinger63fd9022011-12-14 22:25:15 +000078int printlock_w39l040(struct flashctx * flash);
79int printlock_w39v040a(struct flashctx *flash);
80int printlock_w39v040b(struct flashctx *flash);
81int printlock_w39v040c(struct flashctx *flash);
82int printlock_w39v040fa(struct flashctx *flash);
83int printlock_w39v040fb(struct flashctx *flash);
84int printlock_w39v040fc(struct flashctx *flash);
85int printlock_w39v080a(struct flashctx *flash);
86int printlock_w39v080fa(struct flashctx *flash);
87int printlock_w39v080fa_dual(struct flashctx *flash);
David Borgf5a30f62012-04-15 13:16:32 +000088int printlock_at49f(struct flashctx *flash);
Carl-Daniel Hailfinger5d5c0722009-12-14 03:32:24 +000089
90/* w29ee011.c */
Carl-Daniel Hailfinger63fd9022011-12-14 22:25:15 +000091int probe_w29ee011(struct flashctx *flash);
Carl-Daniel Hailfinger5d5c0722009-12-14 03:32:24 +000092
Stefan Tauner4404f732013-09-12 08:28:56 +000093/* stm50.c */
94int erase_sector_stm50(struct flashctx *flash, unsigned int block, unsigned int blocksize);
Carl-Daniel Hailfinger5d5c0722009-12-14 03:32:24 +000095
Rudolf Marek47eff6b2012-04-14 22:51:40 +000096/* en29lv640b.c */
97int probe_en29lv640b(struct flashctx *flash);
Mark Marshallf20b7be2014-05-09 21:16:21 +000098int write_en29lv640b(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len);
Rudolf Marek47eff6b2012-04-14 22:51:40 +000099
Paul Kocialkowski80ae14e2018-01-15 01:07:46 +0300100/* edi.c */
101int edi_chip_block_erase(struct flashctx *flash, unsigned int page, unsigned int size);
102int edi_chip_write(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len);
103int edi_chip_read(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len);
104int edi_probe_kb9012(struct flashctx *flash);
105
Nico Huber0e76d992023-01-12 20:22:55 +0100106/* memory_bus.c */
Nico Huber9eec4072023-01-12 01:17:30 +0100107int prepare_memory_access(struct flashctx *, enum preparation_steps);
Nico Huberb1974022023-01-12 13:13:12 +0100108int prepare_memory_register_access(struct flashctx *, enum preparation_steps);
Nico Huber9eec4072023-01-12 01:17:30 +0100109void finish_memory_access(struct flashctx *);
110
Carl-Daniel Hailfinger5d5c0722009-12-14 03:32:24 +0000111#endif /* !__CHIPDRIVERS_H__ */