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 | * |
| 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 */ |
| 29 | int probe_spi_rdid(struct flashchip *flash); |
| 30 | int probe_spi_rdid4(struct flashchip *flash); |
| 31 | int probe_spi_rems(struct flashchip *flash); |
Carl-Daniel Hailfinger | dc1cda1 | 2010-05-28 17:07:57 +0000 | [diff] [blame] | 32 | int probe_spi_res1(struct flashchip *flash); |
| 33 | int probe_spi_res2(struct flashchip *flash); |
Carl-Daniel Hailfinger | 5d5c072 | 2009-12-14 03:32:24 +0000 | [diff] [blame] | 34 | int spi_write_enable(void); |
| 35 | int spi_write_disable(void); |
Carl-Daniel Hailfinger | 5d5c072 | 2009-12-14 03:32:24 +0000 | [diff] [blame] | 36 | int spi_block_erase_20(struct flashchip *flash, unsigned int addr, unsigned int blocklen); |
| 37 | int spi_block_erase_52(struct flashchip *flash, unsigned int addr, unsigned int blocklen); |
Sean Nelson | 5643c07 | 2010-01-19 03:23:07 +0000 | [diff] [blame] | 38 | int spi_block_erase_d7(struct flashchip *flash, unsigned int addr, unsigned int blocklen); |
Carl-Daniel Hailfinger | 5d5c072 | 2009-12-14 03:32:24 +0000 | [diff] [blame] | 39 | int spi_block_erase_d8(struct flashchip *flash, unsigned int addr, unsigned int blocklen); |
| 40 | int spi_block_erase_60(struct flashchip *flash, unsigned int addr, unsigned int blocklen); |
| 41 | int spi_block_erase_c7(struct flashchip *flash, unsigned int addr, unsigned int blocklen); |
Carl-Daniel Hailfinger | 75a58f9 | 2010-10-13 22:26:56 +0000 | [diff] [blame] | 42 | int spi_chip_write_1(struct flashchip *flash, uint8_t *buf, int start, int len); |
| 43 | int spi_chip_write_256(struct flashchip *flash, uint8_t *buf, int start, int len); |
Carl-Daniel Hailfinger | 5d5c072 | 2009-12-14 03:32:24 +0000 | [diff] [blame] | 44 | int spi_chip_read(struct flashchip *flash, uint8_t *buf, int start, int len); |
| 45 | uint8_t spi_read_status_register(void); |
Carl-Daniel Hailfinger | 7a3bd8f | 2011-05-19 00:06:06 +0000 | [diff] [blame] | 46 | int spi_write_status_register(struct flashchip *flash, int status); |
| 47 | void spi_prettyprint_status_register_bit(uint8_t status, int bit); |
| 48 | void spi_prettyprint_status_register_bp3210(uint8_t status, int bp); |
| 49 | void spi_prettyprint_status_register_welwip(uint8_t status); |
| 50 | int spi_prettyprint_status_register(struct flashchip *flash); |
Carl-Daniel Hailfinger | 29a1c66 | 2010-07-14 20:21:22 +0000 | [diff] [blame] | 51 | int spi_disable_blockprotect(struct flashchip *flash); |
Michael Karcher | 4e2fb0e | 2010-01-12 23:29:26 +0000 | [diff] [blame] | 52 | int spi_byte_program(int addr, uint8_t databyte); |
Carl-Daniel Hailfinger | 5d5c072 | 2009-12-14 03:32:24 +0000 | [diff] [blame] | 53 | int spi_nbyte_program(int addr, uint8_t *bytes, int len); |
| 54 | int spi_nbyte_read(int addr, uint8_t *bytes, int len); |
| 55 | int spi_read_chunked(struct flashchip *flash, uint8_t *buf, int start, int len, int chunksize); |
Carl-Daniel Hailfinger | 5824fbf | 2010-05-21 23:09:42 +0000 | [diff] [blame] | 56 | int spi_write_chunked(struct flashchip *flash, uint8_t *buf, int start, int len, int chunksize); |
Carl-Daniel Hailfinger | 75a58f9 | 2010-10-13 22:26:56 +0000 | [diff] [blame] | 57 | int spi_aai_write(struct flashchip *flash, uint8_t *buf, int start, int len); |
Carl-Daniel Hailfinger | 5d5c072 | 2009-12-14 03:32:24 +0000 | [diff] [blame] | 58 | |
Carl-Daniel Hailfinger | 7a3bd8f | 2011-05-19 00:06:06 +0000 | [diff] [blame] | 59 | /* a25.c */ |
| 60 | int spi_prettyprint_status_register_amic_a25l05p(struct flashchip *flash); |
| 61 | int spi_prettyprint_status_register_amic_a25l40p(struct flashchip *flash); |
| 62 | int spi_prettyprint_status_register_amic_a25l032(struct flashchip *flash); |
| 63 | int spi_prettyprint_status_register_amic_a25lq032(struct flashchip *flash); |
| 64 | |
| 65 | /* at25.c */ |
| 66 | int spi_prettyprint_status_register_at25df(struct flashchip *flash); |
| 67 | int spi_prettyprint_status_register_at25df_sec(struct flashchip *flash); |
| 68 | int spi_prettyprint_status_register_at25f(struct flashchip *flash); |
| 69 | int spi_prettyprint_status_register_at25fs010(struct flashchip *flash); |
| 70 | int spi_prettyprint_status_register_at25fs040(struct flashchip *flash); |
| 71 | int spi_prettyprint_status_register_atmel_at26df081a(struct flashchip *flash); |
| 72 | int spi_disable_blockprotect_at25df(struct flashchip *flash); |
| 73 | int spi_disable_blockprotect_at25df_sec(struct flashchip *flash); |
| 74 | int spi_disable_blockprotect_at25f(struct flashchip *flash); |
| 75 | int spi_disable_blockprotect_at25fs010(struct flashchip *flash); |
| 76 | int spi_disable_blockprotect_at25fs040(struct flashchip *flash); |
| 77 | |
Carl-Daniel Hailfinger | 5d5c072 | 2009-12-14 03:32:24 +0000 | [diff] [blame] | 78 | /* 82802ab.c */ |
Carl-Daniel Hailfinger | b30a5ed | 2010-10-10 14:02:27 +0000 | [diff] [blame] | 79 | uint8_t wait_82802ab(struct flashchip *flash); |
Carl-Daniel Hailfinger | 5d5c072 | 2009-12-14 03:32:24 +0000 | [diff] [blame] | 80 | int probe_82802ab(struct flashchip *flash); |
Sean Nelson | 28accc2 | 2010-03-19 18:47:06 +0000 | [diff] [blame] | 81 | int erase_block_82802ab(struct flashchip *flash, unsigned int page, unsigned int pagesize); |
Carl-Daniel Hailfinger | 75a58f9 | 2010-10-13 22:26:56 +0000 | [diff] [blame] | 82 | int write_82802ab(struct flashchip *flash, uint8_t *buf, int start, int len); |
Sean Nelson | 28accc2 | 2010-03-19 18:47:06 +0000 | [diff] [blame] | 83 | void print_status_82802ab(uint8_t status); |
Sean Nelson | 28accc2 | 2010-03-19 18:47:06 +0000 | [diff] [blame] | 84 | int unlock_82802ab(struct flashchip *flash); |
Sean Nelson | 8864710 | 2010-03-22 06:57:02 +0000 | [diff] [blame] | 85 | int unlock_28f004s5(struct flashchip *flash); |
Carl-Daniel Hailfinger | 5d5c072 | 2009-12-14 03:32:24 +0000 | [diff] [blame] | 86 | |
Carl-Daniel Hailfinger | 5d5c072 | 2009-12-14 03:32:24 +0000 | [diff] [blame] | 87 | /* jedec.c */ |
| 88 | uint8_t oddparity(uint8_t val); |
| 89 | void toggle_ready_jedec(chipaddr dst); |
| 90 | void data_polling_jedec(chipaddr dst, uint8_t data); |
Carl-Daniel Hailfinger | 5d5c072 | 2009-12-14 03:32:24 +0000 | [diff] [blame] | 91 | int write_byte_program_jedec(chipaddr bios, uint8_t *src, |
| 92 | chipaddr dst); |
| 93 | int probe_jedec(struct flashchip *flash); |
Carl-Daniel Hailfinger | 75a58f9 | 2010-10-13 22:26:56 +0000 | [diff] [blame] | 94 | int write_jedec(struct flashchip *flash, uint8_t *buf, int start, int len); |
| 95 | int write_jedec_1(struct flashchip *flash, uint8_t *buf, int start, int len); |
Carl-Daniel Hailfinger | 5d5c072 | 2009-12-14 03:32:24 +0000 | [diff] [blame] | 96 | int erase_sector_jedec(struct flashchip *flash, unsigned int page, unsigned int pagesize); |
| 97 | int erase_block_jedec(struct flashchip *flash, unsigned int page, unsigned int blocksize); |
Sean Nelson | 72a9a02 | 2009-12-22 22:15:33 +0000 | [diff] [blame] | 98 | int erase_chip_block_jedec(struct flashchip *flash, unsigned int page, unsigned int blocksize); |
Carl-Daniel Hailfinger | 5d5c072 | 2009-12-14 03:32:24 +0000 | [diff] [blame] | 99 | |
Carl-Daniel Hailfinger | 5d5c072 | 2009-12-14 03:32:24 +0000 | [diff] [blame] | 100 | /* m29f400bt.c */ |
| 101 | int probe_m29f400bt(struct flashchip *flash); |
Sean Nelson | 6b11ad2 | 2009-12-23 17:05:59 +0000 | [diff] [blame] | 102 | int block_erase_m29f400bt(struct flashchip *flash, unsigned int start, unsigned int len); |
| 103 | int block_erase_chip_m29f400bt(struct flashchip *flash, unsigned int start, unsigned int len); |
Carl-Daniel Hailfinger | 75a58f9 | 2010-10-13 22:26:56 +0000 | [diff] [blame] | 104 | int write_m29f400bt(struct flashchip *flash, uint8_t *buf, int start, int len); |
Carl-Daniel Hailfinger | 5d5c072 | 2009-12-14 03:32:24 +0000 | [diff] [blame] | 105 | void protect_m29f400bt(chipaddr bios); |
Carl-Daniel Hailfinger | 5d5c072 | 2009-12-14 03:32:24 +0000 | [diff] [blame] | 106 | |
Carl-Daniel Hailfinger | 5d5c072 | 2009-12-14 03:32:24 +0000 | [diff] [blame] | 107 | /* pm49fl00x.c */ |
Sean Nelson | 6e0b912 | 2010-02-19 00:52:10 +0000 | [diff] [blame] | 108 | int unlock_49fl00x(struct flashchip *flash); |
Sean Nelson | 3617234 | 2010-02-27 18:01:15 +0000 | [diff] [blame] | 109 | int lock_49fl00x(struct flashchip *flash); |
Carl-Daniel Hailfinger | 5d5c072 | 2009-12-14 03:32:24 +0000 | [diff] [blame] | 110 | |
Carl-Daniel Hailfinger | 5d5c072 | 2009-12-14 03:32:24 +0000 | [diff] [blame] | 111 | /* sst28sf040.c */ |
Sean Nelson | 51c83fb | 2010-01-20 20:55:53 +0000 | [diff] [blame] | 112 | int erase_chip_28sf040(struct flashchip *flash, unsigned int addr, unsigned int blocklen); |
| 113 | int erase_sector_28sf040(struct flashchip *flash, unsigned int address, unsigned int sector_size); |
Carl-Daniel Hailfinger | 75a58f9 | 2010-10-13 22:26:56 +0000 | [diff] [blame] | 114 | int write_28sf040(struct flashchip *flash, uint8_t *buf, int start, int len); |
Carl-Daniel Hailfinger | 79e6757 | 2010-10-13 21:49:30 +0000 | [diff] [blame] | 115 | int unprotect_28sf040(struct flashchip *flash); |
| 116 | int protect_28sf040(struct flashchip *flash); |
Carl-Daniel Hailfinger | 5d5c072 | 2009-12-14 03:32:24 +0000 | [diff] [blame] | 117 | |
Carl-Daniel Hailfinger | 5d5c072 | 2009-12-14 03:32:24 +0000 | [diff] [blame] | 118 | /* sst49lfxxxc.c */ |
Sean Nelson | 51c83fb | 2010-01-20 20:55:53 +0000 | [diff] [blame] | 119 | int erase_sector_49lfxxxc(struct flashchip *flash, unsigned int address, unsigned int sector_size); |
Sean Nelson | 6e0b912 | 2010-02-19 00:52:10 +0000 | [diff] [blame] | 120 | int unlock_49lfxxxc(struct flashchip *flash); |
Carl-Daniel Hailfinger | 5d5c072 | 2009-12-14 03:32:24 +0000 | [diff] [blame] | 121 | |
| 122 | /* sst_fwhub.c */ |
Carl-Daniel Hailfinger | 81449a2 | 2010-03-15 03:48:42 +0000 | [diff] [blame] | 123 | int printlock_sst_fwhub(struct flashchip *flash); |
Sean Nelson | ccf7a2a | 2010-03-16 03:09:10 +0000 | [diff] [blame] | 124 | int unlock_sst_fwhub(struct flashchip *flash); |
Carl-Daniel Hailfinger | 5d5c072 | 2009-12-14 03:32:24 +0000 | [diff] [blame] | 125 | |
Carl-Daniel Hailfinger | 9188240 | 2010-12-05 16:33:59 +0000 | [diff] [blame] | 126 | /* w39.c */ |
Michael Karcher | 19e0aac | 2011-03-06 17:58:05 +0000 | [diff] [blame] | 127 | int printlock_w39l040(struct flashchip * flash); |
Carl-Daniel Hailfinger | 9188240 | 2010-12-05 16:33:59 +0000 | [diff] [blame] | 128 | int printlock_w39v040a(struct flashchip *flash); |
| 129 | int printlock_w39v040b(struct flashchip *flash); |
Sean Nelson | 6e0b912 | 2010-02-19 00:52:10 +0000 | [diff] [blame] | 130 | int printlock_w39v040c(struct flashchip *flash); |
Carl-Daniel Hailfinger | 9188240 | 2010-12-05 16:33:59 +0000 | [diff] [blame] | 131 | int printlock_w39v040fa(struct flashchip *flash); |
| 132 | int printlock_w39v040fb(struct flashchip *flash); |
| 133 | int printlock_w39v040fc(struct flashchip *flash); |
| 134 | int printlock_w39v080a(struct flashchip *flash); |
| 135 | int printlock_w39v080fa(struct flashchip *flash); |
| 136 | int printlock_w39v080fa_dual(struct flashchip *flash); |
Idwer Vollering | ecc6707 | 2010-12-26 23:55:12 +0000 | [diff] [blame] | 137 | int unlock_w39v040fb(struct flashchip *flash); |
Carl-Daniel Hailfinger | 9188240 | 2010-12-05 16:33:59 +0000 | [diff] [blame] | 138 | int unlock_w39v080fa(struct flashchip *flash); |
Carl-Daniel Hailfinger | 5d5c072 | 2009-12-14 03:32:24 +0000 | [diff] [blame] | 139 | |
| 140 | /* w29ee011.c */ |
| 141 | int probe_w29ee011(struct flashchip *flash); |
| 142 | |
Carl-Daniel Hailfinger | 5d5c072 | 2009-12-14 03:32:24 +0000 | [diff] [blame] | 143 | /* stm50flw0x0x.c */ |
Sean Nelson | 56358aa | 2010-01-19 16:08:51 +0000 | [diff] [blame] | 144 | int erase_sector_stm50flw0x0x(struct flashchip *flash, unsigned int block, unsigned int blocksize); |
Sean Nelson | 28accc2 | 2010-03-19 18:47:06 +0000 | [diff] [blame] | 145 | int unlock_stm50flw0x0x(struct flashchip *flash); |
Carl-Daniel Hailfinger | 5d5c072 | 2009-12-14 03:32:24 +0000 | [diff] [blame] | 146 | |
| 147 | #endif /* !__CHIPDRIVERS_H__ */ |