diff options
| -rw-r--r-- | Documentation/powerpc/booting-without-of.txt | 6 | ||||
| -rw-r--r-- | MAINTAINERS | 7 | ||||
| -rw-r--r-- | arch/powerpc/boot/dts/mpc8641_hpcn.dts | 4 | ||||
| -rw-r--r-- | arch/powerpc/sysdev/fsl_soc.c | 9 | ||||
| -rw-r--r-- | drivers/net/Kconfig | 44 | ||||
| -rw-r--r-- | drivers/net/Makefile | 1 | ||||
| -rw-r--r-- | drivers/net/arm/ether3.c | 2 | ||||
| -rw-r--r-- | drivers/net/bfin_mac.c | 1009 | ||||
| -rw-r--r-- | drivers/net/bfin_mac.h | 132 | ||||
| -rw-r--r-- | drivers/net/ehea/ehea.h | 2 | ||||
| -rw-r--r-- | drivers/net/ehea/ehea_main.c | 37 | ||||
| -rw-r--r-- | drivers/net/gianfar.c | 12 | ||||
| -rw-r--r-- | drivers/net/ni5010.c | 6 | ||||
| -rw-r--r-- | drivers/net/ns83820.c | 2 | ||||
| -rw-r--r-- | drivers/net/phy/vitesse.c | 46 | ||||
| -rw-r--r-- | drivers/net/saa9730.c | 9 | ||||
| -rw-r--r-- | drivers/net/tc35815.c | 2 | ||||
| -rw-r--r-- | drivers/net/wireless/ipw2100.c | 6 | ||||
| -rw-r--r-- | drivers/net/wireless/ipw2200.c | 18 | ||||
| -rw-r--r-- | drivers/net/wireless/zd1211rw/zd_usb.c | 2 | ||||
| -rw-r--r-- | include/linux/fsl_devices.h | 1 | ||||
| -rw-r--r-- | net/ieee80211/ieee80211_wx.c | 7 |
22 files changed, 1308 insertions, 56 deletions
diff --git a/Documentation/powerpc/booting-without-of.txt b/Documentation/powerpc/booting-without-of.txt index 0c2434822094..76733a3962f0 100644 --- a/Documentation/powerpc/booting-without-of.txt +++ b/Documentation/powerpc/booting-without-of.txt | |||
| @@ -1250,6 +1250,12 @@ platforms are moved over to use the flattened-device-tree model. | |||
| 1250 | network device. This is used by the bootwrapper to interpret | 1250 | network device. This is used by the bootwrapper to interpret |
| 1251 | MAC addresses passed by the firmware when no information other | 1251 | MAC addresses passed by the firmware when no information other |
| 1252 | than indices is available to associate an address with a device. | 1252 | than indices is available to associate an address with a device. |
| 1253 | - phy-connection-type : a string naming the controller/PHY interface type, | ||
| 1254 | i.e., "mii" (default), "rmii", "gmii", "rgmii", "rgmii-id", "sgmii", | ||
| 1255 | "tbi", or "rtbi". This property is only really needed if the connection | ||
| 1256 | is of type "rgmii-id", as all other connection types are detected by | ||
| 1257 | hardware. | ||
| 1258 | |||
| 1253 | 1259 | ||
| 1254 | Example: | 1260 | Example: |
| 1255 | 1261 | ||
diff --git a/MAINTAINERS b/MAINTAINERS index e78f62f13bac..f6b2665ccb2b 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
| @@ -732,6 +732,13 @@ L: uclinux-dist-devel@blackfin.uclinux.org (subscribers-only) | |||
| 732 | W: http://blackfin.uclinux.org | 732 | W: http://blackfin.uclinux.org |
| 733 | S: Supported | 733 | S: Supported |
| 734 | 734 | ||
| 735 | BLACKFIN EMAC DRIVER | ||
| 736 | P: Bryan Wu | ||
| 737 | M: bryan.wu@analog.com | ||
| 738 | L: uclinux-dist-devel@blackfin.uclinux.org (subscribers-only) | ||
| 739 | W: http://blackfin.uclinux.org | ||
| 740 | S: Supported | ||
| 741 | |||
| 735 | BLACKFIN RTC DRIVER | 742 | BLACKFIN RTC DRIVER |
| 736 | P: Mike Frysinger | 743 | P: Mike Frysinger |
| 737 | M: michael.frysinger@analog.com | 744 | M: michael.frysinger@analog.com |
diff --git a/arch/powerpc/boot/dts/mpc8641_hpcn.dts b/arch/powerpc/boot/dts/mpc8641_hpcn.dts index db56a02b748f..6a78a2b37c08 100644 --- a/arch/powerpc/boot/dts/mpc8641_hpcn.dts +++ b/arch/powerpc/boot/dts/mpc8641_hpcn.dts | |||
| @@ -131,6 +131,7 @@ | |||
| 131 | interrupts = <1d 2 1e 2 22 2>; | 131 | interrupts = <1d 2 1e 2 22 2>; |
| 132 | interrupt-parent = <&mpic>; | 132 | interrupt-parent = <&mpic>; |
| 133 | phy-handle = <&phy0>; | 133 | phy-handle = <&phy0>; |
| 134 | phy-connection-type = "rgmii-id"; | ||
| 134 | }; | 135 | }; |
| 135 | 136 | ||
| 136 | ethernet@25000 { | 137 | ethernet@25000 { |
| @@ -150,6 +151,7 @@ | |||
| 150 | interrupts = <23 2 24 2 28 2>; | 151 | interrupts = <23 2 24 2 28 2>; |
| 151 | interrupt-parent = <&mpic>; | 152 | interrupt-parent = <&mpic>; |
| 152 | phy-handle = <&phy1>; | 153 | phy-handle = <&phy1>; |
| 154 | phy-connection-type = "rgmii-id"; | ||
| 153 | }; | 155 | }; |
| 154 | 156 | ||
| 155 | ethernet@26000 { | 157 | ethernet@26000 { |
| @@ -169,6 +171,7 @@ | |||
| 169 | interrupts = <1F 2 20 2 21 2>; | 171 | interrupts = <1F 2 20 2 21 2>; |
| 170 | interrupt-parent = <&mpic>; | 172 | interrupt-parent = <&mpic>; |
| 171 | phy-handle = <&phy2>; | 173 | phy-handle = <&phy2>; |
| 174 | phy-connection-type = "rgmii-id"; | ||
| 172 | }; | 175 | }; |
| 173 | 176 | ||
| 174 | ethernet@27000 { | 177 | ethernet@27000 { |
| @@ -188,6 +191,7 @@ | |||
| 188 | interrupts = <25 2 26 2 27 2>; | 191 | interrupts = <25 2 26 2 27 2>; |
| 189 | interrupt-parent = <&mpic>; | 192 | interrupt-parent = <&mpic>; |
| 190 | phy-handle = <&phy3>; | 193 | phy-handle = <&phy3>; |
| 194 | phy-connection-type = "rgmii-id"; | ||
| 191 | }; | 195 | }; |
| 192 | serial@4500 { | 196 | serial@4500 { |
| 193 | device_type = "serial"; | 197 | device_type = "serial"; |
diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c index c0ddc80d8160..3289fab01e92 100644 --- a/arch/powerpc/sysdev/fsl_soc.c +++ b/arch/powerpc/sysdev/fsl_soc.c | |||
| @@ -197,6 +197,7 @@ static int __init gfar_of_init(void) | |||
| 197 | struct gianfar_platform_data gfar_data; | 197 | struct gianfar_platform_data gfar_data; |
| 198 | const unsigned int *id; | 198 | const unsigned int *id; |
| 199 | const char *model; | 199 | const char *model; |
| 200 | const char *ctype; | ||
| 200 | const void *mac_addr; | 201 | const void *mac_addr; |
| 201 | const phandle *ph; | 202 | const phandle *ph; |
| 202 | int n_res = 2; | 203 | int n_res = 2; |
| @@ -254,6 +255,14 @@ static int __init gfar_of_init(void) | |||
| 254 | FSL_GIANFAR_DEV_HAS_VLAN | | 255 | FSL_GIANFAR_DEV_HAS_VLAN | |
| 255 | FSL_GIANFAR_DEV_HAS_EXTENDED_HASH; | 256 | FSL_GIANFAR_DEV_HAS_EXTENDED_HASH; |
| 256 | 257 | ||
| 258 | ctype = of_get_property(np, "phy-connection-type", NULL); | ||
| 259 | |||
| 260 | /* We only care about rgmii-id. The rest are autodetected */ | ||
| 261 | if (ctype && !strcmp(ctype, "rgmii-id")) | ||
| 262 | gfar_data.interface = PHY_INTERFACE_MODE_RGMII_ID; | ||
| 263 | else | ||
| 264 | gfar_data.interface = PHY_INTERFACE_MODE_MII; | ||
| 265 | |||
| 257 | ph = of_get_property(np, "phy-handle", NULL); | 266 | ph = of_get_property(np, "phy-handle", NULL); |
| 258 | phy = of_find_node_by_phandle(*ph); | 267 | phy = of_find_node_by_phandle(*ph); |
| 259 | 268 | ||
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 5fb659f8b20e..3073f679584b 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
| @@ -838,6 +838,50 @@ config ULTRA32 | |||
| 838 | <file:Documentation/networking/net-modules.txt>. The module | 838 | <file:Documentation/networking/net-modules.txt>. The module |
| 839 | will be called smc-ultra32. | 839 | will be called smc-ultra32. |
| 840 | 840 | ||
| 841 | config BFIN_MAC | ||
| 842 | tristate "Blackfin 536/537 on-chip mac support" | ||
| 843 | depends on NET_ETHERNET && (BF537 || BF536) && (!BF537_PORT_H) | ||
| 844 | select CRC32 | ||
| 845 | select BFIN_MAC_USE_L1 if DMA_UNCACHED_NONE | ||
| 846 | help | ||
| 847 | This is the driver for blackfin on-chip mac device. Say Y if you want it | ||
| 848 | compiled into the kernel. This driver is also available as a module | ||
| 849 | ( = code which can be inserted in and removed from the running kernel | ||
| 850 | whenever you want). The module will be called bfin_mac. | ||
| 851 | |||
| 852 | config BFIN_MAC_USE_L1 | ||
| 853 | bool "Use L1 memory for rx/tx packets" | ||
| 854 | depends on BFIN_MAC && BF537 | ||
| 855 | default y | ||
| 856 | help | ||
| 857 | To get maximum network performace, you should use L1 memory as rx/tx buffers. | ||
| 858 | Say N here if you want to reserve L1 memory for other uses. | ||
| 859 | |||
| 860 | config BFIN_TX_DESC_NUM | ||
| 861 | int "Number of transmit buffer packets" | ||
| 862 | depends on BFIN_MAC | ||
| 863 | range 6 10 if BFIN_MAC_USE_L1 | ||
| 864 | range 10 100 | ||
| 865 | default "10" | ||
| 866 | help | ||
| 867 | Set the number of buffer packets used in driver. | ||
| 868 | |||
| 869 | config BFIN_RX_DESC_NUM | ||
| 870 | int "Number of receive buffer packets" | ||
| 871 | depends on BFIN_MAC | ||
| 872 | range 20 100 if BFIN_MAC_USE_L1 | ||
| 873 | range 20 800 | ||
| 874 | default "20" | ||
| 875 | help | ||
| 876 | Set the number of buffer packets used in driver. | ||
| 877 | |||
| 878 | config BFIN_MAC_RMII | ||
| 879 | bool "RMII PHY Interface (EXPERIMENTAL)" | ||
| 880 | depends on BFIN_MAC && EXPERIMENTAL | ||
| 881 | default n | ||
| 882 | help | ||
| 883 | Use Reduced PHY MII Interface | ||
| 884 | |||
| 841 | config SMC9194 | 885 | config SMC9194 |
| 842 | tristate "SMC 9194 support" | 886 | tristate "SMC 9194 support" |
| 843 | depends on NET_VENDOR_SMC && (ISA || MAC && BROKEN) | 887 | depends on NET_VENDOR_SMC && (ISA || MAC && BROKEN) |
diff --git a/drivers/net/Makefile b/drivers/net/Makefile index 0e286ab8855a..aaaa0a04bb46 100644 --- a/drivers/net/Makefile +++ b/drivers/net/Makefile | |||
| @@ -200,6 +200,7 @@ obj-$(CONFIG_S2IO) += s2io.o | |||
| 200 | obj-$(CONFIG_MYRI10GE) += myri10ge/ | 200 | obj-$(CONFIG_MYRI10GE) += myri10ge/ |
| 201 | obj-$(CONFIG_SMC91X) += smc91x.o | 201 | obj-$(CONFIG_SMC91X) += smc91x.o |
| 202 | obj-$(CONFIG_SMC911X) += smc911x.o | 202 | obj-$(CONFIG_SMC911X) += smc911x.o |
| 203 | obj-$(CONFIG_BFIN_MAC) += bfin_mac.o | ||
| 203 | obj-$(CONFIG_DM9000) += dm9000.o | 204 | obj-$(CONFIG_DM9000) += dm9000.o |
| 204 | obj-$(CONFIG_FEC_8XX) += fec_8xx/ | 205 | obj-$(CONFIG_FEC_8XX) += fec_8xx/ |
| 205 | obj-$(CONFIG_PASEMI_MAC) += pasemi_mac.o | 206 | obj-$(CONFIG_PASEMI_MAC) += pasemi_mac.o |
diff --git a/drivers/net/arm/ether3.c b/drivers/net/arm/ether3.c index da713500654d..a7cac695a9bd 100644 --- a/drivers/net/arm/ether3.c +++ b/drivers/net/arm/ether3.c | |||
| @@ -464,7 +464,7 @@ static void ether3_setmulticastlist(struct net_device *dev) | |||
| 464 | if (dev->flags & IFF_PROMISC) { | 464 | if (dev->flags & IFF_PROMISC) { |
| 465 | /* promiscuous mode */ | 465 | /* promiscuous mode */ |
| 466 | priv(dev)->regs.config1 |= CFG1_RECVPROMISC; | 466 | priv(dev)->regs.config1 |= CFG1_RECVPROMISC; |
| 467 | } else if (dev->flags & IFF_ALLMULTI) { | 467 | } else if (dev->flags & IFF_ALLMULTI || dev->mc_count) { |
| 468 | priv(dev)->regs.config1 |= CFG1_RECVSPECBRMULTI; | 468 | priv(dev)->regs.config1 |= CFG1_RECVSPECBRMULTI; |
| 469 | } else | 469 | } else |
| 470 | priv(dev)->regs.config1 |= CFG1_RECVSPECBROAD; | 470 | priv(dev)->regs.config1 |= CFG1_RECVSPECBROAD; |
diff --git a/drivers/net/bfin_mac.c b/drivers/net/bfin_mac.c new file mode 100644 index 000000000000..9a08d656f1ce --- /dev/null +++ b/drivers/net/bfin_mac.c | |||
| @@ -0,0 +1,1009 @@ | |||
| 1 | /* | ||
| 2 | * File: drivers/net/bfin_mac.c | ||
| 3 | * Based on: | ||
| 4 | * Maintainer: | ||
| 5 | * Bryan Wu <bryan.wu@analog.com> | ||
| 6 | * | ||
| 7 | * Original author: | ||
| 8 | * Luke Yang <luke.yang@analog.com> | ||
| 9 | * | ||
| 10 | * Created: | ||
| 11 | * Description: | ||
| 12 | * | ||
| 13 | * Modified: | ||
| 14 | * Copyright 2004-2006 Analog Devices Inc. | ||
| 15 | * | ||
| 16 | * Bugs: Enter bugs at http://blackfin.uclinux.org/ | ||
| 17 | * | ||
| 18 | * This program is free software ; you can redistribute it and/or modify | ||
| 19 | * it under the terms of the GNU General Public License as published by | ||
| 20 | * the Free Software Foundation ; either version 2, or (at your option) | ||
| 21 | * any later version. | ||
| 22 | * | ||
| 23 | * This program is distributed in the hope that it will be useful, | ||
| 24 | * but WITHOUT ANY WARRANTY ; without even the implied warranty of | ||
| 25 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 26 | * GNU General Public License for more details. | ||
| 27 | * | ||
| 28 | * You should have received a copy of the GNU General Public License | ||
| 29 | * along with this program ; see the file COPYING. | ||
| 30 | * If not, write to the Free Software Foundation, | ||
| 31 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
| 32 | */ | ||
| 33 | |||
| 34 | #include <linux/init.h> | ||
| 35 | #include <linux/module.h> | ||
| 36 | #include <linux/kernel.h> | ||
| 37 | #include <linux/sched.h> | ||
| 38 | #include <linux/slab.h> | ||
| 39 | #include <linux/delay.h> | ||
| 40 | #include <linux/timer.h> | ||
| 41 | #include <linux/errno.h> | ||
| 42 | #include <linux/irq.h> | ||
| 43 | #include <linux/io.h> | ||
| 44 | #include <linux/ioport.h> | ||
| 45 | #include <linux/crc32.h> | ||
| 46 | #include <linux/device.h> | ||
| 47 | #include <linux/spinlock.h> | ||
| 48 | #include <linux/ethtool.h> | ||
| 49 | #include <linux/mii.h> | ||
| 50 | |||
| 51 | #include <linux/netdevice.h> | ||
| 52 | #include <linux/etherdevice.h> | ||
| 53 | #include <linux/skbuff.h> | ||
| 54 | |||
| 55 | #include <linux/platform_device.h> | ||
| 56 | #include <linux/netdevice.h> | ||
| 57 | #include <linux/etherdevice.h> | ||
| 58 | #include <linux/skbuff.h> | ||
| 59 | |||
| 60 | #include <asm/dma.h> | ||
| 61 | #include <linux/dma-mapping.h> | ||
| 62 | |||
| 63 | #include <asm/blackfin.h> | ||
| 64 | #include <asm/cacheflush.h> | ||
| 65 | #include <asm/portmux.h> | ||
| 66 | |||
| 67 | #include "bfin_mac.h" | ||
| 68 | |||
| 69 | #define DRV_NAME "bfin_mac" | ||
| 70 | #define DRV_VERSION "1.1" | ||
| 71 | #define DRV_AUTHOR "Bryan Wu, Luke Yang" | ||
| 72 | #define DRV_DESC "Blackfin BF53[67] on-chip Ethernet MAC driver" | ||
| 73 | |||
| 74 | MODULE_AUTHOR(DRV_AUTHOR); | ||
| 75 | MODULE_LICENSE("GPL"); | ||
| 76 | MODULE_DESCRIPTION(DRV_DESC); | ||
| 77 | |||
| 78 | #if defined(CONFIG_BFIN_MAC_USE_L1) | ||
| 79 | # define bfin_mac_alloc(dma_handle, size) l1_data_sram_zalloc(size) | ||
| 80 | # define bfin_mac_free(dma_handle, ptr) l1_data_sram_free(ptr) | ||
| 81 | #else | ||
| 82 | # define bfin_mac_alloc(dma_handle, size) \ | ||
| 83 | dma_alloc_coherent(NULL, size, dma_handle, GFP_KERNEL) | ||
| 84 | # define bfin_mac_free(dma_handle, ptr) \ | ||
| 85 | dma_free_coherent(NULL, sizeof(*ptr), ptr, dma_handle) | ||
| 86 | #endif | ||
| 87 | |||
| 88 | #define PKT_BUF_SZ 1580 | ||
| 89 | |||
| 90 | #define MAX_TIMEOUT_CNT 500 | ||
| 91 | |||
| 92 | /* pointers to maintain transmit list */ | ||
| 93 | static struct net_dma_desc_tx *tx_list_head; | ||
| 94 | static struct net_dma_desc_tx *tx_list_tail; | ||
| 95 | static struct net_dma_desc_rx *rx_list_head; | ||
| 96 | static struct net_dma_desc_rx *rx_list_tail; | ||
| 97 | static struct net_dma_desc_rx *current_rx_ptr; | ||
| 98 | static struct net_dma_desc_tx *current_tx_ptr; | ||
| 99 | static struct net_dma_desc_tx *tx_desc; | ||
| 100 | static struct net_dma_desc_rx *rx_desc; | ||
| 101 | |||
| 102 | static void desc_list_free(void) | ||
| 103 | { | ||
| 104 | struct net_dma_desc_rx *r; | ||
| 105 | struct net_dma_desc_tx *t; | ||
| 106 | int i; | ||
| 107 | #if !defined(CONFIG_BFIN_MAC_USE_L1) | ||
| 108 | dma_addr_t dma_handle = 0; | ||
| 109 | #endif | ||
| 110 | |||
| 111 | if (tx_desc) { | ||
| 112 | t = tx_list_head; | ||
| 113 | for (i = 0; i < CONFIG_BFIN_TX_DESC_NUM; i++) { | ||
| 114 | if (t) { | ||
| 115 | if (t->skb) { | ||
| 116 | dev_kfree_skb(t->skb); | ||
| 117 | t->skb = NULL; | ||
| 118 | } | ||
| 119 | t = t->next; | ||
| 120 | } | ||
| 121 | } | ||
| 122 | bfin_mac_free(dma_handle, tx_desc); | ||
| 123 | } | ||
| 124 | |||
| 125 | if (rx_desc) { | ||
| 126 | r = rx_list_head; | ||
| 127 | for (i = 0; i < CONFIG_BFIN_RX_DESC_NUM; i++) { | ||
| 128 | if (r) { | ||
| 129 | if (r->skb) { | ||
| 130 | dev_kfree_skb(r->skb); | ||
| 131 | r->skb = NULL; | ||
| 132 | } | ||
| 133 | r = r->next; | ||
| 134 | } | ||
| 135 | } | ||
| 136 | bfin_mac_free(dma_handle, rx_desc); | ||
| 137 | } | ||
| 138 | } | ||
| 139 | |||
| 140 | static int desc_list_init(void) | ||
| 141 | { | ||
| 142 | int i; | ||
| 143 | struct sk_buff *new_skb; | ||
| 144 | #if !defined(CONFIG_BFIN_MAC_USE_L1) | ||
| 145 | /* | ||
| 146 | * This dma_handle is useless in Blackfin dma_alloc_coherent(). | ||
| 147 | * The real dma handler is the return value of dma_alloc_coherent(). | ||
| 148 | */ | ||
| 149 | dma_addr_t dma_handle; | ||
| 150 | #endif | ||
| 151 | |||
| 152 | tx_desc = bfin_mac_alloc(&dma_handle, | ||
| 153 | sizeof(struct net_dma_desc_tx) * | ||
| 154 | CONFIG_BFIN_TX_DESC_NUM); | ||
| 155 | if (tx_desc == NULL) | ||
| 156 | goto init_error; | ||
| 157 | |||
| 158 | rx_desc = bfin_mac_alloc(&dma_handle, | ||
| 159 | sizeof(struct net_dma_desc_rx) * | ||
| 160 | CONFIG_BFIN_RX_DESC_NUM); | ||
| 161 | if (rx_desc == NULL) | ||
| 162 | goto init_error; | ||
| 163 | |||
| 164 | /* init tx_list */ | ||
| 165 | tx_list_head = tx_list_tail = tx_desc; | ||
| 166 | |||
| 167 | for (i = 0; i < CONFIG_BFIN_TX_DESC_NUM; i++) { | ||
| 168 | struct net_dma_desc_tx *t = tx_desc + i; | ||
| 169 | struct dma_descriptor *a = &(t->desc_a); | ||
| 170 | struct dma_descriptor *b = &(t->desc_b); | ||
| 171 | |||
| 172 | /* | ||
| 173 | * disable DMA | ||
| 174 | * read from memory WNR = 0 | ||
| 175 | * wordsize is 32 bits | ||
| 176 | * 6 half words is desc size | ||
| 177 | * large desc flow | ||
| 178 | */ | ||
| 179 | a->config = WDSIZE_32 | NDSIZE_6 | DMAFLOW_LARGE; | ||
| 180 | a->start_addr = (unsigned long)t->packet; | ||
| 181 | a->x_count = 0; | ||
| 182 | a->next_dma_desc = b; | ||
| 183 | |||
| 184 | /* | ||
| 185 | * enabled DMA | ||
| 186 | * write to memory WNR = 1 | ||
| 187 | * wordsize is 32 bits | ||
| 188 | * disable interrupt | ||
| 189 | * 6 half words is desc size | ||
| 190 | * large desc flow | ||
| 191 | */ | ||
| 192 | b->config = DMAEN | WNR | WDSIZE_32 | NDSIZE_6 | DMAFLOW_LARGE; | ||
| 193 | b->start_addr = (unsigned long)(&(t->status)); | ||
| 194 | b->x_count = 0; | ||
| 195 | |||
| 196 | t->skb = NULL; | ||
| 197 | tx_list_tail->desc_b.next_dma_desc = a; | ||
| 198 | tx_list_tail->next = t; | ||
| 199 | tx_list_tail = t; | ||
| 200 | } | ||
| 201 | tx_list_tail->next = tx_list_head; /* tx_list is a circle */ | ||
| 202 | tx_list_tail->desc_b.next_dma_desc = &(tx_list_head->desc_a); | ||
| 203 | current_tx_ptr = tx_list_head; | ||
| 204 | |||
| 205 | /* init rx_list */ | ||
| 206 | rx_list_head = rx_list_tail = rx_desc; | ||
| 207 | |||
| 208 | for (i = 0; i < CONFIG_BFIN_RX_DESC_NUM; i++) { | ||
| 209 | struct net_dma_desc_rx *r = rx_desc + i; | ||
| 210 | struct dma_descriptor *a = &(r->desc_a); | ||
| 211 | struct dma_descriptor *b = &(r->desc_b); | ||
| 212 | |||
| 213 | /* allocate a new skb for next time receive */ | ||
| 214 | new_skb = dev_alloc_skb(PKT_BUF_SZ + 2); | ||
| 215 | if (!new_skb) { | ||
| 216 | printk(KERN_NOTICE DRV_NAME | ||
| 217 | ": init: low on mem - packet dropped\n"); | ||
| 218 | goto init_error; | ||
| 219 | } | ||
| 220 | skb_reserve(new_skb, 2); | ||
| 221 | r->skb = new_skb; | ||
| 222 | |||
| 223 | /* | ||
| 224 | * enabled DMA | ||
| 225 | * write to memory WNR = 1 | ||
| 226 | * wordsize is 32 bits | ||
| 227 | * disable interrupt | ||
| 228 | * 6 half words is desc size | ||
| 229 | * large desc flow | ||
| 230 | */ | ||
| 231 | a->config = DMAEN | WNR | WDSIZE_32 | NDSIZE_6 | DMAFLOW_LARGE; | ||
| 232 | /* since RXDWA is enabled */ | ||
| 233 | a->start_addr = (unsigned long)new_skb->data - 2; | ||
| 234 | a->x_count = 0; | ||
| 235 | a->next_dma_desc = b; | ||
| 236 | |||
| 237 | /* | ||
| 238 | * enabled DMA | ||
| 239 | * write to memory WNR = 1 | ||
| 240 | * wordsize is 32 bits | ||
| 241 | * enable interrupt | ||
| 242 | * 6 half words is desc size | ||
| 243 | * large desc flow | ||
| 244 | */ | ||
| 245 | b->config = DMAEN | WNR | WDSIZE_32 | DI_EN | | ||
| 246 | NDSIZE_6 | DMAFLOW_LARGE; | ||
| 247 | b->start_addr = (unsigned long)(&(r->status)); | ||
| 248 | b->x_count = 0; | ||
| 249 | |||
| 250 | rx_list_tail->desc_b.next_dma_desc = a; | ||
| 251 | rx_list_tail->next = r; | ||
| 252 | rx_list_tail = r; | ||
| 253 | } | ||
| 254 | rx_list_tail->next = rx_list_head; /* rx_list is a circle */ | ||
| 255 | rx_list_tail->desc_b.next_dma_desc = &(rx_list_head->desc_a); | ||
| 256 | current_rx_ptr = rx_list_head; | ||
| 257 | |||
| 258 | return 0; | ||
| 259 | |||
| 260 | init_error: | ||
| 261 | desc_list_free(); | ||
| 262 | printk(KERN_ERR DRV_NAME ": kmalloc failed\n"); | ||
| 263 | return -ENOMEM; | ||
| 264 | } | ||
| 265 | |||
| 266 | |||
| 267 | /*---PHY CONTROL AND CONFIGURATION-----------------------------------------*/ | ||
| 268 | |||
| 269 | /* Set FER regs to MUX in Ethernet pins */ | ||
| 270 | static int setup_pin_mux(int action) | ||
| 271 | { | ||
| 272 | #if defined(CONFIG_BFIN_MAC_RMII) | ||
| 273 | u16 pin_req[] = P_RMII0; | ||
| 274 | #else | ||
| 275 | u16 pin_req[] = P_MII0; | ||
| 276 | #endif | ||
| 277 | |||
| 278 | if (action) { | ||
| 279 | if (peripheral_request_list(pin_req, DRV_NAME)) { | ||
| 280 | printk(KERN_ERR DRV_NAME | ||
| 281 | ": Requesting Peripherals failed\n"); | ||
| 282 | return -EFAULT; | ||
| 283 | } | ||
| 284 | } else | ||
| 285 | peripheral_free_list(pin_req); | ||
| 286 | |||
| 287 | return 0; | ||
| 288 | } | ||
| 289 | |||
| 290 | /* Wait until the previous MDC/MDIO transaction has completed */ | ||
| 291 | static void poll_mdc_done(void) | ||
| 292 | { | ||
| 293 | int timeout_cnt = MAX_TIMEOUT_CNT; | ||
| 294 | |||
| 295 | /* poll the STABUSY bit */ | ||
| 296 | while ((bfin_read_EMAC_STAADD()) & STABUSY) { | ||
| 297 | mdelay(10); | ||
| 298 | if (timeout_cnt-- < 0) { | ||
| 299 | printk(KERN_ERR DRV_NAME | ||
| 300 | ": wait MDC/MDIO transaction to complete timeout\n"); | ||
| 301 | break; | ||
| 302 | } | ||
| 303 | } | ||
| 304 | } | ||
| 305 | |||
| 306 | /* Read an off-chip register in a PHY through the MDC/MDIO port */ | ||
| 307 | static u16 read_phy_reg(u16 PHYAddr, u16 RegAddr) | ||
| 308 | { | ||
| 309 | poll_mdc_done(); | ||
| 310 | /* read mode */ | ||
| 311 | bfin_write_EMAC_STAADD(SET_PHYAD(PHYAddr) | | ||
| 312 | SET_REGAD(RegAddr) | | ||
| 313 | STABUSY); | ||
| 314 | poll_mdc_done(); | ||
| 315 | |||
| 316 | return (u16) bfin_read_EMAC_STADAT(); | ||
| 317 | } | ||
| 318 | |||
| 319 | /* Write an off-chip register in a PHY through the MDC/MDIO port */ | ||
| 320 | static void raw_write_phy_reg(u16 PHYAddr, u16 RegAddr, u32 Data) | ||
| 321 | { | ||
| 322 | bfin_write_EMAC_STADAT(Data); | ||
| 323 | |||
| 324 | /* write mode */ | ||
| 325 | bfin_write_EMAC_STAADD(SET_PHYAD(PHYAddr) | | ||
| 326 | SET_REGAD(RegAddr) | | ||
| 327 | STAOP | | ||
| 328 | STABUSY); | ||
| 329 | |||
| 330 | poll_mdc_done(); | ||
| 331 | } | ||
| 332 | |||
| 333 | static void write_phy_reg(u16 PHYAddr, u16 RegAddr, u32 Data) | ||
| 334 | { | ||
| 335 | poll_mdc_done(); | ||
| 336 | raw_write_phy_reg(PHYAddr, RegAddr, Data); | ||
| 337 | } | ||
| 338 | |||
| 339 | /* set up the phy */ | ||
| 340 | static void bf537mac_setphy(struct net_device *dev) | ||
| 341 | { | ||
| 342 | u16 phydat; | ||
| 343 | struct bf537mac_local *lp = netdev_priv(dev); | ||
| 344 | |||
| 345 | /* Program PHY registers */ | ||
| 346 | pr_debug("start setting up phy\n"); | ||
| 347 | |||
| 348 | /* issue a reset */ | ||
| 349 | raw_write_phy_reg(lp->PhyAddr, PHYREG_MODECTL, 0x8000); | ||
| 350 | |||
| 351 | /* wait half a second */ | ||
| 352 | msleep(500); | ||
| 353 | |||
| 354 | phydat = read_phy_reg(lp->PhyAddr, PHYREG_MODECTL); | ||
| 355 | |||
| 356 | /* advertise flow control supported */ | ||
| 357 | phydat = read_phy_reg(lp->PhyAddr, PHYREG_ANAR); | ||
| 358 | phydat |= (1 << 10); | ||
| 359 | write_phy_reg(lp->PhyAddr, PHYREG_ANAR, phydat); | ||
| 360 | |||
| 361 | phydat = 0; | ||
| 362 | if (lp->Negotiate) | ||
| 363 | phydat |= 0x1000; /* enable auto negotiation */ | ||
| 364 | else { | ||
| 365 | if (lp->FullDuplex) | ||
| 366 | phydat |= (1 << 8); /* full duplex */ | ||
| 367 | else | ||
| 368 | phydat &= (~(1 << 8)); /* half duplex */ | ||
| 369 | |||
| 370 | if (!lp->Port10) | ||
| 371 | phydat |= (1 << 13); /* 100 Mbps */ | ||
| 372 | else | ||
| 373 | phydat &= (~(1 << 13)); /* 10 Mbps */ | ||
| 374 | } | ||
| 375 | |||
| 376 | if (lp->Loopback) | ||
| 377 | phydat |= (1 << 14); /* enable TX->RX loopback */ | ||
| 378 | |||
| 379 | write_phy_reg(lp->PhyAddr, PHYREG_MODECTL, phydat); | ||
| 380 | msleep(500); | ||
| 381 | |||
| 382 | phydat = read_phy_reg(lp->PhyAddr, PHYREG_MODECTL); | ||
| 383 | /* check for SMSC PHY */ | ||
| 384 | if ((read_phy_reg(lp->PhyAddr, PHYREG_PHYID1) == 0x7) && | ||
| 385 | ((read_phy_reg(lp->PhyAddr, PHYREG_PHYID2) & 0xfff0) == 0xC0A0)) { | ||
| 386 | /* | ||
| 387 | * we have SMSC PHY so reqest interrupt | ||
| 388 | * on link down condition | ||
| 389 | */ | ||
| 390 | |||
| 391 | /* enable interrupts */ | ||
| 392 | write_phy_reg(lp->PhyAddr, 30, 0x0ff); | ||
| 393 | } | ||
| 394 | } | ||
| 395 | |||
| 396 | /**************************************************************************/ | ||
| 397 | void setup_system_regs(struct net_device *dev) | ||
| 398 | { | ||
| 399 | int phyaddr; | ||
| 400 | unsigned short sysctl, phydat; | ||
| 401 | u32 opmode; | ||
| 402 | struct bf537mac_local *lp = netdev_priv(dev); | ||
| 403 | int count = 0; | ||
| 404 | |||
| 405 | phyaddr = lp->PhyAddr; | ||
| 406 | |||
| 407 | /* Enable PHY output */ | ||
| 408 | if (!(bfin_read_VR_CTL() & PHYCLKOE)) | ||
| 409 | bfin_write_VR_CTL(bfin_read_VR_CTL() | PHYCLKOE); | ||
| 410 | |||
| 411 | /* MDC = 2.5 MHz */ | ||
| 412 | sysctl = SET_MDCDIV(24); | ||
| 413 | /* Odd word alignment for Receive Frame DMA word */ | ||
| 414 | /* Configure checksum support and rcve frame word alignment */ | ||
| 415 | #if defined(BFIN_MAC_CSUM_OFFLOAD) | ||
| 416 | sysctl |= RXDWA | RXCKS; | ||
| 417 | #else | ||
| 418 | sysctl |= RXDWA; | ||
| 419 | #endif | ||
| 420 | bfin_write_EMAC_SYSCTL(sysctl); | ||
| 421 | /* auto negotiation on */ | ||
| 422 | /* full duplex */ | ||
| 423 | /* 100 Mbps */ | ||
| 424 | phydat = PHY_ANEG_EN | PHY_DUPLEX | PHY_SPD_SET; | ||
| 425 | write_phy_reg(phyaddr, PHYREG_MODECTL, phydat); | ||
| 426 | |||
| 427 | /* test if full duplex supported */ | ||
| 428 | do { | ||
| 429 | msleep(100); | ||
| 430 | phydat = read_phy_reg(phyaddr, PHYREG_MODESTAT); | ||
| 431 | if (count > 30) { | ||
| 432 | printk(KERN_NOTICE DRV_NAME ": Link is down\n"); | ||
| 433 | printk(KERN_NOTICE DRV_NAME | ||
| 434 | "please check your network connection\n"); | ||
| 435 | break; | ||
| 436 | } | ||
| 437 | count++; | ||
| 438 | } while (!(phydat & 0x0004)); | ||
| 439 | |||
| 440 | phydat = read_phy_reg(phyaddr, PHYREG_ANLPAR); | ||
| 441 | |||
| 442 | if ((phydat & 0x0100) || (phydat & 0x0040)) { | ||
| 443 | opmode = FDMODE; | ||
| 444 | } else { | ||
| 445 | opmode = 0; | ||
| 446 | printk(KERN_INFO DRV_NAME | ||
| 447 | ": Network is set to half duplex\n"); | ||
| 448 | } | ||
| 449 | |||
| 450 | #if defined(CONFIG_BFIN_MAC_RMII) | ||
| 451 | opmode |= RMII; /* For Now only 100MBit are supported */ | ||
| 452 | #endif | ||
| 453 | |||
| 454 | bfin_write_EMAC_OPMODE(opmode); | ||
| 455 | |||
| 456 | bfin_write_EMAC_MMC_CTL(RSTC | CROLL); | ||
| 457 | |||
| 458 | /* Initialize the TX DMA channel registers */ | ||
| 459 | bfin_write_DMA2_X_COUNT(0); | ||
| 460 | bfin_write_DMA2_X_MODIFY(4); | ||
| 461 | bfin_write_DMA2_Y_COUNT(0); | ||
| 462 | bfin_write_DMA2_Y_MODIFY(0); | ||
| 463 | |||
| 464 | /* Initialize the RX DMA channel registers */ | ||
| 465 | bfin_write_DMA1_X_COUNT(0); | ||
| 466 | bfin_write_DMA1_X_MODIFY(4); | ||
| 467 | bfin_write_DMA1_Y_COUNT(0); | ||
| 468 | bfin_write_DMA1_Y_MODIFY(0); | ||
| 469 | } | ||
| 470 | |||
| 471 | void setup_mac_addr(u8 * mac_addr) | ||
| 472 | { | ||
| 473 | u32 addr_low = le32_to_cpu(*(__le32 *) & mac_addr[0]); | ||
| 474 | u16 addr_hi = le16_to_cpu(*(__le16 *) & mac_addr[4]); | ||
| 475 | |||
| 476 | /* this depends on a little-endian machine */ | ||
| 477 | bfin_write_EMAC_ADDRLO(addr_low); | ||
| 478 | bfin_write_EMAC_ADDRHI(addr_hi); | ||
| 479 | } | ||
| 480 | |||
| 481 | static void adjust_tx_list(void) | ||
| 482 | { | ||
| 483 | int timeout_cnt = MAX_TIMEOUT_CNT; | ||
| 484 | |||
| 485 | if (tx_list_head->status.status_word != 0 | ||
| 486 | && current_tx_ptr != tx_list_head) { | ||
| 487 | goto adjust_head; /* released something, just return; */ | ||
| 488 | } | ||
| 489 | |||
| 490 | /* | ||
| 491 | * if nothing released, check wait condition | ||
| 492 | * current's next can not be the head, | ||
| 493 | * otherwise the dma will not stop as we want | ||
| 494 | */ | ||
| 495 | if (current_tx_ptr->next->next == tx_list_head) { | ||
| 496 | while (tx_list_head->status.status_word == 0) { | ||
| 497 | mdelay(10); | ||
| 498 | if (tx_list_head->status.status_word != 0 | ||
| 499 | || !(bfin_read_DMA2_IRQ_STATUS() & 0x08)) { | ||
| 500 | goto adjust_head; | ||
| 501 | } | ||
| 502 | if (timeout_cnt-- < 0) { | ||
| 503 | printk(KERN_ERR DRV_NAME | ||
| 504 | ": wait for adjust tx list head timeout\n"); | ||
| 505 | break; | ||
| 506 | } | ||
| 507 | } | ||
| 508 | if (tx_list_head->status.status_word != 0) { | ||
| 509 | goto adjust_head; | ||
| 510 | } | ||
| 511 | } | ||
| 512 | |||
| 513 | return; | ||
| 514 | |||
| 515 | adjust_head: | ||
| 516 | do { | ||
| 517 | tx_list_head->desc_a.config &= ~DMAEN; | ||
| 518 | tx_list_head->status.status_word = 0; | ||
| 519 | if (tx_list_head->skb) { | ||
| 520 | dev_kfree_skb(tx_list_head->skb); | ||
| 521 | tx_list_head->skb = NULL; | ||
| 522 | } else { | ||
| 523 | printk(KERN_ERR DRV_NAME | ||
| 524 | ": no sk_buff in a transmitted frame!\n"); | ||
| 525 | } | ||
| 526 | tx_list_head = tx_list_head->next; | ||
| 527 | } while (tx_list_head->status.status_word != 0 | ||
| 528 | && current_tx_ptr != tx_list_head); | ||
| 529 | return; | ||
| 530 | |||
| 531 | } | ||
| 532 | |||
| 533 | static int bf537mac_hard_start_xmit(struct sk_buff *skb, | ||
| 534 | struct net_device *dev) | ||
| 535 | { | ||
| 536 | struct bf537mac_local *lp = netdev_priv(dev); | ||
| 537 | unsigned int data; | ||
| 538 | |||
| 539 | current_tx_ptr->skb = skb; | ||
| 540 | |||
| 541 | /* | ||
| 542 | * Is skb->data always 16-bit aligned? | ||
| 543 | * Do we need to memcpy((char *)(tail->packet + 2), skb->data, len)? | ||
| 544 | */ | ||
| 545 | if ((((unsigned int)(skb->data)) & 0x02) == 2) { | ||
| 546 | /* move skb->data to current_tx_ptr payload */ | ||
| 547 | data = (unsigned int)(skb->data) - 2; | ||
| 548 | *((unsigned short *)data) = (unsigned short)(skb->len); | ||
| 549 | current_tx_ptr->desc_a.start_addr = (unsigned long)data; | ||
| 550 | /* this is important! */ | ||
| 551 | blackfin_dcache_flush_range(data, (data + (skb->len)) + 2); | ||
| 552 | |||
| 553 | } else { | ||
| 554 | *((unsigned short *)(current_tx_ptr->packet)) = | ||
| 555 | (unsigned short)(skb->len); | ||
| 556 | memcpy((char *)(current_tx_ptr->packet + 2), skb->data, | ||
| 557 | (skb->len)); | ||
| 558 | current_tx_ptr->desc_a.start_addr = | ||
| 559 | (unsigned long)current_tx_ptr->packet; | ||
| 560 | if (current_tx_ptr->status.status_word != 0) | ||
| 561 | current_tx_ptr->status.status_word = 0; | ||
| 562 | blackfin_dcache_flush_range((unsigned int)current_tx_ptr-> | ||
| 563 | packet, | ||
| 564 | (unsigned int)(current_tx_ptr-> | ||
| 565 | packet + skb->len) + | ||
| 566 | 2); | ||
| 567 | } | ||
| 568 | |||
| 569 | /* enable this packet's dma */ | ||
| 570 | current_tx_ptr->desc_a.config |= DMAEN; | ||
| 571 | |||
| 572 | /* tx dma is running, just return */ | ||
| 573 | if (bfin_read_DMA2_IRQ_STATUS() & 0x08) | ||
| 574 | goto out; | ||
| 575 | |||
| 576 | /* tx dma is not running */ | ||
| 577 | bfin_write_DMA2_NEXT_DESC_PTR(&(current_tx_ptr->desc_a)); | ||
| 578 | /* dma enabled, read from memory, size is 6 */ | ||
| 579 | bfin_write_DMA2_CONFIG(current_tx_ptr->desc_a.config); | ||
| 580 | /* Turn on the EMAC tx */ | ||
| 581 | bfin_write_EMAC_OPMODE(bfin_read_EMAC_OPMODE() | TE); | ||
| 582 | |||
| 583 | out: | ||
| 584 | adjust_tx_list(); | ||
| 585 | current_tx_ptr = current_tx_ptr->next; | ||
| 586 | dev->trans_start = jiffies; | ||
| 587 | lp->stats.tx_packets++; | ||
| 588 | lp->stats.tx_bytes += (skb->len); | ||
| 589 | return 0; | ||
| 590 | } | ||
| 591 | |||
| 592 | static void bf537mac_rx(struct net_device *dev) | ||
| 593 | { | ||
| 594 | struct sk_buff *skb, *new_skb; | ||
| 595 | struct bf537mac_local *lp = netdev_priv(dev); | ||
| 596 | unsigned short len; | ||
| 597 | |||
| 598 | /* allocate a new skb for next time receive */ | ||
| 599 | skb = current_rx_ptr->skb; | ||
| 600 | new_skb = dev_alloc_skb(PKT_BUF_SZ + 2); | ||
| 601 | if (!new_skb) { | ||
| 602 | printk(KERN_NOTICE DRV_NAME | ||
| 603 | ": rx: low on mem - packet dropped\n"); | ||
| 604 | lp->stats.rx_dropped++; | ||
| 605 | goto out; | ||
| 606 | } | ||
| 607 | /* reserve 2 bytes for RXDWA padding */ | ||
| 608 | skb_reserve(new_skb, 2); | ||
| 609 | current_rx_ptr->skb = new_skb; | ||
| 610 | current_rx_ptr->desc_a.start_addr = (unsigned long)new_skb->data - 2; | ||
| 611 | |||
| 612 | len = (unsigned short)((current_rx_ptr->status.status_word) & RX_FRLEN); | ||
| 613 | skb_put(skb, len); | ||
| 614 | blackfin_dcache_invalidate_range((unsigned long)skb->head, | ||
| 615 | (unsigned long)skb->tail); | ||
| 616 | |||
| 617 | dev->last_rx = jiffies; | ||
| 618 | skb->dev = dev; | ||
| 619 | skb->protocol = eth_type_trans(skb, dev); | ||
| 620 | #if defined(BFIN_MAC_CSUM_OFFLOAD) | ||
| 621 | skb->csum = current_rx_ptr->status.ip_payload_csum; | ||
| 622 | skb->ip_summed = CHECKSUM_PARTIAL; | ||
| 623 | #endif | ||
| 624 | |||
| 625 | netif_rx(skb); | ||
| 626 | lp->stats.rx_packets++; | ||
| 627 | lp->stats.rx_bytes += len; | ||
| 628 | current_rx_ptr->status.status_word = 0x00000000; | ||
| 629 | current_rx_ptr = current_rx_ptr->next; | ||
| 630 | |||
| 631 | out: | ||
| 632 | return; | ||
| 633 | } | ||
| 634 | |||
| 635 | /* interrupt routine to handle rx and error signal */ | ||
| 636 | static irqreturn_t bf537mac_interrupt(int irq, void *dev_id) | ||
| 637 | { | ||
| 638 | struct net_device *dev = dev_id; | ||
| 639 | int number = 0; | ||
| 640 | |||
| 641 | get_one_packet: | ||
| 642 | if (current_rx_ptr->status.status_word == 0) { | ||
| 643 | /* no more new packet received */ | ||
| 644 | if (number == 0) { | ||
| 645 | if (current_rx_ptr->next->status.status_word != 0) { | ||
| 646 | current_rx_ptr = current_rx_ptr->next; | ||
| 647 | goto real_rx; | ||
| 648 | } | ||
| 649 | } | ||
| 650 | bfin_write_DMA1_IRQ_STATUS(bfin_read_DMA1_IRQ_STATUS() | | ||
| 651 | DMA_DONE | DMA_ERR); | ||
| 652 | return IRQ_HANDLED; | ||
| 653 | } | ||
| 654 | |||
| 655 | real_rx: | ||
| 656 | bf537mac_rx(dev); | ||
| 657 | number++; | ||
| 658 | goto get_one_packet; | ||
| 659 | } | ||
| 660 | |||
| 661 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
| 662 | static void bf537mac_poll(struct net_device *dev) | ||
| 663 | { | ||
| 664 | disable_irq(IRQ_MAC_RX); | ||
| 665 | bf537mac_interrupt(IRQ_MAC_RX, dev); | ||
| 666 | enable_irq(IRQ_MAC_RX); | ||
| 667 | } | ||
| 668 | #endif /* CONFIG_NET_POLL_CONTROLLER */ | ||
| 669 | |||
| 670 | static void bf537mac_reset(void) | ||
| 671 | { | ||
| 672 | unsigned int opmode; | ||
| 673 | |||
| 674 | opmode = bfin_read_EMAC_OPMODE(); | ||
| 675 | opmode &= (~RE); | ||
| 676 | opmode &= (~TE); | ||
| 677 | /* Turn off the EMAC */ | ||
| 678 | bfin_write_EMAC_OPMODE(opmode); | ||
| 679 | } | ||
| 680 | |||
| 681 | /* | ||
| 682 | * Enable Interrupts, Receive, and Transmit | ||
| 683 | */ | ||
| 684 | static int bf537mac_enable(struct net_device *dev) | ||
| 685 | { | ||
| 686 | u32 opmode; | ||
| 687 | |||
| 688 | pr_debug("%s: %s\n", dev->name, __FUNCTION__); | ||
| 689 | |||
| 690 | /* Set RX DMA */ | ||
| 691 | bfin_write_DMA1_NEXT_DESC_PTR(&(rx_list_head->desc_a)); | ||
| 692 | bfin_write_DMA1_CONFIG(rx_list_head->desc_a.config); | ||
| 693 | |||
| 694 | /* Wait MII done */ | ||
| 695 | poll_mdc_done(); | ||
| 696 | |||
| 697 | /* We enable only RX here */ | ||
| 698 | /* ASTP : Enable Automatic Pad Stripping | ||
| 699 | PR : Promiscuous Mode for test | ||
| 700 | PSF : Receive frames with total length less than 64 bytes. | ||
| 701 | FDMODE : Full Duplex Mode | ||
| 702 | LB : Internal Loopback for test | ||
| 703 | RE : Receiver Enable */ | ||
| 704 | opmode = bfin_read_EMAC_OPMODE(); | ||
| 705 | if (opmode & FDMODE) | ||
| 706 | opmode |= PSF; | ||
| 707 | else | ||
| 708 | opmode |= DRO | DC | PSF; | ||
| 709 | opmode |= RE; | ||
| 710 | |||
| 711 | #if defined(CONFIG_BFIN_MAC_RMII) | ||
| 712 | opmode |= RMII; /* For Now only 100MBit are supported */ | ||
| 713 | #ifdef CONFIG_BF_REV_0_2 | ||
| 714 | opmode |= TE; | ||
| 715 | #endif | ||
| 716 | #endif | ||
| 717 | /* Turn on the EMAC rx */ | ||
| 718 | bfin_write_EMAC_OPMODE(opmode); | ||
| 719 | |||
| 720 | return 0; | ||
| 721 | } | ||
| 722 | |||
| 723 | /* Our watchdog timed out. Called by the networking layer */ | ||
| 724 | static void bf537mac_timeout(struct net_device *dev) | ||
| 725 | { | ||
| 726 | pr_debug("%s: %s\n", dev->name, __FUNCTION__); | ||
| 727 | |||
| 728 | bf537mac_reset(); | ||
| 729 | |||
| 730 | /* reset tx queue */ | ||
| 731 | tx_list_tail = tx_list_head->next; | ||
| 732 | |||
| 733 | bf537mac_enable(dev); | ||
| 734 | |||
| 735 | /* We can accept TX packets again */ | ||
| 736 | dev->trans_start = jiffies; | ||
| 737 | netif_wake_queue(dev); | ||
| 738 | } | ||
| 739 | |||
| 740 | /* | ||
| 741 | * Get the current statistics. | ||
| 742 | * This may be called with the card open or closed. | ||
| 743 | */ | ||
| 744 | static struct net_device_stats *bf537mac_query_statistics(struct net_device | ||
| 745 | *dev) | ||
| 746 | { | ||
| 747 | struct bf537mac_local *lp = netdev_priv(dev); | ||
| 748 | |||
| 749 | pr_debug("%s: %s\n", dev->name, __FUNCTION__); | ||
| 750 | |||
| 751 | return &lp->stats; | ||
| 752 | } | ||
| 753 | |||
| 754 | /* | ||
| 755 | * This routine will, depending on the values passed to it, | ||
| 756 | * either make it accept multicast packets, go into | ||
| 757 | * promiscuous mode (for TCPDUMP and cousins) or accept | ||
| 758 | * a select set of multicast packets | ||
| 759 | */ | ||
| 760 | static void bf537mac_set_multicast_list(struct net_device *dev) | ||
| 761 | { | ||
| 762 | u32 sysctl; | ||
| 763 | |||
| 764 | if (dev->flags & IFF_PROMISC) { | ||
| 765 | printk(KERN_INFO "%s: set to promisc mode\n", dev->name); | ||
| 766 | sysctl = bfin_read_EMAC_OPMODE(); | ||
| 767 | sysctl |= RAF; | ||
| 768 | bfin_write_EMAC_OPMODE(sysctl); | ||
| 769 | } else if (dev->flags & IFF_ALLMULTI || dev->mc_count) { | ||
| 770 | /* accept all multicast */ | ||
| 771 | sysctl = bfin_read_EMAC_OPMODE(); | ||
| 772 | sysctl |= PAM; | ||
| 773 | bfin_write_EMAC_OPMODE(sysctl); | ||
| 774 | } else { | ||
| 775 | /* clear promisc or multicast mode */ | ||
| 776 | sysctl = bfin_read_EMAC_OPMODE(); | ||
| 777 | sysctl &= ~(RAF | PAM); | ||
| 778 | bfin_write_EMAC_OPMODE(sysctl); | ||
| 779 | } | ||
| 780 | } | ||
| 781 | |||
| 782 | /* | ||
| 783 | * this puts the device in an inactive state | ||
| 784 | */ | ||
| 785 | static void bf537mac_shutdown(struct net_device *dev) | ||
| 786 | { | ||
| 787 | /* Turn off the EMAC */ | ||
| 788 | bfin_write_EMAC_OPMODE(0x00000000); | ||
| 789 | /* Turn off the EMAC RX DMA */ | ||
| 790 | bfin_write_DMA1_CONFIG(0x0000); | ||
| 791 | bfin_write_DMA2_CONFIG(0x0000); | ||
| 792 | } | ||
| 793 | |||
| 794 | /* | ||
| 795 | * Open and Initialize the interface | ||
| 796 | * | ||
| 797 | * Set up everything, reset the card, etc.. | ||
| 798 | */ | ||
| 799 | static int bf537mac_open(struct net_device *dev) | ||
| 800 | { | ||
| 801 | pr_debug("%s: %s\n", dev->name, __FUNCTION__); | ||
| 802 | |||
| 803 | /* | ||
| 804 | * Check that the address is valid. If its not, refuse | ||
| 805 | * to bring the device up. The user must specify an | ||
| 806 | * address using ifconfig eth0 hw ether xx:xx:xx:xx:xx:xx | ||
| 807 | */ | ||
| 808 | if (!is_valid_ether_addr(dev->dev_addr)) { | ||
| 809 | printk(KERN_WARNING DRV_NAME ": no valid ethernet hw addr\n"); | ||
| 810 | return -EINVAL; | ||
| 811 | } | ||
| 812 | |||
| 813 | /* initial rx and tx list */ | ||
| 814 | desc_list_init(); | ||
| 815 | |||
| 816 | bf537mac_setphy(dev); | ||
| 817 | setup_system_regs(dev); | ||
| 818 | bf537mac_reset(); | ||
| 819 | bf537mac_enable(dev); | ||
| 820 | |||
| 821 | pr_debug("hardware init finished\n"); | ||
| 822 | netif_start_queue(dev); | ||
| 823 | netif_carrier_on(dev); | ||
| 824 | |||
| 825 | return 0; | ||
| 826 | } | ||
| 827 | |||
| 828 | /* | ||
| 829 | * | ||
| 830 | * this makes the board clean up everything that it can | ||
| 831 | * and not talk to the outside world. Caused by | ||
| 832 | * an 'ifconfig ethX down' | ||
| 833 | */ | ||
| 834 | static int bf537mac_close(struct net_device *dev) | ||
| 835 | { | ||
| 836 | pr_debug("%s: %s\n", dev->name, __FUNCTION__); | ||
| 837 | |||
| 838 | netif_stop_queue(dev); | ||
| 839 | netif_carrier_off(dev); | ||
| 840 | |||
| 841 | /* clear everything */ | ||
| 842 | bf537mac_shutdown(dev); | ||
| 843 | |||
| 844 | /* free the rx/tx buffers */ | ||
| 845 | desc_list_free(); | ||
| 846 | |||
| 847 | return 0; | ||
| 848 | } | ||
| 849 | |||
| 850 | static int __init bf537mac_probe(struct net_device *dev) | ||
| 851 | { | ||
| 852 | struct bf537mac_local *lp = netdev_priv(dev); | ||
| 853 | int retval; | ||
| 854 | |||
| 855 | /* Grab the MAC address in the MAC */ | ||
| 856 | *(__le32 *) (&(dev->dev_addr[0])) = cpu_to_le32(bfin_read_EMAC_ADDRLO()); | ||
| 857 | *(__le16 *) (&(dev->dev_addr[4])) = cpu_to_le16((u16) bfin_read_EMAC_ADDRHI()); | ||
| 858 | |||
| 859 | /* probe mac */ | ||
| 860 | /*todo: how to proble? which is revision_register */ | ||
| 861 | bfin_write_EMAC_ADDRLO(0x12345678); | ||
| 862 | if (bfin_read_EMAC_ADDRLO() != 0x12345678) { | ||
| 863 | pr_debug("can't detect bf537 mac!\n"); | ||
| 864 | retval = -ENODEV; | ||
| 865 | goto err_out; | ||
| 866 | } | ||
| 867 | |||
| 868 | /* set the GPIO pins to Ethernet mode */ | ||
| 869 | retval = setup_pin_mux(1); | ||
| 870 | |||
| 871 | if (retval) | ||
| 872 | return retval; | ||
| 873 | |||
| 874 | /*Is it valid? (Did bootloader initialize it?) */ | ||
| 875 | if (!is_valid_ether_addr(dev->dev_addr)) { | ||
| 876 | /* Grab the MAC from the board somehow - this is done in the | ||
| 877 | arch/blackfin/mach-bf537/boards/eth_mac.c */ | ||
| 878 | get_bf537_ether_addr(dev->dev_addr); | ||
| 879 | } | ||
| 880 | |||
| 881 | /* If still not valid, get a random one */ | ||
| 882 | if (!is_valid_ether_addr(dev->dev_addr)) { | ||
| 883 | random_ether_addr(dev->dev_addr); | ||
| 884 | } | ||
| 885 | |||
| 886 | setup_mac_addr(dev->dev_addr); | ||
| 887 | |||
| 888 | /* Fill in the fields of the device structure with ethernet values. */ | ||
| 889 | ether_setup(dev); | ||
| 890 | |||
| 891 | dev->open = bf537mac_open; | ||
| 892 | dev->stop = bf537mac_close; | ||
| 893 | dev->hard_start_xmit = bf537mac_hard_start_xmit; | ||
| 894 | dev->tx_timeout = bf537mac_timeout; | ||
| 895 | dev->get_stats = bf537mac_query_statistics; | ||
| 896 | dev->set_multicast_list = bf537mac_set_multicast_list; | ||
| 897 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
| 898 | dev->poll_controller = bf537mac_poll; | ||
| 899 | #endif | ||
| 900 | |||
| 901 | /* fill in some of the fields */ | ||
| 902 | lp->version = 1; | ||
| 903 | lp->PhyAddr = 0x01; | ||
| 904 | lp->CLKIN = 25; | ||
| 905 | lp->FullDuplex = 0; | ||
| 906 | lp->Negotiate = 1; | ||
| 907 | lp->FlowControl = 0; | ||
| 908 | spin_lock_init(&lp->lock); | ||
| 909 | |||
| 910 | /* now, enable interrupts */ | ||
| 911 | /* register irq handler */ | ||
| 912 | if (request_irq | ||
| 913 | (IRQ_MAC_RX, bf537mac_interrupt, IRQF_DISABLED | IRQF_SHARED, | ||
| 914 | "BFIN537_MAC_RX", dev)) { | ||
| 915 | printk(KERN_WARNING DRV_NAME | ||
| 916 | ": Unable to attach BlackFin MAC RX interrupt\n"); | ||
| 917 | return -EBUSY; | ||
| 918 | } | ||
| 919 | |||
| 920 | /* Enable PHY output early */ | ||
| 921 | if (!(bfin_read_VR_CTL() & PHYCLKOE)) | ||
| 922 | bfin_write_VR_CTL(bfin_read_VR_CTL() | PHYCLKOE); | ||
| 923 | |||
| 924 | retval = register_netdev(dev); | ||
| 925 | if (retval == 0) { | ||
| 926 | /* now, print out the card info, in a short format.. */ | ||
| 927 | printk(KERN_INFO "%s: Version %s, %s\n", | ||
| 928 | DRV_NAME, DRV_VERSION, DRV_DESC); | ||
| 929 | } | ||
| 930 | |||
| 931 | err_out: | ||
| 932 | return retval; | ||
| 933 | } | ||
| 934 | |||
| 935 | static int bfin_mac_probe(struct platform_device *pdev) | ||
| 936 | { | ||
| 937 | struct net_device *ndev; | ||
| 938 | |||
| 939 | ndev = alloc_etherdev(sizeof(struct bf537mac_local)); | ||
| 940 | if (!ndev) { | ||
| 941 | printk(KERN_WARNING DRV_NAME ": could not allocate device\n"); | ||
| 942 | return -ENOMEM; | ||
| 943 | } | ||
| 944 | |||
| 945 | SET_MODULE_OWNER(ndev); | ||
| 946 | SET_NETDEV_DEV(ndev, &pdev->dev); | ||
| 947 | |||
| 948 | platform_set_drvdata(pdev, ndev); | ||
| 949 | |||
| 950 | if (bf537mac_probe(ndev) != 0) { | ||
| 951 | platform_set_drvdata(pdev, NULL); | ||
| 952 | free_netdev(ndev); | ||
| 953 | printk(KERN_WARNING DRV_NAME ": not found\n"); | ||
| 954 | return -ENODEV; | ||
| 955 | } | ||
| 956 | |||
| 957 | return 0; | ||
| 958 | } | ||
| 959 | |||
| 960 | static int bfin_mac_remove(struct platform_device *pdev) | ||
| 961 | { | ||
| 962 | struct net_device *ndev = platform_get_drvdata(pdev); | ||
| 963 | |||
| 964 | platform_set_drvdata(pdev, NULL); | ||
| 965 | |||
| 966 | unregister_netdev(ndev); | ||
| 967 | |||
| 968 | free_irq(IRQ_MAC_RX, ndev); | ||
| 969 | |||
| 970 | free_netdev(ndev); | ||
| 971 | |||
| 972 | setup_pin_mux(0); | ||
| 973 | |||
| 974 | return 0; | ||
| 975 | } | ||
| 976 | |||
| 977 | static int bfin_mac_suspend(struct platform_device *pdev, pm_message_t state) | ||
| 978 | { | ||
| 979 | return 0; | ||
| 980 | } | ||
| 981 | |||
| 982 | static int bfin_mac_resume(struct platform_device *pdev) | ||
| 983 | { | ||
| 984 | return 0; | ||
| 985 | } | ||
| 986 | |||
| 987 | static struct platform_driver bfin_mac_driver = { | ||
| 988 | .probe = bfin_mac_probe, | ||
| 989 | .remove = bfin_mac_remove, | ||
| 990 | .resume = bfin_mac_resume, | ||
| 991 | .suspend = bfin_mac_suspend, | ||
| 992 | .driver = { | ||
| 993 | .name = DRV_NAME, | ||
| 994 | }, | ||
| 995 | }; | ||
| 996 | |||
| 997 | static int __init bfin_mac_init(void) | ||
| 998 | { | ||
| 999 | return platform_driver_register(&bfin_mac_driver); | ||
| 1000 | } | ||
| 1001 | |||
| 1002 | module_init(bfin_mac_init); | ||
| 1003 | |||
| 1004 | static void __exit bfin_mac_cleanup(void) | ||
| 1005 | { | ||
| 1006 | platform_driver_unregister(&bfin_mac_driver); | ||
| 1007 | } | ||
| 1008 | |||
| 1009 | module_exit(bfin_mac_cleanup); | ||
diff --git a/drivers/net/bfin_mac.h b/drivers/net/bfin_mac.h new file mode 100644 index 000000000000..af87189b85fa --- /dev/null +++ b/drivers/net/bfin_mac.h | |||
| @@ -0,0 +1,132 @@ | |||
| 1 | /* | ||
| 2 | * File: drivers/net/bfin_mac.c | ||
| 3 | * Based on: | ||
| 4 | * Maintainer: | ||
| 5 | * Bryan Wu <bryan.wu@analog.com> | ||
| 6 | * | ||
| 7 | * Original author: | ||
| 8 | * Luke Yang <luke.yang@analog.com> | ||
| 9 | * | ||
| 10 | * Created: | ||
| 11 | * Description: | ||
| 12 | * | ||
| 13 | * Modified: | ||
| 14 | * Copyright 2004-2006 Analog Devices Inc. | ||
| 15 | * | ||
| 16 | * Bugs: Enter bugs at http://blackfin.uclinux.org/ | ||
| 17 | * | ||
| 18 | * This program is free software ; you can redistribute it and/or modify | ||
| 19 | * it under the terms of the GNU General Public License as published by | ||
| 20 | * the Free Software Foundation ; either version 2, or (at your option) | ||
| 21 | * any later version. | ||
| 22 | * | ||
| 23 | * This program is distributed in the hope that it will be useful, | ||
| 24 | * but WITHOUT ANY WARRANTY ; without even the implied warranty of | ||
| 25 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 26 | * GNU General Public License for more details. | ||
| 27 | * | ||
| 28 | * You should have received a copy of the GNU General Public License | ||
| 29 | * along with this program ; see the file COPYING. | ||
| 30 | * If not, write to the Free Software Foundation, | ||
| 31 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
| 32 | */ | ||
| 33 | |||
| 34 | /* | ||
| 35 | * PHY REGISTER NAMES | ||
| 36 | */ | ||
| 37 | #define PHYREG_MODECTL 0x0000 | ||
| 38 | #define PHYREG_MODESTAT 0x0001 | ||
| 39 | #define PHYREG_PHYID1 0x0002 | ||
| 40 | #define PHYREG_PHYID2 0x0003 | ||
| 41 | #define PHYREG_ANAR 0x0004 | ||
| 42 | #define PHYREG_ANLPAR 0x0005 | ||
| 43 | #define PHYREG_ANER 0x0006 | ||
| 44 | #define PHYREG_NSR 0x0010 | ||
| 45 | #define PHYREG_LBREMR 0x0011 | ||
| 46 | #define PHYREG_REC 0x0012 | ||
| 47 | #define PHYREG_10CFG 0x0013 | ||
| 48 | #define PHYREG_PHY1_1 0x0014 | ||
| 49 | #define PHYREG_PHY1_2 0x0015 | ||
| 50 | #define PHYREG_PHY2 0x0016 | ||
| 51 | #define PHYREG_TW_1 0x0017 | ||
| 52 | #define PHYREG_TW_2 0x0018 | ||
| 53 | #define PHYREG_TEST 0x0019 | ||
| 54 | |||
| 55 | #define PHY_RESET 0x8000 | ||
| 56 | #define PHY_ANEG_EN 0x1000 | ||
| 57 | #define PHY_DUPLEX 0x0100 | ||
| 58 | #define PHY_SPD_SET 0x2000 | ||
| 59 | |||
| 60 | #define BFIN_MAC_CSUM_OFFLOAD | ||
| 61 | |||
| 62 | struct dma_descriptor { | ||
| 63 | struct dma_descriptor *next_dma_desc; | ||
| 64 | unsigned long start_addr; | ||
| 65 | unsigned short config; | ||
| 66 | unsigned short x_count; | ||
| 67 | }; | ||
| 68 | |||
| 69 | struct status_area_rx { | ||
| 70 | #if defined(BFIN_MAC_CSUM_OFFLOAD) | ||
| 71 | unsigned short ip_hdr_csum; /* ip header checksum */ | ||
| 72 | /* ip payload(udp or tcp or others) checksum */ | ||
| 73 | unsigned short ip_payload_csum; | ||
| 74 | #endif | ||
| 75 | unsigned long status_word; /* the frame status word */ | ||
| 76 | }; | ||
| 77 | |||
| 78 | struct status_area_tx { | ||
| 79 | unsigned long status_word; /* the frame status word */ | ||
| 80 | }; | ||
| 81 | |||
| 82 | /* use two descriptors for a packet */ | ||
| 83 | struct net_dma_desc_rx { | ||
| 84 | struct net_dma_desc_rx *next; | ||
| 85 | struct sk_buff *skb; | ||
| 86 | struct dma_descriptor desc_a; | ||
| 87 | struct dma_descriptor desc_b; | ||
| 88 | struct status_area_rx status; | ||
| 89 | }; | ||
| 90 | |||
| 91 | /* use two descriptors for a packet */ | ||
| 92 | struct net_dma_desc_tx { | ||
| 93 | struct net_dma_desc_tx *next; | ||
| 94 | struct sk_buff *skb; | ||
| 95 | struct dma_descriptor desc_a; | ||
| 96 | struct dma_descriptor desc_b; | ||
| 97 | unsigned char packet[1560]; | ||
| 98 | struct status_area_tx status; | ||
| 99 | }; | ||
| 100 | |||
| 101 | struct bf537mac_local { | ||
| 102 | /* | ||
| 103 | * these are things that the kernel wants me to keep, so users | ||
| 104 | * can find out semi-useless statistics of how well the card is | ||
| 105 | * performing | ||
| 106 | */ | ||
| 107 | struct net_device_stats stats; | ||
| 108 | |||
| 109 | int version; | ||
| 110 | |||
| 111 | int FlowEnabled; /* record if data flow is active */ | ||
| 112 | int EtherIntIVG; /* IVG for the ethernet interrupt */ | ||
| 113 | int RXIVG; /* IVG for the RX completion */ | ||
| 114 | int TXIVG; /* IVG for the TX completion */ | ||
| 115 | int PhyAddr; /* PHY address */ | ||
| 116 | int OpMode; /* set these bits n the OPMODE regs */ | ||
| 117 | int Port10; /* set port speed to 10 Mbit/s */ | ||
| 118 | int GenChksums; /* IP checksums to be calculated */ | ||
| 119 | int NoRcveLnth; /* dont insert recv length at start of buffer */ | ||
| 120 | int StripPads; /* remove trailing pad bytes */ | ||
| 121 | int FullDuplex; /* set full duplex mode */ | ||
| 122 | int Negotiate; /* enable auto negotiation */ | ||
| 123 | int Loopback; /* loopback at the PHY */ | ||
| 124 | int Cache; /* Buffers may be cached */ | ||
| 125 | int FlowControl; /* flow control active */ | ||
| 126 | int CLKIN; /* clock in value in MHZ */ | ||
| 127 | unsigned short IntMask; /* interrupt mask */ | ||
| 128 | unsigned char Mac[6]; /* MAC address of the board */ | ||
| 129 | spinlock_t lock; | ||
| 130 | }; | ||
| 131 | |||
| 132 | extern void get_bf537_ether_addr(char *addr); | ||
diff --git a/drivers/net/ehea/ehea.h b/drivers/net/ehea/ehea.h index 6628fa622e2c..489c8b260dd8 100644 --- a/drivers/net/ehea/ehea.h +++ b/drivers/net/ehea/ehea.h | |||
| @@ -39,7 +39,7 @@ | |||
| 39 | #include <asm/io.h> | 39 | #include <asm/io.h> |
| 40 | 40 | ||
| 41 | #define DRV_NAME "ehea" | 41 | #define DRV_NAME "ehea" |
| 42 | #define DRV_VERSION "EHEA_0070" | 42 | #define DRV_VERSION "EHEA_0071" |
| 43 | 43 | ||
| 44 | /* eHEA capability flags */ | 44 | /* eHEA capability flags */ |
| 45 | #define DLPAR_PORT_ADD_REM 1 | 45 | #define DLPAR_PORT_ADD_REM 1 |
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c index 1d1571cf322e..4c70a9301c1b 100644 --- a/drivers/net/ehea/ehea_main.c +++ b/drivers/net/ehea/ehea_main.c | |||
| @@ -466,6 +466,8 @@ static struct ehea_cqe *ehea_proc_rwqes(struct net_device *dev, | |||
| 466 | cqe->vlan_tag); | 466 | cqe->vlan_tag); |
| 467 | else | 467 | else |
| 468 | netif_receive_skb(skb); | 468 | netif_receive_skb(skb); |
| 469 | |||
| 470 | dev->last_rx = jiffies; | ||
| 469 | } else { | 471 | } else { |
| 470 | pr->p_stats.poll_receive_errors++; | 472 | pr->p_stats.poll_receive_errors++; |
| 471 | port_reset = ehea_treat_poll_error(pr, rq, cqe, | 473 | port_reset = ehea_treat_poll_error(pr, rq, cqe, |
| @@ -1433,7 +1435,8 @@ static int ehea_broadcast_reg_helper(struct ehea_port *port, u32 hcallid) | |||
| 1433 | port->logical_port_id, | 1435 | port->logical_port_id, |
| 1434 | reg_type, port->mac_addr, 0, hcallid); | 1436 | reg_type, port->mac_addr, 0, hcallid); |
| 1435 | if (hret != H_SUCCESS) { | 1437 | if (hret != H_SUCCESS) { |
| 1436 | ehea_error("reg_dereg_bcmc failed (tagged)"); | 1438 | ehea_error("%sregistering bc address failed (tagged)", |
| 1439 | hcallid == H_REG_BCMC ? "" : "de"); | ||
| 1437 | ret = -EIO; | 1440 | ret = -EIO; |
| 1438 | goto out_herr; | 1441 | goto out_herr; |
| 1439 | } | 1442 | } |
| @@ -1444,7 +1447,8 @@ static int ehea_broadcast_reg_helper(struct ehea_port *port, u32 hcallid) | |||
| 1444 | port->logical_port_id, | 1447 | port->logical_port_id, |
| 1445 | reg_type, port->mac_addr, 0, hcallid); | 1448 | reg_type, port->mac_addr, 0, hcallid); |
| 1446 | if (hret != H_SUCCESS) { | 1449 | if (hret != H_SUCCESS) { |
| 1447 | ehea_error("reg_dereg_bcmc failed (vlan)"); | 1450 | ehea_error("%sregistering bc address failed (vlan)", |
| 1451 | hcallid == H_REG_BCMC ? "" : "de"); | ||
| 1448 | ret = -EIO; | 1452 | ret = -EIO; |
| 1449 | } | 1453 | } |
| 1450 | out_herr: | 1454 | out_herr: |
| @@ -2170,7 +2174,6 @@ static int ehea_up(struct net_device *dev) | |||
| 2170 | { | 2174 | { |
| 2171 | int ret, i; | 2175 | int ret, i; |
| 2172 | struct ehea_port *port = netdev_priv(dev); | 2176 | struct ehea_port *port = netdev_priv(dev); |
| 2173 | u64 mac_addr = 0; | ||
| 2174 | 2177 | ||
| 2175 | if (port->state == EHEA_PORT_UP) | 2178 | if (port->state == EHEA_PORT_UP) |
| 2176 | return 0; | 2179 | return 0; |
| @@ -2189,18 +2192,10 @@ static int ehea_up(struct net_device *dev) | |||
| 2189 | goto out_clean_pr; | 2192 | goto out_clean_pr; |
| 2190 | } | 2193 | } |
| 2191 | 2194 | ||
| 2192 | ret = ehea_broadcast_reg_helper(port, H_REG_BCMC); | ||
| 2193 | if (ret) { | ||
| 2194 | ret = -EIO; | ||
| 2195 | ehea_error("out_clean_pr"); | ||
| 2196 | goto out_clean_pr; | ||
| 2197 | } | ||
| 2198 | mac_addr = (*(u64*)dev->dev_addr) >> 16; | ||
| 2199 | |||
| 2200 | ret = ehea_reg_interrupts(dev); | 2195 | ret = ehea_reg_interrupts(dev); |
| 2201 | if (ret) { | 2196 | if (ret) { |
| 2202 | ehea_error("out_dereg_bc"); | 2197 | ehea_error("reg_interrupts failed. ret:%d", ret); |
| 2203 | goto out_dereg_bc; | 2198 | goto out_clean_pr; |
| 2204 | } | 2199 | } |
| 2205 | 2200 | ||
| 2206 | for(i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++) { | 2201 | for(i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++) { |
| @@ -2226,9 +2221,6 @@ static int ehea_up(struct net_device *dev) | |||
| 2226 | out_free_irqs: | 2221 | out_free_irqs: |
| 2227 | ehea_free_interrupts(dev); | 2222 | ehea_free_interrupts(dev); |
| 2228 | 2223 | ||
| 2229 | out_dereg_bc: | ||
| 2230 | ehea_broadcast_reg_helper(port, H_DEREG_BCMC); | ||
| 2231 | |||
| 2232 | out_clean_pr: | 2224 | out_clean_pr: |
| 2233 | ehea_clean_all_portres(port); | 2225 | ehea_clean_all_portres(port); |
| 2234 | out: | 2226 | out: |
| @@ -2273,7 +2265,6 @@ static int ehea_down(struct net_device *dev) | |||
| 2273 | &port->port_res[i].d_netdev->state)) | 2265 | &port->port_res[i].d_netdev->state)) |
| 2274 | msleep(1); | 2266 | msleep(1); |
| 2275 | 2267 | ||
| 2276 | ehea_broadcast_reg_helper(port, H_DEREG_BCMC); | ||
| 2277 | port->state = EHEA_PORT_DOWN; | 2268 | port->state = EHEA_PORT_DOWN; |
| 2278 | 2269 | ||
| 2279 | ret = ehea_clean_all_portres(port); | 2270 | ret = ehea_clean_all_portres(port); |
| @@ -2655,12 +2646,18 @@ struct ehea_port *ehea_setup_single_port(struct ehea_adapter *adapter, | |||
| 2655 | 2646 | ||
| 2656 | INIT_WORK(&port->reset_task, ehea_reset_port); | 2647 | INIT_WORK(&port->reset_task, ehea_reset_port); |
| 2657 | 2648 | ||
| 2649 | ret = ehea_broadcast_reg_helper(port, H_REG_BCMC); | ||
| 2650 | if (ret) { | ||
| 2651 | ret = -EIO; | ||
| 2652 | goto out_unreg_port; | ||
| 2653 | } | ||
| 2654 | |||
| 2658 | ehea_set_ethtool_ops(dev); | 2655 | ehea_set_ethtool_ops(dev); |
| 2659 | 2656 | ||
| 2660 | ret = register_netdev(dev); | 2657 | ret = register_netdev(dev); |
| 2661 | if (ret) { | 2658 | if (ret) { |
| 2662 | ehea_error("register_netdev failed. ret=%d", ret); | 2659 | ehea_error("register_netdev failed. ret=%d", ret); |
| 2663 | goto out_unreg_port; | 2660 | goto out_dereg_bc; |
| 2664 | } | 2661 | } |
| 2665 | 2662 | ||
| 2666 | ret = ehea_get_jumboframe_status(port, &jumbo); | 2663 | ret = ehea_get_jumboframe_status(port, &jumbo); |
| @@ -2675,6 +2672,9 @@ struct ehea_port *ehea_setup_single_port(struct ehea_adapter *adapter, | |||
| 2675 | 2672 | ||
| 2676 | return port; | 2673 | return port; |
| 2677 | 2674 | ||
| 2675 | out_dereg_bc: | ||
| 2676 | ehea_broadcast_reg_helper(port, H_DEREG_BCMC); | ||
| 2677 | |||
| 2678 | out_unreg_port: | 2678 | out_unreg_port: |
| 2679 | ehea_unregister_port(port); | 2679 | ehea_unregister_port(port); |
| 2680 | 2680 | ||
| @@ -2694,6 +2694,7 @@ static void ehea_shutdown_single_port(struct ehea_port *port) | |||
| 2694 | { | 2694 | { |
| 2695 | unregister_netdev(port->netdev); | 2695 | unregister_netdev(port->netdev); |
| 2696 | ehea_unregister_port(port); | 2696 | ehea_unregister_port(port); |
| 2697 | ehea_broadcast_reg_helper(port, H_DEREG_BCMC); | ||
| 2697 | kfree(port->mc_list); | 2698 | kfree(port->mc_list); |
| 2698 | free_netdev(port->netdev); | 2699 | free_netdev(port->netdev); |
| 2699 | port->adapter->active_ports--; | 2700 | port->adapter->active_ports--; |
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c index d7a1a58de766..f92690555dd9 100644 --- a/drivers/net/gianfar.c +++ b/drivers/net/gianfar.c | |||
| @@ -420,8 +420,18 @@ static phy_interface_t gfar_get_interface(struct net_device *dev) | |||
| 420 | if (ecntrl & ECNTRL_REDUCED_MODE) { | 420 | if (ecntrl & ECNTRL_REDUCED_MODE) { |
| 421 | if (ecntrl & ECNTRL_REDUCED_MII_MODE) | 421 | if (ecntrl & ECNTRL_REDUCED_MII_MODE) |
| 422 | return PHY_INTERFACE_MODE_RMII; | 422 | return PHY_INTERFACE_MODE_RMII; |
| 423 | else | 423 | else { |
| 424 | phy_interface_t interface = priv->einfo->interface; | ||
| 425 | |||
| 426 | /* | ||
| 427 | * This isn't autodetected right now, so it must | ||
| 428 | * be set by the device tree or platform code. | ||
| 429 | */ | ||
| 430 | if (interface == PHY_INTERFACE_MODE_RGMII_ID) | ||
| 431 | return PHY_INTERFACE_MODE_RGMII_ID; | ||
| 432 | |||
| 424 | return PHY_INTERFACE_MODE_RGMII; | 433 | return PHY_INTERFACE_MODE_RGMII; |
| 434 | } | ||
| 425 | } | 435 | } |
| 426 | 436 | ||
| 427 | if (priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_GIGABIT) | 437 | if (priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_GIGABIT) |
diff --git a/drivers/net/ni5010.c b/drivers/net/ni5010.c index 3d5b4232f65f..22a3b3dc7d89 100644 --- a/drivers/net/ni5010.c +++ b/drivers/net/ni5010.c | |||
| @@ -670,14 +670,10 @@ static void ni5010_set_multicast_list(struct net_device *dev) | |||
| 670 | 670 | ||
| 671 | PRINTK2((KERN_DEBUG "%s: entering set_multicast_list\n", dev->name)); | 671 | PRINTK2((KERN_DEBUG "%s: entering set_multicast_list\n", dev->name)); |
| 672 | 672 | ||
| 673 | if (dev->flags&IFF_PROMISC || dev->flags&IFF_ALLMULTI) { | 673 | if (dev->flags&IFF_PROMISC || dev->flags&IFF_ALLMULTI || dev->mc_list) { |
| 674 | dev->flags |= IFF_PROMISC; | 674 | dev->flags |= IFF_PROMISC; |
| 675 | outb(RMD_PROMISC, EDLC_RMODE); /* Enable promiscuous mode */ | 675 | outb(RMD_PROMISC, EDLC_RMODE); /* Enable promiscuous mode */ |
| 676 | PRINTK((KERN_DEBUG "%s: Entering promiscuous mode\n", dev->name)); | 676 | PRINTK((KERN_DEBUG "%s: Entering promiscuous mode\n", dev->name)); |
| 677 | } else if (dev->mc_list) { | ||
| 678 | /* Sorry, multicast not supported */ | ||
| 679 | PRINTK((KERN_DEBUG "%s: No multicast, entering broadcast mode\n", dev->name)); | ||
| 680 | outb(RMD_BROADCAST, EDLC_RMODE); | ||
| 681 | } else { | 677 | } else { |
| 682 | PRINTK((KERN_DEBUG "%s: Entering broadcast mode\n", dev->name)); | 678 | PRINTK((KERN_DEBUG "%s: Entering broadcast mode\n", dev->name)); |
| 683 | outb(RMD_BROADCAST, EDLC_RMODE); /* Disable promiscuous mode, use normal mode */ | 679 | outb(RMD_BROADCAST, EDLC_RMODE); /* Disable promiscuous mode, use normal mode */ |
diff --git a/drivers/net/ns83820.c b/drivers/net/ns83820.c index 104aab3c957f..ea80e6cb3dec 100644 --- a/drivers/net/ns83820.c +++ b/drivers/net/ns83820.c | |||
| @@ -1582,7 +1582,7 @@ static void ns83820_set_multicast(struct net_device *ndev) | |||
| 1582 | else | 1582 | else |
| 1583 | and_mask &= ~(RFCR_AAU | RFCR_AAM); | 1583 | and_mask &= ~(RFCR_AAU | RFCR_AAM); |
| 1584 | 1584 | ||
| 1585 | if (ndev->flags & IFF_ALLMULTI) | 1585 | if (ndev->flags & IFF_ALLMULTI || ndev->mc_count) |
| 1586 | or_mask |= RFCR_AAM; | 1586 | or_mask |= RFCR_AAM; |
| 1587 | else | 1587 | else |
| 1588 | and_mask &= ~RFCR_AAM; | 1588 | and_mask &= ~RFCR_AAM; |
diff --git a/drivers/net/phy/vitesse.c b/drivers/net/phy/vitesse.c index 596222b260d6..6a5385647911 100644 --- a/drivers/net/phy/vitesse.c +++ b/drivers/net/phy/vitesse.c | |||
| @@ -21,6 +21,10 @@ | |||
| 21 | /* Vitesse Extended Control Register 1 */ | 21 | /* Vitesse Extended Control Register 1 */ |
| 22 | #define MII_VSC8244_EXT_CON1 0x17 | 22 | #define MII_VSC8244_EXT_CON1 0x17 |
| 23 | #define MII_VSC8244_EXTCON1_INIT 0x0000 | 23 | #define MII_VSC8244_EXTCON1_INIT 0x0000 |
| 24 | #define MII_VSC8244_EXTCON1_TX_SKEW_MASK 0x0c00 | ||
| 25 | #define MII_VSC8244_EXTCON1_RX_SKEW_MASK 0x0300 | ||
| 26 | #define MII_VSC8244_EXTCON1_TX_SKEW 0x0800 | ||
| 27 | #define MII_VSC8244_EXTCON1_RX_SKEW 0x0200 | ||
| 24 | 28 | ||
| 25 | /* Vitesse Interrupt Mask Register */ | 29 | /* Vitesse Interrupt Mask Register */ |
| 26 | #define MII_VSC8244_IMASK 0x19 | 30 | #define MII_VSC8244_IMASK 0x19 |
| @@ -39,7 +43,7 @@ | |||
| 39 | 43 | ||
| 40 | /* Vitesse Auxiliary Control/Status Register */ | 44 | /* Vitesse Auxiliary Control/Status Register */ |
| 41 | #define MII_VSC8244_AUX_CONSTAT 0x1c | 45 | #define MII_VSC8244_AUX_CONSTAT 0x1c |
| 42 | #define MII_VSC8244_AUXCONSTAT_INIT 0x0004 | 46 | #define MII_VSC8244_AUXCONSTAT_INIT 0x0000 |
| 43 | #define MII_VSC8244_AUXCONSTAT_DUPLEX 0x0020 | 47 | #define MII_VSC8244_AUXCONSTAT_DUPLEX 0x0020 |
| 44 | #define MII_VSC8244_AUXCONSTAT_SPEED 0x0018 | 48 | #define MII_VSC8244_AUXCONSTAT_SPEED 0x0018 |
| 45 | #define MII_VSC8244_AUXCONSTAT_GBIT 0x0010 | 49 | #define MII_VSC8244_AUXCONSTAT_GBIT 0x0010 |
| @@ -51,6 +55,7 @@ MODULE_LICENSE("GPL"); | |||
| 51 | 55 | ||
| 52 | static int vsc824x_config_init(struct phy_device *phydev) | 56 | static int vsc824x_config_init(struct phy_device *phydev) |
| 53 | { | 57 | { |
| 58 | int extcon; | ||
| 54 | int err; | 59 | int err; |
| 55 | 60 | ||
| 56 | err = phy_write(phydev, MII_VSC8244_AUX_CONSTAT, | 61 | err = phy_write(phydev, MII_VSC8244_AUX_CONSTAT, |
| @@ -58,14 +63,34 @@ static int vsc824x_config_init(struct phy_device *phydev) | |||
| 58 | if (err < 0) | 63 | if (err < 0) |
| 59 | return err; | 64 | return err; |
| 60 | 65 | ||
| 61 | err = phy_write(phydev, MII_VSC8244_EXT_CON1, | 66 | extcon = phy_read(phydev, MII_VSC8244_EXT_CON1); |
| 62 | MII_VSC8244_EXTCON1_INIT); | 67 | |
| 68 | if (extcon < 0) | ||
| 69 | return err; | ||
| 70 | |||
| 71 | extcon &= ~(MII_VSC8244_EXTCON1_TX_SKEW_MASK | | ||
| 72 | MII_VSC8244_EXTCON1_RX_SKEW_MASK); | ||
| 73 | |||
| 74 | if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) | ||
| 75 | extcon |= (MII_VSC8244_EXTCON1_TX_SKEW | | ||
| 76 | MII_VSC8244_EXTCON1_RX_SKEW); | ||
| 77 | |||
| 78 | err = phy_write(phydev, MII_VSC8244_EXT_CON1, extcon); | ||
| 79 | |||
| 63 | return err; | 80 | return err; |
| 64 | } | 81 | } |
| 65 | 82 | ||
| 66 | static int vsc824x_ack_interrupt(struct phy_device *phydev) | 83 | static int vsc824x_ack_interrupt(struct phy_device *phydev) |
| 67 | { | 84 | { |
| 68 | int err = phy_read(phydev, MII_VSC8244_ISTAT); | 85 | int err = 0; |
| 86 | |||
| 87 | /* | ||
| 88 | * Don't bother to ACK the interrupts if interrupts | ||
| 89 | * are disabled. The 824x cannot clear the interrupts | ||
| 90 | * if they are disabled. | ||
| 91 | */ | ||
| 92 | if (phydev->interrupts == PHY_INTERRUPT_ENABLED) | ||
| 93 | err = phy_read(phydev, MII_VSC8244_ISTAT); | ||
| 69 | 94 | ||
| 70 | return (err < 0) ? err : 0; | 95 | return (err < 0) ? err : 0; |
| 71 | } | 96 | } |
| @@ -77,8 +102,19 @@ static int vsc824x_config_intr(struct phy_device *phydev) | |||
| 77 | if (phydev->interrupts == PHY_INTERRUPT_ENABLED) | 102 | if (phydev->interrupts == PHY_INTERRUPT_ENABLED) |
| 78 | err = phy_write(phydev, MII_VSC8244_IMASK, | 103 | err = phy_write(phydev, MII_VSC8244_IMASK, |
| 79 | MII_VSC8244_IMASK_MASK); | 104 | MII_VSC8244_IMASK_MASK); |
| 80 | else | 105 | else { |
| 106 | /* | ||
| 107 | * The Vitesse PHY cannot clear the interrupt | ||
| 108 | * once it has disabled them, so we clear them first | ||
| 109 | */ | ||
| 110 | err = phy_read(phydev, MII_VSC8244_ISTAT); | ||
| 111 | |||
| 112 | if (err) | ||
| 113 | return err; | ||
| 114 | |||
| 81 | err = phy_write(phydev, MII_VSC8244_IMASK, 0); | 115 | err = phy_write(phydev, MII_VSC8244_IMASK, 0); |
| 116 | } | ||
| 117 | |||
| 82 | return err; | 118 | return err; |
| 83 | } | 119 | } |
| 84 | 120 | ||
diff --git a/drivers/net/saa9730.c b/drivers/net/saa9730.c index 451486b32f23..7dae4d404978 100644 --- a/drivers/net/saa9730.c +++ b/drivers/net/saa9730.c | |||
| @@ -940,15 +940,14 @@ static void lan_saa9730_set_multicast(struct net_device *dev) | |||
| 940 | CAM_CONTROL_GROUP_ACC | CAM_CONTROL_BROAD_ACC, | 940 | CAM_CONTROL_GROUP_ACC | CAM_CONTROL_BROAD_ACC, |
| 941 | &lp->lan_saa9730_regs->CamCtl); | 941 | &lp->lan_saa9730_regs->CamCtl); |
| 942 | } else { | 942 | } else { |
| 943 | if (dev->flags & IFF_ALLMULTI) { | 943 | if (dev->flags & IFF_ALLMULTI || dev->mc_count) { |
| 944 | /* accept all multicast packets */ | 944 | /* accept all multicast packets */ |
| 945 | writel(CAM_CONTROL_COMP_EN | CAM_CONTROL_GROUP_ACC | | ||
| 946 | CAM_CONTROL_BROAD_ACC, | ||
| 947 | &lp->lan_saa9730_regs->CamCtl); | ||
| 948 | } else { | ||
| 949 | /* | 945 | /* |
| 950 | * Will handle the multicast stuff later. -carstenl | 946 | * Will handle the multicast stuff later. -carstenl |
| 951 | */ | 947 | */ |
| 948 | writel(CAM_CONTROL_COMP_EN | CAM_CONTROL_GROUP_ACC | | ||
| 949 | CAM_CONTROL_BROAD_ACC, | ||
| 950 | &lp->lan_saa9730_regs->CamCtl); | ||
| 952 | } | 951 | } |
| 953 | } | 952 | } |
| 954 | 953 | ||
diff --git a/drivers/net/tc35815.c b/drivers/net/tc35815.c index 75655add3f34..7f94ca930988 100644 --- a/drivers/net/tc35815.c +++ b/drivers/net/tc35815.c | |||
| @@ -626,7 +626,7 @@ static int __devinit tc35815_read_plat_dev_addr(struct net_device *dev) | |||
| 626 | return -ENODEV; | 626 | return -ENODEV; |
| 627 | } | 627 | } |
| 628 | #else | 628 | #else |
| 629 | static int __devinit tc35815_read_plat_dev_addr(struct device *dev) | 629 | static int __devinit tc35815_read_plat_dev_addr(struct net_device *dev) |
| 630 | { | 630 | { |
| 631 | return -ENODEV; | 631 | return -ENODEV; |
| 632 | } | 632 | } |
diff --git a/drivers/net/wireless/ipw2100.c b/drivers/net/wireless/ipw2100.c index 072ede71e575..8990585bd228 100644 --- a/drivers/net/wireless/ipw2100.c +++ b/drivers/net/wireless/ipw2100.c | |||
| @@ -7868,10 +7868,10 @@ static int ipw2100_wx_set_powermode(struct net_device *dev, | |||
| 7868 | goto done; | 7868 | goto done; |
| 7869 | } | 7869 | } |
| 7870 | 7870 | ||
| 7871 | if ((mode < 1) || (mode > POWER_MODES)) | 7871 | if ((mode < 0) || (mode > POWER_MODES)) |
| 7872 | mode = IPW_POWER_AUTO; | 7872 | mode = IPW_POWER_AUTO; |
| 7873 | 7873 | ||
| 7874 | if (priv->power_mode != mode) | 7874 | if (IPW_POWER_LEVEL(priv->power_mode) != mode) |
| 7875 | err = ipw2100_set_power_mode(priv, mode); | 7875 | err = ipw2100_set_power_mode(priv, mode); |
| 7876 | done: | 7876 | done: |
| 7877 | mutex_unlock(&priv->action_mutex); | 7877 | mutex_unlock(&priv->action_mutex); |
| @@ -7902,7 +7902,7 @@ static int ipw2100_wx_get_powermode(struct net_device *dev, | |||
| 7902 | break; | 7902 | break; |
| 7903 | case IPW_POWER_AUTO: | 7903 | case IPW_POWER_AUTO: |
| 7904 | snprintf(extra, MAX_POWER_STRING, | 7904 | snprintf(extra, MAX_POWER_STRING, |
| 7905 | "Power save level: %d (Auto)", 0); | 7905 | "Power save level: %d (Auto)", level); |
| 7906 | break; | 7906 | break; |
| 7907 | default: | 7907 | default: |
| 7908 | timeout = timeout_duration[level - 1] / 1000; | 7908 | timeout = timeout_duration[level - 1] / 1000; |
diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index aa32a97380ec..61497c467467 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c | |||
| @@ -70,7 +70,7 @@ | |||
| 70 | #define VQ | 70 | #define VQ |
| 71 | #endif | 71 | #endif |
| 72 | 72 | ||
| 73 | #define IPW2200_VERSION "1.2.0" VK VD VM VP VR VQ | 73 | #define IPW2200_VERSION "1.2.2" VK VD VM VP VR VQ |
| 74 | #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2200/2915 Network Driver" | 74 | #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2200/2915 Network Driver" |
| 75 | #define DRV_COPYRIGHT "Copyright(c) 2003-2006 Intel Corporation" | 75 | #define DRV_COPYRIGHT "Copyright(c) 2003-2006 Intel Corporation" |
| 76 | #define DRV_VERSION IPW2200_VERSION | 76 | #define DRV_VERSION IPW2200_VERSION |
| @@ -2506,7 +2506,7 @@ static int ipw_send_power_mode(struct ipw_priv *priv, u32 mode) | |||
| 2506 | break; | 2506 | break; |
| 2507 | } | 2507 | } |
| 2508 | 2508 | ||
| 2509 | param = cpu_to_le32(mode); | 2509 | param = cpu_to_le32(param); |
| 2510 | return ipw_send_cmd_pdu(priv, IPW_CMD_POWER_MODE, sizeof(param), | 2510 | return ipw_send_cmd_pdu(priv, IPW_CMD_POWER_MODE, sizeof(param), |
| 2511 | ¶m); | 2511 | ¶m); |
| 2512 | } | 2512 | } |
| @@ -9568,6 +9568,7 @@ static int ipw_wx_set_power(struct net_device *dev, | |||
| 9568 | priv->power_mode = IPW_POWER_ENABLED | IPW_POWER_BATTERY; | 9568 | priv->power_mode = IPW_POWER_ENABLED | IPW_POWER_BATTERY; |
| 9569 | else | 9569 | else |
| 9570 | priv->power_mode = IPW_POWER_ENABLED | priv->power_mode; | 9570 | priv->power_mode = IPW_POWER_ENABLED | priv->power_mode; |
| 9571 | |||
| 9571 | err = ipw_send_power_mode(priv, IPW_POWER_LEVEL(priv->power_mode)); | 9572 | err = ipw_send_power_mode(priv, IPW_POWER_LEVEL(priv->power_mode)); |
| 9572 | if (err) { | 9573 | if (err) { |
| 9573 | IPW_DEBUG_WX("failed setting power mode.\n"); | 9574 | IPW_DEBUG_WX("failed setting power mode.\n"); |
| @@ -9604,22 +9605,19 @@ static int ipw_wx_set_powermode(struct net_device *dev, | |||
| 9604 | struct ipw_priv *priv = ieee80211_priv(dev); | 9605 | struct ipw_priv *priv = ieee80211_priv(dev); |
| 9605 | int mode = *(int *)extra; | 9606 | int mode = *(int *)extra; |
| 9606 | int err; | 9607 | int err; |
| 9608 | |||
| 9607 | mutex_lock(&priv->mutex); | 9609 | mutex_lock(&priv->mutex); |
| 9608 | if ((mode < 1) || (mode > IPW_POWER_LIMIT)) { | 9610 | if ((mode < 1) || (mode > IPW_POWER_LIMIT)) |
| 9609 | mode = IPW_POWER_AC; | 9611 | mode = IPW_POWER_AC; |
| 9610 | priv->power_mode = mode; | ||
| 9611 | } else { | ||
| 9612 | priv->power_mode = IPW_POWER_ENABLED | mode; | ||
| 9613 | } | ||
| 9614 | 9612 | ||
| 9615 | if (priv->power_mode != mode) { | 9613 | if (IPW_POWER_LEVEL(priv->power_mode) != mode) { |
| 9616 | err = ipw_send_power_mode(priv, mode); | 9614 | err = ipw_send_power_mode(priv, mode); |
| 9617 | |||
| 9618 | if (err) { | 9615 | if (err) { |
| 9619 | IPW_DEBUG_WX("failed setting power mode.\n"); | 9616 | IPW_DEBUG_WX("failed setting power mode.\n"); |
| 9620 | mutex_unlock(&priv->mutex); | 9617 | mutex_unlock(&priv->mutex); |
| 9621 | return err; | 9618 | return err; |
| 9622 | } | 9619 | } |
| 9620 | priv->power_mode = IPW_POWER_ENABLED | mode; | ||
| 9623 | } | 9621 | } |
| 9624 | mutex_unlock(&priv->mutex); | 9622 | mutex_unlock(&priv->mutex); |
| 9625 | return 0; | 9623 | return 0; |
| @@ -10555,7 +10553,7 @@ static irqreturn_t ipw_isr(int irq, void *data) | |||
| 10555 | spin_lock(&priv->irq_lock); | 10553 | spin_lock(&priv->irq_lock); |
| 10556 | 10554 | ||
| 10557 | if (!(priv->status & STATUS_INT_ENABLED)) { | 10555 | if (!(priv->status & STATUS_INT_ENABLED)) { |
| 10558 | /* Shared IRQ */ | 10556 | /* IRQ is disabled */ |
| 10559 | goto none; | 10557 | goto none; |
| 10560 | } | 10558 | } |
| 10561 | 10559 | ||
diff --git a/drivers/net/wireless/zd1211rw/zd_usb.c b/drivers/net/wireless/zd1211rw/zd_usb.c index 28d41a29d7b1..a9c339ef116a 100644 --- a/drivers/net/wireless/zd1211rw/zd_usb.c +++ b/drivers/net/wireless/zd1211rw/zd_usb.c | |||
| @@ -72,6 +72,8 @@ static struct usb_device_id usb_ids[] = { | |||
| 72 | { USB_DEVICE(0x0586, 0x3413), .driver_info = DEVICE_ZD1211B }, | 72 | { USB_DEVICE(0x0586, 0x3413), .driver_info = DEVICE_ZD1211B }, |
| 73 | { USB_DEVICE(0x0053, 0x5301), .driver_info = DEVICE_ZD1211B }, | 73 | { USB_DEVICE(0x0053, 0x5301), .driver_info = DEVICE_ZD1211B }, |
| 74 | { USB_DEVICE(0x0411, 0x00da), .driver_info = DEVICE_ZD1211B }, | 74 | { USB_DEVICE(0x0411, 0x00da), .driver_info = DEVICE_ZD1211B }, |
| 75 | { USB_DEVICE(0x2019, 0x5303), .driver_info = DEVICE_ZD1211B }, | ||
| 76 | { USB_DEVICE(0x129b, 0x1667), .driver_info = DEVICE_ZD1211B }, | ||
| 75 | /* "Driverless" devices that need ejecting */ | 77 | /* "Driverless" devices that need ejecting */ |
| 76 | { USB_DEVICE(0x0ace, 0x2011), .driver_info = DEVICE_INSTALLER }, | 78 | { USB_DEVICE(0x0ace, 0x2011), .driver_info = DEVICE_INSTALLER }, |
| 77 | { USB_DEVICE(0x0ace, 0x20ff), .driver_info = DEVICE_INSTALLER }, | 79 | { USB_DEVICE(0x0ace, 0x20ff), .driver_info = DEVICE_INSTALLER }, |
diff --git a/include/linux/fsl_devices.h b/include/linux/fsl_devices.h index 695741b0e420..1831b196c70a 100644 --- a/include/linux/fsl_devices.h +++ b/include/linux/fsl_devices.h | |||
| @@ -53,6 +53,7 @@ struct gianfar_platform_data { | |||
| 53 | u32 bus_id; | 53 | u32 bus_id; |
| 54 | u32 phy_id; | 54 | u32 phy_id; |
| 55 | u8 mac_addr[6]; | 55 | u8 mac_addr[6]; |
| 56 | phy_interface_t interface; | ||
| 56 | }; | 57 | }; |
| 57 | 58 | ||
| 58 | struct gianfar_mdio_data { | 59 | struct gianfar_mdio_data { |
diff --git a/net/ieee80211/ieee80211_wx.c b/net/ieee80211/ieee80211_wx.c index 523a137d49dd..465b73d50532 100644 --- a/net/ieee80211/ieee80211_wx.c +++ b/net/ieee80211/ieee80211_wx.c | |||
| @@ -90,14 +90,11 @@ static char *ieee80211_translate_scan(struct ieee80211_device *ieee, | |||
| 90 | } | 90 | } |
| 91 | 91 | ||
| 92 | /* Add channel and frequency */ | 92 | /* Add channel and frequency */ |
| 93 | /* Note : userspace automatically computes channel using iwrange */ | ||
| 93 | iwe.cmd = SIOCGIWFREQ; | 94 | iwe.cmd = SIOCGIWFREQ; |
| 94 | iwe.u.freq.m = network->channel; | ||
| 95 | iwe.u.freq.e = 0; | ||
| 96 | iwe.u.freq.i = 0; | ||
| 97 | start = iwe_stream_add_event(start, stop, &iwe, IW_EV_FREQ_LEN); | ||
| 98 | |||
| 99 | iwe.u.freq.m = ieee80211_channel_to_freq(ieee, network->channel); | 95 | iwe.u.freq.m = ieee80211_channel_to_freq(ieee, network->channel); |
| 100 | iwe.u.freq.e = 6; | 96 | iwe.u.freq.e = 6; |
| 97 | iwe.u.freq.i = 0; | ||
| 101 | start = iwe_stream_add_event(start, stop, &iwe, IW_EV_FREQ_LEN); | 98 | start = iwe_stream_add_event(start, stop, &iwe, IW_EV_FREQ_LEN); |
| 102 | 99 | ||
| 103 | /* Add encryption capability */ | 100 | /* Add encryption capability */ |
