Skip to contentSkip to conversation

net/onsemi: Add NCN26010 driver

PATCH In review Jay Monkman 3 participants 4 messages Sep 18, 2023 – Sep 19, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 4/4 net/onsemi: Add NCN26010 driver

This adds a driver for the onsemi NCN26010 ethernet controller. The NCN26010 is combined MAC/PHY that uses SPI to interface to a microcontroller.

---
 drivers/net/ethernet/Kconfig                  |    1 +
 drivers/net/ethernet/Makefile                 |    1 +
 drivers/net/ethernet/onsemi/Kconfig           |   27 +
 drivers/net/ethernet/onsemi/Makefile          |    9 +
 drivers/net/ethernet/onsemi/onsemi_macphy.h   |  298 +++
 .../net/ethernet/onsemi/onsemi_macphy_core.c  | 2149 +++++++++++++++++
 .../ethernet/onsemi/onsemi_macphy_ethtool.c   |  179 ++
 7 files changed, 2664 insertions(+)
 create mode 100644 drivers/net/ethernet/onsemi/Kconfig
 create mode 100644 drivers/net/ethernet/onsemi/Makefile
 create mode 100644 drivers/net/ethernet/onsemi/onsemi_macphy.h
 create mode 100644 drivers/net/ethernet/onsemi/onsemi_macphy_core.c
 create mode 100644 drivers/net/ethernet/onsemi/onsemi_macphy_ethtool.c
drivers/net/ethernet/Kconfig +1 -0
index 5a274b99f299..5ae26396ccfa 100644
@@ -145,6 +145,7 @@ source "drivers/net/ethernet/ni/Kconfig"
 source "drivers/net/ethernet/natsemi/Kconfig"
 source "drivers/net/ethernet/neterion/Kconfig"
 source "drivers/net/ethernet/netronome/Kconfig"
+source "drivers/net/ethernet/onsemi/Kconfig"
 source "drivers/net/ethernet/8390/Kconfig"
 source "drivers/net/ethernet/nvidia/Kconfig"
 source "drivers/net/ethernet/nxp/Kconfig"
drivers/net/ethernet/Makefile +1 -0
index 0d872d4efcd1..62900d4fcd7a 100644
@@ -73,6 +73,7 @@ obj-$(CONFIG_NET_VENDOR_NVIDIA) += nvidia/
 obj-$(CONFIG_LPC_ENET) += nxp/
 obj-$(CONFIG_NET_VENDOR_OKI) += oki-semi/
 obj-$(CONFIG_ETHOC) += ethoc.o
+obj-$(CONFIG_NET_VENDOR_ONSEMI) += onsemi/
 obj-$(CONFIG_NET_VENDOR_PACKET_ENGINES) += packetengines/
 obj-$(CONFIG_NET_VENDOR_PASEMI) += pasemi/
 obj-$(CONFIG_NET_VENDOR_QLOGIC) += qlogic/
drivers/net/ethernet/onsemi/Kconfig new file +27 -0
new file mode 100644
index 000000000000..a5b029e53a6d
@@ -0,0 +1,27 @@
+# SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause
+#
+# onsemi device configuration
+#
+
+config NET_VENDOR_ONSEMI
+	bool "onsemi devices"
+	default y
+	depends on SPI
+	help
+	  If you have a network (Ethernet) card belonging to this class, say Y.
+
+	  Note that the answer to this question doesn't directly affect the
+	  kernel: saying N will just cause the configurator to skip all
+	  the questions about ONSEMI devices. If you say Y, you will be asked
+	  for your specific card in the following questions.
+
+if NET_VENDOR_ONSEMI
+
+config ONSEMI_MACPHY
+	tristate "onsemi NCN260xx SPI MAC-PHY devices"
+	depends on SPI
+	select NCN26000_PHY
+	help
+	  Say yes here to build support for onsemi MAC-PHY devices
+
+endif # NET_VENDOR_ONSEMI
drivers/net/ethernet/onsemi/Makefile new file +9 -0
new file mode 100644
index 000000000000..50ef2e4930a1
@@ -0,0 +1,9 @@
+# SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause
+#
+# Makefile for the onsemi network device drivers.
+#
+
+obj-$(CONFIG_ONSEMI_MACPHY) += onsemi_macphy.o
+onsemi_macphy-y := \
+	onsemi_macphy_core.o \
+	onsemi_macphy_ethtool.o
drivers/net/ethernet/onsemi/onsemi_macphy.h new file +298 -0

298 lines not on this page · raw message

drivers/net/ethernet/onsemi/onsemi_macphy_core.c new file +2149 -0

2,149 lines not on this page · raw message

drivers/net/ethernet/onsemi/onsemi_macphy_ethtool.c new file +179 -0

179 lines not on this page · raw message

Signature · 1 line
2.40.1
#1 lore raw
Quoted 4 lines · Jay Monkman

This adds a driver for the onsemi NCN26010 ethernet controller. The NCN26010 is combined MAC/PHY that uses SPI to interface to a microcontroller.

Is this an OA TC6 device? At a quick look it does appear to be. Please make use of the framework Microchip is developing:

https://lore.kernel.org/netdev/[email protected]/T/

Andrew

maintainer
#3 lore raw
Quoted 7 lines · Jay Monkman
Quoted 4 lines · Andrew Lunn

Is this an OA TC6 device? At a quick look it does appear to be. Please make use of the framework Microchip is developing:

https://lore.kernel.org/netdev/[email protected]/T/

Yes it is. I wasn't aware of Microchip's work. Thanks for pointing it out.

I guess this patch is going to change a lot in future revisions...

Please double check the code with checkpatch before the next submission, there are a few things that could be improved.

Specifically, avoid c++ style comments, and avoid using multiple label names to jump into the same location - selecting the label name as the target action will make the code more clear.

Thanks,

Paolo