mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 12:17:12 +09:00
usb Ether works ok
This commit is contained in:
@@ -192,12 +192,12 @@ CONFIG_BLK_DEV_DM=y
|
||||
CONFIG_DM_CRYPT=y
|
||||
CONFIG_DM_UEVENT=y
|
||||
CONFIG_NETDEVICES=y
|
||||
CONFIG_NET_ETHERNET=y
|
||||
CONFIG_RK29_VMAC=y
|
||||
CONFIG_PHYLIB=y
|
||||
# CONFIG_NETDEV_1000 is not set
|
||||
# CONFIG_NETDEV_10000 is not set
|
||||
CONFIG_WLAN_80211=y
|
||||
CONFIG_BCM4329=y
|
||||
CONFIG_USB_USBNET=y
|
||||
CONFIG_PPP=y
|
||||
CONFIG_PPP_MULTILINK=y
|
||||
CONFIG_PPP_FILTER=y
|
||||
|
||||
@@ -19,9 +19,9 @@
|
||||
* V1.5 - Support RK2818 (Debug the Register Function)
|
||||
*/
|
||||
|
||||
//#define DEBUG
|
||||
#define DEBUG
|
||||
|
||||
#define RK2818
|
||||
//#define RK2818
|
||||
|
||||
|
||||
#include <linux/module.h>
|
||||
@@ -525,31 +525,31 @@ static struct ethtool_ops dm9620_ethtool_ops = {
|
||||
|
||||
static void dm9620_set_multicast(struct net_device *net)
|
||||
{
|
||||
struct usbnet *dev = netdev_priv(net);
|
||||
/* We use the 20 byte dev->data for our 8 byte filter buffer
|
||||
* to avoid allocating memory that is tricky to free later */
|
||||
u8 *hashes = (u8 *) & dev->data;
|
||||
u8 rx_ctl = 0x31;
|
||||
struct usbnet *dev = netdev_priv(net);
|
||||
/* We use the 20 byte dev->data for our 8 byte filter buffer
|
||||
* to avoid allocating memory that is tricky to free later */
|
||||
u8 *hashes = (u8 *) & dev->data;
|
||||
u8 rx_ctl = 0x31;
|
||||
|
||||
memset(hashes, 0x00, DM_MCAST_SIZE);
|
||||
hashes[DM_MCAST_SIZE - 1] |= 0x80; /* broadcast address */
|
||||
memset(hashes, 0x00, DM_MCAST_SIZE);
|
||||
hashes[DM_MCAST_SIZE - 1] |= 0x80; /* broadcast address */
|
||||
|
||||
if (net->flags & IFF_PROMISC) {
|
||||
rx_ctl |= 0x02;
|
||||
} else if (net->flags & IFF_ALLMULTI || net->mc_count > DM_MAX_MCAST) {
|
||||
rx_ctl |= 0x04;
|
||||
} else if (net->mc_count) {
|
||||
struct dev_mc_list *mc_list = net->mc_list;
|
||||
int i;
|
||||
if (net->flags & IFF_PROMISC) {
|
||||
rx_ctl |= 0x02;
|
||||
} else if (net->flags & IFF_ALLMULTI ||
|
||||
netdev_mc_count(net) > DM_MAX_MCAST) {
|
||||
rx_ctl |= 0x04;
|
||||
} else if (!netdev_mc_empty(net)) {
|
||||
struct netdev_hw_addr *ha;
|
||||
|
||||
for (i = 0; i < net->mc_count; i++, mc_list = mc_list->next) {
|
||||
u32 crc = ether_crc(ETH_ALEN, mc_list->dmi_addr) >> 26;
|
||||
hashes[crc >> 3] |= 1 << (crc & 0x7);
|
||||
}
|
||||
}
|
||||
netdev_for_each_mc_addr(ha, net) {
|
||||
u32 crc = ether_crc(ETH_ALEN, ha->addr) >> 26;
|
||||
hashes[crc >> 3] |= 1 << (crc & 0x7);
|
||||
}
|
||||
}
|
||||
|
||||
dm_write_async(dev, DM_MCAST_ADDR, DM_MCAST_SIZE, hashes);
|
||||
dm_write_reg_async(dev, DM_RX_CTRL, rx_ctl);
|
||||
dm_write_async(dev, DM_MCAST_ADDR, DM_MCAST_SIZE, hashes);
|
||||
dm_write_reg_async(dev, DM_RX_CTRL, rx_ctl);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
* kind, whether express or implied.
|
||||
*/
|
||||
|
||||
//#define DEBUG
|
||||
#define DEBUG
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/sched.h>
|
||||
@@ -353,31 +353,31 @@ static const struct ethtool_ops sr9700_android_ethtool_ops = {
|
||||
|
||||
static void sr9700_android_set_multicast(struct net_device *net)
|
||||
{
|
||||
struct usbnet *dev = netdev_priv(net);
|
||||
/* We use the 20 byte dev->data for our 8 byte filter buffer
|
||||
* to avoid allocating memory that is tricky to free later */
|
||||
u8 *hashes = (u8 *) & dev->data;
|
||||
u8 rx_ctl = 0x31; // enable, disable_long, disable_crc
|
||||
struct usbnet *dev = netdev_priv(net);
|
||||
/* We use the 20 byte dev->data for our 8 byte filter buffer
|
||||
* to avoid allocating memory that is tricky to free later */
|
||||
u8 *hashes = (u8 *) & dev->data;
|
||||
u8 rx_ctl = 0x31;
|
||||
|
||||
memset(hashes, 0x00, QF_MCAST_SIZE);
|
||||
hashes[QF_MCAST_SIZE - 1] |= 0x80; /* broadcast address */
|
||||
memset(hashes, 0x00, QF_MCAST_SIZE);
|
||||
hashes[QF_MCAST_SIZE - 1] |= 0x80; /* broadcast address */
|
||||
|
||||
if (net->flags & IFF_PROMISC) {
|
||||
rx_ctl |= 0x02;
|
||||
} else if (net->flags & IFF_ALLMULTI || net->mc_count > QF_MCAST_MAX) {
|
||||
rx_ctl |= 0x04;
|
||||
} else if (net->mc_count) {
|
||||
struct dev_mc_list *mc_list = net->mc_list;
|
||||
int i;
|
||||
if (net->flags & IFF_PROMISC) {
|
||||
rx_ctl |= 0x02;
|
||||
} else if (net->flags & IFF_ALLMULTI ||
|
||||
netdev_mc_count(net) > QF_MCAST_MAX) {
|
||||
rx_ctl |= 0x04;
|
||||
} else if (!netdev_mc_empty(net)) {
|
||||
struct netdev_hw_addr *ha;
|
||||
|
||||
for (i = 0; i < net->mc_count; i++, mc_list = mc_list->next) {
|
||||
u32 crc = ether_crc(ETH_ALEN, mc_list->dmi_addr) >> 26;
|
||||
hashes[crc >> 3] |= 1 << (crc & 0x7);
|
||||
}
|
||||
}
|
||||
netdev_for_each_mc_addr(ha, net) {
|
||||
u32 crc = ether_crc(ETH_ALEN, ha->addr) >> 26;
|
||||
hashes[crc >> 3] |= 1 << (crc & 0x7);
|
||||
}
|
||||
}
|
||||
|
||||
qf_write_async(dev, MAR, QF_MCAST_SIZE, hashes);
|
||||
qf_write_reg_async(dev, RCR, rx_ctl);
|
||||
qf_write_async(dev, MAR, QF_MCAST_SIZE, hashes);
|
||||
qf_write_reg_async(dev, RCR, rx_ctl);
|
||||
}
|
||||
|
||||
static int sr9700_android_set_mac_address(struct net_device *net, void *p)
|
||||
|
||||
@@ -228,4 +228,22 @@ extern void usbnet_set_msglevel(struct net_device *, u32);
|
||||
extern void usbnet_get_drvinfo(struct net_device *, struct ethtool_drvinfo *);
|
||||
extern int usbnet_nway_reset(struct net_device *net);
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
#define devdbg(usbnet, fmt, arg...) \
|
||||
printk(KERN_DEBUG "%s: " fmt "\n" , (usbnet)->net->name , ## arg)
|
||||
#else
|
||||
#define devdbg(usbnet, fmt, arg...) \
|
||||
({ if (0) printk(KERN_DEBUG "%s: " fmt "\n" , (usbnet)->net->name , \
|
||||
## arg); 0; })
|
||||
#endif
|
||||
|
||||
#define deverr(usbnet, fmt, arg...) \
|
||||
printk(KERN_ERR "%s: " fmt "\n" , (usbnet)->net->name , ## arg)
|
||||
#define devwarn(usbnet, fmt, arg...) \
|
||||
printk(KERN_WARNING "%s: " fmt "\n" , (usbnet)->net->name , ## arg)
|
||||
|
||||
#define devinfo(usbnet, fmt, arg...) \
|
||||
printk(KERN_INFO "%s: " fmt "\n" , (usbnet)->net->name , ## arg);
|
||||
|
||||
#endif /* __LINUX_USB_USBNET_H */
|
||||
|
||||
Reference in New Issue
Block a user