Skip to contentSkip to conversation

LS1012A PFE driver patch series

PATCH Superseded Calvin Johnson 4 participants 38 messages Feb 15, 2018 – Mar 1, 2018

Subsystems (3)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v2 cover LS1012A PFE driver patch series

Hi,

This patch series introduces U-Boot support for NXP's LS1012A Packet Forwarding Engine (pfe_eth). LS1012A uses hardware packet forwarding engine to provide high performance Ethernet interfaces. The device includes two Ethernet ports.

Changes in v2 series:
1. PFE patches submitted on top of this base patch are now merged to this patch.
2. Platform changes are segregated into different patches.
3. Network enabled on 2g5rdb platform
4. Moved from legacy to new driver model.

Calvin Johnson (12):
drivers: net: phy: Fix aquantia compilation with DM
drivers: net: pfe_eth: LS1012A PFE driver introduction
drivers: net: pfe_eth: provide pfe commands
drivers: net: pfe_eth: LS1012A PFE headers
board: freescale: ls1012aqds: enable network support on ls1012aqds
board: freescale: ls1012afrdm: enable network support on ls1012afrdm
board: freescale: ls1012ardb: enable network support on ls1012ardb
board: freescale: ls1012a2g5rdb: enable network support on

    ls1012a2g5rdb

armv8: fsl-lsch2: add pfe macros and update ccsr_scfg structure
armv8: fsl-lsch2: configure pfe's DDR and HDBUS interfaces and ECC
armv8: layerscape: csu: enable ns access to PFE registers
configs: ls1012a: add pfe configuration for LS1012A

Prabhakar Kushwaha (1):
armv8: fsl-layerscape: Add support of GPIO structure

 arch/arm/cpu/armv8/fsl-layerscape/soc.c            |  23 +
 .../include/asm/arch-fsl-layerscape/immap_lsch2.h  |  63 +-
 .../include/asm/arch-fsl-layerscape/ns_access.h    |   2 +
 arch/arm/include/asm/arch-fsl-layerscape/soc.h     |   3 +
 board/freescale/ls1012afrdm/Kconfig                |  14 +
 board/freescale/ls1012afrdm/Makefile               |   1 +
 board/freescale/ls1012afrdm/eth.c                  | 122 +++
 board/freescale/ls1012afrdm/ls1012afrdm.c          |   5 -
 board/freescale/ls1012aqds/Kconfig                 |  14 +
 board/freescale/ls1012aqds/Makefile                |   1 +
 board/freescale/ls1012aqds/eth.c                   | 304 +++++++
 board/freescale/ls1012aqds/ls1012aqds.c            |  97 +-
 board/freescale/ls1012aqds/ls1012aqds_pfe.h        |  48 +
 board/freescale/ls1012aqds/ls1012aqds_qixis.h      |   2 +-
 board/freescale/ls1012ardb/Kconfig                 |  28 +
 board/freescale/ls1012ardb/Makefile                |   1 +
 board/freescale/ls1012ardb/eth.c                   | 131 +++
 board/freescale/ls1012ardb/ls1012ardb.c            |   4 -
 configs/ls1012a2g5rdb_qspi_defconfig               |   2 +
 configs/ls1012afrdm_qspi_defconfig                 |   2 +
 configs/ls1012aqds_qspi_defconfig                  |   2 +
 configs/ls1012ardb_qspi_defconfig                  |   2 +
 drivers/net/Kconfig                                |   1 +
 drivers/net/Makefile                               |   1 +
 drivers/net/pfe_eth/Kconfig                        |  17 +
 drivers/net/pfe_eth/Makefile                       |  12 +
 drivers/net/pfe_eth/pfe_cmd.c                      | 497 ++++++++++
 drivers/net/pfe_eth/pfe_driver.c                   | 643 +++++++++++++
 drivers/net/pfe_eth/pfe_eth.c                      | 297 ++++++
 drivers/net/pfe_eth/pfe_firmware.c                 | 230 +++++
 drivers/net/pfe_eth/pfe_hw.c                       | 999 +++++++++++++++++++++
 drivers/net/pfe_eth/pfe_mdio.c                     | 291 ++++++
 drivers/net/phy/aquantia.c                         |   1 +
 include/configs/ls1012a2g5rdb.h                    |   2 +-
 include/configs/ls1012a_common.h                   |   6 +-
 include/configs/ls1012afrdm.h                      |   9 +-
 include/configs/ls1012aqds.h                       |  14 +
 include/configs/ls1012ardb.h                       |  14 +-
 include/dm/platform_data/pfe_dm_eth.h              |  21 +
 include/pfe_eth/pfe/cbus.h                         |  77 ++
 include/pfe_eth/pfe/cbus/bmu.h                     |  40 +
 include/pfe_eth/pfe/cbus/class_csr.h               | 180 ++++
 include/pfe_eth/pfe/cbus/emac.h                    | 140 +++
 include/pfe_eth/pfe/cbus/gpi.h                     |  62 ++
 include/pfe_eth/pfe/cbus/hif.h                     |  68 ++
 include/pfe_eth/pfe/cbus/hif_nocpy.h               |  40 +
 include/pfe_eth/pfe/cbus/tmu_csr.h                 | 148 +++
 include/pfe_eth/pfe/cbus/util_csr.h                |  47 +
 include/pfe_eth/pfe/pfe_hw.h                       | 163 ++++
 include/pfe_eth/pfe_driver.h                       |  59 ++
 include/pfe_eth/pfe_eth.h                          | 104 +++
 include/pfe_eth/pfe_firmware.h                     |  17 +
 include/pfe_eth/pfe_mdio.h                         |  13 +
 53 files changed, 5060 insertions(+), 24 deletions(-)
 create mode 100644 board/freescale/ls1012afrdm/eth.c
 create mode 100644 board/freescale/ls1012aqds/eth.c
 create mode 100644 board/freescale/ls1012aqds/ls1012aqds_pfe.h
 create mode 100644 board/freescale/ls1012ardb/eth.c
 create mode 100644 drivers/net/pfe_eth/Kconfig
 create mode 100644 drivers/net/pfe_eth/Makefile
 create mode 100644 drivers/net/pfe_eth/pfe_cmd.c
 create mode 100644 drivers/net/pfe_eth/pfe_driver.c
 create mode 100644 drivers/net/pfe_eth/pfe_eth.c
 create mode 100644 drivers/net/pfe_eth/pfe_firmware.c
 create mode 100644 drivers/net/pfe_eth/pfe_hw.c
 create mode 100644 drivers/net/pfe_eth/pfe_mdio.c
 create mode 100644 include/dm/platform_data/pfe_dm_eth.h
 create mode 100644 include/pfe_eth/pfe/cbus.h
 create mode 100644 include/pfe_eth/pfe/cbus/bmu.h
 create mode 100644 include/pfe_eth/pfe/cbus/class_csr.h
 create mode 100644 include/pfe_eth/pfe/cbus/emac.h
 create mode 100644 include/pfe_eth/pfe/cbus/gpi.h
 create mode 100644 include/pfe_eth/pfe/cbus/hif.h
 create mode 100644 include/pfe_eth/pfe/cbus/hif_nocpy.h
 create mode 100644 include/pfe_eth/pfe/cbus/tmu_csr.h
 create mode 100644 include/pfe_eth/pfe/cbus/util_csr.h
 create mode 100644 include/pfe_eth/pfe/pfe_hw.h
 create mode 100644 include/pfe_eth/pfe_driver.h
 create mode 100644 include/pfe_eth/pfe_eth.h
 create mode 100644 include/pfe_eth/pfe_firmware.h
 create mode 100644 include/pfe_eth/pfe_mdio.h
Signature · 1 line
2.7.4
#1 lore raw

PATCH v2 1/13 drivers: net: phy: Fix aquantia compilation with DM

With CONFIG_DM_ETH enabled, aquantia driver compilation fails with below error. This patch fixes the issue by including dm.h.

drivers/net/phy/aquantia.c: In function ‘aquantia_startup’:
drivers/net/phy/aquantia.c:73:21: error: dereferencing pointer to incomplete
type ‘struct udevice’

          phydev->dev->name);
		     ^~

---
Changes in v2: None

---
 drivers/net/phy/aquantia.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/phy/aquantia.c +1 -0
index ad12f6d..6678147 100644
@@ -7,6 +7,7 @@
  */
 #include <config.h>
 #include <common.h>
+#include <dm.h>
 #include <phy.h>
 
 #ifndef CONFIG_PHYLIB_10G
Signature · 1 line
2.7.4
#2 lore raw

PATCH v2 1/13 drivers: net: phy: Fix aquantia compilation with DM

Quoted 11 lines · Calvin Johnson

With CONFIG_DM_ETH enabled, aquantia driver compilation fails with below error. This patch fixes the issue by including dm.h.

drivers/net/phy/aquantia.c: In function ‘aquantia_startup’:
drivers/net/phy/aquantia.c:73:21: error: dereferencing pointer to incomplete
type ‘struct udevice’

          phydev->dev->name);
                     ^~
#3 lore raw

PATCH v2 2/13 armv8: fsl-layerscape: Add support of GPIO structure

In reply to Calvin Johnson

From: Prabhakar Kushwaha <[email protected]>

Layerscape Gen2 SoC supports GPIO registers to control GPIO signals. Adding support of GPIO structure to access GPIO registers.

---
Changes in v2: None

---
 arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h +15 -0
index 1ff5cac..b195005 100644
@@ -82,6 +82,11 @@
 #define QSPI0_BASE_ADDR				(CONFIG_SYS_IMMR + 0x00550000)
 #define DSPI1_BASE_ADDR				(CONFIG_SYS_IMMR + 0x01100000)
 
+#define GPIO1_BASE_ADDR				(CONFIG_SYS_IMMR + 0x1300000)
+#define GPIO2_BASE_ADDR				(CONFIG_SYS_IMMR + 0x1310000)
+#define GPIO3_BASE_ADDR				(CONFIG_SYS_IMMR + 0x1320000)
+#define GPIO4_BASE_ADDR				(CONFIG_SYS_IMMR + 0x1330000)
+
 #define LPUART_BASE				(CONFIG_SYS_IMMR + 0x01950000)
 
 #define AHCI_BASE_ADDR				(CONFIG_SYS_IMMR + 0x02200000)
@@ -591,6 +596,16 @@ struct ccsr_serdes {
 	u8	res_19a0[0x2000-0x19a0];	/* from 0x19a0 to 0x1fff */
 };
 
+struct ccsr_gpio {
+	u32	gpdir;
+	u32	gpodr;
+	u32	gpdat;
+	u32	gpier;
+	u32	gpimr;
+	u32	gpicr;
+	u32	gpibe;
+};
+
 /* MMU 500 */
 #define SMMU_SCR0			(SMMU_BASE + 0x0)
 #define SMMU_SCR1			(SMMU_BASE + 0x4)
Signature · 1 line
2.7.4
#5 lore raw

PATCH v2 3/13 drivers: net: pfe_eth: LS1012A PFE driver introduction

In reply to Calvin Johnson

This patch adds PFE driver to U-Boot

Following are the main driver files:-
pfe_hw.c: provides low level helper functions to initialize PFE internal processor engines and other hardware blocks pfe_driver.c: provides initialization functions
and packet send and receive functions
pfe_eth.c: provides high level gemac initialization functions pfe_firmware.c: provides functions to load firmware into PFE internal processor engines.
pfe_mdio.c: provides functions to initialize phy and mdio.

---
Changes in v2:
-fix RGMII TX-delay issue
-add pfe_rx_done to clear bd after packet processing
-use writel/readl to access hw bds
-cleanup typos and indent
-remove unused code under CONFIG_UTIL_PE_DISABLED -Consolidate code in pfe_lib_init
-Corrected typo receive
-Magic numbers replaced with proper definitions
-File names pfe.c renamed to pfe_hw.c to be more clear as it contains
low level functions that directly access pfe hardware block.
-MDIO related code is also moved from pfe_eth.c to a new file
pfe_mdio.c.

---
 drivers/net/pfe_eth/pfe_driver.c   | 643 ++++++++++++++++++++++++
 drivers/net/pfe_eth/pfe_eth.c      | 297 +++++++++++
 drivers/net/pfe_eth/pfe_firmware.c | 230 +++++++++
 drivers/net/pfe_eth/pfe_hw.c       | 999 +++++++++++++++++++++++++++++++++++++
 drivers/net/pfe_eth/pfe_mdio.c     | 291 +++++++++++
 5 files changed, 2460 insertions(+)
 create mode 100644 drivers/net/pfe_eth/pfe_driver.c
 create mode 100644 drivers/net/pfe_eth/pfe_eth.c
 create mode 100644 drivers/net/pfe_eth/pfe_firmware.c
 create mode 100644 drivers/net/pfe_eth/pfe_hw.c
 create mode 100644 drivers/net/pfe_eth/pfe_mdio.c
drivers/net/pfe_eth/pfe_driver.c new file +643 -0
new file mode 100644
index 0000000..3122d5a
@@ -0,0 +1,643 @@
+/*
+ * Copyright 2015-2016 Freescale Semiconductor, Inc.
+ * Copyright 2017 NXP
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <pfe_eth/pfe_eth.h>
+#include <pfe_eth/pfe_firmware.h>
+
+static struct tx_desc_s *g_tx_desc;
+static struct rx_desc_s *g_rx_desc;
+
+/*
+ * HIF Rx interface function
+ * Reads the rx descriptor from the current location (rx_to_read).
+ * - If the descriptor has a valid data/pkt, then get the data pointer
+ * - check for the input rx phy number
+ * - increment the rx data pointer by pkt_head_room_size
+ * - decrement the data length by pkt_head_room_size
+ * - handover the packet to caller.
+ *
+ * @param[out] pkt_ptr - Pointer to store rx packet
+ * @param[out] phy_port - Pointer to store recv phy port
+ *
+ * @return -1 if no packet, else return length of packet.
+ */
+int pfe_recv(uchar **pkt_ptr, int *phy_port)
+{
+	struct rx_desc_s *rx_desc = g_rx_desc;
+	struct buf_desc *bd;
+	int len = 0;
+
+	struct hif_header_s *hif_header;
+
+	bd = rx_desc->rx_base + rx_desc->rx_to_read;
+
+	if (readl(&bd->ctrl) & BD_CTRL_DESC_EN)
+		return len; /* No pending Rx packet */
+
+	/* this len include hif_header(8 bytes) */
+	len = readl(&bd->ctrl) & 0xFFFF;
+
+	hif_header = (struct hif_header_s *)DDR_PFE_TO_VIRT(readl(&bd->data));
+
+	/* Get the receive port info from the packet */
+	debug("Pkt received:");
+	debug(" Pkt ptr(%p), len(%d), gemac_port(%d) status(%08x)\n",
+	      hif_header, len, hif_header->port_no, readl(&bd->status));
+#ifdef DEBUG
+	{
+		int i;
+		unsigned char *p = (unsigned char *)hif_header;
+
+		for (i = 0; i < len; i++) {
+			if (!(i % 16))
+				printf("\n");
+			printf(" %02x", p[i]);
+		}
+		printf("\n");
+	}
+#endif
+
+	*pkt_ptr = (uchar *)(hif_header + 1);
+	*phy_port = hif_header->port_no;
+	len -= sizeof(struct hif_header_s);
+
+	return len;
+}
+
+/*
+ * HIF function to check the Rx done
+ * This function will check the rx done indication of the current rx_to_read
+ * locations
+ * if success, moves the rx_to_read to next location.
+ */
+int pfe_eth_free_pkt(struct udevice *dev, uchar *packet, int length)
+{
+	struct rx_desc_s *rx_desc = g_rx_desc;
+	struct buf_desc *bd;
+
+	debug("%s:rx_base: %p, rx_to_read: %d\n", __func__, rx_desc->rx_base,
+	      rx_desc->rx_to_read);
+
+	bd = rx_desc->rx_base + rx_desc->rx_to_read;
+
+	/* reset the control field */
+	writel((MAX_FRAME_SIZE | BD_CTRL_LIFM | BD_CTRL_DESC_EN
+		    | BD_CTRL_DIR), &bd->ctrl);
+	writel(0, &bd->status);
+
+	debug("Rx Done : status: %08x, ctrl: %08x\n", readl(&bd->status),
+	      readl(&bd->ctrl));
+
+	/* Give START_STROBE to BDP to fetch the descriptor __NOW__,
+	 * BDP need not wait for rx_poll_cycle time to fetch the descriptor,
+	 * In idle state (ie., no rx pkt), BDP will not fetch
+	 * the descriptor even if strobe is given.
+	 */
+	writel((readl(HIF_RX_CTRL) | HIF_CTRL_BDP_CH_START_WSTB), HIF_RX_CTRL);
+
+	/* increment the rx_to_read index to next location */
+	rx_desc->rx_to_read = (rx_desc->rx_to_read + 1)
+			       & (rx_desc->rx_ring_size - 1);
+
+	debug("Rx next pkt location: %d\n", rx_desc->rx_to_read);
+
+	return 0;
+}
+
+/*
+ * HIF Tx interface function
+ * This function sends a single packet to PFE from HIF interface.
+ * - No interrupt indication on tx completion.
+ * - Data is copied to tx buffers before tx descriptor is updated
+ *   and TX DMA is enabled.
+ *
+ * @param[in] phy_port	Phy port number to send out this packet
+ * @param[in] data	Pointer to the data
+ * @param[in] length	Length of the ethernet packet to be transferred.
+ *
+ * @return -1 if tx Q is full, else returns the tx location where the pkt is
+ * placed.
+ */
+int pfe_send(int phy_port, void *data, int length)
+{
+	struct tx_desc_s *tx_desc = g_tx_desc;
+	struct buf_desc *bd;
+	struct hif_header_s hif_header;
+	u8 *tx_buf_va;
+
+	debug("%s:pkt: %p, len: %d, tx_base: %p, tx_to_send: %d\n", __func__,
+	      data, length, tx_desc->tx_base, tx_desc->tx_to_send);
+
+	bd = tx_desc->tx_base + tx_desc->tx_to_send;
+
+	/* check queue-full condition */
+	if (readl(&bd->ctrl) & BD_CTRL_DESC_EN)
+		return -1;
+
+	/* PFE checks for min pkt size */
+	if (length < MIN_PKT_SIZE)
+		length = MIN_PKT_SIZE;
+
+	tx_buf_va = (void *)DDR_PFE_TO_VIRT(readl(&bd->data));
+	debug("%s: tx_buf_va: %p, tx_buf_pa: %08x\n", __func__, tx_buf_va,
+	      readl(&bd->data));
+
+	/* Fill the gemac/phy port number to send this packet out */
+	memset(&hif_header, 0, sizeof(struct hif_header_s));
+	hif_header.port_no = phy_port;
+
+	memcpy(tx_buf_va, (u8 *)&hif_header, sizeof(struct hif_header_s));
+	memcpy(tx_buf_va + sizeof(struct hif_header_s), data, length);
+	length += sizeof(struct hif_header_s);
+
+#ifdef DEBUG
+	{
+		int i;
+		unsigned char *p = (unsigned char *)tx_buf_va;
+
+		for (i = 0; i < length; i++) {
+			if (!(i % 16))
+				printf("\n");
+			printf("%02x ", p[i]);
+		}
+	}
+#endif
+
+	debug("Tx Done: status: %08x, ctrl: %08x\n", readl(&bd->status),
+	      readl(&bd->ctrl));
+
+	/* fill the tx desc */
+	writel((u32)(BD_CTRL_DESC_EN | BD_CTRL_LIFM | (length & 0xFFFF)),
+	       &bd->ctrl);
+	writel(0, &bd->status);
+
+	writel((HIF_CTRL_DMA_EN | HIF_CTRL_BDP_CH_START_WSTB), HIF_TX_CTRL);
+
+	udelay(100);
+
+	return tx_desc->tx_to_send;
+}
+
+/*
+ * HIF function to check the Tx done
+ *  This function will check the tx done indication of the current tx_to_send
+ *  locations
+ *  if success, moves the tx_to_send to next location.
+ *
+ * @return -1 if TX ownership bit is not cleared by hw.
+ * else on success (tx done completion) return zero.
+ */
+int pfe_tx_done(void)
+{
+	struct tx_desc_s *tx_desc = g_tx_desc;
+	struct buf_desc *bd;
+
+	debug("%s:tx_base: %p, tx_to_send: %d\n", __func__, tx_desc->tx_base,
+	      tx_desc->tx_to_send);
+
+	bd = tx_desc->tx_base + tx_desc->tx_to_send;
+
+	/* check queue-full condition */
+	if (readl(&bd->ctrl) & BD_CTRL_DESC_EN)
+		return -1;
+
+	/* reset the control field */
+	writel(0, &bd->ctrl);
+	writel(0, &bd->status);
+
+	debug("Tx Done : status: %08x, ctrl: %08x\n", readl(&bd->status),
+	      readl(&bd->ctrl));
+
+	/* increment the txtosend index to next location */
+	tx_desc->tx_to_send = (tx_desc->tx_to_send + 1)
+			       & (tx_desc->tx_ring_size - 1);
+
+	debug("Tx next pkt location: %d\n", tx_desc->tx_to_send);
+
+	return 0;
+}
+
+/*
+ * Helper function to dump Rx descriptors.
+ */
+static inline void hif_rx_desc_dump(void)
+{
+	struct buf_desc *bd_va;
+	int i;
+	struct rx_desc_s *rx_desc;
+
+	if (!g_rx_desc) {
+		printf("%s: HIF Rx desc no init\n", __func__);
+		return;
+	}
+
+	rx_desc = g_rx_desc;
+	bd_va = rx_desc->rx_base;
+
+	debug("HIF rx desc: base_va: %p, base_pa: %08x\n", rx_desc->rx_base,
+	      rx_desc->rx_base_pa);
+	for (i = 0; i < rx_desc->rx_ring_size; i++) {
+		debug("status: %08x, ctrl: %08x, data: %08x, next: 0x%08x\n",
+		      readl(&bd_va->status),
+		      readl(&bd_va->ctrl),
+		      readl(&bd_va->data),
+		      readl(&bd_va->next));
+		bd_va++;
+	}
+}
+
+/*
+ * This function mark all Rx descriptors as LAST_BD.
+ */
+void hif_rx_desc_disable(void)
+{
+	int i;
+	struct rx_desc_s *rx_desc;
+	struct buf_desc *bd_va;
+
+	if (!g_rx_desc) {
+		printf("%s: HIF Rx desc not initialized\n", __func__);
+		return;
+	}
+
+	rx_desc = g_rx_desc;
+	bd_va = rx_desc->rx_base;
+
+	for (i = 0; i < rx_desc->rx_ring_size; i++) {
+		writel(readl(&bd_va->ctrl) | BD_CTRL_LAST_BD, &bd_va->ctrl);
+		bd_va++;
+	}
+}
+
+/*
+ * HIF Rx Desc initialization function.
+ */
+static int hif_rx_desc_init(struct pfe_ddr_address *pfe_addr)
+{
+	u32 ctrl;
+	struct buf_desc *bd_va;
+	struct buf_desc *bd_pa;
+	struct rx_desc_s *rx_desc;
+	u32 rx_buf_pa;
+	int i;
+
+	/* sanity check */
+	if (g_rx_desc) {
+		printf("%s: HIF Rx desc re-init request\n", __func__);
+		return 0;
+	}
+
+	rx_desc = (struct rx_desc_s *)malloc(sizeof(struct rx_desc_s));
+	if (!rx_desc) {
+		printf("%s: Memory allocation failure\n", __func__);
+		return -ENOMEM;
+	}
+	memset(rx_desc, 0, sizeof(struct rx_desc_s));
+
+	/* init: Rx ring buffer */
+	rx_desc->rx_ring_size = HIF_RX_DESC_NT;
+
+	/* NOTE: must be 64bit aligned  */
+	bd_va = (struct buf_desc *)(pfe_addr->ddr_pfe_baseaddr
+		 + RX_BD_BASEADDR);
+	bd_pa = (struct buf_desc *)(pfe_addr->ddr_pfe_phys_baseaddr
+				    + RX_BD_BASEADDR);
+
+	rx_desc->rx_base = bd_va;
+	rx_desc->rx_base_pa = (unsigned long)bd_pa;
+
+	rx_buf_pa = pfe_addr->ddr_pfe_phys_baseaddr + HIF_RX_PKT_DDR_BASEADDR;
+
+	debug("%s: Rx desc base: %p, base_pa: %08x, desc_count: %d\n",
+	      __func__, rx_desc->rx_base, rx_desc->rx_base_pa,
+	      rx_desc->rx_ring_size);
+
+	memset(bd_va, 0, sizeof(struct buf_desc) * rx_desc->rx_ring_size);
+
+	ctrl = (MAX_FRAME_SIZE | BD_CTRL_DESC_EN | BD_CTRL_DIR | BD_CTRL_LIFM);
+
+	for (i = 0; i < rx_desc->rx_ring_size; i++) {
+		writel((unsigned long)(bd_pa + 1), &bd_va->next);
+		writel(ctrl, &bd_va->ctrl);
+		writel(rx_buf_pa + (i * MAX_FRAME_SIZE), &bd_va->data);
+		bd_va++;
+		bd_pa++;
+	}
+	--bd_va;
+	writel((u32)rx_desc->rx_base_pa, &bd_va->next);
+
+	writel(rx_desc->rx_base_pa, HIF_RX_BDP_ADDR);
+	writel((readl(HIF_RX_CTRL) | HIF_CTRL_BDP_CH_START_WSTB), HIF_RX_CTRL);
+
+	g_rx_desc = rx_desc;
+
+	return 0;
+}
+
+/*
+ * Helper function to dump Tx Descriptors.
+ */
+static inline void hif_tx_desc_dump(void)
+{
+	struct tx_desc_s *tx_desc;
+	int i;
+	struct buf_desc *bd_va;
+
+	if (!g_tx_desc) {
+		printf("%s: HIF Tx desc no init\n", __func__);
+		return;
+	}
+
+	tx_desc = g_tx_desc;
+	bd_va = tx_desc->tx_base;
+
+	debug("HIF tx desc: base_va: %p, base_pa: %08x\n", tx_desc->tx_base,
+	      tx_desc->tx_base_pa);
+
+	for (i = 0; i < tx_desc->tx_ring_size; i++)
+		bd_va++;
+}
+
+/*
+ * HIF Tx descriptor initialization function.
+ */
+static int hif_tx_desc_init(struct pfe_ddr_address *pfe_addr)
+{
+	struct buf_desc *bd_va;
+	struct buf_desc *bd_pa;
+	int i;
+	struct tx_desc_s *tx_desc;
+	u32 tx_buf_pa;
+
+	/* sanity check */
+	if (g_tx_desc) {
+		printf("%s: HIF Tx desc re-init request\n", __func__);
+		return 0;
+	}
+
+	tx_desc = (struct tx_desc_s *)malloc(sizeof(struct tx_desc_s));
+	if (!tx_desc) {
+		printf("%s:%d:Memory allocation failure\n", __func__,
+		       __LINE__);
+		return -ENOMEM;
+	}
+	memset(tx_desc, 0, sizeof(struct tx_desc_s));
+
+	/* init: Tx ring buffer */
+	tx_desc->tx_ring_size = HIF_TX_DESC_NT;
+
+	/* NOTE: must be 64bit aligned  */
+	bd_va = (struct buf_desc *)(pfe_addr->ddr_pfe_baseaddr
+		 + TX_BD_BASEADDR);
+	bd_pa = (struct buf_desc *)(pfe_addr->ddr_pfe_phys_baseaddr
+				    + TX_BD_BASEADDR);
+
+	tx_desc->tx_base_pa = (unsigned long)bd_pa;
+	tx_desc->tx_base = bd_va;
+
+	debug("%s: Tx desc_base: %p, base_pa: %08x, desc_count: %d\n",
+	      __func__, tx_desc->tx_base, tx_desc->tx_base_pa,
+	      tx_desc->tx_ring_size);
+
+	memset(bd_va, 0, sizeof(struct buf_desc) * tx_desc->tx_ring_size);
+
+	tx_buf_pa = pfe_addr->ddr_pfe_phys_baseaddr + HIF_TX_PKT_DDR_BASEADDR;
+
+	for (i = 0; i < tx_desc->tx_ring_size; i++) {
+		writel((unsigned long)(bd_pa + 1), &bd_va->next);
+		writel(tx_buf_pa + (i * MAX_FRAME_SIZE), &bd_va->data);
+		bd_va++;
+		bd_pa++;
+	}
+	--bd_va;
+	writel((u32)tx_desc->tx_base_pa, &bd_va->next);
+
+	writel(tx_desc->tx_base_pa, HIF_TX_BDP_ADDR);
+
+	g_tx_desc = tx_desc;
+
+	return 0;
+}
+
+/*
+ * PFE/Class initialization.
+ */
+static void pfe_class_init(struct pfe_ddr_address *pfe_addr)
+{
+	struct class_cfg class_cfg = {
+		.route_table_baseaddr = pfe_addr->ddr_pfe_phys_baseaddr +
+					ROUTE_TABLE_BASEADDR,
+		.route_table_hash_bits = ROUTE_TABLE_HASH_BITS,
+	};
+
+	class_init(&class_cfg);
+
+	debug("class init complete\n");
+}
+
+/*
+ * PFE/TMU initialization.
+ */
+static void pfe_tmu_init(struct pfe_ddr_address *pfe_addr)
+{
+	struct tmu_cfg tmu_cfg = {
+		.llm_base_addr = pfe_addr->ddr_pfe_phys_baseaddr
+				 + TMU_LLM_BASEADDR,
+		.llm_queue_len = TMU_LLM_QUEUE_LEN,
+	};
+
+	tmu_init(&tmu_cfg);
+
+	debug("tmu init complete\n");
+}
+
+/*
+ * PFE/BMU (both BMU1 & BMU2) initialization.
+ */
+static void pfe_bmu_init(struct pfe_ddr_address *pfe_addr)
+{
+	struct bmu_cfg bmu1_cfg = {
+		.baseaddr = CBUS_VIRT_TO_PFE(LMEM_BASE_ADDR +
+						BMU1_LMEM_BASEADDR),
+		.count = BMU1_BUF_COUNT,
+		.size = BMU1_BUF_SIZE,
+	};
+
+	struct bmu_cfg bmu2_cfg = {
+		.baseaddr = pfe_addr->ddr_pfe_phys_baseaddr + BMU2_DDR_BASEADDR,
+		.count = BMU2_BUF_COUNT,
+		.size = BMU2_BUF_SIZE,
+	};
+
+	bmu_init(BMU1_BASE_ADDR, &bmu1_cfg);
+	debug("bmu1 init: done\n");
+
+	bmu_init(BMU2_BASE_ADDR, &bmu2_cfg);
+	debug("bmu2 init: done\n");
+}
+
+/*
+ * PFE/GPI initialization function.
+ *  - egpi1, egpi2, egpi3, hgpi
+ */
+static void pfe_gpi_init(struct pfe_ddr_address *pfe_addr)
+{
+	struct gpi_cfg egpi1_cfg = {
+		.lmem_rtry_cnt = EGPI1_LMEM_RTRY_CNT,
+		.tmlf_txthres = EGPI1_TMLF_TXTHRES,
+		.aseq_len = EGPI1_ASEQ_LEN,
+	};
+
+	struct gpi_cfg egpi2_cfg = {
+		.lmem_rtry_cnt = EGPI2_LMEM_RTRY_CNT,
+		.tmlf_txthres = EGPI2_TMLF_TXTHRES,
+		.aseq_len = EGPI2_ASEQ_LEN,
+	};
+
+	struct gpi_cfg hgpi_cfg = {
+		.lmem_rtry_cnt = HGPI_LMEM_RTRY_CNT,
+		.tmlf_txthres = HGPI_TMLF_TXTHRES,
+		.aseq_len = HGPI_ASEQ_LEN,
+	};
+
+	gpi_init(EGPI1_BASE_ADDR, &egpi1_cfg);
+	debug("GPI1 init complete\n");
+
+	gpi_init(EGPI2_BASE_ADDR, &egpi2_cfg);
+	debug("GPI2 init complete\n");
+
+	gpi_init(HGPI_BASE_ADDR, &hgpi_cfg);
+	debug("HGPI init complete\n");
+}
+
+/*
+ * PFE/HIF initialization function.
+ */
+static int pfe_hif_init(struct pfe_ddr_address *pfe_addr)
+{
+	int ret = 0;
+
+	hif_tx_disable();
+	hif_rx_disable();
+
+	ret = hif_tx_desc_init(pfe_addr);
+	if (ret)
+		return ret;
+	ret = hif_rx_desc_init(pfe_addr);
+	if (ret)
+		return ret;
+
+	hif_init();
+
+	hif_tx_enable();
+	hif_rx_enable();
+
+	hif_rx_desc_dump();
+	hif_tx_desc_dump();
+
+	debug("HIF init complete\n");
+	return ret;
+}
+
+/*
+ * PFE initialization
+ * - Firmware loading (CLASS-PE and TMU-PE)
+ * - BMU1 and BMU2 init
+ * - GEMAC init
+ * - GPI init
+ * - CLASS-PE init
+ * - TMU-PE init
+ * - HIF tx and rx descriptors init
+ *
+ * @param[in]	edev	Pointer to eth device structure.
+ *
+ * @return 0, on success.
+ */
+static int pfe_hw_init(struct pfe_ddr_address *pfe_addr)
+{
+	int ret = 0;
+
+	debug("%s: start\n", __func__);
+
+	writel(0x3, CLASS_PE_SYS_CLK_RATIO);
+	writel(0x3, TMU_PE_SYS_CLK_RATIO);
+	writel(0x3, UTIL_PE_SYS_CLK_RATIO);
+	udelay(10);
+
+	pfe_class_init(pfe_addr);
+
+	pfe_tmu_init(pfe_addr);
+
+	pfe_bmu_init(pfe_addr);
+
+	pfe_gpi_init(pfe_addr);
+
+	ret = pfe_hif_init(pfe_addr);
+	if (ret)
+		return ret;
+
+	bmu_enable(BMU1_BASE_ADDR);
+	debug("bmu1 enabled\n");
+
+	bmu_enable(BMU2_BASE_ADDR);
+	debug("bmu2 enabled\n");
+
+	debug("%s: done\n", __func__);
+
+	return ret;
+}
+
+/*
+ * PFE driver init function.
+ * - Initializes pfe_lib
+ * - pfe hw init
+ * - fw loading and enables PEs
+ * - should be executed once.
+ *
+ * @param[in] pfe  Pointer the pfe control block
+ */
+int pfe_drv_init(struct pfe_ddr_address  *pfe_addr)
+{
+	int ret = 0;
+
+	pfe_lib_init();
+
+	ret = pfe_hw_init(pfe_addr);
+	if (ret)
+		return ret;
+
+	/* Load the class,TM, Util fw.
+	 * By now pfe is:
+	 * - out of reset + disabled + configured.
+	 * Fw loading should be done after pfe_hw_init()
+	 */
+	/* It loads default inbuilt sbl firmware */
+	pfe_firmware_init();
+
+	return ret;
+}
+
+/*
+ * PFE remove function
+ *  - stops PEs
+ *  - frees tx/rx descriptor resources
+ *  - should be called once.
+ *
+ * @param[in] pfe Pointer to pfe control block.
+ */
+int pfe_eth_remove(struct udevice *dev)
+{
+	if (g_tx_desc)
+		free(g_tx_desc);
+
+	if (g_rx_desc)
+		free(g_rx_desc);
+
+	pfe_firmware_exit();
+
+	return 0;
+}
drivers/net/pfe_eth/pfe_eth.c new file +297 -0

297 lines not on this page · raw message

drivers/net/pfe_eth/pfe_firmware.c new file +230 -0

230 lines not on this page · raw message

drivers/net/pfe_eth/pfe_hw.c new file +999 -0

999 lines not on this page · raw message

drivers/net/pfe_eth/pfe_mdio.c new file +291 -0

291 lines not on this page · raw message

Signature · 1 line
2.7.4
#6 lore raw

PATCH v2 3/13 drivers: net: pfe_eth: LS1012A PFE driver introduction

Quoted 12 lines · Calvin Johnson

This patch adds PFE driver to U-Boot

Following are the main driver files:-
pfe_hw.c: provides low level helper functions to initialize PFE internal processor engines and other hardware blocks pfe_driver.c: provides initialization functions
and packet send and receive functions
pfe_eth.c: provides high level gemac initialization functions pfe_firmware.c: provides functions to load firmware into PFE internal processor engines.
pfe_mdio.c: provides functions to initialize phy and mdio.

Quoted 2 lines
#7 lore raw

PATCH v2 4/13 drivers: net: pfe_eth: provide pfe commands

In reply to Calvin Johnson

pfe_command provides command line support for several features that support pfe, like starting or stopping the pfe, checking the health of the processor engines and checking status of different units inside pfe.

---
Changes in v2:
-remove unused code under CONFIG_UTIL_PE_DISABLED
-remove unused code under CONFIG_PFE_WARN_WA

---
 drivers/net/pfe_eth/pfe_cmd.c | 497 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 497 insertions(+)
 create mode 100644 drivers/net/pfe_eth/pfe_cmd.c
drivers/net/pfe_eth/pfe_cmd.c new file +497 -0
new file mode 100644
index 0000000..41c9c9b
@@ -0,0 +1,497 @@
+/*
+ * Copyright 2015-2016 Freescale Semiconductor, Inc.
+ * Copyright 2017 NXP
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+/*
+ * @file
+ * @brief PFE utility commands
+ */
+
+#include <pfe_eth/pfe_eth.h>
+
+static inline void pfe_command_help(void)
+{
+	printf("Usage: pfe [pe | status | expt ] <options>\n");
+}
+
+static void pfe_command_pe(int argc, char * const argv[])
+{
+	if (argc >= 3 && strcmp(argv[2], "pmem") == 0) {
+		if (argc >= 4 && strcmp(argv[3], "read") == 0) {
+			int i;
+			int num;
+			int id;
+			u32 addr;
+			u32 size;
+			u32 val;
+
+			if (argc == 7) {
+				num = simple_strtoul(argv[6], NULL, 0);
+			} else if (argc == 6) {
+				num = 1;
+			} else {
+				printf("Usage: pfe pe pmem read <id> <addr> [<num>]\n");
+				return;
+			}
+
+			id = simple_strtoul(argv[4], NULL, 0);
+			addr = simple_strtoul(argv[5], NULL, 16);
+			size = 4;
+
+			for (i = 0; i < num; i++, addr += 4) {
+				val = pe_pmem_read(id, addr, size);
+				val = be32_to_cpu(val);
+				if (!(i & 3))
+					printf("%08x: ", addr);
+				printf("%08x%s", val, i == num - 1 || (i & 3)
+				       == 3 ? "\n" : " ");
+			}
+
+		} else {
+			printf("Usage: pfe pe pmem read <parameters>\n");
+		}
+	} else if (argc >= 3 && strcmp(argv[2], "dmem") == 0) {
+		if (argc >= 4 && strcmp(argv[3], "read") == 0) {
+			int i;
+			int num;
+			int id;
+			u32 addr;
+			u32 size;
+			u32 val;
+
+			if (argc == 7) {
+				num = simple_strtoul(argv[6], NULL, 0);
+			} else if (argc == 6) {
+				num = 1;
+			} else {
+				printf("Usage: pfe pe dmem read <id> <addr> [<num>]\n");
+				return;
+			}
+
+			id = simple_strtoul(argv[4], NULL, 0);
+			addr = simple_strtoul(argv[5], NULL, 16);
+			size = 4;
+
+			for (i = 0; i < num; i++, addr += 4) {
+				val = pe_dmem_read(id, addr, size);
+				val = be32_to_cpu(val);
+				if (!(i & 3))
+					printf("%08x: ", addr);
+				printf("%08x%s", val, i == num - 1 || (i & 3)
+				       == 3 ? "\n" : " ");
+			}
+
+		} else if (argc >= 4 && strcmp(argv[3], "write") == 0) {
+			int id;
+			u32 val;
+			u32 addr;
+			u32 size;
+
+			if (argc != 7) {
+				printf("Usage: pfe pe dmem write <id> <val> <addr>\n");
+				return;
+			}
+
+			id = simple_strtoul(argv[4], NULL, 0);
+			val = simple_strtoul(argv[5], NULL, 16);
+			val = cpu_to_be32(val);
+			addr = simple_strtoul(argv[6], NULL, 16);
+			size = 4;
+			pe_dmem_write(id, val, addr, size);
+		} else {
+			printf("Usage: pfe pe dmem [read | write] <parameters>\n");
+		}
+	} else if (argc >= 3 && strcmp(argv[2], "lmem") == 0) {
+		if (argc >= 4 && strcmp(argv[3], "read") == 0) {
+			int i;
+			int num;
+			u32 val;
+			u32 offset;
+
+			if (argc == 6) {
+				num = simple_strtoul(argv[5], NULL, 0);
+			} else if (argc == 5) {
+				num = 1;
+			} else {
+				printf("Usage: pfe pe lmem read <offset> [<num>]\n");
+				return;
+			}
+
+			offset = simple_strtoul(argv[4], NULL, 16);
+
+			for (i = 0; i < num; i++, offset += 4) {
+				pe_lmem_read(&val, 4, offset);
+				val = be32_to_cpu(val);
+				printf("%08x%s", val, i == num - 1 || (i & 7)
+				       == 7 ? "\n" : " ");
+			}
+
+		} else if (argc >= 4 && strcmp(argv[3], "write") == 0)	{
+			u32 val;
+			u32 offset;
+
+			if (argc != 6) {
+				printf("Usage: pfe pe lmem write <val> <offset>\n");
+				return;
+			}
+
+			val = simple_strtoul(argv[4], NULL, 16);
+			val = cpu_to_be32(val);
+			offset = simple_strtoul(argv[5], NULL, 16);
+			pe_lmem_write(&val, 4, offset);
+		} else {
+			printf("Usage: pfe pe lmem [read | write] <parameters>\n");
+		}
+	} else {
+		if (strcmp(argv[2], "help") != 0)
+			printf("Unknown option: %s\n", argv[2]);
+
+		printf("Usage: pfe pe <parameters>\n");
+	}
+}
+
+#define NUM_QUEUES		16
+
+/*
+ * qm_read_drop_stat
+ * This function is used to read the drop statistics from the TMU
+ * hw drop counter.  Since the hw counter is always cleared afer
+ * reading, this function maintains the previous drop count, and
+ * adds the new value to it.  That value can be retrieved by
+ * passing a pointer to it with the total_drops arg.
+ *
+ * @param tmu           TMU number (0 - 3)
+ * @param queue         queue number (0 - 15)
+ * @param total_drops   pointer to location to store total drops (or NULL)
+ * @param do_reset      if TRUE, clear total drops after updating
+ *
+ */
+u32 qm_read_drop_stat(u32 tmu, u32 queue, u32 *total_drops, int do_reset)
+{
+	static u32 qtotal[TMU_MAX_ID + 1][NUM_QUEUES];
+	u32 val;
+
+	writel((tmu << 8) | queue, TMU_TEQ_CTRL);
+	writel((tmu << 8) | queue, TMU_LLM_CTRL);
+	val = readl(TMU_TEQ_DROP_STAT);
+	qtotal[tmu][queue] += val;
+	if (total_drops)
+		*total_drops = qtotal[tmu][queue];
+	if (do_reset)
+		qtotal[tmu][queue] = 0;
+	return val;
+}
+
+static ssize_t tmu_queue_stats(char *buf, int tmu, int queue)
+{
+	ssize_t len = 0;
+	u32 drops;
+
+	printf("%d-%02d, ", tmu, queue);
+
+	drops = qm_read_drop_stat(tmu, queue, NULL, 0);
+
+	/* Select queue */
+	writel((tmu << 8) | queue, TMU_TEQ_CTRL);
+	writel((tmu << 8) | queue, TMU_LLM_CTRL);
+
+	printf("(teq) drop: %10u, tx: %10u (llm) head: %08x, tail: %08x, drop: %10u\n",
+	       drops, readl(TMU_TEQ_TRANS_STAT),
+	       readl(TMU_LLM_QUE_HEADPTR), readl(TMU_LLM_QUE_TAILPTR),
+	       readl(TMU_LLM_QUE_DROPCNT));
+
+	return len;
+}
+
+static ssize_t tmu_queues(char *buf, int tmu)
+{
+	ssize_t len = 0;
+	int queue;
+
+	for (queue = 0; queue < 16; queue++)
+		len += tmu_queue_stats(buf + len, tmu, queue);
+
+	return len;
+}
+
+static inline void hif_status(void)
+{
+	printf("hif:\n");
+
+	printf("  tx curr bd:    %x\n", readl(HIF_TX_CURR_BD_ADDR));
+	printf("  tx status:     %x\n", readl(HIF_TX_STATUS));
+	printf("  tx dma status: %x\n", readl(HIF_TX_DMA_STATUS));
+
+	printf("  rx curr bd:    %x\n", readl(HIF_RX_CURR_BD_ADDR));
+	printf("  rx status:     %x\n", readl(HIF_RX_STATUS));
+	printf("  rx dma status: %x\n", readl(HIF_RX_DMA_STATUS));
+
+	printf("hif nocopy:\n");
+
+	printf("  tx curr bd:    %x\n", readl(HIF_NOCPY_TX_CURR_BD_ADDR));
+	printf("  tx status:     %x\n", readl(HIF_NOCPY_TX_STATUS));
+	printf("  tx dma status: %x\n", readl(HIF_NOCPY_TX_DMA_STATUS));
+
+	printf("  rx curr bd:    %x\n", readl(HIF_NOCPY_RX_CURR_BD_ADDR));
+	printf("  rx status:     %x\n", readl(HIF_NOCPY_RX_STATUS));
+	printf("  rx dma status: %x\n", readl(HIF_NOCPY_RX_DMA_STATUS));
+}
+
+static void gpi(int id, void *base)
+{
+	u32 val;
+
+	printf("%s%d:\n", __func__, id);
+
+	printf("  tx under stick: %x\n", readl(base + GPI_FIFO_STATUS));
+	val = readl(base + GPI_FIFO_DEBUG);
+	printf("  tx pkts:        %x\n", (val >> 23) & 0x3f);
+	printf("  rx pkts:        %x\n", (val >> 18) & 0x3f);
+	printf("  tx bytes:       %x\n", (val >> 9) & 0x1ff);
+	printf("  rx bytes:       %x\n", (val >> 0) & 0x1ff);
+	printf("  overrun:        %x\n", readl(base + GPI_OVERRUN_DROPCNT));
+}
+
+static void  bmu(int id, void *base)
+{
+	printf("%s%d:\n", __func__, id);
+
+	printf("  buf size:  %x\n", (1 << readl(base + BMU_BUF_SIZE)));
+	printf("  buf count: %x\n", readl(base + BMU_BUF_CNT));
+	printf("  buf rem:   %x\n", readl(base + BMU_REM_BUF_CNT));
+	printf("  buf curr:  %x\n", readl(base + BMU_CURR_BUF_CNT));
+	printf("  free err:  %x\n", readl(base + BMU_FREE_ERR_ADDR));
+}
+
+#define	PESTATUS_ADDR_CLASS	0x800
+#define PEMBOX_ADDR_CLASS	0x890
+#define	PESTATUS_ADDR_TMU	0x80
+#define PEMBOX_ADDR_TMU		0x290
+#define	PESTATUS_ADDR_UTIL	0x0
+
+static void pfe_pe_status(int argc, char * const argv[])
+{
+	int do_clear = 0;
+	u32 id;
+	u32 dmem_addr;
+	u32 cpu_state;
+	u32 activity_counter;
+	u32 rx;
+	u32 tx;
+	u32 drop;
+	char statebuf[5];
+	u32 class_debug_reg = 0;
+
+	if (argc == 4 && strcmp(argv[3], "clear") == 0)
+		do_clear = 1;
+
+	for (id = CLASS0_ID; id < MAX_PE; id++) {
+		if (id >= TMU0_ID) {
+			if (id == TMU2_ID)
+				continue;
+			if (id == TMU0_ID)
+				printf("tmu:\n");
+			dmem_addr = PESTATUS_ADDR_TMU;
+		} else {
+			if (id == CLASS0_ID)
+				printf("class:\n");
+			dmem_addr = PESTATUS_ADDR_CLASS;
+			class_debug_reg = readl(CLASS_PE0_DEBUG + id * 4);
+		}
+
+		cpu_state = pe_dmem_read(id, dmem_addr, 4);
+		dmem_addr += 4;
+		memcpy(statebuf, (char *)&cpu_state, 4);
+		statebuf[4] = '\0';
+		activity_counter = pe_dmem_read(id, dmem_addr, 4);
+		dmem_addr += 4;
+		rx = pe_dmem_read(id, dmem_addr, 4);
+		if (do_clear)
+			pe_dmem_write(id, 0, dmem_addr, 4);
+		dmem_addr += 4;
+		tx = pe_dmem_read(id, dmem_addr, 4);
+		if (do_clear)
+			pe_dmem_write(id, 0, dmem_addr, 4);
+		dmem_addr += 4;
+		drop = pe_dmem_read(id, dmem_addr, 4);
+		if (do_clear)
+			pe_dmem_write(id, 0, dmem_addr, 4);
+		dmem_addr += 4;
+
+		if (id >= TMU0_ID) {
+			printf("%d: state=%4s ctr=%08x rx=%x qstatus=%x\n",
+			       id - TMU0_ID, statebuf,
+			       cpu_to_be32(activity_counter),
+			       cpu_to_be32(rx), cpu_to_be32(tx));
+		} else {
+			printf("%d: pc=1%04x ldst=%04x state=%4s ctr=%08x rx=%x tx=%x drop=%x\n",
+			       id - CLASS0_ID, class_debug_reg & 0xFFFF,
+			       class_debug_reg >> 16,
+			       statebuf, cpu_to_be32(activity_counter),
+			       cpu_to_be32(rx), cpu_to_be32(tx),
+			       cpu_to_be32(drop));
+		}
+	}
+}
+
+static void pfe_command_status(int argc, char * const argv[])
+{
+	if (argc >= 3 && strcmp(argv[2], "pe") == 0) {
+		pfe_pe_status(argc, argv);
+	} else if (argc == 3 && strcmp(argv[2], "bmu") == 0) {
+		bmu(1, BMU1_BASE_ADDR);
+		bmu(2, BMU2_BASE_ADDR);
+	} else if (argc == 3 && strcmp(argv[2], "hif") == 0) {
+		hif_status();
+	} else if (argc == 3 && strcmp(argv[2], "gpi") == 0) {
+		gpi(0, EGPI1_BASE_ADDR);
+		gpi(1, EGPI2_BASE_ADDR);
+		gpi(3, HGPI_BASE_ADDR);
+	} else if (argc == 3 && strcmp(argv[2], "tmu0_queues") == 0) {
+		tmu_queues(NULL, 0);
+	} else if (argc == 3 && strcmp(argv[2], "tmu1_queues") == 0) {
+		tmu_queues(NULL, 1);
+	} else if (argc == 3 && strcmp(argv[2], "tmu3_queues") == 0) {
+		tmu_queues(NULL, 3);
+	} else {
+		printf("Usage: pfe status [pe <clear> | bmu | gpi | hif | tmuX_queues ]\n");
+	}
+}
+
+#define EXPT_DUMP_ADDR 0x1fa8
+#define EXPT_REG_COUNT 20
+static const char *register_names[EXPT_REG_COUNT] = {
+		"  pc", "ECAS", " EID", "  ED",
+		"  sp", "  r1", "  r2", "  r3",
+		"  r4", "  r5", "  r6", "  r7",
+		"  r8", "  r9", " r10", " r11",
+		" r12", " r13", " r14", " r15"
+};
+
+static void pfe_command_expt(int argc, char * const argv[])
+{
+	unsigned int id, i, val, addr;
+
+	if (argc == 3) {
+		id = simple_strtoul(argv[2], NULL, 0);
+		addr = EXPT_DUMP_ADDR;
+		printf("Exception information for PE %d:\n", id);
+		for (i = 0; i < EXPT_REG_COUNT; i++) {
+			val = pe_dmem_read(id, addr, 4);
+			val = be32_to_cpu(val);
+			printf("%s:%08x%s", register_names[i], val,
+			       (i & 3) == 3 ? "\n" : " ");
+			addr += 4;
+		}
+	} else {
+		printf("Usage: pfe expt <id>\n");
+	}
+}
+
+#ifdef PFE_RESET_WA
+/*This function sends a dummy packet to HIF through TMU3 */
+static void send_dummy_pkt_to_hif(void)
+{
+	u32 buf;
+	static u32 dummy_pkt[] =  {
+		0x4200800a, 0x01000003, 0x00018100, 0x00000000,
+		0x33221100, 0x2b785544, 0xd73093cb, 0x01000608,
+		0x04060008, 0x2b780200, 0xd73093cb, 0x0a01a8c0,
+		0x33221100, 0xa8c05544, 0x00000301, 0x00000000,
+		0x00000000, 0x00000000, 0x00000000, 0xbe86c51f };
+
+	/*Allocate BMU2 buffer */
+	buf = readl(BMU2_BASE_ADDR + BMU_ALLOC_CTRL);
+
+	debug("Sending a dummy pkt to HIF %x\n", buf);
+	buf += 0x80;
+	memcpy((void *)DDR_PFE_TO_VIRT(buf), dummy_pkt, sizeof(dummy_pkt));
+
+	/*Write length and pkt to TMU*/
+	writel(0x03000042, TMU_PHY_INQ_PKTPTR);
+	writel(buf, TMU_PHY_INQ_PKTINFO);
+}
+
+static void pfe_command_stop(int argc, char * const argv[])
+{
+	int pfe_pe_id, hif_stop_loop = 10;
+	u32 rx_status;
+
+	printf("Stopping PFE...\n");
+
+	/*Mark all descriptors as LAST_BD */
+	hif_rx_desc_disable();
+
+	/*If HIF Rx BDP is busy send a dummy packet */
+	do {
+		rx_status = readl(HIF_RX_STATUS);
+		if (rx_status & BDP_CSR_RX_DMA_ACTV)
+			send_dummy_pkt_to_hif();
+		udelay(10);
+	} while (hif_stop_loop--);
+
+	if (readl(HIF_RX_STATUS) & BDP_CSR_RX_DMA_ACTV)
+		printf("Unable to stop HIF\n");
+
+	/*Disable Class PEs */
+	for (pfe_pe_id = CLASS0_ID; pfe_pe_id <= CLASS_MAX_ID; pfe_pe_id++) {
+		/*Inform PE to stop */
+		pe_dmem_write(pfe_pe_id, cpu_to_be32(1), PEMBOX_ADDR_CLASS, 4);
+		udelay(10);
+
+		/*Read status */
+		if (!pe_dmem_read(pfe_pe_id, PEMBOX_ADDR_CLASS + 4, 4))
+			printf("Failed to stop PE%d\n", pfe_pe_id);
+	}
+
+	/*Disable TMU PEs */
+	for (pfe_pe_id = TMU0_ID; pfe_pe_id <= TMU_MAX_ID; pfe_pe_id++) {
+		if (pfe_pe_id == TMU2_ID)
+			continue;
+
+		/*Inform PE to stop */
+		pe_dmem_write(pfe_pe_id, 1, PEMBOX_ADDR_TMU, 4);
+		udelay(10);
+
+		/*Read status */
+		if (!pe_dmem_read(pfe_pe_id, PEMBOX_ADDR_TMU + 4, 4))
+			printf("Failed to stop PE%d\n", pfe_pe_id);
+	}
+}
+#endif
+
+static int pfe_command(cmd_tbl_t *cmdtp, int flag, int argc,
+		       char * const argv[])
+{
+	if (argc == 1 || strcmp(argv[1], "help") == 0) {
+		pfe_command_help();
+		return CMD_RET_SUCCESS;
+	}
+
+	if (strcmp(argv[1], "pe") == 0) {
+		pfe_command_pe(argc, argv);
+	} else if (strcmp(argv[1], "status") == 0) {
+		pfe_command_status(argc, argv);
+	} else if (strcmp(argv[1], "expt") == 0) {
+		pfe_command_expt(argc, argv);
+#ifdef PFE_RESET_WA
+	} else if (strcmp(argv[1], "stop") == 0) {
+		pfe_command_stop(argc, argv);
+#endif
+	} else {
+		printf("Unknown option: %s\n", argv[1]);
+		pfe_command_help();
+		return CMD_RET_FAILURE;
+	}
+	return CMD_RET_SUCCESS;
+}
+
+U_BOOT_CMD(
+	pfe,	7,	1,	pfe_command,
+	"Performs PFE lib utility functions",
+	"Usage:\n"
+	"pfe <options>"
+);
Signature · 1 line
2.7.4
#8 lore raw

PATCH v2 4/13 drivers: net: pfe_eth: provide pfe commands

Quoted 7 lines · Calvin Johnson

pfe_command provides command line support for several features that support pfe, like starting or stopping the pfe, checking the health of the processor engines and checking status of different units inside pfe.

#9 lore raw

PATCH v2 5/13 drivers: net: pfe_eth: LS1012A PFE headers

In reply to Calvin Johnson

Contains all the pfe header files.

---
Changes in v2:
-Add pfe_rx_done to clear bd after packet processing -remove unused code under CONFIG_UTIL_PE_DISABLED
-Used BIT and GENMASK macros wherever applicable
-Removed generic definitions that pollutes namespace
-File names pfe.h renamed to pfe_hw.h to be more clear as it contains
low level functions that directly access pfe hardware block
-Added pfe_dm_eth.h for new driver model

---
 include/dm/platform_data/pfe_dm_eth.h |  21 ++++
 include/pfe_eth/pfe/cbus.h            |  77 +++++++++++++++
 include/pfe_eth/pfe/cbus/bmu.h        |  40 ++++++++
 include/pfe_eth/pfe/cbus/class_csr.h  | 180 ++++++++++++++++++++++++++++++++++
 include/pfe_eth/pfe/cbus/emac.h       | 140 ++++++++++++++++++++++++++
 include/pfe_eth/pfe/cbus/gpi.h        |  62 ++++++++++++
 include/pfe_eth/pfe/cbus/hif.h        |  68 +++++++++++++
 include/pfe_eth/pfe/cbus/hif_nocpy.h  |  40 ++++++++
 include/pfe_eth/pfe/cbus/tmu_csr.h    | 148 ++++++++++++++++++++++++++++
 include/pfe_eth/pfe/cbus/util_csr.h   |  47 +++++++++
 include/pfe_eth/pfe/pfe_hw.h          | 163 ++++++++++++++++++++++++++++++
 include/pfe_eth/pfe_driver.h          |  59 +++++++++++
 include/pfe_eth/pfe_eth.h             | 104 ++++++++++++++++++++
 include/pfe_eth/pfe_firmware.h        |  17 ++++
 include/pfe_eth/pfe_mdio.h            |  13 +++
 15 files changed, 1179 insertions(+)
 create mode 100644 include/dm/platform_data/pfe_dm_eth.h
 create mode 100644 include/pfe_eth/pfe/cbus.h
 create mode 100644 include/pfe_eth/pfe/cbus/bmu.h
 create mode 100644 include/pfe_eth/pfe/cbus/class_csr.h
 create mode 100644 include/pfe_eth/pfe/cbus/emac.h
 create mode 100644 include/pfe_eth/pfe/cbus/gpi.h
 create mode 100644 include/pfe_eth/pfe/cbus/hif.h
 create mode 100644 include/pfe_eth/pfe/cbus/hif_nocpy.h
 create mode 100644 include/pfe_eth/pfe/cbus/tmu_csr.h
 create mode 100644 include/pfe_eth/pfe/cbus/util_csr.h
 create mode 100644 include/pfe_eth/pfe/pfe_hw.h
 create mode 100644 include/pfe_eth/pfe_driver.h
 create mode 100644 include/pfe_eth/pfe_eth.h
 create mode 100644 include/pfe_eth/pfe_firmware.h
 create mode 100644 include/pfe_eth/pfe_mdio.h
include/dm/platform_data/pfe_dm_eth.h new file +21 -0
new file mode 100644
index 0000000..7943c67
@@ -0,0 +1,21 @@
+/*
+ * Copyright 2015-2016 Freescale Semiconductor, Inc.
+ * Copyright 2017 NXP
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#ifndef __PFE_DM_ETH_H__
+#define __PFE_DM_ETH_H__
+#include <net.h>
+
+struct pfe_ddr_address {
+	void *ddr_pfe_baseaddr;
+	unsigned long ddr_pfe_phys_baseaddr;
+};
+
+struct pfe_eth_pdata {
+	struct eth_pdata pfe_eth_pdata_mac;
+	struct pfe_ddr_address pfe_ddr_addr;
+};
+#endif /* __PFE_DM_ETH_H__ */
include/pfe_eth/pfe/cbus.h new file +77 -0

77 lines not on this page · raw message

include/pfe_eth/pfe/cbus/bmu.h new file +40 -0
new file mode 100644
index 0000000..f707cc3
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2015-2016 Freescale Semiconductor, Inc.
+ * Copyright 2017 NXP
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#ifndef _BMU_H_
+#define _BMU_H_
+
+#define BMU_VERSION		0x000
+#define BMU_CTRL		0x004
+#define BMU_UCAST_CONFIG	0x008
+#define BMU_UCAST_BASE_ADDR	0x00c
+#define BMU_BUF_SIZE		0x010
+#define BMU_BUF_CNT		0x014
+#define BMU_THRES		0x018
+#define BMU_INT_SRC		0x020
+#define BMU_INT_ENABLE		0x024
+#define BMU_ALLOC_CTRL		0x030
+#define BMU_FREE_CTRL		0x034
+#define BMU_FREE_ERR_ADDR	0x038
+#define BMU_CURR_BUF_CNT	0x03c
+#define BMU_MCAST_CNT		0x040
+#define BMU_MCAST_ALLOC_CTRL	0x044
+#define BMU_REM_BUF_CNT		0x048
+#define BMU_LOW_WATERMARK	0x050
+#define BMU_HIGH_WATERMARK	0x054
+#define BMU_INT_MEM_ACCESS	0x100
+
+struct bmu_cfg {
+	u32 baseaddr;
+	u32 count;
+	u32 size;
+};
+
+#define BMU1_BUF_SIZE	LMEM_BUF_SIZE_LN2
+#define BMU2_BUF_SIZE	DDR_BUF_SIZE_LN2
+
+#endif /* _BMU_H_ */
include/pfe_eth/pfe/cbus/class_csr.h new file +180 -0

180 lines not on this page · raw message

include/pfe_eth/pfe/cbus/emac.h new file +140 -0

140 lines not on this page · raw message

include/pfe_eth/pfe/cbus/gpi.h new file +62 -0

62 lines not on this page · raw message

include/pfe_eth/pfe/cbus/hif.h new file +68 -0

68 lines not on this page · raw message

include/pfe_eth/pfe/cbus/hif_nocpy.h new file +40 -0
new file mode 100644
index 0000000..c2d6f6d
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2015-2016 Freescale Semiconductor, Inc.
+ * Copyright 2017 NXP
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#ifndef _HIF_NOCPY_H_
+#define _HIF_NOCPY_H_
+
+#define HIF_NOCPY_VERSION		(HIF_NOCPY_BASE_ADDR + 0x00)
+#define HIF_NOCPY_TX_CTRL		(HIF_NOCPY_BASE_ADDR + 0x04)
+#define HIF_NOCPY_TX_CURR_BD_ADDR	(HIF_NOCPY_BASE_ADDR + 0x08)
+#define HIF_NOCPY_TX_ALLOC		(HIF_NOCPY_BASE_ADDR + 0x0c)
+#define HIF_NOCPY_TX_BDP_ADDR		(HIF_NOCPY_BASE_ADDR + 0x10)
+#define HIF_NOCPY_TX_STATUS		(HIF_NOCPY_BASE_ADDR + 0x14)
+#define HIF_NOCPY_RX_CTRL		(HIF_NOCPY_BASE_ADDR + 0x20)
+#define HIF_NOCPY_RX_BDP_ADDR		(HIF_NOCPY_BASE_ADDR + 0x24)
+#define HIF_NOCPY_RX_STATUS		(HIF_NOCPY_BASE_ADDR + 0x30)
+#define HIF_NOCPY_INT_SRC		(HIF_NOCPY_BASE_ADDR + 0x34)
+#define HIF_NOCPY_INT_ENABLE		(HIF_NOCPY_BASE_ADDR + 0x38)
+#define HIF_NOCPY_POLL_CTRL		(HIF_NOCPY_BASE_ADDR + 0x3c)
+#define HIF_NOCPY_RX_CURR_BD_ADDR	(HIF_NOCPY_BASE_ADDR + 0x40)
+#define HIF_NOCPY_RX_ALLOC		(HIF_NOCPY_BASE_ADDR + 0x44)
+#define HIF_NOCPY_TX_DMA_STATUS		(HIF_NOCPY_BASE_ADDR + 0x48)
+#define HIF_NOCPY_RX_DMA_STATUS		(HIF_NOCPY_BASE_ADDR + 0x4c)
+#define HIF_NOCPY_RX_INQ0_PKTPTR	(HIF_NOCPY_BASE_ADDR + 0x50)
+#define HIF_NOCPY_RX_INQ1_PKTPTR	(HIF_NOCPY_BASE_ADDR + 0x54)
+#define HIF_NOCPY_TX_PORT_NO		(HIF_NOCPY_BASE_ADDR + 0x60)
+#define HIF_NOCPY_LMEM_ALLOC_ADDR	(HIF_NOCPY_BASE_ADDR + 0x64)
+#define HIF_NOCPY_CLASS_ADDR		(HIF_NOCPY_BASE_ADDR + 0x68)
+#define HIF_NOCPY_TMU_PORT0_ADDR	(HIF_NOCPY_BASE_ADDR + 0x70)
+#define HIF_NOCPY_TMU_PORT1_ADDR	(HIF_NOCPY_BASE_ADDR + 0x74)
+#define HIF_NOCPY_TMU_PORT2_ADDR	(HIF_NOCPY_BASE_ADDR + 0x7c)
+#define HIF_NOCPY_TMU_PORT3_ADDR	(HIF_NOCPY_BASE_ADDR + 0x80)
+#define HIF_NOCPY_TMU_PORT4_ADDR	(HIF_NOCPY_BASE_ADDR + 0x84)
+#define HIF_NOCPY_INT_COAL		(HIF_NOCPY_BASE_ADDR + 0x90)
+#define HIF_NOCPY_AXI_CTRL		(HIF_NOCPY_BASE_ADDR + 0x94)
+
+#endif /* _HIF_NOCPY_H_ */
include/pfe_eth/pfe/cbus/tmu_csr.h new file +148 -0

148 lines not on this page · raw message

include/pfe_eth/pfe/cbus/util_csr.h new file +47 -0

47 lines not on this page · raw message

include/pfe_eth/pfe/pfe_hw.h new file +163 -0

163 lines not on this page · raw message

include/pfe_eth/pfe_driver.h new file +59 -0

59 lines not on this page · raw message

include/pfe_eth/pfe_eth.h new file +104 -0

104 lines not on this page · raw message

include/pfe_eth/pfe_firmware.h new file +17 -0
new file mode 100644
index 0000000..588b2ae
@@ -0,0 +1,17 @@
+/*
+ * Copyright 2015-2016 Freescale Semiconductor, Inc.
+ * Copyright 2017 NXP
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+/** @file
+ *  Contains all the defines to handle parsing and loading of PE firmware files.
+ */
+#ifndef __PFE_FIRMWARE_H__
+#define __PFE_FIRMWARE_H__
+
+int pfe_firmware_init(void);
+void pfe_firmware_exit(void);
+
+#endif
include/pfe_eth/pfe_mdio.h new file +13 -0
new file mode 100644
index 0000000..ab27ec3
@@ -0,0 +1,13 @@
+/*
+ * Copyright 2015-2016 Freescale Semiconductor, Inc.
+ * Copyright 2017 NXP
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#ifndef _PFE_MDIO_H_
+#define _PFE_MDIO_H_
+
+int pfe_phy_configure(struct pfe_eth_dev *priv, int dev_id, int phy_id);
+
+#endif /* _PFE_MDIO_H_ */
Signature · 1 line
2.7.4
#10 lore raw

PATCH v2 5/13 drivers: net: pfe_eth: LS1012A PFE headers

Quoted 1 line · Calvin Johnson

Contains all the pfe header files.

Looks good, but I'd like to move the files.

Quoted 5 lines

---
Changes in v2:

Review

Quoted 9 lines
(quoted diff) +0 -7
-Add pfe_rx_done to clear bd after packet processing
-remove unused code under CONFIG_UTIL_PE_DISABLED
-Used BIT and GENMASK macros wherever applicable
-Removed generic definitions that pollutes namespace
-File names pfe.h renamed to pfe_hw.h to be more clear as it contains
 low level functions that directly access pfe hardware block
-Added pfe_dm_eth.h for new driver model
---
 include/dm/platform_data/pfe_dm_eth.h |  21 ++++

This is fine.

Quoted 10 lines
 include/pfe_eth/pfe/cbus.h            |  77 +++++++++++++++
 include/pfe_eth/pfe/cbus/bmu.h        |  40 ++++++++
 include/pfe_eth/pfe/cbus/class_csr.h  | 180 ++++++++++++++++++++++++++++++++++
 include/pfe_eth/pfe/cbus/emac.h       | 140 ++++++++++++++++++++++++++
 include/pfe_eth/pfe/cbus/gpi.h        |  62 ++++++++++++
 include/pfe_eth/pfe/cbus/hif.h        |  68 +++++++++++++
 include/pfe_eth/pfe/cbus/hif_nocpy.h  |  40 ++++++++
 include/pfe_eth/pfe/cbus/tmu_csr.h    | 148 ++++++++++++++++++++++++++++
 include/pfe_eth/pfe/cbus/util_csr.h   |  47 +++++++++
 include/pfe_eth/pfe/pfe_hw.h          | 163 ++++++++++++++++++++++++++++++

Please move these to include/net/pfe/*

Quoted 4 lines
 include/pfe_eth/pfe_driver.h          |  59 +++++++++++
 include/pfe_eth/pfe_eth.h             | 104 ++++++++++++++++++++
 include/pfe_eth/pfe_firmware.h        |  17 ++++
 include/pfe_eth/pfe_mdio.h            |  13 +++

Please move these to include/net/pfe/*

Quoted 8 lines
 15 files changed, 1179 insertions(+)
 create mode 100644 include/dm/platform_data/pfe_dm_eth.h
 create mode 100644 include/pfe_eth/pfe/cbus.h
 create mode 100644 include/pfe_eth/pfe/cbus/bmu.h
 create mode 100644 include/pfe_eth/pfe/cbus/class_csr.h
 create mode 100644 include/pfe_eth/pfe/cbus/emac.h
 create mode 100644 include/pfe_eth/pfe/cbus/gpi.h
 create mode 100644 include/pfe_eth/pfe/cbus/hif.h
Quoted 9 lines
 create mode 100644 include/pfe_eth/pfe/cbus/hif_nocpy.h
 create mode 100644 include/pfe_eth/pfe/cbus/tmu_csr.h
 create mode 100644 include/pfe_eth/pfe/cbus/util_csr.h
 create mode 100644 include/pfe_eth/pfe/pfe_hw.h
 create mode 100644 include/pfe_eth/pfe_driver.h
 create mode 100644 include/pfe_eth/pfe_eth.h
 create mode 100644 include/pfe_eth/pfe_firmware.h
 create mode 100644 include/pfe_eth/pfe_mdio.h

Thanks,
-Joe

#11 lore raw

PATCH v2 6/13 board: freescale: ls1012aqds: enable network support on ls1012aqds

In reply to Calvin Johnson

This patch enables ethernet support for ls1012aqds.

---
Changes in v2:
-split from original patch "board: freescale: ls1012a: enable network support on ls1012a platforms"

---
 board/freescale/ls1012aqds/Kconfig            |  14 ++
 board/freescale/ls1012aqds/Makefile           |   1 +
 board/freescale/ls1012aqds/eth.c              | 304 ++++++++++++++++++++++++++
 board/freescale/ls1012aqds/ls1012aqds.c       |  97 +++++++-
 board/freescale/ls1012aqds/ls1012aqds_pfe.h   |  48 ++++
 board/freescale/ls1012aqds/ls1012aqds_qixis.h |   2 +-
 6 files changed, 459 insertions(+), 7 deletions(-)
 create mode 100644 board/freescale/ls1012aqds/eth.c
 create mode 100644 board/freescale/ls1012aqds/ls1012aqds_pfe.h
board/freescale/ls1012aqds/Kconfig +14 -0
index fc9250b..e6c2aa2 100644
@@ -12,6 +12,20 @@ config SYS_SOC
 config SYS_CONFIG_NAME
 	default "ls1012aqds"
 
+if FSL_PFE
+config SYS_LS_PFE_FW_ADDR
+	hex "Flash address of PFE firmware"
+	default 0x40a00000
+
+config DDR_PFE_PHYS_BASEADDR
+	hex "PFE DDR physical base address"
+	default 0x03800000
+
+config DDR_PFE_BASEADDR
+	hex "PFE DDR base address"
+	default 0x83800000
+endif
+
 source "board/freescale/common/Kconfig"
 
 endif
board/freescale/ls1012aqds/Makefile +1 -0
index 0b813f9..b18494a 100644
@@ -5,3 +5,4 @@
 #
 
 obj-y += ls1012aqds.o
+obj-y += eth.o
board/freescale/ls1012aqds/eth.c new file +304 -0

304 lines not on this page · raw message

board/freescale/ls1012aqds/ls1012aqds.c +91 -6

123 lines not on this page · raw message

board/freescale/ls1012aqds/ls1012aqds_pfe.h new file +48 -0

48 lines not on this page · raw message

board/freescale/ls1012aqds/ls1012aqds_qixis.h +1 -1
index 584f604..7a1ba3d 100644
@@ -11,7 +11,7 @@
 
 /* BRDCFG4[4:7] select EC1 and EC2 as a pair */
 #define BRDCFG4_EMISEL_MASK		0xe0
-#define BRDCFG4_EMISEL_SHIFT		5
+#define BRDCFG4_EMISEL_SHIFT		6
 
 /* SYSCLK */
 #define QIXIS_SYSCLK_66			0x0
Signature · 1 line
2.7.4
#12 lore raw

PATCH v2 6/13 board: freescale: ls1012aqds: enable network support on ls1012aqds

Quoted 19 lines · Calvin Johnson

This patch enables ethernet support for ls1012aqds.

---
Changes in v2:
-split from original patch "board: freescale: ls1012a: enable network support on ls1012a platforms"

---
 board/freescale/ls1012aqds/Kconfig            |  14 ++
 board/freescale/ls1012aqds/Makefile           |   1 +
 board/freescale/ls1012aqds/eth.c              | 304 ++++++++++++++++++++++++++
 board/freescale/ls1012aqds/ls1012aqds.c       |  97 +++++++-
 board/freescale/ls1012aqds/ls1012aqds_pfe.h   |  48 ++++
 board/freescale/ls1012aqds/ls1012aqds_qixis.h |   2 +-
 6 files changed, 459 insertions(+), 7 deletions(-)
 create mode 100644 board/freescale/ls1012aqds/eth.c
 create mode 100644 board/freescale/ls1012aqds/ls1012aqds_pfe.h

[ ... ]

Quoted 5 lines
board/freescale/ls1012aqds/eth.c new file +0 -0
new file mode 100644
index 0000000..41d077a

[ ... ]

Quoted 34 lines
board/freescale/ls1012aqds/eth.c new file +34 -0
+int pfe_eth_board_init(struct udevice *dev)
+{
+       static int init_done;
+       struct mii_dev *bus;
+       static const char *mdio_name;
+       struct pfe_mdio_info mac_mdio_info;
+       struct ccsr_gur __iomem *gur = (void *)CONFIG_SYS_FSL_GUTS_ADDR;
+       u8 data8;
+       struct pfe_eth_dev *priv = dev_get_priv(dev);
+
+       int srds_s1 = in_be32(&gur->rcwsr[4]) &
+                       FSL_CHASSIS2_RCWSR4_SRDS1_PRTCL_MASK;
+       srds_s1 >>= FSL_CHASSIS2_RCWSR4_SRDS1_PRTCL_SHIFT;
+
+       ls1012aqds_mux_mdio(EMI1_SLOT1);
+
+       if (!init_done) {
+               mac_mdio_info.reg_base = (void *)EMAC1_BASE_ADDR;
+               mac_mdio_info.name = DEFAULT_PFE_MDIO_NAME;
+
+               bus = pfe_mdio_init(&mac_mdio_info);
+               if (!bus) {
+                       printf("Failed to register mdio\n");
+                       return -1;
+               }
+               init_done = 1;
+       }
+
+       if (priv->gemac_port) {
+               mac_mdio_info.reg_base = (void *)EMAC2_BASE_ADDR;
+               mac_mdio_info.name = DEFAULT_PFE_MDIO1_NAME;
+
+               bus = pfe_mdio_init(&mac_mdio_info);
+               if (!bus) {

board/freescale/ls1012aqds/eth.c line 173

Quoted 10 lines
board/freescale/ls1012aqds/eth.c new file +10 -0
+                       printf("Failed to register mdio\n");
+                       return -1;
+               }
+       }
+
+       switch (srds_s1) {
+       case 0x3508:
+               printf("ls1012aqds:supported SerDes PRCTL= %d\n", srds_s1);
+#ifdef RGMII_RESET_WA
+               /* Work around for FPGA registers initialization

Please use the normal multi-line comment style where the first /* stands alone.

Quoted 13 lines
board/freescale/ls1012aqds/eth.c new file +13 -0
+                * This is needed for RGMII to work.
+                */
+               printf("Reset RGMII WA....\n");
+               data8 = QIXIS_READ(rst_frc[0]);
+               data8 |= 0x2;
+               QIXIS_WRITE(rst_frc[0], data8);
+               data8 = QIXIS_READ(rst_frc[0]);
+
+               data8 = QIXIS_READ(res8[6]);
+               data8 |= 0xff;
+               QIXIS_WRITE(res8[6], data8);
+               data8 = QIXIS_READ(res8[6]);
+#endif

[ ... ]

Quoted 30 lines
board/freescale/ls1012aqds/ls1012aqds_pfe.h new file +24 -0
new file mode 100644
index 0000000..c279ef3
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2017 NXP
+ *
+ * SPDX-License-Identifier:     GPL-2.0+
+ */
+
+#define ETH_1_1G_BUS_ID                0x1
+#define ETH_1_1G_PHY_ID                0x1e
+#define ETH_1_1G_MDIO_MUX      0x2
+#define ETH_1G_MDIO_PHY_MASK   0xBFFFFFFD
+#define ETH_1_1G_PHY_MODE      "sgmii"
+#define ETH_2_1G_BUS_ID                0x1
+#define ETH_2_1G_PHY_ID                0x1
+#define ETH_2_1G_MDIO_MUX      0x1
+#define ETH_2_1G_PHY_MODE      "rgmii"
+
+#define ETH_1_2_5G_BUS_ID      0x0
+#define ETH_1_2_5G_PHY_ID      0x1
+#define ETH_1_2_5G_MDIO_MUX    0x2
+#define ETH_2_5G_MDIO_PHY_MASK 0xFFFFFFF9
+#define ETH_2_5G_PHY_MODE      "sgmii-2500"
+#define ETH_2_2_5G_BUS_ID      0x1
+#define ETH_2_2_5G_PHY_ID      0x2
+#define ETH_2_2_5G_MDIO_MUX    0x3

board/freescale/ls1012aqds/ls1012aqds_pfe.h line 34

Quoted 10 lines
board/freescale/ls1012aqds/ls1012aqds_pfe.h new file +10 -0
+
+#define SERDES_1_G_PROTOCOL    0x3508
+#define SERDES_2_5_G_PROTOCOL  0x2205
+
+#define PFE_PROP_LEN           4
+
+#define ETH_1_SOC_PATH         "/soc/pfe at 04000000/ethernet at 0"
+#define ETH_1_PATH             "/pfe at 04000000/ethernet at 0"
+#define ETH_2_SOC_PATH         "/soc/pfe at 04000000/ethernet at 1"
+#define ETH_2_PATH             "/pfe at 04000000/ethernet at 1"

Seems like you could easily define *_SOC_PATH in terms of *_PATH

like:

#define ETH_1_PATH "/pfe at 04000000/ethernet at 0"
#define ETH_1_SOC_PATH "/soc" ETH_1_PATH

Quoted 34 lines
board/freescale/ls1012aqds/ls1012aqds_pfe.h new file +14 -0
+
+#define ETH_1_MDIO_SOC_PATH    "/soc/pfe at 04000000/ethernet at 0/mdio at 0"
+#define ETH_1_MDIO             "/pfe at 04000000/ethernet at 0/mdio at 0"
+#define ETH_2_MDIO_SOC_PATH    "/soc/pfe at 04000000/ethernet at 1/mdio at 0"
+#define ETH_2_MDIO             "/pfe at 04000000/ethernet at 1/mdio at 0"
+
+#define NUM_ETH_NODE           2
+struct pfe_prop_val {
+       int busid;
+       int phyid;
+       int mux_val;
+       int phy_mask;
+       char *phy_mode;
+};
board/freescale/ls1012aqds/ls1012aqds_qixis.h +1 -2
index 584f604..7a1ba3d 100644
@@ -11,7 +11,7 @@
 
 /* BRDCFG4[4:7] select EC1 and EC2 as a pair */
 #define BRDCFG4_EMISEL_MASK            0xe0
-#define BRDCFG4_EMISEL_SHIFT           5
+#define BRDCFG4_EMISEL_SHIFT           6
 
 /* SYSCLK */
 #define QIXIS_SYSCLK_66                        0x0
--

2.7.4

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

#13 lore raw

PATCH v2 6/13 board: freescale: ls1012aqds: enable network support on ls1012aqds

In reply to Calvin Johnson
Quoted 8 lines · Calvin Johnson

This patch enables ethernet support for ls1012aqds.

---
Changes in v2:
-split from original patch "board: freescale: ls1012a: enable network support on ls1012a platforms"

FYI, this doesn't apply cleanly as of today. Please be sure to rebase the series before next version.

Thanks,
-Joe

#14 lore raw

PATCH v2 7/13 board: freescale: ls1012afrdm: enable network support on ls1012afrdm

In reply to Calvin Johnson

This patch enables ethernet support for ls1012afrdm.

---
Changes in v2:
-split from original patch "board: freescale: ls1012a: enable network support on ls1012a platforms"

---
 board/freescale/ls1012afrdm/Kconfig       |  14 ++++
 board/freescale/ls1012afrdm/Makefile      |   1 +
 board/freescale/ls1012afrdm/eth.c         | 122 ++++++++++++++++++++++++++++++
 board/freescale/ls1012afrdm/ls1012afrdm.c |   5 --
 4 files changed, 137 insertions(+), 5 deletions(-)
 create mode 100644 board/freescale/ls1012afrdm/eth.c
board/freescale/ls1012afrdm/Kconfig +14 -0
index 38bd91b..ad6666b 100644
@@ -12,6 +12,20 @@ config SYS_SOC
 config SYS_CONFIG_NAME
 	default "ls1012afrdm"
 
+if FSL_PFE
+config SYS_LS_PFE_FW_ADDR
+	hex "Flash address of PFE firmware"
+	default 0x40a00000
+
+config DDR_PFE_PHYS_BASEADDR
+	hex "PFE DDR physical base address"
+	default 0x03800000
+
+config DDR_PFE_BASEADDR
+	hex "PFE DDR base address"
+	default 0x83800000
+endif
+
 source "board/freescale/common/Kconfig"
 
 endif
board/freescale/ls1012afrdm/Makefile +1 -0
index dbfa2ce..1364f22 100644
@@ -5,3 +5,4 @@
 #
 
 obj-y += ls1012afrdm.o
+obj-y += eth.o
board/freescale/ls1012afrdm/eth.c new file +122 -0

122 lines not on this page · raw message

board/freescale/ls1012afrdm/ls1012afrdm.c +0 -5
index 9afd1c4..0145886 100644
@@ -57,11 +57,6 @@ int dram_init(void)
 	return 0;
 }
 
-int board_eth_init(bd_t *bis)
-{
-	return pci_eth_init(bis);
-}
-
 int board_early_init_f(void)
 {
 	fsl_lsch2_early_init_f();
Signature · 1 line
2.7.4
#16 lore raw

PATCH v2 8/13 board: freescale: ls1012ardb: enable network support on ls1012ardb

In reply to Calvin Johnson

This patch enables ethernet support for ls1012ardb.

---
Changes in v2:
-split from original patch "board: freescale: ls1012a: enable network support on ls1012a platforms"

---
 board/freescale/ls1012ardb/Kconfig      |  14 +++++
 board/freescale/ls1012ardb/Makefile     |   1 +
 board/freescale/ls1012ardb/eth.c        | 106 ++++++++++++++++++++++++++++++++
 board/freescale/ls1012ardb/ls1012ardb.c |   4 --
 include/configs/ls1012ardb.h            |   4 ++
 5 files changed, 125 insertions(+), 4 deletions(-)
 create mode 100644 board/freescale/ls1012ardb/eth.c
board/freescale/ls1012ardb/Kconfig +14 -0
index d13b08e..6e6197a 100644
@@ -12,6 +12,20 @@ config SYS_SOC
 config SYS_CONFIG_NAME
 	default "ls1012ardb"
 
+if FSL_PFE
+config SYS_LS_PFE_FW_ADDR
+	hex "Flash address of PFE firmware"
+	default 0x40a00000
+
+config DDR_PFE_PHYS_BASEADDR
+	hex "PFE DDR physical base address"
+	default 0x03800000
+
+config DDR_PFE_BASEADDR
+	hex "PFE DDR base address"
+	default 0x83800000
+endif
+
 source "board/freescale/common/Kconfig"
 
 endif
board/freescale/ls1012ardb/Makefile +1 -0
index 05fa9d9..bd80ce5 100644
@@ -5,3 +5,4 @@
 #
 
 obj-y += ls1012ardb.o
+obj-y += eth.o
board/freescale/ls1012ardb/eth.c new file +106 -0

106 lines not on this page · raw message

board/freescale/ls1012ardb/ls1012ardb.c +0 -4
index c9557bb..ed5a8e6 100644
@@ -114,10 +114,6 @@ int dram_init(void)
 	return 0;
 }
 
-int board_eth_init(bd_t *bis)
-{
-	return pci_eth_init(bis);
-}
 
 int board_early_init_f(void)
 {
include/configs/ls1012ardb.h +4 -0
index 438b5a6..ced6c5e 100644
@@ -25,6 +25,7 @@
  */
 
 #define I2C_MUX_IO_ADDR		0x24
+#define I2C_MUX_IO2_ADDR	0x25
 #define I2C_MUX_IO_0		0
 #define I2C_MUX_IO_1		1
 #define SW_BOOT_MASK		0x03
@@ -39,6 +40,9 @@
 #define SW_REV_C2		0xD8
 #define SW_REV_D		0xD0
 #define SW_REV_E		0xC8
+#define __PHY_MASK		0xF9
+#define __PHY_ETH2_MASK		0xFB
+#define __PHY_ETH1_MASK		0xFD
 
 /*  MMC  */
 #ifdef CONFIG_MMC
Signature · 1 line
2.7.4
#18 lore raw

PATCH v2 9/13 board: freescale: ls1012a2g5rdb: enable network support on ls1012a2g5rdb

In reply to Calvin Johnson

This patch enables ethernet support for ls1012a2g5rdb.

---
Changes in v2:
-New patch added to series to enable ethernet support for ls1012a2g5rdb

---
 board/freescale/ls1012ardb/Kconfig | 14 ++++++++++++++
 board/freescale/ls1012ardb/eth.c   | 25 +++++++++++++++++++++++++
 2 files changed, 39 insertions(+)
board/freescale/ls1012ardb/Kconfig +14 -0
index 6e6197a..4bb672c 100644
@@ -44,6 +44,20 @@ config SYS_SOC
 config SYS_CONFIG_NAME
         default "ls1012a2g5rdb"
 
+if FSL_PFE
+config SYS_LS_PFE_FW_ADDR
+	hex "Flash address of PFE firmware"
+	default 0x40a00000
+
+config DDR_PFE_PHYS_BASEADDR
+	hex "PFE DDR physical base address"
+	default 0x03800000
+
+config DDR_PFE_BASEADDR
+	hex "PFE DDR base address"
+	default 0x83800000
+endif
+
 source "board/freescale/common/Kconfig"
 
 endif
board/freescale/ls1012ardb/eth.c +25 -0
index bf67590..fc062cf 100644
@@ -26,6 +26,7 @@
 
 static inline void ls1012ardb_reset_phy(void)
 {
+#ifdef CONFIG_TARGET_LS1012ARDB
 	/* Through reset IO expander reset both RGMII and SGMII PHYs */
 	i2c_reg_write(I2C_MUX_IO2_ADDR, 6, __PHY_MASK);
 	i2c_reg_write(I2C_MUX_IO2_ADDR, 2, __PHY_ETH2_MASK);
@@ -34,6 +35,7 @@ static inline void ls1012ardb_reset_phy(void)
 	mdelay(10);
 	i2c_reg_write(I2C_MUX_IO2_ADDR, 2, 0xFF);
 	mdelay(50);
+#endif
 }
 
 int pfe_eth_board_init(struct udevice *dev)
@@ -42,6 +44,11 @@ int pfe_eth_board_init(struct udevice *dev)
 	struct mii_dev *bus;
 	struct pfe_mdio_info mac_mdio_info;
 	struct pfe_eth_dev *priv = dev_get_priv(dev);
+	struct ccsr_gur __iomem *gur = (void *)CONFIG_SYS_FSL_GUTS_ADDR;
+
+	int srds_s1 = in_be32(&gur->rcwsr[4]) &
+			FSL_CHASSIS2_RCWSR4_SRDS1_PRTCL_MASK;
+	srds_s1 >>= FSL_CHASSIS2_RCWSR4_SRDS1_PRTCL_SHIFT;
 
 	if (!init_done) {
 		ls1012ardb_reset_phy();
@@ -59,6 +66,8 @@ int pfe_eth_board_init(struct udevice *dev)
 	pfe_set_mdio(priv->gemac_port,
 		     miiphy_get_dev_by_name(DEFAULT_PFE_MDIO_NAME));
 
+	switch (srds_s1) {
+	case 0x3508:
 	if (!priv->gemac_port) {
 		/* MAC1 */
 		pfe_set_phy_address_mode(priv->gemac_port, EMAC1_PHY_ADDR,
@@ -68,6 +77,22 @@ int pfe_eth_board_init(struct udevice *dev)
 		pfe_set_phy_address_mode(priv->gemac_port, EMAC2_PHY_ADDR,
 					 PHY_INTERFACE_MODE_RGMII_TXID);
 	}
+		break;
+	case 0x2208:
+	if (!priv->gemac_port) {
+		/* MAC1 */
+		pfe_set_phy_address_mode(priv->gemac_port, EMAC1_PHY_ADDR,
+					 PHY_INTERFACE_MODE_SGMII_2500);
+	} else {
+		/* MAC2 */
+		pfe_set_phy_address_mode(priv->gemac_port, EMAC2_PHY_ADDR,
+					 PHY_INTERFACE_MODE_SGMII_2500);
+	}
+		break;
+	default:
+		printf("unsupported SerDes PRCTL= %d\n", srds_s1);
+		break;
+	}
 	return 0;
 }
 
Signature · 1 line
2.7.4
#19 lore raw

PATCH v2 9/13 board: freescale: ls1012a2g5rdb: enable network support on ls1012a2g5rdb

Quoted 71 lines · Calvin Johnson

This patch enables ethernet support for ls1012a2g5rdb.

---
Changes in v2:
-New patch added to series to enable ethernet support for ls1012a2g5rdb

---
 board/freescale/ls1012ardb/Kconfig | 14 ++++++++++++++
 board/freescale/ls1012ardb/eth.c   | 25 +++++++++++++++++++++++++
 2 files changed, 39 insertions(+)
board/freescale/ls1012ardb/Kconfig +14 -0
index 6e6197a..4bb672c 100644
@@ -44,6 +44,20 @@ config SYS_SOC
 config SYS_CONFIG_NAME
         default "ls1012a2g5rdb"
 
+if FSL_PFE
+config SYS_LS_PFE_FW_ADDR
+       hex "Flash address of PFE firmware"
+       default 0x40a00000
+
+config DDR_PFE_PHYS_BASEADDR
+       hex "PFE DDR physical base address"
+       default 0x03800000
+
+config DDR_PFE_BASEADDR
+       hex "PFE DDR base address"
+       default 0x83800000
+endif
+
 source "board/freescale/common/Kconfig"
 
 endif
board/freescale/ls1012ardb/eth.c +7 -0
index bf67590..fc062cf 100644
@@ -26,6 +26,7 @@
 
 static inline void ls1012ardb_reset_phy(void)
 {
+#ifdef CONFIG_TARGET_LS1012ARDB
        /* Through reset IO expander reset both RGMII and SGMII PHYs */
        i2c_reg_write(I2C_MUX_IO2_ADDR, 6, __PHY_MASK);
        i2c_reg_write(I2C_MUX_IO2_ADDR, 2, __PHY_ETH2_MASK);
@@ -34,6 +35,7 @@ static inline void ls1012ardb_reset_phy(void)
        mdelay(10);
        i2c_reg_write(I2C_MUX_IO2_ADDR, 2, 0xFF);
        mdelay(50);
+#endif
 }
 
 int pfe_eth_board_init(struct udevice *dev)
@@ -42,6 +44,11 @@ int pfe_eth_board_init(struct udevice *dev)
        struct mii_dev *bus;
        struct pfe_mdio_info mac_mdio_info;
        struct pfe_eth_dev *priv = dev_get_priv(dev);
+       struct ccsr_gur __iomem *gur = (void *)CONFIG_SYS_FSL_GUTS_ADDR;
+
+       int srds_s1 = in_be32(&gur->rcwsr[4]) &
+                       FSL_CHASSIS2_RCWSR4_SRDS1_PRTCL_MASK;
+       srds_s1 >>= FSL_CHASSIS2_RCWSR4_SRDS1_PRTCL_SHIFT;
 
        if (!init_done) {
                ls1012ardb_reset_phy();

board/freescale/ls1012ardb/eth.c int pfe_eth_board_init(struct udevice *dev) · line 71

Quoted 6 lines
board/freescale/ls1012ardb/eth.c +2 -0
@@ -59,6 +66,8 @@ int pfe_eth_board_init(struct udevice *dev)
        pfe_set_mdio(priv->gemac_port,
                     miiphy_get_dev_by_name(DEFAULT_PFE_MDIO_NAME));
 
+       switch (srds_s1) {
+       case 0x3508:
        if (!priv->gemac_port) {

This needs to be indented.

board/freescale/ls1012ardb/eth.c int pfe_eth_board_init(struct udevice *dev) · line 82

Quoted 9 lines
board/freescale/ls1012ardb/eth.c +3 -0
                /* MAC1 */
                pfe_set_phy_address_mode(priv->gemac_port, EMAC1_PHY_ADDR,
@@ -68,6 +77,22 @@ int pfe_eth_board_init(struct udevice *dev)
                pfe_set_phy_address_mode(priv->gemac_port, EMAC2_PHY_ADDR,
                                         PHY_INTERFACE_MODE_RGMII_TXID);
        }
+               break;
+       case 0x2208:
+       if (!priv->gemac_port) {

This indentation needs to be fixed.

Quoted 23 lines
board/freescale/ls1012ardb/eth.c +13 -1
+               /* MAC1 */
+               pfe_set_phy_address_mode(priv->gemac_port, EMAC1_PHY_ADDR,
+                                        PHY_INTERFACE_MODE_SGMII_2500);
+       } else {
+               /* MAC2 */
+               pfe_set_phy_address_mode(priv->gemac_port, EMAC2_PHY_ADDR,
+                                        PHY_INTERFACE_MODE_SGMII_2500);
+       }
+               break;
+       default:
+               printf("unsupported SerDes PRCTL= %d\n", srds_s1);
+               break;
+       }
        return 0;
 }
 
--

2.7.4

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

#20 lore raw

PATCH v2 10/13 armv8: fsl-lsch2: add pfe macros and update ccsr_scfg structure

In reply to Calvin Johnson

SoC specific PFE macros are defined and structure ccsr_scfg is updated with members defined for PFE.

---
Changes in v2: None

---
 .../include/asm/arch-fsl-layerscape/immap_lsch2.h  | 38 ++++++++++++++++++++--
 1 file changed, 36 insertions(+), 2 deletions(-)
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h +36 -2
index b195005..e1a57de 100644
@@ -395,6 +395,21 @@ struct ccsr_gur {
 #define SCFG_SNPCNFGCR_SATARDSNP	0x00800000
 #define SCFG_SNPCNFGCR_SATAWRSNP	0x00400000
 
+/* RGMIIPCR bit definitions*/
+#define SCFG_RGMIIPCR_EN_AUTO		(0x00000008)
+#define SCFG_RGMIIPCR_SETSP_1000M	(0x00000004)
+#define SCFG_RGMIIPCR_SETSP_100M	(0x00000000)
+#define SCFG_RGMIIPCR_SETSP_10M		(0x00000002)
+#define SCFG_RGMIIPCR_SETFD		(0x00000001)
+
+/*PFEASBCR bit definitions */
+#define SCFG_PFEASBCR_ARCACHE0		(0x80000000)
+#define SCFG_PFEASBCR_AWCACHE0		(0x40000000)
+#define SCFG_PFEASBCR_ARCACHE1		(0x20000000)
+#define SCFG_PFEASBCR_AWCACHE1		(0x10000000)
+#define SCFG_PFEASBCR_ARSNP		(0x08000000)
+#define SCFG_PFEASBCR_AWSNP		(0x04000000)
+
 /* Supplemental Configuration Unit */
 struct ccsr_scfg {
 	u8 res_000[0x100-0x000];
@@ -412,7 +427,12 @@ struct ccsr_scfg {
 	u8 res_140[0x158-0x140];
 	u32 altcbar;
 	u32 qspi_cfg;
-	u8 res_160[0x180-0x160];
+	u8 res_160[0x164 - 0x160];
+	u32 wr_qos1;
+	u32 wr_qos2;
+	u32 rd_qos1;
+	u32 rd_qos2;
+	u8 res_174[0x180 - 0x174];
 	u32 dmamcr;
 	u8 res_184[0x188-0x184];
 	u32 gic_align;
@@ -443,7 +463,21 @@ struct ccsr_scfg {
 	u32 usb_refclk_selcr1;
 	u32 usb_refclk_selcr2;
 	u32 usb_refclk_selcr3;
-	u8 res_424[0x600-0x424];
+	u8 res_424[0x434 - 0x424];
+	u32 rgmiipcr;
+	u32 res_438;
+	u32 rgmiipsr;
+	u32 pfepfcssr1;
+	u32 pfeintencr1;
+	u32 pfepfcssr2;
+	u32 pfeintencr2;
+	u32 pfeerrcr;
+	u32 pfeeerrintencr;
+	u32 pfeasbcr;
+	u32 pfebsbcr;
+	u8 res_460[0x484 - 0x460];
+	u32 mdioselcr;
+	u8 res_468[0x600 - 0x488];
 	u32 scratchrw[4];
 	u8 res_610[0x680-0x610];
 	u32 corebcr;
Signature · 1 line
2.7.4
#21 lore raw

PATCH v2 10/13 armv8: fsl-lsch2: add pfe macros and update ccsr_scfg structure

Quoted 23 lines · Calvin Johnson

SoC specific PFE macros are defined and structure ccsr_scfg is updated with members defined for PFE.

---
Changes in v2: None

---
 .../include/asm/arch-fsl-layerscape/immap_lsch2.h  | 38 ++++++++++++++++++++--
 1 file changed, 36 insertions(+), 2 deletions(-)
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h +4 -0
index b195005..e1a57de 100644
@@ -395,6 +395,21 @@ struct ccsr_gur {
 #define SCFG_SNPCNFGCR_SATARDSNP       0x00800000
 #define SCFG_SNPCNFGCR_SATAWRSNP       0x00400000
 
+/* RGMIIPCR bit definitions*/
+#define SCFG_RGMIIPCR_EN_AUTO          (0x00000008)
+#define SCFG_RGMIIPCR_SETSP_1000M      (0x00000004)
+#define SCFG_RGMIIPCR_SETSP_100M       (0x00000000)

arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h struct ccsr_gur { · line 411

Quoted 10 lines
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h +10 -0
+#define SCFG_RGMIIPCR_SETSP_10M                (0x00000002)
+#define SCFG_RGMIIPCR_SETFD            (0x00000001)
+
+/*PFEASBCR bit definitions */
+#define SCFG_PFEASBCR_ARCACHE0         (0x80000000)
+#define SCFG_PFEASBCR_AWCACHE0         (0x40000000)
+#define SCFG_PFEASBCR_ARCACHE1         (0x20000000)
+#define SCFG_PFEASBCR_AWCACHE1         (0x10000000)
+#define SCFG_PFEASBCR_ARSNP            (0x08000000)
+#define SCFG_PFEASBCR_AWSNP            (0x04000000)

I thought you were switching to using the BIT() macro.

Quoted 48 lines
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h +22 -3
+
 /* Supplemental Configuration Unit */
 struct ccsr_scfg {
        u8 res_000[0x100-0x000];
@@ -412,7 +427,12 @@ struct ccsr_scfg {
        u8 res_140[0x158-0x140];
        u32 altcbar;
        u32 qspi_cfg;
-       u8 res_160[0x180-0x160];
+       u8 res_160[0x164 - 0x160];
+       u32 wr_qos1;
+       u32 wr_qos2;
+       u32 rd_qos1;
+       u32 rd_qos2;
+       u8 res_174[0x180 - 0x174];
        u32 dmamcr;
        u8 res_184[0x188-0x184];
        u32 gic_align;
@@ -443,7 +463,21 @@ struct ccsr_scfg {
        u32 usb_refclk_selcr1;
        u32 usb_refclk_selcr2;
        u32 usb_refclk_selcr3;
-       u8 res_424[0x600-0x424];
+       u8 res_424[0x434 - 0x424];
+       u32 rgmiipcr;
+       u32 res_438;
+       u32 rgmiipsr;
+       u32 pfepfcssr1;
+       u32 pfeintencr1;
+       u32 pfepfcssr2;
+       u32 pfeintencr2;
+       u32 pfeerrcr;
+       u32 pfeeerrintencr;
+       u32 pfeasbcr;
+       u32 pfebsbcr;
+       u8 res_460[0x484 - 0x460];
+       u32 mdioselcr;
+       u8 res_468[0x600 - 0x488];
        u32 scratchrw[4];
        u8 res_610[0x680-0x610];
        u32 corebcr;
--

2.7.4

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

#22 lore raw

PATCH v2 11/13 armv8: fsl-lsch2: configure pfe's DDR and HDBUS interfaces and ECC

In reply to Calvin Johnson

1. Set AWCACHE0 attribute of PFE DDR and HDBUS master interfaces to bufferable.
2. Set RD/WR QoS for PFE DDR and HDBUS AXI master interfaces.
3. Disable ECC detection for PFE.

---
Changes in v2:
-Improved commit message to provide more description -Replaced magic numbers with proper definitions

---
 arch/arm/cpu/armv8/fsl-layerscape/soc.c            | 23 ++++++++++++++++++++++
 .../include/asm/arch-fsl-layerscape/immap_lsch2.h  | 12 ++++++++++-
 arch/arm/include/asm/arch-fsl-layerscape/soc.h     |  3 +++
 3 files changed, 37 insertions(+), 1 deletion(-)
arch/arm/cpu/armv8/fsl-layerscape/soc.c +23 -0
index b9f837d..18fb937 100644
@@ -612,6 +612,29 @@ int setup_chip_volt(void)
 	return 0;
 }
 
+#ifdef CONFIG_FSL_PFE
+void init_pfe_scfg_dcfg_regs(void)
+{
+	struct ccsr_scfg *scfg = (struct ccsr_scfg *)CONFIG_SYS_FSL_SCFG_ADDR;
+	u32 ecccr2;
+
+	out_be32(&scfg->pfeasbcr,
+		 in_be32(&scfg->pfeasbcr) | SCFG_PFEASBCR_AWCACHE0);
+	out_be32(&scfg->pfebsbcr,
+		 in_be32(&scfg->pfebsbcr) | SCFG_PFEASBCR_AWCACHE0);
+
+	/* CCI-400 QoS settings for PFE */
+	out_be32(&scfg->wr_qos1, (unsigned int)(SCFG_WR_QOS1_PFE1_QOS
+		 | SCFG_WR_QOS1_PFE2_QOS));
+	out_be32(&scfg->rd_qos1, (unsigned int)(SCFG_RD_QOS1_PFE1_QOS
+		 | SCFG_RD_QOS1_PFE2_QOS));
+
+	ecccr2 = in_be32(CONFIG_SYS_DCSR_DCFG_ADDR + DCFG_DCSR_ECCCR2);
+	out_be32((void *)CONFIG_SYS_DCSR_DCFG_ADDR + DCFG_DCSR_ECCCR2,
+		 ecccr2 | (unsigned int)DISABLE_PFE_ECC);
+}
+#endif
+
 void fsl_lsch2_early_init_f(void)
 {
 	struct ccsr_cci400 *cci = (struct ccsr_cci400 *)(CONFIG_SYS_IMMR +
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h +11 -1
index e1a57de..11cf35c 100644
@@ -205,6 +205,8 @@ struct sys_info {
 
 /* Device Configuration and Pin Control */
 #define DCFG_DCSR_PORCR1		0x0
+#define DCFG_DCSR_ECCCR2		0x524
+#define DISABLE_PFE_ECC			BIT(13)
 
 struct ccsr_gur {
 	u32     porsr1;         /* POR status 1 */
@@ -402,7 +404,7 @@ struct ccsr_gur {
 #define SCFG_RGMIIPCR_SETSP_10M		(0x00000002)
 #define SCFG_RGMIIPCR_SETFD		(0x00000001)
 
-/*PFEASBCR bit definitions */
+/* PFEASBCR bit definitions */
 #define SCFG_PFEASBCR_ARCACHE0		(0x80000000)
 #define SCFG_PFEASBCR_AWCACHE0		(0x40000000)
 #define SCFG_PFEASBCR_ARCACHE1		(0x20000000)
@@ -410,6 +412,14 @@ struct ccsr_gur {
 #define SCFG_PFEASBCR_ARSNP		(0x08000000)
 #define SCFG_PFEASBCR_AWSNP		(0x04000000)
 
+/* WR_QoS1 PFE bit definitions */
+#define SCFG_WR_QOS1_PFE1_QOS		GENMASK(27, 24)
+#define SCFG_WR_QOS1_PFE2_QOS		GENMASK(23, 20)
+
+/* RD_QoS1 PFE bit definitions */
+#define SCFG_RD_QOS1_PFE1_QOS		GENMASK(27, 24)
+#define SCFG_RD_QOS1_PFE2_QOS		GENMASK(23, 20)
+
 /* Supplemental Configuration Unit */
 struct ccsr_scfg {
 	u8 res_000[0x100-0x000];
arch/arm/include/asm/arch-fsl-layerscape/soc.h +3 -0
index cb760b5..d9bfddb 100644
@@ -127,6 +127,9 @@ void fsl_lsch2_early_init_f(void);
 int setup_chip_volt(void);
 /* Setup core vdd in unit mV */
 int board_setup_core_volt(u32 vdd);
+#ifdef CONFIG_FSL_PFE
+void init_pfe_scfg_dcfg_regs(void);
+#endif
 #endif
 
 void cpu_name(char *name);
Signature · 1 line
2.7.4
#24 lore raw

PATCH v2 12/13 armv8: layerscape: csu: enable ns access to PFE registers

In reply to Calvin Johnson

Enable all types of non-secure access to PFE block registers.

---
Changes in v2:
-Improved commit message to provide more description

---
 arch/arm/include/asm/arch-fsl-layerscape/ns_access.h | 2 ++
 1 file changed, 2 insertions(+)
arch/arm/include/asm/arch-fsl-layerscape/ns_access.h +2 -0
index f46f1d8..fe97a93 100644
@@ -26,6 +26,7 @@ enum csu_cslx_ind {
 	CSU_CSLX_PCIE3_IO,
 	CSU_CSLX_USB3 = 20,
 	CSU_CSLX_USB2,
+	CSU_CSLX_PFE = 23,
 	CSU_CSLX_SERDES = 32,
 	CSU_CSLX_QDMA,
 	CSU_CSLX_LPUART2,
@@ -105,6 +106,7 @@ static struct csu_ns_dev ns_dev[] = {
 	 {CSU_CSLX_PCIE3_IO, CSU_ALL_RW},
 	 {CSU_CSLX_USB3, CSU_ALL_RW},
 	 {CSU_CSLX_USB2, CSU_ALL_RW},
+	 {CSU_CSLX_PFE, CSU_ALL_RW},
 	 {CSU_CSLX_SERDES, CSU_ALL_RW},
 	 {CSU_CSLX_QDMA, CSU_ALL_RW},
 	 {CSU_CSLX_LPUART2, CSU_ALL_RW},
Signature · 1 line
2.7.4
#26 lore raw

PATCH v2 13/13 configs: ls1012a: add pfe configuration for LS1012A

In reply to Calvin Johnson

Add configurations for PFE.

---
Changes in v2:
-Moved SYS_LS_PFE_FW_ADDR from pfe Kconfig to board Kconfigs -Add "pfe stop" to ls1012a rdb, frdm and 2g5rdb config files

---
 configs/ls1012a2g5rdb_qspi_defconfig |  2 ++
 configs/ls1012afrdm_qspi_defconfig   |  2 ++
 configs/ls1012aqds_qspi_defconfig    |  2 ++
 configs/ls1012ardb_qspi_defconfig    |  2 ++
 drivers/net/Kconfig                  |  1 +
 drivers/net/Makefile                 |  1 +
 drivers/net/pfe_eth/Kconfig          | 17 +++++++++++++++++
 drivers/net/pfe_eth/Makefile         | 12 ++++++++++++
 include/configs/ls1012a2g5rdb.h      |  2 +-
 include/configs/ls1012a_common.h     |  6 +++---
 include/configs/ls1012afrdm.h        |  9 ++++++++-
 include/configs/ls1012aqds.h         | 14 ++++++++++++++
 include/configs/ls1012ardb.h         | 10 +++++++++-
 13 files changed, 74 insertions(+), 6 deletions(-)
 create mode 100644 drivers/net/pfe_eth/Kconfig
 create mode 100644 drivers/net/pfe_eth/Makefile
configs/ls1012a2g5rdb_qspi_defconfig +2 -0
index 140a4e1..a979211 100644
@@ -30,7 +30,9 @@ CONFIG_DM=y
 CONFIG_DM_MMC=y
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH=y
+CONFIG_DM_ETH=y
 CONFIG_NETDEVICES=y
+CONFIG_FSL_PFE=y
 CONFIG_SYS_NS16550=y
 CONFIG_DM_SPI=y
 CONFIG_USB=y
configs/ls1012afrdm_qspi_defconfig +2 -0
index 060f073..d0bf081 100644
@@ -28,8 +28,10 @@ CONFIG_DM=y
 # CONFIG_MMC is not set
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH=y
+CONFIG_DM_ETH=y
 CONFIG_NETDEVICES=y
 CONFIG_E1000=y
+CONFIG_FSL_PFE=y
 CONFIG_PCI=y
 CONFIG_DM_PCI=y
 CONFIG_DM_PCI_COMPAT=y
configs/ls1012aqds_qspi_defconfig +2 -0
index 0435d51..40fbdd8 100644
@@ -39,8 +39,10 @@ CONFIG_SCSI_AHCI=y
 CONFIG_DM_MMC=y
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH=y
+CONFIG_DM_ETH=y
 CONFIG_NETDEVICES=y
 CONFIG_E1000=y
+CONFIG_FSL_PFE=y
 CONFIG_PCI=y
 CONFIG_DM_PCI=y
 CONFIG_DM_PCI_COMPAT=y
configs/ls1012ardb_qspi_defconfig +2 -0
index ea28953..6262351 100644
@@ -31,8 +31,10 @@ CONFIG_DM=y
 CONFIG_DM_MMC=y
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH=y
+CONFIG_DM_ETH=y
 CONFIG_NETDEVICES=y
 CONFIG_E1000=y
+CONFIG_FSL_PFE=y
 CONFIG_PCI=y
 CONFIG_DM_PCI=y
 CONFIG_DM_PCI_COMPAT=y
drivers/net/Kconfig +1 -0
index de1947c..f589978 100644
@@ -1,4 +1,5 @@
 source "drivers/net/phy/Kconfig"
+source "drivers/net/pfe_eth/Kconfig"
 
 config DM_ETH
 	bool "Enable Driver Model for Ethernet drivers"
drivers/net/Makefile +1 -0
index ac5443c..102e65a 100644
@@ -75,3 +75,4 @@ obj-$(CONFIG_FSL_MEMAC) += fm/memac_phy.o
 obj-$(CONFIG_VSC9953) += vsc9953.o
 obj-$(CONFIG_PIC32_ETH) += pic32_mdio.o pic32_eth.o
 obj-$(CONFIG_DWC_ETH_QOS) += dwc_eth_qos.o
+obj-$(CONFIG_FSL_PFE) += pfe_eth/
drivers/net/pfe_eth/Kconfig new file +17 -0
new file mode 100644
index 0000000..6f99710
@@ -0,0 +1,17 @@
+menuconfig FSL_PFE
+	bool "Freescale PFE driver"
+	help
+	  This driver provides support for Freescale PFE.
+
+if FSL_PFE
+
+config UTIL_PE_DISABLED
+	bool
+	help
+	  Disable UTIL processor engine of PFE
+
+config SYS_FSL_PFE_ADDR
+	hex "PFE base address"
+	default 0x04000000
+
+endif
drivers/net/pfe_eth/Makefile new file +12 -0
new file mode 100644
index 0000000..6b5248f
@@ -0,0 +1,12 @@
+# Copyright 2015-2016 Freescale Semiconductor, Inc.
+# Copyright 2017 NXP
+#
+# SPDX-License-Identifier:GPL-2.0+
+
+# Layerscape PFE driver
+obj-y += pfe_cmd.o	\
+	 pfe_driver.o	\
+	 pfe_eth.o	\
+	 pfe_firmware.o \
+	 pfe_hw.o	\
+	 pfe_mdio.o
include/configs/ls1012a2g5rdb.h +1 -1
index 25df103..2d18f3c 100644
@@ -110,7 +110,7 @@
 
 #undef CONFIG_BOOTCOMMAND
 #if defined(CONFIG_QSPI_BOOT) || defined(CONFIG_SD_BOOT_QSPI)
-#define CONFIG_BOOTCOMMAND "run distro_bootcmd; run qspi_bootcmd; " \
+#define CONFIG_BOOTCOMMAND "pfe stop;run distro_bootcmd; run qspi_bootcmd; " \
 			   "env exists secureboot && esbc_halt;"
 #endif
 
include/configs/ls1012a_common.h +3 -3
index 7dbe231..b590d7a 100644
@@ -118,9 +118,9 @@
 	"kernel_size=0x2800000\0"		\
 
 #undef CONFIG_BOOTCOMMAND
-#define CONFIG_BOOTCOMMAND		"sf probe 0:0; sf read $kernel_load "\
-					"$kernel_start $kernel_size && "\
-					"bootm $kernel_load"
+#define CONFIG_BOOTCOMMAND	"pfe stop; sf probe 0:0; sf read $kernel_load "\
+				"$kernel_start $kernel_size && "\
+				"bootm $kernel_load"
 
 /* Monitor Command Prompt */
 #define CONFIG_SYS_CBSIZE		512	/* Console I/O Buffer Size */
include/configs/ls1012afrdm.h +8 -1
index 297c057..f54021e 100644
@@ -9,6 +9,13 @@
 
 #include "ls1012a_common.h"
 
+#ifdef CONFIG_FSL_PFE
+#define EMAC1_PHY_ADDR          0x2
+#define EMAC2_PHY_ADDR          0x1
+#define CONFIG_PHYLIB
+#define CONFIG_PHY_REALTEK
+#endif
+
 /* DDR */
 #define CONFIG_DIMM_SLOTS_PER_CTLR	1
 #define CONFIG_CHIP_SELECTS_PER_CTRL	1
@@ -68,7 +75,7 @@
 		"$kernel_addr $kernel_size && bootm $load_addr#$board\0"
 
 #undef CONFIG_BOOTCOMMAND
-#define CONFIG_BOOTCOMMAND "run distro_bootcmd;run qspi_bootcmd"
+#define CONFIG_BOOTCOMMAND "pfe stop;run distro_bootcmd;run qspi_bootcmd"
 
 #define CONFIG_CMD_MEMINFO
 #define CONFIG_CMD_MEMTEST
include/configs/ls1012aqds.h +14 -0
index e1767ef..f6c2650 100644
@@ -9,6 +9,20 @@
 
 #include "ls1012a_common.h"
 
+/* PFE Ethernet */
+#ifdef CONFIG_FSL_PFE
+#define EMAC1_PHY_ADDR          0x1e
+#define EMAC2_PHY_ADDR          0x1
+#define	SGMII_2500_PHY1_ADDR	0x1
+#define	SGMII_2500_PHY2_ADDR	0x2
+#define CONFIG_PHYLIB
+#define CONFIG_PHY_VITESSE
+#define CONFIG_PHY_REALTEK
+#define	CONFIG_PHY_AQUANTIA
+#define	CONFIG_PHYLIB_10G
+#define RGMII_RESET_WA
+#endif
+
 /* DDR */
 #define CONFIG_DIMM_SLOTS_PER_CTLR	1
 #define CONFIG_CHIP_SELECTS_PER_CTRL	1
include/configs/ls1012ardb.h +9 -1
index ced6c5e..3054ba1 100644
@@ -9,6 +9,14 @@
 
 #include "ls1012a_common.h"
 
+/* PFE Ethernet */
+#ifdef CONFIG_FSL_PFE
+#define EMAC1_PHY_ADDR          0x2
+#define EMAC2_PHY_ADDR          0x1
+#define CONFIG_PHYLIB
+#define CONFIG_PHY_REALTEK
+#endif
+
 /* DDR */
 #define CONFIG_DIMM_SLOTS_PER_CTLR	1
 #define CONFIG_CHIP_SELECTS_PER_CTRL	1
@@ -102,7 +110,7 @@
 		"$kernel_addr $kernel_size && bootm $load_addr#$board\0"
 
 #undef CONFIG_BOOTCOMMAND
-#define CONFIG_BOOTCOMMAND "run distro_bootcmd;run qspi_bootcmd"
+#define CONFIG_BOOTCOMMAND "pfe stop; run distro_bootcmd;run qspi_bootcmd"
 
 #include <asm/fsl_secure_boot.h>
 
Signature · 1 line
2.7.4
#27 lore raw

PATCH v2 13/13 configs: ls1012a: add pfe configuration for LS1012A

Quoted 110 lines · Calvin Johnson

Add configurations for PFE.

---
Changes in v2:

(quoted diff) +0 -3
-Moved SYS_LS_PFE_FW_ADDR from pfe Kconfig to board Kconfigs
-Add "pfe stop" to ls1012a rdb, frdm and 2g5rdb config files
---
 configs/ls1012a2g5rdb_qspi_defconfig |  2 ++
 configs/ls1012afrdm_qspi_defconfig   |  2 ++
 configs/ls1012aqds_qspi_defconfig    |  2 ++
 configs/ls1012ardb_qspi_defconfig    |  2 ++
 drivers/net/Kconfig                  |  1 +
 drivers/net/Makefile                 |  1 +
 drivers/net/pfe_eth/Kconfig          | 17 +++++++++++++++++
 drivers/net/pfe_eth/Makefile         | 12 ++++++++++++
 include/configs/ls1012a2g5rdb.h      |  2 +-
 include/configs/ls1012a_common.h     |  6 +++---
 include/configs/ls1012afrdm.h        |  9 ++++++++-
 include/configs/ls1012aqds.h         | 14 ++++++++++++++
 include/configs/ls1012ardb.h         | 10 +++++++++-
 13 files changed, 74 insertions(+), 6 deletions(-)
 create mode 100644 drivers/net/pfe_eth/Kconfig
 create mode 100644 drivers/net/pfe_eth/Makefile
configs/ls1012a2g5rdb_qspi_defconfig +2 -0
index 140a4e1..a979211 100644
@@ -30,7 +30,9 @@ CONFIG_DM=y
 CONFIG_DM_MMC=y
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH=y
+CONFIG_DM_ETH=y
 CONFIG_NETDEVICES=y
+CONFIG_FSL_PFE=y
 CONFIG_SYS_NS16550=y
 CONFIG_DM_SPI=y
 CONFIG_USB=y
configs/ls1012afrdm_qspi_defconfig +2 -0
index 060f073..d0bf081 100644
@@ -28,8 +28,10 @@ CONFIG_DM=y
 # CONFIG_MMC is not set
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH=y
+CONFIG_DM_ETH=y
 CONFIG_NETDEVICES=y
 CONFIG_E1000=y
+CONFIG_FSL_PFE=y
 CONFIG_PCI=y
 CONFIG_DM_PCI=y
 CONFIG_DM_PCI_COMPAT=y
configs/ls1012aqds_qspi_defconfig +2 -0
index 0435d51..40fbdd8 100644
@@ -39,8 +39,10 @@ CONFIG_SCSI_AHCI=y
 CONFIG_DM_MMC=y
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH=y
+CONFIG_DM_ETH=y
 CONFIG_NETDEVICES=y
 CONFIG_E1000=y
+CONFIG_FSL_PFE=y
 CONFIG_PCI=y
 CONFIG_DM_PCI=y
 CONFIG_DM_PCI_COMPAT=y
configs/ls1012ardb_qspi_defconfig +2 -0
index ea28953..6262351 100644
@@ -31,8 +31,10 @@ CONFIG_DM=y
 CONFIG_DM_MMC=y
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH=y
+CONFIG_DM_ETH=y
 CONFIG_NETDEVICES=y
 CONFIG_E1000=y
+CONFIG_FSL_PFE=y
 CONFIG_PCI=y
 CONFIG_DM_PCI=y
 CONFIG_DM_PCI_COMPAT=y
drivers/net/Kconfig +1 -0
index de1947c..f589978 100644
@@ -1,4 +1,5 @@
 source "drivers/net/phy/Kconfig"
+source "drivers/net/pfe_eth/Kconfig"
 
 config DM_ETH
        bool "Enable Driver Model for Ethernet drivers"
drivers/net/Makefile +1 -0
index ac5443c..102e65a 100644
@@ -75,3 +75,4 @@ obj-$(CONFIG_FSL_MEMAC) += fm/memac_phy.o
 obj-$(CONFIG_VSC9953) += vsc9953.o
 obj-$(CONFIG_PIC32_ETH) += pic32_mdio.o pic32_eth.o
 obj-$(CONFIG_DWC_ETH_QOS) += dwc_eth_qos.o
+obj-$(CONFIG_FSL_PFE) += pfe_eth/
drivers/net/pfe_eth/Kconfig new file +0 -0
new file mode 100644
index 0000000..6f99710

drivers/net/pfe_eth/Kconfig line 2

Quoted 2 lines
drivers/net/pfe_eth/Kconfig new file +2 -0
@@ -0,0 +1,17 @@
+menuconfig FSL_PFE
+       bool "Freescale PFE driver"

Is NXP more appropriate at this point? Or Qualcomm? Or Broadcom? :D

Seriously, though, maybe it should include "Ethernet driver".

drivers/net/pfe_eth/Kconfig line 4

Quoted 2 lines
drivers/net/pfe_eth/Kconfig new file +2 -0
+       help
+         This driver provides support for Freescale PFE.

It probably makes sense here to spell out the acronym.

Quoted 93 lines
drivers/net/pfe_eth/Kconfig new file +13 -0
+
+if FSL_PFE
+
+config UTIL_PE_DISABLED
+       bool
+       help
+         Disable UTIL processor engine of PFE
+
+config SYS_FSL_PFE_ADDR
+       hex "PFE base address"
+       default 0x04000000
+
+endif
drivers/net/pfe_eth/Makefile new file +12 -0
new file mode 100644
index 0000000..6b5248f
@@ -0,0 +1,12 @@
+# Copyright 2015-2016 Freescale Semiconductor, Inc.
+# Copyright 2017 NXP
+#
+# SPDX-License-Identifier:GPL-2.0+
+
+# Layerscape PFE driver
+obj-y += pfe_cmd.o     \
+        pfe_driver.o   \
+        pfe_eth.o      \
+        pfe_firmware.o \
+        pfe_hw.o       \
+        pfe_mdio.o
include/configs/ls1012a2g5rdb.h +1 -1
index 25df103..2d18f3c 100644
@@ -110,7 +110,7 @@
 
 #undef CONFIG_BOOTCOMMAND
 #if defined(CONFIG_QSPI_BOOT) || defined(CONFIG_SD_BOOT_QSPI)
-#define CONFIG_BOOTCOMMAND "run distro_bootcmd; run qspi_bootcmd; " \
+#define CONFIG_BOOTCOMMAND "pfe stop;run distro_bootcmd; run qspi_bootcmd; " \
                           "env exists secureboot && esbc_halt;"
 #endif
 
include/configs/ls1012a_common.h +3 -3
index 7dbe231..b590d7a 100644
@@ -118,9 +118,9 @@
        "kernel_size=0x2800000\0"               \
 
 #undef CONFIG_BOOTCOMMAND
-#define CONFIG_BOOTCOMMAND             "sf probe 0:0; sf read $kernel_load "\
-                                       "$kernel_start $kernel_size && "\
-                                       "bootm $kernel_load"
+#define CONFIG_BOOTCOMMAND     "pfe stop; sf probe 0:0; sf read $kernel_load "\
+                               "$kernel_start $kernel_size && "\
+                               "bootm $kernel_load"
 
 /* Monitor Command Prompt */
 #define CONFIG_SYS_CBSIZE              512     /* Console I/O Buffer Size */
include/configs/ls1012afrdm.h +8 -1
index 297c057..f54021e 100644
@@ -9,6 +9,13 @@
 
 #include "ls1012a_common.h"
 
+#ifdef CONFIG_FSL_PFE
+#define EMAC1_PHY_ADDR          0x2
+#define EMAC2_PHY_ADDR          0x1
+#define CONFIG_PHYLIB
+#define CONFIG_PHY_REALTEK
+#endif
+
 /* DDR */
 #define CONFIG_DIMM_SLOTS_PER_CTLR     1
 #define CONFIG_CHIP_SELECTS_PER_CTRL   1
@@ -68,7 +75,7 @@
                "$kernel_addr $kernel_size && bootm $load_addr#$board\0"
 
 #undef CONFIG_BOOTCOMMAND
-#define CONFIG_BOOTCOMMAND "run distro_bootcmd;run qspi_bootcmd"
+#define CONFIG_BOOTCOMMAND "pfe stop;run distro_bootcmd;run qspi_bootcmd"
 
 #define CONFIG_CMD_MEMINFO
 #define CONFIG_CMD_MEMTEST
include/configs/ls1012aqds.h +0 -0
index e1767ef..f6c2650 100644

include/configs/ls1012aqds.h line 17

Quoted 9 lines
include/configs/ls1012aqds.h +6 -0
@@ -9,6 +9,20 @@
 
 #include "ls1012a_common.h"
 
+/* PFE Ethernet */
+#ifdef CONFIG_FSL_PFE
+#define EMAC1_PHY_ADDR          0x1e
+#define EMAC2_PHY_ADDR          0x1
+#define        SGMII_2500_PHY1_ADDR    0x1
+#define        SGMII_2500_PHY2_ADDR    0x2

Seems like these 4 could move to Kconfig for PFE, maybe prefixed with PFE.

include/configs/ls1012aqds.h line 18

Quoted 1 line
include/configs/ls1012aqds.h +1 -0
+#define CONFIG_PHYLIB

This is Kconfig. Select it.

include/configs/ls1012aqds.h line 22

Quoted 4 lines
include/configs/ls1012aqds.h +4 -0
+#define CONFIG_PHY_VITESSE
+#define CONFIG_PHY_REALTEK
+#define        CONFIG_PHY_AQUANTIA
+#define        CONFIG_PHYLIB_10G

These are all in Kconfig. Imply them?

Quoted 41 lines
include/configs/ls1012aqds.h +3 -0
+#define RGMII_RESET_WA
+#endif
+
 /* DDR */
 #define CONFIG_DIMM_SLOTS_PER_CTLR     1
 #define CONFIG_CHIP_SELECTS_PER_CTRL   1
include/configs/ls1012ardb.h +9 -2
index ced6c5e..3054ba1 100644
@@ -9,6 +9,14 @@
 
 #include "ls1012a_common.h"
 
+/* PFE Ethernet */
+#ifdef CONFIG_FSL_PFE
+#define EMAC1_PHY_ADDR          0x2
+#define EMAC2_PHY_ADDR          0x1
+#define CONFIG_PHYLIB
+#define CONFIG_PHY_REALTEK
+#endif
+
 /* DDR */
 #define CONFIG_DIMM_SLOTS_PER_CTLR     1
 #define CONFIG_CHIP_SELECTS_PER_CTRL   1
@@ -102,7 +110,7 @@
                "$kernel_addr $kernel_size && bootm $load_addr#$board\0"
 
 #undef CONFIG_BOOTCOMMAND
-#define CONFIG_BOOTCOMMAND "run distro_bootcmd;run qspi_bootcmd"
+#define CONFIG_BOOTCOMMAND "pfe stop; run distro_bootcmd;run qspi_bootcmd"
 
 #include <asm/fsl_secure_boot.h>
 
--

2.7.4

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

#28 lore raw

PATCH v2 13/13 configs: ls1012a: add pfe configuration for LS1012A

Hi Joe,

Quoted 37 lines

-----Original Message-----
From: Joe Hershberger [mailto:joe.hershberger at ni.com]
Sent: Wednesday, February 28, 2018 1:47 AM
To: Calvin Johnson <[email protected]>
Cc: u-boot <[email protected]>; Joe Hershberger <[email protected]>; Anji Jagarlmudi <[email protected]>
Subject: Re: [U-Boot] [PATCH v2 13/13] configs: ls1012a: add pfe configuration for LS1012A

Quoted 26 lines · Calvin Johnson

Add configurations for PFE.

---
Changes in v2:

(quoted diff) +0 -3
-Moved SYS_LS_PFE_FW_ADDR from pfe Kconfig to board Kconfigs
-Add "pfe stop" to ls1012a rdb, frdm and 2g5rdb config files
---
 configs/ls1012a2g5rdb_qspi_defconfig |  2 ++
 configs/ls1012afrdm_qspi_defconfig   |  2 ++
 configs/ls1012aqds_qspi_defconfig    |  2 ++
 configs/ls1012ardb_qspi_defconfig    |  2 ++
 drivers/net/Kconfig                  |  1 +
 drivers/net/Makefile                 |  1 +
 drivers/net/pfe_eth/Kconfig          | 17 +++++++++++++++++
 drivers/net/pfe_eth/Makefile         | 12 ++++++++++++
 include/configs/ls1012a2g5rdb.h      |  2 +-
 include/configs/ls1012a_common.h     |  6 +++---
 include/configs/ls1012afrdm.h        |  9 ++++++++-
 include/configs/ls1012aqds.h         | 14 ++++++++++++++
 include/configs/ls1012ardb.h         | 10 +++++++++-
 13 files changed, 74 insertions(+), 6 deletions(-)
 create mode 100644 drivers/net/pfe_eth/Kconfig
 create mode 100644 drivers/net/pfe_eth/Makefile

<snip>

Quoted 10 lines

drivers/net/pfe_eth/Kconfig line 2

Quoted 8 lines
drivers/net/pfe_eth/Kconfig new file +2 -0
new file mode 100644
index 0000000..6f99710
@@ -0,0 +1,17 @@
+menuconfig FSL_PFE
+       bool "Freescale PFE driver"

Is NXP more appropriate at this point? Or Qualcomm? Or Broadcom? :D

Yes, I think NXP is more appropriate right now.
If required, we can change it later. 😊

Quoted 120 lines

Seriously, though, maybe it should include "Ethernet driver".

drivers/net/pfe_eth/Kconfig line 4

Quoted 2 lines
drivers/net/pfe_eth/Kconfig new file +2 -0
+       help
+         This driver provides support for Freescale PFE.

It probably makes sense here to spell out the acronym.

Quoted 36 lines
drivers/net/pfe_eth/Kconfig new file +13 -0
+
+if FSL_PFE
+
+config UTIL_PE_DISABLED
+       bool
+       help
+         Disable UTIL processor engine of PFE
+
+config SYS_FSL_PFE_ADDR
+       hex "PFE base address"
+       default 0x04000000
+
+endif
drivers/net/pfe_eth/Makefile new file +12 -0
new file mode 100644
index 0000000..6b5248f
@@ -0,0 +1,12 @@
+# Copyright 2015-2016 Freescale Semiconductor, Inc.
+# Copyright 2017 NXP
+#
+# SPDX-License-Identifier:GPL-2.0+
+
+# Layerscape PFE driver
+obj-y += pfe_cmd.o     \
+        pfe_driver.o   \
+        pfe_eth.o      \
+        pfe_firmware.o \
+        pfe_hw.o       \
+        pfe_mdio.o
include/configs/ls1012a2g5rdb.h +0 -0
index 25df103..2d18f3c 100644

include/configs/ls1012a2g5rdb.h line 113

Quoted 4 lines
include/configs/ls1012a2g5rdb.h +0 -1
@@ -110,7 +110,7 @@
 
 #undef CONFIG_BOOTCOMMAND
 #if defined(CONFIG_QSPI_BOOT) || defined(CONFIG_SD_BOOT_QSPI)
-#define CONFIG_BOOTCOMMAND "run distro_bootcmd; run qspi_bootcmd; "

\

include/configs/ls1012a2g5rdb.h line 113

Quoted 1 line
include/configs/ls1012a2g5rdb.h +1 -0
+#define CONFIG_BOOTCOMMAND "pfe stop;run distro_bootcmd; run

qspi_bootcmd; " \

Review

Quoted 4 lines
include/configs/ls1012a2g5rdb.h +0 -0
                           "env exists secureboot && esbc_halt;"
 #endif
 
(quoted diff) +0 -0

b/include/configs/ls1012a_common.h

include/configs/ls1012a_common.h line 121

Quoted 11 lines

index 7dbe231..b590d7a 100644

include/configs/ls1012a_common.h +1 -3
@@ -118,9 +118,9 @@
        "kernel_size=0x2800000\0"               \
 
 #undef CONFIG_BOOTCOMMAND
-#define CONFIG_BOOTCOMMAND             "sf probe 0:0; sf read $kernel_load "\
-                                       "$kernel_start $kernel_size && "\
-                                       "bootm $kernel_load"
+#define CONFIG_BOOTCOMMAND     "pfe stop; sf probe 0:0; sf read

$kernel_load "\

Quoted 24 lines
include/configs/ls1012a_common.h +2 -0
+                               "$kernel_start $kernel_size && "\
+                               "bootm $kernel_load"
 
 /* Monitor Command Prompt */
 #define CONFIG_SYS_CBSIZE              512     /* Console I/O Buffer Size */
include/configs/ls1012afrdm.h +7 -0
index 297c057..f54021e 100644
@@ -9,6 +9,13 @@
 
 #include "ls1012a_common.h"
 
+#ifdef CONFIG_FSL_PFE
+#define EMAC1_PHY_ADDR          0x2
+#define EMAC2_PHY_ADDR          0x1
+#define CONFIG_PHYLIB
+#define CONFIG_PHY_REALTEK
+#endif
+
 /* DDR */
 #define CONFIG_DIMM_SLOTS_PER_CTLR     1
 #define CONFIG_CHIP_SELECTS_PER_CTRL   1

include/configs/ls1012afrdm.h line 78

Quoted 5 lines
include/configs/ls1012afrdm.h +1 -1
@@ -68,7 +75,7 @@
                "$kernel_addr $kernel_size && bootm $load_addr#$board\0"
 
 #undef CONFIG_BOOTCOMMAND
-#define CONFIG_BOOTCOMMAND "run distro_bootcmd;run qspi_bootcmd"
+#define CONFIG_BOOTCOMMAND "pfe stop;run distro_bootcmd;run

qspi_bootcmd"

Quoted 8 lines
include/configs/ls1012afrdm.h +0 -0
 #define CONFIG_CMD_MEMINFO
 #define CONFIG_CMD_MEMTEST
include/configs/ls1012aqds.h +0 -0
index e1767ef..f6c2650 100644

include/configs/ls1012aqds.h line 17

Quoted 9 lines
include/configs/ls1012aqds.h +6 -0
@@ -9,6 +9,20 @@
 
 #include "ls1012a_common.h"
 
+/* PFE Ethernet */
+#ifdef CONFIG_FSL_PFE
+#define EMAC1_PHY_ADDR          0x1e
+#define EMAC2_PHY_ADDR          0x1
+#define        SGMII_2500_PHY1_ADDR    0x1
+#define        SGMII_2500_PHY2_ADDR    0x2

Seems like these 4 could move to Kconfig for PFE, maybe prefixed with PFE.

include/configs/ls1012aqds.h line 18

Quoted 1 line
include/configs/ls1012aqds.h +1 -0
+#define CONFIG_PHYLIB
Quoted 8 lines

This is Kconfig. Select it.

include/configs/ls1012aqds.h line 22

Quoted 4 lines
include/configs/ls1012aqds.h +4 -0
+#define CONFIG_PHY_VITESSE
+#define CONFIG_PHY_REALTEK
+#define        CONFIG_PHY_AQUANTIA
+#define        CONFIG_PHYLIB_10G

These are all in Kconfig. Imply them?

Agree with your comments. Will work on them and submit v3.

Thanks
Calvin

#29 lore raw

PATCH v2 13/13 configs: ls1012a: add pfe configuration for LS1012A

In reply to Calvin Johnson

Review

Quoted 8 lines · Calvin Johnson

Add configurations for PFE.

---
Changes in v2:

(quoted diff) +0 -2
-Moved SYS_LS_PFE_FW_ADDR from pfe Kconfig to board Kconfigs
-Add "pfe stop" to ls1012a rdb, frdm and 2g5rdb config files

This one also does not apply cleanly as of today. Please rebase.

Thanks!
-Joe

#30 lore raw

v2 cover LS1012A PFE driver patch series

In reply to Calvin Johnson
Quoted 23 lines · Calvin Johnson

Hi,

This patch series introduces U-Boot support for NXP's LS1012A Packet Forwarding Engine (pfe_eth). LS1012A uses hardware packet forwarding engine to provide high performance Ethernet interfaces. The device includes two Ethernet ports.

Changes in v2 series:
1. PFE patches submitted on top of this base patch are now merged to this patch.
2. Platform changes are segregated into different patches.
3. Network enabled on 2g5rdb platform
4. Moved from legacy to new driver model.

Calvin Johnson (12):
drivers: net: phy: Fix aquantia compilation with DM
drivers: net: pfe_eth: LS1012A PFE driver introduction
drivers: net: pfe_eth: provide pfe commands
drivers: net: pfe_eth: LS1012A PFE headers
board: freescale: ls1012aqds: enable network support on ls1012aqds
board: freescale: ls1012afrdm: enable network support on ls1012afrdm
board: freescale: ls1012ardb: enable network support on ls1012ardb
board: freescale: ls1012a2g5rdb: enable network support on

Quoted 8 lines
    ls1012a2g5rdb

armv8: fsl-lsch2: add pfe macros and update ccsr_scfg structure
armv8: fsl-lsch2: configure pfe's DDR and HDBUS interfaces and ECC
armv8: layerscape: csu: enable ns access to PFE registers
configs: ls1012a: add pfe configuration for LS1012A

Prabhakar Kushwaha (1):
armv8: fsl-layerscape: Add support of GPIO structure

Calvin,

I think you should update your copyright year. Is it right to add 2015-2016 copyright year? Did you have these files then?

York

#31 lore raw

v2 cover LS1012A PFE driver patch series

Hi York,

Quoted 37 lines

-----Original Message-----
From: York Sun
Sent: Thursday, February 15, 2018 9:19 PM
To: Calvin Johnson <[email protected]>; u-boot at lists.denx.de
Cc: joe.hershberger at ni.com; Anji Jagarlmudi <[email protected]>
Subject: Re: [PATCH v2 00/13] LS1012A PFE driver patch series

Quoted 29 lines · Calvin Johnson

Hi,

This patch series introduces U-Boot support for NXP's LS1012A Packet Forwarding Engine (pfe_eth). LS1012A uses hardware packet forwarding engine to provide high performance Ethernet interfaces. The device includes two Ethernet ports.

Changes in v2 series:
1. PFE patches submitted on top of this base patch are now merged to this patch.
2. Platform changes are segregated into different patches.
3. Network enabled on 2g5rdb platform
4. Moved from legacy to new driver model.

Calvin Johnson (12):
drivers: net: phy: Fix aquantia compilation with DM
drivers: net: pfe_eth: LS1012A PFE driver introduction
drivers: net: pfe_eth: provide pfe commands
drivers: net: pfe_eth: LS1012A PFE headers
board: freescale: ls1012aqds: enable network support on ls1012aqds
board: freescale: ls1012afrdm: enable network support on ls1012afrdm
board: freescale: ls1012ardb: enable network support on ls1012ardb
board: freescale: ls1012a2g5rdb: enable network support on

    ls1012a2g5rdb

armv8: fsl-lsch2: add pfe macros and update ccsr_scfg structure
armv8: fsl-lsch2: configure pfe's DDR and HDBUS interfaces and ECC
armv8: layerscape: csu: enable ns access to PFE registers
configs: ls1012a: add pfe configuration for LS1012A

Quoted 7 lines
Quoted 2 lines

Prabhakar Kushwaha (1):
armv8: fsl-layerscape: Add support of GPIO structure

Calvin,

I think you should update your copyright year. Is it right to add 2015-2016 copyright year? Did you have these files then?

I think most of the pfe driver files, except for board files were present during that period.

However, I would wait for Anji to respond on this. Based on his response I can update copyright year if required.

Thanks
Calvin

#32 lore raw

v2 cover LS1012A PFE driver patch series

Hi York,

Quoted 2 lines
Quoted 2 lines

I think you should update your copyright year. Is it right to add 2015-2016 copyright year? Did you have these files then?

Yes, these files were exit during that time. In fact these files were exist since 2011 with Mindspeed copyright. We did modifications for LS1012A and using them since 2015, I think during cleanup Mindspeed copyright has been removed.

Regards,
Anji

Quoted 62 lines

-----Original Message-----
From: Calvin Johnson
Sent: Thursday, February 15, 2018 10:14 PM
To: York Sun <[email protected]>; u-boot at lists.denx.de
Cc: joe.hershberger at ni.com; Anji Jagarlmudi <[email protected]>
Subject: RE: [PATCH v2 00/13] LS1012A PFE driver patch series

Hi York,

Quoted 37 lines

-----Original Message-----
From: York Sun
Sent: Thursday, February 15, 2018 9:19 PM
To: Calvin Johnson <[email protected]>; u-boot at lists.denx.de
Cc: joe.hershberger at ni.com; Anji Jagarlmudi <[email protected]>
Subject: Re: [PATCH v2 00/13] LS1012A PFE driver patch series

Quoted 29 lines · Calvin Johnson

Hi,

This patch series introduces U-Boot support for NXP's LS1012A Packet Forwarding Engine (pfe_eth). LS1012A uses hardware packet forwarding engine to provide high performance Ethernet interfaces. The device includes two Ethernet ports.

Changes in v2 series:
1. PFE patches submitted on top of this base patch are now merged to this patch.
2. Platform changes are segregated into different patches.
3. Network enabled on 2g5rdb platform 4. Moved from legacy to new driver model.

Calvin Johnson (12):
drivers: net: phy: Fix aquantia compilation with DM
drivers: net: pfe_eth: LS1012A PFE driver introduction
drivers: net: pfe_eth: provide pfe commands
drivers: net: pfe_eth: LS1012A PFE headers
board: freescale: ls1012aqds: enable network support on ls1012aqds
board: freescale: ls1012afrdm: enable network support on ls1012afrdm
board: freescale: ls1012ardb: enable network support on ls1012ardb
board: freescale: ls1012a2g5rdb: enable network support on

    ls1012a2g5rdb

armv8: fsl-lsch2: add pfe macros and update ccsr_scfg structure
armv8: fsl-lsch2: configure pfe's DDR and HDBUS interfaces and ECC
armv8: layerscape: csu: enable ns access to PFE registers
configs: ls1012a: add pfe configuration for LS1012A

Quoted 7 lines
Quoted 2 lines

Prabhakar Kushwaha (1):
armv8: fsl-layerscape: Add support of GPIO structure

Calvin,

I think you should update your copyright year. Is it right to add 2015-2016 copyright year? Did you have these files then?

I think most of the pfe driver files, except for board files were present during that period.

However, I would wait for Anji to respond on this. Based on his response I can update copyright year if required.

Thanks
Calvin

#33 lore raw

v2 cover LS1012A PFE driver patch series

In reply to Calvin Johnson

Hi Joe,

Quoted 8 lines

-----Original Message-----
From: Calvin Johnson [mailto:calvin.johnson at nxp.com]
Sent: Thursday, February 15, 2018 7:47 PM
To: u-boot at lists.denx.de
Cc: joe.hershberger at ni.com; York Sun <[email protected]>; Anji Jagarlmudi <[email protected]>; Calvin Johnson <[email protected]>
Subject: [PATCH v2 00/13] LS1012A PFE driver patch series

<snip>

Quoted 6 lines

Changes in v2 series:
1. PFE patches submitted on top of this base patch are now merged to this patch.
2. Platform changes are segregated into different patches.
3. Network enabled on 2g5rdb platform
4. Moved from legacy to new driver model.

Gentle reminder. Hope the PFE patches didn't miss your sight.

Thanks & Regards
Calvin

#34 lore raw

v2 cover LS1012A PFE driver patch series

Hi Calvin,

Quoted 13 lines · Calvin Johnson

Hi Joe,

Quoted 8 lines

-----Original Message-----
From: Calvin Johnson [mailto:calvin.johnson at nxp.com]
Sent: Thursday, February 15, 2018 7:47 PM
To: u-boot at lists.denx.de
Cc: joe.hershberger at ni.com; York Sun <[email protected]>; Anji Jagarlmudi <[email protected]>; Calvin Johnson <[email protected]>
Subject: [PATCH v2 00/13] LS1012A PFE driver patch series

<snip>

Quoted 8 lines
Quoted 6 lines

Changes in v2 series:
1. PFE patches submitted on top of this base patch are now merged to this patch.
2. Platform changes are segregated into different patches.
3. Network enabled on 2g5rdb platform
4. Moved from legacy to new driver model.

Gentle reminder. Hope the PFE patches didn't miss your sight.

I tried applying your series and it had many checkpatch issues. Please resolve those and resend.

Thanks,
-Joe

-----------------

Fetched U-Boot-1-9-drivers-net-pfe_eth-LS1012A-PFE-driver-introduction (823206.mbox)
823206.mbox:46: WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
823206.mbox:534: CHECK: Avoid CamelCase: <Elf32_Shdr>
823206.mbox:551: CHECK: No space is necessary after a cast 823206.mbox:669: CHECK: spaces preferred around that '&' (ctx:ExV) 823206.mbox:728: CHECK: Unbalanced braces around else statement 823206.mbox:835: WARNING: else is not generally useful after a break or return 823206.mbox:1231: CHECK: Please use a blank line after function/struct/union/enum declarations
823206.mbox:1237: CHECK: spaces preferred around that '<<' (ctx:VxV) 823206.mbox:1237: CHECK: spaces preferred around that '|' (ctx:VxV) 823206.mbox:1461: CHECK: Comparison to NULL could be written "!g_rx_desc" 823206.mbox:1487: CHECK: Comparison to NULL could be written "!g_rx_desc" 823206.mbox:1520: CHECK: Comparison to NULL could be written "!rx_desc" 823206.mbox:1573: CHECK: Comparison to NULL could be written "!g_tx_desc" 823206.mbox:1606: CHECK: Comparison to NULL could be written "!tx_desc" 823206.mbox:1891: WARNING: Statements should start on a tabstop 823206.mbox:1901: WARNING: Statements should start on a tabstop 823206.mbox:1937: CHECK: spaces preferred around that '|' (ctx:VxV) 823206.mbox:2100: CHECK: Please don't use multiple blank lines 823206.mbox:2118: CHECK: Please don't use multiple blank lines 823206.mbox:2132: WARNING: suspect code indent for conditional statements (8, 24)
823206.mbox:2178: CHECK: Alignment should match open parenthesis 823206.mbox:2462: CHECK: Avoid CamelCase: <Elf32_Ehdr>
823206.mbox:2605: CHECK: Prefer kernel type 'u8' over 'uint8_t'
total: 0 errors, 5 warnings, 18 checks, 2580 lines checked
Checking patch drivers/net/pfe_eth/Kconfig...
Checking patch drivers/net/pfe_eth/Makefile...
Checking patch drivers/net/pfe_eth/pfe.c...
Checking patch drivers/net/pfe_eth/pfe_driver.c...
Checking patch drivers/net/pfe_eth/pfe_eth.c...
Checking patch drivers/net/pfe_eth/pfe_firmware.c...
Applied patch drivers/net/pfe_eth/Kconfig cleanly.
Applied patch drivers/net/pfe_eth/Makefile cleanly.
Applied patch drivers/net/pfe_eth/pfe.c cleanly.
Applied patch drivers/net/pfe_eth/pfe_driver.c cleanly.
Applied patch drivers/net/pfe_eth/pfe_eth.c cleanly.
Applied patch drivers/net/pfe_eth/pfe_firmware.c cleanly.
Applying: drivers: net: pfe_eth: LS1012A PFE driver introduction
Fetched U-Boot-2-9-drivers-net-pfe_eth-provide-pfe-commands (823207.mbox) 823207.mbox:43: WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
823207.mbox:83: WARNING: line over 80 characters
823207.mbox:94: CHECK: spaces preferred around that '&' (ctx:VxV) 823207.mbox:117: WARNING: line over 80 characters
823207.mbox:128: CHECK: spaces preferred around that '&' (ctx:VxV) 823207.mbox:141: WARNING: line over 80 characters
823207.mbox:152: WARNING: line over 80 characters
823207.mbox:166: WARNING: line over 80 characters
823207.mbox:184: WARNING: line over 80 characters
823207.mbox:193: WARNING: line over 80 characters
823207.mbox:248: WARNING: line over 80 characters
823207.mbox:294: WARNING: Prefer using '"%s...", __func__' to using 'gpi', this function's name, in a string
823207.mbox:307: WARNING: Prefer using '"%s...", __func__' to using 'bmu', this function's name, in a string
823207.mbox:385: WARNING: suspect code indent for conditional
statements (16, 16)
823207.mbox:385: CHECK: Unbalanced braces around else statement 823207.mbox:393: WARNING: line over 80 characters
823207.mbox:405: WARNING: Missing a blank line after declarations 823207.mbox:444: WARNING: line over 80 characters
823207.mbox:448: WARNING: void function return statements are not generally useful
823207.mbox:532: CHECK: spaces preferred around that '+' (ctx:VxV) 823207.mbox:546: CHECK: spaces preferred around that '+' (ctx:VxV) 823207.mbox:578: CHECK: Please don't use multiple blank lines
total: 0 errors, 16 warnings, 6 checks, 544 lines checked
Checking patch drivers/net/pfe_eth/Makefile...
Checking patch drivers/net/pfe_eth/pfe_cmd.c...
Applied patch drivers/net/pfe_eth/Makefile cleanly.
Applied patch drivers/net/pfe_eth/pfe_cmd.c cleanly.
Applying: drivers: net: pfe_eth: provide pfe commands
Fetched U-Boot-3-9-drivers-net-pfe_eth-LS1012A-PFE-headers (823209.mbox) 823209.mbox:50: WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
823209.mbox:101: CHECK: spaces preferred around that '<<' (ctx:VxV) 823209.mbox:101: CHECK: Prefer using the BIT macro
823209.mbox:103: CHECK: spaces preferred around that '<<' (ctx:VxV) 823209.mbox:105: CHECK: spaces preferred around that '<<' (ctx:VxV) 823209.mbox:105: CHECK: Prefer using the BIT macro
823209.mbox:106: CHECK: spaces preferred around that '<<' (ctx:VxV) 823209.mbox:106: CHECK: Prefer using the BIT macro
823209.mbox:108: CHECK: Macro argument reuse 'size' - possible side-effects? 823209.mbox:119: CHECK: Prefer using the BIT macro
823209.mbox:124: CHECK: Prefer using the BIT macro
823209.mbox:340: CHECK: Prefer using the BIT macro
823209.mbox:341: CHECK: Prefer using the BIT macro
823209.mbox:342: CHECK: Prefer using the BIT macro
823209.mbox:343: CHECK: Prefer using the BIT macro
823209.mbox:344: CHECK: Prefer using the BIT macro
823209.mbox:345: CHECK: Prefer using the BIT macro
823209.mbox:346: CHECK: Prefer using the BIT macro
823209.mbox:348: CHECK: Prefer using the BIT macro
823209.mbox:351: CHECK: Prefer using the BIT macro
823209.mbox:353: CHECK: Prefer using the BIT macro
823209.mbox:354: CHECK: Prefer using the BIT macro
823209.mbox:355: CHECK: Prefer using the BIT macro
823209.mbox:628: CHECK: spaces preferred around that '<<' (ctx:VxV) 823209.mbox:628: CHECK: Prefer using the BIT macro
823209.mbox:629: CHECK: spaces preferred around that '<<' (ctx:VxV) 823209.mbox:629: CHECK: Prefer using the BIT macro
823209.mbox:630: CHECK: spaces preferred around that '<<' (ctx:VxV) 823209.mbox:630: CHECK: Prefer using the BIT macro
823209.mbox:633: CHECK: spaces preferred around that '<<' (ctx:VxV) 823209.mbox:633: CHECK: Prefer using the BIT macro
823209.mbox:636: CHECK: Prefer using the BIT macro
823209.mbox:637: CHECK: Prefer using the BIT macro
823209.mbox:638: CHECK: Prefer using the BIT macro
823209.mbox:639: CHECK: Prefer using the BIT macro
823209.mbox:640: CHECK: Prefer using the BIT macro
823209.mbox:649: CHECK: Prefer using the BIT macro
823209.mbox:650: CHECK: Prefer using the BIT macro
823209.mbox:651: CHECK: Prefer using the BIT macro
823209.mbox:652: CHECK: Prefer using the BIT macro
823209.mbox:653: CHECK: Prefer using the BIT macro
823209.mbox:654: CHECK: Prefer using the BIT macro
823209.mbox:655: CHECK: Prefer using the BIT macro
823209.mbox:656: CHECK: Prefer using the BIT macro
823209.mbox:657: CHECK: Prefer using the BIT macro
823209.mbox:658: CHECK: Prefer using the BIT macro
823209.mbox:839: CHECK: Prefer using the BIT macro
823209.mbox:840: CHECK: Prefer using the BIT macro
823209.mbox:841: CHECK: Prefer using the BIT macro
823209.mbox:842: CHECK: Prefer using the BIT macro
823209.mbox:843: CHECK: Prefer using the BIT macro
823209.mbox:844: CHECK: Prefer using the BIT macro
823209.mbox:845: CHECK: Prefer using the BIT macro
823209.mbox:846: CHECK: Prefer using the BIT macro
823209.mbox:847: CHECK: Prefer using the BIT macro
823209.mbox:848: CHECK: spaces preferred around that '<<' (ctx:VxV) 823209.mbox:848: CHECK: Prefer using the BIT macro
823209.mbox:964: CHECK: Macro argument reuse 'addr' - possible side-effects? 823209.mbox:967: CHECK: Macro argument reuse 'addr' - possible side-effects? 823209.mbox:970: CHECK: Macro argument reuse 'addr' - possible side-effects? 823209.mbox:974: CHECK: Macro argument reuse 'addr' - possible side-effects? 823209.mbox:978: CHECK: Macro argument reuse 'addr' - possible side-effects? 823209.mbox:1030: CHECK: Prefer using the BIT macro
823209.mbox:1071: CHECK: Avoid CamelCase: <Elf32_Shdr>
823209.mbox:1125: WARNING: Adding new packed members is to be done with care 823209.mbox:1133: WARNING: Adding new packed members is to be done with care
total: 0 errors, 3 warnings, 63 checks, 1172 lines checked
Checking patch include/pfe_eth/pfe/cbus.h...
Checking patch include/pfe_eth/pfe/cbus/bmu.h...
Checking patch include/pfe_eth/pfe/cbus/class_csr.h...
Checking patch include/pfe_eth/pfe/cbus/emac.h...
Checking patch include/pfe_eth/pfe/cbus/gpi.h...
Checking patch include/pfe_eth/pfe/cbus/hif.h...
Checking patch include/pfe_eth/pfe/cbus/hif_nocpy.h...
Checking patch include/pfe_eth/pfe/cbus/tmu_csr.h...
Checking patch include/pfe_eth/pfe/cbus/util_csr.h...
Checking patch include/pfe_eth/pfe/pfe.h...
Checking patch include/pfe_eth/pfe_driver.h...
Checking patch include/pfe_eth/pfe_eth.h...
Checking patch include/pfe_eth/pfe_firmware.h...
Applied patch include/pfe_eth/pfe/cbus.h cleanly.
Applied patch include/pfe_eth/pfe/cbus/bmu.h cleanly.
Applied patch include/pfe_eth/pfe/cbus/class_csr.h cleanly.
Applied patch include/pfe_eth/pfe/cbus/emac.h cleanly.
Applied patch include/pfe_eth/pfe/cbus/gpi.h cleanly.
Applied patch include/pfe_eth/pfe/cbus/hif.h cleanly.
Applied patch include/pfe_eth/pfe/cbus/hif_nocpy.h cleanly.
Applied patch include/pfe_eth/pfe/cbus/tmu_csr.h cleanly.
Applied patch include/pfe_eth/pfe/cbus/util_csr.h cleanly.
Applied patch include/pfe_eth/pfe/pfe.h cleanly.
Applied patch include/pfe_eth/pfe_driver.h cleanly.
Applied patch include/pfe_eth/pfe_eth.h cleanly.
Applied patch include/pfe_eth/pfe_firmware.h cleanly.
Applying: drivers: net: pfe_eth: LS1012A PFE headers
Fetched U-Boot-4-9-board-freescale-ls1012a-enable-network-support-on-ls1012a-platforms (823210.mbox)
823210.mbox:55: WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
823210.mbox:122: WARNING: Block comments use a trailing */ on a separate line 823210.mbox:142: CHECK: Please don't use multiple blank lines 823210.mbox:239: CHECK: Alignment should match open parenthesis 823210.mbox:249: CHECK: Alignment should match open parenthesis 823210.mbox:344: WARNING: Block comments use a trailing */ on a separate line 823210.mbox:364: WARNING: suspect code indent for conditional
statements (16, 32)
823210.mbox:389: WARNING: Block comments use a trailing */ on a separate line 823210.mbox:400: WARNING: suspect code indent for conditional
statements (16, 32)
823210.mbox:511: WARNING: suspect code indent for conditional
statements (32, 32)
823210.mbox:538: WARNING: suspect code indent for conditional
statements (32, 32)
823210.mbox:674: CHECK: Please don't use multiple blank lines
total: 0 errors, 8 warnings, 4 checks, 640 lines checked
[ ... ]

#35 lore raw

v2 cover LS1012A PFE driver patch series

Hi Joe,

Quoted 43 lines

-----Original Message-----
From: Joe Hershberger [mailto:joe.hershberger at ni.com]
Sent: Tuesday, February 27, 2018 1:31 AM
To: Calvin Johnson <[email protected]>
Cc: joe.hershberger at ni.com; u-boot at lists.denx.de; Anji Jagarlmudi <[email protected]>
Subject: Re: [U-Boot] [PATCH v2 00/13] LS1012A PFE driver patch series

Hi Calvin,

Quoted 13 lines · Calvin Johnson

Hi Joe,

Quoted 8 lines

-----Original Message-----
From: Calvin Johnson [mailto:calvin.johnson at nxp.com]
Sent: Thursday, February 15, 2018 7:47 PM
To: u-boot at lists.denx.de
Cc: joe.hershberger at ni.com; York Sun <[email protected]>; Anji Jagarlmudi <[email protected]>; Calvin Johnson <[email protected]>
Subject: [PATCH v2 00/13] LS1012A PFE driver patch series

<snip>

Quoted 8 lines
Quoted 6 lines

Changes in v2 series:
1. PFE patches submitted on top of this base patch are now merged to this patch.
2. Platform changes are segregated into different patches.
3. Network enabled on 2g5rdb platform
4. Moved from legacy to new driver model.

Gentle reminder. Hope the PFE patches didn't miss your sight.

I tried applying your series and it had many checkpatch issues. Please resolve those and resend.

Thanks,
-Joe

-----------------

Quoted 7 lines

Fetched U-Boot-1-9-drivers-net-pfe_eth-LS1012A-PFE-driver-introduction (823206.mbox)
823206.mbox:46: WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
823206.mbox:534: CHECK: Avoid CamelCase: <Elf32_Shdr> 823206.mbox:551: CHECK: No space is necessary after a cast 823206.mbox:669: CHECK: spaces preferred around that '&' (ctx:ExV)

<snip>

Looks like you have run checkpatch on the v1 series (9 patches). I had submitted the v2 series (13 patches).

However, in the v2 series, there are some checkpatch warnings like ' line over 80 characters' which I had to ignore due to valid reasons. If there is any concern on these, I can work on them after discussion.

Thanks
Calvin

#36 lore raw

v2 cover LS1012A PFE driver patch series

Quoted 53 lines · Calvin Johnson

Hi Joe,

Quoted 43 lines

-----Original Message-----
From: Joe Hershberger [mailto:joe.hershberger at ni.com]
Sent: Tuesday, February 27, 2018 1:31 AM
To: Calvin Johnson <[email protected]>
Cc: joe.hershberger at ni.com; u-boot at lists.denx.de; Anji Jagarlmudi <[email protected]>
Subject: Re: [U-Boot] [PATCH v2 00/13] LS1012A PFE driver patch series

Hi Calvin,

Quoted 13 lines · Calvin Johnson

Hi Joe,

Quoted 8 lines

-----Original Message-----
From: Calvin Johnson [mailto:calvin.johnson at nxp.com]
Sent: Thursday, February 15, 2018 7:47 PM
To: u-boot at lists.denx.de
Cc: joe.hershberger at ni.com; York Sun <[email protected]>; Anji Jagarlmudi <[email protected]>; Calvin Johnson <[email protected]>
Subject: [PATCH v2 00/13] LS1012A PFE driver patch series

<snip>

Quoted 8 lines
Quoted 6 lines

Changes in v2 series:
1. PFE patches submitted on top of this base patch are now merged to this patch.
2. Platform changes are segregated into different patches.
3. Network enabled on 2g5rdb platform
4. Moved from legacy to new driver model.

Gentle reminder. Hope the PFE patches didn't miss your sight.

I tried applying your series and it had many checkpatch issues. Please resolve those and resend.

Thanks,
-Joe

-----------------

Quoted 7 lines

Fetched U-Boot-1-9-drivers-net-pfe_eth-LS1012A-PFE-driver-introduction (823206.mbox)
823206.mbox:46: WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
823206.mbox:534: CHECK: Avoid CamelCase: <Elf32_Shdr> 823206.mbox:551: CHECK: No space is necessary after a cast 823206.mbox:669: CHECK: spaces preferred around that '&' (ctx:ExV)

Quoted 8 lines

<snip>

Looks like you have run checkpatch on the v1 series (9 patches). I had submitted the v2 series (13 patches).

However, in the v2 series, there are some checkpatch warnings like ' line over 80 characters' which I had to ignore due to valid reasons. If there is any concern on these, I can work on them after discussion.

Sorry about that - Only your V1 was assigned to me in patchwork, so I missed it.

Looks like V2 is assigned to York at the moment, but I'm going to assign it to myself since it is all about networking.

Cheers,
-Joe

#37 lore raw

v2 cover LS1012A PFE driver patch series

Quoted 71 lines

-----Original Message-----
From: Joe Hershberger [mailto:joe.hershberger at ni.com]
Sent: Tuesday, February 27, 2018 9:18 PM
To: Calvin Johnson <[email protected]>
Cc: joe.hershberger at ni.com; u-boot at lists.denx.de; Anji Jagarlmudi <[email protected]>; York Sun <[email protected]>
Subject: Re: [U-Boot] [PATCH v2 00/13] LS1012A PFE driver patch series

Quoted 21 lines · Calvin Johnson

Hi Joe,

Quoted 19 lines

-----Original Message-----
From: Joe Hershberger [mailto:joe.hershberger at ni.com]
Sent: Tuesday, February 27, 2018 1:31 AM
To: Calvin Johnson <[email protected]>
Cc: joe.hershberger at ni.com; u-boot at lists.denx.de; Anji Jagarlmudi <[email protected]>
Subject: Re: [U-Boot] [PATCH v2 00/13] LS1012A PFE driver patch series

Hi Calvin,

Quoted 7 lines · Calvin Johnson

Hi Joe,

Quoted 5 lines

-----Original Message-----
From: Calvin Johnson [mailto:calvin.johnson at nxp.com]
Sent: Thursday, February 15, 2018 7:47 PM
To: u-boot at lists.denx.de
Cc: joe.hershberger at ni.com; York Sun <[email protected]>; Anji

Jagarlmudi

Quoted 32 lines
Quoted 24 lines
Quoted 6 lines
Quoted 3 lines

<[email protected]>; Calvin Johnson <[email protected]>
Subject: [PATCH v2 00/13] LS1012A PFE driver patch series

<snip>

Quoted 8 lines
Quoted 6 lines

Changes in v2 series:
1. PFE patches submitted on top of this base patch are now merged to this patch.
2. Platform changes are segregated into different patches.
3. Network enabled on 2g5rdb platform
4. Moved from legacy to new driver model.

Gentle reminder. Hope the PFE patches didn't miss your sight.

I tried applying your series and it had many checkpatch issues. Please resolve those and resend.

Thanks,
-Joe

-----------------

Quoted 7 lines

Fetched U-Boot-1-9-drivers-net-pfe_eth-LS1012A-PFE-driver-introduction (823206.mbox)
823206.mbox:46: WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
823206.mbox:534: CHECK: Avoid CamelCase: <Elf32_Shdr> 823206.mbox:551: CHECK: No space is necessary after a cast 823206.mbox:669: CHECK: spaces preferred around that '&' (ctx:ExV)

Quoted 6 lines

<snip>

Looks like you have run checkpatch on the v1 series (9 patches). I had submitted the v2 series (13 patches).

However, in the v2 series, there are some checkpatch warnings like ' line over

80 characters'

Quoted 8 lines
Quoted 1 line

which I had to ignore due to valid reasons. If there is any concern on these, I

can work on them

Quoted 1 line

after discussion.

Sorry about that - Only your V1 was assigned to me in patchwork, so I missed it.

Looks like V2 is assigned to York at the moment, but I'm going to assign it to myself since it is all about networking.

Not sure, how it got assigned to York. Thanks for taking up the patches.

Regards
Calvin