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

2024-04-15 Thread Jonas Richardsen
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.

Signed-off-by: Jonas Richardsen 
---
In the process of creating this patch, we realized that the fixups 
for the Raspberry Pi are extensively copying properties from the video
core device tree that are not strictly necessary. We will do some
work on making the fixups more precise (i.e., only copy specific
properties, not entire nodes) soon.

 drivers/of/base.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index b22959dabe..3192a74ab9 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -2346,6 +2346,9 @@ struct property *of_copy_property(const struct 
device_node *src,
if (!prop)
return NULL;
 
+   if (of_property_present(dst, propname))
+   return ERR_PTR(-EEXIST);
+
return of_new_property(dst, propname,
   of_property_get_value(prop), prop->length);
 }
-- 
2.42.0




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

2024-04-15 Thread Ahmad Fatoum
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.

Signed-off-by: Ahmad Fatoum 
---
 Documentation/devel/project-ideas.rst | 2 --
 1 file changed, 2 deletions(-)

diff --git a/Documentation/devel/project-ideas.rst 
b/Documentation/devel/project-ideas.rst
index da146c3e520e..4127b2556b55 100644
--- a/Documentation/devel/project-ideas.rst
+++ b/Documentation/devel/project-ideas.rst
@@ -156,8 +156,6 @@ on top of a block device which caches blocks previously 
read from the
 hardware driver, often by means of DMA. There are a number of improvements
 possible to increase throughput of barebox I/O:
 
-- Support for higher MMC speed modes: The maximum currently supported
-  is 50/52 MHz and no DDR.
 - More efficient erase: Communication protocols like Android Fastboot
   encode large blocks of zeros specially. MMCs with erase-to-zero
   capability could perform such erases in the background instead
-- 
2.39.2




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

2024-04-15 Thread Ahmad Fatoum
Commit d00b07dd14bc ("ARM: Remove qemu_virt64_defconfig") dropped the
defconfig in favor of multi_v8_defconfig, but missed updating the
documentation. Remedy this.

Signed-off-by: Ahmad Fatoum 
---
 Documentation/boards/aarch64-qemu-virt.rst | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/Documentation/boards/aarch64-qemu-virt.rst 
b/Documentation/boards/aarch64-qemu-virt.rst
index 42e7d00bfef6..8bf590a7a831 100644
--- a/Documentation/boards/aarch64-qemu-virt.rst
+++ b/Documentation/boards/aarch64-qemu-virt.rst
@@ -1,8 +1,11 @@
 Aarch64 Qemu virt
 =
 
-Besides a number of physical ARM64 targets, barebox also supports a
-``qemu-virt64`` board.
+Besides a number of physical ARM64 targets, barebox also supports the
+``qemu-virt64`` board in the generic ``multi_v8_defconfig``::
+
+ make multi_v8_defconfig
+ make
 
 Running barebox on QEMU aarch64 virt machine
 
-- 
2.39.2




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

2024-04-15 Thread Ahmad Fatoum
On 15.04.24 10:14, Jonas Richardsen wrote:

Please write a short sentence here, justifying the change and add
you S-o-b, see https://developercertificate.org/

> ---
>  drivers/of/base.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index b22959dabe..9bb4ae13db 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -2346,6 +2346,9 @@ struct property *of_copy_property(const struct 
> device_node *src,
>   if (!prop)
>   return NULL;
>  
> + if (of_find_property(dst, propname, NULL))
> + return ERR_PTR(-EEXIST);

Use of_property_present() here instead.

Cheers,
Ahmad

> +
>   return of_new_property(dst, propname,
>  of_property_get_value(prop), prop->length);
>  }

-- 
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] of: do not copy properties if they already exist in the destination

2024-04-15 Thread Jonas Richardsen
---
 drivers/of/base.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index b22959dabe..9bb4ae13db 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -2346,6 +2346,9 @@ struct property *of_copy_property(const struct 
device_node *src,
if (!prop)
return NULL;
 
+   if (of_find_property(dst, propname, NULL))
+   return ERR_PTR(-EEXIST);
+
return of_new_property(dst, propname,
   of_property_get_value(prop), prop->length);
 }
-- 
2.42.0




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

2024-04-15 Thread Ahmad Fatoum
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.

Signed-off-by: Ahmad Fatoum 
---
 drivers/pinctrl/pinctrl-rockchip.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/pinctrl/pinctrl-rockchip.c 
b/drivers/pinctrl/pinctrl-rockchip.c
index c1e937ea2cb1..ca9939c9e91d 100644
--- a/drivers/pinctrl/pinctrl-rockchip.c
+++ b/drivers/pinctrl/pinctrl-rockchip.c
@@ -2172,8 +2172,13 @@ static int rockchip_set_pull(struct rockchip_pin_bank 
*bank,
if (ret == RK_BIAS_PULL_UP)
ret = 3;
}
 
+   if (ret < 0) {
+   dev_err(dev, "unsupported pull setting %d\n", pull);
+   return ret;
+   }
+
/* enable the write to the equivalent lower bits */
data = ((1 << RK3188_PULL_BITS_PER_PIN) - 1) << (bit + 16);
rmask = data | (data >> 16);
data |= (ret << bit);
-- 
2.39.2