diff options
author | David S. Miller <davem@davemloft.net> | 2010-05-03 18:45:52 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-05-03 18:45:52 -0400 |
commit | 0f7ca5917e989c4f77db3e97f92badaf3266d4dc (patch) | |
tree | 0f29c4d45870c7d6317ff768c751aebf0948098a /drivers/net | |
parent | a2f3be17c07ad9bd45ab300f79642ecb39cfb553 (diff) | |
parent | d05070091849015f8c5b7d55cd75b86ebb61b3ec (diff) |
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/phy/Kconfig | 5 | ||||
-rw-r--r-- | drivers/net/phy/Makefile | 1 | ||||
-rw-r--r-- | drivers/net/phy/micrel.c | 104 | ||||
-rw-r--r-- | drivers/net/ppp_generic.c | 34 | ||||
-rw-r--r-- | drivers/net/usb/dm9601.c | 2 |
5 files changed, 133 insertions, 13 deletions
diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig index fc5938ba3d78..a527e37728cd 100644 --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig | |||
@@ -88,6 +88,11 @@ config LSI_ET1011C_PHY | |||
88 | ---help--- | 88 | ---help--- |
89 | Supports the LSI ET1011C PHY. | 89 | Supports the LSI ET1011C PHY. |
90 | 90 | ||
91 | config MICREL_PHY | ||
92 | tristate "Driver for Micrel PHYs" | ||
93 | ---help--- | ||
94 | Supports the KSZ9021, VSC8201, KS8001 PHYs. | ||
95 | |||
91 | config FIXED_PHY | 96 | config FIXED_PHY |
92 | bool "Driver for MDIO Bus/PHY emulation with fixed speed/link PHYs" | 97 | bool "Driver for MDIO Bus/PHY emulation with fixed speed/link PHYs" |
93 | depends on PHYLIB=y | 98 | depends on PHYLIB=y |
diff --git a/drivers/net/phy/Makefile b/drivers/net/phy/Makefile index 1342585af381..13bebab65d02 100644 --- a/drivers/net/phy/Makefile +++ b/drivers/net/phy/Makefile | |||
@@ -20,4 +20,5 @@ obj-$(CONFIG_MDIO_BITBANG) += mdio-bitbang.o | |||
20 | obj-$(CONFIG_MDIO_GPIO) += mdio-gpio.o | 20 | obj-$(CONFIG_MDIO_GPIO) += mdio-gpio.o |
21 | obj-$(CONFIG_NATIONAL_PHY) += national.o | 21 | obj-$(CONFIG_NATIONAL_PHY) += national.o |
22 | obj-$(CONFIG_STE10XP) += ste10Xp.o | 22 | obj-$(CONFIG_STE10XP) += ste10Xp.o |
23 | obj-$(CONFIG_MICREL_PHY) += micrel.o | ||
23 | obj-$(CONFIG_MDIO_OCTEON) += mdio-octeon.o | 24 | obj-$(CONFIG_MDIO_OCTEON) += mdio-octeon.o |
diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c new file mode 100644 index 000000000000..0cd80e4d71d9 --- /dev/null +++ b/drivers/net/phy/micrel.c | |||
@@ -0,0 +1,104 @@ | |||
1 | /* | ||
2 | * drivers/net/phy/micrel.c | ||
3 | * | ||
4 | * Driver for Micrel PHYs | ||
5 | * | ||
6 | * Author: David J. Choi | ||
7 | * | ||
8 | * Copyright (c) 2010 Micrel, Inc. | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify it | ||
11 | * under the terms of the GNU General Public License as published by the | ||
12 | * Free Software Foundation; either version 2 of the License, or (at your | ||
13 | * option) any later version. | ||
14 | * | ||
15 | * Support : ksz9021 , vsc8201, ks8001 | ||
16 | */ | ||
17 | |||
18 | #include <linux/kernel.h> | ||
19 | #include <linux/module.h> | ||
20 | #include <linux/phy.h> | ||
21 | |||
22 | #define PHY_ID_KSZ9021 0x00221611 | ||
23 | #define PHY_ID_VSC8201 0x000FC413 | ||
24 | #define PHY_ID_KS8001 0x0022161A | ||
25 | |||
26 | |||
27 | static int kszphy_config_init(struct phy_device *phydev) | ||
28 | { | ||
29 | return 0; | ||
30 | } | ||
31 | |||
32 | |||
33 | static struct phy_driver ks8001_driver = { | ||
34 | .phy_id = PHY_ID_KS8001, | ||
35 | .phy_id_mask = 0x00fffff0, | ||
36 | .features = PHY_BASIC_FEATURES, | ||
37 | .flags = PHY_POLL, | ||
38 | .config_init = kszphy_config_init, | ||
39 | .config_aneg = genphy_config_aneg, | ||
40 | .read_status = genphy_read_status, | ||
41 | .driver = { .owner = THIS_MODULE,}, | ||
42 | }; | ||
43 | |||
44 | static struct phy_driver vsc8201_driver = { | ||
45 | .phy_id = PHY_ID_VSC8201, | ||
46 | .name = "Micrel VSC8201", | ||
47 | .phy_id_mask = 0x00fffff0, | ||
48 | .features = PHY_BASIC_FEATURES, | ||
49 | .flags = PHY_POLL, | ||
50 | .config_init = kszphy_config_init, | ||
51 | .config_aneg = genphy_config_aneg, | ||
52 | .read_status = genphy_read_status, | ||
53 | .driver = { .owner = THIS_MODULE,}, | ||
54 | }; | ||
55 | |||
56 | static struct phy_driver ksz9021_driver = { | ||
57 | .phy_id = PHY_ID_KSZ9021, | ||
58 | .phy_id_mask = 0x000fff10, | ||
59 | .name = "Micrel KSZ9021 Gigabit PHY", | ||
60 | .features = PHY_GBIT_FEATURES | SUPPORTED_Pause, | ||
61 | .flags = PHY_POLL, | ||
62 | .config_init = kszphy_config_init, | ||
63 | .config_aneg = genphy_config_aneg, | ||
64 | .read_status = genphy_read_status, | ||
65 | .driver = { .owner = THIS_MODULE, }, | ||
66 | }; | ||
67 | |||
68 | static int __init ksphy_init(void) | ||
69 | { | ||
70 | int ret; | ||
71 | |||
72 | ret = phy_driver_register(&ks8001_driver); | ||
73 | if (ret) | ||
74 | goto err1; | ||
75 | ret = phy_driver_register(&vsc8201_driver); | ||
76 | if (ret) | ||
77 | goto err2; | ||
78 | |||
79 | ret = phy_driver_register(&ksz9021_driver); | ||
80 | if (ret) | ||
81 | goto err3; | ||
82 | return 0; | ||
83 | |||
84 | err3: | ||
85 | phy_driver_unregister(&vsc8201_driver); | ||
86 | err2: | ||
87 | phy_driver_unregister(&ks8001_driver); | ||
88 | err1: | ||
89 | return ret; | ||
90 | } | ||
91 | |||
92 | static void __exit ksphy_exit(void) | ||
93 | { | ||
94 | phy_driver_unregister(&ks8001_driver); | ||
95 | phy_driver_unregister(&vsc8201_driver); | ||
96 | phy_driver_unregister(&ksz9021_driver); | ||
97 | } | ||
98 | |||
99 | module_init(ksphy_init); | ||
100 | module_exit(ksphy_exit); | ||
101 | |||
102 | MODULE_DESCRIPTION("Micrel PHY driver"); | ||
103 | MODULE_AUTHOR("David J. Choi"); | ||
104 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c index 35f195329fdd..5441688daba7 100644 --- a/drivers/net/ppp_generic.c +++ b/drivers/net/ppp_generic.c | |||
@@ -405,6 +405,7 @@ static ssize_t ppp_read(struct file *file, char __user *buf, | |||
405 | DECLARE_WAITQUEUE(wait, current); | 405 | DECLARE_WAITQUEUE(wait, current); |
406 | ssize_t ret; | 406 | ssize_t ret; |
407 | struct sk_buff *skb = NULL; | 407 | struct sk_buff *skb = NULL; |
408 | struct iovec iov; | ||
408 | 409 | ||
409 | ret = count; | 410 | ret = count; |
410 | 411 | ||
@@ -448,7 +449,9 @@ static ssize_t ppp_read(struct file *file, char __user *buf, | |||
448 | if (skb->len > count) | 449 | if (skb->len > count) |
449 | goto outf; | 450 | goto outf; |
450 | ret = -EFAULT; | 451 | ret = -EFAULT; |
451 | if (copy_to_user(buf, skb->data, skb->len)) | 452 | iov.iov_base = buf; |
453 | iov.iov_len = count; | ||
454 | if (skb_copy_datagram_iovec(skb, 0, &iov, skb->len)) | ||
452 | goto outf; | 455 | goto outf; |
453 | ret = skb->len; | 456 | ret = skb->len; |
454 | 457 | ||
@@ -1567,13 +1570,22 @@ ppp_input(struct ppp_channel *chan, struct sk_buff *skb) | |||
1567 | struct channel *pch = chan->ppp; | 1570 | struct channel *pch = chan->ppp; |
1568 | int proto; | 1571 | int proto; |
1569 | 1572 | ||
1570 | if (!pch || skb->len == 0) { | 1573 | if (!pch) { |
1571 | kfree_skb(skb); | 1574 | kfree_skb(skb); |
1572 | return; | 1575 | return; |
1573 | } | 1576 | } |
1574 | 1577 | ||
1575 | proto = PPP_PROTO(skb); | ||
1576 | read_lock_bh(&pch->upl); | 1578 | read_lock_bh(&pch->upl); |
1579 | if (!pskb_may_pull(skb, 2)) { | ||
1580 | kfree_skb(skb); | ||
1581 | if (pch->ppp) { | ||
1582 | ++pch->ppp->dev->stats.rx_length_errors; | ||
1583 | ppp_receive_error(pch->ppp); | ||
1584 | } | ||
1585 | goto done; | ||
1586 | } | ||
1587 | |||
1588 | proto = PPP_PROTO(skb); | ||
1577 | if (!pch->ppp || proto >= 0xc000 || proto == PPP_CCPFRAG) { | 1589 | if (!pch->ppp || proto >= 0xc000 || proto == PPP_CCPFRAG) { |
1578 | /* put it on the channel queue */ | 1590 | /* put it on the channel queue */ |
1579 | skb_queue_tail(&pch->file.rq, skb); | 1591 | skb_queue_tail(&pch->file.rq, skb); |
@@ -1585,6 +1597,8 @@ ppp_input(struct ppp_channel *chan, struct sk_buff *skb) | |||
1585 | } else { | 1597 | } else { |
1586 | ppp_do_recv(pch->ppp, skb, pch); | 1598 | ppp_do_recv(pch->ppp, skb, pch); |
1587 | } | 1599 | } |
1600 | |||
1601 | done: | ||
1588 | read_unlock_bh(&pch->upl); | 1602 | read_unlock_bh(&pch->upl); |
1589 | } | 1603 | } |
1590 | 1604 | ||
@@ -1617,7 +1631,8 @@ ppp_input_error(struct ppp_channel *chan, int code) | |||
1617 | static void | 1631 | static void |
1618 | ppp_receive_frame(struct ppp *ppp, struct sk_buff *skb, struct channel *pch) | 1632 | ppp_receive_frame(struct ppp *ppp, struct sk_buff *skb, struct channel *pch) |
1619 | { | 1633 | { |
1620 | if (pskb_may_pull(skb, 2)) { | 1634 | /* note: a 0-length skb is used as an error indication */ |
1635 | if (skb->len > 0) { | ||
1621 | #ifdef CONFIG_PPP_MULTILINK | 1636 | #ifdef CONFIG_PPP_MULTILINK |
1622 | /* XXX do channel-level decompression here */ | 1637 | /* XXX do channel-level decompression here */ |
1623 | if (PPP_PROTO(skb) == PPP_MP) | 1638 | if (PPP_PROTO(skb) == PPP_MP) |
@@ -1625,15 +1640,10 @@ ppp_receive_frame(struct ppp *ppp, struct sk_buff *skb, struct channel *pch) | |||
1625 | else | 1640 | else |
1626 | #endif /* CONFIG_PPP_MULTILINK */ | 1641 | #endif /* CONFIG_PPP_MULTILINK */ |
1627 | ppp_receive_nonmp_frame(ppp, skb); | 1642 | ppp_receive_nonmp_frame(ppp, skb); |
1628 | return; | 1643 | } else { |
1644 | kfree_skb(skb); | ||
1645 | ppp_receive_error(ppp); | ||
1629 | } | 1646 | } |
1630 | |||
1631 | if (skb->len > 0) | ||
1632 | /* note: a 0-length skb is used as an error indication */ | ||
1633 | ++ppp->dev->stats.rx_length_errors; | ||
1634 | |||
1635 | kfree_skb(skb); | ||
1636 | ppp_receive_error(ppp); | ||
1637 | } | 1647 | } |
1638 | 1648 | ||
1639 | static void | 1649 | static void |
diff --git a/drivers/net/usb/dm9601.c b/drivers/net/usb/dm9601.c index 291add255246..47634b617107 100644 --- a/drivers/net/usb/dm9601.c +++ b/drivers/net/usb/dm9601.c | |||
@@ -240,7 +240,7 @@ static int dm_write_shared_word(struct usbnet *dev, int phy, u8 reg, __le16 valu | |||
240 | goto out; | 240 | goto out; |
241 | 241 | ||
242 | dm_write_reg(dev, DM_SHARED_ADDR, phy ? (reg | 0x40) : reg); | 242 | dm_write_reg(dev, DM_SHARED_ADDR, phy ? (reg | 0x40) : reg); |
243 | dm_write_reg(dev, DM_SHARED_CTRL, phy ? 0x1c : 0x14); | 243 | dm_write_reg(dev, DM_SHARED_CTRL, phy ? 0x1a : 0x12); |
244 | 244 | ||
245 | for (i = 0; i < DM_TIMEOUT; i++) { | 245 | for (i = 0; i < DM_TIMEOUT; i++) { |
246 | u8 tmp; | 246 | u8 tmp; |