Skip to content

Commit 69a3b16

Browse files
committed
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: David S. Miller <davem@davemloft.net>
2 parents 89c69d3 + 9a391c7 commit 69a3b16

File tree

5 files changed

+1303
-341
lines changed

5 files changed

+1303
-341
lines changed

Documentation/devicetree/bindings/net/keystone-netcp.txt

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ Required properties:
4949
- compatible: Should be "ti,netcp-1.0"
5050
- clocks: phandle to the reference clocks for the subsystem.
5151
- dma-id: Navigator packet dma instance id.
52+
- ranges: address range of NetCP (includes, Ethernet SS, PA and SA)
5253

5354
Optional properties:
5455
- reg: register location and the size for the following register
@@ -64,10 +65,30 @@ NetCP device properties: Device specification for NetCP sub-modules.
6465
1Gb/10Gb (gbe/xgbe) ethernet switch sub-module specifications.
6566
Required properties:
6667
- label: Must be "netcp-gbe" for 1Gb & "netcp-xgbe" for 10Gb.
68+
- compatible: Must be one of below:-
69+
"ti,netcp-gbe" for 1GbE on NetCP 1.4
70+
"ti,netcp-gbe-5" for 1GbE N NetCP 1.5 (N=5)
71+
"ti,netcp-gbe-9" for 1GbE N NetCP 1.5 (N=9)
72+
"ti,netcp-gbe-2" for 1GbE N NetCP 1.5 (N=2)
73+
"ti,netcp-xgbe" for 10 GbE
74+
6775
- reg: register location and the size for the following register
6876
regions in the specified order.
69-
- subsystem registers
70-
- serdes registers
77+
- switch subsystem registers
78+
- sgmii port3/4 module registers (only for NetCP 1.4)
79+
- switch module registers
80+
- serdes registers (only for 10G)
81+
82+
NetCP 1.4 ethss, here is the order
83+
index #0 - switch subsystem registers
84+
index #1 - sgmii port3/4 module registers
85+
index #2 - switch module registers
86+
87+
NetCP 1.5 ethss 9 port, 5 port and 2 port
88+
index #0 - switch subsystem registers
89+
index #1 - switch module registers
90+
index #2 - serdes registers
91+
7192
- tx-channel: the navigator packet dma channel name for tx.
7293
- tx-queue: the navigator queue number associated with the tx dma channel.
7394
- interfaces: specification for each of the switch port to be registered as a
@@ -120,14 +141,13 @@ Optional properties:
120141

121142
Example binding:
122143

123-
netcp: netcp@2090000 {
144+
netcp: netcp@2000000 {
124145
reg = <0x2620110 0x8>;
125146
reg-names = "efuse";
126147
compatible = "ti,netcp-1.0";
127148
#address-cells = <1>;
128149
#size-cells = <1>;
129-
ranges;
130-
150+
ranges = <0 0x2000000 0xfffff>;
131151
clocks = <&papllclk>, <&clkcpgmac>, <&chipclk12>;
132152
dma-coherent;
133153
/* big-endian; */
@@ -137,9 +157,9 @@ netcp: netcp@2090000 {
137157
#address-cells = <1>;
138158
#size-cells = <1>;
139159
ranges;
140-
gbe@0x2090000 {
160+
gbe@90000 {
141161
label = "netcp-gbe";
142-
reg = <0x2090000 0xf00>;
162+
reg = <0x90000 0x300>, <0x90400 0x400>, <0x90800 0x700>;
143163
/* enable-ale; */
144164
tx-queue = <648>;
145165
tx-channel = <8>;

drivers/net/ethernet/ti/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ config TI_CPTS
8888
config TI_KEYSTONE_NETCP
8989
tristate "TI Keystone NETCP Core Support"
9090
select TI_CPSW_ALE
91+
select TI_DAVINCI_MDIO
9192
depends on OF
9293
depends on KEYSTONE_NAVIGATOR_DMA && KEYSTONE_NAVIGATOR_QMSS
9394
---help---

drivers/net/ethernet/ti/netcp.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@ struct netcp_tx_pipe {
4141
struct netcp_device *netcp_device;
4242
void *dma_queue;
4343
unsigned int dma_queue_id;
44-
u8 dma_psflags;
44+
/* To port for packet forwarded to switch. Used only by ethss */
45+
u8 switch_to_port;
46+
#define SWITCH_TO_PORT_IN_TAGINFO BIT(0)
47+
u8 flags;
4548
void *dma_channel;
4649
const char *dma_chan_name;
4750
};

drivers/net/ethernet/ti/netcp_core.c

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1098,9 +1098,9 @@ static int netcp_tx_submit_skb(struct netcp_intf *netcp,
10981098
struct netcp_tx_pipe *tx_pipe = NULL;
10991099
struct netcp_hook_list *tx_hook;
11001100
struct netcp_packet p_info;
1101-
u32 packet_info = 0;
11021101
unsigned int dma_sz;
11031102
dma_addr_t dma;
1103+
u32 tmp = 0;
11041104
int ret = 0;
11051105

11061106
p_info.netcp = netcp;
@@ -1140,20 +1140,27 @@ static int netcp_tx_submit_skb(struct netcp_intf *netcp,
11401140
memmove(p_info.psdata, p_info.psdata + p_info.psdata_len,
11411141
p_info.psdata_len);
11421142
set_words(psdata, p_info.psdata_len, psdata);
1143-
packet_info |=
1144-
(p_info.psdata_len & KNAV_DMA_DESC_PSLEN_MASK) <<
1143+
tmp |= (p_info.psdata_len & KNAV_DMA_DESC_PSLEN_MASK) <<
11451144
KNAV_DMA_DESC_PSLEN_SHIFT;
11461145
}
11471146

1148-
packet_info |= KNAV_DMA_DESC_HAS_EPIB |
1147+
tmp |= KNAV_DMA_DESC_HAS_EPIB |
11491148
((netcp->tx_compl_qid & KNAV_DMA_DESC_RETQ_MASK) <<
1150-
KNAV_DMA_DESC_RETQ_SHIFT) |
1151-
((tx_pipe->dma_psflags & KNAV_DMA_DESC_PSFLAG_MASK) <<
1152-
KNAV_DMA_DESC_PSFLAG_SHIFT);
1149+
KNAV_DMA_DESC_RETQ_SHIFT);
11531150

1154-
set_words(&packet_info, 1, &desc->packet_info);
1151+
if (!(tx_pipe->flags & SWITCH_TO_PORT_IN_TAGINFO)) {
1152+
tmp |= ((tx_pipe->switch_to_port & KNAV_DMA_DESC_PSFLAG_MASK) <<
1153+
KNAV_DMA_DESC_PSFLAG_SHIFT);
1154+
}
1155+
1156+
set_words(&tmp, 1, &desc->packet_info);
11551157
set_words((u32 *)&skb, 1, &desc->pad[0]);
11561158

1159+
if (tx_pipe->flags & SWITCH_TO_PORT_IN_TAGINFO) {
1160+
tmp = tx_pipe->switch_to_port;
1161+
set_words((u32 *)&tmp, 1, &desc->tag_info);
1162+
}
1163+
11571164
/* submit packet descriptor */
11581165
ret = knav_pool_desc_map(netcp->tx_pool, desc, sizeof(*desc), &dma,
11591166
&dma_sz);

0 commit comments

Comments
 (0)