Skip to content

Commit

Permalink
asix: Add a new driver for the AX88172A
Browse files Browse the repository at this point in the history
The Asix AX88172A is a USB 2.0 Ethernet interface that supports both an
internal PHY as well as an external PHY (connected via MII).

This patch adds a driver for the AX88172A and provides support for
both modes and the phylib.

Signed-off-by: Christian Riesch <christian.riesch@omicron.at>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Christian Riesch authored and David S. Miller committed Jul 17, 2012
1 parent 607740b commit 16626b0
Show file tree
Hide file tree
Showing 5 changed files with 437 additions and 3 deletions.
2 changes: 1 addition & 1 deletion drivers/net/usb/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ obj-$(CONFIG_USB_PEGASUS) += pegasus.o
obj-$(CONFIG_USB_RTL8150) += rtl8150.o
obj-$(CONFIG_USB_HSO) += hso.o
obj-$(CONFIG_USB_NET_AX8817X) += asix.o
asix-y := asix_devices.o asix_common.o
asix-y := asix_devices.o asix_common.o ax88172a.o
obj-$(CONFIG_USB_NET_CDCETHER) += cdc_ether.o
obj-$(CONFIG_USB_NET_CDC_EEM) += cdc_eem.o
obj-$(CONFIG_USB_NET_DM9601) += dm9601.o
Expand Down
5 changes: 5 additions & 0 deletions drivers/net/usb/asix.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@
#define AX_CMD_SW_PHY_STATUS 0x21
#define AX_CMD_SW_PHY_SELECT 0x22

#define AX_PHY_SELECT_MASK (BIT(3) | BIT(2))
#define AX_PHY_SELECT_INTERNAL 0
#define AX_PHY_SELECT_EXTERNAL BIT(2)

#define AX_MONITOR_MODE 0x01
#define AX_MONITOR_LINK 0x02
#define AX_MONITOR_MAGIC 0x04
Expand Down Expand Up @@ -181,6 +185,7 @@ struct sk_buff *asix_tx_fixup(struct usbnet *dev, struct sk_buff *skb,
int asix_set_sw_mii(struct usbnet *dev);
int asix_set_hw_mii(struct usbnet *dev);

int asix_read_phy_addr(struct usbnet *dev, int internal);
int asix_get_phy_addr(struct usbnet *dev);

int asix_sw_reset(struct usbnet *dev, u8 flags);
Expand Down
12 changes: 10 additions & 2 deletions drivers/net/usb/asix_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,9 @@ int asix_set_hw_mii(struct usbnet *dev)
return ret;
}

int asix_get_phy_addr(struct usbnet *dev)
int asix_read_phy_addr(struct usbnet *dev, int internal)
{
int offset = (internal ? 1 : 0);
u8 buf[2];
int ret = asix_read_cmd(dev, AX_CMD_READ_PHY_ID, 0, 0, 2, buf);

Expand All @@ -271,12 +272,19 @@ int asix_get_phy_addr(struct usbnet *dev)
}
netdev_dbg(dev->net, "asix_get_phy_addr() returning 0x%04x\n",
*((__le16 *)buf));
ret = buf[1];
ret = buf[offset];

out:
return ret;
}

int asix_get_phy_addr(struct usbnet *dev)
{
/* return the address of the internal phy */
return asix_read_phy_addr(dev, 1);
}


int asix_sw_reset(struct usbnet *dev, u8 flags)
{
int ret;
Expand Down
6 changes: 6 additions & 0 deletions drivers/net/usb/asix_devices.c
Original file line number Diff line number Diff line change
Expand Up @@ -872,6 +872,8 @@ static const struct driver_info ax88178_info = {
.tx_fixup = asix_tx_fixup,
};

extern const struct driver_info ax88172a_info;

static const struct usb_device_id products [] = {
{
// Linksys USB200M
Expand Down Expand Up @@ -997,6 +999,10 @@ static const struct usb_device_id products [] = {
// Asus USB Ethernet Adapter
USB_DEVICE (0x0b95, 0x7e2b),
.driver_info = (unsigned long) &ax88772_info,
}, {
/* ASIX 88172a demo board */
USB_DEVICE(0x0b95, 0x172a),
.driver_info = (unsigned long) &ax88172a_info,
},
{ }, // END
};
Expand Down
Loading

0 comments on commit 16626b0

Please sign in to comment.