Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net: phytium: Add support for phytium GMAC #222

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions Documentation/devicetree/bindings/net/phytmac.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
* Phytium xgmac Ethernet controller

Required properties:
- compatible: Should be "phytium,gmac-[version]"
Use "phytium,gmac-1.0" for gmac version 1.0 on Phytium SoCs
Use "phytium,gmac-2.0" for gmac version 2.0 on Phytium SoCs

- reg: Address and length of the register set for the device
- interrupts: Should contain phytmac interrupt
- queue-number: The number of queues for the device
- phy-mode: See ethernet.txt file in the same directory
- fixed-link:See ethernet.txt file in the same directory
- dma-coherent: Boolean property, must only be present if memory
accesses performed by the device are cache coherent.

The MAC address will be determined using the optional properties
defined in ethernet.txt.

Examples:

eth0@36ce0000 {
compatible = "phytium,gmac-1.0";
reg = <0x00 0x36ce0000 0x00 0x2000>;
interrupts = <0x00 0x20 0x04 0x00 0x21 0x04 0x00 0x22 0x04 0x00 0x23 0x04>;
queue-number = <0x04>;
magic-packet;
dma-coherent;
phy-mode = "usxgmii";
status = "okay";

fixed-link {
speed = <0x2710>;
full-duplex;
};
};
1 change: 1 addition & 0 deletions drivers/net/ethernet/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -192,5 +192,6 @@ source "drivers/net/ethernet/wangxun/Kconfig"
source "drivers/net/ethernet/wiznet/Kconfig"
source "drivers/net/ethernet/xilinx/Kconfig"
source "drivers/net/ethernet/xircom/Kconfig"
source "drivers/net/ethernet/phytium/Kconfig"

endif # ETHERNET
1 change: 1 addition & 0 deletions drivers/net/ethernet/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,4 @@ obj-$(CONFIG_NET_VENDOR_XILINX) += xilinx/
obj-$(CONFIG_NET_VENDOR_XIRCOM) += xircom/
obj-$(CONFIG_NET_VENDOR_SYNOPSYS) += synopsys/
obj-$(CONFIG_NET_VENDOR_PENSANDO) += pensando/
obj-$(CONFIG_NET_VENDOR_PHYTIUM) += phytium/
58 changes: 58 additions & 0 deletions drivers/net/ethernet/phytium/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# SPDX-License-Identifier: GPL-2.0-only
#
# Phytium device configuration
#

config NET_VENDOR_PHYTIUM
bool "Phytium devices"
depends on HAS_IOMEM
default y
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
remaining Cadence network card questions. If you say Y, you will be
asked for your specific card in the following questions.

if NET_VENDOR_PHYTIUM

config PHYTMAC
tristate "Phytium GMAC support"
depends on HAS_DMA
select PHYLINK
select CRC32
help
If you have a network (Ethernet) controller of this type, say Y
or M here.

To compile this driver as a module, choose M here: the module
will be phytmac.

config PHYTMAC_ENABLE_PTP
bool "Enable IEEE 1588 hwstamp"
depends on PHYTMAC
depends on PTP_1588_CLOCK
default y
help
Enable IEEE 1588 PTP support for PHYTMAC.

config PHYTMAC_PLATFORM
tristate "Phytmac Platform support"
depends on PHYTMAC
help
This is Platform driver.

To compile this driver as a module, choose M here: the module
will be called phytmac_platform.

config PHYTMAC_PCI
tristate "Phytmac PCI support"
depends on PHYTMAC && PCI
help
This is PCI driver.

To compile this driver as a module, choose M here: the module
will be called phytmac_pci.

endif # NET_VENDOR_PHYTIUM
17 changes: 17 additions & 0 deletions drivers/net/ethernet/phytium/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

# SPDX-License-Identifier: GPL-2.0
#
# Makefile for the Phytium network device drivers.
#
#

obj-$(CONFIG_PHYTMAC) += phytmac.o

phytmac-objs := phytmac_main.o phytmac_ethtool.o phytmac_v1.o phytmac_v2.o
phytmac-$(CONFIG_PHYTMAC_ENABLE_PTP) += phytmac_ptp.o

obj-$(CONFIG_PHYTMAC_PLATFORM) += phytmac-platform.o
phytmac-platform-objs := phytmac_platform.o

obj-$(CONFIG_PHYTMAC_PCI) += phytmac-pci.o
phytmac-pci-objs := phytmac_pci.o
Loading