public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Nishanth Menon <nm@ti.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v4 3/7] ARM: omap-common: Add standard access for board description EEPROM
Date: Mon, 9 Nov 2015 16:19:04 -0600	[thread overview]
Message-ID: <56411BD8.8010001@ti.com> (raw)
In-Reply-To: <1446770376-8205-3-git-send-email-s-kipisz2@ti.com>

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

  parent reply	other threads:[~2015-11-09 22:19 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-06  0:39 [U-Boot] [PATCH v4 1/7] ARM: OMAP4/5: Centralize early clock initialization Steve Kipisz
2015-11-06  0:39 ` [U-Boot] [PATCH v4 2/7] ARM: OMAP4/5: Centralize gpi2c_init Steve Kipisz
2015-11-06  0:39 ` [U-Boot] [PATCH v4 3/7] ARM: omap-common: Add standard access for board description EEPROM Steve Kipisz
2015-11-06  9:29   ` Igor Grinberg
2015-11-08 13:34   ` Tom Rini
2015-11-09 22:19   ` Nishanth Menon [this message]
2015-11-09 23:47   ` Nishanth Menon
2015-11-06  0:39 ` [U-Boot] [PATCH v4 4/7] ti: am335x: Use generic EEPROM detection logic Steve Kipisz
2015-11-06  3:48   ` Lokesh Vutla
2015-11-08 13:35   ` Tom Rini
2015-11-06  0:39 ` [U-Boot] [PATCH v4 5/7] ti: AM437x: " Steve Kipisz
2015-11-06  3:49   ` Lokesh Vutla
2015-11-08 13:36   ` Tom Rini
2015-11-06  0:39 ` [U-Boot] [PATCH v4 6/7] ARM: OMAP4/5: Add generic board detection hook Steve Kipisz
2015-11-06  3:49   ` Lokesh Vutla
2015-11-06  0:39 ` [U-Boot] [PATCH v4 7/7] board: ti: AM57xx: Add detection logic for AM57xx-evm Steve Kipisz
2015-11-06  9:35   ` Igor Grinberg
2015-11-08 13:36   ` Tom Rini
2015-11-10  0:15   ` Nishanth Menon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56411BD8.8010001@ti.com \
    --to=nm@ti.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox