diff options
Diffstat (limited to 'drivers/net/gianfar_sysfs.c')
-rw-r--r-- | drivers/net/gianfar_sysfs.c | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/drivers/net/gianfar_sysfs.c b/drivers/net/gianfar_sysfs.c index 9c664f85705c..adea11ea4038 100644 --- a/drivers/net/gianfar_sysfs.c +++ b/drivers/net/gianfar_sysfs.c | |||
@@ -50,6 +50,7 @@ static ssize_t gfar_set_bd_stash(struct device *dev, | |||
50 | const char *buf, size_t count) | 50 | const char *buf, size_t count) |
51 | { | 51 | { |
52 | struct gfar_private *priv = netdev_priv(to_net_dev(dev)); | 52 | struct gfar_private *priv = netdev_priv(to_net_dev(dev)); |
53 | struct gfar __iomem *regs = priv->gfargrp.regs; | ||
53 | struct gfar_priv_rx_q *rx_queue = NULL; | 54 | struct gfar_priv_rx_q *rx_queue = NULL; |
54 | int new_setting = 0; | 55 | int new_setting = 0; |
55 | u32 temp; | 56 | u32 temp; |
@@ -74,14 +75,14 @@ static ssize_t gfar_set_bd_stash(struct device *dev, | |||
74 | /* Set the new stashing value */ | 75 | /* Set the new stashing value */ |
75 | priv->bd_stash_en = new_setting; | 76 | priv->bd_stash_en = new_setting; |
76 | 77 | ||
77 | temp = gfar_read(&priv->regs->attr); | 78 | temp = gfar_read(®s->attr); |
78 | 79 | ||
79 | if (new_setting) | 80 | if (new_setting) |
80 | temp |= ATTR_BDSTASH; | 81 | temp |= ATTR_BDSTASH; |
81 | else | 82 | else |
82 | temp &= ~(ATTR_BDSTASH); | 83 | temp &= ~(ATTR_BDSTASH); |
83 | 84 | ||
84 | gfar_write(&priv->regs->attr, temp); | 85 | gfar_write(®s->attr, temp); |
85 | 86 | ||
86 | spin_unlock_irqrestore(&rx_queue->rxlock, flags); | 87 | spin_unlock_irqrestore(&rx_queue->rxlock, flags); |
87 | 88 | ||
@@ -103,6 +104,7 @@ static ssize_t gfar_set_rx_stash_size(struct device *dev, | |||
103 | const char *buf, size_t count) | 104 | const char *buf, size_t count) |
104 | { | 105 | { |
105 | struct gfar_private *priv = netdev_priv(to_net_dev(dev)); | 106 | struct gfar_private *priv = netdev_priv(to_net_dev(dev)); |
107 | struct gfar __iomem *regs = priv->gfargrp.regs; | ||
106 | struct gfar_priv_rx_q *rx_queue = NULL; | 108 | struct gfar_priv_rx_q *rx_queue = NULL; |
107 | unsigned int length = simple_strtoul(buf, NULL, 0); | 109 | unsigned int length = simple_strtoul(buf, NULL, 0); |
108 | u32 temp; | 110 | u32 temp; |
@@ -122,20 +124,20 @@ static ssize_t gfar_set_rx_stash_size(struct device *dev, | |||
122 | 124 | ||
123 | priv->rx_stash_size = length; | 125 | priv->rx_stash_size = length; |
124 | 126 | ||
125 | temp = gfar_read(&priv->regs->attreli); | 127 | temp = gfar_read(®s->attreli); |
126 | temp &= ~ATTRELI_EL_MASK; | 128 | temp &= ~ATTRELI_EL_MASK; |
127 | temp |= ATTRELI_EL(length); | 129 | temp |= ATTRELI_EL(length); |
128 | gfar_write(&priv->regs->attreli, temp); | 130 | gfar_write(®s->attreli, temp); |
129 | 131 | ||
130 | /* Turn stashing on/off as appropriate */ | 132 | /* Turn stashing on/off as appropriate */ |
131 | temp = gfar_read(&priv->regs->attr); | 133 | temp = gfar_read(®s->attr); |
132 | 134 | ||
133 | if (length) | 135 | if (length) |
134 | temp |= ATTR_BUFSTASH; | 136 | temp |= ATTR_BUFSTASH; |
135 | else | 137 | else |
136 | temp &= ~(ATTR_BUFSTASH); | 138 | temp &= ~(ATTR_BUFSTASH); |
137 | 139 | ||
138 | gfar_write(&priv->regs->attr, temp); | 140 | gfar_write(®s->attr, temp); |
139 | 141 | ||
140 | out: | 142 | out: |
141 | spin_unlock_irqrestore(&rx_queue->rxlock, flags); | 143 | spin_unlock_irqrestore(&rx_queue->rxlock, flags); |
@@ -161,6 +163,7 @@ static ssize_t gfar_set_rx_stash_index(struct device *dev, | |||
161 | const char *buf, size_t count) | 163 | const char *buf, size_t count) |
162 | { | 164 | { |
163 | struct gfar_private *priv = netdev_priv(to_net_dev(dev)); | 165 | struct gfar_private *priv = netdev_priv(to_net_dev(dev)); |
166 | struct gfar __iomem *regs = priv->gfargrp.regs; | ||
164 | struct gfar_priv_rx_q *rx_queue = NULL; | 167 | struct gfar_priv_rx_q *rx_queue = NULL; |
165 | unsigned short index = simple_strtoul(buf, NULL, 0); | 168 | unsigned short index = simple_strtoul(buf, NULL, 0); |
166 | u32 temp; | 169 | u32 temp; |
@@ -180,10 +183,10 @@ static ssize_t gfar_set_rx_stash_index(struct device *dev, | |||
180 | 183 | ||
181 | priv->rx_stash_index = index; | 184 | priv->rx_stash_index = index; |
182 | 185 | ||
183 | temp = gfar_read(&priv->regs->attreli); | 186 | temp = gfar_read(®s->attreli); |
184 | temp &= ~ATTRELI_EI_MASK; | 187 | temp &= ~ATTRELI_EI_MASK; |
185 | temp |= ATTRELI_EI(index); | 188 | temp |= ATTRELI_EI(index); |
186 | gfar_write(&priv->regs->attreli, flags); | 189 | gfar_write(®s->attreli, flags); |
187 | 190 | ||
188 | out: | 191 | out: |
189 | spin_unlock_irqrestore(&rx_queue->rxlock, flags); | 192 | spin_unlock_irqrestore(&rx_queue->rxlock, flags); |
@@ -208,6 +211,7 @@ static ssize_t gfar_set_fifo_threshold(struct device *dev, | |||
208 | const char *buf, size_t count) | 211 | const char *buf, size_t count) |
209 | { | 212 | { |
210 | struct gfar_private *priv = netdev_priv(to_net_dev(dev)); | 213 | struct gfar_private *priv = netdev_priv(to_net_dev(dev)); |
214 | struct gfar __iomem *regs = priv->gfargrp.regs; | ||
211 | struct gfar_priv_tx_q *tx_queue = NULL; | 215 | struct gfar_priv_tx_q *tx_queue = NULL; |
212 | unsigned int length = simple_strtoul(buf, NULL, 0); | 216 | unsigned int length = simple_strtoul(buf, NULL, 0); |
213 | u32 temp; | 217 | u32 temp; |
@@ -222,10 +226,10 @@ static ssize_t gfar_set_fifo_threshold(struct device *dev, | |||
222 | 226 | ||
223 | priv->fifo_threshold = length; | 227 | priv->fifo_threshold = length; |
224 | 228 | ||
225 | temp = gfar_read(&priv->regs->fifo_tx_thr); | 229 | temp = gfar_read(®s->fifo_tx_thr); |
226 | temp &= ~FIFO_TX_THR_MASK; | 230 | temp &= ~FIFO_TX_THR_MASK; |
227 | temp |= length; | 231 | temp |= length; |
228 | gfar_write(&priv->regs->fifo_tx_thr, temp); | 232 | gfar_write(®s->fifo_tx_thr, temp); |
229 | 233 | ||
230 | spin_unlock_irqrestore(&tx_queue->txlock, flags); | 234 | spin_unlock_irqrestore(&tx_queue->txlock, flags); |
231 | 235 | ||
@@ -248,6 +252,7 @@ static ssize_t gfar_set_fifo_starve(struct device *dev, | |||
248 | const char *buf, size_t count) | 252 | const char *buf, size_t count) |
249 | { | 253 | { |
250 | struct gfar_private *priv = netdev_priv(to_net_dev(dev)); | 254 | struct gfar_private *priv = netdev_priv(to_net_dev(dev)); |
255 | struct gfar __iomem *regs = priv->gfargrp.regs; | ||
251 | struct gfar_priv_tx_q *tx_queue = NULL; | 256 | struct gfar_priv_tx_q *tx_queue = NULL; |
252 | unsigned int num = simple_strtoul(buf, NULL, 0); | 257 | unsigned int num = simple_strtoul(buf, NULL, 0); |
253 | u32 temp; | 258 | u32 temp; |
@@ -261,10 +266,10 @@ static ssize_t gfar_set_fifo_starve(struct device *dev, | |||
261 | 266 | ||
262 | priv->fifo_starve = num; | 267 | priv->fifo_starve = num; |
263 | 268 | ||
264 | temp = gfar_read(&priv->regs->fifo_tx_starve); | 269 | temp = gfar_read(®s->fifo_tx_starve); |
265 | temp &= ~FIFO_TX_STARVE_MASK; | 270 | temp &= ~FIFO_TX_STARVE_MASK; |
266 | temp |= num; | 271 | temp |= num; |
267 | gfar_write(&priv->regs->fifo_tx_starve, temp); | 272 | gfar_write(®s->fifo_tx_starve, temp); |
268 | 273 | ||
269 | spin_unlock_irqrestore(&tx_queue->txlock, flags); | 274 | spin_unlock_irqrestore(&tx_queue->txlock, flags); |
270 | 275 | ||
@@ -288,6 +293,7 @@ static ssize_t gfar_set_fifo_starve_off(struct device *dev, | |||
288 | const char *buf, size_t count) | 293 | const char *buf, size_t count) |
289 | { | 294 | { |
290 | struct gfar_private *priv = netdev_priv(to_net_dev(dev)); | 295 | struct gfar_private *priv = netdev_priv(to_net_dev(dev)); |
296 | struct gfar __iomem *regs = priv->gfargrp.regs; | ||
291 | struct gfar_priv_tx_q *tx_queue = NULL; | 297 | struct gfar_priv_tx_q *tx_queue = NULL; |
292 | unsigned int num = simple_strtoul(buf, NULL, 0); | 298 | unsigned int num = simple_strtoul(buf, NULL, 0); |
293 | u32 temp; | 299 | u32 temp; |
@@ -301,10 +307,10 @@ static ssize_t gfar_set_fifo_starve_off(struct device *dev, | |||
301 | 307 | ||
302 | priv->fifo_starve_off = num; | 308 | priv->fifo_starve_off = num; |
303 | 309 | ||
304 | temp = gfar_read(&priv->regs->fifo_tx_starve_shutoff); | 310 | temp = gfar_read(®s->fifo_tx_starve_shutoff); |
305 | temp &= ~FIFO_TX_STARVE_OFF_MASK; | 311 | temp &= ~FIFO_TX_STARVE_OFF_MASK; |
306 | temp |= num; | 312 | temp |= num; |
307 | gfar_write(&priv->regs->fifo_tx_starve_shutoff, temp); | 313 | gfar_write(®s->fifo_tx_starve_shutoff, temp); |
308 | 314 | ||
309 | spin_unlock_irqrestore(&tx_queue->txlock, flags); | 315 | spin_unlock_irqrestore(&tx_queue->txlock, flags); |
310 | 316 | ||