Skip to content

Commit e446fb9

Browse files
NET:ETH:ALTERA: backward compatibility changes
1 parent 3c4077d commit e446fb9

File tree

9 files changed

+188
-67
lines changed

9 files changed

+188
-67
lines changed

drivers/net/ethernet/altera/Kconfig

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,16 @@ config INTEL_FPGA_HSSI_XTILE
6464
To compile this driver as a module, choose M here. The module
6565
will be called intel_fpga_hssi_xtile.
6666

67+
config INTEL_FPGA_GTS_TILE
68+
tristate "Intel FPGA HSSI based 10/25G GTS driver support"
69+
select PTP_1588_CLOCK
70+
select PHYLINK
71+
help
72+
This driver supports the Intel FPGA GTS Ethernet MAC.
73+
74+
To compile this driver as a module, choose M here. The module
75+
will be called intel_fpga_hssi_xtile.
76+
6777
config INTEL_FPGA_TOD
6878
tristate "Intel FPGA ToD driver support"
6979
help
@@ -72,6 +82,12 @@ config INTEL_FPGA_TOD
7282
To compile this driver as a module, choose M here. The module
7383
will be called intel_fpga_tod.
7484

85+
config INTEL_FPGA_FREQ_CTRL
86+
depends on INTEL_FPGA_TOD
87+
tristate "Intel FPGA frequency control device specific driver calls"
88+
help
89+
This driver supports the Intel FPGA frequency steering
90+
7591
endif
7692

7793
config INTEL_FPGA_HSSISS

drivers/net/ethernet/altera/Makefile

Lines changed: 57 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,45 @@
22
#
33
# Makefile for the Altera device drivers.
44
#
5+
ifeq ($(CONFIG_NET_ALTERA_ETH),y)
6+
obj-$(CONFIG_NET_ALTERA_ETH) += altera_eth.o
7+
altera_eth-objs := altera_eth_dma.o \
8+
altera_sgdma.o altera_msgdma.o \
9+
altera_msgdma_prefetcher.o
10+
endif
11+
12+
ifeq ($(CONFIG_INTEL_FPGA_UTIL),y)
13+
obj-$(CONFIG_INTEL_FPGA_UTIL) += altera_utils.o
14+
endif
515

6-
obj-$(CONFIG_NET_ALTERA_ETH) += altera_eth.o
7-
altera_eth-objs := altera_utils.o altera_eth_dma.o \
8-
altera_sgdma.o altera_msgdma.o \
9-
altera_msgdma_prefetcher.o
16+
ifeq ($(CONFIG_SSGDMA_SOC_DMA),y)
17+
obj-$(CONFIG_SSGDMA_SOC_DMA) += ssgdma_soc_dma.o
18+
ssgdma_soc_dma-objs := intel_ssgdma_soc_main.o \
19+
intel_ssgdma_common.o \
20+
intel_ssgdma_hal.o \
21+
intel_ssgdma_dmac.o
22+
ssgdma_soc_dma-objs := $(addprefix ssgdma/, $(ssgdma_soc_dma-objs))
23+
endif
24+
25+
ifeq ($(CONFIG_INTEL_FPGA_FREQ_CTRL), y)
26+
obj-$(CONFIG_INTEL_FPGA_FREQ_CTRL) += intel_frequency_ctrl_driver.o
27+
28+
ifeq ($(CONFIG_DEBUG_FS),y)
29+
intel_frequency_ctrl_driver-objs := intel_freq_ctrl_zl30733_debugfs.o
30+
endif
31+
intel_frequency_ctrl_driver-objs += intel_freq_ctrl_zl30793_spi.o \
32+
intel_freq_ctrl_zl30793.o \
33+
intel_freq_ctrl_zl30733_i2c.o \
34+
intel_freq_ctrl_common_spi.o \
35+
intel_freq_ctrl_common_i2c.o \
1036

11-
ifeq ($(CONFIG_DEBUG_FS),y)
12-
obj-$(CONFIG_INTEL_FPGA_TOD) += intel_freq_control_zl30733_debugfs.o
37+
intel_frequency_ctrl_driver-objs := $(addprefix dpll/, $(intel_frequency_ctrl_driver-objs))
1338
endif
1439

15-
obj-$(CONFIG_INTEL_FPGA_TOD) += altera_utils.o \
16-
intel_freq_ctrl_zl30793_spi.o \
17-
intel_freq_control_zl30793.o \
18-
intel_freq_ctrl_zl30733_i2c.o \
19-
intel_freq_control.o \
20-
intel_freq_ctrl_common_spi.o \
21-
intel_freq_ctrl_common_i2c.o \
22-
intel_fpga_tod.o
40+
ifeq ($(CONFIG_INTEL_FPGA_TOD), y)
41+
obj-$(CONFIG_INTEL_FPGA_TOD) += intel_freq_control.o \
42+
intel_fpga_tod.o
43+
endif
2344

2445
ifeq ($(CONFIG_ALTERA_TSE),y)
2546
obj-$(CONFIG_ALTERA_TSE) += altera_tse.o
@@ -39,13 +60,17 @@ endif
3960
ifeq ($(CONFIG_INTEL_FPGA_HSSISS),y)
4061
obj-$(CONFIG_INTEL_FPGA_HSSISS) += intel_fpga_hssi.o
4162
ifeq ($(CONFIG_DEBUG_FS),y)
42-
intel_fpga_hssi-objs := intel_fpga_hssiss.o \
63+
intel_fpga_hssi-objs := intel_fpga_hssigl_gts_driver.o \
64+
intel_fpga_hssiss.o \
4365
intel_fpga_hssi_driver.o \
4466
intel_fpga_hssiss_debug.o \
67+
intel_fpga_hssigl_driver.o \
4568
intel_fpga_eth_hssi_itf.o
4669
else
47-
intel_fpga_hssi-objs := intel_fpga_hssiss.o \
70+
intel_fpga_hssi-objs := intel_fpga_hssigl_gts_driver.o \
71+
intel_fpga_hssiss.o \
4872
intel_fpga_hssi_driver.o \
73+
intel_fpga_hssigl_driver.o \
4974
intel_fpga_eth_hssi_itf.o
5075
endif
5176
endif
@@ -64,3 +89,19 @@ ifeq ($(CONFIG_INTEL_FPGA_HSSI_XTILE),y)
6489
intel_fpga_hssi_ftile_ethtool.o \
6590

6691
endif
92+
93+
ifeq ($(CONFIG_INTEL_FPGA_GTS_TILE), y)
94+
obj-$(CONFIG_INTEL_FPGA_GTS_TILE) += intel_fpga_gts_tile.o
95+
ifeq ($(CONFIG_DEBUG_FS),y)
96+
intel_fpga_gts_tile-objs := intel_fpga_eth_debug.o
97+
endif
98+
intel_fpga_gts_tile-objs += intel_fpga_eth_main.o \
99+
intel_fpga_gts_ethtool.o \
100+
intel_fpga_gts_driver.o \
101+
intel_fpga_etile_driver.o \
102+
intel_fpga_hssi_etile_fec.o \
103+
intel_fpga_hssi_etile_ethtool.o \
104+
intel_fpga_ftile_driver.o \
105+
intel_fpga_hssi_ftile_fec.o \
106+
intel_fpga_hssi_ftile_ethtool.o
107+
endif

drivers/net/ethernet/altera/altera_tse_main.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1498,18 +1498,11 @@ static int altera_tse_probe(struct platform_device *pdev)
14981498

14991499
if (priv->ptp_enable) {
15001500
/* MAP PTP */
1501-
ret = intel_fpga_tod_probe(pdev, &priv->ptp_priv);
1501+
ret = intel_fpga_tod_probe(pdev);
15021502
if (ret) {
15031503
dev_err(&pdev->dev, "cannot map PTP\n");
15041504
goto err_init_phy;
15051505
}
1506-
ret = intel_fpga_tod_register(&priv->ptp_priv,
1507-
priv->device);
1508-
if (ret) {
1509-
dev_err(&pdev->dev, "Failed to register PTP clock\n");
1510-
ret = -ENXIO;
1511-
goto err_init_phy;
1512-
}
15131506
}
15141507

15151508
return 0;

drivers/net/ethernet/altera/intel_fpga_eth_main.c

Lines changed: 58 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include "intel_fpga_eth_main.h"
2929
#include "intel_fpga_ftile_driver.h"
3030
#include "intel_fpga_etile_driver.h"
31+
#include "intel_fpga_gts_driver.h"
3132
#include "intel_fpga_eth_hssi_itf.h"
3233
#include "intel_fpga_eth_tile_ops.h"
3334
#include <linux/sched.h>
@@ -325,9 +326,11 @@ static int xtile_init_rx_buffer(struct intel_fpga_xtile_eth_private *priv,
325326
struct altera_dma_buffer *rxbuffer,
326327
int len)
327328
{
328-
rxbuffer->skb = netdev_alloc_skb_ip_align(priv->dev, len);
329-
if (!rxbuffer->skb)
330-
return -ENOMEM;
329+
rxbuffer->skb = netdev_alloc_skb(priv->dev, len);
330+
skb_reserve(rxbuffer->skb, SKB_DMA_REALIGN);
331+
332+
if (!rxbuffer->skb)
333+
return -ENOMEM;
331334

332335
rxbuffer->dma_addr = dma_map_single(priv->device,
333336
rxbuffer->skb->data,
@@ -342,8 +345,6 @@ static int xtile_init_rx_buffer(struct intel_fpga_xtile_eth_private *priv,
342345
return -EINVAL;
343346
}
344347

345-
/* align the address on 4 byte boundary */
346-
rxbuffer->dma_addr &= (dma_addr_t)~3;
347348
rxbuffer->len = len;
348349

349350
return 0;
@@ -360,7 +361,8 @@ static void xtile_free_rx_buffer(struct intel_fpga_xtile_eth_private *priv,
360361
dma_unmap_single(priv->device, dma_addr,
361362
rxbuffer->len,
362363
DMA_FROM_DEVICE);
363-
dev_kfree_skb_any(skb);
364+
365+
dev_consume_skb_any(skb);
364366
rxbuffer->skb = NULL;
365367
rxbuffer->dma_addr = 0;
366368
}
@@ -381,7 +383,7 @@ static void xtile_free_tx_buffer(struct intel_fpga_xtile_eth_private *priv,
381383
buffer->dma_addr = 0;
382384
}
383385
if (buffer->skb) {
384-
dev_kfree_skb_any(buffer->skb);
386+
dev_consume_skb_any(buffer->skb);
385387
buffer->skb = NULL;
386388
}
387389
}
@@ -1101,6 +1103,9 @@ static int xtile_open(struct net_device *dev)
11011103

11021104
/* clear the MAC layer statistics to start afresh */
11031105
xtile_clear_mac_statistics(pdev, hssi_port);
1106+
1107+
/* we need to clear the dev stats so that the ifconfig on interface shouldn't show old data */
1108+
memset(&dev->stats, 0, sizeof(dev->stats));
11041109

11051110
for (queue = 0; queue < priv->num_channels; queue++) {
11061111
priv->spec_ops->dma_ops->quiese_pref(&priv->dma_info[queue].dma_priv);
@@ -1322,6 +1327,8 @@ static int xtile_start_xmit(struct sk_buff *skb, struct net_device *dev)
13221327
16, 1, skb->data, skb->len, true);
13231328
}
13241329

1330+
skb_reserve(skb, SKB_DMA_REALIGN);
1331+
13251332
/* Map the first skb fragment */
13261333
entry = priv->dma_info[queue].dma_priv.tx_prod % txsize;
13271334
buffer = &priv->dma_info[queue].dma_priv.tx_ring[entry];
@@ -1740,8 +1747,6 @@ static int intel_fpga_xtile_probe(struct platform_device *pdev)
17401747
int ret = -ENODEV;
17411748
struct device_node *np, *dmanp;
17421749
struct net_device *ndev;
1743-
//struct resource *rx_fifo;
1744-
//struct resource *tx_fifo;
17451750
struct device_node *dev_hssi;
17461751
u8 macaddr[ETH_ALEN];
17471752
struct fwnode_handle *fixed_node;
@@ -1752,7 +1757,9 @@ static int intel_fpga_xtile_probe(struct platform_device *pdev)
17521757
struct platform_device *pdev_tod;
17531758
char dma_nodename[6];
17541759
int queue = 0;
1760+
const char *if_name = NULL;
17551761
char irq_name[12];
1762+
struct set_mtu_data mtu;
17561763

17571764
np = pdev->dev.of_node;
17581765

@@ -1983,7 +1990,11 @@ static int intel_fpga_xtile_probe(struct platform_device *pdev)
19831990
&priv->dev->max_mtu)) {
19841991
dev_warn(&pdev->dev, "Not able to get max-frame-size. Defaulting max_mtu to %d\n",
19851992
priv->dev->max_mtu);
1986-
}
1993+
} else {
1994+
mtu.port = priv->hssi_port;
1995+
mtu.max_tx_frame_size = mtu.max_rx_frame_size = priv->dev->max_mtu;
1996+
hssiss_set_mtu(priv->pdev_hssi, SAL_SET_MTU, &mtu);
1997+
}
19871998

19881999
/* The DMA buffer size already accounts for an alignment bias
19892000
* to avoid unaligned access exceptions for the NIOS processor,
@@ -2104,20 +2115,31 @@ static int intel_fpga_xtile_probe(struct platform_device *pdev)
21042115

21052116
priv->autoneg = true;
21062117

2107-
/* read the fixed link properties*/
2108-
fixed_node = fwnode_get_named_child_node(pdev->dev.fwnode, "fixed-link");
2109-
if (fixed_node) {
2110-
fwnode_property_read_u32(fixed_node, "speed", &priv->link_speed);
2118+
fixed_node = fwnode_get_named_child_node(pdev->dev.fwnode, "fixed-link");
2119+
if (fixed_node) {
2120+
fwnode_property_read_u32(fixed_node, "speed", &priv->link_speed);
2121+
/* read the fixed link properties*/
21112122
priv->duplex = DUPLEX_FULL;
21122123
priv->autoneg = false;
21132124

21142125
dev_info(&pdev->dev, "\tfixed link speed:%d full duplex:%d\n",
21152126
priv->link_speed, priv->duplex);
2127+
2128+
fwnode_handle_put(fixed_node);
21162129
} else {
21172130
dev_err(&pdev->dev, "fixed link property undefined\n");
2131+
ret = -ENODEV;
21182132
goto err_free_netdev;
21192133
}
21202134

2135+
ret = of_property_read_string(pdev->dev.of_node, "if_name",
2136+
&if_name);
2137+
2138+
if (if_name) {
2139+
memset(&ndev->name, 0, 16);
2140+
memcpy(ndev->name, if_name, strlen(if_name));
2141+
}
2142+
21212143
ret = register_netdev(ndev);
21222144
if (ret) {
21232145
dev_err(&pdev->dev, "failed to register ethernet device\n");
@@ -2163,7 +2185,7 @@ static void intel_fpga_xtile_remove(struct platform_device *pdev)
21632185

21642186
/* perform the proper cleaning up */
21652187
xtile_shutdown(ndev);
2166-
2188+
kfree(priv->dma_info);
21672189
platform_set_drvdata(pdev, NULL);
21682190
unregister_netdev(ndev);
21692191
free_netdev(ndev);
@@ -2230,14 +2252,34 @@ static const struct xtile_spec_ops ftile_data = {
22302252
},
22312253
};
22322254

2255+
static const struct xtile_spec_ops gts_data = {
2256+
.dma_ops = &altera_dtype_prefetcher,
2257+
.tile = {
2258+
.reset = gts_ehip_reset,
2259+
.deassert_reset = gts_ehip_deassert_reset,
2260+
.init = gts_init,
2261+
.uninit = gts_uninit,
2262+
.start = gts_start,
2263+
.stop = gts_stop,
2264+
.run_check = gts_run_check,
2265+
.update_mac_addr = gts_update_mac_addr,
2266+
.link_fault_status = gts_get_link_fault_status,
2267+
.reg_ethtool_ops =
2268+
intel_fpga_gts_set_ethtool_ops,
2269+
.check_dts_param = gts_check_dts_param,
2270+
},
2271+
};
2272+
22332273
static const struct of_device_id intel_fpga_xtile_ll_ids[] = {
22342274
{.compatible = "altr,hssi-etile-1.0",
22352275
.data = &etile_data,
22362276
},
22372277
{.compatible = "altr,hssi-ftile-1.0",
22382278
.data = &ftile_data,
22392279
},
2240-
2280+
{.compatible = "altr,msgdma-gts-1.0",
2281+
.data = &gts_data,
2282+
},
22412283
};
22422284

22432285
MODULE_DEVICE_TABLE(of, intel_fpga_xtile_ll_ids);

drivers/net/ethernet/altera/intel_fpga_eth_main.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@
5252
/* Link Stability check */
5353
#define PRELOAD_LINK_STABILITY_COUNT 10
5454

55+
#define SKB_DMA_REALIGN ((PAGE_SIZE - NET_SKB_PAD) % SMP_CACHE_BYTES)
56+
5557
enum {
5658
ETH_LINK_STATE_RESET = 0,
5759
ETH_LINK_STATE_START,

0 commit comments

Comments
 (0)