| Carl-Daniel Hailfinger | 5d5c072 | 2009-12-14 03:32:24 +0000 | [diff] [blame] | 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 | * |
| Carl-Daniel Hailfinger | 5d5c072 | 2009-12-14 03:32:24 +0000 | [diff] [blame] | 15 | * 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 Hailfinger | 63fd902 | 2011-12-14 22:25:15 +0000 | [diff] [blame] | 17 | * struct flashctx as first parameter. |
| Carl-Daniel Hailfinger | 5d5c072 | 2009-12-14 03:32:24 +0000 | [diff] [blame] | 18 | */ |
| 19 | |
| 20 | #ifndef __CHIPDRIVERS_H__ |
| 21 | #define __CHIPDRIVERS_H__ 1 |
| 22 | |
| Carl-Daniel Hailfinger | 63fd902 | 2011-12-14 22:25:15 +0000 | [diff] [blame] | 23 | #include "flash.h" /* for chipaddr and flashctx */ |
| Stefan Tauner | a63c7c4 | 2011-08-16 12:08:22 +0000 | [diff] [blame] | 24 | |
| Carl-Daniel Hailfinger | 532c717 | 2011-11-04 21:35:26 +0000 | [diff] [blame] | 25 | /* opaque.c */ |
| Carl-Daniel Hailfinger | 63fd902 | 2011-12-14 22:25:15 +0000 | [diff] [blame] | 26 | int probe_opaque(struct flashctx *flash); |
| 27 | int read_opaque(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len); |
| Mark Marshall | f20b7be | 2014-05-09 21:16:21 +0000 | [diff] [blame] | 28 | int write_opaque(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len); |
| Carl-Daniel Hailfinger | 63fd902 | 2011-12-14 22:25:15 +0000 | [diff] [blame] | 29 | int erase_opaque(struct flashctx *flash, unsigned int blockaddr, unsigned int blocklen); |
| Carl-Daniel Hailfinger | 532c717 | 2011-11-04 21:35:26 +0000 | [diff] [blame] | 30 | |
| Carl-Daniel Hailfinger | 5d5c072 | 2009-12-14 03:32:24 +0000 | [diff] [blame] | 31 | /* 82802ab.c */ |
| Carl-Daniel Hailfinger | 63fd902 | 2011-12-14 22:25:15 +0000 | [diff] [blame] | 32 | uint8_t wait_82802ab(struct flashctx *flash); |
| 33 | int probe_82802ab(struct flashctx *flash); |
| 34 | int erase_block_82802ab(struct flashctx *flash, unsigned int page, unsigned int pagesize); |
| Mark Marshall | f20b7be | 2014-05-09 21:16:21 +0000 | [diff] [blame] | 35 | int write_82802ab(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len); |
| Sean Nelson | 28accc2 | 2010-03-19 18:47:06 +0000 | [diff] [blame] | 36 | void print_status_82802ab(uint8_t status); |
| Carl-Daniel Hailfinger | 63fd902 | 2011-12-14 22:25:15 +0000 | [diff] [blame] | 37 | int unlock_28f004s5(struct flashctx *flash); |
| 38 | int unlock_lh28f008bjt(struct flashctx *flash); |
| Carl-Daniel Hailfinger | 5d5c072 | 2009-12-14 03:32:24 +0000 | [diff] [blame] | 39 | |
| Carl-Daniel Hailfinger | 5d5c072 | 2009-12-14 03:32:24 +0000 | [diff] [blame] | 40 | /* jedec.c */ |
| 41 | uint8_t oddparity(uint8_t val); |
| Stefan Tauner | 0ab1e5d | 2014-05-29 11:51:24 +0000 | [diff] [blame] | 42 | void toggle_ready_jedec(const struct flashctx *flash, chipaddr dst); |
| 43 | void data_polling_jedec(const struct flashctx *flash, chipaddr dst, uint8_t data); |
| Carl-Daniel Hailfinger | 63fd902 | 2011-12-14 22:25:15 +0000 | [diff] [blame] | 44 | int probe_jedec(struct flashctx *flash); |
| Stefan Tauner | 03a9c3c | 2014-08-03 14:15:14 +0000 | [diff] [blame] | 45 | int probe_jedec_29gl(struct flashctx *flash); |
| Mark Marshall | f20b7be | 2014-05-09 21:16:21 +0000 | [diff] [blame] | 46 | int write_jedec(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len); |
| 47 | int write_jedec_1(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len); |
| Carl-Daniel Hailfinger | 63fd902 | 2011-12-14 22:25:15 +0000 | [diff] [blame] | 48 | int erase_sector_jedec(struct flashctx *flash, unsigned int page, unsigned int pagesize); |
| 49 | int erase_block_jedec(struct flashctx *flash, unsigned int page, unsigned int blocksize); |
| 50 | int erase_chip_block_jedec(struct flashctx *flash, unsigned int page, unsigned int blocksize); |
| Carl-Daniel Hailfinger | 5d5c072 | 2009-12-14 03:32:24 +0000 | [diff] [blame] | 51 | |
| Carl-Daniel Hailfinger | ef3ac8a | 2014-08-03 13:05:34 +0000 | [diff] [blame] | 52 | int unlock_regspace2_uniform_32k(struct flashctx *flash); |
| 53 | int unlock_regspace2_uniform_64k(struct flashctx *flash); |
| 54 | int unlock_regspace2_block_eraser_0(struct flashctx *flash); |
| 55 | int unlock_regspace2_block_eraser_1(struct flashctx *flash); |
| Carl-Daniel Hailfinger | ef3ac8a | 2014-08-03 13:05:34 +0000 | [diff] [blame] | 56 | int printlock_regspace2_uniform_64k(struct flashctx *flash); |
| 57 | int printlock_regspace2_block_eraser_0(struct flashctx *flash); |
| 58 | int printlock_regspace2_block_eraser_1(struct flashctx *flash); |
| 59 | |
| Carl-Daniel Hailfinger | 5d5c072 | 2009-12-14 03:32:24 +0000 | [diff] [blame] | 60 | /* sst28sf040.c */ |
| Carl-Daniel Hailfinger | 63fd902 | 2011-12-14 22:25:15 +0000 | [diff] [blame] | 61 | int erase_chip_28sf040(struct flashctx *flash, unsigned int addr, unsigned int blocklen); |
| 62 | int erase_sector_28sf040(struct flashctx *flash, unsigned int address, unsigned int sector_size); |
| Edward O'Callaghan | d1fbc46 | 2020-12-19 11:57:30 +1100 | [diff] [blame] | 63 | int write_28sf040(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len); |
| Carl-Daniel Hailfinger | 63fd902 | 2011-12-14 22:25:15 +0000 | [diff] [blame] | 64 | int unprotect_28sf040(struct flashctx *flash); |
| 65 | int protect_28sf040(struct flashctx *flash); |
| Carl-Daniel Hailfinger | 5d5c072 | 2009-12-14 03:32:24 +0000 | [diff] [blame] | 66 | |
| Carl-Daniel Hailfinger | 5d5c072 | 2009-12-14 03:32:24 +0000 | [diff] [blame] | 67 | /* sst49lfxxxc.c */ |
| Carl-Daniel Hailfinger | 63fd902 | 2011-12-14 22:25:15 +0000 | [diff] [blame] | 68 | int erase_sector_49lfxxxc(struct flashctx *flash, unsigned int address, unsigned int sector_size); |
| Carl-Daniel Hailfinger | 5d5c072 | 2009-12-14 03:32:24 +0000 | [diff] [blame] | 69 | |
| 70 | /* sst_fwhub.c */ |
| Carl-Daniel Hailfinger | 63fd902 | 2011-12-14 22:25:15 +0000 | [diff] [blame] | 71 | int printlock_sst_fwhub(struct flashctx *flash); |
| 72 | int unlock_sst_fwhub(struct flashctx *flash); |
| Carl-Daniel Hailfinger | 5d5c072 | 2009-12-14 03:32:24 +0000 | [diff] [blame] | 73 | |
| Carl-Daniel Hailfinger | 9188240 | 2010-12-05 16:33:59 +0000 | [diff] [blame] | 74 | /* w39.c */ |
| Kyösti Mälkki | c31243e | 2012-10-28 01:50:08 +0000 | [diff] [blame] | 75 | int printlock_w39f010(struct flashctx * flash); |
| 76 | int printlock_w39l010(struct flashctx * flash); |
| 77 | int printlock_w39l020(struct flashctx * flash); |
| Carl-Daniel Hailfinger | 63fd902 | 2011-12-14 22:25:15 +0000 | [diff] [blame] | 78 | int printlock_w39l040(struct flashctx * flash); |
| 79 | int printlock_w39v040a(struct flashctx *flash); |
| 80 | int printlock_w39v040b(struct flashctx *flash); |
| 81 | int printlock_w39v040c(struct flashctx *flash); |
| 82 | int printlock_w39v040fa(struct flashctx *flash); |
| 83 | int printlock_w39v040fb(struct flashctx *flash); |
| 84 | int printlock_w39v040fc(struct flashctx *flash); |
| 85 | int printlock_w39v080a(struct flashctx *flash); |
| 86 | int printlock_w39v080fa(struct flashctx *flash); |
| 87 | int printlock_w39v080fa_dual(struct flashctx *flash); |
| David Borg | f5a30f6 | 2012-04-15 13:16:32 +0000 | [diff] [blame] | 88 | int printlock_at49f(struct flashctx *flash); |
| Carl-Daniel Hailfinger | 5d5c072 | 2009-12-14 03:32:24 +0000 | [diff] [blame] | 89 | |
| 90 | /* w29ee011.c */ |
| Carl-Daniel Hailfinger | 63fd902 | 2011-12-14 22:25:15 +0000 | [diff] [blame] | 91 | int probe_w29ee011(struct flashctx *flash); |
| Carl-Daniel Hailfinger | 5d5c072 | 2009-12-14 03:32:24 +0000 | [diff] [blame] | 92 | |
| Stefan Tauner | 4404f73 | 2013-09-12 08:28:56 +0000 | [diff] [blame] | 93 | /* stm50.c */ |
| 94 | int erase_sector_stm50(struct flashctx *flash, unsigned int block, unsigned int blocksize); |
| Carl-Daniel Hailfinger | 5d5c072 | 2009-12-14 03:32:24 +0000 | [diff] [blame] | 95 | |
| Rudolf Marek | 47eff6b | 2012-04-14 22:51:40 +0000 | [diff] [blame] | 96 | /* en29lv640b.c */ |
| 97 | int probe_en29lv640b(struct flashctx *flash); |
| Mark Marshall | f20b7be | 2014-05-09 21:16:21 +0000 | [diff] [blame] | 98 | int write_en29lv640b(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len); |
| Rudolf Marek | 47eff6b | 2012-04-14 22:51:40 +0000 | [diff] [blame] | 99 | |
| Nico Huber | 0e76d99 | 2023-01-12 20:22:55 +0100 | [diff] [blame] | 100 | /* memory_bus.c */ |
| Nico Huber | 9eec407 | 2023-01-12 01:17:30 +0100 | [diff] [blame] | 101 | int prepare_memory_access(struct flashctx *, enum preparation_steps); |
| Nico Huber | b197402 | 2023-01-12 13:13:12 +0100 | [diff] [blame] | 102 | int prepare_memory_register_access(struct flashctx *, enum preparation_steps); |
| Nico Huber | 9eec407 | 2023-01-12 01:17:30 +0100 | [diff] [blame] | 103 | void finish_memory_access(struct flashctx *); |
| 104 | |
| Carl-Daniel Hailfinger | 5d5c072 | 2009-12-14 03:32:24 +0000 | [diff] [blame] | 105 | #endif /* !__CHIPDRIVERS_H__ */ |