diff options
| author | Mattias Mattsson <vitplister@gmail.com> | 2011-08-25 22:44:11 +0000 | 
|---|---|---|
| committer | Uwe Hermann <uwe@hermann-uwe.de> | 2011-08-25 22:44:11 +0000 | 
| commit | fca3b012dae98c852e2dd492b191e2cecf728583 (patch) | |
| tree | 8a7a9ab9f282b555bec39a58e833f3cb384cc8b7 | |
| parent | 14ab8d456a994ec3d84aaa43cc5e20a580aac0c0 (diff) | |
| download | flashrom-fca3b012dae98c852e2dd492b191e2cecf728583.tar.gz flashrom-fca3b012dae98c852e2dd492b191e2cecf728583.tar.bz2 flashrom-fca3b012dae98c852e2dd492b191e2cecf728583.zip | |
Add support for the Sharp LH28F008BJT-BTLZ1 chip
Tested by Mattias Mattsson <vitplister@gmail.com> on a PowerPC box.
Corresponding to flashrom svn r1420.
Signed-off-by: Mattias Mattsson <vitplister@gmail.com>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
| -rw-r--r-- | 82802ab.c | 55 | ||||
| -rw-r--r-- | chipdrivers.h | 1 | ||||
| -rw-r--r-- | flashchips.c | 30 | 
3 files changed, 86 insertions, 0 deletions
| @@ -208,3 +208,58 @@ int unlock_28f004s5(struct flashchip *flash)  	return 0;  } + +int unlock_lh28f008bjt(struct flashchip *flash) +{ +	chipaddr bios = flash->virtual_memory; +	uint8_t mcfg, bcfg; +	uint8_t need_unlock = 0, can_unlock = 0; +	int i; + +	/* Wait if chip is busy */ +	wait_82802ab(flash); + +	/* Read identifier codes */ +	chip_writeb(0x90, bios); + +	/* Read master lock-bit */ +	mcfg = chip_readb(bios + 0x3); +	msg_cdbg("master lock is "); +	if (mcfg) { +		msg_cdbg("locked!\n"); +	} else { +		msg_cdbg("unlocked!\n"); +		can_unlock = 1; +	} + +	/* Read block lock-bits, 8 * 8 KB + 15 * 64 KB */ +	for (i = 0; i < flash->total_size * 1024; +	     i += (i >= (64 * 1024) ? 64 * 1024 : 8 * 1024)) { +		bcfg = chip_readb(bios + i + 2); /* read block lock config */ +		msg_cdbg("block lock at %06x is %slocked!\n", i, +			 bcfg ? "" : "un"); +		if (bcfg) +			need_unlock = 1; +	} + +	/* Reset chip */ +	chip_writeb(0xFF, bios); + +	/* Unlock: clear block lock-bits, if needed */ +	if (can_unlock && need_unlock) { +		msg_cdbg("Unlock: "); +		chip_writeb(0x60, bios); +		chip_writeb(0xD0, bios); +		chip_writeb(0xFF, bios); +		wait_82802ab(flash); +		msg_cdbg("Done!\n"); +	} + +	/* Error: master locked or a block is locked */ +	if (!can_unlock && need_unlock) { +		msg_cerr("At least one block is locked and lockdown is active!\n"); +		return -1; +	} + +	return 0; +} diff --git a/chipdrivers.h b/chipdrivers.h index 3f5b503e..958c59ad 100644 --- a/chipdrivers.h +++ b/chipdrivers.h @@ -85,6 +85,7 @@ int write_82802ab(struct flashchip *flash, uint8_t *buf, int start, int len);  void print_status_82802ab(uint8_t status);  int unlock_82802ab(struct flashchip *flash);  int unlock_28f004s5(struct flashchip *flash); +int unlock_lh28f008bjt(struct flashchip *flash);  /* jedec.c */  uint8_t oddparity(uint8_t val); diff --git a/flashchips.c b/flashchips.c index 4d741a08..d7a1b9bb 100644 --- a/flashchips.c +++ b/flashchips.c @@ -5379,6 +5379,36 @@ const struct flashchip flashchips[] = {  	{  		.vendor		= "Sharp", +		.name		= "LH28F008BJT-BTLZ1", +		.bustype	= BUS_PARALLEL, +		.manufacture_id	= SHARP_ID, +		.model_id	= SHARP_LH28F008BJxxPB, +		.total_size	= 1024, +		.page_size	= 64 * 1024, +		.tested		= TEST_OK_PREW, +		.probe		= probe_82802ab, +		.probe_timing	= TIMING_ZERO, +		.block_erasers	= +		{ +			{ +				.eraseblocks = { +					{8 * 1024, 8}, +					{64 * 1024, 15} +				 }, +				.block_erase = erase_block_82802ab, +			}, { +				.eraseblocks = { {1024 * 1024, 1} }, +				.block_erase = erase_sector_49lfxxxc, +			} +		}, +		.unlock		= unlock_lh28f008bjt, +		.write		= write_82802ab, +		.read		= read_memmapped, +		.voltage	= {2700, 3600}, +	}, + +	{ +		.vendor		= "Sharp",  		.name		= "LHF00L04",  		.bustype	= BUS_FWH, /* A/A Mux */  		.manufacture_id	= SHARP_ID, | 
