Skip to content

Commit 19243c3

Browse files
committed
Add NXP QUICC Engine UCC ethernet port (P1021/P1025)
1 parent 78c2cef commit 19243c3

5 files changed

Lines changed: 1007 additions & 0 deletions

File tree

src/port/nxp_qe_uec/README.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# wolfIP NXP QUICC Engine UCC (UEC) port
2+
3+
Ethernet driver for the NXP QUICC Engine (QE) UCC fast controller in UEC-GETH (ethernet) mode, for big-endian PowerPC parts that carry a QE (e.g. P1021/P1025, e500v2). Brings up one UCC in polled mode and exposes the wolfIP poll/send callbacks.
4+
5+
## Important: which P1021 MAC?
6+
7+
The **stock P1021RDB routes its copper through eTSEC (Gianfar) + a VSC7385 switch, not the QE UCC** -- the QE-UEC ethernet path is a P1025RDB-style configuration. On a stock P1021RDB the QE only drives the switch firmware. Use the **`nxp_etsec` port** for stock P1021RDB hardware. Use this `nxp_qe_uec` port for boards with custom UCC-to-PHY wiring (or P1025-style RMII).
8+
9+
## Model
10+
11+
The board (DDR, clocks, UART, pin-mux) and the QE microcode are brought up by the boot stage (wolfBoot `hal_qe_init`, which uploads the microcode, sets IRAM-ready, configures SDMA, resets the engine, and muxes the UCC pins). This driver runs in the booted application: it routes the UCC clocks, runs UCC-fast init (GUMR + virtual FIFOs), configures the MAC + MDIO/PHY, builds the parameter RAM in QE MURAM, sets up the BD rings in DRAM, issues the `INIT_TX_RX` command, and polls the rings.
12+
13+
**Single instance.** All per-device state (base addresses, ring indices, PHY address, BD rings, buffer pools) is held in file-scope statics and `WOLFIP_MAX_INTERFACES` defaults to 1, so the driver drives exactly one MAC. A second port of the same MAC type in one image would share that state; move it behind `ll->priv` first.
14+
15+
## Files
16+
17+
- `nxp_qe_uec.h` - public API + QE engine / UCC fast / UEC MAC / MII / BD / param-RAM register map.
18+
- `nxp_qe_uec.c` - driver: BE register access, MURAM allocator, QE command register, MDIO clause-22, PHY bring-up, UCC-fast + MAC init, parameter RAM, BD-ring datapath.
19+
- `nxp_qe_uec_board.h` - board parameters (CCSRBAR, UCC index, PHY address, interface mode, speed, SNUMs). All overridable from CFLAGS.
20+
- `config.h` - wolfIP compile-time configuration for this port.
21+
22+
## Board parameters
23+
24+
| Define | Default | Notes |
25+
|---|---|---|
26+
| `NXP_QE_CCSRBAR` | `0xFF700000` | P1021 reset default (kept by wolfBoot for the QE block) |
27+
| `NXP_QE_IMMR_OFFSET` | `0x80000` | QE_IMMR = CCSRBAR + 0x80000 |
28+
| `NXP_QE_UCC_NUM` | `0` | 0-based UCC index (UCC1=0; wolfBoot muxes UCC1=MII, UCC5=RMII) |
29+
| `NXP_QE_PHY_ADDR` | `0x0` | external PHY (probed first, then bus scan) |
30+
| `NXP_QE_IF_MODE` | `0` | 0=MII, 1=RMII, 2=RGMII |
31+
| `NXP_QE_SPEED` | `100` | 10/100/1000 (selects VFIFO sizes and MAC byte/nibble mode) |
32+
| `NXP_QE_SNUM_RX/RX2/TX` | `0x04/0x0C/0x05` | serial numbers from the P1021 28-snum pool |
33+
34+
## Status
35+
36+
Build-validated (compiles clean for e500 BE in MII, RMII and RGMII/gigabit modes). The polled `eth_poll`/`eth_send` ring datapath (index/wrap/ring-full and length-clamp bookkeeping) is NOT yet exercised by any host or hardware test. Hardware bring-up is pending suitable QE/UCC hardware. The bring-up follows the U-Boot QE UEC driver (drivers/qe/uec.c). Hardware-verify items, flagged inline in the source:
37+
38+
- The CMXUCRn per-UCC RX/TX clock-route 4-bit field layout is not in the U-Boot sources and must be taken from the P1021 RM "QE Multiplexing" -- `qe_clock_route()` currently only programs the well-defined MII-management routing (CMXGCR).
39+
- Whether `qe_assign_page()` is required after wolfBoot's engine reset, and its exact CECDR page encoding.
40+
- The PHY interface mode and MDIO address (board-specific; the stock P1021RDB does not use this path at all).
41+
42+
## Cache coherency
43+
44+
e500v2 has no I/O cache snooping and wolfBoot maps low DDR cacheable-but-non-coherent, so the driver does explicit `dcbf` cache maintenance (32-byte lines) around the BD rings and buffers. `TSTATE`/`RSTATE` also set the QE `BMR_GLB` snoop bit.
45+
46+
## Build
47+
48+
```
49+
powerpc-linux-gnu-gcc -mcpu=e500mc -mbig-endian -I<wolfip-root> -Isrc/port/nxp_qe_uec \
50+
-c src/port/nxp_qe_uec/nxp_qe_uec.c
51+
```

src/port/nxp_qe_uec/config.h

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
/* config.h
2+
*
3+
* wolfIP configuration for the NXP QUICC Engine UCC (UEC) port (P1021/P1025).
4+
*
5+
* Copyright (C) 2026 wolfSSL Inc.
6+
*
7+
* This file is part of wolfIP TCP/IP stack.
8+
*
9+
* wolfIP is free software; you can redistribute it and/or modify
10+
* it under the terms of the GNU General Public License as published by
11+
* the Free Software Foundation; either version 3 of the License, or
12+
* (at your option) any later version.
13+
*
14+
* wolfIP is distributed in the hope that it will be useful,
15+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17+
* GNU General Public License for more details.
18+
*
19+
* You should have received a copy of the GNU General Public License
20+
* along with this program; if not, write to the Free Software
21+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
22+
*/
23+
#ifndef WOLF_CONFIG_H
24+
#define WOLF_CONFIG_H
25+
26+
#ifndef CONFIG_IPFILTER
27+
#define CONFIG_IPFILTER 0
28+
#endif
29+
30+
#define ETHERNET
31+
#define LINK_MTU 1536
32+
33+
#define MAX_TCPSOCKETS 4
34+
#define MAX_UDPSOCKETS 2
35+
#define MAX_ICMPSOCKETS 1
36+
#define RXBUF_SIZE LINK_MTU
37+
#define TXBUF_SIZE LINK_MTU
38+
39+
#define MAX_NEIGHBORS 8
40+
#define WOLFIP_ARP_PENDING_MAX 2
41+
42+
#ifndef WOLFIP_MAX_INTERFACES
43+
#define WOLFIP_MAX_INTERFACES 1
44+
#endif
45+
46+
#ifndef WOLFIP_ENABLE_FORWARDING
47+
#define WOLFIP_ENABLE_FORWARDING 0
48+
#endif
49+
50+
#ifndef WOLFIP_ENABLE_LOOPBACK
51+
#define WOLFIP_ENABLE_LOOPBACK 0
52+
#endif
53+
54+
#ifndef WOLFIP_ENABLE_DHCP
55+
#define WOLFIP_ENABLE_DHCP 1
56+
#endif
57+
58+
/* Static IP fallback (used when DHCP is disabled or times out). */
59+
#define WOLFIP_IP "192.168.1.10"
60+
#define WOLFIP_NETMASK "255.255.255.0"
61+
#define WOLFIP_GW "192.168.1.1"
62+
#define WOLFIP_STATIC_DNS_IP "8.8.8.8"
63+
64+
#if WOLFIP_ENABLE_DHCP
65+
#define DHCP
66+
#endif
67+
68+
#endif /* WOLF_CONFIG_H */

0 commit comments

Comments
 (0)