sharplhf00l04.c 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. * This file is part of the flashrom project.
  3. *
  4. * Copyright (C) 2000 Silicon Integrated System Corporation
  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. #include "flash.h"
  21. #include "chipdrivers.h"
  22. /* FIXME: The datasheet is unclear whether we should use toggle_ready_jedec
  23. * or wait_82802ab.
  24. * FIXME: This file is unused.
  25. */
  26. int erase_lhf00l04_block(struct flashctx *flash, unsigned int blockaddr, unsigned int blocklen)
  27. {
  28. chipaddr bios = flash->virtual_memory + blockaddr;
  29. chipaddr wrprotect = flash->virtual_registers + blockaddr + 2;
  30. uint8_t status;
  31. // clear status register
  32. chip_writeb(flash, 0x50, bios);
  33. status = wait_82802ab(flash);
  34. print_status_82802ab(status);
  35. // clear write protect
  36. msg_cspew("write protect is at 0x%lx\n", (wrprotect));
  37. msg_cspew("write protect is 0x%x\n", chip_readb(flash, wrprotect));
  38. chip_writeb(flash, 0, wrprotect);
  39. msg_cspew("write protect is 0x%x\n", chip_readb(flash, wrprotect));
  40. // now start it
  41. chip_writeb(flash, 0x20, bios);
  42. chip_writeb(flash, 0xd0, bios);
  43. programmer_delay(10);
  44. // now let's see what the register is
  45. status = wait_82802ab(flash);
  46. print_status_82802ab(status);
  47. /* FIXME: Check the status register for errors. */
  48. return 0;
  49. }