Andy Fleming | 7f7f531 | 2005-11-11 12:38:59 -0600 | [diff] [blame] | 1 | /* |
| 2 | * drivers/net/gianfar_sysfs.c |
| 3 | * |
| 4 | * Gianfar Ethernet Driver |
| 5 | * This driver is designed for the non-CPM ethernet controllers |
| 6 | * on the 85xx and 83xx family of integrated processors |
| 7 | * Based on 8260_io/fcc_enet.c |
| 8 | * |
| 9 | * Author: Andy Fleming |
Adrian Bunk | b56d55b | 2006-01-11 02:00:10 +0100 | [diff] [blame] | 10 | * Maintainer: Kumar Gala (galak@kernel.crashing.org) |
Andy Fleming | 7f7f531 | 2005-11-11 12:38:59 -0600 | [diff] [blame] | 11 | * |
| 12 | * Copyright (c) 2002-2005 Freescale Semiconductor, Inc. |
| 13 | * |
| 14 | * This program is free software; you can redistribute it and/or modify it |
| 15 | * under the terms of the GNU General Public License as published by the |
| 16 | * Free Software Foundation; either version 2 of the License, or (at your |
| 17 | * option) any later version. |
| 18 | * |
| 19 | * Sysfs file creation and management |
| 20 | */ |
| 21 | |
Andy Fleming | 7f7f531 | 2005-11-11 12:38:59 -0600 | [diff] [blame] | 22 | #include <linux/kernel.h> |
Andy Fleming | 7f7f531 | 2005-11-11 12:38:59 -0600 | [diff] [blame] | 23 | #include <linux/string.h> |
| 24 | #include <linux/errno.h> |
| 25 | #include <linux/unistd.h> |
| 26 | #include <linux/slab.h> |
| 27 | #include <linux/init.h> |
| 28 | #include <linux/delay.h> |
| 29 | #include <linux/etherdevice.h> |
| 30 | #include <linux/spinlock.h> |
| 31 | #include <linux/mm.h> |
| 32 | #include <linux/device.h> |
| 33 | |
| 34 | #include <asm/uaccess.h> |
| 35 | #include <linux/module.h> |
Andy Fleming | 7f7f531 | 2005-11-11 12:38:59 -0600 | [diff] [blame] | 36 | |
| 37 | #include "gianfar.h" |
| 38 | |
Kumar Gala | 4409d28 | 2007-02-12 23:40:06 -0600 | [diff] [blame] | 39 | static ssize_t gfar_show_bd_stash(struct device *dev, |
| 40 | struct device_attribute *attr, char *buf) |
Andy Fleming | 7f7f531 | 2005-11-11 12:38:59 -0600 | [diff] [blame] | 41 | { |
Kumar Gala | 4409d28 | 2007-02-12 23:40:06 -0600 | [diff] [blame] | 42 | struct gfar_private *priv = netdev_priv(to_net_dev(dev)); |
Andy Fleming | 7f7f531 | 2005-11-11 12:38:59 -0600 | [diff] [blame] | 43 | |
Kumar Gala | 4409d28 | 2007-02-12 23:40:06 -0600 | [diff] [blame] | 44 | return sprintf(buf, "%s\n", priv->bd_stash_en ? "on" : "off"); |
Andy Fleming | 7f7f531 | 2005-11-11 12:38:59 -0600 | [diff] [blame] | 45 | } |
| 46 | |
Kumar Gala | 4409d28 | 2007-02-12 23:40:06 -0600 | [diff] [blame] | 47 | static ssize_t gfar_set_bd_stash(struct device *dev, |
| 48 | struct device_attribute *attr, |
| 49 | const char *buf, size_t count) |
Andy Fleming | 7f7f531 | 2005-11-11 12:38:59 -0600 | [diff] [blame] | 50 | { |
Kumar Gala | 4409d28 | 2007-02-12 23:40:06 -0600 | [diff] [blame] | 51 | struct gfar_private *priv = netdev_priv(to_net_dev(dev)); |
Andy Fleming | 7f7f531 | 2005-11-11 12:38:59 -0600 | [diff] [blame] | 52 | int new_setting = 0; |
| 53 | u32 temp; |
| 54 | unsigned long flags; |
| 55 | |
Andy Fleming | 4d7902f | 2009-02-04 16:43:44 -0800 | [diff] [blame] | 56 | if (!(priv->device_flags & FSL_GIANFAR_DEV_HAS_BD_STASHING)) |
| 57 | return count; |
| 58 | |
Andy Fleming | 7f7f531 | 2005-11-11 12:38:59 -0600 | [diff] [blame] | 59 | /* Find out the new setting */ |
Kumar Gala | 4409d28 | 2007-02-12 23:40:06 -0600 | [diff] [blame] | 60 | if (!strncmp("on", buf, count - 1) || !strncmp("1", buf, count - 1)) |
Andy Fleming | 7f7f531 | 2005-11-11 12:38:59 -0600 | [diff] [blame] | 61 | new_setting = 1; |
Kumar Gala | 4409d28 | 2007-02-12 23:40:06 -0600 | [diff] [blame] | 62 | else if (!strncmp("off", buf, count - 1) |
| 63 | || !strncmp("0", buf, count - 1)) |
Andy Fleming | 7f7f531 | 2005-11-11 12:38:59 -0600 | [diff] [blame] | 64 | new_setting = 0; |
| 65 | else |
| 66 | return count; |
| 67 | |
Andy Fleming | fef6108 | 2006-04-20 16:44:29 -0500 | [diff] [blame] | 68 | spin_lock_irqsave(&priv->rxlock, flags); |
Andy Fleming | 7f7f531 | 2005-11-11 12:38:59 -0600 | [diff] [blame] | 69 | |
| 70 | /* Set the new stashing value */ |
| 71 | priv->bd_stash_en = new_setting; |
| 72 | |
| 73 | temp = gfar_read(&priv->regs->attr); |
Jeff Garzik | 6aa20a2 | 2006-09-13 13:24:59 -0400 | [diff] [blame] | 74 | |
Andy Fleming | 7f7f531 | 2005-11-11 12:38:59 -0600 | [diff] [blame] | 75 | if (new_setting) |
| 76 | temp |= ATTR_BDSTASH; |
| 77 | else |
| 78 | temp &= ~(ATTR_BDSTASH); |
| 79 | |
| 80 | gfar_write(&priv->regs->attr, temp); |
| 81 | |
Andy Fleming | fef6108 | 2006-04-20 16:44:29 -0500 | [diff] [blame] | 82 | spin_unlock_irqrestore(&priv->rxlock, flags); |
Andy Fleming | 7f7f531 | 2005-11-11 12:38:59 -0600 | [diff] [blame] | 83 | |
| 84 | return count; |
| 85 | } |
| 86 | |
Anton Vorontsov | b2f66d1 | 2009-02-01 00:54:16 -0800 | [diff] [blame] | 87 | static DEVICE_ATTR(bd_stash, 0644, gfar_show_bd_stash, gfar_set_bd_stash); |
Grant Likely | 35a84fd | 2007-12-01 22:12:45 -0700 | [diff] [blame] | 88 | |
Kumar Gala | 4409d28 | 2007-02-12 23:40:06 -0600 | [diff] [blame] | 89 | static ssize_t gfar_show_rx_stash_size(struct device *dev, |
| 90 | struct device_attribute *attr, char *buf) |
Andy Fleming | 7f7f531 | 2005-11-11 12:38:59 -0600 | [diff] [blame] | 91 | { |
Kumar Gala | 4409d28 | 2007-02-12 23:40:06 -0600 | [diff] [blame] | 92 | struct gfar_private *priv = netdev_priv(to_net_dev(dev)); |
Andy Fleming | 7f7f531 | 2005-11-11 12:38:59 -0600 | [diff] [blame] | 93 | |
| 94 | return sprintf(buf, "%d\n", priv->rx_stash_size); |
| 95 | } |
| 96 | |
Kumar Gala | 4409d28 | 2007-02-12 23:40:06 -0600 | [diff] [blame] | 97 | static ssize_t gfar_set_rx_stash_size(struct device *dev, |
| 98 | struct device_attribute *attr, |
| 99 | const char *buf, size_t count) |
Andy Fleming | 7f7f531 | 2005-11-11 12:38:59 -0600 | [diff] [blame] | 100 | { |
Kumar Gala | 4409d28 | 2007-02-12 23:40:06 -0600 | [diff] [blame] | 101 | struct gfar_private *priv = netdev_priv(to_net_dev(dev)); |
Andy Fleming | 7f7f531 | 2005-11-11 12:38:59 -0600 | [diff] [blame] | 102 | unsigned int length = simple_strtoul(buf, NULL, 0); |
| 103 | u32 temp; |
| 104 | unsigned long flags; |
| 105 | |
Andy Fleming | 4d7902f | 2009-02-04 16:43:44 -0800 | [diff] [blame] | 106 | if (!(priv->device_flags & FSL_GIANFAR_DEV_HAS_BUF_STASHING)) |
| 107 | return count; |
| 108 | |
Andy Fleming | fef6108 | 2006-04-20 16:44:29 -0500 | [diff] [blame] | 109 | spin_lock_irqsave(&priv->rxlock, flags); |
Andy Fleming | 7f7f531 | 2005-11-11 12:38:59 -0600 | [diff] [blame] | 110 | if (length > priv->rx_buffer_size) |
Andy Fleming | f162b9d | 2008-05-02 13:00:30 -0500 | [diff] [blame] | 111 | goto out; |
Andy Fleming | 7f7f531 | 2005-11-11 12:38:59 -0600 | [diff] [blame] | 112 | |
| 113 | if (length == priv->rx_stash_size) |
Andy Fleming | f162b9d | 2008-05-02 13:00:30 -0500 | [diff] [blame] | 114 | goto out; |
Andy Fleming | 7f7f531 | 2005-11-11 12:38:59 -0600 | [diff] [blame] | 115 | |
| 116 | priv->rx_stash_size = length; |
| 117 | |
| 118 | temp = gfar_read(&priv->regs->attreli); |
| 119 | temp &= ~ATTRELI_EL_MASK; |
| 120 | temp |= ATTRELI_EL(length); |
| 121 | gfar_write(&priv->regs->attreli, temp); |
| 122 | |
| 123 | /* Turn stashing on/off as appropriate */ |
| 124 | temp = gfar_read(&priv->regs->attr); |
| 125 | |
| 126 | if (length) |
| 127 | temp |= ATTR_BUFSTASH; |
| 128 | else |
| 129 | temp &= ~(ATTR_BUFSTASH); |
| 130 | |
| 131 | gfar_write(&priv->regs->attr, temp); |
| 132 | |
Andy Fleming | f162b9d | 2008-05-02 13:00:30 -0500 | [diff] [blame] | 133 | out: |
Andy Fleming | fef6108 | 2006-04-20 16:44:29 -0500 | [diff] [blame] | 134 | spin_unlock_irqrestore(&priv->rxlock, flags); |
Andy Fleming | 7f7f531 | 2005-11-11 12:38:59 -0600 | [diff] [blame] | 135 | |
| 136 | return count; |
| 137 | } |
| 138 | |
Anton Vorontsov | b2f66d1 | 2009-02-01 00:54:16 -0800 | [diff] [blame] | 139 | static DEVICE_ATTR(rx_stash_size, 0644, gfar_show_rx_stash_size, |
| 140 | gfar_set_rx_stash_size); |
Grant Likely | 35a84fd | 2007-12-01 22:12:45 -0700 | [diff] [blame] | 141 | |
Andy Fleming | 7f7f531 | 2005-11-11 12:38:59 -0600 | [diff] [blame] | 142 | /* Stashing will only be enabled when rx_stash_size != 0 */ |
Kumar Gala | 4409d28 | 2007-02-12 23:40:06 -0600 | [diff] [blame] | 143 | static ssize_t gfar_show_rx_stash_index(struct device *dev, |
| 144 | struct device_attribute *attr, |
| 145 | char *buf) |
Andy Fleming | 7f7f531 | 2005-11-11 12:38:59 -0600 | [diff] [blame] | 146 | { |
Kumar Gala | 4409d28 | 2007-02-12 23:40:06 -0600 | [diff] [blame] | 147 | struct gfar_private *priv = netdev_priv(to_net_dev(dev)); |
Andy Fleming | 7f7f531 | 2005-11-11 12:38:59 -0600 | [diff] [blame] | 148 | |
| 149 | return sprintf(buf, "%d\n", priv->rx_stash_index); |
| 150 | } |
| 151 | |
Kumar Gala | 4409d28 | 2007-02-12 23:40:06 -0600 | [diff] [blame] | 152 | static ssize_t gfar_set_rx_stash_index(struct device *dev, |
| 153 | struct device_attribute *attr, |
| 154 | const char *buf, size_t count) |
Andy Fleming | 7f7f531 | 2005-11-11 12:38:59 -0600 | [diff] [blame] | 155 | { |
Kumar Gala | 4409d28 | 2007-02-12 23:40:06 -0600 | [diff] [blame] | 156 | struct gfar_private *priv = netdev_priv(to_net_dev(dev)); |
Andy Fleming | 7f7f531 | 2005-11-11 12:38:59 -0600 | [diff] [blame] | 157 | unsigned short index = simple_strtoul(buf, NULL, 0); |
| 158 | u32 temp; |
| 159 | unsigned long flags; |
| 160 | |
Andy Fleming | 4d7902f | 2009-02-04 16:43:44 -0800 | [diff] [blame] | 161 | if (!(priv->device_flags & FSL_GIANFAR_DEV_HAS_BUF_STASHING)) |
| 162 | return count; |
| 163 | |
Andy Fleming | fef6108 | 2006-04-20 16:44:29 -0500 | [diff] [blame] | 164 | spin_lock_irqsave(&priv->rxlock, flags); |
Andy Fleming | 7f7f531 | 2005-11-11 12:38:59 -0600 | [diff] [blame] | 165 | if (index > priv->rx_stash_size) |
Andy Fleming | f162b9d | 2008-05-02 13:00:30 -0500 | [diff] [blame] | 166 | goto out; |
Andy Fleming | 7f7f531 | 2005-11-11 12:38:59 -0600 | [diff] [blame] | 167 | |
| 168 | if (index == priv->rx_stash_index) |
Andy Fleming | f162b9d | 2008-05-02 13:00:30 -0500 | [diff] [blame] | 169 | goto out; |
Andy Fleming | 7f7f531 | 2005-11-11 12:38:59 -0600 | [diff] [blame] | 170 | |
| 171 | priv->rx_stash_index = index; |
| 172 | |
| 173 | temp = gfar_read(&priv->regs->attreli); |
| 174 | temp &= ~ATTRELI_EI_MASK; |
| 175 | temp |= ATTRELI_EI(index); |
| 176 | gfar_write(&priv->regs->attreli, flags); |
| 177 | |
Andy Fleming | f162b9d | 2008-05-02 13:00:30 -0500 | [diff] [blame] | 178 | out: |
Andy Fleming | fef6108 | 2006-04-20 16:44:29 -0500 | [diff] [blame] | 179 | spin_unlock_irqrestore(&priv->rxlock, flags); |
Andy Fleming | 7f7f531 | 2005-11-11 12:38:59 -0600 | [diff] [blame] | 180 | |
| 181 | return count; |
| 182 | } |
| 183 | |
Anton Vorontsov | b2f66d1 | 2009-02-01 00:54:16 -0800 | [diff] [blame] | 184 | static DEVICE_ATTR(rx_stash_index, 0644, gfar_show_rx_stash_index, |
| 185 | gfar_set_rx_stash_index); |
Grant Likely | 35a84fd | 2007-12-01 22:12:45 -0700 | [diff] [blame] | 186 | |
Kumar Gala | 4409d28 | 2007-02-12 23:40:06 -0600 | [diff] [blame] | 187 | static ssize_t gfar_show_fifo_threshold(struct device *dev, |
| 188 | struct device_attribute *attr, |
| 189 | char *buf) |
Andy Fleming | 7f7f531 | 2005-11-11 12:38:59 -0600 | [diff] [blame] | 190 | { |
Kumar Gala | 4409d28 | 2007-02-12 23:40:06 -0600 | [diff] [blame] | 191 | struct gfar_private *priv = netdev_priv(to_net_dev(dev)); |
Andy Fleming | 7f7f531 | 2005-11-11 12:38:59 -0600 | [diff] [blame] | 192 | |
| 193 | return sprintf(buf, "%d\n", priv->fifo_threshold); |
| 194 | } |
| 195 | |
Kumar Gala | 4409d28 | 2007-02-12 23:40:06 -0600 | [diff] [blame] | 196 | static ssize_t gfar_set_fifo_threshold(struct device *dev, |
| 197 | struct device_attribute *attr, |
| 198 | const char *buf, size_t count) |
Andy Fleming | 7f7f531 | 2005-11-11 12:38:59 -0600 | [diff] [blame] | 199 | { |
Kumar Gala | 4409d28 | 2007-02-12 23:40:06 -0600 | [diff] [blame] | 200 | struct gfar_private *priv = netdev_priv(to_net_dev(dev)); |
Andy Fleming | 7f7f531 | 2005-11-11 12:38:59 -0600 | [diff] [blame] | 201 | unsigned int length = simple_strtoul(buf, NULL, 0); |
| 202 | u32 temp; |
| 203 | unsigned long flags; |
| 204 | |
| 205 | if (length > GFAR_MAX_FIFO_THRESHOLD) |
| 206 | return count; |
| 207 | |
Andy Fleming | fef6108 | 2006-04-20 16:44:29 -0500 | [diff] [blame] | 208 | spin_lock_irqsave(&priv->txlock, flags); |
Andy Fleming | 7f7f531 | 2005-11-11 12:38:59 -0600 | [diff] [blame] | 209 | |
| 210 | priv->fifo_threshold = length; |
| 211 | |
| 212 | temp = gfar_read(&priv->regs->fifo_tx_thr); |
| 213 | temp &= ~FIFO_TX_THR_MASK; |
| 214 | temp |= length; |
| 215 | gfar_write(&priv->regs->fifo_tx_thr, temp); |
| 216 | |
Andy Fleming | fef6108 | 2006-04-20 16:44:29 -0500 | [diff] [blame] | 217 | spin_unlock_irqrestore(&priv->txlock, flags); |
Andy Fleming | 7f7f531 | 2005-11-11 12:38:59 -0600 | [diff] [blame] | 218 | |
| 219 | return count; |
| 220 | } |
| 221 | |
Anton Vorontsov | b2f66d1 | 2009-02-01 00:54:16 -0800 | [diff] [blame] | 222 | static DEVICE_ATTR(fifo_threshold, 0644, gfar_show_fifo_threshold, |
| 223 | gfar_set_fifo_threshold); |
Grant Likely | 35a84fd | 2007-12-01 22:12:45 -0700 | [diff] [blame] | 224 | |
Kumar Gala | 4409d28 | 2007-02-12 23:40:06 -0600 | [diff] [blame] | 225 | static ssize_t gfar_show_fifo_starve(struct device *dev, |
| 226 | struct device_attribute *attr, char *buf) |
Andy Fleming | 7f7f531 | 2005-11-11 12:38:59 -0600 | [diff] [blame] | 227 | { |
Kumar Gala | 4409d28 | 2007-02-12 23:40:06 -0600 | [diff] [blame] | 228 | struct gfar_private *priv = netdev_priv(to_net_dev(dev)); |
Andy Fleming | 7f7f531 | 2005-11-11 12:38:59 -0600 | [diff] [blame] | 229 | |
| 230 | return sprintf(buf, "%d\n", priv->fifo_starve); |
| 231 | } |
| 232 | |
Kumar Gala | 4409d28 | 2007-02-12 23:40:06 -0600 | [diff] [blame] | 233 | static ssize_t gfar_set_fifo_starve(struct device *dev, |
| 234 | struct device_attribute *attr, |
| 235 | const char *buf, size_t count) |
Andy Fleming | 7f7f531 | 2005-11-11 12:38:59 -0600 | [diff] [blame] | 236 | { |
Kumar Gala | 4409d28 | 2007-02-12 23:40:06 -0600 | [diff] [blame] | 237 | struct gfar_private *priv = netdev_priv(to_net_dev(dev)); |
Andy Fleming | 7f7f531 | 2005-11-11 12:38:59 -0600 | [diff] [blame] | 238 | unsigned int num = simple_strtoul(buf, NULL, 0); |
| 239 | u32 temp; |
| 240 | unsigned long flags; |
| 241 | |
| 242 | if (num > GFAR_MAX_FIFO_STARVE) |
| 243 | return count; |
| 244 | |
Andy Fleming | fef6108 | 2006-04-20 16:44:29 -0500 | [diff] [blame] | 245 | spin_lock_irqsave(&priv->txlock, flags); |
Andy Fleming | 7f7f531 | 2005-11-11 12:38:59 -0600 | [diff] [blame] | 246 | |
| 247 | priv->fifo_starve = num; |
| 248 | |
| 249 | temp = gfar_read(&priv->regs->fifo_tx_starve); |
| 250 | temp &= ~FIFO_TX_STARVE_MASK; |
| 251 | temp |= num; |
| 252 | gfar_write(&priv->regs->fifo_tx_starve, temp); |
| 253 | |
Andy Fleming | fef6108 | 2006-04-20 16:44:29 -0500 | [diff] [blame] | 254 | spin_unlock_irqrestore(&priv->txlock, flags); |
Andy Fleming | 7f7f531 | 2005-11-11 12:38:59 -0600 | [diff] [blame] | 255 | |
| 256 | return count; |
| 257 | } |
| 258 | |
Anton Vorontsov | b2f66d1 | 2009-02-01 00:54:16 -0800 | [diff] [blame] | 259 | static DEVICE_ATTR(fifo_starve, 0644, gfar_show_fifo_starve, |
| 260 | gfar_set_fifo_starve); |
Grant Likely | 35a84fd | 2007-12-01 22:12:45 -0700 | [diff] [blame] | 261 | |
Kumar Gala | 4409d28 | 2007-02-12 23:40:06 -0600 | [diff] [blame] | 262 | static ssize_t gfar_show_fifo_starve_off(struct device *dev, |
| 263 | struct device_attribute *attr, |
| 264 | char *buf) |
Andy Fleming | 7f7f531 | 2005-11-11 12:38:59 -0600 | [diff] [blame] | 265 | { |
Kumar Gala | 4409d28 | 2007-02-12 23:40:06 -0600 | [diff] [blame] | 266 | struct gfar_private *priv = netdev_priv(to_net_dev(dev)); |
Andy Fleming | 7f7f531 | 2005-11-11 12:38:59 -0600 | [diff] [blame] | 267 | |
| 268 | return sprintf(buf, "%d\n", priv->fifo_starve_off); |
| 269 | } |
| 270 | |
Kumar Gala | 4409d28 | 2007-02-12 23:40:06 -0600 | [diff] [blame] | 271 | static ssize_t gfar_set_fifo_starve_off(struct device *dev, |
| 272 | struct device_attribute *attr, |
| 273 | const char *buf, size_t count) |
Andy Fleming | 7f7f531 | 2005-11-11 12:38:59 -0600 | [diff] [blame] | 274 | { |
Kumar Gala | 4409d28 | 2007-02-12 23:40:06 -0600 | [diff] [blame] | 275 | struct gfar_private *priv = netdev_priv(to_net_dev(dev)); |
Andy Fleming | 7f7f531 | 2005-11-11 12:38:59 -0600 | [diff] [blame] | 276 | unsigned int num = simple_strtoul(buf, NULL, 0); |
| 277 | u32 temp; |
| 278 | unsigned long flags; |
| 279 | |
| 280 | if (num > GFAR_MAX_FIFO_STARVE_OFF) |
| 281 | return count; |
| 282 | |
Andy Fleming | fef6108 | 2006-04-20 16:44:29 -0500 | [diff] [blame] | 283 | spin_lock_irqsave(&priv->txlock, flags); |
Andy Fleming | 7f7f531 | 2005-11-11 12:38:59 -0600 | [diff] [blame] | 284 | |
| 285 | priv->fifo_starve_off = num; |
| 286 | |
| 287 | temp = gfar_read(&priv->regs->fifo_tx_starve_shutoff); |
| 288 | temp &= ~FIFO_TX_STARVE_OFF_MASK; |
| 289 | temp |= num; |
| 290 | gfar_write(&priv->regs->fifo_tx_starve_shutoff, temp); |
| 291 | |
Andy Fleming | fef6108 | 2006-04-20 16:44:29 -0500 | [diff] [blame] | 292 | spin_unlock_irqrestore(&priv->txlock, flags); |
Andy Fleming | 7f7f531 | 2005-11-11 12:38:59 -0600 | [diff] [blame] | 293 | |
| 294 | return count; |
| 295 | } |
| 296 | |
Anton Vorontsov | b2f66d1 | 2009-02-01 00:54:16 -0800 | [diff] [blame] | 297 | static DEVICE_ATTR(fifo_starve_off, 0644, gfar_show_fifo_starve_off, |
| 298 | gfar_set_fifo_starve_off); |
Grant Likely | 35a84fd | 2007-12-01 22:12:45 -0700 | [diff] [blame] | 299 | |
Andy Fleming | 7f7f531 | 2005-11-11 12:38:59 -0600 | [diff] [blame] | 300 | void gfar_init_sysfs(struct net_device *dev) |
| 301 | { |
| 302 | struct gfar_private *priv = netdev_priv(dev); |
Grant Likely | 35a84fd | 2007-12-01 22:12:45 -0700 | [diff] [blame] | 303 | int rc; |
Andy Fleming | 7f7f531 | 2005-11-11 12:38:59 -0600 | [diff] [blame] | 304 | |
| 305 | /* Initialize the default values */ |
Andy Fleming | 7f7f531 | 2005-11-11 12:38:59 -0600 | [diff] [blame] | 306 | priv->fifo_threshold = DEFAULT_FIFO_TX_THR; |
| 307 | priv->fifo_starve = DEFAULT_FIFO_TX_STARVE; |
| 308 | priv->fifo_starve_off = DEFAULT_FIFO_TX_STARVE_OFF; |
Andy Fleming | 7f7f531 | 2005-11-11 12:38:59 -0600 | [diff] [blame] | 309 | |
| 310 | /* Create our sysfs files */ |
Grant Likely | 35a84fd | 2007-12-01 22:12:45 -0700 | [diff] [blame] | 311 | rc = device_create_file(&dev->dev, &dev_attr_bd_stash); |
| 312 | rc |= device_create_file(&dev->dev, &dev_attr_rx_stash_size); |
| 313 | rc |= device_create_file(&dev->dev, &dev_attr_rx_stash_index); |
| 314 | rc |= device_create_file(&dev->dev, &dev_attr_fifo_threshold); |
| 315 | rc |= device_create_file(&dev->dev, &dev_attr_fifo_starve); |
| 316 | rc |= device_create_file(&dev->dev, &dev_attr_fifo_starve_off); |
| 317 | if (rc) |
| 318 | dev_err(&dev->dev, "Error creating gianfar sysfs files.\n"); |
Andy Fleming | 7f7f531 | 2005-11-11 12:38:59 -0600 | [diff] [blame] | 319 | } |