Skip to contentSkip to conversation

net: dwc_eth_qos: Add glue driver for Intel MAC

PATCH Superseded Philip Oberfichtner 2 participants 9 messages Jul 17, 2024 – Aug 2, 2024

Subsystems (5)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v3 cover net: dwc_eth_qos: Add glue driver for Intel MAC

This patch series implements the dwc_eth_qos glue driver for Intel SOCs. Before doing that, a few general adaptions to the dwc_eth_qos.c main driver are required. Most notably, the preparation for PCI based driver instances, which do not necessarily use a device tree.

This patch series depends on: "net: dwc_eth_qos: mdio: Implement clause 45":
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

Changes in V3:
- Replace mfence() with mb()
- Clean-up eqos_get_base_addr()
- Several style fixes for dwc_eth_qos_intel

Philip Oberfichtner (5):
x86: provide mb() macro
net: dwc_eth_qos: Fix header to be self-contained
net: dwc_eth_qos: Adapt probe() for PCI devices
net: dwc_eth_qos: Implement bind() for PCI devices
net: dwc_eth_qos: Add glue driver for Intel MAC

 arch/x86/cpu/mp_init.c             |  10 +-
 arch/x86/include/asm/cpu.h         |   5 -
 arch/x86/include/asm/io.h          |   1 +
 drivers/net/Kconfig                |   7 +
 drivers/net/Makefile               |   1 +
 drivers/net/dwc_eth_qos.c          |  79 ++++-
 drivers/net/dwc_eth_qos.h          |   8 +-
 drivers/net/dwc_eth_qos_imx.c      |   6 +
 drivers/net/dwc_eth_qos_intel.c    | 449 +++++++++++++++++++++++++++++
 drivers/net/dwc_eth_qos_intel.h    |  57 ++++
 drivers/net/dwc_eth_qos_qcom.c     |   6 +
 drivers/net/dwc_eth_qos_rockchip.c |   6 +
 drivers/net/dwc_eth_qos_starfive.c |   6 +
 drivers/net/dwc_eth_qos_stm32.c    |   6 +
 include/pci_ids.h                  |   9 +
 15 files changed, 637 insertions(+), 19 deletions(-)
 create mode 100644 drivers/net/dwc_eth_qos_intel.c
 create mode 100644 drivers/net/dwc_eth_qos_intel.h
Signature · 1 line
2.39.2
#1 lore raw

PATCH v3 1/5 x86: provide mb() macro

Implement a x86 memory barrier mb(). Furthermore, remove the previously used mfence() function, which does the same thing.

The mb() macro is now equivalent to Linux (v6.9):
linux/arch/x86/include/asm/barrier.h

---

Notes:
Changes in V3:
- Remove mfence() function

 arch/x86/cpu/mp_init.c     | 10 +++++-----
 arch/x86/include/asm/cpu.h |  5 -----
 arch/x86/include/asm/io.h  |  1 +
 3 files changed, 6 insertions(+), 10 deletions(-)
arch/x86/cpu/mp_init.c +5 -5
index aa1f47d7227..e2e1849c065 100644
@@ -164,12 +164,12 @@ static inline void barrier_wait(atomic_t *b)
 {
 	while (atomic_read(b) == 0)
 		asm("pause");
-	mfence();
+	mb();
 }
 
 static inline void release_barrier(atomic_t *b)
 {
-	mfence();
+	mb();
 	atomic_set(b, 1);
 }
 
@@ -631,7 +631,7 @@ static int run_ap_work(struct mp_callback *callback, struct udevice *bsp,
 		if (cur_cpu != i)
 			store_callback(&ap_callbacks[i], callback);
 	}
-	mfence();
+	mb();
 
 	/* Wait for all the APs to signal back that call has been accepted. */
 	start = get_timer(0);
@@ -656,7 +656,7 @@ static int run_ap_work(struct mp_callback *callback, struct udevice *bsp,
 	} while (cpus_accepted != num_aps);
 
 	/* Make sure we can see any data written by the APs */
-	mfence();
+	mb();
 
 	return 0;
 }
@@ -692,7 +692,7 @@ static int ap_wait_for_instruction(struct udevice *cpu, void *unused)
 
 		/* Copy to local variable before using the value */
 		memcpy(&lcb, cb, sizeof(lcb));
-		mfence();
+		mb();
 		if (lcb.logical_cpu_number == MP_SELECT_ALL ||
 		    lcb.logical_cpu_number == MP_SELECT_APS ||
 		    dev_seq(cpu) == lcb.logical_cpu_number)
arch/x86/include/asm/cpu.h +0 -5
index 073f80b07f1..87e0c6f12b6 100644
@@ -185,11 +185,6 @@ static inline int flag_is_changeable_p(uint32_t flag)
 }
 #endif
 
-static inline void mfence(void)
-{
-	__asm__ __volatile__("mfence" : : : "memory");
-}
-
 /**
  * cpu_enable_paging_pae() - Enable PAE-paging
  *
arch/x86/include/asm/io.h +1 -0
index c6d90eb794a..1390193f09c 100644
@@ -240,6 +240,7 @@ static inline void sync(void)
  * have some advantages to use them instead of the simple one here.
  */
 #define dmb()		__asm__ __volatile__ ("" : : : "memory")
+#define mb()		__asm__ __volatile__ ("mfence" : : : "memory")
 #define __iormb()	dmb()
 #define __iowmb()	dmb()
 
Signature · 1 line
2.39.2
#2 lore raw

PATCH v3 2/5 net: dwc_eth_qos: Fix header to be self-contained

In reply to Philip Oberfichtner

Before this commit, usage of this header relied on a specific include order. Fix it by including all dependencies.

---
 drivers/net/dwc_eth_qos.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/dwc_eth_qos.h +4 -1
index 8b3d0d464d3..6372ba9f35c 100644
@@ -3,8 +3,11 @@
  * Copyright 2022 NXP
  */
 
-#include <phy_interface.h>
+#include <asm/gpio.h>
+#include <clk.h>
 #include <linux/bitops.h>
+#include <phy_interface.h>
+#include <reset.h>
 
 /* Core registers */
 
Signature · 1 line
2.39.2
#3 lore raw

PATCH v3 3/5 net: dwc_eth_qos: Adapt probe() for PCI devices

In reply to Philip Oberfichtner

PCI devices do not necessarily use a device tree. In that case, the driver currently fails to find eqos->config and eqos->regs.

This commit factors out the respective functionality. Device tree usage remains default, but board specific implementations will be possible as well.

---

Notes:
Changes in V3:

Factor out eqos_get_base_addr_common() in order to avoid introducing a new callback function.

 drivers/net/dwc_eth_qos.c          | 51 +++++++++++++++++++++++++-----
 drivers/net/dwc_eth_qos.h          |  2 ++
 drivers/net/dwc_eth_qos_imx.c      |  6 ++++
 drivers/net/dwc_eth_qos_qcom.c     |  6 ++++
 drivers/net/dwc_eth_qos_rockchip.c |  6 ++++
 drivers/net/dwc_eth_qos_starfive.c |  6 ++++
 drivers/net/dwc_eth_qos_stm32.c    |  6 ++++
 7 files changed, 75 insertions(+), 8 deletions(-)
drivers/net/dwc_eth_qos.c +43 -8
index 67ac86f82bc..039d7d409e3 100644
@@ -32,6 +32,7 @@
 #include <clk.h>
 #include <cpu_func.h>
 #include <dm.h>
+#include <dm/device_compat.h>
 #include <errno.h>
 #include <eth_phy.h>
 #include <log.h>
@@ -1279,6 +1280,13 @@ static int eqos_probe_resources_tegra186(struct udevice *dev)
 
 	debug("%s(dev=%p):\n", __func__, dev);
 
+	ret = eqos_get_base_addr_dt(dev);
+	if (ret) {
+		pr_err("eqos_get_base_addr_dt failed: %d\n", ret);
+		return ret;
+	}
+	eqos->tegra186_regs = (void *)(eqos->regs + EQOS_TEGRA186_REGS_BASE);
+
 	ret = reset_get_by_name(dev, "eqos", &eqos->reset_ctl);
 	if (ret) {
 		pr_err("reset_get_by_name(rst) failed: %d\n", ret);
@@ -1353,6 +1361,38 @@ static int eqos_remove_resources_tegra186(struct udevice *dev)
 	return 0;
 }
 
+/*
+ * Get driver data based on the device tree. Boards not using a device tree can
+ * overwrite this function.
+ */
+__weak void *eqos_get_driver_data(struct udevice *dev)
+{
+	return (void *)dev_get_driver_data(dev);
+}
+
+static fdt_addr_t eqos_get_base_addr_common(struct udevice *dev, fdt_addr_t addr)
+{
+	struct eqos_priv *eqos = dev_get_priv(dev);
+
+	if (addr == FDT_ADDR_T_NONE) {
+		dev_err(dev, "addr=0x%llx is invalid.\n", addr);
+		return -EINVAL;
+	}
+
+	eqos->regs = addr;
+	eqos->mac_regs = (void *)(addr + EQOS_MAC_REGS_BASE);
+	eqos->mtl_regs = (void *)(addr + EQOS_MTL_REGS_BASE);
+	eqos->dma_regs = (void *)(addr + EQOS_DMA_REGS_BASE);
+
+	return 0;
+}
+
+int eqos_get_base_addr_dt(struct udevice *dev)
+{
+	fdt_addr_t addr = dev_read_addr(dev);
+	return eqos_get_base_addr_common(dev, addr);
+}
+
 static int eqos_probe(struct udevice *dev)
 {
 	struct eqos_priv *eqos = dev_get_priv(dev);
@@ -1361,17 +1401,12 @@ static int eqos_probe(struct udevice *dev)
 	debug("%s(dev=%p):\n", __func__, dev);
 
 	eqos->dev = dev;
-	eqos->config = (void *)dev_get_driver_data(dev);
 
-	eqos->regs = dev_read_addr(dev);
-	if (eqos->regs == FDT_ADDR_T_NONE) {
-		pr_err("dev_read_addr() failed\n");
+	eqos->config = eqos_get_driver_data(dev);
+	if (!eqos->config) {
+		pr_err("Failed to get driver data.\n");
 		return -ENODEV;
 	}
-	eqos->mac_regs = (void *)(eqos->regs + EQOS_MAC_REGS_BASE);
-	eqos->mtl_regs = (void *)(eqos->regs + EQOS_MTL_REGS_BASE);
-	eqos->dma_regs = (void *)(eqos->regs + EQOS_DMA_REGS_BASE);
-	eqos->tegra186_regs = (void *)(eqos->regs + EQOS_TEGRA186_REGS_BASE);
 
 	eqos->max_speed = dev_read_u32_default(dev, "max-speed", 0);
 
drivers/net/dwc_eth_qos.h +2 -0
index 6372ba9f35c..1121d242ca6 100644
@@ -288,7 +288,9 @@ void eqos_inval_desc_generic(void *desc);
 void eqos_flush_desc_generic(void *desc);
 void eqos_inval_buffer_generic(void *buf, size_t size);
 void eqos_flush_buffer_generic(void *buf, size_t size);
+int eqos_get_base_addr_dt(struct udevice *dev);
 int eqos_null_ops(struct udevice *dev);
+void *eqos_get_driver_data(struct udevice *dev);
 
 extern struct eqos_config eqos_imx_config;
 extern struct eqos_config eqos_rockchip_config;
drivers/net/dwc_eth_qos_imx.c +6 -0
index d6bed278ca7..642432834f5 100644
@@ -47,6 +47,12 @@ static int eqos_probe_resources_imx(struct udevice *dev)
 
 	debug("%s(dev=%p):\n", __func__, dev);
 
+	ret = eqos_get_base_addr_dt(dev);
+	if (ret) {
+		dev_dbg(dev, "eqos_get_base_addr_dt failed: %d", ret);
+		goto err_probe;
+	}
+
 	interface = eqos->config->interface(dev);
 
 	if (interface == PHY_INTERFACE_MODE_NA) {
drivers/net/dwc_eth_qos_qcom.c +6 -0
index 77d626393d5..de0ae090c5d 100644
@@ -522,6 +522,12 @@ static int eqos_probe_resources_qcom(struct udevice *dev)
 
 	debug("%s(dev=%p):\n", __func__, dev);
 
+	ret = eqos_get_base_addr_dt(dev);
+	if (ret) {
+		pr_err("eqos_get_base_addr_dt failed: %d\n", ret);
+		return ret;
+	}
+
 	interface = eqos->config->interface(dev);
 
 	if (interface == PHY_INTERFACE_MODE_NA) {
drivers/net/dwc_eth_qos_rockchip.c +6 -0
index c4557e57988..9fc8c686b88 100644
@@ -311,6 +311,12 @@ static int eqos_probe_resources_rk(struct udevice *dev)
 	int reset_flags = GPIOD_IS_OUT | GPIOD_IS_OUT_ACTIVE;
 	int ret;
 
+	ret = eqos_get_base_addr_dt(dev);
+	if (ret) {
+		dev_err(dev, "eqos_get_base_addr_dt failed: %d\n", ret);
+		return ret;
+	}
+
 	data = calloc(1, sizeof(struct rockchip_platform_data));
 	if (!data)
 		return -ENOMEM;
drivers/net/dwc_eth_qos_starfive.c +6 -0
index 09e714ce76a..d9ace435ee2 100644
@@ -183,6 +183,12 @@ static int eqos_probe_resources_jh7110(struct udevice *dev)
 	struct starfive_platform_data *data;
 	int ret;
 
+	ret = eqos_get_base_addr_dt(dev);
+	if (ret) {
+		pr_err("eqos_get_base_addr_dt failed: %d\n", ret);
+		return ret;
+	}
+
 	data = calloc(1, sizeof(struct starfive_platform_data));
 	if (!data)
 		return -ENOMEM;
drivers/net/dwc_eth_qos_stm32.c +6 -0
index cffaa10b705..f3a973f3774 100644
@@ -234,6 +234,12 @@ static int eqos_probe_resources_stm32(struct udevice *dev)
 
 	interface = eqos->config->interface(dev);
 
+	ret = eqos_get_base_addr_dt(dev);
+	if (ret) {
+		dev_err(dev, "eqos_get_base_addr_dt failed: %d\n", ret);
+		return ret;
+	}
+
 	if (interface == PHY_INTERFACE_MODE_NA) {
 		dev_err(dev, "Invalid PHY interface\n");
 		return -EINVAL;
Signature · 1 line
2.39.2
#4 lore raw

PATCH v3 4/5 net: dwc_eth_qos: Implement bind() for PCI devices

In reply to Philip Oberfichtner

PCI devices do not necessarily use a device tree. Implement a bind() function to assign unique device names in that case.

---
 drivers/net/dwc_eth_qos.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
drivers/net/dwc_eth_qos.c +16 -0
index 039d7d409e3..b7aef751866 100644
@@ -1361,6 +1361,21 @@ static int eqos_remove_resources_tegra186(struct udevice *dev)
 	return 0;
 }
 
+static int eqos_bind(struct udevice *dev)
+{
+	static int dev_num;
+	const size_t name_sz = 16;
+	char name[name_sz];
+
+	/* Device name defaults to DT node name. */
+	if (ofnode_valid(dev_ofnode(dev)))
+		return 0;
+
+	/* Assign unique names in case there is no DT node. */
+	snprintf(name, name_sz, "eth_eqos#%d", dev_num++);
+	return device_set_name(dev, name);
+}
+
 /*
  * Get driver data based on the device tree. Boards not using a device tree can
  * overwrite this function.
@@ -1587,6 +1602,7 @@ U_BOOT_DRIVER(eth_eqos) = {
 	.name = "eth_eqos",
 	.id = UCLASS_ETH,
 	.of_match = of_match_ptr(eqos_ids),
+	.bind	= eqos_bind,
 	.probe = eqos_probe,
 	.remove = eqos_remove,
 	.ops = &eqos_ops,
Signature · 1 line
2.39.2
#5 lore raw

PATCH v3 5/5 net: dwc_eth_qos: Add glue driver for Intel MAC

In reply to Philip Oberfichtner

Add dwc_eth_qos glue driver for the Intel Elkhart-Lake SOC.

---

Notes:
Changes in V3:
- update linux reference to current stable
- replace pr_err by dev_err
- drop __prefix from local function names
- use FIELD_PREP to simplify bitfield extraction

 drivers/net/Kconfig             |   7 +
 drivers/net/Makefile            |   1 +
 drivers/net/dwc_eth_qos.c       |  12 +
 drivers/net/dwc_eth_qos.h       |   1 +
 drivers/net/dwc_eth_qos_intel.c | 449 ++++++++++++++++++++++++++++++++
 drivers/net/dwc_eth_qos_intel.h |  57 ++++
 include/pci_ids.h               |   9 +
 7 files changed, 536 insertions(+)
 create mode 100644 drivers/net/dwc_eth_qos_intel.c
 create mode 100644 drivers/net/dwc_eth_qos_intel.h
drivers/net/Kconfig +7 -0
index b4ff033afa9..6f5618918f6 100644
@@ -243,6 +243,13 @@ config DWC_ETH_QOS_IMX
 	  The Synopsys Designware Ethernet QOS IP block with the specific
 	  configuration used in IMX soc.
 
+config DWC_ETH_QOS_INTEL
+	bool "Synopsys DWC Ethernet QOS device support for Intel"
+	depends on DWC_ETH_QOS
+	help
+	  The Synopsys Designware Ethernet QOS IP block with the specific
+	  configuration used in the Intel Elkhart-Lake soc.
+
 config DWC_ETH_QOS_ROCKCHIP
 	bool "Synopsys DWC Ethernet QOS device support for Rockchip SoCs"
 	depends on DWC_ETH_QOS
drivers/net/Makefile +1 -0
index dce71685c3d..685dda5a584 100644
@@ -20,6 +20,7 @@ obj-$(CONFIG_DRIVER_DM9000) += dm9000x.o
 obj-$(CONFIG_DSA_SANDBOX) += dsa_sandbox.o
 obj-$(CONFIG_DWC_ETH_QOS) += dwc_eth_qos.o
 obj-$(CONFIG_DWC_ETH_QOS_IMX) += dwc_eth_qos_imx.o
+obj-$(CONFIG_DWC_ETH_QOS_INTEL) += dwc_eth_qos_intel.o
 obj-$(CONFIG_DWC_ETH_QOS_ROCKCHIP) += dwc_eth_qos_rockchip.o
 obj-$(CONFIG_DWC_ETH_QOS_QCOM) += dwc_eth_qos_qcom.o
 obj-$(CONFIG_DWC_ETH_XGMAC) += dwc_eth_xgmac.o
drivers/net/dwc_eth_qos.c +12 -0
index b7aef751866..19f0e9eb5b4 100644
@@ -1408,6 +1408,18 @@ int eqos_get_base_addr_dt(struct udevice *dev)
 	return eqos_get_base_addr_common(dev, addr);
 }
 
+int eqos_get_base_addr_pci(struct udevice *dev)
+{
+	fdt_addr_t addr;
+	void *paddr;
+
+	paddr = dm_pci_map_bar(dev, PCI_BASE_ADDRESS_0, 0, 0, PCI_REGION_TYPE,
+							      PCI_REGION_MEM);
+	addr = paddr ? (fdt_addr_t)paddr : FDT_ADDR_T_NONE;
+
+	return eqos_get_base_addr_common(dev, addr);
+}
+
 static int eqos_probe(struct udevice *dev)
 {
 	struct eqos_priv *eqos = dev_get_priv(dev);
drivers/net/dwc_eth_qos.h +1 -0
index 1121d242ca6..0987bdd0b81 100644
@@ -289,6 +289,7 @@ void eqos_flush_desc_generic(void *desc);
 void eqos_inval_buffer_generic(void *buf, size_t size);
 void eqos_flush_buffer_generic(void *buf, size_t size);
 int eqos_get_base_addr_dt(struct udevice *dev);
+int eqos_get_base_addr_pci(struct udevice *dev);
 int eqos_null_ops(struct udevice *dev);
 void *eqos_get_driver_data(struct udevice *dev);
 
drivers/net/dwc_eth_qos_intel.c new file +449 -0

449 lines not on this page · raw message

drivers/net/dwc_eth_qos_intel.h new file +57 -0

57 lines not on this page · raw message

include/pci_ids.h +9 -0
index 6f095442cac..a6f99cb5987 100644
@@ -2601,6 +2601,15 @@
 #define PCI_DEVICE_ID_DCI_PCCOM2	0x0004
 
 #define PCI_VENDOR_ID_INTEL		0x8086
+#define PCI_DEVICE_ID_INTEL_EHL_RGMII1G       0x4b30
+#define PCI_DEVICE_ID_INTEL_EHL_SGMII1        0x4b31
+#define PCI_DEVICE_ID_INTEL_EHL_SGMII2G5      0x4b32
+#define PCI_DEVICE_ID_INTEL_EHL_PSE0_RGMII1G  0x4ba0
+#define PCI_DEVICE_ID_INTEL_EHL_PSE0_SGMII1G  0x4ba1
+#define PCI_DEVICE_ID_INTEL_EHL_PSE0_SGMII2G5 0x4ba2
+#define PCI_DEVICE_ID_INTEL_EHL_PSE1_RGMII1G  0x4bb0
+#define PCI_DEVICE_ID_INTEL_EHL_PSE1_SGMII1G  0x4bb1
+#define PCI_DEVICE_ID_INTEL_EHL_PSE1_SGMII2G5 0x4bb2
 #define PCI_DEVICE_ID_INTEL_EESSC	0x0008
 #define PCI_DEVICE_ID_INTEL_SNB_IMC	0x0100
 #define PCI_DEVICE_ID_INTEL_IVB_IMC	0x0154
Signature · 1 line
2.39.2
#6 lore raw
In reply to Philip Oberfichtner

Hi Ramon,

Any comments on this series?

Quoted 42 lines · Philip Oberfichtner

This patch series implements the dwc_eth_qos glue driver for Intel SOCs. Before doing that, a few general adaptions to the dwc_eth_qos.c main driver are required. Most notably, the preparation for PCI based driver instances, which do not necessarily use a device tree.

This patch series depends on: "net: dwc_eth_qos: mdio: Implement clause 45":
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

Changes in V3:
- Replace mfence() with mb()
- Clean-up eqos_get_base_addr()
- Several style fixes for dwc_eth_qos_intel

Philip Oberfichtner (5):
x86: provide mb() macro
net: dwc_eth_qos: Fix header to be self-contained
net: dwc_eth_qos: Adapt probe() for PCI devices
net: dwc_eth_qos: Implement bind() for PCI devices
net: dwc_eth_qos: Add glue driver for Intel MAC

 arch/x86/cpu/mp_init.c             |  10 +-
 arch/x86/include/asm/cpu.h         |   5 -
 arch/x86/include/asm/io.h          |   1 +
 drivers/net/Kconfig                |   7 +
 drivers/net/Makefile               |   1 +
 drivers/net/dwc_eth_qos.c          |  79 ++++-
 drivers/net/dwc_eth_qos.h          |   8 +-
 drivers/net/dwc_eth_qos_imx.c      |   6 +
 drivers/net/dwc_eth_qos_intel.c    | 449 +++++++++++++++++++++++++++++
 drivers/net/dwc_eth_qos_intel.h    |  57 ++++
 drivers/net/dwc_eth_qos_qcom.c     |   6 +
 drivers/net/dwc_eth_qos_rockchip.c |   6 +
 drivers/net/dwc_eth_qos_starfive.c |   6 +
 drivers/net/dwc_eth_qos_stm32.c    |   6 +
 include/pci_ids.h                  |   9 +
 15 files changed, 637 insertions(+), 19 deletions(-)
 create mode 100644 drivers/net/dwc_eth_qos_intel.c
 create mode 100644 drivers/net/dwc_eth_qos_intel.h
Signature · 1 line
2.39.2
Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,        Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-22  Fax: +49-8142-66989-80   Email: [email protected]
=====================================================================
#7 lore raw
In reply to Philip Oberfichtner
Quoted 5 lines · Philip Oberfichtner

This patch series implements the dwc_eth_qos glue driver for Intel SOCs. Before doing that, a few general adaptions to the dwc_eth_qos.c main driver are required. Most notably, the preparation for PCI based driver instances, which do not necessarily use a device tree.

Quoted 7 lines

This patch series depends on: "net: dwc_eth_qos: mdio: Implement clause 45":
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

Changes in V3:
- Replace mfence() with mb()
- Clean-up eqos_get_base_addr()
- Several style fixes for dwc_eth_qos_intel

This adds a failure to build on stm32mp15_dhcor_basic and all of the
other stm32mp15 platforms that use this driver:
+(stm32mp15_dhcor_basic) drivers/net/dwc_eth_qos.c: In function 'eqos_get_base_addr_common':
+(stm32mp15_dhcor_basic) drivers/net/dwc_eth_qos.c:1415:30: error: format '%llx' expects argument of type 'long long unsigned int', but argument 2 has type 'fdt_addr_t' {aka 'unsigned int'} [-Werror=format=]

+(stm32mp15_dhcor_basic)  1415 |                 dev_err(dev, "addr=0x%llx is invalid.\n", addr);
+(stm32mp15_dhcor_basic)       |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~  ~~~~
+(stm32mp15_dhcor_basic)       |                                                           |
+(stm32mp15_dhcor_basic)       |                                                           fdt_addr_t {aka unsigned int}

+(stm32mp15_dhcor_basic) include/dm/device_compat.h:51:24: note: in definition of macro 'dev_printk_emit'
+(stm32mp15_dhcor_basic) 51 | printf(fmt, ##__VA_ARGS__); \
+(stm32mp15_dhcor_basic) | ^~~
+(stm32mp15_dhcor_basic) include/dm/device_compat.h:110:9: note: in expansion of macro '__dev_printk'

+(stm32mp15_dhcor_basic)   110 |         __dev_printk(LOGL_ERR, dev, fmt, ##__VA_ARGS__)
+(stm32mp15_dhcor_basic)       |         ^~~~~~~~~~~~
+(stm32mp15_dhcor_basic) drivers/net/dwc_eth_qos.c:1415:17: note: in expansion of macro 'dev_err'
+(stm32mp15_dhcor_basic)       |                 ^~~~~~~
+(stm32mp15_dhcor_basic) drivers/net/dwc_eth_qos.c:1415:41: note: format string is defined here
+(stm32mp15_dhcor_basic)       |                                      ~~~^
+(stm32mp15_dhcor_basic)       |                                         |
+(stm32mp15_dhcor_basic)       |                                         long long unsigned int
+(stm32mp15_dhcor_basic)       |                                      %x
+(stm32mp15_dhcor_basic) In file included from include/linux/printk.h:4,
+(stm32mp15_dhcor_basic)                  from include/linux/kernel.h:5,
+(stm32mp15_dhcor_basic)                  from include/linux/libfdt_env.h:13,
+(stm32mp15_dhcor_basic)                  from include/linux/libfdt.h:6,
+(stm32mp15_dhcor_basic)                  from include/fdtdec.h:17,
+(stm32mp15_dhcor_basic)                  from include/dm/ofnode.h:11,
+(stm32mp15_dhcor_basic)                  from include/clk.h:11,
+(stm32mp15_dhcor_basic)                  from drivers/net/dwc_eth_qos.c:32:

+(stm32mp15_dhcor_basic) include/log.h:224:24: note: in definition of macro 'log'
+(stm32mp15_dhcor_basic) 224 | printf(_fmt, ##_args); \
+(stm32mp15_dhcor_basic) | ^~~~
+(stm32mp15_dhcor_basic) include/dm/device_compat.h:86:17: note: in expansion of macro 'dev_printk_emit'

+(stm32mp15_dhcor_basic)    86 |                 dev_printk_emit(LOG_CATEGORY, level, fmt, ##__VA_ARGS__); \
+(stm32mp15_dhcor_basic)       |                 ^~~~~~~~~~~~~~~
+(stm32mp15_dhcor_basic) include/dm/device_compat.h:55:24: note: in definition of macro 'dev_printk_emit'
+(stm32mp15_dhcor_basic)    55 |                 printf(fmt, ##__VA_ARGS__); \
+(stm32mp15_dhcor_basic) include/dm/device_compat.h:92:41: error: format '%llx' expects argument of type 'long long unsigned int', but argument 4 has type 'fdt_addr_t' {aka 'unsigned int'} [-Werror=format=]
+(stm32mp15_dhcor_basic)    92 |                                         "%s %s: " fmt, \
+(stm32mp15_dhcor_basic)       |                                         ^~~~~~~~~
+(stm32mp15_dhcor_basic) include/dm/device_compat.h:91:25: note: in expansion of macro 'dev_printk_emit'
+(stm32mp15_dhcor_basic)    91 |                         dev_printk_emit(__dev->driver->id, level, \
+(stm32mp15_dhcor_basic)       |                         ^~~~~~~~~~~~~~~

+(stm32mp15_dhcor_basic) include/dm/device_compat.h:97:41: error: format '%llx' expects argument of type 'long long unsigned int', but argument 4 has type 'fdt_addr_t' {aka 'unsigned int'} [-Werror=format=]
+(stm32mp15_dhcor_basic) 97 | "%s %s: " fmt, \
+(stm32mp15_dhcor_basic) include/dm/device_compat.h:96:25: note: in expansion of macro 'dev_printk_emit'
+(stm32mp15_dhcor_basic) 96 | dev_printk_emit(LOG_CATEGORY, level, \
+(stm32mp15_dhcor_basic) cc1: all warnings being treated as errors
+(stm32mp15_dhcor_basic) make[3]: *** [scripts/Makefile.build:256: drivers/net/dwc_eth_qos.o] Error 1
+(stm32mp15_dhcor_basic) make[2]: *** [scripts/Makefile.build:397: drivers/net] Error 2
+(stm32mp15_dhcor_basic) make[1]: *** [Makefile:1895: drivers] Error 2
+(stm32mp15_dhcor_basic) make: *** [Makefile:177: sub-make] Error 2

Signature · 1 line
Tom
#8 lore raw
Quoted 10 lines · Tom Rini
Quoted 8 lines · Philip Oberfichtner

This patch series implements the dwc_eth_qos glue driver for Intel SOCs. Before doing that, a few general adaptions to the dwc_eth_qos.c main driver are required. Most notably, the preparation for PCI based driver instances, which do not necessarily use a device tree.

This patch series depends on: "net: dwc_eth_qos: mdio: Implement clause 45":
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

Quoted 6 lines
Quoted 4 lines

Changes in V3:
- Replace mfence() with mb()
- Clean-up eqos_get_base_addr()
- Several style fixes for dwc_eth_qos_intel

This adds a failure to build on stm32mp15_dhcor_basic and all of the

Thanks for the feedback!

I added some #if CONFIG_IS_ENABLED(FDT_64BIT) to catch this case. It should be fine in V4 then.

Best regards,
Philip

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,        Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-22  Fax: +49-8142-66989-80   Email: [email protected]
=====================================================================