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); |
| 32 | int probe_spi_res(struct flashchip *flash); |
| 33 | int spi_write_enable(void); |
| 34 | int spi_write_disable(void); |
| 35 | int spi_chip_erase_60(struct flashchip *flash); |
| 36 | int spi_chip_erase_c7(struct flashchip *flash); |
| 37 | int spi_chip_erase_60_c7(struct flashchip *flash); |
| 38 | int spi_chip_erase_d8(struct flashchip *flash); |
| 39 | int spi_block_erase_20(struct flashchip *flash, unsigned int addr, unsigned int blocklen); |
| 40 | int spi_block_erase_52(struct flashchip *flash, unsigned int addr, unsigned int blocklen); |
| 41 | int spi_block_erase_d8(struct flashchip *flash, unsigned int addr, unsigned int blocklen); |
| 42 | int spi_block_erase_60(struct flashchip *flash, unsigned int addr, unsigned int blocklen); |
| 43 | int spi_block_erase_c7(struct flashchip *flash, unsigned int addr, unsigned int blocklen); |
| 44 | int spi_chip_write_1(struct flashchip *flash, uint8_t *buf); |
| 45 | int spi_chip_write_256(struct flashchip *flash, uint8_t *buf); |
| 46 | int spi_chip_read(struct flashchip *flash, uint8_t *buf, int start, int len); |
| 47 | uint8_t spi_read_status_register(void); |
| 48 | int spi_disable_blockprotect(void); |
| 49 | int spi_byte_program(int addr, uint8_t byte); |
| 50 | int spi_nbyte_program(int addr, uint8_t *bytes, int len); |
| 51 | int spi_nbyte_read(int addr, uint8_t *bytes, int len); |
| 52 | int spi_read_chunked(struct flashchip *flash, uint8_t *buf, int start, int len, int chunksize); |
| 53 | int spi_aai_write(struct flashchip *flash, uint8_t *buf); |
| 54 | |
| 55 | /* 82802ab.c */ |
| 56 | int probe_82802ab(struct flashchip *flash); |
| 57 | int erase_82802ab(struct flashchip *flash); |
| 58 | int write_82802ab(struct flashchip *flash, uint8_t *buf); |
| 59 | |
| 60 | /* am29f040b.c */ |
| 61 | int probe_29f040b(struct flashchip *flash); |
| 62 | int erase_29f040b(struct flashchip *flash); |
| 63 | int write_29f040b(struct flashchip *flash, uint8_t *buf); |
| 64 | |
| 65 | /* pm29f002.c */ |
| 66 | int write_pm29f002(struct flashchip *flash, uint8_t *buf); |
| 67 | |
| 68 | /* en29f002a.c */ |
| 69 | int probe_en29f002a(struct flashchip *flash); |
| 70 | int erase_en29f002a(struct flashchip *flash); |
| 71 | int write_en29f002a(struct flashchip *flash, uint8_t *buf); |
| 72 | |
| 73 | /* jedec.c */ |
| 74 | uint8_t oddparity(uint8_t val); |
| 75 | void toggle_ready_jedec(chipaddr dst); |
| 76 | void data_polling_jedec(chipaddr dst, uint8_t data); |
| 77 | void start_program_jedec(chipaddr bios); |
| 78 | int write_byte_program_jedec(chipaddr bios, uint8_t *src, |
| 79 | chipaddr dst); |
| 80 | int probe_jedec(struct flashchip *flash); |
| 81 | int erase_chip_jedec(struct flashchip *flash); |
| 82 | int write_jedec(struct flashchip *flash, uint8_t *buf); |
| 83 | int write_jedec_1(struct flashchip *flash, uint8_t *buf); |
| 84 | int erase_sector_jedec(struct flashchip *flash, unsigned int page, unsigned int pagesize); |
| 85 | int erase_block_jedec(struct flashchip *flash, unsigned int page, unsigned int blocksize); |
| 86 | int write_sector_jedec(chipaddr bios, uint8_t *src, |
| 87 | chipaddr dst, unsigned int page_size); |
| 88 | |
| 89 | /* m29f002.c */ |
| 90 | int erase_m29f002(struct flashchip *flash); |
| 91 | int write_m29f002t(struct flashchip *flash, uint8_t *buf); |
| 92 | int write_m29f002b(struct flashchip *flash, uint8_t *buf); |
| 93 | |
| 94 | /* m29f400bt.c */ |
| 95 | int probe_m29f400bt(struct flashchip *flash); |
| 96 | int erase_m29f400bt(struct flashchip *flash); |
| 97 | int block_erase_m29f400bt(struct flashchip *flash, int start, int len); |
| 98 | int write_m29f400bt(struct flashchip *flash, uint8_t *buf); |
| 99 | int write_coreboot_m29f400bt(struct flashchip *flash, uint8_t *buf); |
Carl-Daniel Hailfinger | 5d5c072 | 2009-12-14 03:32:24 +0000 | [diff] [blame] | 100 | void protect_m29f400bt(chipaddr bios); |
| 101 | void write_page_m29f400bt(chipaddr bios, uint8_t *src, |
| 102 | chipaddr dst, int page_size); |
| 103 | |
| 104 | /* mx29f002.c */ |
| 105 | int probe_29f002(struct flashchip *flash); |
| 106 | int erase_29f002(struct flashchip *flash); |
| 107 | int write_29f002(struct flashchip *flash, uint8_t *buf); |
| 108 | |
| 109 | /* pm49fl00x.c */ |
| 110 | int probe_49fl00x(struct flashchip *flash); |
| 111 | int erase_49fl00x(struct flashchip *flash); |
| 112 | int write_49fl00x(struct flashchip *flash, uint8_t *buf); |
| 113 | |
| 114 | /* sharplhf00l04.c */ |
| 115 | int probe_lhf00l04(struct flashchip *flash); |
| 116 | int erase_lhf00l04(struct flashchip *flash); |
| 117 | int write_lhf00l04(struct flashchip *flash, uint8_t *buf); |
Carl-Daniel Hailfinger | 5d5c072 | 2009-12-14 03:32:24 +0000 | [diff] [blame] | 118 | void protect_lhf00l04(chipaddr bios); |
| 119 | |
| 120 | /* sst28sf040.c */ |
| 121 | int probe_28sf040(struct flashchip *flash); |
| 122 | int erase_28sf040(struct flashchip *flash); |
| 123 | int write_28sf040(struct flashchip *flash, uint8_t *buf); |
| 124 | |
| 125 | /* sst39sf020.c */ |
| 126 | int probe_39sf020(struct flashchip *flash); |
| 127 | int write_39sf020(struct flashchip *flash, uint8_t *buf); |
| 128 | |
| 129 | /* sst49lf040.c */ |
| 130 | int erase_49lf040(struct flashchip *flash); |
| 131 | int write_49lf040(struct flashchip *flash, uint8_t *buf); |
| 132 | |
| 133 | /* sst49lfxxxc.c */ |
| 134 | int probe_49lfxxxc(struct flashchip *flash); |
| 135 | int erase_49lfxxxc(struct flashchip *flash); |
| 136 | int write_49lfxxxc(struct flashchip *flash, uint8_t *buf); |
| 137 | |
| 138 | /* sst_fwhub.c */ |
| 139 | int probe_sst_fwhub(struct flashchip *flash); |
| 140 | int erase_sst_fwhub(struct flashchip *flash); |
| 141 | int erase_sst_fwhub_block(struct flashchip *flash, unsigned int offset, unsigned int page_size); |
| 142 | int write_sst_fwhub(struct flashchip *flash, uint8_t *buf); |
| 143 | |
| 144 | /* w39v040c.c */ |
| 145 | int probe_w39v040c(struct flashchip *flash); |
| 146 | int erase_w39v040c(struct flashchip *flash); |
| 147 | int write_w39v040c(struct flashchip *flash, uint8_t *buf); |
| 148 | |
| 149 | /* w39V080fa.c */ |
| 150 | int probe_winbond_fwhub(struct flashchip *flash); |
| 151 | int erase_winbond_fwhub(struct flashchip *flash); |
| 152 | int write_winbond_fwhub(struct flashchip *flash, uint8_t *buf); |
| 153 | |
| 154 | /* w29ee011.c */ |
| 155 | int probe_w29ee011(struct flashchip *flash); |
| 156 | |
| 157 | /* w49f002u.c */ |
| 158 | int write_49f002(struct flashchip *flash, uint8_t *buf); |
| 159 | |
| 160 | /* stm50flw0x0x.c */ |
| 161 | int probe_stm50flw0x0x(struct flashchip *flash); |
| 162 | int erase_stm50flw0x0x(struct flashchip *flash); |
| 163 | int write_stm50flw0x0x(struct flashchip *flash, uint8_t *buf); |
| 164 | |
| 165 | #endif /* !__CHIPDRIVERS_H__ */ |