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

2024-04-12 Thread Enrico Scholz
From: Enrico Scholz 

Use of_property_get_value() accessor.  Else, wrong results are
returned when working with fit images.

Signed-off-by: Enrico Scholz 
---
 drivers/of/base.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index b22959dabebf..9bd0cdaac2ad 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -853,7 +853,7 @@ int of_property_count_elems_of_size(const struct 
device_node *np,
 
if (!prop)
return -EINVAL;
-   if (!prop->value)
+   if (!of_property_get_value(prop))
return -ENODATA;
 
if (prop->length % elem_size != 0) {
@@ -2009,9 +2009,9 @@ int of_property_read_string_helper(const struct 
device_node *np,
 
if (!prop)
return -EINVAL;
-   if (!prop->value)
+   p = of_property_get_value(prop);
+   if (!p)
return -ENODATA;
-   p = prop->value;
end = p + prop->length;
 
for (i = 0; p < end && (!out_strs || i < skip + sz); i++, p += l) {
-- 
2.44.0




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

2024-04-12 Thread Enrico Scholz
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.

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




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

2024-04-12 Thread Marco Felsch
On 24-04-12, 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 from my side.

Regards,
  Marco



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

2024-04-12 Thread Ahmad Fatoum
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?

Cheers,
Ahmad

> 
>> On 24-04-05, Michael Riesch wrote:
>>> [...]
> Best regards,
> Michael
> 
> 

-- 
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 v2 4/4] arm: boards: add wolfvision pf5 mainboard

2024-04-12 Thread Michael Riesch
Add support for the WolfVision PF5 mainboard, which features the Rockchip
RK3568 SoC and can be extended with different expansion boards.

Signed-off-by: Michael Riesch 
---
 arch/arm/boards/Makefile   |  1 +
 arch/arm/boards/wolfvision-pf5/.gitignore  |  1 +
 arch/arm/boards/wolfvision-pf5/Makefile|  3 +
 arch/arm/boards/wolfvision-pf5/board.c | 88 ++
 arch/arm/boards/wolfvision-pf5/lowlevel.c  | 36 +
 arch/arm/dts/Makefile  |  3 +
 .../arm/dts/rk3568-wolfvision-pf5-io-expander.dtso | 11 +++
 arch/arm/dts/rk3568-wolfvision-pf5.dts | 48 
 arch/arm/mach-rockchip/Kconfig |  9 +++
 images/Makefile.rockchip   |  1 +
 10 files changed, 201 insertions(+)

diff --git a/arch/arm/boards/Makefile b/arch/arm/boards/Makefile
index 84e777092d..98eab17af2 100644
--- a/arch/arm/boards/Makefile
+++ b/arch/arm/boards/Makefile
@@ -204,3 +204,4 @@ obj-$(CONFIG_MACH_RADXA_ROCK5)  += 
radxa-rock5/
 obj-$(CONFIG_MACH_VARISCITE_DT8MCUSTOMBOARD_IMX8MP)+= 
variscite-dt8mcustomboard-imx8mp/
 obj-$(CONFIG_MACH_RADXA_CM3)   += radxa-cm3/
 obj-$(CONFIG_MACH_TQMA93XX)+= tqma93xx/
+obj-$(CONFIG_MACH_WOLFVISION_PF5)  += wolfvision-pf5/
diff --git a/arch/arm/boards/wolfvision-pf5/.gitignore 
b/arch/arm/boards/wolfvision-pf5/.gitignore
new file mode 100644
index 00..f458f794b5
--- /dev/null
+++ b/arch/arm/boards/wolfvision-pf5/.gitignore
@@ -0,0 +1 @@
+sdram-init.bin
diff --git a/arch/arm/boards/wolfvision-pf5/Makefile 
b/arch/arm/boards/wolfvision-pf5/Makefile
new file mode 100644
index 00..b37b6c870b
--- /dev/null
+++ b/arch/arm/boards/wolfvision-pf5/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/wolfvision-pf5/board.c 
b/arch/arm/boards/wolfvision-pf5/board.c
new file mode 100644
index 00..797f51bc2e
--- /dev/null
+++ b/arch/arm/boards/wolfvision-pf5/board.c
@@ -0,0 +1,88 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Board code for the WolfVision PF5 mainboard.
+ *
+ * Copyright (C) 2024 WolfVision GmbH.
+ */
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#define PF5_IO_EXPANDER_FILENAME "rk3568-wolfvision-pf5-io-expander.dtbo"
+#define PF5_IO_EXPANDER_DATA __dtbo_rk3568_wolfvision_pf5_io_expander_start
+
+enum {
+   PF5_HWID_CHANNEL_MAINBOARD = 1,
+   PF5_HWID_CHANNEL_MODULE = 2,
+};
+
+extern char PF5_IO_EXPANDER_DATA[];
+
+static const struct wv_rk3568_extension pf5_extensions[] = {
+   {
+   .adc_chan = PF5_HWID_CHANNEL_MAINBOARD,
+   .name = "mainboard",
+   .overlays = {
+   [0] = { .name = "PF5 DC V1.0 A", },
+   [4] = { .name = "PF5 DC V1.1 A", },
+   },
+   },
+   {
+   .adc_chan = PF5_HWID_CHANNEL_MODULE,
+   .name = "module",
+   .overlays = {
+   [0] = { .name = "PF5 IO Expander V1.0 A",
+   .filename = PF5_IO_EXPANDER_FILENAME,
+   .data = PF5_IO_EXPANDER_DATA,
+   },
+   [16] = { .name = "no", },
+   },
+   },
+};
+
+static int pf5_probe(struct device *dev)
+{
+   char *pf5_overlays = NULL;
+   int ret;
+
+   barebox_set_model("WolfVision PF5");
+   barebox_set_hostname("PF5");
+
+   ret = wolfvision_register_ethaddr();
+   if (ret)
+   pr_warning("failed to register MAC addresses\n");
+
+   rk3568_bbu_mmc_register("emmc", BBU_HANDLER_FLAG_DEFAULT, "/dev/mmc0");
+
+   ret = wolfvision_rk3568_detect_hw(
+   pf5_extensions, ARRAY_SIZE(pf5_extensions), _overlays);
+   if (ret)
+   pr_warning("failed to detect HW\n");
+
+   if (pf5_overlays)
+   globalvar_set("of.overlay.filepattern", pf5_overlays);
+
+   free(pf5_overlays);
+
+   return 0;
+}
+
+static const struct of_device_id pf5_of_match[] = {
+   {
+   .compatible = "wolfvision,rk3568-pf5",
+   },
+   { /* sentinel */ },
+};
+
+static struct driver_d pf5_board_driver = {
+   .name = "board-wolfvision-pf5",
+   .probe = pf5_probe,
+   .of_compatible = pf5_of_match,
+};
+coredevice_platform_driver(pf5_board_driver);
+
+BAREBOX_DEEP_PROBE_ENABLE(pf5_of_match);
diff --git a/arch/arm/boards/wolfvision-pf5/lowlevel.c 
b/arch/arm/boards/wolfvision-pf5/lowlevel.c
new file mode 100644
index 00..c20ca4ae13
--- /dev/null
+++ b/arch/arm/boards/wolfvision-pf5/lowlevel.c
@@ -0,0 +1,36 @@
+// SPDX-License-Identifier: GPL-2.0-only
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+extern char __dtb_rk3568_wolfvision_pf5_start[];
+

[PATCH v2 3/4] common: add wolfvision board code library

2024-04-12 Thread Michael Riesch
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  | 142 +
 include/boards/wolfvision/common.h |  32 +
 5 files changed, 180 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..f483918cec
--- /dev/null
+++ b/common/boards/wolfvision/common.c
@@ -0,0 +1,142 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Common board code functions WolfVision boards.
+ *
+ * Copyright (C) 2024 WolfVision GmbH.
+ */
+
+#define pr_fmt(fmt) "boards: wolfvision: " fmt
+
+#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 (IS_ERR(node)) {
+   pr_err("Cannot unflatten dtbo\n");
+   return PTR_ERR(node);
+   }
+
+   ret = of_overlay_apply_tree(of_get_root_node(), node);
+
+   of_delete_node(node);
+
+   if (ret) {
+   pr_err("Cannot apply overlay: %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;
+}
+
+static 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,
+   };
+   int ret, hwid, voltage;
+   char *chan_name;
+
+   chan_name = basprintf("saradc.in_value%d_mV", chan_idx);
+   ret = aiochannel_name_get_value(chan_name, );
+   free(chan_name);
+   if (ret)
+   return ret;
+
+   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 wv_rk3568_extension *extensions,
+   int num_extensions, char **overlays)
+{
+   int i, hwid, ret;
+
+   ret = of_device_ensure_probed_by_alias("saradc");
+   if (ret)
+   return ret;
+
+   for (i = 0; i < num_extensions; i++) {
+   const struct wv_rk3568_extension *extension = [i];
+   const struct wv_overlay *overlay;
+
+   ret = wolfvision_rk3568_get_hwid(extension->adc_chan);
+   if (ret < 0) {
+   pr_warning("Could not retrieve %s HWID (%d)\n",
+  extension->name, ret);
+ 

[PATCH v2 2/4] arm: dts: add common state for wolfvision boards

2024-04-12 Thread Michael Riesch
Add a common state device tree include that features
 - the boot state
 - the MAC address
envisaged for the use in all WolfVision boards.

Signed-off-by: Michael Riesch 
---
 arch/arm/dts/wolfvision-state.dtsi | 71 ++
 1 file changed, 71 insertions(+)

diff --git a/arch/arm/dts/wolfvision-state.dtsi 
b/arch/arm/dts/wolfvision-state.dtsi
new file mode 100644
index 00..f246a1a4a8
--- /dev/null
+++ b/arch/arm/dts/wolfvision-state.dtsi
@@ -0,0 +1,71 @@
+// SPDX-License-Identifier: (GPL-2.0-or-later OR MIT)
+/*
+ * Common state definition for WolfVision boards.
+ *
+ * Copyright (C) 2024 WolfVision GmbH.
+ */
+
+/ {
+   aliases {
+   state = 
+   };
+
+   state: state {
+   compatible = "barebox,state";
+   #address-cells = <1>;
+   #size-cells = <1>;
+   backend-type = "raw";
+   backend = <_state>;
+   backend-stridesize = <1024>;
+   magic = <0xef784236>;
+
+   bootstate {
+   #address-cells = <1>;
+   #size-cells = <1>;
+
+   system1 {
+   #address-cells = <1>;
+   #size-cells = <1>;
+
+   remaining_attempts@0 {
+   reg = <0x0 0x4>;
+   type = "uint32";
+   default = <3>;
+   };
+
+   priority@4 {
+   reg = <0x4 0x4>;
+   type = "uint32";
+   default = <21>;
+   };
+   };
+
+   system2 {
+   #address-cells = <1>;
+   #size-cells = <1>;
+
+   remaining_attempts@8 {
+   reg = <0x8 0x4>;
+   type = "uint32";
+   default = <3>;
+   };
+
+   priority@c {
+   reg = <0xc 0x4>;
+   type = "uint32";
+   default = <20>;
+   };
+   };
+
+   last_chosen@10 {
+   reg = <0x10 0x4>;
+   type = "uint32";
+   };
+   };
+
+   mac-address@14 {
+   reg = <0x14 0x6>;
+   type = "mac";
+   };
+   };
+};

-- 
2.34.1




[PATCH v2 1/4] arm: dts: copy pf5 device tree from mainline linux

2024-04-12 Thread Michael Riesch
The device tree for the WolfVision PF5 mainboard and the overlay for
the PF5 IO Expander have been accepted for inclusion in Linux v6.10:
https://git.kernel.org/pub/scm/linux/kernel/git/mmind/linux-rockchip.git/log/?h=v6.10-armsoc/dts64

Once the device tree changes are merged and then integrated into
barebox these files should vanish.

Signed-off-by: Michael Riesch 
---
 ...rk3568-wolfvision-pf5-io-expander-upstream.dtso | 137 ++
 arch/arm/dts/rk3568-wolfvision-pf5-upstream.dts| 528 +
 2 files changed, 665 insertions(+)

diff --git a/arch/arm/dts/rk3568-wolfvision-pf5-io-expander-upstream.dtso 
b/arch/arm/dts/rk3568-wolfvision-pf5-io-expander-upstream.dtso
new file mode 100644
index 00..ebcaeafc38
--- /dev/null
+++ b/arch/arm/dts/rk3568-wolfvision-pf5-io-expander-upstream.dtso
@@ -0,0 +1,137 @@
+// SPDX-License-Identifier: (GPL-2.0-or-later OR MIT)
+/*
+ * Device tree overlay for the WolfVision PF5 IO Expander board.
+ *
+ * Copyright (C) 2024 WolfVision GmbH.
+ */
+
+/dts-v1/;
+/plugin/;
+
+#include 
+#include 
+#include 
+#include 
+
+&{/} {
+   gmac0_clkin: external-gmac0-clock {
+   compatible = "fixed-clock";
+   clock-frequency = <5000>;
+   clock-output-names = "gmac0_clkin";
+   #clock-cells = <0>;
+   };
+
+   usb_host_vbus: usb-host-vbus-regulator {
+   compatible = "regulator-fixed";
+   enable-active-high;
+   gpio = < RK_PA3 GPIO_ACTIVE_HIGH>;
+   pinctrl-names = "default";
+   pinctrl-0 = <_host_vbus_en>;
+   regulator-name = "usb_host_vbus";
+   regulator-min-microvolt = <500>;
+   regulator-max-microvolt = <500>;
+   vin-supply = <_in>;
+   };
+
+   vcc1v8_eth: vcc1v8-eth-regulator {
+   compatible = "regulator-fixed";
+   enable-active-high;
+   gpio = < RK_PC1 GPIO_ACTIVE_HIGH>;
+   pinctrl-names = "default";
+   pinctrl-0 = <_eth_en>;
+   regulator-always-on;
+   regulator-boot-on;
+   regulator-name = "1v8_eth";
+   regulator-min-microvolt = <180>;
+   regulator-max-microvolt = <180>;
+   vin-supply = <_sys>;
+   };
+
+   vcc3v3_eth: vcc3v3-eth-regulator {
+   compatible = "regulator-fixed";
+   enable-active-low;
+   gpio = < RK_PC0 GPIO_ACTIVE_LOW>;
+   pinctrl-names = "default";
+   pinctrl-0 = <_eth_enn>;
+   regulator-always-on;
+   regulator-boot-on;
+   regulator-name = "3v3_eth";
+   regulator-min-microvolt = <330>;
+   regulator-max-microvolt = <330>;
+   vin-supply = <_sys>;
+   };
+};
+
+ {
+   assigned-clocks = < SCLK_GMAC0_RX_TX>,
+ < SCLK_GMAC0>;
+   assigned-clock-parents = < SCLK_GMAC0_RMII_SPEED>,
+<_clkin>;
+   clock_in_out = "input";
+   phy-handle = <>;
+   phy-mode = "rmii";
+   phy-supply = <_eth>;
+   pinctrl-names = "default";
+   pinctrl-0 = <_miim
+_clkinout
+_rx_er
+_rx_bus2
+_tx_bus2>;
+   status = "okay";
+};
+
+ {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   dp83826: ethernet-phy@0 {
+   compatible = "ethernet-phy-ieee802.3-c22";
+   reg = <0x0>;
+   interrupt-parent = <>;
+   interrupts = ;
+   pinctrl-names = "default";
+   pinctrl-0 = <_wake_intn _phy_rstn>;
+   reset-assert-us = <1000>;
+   reset-deassert-us = <2000>;
+   reset-gpios = < RK_PD4 GPIO_ACTIVE_LOW>;
+   wakeup-source;
+   };
+};
+
+ {
+   ethernet {
+   eth_wake_intn: eth-wake-intn-pinctrl {
+   rockchip,pins = <0 RK_PD3 RK_FUNC_GPIO _pull_none>;
+   };
+
+   eth_phy_rstn: eth-phy-rstn-pinctrl {
+   rockchip,pins = <0 RK_PD4 RK_FUNC_GPIO _pull_none>;
+   };
+
+   vcc1v8_eth_en: vcc1v8-eth-en-pinctrl {
+   rockchip,pins = <0 RK_PC1 RK_FUNC_GPIO _pull_none>;
+   };
+
+   vcc3v3_eth_enn: vcc3v3-eth-enn-pinctrl {
+   rockchip,pins = <0 RK_PC0 RK_FUNC_GPIO _pull_none>;
+   };
+   };
+
+   usb {
+   usb_host_vbus_en: usb-host-vbus-en-pinctrl {
+   rockchip,pins = <1 RK_PA3 RK_FUNC_GPIO _pull_none>;
+   };
+   };
+};
+
+_host1_xhci {
+   maximum-speed = "high-speed";
+   phys = <_host>;
+   phy-names = "usb2-phy";
+   status = "okay";
+};
+
+_host {
+   phy-supply = <_host_vbus>;
+   status = "okay";
+};
diff --git 

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

2024-04-12 Thread Michael Riesch
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.

Patch 1 copies the device tree (overlay) from mainline Linux.

Patch 2 and 3 provide a library and state definition that are envisaged
to be used by all WolfVision boards.

Finally, patch 4 adds the actual PF5 mainboard support.

v2 addresses comments by Sascha and Marco -- thanks for the review!

Looking forward to your comments!

Signed-off-by: Michael Riesch 
---
Michael Riesch (4):
  arm: dts: copy pf5 device tree from mainline linux
  arm: dts: add common state for wolfvision boards
  common: add wolfvision board code library
  arm: boards: add wolfvision pf5 mainboard

 arch/arm/boards/Makefile   |   1 +
 arch/arm/boards/wolfvision-pf5/.gitignore  |   1 +
 arch/arm/boards/wolfvision-pf5/Makefile|   3 +
 arch/arm/boards/wolfvision-pf5/board.c |  88 
 arch/arm/boards/wolfvision-pf5/lowlevel.c  |  36 ++
 arch/arm/dts/Makefile  |   3 +
 ...rk3568-wolfvision-pf5-io-expander-upstream.dtso | 137 ++
 .../arm/dts/rk3568-wolfvision-pf5-io-expander.dtso |  11 +
 arch/arm/dts/rk3568-wolfvision-pf5-upstream.dts| 528 +
 arch/arm/dts/rk3568-wolfvision-pf5.dts |  48 ++
 arch/arm/dts/wolfvision-state.dtsi |  71 +++
 arch/arm/mach-rockchip/Kconfig |   9 +
 common/boards/Kconfig  |   3 +
 common/boards/Makefile |   1 +
 common/boards/wolfvision/Makefile  |   2 +
 common/boards/wolfvision/common.c  | 142 ++
 images/Makefile.rockchip   |   1 +
 include/boards/wolfvision/common.h |  32 ++
 18 files changed, 1117 insertions(+)
---
base-commit: 8351de807d1430977fe83457c85face9537357d4
change-id: 20240405-feature-wolfvision-pf5-4d15a072b0b8

Best regards,
-- 
Michael Riesch 




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

2024-04-12 Thread Michael Riesch
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

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?

> On 24-04-05, Michael Riesch wrote:
>> [...]
Best regards,
Michael