From: Christian Riesch <christian.riesch@omicron.at>
To: freddy@asix.com.tw
Cc: Ming Lei <ming.lei@canonical.com>,
davem@davemloft.net, linux-kernel@vger.kernel.org,
louis@asix.com.tw, netdev@vger.kernel.org,
linux-usb@vger.kernel.org
Subject: Re: [PATCH] ax88179_178a: ASIX AX88179_178A USB 3.0/2.0 to gigabit ethernet adapter driver
Date: Fri, 11 Jan 2013 09:18:46 +0100 [thread overview]
Message-ID: <50EFCAE6.9070306@omicron.at> (raw)
In-Reply-To: <CACVXFVMdgx1we67poF5yU5pAYRYoA9Ao1EJqQgGBaaORuARFQQ@mail.gmail.com>
Hi,
On 2013-01-11 03:45, Ming Lei wrote:
> Cc netdev and usb lists.
>
>
> On Fri, Jan 11, 2013 at 9:17 AM, <freddy@asix.com.tw> wrote:
>> From: Freddy Xin <freddy@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 <freddy@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 0000000..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;
>> +}
>> +
next prev parent reply other threads:[~2013-01-11 8:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-11 1:17 [PATCH] ax88179_178a: ASIX AX88179_178A USB 3.0/2.0 to gigabit ethernet adapter driver freddy
2013-01-11 2:45 ` Ming Lei
2013-01-11 5:14 ` David Miller
2013-01-11 8:18 ` Christian Riesch [this message]
2013-01-11 9:30 ` Freddy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=50EFCAE6.9070306@omicron.at \
--to=christian.riesch@omicron.at \
--cc=davem@davemloft.net \
--cc=freddy@asix.com.tw \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=louis@asix.com.tw \
--cc=ming.lei@canonical.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.