public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH v2 0/4] Fix rtl8169 compile warning and add a new device ID
@ 2023-07-20 11:37 Minda Chen
  2023-07-20 11:37 ` [PATCH v2 1/4] net: rtl8169: Fix compile warning in rtl8169 Minda Chen
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Minda Chen @ 2023-07-20 11:37 UTC (permalink / raw)
  To: Joe Hershberger, Ramon Fried, Leo, Rick Chen; +Cc: u-boot, Mason Huo

StarFive JH7110 uboot support PCIe and using rtl8169 network adapter
PCIe device. But compile warning in rtl8169 driver cause CI test fail.
So commit this patch set to fix it, Also a new device ID to adjust the
PCI bar regions in rtl8169.

The StarFive JH7110 PCIe driver link, patch 4 rely on this.
https://patchwork.ozlabs.org/project/uboot/cover/20230720112333.9255-1-minda.chen@starfivetech.com/

previous version:
[1] https://patchwork.ozlabs.org/project/uboot/cover/20230621090540.119313-1-minda.chen@starfivetech.com/

change:
v2: patch 1- 3 modify the commit messages.
    rebase to latest mainline codes.

patch 1 is fix make pointer from integer warning.
 eg: /home/minda/vf2/visionfive/u-boot/drivers/net/rtl8169.c:103:52: warning:
    passing argument 2 of ‘writew’ makes pointer from integer without a cast [-Wint-conversion]
patch 2 fix RISC-V 8169 descriptor less than DMA min aligned size warning
patch 3 add new device ID
patch 4 enable 8169 in JH7110 SoC configs file.

Minda Chen (4):
  net: rtl8169: Fix compile warning in rtl8169
  net: rtl8169: Fix DMA minimal aligned compile warning in RISC-V
  net: rtl8169: Add one device ID 0x8161
  configs: starfive-jh7110: Add CONFIG_RTL8169

 configs/starfive_visionfive2_defconfig |  1 +
 drivers/net/rtl8169.c                  | 22 +++++++++++++---------
 2 files changed, 14 insertions(+), 9 deletions(-)


base-commit: e6e67bb9e0a40f3eb3c87d16935192821987c3e0
-- 
2.17.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2 1/4] net: rtl8169: Fix compile warning in rtl8169
  2023-07-20 11:37 [PATCH v2 0/4] Fix rtl8169 compile warning and add a new device ID Minda Chen
@ 2023-07-20 11:37 ` Minda Chen
  2023-07-24  2:05   ` Leo Liang
  2023-07-20 11:37 ` [PATCH v2 2/4] net: rtl8169: Fix DMA minimal aligned compile warning in RISC-V Minda Chen
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 9+ messages in thread
From: Minda Chen @ 2023-07-20 11:37 UTC (permalink / raw)
  To: Joe Hershberger, Ramon Fried, Leo, Rick Chen; +Cc: u-boot, Mason Huo

While compiling rtl8169.c, There are many "make pointer from
integer without a cast" compile warnings. fix them with
adding cast.

Signed-off-by: Minda Chen <minda.chen@starfivetech.com>
---
 drivers/net/rtl8169.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/net/rtl8169.c b/drivers/net/rtl8169.c
index 2276a465e7..dcba51590d 100644
--- a/drivers/net/rtl8169.c
+++ b/drivers/net/rtl8169.c
@@ -96,12 +96,12 @@ static int media[MAX_UNITS] = { -1, -1, -1, -1, -1, -1, -1, -1 };
 #define TX_TIMEOUT  (6*HZ)
 
 /* write/read MMIO register. Notice: {read,write}[wl] do the necessary swapping */
-#define RTL_W8(reg, val8)	writeb((val8), ioaddr + (reg))
-#define RTL_W16(reg, val16)	writew((val16), ioaddr + (reg))
-#define RTL_W32(reg, val32)	writel((val32), ioaddr + (reg))
-#define RTL_R8(reg)		readb(ioaddr + (reg))
-#define RTL_R16(reg)		readw(ioaddr + (reg))
-#define RTL_R32(reg)		readl(ioaddr + (reg))
+#define RTL_W8(reg, val8)	writeb((val8), (void *)(ioaddr + (reg)))
+#define RTL_W16(reg, val16)	writew((val16), (void *)(ioaddr + (reg)))
+#define RTL_W32(reg, val32)	writel((val32), (void *)(ioaddr + (reg)))
+#define RTL_R8(reg)		readb((void *)(ioaddr + (reg)))
+#define RTL_R16(reg)		readw((void *)(ioaddr + (reg)))
+#define RTL_R32(reg)		readl((void *)(ioaddr + (reg)))
 
 #define bus_to_phys(a)	pci_mem_to_phys((pci_dev_t)(unsigned long)dev->priv, \
 	(pci_addr_t)(unsigned long)a)
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 2/4] net: rtl8169: Fix DMA minimal aligned compile warning in RISC-V
  2023-07-20 11:37 [PATCH v2 0/4] Fix rtl8169 compile warning and add a new device ID Minda Chen
  2023-07-20 11:37 ` [PATCH v2 1/4] net: rtl8169: Fix compile warning in rtl8169 Minda Chen
@ 2023-07-20 11:37 ` Minda Chen
  2023-07-24  2:06   ` Leo Liang
  2023-07-20 11:37 ` [PATCH v2 3/4] net: rtl8169: Add one device ID 0x8161 Minda Chen
  2023-07-20 11:37 ` [PATCH v2 4/4] configs: starfive-jh7110: Add CONFIG_RTL8169 Minda Chen
  3 siblings, 1 reply; 9+ messages in thread
From: Minda Chen @ 2023-07-20 11:37 UTC (permalink / raw)
  To: Joe Hershberger, Ramon Fried, Leo, Rick Chen; +Cc: u-boot, Mason Huo

For RISC-V architeture, hardware maintain the dcache coherency.
Software do not flush the cache. So even cache-line size larger
than descriptor size, driver can work.

Signed-off-by: Minda Chen <minda.chen@starfivetech.com>
---
 drivers/net/rtl8169.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/rtl8169.c b/drivers/net/rtl8169.c
index dcba51590d..34e4cff1e9 100644
--- a/drivers/net/rtl8169.c
+++ b/drivers/net/rtl8169.c
@@ -311,10 +311,12 @@ static unsigned char rxdata[RX_BUF_LEN];
  *
  * This can be fixed by defining CONFIG_SYS_NONCACHED_MEMORY which will cause
  * the driver to allocate descriptors from a pool of non-cached memory.
+ *
+ * Hardware maintain D-cache coherency in RISC-V architecture.
  */
 #if RTL8169_DESC_SIZE < ARCH_DMA_MINALIGN
 #if !defined(CONFIG_SYS_NONCACHED_MEMORY) && \
-	!CONFIG_IS_ENABLED(SYS_DCACHE_OFF) && !defined(CONFIG_X86)
+	!CONFIG_IS_ENABLED(SYS_DCACHE_OFF) && !defined(CONFIG_X86) && !defined(CONFIG_RISCV)
 #warning cache-line size is larger than descriptor size
 #endif
 #endif
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 3/4] net: rtl8169: Add one device ID 0x8161
  2023-07-20 11:37 [PATCH v2 0/4] Fix rtl8169 compile warning and add a new device ID Minda Chen
  2023-07-20 11:37 ` [PATCH v2 1/4] net: rtl8169: Fix compile warning in rtl8169 Minda Chen
  2023-07-20 11:37 ` [PATCH v2 2/4] net: rtl8169: Fix DMA minimal aligned compile warning in RISC-V Minda Chen
@ 2023-07-20 11:37 ` Minda Chen
  2023-07-24  2:07   ` Leo Liang
  2023-07-20 11:37 ` [PATCH v2 4/4] configs: starfive-jh7110: Add CONFIG_RTL8169 Minda Chen
  3 siblings, 1 reply; 9+ messages in thread
From: Minda Chen @ 2023-07-20 11:37 UTC (permalink / raw)
  To: Joe Hershberger, Ramon Fried, Leo, Rick Chen; +Cc: u-boot, Mason Huo

Add rtl8169 NIC device ID and reorder the device ID.

Signed-off-by: Minda Chen <minda.chen@starfivetech.com>
---
 drivers/net/rtl8169.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/rtl8169.c b/drivers/net/rtl8169.c
index 34e4cff1e9..963702777c 100644
--- a/drivers/net/rtl8169.c
+++ b/drivers/net/rtl8169.c
@@ -353,10 +353,11 @@ static const unsigned int rtl8169_rx_config =
     (RX_FIFO_THRESH << RxCfgFIFOShift) | (RX_DMA_BURST << RxCfgDMAShift);
 
 static struct pci_device_id supported[] = {
+	{ PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8125) },
+	{ PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8161) },
 	{ PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8167) },
 	{ PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8168) },
 	{ PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8169) },
-	{ PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8125) },
 	{}
 };
 
@@ -1051,8 +1052,9 @@ static int rtl8169_eth_probe(struct udevice *dev)
 	int ret;
 
 	switch (pplat->device) {
-	case 0x8168:
 	case 0x8125:
+	case 0x8161:
+	case 0x8168:
 		region = 2;
 		break;
 	default:
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 4/4] configs: starfive-jh7110: Add CONFIG_RTL8169
  2023-07-20 11:37 [PATCH v2 0/4] Fix rtl8169 compile warning and add a new device ID Minda Chen
                   ` (2 preceding siblings ...)
  2023-07-20 11:37 ` [PATCH v2 3/4] net: rtl8169: Add one device ID 0x8161 Minda Chen
@ 2023-07-20 11:37 ` Minda Chen
  2023-07-24  1:41   ` Leo Liang
  3 siblings, 1 reply; 9+ messages in thread
From: Minda Chen @ 2023-07-20 11:37 UTC (permalink / raw)
  To: Joe Hershberger, Ramon Fried, Leo, Rick Chen; +Cc: u-boot, Mason Huo

Add PCIe device rtl8169 net adapter driver support.

Signed-off-by: Minda Chen <minda.chen@starfivetech.com>
---
 configs/starfive_visionfive2_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/starfive_visionfive2_defconfig b/configs/starfive_visionfive2_defconfig
index 59e39c6f9b..7fc1569b59 100644
--- a/configs/starfive_visionfive2_defconfig
+++ b/configs/starfive_visionfive2_defconfig
@@ -95,6 +95,7 @@ CONFIG_DWC_ETH_QOS=y
 CONFIG_DWC_ETH_QOS_STARFIVE=y
 CONFIG_RGMII=y
 CONFIG_RMII=y
+CONFIG_RTL8169=y
 CONFIG_NVME_PCI=y
 CONFIG_DM_PCI_COMPAT=y
 # CONFIG_PCI_PNP is not set
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 4/4] configs: starfive-jh7110: Add CONFIG_RTL8169
  2023-07-20 11:37 ` [PATCH v2 4/4] configs: starfive-jh7110: Add CONFIG_RTL8169 Minda Chen
@ 2023-07-24  1:41   ` Leo Liang
  0 siblings, 0 replies; 9+ messages in thread
From: Leo Liang @ 2023-07-24  1:41 UTC (permalink / raw)
  To: Minda Chen; +Cc: Joe Hershberger, Ramon Fried, Rick Chen, u-boot, Mason Huo

On Thu, Jul 20, 2023 at 07:37:29PM +0800, Minda Chen wrote:
> Add PCIe device rtl8169 net adapter driver support.
> 
> Signed-off-by: Minda Chen <minda.chen@starfivetech.com>
> ---
>  configs/starfive_visionfive2_defconfig | 1 +
>  1 file changed, 1 insertion(+)

Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 1/4] net: rtl8169: Fix compile warning in rtl8169
  2023-07-20 11:37 ` [PATCH v2 1/4] net: rtl8169: Fix compile warning in rtl8169 Minda Chen
@ 2023-07-24  2:05   ` Leo Liang
  0 siblings, 0 replies; 9+ messages in thread
From: Leo Liang @ 2023-07-24  2:05 UTC (permalink / raw)
  To: Minda Chen; +Cc: Joe Hershberger, Ramon Fried, Rick Chen, u-boot, Mason Huo

On Thu, Jul 20, 2023 at 07:37:26PM +0800, Minda Chen wrote:
> While compiling rtl8169.c, There are many "make pointer from
> integer without a cast" compile warnings. fix them with
> adding cast.
> 
> Signed-off-by: Minda Chen <minda.chen@starfivetech.com>
> ---
>  drivers/net/rtl8169.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)

Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 2/4] net: rtl8169: Fix DMA minimal aligned compile warning in RISC-V
  2023-07-20 11:37 ` [PATCH v2 2/4] net: rtl8169: Fix DMA minimal aligned compile warning in RISC-V Minda Chen
@ 2023-07-24  2:06   ` Leo Liang
  0 siblings, 0 replies; 9+ messages in thread
From: Leo Liang @ 2023-07-24  2:06 UTC (permalink / raw)
  To: Minda Chen; +Cc: Joe Hershberger, Ramon Fried, Rick Chen, u-boot, Mason Huo

On Thu, Jul 20, 2023 at 07:37:27PM +0800, Minda Chen wrote:
> For RISC-V architeture, hardware maintain the dcache coherency.
> Software do not flush the cache. So even cache-line size larger
> than descriptor size, driver can work.
> 
> Signed-off-by: Minda Chen <minda.chen@starfivetech.com>
> ---
>  drivers/net/rtl8169.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 3/4] net: rtl8169: Add one device ID 0x8161
  2023-07-20 11:37 ` [PATCH v2 3/4] net: rtl8169: Add one device ID 0x8161 Minda Chen
@ 2023-07-24  2:07   ` Leo Liang
  0 siblings, 0 replies; 9+ messages in thread
From: Leo Liang @ 2023-07-24  2:07 UTC (permalink / raw)
  To: Minda Chen; +Cc: Joe Hershberger, Ramon Fried, Rick Chen, u-boot, Mason Huo

On Thu, Jul 20, 2023 at 07:37:28PM +0800, Minda Chen wrote:
> Add rtl8169 NIC device ID and reorder the device ID.
> 
> Signed-off-by: Minda Chen <minda.chen@starfivetech.com>
> ---
>  drivers/net/rtl8169.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)

Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-07-24  2:08 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-20 11:37 [PATCH v2 0/4] Fix rtl8169 compile warning and add a new device ID Minda Chen
2023-07-20 11:37 ` [PATCH v2 1/4] net: rtl8169: Fix compile warning in rtl8169 Minda Chen
2023-07-24  2:05   ` Leo Liang
2023-07-20 11:37 ` [PATCH v2 2/4] net: rtl8169: Fix DMA minimal aligned compile warning in RISC-V Minda Chen
2023-07-24  2:06   ` Leo Liang
2023-07-20 11:37 ` [PATCH v2 3/4] net: rtl8169: Add one device ID 0x8161 Minda Chen
2023-07-24  2:07   ` Leo Liang
2023-07-20 11:37 ` [PATCH v2 4/4] configs: starfive-jh7110: Add CONFIG_RTL8169 Minda Chen
2023-07-24  1:41   ` Leo Liang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox