102ac6454SAndrew Thompson /* $FreeBSD$ */ 202ac6454SAndrew Thompson /* $NetBSD: ugensa.c,v 1.9.2.1 2007/03/24 14:55:50 yamt Exp $ */ 302ac6454SAndrew Thompson 402ac6454SAndrew Thompson /* 502ac6454SAndrew Thompson * Copyright (c) 2004, 2005 The NetBSD Foundation, Inc. 602ac6454SAndrew Thompson * All rights reserved. 702ac6454SAndrew Thompson * 802ac6454SAndrew Thompson * This code is derived from software contributed to The NetBSD Foundation 902ac6454SAndrew Thompson * by Roland C. Dowdeswell <elric@netbsd.org>. 1002ac6454SAndrew Thompson * 1102ac6454SAndrew Thompson * Redistribution and use in source and binary forms, with or without 1202ac6454SAndrew Thompson * modification, are permitted provided that the following conditions 1302ac6454SAndrew Thompson * are met: 1402ac6454SAndrew Thompson * 1. Redistributions of source code must retain the above copyright 1502ac6454SAndrew Thompson * notice, this list of conditions and the following disclaimer. 1602ac6454SAndrew Thompson * 2. Redistributions in binary form must reproduce the above copyright 1702ac6454SAndrew Thompson * notice, this list of conditions and the following disclaimer in the 1802ac6454SAndrew Thompson * documentation and/or other materials provided with the distribution. 1902ac6454SAndrew Thompson * 3. All advertising materials mentioning features or use of this software 2002ac6454SAndrew Thompson * must display the following acknowledgement: 2102ac6454SAndrew Thompson * This product includes software developed by the NetBSD 2202ac6454SAndrew Thompson * Foundation, Inc. and its contributors. 2302ac6454SAndrew Thompson * 4. Neither the name of The NetBSD Foundation nor the names of its 2402ac6454SAndrew Thompson * contributors may be used to endorse or promote products derived 2502ac6454SAndrew Thompson * from this software without specific prior written permission. 2602ac6454SAndrew Thompson * 2702ac6454SAndrew Thompson * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 2802ac6454SAndrew Thompson * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 2902ac6454SAndrew Thompson * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 3002ac6454SAndrew Thompson * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 3102ac6454SAndrew Thompson * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 3202ac6454SAndrew Thompson * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 3302ac6454SAndrew Thompson * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 3402ac6454SAndrew Thompson * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 3502ac6454SAndrew Thompson * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 3602ac6454SAndrew Thompson * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 3702ac6454SAndrew Thompson * POSSIBILITY OF SUCH DAMAGE. 3802ac6454SAndrew Thompson */ 3902ac6454SAndrew Thompson 4002ac6454SAndrew Thompson /* 4102ac6454SAndrew Thompson * NOTE: all function names beginning like "ugensa_cfg_" can only 4202ac6454SAndrew Thompson * be called from within the config thread function ! 4302ac6454SAndrew Thompson */ 4402ac6454SAndrew Thompson 4502ac6454SAndrew Thompson #include "usbdevs.h" 4602ac6454SAndrew Thompson #include <dev/usb/usb.h> 4702ac6454SAndrew Thompson #include <dev/usb/usb_mfunc.h> 4802ac6454SAndrew Thompson #include <dev/usb/usb_error.h> 4902ac6454SAndrew Thompson #include <dev/usb/usb_cdc.h> 5002ac6454SAndrew Thompson 5102ac6454SAndrew Thompson #define USB_DEBUG_VAR usb2_debug 5202ac6454SAndrew Thompson 5302ac6454SAndrew Thompson #include <dev/usb/usb_core.h> 5402ac6454SAndrew Thompson #include <dev/usb/usb_debug.h> 5502ac6454SAndrew Thompson #include <dev/usb/usb_process.h> 5602ac6454SAndrew Thompson #include <dev/usb/usb_request.h> 5702ac6454SAndrew Thompson #include <dev/usb/usb_lookup.h> 5802ac6454SAndrew Thompson #include <dev/usb/usb_util.h> 5902ac6454SAndrew Thompson #include <dev/usb/usb_device.h> 6002ac6454SAndrew Thompson 6102ac6454SAndrew Thompson #include <dev/usb/serial/usb_serial.h> 6202ac6454SAndrew Thompson 6302ac6454SAndrew Thompson #define UGENSA_BUF_SIZE 2048 /* bytes */ 6402ac6454SAndrew Thompson #define UGENSA_CONFIG_INDEX 0 6502ac6454SAndrew Thompson #define UGENSA_IFACE_INDEX 0 6602ac6454SAndrew Thompson #define UGENSA_IFACE_MAX 8 /* exclusivly */ 6702ac6454SAndrew Thompson 6802ac6454SAndrew Thompson enum { 6902ac6454SAndrew Thompson UGENSA_BULK_DT_WR, 7002ac6454SAndrew Thompson UGENSA_BULK_DT_RD, 7102ac6454SAndrew Thompson UGENSA_N_TRANSFER, 7202ac6454SAndrew Thompson }; 7302ac6454SAndrew Thompson 7402ac6454SAndrew Thompson struct ugensa_sub_softc { 75760bc48eSAndrew Thompson struct ucom_softc *sc_usb2_com_ptr; 76760bc48eSAndrew Thompson struct usb_xfer *sc_xfer[UGENSA_N_TRANSFER]; 7702ac6454SAndrew Thompson }; 7802ac6454SAndrew Thompson 7902ac6454SAndrew Thompson struct ugensa_softc { 80760bc48eSAndrew Thompson struct ucom_super_softc sc_super_ucom; 81760bc48eSAndrew Thompson struct ucom_softc sc_ucom[UGENSA_IFACE_MAX]; 8202ac6454SAndrew Thompson struct ugensa_sub_softc sc_sub[UGENSA_IFACE_MAX]; 8302ac6454SAndrew Thompson 8402ac6454SAndrew Thompson struct mtx sc_mtx; 8502ac6454SAndrew Thompson uint8_t sc_niface; 8602ac6454SAndrew Thompson }; 8702ac6454SAndrew Thompson 8802ac6454SAndrew Thompson /* prototypes */ 8902ac6454SAndrew Thompson 9002ac6454SAndrew Thompson static device_probe_t ugensa_probe; 9102ac6454SAndrew Thompson static device_attach_t ugensa_attach; 9202ac6454SAndrew Thompson static device_detach_t ugensa_detach; 9302ac6454SAndrew Thompson 9402ac6454SAndrew Thompson static usb2_callback_t ugensa_bulk_write_callback; 9502ac6454SAndrew Thompson static usb2_callback_t ugensa_bulk_read_callback; 9602ac6454SAndrew Thompson 97760bc48eSAndrew Thompson static void ugensa_start_read(struct ucom_softc *); 98760bc48eSAndrew Thompson static void ugensa_stop_read(struct ucom_softc *); 99760bc48eSAndrew Thompson static void ugensa_start_write(struct ucom_softc *); 100760bc48eSAndrew Thompson static void ugensa_stop_write(struct ucom_softc *); 10102ac6454SAndrew Thompson 102760bc48eSAndrew Thompson static const struct usb_config 10302ac6454SAndrew Thompson ugensa_xfer_config[UGENSA_N_TRANSFER] = { 10402ac6454SAndrew Thompson 10502ac6454SAndrew Thompson [UGENSA_BULK_DT_WR] = { 10602ac6454SAndrew Thompson .type = UE_BULK, 10702ac6454SAndrew Thompson .endpoint = UE_ADDR_ANY, 10802ac6454SAndrew Thompson .direction = UE_DIR_OUT, 1094eae601eSAndrew Thompson .bufsize = UGENSA_BUF_SIZE, 1104eae601eSAndrew Thompson .flags = {.pipe_bof = 1,.force_short_xfer = 1,}, 1114eae601eSAndrew Thompson .callback = &ugensa_bulk_write_callback, 11202ac6454SAndrew Thompson }, 11302ac6454SAndrew Thompson 11402ac6454SAndrew Thompson [UGENSA_BULK_DT_RD] = { 11502ac6454SAndrew Thompson .type = UE_BULK, 11602ac6454SAndrew Thompson .endpoint = UE_ADDR_ANY, 11702ac6454SAndrew Thompson .direction = UE_DIR_IN, 1184eae601eSAndrew Thompson .bufsize = UGENSA_BUF_SIZE, 1194eae601eSAndrew Thompson .flags = {.pipe_bof = 1,.short_xfer_ok = 1,}, 1204eae601eSAndrew Thompson .callback = &ugensa_bulk_read_callback, 12102ac6454SAndrew Thompson }, 12202ac6454SAndrew Thompson }; 12302ac6454SAndrew Thompson 124760bc48eSAndrew Thompson static const struct ucom_callback ugensa_callback = { 12502ac6454SAndrew Thompson .usb2_com_start_read = &ugensa_start_read, 12602ac6454SAndrew Thompson .usb2_com_stop_read = &ugensa_stop_read, 12702ac6454SAndrew Thompson .usb2_com_start_write = &ugensa_start_write, 12802ac6454SAndrew Thompson .usb2_com_stop_write = &ugensa_stop_write, 12902ac6454SAndrew Thompson }; 13002ac6454SAndrew Thompson 13102ac6454SAndrew Thompson static device_method_t ugensa_methods[] = { 13202ac6454SAndrew Thompson /* Device methods */ 13302ac6454SAndrew Thompson DEVMETHOD(device_probe, ugensa_probe), 13402ac6454SAndrew Thompson DEVMETHOD(device_attach, ugensa_attach), 13502ac6454SAndrew Thompson DEVMETHOD(device_detach, ugensa_detach), 13602ac6454SAndrew Thompson {0, 0} 13702ac6454SAndrew Thompson }; 13802ac6454SAndrew Thompson 13902ac6454SAndrew Thompson static devclass_t ugensa_devclass; 14002ac6454SAndrew Thompson 14102ac6454SAndrew Thompson static driver_t ugensa_driver = { 14202ac6454SAndrew Thompson .name = "ugensa", 14302ac6454SAndrew Thompson .methods = ugensa_methods, 14402ac6454SAndrew Thompson .size = sizeof(struct ugensa_softc), 14502ac6454SAndrew Thompson }; 14602ac6454SAndrew Thompson 1479aef556dSAndrew Thompson DRIVER_MODULE(ugensa, uhub, ugensa_driver, ugensa_devclass, NULL, 0); 14802ac6454SAndrew Thompson MODULE_DEPEND(ugensa, ucom, 1, 1, 1); 14902ac6454SAndrew Thompson MODULE_DEPEND(ugensa, usb, 1, 1, 1); 15002ac6454SAndrew Thompson 151760bc48eSAndrew Thompson static const struct usb_device_id ugensa_devs[] = { 15202ac6454SAndrew Thompson {USB_VPI(USB_VENDOR_AIRPRIME, USB_PRODUCT_AIRPRIME_PC5220, 0)}, 15302ac6454SAndrew Thompson {USB_VPI(USB_VENDOR_CMOTECH, USB_PRODUCT_CMOTECH_CDMA_MODEM1, 0)}, 15402ac6454SAndrew Thompson {USB_VPI(USB_VENDOR_KYOCERA2, USB_PRODUCT_KYOCERA2_CDMA_MSM_K, 0)}, 15502ac6454SAndrew Thompson {USB_VPI(USB_VENDOR_HP, USB_PRODUCT_HP_49GPLUS, 0)}, 15602ac6454SAndrew Thompson {USB_VPI(USB_VENDOR_NOVATEL2, USB_PRODUCT_NOVATEL2_FLEXPACKGPS, 0)}, 15702ac6454SAndrew Thompson }; 15802ac6454SAndrew Thompson 15902ac6454SAndrew Thompson static int 16002ac6454SAndrew Thompson ugensa_probe(device_t dev) 16102ac6454SAndrew Thompson { 162760bc48eSAndrew Thompson struct usb_attach_arg *uaa = device_get_ivars(dev); 16302ac6454SAndrew Thompson 164f29a0724SAndrew Thompson if (uaa->usb_mode != USB_MODE_HOST) { 16502ac6454SAndrew Thompson return (ENXIO); 16602ac6454SAndrew Thompson } 16702ac6454SAndrew Thompson if (uaa->info.bConfigIndex != UGENSA_CONFIG_INDEX) { 16802ac6454SAndrew Thompson return (ENXIO); 16902ac6454SAndrew Thompson } 17002ac6454SAndrew Thompson if (uaa->info.bIfaceIndex != 0) { 17102ac6454SAndrew Thompson return (ENXIO); 17202ac6454SAndrew Thompson } 17302ac6454SAndrew Thompson return (usb2_lookup_id_by_uaa(ugensa_devs, sizeof(ugensa_devs), uaa)); 17402ac6454SAndrew Thompson } 17502ac6454SAndrew Thompson 17602ac6454SAndrew Thompson static int 17702ac6454SAndrew Thompson ugensa_attach(device_t dev) 17802ac6454SAndrew Thompson { 179760bc48eSAndrew Thompson struct usb_attach_arg *uaa = device_get_ivars(dev); 18002ac6454SAndrew Thompson struct ugensa_softc *sc = device_get_softc(dev); 18102ac6454SAndrew Thompson struct ugensa_sub_softc *ssc; 182760bc48eSAndrew Thompson struct usb_interface *iface; 18302ac6454SAndrew Thompson int32_t error; 18402ac6454SAndrew Thompson uint8_t iface_index; 18502ac6454SAndrew Thompson int x, cnt; 18602ac6454SAndrew Thompson 18702ac6454SAndrew Thompson device_set_usb2_desc(dev); 18802ac6454SAndrew Thompson mtx_init(&sc->sc_mtx, "ugensa", NULL, MTX_DEF); 18902ac6454SAndrew Thompson 19002ac6454SAndrew Thompson /* Figure out how many interfaces this device has got */ 19102ac6454SAndrew Thompson for (cnt = 0; cnt < UGENSA_IFACE_MAX; cnt++) { 19202ac6454SAndrew Thompson if ((usb2_get_pipe(uaa->device, cnt, ugensa_xfer_config + 0) == NULL) || 19302ac6454SAndrew Thompson (usb2_get_pipe(uaa->device, cnt, ugensa_xfer_config + 1) == NULL)) { 19402ac6454SAndrew Thompson /* we have reached the end */ 19502ac6454SAndrew Thompson break; 19602ac6454SAndrew Thompson } 19702ac6454SAndrew Thompson } 19802ac6454SAndrew Thompson 19902ac6454SAndrew Thompson if (cnt == 0) { 20002ac6454SAndrew Thompson device_printf(dev, "No interfaces!\n"); 20102ac6454SAndrew Thompson goto detach; 20202ac6454SAndrew Thompson } 20302ac6454SAndrew Thompson for (x = 0; x < cnt; x++) { 20402ac6454SAndrew Thompson iface = usb2_get_iface(uaa->device, x); 20502ac6454SAndrew Thompson if (iface->idesc->bInterfaceClass != UICLASS_VENDOR) 20602ac6454SAndrew Thompson /* Not a serial port, most likely a SD reader */ 20702ac6454SAndrew Thompson continue; 20802ac6454SAndrew Thompson 20902ac6454SAndrew Thompson ssc = sc->sc_sub + sc->sc_niface; 21002ac6454SAndrew Thompson ssc->sc_usb2_com_ptr = sc->sc_ucom + sc->sc_niface; 21102ac6454SAndrew Thompson 21202ac6454SAndrew Thompson iface_index = (UGENSA_IFACE_INDEX + x); 21302ac6454SAndrew Thompson error = usb2_transfer_setup(uaa->device, 21402ac6454SAndrew Thompson &iface_index, ssc->sc_xfer, ugensa_xfer_config, 21502ac6454SAndrew Thompson UGENSA_N_TRANSFER, ssc, &sc->sc_mtx); 21602ac6454SAndrew Thompson 21702ac6454SAndrew Thompson if (error) { 21802ac6454SAndrew Thompson device_printf(dev, "allocating USB " 21902ac6454SAndrew Thompson "transfers failed!\n"); 22002ac6454SAndrew Thompson goto detach; 22102ac6454SAndrew Thompson } 22202ac6454SAndrew Thompson /* clear stall at first run */ 223deefe583SAndrew Thompson mtx_lock(&sc->sc_mtx); 22402ac6454SAndrew Thompson usb2_transfer_set_stall(ssc->sc_xfer[UGENSA_BULK_DT_WR]); 22502ac6454SAndrew Thompson usb2_transfer_set_stall(ssc->sc_xfer[UGENSA_BULK_DT_RD]); 226deefe583SAndrew Thompson mtx_unlock(&sc->sc_mtx); 22702ac6454SAndrew Thompson 22802ac6454SAndrew Thompson /* initialize port number */ 22902ac6454SAndrew Thompson ssc->sc_usb2_com_ptr->sc_portno = sc->sc_niface; 23002ac6454SAndrew Thompson sc->sc_niface++; 23102ac6454SAndrew Thompson if (x != uaa->info.bIfaceIndex) 23202ac6454SAndrew Thompson usb2_set_parent_iface(uaa->device, x, 23302ac6454SAndrew Thompson uaa->info.bIfaceIndex); 23402ac6454SAndrew Thompson } 23502ac6454SAndrew Thompson device_printf(dev, "Found %d interfaces.\n", sc->sc_niface); 23602ac6454SAndrew Thompson 23702ac6454SAndrew Thompson error = usb2_com_attach(&sc->sc_super_ucom, sc->sc_ucom, sc->sc_niface, sc, 23802ac6454SAndrew Thompson &ugensa_callback, &sc->sc_mtx); 23902ac6454SAndrew Thompson if (error) { 24002ac6454SAndrew Thompson DPRINTF("attach failed\n"); 24102ac6454SAndrew Thompson goto detach; 24202ac6454SAndrew Thompson } 24302ac6454SAndrew Thompson return (0); /* success */ 24402ac6454SAndrew Thompson 24502ac6454SAndrew Thompson detach: 24602ac6454SAndrew Thompson ugensa_detach(dev); 24702ac6454SAndrew Thompson return (ENXIO); /* failure */ 24802ac6454SAndrew Thompson } 24902ac6454SAndrew Thompson 25002ac6454SAndrew Thompson static int 25102ac6454SAndrew Thompson ugensa_detach(device_t dev) 25202ac6454SAndrew Thompson { 25302ac6454SAndrew Thompson struct ugensa_softc *sc = device_get_softc(dev); 25402ac6454SAndrew Thompson uint8_t x; 25502ac6454SAndrew Thompson 25602ac6454SAndrew Thompson usb2_com_detach(&sc->sc_super_ucom, sc->sc_ucom, sc->sc_niface); 25702ac6454SAndrew Thompson 25802ac6454SAndrew Thompson for (x = 0; x < sc->sc_niface; x++) { 25902ac6454SAndrew Thompson usb2_transfer_unsetup(sc->sc_sub[x].sc_xfer, UGENSA_N_TRANSFER); 26002ac6454SAndrew Thompson } 26102ac6454SAndrew Thompson mtx_destroy(&sc->sc_mtx); 26202ac6454SAndrew Thompson 26302ac6454SAndrew Thompson return (0); 26402ac6454SAndrew Thompson } 26502ac6454SAndrew Thompson 26602ac6454SAndrew Thompson static void 267760bc48eSAndrew Thompson ugensa_bulk_write_callback(struct usb_xfer *xfer) 26802ac6454SAndrew Thompson { 26902ac6454SAndrew Thompson struct ugensa_sub_softc *ssc = xfer->priv_sc; 27002ac6454SAndrew Thompson uint32_t actlen; 27102ac6454SAndrew Thompson 27202ac6454SAndrew Thompson switch (USB_GET_STATE(xfer)) { 27302ac6454SAndrew Thompson case USB_ST_SETUP: 27402ac6454SAndrew Thompson case USB_ST_TRANSFERRED: 27502ac6454SAndrew Thompson tr_setup: 27602ac6454SAndrew Thompson if (usb2_com_get_data(ssc->sc_usb2_com_ptr, xfer->frbuffers, 0, 27702ac6454SAndrew Thompson UGENSA_BUF_SIZE, &actlen)) { 27802ac6454SAndrew Thompson xfer->frlengths[0] = actlen; 27902ac6454SAndrew Thompson usb2_start_hardware(xfer); 28002ac6454SAndrew Thompson } 28102ac6454SAndrew Thompson return; 28202ac6454SAndrew Thompson 28302ac6454SAndrew Thompson default: /* Error */ 28402ac6454SAndrew Thompson if (xfer->error != USB_ERR_CANCELLED) { 28502ac6454SAndrew Thompson /* try to clear stall first */ 28602ac6454SAndrew Thompson xfer->flags.stall_pipe = 1; 28702ac6454SAndrew Thompson goto tr_setup; 28802ac6454SAndrew Thompson } 28902ac6454SAndrew Thompson return; 29002ac6454SAndrew Thompson } 29102ac6454SAndrew Thompson } 29202ac6454SAndrew Thompson 29302ac6454SAndrew Thompson static void 294760bc48eSAndrew Thompson ugensa_bulk_read_callback(struct usb_xfer *xfer) 29502ac6454SAndrew Thompson { 29602ac6454SAndrew Thompson struct ugensa_sub_softc *ssc = xfer->priv_sc; 29702ac6454SAndrew Thompson 29802ac6454SAndrew Thompson switch (USB_GET_STATE(xfer)) { 29902ac6454SAndrew Thompson case USB_ST_TRANSFERRED: 30002ac6454SAndrew Thompson usb2_com_put_data(ssc->sc_usb2_com_ptr, xfer->frbuffers, 0, 30102ac6454SAndrew Thompson xfer->actlen); 30202ac6454SAndrew Thompson 30302ac6454SAndrew Thompson case USB_ST_SETUP: 30402ac6454SAndrew Thompson tr_setup: 30502ac6454SAndrew Thompson xfer->frlengths[0] = xfer->max_data_length; 30602ac6454SAndrew Thompson usb2_start_hardware(xfer); 30702ac6454SAndrew Thompson return; 30802ac6454SAndrew Thompson 30902ac6454SAndrew Thompson default: /* Error */ 31002ac6454SAndrew Thompson if (xfer->error != USB_ERR_CANCELLED) { 31102ac6454SAndrew Thompson /* try to clear stall first */ 31202ac6454SAndrew Thompson xfer->flags.stall_pipe = 1; 31302ac6454SAndrew Thompson goto tr_setup; 31402ac6454SAndrew Thompson } 31502ac6454SAndrew Thompson return; 31602ac6454SAndrew Thompson } 31702ac6454SAndrew Thompson } 31802ac6454SAndrew Thompson 31902ac6454SAndrew Thompson static void 320760bc48eSAndrew Thompson ugensa_start_read(struct ucom_softc *ucom) 32102ac6454SAndrew Thompson { 32202ac6454SAndrew Thompson struct ugensa_softc *sc = ucom->sc_parent; 32302ac6454SAndrew Thompson struct ugensa_sub_softc *ssc = sc->sc_sub + ucom->sc_portno; 32402ac6454SAndrew Thompson 32502ac6454SAndrew Thompson usb2_transfer_start(ssc->sc_xfer[UGENSA_BULK_DT_RD]); 32602ac6454SAndrew Thompson } 32702ac6454SAndrew Thompson 32802ac6454SAndrew Thompson static void 329760bc48eSAndrew Thompson ugensa_stop_read(struct ucom_softc *ucom) 33002ac6454SAndrew Thompson { 33102ac6454SAndrew Thompson struct ugensa_softc *sc = ucom->sc_parent; 33202ac6454SAndrew Thompson struct ugensa_sub_softc *ssc = sc->sc_sub + ucom->sc_portno; 33302ac6454SAndrew Thompson 33402ac6454SAndrew Thompson usb2_transfer_stop(ssc->sc_xfer[UGENSA_BULK_DT_RD]); 33502ac6454SAndrew Thompson } 33602ac6454SAndrew Thompson 33702ac6454SAndrew Thompson static void 338760bc48eSAndrew Thompson ugensa_start_write(struct ucom_softc *ucom) 33902ac6454SAndrew Thompson { 34002ac6454SAndrew Thompson struct ugensa_softc *sc = ucom->sc_parent; 34102ac6454SAndrew Thompson struct ugensa_sub_softc *ssc = sc->sc_sub + ucom->sc_portno; 34202ac6454SAndrew Thompson 34302ac6454SAndrew Thompson usb2_transfer_start(ssc->sc_xfer[UGENSA_BULK_DT_WR]); 34402ac6454SAndrew Thompson } 34502ac6454SAndrew Thompson 34602ac6454SAndrew Thompson static void 347760bc48eSAndrew Thompson ugensa_stop_write(struct ucom_softc *ucom) 34802ac6454SAndrew Thompson { 34902ac6454SAndrew Thompson struct ugensa_softc *sc = ucom->sc_parent; 35002ac6454SAndrew Thompson struct ugensa_sub_softc *ssc = sc->sc_sub + ucom->sc_portno; 35102ac6454SAndrew Thompson 35202ac6454SAndrew Thompson usb2_transfer_stop(ssc->sc_xfer[UGENSA_BULK_DT_WR]); 35302ac6454SAndrew Thompson } 354