diff options
author | Peter Stuge <peter@stuge.se> | 2008-06-22 17:06:41 +0000 |
---|---|---|
committer | Stefan Reinauer <stepan@coresystems.de> | 2008-06-22 17:06:41 +0000 |
commit | 3ea2c031484b7cc62714f32db35b857f8e9fd0b6 (patch) | |
tree | 1e2ffc47f73943201415adb8242967cd94ce8ea5 | |
parent | 4962a2784740a12c84f10c8346fd1e858420a1c3 (diff) | |
download | flashrom-3ea2c031484b7cc62714f32db35b857f8e9fd0b6.zip flashrom-3ea2c031484b7cc62714f32db35b857f8e9fd0b6.tar.gz |
Remove dead M-Systems Disk on Chip code
DOC support has been disabled by default for many years. The write function
does nothing but print text. It has a call to write_page_md2802() commented
out, but that function does not exist. This is dead code with ugly #ifdefs.
Updates README to reflect that there was a time when there was code, but it
didn't work. Removes M-Systems #defines and also includes svn rm msys_doc.*
Corresponding to flashrom svn r269 and coreboot v2 svn r3382.
Signed-off-by: Peter Stuge <peter@stuge.se>
Acked-by: Stefan Reinauer <stepan@coresystems.de>
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r-- | README | 7 | ||||
-rw-r--r-- | flash.h | 5 | ||||
-rw-r--r-- | flashchips.c | 6 | ||||
-rw-r--r-- | msys_doc.c | 250 | ||||
-rw-r--r-- | msys_doc.h | 99 |
6 files changed, 6 insertions, 365 deletions
@@ -11,7 +11,7 @@ STRIP = strip INSTALL = /usr/bin/install PREFIX = /usr/local #CFLAGS = -O2 -g -Wall -Werror -CFLAGS = -Os -Wall -Werror -DDISABLE_DOC # -DTS5300 +CFLAGS = -Os -Wall -Werror # -DTS5300 OS_ARCH = $(shell uname) ifeq ($(OS_ARCH), SunOS) LDFLAGS = -lpci -lz @@ -26,7 +26,7 @@ endif OBJS = chipset_enable.o board_enable.o udelay.o jedec.o stm50flw0x0x.o \ sst28sf040.o am29f040b.o mx29f002.o sst39sf020.o m29f400bt.o \ - w49f002u.o 82802ab.o msys_doc.o pm49fl00x.o sst49lf040.o \ + w49f002u.o 82802ab.o pm49fl00x.o sst49lf040.o \ sst49lfxxxc.o sst_fwhub.o layout.o cbtable.o flashchips.o \ flashrom.o w39v080fa.o sharplhf00l04.o w29ee011.o spi.o it87spi.o \ ichspi.o @@ -98,8 +98,10 @@ ROM layout and the ROM image in one file (cpio, zip or something?). Disk on Chip support -------------------- -Disk on Chip support is currently disabled since it is considered unstable. -Change CFLAGS in the Makefile to enable it: Remove -DDISABLE_DOC from CFLAGS. +Disk on Chip support was removed from flashrom in r3380. It had already +been disabled by default in flashrom for several years because the code +was considered unstable and incomplete. The products intended to work +have been End-Of-Lifed by the manufacturer for a long time. Supported Flash Chips @@ -113,7 +115,6 @@ Atmel AT-29C020 EMST F49B002UA Intel 82802AB (Firmware Hub) Intel 82802AC (Firmware Hub) -M-Systems MD-2802 (unsupported, disabled by default) MX MX-29F002 PMC PMC-49FL002 PMC PMC-49FL004 @@ -192,11 +192,6 @@ extern struct flashchip flashchips[]; #define ISSI_ID 0xD5 /* ISSI Integrated Silicon Solutions */ -#define MSYSTEMS_ID 0x156F /* M-Systems, not listed in JEP106W */ -#define MSYSTEMS_MD2200 0xDB -#define MSYSTEMS_MD2800 0x30 /* hmm -- both 0x30 */ -#define MSYSTEMS_MD2802 0x30 /* hmm -- both 0x30 */ - /* * MX25 chips are SPI, first byte of device ID is memory type, * second byte of device ID is log(bitsize)-9. diff --git a/flashchips.c b/flashchips.c index 8a0a477..d688b28 100644 --- a/flashchips.c +++ b/flashchips.c @@ -21,9 +21,6 @@ */ #include "flash.h" -#ifndef DISABLE_DOC -#include "msys_doc.h" -#endif /** * List of supported flash ROM chips. @@ -58,9 +55,6 @@ struct flashchip flashchips[] = { {"Macronix", "MX25L1605", MX_ID, MX_25L1605, 2048, 256, TEST_UNTESTED, probe_spi_rdid, spi_chip_erase_c7, spi_chip_write, spi_chip_read}, {"Macronix", "MX25L3205", MX_ID, MX_25L3205, 4096, 256, TEST_OK_PREW, probe_spi_rdid, spi_chip_erase_c7, spi_chip_write, spi_chip_read}, {"Macronix", "MX29F002", MX_ID, MX_29F002, 256, 64 * 1024, TEST_UNTESTED, probe_29f002, erase_29f002, write_29f002}, -#ifndef DISABLE_DOC - {"M-Systems", "MD-2802", MSYSTEMS_ID, MSYSTEMS_MD2802, 8, 8 * 1024, TEST_UNTESTED, probe_md2802, erase_md2802, write_md2802, read_md2802}, -#endif {"PMC", "Pm25LV010", PMC_ID, PMC_25LV010, 128, 256, TEST_UNTESTED, probe_spi_rdid, spi_chip_erase_c7, spi_chip_write, spi_chip_read}, {"PMC", "Pm25LV016B", PMC_ID, PMC_25LV016B, 2048, 256, TEST_UNTESTED, probe_spi_rdid, spi_chip_erase_c7, spi_chip_write, spi_chip_read}, {"PMC", "Pm25LV020", PMC_ID, PMC_25LV020, 256, 256, TEST_UNTESTED, probe_spi_rdid, spi_chip_erase_c7, spi_chip_write, spi_chip_read}, diff --git a/msys_doc.c b/msys_doc.c deleted file mode 100644 index 1d80f46..0000000 --- a/msys_doc.c +++ /dev/null @@ -1,250 +0,0 @@ -/* - * This file is part of the flashrom project. - * - * Copyright (C) 2003 Niki W. Waibel <niki.waibel@gmx.net> - * - * 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 <stdio.h> -#include <unistd.h> -#include "flash.h" -#include "msys_doc.h" - -static int doc_wait(volatile uint8_t *bios, int timeout); -static uint8_t doc_read_chipid(volatile uint8_t *bios); -static uint8_t doc_read_docstatus(volatile uint8_t *bios); -static uint8_t doc_read_cdsncontrol(volatile uint8_t *bios); -static void doc_write_cdsncontrol(volatile uint8_t *bios, uint8_t data); - -int probe_md2802(struct flashchip *flash) -{ - volatile uint8_t *bios = flash->virtual_memory; - uint8_t chipid; -#ifndef MSYSTEMS_DOC_NO_55AA_CHECKING - uint8_t id_0x55, id_0xAA; -#endif /* !MSYSTEMS_DOC_NO_55AA_CHECKING */ - int i, toggle_a, toggle_b; - - printf_debug("%s:\n", __FUNCTION__); - printf_debug("%s: *******************************\n", __FUNCTION__); - printf_debug("%s: * THIS IS A PRE ALPHA VERSION *\n", __FUNCTION__); - printf_debug("%s: * IN THE DEVELOPEMENT *********\n", __FUNCTION__); - printf_debug("%s: * PROCESS RIGHT NOW. **********\n", __FUNCTION__); - printf_debug("%s: *******************************\n", __FUNCTION__); - printf_debug("%s: * IF YOU ARE NOT A DEVELOPER **\n", __FUNCTION__); - printf_debug("%s: * THEN DO NOT TRY TO READ OR **\n", __FUNCTION__); - printf_debug("%s: * WRITE TO THIS DEVICE ********\n", __FUNCTION__); - printf_debug("%s: *******************************\n", __FUNCTION__); - printf_debug("%s:\n", __FUNCTION__); - - printf_debug("%s: switching off reset mode ...\n", __FUNCTION__); - doc_write(0x85, bios, DOCControl); - doc_write(0x85, bios, DOCControl); - doc_read_4nop(bios); - if (doc_wait(bios, 5000)) - return (-1); - printf("%s: switching off reset mode ... done\n", __FUNCTION__); - printf("%s:\n", __FUNCTION__); - - printf("%s: switching off write protection ...\n", __FUNCTION__); - doc_write_cdsncontrol(bios, doc_read_cdsncontrol(bios) & (~0x08)); - printf("%s: switching off write protection ... done\n", __FUNCTION__); - printf("%s:\n", __FUNCTION__); - - chipid = doc_read_chipid(bios); -#ifndef MSYSTEMS_DOC_NO_55AA_CHECKING - id_0x55 = doc_read(bios, IPL_0x0000); - id_0xAA = doc_read(bios, IPL_0x0001); -#endif /* !MSYSTEMS_DOC_NO_55AA_CHECKING */ - printf("%s: IPL_0x0000: 0x%02x\n", __FUNCTION__, id_0x55); - printf("%s: IPL_0x0001: 0x%02x\n", __FUNCTION__, id_0xAA); - printf("%s: IPL_0x0002: 0x%02x\n", __FUNCTION__, - doc_read(bios, IPL_0x0002)); - printf("%s: IPL_0x0003: 0x%02x\n", __FUNCTION__, - doc_read(bios, IPL_0x0003)); - printf("%s:\n", __FUNCTION__); - printf("%s: ChipID: 0x%02x\n", __FUNCTION__, chipid); - printf("%s: DOCStatus: 0x%02x\n", __FUNCTION__, - doc_read_docstatus(bios)); - printf("%s: FloorSelect: 0x%02x\n", __FUNCTION__, - doc_read(bios, FloorSelect)); - printf("%s: CDSNControl: 0x%02x\n", __FUNCTION__, - doc_read_cdsncontrol(bios)); - printf("%s: CDSNDeviceSelect: 0x%02x\n", __FUNCTION__, - doc_read(bios, CDSNDeviceSelect)); - printf("%s: ECCConfiguration: 0x%02x\n", __FUNCTION__, - doc_read(bios, ECCConfiguration)); - printf("%s: CDSNSlowIO: 0x%02x\n", __FUNCTION__, - doc_read(bios, CDSNSlowIO)); - printf("%s: ECCSyndrome0: 0x%02x\n", __FUNCTION__, - doc_read(bios, ECCSyndrome0)); - printf("%s: ECCSyndrome1: 0x%02x\n", __FUNCTION__, - doc_read(bios, ECCSyndrome1)); - printf("%s: ECCSyndrome2: 0x%02x\n", __FUNCTION__, - doc_read(bios, ECCSyndrome2)); - printf("%s: ECCSyndrome3: 0x%02x\n", __FUNCTION__, - doc_read(bios, ECCSyndrome3)); - printf("%s: ECCSyndrome4: 0x%02x\n", __FUNCTION__, - doc_read(bios, ECCSyndrome4)); - printf("%s: ECCSyndrome5: 0x%02x\n", __FUNCTION__, - doc_read(bios, ECCSyndrome5)); - printf("%s: AliasResolution: 0x%02x\n", __FUNCTION__, - doc_read(bios, AliasResolution)); - printf("%s: ConfigurationInput: 0x%02x\n", __FUNCTION__, - doc_read(bios, ConfigurationInput)); - printf("%s: ReadPipelineInitialization: 0x%02x\n", __FUNCTION__, - doc_read(bios, ReadPipelineInitialization)); - printf("%s: LastDataRead: 0x%02x\n", __FUNCTION__, - doc_read(bios, LastDataRead)); - printf("%s:\n", __FUNCTION__); - - printf("%s: checking ECCConfiguration toggle bit\n", __FUNCTION__); - printf("%s:", __FUNCTION__); - toggle_a = toggle_b = 0; - for (i = 0; i < 10; i++) { - uint8_t toggle = doc_toggle(bios); - - printf(" 0x%02x", toggle); - - if (i % 2) - toggle_a += toggle; - else - toggle_b += toggle; - } /* for(i=0; i<10; i++) */ - printf("\n%s: toggle result: %d/%d\n", __FUNCTION__, toggle_a, - toggle_b); - - if (chipid == flash->model_id && ((toggle_a == 5 && toggle_b == 0) - || (toggle_a == 0 && toggle_b == 5)) -#ifndef MSYSTEMS_DOC_NO_55AA_CHECKING - && id_0x55 == 0x55 && id_0xAA == 0xaa -#endif /* !MSYSTEMS_DOC_NO_55AA_CHECKING */ - ) { - return 1; - } - - return 0; -} - -int read_md2802(struct flashchip *flash, uint8_t *buf) -{ - return 0; -} - -int erase_md2802(struct flashchip *flash) -{ - volatile uint8_t *bios = flash->virtual_memory; - - return 1; - - *(volatile uint8_t *)(bios + 0x5555) = 0xAA; - *(volatile uint8_t *)(bios + 0x2AAA) = 0x55; - *(volatile uint8_t *)(bios + 0x5555) = 0x80; - - *(volatile uint8_t *)(bios + 0x5555) = 0xAA; - *(volatile uint8_t *)(bios + 0x2AAA) = 0x55; - *(volatile uint8_t *)(bios + 0x5555) = 0x10; -} - -int write_md2802(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; - - return (1); - erase_md2802(flash); - if (*bios != (uint8_t) 0xff) { - printf("ERASE FAILED!\n"); - return -1; - } - printf("Programming page: "); - for (i = 0; i < total_size / page_size; i++) { - printf("%04d at address: 0x%08x", i, i * page_size); - //write_page_md2802(bios, buf + i * page_size, bios + i * page_size, 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"); - } - printf("\n"); - //protect_md2802(bios); - - return 0; -} /* int write_md2802(struct flashchip *flash, uint8_t *buf) */ - -/* - wait timeout msec for doc to become ready - return: - 0: ready - -1: timeout expired -*/ - -static int doc_wait(volatile uint8_t *bios, int timeout) -{ - int i = 20; - - doc_read_4nop(bios); - - while (_doc_busy(bios) && (i != 0)) { - usleep(timeout * 1000 / 20); - i--; - } - - doc_read_2nop(bios); - - if (_doc_busy(bios)) { - doc_read_2nop(bios); - return (-1); - } - - return 0; -} - -static uint8_t doc_read_docstatus(volatile uint8_t *bios) -{ - doc_read(bios, CDSNSlowIO); - doc_read_2nop(bios); - - return (doc_read(bios, _DOCStatus)); -} - -static uint8_t doc_read_chipid(volatile uint8_t *bios) -{ - doc_read(bios, CDSNSlowIO); - doc_read_2nop(bios); - - return (doc_read(bios, _ChipID)); -} - -static uint8_t doc_read_cdsncontrol(volatile uint8_t *bios) -{ - uint8_t value; - - /* the delays might be necessary when reading the busy bit, - but because a read to this reg reads the busy bit - anyway we better do this delays... */ - doc_read_4nop(bios); - value = doc_read(bios, _CDSNControl); - doc_read_2nop(bios); - - return value; -} - -static void doc_write_cdsncontrol(volatile uint8_t *bios, uint8_t data) -{ - doc_write(data, bios, _CDSNControl); - doc_read_4nop(bios); -} diff --git a/msys_doc.h b/msys_doc.h deleted file mode 100644 index 13915c9..0000000 --- a/msys_doc.h +++ /dev/null @@ -1,99 +0,0 @@ -/* - * This file is part of the flashrom project. - * - * Copyright (C) 2003 Niki W. Waibel <niki.waibel@gmx.net> - * - * 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 - */ - -#ifndef __MSYS_DOC_H__ -#define __MSYS_DOC_H__ 1 - -/* idea from include/linux/mtd/doc2000.h */ -/* registers with __ should not be read/written directly */ -#define MSYSTEMS_DOC_R__ChipID 0x1000 -#define MSYSTEMS_DOC_R__DOCStatus 0x1001 -#define MSYSTEMS_DOC_W_DOCControl 0x1002 -#define MSYSTEMS_DOC_R_FloorSelect 0x1003 -#define MSYSTEMS_DOC_W_FloorSelect 0x1003 -#define MSYSTEMS_DOC_R__CDSNControl 0x1004 -#define MSYSTEMS_DOC_W__CDSNControl 0x1004 -#define MSYSTEMS_DOC_R_CDSNDeviceSelect 0x1005 -#define MSYSTEMS_DOC_W_CDSNDeviceSelect 0x1005 -#define MSYSTEMS_DOC_R_ECCConfiguration 0x1006 -#define MSYSTEMS_DOC_W_ECCConfiguration 0x1006 -#define MSYSTEMS_DOC_R_CDSNSlowIO 0x100d -#define MSYSTEMS_DOC_W_CDSNSlowIO 0x100d -#define MSYSTEMS_DOC_R_ECCSyndrome0 0x1010 -#define MSYSTEMS_DOC_R_ECCSyndrome1 0x1011 -#define MSYSTEMS_DOC_R_ECCSyndrome2 0x1012 -#define MSYSTEMS_DOC_R_ECCSyndrome3 0x1013 -#define MSYSTEMS_DOC_R_ECCSyndrome4 0x1014 -#define MSYSTEMS_DOC_R_ECCSyndrome5 0x1015 -#define MSYSTEMS_DOC_R_AliasResolution 0x101b -#define MSYSTEMS_DOC_W_AliasResolution 0x101b -#define MSYSTEMS_DOC_R_ConfigurationInput 0x101c -#define MSYSTEMS_DOC_W_ConfigurationInput 0x101c -#define MSYSTEMS_DOC_R_ReadPipelineInitialization 0x101d -#define MSYSTEMS_DOC_W_WritePipelineTermination 0x101e -#define MSYSTEMS_DOC_R_LastDataRead 0x101f -#define MSYSTEMS_DOC_W_LastDataRead 0x101f -#define MSYSTEMS_DOC_R_NOP 0x1020 -#define MSYSTEMS_DOC_W_NOP 0x1020 - -#define MSYSTEMS_DOC_R_IPL_0x0000 0x0000 -#define MSYSTEMS_DOC_R_IPL_0x0001 0x0001 -#define MSYSTEMS_DOC_R_IPL_0x0002 0x0002 -#define MSYSTEMS_DOC_R_IPL_0x0003 0x0003 - -#define MSYSTEMS_DOC_R_CDSNIO_BASE 0x0800 -#define MSYSTEMS_DOC_W_CDSNIO_BASE 0x0800 - -#define doc_read(base,reg) \ - (*(volatile uint8_t *)(base + MSYSTEMS_DOC_R_##reg)) - -#define doc_read_nop(base) \ - doc_read(base, NOP) - -#define doc_read_2nop(base) \ - { doc_read_nop(base); doc_read_nop(base); } - -#define doc_read_4nop(base) \ - { doc_read_2nop(base); doc_read_2nop(base); } - -#define doc_write(data,base,reg) \ - (*(volatile uint8_t *)(base + MSYSTEMS_DOC_W_##reg)) = data - -#define doc_write_nop(base) \ - doc_write(0, base, NOP) - -#define doc_write_2nop(base) \ - { doc_write_nop(base); doc_write_nop(base); } - -#define doc_write_4nop(base) \ - { doc_write_2nop(base); doc_write_2nop(base); } - -#define _doc_busy(base) /* 0: ready; -1: busy */ \ - ( ((doc_read(base, _CDSNControl) & 0x80) >> 7) - 1) - -#define doc_toggle(base) /* 0, 1, 0, 1, 0, 1, ... if a doc is present */ \ - ( (doc_read(base, ECCConfiguration) & 0x04) >> 2 ) - -int probe_md2802(struct flashchip *flash); -int read_md2802(struct flashchip *flash, uint8_t *buf); -int erase_md2802(struct flashchip *flash); -int write_md2802(struct flashchip *flash, uint8_t *buf); - -#endif /* !__MSYS_DOC_H__ */ |