From owner-freebsd-wireless@freebsd.org Sun Oct 1 19:15:14 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 AFE65E2C4C4 for ; Sun, 1 Oct 2017 19:15:14 +0000 (UTC) (envelope-from s3erios@gmail.com) Received: from mail-wm0-x235.google.com (mail-wm0-x235.google.com [IPv6:2a00:1450:400c:c09::235]) (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 3C7726B5B8 for ; Sun, 1 Oct 2017 19:15:14 +0000 (UTC) (envelope-from s3erios@gmail.com) Received: by mail-wm0-x235.google.com with SMTP id m72so7041756wmc.1 for ; Sun, 01 Oct 2017 12:15:14 -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=SJPkJwZs50+j2wxB2uytz/5PjlZJnRPQh7CD4cucR/M=; b=q7QE+sLxA/1DGI6zGLeHwaY/SOwx10k3Cw+Fv4cMhbeCJ3x5Cgimb26KC6V9Z8OGkF CKAAPJcA9cAuNkeEdRfPfddjQ8jIlSsXNtRdyQ3ov/3xOD6P4/p3BOP52rUifKDZHjZf Fvzl5ERL0b1PlSTPb6MRf7UAuR2zX5uwObpUKo3a0uFys5rRCyRXf4j0YyPiBNDnWFTY ED5Cep3xd/t/C5rdMBsuznamYAW3GTxfdtrBxuLSWDUDAKE6IZkCopgJR8sqkzY7x+CM AHSWBGedKibYArxbxpxLKpck7izsebOsXqPSftSyoUi/C1F4Zz51b3EpbxEAOa0bS7BK YbYg== 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=SJPkJwZs50+j2wxB2uytz/5PjlZJnRPQh7CD4cucR/M=; b=YYUYmD7cUD/NoIxXe59Mt08D3Y0LqgNExv0hBQICoRh8wmfgLU6NCwkTCDHqwB+f1I rhVMA4SYz3FwDEWJyl66OihfJdlBrCRT5OxI2DhYMCXDApygf8HCTY7mm5AXZHjHZryY bIGkYAr5KFz+KKXUwMem5WYB7ypbxFba/U9NiNIBQJV1wIx/kNC2o/UtYopiC98TL0yi 6Acm3BzYBvmKFIySccp8GXjOvZtEZ/fJ4RT/3tIgl0iA42WkJiULB8ZZGHmEYUx+zkjX omUDQHQnQmNW1QoT4lPz0FOur2cb9JZyrBGr26EfMjHKj5rfMG5SDEptB7JWLBaBXgiX bBlw== X-Gm-Message-State: AMCzsaW9CitaRJgcZrB5gnBpP3xucE9PjFT63eSEvDIS4oUM47fIsQ06 tQGHil0mTq7HJE8RhdBKoaE= X-Google-Smtp-Source: AOwi7QB9bimax0Mnke/BvpNObMSFEMRYOjt+bTIVCA111XLfj7JoNxXV83uPInDblbfd2O0dQ/PomA== X-Received: by 10.28.11.195 with SMTP id 186mr8006610wml.41.1506885312556; Sun, 01 Oct 2017 12:15:12 -0700 (PDT) Received: from thinkpad-x220 (46-133-43-27.dialup.umc.net.ua. [46.133.43.27]) by smtp.gmail.com with ESMTPSA id p200sm7936218wmg.48.2017.10.01.12.15.10 (version=TLS1 cipher=AES128-SHA bits=128/128); Sun, 01 Oct 2017 12:15:11 -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> Date: Sun, 01 Oct 2017 22:12:42 +0300 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: "Andriy Voskoboinyk" Message-ID: In-Reply-To: <3f760297-d8dd-a2e0-9fda-e09bff06b11c@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: Sun, 01 Oct 2017 19:15:14 -0000 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"