mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/4] globalvar: add set_single function
@ 2020-09-12  7:12 Rouven Czerwinski
  2020-09-12  7:12 ` [PATCH] iotmaxx: gw4100: WDOG_ANY as GPIO output Rouven Czerwinski
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Rouven Czerwinski @ 2020-09-12  7:12 UTC (permalink / raw)
  To: barebox; +Cc: Rouven Czerwinski

Instead of overwriting the whole hierarchy beneath a globalvar, the
set_single function only sets the specific globalvar.

Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
---
 common/globalvar.c  | 11 +++++++++++
 include/globalvar.h |  1 +
 2 files changed, 12 insertions(+)

diff --git a/common/globalvar.c b/common/globalvar.c
index 98a028a68a..848a7d6832 100644
--- a/common/globalvar.c
+++ b/common/globalvar.c
@@ -399,6 +399,17 @@ void globalvar_set_match(const char *match, const char *val)
 	}
 }
 
+void globalvar_set_single(const char *match, const char *val)
+{
+	struct param_d *param;
+
+	list_for_each_entry(param, &global_device.parameters, list) {
+		if (!strncmp(match, param->name, strlen(match))
+		    && strlen(match) == strlen(param->name))
+			dev_set_param(&global_device, param->name, val);
+	}
+}
+
 static int globalvar_simple_set(struct device_d *dev, struct param_d *p, const char *val)
 {
 	struct device_d *rdev;
diff --git a/include/globalvar.h b/include/globalvar.h
index fc85e93e14..ceed020ff4 100644
--- a/include/globalvar.h
+++ b/include/globalvar.h
@@ -15,6 +15,7 @@ int globalvar_add_simple(const char *name, const char *value);
 void globalvar_remove(const char *name);
 char *globalvar_get_match(const char *match, const char *separator);
 void globalvar_set_match(const char *match, const char *val);
+void globalvar_set_single(const char *match, const char *val);
 
 int globalvar_add_simple_string(const char *name, char **value);
 int globalvar_add_simple_int(const char *name, int *value,
-- 
2.28.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH] iotmaxx: gw4100: WDOG_ANY as GPIO output
  2020-09-12  7:12 [PATCH 1/4] globalvar: add set_single function Rouven Czerwinski
@ 2020-09-12  7:12 ` Rouven Czerwinski
  2020-09-12  7:15   ` Rouven Czerwinski
  2020-09-12  7:12 ` [PATCH 2/4] blspec: only reset variable locations, not paths Rouven Czerwinski
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 7+ messages in thread
From: Rouven Czerwinski @ 2020-09-12  7:12 UTC (permalink / raw)
  To: barebox; +Cc: Rouven Czerwinski

Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
---
 dts/src/arm/imx7d-iotmaxx-gw4100.dts | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/dts/src/arm/imx7d-iotmaxx-gw4100.dts b/dts/src/arm/imx7d-iotmaxx-gw4100.dts
index 91befd2607..c9321ca7e0 100644
--- a/dts/src/arm/imx7d-iotmaxx-gw4100.dts
+++ b/dts/src/arm/imx7d-iotmaxx-gw4100.dts
@@ -220,6 +220,21 @@
 	};
 };
 
+&gpio7 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_gpio7>;
+	status = "okay";
+	gpio-line-names = "",
+	"", "", "", "", "",
+	"", "reset", "", "", "",
+	"", "", "", "", "",
+	"", "", "", "", "",
+	"", "", "", "", "",
+	"", "", "", "", "",
+	"";
+
+};
+
 &i2c1 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&pinctrl_i2c1>;
@@ -454,6 +469,11 @@
 		MX7D_PAD_SD3_STROBE__SD3_STROBE			0x1b
 		>;
 	};
+	pinctrl_gpio7: gpio7grp {
+		fsl,pins = <
+		MX7D_PAD_ENET1_COL__GPIO7_IO15			0x51
+		>;
+	};
 };
 
 &iomuxc_lpsr {
-- 
2.27.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 2/4] blspec: only reset variable locations, not paths
  2020-09-12  7:12 [PATCH 1/4] globalvar: add set_single function Rouven Czerwinski
  2020-09-12  7:12 ` [PATCH] iotmaxx: gw4100: WDOG_ANY as GPIO output Rouven Czerwinski
@ 2020-09-12  7:12 ` Rouven Czerwinski
  2020-09-12  7:12 ` [PATCH 3/4] blspec: fix bootm_data initialization Rouven Czerwinski
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Rouven Czerwinski @ 2020-09-12  7:12 UTC (permalink / raw)
  To: barebox; +Cc: Rouven Czerwinski

Configuration of the loadaddresses for image oftree and initrd can not
be done inside the bootloader spec yet, so using bootloader spec should
not override settings from the environment.

Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
---
 common/blspec.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/common/blspec.c b/common/blspec.c
index 9e1036c834..b3b1fe422e 100644
--- a/common/blspec.c
+++ b/common/blspec.c
@@ -137,9 +137,9 @@ static int blspec_boot(struct bootentry *be, int verbose, int dryrun)
 	};
 
 	globalvar_set_match("linux.bootargs.dyn.", "");
-	globalvar_set_match("bootm.image", "");
-	globalvar_set_match("bootm.oftree", "");
-	globalvar_set_match("bootm.initrd", "");
+	globalvar_set_single("bootm.image", "");
+	globalvar_set_single("bootm.oftree", "");
+	globalvar_set_single("bootm.initrd", "");
 
 	bootm_data_init_defaults(&data);
 
-- 
2.28.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 3/4] blspec: fix bootm_data initialization
  2020-09-12  7:12 [PATCH 1/4] globalvar: add set_single function Rouven Czerwinski
  2020-09-12  7:12 ` [PATCH] iotmaxx: gw4100: WDOG_ANY as GPIO output Rouven Czerwinski
  2020-09-12  7:12 ` [PATCH 2/4] blspec: only reset variable locations, not paths Rouven Czerwinski
@ 2020-09-12  7:12 ` Rouven Czerwinski
  2020-09-12  7:12 ` [PATCH 4/4] fastboot: only unset image, not loadaddr Rouven Czerwinski
  2020-09-14  9:13 ` [PATCH 1/4] globalvar: add set_single function Sascha Hauer
  4 siblings, 0 replies; 7+ messages in thread
From: Rouven Czerwinski @ 2020-09-12  7:12 UTC (permalink / raw)
  To: barebox; +Cc: Rouven Czerwinski

Remove initialization of the verbose struct member, it will be
overwritten by the call to bootm_data_init_defaults(). Also remove
members which are initialized in the call.
Verbose should be enabled if either the argument or variable is set, so
|| both.

Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
---
 common/blspec.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/common/blspec.c b/common/blspec.c
index b3b1fe422e..7d5b4a482e 100644
--- a/common/blspec.c
+++ b/common/blspec.c
@@ -130,9 +130,6 @@ static int blspec_boot(struct bootentry *be, int verbose, int dryrun)
 	const char *overlays;
 	const char *appendroot;
 	struct bootm_data data = {
-		.initrd_address = UIMAGE_INVALID_ADDRESS,
-		.os_address = UIMAGE_SOME_ADDRESS,
-		.verbose = verbose,
 		.dryrun = dryrun,
 	};
 
@@ -143,6 +140,8 @@ static int blspec_boot(struct bootentry *be, int verbose, int dryrun)
 
 	bootm_data_init_defaults(&data);
 
+	data.verbose = verbose || data.verbose;
+
 	devicetree = blspec_entry_var_get(entry, "devicetree");
 	initrd = blspec_entry_var_get(entry, "initrd");
 	options = blspec_entry_var_get(entry, "options");
-- 
2.28.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 4/4] fastboot: only unset image, not loadaddr
  2020-09-12  7:12 [PATCH 1/4] globalvar: add set_single function Rouven Czerwinski
                   ` (2 preceding siblings ...)
  2020-09-12  7:12 ` [PATCH 3/4] blspec: fix bootm_data initialization Rouven Czerwinski
@ 2020-09-12  7:12 ` Rouven Czerwinski
  2020-09-14  9:13 ` [PATCH 1/4] globalvar: add set_single function Sascha Hauer
  4 siblings, 0 replies; 7+ messages in thread
From: Rouven Czerwinski @ 2020-09-12  7:12 UTC (permalink / raw)
  To: barebox; +Cc: Rouven Czerwinski

In case the board needs to setup the load address of the kernel, don't
overwrite the variable, instead only override the image.

Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
---
 common/fastboot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/fastboot.c b/common/fastboot.c
index 302720c43d..5402a56e66 100644
--- a/common/fastboot.c
+++ b/common/fastboot.c
@@ -383,7 +383,7 @@ static void __maybe_unused cb_boot(struct fastboot *fb, const char *opt)
 	fastboot_tx_print(fb, FASTBOOT_MSG_INFO, "Booting kernel..\n");
 
 	globalvar_set_match("linux.bootargs.dyn.", "");
-	globalvar_set_match("bootm.image", "");
+	globalvar_set_single("bootm.image", "");
 
 	data.os_file = fb->tempname;
 
-- 
2.28.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH] iotmaxx: gw4100: WDOG_ANY as GPIO output
  2020-09-12  7:12 ` [PATCH] iotmaxx: gw4100: WDOG_ANY as GPIO output Rouven Czerwinski
@ 2020-09-12  7:15   ` Rouven Czerwinski
  0 siblings, 0 replies; 7+ messages in thread
From: Rouven Czerwinski @ 2020-09-12  7:15 UTC (permalink / raw)
  To: barebox

Hi,

On Sat, 2020-09-12 at 09:12 +0200, Rouven Czerwinski wrote:
> Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
> ---
>  dts/src/arm/imx7d-iotmaxx-gw4100.dts | 20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)
> 
> diff --git a/dts/src/arm/imx7d-iotmaxx-gw4100.dts
> b/dts/src/arm/imx7d-iotmaxx-gw4100.dts
> index 91befd2607..c9321ca7e0 100644
> --- a/dts/src/arm/imx7d-iotmaxx-gw4100.dts
> +++ b/dts/src/arm/imx7d-iotmaxx-gw4100.dts
> @@ -220,6 +220,21 @@
>  	};
>  };
>  
> +&gpio7 {
> +	pinctrl-names = "default";
> +	pinctrl-0 = <&pinctrl_gpio7>;
> +	status = "okay";
> +	gpio-line-names = "",
> +	"", "", "", "", "",
> +	"", "reset", "", "", "",
> +	"", "", "", "", "",
> +	"", "", "", "", "",
> +	"", "", "", "", "",
> +	"", "", "", "", "",
> +	"";
> +
> +};
> +
>  &i2c1 {
>  	pinctrl-names = "default";
>  	pinctrl-0 = <&pinctrl_i2c1>;
> @@ -454,6 +469,11 @@
>  		MX7D_PAD_SD3_STROBE__SD3_STROBE			0x1b
>  		>;
>  	};
> +	pinctrl_gpio7: gpio7grp {
> +		fsl,pins = <
> +		MX7D_PAD_ENET1_COL__GPIO7_IO15			0x51
> +		>;
> +	};
>  };
>  
>  &iomuxc_lpsr {

Please ignore this, leftover patch in my patch directory.

Regards,
Rouven


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH 1/4] globalvar: add set_single function
  2020-09-12  7:12 [PATCH 1/4] globalvar: add set_single function Rouven Czerwinski
                   ` (3 preceding siblings ...)
  2020-09-12  7:12 ` [PATCH 4/4] fastboot: only unset image, not loadaddr Rouven Czerwinski
@ 2020-09-14  9:13 ` Sascha Hauer
  4 siblings, 0 replies; 7+ messages in thread
From: Sascha Hauer @ 2020-09-14  9:13 UTC (permalink / raw)
  To: Rouven Czerwinski; +Cc: barebox

Hi Rouven,

On Sat, Sep 12, 2020 at 09:12:37AM +0200, Rouven Czerwinski wrote:
> Instead of overwriting the whole hierarchy beneath a globalvar, the
> set_single function only sets the specific globalvar.
> 
> Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
> ---
>  common/globalvar.c  | 11 +++++++++++
>  include/globalvar.h |  1 +
>  2 files changed, 12 insertions(+)
> 
> diff --git a/common/globalvar.c b/common/globalvar.c
> index 98a028a68a..848a7d6832 100644
> --- a/common/globalvar.c
> +++ b/common/globalvar.c
> @@ -399,6 +399,17 @@ void globalvar_set_match(const char *match, const char *val)
>  	}
>  }
>  
> +void globalvar_set_single(const char *match, const char *val)
> +{
> +	struct param_d *param;
> +
> +	list_for_each_entry(param, &global_device.parameters, list) {
> +		if (!strncmp(match, param->name, strlen(match))
> +		    && strlen(match) == strlen(param->name))

What's the difference between this construct and plain strcmp()?

> +			dev_set_param(&global_device, param->name, val);

And then, why not call dev_set_param directly with "match" as argument?

I would rename "match" to "name" as it describes a single variable name.
Also "globalvar_set" is IMO enough as a function name.

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

end of thread, other threads:[~2020-09-14  9:13 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-12  7:12 [PATCH 1/4] globalvar: add set_single function Rouven Czerwinski
2020-09-12  7:12 ` [PATCH] iotmaxx: gw4100: WDOG_ANY as GPIO output Rouven Czerwinski
2020-09-12  7:15   ` Rouven Czerwinski
2020-09-12  7:12 ` [PATCH 2/4] blspec: only reset variable locations, not paths Rouven Czerwinski
2020-09-12  7:12 ` [PATCH 3/4] blspec: fix bootm_data initialization Rouven Czerwinski
2020-09-12  7:12 ` [PATCH 4/4] fastboot: only unset image, not loadaddr Rouven Czerwinski
2020-09-14  9:13 ` [PATCH 1/4] globalvar: add set_single function Sascha Hauer

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