|
| 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 `static` variables 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 | +``` |
0 commit comments