* [PATCH 1/5] bbu: include necessary headers
@ 2015-02-27 19:22 Lucas Stach
2015-02-27 19:22 ` [PATCH 2/5] bbu: make bbu confirm a bit more verbose Lucas Stach
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Lucas Stach @ 2015-02-27 19:22 UTC (permalink / raw)
To: barebox
Fixes compile errors due to undefined symbols.
Signed-off-by: Lucas Stach <dev@lynxeye.de>
---
include/bbu.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/include/bbu.h b/include/bbu.h
index adb52b0..4a3d35e 100644
--- a/include/bbu.h
+++ b/include/bbu.h
@@ -2,6 +2,8 @@
#define __INCLUDE_BBU_H
#include <asm-generic/errno.h>
+#include <linux/list.h>
+#include <linux/types.h>
struct bbu_data {
#define BBU_FLAG_FORCE (1 << 0)
--
2.1.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/5] bbu: make bbu confirm a bit more verbose
2015-02-27 19:22 [PATCH 1/5] bbu: include necessary headers Lucas Stach
@ 2015-02-27 19:22 ` Lucas Stach
2015-02-27 19:22 ` [PATCH 3/5] ARM: tegra: add eMMC barebox update handler Lucas Stach
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: Lucas Stach @ 2015-02-27 19:22 UTC (permalink / raw)
To: barebox
It is a lot more user friendly if we give a bit more feedback.
Signed-off-by: Lucas Stach <dev@lynxeye.de>
---
common/bbu.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/common/bbu.c b/common/bbu.c
index e31f645..7fb154a 100644
--- a/common/bbu.c
+++ b/common/bbu.c
@@ -65,8 +65,10 @@ int bbu_confirm(struct bbu_data *data)
key = read_key();
- if (key == 'y')
+ if (key == 'y') {
+ printf("updating barebox...\n");
return 0;
+ }
return -EINTR;
}
--
2.1.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/5] ARM: tegra: add eMMC barebox update handler
2015-02-27 19:22 [PATCH 1/5] bbu: include necessary headers Lucas Stach
2015-02-27 19:22 ` [PATCH 2/5] bbu: make bbu confirm a bit more verbose Lucas Stach
@ 2015-02-27 19:22 ` Lucas Stach
2015-02-27 19:22 ` [PATCH 4/5] ARM: tegra: add barebox update handler to Beaver board Lucas Stach
2015-02-27 19:22 ` [PATCH 5/5] ARM: tegra: add barebox update handler to Jetson board Lucas Stach
3 siblings, 0 replies; 7+ messages in thread
From: Lucas Stach @ 2015-02-27 19:22 UTC (permalink / raw)
To: barebox
Signed-off-by: Lucas Stach <dev@lynxeye.de>
---
arch/arm/mach-tegra/Makefile | 1 +
arch/arm/mach-tegra/include/mach/tegra-bbu.h | 28 +++++++++++
arch/arm/mach-tegra/tegra-bbu.c | 74 ++++++++++++++++++++++++++++
3 files changed, 103 insertions(+)
create mode 100644 arch/arm/mach-tegra/include/mach/tegra-bbu.h
create mode 100644 arch/arm/mach-tegra/tegra-bbu.c
diff --git a/arch/arm/mach-tegra/Makefile b/arch/arm/mach-tegra/Makefile
index e68156a..7c4c1fd 100644
--- a/arch/arm/mach-tegra/Makefile
+++ b/arch/arm/mach-tegra/Makefile
@@ -13,3 +13,4 @@ lwl-y += tegra_maincomplex_init.o
obj-y += tegra20.o
obj-y += tegra20-pmc.o
obj-y += tegra20-timer.o
+obj-$(CONFIG_BAREBOX_UPDATE) += tegra-bbu.o
diff --git a/arch/arm/mach-tegra/include/mach/tegra-bbu.h b/arch/arm/mach-tegra/include/mach/tegra-bbu.h
new file mode 100644
index 0000000..32e2861
--- /dev/null
+++ b/arch/arm/mach-tegra/include/mach/tegra-bbu.h
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2015 Lucas Stach <l.stach@pengutronix.de>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <bbu.h>
+
+#ifdef CONFIG_BAREBOX_UPDATE
+int tegra_bbu_register_emmc_handler(const char *name, char *devicefile,
+ unsigned long flags);
+#else
+static int tegra_bbu_register_emmc_handler(const char *name, char *devicefile,
+ unsigned long flags)
+{
+ return 0;
+};
+#endif
diff --git a/arch/arm/mach-tegra/tegra-bbu.c b/arch/arm/mach-tegra/tegra-bbu.c
new file mode 100644
index 0000000..089e6c7
--- /dev/null
+++ b/arch/arm/mach-tegra/tegra-bbu.c
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2015 Lucas Stach <l.stach@pengutronix.de>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <common.h>
+#include <fcntl.h>
+#include <fs.h>
+#include <mach/tegra-bbu.h>
+#include <malloc.h>
+
+static int tegra_bbu_emmc_handler(struct bbu_handler *handler,
+ struct bbu_data *data)
+{
+
+ int fd, ret;
+
+ if (file_detect_type(data->image + 0x4000, data->len) !=
+ filetype_arm_barebox &&
+ !bbu_force(data, "Not an ARM barebox image"))
+ return -EINVAL;
+
+ ret = bbu_confirm(data);
+ if (ret)
+ return ret;
+
+ fd = open(data->devicefile, O_WRONLY);
+ if (fd < 0)
+ return fd;
+
+ ret = write(fd, data->image, data->len);
+ if (ret < 0) {
+ pr_err("writing update to %s failed with %s\n",
+ data->devicefile, strerror(-ret));
+ goto err_close;
+ }
+
+ ret = 0;
+
+err_close:
+ close(fd);
+
+ return ret;
+}
+
+int tegra_bbu_register_emmc_handler(const char *name, char *devicefile,
+ unsigned long flags)
+{
+ struct bbu_handler *handler;
+ int ret = 0;
+
+ handler = xzalloc(sizeof(*handler));
+ handler->name = name;
+ handler->devicefile = devicefile;
+ handler->flags = flags;
+ handler->handler = tegra_bbu_emmc_handler;
+
+ ret = bbu_register_handler(handler);
+ if (ret)
+ free(handler);
+
+ return ret;
+}
--
2.1.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/5] ARM: tegra: add barebox update handler to Beaver board
2015-02-27 19:22 [PATCH 1/5] bbu: include necessary headers Lucas Stach
2015-02-27 19:22 ` [PATCH 2/5] bbu: make bbu confirm a bit more verbose Lucas Stach
2015-02-27 19:22 ` [PATCH 3/5] ARM: tegra: add eMMC barebox update handler Lucas Stach
@ 2015-02-27 19:22 ` Lucas Stach
2015-03-01 7:23 ` Sascha Hauer
2015-02-27 19:22 ` [PATCH 5/5] ARM: tegra: add barebox update handler to Jetson board Lucas Stach
3 siblings, 1 reply; 7+ messages in thread
From: Lucas Stach @ 2015-02-27 19:22 UTC (permalink / raw)
To: barebox
Signed-off-by: Lucas Stach <dev@lynxeye.de>
---
arch/arm/boards/nvidia-beaver/board.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/arch/arm/boards/nvidia-beaver/board.c b/arch/arm/boards/nvidia-beaver/board.c
index d270301..b4d856e 100644
--- a/arch/arm/boards/nvidia-beaver/board.c
+++ b/arch/arm/boards/nvidia-beaver/board.c
@@ -19,6 +19,7 @@
#include <gpio.h>
#include <i2c/i2c.h>
#include <init.h>
+#include <mach/tegra-bbu.h>
static int nvidia_beaver_fs_init(void)
{
@@ -53,6 +54,9 @@ static int nvidia_beaver_device_init(void)
barebox_set_hostname("beaver");
+ tegra_bbu_register_emmc_handler("eMMC", "/dev/disk0.boot0",
+ BBU_HANDLER_FLAG_DEFAULT);
+
return 0;
}
device_initcall(nvidia_beaver_device_init);
--
2.1.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 5/5] ARM: tegra: add barebox update handler to Jetson board
2015-02-27 19:22 [PATCH 1/5] bbu: include necessary headers Lucas Stach
` (2 preceding siblings ...)
2015-02-27 19:22 ` [PATCH 4/5] ARM: tegra: add barebox update handler to Beaver board Lucas Stach
@ 2015-02-27 19:22 ` Lucas Stach
3 siblings, 0 replies; 7+ messages in thread
From: Lucas Stach @ 2015-02-27 19:22 UTC (permalink / raw)
To: barebox
Signed-off-by: Lucas Stach <dev@lynxeye.de>
---
arch/arm/boards/nvidia-jetson-tk1/board.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/arch/arm/boards/nvidia-jetson-tk1/board.c b/arch/arm/boards/nvidia-jetson-tk1/board.c
index 564e6a0..8d8dddf 100644
--- a/arch/arm/boards/nvidia-jetson-tk1/board.c
+++ b/arch/arm/boards/nvidia-jetson-tk1/board.c
@@ -19,6 +19,7 @@
#include <gpio.h>
#include <i2c/i2c.h>
#include <init.h>
+#include <mach/tegra-bbu.h>
#define AS3722_SD_VOLTAGE(n) (0x00 + (n))
#define AS3722_GPIO_CONTROL(n) (0x08 + (n))
@@ -56,6 +57,9 @@ static int nvidia_jetson_tk1_device_init(void)
barebox_set_hostname("jetson-tk1");
+ tegra_bbu_register_emmc_handler("eMMC", "/dev/disk0.boot0",
+ BBU_HANDLER_FLAG_DEFAULT);
+
return 0;
}
device_initcall(nvidia_jetson_tk1_device_init);
--
2.1.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 4/5] ARM: tegra: add barebox update handler to Beaver board
2015-02-27 19:22 ` [PATCH 4/5] ARM: tegra: add barebox update handler to Beaver board Lucas Stach
@ 2015-03-01 7:23 ` Sascha Hauer
2015-03-01 12:10 ` Lucas Stach
0 siblings, 1 reply; 7+ messages in thread
From: Sascha Hauer @ 2015-03-01 7:23 UTC (permalink / raw)
To: Lucas Stach; +Cc: barebox
On Fri, Feb 27, 2015 at 08:22:17PM +0100, Lucas Stach wrote:
> Signed-off-by: Lucas Stach <dev@lynxeye.de>
> ---
> arch/arm/boards/nvidia-beaver/board.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/arch/arm/boards/nvidia-beaver/board.c b/arch/arm/boards/nvidia-beaver/board.c
> index d270301..b4d856e 100644
> --- a/arch/arm/boards/nvidia-beaver/board.c
> +++ b/arch/arm/boards/nvidia-beaver/board.c
> @@ -19,6 +19,7 @@
> #include <gpio.h>
> #include <i2c/i2c.h>
> #include <init.h>
> +#include <mach/tegra-bbu.h>
>
> static int nvidia_beaver_fs_init(void)
> {
> @@ -53,6 +54,9 @@ static int nvidia_beaver_device_init(void)
>
> barebox_set_hostname("beaver");
>
> + tegra_bbu_register_emmc_handler("eMMC", "/dev/disk0.boot0",
> + BBU_HANDLER_FLAG_DEFAULT);
'disk0' is not a persistent name and will change when your SD slots are
probed in a different order. You should add aliases to the device nodes
and use of_alias_get() to obtain them, see for example imx-esdhc.c
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 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
* Re: [PATCH 4/5] ARM: tegra: add barebox update handler to Beaver board
2015-03-01 7:23 ` Sascha Hauer
@ 2015-03-01 12:10 ` Lucas Stach
0 siblings, 0 replies; 7+ messages in thread
From: Lucas Stach @ 2015-03-01 12:10 UTC (permalink / raw)
To: Sascha Hauer; +Cc: barebox
Am Sonntag, den 01.03.2015, 08:23 +0100 schrieb Sascha Hauer:
> On Fri, Feb 27, 2015 at 08:22:17PM +0100, Lucas Stach wrote:
> > Signed-off-by: Lucas Stach <dev@lynxeye.de>
> > ---
> > arch/arm/boards/nvidia-beaver/board.c | 4 ++++
> > 1 file changed, 4 insertions(+)
> >
> > diff --git a/arch/arm/boards/nvidia-beaver/board.c b/arch/arm/boards/nvidia-beaver/board.c
> > index d270301..b4d856e 100644
> > --- a/arch/arm/boards/nvidia-beaver/board.c
> > +++ b/arch/arm/boards/nvidia-beaver/board.c
> > @@ -19,6 +19,7 @@
> > #include <gpio.h>
> > #include <i2c/i2c.h>
> > #include <init.h>
> > +#include <mach/tegra-bbu.h>
> >
> > static int nvidia_beaver_fs_init(void)
> > {
> > @@ -53,6 +54,9 @@ static int nvidia_beaver_device_init(void)
> >
> > barebox_set_hostname("beaver");
> >
> > + tegra_bbu_register_emmc_handler("eMMC", "/dev/disk0.boot0",
> > + BBU_HANDLER_FLAG_DEFAULT);
>
> 'disk0' is not a persistent name and will change when your SD slots are
> probed in a different order. You should add aliases to the device nodes
> and use of_alias_get() to obtain them, see for example imx-esdhc.c
>
It's not a problem for these patches, as both boards have their
environment on disk0.boot1, so the eMMC will always be the first SDMMC
device to be detected and consequently always get number 0 assigned.
But in general I agree with you and will add the alias handling in a
follow on series.
Regards,
Lucas
_______________________________________________
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:[~2015-03-01 12:11 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-27 19:22 [PATCH 1/5] bbu: include necessary headers Lucas Stach
2015-02-27 19:22 ` [PATCH 2/5] bbu: make bbu confirm a bit more verbose Lucas Stach
2015-02-27 19:22 ` [PATCH 3/5] ARM: tegra: add eMMC barebox update handler Lucas Stach
2015-02-27 19:22 ` [PATCH 4/5] ARM: tegra: add barebox update handler to Beaver board Lucas Stach
2015-03-01 7:23 ` Sascha Hauer
2015-03-01 12:10 ` Lucas Stach
2015-02-27 19:22 ` [PATCH 5/5] ARM: tegra: add barebox update handler to Jetson board Lucas Stach
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox