RE: [PATCH] ax88179_178a: ASIX AX88179_178A USB 3.0/2.0 to gigabit ethernet adapter driver

2013-01-11 Thread Freddy
Hi,

>> +static int ax88179_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16
index,
>> +   u16 size, void *data) {
>> +   int ret;
>> +   ret = usbnet_read_cmd(dev, cmd,
>> +  USB_DIR_IN | USB_TYPE_VENDOR |
USB_RECIP_DEVICE,
>> +  value, index, data, size);
>> +
>> +   if (ret != size && ret >= 0)
>> +   return -EINVAL;
>> +   return ret;
>> +}
>> +
>> +static int ax88179_write_cmd(struct usbnet *dev, u8 cmd, u16 value, u16
index,
>> +u16 size, void *data) {
>> +   return usbnet_write_cmd(dev, cmd, USB_DIR_OUT | USB_TYPE_VENDOR
>> +   | USB_RECIP_DEVICE, value, index, 
>> +data, size); }
>> +
>> +static void
>> +ax88179_write_cmd_async(struct usbnet *dev, u8 cmd, u16 value, u16
index,
>> +   u16 size, void *data) {
>> +   usbnet_write_cmd_async(dev, cmd,
>> +  USB_DIR_OUT | USB_TYPE_VENDOR |
USB_RECIP_DEVICE,
>> +  value, index, data, size); }
>> +

ax88179_read_cmd, ax88179_write_cmd, and ax88179_write_cmd_async duplicate
code from asix_common.c.

Do you mean that I should merge this driver into asix_common and
asix_devices, or just reuse the functions that had been implemented?

[...]

>> +static int ax88179_get_eeprom(struct net_device *net,
>> + struct ethtool_eeprom *eeprom, u8 
>> +*data) {
>> +   struct usbnet *dev = netdev_priv(net);
>> +   u16 *ebuf = (u16 *)data;
>> +   int i;
>> +
>> +   /* Crude hack to ensure that we don't overwrite memory
>> +* if an odd length is supplied

Have a look at asix_get_eeprom() in asix_common.c for a better
implementation. There is also code for programming the eeprom
(asix_set_eeprom in asix_common.c), can this be used for the AX88179/178A as
well?

Thanks, I will check whether the eeprom access functions in asix_common.c
can be used in the driver or not.

Regards, Freddy

>> +*/
>> +   if (eeprom->len % 2)
>> +   return -EINVAL;
>> +
>> +   /* ax8817x returns 2 bytes from eeprom on read */
>> +   for (i = 0; i < eeprom->len / 2; i++) {
>> +   if (ax88179_read_cmd(dev, AX_ACCESS_EEPROM,
>> +   eeprom->offset + i, 1, 2, [i]) < 0)
>> +   return -EINVAL;
>> +   }
>> +   return 0;
>> +}
>> +

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] ax88179_178a: ASIX AX88179_178A USB 3.0/2.0 to gigabit ethernet adapter driver

2013-01-11 Thread Christian Riesch

Hi,

On 2013-01-11 03:45, Ming Lei wrote:

Cc netdev and usb lists.


On Fri, Jan 11, 2013 at 9:17 AM,   wrote:

From: Freddy Xin 

This patch adds a driver for ASIX's AX88179 family of USB 3.0/2.0
to gigabit ethernet adapters. It's based on the AX88xxx driver but
the usb commands used to access registers for AX88179 are completely different.
This driver had been verified on x86 system with AX88179/AX88178A and
Sitcomm LN-032 USB dongles.

Signed-off-by: Freddy Xin 
---
  drivers/net/usb/Kconfig|   18 +
  drivers/net/usb/Makefile   |1 +
  drivers/net/usb/ax88179_178a.c | 1457 
  3 files changed, 1476 insertions(+)
  create mode 100644 drivers/net/usb/ax88179_178a.c



[...]


diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c
new file mode 100644
index 000..47504ea
--- /dev/null
+++ b/drivers/net/usb/ax88179_178a.c

[...]

+static int ax88179_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
+   u16 size, void *data)
+{
+   int ret;
+   ret = usbnet_read_cmd(dev, cmd,
+  USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
+  value, index, data, size);
+
+   if (ret != size && ret >= 0)
+   return -EINVAL;
+   return ret;
+}
+
+static int ax88179_write_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
+u16 size, void *data)
+{
+   return usbnet_write_cmd(dev, cmd, USB_DIR_OUT | USB_TYPE_VENDOR
+   | USB_RECIP_DEVICE, value, index, data, size);
+}
+
+static void
+ax88179_write_cmd_async(struct usbnet *dev, u8 cmd, u16 value, u16 index,
+   u16 size, void *data)
+{
+   usbnet_write_cmd_async(dev, cmd,
+  USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
+  value, index, data, size);
+}
+


ax88179_read_cmd, ax88179_write_cmd, and ax88179_write_cmd_async 
duplicate code from asix_common.c.


[...]


+static int ax88179_get_eeprom(struct net_device *net,
+ struct ethtool_eeprom *eeprom, u8 *data)
+{
+   struct usbnet *dev = netdev_priv(net);
+   u16 *ebuf = (u16 *)data;
+   int i;
+
+   /* Crude hack to ensure that we don't overwrite memory
+* if an odd length is supplied


Have a look at asix_get_eeprom() in asix_common.c for a better 
implementation. There is also code for programming the eeprom 
(asix_set_eeprom in asix_common.c), can this be used for the 
AX88179/178A as well?


Regards, Christian


+*/
+   if (eeprom->len % 2)
+   return -EINVAL;
+
+   /* ax8817x returns 2 bytes from eeprom on read */
+   for (i = 0; i < eeprom->len / 2; i++) {
+   if (ax88179_read_cmd(dev, AX_ACCESS_EEPROM,
+   eeprom->offset + i, 1, 2, [i]) < 0)
+   return -EINVAL;
+   }
+   return 0;
+}
+


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] ax88179_178a: ASIX AX88179_178A USB 3.0/2.0 to gigabit ethernet adapter driver

2013-01-11 Thread Christian Riesch

Hi,

On 2013-01-11 03:45, Ming Lei wrote:

Cc netdev and usb lists.


On Fri, Jan 11, 2013 at 9:17 AM,  fre...@asix.com.tw wrote:

From: Freddy Xin fre...@asix.com.tw

This patch adds a driver for ASIX's AX88179 family of USB 3.0/2.0
to gigabit ethernet adapters. It's based on the AX88xxx driver but
the usb commands used to access registers for AX88179 are completely different.
This driver had been verified on x86 system with AX88179/AX88178A and
Sitcomm LN-032 USB dongles.

Signed-off-by: Freddy Xin fre...@asix.com.tw
---
  drivers/net/usb/Kconfig|   18 +
  drivers/net/usb/Makefile   |1 +
  drivers/net/usb/ax88179_178a.c | 1457 
  3 files changed, 1476 insertions(+)
  create mode 100644 drivers/net/usb/ax88179_178a.c



[...]


diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c
new file mode 100644
index 000..47504ea
--- /dev/null
+++ b/drivers/net/usb/ax88179_178a.c

[...]

+static int ax88179_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
+   u16 size, void *data)
+{
+   int ret;
+   ret = usbnet_read_cmd(dev, cmd,
+  USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
+  value, index, data, size);
+
+   if (ret != size  ret = 0)
+   return -EINVAL;
+   return ret;
+}
+
+static int ax88179_write_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
+u16 size, void *data)
+{
+   return usbnet_write_cmd(dev, cmd, USB_DIR_OUT | USB_TYPE_VENDOR
+   | USB_RECIP_DEVICE, value, index, data, size);
+}
+
+static void
+ax88179_write_cmd_async(struct usbnet *dev, u8 cmd, u16 value, u16 index,
+   u16 size, void *data)
+{
+   usbnet_write_cmd_async(dev, cmd,
+  USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
+  value, index, data, size);
+}
+


ax88179_read_cmd, ax88179_write_cmd, and ax88179_write_cmd_async 
duplicate code from asix_common.c.


[...]


+static int ax88179_get_eeprom(struct net_device *net,
+ struct ethtool_eeprom *eeprom, u8 *data)
+{
+   struct usbnet *dev = netdev_priv(net);
+   u16 *ebuf = (u16 *)data;
+   int i;
+
+   /* Crude hack to ensure that we don't overwrite memory
+* if an odd length is supplied


Have a look at asix_get_eeprom() in asix_common.c for a better 
implementation. There is also code for programming the eeprom 
(asix_set_eeprom in asix_common.c), can this be used for the 
AX88179/178A as well?


Regards, Christian


+*/
+   if (eeprom-len % 2)
+   return -EINVAL;
+
+   /* ax8817x returns 2 bytes from eeprom on read */
+   for (i = 0; i  eeprom-len / 2; i++) {
+   if (ax88179_read_cmd(dev, AX_ACCESS_EEPROM,
+   eeprom-offset + i, 1, 2, ebuf[i])  0)
+   return -EINVAL;
+   }
+   return 0;
+}
+


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


RE: [PATCH] ax88179_178a: ASIX AX88179_178A USB 3.0/2.0 to gigabit ethernet adapter driver

2013-01-11 Thread Freddy
Hi,

 +static int ax88179_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16
index,
 +   u16 size, void *data) {
 +   int ret;
 +   ret = usbnet_read_cmd(dev, cmd,
 +  USB_DIR_IN | USB_TYPE_VENDOR |
USB_RECIP_DEVICE,
 +  value, index, data, size);
 +
 +   if (ret != size  ret = 0)
 +   return -EINVAL;
 +   return ret;
 +}
 +
 +static int ax88179_write_cmd(struct usbnet *dev, u8 cmd, u16 value, u16
index,
 +u16 size, void *data) {
 +   return usbnet_write_cmd(dev, cmd, USB_DIR_OUT | USB_TYPE_VENDOR
 +   | USB_RECIP_DEVICE, value, index, 
 +data, size); }
 +
 +static void
 +ax88179_write_cmd_async(struct usbnet *dev, u8 cmd, u16 value, u16
index,
 +   u16 size, void *data) {
 +   usbnet_write_cmd_async(dev, cmd,
 +  USB_DIR_OUT | USB_TYPE_VENDOR |
USB_RECIP_DEVICE,
 +  value, index, data, size); }
 +

ax88179_read_cmd, ax88179_write_cmd, and ax88179_write_cmd_async duplicate
code from asix_common.c.

Do you mean that I should merge this driver into asix_common and
asix_devices, or just reuse the functions that had been implemented?

[...]

 +static int ax88179_get_eeprom(struct net_device *net,
 + struct ethtool_eeprom *eeprom, u8 
 +*data) {
 +   struct usbnet *dev = netdev_priv(net);
 +   u16 *ebuf = (u16 *)data;
 +   int i;
 +
 +   /* Crude hack to ensure that we don't overwrite memory
 +* if an odd length is supplied

Have a look at asix_get_eeprom() in asix_common.c for a better
implementation. There is also code for programming the eeprom
(asix_set_eeprom in asix_common.c), can this be used for the AX88179/178A as
well?

Thanks, I will check whether the eeprom access functions in asix_common.c
can be used in the driver or not.

Regards, Freddy

 +*/
 +   if (eeprom-len % 2)
 +   return -EINVAL;
 +
 +   /* ax8817x returns 2 bytes from eeprom on read */
 +   for (i = 0; i  eeprom-len / 2; i++) {
 +   if (ax88179_read_cmd(dev, AX_ACCESS_EEPROM,
 +   eeprom-offset + i, 1, 2, ebuf[i])  0)
 +   return -EINVAL;
 +   }
 +   return 0;
 +}
 +

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] ax88179_178a: ASIX AX88179_178A USB 3.0/2.0 to gigabit ethernet adapter driver

2013-01-10 Thread David Miller
From: Ming Lei 
Date: Fri, 11 Jan 2013 10:45:38 +0800

> Cc netdev and usb lists.

That doesn't work for patches, sorry.  It will have to be submitted
freshly and cleanly to the appropriate lists, not as a quoted reply.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] ax88179_178a: ASIX AX88179_178A USB 3.0/2.0 to gigabit ethernet adapter driver

2013-01-10 Thread Ming Lei
Cc netdev and usb lists.


On Fri, Jan 11, 2013 at 9:17 AM,   wrote:
> From: Freddy Xin 
>
> This patch adds a driver for ASIX's AX88179 family of USB 3.0/2.0
> to gigabit ethernet adapters. It's based on the AX88xxx driver but
> the usb commands used to access registers for AX88179 are completely 
> different.
> This driver had been verified on x86 system with AX88179/AX88178A and
> Sitcomm LN-032 USB dongles.
>
> Signed-off-by: Freddy Xin 
> ---
>  drivers/net/usb/Kconfig|   18 +
>  drivers/net/usb/Makefile   |1 +
>  drivers/net/usb/ax88179_178a.c | 1457 
> 
>  3 files changed, 1476 insertions(+)
>  create mode 100644 drivers/net/usb/ax88179_178a.c
>
> diff --git a/drivers/net/usb/Kconfig b/drivers/net/usb/Kconfig
> index ef97621..75af401 100644
> --- a/drivers/net/usb/Kconfig
> +++ b/drivers/net/usb/Kconfig
> @@ -158,6 +158,24 @@ config USB_NET_AX8817X
>   This driver creates an interface named "ethX", where X depends on
>   what other networking devices you have in use.
>
> +config USB_NET_AX88179_178A
> +   tristate "ASIX AX88179/178A USB 3.0/2.0 to Gigabit Ethernet"
> +   depends on USB_USBNET
> +   select CRC32
> +   select PHYLIB
> +   default y
> +   help
> + This option adds support for ASIX AX88179 based USB 3.0/2.0
> + to Gigabit Ethernet adapters.
> +
> + This driver should work with at least the following devices:
> +   * ASIX AX88179
> +   * ASIX AX88178A
> +   * Sitcomm LN-032
> +
> + This driver creates an interface named "ethX", where X depends on
> + what other networking devices you have in use.
> +
>  config USB_NET_CDCETHER
> tristate "CDC Ethernet support (smart devices such as cable modems)"
> depends on USB_USBNET
> diff --git a/drivers/net/usb/Makefile b/drivers/net/usb/Makefile
> index 4786913..ce01578 100644
> --- a/drivers/net/usb/Makefile
> +++ b/drivers/net/usb/Makefile
> @@ -9,6 +9,7 @@ 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 ax88172a.o
> +obj-$(CONFIG_USB_NET_AX88179_178A) += ax88179_178a.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
> diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c
> new file mode 100644
> index 000..47504ea
> --- /dev/null
> +++ b/drivers/net/usb/ax88179_178a.c
> @@ -0,0 +1,1457 @@
> +/*
> + * ASIX AX88179/178A USB 3.0/2.0 to Gigabit Ethernet Devices
> + *
> + * Copyright (C) 20011-2012 ASIX
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; either version 2
> + * of the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, 
> USA.
> + *
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +
> +#define AX88179_PHY_ID 0x03
> +#define AX_EEPROM_LEN  0x100
> +#define AX_MCAST_FILTER_SIZE   8
> +#define AX_MAX_MCAST   64
> +#define AX_RX_CHECKSUM 1
> +#define AX_TX_CHECKSUM 2
> +#define AX_INT_PPLS_LINK   BIT(0)
> +#define AX_RXHDR_L4_TYPE_UDP   1
> +#define AX_RXHDR_L4_TYPE_TCP   4
> +#define AX_ACCESS_MAC  0x01
> +#define AX_ACCESS_PHY  0x02
> +#define AX_ACCESS_EEPROM   0x04
> +#define AX_ACCESS_EFUSE0x05
> +#define AX_PAUSE_WATERLVL_HIGH 0x54
> +#define AX_PAUSE_WATERLVL_LOW  0x55
> +
> +#define PHYSICAL_LINK_STATUS   0x02
> +   #define AX_USB_SS   0x04
> +   #define AX_USB_HS   0x02
> +   #define AX_USB_FS   0x01
> +
> +#define GENERAL_STATUS 0x03
> +/* Check AX88179 version. UA1:Bit2 = 0,  UA2:Bit2 = 1 */
> +   #define AX_SECLD0x04
> +
> +#define AX_SROM_ADDR   0x07
> +#define AX_SROM_CMD0x0a
> +   #define EEP_RD  0x04
> +   #define EEP_BUSY0x10
> +
> +
> 

[PATCH] ax88179_178a: ASIX AX88179_178A USB 3.0/2.0 to gigabit ethernet adapter driver

2013-01-10 Thread freddy
From: Freddy Xin 

This patch adds a driver for ASIX's AX88179 family of USB 3.0/2.0
to gigabit ethernet adapters. It's based on the AX88xxx driver but
the usb commands used to access registers for AX88179 are completely different.
This driver had been verified on x86 system with AX88179/AX88178A and
Sitcomm LN-032 USB dongles.

Signed-off-by: Freddy Xin 
---
 drivers/net/usb/Kconfig|   18 +
 drivers/net/usb/Makefile   |1 +
 drivers/net/usb/ax88179_178a.c | 1457 
 3 files changed, 1476 insertions(+)
 create mode 100644 drivers/net/usb/ax88179_178a.c

diff --git a/drivers/net/usb/Kconfig b/drivers/net/usb/Kconfig
index ef97621..75af401 100644
--- a/drivers/net/usb/Kconfig
+++ b/drivers/net/usb/Kconfig
@@ -158,6 +158,24 @@ config USB_NET_AX8817X
  This driver creates an interface named "ethX", where X depends on
  what other networking devices you have in use.
 
+config USB_NET_AX88179_178A
+   tristate "ASIX AX88179/178A USB 3.0/2.0 to Gigabit Ethernet"
+   depends on USB_USBNET
+   select CRC32
+   select PHYLIB
+   default y
+   help
+ This option adds support for ASIX AX88179 based USB 3.0/2.0
+ to Gigabit Ethernet adapters.
+
+ This driver should work with at least the following devices:
+   * ASIX AX88179
+   * ASIX AX88178A
+   * Sitcomm LN-032
+
+ This driver creates an interface named "ethX", where X depends on
+ what other networking devices you have in use.
+
 config USB_NET_CDCETHER
tristate "CDC Ethernet support (smart devices such as cable modems)"
depends on USB_USBNET
diff --git a/drivers/net/usb/Makefile b/drivers/net/usb/Makefile
index 4786913..ce01578 100644
--- a/drivers/net/usb/Makefile
+++ b/drivers/net/usb/Makefile
@@ -9,6 +9,7 @@ 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 ax88172a.o
+obj-$(CONFIG_USB_NET_AX88179_178A) += ax88179_178a.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
diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c
new file mode 100644
index 000..47504ea
--- /dev/null
+++ b/drivers/net/usb/ax88179_178a.c
@@ -0,0 +1,1457 @@
+/*
+ * ASIX AX88179/178A USB 3.0/2.0 to Gigabit Ethernet Devices
+ *
+ * Copyright (C) 20011-2012 ASIX
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+
+#define AX88179_PHY_ID 0x03
+#define AX_EEPROM_LEN  0x100
+#define AX_MCAST_FILTER_SIZE   8
+#define AX_MAX_MCAST   64
+#define AX_RX_CHECKSUM 1
+#define AX_TX_CHECKSUM 2
+#define AX_INT_PPLS_LINK   BIT(0)
+#define AX_RXHDR_L4_TYPE_UDP   1
+#define AX_RXHDR_L4_TYPE_TCP   4
+#define AX_ACCESS_MAC  0x01
+#define AX_ACCESS_PHY  0x02
+#define AX_ACCESS_EEPROM   0x04
+#define AX_ACCESS_EFUSE0x05
+#define AX_PAUSE_WATERLVL_HIGH 0x54
+#define AX_PAUSE_WATERLVL_LOW  0x55
+
+#define PHYSICAL_LINK_STATUS   0x02
+   #define AX_USB_SS   0x04
+   #define AX_USB_HS   0x02
+   #define AX_USB_FS   0x01
+
+#define GENERAL_STATUS 0x03
+/* Check AX88179 version. UA1:Bit2 = 0,  UA2:Bit2 = 1 */
+   #define AX_SECLD0x04
+
+#define AX_SROM_ADDR   0x07
+#define AX_SROM_CMD0x0a
+   #define EEP_RD  0x04
+   #define EEP_BUSY0x10
+
+
+#define AX_SROM_DATA_LOW   0x08
+#define AX_SROM_DATA_HIGH  0x09
+
+#define AX_RX_CTL  0x0b
+   #define AX_RX_CTL_DROPCRCERR0x0100
+   #define AX_RX_CTL_IPE   0x0200
+   #define AX_RX_CTL_START 0x0080
+   #define 

[PATCH] ax88179_178a: ASIX AX88179_178A USB 3.0/2.0 to gigabit ethernet adapter driver

2013-01-10 Thread freddy
From: Freddy Xin fre...@asix.com.tw

This patch adds a driver for ASIX's AX88179 family of USB 3.0/2.0
to gigabit ethernet adapters. It's based on the AX88xxx driver but
the usb commands used to access registers for AX88179 are completely different.
This driver had been verified on x86 system with AX88179/AX88178A and
Sitcomm LN-032 USB dongles.

Signed-off-by: Freddy Xin fre...@asix.com.tw
---
 drivers/net/usb/Kconfig|   18 +
 drivers/net/usb/Makefile   |1 +
 drivers/net/usb/ax88179_178a.c | 1457 
 3 files changed, 1476 insertions(+)
 create mode 100644 drivers/net/usb/ax88179_178a.c

diff --git a/drivers/net/usb/Kconfig b/drivers/net/usb/Kconfig
index ef97621..75af401 100644
--- a/drivers/net/usb/Kconfig
+++ b/drivers/net/usb/Kconfig
@@ -158,6 +158,24 @@ config USB_NET_AX8817X
  This driver creates an interface named ethX, where X depends on
  what other networking devices you have in use.
 
+config USB_NET_AX88179_178A
+   tristate ASIX AX88179/178A USB 3.0/2.0 to Gigabit Ethernet
+   depends on USB_USBNET
+   select CRC32
+   select PHYLIB
+   default y
+   help
+ This option adds support for ASIX AX88179 based USB 3.0/2.0
+ to Gigabit Ethernet adapters.
+
+ This driver should work with at least the following devices:
+   * ASIX AX88179
+   * ASIX AX88178A
+   * Sitcomm LN-032
+
+ This driver creates an interface named ethX, where X depends on
+ what other networking devices you have in use.
+
 config USB_NET_CDCETHER
tristate CDC Ethernet support (smart devices such as cable modems)
depends on USB_USBNET
diff --git a/drivers/net/usb/Makefile b/drivers/net/usb/Makefile
index 4786913..ce01578 100644
--- a/drivers/net/usb/Makefile
+++ b/drivers/net/usb/Makefile
@@ -9,6 +9,7 @@ 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 ax88172a.o
+obj-$(CONFIG_USB_NET_AX88179_178A) += ax88179_178a.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
diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c
new file mode 100644
index 000..47504ea
--- /dev/null
+++ b/drivers/net/usb/ax88179_178a.c
@@ -0,0 +1,1457 @@
+/*
+ * ASIX AX88179/178A USB 3.0/2.0 to Gigabit Ethernet Devices
+ *
+ * Copyright (C) 20011-2012 ASIX
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ *
+ */
+
+#include linux/module.h
+#include linux/etherdevice.h
+#include linux/mii.h
+#include linux/usb.h
+#include linux/crc32.h
+#include linux/usb/usbnet.h
+
+
+#define AX88179_PHY_ID 0x03
+#define AX_EEPROM_LEN  0x100
+#define AX_MCAST_FILTER_SIZE   8
+#define AX_MAX_MCAST   64
+#define AX_RX_CHECKSUM 1
+#define AX_TX_CHECKSUM 2
+#define AX_INT_PPLS_LINK   BIT(0)
+#define AX_RXHDR_L4_TYPE_UDP   1
+#define AX_RXHDR_L4_TYPE_TCP   4
+#define AX_ACCESS_MAC  0x01
+#define AX_ACCESS_PHY  0x02
+#define AX_ACCESS_EEPROM   0x04
+#define AX_ACCESS_EFUSE0x05
+#define AX_PAUSE_WATERLVL_HIGH 0x54
+#define AX_PAUSE_WATERLVL_LOW  0x55
+
+#define PHYSICAL_LINK_STATUS   0x02
+   #define AX_USB_SS   0x04
+   #define AX_USB_HS   0x02
+   #define AX_USB_FS   0x01
+
+#define GENERAL_STATUS 0x03
+/* Check AX88179 version. UA1:Bit2 = 0,  UA2:Bit2 = 1 */
+   #define AX_SECLD0x04
+
+#define AX_SROM_ADDR   0x07
+#define AX_SROM_CMD0x0a
+   #define EEP_RD  0x04
+   #define EEP_BUSY0x10
+
+
+#define AX_SROM_DATA_LOW   0x08
+#define AX_SROM_DATA_HIGH  0x09
+
+#define AX_RX_CTL  0x0b
+   #define AX_RX_CTL_DROPCRCERR0x0100

Re: [PATCH] ax88179_178a: ASIX AX88179_178A USB 3.0/2.0 to gigabit ethernet adapter driver

2013-01-10 Thread Ming Lei
Cc netdev and usb lists.


On Fri, Jan 11, 2013 at 9:17 AM,  fre...@asix.com.tw wrote:
 From: Freddy Xin fre...@asix.com.tw

 This patch adds a driver for ASIX's AX88179 family of USB 3.0/2.0
 to gigabit ethernet adapters. It's based on the AX88xxx driver but
 the usb commands used to access registers for AX88179 are completely 
 different.
 This driver had been verified on x86 system with AX88179/AX88178A and
 Sitcomm LN-032 USB dongles.

 Signed-off-by: Freddy Xin fre...@asix.com.tw
 ---
  drivers/net/usb/Kconfig|   18 +
  drivers/net/usb/Makefile   |1 +
  drivers/net/usb/ax88179_178a.c | 1457 
 
  3 files changed, 1476 insertions(+)
  create mode 100644 drivers/net/usb/ax88179_178a.c

 diff --git a/drivers/net/usb/Kconfig b/drivers/net/usb/Kconfig
 index ef97621..75af401 100644
 --- a/drivers/net/usb/Kconfig
 +++ b/drivers/net/usb/Kconfig
 @@ -158,6 +158,24 @@ config USB_NET_AX8817X
   This driver creates an interface named ethX, where X depends on
   what other networking devices you have in use.

 +config USB_NET_AX88179_178A
 +   tristate ASIX AX88179/178A USB 3.0/2.0 to Gigabit Ethernet
 +   depends on USB_USBNET
 +   select CRC32
 +   select PHYLIB
 +   default y
 +   help
 + This option adds support for ASIX AX88179 based USB 3.0/2.0
 + to Gigabit Ethernet adapters.
 +
 + This driver should work with at least the following devices:
 +   * ASIX AX88179
 +   * ASIX AX88178A
 +   * Sitcomm LN-032
 +
 + This driver creates an interface named ethX, where X depends on
 + what other networking devices you have in use.
 +
  config USB_NET_CDCETHER
 tristate CDC Ethernet support (smart devices such as cable modems)
 depends on USB_USBNET
 diff --git a/drivers/net/usb/Makefile b/drivers/net/usb/Makefile
 index 4786913..ce01578 100644
 --- a/drivers/net/usb/Makefile
 +++ b/drivers/net/usb/Makefile
 @@ -9,6 +9,7 @@ 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 ax88172a.o
 +obj-$(CONFIG_USB_NET_AX88179_178A) += ax88179_178a.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
 diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c
 new file mode 100644
 index 000..47504ea
 --- /dev/null
 +++ b/drivers/net/usb/ax88179_178a.c
 @@ -0,0 +1,1457 @@
 +/*
 + * ASIX AX88179/178A USB 3.0/2.0 to Gigabit Ethernet Devices
 + *
 + * Copyright (C) 20011-2012 ASIX
 + *
 + * This program is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License
 + * as published by the Free Software Foundation; either version 2
 + * of the License, or (at your option) any later version.
 + *
 + * This program is distributed in the hope that it will be useful,
 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 + * GNU General Public License for more details.
 + *
 + * You should have received a copy of the GNU General Public License
 + * along with this program; if not, write to the Free Software
 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, 
 USA.
 + *
 + */
 +
 +#include linux/module.h
 +#include linux/etherdevice.h
 +#include linux/mii.h
 +#include linux/usb.h
 +#include linux/crc32.h
 +#include linux/usb/usbnet.h
 +
 +
 +#define AX88179_PHY_ID 0x03
 +#define AX_EEPROM_LEN  0x100
 +#define AX_MCAST_FILTER_SIZE   8
 +#define AX_MAX_MCAST   64
 +#define AX_RX_CHECKSUM 1
 +#define AX_TX_CHECKSUM 2
 +#define AX_INT_PPLS_LINK   BIT(0)
 +#define AX_RXHDR_L4_TYPE_UDP   1
 +#define AX_RXHDR_L4_TYPE_TCP   4
 +#define AX_ACCESS_MAC  0x01
 +#define AX_ACCESS_PHY  0x02
 +#define AX_ACCESS_EEPROM   0x04
 +#define AX_ACCESS_EFUSE0x05
 +#define AX_PAUSE_WATERLVL_HIGH 0x54
 +#define AX_PAUSE_WATERLVL_LOW  0x55
 +
 +#define PHYSICAL_LINK_STATUS   0x02
 +   #define AX_USB_SS   0x04
 +   #define AX_USB_HS   0x02
 +   #define AX_USB_FS   0x01
 +
 +#define GENERAL_STATUS 0x03
 +/* Check AX88179 version. UA1:Bit2 = 0,  UA2:Bit2 = 1 */
 +   #define AX_SECLD0x04
 +
 +#define AX_SROM_ADDR   0x07
 +#define AX_SROM_CMD0x0a
 +   #define EEP_RD  0x04
 +   #define EEP_BUSY0x10
 +
 

Re: [PATCH] ax88179_178a: ASIX AX88179_178A USB 3.0/2.0 to gigabit ethernet adapter driver

2013-01-10 Thread David Miller
From: Ming Lei ming@canonical.com
Date: Fri, 11 Jan 2013 10:45:38 +0800

 Cc netdev and usb lists.

That doesn't work for patches, sorry.  It will have to be submitted
freshly and cleanly to the appropriate lists, not as a quoted reply.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/