Fix rtl8169 compile warning and add a new device ID
cover Fix rtl8169 compile warning and add a new device ID
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/[email protected]/
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
Signature · 1 line
2.17.1
PATCH 1/4 net: rtl8169: Fix compile warning in rtl8169 network adapter
Fix make pointer from integer without a cast compile warning.
--- drivers/net/rtl8169.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/net/rtl8169.c +6 -6
@@ -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)
Signature · 1 line
2.17.1
Re: [PATCH v1 1/4] net: rtl8169: Fix compile warning in rtl8169 network adapter
Quoted 32 lines · Minda Chen
Fix make pointer from integer without a cast compile warning.
Signed-off-by Minda Chen <[email protected]>--- drivers/net/rtl8169.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)drivers/net/rtl8169.c +6
-7@@ -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) --
Quoted 2 lines
2.17.1
PATCH 2/4 net: rtl8169: Fix DMA min aligned compile warning in riscv
In reply to Minda ChenFix rtl8169 descriptor less the DMA min aligned compile warning for RISC-V SoC platform.
--- drivers/net/rtl8169.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/rtl8169.c +3 -1
@@ -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
Signature · 1 line
2.17.1
Re: [PATCH v1 2/4] net: rtl8169: Fix DMA min aligned compile warning in riscv
Quoted 28 lines · Minda Chen
Fix rtl8169 descriptor less the DMA min aligned compile warning for RISC-V SoC platform.
Signed-off-by Minda Chen <[email protected]>--- drivers/net/rtl8169.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/net/rtl8169.c +3
-2@@ -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 --
Quoted 2 lines
2.17.1
PATCH 3/4 net: rtl8169: Add one more device ID
In reply to Minda ChenAdd the NIC device ID and adjust the PCI bar regions.
--- drivers/net/rtl8169.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/rtl8169.c +4 -2
@@ -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 :
Signature · 1 line
2.17.1
Re: [PATCH v1 3/4] net: rtl8169: Add one more device ID
Quoted 37 lines · Minda Chen
Add the NIC device ID and adjust the PCI bar regions.
Signed-off-by Minda Chen <[email protected]>--- drivers/net/rtl8169.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/net/rtl8169.c +4
-3@@ -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 : --
Quoted 2 lines
2.17.1
PATCH 4/4 configs: starfive-jh7110: Add CONFIG_RTL8169
In reply to Minda ChenAdd PCIe device rtl8169 net adapter driver support.
--- configs/starfive_visionfive2_defconfig | 1 + 1 file changed, 1 insertion(+)
configs/starfive_visionfive2_defconfig +1 -0
@@ -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
Signature · 1 line
2.17.1
Hi Joe and Ramon
Sorry to disturb you. Could you please review this patchset. Thanks
Quoted 27 lines · Minda Chen
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/[email protected]/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: AddCONFIG_RTL8169configs/starfive_visionfive2_defconfig | 1 + drivers/net/rtl8169.c | 22 +++++++++++++--------- 2 files changed, 14 insertions(+), 9 deletions(-)base-commit:
50842b217fef505a0ec6662cc2acdc55d0bb23c5