Home | History | Annotate | Line # | Download | only in ic
al2210reg.h revision 1.4
      1  1.4  dyoung /* $NetBSD: al2210reg.h,v 1.4 2006/03/08 08:26:50 dyoung Exp $ */
      2  1.1  dyoung 
      3  1.1  dyoung /*
      4  1.1  dyoung  * Copyright (c) 2004 David Young.  All rights reserved.
      5  1.1  dyoung  *
      6  1.1  dyoung  * This code was written by David Young.
      7  1.1  dyoung  *
      8  1.1  dyoung  * Redistribution and use in source and binary forms, with or without
      9  1.1  dyoung  * modification, are permitted provided that the following conditions
     10  1.1  dyoung  * are met:
     11  1.1  dyoung  * 1. Redistributions of source code must retain the above copyright
     12  1.1  dyoung  *    notice, this list of conditions and the following disclaimer.
     13  1.1  dyoung  * 2. Redistributions in binary form must reproduce the above copyright
     14  1.1  dyoung  *    notice, this list of conditions and the following disclaimer in the
     15  1.1  dyoung  *    documentation and/or other materials provided with the distribution.
     16  1.1  dyoung  * 3. Neither the name of the author nor the names of any co-contributors
     17  1.1  dyoung  *    may be used to endorse or promote products derived from this software
     18  1.1  dyoung  *    without specific prior written permission.
     19  1.1  dyoung  *
     20  1.1  dyoung  * THIS SOFTWARE IS PROVIDED BY David Young ``AS IS'' AND ANY
     21  1.1  dyoung  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
     22  1.1  dyoung  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
     23  1.1  dyoung  * PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL David
     24  1.1  dyoung  * Young BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     25  1.1  dyoung  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
     26  1.1  dyoung  * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     27  1.1  dyoung  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
     28  1.1  dyoung  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
     29  1.1  dyoung  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     30  1.1  dyoung  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
     31  1.1  dyoung  * OF SUCH DAMAGE.
     32  1.1  dyoung  */
     33  1.1  dyoung 
     34  1.1  dyoung #ifndef _DEV_IC_AL2210REG_H_
     35  1.1  dyoung #define	_DEV_IC_AL2210REG_H_
     36  1.1  dyoung 
     37  1.1  dyoung /*
     38  1.1  dyoung  * Register definitions for the Airoha AL2210 2.4GHz 802.11b
     39  1.1  dyoung  * transceiver.
     40  1.1  dyoung  */
     41  1.1  dyoung 
     42  1.1  dyoung /* NOTE WELL: These register definitions, in spite of being derived
     43  1.1  dyoung  * from an "official" Airoha AL2210 datasheet, contain a lot of
     44  1.1  dyoung  * "magic." Comparing with the magic in this header file with a
     45  1.1  dyoung  * reference driver that also contains AL2210 magic, the magic does
     46  1.1  dyoung  * not match!
     47  1.1  dyoung  */
     48  1.1  dyoung 
     49  1.1  dyoung /*
     50  1.1  dyoung  * Serial bus format for Airoha AL2210 2.4GHz transceiver.
     51  1.1  dyoung  */
     52  1.4  dyoung #define	AL2210_TWI_DATA_MASK	__BITS(23, 4)
     53  1.4  dyoung #define	AL2210_TWI_ADDR_MASK	__BITS(3, 0)
     54  1.1  dyoung 
     55  1.1  dyoung /*
     56  1.1  dyoung  * Registers for Airoha AL2210.
     57  1.1  dyoung  */
     58  1.1  dyoung 
     59  1.1  dyoung /* The synthesizer magic should be decipherable, but I'm not going
     60  1.1  dyoung  * to waste my time right now.
     61  1.1  dyoung  */
     62  1.1  dyoung #define AL2210_CHANNEL		0x0
     63  1.4  dyoung #define		AL2210_CHANNEL_B_MASK		__BITS(10, 5)	/* Counter B */
     64  1.1  dyoung #define		AL2210_CHANNEL_B_2412MHZ	0x396
     65  1.1  dyoung #define		AL2210_CHANNEL_B_2417MHZ	0x396
     66  1.1  dyoung #define		AL2210_CHANNEL_B_2422MHZ	0x396
     67  1.1  dyoung #define		AL2210_CHANNEL_B_2427MHZ	0x396
     68  1.1  dyoung #define		AL2210_CHANNEL_B_2432MHZ	0x398
     69  1.1  dyoung #define		AL2210_CHANNEL_B_2437MHZ	0x398
     70  1.1  dyoung #define		AL2210_CHANNEL_B_2442MHZ	0x398
     71  1.1  dyoung #define		AL2210_CHANNEL_B_2447MHZ	0x398
     72  1.1  dyoung #define		AL2210_CHANNEL_B_2452MHZ	0x398
     73  1.1  dyoung #define		AL2210_CHANNEL_B_2457MHZ	0x398
     74  1.1  dyoung #define		AL2210_CHANNEL_B_2462MHZ	0x398
     75  1.1  dyoung #define		AL2210_CHANNEL_B_2467MHZ	0x39a
     76  1.1  dyoung #define		AL2210_CHANNEL_B_2472MHZ	0x39a
     77  1.1  dyoung #define		AL2210_CHANNEL_B_2484MHZ	0x39b
     78  1.4  dyoung #define		AL2210_CHANNEL_A_MASK		__BITS(4, 0)	/* Counter A */
     79  1.1  dyoung #define		AL2210_CHANNEL_A_2412MHZ	0x0c
     80  1.1  dyoung #define		AL2210_CHANNEL_A_2417MHZ	0x11
     81  1.1  dyoung #define		AL2210_CHANNEL_A_2422MHZ	0x16
     82  1.1  dyoung #define		AL2210_CHANNEL_A_2427MHZ	0x1b
     83  1.1  dyoung #define		AL2210_CHANNEL_A_2432MHZ	0x00
     84  1.1  dyoung #define		AL2210_CHANNEL_A_2437MHZ	0x05
     85  1.1  dyoung #define		AL2210_CHANNEL_A_2442MHZ	0x0a
     86  1.1  dyoung #define		AL2210_CHANNEL_A_2447MHZ	0x0f
     87  1.1  dyoung #define		AL2210_CHANNEL_A_2452MHZ	0x14
     88  1.1  dyoung #define		AL2210_CHANNEL_A_2457MHZ	0x10
     89  1.1  dyoung #define		AL2210_CHANNEL_A_2462MHZ	0x1e
     90  1.1  dyoung #define		AL2210_CHANNEL_A_2467MHZ	0x03
     91  1.1  dyoung #define		AL2210_CHANNEL_A_2472MHZ	0x08
     92  1.1  dyoung #define		AL2210_CHANNEL_A_2484MHZ	0x14
     93  1.1  dyoung 
     94  1.1  dyoung #define AL2210_SYNTHESIZER	0x1
     95  1.4  dyoung #define		AL2210_SYNTHESIZER_R_MASK	__BITS(4, 0)	/* Reference
     96  1.1  dyoung 								 * divider
     97  1.4  dyoung 								 */
     98  1.1  dyoung #define AL2210_RECEIVER		0x2
     99  1.1  dyoung /* Rx VAGC Detector Negative Edge Threshold */
    100  1.4  dyoung #define		AL2210_RECEIVER_AGCDET_P_MASK	__BITS(16, 15)
    101  1.1  dyoung #define		AL2210_RECEIVER_AGCDET_P_0_4V	0	/* 0.4V */
    102  1.1  dyoung #define		AL2210_RECEIVER_AGCDET_P_0_3V	1	/* 0.3V */
    103  1.1  dyoung #define		AL2210_RECEIVER_AGCDET_P_0_2V	2	/* 0.2V */
    104  1.1  dyoung #define		AL2210_RECEIVER_AGCDET_P_RSVD	3	/* reserved */
    105  1.1  dyoung /* Rx VAGC Detector Negative Edge Threshold */
    106  1.4  dyoung #define		AL2210_RECEIVER_AGCDET_N_MASK	__BITS(14, 13)
    107  1.1  dyoung #define		AL2210_RECEIVER_AGCDET_N_0_4V	0	/* 0.4V */
    108  1.1  dyoung #define		AL2210_RECEIVER_AGCDET_N_0_3V	1	/* 0.3V */
    109  1.1  dyoung #define		AL2210_RECEIVER_AGCDET_N_0_2V	2	/* 0.2V */
    110  1.1  dyoung #define		AL2210_RECEIVER_AGCDET_N_RSVD	3	/* reserved */
    111  1.1  dyoung /* AGC detector control, 1: enable, 0: disable. */
    112  1.4  dyoung #define		AL2210_RECEIVER_AGCDETENA	__BIT(11)
    113  1.1  dyoung /* Rx filter bandwidth select */
    114  1.4  dyoung #define		AL2210_RECEIVER_BW_SEL_MASK	__BITS(4, 2)
    115  1.1  dyoung #define		AL2210_RECEIVER_BW_SEL_9_5MHZ	0
    116  1.1  dyoung #define		AL2210_RECEIVER_BW_SEL_9MHZ	1
    117  1.1  dyoung #define		AL2210_RECEIVER_BW_SEL_8_5MHZ	2
    118  1.1  dyoung #define		AL2210_RECEIVER_BW_SEL_8MHZ	3
    119  1.1  dyoung #define		AL2210_RECEIVER_BW_SEL_7_5MHZ	4
    120  1.1  dyoung #define		AL2210_RECEIVER_BW_SEL_7MHZ	5
    121  1.1  dyoung #define		AL2210_RECEIVER_BW_SEL_6_5MHZ	6
    122  1.1  dyoung #define		AL2210_RECEIVER_BW_SEL_6MHZ	7
    123  1.1  dyoung 
    124  1.1  dyoung #define AL2210_TRANSMITTER	0x3
    125  1.1  dyoung /* 2nd-stage power amplifier current control.  Units of 20uA.
    126  1.1  dyoung  * "Full scale" current is 300uA.  (Is full-scale at PABIAS2 = 0 or
    127  1.1  dyoung  * at PABIAS2 = 15?)
    128  1.1  dyoung  */
    129  1.4  dyoung #define		AL2210_TRANSMITTER_PABIAS2_MASK	__BITS(7, 4)
    130  1.1  dyoung /* 1st-stage power amplifier current control.  Units of 20uA.
    131  1.1  dyoung  * "Full scale" current is 300uA.  (Is full-scale at PABIAS2 = 0 or
    132  1.1  dyoung  * at PABIAS2 = 15?)
    133  1.1  dyoung  */
    134  1.4  dyoung #define		AL2210_TRANSMITTER_PABIAS1_MASK	__BITS(3, 0)
    135  1.1  dyoung 
    136  1.1  dyoung #define AL2210_CONFIG1		0x4
    137  1.1  dyoung 
    138  1.1  dyoung #define AL2210_CONFIG2		0x5
    139  1.1  dyoung /* Regulator power.  0: on, 1: off. */
    140  1.4  dyoung #define		AL2210_CONFIG2_REGPD_MASK	__BIT(19)
    141  1.1  dyoung /* XO clock setting.   0: 44MHz, 1: 22MHz. */
    142  1.4  dyoung #define		AL2210_CONFIG2_XTAL_SC_MASK	__BIT(10)
    143  1.1  dyoung 
    144  1.1  dyoung /* DC Offset Calibration (DCOC) */
    145  1.1  dyoung #define AL2210_CONFIG3		0x6
    146  1.1  dyoung /* Select 1MHz DCOC timing. */
    147  1.4  dyoung #define		AL2210_CONFIG3_AGC_DET_PATT_1MHZ	__BIT(17)
    148  1.1  dyoung /* Select 100kHz DCOC timing. */
    149  1.4  dyoung #define		AL2210_CONFIG3_AGC_DET_PATT_100KHZ	__BIT(16)
    150  1.4  dyoung #define		AL2210_CONFIG3_LNA_GAIN_PATT_1MHZ	__BITS(15)
    151  1.4  dyoung #define		AL2210_CONFIG3_LNA_GAIN_PATT_100KHZ	__BITS(14)
    152  1.4  dyoung #define		AL2210_CONFIG3_RXON_PATT_1MHZ		__BITS(13)
    153  1.4  dyoung #define		AL2210_CONFIG3_RXON_PATT_1OOKHZ		__BITS(12)
    154  1.1  dyoung /* 1MHz DCOC duration?  Microseconds. */
    155  1.4  dyoung #define		AL2210_CONFIG3_CNT_1M_AGC_MASK		__BITS(11, 8)
    156  1.4  dyoung #define		AL2210_CONFIG3_CNT_1M_LNA_MASK		__BITS(7, 4)
    157  1.4  dyoung #define		AL2210_CONFIG3_CNT_1M_RXON_MASK		__BITS(3, 0)
    158  1.1  dyoung 
    159  1.1  dyoung #define AL2210_CONFIG4		0x7
    160  1.1  dyoung /* 100kHz DCOC duration?  Microseconds. */
    161  1.4  dyoung #define		AL2210_CONFIG4_CNT_100K_AGC_MASK	__BITS(11, 8)
    162  1.4  dyoung #define		AL2210_CONFIG4_CNT_100K_LNA_MASK	__BITS(7, 4)
    163  1.4  dyoung #define		AL2210_CONFIG4_CNT_100K_RXON_MASK	__BITS(3, 0)
    164  1.1  dyoung 
    165  1.1  dyoung #define AL2210_CONFIG5		0x8
    166  1.4  dyoung #define		AL2210_CONFIG5_TXF_BW_MASK		__BITS(9, 8)
    167  1.1  dyoung #define		AL2210_CONFIG5_TXF_BW_12MHZ		3
    168  1.1  dyoung #define		AL2210_CONFIG5_TXF_BW_11MHZ		2
    169  1.1  dyoung #define		AL2210_CONFIG5_TXF_BW_10MHZ		1
    170  1.1  dyoung #define		AL2210_CONFIG5_TXF_BW_9MHZ		0
    171  1.1  dyoung 
    172  1.1  dyoung #define AL2210_CONFIG6		0x9
    173  1.1  dyoung #define	AL2210_CONFIG6_DEFAULT	0x2c0009	/* magic */
    174  1.1  dyoung 
    175  1.1  dyoung #define AL2210_CONFIG7		0xa
    176  1.1  dyoung #define	AL2210_CONFIG7_DEFAULT	0x001c0a	/* magic */
    177  1.1  dyoung 
    178  1.1  dyoung #define AL2210_CONFIG8		0xb
    179  1.1  dyoung #define	AL2210_CONFIG8_DEFAULT	0x01000b	/* magic */
    180  1.1  dyoung 
    181  1.1  dyoung #endif /* _DEV_IC_AL2210REG_H_ */
    182