blob: d6c85c8fb41302b9b9431f8f6a28217d9f7d3825 [file] [log] [blame]
Yinghai Luca782972007-01-22 20:21:17 +00001/*
Uwe Hermannd1107642007-08-29 17:52:32 +00002 * This file is part of the flashrom project.
Yinghai Luca782972007-01-22 20:21:17 +00003 *
Uwe Hermannd22a1d42007-09-09 20:21:05 +00004 * Copyright (C) 2000 Silicon Integrated System Corporation
5 * Copyright (C) 2005-2007 coresystems GmbH
Sean Nelson51c83fb2010-01-20 20:55:53 +00006 * Copyright (C) 2009 Sean Nelson <audiohacked@gmail.com>
Yinghai Luca782972007-01-22 20:21:17 +00007 *
Uwe Hermannd1107642007-08-29 17:52:32 +00008 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
Yinghai Luca782972007-01-22 20:21:17 +000012 *
Uwe Hermannd1107642007-08-29 17:52:32 +000013 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
Yinghai Luca782972007-01-22 20:21:17 +000017 *
Uwe Hermannd1107642007-08-29 17:52:32 +000018 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Yinghai Luca782972007-01-22 20:21:17 +000021 */
22
Yinghai Luca782972007-01-22 20:21:17 +000023#include "flash.h"
Sean Nelson14ba6682010-02-26 05:48:29 +000024#include "chipdrivers.h"
Yinghai Luca782972007-01-22 20:21:17 +000025
Carl-Daniel Hailfinger8a3c60c2011-12-18 15:01:24 +000026int erase_sector_49lfxxxc(struct flashctx *flash, unsigned int address,
27 unsigned int sector_size)
Yinghai Luca782972007-01-22 20:21:17 +000028{
Sean Nelson69e58112010-03-23 17:10:28 +000029 uint8_t status;
Carl-Daniel Hailfinger30f7cb22009-06-15 17:23:36 +000030 chipaddr bios = flash->virtual_memory;
Yinghai Luca782972007-01-22 20:21:17 +000031
Carl-Daniel Hailfinger8a3c60c2011-12-18 15:01:24 +000032 chip_writeb(flash, 0x30, bios);
33 chip_writeb(flash, 0xD0, bios + address);
Yinghai Luca782972007-01-22 20:21:17 +000034
Carl-Daniel Hailfingerb30a5ed2010-10-10 14:02:27 +000035 status = wait_82802ab(flash);
Stefan Reinauere8a648d2011-06-19 17:09:49 +000036 print_status_82802ab(status);
Yinghai Luca782972007-01-22 20:21:17 +000037
Carl-Daniel Hailfingerb4061f62011-06-26 17:04:16 +000038 /* FIXME: Check the status register for errors. */
Uwe Hermannffec5f32007-08-23 16:08:21 +000039 return 0;
Yinghai Luca782972007-01-22 20:21:17 +000040}