From owner-freebsd-wireless@freebsd.org Sun Dec 23 02:42:12 2018 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 B8D9513474B7 for ; Sun, 23 Dec 2018 02:42:12 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 82F6885FB1; Sun, 23 Dec 2018 02:42:11 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by mail-wr1-f65.google.com with SMTP id s12so8816784wrt.4; Sat, 22 Dec 2018 18:42:11 -0800 (PST) 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=fd8yFmC8i+jmFgqcwxLg6+eamFoqYT1q3KdwPcAy8x4=; b=VcfLJPF2jnLXo9L2sDmAZ05Nk173BTwONELDYBRzcs7Ehn641wnmgZcv59bNkOX6g7 0jcEkN4K48gVG4UU++8sx/VYr2oCL24N9VwcIF+FYk7iXGVrScE4yCr1JZUIKCnaUKTN TTGS7/f66nqqDgYOM2WIZybwbTpIYBEunMdjPwroGnhSHJJU6iUYbOIWRUFORmINGxl/ 1cq1O3EQ55PEXnPbJ9px8uEACHGI9R+DWnAXNX2xAh4q+SOo8H1Ot6q0rKtMQXyCI9SJ u/BNwkq5KpbbvmI2Z28FGsrN9ZTggh4+w15yXJVNqZ57Q7cqmdVa77IJD05JDqQj/HLo NLHg== X-Gm-Message-State: AJcUukeCEiVL/A41G9ZJEyWUhSS+vXX1LDX8ua2c0YtG2lvzTyhYPGLI a8Zxs/24WeSICNCKurxDBcqvNLSbxWRHljYh3Nqvew== X-Google-Smtp-Source: ALg8bN59cH4sQglMckiyf6+Gsx4pNZ0vKcUWbp055jwqLFTcuROIeyNQ5ti94HLzXGmIRO+Utc8OxBxhvP3cjtHH7rA= X-Received: by 2002:adf:e5c4:: with SMTP id a4mr7110033wrn.157.1545528972359; Sat, 22 Dec 2018 17:36:12 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Adrian Chadd Date: Sat, 22 Dec 2018 17:35:59 -0800 Message-ID: Subject: Re: Support for AR9271 (ath USB glue) To: lr x Cc: "freebsd-wireless@freebsd.org" , kevans@freebsd.org X-Rspamd-Queue-Id: 82F6885FB1 X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; spf=pass (mx1.freebsd.org: domain of adrianchadd@gmail.com designates 209.85.221.65 as permitted sender) smtp.mailfrom=adrianchadd@gmail.com X-Spamd-Result: default: False [-3.93 / 15.00]; ARC_NA(0.00)[]; TO_DN_EQ_ADDR_SOME(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.996,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; IP_SCORE(-1.04)[ipnet: 209.85.128.0/17(-3.64), asn: 15169(-1.46), country: US(-0.08)]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; MIME_TRACE(0.00)[0:+,1:+]; DMARC_NA(0.00)[freebsd.org]; TO_DN_SOME(0.00)[]; NEURAL_HAM_LONG(-1.00)[-0.996,0]; TO_MATCH_ENVRCPT_SOME(0.00)[]; MX_GOOD(-0.01)[cached: alt3.gmail-smtp-in.l.google.com]; NEURAL_HAM_SHORT(-0.89)[-0.889,0]; RCVD_IN_DNSWL_NONE(0.00)[65.221.85.209.list.dnswl.org : 127.0.5.0]; RCVD_TLS_LAST(0.00)[]; FORGED_SENDER(0.30)[adrian@freebsd.org,adrianchadd@gmail.com]; FREEMAIL_TO(0.00)[gmail.com]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; FROM_NEQ_ENVFROM(0.00)[adrian@freebsd.org,adrianchadd@gmail.com]; TAGGED_FROM(0.00)[]; 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: Sun, 23 Dec 2018 02:42:13 -0000 Hi! Sorry for not replying earlier. The 30 second version - you should look at uath and ath9k's usb code. It's not ENTIRELY just a register access method - there are a bunch of things that are done by firmware via calls - like setting the mode, adding/removing nodes, etc. ath(4) will need a bunch of stuff turned into methods that the USB driver calls into. Sorry I can't be more help right now, life's busy as heck atm. -a On Sat, 22 Dec 2018 at 15:50, lr x wrote: > Hi, > > I have a TP-LINK device[1] and I'd like to get this running on FreeBSD. I > have searched the interwebs[2][3] and, as I understand, the only thing > that's blocking this is the missing usb glue in ath / ath_hal [4][5]. > > I'm not entirely sure of how it all works together. What all should the > USB glue be doing? uath seems to be handling stuff like radiotap headers > that I'm not really sure belong in this USB glue. otus[6] seems a more > likely candidate of what this glue code should look like. Or is this about > adding USB support to the existing ath hal code (like checking if USB > device is supported when ath_hal_probe() is called?) > > I started writing an if_ath_usb.c file under sys/dev/ath and have probe() > working for my device. I'm looking at the ukbd, uath, otus and if_ath_pci > modules to understand what if_ath_usb should do (along with man usbdi). > > Have I completely misunderstood what needs to be done? > > From the if_ath_usb.c I have right now: > > static int > ath_usb_probe(device_t dev) > { > struct usb_attach_arg *uaa = device_get_ivars(dev); > printf("[ath_usb_probe] vendorId = %x, productId %x\n", > uaa->info.idVendor, uaa->info.idProduct); > > /* Skipping ath_hal_probe here as we have not registered a chip > (YET).. */ > /* Check if product is AR9271 chip */ > > /* idVendor = 0x0cf3 */ > /* idProduct = 0x9271 */ > if(uaa->info.idVendor == 0x0cf3 && uaa->info.idProduct == 0x9271) > return BUS_PROBE_DEFAULT; > > return ENXIO; > } > > > [1] https://wikidevi.com/wiki/TP-LINK_TL-WN721N > [2] > https://lists.freebsd.org/pipermail/freebsd-wireless/2015-June/005934.html > [3] https://wiki.freebsd.org/dev/ath_hal%284%29/HardwareSupport (Chipsets > I won't be working on) > [4] https://wiki.freebsd.org/dev/ath_hal%284%29 > [5] https://wiki.freebsd.org/dev/ath_hal%284%29/ApiOverview > [6] > http://adrianchadd.blogspot.com/2015/09/porting-wifi-driver-from-openbsd-ar9170.html > > Regards. >