aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/gianfar_sysfs.c
diff options
context:
space:
mode:
authorAndy Fleming <afleming@freescale.com>2009-02-04 19:43:44 -0500
committerDavid S. Miller <davem@davemloft.net>2009-02-04 19:43:44 -0500
commit4d7902f22b0804730b80f7a4147f676430248a3a (patch)
treef3a2eb354156760e9f07b02774006fb2103aa20e /drivers/net/gianfar_sysfs.c
parent0fd56bb5be6455d0d42241e65aed057244665e5e (diff)
gianfar: Fix stashing support
Stashing is only supported on the 85xx (e500-based) SoCs. The 83xx and 86xx chips don't have a proper cache for this. U-Boot has been updated to add stashing properties to the device tree nodes of gianfar devices on 85xx. So now we modify Linux to keep stashing off unless those properties are there. Signed-off-by: Andy Fleming <afleming@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/gianfar_sysfs.c')
-rw-r--r--drivers/net/gianfar_sysfs.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/net/gianfar_sysfs.c b/drivers/net/gianfar_sysfs.c
index 74e0b4d42587..dd26da74f27a 100644
--- a/drivers/net/gianfar_sysfs.c
+++ b/drivers/net/gianfar_sysfs.c
@@ -53,6 +53,9 @@ static ssize_t gfar_set_bd_stash(struct device *dev,
53 u32 temp; 53 u32 temp;
54 unsigned long flags; 54 unsigned long flags;
55 55
56 if (!(priv->device_flags & FSL_GIANFAR_DEV_HAS_BD_STASHING))
57 return count;
58
56 /* Find out the new setting */ 59 /* Find out the new setting */
57 if (!strncmp("on", buf, count - 1) || !strncmp("1", buf, count - 1)) 60 if (!strncmp("on", buf, count - 1) || !strncmp("1", buf, count - 1))
58 new_setting = 1; 61 new_setting = 1;
@@ -100,6 +103,9 @@ static ssize_t gfar_set_rx_stash_size(struct device *dev,
100 u32 temp; 103 u32 temp;
101 unsigned long flags; 104 unsigned long flags;
102 105
106 if (!(priv->device_flags & FSL_GIANFAR_DEV_HAS_BUF_STASHING))
107 return count;
108
103 spin_lock_irqsave(&priv->rxlock, flags); 109 spin_lock_irqsave(&priv->rxlock, flags);
104 if (length > priv->rx_buffer_size) 110 if (length > priv->rx_buffer_size)
105 goto out; 111 goto out;
@@ -152,6 +158,9 @@ static ssize_t gfar_set_rx_stash_index(struct device *dev,
152 u32 temp; 158 u32 temp;
153 unsigned long flags; 159 unsigned long flags;
154 160
161 if (!(priv->device_flags & FSL_GIANFAR_DEV_HAS_BUF_STASHING))
162 return count;
163
155 spin_lock_irqsave(&priv->rxlock, flags); 164 spin_lock_irqsave(&priv->rxlock, flags);
156 if (index > priv->rx_stash_size) 165 if (index > priv->rx_stash_size)
157 goto out; 166 goto out;
@@ -294,12 +303,9 @@ void gfar_init_sysfs(struct net_device *dev)
294 int rc; 303 int rc;
295 304
296 /* Initialize the default values */ 305 /* Initialize the default values */
297 priv->rx_stash_size = DEFAULT_STASH_LENGTH;
298 priv->rx_stash_index = DEFAULT_STASH_INDEX;
299 priv->fifo_threshold = DEFAULT_FIFO_TX_THR; 306 priv->fifo_threshold = DEFAULT_FIFO_TX_THR;
300 priv->fifo_starve = DEFAULT_FIFO_TX_STARVE; 307 priv->fifo_starve = DEFAULT_FIFO_TX_STARVE;
301 priv->fifo_starve_off = DEFAULT_FIFO_TX_STARVE_OFF; 308 priv->fifo_starve_off = DEFAULT_FIFO_TX_STARVE_OFF;
302 priv->bd_stash_en = DEFAULT_BD_STASH;
303 309
304 /* Create our sysfs files */ 310 /* Create our sysfs files */
305 rc = device_create_file(&dev->dev, &dev_attr_bd_stash); 311 rc = device_create_file(&dev->dev, &dev_attr_bd_stash);