From owner-freebsd-wireless@freebsd.org Sat Apr 13 18:44:41 2019 Return-Path: Delivered-To: freebsd-wireless@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B981D1580231 for ; Sat, 13 Apr 2019 18:44:41 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 677DE8D846; Sat, 13 Apr 2019 18:44:40 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by mail-wr1-x442.google.com with SMTP id y13so16232978wrd.3; Sat, 13 Apr 2019 11:44:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=y6bgpVkhftKJy25XqJ5KyM39I7VJt+fgIDLs/A8W/qY=; b=BVUQD7NcJQiJ8fbCQEUETAKC+4l4T7jUKG1g1lHMNrKITKuZ0rcyqH+jbYWQ4cgNAi iD7LVjqXlMxL3GnAhDUgciEziFWCG+dQnsYki2ANkF7yNM5FBO9yT66Hfy8071xzVUTd y9gtPAN9ooxmuw8toiAFFsBdudVebzPxmXGjl+NlvJ6md5j1WzUaNvVOWyH21T23OEDm 6jiM1asD15aO5TVSpYnDIOJh4oqhJT2NbpgSHuLz9u47s5LEskVVga+LjYe2aco5dQ9S s5h/4MVh4oqmjikf78e190uYGABYpD+D0WYGBeRm4yVy30m6rLGpuS1I4w76cHxrq2zI ZGFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=y6bgpVkhftKJy25XqJ5KyM39I7VJt+fgIDLs/A8W/qY=; b=n+VoAl9DSG/ojQNgTk2dQ5nYXIveC0KUduldK1wlWGzVFHYdQ9JK24P3eeYoKhyZtw L0TEnyGXDv5ja/2vAEaFHiMIndzVmkkmDKzpQGiXPRW/3q/9biTJsRckVXosVS4B2CkY slVlB1CwDRx/vCTOFkHFO95fSHXLnPKiaVjB2LcPH7J+0z/oyUvtq7OqqMqKYBn/xNIm VmSSp7nfmym88aPHJ5GaKxE5G7cw5idMVBzjpybjlDEn/vsaxJeGROYMPwJUneCbHP3t ubrfGMR/m1hapXK4bjOpsT62luWV7okGHen8wyNBbuD9dsNzk29Bcc0zPidQHkAuOCZW WRPA== X-Gm-Message-State: APjAAAVYgxeH7LezgvMmizUNDfD358FhmcA/RjkqlnUETzZUDsn3Or8r kSfWLEzTFTWaKuSXWxkMyVu5fV7EbTzZ0NcBKIjCdg== X-Google-Smtp-Source: APXvYqx4kLd1kDk3etaWROf/I72Ds9K05oKrm9MiotDjKnLPNBsiwoaC3gaXESFoKdd1Ja2nkDCyyq8+xpE6jKqo/dE= X-Received: by 2002:adf:e84b:: with SMTP id d11mr39111756wrn.289.1555181077147; Sat, 13 Apr 2019 11:44:37 -0700 (PDT) MIME-Version: 1.0 References: <20190409160344.GA83271@FreeBSD.org> <20190410152250.GA37191@FreeBSD.org> <20190411092758.GA6899@FreeBSD.org> <20190411104647.GA3864@c720-r342378> <20190411125242.GA64046@FreeBSD.org> <20190411131328.GA4909@c720-r342378> <20190411131859.GA17806@FreeBSD.org> <20190411142350.GA71446@FreeBSD.org> <20190412171218.GA16463@FreeBSD.org> <20190413142006.GA59512@FreeBSD.org> In-Reply-To: <20190413142006.GA59512@FreeBSD.org> From: Adrian Chadd Date: Sat, 13 Apr 2019 11:44:25 -0700 Message-ID: Subject: Re: Atheros AR5B22 WLAN+Bluetooth support on FreeBSD To: Alexey Dokuchaev Cc: "freebsd-wireless@freebsd.org" X-Rspamd-Queue-Id: 677DE8D846 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=BVUQD7Nc; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of adrianchadd@gmail.com designates 2a00:1450:4864:20::442 as permitted sender) smtp.mailfrom=adrianchadd@gmail.com X-Spamd-Result: default: False [-4.18 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36]; FREEMAIL_FROM(0.00)[gmail.com]; DKIM_TRACE(0.00)[gmail.com:+]; RCPT_COUNT_TWO(0.00)[2]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; MX_GOOD(-0.01)[cached: alt3.gmail-smtp-in.l.google.com]; NEURAL_HAM_SHORT(-0.40)[-0.399,0]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_LAST(0.00)[]; MIME_TRACE(0.00)[0:+,1:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; TAGGED_FROM(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com.dwl.dnswl.org : 127.0.5.0]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; IP_SCORE(-0.77)[ip: (0.78), ipnet: 2a00:1450::/32(-2.39), asn: 15169(-2.19), country: US(-0.06)]; RCVD_IN_DNSWL_NONE(0.00)[2.4.4.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.5.4.1.0.0.a.2.list.dnswl.org : 127.0.5.0]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: freebsd-wireless@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Discussions of 802.11 stack, tools device driver development." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Apr 2019 18:44:42 -0000 Hm, is this a problem with our usb3 stack itself? If you send me a pull request against ath3k I'll merge it into my git tree just for completeness. Maybe we need to loop in hps@ with a bunch of usbdump output to see what the transactions look like... -adrian On Sat, 13 Apr 2019 at 07:21, Alexey Dokuchaev wrote: > On Fri, Apr 12, 2019 at 05:12:18PM +0000, Alexey Dokuchaev wrote: > > I've then rebooted back into FreeBSD. Apparently, this AR3012 hardware > > is very fragile, it can be easily left in confused state and won't accept > > further commands, "usbconfig reset" does not help. To avoid this, it is > > better run ./ath3kfw as root, after powercycling machine (to reset the > > card). This got me further: > > > > ath3kfw: opening dev 2.2 > > main: state=0x0e > > ROM version: 285343744, build version: 155, ram version: 155, ref clock=1 > > ath3k_init_firmware: loading ath3k-1.fw > > ath3k_load_fwfile: > file=/home/danfe/ath3k/share/firmware/ath3k/ath3k-1.fw, > > size=246804 > > ath3k_load_fwfile: transferring 20 bytes, offset 4096 > > Looks like there is a bug with the logging, consider this pseudo-patch: > > @@ ... > ath3k_debug("%s: transferring %d bytes, offset %d\n", > __func__, > - sent, > - size); > + size, sent); > > > ... > > ath3k_load_fwfile: transferring 65556 bytes, offset 4096 > > LIBUSB_FUNCTION: libusb_bulk_transfer enter > > LIBUSB_FUNCTION: libusb_submit_transfer enter > > LIBUSB_FUNCTION: libusb_submit_transfer leave 0 > > LIBUSB_FUNCTION: libusb_handle_events_timeout_completed enter > > LIBUSB_FUNCTION: libusb10_handle_events_sub enter > > LIBUSB_TRANSFER: sync I/O done > > LIBUSB_FUNCTION: libusb_handle_events_timeout_completed exit > > LIBUSB_FUNCTION: libusb_bulk_transfer leave > > Can't load firmware: err=Timeout, size=4096 > > ath3k_load_fwfile: transferring 65556 bytes, offset 4096 > > I've found seemingly related bug report about Atheros BT devices (ath3k) > failing to work on USB 3.0 buses, while working well on USB 2.0: > > https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1400215 > > In 2015, a work-around for this problem was committed* to Linux kernel: > > author Adam Lee 2015-01-28 > committer Marcel Holtmann 2015-01-29 > commit c561a5753dd631920c4459a067d22679b3d110d6 > > Bluetooth: ath3k: workaround the compatibility issue with xHCI controller > > ath3k devices fail to load firmwares on xHCI buses, but work well on > EHCI, this might be a compatibility issue between xHCI and ath3k chips. > As my testing result, those chips will work on xHCI buses again with > this patch. > > This workaround is from Qualcomm, they also did some workarounds in > Windows driver. > > I've patched ath3kfw tool in a similar way like this: > > +#define TIMEGAP_USEC_MIN 50 > +#define TIMEGAP_USEC_MAX 100 > + > +static inline void > +usleep_range(unsigned long min, unsigned long max) > +{ > + usleep(min); // or usleep(max); > +} > ... > > while (count) { > + /* workaround the compatibility issue with xHCI controller */ > + usleep_range(TIMEGAP_USEC_MIN, TIMEGAP_USEC_MAX); > > Unfortunately, this hack didn't help, neither with usleep(min) nor with > usleep(max). Error message is the same "Can't load firmware: err=Timeout, > size=4096". > > I will try to find a USB 2.0-only laptop which supports mini-PCIe cards > to get more data points, but not sure if I can find one easily. It would > be nice if someone who has pre-xHCI hardware could conduct this test. > > ./danfe > > *) > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/bluetooth/ath3k.c?id=c561a5753dd631920c4459a067d22679b3d110d6 > _______________________________________________ > freebsd-wireless@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-wireless > To unsubscribe, send any mail to "freebsd-wireless-unsubscribe@freebsd.org > " >