mirror of
https://gitlab.com/etherlab.org/ethercat.git
synced 2026-08-18 00:57:23 +08:00
Native EtherCAT device driver for the Raspberry Pi 5 on-RP1 gigabit MAC (Cadence GEM, "macb"), ported from the genet recipe. Lets the IgH kernel master poll-drive the NIC directly instead of via the generic driver. Derived from the in-tree macb driver at Linux 6.18.33 (drivers/net/ethernet/cadence: macb_main.c, macb.h, macb_ptp.c); the -orig files are verbatim, the -ethercat files add the ecdev hooks (ecdev_offer/open/close/withdraw, ec_poll, gem_rx -> ecdev_receive, a persistent TX skb ring, IRQ/NAPI/PTP gated by get_ecdev()). macb-specific points vs the genet recipe: - ecdev_offer() before macb_init() (macb requests its IRQs there). - phylink (not MDIO adjust_link); phylink_start/stop wrapped in rtnl_lock in EtherCAT mode (ecdev_open runs without the RTNL lock). - MAC PHC / PTP init gated off in EtherCAT mode. - macb_pad_and_fcs(): the master reuses one persistent TX skb and rewrites skb->len each cycle without resetting the tail, so re-sync the tail and append the software FCS in place; a plain skb_put() walked the tail past the buffer end -> skb_over_panic(). Tested on a Raspberry Pi 5 (BCM2712, 6.18.33-rt) against an A6-EC servo drive: binds the RP1 GEM, reaches OP, 0 lost frames at up to 4 kHz. Build: ./configure --enable-macb [--with-macb-kernel=6.18] Known limitations: RX allocates an skb per frame in the poll path (a future revision can reuse the buffer in place); only the GEM RX path carries the hook (RP1 is GEM); PM suspend/resume is not specially handled.
125 lines
3.1 KiB
Makefile
125 lines
3.1 KiB
Makefile
#------------------------------------------------------------------------------
|
|
#
|
|
# Copyright (C) 2006-2025 Florian Pose, Ingenieurgemeinschaft IgH
|
|
#
|
|
# This file is part of the IgH EtherCAT Master.
|
|
#
|
|
# The IgH EtherCAT Master is free software; you can redistribute it and/or
|
|
# modify it under the terms of the GNU General Public License version 2, as
|
|
# published by the Free Software Foundation.
|
|
#
|
|
# The IgH EtherCAT Master is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
|
# Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License along
|
|
# with the IgH EtherCAT Master; if not, write to the Free Software
|
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
#
|
|
#------------------------------------------------------------------------------
|
|
|
|
include $(top_srcdir)/Makefile.kbuild
|
|
|
|
SUBDIRS = \
|
|
ccat \
|
|
e1000 \
|
|
e1000e \
|
|
genet \
|
|
igb \
|
|
igc \
|
|
macb \
|
|
r8169 \
|
|
stmmac
|
|
|
|
EXTRA_DIST = \
|
|
8139too-3.0-ethercat.c \
|
|
8139too-3.0-orig.c \
|
|
8139too-3.10-ethercat.c \
|
|
8139too-3.10-orig.c \
|
|
8139too-3.12-ethercat.c \
|
|
8139too-3.12-orig.c \
|
|
8139too-3.14-ethercat.c \
|
|
8139too-3.14-orig.c \
|
|
8139too-3.16-ethercat.c \
|
|
8139too-3.16-orig.c \
|
|
8139too-3.2-ethercat.c \
|
|
8139too-3.2-orig.c \
|
|
8139too-3.4-ethercat.c \
|
|
8139too-3.4-orig.c \
|
|
8139too-3.6-ethercat.c \
|
|
8139too-3.6-orig.c \
|
|
8139too-3.8-ethercat.c \
|
|
8139too-3.8-orig.c \
|
|
8139too-4.4-ethercat.c \
|
|
8139too-4.4-orig.c \
|
|
8139too-5.10-ethercat.c \
|
|
8139too-5.10-orig.c \
|
|
8139too-5.14-ethercat.c \
|
|
8139too-5.14-orig.c \
|
|
8139too-5.15-ethercat.c \
|
|
8139too-5.15-orig.c \
|
|
8139too-6.1-ethercat.c \
|
|
8139too-6.1-orig.c \
|
|
8139too-6.12-ethercat.c \
|
|
8139too-6.12-orig.c \
|
|
8139too-6.4-ethercat.c \
|
|
8139too-6.4-orig.c \
|
|
create_driver_table.py \
|
|
device_drivers_template.md \
|
|
e100-3.0-ethercat.c \
|
|
e100-3.0-orig.c \
|
|
e100-3.10-ethercat.c \
|
|
e100-3.10-orig.c \
|
|
e100-3.12-ethercat.c \
|
|
e100-3.12-orig.c \
|
|
e100-3.14-ethercat.c \
|
|
e100-3.14-orig.c \
|
|
e100-3.16-ethercat.c \
|
|
e100-3.16-orig.c \
|
|
e100-3.4-ethercat.c \
|
|
e100-3.4-orig.c \
|
|
e100-3.6-ethercat.c \
|
|
e100-3.6-orig.c \
|
|
e100-3.8-ethercat.c \
|
|
e100-3.8-orig.c \
|
|
e100-4.4-ethercat.c \
|
|
e100-4.4-orig.c \
|
|
e100-5.10-ethercat.c \
|
|
e100-5.10-orig.c \
|
|
e100-5.14-ethercat.c \
|
|
e100-5.14-orig.c \
|
|
e100-5.15-ethercat.c \
|
|
e100-5.15-orig.c \
|
|
e100-5.4-ethercat.c \
|
|
e100-5.4-orig.c \
|
|
e100-6.1-ethercat.c \
|
|
e100-6.1-orig.c \
|
|
e100-6.12-ethercat.c \
|
|
e100-6.12-orig.c \
|
|
e100-6.4-ethercat.c \
|
|
e100-6.4-orig.c \
|
|
ecdev.h \
|
|
generic.c \
|
|
r8169-3.10-ethercat.c \
|
|
r8169-3.10-orig.c \
|
|
r8169-3.12-ethercat.c \
|
|
r8169-3.12-orig.c \
|
|
r8169-3.14-ethercat.c \
|
|
r8169-3.14-orig.c \
|
|
r8169-3.16-ethercat.c \
|
|
r8169-3.16-orig.c \
|
|
r8169-3.2-ethercat.c \
|
|
r8169-3.2-orig.c \
|
|
r8169-3.4-ethercat.c \
|
|
r8169-3.4-orig.c \
|
|
r8169-3.6-ethercat.c \
|
|
r8169-3.6-orig.c \
|
|
r8169-3.8-ethercat.c \
|
|
r8169-3.8-orig.c \
|
|
r8169-4.4-ethercat.c \
|
|
r8169-4.4-orig.c \
|
|
update.sh
|
|
|
|
#------------------------------------------------------------------------------
|