From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sean Anderson Date: Fri, 5 Mar 2021 15:12:22 -0500 Subject: [PATCH v2 2/5] sysinfo: Provide some global/default IDs In-Reply-To: <20210305201225.3753841-1-sean.anderson@seco.com> References: <20210305201225.3753841-1-sean.anderson@seco.com> Message-ID: <20210305201225.3753841-3-sean.anderson@seco.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de This adds an ID for a board revision. Existing IDs have been moved above SYSINFO_ID_END to allow for future expansion. Signed-off-by: Sean Anderson --- Changes in v2: - Set BOARD_HWVERSION to SYSINFO_ID_REVISION, as they represent the same content. - Use enums instead of defines for sysinfo ids drivers/sysinfo/gazerbeam.h | 8 +++++--- drivers/sysinfo/sandbox.h | 2 +- include/sysinfo.h | 13 +++++++++++++ 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/drivers/sysinfo/gazerbeam.h b/drivers/sysinfo/gazerbeam.h index 171729d203..21514dd122 100644 --- a/drivers/sysinfo/gazerbeam.h +++ b/drivers/sysinfo/gazerbeam.h @@ -5,10 +5,12 @@ * */ +#include + enum { - BOARD_MULTICHANNEL, - BOARD_VARIANT, - BOARD_HWVERSION, + BOARD_HWVERSION = SYSINFO_ID_REVISION, + BOARD_MULTICHANNEL = SYSINFO_ID_END + 1, + BOARD_VARIANT }; enum { diff --git a/drivers/sysinfo/sandbox.h b/drivers/sysinfo/sandbox.h index 2cff494f56..9a67fd2389 100644 --- a/drivers/sysinfo/sandbox.h +++ b/drivers/sysinfo/sandbox.h @@ -5,7 +5,7 @@ */ enum { - BOOL_CALLED_DETECT, + BOOL_CALLED_DETECT = SYSINFO_ID_END + 1, INT_TEST1, INT_TEST2, STR_VACATIONSPOT, diff --git a/include/sysinfo.h b/include/sysinfo.h index c045d316b0..9386bdf49a 100644 --- a/include/sysinfo.h +++ b/include/sysinfo.h @@ -32,6 +32,19 @@ */ #if CONFIG_IS_ENABLED(SYSINFO) +/** + * enum sysinfo_id - IDs which may be passed to sysinfo accessors + */ +enum sysinfo_id { + /** @SYSINFO_ID_REVISION: Use this ID to access the board revision. */ + SYSINFO_ID_REVISION, + /** + * @SYSINFO_ID_END: The last global sysinfo id. If you need to return + * custom information, use SYSINFO_ID_END+1 as the base offset. + */ + SYSINFO_ID_END = 127, +}; + struct sysinfo_ops { /** * detect() - Run the hardware info detection procedure for this -- 2.25.1