Re: Register Address Size Mismatch

2017-10-02 Thread Andriy Voskoboinyk
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-unsubscr...@freebsd.org"

___
freebsd-wireless@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-wireless
To unsubscribe, send any mail to "freebsd-wireless-unsubscr...@freebsd.org"


Re: Register Address Size Mismatch

2017-10-01 Thread Farhan Khan
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-unsubscr...@freebsd.org"
___
freebsd-wireless@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-wireless
To unsubscribe, send any mail to "freebsd-wireless-unsubscr...@freebsd.org"


Re: Register Address Size Mismatch

2017-10-01 Thread Andriy Voskoboinyk

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-unsubscr...@freebsd.org"

___
freebsd-wireless@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-wireless
To unsubscribe, send any mail to "freebsd-wireless-unsubscr...@freebsd.org"


Re: Register Address Size Mismatch

2017-10-01 Thread Farhan Khan
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-unsubscr...@freebsd.org"
___
freebsd-wireless@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-wireless
To unsubscribe, send any mail to "freebsd-wireless-unsubscr...@freebsd.org"


Re: Register Address Size Mismatch

2017-10-01 Thread Andriy Voskoboinyk

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-unsubscr...@freebsd.org"

___
freebsd-wireless@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-wireless
To unsubscribe, send any mail to "freebsd-wireless-unsubscr...@freebsd.org"