blob: a69ab753914a7e447a1269a2d8f36f572e82b4d7 [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 */
18
Yinghai Luca782972007-01-22 20:21:17 +000019#include "flash.h"
Sean Nelson14ba6682010-02-26 05:48:29 +000020#include "chipdrivers.h"
Yinghai Luca782972007-01-22 20:21:17 +000021
Carl-Daniel Hailfinger8a3c60c2011-12-18 15:01:24 +000022int erase_sector_49lfxxxc(struct flashctx *flash, unsigned int address,
23 unsigned int sector_size)
Yinghai Luca782972007-01-22 20:21:17 +000024{
Sean Nelson69e58112010-03-23 17:10:28 +000025 uint8_t status;
Carl-Daniel Hailfinger30f7cb22009-06-15 17:23:36 +000026 chipaddr bios = flash->virtual_memory;
Yinghai Luca782972007-01-22 20:21:17 +000027
Carl-Daniel Hailfinger8a3c60c2011-12-18 15:01:24 +000028 chip_writeb(flash, 0x30, bios);
29 chip_writeb(flash, 0xD0, bios + address);
Yinghai Luca782972007-01-22 20:21:17 +000030
Carl-Daniel Hailfingerb30a5ed2010-10-10 14:02:27 +000031 status = wait_82802ab(flash);
Stefan Reinauere8a648d2011-06-19 17:09:49 +000032 print_status_82802ab(status);
Yinghai Luca782972007-01-22 20:21:17 +000033
Carl-Daniel Hailfingerb4061f62011-06-26 17:04:16 +000034 /* FIXME: Check the status register for errors. */
Uwe Hermannffec5f32007-08-23 16:08:21 +000035 return 0;
Yinghai Luca782972007-01-22 20:21:17 +000036}