diff --git a/Makefile b/Makefile index 567c42c8f4adf29ef9e0ab8f8399f0ef64419b9a..54d662d3c83aec54fc5fd57e4fe8f8f91ecab958 100644 --- a/Makefile +++ b/Makefile @@ -43,7 +43,7 @@ endif LIBS += -lpci -lz OBJS = chipset_enable.o board_enable.o udelay.o jedec.o stm50flw0x0x.o \ - sst28sf040.o am29f040b.o mx29f002.o m29f400bt.o \ + sst28sf040.o am29f040b.o mx29f002.o m29f400bt.o pm29f002.c \ w49f002u.o 82802ab.o pm49fl00x.o sst49lf040.o en29f002a.o \ sst49lfxxxc.o sst_fwhub.o layout.o cbtable.o flashchips.o physmap.o \ flashrom.o w39v080fa.o sharplhf00l04.o w29ee011.o spi.o it87spi.o \ diff --git a/flash.h b/flash.h index 1b798af04ebcd5f29a8bffb3b98e34cefd3f2fb0..ac0a8373b5b79a0b82a196ed6900f1ce5d791b6b 100644 --- a/flash.h +++ b/flash.h @@ -453,6 +453,8 @@ extern const struct board_info boards_bad[]; #define PMC_25LV040 0x7E #define PMC_25LV080B 0x13 #define PMC_25LV016B 0x14 +#define PMC_29F002T 0x1D +#define PMC_29F002B 0x2D #define PMC_39LV512 0x1B #define PMC_39F010 0x1C /* also Pm39LV010 */ #define PMC_39LV020 0x3D @@ -783,6 +785,9 @@ int probe_29f040b(struct flashchip *flash); int erase_29f040b(struct flashchip *flash); int write_29f040b(struct flashchip *flash, uint8_t *buf); +/* pm29f002.c */ +int write_pm29f002(struct flashchip *flash, uint8_t *buf); + /* en29f002a.c */ int probe_en29f002a(struct flashchip *flash); int erase_en29f002a(struct flashchip *flash); diff --git a/flashchips.c b/flashchips.c index ccd7a2102979e70bd01bb897a06372a762f376fb..c668a5b2b3200b7af9166b2daa1a425dad400136 100644 --- a/flashchips.c +++ b/flashchips.c @@ -1512,6 +1512,38 @@ struct flashchip flashchips[] = { .read = spi_chip_read, }, + { + .vendor = "PMC", + .name = "Pm29F0002T", + .bustype = CHIP_BUSTYPE_PARALLEL, + .manufacture_id = PMC_ID_NOPREFIX, + .model_id = PMC_29F002T, + .total_size = 256, + .page_size = 8192, + .tested = TEST_OK_PREW, + .probe = probe_29f040b, + .probe_timing = TIMING_FIXME, + .erase = erase_29f040b, + .write = write_pm29f002, + .read = read_memmapped, + }, + + { + .vendor = "PMC", + .name = "Pm29F0002B", + .bustype = CHIP_BUSTYPE_PARALLEL, + .manufacture_id = PMC_ID_NOPREFIX, + .model_id = PMC_29F002B, + .total_size = 256, + .page_size = 8192, + .tested = TEST_UNTESTED, + .probe = probe_29f040b, + .probe_timing = TIMING_FIXME, + .erase = erase_29f040b, + .write = write_pm29f002, + .read = read_memmapped, + }, + { .vendor = "PMC", .name = "Pm39LV010", diff --git a/pm29f002.c b/pm29f002.c new file mode 100644 index 0000000000000000000000000000000000000000..374582b98ac2c8a5098456645bdebb7195835d02 --- /dev/null +++ b/pm29f002.c @@ -0,0 +1,53 @@ +/* + * This file is part of the flashrom project. + * + * Copyright (C) 2009 Uwe Hermann <uwe@hermann-uwe.de> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "flash.h" + +int write_pm29f002(struct flashchip *flash, uint8_t *buf) +{ + int i, total_size = flash->total_size * 1024; + chipaddr bios = flash->virtual_memory; + chipaddr dst = bios; + + /* Pm29F002T/B use the same erase method... */ + erase_29f040b(flash); + + printf("Programming page: "); + for (i = 0; i < total_size; i++) { + if ((i & 0xfff) == 0) + printf("address: 0x%08lx", (unsigned long)i); + + /* Pm29F002T/B only support byte-wise programming. */ + chip_writeb(0xAA, bios + 0x555); + chip_writeb(0x55, bios + 0x2AA); + chip_writeb(0xA0, bios + 0x555); + chip_writeb(*buf++, dst++); + + /* Wait for Toggle bit ready. */ + toggle_ready_jedec(dst); + + if ((i & 0xfff) == 0) + printf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"); + } + + printf("\n"); + + return 0; +}