[U-Boot] [PATCH 1/2] drivers: net: pfe_eth: remove unused code under CONFIG_UTIL_PE_DISABLED

Calvin Johnson calvin.johnson at nxp.com
Wed Nov 22 06:45:13 UTC 2017


remove unused code under CONFIG_UTIL_PE_DISABLED

Signed-off-by: Calvin Johnson <calvin.johnson at nxp.com>
---

 drivers/net/pfe_eth/pfe.c          | 98 --------------------------------------
 drivers/net/pfe_eth/pfe_cmd.c      | 16 +------
 drivers/net/pfe_eth/pfe_driver.c   | 15 ------
 drivers/net/pfe_eth/pfe_firmware.c |  3 --
 include/pfe_eth/pfe/pfe.h          |  8 ----
 5 files changed, 2 insertions(+), 138 deletions(-)

diff --git a/drivers/net/pfe_eth/pfe.c b/drivers/net/pfe_eth/pfe.c
index fc6631e..d477192 100644
--- a/drivers/net/pfe_eth/pfe.c
+++ b/drivers/net/pfe_eth/pfe.c
@@ -89,13 +89,6 @@ void pfe_lib_init(void *ddr_base, unsigned long ddr_phys_base)
 	pe[TMU3_ID].mem_access_wdata = (void *)TMU_MEM_ACCESS_WDATA;
 	pe[TMU3_ID].mem_access_addr = (void *)TMU_MEM_ACCESS_ADDR;
 	pe[TMU3_ID].mem_access_rdata = (void *)TMU_MEM_ACCESS_RDATA;
-
-#if !defined(CONFIG_UTIL_PE_DISABLED)
-	pe[UTIL_ID].dmem_base_addr = (u32)UTIL_DMEM_BASE_ADDR;
-	pe[UTIL_ID].mem_access_wdata = (void *)UTIL_MEM_ACCESS_WDATA;
-	pe[UTIL_ID].mem_access_addr = (void *)UTIL_MEM_ACCESS_ADDR;
-	pe[UTIL_ID].mem_access_rdata = (void *)UTIL_MEM_ACCESS_RDATA;
-#endif
 }
 
 /*
@@ -387,60 +380,6 @@ void pe_lmem_write(u32 *src, u32 len, u32 offset)
 					0x03));
 }
 
-#if !defined(CONFIG_UTIL_PE_DISABLED)
-/*
- * Writes UTIL program memory (DDR) from the host.
- *
- * @param[in] addr	Address to write (virtual, must be aligned on size)
- * @param[in] val	Value to write (in PE endianness, i.e BE)
- * @param[in] size	Number of bytes to write (2 or 4)
- */
-static void util_pmem_write(u32 val, void *addr, u8 size)
-{
-	void *addr64 = (void *)((unsigned long)addr & ~0x7);
-	unsigned long off = 8 - ((unsigned long)addr & 0x7) - size;
-
-	/* IMEM should  be loaded as a 64bit swapped value in a 64bit aligned
-	 * location
-	 */
-	if (size == 4)
-		writel(be32_to_cpu(val), addr64 + off);
-	else
-		writew(be16_to_cpu((u16)val), addr64 + off);
-}
-
-/*
- * Writes a buffer to UTIL program memory (DDR) from the host.
- *
- * @param[in] dst	Address to write (virtual, must be at least 16bit
- *					aligned)
- * @param[in] src	Buffer to write (in PE endianness, i.e BE, must have
- *				same alignment as dst)
- * @param[in] len	Number of bytes to write (must be at least 16bit
- *						aligned)
- */
-static void util_pmem_memcpy(void *dst, const void *src, unsigned int len)
-{
-	unsigned int len32;
-	int i;
-
-	if ((unsigned long)src & 0x2) {
-		util_pmem_write(*(u16 *)src, dst, 2);
-		src += 2;
-		dst += 2;
-		len -= 2;
-	}
-
-	len32 = len >> 2;
-
-	for (i = 0; i < len32; i++, dst += 4, src += 4)
-		util_pmem_write(*(u32 *)src, dst, 4);
-
-	if (len & 0x2)
-		util_pmem_write(*(u16 *)src, dst, len & 0x2);
-}
-#endif
-
 /*
  * Loads an elf section into pmem
  * Code needs to be at least 16bit aligned and only PROGBITS sections are
@@ -458,13 +397,6 @@ static int pe_load_pmem_section(int id, const void *data, Elf32_Shdr *shdr)
 	u32 size = be32_to_cpu(shdr->sh_size);
 	u32 type = be32_to_cpu(shdr->sh_type);
 
-#if !defined(CONFIG_UTIL_PE_DISABLED)
-	if (id == UTIL_ID) {
-		printf("%s: unsupported pmem section for UTIL\n", __func__);
-		return -1;
-	}
-#endif
-
 	if (((unsigned long)(data + offset) & 0x3) != (addr & 0x3)) {
 		printf(
 			"%s: load address(%x) and elf file address(%lx) don't have the same alignment\n",
@@ -615,36 +547,6 @@ static int pe_load_ddr_section(int id, const void *data, Elf32_Shdr *shdr)
 				}
 			}
 
-#if !defined(CONFIG_UTIL_PE_DISABLED)
-			else if (id == UTIL_ID) {
-				if (((unsigned long)(data + offset) & 0x3)
-					!= (addr & 0x3)) {
-					printf(
-						"%s: load address(%x) and elf file address(%lx) don't have the same alignment\n",
-							__func__, addr,
-						(unsigned long)data + offset);
-
-					return -1;
-				}
-
-				if (addr & 0x1) {
-					printf(
-						"%s: load address(%x) is not 16bit aligned\n"
-						, __func__, addr);
-					return -1;
-				}
-
-				if (size & 0x1) {
-					printf(
-						"%s: load length(%x) is not 16bit aligned\n"
-						, __func__, size);
-					return -1;
-				}
-
-				util_pmem_memcpy((void *)DDR_PFE_TO_VIRT(addr),
-						 data + offset, size);
-			}
-#endif
 			else {
 				printf(
 					"%s: unsupported ddr section type(%x) for PE(%d)\n"
diff --git a/drivers/net/pfe_eth/pfe_cmd.c b/drivers/net/pfe_eth/pfe_cmd.c
index 74f7c3d..03a2690 100644
--- a/drivers/net/pfe_eth/pfe_cmd.c
+++ b/drivers/net/pfe_eth/pfe_cmd.c
@@ -292,14 +292,7 @@ static void pfe_pe_status(int argc, char * const argv[])
 		do_clear = 1;
 
 	for (id = CLASS0_ID; id < MAX_PE; id++) {
-#if !defined(CONFIG_UTIL_PE_DISABLED)
-		if (id == UTIL_ID) {
-			printf("util:\n");
-			dmem_addr = PESTATUS_ADDR_UTIL;
-		} else if (id >= TMU0_ID) {
-#else
 		if (id >= TMU0_ID) {
-#endif
 			if (id == TMU2_ID)
 				continue;
 			if (id == TMU0_ID)
@@ -330,13 +323,7 @@ static void pfe_pe_status(int argc, char * const argv[])
 		if (do_clear)
 			pe_dmem_write(id, 0, dmem_addr, 4);
 		dmem_addr += 4;
-#if !defined(CONFIG_UTIL_PE_DISABLED)
-		if (id == UTIL_ID) {
-			printf("state=%4s ctr=%08x rx=%x tx=%x\n",
-			       statebuf, cpu_to_be32(activity_counter),
-			       cpu_to_be32(rx), cpu_to_be32(tx));
-		} else
-#endif
+
 		if (id >= TMU0_ID) {
 			printf("%d: state=%4s ctr=%08x rx=%x qstatus=%x\n",
 			       id - TMU0_ID, statebuf,
@@ -350,6 +337,7 @@ static void pfe_pe_status(int argc, char * const argv[])
 			       cpu_to_be32(rx), cpu_to_be32(tx),
 			       cpu_to_be32(drop));
 		}
+
 #ifdef CONFIG_PFE_WARN_WA
 		debug_indicator = pe_dmem_read(id, dmem_addr, 4);
 		dmem_addr += 4;
diff --git a/drivers/net/pfe_eth/pfe_driver.c b/drivers/net/pfe_eth/pfe_driver.c
index 2bb257a..b97c7a3 100644
--- a/drivers/net/pfe_eth/pfe_driver.c
+++ b/drivers/net/pfe_eth/pfe_driver.c
@@ -475,17 +475,6 @@ static void pfe_bmu_init(struct pfe *pfe)
 	debug("bmu2 init: done\n");
 }
 
-#if !defined(CONFIG_UTIL_PE_DISABLED)
-/*
- * PFE/Util initialization function.
- */
-static void pfe_util_init(struct pfe *pfe)
-{
-	util_init();
-	printf("util init complete\n");
-}
-#endif
-
 /*
  * PFE/GPI initialization function.
  *  - egpi1, egpi2, egpi3, hgpi
@@ -571,10 +560,6 @@ static int pfe_hw_init(struct pfe *pfe)
 
 	pfe_bmu_init(pfe);
 
-#if !defined(CONFIG_UTIL_PE_DISABLED)
-	pfe_util_init(pfe);
-#endif
-
 	pfe_gpi_init(pfe);
 
 	pfe_hif_init(pfe);
diff --git a/drivers/net/pfe_eth/pfe_firmware.c b/drivers/net/pfe_eth/pfe_firmware.c
index 4fc1522..bd9309a 100644
--- a/drivers/net/pfe_eth/pfe_firmware.c
+++ b/drivers/net/pfe_eth/pfe_firmware.c
@@ -222,9 +222,6 @@ void pfe_firmware_exit(void)
 
 	class_disable();
 	tmu_disable(0xf);
-#if !defined(CONFIG_UTIL_PE_DISABLED)
-	util_disable();
-#endif
 	hif_tx_disable();
 	hif_rx_disable();
 }
diff --git a/include/pfe_eth/pfe/pfe.h b/include/pfe_eth/pfe/pfe.h
index 1c73a95..b45abe0 100644
--- a/include/pfe_eth/pfe/pfe.h
+++ b/include/pfe_eth/pfe/pfe.h
@@ -12,7 +12,6 @@
 #include "cbus.h"
 
 #define PFE_LS1012A_RESET_WA
-#define CONFIG_UTIL_PE_DISABLED
 
 #define CLASS_DMEM_BASE_ADDR(i)	(0x00000000 | ((i) << 20))
 /* Only valid for mem access register interface */
@@ -93,9 +92,6 @@ enum {
 	TMU1_ID,
 	TMU2_ID,
 	TMU3_ID,
-#if !defined(CONFIG_UTIL_PE_DISABLED)
-	UTIL_ID,
-#endif
 	MAX_PE
 };
 
@@ -107,10 +103,6 @@ enum {
 #define TMU_MASK	((1 << TMU0_ID) | (1 << TMU1_ID) | (1 << TMU3_ID))
 #define TMU_MAX_ID	TMU3_ID
 
-#if !defined(CONFIG_UTIL_PE_DISABLED)
-#define UTIL_MASK	(1 << UTIL_ID)
-#endif
-
 /*
  * PE information.
  * Structure containing PE's specific information. It is used to create
-- 
2.7.4



More information about the U-Boot mailing list