Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 351459
b: refs/heads/master
c: 5620df6
h: refs/heads/master
i:
  351457: 33b57fb
  351455: e2521e0
v: v3
  • Loading branch information
Lucas Stach authored and David S. Miller committed Jan 18, 2013
1 parent 469d819 commit 115c515
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a16af2ffa2f640f094a3ad3543996a37b588a3cc
refs/heads/master: 5620df65d81292c5fb1beba8d380ef58cd98b53f
3 changes: 3 additions & 0 deletions trunk/drivers/net/usb/asix.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,9 @@ struct asix_data {
u8 res;
};

/* ASIX specific flags */
#define FLAG_EEPROM_MAC (1UL << 0) /* init device MAC from eeprom */

int asix_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
u16 size, void *data);

Expand Down
30 changes: 27 additions & 3 deletions trunk/drivers/net/usb/asix_devices.c
Original file line number Diff line number Diff line change
Expand Up @@ -422,14 +422,25 @@ static const struct net_device_ops ax88772_netdev_ops = {

static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
{
int ret, embd_phy;
int ret, embd_phy, i;
u8 buf[ETH_ALEN];
u32 phyid;

usbnet_get_endpoints(dev,intf);

/* Get the MAC address */
ret = asix_read_cmd(dev, AX_CMD_READ_NODE_ID, 0, 0, ETH_ALEN, buf);
if (dev->driver_info->data & FLAG_EEPROM_MAC) {
for (i = 0; i < (ETH_ALEN >> 1); i++) {
ret = asix_read_cmd(dev, AX_CMD_READ_EEPROM, 0x04 + i,
0, 2, buf + i * 2);
if (ret < 0)
break;
}
} else {
ret = asix_read_cmd(dev, AX_CMD_READ_NODE_ID,
0, 0, ETH_ALEN, buf);
}

if (ret < 0) {
netdev_dbg(dev->net, "Failed to read MAC address: %d\n", ret);
return ret;
Expand Down Expand Up @@ -872,6 +883,19 @@ static const struct driver_info ax88772_info = {
.tx_fixup = asix_tx_fixup,
};

static const struct driver_info ax88772b_info = {
.description = "ASIX AX88772B USB 2.0 Ethernet",
.bind = ax88772_bind,
.status = asix_status,
.link_reset = ax88772_link_reset,
.reset = ax88772_reset,
.flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_LINK_INTR |
FLAG_MULTI_PACKET,
.rx_fixup = asix_rx_fixup,
.tx_fixup = asix_tx_fixup,
.data = FLAG_EEPROM_MAC,
};

static const struct driver_info ax88178_info = {
.description = "ASIX AX88178 USB 2.0 Ethernet",
.bind = ax88178_bind,
Expand Down Expand Up @@ -953,7 +977,7 @@ static const struct usb_device_id products [] = {
}, {
// ASIX AX88772B 10/100
USB_DEVICE (0x0b95, 0x772b),
.driver_info = (unsigned long) &ax88772_info,
.driver_info = (unsigned long) &ax88772b_info,
}, {
// ASIX AX88772 10/100
USB_DEVICE (0x0b95, 0x7720),
Expand Down

0 comments on commit 115c515

Please sign in to comment.