Commit 16626b0c authored by Christian Riesch's avatar Christian Riesch Committed by David S. Miller

asix: Add a new driver for the AX88172A

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: default avatarChristian Riesch <christian.riesch@omicron.at>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 607740bc
...@@ -8,7 +8,7 @@ obj-$(CONFIG_USB_PEGASUS) += pegasus.o ...@@ -8,7 +8,7 @@ obj-$(CONFIG_USB_PEGASUS) += pegasus.o
obj-$(CONFIG_USB_RTL8150) += rtl8150.o obj-$(CONFIG_USB_RTL8150) += rtl8150.o
obj-$(CONFIG_USB_HSO) += hso.o obj-$(CONFIG_USB_HSO) += hso.o
obj-$(CONFIG_USB_NET_AX8817X) += asix.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_CDCETHER) += cdc_ether.o
obj-$(CONFIG_USB_NET_CDC_EEM) += cdc_eem.o obj-$(CONFIG_USB_NET_CDC_EEM) += cdc_eem.o
obj-$(CONFIG_USB_NET_DM9601) += dm9601.o obj-$(CONFIG_USB_NET_DM9601) += dm9601.o
......
...@@ -74,6 +74,10 @@ ...@@ -74,6 +74,10 @@
#define AX_CMD_SW_PHY_STATUS 0x21 #define AX_CMD_SW_PHY_STATUS 0x21
#define AX_CMD_SW_PHY_SELECT 0x22 #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_MODE 0x01
#define AX_MONITOR_LINK 0x02 #define AX_MONITOR_LINK 0x02
#define AX_MONITOR_MAGIC 0x04 #define AX_MONITOR_MAGIC 0x04
...@@ -181,6 +185,7 @@ struct sk_buff *asix_tx_fixup(struct usbnet *dev, struct sk_buff *skb, ...@@ -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_sw_mii(struct usbnet *dev);
int asix_set_hw_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_get_phy_addr(struct usbnet *dev);
int asix_sw_reset(struct usbnet *dev, u8 flags); int asix_sw_reset(struct usbnet *dev, u8 flags);
......
...@@ -258,8 +258,9 @@ int asix_set_hw_mii(struct usbnet *dev) ...@@ -258,8 +258,9 @@ int asix_set_hw_mii(struct usbnet *dev)
return ret; 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]; u8 buf[2];
int ret = asix_read_cmd(dev, AX_CMD_READ_PHY_ID, 0, 0, 2, buf); int ret = asix_read_cmd(dev, AX_CMD_READ_PHY_ID, 0, 0, 2, buf);
...@@ -271,12 +272,19 @@ int asix_get_phy_addr(struct usbnet *dev) ...@@ -271,12 +272,19 @@ int asix_get_phy_addr(struct usbnet *dev)
} }
netdev_dbg(dev->net, "asix_get_phy_addr() returning 0x%04x\n", netdev_dbg(dev->net, "asix_get_phy_addr() returning 0x%04x\n",
*((__le16 *)buf)); *((__le16 *)buf));
ret = buf[1]; ret = buf[offset];
out: out:
return ret; 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 asix_sw_reset(struct usbnet *dev, u8 flags)
{ {
int ret; int ret;
......
...@@ -872,6 +872,8 @@ static const struct driver_info ax88178_info = { ...@@ -872,6 +872,8 @@ static const struct driver_info ax88178_info = {
.tx_fixup = asix_tx_fixup, .tx_fixup = asix_tx_fixup,
}; };
extern const struct driver_info ax88172a_info;
static const struct usb_device_id products [] = { static const struct usb_device_id products [] = {
{ {
// Linksys USB200M // Linksys USB200M
...@@ -997,6 +999,10 @@ static const struct usb_device_id products [] = { ...@@ -997,6 +999,10 @@ static const struct usb_device_id products [] = {
// Asus USB Ethernet Adapter // Asus USB Ethernet Adapter
USB_DEVICE (0x0b95, 0x7e2b), USB_DEVICE (0x0b95, 0x7e2b),
.driver_info = (unsigned long) &ax88772_info, .driver_info = (unsigned long) &ax88772_info,
}, {
/* ASIX 88172a demo board */
USB_DEVICE(0x0b95, 0x172a),
.driver_info = (unsigned long) &ax88172a_info,
}, },
{ }, // END { }, // END
}; };
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment