aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/powerpc/dts-bindings/fsl/tsec.txt6
-rw-r--r--drivers/net/gianfar.c23
-rw-r--r--drivers/net/gianfar_sysfs.c12
3 files changed, 38 insertions, 3 deletions
diff --git a/Documentation/powerpc/dts-bindings/fsl/tsec.txt b/Documentation/powerpc/dts-bindings/fsl/tsec.txt
index 7fa4b27574b5..edb7ae19e868 100644
--- a/Documentation/powerpc/dts-bindings/fsl/tsec.txt
+++ b/Documentation/powerpc/dts-bindings/fsl/tsec.txt
@@ -56,6 +56,12 @@ Properties:
56 hardware. 56 hardware.
57 - fsl,magic-packet : If present, indicates that the hardware supports 57 - fsl,magic-packet : If present, indicates that the hardware supports
58 waking up via magic packet. 58 waking up via magic packet.
59 - bd-stash : If present, indicates that the hardware supports stashing
60 buffer descriptors in the L2.
61 - rx-stash-len : Denotes the number of bytes of a received buffer to stash
62 in the L2.
63 - rx-stash-idx : Denotes the index of the first byte from the received
64 buffer to stash in the L2.
59 65
60Example: 66Example:
61 ethernet@24000 { 67 ethernet@24000 {
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index 33de25602b32..dadd08cd801b 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -164,6 +164,9 @@ static int gfar_of_init(struct net_device *dev)
164 struct gfar_private *priv = netdev_priv(dev); 164 struct gfar_private *priv = netdev_priv(dev);
165 struct device_node *np = priv->node; 165 struct device_node *np = priv->node;
166 char bus_name[MII_BUS_ID_SIZE]; 166 char bus_name[MII_BUS_ID_SIZE];
167 const u32 *stash;
168 const u32 *stash_len;
169 const u32 *stash_idx;
167 170
168 if (!np || !of_device_is_available(np)) 171 if (!np || !of_device_is_available(np))
169 return -ENODEV; 172 return -ENODEV;
@@ -193,6 +196,26 @@ static int gfar_of_init(struct net_device *dev)
193 } 196 }
194 } 197 }
195 198
199 stash = of_get_property(np, "bd-stash", NULL);
200
201 if(stash) {
202 priv->device_flags |= FSL_GIANFAR_DEV_HAS_BD_STASHING;
203 priv->bd_stash_en = 1;
204 }
205
206 stash_len = of_get_property(np, "rx-stash-len", NULL);
207
208 if (stash_len)
209 priv->rx_stash_size = *stash_len;
210
211 stash_idx = of_get_property(np, "rx-stash-idx", NULL);
212
213 if (stash_idx)
214 priv->rx_stash_index = *stash_idx;
215
216 if (stash_len || stash_idx)
217 priv->device_flags |= FSL_GIANFAR_DEV_HAS_BUF_STASHING;
218
196 mac_addr = of_get_mac_address(np); 219 mac_addr = of_get_mac_address(np);
197 if (mac_addr) 220 if (mac_addr)
198 memcpy(dev->dev_addr, mac_addr, MAC_ADDR_LEN); 221 memcpy(dev->dev_addr, mac_addr, MAC_ADDR_LEN);
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);