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); |
Sean Nelson | 5643c07 | 2010-01-19 03:23:07 +0000 | [diff] [blame] | 41 | 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] | 42 | int spi_block_erase_d8(struct flashchip *flash, unsigned int addr, unsigned int blocklen); |
| 43 | int spi_block_erase_60(struct flashchip *flash, unsigned int addr, unsigned int blocklen); |
| 44 | int spi_block_erase_c7(struct flashchip *flash, unsigned int addr, unsigned int blocklen); |
| 45 | int spi_chip_write_1(struct flashchip *flash, uint8_t *buf); |
| 46 | int spi_chip_write_256(struct flashchip *flash, uint8_t *buf); |
| 47 | int spi_chip_read(struct flashchip *flash, uint8_t *buf, int start, int len); |
| 48 | uint8_t spi_read_status_register(void); |
| 49 | int spi_disable_blockprotect(void); |
Michael Karcher | 4e2fb0e | 2010-01-12 23:29:26 +0000 | [diff] [blame] | 50 | int spi_byte_program(int addr, uint8_t databyte); |
Carl-Daniel Hailfinger | 5d5c072 | 2009-12-14 03:32:24 +0000 | [diff] [blame] | 51 | int spi_nbyte_program(int addr, uint8_t *bytes, int len); |
| 52 | int spi_nbyte_read(int addr, uint8_t *bytes, int len); |
| 53 | int spi_read_chunked(struct flashchip *flash, uint8_t *buf, int start, int len, int chunksize); |
| 54 | int spi_aai_write(struct flashchip *flash, uint8_t *buf); |
| 55 | |
| 56 | /* 82802ab.c */ |
Carl-Daniel Hailfinger | aca1dce | 2010-01-07 21:23:45 +0000 | [diff] [blame] | 57 | uint8_t wait_82802ab(chipaddr bios); |
Carl-Daniel Hailfinger | 5d5c072 | 2009-12-14 03:32:24 +0000 | [diff] [blame] | 58 | int probe_82802ab(struct flashchip *flash); |
| 59 | int erase_82802ab(struct flashchip *flash); |
Sean Nelson | 5459637 | 2010-01-09 05:30:14 +0000 | [diff] [blame] | 60 | int erase_82802ab_block(struct flashchip *flash, unsigned int page, unsigned int pagesize); |
Carl-Daniel Hailfinger | 5d5c072 | 2009-12-14 03:32:24 +0000 | [diff] [blame] | 61 | int write_82802ab(struct flashchip *flash, uint8_t *buf); |
| 62 | |
Carl-Daniel Hailfinger | 5d5c072 | 2009-12-14 03:32:24 +0000 | [diff] [blame] | 63 | /* jedec.c */ |
| 64 | uint8_t oddparity(uint8_t val); |
| 65 | void toggle_ready_jedec(chipaddr dst); |
| 66 | void data_polling_jedec(chipaddr dst, uint8_t data); |
Carl-Daniel Hailfinger | 5d5c072 | 2009-12-14 03:32:24 +0000 | [diff] [blame] | 67 | int write_byte_program_jedec(chipaddr bios, uint8_t *src, |
| 68 | chipaddr dst); |
| 69 | int probe_jedec(struct flashchip *flash); |
| 70 | int erase_chip_jedec(struct flashchip *flash); |
| 71 | int write_jedec(struct flashchip *flash, uint8_t *buf); |
| 72 | int write_jedec_1(struct flashchip *flash, uint8_t *buf); |
| 73 | int erase_sector_jedec(struct flashchip *flash, unsigned int page, unsigned int pagesize); |
| 74 | 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] | 75 | int erase_chip_block_jedec(struct flashchip *flash, unsigned int page, unsigned int blocksize); |
Sean Nelson | c57a920 | 2010-01-04 17:15:23 +0000 | [diff] [blame] | 76 | int write_sector_jedec_common(struct flashchip *flash, uint8_t *src, chipaddr dst, unsigned int page_size, unsigned int mask); |
Carl-Daniel Hailfinger | 5d5c072 | 2009-12-14 03:32:24 +0000 | [diff] [blame] | 77 | |
Carl-Daniel Hailfinger | 5d5c072 | 2009-12-14 03:32:24 +0000 | [diff] [blame] | 78 | /* m29f400bt.c */ |
| 79 | int probe_m29f400bt(struct flashchip *flash); |
| 80 | int erase_m29f400bt(struct flashchip *flash); |
Sean Nelson | 6b11ad2 | 2009-12-23 17:05:59 +0000 | [diff] [blame] | 81 | int block_erase_m29f400bt(struct flashchip *flash, unsigned int start, unsigned int len); |
| 82 | int block_erase_chip_m29f400bt(struct flashchip *flash, unsigned int start, unsigned int len); |
Carl-Daniel Hailfinger | 5d5c072 | 2009-12-14 03:32:24 +0000 | [diff] [blame] | 83 | int write_m29f400bt(struct flashchip *flash, uint8_t *buf); |
| 84 | int write_coreboot_m29f400bt(struct flashchip *flash, uint8_t *buf); |
Carl-Daniel Hailfinger | 5d5c072 | 2009-12-14 03:32:24 +0000 | [diff] [blame] | 85 | void protect_m29f400bt(chipaddr bios); |
| 86 | void write_page_m29f400bt(chipaddr bios, uint8_t *src, |
| 87 | chipaddr dst, int page_size); |
| 88 | |
Carl-Daniel Hailfinger | 5d5c072 | 2009-12-14 03:32:24 +0000 | [diff] [blame] | 89 | /* pm49fl00x.c */ |
| 90 | int probe_49fl00x(struct flashchip *flash); |
| 91 | int erase_49fl00x(struct flashchip *flash); |
| 92 | int write_49fl00x(struct flashchip *flash, uint8_t *buf); |
Sean Nelson | 6e0b912 | 2010-02-19 00:52:10 +0000 | [diff] [blame] | 93 | int unlock_49fl00x(struct flashchip *flash); |
Carl-Daniel Hailfinger | 5d5c072 | 2009-12-14 03:32:24 +0000 | [diff] [blame] | 94 | |
| 95 | /* sharplhf00l04.c */ |
| 96 | int probe_lhf00l04(struct flashchip *flash); |
Carl-Daniel Hailfinger | aca1dce | 2010-01-07 21:23:45 +0000 | [diff] [blame] | 97 | int erase_lhf00l04_block(struct flashchip *flash, unsigned int blockaddr, unsigned int blocklen); |
Carl-Daniel Hailfinger | 5d5c072 | 2009-12-14 03:32:24 +0000 | [diff] [blame] | 98 | int write_lhf00l04(struct flashchip *flash, uint8_t *buf); |
Carl-Daniel Hailfinger | 5d5c072 | 2009-12-14 03:32:24 +0000 | [diff] [blame] | 99 | void protect_lhf00l04(chipaddr bios); |
| 100 | |
| 101 | /* sst28sf040.c */ |
| 102 | int probe_28sf040(struct flashchip *flash); |
Sean Nelson | 51c83fb | 2010-01-20 20:55:53 +0000 | [diff] [blame] | 103 | int erase_chip_28sf040(struct flashchip *flash, unsigned int addr, unsigned int blocklen); |
| 104 | int erase_sector_28sf040(struct flashchip *flash, unsigned int address, unsigned int sector_size); |
Carl-Daniel Hailfinger | 5d5c072 | 2009-12-14 03:32:24 +0000 | [diff] [blame] | 105 | int write_28sf040(struct flashchip *flash, uint8_t *buf); |
| 106 | |
Carl-Daniel Hailfinger | 5d5c072 | 2009-12-14 03:32:24 +0000 | [diff] [blame] | 107 | /* sst49lfxxxc.c */ |
| 108 | int probe_49lfxxxc(struct flashchip *flash); |
| 109 | int erase_49lfxxxc(struct flashchip *flash); |
Sean Nelson | 51c83fb | 2010-01-20 20:55:53 +0000 | [diff] [blame] | 110 | int erase_sector_49lfxxxc(struct flashchip *flash, unsigned int address, unsigned int sector_size); |
| 111 | int erase_block_49lfxxxc(struct flashchip *flash, unsigned int address, unsigned int sector_size); |
| 112 | int erase_chip_49lfxxxc(struct flashchip *flash, unsigned int addr, unsigned int blocksize); |
Carl-Daniel Hailfinger | 5d5c072 | 2009-12-14 03:32:24 +0000 | [diff] [blame] | 113 | int write_49lfxxxc(struct flashchip *flash, uint8_t *buf); |
Sean Nelson | 6e0b912 | 2010-02-19 00:52:10 +0000 | [diff] [blame] | 114 | int unlock_49lfxxxc(struct flashchip *flash); |
Carl-Daniel Hailfinger | 5d5c072 | 2009-12-14 03:32:24 +0000 | [diff] [blame] | 115 | |
| 116 | /* sst_fwhub.c */ |
| 117 | int probe_sst_fwhub(struct flashchip *flash); |
| 118 | int erase_sst_fwhub(struct flashchip *flash); |
| 119 | int erase_sst_fwhub_block(struct flashchip *flash, unsigned int offset, unsigned int page_size); |
Sean Nelson | 51c83fb | 2010-01-20 20:55:53 +0000 | [diff] [blame] | 120 | int erase_sst_fwhub_sector(struct flashchip *flash, unsigned int offset, unsigned int page_size); |
Carl-Daniel Hailfinger | 5d5c072 | 2009-12-14 03:32:24 +0000 | [diff] [blame] | 121 | int write_sst_fwhub(struct flashchip *flash, uint8_t *buf); |
| 122 | |
| 123 | /* w39v040c.c */ |
| 124 | int probe_w39v040c(struct flashchip *flash); |
| 125 | int erase_w39v040c(struct flashchip *flash); |
| 126 | int write_w39v040c(struct flashchip *flash, uint8_t *buf); |
Sean Nelson | 6e0b912 | 2010-02-19 00:52:10 +0000 | [diff] [blame] | 127 | int printlock_w39v040c(struct flashchip *flash); |
Carl-Daniel Hailfinger | 5d5c072 | 2009-12-14 03:32:24 +0000 | [diff] [blame] | 128 | |
| 129 | /* w39V080fa.c */ |
| 130 | int probe_winbond_fwhub(struct flashchip *flash); |
| 131 | int erase_winbond_fwhub(struct flashchip *flash); |
| 132 | int write_winbond_fwhub(struct flashchip *flash, uint8_t *buf); |
Sean Nelson | 6e0b912 | 2010-02-19 00:52:10 +0000 | [diff] [blame] | 133 | int unlock_winbond_fwhub(struct flashchip *flash); |
Carl-Daniel Hailfinger | 5d5c072 | 2009-12-14 03:32:24 +0000 | [diff] [blame] | 134 | |
| 135 | /* w29ee011.c */ |
| 136 | int probe_w29ee011(struct flashchip *flash); |
| 137 | |
Carl-Daniel Hailfinger | 5d5c072 | 2009-12-14 03:32:24 +0000 | [diff] [blame] | 138 | /* stm50flw0x0x.c */ |
| 139 | int probe_stm50flw0x0x(struct flashchip *flash); |
| 140 | int erase_stm50flw0x0x(struct flashchip *flash); |
Sean Nelson | 56358aa | 2010-01-19 16:08:51 +0000 | [diff] [blame] | 141 | int erase_block_stm50flw0x0x(struct flashchip *flash, unsigned int block, unsigned int blocksize); |
| 142 | int erase_sector_stm50flw0x0x(struct flashchip *flash, unsigned int block, unsigned int blocksize); |
| 143 | int erase_chip_stm50flw0x0x(struct flashchip *flash, unsigned int addr, unsigned int blocklen); |
Carl-Daniel Hailfinger | 5d5c072 | 2009-12-14 03:32:24 +0000 | [diff] [blame] | 144 | int write_stm50flw0x0x(struct flashchip *flash, uint8_t *buf); |
| 145 | |
| 146 | #endif /* !__CHIPDRIVERS_H__ */ |