Skip to contentSkip to conversation

get rid of immrbar_virt_to_phys()

PATCH In review Christophe Leroy 3 participants 7 messages Feb 7, 2017 – Feb 9, 2017

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

cover get rid of immrbar_virt_to_phys()

ucc_geth ethernet driver is the only driver using immrbar_virt_to_phys() and it uses it incorrectly.

This patch fixes ucc_geth driver then removes immrbar_virt_to_phys()

Christophe Leroy (2):
net: ethernet: ucc_geth: fix MEM_PART_MURAM mode soc/fsl/qe: get rid of immrbar_virt_to_phys()

 drivers/net/ethernet/freescale/ucc_geth.c |  8 +++-----
 drivers/soc/fsl/qe/qe.c                   |  2 --
 include/soc/fsl/qe/immap_qe.h             | 19 -------------------
 include/soc/fsl/qe/qe.h                   |  1 +
 4 files changed, 4 insertions(+), 26 deletions(-)
Signature · 1 line
2.10.1
#1 lore raw

PATCH 1/2 net: ethernet: ucc_geth: fix MEM_PART_MURAM mode

Since commit 5093bb965a163 ("powerpc/QE: switch to the cpm_muram implementation"), muram area is not part of immrbar mapping anymore so immrbar_virt_to_phys() is not usable anymore.

Fixes 5093bb965a163 ("powerpc/QE: switch to the cpm_muram implementation)
---
 drivers/net/ethernet/freescale/ucc_geth.c | 8 +++-----
 include/soc/fsl/qe/qe.h                   | 1 +
 2 files changed, 4 insertions(+), 5 deletions(-)
drivers/net/ethernet/freescale/ucc_geth.c +3 -5
index 3f7ae9f..f77ba9f 100644
@@ -2594,11 +2594,10 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
 		} else if (ugeth->ug_info->uf_info.bd_mem_part ==
 			   MEM_PART_MURAM) {
 			out_be32(&ugeth->p_send_q_mem_reg->sqqd[i].bd_ring_base,
-				 (u32) immrbar_virt_to_phys(ugeth->
-							    p_tx_bd_ring[i]));
+				 (u32)qe_muram_dma(ugeth->p_tx_bd_ring[i]));
 			out_be32(&ugeth->p_send_q_mem_reg->sqqd[i].
 				 last_bd_completed_address,
-				 (u32) immrbar_virt_to_phys(endOfRing));
+				 (u32)qe_muram_dma(endOfRing));
 		}
 	}
 
@@ -2844,8 +2843,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
 		} else if (ugeth->ug_info->uf_info.bd_mem_part ==
 			   MEM_PART_MURAM) {
 			out_be32(&ugeth->p_rx_bd_qs_tbl[i].externalbdbaseptr,
-				 (u32) immrbar_virt_to_phys(ugeth->
-							    p_rx_bd_ring[i]));
+				 (u32)qe_muram_dma(ugeth->p_rx_bd_ring[i]));
 		}
 		/* rest of fields handled by QE */
 	}
include/soc/fsl/qe/qe.h +1 -0
index 70339d7..0cd4c1147 100644
@@ -243,6 +243,7 @@ static inline int qe_alive_during_sleep(void)
 #define qe_muram_free cpm_muram_free
 #define qe_muram_addr cpm_muram_addr
 #define qe_muram_offset cpm_muram_offset
+#define qe_muram_dma cpm_muram_dma
 
 #define qe_setbits32(_addr, _v) iowrite32be(ioread32be(_addr) |  (_v), (_addr))
 #define qe_clrbits32(_addr, _v) iowrite32be(ioread32be(_addr) & ~(_v), (_addr))
Signature · 1 line
2.10.1
author Acked-by David S. Miller on v1 1/2
#2 lore raw

Re: [PATCH 1/2] net: ethernet: ucc_geth: fix MEM_PART_MURAM mode

Le 07/02/2017 ? 10:05, Christophe Leroy a ?crit :

Quoted 52 lines

Since commit 5093bb965a163 ("powerpc/QE: switch to the cpm_muram implementation"), muram area is not part of immrbar mapping anymore so immrbar_virt_to_phys() is not usable anymore.

Fixes 5093bb965a163 ("powerpc/QE: switch to the cpm_muram implementation)
---
 drivers/net/ethernet/freescale/ucc_geth.c | 8 +++-----
 include/soc/fsl/qe/qe.h                   | 1 +
 2 files changed, 4 insertions(+), 5 deletions(-)
drivers/net/ethernet/freescale/ucc_geth.c +3 -5
index 3f7ae9f..f77ba9f 100644
@@ -2594,11 +2594,10 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
 		} else if (ugeth->ug_info->uf_info.bd_mem_part ==
 			   MEM_PART_MURAM) {
 			out_be32(&ugeth->p_send_q_mem_reg->sqqd[i].bd_ring_base,
-				 (u32) immrbar_virt_to_phys(ugeth->
-							    p_tx_bd_ring[i]));
+				 (u32)qe_muram_dma(ugeth->p_tx_bd_ring[i]));
 			out_be32(&ugeth->p_send_q_mem_reg->sqqd[i].
 				 last_bd_completed_address,
-				 (u32) immrbar_virt_to_phys(endOfRing));
+				 (u32)qe_muram_dma(endOfRing));
 		}
 	}
 
@@ -2844,8 +2843,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
 		} else if (ugeth->ug_info->uf_info.bd_mem_part ==
 			   MEM_PART_MURAM) {
 			out_be32(&ugeth->p_rx_bd_qs_tbl[i].externalbdbaseptr,
-				 (u32) immrbar_virt_to_phys(ugeth->
-							    p_rx_bd_ring[i]));
+				 (u32)qe_muram_dma(ugeth->p_rx_bd_ring[i]));
 		}
 		/* rest of fields handled by QE */
 	}
include/soc/fsl/qe/qe.h +1 -0
index 70339d7..0cd4c1147 100644
@@ -243,6 +243,7 @@ static inline int qe_alive_during_sleep(void)
 #define qe_muram_free cpm_muram_free
 #define qe_muram_addr cpm_muram_addr
 #define qe_muram_offset cpm_muram_offset
+#define qe_muram_dma cpm_muram_dma
 
 #define qe_setbits32(_addr, _v) iowrite32be(ioread32be(_addr) |  (_v), (_addr))
 #define qe_clrbits32(_addr, _v) iowrite32be(ioread32be(_addr) & ~(_v), (_addr))
Acked-by on v1 1/2
#3 lore raw

Re: [PATCH 1/2] net: ethernet: ucc_geth: fix MEM_PART_MURAM mode

In reply to Christophe Leroy
Quoted 6 lines · Christophe Leroy

Since commit 5093bb965a163 ("powerpc/QE: switch to the cpm_muram implementation"), muram area is not part of immrbar mapping anymore so immrbar_virt_to_phys() is not usable anymore.

Fixes 5093bb965a163 ("powerpc/QE: switch to the cpm_muram implementation)

Regards,
Leo

#4 lore raw

PATCH 2/2 soc/fsl/qe: get rid of immrbar_virt_to_phys()

In reply to Christophe Leroy

immrbar_virt_to_phys() is not used anymore

---
 drivers/soc/fsl/qe/qe.c       |  4 +---
 include/soc/fsl/qe/immap_qe.h | 19 -------------------
 2 files changed, 1 insertion(+), 22 deletions(-)
drivers/soc/fsl/qe/qe.c +1 -3
index ade168f..d9c04f5 100644
@@ -66,7 +66,7 @@ static unsigned int qe_num_of_snum;
 
 static phys_addr_t qebase = -1;
 
-phys_addr_t get_qe_base(void)
+static phys_addr_t get_qe_base(void)
 {
 	struct device_node *qe;
 	int ret;
@@ -90,8 +90,6 @@ phys_addr_t get_qe_base(void)
 	return qebase;
 }
 
-EXPORT_SYMBOL(get_qe_base);
-
 void qe_reset(void)
 {
 	if (qe_immr == NULL)
include/soc/fsl/qe/immap_qe.h +0 -19
index c76ef30..7baaabd 100644
@@ -464,25 +464,6 @@ struct qe_immap {
 } __attribute__ ((packed));
 
 extern struct qe_immap __iomem *qe_immr;
-extern phys_addr_t get_qe_base(void);
-
-/*
- * Returns the offset within the QE address space of the given pointer.
- *
- * Note that the QE does not support 36-bit physical addresses, so if
- * get_qe_base() returns a number above 4GB, the caller will probably fail.
- */
-static inline phys_addr_t immrbar_virt_to_phys(void *address)
-{
-	void *q = (void *)qe_immr;
-
-	/* Is it a MURAM address? */
-	if ((address >= q) && (address < (q + QE_IMMAP_SIZE)))
-		return get_qe_base() + (address - q);
-
-	/* It's an address returned by kmalloc */
-	return virt_to_phys(address);
-}
 
 #endif /* __KERNEL__ */
 #endif /* _ASM_POWERPC_IMMAP_QE_H */
Signature · 1 line
2.10.1