* [PATCH 1/3] net: e1000: Remove unused bus_to_phys() macro
@ 2020-11-16 17:02 Stefan Roese
2020-11-16 17:02 ` [PATCH 2/3] net: e1000: Use virt_to_phys() instead of pci_virt_to_mem() Stefan Roese
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Stefan Roese @ 2020-11-16 17:02 UTC (permalink / raw)
To: u-boot
bus_to_phys() is defined but not referenced at all. This patch removes
it completely.
Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Aaron Williams <awilliams@marvell.com>
Cc: Chandrakala Chavva <cchavva@marvell.com>
---
drivers/net/e1000.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/net/e1000.c b/drivers/net/e1000.c
index 8e6c755f64..2c57786ec9 100644
--- a/drivers/net/e1000.c
+++ b/drivers/net/e1000.c
@@ -47,10 +47,8 @@ tested on both gig copper and gig fiber boards
#ifdef CONFIG_DM_ETH
#define virt_to_bus(devno, v) dm_pci_virt_to_mem(devno, (void *) (v))
-#define bus_to_phys(devno, a) dm_pci_mem_to_phys(devno, a)
#else
#define virt_to_bus(devno, v) pci_virt_to_mem(devno, (void *) (v))
-#define bus_to_phys(devno, a) pci_mem_to_phys(devno, a)
#endif
#define E1000_DEFAULT_PCI_PBA 0x00000030
--
2.29.2
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH 2/3] net: e1000: Use virt_to_phys() instead of pci_virt_to_mem() 2020-11-16 17:02 [PATCH 1/3] net: e1000: Remove unused bus_to_phys() macro Stefan Roese @ 2020-11-16 17:02 ` Stefan Roese 2021-01-27 19:21 ` Tom Rini 2020-11-16 17:02 ` [PATCH 3/3] net: e1000: Add missing address translations Stefan Roese 2021-01-27 19:21 ` [PATCH 1/3] net: e1000: Remove unused bus_to_phys() macro Tom Rini 2 siblings, 1 reply; 6+ messages in thread From: Stefan Roese @ 2020-11-16 17:02 UTC (permalink / raw) To: u-boot Using (dm_)pci_virt_to_mem() is incorrect to translate the virtual address in local DRAM to a physical address. The correct macro here is virt_to_phys() so switch to using this macro. As virt_to_bus() is now not used any more, this patch also removes both definitions (DM and non-DM). This issue was detected while testing the e1000 driver on the MIPS Octeon III platform, which needs address translation. Signed-off-by: Stefan Roese <sr@denx.de> Cc: Joe Hershberger <joe.hershberger@ni.com> Cc: Aaron Williams <awilliams@marvell.com> Cc: Chandrakala Chavva <cchavva@marvell.com> --- drivers/net/e1000.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/net/e1000.c b/drivers/net/e1000.c index 2c57786ec9..bf6cd7d602 100644 --- a/drivers/net/e1000.c +++ b/drivers/net/e1000.c @@ -45,12 +45,6 @@ tested on both gig copper and gig fiber boards #define TOUT_LOOP 100000 -#ifdef CONFIG_DM_ETH -#define virt_to_bus(devno, v) dm_pci_virt_to_mem(devno, (void *) (v)) -#else -#define virt_to_bus(devno, v) pci_virt_to_mem(devno, (void *) (v)) -#endif - #define E1000_DEFAULT_PCI_PBA 0x00000030 #define E1000_DEFAULT_PCIE_PBA 0x000a0026 @@ -5387,7 +5381,7 @@ static int _e1000_transmit(struct e1000_hw *hw, void *txpacket, int length) txp = tx_base + tx_tail; tx_tail = (tx_tail + 1) % 8; - txp->buffer_addr = cpu_to_le64(virt_to_bus(hw->pdev, nv_packet)); + txp->buffer_addr = cpu_to_le64(virt_to_phys(nv_packet)); txp->lower.data = cpu_to_le32(hw->txd_cmd | length); txp->upper.data = 0; -- 2.29.2 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/3] net: e1000: Use virt_to_phys() instead of pci_virt_to_mem() 2020-11-16 17:02 ` [PATCH 2/3] net: e1000: Use virt_to_phys() instead of pci_virt_to_mem() Stefan Roese @ 2021-01-27 19:21 ` Tom Rini 0 siblings, 0 replies; 6+ messages in thread From: Tom Rini @ 2021-01-27 19:21 UTC (permalink / raw) To: u-boot On Mon, Nov 16, 2020 at 06:02:29PM +0100, Stefan Roese wrote: > Using (dm_)pci_virt_to_mem() is incorrect to translate the virtual > address in local DRAM to a physical address. The correct macro here > is virt_to_phys() so switch to using this macro. > > As virt_to_bus() is now not used any more, this patch also removes > both definitions (DM and non-DM). > > This issue was detected while testing the e1000 driver on the MIPS > Octeon III platform, which needs address translation. > > Signed-off-by: Stefan Roese <sr@denx.de> > Cc: Joe Hershberger <joe.hershberger@ni.com> > Cc: Aaron Williams <awilliams@marvell.com> > Cc: Chandrakala Chavva <cchavva@marvell.com> Applied to u-boot/master, thanks! -- Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210127/9b77d515/attachment.sig> ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 3/3] net: e1000: Add missing address translations 2020-11-16 17:02 [PATCH 1/3] net: e1000: Remove unused bus_to_phys() macro Stefan Roese 2020-11-16 17:02 ` [PATCH 2/3] net: e1000: Use virt_to_phys() instead of pci_virt_to_mem() Stefan Roese @ 2020-11-16 17:02 ` Stefan Roese 2021-01-27 19:21 ` Tom Rini 2021-01-27 19:21 ` [PATCH 1/3] net: e1000: Remove unused bus_to_phys() macro Tom Rini 2 siblings, 1 reply; 6+ messages in thread From: Stefan Roese @ 2020-11-16 17:02 UTC (permalink / raw) To: u-boot Add some missing address translations from virtual address in local DRAM to physical address, which is needed for the DMA transactions to work correctly. This issue was detected while testing the e1000 driver on the MIPS Octeon III platform, which needs address translation. Signed-off-by: Stefan Roese <sr@denx.de> Cc: Joe Hershberger <joe.hershberger@ni.com> Cc: Aaron Williams <awilliams@marvell.com> Cc: Chandrakala Chavva <cchavva@marvell.com> --- drivers/net/e1000.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/e1000.c b/drivers/net/e1000.c index bf6cd7d602..cf57ff067b 100644 --- a/drivers/net/e1000.c +++ b/drivers/net/e1000.c @@ -5143,7 +5143,7 @@ fill_rx(struct e1000_hw *hw) rd = rx_base + rx_tail; rx_tail = (rx_tail + 1) % 8; memset(rd, 0, 16); - rd->buffer_addr = cpu_to_le64((unsigned long)packet); + rd->buffer_addr = cpu_to_le64(virt_to_phys(packet)); /* * Make sure there are no stale data in WB over this area, which @@ -5174,8 +5174,8 @@ e1000_configure_tx(struct e1000_hw *hw) unsigned long tipg, tarc; uint32_t ipgr1, ipgr2; - E1000_WRITE_REG(hw, TDBAL, lower_32_bits((unsigned long)tx_base)); - E1000_WRITE_REG(hw, TDBAH, upper_32_bits((unsigned long)tx_base)); + E1000_WRITE_REG(hw, TDBAL, lower_32_bits(virt_to_phys(tx_base))); + E1000_WRITE_REG(hw, TDBAH, upper_32_bits(virt_to_phys(tx_base))); E1000_WRITE_REG(hw, TDLEN, 128); @@ -5319,8 +5319,8 @@ e1000_configure_rx(struct e1000_hw *hw) E1000_WRITE_FLUSH(hw); } /* Setup the Base and Length of the Rx Descriptor Ring */ - E1000_WRITE_REG(hw, RDBAL, lower_32_bits((unsigned long)rx_base)); - E1000_WRITE_REG(hw, RDBAH, upper_32_bits((unsigned long)rx_base)); + E1000_WRITE_REG(hw, RDBAL, lower_32_bits(virt_to_phys(rx_base))); + E1000_WRITE_REG(hw, RDBAH, upper_32_bits(virt_to_phys(rx_base))); E1000_WRITE_REG(hw, RDLEN, 128); -- 2.29.2 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/3] net: e1000: Add missing address translations 2020-11-16 17:02 ` [PATCH 3/3] net: e1000: Add missing address translations Stefan Roese @ 2021-01-27 19:21 ` Tom Rini 0 siblings, 0 replies; 6+ messages in thread From: Tom Rini @ 2021-01-27 19:21 UTC (permalink / raw) To: u-boot On Mon, Nov 16, 2020 at 06:02:30PM +0100, Stefan Roese wrote: > Add some missing address translations from virtual address in local DRAM > to physical address, which is needed for the DMA transactions to work > correctly. > > This issue was detected while testing the e1000 driver on the MIPS > Octeon III platform, which needs address translation. > > Signed-off-by: Stefan Roese <sr@denx.de> > Cc: Joe Hershberger <joe.hershberger@ni.com> > Cc: Aaron Williams <awilliams@marvell.com> > Cc: Chandrakala Chavva <cchavva@marvell.com> Applied to u-boot/master, thanks! -- Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210127/da4a9264/attachment.sig> ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/3] net: e1000: Remove unused bus_to_phys() macro 2020-11-16 17:02 [PATCH 1/3] net: e1000: Remove unused bus_to_phys() macro Stefan Roese 2020-11-16 17:02 ` [PATCH 2/3] net: e1000: Use virt_to_phys() instead of pci_virt_to_mem() Stefan Roese 2020-11-16 17:02 ` [PATCH 3/3] net: e1000: Add missing address translations Stefan Roese @ 2021-01-27 19:21 ` Tom Rini 2 siblings, 0 replies; 6+ messages in thread From: Tom Rini @ 2021-01-27 19:21 UTC (permalink / raw) To: u-boot On Mon, Nov 16, 2020 at 06:02:28PM +0100, Stefan Roese wrote: > bus_to_phys() is defined but not referenced at all. This patch removes > it completely. > > Signed-off-by: Stefan Roese <sr@denx.de> > Cc: Joe Hershberger <joe.hershberger@ni.com> > Cc: Aaron Williams <awilliams@marvell.com> > Cc: Chandrakala Chavva <cchavva@marvell.com> Applied to u-boot/master, thanks! -- Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210127/b0981e3d/attachment.sig> ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-01-27 19:21 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2020-11-16 17:02 [PATCH 1/3] net: e1000: Remove unused bus_to_phys() macro Stefan Roese 2020-11-16 17:02 ` [PATCH 2/3] net: e1000: Use virt_to_phys() instead of pci_virt_to_mem() Stefan Roese 2021-01-27 19:21 ` Tom Rini 2020-11-16 17:02 ` [PATCH 3/3] net: e1000: Add missing address translations Stefan Roese 2021-01-27 19:21 ` Tom Rini 2021-01-27 19:21 ` [PATCH 1/3] net: e1000: Remove unused bus_to_phys() macro Tom Rini
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox