From owner-freebsd-wireless@freebsd.org Mon Oct 2 05:10:39 2017 Return-Path: Delivered-To: freebsd-wireless@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BFF22E365A7 for ; Mon, 2 Oct 2017 05:10:39 +0000 (UTC) (envelope-from khanzf@gmail.com) Received: from mail-qt0-x22b.google.com (mail-qt0-x22b.google.com [IPv6:2607:f8b0:400d:c0d::22b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 766F47F01A for ; Mon, 2 Oct 2017 05:10:39 +0000 (UTC) (envelope-from khanzf@gmail.com) Received: by mail-qt0-x22b.google.com with SMTP id i13so5950463qtc.11 for ; Sun, 01 Oct 2017 22:10:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=rghP1uKpUpexRBqLVk+HBSfg584cO11J7ZXljmKsZOM=; b=j4joxmS+BM4e3wbARFzb1TEKG+bSY2hP7jAMa8kJMsewnHEPWEYCbt7JDo80YOEFWO OcQ2gh9ZuEXyGaDFw7MZpG9RHPA2PDTW4kdSGLqDCvfkUmTA75qquXA+xztJJYf/o/rH eTf9kggFROd80Mq4T6pjlyAt998yaddIqKRMnLGY1o5iKZjpt2Ge1tui2gXJbBgqCEj2 mfokj1765qrH/w+blogDChKlhjvjaMlJOzMqFdQLJ8WdFHaMY6ZNgMXMF7hZaz7mDF67 fLdwykvv82U7J25vjni4A8tNKkoaElfTlzZQffMiG6cifP6130oVUviM3uhpqKWsIKz5 LolQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=rghP1uKpUpexRBqLVk+HBSfg584cO11J7ZXljmKsZOM=; b=M02oddGIQFjJnfVHiCnmlMmZ0ngKQXKLGc8qbbnot2Ad0+NV2DJDxzIQSPKgbfyRKq AHvYtBliFUuw3Y1FtwTVraQfrP5sUlSi7P7wHNNlsech+uQ+RRL2eDyz+ewyVM9W0Khp ENve7JpIo6KvJxQdZ0L+U5kxC2hXRNuxb/BPIQwCx7QZ00qPNDPDCm7/g6Ca7H3Zbr2U gLTGQKJr3wmguTrfnsXvfhGx8GIGww+E2ZX/+us4mYt3ikG9zQrfClTVn1JbdDIPXiuH jltBr1xYGdiydD52+9ihQwUnB5C4d8Joa36jF3GpFDIxcLCDWLEfZGGxAAoyOiQh0KjX hJAw== X-Gm-Message-State: AMCzsaUiwfqpPHvAt4lEdOICF4X01GiAReGDShurH7knlsGVj+wFMYOS 0IRWg7kOx3orbbKptgFdFu7+CChp X-Google-Smtp-Source: AOwi7QCjClmvqhzLZzha/ogU9YUUKMNdjarSA1c5oMRAiiLV5DAleViCC/bsgoPwyVBd+m6AACchtg== X-Received: by 10.237.60.101 with SMTP id u34mr16550473qte.153.1506921037989; Sun, 01 Oct 2017 22:10:37 -0700 (PDT) Received: from pc.farhan.codes ([2001:470:8:209:ee25:a59b:55f4:7cc]) by smtp.gmail.com with ESMTPSA id j205sm2072217qke.7.2017.10.01.22.10.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 01 Oct 2017 22:10:36 -0700 (PDT) Subject: Re: Register Address Size Mismatch To: Andriy Voskoboinyk Cc: freebsd-wireless@freebsd.org References: <293228d3-c777-d928-8476-ee23ba487c72@gmail.com> <3f760297-d8dd-a2e0-9fda-e09bff06b11c@gmail.com> From: Farhan Khan Message-ID: <9b0976c3-ad31-0558-a3f4-0177b91fb7e6@gmail.com> Date: Mon, 2 Oct 2017 01:10:35 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-BeenThere: freebsd-wireless@freebsd.org X-Mailman-Version: 2.1.23 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: Mon, 02 Oct 2017 05:10:39 -0000 Thank you! That is in the Linux driver here: http://src.illumos.org/source/xref/linux-master/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/phy.c#_rtl8188e_config_rf_reg As a matter of completion, is this information publicly available such as in a chipset document or something you came across from reading the driver code? I am currently essentially doing replay without fully understanding how the device works. On 10/01/2017 03:12 PM, Andriy Voskoboinyk wrote: > Do you mean 0xFFE address? In vendor driver such 'addresses' are used > for delay between writes (50 ms for RTL8812A). > >> The issue is in the assignment, not the write/read part. rtwn_rf_prog >> wants a * uint8_t list, whereas the register size from Linux is a >> uint32_t (but can cleanly fit into a uint16_t and might just be the >> default register size on Linux). How do I reconcile those two? I hope I >> was clearer there. >> >> The first column are the Linux registers in question: >> http://src.illumos.org/source/xref/linux-master/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/table.c#316 >> >> >> Thank you for your continued assistance. >> >> On 10/01/2017 06:30 AM, Andriy Voskoboinyk wrote: >>> Hi, >>> >>> RF registers are using indirect addressing; you should use >>> rtwn_rf_write() / rtwn_rf_read() instead. >>> >>> >>>> I am working on porting over a Linux Realtek driver to FreeBSD. I ran >>>> into a register-size issue. >>>> >>>> FreeBSD's PCI-write function is defined as follows: >>>> rtwn_pci_write_4(struct rtwn_softc *sc, uint16_t addr) >>>> >>>> Notice that the second parameter is of type uint16_t. >>>> >>>> During initialization, the rtwn driver uses the rtwn_rf_prog structure >>>> to write a pre-defined list of data to a pre-defined list of registers. >>>> The structure to hold both lists is defined here: >>>> http://src.illumos.org/source/xref/freebsd-head/sys/dev/rtwn/if_rtwnreg.h#150. >>>> >>>> >>>> Notice how the second parameter 'reg' is a uint8_t. >>>> >>>> The rtwn_pci_write_4's addr is uint16_t, the rtwn_rf_prog's addr is a >>>> uint8_t. How would I reconcile this type mismatch? Additionally, the >>>> Linux version of this block of code has all register values as a >>>> uint32_t. It is not a matter of a cast, because some values definitely >>>> use more than 1 byte (ie 0xFFE). >>>> >>>> Suggestions on how to reconcile and resolve this issue? >>>> >>>> Thanks! >>>> Farhan Khan >>>> _______________________________________________ >>>> 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"