3636 * Register set per Versal ACAP TRM (AM011) chapter "Gigabit Ethernet
3737 * MAC" / Cadence GEM.
3838 *
39- * UNTESTED ON HARDWARE -- structural scaffold .
39+ * Brought up on a VMK180 (Cortex-A72 EL3): DHCP, ping and UDP echo .
4040 */
4141#include <stdint.h>
4242#include <string.h>
4848#include "gem.h"
4949#include "phy_dp83867.h"
5050
51- /* Cache maintenance helpers for GEM DMA coherency. Cortex-A53 cache
51+ /* Cache maintenance helpers for GEM DMA coherency. Cortex-A72 cache
5252 * line is 64 bytes. With D-cache enabled and BD/buffers in normal
5353 * cacheable memory, CPU writes may sit in L1 D-cache and not be
5454 * visible to the MAC's DMA path. cache_clean() writes back dirty
@@ -542,12 +542,12 @@ void gem_dump_state(void)
542542 * boots with networking up), so we deliberately do NOT touch CRL here.
543543 * The driver's per-MAC soft reset via GEM_NWCTRL is enough to put the
544544 * MAC into a known state on top of the PLM-configured clock. */
545- static void gem3_set_ref_clk (int speed_mbps )
545+ static void gem0_set_ref_clk (int speed_mbps )
546546{
547547 (void )speed_mbps ; /* clock owned by PLM; nothing to do on Versal */
548548}
549549
550- static void gem3_hw_reset (void )
550+ static void gem0_hw_reset (void )
551551{
552552#ifdef DEBUG_GEM
553553 volatile uint32_t * gem0ref = (volatile uint32_t * )CRL_APB_GEM0_REF_CTRL ;
@@ -564,7 +564,7 @@ static void gem3_hw_reset(void)
564564/* ---------------------------------------------------------------------
565565 * Public init
566566 * ------------------------------------------------------------------- */
567- int zcu102_eth_init (struct wolfIP_ll_dev * ll )
567+ int versal_eth_init (struct wolfIP_ll_dev * ll )
568568{
569569 uint8_t addr ;
570570 uint16_t id1 ;
@@ -573,7 +573,7 @@ int zcu102_eth_init(struct wolfIP_ll_dev *ll)
573573 int fd ;
574574 int link_up ;
575575
576- gem3_hw_reset ();
576+ gem0_hw_reset ();
577577
578578 /* Disable everything before configuring. */
579579 GEM_NWCTRL = 0 ;
@@ -585,7 +585,7 @@ int zcu102_eth_init(struct wolfIP_ll_dev *ll)
585585
586586 /* Initial NWCFG: gigabit, full duplex, MDC=/96, 1536-byte frames,
587587 * strip FCS from RX, accept broadcasts, multicast via hash,
588- * DWIDTH_64 because ZynqMP GEM hangs on a 64-bit AXI bus and
588+ * DWIDTH_64 because the Cadence GEM hangs on a 64-bit AXI bus and
589589 * needs this bit for TX to actually transmit (matches U-Boot
590590 * ZYNQ_GEM_DBUS_WIDTH for CONFIG_ARM64).
591591 * COPYALL temporarily on for first-bring-up so we can confirm
@@ -645,7 +645,7 @@ int zcu102_eth_init(struct wolfIP_ll_dev *ll)
645645 cache_clean (& dummy_tx_bd , sizeof (dummy_tx_bd ));
646646 cache_clean (& dummy_rx_bd , sizeof (dummy_rx_bd ));
647647
648- /* Clear any stale RX/TX packet classification screening. ZynqMP
648+ /* Clear any stale RX/TX packet classification screening. The Cadence
649649 * GEM has SCREENING_TYPE_1 (TID match) at 0x500+ and SCREENING_TYPE_2
650650 * (compare) at 0x540+. If non-zero, frames may be routed to non-Q0
651651 * queues. Default 0 = all to Q0. */
@@ -660,9 +660,6 @@ int zcu102_eth_init(struct wolfIP_ll_dev *ll)
660660 /* Enable MDIO so we can talk to the PHY. */
661661 GEM_NWCTRL |= NWCTRL_MDEN ;
662662
663- /* Probe MDIO addresses 0..31 for a responsive PHY. ZCU102 routes
664- * DP83867 to MDIO address 0x0C, but probing makes the driver
665- * resilient to board variants. */
666663 /* Scan all 32 MDIO addresses, reporting each responsive PHY's ID and
667664 * link status (BMSR reg 1, bit 2). VMK180 can present more than one
668665 * DP83867 on the bus; prefer one that already has copper link so we
@@ -703,7 +700,7 @@ int zcu102_eth_init(struct wolfIP_ll_dev *ll)
703700 }
704701
705702 /* If PHY ended up at 10/100, downshift the MAC speed. The GEM0
706- * reference clock is owned by the PLM (see gem3_set_ref_clk ), so we
703+ * reference clock is owned by the PLM (see gem0_set_ref_clk ), so we
707704 * only adjust the MAC config here, not the CRL clock divider. */
708705 if (speed != 1000 ) {
709706 uint32_t cfg = GEM_NWCFG ;
@@ -715,7 +712,7 @@ int zcu102_eth_init(struct wolfIP_ll_dev *ll)
715712 if (!fd )
716713 cfg &= ~NWCFG_FDEN ;
717714 GEM_NWCFG = cfg ;
718- gem3_set_ref_clk (speed );
715+ gem0_set_ref_clk (speed );
719716 }
720717
721718 /* Install RX ISR. */
0 commit comments