[PATCH] mtd: m25p80: add support for Spansion s25fl128s chip

Huang Shijie b32955 at freescale.com
Fri Dec 6 05:02:22 EST 2013


On Thu, Dec 05, 2013 at 10:55:34AM +0000, Angus Clark wrote:
> static struct flash_info *__devinit fsm_jedec_probe(struct stm_spi_fsm *fsm)
> {
> 	uint8_t	readid[MAX_READID_LEN];

How long is the MAX_READID_LEN? 5 or 8?

Brian doubt that some NOR can not be read out more then 5 bytes.

> 	char readid_str[MAX_READID_LEN * 3 + 1];
> 	struct flash_info *info;
> 
> 	if (fsm_read_jedec(fsm, readid) != 0) {
> 		dev_info(fsm->dev, "error reading JEDEC ID\n");
> 		return NULL;
> 	}
> 
> 	hex_dump_to_buffer(readid, MAX_READID_LEN, 16, 1,
> 			   readid_str, sizeof(readid_str), 0);
> 
> 	dev_dbg(fsm->dev, "READID = %s\n", readid_str);
> 
> 	/* The 'readid' may match multiple entries in the table.  To ensure we
> 	 * retrieve the most specific match, the table is sorted in order of
> 	 * 'readid_len'.
> 	 */
> 	sort(flash_types, ARRAY_SIZE(flash_types) - 1,
> 	     sizeof(struct flash_info), cmp_flash_info_readid_len, NULL);
> 
If we keep the flash_types table be inserted by a specific order.
We can remove this sort code.

> 	for (info = flash_types; info->name; info++) {
> 		if (memcmp(info->readid, readid, info->readid_len) == 0)
> 			return info;
> 	}
> 

thanks
Huang Shijie




More information about the linux-mtd mailing list