Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bfab27a1 authored by Giuseppe CAVALLARO's avatar Giuseppe CAVALLARO Committed by David S. Miller
Browse files

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: default avatarRayagond Kokatanur <rayagond@vayavyalabs.com>
Signed-off-by: default avatarGiuseppe Cavallaro <peppe.cavallaro@st.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 225d9b89
Loading
Loading
Loading
Loading
+26 −1
Original line number Diff line number Diff line
@@ -12,11 +12,36 @@ config STMMAC_ETH

if STMMAC_ETH

config STMMAC_PLATFORM
	tristate "STMMAC platform bus support"
	depends on STMMAC_ETH
	default y
	---help---
	  This selects the platform specific bus support for
	  the stmmac device driver. This is the driver used
	  on many embedded STM platforms based on ARM and SuperH
	  processors.
	  If you have a controller with this interface, say Y or M here.

	  If unsure, say N.

config STMMAC_PCI
	tristate "STMMAC support on PCI bus (EXPERIMENTAL)"
	depends on STMMAC_ETH && PCI && EXPERIMENTAL
	---help---
	  This is to select the Synopsys DWMAC available on PCI devices,
	  if you have a controller with this interface, say Y or M here.

	  This PCI support is tested on XLINX XC2V3000 FF1152AMT0221
	  D1215994A VIRTEX FPGA board.

	  If unsure, say N.

config STMMAC_DEBUG_FS
	bool "Enable monitoring via sysFS "
	default n
	depends on STMMAC_ETH && DEBUG_FS
	-- help
	---help---
	  The stmmac entry in /sys reports DMA TX/RX rings
	  or (if supported) the HW cap register.

+2 −0
Original line number Diff line number Diff line
@@ -2,6 +2,8 @@ obj-$(CONFIG_STMMAC_ETH) += stmmac.o
stmmac-$(CONFIG_STMMAC_TIMER) += stmmac_timer.o
stmmac-$(CONFIG_STMMAC_RING) += ring_mode.o
stmmac-$(CONFIG_STMMAC_CHAINED) += chain_mode.o
stmmac-$(CONFIG_STMMAC_PLATFORM) += stmmac_platform.o
stmmac-$(CONFIG_STMMAC_PCI) += stmmac_pci.o
stmmac-objs:= stmmac_main.o stmmac_ethtool.o stmmac_mdio.o	\
	      dwmac_lib.o dwmac1000_core.o  dwmac1000_dma.o	\
	      dwmac100_core.o dwmac100_dma.o enh_desc.o  norm_desc.o \
+7 −0
Original line number Diff line number Diff line
@@ -22,7 +22,11 @@
  Author: Giuseppe Cavallaro <peppe.cavallaro@st.com>
*******************************************************************************/

#include <linux/etherdevice.h>
#include <linux/netdevice.h>
#include <linux/phy.h>
#include <linux/module.h>
#include <linux/init.h>
#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
#define STMMAC_VLAN_TAG_USED
#include <linux/if_vlan.h>
@@ -315,5 +319,8 @@ extern void stmmac_set_mac_addr(void __iomem *ioaddr, u8 addr[6],
				unsigned int high, unsigned int low);
extern void stmmac_get_mac_addr(void __iomem *ioaddr, unsigned char *addr,
				unsigned int high, unsigned int low);

extern void stmmac_set_mac(void __iomem *ioaddr, bool enable);

extern void dwmac_dma_flush_tx_fifo(void __iomem *ioaddr);
extern const struct stmmac_ring_mode_ops ring_mode_ops;
+13 −0
Original line number Diff line number Diff line
@@ -238,6 +238,19 @@ void stmmac_set_mac_addr(void __iomem *ioaddr, u8 addr[6],
	writel(data, ioaddr + low);
}

/* Enable disable MAC RX/TX */
void stmmac_set_mac(void __iomem *ioaddr, bool enable)
{
	u32 value = readl(ioaddr + MAC_CTRL_REG);

	if (enable)
		value |= MAC_RNABLE_RX | MAC_ENABLE_TX;
	else
		value &= ~(MAC_ENABLE_TX | MAC_RNABLE_RX);

	writel(value, ioaddr + MAC_CTRL_REG);
}

void stmmac_get_mac_addr(void __iomem *ioaddr, unsigned char *addr,
			 unsigned int high, unsigned int low)
{
+12 −1
Original line number Diff line number Diff line
@@ -20,7 +20,8 @@
  Author: Giuseppe Cavallaro <peppe.cavallaro@st.com>
*******************************************************************************/

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

extern int phyaddr;

extern int stmmac_mdio_unregister(struct net_device *ndev);
extern int stmmac_mdio_register(struct net_device *ndev);
extern void stmmac_set_ethtool_ops(struct net_device *netdev);
extern const struct stmmac_desc_ops enh_desc_ops;
extern const struct stmmac_desc_ops ndesc_ops;

int stmmac_freeze(struct net_device *ndev);
int stmmac_restore(struct net_device *ndev);
int stmmac_resume(struct net_device *ndev);
int stmmac_suspend(struct net_device *ndev);
int stmmac_dvr_remove(struct net_device *ndev);
struct stmmac_priv *stmmac_dvr_probe(struct device *device,
				struct plat_stmmacenet_data *plat_dat);
Loading