Skip to content

Commit bfab27a

Browse files
cavagiudavem330
authored andcommitted
stmmac: add the experimental PCI support
This patch adds the PCI support (as EXPERIMENTAL) this has been also tested on XLINX XC2V3000 FF1152AMT0221 D1215994A VIRTEX FPGA board. To support the PCI bus the main part has been reworked and both the platform and the PCI specific parts have been moved into different files. Signed-off-by: Rayagond Kokatanur <[email protected]> Signed-off-by: Giuseppe Cavallaro <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 225d9b8 commit bfab27a

File tree

9 files changed

+612
-290
lines changed

9 files changed

+612
-290
lines changed

drivers/net/ethernet/stmicro/stmmac/Kconfig

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,36 @@ config STMMAC_ETH
1212

1313
if STMMAC_ETH
1414

15+
config STMMAC_PLATFORM
16+
tristate "STMMAC platform bus support"
17+
depends on STMMAC_ETH
18+
default y
19+
---help---
20+
This selects the platform specific bus support for
21+
the stmmac device driver. This is the driver used
22+
on many embedded STM platforms based on ARM and SuperH
23+
processors.
24+
If you have a controller with this interface, say Y or M here.
25+
26+
If unsure, say N.
27+
28+
config STMMAC_PCI
29+
tristate "STMMAC support on PCI bus (EXPERIMENTAL)"
30+
depends on STMMAC_ETH && PCI && EXPERIMENTAL
31+
---help---
32+
This is to select the Synopsys DWMAC available on PCI devices,
33+
if you have a controller with this interface, say Y or M here.
34+
35+
This PCI support is tested on XLINX XC2V3000 FF1152AMT0221
36+
D1215994A VIRTEX FPGA board.
37+
38+
If unsure, say N.
39+
1540
config STMMAC_DEBUG_FS
1641
bool "Enable monitoring via sysFS "
1742
default n
1843
depends on STMMAC_ETH && DEBUG_FS
19-
-- help
44+
---help---
2045
The stmmac entry in /sys reports DMA TX/RX rings
2146
or (if supported) the HW cap register.
2247

drivers/net/ethernet/stmicro/stmmac/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ obj-$(CONFIG_STMMAC_ETH) += stmmac.o
22
stmmac-$(CONFIG_STMMAC_TIMER) += stmmac_timer.o
33
stmmac-$(CONFIG_STMMAC_RING) += ring_mode.o
44
stmmac-$(CONFIG_STMMAC_CHAINED) += chain_mode.o
5+
stmmac-$(CONFIG_STMMAC_PLATFORM) += stmmac_platform.o
6+
stmmac-$(CONFIG_STMMAC_PCI) += stmmac_pci.o
57
stmmac-objs:= stmmac_main.o stmmac_ethtool.o stmmac_mdio.o \
68
dwmac_lib.o dwmac1000_core.o dwmac1000_dma.o \
79
dwmac100_core.o dwmac100_dma.o enh_desc.o norm_desc.o \

drivers/net/ethernet/stmicro/stmmac/common.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@
2222
Author: Giuseppe Cavallaro <[email protected]>
2323
*******************************************************************************/
2424

25+
#include <linux/etherdevice.h>
2526
#include <linux/netdevice.h>
27+
#include <linux/phy.h>
28+
#include <linux/module.h>
29+
#include <linux/init.h>
2630
#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
2731
#define STMMAC_VLAN_TAG_USED
2832
#include <linux/if_vlan.h>
@@ -315,5 +319,8 @@ extern void stmmac_set_mac_addr(void __iomem *ioaddr, u8 addr[6],
315319
unsigned int high, unsigned int low);
316320
extern void stmmac_get_mac_addr(void __iomem *ioaddr, unsigned char *addr,
317321
unsigned int high, unsigned int low);
322+
323+
extern void stmmac_set_mac(void __iomem *ioaddr, bool enable);
324+
318325
extern void dwmac_dma_flush_tx_fifo(void __iomem *ioaddr);
319326
extern const struct stmmac_ring_mode_ops ring_mode_ops;

drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,19 @@ void stmmac_set_mac_addr(void __iomem *ioaddr, u8 addr[6],
238238
writel(data, ioaddr + low);
239239
}
240240

241+
/* Enable disable MAC RX/TX */
242+
void stmmac_set_mac(void __iomem *ioaddr, bool enable)
243+
{
244+
u32 value = readl(ioaddr + MAC_CTRL_REG);
245+
246+
if (enable)
247+
value |= MAC_RNABLE_RX | MAC_ENABLE_TX;
248+
else
249+
value &= ~(MAC_ENABLE_TX | MAC_RNABLE_RX);
250+
251+
writel(value, ioaddr + MAC_CTRL_REG);
252+
}
253+
241254
void stmmac_get_mac_addr(void __iomem *ioaddr, unsigned char *addr,
242255
unsigned int high, unsigned int low)
243256
{

drivers/net/ethernet/stmicro/stmmac/stmmac.h

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
Author: Giuseppe Cavallaro <[email protected]>
2121
*******************************************************************************/
2222

23-
#define DRV_MODULE_VERSION "Oct_2011"
23+
#define STMMAC_RESOURCE_NAME "stmmaceth"
24+
#define DRV_MODULE_VERSION "Dec_2011"
2425
#include <linux/stmmac.h>
2526
#include <linux/phy.h>
2627
#include "common.h"
@@ -82,8 +83,18 @@ struct stmmac_priv {
8283
int hw_cap_support;
8384
};
8485

86+
extern int phyaddr;
87+
8588
extern int stmmac_mdio_unregister(struct net_device *ndev);
8689
extern int stmmac_mdio_register(struct net_device *ndev);
8790
extern void stmmac_set_ethtool_ops(struct net_device *netdev);
8891
extern const struct stmmac_desc_ops enh_desc_ops;
8992
extern const struct stmmac_desc_ops ndesc_ops;
93+
94+
int stmmac_freeze(struct net_device *ndev);
95+
int stmmac_restore(struct net_device *ndev);
96+
int stmmac_resume(struct net_device *ndev);
97+
int stmmac_suspend(struct net_device *ndev);
98+
int stmmac_dvr_remove(struct net_device *ndev);
99+
struct stmmac_priv *stmmac_dvr_probe(struct device *device,
100+
struct plat_stmmacenet_data *plat_dat);

0 commit comments

Comments
 (0)