Files
ethercat/devices/Kbuild.in
T
Danila Dergachev a40c85c03a Added macb (Cadence GEM / RP1) driver for kernel 6.18.
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.
2026-06-26 17:58:43 +02:00

109 lines
2.6 KiB
Plaintext

#-----------------------------------------------------------------------------
#
# Copyright (C) 2006-2008 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
#
# ---
#
# vim: syntax=make
#
#-----------------------------------------------------------------------------
src := @abs_srcdir@
ccflags-y := -I@abs_top_builddir@
ifeq (@ENABLE_DRIVER_RESOURCE_VERIFYING@,1)
ccflags-y += -DEC_ENABLE_DRIVER_RESOURCE_VERIFYING
endif
REV := $(shell if test -s $(src)/../revision; then \
cat $(src)/../revision; \
else \
git -C $(src)/.. describe 2>/dev/null || echo "unknown"; \
fi)
ifeq (@ENABLE_GENERIC@,1)
EC_GENERIC_OBJ := generic.o
obj-m += ec_generic.o
ec_generic-objs := $(EC_GENERIC_OBJ)
CFLAGS_$(EC_GENERIC_OBJ) = -DREV=$(REV)
endif
ifeq (@ENABLE_8139TOO@,1)
EC_8139TOO_OBJ := 8139too-@KERNEL_8139TOO@-ethercat.o
obj-m += ec_8139too.o
ec_8139too-objs := $(EC_8139TOO_OBJ)
CFLAGS_$(EC_8139TOO_OBJ) = -DREV=$(REV)
endif
ifeq (@ENABLE_CCAT@,1)
obj-m += ccat/
endif
ifeq (@ENABLE_E100@,1)
EC_E100_OBJ := e100-@KERNEL_E100@-ethercat.o
obj-m += ec_e100.o
ec_e100-objs := $(EC_E100_OBJ)
CFLAGS_$(EC_E100_OBJ) = -DREV=$(REV)
endif
ifeq (@ENABLE_E1000@,1)
obj-m += e1000/
endif
ifeq (@ENABLE_E1000E@,1)
obj-m += e1000e/
endif
ifeq (@ENABLE_GENET@,1)
obj-m += genet/
endif
ifeq (@ENABLE_IGB@,1)
obj-m += igb/
endif
ifeq (@ENABLE_IGC@,1)
obj-m += igc/
endif
ifeq (@ENABLE_MACB@,1)
obj-m += macb/
endif
ifeq (@ENABLE_R8169@,1)
ifeq (@R8169_IN_SUBDIR@,1)
obj-m += r8169/
else
EC_R8169_OBJ := r8169-@KERNEL_R8169@-ethercat.o
obj-m += ec_r8169.o
ec_r8169-objs := $(EC_R8169_OBJ)
CFLAGS_$(EC_R8169_OBJ) = -DREV=$(REV)
endif
endif
ifeq (@ENABLE_STMMAC@,1)
obj-m += stmmac/
endif
KBUILD_EXTRA_SYMBOLS := \
@abs_top_builddir@/$(LINUX_SYMVERS) \
@abs_top_builddir@/master/$(LINUX_SYMVERS)
#-----------------------------------------------------------------------------