diff -Nru flashrom/flashchips.c flashrom-pm49fl00x/flashchips.c
--- flashrom/flashchips.c	2008-02-07 03:07:58.000000000 +0500
+++ flashrom-pm49fl00x/flashchips.c	2008-03-11 13:38:25.000000000 +0500
@@ -101,9 +101,9 @@
 	{"SST49LF160C", SST_ID,		SST_49LF160C, 	2048, 4 * 1024 ,
 	 probe_49lfxxxc, erase_49lfxxxc, write_49lfxxxc},
 	{"Pm49FL002",	PMC_ID_NOPREFIX,	PMC_49FL002,	256, 16 * 1024,
-	 probe_jedec,	erase_chip_jedec, write_49fl004},
+	 probe_49fl00x,	erase_49fl00x, write_49fl00x},
 	{"Pm49FL004",	PMC_ID_NOPREFIX,	PMC_49FL004,	512, 64 * 1024,
-	 probe_jedec,	erase_chip_jedec, write_49fl004},
+	 probe_49fl00x,	erase_49fl00x, write_49fl00x},
 	{"Pm25LV512",	PMC_ID,	PMC_25LV512,	64, 256,
 	 probe_spi,	generic_spi_chip_erase_c7,	generic_spi_chip_write,	generic_spi_chip_read},
 	{"Pm25LV010",	PMC_ID,	PMC_25LV010,	128, 256,
diff -Nru flashrom/flash.h flashrom-pm49fl00x/flash.h
--- flashrom/flash.h	2008-02-07 03:07:58.000000000 +0500
+++ flashrom-pm49fl00x/flash.h	2008-03-11 13:38:25.000000000 +0500
@@ -373,9 +373,9 @@
 int write_29f002(struct flashchip *flash, uint8_t *buf);
 
 /* pm49fl004.c */
-int probe_49fl004(struct flashchip *flash);
-int erase_49fl004(struct flashchip *flash);
-int write_49fl004(struct flashchip *flash, uint8_t *buf);
+int probe_49fl00x(struct flashchip *flash);
+int erase_49fl00x(struct flashchip *flash);
+int write_49fl00x(struct flashchip *flash, uint8_t *buf);
 
 /* sharplhf00l04.c */
 int probe_lhf00l04(struct flashchip *flash);
diff -Nru flashrom/pm49fl004.c flashrom-pm49fl00x/pm49fl004.c
--- flashrom/pm49fl004.c	2007-10-18 05:55:15.000000000 +0600
+++ flashrom-pm49fl00x/pm49fl004.c	2008-03-11 13:38:25.000000000 +0500
@@ -2,6 +2,8 @@
  * This file is part of the flashrom project.
  *
  * Copyright (C) 2004 Tyan Corporation
+ * Copyright (C) 2007 Nikolay Petukhov <nikolay.petukhov@gmail.com>
+ * Copyright (C) 2007 Reinder E.N. de Haan <lb_reha@mveas.com>
  *
  * 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
@@ -23,13 +25,71 @@
 
 extern int exclude_start_page, exclude_end_page;
 
-int write_49fl004(struct flashchip *flash, uint8_t *buf)
+void write_lockbits_49fl00x(volatile uint8_t *bios, int size,
+					      unsigned char bits, int block_size)
+{
+	int i, left = size;
+
+	for (i = 0; left >= block_size; i++, left -= block_size) {
+
+		/* pm49fl002 */
+		if (block_size == 16384 && i%2)
+			continue;
+
+		*(bios + (i * block_size) + 2) = bits;
+	}
+}
+
+int probe_49fl00x(struct flashchip *flash)
+{
+	int ret = probe_jedec(flash);
+	
+	if (ret == 1)
+		map_flash_registers(flash);
+
+	return ret;
+}
+
+int erase_49fl00x(struct flashchip *flash)
 {
 	int i;
 	int total_size = flash->total_size * 1024;
 	int page_size = flash->page_size;
 	volatile uint8_t *bios = flash->virtual_memory;
 
+	/* unprotected */
+	write_lockbits_49fl00x(flash->virtual_registers, total_size, 0, page_size);
+
+	//erase_chip_jedec will not work ... datasheet says "Chip erase is available in A/A Mux Mode only"
+	printf("Erasing page: ");
+	for (i = 0; i < total_size / page_size; i++) {
+		if ((i >= exclude_start_page) && (i < exclude_end_page))
+			continue;
+
+		/* erase the page */
+		erase_block_jedec(bios, i * page_size);
+		printf("%04d at address: 0x%08x", i, i * page_size);
+		printf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b");
+		fflush(stdout);
+	}
+	printf("\n");
+
+	/* protected */
+	write_lockbits_49fl00x(flash->virtual_registers, total_size, 1, page_size);
+
+	return 0;
+}
+
+int write_49fl00x(struct flashchip *flash, uint8_t *buf)
+{
+	int i;
+	int total_size = flash->total_size * 1024;
+	int page_size = flash->page_size;
+	volatile uint8_t *bios = flash->virtual_memory;
+
+	/* unprotected */
+	write_lockbits_49fl00x(flash->virtual_registers, total_size, 0, page_size);
+
 	printf("Programming page: ");
 	for (i = 0; i < total_size / page_size; i++) {
 		if ((i >= exclude_start_page) && (i < exclude_end_page))
@@ -46,6 +106,9 @@
 		fflush(stdout);
 	}
 	printf("\n");
+	
+	/* protected */
+	write_lockbits_49fl00x(flash->virtual_registers, total_size, 1, page_size);
 
 	return 0;
 }
