mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] ARM: i.MX8M: drop function prototype for removed imx8m_uid
@ 2024-02-28 17:51 Ahmad Fatoum
  2024-02-28 17:51 ` [PATCH 2/2] env: export getenv_ullx() helper Ahmad Fatoum
  2024-02-29  8:20 ` [PATCH 1/2] ARM: i.MX8M: drop function prototype for removed imx8m_uid Sascha Hauer
  0 siblings, 2 replies; 3+ messages in thread
From: Ahmad Fatoum @ 2024-02-28 17:51 UTC (permalink / raw)
  To: barebox; +Cc: mfe, Ahmad Fatoum

The i.MX8M UID and some other SoC-related info is now available over
soc0.soc_uid and imx8m_uid's function definition was removed.

Therefore remove the prototype as well.

Fixes: d392a0aea330 ("ARM: i.MX8M: convert the machine init to the soc driver")
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 include/mach/imx/imx8mq.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/include/mach/imx/imx8mq.h b/include/mach/imx/imx8mq.h
index df28b2a22caa..aafc4accd30e 100644
--- a/include/mach/imx/imx8mq.h
+++ b/include/mach/imx/imx8mq.h
@@ -87,6 +87,4 @@ static inline int imx8mq_cpu_revision(void)
 	return revision;
 }
 
-u64 imx8m_uid(void);
-
 #endif /* __MACH_IMX8_H */
-- 
2.39.2




^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 2/2] env: export getenv_ullx() helper
  2024-02-28 17:51 [PATCH 1/2] ARM: i.MX8M: drop function prototype for removed imx8m_uid Ahmad Fatoum
@ 2024-02-28 17:51 ` Ahmad Fatoum
  2024-02-29  8:20 ` [PATCH 1/2] ARM: i.MX8M: drop function prototype for removed imx8m_uid Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Ahmad Fatoum @ 2024-02-28 17:51 UTC (permalink / raw)
  To: barebox; +Cc: mfe, Ahmad Fatoum

getenv_ull() will parse values according to prefix:

  - If it starts with 0x, it's hexadecimal
  - If it's just 0, it's octal
  - otherwise, it's decimal

Some variables like i.MX8M soc0.soc_uid are hexadecimal without leading
0x. Therefore add a getenv_ullx helper, so code that used to do:

  uid = imx8m_uid();

can be replaced with

  getenv_ullx("soc0.soc_uid", &uid);

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 common/env.c          | 15 +++++++++++++--
 include/environment.h |  6 ++++++
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/common/env.c b/common/env.c
index d673b061ab7a..b68e998e46b1 100644
--- a/common/env.c
+++ b/common/env.c
@@ -343,17 +343,28 @@ const char *getenv_nonempty(const char *var)
 }
 EXPORT_SYMBOL(getenv_nonempty);
 
-int getenv_ull(const char *var , unsigned long long *val)
+static int getenv_ull_base(const char *var, int base, unsigned long long *val)
 {
 	const char *valstr = getenv(var);
 
 	if (!valstr || !*valstr)
 		return -EINVAL;
 
-	*val = simple_strtoull(valstr, NULL, 0);
+	*val = simple_strtoull(valstr, NULL, base);
 
 	return 0;
 }
+
+int getenv_ull(const char *var , unsigned long long *val)
+{
+	return getenv_ull_base(var, 0, val);
+}
+EXPORT_SYMBOL(getenv_ull);
+
+int getenv_ullx(const char *var , unsigned long long *val)
+{
+	return getenv_ull_base(var, 16, val);
+}
 EXPORT_SYMBOL(getenv_ull);
 
 int getenv_ul(const char *var , unsigned long *val)
diff --git a/include/environment.h b/include/environment.h
index 1557c3a1d730..8b143c16b7ad 100644
--- a/include/environment.h
+++ b/include/environment.h
@@ -35,6 +35,7 @@ int setenv(const char *, const char *);
 int pr_setenv(const char *, const char *fmt, ...)  __attribute__ ((format(__printf__, 2, 3)));
 void export_env_ull(const char *name, unsigned long long val);
 int getenv_ull(const char *name, unsigned long long *val);
+int getenv_ullx(const char *name, unsigned long long *val);
 int getenv_ul(const char *name, unsigned long *val);
 int getenv_uint(const char *name, unsigned int *val);
 int getenv_bool(const char *var, int *val);
@@ -63,6 +64,11 @@ static inline int getenv_ull(const char *name, unsigned long long *val)
 	return -EINVAL;
 }
 
+static inline int getenv_ullx(const char *name, unsigned long long *val)
+{
+	return -EINVAL;
+}
+
 static inline int getenv_ul(const char *name, unsigned long *val)
 {
 	return -EINVAL;
-- 
2.39.2




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] ARM: i.MX8M: drop function prototype for removed imx8m_uid
  2024-02-28 17:51 [PATCH 1/2] ARM: i.MX8M: drop function prototype for removed imx8m_uid Ahmad Fatoum
  2024-02-28 17:51 ` [PATCH 2/2] env: export getenv_ullx() helper Ahmad Fatoum
@ 2024-02-29  8:20 ` Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2024-02-29  8:20 UTC (permalink / raw)
  To: barebox, Ahmad Fatoum; +Cc: mfe


On Wed, 28 Feb 2024 18:51:27 +0100, Ahmad Fatoum wrote:
> The i.MX8M UID and some other SoC-related info is now available over
> soc0.soc_uid and imx8m_uid's function definition was removed.
> 
> Therefore remove the prototype as well.
> 
> 

Applied, thanks!

[1/2] ARM: i.MX8M: drop function prototype for removed imx8m_uid
      https://git.pengutronix.de/cgit/barebox/commit/?id=92a798ed6b94 (link may not be stable)
[2/2] env: export getenv_ullx() helper
      https://git.pengutronix.de/cgit/barebox/commit/?id=3aac1a9dfc97 (link may not be stable)

Best regards,
-- 
Sascha Hauer <s.hauer@pengutronix.de>




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-02-29  8:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-28 17:51 [PATCH 1/2] ARM: i.MX8M: drop function prototype for removed imx8m_uid Ahmad Fatoum
2024-02-28 17:51 ` [PATCH 2/2] env: export getenv_ullx() helper Ahmad Fatoum
2024-02-29  8:20 ` [PATCH 1/2] ARM: i.MX8M: drop function prototype for removed imx8m_uid Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox