Commit 69a3b16f authored by David S. Miller's avatar David S. Miller

Merge branch 'netcp-next'

Murali Karicheri says:

====================
NetCP: Add support for version 1.5

NetCP 1.5 is used in newer K2 SoCs from Texas Instruments
such as K2E, K2L etc. This patch series add support for Ethss
driver for this version of NetCP. While at it, fix couple of
bugs in the original driver.

One of the earlier patch "net: netcp: select davinci_mdio driver
by default" is folded onto this series.

Please review and let me know your comments.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 89c69d3c 9a391c7b
......@@ -49,6 +49,7 @@ 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.
- ranges: address range of NetCP (includes, Ethernet SS, PA and SA)
Optional properties:
- reg: register location and the size for the following register
......@@ -64,10 +65,30 @@ 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.
- compatible: Must be one of below:-
"ti,netcp-gbe" for 1GbE on NetCP 1.4
"ti,netcp-gbe-5" for 1GbE N NetCP 1.5 (N=5)
"ti,netcp-gbe-9" for 1GbE N NetCP 1.5 (N=9)
"ti,netcp-gbe-2" for 1GbE N NetCP 1.5 (N=2)
"ti,netcp-xgbe" for 10 GbE
- reg: register location and the size for the following register
regions in the specified order.
- subsystem registers
- serdes registers
- switch subsystem registers
- sgmii port3/4 module registers (only for NetCP 1.4)
- switch module registers
- serdes registers (only for 10G)
NetCP 1.4 ethss, here is the order
index #0 - switch subsystem registers
index #1 - sgmii port3/4 module registers
index #2 - switch module registers
NetCP 1.5 ethss 9 port, 5 port and 2 port
index #0 - switch subsystem registers
index #1 - switch module registers
index #2 - 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
......@@ -120,14 +141,13 @@ Optional properties:
Example binding:
netcp: netcp@2090000 {
netcp: netcp@2000000 {
reg = <0x2620110 0x8>;
reg-names = "efuse";
compatible = "ti,netcp-1.0";
#address-cells = <1>;
#size-cells = <1>;
ranges;
ranges = <0 0x2000000 0xfffff>;
clocks = <&papllclk>, <&clkcpgmac>, <&chipclk12>;
dma-coherent;
/* big-endian; */
......@@ -137,9 +157,9 @@ netcp: netcp@2090000 {
#address-cells = <1>;
#size-cells = <1>;
ranges;
gbe@0x2090000 {
gbe@90000 {
label = "netcp-gbe";
reg = <0x2090000 0xf00>;
reg = <0x90000 0x300>, <0x90400 0x400>, <0x90800 0x700>;
/* enable-ale; */
tx-queue = <648>;
tx-channel = <8>;
......
......@@ -88,6 +88,7 @@ config TI_CPTS
config TI_KEYSTONE_NETCP
tristate "TI Keystone NETCP Core Support"
select TI_CPSW_ALE
select TI_DAVINCI_MDIO
depends on OF
depends on KEYSTONE_NAVIGATOR_DMA && KEYSTONE_NAVIGATOR_QMSS
---help---
......
......@@ -41,7 +41,10 @@ struct netcp_tx_pipe {
struct netcp_device *netcp_device;
void *dma_queue;
unsigned int dma_queue_id;
u8 dma_psflags;
/* To port for packet forwarded to switch. Used only by ethss */
u8 switch_to_port;
#define SWITCH_TO_PORT_IN_TAGINFO BIT(0)
u8 flags;
void *dma_channel;
const char *dma_chan_name;
};
......
......@@ -1098,9 +1098,9 @@ static int netcp_tx_submit_skb(struct netcp_intf *netcp,
struct netcp_tx_pipe *tx_pipe = NULL;
struct netcp_hook_list *tx_hook;
struct netcp_packet p_info;
u32 packet_info = 0;
unsigned int dma_sz;
dma_addr_t dma;
u32 tmp = 0;
int ret = 0;
p_info.netcp = netcp;
......@@ -1140,20 +1140,27 @@ static int netcp_tx_submit_skb(struct netcp_intf *netcp,
memmove(p_info.psdata, p_info.psdata + p_info.psdata_len,
p_info.psdata_len);
set_words(psdata, p_info.psdata_len, psdata);
packet_info |=
(p_info.psdata_len & KNAV_DMA_DESC_PSLEN_MASK) <<
tmp |= (p_info.psdata_len & KNAV_DMA_DESC_PSLEN_MASK) <<
KNAV_DMA_DESC_PSLEN_SHIFT;
}
packet_info |= KNAV_DMA_DESC_HAS_EPIB |
tmp |= KNAV_DMA_DESC_HAS_EPIB |
((netcp->tx_compl_qid & KNAV_DMA_DESC_RETQ_MASK) <<
KNAV_DMA_DESC_RETQ_SHIFT) |
((tx_pipe->dma_psflags & KNAV_DMA_DESC_PSFLAG_MASK) <<
KNAV_DMA_DESC_RETQ_SHIFT);
if (!(tx_pipe->flags & SWITCH_TO_PORT_IN_TAGINFO)) {
tmp |= ((tx_pipe->switch_to_port & KNAV_DMA_DESC_PSFLAG_MASK) <<
KNAV_DMA_DESC_PSFLAG_SHIFT);
}
set_words(&packet_info, 1, &desc->packet_info);
set_words(&tmp, 1, &desc->packet_info);
set_words((u32 *)&skb, 1, &desc->pad[0]);
if (tx_pipe->flags & SWITCH_TO_PORT_IN_TAGINFO) {
tmp = tx_pipe->switch_to_port;
set_words((u32 *)&tmp, 1, &desc->tag_info);
}
/* submit packet descriptor */
ret = knav_pool_desc_map(netcp->tx_pool, desc, sizeof(*desc), &dma,
&dma_sz);
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment