Skip to content

Commit

Permalink
ethernet: bundle module for Motorcomm YT6801
Browse files Browse the repository at this point in the history
- The Asus XC-LS3A6M motherboard (Loongson 3A6000) comes with two Ethernet
  ports, which uses a yt6801 controller.
- This patch introduces an out of tree module to provide support for this
  NIC. [^1]
- Refactor module tree to make it work with Kconfig. [^2]
- Drop unneeded installation script (yt_nic_install.sh).
- Trim README to remove useless installation instructions.
- enable YT6801 for x86 arm64 and loongarch as module

[^1]: Ref: https://www.motor-comm.com/Public/Uploads/uploadfile/files/20240104/yt6801-linux-driver-1.0.27.zip
[^2]: CONFIG_NET_VENDOR_MOTORCOMM =(y)=> CONFIG_YT8601 (tristate).

Co-authored-by: Mingcong Bai <[email protected]>
Co-authored-by: Xiaotian Wu <[email protected]>
Signed-off-by: Wentao Guan <[email protected]>
  • Loading branch information
3 people committed May 22, 2024
1 parent f989c57 commit d304189
Show file tree
Hide file tree
Showing 25 changed files with 19,212 additions and 0 deletions.
1 change: 1 addition & 0 deletions arch/arm64/configs/deepin_arm64_desktop_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1406,6 +1406,7 @@ CONFIG_ENC28J60=m
CONFIG_ENC28J60_WRITEVERIFY=y
CONFIG_ENCX24J600=m
CONFIG_LAN743X=m
CONFIG_YT6801=m
CONFIG_MSCC_OCELOT_SWITCH=m
CONFIG_MYRI10GE=m
CONFIG_FEALNX=m
Expand Down
1 change: 1 addition & 0 deletions arch/loongarch/configs/deepin_loongarch_desktop_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1378,6 +1378,7 @@ CONFIG_ENC28J60=m
CONFIG_ENCX24J600=m
CONFIG_LAN743X=m
CONFIG_LAN966X_SWITCH=m
CONFIG_YT6801=m
CONFIG_MSCC_OCELOT_SWITCH=m
CONFIG_MYRI10GE=m
CONFIG_FEALNX=m
Expand Down
1 change: 1 addition & 0 deletions arch/x86/configs/deepin_x86_desktop_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1340,6 +1340,7 @@ CONFIG_KSZ884X_PCI=m
CONFIG_ENC28J60=m
CONFIG_ENCX24J600=m
CONFIG_LAN743X=m
CONFIG_YT6801=m
CONFIG_MYRI10GE=m
CONFIG_FEALNX=m
CONFIG_NI_XGE_MANAGEMENT_ENET=m
Expand Down
1 change: 1 addition & 0 deletions drivers/net/ethernet/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ source "drivers/net/ethernet/mediatek/Kconfig"
source "drivers/net/ethernet/mellanox/Kconfig"
source "drivers/net/ethernet/micrel/Kconfig"
source "drivers/net/ethernet/microchip/Kconfig"
source "drivers/net/ethernet/motorcomm/Kconfig"
source "drivers/net/ethernet/mscc/Kconfig"
source "drivers/net/ethernet/microsoft/Kconfig"
source "drivers/net/ethernet/moxa/Kconfig"
Expand Down
1 change: 1 addition & 0 deletions drivers/net/ethernet/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ obj-$(CONFIG_NET_VENDOR_MEDIATEK) += mediatek/
obj-$(CONFIG_NET_VENDOR_MELLANOX) += mellanox/
obj-$(CONFIG_NET_VENDOR_MICREL) += micrel/
obj-$(CONFIG_NET_VENDOR_MICROCHIP) += microchip/
obj-$(CONFIG_NET_VENDOR_MOTORCOMM) += motorcomm/
obj-$(CONFIG_NET_VENDOR_MICROSEMI) += mscc/
obj-$(CONFIG_NET_VENDOR_MOXART) += moxa/
obj-$(CONFIG_NET_VENDOR_MYRI) += myricom/
Expand Down
29 changes: 29 additions & 0 deletions drivers/net/ethernet/motorcomm/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# SPDX-License-Identifier: GPL-2.0-only
#
# Motorcomm network device configuration
#

config NET_VENDOR_MOTORCOMM
bool "Motorcomm devices"
default y
depends on PCI
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 Motorcomm cards. If you say Y, you will be asked
for your specific card in the following questions.

if NET_VENDOR_MOTORCOMM

config YT6801
tristate "Motorcomm YT6801 Ethernet support"
depends on PCI
help
If you have a network (Ethernet) controller of this type, say Y here.

To compile this driver as a module, choose M here. The module
will be called forcedeth.

endif # NET_VENDOR_MOTORCOMM
1 change: 1 addition & 0 deletions drivers/net/ethernet/motorcomm/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
obj-$(CONFIG_YT6801) += yt6801/
23 changes: 23 additions & 0 deletions drivers/net/ethernet/motorcomm/yt6801/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# SPDX-License-Identifier: GPL-2.0-only
################################################################################
#
# Copyright (c) 2023 Motorcomm, Inc.
# Motorcomm Confidential and Proprietary.
#
# This is Motorcomm NIC driver relevant files. Please don't copy, modify,
# distribute without commercial permission.
#
################################################################################

obj-$(CONFIG_YT6801) += yt6801.o

yt6801-objs := fuxi-gmac-common.o \
fuxi-gmac-desc.o \
fuxi-gmac-ethtool.o \
fuxi-gmac-hw.o \
fuxi-gmac-net.o \
fuxi-gmac-pci.o \
fuxi-gmac-phy.o \
fuxi-efuse.o \
fuxi-dbg.o \
fuxi-gmac-debugfs.o
30 changes: 30 additions & 0 deletions drivers/net/ethernet/motorcomm/yt6801/Notice.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
=============================================================================

This file contains certain notices of software components included with
the software that Motorcomm, Inc. ("Motorcomm") is required to
provide you. Except where prohibited by the open source license, the
content of this file is provided solely to satisfy Motorcomm's attribution
and notice requirement; your use of these software components
together with the Motorcomm software ("Software") is subject to the terms
of your license from Motorcomm. Compliance with all copyright laws and
software license agreements included in the notice section of this
file are the responsibility of the user. Except as may be granted by
separate express written agreement, this file provides no license to
any patents, trademarks, copyrights, or other intellectual property
of Motorcomm or any of its subsidiaries.

Software provided with this notice is NOT A CONTRIBUTION to any open
source project. If alternative licensing is available for any of the
components with licenses or attributions provided below, a license
choice is made for receiving such code by Motorcomm.

Copyright (c) 2021 Motorcomm, Inc. All rights reserved.

Motorcomm is a trademark of Motorcomm Incorporated, registered in China
and other countries. All Motorcomm Incorporated trademarks
are used with permission. Other products and brand names may be
trademarks or registered trademarks of their respective owners.

=============================================================================


89 changes: 89 additions & 0 deletions drivers/net/ethernet/motorcomm/yt6801/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
<Linux device driver for Motorcomm Ethernet controllers>

This is the Linux device driver released for Motorcomm YT6801 Gigabit
Ethernet controllers with PCI-Express interface.

<Set the network related information>
1. Set manually
a. Set the IP address of your machine.

# ifconfig ethX "the IP address of your machine"

b. Set the IP address of DNS.

Insert the following configuration in /etc/resolv.conf.

nameserver "the IP address of DNS"

c. Set the IP address of gateway.

# route add default gw "the IP address of gateway"

2. Set by doing configurations in /etc/sysconfig/network-scripts
/ifcfg-ethX for Redhat and Fedora, or /etc/sysconfig/network
/ifcfg-ethX for SuSE. There are two examples to set network
configurations.

a. Fixed IP address:
DEVICE=eth0
BOOTPROTO=static
ONBOOT=yes
TYPE=ethernet
NETMASK=255.255.255.0
IPADDR=192.168.1.1
GATEWAY=192.168.1.254
BROADCAST=192.168.1.255

b. DHCP:
DEVICE=eth0
BOOTPROTO=dhcp
ONBOOT=yes

<Modify the MAC address>
There are two ways to modify the MAC address of the NIC.
1. Use ifconfig:

# ifconfig ethX hw ether YY:YY:YY:YY:YY:YY

,where X is the device number assigned by Linux kernel, and
YY:YY:YY:YY:YY:YY is the MAC address assigned by the user.

2. Use ip:

# ip link set ethX address YY:YY:YY:YY:YY:YY

,where X is the device number assigned by Linux kernel, and
YY:YY:YY:YY:YY:YY is the MAC address assigned by the user.

<Force Link Status>

Force the link status by using ethtool.
a. Insert the driver first.
b. Make sure that ethtool exists in /sbin.
c. Force the link status as the following command.

# ethtool -s ethX speed SPEED_MODE duplex DUPLEX_MODE autoneg NWAY_OPTION

,where
SPEED_MODE = 1000 for 1000Mbps
= 100 for 100Mbps
= 10 for 10Mbps
DUPLEX_MODE = half for half-duplex
= full for full-duplex
NWAY_OPTION = off for auto-negotiation off (true force)
= on for auto-negotiation on (nway force)

For example:

# ethtool -s eth0 speed 100 duplex full autoneg on

will force PHY to operate in 100Mpbs Full-duplex(nway force).

<Jumbo Frame>
Transmitting Jumbo Frames, whose packet size is bigger than 1500 bytes, please change mtu by the following command.

# ifconfig ethX mtu MTU

, where X=0,1,2,..., and MTU is configured by user.

YT6801 supports Jumbo Frame size up to 9 kBytes.
Loading

0 comments on commit d304189

Please sign in to comment.