[coreboot] [PATCH] flashrom: Support Pm25LV*

Chris Lingard chris at stockwith.co.uk
Wed Feb 6 19:14:00 CET 2008


Carl-Daniel Hailfinger wrote:
> Chris: Please try this against latest flashrom with the switch in both
> positions. It supersedes all previous patches.
> 
> Handle JEDEC JEP106W continuation codes in SPI RDID. Some vendors like
> Programmable Micro Corp need this.
> Both the serial and parallel flash JEDEC detection routines would
> benefit from a parity/sanity check of the vendor ID. Will do this later.
> 
> Add untested support for the PMC Pm25LV family of SPI flash chips.
> 
> Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006 at gmx.net>
> 
> http://www.hailfinger.org/
> 
> Index: flashrom-spi_pm25/flash.h
> ===================================================================
> --- flashrom-spi_pm25/flash.h	(Revision 3090)
> +++ flashrom-spi_pm25/flash.h	(Arbeitskopie)
> @@ -158,7 +158,20 @@
>  /* Programmable Micro Corp is listed in JEP106W in bank 2, so it should have
>   * a 0x7F continuation code prefix.
>   */
> -#define PMC_ID			0x9D	/* PMC */
> +#define PMC_ID			0x7F9D	/* PMC */
> +#define PMC_ID_NOPREFIX		0x9D	/* PMC, missing 0x7F prefix */
> +#define PMC_25LV512		0x7B
> +#define PMC_25LV010		0x7C
> +#define PMC_25LV020		0x7D
> +#define PMC_25LV040		0x7E
> +#define PMC_25LV080B		0x13
> +#define PMC_25LV016B		0x14
> +#define PMC_39LV512		0x1B
> +#define PMC_39F010		0x1C	/* also Pm39LV010 */
> +#define PMC_39LV020		0x3D
> +#define PMC_39LV040		0x3E
> +#define PMC_39F020		0x4D
> +#define PMC_39F040		0x4E
>  #define PMC_49FL002		0x6D
>  #define PMC_49FL004		0x6E
>  
> Index: flashrom-spi_pm25/flashchips.c
> ===================================================================
> --- flashrom-spi_pm25/flashchips.c	(Revision 3090)
> +++ flashrom-spi_pm25/flashchips.c	(Arbeitskopie)
> @@ -100,10 +100,22 @@
>  	 probe_49lfxxxc, erase_49lfxxxc, write_49lfxxxc},
>  	{"SST49LF160C", SST_ID,		SST_49LF160C, 	2048, 4 * 1024 ,
>  	 probe_49lfxxxc, erase_49lfxxxc, write_49lfxxxc},
> -	{"Pm49FL002",	PMC_ID,		PMC_49FL002,	256, 16 * 1024,
> +	{"Pm49FL002",	PMC_ID_NOPREFIX,	PMC_49FL002,	256, 16 * 1024,
>  	 probe_jedec,	erase_chip_jedec, write_49fl004},
> -	{"Pm49FL004",	PMC_ID,		PMC_49FL004,	512, 64 * 1024,
> +	{"Pm49FL004",	PMC_ID_NOPREFIX,	PMC_49FL004,	512, 64 * 1024,
>  	 probe_jedec,	erase_chip_jedec, write_49fl004},
> +	{"Pm25LV512",	PMC_ID,	PMC_25LV512,	64, 256,
> +	 probe_spi,	generic_spi_chip_erase_c7,	generic_spi_chip_write,	generic_spi_chip_read},
> +	{"Pm25LV010",	PMC_ID,	PMC_25LV010,	128, 256,
> +	 probe_spi,	generic_spi_chip_erase_c7,	generic_spi_chip_write,	generic_spi_chip_read},
> +	{"Pm25LV020",	PMC_ID,	PMC_25LV020,	256, 256,
> +	 probe_spi,	generic_spi_chip_erase_c7,	generic_spi_chip_write,	generic_spi_chip_read},
> +	{"Pm25LV040",	PMC_ID,	PMC_25LV040,	512, 256,
> +	 probe_spi,	generic_spi_chip_erase_c7,	generic_spi_chip_write,	generic_spi_chip_read},
> +	{"Pm25LV080B",	PMC_ID,	PMC_25LV080B,	1024, 256,
> +	 probe_spi,	generic_spi_chip_erase_c7,	generic_spi_chip_write,	generic_spi_chip_read},
> +	{"Pm25LV016B",	PMC_ID,	PMC_25LV016B,	2048, 256,
> +	 probe_spi,	generic_spi_chip_erase_c7,	generic_spi_chip_write,	generic_spi_chip_read},
>  	{"W29C011",	WINBOND_ID,	W_29C011,	128, 128,
>  	 probe_jedec,	erase_chip_jedec, write_jedec},
>  	{"W29C040P",	WINBOND_ID,	W_29C040P,	512, 256,
> @@ -205,6 +217,8 @@
>  	 probe_spi,	NULL,	NULL},
>  	{"MX unknown SPI chip",	MX_ID,	GENERIC_DEVICE_ID,	0, 0,
>  	 probe_spi,	NULL,	NULL},
> +	{"PMC unknown SPI chip",	PMC_ID,	GENERIC_DEVICE_ID,	0, 0,
> +	 probe_spi,	NULL,	NULL},
>  	{"SST unknown SPI chip",	SST_ID,	GENERIC_DEVICE_ID,	0, 0,
>  	 probe_spi,	NULL,	NULL},
>  	{"ST unknown SPI chip",	ST_ID,	GENERIC_DEVICE_ID,	0, 0,
> Index: flashrom-spi_pm25/spi.c
> ===================================================================
> --- flashrom-spi_pm25/spi.c	(Revision 3090)
> +++ flashrom-spi_pm25/spi.c	(Arbeitskopie)
> @@ -278,11 +278,17 @@
>  int probe_spi(struct flashchip *flash)
>  {
>  	unsigned char readarr[3];
> -	uint8_t manuf_id;
> -	uint16_t model_id;
> +	uint32_t manuf_id;
> +	uint32_t model_id;
>  	if (!generic_spi_rdid(readarr)) {
> -		manuf_id = readarr[0];
> -		model_id = (readarr[1] << 8) | readarr[2];
> +		/* Check if this is a continuation vendor ID */
> +		if (readarr[0] == 0x7f) {
> +			manuf_id = (readarr[0] << 8) | readarr[1];
> +			model_id = readarr[2];
> +		} else {
> +			manuf_id = readarr[0];
> +			model_id = (readarr[1] << 8) | readarr[2];
> +		}
>  		printf_debug("%s: id1 0x%x, id2 0x%x\n", __FUNCTION__, manuf_id, model_id);
>  		if (manuf_id == flash->manufacture_id &&
>  		    model_id == flash->model_id) {

Works beautifully

Acked-by:   Chris Lingard  <chris at stockwith.co.uk>






More information about the coreboot mailing list