Markus Boas | d2ac6fc | 2007-08-30 10:17:50 +0000 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the flashrom project. |
| 3 | * |
| 4 | * Copyright (C) 2007 Markus Boas <ryven@ryven.de> |
| 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; either version 2 of the License, or |
| 9 | * (at your option) any later version. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this program; if not, write to the Free Software |
| 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 19 | */ |
| 20 | |
Jens Kuehnel | b9f6174 | 2008-06-18 13:36:34 +0000 | [diff] [blame] | 21 | #include <string.h> |
Markus Boas | d2ac6fc | 2007-08-30 10:17:50 +0000 | [diff] [blame] | 22 | #include "flash.h" |
| 23 | |
| 24 | int probe_w29ee011(struct flashchip *flash) |
| 25 | { |
Carl-Daniel Hailfinger | 5820f42 | 2009-05-16 21:22:56 +0000 | [diff] [blame] | 26 | chipaddr bios = flash->virtual_memory; |
Markus Boas | d2ac6fc | 2007-08-30 10:17:50 +0000 | [diff] [blame] | 27 | uint8_t id1, id2; |
Jens Kuehnel | b9f6174 | 2008-06-18 13:36:34 +0000 | [diff] [blame] | 28 | extern char *chip_to_probe; |
| 29 | |
Uwe Hermann | 394131e | 2008-10-18 21:14:13 +0000 | [diff] [blame] | 30 | if (!chip_to_probe || strcmp(chip_to_probe, "W29EE011")) { |
Carl-Daniel Hailfinger | 414bd32 | 2009-07-23 01:33:43 +0000 | [diff] [blame] | 31 | printf_debug("Probing disabled for Winbond W29EE011 because " |
| 32 | "the probing sequence puts the AMIC A49LF040A in " |
| 33 | "a funky state. Use 'flashrom -c W29EE011' if you " |
| 34 | "have a board with this chip.\n"); |
Jens Kuehnel | b9f6174 | 2008-06-18 13:36:34 +0000 | [diff] [blame] | 35 | return 0; |
| 36 | } |
Markus Boas | d2ac6fc | 2007-08-30 10:17:50 +0000 | [diff] [blame] | 37 | |
| 38 | /* Issue JEDEC Product ID Entry command */ |
Carl-Daniel Hailfinger | 0472f3d | 2009-03-06 22:26:00 +0000 | [diff] [blame] | 39 | chip_writeb(0xAA, bios + 0x5555); |
Carl-Daniel Hailfinger | ca8bfc6 | 2009-06-05 17:48:08 +0000 | [diff] [blame] | 40 | programmer_delay(10); |
Carl-Daniel Hailfinger | 0472f3d | 2009-03-06 22:26:00 +0000 | [diff] [blame] | 41 | chip_writeb(0x55, bios + 0x2AAA); |
Carl-Daniel Hailfinger | ca8bfc6 | 2009-06-05 17:48:08 +0000 | [diff] [blame] | 42 | programmer_delay(10); |
Carl-Daniel Hailfinger | 0472f3d | 2009-03-06 22:26:00 +0000 | [diff] [blame] | 43 | chip_writeb(0x80, bios + 0x5555); |
Carl-Daniel Hailfinger | ca8bfc6 | 2009-06-05 17:48:08 +0000 | [diff] [blame] | 44 | programmer_delay(10); |
Carl-Daniel Hailfinger | 0472f3d | 2009-03-06 22:26:00 +0000 | [diff] [blame] | 45 | chip_writeb(0xAA, bios + 0x5555); |
Carl-Daniel Hailfinger | ca8bfc6 | 2009-06-05 17:48:08 +0000 | [diff] [blame] | 46 | programmer_delay(10); |
Carl-Daniel Hailfinger | 0472f3d | 2009-03-06 22:26:00 +0000 | [diff] [blame] | 47 | chip_writeb(0x55, bios + 0x2AAA); |
Carl-Daniel Hailfinger | ca8bfc6 | 2009-06-05 17:48:08 +0000 | [diff] [blame] | 48 | programmer_delay(10); |
Carl-Daniel Hailfinger | 0472f3d | 2009-03-06 22:26:00 +0000 | [diff] [blame] | 49 | chip_writeb(0x60, bios + 0x5555); |
Carl-Daniel Hailfinger | ca8bfc6 | 2009-06-05 17:48:08 +0000 | [diff] [blame] | 50 | programmer_delay(10); |
Markus Boas | d2ac6fc | 2007-08-30 10:17:50 +0000 | [diff] [blame] | 51 | |
| 52 | /* Read product ID */ |
Carl-Daniel Hailfinger | 0472f3d | 2009-03-06 22:26:00 +0000 | [diff] [blame] | 53 | id1 = chip_readb(bios); |
| 54 | id2 = chip_readb(bios + 0x01); |
Markus Boas | d2ac6fc | 2007-08-30 10:17:50 +0000 | [diff] [blame] | 55 | |
| 56 | /* Issue JEDEC Product ID Exit command */ |
Carl-Daniel Hailfinger | 0472f3d | 2009-03-06 22:26:00 +0000 | [diff] [blame] | 57 | chip_writeb(0xAA, bios + 0x5555); |
Carl-Daniel Hailfinger | ca8bfc6 | 2009-06-05 17:48:08 +0000 | [diff] [blame] | 58 | programmer_delay(10); |
Carl-Daniel Hailfinger | 0472f3d | 2009-03-06 22:26:00 +0000 | [diff] [blame] | 59 | chip_writeb(0x55, bios + 0x2AAA); |
Carl-Daniel Hailfinger | ca8bfc6 | 2009-06-05 17:48:08 +0000 | [diff] [blame] | 60 | programmer_delay(10); |
Carl-Daniel Hailfinger | 0472f3d | 2009-03-06 22:26:00 +0000 | [diff] [blame] | 61 | chip_writeb(0xF0, bios + 0x5555); |
Carl-Daniel Hailfinger | ca8bfc6 | 2009-06-05 17:48:08 +0000 | [diff] [blame] | 62 | programmer_delay(10); |
Markus Boas | d2ac6fc | 2007-08-30 10:17:50 +0000 | [diff] [blame] | 63 | |
Peter Stuge | 5cafc33 | 2009-01-25 23:52:45 +0000 | [diff] [blame] | 64 | printf_debug("%s: id1 0x%02x, id2 0x%02x\n", __FUNCTION__, id1, id2); |
Markus Boas | d2ac6fc | 2007-08-30 10:17:50 +0000 | [diff] [blame] | 65 | |
| 66 | if (id1 == flash->manufacture_id && id2 == flash->model_id) |
| 67 | return 1; |
| 68 | |
| 69 | return 0; |
| 70 | } |