[RFC] request_sdram_region: print error message

2019-06-13 Thread Antony Pavlov
I have found that MIPS memory misconfiguration leads to
request_sdram_region() errors. But mem_malloc_resource()
has no error checks for request_sdram_region() result.
MIPS memory mapping needs additional changes this commit
is just RFC on request_sdram_region().

Can we embed error message into request_sdram_region()?

The commid introduce necessary chages but I have no idea
how to change this part of arch/arm/cpu/mmu.c:

if (!request_sdram_region("ttb", (unsigned long)ttb, SZ_16K))
/*
 * This can mean that:
 * - the early MMU code has put the ttb into a place
 *   which we don't have inside our available memory
 * - Somebody else has occupied the ttb region which means
 *   the ttb will get corrupted.
 */
pr_crit("Critical Error: Can't request SDRAM region for ttb at %p\n",
ttb);

Signed-off-by: Antony Pavlov 
---
 arch/arm/cpu/cpu.c  | 3 +--
 arch/arm/lib32/bootm.c  | 7 +--
 arch/arm/lib32/bootz.c  | 1 -
 arch/mips/lib/cpu-probe.c   | 3 +--
 arch/ppc/mach-mpc5xxx/cpu.c | 5 +
 common/elf.c| 1 -
 common/memory.c | 5 +
 common/uimage.c | 5 -
 8 files changed, 9 insertions(+), 21 deletions(-)

diff --git a/arch/arm/cpu/cpu.c b/arch/arm/cpu/cpu.c
index c5daf6c60e..6bf9dfb11c 100644
--- a/arch/arm/cpu/cpu.c
+++ b/arch/arm/cpu/cpu.c
@@ -113,8 +113,7 @@ extern unsigned long arm_stack_top;
 
 static int arm_request_stack(void)
 {
-   if (!request_sdram_region("stack", arm_stack_top - STACK_SIZE, 
STACK_SIZE))
-   pr_err("Error: Cannot request SDRAM region for stack\n");
+   request_sdram_region("stack", arm_stack_top - STACK_SIZE, STACK_SIZE);
 
return 0;
 }
diff --git a/arch/arm/lib32/bootm.c b/arch/arm/lib32/bootm.c
index 4cf570e577..491729b2db 100644
--- a/arch/arm/lib32/bootm.c
+++ b/arch/arm/lib32/bootm.c
@@ -382,8 +382,6 @@ static int do_bootz_linux(struct image_data *data)
 
data->os_res = request_sdram_region("zimage", load_address, image_size);
if (!data->os_res) {
-   pr_err("bootm/zImage: failed to request memory at 0x%lx to 
0x%lx (%zu).\n",
-  load_address, load_address + image_size, image_size);
ret = -ENOMEM;
goto err_out;
}
@@ -506,14 +504,11 @@ static int do_bootm_aimage(struct image_data *data)
cmp = >kernel;
data->os_res = request_sdram_region("akernel", cmp->load_addr, 
cmp->size);
if (!data->os_res) {
-   pr_err("Cannot request region 0x%08x - 0x%08x, using default 
load address\n",
-   cmp->load_addr, cmp->size);
+   pr_err("using default load address\n");
 
data->os_address = mem_start + PAGE_ALIGN(cmp->size * 4);
data->os_res = request_sdram_region("akernel", 
data->os_address, cmp->size);
if (!data->os_res) {
-   pr_err("Cannot request region 0x%08x - 0x%08x\n",
-   cmp->load_addr, cmp->size);
ret = -ENOMEM;
goto err_out;
}
diff --git a/arch/arm/lib32/bootz.c b/arch/arm/lib32/bootz.c
index c0ffd93c2b..4c4882d201 100644
--- a/arch/arm/lib32/bootz.c
+++ b/arch/arm/lib32/bootz.c
@@ -87,7 +87,6 @@ static int do_bootz(int argc, char *argv[])
res = request_sdram_region("zimage",
bank->start + SZ_8M, end);
if (!res) {
-   printf("can't request region for kernel\n");
goto err_out1;
}
}
diff --git a/arch/mips/lib/cpu-probe.c b/arch/mips/lib/cpu-probe.c
index 2556a8b240..4cc96aba45 100644
--- a/arch/mips/lib/cpu-probe.c
+++ b/arch/mips/lib/cpu-probe.c
@@ -169,8 +169,7 @@ unsigned long mips_stack_top;
 
 static int mips_request_stack(void)
 {
-   if (!request_sdram_region("stack", mips_stack_top - STACK_SIZE, 
STACK_SIZE))
-   pr_err("Error: Cannot request SDRAM region for stack\n");
+   request_sdram_region("stack", mips_stack_top - STACK_SIZE, STACK_SIZE);
 
return 0;
 }
diff --git a/arch/ppc/mach-mpc5xxx/cpu.c b/arch/ppc/mach-mpc5xxx/cpu.c
index ab58967aa4..de8f65e4dd 100644
--- a/arch/ppc/mach-mpc5xxx/cpu.c
+++ b/arch/ppc/mach-mpc5xxx/cpu.c
@@ -68,11 +68,8 @@ static int mpc5xxx_reserve_region(void)
 
/* keep this in sync with the assembler routines setting up the stack */
r = request_sdram_region("stack", _text_base - STACK_SIZE, STACK_SIZE);
-   if (r == NULL) {
-   pr_err("Failed to request stack re

[PATCH] MIPS: fix 'assignment makes integer from pointer without a cast' warning

2019-06-13 Thread Antony Pavlov
Signed-off-by: Antony Pavlov 
---
 arch/mips/boot/main_entry.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/mips/boot/main_entry.c b/arch/mips/boot/main_entry.c
index 5b88730b07..4ae4457e7e 100644
--- a/arch/mips/boot/main_entry.c
+++ b/arch/mips/boot/main_entry.c
@@ -85,7 +85,7 @@ void __bare_init main_entry(void *fdt, u32 fdt_size)
 
trap_init();
 
-   malloc_end = _stext;
+   malloc_end = (unsigned long)_stext;
 
if (MALLOC_SIZE > 0)
malloc_start = malloc_end - MALLOC_SIZE;
-- 
2.20.1


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


[PATCH] filetype: fix typo

2019-06-05 Thread Antony Pavlov
Signed-off-by: Antony Pavlov 
---
 common/filetype.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/filetype.c b/common/filetype.c
index e2d707b156..9675009eb0 100644
--- a/common/filetype.c
+++ b/common/filetype.c
@@ -37,7 +37,7 @@ struct filetype_str {
 };
 
 static const struct filetype_str filetype_str[] = {
-   [filetype_unknown] = { "unknown", "unkown" },
+   [filetype_unknown] = { "unknown", "unknown" },
[filetype_arm_zimage] = { "ARM Linux zImage", "arm-zimage" },
[filetype_lzo_compressed] = { "LZO compressed", "lzo" },
[filetype_lz4_compressed] = { "LZ4 compressed", "lz4" },
-- 
2.20.1


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


[RFC 2/4] serial: add litex UART driver

2019-06-02 Thread Antony Pavlov
Signed-off-by: Antony Pavlov 
---
 drivers/serial/Makefile   |  1 +
 drivers/serial/serial_litex.c | 99 +++
 2 files changed, 100 insertions(+)

diff --git a/drivers/serial/Makefile b/drivers/serial/Makefile
index 4174cc1ffb..fa86aa8c05 100644
--- a/drivers/serial/Makefile
+++ b/drivers/serial/Makefile
@@ -23,3 +23,4 @@ obj-$(CONFIG_DRIVER_SERIAL_CADENCE)   += 
serial_cadence.o
 obj-$(CONFIG_DRIVER_SERIAL_EFI_STDIO)  += efi-stdio.o
 obj-$(CONFIG_DRIVER_SERIAL_DIGIC)  += serial_digic.o
 obj-$(CONFIG_DRIVER_SERIAL_LPUART) += serial_lpuart.o
+obj-$(CONFIG_MACH_LITEX)   += serial_litex.o
diff --git a/drivers/serial/serial_litex.c b/drivers/serial/serial_litex.c
new file mode 100644
index 00..4a23921ac7
--- /dev/null
+++ b/drivers/serial/serial_litex.c
@@ -0,0 +1,99 @@
+// SPDX-License-Identifier: GPL-2.
+/*
+ * Copyright (C) 2019 Antony Pavlov 
+ *
+ * This file is part of barebox.
+ * See file CREDITS for list of people who contributed to this project.
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+static inline uint32_t litex_serial_readb(struct console_device *cdev,
+   uint32_t offset)
+{
+   void __iomem *base = cdev->dev->priv;
+
+   return readb(base + offset);
+}
+
+static inline void litex_serial_writeb(struct console_device *cdev,
+   uint32_t value, uint32_t offset)
+{
+   void __iomem *base = cdev->dev->priv;
+
+   writeb(value, base + offset);
+}
+
+static void litex_serial_putc(struct console_device *cdev, char c)
+{
+   while (litex_serial_readb(cdev, UART_TXFULL))
+   ;
+
+   litex_serial_writeb(cdev, c, UART_RXTX);
+}
+
+static int litex_serial_getc(struct console_device *cdev)
+{
+   int c;
+
+   while (litex_serial_readb(cdev, UART_RXEMPTY))
+   ;
+
+   c = litex_serial_readb(cdev, UART_RXTX);
+
+   /* refresh UART_RXEMPTY by writing UART_EV_RX to UART_EV_PENDING */
+   litex_serial_writeb(cdev, UART_EV_RX, UART_EV_PENDING);
+
+   return c;
+}
+
+static int litex_serial_tstc(struct console_device *cdev)
+{
+   if (litex_serial_readb(cdev, UART_RXEMPTY)) {
+   return 0;
+   }
+
+   return 1;
+}
+
+static int litex_serial_probe(struct device_d *dev)
+{
+   struct resource *iores;
+   struct console_device *cdev;
+
+   cdev = xzalloc(sizeof(struct console_device));
+   iores = dev_request_mem_resource(dev, 0);
+   if (IS_ERR(iores))
+   return PTR_ERR(iores);
+   dev->priv = IOMEM(iores->start);
+   cdev->dev = dev;
+   cdev->tstc = _serial_tstc;
+   cdev->putc = _serial_putc;
+   cdev->getc = _serial_getc;
+   cdev->setbrg = NULL;
+
+   console_register(cdev);
+
+   return 0;
+}
+
+static __maybe_unused struct of_device_id litex_serial_dt_ids[] = {
+   {
+   .compatible = "litex,uart",
+   }, {
+   /* sentinel */
+   }
+};
+
+static struct driver_d litex_serial_driver = {
+   .name  = "litex-uart",
+   .probe = litex_serial_probe,
+   .of_compatible = DRV_OF_COMPAT(litex_serial_dt_ids),
+};
+console_platform_driver(litex_serial_driver);
-- 
2.20.1


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


[RFC 0/4] riscv: add initial LiteX SoC support

2019-06-02 Thread Antony Pavlov
This RFC patchseries adds initial LiteX RISC-V SoC support for barebox.

You can obtain this patchseries from github:

$ git clone -b 20190602.litex https://github.com/frantony/barebox

LiteX is a Migen-based System on Chip [1], supporting softcore VexRiscv CPU,
 a 32-bits Linux Capable RISC-V CPU [2].

All the components used to create the LiteX SoC are open-source and
the flexibility of Spinal HDL/Migen allow targeting easily very various
FPGA devices/boards: Lattice, Altera, Xilinx, Microsemi FPGAs
with SDRAM/DDR/DDR2/DDR3/DDR4 RAMs, RMII/MII/RGMII/1000BASE-X Ethernet PHYs.

The LiteX SoC with VexRiscv CPU can be deployed on e.g. Digilent ARTY board [3]
or Terasic DE0-Nano board [4].

You can boot barebox from serial port using flterm [5]:, e.g.:

flterm --port /dev/ttyUSB0 --kernel  --kernel-adr 
0x4000


TODO


  * add pbl support for riscv barebox;
  * add liteeth Ethernet core support [6] (tip: use ARTY board);
  * fix issues (see the WIP commit);
  * use barebox to start linux [2] and zephyr [7].


REFERENCES
==

 [1] https://github.com/enjoy-digital/litex
 [2] https://github.com/enjoy-digital/linux-on-litex-vexriscv
 [3] 
https://store.digilentinc.com/arty-a7-artix-7-fpga-development-board-for-makers-and-hobbyists/
 [4] http://www.terasic.com.tw/cgi-bin/page/archive.pl?Language=English=593
 [5] https://github.com/timvideos/flterm
 [6] https://github.com/enjoy-digital/liteeth
 [7] 
https://github.com/zephyrproject-rtos/zephyr/tree/master/boards/riscv32/litex_vexriscv


Antony Pavlov (4):
  riscv: add initial LiteX SoC support
  serial: add litex UART driver
  WIP: make it work on litex
  riscv: add litex_defconfig

 arch/riscv/Kconfig|   6 +
 arch/riscv/Makefile   |   1 +
 arch/riscv/boot/start.S   |   2 -
 arch/riscv/configs/litex_defconfig|  45 +++
 arch/riscv/dts/litex-generic.dts  |  17 +++
 arch/riscv/dts/litex.dtsi |  36 +
 arch/riscv/mach-litex/Kconfig |  11 ++
 arch/riscv/mach-litex/Makefile|   3 +
 arch/riscv/mach-litex/include/mach/debug_ll.h | 124 ++
 common/bootm.c|   2 +
 drivers/serial/Makefile   |   1 +
 drivers/serial/serial_litex.c |  99 ++
 12 files changed, 345 insertions(+), 2 deletions(-)
 create mode 100644 arch/riscv/configs/litex_defconfig
 create mode 100644 arch/riscv/dts/litex-generic.dts
 create mode 100644 arch/riscv/dts/litex.dtsi
 create mode 100644 arch/riscv/mach-litex/Kconfig
 create mode 100644 arch/riscv/mach-litex/Makefile
 create mode 100644 arch/riscv/mach-litex/include/mach/debug_ll.h
 create mode 100644 drivers/serial/serial_litex.c

-- 
2.20.1


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


[RFC 4/4] riscv: add litex_defconfig

2019-06-02 Thread Antony Pavlov
Signed-off-by: Antony Pavlov 
---
 arch/riscv/configs/litex_defconfig | 45 ++
 1 file changed, 45 insertions(+)

diff --git a/arch/riscv/configs/litex_defconfig 
b/arch/riscv/configs/litex_defconfig
new file mode 100644
index 00..cc8404e4b1
--- /dev/null
+++ b/arch/riscv/configs/litex_defconfig
@@ -0,0 +1,45 @@
+CONFIG_MACH_LITEX=y
+CONFIG_BUILTIN_DTB=y
+CONFIG_BUILTIN_DTB_NAME="litex-generic"
+CONFIG_NMON=y
+CONFIG_NMON_HELP=y
+CONFIG_TEXT_BASE=0x4000
+CONFIG_MEMORY_LAYOUT_FIXED=y
+CONFIG_STACK_BASE=0x400e
+CONFIG_STACK_SIZE=0x2
+CONFIG_MALLOC_BASE=0x4010
+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_DEFAULT_ENVIRONMENT_GENERIC_NEW=y
+CONFIG_POLLER=y
+CONFIG_DEBUG_LL=y
+CONFIG_LONGHELP=y
+CONFIG_CMD_IOMEM=y
+CONFIG_CMD_IMD=y
+CONFIG_CMD_MEMINFO=y
+# CONFIG_CMD_BOOTM is not set
+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_GPIO=y
+CONFIG_CMD_OF_DUMP=y
+CONFIG_CMD_TIME=y
+CONFIG_CMD_DHRYSTONE=y
+CONFIG_OFDEVICE=y
+# CONFIG_SPI is not set
+CONFIG_CLOCKSOURCE_DUMMY_RATE=6
+CONFIG_GPIO_GENERIC_PLATFORM=y
+# CONFIG_PINCTRL is not set
+CONFIG_DIGEST_CRC32_GENERIC=y
-- 
2.20.1


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


[RFC 3/4] WIP: make it work on litex

2019-06-02 Thread Antony Pavlov
  * litex platform does not use ns16550 at all
so debug_ll_ns16550_init should be eliminated;

  * there is no IH_ARCH_RISCV definition in include/image.h
at the moment, so the error stops compiling:
common/bootm.c: In function 'bootm_open_os_uimage':
common/bootm.c:491:34: error: 'IH_ARCH' undeclared (first use in this
function)
if (data->os->header.ih_arch != IH_ARCH) {
^~~

Signed-off-by: Antony Pavlov 
---
 arch/riscv/boot/start.S | 2 --
 common/bootm.c  | 2 ++
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/riscv/boot/start.S b/arch/riscv/boot/start.S
index d1dbe48b7b..fab23e926f 100644
--- a/arch/riscv/boot/start.S
+++ b/arch/riscv/boot/start.S
@@ -28,8 +28,6 @@
 
 .globl _start
 _start:
-   debug_ll_ns16550_init
-
riscv_nmon
 
li  sp, STACK_BASE + STACK_SIZE
diff --git a/common/bootm.c b/common/bootm.c
index 36f6c41bbd..37379ef03f 100644
--- a/common/bootm.c
+++ b/common/bootm.c
@@ -487,11 +487,13 @@ static int bootm_open_os_uimage(struct image_data *data)
 
uimage_print_contents(data->os);
 
+#if 0
if (data->os->header.ih_arch != IH_ARCH) {
printf("Unsupported Architecture 0x%x\n",
   data->os->header.ih_arch);
return -EINVAL;
}
+#endif
 
if (data->os_address == UIMAGE_SOME_ADDRESS)
data->os_address = data->os->header.ih_load;
-- 
2.20.1


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


[RFC 1/4] riscv: add initial LiteX SoC support

2019-06-02 Thread Antony Pavlov
LiteX is a Migen-based System on Chip, supporting softcore VexRiscv CPU,
 a 32-bits Linux Capable RISC-V CPU.

See https://github.com/enjoy-digital/litex for details.

Signed-off-by: Antony Pavlov 
---
 arch/riscv/Kconfig|   6 +
 arch/riscv/Makefile   |   1 +
 arch/riscv/dts/litex-generic.dts  |  17 +++
 arch/riscv/dts/litex.dtsi |  36 +
 arch/riscv/mach-litex/Kconfig |  11 ++
 arch/riscv/mach-litex/Makefile|   3 +
 arch/riscv/mach-litex/include/mach/debug_ll.h | 124 ++
 7 files changed, 198 insertions(+)

diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index 16c3eecce6..ca764d54d0 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -24,6 +24,11 @@ config MACH_ERIZO
select HAS_DEBUG_LL
select HAS_NMON
 
+config MACH_LITEX
+   bool "litex family"
+   select HAS_DEBUG_LL
+   select HAS_NMON
+
 endchoice
 
 choice
@@ -63,6 +68,7 @@ config BUILTIN_DTB_NAME
depends on BUILTIN_DTB
 
 source "arch/riscv/mach-erizo/Kconfig"
+source "arch/riscv/mach-litex/Kconfig"
 
 endmenu
 
diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile
index 643c0bc8eb..955a10cecb 100644
--- a/arch/riscv/Makefile
+++ b/arch/riscv/Makefile
@@ -12,6 +12,7 @@ LDFLAGS += $(ldflags-y)
 LDFLAGS_barebox += -nostdlib
 
 machine-$(CONFIG_MACH_ERIZO)   := erizo
+machine-$(CONFIG_MACH_LITEX)   := litex
 
 TEXT_BASE = $(CONFIG_TEXT_BASE)
 CPPFLAGS += -DTEXT_BASE=$(CONFIG_TEXT_BASE)
diff --git a/arch/riscv/dts/litex-generic.dts b/arch/riscv/dts/litex-generic.dts
new file mode 100644
index 00..7dc0fa6c79
--- /dev/null
+++ b/arch/riscv/dts/litex-generic.dts
@@ -0,0 +1,17 @@
+// SPDX-License-Identifier: GPL-2.0-only
+
+#include "litex.dtsi"
+
+/ {
+   model = "LiteX VexRiscV";
+   compatible = "litex,vexriscv";
+
+   memory@4000 {
+   device_type = "memory";
+   reg = <0x4000 0x0080>;
+   };
+};
+
+ {
+   status = "okay";
+};
diff --git a/arch/riscv/dts/litex.dtsi b/arch/riscv/dts/litex.dtsi
new file mode 100644
index 00..dfd3d83404
--- /dev/null
+++ b/arch/riscv/dts/litex.dtsi
@@ -0,0 +1,36 @@
+// SPDX-License-Identifier: GPL-2.0-only
+
+/dts-v1/;
+
+/ {
+   compatible = "litex,vexriscv", "litex-dev";
+
+   #address-cells = <1>;
+   #size-cells = <1>;
+
+   clocks {
+   ref_clk: ref_clk {
+   #clock-cells = <0>;
+   compatible = "fixed-clock";
+   clock-frequency = <5000>;
+   };
+   };
+
+   cpus {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   cpu@0 {
+   device_type = "cpu";
+   compatible = "spinalhdl,vexriscv", "riscv";
+   clocks = <_clk>;
+   reg = <0>;
+   };
+   };
+
+   uart0: serial@e0001800 {
+   compatible = "litex,uart";
+   reg = <0xe0001800 0x18>;
+   status = "disabled";
+   };
+};
diff --git a/arch/riscv/mach-litex/Kconfig b/arch/riscv/mach-litex/Kconfig
new file mode 100644
index 00..ab6cd2fa01
--- /dev/null
+++ b/arch/riscv/mach-litex/Kconfig
@@ -0,0 +1,11 @@
+if MACH_LITEX
+
+choice
+   prompt "Board type"
+
+config BOARD_LITEX_GENERIC
+   bool "litex generic board"
+
+endchoice
+
+endif
diff --git a/arch/riscv/mach-litex/Makefile b/arch/riscv/mach-litex/Makefile
new file mode 100644
index 00..d9c51e74c3
--- /dev/null
+++ b/arch/riscv/mach-litex/Makefile
@@ -0,0 +1,3 @@
+# just to build a built-in.o. Otherwise compilation fails when no o-files is
+# created.
+obj- += dummy.o
diff --git a/arch/riscv/mach-litex/include/mach/debug_ll.h 
b/arch/riscv/mach-litex/include/mach/debug_ll.h
new file mode 100644
index 00..aaf9f0b855
--- /dev/null
+++ b/arch/riscv/mach-litex/include/mach/debug_ll.h
@@ -0,0 +1,124 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (C) 2019 Antony Pavlov 
+ *
+ * This file is part of barebox.
+ *
+ * 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 __MACH_LITEX_DEBUG_LL__
+#define __MACH_LITEX_DEBUG_LL__
+
+/** @file
+ *  This File contains declaration for early output support
+ */
+
+#include 
+
+#define DEBUG_LL_UART_ADDR 0xe0001800
+#define UART_RXTX  0x00
+#define UART_TXFULL0x04
+#define UART_RXEMPTY   0x08
+#define UART_EV_PENDING0x10
+#define  

[PATCH] Documentation: add riscv mention

2019-06-01 Thread Antony Pavlov
Signed-off-by: Antony Pavlov 
---
 Documentation/user/barebox.rst | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/user/barebox.rst b/Documentation/user/barebox.rst
index 026ed1b9c0..1927fe4efc 100644
--- a/Documentation/user/barebox.rst
+++ b/Documentation/user/barebox.rst
@@ -58,6 +58,7 @@ variable. Currently, ``ARCH`` must be one of:
 * nios2
 * openrisc
 * ppc
+* riscv
 * sandbox
 * x86
 
-- 
2.20.1


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


[PATCH] riscv: dts: erizo-generic: fix memory node name

2019-06-01 Thread Antony Pavlov
Signed-off-by: Antony Pavlov 
---
 arch/riscv/dts/erizo-generic.dts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/riscv/dts/erizo-generic.dts b/arch/riscv/dts/erizo-generic.dts
index d1f8d57168..29da01ef8e 100644
--- a/arch/riscv/dts/erizo-generic.dts
+++ b/arch/riscv/dts/erizo-generic.dts
@@ -7,7 +7,7 @@
model = "generic Erizo SoC board";
compatible = "miet-riscv-workgroup,erizo-generic-board";
 
-   memory@0 {
+   memory@8000 {
device_type = "memory";
reg = <0x8000 0x0080>;
};
-- 
2.20.1


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


[PATCH] commands/hwclock: align -n option help

2019-05-09 Thread Antony Pavlov
Help string for hwclock -n option isn't aligned:

  barebox@barebox sandbox:/ help hwclock

  hwclock - query or set the hardware clock (RTC)

  Options:
  -f NAME RTC device name (default rtc0)
  -e VARNAME  store RTC readout into variable 
VARNAME
  -n NTPSERVERset RTC from NTP server
  -s ccyymmddHHMM[.SS]set time

Signed-off-by: Antony Pavlov 
---
 commands/hwclock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/commands/hwclock.c b/commands/hwclock.c
index 5073618675..1b5c2cd100 100644
--- a/commands/hwclock.c
+++ b/commands/hwclock.c
@@ -175,7 +175,7 @@ BAREBOX_CMD_HELP_START(hwclock)
 BAREBOX_CMD_HELP_TEXT("Options:")
 BAREBOX_CMD_HELP_OPT ("-f NAME\t\t\t", "RTC device name (default rtc0)")
 BAREBOX_CMD_HELP_OPT ("-e VARNAME\t\t", "store RTC readout into variable 
VARNAME")
-BAREBOX_CMD_HELP_OPT ("-n NTPSERVER\t", "set RTC from NTP server")
+BAREBOX_CMD_HELP_OPT ("-n NTPSERVER\t\t", "set RTC from NTP server")
 BAREBOX_CMD_HELP_OPT ("-s ccyymmddHHMM[.SS]\t", "set time")
 BAREBOX_CMD_HELP_END
 
-- 
2.20.1


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


Re: [PATCH v2 2/2] scripts/checkpatch.pl: rebase on top of upstream v5.0-rc6

2019-03-03 Thread Antony Pavlov
On Tue, 26 Feb 2019 10:55:40 +0100
Ahmad Fatoum  wrote:

> Hello Antony,
> 
> On 20/2/19 08:14, Antony Pavlov wrote:
> > On Tue, 19 Feb 2019 15:16:47 +0100
> > Ahmad Fatoum  wrote:
> > 
> >> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> >> index 4e17347a8481..48b39fbf962a 100755
> >> --- a/scripts/checkpatch.pl
> >> +++ b/scripts/checkpatch.pl
> > ...
> > 
> >> @@ -1555,13 +2997,9 @@ sub process {
> >>  
> >>my @compats = $rawline =~ 
> >> /\"([a-zA-Z0-9\-\,\.\+_]+)\"/g;
> >>  
> >> -  # linux device tree files
> >> -  my $dt_path = $root . "/dts/Bindings/";
> >> +  my $dt_path = $root . 
> >> "/Documentation/devicetree/bindings/";
> > 
> > At the moment it looks like barebox uses both paths ("/dts/Bindings/" and 
> > "/Documentation/devicetree/bindings/")
> > to store dt-related documentation.
> 
> Missed this one. I can reinstate it in a v2. I think I should've caught all 
> barebox specifics now.
> 
> > 
> > The patch is very long and very hard to review.
> 
> Any suggestion on a better way to do it? It's a straight copy from upstream 
> with
> some barebox specific changes applied on top, so I assume ensuring the barebox
> changes are accounted for are all the review we need.

I propose to port checkpatch-related patches from linux one by one.
Of course you can join some patches into one please remember this
quote from 
https://www.kernel.org/doc/html/v4.17/process/submitting-patches.html#split-changes

   The point to remember is that each patch should make an easily understood
   change that can be verified by reviewers. Each patch should be justifiable
   on its own merits.

> 
> I could for v2 include a scripts/checkpatch.patch which patches the 
> corresponding
> upstream checkpatch.pl into the barebox checkpatch.pl. That way reviewing 
> would work
> like this:
> 
> - review checkpatch.patch
> - $ patch -R < checkpatch.patch
> - $ diff $LINUX/scripts/checkpatch.pl $BAREBOX/scripts/checkpatch.pl
> 
> What do you think?

I suppose that we want to get new checkpatch features/bugfixes from linux kernel
but not minimize barebox checkpatch vs linux kernel checkpatch diff size.

-- 
Best regards,
  Antony Pavlov

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


Re: [PATCH v2 2/2] scripts/checkpatch.pl: rebase on top of upstream v5.0-rc6

2019-02-19 Thread Antony Pavlov
On Tue, 19 Feb 2019 15:16:47 +0100
Ahmad Fatoum  wrote:

> This brings many upstream goodies, among them checking for
> SPDX-License-Identifier entries for newly added source files.
> 
> For future reference, following barebox changes were applied
> on top of the version copied from upstream:
> 
> 4a7f56056d ("scripts: Adapt checkpatch.pl for barebox.")
> 2671c30c25 ("scripts/checkpatch.pl: don't search for Doxyfile when checking 
> top_of_kernel_tree()")
> ad3c55fbf2 ("scripts/checkpatch.pl: don't search for CREDITS when checking 
> top_of_kernel_tree()")
> 13b0f4666d ("checkpatch: don't check TODO file presence")
> 
> These adjust sub top_of_kernel_tree's @tree_check to eventually contain
>   (
>   "arch", "commands", "common", "COPYING", "defaultenv",
>   "Documentation", "drivers", "fs", "include", "lib",
>   "MAKEALL", "Makefile", "net", "README", "scripts"
>   );
> 
> 9e809ef431 ("scripts: allow lines longer than 80 cols with printf() in 
> checkpatch")
> 
>   adds an exception for printf, same as printk.
> 
> The new checkpatch.pl now also depends on some more files:
> - cleanfile, cleanpatch, spdxcheck.py, spelling.txt: copied over
> - const_structs.checkpatch: added as empty file for now
> - get_maintainer.pl: implemented a dummy to keep changes here to a minimum.
> 
> Signed-off-by: Ahmad Fatoum 
> ---
>  scripts/checkpatch.pl| 4682 ++
>  scripts/cleanfile|  178 ++
>  scripts/cleanpatch   |  260 ++
>  scripts/const_structs.checkpatch |0
>  scripts/get_maintainer.pl|   11 +
>  scripts/spdxcheck.py |  286 ++
>  scripts/spelling.txt | 1344 +
>  7 files changed, 6169 insertions(+), 592 deletions(-)
>  create mode 100755 scripts/cleanfile
>  create mode 100755 scripts/cleanpatch
>  create mode 100644 scripts/const_structs.checkpatch
>  create mode 100755 scripts/get_maintainer.pl
>  create mode 100755 scripts/spdxcheck.py
>  create mode 100644 scripts/spelling.txt
> 

...

> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 4e17347a8481..48b39fbf962a 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
...

> @@ -1555,13 +2997,9 @@ sub process {
>  
>   my @compats = $rawline =~ 
> /\"([a-zA-Z0-9\-\,\.\+_]+)\"/g;
>  
> - # linux device tree files
> - my $dt_path = $root . "/dts/Bindings/";
> + my $dt_path = $root . 
> "/Documentation/devicetree/bindings/";

At the moment it looks like barebox uses both paths ("/dts/Bindings/" and 
"/Documentation/devicetree/bindings/")
to store dt-related documentation.

The patch is very long and very hard to review.

@Sascha

Can we introduce rules on storing dt-documentation?

It looks like we have some dt documentation duplication, e.g.

  ./Documentation/devicetree/bindings/rtc/dallas,ds1307.rst
  ./dts/Bindings/rtc/rtc-ds1307.txt

-- 
Best regards,
  Antony Pavlov

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


Re: [PATCH v1 1/4] MIPS: relocation: pass ram size to pbl_main_entry

2019-02-19 Thread Antony Pavlov
On Tue, 19 Feb 2019 09:34:43 +0100
Oleksij Rempel  wrote:

> Hi Antony,
> 
> your attention will be needed here..

Hi Oleksij!

Sorry but this week I'm on vacation.

Could you please push this patchseries to github?

-- 
Best regards,
  Antony Pavlov

> 
> On 18.02.19 08:51, Oleksij Rempel wrote:
> > From: Oleksij Rempel 
> > 
> > To make barebox dynamically relocatable it should know
> > the RAM size to be able to calculate proper new location.
> > 
> > Signed-off-by: Oleksij Rempel 
> > ---
> >   arch/mips/boards/8devices-lima/lowlevel.S | 3 ++-
> >   arch/mips/boards/black-swift/lowlevel.S   | 3 ++-
> >   arch/mips/boards/dlink-dir-320/lowlevel.S | 3 ++-
> >   arch/mips/boards/dptechnics-dpt-module/lowlevel.S | 3 ++-
> >   arch/mips/boards/img-ci20/lowlevel.S  | 3 ++-
> >   arch/mips/boards/loongson-ls1b/lowlevel.S | 3 ++-
> >   arch/mips/boards/qemu-malta/lowlevel.S| 3 ++-
> >   arch/mips/boards/ritmix-rzx50/lowlevel.S  | 3 ++-
> >   arch/mips/boards/tplink-mr3020/lowlevel.S | 3 ++-
> >   arch/mips/boards/tplink-wdr4300/lowlevel.S| 3 ++-
> >   arch/mips/boot/main_entry-pbl.c   | 5 +++--
> >   arch/mips/include/asm/asm.h   | 3 ++-
> >   12 files changed, 25 insertions(+), 13 deletions(-)
> > 
> > diff --git a/arch/mips/boards/8devices-lima/lowlevel.S 
> > b/arch/mips/boards/8devices-lima/lowlevel.S
> > index b53b23b42a..dd1ab6247d 100644
> > --- a/arch/mips/boards/8devices-lima/lowlevel.S
> > +++ b/arch/mips/boards/8devices-lima/lowlevel.S
> > @@ -11,6 +11,7 @@
> >   #include 
> >   #include 
> >   #include 
> > +#include 
> >   
> >   ENTRY_FUNCTION(BOARD_PBL_START)
> >   
> > @@ -38,4 +39,4 @@ skip_flash_test:
> > dcache_enable
> >   skip_pll_ram_config:
> >   
> > -ENTRY_FUNCTION_END(BOARD_PBL_START, qca4531_8devices_lima)
> > +ENTRY_FUNCTION_END(BOARD_PBL_START, qca4531_8devices_lima, SZ_64M)
> > diff --git a/arch/mips/boards/black-swift/lowlevel.S 
> > b/arch/mips/boards/black-swift/lowlevel.S
> > index 0ba77435f8..5c5afcdf09 100644
> > --- a/arch/mips/boards/black-swift/lowlevel.S
> > +++ b/arch/mips/boards/black-swift/lowlevel.S
> > @@ -11,9 +11,10 @@
> >   #include 
> >   #include 
> >   #include 
> > +#include 
> >   
> >   ENTRY_FUNCTION(BOARD_PBL_START)
> >   
> > ar9331_pbl_generic_start
> >   
> > -ENTRY_FUNCTION_END(BOARD_PBL_START, black_swift)
> > +ENTRY_FUNCTION_END(BOARD_PBL_START, black_swift, SZ_64M)
> > diff --git a/arch/mips/boards/dlink-dir-320/lowlevel.S 
> > b/arch/mips/boards/dlink-dir-320/lowlevel.S
> > index 9f3bd5dead..da969bc74e 100644
> > --- a/arch/mips/boards/dlink-dir-320/lowlevel.S
> > +++ b/arch/mips/boards/dlink-dir-320/lowlevel.S
> > @@ -9,6 +9,7 @@
> >   #include 
> >   #include 
> >   #include 
> > +#include 
> >   
> >   ENTRY_FUNCTION(BOARD_PBL_START)
> >   
> > @@ -19,4 +20,4 @@ ENTRY_FUNCTION(BOARD_PBL_START)
> > /* CPU/SoC specific setup ... */
> > /* ... absent */
> >   
> > -ENTRY_FUNCTION_END(BOARD_PBL_START, dlink_dir_320)
> > +ENTRY_FUNCTION_END(BOARD_PBL_START, dlink_dir_320, SZ_32M)
> > diff --git a/arch/mips/boards/dptechnics-dpt-module/lowlevel.S 
> > b/arch/mips/boards/dptechnics-dpt-module/lowlevel.S
> > index 28b8f4fac7..b5621963c3 100644
> > --- a/arch/mips/boards/dptechnics-dpt-module/lowlevel.S
> > +++ b/arch/mips/boards/dptechnics-dpt-module/lowlevel.S
> > @@ -12,9 +12,10 @@
> >   #include 
> >   #include 
> >   #include 
> > +#include 
> >   
> >   ENTRY_FUNCTION(BOARD_PBL_START)
> >   
> > ar9331_pbl_generic_start
> >   
> > -ENTRY_FUNCTION_END(BOARD_PBL_START, ar9331_dptechnics_dpt_module)
> > +ENTRY_FUNCTION_END(BOARD_PBL_START, ar9331_dptechnics_dpt_module, SZ_64M)
> > diff --git a/arch/mips/boards/img-ci20/lowlevel.S 
> > b/arch/mips/boards/img-ci20/lowlevel.S
> > index 056df17bf8..0295e44d1a 100644
> > --- a/arch/mips/boards/img-ci20/lowlevel.S
> > +++ b/arch/mips/boards/img-ci20/lowlevel.S
> > @@ -10,6 +10,7 @@
> >   #include 
> >   #include 
> >   #include 
> > +#include 
> >   
> >   ENTRY_FUNCTION(BOARD_PBL_START)
> >   
> > @@ -23,4 +24,4 @@ ENTRY_FUNCTION(BOARD_PBL_START)
> > debug_ll_outc '.'
> > debug_ll_ns16550_outnl
> >   
> > -ENTRY_FUNCTION_END(BOARD_PBL_START, img_ci20)
> > +ENTRY_FUNCTION_END(BOARD_PBL_

Re: Barebox support for Arm Cortex-M0 Boards

2019-02-12 Thread Antony Pavlov
On Tue, 12 Feb 2019 12:57:26 +
Kai Che  wrote:

Hi!

> does barebox support any kind of Arm-Cortex M0 Boards? e.g. STM32F0 or 
> similiar?

At the moment barebox does not support ARM-Cortex.
I suppose there is no problem to port barebox to STM32.
However STM32F0 definitely is not a preferred STM32 target chip for porting.
Barebox is intended to be a BOOTLOADER. Barebox is intended to load something 
into RAM.
STM32F098VC is an advanced STMF0 family chip in terms of RAM and ROM size.
STM32F098VC has 256 KB of flash ROM and 32 KB of SRAM.
I suppose that barebox can be linked to put code into flash ROM (e.g. see 
ROMKERNEL
option for blackfin linux kernel port) and 32 KB of RAM can be enough for data
but IMHO 32 KB is not enough for comfort and useful work.

AFAIR It is possible to run risc-v barebox (both code and data) inside 192 KB 
RAM memory
space in a VERY VERY MINIMAL configuration, just demo.

Barebox can be really useful on linux-capable STM32 chips and board, e.g.
STM32F429 DISCO board 
(https://www.st.com/en/evaluation-tools/32f429idiscovery.html)

> I couldn't find any mention of such a board in the board support section of 
> the documentation.
> 
> I hope I didn't overlook something.

-- 
Best regards,
  Antony Pavlov

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


[PATCH] nvmem: eeprom_93xx46: fix whitespaces

2019-02-11 Thread Antony Pavlov
Signed-off-by: Antony Pavlov 
---
 drivers/nvmem/eeprom_93xx46.c | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/nvmem/eeprom_93xx46.c b/drivers/nvmem/eeprom_93xx46.c
index d96ba32d07..49ed396dc2 100644
--- a/drivers/nvmem/eeprom_93xx46.c
+++ b/drivers/nvmem/eeprom_93xx46.c
@@ -339,7 +339,7 @@ static int eeprom_93xx46_probe_dt(struct spi_device *spi)
if (of_property_read_bool(np, "read-only"))
pd->flags |= EE_READONLY;
 
-   pd->select =of_get_named_gpio_flags(np, "select", 0, _flags);
+   pd->select = of_get_named_gpio_flags(np, "select", 0, _flags);
if (gpio_is_valid(pd->select)) {
char *name;
 
@@ -441,6 +441,3 @@ static struct driver_d eeprom_93xx46_driver = {
.of_compatible = DRV_OF_COMPAT(eeprom_93xx46_of_table),
 };
 device_spi_driver(eeprom_93xx46_driver);
-
-
-
-- 
2.20.1


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


powerpc-linux-gnu-gcc: error: unrecognized command line option ‘-mno-spe’

2019-01-23 Thread Antony Pavlov
Hi Sascha!

I'm playing with MAKEALL script to build as many defconfigs as possible.
My build environment is base on Debian Buster.
Debian Buster has cross compiler for PowerPC32.

Alas I have no success with debian powerpc-linux-gnu-gcc 8.2.0-2.

After

  CROSS_COMPILE=powerpc-linux-gnu- ./MAKEALL -a ppc

the error message is:

  powerpc-linux-gnu-gcc: error: unrecognized command line option ‘-mno-spe’; 
did you mean ‘-fno-see’?
  powerpc-linux-gnu-gcc: error: unrecognized command line option ‘-mspe=no’; 
did you mean ‘-misel=no’?
  make[2]: *** [/home/builduser/barebox/./Kbuild:40: 
arch/ppc/lib/asm-offsets.s] Error 1
  make[1]: *** [/home/builduser/barebox/Makefile:832: prepare0] Error 2
  make[1]: *** Waiting for unfinished jobs
  powerpc-linux-gnu-gcc: error: unrecognized command line option ‘-mno-spe’; 
did you mean ‘-fno-see’?
  powerpc-linux-gnu-gcc: error: unrecognized command line option ‘-mspe=no’; 
did you mean ‘-misel=no’?
  make[3]: *** [/home/builduser/barebox/scripts/Makefile.build:250: 
scripts/mod/empty.o] Error 1
  make[3]: *** Waiting for unfinished jobs


With this linux kernel-based patch ppc build has no fail.

diff --git a/arch/ppc/Makefile b/arch/ppc/Makefile
index 05ec2438a..e575e5923 100644
--- a/arch/ppc/Makefile
+++ b/arch/ppc/Makefile
@@ -1,7 +1,12 @@
 
 CPPFLAGS += -ffixed-r14 -m32   \
-meabi -D __PPC__ -D CONFIG_PPC \
-   -fno-strict-aliasing -mno-spe -mspe=no
+   -fno-strict-aliasing
+
+# No SPE instruction when building kernel
+# (We use all available options to help semi-broken compilers)
+CPPFLAGS += $(call cc-option,-mno-spe)
+CPPFLAGS += $(call cc-option,-mspe=no)
 
 ifdef CONFIG_RELOCATABLE
 CPPFLAGS += -fPIC -mrelocatable


I have no real powerpc experience to submit this patch.

Could you please comment this patch?

-- 
Best regards,
  Antony Pavlov

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


[PATCH v2] ARM: zynq: fix "'IO_SPACE_LIMIT' redefined" warning

2019-01-22 Thread Antony Pavlov
The patch fixes the following compiler's warning:

In file included from include/common.h:33:0,
 from arch/arm/mach-zynq/zynq.c:18:
arch/arm/include/asm/io.h:4:0: warning: "IO_SPACE_LIMIT" redefined
 #define IO_SPACE_LIMIT 0

In file included from
arch/arm/mach-zynq/zynq.c:17:0:
include/asm-generic/io.h:92:0: note: this is the location of the previous 
definition
 #define IO_SPACE_LIMIT 0x

Cc: Steffen Trumtrar 
Signed-off-by: Antony Pavlov 
---
 arch/arm/mach-zynq/zynq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-zynq/zynq.c b/arch/arm/mach-zynq/zynq.c
index a0a8d0d249..f6112fd249 100644
--- a/arch/arm/mach-zynq/zynq.c
+++ b/arch/arm/mach-zynq/zynq.c
@@ -14,7 +14,7 @@
  */
 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
-- 
2.20.1


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


[PATCH] MIPS: drop *_MULTI_BOARDS atavisms

2019-01-21 Thread Antony Pavlov
Signed-off-by: Antony Pavlov 
---
 arch/mips/configs/ath79_defconfig  | 1 -
 arch/mips/configs/qemu-malta_defconfig | 1 -
 arch/mips/mach-malta/Kconfig   | 8 
 3 files changed, 10 deletions(-)

diff --git a/arch/mips/configs/ath79_defconfig 
b/arch/mips/configs/ath79_defconfig
index 781786bc52..8d7d5a1722 100644
--- a/arch/mips/configs/ath79_defconfig
+++ b/arch/mips/configs/ath79_defconfig
@@ -1,5 +1,4 @@
 CONFIG_MACH_MIPS_ATH79=y
-CONFIG_MIPS_ATH79_MULTI_BOARDS=y
 CONFIG_BOARD_8DEVICES_LIMA=y
 CONFIG_BOARD_DPTECHNICS_DPT_MODULE=y
 CONFIG_BOARD_TPLINK_MR3020=y
diff --git a/arch/mips/configs/qemu-malta_defconfig 
b/arch/mips/configs/qemu-malta_defconfig
index 1314783e02..69c7b0b10a 100644
--- a/arch/mips/configs/qemu-malta_defconfig
+++ b/arch/mips/configs/qemu-malta_defconfig
@@ -1,4 +1,3 @@
-CONFIG_MIPS_MALTA_MULTI_BOARDS=y
 CONFIG_BOARD_QEMU_MALTA=y
 CONFIG_IMAGE_COMPRESSION_XZKERN=y
 CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x40
diff --git a/arch/mips/mach-malta/Kconfig b/arch/mips/mach-malta/Kconfig
index ceea937e30..70799808f9 100644
--- a/arch/mips/mach-malta/Kconfig
+++ b/arch/mips/mach-malta/Kconfig
@@ -4,18 +4,10 @@ config ARCH_TEXT_BASE
hex
default 0xa080
 
-config MIPS_MALTA_MULTI_BOARDS
-   bool "Allow multiple boards to be selected"
-   select HAVE_PBL_MULTI_IMAGE
-
-if MIPS_MALTA_MULTI_BOARDS
-
 config BOARD_QEMU_MALTA
bool "qemu malta"
select HAVE_PBL_IMAGE
select HAVE_IMAGE_COMPRESSION
select HAS_NMON
 
-endif # MIPS_MALTA_MULTI_BOARDS
-
 endif
-- 
2.20.1


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


Re: [HELP] Barebox porting

2019-01-16 Thread Antony Pavlov
On Wed, 16 Jan 2019 18:28:06 +0100
Sam Ravnborg  wrote:

Hi!

> On Wed, Jan 16, 2019 at 06:14:03PM +0300, Серафим Долбилов wrote:
> > 
> > A new portion of questions is ready:)
> > 1. dlmalloc or tlsf - what are pros and cons of each of them?
> 
> Looking at the history I could see that dlmalloc was present since barebox
> was forked from U-boot. So and old implmentation.
> 
> Later tlsf was added, wihtout any explanation why.
> But based on the fact that Jean (who added tlsf) did is when we already
> had dlmalloc I tentatively conclude that tlsf is the better alternative.
> And I can see line of code is less than dlmalloc too - so maybe it is even 
> smaller.
> I would go for tlsf based on the above and not botheting about this anymore.

Please see this Sascha's comment on tlsf:

  http://lists.infradead.org/pipermail/barebox/2011-December/005288.html

At the moment we use tlsf2 in barebox. Please note that there is more recent 
tlsf3 at github:

  https://github.com/mattconte/tlsf

-- 
Best regards,
  Antony Pavlov

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


[PATCH-for-next 0/2] move umode_t typedef from asm/types.h to

2019-01-14 Thread Antony Pavlov
This patchseries is marked "for-next" because it contains
arch/riscv changes.

Antony Pavlov (2):
  MIPS: asm/types.h: drop unused stuff
  move umode_t typedef from asm/types.h to linux/types.h

 arch/arm/include/asm/types.h  |  2 --
 arch/blackfin/include/asm/types.h |  2 --
 arch/mips/include/asm/types.h | 35 ---
 arch/nios2/include/asm/types.h|  2 --
 arch/openrisc/include/asm/types.h |  2 --
 arch/ppc/include/asm/types.h  |  2 --
 arch/riscv/include/asm/types.h|  2 --
 arch/sandbox/include/asm/types.h  |  2 --
 arch/x86/include/asm/types.h  |  2 --
 include/linux/types.h |  1 +
 10 files changed, 1 insertion(+), 51 deletions(-)

-- 
2.20.1


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


[PATCH-for-next 1/2] MIPS: asm/types.h: drop unused stuff

2019-01-14 Thread Antony Pavlov
Signed-off-by: Antony Pavlov 
---
 arch/mips/include/asm/types.h | 29 -
 1 file changed, 29 deletions(-)

diff --git a/arch/mips/include/asm/types.h b/arch/mips/include/asm/types.h
index cd76f53b50..78068e4113 100644
--- a/arch/mips/include/asm/types.h
+++ b/arch/mips/include/asm/types.h
@@ -10,39 +10,10 @@
 
 #include 
 
-/*
- * We don't use int-l64.h for the kernel anymore but still use it for
- * userspace to avoid code changes.
- */
-#if (_MIPS_SZLONG == 64) && !defined(__KERNEL__)
-# include 
-#else
-# include 
-#endif
-
 #ifndef __ASSEMBLY__
 
 typedef unsigned short umode_t;
 
 #endif /* __ASSEMBLY__ */
 
-/*
- * These aren't exported outside the kernel to avoid name space clashes
- */
-#ifdef __KERNEL__
-#ifndef __ASSEMBLY__
-
-/*
- * Don't use phys_t.  You've been warned.
- */
-#ifdef CONFIG_64BIT_PHYS_ADDR
-typedef unsigned long long phys_t;
-#else
-typedef unsigned long phys_t;
-#endif
-
-#endif /* __ASSEMBLY__ */
-
-#endif /* __KERNEL__ */
-
 #endif /* _ASM_TYPES_H */
-- 
2.20.1


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


[PATCH-for-next 2/2] move umode_t typedef from asm/types.h to linux/types.h

2019-01-14 Thread Antony Pavlov
Signed-off-by: Antony Pavlov 
---
 arch/arm/include/asm/types.h  | 2 --
 arch/blackfin/include/asm/types.h | 2 --
 arch/mips/include/asm/types.h | 6 --
 arch/nios2/include/asm/types.h| 2 --
 arch/openrisc/include/asm/types.h | 2 --
 arch/ppc/include/asm/types.h  | 2 --
 arch/riscv/include/asm/types.h| 2 --
 arch/sandbox/include/asm/types.h  | 2 --
 arch/x86/include/asm/types.h  | 2 --
 include/linux/types.h | 1 +
 10 files changed, 1 insertion(+), 22 deletions(-)

diff --git a/arch/arm/include/asm/types.h b/arch/arm/include/asm/types.h
index 1a7f47add0..9c21066882 100644
--- a/arch/arm/include/asm/types.h
+++ b/arch/arm/include/asm/types.h
@@ -3,8 +3,6 @@
 
 #ifndef __ASSEMBLY__
 
-typedef unsigned short umode_t;
-
 /*
  * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
  * header files exported to user space
diff --git a/arch/blackfin/include/asm/types.h 
b/arch/blackfin/include/asm/types.h
index e9d73377eb..086da34d7f 100644
--- a/arch/blackfin/include/asm/types.h
+++ b/arch/blackfin/include/asm/types.h
@@ -30,8 +30,6 @@
  */
 #ifndef __ASSEMBLY__
 
-typedef unsigned short umode_t;
-
 /*
  * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
  * header files exported to user space
diff --git a/arch/mips/include/asm/types.h b/arch/mips/include/asm/types.h
index 78068e4113..c635c1aac1 100644
--- a/arch/mips/include/asm/types.h
+++ b/arch/mips/include/asm/types.h
@@ -10,10 +10,4 @@
 
 #include 
 
-#ifndef __ASSEMBLY__
-
-typedef unsigned short umode_t;
-
-#endif /* __ASSEMBLY__ */
-
 #endif /* _ASM_TYPES_H */
diff --git a/arch/nios2/include/asm/types.h b/arch/nios2/include/asm/types.h
index 710ee55796..0067ea83c1 100644
--- a/arch/nios2/include/asm/types.h
+++ b/arch/nios2/include/asm/types.h
@@ -3,6 +3,4 @@
 
 #include 
 
-typedef unsigned short umode_t;
-
 #endif
diff --git a/arch/openrisc/include/asm/types.h 
b/arch/openrisc/include/asm/types.h
index 5b6391baf0..8ee6bb00f9 100644
--- a/arch/openrisc/include/asm/types.h
+++ b/arch/openrisc/include/asm/types.h
@@ -24,8 +24,6 @@
  * need to be careful to avoid a name clashes.
  */
 
-typedef unsigned short umode_t;
-
 /*
  * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
  * header files exported to user space
diff --git a/arch/ppc/include/asm/types.h b/arch/ppc/include/asm/types.h
index 6eb3877032..2d3ce0a283 100644
--- a/arch/ppc/include/asm/types.h
+++ b/arch/ppc/include/asm/types.h
@@ -3,8 +3,6 @@
 
 #ifndef __ASSEMBLY__
 
-typedef unsigned short umode_t;
-
 typedef __signed__ char __s8;
 typedef unsigned char __u8;
 
diff --git a/arch/riscv/include/asm/types.h b/arch/riscv/include/asm/types.h
index ba386ab4c5..8200a03349 100644
--- a/arch/riscv/include/asm/types.h
+++ b/arch/riscv/include/asm/types.h
@@ -15,8 +15,6 @@
 
 #endif
 
-typedef unsigned short umode_t;
-
 /*
  * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
  * header files exported to user space
diff --git a/arch/sandbox/include/asm/types.h b/arch/sandbox/include/asm/types.h
index 501883f5aa..8426de4cc2 100644
--- a/arch/sandbox/include/asm/types.h
+++ b/arch/sandbox/include/asm/types.h
@@ -16,8 +16,6 @@
 
 #endif
 
-typedef unsigned short umode_t;
-
 /*
  * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
  * header files exported to user space
diff --git a/arch/x86/include/asm/types.h b/arch/x86/include/asm/types.h
index 3caac398d8..e57ae2c8cf 100644
--- a/arch/x86/include/asm/types.h
+++ b/arch/x86/include/asm/types.h
@@ -18,8 +18,6 @@
 
 #endif
 
-typedef unsigned short umode_t;
-
 /*
  * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
  * header files exported to user space
diff --git a/include/linux/types.h b/include/linux/types.h
index ed3a5b6e81..c19d1dc053 100644
--- a/include/linux/types.h
+++ b/include/linux/types.h
@@ -15,6 +15,7 @@ typedef __kernel_fd_set   fd_set;
 typedef __kernel_dev_t dev_t;
 typedef __kernel_ino_t ino_t;
 typedef __kernel_mode_tmode_t;
+typedef unsigned short umode_t;
 typedef __kernel_off_t off_t;
 typedef __kernel_pid_t pid_t;
 typedef __kernel_daddr_t   daddr_t;
-- 
2.20.1


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


barebox: plathome-openblocks-a6/kwbimage.cfg is missed

2019-01-10 Thread Antony Pavlov
Hi!

It looks like the file arch/arm/boards/plathome-openblocks-a6/kwbimage.cfg is 
missed.

Here is my build log quotes:

  git clone git://git.pengutronix.de/git/barebox.git
  cd barebox
  git describe
  v2018.12.0-140-g64fc4ac1b

  touch arch/arm/boards/globalscale-mirabox/binary.0
  touch arch/arm/boards/lenovo-ix4-300d/binary.0
  touch arch/arm/boards/marvell-armada-xp-gp/binary.0
  touch arch/arm/boards/netgear-rn104/binary.0
  touch arch/arm/boards/plathome-openblocks-ax3/binary.0

  CROSS_COMPILE=arm-linux-gnueabi- ./MAKEALL -a arm mvebu_defconfig

  ...

  Could not open input file 
/home/builduser/barebox/arch/arm/boards/plathome-openblocks-a6/kwbimage.cfg

-- 
Best regards,
  Antony Pavlov

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


Re: [RFC] ARM: zynq: fix "'IO_SPACE_LIMIT' redefined" warning

2019-01-10 Thread Antony Pavlov
On Thu, 10 Jan 2019 09:38:25 +0100
Sascha Hauer  wrote:

> On Wed, Jan 09, 2019 at 11:27:54PM +0300, Antony Pavlov wrote:
> > The patch fixes the following compiler's warning:
> > 
> > In file included from include/common.h:33:0,
> >  from arch/arm/mach-zynq/zynq.c:18:
> > arch/arm/include/asm/io.h:4:0: warning: "IO_SPACE_LIMIT" redefined
> >  #define IO_SPACE_LIMIT 0
> > 
> > In file included from
> > arch/arm/mach-zynq/zynq.c:17:0:
> > include/asm-generic/io.h:92:0: note: this is the location of the previous 
> > definition
> >  #define IO_SPACE_LIMIT 0x
> > 
> > Cc: Steffen Trumtrar 
> > Signed-off-by: Antony Pavlov 
> > ---
> >  arch/arm/mach-zynq/zynq.c | 1 -
> >  1 file changed, 1 deletion(-)
> > 
> > diff --git a/arch/arm/mach-zynq/zynq.c b/arch/arm/mach-zynq/zynq.c
> > index a0a8d0d249..dd8f12c16a 100644
> > --- a/arch/arm/mach-zynq/zynq.c
> > +++ b/arch/arm/mach-zynq/zynq.c
> > @@ -14,7 +14,6 @@
> >   */
> >  
> >  #include 
> > -#include 
> 
> asm-generic/io.h shouldn't be included directly, but only from asm/io.h
> if it decides to do so. io.h includes asm/io.h, so this is the one that
> should be included instead.

common.h includes asm/io.h, please see full patch context:

--- a/arch/arm/mach-zynq/zynq.c
+++ b/arch/arm/mach-zynq/zynq.c
@@ -14,7 +14,6 @@
  */
 
 #include 
-#include 
 #include 
 #include 
 #include 


The question is, should we just drop this "#include " or
change "#include " into "#include ".

-- 
Best regards,
  Antony Pavlov

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


[RFC] ARM: zynq: fix "'IO_SPACE_LIMIT' redefined" warning

2019-01-09 Thread Antony Pavlov
The patch fixes the following compiler's warning:

In file included from include/common.h:33:0,
 from arch/arm/mach-zynq/zynq.c:18:
arch/arm/include/asm/io.h:4:0: warning: "IO_SPACE_LIMIT" redefined
 #define IO_SPACE_LIMIT 0

In file included from
arch/arm/mach-zynq/zynq.c:17:0:
include/asm-generic/io.h:92:0: note: this is the location of the previous 
definition
 #define IO_SPACE_LIMIT 0x

Cc: Steffen Trumtrar 
Signed-off-by: Antony Pavlov 
---
 arch/arm/mach-zynq/zynq.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/arm/mach-zynq/zynq.c b/arch/arm/mach-zynq/zynq.c
index a0a8d0d249..dd8f12c16a 100644
--- a/arch/arm/mach-zynq/zynq.c
+++ b/arch/arm/mach-zynq/zynq.c
@@ -14,7 +14,6 @@
  */
 
 #include 
-#include 
 #include 
 #include 
 #include 
-- 
2.20.1


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


[PATCH 0/3] drivers: fix "no previous prototype" warnings

2019-01-09 Thread Antony Pavlov
Antony Pavlov (3):
  w1: fix "no previous prototype for 'w1_found'" warning
  serial: amba-pl011: fix "no previous prototype for 'pl011_init_port'" warning
  net: ks8851_mll: fix "no previous prototype for 'ks_enable_qmu'" warning

 drivers/net/ks8851_mll.c| 2 +-
 drivers/serial/amba-pl011.c | 2 +-
 drivers/w1/w1.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

-- 
2.20.1


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


[PATCH 2/3] serial: amba-pl011: fix "no previous prototype for 'pl011_init_port'" warning

2019-01-09 Thread Antony Pavlov
The patch fixes the following compiler's warning:

drivers/serial/amba-pl011.c:151:5: warning: no previous prototype for 
‘pl011_init_port’ [-Wmissing-prototypes]
 int pl011_init_port (struct console_device *cdev)
 ^~~

Signed-off-by: Antony Pavlov 
---
 drivers/serial/amba-pl011.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/serial/amba-pl011.c b/drivers/serial/amba-pl011.c
index ce40f840f7..9b567e3cd2 100644
--- a/drivers/serial/amba-pl011.c
+++ b/drivers/serial/amba-pl011.c
@@ -148,7 +148,7 @@ static void pl011_rlcr(struct amba_uart_port *uart, u32 lcr)
}
 }
 
-int pl011_init_port (struct console_device *cdev)
+static int pl011_init_port(struct console_device *cdev)
 {
struct amba_uart_port *uart = to_amba_uart_port(cdev);
 
-- 
2.20.1


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


[PATCH 1/3] w1: fix "no previous prototype for 'w1_found'" warning

2019-01-09 Thread Antony Pavlov
The patch fixes the following compiler's warning:

drivers/w1/w1.c:459:6: warning: no previous prototype for ‘w1_found’ 
[-Wmissing-prototypes]
 void w1_found(struct w1_bus *bus, u64 rn)
  ^~~~

Signed-off-by: Antony Pavlov 
---
 drivers/w1/w1.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c
index 694ffa853e..f74046c0b7 100644
--- a/drivers/w1/w1.c
+++ b/drivers/w1/w1.c
@@ -456,7 +456,7 @@ int w1_driver_register(struct w1_driver *drv)
return register_driver(>drv);
 }
 
-void w1_found(struct w1_bus *bus, u64 rn)
+static void w1_found(struct w1_bus *bus, u64 rn)
 {
struct w1_device *dev;
u64 tmp = be64_to_cpu(rn);
-- 
2.20.1


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


[PATCH 3/3] net: ks8851_mll: fix "no previous prototype for 'ks_enable_qmu'" warning

2019-01-09 Thread Antony Pavlov
The patch fixes the following compiler's warning:

drivers/net/ks8851_mll.c:438:6: warning: no previous prototype for 
‘ks_enable_qmu’ [-Wmissing-prototypes]
 void ks_enable_qmu(struct ks_net *ks)
  ^

Signed-off-by: Antony Pavlov 
---
 drivers/net/ks8851_mll.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ks8851_mll.c b/drivers/net/ks8851_mll.c
index c0608112d5..b037e19633 100644
--- a/drivers/net/ks8851_mll.c
+++ b/drivers/net/ks8851_mll.c
@@ -435,7 +435,7 @@ static inline void ks_outblk(struct ks_net *ks, u16 *wptr, 
u32 len)
writew(*wptr++, ks->hw_addr);
 }
 
-void ks_enable_qmu(struct ks_net *ks)
+static void ks_enable_qmu(struct ks_net *ks)
 {
u16 w;
 
-- 
2.20.1


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


Re: barebox on Canon A1100

2019-01-04 Thread Antony Pavlov
On Fri, 4 Jan 2019 09:17:41 +0100
Sascha Hauer  wrote:

> On Fri, Jan 04, 2019 at 01:56:41AM +0300, Antony Pavlov wrote:
> > Hi Sascha!
> > 
> > I have some good news and some bad news.
> > 
> > First the good news.
> > 
> > Barebox was used for Day 18 of QEMU 2018 advent 
> > (https://www.qemu-advent-calendar.org/2018/).
> > 
> > Here is a quote:
> > 
> >   > This is an image for QEMU's emulated Canon A1100 Arm machine:
> >   > Play 2048 in the Barebox firmware environment.
> 
> Hey nice :)
> 
> > 
> > The bad news.
> > 
> > Current master branch barebox for Canon A1100 does not work under qemu,
> > barebox v2017.02.0 was used for qemu advent.
> > 
> > Thomas Huth reported the problem in the qemu-devel mailing
> > list two months ago. Please see 
> > https://www.mail-archive.com/qemu-devel@nongnu.org/msg571887.html
> > for details.
> > 
> > The commit a43e2bbc468a71 breaks barebox for Canon A1100:
> > 
> >   > commit a43e2bbc468a71fb8825e8acafb7fac7ad7c6dad
> >   > Author: Sascha Hauer 
> >   > Date:   Wed Mar 7 10:04:07 2018 +0100
> >   >
> >   >ARM: return positive offset in get_runtime_offset()
> > 
> > Any suggestion?
> 
> Yes, try again with a recent barebox. There was a bug in this commit that
> should be fixed with the following:
>
> | commit 0230365df6601cd561c9e3e368c96222076ec9f5
> | Author: Sascha Hauer 
> | Date:   Wed Dec 12 08:55:31 2018 +0100
> | 
> | ARM: fix setup_c when runtime offset is != 0
> | 
> | The runtime offset has to be added to the memcpy source address and
> | substracted from the return address. This should have been changed in
> | a43e2bbc46 which changed from returning the negative runtime offset
> | into changing the positive runtime offset. Instead a43e2bbc46 only
> | changed a zero substraction ("subs r4, r0, #0") into a zero addition
> | ("adds r4, r0, #0") which was used as a equal to zero test and changed
> | nothing. This part is reverted here.
> | 
> | Fixes wrong copy / return locations when setup_c is called with
> | different runtime and link addresses.
> | 
> | fixes: a43e2bbc46 ("ARM: return positive offset in 
> get_runtime_offset()")
> | 
> | Signed-off-by: Sascha Hauer 

Thanks for noting!

I have just tested recent master branch barebox with qemu-3.1.0 from Debian 
unstable.
It works!

Here is the log:

$ qemu-system-arm --version
QEMU emulator version 3.1.0 (Debian 1:3.1+dfsg-2)
Copyright (c) 2003-2018 Fabrice Bellard and the QEMU Project developers
$ qemu-system-arm -M canon-a1100 -display none -serial stdio -bios 
barebox.canon-a1100.bin
Switch to console [cs0]


barebox 2018.12.0-00140-g64fc4ac1b5 #1 Fri Jan 4 13:36:42 MSK 2019


Board: Canon PowerShot A1100 IS
digic-gpio c022.gpio.of: probed gpiochip-1 with base 0
cfi_flash f800.fl...@f800.of: found cfi flash at 0xf800, size 4 MiB
malloc space: 0x0010 -> 0x002f (size 2 MiB)
running /env/bin/init...
/env/bin/init not found
canon-a1100 > /


-- 
Best regards,
  Antony Pavlov

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


Re: [PATCH v3 00/10] Add initial RISC-V architecture support

2019-01-04 Thread Antony Pavlov
On Thu, 3 Jan 2019 12:18:09 +0100
Sascha Hauer  wrote:

> On Tue, Dec 18, 2018 at 10:19:33AM +0300, Antony Pavlov wrote:
> > This patchseries adds initial RISC-V architecture support for barebox.
> 
> It's very nice to get RISC-V support for barebox.
> 
> The code looks fine from a first glance. I would prefer using multi
> image support from the start of course, but I think I can live without
> it.
> I do not have the bandwidth to look at the code so closely to give any
> valuable input though. I am fine to apply it if you want to, or you
> could continue to develop it out of tree if that's more convenient for
> you. Your choice.

Hi Sascha!

Please apply RISC-V patchseries.

It's looks like people need a good bootloader for RISC-V ;)
E.g.:

  https://www.mail-archive.com/coreboot@coreboot.org/msg52977.html
  https://forums.sifive.com/t/coreboot-or-u-boot/1186

I'm planning to add linux-capable 64-bit SiFive Unleashed board support in the 
next RISC-V patchseries.
See https://www.sifive.com/boards/hifive-unleashed for details.
At least current qemu supports Unleashed-class boards.

-- 
Best regards,
  Antony Pavlov

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


barebox on Canon A1100

2019-01-03 Thread Antony Pavlov
Hi Sascha!

I have some good news and some bad news.

First the good news.

Barebox was used for Day 18 of QEMU 2018 advent 
(https://www.qemu-advent-calendar.org/2018/).

Here is a quote:

  > This is an image for QEMU's emulated Canon A1100 Arm machine:
  > Play 2048 in the Barebox firmware environment.

The bad news.

Current master branch barebox for Canon A1100 does not work under qemu,
barebox v2017.02.0 was used for qemu advent.

Thomas Huth reported the problem in the qemu-devel mailing
list two months ago. Please see 
https://www.mail-archive.com/qemu-devel@nongnu.org/msg571887.html
for details.

The commit a43e2bbc468a71 breaks barebox for Canon A1100:

  > commit a43e2bbc468a71fb8825e8acafb7fac7ad7c6dad
  > Author: Sascha Hauer 
  > Date:   Wed Mar 7 10:04:07 2018 +0100
  >
  >ARM: return positive offset in get_runtime_offset()

Any suggestion?

-- 
Best regards,
  Antony Pavlov

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


Re: [PATCH v1 1/3] MIPS: migrate all files to SPDX

2018-12-18 Thread Antony Pavlov
On Tue, 18 Dec 2018 09:29:20 +0100
Oleksij Rempel  wrote:

> Hi,
> 
> On 18.12.18 08:32, Antony Pavlov wrote:
> > On Sat, 15 Dec 2018 11:02:33 +0100
> > Oleksij Rempel  wrote:
> > 
> >> Signed-off-by: Oleksij Rempel 
> >> ---
> >>   arch/mips/boards/8devices-lima/lowlevel.S | 14 +-
> >>   arch/mips/boards/black-swift/lowlevel.S   | 14 +-
> >>   arch/mips/boards/dlink-dir-320/board.c| 14 +-
> >>   arch/mips/boards/dptechnics-dpt-module/lowlevel.S |  5 +
> >>   arch/mips/boards/img-ci20/lowlevel.S  | 14 +-
> >>   .../boards/loongson-ls1b/include/board/debug_ll.h | 14 +-
> >>   arch/mips/boards/loongson-ls1b/lowlevel.S | 14 +-
> >>   .../boards/netgear-wg102/include/board/debug_ll.h | 14 +-
> >>   arch/mips/boards/netgear-wg102/lowlevel.S | 14 +-
> >>   .../boards/qemu-malta/include/board/debug_ll.h| 14 +-
> >>   arch/mips/boards/qemu-malta/lowlevel.S| 14 +-
> >>   arch/mips/boards/ritmix-rzx50/lowlevel.S  | 14 +-
> >>   arch/mips/boards/tplink-mr3020/lowlevel.S | 14 +-
> >>   arch/mips/boards/tplink-wdr4300/lowlevel.S| 14 +-
> >>   arch/mips/boot/dtb.c  | 14 +-
> >>   arch/mips/boot/main_entry-pbl.c   | 15 +--
> >>   arch/mips/boot/main_entry.c   | 15 +--
> >>   arch/mips/boot/start.S| 14 +-
> >>   arch/mips/dts/img-ci20.dts| 12 +---
> >>   arch/mips/include/asm/barebox.h   | 14 +-
> >>   arch/mips/include/asm/bitops.h| 14 +-
> >>   arch/mips/include/asm/common.h| 14 +-
> >>   arch/mips/include/asm/debug_ll_ns16550.h  | 14 +-
> >>   arch/mips/include/asm/dma.h   |  4 +---
> >>   arch/mips/include/asm/gt64120.h   | 11 +--
> >>   arch/mips/include/asm/module.h| 14 +-
> >>   arch/mips/include/asm/pbl_macros.h| 14 +-
> >>   arch/mips/include/asm/pbl_nmon.h  | 14 +-
> >>   arch/mips/include/asm/string.h| 14 +-
> >>   arch/mips/lib/barebox.lds.S   | 14 +-
> >>   arch/mips/lib/cpu-probe.c |  6 +-
> >>   arch/mips/lib/cpuinfo.c   | 14 +-
> >>   arch/mips/lib/csrc-r4k.c  | 14 +-
> >>   arch/mips/lib/dma-default.c   | 11 +--
> >>   arch/mips/lib/pbl.lds.S   |  2 +-
> >>   arch/mips/mach-ar231x/ar231x.c|  6 +-
> >>   arch/mips/mach-ar231x/ar231x_reset.c  |  6 +-
> >>   arch/mips/mach-ar231x/board.c |  6 +-
> >>   arch/mips/mach-ar231x/include/mach/ar2312_regs.h  |  6 +-
> >>   .../mach-ar231x/include/mach/ar231x_platform.h|  6 +-
> >>   arch/mips/mach-ar231x/include/mach/debug_ll.h | 14 +-
> >>   arch/mips/mach-ath79/bbu.c| 10 +-
> >>   arch/mips/mach-ath79/include/mach/ar71xx_regs.h   |  5 +
> >>   arch/mips/mach-ath79/include/mach/ath79.h |  5 +
> >>   arch/mips/mach-ath79/include/mach/debug_ll.h  | 14 +-
> >>   .../mach-ath79/include/mach/debug_ll_ar9331.h | 14 +-
> >>   .../mach-ath79/include/mach/debug_ll_ar9344.h | 14 +-
> >>   arch/mips/mach-ath79/reset.c  | 14 +-
> >>   arch/mips/mach-bcm47xx/include/mach/debug_ll.h| 14 +-
> >>   arch/mips/mach-bcm47xx/include/mach/hardware.h| 14 +-
> >>   arch/mips/mach-bcm47xx/reset.c| 14 +-
> >>   arch/mips/mach-loongson/include/mach/debug_ll.h   | 14 +-
> >>   arch/mips/mach-loongson/include/mach/loongson1.h  |  6 +-
> >>   arch/mips/mach-loongson/loongson1_reset.c | 11 +--
> >>   arch/mips/mach-malta/include/mach/debug_ll.h  | 14 +-
> >>   arch/mips/mach-malta/include/mach/hardware.h  | 14 +-
> >>   arch/m

Re: [PATCH v1 1/3] MIPS: migrate all files to SPDX

2018-12-17 Thread Antony Pavlov
a/arch/mips/boards/8devices-lima/lowlevel.S 
> b/arch/mips/boards/8devices-lima/lowlevel.S
> index a619747f3..f33cfe4d9 100644
> --- a/arch/mips/boards/8devices-lima/lowlevel.S
> +++ b/arch/mips/boards/8devices-lima/lowlevel.S
> @@ -1,18 +1,6 @@
> +/* SPDX-License-Identifier: GPL-2.0-only */
>  /*
>   * Copyright (C) 2018 Oleksij Rempel 
> - *
> - * This file is part of barebox.

Why you don't like this line? 



> - * See file CREDITS for list of people who contributed to this project.

There is no CREDITS file in barebox. We can drop this line tree-wide.


> - * 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.
> - *
>   */
>  
>  #define BOARD_PBL_START start_8devices_lima

-- 
Best regards,
  Antony Pavlov

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


[PATCH v3 10/10] Documentation: add RISC-V docs

2018-12-17 Thread Antony Pavlov
Signed-off-by: Antony Pavlov 
---
 Documentation/boards/riscv.rst | 91 ++
 1 file changed, 91 insertions(+)

diff --git a/Documentation/boards/riscv.rst b/Documentation/boards/riscv.rst
new file mode 100644
index 00..c7fa52aadb
--- /dev/null
+++ b/Documentation/boards/riscv.rst
@@ -0,0 +1,91 @@
+RISC-V
+==
+
+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 20180409.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=/riscv32-unknown-elf-
+
+Run barebox::
+
+  $ /riscv32-softmmu/qemu-system-riscv32 \
+  -nographic -M erizo -bios /barebox.bin \
+  -serial stdio -monitor none -trace file=/dev/null
+  Switch to console [cs0]
+  
+  
+  barebox 2018.12.0-00148-g60e49c4e16 #1 Tue Dec 18 01:12:29 MSK 2018
+  
+  
+  Board: generic Erizo SoC board
+  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/ttyUSB0 115200
+
+Wait several munutes for 'nmon> ' prompt.
+
+Next, start barebox from DRAM:
+
+  nmon> g 8000
+  Switch to console [cs0]
+  
+  
+  barebox 2018.12.0-00148-g60e49c4e16 #1 Tue Dec 18 01:12:29 MSK 2018
+  
+  
+  Board: generic Erizo SoC board
+  malloc space: 0x8010 -> 0x801f (size 1 MiB)
+  running /env/bin/init...
+  /env/bin/init not found
+  barebox:/
-- 
2.20.0


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


[PATCH v3 08/10] RISC-V: add erizo_generic_defconfig

2018-12-17 Thread Antony Pavlov
Signed-off-by: Antony Pavlov 
---
 arch/riscv/configs/erizo_generic_defconfig | 51 ++
 1 file changed, 51 insertions(+)

diff --git a/arch/riscv/configs/erizo_generic_defconfig 
b/arch/riscv/configs/erizo_generic_defconfig
new file mode 100644
index 00..2ea1e46cc9
--- /dev/null
+++ b/arch/riscv/configs/erizo_generic_defconfig
@@ -0,0 +1,51 @@
+# 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_AT24=y
+CONFIG_GPIO_GENERIC_PLATFORM=y
+# CONFIG_PINCTRL is not set
+CONFIG_DIGEST_CRC32_GENERIC=y
-- 
2.20.0


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


[PATCH v3 04/10] RISC-V: add nmon nano-monitor

2018-12-17 Thread 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 |   8 +
 arch/riscv/include/asm/riscv_nmon.h | 234 
 3 files changed, 266 insertions(+)

diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index ee532ac11a..f1e69377e5 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -63,3 +63,27 @@ config BUILTIN_DTB_NAME
 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
diff --git a/arch/riscv/boot/start.S b/arch/riscv/boot/start.S
index d13708740b..d1dbe48b7b 100644
--- a/arch/riscv/boot/start.S
+++ b/arch/riscv/boot/start.S
@@ -18,12 +18,20 @@
 
 #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
 
/* copy barebox to link location */
diff --git a/arch/riscv/include/asm/riscv_nmon.h 
b/arch/riscv/include/asm/riscv_nmon.h
new file mode 100644
index 00..caf213cdd8
--- /dev/null
+++ b/arch/riscv/include/asm/riscv_nmon.h
@@ -0,0 +1,234 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * nano-monitor for RISC-V CPU
+ *
+ * Copyright (C) 2016, 2017 Antony Pavlov 
+ *
+ * This file is part of barebox.
+ *
+ * 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
+
+#ifdef CONFIG_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
+
+   j   nmon_main_help
+
+nmon_cmd_d:
+   jal _nmon_outc_a0
+
+   li  a0, ' '
+   jal _nmon_outc_a0
+
+   jal _nmon_gethexw
+
+   nmon_outs   msg_nl
+
+   lw  a0, (s0)
+   debug_ll_outhexw
+
+   j   nmon_main
+
+nmon_cmd_w:
+   jal _nmon_outc_a0
+
+   li  a0, ' '
+   jal _nmon_outc_a0
+
+   jal _nmon_gethexw
+   moves2, s0
+
+   li  a0, ' '
+   jal _nmon_outc_a0
+   jal _nmon_gethexw
+
+   sw  s0, 0(s2)
+   j   nmon_main
+
+nmon_cmd_g:
+   jal _nmon_outc_a0
+
+   li  a0, ' '
+   jal _nmon_outc_a0
+
+   jal _nmon_gethexw
+   moves2, s0
+
+   nmon_outs   msg_nl
+
+   jalrs2
+   j   nmon_main
+
+_nmon_outc_a0:
+   debug_ll_outc_a0
+   jr  ra
+
+_nmon_outs:
+
+   lb  a0, 0(a1)
+   addia1, a1, 1
+   beqza0, _nmon_jr_ra_exit
+
+   debug_ll_outc_a0
+
+   j   _nmon_outs
+
+_nmon_gethexw:
+
+   li  t3, 8
+   li  t2, 0
+
+_get_hex_digit:
+   debug_ll_getc
+
+   li  s1, CODE_ESC
+   beq s0, s1, nmon_main
+
+   li  s1, '0'
+   bge s0, s1, 0f
+   j   _get_hex

[PATCH v3 05/10] RISC-V: erizo: add DEBUG_LL support

2018-12-17 Thread Antony Pavlov
Signed-off-by: Antony Pavlov 
---
 arch/riscv/Kconfig|  1 +
 arch/riscv/mach-erizo/include/mach/debug_ll.h | 33 +++
 2 files changed, 34 insertions(+)

diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index f1e69377e5..617656ae5e 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -21,6 +21,7 @@ choice
 
 config MACH_ERIZO
bool "erizo family"
+   select HAS_DEBUG_LL
 
 endchoice
 
diff --git a/arch/riscv/mach-erizo/include/mach/debug_ll.h 
b/arch/riscv/mach-erizo/include/mach/debug_ll.h
new file mode 100644
index 00..a20acfcdfb
--- /dev/null
+++ b/arch/riscv/mach-erizo/include/mach/debug_ll.h
@@ -0,0 +1,33 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (C) 2017 Antony Pavlov 
+ *
+ * This file is part of barebox.
+ *
+ * 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 __MACH_ERIZO_DEBUG_LL__
+#define __MACH_ERIZO_DEBUG_LL__
+
+/** @file
+ *  This File contains declaration for early output support
+ */
+
+#include 
+
+#define DEBUG_LL_UART_ADDR 0x9000
+#define DEBUG_LL_UART_SHIFT2
+#define DEBUG_LL_UART_IOSIZE32
+
+#define DEBUG_LL_UART_CLK   (2400 / 16)
+#define DEBUG_LL_UART_BPS   CONFIG_BAUDRATE
+#define DEBUG_LL_UART_DIVISOR   (DEBUG_LL_UART_CLK / DEBUG_LL_UART_BPS)
+
+#include 
+
+#endif /* __MACH_ERIZO_DEBUG_LL__ */
-- 
2.20.0


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


[PATCH v3 00/10] Add initial RISC-V architecture support

2018-12-17 Thread Antony Pavlov
This patchseries adds initial RISC-V architecture support for barebox.

See Documentation/boards/riscv.rst for instructions.

You can obtain this patchseries from github:

$ git clone -b 20181218.riscv https://github.com/frantony/barebox

Changes since PATCH v2 (20180628)
(http://lists.infradead.org/pipermail/barebox/2018-June/033879.html)

* eliminate arch/riscv/boards/erizo-generic;
* use obj-dtb-y to include the dtb;
* simplify barebox.lds.S (see 
http://lists.infradead.org/pipermail/barebox/2018-June/033901.html);
* add SPDX-License-Identifier;
* rebase over latest master.

Changes since PATCH v1 (20170415)
(http://lists.infradead.org/pipermail/barebox/2018-April/032647.html)

* drop skeleton.dtsi;
* drop SPI GPIO bindings for erizo_generic;
* improve erizo-nmon-image;
* generic linker script is dropped;
* use generic GCC library routines from lib.

Changes since RFC v4 (20170927)
(http://lists.infradead.org/pipermail/barebox/2017-September/031226.html)

* drop 64-bit support;
* sync with RISC-V linux;
* RISC-V in barebox now is little endian only;
* fix according to notes by Oleksij Rempel.

Changes since RFC v3 (20161212)
(http://lists.infradead.org/pipermail/barebox/2016-December/028716.html)

* drop SiFive support, add support for custom Erizo SoC;
* barebox runs on real hardware (e.g. DE0-Nano FPGA board,
  see https://github.com/miet-riscv-workgroup/rv32-simple-soc for
details);
* introduce NMON for RISC-V;
* add relocator to start.S.

Changes since RFC v2 (20161113)
(http://lists.infradead.org/pipermail/barebox/2016-November/028533.html):

* add RV32 support.

Changes since RFC v1 (20161013)
(http://lists.infradead.org/pipermail/barebox/2016-October/028309.html):

* drop spike pk support;
* add qemu-sifive board support;
* add Documentation/boards/riscv.rst;
* fix guard macro names.

Antony Pavlov (10):
  Add initial RISC-V architecture support
  RISC-V: add Erizo SoC support
  RISC-V: add low-level debug macros for ns16550
  RISC-V: add nmon nano-monitor
  RISC-V: erizo: add DEBUG_LL support
  RISC-V: erizo: enable nmon
  RISC-V: erizo: add nmon image creation
  RISC-V: add erizo_generic_defconfig
  scripts: add nmon-loader
  Documentation: add RISC-V docs

 Documentation/boards/riscv.rst|  91 +++
 arch/riscv/Kconfig|  91 +++
 arch/riscv/Makefile   |  67 +
 arch/riscv/boot/Makefile  |   3 +
 arch/riscv/boot/dtb.c |  37 +++
 arch/riscv/boot/main_entry.c  |  35 +++
 arch/riscv/boot/start.S   |  68 +
 arch/riscv/configs/erizo_generic_defconfig|  51 
 arch/riscv/dts/.gitignore |   1 +
 arch/riscv/dts/Makefile   |  13 +
 arch/riscv/dts/erizo-generic.dts  |  14 ++
 arch/riscv/dts/erizo.dtsi |  46 
 arch/riscv/include/asm/barebox.h  |   1 +
 arch/riscv/include/asm/bitops.h   |  32 +++
 arch/riscv/include/asm/bitsperlong.h  |  10 +
 arch/riscv/include/asm/byteorder.h|   6 +
 arch/riscv/include/asm/common.h   |   6 +
 arch/riscv/include/asm/debug_ll_ns16550.h | 182 ++
 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/riscv_nmon.h   | 234 ++
 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   |   3 +
 arch/riscv/lib/asm-offsets.c  |  12 +
 arch/riscv/lib/barebox.lds.S  |  79 ++
 arch/riscv/lib/riscv_timer.c  |  63 +
 arch/riscv/mach-erizo/Kconfig |  11 +
 arch/riscv/mach-erizo/Makefile|   3 +
 arch/riscv/mach-erizo/include/mach/debug_ll.h |  33 +++
 drivers/of/Kconfig|   2 +-
 scripts/erizo-nmon-image  |  10 +
 scripts/nmon-loader   |  31 +++
 39 files changed, 1348 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/boards/riscv.rst
 create mode 100644 arch/riscv/Kconfig
 create mode 100644 arch/riscv/Makefile
 create mode 100644 arch/riscv/boot/Makefile
 create mode 100644 arch/riscv/boot/dtb.c
 create mode 100644 arch/riscv/boot/main_entry.c
 create mode 100644 arch/riscv/boot/start.S
 create mode 100644 arch/riscv/configs/erizo_generic_defconfig
 create mode 100644 arch/riscv/dts

[PATCH v3 09/10] scripts: add nmon-loader

2018-12-17 Thread Antony Pavlov
Signed-off-by: Antony Pavlov 
---
 scripts/nmon-loader | 31 +++
 1 file changed, 31 insertions(+)

diff --git a/scripts/nmon-loader b/scripts/nmon-loader
new file mode 100755
index 00..d80a53097a
--- /dev/null
+++ b/scripts/nmon-loader
@@ -0,0 +1,31 @@
+#!/usr/bin/expect -f
+
+# device
+set image [lindex $argv 0];
+set modem [lindex $argv 1];
+set speed [lindex $argv 2];
+
+if {$argc != 3} {
+puts "Usage:"
+puts "nmon-loader.expect   "
+exit 2
+}
+
+# keep it open
+exec sh -c "sleep 3 < $modem" &
+
+# serial port parameters
+exec stty -F $modem $speed raw -clocal -echo -istrip -hup
+
+# connect
+send_user "connecting to $modem, exit with ~.\n"
+spawn -open [open $modem w+]
+send_user "connected\n"
+send "\r"
+
+source $image
+
+interact {
+~- exit
+~~ {send "\034"}
+}
-- 
2.20.0


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


[PATCH v3 06/10] RISC-V: erizo: enable nmon

2018-12-17 Thread Antony Pavlov
Signed-off-by: Antony Pavlov 
---
 arch/riscv/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index 617656ae5e..c435cc8a31 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -22,6 +22,7 @@ choice
 config MACH_ERIZO
bool "erizo family"
select HAS_DEBUG_LL
+   select HAS_NMON
 
 endchoice
 
-- 
2.20.0


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


[PATCH v3 03/10] RISC-V: add low-level debug macros for ns16550

2018-12-17 Thread Antony Pavlov
This patch adds macros for ns16550 port initialization
and single char output. The macros can be used in
MIPS asm pbl code.

Signed-off-by: Antony Pavlov 
---
 arch/riscv/include/asm/debug_ll_ns16550.h | 182 ++
 1 file changed, 182 insertions(+)

diff --git a/arch/riscv/include/asm/debug_ll_ns16550.h 
b/arch/riscv/include/asm/debug_ll_ns16550.h
new file mode 100644
index 00..e891cbda25
--- /dev/null
+++ b/arch/riscv/include/asm/debug_ll_ns16550.h
@@ -0,0 +1,182 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (C) 2016, 2017 Antony Pavlov 
+ *
+ * This file is part of barebox.
+ *
+ * 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.
+ *
+ */
+
+/** @file
+ *  This file contains declaration for early output support
+ */
+#ifndef __INCLUDE_RISCV_ASM_DEBUG_LL_NS16550_H__
+#define __INCLUDE_RISCV_ASM_DEBUG_LL_NS16550_H__
+
+#include 
+
+#ifdef CONFIG_DEBUG_LL
+
+#ifndef DEBUG_LL_UART_ADDR
+#error DEBUG_LL_UART_ADDR is undefined!
+#endif
+
+#ifndef DEBUG_LL_UART_SHIFT
+#error DEBUG_LL_UART_SHIFT is undefined!
+#endif
+
+#ifndef DEBUG_LL_UART_DIVISOR
+#error DEBUG_LL_UART_DIVISOR is undefined!
+#endif
+
+#endif /* CONFIG_DEBUG_LL */
+
+#define UART_THR   (0x0 << DEBUG_LL_UART_SHIFT)
+#define UART_RBR   (0x0 << DEBUG_LL_UART_SHIFT)
+#define UART_DLL   (0x0 << DEBUG_LL_UART_SHIFT)
+#define UART_DLM   (0x1 << DEBUG_LL_UART_SHIFT)
+#define UART_LCR   (0x3 << DEBUG_LL_UART_SHIFT)
+#define UART_LSR   (0x5 << DEBUG_LL_UART_SHIFT)
+
+#define UART_LCR_W 0x07/* Set UART to 8,N,2 & DLAB = 0 */
+#define UART_LCR_DLAB  0x87/* Set UART to 8,N,2 & DLAB = 1 */
+
+#define UART_LSR_DR0x01/* UART received data present */
+#define UART_LSR_THRE  0x20/* Xmit holding register empty */
+
+#if defined(DEBUG_LL_UART_IOSIZE32)
+#define UART_REG_L lw
+#define UART_REG_S sw
+#elif defined(DEBUG_LL_UART_IOSIZE8)
+#define UART_REG_L lbu
+#define UART_REG_S sb
+#else
+#error "Please define DEBUG_LL_UART_IOSIZE{8,32}"
+#endif
+
+#ifndef __ASSEMBLY__
+/*
+ * C macros
+ */
+
+#include 
+
+static inline void PUTC_LL(char ch)
+{
+#ifdef CONFIG_DEBUG_LL
+   while (!(__raw_readl((u8 *)DEBUG_LL_UART_ADDR + UART_LSR) & 
UART_LSR_THRE))
+   ;
+   __raw_writel(ch, (u8 *)DEBUG_LL_UART_ADDR + UART_THR);
+#endif /* CONFIG_DEBUG_LL */
+}
+
+static inline void debug_ll_ns16550_init(void)
+{
+#ifdef CONFIG_DEBUG_LL
+   __raw_writel(UART_LCR_DLAB, (u8 *)DEBUG_LL_UART_ADDR + UART_LCR);
+   __raw_writel(DEBUG_LL_UART_DIVISOR & 0xff, (u8 *)DEBUG_LL_UART_ADDR + 
UART_DLL);
+   __raw_writel((DEBUG_LL_UART_DIVISOR >> 8) & 0xff, (u8 
*)DEBUG_LL_UART_ADDR + UART_DLM);
+   __raw_writel(UART_LCR_W, (u8 *)DEBUG_LL_UART_ADDR + UART_LCR);
+#endif /* CONFIG_DEBUG_LL */
+}
+#else /* __ASSEMBLY__ */
+/*
+ * Macros for use in assembly language code
+ */
+
+.macro debug_ll_ns16550_init
+#ifdef CONFIG_DEBUG_LL
+   li  t0, DEBUG_LL_UART_ADDR
+
+   li  t1, UART_LCR_DLAB   /* DLAB on */
+   UART_REG_S  t1, UART_LCR(t0)/* Write it out */
+
+   li  t1, DEBUG_LL_UART_DIVISOR
+   UART_REG_S  t1, UART_DLL(t0)/* write low order byte 
*/
+   srl t1, t1, 8
+   UART_REG_S  t1, UART_DLM(t0)/* write high order 
byte */
+
+   li  t1, UART_LCR_W  /* DLAB off */
+   UART_REG_S  t1, UART_LCR(t0)/* Write it out */
+#endif /* CONFIG_DEBUG_LL */
+.endm
+
+/*
+ * output a character in a0
+ */
+.macro debug_ll_outc_a0
+#ifdef CONFIG_DEBUG_LL
+
+   li  t0, DEBUG_LL_UART_ADDR
+
+201:
+   UART_REG_L  t1, UART_LSR(t0)/* get line status */
+   andit1, t1, UART_LSR_THRE   /* check for transmitter empty */
+   beqzt1, 201b/* try again */
+
+   UART_REG_S  a0, UART_THR(t0)/* write the character */
+
+#endif /* CONFIG_DEBUG_LL */
+.endm
+
+/*
+ * output a character
+ */
+.macro debug_ll_outc chr
+#ifdef CONFIG_DEBUG_LL
+   li  a0, \chr
+   debug_ll_outc_a0
+#endif /* CONFIG_DEBUG_LL */
+.endm
+
+/*
+ * output CR + NL
+ */
+.macro debug_ll_ns16550_outnl
+#ifdef CONFIG_DEBUG_LL
+   debug_ll_outc '\r'
+   debug_ll_outc '\n'
+#endif /* CONFIG_DEBUG_LL */
+.endm
+
+/*
+ * check character in input buffer
+ * return value:
+ *  v0 = 0   no character in input buffer
+ *  v0 != 0  character in input buffer
+ */
+.macro debug_ll_tstc
+#ifdef CONFIG_DEBUG_LL
+   li  t0, DEBUG_LL_UART_ADDR
+
+   /* get line status and check for data present */
+   UART_REG_L  s0, UART_LSR(t0)
+   andis0, s0, UART_LSR_DR
+
+#endif /* CONFIG_DEB

[PATCH v3 02/10] RISC-V: add Erizo SoC support

2018-12-17 Thread Antony Pavlov
Erizo is an opensource hardware SoC for FPGA.

Signed-off-by: Antony Pavlov 
---
 arch/riscv/Kconfig   | 11 
 arch/riscv/Makefile  |  2 ++
 arch/riscv/dts/Makefile  |  2 ++
 arch/riscv/dts/erizo-generic.dts | 14 ++
 arch/riscv/dts/erizo.dtsi| 46 
 arch/riscv/mach-erizo/Kconfig| 11 
 arch/riscv/mach-erizo/Makefile   |  3 +++
 7 files changed, 89 insertions(+)

diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index c9719dfeca..ee532ac11a 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -15,6 +15,15 @@ config ARCH_TEXT_BASE
 
 menu "Machine selection"
 
+choice
+   prompt "System type"
+   default MACH_ERIZO
+
+config MACH_ERIZO
+   bool "erizo family"
+
+endchoice
+
 choice
prompt "Base ISA"
default ARCH_RV32I
@@ -51,4 +60,6 @@ config BUILTIN_DTB_NAME
string "DTB to build into the barebox image"
depends on BUILTIN_DTB
 
+source arch/riscv/mach-erizo/Kconfig
+
 endmenu
diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile
index 28eb414452..d5a392de05 100644
--- a/arch/riscv/Makefile
+++ b/arch/riscv/Makefile
@@ -11,6 +11,8 @@ cflags-y += -Wall -Wstrict-prototypes \
 LDFLAGS += $(ldflags-y)
 LDFLAGS_barebox += -nostdlib
 
+machine-$(CONFIG_MACH_ERIZO)   := erizo
+
 TEXT_BASE = $(CONFIG_TEXT_BASE)
 CPPFLAGS += -DTEXT_BASE=$(CONFIG_TEXT_BASE)
 
diff --git a/arch/riscv/dts/Makefile b/arch/riscv/dts/Makefile
index 0a88af1603..903fe8ff34 100644
--- a/arch/riscv/dts/Makefile
+++ b/arch/riscv/dts/Makefile
@@ -3,6 +3,8 @@ ifneq ($(BUILTIN_DTB),)
 obj-dtb-$(CONFIG_BUILTIN_DTB) += $(BUILTIN_DTB).dtb.o
 endif
 
+obj-dtb-$(CONFIG_BOARD_ERIZO_GENERIC) += erizo-generic.dtb.o
+
 # just to build a built-in.o. Otherwise compilation fails when no devicetree is
 # created.
 obj- += dummy.o
diff --git a/arch/riscv/dts/erizo-generic.dts b/arch/riscv/dts/erizo-generic.dts
new file mode 100644
index 00..d1f8d57168
--- /dev/null
+++ b/arch/riscv/dts/erizo-generic.dts
@@ -0,0 +1,14 @@
+// SPDX-License-Identifier: GPL-2.0-only
+
+#include "erizo.dtsi"
+#include 
+
+/ {
+   model = "generic Erizo SoC board";
+   compatible = "miet-riscv-workgroup,erizo-generic-board";
+
+   memory@0 {
+   device_type = "memory";
+   reg = <0x8000 0x0080>;
+   };
+};
diff --git a/arch/riscv/dts/erizo.dtsi b/arch/riscv/dts/erizo.dtsi
new file mode 100644
index 00..07534798ac
--- /dev/null
+++ b/arch/riscv/dts/erizo.dtsi
@@ -0,0 +1,46 @@
+// SPDX-License-Identifier: GPL-2.0-only
+
+/dts-v1/;
+
+/ {
+   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>,
+   <0x9104 0x4>;
+   #gpio-cells = <2>;
+   gpio-controller;
+   };
+};
diff --git a/arch/riscv/mach-erizo/Kconfig b/arch/riscv/mach-erizo/Kconfig
new file mode 100644
index 00..2400b4437b
--- /dev/null
+++ b/arch/riscv/mach-erizo/Kconfig
@@ -0,0 +1,11 @@
+if MACH_ERIZO
+
+choice
+   prompt "Board type"
+
+config BOARD_ERIZO_GENERIC
+   bool "erizo generic board"
+
+endchoice
+
+endif
diff --git a/arch/riscv/mach-erizo/Makefile b/arch/riscv/mach-erizo/Makefile
new file mode 100644
index 00..d9c51e74c3
--- /dev/null
+++ b/arch/riscv/mach-erizo/Makefile
@@ -0,0 +1,3 @@
+# just to build a built-in.o. Otherwise compilation fails when no o-files is
+# created.
+obj- += dummy.o
-- 
2.20.0


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


[PATCH v3 01/10] Add initial RISC-V architecture support

2018-12-17 Thread Antony Pavlov
Signed-off-by: Antony Pavlov 
---
 arch/riscv/Kconfig   | 54 +++
 arch/riscv/Makefile  | 54 +++
 arch/riscv/boot/Makefile |  3 ++
 arch/riscv/boot/dtb.c| 37 +
 arch/riscv/boot/main_entry.c | 35 
 arch/riscv/boot/start.S  | 60 +
 arch/riscv/dts/.gitignore|  1 +
 arch/riscv/dts/Makefile  | 11 
 arch/riscv/include/asm/barebox.h |  1 +
 arch/riscv/include/asm/bitops.h  | 32 +++
 arch/riscv/include/asm/bitsperlong.h | 10 
 arch/riscv/include/asm/byteorder.h   |  6 +++
 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  |  3 ++
 arch/riscv/lib/asm-offsets.c | 12 +
 arch/riscv/lib/barebox.lds.S | 79 
 arch/riscv/lib/riscv_timer.c | 63 ++
 drivers/of/Kconfig   |  2 +-
 28 files changed, 582 insertions(+), 1 deletion(-)

diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
new file mode 100644
index 00..c9719dfeca
--- /dev/null
+++ b/arch/riscv/Kconfig
@@ -0,0 +1,54 @@
+config RISCV
+   def_bool y
+   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
+
+config ARCH_TEXT_BASE
+   hex
+   default 0x0
+
+menu "Machine selection"
+
+choice
+   prompt "Base ISA"
+   default ARCH_RV32I
+
+config ARCH_RV32I
+   bool "RV32I"
+   select CPU_SUPPORTS_32BIT_KERNEL
+   select GENERIC_LIB_ASHLDI3
+   select GENERIC_LIB_ASHRDI3
+   select GENERIC_LIB_LSHRDI3
+
+endchoice
+
+config CPU_SUPPORTS_32BIT_KERNEL
+   bool
+
+choice
+   prompt "barebox code model"
+   default 32BIT
+
+config 32BIT
+   bool "32-bit barebox"
+   depends on CPU_SUPPORTS_32BIT_KERNEL
+   help
+ Select this option to build a 32-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
diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile
new file mode 100644
index 00..28eb414452
--- /dev/null
+++ b/arch/riscv/Makefile
@@ -0,0 +1,54 @@
+CPPFLAGS += -fno-strict-aliasing
+
+ifeq ($(CONFIG_ARCH_RV32I),y)
+   cflags-y += -march=rv32im
+endif
+
+cflags-y += -fno-pic -pipe
+cflags-y += -Wall -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))
+
+ifeq ($(KBUILD_SRC),)
+CPPFLAGS += $(patsubst %,-I%include,$(machdirs))
+else
+CPPFLAGS += $(patsubst %,-I$(srctree)/%include,$(machdirs))
+endif
+
+archprepare: maketools
+
+PHONY += maketools
+
+ifneq ($(machine-y),)
+MACH  := arch/riscv/mach-$(machine-y)/
+else
+MACH  :=
+endif
+
+common-y += $(MACH)
+common-y += arch/riscv/boot/
+common-y += arch/riscv/lib/
+
+common-$(CONFIG_OFTREE) += arch/riscv/dts/
+
+CPPFLAGS += $(cflags-y)
+CFLAGS += $(cflags-y)
+
+lds-y  := arch/riscv/lib/barebox.lds
+
+CLEAN_FILES += arch/riscv/lib/barebox.lds
diff --git a/arch/riscv/boot/Makefile b/arch/riscv/boot/Makefile
new file mode 100644
index 00..fd62cab8c1
--- /dev/null
+++ b/arch/riscv/boot/Makefile
@@ -0,0 +1,3 @@
+obj-y += start.o
+obj-y += main_entry.o
+obj-$(CONFIG_OFDEVICE) += dtb.o
diff --git a/arch/riscv/boot/dtb.c b/arch/riscv/boot/dtb.c
new file mode 100644
index 00..5d73413a43
--- /dev/null
+++ b/arch/riscv/boot/dtb.c
@@ -0,0 +1,37 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (C) 2016, 2018 Antony Pavlov 
+ *
+ * This file is part of barebox.
+ *
+ * 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 t

[PATCH v3 07/10] RISC-V: erizo: add nmon image creation

2018-12-17 Thread Antony Pavlov
Signed-off-by: Antony Pavlov 
---
 arch/riscv/Makefile  | 11 +++
 scripts/erizo-nmon-image | 10 ++
 2 files changed, 21 insertions(+)

diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile
index d5a392de05..643c0bc8eb 100644
--- a/arch/riscv/Makefile
+++ b/arch/riscv/Makefile
@@ -54,3 +54,14 @@ CFLAGS += $(cflags-y)
 lds-y  := arch/riscv/lib/barebox.lds
 
 CLEAN_FILES += arch/riscv/lib/barebox.lds
+
+ifeq ($(CONFIG_MACH_ERIZO),y)
+KBUILD_IMAGE := barebox.erizo.nmon
+endif
+
+quiet_cmd_erizo_nmon_image = MKIMAGE $@
+  cmd_erizo_nmon_image = $(srctree)/scripts/erizo-nmon-image $< $@ || \
+   echo "WARNING: Couldn't create erizo nmon image due to previous errors."
+
+barebox.erizo.nmon: $(KBUILD_BINARY) FORCE
+   $(call if_changed,erizo_nmon_image)
diff --git a/scripts/erizo-nmon-image b/scripts/erizo-nmon-image
new file mode 100755
index 00..b56fd365c6
--- /dev/null
+++ b/scripts/erizo-nmon-image
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+if [ $# != 2 ]; then
+   echo "Usage:"
+   echo "  erizo-nmon-image  "
+
+   exit 1
+fi
+
+hexdump -v -e '/4 "%08x\n"' $1 | perl -e '$a = 0x8000; while (<>) { chop; 
printf("expect \"nmon> \"\n"); printf("send \"w%08x$_\"\n", $a); $a = $a + 4; 
}' > $2
-- 
2.20.0


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


Re: [PATCH] imd: model and compatible missing in metadata

2018-12-17 Thread Antony Pavlov
On Thu, 13 Dec 2018 07:33:56 +0100
"Thorsten K. Scherer"  wrote:

Hi!


> fixes 97e81f2
> 
> Signed-off-by: Thorsten K. Scherer 
> ---
>  include/asm-generic/barebox.lds.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/asm-generic/barebox.lds.h 
> b/include/asm-generic/barebox.lds.h
> index 74d3ca4a9..decaab79a 100644
> --- a/include/asm-generic/barebox.lds.h
> +++ b/include/asm-generic/barebox.lds.h
> @@ -66,7 +66,7 @@
>  #define BAREBOX_IMD  \
>   KEEP(*(.barebox_imd_start)) \
>   KEEP(*(.barebox_imd_1*))\
> - *(.barebox_imd_0*)  \
> + KEEP(*(.barebox_imd_0*))\
>   KEEP(*(.barebox_imd_end))
>  
>  #if defined(CONFIG_ARCH_BAREBOX_MAX_BARE_INIT_SIZE) && \
> -- 
> 2.19.1

It looks like this patch has unobvious drawback.
The bareboximd utility sees too many 'model' and 'compatible' strings in a 
single image, e.g.:

  $ git clone -b next git://git.pengutronix.de/git/barebox.git
  $ cd barebox
  barebox$ git log -1 --oneline
  5407887ff (HEAD -> next, origin/next) Merge branch 'for-next/mtd' into next
  barebox$ export ARCH=arm
  barebox$ export CROSS_COMPILE=arm-linux-gnueabi-
  barebox$ make tegra_v7_defconfig
  barebox$ echo "CONFIG_IMD=y" >> .config
  barebox$ echo "CONFIG_IMD_TARGET=y" >> .config
  barebox$ make oldconfig
  barebox$ make
  barebox$ ./scripts/bareboximd 
images/barebox-tegra20-toshiba-ac100-usbloader.img
  build: #1 Mon Dec 17 13:59:41 MSK 2018
  release: 2018.12.0-00273-g5407887ff
  of_compatible: nvidia,jetson-tk1 nvidia,tegra124
  model: NVIDIA Tegra124 Jetson TK1
  of_compatible: toradex,iris toradex,colibri_t20 nvidia,tegra20
  model: Toradex Colibri T20 on Iris
  of_compatible: compal,paz00 nvidia,tegra20
  model: Toshiba AC100 / Dynabook AZ
  of_compatible: nvidia,beaver nvidia,tegra30
  model: NVIDIA Tegra30 Beaver evaluation board

-- 
Best regards,
  Antony Pavlov

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


[PATCH] globalvar: fix crash if CONFIG_NVVAR is not set

2018-12-12 Thread Antony Pavlov
At the moment globalvar code tries to use nv_device
even if nv_device is not registered.

How to reproduce the problem:

barebox$ make sandbox_defconfig
...
barebox$ sed -i "s/\(CONFIG_NVVAR\)=y/# \1 is not set/" .config
barebox$ sed -i "s/\(CONFIG_DEFAULT_ENVIRONMENT_GENERIC_NEW\)=y/# \1 is not 
set\n# CONFIG_DEFAULT_ENVIRONMENT_GENERIC is not set/" .config
barebox$ make oldconfig
...
barebox$ make
...
barebox$ ./barebox
Segmentation fault

This patch blocks nv_device use if CONFIG_NVVAR is not set.

Signed-off-by: Antony Pavlov 
---
 common/globalvar.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/common/globalvar.c b/common/globalvar.c
index b9bfce7dac..1bea7425d4 100644
--- a/common/globalvar.c
+++ b/common/globalvar.c
@@ -99,6 +99,9 @@ void dev_param_init_from_nv(struct device_d *dev, const char 
*name)
const char *val;
int ret = 0;
 
+   if (!IS_ENABLED(CONFIG_NVVAR))
+   return;
+
if (dev == _device)
return;
if (dev == _device)
@@ -138,6 +141,9 @@ static int nvvar_device_dispatch(const char *name, struct 
device_d **dev,
const char *dot;
int dotpos;
 
+   if (!IS_ENABLED(CONFIG_NVVAR))
+   return -ENOSYS;
+
*dev = NULL;
 
if (strncmp(name, "dev.", 4))
@@ -447,6 +453,9 @@ static void globalvar_nv_sync(const char *name)
 {
const char *val;
 
+   if (!IS_ENABLED(CONFIG_NVVAR))
+   return;
+
val = dev_get_param(_device, name);
if (val)
dev_set_param(_device, name, val);
-- 
2.20.0.rc2


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


Re: [PATCH v3 08/10] MIPS: port all mach* to multiimage

2018-12-11 Thread Antony Pavlov
On Fri, 7 Dec 2018 08:09:50 +0100
Oleksij Rempel  wrote:

> Hi Anthony,
> 
> i would be happy if you can say:
> - this set is no go, because...
> or:
> - right now, I can't test it and if it caused some regression they will
> be fixed in separate patches...
> 

Hi Oleksij!

Sorry for delay.

I have tested mltiimage barebox on top on next branch,
the latest next branch  commit  is a141773b21bdc3e57486594b687cd307637bd
Merge: 787c9fb55f 34d598023e
Author: Sascha Hauer 
Date:   Fri Nov 30 22:23:12 2018 +0100

Merge branch 'for-next/ubimkvol_add_volume_id_parameter' into next

barebox succesfully works on DPTechnics module and on Black Swift board.

@Sascha!
Please merge Oleksij's mips multiimage branch.

> Am 05.12.18 um 09:50 schrieb Antony Pavlov:
> > On Tue, 27 Nov 2018 10:19:33 +0100
> > Oleksij Rempel  wrote:
> > 
> > 
> > ...
> > 
> >> diff --git 
> >> a/arch/mips/boards/8devices-lima/include/board/board_pbl_start.h 
> >> b/arch/mips/boards/8devices-lima/lowlevel.S
> >> similarity index 78%
> >> rename from arch/mips/boards/8devices-lima/include/board/board_pbl_start.h
> >> rename to arch/mips/boards/8devices-lima/lowlevel.S
> >> index e95aa49256..a619747f39 100644
> >> --- a/arch/mips/boards/8devices-lima/include/board/board_pbl_start.h
> >> +++ b/arch/mips/boards/8devices-lima/lowlevel.S
> >> @@ -15,51 +15,39 @@
> >>   *
> >>   */
> >>  
> >> -#include 
> >> +#define BOARD_PBL_START start_8devices_lima
> >> +
> >> +#include 
> >> +#include 
> >>  #include 
> >>  #include 
> >>  #include 
> >>  #include 
> >>  
> >> -  .macro  board_pbl_start
> >> -  .setpush
> >> -  .setnoreorder
> >> +ENTRY_FUNCTION(BOARD_PBL_START)
> >>  
> >>mips_barebox_10h
> >>  
> >> -  debug_ll_ar9344_init
> >> -
> >> -  debug_ll_outc '1'
> >> +  debug_ll_ath79_init
> >>  
> > 
> > I suppose there is a problem with simultaneous debug_ll support for AR9344 
> > and AR9331 in one binary.
> > the Kconfig DEBUG_AR9331_UART and DEBUG_AR9344_UART options are mutually 
> > exclusive.
> > 
> > Your approach makes it possible to build barebox binary image for AR9331 
> > board with debug_ll code for AR9344
> > and vice versa.
> > 
> >>hornet_mips24k_cp0_setup
> >> -  debug_ll_outc '2'
> >>  
> >>/* test if we are in the SRAM */
> >>pbl_blt 0xbd00 1f t8
> > 
> > "if $pc < 0xbd00 then jump to 1f"
> > 
> >> -  debug_ll_outc '3'
> >>b skip_flash_test
> >>nop
> >>  1:
> >>/* test if we are in the flash */
> >>pbl_blt 0xbf00 skip_pll_ram_config t8
> > 
> > "if $pc < 0xbf00 then jump to skip_pll_ram_config"
> > 
> > 
> > The code checks that $pc is less than 0xbd00 if true then the code 
> > checks
> > that $pc is less than 0xbf00. The second check is redundant!
> > 
> > 
> > 
> >> -  debug_ll_outc '4'
> >>  skip_flash_test:
> >>  
> >>pbl_qca4531_ddr2_550_550_init
> >>  
> >> -  debug_ll_outc '5'
> >>/* Initialize caches... */
> >>mips_cache_reset
> >>  
> >>/* ... and enable them */
> >>dcache_enable
> >>  skip_pll_ram_config:
> >> -  debug_ll_outc '6'
> >> -  debug_ll_outnl
> >> -
> >> -  mips_nmon
> >> -
> >> -  copy_to_link_location   pbl_start
> >>  
> >> -  .setpop
> >> -  .endm
> >> +ENTRY_FUNCTION_END(BOARD_PBL_START, qca4531_8devices_lima)
> > 
> 
> 


-- 
Best regards,
  Antony Pavlov

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


Re: [PATCH v2 0/4] checkpatch.pl: add ability to ignore various messages

2018-12-05 Thread Antony Pavlov
On Wed,  5 Dec 2018 16:21:54 +0300
Antony Pavlov  wrote:

Haste makes waste.

Sorry!

The correct subject for this message is "[PATCH v2 0/4] checkpatch.pl: port 
misc linux commits".

> Changes since PATCH v1:
> 
>   * fix linux kernel git repo hash sums in "checkpatch.pl: check
> for common memset parameter issues against statements" commit message.
> 
> Antony Pavlov (4):
>   checkpatch.pl: add ability to ignore various messages
>   checkpatch.pl: check for common memset parameter issues against
> statements
>   checkpatch.pl: use SPDX tag
>   checkpatch.pl: check for #if 0/#if 1
> 
>  scripts/checkpatch.pl | 508 ++
>  1 file changed, 367 insertions(+), 141 deletions(-)
> 
> -- 
> 2.20.0.rc2
> 


-- 
Best regards,
  Antony Pavlov

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


[PATCH v2 4/4] checkpatch.pl: check for #if 0/#if 1

2018-12-05 Thread Antony Pavlov
The #if 0 or #if 1 is used to toggle features. Warn if #if 0 or #if 1
is present and suggest that they can be removed.

Based on 60f890105547f7a4 ("checkpatch: check for #if 0/#if 1")
Linux kernel commit.

Signed-off-by: Antony Pavlov 
---
 scripts/checkpatch.pl | 11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index d1fe6659ce..4e17347a84 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2863,9 +2863,14 @@ sub process {
 
 # warn about #if 0
if ($line =~ /^.\s*\#\s*if\s+0\b/) {
-   CHK("REDUNDANT_CODE",
-   "if this code is redundant consider removing it\n" .
-   $herecurr);
+   WARN("IF_0",
+"Consider removing the code enclosed by this #if 0 
and its #endif\n" . $herecurr);
+   }
+
+# warn about #if 1
+   if ($line =~ /^.\s*\#\s*if\s+1\b/) {
+   WARN("IF_1",
+"Consider removing the #if 1 and its #endif\n" . 
$herecurr);
}
 
 # check for needless kfree() checks
-- 
2.20.0.rc2


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


[PATCH v2 3/4] checkpatch.pl: use SPDX tag

2018-12-05 Thread Antony Pavlov
Also add Joe's copyright.

Based on Linux kernel commit 882ea1d64eb3956
("scripts: use SPDX tag in get_maintainer and checkpatch").

Signed-off-by: Antony Pavlov 
---
 scripts/checkpatch.pl | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index d8a8e5004f..d1fe6659ce 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1,9 +1,11 @@
 #!/usr/bin/perl -w
+# SPDX-License-Identifier: GPL-2.0
+#
 # (c) 2001, Dave Jones. (the file handling bit)
 # (c) 2005, Joel Schopp  (the ugly bit)
 # (c) 2007,2008, Andy Whitcroft  (new conditions, test suite)
 # (c) 2008-2010 Andy Whitcroft 
-# Licensed under the terms of the GNU GPL License version 2
+# (c) 2010-2018 Joe Perches 
 
 use strict;
 
-- 
2.20.0.rc2


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


[PATCH v2 1/4] checkpatch.pl: add ability to ignore various messages

2018-12-05 Thread Antony Pavlov
Based on commit 000d1cc1829f938c ("checkpatch.pl: add
ability to ignore various messages") from Linux kernel.

This simplifies current linux kernel checkpatch.pl commit
adoption for barebox due to conversion of
1-argument ERROR($1), WARN($1) and CHK($1) subs into
2-argument ERROR($1, $2), WARN($1, $2) and CHK($1, $2) subs.

Signed-off-by: Antony Pavlov 
---
 scripts/checkpatch.pl | 475 ++
 1 file changed, 336 insertions(+), 139 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 9a6f6e2298..4b9b9d06f3 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -10,7 +10,7 @@ use strict;
 my $P = $0;
 $P =~ s@.*/@@g;
 
-my $V = '0.31';
+my $V = '0.32';
 
 use Getopt::Long qw(:config no_auto_abbrev);
 
@@ -26,9 +26,13 @@ my $check = 0;
 my $summary = 1;
 my $mailback = 0;
 my $summary_file = 0;
+my $show_types = 0;
 my $root;
 my %debug;
+my %ignore_type = ();
+my @ignore = ();
 my $help = 0;
+my $configuration_file = ".checkpatch.conf";
 
 sub help {
my ($exitcode) = @_;
@@ -46,6 +50,8 @@ Options:
   --terseone line per report
   -f, --file treat FILE as regular source file
   --subjective, --strict enable more subjective tests
+  --ignore TYPE(,TYPE2...)   ignore various comma separated message types
+  --show-types   show the message "types" in the output
   --root=PATHPATH to the kernel tree root
   --no-summary   suppress the per-file summary
   --mailback only produce a report in case of warnings/errors
@@ -63,6 +69,32 @@ EOM
exit($exitcode);
 }
 
+my $conf = which_conf($configuration_file);
+if (-f $conf) {
+   my @conf_args;
+   open(my $conffile, '<', "$conf")
+   or warn "$P: Can't find a readable $configuration_file file $!\n";
+
+   while (<$conffile>) {
+   my $line = $_;
+
+   $line =~ s/\s*\n?$//g;
+   $line =~ s/^\s*//g;
+   $line =~ s/\s+/ /g;
+
+   next if ($line =~ m/^\s*#/);
+   next if ($line =~ m/^\s*$/);
+
+   my @words = split(" ", $line);
+   foreach my $word (@words) {
+   last if ($word =~ m/^#/);
+   push (@conf_args, $word);
+   }
+   }
+   close($conffile);
+   unshift(@ARGV, @conf_args) if @conf_args;
+}
+
 GetOptions(
'q|quiet+'  => \$quiet,
'tree!' => \$tree,
@@ -73,6 +105,8 @@ GetOptions(
'f|file!'   => \$file,
'subjective!'   => \$check,
'strict!'   => \$check,
+   'ignore=s'  => \@ignore,
+   'show-types!'   => \$show_types,
'root=s'=> \$root,
'summary!'  => \$summary,
'mailback!' => \$mailback,
@@ -93,6 +127,19 @@ if ($#ARGV < 0) {
exit(1);
 }
 
+@ignore = split(/,/, join(',',@ignore));
+foreach my $word (@ignore) {
+   $word =~ s/\s*\n?$//g;
+   $word =~ s/^\s*//g;
+   $word =~ s/\s+/ /g;
+   $word =~ tr/[a-z]/[A-Z]/;
+
+   next if ($word =~ m/^\s*#/);
+   next if ($word =~ m/^\s*$/);
+
+   $ignore_type{$word}++;
+}
+
 my $dbg_values = 0;
 my $dbg_possible = 0;
 my $dbg_type = 0;
@@ -341,6 +388,18 @@ sub top_of_kernel_tree {
return 1;
 }
 
+sub which_conf {
+   my ($conf) = @_;
+
+   foreach my $path (split(/:/, ".:$ENV{HOME}:.scripts")) {
+   if (-e "$path/$conf") {
+   return "$path/$conf";
+   }
+   }
+
+   return "";
+}
+
 sub expand_tabs {
my ($str) = @_;
 
@@ -1086,12 +1145,21 @@ sub possible {
 
 my $prefix = '';
 
+sub show_type {
+   return !defined $ignore_type{$_[0]};
+}
+
 sub report {
-   if (defined $tst_only && $_[0] !~ /\Q$tst_only\E/) {
+   if (!show_type($_[1]) ||
+   (defined $tst_only && $_[2] !~ /\Q$tst_only\E/)) {
return 0;
}
-   my $line = $prefix . $_[0];
-
+   my $line;
+   if ($show_types) {
+   $line = "$prefix$_[0]:$_[1]: $_[2]\n";
+   } else {
+   $line = "$prefix$_[0]: $_[2]\n";
+   }
$line = (split('\n', $line))[0] . "\n" if ($terse);
 
push(our @report, $line);
@@ -1101,20 +1169,21 @@ sub report {
 sub report_dump {
our @report;
 }
+
 sub ERROR {
-   if (report("ERROR: $_[0]\n")) {
+   if (report("ERROR", $_[0], $_[1])) {
our $clean = 0;
our $cnt_error++;
}
 }
 sub WARN {
-   if (report("WARNING: $_[0]\n")) {
+   if (report("WARNING", $_[0], $_[1])) {
our $clean = 0;
our $cnt_warn++;
}
 }
 sub CHK {
-   if ($check && re

[PATCH v2 0/4] checkpatch.pl: add ability to ignore various messages

2018-12-05 Thread Antony Pavlov
Changes since PATCH v1:

  * fix linux kernel git repo hash sums in "checkpatch.pl: check
for common memset parameter issues against statements" commit message.

Antony Pavlov (4):
  checkpatch.pl: add ability to ignore various messages
  checkpatch.pl: check for common memset parameter issues against
statements
  checkpatch.pl: use SPDX tag
  checkpatch.pl: check for #if 0/#if 1

 scripts/checkpatch.pl | 508 ++
 1 file changed, 367 insertions(+), 141 deletions(-)

-- 
2.20.0.rc2


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


[PATCH v2 2/4] checkpatch.pl: check for common memset parameter issues against statements

2018-12-05 Thread Antony Pavlov
Based on these Linux kernel commits

> 309c00c73f053a90 checkpatch: warn about memset with swapped arguments
> 554e165cf32610ec checkpatch: check for common memset parameter issues against 
> statments

Signed-off-by: Antony Pavlov 
---
 scripts/checkpatch.pl | 22 ++
 1 file changed, 22 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 4b9b9d06f3..d8a8e5004f 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2961,6 +2961,28 @@ sub process {
 "sizeof(& should be avoided\n" . $herecurr);
}
 
+# Check for misused memsets
+   if (defined $stat && $stat =~ /\bmemset\s*\((.*)\)/s) {
+   my $args = $1;
+
+   # Flatten any parentheses and braces
+   while ($args =~ s/\([^\(\)]*\)/10/s ||
+  $args =~ s/\{[^\{\}]*\}/10/s ||
+  $args =~ s/\[[^\[\]]*\]/10/s)
+   {
+   }
+   # Extract the simplified arguments.
+   my ($ms_addr, $ms_val, $ms_size) =
+   split(/\s*,\s*/, $args);
+   if ($ms_size =~ /^(0x|)0$/i) {
+   ERROR("MEMSET",
+ "memset size is 3rd argument, not the 
second.\n" . $herecurr);
+   } elsif ($ms_size =~ /^(0x|)1$/i) {
+   WARN("MEMSET",
+"single byte memset is suspicious. Swapped 
2nd/3rd argument?\n" . $herecurr);
+   }
+   }
+
 # check for new externs in .c files.
if ($realfile =~ /\.c$/ && defined $stat &&
$stat =~ /^.\s*(?:extern\s+)?$Type\s+($Ident)(\s*)\(/s)
-- 
2.20.0.rc2


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


[PATCH 4/4] checkpatch.pl: check for #if 0/#if 1

2018-12-05 Thread Antony Pavlov
The #if 0 or #if 1 is used to toggle features. Warn if #if 0 or #if 1
is present and suggest that they can be removed.

Based on 60f890105547f7a4 ("checkpatch: check for #if 0/#if 1")
Linux kernel commit.

Signed-off-by: Antony Pavlov 
---
 scripts/checkpatch.pl | 11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index d1fe6659ce..4e17347a84 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2863,9 +2863,14 @@ sub process {
 
 # warn about #if 0
if ($line =~ /^.\s*\#\s*if\s+0\b/) {
-   CHK("REDUNDANT_CODE",
-   "if this code is redundant consider removing it\n" .
-   $herecurr);
+   WARN("IF_0",
+"Consider removing the code enclosed by this #if 0 
and its #endif\n" . $herecurr);
+   }
+
+# warn about #if 1
+   if ($line =~ /^.\s*\#\s*if\s+1\b/) {
+   WARN("IF_1",
+"Consider removing the #if 1 and its #endif\n" . 
$herecurr);
}
 
 # check for needless kfree() checks
-- 
2.20.0.rc2


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


[PATCH 1/4] checkpatch.pl: add ability to ignore various messages

2018-12-05 Thread Antony Pavlov
Based on commit 000d1cc1829f938c ("checkpatch.pl: add
ability to ignore various messages") from Linux kernel.

This simplifies current linux kernel checkpatch.pl commit
adoption for barebox due to conversion of
1-argument ERROR($1), WARN($1) and CHK($1) subs into
2-argument ERROR($1, $2), WARN($1, $2) and CHK($1, $2) subs.

Signed-off-by: Antony Pavlov 
---
 scripts/checkpatch.pl | 475 ++
 1 file changed, 336 insertions(+), 139 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 9a6f6e2298..4b9b9d06f3 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -10,7 +10,7 @@ use strict;
 my $P = $0;
 $P =~ s@.*/@@g;
 
-my $V = '0.31';
+my $V = '0.32';
 
 use Getopt::Long qw(:config no_auto_abbrev);
 
@@ -26,9 +26,13 @@ my $check = 0;
 my $summary = 1;
 my $mailback = 0;
 my $summary_file = 0;
+my $show_types = 0;
 my $root;
 my %debug;
+my %ignore_type = ();
+my @ignore = ();
 my $help = 0;
+my $configuration_file = ".checkpatch.conf";
 
 sub help {
my ($exitcode) = @_;
@@ -46,6 +50,8 @@ Options:
   --terseone line per report
   -f, --file treat FILE as regular source file
   --subjective, --strict enable more subjective tests
+  --ignore TYPE(,TYPE2...)   ignore various comma separated message types
+  --show-types   show the message "types" in the output
   --root=PATHPATH to the kernel tree root
   --no-summary   suppress the per-file summary
   --mailback only produce a report in case of warnings/errors
@@ -63,6 +69,32 @@ EOM
exit($exitcode);
 }
 
+my $conf = which_conf($configuration_file);
+if (-f $conf) {
+   my @conf_args;
+   open(my $conffile, '<', "$conf")
+   or warn "$P: Can't find a readable $configuration_file file $!\n";
+
+   while (<$conffile>) {
+   my $line = $_;
+
+   $line =~ s/\s*\n?$//g;
+   $line =~ s/^\s*//g;
+   $line =~ s/\s+/ /g;
+
+   next if ($line =~ m/^\s*#/);
+   next if ($line =~ m/^\s*$/);
+
+   my @words = split(" ", $line);
+   foreach my $word (@words) {
+   last if ($word =~ m/^#/);
+   push (@conf_args, $word);
+   }
+   }
+   close($conffile);
+   unshift(@ARGV, @conf_args) if @conf_args;
+}
+
 GetOptions(
'q|quiet+'  => \$quiet,
'tree!' => \$tree,
@@ -73,6 +105,8 @@ GetOptions(
'f|file!'   => \$file,
'subjective!'   => \$check,
'strict!'   => \$check,
+   'ignore=s'  => \@ignore,
+   'show-types!'   => \$show_types,
'root=s'=> \$root,
'summary!'  => \$summary,
'mailback!' => \$mailback,
@@ -93,6 +127,19 @@ if ($#ARGV < 0) {
exit(1);
 }
 
+@ignore = split(/,/, join(',',@ignore));
+foreach my $word (@ignore) {
+   $word =~ s/\s*\n?$//g;
+   $word =~ s/^\s*//g;
+   $word =~ s/\s+/ /g;
+   $word =~ tr/[a-z]/[A-Z]/;
+
+   next if ($word =~ m/^\s*#/);
+   next if ($word =~ m/^\s*$/);
+
+   $ignore_type{$word}++;
+}
+
 my $dbg_values = 0;
 my $dbg_possible = 0;
 my $dbg_type = 0;
@@ -341,6 +388,18 @@ sub top_of_kernel_tree {
return 1;
 }
 
+sub which_conf {
+   my ($conf) = @_;
+
+   foreach my $path (split(/:/, ".:$ENV{HOME}:.scripts")) {
+   if (-e "$path/$conf") {
+   return "$path/$conf";
+   }
+   }
+
+   return "";
+}
+
 sub expand_tabs {
my ($str) = @_;
 
@@ -1086,12 +1145,21 @@ sub possible {
 
 my $prefix = '';
 
+sub show_type {
+   return !defined $ignore_type{$_[0]};
+}
+
 sub report {
-   if (defined $tst_only && $_[0] !~ /\Q$tst_only\E/) {
+   if (!show_type($_[1]) ||
+   (defined $tst_only && $_[2] !~ /\Q$tst_only\E/)) {
return 0;
}
-   my $line = $prefix . $_[0];
-
+   my $line;
+   if ($show_types) {
+   $line = "$prefix$_[0]:$_[1]: $_[2]\n";
+   } else {
+   $line = "$prefix$_[0]: $_[2]\n";
+   }
$line = (split('\n', $line))[0] . "\n" if ($terse);
 
push(our @report, $line);
@@ -1101,20 +1169,21 @@ sub report {
 sub report_dump {
our @report;
 }
+
 sub ERROR {
-   if (report("ERROR: $_[0]\n")) {
+   if (report("ERROR", $_[0], $_[1])) {
our $clean = 0;
our $cnt_error++;
}
 }
 sub WARN {
-   if (report("WARNING: $_[0]\n")) {
+   if (report("WARNING", $_[0], $_[1])) {
our $clean = 0;
our $cnt_warn++;
}
 }
 sub CHK {
-   if ($check && re

[PATCH 0/4] checkpatch.pl: port misc linux commits

2018-12-05 Thread Antony Pavlov
Antony Pavlov (4):
  checkpatch.pl: add ability to ignore various messages
  checkpatch.pl: check for common memset parameter issues against
statements
  checkpatch.pl: use SPDX tag
  checkpatch.pl: check for #if 0/#if 1

 scripts/checkpatch.pl | 508 ++
 1 file changed, 367 insertions(+), 141 deletions(-)

-- 
2.20.0.rc2


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


[PATCH 3/4] checkpatch.pl: use SPDX tag

2018-12-05 Thread Antony Pavlov
Also add Joe's copyright.

Based on Linux kernel commit 882ea1d64eb3956
("scripts: use SPDX tag in get_maintainer and checkpatch").

Signed-off-by: Antony Pavlov 
---
 scripts/checkpatch.pl | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index d8a8e5004f..d1fe6659ce 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1,9 +1,11 @@
 #!/usr/bin/perl -w
+# SPDX-License-Identifier: GPL-2.0
+#
 # (c) 2001, Dave Jones. (the file handling bit)
 # (c) 2005, Joel Schopp  (the ugly bit)
 # (c) 2007,2008, Andy Whitcroft  (new conditions, test suite)
 # (c) 2008-2010 Andy Whitcroft 
-# Licensed under the terms of the GNU GPL License version 2
+# (c) 2010-2018 Joe Perches 
 
 use strict;
 
-- 
2.20.0.rc2


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


[PATCH 2/4] checkpatch.pl: check for common memset parameter issues against statements

2018-12-05 Thread Antony Pavlov
Based on these Linux kernel commits

> 09c00c73f053a905 checkpatch: warn about memset with swapped arguments
> 54e165cf32610ec9 checkpatch: check for common memset parameter issues against 
> statments

Signed-off-by: Antony Pavlov 
---
 scripts/checkpatch.pl | 22 ++
 1 file changed, 22 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 4b9b9d06f3..d8a8e5004f 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2961,6 +2961,28 @@ sub process {
 "sizeof(& should be avoided\n" . $herecurr);
}
 
+# Check for misused memsets
+   if (defined $stat && $stat =~ /\bmemset\s*\((.*)\)/s) {
+   my $args = $1;
+
+   # Flatten any parentheses and braces
+   while ($args =~ s/\([^\(\)]*\)/10/s ||
+  $args =~ s/\{[^\{\}]*\}/10/s ||
+  $args =~ s/\[[^\[\]]*\]/10/s)
+   {
+   }
+   # Extract the simplified arguments.
+   my ($ms_addr, $ms_val, $ms_size) =
+   split(/\s*,\s*/, $args);
+   if ($ms_size =~ /^(0x|)0$/i) {
+   ERROR("MEMSET",
+ "memset size is 3rd argument, not the 
second.\n" . $herecurr);
+   } elsif ($ms_size =~ /^(0x|)1$/i) {
+   WARN("MEMSET",
+"single byte memset is suspicious. Swapped 
2nd/3rd argument?\n" . $herecurr);
+   }
+   }
+
 # check for new externs in .c files.
if ($realfile =~ /\.c$/ && defined $stat &&
$stat =~ /^.\s*(?:extern\s+)?$Type\s+($Ident)(\s*)\(/s)
-- 
2.20.0.rc2


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


Re: [PATCH v3 08/10] MIPS: port all mach* to multiimage

2018-12-05 Thread Antony Pavlov
On Tue, 27 Nov 2018 10:19:33 +0100
Oleksij Rempel  wrote:


...

> diff --git a/arch/mips/boards/8devices-lima/include/board/board_pbl_start.h 
> b/arch/mips/boards/8devices-lima/lowlevel.S
> similarity index 78%
> rename from arch/mips/boards/8devices-lima/include/board/board_pbl_start.h
> rename to arch/mips/boards/8devices-lima/lowlevel.S
> index e95aa49256..a619747f39 100644
> --- a/arch/mips/boards/8devices-lima/include/board/board_pbl_start.h
> +++ b/arch/mips/boards/8devices-lima/lowlevel.S
> @@ -15,51 +15,39 @@
>   *
>   */
>  
> -#include 
> +#define BOARD_PBL_START start_8devices_lima
> +
> +#include 
> +#include 
>  #include 
>  #include 
>  #include 
>  #include 
>  
> - .macro  board_pbl_start
> - .setpush
> - .setnoreorder
> +ENTRY_FUNCTION(BOARD_PBL_START)
>  
>   mips_barebox_10h
>  
> - debug_ll_ar9344_init
> -
> - debug_ll_outc '1'
> + debug_ll_ath79_init
>  

I suppose there is a problem with simultaneous debug_ll support for AR9344 and 
AR9331 in one binary.
the Kconfig DEBUG_AR9331_UART and DEBUG_AR9344_UART options are mutually 
exclusive.

Your approach makes it possible to build barebox binary image for AR9331 board 
with debug_ll code for AR9344
and vice versa.

>   hornet_mips24k_cp0_setup
> - debug_ll_outc '2'
>  
>   /* test if we are in the SRAM */
>   pbl_blt 0xbd00 1f t8

"if $pc < 0xbd00 then jump to 1f"

> - debug_ll_outc '3'
>   b skip_flash_test
>   nop
>  1:
>   /* test if we are in the flash */
>   pbl_blt 0xbf00 skip_pll_ram_config t8

"if $pc < 0xbf00 then jump to skip_pll_ram_config"


The code checks that $pc is less than 0xbd00 if true then the code checks
that $pc is less than 0xbf00. The second check is redundant!



> - debug_ll_outc '4'
>  skip_flash_test:
>  
>   pbl_qca4531_ddr2_550_550_init
>  
> - debug_ll_outc '5'
>   /* Initialize caches... */
>   mips_cache_reset
>  
>   /* ... and enable them */
>   dcache_enable
>  skip_pll_ram_config:
> - debug_ll_outc '6'
> - debug_ll_outnl
> -
> - mips_nmon
> -
> - copy_to_link_location   pbl_start
>  
> - .setpop
> - .endm
> +ENTRY_FUNCTION_END(BOARD_PBL_START, qca4531_8devices_lima)

-- 
Best regards,
  Antony Pavlov

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


Re: [PATCH v3 00/10] MIPS: migrate to multiimage support

2018-11-30 Thread Antony Pavlov
-
> >  ...itmix-rzx50_defconfig => xburst_defconfig} |  8 +-
> >  arch/mips/dts/Makefile| 15 +++-
> >  arch/mips/include/asm/asm.h   | 29 ++
> >  arch/mips/lib/pbl.lds.S   | 53 +++
> >  arch/mips/mach-ar231x/include/mach/debug_ll.h |  1 -
> >  arch/mips/mach-ath79/Kconfig  | 16 ++--
> >  arch/mips/mach-ath79/include/mach/debug_ll.h  | 12 ++-
> >  .../mach-ath79/include/mach/debug_ll_ar9331.h |  2 +-
> >  .../mach-ath79/include/mach/debug_ll_ar9344.h |  4 +-
> >  .../mips/mach-ath79/include/mach/pbl_macros.h |  5 +-
> >  .../mach-loongson/include/mach/debug_ll.h |  1 -
> >  arch/mips/mach-malta/Kconfig  |  9 +-
> >  arch/mips/mach-malta/include/mach/debug_ll.h  | 10 ++-
> >  arch/mips/mach-xburst/Kconfig | 14 ++-
> >  arch/mips/mach-xburst/include/mach/debug_ll.h | 14 ++-
> >  images/Makefile   |  7 +-
> >  images/Makefile.ar231x|  3 +
> >  images/Makefile.ath79 | 20 +
> >  images/Makefile.loongson  |  3 +
> >  images/Makefile.malta |  3 +
> >  images/Makefile.xburst|  7 ++
> >  images/piggy.S|  2 +-
> >  pbl/Kconfig   |  2 +-
> >  68 files changed, 354 insertions(+), 814 deletions(-)
> >  create mode 100644 arch/mips/boards/8devices-lima/Makefile
> >  rename arch/mips/boards/8devices-lima/{include/board/board_pbl_start.h => 
> > lowlevel.S} (78%)
> >  create mode 100644 arch/mips/boards/Makefile
> >  delete mode 100644 arch/mips/boards/black-swift/board.c
> >  rename arch/mips/boards/black-swift/{include/board/board_pbl_start.h => 
> > lowlevel.S} (86%)
> >  create mode 100644 arch/mips/boards/dptechnics-dpt-module/Makefile
> >  rename 
> > arch/mips/boards/dptechnics-dpt-module/{include/board/board_pbl_start.h => 
> > lowlevel.S} (59%)
> >  delete mode 100644 arch/mips/boards/img-ci20/board.c
> >  delete mode 100644 arch/mips/boards/img-ci20/include/board/debug_ll.h
> >  rename arch/mips/boards/img-ci20/{include/board/board_pbl_start.h => 
> > lowlevel.S} (88%)
> >  rename arch/mips/boards/loongson-ls1b/{include/board/board_pbl_start.h => 
> > lowlevel.S} (86%)
> >  delete mode 100644 arch/mips/boards/loongson-ls1b/serial.c
> >  rename arch/mips/boards/netgear-wg102/{include/board/board_pbl_start.h => 
> > lowlevel.S} (87%)
> >  delete mode 100644 arch/mips/boards/qemu-malta/init.c
> >  rename arch/mips/boards/qemu-malta/{include/board/board_pbl_start.h => 
> > lowlevel.S} (94%)
> >  delete mode 100644 arch/mips/boards/ritmix-rzx50/include/board/debug_ll.h
> >  rename arch/mips/boards/ritmix-rzx50/{include/board/board_pbl_start.h => 
> > lowlevel.S} (88%)
> >  delete mode 100644 arch/mips/boards/ritmix-rzx50/serial.c
> >  delete mode 100644 arch/mips/boards/tplink-mr3020/board.c
> >  rename arch/mips/boards/tplink-mr3020/{include/board/board_pbl_start.h => 
> > lowlevel.S} (86%)
> >  delete mode 100644 arch/mips/boards/tplink-wdr4300/board.c
> >  rename arch/mips/boards/tplink-wdr4300/{include/board/board_pbl_start.h => 
> > lowlevel.S} (77%)
> >  delete mode 100644 arch/mips/boot/start-pbl.S
> >  delete mode 100644 arch/mips/configs/8devices-lima_defconfig
> >  rename arch/mips/configs/{tplink-mr3020_defconfig => ath79_defconfig} (90%)
> >  delete mode 100644 arch/mips/configs/black-swift_defconfig
> >  delete mode 100644 arch/mips/configs/dptechnics-dpt-module_defconfig
> >  delete mode 100644 arch/mips/configs/img-ci20_defconfig
> >  delete mode 100644 arch/mips/configs/tplink-wdr4300_defconfig
> >  rename arch/mips/configs/{ritmix-rzx50_defconfig => xburst_defconfig} (89%)
> >  create mode 100644 arch/mips/lib/pbl.lds.S
> >  create mode 100644 images/Makefile.ar231x
> >  create mode 100644 images/Makefile.ath79
> >  create mode 100644 images/Makefile.loongson
> >  create mode 100644 images/Makefile.malta
> >  create mode 100644 images/Makefile.xburst
> > 
> > -- 
> > 2.19.1
> > 
> > 
> > ___
> > barebox mailing list
> > barebox@lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/barebox
> > 
> 
> -- 
> 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- |


-- 
Best regards,
  Antony Pavlov

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


[PATCH] kconfig: include common Kconfig files from top-level Kconfig

2018-11-29 Thread Antony Pavlov
Based on this linux kernel commit:

> commit 1572497cb0e6d2016078bc9d5a95786bb878389f
> Author: Christoph Hellwig 
> Date:   Tue Jul 31 13:39:30 2018 +0200
>
> kconfig: include common Kconfig files from top-level Kconfig

Signed-off-by: Antony Pavlov 
---
 Kconfig   | 8 
 arch/arm/Kconfig  | 9 -
 arch/blackfin/Kconfig | 8 
 arch/mips/Kconfig | 8 
 arch/nios2/Kconfig| 8 
 arch/openrisc/Kconfig | 8 
 arch/ppc/Kconfig  | 7 ---
 arch/sandbox/Kconfig  | 8 
 arch/x86/Kconfig  | 8 
 9 files changed, 8 insertions(+), 64 deletions(-)

diff --git a/Kconfig b/Kconfig
index 197dd1c4b3..5c99e666c0 100644
--- a/Kconfig
+++ b/Kconfig
@@ -10,4 +10,12 @@ config SRCARCH
 
 source "arch/$SRCARCH/Kconfig"
 
+source common/Kconfig
+source commands/Kconfig
+source net/Kconfig
+source drivers/Kconfig
+source fs/Kconfig
+source lib/Kconfig
+source crypto/Kconfig
+source firmware/Kconfig
 source "scripts/Kconfig"
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 3b486f7b8b..cdc22efdeb 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -412,12 +412,3 @@ config ARM_PSCI_DEBUG
  Only use for debugging.
 
 endmenu
-
-source common/Kconfig
-source commands/Kconfig
-source net/Kconfig
-source drivers/Kconfig
-source fs/Kconfig
-source lib/Kconfig
-source crypto/Kconfig
-source firmware/Kconfig
diff --git a/arch/blackfin/Kconfig b/arch/blackfin/Kconfig
index 6233614e19..c9b5512c0a 100644
--- a/arch/blackfin/Kconfig
+++ b/arch/blackfin/Kconfig
@@ -64,11 +64,3 @@ config BFIN_BOOT_FLASH16
  blackfin is strapped to boot from 16bit wide flash via boot ROM
 
 endchoice
-
-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/mips/Kconfig b/arch/mips/Kconfig
index 524375a81a..7c40991cab 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -353,11 +353,3 @@ config MIPS_OPTIMIZED_STRING_FUNCTIONS
  increase your binary size.
 
 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/nios2/Kconfig b/arch/nios2/Kconfig
index 199540ba74..c7c13a464b 100644
--- a/arch/nios2/Kconfig
+++ b/arch/nios2/Kconfig
@@ -27,11 +27,3 @@ config EARLY_PRINTF
bool "Enable early printf functions"
 
 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/openrisc/Kconfig b/arch/openrisc/Kconfig
index 2a8abf0ff8..32d23029d8 100644
--- a/arch/openrisc/Kconfig
+++ b/arch/openrisc/Kconfig
@@ -27,11 +27,3 @@ config GENERIC
select OPENRISC
 
 endchoice
-
-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/ppc/Kconfig b/arch/ppc/Kconfig
index 97e6c00689..7a45ced7cd 100644
--- a/arch/ppc/Kconfig
+++ b/arch/ppc/Kconfig
@@ -20,10 +20,3 @@ endchoice
 
 source arch/ppc/mach-mpc5xxx/Kconfig
 source arch/ppc/mach-mpc85xx/Kconfig
-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/sandbox/Kconfig b/arch/sandbox/Kconfig
index 3f1cefb837..5227cb624f 100644
--- a/arch/sandbox/Kconfig
+++ b/arch/sandbox/Kconfig
@@ -15,11 +15,3 @@ config LINUX
 
 config ARCH_LINUX
bool
-
-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/x86/Kconfig b/arch/x86/Kconfig
index 52ccf4894f..3f91585d02 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -97,11 +97,3 @@ endchoice
 
 source arch/x86/boot/Kconfig
 source arch/x86/mach-i386/Kconfig
-
-source common/Kconfig
-source commands/Kconfig
-source net/Kconfig
-source drivers/Kconfig
-source fs/Kconfig
-source lib/Kconfig
-source crypto/Kconfig
-- 
2.20.0.rc1


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


Re: [PATCH] Kconfig: drop duplicate PHYS_ADDR_T_64BIT definitions

2018-11-29 Thread Antony Pavlov
On Thu, 29 Nov 2018 12:52:47 +0300
Antony Pavlov  wrote:

Please ignore this patch.

It looks like the patch fails on imx_v8_defconfig build.


> PHYS_ADDR_T_64BIT is already defined in common/Kconfig.
> 
> Signed-off-by: Antony Pavlov 
> ---
>  arch/arm/cpu/Kconfig | 3 ---
>  arch/mips/Kconfig| 3 ---
>  2 files changed, 6 deletions(-)
> 
> diff --git a/arch/arm/cpu/Kconfig b/arch/arm/cpu/Kconfig
> index 2359c56b30..f3b35d19fd 100644
> --- a/arch/arm/cpu/Kconfig
> +++ b/arch/arm/cpu/Kconfig
> @@ -1,8 +1,5 @@
>  comment "Processor Type"
>  
> -config PHYS_ADDR_T_64BIT
> - bool
> -
>  config CPU_32
>   bool
>   select HAS_MODULES
> diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
> index 524375a81a..75bfcb74e9 100644
> --- a/arch/mips/Kconfig
> +++ b/arch/mips/Kconfig
> @@ -29,9 +29,6 @@ config GENERIC_LINKER_SCRIPT
>  config HAS_NO_BOARD_HL_CODE
>   bool
>  
> -config PHYS_ADDR_T_64BIT
> - bool
> -
>  menu "Machine selection"
>  
>  config BUILTIN_DTB
> -- 
> 2.20.0.rc1
> 


-- 
Best regards,
  Antony Pavlov

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


[PATCH] Kconfig: drop duplicate PHYS_ADDR_T_64BIT definitions

2018-11-29 Thread Antony Pavlov
PHYS_ADDR_T_64BIT is already defined in common/Kconfig.

Signed-off-by: Antony Pavlov 
---
 arch/arm/cpu/Kconfig | 3 ---
 arch/mips/Kconfig| 3 ---
 2 files changed, 6 deletions(-)

diff --git a/arch/arm/cpu/Kconfig b/arch/arm/cpu/Kconfig
index 2359c56b30..f3b35d19fd 100644
--- a/arch/arm/cpu/Kconfig
+++ b/arch/arm/cpu/Kconfig
@@ -1,8 +1,5 @@
 comment "Processor Type"
 
-config PHYS_ADDR_T_64BIT
-   bool
-
 config CPU_32
bool
select HAS_MODULES
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 524375a81a..75bfcb74e9 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -29,9 +29,6 @@ config GENERIC_LINKER_SCRIPT
 config HAS_NO_BOARD_HL_CODE
bool
 
-config PHYS_ADDR_T_64BIT
-   bool
-
 menu "Machine selection"
 
 config BUILTIN_DTB
-- 
2.20.0.rc1


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


Re: [PATCH v2 0/4] Xilinx Zynq Ultrascale+ MPSoC support

2018-11-28 Thread Antony Pavlov
On Wed, 28 Nov 2018 12:20:49 +0100
Michael Tretter  wrote:

> This is v2 of the series to add support for the Xilinx Zynq Ultrascale+ MPSoC
> platform and the ZCU104 Evaluation Kit.
> 
> The patch "[PATCH v2 3/4] ARM: aarch64: add ENTRY_PROC macro for arm64"
> probably needs a closer look, as it adds a generic macro that is expected to
> be used by other arm64 architectures as well.
> 
> Changelog:
> 
> v1 -> v2:
> - move ENTRY_PROC to a more generic location
> - add separate patch for ENTRY_PROC
> - rebase onto piggydata patches
> - remove empty zynqmp.c and board.c
> - use SPDX-License-Identifiers

At the moment barebox uses SPDX identifiers in very few files.

Can we adopt Linux kernel licensing rules for barebox?
(https://github.com/torvalds/linux/blob/master/Documentation/process/license-rules.rst)

If so, we can add SPDX identifiers presense check into checkpatch.pl
as Linux kernel checkpatch.pl does (see 
https://lore.kernel.org/patchwork/patch/883424/).

-- 
Best regards,
  Antony Pavlov

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


Re: [PATCH v2 05/10] MIPS: multiimage: add ENTRY_FUNCTION macros

2018-11-27 Thread Antony Pavlov
On Tue, 27 Nov 2018 09:04:17 +0100
Sascha Hauer  wrote:

> > +   \
> > +   la  a0, dtb_start;  \
> > +   la  a1, dtb_end;\
> > +   la  v0, pbl_main_entry; \
> > +   jal v0; \
> > +nop;   \
> 
> Whitespace inconsistency here.

No whitespace inconsistency here.
Extra whitespace before nop is used because the nop instruction is in delay 
slot of the jal instruction.

-- 
Best regards,
  Antony Pavlov

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


Re: [PATCH v1 08/10] MIPS: port all mach* to multiimage

2018-11-26 Thread Antony Pavlov
On Mon, 26 Nov 2018 10:18:05 +0100
Oleksij Rempel  wrote:

Hi!

I can't apply this patch.
Here is 'git am' log:

Applying: MIPS: port all mach* to multiimage
.git/rebase-apply/patch:1291: trailing whitespace.
pbl-dtb-$(CONFIG_BOARD_8DEVICES_LIMA) += qca4531-8devices-lima.dtb.o 
.git/rebase-apply/patch:1292: trailing whitespace.
pbl-dtb-$(CONFIG_BOARD_BLACK_SWIFT) += black-swift.dtb.o 
.git/rebase-apply/patch:1294: trailing whitespace.
pbl-dtb-$(CONFIG_BOARD_DPTECHNICS_DPT_MODULE) += 
ar9331-dptechnics-dpt-module.dtb.o 
.git/rebase-apply/patch:1298: trailing whitespace.
pbl-dtb-$(CONFIG_BOARD_TPLINK_MR3020) += tplink-mr3020.dtb.o 
.git/rebase-apply/patch:1299: trailing whitespace.
pbl-dtb-$(CONFIG_BOARD_TPLINK_WDR4300) += ar9344-tl-wdr4300-v1.7.dtb.o 
error: patch failed: images/Makefile:53
error: images/Makefile: patch does not apply
Patch failed at 0001 MIPS: port all mach* to multiimage
hint: Use 'git am --show-current-patch' to see the failed patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

-- 
Best regards,
  Antony Pavlov

> Signed-off-by: Oleksij Rempel 
> ---
>  arch/mips/Kconfig |  7 ++
>  arch/mips/Makefile| 28 +-
>  arch/mips/boards/8devices-lima/Makefile   |  1 +
>  .../board/board_pbl_start.h => lowlevel.S}| 27 ++
>  arch/mips/boards/Makefile | 11 +++
>  arch/mips/boards/black-swift/Makefile |  1 +
>  .../board/board_pbl_start.h => lowlevel.S}| 17 ++--
>  .../boards/dptechnics-dpt-module/Makefile |  1 +
>  .../board/board_pbl_start.h => lowlevel.S}| 14 +--
>  arch/mips/boards/img-ci20/Makefile|  1 +
>  .../boards/img-ci20/include/board/debug_ll.h  | 23 -
>  .../board/board_pbl_start.h => lowlevel.S}| 14 ++-
>  arch/mips/boards/loongson-ls1b/Makefile   |  1 +
>  .../board/board_pbl_start.h => lowlevel.S}| 14 ++-
>  arch/mips/boards/netgear-wg102/Makefile   |  1 +
>  .../board/board_pbl_start.h => lowlevel.S}| 20 +++--
>  arch/mips/boards/qemu-malta/Makefile  |  1 +
>  .../board/board_pbl_start.h => lowlevel.S}| 16 ++--
>  arch/mips/boards/ritmix-rzx50/Makefile|  1 +
>  .../ritmix-rzx50/include/board/debug_ll.h | 23 -
>  .../board/board_pbl_start.h => lowlevel.S}| 14 ++-
>  arch/mips/boards/tplink-mr3020/Makefile   |  1 +
>  .../board/board_pbl_start.h => lowlevel.S}| 17 ++--
>  arch/mips/boards/tplink-wdr4300/Makefile  |  1 +
>  .../board/board_pbl_start.h => lowlevel.S}| 27 ++
>  arch/mips/boot/Makefile   |  2 +-
>  arch/mips/boot/start-pbl.S|  1 -
>  arch/mips/configs/8devices-lima_defconfig | 83 -
>  ...plink-mr3020_defconfig => ath79_defconfig} |  9 +-
>  arch/mips/configs/black-swift_defconfig   | 54 ---
>  .../configs/dptechnics-dpt-module_defconfig   | 89 ---
>  arch/mips/configs/img-ci20_defconfig  | 45 --
>  arch/mips/configs/qemu-malta_defconfig| 12 +--
>  arch/mips/configs/tplink-wdr4300_defconfig| 82 -
>  ...itmix-rzx50_defconfig => xburst_defconfig} |  8 +-
>  arch/mips/dts/Makefile| 15 +++-
>  arch/mips/mach-ar231x/include/mach/debug_ll.h |  2 +-
>  arch/mips/mach-ath79/Kconfig  | 20 -
>  arch/mips/mach-ath79/include/mach/debug_ll.h  | 12 ++-
>  .../mach-ath79/include/mach/debug_ll_ar9331.h |  2 +-
>  .../mach-ath79/include/mach/debug_ll_ar9344.h |  4 +-
>  .../mips/mach-ath79/include/mach/pbl_macros.h |  5 +-
>  arch/mips/mach-loongson/Kconfig   |  1 +
>  .../mach-loongson/include/mach/debug_ll.h |  2 +-
>  arch/mips/mach-malta/Kconfig  |  9 +-
>  arch/mips/mach-malta/include/mach/debug_ll.h  | 10 ++-
>  arch/mips/mach-xburst/Kconfig | 14 ++-
>  arch/mips/mach-xburst/include/mach/debug_ll.h | 14 ++-
>  images/Makefile   |  7 +-
>  images/Makefile.ar231x|  3 +
>  images/Makefile.ath79 | 20 +
>  images/Makefile.loongson  |  3 +
>  images/Makefile.malta |  3 +
>  images/Makefile.xburst|  7 ++
>  54 files changed, 253 insertions(+), 567 deletions(-)
>  create mode 100644 arch/mips/boards/8devices-lima/Makefile
>  rename arch/mips/boards/8devices-lima/{include/board/board_pbl_start.h => 
> lowlevel.S} (78%)
>  create mode 100644 arch/mips/boards/Makefile
>  rename arch/mips/boards/black-swift/{include/board/board_pbl_sta

Re: [PATCH v1 01/10] images: piggy: use "a" instead of #alloc flag

2018-11-26 Thread Antony Pavlov
On Mon, 26 Nov 2018 10:17:58 +0100
Oleksij Rempel  wrote:

Hi!

I can't apply this patch to the master branch 'FIT: support hash-1/signature-1 
nodes in signature check' (6bacf7bd8df)

Here is git-am error log:

Applying: images: piggy: use "a" instead of #alloc flag
error: images/piggy.S: does not exist in index
Patch failed at 0001 images: piggy: use "a" instead of #alloc flag
hint: Use 'git am --show-current-patch' to see the failed patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".


-- 
Best regards,
  Antony Pavlov


> "#alloc" is not working with MIPS compiler. The "a" variant
> seems to be more generic and works with ARM and MIPS.
> 
> Signed-off-by: Oleksij Rempel 
> ---
>  images/piggy.S | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/images/piggy.S b/images/piggy.S
> index 84396ae4ec..c2274ebac7 100644
> --- a/images/piggy.S
> +++ b/images/piggy.S
> @@ -1,4 +1,4 @@
> -.section .piggydata,#alloc
> +.section .piggydata,"a"
>  .globl  input_data
>  input_data:
>  .incbin "images/barebox.z"
> -- 
> 2.19.1
> 
> 
> ___
> 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: [PATCH v1 10/10] MIPS: multiimage: remove useless board files

2018-11-26 Thread Antony Pavlov
On Mon, 26 Nov 2018 10:18:07 +0100
Oleksij Rempel  wrote:

Hi!

This patch has no relation with multi-image support.
It uses the features introdused in your patch 'of: base: use root_node 
compatible
as suggestion for a hostname' (76759ec94eb3a3) which is already in mainline.

Can we submit 'remove useless board files' as an independent patch?

> From: Oleksij Rempel 
> 
> With multiimage support we should check OF compatible before executing
> some thing board specific. In most cases we was executing only 
> barebox_set_hostname().
> Since we can extract host name from devicetree, we can drop all of this
> board files.
> 
> Signed-off-by: Oleksij Rempel 
> ---
>  arch/mips/boards/black-swift/Makefile|  1 -
>  arch/mips/boards/black-swift/board.c | 27 --
>  arch/mips/boards/img-ci20/Makefile   |  1 -
>  arch/mips/boards/img-ci20/board.c| 27 --
>  arch/mips/boards/loongson-ls1b/Makefile  |  1 -
>  arch/mips/boards/loongson-ls1b/serial.c  | 10 
>  arch/mips/boards/qemu-malta/Makefile |  1 -
>  arch/mips/boards/qemu-malta/init.c   | 29 
>  arch/mips/boards/ritmix-rzx50/Makefile   |  1 -
>  arch/mips/boards/ritmix-rzx50/serial.c   | 27 --
>  arch/mips/boards/tplink-mr3020/Makefile  |  1 -
>  arch/mips/boards/tplink-mr3020/board.c   | 27 --
>  arch/mips/boards/tplink-wdr4300/Makefile |  1 -
>  arch/mips/boards/tplink-wdr4300/board.c  | 28 ---
>  14 files changed, 182 deletions(-)
>  delete mode 100644 arch/mips/boards/black-swift/board.c
>  delete mode 100644 arch/mips/boards/img-ci20/board.c
>  delete mode 100644 arch/mips/boards/loongson-ls1b/serial.c
>  delete mode 100644 arch/mips/boards/qemu-malta/init.c
>  delete mode 100644 arch/mips/boards/ritmix-rzx50/serial.c
>  delete mode 100644 arch/mips/boards/tplink-mr3020/board.c
>  delete mode 100644 arch/mips/boards/tplink-wdr4300/board.c
> 
> diff --git a/arch/mips/boards/black-swift/Makefile 
> b/arch/mips/boards/black-swift/Makefile
> index 092c31d6b2..b08c4a93ca 100644
> --- a/arch/mips/boards/black-swift/Makefile
> +++ b/arch/mips/boards/black-swift/Makefile
> @@ -1,2 +1 @@
>  lwl-y += lowlevel.o
> -obj-y += board.o
> diff --git a/arch/mips/boards/black-swift/board.c 
> b/arch/mips/boards/black-swift/board.c
> deleted file mode 100644
> index 2e2ed2075b..00
> --- a/arch/mips/boards/black-swift/board.c
> +++ /dev/null
> @@ -1,27 +0,0 @@
> -/*
> - * Copyright (C) 2015 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 
> -
> -static int model_hostname_init(void)
> -{
> - barebox_set_hostname("black-swift");
> -
> - return 0;
> -}
> -postcore_initcall(model_hostname_init);
> diff --git a/arch/mips/boards/img-ci20/Makefile 
> b/arch/mips/boards/img-ci20/Makefile
> index 092c31d6b2..b08c4a93ca 100644
> --- a/arch/mips/boards/img-ci20/Makefile
> +++ b/arch/mips/boards/img-ci20/Makefile
> @@ -1,2 +1 @@
>  lwl-y += lowlevel.o
> -obj-y += board.o
> diff --git a/arch/mips/boards/img-ci20/board.c 
> b/arch/mips/boards/img-ci20/board.c
> deleted file mode 100644
> index 515ebaece6..00
> --- a/arch/mips/boards/img-ci20/board.c
> +++ /dev/null
> @@ -1,27 +0,0 @@
> -/*
> - * Copyright (C) 2012 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 
> -
> -static int ci20_hostname_init(void)
> -{
> - barebox_set_hostname("ci20");
> -
> - return 0;
> -}
> -consol

Re: [PATCH v1 08/10] MIPS: port all mach* to multiimage

2018-11-26 Thread Antony Pavlov
TART, __dtb_black_swift_start,
> + __dtb_black_swift_end)
> diff --git a/arch/mips/boards/dptechnics-dpt-module/Makefile 
> b/arch/mips/boards/dptechnics-dpt-module/Makefile
> new file mode 100644
> index 00..b08c4a93ca
> --- /dev/null
> +++ b/arch/mips/boards/dptechnics-dpt-module/Makefile
> @@ -0,0 +1 @@
> +lwl-y += lowlevel.o
> diff --git 
> a/arch/mips/boards/dptechnics-dpt-module/include/board/board_pbl_start.h 
> b/arch/mips/boards/dptechnics-dpt-module/lowlevel.S
> similarity index 55%
> rename from 
> arch/mips/boards/dptechnics-dpt-module/include/board/board_pbl_start.h
> rename to arch/mips/boards/dptechnics-dpt-module/lowlevel.S
> index 9d6b1b86bc..ab6e469492 100644
> --- a/arch/mips/boards/dptechnics-dpt-module/include/board/board_pbl_start.h
> +++ b/arch/mips/boards/dptechnics-dpt-module/lowlevel.S
> @@ -6,15 +6,19 @@
>   * as published by the Free Software Foundation.
>   */
>  
> +#define BOARD_PBL_START start_dptechnics_dpt_module
> +
> +#include 
> +#include 
> +#include 
> +#include 
>  #include 
>  #include 
>  #include 
>  
> - .macro  board_pbl_start
> - .setpush
> - .setnoreorder
> +ENTRY_FUNCTION(BOARD_PBL_START)
>  
>   ar9331_pbl_generic_start
>  
> - .setpop
> - .endm
> +ENTRY_FUNCTION_END(BOARD_PBL_START, __dtb_ar9331_dptechnics_dpt_module_start,
> + __dtb_ar9331_dptechnics_dpt_module_end)
> diff --git a/arch/mips/boards/img-ci20/Makefile 
> b/arch/mips/boards/img-ci20/Makefile
> index dcfc2937d3..092c31d6b2 100644
> --- a/arch/mips/boards/img-ci20/Makefile
> +++ b/arch/mips/boards/img-ci20/Makefile
> @@ -1 +1,2 @@
> +lwl-y += lowlevel.o
>  obj-y += board.o
> diff --git a/arch/mips/boards/img-ci20/include/board/debug_ll.h 
> b/arch/mips/boards/img-ci20/include/board/debug_ll.h
> deleted file mode 100644
> index 72612cff2b..00
> --- a/arch/mips/boards/img-ci20/include/board/debug_ll.h
> +++ /dev/null
> @@ -1,23 +0,0 @@
> -/*
> - * Copyright (C) 2014 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 __INCLUDE_CI20_BOARD_DEBUG_LL_H__
> -#define __INCLUDE_CI20_BOARD_DEBUG_LL_H__
> -
> -#include 
> -
> -#endif  /* __INCLUDE_CI20_BOARD_DEBUG_LL_H__ */
> diff --git a/arch/mips/boards/img-ci20/include/board/board_pbl_start.h 
> b/arch/mips/boards/img-ci20/lowlevel.S
> similarity index 85%
> rename from arch/mips/boards/img-ci20/include/board/board_pbl_start.h
> rename to arch/mips/boards/img-ci20/lowlevel.S
> index 42d23c82a9..ffaf5c81e4 100644
> --- a/arch/mips/boards/img-ci20/include/board/board_pbl_start.h
> +++ b/arch/mips/boards/img-ci20/lowlevel.S
> @@ -17,13 +17,13 @@
>   *
>   */
>  
> +#define BOARD_PBL_START start_img_ci20
> +
>  #include 
>  #include 
>  #include 
>  
> - .macro  board_pbl_start
> - .setpush
> - .setnoreorder
> +ENTRY_FUNCTION(BOARD_PBL_START)
>  
>   mips_disable_interrupts
>  
> @@ -35,9 +35,5 @@
>   debug_ll_outc '.'
>   debug_ll_ns16550_outnl
>  
> - mips_nmon
> -
> - copy_to_link_location   pbl_start
> -
> - .setpop
> - .endm
> +ENTRY_FUNCTION_END(BOARD_PBL_START, __dtb_img_ci20_start,
> + __dtb_img_ci20_end)
> diff --git a/arch/mips/boards/loongson-ls1b/Makefile 
> b/arch/mips/boards/loongson-ls1b/Makefile
> index 31c062987f..ded9867a8e 100644
> --- a/arch/mips/boards/loongson-ls1b/Makefile
> +++ b/arch/mips/boards/loongson-ls1b/Makefile
> @@ -1 +1,2 @@
> +lwl-y += lowlevel.o
>  obj-y += serial.o
> diff --git a/arch/mips/boards/loongson-ls1b/include/board/board_pbl_start.h 
> b/arch/mips/boards/loongson-ls1b/lowlevel.S
> similarity index 83%
> rename from arch/mips/boards/loongson-ls1b/include/board/board_pbl_start.h
> rename to arch/mips/boards/loongson-ls1b/lowlevel.S
> index a3c585ecba..ba66fc3212 100644
> --- a/arch/mips/boards/loongson-ls1b/include/board/board_pbl_start.h
> +++ b/arch/mips/boards/loongson-ls1b/lowlevel.S
> @@ -15,14 +15,14 @@
>   *
>   */
>  
> +#define BOARD_PBL_START start_loongson_ls1b
> +
>  #include 
>  #include 
>  #include

Re: [PATCH] arch: *: cpuinfo: harmonize command description

2018-11-22 Thread Antony Pavlov
On Thu, 22 Nov 2018 09:12:00 +0100
Ulrich Ölmann  wrote:

Hello Robert!

AFAIR you are a native English speaker.

Would you please comment this change

> - BAREBOX_CMD_DESC("show CPU information")
> + BAREBOX_CMD_DESC("show information about CPU")

Which version of the cpuinfo command description is better?

-- 
Best regards,
  Antony Pavlov

> Unify the different cpuinfo commands' description and adjust them to the
> descriptions of "clk_dump" and "devinfo".
> 
> Signed-off-by: Ulrich Ölmann 
> ---
>  arch/arm/cpu/cpuinfo.c  | 2 +-
>  arch/mips/lib/cpuinfo.c | 2 +-
>  arch/openrisc/lib/cpuinfo.c | 2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm/cpu/cpuinfo.c b/arch/arm/cpu/cpuinfo.c
> index 175475b038dc..2421b91e57f1 100644
> --- a/arch/arm/cpu/cpuinfo.c
> +++ b/arch/arm/cpu/cpuinfo.c
> @@ -268,7 +268,7 @@ static int do_cpuinfo(int argc, char *argv[])
>  
>  BAREBOX_CMD_START(cpuinfo)
>   .cmd= do_cpuinfo,
> - BAREBOX_CMD_DESC("show info about CPU")
> + BAREBOX_CMD_DESC("show information about CPU")
>   BAREBOX_CMD_GROUP(CMD_GRP_INFO)
>   BAREBOX_CMD_COMPLETE(empty_complete)
>  BAREBOX_CMD_END
> diff --git a/arch/mips/lib/cpuinfo.c b/arch/mips/lib/cpuinfo.c
> index fb02a4d20217..a327672f78a5 100644
> --- a/arch/mips/lib/cpuinfo.c
> +++ b/arch/mips/lib/cpuinfo.c
> @@ -63,6 +63,6 @@ static int do_cpuinfo(int argc, char *argv[])
>  
>  BAREBOX_CMD_START(cpuinfo)
>   .cmd= do_cpuinfo,
> - BAREBOX_CMD_DESC("show CPU information")
> + BAREBOX_CMD_DESC("show information about CPU")
>   BAREBOX_CMD_GROUP(CMD_GRP_INFO)
>  BAREBOX_CMD_END
> diff --git a/arch/openrisc/lib/cpuinfo.c b/arch/openrisc/lib/cpuinfo.c
> index 175adc582ca4..3d7fcb1f59ce 100644
> --- a/arch/openrisc/lib/cpuinfo.c
> +++ b/arch/openrisc/lib/cpuinfo.c
> @@ -198,6 +198,6 @@ static int do_cpuinfo(int argc, char *argv[])
>  
>  BAREBOX_CMD_START(cpuinfo)
>   .cmd= do_cpuinfo,
> - BAREBOX_CMD_DESC("show CPU information")
> + BAREBOX_CMD_DESC("show information about CPU")
>   BAREBOX_CMD_GROUP(CMD_GRP_INFO)
>  BAREBOX_CMD_END
> -- 
> 2.19.1
> 
> 
> ___
> 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


common/ddr_spd.c:281:28: warning: bitwise comparison always evaluates to false

2018-11-01 Thread Antony Pavlov
Hi!

I have tried to build barebox with gcc-8.2.

I see this warning:

common/ddr_spd.c:281:28:
common/ddr_spd.c: In function ‘ddr_spd_print’:
common/ddr_spd.c:281:28: warning: bitwise comparison always evaluates to false 
[-Wtautological-compare]
  if ((s->mod_ranks & 0x10) == 1)
^~

Git blame show me this:

f75fe31095 (Alexander Smirnov 2015-07-03 18:58:24 +0300 280)printf("%-48s 
", "DRAM Package ");
f75fe31095 (Alexander Smirnov 2015-07-03 18:58:24 +0300 281)if 
((s->mod_ranks & 0x10) == 1)
f75fe31095 (Alexander Smirnov 2015-07-03 18:58:24 +0300 282)
printf("Stack\n");
f75fe31095 (Alexander Smirnov 2015-07-03 18:58:24 +0300 283)else
f75fe31095 (Alexander Smirnov 2015-07-03 18:58:24 +0300 284)
printf("Planar\n");

Please fix it.

-- 
Best regards,
  Antony Pavlov

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


[PATCH] net: make routing work after dhcp command

2018-10-15 Thread Antony Pavlov
At the moment only ifup stuff turns netif up.
After the commit f0624a701513 ('net: Do not route traffic
to interfaces that are not up') the dhcp command
keeps netif->ifup == false and network subsystem
can't route packets.

How to repropduce the problem on qemu-malta_defconfig:

qemu-system-mips -nodefaults -M malta -m 256 \
 -nographic -serial stdio -monitor null \
 -bios barebox-flash-image \
 -net user -net nic,model=rtl8139

...

barebox:/ dhcp
eth0: 100Mbps full duplex link detected
eth0: DHCP client bound to address 10.0.2.15
barebox:/ ping 10.0.2.2
ping failed: No route to host

However if ifup command is used for network interface
configuration then there is no network problem, e.g.

barebox:/ ifup eth0
eth0: 100Mbps full duplex link detected
eth0: DHCP client bound to address 10.0.2.15
barebox:/ ping 10.0.2.2
host 10.0.2.2 is alive

Signed-off-by: Antony Pavlov 
CC: Andrey Smirnov 
---
 net/dhcp.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/dhcp.c b/net/dhcp.c
index 984d32a93e..427d80a5a8 100644
--- a/net/dhcp.c
+++ b/net/dhcp.c
@@ -615,6 +615,9 @@ int dhcp(struct eth_device *edev, const struct 
dhcp_req_param *param)
 
dhcp_result_free(res);
 
+   if (!ret)
+   edev->ifup = true;
+
return ret;
 }
 
-- 
2.19.1


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


[PATCH] checkpatch: don't check TODO file presence

2018-09-12 Thread Antony Pavlov
The commit b3baf2d86149 ("TODO: remove unused file") drops
the TODO file. Alas scripts/checkpatch.pl checks TODO file
presence in top_of_kernel_tree(). Without TODO checkpatch.pl
exits with 'Must be run from the top-level dir. of a kernel tree'.

Signed-off-by: Antony Pavlov 
---
 scripts/checkpatch.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 48ad4938d9..9a6f6e2298 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -330,7 +330,7 @@ sub top_of_kernel_tree {
my @tree_check = (
"arch", "commands", "common", "COPYING", "defaultenv",
"Documentation", "drivers", "fs", "include", "lib",
-   "MAKEALL", "Makefile", "net", "README", "scripts", "TODO"
+   "MAKEALL", "Makefile", "net", "README", "scripts"
);
 
foreach my $check (@tree_check) {
-- 
2.18.0


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


[PATCH for master 0/2] MIPS and PCI-related fixes

2018-09-12 Thread Antony Pavlov
Antony Pavlov (2):
  MIPS: fix PCI quirk infrastructure build
  pci_of_match_device: don't crash on MIPS Malta

 arch/mips/lib/barebox.lds.S | 11 +++
 drivers/pci/pci.c   |  2 +-
 2 files changed, 12 insertions(+), 1 deletion(-)

-- 
2.18.0


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


[PATCH for master 1/2] MIPS: fix PCI quirk infrastructure build

2018-09-12 Thread Antony Pavlov
The commit fc2c618c2038 ("pci: add quirk infrastructure")
adds necessary ld-script changes only for ARM architecture.
As a result, qemu-malta build fails:

 LD  barebox
drivers/built-in.o: In function `pci_fixup_device':
(.text.pci_fixup_device+0x30): undefined reference to 
`__end_pci_fixups_enable'
(.text.pci_fixup_device+0x38): undefined reference to 
`__end_pci_fixups_enable'
(.text.pci_fixup_device+0x34): undefined reference to 
`__start_pci_fixups_enable'
(.text.pci_fixup_device+0x3c): undefined reference to 
`__start_pci_fixups_enable'
(.text.pci_fixup_device+0x70): undefined reference to 
`__end_pci_fixups_header'
(.text.pci_fixup_device+0x78): undefined reference to 
`__end_pci_fixups_header'
(.text.pci_fixup_device+0x74): undefined reference to 
`__start_pci_fixups_header'
(.text.pci_fixup_device+0x80): undefined reference to 
`__start_pci_fixups_header'
(.text.pci_fixup_device+0x2c): undefined reference to 
`__end_pci_fixups_early'
(.text.pci_fixup_device+0x88): undefined reference to 
`__end_pci_fixups_early'
(.text.pci_fixup_device+0x84): undefined reference to 
`__start_pci_fixups_early'
(.text.pci_fixup_device+0x90): undefined reference to 
`__start_pci_fixups_early'
make: *** [Makefile:767: barebox] Error 1

Signed-off-by: Antony Pavlov 
---
 arch/mips/lib/barebox.lds.S | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/arch/mips/lib/barebox.lds.S b/arch/mips/lib/barebox.lds.S
index 660d4be85e..c4026bb7f1 100644
--- a/arch/mips/lib/barebox.lds.S
+++ b/arch/mips/lib/barebox.lds.S
@@ -75,6 +75,17 @@ SECTIONS
__usymtab : { BAREBOX_SYMS }
__usymtab_end = .;
 
+#ifdef CONFIG_PCI
+   __start_pci_fixups_early = .;
+   .pci_fixup_early : { KEEP(*(.pci_fixup_early)) }
+   __end_pci_fixups_early = .;
+   __start_pci_fixups_header = .;
+   .pci_fixup_header : { KEEP(*(.pci_fixup_header)) }
+   __end_pci_fixups_header = .;
+   __start_pci_fixups_enable = .;
+   .pci_fixup_enable : { KEEP(*(.pci_fixup_enable)) }
+   __end_pci_fixups_enable = .;
+#endif
.oftables : { BAREBOX_CLK_TABLE() }
 
.dtb : { BAREBOX_DTB() }
-- 
2.18.0


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


[PATCH for master 2/2] pci_of_match_device: don't crash on MIPS Malta

2018-09-12 Thread Antony Pavlov
In arch/mips/mach-malta/pci.c PCI controller is instantiated
without dt and struct pci_controller parent field is NULL.

Signed-off-by: Antony Pavlov 
---
 drivers/pci/pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index d206c53848..7abc7a3439 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -339,7 +339,7 @@ pci_of_match_device(struct device_d *parent, unsigned int 
devfn)
struct device_node *np;
u32 reg;
 
-   if (!IS_ENABLED(CONFIG_OFTREE) || !parent->device_node)
+   if (!IS_ENABLED(CONFIG_OFTREE) || !parent || !parent->device_node)
return NULL;
 
for_each_child_of_node(parent->device_node, np) {
-- 
2.18.0


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


Re: [PATCH v2 03/12] Add initial RISC-V architecture support

2018-06-29 Thread Antony Pavlov
On Fri, 29 Jun 2018 13:32:55 +0200
Sascha Hauer  wrote:

> On Fri, Jun 29, 2018 at 01:27:10PM +0300, Antony Pavlov wrote:
> > On Fri, 29 Jun 2018 09:29:08 +0200
> > > 
> > > Do you need these __bare_init* stuff? If not I would prefer to remove
> > > it.
> > 
> > 
> > Hmmm. You are right! I have not realized PBL for RISC-V yet so it's better
> > to drop all these bare_inits.
> 
> This isn't needed for PBL either. It is only for cases where the boot
> ROM only loads the initial image portion.
> 
> > > 
> > > > +static int of_riscv_init(void)
> > > > +{
> > > > +   struct device_node *root;
> > > > +
> > > > +   root = of_get_root_node();
> > > > +   if (root)
> > > > +   return 0;
> > > > +
> > > > +   root = of_unflatten_dtb(__dtb_start);
> > > > +   if (!IS_ERR(root)) {
> > > > +   pr_debug("using internal DTB\n");
> > > > +   of_set_root_node(root);
> > > > +   if (IS_ENABLED(CONFIG_OFDEVICE))
> > > > +   of_probe();
> > > > +   }
> > > 
> > > Can we just call of_unflatten_dtb()/of_set_root_node() from the board
> > > code and use obj-dtb-y to include the dtb?
> > > 
> > > That way a board can specify the dtb and not the config.
> > 
> > Good idea! MIPS code lacks this feature at the moment.
> > 
> > Can I use of_arm_init() as a reference?
> 
> Not sure what you mean. of_riscv_init() is nearly a copy of
> of_arm_init() already.

Actually of_riscv_init() is a copy of of_mips_init().

-- 
Best regards,
  Antony Pavlov

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


[PATCH] MIPS: don't include generated header files into MIPS asm files

2018-06-29 Thread Antony Pavlov
This patch came out of discussions in the 'MIPS parallel build breakage' e-mail 
thread:

http://lists.infradead.org/pipermail/barebox/2018-March/032251.html

Signed-off-by: Antony Pavlov 
---
 arch/mips/include/asm/pbl_macros.h | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/arch/mips/include/asm/pbl_macros.h 
b/arch/mips/include/asm/pbl_macros.h
index 18115c8489..bb3182cda9 100644
--- a/arch/mips/include/asm/pbl_macros.h
+++ b/arch/mips/include/asm/pbl_macros.h
@@ -25,8 +25,6 @@
 #include 
 #include 
 #include 
-#include 
-#include 
 #include 
 #include 
 
@@ -174,7 +172,7 @@ copy_loop_exit:
 nop
 
.org0x10
-   .ascii  "barebox " UTS_RELEASE " " UTS_VERSION
+   .ascii  "barebox"
.byte   0
 
.align  4
-- 
2.18.0


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


Re: [PATCH v2 03/12] Add initial RISC-V architecture support

2018-06-29 Thread Antony Pavlov
On Fri, 29 Jun 2018 09:29:08 +0200
Sascha Hauer  wrote:

> On Thu, Jun 28, 2018 at 10:39:44AM +0300, Antony Pavlov wrote:
> > Signed-off-by: Antony Pavlov 
> > ---
> > +++ b/arch/riscv/lib/barebox.lds.S
> > @@ -0,0 +1,89 @@
> > +/*
> > + * 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 
> > +
> > +OUTPUT_ARCH(riscv)
> > +ENTRY(_start)
> > +SECTIONS
> > +{
> > +   . = TEXT_BASE;
> > +
> > +   . = ALIGN(8);
> > +   .text  :
> > +   {
> > +   _stext = .;
> > +   _start = .;
> > +   KEEP(*(.text_entry*))
> > +   _text = .;
> > +   __bare_init_start = .;
> > +   *(.text_bare_init*)
> > +   __bare_init_end = .;
> > +   *(.text*)
> > +   }
> > +   BAREBOX_BARE_INIT_SIZE
> 
> Do you need these __bare_init* stuff? If not I would prefer to remove
> it.


Hmmm. You are right! I have not realized PBL for RISC-V yet so it's better
to drop all these bare_inits.


> > +
> > +   PRE_IMAGE
> 
> Same here.
> 
> > +static int of_riscv_init(void)
> > +{
> > +   struct device_node *root;
> > +
> > +   root = of_get_root_node();
> > +   if (root)
> > +   return 0;
> > +
> > +   root = of_unflatten_dtb(__dtb_start);
> > +   if (!IS_ERR(root)) {
> > +   pr_debug("using internal DTB\n");
> > +   of_set_root_node(root);
> > +   if (IS_ENABLED(CONFIG_OFDEVICE))
> > +   of_probe();
> > +   }
> 
> Can we just call of_unflatten_dtb()/of_set_root_node() from the board
> code and use obj-dtb-y to include the dtb?
> 
> That way a board can specify the dtb and not the config.

Good idea! MIPS code lacks this feature at the moment.

Can I use of_arm_init() as a reference?

-- 
Best regards,
  Antony Pavlov

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


[PATCH v2 02/12] MIPS: Use generic GCC library routines from lib/

2018-06-28 Thread Antony Pavlov
This is a port of Linux kernel commit

| commit 740129b36faf049e6845819144542a0455e1e285
| Author: Antony Pavlov 
| Date:   Wed Apr 11 08:50:19 2018 +0100
|
| MIPS: Use generic GCC library routines from lib/

Signed-off-by: Antony Pavlov 
---
 arch/mips/Kconfig   |  3 +++
 arch/mips/lib/Makefile  |  5 -
 arch/mips/lib/ashldi3.c | 28 
 arch/mips/lib/ashrdi3.c | 30 --
 arch/mips/lib/libgcc.h  | 29 -
 arch/mips/lib/lshrdi3.c | 28 
 6 files changed, 3 insertions(+), 120 deletions(-)

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 359f67883c..5dd95b42a7 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -3,6 +3,9 @@
 #
 config MIPS
bool
+   select GENERIC_LIB_ASHLDI3
+   select GENERIC_LIB_ASHRDI3
+   select GENERIC_LIB_LSHRDI3
select HAS_KALLSYMS
select HAVE_CONFIGURABLE_MEMORY_LAYOUT
select HAVE_CONFIGURABLE_TEXT_BASE
diff --git a/arch/mips/lib/Makefile b/arch/mips/lib/Makefile
index d25d0969fc..1a049c7914 100644
--- a/arch/mips/lib/Makefile
+++ b/arch/mips/lib/Makefile
@@ -1,8 +1,5 @@
 extra-$(CONFIG_GENERIC_LINKER_SCRIPT) += barebox.lds
 obj-$(CONFIG_CSRC_R4K_LIB) += csrc-r4k.o
-obj-y += lshrdi3.o
-obj-y += ashldi3.o
-obj-y += ashrdi3.o
 obj-y += cpu-probe.o
 obj-y += traps.o
 obj-y += genex.o
@@ -17,5 +14,3 @@ obj-$(CONFIG_CPU_MIPS64) += c-r4k.o
 
 obj-$(CONFIG_CMD_MIPS_CPUINFO) += cpuinfo.o
 obj-$(CONFIG_CMD_BOOTM)+= bootm.o
-
-pbl-y  += ashldi3.o
diff --git a/arch/mips/lib/ashldi3.c b/arch/mips/lib/ashldi3.c
deleted file mode 100644
index cbdbcbb6a9..00
--- a/arch/mips/lib/ashldi3.c
+++ /dev/null
@@ -1,28 +0,0 @@
-#include 
-
-#include "libgcc.h"
-
-long long __ashldi3(long long u, word_type b)
-{
-   DWunion uu, w;
-   word_type bm;
-
-   if (b == 0)
-   return u;
-
-   uu.ll = u;
-   bm = 32 - b;
-
-   if (bm <= 0) {
-   w.s.low = 0;
-   w.s.high = (unsigned int) uu.s.low << -bm;
-   } else {
-   const unsigned int carries = (unsigned int) uu.s.low >> bm;
-
-   w.s.low = (unsigned int) uu.s.low << b;
-   w.s.high = ((unsigned int) uu.s.high << b) | carries;
-   }
-
-   return w.ll;
-}
-EXPORT_SYMBOL(__ashldi3);
diff --git a/arch/mips/lib/ashrdi3.c b/arch/mips/lib/ashrdi3.c
deleted file mode 100644
index 928d6d97ce..00
--- a/arch/mips/lib/ashrdi3.c
+++ /dev/null
@@ -1,30 +0,0 @@
-#include 
-
-#include "libgcc.h"
-
-long long __ashrdi3(long long u, word_type b)
-{
-   DWunion uu, w;
-   word_type bm;
-
-   if (b == 0)
-   return u;
-
-   uu.ll = u;
-   bm = 32 - b;
-
-   if (bm <= 0) {
-   /* w.s.high = 1..1 or 0..0 */
-   w.s.high =
-   uu.s.high >> 31;
-   w.s.low = uu.s.high >> -bm;
-   } else {
-   const unsigned int carries = (unsigned int) uu.s.high << bm;
-
-   w.s.high = uu.s.high >> b;
-   w.s.low = ((unsigned int) uu.s.low >> b) | carries;
-   }
-
-   return w.ll;
-}
-EXPORT_SYMBOL(__ashrdi3);
diff --git a/arch/mips/lib/libgcc.h b/arch/mips/lib/libgcc.h
deleted file mode 100644
index 593e598022..00
--- a/arch/mips/lib/libgcc.h
+++ /dev/null
@@ -1,29 +0,0 @@
-#ifndef __ASM_LIBGCC_H
-#define __ASM_LIBGCC_H
-
-#include 
-
-typedef int word_type __attribute__ ((mode (__word__)));
-
-#ifdef __BIG_ENDIAN
-struct DWstruct {
-   int high, low;
-};
-#elif defined(__LITTLE_ENDIAN)
-struct DWstruct {
-   int low, high;
-};
-#else
-#error I feel sick.
-#endif
-
-typedef union {
-   struct DWstruct s;
-   long long ll;
-} DWunion;
-
-long long __lshrdi3(long long u, word_type b);
-long long __ashldi3(long long u, word_type b);
-long long __ashrdi3(long long u, word_type b);
-
-#endif /* __ASM_LIBGCC_H */
diff --git a/arch/mips/lib/lshrdi3.c b/arch/mips/lib/lshrdi3.c
deleted file mode 100644
index 74a4846e97..00
--- a/arch/mips/lib/lshrdi3.c
+++ /dev/null
@@ -1,28 +0,0 @@
-#include 
-
-#include "libgcc.h"
-
-long long __lshrdi3(long long u, word_type b)
-{
-   DWunion uu, w;
-   word_type bm;
-
-   if (b == 0)
-   return u;
-
-   uu.ll = u;
-   bm = 32 - b;
-
-   if (bm <= 0) {
-   w.s.high = 0;
-   w.s.low = (unsigned int) uu.s.high >> -bm;
-   } else {
-   const unsigned int carries = (unsigned int) uu.s.high << bm;
-
-   w.s.high = (unsigned int) uu.s.high >> b;
-   w.s.low = ((unsigned int) uu.s.low >> b) | carries;
-   }
-
-   return w.ll;
-}
-EXPORT_SYMBOL(__lshrdi3);
-- 
2.18.0


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


[PATCH v2 08/12] RISC-V: erizo: enable nmon

2018-06-28 Thread Antony Pavlov
Signed-off-by: Antony Pavlov 
---
 arch/riscv/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index f754aef05e..ff0d584761 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -22,6 +22,7 @@ choice
 config MACH_ERIZO
bool "erizo family"
select HAS_DEBUG_LL
+   select HAS_NMON
 
 endchoice
 
-- 
2.18.0


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


[PATCH v2 10/12] RISC-V: add erizo_generic_defconfig

2018-06-28 Thread Antony Pavlov
Signed-off-by: Antony Pavlov 
---
 arch/riscv/configs/erizo_generic_defconfig | 53 ++
 1 file changed, 53 insertions(+)

diff --git a/arch/riscv/configs/erizo_generic_defconfig 
b/arch/riscv/configs/erizo_generic_defconfig
new file mode 100644
index 00..e62b6ec719
--- /dev/null
+++ b/arch/riscv/configs/erizo_generic_defconfig
@@ -0,0 +1,53 @@
+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_AT24=y
+CONFIG_GPIO_GENERIC_PLATFORM=y
+# CONFIG_PINCTRL is not set
+CONFIG_DIGEST_CRC32_GENERIC=y
-- 
2.18.0


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


[PATCH v2 07/12] RISC-V: erizo: add DEBUG_LL support

2018-06-28 Thread Antony Pavlov
Signed-off-by: Antony Pavlov 
---
 arch/riscv/Kconfig|  1 +
 arch/riscv/mach-erizo/include/mach/debug_ll.h | 37 +++
 2 files changed, 38 insertions(+)

diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index d0e934e939..f754aef05e 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -21,6 +21,7 @@ choice
 
 config MACH_ERIZO
bool "erizo family"
+   select HAS_DEBUG_LL
 
 endchoice
 
diff --git a/arch/riscv/mach-erizo/include/mach/debug_ll.h 
b/arch/riscv/mach-erizo/include/mach/debug_ll.h
new file mode 100644
index 00..913b323d99
--- /dev/null
+++ b/arch/riscv/mach-erizo/include/mach/debug_ll.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 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 __MACH_ERIZO_DEBUG_LL__
+#define __MACH_ERIZO_DEBUG_LL__
+
+/** @file
+ *  This File contains declaration for early output support
+ */
+
+#include 
+
+#define DEBUG_LL_UART_ADDR 0x9000
+#define DEBUG_LL_UART_SHIFT2
+#define DEBUG_LL_UART_IOSIZE32
+
+#define DEBUG_LL_UART_CLK   (2400 / 16)
+#define DEBUG_LL_UART_BPS   CONFIG_BAUDRATE
+#define DEBUG_LL_UART_DIVISOR   (DEBUG_LL_UART_CLK / DEBUG_LL_UART_BPS)
+
+#include 
+
+#endif /* __MACH_ERIZO_DEBUG_LL__ */
-- 
2.18.0


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


[PATCH v2 06/12] RISC-V: add nmon nano-monitor

2018-06-28 Thread 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 |   8 +
 arch/riscv/include/asm/riscv_nmon.h | 238 
 3 files changed, 270 insertions(+)

diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index bcca385e14..d0e934e939 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -64,6 +64,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 be3aed1507..de1f18fcb9 100644
--- a/arch/riscv/boot/start.S
+++ b/arch/riscv/boot/start.S
@@ -21,12 +21,20 @@
 
 #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
 
/* copy barebox to link location */
diff --git a/arch/riscv/include/asm/riscv_nmon.h 
b/arch/riscv/include/asm/riscv_nmon.h
new file mode 100644
index 00..ce0d5aeac3
--- /dev/null
+++ b/arch/riscv/include/asm/riscv_nmon.h
@@ -0,0 +1,238 @@
+/*
+ * 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
+
+#ifdef CONFIG_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
+
+   j   nmon_main_help
+
+nmon_cmd_d:
+   jal _nmon_outc_a0
+
+   li  a0, ' '
+   jal _nmon_outc_a0
+
+   jal _nmon_gethexw
+
+   nmon_outs   msg_nl
+
+   lw  a0, (s0)
+   debug_ll_outhexw
+
+   j   nmon_main
+
+nmon_cmd_w:
+   jal _nmon_outc_a0
+
+   li  a0, ' '
+   jal _nmon_outc_a0
+
+   jal _nmon_gethexw
+   moves2, s0
+
+   li  a0, ' '
+   jal _nmon_outc_a0
+   jal _nmon_gethexw
+
+   sw  s0, 0(s2)
+   j   nmon_main
+
+nmon_cmd_g:
+   jal _nmon_outc_a0
+
+   li  a0, ' '
+   jal _nmon_outc_a0
+
+   jal _nmon_gethexw
+   moves2, s0
+
+   nmon_outs   msg_nl
+
+   jalrs2
+   j   nmon_main
+
+_nmon_outc_a0:
+   debug_ll_outc_a0
+   jr  ra
+
+_nmon_outs:
+
+   lb  a0, 0(a1)
+   addia1, a1, 1
+   beqza0, _nmon_jr_ra_exit
+
+   debug_ll_outc_a0
+
+   j   

[PATCH v2 03/12] Add initial RISC-V architecture support

2018-06-28 Thread Antony Pavlov
Signed-off-by: Antony Pavlov 
---
 arch/riscv/Kconfig   | 62 +++
 arch/riscv/Makefile  | 72 ++
 arch/riscv/boot/Makefile |  2 +
 arch/riscv/boot/main_entry.c | 40 +
 arch/riscv/boot/start.S  | 63 
 arch/riscv/dts/.gitignore|  1 +
 arch/riscv/dts/Makefile  |  9 +++
 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   |  6 ++
 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  |  5 ++
 arch/riscv/lib/asm-offsets.c | 12 
 arch/riscv/lib/barebox.lds.S | 89 
 arch/riscv/lib/dtb.c | 41 +
 arch/riscv/lib/riscv_timer.c | 67 +
 drivers/of/Kconfig   |  2 +-
 28 files changed, 636 insertions(+), 1 deletion(-)

diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
new file mode 100644
index 00..8bbe52f232
--- /dev/null
+++ b/arch/riscv/Kconfig
@@ -0,0 +1,62 @@
+config RISCV
+   def_bool y
+   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
+
+config ARCH_TEXT_BASE
+   hex
+   default 0x0
+
+menu "Machine selection"
+
+choice
+   prompt "Base ISA"
+   default ARCH_RV32I
+
+config ARCH_RV32I
+   bool "RV32I"
+   select CPU_SUPPORTS_32BIT_KERNEL
+   select GENERIC_LIB_ASHLDI3
+   select GENERIC_LIB_ASHRDI3
+   select GENERIC_LIB_LSHRDI3
+
+endchoice
+
+config CPU_SUPPORTS_32BIT_KERNEL
+   bool
+
+choice
+   prompt "barebox code model"
+   default 32BIT
+
+config 32BIT
+   bool "32-bit barebox"
+   depends on CPU_SUPPORTS_32BIT_KERNEL
+   help
+ Select this option to build a 32-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 00..e9c407354c
--- /dev/null
+++ b/arch/riscv/Makefile
@@ -0,0 +1,72 @@
+CPPFLAGS += -fno-strict-aliasing
+
+ifeq ($(CONFIG_ARCH_RV32I),y)
+   cflags-y += -march=rv32im
+endif
+
+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
+CPPFLAGS += $(patsubst %,-I$(srctree)/%include,$(machdirs))
+endif
+
+archprepare: maketools
+
+PHONY += maketools
+
+ifneq ($(machine-y),)
+MACH  := arch/riscv/mach-$(machine-y)/
+else
+MACH  :=
+endif
+
+ifneq ($(board-y),)
+BOARD := arch/riscv/boards/$(board-y)/
+else
+BOARD :=
+endif
+
+common-y += $(BOARD) $(MACH)
+common-y += arch/riscv/lib/
+common-y += arch/riscv/boot/
+
+common-$(CONFIG_OFTREE) += arch/riscv/dts/
+
+CPPFLAGS += $(cflags-y)
+CFLAGS += $(cflags-y)
+
+lds-y  := arch/riscv/lib/barebox.lds
+
+CLEAN_FILES += arch/riscv/lib/barebox.lds
diff --git a/arch/riscv/boot/Makefile b/arch/riscv/boot/Makefile
new file mode 100644
index 00..d6d28ce652
--- /dev/null
+++ b/arch/riscv/boot/Makefile
@@ -0,0 +1,2 @@
+obj-y += start.o
+obj-y += main_entry.o
diff --git a/arch/riscv/boot/main_entry.c b/arch/riscv/boot/main_e

[PATCH v2 04/12] RISC-V: add Erizo SoC support

2018-06-28 Thread 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  | 44 ++
 arch/riscv/dts/erizo_generic.dts   | 12 ++
 arch/riscv/mach-erizo/Kconfig  | 11 ++
 arch/riscv/mach-erizo/Makefile |  3 ++
 9 files changed, 114 insertions(+)

diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index 8bbe52f232..bcca385e14 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -15,6 +15,15 @@ config ARCH_TEXT_BASE
 
 menu "Machine selection"
 
+choice
+   prompt "System type"
+   default MACH_ERIZO
+
+config MACH_ERIZO
+   bool "erizo family"
+
+endchoice
+
 choice
prompt "Base ISA"
default ARCH_RV32I
@@ -51,6 +60,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 e9c407354c..9a3921065c 100644
--- a/arch/riscv/Makefile
+++ b/arch/riscv/Makefile
@@ -11,6 +11,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 00..d1165788c9
--- /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 00..dcfc2937d3
--- /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 00..46c9ca34f0
--- /dev/null
+++ b/arch/riscv/boards/erizo-generic/board.c
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 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.
+ *
+ */
+
+#include 
+#include 
+#include 
+
+static int hostname_init(void)
+{
+   barebox_set_hostname("erizo-generic");
+
+   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 00..b7733c3813
--- /dev/null
+++ b/arch/riscv/dts/erizo.dtsi
@@ -0,0 +1,44 @@
+/dts-v1/;
+
+/ {
+   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>,
+   <0x9104 0x4>;
+   #gpio-cells = <2>;
+   gpio-controller;
+   };
+};
diff --git a/arch/riscv/dts/erizo_generic.dts b/arch/riscv/dts/erizo_generic.dts
new file mode 100644
index 00..fae265fd96
--- /dev/null
+++ b/arch/riscv/dts/erizo_generic.dts
@@ -0,0 +1,12 @@
+#include "erizo.dtsi&quo

[PATCH v2 11/12] scripts: add nmon-loader

2018-06-28 Thread Antony Pavlov
Signed-off-by: Antony Pavlov 
---
 scripts/nmon-loader | 31 +++
 1 file changed, 31 insertions(+)

diff --git a/scripts/nmon-loader b/scripts/nmon-loader
new file mode 100755
index 00..d80a53097a
--- /dev/null
+++ b/scripts/nmon-loader
@@ -0,0 +1,31 @@
+#!/usr/bin/expect -f
+
+# device
+set image [lindex $argv 0];
+set modem [lindex $argv 1];
+set speed [lindex $argv 2];
+
+if {$argc != 3} {
+puts "Usage:"
+puts "nmon-loader.expect   "
+exit 2
+}
+
+# keep it open
+exec sh -c "sleep 3 < $modem" &
+
+# serial port parameters
+exec stty -F $modem $speed raw -clocal -echo -istrip -hup
+
+# connect
+send_user "connecting to $modem, exit with ~.\n"
+spawn -open [open $modem w+]
+send_user "connected\n"
+send "\r"
+
+source $image
+
+interact {
+~- exit
+~~ {send "\034"}
+}
-- 
2.18.0


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


[PATCH v2 12/12] Documentation: add RISC-V docs

2018-06-28 Thread Antony Pavlov
Signed-off-by: Antony Pavlov 
---
 Documentation/boards/riscv.rst | 91 ++
 1 file changed, 91 insertions(+)

diff --git a/Documentation/boards/riscv.rst b/Documentation/boards/riscv.rst
new file mode 100644
index 00..1a51d4d44f
--- /dev/null
+++ b/Documentation/boards/riscv.rst
@@ -0,0 +1,91 @@
+RISC-V
+==
+
+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 20180409.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=/riscv32-unknown-elf-
+
+Run barebox::
+
+  $ /riscv32-softmmu/qemu-system-riscv32 \
+  -nographic -M erizo -bios /barebox.bin \
+  -serial stdio -monitor none -trace file=/dev/null
+  Switch to console [cs0]
+  
+  
+  barebox 2018.06.0-00157-g3f41f41593 #0 Thu Jun 17 11:40:43 MSK 2018
+  
+  
+  Board: generic Erizo SoC board
+  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/ttyUSB0 115200
+
+Wait several munutes for 'nmon> ' prompt.
+
+Next, start barebox from DRAM:
+
+  nmon> g 8000
+  Switch to console [cs0]
+  
+  
+  barebox 2018.06.0-00157-g3f41f41593 #0 Thu Jun 17 11:40:43 MSK 2018
+  
+  
+  Board: generic Erizo SoC board
+  malloc space: 0x8010 -> 0x801f (size 1 MiB)
+  running /env/bin/init...
+  /env/bin/init not found
+  barebox:/ 
-- 
2.18.0


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


[PATCH v2 01/12] lib: Add shared copies of some GCC library routines

2018-06-28 Thread Antony Pavlov
This commit is based on these linux kernel commits:

| commit b35cd9884fa5d81c9d5e7f57c9d03264ae2bd835
| Author: Palmer Dabbelt 
| Date:   Tue May 23 10:28:26 2017 -0700
|
| lib: Add shared copies of some GCC library routines
|
| commit e3d5980568fdf83c15a5a3c8ddca1590551ab7a2
| Author: Matt Redfearn 
| Date:   Wed Apr 11 08:50:17 2018 +0100
|
| lib: Rename compiler intrinsic selects to GENERIC_LIB_*

Signed-off-by: Antony Pavlov 
---
 include/lib/libgcc.h | 47 
 lib/Kconfig  |  9 +
 lib/Makefile |  7 +++
 lib/ashldi3.c| 44 +
 lib/ashrdi3.c| 46 +++
 lib/lshrdi3.c| 45 ++
 6 files changed, 198 insertions(+)

diff --git a/include/lib/libgcc.h b/include/lib/libgcc.h
new file mode 100644
index 00..adad27704a
--- /dev/null
+++ b/include/lib/libgcc.h
@@ -0,0 +1,47 @@
+/*
+ * include/lib/libgcc.h
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see the file COPYING, or write
+ * to the Free Software Foundation, Inc.
+ */
+
+#ifndef __LIB_LIBGCC_H
+#define __LIB_LIBGCC_H
+
+#include 
+
+typedef int word_type __attribute__ ((mode (__word__)));
+
+#ifdef __BIG_ENDIAN
+struct DWstruct {
+   int high, low;
+};
+#elif defined(__LITTLE_ENDIAN)
+struct DWstruct {
+   int low, high;
+};
+#else
+#error I feel sick.
+#endif
+
+typedef union {
+   struct DWstruct s;
+   long long ll;
+} DWunion;
+
+long long __lshrdi3(long long u, word_type b);
+long long __ashldi3(long long u, word_type b);
+long long __ashrdi3(long long u, word_type b);
+
+#endif /* __ASM_LIBGCC_H */
diff --git a/lib/Kconfig b/lib/Kconfig
index 3d06655707..860d471de9 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -129,4 +129,13 @@ source lib/bootstrap/Kconfig
 config PRINTF_UUID
bool
 
+config GENERIC_LIB_ASHLDI3
+   bool
+
+config GENERIC_LIB_ASHRDI3
+   bool
+
+config GENERIC_LIB_LSHRDI3
+   bool
+
 endmenu
diff --git a/lib/Makefile b/lib/Makefile
index a7498288af..693945fb2c 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -65,3 +65,10 @@ obj-y+= int_sqrt.o
 obj-y  += parseopt.o
 obj-y  += clz_ctz.o
 obj-$(CONFIG_CRC_CCITT) += crc-ccitt.o
+
+# GCC library routines
+obj-$(CONFIG_GENERIC_LIB_ASHLDI3) += ashldi3.o
+obj-$(CONFIG_GENERIC_LIB_ASHRDI3) += ashrdi3.o
+obj-$(CONFIG_GENERIC_LIB_LSHRDI3) += lshrdi3.o
+
+pbl-$(CONFIG_GENERIC_LIB_ASHLDI3) += ashldi3.o
diff --git a/lib/ashldi3.c b/lib/ashldi3.c
new file mode 100644
index 00..308464a788
--- /dev/null
+++ b/lib/ashldi3.c
@@ -0,0 +1,44 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see the file COPYING, or write
+ * to the Free Software Foundation, Inc.
+ */
+
+#include 
+
+#include 
+
+long long notrace __ashldi3(long long u, word_type b)
+{
+   DWunion uu, w;
+   word_type bm;
+
+   if (b == 0)
+   return u;
+
+   uu.ll = u;
+   bm = 32 - b;
+
+   if (bm <= 0) {
+   w.s.low = 0;
+   w.s.high = (unsigned int) uu.s.low << -bm;
+   } else {
+   const unsigned int carries = (unsigned int) uu.s.low >> bm;
+
+   w.s.low = (unsigned int) uu.s.low << b;
+   w.s.high = ((unsigned int) uu.s.high << b) | carries;
+   }
+
+   return w.ll;
+}
+EXPORT_SYMBOL(__ashldi3);
diff --git a/lib/ashrdi3.c b/lib/ashrdi3.c
new file mode 100644
index 00..a55ad5289d
--- /dev/null
+++ b/lib/ashrdi3.c
@@ -0,0 +1,46 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, 

[PATCH v2 00/12] Add initial RISC-V architecture support

2018-06-28 Thread Antony Pavlov
This patchseries adds initial RISC-V architecture support for barebox.

See Documentation/boards/riscv.rst for instructions.

You can obtain this patchseries from github:

$ git clone -b 20180628.riscv https://github.com/frantony/barebox

Changes since PATCH v1 (20170415)
(http://lists.infradead.org/pipermail/barebox/2018-April/032647.html)

* drop skeleton.dtsi;
* drop SPI GPIO bindings for erizo_generic;
* improve erizo-nmon-image;
* generic linker script is dropped;
* use generic GCC library routines from lib.

Changes since RFC v4 (20170927)
(http://lists.infradead.org/pipermail/barebox/2017-September/031226.html)

* drop 64-bit support;
* sync with RISC-V linux;
* RISC-V in barebox now is little endian only;
* fix according to notes by Oleksij Rempel.

Changes since RFC v3 (20161212)
(http://lists.infradead.org/pipermail/barebox/2016-December/028716.html)

* drop SiFive support, add support for custom Erizo SoC;
* barebox runs on real hardware (e.g. DE0-Nano FPGA board,
  see https://github.com/miet-riscv-workgroup/rv32-simple-soc for
details);
* introduce NMON for RISC-V;
* add relocator to start.S.

Changes since RFC v2 (20161113)
(http://lists.infradead.org/pipermail/barebox/2016-November/028533.html):

* add RV32 support.

Changes since RFC v1 (20161013)
(http://lists.infradead.org/pipermail/barebox/2016-October/028309.html):

* drop spike pk support;
* add qemu-sifive board support;
* add Documentation/boards/riscv.rst;
* fix guard macro names.

Antony Pavlov (12):
  lib: Add shared copies of some GCC library routines
  MIPS: Use generic GCC library routines from lib/
  Add initial RISC-V architecture support
  RISC-V: add Erizo SoC support
  RISC-V: add low-level debug macros for ns16550
  RISC-V: add nmon nano-monitor
  RISC-V: erizo: add DEBUG_LL support
  RISC-V: erizo: enable nmon
  RISC-V: erizo: add nmon image creation
  RISC-V: add erizo_generic_defconfig
  scripts: add nmon-loader
  Documentation: add RISC-V docs

 Documentation/boards/riscv.rst|  91 +++
 arch/mips/Kconfig |   3 +
 arch/mips/lib/Makefile|   5 -
 arch/mips/lib/ashldi3.c   |  28 ---
 arch/mips/lib/ashrdi3.c   |  30 ---
 arch/mips/lib/libgcc.h|  29 ---
 arch/mips/lib/lshrdi3.c   |  28 ---
 arch/riscv/Kconfig|  99 
 arch/riscv/Makefile   |  86 +++
 arch/riscv/boards/erizo-generic/.gitignore|   1 +
 arch/riscv/boards/erizo-generic/Makefile  |   1 +
 arch/riscv/boards/erizo-generic/board.c   |  28 +++
 arch/riscv/boot/Makefile  |   2 +
 arch/riscv/boot/main_entry.c  |  40 +++
 arch/riscv/boot/start.S   |  71 ++
 arch/riscv/configs/erizo_generic_defconfig|  53 
 arch/riscv/dts/.gitignore |   1 +
 arch/riscv/dts/Makefile   |   9 +
 arch/riscv/dts/erizo.dtsi |  44 
 arch/riscv/dts/erizo_generic.dts  |  12 +
 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|   6 +
 arch/riscv/include/asm/common.h   |   6 +
 arch/riscv/include/asm/debug_ll_ns16550.h | 186 ++
 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/riscv_nmon.h   | 238 ++
 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   |   5 +
 arch/riscv/lib/asm-offsets.c  |  12 +
 arch/riscv/lib/barebox.lds.S  |  89 +++
 arch/riscv/lib/dtb.c  |  41 +++
 arch/riscv/lib/riscv_timer.c  |  67 +
 arch/riscv/mach-erizo/Kconfig |  11 +
 arch/riscv/mach-erizo/Makefile|   3 +
 arch/riscv/mach-erizo/include/mach/debug_ll.h |  37 +++
 drivers/of/Kconfig|   2 +-
 include/lib/libgcc.h  |  47 
 lib/Kconfig   |   9 +
 lib/Makefile  |   7 +
 lib/ashldi3.c |  44 
 lib/ashrdi3.c |  46 
 lib/lshrdi3.c

[PATCH v2 05/12] RISC-V: add low-level debug macros for ns16550

2018-06-28 Thread Antony Pavlov
This patch adds macros for ns16550 port initialization
and single char output. The macros can be used in
MIPS asm pbl code.

Signed-off-by: Antony Pavlov 
---
 arch/riscv/include/asm/debug_ll_ns16550.h | 186 ++
 1 file changed, 186 insertions(+)

diff --git a/arch/riscv/include/asm/debug_ll_ns16550.h 
b/arch/riscv/include/asm/debug_ll_ns16550.h
new file mode 100644
index 00..6929453b1e
--- /dev/null
+++ b/arch/riscv/include/asm/debug_ll_ns16550.h
@@ -0,0 +1,186 @@
+/*
+ * 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.
+ *
+ */
+
+/** @file
+ *  This file contains declaration for early output support
+ */
+#ifndef __INCLUDE_RISCV_ASM_DEBUG_LL_NS16550_H__
+#define __INCLUDE_RISCV_ASM_DEBUG_LL_NS16550_H__
+
+#include 
+
+#ifdef CONFIG_DEBUG_LL
+
+#ifndef DEBUG_LL_UART_ADDR
+#error DEBUG_LL_UART_ADDR is undefined!
+#endif
+
+#ifndef DEBUG_LL_UART_SHIFT
+#error DEBUG_LL_UART_SHIFT is undefined!
+#endif
+
+#ifndef DEBUG_LL_UART_DIVISOR
+#error DEBUG_LL_UART_DIVISOR is undefined!
+#endif
+
+#endif /* CONFIG_DEBUG_LL */
+
+#define UART_THR   (0x0 << DEBUG_LL_UART_SHIFT)
+#define UART_RBR   (0x0 << DEBUG_LL_UART_SHIFT)
+#define UART_DLL   (0x0 << DEBUG_LL_UART_SHIFT)
+#define UART_DLM   (0x1 << DEBUG_LL_UART_SHIFT)
+#define UART_LCR   (0x3 << DEBUG_LL_UART_SHIFT)
+#define UART_LSR   (0x5 << DEBUG_LL_UART_SHIFT)
+
+#define UART_LCR_W 0x07/* Set UART to 8,N,2 & DLAB = 0 */
+#define UART_LCR_DLAB  0x87/* Set UART to 8,N,2 & DLAB = 1 */
+
+#define UART_LSR_DR0x01/* UART received data present */
+#define UART_LSR_THRE  0x20/* Xmit holding register empty */
+
+#if defined(DEBUG_LL_UART_IOSIZE32)
+#define UART_REG_L lw
+#define UART_REG_S sw
+#elif defined(DEBUG_LL_UART_IOSIZE8)
+#define UART_REG_L lbu
+#define UART_REG_S sb
+#else
+#error "Please define DEBUG_LL_UART_IOSIZE{8,32}"
+#endif
+
+#ifndef __ASSEMBLY__
+/*
+ * C macros
+ */
+
+#include 
+
+static inline void PUTC_LL(char ch)
+{
+#ifdef CONFIG_DEBUG_LL
+   while (!(__raw_readl((u8 *)DEBUG_LL_UART_ADDR + UART_LSR) & 
UART_LSR_THRE))
+   ;
+   __raw_writel(ch, (u8 *)DEBUG_LL_UART_ADDR + UART_THR);
+#endif /* CONFIG_DEBUG_LL */
+}
+
+static inline void debug_ll_ns16550_init(void)
+{
+#ifdef CONFIG_DEBUG_LL
+   __raw_writel(UART_LCR_DLAB, (u8 *)DEBUG_LL_UART_ADDR + UART_LCR);
+   __raw_writel(DEBUG_LL_UART_DIVISOR & 0xff, (u8 *)DEBUG_LL_UART_ADDR + 
UART_DLL);
+   __raw_writel((DEBUG_LL_UART_DIVISOR >> 8) & 0xff, (u8 
*)DEBUG_LL_UART_ADDR + UART_DLM);
+   __raw_writel(UART_LCR_W, (u8 *)DEBUG_LL_UART_ADDR + UART_LCR);
+#endif /* CONFIG_DEBUG_LL */
+}
+#else /* __ASSEMBLY__ */
+/*
+ * Macros for use in assembly language code
+ */
+
+.macro debug_ll_ns16550_init
+#ifdef CONFIG_DEBUG_LL
+   li  t0, DEBUG_LL_UART_ADDR
+
+   li  t1, UART_LCR_DLAB   /* DLAB on */
+   UART_REG_S  t1, UART_LCR(t0)/* Write it out */
+
+   li  t1, DEBUG_LL_UART_DIVISOR
+   UART_REG_S  t1, UART_DLL(t0)/* write low order byte 
*/
+   srl t1, t1, 8
+   UART_REG_S  t1, UART_DLM(t0)/* write high order 
byte */
+
+   li  t1, UART_LCR_W  /* DLAB off */
+   UART_REG_S  t1, UART_LCR(t0)/* Write it out */
+#endif /* CONFIG_DEBUG_LL */
+.endm
+
+/*
+ * output a character in a0
+ */
+.macro debug_ll_outc_a0
+#ifdef CONFIG_DEBUG_LL
+
+   li  t0, DEBUG_LL_UART_ADDR
+
+201:
+   UART_REG_L  t1, UART_LSR(t0)/* get line status */
+   andit1, t1, UART_LSR_THRE   /* check for transmitter empty */
+   beqzt1, 201b/* try again */
+
+   UART_REG_S  a0, UART_THR(t0)/* write the character */
+
+#endif /* CONFIG_DEBUG_LL */
+.endm
+
+/*
+ * output a character
+ */
+.macro debug_ll_outc chr
+#ifdef CONFIG_DEBUG_LL
+   li  a0, \chr
+   debug_ll_outc_a0
+#endif /* CONFIG_DEBUG_LL */
+.endm
+
+/*
+ * output CR + NL
+ */
+.macro debug_ll_ns16550_outnl
+#ifdef CONFIG_DEBUG_LL
+   debug_ll_outc '\r'
+   debug_ll_outc '\n'
+#endif /* CONFIG_DEBUG_LL */
+.endm
+
+/*
+ * check character in input buffer
+ * return value:
+ *  v0 = 0   no character in input buffer
+ *  v0 != 0  character in input buffer
+ */
+.macro debu

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

2018-06-25 Thread Antony Pavlov
On Tue, 17 Apr 2018 08:22:55 +0200
Sascha Hauer  wrote:

> Hi Antony,
> 
> On Sun, Apr 15, 2018 at 02:28:49PM +0300, Antony Pavlov wrote:
> > Signed-off-by: Antony Pavlov 
> > ---
> > diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
> > new file mode 100644
> > index 00..d65e87acd8
> > --- /dev/null
> > +++ b/arch/riscv/Kconfig
> > @@ -0,0 +1,62 @@
> > +config RISCV
> > +   def_bool y
> > +   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
> > +
> > +config ARCH_TEXT_BASE
> > +   hex
> > +   default 0x0
> > +
> > +config GENERIC_LINKER_SCRIPT
> > +   def_bool y
> 
> Do we need this? The linker script should be universal enough to be used
> by all boards.

I have dropped it in v2 RISC-V patchseries.

> > diff --git a/arch/riscv/dts/skeleton.dtsi b/arch/riscv/dts/skeleton.dtsi
> > new file mode 100644
> > index 00..38ead821bb
> > --- /dev/null
> > +++ b/arch/riscv/dts/skeleton.dtsi
> > @@ -0,0 +1,13 @@
> > +/*
> > + * Skeleton device tree; the bare minimum needed to boot; just include and
> > + * add a compatible value.  The bootloader will typically populate the 
> > memory
> > + * node.
> > + */
> > +
> > +/ {
> > +   #address-cells = <2>;
> > +   #size-cells = <1>;
> > +   chosen { };
> > +   aliases { };
> > +   memory { device_type = "memory"; reg = <0 0 0>; };
> > +};
> 
> skeleton.dtsi should no longer be used. For example we should now have
> memory@adr {}; instead of memory {};. Since "adr" is board/SoC specific
> we can't put it in a generic file.

I have dropped skeleton.dtsi in the v2 RISC-V patchseries.

I have even submitted patches for MIPS, please review.

> 
> > diff --git a/arch/riscv/lib/ashldi3.c b/arch/riscv/lib/ashldi3.c
> > new file mode 100644
> > index 00..cbdbcbb6a9
> > --- /dev/null
> > +++ b/arch/riscv/lib/ashldi3.c
> > @@ -0,0 +1,28 @@
> > +#include 
> > +
> > +#include "libgcc.h"
> > +
> > +long long __ashldi3(long long u, word_type b)
> > +{
> 
> Can we have generic C variants for these files? The Kernel has these
> symbols in lib/ and they can be selected by "select GENERIC_ASHLDI3"

I know about this problem. I have even made a patch for linux kernel for MIPS:

  [PATCH v3 2/2] MIPS: use generic GCC library routines from lib/
  https://www.mail-archive.com/linux-kernel@vger.kernel.org/msg1599191.html

During this MIPS patch discussion it has become evident that Kconfig GENERIC_
prefix has to be changed to GENERIC_LIB_.

This morning I found that the patch 

  [PATCH] lib: Rename compiler intrinsic selects to GENERIC_LIB_*
  https://patchwork.kernel.org/patch/10335017/

has been merged by Linus almost two weeks ago.

So I can prepare corresponding generic GCC functions barebox patchseries
(it will be useful for MIPS). Next I shall submit RISC-V v2 patchseries.
RISC-V will use generic GCC functions from lib/ too.

-- 
Best regards,
  Antony Pavlov

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


[PATCH v2 1/2] MIPS: dts: drop skeleton.dtsi

2018-06-21 Thread Antony Pavlov
Based on feedback from Sascha:

http://lists.infradead.org/pipermail/barebox/2018-April/032694.html
"
skeleton.dtsi should no longer be used
"

Several reasons to remove skeleton.dtsi are explained in
the linux commit 3ebee5a2e141 ("arm64: dts: kill skeleton.dtsi").

Signed-off-by: Antony Pavlov 
---
 arch/mips/dts/dlink-dir-320.dts |  6 --
 arch/mips/dts/jz4755.dtsi   |  5 +++--
 arch/mips/dts/jz4780.dtsi   |  5 +++--
 arch/mips/dts/loongson-ls1b.dts |  1 +
 arch/mips/dts/ls1b.dtsi |  5 +++--
 arch/mips/dts/qemu-malta.dts|  6 --
 arch/mips/dts/rzx50.dts |  1 +
 arch/mips/dts/skeleton.dtsi | 13 -
 8 files changed, 19 insertions(+), 23 deletions(-)

diff --git a/arch/mips/dts/dlink-dir-320.dts b/arch/mips/dts/dlink-dir-320.dts
index b961c9dca3..966c9b362d 100644
--- a/arch/mips/dts/dlink-dir-320.dts
+++ b/arch/mips/dts/dlink-dir-320.dts
@@ -1,12 +1,14 @@
 /dts-v1/;
 
-#include "skeleton.dtsi"
-
 / {
model = "D-Link DIR-320";
compatible = "dlink,dir320";
 
+   #address-cells = <1>;
+   #size-cells = <1>;
+
memory {
+   device_type = "memory";
reg = <0x 0x200>;
};
 
diff --git a/arch/mips/dts/jz4755.dtsi b/arch/mips/dts/jz4755.dtsi
index 137156df7e..5d929c5d83 100644
--- a/arch/mips/dts/jz4755.dtsi
+++ b/arch/mips/dts/jz4755.dtsi
@@ -1,6 +1,7 @@
-#include "skeleton.dtsi"
-
 / {
+   #address-cells = <1>;
+   #size-cells = <1>;
+
soc {
compatible = "simple-bus";
model = "Ingenic JZ4755";
diff --git a/arch/mips/dts/jz4780.dtsi b/arch/mips/dts/jz4780.dtsi
index 9f0de5d1ae..fbffe814bb 100644
--- a/arch/mips/dts/jz4780.dtsi
+++ b/arch/mips/dts/jz4780.dtsi
@@ -1,6 +1,7 @@
-#include "skeleton.dtsi"
-
 / {
+   #address-cells = <1>;
+   #size-cells = <1>;
+
soc {
model = "Ingenic JZ4780";
#address-cells = <1>;
diff --git a/arch/mips/dts/loongson-ls1b.dts b/arch/mips/dts/loongson-ls1b.dts
index b81a951dc7..61e9a2d2aa 100644
--- a/arch/mips/dts/loongson-ls1b.dts
+++ b/arch/mips/dts/loongson-ls1b.dts
@@ -7,6 +7,7 @@
compatible = "loongson,ls1b";
 
memory {
+   device_type = "memory";
reg = <0x 0x400>;
};
 };
diff --git a/arch/mips/dts/ls1b.dtsi b/arch/mips/dts/ls1b.dtsi
index af7119f1d0..cb85814af4 100644
--- a/arch/mips/dts/ls1b.dtsi
+++ b/arch/mips/dts/ls1b.dtsi
@@ -1,6 +1,7 @@
-#include "skeleton.dtsi"
-
 / {
+   #address-cells = <1>;
+   #size-cells = <1>;
+
soc {
#address-cells = <1>;
#size-cells = <1>;
diff --git a/arch/mips/dts/qemu-malta.dts b/arch/mips/dts/qemu-malta.dts
index 9b0c594e87..546b129f85 100644
--- a/arch/mips/dts/qemu-malta.dts
+++ b/arch/mips/dts/qemu-malta.dts
@@ -1,11 +1,12 @@
 /dts-v1/;
 
-/include/ "skeleton.dtsi"
-
 / {
model = "qemu malta";
compatible = "qemu,malta";
 
+   #address-cells = <1>;
+   #size-cells = <1>;
+
chosen {
environment@0 {
compatible = "barebox,environment";
@@ -14,6 +15,7 @@
};
 
memory {
+   device_type = "memory";
reg = <0x 0x1000>;
};
 
diff --git a/arch/mips/dts/rzx50.dts b/arch/mips/dts/rzx50.dts
index 7ec3352666..2896cbae82 100644
--- a/arch/mips/dts/rzx50.dts
+++ b/arch/mips/dts/rzx50.dts
@@ -7,6 +7,7 @@
compatible = "ritmix,rzx50";
 
memory {
+   device_type = "memory";
reg = <0x 0x400>;
};
 
diff --git a/arch/mips/dts/skeleton.dtsi b/arch/mips/dts/skeleton.dtsi
deleted file mode 100644
index b41d241de2..00
--- a/arch/mips/dts/skeleton.dtsi
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
- * Skeleton device tree; the bare minimum needed to boot; just include and
- * add a compatible value.  The bootloader will typically populate the memory
- * node.
- */
-
-/ {
-   #address-cells = <1>;
-   #size-cells = <1>;
-   chosen { };
-   aliases { };
-   memory { device_type = "memory"; reg = <0 0>; };
-};
-- 
2.17.0


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


[PATCH v2 2/2] MIPS: dts: fix dtc unit_address_vs_reg warning

2018-06-21 Thread Antony Pavlov
Unit number is added to the /memory nodes to fix this dtc warning:

Warning (unit_address_vs_reg): /memory: node has a reg or ranges
property, but no unit name

Signed-off-by: Antony Pavlov 
---
 arch/mips/dts/dlink-dir-320.dts | 2 +-
 arch/mips/dts/img-ci20.dts  | 2 +-
 arch/mips/dts/loongson-ls1b.dts | 2 +-
 arch/mips/dts/qemu-malta.dts| 2 +-
 arch/mips/dts/rzx50.dts | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/mips/dts/dlink-dir-320.dts b/arch/mips/dts/dlink-dir-320.dts
index 966c9b362d..d19c3087d0 100644
--- a/arch/mips/dts/dlink-dir-320.dts
+++ b/arch/mips/dts/dlink-dir-320.dts
@@ -7,7 +7,7 @@
#address-cells = <1>;
#size-cells = <1>;
 
-   memory {
+   memory@0 {
device_type = "memory";
reg = <0x 0x200>;
};
diff --git a/arch/mips/dts/img-ci20.dts b/arch/mips/dts/img-ci20.dts
index da2a5bf625..d985666020 100644
--- a/arch/mips/dts/img-ci20.dts
+++ b/arch/mips/dts/img-ci20.dts
@@ -24,7 +24,7 @@
model = "MIPS Creator CI20";
compatible = "img,ci20";
 
-   memory {
+   memory@0 {
device_type = "memory";
reg = <0x0 0x1000>;
};
diff --git a/arch/mips/dts/loongson-ls1b.dts b/arch/mips/dts/loongson-ls1b.dts
index 61e9a2d2aa..6b53311982 100644
--- a/arch/mips/dts/loongson-ls1b.dts
+++ b/arch/mips/dts/loongson-ls1b.dts
@@ -6,7 +6,7 @@
model = "Loongson Tech LS1B Demo Board";
compatible = "loongson,ls1b";
 
-   memory {
+   memory@0 {
device_type = "memory";
reg = <0x 0x400>;
};
diff --git a/arch/mips/dts/qemu-malta.dts b/arch/mips/dts/qemu-malta.dts
index 546b129f85..9772d49eb3 100644
--- a/arch/mips/dts/qemu-malta.dts
+++ b/arch/mips/dts/qemu-malta.dts
@@ -14,7 +14,7 @@
};
};
 
-   memory {
+   memory@0 {
device_type = "memory";
reg = <0x 0x1000>;
};
diff --git a/arch/mips/dts/rzx50.dts b/arch/mips/dts/rzx50.dts
index 2896cbae82..bd3631f7c4 100644
--- a/arch/mips/dts/rzx50.dts
+++ b/arch/mips/dts/rzx50.dts
@@ -6,7 +6,7 @@
model = "Ritmix RZX-50";
compatible = "ritmix,rzx50";
 
-   memory {
+   memory@0 {
device_type = "memory";
reg = <0x 0x400>;
};
-- 
2.17.0


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


[PATCH v2 0/2] MIPS: dts: drop skeleton.dtsi

2018-06-21 Thread Antony Pavlov
Changes since v1 patchseries:

  * add `device_type = "memory";` to the memory node;
  * split patch.

Antony Pavlov (2):
  MIPS: dts: drop skeleton.dtsi
  MIPS: dts: fix dtc unit_address_vs_reg warning

 arch/mips/dts/dlink-dir-320.dts |  8 +---
 arch/mips/dts/img-ci20.dts  |  2 +-
 arch/mips/dts/jz4755.dtsi   |  5 +++--
 arch/mips/dts/jz4780.dtsi   |  5 +++--
 arch/mips/dts/loongson-ls1b.dts |  3 ++-
 arch/mips/dts/ls1b.dtsi |  5 +++--
 arch/mips/dts/qemu-malta.dts|  8 +---
 arch/mips/dts/rzx50.dts |  3 ++-
 arch/mips/dts/skeleton.dtsi | 13 -
 9 files changed, 24 insertions(+), 28 deletions(-)
 delete mode 100644 arch/mips/dts/skeleton.dtsi

-- 
2.17.0


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


Re: [PATCH] MIPS: dts: drop skeleton.dtsi

2018-06-20 Thread Antony Pavlov
On Tue, 19 Jun 2018 20:14:33 +0300
Antony Pavlov  wrote:

Hi, Sascha!

Please ignore this patch.

I have to add `device_type = "memory";` to memory nodes.

Also I'm planning to move #address-cells and #size-cells definitions to a 
separate patch.

> Based on feedback from Sascha:
> 
> http://lists.infradead.org/pipermail/barebox/2018-April/032694.html
> "
> skeleton.dtsi should no longer be used
> "
> 
> Several reasons to remove skeleton.dtsi ares explained in
> the linux commit 3ebee5a2e141 ("arm64: dts: kill skeleton.dtsi").
> 
> Unit number is added to the /memory nodes to fix this dtc warning:
> 
>   Warning (unit_address_vs_reg): /memory: node has a reg or ranges
>   property, but no unit name
> 
> Also this commit adds #address-cells and #size-cells definitions
> to board and SoC dts file to avoid dtc warning, e.g.
> 
>   Warning (avoid_default_addr_size): /memory@0: Relying on default
>   #address-cells value
> 
> Signed-off-by: Antony Pavlov 
> ---
>  arch/mips/dts/dlink-dir-320.dts |  7 ---
>  arch/mips/dts/img-ci20.dts  |  2 +-
>  arch/mips/dts/jz4755.dtsi   |  5 +++--
>  arch/mips/dts/jz4780.dtsi   |  5 +++--
>  arch/mips/dts/loongson-ls1b.dts |  2 +-
>  arch/mips/dts/ls1b.dtsi |  5 +++--
>  arch/mips/dts/qemu-malta.dts|  7 ---
>  arch/mips/dts/rzx50.dts |  2 +-
>  arch/mips/dts/skeleton.dtsi | 13 -
>  9 files changed, 20 insertions(+), 28 deletions(-)
> 
> diff --git a/arch/mips/dts/dlink-dir-320.dts b/arch/mips/dts/dlink-dir-320.dts
> index b961c9dca3..e21700637f 100644
> --- a/arch/mips/dts/dlink-dir-320.dts
> +++ b/arch/mips/dts/dlink-dir-320.dts
> @@ -1,12 +1,13 @@
>  /dts-v1/;
>  
> -#include "skeleton.dtsi"
> -
>  / {
>   model = "D-Link DIR-320";
>   compatible = "dlink,dir320";
>  
> - memory {
> + #address-cells = <1>;
> + #size-cells = <1>;
> +
> + memory@0 {
>   reg = <0x 0x200>;
>   };
>  
> diff --git a/arch/mips/dts/img-ci20.dts b/arch/mips/dts/img-ci20.dts
> index da2a5bf625..d985666020 100644
> --- a/arch/mips/dts/img-ci20.dts
> +++ b/arch/mips/dts/img-ci20.dts
> @@ -24,7 +24,7 @@
>   model = "MIPS Creator CI20";
>   compatible = "img,ci20";
>  
> - memory {
> + memory@0 {
>   device_type = "memory";
>   reg = <0x0 0x1000>;
>   };
> diff --git a/arch/mips/dts/jz4755.dtsi b/arch/mips/dts/jz4755.dtsi
> index 137156df7e..5d929c5d83 100644
> --- a/arch/mips/dts/jz4755.dtsi
> +++ b/arch/mips/dts/jz4755.dtsi
> @@ -1,6 +1,7 @@
> -#include "skeleton.dtsi"
> -
>  / {
> + #address-cells = <1>;
> + #size-cells = <1>;
> +
>   soc {
>   compatible = "simple-bus";
>   model = "Ingenic JZ4755";
> diff --git a/arch/mips/dts/jz4780.dtsi b/arch/mips/dts/jz4780.dtsi
> index 9f0de5d1ae..fbffe814bb 100644
> --- a/arch/mips/dts/jz4780.dtsi
> +++ b/arch/mips/dts/jz4780.dtsi
> @@ -1,6 +1,7 @@
> -#include "skeleton.dtsi"
> -
>  / {
> + #address-cells = <1>;
> + #size-cells = <1>;
> +
>   soc {
>   model = "Ingenic JZ4780";
>   #address-cells = <1>;
> diff --git a/arch/mips/dts/loongson-ls1b.dts b/arch/mips/dts/loongson-ls1b.dts
> index b81a951dc7..39e44eba35 100644
> --- a/arch/mips/dts/loongson-ls1b.dts
> +++ b/arch/mips/dts/loongson-ls1b.dts
> @@ -6,7 +6,7 @@
>   model = "Loongson Tech LS1B Demo Board";
>   compatible = "loongson,ls1b";
>  
> - memory {
> + memory@0 {
>   reg = <0x 0x400>;
>   };
>  };
> diff --git a/arch/mips/dts/ls1b.dtsi b/arch/mips/dts/ls1b.dtsi
> index af7119f1d0..cb85814af4 100644
> --- a/arch/mips/dts/ls1b.dtsi
> +++ b/arch/mips/dts/ls1b.dtsi
> @@ -1,6 +1,7 @@
> -#include "skeleton.dtsi"
> -
>  / {
> + #address-cells = <1>;
> + #size-cells = <1>;
> +
>   soc {
>   #address-cells = <1>;
>   #size-cells = <1>;
> diff --git a/arch/mips/dts/qemu-malta.dts b/arch/mips/dts/qemu-malta.dts
> index 9b0c594e87..0311baed41 100644
> --- a/arch/mips/dts/qemu-malta.dts
> +++ b/arch/mips/dts/qemu-malta.dts
> @@ -1,11 +1,12 @@
>  /dts-v1/;
>  
> -/include/ "skeleton.dtsi"
> -
>  / {
>   model = "qemu malta";
>   compatible = "qemu,malta";
>  
> + #address-cells = <1>;
> 

Re: [PATCH] MIPS: dts: drop skeleton.dtsi

2018-06-20 Thread Antony Pavlov
On Tue, 19 Jun 2018 19:46:38 +0200
Oleksij Rempel  wrote:

> Tested-by Oleksij Rempel 
> 
> on dpt board.

Have you tried to boot linux?


> 
> Am 19.06.2018 um 19:14 schrieb Antony Pavlov:
> > Based on feedback from Sascha:
> > 
> > http://lists.infradead.org/pipermail/barebox/2018-April/032694.html
> > "
> > skeleton.dtsi should no longer be used
> > "
> > 
> > Several reasons to remove skeleton.dtsi ares explained in
> > the linux commit 3ebee5a2e141 ("arm64: dts: kill skeleton.dtsi").
> > 
> > Unit number is added to the /memory nodes to fix this dtc warning:
> > 
> >   Warning (unit_address_vs_reg): /memory: node has a reg or ranges
> >   property, but no unit name
> > 
> > Also this commit adds #address-cells and #size-cells definitions
> > to board and SoC dts file to avoid dtc warning, e.g.
> > 
> >   Warning (avoid_default_addr_size): /memory@0: Relying on default
> >   #address-cells value
> > 
> > Signed-off-by: Antony Pavlov 
> > ---
> >  arch/mips/dts/dlink-dir-320.dts |  7 ---
> >  arch/mips/dts/img-ci20.dts  |  2 +-
> >  arch/mips/dts/jz4755.dtsi   |  5 +++--
> >  arch/mips/dts/jz4780.dtsi   |  5 +++--
> >  arch/mips/dts/loongson-ls1b.dts |  2 +-
> >  arch/mips/dts/ls1b.dtsi |  5 +++--
> >  arch/mips/dts/qemu-malta.dts|  7 ---
> >  arch/mips/dts/rzx50.dts |  2 +-
> >  arch/mips/dts/skeleton.dtsi | 13 -
> >  9 files changed, 20 insertions(+), 28 deletions(-)
> > 
> > diff --git a/arch/mips/dts/dlink-dir-320.dts 
> > b/arch/mips/dts/dlink-dir-320.dts
> > index b961c9dca3..e21700637f 100644
> > --- a/arch/mips/dts/dlink-dir-320.dts
> > +++ b/arch/mips/dts/dlink-dir-320.dts
> > @@ -1,12 +1,13 @@
> >  /dts-v1/;
> >  
> > -#include "skeleton.dtsi"
> > -
> >  / {
> > model = "D-Link DIR-320";
> > compatible = "dlink,dir320";
> >  
> > -   memory {
> > +   #address-cells = <1>;
> > +   #size-cells = <1>;
> > +
> > +   memory@0 {
> > reg = <0x 0x200>;
> > };
> >  
> > diff --git a/arch/mips/dts/img-ci20.dts b/arch/mips/dts/img-ci20.dts
> > index da2a5bf625..d985666020 100644
> > --- a/arch/mips/dts/img-ci20.dts
> > +++ b/arch/mips/dts/img-ci20.dts
> > @@ -24,7 +24,7 @@
> > model = "MIPS Creator CI20";
> > compatible = "img,ci20";
> >  
> > -   memory {
> > +   memory@0 {
> > device_type = "memory";
> > reg = <0x0 0x1000>;
> > };
> > diff --git a/arch/mips/dts/jz4755.dtsi b/arch/mips/dts/jz4755.dtsi
> > index 137156df7e..5d929c5d83 100644
> > --- a/arch/mips/dts/jz4755.dtsi
> > +++ b/arch/mips/dts/jz4755.dtsi
> > @@ -1,6 +1,7 @@
> > -#include "skeleton.dtsi"
> > -
> >  / {
> > +   #address-cells = <1>;
> > +   #size-cells = <1>;
> > +
> > soc {
> > compatible = "simple-bus";
> > model = "Ingenic JZ4755";
> > diff --git a/arch/mips/dts/jz4780.dtsi b/arch/mips/dts/jz4780.dtsi
> > index 9f0de5d1ae..fbffe814bb 100644
> > --- a/arch/mips/dts/jz4780.dtsi
> > +++ b/arch/mips/dts/jz4780.dtsi
> > @@ -1,6 +1,7 @@
> > -#include "skeleton.dtsi"
> > -
> >  / {
> > +   #address-cells = <1>;
> > +   #size-cells = <1>;
> > +
> > soc {
> > model = "Ingenic JZ4780";
> > #address-cells = <1>;
> > diff --git a/arch/mips/dts/loongson-ls1b.dts 
> > b/arch/mips/dts/loongson-ls1b.dts
> > index b81a951dc7..39e44eba35 100644
> > --- a/arch/mips/dts/loongson-ls1b.dts
> > +++ b/arch/mips/dts/loongson-ls1b.dts
> > @@ -6,7 +6,7 @@
> > model = "Loongson Tech LS1B Demo Board";
> > compatible = "loongson,ls1b";
> >  
> > -   memory {
> > +   memory@0 {
> > reg = <0x 0x400>;
> > };
> >  };
> > diff --git a/arch/mips/dts/ls1b.dtsi b/arch/mips/dts/ls1b.dtsi
> > index af7119f1d0..cb85814af4 100644
> > --- a/arch/mips/dts/ls1b.dtsi
> > +++ b/arch/mips/dts/ls1b.dtsi
> > @@ -1,6 +1,7 @@
> > -#include "skeleton.dtsi"
> > -
> >  / {
> > +   #address-cells = <1>;
> > +   #size-cells = <1>;
> > +
> > soc {
> > #addres

[PATCH] MIPS: dts: drop skeleton.dtsi

2018-06-19 Thread Antony Pavlov
Based on feedback from Sascha:

http://lists.infradead.org/pipermail/barebox/2018-April/032694.html
"
skeleton.dtsi should no longer be used
"

Several reasons to remove skeleton.dtsi ares explained in
the linux commit 3ebee5a2e141 ("arm64: dts: kill skeleton.dtsi").

Unit number is added to the /memory nodes to fix this dtc warning:

  Warning (unit_address_vs_reg): /memory: node has a reg or ranges
  property, but no unit name

Also this commit adds #address-cells and #size-cells definitions
to board and SoC dts file to avoid dtc warning, e.g.

  Warning (avoid_default_addr_size): /memory@0: Relying on default
  #address-cells value

Signed-off-by: Antony Pavlov 
---
 arch/mips/dts/dlink-dir-320.dts |  7 ---
 arch/mips/dts/img-ci20.dts  |  2 +-
 arch/mips/dts/jz4755.dtsi   |  5 +++--
 arch/mips/dts/jz4780.dtsi   |  5 +++--
 arch/mips/dts/loongson-ls1b.dts |  2 +-
 arch/mips/dts/ls1b.dtsi |  5 +++--
 arch/mips/dts/qemu-malta.dts|  7 ---
 arch/mips/dts/rzx50.dts |  2 +-
 arch/mips/dts/skeleton.dtsi | 13 -
 9 files changed, 20 insertions(+), 28 deletions(-)

diff --git a/arch/mips/dts/dlink-dir-320.dts b/arch/mips/dts/dlink-dir-320.dts
index b961c9dca3..e21700637f 100644
--- a/arch/mips/dts/dlink-dir-320.dts
+++ b/arch/mips/dts/dlink-dir-320.dts
@@ -1,12 +1,13 @@
 /dts-v1/;
 
-#include "skeleton.dtsi"
-
 / {
model = "D-Link DIR-320";
compatible = "dlink,dir320";
 
-   memory {
+   #address-cells = <1>;
+   #size-cells = <1>;
+
+   memory@0 {
reg = <0x 0x200>;
};
 
diff --git a/arch/mips/dts/img-ci20.dts b/arch/mips/dts/img-ci20.dts
index da2a5bf625..d985666020 100644
--- a/arch/mips/dts/img-ci20.dts
+++ b/arch/mips/dts/img-ci20.dts
@@ -24,7 +24,7 @@
model = "MIPS Creator CI20";
compatible = "img,ci20";
 
-   memory {
+   memory@0 {
device_type = "memory";
reg = <0x0 0x1000>;
};
diff --git a/arch/mips/dts/jz4755.dtsi b/arch/mips/dts/jz4755.dtsi
index 137156df7e..5d929c5d83 100644
--- a/arch/mips/dts/jz4755.dtsi
+++ b/arch/mips/dts/jz4755.dtsi
@@ -1,6 +1,7 @@
-#include "skeleton.dtsi"
-
 / {
+   #address-cells = <1>;
+   #size-cells = <1>;
+
soc {
compatible = "simple-bus";
model = "Ingenic JZ4755";
diff --git a/arch/mips/dts/jz4780.dtsi b/arch/mips/dts/jz4780.dtsi
index 9f0de5d1ae..fbffe814bb 100644
--- a/arch/mips/dts/jz4780.dtsi
+++ b/arch/mips/dts/jz4780.dtsi
@@ -1,6 +1,7 @@
-#include "skeleton.dtsi"
-
 / {
+   #address-cells = <1>;
+   #size-cells = <1>;
+
soc {
model = "Ingenic JZ4780";
#address-cells = <1>;
diff --git a/arch/mips/dts/loongson-ls1b.dts b/arch/mips/dts/loongson-ls1b.dts
index b81a951dc7..39e44eba35 100644
--- a/arch/mips/dts/loongson-ls1b.dts
+++ b/arch/mips/dts/loongson-ls1b.dts
@@ -6,7 +6,7 @@
model = "Loongson Tech LS1B Demo Board";
compatible = "loongson,ls1b";
 
-   memory {
+   memory@0 {
reg = <0x 0x400>;
};
 };
diff --git a/arch/mips/dts/ls1b.dtsi b/arch/mips/dts/ls1b.dtsi
index af7119f1d0..cb85814af4 100644
--- a/arch/mips/dts/ls1b.dtsi
+++ b/arch/mips/dts/ls1b.dtsi
@@ -1,6 +1,7 @@
-#include "skeleton.dtsi"
-
 / {
+   #address-cells = <1>;
+   #size-cells = <1>;
+
soc {
#address-cells = <1>;
#size-cells = <1>;
diff --git a/arch/mips/dts/qemu-malta.dts b/arch/mips/dts/qemu-malta.dts
index 9b0c594e87..0311baed41 100644
--- a/arch/mips/dts/qemu-malta.dts
+++ b/arch/mips/dts/qemu-malta.dts
@@ -1,11 +1,12 @@
 /dts-v1/;
 
-/include/ "skeleton.dtsi"
-
 / {
model = "qemu malta";
compatible = "qemu,malta";
 
+   #address-cells = <1>;
+   #size-cells = <1>;
+
chosen {
environment@0 {
compatible = "barebox,environment";
@@ -13,7 +14,7 @@
};
};
 
-   memory {
+   memory@0 {
reg = <0x 0x1000>;
};
 
diff --git a/arch/mips/dts/rzx50.dts b/arch/mips/dts/rzx50.dts
index 7ec3352666..8d4f92c98a 100644
--- a/arch/mips/dts/rzx50.dts
+++ b/arch/mips/dts/rzx50.dts
@@ -6,7 +6,7 @@
model = "Ritmix RZX-50";
compatible = "ritmix,rzx50";
 
-   memory {
+   memory@0 {
reg = <0x 0x400>;
};
 
diff --git a/arch/mips/dts/skeleton.dtsi b/arch/mips/dts/skeleton.dtsi
deleted file mode 100644
index b41d241de2..00
--- a/arch/mips/dts/skeleton.dtsi
+++ /dev/null
@@ -1,13 +0,0 @@
-/

<    1   2   3   4   5   6   7   8   9   10   >