From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nishanth Menon Date: Mon, 9 Nov 2015 16:19:04 -0600 Subject: [U-Boot] [PATCH v4 3/7] ARM: omap-common: Add standard access for board description EEPROM In-Reply-To: <1446770376-8205-3-git-send-email-s-kipisz2@ti.com> References: <1446770376-8205-1-git-send-email-s-kipisz2@ti.com> <1446770376-8205-3-git-send-email-s-kipisz2@ti.com> Message-ID: <56411BD8.8010001@ti.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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