From: Felipe Balbi <felipe.balbi@linux.intel.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 01/31] ti: common: board_detect: Allow settings board detection variables manually
Date: Thu, 02 Mar 2017 21:10:32 +0200 [thread overview]
Message-ID: <87tw7bsdef.fsf@linux.intel.com> (raw)
In-Reply-To: <20170302190435.23212-2-fcooper@ti.com>
Hi,
Franklin S Cooper Jr <fcooper@ti.com> writes:
> From: Nishanth Menon <nm@ti.com>
>
> In some situations the EEPROM used for board detection may not be
> programmed or simply programmed incorrectly. Therefore, it may be
> necessary to "simulate" reading the contents of the EEPROM to set
> appropriate variables used in the board detection code.
>
> This may also be helpful in certain boot modes where doing i2c reads
> may be costly and the config supports running only a specific board.
>
> Signed-off-by: Nishanth Menon <nm@ti.com>
> Signed-off-by: Tero Kristo <t-kristo@ti.com>
> Signed-off-by: Keerthy <j-keerthy@ti.com>
> Signed-off-by: Franklin S Cooper Jr. <fcooper@ti.com>
> ---
> board/ti/common/board_detect.c | 24 ++++++++++++++++++++++++
> board/ti/common/board_detect.h | 17 +++++++++++++++++
> 2 files changed, 41 insertions(+)
>
> diff --git a/board/ti/common/board_detect.c b/board/ti/common/board_detect.c
> index a5dba94..5aaf884 100644
> --- a/board/ti/common/board_detect.c
> +++ b/board/ti/common/board_detect.c
> @@ -116,6 +116,30 @@ static int __maybe_unused ti_i2c_eeprom_get(int bus_addr, int dev_addr,
> return 0;
> }
>
> +int __maybe_unused ti_i2c_eeprom_am_set(const char *name, const char *rev)
> +{
> + struct ti_common_eeprom *ep;
> +
> + if (!name || !rev)
> + return -1;
> +
> + ep = TI_EEPROM_DATA;
> + if (ep->header == TI_EEPROM_HEADER_MAGIC)
> + goto already_set;
> +
> + /* Set to 0 all fields */
> + memset(ep, 0, sizeof(*ep));
> + strncpy(ep->name, name, TI_EEPROM_HDR_NAME_LEN);
> + strncpy(ep->version, rev, TI_EEPROM_HDR_REV_LEN);
> + /* Some dummy serial number to identify the platform */
> + strncpy(ep->serial, "0000", TI_EEPROM_HDR_SERIAL_LEN);
> + /* Mark it with a valid header */
> + ep->header = TI_EEPROM_HEADER_MAGIC;
> +
> +already_set:
> + return 0;
> +}
> +
> int __maybe_unused ti_i2c_eeprom_am_get(int bus_addr, int dev_addr)
> {
> int rc;
> diff --git a/board/ti/common/board_detect.h b/board/ti/common/board_detect.h
> index 343fcb4..eeeacd3 100644
> --- a/board/ti/common/board_detect.h
> +++ b/board/ti/common/board_detect.h
> @@ -193,4 +193,21 @@ u64 board_ti_get_emif2_size(void);
> */
> void set_board_info_env(char *name);
>
> +/**
> + * ti_i2c_eeprom_am_set() - Setup the eeprom data with predefined values
> + * @name: Name of the board
> + * @rev: Revision of the board
> + *
> + * In some cases such as in RTC-only mode, we are able to skip reading eeprom
> + * and wasting i2c based initialization time by using predefined flags for
> + * detecting what platform we are booting on. For those platforms, provide
> + * a handy function to pre-program information.
there's a micro-optimization for some cases here. You can try to read
i2c only on first time and save the result to environment. Something
like:
if (!getenv("serial#")) {
read_serial_from_eeprom(&serial);
setenv("serial#", serial);
saveenv();
}
Of course, this assumes i2c is available and eeprom is properly
programmed. For bogus eeprom data, well, can't do much.
--
balbi
next prev parent reply other threads:[~2017-03-02 19:10 UTC|newest]
Thread overview: 68+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-02 19:04 [U-Boot] [PATCH 00/31] ARM: k2g: Add support for new K2G ICE EVM Franklin S Cooper Jr
2017-03-02 19:04 ` [U-Boot] [PATCH 01/31] ti: common: board_detect: Allow settings board detection variables manually Franklin S Cooper Jr
2017-03-02 19:10 ` Felipe Balbi [this message]
2017-03-02 19:52 ` Franklin S Cooper Jr
2017-03-02 19:04 ` [U-Boot] [PATCH 02/31] spl: fit: Break out some functions into a common file Franklin S Cooper Jr
2017-03-08 21:01 ` Simon Glass
2017-03-08 21:30 ` Franklin S Cooper Jr
2017-03-13 12:33 ` Simon Glass
2017-03-02 19:04 ` [U-Boot] [PATCH 03/31] boot_fit: Create helper functions that can be used to select DTB out of FIT Franklin S Cooper Jr
2017-03-02 19:04 ` [U-Boot] [PATCH 04/31] fdt: Enable selecting correct DTB from append FIT Image Franklin S Cooper Jr
2017-03-09 13:08 ` Tom Rini
2017-03-02 19:04 ` [U-Boot] [PATCH 05/31] ti: common: board_detect: Add function to determine if EEPROM was read Franklin S Cooper Jr
2017-03-09 13:08 ` Tom Rini
2017-03-02 19:04 ` [U-Boot] [PATCH 06/31] dts: Allow OF_LIST to depend on FIT_EMBED Franklin S Cooper Jr
2017-03-02 19:04 ` [U-Boot] [PATCH 07/31] arm: dts: Add new "generic" 66AK2Gx device tree file Franklin S Cooper Jr
2017-03-02 19:04 ` [U-Boot] [PATCH 08/31] ti: common: board_detect: Rename EEPROM scratch start macro Franklin S Cooper Jr
2017-03-02 19:04 ` [U-Boot] [PATCH 09/31] ti_armv7_keystone2: Define scratch space in SRAM Franklin S Cooper Jr
2017-03-09 13:08 ` Tom Rini
2017-03-02 19:04 ` [U-Boot] [PATCH 10/31] ARM: Use Kconfig for board EEPROM's I2C bus and chip address Franklin S Cooper Jr
2017-03-02 19:04 ` [U-Boot] [PATCH 11/31] ARM: k2g: Enable TI board detection code Franklin S Cooper Jr
2017-03-09 13:08 ` Tom Rini
2017-03-02 19:04 ` [U-Boot] [PATCH 12/31] board_f: Add new function to allow runtime DTB selection Franklin S Cooper Jr
2017-03-09 13:08 ` Tom Rini
2017-03-09 20:12 ` Lukasz Majewski
2017-03-10 15:42 ` Tom Rini
2017-03-30 16:22 ` Franklin S Cooper Jr
2017-03-02 19:04 ` [U-Boot] [PATCH 13/31] Makefile: Build additional binaries for dtb FIT blobs appended to U-boot Franklin S Cooper Jr
2017-03-09 13:08 ` Tom Rini
2017-03-02 19:04 ` [U-Boot] [PATCH 14/31] ARM: keystone2: Allow to build with all image formats Franklin S Cooper Jr
2017-03-09 13:08 ` Tom Rini
2017-03-02 19:04 ` [U-Boot] [PATCH 15/31] ARM: k2g: Define embedded_dtb_select for runtime DTB selection in U-boot Franklin S Cooper Jr
2017-03-09 13:08 ` Tom Rini
2017-03-02 19:04 ` [U-Boot] [PATCH 16/31] ARM: keystone2: Define board_fit_config_name_match for Keystone 2 boards Franklin S Cooper Jr
2017-03-09 13:08 ` Tom Rini
2017-03-02 19:04 ` [U-Boot] [PATCH 17/31] ks2_evm: Add EEPROM based board detection Franklin S Cooper Jr
2017-03-09 13:08 ` Tom Rini
2017-03-02 19:04 ` [U-Boot] [PATCH 18/31] defconfig: keystone2: Enable U-boot runtime DTB detection Franklin S Cooper Jr
2017-03-09 13:08 ` Tom Rini
2017-03-16 21:52 ` Franklin S Cooper Jr
2017-03-02 19:04 ` [U-Boot] [PATCH 19/31] ARM: keystone2: Add additional fields used for DDR3 configuration Franklin S Cooper Jr
2017-03-09 13:08 ` Tom Rini
2017-03-02 19:04 ` [U-Boot] [PATCH 20/31] ARM: k2g: Program DDR PHY MR2 register with the default value Franklin S Cooper Jr
2017-03-09 13:08 ` Tom Rini
2017-03-02 19:04 ` [U-Boot] [PATCH 21/31] ARM: k2g: Program DDRPHY_DATX8 registers via mask and value variables Franklin S Cooper Jr
2017-03-09 13:09 ` Tom Rini
2017-03-02 19:04 ` [U-Boot] [PATCH 22/31] ks2_evm: Add EEPROM based board detection helper functions Franklin S Cooper Jr
2017-03-09 13:09 ` Tom Rini
2017-03-02 19:04 ` [U-Boot] [PATCH 23/31] ARM: k2g: Add pinmux support for K2G ICE evm Franklin S Cooper Jr
2017-03-09 13:09 ` Tom Rini
2017-03-02 19:04 ` [U-Boot] [PATCH 24/31] ARM: k2g: Add DDR3 configuration " Franklin S Cooper Jr
2017-03-09 13:09 ` Tom Rini
2017-03-02 19:04 ` [U-Boot] [PATCH 25/31] board: ks2: Use board detection to wrap code not specific to " Franklin S Cooper Jr
2017-03-09 13:09 ` Tom Rini
2017-03-02 19:04 ` [U-Boot] [PATCH 26/31] ARM: k2g: Use board detection to wrap K2G GP specific calls Franklin S Cooper Jr
2017-03-09 13:09 ` Tom Rini
2017-03-02 19:04 ` [U-Boot] [PATCH 27/31] ARM: k2g: Update board_name u-boot env variable at runtime Franklin S Cooper Jr
2017-03-09 13:09 ` Tom Rini
2017-03-02 19:04 ` [U-Boot] [PATCH 28/31] ARM: dts: k2g: Disable netcp by default Franklin S Cooper Jr
2017-03-09 13:09 ` Tom Rini
2017-03-16 21:55 ` Franklin S Cooper Jr
2017-03-02 19:04 ` [U-Boot] [PATCH 29/31] ARM: dts: k2g: Add DT support for K2G Industrial Communication Engine evm Franklin S Cooper Jr
2017-03-09 13:09 ` Tom Rini
2017-03-16 21:56 ` Franklin S Cooper Jr
2017-03-17 14:08 ` Tom Rini
2017-03-02 19:04 ` [U-Boot] [PATCH 30/31] ARM: k2g: Add K2G ICE DTB to the list of possible DTBs Franklin S Cooper Jr
2017-03-09 13:10 ` Tom Rini
2017-03-02 19:04 ` [U-Boot] [PATCH 31/31] defconfig: k2g_evm_defconfig: Add K2G ICE to OF_LIST Franklin S Cooper Jr
2017-03-09 13:10 ` Tom Rini
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=87tw7bsdef.fsf@linux.intel.com \
--to=felipe.balbi@linux.intel.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