Skip to content

Commit

Permalink
Merge branch 'netcp'
Browse files Browse the repository at this point in the history
Murali Karicheri says:

====================
net: Add Keystone NetCP ethernet driver support

The Network Coprocessor (NetCP) is a hardware accelerator that processes
Ethernet packets. NetCP has a gigabit Ethernet (GbE) subsystem with a ethernet
switch sub-module to send and receive packets. NetCP also includes a packet
accelerator (PA) module to perform packet classification operations such as
header matching, and packet modification operations such as checksum
generation. NetCP can also optionally include a Security Accelerator(SA)
capable of performing IPSec operations on ingress/egress packets.

Keystone SoC's also have a 10 Gigabit Ethernet Subsystem (XGbE) which
includes a 3-port Ethernet switch sub-module capable of 10Gb/s and
1Gb/s rates per Ethernet port.

Both GBE and XGBE network processors supported using common driver. It
is also designed to handle future variants of NetCP.

version history
---------------
v7->v8

 - Reworked comments against v7, related to checker warning.
 - Patch 2/4 that has all of the driver code in v7 is now split into 3
   patches based on functionality so that we have 3 smaller patches
   review instead of a big patch.
 - Patch for MAINTAINER is merged to 2/4 along with netcp core driver
 - Separate patch (3/4) for 1G and  (4/4) for 10G
 - Removed big endian support for initial version (will add it later)

v6->v7
 - Fixed some minor documentation error and also modified the netcp driver
   to fix the set* functions to include correct le/be macros.

v5->v6
 - updated version after incorporating comments [6] from David Miller,
   David Laight & Geert Uytterhoeven on v5. I would like get this in
   for v3.19 merge window if the latest version is acceptable.

v4->v5
 - Sorry to spin v5 quickly but I missed few check-patch warnings which
   were pointed by Joe Perches(thanks). I folded his changes [5] along with
   few more check-patch warning fixes. I would like get this in for v3.18
   merge window if David is happy with this version.

v3->v4
 - Couple of fixes in in error path as pointed [4] out by David. Rest of
   the patches are unchanged from v3.

v2->v3
 - Update v3 after incorporating Jamal and David Miller's comment/suggestion
   from earlier versions [1] [2].  After per the discussion here [3], the
   controversial custom exports have been dropped now. And for future
   future offload support additions, we will plug into generic frameworks
   as an when they are available.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Jan 19, 2015
2 parents 92cb13f + 90cff9e commit b66a4ea
Show file tree
Hide file tree
Showing 9 changed files with 5,377 additions and 0 deletions.
197 changes: 197 additions & 0 deletions Documentation/devicetree/bindings/net/keystone-netcp.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
This document describes the device tree bindings associated with the
keystone network coprocessor(NetCP) driver support.

The network coprocessor (NetCP) is a hardware accelerator that processes
Ethernet packets. NetCP has a gigabit Ethernet (GbE) subsytem with a ethernet
switch sub-module to send and receive packets. NetCP also includes a packet
accelerator (PA) module to perform packet classification operations such as
header matching, and packet modification operations such as checksum
generation. NetCP can also optionally include a Security Accelerator (SA)
capable of performing IPSec operations on ingress/egress packets.

Keystone II SoC's also have a 10 Gigabit Ethernet Subsystem (XGbE) which
includes a 3-port Ethernet switch sub-module capable of 10Gb/s and 1Gb/s rates
per Ethernet port.

Keystone NetCP driver has a plug-in module architecture where each of the NetCP
sub-modules exist as a loadable kernel module which plug in to the netcp core.
These sub-modules are represented as "netcp-devices" in the dts bindings. It is
mandatory to have the ethernet switch sub-module for the ethernet interface to
be operational. Any other sub-module like the PA is optional.

NetCP Ethernet SubSystem Layout:

-----------------------------
NetCP subsystem(10G or 1G)
-----------------------------
|
|-> NetCP Devices -> |
| |-> GBE/XGBE Switch
| |
| |-> Packet Accelerator
| |
| |-> Security Accelerator
|
|
|
|-> NetCP Interfaces -> |
|-> Ethernet Port 0
|
|-> Ethernet Port 1
|
|-> Ethernet Port 2
|
|-> Ethernet Port 3


NetCP subsystem properties:
Required properties:
- compatible: Should be "ti,netcp-1.0"
- clocks: phandle to the reference clocks for the subsystem.
- dma-id: Navigator packet dma instance id.

Optional properties:
- reg: register location and the size for the following register
regions in the specified order.
- Efuse MAC address register
- dma-coherent: Present if dma operations are coherent
- big-endian: Keystone devices can be operated in a mode where the DSP is in
the big endian mode. In such cases enable this option. This
option should also be enabled if the ARM is operated in
big endian mode with the DSP in little endian.

NetCP device properties: Device specification for NetCP sub-modules.
1Gb/10Gb (gbe/xgbe) ethernet switch sub-module specifications.
Required properties:
- label: Must be "netcp-gbe" for 1Gb & "netcp-xgbe" for 10Gb.
- reg: register location and the size for the following register
regions in the specified order.
- subsystem registers
- serdes registers
- tx-channel: the navigator packet dma channel name for tx.
- tx-queue: the navigator queue number associated with the tx dma channel.
- interfaces: specification for each of the switch port to be registered as a
network interface in the stack.
-- slave-port: Switch port number, 0 based numbering.
-- link-interface: type of link interface, supported options are
- mac<->mac auto negotiate mode: 0
- mac<->phy mode: 1
- mac<->mac forced mode: 2
- mac<->fiber mode: 3
- mac<->phy mode with no mdio: 4
- 10Gb mac<->phy mode : 10
- 10Gb mac<->mac forced mode : 11
----phy-handle: phandle to PHY device

Optional properties:
- enable-ale: NetCP driver keeps the address learning feature in the ethernet
switch module disabled. This attribute is to enable the address
learning.
- secondary-slave-ports: specification for each of the switch port not be
registered as a network interface. NetCP driver
will only initialize these ports and attach PHY
driver to them if needed.

NetCP interface properties: Interface specification for NetCP sub-modules.
Required properties:
- rx-channel: the navigator packet dma channel name for rx.
- rx-queue: the navigator queue number associated with rx dma channel.
- rx-pool: specifies the number of descriptors to be used & the region-id
for creating the rx descriptor pool.
- tx-pool: specifies the number of descriptors to be used & the region-id
for creating the tx descriptor pool.
- rx-queue-depth: number of descriptors in each of the free descriptor
queue (FDQ) for the pktdma Rx flow. There can be at
present a maximum of 4 queues per Rx flow.
- rx-buffer-size: the buffer size for each of the Rx flow FDQ.
- tx-completion-queue: the navigator queue number where the descriptors are
recycled after Tx DMA completion.

Optional properties:
- efuse-mac: If this is 1, then the MAC address for the interface is
obtained from the device efuse mac address register
- local-mac-address: the driver is designed to use the of_get_mac_address api
only if efuse-mac is 0. When efuse-mac is 0, the MAC
address is obtained from local-mac-address. If this
attribute is not present, then the driver will use a
random MAC address.
- "netcp-device label": phandle to the device specification for each of NetCP
sub-module attached to this interface.

Example binding:

netcp: netcp@2090000 {
reg = <0x2620110 0x8>;
reg-names = "efuse";
compatible = "ti,netcp-1.0";
#address-cells = <1>;
#size-cells = <1>;
ranges;

clocks = <&papllclk>, <&clkcpgmac>, <&chipclk12>;
dma-coherent;
/* big-endian; */
dma-id = <0>;

netcp-devices {
#address-cells = <1>;
#size-cells = <1>;
ranges;
gbe@0x2090000 {
label = "netcp-gbe";
reg = <0x2090000 0xf00>;
/* enable-ale; */
tx-queue = <648>;
tx-channel = <8>;

interfaces {
gbe0: interface-0 {
slave-port = <0>;
link-interface = <4>;
};
gbe1: interface-1 {
slave-port = <1>;
link-interface = <4>;
};
};

secondary-slave-ports {
port-2 {
slave-port = <2>;
link-interface = <2>;
};
port-3 {
slave-port = <3>;
link-interface = <2>;
};
};
};
};

netcp-interfaces {
interface-0 {
rx-channel = <22>;
rx-pool = <1024 12>;
tx-pool = <1024 12>;
rx-queue-depth = <128 128 0 0>;
rx-buffer-size = <1518 4096 0 0>;
rx-queue = <8704>;
tx-completion-queue = <8706>;
efuse-mac = <1>;
netcp-gbe = <&gbe0>;

};
interface-1 {
rx-channel = <23>;
rx-pool = <1024 12>;
tx-pool = <1024 12>;
rx-queue-depth = <128 128 0 0>;
rx-buffer-size = <1518 4096 0 0>;
rx-queue = <8705>;
tx-completion-queue = <8707>;
efuse-mac = <0>;
local-mac-address = [02 18 31 7e 3e 6f];
netcp-gbe = <&gbe1>;
};
};
};
7 changes: 7 additions & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -9609,6 +9609,13 @@ F: drivers/power/lp8788-charger.c
F: drivers/regulator/lp8788-*.c
F: include/linux/mfd/lp8788*.h

TI NETCP ETHERNET DRIVER
M: Wingman Kwok <w-kwok2@ti.com>
M: Murali Karicheri <m-karicheri2@ti.com>
L: netdev@vger.kernel.org
S: Maintained
F: drivers/net/ethernet/ti/netcp*

TI TWL4030 SERIES SOC CODEC DRIVER
M: Peter Ujfalusi <peter.ujfalusi@ti.com>
L: alsa-devel@alsa-project.org (moderated for non-subscribers)
Expand Down
11 changes: 11 additions & 0 deletions drivers/net/ethernet/ti/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,23 @@ config TI_CPSW
config TI_CPTS
boolean "TI Common Platform Time Sync (CPTS) Support"
depends on TI_CPSW
depends on TI_CPSW || TI_KEYSTONE_NET
select PTP_1588_CLOCK
---help---
This driver supports the Common Platform Time Sync unit of
the CPSW Ethernet Switch. The unit can time stamp PTP UDP/IPv4
and Layer 2 packets, and the driver offers a PTP Hardware Clock.

config TI_KEYSTONE_NETCP
tristate "TI Keystone NETCP Ethernet subsystem Support"
depends on OF
depends on KEYSTONE_NAVIGATOR_DMA && KEYSTONE_NAVIGATOR_QMSS
---help---
This driver supports TI's Keystone NETCP Ethernet subsystem.

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

config TLAN
tristate "TI ThunderLAN support"
depends on (PCI || EISA)
Expand Down
4 changes: 4 additions & 0 deletions drivers/net/ethernet/ti/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@ obj-$(CONFIG_TI_DAVINCI_CPDMA) += davinci_cpdma.o
obj-$(CONFIG_TI_CPSW_PHY_SEL) += cpsw-phy-sel.o
obj-$(CONFIG_TI_CPSW) += ti_cpsw.o
ti_cpsw-y := cpsw_ale.o cpsw.o cpts.o

obj-$(CONFIG_TI_KEYSTONE_NETCP) += keystone_netcp.o
keystone_netcp-y := netcp_core.o netcp_ethss.o netcp_sgmii.o \
netcp_xgbepcsr.o cpsw_ale.o cpts.o
Loading

0 comments on commit b66a4ea

Please sign in to comment.