[U-Boot] [PATCH v4 3/7] ARM: omap-common: Add standard access for board description EEPROM

Nishanth Menon nm at ti.com
Mon Nov 9 23:19:04 CET 2015


On 11/05/2015 06:39 PM, Steve Kipisz wrote:
[...]
> diff --git a/board/ti/common/board_detect.c b/board/ti/common/board_detect.c
> new file mode 100644
> index 000000000000..3d2b1bb1465e
> --- /dev/null
> +++ b/board/ti/common/board_detect.c

[...]

> +int __maybe_unused ti_i2c_eeprom_am_get_print(int bus_addr, int dev_addr,
> +					      struct ti_am_eeprom_printable *p)
> +{
> +	struct ti_am_eeprom *ep;
> +	int rc;
> +
> +	/* Incase of invalid eeprom contents */
> +	p->name[0] = 0x00;
> +	p->version[0] = 0x00;
> +	p->serial[0] = 0x00;
> +
> +	rc = ti_i2c_eeprom_am_get(bus_addr, dev_addr, &ep);
> +	if (rc)
> +		return rc;
> +
> +	/*
> +	 * Alas! we have to null terminate and cleanup the strings!
> +	 */
> +	strlcpy(p->name, ep->name, TI_EEPROM_HDR_NAME_LEN);
> +	ti_eeprom_string_cleanup(p->name);
> +	strlcpy(p->version, ep->version, TI_EEPROM_HDR_NAME_LEN);

s/TI_EEPROM_HDR_NAME_LEN/TI_EEPROM_HDR_REV_LEN ?

> +	ti_eeprom_string_cleanup(p->version);
> +	strlcpy(p->serial, ep->serial, TI_EEPROM_HDR_NAME_LEN);

s/TI_EEPROM_HDR_NAME_LEN/TI_EEPROM_HDR_SERIAL_LEN?

> +	ti_eeprom_string_cleanup(p->serial);
> +	return 0;
> +}
> +
> +bool __maybe_unused board_am_is(char *name_tag)
> +{
> +	struct ti_am_eeprom *ep = TI_AM_EEPROM_DATA;
> +
> +	if (ep->header != TI_EEPROM_HEADER_MAGIC)
> +		return false;
> +	return !strncmp(ep->name, name_tag, TI_EEPROM_HDR_NAME_LEN);
> +}
> +
> +bool __maybe_unused board_am_rev_is(char *rev_tag, int cmp_len)
> +{
> +	struct ti_am_eeprom *ep = TI_AM_EEPROM_DATA;
> +	int l;
> +
> +	if (ep->header != TI_EEPROM_HEADER_MAGIC)
> +		return false;
> +
> +	l = cmp_len > TI_EEPROM_HDR_REV_LEN ? TI_EEPROM_HDR_NAME_LEN : cmp_len;

s/TI_EEPROM_HDR_NAME_LEN/TI_EEPROM_HDR_REV_LEN/ ?

> +	return !strncmp(ep->version, rev_tag, l);
> +}
> +
[...]



-- 
Regards,
Nishanth Menon


More information about the U-Boot mailing list