[PATCH 2/3] add handoff-data support

2024-04-30 Thread Sascha Hauer
We need to pass data from the PBL to barebox proper. Right now we do
this with passing the data in registers which is quite limited. As the
amount of information that has to be passed increases it's time to
overcome this limitation.

With this patch we introduce handoff-data which is a linked list of
memory blobs that can be passed from PBL to barebox proper.

The data format is done in a way that enables us to compile the list
entries and the data into the binary, so that no memory allocations
are needed in PBL.

Signed-off-by: Sascha Hauer 
---
 include/handoff-data.h |  48 +++
 pbl/Makefile   |   1 +
 pbl/handoff-data.c | 192 +
 3 files changed, 241 insertions(+)
 create mode 100644 include/handoff-data.h
 create mode 100644 pbl/handoff-data.c

diff --git a/include/handoff-data.h b/include/handoff-data.h
new file mode 100644
index 00..f5586e22fe
--- /dev/null
+++ b/include/handoff-data.h
@@ -0,0 +1,48 @@
+#ifndef __HANDOFF_DATA_H
+#define __HANDOFF_DATA_H
+
+#include 
+
+struct handoff_data {
+   struct list_head entries;
+};
+
+#define HANDOFF_DATA_BAREBOX(n)(0x28061971 + (n))
+#define HANDOFF_DATA_INTERNAL_DT   HANDOFF_DATA_BAREBOX(0)
+#define HANDOFF_DATA_INTERNAL_DT_Z HANDOFF_DATA_BAREBOX(1)
+#define HANDOFF_DATA_EXTERNAL_DT   HANDOFF_DATA_BAREBOX(2)
+#define HANDOFF_DATA_BOARDDATA HANDOFF_DATA_BAREBOX(3)
+
+#define HANDOFF_DATA_BOARD(n)  (0x951726fb + (n))
+
+struct handoff_data_entry {
+   struct list_head list;
+   void *data;
+   size_t size;
+   unsigned int cookie;
+#define HANDOFF_DATA_FLAG_NO_COPY  BIT(0)
+   unsigned int flags;
+};
+
+#define handoff_data_add_flags(_cookie, _data, _size, _flags)  \
+   do {\
+   static struct handoff_data_entry hde;   \
+   hde.cookie = _cookie;   \
+   hde.data = _data;   \
+   hde.size = _size;   \
+   hde.flags = _flags; \
+   \
+   handoff_data_add_entry();   \
+   } while (0);
+
+#define handoff_data_add(_cookie, _data, _size)\
+   handoff_data_add_flags((_cookie), (_data), (_size), 0)
+
+void handoff_data_add_entry(struct handoff_data_entry *entry);
+size_t handoff_data_size(void);
+void handoff_data_move(void *dest);
+void handoff_data_set(struct handoff_data *handoff);
+void *handoff_data_get_entry(unsigned int cookie, size_t *size);
+int handoff_data_show(void);
+
+#endif /* __HANDOFF_DATA_H */
diff --git a/pbl/Makefile b/pbl/Makefile
index f6e98e78be..79837c5611 100644
--- a/pbl/Makefile
+++ b/pbl/Makefile
@@ -8,3 +8,4 @@ pbl-y += string.o
 pbl-y += decomp.o
 pbl-$(CONFIG_LIBFDT) += fdt.o
 pbl-$(CONFIG_PBL_CONSOLE) += console.o
+obj-pbl-y += handoff-data.o
diff --git a/pbl/handoff-data.c b/pbl/handoff-data.c
new file mode 100644
index 00..fcb27234a6
--- /dev/null
+++ b/pbl/handoff-data.c
@@ -0,0 +1,192 @@
+// SPDX-License-Identifier: GPL-2.0
+#include 
+#include 
+#include 
+#include 
+#include 
+
+static struct handoff_data *handoff_data = (void *)-1;
+
+static struct handoff_data *handoff_data_get(void)
+{
+   static struct handoff_data __handoff_data;
+
+   /*
+* Sometimes the PBL copies itself to some other location and is
+* re-entered at that location. For example on some i.MX SoCs we have
+* to move the PBL out of the SRAM (which will be occupied by the TF-A
+* later). We force the handoff_data variable into the data segment.
+* When moving the PBL somewhere else with handoff_data set we move the
+* content of the variable with it and thus find it to have the correct
+* value in the new PBL.
+*/
+   if (handoff_data == (void *)-1) {
+   handoff_data = &__handoff_data;
+   INIT_LIST_HEAD(_data->entries);
+   }
+
+   return handoff_data;
+}
+
+/**
+ * handoff_data_set - set the handoff data to be at a specified pointer
+ * @handoff: the place where the handoff data is
+ *
+ * This sets the handoff data to @handoff. To be used by barebox proper
+ * to pass the place where the handoff data has been placed by the PBL.
+ */
+void handoff_data_set(struct handoff_data *handoff)
+{
+   handoff_data = handoff;
+}
+
+/**
+ * handoff_data_add_entry - add a new handoff data entry
+ * @hde: the new entry
+ *
+ * This adds a new handoff data entry.
+ */
+void handoff_data_add_entry(struct handoff_data_entry *hde)
+{
+   struct handoff_data *hd = handoff_data_get();
+
+   list_add_tail(>list, >entries);
+}
+
+/**
+ * handoff_data_size - calculate the handoff data size
+ *
+ * This calculates the size needed for the current handoff 

[PATCH 3/3] ARM: pass handoff data from PBL to proper

2024-04-30 Thread Sascha Hauer
Use newly introduced handoff data to pass data from PBL to barebox
proper. This will allow us later to pass more SoC and/or board specific
data from PBL to barebox proper.

Signed-off-by: Sascha Hauer 
---
 arch/arm/cpu/start.c  | 53 ---
 arch/arm/cpu/uncompress.c | 33 +---
 2 files changed, 45 insertions(+), 41 deletions(-)

diff --git a/arch/arm/cpu/start.c b/arch/arm/cpu/start.c
index c13e93c243..b9dbe1f2fb 100644
--- a/arch/arm/cpu/start.c
+++ b/arch/arm/cpu/start.c
@@ -21,6 +21,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -38,10 +39,9 @@ static unsigned long barebox_boarddata_size;
 
 const struct barebox_boarddata *barebox_get_boarddata(void)
 {
-   if (!barebox_boarddata || !blob_is_arm_boarddata(barebox_boarddata))
-   return NULL;
+   size_t size;
 
-   return barebox_boarddata;
+   return handoff_data_get_entry(HANDOFF_DATA_BOARDDATA, );
 }
 
 u32 barebox_arm_machine(void)
@@ -56,19 +56,24 @@ void *barebox_arm_boot_dtb(void)
int ret = 0;
struct barebox_boarddata_compressed_dtb *compressed_dtb;
static void *boot_dtb;
+   void *blob;
+   size_t size;
 
if (boot_dtb)
return boot_dtb;
 
-   if (barebox_boarddata && blob_is_fdt(barebox_boarddata)) {
-   pr_debug("%s: using barebox_boarddata\n", __func__);
-   return barebox_boarddata;
-   }
+   blob = handoff_data_get_entry(HANDOFF_DATA_INTERNAL_DT, );
+   if (blob)
+   return blob;
+
+   blob = handoff_data_get_entry(HANDOFF_DATA_INTERNAL_DT_Z, );
+   if (!blob)
+   return NULL;
 
-   if (!fdt_blob_can_be_decompressed(barebox_boarddata))
+   if (!fdt_blob_can_be_decompressed(blob))
return NULL;
 
-   compressed_dtb = barebox_boarddata;
+   compressed_dtb = blob;
 
pr_debug("%s: using compressed_dtb\n", __func__);
 
@@ -167,34 +172,6 @@ __noreturn __prereloc void barebox_non_pbl_start(unsigned 
long membase,
arm_barebox_size = barebox_size;
malloc_end = barebox_base;
 
-   if (boarddata) {
-   uint32_t totalsize = 0;
-   const char *name;
-
-   if (blob_is_fdt(boarddata)) {
-   totalsize = get_unaligned_be32(boarddata + 4);
-   name = "DTB";
-   } else if (blob_is_compressed_fdt(boarddata)) {
-   struct barebox_boarddata_compressed_dtb *bd = boarddata;
-   totalsize = bd->datalen + sizeof(*bd);
-   name = "Compressed DTB";
-   } else if (blob_is_arm_boarddata(boarddata)) {
-   totalsize = sizeof(struct barebox_arm_boarddata);
-   name = "machine type";
-   }
-
-   if (totalsize) {
-   unsigned long mem = arm_mem_boarddata(membase, endmem,
- totalsize);
-   pr_debug("found %s in boarddata, copying to 0x%08lx\n",
-name, mem);
-   barebox_boarddata = memcpy((void *)mem, boarddata,
-  totalsize);
-   barebox_boarddata_size = totalsize;
-   malloc_end = mem;
-   }
-   }
-
/*
 * Maximum malloc space is the Kconfig value if given
 * or 1GB.
@@ -216,6 +193,8 @@ __noreturn __prereloc void barebox_non_pbl_start(unsigned 
long membase,
 
mem_malloc_init((void *)malloc_start, (void *)malloc_end - 1);
 
+   handoff_data_set(boarddata);
+
if (IS_ENABLED(CONFIG_BOOTM_OPTEE))
of_add_reserve_entry(endmem - OPTEE_SIZE, endmem - 1);
 
diff --git a/arch/arm/cpu/uncompress.c b/arch/arm/cpu/uncompress.c
index aa1a49bfc9..a29703e760 100644
--- a/arch/arm/cpu/uncompress.c
+++ b/arch/arm/cpu/uncompress.c
@@ -10,6 +10,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -18,6 +19,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -29,6 +31,22 @@ unsigned long free_mem_end_ptr;
 extern unsigned char input_data[];
 extern unsigned char input_data_end[];
 
+static void add_handoff_data(void *boarddata)
+{
+   if (blob_is_fdt(boarddata)) {
+   handoff_data_add(HANDOFF_DATA_INTERNAL_DT, boarddata,
+get_unaligned_be32(boarddata + 4));
+   } else if (blob_is_compressed_fdt(boarddata)) {
+   struct barebox_boarddata_compressed_dtb *bd = boarddata;
+
+   handoff_data_add(HANDOFF_DATA_INTERNAL_DT_Z, boarddata,
+bd->datalen + sizeof(*bd));
+   } else if (blob_is_arm_boarddata(boardd

[PATCH 1/3] ARM: move blob_is_arm_boarddata() to include

2024-04-30 Thread Sascha Hauer
Signed-off-by: Sascha Hauer 
---
 arch/arm/cpu/start.c   | 7 ---
 arch/arm/include/asm/barebox-arm.h | 7 +++
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/arch/arm/cpu/start.c b/arch/arm/cpu/start.c
index 6d0a7cfc6b..c13e93c243 100644
--- a/arch/arm/cpu/start.c
+++ b/arch/arm/cpu/start.c
@@ -36,13 +36,6 @@ static unsigned long arm_membase;
 static void *barebox_boarddata;
 static unsigned long barebox_boarddata_size;
 
-static bool blob_is_arm_boarddata(const void *blob)
-{
-   const struct barebox_arm_boarddata *bd = blob;
-
-   return bd->magic == BAREBOX_ARM_BOARDDATA_MAGIC;
-}
-
 const struct barebox_boarddata *barebox_get_boarddata(void)
 {
if (!barebox_boarddata || !blob_is_arm_boarddata(barebox_boarddata))
diff --git a/arch/arm/include/asm/barebox-arm.h 
b/arch/arm/include/asm/barebox-arm.h
index 4d70360b91..67f2b6ac45 100644
--- a/arch/arm/include/asm/barebox-arm.h
+++ b/arch/arm/include/asm/barebox-arm.h
@@ -32,6 +32,13 @@ void __noreturn barebox_arm_entry(unsigned long membase, 
unsigned long memsize,
 #define barebox_arm_boarddata  barebox_boarddata
 #define BAREBOX_ARM_BOARDDATA_MAGICBAREBOX_BOARDDATA_MAGIC
 
+static inline bool blob_is_arm_boarddata(const void *blob)
+{
+   const struct barebox_arm_boarddata *bd = blob;
+
+   return bd->magic == BAREBOX_ARM_BOARDDATA_MAGIC;
+}
+
 u32 barebox_arm_machine(void);
 
 unsigned long arm_mem_ramoops_get(void);
-- 
2.39.2




[PATCH 0/3] add PBL handoff-data support

2024-04-30 Thread Sascha Hauer
We need to pass data from the PBL to barebox proper. Right now we do
this with passing the data in registers which is quite limited. As the
amount of information that has to be passed increases it's time to
overcome this limitation.

This series introduces handoff-data which is a linked list of memory
blobs that can be passed from PBL to barebox proper. Board and SoC
code can append this list with their own entries and pick them up later
in barebox proper. The ARM architecture is converted over to use handoff
data, other architectures could follow.

Sascha Hauer (3):
  ARM: move blob_is_arm_boarddata() to include
  add handoff-data support
  ARM: pass handoff data from PBL to proper

 arch/arm/cpu/start.c   |  60 +++--
 arch/arm/cpu/uncompress.c  |  33 -
 arch/arm/include/asm/barebox-arm.h |   7 ++
 include/handoff-data.h |  48 
 pbl/Makefile   |   1 +
 pbl/handoff-data.c | 192 +
 6 files changed, 293 insertions(+), 48 deletions(-)
 create mode 100644 include/handoff-data.h
 create mode 100644 pbl/handoff-data.c

-- 
2.39.2




[PATCH] treewide: use runtime_address() where possible

2024-04-29 Thread Sascha Hauer
We now have runtime_address() to access a linker variable when the
binary is not yet relocated to the correct address. It provides a
safer API, so use this one where possible instead of using previous
way of adding get_runtime_offset() manually.

Signed-off-by: Sascha Hauer 
---
 arch/arm/boards/ac-sxb/lowlevel.c |  2 +-
 arch/arm/boards/afi-gf/lowlevel.c |  2 +-
 arch/arm/boards/at91sam9263ek/lowlevel_init.c |  2 +-
 arch/arm/boards/at91sam9x5ek/lowlevel.c   |  2 +-
 arch/arm/boards/avnet-zedboard/lowlevel.c |  3 +-
 arch/arm/boards/beaglebone/lowlevel.c |  6 ++--
 .../boundarydevices-nitrogen6/lowlevel.c  | 10 +++---
 arch/arm/boards/ccxmx51/lowlevel.c|  2 +-
 arch/arm/boards/ccxmx53/lowlevel.c|  4 +--
 arch/arm/boards/clep7212/lowlevel.c   |  4 +--
 arch/arm/boards/datamodul-edm-qmx6/lowlevel.c |  2 +-
 arch/arm/boards/dfi-fs700-m60/lowlevel.c  |  6 ++--
 arch/arm/boards/duckbill/lowlevel.c   |  2 +-
 arch/arm/boards/efika-mx-smartbook/lowlevel.c |  2 +-
 arch/arm/boards/element14-warp7/lowlevel.c|  2 +-
 arch/arm/boards/eltec-hipercam/lowlevel.c |  2 +-
 arch/arm/boards/embedsky-e9/lowlevel.c|  2 +-
 arch/arm/boards/embest-marsboard/lowlevel.c   |  2 +-
 arch/arm/boards/embest-riotboard/lowlevel.c   |  2 +-
 arch/arm/boards/enclustra-aa1/lowlevel.c  |  6 ++--
 arch/arm/boards/freescale-mx28-evk/lowlevel.c |  2 +-
 .../boards/freescale-mx51-babbage/lowlevel.c  |  2 +-
 arch/arm/boards/freescale-mx53-qsb/lowlevel.c |  4 +--
 .../boards/freescale-mx53-vmx53/lowlevel.c|  2 +-
 .../boards/freescale-mx6-sabresd/lowlevel.c   |  6 ++--
 .../freescale-mx6sx-sabresdb/lowlevel.c   |  2 +-
 .../boards/freescale-mx7-sabresd/lowlevel.c   |  2 +-
 .../arm/boards/freescale-vf610-twr/lowlevel.c |  2 +-
 arch/arm/boards/gateworks-ventana/lowlevel.c  |  2 +-
 arch/arm/boards/gk802/lowlevel.c  |  2 +-
 .../boards/globalscale-guruplug/lowlevel.c|  3 +-
 .../arm/boards/globalscale-mirabox/lowlevel.c |  3 +-
 arch/arm/boards/grinn-liteboard/lowlevel.c|  3 +-
 arch/arm/boards/guf-vincell/lowlevel.c|  4 +--
 .../kamstrup-mx7-concentrator/lowlevel.c  |  2 +-
 arch/arm/boards/karo-tx25/lowlevel.c  |  2 +-
 arch/arm/boards/karo-tx53/lowlevel.c  |  7 ++--
 arch/arm/boards/karo-tx6x/lowlevel.c  |  8 ++---
 arch/arm/boards/kindle-mx50/lowlevel.c|  6 ++--
 arch/arm/boards/kontron-samx6i/lowlevel.c |  9 ++
 arch/arm/boards/lenovo-ix4-300d/lowlevel.c|  3 +-
 arch/arm/boards/lxa-mc1/lowlevel.c|  2 +-
 .../boards/marvell-armada-xp-db/lowlevel.c|  2 +-
 .../boards/marvell-armada-xp-gp/lowlevel.c|  2 +-
 arch/arm/boards/meerkat96/lowlevel.c  |  2 +-
 .../boards/microchip-ksz9477-evb/lowlevel.c   |  2 +-
 .../boards/microchip-sama5d3-eds/lowlevel.c   |  2 +-
 arch/arm/boards/myirtech-x335x/lowlevel.c |  4 +--
 arch/arm/boards/netgear-rn104/lowlevel.c  |  3 +-
 arch/arm/boards/netgear-rn2120/lowlevel.c |  3 +-
 arch/arm/boards/nvidia-beaver/entry.c |  2 +-
 arch/arm/boards/nvidia-jetson-tk1/entry.c |  2 +-
 .../boards/phytec-phycard-imx27/lowlevel.c|  2 +-
 .../boards/phytec-phycore-imx27/lowlevel.c|  2 +-
 .../arm/boards/phytec-phycore-imx7/lowlevel.c |  2 +-
 .../boards/phytec-phycore-stm32mp1/lowlevel.c |  2 +-
 arch/arm/boards/phytec-som-am335x/lowlevel.c  |  9 ++
 arch/arm/boards/phytec-som-imx6/lowlevel.c|  7 ++--
 arch/arm/boards/phytec-som-rk3288/lowlevel.c  |  2 +-
 .../boards/plathome-openblocks-a6/lowlevel.c  |  3 +-
 .../boards/plathome-openblocks-ax3/lowlevel.c |  3 +-
 arch/arm/boards/protonic-imx6/lowlevel.c  | 32 +--
 arch/arm/boards/protonic-stm32mp1/lowlevel.c  |  6 ++--
 arch/arm/boards/radxa-rock/lowlevel.c |  2 +-
 arch/arm/boards/raspberry-pi/lowlevel.c   | 10 +++---
 arch/arm/boards/reflex-achilles/lowlevel.c|  4 +--
 .../arm/boards/sama5d27-giantboard/lowlevel.c |  2 +-
 arch/arm/boards/sama5d27-som1/lowlevel.c  |  2 +-
 arch/arm/boards/sama5d3_xplained/lowlevel.c   |  2 +-
 arch/arm/boards/sama5d4_wifx/lowlevel.c   |  2 +-
 arch/arm/boards/scb9328/lowlevel.c|  2 +-
 arch/arm/boards/seeed-odyssey/lowlevel.c  |  2 +-
 arch/arm/boards/skov-arm9cpu/lowlevel.c   |  2 +-
 arch/arm/boards/solidrun-cubox/lowlevel.c |  2 +-
 arch/arm/boards/solidrun-microsom/lowlevel.c  | 18 +--
 arch/arm/boards/stm32mp15x-ev1/lowlevel.c |  2 +-
 arch/arm/boards/stm32mp15xx-dkx/lowlevel.c|  6 ++--
 .../boards/technexion-pico-hobbit/lowlevel.c  |  8 ++---
 arch/arm/boards/toradex-colibri-t20/entry.c   |  2 +-
 arch/arm/boards/toshiba-ac100/entry.c |  2 +-
 arch/arm/boards/tqma53/lowlevel.c |  4 +--
 arch/arm/boards/tqma6x/lowlevel.c |  4 +--
 arch/arm/boards/turris-omnia/lowlevel.c   |  3 +-
 arch/arm/boards/udoo-neo/lowlevel.c   |  2 +-
 arch/arm/boards/udoo

[PATCH] ARM: remove MLO target

2024-04-29 Thread Sascha Hauer
All am335x boards use multi image support, so the MLO target is unused.
Remove it.

Signed-off-by: Sascha Hauer 
---
 arch/arm/Makefile | 10 --
 1 file changed, 10 deletions(-)

diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index f91fcb0454..6785432c52 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -112,16 +112,6 @@ KBUILD_CFLAGS_KERNEL += -fPIE
 
 KBUILD_BINARY := barebox.bin
 
-quiet_cmd_mlo ?= IFT $@
-   cmd_mlo ?= scripts/omap_signGP -o MLO -l $(TEXT_BASE) -c $<
-
-MLO: $(KBUILD_BINARY)
-   $(call if_changed,mlo)
-
-ifeq ($(CONFIG_OMAP_BUILD_IFT),y)
-KBUILD_IMAGE := MLO
-endif
-
 archclean:
$(MAKE) $(clean)=$(pbl)
 
-- 
2.39.2




Re: [PATCH] mtd: nand-imx: Improve comment about vendor BBM and address verschwurbelung

2024-04-29 Thread Sascha Hauer
On Tue, Apr 23, 2024 at 07:35:32PM +0200, Uwe Kleine-König wrote:
> From: Uwe Kleine-König 
> 
> To better describe why the BBM is at offset 2000 describe the full
> misinterpretation^Wmapping of the NAND memory that the i.MX hardware
> implements.
> 
> Also adapt the comment to reality: A BBT is created automatically since
> commit 2ad441bb7e78 ("mtd: nand-imx: Create BBT automatically when
> necessary") which was included in v2020.03.0.
> 
> Signed-off-by: Uwe Kleine-König 
> ---
>  drivers/mtd/nand/nand_imx.c | 30 +-
>  1 file changed, 21 insertions(+), 9 deletions(-)

As the driver has been abandoned in favour for the Kernel driver I can't
apply this one.

Sascha

> 
> diff --git a/drivers/mtd/nand/nand_imx.c b/drivers/mtd/nand/nand_imx.c
> index 23b9c52e0f76..77655daa4efe 100644
> --- a/drivers/mtd/nand/nand_imx.c
> +++ b/drivers/mtd/nand/nand_imx.c
> @@ -1139,20 +1139,32 @@ static int __init mxcnd_probe_dt(struct imx_nand_host 
> *host)
>   * 512b data + 16b OOB +
>   * 512b data + 16b OOB
>   *
> + * So the mapping between original NAND addressing (as intended by the chip
> + * vendor) and interpretation when accessed via the i.MX NAND controller is 
> as
> + * follows:
> + *
> + *   original   |i.MX
> + * -+-
> + * data 0x - 0x0200 | data 0x - 0x0200
> + * data 0x0200 - 0x0210 | oob  0x - 0x0010
> + * data 0x0210 - 0x0410 | data 0x0200 - 0x0400
> + * data 0x0410 - 0x0420 | oob  0x0010 - 0x0020
> + * data 0x0420 - 0x0620 | data 0x0400 - 0x0600
> + * data 0x0620 - 0x0630 | oob  0x0020 - 0x0030
> + * data 0x0630 - 0x0800 | data 0x0600 - 0x07d0
> + * oob  0x - 0x0030 | data 0x07d0 - 0x0800
> + * oob  0x0030 - 0x0040 | oob  0x0030 - 0x0040
> + *
>   * This means that the factory provided bad block marker ends up
> - * in the page data at offset 2000 instead of in the OOB data.
> + * in the page data at offset 2000 = 0x7d0 instead of in the OOB data.
>   *
> - * To preserve the factory bad block information we take the following
> - * strategy:
> - *
> - * - If the NAND driver detects that no flash BBT is present on 2k NAND
> - *   chips it will not create one because it would do so based on the wrong
> - *   BBM position
> - * - This command is used to create a flash BBT then.
> + * If the NAND driver detects that no flash BBT is present on a 2k NAND
> + * chip it will create one automatically in the assumption that the NAND is
> + * pristine (that is completely erased with only vendor BBMs in the OOB) to
> + * preserve factory bad block information.
>   *
>   * From this point on we can forget about the BBMs and rely completely
>   * on the flash BBT.
> - *
>   */
>  static int checkbad(struct nand_chip *chip, loff_t ofs)
>  {
> 
> base-commit: f40319c8e157c90117d32aed1dae5549a723c63e
> -- 
> 2.43.0
> 
> 
> 

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



Re: [PATCH 00/15] ARM: remove non PBL ARM boards and sub architectures

2024-04-29 Thread Sascha Hauer


On Thu, 25 Apr 2024 13:54:24 +0200, Sascha Hauer wrote:
> The ARM architecture support in barebox has become quite complicated
> over time.  Most SoCs use PBL and relocatable binaries, but some older
> ones still don't.  This makes the lowlevel ARM code hard to maintain and
> often hard to understand.
> 
> I've decided that it is time to make a cut and to abandon the old non
> PBL boards and sometimes the sub architecture with it. This series
> removes:
> 
> [...]

Applied, thanks!

[01/15] ARM: move HAVE_PBL_MULTI_IMAGES up to ARCH_MULTIARCH
https://git.pengutronix.de/cgit/barebox/commit/?id=13c3c07e96e1 (link 
may not be stable)
[02/15] ARM: move OFTREE and OFDEVICE up one level
https://git.pengutronix.de/cgit/barebox/commit/?id=45b30c8d801e (link 
may not be stable)
[03/15] ARM: remove uemd architecure
https://git.pengutronix.de/cgit/barebox/commit/?id=a5681b18d47c (link 
may not be stable)
[04/15] ARM: remove ep93xx
https://git.pengutronix.de/cgit/barebox/commit/?id=5418fd777d76 (link 
may not be stable)
[05/15] ARM: remove canon-a1100 support
https://git.pengutronix.de/cgit/barebox/commit/?id=b6e3e1d8dc3f (link 
may not be stable)
[06/15] ARM: remove davinci
https://git.pengutronix.de/cgit/barebox/commit/?id=68da68c3b0f2 (link 
may not be stable)
[07/15] ARM: remove PXA boards
https://git.pengutronix.de/cgit/barebox/commit/?id=d7d7a18304a3 (link 
may not be stable)
[08/15] ARM: remove nomadik
https://git.pengutronix.de/cgit/barebox/commit/?id=32d76e3b9294 (link 
may not be stable)
[09/15] ARM: remove non PBL OMAP boards
https://git.pengutronix.de/cgit/barebox/commit/?id=717deee50b3b (link 
may not be stable)
[10/15] ARM: remove non PBL Atmel boards
https://git.pengutronix.de/cgit/barebox/commit/?id=e0ae81c736d9 (link 
may not be stable)
[11/15] ARM: move HAVE_PBL_MULTI_IMAGES to toplevel
https://git.pengutronix.de/cgit/barebox/commit/?id=0e3cb435f7e5 (link 
may not be stable)
[12/15] ARM: drop non PBL support
https://git.pengutronix.de/cgit/barebox/commit/?id=0a63711018eb (link 
may not be stable)
[13/15] ARM: drop barebox_arm_head()
https://git.pengutronix.de/cgit/barebox/commit/?id=64627a98b6dd (link 
may not be stable)
[14/15] ARM: make relocatable mandatory
https://git.pengutronix.de/cgit/barebox/commit/?id=9bca0e9adc70 (link 
may not be stable)
[15/15] ARM: drop TEXT_BASE
https://git.pengutronix.de/cgit/barebox/commit/?id=8d0d0f9b67be (link 
may not be stable)

Best regards,
-- 
Sascha Hauer 




Re: [PATCH master 1/3] mci: core: fix fallback when eMMC DDR52 is not possible

2024-04-29 Thread Sascha Hauer


On Tue, 23 Apr 2024 08:22:04 +0200, Ahmad Fatoum wrote:
> mci_mmc_select_hs_ddr() will try DDR52 and if that fails, revert to
> SDR operation. In that case, it returns the bus width, which would
> be forwarded as if it were an error code:
> 
>   WARNING: mmc2: Card's startup fails with 3
> 
> Fix this by translating successful return values to 0 in
> mci_startup_mmc().
> 
> [...]

Applied, thanks!

[1/3] mci: core: fix fallback when eMMC DDR52 is not possible
  https://git.pengutronix.de/cgit/barebox/commit/?id=02a40f3ed0ac (link may 
not be stable)
[2/3] mci: core: fix fallback when host doesn't support HS200
  https://git.pengutronix.de/cgit/barebox/commit/?id=ebb5a3204630 (link may 
not be stable)
[3/3] mci: core: make execute_tuning mandatory for HS200
  https://git.pengutronix.de/cgit/barebox/commit/?id=8ca910b92188 (link may 
not be stable)

Best regards,
-- 
Sascha Hauer 




Re: [PATCH] net: dsa: use dma_alloc in receive path for symmetry

2024-04-29 Thread Sascha Hauer


On Tue, 23 Apr 2024 19:53:37 +0200, Ahmad Fatoum wrote:
> As explained by the comment, we don't strictly need this at moment, but,
> say, if in future, we decide to save a memory copy in the ping reply
> code by reusing the receive buffer for transmission, it would work for
> all interfaces, except for DSA. Therefore, let's iron out this wrinkle.
> 
> 

Applied, thanks!

[1/1] net: dsa: use dma_alloc in receive path for symmetry
  https://git.pengutronix.de/cgit/barebox/commit/?id=58998f56ee4c (link may 
not be stable)

Best regards,
-- 
Sascha Hauer 




Re: [PATCH] net: fsl-fman: remove superfluous zeroing of new dma_alloc_coherent buf

2024-04-29 Thread Sascha Hauer


On Tue, 23 Apr 2024 19:36:25 +0200, Ahmad Fatoum wrote:
> dma_alloc_coherent() already takes care to zero the memory, so there's
> no need to zero it explicitly.
> 
> 

Applied, thanks!

[1/1] net: fsl-fman: remove superfluous zeroing of new dma_alloc_coherent buf
  https://git.pengutronix.de/cgit/barebox/commit/?id=0e5b0c7c11bc (link may 
not be stable)

Best regards,
-- 
Sascha Hauer 




Re: [PATCH 10/15] ARM: remove non PBL Atmel boards

2024-04-26 Thread Sascha Hauer
Hi Sam,

On Thu, Apr 25, 2024 at 06:56:48PM +0200, Sam Ravnborg wrote:
> Hi Sascha
> 
> On Thu, Apr 25, 2024 at 01:54:34PM +0200, Sascha Hauer wrote:
> > Some Atmel AT91 boards still do not have PBL support which becomes
> > mandatory soon. Remove these boards.
> > 
> > Signed-off-by: Sascha Hauer 
> > ---
> >  arch/arm/boards/Makefile  |   3 -
> >  arch/arm/boards/sama5d3xek/Makefile   |   6 -
> >  .../defaultenv-sama5d3xek/bin/init_board  |  15 -
> >  .../sama5d3xek/defaultenv-sama5d3xek/config   |  44 --
> >  arch/arm/boards/sama5d3xek/hw_version.c   | 236 -
> >  arch/arm/boards/sama5d3xek/hw_version.h   |  40 --
> >  arch/arm/boards/sama5d3xek/init.c | 475 --
> >  arch/arm/boards/sama5d3xek/lowlevel.c |  23 -
> >  arch/arm/boards/sama5d4_xplained/Makefile |   4 -
> I have patches that DT enable this board, and an attempt to
> add PBL support (which did not succeed).
> 
> I did not touch the patches since last summer, so some rebasing is
> required.
> I will try to find time to give it a spin within the next days and
> post the result.

Ok, thanks. I'll mark the board as broken then instead of removing it.

Sascha

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



Re: [PATCH master] sandbox: dma: fix recursive dependency between headers

2024-04-26 Thread Sascha Hauer
On Fri, Apr 26, 2024 at 12:41:47PM +0200, Ahmad Fatoum wrote:
> If  includes  via , it will end up
> including , which in turn includes .
> 
> This leads to use of symbols before definition, so remove the
>  definition.
> 
> Fixes: 9b12861830e0 ("include: linux/slab: use dma_alloc for kmalloc")
> Signed-off-by: Ahmad Fatoum 
> ---
>  arch/sandbox/include/asm/dma.h | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

Applied, thanks

Sascha

> 
> diff --git a/arch/sandbox/include/asm/dma.h b/arch/sandbox/include/asm/dma.h
> index ab84166846a2..2dbce1ad6c9a 100644
> --- a/arch/sandbox/include/asm/dma.h
> +++ b/arch/sandbox/include/asm/dma.h
> @@ -8,7 +8,8 @@
>  #ifndef __ASM_DMA_H
>  #define __ASM_DMA_H
>  
> -#include 
> +#include 
> +#include 
>  #include 
>  
>  #define DMA_ALIGNMENT64
> -- 
> 2.39.2
> 
> 
> 

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



[PATCH 10/15] ARM: remove non PBL Atmel boards

2024-04-25 Thread Sascha Hauer
Some Atmel AT91 boards still do not have PBL support which becomes
mandatory soon. Remove these boards.

Signed-off-by: Sascha Hauer 
---
 arch/arm/boards/Makefile  |   3 -
 arch/arm/boards/sama5d3xek/Makefile   |   6 -
 .../defaultenv-sama5d3xek/bin/init_board  |  15 -
 .../sama5d3xek/defaultenv-sama5d3xek/config   |  44 --
 arch/arm/boards/sama5d3xek/hw_version.c   | 236 -
 arch/arm/boards/sama5d3xek/hw_version.h   |  40 --
 arch/arm/boards/sama5d3xek/init.c | 475 --
 arch/arm/boards/sama5d3xek/lowlevel.c |  23 -
 arch/arm/boards/sama5d4_xplained/Makefile |   4 -
 arch/arm/boards/sama5d4_xplained/env/boot/mmc |   8 -
 .../arm/boards/sama5d4_xplained/env/boot/nand |   8 -
 .../sama5d4_xplained/env/init/automount   |   5 -
 .../sama5d4_xplained/env/init/mtdparts-nand   |   6 -
 .../boards/sama5d4_xplained/env/init/splash   |  15 -
 .../sama5d4_xplained/env/nv/boot.default  |   1 -
 .../env/nv/linux.bootargs.console |   1 -
 arch/arm/boards/sama5d4_xplained/lowlevel.c   |  23 -
 .../sama5d4_xplained/sama5d4_xplained.c   | 320 
 arch/arm/boards/sama5d4ek/Makefile|   4 -
 arch/arm/boards/sama5d4ek/env/boot/nand   |   6 -
 .../boards/sama5d4ek/env/init/mtdparts-nand   |   6 -
 .../boards/sama5d4ek/env/init/mtdparts-nor|   6 -
 arch/arm/boards/sama5d4ek/env/init/splash |  10 -
 arch/arm/boards/sama5d4ek/env/nv/boot.default |   1 -
 arch/arm/boards/sama5d4ek/env/nv/hostname |   1 -
 .../sama5d4ek/env/nv/linux.bootargs.console   |   1 -
 arch/arm/boards/sama5d4ek/lowlevel.c  |  23 -
 arch/arm/boards/sama5d4ek/sama5d4ek.c | 318 
 arch/arm/configs/sama5d4_xplained_defconfig   |  84 
 arch/arm/configs/sama5d4ek_defconfig  |  83 ---
 arch/arm/mach-at91/Kconfig|  36 --
 31 files changed, 1812 deletions(-)
 delete mode 100644 arch/arm/boards/sama5d3xek/Makefile
 delete mode 100644 
arch/arm/boards/sama5d3xek/defaultenv-sama5d3xek/bin/init_board
 delete mode 100644 arch/arm/boards/sama5d3xek/defaultenv-sama5d3xek/config
 delete mode 100644 arch/arm/boards/sama5d3xek/hw_version.c
 delete mode 100644 arch/arm/boards/sama5d3xek/hw_version.h
 delete mode 100644 arch/arm/boards/sama5d3xek/init.c
 delete mode 100644 arch/arm/boards/sama5d3xek/lowlevel.c
 delete mode 100644 arch/arm/boards/sama5d4_xplained/Makefile
 delete mode 100644 arch/arm/boards/sama5d4_xplained/env/boot/mmc
 delete mode 100644 arch/arm/boards/sama5d4_xplained/env/boot/nand
 delete mode 100644 arch/arm/boards/sama5d4_xplained/env/init/automount
 delete mode 100644 arch/arm/boards/sama5d4_xplained/env/init/mtdparts-nand
 delete mode 100644 arch/arm/boards/sama5d4_xplained/env/init/splash
 delete mode 100644 arch/arm/boards/sama5d4_xplained/env/nv/boot.default
 delete mode 100644 
arch/arm/boards/sama5d4_xplained/env/nv/linux.bootargs.console
 delete mode 100644 arch/arm/boards/sama5d4_xplained/lowlevel.c
 delete mode 100644 arch/arm/boards/sama5d4_xplained/sama5d4_xplained.c
 delete mode 100644 arch/arm/boards/sama5d4ek/Makefile
 delete mode 100644 arch/arm/boards/sama5d4ek/env/boot/nand
 delete mode 100644 arch/arm/boards/sama5d4ek/env/init/mtdparts-nand
 delete mode 100644 arch/arm/boards/sama5d4ek/env/init/mtdparts-nor
 delete mode 100644 arch/arm/boards/sama5d4ek/env/init/splash
 delete mode 100644 arch/arm/boards/sama5d4ek/env/nv/boot.default
 delete mode 100644 arch/arm/boards/sama5d4ek/env/nv/hostname
 delete mode 100644 arch/arm/boards/sama5d4ek/env/nv/linux.bootargs.console
 delete mode 100644 arch/arm/boards/sama5d4ek/lowlevel.c
 delete mode 100644 arch/arm/boards/sama5d4ek/sama5d4ek.c
 delete mode 100644 arch/arm/configs/sama5d4_xplained_defconfig
 delete mode 100644 arch/arm/configs/sama5d4ek_defconfig

diff --git a/arch/arm/boards/Makefile b/arch/arm/boards/Makefile
index 6e9e6798ba..fc8c032ec1 100644
--- a/arch/arm/boards/Makefile
+++ b/arch/arm/boards/Makefile
@@ -103,13 +103,10 @@ obj-$(CONFIG_MACH_SKOV_IMX8MP)+= 
skov-imx8mp/
 obj-$(CONFIG_MACH_FREESCALE_IMX6SX_SABRESDB)   += freescale-mx6sx-sabresdb/
 obj-$(CONFIG_MACH_SAMA5D27_GIANTBOARD) += sama5d27-giantboard/
 obj-$(CONFIG_MACH_SAMA5D27_SOM1)   += sama5d27-som1/
-obj-$(CONFIG_MACH_SAMA5D3XEK)  += sama5d3xek/
 obj-$(CONFIG_MACH_SAMA5D3_XPLAINED)+= sama5d3_xplained/
 obj-$(CONFIG_MACH_MICROCHIP_KSZ9477_EVB)   += microchip-ksz9477-evb/
 obj-$(CONFIG_MACH_MICROCHIP_SAMA5D3_EDS)   += microchip-sama5d3-eds/
-obj-$(CONFIG_MACH_SAMA5D4_XPLAINED)+= sama5d4_xplained/
 obj-$(CONFIG_MACH_SAMA5D4_WIFX)+= sama5d4_wifx/
-obj-$(CONFIG_MACH_SAMA5D4EK)   += sama5d4ek/
 obj-$(CONFIG_MACH_SCB9328) += scb9328/
 obj-$(CONFIG_MACH_SEEED_ODYSSEY)   += seeed-odyssey/
 obj-$(CONFIG_MACH_SOCFPGA_ALTERA_SOCDK)+= altera-socdk/
diff

[PATCH 15/15] ARM: drop TEXT_BASE

2024-04-25 Thread Sascha Hauer
With all ARM boards being relocatable TEXT_BASE is always defined to 0x0
and can be dropped. The ARCH_TEXT_BASE Kconfig symbol is also no longer
used and can be removed.

Signed-off-by: Sascha Hauer 
---
 arch/arm/Kconfig  | 4 
 arch/arm/Makefile | 4 
 arch/arm/boards/versatile/Kconfig | 4 
 arch/arm/lib32/barebox.lds.S  | 2 +-
 arch/arm/lib64/barebox.lds.S  | 2 +-
 arch/arm/mach-at91/Kconfig| 8 
 arch/arm/mach-bcm283x/Kconfig | 4 
 arch/arm/mach-mvebu/Kconfig   | 7 ---
 arch/arm/mach-mxs/Kconfig | 9 -
 arch/arm/mach-omap/Kconfig| 5 -
 arch/arm/mach-rockchip/Kconfig| 5 -
 arch/arm/mach-socfpga/Kconfig | 4 
 arch/arm/mach-tegra/Kconfig   | 4 
 arch/arm/mach-versatile/Kconfig   | 3 ---
 arch/arm/mach-vexpress/Kconfig| 4 
 arch/arm/mach-zynq/Kconfig| 4 
 16 files changed, 2 insertions(+), 71 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 6a6d7955d1..b9883b30f7 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -24,10 +24,6 @@ config ARM_USE_COMPRESSED_DTB
bool
select USE_COMPRESSED_DTB
 
-config TEXT_BASE
-   hex
-   default 0x0
-
 menu "System Type"
 
 config ARCH_STM32
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index f98770f66a..f91fcb0454 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -102,10 +102,6 @@ machine-$(CONFIG_ARCH_TEGRA)   += tegra
 machine-$(CONFIG_ARCH_ZYNQ)+= zynq
 machine-$(CONFIG_ARCH_ZYNQMP)  += zynqmp
 
-TEXT_BASE = $(CONFIG_TEXT_BASE)
-
-KBUILD_CPPFLAGS += -DTEXT_BASE=$(TEXT_BASE)
-
 # Add cleanup flags
 KBUILD_CPPFLAGS += -fdata-sections -ffunction-sections
 LDFLAGS_barebox += --gc-sections -pie
diff --git a/arch/arm/boards/versatile/Kconfig 
b/arch/arm/boards/versatile/Kconfig
index 66492404e0..5cb3061635 100644
--- a/arch/arm/boards/versatile/Kconfig
+++ b/arch/arm/boards/versatile/Kconfig
@@ -2,8 +2,4 @@
 
 if MACH_VERSATILEPB
 
-config ARCH_TEXT_BASE
-   hex
-   default 0x0100
-
 endif
diff --git a/arch/arm/lib32/barebox.lds.S b/arch/arm/lib32/barebox.lds.S
index ad9e9e84ef..97f41f72fe 100644
--- a/arch/arm/lib32/barebox.lds.S
+++ b/arch/arm/lib32/barebox.lds.S
@@ -83,5 +83,5 @@ SECTIONS
 #endif
 
_end = .;
-   _barebox_image_size = __bss_start - TEXT_BASE;
+   _barebox_image_size = __bss_start;
 }
diff --git a/arch/arm/lib64/barebox.lds.S b/arch/arm/lib64/barebox.lds.S
index 2479646d9d..1d0cc6dc54 100644
--- a/arch/arm/lib64/barebox.lds.S
+++ b/arch/arm/lib64/barebox.lds.S
@@ -53,5 +53,5 @@ SECTIONS
.bss : { *(.bss*) }
.__bss_stop :  { *(.__bss_stop) }
_end = .;
-   _barebox_image_size = __bss_start - TEXT_BASE;
+   _barebox_image_size = __bss_start;
 }
diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index b68a9f4e25..0b75d665d0 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -147,14 +147,6 @@ config SOC_SAMA7G5
help
  Select this if you are using one of Microchip's SAMA7G5 family SoC.
 
-config ARCH_TEXT_BASE
-   hex
-   default 0x73f0 if SOC_AT91SAM9G45
-   default 0x26f0 if SOC_AT91SAM9X5
-   default 0x20f0 if SOC_AT91RM9200
-   default 0x21f0 if MACH_ANIMEO_IP
-   default 0x23f0
-
 config HAVE_NAND_ATMEL_BUSWIDTH_16
bool
 
diff --git a/arch/arm/mach-bcm283x/Kconfig b/arch/arm/mach-bcm283x/Kconfig
index f7434d2f5c..defccf8362 100644
--- a/arch/arm/mach-bcm283x/Kconfig
+++ b/arch/arm/mach-bcm283x/Kconfig
@@ -2,10 +2,6 @@
 
 if ARCH_BCM283X
 
-config ARCH_TEXT_BASE
-   hex
-   default 0x0
-
 config MACH_RPI_COMMON
bool
select ARM_USE_COMPRESSED_DTB
diff --git a/arch/arm/mach-mvebu/Kconfig b/arch/arm/mach-mvebu/Kconfig
index 1b26148434..ed1302af65 100644
--- a/arch/arm/mach-mvebu/Kconfig
+++ b/arch/arm/mach-mvebu/Kconfig
@@ -2,13 +2,6 @@
 
 if ARCH_MVEBU
 
-config ARCH_TEXT_BASE
-   hex
-   default 0x200 if ARCH_ARMADA_370
-   default 0x200 if ARCH_ARMADA_XP
-   default 0x200 if ARCH_DOVE
-   default 0x200 if ARCH_KIRKWOOD
-
 config ARCH_ARMADA_370
bool
select CPU_V7
diff --git a/arch/arm/mach-mxs/Kconfig b/arch/arm/mach-mxs/Kconfig
index c8ef2c62af..0219196794 100644
--- a/arch/arm/mach-mxs/Kconfig
+++ b/arch/arm/mach-mxs/Kconfig
@@ -2,15 +2,6 @@
 
 if ARCH_MXS
 
-config ARCH_TEXT_BASE
-   hex
-   default 0x4100 if MACH_MX23EVK
-   default 0x4200 if MACH_CHUMBY
-   default 0x4200 if MACH_IMX233_OLINUXINO
-   default 0x4700 if MACH_TX28
-   default 0x4700 if MACH_MX28EVK
-   default 0x4700 if MACH_CFA10036
-
 config ARCH_MXS_OF_SUPPORT
bool
select COMMON_CLK_OF_PROVIDER
diff --git a/arch/arm/mach-omap/Kconfig b/arch/arm/mach-omap/Kconfig
index 6ddbb6e572..7b0eade65a 100644
--- a/arch/arm/mach-omap/Kco

[PATCH 14/15] ARM: make relocatable mandatory

2024-04-25 Thread Sascha Hauer
Most ARM boards use relocatable binaries already. Make it mandatory
for the remaining boards to better unify the ARM support.

Signed-off-by: Sascha Hauer 
---
 arch/arm/Kconfig   | 10 ++
 arch/arm/Makefile  | 16 ++--
 arch/arm/cpu/exceptions_32.S   |  2 +-
 arch/arm/cpu/start.c   |  3 +--
 arch/arm/cpu/uncompress.c  | 27 +++
 arch/arm/include/asm/barebox-arm.h | 11 ++-
 arch/arm/lib/pbl.lds.S | 18 ++
 arch/arm/lib32/barebox.lds.S   |  4 
 arch/arm/lib64/barebox.lds.S   |  4 
 arch/arm/mach-rockchip/Kconfig |  1 -
 arch/arm/mach-zynq/Kconfig |  3 ---
 11 files changed, 25 insertions(+), 74 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 9acda8d929..6a6d7955d1 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -4,7 +4,6 @@ config ARM
bool
select HAS_KALLSYMS
select HAS_CACHE
-   select HAVE_CONFIGURABLE_TEXT_BASE if !RELOCATABLE
select HAVE_IMAGE_COMPRESSION
select HAVE_ARCH_KASAN
select ARCH_HAS_SJLJ
@@ -12,6 +11,8 @@ config ARM
select HAVE_EFI_STUB
select HAVE_PBL_IMAGE
select HAVE_PBL_MULTI_IMAGES
+   select RELOCATABLE
+   select PBL_RELOCATABLE
default y
 
 config ARM_LINUX
@@ -67,7 +68,6 @@ config ARCH_CLPS711X
select GPIOLIB
select HAS_DEBUG_LL
select MFD_SYSCON
-   select RELOCATABLE
 
 config ARCH_MVEBU
bool "Marvell EBU platforms"
@@ -115,7 +115,6 @@ config ARCH_TEGRA
select GPIO_TEGRA
select OFDEVICE
select OFTREE
-   select RELOCATABLE
select RESET_CONTROLLER
select PINCTRL
 
@@ -131,7 +130,6 @@ config ARCH_ARM64_VIRT
bool "ARM64 QEMU Virt board"
depends on 64BIT
select CPU_V8
-   select RELOCATABLE
select ARM_AMBA
select BOARD_ARM_VIRT
select HW_HAS_PCI
@@ -145,7 +143,6 @@ config ARCH_BCM283X
select CLOCKSOURCE_BCM283X
select ARM_AMBA
select HAS_DEBUG_LL
-   select RELOCATABLE
 
 config ARCH_IMX
bool "Freescale iMX-based"
@@ -154,7 +151,6 @@ config ARCH_IMX
select COMMON_CLK
select WATCHDOG_IMX_RESET_SOURCE
select HAS_DEBUG_LL
-   select RELOCATABLE
 
 config ARCH_K3
bool "Texas Instruments Inc. K3 multicore SoC architecture"
@@ -229,7 +225,6 @@ config ARCH_VEXPRESS
select AMBA_SP804
select COMMON_CLK
select COMMON_CLK_OF_PROVIDER
-   select RELOCATABLE
 
 config ARCH_ZYNQMP
bool "Xilinx ZynqMP-based boards"
@@ -240,7 +235,6 @@ config ARCH_ZYNQMP
select COMMON_CLK
select COMMON_CLK_OF_PROVIDER
select GPIOLIB
-   select RELOCATABLE
select HAS_MACB
 
 source "arch/arm/cpu/Kconfig"
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 67362d2023..f98770f66a 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -108,24 +108,12 @@ KBUILD_CPPFLAGS += -DTEXT_BASE=$(TEXT_BASE)
 
 # Add cleanup flags
 KBUILD_CPPFLAGS += -fdata-sections -ffunction-sections
-LDFLAGS_barebox += --gc-sections
-LDFLAGS_pbl += --gc-sections
+LDFLAGS_barebox += --gc-sections -pie
+LDFLAGS_pbl += --gc-sections -pie
 
 # early code often runs at addresses we are not linked at
 KBUILD_CFLAGS_KERNEL += -fPIE
 
-ifdef CONFIG_RELOCATABLE
-LDFLAGS_barebox += -pie
-else
-LDFLAGS_barebox += -static
-endif
-
-ifdef CONFIG_PBL_RELOCATABLE
-LDFLAGS_pbl += -pie
-else
-LDFLAGS_pbl += -static
-endif
-
 KBUILD_BINARY := barebox.bin
 
 quiet_cmd_mlo ?= IFT $@
diff --git a/arch/arm/cpu/exceptions_32.S b/arch/arm/cpu/exceptions_32.S
index 749c713aab..235996f7ec 100644
--- a/arch/arm/cpu/exceptions_32.S
+++ b/arch/arm/cpu/exceptions_32.S
@@ -128,7 +128,7 @@ fiq:
bad_save_user_regs
bl  do_fiq
 
-#if defined(CONFIG_RELOCATABLE) && defined(CONFIG_ARM_EXCEPTIONS)
+#ifdef CONFIG_ARM_EXCEPTIONS
 /*
  * With relocatable binary support the runtime exception vectors do not match
  * the addresses in the binary. We have to fix them up during runtime
diff --git a/arch/arm/cpu/start.c b/arch/arm/cpu/start.c
index cc5529eef5..6d0a7cfc6b 100644
--- a/arch/arm/cpu/start.c
+++ b/arch/arm/cpu/start.c
@@ -158,8 +158,7 @@ __noreturn __prereloc void barebox_non_pbl_start(unsigned 
long membase,
if (IS_ENABLED(CONFIG_CPU_V7))
armv7_hyp_install();
 
-   if (IS_ENABLED(CONFIG_RELOCATABLE))
-   relocate_to_adr(barebox_base);
+   relocate_to_adr(barebox_base);
 
setup_c();
 
diff --git a/arch/arm/cpu/uncompress.c b/arch/arm/cpu/uncompress.c
index 4101cb36a4..aa1a49bfc9 100644
--- a/arch/arm/cpu/uncompress.c
+++ b/arch/arm/cpu/uncompress.c
@@ -43,26 +43,21 @@ void __noreturn barebox_pbl_start(unsigned long membase, 
unsigned long memsize,
pg_start = runtime_

[PATCH 13/15] ARM: drop barebox_arm_head()

2024-04-25 Thread Sascha Hauer
barebox_arm_head() is unused now. Remove it.

Signed-off-by: Sascha Hauer 
---
 arch/arm/include/asm/barebox-arm-head.h | 8 
 include/mach/socfpga/barebox-arm-head.h | 7 ---
 2 files changed, 15 deletions(-)

diff --git a/arch/arm/include/asm/barebox-arm-head.h 
b/arch/arm/include/asm/barebox-arm-head.h
index 135d0585b1..a55cf7df51 100644
--- a/arch/arm/include/asm/barebox-arm-head.h
+++ b/arch/arm/include/asm/barebox-arm-head.h
@@ -9,7 +9,6 @@
 
 void arm_cpu_lowlevel_init(void);
 void cortex_a7_lowlevel_init(void);
-void barebox_arm_reset_vector(uint32_t r0, uint32_t r1, uint32_t r2);
 
 /*
  * 32 bytes at this offset is reserved in the barebox head for board/SoC
@@ -60,13 +59,6 @@ static inline void __barebox_arm_head(void)
 #endif
);
 }
-static inline void barebox_arm_head(void)
-{
-   __barebox_arm_head();
-   __asm__ __volatile__ (
-   "b barebox_arm_reset_vector\n"
-   );
-}
 #endif
 
 #endif /* __ASSEMBLY__ */
diff --git a/include/mach/socfpga/barebox-arm-head.h 
b/include/mach/socfpga/barebox-arm-head.h
index 634d3f109b..eff05b0e41 100644
--- a/include/mach/socfpga/barebox-arm-head.h
+++ b/include/mach/socfpga/barebox-arm-head.h
@@ -35,10 +35,3 @@ static inline void __barebox_arm_head(void)
"2:\n"
);
 }
-static inline void barebox_arm_head(void)
-{
-   __barebox_arm_head();
-   __asm__ __volatile__ (
-   "b barebox_arm_reset_vector\n"
-   );
-}
-- 
2.39.2




[PATCH 11/15] ARM: move HAVE_PBL_MULTI_IMAGES to toplevel

2024-04-25 Thread Sascha Hauer
All ARM architectures now have PBL multi image support, so move
HAVE_PBL_MULTI_IMAGES and HAVE_PBL_IMAGE to the toplevel ARM
config.

Signed-off-by: Sascha Hauer 
---
 arch/arm/Kconfig  |  9 ++---
 arch/arm/cpu/Kconfig  |  3 ---
 arch/arm/cpu/uncompress.c | 13 -
 arch/arm/mach-omap/Kconfig|  1 -
 arch/arm/mach-socfpga/Kconfig |  2 --
 arch/arm/mach-zynq/Kconfig|  1 -
 6 files changed, 2 insertions(+), 27 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 5a10b5aaa3..e2ea68e762 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -10,6 +10,8 @@ config ARM
select ARCH_HAS_SJLJ
select ARM_OPTIMZED_STRING_FUNCTIONS if KASAN
select HAVE_EFI_STUB
+   select HAVE_PBL_IMAGE
+   select HAVE_PBL_MULTI_IMAGES
default y
 
 config ARM_LINUX
@@ -42,7 +44,6 @@ choice
prompt "ARM system type"
 
 config ARCH_MULTIARCH
-   select HAVE_PBL_MULTI_IMAGES
select OFTREE
select OFDEVICE
bool "Allow multiple archs to be selected"
@@ -52,7 +53,6 @@ config ARCH_AT91
depends on 32BIT
select GPIOLIB
select CLKDEV_LOOKUP
-   select HAVE_PBL_MULTI_IMAGES
select HAS_DEBUG_LL
select HAVE_CLK
select COMMON_CLK_AT91 if COMMON_CLK_OF_PROVIDER
@@ -66,7 +66,6 @@ config ARCH_CLPS711X
select CPU_32v4T
select GPIOLIB
select HAS_DEBUG_LL
-   select HAVE_PBL_MULTI_IMAGES
select MFD_SYSCON
select RELOCATABLE
 
@@ -77,7 +76,6 @@ config ARCH_MVEBU
select COMMON_CLK_OF_PROVIDER
select GPIOLIB
select HAS_DEBUG_LL
-   select HAVE_PBL_MULTI_IMAGES
select HW_HAS_PCI
select MVEBU_MBUS
select OFTREE
@@ -91,7 +89,6 @@ config ARCH_MXS
select GENERIC_GPIO
select COMMON_CLK
select HAS_DEBUG_LL
-   select HAVE_PBL_MULTI_IMAGES
 
 config ARCH_PXA
bool "Intel/Marvell PXA based"
@@ -116,7 +113,6 @@ config ARCH_TEGRA
select COMMON_CLK_OF_PROVIDER
select GPIOLIB
select GPIO_TEGRA
-   select HAVE_PBL_MULTI_IMAGES
select OFDEVICE
select OFTREE
select RELOCATABLE
@@ -277,7 +273,6 @@ config BOARD_ARM_VIRT
 config BOARD_ARM_GENERIC_DT
select BOARD_GENERIC_DT
select ARM_AMBA
-   depends on HAVE_PBL_MULTI_IMAGES
depends on OFDEVICE
bool "Build generic ARM device tree 2nd stage image"
help
diff --git a/arch/arm/cpu/Kconfig b/arch/arm/cpu/Kconfig
index e69acaacdf..6563394a7a 100644
--- a/arch/arm/cpu/Kconfig
+++ b/arch/arm/cpu/Kconfig
@@ -10,14 +10,11 @@ config CPU_32
select HAS_MODULES
select HAVE_MOD_ARCH_SPECIFIC
select HAS_DMA
-   select HAVE_PBL_IMAGE
select ARCH_HAS_ZERO_PAGE
 
 config CPU_64
bool
select PHYS_ADDR_T_64BIT
-   select HAVE_PBL_IMAGE
-   select HAVE_PBL_MULTI_IMAGES
select HAS_DMA
select ARCH_WANT_FRAME_POINTERS
select ARCH_HAS_ZERO_PAGE
diff --git a/arch/arm/cpu/uncompress.c b/arch/arm/cpu/uncompress.c
index a481c4634d..4101cb36a4 100644
--- a/arch/arm/cpu/uncompress.c
+++ b/arch/arm/cpu/uncompress.c
@@ -23,19 +23,6 @@
 
 #include "entry.h"
 
-#ifndef CONFIG_HAVE_PBL_MULTI_IMAGES
-
-void start_pbl(void);
-
-/*
- * First instructions in the pbl image
- */
-void __naked __section(.text_head_entry_start_single_pbl) start_pbl(void)
-{
-   barebox_arm_head();
-}
-#endif
-
 unsigned long free_mem_ptr;
 unsigned long free_mem_end_ptr;
 
diff --git a/arch/arm/mach-omap/Kconfig b/arch/arm/mach-omap/Kconfig
index fe3c6316dc..6ddbb6e572 100644
--- a/arch/arm/mach-omap/Kconfig
+++ b/arch/arm/mach-omap/Kconfig
@@ -182,7 +182,6 @@ config MACH_VSCOM_BALTOS
 config MACH_WAGO_PFC_AM35XX
 bool "Wago PFC200 Fieldbus Controller"
 select ARCH_AM35XX
-select HAVE_PBL_MULTI_IMAGES
 select HAVE_CONFIGURABLE_MEMORY_LAYOUT
 help
   Say Y here if you are using a the AM3505 based PFC200 controller
diff --git a/arch/arm/mach-socfpga/Kconfig b/arch/arm/mach-socfpga/Kconfig
index b23a41d3f9..75f03d3f6a 100644
--- a/arch/arm/mach-socfpga/Kconfig
+++ b/arch/arm/mach-socfpga/Kconfig
@@ -15,7 +15,6 @@ comment "Altera SoCFPGA System-on-Chip"
 config ARCH_SOCFPGA_CYCLONE5
bool
select CPU_V7
-   select HAVE_PBL_MULTI_IMAGES
select OFDEVICE if !ARCH_SOCFPGA_XLOAD
select OFTREE if !ARCH_SOCFPGA_XLOAD
select GPIOLIB if !ARCH_SOCFPGA_XLOAD
@@ -25,7 +24,6 @@ config ARCH_SOCFPGA_ARRIA10
select CPU_V7
select ARM_USE_COMPRESSED_DTB
select RESET_CONTROLLER
-   select HAVE_PBL_MULTI_IMAGES
select OFDEVICE
select OFTREE
 
diff --git a/arch/arm/mach-zynq/Kconfig b/arch/arm/mach-zynq/Kconfig
index 451a344b2e..be51411a43 100644
--- a/arch/arm/mach-zynq/Kconfig
+++ b/arch/arm/mach-zynq/Kconfig
@@ -17

[PATCH 12/15] ARM: drop non PBL support

2024-04-25 Thread Sascha Hauer
All ARM boards now use PBL, so remove unused code inside #ifdef
CONFIG_PBL_IMAGE.

Signed-off-by: Sascha Hauer 
---
 arch/arm/Kconfig |  1 -
 arch/arm/cpu/entry_ll_32.S   |  4 
 arch/arm/cpu/entry_ll_64.S   |  4 
 arch/arm/cpu/start.c | 17 -
 arch/arm/lib32/barebox.lds.S |  3 ---
 arch/arm/lib64/barebox.lds.S |  3 ---
 6 files changed, 32 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index e2ea68e762..9acda8d929 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -123,7 +123,6 @@ config ARCH_ZYNQ
bool "Xilinx Zynq-based boards"
depends on 32BIT
select HAS_DEBUG_LL
-   select PBL_IMAGE
select GPIOLIB
 
 endchoice
diff --git a/arch/arm/cpu/entry_ll_32.S b/arch/arm/cpu/entry_ll_32.S
index 2800174c45..0d4c47c1c8 100644
--- a/arch/arm/cpu/entry_ll_32.S
+++ b/arch/arm/cpu/entry_ll_32.S
@@ -19,9 +19,5 @@ ENTRY(__barebox_arm_entry)
mov r0, r4
mov r1, r5
mov r2, r6
-#if IS_ENABLED(CONFIG_PBL_IMAGE)
b   barebox_pbl_start
-#else
-   b   barebox_non_pbl_start
-#endif
 ENDPROC(__barebox_arm_entry)
diff --git a/arch/arm/cpu/entry_ll_64.S b/arch/arm/cpu/entry_ll_64.S
index 6530bec5eb..5eb6efed5b 100644
--- a/arch/arm/cpu/entry_ll_64.S
+++ b/arch/arm/cpu/entry_ll_64.S
@@ -19,9 +19,5 @@ ENTRY(__barebox_arm_entry)
mov x0, x19
mov x1, x20
mov x2, x21
-#if IS_ENABLED(CONFIG_PBL_IMAGE)
b   barebox_pbl_start
-#else
-   b   barebox_non_pbl_start
-#endif
 ENDPROC(__barebox_arm_entry)
diff --git a/arch/arm/cpu/start.c b/arch/arm/cpu/start.c
index 0351dcb927..cc5529eef5 100644
--- a/arch/arm/cpu/start.c
+++ b/arch/arm/cpu/start.c
@@ -224,11 +224,6 @@ __noreturn __prereloc void barebox_non_pbl_start(unsigned 
long membase,
 
mem_malloc_init((void *)malloc_start, (void *)malloc_end - 1);
 
-   if (IS_ENABLED(CONFIG_MMU) && !IS_ENABLED(CONFIG_PBL_IMAGE)) {
-   arm_early_mmu_cache_invalidate();
-   mmu_early_enable(membase, memsize);
-   }
-
if (IS_ENABLED(CONFIG_BOOTM_OPTEE))
of_add_reserve_entry(endmem - OPTEE_SIZE, endmem - 1);
 
@@ -237,17 +232,6 @@ __noreturn __prereloc void barebox_non_pbl_start(unsigned 
long membase,
start_barebox();
 }
 
-#ifndef CONFIG_PBL_IMAGE
-
-void start(void);
-
-void NAKED __section(.text_entry) start(void)
-{
-   barebox_arm_head();
-}
-
-#else
-
 void start(unsigned long membase, unsigned long memsize, void *boarddata);
 /*
  * First function in the uncompressed image. We get here from
@@ -258,4 +242,3 @@ void NAKED __prereloc __section(.text_entry) start(unsigned 
long membase,
 {
barebox_non_pbl_start(membase, memsize, boarddata);
 }
-#endif
diff --git a/arch/arm/lib32/barebox.lds.S b/arch/arm/lib32/barebox.lds.S
index ec145569be..90be773840 100644
--- a/arch/arm/lib32/barebox.lds.S
+++ b/arch/arm/lib32/barebox.lds.S
@@ -16,9 +16,6 @@ SECTIONS
 #endif
.image_start : { *(.__image_start) }
 
-#ifndef CONFIG_PBL_IMAGE
-   PRE_IMAGE
-#endif
. = ALIGN(4);
 
._text : { *(._text) }
diff --git a/arch/arm/lib64/barebox.lds.S b/arch/arm/lib64/barebox.lds.S
index de777ddb54..a05340ad48 100644
--- a/arch/arm/lib64/barebox.lds.S
+++ b/arch/arm/lib64/barebox.lds.S
@@ -16,9 +16,6 @@ SECTIONS
 
.image_start : { *(.__image_start) }
 
-#ifndef CONFIG_PBL_IMAGE
-   PRE_IMAGE
-#endif
. = ALIGN(4);
._text : { *(._text) }
.text  :
-- 
2.39.2




[PATCH 04/15] ARM: remove ep93xx

2024-04-25 Thread Sascha Hauer
None of the ep93xx boards supports PBL. PBL becomes mandatory, so remove
the boards and with it the now unused architecture.

Signed-off-by: Sascha Hauer 
---
 arch/arm/Kconfig  |   7 -
 arch/arm/Makefile |   1 -
 arch/arm/boards/Makefile  |   8 -
 arch/arm/boards/edb93xx/Makefile  |   4 -
 arch/arm/boards/edb93xx/early_udelay.h|  15 -
 arch/arm/boards/edb93xx/edb93xx.c | 121 
 arch/arm/boards/edb93xx/edb93xx.h |  29 -
 arch/arm/boards/edb93xx/env/bin/boot  |  48 --
 .../boards/edb93xx/env/bin/flash_partition|  22 -
 arch/arm/boards/edb93xx/env/bin/init  |  19 -
 arch/arm/boards/edb93xx/env/bin/set_nor_parts |   3 -
 arch/arm/boards/edb93xx/env/bin/update_kernel |  16 -
 arch/arm/boards/edb93xx/env/bin/update_rootfs |  16 -
 arch/arm/boards/edb93xx/env/config|  16 -
 arch/arm/boards/edb93xx/flash_cfg.c   |  22 -
 arch/arm/boards/edb93xx/pll_cfg.c |  41 --
 arch/arm/boards/edb93xx/pll_cfg.h |  53 --
 arch/arm/boards/edb93xx/sdram_cfg.c   | 128 
 arch/arm/boards/edb93xx/sdram_cfg.h   | 125 
 arch/arm/configs/edb93xx_defconfig|  32 -
 arch/arm/include/asm/barebox.lds.h|   4 -
 arch/arm/include/asm/debug_ll.h   |   2 -
 arch/arm/include/asm/mach-types.h |  96 ---
 arch/arm/mach-ep93xx/Kconfig  | 411 
 arch/arm/mach-ep93xx/Makefile |   5 -
 arch/arm/mach-ep93xx/clocksource.c|  93 ---
 arch/arm/mach-ep93xx/gpio.c   | 134 
 arch/arm/mach-ep93xx/header.c |  12 -
 arch/arm/mach-ep93xx/led.c|  57 --
 arch/arm/mach-ep93xx/led.h|  19 -
 arch/arm/mach-ep93xx/lowlevel_init.S  |  61 --
 include/mach/ep93xx/barebox.lds.h |  10 -
 include/mach/ep93xx/ep93xx-regs.h | 599 --
 33 files changed, 2229 deletions(-)
 delete mode 100644 arch/arm/boards/edb93xx/Makefile
 delete mode 100644 arch/arm/boards/edb93xx/early_udelay.h
 delete mode 100644 arch/arm/boards/edb93xx/edb93xx.c
 delete mode 100644 arch/arm/boards/edb93xx/edb93xx.h
 delete mode 100644 arch/arm/boards/edb93xx/env/bin/boot
 delete mode 100644 arch/arm/boards/edb93xx/env/bin/flash_partition
 delete mode 100644 arch/arm/boards/edb93xx/env/bin/init
 delete mode 100644 arch/arm/boards/edb93xx/env/bin/set_nor_parts
 delete mode 100644 arch/arm/boards/edb93xx/env/bin/update_kernel
 delete mode 100644 arch/arm/boards/edb93xx/env/bin/update_rootfs
 delete mode 100644 arch/arm/boards/edb93xx/env/config
 delete mode 100644 arch/arm/boards/edb93xx/flash_cfg.c
 delete mode 100644 arch/arm/boards/edb93xx/pll_cfg.c
 delete mode 100644 arch/arm/boards/edb93xx/pll_cfg.h
 delete mode 100644 arch/arm/boards/edb93xx/sdram_cfg.c
 delete mode 100644 arch/arm/boards/edb93xx/sdram_cfg.h
 delete mode 100644 arch/arm/configs/edb93xx_defconfig
 delete mode 100644 arch/arm/mach-ep93xx/Kconfig
 delete mode 100644 arch/arm/mach-ep93xx/Makefile
 delete mode 100644 arch/arm/mach-ep93xx/clocksource.c
 delete mode 100644 arch/arm/mach-ep93xx/gpio.c
 delete mode 100644 arch/arm/mach-ep93xx/header.c
 delete mode 100644 arch/arm/mach-ep93xx/led.c
 delete mode 100644 arch/arm/mach-ep93xx/led.h
 delete mode 100644 arch/arm/mach-ep93xx/lowlevel_init.S
 delete mode 100644 include/mach/ep93xx/barebox.lds.h
 delete mode 100644 include/mach/ep93xx/ep93xx-regs.h

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 0b4333db6a..837c7eb9f4 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -87,12 +87,6 @@ config ARCH_DIGIC
help
  Support for Canon's digital cameras that use the DIGIC4 chip.
 
-config ARCH_EP93XX
-   bool "Cirrus Logic EP93xx"
-   depends on 32BIT
-   select CPU_ARM920T
-   select GENERIC_GPIO
-
 config ARCH_MVEBU
bool "Marvell EBU platforms"
depends on 32BIT
@@ -292,7 +286,6 @@ source "arch/arm/mach-bcm283x/Kconfig"
 source "arch/arm/mach-clps711x/Kconfig"
 source "arch/arm/mach-davinci/Kconfig"
 source "arch/arm/mach-digic/Kconfig"
-source "arch/arm/mach-ep93xx/Kconfig"
 source "arch/arm/mach-imx/Kconfig"
 source "arch/arm/mach-layerscape/Kconfig"
 source "arch/arm/mach-mxs/Kconfig"
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 1c8ec48988..a08be94687 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -87,7 +87,6 @@ machine-$(CONFIG_ARCH_BCM283X)+= bcm283x
 machine-$(CONFIG_ARCH_CLPS711X)+= clps711x
 machine-$(CONFIG_ARCH_DAVINCI) += davinci
 machine-$(CONFIG_ARCH_DIGIC)   += digic
-machine-$(CONFIG_ARCH_EP93XX)  += ep93xx
 machine-$(CONFIG_ARCH_IMX) += imx
 machine-$(CONFIG_ARCH_K3)  += k3
 machine-$(CONFIG_

[PATCH 08/15] ARM: remove nomadik

2024-04-25 Thread Sascha Hauer
Nomadik was mainlined once and has never got any attention. It still
doesn't have PBL support or device tree support. Remove the ancient
and likely unused architecture.

Signed-off-by: Sascha Hauer 
---
 arch/arm/Kconfig  |  10 --
 arch/arm/Makefile |   1 -
 arch/arm/boards/Makefile  |   1 -
 arch/arm/boards/nhk8815/Makefile  |   5 -
 .../boards/nhk8815/defaultenv-nhk8815/config  |  43 ---
 arch/arm/boards/nhk8815/lowlevel.c|  12 --
 arch/arm/boards/nhk8815/setup.c   | 113 --
 arch/arm/configs/nhk8815_defconfig|  50 
 arch/arm/include/asm/debug_ll.h   |   2 -
 arch/arm/include/asm/mach-types.h |  12 --
 arch/arm/mach-nomadik/8815.c  |  71 ---
 arch/arm/mach-nomadik/Kconfig |  23 
 arch/arm/mach-nomadik/Makefile|   4 -
 arch/arm/mach-nomadik/clock.c |  55 -
 arch/arm/mach-nomadik/clock.h |  14 ---
 arch/arm/mach-nomadik/reset.c |  42 ---
 arch/arm/mach-nomadik/timer.c |  33 -
 include/mach/nomadik/board.h  |  24 
 include/mach/nomadik/fsmc.h   |  30 -
 include/mach/nomadik/hardware.h   |  87 --
 include/mach/nomadik/nand.h   |  15 ---
 21 files changed, 647 deletions(-)
 delete mode 100644 arch/arm/boards/nhk8815/Makefile
 delete mode 100644 arch/arm/boards/nhk8815/defaultenv-nhk8815/config
 delete mode 100644 arch/arm/boards/nhk8815/lowlevel.c
 delete mode 100644 arch/arm/boards/nhk8815/setup.c
 delete mode 100644 arch/arm/configs/nhk8815_defconfig
 delete mode 100644 arch/arm/mach-nomadik/8815.c
 delete mode 100644 arch/arm/mach-nomadik/Kconfig
 delete mode 100644 arch/arm/mach-nomadik/Makefile
 delete mode 100644 arch/arm/mach-nomadik/clock.c
 delete mode 100644 arch/arm/mach-nomadik/clock.h
 delete mode 100644 arch/arm/mach-nomadik/reset.c
 delete mode 100644 arch/arm/mach-nomadik/timer.c
 delete mode 100644 include/mach/nomadik/board.h
 delete mode 100644 include/mach/nomadik/fsmc.h
 delete mode 100644 include/mach/nomadik/hardware.h
 delete mode 100644 include/mach/nomadik/nand.h

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 7f84a1a12b..bf3240df96 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -93,15 +93,6 @@ config ARCH_MXS
select HAS_DEBUG_LL
select HAVE_PBL_MULTI_IMAGES
 
-config ARCH_NOMADIK
-   bool "STMicroelectronics Nomadik"
-   depends on 32BIT
-   select CPU_ARM926T
-   select CLOCKSOURCE_NOMADIK
-   select HAVE_LEGACY_CLK
-   help
- Support for the Nomadik platform by ST-Ericsson
-
 config ARCH_OMAP_SINGLE
bool "TI OMAP"
depends on 32BIT
@@ -271,7 +262,6 @@ source "arch/arm/mach-imx/Kconfig"
 source "arch/arm/mach-layerscape/Kconfig"
 source "arch/arm/mach-mxs/Kconfig"
 source "arch/arm/mach-mvebu/Kconfig"
-source "arch/arm/mach-nomadik/Kconfig"
 source "arch/arm/mach-k3/Kconfig"
 source "arch/arm/mach-omap/Kconfig"
 source "arch/arm/mach-pxa/Kconfig"
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index beb1c102c9..67362d2023 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -90,7 +90,6 @@ machine-$(CONFIG_ARCH_K3) += k3
 machine-$(CONFIG_ARCH_LAYERSCAPE)  += layerscape
 machine-$(CONFIG_ARCH_MXS) += mxs
 machine-$(CONFIG_ARCH_MVEBU)   += mvebu
-machine-$(CONFIG_ARCH_NOMADIK) += nomadik
 machine-$(CONFIG_ARCH_OMAP)+= omap
 machine-$(CONFIG_ARCH_PXA) += pxa
 machine-$(CONFIG_ARCH_ROCKCHIP)+= rockchip
diff --git a/arch/arm/boards/Makefile b/arch/arm/boards/Makefile
index fc7a829900..ca6f8f2137 100644
--- a/arch/arm/boards/Makefile
+++ b/arch/arm/boards/Makefile
@@ -63,7 +63,6 @@ obj-$(CONFIG_MACH_MX28EVK)+= 
freescale-mx28-evk/
 obj-$(CONFIG_MACH_MYIRTECH_X335X)  += myirtech-x335x/
 obj-$(CONFIG_MACH_NETGEAR_RN104)   += netgear-rn104/
 obj-$(CONFIG_MACH_NETGEAR_RN2120)  += netgear-rn2120/
-obj-$(CONFIG_MACH_NOMADIK_8815NHK) += nhk8815/
 obj-$(CONFIG_MACH_NVIDIA_BEAVER)   += nvidia-beaver/
 obj-$(CONFIG_MACH_NVIDIA_JETSON)   += nvidia-jetson-tk1/
 obj-$(CONFIG_MACH_NXP_IMX6ULL_EVK) += nxp-imx6ull-evk/
diff --git a/arch/arm/boards/nhk8815/Makefile b/arch/arm/boards/nhk8815/Makefile
deleted file mode 100644
index 0367fa7dd5..00
--- a/arch/arm/boards/nhk8815/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-only
-
-obj-y += setup.o
-lwl-y += lowlevel.o
-bbenv-$(CONFIG_DEFAULT_ENVIRONMENT_GENERIC) += defaultenv-nhk8815
diff --git a/arch/arm/boards/nhk8815/defaultenv-nhk8815/config 
b/arch/arm/board

[PATCH 01/15] ARM: move HAVE_PBL_MULTI_IMAGES up to ARCH_MULTIARCH

2024-04-25 Thread Sascha Hauer
All ARCH_MULTIARCH machines need HAVE_PBL_MULTI_IMAGES enabled, so
move selection of the symbol up to ARCH_MULTIARCH.

Signed-off-by: Sascha Hauer 
---
 arch/arm/Kconfig | 11 +--
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 1377679ac9..6ebcb1577f 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -42,6 +42,7 @@ choice
prompt "ARM system type"
 
 config ARCH_MULTIARCH
+   select HAVE_PBL_MULTI_IMAGES
bool "Allow multiple archs to be selected"
 
 config ARCH_AT91
@@ -181,7 +182,6 @@ config ARCH_ARM64_VIRT
bool "ARM64 QEMU Virt board"
depends on 64BIT
select CPU_V8
-   select HAVE_PBL_MULTI_IMAGES
select OFDEVICE
select OFTREE
select RELOCATABLE
@@ -201,7 +201,6 @@ config ARCH_BCM283X
select RELOCATABLE
select OFTREE
select OFDEVICE
-   select HAVE_PBL_MULTI_IMAGES
 
 config ARCH_IMX
bool "Freescale iMX-based"
@@ -210,7 +209,6 @@ config ARCH_IMX
select COMMON_CLK
select WATCHDOG_IMX_RESET_SOURCE
select HAS_DEBUG_LL
-   select HAVE_PBL_MULTI_IMAGES
select RELOCATABLE
 
 config ARCH_K3
@@ -219,7 +217,6 @@ config ARCH_K3
select CPU_V8
select GPIOLIB
select COMMON_CLK
-   select HAVE_PBL_MULTI_IMAGES
select HAS_DEBUG_LL
select COMMON_CLK_OF_PROVIDER
select PM_GENERIC_DOMAINS
@@ -229,7 +226,6 @@ config ARCH_LAYERSCAPE
depends on ARCH_MULTIARCH
select GPIOLIB
select HAS_DEBUG_LL
-   select HAVE_PBL_MULTI_IMAGES
select COMMON_CLK
select COMMON_CLK_OF_PROVIDER
select HW_HAS_PCI
@@ -256,7 +252,6 @@ config ARCH_ROCKCHIP
select PINCTRL
select PINCTRL_ROCKCHIP
select OFTREE
-   select HAVE_PBL_MULTI_IMAGES
select HAS_DEBUG_LL
imply GPIO_ROCKCHIP
 
@@ -265,7 +260,6 @@ config ARCH_STM32MP
depends on 32BIT
select ARCH_STM32
select CPU_V7
-   select HAVE_PBL_MULTI_IMAGES
select COMMON_CLK
select COMMON_CLK_OF_PROVIDER
select HAS_DEBUG_LL
@@ -284,7 +278,6 @@ config ARCH_VERSATILE
select HAS_DEBUG_LL
select COMMON_CLK
select COMMON_CLK_OF_PROVIDER
-   select HAVE_PBL_MULTI_IMAGES
 
 config ARCH_VEXPRESS
bool "ARM Vexpress & virt boards"
@@ -298,14 +291,12 @@ config ARCH_VEXPRESS
select OFTREE
select OFDEVICE
select RELOCATABLE
-   select HAVE_PBL_MULTI_IMAGES
 
 config ARCH_ZYNQMP
bool "Xilinx ZynqMP-based boards"
depends on 64BIT
select CPU_V8
select HAS_DEBUG_LL
-   select HAVE_PBL_MULTI_IMAGES
select ARM_SMCCC
select COMMON_CLK
select COMMON_CLK_OF_PROVIDER
-- 
2.39.2




[PATCH 06/15] ARM: remove davinci

2024-04-25 Thread Sascha Hauer
barebox davinci support is very minimal, the only supported board is
the virt2real board. This still has no PBL support which becomes
mandatory soon, so remove the architecture.

Signed-off-by: Sascha Hauer 
---
 arch/arm/Kconfig |   8 -
 arch/arm/Makefile|  13 --
 arch/arm/boards/Makefile |   1 -
 arch/arm/boards/virt2real/Makefile   |   4 -
 arch/arm/boards/virt2real/board.c|  15 --
 arch/arm/boards/virt2real/lowlevel.c |  28 
 arch/arm/configs/virt2real_defconfig |  45 --
 arch/arm/dts/Makefile|   1 -
 arch/arm/dts/virt2real.dts   |  36 -
 arch/arm/include/asm/debug_ll.h  |   2 -
 arch/arm/mach-davinci/Kconfig|  19 ---
 arch/arm/mach-davinci/Makefile   |   3 -
 arch/arm/mach-davinci/time.c | 216 ---
 include/mach/davinci/debug_ll.h  |  28 
 include/mach/davinci/hardware.h  |  27 
 include/mach/davinci/serial.h|  18 ---
 include/mach/davinci/time.h  |  18 ---
 scripts/Kconfig  |   7 -
 scripts/Makefile |   1 -
 scripts/mkublheader.c|  85 ---
 20 files changed, 575 deletions(-)
 delete mode 100644 arch/arm/boards/virt2real/Makefile
 delete mode 100644 arch/arm/boards/virt2real/board.c
 delete mode 100644 arch/arm/boards/virt2real/lowlevel.c
 delete mode 100644 arch/arm/configs/virt2real_defconfig
 delete mode 100644 arch/arm/dts/virt2real.dts
 delete mode 100644 arch/arm/mach-davinci/Kconfig
 delete mode 100644 arch/arm/mach-davinci/Makefile
 delete mode 100644 arch/arm/mach-davinci/time.c
 delete mode 100644 include/mach/davinci/debug_ll.h
 delete mode 100644 include/mach/davinci/hardware.h
 delete mode 100644 include/mach/davinci/serial.h
 delete mode 100644 include/mach/davinci/time.h
 delete mode 100644 scripts/mkublheader.c

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index b3e4330ffe..7f84a1a12b 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -70,13 +70,6 @@ config ARCH_CLPS711X
select MFD_SYSCON
select RELOCATABLE
 
-config ARCH_DAVINCI
-   bool "TI Davinci"
-   depends on 32BIT
-   select CPU_ARM926T
-   select HAS_DEBUG_LL
-   select GPIOLIB
-
 config ARCH_MVEBU
bool "Marvell EBU platforms"
depends on 32BIT
@@ -274,7 +267,6 @@ source "arch/arm/cpu/Kconfig"
 source "arch/arm/mach-at91/Kconfig"
 source "arch/arm/mach-bcm283x/Kconfig"
 source "arch/arm/mach-clps711x/Kconfig"
-source "arch/arm/mach-davinci/Kconfig"
 source "arch/arm/mach-imx/Kconfig"
 source "arch/arm/mach-layerscape/Kconfig"
 source "arch/arm/mach-mxs/Kconfig"
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index a183a5a61e..beb1c102c9 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -85,7 +85,6 @@ endif
 machine-$(CONFIG_ARCH_AT91)+= at91
 machine-$(CONFIG_ARCH_BCM283X) += bcm283x
 machine-$(CONFIG_ARCH_CLPS711X)+= clps711x
-machine-$(CONFIG_ARCH_DAVINCI) += davinci
 machine-$(CONFIG_ARCH_IMX) += imx
 machine-$(CONFIG_ARCH_K3)  += k3
 machine-$(CONFIG_ARCH_LAYERSCAPE)  += layerscape
@@ -140,18 +139,6 @@ ifeq ($(CONFIG_OMAP_BUILD_IFT),y)
 KBUILD_IMAGE := MLO
 endif
 
-quiet_cmd_davinci_ubl_image = UBL-IMG $@
-  cmd_davinci_ubl_image = set -e; \
-scripts/mkublheader $< > $@; \
-cat $< >> $@
-
-barebox.ubl: $(KBUILD_BINARY) FORCE
-   $(call if_changed,davinci_ubl_image)
-
-ifeq ($(CONFIG_ARCH_DAVINCI),y)
-KBUILD_IMAGE := barebox.ubl
-endif
-
 archclean:
$(MAKE) $(clean)=$(pbl)
 
diff --git a/arch/arm/boards/Makefile b/arch/arm/boards/Makefile
index a06c45d11d..022ba9903a 100644
--- a/arch/arm/boards/Makefile
+++ b/arch/arm/boards/Makefile
@@ -161,7 +161,6 @@ obj-$(CONFIG_MACH_USB_A9G20)+= 
usb-a926x/
 obj-$(CONFIG_MACH_USI_TOPKICK) += usi-topkick/
 obj-$(CONFIG_MACH_VERSATILEPB) += versatile/
 obj-$(CONFIG_MACH_VEXPRESS)+= vexpress/
-obj-$(CONFIG_MACH_VIRT2REAL)   += virt2real/
 obj-$(CONFIG_MACH_ZEDBOARD)+= avnet-zedboard/
 obj-$(CONFIG_MACH_ZYLONITE)+= zylonite/
 obj-$(CONFIG_MACH_VARISCITE_MX6)   += variscite-mx6/
diff --git a/arch/arm/boards/virt2real/Makefile 
b/arch/arm/boards/virt2real/Makefile
deleted file mode 100644
index da63d2625f..00
--- a/arch/arm/boards/virt2real/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-only
-
-obj-y += board.o
-lwl-y += lowlevel.o
diff --git a/arch/arm/boards/virt2real/board.c 
b/arch/arm/boards/virt2real/board.c
deleted file mode 100644
index caa2b53a68..00
--- a/arch/arm/boards/virt2real/board.c
+++ /dev/null
@@ -1,15 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-// SPDX-

[PATCH 07/15] ARM: remove PXA boards

2024-04-25 Thread Sascha Hauer
None of the PXA boards has PBL support. This becomes mandatory soon, so
remove the boards.

Signed-off-by: Sascha Hauer 
---
 arch/arm/boards/Makefile  |   5 -
 arch/arm/boards/lubbock/Makefile  |   4 -
 arch/arm/boards/lubbock/board.c   | 118 -
 arch/arm/boards/lubbock/env/boot/nor-ubi  |   5 -
 arch/arm/boards/lubbock/env/init/mtdparts-nor |   6 -
 .../lubbock/env/nv/linux.bootargs.console |   1 -
 arch/arm/boards/lubbock/lowlevel.c| 194 
 arch/arm/boards/mainstone/Makefile|   4 -
 arch/arm/boards/mainstone/board.c | 118 -
 arch/arm/boards/mainstone/env/boot/nor-ubi|   5 -
 .../boards/mainstone/env/init/mtdparts-nor|   6 -
 .../mainstone/env/nv/linux.bootargs.console   |   1 -
 arch/arm/boards/mainstone/lowlevel.c  | 266 ---
 arch/arm/boards/mioa701/Makefile  |   4 -
 arch/arm/boards/mioa701/board.c   | 274 ---
 .../arm/boards/mioa701/env/bin/barebox_update |  11 -
 arch/arm/boards/mioa701/env/bin/console_mode  |   6 -
 arch/arm/boards/mioa701/env/bin/dps1_unlock   |  12 -
 arch/arm/boards/mioa701/env/bin/dps1_update   |  12 -
 arch/arm/boards/mioa701/env/bin/init  |  79 ---
 .../boards/mioa701/env/bin/mtd_env_override   |   4 -
 .../boards/mioa701/env/bin/sdcard_override|  19 -
 arch/arm/boards/mioa701/env/config|   6 -
 arch/arm/boards/mioa701/env/data/dps1.raw.gz  | Bin 1324 -> 0 bytes
 arch/arm/boards/mioa701/gpio0_poweroff.c  |  67 ---
 arch/arm/boards/mioa701/lowlevel.c|  12 -
 arch/arm/boards/mioa701/mioa701.h |  67 ---
 .../arm/boards/phytec-phycore-pxa270/Makefile |   4 -
 arch/arm/boards/phytec-phycore-pxa270/board.c | 171 ---
 .../arm/boards/phytec-phycore-pxa270/config.h | 314 
 .../env/init/mtdparts-nor |   6 -
 .../env/nv/linux.bootargs.console |   1 -
 .../phytec-phycore-pxa270/lowlevel_init.S | 448 --
 arch/arm/boards/zylonite/Makefile |   4 -
 arch/arm/boards/zylonite/board.c  |  93 
 arch/arm/boards/zylonite/env/boot/nand-ubi|   5 -
 .../boards/zylonite/env/init/mtdparts-nand|   6 -
 arch/arm/boards/zylonite/env/nv/hostname  |   1 -
 .../zylonite/env/nv/linux.bootargs.base   |   1 -
 .../zylonite/env/nv/linux.bootargs.console|   1 -
 arch/arm/boards/zylonite/lowlevel.c   |  12 -
 arch/arm/configs/lubbock_defconfig| 100 
 arch/arm/configs/mainstone_defconfig  | 103 
 arch/arm/configs/mioa701_defconfig| 104 
 .../configs/phytec-phycore-pxa270_defconfig   |  60 ---
 arch/arm/configs/zylonite310_defconfig| 104 
 arch/arm/include/asm/mach-types.h |  60 ---
 arch/arm/mach-pxa/Kconfig |  87 
 48 files changed, 2991 deletions(-)
 delete mode 100644 arch/arm/boards/lubbock/Makefile
 delete mode 100644 arch/arm/boards/lubbock/board.c
 delete mode 100644 arch/arm/boards/lubbock/env/boot/nor-ubi
 delete mode 100644 arch/arm/boards/lubbock/env/init/mtdparts-nor
 delete mode 100644 arch/arm/boards/lubbock/env/nv/linux.bootargs.console
 delete mode 100644 arch/arm/boards/lubbock/lowlevel.c
 delete mode 100644 arch/arm/boards/mainstone/Makefile
 delete mode 100644 arch/arm/boards/mainstone/board.c
 delete mode 100644 arch/arm/boards/mainstone/env/boot/nor-ubi
 delete mode 100644 arch/arm/boards/mainstone/env/init/mtdparts-nor
 delete mode 100644 arch/arm/boards/mainstone/env/nv/linux.bootargs.console
 delete mode 100644 arch/arm/boards/mainstone/lowlevel.c
 delete mode 100644 arch/arm/boards/mioa701/Makefile
 delete mode 100644 arch/arm/boards/mioa701/board.c
 delete mode 100644 arch/arm/boards/mioa701/env/bin/barebox_update
 delete mode 100644 arch/arm/boards/mioa701/env/bin/console_mode
 delete mode 100644 arch/arm/boards/mioa701/env/bin/dps1_unlock
 delete mode 100644 arch/arm/boards/mioa701/env/bin/dps1_update
 delete mode 100644 arch/arm/boards/mioa701/env/bin/init
 delete mode 100644 arch/arm/boards/mioa701/env/bin/mtd_env_override
 delete mode 100644 arch/arm/boards/mioa701/env/bin/sdcard_override
 delete mode 100644 arch/arm/boards/mioa701/env/config
 delete mode 100644 arch/arm/boards/mioa701/env/data/dps1.raw.gz
 delete mode 100644 arch/arm/boards/mioa701/gpio0_poweroff.c
 delete mode 100644 arch/arm/boards/mioa701/lowlevel.c
 delete mode 100644 arch/arm/boards/mioa701/mioa701.h
 delete mode 100644 arch/arm/boards/phytec-phycore-pxa270/Makefile
 delete mode 100644 arch/arm/boards/phytec-phycore-pxa270/board.c
 delete mode 100644 arch/arm/boards/phytec-phycore-pxa270/config.h
 delete mode 100644 arch/arm/boards/phytec-phycore-pxa270/env/init/mtdparts-nor
 delete mode 100644 
arch/arm/boards/phytec-phycore-pxa270/env/nv/linux.bootargs.console
 delete mode 100644 arch/arm/boards/phytec-phycore-pxa270/lowlevel_init.S
 delete mode 100644 arch/arm/boards/zylonite/Makef

[PATCH 05/15] ARM: remove canon-a1100 support

2024-04-25 Thread Sascha Hauer
canon-a1100 still doesn't have PBL support which will become mandatory
soon. Remove the architecture.

Signed-off-by: Sascha Hauer 
---
 arch/arm/Kconfig   | 11 --
 arch/arm/Makefile  | 11 --
 arch/arm/boards/Makefile   |  1 -
 arch/arm/boards/canon-a1100/Makefile   |  3 --
 arch/arm/boards/canon-a1100/lowlevel.c | 32 
 arch/arm/configs/canon-a1100_defconfig | 51 --
 arch/arm/dts/Makefile  |  1 -
 arch/arm/dts/canon-a1100.dts   | 36 --
 arch/arm/include/asm/debug_ll.h|  2 -
 arch/arm/mach-digic/Kconfig| 17 -
 arch/arm/mach-digic/Makefile   |  3 --
 include/mach/digic/debug_ll.h  | 39 
 include/mach/digic/digic4.h| 22 ---
 include/mach/digic/uart.h  | 27 --
 scripts/canon-a1100-image  | 12 --
 15 files changed, 268 deletions(-)
 delete mode 100644 arch/arm/boards/canon-a1100/Makefile
 delete mode 100644 arch/arm/boards/canon-a1100/lowlevel.c
 delete mode 100644 arch/arm/configs/canon-a1100_defconfig
 delete mode 100644 arch/arm/dts/canon-a1100.dts
 delete mode 100644 arch/arm/mach-digic/Kconfig
 delete mode 100644 arch/arm/mach-digic/Makefile
 delete mode 100644 include/mach/digic/debug_ll.h
 delete mode 100644 include/mach/digic/digic4.h
 delete mode 100644 include/mach/digic/uart.h
 delete mode 100755 scripts/canon-a1100-image

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 837c7eb9f4..b3e4330ffe 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -77,16 +77,6 @@ config ARCH_DAVINCI
select HAS_DEBUG_LL
select GPIOLIB
 
-config ARCH_DIGIC
-   bool "Canon DIGIC-based cameras"
-   depends on 32BIT
-   select CPU_ARM946E
-   select HAS_DEBUG_LL
-   select CLOCKSOURCE_DIGIC
-   select GPIOLIB
-   help
- Support for Canon's digital cameras that use the DIGIC4 chip.
-
 config ARCH_MVEBU
bool "Marvell EBU platforms"
depends on 32BIT
@@ -285,7 +275,6 @@ source "arch/arm/mach-at91/Kconfig"
 source "arch/arm/mach-bcm283x/Kconfig"
 source "arch/arm/mach-clps711x/Kconfig"
 source "arch/arm/mach-davinci/Kconfig"
-source "arch/arm/mach-digic/Kconfig"
 source "arch/arm/mach-imx/Kconfig"
 source "arch/arm/mach-layerscape/Kconfig"
 source "arch/arm/mach-mxs/Kconfig"
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index a08be94687..a183a5a61e 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -86,7 +86,6 @@ machine-$(CONFIG_ARCH_AT91)   += at91
 machine-$(CONFIG_ARCH_BCM283X) += bcm283x
 machine-$(CONFIG_ARCH_CLPS711X)+= clps711x
 machine-$(CONFIG_ARCH_DAVINCI) += davinci
-machine-$(CONFIG_ARCH_DIGIC)   += digic
 machine-$(CONFIG_ARCH_IMX) += imx
 machine-$(CONFIG_ARCH_K3)  += k3
 machine-$(CONFIG_ARCH_LAYERSCAPE)  += layerscape
@@ -153,16 +152,6 @@ ifeq ($(CONFIG_ARCH_DAVINCI),y)
 KBUILD_IMAGE := barebox.ubl
 endif
 
-quiet_cmd_canon_a1100_image = DD  $@
-  cmd_canon_a1100_image = scripts/canon-a1100-image $< $@ || \
-   echo "WARNING: Couldn't create Canon A1100 image due to previous 
errors."
-barebox.canon-a1100.bin: $(KBUILD_BINARY) FORCE
-   $(call if_changed,canon_a1100_image)
-
-ifeq ($(CONFIG_MACH_CANON_A1100),y)
-KBUILD_IMAGE := barebox.canon-a1100.bin
-endif
-
 archclean:
$(MAKE) $(clean)=$(pbl)
 
diff --git a/arch/arm/boards/Makefile b/arch/arm/boards/Makefile
index 2e41865890..a06c45d11d 100644
--- a/arch/arm/boards/Makefile
+++ b/arch/arm/boards/Makefile
@@ -19,7 +19,6 @@ obj-$(CONFIG_MACH_BEAGLE) += beagle/
 obj-$(CONFIG_MACH_BEAGLEBONE)  += beaglebone/
 obj-$(CONFIG_MACH_BEAGLEPLAY)  += beagleplay/
 obj-$(CONFIG_MACH_CALAO)   += calao/
-obj-$(CONFIG_MACH_CANON_A1100) += canon-a1100/
 obj-$(CONFIG_MACH_CM_FX6)  += cm-fx6/
 obj-$(CONFIG_MACH_NITROGEN6)   += boundarydevices-nitrogen6/
 obj-$(CONFIG_MACH_NOVENA)  += novena/
diff --git a/arch/arm/boards/canon-a1100/Makefile 
b/arch/arm/boards/canon-a1100/Makefile
deleted file mode 100644
index 458f520900..00
--- a/arch/arm/boards/canon-a1100/Makefile
+++ /dev/null
@@ -1,3 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-only
-
-lwl-y += lowlevel.o
diff --git a/arch/arm/boards/canon-a1100/lowlevel.c 
b/arch/arm/boards/canon-a1100/lowlevel.c
deleted file mode 100644
index 47a9564e0f..00
--- a/arch/arm/boards/canon-a1100/lowlevel.c
+++ /dev/null
@@ -1,32 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-
-#include 
-#include 
-#include 
-#include 
-
-extern char __dtb_canon_a1100_start[];
-
-void __naked barebox_arm_reset_vector(uint32_t r0, uint32_t 

[PATCH 02/15] ARM: move OFTREE and OFDEVICE up one level

2024-04-25 Thread Sascha Hauer
All ARCH_MULTIARCH machines are probing from device tree, so select
the necessary symbols from ARCH_MULTIARCH rather than individually
from the machines.

Signed-off-by: Sascha Hauer 
---
 arch/arm/Kconfig   | 13 ++---
 arch/arm/mach-imx/Kconfig  |  7 ---
 arch/arm/mach-omap/Kconfig |  1 -
 3 files changed, 2 insertions(+), 19 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 6ebcb1577f..728438dcf6 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -43,6 +43,8 @@ choice
 
 config ARCH_MULTIARCH
select HAVE_PBL_MULTI_IMAGES
+   select OFTREE
+   select OFDEVICE
bool "Allow multiple archs to be selected"
 
 config ARCH_AT91
@@ -182,8 +184,6 @@ config ARCH_ARM64_VIRT
bool "ARM64 QEMU Virt board"
depends on 64BIT
select CPU_V8
-   select OFDEVICE
-   select OFTREE
select RELOCATABLE
select ARM_AMBA
select BOARD_ARM_VIRT
@@ -199,8 +199,6 @@ config ARCH_BCM283X
select ARM_AMBA
select HAS_DEBUG_LL
select RELOCATABLE
-   select OFTREE
-   select OFDEVICE
 
 config ARCH_IMX
bool "Freescale iMX-based"
@@ -229,8 +227,6 @@ config ARCH_LAYERSCAPE
select COMMON_CLK
select COMMON_CLK_OF_PROVIDER
select HW_HAS_PCI
-   select OFTREE
-   select OFDEVICE
select ARM_USE_COMPRESSED_DTB
select OF_DMA_COHERENCY
 
@@ -251,7 +247,6 @@ config ARCH_ROCKCHIP
select GPIOLIB
select PINCTRL
select PINCTRL_ROCKCHIP
-   select OFTREE
select HAS_DEBUG_LL
imply GPIO_ROCKCHIP
 
@@ -288,8 +283,6 @@ config ARCH_VEXPRESS
select AMBA_SP804
select COMMON_CLK
select COMMON_CLK_OF_PROVIDER
-   select OFTREE
-   select OFDEVICE
select RELOCATABLE
 
 config ARCH_ZYNQMP
@@ -301,8 +294,6 @@ config ARCH_ZYNQMP
select COMMON_CLK
select COMMON_CLK_OF_PROVIDER
select GPIOLIB
-   select OFDEVICE
-   select OFTREE
select RELOCATABLE
select HAS_MACB
 
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index 6125813773..4d10def3c2 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -124,7 +124,6 @@ config ARCH_IMX6
select ARCH_HAS_IMX_GPT
select CPU_V7
select PINCTRL_IMX_IOMUX_V3
-   select OFDEVICE
select COMMON_CLK_OF_PROVIDER
select HW_HAS_PCI
 
@@ -144,7 +143,6 @@ config ARCH_IMX7
bool
select CPU_V7
select PINCTRL_IMX_IOMUX_V3
-   select OFTREE
select COMMON_CLK_OF_PROVIDER
select ARCH_HAS_FEC_IMX
select ARCH_HAS_IMX_GPT
@@ -154,7 +152,6 @@ config ARCH_IMX8M
bool
select CPU_V8
select PINCTRL_IMX_IOMUX_V3
-   select OFTREE
select COMMON_CLK_OF_PROVIDER
select ARCH_HAS_FEC_IMX
select HW_HAS_PCI
@@ -189,7 +186,6 @@ config ARCH_IMX93
select ARCH_IMX9
select CPU_V8
select PINCTRL_IMX_IOMUX_V3
-   select OFTREE
select COMMON_CLK_OF_PROVIDER
select ARM_USE_COMPRESSED_DTB
select ARCH_HAS_FEC_IMX
@@ -200,8 +196,6 @@ config ARCH_VF610
select ARCH_HAS_FEC_IMX
select CPU_V7
select PINCTRL
-   select OFDEVICE
-   select OFTREE
select COMMON_CLK
select COMMON_CLK_OF_PROVIDER
select NVMEM
@@ -825,7 +819,6 @@ config HABV4
select NVMEM
select IMX_OCOTP
depends on ARCH_IMX6 || ARCH_IMX8M
-   depends on OFDEVICE
help
  High Assurance Boot, as found on i.MX28/i.MX6/i.MX8M.
 
diff --git a/arch/arm/mach-omap/Kconfig b/arch/arm/mach-omap/Kconfig
index f0e035e31e..cb1ba9f7eb 100644
--- a/arch/arm/mach-omap/Kconfig
+++ b/arch/arm/mach-omap/Kconfig
@@ -39,7 +39,6 @@ config ARCH_AM33XX
bool
select CPU_V7
select GENERIC_GPIO
-   select OFTREE
select CLOCKSOURCE_TI_DM
select ARM_USE_COMPRESSED_DTB
help
-- 
2.39.2




[PATCH 03/15] ARM: remove uemd architecure

2024-04-25 Thread Sascha Hauer
mach-uemd is one of the architectures that still doesn't support PBL.
As PBL support becomes mandatory remove the architecture.

Signed-off-by: Sascha Hauer 
---
 arch/arm/Kconfig | 12 ---
 arch/arm/Makefile|  1 -
 arch/arm/boards/Makefile |  1 -
 arch/arm/boards/module-mb7707/Makefile   |  4 ---
 arch/arm/boards/module-mb7707/board.c| 31 
 arch/arm/boards/module-mb7707/lowlevel.c | 28 ---
 arch/arm/configs/module-mb7707_defconfig | 45 
 arch/arm/dts/Makefile|  1 -
 arch/arm/dts/k1879hb1ya.dtsi | 44 ---
 arch/arm/dts/module-mb7707.dts   | 25 -
 arch/arm/include/asm/debug_ll.h  |  2 --
 arch/arm/mach-uemd/Kconfig   | 17 -
 arch/arm/mach-uemd/Makefile  |  3 --
 include/mach/uemd/debug_ll.h | 41 -
 include/mach/uemd/hardware.h |  9 -
 15 files changed, 264 deletions(-)
 delete mode 100644 arch/arm/boards/module-mb7707/Makefile
 delete mode 100644 arch/arm/boards/module-mb7707/board.c
 delete mode 100644 arch/arm/boards/module-mb7707/lowlevel.c
 delete mode 100644 arch/arm/configs/module-mb7707_defconfig
 delete mode 100644 arch/arm/dts/k1879hb1ya.dtsi
 delete mode 100644 arch/arm/dts/module-mb7707.dts
 delete mode 100644 arch/arm/mach-uemd/Kconfig
 delete mode 100644 arch/arm/mach-uemd/Makefile
 delete mode 100644 include/mach/uemd/debug_ll.h
 delete mode 100644 include/mach/uemd/hardware.h

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 728438dcf6..0b4333db6a 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -160,17 +160,6 @@ config ARCH_TEGRA
select RESET_CONTROLLER
select PINCTRL
 
-config ARCH_UEMD
-   bool "RC Module UEMD Platform"
-   depends on 32BIT
-   select CPU_ARM1176
-   select COMMON_CLK
-   select COMMON_CLK_OF_PROVIDER
-   select OFDEVICE
-   select OFTREE
-   select CLOCKSOURCE_UEMD
-   select HAS_DEBUG_LL
-
 config ARCH_ZYNQ
bool "Xilinx Zynq-based boards"
depends on 32BIT
@@ -318,7 +307,6 @@ source "arch/arm/mach-stm32mp/Kconfig"
 source "arch/arm/mach-versatile/Kconfig"
 source "arch/arm/mach-vexpress/Kconfig"
 source "arch/arm/mach-tegra/Kconfig"
-source "arch/arm/mach-uemd/Kconfig"
 source "arch/arm/mach-zynq/Kconfig"
 source "arch/arm/mach-zynqmp/Kconfig"
 
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index ecc74838f6..1c8ec48988 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -103,7 +103,6 @@ machine-$(CONFIG_ARCH_STM32MP)  += stm32mp
 machine-$(CONFIG_ARCH_VERSATILE)   += versatile
 machine-$(CONFIG_ARCH_VEXPRESS)+= vexpress
 machine-$(CONFIG_ARCH_TEGRA)   += tegra
-machine-$(CONFIG_ARCH_UEMD)+= uemd
 machine-$(CONFIG_ARCH_ZYNQ)+= zynq
 machine-$(CONFIG_ARCH_ZYNQMP)  += zynqmp
 
diff --git a/arch/arm/boards/Makefile b/arch/arm/boards/Makefile
index 98eab17af2..eb4e80d3e0 100644
--- a/arch/arm/boards/Makefile
+++ b/arch/arm/boards/Makefile
@@ -69,7 +69,6 @@ obj-$(CONFIG_MACH_LUBBOCK)+= lubbock/
 obj-$(CONFIG_MACH_MAINSTONE)   += mainstone/
 obj-$(CONFIG_MACH_MARVELL_ARMADA_XP_GP)+= marvell-armada-xp-gp/
 obj-$(CONFIG_MACH_MARVELL_ARMADA_XP_DB)+= marvell-armada-xp-db/
-obj-$(CONFIG_MACH_MB7707)  += module-mb7707/
 obj-$(CONFIG_MACH_MIOA701) += mioa701/
 obj-$(CONFIG_MACH_MX23EVK) += freescale-mx23-evk/
 obj-$(CONFIG_MACH_MX28EVK) += freescale-mx28-evk/
diff --git a/arch/arm/boards/module-mb7707/Makefile 
b/arch/arm/boards/module-mb7707/Makefile
deleted file mode 100644
index da63d2625f..00
--- a/arch/arm/boards/module-mb7707/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-only
-
-obj-y += board.o
-lwl-y += lowlevel.o
diff --git a/arch/arm/boards/module-mb7707/board.c 
b/arch/arm/boards/module-mb7707/board.c
deleted file mode 100644
index 366baddf81..00
--- a/arch/arm/boards/module-mb7707/board.c
+++ /dev/null
@@ -1,31 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-// SPDX-FileCopyrightText: 2014 Antony Pavlov 
-
-/* This file is part of barebox. */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-
-static int hostname_init(void)
-{
-   barebox_set_hostname("mb7707");
-
-   return 0;
-}
-core_initcall(hostname_init);
-
-static struct ehci_platform_data ehci_pdata = {
-   .flags = 0,
-};
-
-static int mb7707_devices_init(void)
-{
-   add_usb_ehci_device(DEVICE_ID_DYNAMIC, UEMD_EHCI_BASE,
-   UEMD_EHCI_BASE + 0x10, _pdata);
-
-   return 0;
-}
-device_initcall(mb7707_devices_init);
diff --git a/arch/arm/boards

[PATCH 00/15] ARM: remove non PBL ARM boards and sub architectures

2024-04-25 Thread Sascha Hauer
The ARM architecture support in barebox has become quite complicated
over time.  Most SoCs use PBL and relocatable binaries, but some older
ones still don't.  This makes the lowlevel ARM code hard to maintain and
often hard to understand.

I've decided that it is time to make a cut and to abandon the old non
PBL boards and sometimes the sub architecture with it. This series
removes:

- mach-davinci
- mach-ep93xx
- mach-digic
- mach-nomadik
- mach-uemd
- non PBL Atmel AT91 boards
- non PBL OMAP boards

If you are still using one of these boards/sub architecures then please
speak up.  In some cases the conversion to PBL support is quite straight
forward and I could guide you through the process or create patches for
them. Anyway, I assume most of the sub architectures are unused so I
would do the work only if somebody actively shows interest.

Sascha Hauer (15):
  ARM: move HAVE_PBL_MULTI_IMAGES up to ARCH_MULTIARCH
  ARM: move OFTREE and OFDEVICE up one level
  ARM: remove uemd architecure
  ARM: remove ep93xx
  ARM: remove canon-a1100 support
  ARM: remove davinci
  ARM: remove PXA boards
  ARM: remove nomadik
  ARM: remove non PBL OMAP boards
  ARM: remove non PBL Atmel boards
  ARM: move HAVE_PBL_MULTI_IMAGES to toplevel
  ARM: drop non PBL support
  ARM: drop barebox_arm_head()
  ARM: make relocatable mandatory
  ARM: drop TEXT_BASE

 arch/arm/Kconfig  | 100 +--
 arch/arm/Makefile |  47 +-
 arch/arm/boards/Makefile  |  27 -
 arch/arm/boards/archosg9/Makefile |   5 -
 arch/arm/boards/archosg9/archos_features.c| 189 --
 arch/arm/boards/archosg9/archos_features.h|  24 -
 arch/arm/boards/archosg9/board.c  | 180 --
 .../boards/archosg9/env/boot/sd-card-android  |   6 -
 .../boards/archosg9/env/boot/sd-card-linux|  12 -
 arch/arm/boards/archosg9/env/boot/usb-android |   6 -
 arch/arm/boards/archosg9/env/boot/usb-linux   |  12 -
 arch/arm/boards/archosg9/env/init/automount2  |   7 -
 arch/arm/boards/archosg9/env/init/bootsource  |  15 -
 arch/arm/boards/archosg9/env/init/splash  |   5 -
 .../archosg9/env/menu/11-boot-flash/action|   4 -
 .../archosg9/env/menu/11-boot-flash/title |   1 -
 .../archosg9/env/menu/12-boot-sd/action   |   4 -
 .../boards/archosg9/env/menu/12-boot-sd/title |   1 -
 .../archosg9/env/menu/13-boot-usb/action  |   4 -
 .../archosg9/env/menu/13-boot-usb/title   |   1 -
 arch/arm/boards/archosg9/feature_list.h   | 352 --
 arch/arm/boards/archosg9/lowlevel.c   |  73 ---
 arch/arm/boards/archosg9/mux.c| 262 
 arch/arm/boards/archosg9/mux.h|   8 -
 arch/arm/boards/canon-a1100/Makefile  |   3 -
 arch/arm/boards/canon-a1100/lowlevel.c|  32 -
 arch/arm/boards/edb93xx/Makefile  |   4 -
 arch/arm/boards/edb93xx/early_udelay.h|  15 -
 arch/arm/boards/edb93xx/edb93xx.c | 121 
 arch/arm/boards/edb93xx/edb93xx.h |  29 -
 arch/arm/boards/edb93xx/env/bin/boot  |  48 --
 .../boards/edb93xx/env/bin/flash_partition|  22 -
 arch/arm/boards/edb93xx/env/bin/init  |  19 -
 arch/arm/boards/edb93xx/env/bin/set_nor_parts |   3 -
 arch/arm/boards/edb93xx/env/bin/update_kernel |  16 -
 arch/arm/boards/edb93xx/env/bin/update_rootfs |  16 -
 arch/arm/boards/edb93xx/env/config|  16 -
 arch/arm/boards/edb93xx/flash_cfg.c   |  22 -
 arch/arm/boards/edb93xx/pll_cfg.c |  41 --
 arch/arm/boards/edb93xx/pll_cfg.h |  53 --
 arch/arm/boards/edb93xx/sdram_cfg.c   | 128 
 arch/arm/boards/edb93xx/sdram_cfg.h   | 125 
 arch/arm/boards/lubbock/Makefile  |   4 -
 arch/arm/boards/lubbock/board.c   | 118 
 arch/arm/boards/lubbock/env/boot/nor-ubi  |   5 -
 arch/arm/boards/lubbock/env/init/mtdparts-nor |   6 -
 .../lubbock/env/nv/linux.bootargs.console |   1 -
 arch/arm/boards/lubbock/lowlevel.c| 194 --
 arch/arm/boards/mainstone/Makefile|   4 -
 arch/arm/boards/mainstone/board.c | 118 
 arch/arm/boards/mainstone/env/boot/nor-ubi|   5 -
 .../boards/mainstone/env/init/mtdparts-nor|   6 -
 .../mainstone/env/nv/linux.bootargs.console   |   1 -
 arch/arm/boards/mainstone/lowlevel.c  | 266 
 arch/arm/boards/mioa701/Makefile  |   4 -
 arch/arm/boards/mioa701/board.c   | 274 
 .../arm/boards/mioa701/env/bin/barebox_update |  11 -
 arch/arm/boards/mioa701/env/bin/console_mode  |   6 -
 arch/arm/boards/mioa701/env/bin/dps1_unlock   |  12 -
 arch/arm/boards/mioa701/env/bin/dps1_update   |  12 -
 arch/arm/boards/mioa701/env/bin/init  |  79 ---
 .../boards/mioa701/env/bin/mtd_env_override   |   4 -
 .../boards/mioa701/env/bin/sdcard_override|  19 -
 arch/arm/boards/mioa701/env/config|   6 -
 arch/arm/boards/mioa701/env/data/dps1.raw.gz

Re: [PATCH] fixup! mtd: nand: move to drivers/mtd/nand/raw/

2024-04-25 Thread Sascha Hauer
On Wed, Apr 24, 2024 at 08:41:56AM +0200, Ahmad Fatoum wrote:
> mtd: nand: align IS_ENABLED(symbol) for header stub with Makefile
> 
> drivers/mtd/nand/Makefile builds nand-bb.o when CONFIG_MTD_NAND_CORE
> is defined. We need to use the same symbol in the header to avoid
> breakage when CONFIG_MTD_RAW_NAND is deselected.
> 
> Signed-off-by: Ahmad Fatoum 
> ---
>  include/nand.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied, thanks

Sascha

> 
> diff --git a/include/nand.h b/include/nand.h
> index 84f5a9671410..4fb52e9f82d5 100644
> --- a/include/nand.h
> +++ b/include/nand.h
> @@ -4,7 +4,7 @@
>  
>  struct nand_bb;
>  
> -#ifdef CONFIG_MTD_RAW_NAND
> +#ifdef CONFIG_MTD_NAND_CORE
>  int dev_add_bb_dev(const char *filename, const char *name);
>  int dev_remove_bb_dev(const char *name);
>  struct cdev *mtd_add_bb(struct mtd_info *mtd, const char *name);
> -- 
> 2.39.2
> 
> 
> 

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



Re: [PATCH master 00/23] treewide: fix bugs using DMA API

2024-04-25 Thread Sascha Hauer


On Wed, 24 Apr 2024 08:40:35 +0200, Ahmad Fatoum wrote:
> As described in commi b986aad24ab8 ("mci: core: allocate memory used
> for DMA with dma_alloc"), the recent fix to ARMv8 cache operations in
> commit 65ef5d885263 ("ARM64: let 'end' point after the range in cache
> functions") may lead to unearthing some of the alignment bugs we have:
> 
> These bugs were already there: If a DMA buffer is misaligned and you do
> cache maintenance on it, you will corrupt memory that's unlucky to share
> the cache line. This has been the case for many years though, which I
> think is because that corruption was limited to the driver itself:
> If a driver invalidates only part of its buffer, then that is its
> problem and that of its consumers (e.g. TFTP failing for some file
> names, because network driver only invalidated part of the packet).
> 
> [...]

Applied, thanks!

[01/23] habv4: use DMA-capable memory for getting event from BootROM
https://git.pengutronix.de/cgit/barebox/commit/?id=72b50532f7d9 (link 
may not be stable)
[02/23] dma: give inline dma_alloc a single external definition
https://git.pengutronix.de/cgit/barebox/commit/?id=f77b139c4d74 (link 
may not be stable)
[03/23] dma: add definition for dma_zalloc
https://git.pengutronix.de/cgit/barebox/commit/?id=d2d9eb85597c (link 
may not be stable)
[04/23] include: linux/kernel.h: factor out alignment macros
https://git.pengutronix.de/cgit/barebox/commit/?id=04fbbf21e502 (link 
may not be stable)
[05/23] driver: move out struct device definition into its own header
https://git.pengutronix.de/cgit/barebox/commit/?id=58e2ba922bea (link 
may not be stable)
[06/23] dma: remove common.h include from asm/dma.h
https://git.pengutronix.de/cgit/barebox/commit/?id=d0124e06ab06 (link 
may not be stable)
[07/23] RISC-V: dma: fix dma.h inclusion
https://git.pengutronix.de/cgit/barebox/commit/?id=a9e636c1b9d9 (link 
may not be stable)
[08/23] sandbox: dma: drop unused driver.h include
https://git.pengutronix.de/cgit/barebox/commit/?id=d256efaaff68 (link 
may not be stable)
[09/23] dma: remove linux/kernel.h dependency from dma.h
https://git.pengutronix.de/cgit/barebox/commit/?id=27490e48068c (link 
may not be stable)
[10/23] include: linux/slab: fix possible overflow in kmalloc_array
https://git.pengutronix.de/cgit/barebox/commit/?id=f82819fb748a (link 
may not be stable)
[11/23] include: linux/slab: use dma_alloc for kmalloc
https://git.pengutronix.de/cgit/barebox/commit/?id=9b12861830e0 (link 
may not be stable)
[12/23] include: linux/slab: retire krealloc
https://git.pengutronix.de/cgit/barebox/commit/?id=3afbd2693d2f (link 
may not be stable)
[13/23] commands: mmc_extcsd: use DMA capable memory where needed
https://git.pengutronix.de/cgit/barebox/commit/?id=9d320afb3df3 (link 
may not be stable)
[14/23] net: macb: use DMA-capable memory for receive buffer
https://git.pengutronix.de/cgit/barebox/commit/?id=9ce5a4a7792b (link 
may not be stable)
[15/23] firmware: qemu_fw_cfg: use bounce buffer for write
https://git.pengutronix.de/cgit/barebox/commit/?id=cf6a5d4321c9 (link 
may not be stable)
[16/23] net: usb: asix: use dma_alloc for buffers in USB control messages
https://git.pengutronix.de/cgit/barebox/commit/?id=25826dced0d1 (link 
may not be stable)
[17/23] net: usb: smsc95xx: use DMA memory for usb_control_msg
https://git.pengutronix.de/cgit/barebox/commit/?id=c7ce7c992ccd (link 
may not be stable)
[18/23] usb: hub: use DMA memory in usb_get_port_status
https://git.pengutronix.de/cgit/barebox/commit/?id=3a678386fe77 (link 
may not be stable)
[19/23] usb: hub: use DMA-capable memory in usb_hub_configure
https://git.pengutronix.de/cgit/barebox/commit/?id=7cffd374fbc3 (link 
may not be stable)
[20/23] treewide: use new dma_zalloc instead of opencoding
https://git.pengutronix.de/cgit/barebox/commit/?id=f607c950a05e (link 
may not be stable)
[21/23] usb: dwc2: host: fix mismatch between dma_map_single and unmap
https://git.pengutronix.de/cgit/barebox/commit/?id=a0ae1c2c67d7 (link 
may not be stable)
[22/23] net: bcmgenet: map DMA buffers with dma_map_single
https://git.pengutronix.de/cgit/barebox/commit/?id=ecf47be780ce (link 
may not be stable)
[23/23] dma: debug: add alignment check when mapping buffers
https://git.pengutronix.de/cgit/barebox/commit/?id=699194dd2a4f (link 
may not be stable)

Best regards,
-- 
Sascha Hauer 




v2024.04.0

2024-04-25 Thread Sascha Hauer
ove reference to undefined CONFIG_HW_RANDOM
  hw_random: add Atmel RNG driver
  hw_random: add BCM2835 RNG driver
  hw_random: add IPROC RNG200 driver for BCM2711
  hw_random: add Rockchip RNG support
  hw_random: add timeriomem_rng driver
  hw_random: add OMAP RNG driver
  ddr: imx8m: add deprecation warnings for ddrphy_trained_csr
  net: cpsw: map/unmap buffers used for DMA
  ARM: i.MX: define MUX_MODE_SION for use in board code
  dma: correctly honour dma-noncoherent device tree property
  soc: sifive: l2_cache: fix 32-bit compilation
  RISC-V: riscvemu: build overlay as DTSO
  treewide: replace references to barebox.org/jsbarebox with demo
  Documentation: devel: project-ideas: remove outdated info on MMC speed
  Documentation: aarch64-qemu-virt: add name of defconfig
  gpio: rockchip: fix support for RK3588/RK3566
  soc: rockchip: io-domain: handle missing supply correctly
  partitions: efi: fix NULL dereference on corrupted GPT
  mci: core: don't fail MMC probe if HS200 isn't supported in HW
  clk: imx: add IMX_COMPOSITE_CLK_FLAGS_DEFAULT macro
  clk: imx: composite-8m: fix muxing of core and bus clocks
  clk: imx: imx8mp: sync with Linux v6.9-rc3
  mci: core: allocate memory used for DMA with dma_alloc

Antony Pavlov (2):
  net: drop unused rarp.h
  MIPS: add generic device tree 2nd stage support

Bastian Krause (3):
  ARM: i.MX8MM: set SION bits for i2c2, i2c3, i2c4 mux options
  ARM: i.MX8MN: set SION bits for i2c mux options
  firmware: fix SoC variant in help text of FIRMWARE_IMX93_OPTEE

Denis Orlov (3):
  ddr_spd: add DDR3 Load Reduced module specific data
  ddr_spd: add routine for printing DDR3 SPD contents
  clk: fix clk_set_rate command help text

Enrico Scholz (2):
  of: do not acccess 'prop->value' directly
  ARM64: let 'end' point after the range in cache functions

Johannes Zink (1):
  ARM: i.MX8MP: add König+Bauer AlphaJet board

Jonas Richardsen (1):
  of: do not copy properties if they already exist in the destination

Lucas Stach (1):
  usb: onboard-hub: bail out if peer hub is already probed

Marc Kleine-Budde (4):
  net: phy: micrel: update id table from Linux kernel
  net: phy: micrel: add support for ksz9131 phy
  arm: dts: karo: import dts for karo-qsxp-ml81
  arm: imx8mp: add karo electronics qsxp-ml81 som support

Marco Felsch (5):
  fastboot: add support to set fastboot_bbu from board code
  boot: add helper to set default boot source from board file
  startup: fix autoboot_state in case of abort
  common: barebox_banner: fix missing newline
  pmdomain: imx8mp-blk-ctrl: fix adb handshake handling

Oleksij Rempel (1):
  ARM: i.MX8MP: skov: add MAC address assignment support

Sam Ravnborg (1):
  ARM: at91: skov-arm9cpu: Add SD-Card xload support

Sascha Hauer (37):
  gpio: add slice support
  gpio: pca953x: depend on i2c slice
  input: gpio_keys: limit poll rate
  input: gpio_keys: only use gpios in poller when not in use
  dts: update to v6.8-rc6
  dts: update to v6.8
  board: tq: add missing select
  board: tq: fix format specifier
  board: tq: add support for 16bit eeprom
  ARM: i.MX6: add i2c4 base address
  ARM: tqma6ul: add pr_fmt string
  ARM: tqma6ul: enable enet_ref_125m clk
  net: phy: fix miibus parent device of_node not matching phy node
  ARM: tqma6ul: use upstream device trees
  ARM: i.MX6: TQMa6ulx: add OP-TEE support
  ARM: i.MX6ul: TQMa6ul: fix mmc aliases
  ARM: i.MX6ul: TQMa6ul: install barebox on eMMC boot partitions
  ARM: i.MX93: add bootsource detection
  ARM: i.MX: ele: remove unnecessary argument
  ARM: i.MX: ele: move ELE_READ_SHADOW_REQ definition
  ARM: i.MX: ele: add function comments
  ARM: i.MX: ele: add ele_write_shadow_fuse
  nvmem: add nvmem_device_get_device()
  nvmem: imx-ocotp-ele: implement permanent write support
  Merge branch 'for-next/arm-efi-prepare'
  Merge branch 'for-next/at91'
  Merge branch 'for-next/bus-probe'
  Merge branch 'for-next/dts'
  Merge branch 'for-next/hwrng'
  Merge branch 'for-next/imx'
  Merge branch 'for-next/misc'
  dma: Fix compiler warning
  mtd: nand: stm32: fix wrong regmap_bulk_read() usage
  clk: imx27: add nand clock
  clk: imx27: add watchdog clock
  Revert "ARM64: let 'end' point after the range in cache functions"
  Release v2024.04.0

Sebastian Reichel (1):
  of: introduce of_property_read_s32

Stefan Kerkmann (4):
  arm: mach-imx: tzasc: lock id_swap_bypass bit
  arm: mach-imx: set cpu type in pbl
  arm: mach-imx: tzasc: convert to cpu_is_mx8xyz macros
  arm: dts: karo: add karo imx8mp-karo-qsxp-ml81-qsbase4

Stefano Manni (1):
  ARM: i.MX: sabresd: Add support for i.MX6DL board variant

Steffen Trumtrar (18):
  mci: arasan: add dma s

Re: [PATCH 0/3] raspi: cleanup of vc fixups

2024-04-23 Thread Sascha Hauer


On Mon, 22 Apr 2024 10:16:46 +, Jonas Richardsen wrote:
> This patch series contains a few changes to the video core fixups where
> the desired behaviour is obvious from raspberry device trees. These were
> tested on a Raspberry Pi 4B. There's a few more differences between the
> video core device tree and the one provided by barebox for which a
> discussion is welcome:
> 
> - After a [recent change][link1] the `/chosen` node of the device tree
>   is now fully copied from the video core device tree. This could
>   possibly be restricted to only copy relevant properties.
> - The properties `memreserve` and `serial-number` of the root node are
>   added by the video core and could also be copied.
> - The property `model` of the root node is updated with the specific
>   hardware revision of the pi.
> - The video core adds the two aliases `i2c_arm` and `i2c_vc` (as
>   properties to the `/aliases` node). As the [raspberrypi
>   documentation][link2] suggests to use the former for writing overlays,
>   it should maybe also be copied as a fixup.
> 
> [...]

Applied, thanks!

[1/3] raspi: add fixup method for specific properties
  https://git.pengutronix.de/cgit/barebox/commit/?id=dcb947764491 (link may 
not be stable)
[2/3] raspi: override properties in /reserved-memory node of device tree
  https://git.pengutronix.de/cgit/barebox/commit/?id=3cf4417d0045 (link may 
not be stable)
[3/3] raspi: add a fixup for the `dma-ranges` property of the `/emmc2bus` dt 
node
  https://git.pengutronix.de/cgit/barebox/commit/?id=3f9788433919 (link may 
not be stable)

Best regards,
-- 
Sascha Hauer 




Re: [PATCH master 1/3] mci: core: fix fallback when eMMC DDR52 is not possible

2024-04-23 Thread Sascha Hauer
On Tue, Apr 23, 2024 at 08:22:04AM +0200, Ahmad Fatoum wrote:
> mci_mmc_select_hs_ddr() will try DDR52 and if that fails, revert to
> SDR operation. In that case, it returns the bus width, which would
> be forwarded as if it were an error code:
> 
>   WARNING: mmc2: Card's startup fails with 3
> 
> Fix this by translating successful return values to 0 in
> mci_startup_mmc().
> 
> Signed-off-by: Ahmad Fatoum 
> ---
>  drivers/mci/mci-core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
> index 1d383e6449e9..57b4c5b99c9c 100644
> --- a/drivers/mci/mci-core.c
> +++ b/drivers/mci/mci-core.c
> @@ -1566,7 +1566,7 @@ static int mci_startup_mmc(struct mci *mci)
>   }
>   }
>  
> - return ret;
> + return ret >= MMC_BUS_WIDTH_1 ? 0 : ret;
>  }

Can we do it like below instead? It makes clear where a MMC_BUS_WIDTH_x
return value is expected.

Sascha


--8<---

diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
index 083d2f4ed1..da892a5f84 100644
--- a/drivers/mci/mci-core.c
+++ b/drivers/mci/mci-core.c
@@ -1558,8 +1558,12 @@ static int mci_startup_mmc(struct mci *mci)
 
/* find out maximum bus width and then try DDR if supported */
ret = mci_mmc_select_bus_width(mci);
-   if (ret > MMC_BUS_WIDTH_1 && mci->tran_speed == 5200)
-   ret = mci_mmc_select_hs_ddr(mci);
+   if (ret > MMC_BUS_WIDTH_1) {
+   ret = 0;
+
+   if (mci->tran_speed == 5200)
+   ret = mci_mmc_select_hs_ddr(mci);
+   }
 
if (ret < 0) {
dev_warn(>dev, "Changing MMC bus width failed: 
%d\n", ret);


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



Re: [PATCH master] mci: core: allocate memory used for DMA with dma_alloc

2024-04-23 Thread Sascha Hauer


On Tue, 23 Apr 2024 08:04:35 +0200, Ahmad Fatoum wrote:
> Memory allocated by normal malloc may not fulfill the alignment
> requirements for DMA.
> 
> This fixes memory corruption observed on the i.MX8MP when the
> DMA-enabled eSDHC driver attempts to probe an eMMC.
> 
> This issues always existed, but only after commit 65ef5d885263
> ("ARM64: let 'end' point after the range in cache functions"), the whole
> 512 bytes were getting invalidated, which corrupted the TLSF malloc
> header of the block after it.
> 
> [...]

Applied, thanks!

[1/1] mci: core: allocate memory used for DMA with dma_alloc
  https://git.pengutronix.de/cgit/barebox/commit/?id=b986aad24ab8 (link may 
not be stable)

Best regards,
-- 
Sascha Hauer 




Re: [PATCH] ddr: imx: hide config prompt unless COMPILE_TEST

2024-04-23 Thread Sascha Hauer


On Tue, 23 Apr 2024 08:00:46 +0200, Ahmad Fatoum wrote:
> The DDR drivers are called into by low-level code for DRAM init.
> The Kconfig options for them are selected by the SOC symbols, e.g.
> ARCH_IMX8M and there's no point in asking for user decision: either
> it's required and already selected or it will be unused and subject
> to linker garbage collection. Therefore, hide the prompts by default.
> 
> 
> [...]

Applied, thanks!

[1/1] ddr: imx: hide config prompt unless COMPILE_TEST
  https://git.pengutronix.de/cgit/barebox/commit/?id=8028c9f2d564 (link may 
not be stable)

Best regards,
-- 
Sascha Hauer 




Re: [PATCH v2] scripts: imx: IMX8MQ: fix header entry offset

2024-04-22 Thread Sascha Hauer


On Thu, 18 Apr 2024 11:24:11 +0200, Benjamin Gaignard wrote:
> Unlike other IMX8M, IMX8MQ version use a fixed offset so do a special
> case for this SoC.
> 
> 

Applied, thanks!

[1/1] scripts: imx: IMX8MQ: fix header entry offset
  https://git.pengutronix.de/cgit/barebox/commit/?id=9a39a534b771 (link may 
not be stable)

Best regards,
-- 
Sascha Hauer 




Re: [PATCH 1/2] include: kconfig.h: move __is_defined definition into new header

2024-04-22 Thread Sascha Hauer


On Wed, 03 Apr 2024 09:23:31 +0200, Ahmad Fatoum wrote:
> While we run the preprocessor over device trees before compiling them,
> we don't define the Kconfig symbols and including 
> would fail.
> 
> The file defines __is_defined however, which can be useful for other
> macros that are either defined to 1 or undefined like the macros we
> define for device tree fragments to indicate which file they are being
> appended to. To make it possible to use __is_defined from fragments,
> move the kconfig-independent part out of  into
> .
> 
> [...]

Applied, thanks!

[1/2] include: kconfig.h: move __is_defined definition into new header
  https://git.pengutronix.de/cgit/barebox/commit/?id=71b94b24f462 (link may 
not be stable)
[2/2] include: is_defined: implement __if_defined helper
  https://git.pengutronix.de/cgit/barebox/commit/?id=1674da1f95ce (link may 
not be stable)

Best regards,
-- 
Sascha Hauer 




Re: [PATCH 2/2] net: designware-imx: i.MX93: set TX_CLK in RMII mode

2024-04-22 Thread Sascha Hauer
On Wed, Apr 17, 2024 at 11:11:26AM +0200, Steffen Trumtrar wrote:
> According to NXP AT14149 the TX_CLK direction must be set to output
> when the ENET is used in RMII mode.
> 
> Signed-off-by: Steffen Trumtrar 
> ---
>  drivers/net/designware_imx.c | 12 
>  1 file changed, 12 insertions(+)
> 
> diff --git a/drivers/net/designware_imx.c b/drivers/net/designware_imx.c
> index ab60d98298..2cc707ecac 100644
> --- a/drivers/net/designware_imx.c
> +++ b/drivers/net/designware_imx.c
> @@ -26,6 +26,10 @@
>  
>  #define RMII_RESET_SPEED (0x3 << 14)
>  
> +#define MX93_GPR_ENET_CLK_SEL_OFFSET 0x4
> +#define MX93_ENET_CLK_ENET_QOS_TX_CLK_SEL_MASK   GENMASK(0, 0)
> +#define MX93_ENET_CLK_ENET_QOS_TX_CLK_SEL(0x1 << 0)

No need to define an extra _MASK for single bit fields. Just use
MX93_ENET_CLK_ENET_QOS_TX_CLK_SEL instead.

> +
>  struct eqos_imx_soc_data {
>   int (*set_interface_mode)(struct eqos *eqos);
>   void (*fix_soc_reset)(struct eqos *eqos, u32 *mac_regs);
> @@ -155,6 +159,14 @@ static int eqos_imx93_set_interface_mode(struct eqos 
> *eqos)
>   break;
>   case PHY_INTERFACE_MODE_RMII:
>   val = MX93_GPR_ENET_QOS_INTF_SEL_RMII;
> +
> + /* According to NXP AN14149, the direction of the
> +  * TX_CLK must be set to output in RMII mode.
> +  */
> + regmap_update_bits(priv->intf_regmap,
> +priv->intf_reg_off + 
> MX93_GPR_ENET_CLK_SEL_OFFSET,
> +MX93_ENET_CLK_ENET_QOS_TX_CLK_SEL_MASK,
> +MX93_ENET_CLK_ENET_QOS_TX_CLK_SEL);

I think this is ok for now as all in tree boards need this set, but what
about this comment to the corresponding kernel patch?

https://lore.kernel.org/all/f01d49cf-5955-405c-9c2b-05b0c7bb9...@armadeus.com/

Also according to the reference manual this bit is default 1 already,
how comes you have to adjust it?

Sascha

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



Re: [PATCH master 0/3] clk: imx: composite-8m: fix muxing of core and bus

2024-04-22 Thread Sascha Hauer


On Fri, 19 Apr 2024 08:10:00 +0200, Ahmad Fatoum wrote:
> The i.MX8M differntiates between three types of composite clocks (called
> slices): Core, Bus and IP (peripheral) clocks. How muxes are configured
> differs between these clocks, so the driver is populating a mux_ops
> variable to point at the correct struct clk_ops.
> 
> Unfortunately, mux_ops wasn't actually used, leading to barebox hangs,
> depending on the assigned-clock-parents properties in the device tree.
> 
> [...]

Applied, thanks!

[1/3] clk: imx: add IMX_COMPOSITE_CLK_FLAGS_DEFAULT macro
  https://git.pengutronix.de/cgit/barebox/commit/?id=fb6c852f5b87 (link may 
not be stable)
[2/3] clk: imx: composite-8m: fix muxing of core and bus clocks
  https://git.pengutronix.de/cgit/barebox/commit/?id=4ec1f1d2887f (link may 
not be stable)
[3/3] clk: imx: imx8mp: sync with Linux v6.9-rc3
  https://git.pengutronix.de/cgit/barebox/commit/?id=ed8dad10eac8 (link may 
not be stable)

Best regards,
-- 
Sascha Hauer 




Re: [PATCH 1/2] clk: add flags parameter to clk_dump(_one)

2024-04-22 Thread Sascha Hauer


On Fri, 19 Apr 2024 08:07:58 +0200, Ahmad Fatoum wrote:
> We currently customize dumping by means of a single verbose argument.
> Follow-up commit will want to customize the dumping further, so turn
> the verbose parameter into a general flags parameter.
> 
> 

Applied, thanks!

[1/2] clk: add flags parameter to clk_dump(_one)
  https://git.pengutronix.de/cgit/barebox/commit/?id=ab544df4e368 (link may 
not be stable)
[2/2] commands: clk_dump: add json output option
  https://git.pengutronix.de/cgit/barebox/commit/?id=83b091903d70 (link may 
not be stable)

Best regards,
-- 
Sascha Hauer 




Re: [PATCH] ARM: i.MX: remove platform device registration helpers

2024-04-19 Thread Sascha Hauer


On Thu, 11 Apr 2024 09:11:22 +0200, Sascha Hauer wrote:
> With two exceptions the imx_add_* platform device registration helpers
> are no longer used, so remove them.
> In two cases a framebuffer is still registered with a helper function.
> Replace them with add_generic_device().
> 
> 

Applied, thanks!

[1/1] ARM: i.MX: remove platform device registration helpers
  https://git.pengutronix.de/cgit/barebox/commit/?id=0556365d0377 (link may 
not be stable)

Best regards,
-- 
Sascha Hauer 




Re: [PATCH] file-list: remove unused variable

2024-04-19 Thread Sascha Hauer


On Wed, 17 Apr 2024 08:19:36 +0200, Sascha Hauer wrote:
> struct file_list::num_entries is only ever used to check if a file list
> is empty. Do this check with list_empty() instead and remove the unused
> member.
> 
> 

Applied, thanks!

[1/1] file-list: remove unused variable
  https://git.pengutronix.de/cgit/barebox/commit/?id=684dc87ce140 (link may 
not be stable)

Best regards,
-- 
Sascha Hauer 




[PATCH] mtd: nand: mxc_nand: disable subpage reads

2024-04-17 Thread Sascha Hauer
The NAND core enabled subpage reads when a largepage NAND is used with
SOFT_ECC. The i.MX NAND controller doesn't support subpage reads, so
clear the flag again.

Signed-off-by: Sascha Hauer 
---
 drivers/mtd/nand/raw/mxc_nand.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/mtd/nand/raw/mxc_nand.c b/drivers/mtd/nand/raw/mxc_nand.c
index 46f8bb2406..2774b6bb4f 100644
--- a/drivers/mtd/nand/raw/mxc_nand.c
+++ b/drivers/mtd/nand/raw/mxc_nand.c
@@ -1708,6 +1708,8 @@ static int mxcnd_probe(struct device *dev)
if (err)
goto escan;
 
+   this->options &= ~NAND_SUBPAGE_READ;
+
if ((this->bbt_options & NAND_BBT_USE_FLASH) &&
this->bbt_td->pages[0] == -1 && this->bbt_md->pages[0] == -1) {
dev_info(dev, "no BBT found. creating one\n");
-- 
2.39.2




Re: [PATCH] mtd: nand: stm32: fix wrong regmap_bulk_read() usage

2024-04-17 Thread Sascha Hauer


On Tue, 16 Apr 2024 08:08:06 +0200, Sascha Hauer wrote:
> Compilation of the STM32 NAND driver fails with:
> 
> error: call to '__regmap_bulk_api_changed' declared with attribute error: 
> Last argument is now number of registers, not bytes. Fix it and include 
>  
> Do exactly this to make the driver compile again
> 
> 
> [...]

Applied, thanks!

[1/1] mtd: nand: stm32: fix wrong regmap_bulk_read() usage
  https://git.pengutronix.de/cgit/barebox/commit/?id=760f14774fcd (link may 
not be stable)

Best regards,
-- 
Sascha Hauer 




Re: [PATCH 1/2] fs: jffs2: remove NAND write support entirely

2024-04-17 Thread Sascha Hauer


On Tue, 16 Apr 2024 08:17:29 +0200, Sascha Hauer wrote:
> Our JFFS2 implementation refuses to work on NAND flashes because we lack
> support for CONFIG_JFFS2_FS_WRITEBUFFER currently. JFFS2 is barely used
> anymore and it seems unlikely that write support for it will ever be
> added, so remove write support altogether. With this we can now safely
> operate on NAND flashes.
> 
> 
> [...]

Applied, thanks!

[1/2] fs: jffs2: remove NAND write support entirely
  https://git.pengutronix.de/cgit/barebox/commit/?id=5817dd7e4826 (link may 
not be stable)
[2/2] fs: jffs2: ignore cleanup hints
  https://git.pengutronix.de/cgit/barebox/commit/?id=524cb0a98fbd (link may 
not be stable)

Best regards,
-- 
Sascha Hauer 




[PATCH] file-list: remove unused variable

2024-04-17 Thread Sascha Hauer
struct file_list::num_entries is only ever used to check if a file list
is empty. Do this check with list_empty() instead and remove the unused
member.

Signed-off-by: Sascha Hauer 
---
 common/file-list.c  | 6 +-
 include/file-list.h | 3 +--
 2 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/common/file-list.c b/common/file-list.c
index 7ecc8d00bb..3867e79c09 100644
--- a/common/file-list.c
+++ b/common/file-list.c
@@ -194,8 +194,6 @@ struct file_list *file_list_parse(const char *str)
goto out;
}
str = endptr;
-
-   files->num_entries++;
}
 
return files;
@@ -244,11 +242,9 @@ struct file_list *file_list_dup(struct file_list *old)
 
new = file_list_new();
 
-   list_for_each_entry(old_entry, >list, list) {
+   list_for_each_entry(old_entry, >list, list)
(void)file_list_add_entry(new, old_entry->name, 
old_entry->filename,
  old_entry->flags); /* can't fail */
-   new->num_entries++;
-   }
 
return new;
 }
diff --git a/include/file-list.h b/include/file-list.h
index 79190b0f19..1625f116a0 100644
--- a/include/file-list.h
+++ b/include/file-list.h
@@ -21,7 +21,6 @@ struct file_list_entry {
 
 struct file_list {
struct list_head list;
-   int num_entries;
 };
 
 struct file_list *file_list_parse(const char *str);
@@ -47,7 +46,7 @@ struct file_list_entry *file_list_entry_by_name(struct 
file_list *files, const c
 
 static inline bool file_list_empty(struct file_list *files)
 {
-   return !files || !files->num_entries;
+   return !files || list_empty(>list);
 }
 
 #endif /* __FILE_LIST */
-- 
2.39.2




Re: [PATCH 1/2] clk: imx27: add nand clock

2024-04-16 Thread Sascha Hauer


On Tue, 16 Apr 2024 08:31:25 +0200, Sascha Hauer wrote:
> The NAND clock is currently missing. The NAND driver doesn't use it
> currently, but will be using it later once we update the driver. Add
> this missing clock.
> 
> 

Applied, thanks!

[1/2] clk: imx27: add nand clock
  https://git.pengutronix.de/cgit/barebox/commit/?id=c817f57bd873 (link may 
not be stable)
[2/2] clk: imx27: add watchdog clock
  https://git.pengutronix.de/cgit/barebox/commit/?id=f40319c8e157 (link may 
not be stable)

Best regards,
-- 
Sascha Hauer 




Re: [PATCH 1/4] DNM: dts: arm64: rockchip: copy pf5 device tree from mainline Linux

2024-04-16 Thread Sascha Hauer
On Fri, Apr 12, 2024 at 03:33:00PM +0200, Ahmad Fatoum wrote:
> Hi,
> 
> On 12.04.24 15:02, Michael Riesch wrote:
> > Hi Marco,
> > 
> > Thanks for your response!
> > 
> > On 4/5/24 19:02, Marco Felsch wrote:
> >> Hi Michael,
> >>
> >> thanks for your patches.
> >>
> >>> DNM: dts: arm64: rockchip: copy pf5 device tree from
> >>
> >> I suppose DNM means "do not merge", instead of marking it this way we
> >> put the not yet upstream Linux dts files into arch as well but mark them
> >> as upstream dts file, e.g.:
> >>
> >>   - arch/arm/dts/imx8mm-innocomm-wb15-evk-upstream.dts
> >>   - arch/arm/dts/imx8mp-debix-model-a-upstream.dts
> >>   - arch/arm/dts/imx8mp-debix-som-a-bmb-08-upstream.dts
> >>   - arch/arm/dts/imx8mp-debix-som-a-upstream.dtsi
> 
> I have been wondering if we should add yet another device tree
> directory for kernel DTs that are not yet in the kernel, e.g.
> common/boards/dts. Then we can place full DTs there, remove them
> once they are in dts/ and clean up arch/$ARCH/dts/ that way.
> 
> > OK, I'll do it that way!
> > 
> >> Once the files are usptream we can remove them.
> > 
> > Is this something I should keep in mind or may I expect that this
> > happens automagically?
> 
> Usually, when someone notices. Having them in a single directory
> as suggested above may make it easier to sport no longer needed DTs.
> 
> Thoughts?

+1

Sascha

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



Re: [PATCH v2] of: do not copy properties if they already exist in the destination

2024-04-16 Thread Sascha Hauer


On Mon, 15 Apr 2024 14:26:04 +0200, Jonas Richardsen wrote:
> Currently `of_copy_property` copies the given property even if a property
> with the same name already exists on the destination node.
> This leads to kernel warnings about duplicate properties:
> ```
> [0.014063] Duplicate name in chosen, renamed to "stdout-path#1"
> [0.014093] Duplicate name in chosen, renamed to "bootargs#1"
> [0.014119] Duplicate name in chosen, renamed to "phandle#1"
> [0.014197] Duplicate name in reserved-memory, renamed to 
> "#address-cells#1"
> [0.014226] Duplicate name in reserved-memory, renamed to "#size-cells#1"
> [0.014252] Duplicate name in reserved-memory, renamed to "ranges#1"
> [0.014278] Duplicate name in reserved-memory, renamed to "phandle#1"
> ```
> Therefore, the function was changed to return an error if the property
> already exists in the destination.
> The change does not cause any regressions, because the only usage of
> this function occurs within `arch/arm/boards/raspberry-pi/rpi-common.c`
> where the original behaviour of the function is obviously unintended.
> 
> [...]

Applied, thanks!

[1/1] of: do not copy properties if they already exist in the destination
  https://git.pengutronix.de/cgit/barebox/commit/?id=364a1831678d (link may 
not be stable)

Best regards,
-- 
Sascha Hauer 




Re: [PATCH v2] gpio: Add Intel gpio controller support

2024-04-16 Thread Sascha Hauer


On Wed, 10 Apr 2024 18:34:46 +0200, Tomas Marek wrote:
> 


Applied, thanks!

[1/1] gpio: Add Intel gpio controller support
  https://git.pengutronix.de/cgit/barebox/commit/?id=e476edd5322f (link may 
not be stable)

Best regards,
-- 
Sascha Hauer 




Re: [PATCH] scripts: config: add script to manipulate .config files on the command line

2024-04-16 Thread Sascha Hauer


On Wed, 10 Apr 2024 14:26:45 +0200, Ahmad Fatoum wrote:
> This ports over the Linux v6.9-rc3 state of the config script, which
> allows easy enabling and disabling of options from the command line, e.g.:
> 
>   scripts/config --file build/.config -d CONFIG_WERROR
> 
> By having the script in the barebox scripts directory, it's available
> for use by build systems instead of running sed over the .config file.
> 
> [...]

Applied, thanks!

[1/1] scripts: config: add script to manipulate .config files on the command 
line
  https://git.pengutronix.de/cgit/barebox/commit/?id=e77ccb480a8c (link may 
not be stable)

Best regards,
-- 
Sascha Hauer 




Re: [PATCH v2 0/4] arm: boards: add wolfvision pf5 mainboard

2024-04-16 Thread Sascha Hauer


On Fri, 12 Apr 2024 15:32:11 +0200, Michael Riesch wrote:
> Habidere,
> 
> This series adds support for the WolfVision PF5 mainboard, which serves
> as base for recent WolfVision products. It features the Rockchip RK3568
> and can be extended with several different extension boards. The
> WolfVision PF5 IO Expander is one example of such an extension board.
> Support for this extension is also included in this series.
> 
> [...]

Applied, thanks!

[1/4] arm: dts: copy pf5 device tree from mainline linux
  https://git.pengutronix.de/cgit/barebox/commit/?id=50b1eceef4eb (link may 
not be stable)
[2/4] arm: dts: add common state for wolfvision boards
  https://git.pengutronix.de/cgit/barebox/commit/?id=fdfa97893c38 (link may 
not be stable)
[3/4] common: add wolfvision board code library
  https://git.pengutronix.de/cgit/barebox/commit/?id=5f20e518aad1 (link may 
not be stable)
[4/4] arm: boards: add wolfvision pf5 mainboard
  https://git.pengutronix.de/cgit/barebox/commit/?id=69bfc54d6eb0 (link may 
not be stable)

Best regards,
-- 
Sascha Hauer 




Re: [PATCH] ARM64: let 'end' point after the range in cache functions

2024-04-16 Thread Sascha Hauer
Hi Enrico,

On Fri, Apr 12, 2024 at 06:28:35PM +0200, Enrico Scholz wrote:
> From: Enrico Scholz 
> 
> v8_flush_dcache_range() and v8_inv_dcache_range() are implemented
> under the assumption that their 'end' parameter points *after* the
> range.
> 
> Fix callers to use it in this way.
> 
> This fixes e.g. spurious corruptions in the last octet when sending
> 129 bytes over ethernet.

So 129 bytes are sent from barebox, right? Which network driver driver
is involved on the barebox side here? How did you force sending excatly
129 bytes?

I am asking because I want to look if there are other bugs invlolved
here.

Sascha

> 
> Signed-off-by: Enrico Scholz 
> ---
>  arch/arm/cpu/dma_64.c | 2 +-
>  arch/arm/cpu/mmu_64.c | 4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm/cpu/dma_64.c b/arch/arm/cpu/dma_64.c
> index 74d7167860c2..b50572f5e601 100644
> --- a/arch/arm/cpu/dma_64.c
> +++ b/arch/arm/cpu/dma_64.c
> @@ -6,7 +6,7 @@ void arch_sync_dma_for_device(void *vaddr, size_t size,
>enum dma_data_direction dir)
>  {
>   unsigned long start = (unsigned long)vaddr;
> - unsigned long end = start + size - 1;
> + unsigned long end = start + size;
>  
>   if (dir == DMA_FROM_DEVICE)
>   v8_inv_dcache_range(start, end);
> diff --git a/arch/arm/cpu/mmu_64.c b/arch/arm/cpu/mmu_64.c
> index 12cd644de0c7..b48e4732b86d 100644
> --- a/arch/arm/cpu/mmu_64.c
> +++ b/arch/arm/cpu/mmu_64.c
> @@ -282,7 +282,7 @@ void mmu_disable(void)
>  void dma_inv_range(void *ptr, size_t size)
>  {
>   unsigned long start = (unsigned long)ptr;
> - unsigned long end = start + size - 1;
> + unsigned long end = start + size;
>  
>   v8_inv_dcache_range(start, end);
>  }
> @@ -290,7 +290,7 @@ void dma_inv_range(void *ptr, size_t size)
>  void dma_flush_range(void *ptr, size_t size)
>  {
>   unsigned long start = (unsigned long)ptr;
> - unsigned long end = start + size - 1;
> + unsigned long end = start + size;
>  
>   v8_flush_dcache_range(start, end);
>  }
> -- 
> 2.44.0
> 
> 
> 

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



Re: [PATCH] ARM64: let 'end' point after the range in cache functions

2024-04-16 Thread Sascha Hauer


On Fri, 12 Apr 2024 18:28:35 +0200, Enrico Scholz wrote:
> v8_flush_dcache_range() and v8_inv_dcache_range() are implemented
> under the assumption that their 'end' parameter points *after* the
> range.
> 
> Fix callers to use it in this way.
> 
> This fixes e.g. spurious corruptions in the last octet when sending
> 129 bytes over ethernet.
> 
> [...]

Applied, thanks!

[1/1] ARM64: let 'end' point after the range in cache functions
  https://git.pengutronix.de/cgit/barebox/commit/?id=65ef5d885263 (link may 
not be stable)

Best regards,
-- 
Sascha Hauer 




Re: [PATCH] of: do not acccess 'prop->value' directly

2024-04-16 Thread Sascha Hauer


On Fri, 12 Apr 2024 18:29:25 +0200, Enrico Scholz wrote:
> Use of_property_get_value() accessor.  Else, wrong results are
> returned when working with fit images.
> 
> 

Applied, thanks!

[1/1] of: do not acccess 'prop->value' directly
  https://git.pengutronix.de/cgit/barebox/commit/?id=7b7ab4a37d25 (link may 
not be stable)

Best regards,
-- 
Sascha Hauer 




Re: [PATCH master] mci: core: don't fail MMC probe if HS200 isn't supported in HW

2024-04-16 Thread Sascha Hauer


On Mon, 15 Apr 2024 07:27:34 +0200, Ahmad Fatoum wrote:
> A MMC may support HS200 in theory, but it's unusable due to I/O
> voltage. Unlike Linux, barebox doesn't check the I/O voltage, so it
> will attempt enabling HS200 and get told no by the card.
> 
> This no currently triggered a failure of the probe:
> 
>   mmc1: detected MMC card version 5.0
>   ERROR: mmc1: mmc_select_hs200 failed, error -5
>   WARNING: mmc1: Card's startup fails with -5
>   Cannot set parameter mmc1.probe: I/O error
> 
> [...]

Applied, thanks!

[1/1] mci: core: don't fail MMC probe if HS200 isn't supported in HW
  https://git.pengutronix.de/cgit/barebox/commit/?id=75d6a1ce692d (link may 
not be stable)

Best regards,
-- 
Sascha Hauer 




Re: [PATCH 1/3] ARM: Rockchip: bbu: rename rk3568_bbu_mmc_register to rockchip_*

2024-04-16 Thread Sascha Hauer


On Mon, 15 Apr 2024 07:28:13 +0200, Ahmad Fatoum wrote:
> The update handler isn't restricted to the RK3568, but is also usable
> for other RKNS SoCs. With minor modification, it is also usable for the
> RK3399 and perhaps even older SoCs, so let's rename it to
> rockchip_bbu_mmc_handler instead. We can always do SoC-type checks
> inside to handle differences.
> 
> 
> [...]

Applied, thanks!

[1/3] ARM: Rockchip: bbu: rename rk3568_bbu_mmc_register to rockchip_*
  https://git.pengutronix.de/cgit/barebox/commit/?id=66e0e8536986 (link may 
not be stable)
[2/3] ARM: Rockchip: bbu: output unallocated space size on error
  https://git.pengutronix.de/cgit/barebox/commit/?id=702504f04c78 (link may 
not be stable)
[3/3] ARM: Rockchip: bbu: allow forcing barebox update handler despite size
  https://git.pengutronix.de/cgit/barebox/commit/?id=30558b84d1bb (link may 
not be stable)

Best regards,
-- 
Sascha Hauer 




Re: [PATCH] gpiolib: implement gpiod_slice_acquired

2024-04-16 Thread Sascha Hauer


On Mon, 15 Apr 2024 07:28:50 +0200, Ahmad Fatoum wrote:
> For use by poller code that makes use of GPIO descriptors instead of the
> unstable indices, add a gpiod variant of the existing
> gpiod_slice_acquird.
> 
> 

Applied, thanks!

[1/1] gpiolib: implement gpiod_slice_acquired
  https://git.pengutronix.de/cgit/barebox/commit/?id=fcc51585350b (link may 
not be stable)

Best regards,
-- 
Sascha Hauer 




Re: [PATCH master] partitions: efi: fix NULL dereference on corrupted GPT

2024-04-16 Thread Sascha Hauer


On Mon, 15 Apr 2024 07:31:20 +0200, Ahmad Fatoum wrote:
> When processing a corrupted GPT, the initial magic check may succeed,
> but later partition parsing may terminate unsuccessfully. In such case,
> we returned an invalid pointer that happened to be NULL, but didn't do
> much about it leading to a NULL pointer dereference.
> 
> Fix this by explicitly returning NULL and correctly propagating it.
> 
> [...]

Applied, thanks!

[1/1] partitions: efi: fix NULL dereference on corrupted GPT
  https://git.pengutronix.de/cgit/barebox/commit/?id=7358ef660dc4 (link may 
not be stable)

Best regards,
-- 
Sascha Hauer 




Re: [PATCH master] soc: rockchip: io-domain: handle missing supply correctly

2024-04-16 Thread Sascha Hauer


On Mon, 15 Apr 2024 07:31:30 +0200, Ahmad Fatoum wrote:
> The original Linux code calls regulator_get_optional and handles its
> -ENODEV return code, which morphed into regulator_get when ported to
> barebox. The error handling stayed as-is leading to causing supplies to
> trigger errors instead of being silently ignored.
> 
> As we use NULL to describe the dummy regulator in barebox, we can add a
> trivial regulator_get_optional implementation and use it to fix the
> I/O domain driver.
> 
> [...]

Applied, thanks!

[1/1] soc: rockchip: io-domain: handle missing supply correctly
  https://git.pengutronix.de/cgit/barebox/commit/?id=284a876cee1f (link may 
not be stable)

Best regards,
-- 
Sascha Hauer 




Re: [PATCH master] gpio: rockchip: fix support for RK3588/RK3566

2024-04-16 Thread Sascha Hauer


On Mon, 15 Apr 2024 07:31:37 +0200, Ahmad Fatoum wrote:
> The GPIO controller on newer Rockchip SoCs isn't compatible with the
> older ones. Back when GPIOv2 support was added, RK3568 was the only
> SoC supported using it, but since then support for the very similar
> RK3566 as well as the newer RK3588 has followed, but the driver wasn't
> extended to support them.
> 
> As GPIOv2 controllers have an identification register, start checking it
> like Linux does and use that to detect whether we have a GPIOv2 or GPIOv1.
> 
> [...]

Applied, thanks!

[1/1] gpio: rockchip: fix support for RK3588/RK3566
  https://git.pengutronix.de/cgit/barebox/commit/?id=ff8547d924aa (link may 
not be stable)

Best regards,
-- 
Sascha Hauer 




Re: [PATCH] clk: rk3568: sync PLL rates with Linux

2024-04-16 Thread Sascha Hauer


On Mon, 15 Apr 2024 07:31:54 +0200, Ahmad Fatoum wrote:
> The Linux driver has gained additional PLL rates since we last
> synchronized. Add their parameters to barebox as well.
> 
> 

Applied, thanks!

[1/1] clk: rk3568: sync PLL rates with Linux
  https://git.pengutronix.de/cgit/barebox/commit/?id=f382eedfb4f4 (link may 
not be stable)

Best regards,
-- 
Sascha Hauer 




Re: [PATCH] ARM: dts: rockchip: drop unreferenced rockchip-pinconf.dtsi

2024-04-16 Thread Sascha Hauer


On Mon, 15 Apr 2024 07:32:12 +0200, Ahmad Fatoum wrote:
> This file is no longer used in barebox and existing drivers instead use
> the upstream variant. Therefore drop our unreferenced and possibly stale
> copy.
> 
> 

Applied, thanks!

[1/1] ARM: dts: rockchip: drop unreferenced rockchip-pinconf.dtsi
  https://git.pengutronix.de/cgit/barebox/commit/?id=3d633c0f7c52 (link may 
not be stable)

Best regards,
-- 
Sascha Hauer 




Re: [PATCH] ARM: dts: rk356x: describe serial reboot mode

2024-04-16 Thread Sascha Hauer


On Mon, 15 Apr 2024 07:32:53 +0200, Ahmad Fatoum wrote:
> The PMUGRF (Power Management Unit - General Register File) of the RK3568
> has a general purpose register checked by the BootROM on power-on to
> decide on whether to drop to recovery mode (rk-usb-loader/rkdeveloptool).
> 
> Describe this in the device tree, so it's possible to use, e.g.
> 
>   global.system.reboot_mode.next=serial reset
> 
> [...]

Applied, thanks!

[1/1] ARM: dts: rk356x: describe serial reboot mode
  https://git.pengutronix.de/cgit/barebox/commit/?id=c55fc4d1dbea (link may 
not be stable)

Best regards,
-- 
Sascha Hauer 




Re: [PATCH 0/7] PWM: rockchip: add driver support

2024-04-16 Thread Sascha Hauer


On Mon, 15 Apr 2024 07:35:53 +0200, Ahmad Fatoum wrote:
> This series aligns the barebox PWM framework more with the current Linux
> state in v6.8 and then ports over the Rockchip PWM driver.
> 
> This has been tested on the RK3566 controlling backlight and PWM LEDs.
> 
> Ahmad Fatoum (7):
>   PWM: core: check that struct pwm_chip::devname is set
>   PWM: core: add struct pwm_chip::dev
>   PWM: core: adopt Linux prototype for struct pwm_ops::apply
>   PWM: align struct pwm_state member names with Linux
>   PWM: core: add definition for PWM_POLARITY_INVERSED
>   PWM: rockchip: add driver support
>   ARM: dts: rk356x: add aliases for PWM controllers
> 
> [...]

Applied, thanks!

[1/7] PWM: core: check that struct pwm_chip::devname is set
  https://git.pengutronix.de/cgit/barebox/commit/?id=9c2ce1113752 (link may 
not be stable)
[2/7] PWM: core: add struct pwm_chip::dev
  https://git.pengutronix.de/cgit/barebox/commit/?id=66cc09c044ab (link may 
not be stable)
[3/7] PWM: core: adopt Linux prototype for struct pwm_ops::apply
  https://git.pengutronix.de/cgit/barebox/commit/?id=29e00152bb73 (link may 
not be stable)
[4/7] PWM: align struct pwm_state member names with Linux
  https://git.pengutronix.de/cgit/barebox/commit/?id=c5ae8eb5ef72 (link may 
not be stable)
[5/7] PWM: core: add definition for PWM_POLARITY_INVERSED
  https://git.pengutronix.de/cgit/barebox/commit/?id=32a64b0e2cf7 (link may 
not be stable)
[6/7] PWM: rockchip: add driver support
  https://git.pengutronix.de/cgit/barebox/commit/?id=b96d3bccc710 (link may 
not be stable)
[7/7] ARM: dts: rk356x: add aliases for PWM controllers
  https://git.pengutronix.de/cgit/barebox/commit/?id=a77bd919a9e0 (link may 
not be stable)

Best regards,
-- 
Sascha Hauer 




Re: [PATCH] common: factor out debugging options into separate files

2024-04-16 Thread Sascha Hauer


On Mon, 15 Apr 2024 07:36:30 +0200, Ahmad Fatoum wrote:
> We have a lot of debugging options, especially for DEBUG_LL, which make
> common/Kconfig quite a bit crowded. Releive some pressure there by
> factoring the debugging options and DEBUG_LL out into separate files.
> 
> 

Applied, thanks!

[1/1] common: factor out debugging options into separate files
  https://git.pengutronix.de/cgit/barebox/commit/?id=b3d50a2b40de (link may 
not be stable)

Best regards,
-- 
Sascha Hauer 




Re: [PATCH] pinctrl: rockchip: check for invalid pull settings

2024-04-16 Thread Sascha Hauer


On Mon, 15 Apr 2024 09:21:35 +0200, Ahmad Fatoum wrote:
> Commit e877582e9875 ("pinctrl: rockchip: fix bias settings") reinstated
> the translation done to pull settings via the bank->pull_type array,
> like the original Linux driver does. What it didn't do is actually check
> that the translation succeeded. Add this check to make sure we don't
> somehow end up packing a negative value into the bitset we write into
> the hardware.
> 
> [...]

Applied, thanks!

[1/1] pinctrl: rockchip: check for invalid pull settings
  https://git.pengutronix.de/cgit/barebox/commit/?id=32e9e020ae44 (link may 
not be stable)

Best regards,
-- 
Sascha Hauer 




Re: [PATCH master] Documentation: aarch64-qemu-virt: add name of defconfig

2024-04-16 Thread Sascha Hauer


On Mon, 15 Apr 2024 11:14:48 +0200, Ahmad Fatoum wrote:
> Commit d00b07dd14bc ("ARM: Remove qemu_virt64_defconfig") dropped the
> defconfig in favor of multi_v8_defconfig, but missed updating the
> documentation. Remedy this.
> 
> 

Applied, thanks!

[1/1] Documentation: aarch64-qemu-virt: add name of defconfig
  https://git.pengutronix.de/cgit/barebox/commit/?id=26b637912f30 (link may 
not be stable)

Best regards,
-- 
Sascha Hauer 




Re: [PATCH master] Documentation: devel: project-ideas: remove outdated info on MMC speed

2024-04-16 Thread Sascha Hauer


On Mon, 15 Apr 2024 11:17:07 +0200, Ahmad Fatoum wrote:
> This is now doubly outdated. We have support for DDR in a number of
> drivers and HS200 for one SoC (ZynqMP) and more is likely to come with
> time, so remove that outdate info.
> 
> 

Applied, thanks!

[1/1] Documentation: devel: project-ideas: remove outdated info on MMC speed
  https://git.pengutronix.de/cgit/barebox/commit/?id=615b803a07c8 (link may 
not be stable)

Best regards,
-- 
Sascha Hauer 




[PATCH 1/8] bch: update from Kernel

2024-04-16 Thread Sascha Hauer
This updates BCH support from Linux as of Linux-6.9-rc2. Among other
things in Linux the bch function names changed from a _bch suffix to a bch_
prefix.

Link: https://lore.barebox.org/20240416062147.1337233-1-s.ha...@pengutronix.de
Signed-off-by: Sascha Hauer 
---
 common/imx-bbu-nand-fcb.c   |  12 +--
 drivers/mtd/devices/docg3.c |   8 +-
 drivers/mtd/nand/nand_bch.c |  10 +--
 include/linux/bch.h |  25 ++
 lib/Kconfig |   1 +
 lib/bch.c   | 167 +++-
 6 files changed, 130 insertions(+), 93 deletions(-)

diff --git a/common/imx-bbu-nand-fcb.c b/common/imx-bbu-nand-fcb.c
index 0d46192720..d0261140cf 100644
--- a/common/imx-bbu-nand-fcb.c
+++ b/common/imx-bbu-nand-fcb.c
@@ -79,7 +79,7 @@ static void encode_bch_ecc(void *buf, struct fcb_block *fcb, 
int eccbits)
int blocksize = 128;
int numblocks = 8;
int ecc_buf_size = (m * eccbits + 7) / 8;
-   struct bch_control *bch = init_bch(m, eccbits, 0);
+   struct bch_control *bch = bch_init(m, eccbits, 0, false);
uint8_t *ecc_buf = xmalloc(ecc_buf_size);
uint8_t *tmp_buf = xzalloc(blocksize * numblocks);
uint8_t *psrc, *pdst;
@@ -109,7 +109,7 @@ static void encode_bch_ecc(void *buf, struct fcb_block 
*fcb, int eccbits)
for (j = 0; j < blocksize; j++)
psrc[j] = reverse_bit(psrc[j]);
 
-   encode_bch(bch, psrc, blocksize, ecc_buf);
+   bch_encode(bch, psrc, blocksize, ecc_buf);
 
/* reverse ecc bit */
for (j = 0; j < ecc_buf_size; j++)
@@ -121,7 +121,7 @@ static void encode_bch_ecc(void *buf, struct fcb_block 
*fcb, int eccbits)
 
free(ecc_buf);
free(tmp_buf);
-   free_bch(bch);
+   bch_free(bch);
 }
 
 static struct fcb_block *fcb_decode_bch(void *rawpage, int eccbits)
@@ -130,7 +130,7 @@ static struct fcb_block *fcb_decode_bch(void *rawpage, int 
eccbits)
int blocksize = 128;
int numblocks = 8;
int ecc_buf_size = (m * eccbits + 7) / 8;
-   struct bch_control *bch = init_bch(m, eccbits, 0);
+   struct bch_control *bch = bch_init(m, eccbits, 0, false);
uint8_t *fcb = xmalloc(numblocks * blocksize);
uint8_t *ecc_buf = xmalloc(ecc_buf_size);
uint8_t *data_buf = xmalloc(blocksize);
@@ -152,7 +152,7 @@ static struct fcb_block *fcb_decode_bch(void *rawpage, int 
eccbits)
for (j = 0; j < ecc_buf_size; j++)
ecc_buf[j] = reverse_bit(psrc[j + blocksize]);
 
-   ret = decode_bch(bch, data_buf, blocksize, ecc_buf,
+   ret = bch_decode(bch, data_buf, blocksize, ecc_buf,
 NULL, NULL, errloc);
 
if (ret < 0) {
@@ -185,7 +185,7 @@ static struct fcb_block *fcb_decode_bch(void *rawpage, int 
eccbits)
free(data_buf);
free(ecc_buf);
free(errloc);
-   free_bch(bch);
+   bch_free(bch);
 
return (struct fcb_block *)fcb;
 }
diff --git a/drivers/mtd/devices/docg3.c b/drivers/mtd/devices/docg3.c
index 593a7035e5..fcf9403b8f 100644
--- a/drivers/mtd/devices/docg3.c
+++ b/drivers/mtd/devices/docg3.c
@@ -325,7 +325,7 @@ static int doc_ecc_bch_fix_data(struct docg3 *docg3, void 
*buf, u8 *hwecc)
 
for (i = 0; i < DOC_ECC_BCH_SIZE; i++)
ecc[i] = bitrev8(hwecc[i]);
-   numerrs = decode_bch(docg3_bch, NULL, DOC_ECC_BCH_COVERED_BYTES,
+   numerrs = bch_decode(docg3_bch, NULL, DOC_ECC_BCH_COVERED_BYTES,
 NULL, ecc, NULL, errorpos);
BUG_ON(numerrs == -EINVAL);
if (numerrs < 0)
@@ -1144,8 +1144,8 @@ static int __init docg3_probe(struct device *dev)
base = IOMEM(iores->start);
 
ret = -ENOMEM;
-   docg3_bch = init_bch(DOC_ECC_BCH_M, DOC_ECC_BCH_T,
-DOC_ECC_BCH_PRIMPOLY);
+   docg3_bch = bch_init(DOC_ECC_BCH_M, DOC_ECC_BCH_T,
+DOC_ECC_BCH_PRIMPOLY, false);
if (!docg3_bch)
goto nomem2;
 
@@ -1181,7 +1181,7 @@ static int __init docg3_probe(struct device *dev)
ret = -ENODEV;
dev_info(dev, "No supported DiskOnChip found\n");
 err_probe:
-   free_bch(docg3_bch);
+   bch_free(docg3_bch);
 nomem2:
return ret;
 }
diff --git a/drivers/mtd/nand/nand_bch.c b/drivers/mtd/nand/nand_bch.c
index 0d636d9608..45f9c5052a 100644
--- a/drivers/mtd/nand/nand_bch.c
+++ b/drivers/mtd/nand/nand_bch.c
@@ -42,7 +42,7 @@ int nand_bch_calculate_ecc(struct nand_chip *chip, const 
unsigned char *buf,
unsigned int i;
 
memset(code, 0, chip->ecc.bytes);
-   encode_bch(nbc->bch, buf, chip->ecc.size, code);
+   bch_encode(nbc->bch, buf, chip->ecc.size, code);
 
/* apply mask so that an erased page is a valid codeword */
for (i = 0; i < chip->ecc.bytes; i++)
@@ -68,7 +68,7 @@ int na

[PATCH 5/8] mtd: nand: replace nand_imx driver with kernel driver

2024-04-16 Thread Sascha Hauer
The barebox nand_imx driver has diverged a lot from the corresponding
Kernel driver. To reduce maintenance effort replace the driver with
the Kernel driver. The driver is mostly taken from the Kernel and only
adjusted to compile with barebox. The only significant change is that
the driver creates the flash BBT if none exists, like our old driver
did.

Signed-off-by: Sascha Hauer 
---
 drivers/mtd/nand/raw/Makefile   |2 +-
 drivers/mtd/nand/raw/mxc_nand.c | 1880 +++
 drivers/mtd/nand/raw/nand_imx.c | 1483 
 3 files changed, 1881 insertions(+), 1484 deletions(-)
 create mode 100644 drivers/mtd/nand/raw/mxc_nand.c
 delete mode 100644 drivers/mtd/nand/raw/nand_imx.c

diff --git a/drivers/mtd/nand/raw/Makefile b/drivers/mtd/nand/raw/Makefile
index f0e8834e25..38c7cc809d 100644
--- a/drivers/mtd/nand/raw/Makefile
+++ b/drivers/mtd/nand/raw/Makefile
@@ -10,7 +10,7 @@ obj-$(CONFIG_MTD_RAW_NAND)+= nand_jedec.o
 obj-$(CONFIG_MTD_RAW_NAND) += nand_bbt.o
 
 obj-$(CONFIG_MTD_NAND_NOMADIK) += nomadik_nand.o
-obj-$(CONFIG_NAND_IMX) += nand_imx.o
+obj-$(CONFIG_NAND_IMX) += mxc_nand.o
 obj-$(CONFIG_NAND_OMAP_GPMC)   += nand_omap_gpmc.o 
nand_omap_bch_decoder.o
 obj-$(CONFIG_MTD_NAND_OMAP_ELM)+= omap_elm.o
 obj-$(CONFIG_NAND_ORION)   += nand_orion.o
diff --git a/drivers/mtd/nand/raw/mxc_nand.c b/drivers/mtd/nand/raw/mxc_nand.c
new file mode 100644
index 00..9b5b5c744a
--- /dev/null
+++ b/drivers/mtd/nand/raw/mxc_nand.c
@@ -0,0 +1,1880 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2004-2007 Freescale Semiconductor, Inc. All Rights Reserved.
+ * Copyright 2008 Sascha Hauer, ker...@pengutronix.de
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define DRIVER_NAME "mxc_nand"
+
+/* Addresses for NFC registers */
+#define NFC_V1_V2_BUF_SIZE (host->regs + 0x00)
+#define NFC_V1_V2_BUF_ADDR (host->regs + 0x04)
+#define NFC_V1_V2_FLASH_ADDR   (host->regs + 0x06)
+#define NFC_V1_V2_FLASH_CMD(host->regs + 0x08)
+#define NFC_V1_V2_CONFIG   (host->regs + 0x0a)
+#define NFC_V1_V2_ECC_STATUS_RESULT(host->regs + 0x0c)
+#define NFC_V1_V2_RSLTMAIN_AREA(host->regs + 0x0e)
+#define NFC_V21_RSLTSPARE_AREA (host->regs + 0x10)
+#define NFC_V1_V2_WRPROT   (host->regs + 0x12)
+#define NFC_V1_UNLOCKSTART_BLKADDR (host->regs + 0x14)
+#define NFC_V1_UNLOCKEND_BLKADDR   (host->regs + 0x16)
+#define NFC_V21_UNLOCKSTART_BLKADDR0   (host->regs + 0x20)
+#define NFC_V21_UNLOCKSTART_BLKADDR1   (host->regs + 0x24)
+#define NFC_V21_UNLOCKSTART_BLKADDR2   (host->regs + 0x28)
+#define NFC_V21_UNLOCKSTART_BLKADDR3   (host->regs + 0x2c)
+#define NFC_V21_UNLOCKEND_BLKADDR0 (host->regs + 0x22)
+#define NFC_V21_UNLOCKEND_BLKADDR1 (host->regs + 0x26)
+#define NFC_V21_UNLOCKEND_BLKADDR2 (host->regs + 0x2a)
+#define NFC_V21_UNLOCKEND_BLKADDR3 (host->regs + 0x2e)
+#define NFC_V1_V2_NF_WRPRST(host->regs + 0x18)
+#define NFC_V1_V2_CONFIG1  (host->regs + 0x1a)
+#define NFC_V1_V2_CONFIG2  (host->regs + 0x1c)
+
+#define NFC_V2_CONFIG1_ECC_MODE_4  (1 << 0)
+#define NFC_V1_V2_CONFIG1_SP_EN(1 << 2)
+#define NFC_V1_V2_CONFIG1_ECC_EN   (1 << 3)
+#define NFC_V1_V2_CONFIG1_INT_MSK  (1 << 4)
+#define NFC_V1_V2_CONFIG1_BIG  (1 << 5)
+#define NFC_V1_V2_CONFIG1_RST  (1 << 6)
+#define NFC_V1_V2_CONFIG1_CE   (1 << 7)
+#define NFC_V2_CONFIG1_ONE_CYCLE   (1 << 8)
+#define NFC_V2_CONFIG1_PPB(x)  (((x) & 0x3) << 9)
+#define NFC_V2_CONFIG1_FP_INT  (1 << 11)
+
+#define NFC_V1_V2_CONFIG2_INT  (1 << 15)
+
+/*
+ * Operation modes for the NFC. Valid for v1, v2 and v3
+ * type controllers.
+ */
+#define NFC_CMD(1 << 0)
+#define NFC_ADDR   (1 << 1)
+#define NFC_INPUT  (1 << 2)
+#define NFC_OUTPUT (1 << 3)
+#define NFC_ID (1 << 4)
+#define NFC_STATUS (1 << 5)
+
+#define NFC_V3_FLASH_CMD   (host->regs_axi + 0x00)
+#define NFC_V3_FLASH_ADDR0 (host->regs_axi + 0x04)
+
+#define NFC_V3_CONFIG1 (host->regs_axi + 0x34)
+#define NFC_V3_CONFIG1_SP_EN   (1 << 0)
+#define NFC_V3_CONFIG1_RBA(x)  (((x) & 0x7 ) << 4)
+
+#define NFC_V3_ECC_STATUS_RESULT   (host->regs_axi + 0x38)
+
+#define NFC_V3_LAUNCH  (host->regs_axi + 0x40)
+
+#define NFC_V3_WRPROT  (host->regs_ip + 0x0)
+#define NFC_V3_WRPROT_LOCK_TIGHT

[PATCH 7/8] mtd: nand: mxc_nand: implement exec_op

2024-04-16 Thread Sascha Hauer
This converts the driver to the more modern exec_op which gets us rid
of a bunch of legacy code. Tested on i.MX27 and i.MX25.

Signed-off-by: Sascha Hauer 
---
 drivers/mtd/nand/raw/mxc_nand.c | 426 ++--
 1 file changed, 132 insertions(+), 294 deletions(-)

diff --git a/drivers/mtd/nand/raw/mxc_nand.c b/drivers/mtd/nand/raw/mxc_nand.c
index d9e06a0014..bd320bf3b8 100644
--- a/drivers/mtd/nand/raw/mxc_nand.c
+++ b/drivers/mtd/nand/raw/mxc_nand.c
@@ -119,8 +119,7 @@ struct mxc_nand_host;
 
 struct mxc_nand_devtype_data {
void (*preset)(struct mtd_info *);
-   int (*read_page)(struct nand_chip *chip, void *buf, void *oob, bool ecc,
-int page);
+   int (*read_page)(struct nand_chip *chip);
void (*send_cmd)(struct mxc_nand_host *, uint16_t, int);
void (*send_addr)(struct mxc_nand_host *, uint16_t, int);
void (*send_page)(struct mtd_info *, unsigned int);
@@ -175,8 +174,7 @@ struct mxc_nand_host {
 
struct completion   op_completion;
 
-   uint8_t *data_buf;
-   unsigned intbuf_start;
+   void*data_buf;
 
const struct mxc_nand_devtype_data *devtype_data;
 };
@@ -279,63 +277,6 @@ static void copy_spare(struct mtd_info *mtd, bool bfrom, 
void *buf)
}
 }
 
-/*
- * MXC NANDFC can only perform full page+spare or spare-only read/write.  When
- * the upper layers perform a read/write buf operation, the saved column 
address
- * is used to index into the full page. So usually this function is called with
- * column == 0 (unless no column cycle is needed indicated by column == -1)
- */
-static void mxc_do_addr_cycle(struct mtd_info *mtd, int column, int page_addr)
-{
-   struct nand_chip *nand_chip = mtd_to_nand(mtd);
-   struct mxc_nand_host *host = nand_get_controller_data(nand_chip);
-
-   /* Write out column address, if necessary */
-   if (column != -1) {
-   host->devtype_data->send_addr(host, column & 0xff,
- page_addr == -1);
-   if (mtd->writesize > 512)
-   /* another col addr cycle for 2k page */
-   host->devtype_data->send_addr(host,
- (column >> 8) & 0xff,
- false);
-   }
-
-   /* Write out page address, if necessary */
-   if (page_addr != -1) {
-   /* paddr_0 - p_addr_7 */
-   host->devtype_data->send_addr(host, (page_addr & 0xff), false);
-
-   if (mtd->writesize > 512) {
-   if (mtd->size >= 0x1000) {
-   /* paddr_8 - paddr_15 */
-   host->devtype_data->send_addr(host,
-   (page_addr >> 8) & 0xff,
-   false);
-   host->devtype_data->send_addr(host,
-   (page_addr >> 16) & 0xff,
-   true);
-   } else
-   /* paddr_8 - paddr_15 */
-   host->devtype_data->send_addr(host,
-   (page_addr >> 8) & 0xff, true);
-   } else {
-   if (nand_chip->options & NAND_ROW_ADDR_3) {
-   /* paddr_8 - paddr_15 */
-   host->devtype_data->send_addr(host,
-   (page_addr >> 8) & 0xff,
-   false);
-   host->devtype_data->send_addr(host,
-   (page_addr >> 16) & 0xff,
-   true);
-   } else
-   /* paddr_8 - paddr_15 */
-   host->devtype_data->send_addr(host,
-   (page_addr >> 8) & 0xff, true);
-   }
-   }
-}
-
 static int check_int_v3(struct mxc_nand_host *host)
 {
uint32_t tmp;
@@ -716,18 +657,7 @@ static void mxc_nand_enable_hwecc_v3(struct nand_chip 
*chip, bool enable)
writel(config2, NFC_V3_CONFIG2);
 }
 
-/* This functions is used by upper layer to checks if device is ready */
-static int mxc_nand_dev_ready(struct nand_chip *chip)
-{
-   /*
-* NFC handles R/B internally. Therefore, this function
-* always returns status as ready.
-*/
-   return 1;
-}
-
-static int mxc_nand_read_page_v1(struct nand_chip *chip, void *buf, void *oob,
-

[PATCH 8/8] mtd: nand: mxc_nand: support software ECC

2024-04-16 Thread Sascha Hauer
To support software ECC we still need the driver provided read_oob,
read_page_raw and write_page_raw ops, so set them unconditionally
no matter which engine_type we use. The OOB layout on the other hand
represents the layout the i.MX ECC hardware uses, so set this only
when NAND_ECC_ENGINE_TYPE_ON_HOST is in use.

With these changes the driver can be used with software BCH ECC which
is useful for NAND chips that require a stronger ECC than the i.MX
hardware supports.

Signed-off-by: Sascha Hauer 
---
 drivers/mtd/nand/raw/mxc_nand.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/mtd/nand/raw/mxc_nand.c b/drivers/mtd/nand/raw/mxc_nand.c
index bd320bf3b8..d057d1b1bc 100644
--- a/drivers/mtd/nand/raw/mxc_nand.c
+++ b/drivers/mtd/nand/raw/mxc_nand.c
@@ -1347,15 +1347,16 @@ static int mxcnd_attach_chip(struct nand_chip *chip)
chip->ecc.bytes = host->devtype_data->eccbytes;
host->eccsize = host->devtype_data->eccsize;
chip->ecc.size = 512;
-   mtd_set_ooblayout(mtd, host->devtype_data->ooblayout);
+
+   chip->ecc.read_oob = mxc_nand_read_oob;
+   chip->ecc.read_page_raw = mxc_nand_read_page_raw;
+   chip->ecc.write_page_raw = mxc_nand_write_page_raw;
 
switch (chip->ecc.engine_type) {
case NAND_ECC_ENGINE_TYPE_ON_HOST:
+   mtd_set_ooblayout(mtd, host->devtype_data->ooblayout);
chip->ecc.read_page = mxc_nand_read_page;
-   chip->ecc.read_page_raw = mxc_nand_read_page_raw;
-   chip->ecc.read_oob = mxc_nand_read_oob;
chip->ecc.write_page = mxc_nand_write_page_ecc;
-   chip->ecc.write_page_raw = mxc_nand_write_page_raw;
chip->ecc.write_oob = mxc_nand_write_oob;
break;
 
-- 
2.39.2




[PATCH 0/8] Update NAND layer

2024-04-16 Thread Sascha Hauer
This series comes out of the need to support software BCH ECC for the i.MX
NAND driver, as the ancient i.MX27 hardware only supports 1-bit Hamming
ECC which is not sufficient on more modern NAND chips.

1st of all the NAND layer is updated to Linux-6.9-rc2, because this has
better support for Software ECC. And yes, the update is overdue as our
last update is from Linux-5.9 which is already 4 years old. We take the
opportunity to move the NAND drivers over to drivers/mtd/nand/raw/, the
place where the Kernel NAND drivers live for several years now.

Next thing is to move the i.MX NAND driver over to exec_op which makes
it easier to support software BCH ECC. Before doing this we move over
to the Kernel i.MX NAND driver so that the same patches can be sent for
Kernel inclusion as well.

Finally fixing the driver for using software BCH ECC is only a small
patch.

I've tested the NAND layer update on i.MX6, i.MX27, i.MX25, SoCFPGA
(denali) and one Atmel sama5d4 device. The patch is huge and I am sure
there will be regressions somewhere in it, so I welcome all testing
reports and will happily fix fallout.

Sascha

Sascha Hauer (8):
  bch: update from Kernel
  mtd: nand: move to drivers/mtd/nand/raw/
  mtd: update _lock/_unlock prototype
  mtd: nand: update to Linux-6.9-rc2
  mtd: nand: replace nand_imx driver with kernel driver
  mtd: nand: mxc_nand: separate page read from ecc calc
  mtd: nand: mxc_nand: implement exec_op
  mtd: nand: mxc_nand: support software ECC

 commands/Kconfig  |6 +-
 common/imx-bbu-nand-fcb.c |   12 +-
 drivers/mtd/Makefile  |2 +-
 drivers/mtd/devices/docg3.c   |8 +-
 drivers/mtd/mtdconcat.c   |4 +-
 drivers/mtd/nand/Kconfig  |  184 +-
 drivers/mtd/nand/Makefile |   28 +-
 drivers/mtd/nand/core.c   |  133 +-
 drivers/mtd/nand/ecc-sw-bch.c |  406 
 drivers/mtd/nand/ecc-sw-hamming.c |  660 +++
 drivers/mtd/nand/ecc.c|  697 +++
 drivers/mtd/nand/nand_bch.c   |  219 ---
 drivers/mtd/nand/nand_imx.c   | 1494 --
 drivers/mtd/nand/raw/Kconfig  |  171 ++
 drivers/mtd/nand/raw/Makefile |   23 +
 drivers/mtd/nand/{ => raw}/atmel/Makefile |0
 .../mtd/nand/{ => raw}/atmel/atmel_nand_ecc.h |0
 drivers/mtd/nand/{ => raw}/atmel/legacy.c |   11 +-
 .../nand/{ => raw}/atmel/nand-controller.c|0
 drivers/mtd/nand/{ => raw}/atmel/pmecc.c  |0
 drivers/mtd/nand/{ => raw}/atmel/pmecc.h  |0
 drivers/mtd/nand/{ => raw}/denali.h   |0
 drivers/mtd/nand/{ => raw}/fsl_ifc.h  |0
 drivers/mtd/nand/{ => raw}/internals.h|5 +
 drivers/mtd/nand/raw/mxc_nand.c   | 1751 +
 drivers/mtd/nand/{ => raw}/nand_amd.c |0
 drivers/mtd/nand/{ => raw}/nand_base.c| 1635 +--
 drivers/mtd/nand/{ => raw}/nand_bbt.c |0
 drivers/mtd/nand/{ => raw}/nand_denali.c  |3 +-
 drivers/mtd/nand/{ => raw}/nand_denali_dt.c   |0
 drivers/mtd/nand/{ => raw}/nand_ecc.c |0
 drivers/mtd/nand/{ => raw}/nand_esmt.c|   17 +-
 drivers/mtd/nand/{ => raw}/nand_fsl_ifc.c |8 +-
 drivers/mtd/nand/{ => raw}/nand_hynix.c   |   59 +-
 drivers/mtd/nand/{ => raw}/nand_ids.c |0
 drivers/mtd/nand/{ => raw}/nand_jedec.c   |0
 drivers/mtd/nand/{ => raw}/nand_legacy.c  |0
 drivers/mtd/nand/{ => raw}/nand_macronix.c|   42 +-
 drivers/mtd/nand/{ => raw}/nand_micron.c  |   24 +-
 drivers/mtd/nand/{ => raw}/nand_mrvl_nfc.c|   10 +-
 drivers/mtd/nand/{ => raw}/nand_mxs.c |2 +-
 .../nand/{ => raw}/nand_omap_bch_decoder.c|0
 .../nand/{ => raw}/nand_omap_bch_decoder.h|0
 drivers/mtd/nand/{ => raw}/nand_omap_gpmc.c   |5 +-
 drivers/mtd/nand/{ => raw}/nand_onfi.c|   32 +-
 drivers/mtd/nand/{ => raw}/nand_orion.c   |3 +-
 drivers/mtd/nand/{ => raw}/nand_samsung.c |   22 +-
 drivers/mtd/nand/{ => raw}/nand_timings.c |  370 +++-
 drivers/mtd/nand/{ => raw}/nand_toshiba.c |   25 +-
 drivers/mtd/nand/{ => raw}/nomadik_nand.c |2 +-
 drivers/mtd/nand/{ => raw}/omap_elm.c |0
 drivers/mtd/nand/{ => raw}/stm32_fmc2_nand.c  |2 +-
 drivers/mtd/nor/cfi_flash.c   |4 +-
 drivers/mtd/partition.c   |4 +-
 drivers/mtd/spi-nor/spi-nor.c |4 +-
 drivers/net/e1000/mtd.c   |4 +-
 drivers/of/of_mtd.c   |1 -
 include/linux/bch.h   |   25 +-
 include/linux/mtd/mtd.h   |7 +-
 include/linux/mtd/nand-ecc-s

[PATCH 2/8] mtd: nand: move to drivers/mtd/nand/raw/

2024-04-16 Thread Sascha Hauer
Linux moved the raw NAND drivers from drivers/mtd/nand/ to
drivers/mtd/nand/raw/ years ago. Follow suit and do the same
for barebox to be more consistent with Linux.

Signed-off-by: Sascha Hauer 
---
 commands/Kconfig  |   6 +-
 drivers/mtd/Makefile  |   2 +-
 drivers/mtd/nand/Kconfig  | 165 +---
 drivers/mtd/nand/Makefile |  24 +--
 drivers/mtd/nand/raw/Kconfig  | 177 ++
 drivers/mtd/nand/raw/Makefile |  24 +++
 drivers/mtd/nand/{ => raw}/atmel/Makefile |   0
 .../mtd/nand/{ => raw}/atmel/atmel_nand_ecc.h |   0
 drivers/mtd/nand/{ => raw}/atmel/legacy.c |   0
 .../nand/{ => raw}/atmel/nand-controller.c|   0
 drivers/mtd/nand/{ => raw}/atmel/pmecc.c  |   0
 drivers/mtd/nand/{ => raw}/atmel/pmecc.h  |   0
 drivers/mtd/nand/{ => raw}/denali.h   |   0
 drivers/mtd/nand/{ => raw}/fsl_ifc.h  |   0
 drivers/mtd/nand/{ => raw}/internals.h|   0
 drivers/mtd/nand/{ => raw}/nand_amd.c |   0
 drivers/mtd/nand/{ => raw}/nand_base.c|   0
 drivers/mtd/nand/{ => raw}/nand_bbt.c |   0
 drivers/mtd/nand/{ => raw}/nand_bch.c |   0
 drivers/mtd/nand/{ => raw}/nand_denali.c  |   0
 drivers/mtd/nand/{ => raw}/nand_denali_dt.c   |   0
 drivers/mtd/nand/{ => raw}/nand_ecc.c |   0
 drivers/mtd/nand/{ => raw}/nand_esmt.c|   0
 drivers/mtd/nand/{ => raw}/nand_fsl_ifc.c |   0
 drivers/mtd/nand/{ => raw}/nand_hynix.c   |   0
 drivers/mtd/nand/{ => raw}/nand_ids.c |   0
 drivers/mtd/nand/{ => raw}/nand_imx.c |   0
 drivers/mtd/nand/{ => raw}/nand_jedec.c   |   0
 drivers/mtd/nand/{ => raw}/nand_legacy.c  |   0
 drivers/mtd/nand/{ => raw}/nand_macronix.c|   0
 drivers/mtd/nand/{ => raw}/nand_micron.c  |   0
 drivers/mtd/nand/{ => raw}/nand_mrvl_nfc.c|   0
 drivers/mtd/nand/{ => raw}/nand_mxs.c |   0
 .../nand/{ => raw}/nand_omap_bch_decoder.c|   0
 .../nand/{ => raw}/nand_omap_bch_decoder.h|   0
 drivers/mtd/nand/{ => raw}/nand_omap_gpmc.c   |   0
 drivers/mtd/nand/{ => raw}/nand_onfi.c|   0
 drivers/mtd/nand/{ => raw}/nand_orion.c   |   0
 drivers/mtd/nand/{ => raw}/nand_samsung.c |   0
 drivers/mtd/nand/{ => raw}/nand_timings.c |   0
 drivers/mtd/nand/{ => raw}/nand_toshiba.c |   0
 drivers/mtd/nand/{ => raw}/nomadik_nand.c |   0
 drivers/mtd/nand/{ => raw}/omap_elm.c |   0
 drivers/mtd/nand/{ => raw}/stm32_fmc2_nand.c  |   0
 include/nand.h|   2 +-
 45 files changed, 213 insertions(+), 187 deletions(-)
 create mode 100644 drivers/mtd/nand/raw/Kconfig
 create mode 100644 drivers/mtd/nand/raw/Makefile
 rename drivers/mtd/nand/{ => raw}/atmel/Makefile (100%)
 rename drivers/mtd/nand/{ => raw}/atmel/atmel_nand_ecc.h (100%)
 rename drivers/mtd/nand/{ => raw}/atmel/legacy.c (100%)
 rename drivers/mtd/nand/{ => raw}/atmel/nand-controller.c (100%)
 rename drivers/mtd/nand/{ => raw}/atmel/pmecc.c (100%)
 rename drivers/mtd/nand/{ => raw}/atmel/pmecc.h (100%)
 rename drivers/mtd/nand/{ => raw}/denali.h (100%)
 rename drivers/mtd/nand/{ => raw}/fsl_ifc.h (100%)
 rename drivers/mtd/nand/{ => raw}/internals.h (100%)
 rename drivers/mtd/nand/{ => raw}/nand_amd.c (100%)
 rename drivers/mtd/nand/{ => raw}/nand_base.c (100%)
 rename drivers/mtd/nand/{ => raw}/nand_bbt.c (100%)
 rename drivers/mtd/nand/{ => raw}/nand_bch.c (100%)
 rename drivers/mtd/nand/{ => raw}/nand_denali.c (100%)
 rename drivers/mtd/nand/{ => raw}/nand_denali_dt.c (100%)
 rename drivers/mtd/nand/{ => raw}/nand_ecc.c (100%)
 rename drivers/mtd/nand/{ => raw}/nand_esmt.c (100%)
 rename drivers/mtd/nand/{ => raw}/nand_fsl_ifc.c (100%)
 rename drivers/mtd/nand/{ => raw}/nand_hynix.c (100%)
 rename drivers/mtd/nand/{ => raw}/nand_ids.c (100%)
 rename drivers/mtd/nand/{ => raw}/nand_imx.c (100%)
 rename drivers/mtd/nand/{ => raw}/nand_jedec.c (100%)
 rename drivers/mtd/nand/{ => raw}/nand_legacy.c (100%)
 rename drivers/mtd/nand/{ => raw}/nand_macronix.c (100%)
 rename drivers/mtd/nand/{ => raw}/nand_micron.c (100%)
 rename drivers/mtd/nand/{ => raw}/nand_mrvl_nfc.c (100%)
 rename drivers/mtd/nand/{ => raw}/nand_mxs.c (100%)
 rename drivers/mtd/nand/{ => raw}/nand_omap_bch_decoder.c (100%)
 rename drivers/mtd/nand/{ => raw}/nand_omap_bch_decoder.h (100%)
 rename drivers/mtd/nand/{ => raw}/nand_omap_gpmc.c (100%)
 rename drivers/mtd/nand/{ => raw}/nand_onfi.c (100%)
 rename drivers/mtd/nand/{ => raw}/nand_orion.c (100%)
 rename drivers/mtd/nand/{ => raw}/nand_samsung.c (100%)
 rename drivers/mtd/nand/{ => raw}/nand_timings.c (100%)
 rename drivers/mtd/nand/{ => raw}/nand_toshiba.c (100%)
 renam

[PATCH 3/8] mtd: update _lock/_unlock prototype

2024-04-16 Thread Sascha Hauer
In Linux the _lock/_unlock hooks now take a uint64_t as length argument.
Follow suit to be more consistent with Linux.

Signed-off-by: Sascha Hauer 
---
 drivers/mtd/mtdconcat.c  | 4 ++--
 drivers/mtd/nand/raw/nand_base.c | 4 ++--
 drivers/mtd/nor/cfi_flash.c  | 4 ++--
 drivers/mtd/partition.c  | 4 ++--
 drivers/mtd/spi-nor/spi-nor.c| 4 ++--
 drivers/net/e1000/mtd.c  | 4 ++--
 include/linux/mtd/mtd.h  | 4 ++--
 7 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/mtd/mtdconcat.c b/drivers/mtd/mtdconcat.c
index 964b00166a..d4f0227384 100644
--- a/drivers/mtd/mtdconcat.c
+++ b/drivers/mtd/mtdconcat.c
@@ -382,7 +382,7 @@ static int concat_erase(struct mtd_info *mtd, struct 
erase_info *instr)
return 0;
 }
 
-static int concat_lock(struct mtd_info *mtd, loff_t ofs, size_t len)
+static int concat_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
 {
struct mtd_concat *concat = CONCAT(mtd);
int i, err = -EINVAL;
@@ -416,7 +416,7 @@ static int concat_lock(struct mtd_info *mtd, loff_t ofs, 
size_t len)
return err;
 }
 
-static int concat_unlock(struct mtd_info *mtd, loff_t ofs, size_t len)
+static int concat_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
 {
struct mtd_concat *concat = CONCAT(mtd);
int i, err = 0;
diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c
index 2599e8c8c2..439c3f72d2 100644
--- a/drivers/mtd/nand/raw/nand_base.c
+++ b/drivers/mtd/nand/raw/nand_base.c
@@ -4449,7 +4449,7 @@ static int nand_block_markgood(struct mtd_info *mtd, 
loff_t ofs)
  * @ofs: offset byte address
  * @len: number of bytes to lock (must be a multiple of block/page size)
  */
-static int nand_lock(struct mtd_info *mtd, loff_t ofs, size_t len)
+static int nand_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
 {
struct nand_chip *chip = mtd_to_nand(mtd);
 
@@ -4465,7 +4465,7 @@ static int nand_lock(struct mtd_info *mtd, loff_t ofs, 
size_t len)
  * @ofs: offset byte address
  * @len: number of bytes to unlock (must be a multiple of block/page size)
  */
-static int nand_unlock(struct mtd_info *mtd, loff_t ofs, size_t len)
+static int nand_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
 {
struct nand_chip *chip = mtd_to_nand(mtd);
 
diff --git a/drivers/mtd/nor/cfi_flash.c b/drivers/mtd/nor/cfi_flash.c
index ac46575004..2cb3d5538f 100644
--- a/drivers/mtd/nor/cfi_flash.c
+++ b/drivers/mtd/nor/cfi_flash.c
@@ -652,14 +652,14 @@ static int cfi_mtd_protect(struct flash_info *finfo, 
loff_t offset, size_t len,
return 0;
 }
 
-static int cfi_mtd_lock(struct mtd_info *mtd, loff_t offset, size_t len)
+static int cfi_mtd_lock(struct mtd_info *mtd, loff_t offset, uint64_t len)
 {
struct flash_info *finfo = container_of(mtd, struct flash_info, mtd);
 
return cfi_mtd_protect(finfo, offset, len, 1);
 }
 
-static int cfi_mtd_unlock(struct mtd_info *mtd, loff_t offset, size_t len)
+static int cfi_mtd_unlock(struct mtd_info *mtd, loff_t offset, uint64_t len)
 {
struct flash_info *finfo = container_of(mtd, struct flash_info, mtd);
 
diff --git a/drivers/mtd/partition.c b/drivers/mtd/partition.c
index 4ebc5bba41..c53375e0e2 100644
--- a/drivers/mtd/partition.c
+++ b/drivers/mtd/partition.c
@@ -80,7 +80,7 @@ static int mtd_part_erase(struct mtd_info *mtd, struct 
erase_info *instr)
return ret;
 }
 
-static int mtd_part_lock(struct mtd_info *mtd, loff_t offset, size_t len)
+static int mtd_part_lock(struct mtd_info *mtd, loff_t offset, uint64_t len)
 {
if (!mtd->parent->_lock)
return -ENOSYS;
@@ -96,7 +96,7 @@ static int mtd_part_lock(struct mtd_info *mtd, loff_t offset, 
size_t len)
return mtd->parent->_lock(mtd->parent, offset, len);
 }
 
-static int mtd_part_unlock(struct mtd_info *mtd, loff_t offset, size_t len)
+static int mtd_part_unlock(struct mtd_info *mtd, loff_t offset, uint64_t len)
 {
if (!mtd->parent->_unlock)
return -ENOSYS;
diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
index 1773db09a1..9fdcffeed1 100644
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
@@ -546,12 +546,12 @@ static int spi_nor_erase(struct mtd_info *mtd, struct 
erase_info *instr)
return ret;
 }
 
-static int spi_nor_lock(struct mtd_info *mtd, loff_t ofs, size_t len)
+static int spi_nor_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
 {
return 0;
 }
 
-static int spi_nor_unlock(struct mtd_info *mtd, loff_t ofs, size_t len)
+static int spi_nor_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
 {
struct spi_nor *nor = mtd_to_spi_nor(mtd);
uint8_t status;
diff --git a/drivers/net/e1000/mtd.c b/drivers/net/e1000/mtd.c
index d472bd10a9..50883fc2a6 100644
--- a/drivers/net/e1000/mtd.c
+++ b/drivers/net/e1000/mtd.c
@@ -688,12 +688,12 @@ static int e1000_mtd_sr_rmw(struct mtd_info *

[PATCH 6/8] mtd: nand: mxc_nand: separate page read from ecc calc

2024-04-16 Thread Sascha Hauer
Our read_page hook currently reads out a page and also counts and
returns the number of bitflips. In upcoming exec_op conversion we'll
need to read the page data in exec_op, but the bitflip information
will be needed in mxc_nand_read_page(). To ease exec_op conversion
separate the page read out from the bitflip evaluation.

For the v2/v3 controllers we can leave the bitflip information in the
status register for later evaluation. For the v1 controller this is
not possible, because the status register is overwritten with each
subpage read. We therefore store the bitflip information in the private
data.

Signed-off-by: Sascha Hauer 
---
 drivers/mtd/nand/raw/mxc_nand.c | 140 
 1 file changed, 86 insertions(+), 54 deletions(-)

diff --git a/drivers/mtd/nand/raw/mxc_nand.c b/drivers/mtd/nand/raw/mxc_nand.c
index 9b5b5c744a..d9e06a0014 100644
--- a/drivers/mtd/nand/raw/mxc_nand.c
+++ b/drivers/mtd/nand/raw/mxc_nand.c
@@ -12,6 +12,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #define DRIVER_NAME "mxc_nand"
@@ -40,6 +41,8 @@
 #define NFC_V1_V2_CONFIG1  (host->regs + 0x1a)
 #define NFC_V1_V2_CONFIG2  (host->regs + 0x1c)
 
+#define NFC_V1_V2_ECC_STATUS_RESULT_ERM GENMASK(3, 2)
+
 #define NFC_V2_CONFIG1_ECC_MODE_4  (1 << 0)
 #define NFC_V1_V2_CONFIG1_SP_EN(1 << 2)
 #define NFC_V1_V2_CONFIG1_ECC_EN   (1 << 3)
@@ -125,7 +128,7 @@ struct mxc_nand_devtype_data {
uint16_t (*get_dev_status)(struct mxc_nand_host *);
int (*check_int)(struct mxc_nand_host *);
void (*irq_control)(struct mxc_nand_host *, int);
-   u32 (*get_ecc_status)(struct mxc_nand_host *);
+   u32 (*get_ecc_status)(struct nand_chip *);
const struct mtd_ooblayout_ops *ooblayout;
void (*select_chip)(struct nand_chip *chip, int cs);
int (*setup_interface)(struct nand_chip *chip, int csline,
@@ -168,6 +171,7 @@ struct mxc_nand_host {
int eccsize;
int used_oobsize;
int active_cs;
+   unsigned intecc_stats_v1;
 
struct completion   op_completion;
 
@@ -388,19 +392,81 @@ static void irq_control_v3(struct mxc_nand_host *host, 
int activate)
writel(tmp, NFC_V3_CONFIG2);
 }
 
-static u32 get_ecc_status_v1(struct mxc_nand_host *host)
+static u32 get_ecc_status_v1(struct nand_chip *chip)
+{
+   struct mtd_info *mtd = nand_to_mtd(chip);
+   struct mxc_nand_host *host = nand_get_controller_data(chip);
+   unsigned int ecc_stats, max_bitflips = 0;
+   int no_subpages, i;
+
+   no_subpages = mtd->writesize >> 9;
+
+   ecc_stats = host->ecc_stats_v1;
+
+   for (i = 0; i < no_subpages; i++) {
+   switch (ecc_stats & 0x3) {
+   case 0:
+   default:
+   break;
+   case 1:
+   mtd->ecc_stats.corrected++;
+   max_bitflips = 1;
+   break;
+   case 2:
+   mtd->ecc_stats.failed++;
+   break;
+   }
+
+   ecc_stats >>= 2;
+   }
+
+   return max_bitflips;
+}
+
+static u32 get_ecc_status_v2_v3(struct nand_chip *chip, unsigned int ecc_stat)
 {
-   return readw(NFC_V1_V2_ECC_STATUS_RESULT);
+   struct mtd_info *mtd = nand_to_mtd(chip);
+   struct mxc_nand_host *host = nand_get_controller_data(chip);
+   u8 ecc_bit_mask, err_limit;
+   unsigned int max_bitflips = 0;
+   int no_subpages, err;
+
+   ecc_bit_mask = (host->eccsize == 4) ? 0x7 : 0xf;
+   err_limit = (host->eccsize == 4) ? 0x4 : 0x8;
+
+   no_subpages = mtd->writesize >> 9;
+
+   do {
+   err = ecc_stat & ecc_bit_mask;
+   if (err > err_limit) {
+   mtd->ecc_stats.failed++;
+   } else {
+   mtd->ecc_stats.corrected += err;
+   max_bitflips = max_t(unsigned int, max_bitflips, err);
+   }
+
+   ecc_stat >>= 4;
+   } while (--no_subpages);
+
+   return max_bitflips;
 }
 
-static u32 get_ecc_status_v2(struct mxc_nand_host *host)
+static u32 get_ecc_status_v2(struct nand_chip *chip)
 {
-   return readl(NFC_V1_V2_ECC_STATUS_RESULT);
+   struct mxc_nand_host *host = nand_get_controller_data(chip);
+
+   u32 ecc_stat = readl(NFC_V1_V2_ECC_STATUS_RESULT);
+
+   return get_ecc_status_v2_v3(chip, ecc_stat);
 }
 
-static u32 get_ecc_status_v3(struct mxc_nand_host *host)
+static u32 get_ecc_status_v3(struct nand_chip *chip)
 {
-   return readl(NFC_V3_ECC_STATUS_RESULT);
+   struct mxc_nand_host *host = nand_get_controller_data(chip);
+
+   u32 ecc_stat = readl(NFC_V3_ECC_STATUS_RESULT);
+
+   return get_ecc_status_v2_v3(chip, ecc_stat);
 }

[PATCH 1/2] clk: imx27: add nand clock

2024-04-16 Thread Sascha Hauer
The NAND clock is currently missing. The NAND driver doesn't use it
currently, but will be using it later once we update the driver. Add
this missing clock.

Signed-off-by: Sascha Hauer 
---
 drivers/clk/imx/clk-imx27.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/clk/imx/clk-imx27.c b/drivers/clk/imx/clk-imx27.c
index 083d87fb34..7da4a1f9a6 100644
--- a/drivers/clk/imx/clk-imx27.c
+++ b/drivers/clk/imx/clk-imx27.c
@@ -246,6 +246,7 @@ static int imx27_ccm_probe(struct device *dev)
clkdev_add_physbase(clks[lcdc_ahb_gate], MX27_LCDC_BASE_ADDR, "ahb");
clkdev_add_physbase(clks[lcdc_ipg_gate], MX27_LCDC_BASE_ADDR, "ipg");
clkdev_add_physbase(clks[ipg], MX27_FEC_BASE_ADDR, NULL);
+   clkdev_add_physbase(clks[nfc_div], MX27_NFC_BASE_ADDR, NULL);
 
return 0;
 }
-- 
2.39.2




[PATCH 2/2] clk: imx27: add watchdog clock

2024-04-16 Thread Sascha Hauer
Since 87cad17964 the imxwd watchdog driver needs a clock to probe. Add
this clock for i.MX27 to make the watchdog driver work again.

Fixes: 87cad17964 ("watchdog: imxwd: get and enable clock")
Signed-off-by: Sascha Hauer 
---
 drivers/clk/imx/clk-imx27.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/clk/imx/clk-imx27.c b/drivers/clk/imx/clk-imx27.c
index 7da4a1f9a6..3f03705634 100644
--- a/drivers/clk/imx/clk-imx27.c
+++ b/drivers/clk/imx/clk-imx27.c
@@ -221,6 +221,7 @@ static int imx27_ccm_probe(struct device *dev)
clks[per3_gate] = imx_clk_gate("per3_gate", "per3_div", base + 
CCM_PCCR1, 8);
clks[lcdc_ahb_gate] = imx_clk_gate("lcdc_ahb_gate", "ahb", base + 
CCM_PCCR1, 15);
clks[lcdc_ipg_gate] = imx_clk_gate("lcdc_ipg_gate", "ipg", base + 
CCM_PCCR0, 14);
+   clks[wdog_ipg_gate] = imx_clk_gate("wdog_ipg_gate", "ipg", base + 
CCM_PCCR1, 24);
 
clkdev_add_physbase(clks[per1_div], MX27_GPT1_BASE_ADDR, NULL);
clkdev_add_physbase(clks[per1_div], MX27_GPT2_BASE_ADDR, NULL);
@@ -247,6 +248,7 @@ static int imx27_ccm_probe(struct device *dev)
clkdev_add_physbase(clks[lcdc_ipg_gate], MX27_LCDC_BASE_ADDR, "ipg");
clkdev_add_physbase(clks[ipg], MX27_FEC_BASE_ADDR, NULL);
clkdev_add_physbase(clks[nfc_div], MX27_NFC_BASE_ADDR, NULL);
+   clkdev_add_physbase(clks[wdog_ipg_gate], MX27_WDOG_BASE_ADDR, NULL);
 
return 0;
 }
-- 
2.39.2




[PATCH] bch: update from Kernel

2024-04-16 Thread Sascha Hauer
This updates BCH support from Linux as of Linux-6.9-rc2. Among other
things in Linux the bch function names changed from a _bch suffix to a bch_
prefix.

Signed-off-by: Sascha Hauer 
---
 common/imx-bbu-nand-fcb.c   |  12 +--
 drivers/mtd/devices/docg3.c |   8 +-
 drivers/mtd/nand/nand_bch.c |  10 +--
 include/linux/bch.h |  25 ++
 lib/Kconfig |   1 +
 lib/bch.c   | 167 +++-
 6 files changed, 130 insertions(+), 93 deletions(-)

diff --git a/common/imx-bbu-nand-fcb.c b/common/imx-bbu-nand-fcb.c
index 0d46192720..d0261140cf 100644
--- a/common/imx-bbu-nand-fcb.c
+++ b/common/imx-bbu-nand-fcb.c
@@ -79,7 +79,7 @@ static void encode_bch_ecc(void *buf, struct fcb_block *fcb, 
int eccbits)
int blocksize = 128;
int numblocks = 8;
int ecc_buf_size = (m * eccbits + 7) / 8;
-   struct bch_control *bch = init_bch(m, eccbits, 0);
+   struct bch_control *bch = bch_init(m, eccbits, 0, false);
uint8_t *ecc_buf = xmalloc(ecc_buf_size);
uint8_t *tmp_buf = xzalloc(blocksize * numblocks);
uint8_t *psrc, *pdst;
@@ -109,7 +109,7 @@ static void encode_bch_ecc(void *buf, struct fcb_block 
*fcb, int eccbits)
for (j = 0; j < blocksize; j++)
psrc[j] = reverse_bit(psrc[j]);
 
-   encode_bch(bch, psrc, blocksize, ecc_buf);
+   bch_encode(bch, psrc, blocksize, ecc_buf);
 
/* reverse ecc bit */
for (j = 0; j < ecc_buf_size; j++)
@@ -121,7 +121,7 @@ static void encode_bch_ecc(void *buf, struct fcb_block 
*fcb, int eccbits)
 
free(ecc_buf);
free(tmp_buf);
-   free_bch(bch);
+   bch_free(bch);
 }
 
 static struct fcb_block *fcb_decode_bch(void *rawpage, int eccbits)
@@ -130,7 +130,7 @@ static struct fcb_block *fcb_decode_bch(void *rawpage, int 
eccbits)
int blocksize = 128;
int numblocks = 8;
int ecc_buf_size = (m * eccbits + 7) / 8;
-   struct bch_control *bch = init_bch(m, eccbits, 0);
+   struct bch_control *bch = bch_init(m, eccbits, 0, false);
uint8_t *fcb = xmalloc(numblocks * blocksize);
uint8_t *ecc_buf = xmalloc(ecc_buf_size);
uint8_t *data_buf = xmalloc(blocksize);
@@ -152,7 +152,7 @@ static struct fcb_block *fcb_decode_bch(void *rawpage, int 
eccbits)
for (j = 0; j < ecc_buf_size; j++)
ecc_buf[j] = reverse_bit(psrc[j + blocksize]);
 
-   ret = decode_bch(bch, data_buf, blocksize, ecc_buf,
+   ret = bch_decode(bch, data_buf, blocksize, ecc_buf,
 NULL, NULL, errloc);
 
if (ret < 0) {
@@ -185,7 +185,7 @@ static struct fcb_block *fcb_decode_bch(void *rawpage, int 
eccbits)
free(data_buf);
free(ecc_buf);
free(errloc);
-   free_bch(bch);
+   bch_free(bch);
 
return (struct fcb_block *)fcb;
 }
diff --git a/drivers/mtd/devices/docg3.c b/drivers/mtd/devices/docg3.c
index 593a7035e5..fcf9403b8f 100644
--- a/drivers/mtd/devices/docg3.c
+++ b/drivers/mtd/devices/docg3.c
@@ -325,7 +325,7 @@ static int doc_ecc_bch_fix_data(struct docg3 *docg3, void 
*buf, u8 *hwecc)
 
for (i = 0; i < DOC_ECC_BCH_SIZE; i++)
ecc[i] = bitrev8(hwecc[i]);
-   numerrs = decode_bch(docg3_bch, NULL, DOC_ECC_BCH_COVERED_BYTES,
+   numerrs = bch_decode(docg3_bch, NULL, DOC_ECC_BCH_COVERED_BYTES,
 NULL, ecc, NULL, errorpos);
BUG_ON(numerrs == -EINVAL);
if (numerrs < 0)
@@ -1144,8 +1144,8 @@ static int __init docg3_probe(struct device *dev)
base = IOMEM(iores->start);
 
ret = -ENOMEM;
-   docg3_bch = init_bch(DOC_ECC_BCH_M, DOC_ECC_BCH_T,
-DOC_ECC_BCH_PRIMPOLY);
+   docg3_bch = bch_init(DOC_ECC_BCH_M, DOC_ECC_BCH_T,
+DOC_ECC_BCH_PRIMPOLY, false);
if (!docg3_bch)
goto nomem2;
 
@@ -1181,7 +1181,7 @@ static int __init docg3_probe(struct device *dev)
ret = -ENODEV;
dev_info(dev, "No supported DiskOnChip found\n");
 err_probe:
-   free_bch(docg3_bch);
+   bch_free(docg3_bch);
 nomem2:
return ret;
 }
diff --git a/drivers/mtd/nand/nand_bch.c b/drivers/mtd/nand/nand_bch.c
index 0d636d9608..45f9c5052a 100644
--- a/drivers/mtd/nand/nand_bch.c
+++ b/drivers/mtd/nand/nand_bch.c
@@ -42,7 +42,7 @@ int nand_bch_calculate_ecc(struct nand_chip *chip, const 
unsigned char *buf,
unsigned int i;
 
memset(code, 0, chip->ecc.bytes);
-   encode_bch(nbc->bch, buf, chip->ecc.size, code);
+   bch_encode(nbc->bch, buf, chip->ecc.size, code);
 
/* apply mask so that an erased page is a valid codeword */
for (i = 0; i < chip->ecc.bytes; i++)
@@ -68,7 +68,7 @@ int nand_bch_correct_data(struct nand_chip *chip, unsigned 
char *buf,
unsi

[PATCH 1/2] fs: jffs2: remove NAND write support entirely

2024-04-16 Thread Sascha Hauer
From: Juergen Borleis 

Our JFFS2 implementation refuses to work on NAND flashes because we lack
support for CONFIG_JFFS2_FS_WRITEBUFFER currently. JFFS2 is barely used
anymore and it seems unlikely that write support for it will ever be
added, so remove write support altogether. With this we can now safely
operate on NAND flashes.

Signed-off-by: Juergen Borleis 
Signed-off-by: Sascha Hauer 
---
 fs/jffs2/Kconfig   |  4 ++-
 fs/jffs2/fs.c  | 11 --
 fs/jffs2/jffs2_fs_sb.h | 16 -
 fs/jffs2/nodelist.h|  8 -
 fs/jffs2/os-linux.h| 79 ++
 fs/jffs2/scan.c| 59 +--
 fs/jffs2/super.c   |  4 +--
 7 files changed, 23 insertions(+), 158 deletions(-)

diff --git a/fs/jffs2/Kconfig b/fs/jffs2/Kconfig
index 329e7b806a..76f2a9f70a 100644
--- a/fs/jffs2/Kconfig
+++ b/fs/jffs2/Kconfig
@@ -20,7 +20,7 @@ config FS_JFFS2_COMPRESSION_OPTIONS
  compression modules, if any, are enabled in JFFS2. Removing
  compressors can mean you cannot read existing file systems,
  and enabling experimental compressors can mean that you
- write a file system which cannot be read by a standard kernel.
+ write a file system which cannot be read by the bootloader.
 
  If unsure, you should _definitely_ say 'N'.
 
@@ -30,6 +30,8 @@ config FS_JFFS2_COMPRESSION_ZLIB
bool
select ZLIB
prompt "ZLIB compression support"
+   help
+ Enable zlib, if compression type 0x06 is missed at run-time.
 
 config FS_JFFS2_COMPRESSION_LZO
bool
diff --git a/fs/jffs2/fs.c b/fs/jffs2/fs.c
index 6f2cbff6c9..a9831582bd 100644
--- a/fs/jffs2/fs.c
+++ b/fs/jffs2/fs.c
@@ -269,17 +269,6 @@ int jffs2_do_fill_super(struct super_block *sb, int silent)
 
c = JFFS2_SB_INFO(sb);
 
-#ifndef CONFIG_JFFS2_FS_WRITEBUFFER
-   if (c->mtd->type == MTD_NANDFLASH) {
-   pr_err("Cannot operate on NAND flash unless jffs2 NAND support 
is compiled in");
-   return -EINVAL;
-   }
-   if (c->mtd->type == MTD_DATAFLASH) {
-   pr_err("Cannot operate on DataFlash unless jffs2 DataFlash 
support is compiled in");
-   return -EINVAL;
-   }
-#endif
-
c->flash_size = c->mtd->size;
c->sector_size = c->mtd->erasesize;
blocks = c->flash_size / c->sector_size;
diff --git a/fs/jffs2/jffs2_fs_sb.h b/fs/jffs2/jffs2_fs_sb.h
index 20fa9a26a4..9e35a142e4 100644
--- a/fs/jffs2/jffs2_fs_sb.h
+++ b/fs/jffs2/jffs2_fs_sb.h
@@ -120,22 +120,6 @@ struct jffs2_sb_info {
 
uint32_t wbuf_pagesize; /* 0 for NOR and other flashes with no wbuf */
 
-#ifdef CONFIG_JFFS2_FS_WBUF_VERIFY
-   unsigned char *wbuf_verify; /* read-back buffer for verification */
-#endif
-#ifdef CONFIG_JFFS2_FS_WRITEBUFFER
-   unsigned char *wbuf; /* Write-behind buffer for NAND flash */
-   uint32_t wbuf_ofs;
-   uint32_t wbuf_len;
-   struct jffs2_inodirty *wbuf_inodes;
-   struct rw_semaphore wbuf_sem;   /* Protects the write buffer */
-
-   struct delayed_work wbuf_dwork; /* write-buffer write-out work */
-
-   unsigned char *oobbuf;
-   int oobavail; /* How many bytes are available for JFFS2 in OOB */
-#endif
-
struct jffs2_summary *summary;  /* Summary information */
struct jffs2_mount_opts mount_opts;
 
diff --git a/fs/jffs2/nodelist.h b/fs/jffs2/nodelist.h
index b5f7716ce2..d8687319c7 100644
--- a/fs/jffs2/nodelist.h
+++ b/fs/jffs2/nodelist.h
@@ -489,14 +489,6 @@ int jffs2_do_mount_fs(struct jffs2_sb_info *c);
 int jffs2_erase_pending_blocks(struct jffs2_sb_info *c, int count);
 void jffs2_free_jeb_node_refs(struct jffs2_sb_info *c, struct jffs2_eraseblock 
*jeb);
 
-#ifdef CONFIG_JFFS2_FS_WRITEBUFFER
-/* wbuf.c */
-int jffs2_flush_wbuf_gc(struct jffs2_sb_info *c, uint32_t ino);
-int jffs2_flush_wbuf_pad(struct jffs2_sb_info *c);
-int jffs2_check_nand_cleanmarker(struct jffs2_sb_info *c, struct 
jffs2_eraseblock *jeb);
-int jffs2_write_nand_cleanmarker(struct jffs2_sb_info *c, struct 
jffs2_eraseblock *jeb);
-#endif
-
 #include "debug.h"
 
 #endif /* __JFFS2_NODELIST_H__ */
diff --git a/fs/jffs2/os-linux.h b/fs/jffs2/os-linux.h
index 29915715bb..424acbdc4d 100644
--- a/fs/jffs2/os-linux.h
+++ b/fs/jffs2/os-linux.h
@@ -11,6 +11,8 @@
 #ifndef __JFFS2_OS_LINUX_H__
 #define __JFFS2_OS_LINUX_H__
 
+#include 
+
 /* JFFS2 uses Linux mode bits natively -- no need for conversion */
 #define os_to_jffs2_mode(x) (x)
 #define jffs2_to_os_mode(x) (x)
@@ -67,11 +69,21 @@ struct jffs2_file {
unsigned int offset;
 };
 
-#define jffs2_is_readonly(c) (OFNI_BS_2SFFJ(c)->s_flags & SB_RDONLY)
+/* Read-only support */
+#define jffs2_is_readonly(c) (1)
 
 #define SECTOR_ADDR(x) ( (((unsigned long)(x) / c->sector_size) * 
c->sector_size) )
-#ifndef CONFIG_JFFS2_FS_WRITEBUFFER
 
+static inline int jffs2

[PATCH 2/2] fs: jffs2: ignore cleanup hints

2024-04-16 Thread Sascha Hauer
From: Juergen Borleis 

Without any kind of write support cleanup hints make no sense and cannot
fixed inside the bootloader. Thus, ignore them entirely.

Signed-off-by: Juergen Borleis 
Signed-off-by: Sascha Hauer 
---
 fs/jffs2/os-linux.h | 10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/fs/jffs2/os-linux.h b/fs/jffs2/os-linux.h
index 424acbdc4d..9c1c05eb6c 100644
--- a/fs/jffs2/os-linux.h
+++ b/fs/jffs2/os-linux.h
@@ -74,9 +74,17 @@ struct jffs2_file {
 
 #define SECTOR_ADDR(x) ( (((unsigned long)(x) / c->sector_size) * 
c->sector_size) )
 
+/**
+ * Read data from memory and ignore any hints about bitflips in case of NAND
+ * memory (because we cannot repair them).
+ */
 static inline int jffs2_flash_read(struct jffs2_sb_info *c, loff_t ofs, size_t 
len, size_t *retlen, u_char *buf)
 {
-   return mtd_read((c)->mtd, ofs, len, retlen, buf);
+   int rc = mtd_read((c)->mtd, ofs, len, retlen, buf);
+   if (rc == -EUCLEAN)
+   return 0; // we are read-only, we cannot repair anything.
+
+   return rc;
 }
 
 /* support run-time speed-up while scanning NAND flashs */
-- 
2.39.2




[PATCH] mtd: nand: stm32: fix wrong regmap_bulk_read() usage

2024-04-16 Thread Sascha Hauer
Compilation of the STM32 NAND driver fails with:

error: call to '__regmap_bulk_api_changed' declared with attribute error: Last 
argument is now number of registers, not bytes. Fix it and include 

---
 drivers/mtd/nand/stm32_fmc2_nand.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/nand/stm32_fmc2_nand.c 
b/drivers/mtd/nand/stm32_fmc2_nand.c
index 958a619be5..47b012cc9e 100644
--- a/drivers/mtd/nand/stm32_fmc2_nand.c
+++ b/drivers/mtd/nand/stm32_fmc2_nand.c
@@ -7,7 +7,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -551,7 +551,7 @@ static int stm32_fmc2_nfc_bch_correct(struct nand_chip 
*chip, u8 *dat,
return -ETIMEDOUT;
}
 
-   regmap_bulk_read(nfc->regmap, FMC2_BCHDSR0, ecc_sta, 5);
+   regmap_bulk_read(nfc->regmap, FMC2_BCHDSR0, ecc_sta, 
ARRAY_SIZE(ecc_sta));
 
stm32_fmc2_nfc_set_ecc(nfc, false);
 
-- 
2.39.2




[PATCH] ARM: i.MX: remove platform device registration helpers

2024-04-11 Thread Sascha Hauer
With two exceptions the imx_add_* platform device registration helpers
are no longer used, so remove them.
In two cases a framebuffer is still registered with a helper function.
Replace them with add_generic_device().

Signed-off-by: Sascha Hauer 
---
 arch/arm/boards/datamodul-edm-qmx6/board.c|   2 +-
 arch/arm/boards/efika-mx-smartbook/board.c|   1 -
 arch/arm/boards/embedsky-e9/board.c   |   1 -
 .../arm/boards/freescale-mx51-babbage/board.c |   1 -
 .../boards/freescale-mx6-sabrelite/board.c|   1 -
 arch/arm/boards/freescale-mx6-sabresd/board.c |   1 -
 .../boards/freescale-mx6sx-sabresdb/board.c   |   2 +-
 arch/arm/boards/guf-vincell/board.c   |   2 +-
 arch/arm/boards/karo-tx25/board.c |   6 +-
 arch/arm/boards/karo-tx53/board.c |   1 -
 arch/arm/boards/phytec-phycard-imx27/pca100.c |   1 -
 arch/arm/boards/phytec-phycore-imx27/pcm038.c |   4 +-
 arch/arm/boards/scb9328/scb9328.c |   1 -
 arch/arm/boards/tqma6x/board.c|   2 +-
 arch/arm/boards/udoo/board.c  |   1 -
 arch/arm/boards/variscite-mx6/board.c |   1 -
 arch/arm/mach-imx/Makefile|   2 +-
 arch/arm/mach-imx/devices.c   |  96 --
 include/mach/imx/devices-imx1.h   |  14 ---
 include/mach/imx/devices-imx21.h  |  35 --
 include/mach/imx/devices-imx25.h  |  84 -
 include/mach/imx/devices-imx27.h  |  89 -
 include/mach/imx/devices-imx31.h  |  94 --
 include/mach/imx/devices-imx35.h  |  74 ---
 include/mach/imx/devices-imx50.h  |  84 -
 include/mach/imx/devices-imx51.h  | 117 --
 include/mach/imx/devices-imx53.h  |  89 -
 include/mach/imx/devices-imx6.h   | 100 ---
 include/mach/imx/devices.h|  29 -
 29 files changed, 10 insertions(+), 925 deletions(-)
 delete mode 100644 arch/arm/mach-imx/devices.c
 delete mode 100644 include/mach/imx/devices-imx1.h
 delete mode 100644 include/mach/imx/devices-imx21.h
 delete mode 100644 include/mach/imx/devices-imx25.h
 delete mode 100644 include/mach/imx/devices-imx27.h
 delete mode 100644 include/mach/imx/devices-imx31.h
 delete mode 100644 include/mach/imx/devices-imx35.h
 delete mode 100644 include/mach/imx/devices-imx50.h
 delete mode 100644 include/mach/imx/devices-imx51.h
 delete mode 100644 include/mach/imx/devices-imx53.h
 delete mode 100644 include/mach/imx/devices-imx6.h
 delete mode 100644 include/mach/imx/devices.h

diff --git a/arch/arm/boards/datamodul-edm-qmx6/board.c 
b/arch/arm/boards/datamodul-edm-qmx6/board.c
index 8680485de2..93abce33af 100644
--- a/arch/arm/boards/datamodul-edm-qmx6/board.c
+++ b/arch/arm/boards/datamodul-edm-qmx6/board.c
@@ -12,13 +12,13 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 
 #include 
 #include 
 
-#include 
 #include 
 #include 
 #include 
diff --git a/arch/arm/boards/efika-mx-smartbook/board.c 
b/arch/arm/boards/efika-mx-smartbook/board.c
index f5a3f3cec4..5101e3a558 100644
--- a/arch/arm/boards/efika-mx-smartbook/board.c
+++ b/arch/arm/boards/efika-mx-smartbook/board.c
@@ -19,7 +19,6 @@
 
 #include 
 
-#include 
 #include 
 #include 
 #include 
diff --git a/arch/arm/boards/embedsky-e9/board.c 
b/arch/arm/boards/embedsky-e9/board.c
index afc9e3d27e..6052805b8a 100644
--- a/arch/arm/boards/embedsky-e9/board.c
+++ b/arch/arm/boards/embedsky-e9/board.c
@@ -23,7 +23,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/arch/arm/boards/freescale-mx51-babbage/board.c 
b/arch/arm/boards/freescale-mx51-babbage/board.c
index 76bdc78b02..1d4fb2d8c6 100644
--- a/arch/arm/boards/freescale-mx51-babbage/board.c
+++ b/arch/arm/boards/freescale-mx51-babbage/board.c
@@ -24,7 +24,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 
 #define MX51_CCM_CACRR 0x10
diff --git a/arch/arm/boards/freescale-mx6-sabrelite/board.c 
b/arch/arm/boards/freescale-mx6-sabrelite/board.c
index 0f5306cde8..fe47743540 100644
--- a/arch/arm/boards/freescale-mx6-sabrelite/board.c
+++ b/arch/arm/boards/freescale-mx6-sabrelite/board.c
@@ -23,7 +23,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/arch/arm/boards/freescale-mx6-sabresd/board.c 
b/arch/arm/boards/freescale-mx6-sabresd/board.c
index 2b1d005cf2..1db52736f9 100644
--- a/arch/arm/boards/freescale-mx6-sabresd/board.c
+++ b/arch/arm/boards/freescale-mx6-sabresd/board.c
@@ -20,7 +20,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/arch/arm/boards/freescale-mx6sx-sabresdb/board.c 
b/arch/arm/boards/freescale-mx6sx-sabresdb/board.c
index 4749981265..22163a4864 100644
--- a/arch/arm/boards/freescale-mx6sx-sabresdb/board.c
+++ b/arch/arm/boards/freescale-mx6sx-sabresdb/board.c
@@ -6,6 +6,7 @@
 #include

[PATCH] jffs2: change pr_fmt prefix to jffs2

2024-04-10 Thread Sascha Hauer
KBUILD_MODNAME expands to the filename which is not a good prefix for
messages. Change it to jffs2 to give the messages a more meaningful
prefix.

Signed-off-by: Sascha Hauer 
---
 fs/jffs2/build.c   | 2 +-
 fs/jffs2/compr.c   | 2 +-
 fs/jffs2/compr_rubin.c | 2 +-
 fs/jffs2/compr_zlib.c  | 2 +-
 fs/jffs2/debug.c   | 2 +-
 fs/jffs2/dir.c | 2 +-
 fs/jffs2/fs.c  | 2 +-
 fs/jffs2/malloc.c  | 2 +-
 fs/jffs2/nodelist.c| 2 +-
 fs/jffs2/read.c| 2 +-
 fs/jffs2/readinode.c   | 2 +-
 fs/jffs2/scan.c| 2 +-
 fs/jffs2/super.c   | 2 +-
 13 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/fs/jffs2/build.c b/fs/jffs2/build.c
index d5757d100b..3871547b99 100644
--- a/fs/jffs2/build.c
+++ b/fs/jffs2/build.c
@@ -8,7 +8,7 @@
  * Created by David Woodhouse 
  */
 
-#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+#define pr_fmt(fmt) "jffs2: " fmt
 #include 
 #include 
 #include 
diff --git a/fs/jffs2/compr.c b/fs/jffs2/compr.c
index 04b014199f..a056be051c 100644
--- a/fs/jffs2/compr.c
+++ b/fs/jffs2/compr.c
@@ -9,7 +9,7 @@
  *
  * Created by Arjan van de Ven 
  */
-#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+#define pr_fmt(fmt) "jffs2: " fmt
 #include 
 #include "compr.h"
 
diff --git a/fs/jffs2/compr_rubin.c b/fs/jffs2/compr_rubin.c
index 91a500f4fb..913276d986 100644
--- a/fs/jffs2/compr_rubin.c
+++ b/fs/jffs2/compr_rubin.c
@@ -8,7 +8,7 @@
  * Created by Arjan van de Ven 
  */
 
-#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+#define pr_fmt(fmt) "jffs2: " fmt
 
 #include 
 #include 
diff --git a/fs/jffs2/compr_zlib.c b/fs/jffs2/compr_zlib.c
index 2b7914f1f5..0580bab0de 100644
--- a/fs/jffs2/compr_zlib.c
+++ b/fs/jffs2/compr_zlib.c
@@ -7,7 +7,7 @@
  *
  * Created by David Woodhouse 
  */
-#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+#define pr_fmt(fmt) "jffs2: " fmt
 #include 
 #include 
 #include 
diff --git a/fs/jffs2/debug.c b/fs/jffs2/debug.c
index edf8539762..4ac501e2de 100644
--- a/fs/jffs2/debug.c
+++ b/fs/jffs2/debug.c
@@ -8,7 +8,7 @@
  * Created by David Woodhouse 
  */
 
-#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+#define pr_fmt(fmt) "jffs2: " fmt
 
 #include 
 #include 
diff --git a/fs/jffs2/dir.c b/fs/jffs2/dir.c
index 34f8d141f2..94ef51f778 100644
--- a/fs/jffs2/dir.c
+++ b/fs/jffs2/dir.c
@@ -7,7 +7,7 @@
  *
  * Created by David Woodhouse 
  */
-#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+#define pr_fmt(fmt) "jffs2: " fmt
 #include 
 #include 
 #include 
diff --git a/fs/jffs2/fs.c b/fs/jffs2/fs.c
index 6f2cbff6c9..fcce56c15f 100644
--- a/fs/jffs2/fs.c
+++ b/fs/jffs2/fs.c
@@ -7,7 +7,7 @@
  *
  * Created by David Woodhouse 
  */
-#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+#define pr_fmt(fmt) "jffs2: " fmt
 #include 
 #include 
 #include 
diff --git a/fs/jffs2/malloc.c b/fs/jffs2/malloc.c
index 202191be94..e0e29fa648 100644
--- a/fs/jffs2/malloc.c
+++ b/fs/jffs2/malloc.c
@@ -7,7 +7,7 @@
  * Created by David Woodhouse 
  */
 
-#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+#define pr_fmt(fmt) "jffs2: " fmt
 
 #include 
 #include 
diff --git a/fs/jffs2/nodelist.c b/fs/jffs2/nodelist.c
index 94753e1995..debf10e751 100644
--- a/fs/jffs2/nodelist.c
+++ b/fs/jffs2/nodelist.c
@@ -7,7 +7,7 @@
  * Created by David Woodhouse 
  */
 
-#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+#define pr_fmt(fmt) "jffs2: " fmt
 
 #include 
 #include 
diff --git a/fs/jffs2/read.c b/fs/jffs2/read.c
index a1c3b9d47b..fffa5f60cb 100644
--- a/fs/jffs2/read.c
+++ b/fs/jffs2/read.c
@@ -7,7 +7,7 @@
  * Created by David Woodhouse 
  */
 
-#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+#define pr_fmt(fmt) "jffs2: " fmt
 #include 
 #include 
 #include 
diff --git a/fs/jffs2/readinode.c b/fs/jffs2/readinode.c
index aaf2619613..605130d60c 100644
--- a/fs/jffs2/readinode.c
+++ b/fs/jffs2/readinode.c
@@ -7,7 +7,7 @@
  * Created by David Woodhouse 
  */
 
-#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+#define pr_fmt(fmt) "jffs2: " fmt
 
 #include 
 #include 
diff --git a/fs/jffs2/scan.c b/fs/jffs2/scan.c
index 0d74a8f51f..e1e5120a28 100644
--- a/fs/jffs2/scan.c
+++ b/fs/jffs2/scan.c
@@ -7,7 +7,7 @@
  * Created by David Woodhouse 
  */
 
-#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+#define pr_fmt(fmt) "jffs2: " fmt
 #include 
 #include 
 #include 
diff --git a/fs/jffs2/super.c b/fs/jffs2/super.c
index 37b3f328c6..d56cdfe132 100644
--- a/fs/jffs2/super.c
+++ b/fs/jffs2/super.c
@@ -7,7 +7,7 @@
  *
  * Created by David Woodhouse 
  */
-#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+#define pr_fmt(fmt) "jffs2: " fmt
 #include 
 #include 
 #include 
-- 
2.39.2




Re: [PATCH v2 1/2] bootm: replace CONFIG_BOOTM_FORCE_SIGNED_IMAGES with helper

2024-04-10 Thread Sascha Hauer


On Mon, 08 Apr 2024 16:31:30 +0200, Marco Felsch wrote:
> In preparation for allowing even CONFIG_BOOTM_FORCE_SIGNED_IMAGES=n
> configurations to force boot of only signed images, replace direct
> use of IS_ENABLED(CONFIG_BOOTM_FORCE_SIGNED_IMAGES) with a helper that
> queries a static variable that can be forced at runtime in a follow-up
> commit.
> 
> No functional change.
> 
> [...]

Applied, thanks!

[1/2] bootm: replace CONFIG_BOOTM_FORCE_SIGNED_IMAGES with helper
  https://git.pengutronix.de/cgit/barebox/commit/?id=7c80ebdcecd9 (link may 
not be stable)
[2/2] bootm: add support for dynamically forcing signature verification
  https://git.pengutronix.de/cgit/barebox/commit/?id=933db056bbdf (link may 
not be stable)

Best regards,
-- 
Sascha Hauer 




Re: [PATCH] mci: sdhci: fix dma mapping

2024-04-10 Thread Sascha Hauer


On Mon, 08 Apr 2024 18:31:01 +0200, Marco Felsch wrote:
> In case of MMC_DATA_READ the dest address should be used and in case of
> MMC_DATA_WRITE the src address should be used. We had no issues for now
> since both dest and src point to same address due to the union.
> 
> 

Applied, thanks!

[1/1] mci: sdhci: fix dma mapping
  https://git.pengutronix.de/cgit/barebox/commit/?id=743130a7c75f (link may 
not be stable)

Best regards,
-- 
Sascha Hauer 




Re: [PATCH] mci: arasan: rework register_sdclk

2024-04-09 Thread Sascha Hauer
On Tue, Apr 09, 2024 at 07:57:20AM +0200, Steffen Trumtrar wrote:
> Instead of guarding this at compile time, always call register_sdclk
> with the correct clk_ops, like in linux.
> 
> Currently only ZynqMP and default arasan ops are supported.
> 
> Signed-off-by: Steffen Trumtrar 
> ---
> Instead of guarding the zynqmp functions at compile time and introducing
> possible run-time problems, copy more of the linux driver and add
> soc-specific clk_ops.
> 
> As the zynqmp_pm_* functions are only defined for ARCH_ZYNQMP we need to
> add stub function definitions for other platforms that might use the
> arasan-sdhci driver.
> ---
>  drivers/mci/arasan-sdhci.c| 53 
> ---
>  include/mach/zynqmp/firmware-zynqmp.h | 11 
>  2 files changed, 47 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/mci/arasan-sdhci.c b/drivers/mci/arasan-sdhci.c
> index b7dd98049f..5187dbe468 100644
> --- a/drivers/mci/arasan-sdhci.c
> +++ b/drivers/mci/arasan-sdhci.c
> @@ -65,6 +65,8 @@ struct arasan_sdhci_host {
>   struct mci_host mci;
>   struct sdhcisdhci;
>   unsigned intquirks; /* Arasan deviations from spec */
> + const struct clk_ops*sdcardclk_ops;
> + const struct clk_ops*sampleclk_ops;
>   struct sdhci_arasan_clk_data clk_data;
>  /* Controller does not have CD wired and will not function normally without 
> */
>  #define SDHCI_ARASAN_QUIRK_FORCE_CDTEST  BIT(0)
> @@ -352,7 +354,7 @@ static void arasan_dt_read_clk_phase(struct device *dev,
>   *
>   * Return: 0 on success and error value on error
>   */
> -static int arasan_zynqmp_sampleclk_set_phase(struct clk_hw *hw, int degrees)
> +static __maybe_unused int arasan_zynqmp_sampleclk_set_phase(struct clk_hw 
> *hw, int degrees)

Dropped this unnecessary __maybe_unused here...

> -static int arasan_zynqmp_sdcardclk_set_phase(struct clk_hw *hw, int degrees)
> +static __maybe_unused int arasan_zynqmp_sdcardclk_set_phase(struct clk_hw 
> *hw, int degrees)

...and here while applying.

Sascha

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



Re: [PATCH] mci: arasan: rework register_sdclk

2024-04-09 Thread Sascha Hauer


On Tue, 09 Apr 2024 07:57:20 +0200, Steffen Trumtrar wrote:
> Instead of guarding this at compile time, always call register_sdclk
> with the correct clk_ops, like in linux.
> 
> Currently only ZynqMP and default arasan ops are supported.
> 
> 

Applied, thanks!

[1/1] mci: arasan: rework register_sdclk
  https://git.pengutronix.de/cgit/barebox/commit/?id=70791fb7f1aa (link may 
not be stable)

Best regards,
-- 
Sascha Hauer 




Re: [PATCH] arm: mecsbc: fixup /regulator-sd device tree node

2024-04-08 Thread Sascha Hauer


On Fri, 05 Apr 2024 12:12:50 +0200, Sascha Hauer wrote:
> The MECSBC prototype board has a bug which makes the 1.8V SD mode
> unusable. Add a fixup which sets the regulator-min-microvolt property of
> the SD regulator to 3.3V to prevent the Kernel from going into 1.8V.
> 
> 

Applied, thanks!

[1/1] arm: mecsbc: fixup /regulator-sd device tree node
  https://git.pengutronix.de/cgit/barebox/commit/?id=004911504554 (link may 
not be stable)

Best regards,
-- 
Sascha Hauer 




Re: [PATCH 2/4] common: add wolfvision board code library

2024-04-08 Thread Sascha Hauer
On Fri, Apr 05, 2024 at 04:04:43PM +0200, Michael Riesch wrote:
> Add board code library for all WolfVision boards.
> 
> Signed-off-by: Michael Riesch 
> ---
>  common/boards/Kconfig  |   3 +
>  common/boards/Makefile |   1 +
>  common/boards/wolfvision/Makefile  |   2 +
>  common/boards/wolfvision/common.c  | 145 
> +
>  include/boards/wolfvision/common.h |  32 
>  5 files changed, 183 insertions(+)
> 
> diff --git a/common/boards/Kconfig b/common/boards/Kconfig
> index f6d4a56f88..a2a51155ea 100644
> --- a/common/boards/Kconfig
> +++ b/common/boards/Kconfig
> @@ -14,3 +14,6 @@ config BOARD_PHYTEC_SOM_IMX8M_DETECTION
>  config BOARD_TQ
>   select CRC_ITU_T
>   bool
> +
> +config BOARD_WOLFVISION
> + bool
> diff --git a/common/boards/Makefile b/common/boards/Makefile
> index 147c36643d..3f8ac57b2f 100644
> --- a/common/boards/Makefile
> +++ b/common/boards/Makefile
> @@ -3,3 +3,4 @@
>  obj-$(CONFIG_BOARD_QEMU_VIRT)+= qemu-virt/
>  obj-$(CONFIG_BOARD_PHYTEC_SOM_DETECTION) += phytec/
>  obj-$(CONFIG_BOARD_TQ) += tq/
> +obj-$(CONFIG_BOARD_WOLFVISION) += wolfvision/
> diff --git a/common/boards/wolfvision/Makefile 
> b/common/boards/wolfvision/Makefile
> new file mode 100644
> index 00..b2be4b73f4
> --- /dev/null
> +++ b/common/boards/wolfvision/Makefile
> @@ -0,0 +1,2 @@
> +# SPDX-License-Identifier: GPL-2.0-only
> +obj-pbl-y += common.o
> diff --git a/common/boards/wolfvision/common.c 
> b/common/boards/wolfvision/common.c
> new file mode 100644
> index 00..188931c24c
> --- /dev/null
> +++ b/common/boards/wolfvision/common.c
> @@ -0,0 +1,145 @@
> +// SPDX-License-Identifier: GPL-2.0-only
> +/*
> + * Common board code functions WolfVision boards.
> + *
> + * Copyright (C) 2024 WolfVision GmbH.
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include 
> +
> +#define WV_RK3568_HWID_TOLERANCE 50
> +
> +int wolfvision_apply_overlay(const struct wv_overlay *overlay, char **files)
> +{
> + int ret;
> +
> + if (overlay->filename) {
> + if (*files) {
> + char *old = *files;
> + *files = basprintf("%s %s", old, overlay->filename);
> + free(old);
> + } else {
> + *files = basprintf("%s", overlay->filename);
> + }
> + }
> +
> + if (overlay->data) {
> + struct device_node *node =
> + of_unflatten_dtb(overlay->data, INT_MAX);
> +
> + if (!node) {

of_unflatten_dtb returns an error pointer in case of failure.

> + pr_err("Cannot unflatten dtbo\n");

Please provide a pt_fmt() macro to give the messages a meaningful
prefix.

> + return -EINVAL;
> + }
> +
> + ret = of_overlay_apply_tree(of_get_root_node(), node);
> +
> + of_delete_node(node);
> +
> + if (ret) {
> + pr_err("Cannot apply overlay: %s\n", strerror(-ret));

Should be "%pe\n", ERR_PTR(ret)

> + return ret;
> + }
> +
> + of_clk_init();
> + of_probe();
> + }
> +
> + return 0;
> +}
> +
> +int wolfvision_register_ethaddr(void)
> +{
> + struct device_node *eth0;
> + struct state *state;
> + char mac[ETH_ALEN];
> + int ret;
> +
> + ret = of_device_ensure_probed_by_alias("state");
> + if (ret)
> + return ret;
> +
> + state = state_by_name("state");
> + if (!state)
> + return -ENOENT;
> +
> + ret = state_read_mac(state, "mac-address", mac);
> + if (ret)
> + return ret;
> +
> + if (!is_valid_ether_addr(mac))
> + return -EINVAL;
> +
> + eth0 = of_find_node_by_alias(of_get_root_node(), "ethernet0");
> + if (eth0)
> + of_eth_register_ethaddr(eth0, mac);
> +
> + return 0;
> +}
> +
> +int wolfvision_rk3568_get_hwid(int chan_idx)
> +{
> + const int values[WV_RK3568_HWID_MAX] = {
> + 0,112,  225,  337,  450,  562,  675,  787,  900,
> + 1012, 1125, 1237, 1350, 1462, 1575, 1687, 1800,
> + };
> + struct aiochannel *chan;
> + int ret, hwid, voltage;
> + char *chan_name;
> +
> + chan_name = basprintf("saradc.in_value%d_mV", chan_idx);
> + chan = aiochannel_by_name(chan_name);
> + free(chan_name);
> + if (IS_ERR(chan))
> + return PTR_ERR(chan);
> +
> + ret = aiochannel_get_value(chan, );
> + if (ret)
> + return ret;

I just recently added aiochannel_name_get_value() which combines
aiochannel_by_name() and aiochannel_get_value(), you can use this here.

> +
> + for (hwid = 0; hwid < ARRAY_SIZE(values); hwid++)
> + if (abs(voltage - values[hwid]) < WV_RK3568_HWID_TOLERANCE)
> + return hwid;
> +
> + return -EINVAL;
> +};
> +
> +int wolfvision_rk3568_detect_hw(const struct 

Re: [PATCH] arm: mecsbc: fixup /regulator-sd device tree node

2024-04-05 Thread Sascha Hauer
On Fri, Apr 05, 2024 at 01:46:26PM +0200, Ahmad Fatoum wrote:
> Hello Sascha,
> 
> On 05.04.24 12:12, Sascha Hauer wrote:
> > The MECSBC prototype board has a bug which makes the 1.8V SD mode
> > unusable. Add a fixup which sets the regulator-min-microvolt property of
> > the SD regulator to 3.3V to prevent the Kernel from going into 1.8V.
> 
> Isn't that what the MMC no-1-8-v device tree property is for?

Although it's described in mmc-controller.yaml this is not a generic property.
Only SDHCI based controllers evaluate this property (which the affected
controller here isn't)

Sascha

> 
> Cheers,
> Ahmad
> 
> > 
> > Signed-off-by: Sascha Hauer 
> > ---
> >  arch/arm/boards/protonic-mecsbc/board.c | 21 +
> >  1 file changed, 21 insertions(+)
> > 
> > diff --git a/arch/arm/boards/protonic-mecsbc/board.c 
> > b/arch/arm/boards/protonic-mecsbc/board.c
> > index 3ba8fb8d1c..56f7ca393a 100644
> > --- a/arch/arm/boards/protonic-mecsbc/board.c
> > +++ b/arch/arm/boards/protonic-mecsbc/board.c
> > @@ -90,6 +90,24 @@ static void mecsbc_process_adc(struct device *dev)
> > pr_info("VIN = %d V\n", mecsbc_get_vin_mv() / 1000);
> >  }
> >  
> > +static int mecsbc_sd_of_fixup(struct device_node *root, void *context)
> > +{
> > +   struct device *dev = context;
> > +   struct device_node *np;
> > +
> > +   dev_info(dev, "Fixing up /regulator-sd\n");
> > +
> > +   np = of_find_node_by_path_from(root, "/regulator-sd");
> > +   if (!np) {
> > +   dev_err(dev, "Cannot find /regulator-sd node\n");
> > +   return 0;
> > +   }
> > +
> > +   of_property_write_u32(np, "regulator-min-microvolt", 330);
> > +
> > +   return 0;
> > +}
> > +
> >  static int mecsbc_of_fixup_hwrev(struct device *dev)
> >  {
> > const char *compat;
> > @@ -103,6 +121,9 @@ static int mecsbc_of_fixup_hwrev(struct device *dev)
> >  
> > free(buf);
> >  
> > +   if (mecsbc_data.hw_id == 0 && mecsbc_data.hw_rev == 0)
> > +   of_register_fixup(mecsbc_sd_of_fixup, dev);
> > +
> > return 0;
> >  }
> >  
> 
> -- 
> Pengutronix e.K.   | |
> Steuerwalder Str. 21   | http://www.pengutronix.de/  |
> 31137 Hildesheim, Germany  | Phone: +49-5121-206917-0|
> Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |
> 
> 

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



Re: [PATCH v2 1/2] aiodev: add helper for getting a value by its channel name

2024-04-05 Thread Sascha Hauer


On Thu, 04 Apr 2024 13:15:26 +0200, Sascha Hauer wrote:
> It's a common pattern to get an aiochannel by name and the value
> afterwards. Add a helper for this pattern.
> 
> 

Applied, thanks!

[1/2] aiodev: add helper for getting a value by its channel name
  https://git.pengutronix.de/cgit/barebox/commit/?id=e268186d8051 (link may 
not be stable)
[2/2] arm: boards: Add support for protonic-mecsbc board
  https://git.pengutronix.de/cgit/barebox/commit/?id=cfb1dc439d91 (link may 
not be stable)

Best regards,
-- 
Sascha Hauer 




Re: [PATCH 1/2] ARM: dts: add common bootstate.dtsi

2024-04-05 Thread Sascha Hauer


On Thu, 04 Apr 2024 12:26:22 +0200, Ahmad Fatoum wrote:
> For use by at least the LXA MC-1, add a bootstate definition with the
> minimal set of variables needed for bootchooser.
> 
> We add this to a generic location, so it may be used by other boards as
> well.
> 
> 
> [...]

Applied, thanks!

[1/2] ARM: dts: add common bootstate.dtsi
  https://git.pengutronix.de/cgit/barebox/commit/?id=1e778c610dd4 (link may 
not be stable)
[2/2] ARM: stm32mp: lxa-mc1: add state description
  https://git.pengutronix.de/cgit/barebox/commit/?id=9dd40f0d077d (link may 
not be stable)

Best regards,
-- 
Sascha Hauer 




[PATCH] arm: mecsbc: fixup /regulator-sd device tree node

2024-04-05 Thread Sascha Hauer
The MECSBC prototype board has a bug which makes the 1.8V SD mode
unusable. Add a fixup which sets the regulator-min-microvolt property of
the SD regulator to 3.3V to prevent the Kernel from going into 1.8V.

Signed-off-by: Sascha Hauer 
---
 arch/arm/boards/protonic-mecsbc/board.c | 21 +
 1 file changed, 21 insertions(+)

diff --git a/arch/arm/boards/protonic-mecsbc/board.c 
b/arch/arm/boards/protonic-mecsbc/board.c
index 3ba8fb8d1c..56f7ca393a 100644
--- a/arch/arm/boards/protonic-mecsbc/board.c
+++ b/arch/arm/boards/protonic-mecsbc/board.c
@@ -90,6 +90,24 @@ static void mecsbc_process_adc(struct device *dev)
pr_info("VIN = %d V\n", mecsbc_get_vin_mv() / 1000);
 }
 
+static int mecsbc_sd_of_fixup(struct device_node *root, void *context)
+{
+   struct device *dev = context;
+   struct device_node *np;
+
+   dev_info(dev, "Fixing up /regulator-sd\n");
+
+   np = of_find_node_by_path_from(root, "/regulator-sd");
+   if (!np) {
+   dev_err(dev, "Cannot find /regulator-sd node\n");
+   return 0;
+   }
+
+   of_property_write_u32(np, "regulator-min-microvolt", 330);
+
+   return 0;
+}
+
 static int mecsbc_of_fixup_hwrev(struct device *dev)
 {
const char *compat;
@@ -103,6 +121,9 @@ static int mecsbc_of_fixup_hwrev(struct device *dev)
 
free(buf);
 
+   if (mecsbc_data.hw_id == 0 && mecsbc_data.hw_rev == 0)
+   of_register_fixup(mecsbc_sd_of_fixup, dev);
+
return 0;
 }
 
-- 
2.39.2




Re: [PATCH 00/10] net: fix problems handling trailing bytes

2024-04-05 Thread Sascha Hauer


On Thu, 04 Apr 2024 20:39:51 +0200, Ahmad Fatoum wrote:
> This started by pinging a Raspberry Pi 3b running barebox sitting behind
> a router employing conntrack. The router discarded the ping responses
> due to the wrong ICMP checksum and these issues do not pop up normally
> because the ping command itself doesn't bother to verify the checksum.
> 
> This unearthed issues in two drivers as well as the barebox network
> stack itself.
> 
> [...]

Applied, thanks!

[01/10] net: free packets with net_free_packet
https://git.pengutronix.de/cgit/barebox/commit/?id=006fd6e86707 (link 
may not be stable)
[02/10] net: ip: don't blindly trust driver supplied frame size
https://git.pengutronix.de/cgit/barebox/commit/?id=1b2559919d13 (link 
may not be stable)
[03/10] net: icmp: don't blindly trust driver supplied frame size
https://git.pengutronix.de/cgit/barebox/commit/?id=d1316e6745d0 (link 
may not be stable)
[04/10] net: icmp: properly set IP TTL and fragement fields
https://git.pengutronix.de/cgit/barebox/commit/?id=e2f7ec4625fa (link 
may not be stable)
[05/10] net: icmp: don't overrun buffer on send
https://git.pengutronix.de/cgit/barebox/commit/?id=ad753cf0f5ce (link 
may not be stable)
[06/10] net: cpsw: report correct frame size to network stack
https://git.pengutronix.de/cgit/barebox/commit/?id=20ece44e01aa (link 
may not be stable)
[07/10] net: usb: smsc95xx: don't opencode get/put_aligned_le32
https://git.pengutronix.de/cgit/barebox/commit/?id=209cca7cef6f (link 
may not be stable)
[08/10] net: usb: smsc95xx: don't blindly trust hardware size
https://git.pengutronix.de/cgit/barebox/commit/?id=9a868a27e334 (link 
may not be stable)
[09/10] net: usb: smsc95xx: fix handling of multiple packets per urb
https://git.pengutronix.de/cgit/barebox/commit/?id=1ef8e95ec855 (link 
may not be stable)
[10/10] net: usb: smsc95xx: disable HW checksumming in driver
https://git.pengutronix.de/cgit/barebox/commit/?id=b83c88237593 (link 
may not be stable)

Best regards,
-- 
Sascha Hauer 




Re: [PATCH] pmdomain: imx8mp-blk-ctrl: fix adb handshake handling

2024-04-04 Thread Sascha Hauer


On Wed, 03 Apr 2024 17:31:51 +0200, Marco Felsch wrote:
> Fix powering the DWC3 USB subsystem which is part of the HSIO BLKCTRL.
> Currently we enable the USB clocks and the USB module clock within the
> HSIO BLKCTRL. The later get stuck during the first call of
> imx8mp_blk_ctrl_power_on() since the parent GPCv2 device is not powered
> yet.
> 
> Fix this by porting the Linux imx8mp_blk_ctrl::power_nb notifier_block
> logic. The Linux driver enable/disable the USB module to propagate the
> ADB handshake instead of powering it permanently. The logic is executed
> after the parent GPCv2 power domain is powered so we can access the HSIO
> BLKCTRL registers.
> 
> [...]

Applied, thanks!

[1/1] pmdomain: imx8mp-blk-ctrl: fix adb handshake handling
  https://git.pengutronix.de/cgit/barebox/commit/?id=aa03dc194997 (link may 
not be stable)

Best regards,
-- 
Sascha Hauer 




Re: [PATCH 1/4] string: add isempty helper

2024-04-04 Thread Sascha Hauer


On Wed, 13 Mar 2024 20:45:44 +0100, Marco Felsch wrote:
> This adds systemd's isempty() helper which can be very handy.
> 
> 

Applied, thanks!

[1/4] string: add isempty helper
  https://git.pengutronix.de/cgit/barebox/commit/?id=815db76bd8c8 (link may 
not be stable)
[2/4] common: env: make use of isempty()
  https://git.pengutronix.de/cgit/barebox/commit/?id=f681d1c0ebd0 (link may 
not be stable)
[3/4] common: hostname: validate the provided hostname
  https://git.pengutronix.de/cgit/barebox/commit/?id=e0d5d8bf9a81 (link may 
not be stable)
[4/4] bootm: add global.bootm.provide_hostname option
  https://git.pengutronix.de/cgit/barebox/commit/?id=c1bb8f33009e (link may 
not be stable)

Best regards,
-- 
Sascha Hauer 




[PATCH v2 2/2] arm: boards: Add support for protonic-mecsbc board

2024-04-04 Thread Sascha Hauer
From: David Jander 

MECSBC is a single-board-computer manufactured by Protonic Holland used in
blood analysis machines manufactured by RR-Mechatronics.

Signed-off-by: David Jander 
Signed-off-by: Sascha Hauer 
---

Notes:
Changes since v1:

- Use aiochannel_name_get_value() helper
- some code refactoring

 Documentation/boards/rockchip.rst  |   1 +
 arch/arm/boards/Makefile   |   1 +
 arch/arm/boards/protonic-mecsbc/Makefile   |   3 +
 arch/arm/boards/protonic-mecsbc/board.c| 159 +
 arch/arm/boards/protonic-mecsbc/lowlevel.c |  33 +
 arch/arm/configs/rockchip_v8_defconfig |   4 +
 arch/arm/dts/Makefile  |   1 +
 arch/arm/dts/rk3568-mecsbc-linux.dts   | 704 +
 arch/arm/dts/rk3568-mecsbc.dts | 147 +
 arch/arm/mach-rockchip/Kconfig |   6 +
 images/Makefile.rockchip   |   1 +
 11 files changed, 1060 insertions(+)
 create mode 100644 arch/arm/boards/protonic-mecsbc/Makefile
 create mode 100644 arch/arm/boards/protonic-mecsbc/board.c
 create mode 100644 arch/arm/boards/protonic-mecsbc/lowlevel.c
 create mode 100644 arch/arm/dts/rk3568-mecsbc-linux.dts
 create mode 100644 arch/arm/dts/rk3568-mecsbc.dts

diff --git a/Documentation/boards/rockchip.rst 
b/Documentation/boards/rockchip.rst
index 583b4f1720..aa2febc8eb 100644
--- a/Documentation/boards/rockchip.rst
+++ b/Documentation/boards/rockchip.rst
@@ -61,6 +61,7 @@ Supported Boards
 - Pine64 Quartz64 Model A
 - Radxa ROCK3 Model A
 - Radxa CM3 (RK3566) IO Board
+- Protonic MECSBC
 
 The steps described in the following target the RK3568 and the RK3568 EVB but
 generally apply to both SoCs and all boards.
diff --git a/arch/arm/boards/Makefile b/arch/arm/boards/Makefile
index 05fbcca175..84e777092d 100644
--- a/arch/arm/boards/Makefile
+++ b/arch/arm/boards/Makefile
@@ -109,6 +109,7 @@ obj-$(CONFIG_MACH_PM9G45)   += pm9g45/
 obj-$(CONFIG_MACH_POLYHEX_DEBIX)   += polyhex-debix/
 obj-$(CONFIG_MACH_PROTONIC_IMX6)   += protonic-imx6/
 obj-$(CONFIG_MACH_PROTONIC_IMX8M)  += protonic-imx8m/
+obj-$(CONFIG_MACH_PROTONIC_MECSBC) += protonic-mecsbc/
 obj-$(CONFIG_MACH_PROTONIC_STM32MP1)   += protonic-stm32mp1/
 obj-$(CONFIG_MACH_QIL_A9260)   += qil-a926x/
 obj-$(CONFIG_MACH_QIL_A9G20)   += qil-a926x/
diff --git a/arch/arm/boards/protonic-mecsbc/Makefile 
b/arch/arm/boards/protonic-mecsbc/Makefile
new file mode 100644
index 00..b37b6c870b
--- /dev/null
+++ b/arch/arm/boards/protonic-mecsbc/Makefile
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
+obj-y += board.o
+lwl-y += lowlevel.o
diff --git a/arch/arm/boards/protonic-mecsbc/board.c 
b/arch/arm/boards/protonic-mecsbc/board.c
new file mode 100644
index 00..3ba8fb8d1c
--- /dev/null
+++ b/arch/arm/boards/protonic-mecsbc/board.c
@@ -0,0 +1,159 @@
+// SPDX-License-Identifier: GPL-2.0-only
+
+#define pr_fmt(fmt) "MECSBC: " fmt
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+struct mecsbc_model {
+   const char *name;
+   const char *shortname;
+};
+
+struct mecsbc_priv {
+   int hw_id;
+   int hw_rev;
+};
+
+static struct mecsbc_priv mecsbc_data;
+
+static int saradc_get_value(const char *chan)
+{
+   int ret, voltage;
+
+   ret = aiochannel_name_get_value(chan, );
+   if (ret) {
+   pr_warn_once("Cannot read ADC %s: %pe\n", chan, ERR_PTR(ret));
+   return 0;
+   }
+
+   return voltage;
+}
+
+static int mecsbc_get_vin_mv(void)
+{
+   return saradc_get_value("aiodev0.in_value2_mV") * 22;
+}
+
+static bool mecsbc_get_usb_boot(void)
+{
+   return saradc_get_value("aiodev0.in_value0_mV") < 74;
+}
+
+static int mecsbc_adc_id_values[] = {
+   1800, 1662, 1521, 1354, 1214, 1059, 900, 742, 335, 589, 278, 137, 0
+};
+
+static int mecsbc_get_adc_id(const char *chan)
+{
+   int val;
+   unsigned int t;
+
+   val = saradc_get_value(chan) + 74;
+
+   for (t = 0; t < ARRAY_SIZE(mecsbc_adc_id_values); t++) {
+   if (val > mecsbc_adc_id_values[t])
+   return t;
+   }
+
+   return t;
+}
+
+static void mecsbc_process_adc(struct device *dev)
+{
+   mecsbc_data.hw_id = mecsbc_get_adc_id("aiodev0.in_value1_mV");
+   mecsbc_data.hw_rev = mecsbc_get_adc_id("aiodev0.in_value3_mV");
+
+   dev_add_param_uint32_ro(dev, "boardrev", _data.hw_rev, "%u");
+   dev_add_param_uint32_ro(dev, "boardid", _data.hw_id, "%u");
+
+   /* Check if we need to enable the USB gadget instead of booting */
+   if (mecsbc_get_usb_boot()) {
+   globalvar_add_simple("boot.default", "net");
+   globalvar_add_simple("usbgadget.acm", &

[PATCH v2 1/2] aiodev: add helper for getting a value by its channel name

2024-04-04 Thread Sascha Hauer
It's a common pattern to get an aiochannel by name and the value
afterwards. Add a helper for this pattern.

Signed-off-by: Sascha Hauer 
---
 drivers/aiodev/core.c | 12 
 include/aiodev.h  |  9 +
 2 files changed, 21 insertions(+)

diff --git a/drivers/aiodev/core.c b/drivers/aiodev/core.c
index 1fbb7b9188..5bdc4d83d4 100644
--- a/drivers/aiodev/core.c
+++ b/drivers/aiodev/core.c
@@ -73,6 +73,18 @@ int aiochannel_get_value(struct aiochannel *aiochan, int 
*value)
 }
 EXPORT_SYMBOL(aiochannel_get_value);
 
+int aiochannel_name_get_value(const char *chname, int *value)
+{
+   struct aiochannel *aio;
+
+   aio = aiochannel_by_name(chname);
+   if (IS_ERR(aio))
+   return PTR_ERR(aio);
+
+   return aiochannel_get_value(aio, value);
+}
+EXPORT_SYMBOL(aiochannel_name_get_value);
+
 int aiochannel_get_index(struct aiochannel *aiochan)
 {
return aiochan->index;
diff --git a/include/aiodev.h b/include/aiodev.h
index 56bd2da9f5..fb0807ad42 100644
--- a/include/aiodev.h
+++ b/include/aiodev.h
@@ -47,4 +47,13 @@ static inline const char *aiochannel_get_unit(struct 
aiochannel *aiochan)
 extern struct list_head aiodevices;
 #define for_each_aiodevice(aiodevice) list_for_each_entry(aiodevice, 
, list)
 
+#ifdef CONFIG_AIODEV
+int aiochannel_name_get_value(const char *chname, int *value);
+#else
+static inline int aiochannel_name_get_value(const char *chname, int *value)
+{
+   return -EOPNOTSUPP;
+}
+#endif
+
 #endif
-- 
2.39.2




  1   2   3   4   5   6   7   8   9   10   >