* [PATCH v1 1/4] net: rtl8169: Fix compile warning in rtl8169 network adapter
2023-06-21 9:05 [PATCH v1 0/4] Fix rtl8169 compile warning and add a new device ID Minda Chen
@ 2023-06-21 9:05 ` Minda Chen
2023-07-22 8:55 ` Ramon Fried
2023-06-21 9:05 ` [PATCH v1 2/4] net: rtl8169: Fix DMA min aligned compile warning in riscv Minda Chen
` (3 subsequent siblings)
4 siblings, 1 reply; 9+ messages in thread
From: Minda Chen @ 2023-06-21 9:05 UTC (permalink / raw)
To: Joe Hershberger, Ramon Fried, Leo, Rick Chen
Cc: u-boot, Mason Huo, Minda Chen
Fix make pointer from integer without a cast compile warning.
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* Re: [PATCH v1 1/4] net: rtl8169: Fix compile warning in rtl8169 network adapter
2023-06-21 9:05 ` [PATCH v1 1/4] net: rtl8169: Fix compile warning in rtl8169 network adapter Minda Chen
@ 2023-07-22 8:55 ` Ramon Fried
0 siblings, 0 replies; 9+ messages in thread
From: Ramon Fried @ 2023-07-22 8:55 UTC (permalink / raw)
To: Minda Chen; +Cc: Joe Hershberger, Leo, Rick Chen, u-boot, Mason Huo
On Wed, Jun 21, 2023 at 12:05 PM Minda Chen <minda.chen@starfivetech.com> wrote:
>
> Fix make pointer from integer without a cast compile warning.
>
> 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
>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v1 2/4] net: rtl8169: Fix DMA min aligned compile warning in riscv
2023-06-21 9:05 [PATCH v1 0/4] Fix rtl8169 compile warning and add a new device ID Minda Chen
2023-06-21 9:05 ` [PATCH v1 1/4] net: rtl8169: Fix compile warning in rtl8169 network adapter Minda Chen
@ 2023-06-21 9:05 ` Minda Chen
2023-07-22 8:56 ` Ramon Fried
2023-06-21 9:05 ` [PATCH v1 3/4] net: rtl8169: Add one more device ID Minda Chen
` (2 subsequent siblings)
4 siblings, 1 reply; 9+ messages in thread
From: Minda Chen @ 2023-06-21 9:05 UTC (permalink / raw)
To: Joe Hershberger, Ramon Fried, Leo, Rick Chen
Cc: u-boot, Mason Huo, Minda Chen
Fix rtl8169 descriptor less the DMA min aligned compile warning
for RISC-V SoC platform.
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* Re: [PATCH v1 2/4] net: rtl8169: Fix DMA min aligned compile warning in riscv
2023-06-21 9:05 ` [PATCH v1 2/4] net: rtl8169: Fix DMA min aligned compile warning in riscv Minda Chen
@ 2023-07-22 8:56 ` Ramon Fried
0 siblings, 0 replies; 9+ messages in thread
From: Ramon Fried @ 2023-07-22 8:56 UTC (permalink / raw)
To: Minda Chen; +Cc: Joe Hershberger, Leo, Rick Chen, u-boot, Mason Huo
On Wed, Jun 21, 2023 at 12:05 PM Minda Chen <minda.chen@starfivetech.com> wrote:
>
> Fix rtl8169 descriptor less the DMA min aligned compile warning
> for RISC-V SoC platform.
>
> 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
>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v1 3/4] net: rtl8169: Add one more device ID
2023-06-21 9:05 [PATCH v1 0/4] Fix rtl8169 compile warning and add a new device ID Minda Chen
2023-06-21 9:05 ` [PATCH v1 1/4] net: rtl8169: Fix compile warning in rtl8169 network adapter Minda Chen
2023-06-21 9:05 ` [PATCH v1 2/4] net: rtl8169: Fix DMA min aligned compile warning in riscv Minda Chen
@ 2023-06-21 9:05 ` Minda Chen
2023-07-22 8:56 ` Ramon Fried
2023-06-21 9:05 ` [PATCH v1 4/4] configs: starfive-jh7110: Add CONFIG_RTL8169 Minda Chen
2023-07-05 1:54 ` [PATCH v1 0/4] Fix rtl8169 compile warning and add a new device ID Minda Chen
4 siblings, 1 reply; 9+ messages in thread
From: Minda Chen @ 2023-06-21 9:05 UTC (permalink / raw)
To: Joe Hershberger, Ramon Fried, Leo, Rick Chen
Cc: u-boot, Mason Huo, Minda Chen
Add the NIC device ID and adjust the PCI bar regions.
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* Re: [PATCH v1 3/4] net: rtl8169: Add one more device ID
2023-06-21 9:05 ` [PATCH v1 3/4] net: rtl8169: Add one more device ID Minda Chen
@ 2023-07-22 8:56 ` Ramon Fried
0 siblings, 0 replies; 9+ messages in thread
From: Ramon Fried @ 2023-07-22 8:56 UTC (permalink / raw)
To: Minda Chen; +Cc: Joe Hershberger, Leo, Rick Chen, u-boot, Mason Huo
On Wed, Jun 21, 2023 at 12:05 PM Minda Chen <minda.chen@starfivetech.com> wrote:
>
> Add the NIC device ID and adjust the PCI bar regions.
>
> 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
>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v1 4/4] configs: starfive-jh7110: Add CONFIG_RTL8169
2023-06-21 9:05 [PATCH v1 0/4] Fix rtl8169 compile warning and add a new device ID Minda Chen
` (2 preceding siblings ...)
2023-06-21 9:05 ` [PATCH v1 3/4] net: rtl8169: Add one more device ID Minda Chen
@ 2023-06-21 9:05 ` Minda Chen
2023-07-05 1:54 ` [PATCH v1 0/4] Fix rtl8169 compile warning and add a new device ID Minda Chen
4 siblings, 0 replies; 9+ messages in thread
From: Minda Chen @ 2023-06-21 9:05 UTC (permalink / raw)
To: Joe Hershberger, Ramon Fried, Leo, Rick Chen
Cc: u-boot, Mason Huo, Minda Chen
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 ffbc4b9476..360160200f 100644
--- a/configs/starfive_visionfive2_defconfig
+++ b/configs/starfive_visionfive2_defconfig
@@ -66,6 +66,7 @@ CONFIG_SPI_FLASH_EON=y
CONFIG_SPI_FLASH_GIGADEVICE=y
CONFIG_SPI_FLASH_ISSI=y
CONFIG_SPI_FLASH_MACRONIX=y
+CONFIG_RTL8169=y
CONFIG_PINCTRL=y
CONFIG_PINCONF=y
CONFIG_SPL_PINCTRL=y
--
2.17.1
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [PATCH v1 0/4] Fix rtl8169 compile warning and add a new device ID
2023-06-21 9:05 [PATCH v1 0/4] Fix rtl8169 compile warning and add a new device ID Minda Chen
` (3 preceding siblings ...)
2023-06-21 9:05 ` [PATCH v1 4/4] configs: starfive-jh7110: Add CONFIG_RTL8169 Minda Chen
@ 2023-07-05 1:54 ` Minda Chen
4 siblings, 0 replies; 9+ messages in thread
From: Minda Chen @ 2023-07-05 1:54 UTC (permalink / raw)
To: Joe Hershberger, Ramon Fried, Leo, Rick Chen; +Cc: u-boot, Mason Huo
Hi Joe and Ramon
Sorry to disturb you. Could you please review this patchset. Thanks
On 2023/6/21 17:05, Minda Chen wrote:
> 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:
> https://patchwork.ozlabs.org/project/uboot/cover/20230509082617.119018-1-minda.chen@starfivetech.com/
>
> 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 network adapter
> net: rtl8169: Fix DMA min aligned compile warning in riscv
> net: rtl8169: Add one more device ID
> 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: 50842b217fef505a0ec6662cc2acdc55d0bb23c5
^ permalink raw reply [flat|nested] 9+ messages in thread