From owner-freebsd-wireless@freebsd.org Mon Oct 2 22:01:42 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 1E1B4E28950 for ; Mon, 2 Oct 2017 22:01:42 +0000 (UTC) (envelope-from s3erios@gmail.com) Received: from mail-wr0-x22f.google.com (mail-wr0-x22f.google.com [IPv6:2a00:1450:400c:c0c::22f]) (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 A23B17D1E2 for ; Mon, 2 Oct 2017 22:01:41 +0000 (UTC) (envelope-from s3erios@gmail.com) Received: by mail-wr0-x22f.google.com with SMTP id t76so4832923wrc.3 for ; Mon, 02 Oct 2017 15:01:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:cc:subject:references:date:mime-version :content-transfer-encoding:from:message-id:in-reply-to:user-agent; bh=2DqmJ7Hm0vuifllII8kb8eedoIlGfrzO+ZeZB7O9SYY=; b=qnUXoXGn6KYCvquyW1kxd/mAGfTc/U4Bveq1aIXJAQPqnc5XkYuXzbZM4m8AnM4mXs L4EnHcG/WBDcjaX5dYhUK5wZQoWn0aJbn0iLMzkh5yNal6LL8Jdvk+HKDnhRffb5qv62 EmY3ZERVnLj2dzvnKGeLVkhGE7CcjK5KKw3Vt6fmPuqRkwSF7sPl8vPxhCApV+snTC0m h3Q2wB7fK4GGmudljVBdX8w5m1jfHzBVe8Qne6ojyv3PPCPESZ8FtD2j+IBxFJv94pS5 gwi21LRPlKM2/DIe38hYrmLqAZmwW3dIXs4X7CnCmSnNfkzXdQ0WN2hFY64Wsg9dBc2L gr8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:cc:subject:references:date:mime-version :content-transfer-encoding:from:message-id:in-reply-to:user-agent; bh=2DqmJ7Hm0vuifllII8kb8eedoIlGfrzO+ZeZB7O9SYY=; b=dOXLnECPZ7jtnuiQIWKCnwoRdFb0bp24IYvJlrnpD7lKDdDne7FwAEYlSFegiAOSbv JEm9/VUm/mZ4NibgPkjslQJoxBVLDh+8/7Lmvm89PlElmSyuScux5VRpunng/FIiOcWc 8eRURwm9BPmtoPuW6dzKqc58e9H7bw56SArycGuoS9TFy5O3GvyhZZNELKqfWOdMHH0Z Fo2QBBT0oDL4Vxlt9b6oyymYOmKvqJWJYoYPQjel0enc4V71M6iRLqU1Ri0UCI03vqKP lk0iLvKqUjNJVa5Ax6boM7c5zbza9+rjiIdIuXQgYj7PmchXhPS4zpdv0G+k/j7IbNRx tHYA== X-Gm-Message-State: AHPjjUi4DP55z3G3YmhcLm9dyKfkembgVk/0vJvsMdhpRW6HzRuhfla4 YmGAXLk08vr60IKmuD/ma8g= X-Google-Smtp-Source: AOwi7QC+lB6emEQTS55tRSpzJKX3a8mMKh/XKQ8UBDHLVg0NMXAghnTSVzPwe+JfeKAXPAlUS1eejA== X-Received: by 10.223.198.82 with SMTP id u18mr16767961wrg.5.1506981699933; Mon, 02 Oct 2017 15:01:39 -0700 (PDT) Received: from localhost (46-133-157-150.dialup.umc.net.ua. [46.133.157.150]) by smtp.gmail.com with ESMTPSA id p78sm21343866wma.11.2017.10.02.15.01.36 (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 02 Oct 2017 15:01:39 -0700 (PDT) Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes To: "Farhan Khan" Cc: freebsd-wireless@freebsd.org Subject: Re: Register Address Size Mismatch References: <293228d3-c777-d928-8476-ee23ba487c72@gmail.com> <3f760297-d8dd-a2e0-9fda-e09bff06b11c@gmail.com> <9b0976c3-ad31-0558-a3f4-0177b91fb7e6@gmail.com> Date: Tue, 03 Oct 2017 00:59:06 +0300 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: "Andriy Voskoboinyk" Message-ID: In-Reply-To: <9b0976c3-ad31-0558-a3f4-0177b91fb7e6@gmail.com> User-Agent: Opera Mail/12.15 (FreeBSD) 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 22:01:42 -0000 I have not seen any (except generic chipset description) documents in public (only references to them in the driver); most of information was retrieved by reading vendor driver code / experimenting with devices. > 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"