Skip to content

Commit

Permalink
gianfar: Remove sysfs stubs for FIFOCFG and stashing
Browse files Browse the repository at this point in the history
Removing the sysfs stubs for the Tx FIFOCFG and ATTRELI
(stashing) config registers, as these registers may only
be configured after a MAC reset, with the controller stopped
(i.e. during hw init, at probe() time).  The current sysfs
stubs allow on-the-fly updates of these registers (the locking
measures are useless and only add unecessary code).

Changing these registers is discouraged. Only the default values
will be used instead.

Moreover, the stashing (ATTRELI) configuration options were
effectively disabled (didn't get to the hw anyway if changed)
because the stashing device_flags (HAS_BD_STASHING|HAS_BUF_STASHING)
were "accidentally" cleared during probe().

Signed-off-by: Claudiu Manoil <claudiu.manoil@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
claudiu-m authored and davem330 committed Feb 18, 2014
1 parent 2086278 commit 34018fd
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 408 deletions.
30 changes: 0 additions & 30 deletions Documentation/networking/gianfar.txt
@@ -1,38 +1,8 @@
The Gianfar Ethernet Driver
Sysfs File description

Author: Andy Fleming <afleming@freescale.com>
Updated: 2005-07-28

SYSFS

Several of the features of the gianfar driver are controlled
through sysfs files. These are:

bd_stash:
To stash RX Buffer Descriptors in the L2, echo 'on' or '1' to
bd_stash, echo 'off' or '0' to disable

rx_stash_len:
To stash the first n bytes of the packet in L2, echo the number
of bytes to buf_stash_len. echo 0 to disable.

WARNING: You could really screw these up if you set them too low or high!
fifo_threshold:
To change the number of bytes the controller needs in the
fifo before it starts transmission, echo the number of bytes to
fifo_thresh. Range should be 0-511.

fifo_starve:
When the FIFO has less than this many bytes during a transmit, it
enters starve mode, and increases the priority of TX memory
transactions. To change, echo the number of bytes to
fifo_starve. Range should be 0-511.

fifo_starve_off:
Once in starve mode, the FIFO remains there until it has this
many bytes. To change, echo the number of bytes to
fifo_starve_off. Range should be 0-511.

CHECKSUM OFFLOADING

Expand Down
3 changes: 1 addition & 2 deletions drivers/net/ethernet/freescale/Makefile
Expand Up @@ -14,7 +14,6 @@ obj-$(CONFIG_FSL_XGMAC_MDIO) += xgmac_mdio.o
obj-$(CONFIG_GIANFAR) += gianfar_driver.o
obj-$(CONFIG_PTP_1588_CLOCK_GIANFAR) += gianfar_ptp.o
gianfar_driver-objs := gianfar.o \
gianfar_ethtool.o \
gianfar_sysfs.o
gianfar_ethtool.o
obj-$(CONFIG_UCC_GETH) += ucc_geth_driver.o
ucc_geth_driver-objs := ucc_geth.o ucc_geth_ethtool.o
57 changes: 27 additions & 30 deletions drivers/net/ethernet/freescale/gianfar.c
Expand Up @@ -338,7 +338,6 @@ static void gfar_init_mac(struct net_device *ndev)
struct gfar __iomem *regs = priv->gfargrp[0].regs;
u32 rctrl = 0;
u32 tctrl = 0;
u32 attrs = 0;

/* write the tx/rx base registers */
gfar_init_tx_rx_base(priv);
Expand Down Expand Up @@ -409,29 +408,6 @@ static void gfar_init_mac(struct net_device *ndev)
}

gfar_write(&regs->tctrl, tctrl);

/* Set the extraction length and index */
attrs = ATTRELI_EL(priv->rx_stash_size) |
ATTRELI_EI(priv->rx_stash_index);

gfar_write(&regs->attreli, attrs);

/* Start with defaults, and add stashing or locking
* depending on the approprate variables
*/
attrs = ATTR_INIT_SETTINGS;

if (priv->bd_stash_en)
attrs |= ATTR_BDSTASH;

if (priv->rx_stash_size != 0)
attrs |= ATTR_BUFSTASH;

gfar_write(&regs->attr, attrs);

gfar_write(&regs->fifo_tx_thr, priv->fifo_threshold);
gfar_write(&regs->fifo_tx_starve, priv->fifo_starve);
gfar_write(&regs->fifo_tx_starve_shutoff, priv->fifo_starve_off);
}

static struct net_device_stats *gfar_get_stats(struct net_device *dev)
Expand Down Expand Up @@ -784,13 +760,13 @@ static int gfar_of_init(struct platform_device *ofdev, struct net_device **pdev)
memcpy(dev->dev_addr, mac_addr, ETH_ALEN);

if (model && !strcasecmp(model, "TSEC"))
priv->device_flags = FSL_GIANFAR_DEV_HAS_GIGABIT |
priv->device_flags |= FSL_GIANFAR_DEV_HAS_GIGABIT |
FSL_GIANFAR_DEV_HAS_COALESCE |
FSL_GIANFAR_DEV_HAS_RMON |
FSL_GIANFAR_DEV_HAS_MULTI_INTR;

if (model && !strcasecmp(model, "eTSEC"))
priv->device_flags = FSL_GIANFAR_DEV_HAS_GIGABIT |
priv->device_flags |= FSL_GIANFAR_DEV_HAS_GIGABIT |
FSL_GIANFAR_DEV_HAS_COALESCE |
FSL_GIANFAR_DEV_HAS_RMON |
FSL_GIANFAR_DEV_HAS_MULTI_INTR |
Expand Down Expand Up @@ -1030,7 +1006,7 @@ static void gfar_detect_errata(struct gfar_private *priv)
static void gfar_hw_init(struct gfar_private *priv)
{
struct gfar __iomem *regs = priv->gfargrp[0].regs;
u32 tempval;
u32 tempval, attrs;

/* Reset MAC layer */
gfar_write(&regs->maccfg1, MACCFG1_SOFT_RESET);
Expand All @@ -1052,6 +1028,30 @@ static void gfar_hw_init(struct gfar_private *priv)
/* Initialize ECNTRL */
gfar_write(&regs->ecntrl, ECNTRL_INIT_SETTINGS);

/* Set the extraction length and index */
attrs = ATTRELI_EL(priv->rx_stash_size) |
ATTRELI_EI(priv->rx_stash_index);

gfar_write(&regs->attreli, attrs);

/* Start with defaults, and add stashing
* depending on driver parameters
*/
attrs = ATTR_INIT_SETTINGS;

if (priv->bd_stash_en)
attrs |= ATTR_BDSTASH;

if (priv->rx_stash_size != 0)
attrs |= ATTR_BUFSTASH;

gfar_write(&regs->attr, attrs);

/* FIFO configs */
gfar_write(&regs->fifo_tx_thr, DEFAULT_FIFO_TX_THR);
gfar_write(&regs->fifo_tx_starve, DEFAULT_FIFO_TX_STARVE);
gfar_write(&regs->fifo_tx_starve_shutoff, DEFAULT_FIFO_TX_STARVE_OFF);

/* Program the interrupt steering regs, only for MG devices */
if (priv->num_grps > 1)
gfar_write_isrg(priv);
Expand Down Expand Up @@ -1232,9 +1232,6 @@ static int gfar_probe(struct platform_device *ofdev)
/* Initialize the filer table */
gfar_init_filer_table(priv);

/* Create all the sysfs files */
gfar_init_sysfs(dev);

/* Print out the device info */
netdev_info(dev, "mac: %pM\n", dev->dev_addr);

Expand Down
6 changes: 0 additions & 6 deletions drivers/net/ethernet/freescale/gianfar.h
Expand Up @@ -1130,11 +1130,6 @@ struct gfar_private {
u32 __iomem *hash_regs[16];
int hash_width;

/* global parameters */
unsigned int fifo_threshold;
unsigned int fifo_starve;
unsigned int fifo_starve_off;

/*Filer table*/
unsigned int ftp_rqfpr[MAX_FILER_IDX + 1];
unsigned int ftp_rqfcr[MAX_FILER_IDX + 1];
Expand Down Expand Up @@ -1215,7 +1210,6 @@ void gfar_halt(struct net_device *dev);
void gfar_phy_test(struct mii_bus *bus, struct phy_device *phydev, int enable,
u32 regnum, u32 read);
void gfar_configure_coalescing_all(struct gfar_private *priv);
void gfar_init_sysfs(struct net_device *dev);
int gfar_set_features(struct net_device *dev, netdev_features_t features);
void gfar_check_rx_parser_mode(struct gfar_private *priv);
void gfar_vlan_mode(struct net_device *dev, netdev_features_t features);
Expand Down

0 comments on commit 34018fd

Please sign in to comment.