net: emac: emac gigabit ethernet controller driver
Subsystems (5)
PATCH v10 1/1 net: emac: emac gigabit ethernet controller driver
Add support for the Qualcomm Technologies, Inc. EMAC gigabit Ethernet controller.
This driver supports the following features:
1) Checksum offload.
2) Interrupt coalescing support.
3) SGMII phy.
4) phylib interface for external phy
Based on original work by
Niranjana Vishwanathapura <[email protected]> Gilad Avidov <[email protected]>
---
v10:
- removed superfluous acpi-related data
- fix the Makefiles to allow module building
- rename "jubbers" to "jabbers"
- fix some function prototypes (found via sparse)
- removed invalid __iomem (found via sparse)
- don't print phy status unless phy is attached
.../devicetree/bindings/net/qcom-emac.txt | 112 ++ MAINTAINERS | 6 + drivers/net/ethernet/qualcomm/Kconfig | 12 + drivers/net/ethernet/qualcomm/Makefile | 2 + drivers/net/ethernet/qualcomm/emac/Makefile | 7 + drivers/net/ethernet/qualcomm/emac/emac-mac.c | 1528 ++++++++++++++++++++ drivers/net/ethernet/qualcomm/emac/emac-mac.h | 248 ++++ drivers/net/ethernet/qualcomm/emac/emac-phy.c | 204 +++ drivers/net/ethernet/qualcomm/emac/emac-phy.h | 33 + drivers/net/ethernet/qualcomm/emac/emac-sgmii.c | 722 +++++++++ drivers/net/ethernet/qualcomm/emac/emac-sgmii.h | 24 + drivers/net/ethernet/qualcomm/emac/emac.c | 743 ++++++++++ drivers/net/ethernet/qualcomm/emac/emac.h | 335 +++++ 13 files changed, 3976 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/qcom-emac.txt create mode 100644 drivers/net/ethernet/qualcomm/emac/Makefile create mode 100644 drivers/net/ethernet/qualcomm/emac/emac-mac.c create mode 100644 drivers/net/ethernet/qualcomm/emac/emac-mac.h create mode 100644 drivers/net/ethernet/qualcomm/emac/emac-phy.c create mode 100644 drivers/net/ethernet/qualcomm/emac/emac-phy.h create mode 100644 drivers/net/ethernet/qualcomm/emac/emac-sgmii.c create mode 100644 drivers/net/ethernet/qualcomm/emac/emac-sgmii.h create mode 100644 drivers/net/ethernet/qualcomm/emac/emac.c create mode 100644 drivers/net/ethernet/qualcomm/emac/emac.h
Documentation/devicetree/bindings/net/qcom-emac.txt new file +112 -0
@@ -0,0 +1,112 @@ +Qualcomm Technologies EMAC Gigabit Ethernet Controller + +This network controller consists of two devices: a MAC and an SGMII +internal PHY. Each device is represented by a device tree node. A phandle +connects the MAC node to its corresponding internal phy node. Another +phandle points to the external PHY node. + +Required properties: + +MAC node: +- compatible : Should be "qcom,fsm9900-emac". +- reg : Offset and length of the register regions for the device +- interrupts : Interrupt number used by this controller +- mac-address : The 6-byte MAC address. If present, it is the default + MAC address. +- internal-phy : phandle to the internal PHY node +- phy-handle : phandle the the external PHY node + +Internal PHY node: +- compatible : Should be "qcom,fsm9900-emac-sgmii" or "qcom,qdf2432-emac-sgmii". +- reg : Offset and length of the register region(s) for the device +- interrupts : Interrupt number used by this controller + +The external phy child node: +- reg : The phy address + +Example: + +FSM9900: + +soc { + #address-cells = <1>; + #size-cells = <1>; + + emac0: ethernet@feb20000 { + compatible = "qcom,fsm9900-emac"; + reg = <0xfeb20000 0x10000>, + <0xfeb36000 0x1000>; + interrupts = <76>; + + clocks = <&gcc 0>, <&gcc 1>, <&gcc 3>, <&gcc 4>, <&gcc 5>, + <&gcc 6>, <&gcc 7>; + clock-names = "axi_clk", "cfg_ahb_clk", "high_speed_clk", + "mdio_clk", "tx_clk", "rx_clk", "sys_clk"; + + internal-phy = <&emac_sgmii>; + + phy-handle = <&phy0>; + + #address-cells = <1>; + #size-cells = <0>; + phy0: ethernet-phy@0 { + reg = <0>; + }; + + pinctrl-names = "default"; + pinctrl-0 = <&mdio_pins_a>; + }; + + emac_sgmii: ethernet@feb38000 { + compatible = "qcom,fsm9900-emac-sgmii"; + reg = <0xfeb38000 0x1000>; + interrupts = <80>; + }; + + tlmm: pinctrl@fd510000 { + compatible = "qcom,fsm9900-pinctrl"; + + mdio_pins_a: mdio { + state { + pins = "gpio123", "gpio124"; + function = "mdio"; + }; + }; + }; + + +QDF2432: + +soc { + #address-cells = <2>; + #size-cells = <2>; + + emac0: ethernet@38800000 { + compatible = "qcom,fsm9900-emac"; + reg = <0x0 0x38800000 0x0 0x10000>, + <0x0 0x38816000 0x0 0x1000>; + interrupts = <0 256 4>; + + clocks = <&gcc 0>, <&gcc 1>, <&gcc 3>, <&gcc 4>, <&gcc 5>, + <&gcc 6>, <&gcc 7>; + clock-names = "axi_clk", "cfg_ahb_clk", "high_speed_clk", + "mdio_clk", "tx_clk", "rx_clk", "sys_clk"; + + internal-phy = <&emac_sgmii>; + + phy-handle = <&phy0>; + + #address-cells = <1>; + #size-cells = <0>; + phy0: ethernet-phy@4 { + reg = <4>; + }; + }; + + emac_sgmii: ethernet@410400 { + compatible = "qcom,qdf2432-emac-sgmii"; + reg = <0x0 0x00410400 0x0 0xc00>, /* Base address */ + <0x0 0x00410000 0x0 0x400>; /* Per-lane digital */ + interrupts = <0 254 1>; + }; +
MAINTAINERS +6 -0
@@ -9404,6 +9404,12 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git S: Supported F: drivers/net/wireless/ath/ath10k/ +QUALCOMM EMAC GIGABIT ETHERNET DRIVER +M: Timur Tabi <[email protected]> +L: [email protected] +S: Supported +F: drivers/net/ethernet/qualcomm/emac/ + QUALCOMM HEXAGON ARCHITECTURE M: Richard Kuo <[email protected]> L: [email protected]
drivers/net/ethernet/qualcomm/Kconfig +12 -0
@@ -24,4 +24,16 @@ config QCA7000 To compile this driver as a module, choose M here. The module will be called qcaspi. +config QCOM_EMAC + tristate "Qualcomm Technologies, Inc. EMAC Gigabit Ethernet support" + select CRC32 + select PHYLIB + ---help--- + This driver supports the Qualcomm Technologies, Inc. Gigabit + Ethernet Media Access Controller (EMAC). The controller + supports IEEE 802.3-2002, half-duplex mode at 10/100 Mb/s, + full-duplex mode at 10/100/1000Mb/s, Wake On LAN (WOL) for + low power, Receive-Side Scaling (RSS), and IEEE 1588-2008 + Precision Clock Synchronization Protocol. + endif # NET_VENDOR_QUALCOMM
drivers/net/ethernet/qualcomm/Makefile +2 -0
@@ -4,3 +4,5 @@ obj-$(CONFIG_QCA7000) += qcaspi.o qcaspi-objs := qca_spi.o qca_framing.o qca_7k.o qca_debug.o + +obj-y += emac/
drivers/net/ethernet/qualcomm/emac/Makefile new file +7 -0
@@ -0,0 +1,7 @@ +# +# Makefile for the Qualcomm Technologies, Inc. EMAC Gigabit Ethernet driver +# + +obj-$(CONFIG_QCOM_EMAC) += qcom-emac.o + +qcom-emac-objs := emac.o emac-mac.o emac-phy.o emac-sgmii.o
drivers/net/ethernet/qualcomm/emac/emac-mac.c new file +1528 -0
1,528 lines not on this page · raw message
drivers/net/ethernet/qualcomm/emac/emac-mac.h new file +248 -0
248 lines not on this page · raw message
drivers/net/ethernet/qualcomm/emac/emac-phy.c new file +204 -0
204 lines not on this page · raw message
drivers/net/ethernet/qualcomm/emac/emac-phy.h new file +33 -0
@@ -0,0 +1,33 @@ +/* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 and +* only version 2 as published by the Free Software Foundation. +* +* This program 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. +*/ + +#ifndef _EMAC_PHY_H_ +#define _EMAC_PHY_H_ + +typedef int (*emac_sgmii_initialize )(struct emac_adapter *adpt); + +/** emac_phy - internal emac phy +* @base base address +* @digital per-lane digital block +* @initialize initialization function +*/ +struct emac_phy { +void __iomem *base; +void __iomem *digital; +emac_sgmii_initialize initialize; +}; + +struct emac_adapter ; + +int emac_phy_config (struct platform_device *pdev,struct emac_adapter *adpt); + +#endif /* _EMAC_PHY_H_ */
drivers/net/ethernet/qualcomm/emac/emac-sgmii.c new file +722 -0
722 lines not on this page · raw message
drivers/net/ethernet/qualcomm/emac/emac-sgmii.h new file +24 -0
@@ -0,0 +1,24 @@ +/* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 and +* only version 2 as published by the Free Software Foundation. +* +* This program 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. +*/ + +#ifndef _EMAC_SGMII_H_ +#define _EMAC_SGMII_H_ + +struct emac_adapter ; +struct platform_device ; + +int emac_sgmii_init_v1 (struct emac_adapter *adpt); +int emac_sgmii_init_v2 (struct emac_adapter *adpt); +int emac_sgmii_config (struct platform_device *pdev,struct emac_adapter *adpt); +void emac_sgmii_reset (struct emac_adapter *adpt); + +#endif
drivers/net/ethernet/qualcomm/emac/emac.c new file +743 -0
89 lines not on this page · raw message
drivers/net/ethernet/qualcomm/emac/emac.h new file +335 -0
335 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 3 lines
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm Technologies, Inc. Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.
Part of the diff is not shown here. View the raw message.
From: Timur Tabi <[email protected]>
Date: Wed, 31 Aug 2016 18:22:08 -0500
Quoted 9 lines
Add support for the Qualcomm Technologies, Inc. EMAC gigabit Ethernet controller.
This driver supports the following features:
1) Checksum offload.
2) Interrupt coalescing support.
3) SGMII phy.
4) phylib interface for external phy
Quoted 5 lines
Based on original work by
Niranjana Vishwanathapura <[email protected]> Gilad Avidov <[email protected]>Signed-off-by Timur Tabi <[email protected]>
Applied to net-next, thanks.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html