diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/atm/Makefile | 2 | ||||
-rw-r--r-- | drivers/block/Kconfig | 1 | ||||
-rw-r--r-- | drivers/crypto/Kconfig | 13 | ||||
-rw-r--r-- | drivers/crypto/Makefile | 1 | ||||
-rw-r--r-- | drivers/crypto/geode-aes.c | 474 | ||||
-rw-r--r-- | drivers/crypto/geode-aes.h | 40 | ||||
-rw-r--r-- | drivers/md/dm-crypt.c | 68 | ||||
-rw-r--r-- | drivers/net/irda/pxaficp_ir.c | 26 | ||||
-rw-r--r-- | drivers/net/tg3.c | 142 | ||||
-rw-r--r-- | drivers/net/tg3.h | 1 |
10 files changed, 687 insertions, 81 deletions
diff --git a/drivers/atm/Makefile b/drivers/atm/Makefile index b5077ce8cb40..1b16f8166b09 100644 --- a/drivers/atm/Makefile +++ b/drivers/atm/Makefile | |||
@@ -41,7 +41,7 @@ ifeq ($(CONFIG_ATM_FORE200E_PCA),y) | |||
41 | # guess the target endianess to choose the right PCA-200E firmware image | 41 | # guess the target endianess to choose the right PCA-200E firmware image |
42 | ifeq ($(CONFIG_ATM_FORE200E_PCA_DEFAULT_FW),y) | 42 | ifeq ($(CONFIG_ATM_FORE200E_PCA_DEFAULT_FW),y) |
43 | byteorder.h := include$(if $(patsubst $(srctree),,$(objtree)),2)/asm/byteorder.h | 43 | byteorder.h := include$(if $(patsubst $(srctree),,$(objtree)),2)/asm/byteorder.h |
44 | CONFIG_ATM_FORE200E_PCA_FW := $(obj)/pca200e$(if $(shell $(CC) -E -dM $(byteorder.h) | grep ' __LITTLE_ENDIAN '),.bin,_ecd.bin2) | 44 | CONFIG_ATM_FORE200E_PCA_FW := $(obj)/pca200e$(if $(shell $(CC) $(CPPFLAGS) -E -dM $(byteorder.h) | grep ' __LITTLE_ENDIAN '),.bin,_ecd.bin2) |
45 | endif | 45 | endif |
46 | endif | 46 | endif |
47 | 47 | ||
diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig index 432c17e1e0e6..85072446d772 100644 --- a/drivers/block/Kconfig +++ b/drivers/block/Kconfig | |||
@@ -306,6 +306,7 @@ config BLK_DEV_LOOP | |||
306 | config BLK_DEV_CRYPTOLOOP | 306 | config BLK_DEV_CRYPTOLOOP |
307 | tristate "Cryptoloop Support" | 307 | tristate "Cryptoloop Support" |
308 | select CRYPTO | 308 | select CRYPTO |
309 | select CRYPTO_CBC | ||
309 | depends on BLK_DEV_LOOP | 310 | depends on BLK_DEV_LOOP |
310 | ---help--- | 311 | ---help--- |
311 | Say Y here if you want to be able to use the ciphers that are | 312 | Say Y here if you want to be able to use the ciphers that are |
diff --git a/drivers/crypto/Kconfig b/drivers/crypto/Kconfig index adb554153f67..e816535ab305 100644 --- a/drivers/crypto/Kconfig +++ b/drivers/crypto/Kconfig | |||
@@ -51,4 +51,17 @@ config CRYPTO_DEV_PADLOCK_SHA | |||
51 | If unsure say M. The compiled module will be | 51 | If unsure say M. The compiled module will be |
52 | called padlock-sha.ko | 52 | called padlock-sha.ko |
53 | 53 | ||
54 | config CRYPTO_DEV_GEODE | ||
55 | tristate "Support for the Geode LX AES engine" | ||
56 | depends on CRYPTO && X86_32 | ||
57 | select CRYPTO_ALGAPI | ||
58 | select CRYPTO_BLKCIPHER | ||
59 | default m | ||
60 | help | ||
61 | Say 'Y' here to use the AMD Geode LX processor on-board AES | ||
62 | engine for the CryptoAPI AES alogrithm. | ||
63 | |||
64 | To compile this driver as a module, choose M here: the module | ||
65 | will be called geode-aes. | ||
66 | |||
54 | endmenu | 67 | endmenu |
diff --git a/drivers/crypto/Makefile b/drivers/crypto/Makefile index 4c3d0ec1cf80..6059cf869414 100644 --- a/drivers/crypto/Makefile +++ b/drivers/crypto/Makefile | |||
@@ -1,3 +1,4 @@ | |||
1 | obj-$(CONFIG_CRYPTO_DEV_PADLOCK) += padlock.o | 1 | obj-$(CONFIG_CRYPTO_DEV_PADLOCK) += padlock.o |
2 | obj-$(CONFIG_CRYPTO_DEV_PADLOCK_AES) += padlock-aes.o | 2 | obj-$(CONFIG_CRYPTO_DEV_PADLOCK_AES) += padlock-aes.o |
3 | obj-$(CONFIG_CRYPTO_DEV_PADLOCK_SHA) += padlock-sha.o | 3 | obj-$(CONFIG_CRYPTO_DEV_PADLOCK_SHA) += padlock-sha.o |
4 | obj-$(CONFIG_CRYPTO_DEV_GEODE) += geode-aes.o | ||
diff --git a/drivers/crypto/geode-aes.c b/drivers/crypto/geode-aes.c new file mode 100644 index 000000000000..43a68398656f --- /dev/null +++ b/drivers/crypto/geode-aes.c | |||
@@ -0,0 +1,474 @@ | |||
1 | /* Copyright (C) 2004-2006, Advanced Micro Devices, Inc. | ||
2 | * | ||
3 | * This program is free software; you can redistribute it and/or modify | ||
4 | * it under the terms of the GNU General Public License as published by | ||
5 | * the Free Software Foundation; either version 2 of the License, or | ||
6 | * (at your option) any later version. | ||
7 | */ | ||
8 | |||
9 | #include <linux/module.h> | ||
10 | #include <linux/kernel.h> | ||
11 | #include <linux/sched.h> | ||
12 | #include <linux/pci.h> | ||
13 | #include <linux/pci_ids.h> | ||
14 | #include <linux/crypto.h> | ||
15 | #include <linux/spinlock.h> | ||
16 | #include <crypto/algapi.h> | ||
17 | |||
18 | #include <asm/io.h> | ||
19 | #include <asm/delay.h> | ||
20 | |||
21 | #include "geode-aes.h" | ||
22 | |||
23 | /* Register definitions */ | ||
24 | |||
25 | #define AES_CTRLA_REG 0x0000 | ||
26 | |||
27 | #define AES_CTRL_START 0x01 | ||
28 | #define AES_CTRL_DECRYPT 0x00 | ||
29 | #define AES_CTRL_ENCRYPT 0x02 | ||
30 | #define AES_CTRL_WRKEY 0x04 | ||
31 | #define AES_CTRL_DCA 0x08 | ||
32 | #define AES_CTRL_SCA 0x10 | ||
33 | #define AES_CTRL_CBC 0x20 | ||
34 | |||
35 | #define AES_INTR_REG 0x0008 | ||
36 | |||
37 | #define AES_INTRA_PENDING (1 << 16) | ||
38 | #define AES_INTRB_PENDING (1 << 17) | ||
39 | |||
40 | #define AES_INTR_PENDING (AES_INTRA_PENDING | AES_INTRB_PENDING) | ||
41 | #define AES_INTR_MASK 0x07 | ||
42 | |||
43 | #define AES_SOURCEA_REG 0x0010 | ||
44 | #define AES_DSTA_REG 0x0014 | ||
45 | #define AES_LENA_REG 0x0018 | ||
46 | #define AES_WRITEKEY0_REG 0x0030 | ||
47 | #define AES_WRITEIV0_REG 0x0040 | ||
48 | |||
49 | /* A very large counter that is used to gracefully bail out of an | ||
50 | * operation in case of trouble | ||
51 | */ | ||
52 | |||
53 | #define AES_OP_TIMEOUT 0x50000 | ||
54 | |||
55 | /* Static structures */ | ||
56 | |||
57 | static void __iomem * _iobase; | ||
58 | static spinlock_t lock; | ||
59 | |||
60 | /* Write a 128 bit field (either a writable key or IV) */ | ||
61 | static inline void | ||
62 | _writefield(u32 offset, void *value) | ||
63 | { | ||
64 | int i; | ||
65 | for(i = 0; i < 4; i++) | ||
66 | iowrite32(((u32 *) value)[i], _iobase + offset + (i * 4)); | ||
67 | } | ||
68 | |||
69 | /* Read a 128 bit field (either a writable key or IV) */ | ||
70 | static inline void | ||
71 | _readfield(u32 offset, void *value) | ||
72 | { | ||
73 | int i; | ||
74 | for(i = 0; i < 4; i++) | ||
75 | ((u32 *) value)[i] = ioread32(_iobase + offset + (i * 4)); | ||
76 | } | ||
77 | |||
78 | static int | ||
79 | do_crypt(void *src, void *dst, int len, u32 flags) | ||
80 | { | ||
81 | u32 status; | ||
82 | u32 counter = AES_OP_TIMEOUT; | ||
83 | |||
84 | iowrite32(virt_to_phys(src), _iobase + AES_SOURCEA_REG); | ||
85 | iowrite32(virt_to_phys(dst), _iobase + AES_DSTA_REG); | ||
86 | iowrite32(len, _iobase + AES_LENA_REG); | ||
87 | |||
88 | /* Start the operation */ | ||
89 | iowrite32(AES_CTRL_START | flags, _iobase + AES_CTRLA_REG); | ||
90 | |||
91 | do | ||
92 | status = ioread32(_iobase + AES_INTR_REG); | ||
93 | while(!(status & AES_INTRA_PENDING) && --counter); | ||
94 | |||
95 | /* Clear the event */ | ||
96 | iowrite32((status & 0xFF) | AES_INTRA_PENDING, _iobase + AES_INTR_REG); | ||
97 | return counter ? 0 : 1; | ||
98 | } | ||
99 | |||
100 | static unsigned int | ||
101 | geode_aes_crypt(struct geode_aes_op *op) | ||
102 | { | ||
103 | |||
104 | u32 flags = 0; | ||
105 | int iflags; | ||
106 | |||
107 | if (op->len == 0 || op->src == op->dst) | ||
108 | return 0; | ||
109 | |||
110 | if (op->flags & AES_FLAGS_COHERENT) | ||
111 | flags |= (AES_CTRL_DCA | AES_CTRL_SCA); | ||
112 | |||
113 | if (op->dir == AES_DIR_ENCRYPT) | ||
114 | flags |= AES_CTRL_ENCRYPT; | ||
115 | |||
116 | /* Start the critical section */ | ||
117 | |||
118 | spin_lock_irqsave(&lock, iflags); | ||
119 | |||
120 | if (op->mode == AES_MODE_CBC) { | ||
121 | flags |= AES_CTRL_CBC; | ||
122 | _writefield(AES_WRITEIV0_REG, op->iv); | ||
123 | } | ||
124 | |||
125 | if (op->flags & AES_FLAGS_USRKEY) { | ||
126 | flags |= AES_CTRL_WRKEY; | ||
127 | _writefield(AES_WRITEKEY0_REG, op->key); | ||
128 | } | ||
129 | |||
130 | do_crypt(op->src, op->dst, op->len, flags); | ||
131 | |||
132 | if (op->mode == AES_MODE_CBC) | ||
133 | _readfield(AES_WRITEIV0_REG, op->iv); | ||
134 | |||
135 | spin_unlock_irqrestore(&lock, iflags); | ||
136 | |||
137 | return op->len; | ||
138 | } | ||
139 | |||
140 | /* CRYPTO-API Functions */ | ||
141 | |||
142 | static int | ||
143 | geode_setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int len) | ||
144 | { | ||
145 | struct geode_aes_op *op = crypto_tfm_ctx(tfm); | ||
146 | |||
147 | if (len != AES_KEY_LENGTH) { | ||
148 | tfm->crt_flags |= CRYPTO_TFM_RES_BAD_KEY_LEN; | ||
149 | return -EINVAL; | ||
150 | } | ||
151 | |||
152 | memcpy(op->key, key, len); | ||
153 | return 0; | ||
154 | } | ||
155 | |||
156 | static void | ||
157 | geode_encrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in) | ||
158 | { | ||
159 | struct geode_aes_op *op = crypto_tfm_ctx(tfm); | ||
160 | |||
161 | if ((out == NULL) || (in == NULL)) | ||
162 | return; | ||
163 | |||
164 | op->src = (void *) in; | ||
165 | op->dst = (void *) out; | ||
166 | op->mode = AES_MODE_ECB; | ||
167 | op->flags = 0; | ||
168 | op->len = AES_MIN_BLOCK_SIZE; | ||
169 | op->dir = AES_DIR_ENCRYPT; | ||
170 | |||
171 | geode_aes_crypt(op); | ||
172 | } | ||
173 | |||
174 | |||
175 | static void | ||
176 | geode_decrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in) | ||
177 | { | ||
178 | struct geode_aes_op *op = crypto_tfm_ctx(tfm); | ||
179 | |||
180 | if ((out == NULL) || (in == NULL)) | ||
181 | return; | ||
182 | |||
183 | op->src = (void *) in; | ||
184 | op->dst = (void *) out; | ||
185 | op->mode = AES_MODE_ECB; | ||
186 | op->flags = 0; | ||
187 | op->len = AES_MIN_BLOCK_SIZE; | ||
188 | op->dir = AES_DIR_DECRYPT; | ||
189 | |||
190 | geode_aes_crypt(op); | ||
191 | } | ||
192 | |||
193 | |||
194 | static struct crypto_alg geode_alg = { | ||
195 | .cra_name = "aes", | ||
196 | .cra_driver_name = "geode-aes-128", | ||
197 | .cra_priority = 300, | ||
198 | .cra_alignmask = 15, | ||
199 | .cra_flags = CRYPTO_ALG_TYPE_CIPHER, | ||
200 | .cra_blocksize = AES_MIN_BLOCK_SIZE, | ||
201 | .cra_ctxsize = sizeof(struct geode_aes_op), | ||
202 | .cra_module = THIS_MODULE, | ||
203 | .cra_list = LIST_HEAD_INIT(geode_alg.cra_list), | ||
204 | .cra_u = { | ||
205 | .cipher = { | ||
206 | .cia_min_keysize = AES_KEY_LENGTH, | ||
207 | .cia_max_keysize = AES_KEY_LENGTH, | ||
208 | .cia_setkey = geode_setkey, | ||
209 | .cia_encrypt = geode_encrypt, | ||
210 | .cia_decrypt = geode_decrypt | ||
211 | } | ||
212 | } | ||
213 | }; | ||
214 | |||
215 | static int | ||
216 | geode_cbc_decrypt(struct blkcipher_desc *desc, | ||
217 | struct scatterlist *dst, struct scatterlist *src, | ||
218 | unsigned int nbytes) | ||
219 | { | ||
220 | struct geode_aes_op *op = crypto_blkcipher_ctx(desc->tfm); | ||
221 | struct blkcipher_walk walk; | ||
222 | int err, ret; | ||
223 | |||
224 | blkcipher_walk_init(&walk, dst, src, nbytes); | ||
225 | err = blkcipher_walk_virt(desc, &walk); | ||
226 | |||
227 | while((nbytes = walk.nbytes)) { | ||
228 | op->src = walk.src.virt.addr, | ||
229 | op->dst = walk.dst.virt.addr; | ||
230 | op->mode = AES_MODE_CBC; | ||
231 | op->len = nbytes - (nbytes % AES_MIN_BLOCK_SIZE); | ||
232 | op->dir = AES_DIR_DECRYPT; | ||
233 | |||
234 | memcpy(op->iv, walk.iv, AES_IV_LENGTH); | ||
235 | |||
236 | ret = geode_aes_crypt(op); | ||
237 | |||
238 | memcpy(walk.iv, op->iv, AES_IV_LENGTH); | ||
239 | nbytes -= ret; | ||
240 | |||
241 | err = blkcipher_walk_done(desc, &walk, nbytes); | ||
242 | } | ||
243 | |||
244 | return err; | ||
245 | } | ||
246 | |||
247 | static int | ||
248 | geode_cbc_encrypt(struct blkcipher_desc *desc, | ||
249 | struct scatterlist *dst, struct scatterlist *src, | ||
250 | unsigned int nbytes) | ||
251 | { | ||
252 | struct geode_aes_op *op = crypto_blkcipher_ctx(desc->tfm); | ||
253 | struct blkcipher_walk walk; | ||
254 | int err, ret; | ||
255 | |||
256 | blkcipher_walk_init(&walk, dst, src, nbytes); | ||
257 | err = blkcipher_walk_virt(desc, &walk); | ||
258 | |||
259 | while((nbytes = walk.nbytes)) { | ||
260 | op->src = walk.src.virt.addr, | ||
261 | op->dst = walk.dst.virt.addr; | ||
262 | op->mode = AES_MODE_CBC; | ||
263 | op->len = nbytes - (nbytes % AES_MIN_BLOCK_SIZE); | ||
264 | op->dir = AES_DIR_ENCRYPT; | ||
265 | |||
266 | memcpy(op->iv, walk.iv, AES_IV_LENGTH); | ||
267 | |||
268 | ret = geode_aes_crypt(op); | ||
269 | nbytes -= ret; | ||
270 | err = blkcipher_walk_done(desc, &walk, nbytes); | ||
271 | } | ||
272 | |||
273 | return err; | ||
274 | } | ||
275 | |||
276 | static struct crypto_alg geode_cbc_alg = { | ||
277 | .cra_name = "cbc(aes)", | ||
278 | .cra_driver_name = "cbc-aes-geode-128", | ||
279 | .cra_priority = 400, | ||
280 | .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER, | ||
281 | .cra_blocksize = AES_MIN_BLOCK_SIZE, | ||
282 | .cra_ctxsize = sizeof(struct geode_aes_op), | ||
283 | .cra_alignmask = 15, | ||
284 | .cra_type = &crypto_blkcipher_type, | ||
285 | .cra_module = THIS_MODULE, | ||
286 | .cra_list = LIST_HEAD_INIT(geode_cbc_alg.cra_list), | ||
287 | .cra_u = { | ||
288 | .blkcipher = { | ||
289 | .min_keysize = AES_KEY_LENGTH, | ||
290 | .max_keysize = AES_KEY_LENGTH, | ||
291 | .setkey = geode_setkey, | ||
292 | .encrypt = geode_cbc_encrypt, | ||
293 | .decrypt = geode_cbc_decrypt, | ||
294 | } | ||
295 | } | ||
296 | }; | ||
297 | |||
298 | static int | ||
299 | geode_ecb_decrypt(struct blkcipher_desc *desc, | ||
300 | struct scatterlist *dst, struct scatterlist *src, | ||
301 | unsigned int nbytes) | ||
302 | { | ||
303 | struct geode_aes_op *op = crypto_blkcipher_ctx(desc->tfm); | ||
304 | struct blkcipher_walk walk; | ||
305 | int err, ret; | ||
306 | |||
307 | blkcipher_walk_init(&walk, dst, src, nbytes); | ||
308 | err = blkcipher_walk_virt(desc, &walk); | ||
309 | |||
310 | while((nbytes = walk.nbytes)) { | ||
311 | op->src = walk.src.virt.addr, | ||
312 | op->dst = walk.dst.virt.addr; | ||
313 | op->mode = AES_MODE_ECB; | ||
314 | op->len = nbytes - (nbytes % AES_MIN_BLOCK_SIZE); | ||
315 | op->dir = AES_DIR_DECRYPT; | ||
316 | |||
317 | ret = geode_aes_crypt(op); | ||
318 | nbytes -= ret; | ||
319 | err = blkcipher_walk_done(desc, &walk, nbytes); | ||
320 | } | ||
321 | |||
322 | return err; | ||
323 | } | ||
324 | |||
325 | static int | ||
326 | geode_ecb_encrypt(struct blkcipher_desc *desc, | ||
327 | struct scatterlist *dst, struct scatterlist *src, | ||
328 | unsigned int nbytes) | ||
329 | { | ||
330 | struct geode_aes_op *op = crypto_blkcipher_ctx(desc->tfm); | ||
331 | struct blkcipher_walk walk; | ||
332 | int err, ret; | ||
333 | |||
334 | blkcipher_walk_init(&walk, dst, src, nbytes); | ||
335 | err = blkcipher_walk_virt(desc, &walk); | ||
336 | |||
337 | while((nbytes = walk.nbytes)) { | ||
338 | op->src = walk.src.virt.addr, | ||
339 | op->dst = walk.dst.virt.addr; | ||
340 | op->mode = AES_MODE_ECB; | ||
341 | op->len = nbytes - (nbytes % AES_MIN_BLOCK_SIZE); | ||
342 | op->dir = AES_DIR_ENCRYPT; | ||
343 | |||
344 | ret = geode_aes_crypt(op); | ||
345 | nbytes -= ret; | ||
346 | ret = blkcipher_walk_done(desc, &walk, nbytes); | ||
347 | } | ||
348 | |||
349 | return err; | ||
350 | } | ||
351 | |||
352 | static struct crypto_alg geode_ecb_alg = { | ||
353 | .cra_name = "ecb(aes)", | ||
354 | .cra_driver_name = "ecb-aes-geode-128", | ||
355 | .cra_priority = 400, | ||
356 | .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER, | ||
357 | .cra_blocksize = AES_MIN_BLOCK_SIZE, | ||
358 | .cra_ctxsize = sizeof(struct geode_aes_op), | ||
359 | .cra_alignmask = 15, | ||
360 | .cra_type = &crypto_blkcipher_type, | ||
361 | .cra_module = THIS_MODULE, | ||
362 | .cra_list = LIST_HEAD_INIT(geode_ecb_alg.cra_list), | ||
363 | .cra_u = { | ||
364 | .blkcipher = { | ||
365 | .min_keysize = AES_KEY_LENGTH, | ||
366 | .max_keysize = AES_KEY_LENGTH, | ||
367 | .setkey = geode_setkey, | ||
368 | .encrypt = geode_ecb_encrypt, | ||
369 | .decrypt = geode_ecb_decrypt, | ||
370 | } | ||
371 | } | ||
372 | }; | ||
373 | |||
374 | static void | ||
375 | geode_aes_remove(struct pci_dev *dev) | ||
376 | { | ||
377 | crypto_unregister_alg(&geode_alg); | ||
378 | crypto_unregister_alg(&geode_ecb_alg); | ||
379 | crypto_unregister_alg(&geode_cbc_alg); | ||
380 | |||
381 | pci_iounmap(dev, _iobase); | ||
382 | _iobase = NULL; | ||
383 | |||
384 | pci_release_regions(dev); | ||
385 | pci_disable_device(dev); | ||
386 | } | ||
387 | |||
388 | |||
389 | static int | ||
390 | geode_aes_probe(struct pci_dev *dev, const struct pci_device_id *id) | ||
391 | { | ||
392 | int ret; | ||
393 | |||
394 | if ((ret = pci_enable_device(dev))) | ||
395 | return ret; | ||
396 | |||
397 | if ((ret = pci_request_regions(dev, "geode-aes-128"))) | ||
398 | goto eenable; | ||
399 | |||
400 | _iobase = pci_iomap(dev, 0, 0); | ||
401 | |||
402 | if (_iobase == NULL) { | ||
403 | ret = -ENOMEM; | ||
404 | goto erequest; | ||
405 | } | ||
406 | |||
407 | spin_lock_init(&lock); | ||
408 | |||
409 | /* Clear any pending activity */ | ||
410 | iowrite32(AES_INTR_PENDING | AES_INTR_MASK, _iobase + AES_INTR_REG); | ||
411 | |||
412 | if ((ret = crypto_register_alg(&geode_alg))) | ||
413 | goto eiomap; | ||
414 | |||
415 | if ((ret = crypto_register_alg(&geode_ecb_alg))) | ||
416 | goto ealg; | ||
417 | |||
418 | if ((ret = crypto_register_alg(&geode_cbc_alg))) | ||
419 | goto eecb; | ||
420 | |||
421 | printk(KERN_NOTICE "geode-aes: GEODE AES engine enabled.\n"); | ||
422 | return 0; | ||
423 | |||
424 | eecb: | ||
425 | crypto_unregister_alg(&geode_ecb_alg); | ||
426 | |||
427 | ealg: | ||
428 | crypto_unregister_alg(&geode_alg); | ||
429 | |||
430 | eiomap: | ||
431 | pci_iounmap(dev, _iobase); | ||
432 | |||
433 | erequest: | ||
434 | pci_release_regions(dev); | ||
435 | |||
436 | eenable: | ||
437 | pci_disable_device(dev); | ||
438 | |||
439 | printk(KERN_ERR "geode-aes: GEODE AES initialization failed.\n"); | ||
440 | return ret; | ||
441 | } | ||
442 | |||
443 | static struct pci_device_id geode_aes_tbl[] = { | ||
444 | { PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_LX_AES, PCI_ANY_ID, PCI_ANY_ID} , | ||
445 | { 0, } | ||
446 | }; | ||
447 | |||
448 | MODULE_DEVICE_TABLE(pci, geode_aes_tbl); | ||
449 | |||
450 | static struct pci_driver geode_aes_driver = { | ||
451 | .name = "Geode LX AES", | ||
452 | .id_table = geode_aes_tbl, | ||
453 | .probe = geode_aes_probe, | ||
454 | .remove = __devexit_p(geode_aes_remove) | ||
455 | }; | ||
456 | |||
457 | static int __init | ||
458 | geode_aes_init(void) | ||
459 | { | ||
460 | return pci_module_init(&geode_aes_driver); | ||
461 | } | ||
462 | |||
463 | static void __exit | ||
464 | geode_aes_exit(void) | ||
465 | { | ||
466 | pci_unregister_driver(&geode_aes_driver); | ||
467 | } | ||
468 | |||
469 | MODULE_AUTHOR("Advanced Micro Devices, Inc."); | ||
470 | MODULE_DESCRIPTION("Geode LX Hardware AES driver"); | ||
471 | MODULE_LICENSE("GPL"); | ||
472 | |||
473 | module_init(geode_aes_init); | ||
474 | module_exit(geode_aes_exit); | ||
diff --git a/drivers/crypto/geode-aes.h b/drivers/crypto/geode-aes.h new file mode 100644 index 000000000000..8003a36f3a83 --- /dev/null +++ b/drivers/crypto/geode-aes.h | |||
@@ -0,0 +1,40 @@ | |||
1 | /* Copyright (C) 2003-2006, Advanced Micro Devices, Inc. | ||
2 | * | ||
3 | * This program is free software; you can redistribute it and/or modify | ||
4 | * it under the terms of the GNU General Public License as published by | ||
5 | * the Free Software Foundation; either version 2 of the License, or | ||
6 | * (at your option) any later version. | ||
7 | */ | ||
8 | |||
9 | #ifndef _GEODE_AES_H_ | ||
10 | #define _GEODE_AES_H_ | ||
11 | |||
12 | #define AES_KEY_LENGTH 16 | ||
13 | #define AES_IV_LENGTH 16 | ||
14 | |||
15 | #define AES_MIN_BLOCK_SIZE 16 | ||
16 | |||
17 | #define AES_MODE_ECB 0 | ||
18 | #define AES_MODE_CBC 1 | ||
19 | |||
20 | #define AES_DIR_DECRYPT 0 | ||
21 | #define AES_DIR_ENCRYPT 1 | ||
22 | |||
23 | #define AES_FLAGS_USRKEY (1 << 0) | ||
24 | #define AES_FLAGS_COHERENT (1 << 1) | ||
25 | |||
26 | struct geode_aes_op { | ||
27 | |||
28 | void *src; | ||
29 | void *dst; | ||
30 | |||
31 | u32 mode; | ||
32 | u32 dir; | ||
33 | u32 flags; | ||
34 | int len; | ||
35 | |||
36 | u8 key[AES_KEY_LENGTH]; | ||
37 | u8 iv[AES_IV_LENGTH]; | ||
38 | }; | ||
39 | |||
40 | #endif | ||
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c index c7bee4f2eedb..a1086ee8cccd 100644 --- a/drivers/md/dm-crypt.c +++ b/drivers/md/dm-crypt.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <asm/atomic.h> | 20 | #include <asm/atomic.h> |
21 | #include <linux/scatterlist.h> | 21 | #include <linux/scatterlist.h> |
22 | #include <asm/page.h> | 22 | #include <asm/page.h> |
23 | #include <asm/unaligned.h> | ||
23 | 24 | ||
24 | #include "dm.h" | 25 | #include "dm.h" |
25 | 26 | ||
@@ -85,7 +86,10 @@ struct crypt_config { | |||
85 | */ | 86 | */ |
86 | struct crypt_iv_operations *iv_gen_ops; | 87 | struct crypt_iv_operations *iv_gen_ops; |
87 | char *iv_mode; | 88 | char *iv_mode; |
88 | struct crypto_cipher *iv_gen_private; | 89 | union { |
90 | struct crypto_cipher *essiv_tfm; | ||
91 | int benbi_shift; | ||
92 | } iv_gen_private; | ||
89 | sector_t iv_offset; | 93 | sector_t iv_offset; |
90 | unsigned int iv_size; | 94 | unsigned int iv_size; |
91 | 95 | ||
@@ -113,6 +117,9 @@ static struct kmem_cache *_crypt_io_pool; | |||
113 | * encrypted with the bulk cipher using a salt as key. The salt | 117 | * encrypted with the bulk cipher using a salt as key. The salt |
114 | * should be derived from the bulk cipher's key via hashing. | 118 | * should be derived from the bulk cipher's key via hashing. |
115 | * | 119 | * |
120 | * benbi: the 64-bit "big-endian 'narrow block'-count", starting at 1 | ||
121 | * (needed for LRW-32-AES and possible other narrow block modes) | ||
122 | * | ||
116 | * plumb: unimplemented, see: | 123 | * plumb: unimplemented, see: |
117 | * http://article.gmane.org/gmane.linux.kernel.device-mapper.dm-crypt/454 | 124 | * http://article.gmane.org/gmane.linux.kernel.device-mapper.dm-crypt/454 |
118 | */ | 125 | */ |
@@ -191,21 +198,61 @@ static int crypt_iv_essiv_ctr(struct crypt_config *cc, struct dm_target *ti, | |||
191 | } | 198 | } |
192 | kfree(salt); | 199 | kfree(salt); |
193 | 200 | ||
194 | cc->iv_gen_private = essiv_tfm; | 201 | cc->iv_gen_private.essiv_tfm = essiv_tfm; |
195 | return 0; | 202 | return 0; |
196 | } | 203 | } |
197 | 204 | ||
198 | static void crypt_iv_essiv_dtr(struct crypt_config *cc) | 205 | static void crypt_iv_essiv_dtr(struct crypt_config *cc) |
199 | { | 206 | { |
200 | crypto_free_cipher(cc->iv_gen_private); | 207 | crypto_free_cipher(cc->iv_gen_private.essiv_tfm); |
201 | cc->iv_gen_private = NULL; | 208 | cc->iv_gen_private.essiv_tfm = NULL; |
202 | } | 209 | } |
203 | 210 | ||
204 | static int crypt_iv_essiv_gen(struct crypt_config *cc, u8 *iv, sector_t sector) | 211 | static int crypt_iv_essiv_gen(struct crypt_config *cc, u8 *iv, sector_t sector) |
205 | { | 212 | { |
206 | memset(iv, 0, cc->iv_size); | 213 | memset(iv, 0, cc->iv_size); |
207 | *(u64 *)iv = cpu_to_le64(sector); | 214 | *(u64 *)iv = cpu_to_le64(sector); |
208 | crypto_cipher_encrypt_one(cc->iv_gen_private, iv, iv); | 215 | crypto_cipher_encrypt_one(cc->iv_gen_private.essiv_tfm, iv, iv); |
216 | return 0; | ||
217 | } | ||
218 | |||
219 | static int crypt_iv_benbi_ctr(struct crypt_config *cc, struct dm_target *ti, | ||
220 | const char *opts) | ||
221 | { | ||
222 | unsigned int bs = crypto_blkcipher_blocksize(cc->tfm); | ||
223 | int log = long_log2(bs); | ||
224 | |||
225 | /* we need to calculate how far we must shift the sector count | ||
226 | * to get the cipher block count, we use this shift in _gen */ | ||
227 | |||
228 | if (1 << log != bs) { | ||
229 | ti->error = "cypher blocksize is not a power of 2"; | ||
230 | return -EINVAL; | ||
231 | } | ||
232 | |||
233 | if (log > 9) { | ||
234 | ti->error = "cypher blocksize is > 512"; | ||
235 | return -EINVAL; | ||
236 | } | ||
237 | |||
238 | cc->iv_gen_private.benbi_shift = 9 - log; | ||
239 | |||
240 | return 0; | ||
241 | } | ||
242 | |||
243 | static void crypt_iv_benbi_dtr(struct crypt_config *cc) | ||
244 | { | ||
245 | } | ||
246 | |||
247 | static int crypt_iv_benbi_gen(struct crypt_config *cc, u8 *iv, sector_t sector) | ||
248 | { | ||
249 | __be64 val; | ||
250 | |||
251 | memset(iv, 0, cc->iv_size - sizeof(u64)); /* rest is cleared below */ | ||
252 | |||
253 | val = cpu_to_be64(((u64)sector << cc->iv_gen_private.benbi_shift) + 1); | ||
254 | put_unaligned(val, (__be64 *)(iv + cc->iv_size - sizeof(u64))); | ||
255 | |||
209 | return 0; | 256 | return 0; |
210 | } | 257 | } |
211 | 258 | ||
@@ -219,13 +266,18 @@ static struct crypt_iv_operations crypt_iv_essiv_ops = { | |||
219 | .generator = crypt_iv_essiv_gen | 266 | .generator = crypt_iv_essiv_gen |
220 | }; | 267 | }; |
221 | 268 | ||
269 | static struct crypt_iv_operations crypt_iv_benbi_ops = { | ||
270 | .ctr = crypt_iv_benbi_ctr, | ||
271 | .dtr = crypt_iv_benbi_dtr, | ||
272 | .generator = crypt_iv_benbi_gen | ||
273 | }; | ||
222 | 274 | ||
223 | static int | 275 | static int |
224 | crypt_convert_scatterlist(struct crypt_config *cc, struct scatterlist *out, | 276 | crypt_convert_scatterlist(struct crypt_config *cc, struct scatterlist *out, |
225 | struct scatterlist *in, unsigned int length, | 277 | struct scatterlist *in, unsigned int length, |
226 | int write, sector_t sector) | 278 | int write, sector_t sector) |
227 | { | 279 | { |
228 | u8 iv[cc->iv_size]; | 280 | u8 iv[cc->iv_size] __attribute__ ((aligned(__alignof__(u64)))); |
229 | struct blkcipher_desc desc = { | 281 | struct blkcipher_desc desc = { |
230 | .tfm = cc->tfm, | 282 | .tfm = cc->tfm, |
231 | .info = iv, | 283 | .info = iv, |
@@ -768,7 +820,7 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv) | |||
768 | cc->tfm = tfm; | 820 | cc->tfm = tfm; |
769 | 821 | ||
770 | /* | 822 | /* |
771 | * Choose ivmode. Valid modes: "plain", "essiv:<esshash>". | 823 | * Choose ivmode. Valid modes: "plain", "essiv:<esshash>", "benbi". |
772 | * See comments at iv code | 824 | * See comments at iv code |
773 | */ | 825 | */ |
774 | 826 | ||
@@ -778,6 +830,8 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv) | |||
778 | cc->iv_gen_ops = &crypt_iv_plain_ops; | 830 | cc->iv_gen_ops = &crypt_iv_plain_ops; |
779 | else if (strcmp(ivmode, "essiv") == 0) | 831 | else if (strcmp(ivmode, "essiv") == 0) |
780 | cc->iv_gen_ops = &crypt_iv_essiv_ops; | 832 | cc->iv_gen_ops = &crypt_iv_essiv_ops; |
833 | else if (strcmp(ivmode, "benbi") == 0) | ||
834 | cc->iv_gen_ops = &crypt_iv_benbi_ops; | ||
781 | else { | 835 | else { |
782 | ti->error = "Invalid IV mode"; | 836 | ti->error = "Invalid IV mode"; |
783 | goto bad2; | 837 | goto bad2; |
diff --git a/drivers/net/irda/pxaficp_ir.c b/drivers/net/irda/pxaficp_ir.c index f9a1c88a4283..9137e239fac2 100644 --- a/drivers/net/irda/pxaficp_ir.c +++ b/drivers/net/irda/pxaficp_ir.c | |||
@@ -704,9 +704,9 @@ static int pxa_irda_stop(struct net_device *dev) | |||
704 | return 0; | 704 | return 0; |
705 | } | 705 | } |
706 | 706 | ||
707 | static int pxa_irda_suspend(struct device *_dev, pm_message_t state) | 707 | static int pxa_irda_suspend(struct platform_device *_dev, pm_message_t state) |
708 | { | 708 | { |
709 | struct net_device *dev = dev_get_drvdata(_dev); | 709 | struct net_device *dev = platform_get_drvdata(_dev); |
710 | struct pxa_irda *si; | 710 | struct pxa_irda *si; |
711 | 711 | ||
712 | if (dev && netif_running(dev)) { | 712 | if (dev && netif_running(dev)) { |
@@ -718,9 +718,9 @@ static int pxa_irda_suspend(struct device *_dev, pm_message_t state) | |||
718 | return 0; | 718 | return 0; |
719 | } | 719 | } |
720 | 720 | ||
721 | static int pxa_irda_resume(struct device *_dev) | 721 | static int pxa_irda_resume(struct platform_device *_dev) |
722 | { | 722 | { |
723 | struct net_device *dev = dev_get_drvdata(_dev); | 723 | struct net_device *dev = platform_get_drvdata(_dev); |
724 | struct pxa_irda *si; | 724 | struct pxa_irda *si; |
725 | 725 | ||
726 | if (dev && netif_running(dev)) { | 726 | if (dev && netif_running(dev)) { |
@@ -746,9 +746,8 @@ static int pxa_irda_init_iobuf(iobuff_t *io, int size) | |||
746 | return io->head ? 0 : -ENOMEM; | 746 | return io->head ? 0 : -ENOMEM; |
747 | } | 747 | } |
748 | 748 | ||
749 | static int pxa_irda_probe(struct device *_dev) | 749 | static int pxa_irda_probe(struct platform_device *pdev) |
750 | { | 750 | { |
751 | struct platform_device *pdev = to_platform_device(_dev); | ||
752 | struct net_device *dev; | 751 | struct net_device *dev; |
753 | struct pxa_irda *si; | 752 | struct pxa_irda *si; |
754 | unsigned int baudrate_mask; | 753 | unsigned int baudrate_mask; |
@@ -822,9 +821,9 @@ err_mem_1: | |||
822 | return err; | 821 | return err; |
823 | } | 822 | } |
824 | 823 | ||
825 | static int pxa_irda_remove(struct device *_dev) | 824 | static int pxa_irda_remove(struct platform_device *_dev) |
826 | { | 825 | { |
827 | struct net_device *dev = dev_get_drvdata(_dev); | 826 | struct net_device *dev = platform_get_drvdata(_dev); |
828 | 827 | ||
829 | if (dev) { | 828 | if (dev) { |
830 | struct pxa_irda *si = netdev_priv(dev); | 829 | struct pxa_irda *si = netdev_priv(dev); |
@@ -840,9 +839,10 @@ static int pxa_irda_remove(struct device *_dev) | |||
840 | return 0; | 839 | return 0; |
841 | } | 840 | } |
842 | 841 | ||
843 | static struct device_driver pxa_ir_driver = { | 842 | static struct platform_driver pxa_ir_driver = { |
844 | .name = "pxa2xx-ir", | 843 | .driver = { |
845 | .bus = &platform_bus_type, | 844 | .name = "pxa2xx-ir", |
845 | }, | ||
846 | .probe = pxa_irda_probe, | 846 | .probe = pxa_irda_probe, |
847 | .remove = pxa_irda_remove, | 847 | .remove = pxa_irda_remove, |
848 | .suspend = pxa_irda_suspend, | 848 | .suspend = pxa_irda_suspend, |
@@ -851,12 +851,12 @@ static struct device_driver pxa_ir_driver = { | |||
851 | 851 | ||
852 | static int __init pxa_irda_init(void) | 852 | static int __init pxa_irda_init(void) |
853 | { | 853 | { |
854 | return driver_register(&pxa_ir_driver); | 854 | return platform_driver_register(&pxa_ir_driver); |
855 | } | 855 | } |
856 | 856 | ||
857 | static void __exit pxa_irda_exit(void) | 857 | static void __exit pxa_irda_exit(void) |
858 | { | 858 | { |
859 | driver_unregister(&pxa_ir_driver); | 859 | platform_driver_unregister(&pxa_ir_driver); |
860 | } | 860 | } |
861 | 861 | ||
862 | module_init(pxa_irda_init); | 862 | module_init(pxa_irda_init); |
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index d9123c9adc1e..571320ae87ab 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c | |||
@@ -68,8 +68,8 @@ | |||
68 | 68 | ||
69 | #define DRV_MODULE_NAME "tg3" | 69 | #define DRV_MODULE_NAME "tg3" |
70 | #define PFX DRV_MODULE_NAME ": " | 70 | #define PFX DRV_MODULE_NAME ": " |
71 | #define DRV_MODULE_VERSION "3.69" | 71 | #define DRV_MODULE_VERSION "3.70" |
72 | #define DRV_MODULE_RELDATE "November 15, 2006" | 72 | #define DRV_MODULE_RELDATE "December 1, 2006" |
73 | 73 | ||
74 | #define TG3_DEF_MAC_MODE 0 | 74 | #define TG3_DEF_MAC_MODE 0 |
75 | #define TG3_DEF_RX_MODE 0 | 75 | #define TG3_DEF_RX_MODE 0 |
@@ -192,6 +192,7 @@ static struct pci_device_id tg3_pci_tbl[] = { | |||
192 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5786)}, | 192 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5786)}, |
193 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5787)}, | 193 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5787)}, |
194 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5787M)}, | 194 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5787M)}, |
195 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5787F)}, | ||
195 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5714)}, | 196 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5714)}, |
196 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5714S)}, | 197 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5714S)}, |
197 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5715)}, | 198 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5715)}, |
@@ -1061,7 +1062,7 @@ static void tg3_frob_aux_power(struct tg3 *tp) | |||
1061 | { | 1062 | { |
1062 | struct tg3 *tp_peer = tp; | 1063 | struct tg3 *tp_peer = tp; |
1063 | 1064 | ||
1064 | if ((tp->tg3_flags & TG3_FLAG_EEPROM_WRITE_PROT) != 0) | 1065 | if ((tp->tg3_flags2 & TG3_FLG2_IS_NIC) == 0) |
1065 | return; | 1066 | return; |
1066 | 1067 | ||
1067 | if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) || | 1068 | if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) || |
@@ -1212,8 +1213,8 @@ static int tg3_set_power_state(struct tg3 *tp, pci_power_t state) | |||
1212 | power_control); | 1213 | power_control); |
1213 | udelay(100); /* Delay after power state change */ | 1214 | udelay(100); /* Delay after power state change */ |
1214 | 1215 | ||
1215 | /* Switch out of Vaux if it is not a LOM */ | 1216 | /* Switch out of Vaux if it is a NIC */ |
1216 | if (!(tp->tg3_flags & TG3_FLAG_EEPROM_WRITE_PROT)) | 1217 | if (tp->tg3_flags2 & TG3_FLG2_IS_NIC) |
1217 | tw32_wait_f(GRC_LOCAL_CTRL, tp->grc_local_ctrl, 100); | 1218 | tw32_wait_f(GRC_LOCAL_CTRL, tp->grc_local_ctrl, 100); |
1218 | 1219 | ||
1219 | return 0; | 1220 | return 0; |
@@ -1401,8 +1402,10 @@ static int tg3_set_power_state(struct tg3 *tp, pci_power_t state) | |||
1401 | static void tg3_link_report(struct tg3 *tp) | 1402 | static void tg3_link_report(struct tg3 *tp) |
1402 | { | 1403 | { |
1403 | if (!netif_carrier_ok(tp->dev)) { | 1404 | if (!netif_carrier_ok(tp->dev)) { |
1404 | printk(KERN_INFO PFX "%s: Link is down.\n", tp->dev->name); | 1405 | if (netif_msg_link(tp)) |
1405 | } else { | 1406 | printk(KERN_INFO PFX "%s: Link is down.\n", |
1407 | tp->dev->name); | ||
1408 | } else if (netif_msg_link(tp)) { | ||
1406 | printk(KERN_INFO PFX "%s: Link is up at %d Mbps, %s duplex.\n", | 1409 | printk(KERN_INFO PFX "%s: Link is up at %d Mbps, %s duplex.\n", |
1407 | tp->dev->name, | 1410 | tp->dev->name, |
1408 | (tp->link_config.active_speed == SPEED_1000 ? | 1411 | (tp->link_config.active_speed == SPEED_1000 ? |
@@ -1557,12 +1560,6 @@ static void tg3_phy_copper_begin(struct tg3 *tp) | |||
1557 | 1560 | ||
1558 | tg3_writephy(tp, MII_ADVERTISE, new_adv); | 1561 | tg3_writephy(tp, MII_ADVERTISE, new_adv); |
1559 | } else if (tp->link_config.speed == SPEED_INVALID) { | 1562 | } else if (tp->link_config.speed == SPEED_INVALID) { |
1560 | tp->link_config.advertising = | ||
1561 | (ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full | | ||
1562 | ADVERTISED_100baseT_Half | ADVERTISED_100baseT_Full | | ||
1563 | ADVERTISED_1000baseT_Half | ADVERTISED_1000baseT_Full | | ||
1564 | ADVERTISED_Autoneg | ADVERTISED_MII); | ||
1565 | |||
1566 | if (tp->tg3_flags & TG3_FLAG_10_100_ONLY) | 1563 | if (tp->tg3_flags & TG3_FLAG_10_100_ONLY) |
1567 | tp->link_config.advertising &= | 1564 | tp->link_config.advertising &= |
1568 | ~(ADVERTISED_1000baseT_Half | | 1565 | ~(ADVERTISED_1000baseT_Half | |
@@ -1706,25 +1703,36 @@ static int tg3_init_5401phy_dsp(struct tg3 *tp) | |||
1706 | return err; | 1703 | return err; |
1707 | } | 1704 | } |
1708 | 1705 | ||
1709 | static int tg3_copper_is_advertising_all(struct tg3 *tp) | 1706 | static int tg3_copper_is_advertising_all(struct tg3 *tp, u32 mask) |
1710 | { | 1707 | { |
1711 | u32 adv_reg, all_mask; | 1708 | u32 adv_reg, all_mask = 0; |
1709 | |||
1710 | if (mask & ADVERTISED_10baseT_Half) | ||
1711 | all_mask |= ADVERTISE_10HALF; | ||
1712 | if (mask & ADVERTISED_10baseT_Full) | ||
1713 | all_mask |= ADVERTISE_10FULL; | ||
1714 | if (mask & ADVERTISED_100baseT_Half) | ||
1715 | all_mask |= ADVERTISE_100HALF; | ||
1716 | if (mask & ADVERTISED_100baseT_Full) | ||
1717 | all_mask |= ADVERTISE_100FULL; | ||
1712 | 1718 | ||
1713 | if (tg3_readphy(tp, MII_ADVERTISE, &adv_reg)) | 1719 | if (tg3_readphy(tp, MII_ADVERTISE, &adv_reg)) |
1714 | return 0; | 1720 | return 0; |
1715 | 1721 | ||
1716 | all_mask = (ADVERTISE_10HALF | ADVERTISE_10FULL | | ||
1717 | ADVERTISE_100HALF | ADVERTISE_100FULL); | ||
1718 | if ((adv_reg & all_mask) != all_mask) | 1722 | if ((adv_reg & all_mask) != all_mask) |
1719 | return 0; | 1723 | return 0; |
1720 | if (!(tp->tg3_flags & TG3_FLAG_10_100_ONLY)) { | 1724 | if (!(tp->tg3_flags & TG3_FLAG_10_100_ONLY)) { |
1721 | u32 tg3_ctrl; | 1725 | u32 tg3_ctrl; |
1722 | 1726 | ||
1727 | all_mask = 0; | ||
1728 | if (mask & ADVERTISED_1000baseT_Half) | ||
1729 | all_mask |= ADVERTISE_1000HALF; | ||
1730 | if (mask & ADVERTISED_1000baseT_Full) | ||
1731 | all_mask |= ADVERTISE_1000FULL; | ||
1732 | |||
1723 | if (tg3_readphy(tp, MII_TG3_CTRL, &tg3_ctrl)) | 1733 | if (tg3_readphy(tp, MII_TG3_CTRL, &tg3_ctrl)) |
1724 | return 0; | 1734 | return 0; |
1725 | 1735 | ||
1726 | all_mask = (MII_TG3_CTRL_ADV_1000_HALF | | ||
1727 | MII_TG3_CTRL_ADV_1000_FULL); | ||
1728 | if ((tg3_ctrl & all_mask) != all_mask) | 1736 | if ((tg3_ctrl & all_mask) != all_mask) |
1729 | return 0; | 1737 | return 0; |
1730 | } | 1738 | } |
@@ -1884,7 +1892,8 @@ static int tg3_setup_copper_phy(struct tg3 *tp, int force_reset) | |||
1884 | /* Force autoneg restart if we are exiting | 1892 | /* Force autoneg restart if we are exiting |
1885 | * low power mode. | 1893 | * low power mode. |
1886 | */ | 1894 | */ |
1887 | if (!tg3_copper_is_advertising_all(tp)) | 1895 | if (!tg3_copper_is_advertising_all(tp, |
1896 | tp->link_config.advertising)) | ||
1888 | current_link_up = 0; | 1897 | current_link_up = 0; |
1889 | } else { | 1898 | } else { |
1890 | current_link_up = 0; | 1899 | current_link_up = 0; |
@@ -3703,8 +3712,9 @@ static void tg3_tx_timeout(struct net_device *dev) | |||
3703 | { | 3712 | { |
3704 | struct tg3 *tp = netdev_priv(dev); | 3713 | struct tg3 *tp = netdev_priv(dev); |
3705 | 3714 | ||
3706 | printk(KERN_ERR PFX "%s: transmit timed out, resetting\n", | 3715 | if (netif_msg_tx_err(tp)) |
3707 | dev->name); | 3716 | printk(KERN_ERR PFX "%s: transmit timed out, resetting\n", |
3717 | dev->name); | ||
3708 | 3718 | ||
3709 | schedule_work(&tp->reset_task); | 3719 | schedule_work(&tp->reset_task); |
3710 | } | 3720 | } |
@@ -6396,16 +6406,17 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy) | |||
6396 | udelay(40); | 6406 | udelay(40); |
6397 | 6407 | ||
6398 | /* tp->grc_local_ctrl is partially set up during tg3_get_invariants(). | 6408 | /* tp->grc_local_ctrl is partially set up during tg3_get_invariants(). |
6399 | * If TG3_FLAG_EEPROM_WRITE_PROT is set, we should read the | 6409 | * If TG3_FLG2_IS_NIC is zero, we should read the |
6400 | * register to preserve the GPIO settings for LOMs. The GPIOs, | 6410 | * register to preserve the GPIO settings for LOMs. The GPIOs, |
6401 | * whether used as inputs or outputs, are set by boot code after | 6411 | * whether used as inputs or outputs, are set by boot code after |
6402 | * reset. | 6412 | * reset. |
6403 | */ | 6413 | */ |
6404 | if (tp->tg3_flags & TG3_FLAG_EEPROM_WRITE_PROT) { | 6414 | if (!(tp->tg3_flags2 & TG3_FLG2_IS_NIC)) { |
6405 | u32 gpio_mask; | 6415 | u32 gpio_mask; |
6406 | 6416 | ||
6407 | gpio_mask = GRC_LCLCTRL_GPIO_OE0 | GRC_LCLCTRL_GPIO_OE2 | | 6417 | gpio_mask = GRC_LCLCTRL_GPIO_OE0 | GRC_LCLCTRL_GPIO_OE1 | |
6408 | GRC_LCLCTRL_GPIO_OUTPUT0 | GRC_LCLCTRL_GPIO_OUTPUT2; | 6418 | GRC_LCLCTRL_GPIO_OE2 | GRC_LCLCTRL_GPIO_OUTPUT0 | |
6419 | GRC_LCLCTRL_GPIO_OUTPUT1 | GRC_LCLCTRL_GPIO_OUTPUT2; | ||
6409 | 6420 | ||
6410 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5752) | 6421 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5752) |
6411 | gpio_mask |= GRC_LCLCTRL_GPIO_OE3 | | 6422 | gpio_mask |= GRC_LCLCTRL_GPIO_OE3 | |
@@ -6417,8 +6428,9 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy) | |||
6417 | tp->grc_local_ctrl |= tr32(GRC_LOCAL_CTRL) & gpio_mask; | 6428 | tp->grc_local_ctrl |= tr32(GRC_LOCAL_CTRL) & gpio_mask; |
6418 | 6429 | ||
6419 | /* GPIO1 must be driven high for eeprom write protect */ | 6430 | /* GPIO1 must be driven high for eeprom write protect */ |
6420 | tp->grc_local_ctrl |= (GRC_LCLCTRL_GPIO_OE1 | | 6431 | if (tp->tg3_flags & TG3_FLAG_EEPROM_WRITE_PROT) |
6421 | GRC_LCLCTRL_GPIO_OUTPUT1); | 6432 | tp->grc_local_ctrl |= (GRC_LCLCTRL_GPIO_OE1 | |
6433 | GRC_LCLCTRL_GPIO_OUTPUT1); | ||
6422 | } | 6434 | } |
6423 | tw32_f(GRC_LOCAL_CTRL, tp->grc_local_ctrl); | 6435 | tw32_f(GRC_LOCAL_CTRL, tp->grc_local_ctrl); |
6424 | udelay(100); | 6436 | udelay(100); |
@@ -8656,7 +8668,9 @@ static int tg3_test_registers(struct tg3 *tp) | |||
8656 | return 0; | 8668 | return 0; |
8657 | 8669 | ||
8658 | out: | 8670 | out: |
8659 | printk(KERN_ERR PFX "Register test failed at offset %x\n", offset); | 8671 | if (netif_msg_hw(tp)) |
8672 | printk(KERN_ERR PFX "Register test failed at offset %x\n", | ||
8673 | offset); | ||
8660 | tw32(offset, save_val); | 8674 | tw32(offset, save_val); |
8661 | return -EIO; | 8675 | return -EIO; |
8662 | } | 8676 | } |
@@ -8781,17 +8795,20 @@ static int tg3_run_loopback(struct tg3 *tp, int loopback_mode) | |||
8781 | tg3_writephy(tp, 0x10, phy & ~0x4000); | 8795 | tg3_writephy(tp, 0x10, phy & ~0x4000); |
8782 | tg3_writephy(tp, MII_TG3_EPHY_TEST, phytest); | 8796 | tg3_writephy(tp, MII_TG3_EPHY_TEST, phytest); |
8783 | } | 8797 | } |
8784 | } | 8798 | val = BMCR_LOOPBACK | BMCR_FULLDPLX | BMCR_SPEED100; |
8785 | val = BMCR_LOOPBACK | BMCR_FULLDPLX; | 8799 | } else |
8786 | if (tp->tg3_flags & TG3_FLAG_10_100_ONLY) | 8800 | val = BMCR_LOOPBACK | BMCR_FULLDPLX | BMCR_SPEED1000; |
8787 | val |= BMCR_SPEED100; | ||
8788 | else | ||
8789 | val |= BMCR_SPEED1000; | ||
8790 | 8801 | ||
8791 | tg3_writephy(tp, MII_BMCR, val); | 8802 | tg3_writephy(tp, MII_BMCR, val); |
8792 | udelay(40); | 8803 | udelay(40); |
8793 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) | 8804 | |
8805 | mac_mode = (tp->mac_mode & ~MAC_MODE_PORT_MODE_MASK) | | ||
8806 | MAC_MODE_LINK_POLARITY; | ||
8807 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) { | ||
8794 | tg3_writephy(tp, MII_TG3_EPHY_PTEST, 0x1800); | 8808 | tg3_writephy(tp, MII_TG3_EPHY_PTEST, 0x1800); |
8809 | mac_mode |= MAC_MODE_PORT_MODE_MII; | ||
8810 | } else | ||
8811 | mac_mode |= MAC_MODE_PORT_MODE_GMII; | ||
8795 | 8812 | ||
8796 | /* reset to prevent losing 1st rx packet intermittently */ | 8813 | /* reset to prevent losing 1st rx packet intermittently */ |
8797 | if (tp->tg3_flags2 & TG3_FLG2_MII_SERDES) { | 8814 | if (tp->tg3_flags2 & TG3_FLG2_MII_SERDES) { |
@@ -8799,12 +8816,6 @@ static int tg3_run_loopback(struct tg3 *tp, int loopback_mode) | |||
8799 | udelay(10); | 8816 | udelay(10); |
8800 | tw32_f(MAC_RX_MODE, tp->rx_mode); | 8817 | tw32_f(MAC_RX_MODE, tp->rx_mode); |
8801 | } | 8818 | } |
8802 | mac_mode = (tp->mac_mode & ~MAC_MODE_PORT_MODE_MASK) | | ||
8803 | MAC_MODE_LINK_POLARITY; | ||
8804 | if (tp->tg3_flags & TG3_FLAG_10_100_ONLY) | ||
8805 | mac_mode |= MAC_MODE_PORT_MODE_MII; | ||
8806 | else | ||
8807 | mac_mode |= MAC_MODE_PORT_MODE_GMII; | ||
8808 | if ((tp->phy_id & PHY_ID_MASK) == PHY_ID_BCM5401) { | 8819 | if ((tp->phy_id & PHY_ID_MASK) == PHY_ID_BCM5401) { |
8809 | mac_mode &= ~MAC_MODE_LINK_POLARITY; | 8820 | mac_mode &= ~MAC_MODE_LINK_POLARITY; |
8810 | tg3_writephy(tp, MII_TG3_EXT_CTRL, | 8821 | tg3_writephy(tp, MII_TG3_EXT_CTRL, |
@@ -9456,16 +9467,12 @@ static void __devinit tg3_get_5906_nvram_info(struct tg3 *tp) | |||
9456 | /* Chips other than 5700/5701 use the NVRAM for fetching info. */ | 9467 | /* Chips other than 5700/5701 use the NVRAM for fetching info. */ |
9457 | static void __devinit tg3_nvram_init(struct tg3 *tp) | 9468 | static void __devinit tg3_nvram_init(struct tg3 *tp) |
9458 | { | 9469 | { |
9459 | int j; | ||
9460 | |||
9461 | tw32_f(GRC_EEPROM_ADDR, | 9470 | tw32_f(GRC_EEPROM_ADDR, |
9462 | (EEPROM_ADDR_FSM_RESET | | 9471 | (EEPROM_ADDR_FSM_RESET | |
9463 | (EEPROM_DEFAULT_CLOCK_PERIOD << | 9472 | (EEPROM_DEFAULT_CLOCK_PERIOD << |
9464 | EEPROM_ADDR_CLKPERD_SHIFT))); | 9473 | EEPROM_ADDR_CLKPERD_SHIFT))); |
9465 | 9474 | ||
9466 | /* XXX schedule_timeout() ... */ | 9475 | msleep(1); |
9467 | for (j = 0; j < 100; j++) | ||
9468 | udelay(10); | ||
9469 | 9476 | ||
9470 | /* Enable seeprom accesses. */ | 9477 | /* Enable seeprom accesses. */ |
9471 | tw32_f(GRC_LOCAL_CTRL, | 9478 | tw32_f(GRC_LOCAL_CTRL, |
@@ -9526,12 +9533,12 @@ static int tg3_nvram_read_using_eeprom(struct tg3 *tp, | |||
9526 | EEPROM_ADDR_ADDR_MASK) | | 9533 | EEPROM_ADDR_ADDR_MASK) | |
9527 | EEPROM_ADDR_READ | EEPROM_ADDR_START); | 9534 | EEPROM_ADDR_READ | EEPROM_ADDR_START); |
9528 | 9535 | ||
9529 | for (i = 0; i < 10000; i++) { | 9536 | for (i = 0; i < 1000; i++) { |
9530 | tmp = tr32(GRC_EEPROM_ADDR); | 9537 | tmp = tr32(GRC_EEPROM_ADDR); |
9531 | 9538 | ||
9532 | if (tmp & EEPROM_ADDR_COMPLETE) | 9539 | if (tmp & EEPROM_ADDR_COMPLETE) |
9533 | break; | 9540 | break; |
9534 | udelay(100); | 9541 | msleep(1); |
9535 | } | 9542 | } |
9536 | if (!(tmp & EEPROM_ADDR_COMPLETE)) | 9543 | if (!(tmp & EEPROM_ADDR_COMPLETE)) |
9537 | return -EBUSY; | 9544 | return -EBUSY; |
@@ -9656,12 +9663,12 @@ static int tg3_nvram_write_block_using_eeprom(struct tg3 *tp, | |||
9656 | EEPROM_ADDR_START | | 9663 | EEPROM_ADDR_START | |
9657 | EEPROM_ADDR_WRITE); | 9664 | EEPROM_ADDR_WRITE); |
9658 | 9665 | ||
9659 | for (j = 0; j < 10000; j++) { | 9666 | for (j = 0; j < 1000; j++) { |
9660 | val = tr32(GRC_EEPROM_ADDR); | 9667 | val = tr32(GRC_EEPROM_ADDR); |
9661 | 9668 | ||
9662 | if (val & EEPROM_ADDR_COMPLETE) | 9669 | if (val & EEPROM_ADDR_COMPLETE) |
9663 | break; | 9670 | break; |
9664 | udelay(100); | 9671 | msleep(1); |
9665 | } | 9672 | } |
9666 | if (!(val & EEPROM_ADDR_COMPLETE)) { | 9673 | if (!(val & EEPROM_ADDR_COMPLETE)) { |
9667 | rc = -EBUSY; | 9674 | rc = -EBUSY; |
@@ -9965,8 +9972,10 @@ static void __devinit tg3_get_eeprom_hw_cfg(struct tg3 *tp) | |||
9965 | tp->tg3_flags |= TG3_FLAG_EEPROM_WRITE_PROT; | 9972 | tp->tg3_flags |= TG3_FLAG_EEPROM_WRITE_PROT; |
9966 | 9973 | ||
9967 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) { | 9974 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) { |
9968 | if (!(tr32(PCIE_TRANSACTION_CFG) & PCIE_TRANS_CFG_LOM)) | 9975 | if (!(tr32(PCIE_TRANSACTION_CFG) & PCIE_TRANS_CFG_LOM)) { |
9969 | tp->tg3_flags &= ~TG3_FLAG_EEPROM_WRITE_PROT; | 9976 | tp->tg3_flags &= ~TG3_FLAG_EEPROM_WRITE_PROT; |
9977 | tp->tg3_flags2 |= TG3_FLG2_IS_NIC; | ||
9978 | } | ||
9970 | return; | 9979 | return; |
9971 | } | 9980 | } |
9972 | 9981 | ||
@@ -10066,10 +10075,17 @@ static void __devinit tg3_get_eeprom_hw_cfg(struct tg3 *tp) | |||
10066 | tp->pdev->subsystem_vendor == PCI_VENDOR_ID_DELL) | 10075 | tp->pdev->subsystem_vendor == PCI_VENDOR_ID_DELL) |
10067 | tp->led_ctrl = LED_CTRL_MODE_PHY_2; | 10076 | tp->led_ctrl = LED_CTRL_MODE_PHY_2; |
10068 | 10077 | ||
10069 | if (nic_cfg & NIC_SRAM_DATA_CFG_EEPROM_WP) | 10078 | if (nic_cfg & NIC_SRAM_DATA_CFG_EEPROM_WP) { |
10070 | tp->tg3_flags |= TG3_FLAG_EEPROM_WRITE_PROT; | 10079 | tp->tg3_flags |= TG3_FLAG_EEPROM_WRITE_PROT; |
10071 | else | 10080 | if ((tp->pdev->subsystem_vendor == |
10081 | PCI_VENDOR_ID_ARIMA) && | ||
10082 | (tp->pdev->subsystem_device == 0x205a || | ||
10083 | tp->pdev->subsystem_device == 0x2063)) | ||
10084 | tp->tg3_flags &= ~TG3_FLAG_EEPROM_WRITE_PROT; | ||
10085 | } else { | ||
10072 | tp->tg3_flags &= ~TG3_FLAG_EEPROM_WRITE_PROT; | 10086 | tp->tg3_flags &= ~TG3_FLAG_EEPROM_WRITE_PROT; |
10087 | tp->tg3_flags2 |= TG3_FLG2_IS_NIC; | ||
10088 | } | ||
10073 | 10089 | ||
10074 | if (nic_cfg & NIC_SRAM_DATA_CFG_ASF_ENABLE) { | 10090 | if (nic_cfg & NIC_SRAM_DATA_CFG_ASF_ENABLE) { |
10075 | tp->tg3_flags |= TG3_FLAG_ENABLE_ASF; | 10091 | tp->tg3_flags |= TG3_FLAG_ENABLE_ASF; |
@@ -10147,7 +10163,7 @@ static int __devinit tg3_phy_probe(struct tg3 *tp) | |||
10147 | 10163 | ||
10148 | if (!(tp->tg3_flags2 & TG3_FLG2_ANY_SERDES) && | 10164 | if (!(tp->tg3_flags2 & TG3_FLG2_ANY_SERDES) && |
10149 | !(tp->tg3_flags & TG3_FLAG_ENABLE_ASF)) { | 10165 | !(tp->tg3_flags & TG3_FLAG_ENABLE_ASF)) { |
10150 | u32 bmsr, adv_reg, tg3_ctrl; | 10166 | u32 bmsr, adv_reg, tg3_ctrl, mask; |
10151 | 10167 | ||
10152 | tg3_readphy(tp, MII_BMSR, &bmsr); | 10168 | tg3_readphy(tp, MII_BMSR, &bmsr); |
10153 | if (!tg3_readphy(tp, MII_BMSR, &bmsr) && | 10169 | if (!tg3_readphy(tp, MII_BMSR, &bmsr) && |
@@ -10171,7 +10187,10 @@ static int __devinit tg3_phy_probe(struct tg3 *tp) | |||
10171 | MII_TG3_CTRL_ENABLE_AS_MASTER); | 10187 | MII_TG3_CTRL_ENABLE_AS_MASTER); |
10172 | } | 10188 | } |
10173 | 10189 | ||
10174 | if (!tg3_copper_is_advertising_all(tp)) { | 10190 | mask = (ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full | |
10191 | ADVERTISED_100baseT_Half | ADVERTISED_100baseT_Full | | ||
10192 | ADVERTISED_1000baseT_Half | ADVERTISED_1000baseT_Full); | ||
10193 | if (!tg3_copper_is_advertising_all(tp, mask)) { | ||
10175 | tg3_writephy(tp, MII_ADVERTISE, adv_reg); | 10194 | tg3_writephy(tp, MII_ADVERTISE, adv_reg); |
10176 | 10195 | ||
10177 | if (!(tp->tg3_flags & TG3_FLAG_10_100_ONLY)) | 10196 | if (!(tp->tg3_flags & TG3_FLAG_10_100_ONLY)) |
@@ -10695,7 +10714,7 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) | |||
10695 | tp->tg3_flags |= TG3_FLAG_SRAM_USE_CONFIG; | 10714 | tp->tg3_flags |= TG3_FLAG_SRAM_USE_CONFIG; |
10696 | 10715 | ||
10697 | /* Get eeprom hw config before calling tg3_set_power_state(). | 10716 | /* Get eeprom hw config before calling tg3_set_power_state(). |
10698 | * In particular, the TG3_FLAG_EEPROM_WRITE_PROT flag must be | 10717 | * In particular, the TG3_FLG2_IS_NIC flag must be |
10699 | * determined before calling tg3_set_power_state() so that | 10718 | * determined before calling tg3_set_power_state() so that |
10700 | * we know whether or not to switch out of Vaux power. | 10719 | * we know whether or not to switch out of Vaux power. |
10701 | * When the flag is set, it means that GPIO1 is used for eeprom | 10720 | * When the flag is set, it means that GPIO1 is used for eeprom |
@@ -10862,7 +10881,8 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) | |||
10862 | tp->pdev->device == PCI_DEVICE_ID_TIGON3_5705F)) || | 10881 | tp->pdev->device == PCI_DEVICE_ID_TIGON3_5705F)) || |
10863 | (tp->pdev->vendor == PCI_VENDOR_ID_BROADCOM && | 10882 | (tp->pdev->vendor == PCI_VENDOR_ID_BROADCOM && |
10864 | (tp->pdev->device == PCI_DEVICE_ID_TIGON3_5751F || | 10883 | (tp->pdev->device == PCI_DEVICE_ID_TIGON3_5751F || |
10865 | tp->pdev->device == PCI_DEVICE_ID_TIGON3_5753F)) || | 10884 | tp->pdev->device == PCI_DEVICE_ID_TIGON3_5753F || |
10885 | tp->pdev->device == PCI_DEVICE_ID_TIGON3_5787F)) || | ||
10866 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) | 10886 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) |
10867 | tp->tg3_flags |= TG3_FLAG_10_100_ONLY; | 10887 | tp->tg3_flags |= TG3_FLAG_10_100_ONLY; |
10868 | 10888 | ||
@@ -11912,13 +11932,15 @@ static int __devinit tg3_init_one(struct pci_dev *pdev, | |||
11912 | 11932 | ||
11913 | pci_set_drvdata(pdev, dev); | 11933 | pci_set_drvdata(pdev, dev); |
11914 | 11934 | ||
11915 | printk(KERN_INFO "%s: Tigon3 [partno(%s) rev %04x PHY(%s)] (%s) %sBaseT Ethernet ", | 11935 | printk(KERN_INFO "%s: Tigon3 [partno(%s) rev %04x PHY(%s)] (%s) %s Ethernet ", |
11916 | dev->name, | 11936 | dev->name, |
11917 | tp->board_part_number, | 11937 | tp->board_part_number, |
11918 | tp->pci_chip_rev_id, | 11938 | tp->pci_chip_rev_id, |
11919 | tg3_phy_string(tp), | 11939 | tg3_phy_string(tp), |
11920 | tg3_bus_string(tp, str), | 11940 | tg3_bus_string(tp, str), |
11921 | (tp->tg3_flags & TG3_FLAG_10_100_ONLY) ? "10/100" : "10/100/1000"); | 11941 | ((tp->tg3_flags & TG3_FLAG_10_100_ONLY) ? "10/100Base-TX" : |
11942 | ((tp->tg3_flags2 & TG3_FLG2_ANY_SERDES) ? "1000Base-SX" : | ||
11943 | "10/100/1000Base-T"))); | ||
11922 | 11944 | ||
11923 | for (i = 0; i < 6; i++) | 11945 | for (i = 0; i < 6; i++) |
11924 | printk("%2.2x%c", dev->dev_addr[i], | 11946 | printk("%2.2x%c", dev->dev_addr[i], |
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h index 92f53000bce6..dfaf4ed127bd 100644 --- a/drivers/net/tg3.h +++ b/drivers/net/tg3.h | |||
@@ -2233,6 +2233,7 @@ struct tg3 { | |||
2233 | #define TG3_FLG2_PCI_EXPRESS 0x00000200 | 2233 | #define TG3_FLG2_PCI_EXPRESS 0x00000200 |
2234 | #define TG3_FLG2_ASF_NEW_HANDSHAKE 0x00000400 | 2234 | #define TG3_FLG2_ASF_NEW_HANDSHAKE 0x00000400 |
2235 | #define TG3_FLG2_HW_AUTONEG 0x00000800 | 2235 | #define TG3_FLG2_HW_AUTONEG 0x00000800 |
2236 | #define TG3_FLG2_IS_NIC 0x00001000 | ||
2236 | #define TG3_FLG2_PHY_SERDES 0x00002000 | 2237 | #define TG3_FLG2_PHY_SERDES 0x00002000 |
2237 | #define TG3_FLG2_CAPACITIVE_COUPLING 0x00004000 | 2238 | #define TG3_FLG2_CAPACITIVE_COUPLING 0x00004000 |
2238 | #define TG3_FLG2_FLASH 0x00008000 | 2239 | #define TG3_FLG2_FLASH 0x00008000 |