2022-08-20 17:09:10 +03:00
|
|
|
/* $NetBSD: if_cue.c,v 1.108 2022/08/20 14:09:10 riastradh Exp $ */
|
2019-08-15 11:02:32 +03:00
|
|
|
|
2000-01-17 20:12:20 +03:00
|
|
|
/*
|
|
|
|
* Copyright (c) 1997, 1998, 1999, 2000
|
|
|
|
* Bill Paul <wpaul@ee.columbia.edu>. All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. All advertising materials mentioning features or use of this software
|
|
|
|
* must display the following acknowledgement:
|
|
|
|
* This product includes software developed by Bill Paul.
|
|
|
|
* 4. Neither the name of the author nor the names of any co-contributors
|
|
|
|
* may be used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
|
|
|
|
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
|
|
|
* THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*
|
|
|
|
* $FreeBSD: src/sys/dev/usb/if_cue.c,v 1.4 2000/01/16 22:45:06 wpaul Exp $
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2000-03-24 16:08:28 +03:00
|
|
|
* CATC USB-EL1210A USB to ethernet driver. Used in the CATC Netmate
|
2000-01-17 20:12:20 +03:00
|
|
|
* adapters and others.
|
|
|
|
*
|
|
|
|
* Written by Bill Paul <wpaul@ee.columbia.edu>
|
|
|
|
* Electrical Engineering Department
|
|
|
|
* Columbia University, New York City
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2000-03-24 16:08:28 +03:00
|
|
|
* The CATC USB-EL1210A provides USB ethernet support at 10Mbps. The
|
2000-01-17 20:12:20 +03:00
|
|
|
* RX filter uses a 512-bit multicast hash table, single perfect entry
|
|
|
|
* for the station address, and promiscuous mode. Unlike the ADMtek
|
|
|
|
* and KLSI chips, the CATC ASIC supports read and write combining
|
2019-12-27 12:41:48 +03:00
|
|
|
* mode where multiple packets can be transferred using a single bulk
|
2000-01-17 20:12:20 +03:00
|
|
|
* transaction, which helps performance a great deal.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Ported to NetBSD and somewhat rewritten by Lennart Augustsson.
|
|
|
|
*/
|
|
|
|
|
2001-11-13 09:24:53 +03:00
|
|
|
#include <sys/cdefs.h>
|
2022-08-20 17:09:10 +03:00
|
|
|
__KERNEL_RCSID(0, "$NetBSD: if_cue.c,v 1.108 2022/08/20 14:09:10 riastradh Exp $");
|
2001-11-13 09:24:53 +03:00
|
|
|
|
2013-01-05 05:30:15 +04:00
|
|
|
#ifdef _KERNEL_OPT
|
2000-01-17 20:12:20 +03:00
|
|
|
#include "opt_inet.h"
|
2016-11-25 15:56:29 +03:00
|
|
|
#include "opt_usb.h"
|
2013-01-05 05:30:15 +04:00
|
|
|
#endif
|
2000-01-17 20:12:20 +03:00
|
|
|
|
|
|
|
#include <sys/param.h>
|
2019-08-15 11:02:32 +03:00
|
|
|
|
|
|
|
#include <dev/usb/usbnet.h>
|
|
|
|
#include <dev/usb/if_cuereg.h>
|
2000-03-29 22:24:52 +04:00
|
|
|
|
|
|
|
#ifdef INET
|
|
|
|
#include <netinet/in.h>
|
2012-02-24 10:48:23 +04:00
|
|
|
#include <netinet/if_inarp.h>
|
2000-03-29 22:24:52 +04:00
|
|
|
#endif
|
2000-01-17 20:12:20 +03:00
|
|
|
|
|
|
|
#ifdef CUE_DEBUG
|
2010-11-04 01:28:31 +03:00
|
|
|
#define DPRINTF(x) if (cuedebug) printf x
|
2019-05-23 13:57:27 +03:00
|
|
|
#define DPRINTFN(n, x) if (cuedebug >= (n)) printf x
|
2000-01-17 20:12:20 +03:00
|
|
|
int cuedebug = 0;
|
|
|
|
#else
|
|
|
|
#define DPRINTF(x)
|
2019-05-23 13:57:27 +03:00
|
|
|
#define DPRINTFN(n, x)
|
2000-01-17 20:12:20 +03:00
|
|
|
#endif
|
|
|
|
|
2019-08-15 11:02:32 +03:00
|
|
|
#define CUE_BUFSZ 1536
|
|
|
|
#define CUE_MIN_FRAMELEN 60
|
|
|
|
#define CUE_RX_FRAMES 1
|
|
|
|
#define CUE_TX_FRAMES 1
|
|
|
|
|
|
|
|
#define CUE_CONFIG_NO 1
|
|
|
|
#define CUE_IFACE_IDX 0
|
|
|
|
|
|
|
|
#define CUE_RX_LIST_CNT 1
|
|
|
|
#define CUE_TX_LIST_CNT 1
|
|
|
|
|
|
|
|
struct cue_type {
|
|
|
|
uint16_t cue_vid;
|
|
|
|
uint16_t cue_did;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct cue_softc;
|
|
|
|
|
|
|
|
struct cue_chain {
|
|
|
|
struct cue_softc *cue_sc;
|
|
|
|
struct usbd_xfer *cue_xfer;
|
|
|
|
char *cue_buf;
|
|
|
|
struct mbuf *cue_mbuf;
|
|
|
|
int cue_idx;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct cue_cdata {
|
|
|
|
struct cue_chain cue_tx_chain[CUE_TX_LIST_CNT];
|
|
|
|
struct cue_chain cue_rx_chain[CUE_RX_LIST_CNT];
|
|
|
|
int cue_tx_prod;
|
|
|
|
int cue_tx_cnt;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct cue_softc {
|
|
|
|
struct usbnet cue_un;
|
|
|
|
uint8_t cue_mctab[CUE_MCAST_TABLE_LEN];
|
|
|
|
};
|
|
|
|
|
2000-01-17 20:12:20 +03:00
|
|
|
/*
|
|
|
|
* Various supported device vendors/products.
|
|
|
|
*/
|
2020-01-07 09:42:26 +03:00
|
|
|
static const struct usb_devno cue_devs[] = {
|
2000-01-17 20:12:20 +03:00
|
|
|
{ USB_VENDOR_CATC, USB_PRODUCT_CATC_NETMATE },
|
|
|
|
{ USB_VENDOR_CATC, USB_PRODUCT_CATC_NETMATE2 },
|
2000-04-23 23:03:45 +04:00
|
|
|
{ USB_VENDOR_SMARTBRIDGES, USB_PRODUCT_SMARTBRIDGES_SMARTLINK },
|
2000-03-24 16:08:28 +03:00
|
|
|
/* Belkin F5U111 adapter covered by NETMATE entry */
|
2000-01-17 20:12:20 +03:00
|
|
|
};
|
2001-12-12 18:36:08 +03:00
|
|
|
#define cue_lookup(v, p) (usb_lookup(cue_devs, v, p))
|
2000-01-17 20:12:20 +03:00
|
|
|
|
2020-01-07 09:42:26 +03:00
|
|
|
static int cue_match(device_t, cfdata_t, void *);
|
|
|
|
static void cue_attach(device_t, device_t, void *);
|
2019-05-05 06:17:54 +03:00
|
|
|
|
2010-11-04 01:28:31 +03:00
|
|
|
CFATTACH_DECL_NEW(cue, sizeof(struct cue_softc), cue_match, cue_attach,
|
2019-08-15 11:02:32 +03:00
|
|
|
usbnet_detach, usbnet_activate);
|
|
|
|
|
2020-03-16 02:04:50 +03:00
|
|
|
static unsigned cue_uno_tx_prepare(struct usbnet *, struct mbuf *,
|
|
|
|
struct usbnet_chain *);
|
|
|
|
static void cue_uno_rx_loop(struct usbnet *, struct usbnet_chain *, uint32_t);
|
2022-03-03 08:51:06 +03:00
|
|
|
static void cue_uno_mcast(struct ifnet *);
|
2020-03-16 02:04:50 +03:00
|
|
|
static void cue_uno_stop(struct ifnet *, int);
|
|
|
|
static int cue_uno_init(struct ifnet *);
|
|
|
|
static void cue_uno_tick(struct usbnet *);
|
2019-08-15 11:02:32 +03:00
|
|
|
|
2020-01-07 09:42:26 +03:00
|
|
|
static const struct usbnet_ops cue_ops = {
|
2020-03-16 02:04:50 +03:00
|
|
|
.uno_stop = cue_uno_stop,
|
2022-03-03 08:51:06 +03:00
|
|
|
.uno_mcast = cue_uno_mcast,
|
2020-03-16 02:04:50 +03:00
|
|
|
.uno_tx_prepare = cue_uno_tx_prepare,
|
|
|
|
.uno_rx_loop = cue_uno_rx_loop,
|
|
|
|
.uno_init = cue_uno_init,
|
|
|
|
.uno_tick = cue_uno_tick,
|
2019-08-15 11:02:32 +03:00
|
|
|
};
|
2000-02-28 01:15:24 +03:00
|
|
|
|
2019-08-15 11:02:32 +03:00
|
|
|
#ifdef CUE_DEBUG
|
|
|
|
static int
|
|
|
|
cue_csr_read_1(struct usbnet *un, int reg)
|
2000-01-17 20:12:20 +03:00
|
|
|
{
|
|
|
|
usb_device_request_t req;
|
|
|
|
usbd_status err;
|
2016-04-23 13:15:27 +03:00
|
|
|
uint8_t val = 0;
|
2000-01-17 20:12:20 +03:00
|
|
|
|
2019-08-15 11:02:32 +03:00
|
|
|
if (usbnet_isdying(un))
|
2016-04-23 13:15:27 +03:00
|
|
|
return 0;
|
2000-01-17 20:12:20 +03:00
|
|
|
|
|
|
|
req.bmRequestType = UT_READ_VENDOR_DEVICE;
|
|
|
|
req.bRequest = CUE_CMD_READREG;
|
|
|
|
USETW(req.wValue, 0);
|
|
|
|
USETW(req.wIndex, reg);
|
|
|
|
USETW(req.wLength, 1);
|
|
|
|
|
2019-08-15 11:02:32 +03:00
|
|
|
err = usbd_do_request(un->un_udev, &req, &val);
|
2000-01-17 20:12:20 +03:00
|
|
|
|
2000-03-24 16:08:28 +03:00
|
|
|
if (err) {
|
2020-03-13 21:17:40 +03:00
|
|
|
DPRINTF(("%s: cue_csr_read_1: reg=%#x err=%s\n",
|
2019-08-15 11:02:32 +03:00
|
|
|
device_xname(un->un_dev), reg, usbd_errstr(err)));
|
2016-04-23 13:15:27 +03:00
|
|
|
return 0;
|
2000-03-24 16:08:28 +03:00
|
|
|
}
|
|
|
|
|
2020-03-13 21:17:40 +03:00
|
|
|
DPRINTFN(10,("%s: cue_csr_read_1 reg=%#x val=%#x\n",
|
2019-08-15 11:02:32 +03:00
|
|
|
device_xname(un->un_dev), reg, val));
|
2000-01-17 20:12:20 +03:00
|
|
|
|
2016-04-23 13:15:27 +03:00
|
|
|
return val;
|
2000-01-17 20:12:20 +03:00
|
|
|
}
|
2019-08-15 11:02:32 +03:00
|
|
|
#endif
|
2000-01-17 20:12:20 +03:00
|
|
|
|
2019-08-15 11:02:32 +03:00
|
|
|
static int
|
|
|
|
cue_csr_read_2(struct usbnet *un, int reg)
|
2000-01-17 20:12:20 +03:00
|
|
|
{
|
|
|
|
usb_device_request_t req;
|
|
|
|
usbd_status err;
|
2000-03-24 16:08:28 +03:00
|
|
|
uWord val;
|
2000-01-17 20:12:20 +03:00
|
|
|
|
2019-08-15 11:02:32 +03:00
|
|
|
if (usbnet_isdying(un))
|
2016-04-23 13:15:27 +03:00
|
|
|
return 0;
|
2000-01-17 20:12:20 +03:00
|
|
|
|
|
|
|
req.bmRequestType = UT_READ_VENDOR_DEVICE;
|
|
|
|
req.bRequest = CUE_CMD_READREG;
|
|
|
|
USETW(req.wValue, 0);
|
|
|
|
USETW(req.wIndex, reg);
|
|
|
|
USETW(req.wLength, 2);
|
|
|
|
|
2019-08-15 11:02:32 +03:00
|
|
|
err = usbd_do_request(un->un_udev, &req, &val);
|
2000-01-17 20:12:20 +03:00
|
|
|
|
2020-03-13 21:17:40 +03:00
|
|
|
DPRINTFN(10,("%s: cue_csr_read_2 reg=%#x val=%#x\n",
|
2019-08-15 11:02:32 +03:00
|
|
|
device_xname(un->un_dev), reg, UGETW(val)));
|
2000-03-24 16:08:28 +03:00
|
|
|
|
|
|
|
if (err) {
|
2020-03-13 21:17:40 +03:00
|
|
|
DPRINTF(("%s: cue_csr_read_2: reg=%#x err=%s\n",
|
2019-08-15 11:02:32 +03:00
|
|
|
device_xname(un->un_dev), reg, usbd_errstr(err)));
|
2016-04-23 13:15:27 +03:00
|
|
|
return 0;
|
2000-03-24 16:08:28 +03:00
|
|
|
}
|
2000-01-17 20:12:20 +03:00
|
|
|
|
2016-04-23 13:15:27 +03:00
|
|
|
return UGETW(val);
|
2000-01-17 20:12:20 +03:00
|
|
|
}
|
|
|
|
|
2019-08-15 11:02:32 +03:00
|
|
|
static int
|
|
|
|
cue_csr_write_1(struct usbnet *un, int reg, int val)
|
2000-01-17 20:12:20 +03:00
|
|
|
{
|
|
|
|
usb_device_request_t req;
|
|
|
|
usbd_status err;
|
|
|
|
|
2019-08-15 11:02:32 +03:00
|
|
|
if (usbnet_isdying(un))
|
2016-04-23 13:15:27 +03:00
|
|
|
return 0;
|
2000-03-24 16:08:28 +03:00
|
|
|
|
2020-03-13 21:17:40 +03:00
|
|
|
DPRINTFN(10,("%s: cue_csr_write_1 reg=%#x val=%#x\n",
|
2019-08-15 11:02:32 +03:00
|
|
|
device_xname(un->un_dev), reg, val));
|
2000-01-17 20:12:20 +03:00
|
|
|
|
|
|
|
req.bmRequestType = UT_WRITE_VENDOR_DEVICE;
|
|
|
|
req.bRequest = CUE_CMD_WRITEREG;
|
|
|
|
USETW(req.wValue, val);
|
|
|
|
USETW(req.wIndex, reg);
|
|
|
|
USETW(req.wLength, 0);
|
|
|
|
|
2019-08-15 11:02:32 +03:00
|
|
|
err = usbd_do_request(un->un_udev, &req, NULL);
|
2000-01-17 20:12:20 +03:00
|
|
|
|
2000-03-24 16:08:28 +03:00
|
|
|
if (err) {
|
2020-03-13 21:17:40 +03:00
|
|
|
DPRINTF(("%s: cue_csr_write_1: reg=%#x err=%s\n",
|
2019-08-15 11:02:32 +03:00
|
|
|
device_xname(un->un_dev), reg, usbd_errstr(err)));
|
2016-04-23 13:15:27 +03:00
|
|
|
return -1;
|
2000-03-24 16:08:28 +03:00
|
|
|
}
|
|
|
|
|
2020-03-13 21:17:40 +03:00
|
|
|
DPRINTFN(20,("%s: cue_csr_write_1, after reg=%#x val=%#x\n",
|
2019-08-15 11:02:32 +03:00
|
|
|
device_xname(un->un_dev), reg, cue_csr_read_1(un, reg)));
|
2000-01-17 20:12:20 +03:00
|
|
|
|
2016-04-23 13:15:27 +03:00
|
|
|
return 0;
|
2000-01-17 20:12:20 +03:00
|
|
|
}
|
|
|
|
|
2000-06-01 18:28:57 +04:00
|
|
|
#if 0
|
2019-08-15 11:02:32 +03:00
|
|
|
static int
|
|
|
|
cue_csr_write_2(struct usbnet *un, int reg, int aval)
|
2000-01-17 20:12:20 +03:00
|
|
|
{
|
|
|
|
usb_device_request_t req;
|
|
|
|
usbd_status err;
|
2000-03-24 16:08:28 +03:00
|
|
|
uWord val;
|
2000-01-17 20:12:20 +03:00
|
|
|
int s;
|
|
|
|
|
2019-08-15 11:02:32 +03:00
|
|
|
if (usbnet_isdying(un))
|
2016-04-23 13:15:27 +03:00
|
|
|
return 0;
|
2000-03-24 16:08:28 +03:00
|
|
|
|
2020-03-13 21:17:40 +03:00
|
|
|
DPRINTFN(10,("%s: cue_csr_write_2 reg=%#x val=%#x\n",
|
2019-08-15 11:02:32 +03:00
|
|
|
device_xname(un->un_dev), reg, aval));
|
2000-01-17 20:12:20 +03:00
|
|
|
|
2000-03-24 16:08:28 +03:00
|
|
|
USETW(val, aval);
|
2000-01-17 20:12:20 +03:00
|
|
|
req.bmRequestType = UT_WRITE_VENDOR_DEVICE;
|
|
|
|
req.bRequest = CUE_CMD_WRITEREG;
|
|
|
|
USETW(req.wValue, val);
|
|
|
|
USETW(req.wIndex, reg);
|
|
|
|
USETW(req.wLength, 0);
|
|
|
|
|
2019-08-15 11:02:32 +03:00
|
|
|
err = usbd_do_request(un->un_udev, &req, NULL);
|
2000-01-17 20:12:20 +03:00
|
|
|
|
2000-03-24 16:08:28 +03:00
|
|
|
if (err) {
|
2020-03-13 21:17:40 +03:00
|
|
|
DPRINTF(("%s: cue_csr_write_2: reg=%#x err=%s\n",
|
2019-08-15 11:02:32 +03:00
|
|
|
device_xname(un->un_dev), reg, usbd_errstr(err)));
|
2016-04-23 13:15:27 +03:00
|
|
|
return -1;
|
2000-03-24 16:08:28 +03:00
|
|
|
}
|
2000-01-17 20:12:20 +03:00
|
|
|
|
2016-04-23 13:15:27 +03:00
|
|
|
return 0;
|
2000-01-17 20:12:20 +03:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2019-08-15 11:02:32 +03:00
|
|
|
static int
|
|
|
|
cue_mem(struct usbnet *un, int cmd, int addr, void *buf, int len)
|
2000-01-17 20:12:20 +03:00
|
|
|
{
|
|
|
|
usb_device_request_t req;
|
|
|
|
usbd_status err;
|
|
|
|
|
2020-03-13 21:17:40 +03:00
|
|
|
DPRINTFN(10,("%s: cue_mem cmd=%#x addr=%#x len=%d\n",
|
2019-08-15 11:02:32 +03:00
|
|
|
device_xname(un->un_dev), cmd, addr, len));
|
2000-01-17 20:12:20 +03:00
|
|
|
|
|
|
|
if (cmd == CUE_CMD_READSRAM)
|
|
|
|
req.bmRequestType = UT_READ_VENDOR_DEVICE;
|
|
|
|
else
|
|
|
|
req.bmRequestType = UT_WRITE_VENDOR_DEVICE;
|
|
|
|
req.bRequest = cmd;
|
|
|
|
USETW(req.wValue, 0);
|
|
|
|
USETW(req.wIndex, addr);
|
|
|
|
USETW(req.wLength, len);
|
|
|
|
|
2019-08-15 11:02:32 +03:00
|
|
|
err = usbd_do_request(un->un_udev, &req, buf);
|
2000-01-17 20:12:20 +03:00
|
|
|
|
2000-03-24 16:08:28 +03:00
|
|
|
if (err) {
|
2020-03-13 21:17:40 +03:00
|
|
|
DPRINTF(("%s: cue_csr_mem: addr=%#x err=%s\n",
|
2019-08-15 11:02:32 +03:00
|
|
|
device_xname(un->un_dev), addr, usbd_errstr(err)));
|
2016-04-23 13:15:27 +03:00
|
|
|
return -1;
|
2000-03-24 16:08:28 +03:00
|
|
|
}
|
2000-01-17 20:12:20 +03:00
|
|
|
|
2016-04-23 13:15:27 +03:00
|
|
|
return 0;
|
2000-01-17 20:12:20 +03:00
|
|
|
}
|
|
|
|
|
2019-08-15 11:02:32 +03:00
|
|
|
static int
|
|
|
|
cue_getmac(struct usbnet *un)
|
2000-01-17 20:12:20 +03:00
|
|
|
{
|
|
|
|
usb_device_request_t req;
|
|
|
|
usbd_status err;
|
|
|
|
|
2019-08-15 11:02:32 +03:00
|
|
|
DPRINTFN(10,("%s: cue_getmac\n", device_xname(un->un_dev)));
|
2000-01-17 20:12:20 +03:00
|
|
|
|
|
|
|
req.bmRequestType = UT_READ_VENDOR_DEVICE;
|
|
|
|
req.bRequest = CUE_CMD_GET_MACADDR;
|
|
|
|
USETW(req.wValue, 0);
|
|
|
|
USETW(req.wIndex, 0);
|
|
|
|
USETW(req.wLength, ETHER_ADDR_LEN);
|
|
|
|
|
2019-08-15 11:02:32 +03:00
|
|
|
err = usbd_do_request(un->un_udev, &req, un->un_eaddr);
|
2000-01-17 20:12:20 +03:00
|
|
|
|
|
|
|
if (err) {
|
2010-11-04 01:28:31 +03:00
|
|
|
printf("%s: read MAC address failed\n",
|
2019-08-15 11:02:32 +03:00
|
|
|
device_xname(un->un_dev));
|
2016-04-23 13:15:27 +03:00
|
|
|
return -1;
|
2000-01-17 20:12:20 +03:00
|
|
|
}
|
|
|
|
|
2016-04-23 13:15:27 +03:00
|
|
|
return 0;
|
2000-01-17 20:12:20 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
#define CUE_POLY 0xEDB88320
|
|
|
|
#define CUE_BITS 9
|
|
|
|
|
2019-08-15 11:02:32 +03:00
|
|
|
static uint32_t
|
2005-01-08 06:16:51 +03:00
|
|
|
cue_crc(const char *addr)
|
2000-01-17 20:12:20 +03:00
|
|
|
{
|
2016-04-23 13:15:27 +03:00
|
|
|
uint32_t idx, bit, data, crc;
|
2000-01-17 20:12:20 +03:00
|
|
|
|
|
|
|
/* Compute CRC for the address value. */
|
|
|
|
crc = 0xFFFFFFFF; /* initial value */
|
|
|
|
|
|
|
|
for (idx = 0; idx < 6; idx++) {
|
|
|
|
for (data = *addr++, bit = 0; bit < 8; bit++, data >>= 1)
|
|
|
|
crc = (crc >> 1) ^ (((crc ^ data) & 1) ? CUE_POLY : 0);
|
|
|
|
}
|
|
|
|
|
2016-04-23 13:15:27 +03:00
|
|
|
return crc & ((1 << CUE_BITS) - 1);
|
2000-01-17 20:12:20 +03:00
|
|
|
}
|
|
|
|
|
2019-08-15 11:02:32 +03:00
|
|
|
static void
|
2022-03-03 08:53:04 +03:00
|
|
|
cue_uno_mcast(struct ifnet *ifp)
|
2000-01-17 20:12:20 +03:00
|
|
|
{
|
2022-03-03 08:53:04 +03:00
|
|
|
struct usbnet *un = ifp->if_softc;
|
2019-08-15 11:02:32 +03:00
|
|
|
struct cue_softc *sc = usbnet_softc(un);
|
|
|
|
struct ethercom *ec = usbnet_ec(un);
|
2000-03-24 16:08:28 +03:00
|
|
|
struct ether_multi *enm;
|
|
|
|
struct ether_multistep step;
|
2016-04-23 13:15:27 +03:00
|
|
|
uint32_t h, i;
|
2000-01-17 20:12:20 +03:00
|
|
|
|
2022-08-20 17:08:59 +03:00
|
|
|
DPRINTFN(2,("%s: cue_setiff promisc=%d\n",
|
|
|
|
device_xname(un->un_dev), usbnet_ispromisc(un)));
|
2000-03-24 16:08:28 +03:00
|
|
|
|
2022-08-20 17:08:59 +03:00
|
|
|
if (usbnet_ispromisc(un)) {
|
2022-03-03 08:53:14 +03:00
|
|
|
ETHER_LOCK(ec);
|
2001-01-29 04:24:42 +03:00
|
|
|
allmulti:
|
2022-03-03 08:53:14 +03:00
|
|
|
ec->ec_flags |= ETHER_F_ALLMULTI;
|
|
|
|
ETHER_UNLOCK(ec);
|
2000-01-17 20:12:20 +03:00
|
|
|
for (i = 0; i < CUE_MCAST_TABLE_LEN; i++)
|
|
|
|
sc->cue_mctab[i] = 0xFF;
|
2019-08-15 11:02:32 +03:00
|
|
|
cue_mem(un, CUE_CMD_WRITESRAM, CUE_MCAST_TABLE_ADDR,
|
2000-03-24 16:08:28 +03:00
|
|
|
&sc->cue_mctab, CUE_MCAST_TABLE_LEN);
|
2000-01-17 20:12:20 +03:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* first, zot all the existing hash bits */
|
|
|
|
for (i = 0; i < CUE_MCAST_TABLE_LEN; i++)
|
|
|
|
sc->cue_mctab[i] = 0;
|
|
|
|
|
|
|
|
/* now program new ones */
|
2019-05-28 10:41:46 +03:00
|
|
|
ETHER_LOCK(ec);
|
|
|
|
ETHER_FIRST_MULTI(step, ec, enm);
|
2000-03-24 16:08:28 +03:00
|
|
|
while (enm != NULL) {
|
|
|
|
if (memcmp(enm->enm_addrlo,
|
2019-05-28 10:41:46 +03:00
|
|
|
enm->enm_addrhi, ETHER_ADDR_LEN) != 0) {
|
2001-01-29 04:24:42 +03:00
|
|
|
goto allmulti;
|
2019-05-28 10:41:46 +03:00
|
|
|
}
|
2001-01-29 04:24:42 +03:00
|
|
|
|
2000-03-24 16:08:28 +03:00
|
|
|
h = cue_crc(enm->enm_addrlo);
|
2002-07-12 01:14:24 +04:00
|
|
|
sc->cue_mctab[h >> 3] |= 1 << (h & 0x7);
|
2000-03-24 16:08:28 +03:00
|
|
|
ETHER_NEXT_MULTI(step, enm);
|
|
|
|
}
|
2022-03-03 08:53:14 +03:00
|
|
|
ec->ec_flags &= ~ETHER_F_ALLMULTI;
|
2019-05-28 10:41:46 +03:00
|
|
|
ETHER_UNLOCK(ec);
|
2000-01-17 20:12:20 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Also include the broadcast address in the filter
|
|
|
|
* so we can receive broadcast frames.
|
|
|
|
*/
|
2022-08-20 17:09:10 +03:00
|
|
|
h = cue_crc(etherbroadcastaddr);
|
|
|
|
sc->cue_mctab[h >> 3] |= 1 << (h & 0x7);
|
2000-01-17 20:12:20 +03:00
|
|
|
|
2019-08-15 11:02:32 +03:00
|
|
|
cue_mem(un, CUE_CMD_WRITESRAM, CUE_MCAST_TABLE_ADDR,
|
2000-01-17 20:12:20 +03:00
|
|
|
&sc->cue_mctab, CUE_MCAST_TABLE_LEN);
|
|
|
|
}
|
|
|
|
|
2019-08-15 11:02:32 +03:00
|
|
|
static void
|
|
|
|
cue_reset(struct usbnet *un)
|
2000-01-17 20:12:20 +03:00
|
|
|
{
|
|
|
|
usb_device_request_t req;
|
|
|
|
usbd_status err;
|
|
|
|
|
2019-08-15 11:02:32 +03:00
|
|
|
DPRINTFN(2,("%s: cue_reset\n", device_xname(un->un_dev)));
|
2000-03-24 16:08:28 +03:00
|
|
|
|
2019-08-15 11:02:32 +03:00
|
|
|
if (usbnet_isdying(un))
|
2000-03-24 16:08:28 +03:00
|
|
|
return;
|
2000-01-17 20:12:20 +03:00
|
|
|
|
|
|
|
req.bmRequestType = UT_WRITE_VENDOR_DEVICE;
|
|
|
|
req.bRequest = CUE_CMD_RESET;
|
|
|
|
USETW(req.wValue, 0);
|
|
|
|
USETW(req.wIndex, 0);
|
|
|
|
USETW(req.wLength, 0);
|
|
|
|
|
2019-08-15 11:02:32 +03:00
|
|
|
err = usbd_do_request(un->un_udev, &req, NULL);
|
2000-01-17 20:12:20 +03:00
|
|
|
|
|
|
|
if (err)
|
2019-08-15 11:02:32 +03:00
|
|
|
printf("%s: reset failed\n", device_xname(un->un_dev));
|
2000-01-17 20:12:20 +03:00
|
|
|
|
|
|
|
/* Wait a little while for the chip to get its brains in order. */
|
2019-08-15 11:02:32 +03:00
|
|
|
usbd_delay_ms(un->un_udev, 1);
|
2000-01-17 20:12:20 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Probe for a CATC chip.
|
|
|
|
*/
|
2020-01-07 09:42:26 +03:00
|
|
|
static int
|
2010-11-04 01:28:31 +03:00
|
|
|
cue_match(device_t parent, cfdata_t match, void *aux)
|
2000-01-17 20:12:20 +03:00
|
|
|
{
|
2010-11-04 01:28:31 +03:00
|
|
|
struct usb_attach_arg *uaa = aux;
|
2000-01-17 20:12:20 +03:00
|
|
|
|
2016-04-23 13:15:27 +03:00
|
|
|
return cue_lookup(uaa->uaa_vendor, uaa->uaa_product) != NULL ?
|
|
|
|
UMATCH_VENDOR_PRODUCT : UMATCH_NONE;
|
2000-01-17 20:12:20 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Attach the interface. Allocate softc structures, do ifmedia
|
|
|
|
* setup and ethernet/BPF attach.
|
|
|
|
*/
|
2020-01-07 09:42:26 +03:00
|
|
|
static void
|
2010-11-04 01:28:31 +03:00
|
|
|
cue_attach(device_t parent, device_t self, void *aux)
|
2000-01-17 20:12:20 +03:00
|
|
|
{
|
2010-11-04 01:28:31 +03:00
|
|
|
struct cue_softc *sc = device_private(self);
|
2019-08-15 11:02:32 +03:00
|
|
|
struct usbnet * const un = &sc->cue_un;
|
2010-11-04 01:28:31 +03:00
|
|
|
struct usb_attach_arg *uaa = aux;
|
2005-05-11 14:02:28 +04:00
|
|
|
char *devinfop;
|
2016-04-23 13:15:27 +03:00
|
|
|
struct usbd_device * dev = uaa->uaa_device;
|
2000-01-17 20:12:20 +03:00
|
|
|
usbd_status err;
|
|
|
|
usb_interface_descriptor_t *id;
|
|
|
|
usb_endpoint_descriptor_t *ed;
|
|
|
|
int i;
|
|
|
|
|
2019-08-15 11:02:32 +03:00
|
|
|
KASSERT((void *)sc == un);
|
2000-01-17 20:12:20 +03:00
|
|
|
|
2019-08-15 11:02:32 +03:00
|
|
|
DPRINTFN(5,(" : cue_attach: sc=%p, dev=%p", sc, dev));
|
2008-05-24 20:40:58 +04:00
|
|
|
|
2009-09-23 23:07:19 +04:00
|
|
|
aprint_naive("\n");
|
|
|
|
aprint_normal("\n");
|
2005-05-11 14:02:28 +04:00
|
|
|
devinfop = usbd_devinfo_alloc(dev, 0);
|
2008-05-24 20:40:58 +04:00
|
|
|
aprint_normal_dev(self, "%s\n", devinfop);
|
2005-05-11 14:02:28 +04:00
|
|
|
usbd_devinfo_free(devinfop);
|
2000-01-17 20:12:20 +03:00
|
|
|
|
2000-10-24 18:53:59 +04:00
|
|
|
err = usbd_set_config_no(dev, CUE_CONFIG_NO, 1);
|
2000-01-17 20:12:20 +03:00
|
|
|
if (err) {
|
2012-12-27 20:42:32 +04:00
|
|
|
aprint_error_dev(self, "failed to set configuration"
|
|
|
|
", err=%s\n", usbd_errstr(err));
|
2010-11-04 01:28:31 +03:00
|
|
|
return;
|
2000-01-17 20:12:20 +03:00
|
|
|
}
|
|
|
|
|
2019-08-15 11:02:32 +03:00
|
|
|
un->un_dev = self;
|
|
|
|
un->un_udev = dev;
|
|
|
|
un->un_sc = sc;
|
|
|
|
un->un_ops = &cue_ops;
|
|
|
|
un->un_rx_xfer_flags = USBD_SHORT_XFER_OK;
|
|
|
|
un->un_tx_xfer_flags = USBD_FORCE_SHORT_XFER;
|
|
|
|
un->un_rx_list_cnt = CUE_RX_LIST_CNT;
|
|
|
|
un->un_tx_list_cnt = CUE_TX_LIST_CNT;
|
|
|
|
un->un_rx_bufsz = CUE_BUFSZ;
|
|
|
|
un->un_tx_bufsz = CUE_BUFSZ;
|
2000-01-17 20:12:20 +03:00
|
|
|
|
2019-08-15 11:02:32 +03:00
|
|
|
err = usbd_device2interface_handle(dev, CUE_IFACE_IDX, &un->un_iface);
|
2000-01-17 20:12:20 +03:00
|
|
|
if (err) {
|
2008-05-24 20:40:58 +04:00
|
|
|
aprint_error_dev(self, "getting interface handle failed\n");
|
2010-11-04 01:28:31 +03:00
|
|
|
return;
|
2000-01-17 20:12:20 +03:00
|
|
|
}
|
|
|
|
|
2019-08-15 11:02:32 +03:00
|
|
|
id = usbd_get_interface_descriptor(un->un_iface);
|
2000-01-17 20:12:20 +03:00
|
|
|
|
|
|
|
/* Find endpoints. */
|
|
|
|
for (i = 0; i < id->bNumEndpoints; i++) {
|
2019-08-15 11:02:32 +03:00
|
|
|
ed = usbd_interface2endpoint_descriptor(un->un_iface, i);
|
2000-01-17 20:12:20 +03:00
|
|
|
if (ed == NULL) {
|
2008-05-24 20:40:58 +04:00
|
|
|
aprint_error_dev(self, "couldn't get ep %d\n", i);
|
2010-11-04 01:28:31 +03:00
|
|
|
return;
|
2000-01-17 20:12:20 +03:00
|
|
|
}
|
|
|
|
if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN &&
|
2000-03-06 23:58:18 +03:00
|
|
|
UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) {
|
2019-08-15 11:02:32 +03:00
|
|
|
un->un_ed[USBNET_ENDPT_RX] = ed->bEndpointAddress;
|
2000-01-17 20:12:20 +03:00
|
|
|
} else if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_OUT &&
|
2000-03-06 23:58:18 +03:00
|
|
|
UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) {
|
2019-08-15 11:02:32 +03:00
|
|
|
un->un_ed[USBNET_ENDPT_TX] = ed->bEndpointAddress;
|
2000-01-17 20:12:20 +03:00
|
|
|
} else if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN &&
|
2000-03-06 23:58:18 +03:00
|
|
|
UE_GET_XFERTYPE(ed->bmAttributes) == UE_INTERRUPT) {
|
2019-08-15 11:02:32 +03:00
|
|
|
un->un_ed[USBNET_ENDPT_INTR] = ed->bEndpointAddress;
|
2000-01-17 20:12:20 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-08-15 11:02:32 +03:00
|
|
|
/* First level attach. */
|
2022-03-03 08:56:28 +03:00
|
|
|
usbnet_attach(un);
|
2019-08-15 11:02:32 +03:00
|
|
|
|
2000-03-24 16:08:28 +03:00
|
|
|
#if 0
|
2000-01-17 20:12:20 +03:00
|
|
|
/* Reset the adapter. */
|
2019-08-15 11:02:32 +03:00
|
|
|
cue_reset(un);
|
2000-01-17 20:12:20 +03:00
|
|
|
#endif
|
|
|
|
/*
|
|
|
|
* Get station address.
|
|
|
|
*/
|
2019-08-15 11:02:32 +03:00
|
|
|
cue_getmac(un);
|
2000-01-17 20:12:20 +03:00
|
|
|
|
2019-08-20 09:37:06 +03:00
|
|
|
usbnet_attach_ifp(un, IFF_SIMPLEX | IFF_BROADCAST | IFF_MULTICAST,
|
|
|
|
0, NULL);
|
2000-01-17 20:12:20 +03:00
|
|
|
}
|
|
|
|
|
2019-08-15 11:02:32 +03:00
|
|
|
static void
|
2020-03-16 02:04:50 +03:00
|
|
|
cue_uno_tick(struct usbnet *un)
|
2000-01-17 20:12:20 +03:00
|
|
|
{
|
2019-08-15 11:02:32 +03:00
|
|
|
struct ifnet *ifp = usbnet_ifp(un);
|
2000-01-17 20:12:20 +03:00
|
|
|
|
2020-01-29 09:17:07 +03:00
|
|
|
net_stat_ref_t nsr = IF_STAT_GETREF(ifp);
|
2019-08-15 11:02:32 +03:00
|
|
|
if (cue_csr_read_2(un, CUE_RX_FRAMEERR))
|
2020-01-29 09:17:07 +03:00
|
|
|
if_statinc_ref(nsr, if_ierrors);
|
|
|
|
|
|
|
|
if_statadd_ref(nsr, if_collisions,
|
|
|
|
cue_csr_read_2(un, CUE_TX_SINGLECOLL));
|
|
|
|
if_statadd_ref(nsr, if_collisions,
|
|
|
|
cue_csr_read_2(un, CUE_TX_MULTICOLL));
|
|
|
|
if_statadd_ref(nsr, if_collisions,
|
|
|
|
cue_csr_read_2(un, CUE_TX_EXCESSCOLL));
|
|
|
|
IF_STAT_PUTREF(ifp);
|
2000-01-17 20:12:20 +03:00
|
|
|
}
|
|
|
|
|
2019-08-15 11:02:32 +03:00
|
|
|
static void
|
2020-03-16 02:04:50 +03:00
|
|
|
cue_uno_rx_loop(struct usbnet *un, struct usbnet_chain *c, uint32_t total_len)
|
2000-01-17 20:12:20 +03:00
|
|
|
{
|
2019-08-15 11:02:32 +03:00
|
|
|
struct ifnet *ifp = usbnet_ifp(un);
|
|
|
|
uint8_t *buf = c->unc_buf;
|
2016-04-23 13:15:27 +03:00
|
|
|
uint16_t len;
|
2000-01-17 20:12:20 +03:00
|
|
|
|
2019-08-15 11:02:32 +03:00
|
|
|
DPRINTFN(5,("%s: %s: total_len=%d len=%d\n",
|
|
|
|
device_xname(un->un_dev), __func__,
|
|
|
|
total_len, le16dec(buf)));
|
2000-01-17 20:12:20 +03:00
|
|
|
|
2019-08-15 11:02:32 +03:00
|
|
|
len = UGETW(buf);
|
|
|
|
if (total_len < 2 ||
|
|
|
|
len > total_len - 2 ||
|
|
|
|
len < sizeof(struct ether_header)) {
|
2020-01-29 09:17:07 +03:00
|
|
|
if_statinc(ifp, if_ierrors);
|
2000-01-17 20:12:20 +03:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2019-08-15 11:02:32 +03:00
|
|
|
/* No errors; receive the packet. */
|
|
|
|
usbnet_enqueue(un, buf + 2, len, 0, 0, 0);
|
2001-01-21 22:30:35 +03:00
|
|
|
}
|
|
|
|
|
2019-08-15 11:02:32 +03:00
|
|
|
static unsigned
|
2020-03-16 02:04:50 +03:00
|
|
|
cue_uno_tx_prepare(struct usbnet *un, struct mbuf *m, struct usbnet_chain *c)
|
2001-01-21 22:30:35 +03:00
|
|
|
{
|
2019-08-15 11:02:32 +03:00
|
|
|
unsigned total_len;
|
2000-01-17 20:12:20 +03:00
|
|
|
|
2019-08-15 11:02:32 +03:00
|
|
|
DPRINTFN(5,("%s: %s: mbuf len=%d\n",
|
|
|
|
device_xname(un->un_dev), __func__,
|
|
|
|
m->m_pkthdr.len));
|
2000-01-17 20:12:20 +03:00
|
|
|
|
2019-08-15 11:02:32 +03:00
|
|
|
if ((unsigned)m->m_pkthdr.len > un->un_tx_bufsz - 2)
|
|
|
|
return 0;
|
2000-01-17 20:12:20 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Copy the mbuf data into a contiguous buffer, leaving two
|
|
|
|
* bytes at the beginning to hold the frame length.
|
|
|
|
*/
|
2019-08-15 11:02:32 +03:00
|
|
|
m_copydata(m, 0, m->m_pkthdr.len, c->unc_buf + 2);
|
2000-01-17 20:12:20 +03:00
|
|
|
|
|
|
|
total_len = m->m_pkthdr.len + 2;
|
|
|
|
|
|
|
|
/* The first two bytes are the frame length */
|
2019-08-15 11:02:32 +03:00
|
|
|
c->unc_buf[0] = (uint8_t)m->m_pkthdr.len;
|
|
|
|
c->unc_buf[1] = (uint8_t)(m->m_pkthdr.len >> 8);
|
2000-01-17 20:12:20 +03:00
|
|
|
|
2019-08-15 11:02:32 +03:00
|
|
|
return total_len;
|
2000-01-17 20:12:20 +03:00
|
|
|
}
|
|
|
|
|
2019-08-15 11:02:32 +03:00
|
|
|
static int
|
2022-03-03 08:52:35 +03:00
|
|
|
cue_uno_init(struct ifnet *ifp)
|
2000-01-17 20:12:20 +03:00
|
|
|
{
|
2019-08-15 11:02:32 +03:00
|
|
|
struct usbnet * const un = ifp->if_softc;
|
|
|
|
int i, ctl;
|
2007-08-30 02:33:42 +04:00
|
|
|
const u_char *eaddr;
|
2000-01-17 20:12:20 +03:00
|
|
|
|
2019-08-15 11:02:32 +03:00
|
|
|
DPRINTFN(10,("%s: %s: enter\n", device_xname(un->un_dev),__func__));
|
2000-03-24 16:08:28 +03:00
|
|
|
|
2019-08-15 11:02:32 +03:00
|
|
|
/* Cancel pending I/O */
|
2022-03-03 08:55:29 +03:00
|
|
|
cue_uno_stop(ifp, 1);
|
2000-01-17 20:12:20 +03:00
|
|
|
|
2019-08-15 11:02:32 +03:00
|
|
|
/* Reset the interface. */
|
2000-03-24 16:08:28 +03:00
|
|
|
#if 1
|
2019-08-15 11:02:32 +03:00
|
|
|
cue_reset(un);
|
2000-01-17 20:12:20 +03:00
|
|
|
#endif
|
|
|
|
|
2000-03-24 16:08:28 +03:00
|
|
|
/* Set advanced operation modes. */
|
2019-08-15 11:02:32 +03:00
|
|
|
cue_csr_write_1(un, CUE_ADVANCED_OPMODES,
|
2000-03-24 16:08:28 +03:00
|
|
|
CUE_AOP_EMBED_RXLEN | 0x03); /* 1 wait state */
|
|
|
|
|
2007-08-30 02:33:42 +04:00
|
|
|
eaddr = CLLADDR(ifp->if_sadl);
|
2000-01-17 20:12:20 +03:00
|
|
|
/* Set MAC address */
|
|
|
|
for (i = 0; i < ETHER_ADDR_LEN; i++)
|
2019-08-15 11:02:32 +03:00
|
|
|
cue_csr_write_1(un, CUE_PAR0 - i, eaddr[i]);
|
2000-01-17 20:12:20 +03:00
|
|
|
|
|
|
|
/* Enable RX logic. */
|
2000-03-24 16:08:28 +03:00
|
|
|
ctl = CUE_ETHCTL_RX_ON | CUE_ETHCTL_MCAST_ON;
|
2022-08-20 17:08:59 +03:00
|
|
|
if (usbnet_ispromisc(un))
|
2000-03-24 16:08:28 +03:00
|
|
|
ctl |= CUE_ETHCTL_PROMISC;
|
2019-08-15 11:02:32 +03:00
|
|
|
cue_csr_write_1(un, CUE_ETHCTL, ctl);
|
2000-01-17 20:12:20 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Set the number of RX and TX buffers that we want
|
|
|
|
* to reserve inside the ASIC.
|
|
|
|
*/
|
2019-08-15 11:02:32 +03:00
|
|
|
cue_csr_write_1(un, CUE_RX_BUFPKTS, CUE_RX_FRAMES);
|
|
|
|
cue_csr_write_1(un, CUE_TX_BUFPKTS, CUE_TX_FRAMES);
|
2000-01-17 20:12:20 +03:00
|
|
|
|
|
|
|
/* Set advanced operation modes. */
|
2019-08-15 11:02:32 +03:00
|
|
|
cue_csr_write_1(un, CUE_ADVANCED_OPMODES,
|
2000-03-24 16:08:28 +03:00
|
|
|
CUE_AOP_EMBED_RXLEN | 0x01); /* 1 wait state */
|
2000-01-17 20:12:20 +03:00
|
|
|
|
|
|
|
/* Program the LED operation. */
|
2019-08-15 11:02:32 +03:00
|
|
|
cue_csr_write_1(un, CUE_LEDCTL, CUE_LEDCTL_FOLLOW_LINK);
|
2000-01-17 20:12:20 +03:00
|
|
|
|
2022-03-03 08:56:09 +03:00
|
|
|
return 0;
|
2000-03-24 16:08:28 +03:00
|
|
|
}
|
|
|
|
|
2019-08-15 11:02:32 +03:00
|
|
|
/* Stop and reset the adapter. */
|
|
|
|
static void
|
2020-03-16 02:04:50 +03:00
|
|
|
cue_uno_stop(struct ifnet *ifp, int disable)
|
2000-01-17 20:12:20 +03:00
|
|
|
{
|
2019-08-15 11:02:32 +03:00
|
|
|
struct usbnet * const un = ifp->if_softc;
|
2000-01-17 20:12:20 +03:00
|
|
|
|
2019-08-15 11:02:32 +03:00
|
|
|
DPRINTFN(10,("%s: %s: enter\n", device_xname(un->un_dev), __func__));
|
2000-01-17 20:12:20 +03:00
|
|
|
|
2019-08-15 11:02:32 +03:00
|
|
|
cue_csr_write_1(un, CUE_ETHCTL, 0);
|
|
|
|
cue_reset(un);
|
2000-01-17 20:12:20 +03:00
|
|
|
}
|
|
|
|
|
2019-08-15 11:02:32 +03:00
|
|
|
#ifdef _MODULE
|
|
|
|
#include "ioconf.c"
|
|
|
|
#endif
|
2016-04-23 13:15:27 +03:00
|
|
|
|
2019-08-15 11:02:32 +03:00
|
|
|
USBNET_MODULE(cue)
|