[PATCH v1] MIPS: tplink-wdr4300_defconfig: enable RATP

2017-09-29 Thread Oleksij Rempel
In some cases, if we have cache issues, it is useful to have
good connection to the target. RATP seems to be a good protocol
for this case.

Signed-off-by: Oleksij Rempel 
---
 arch/mips/configs/tplink-wdr4300_defconfig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/mips/configs/tplink-wdr4300_defconfig 
b/arch/mips/configs/tplink-wdr4300_defconfig
index 46093d243..8d5084006 100644
--- a/arch/mips/configs/tplink-wdr4300_defconfig
+++ b/arch/mips/configs/tplink-wdr4300_defconfig
@@ -10,6 +10,7 @@ CONFIG_MALLOC_TLSF=y
 CONFIG_HUSH_FANCY_PROMPT=y
 CONFIG_CMDLINE_EDITING=y
 CONFIG_AUTO_COMPLETE=y
+CONFIG_CONSOLE_RATP=y
 CONFIG_DEFAULT_ENVIRONMENT_GENERIC_NEW=y
 CONFIG_CMD_DMESG=y
 CONFIG_LONGHELP=y
@@ -78,5 +79,6 @@ CONFIG_LED_GPIO_OF=y
 CONFIG_LED_TRIGGERS=y
 CONFIG_FS_TFTP=y
 CONFIG_FS_NFS=y
+CONFIG_FS_RATP=y
 CONFIG_DIGEST_SHA224_GENERIC=y
 CONFIG_DIGEST_SHA256_GENERIC=y
-- 
2.11.0


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


[PATCH v1 1/2] clk: add ar9344 clock driver

2017-09-29 Thread Oleksij Rempel
Signed-off-by: Oleksij Rempel 
---
 drivers/clk/Makefile |   3 +-
 drivers/clk/clk-ar9344.c | 148 +++
 2 files changed, 150 insertions(+), 1 deletion(-)
 create mode 100644 drivers/clk/clk-ar9344.c

diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile
index b5abe1cdf..ddd971c60 100644
--- a/drivers/clk/Makefile
+++ b/drivers/clk/Makefile
@@ -9,6 +9,7 @@ obj-$(CONFIG_ARCH_MXS)  += mxs/
 obj-$(CONFIG_ARCH_ROCKCHIP)+= rockchip/
 obj-$(CONFIG_ARCH_TEGRA)   += tegra/
 obj-$(CONFIG_CLK_SOCFPGA)  += socfpga/
-obj-$(CONFIG_MACH_MIPS_ATH79)  += clk-ar933x.o
+obj-$(CONFIG_SOC_QCA_AR9331)   += clk-ar933x.o
+obj-$(CONFIG_SOC_QCA_AR9344)   += clk-ar9344.o
 obj-$(CONFIG_ARCH_IMX) += imx/
 obj-$(CONFIG_COMMON_CLK_AT91)  += at91/
diff --git a/drivers/clk/clk-ar9344.c b/drivers/clk/clk-ar9344.c
new file mode 100644
index 0..c3c49fb10
--- /dev/null
+++ b/drivers/clk/clk-ar9344.c
@@ -0,0 +1,148 @@
+/*
+ * Copyright (C) 2017 Oleksij Rempel 
+ *
+ * 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.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#define AR9344_CPU_PLL_CONFIG  0x00
+#define AR9344_DDR_PLL_CONFIG  0x04
+#define AR9344_OUTDIV_M0x3
+#define AR9344_OUTDIV_S19
+#define AR9344_REFDIV_M0x1f
+#define AR9344_REFDIV_S12
+#define AR9344_NINT_M  0x3f
+#define AR9344_NINT_S  6
+#define AR9344_NFRAC_M 0x3f
+#define AR9344_NFRAC_S 0
+
+
+#define AR9344_CPU_DDR_CLOCK_CONTROL   0x08
+#define AR9344_CPU_FROM_CPUPLL BIT(20)
+#define AR9344_CPU_PLL_BYPASS  BIT(2)
+#define AR9344_CPU_POST_DIV_M  0x1f
+#define AR9344_CPU_POST_DIV_S  5
+
+static struct clk *clks[ATH79_CLK_END];
+static struct clk_onecell_data clk_data;
+
+struct clk_ar9344 {
+   struct clk clk;
+   void __iomem *base;
+   u32 div_shift;
+   u32 div_mask;
+   const char *parent;
+};
+
+static unsigned long clk_ar9344_recalc_rate(struct clk *clk,
+   unsigned long parent_rate)
+{
+   struct clk_ar9344 *f = container_of(clk, struct clk_ar9344, clk);
+   int outdiv, refdiv, nint, nfrac;
+   int cpu_post_div;
+   u32 clock_ctrl;
+   u32 val;
+
+   clock_ctrl = __raw_readl(f->base + AR9344_CPU_DDR_CLOCK_CONTROL);
+   cpu_post_div = ((clock_ctrl >> AR9344_CPU_POST_DIV_S)
+   & AR9344_CPU_POST_DIV_M) + 1;
+   if (clock_ctrl & AR9344_CPU_PLL_BYPASS) {
+   return parent_rate;
+   } else if (clock_ctrl & AR9344_CPU_FROM_CPUPLL) {
+   val = __raw_readl(f->base + AR9344_CPU_PLL_CONFIG);
+   } else {
+   val = __raw_readl(f->base + AR9344_DDR_PLL_CONFIG);
+   }
+
+   outdiv = (val >> AR9344_OUTDIV_S) & AR9344_OUTDIV_M;
+   refdiv = (val >> AR9344_REFDIV_S) & AR9344_REFDIV_M;
+   nint = (val >> AR9344_NINT_S) & AR9344_NINT_M;
+   nfrac = (val >> AR9344_NFRAC_S) & AR9344_NFRAC_M;
+
+   return (parent_rate * (nint + (nfrac >> 9))) / (refdiv * (1 << outdiv));
+}
+
+struct clk_ops clk_ar9344_ops = {
+   .recalc_rate = clk_ar9344_recalc_rate,
+};
+
+static struct clk *clk_ar9344(const char *name, const char *parent,
+   void __iomem *base)
+{
+   struct clk_ar9344 *f = xzalloc(sizeof(*f));
+
+   f->parent = parent;
+   f->base = base;
+   f->div_shift = 0;
+   f->div_mask = 0;
+
+   f->clk.ops = _ar9344_ops;
+   f->clk.name = name;
+   f->clk.parent_names = >parent;
+   f->clk.num_parents = 1;
+
+   clk_register(>clk);
+
+   return >clk;
+}
+
+static void ar9344_pll_init(void __iomem *base)
+{
+   clks[ATH79_CLK_CPU] = clk_ar9344("cpu", "ref", base);
+}
+
+static int ar9344_clk_probe(struct device_d *dev)
+{
+   struct resource *iores;
+   void __iomem *base;
+
+   iores = dev_request_mem_resource(dev, 0);
+   if (IS_ERR(iores))
+   return PTR_ERR(iores);
+   base = IOMEM(iores->start);
+
+   ar9344_pll_init(base);
+
+   clk_data.clks = clks;
+   clk_data.clk_num = ARRAY_SIZE(clks);
+   of_clk_add_provider(dev->device_node, of_clk_src_onecell_get,
+   _data);
+
+   return 0;
+}
+
+static __maybe_unused struct 

[PATCH v1 2/2] MIPS: dts: ar9344: add pll node

2017-09-29 Thread Oleksij Rempel
Signed-off-by: Oleksij Rempel 
---
 arch/mips/dts/ar9344.dtsi | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/arch/mips/dts/ar9344.dtsi b/arch/mips/dts/ar9344.dtsi
index 3e105174d..0a7171b8d 100644
--- a/arch/mips/dts/ar9344.dtsi
+++ b/arch/mips/dts/ar9344.dtsi
@@ -13,6 +13,7 @@
cpu@0 {
device_type = "cpu";
compatible = "mips,mips74Kc";
+   clocks = < ATH79_CLK_CPU>;
reg = <0>;
};
};
@@ -47,6 +48,16 @@
status = "disabled";
};
 
+   pll: pll-controller@1805 {
+   compatible = "qca,ar9344-pll";
+   reg = <0x1805 0x100>;
+
+   clocks = <>;
+   clock-names = "ref";
+
+   #clock-cells = <1>;
+   };
+
spi: spi@1f00 {
compatible = "qca,ar7100-spi", "qca,ar9344-spi";
reg = <0x1f00 0x1c>;
-- 
2.11.0


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


[PATCH] net: ag71xx: define parent devices

2017-09-29 Thread Oleksij Rempel
without it we are not able to set mac address from other driver.

Signed-off-by: Oleksij Rempel 
---
 drivers/net/ag71xx.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/ag71xx.c b/drivers/net/ag71xx.c
index 1cec26360..a422aacdd 100644
--- a/drivers/net/ag71xx.c
+++ b/drivers/net/ag71xx.c
@@ -580,6 +580,7 @@ static int ag71xx_probe(struct device_d *dev)
miibus = >miibus;
dev->priv = edev;
edev->priv = priv;
+   edev->parent = dev;
 
edev->init = ag71xx_ether_init;
edev->open = ag71xx_ether_open;
@@ -597,6 +598,7 @@ static int ag71xx_probe(struct device_d *dev)
miibus->read = ag71xx_ether_mii_read;
miibus->write = ag71xx_ether_mii_write;
miibus->priv = priv;
+   miibus->parent = dev;
 
/* enable switch core */
rd = ar7240_reg_rd(AR71XX_PLL_BASE + AR933X_ETHSW_CLOCK_CONTROL_REG);
-- 
2.11.0


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


Re: [PATCH 0/2] spi: imx: don't loop endlessly

2017-09-29 Thread Alexander Kurz
Hi,
during xchg_single 32 bits will be sent and received:
2x32 bits / 10 Microseconds = 6.4MHz Clock.

Hence, a 10 Microseconds timeout will break SPI communication for
boards with SPI frequencies less then 6.4MHz.
On some boards spi-max-frequency is limited due to improper communication
at higher frequencies, e.g. for the kindle4 it is 1MHz and there 
also exists one board with 100kHz.

Before sending a patch calculating the timeout from spi-max-frequency,
is 640 Microseconds (to fit imx28-cfa10049.dts 100kHz) acceptable?

Regards, Alexander



On Wed, 2 Aug 2017, Uwe Kleine-König wrote:

> Hello,
> 
> during bringup of an i.MX7 board I am faced with cspi_2_3_xchg_single not
> returning. I don't know yet why this happens, but with this patch set it at 
> least
> doesn't block barebox.
> 
> I didn't test on a working board, maybe the timeout (10 ?s) I chose is too 
> tight?
> 
> Best regards
> Uwe
> 
> Uwe Kleine-K?nig (2):
>   spi: imx: add error checking
>   spi: imx: add timeout to xchg_single
> 
>  drivers/spi/imx_spi.c | 105 
> ++
>  1 file changed, 72 insertions(+), 33 deletions(-)
> 
> -- 
> 2.11.0
> 
> 
> ___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: [PATCH 2/4] usbgadget: do not register when no functions present

2017-09-29 Thread Oleksij Rempel
On Wed, Sep 27, 2017 at 11:12:43AM +0200, Sascha Hauer wrote:
> registering a multifunction device makes only sense when there's
> at least one function configured. Just return otherwise.
> 
> Signed-off-by: Sascha Hauer 
> ---
>  drivers/usb/gadget/autostart.c | 4 
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/usb/gadget/autostart.c b/drivers/usb/gadget/autostart.c
> index 3fa43137fa..a27be899c3 100644
> --- a/drivers/usb/gadget/autostart.c
> +++ b/drivers/usb/gadget/autostart.c
> @@ -55,6 +55,10 @@ static int usbgadget_autostart(void)
>  
>   opts->create_acm = acm;
>  
> + if (!opts->fastboot_opts.files && !opts->create_acm) {
> + pr_warn("No functions to register\n");
> + return 0;
> + }
>  
>   ret = usb_multi_register(opts);
>   if (ret)
> -- 
> 2.11.0
> 
> 

Reviewed-by: Oleksij Rempel 

-- 
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- |

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


Re: [PATCH 1/4] usbgadget: autostart: Handle errors in file list gracefully

2017-09-29 Thread Oleksij Rempel
On Wed, Sep 27, 2017 at 11:12:42AM +0200, Sascha Hauer wrote:
> file_list_parse() can fail and returns an error pointer. Print
> an error message when it fails and also set to NULL again so
> that usb_multi_register() does not stumble upon the error pointer.
> 
> Signed-off-by: Sascha Hauer 
> ---
>  drivers/usb/gadget/autostart.c | 10 +-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/gadget/autostart.c b/drivers/usb/gadget/autostart.c
> index 465d8fd380..3fa43137fa 100644
> --- a/drivers/usb/gadget/autostart.c
> +++ b/drivers/usb/gadget/autostart.c
> @@ -11,6 +11,8 @@
>   * GNU General Public License for more details.
>   *
>   */
> +#define pr_fmt(fmt) "usbgadget autostart: " fmt
> +
>  #include 
>  #include 
>  #include 
> @@ -42,8 +44,14 @@ static int usbgadget_autostart(void)
>   opts = xzalloc(sizeof(*opts));
>   opts->release = usb_multi_opts_release;
>  
> - if (fastboot_function)
> + if (fastboot_function) {
>   opts->fastboot_opts.files = file_list_parse(fastboot_function);
> + if (IS_ERR(opts->fastboot_opts.files)) {
> + pr_err("Parsing file list \"%s\" failed: %s\n", 
> fastboot_function,
> +strerrorp(opts->fastboot_opts.files));
> + opts->fastboot_opts.files = NULL;
> + }
> + }
>  
>   opts->create_acm = acm;

Reviewed-by: Oleksij Rempel 

-- 
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- |

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


Re: how to persistently save config values

2017-09-29 Thread Sascha Hauer
On Fri, Sep 29, 2017 at 02:31:40PM +0200, Giorgio Dal Molin wrote:
> Hi Sascha,
> 
> thank you for the answer.
> 
> I just experimented a bit with the environment and the nv vars
> and I think I'll go this way.
> 
> I was a bit surprised by the saveenv command though: my understanding
> of the (default) environment was that it was a read only blob
> hardcoded in the barebox image

Yes, it is.

> I thought if I want some new/dynamic
> env content to be saved for the next reboot I have to explicitly provide
> a storage disk/cf/mtd partition to the saveenv and then to the loadenv.

Yes, true. Normally the board code provides a storage place. In case of
UEFI the storage place is set to a EFI Variable in common/efi/efi.c:305

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- |

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


Re: [RFC v4 02/10] RISC-V: add Erizo SoC support

2017-09-29 Thread Oleksij Rempel
Probably it is better to send it as patch not as RFC ;)

Am 29.09.2017 um 01:12 schrieb Antony Pavlov:
> Erizo is an opensource hardware SoC for FPGA.
> 
> Signed-off-by: Antony Pavlov 
> ---
>  arch/riscv/Kconfig | 11 +++
>  arch/riscv/Makefile|  3 ++
>  arch/riscv/boards/erizo-generic/.gitignore |  1 +
>  arch/riscv/boards/erizo-generic/Makefile   |  1 +
>  arch/riscv/boards/erizo-generic/board.c| 28 ++
>  arch/riscv/dts/erizo.dtsi  | 46 
> ++
>  arch/riscv/dts/erizo_generic.dts   | 31 
>  arch/riscv/mach-erizo/Kconfig  | 11 +++
>  arch/riscv/mach-erizo/Makefile |  3 ++
>  9 files changed, 135 insertions(+)
> 
> diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
> index b2f0817ef..f4bfbea7c 100644
> --- a/arch/riscv/Kconfig
> +++ b/arch/riscv/Kconfig
> @@ -20,6 +20,15 @@ config GENERIC_LINKER_SCRIPT
>  
>  menu "Machine selection"
>  
> +choice
> + prompt "System type"
> + default MACH_ERIZO
> +
> +config MACH_ERIZO
> + bool "erizo family"
> +
> +endchoice
> +
>  choice
>   prompt "CPU selection"
>   default CPU_RV_GENERIC
> @@ -62,6 +71,8 @@ config BUILTIN_DTB_NAME
>   string "DTB to build into the barebox image"
>   depends on BUILTIN_DTB
>  
> +source arch/riscv/mach-erizo/Kconfig
> +
>  endmenu
>  
>  source common/Kconfig
> diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile
> index 4e3318cf1..8947a1860 100644
> --- a/arch/riscv/Makefile
> +++ b/arch/riscv/Makefile
> @@ -7,6 +7,9 @@ cflags-y += -Wall -Wmissing-prototypes -Wstrict-prototypes \
>  LDFLAGS += $(ldflags-y)
>  LDFLAGS_barebox += -nostdlib
>  
> +machine-$(CONFIG_MACH_ERIZO) := erizo
> +board-$(CONFIG_BOARD_ERIZO_GENERIC)  := erizo-generic
> +
>  TEXT_BASE = $(CONFIG_TEXT_BASE)
>  CPPFLAGS += -DTEXT_BASE=$(CONFIG_TEXT_BASE)
>  
> diff --git a/arch/riscv/boards/erizo-generic/.gitignore 
> b/arch/riscv/boards/erizo-generic/.gitignore
> new file mode 100644
> index 0..d1165788c
> --- /dev/null
> +++ b/arch/riscv/boards/erizo-generic/.gitignore
> @@ -0,0 +1 @@
> +barebox.lds
> diff --git a/arch/riscv/boards/erizo-generic/Makefile 
> b/arch/riscv/boards/erizo-generic/Makefile
> new file mode 100644
> index 0..dcfc2937d
> --- /dev/null
> +++ b/arch/riscv/boards/erizo-generic/Makefile
> @@ -0,0 +1 @@
> +obj-y += board.o
> diff --git a/arch/riscv/boards/erizo-generic/board.c 
> b/arch/riscv/boards/erizo-generic/board.c
> new file mode 100644
> index 0..ecda85001
> --- /dev/null
> +++ b/arch/riscv/boards/erizo-generic/board.c
> @@ -0,0 +1,28 @@
> +/*
> + * Copyright (C) 2016 Antony Pavlov 
> + *
> + * This file is part of barebox.
> + * See file CREDITS for list of people who contributed to this project.
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2
> + * as published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that 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.
> + *
> + */
> +
> +#include 
> +#include 
> +#include 
> +
> +static int hostname_init(void)
> +{
> + barebox_set_hostname("barebox");

please, use board name. Maybe: erizo-generic or so.
For network boot the filenames will be constructed as following:
username-hostname-filetype


> +
> + return 0;
> +}
> +postcore_initcall(hostname_init);
> diff --git a/arch/riscv/dts/erizo.dtsi b/arch/riscv/dts/erizo.dtsi
> new file mode 100644
> index 0..1660ad104
> --- /dev/null
> +++ b/arch/riscv/dts/erizo.dtsi
> @@ -0,0 +1,46 @@
> +/dts-v1/;
> +
> +#include "skeleton.dtsi"
> +
> +/ {
> + compatible = "miet-riscv-workgroup,erizo";
> +
> + #address-cells = <1>;
> + #size-cells = <1>;
> +
> + clocks {
> + ref_clk: ref_clk {
> + #clock-cells = <0>;
> + compatible = "fixed-clock";
> + clock-frequency = <2400>;
> + };
> + };
> +
> + cpus {
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + cpu@0 {
> + device_type = "cpu";
> + compatible = "cliffordwolf,picorv32";
> + clocks = <_clk>;
> + reg = <0>;
> + };
> + };
> +
> + uart0: uart@9000 {
> + compatible = "ns16550a";
> + reg = <0x9000 0x20>;
> + reg-shift = <2>;
> + clocks = <_clk>;
> + };
> +
> + gpio0: gpio@9100 {
> + compatible = "wd,mbl-gpio";
> + reg-names = "dat", "dirout";
> + reg = <0x9100 0x4>,
> + 

Re: [RFC v4 01/10] Add initial RISC-V architecture support

2017-09-29 Thread Oleksij Rempel
Hi,

hm... mostly looks identical with existing arch

Am 29.09.2017 um 01:12 schrieb Antony Pavlov:
> Signed-off-by: Antony Pavlov 
> --
> TODOs:
> 
>   * split patch;
> ---
>  arch/riscv/Kconfig   | 73 +
>  arch/riscv/Makefile  | 68 +++
>  arch/riscv/boot/Makefile |  2 +
>  arch/riscv/boot/main_entry.c | 40 
>  arch/riscv/boot/start.S  | 74 ++
>  arch/riscv/dts/.gitignore|  >  arch/riscv/dts/Makefile   
>|  9 
>  arch/riscv/dts/skeleton.dtsi | 13 ++
>  arch/riscv/include/asm/barebox.h |  1 +
>  arch/riscv/include/asm/bitops.h  | 35 ++
>  arch/riscv/include/asm/bitsperlong.h | 10 
>  arch/riscv/include/asm/byteorder.h   | 10 
>  arch/riscv/include/asm/common.h  |  6 +++
>  arch/riscv/include/asm/elf.h | 11 +
>  arch/riscv/include/asm/io.h  |  8 
>  arch/riscv/include/asm/mmu.h |  6 +++
>  arch/riscv/include/asm/posix_types.h |  1 +
>  arch/riscv/include/asm/sections.h|  1 +
>  arch/riscv/include/asm/string.h  |  1 +
>  arch/riscv/include/asm/swab.h|  6 +++
>  arch/riscv/include/asm/types.h   | 60 
>  arch/riscv/include/asm/unaligned.h   | 19 
>  arch/riscv/lib/.gitignore|  1 +
>  arch/riscv/lib/Makefile  |  9 
>  arch/riscv/lib/ashldi3.c | 28 
>  arch/riscv/lib/ashrdi3.c | 30 
>  arch/riscv/lib/asm-offsets.c | 12 +
>  arch/riscv/lib/barebox.lds.S | 89 
> 
>  arch/riscv/lib/dtb.c | 41 +
>  arch/riscv/lib/libgcc.h  | 29 
>  arch/riscv/lib/lshrdi3.c | 28 
>  arch/riscv/lib/riscv_timer.c | 68 +++
>  drivers/of/Kconfig   |  2 +-
>  33 files changed, 791 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
> new file mode 100644
> index 0..b2f0817ef
> --- /dev/null
> +++ b/arch/riscv/Kconfig
> @@ -0,0 +1,73 @@
> +config RISCV
> + bool
> + select GENERIC_FIND_NEXT_BIT
> + select HAVE_CONFIGURABLE_MEMORY_LAYOUT
> + select HAVE_CONFIGURABLE_TEXT_BASE
> + select GPIOLIB
> + select OFTREE
> + select COMMON_CLK
> + select COMMON_CLK_OF_PROVIDER
> + select CLKDEV_LOOKUP
> + default y
> +
> +config ARCH_TEXT_BASE
> + hex
> + default 0x0
> +
> +config GENERIC_LINKER_SCRIPT
> + bool
> + default y
> +
> +menu "Machine selection"
> +
> +choice
> + prompt "CPU selection"
> + default CPU_RV_GENERIC
> +
> +config CPU_RV_GENERIC
> + bool "Generic RISC-V"
> + select CPU_SUPPORTS_32BIT_KERNEL
> + select CPU_SUPPORTS_64BIT_KERNEL
> +
> +endchoice
> +
> +config CPU_SUPPORTS_32BIT_KERNEL
> + bool
> +config CPU_SUPPORTS_64BIT_KERNEL
> + bool
> +
> +choice
> + prompt "barebox code model"
> + default 64BIT
> +
> +config 32BIT
> + bool "32-bit barebox"
> + depends on CPU_SUPPORTS_32BIT_KERNEL
> + help
> +   Select this option to build a 32-bit barebox.
> +
> +config 64BIT
> + bool "64-bit barebox"
> + depends on CPU_SUPPORTS_64BIT_KERNEL
> + help
> +   Select this option to build a 64-bit barebox.
> +
> +endchoice
> +
> +config BUILTIN_DTB
> + bool "link a DTB into the barebox image"
> + depends on OFTREE
> +
> +config BUILTIN_DTB_NAME
> + string "DTB to build into the barebox image"
> + depends on BUILTIN_DTB
> +
> +endmenu
> +
> +source common/Kconfig
> +source commands/Kconfig
> +source net/Kconfig
> +source drivers/Kconfig
> +source fs/Kconfig
> +source lib/Kconfig
> +source crypto/Kconfig
> diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile
> new file mode 100644
> index 0..4e3318cf1
> --- /dev/null
> +++ b/arch/riscv/Makefile
> @@ -0,0 +1,68 @@
> +CPPFLAGS += -fno-strict-aliasing
> +
> +cflags-y += -fno-pic -pipe
> +cflags-y += -Wall -Wmissing-prototypes -Wstrict-prototypes \
> + -Wno-uninitialized -Wno-format -Wno-main -mcmodel=medany
> +
> +LDFLAGS += $(ldflags-y)
> +LDFLAGS_barebox += -nostdlib
> +
> +TEXT_BASE = $(CONFIG_TEXT_BASE)
> +CPPFLAGS += -DTEXT_BASE=$(CONFIG_TEXT_BASE)
> +
> +ifndef CONFIG_MODULES
> +# Add cleanup flags
> +CPPFLAGS += -fdata-sections -ffunction-sections
> +LDFLAGS_barebox += -static --gc-sections
> +endif
> +
> +KBUILD_BINARY := barebox.bin
> +
> +machdirs := $(patsubst %,arch/riscv/mach-%/,$(machine-y))
> +
> +ifneq ($(board-y),)
> +BOARD := arch/riscv/boards/$(board-y)/
> +else
> +BOARD :=
> +endif
> +
> +ifeq ($(KBUILD_SRC),)
> +CPPFLAGS += -I$(BOARD)/include
> +else
> +CPPFLAGS += -I$(srctree)/$(BOARD)/include
> +endif
> +
> +ifeq ($(KBUILD_SRC),)
> +CPPFLAGS += $(patsubst %,-I%include,$(machdirs))
> +else
> 

Re: [RFC v4 10/10] Documentation: add RISC-V docs

2017-09-29 Thread Oleksij Rempel
Am 29.09.2017 um 01:12 schrieb Antony Pavlov:
> Signed-off-by: Antony Pavlov 
> ---
>  Documentation/boards/riscv.rst | 110 
> +
>  1 file changed, 110 insertions(+)
> 
> diff --git a/Documentation/boards/riscv.rst b/Documentation/boards/riscv.rst
> new file mode 100644
> index 0..912f16786
> --- /dev/null
> +++ b/Documentation/boards/riscv.rst
> @@ -0,0 +1,110 @@
> +RISC-V
> +==
> +
> +At the moment only qemu emulator is supported (see 
> https://github.com/riscv/riscv-isa-sim
> +for details).
> +
> +Running RISC-V barebox on qemu
> +--
> +
> +Obtain RISC-V GCC/Newlib Toolchain,
> +see https://github.com/riscv/riscv-tools/blob/master/README.md
> +for details. The ``build.sh`` script from ``riscv-tools`` should
> +create toolchain.
> +
> +Next compile qemu emulator::
> +
> +  $ git clone -b 20170824.erizo 
> https://github.com/miet-riscv-workgroup/riscv-qemu
> +  $ cd riscv-qemu
> +  $ cap="no" ./configure \
> +--extra-cflags="-Wno-maybe-uninitialized" \
> +--audio-drv-list="" \
> +--disable-attr \
> +--disable-blobs \
> +--disable-bluez \
> +--disable-brlapi \
> +--disable-curl \
> +--disable-curses \
> +--disable-docs \
> +--disable-kvm \
> +--disable-spice \
> +--disable-sdl \
> +--disable-vde \
> +--disable-vnc-sasl \
> +--disable-werror \
> +--enable-trace-backend=simple \
> +--disable-stack-protector \
> +--target-list=riscv32-softmmu,riscv64-softmmu
> +  $ make
> +
> +
> +Next compile barebox::
> +
> +  $ make erizo_generic_defconfig ARCH=riscv
> +  ...
> +  $ make ARCH=riscv CROSS_COMPILE= toolchain>/riscv32-unknown-elf-
> +
> +Run barebox::
> +
> +  $ /riscv32-softmmu/qemu-system-riscv32 \
> +  -nographic -M erizo -bios /barebox.bin \
> +  -serial stdio -monitor none -trace file=/dev/null
> +
> +  nmon> q
> +  
> +  copy loop done
> +  restarting...
> +  
> +  nmon> q
> +  Switch to console [cs0]
> +  
> +  
> +  barebox 2017.08.0-00102-g212af75153 #1 Mon Sep 4 20:54:31 MSK 2017
> +  
> +  
> +  Board: generic Erizo SoC board
> +  m25p80 m25p128@00: unrecognized JEDEC id bytes: 00,  0,  0
> +  m25p80 m25p128@00: probe failed: error 2
> +  malloc space: 0x8010 -> 0x801f (size 1 MiB)
> +  running /env/bin/init...
> +  /env/bin/init not found
> +  barebox:/
> +
> +
> +Running RISC-V barebox on DE0-Nano FPGA board
> +-
> +
> +See https://github.com/open-design/riscv-soc-cores/ for instructions
> +on DE0-Nano bitstream generation and loading.
> +
> +Connect to board's UART with your favorite serial communication software
> +(e.g. minicom) and check 'nmon> ' prompt (nmon runs from onchip ROM).
> +
> +Next close your communication software and use ./scripts/nmon-loader
> +to load barebox image into board's DRAM, e.g.
> +
> +  # ./scripts/nmon-loader barebox.erizo.nmon /dev/ttyUSB1 115200
> +
> +Wait several munutes for 'nmon> ' prompt.
> +
> +Next, start barebox from DRAM:
> +
> +  nmon> g 8000
> +
> +You should see one more 'nmon> ' prompt (this nmon runs from DRAM).
> +Exit nmon with 'q' command:
> +
> +  nmon> q
> +  Switch to console [cs0]
> +  
> +  
> +  barebox 2017.08.0-00102-g212af75153 #1 Mon Sep 4 20:54:31 MSK 2017
> +  
> +  
> +  Board: generic Erizo SoC board
> +  m25p80 m25p128@00: unrecognized JEDEC id bytes: 00,  0,  0
> +  m25p80 m25p128@00: probe failed: error 2

hmmm... not working example?

> +  malloc space: 0x8010 -> 0x801f (size 1 MiB)
> +  running /env/bin/init...
> +  /env/bin/init not found
> +  barebox:/ 

some parts are missing in defconfig. Barebox shell can display hostname
and so on ;)
-- 
Regards,
Oleksij



signature.asc
Description: OpenPGP digital signature
___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: [RFC v4 08/10] RISC-V: add erizo_generic_defconfig

2017-09-29 Thread Oleksij Rempel
Am 29.09.2017 um 01:12 schrieb Antony Pavlov:
> Signed-off-by: Antony Pavlov 
> ---
>  arch/riscv/configs/erizo_generic_defconfig | 55 
> ++
>  1 file changed, 55 insertions(+)
> 
> diff --git a/arch/riscv/configs/erizo_generic_defconfig 
> b/arch/riscv/configs/erizo_generic_defconfig
> new file mode 100644
> index 0..8ccad8934
> --- /dev/null
> +++ b/arch/riscv/configs/erizo_generic_defconfig
> @@ -0,0 +1,55 @@
> +CONFIG_32BIT=y
> +CONFIG_BUILTIN_DTB=y
> +CONFIG_BUILTIN_DTB_NAME="erizo_generic"
> +# CONFIG_GLOBALVAR is not set
> +CONFIG_TEXT_BASE=0x8000
> +CONFIG_MEMORY_LAYOUT_FIXED=y
> +CONFIG_STACK_BASE=0x800e
> +CONFIG_STACK_SIZE=0x2
> +CONFIG_MALLOC_BASE=0x8010
> +CONFIG_MALLOC_SIZE=0x10
> +CONFIG_MALLOC_TLSF=y
> +CONFIG_PANIC_HANG=y
> +CONFIG_HUSH_FANCY_PROMPT=y
> +CONFIG_CMDLINE_EDITING=y
> +CONFIG_AUTO_COMPLETE=y
> +# CONFIG_ERRNO_MESSAGES is not set
> +# CONFIG_TIMESTAMP is not set
> +# CONFIG_BOOTM is not set
> +# CONFIG_ENV_HANDLING is not set
> +CONFIG_POLLER=y
> +CONFIG_DEBUG_LL=y
> +CONFIG_LONGHELP=y
> +CONFIG_CMD_IOMEM=y
> +CONFIG_CMD_IMD=y
> +CONFIG_CMD_MEMINFO=y
> +CONFIG_CMD_GO=y
> +CONFIG_CMD_LOADY=y
> +CONFIG_CMD_CMP=y
> +CONFIG_CMD_MD5SUM=y
> +CONFIG_CMD_SHA1SUM=y
> +CONFIG_CMD_MSLEEP=y
> +CONFIG_CMD_SLEEP=y
> +CONFIG_CMD_MEMTEST=y
> +CONFIG_CMD_MM=y
> +CONFIG_CMD_FLASH=y
> +CONFIG_CMD_GPIO=y
> +CONFIG_CMD_I2C=y
> +CONFIG_CMD_SPI=y
> +CONFIG_CMD_OF_DUMP=y
> +CONFIG_CMD_TIME=y
> +CONFIG_CMD_DHRYSTONE=y
> +CONFIG_OFDEVICE=y
> +CONFIG_DRIVER_SERIAL_NS16550=y
> +CONFIG_DRIVER_SPI_GPIO=y
> +CONFIG_I2C=y
> +CONFIG_I2C_GPIO=y
> +CONFIG_MTD=y
> +# CONFIG_MTD_OOB_DEVICE is not set
> +CONFIG_MTD_M25P80=y
> +CONFIG_CLOCKSOURCE_DUMMY_RATE=6
> +CONFIG_EEPROM_AT25=y
> +CONFIG_EEPROM_AT24=y

hm... none of it seems to be in devicetree. Do you need this eeproms?

> +CONFIG_GPIO_GENERIC_PLATFORM=y
> +# CONFIG_PINCTRL is not set
> +CONFIG_DIGEST_CRC32_GENERIC=y
> 


-- 
Regards,
Oleksij



signature.asc
Description: OpenPGP digital signature
___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: [RFC v4 04/10] RISC-V: add nmon nano-monitor

2017-09-29 Thread Oleksij Rempel
Same as for MIPS

Am 29.09.2017 um 01:12 schrieb Antony Pavlov:
> nmon is a tiny (<1024 bytes) monitor program
> for the RV32I processors.
> 
> It can operate with NO working RAM at all!
> 
> It uses only the processor registers and NS16550-compatible
> UART port for operation, so it can be used for a memory
> controller setup code debugging.
> 
> Signed-off-by: Antony Pavlov 
> ---
>  arch/riscv/Kconfig  |  24 
>  arch/riscv/boot/start.S |  14 +++
>  arch/riscv/include/asm/riscv_nmon.h | 234 
> 
>  3 files changed, 272 insertions(+)
> 
> diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
> index f4bfbea7c..ce5f317cf 100644
> --- a/arch/riscv/Kconfig
> +++ b/arch/riscv/Kconfig
> @@ -75,6 +75,30 @@ source arch/riscv/mach-erizo/Kconfig
>  
>  endmenu
>  
> +menu "RISC-V specific settings"
> +
> +config HAS_NMON
> + bool
> +
> +config NMON
> + bool "nmon"
> + depends on HAS_NMON
> + depends on DEBUG_LL
> + help
> +   Say yes here to add the nmon to pbl.
> +   nmon -- nano-monitor program for the RISC-V processors.
> +   It can operate with NO working RAM, using only
> +   the processor registers.
> +
> +config NMON_HELP
> + bool "nmon help message"
> + depends on NMON
> + help
> +   Say yes here to get the nmon commands message on
> +   every nmon start.
> +
> +endmenu
> +
>  source common/Kconfig
>  source commands/Kconfig
>  source net/Kconfig
> diff --git a/arch/riscv/boot/start.S b/arch/riscv/boot/start.S
> index 2fd00f63d..c2ca6f9a1 100644
> --- a/arch/riscv/boot/start.S
> +++ b/arch/riscv/boot/start.S
> @@ -21,12 +21,21 @@
>  
>  #include 
>  
> +#include "mach/debug_ll.h"
> +
> +#include "asm/riscv_nmon.h"
> +
>   .text
>   .section ".text_entry"
>   .align 2
>  
>  .globl _start
>  _start:
> +
> + debug_ll_ns16550_init
> +
> + riscv_nmon
> +
>   li sp, STACK_BASE + STACK_SIZE
>  
>   # make room for HLS and initialize it
> @@ -66,9 +75,14 @@ copy_loop:
>   addia1, a1, LONGSIZE * 2
>   bgeua2, a0, copy_loop
>  
> + nmon_outs copy_loop_done_message
> +
>   /* Alas! At the moment I can't load main_entry __link__ address
>  into a0 with la. Use CONFIG_TEXT_BASE instead. This solution
>  leads to extra cycles for repeat sp initialization. */
>  
>   li  a0, CONFIG_TEXT_BASE
>   jalra0
> +
> +copy_loop_done_message:
> + .asciz "\r\ncopy loop done\r\nrestarting...\r\n"
> diff --git a/arch/riscv/include/asm/riscv_nmon.h 
> b/arch/riscv/include/asm/riscv_nmon.h
> new file mode 100644
> index 0..717f61334
> --- /dev/null
> +++ b/arch/riscv/include/asm/riscv_nmon.h

may be arch/riscv/include/asm/pbl_nmon.h instead?
to use same naming shema as for existing arch:
arch/mips/include/asm/pbl_nmon.h

every thing else seems to be nearly identical with MIPS, except some
instruction differences.

> @@ -0,0 +1,234 @@
> +/*
> + * nano-monitor for RISC-V CPU
> + *
> + * Copyright (C) 2016, 2017 Antony Pavlov 
> + *
> + * This file is part of barebox.
> + * See file CREDITS for list of people who contributed to this project.
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2
> + * as published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that 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.
> + *
> + */
> +
> +#ifndef __ASM_RISCV_NMON_H
> +#define __ASM_RISCV_NMON_H
> +
> +#define CODE_ESC 0x1b
> +
> +.macro nmon_outs msg
> +
> + la  a1, \msg
> +
> + jal _nmon_outs
> +
> +.endm
> +
> +/*
> + * output a 32-bit value in hex
> + */
> +.macro debug_ll_outhexw
> +#ifdef CONFIG_DEBUG_LL
> + movet6, a0
> + li  t5, 32
> +
> +202:
> + addit5, t5, -4
> + srl a0, t6, t5
> +
> + /* output one hex digit */
> + andia0, a0, 15
> + li  t4, 10
> + blt a0, t4, 203f
> +
> + addia0, a0, ('a' - '9' - 1)
> +
> +203:
> + addia0, a0, '0'
> +
> + debug_ll_outc_a0
> +
> + li  t4, 1
> + bge t5, t4, 202b
> +
> +#endif /* CONFIG_DEBUG_LL */
> +.endm
> +
> +.macro riscv_nmon
> +
> +nmon_main_help:
> +#ifdef CONFIG_NMON_HELP
> + nmon_outs   msg_nmon_help
> +#endif /* CONFIG_NMON_HELP */
> +
> +nmon_main:
> + nmon_outs   msg_prompt
> +
> + debug_ll_getc
> +
> + li  a0, 'q'
> + bne s0, a0, 3f
> +
> + jal _nmon_outc_a0
> +
> + j   nmon_exit
> +
> +3:
> + li  a0, 'd'
> + beq s0, a0, nmon_cmd_d
> +
> + li  a0, 'w'
> + beq s0, a0, nmon_cmd_w
> +
> + li  a0, 'g'
> + beq s0, a0, nmon_cmd_g
> +

Re: how to persistently save config values

2017-09-29 Thread Giorgio Dal Molin
Hi Sascha,

thank you for the answer.

I just experimented a bit with the environment and the nv vars
and I think I'll go this way.

I was a bit surprised by the saveenv command though: my understanding
of the (default) environment was that it was a read only blob
hardcoded in the barebox image; I thought if I want some new/dynamic
env content to be saved for the next reboot I have to explicitly provide
a storage disk/cf/mtd partition to the saveenv and then to the loadenv.
Instead, just saying 'saveenv' saves the contents of '/env' 'somewhere'
from where it can be restored on next reboot (very good!).

Together with the nv vars and the 'nv.dev.' prefix this just does the
trick for me.

Thank you.

giorgio

> On September 29, 2017 at 1:35 PM Sascha Hauer wrote:
> 
> On Fri, Sep 29, 2017 at 10:25:03AM +0200, Giorgio Dal Molin wrote:
> > Hi,
> > 
> > I'm working on a new project with an embedded system based on
> > a standard intel PC.
> > 
> > I already have a barebox.efi running on the system; my problem is now
> > how to permanently save some variables so that, on restart, they can be
> > automatically restored by my '/env/bin/init' script.
> > The variables I mean are for example 'eth0.ipaddr' or 'eth0.serveraddr'.
> > A solution I used in the past was a custom 'env_dump' command that generated
> > a config text file like:
> > 
> > eth0.ipaddr=10.0.0.15
> > eth0.serveraddr=10.0.0.1
> 
> (should be eth0.serverip)
> > ...
> > 
> > Then I saved the file with 'saveenv' and restored it back with 'loadenv'.
> 
> Normally you should edit /env/network/eth0 to change the network config.
> 
> Also there is the possibility to create a nv variable that automatically
> mirrors to the device variable. In this case it would be
> nv.dev.eth0.ipaddr and nv.dev.eth0.serverip. This doesn't work with dhcp
> though.
> 
> 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- |
> 
> ___
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox

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


Re: how to persistently save config values

2017-09-29 Thread Sascha Hauer
On Fri, Sep 29, 2017 at 10:25:03AM +0200, Giorgio Dal Molin wrote:
> Hi,
> 
> I'm working on a new project with an embedded system based on
> a standard intel PC.
> 
> I already have a barebox.efi running on the system; my problem is now
> how to permanently save some variables so that, on restart, they can be
> automatically restored by my '/env/bin/init' script.
> The variables I mean are for example 'eth0.ipaddr' or 'eth0.serveraddr'.
> A solution I used in the past was a custom 'env_dump' command that generated
> a config text file like:
> 
> eth0.ipaddr=10.0.0.15
> eth0.serveraddr=10.0.0.1

(should be eth0.serverip)

> ...
> 
> Then I saved the file with 'saveenv' and restored it back with 'loadenv'.

Normally you should edit /env/network/eth0 to change the network config.

Also there is the possibility to create a nv variable that automatically
mirrors to the device variable. In this case it would be
nv.dev.eth0.ipaddr and nv.dev.eth0.serverip. This doesn't work with dhcp
though.

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- |

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


Re: how to persistently save config values

2017-09-29 Thread B Gol
I just put all the variables in the source directory and then compile again.
Look inside the following dir and its sub dirs, you'll see all the default(hard 
coded)
variables inside it:

/source-path/barebox-.mm.d/defaultenv/


Simply make a text file inside a sub dir.The file name would be your variable 
name and
the string inside the file would be the value for that particular variable.


On Friday, September 29, 2017 12:20 PM, Giorgio Dal Molin 
 wrote:



Hi,


I'm working on a new project with an embedded system based on

a standard intel PC.


I already have a barebox.efi running on the system; my problem is now

how to permanently save some variables so that, on restart, they can be

automatically restored by my '/env/bin/init' script.

The variables I mean are for example 'eth0.ipaddr' or 'eth0.serveraddr'.

A solution I used in the past was a custom 'env_dump' command that generated

a config text file like:


eth0.ipaddr=10.0.0.15

eth0.serveraddr=10.0.0.1

...


Then I saved the file with 'saveenv' and restored it back with 'loadenv'.


Is there a better way to solve this problem ? I don't like very much having to

write 'custom commands' myself.


I had a look at the state framework but it seems kinda overkill for what I need.


giorgio


___

barebox mailing list

barebox@lists.infradead.org

http://lists.infradead.org/mailman/listinfo/barebox

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


Re: how to persistently save config values

2017-09-29 Thread Oleksij Rempel
Hi,
http://www.barebox.org/doc/latest/user/booting-linux.html#network-boot

Am 29.09.2017 um 10:25 schrieb Giorgio Dal Molin:
> Hi,
> 
> I'm working on a new project with an embedded system based on
> a standard intel PC.
> 
> I already have a barebox.efi running on the system; my problem is now
> how to permanently save some variables so that, on restart, they can be
> automatically restored by my '/env/bin/init' script.
> The variables I mean are for example 'eth0.ipaddr' or 'eth0.serveraddr'.
> A solution I used in the past was a custom 'env_dump' command that generated
> a config text file like:
> 
> eth0.ipaddr=10.0.0.15
> eth0.serveraddr=10.0.0.1
> ...
> 
> Then I saved the file with 'saveenv' and restored it back with 'loadenv'.
> 
> Is there a better way to solve this problem ? I don't like very much having to
> write 'custom commands' myself.
> 
> I had a look at the state framework but it seems kinda overkill for what I 
> need.
> 
> giorgio
> 
> ___
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 


-- 
Regards,
Oleksij



signature.asc
Description: OpenPGP digital signature
___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


how to persistently save config values

2017-09-29 Thread Giorgio Dal Molin
Hi,

I'm working on a new project with an embedded system based on
a standard intel PC.

I already have a barebox.efi running on the system; my problem is now
how to permanently save some variables so that, on restart, they can be
automatically restored by my '/env/bin/init' script.
The variables I mean are for example 'eth0.ipaddr' or 'eth0.serveraddr'.
A solution I used in the past was a custom 'env_dump' command that generated
a config text file like:

eth0.ipaddr=10.0.0.15
eth0.serveraddr=10.0.0.1
...

Then I saved the file with 'saveenv' and restored it back with 'loadenv'.

Is there a better way to solve this problem ? I don't like very much having to
write 'custom commands' myself.

I had a look at the state framework but it seems kinda overkill for what I need.

giorgio

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