Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Copyright (c) 2004-2010 Atheros Communications Inc.
0003  * Copyright (c) 2011 Qualcomm Atheros, Inc.
0004  *
0005  * Permission to use, copy, modify, and/or distribute this software for any
0006  * purpose with or without fee is hereby granted, provided that the above
0007  * copyright notice and this permission notice appear in all copies.
0008  *
0009  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
0010  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
0011  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
0012  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
0013  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
0014  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
0015  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
0016  */
0017 
0018 #ifndef TARGET_H
0019 #define TARGET_H
0020 
0021 #define AR6003_BOARD_DATA_SZ        1024
0022 #define AR6003_BOARD_EXT_DATA_SZ    768
0023 #define AR6003_BOARD_EXT_DATA_SZ_V2 1024
0024 
0025 #define AR6004_BOARD_DATA_SZ     6144
0026 #define AR6004_BOARD_EXT_DATA_SZ 0
0027 
0028 #define RESET_CONTROL_ADDRESS       0x00004000
0029 #define RESET_CONTROL_COLD_RST      0x00000100
0030 #define RESET_CONTROL_MBOX_RST      0x00000004
0031 
0032 #define CPU_CLOCK_STANDARD_S        0
0033 #define CPU_CLOCK_STANDARD      0x00000003
0034 #define CPU_CLOCK_ADDRESS       0x00000020
0035 
0036 #define CLOCK_CONTROL_ADDRESS       0x00000028
0037 #define CLOCK_CONTROL_LF_CLK32_S    2
0038 #define CLOCK_CONTROL_LF_CLK32      0x00000004
0039 
0040 #define SYSTEM_SLEEP_ADDRESS        0x000000c4
0041 #define SYSTEM_SLEEP_DISABLE_S      0
0042 #define SYSTEM_SLEEP_DISABLE        0x00000001
0043 
0044 #define LPO_CAL_ADDRESS         0x000000e0
0045 #define LPO_CAL_ENABLE_S        20
0046 #define LPO_CAL_ENABLE          0x00100000
0047 
0048 #define GPIO_PIN9_ADDRESS       0x0000004c
0049 #define GPIO_PIN10_ADDRESS      0x00000050
0050 #define GPIO_PIN11_ADDRESS      0x00000054
0051 #define GPIO_PIN12_ADDRESS      0x00000058
0052 #define GPIO_PIN13_ADDRESS      0x0000005c
0053 
0054 #define HOST_INT_STATUS_ADDRESS     0x00000400
0055 #define HOST_INT_STATUS_ERROR_S     7
0056 #define HOST_INT_STATUS_ERROR       0x00000080
0057 
0058 #define HOST_INT_STATUS_CPU_S       6
0059 #define HOST_INT_STATUS_CPU     0x00000040
0060 
0061 #define HOST_INT_STATUS_COUNTER_S   4
0062 #define HOST_INT_STATUS_COUNTER     0x00000010
0063 
0064 #define CPU_INT_STATUS_ADDRESS      0x00000401
0065 
0066 #define ERROR_INT_STATUS_ADDRESS    0x00000402
0067 #define ERROR_INT_STATUS_WAKEUP_S   2
0068 #define ERROR_INT_STATUS_WAKEUP     0x00000004
0069 
0070 #define ERROR_INT_STATUS_RX_UNDERFLOW_S 1
0071 #define ERROR_INT_STATUS_RX_UNDERFLOW   0x00000002
0072 
0073 #define ERROR_INT_STATUS_TX_OVERFLOW_S  0
0074 #define ERROR_INT_STATUS_TX_OVERFLOW    0x00000001
0075 
0076 #define COUNTER_INT_STATUS_ADDRESS  0x00000403
0077 #define COUNTER_INT_STATUS_COUNTER_S    0
0078 #define COUNTER_INT_STATUS_COUNTER  0x000000ff
0079 
0080 #define RX_LOOKAHEAD_VALID_ADDRESS  0x00000405
0081 
0082 #define INT_STATUS_ENABLE_ADDRESS   0x00000418
0083 #define INT_STATUS_ENABLE_ERROR_S   7
0084 #define INT_STATUS_ENABLE_ERROR     0x00000080
0085 
0086 #define INT_STATUS_ENABLE_CPU_S     6
0087 #define INT_STATUS_ENABLE_CPU       0x00000040
0088 
0089 #define INT_STATUS_ENABLE_INT_S     5
0090 #define INT_STATUS_ENABLE_INT       0x00000020
0091 #define INT_STATUS_ENABLE_COUNTER_S 4
0092 #define INT_STATUS_ENABLE_COUNTER   0x00000010
0093 
0094 #define INT_STATUS_ENABLE_MBOX_DATA_S   0
0095 #define INT_STATUS_ENABLE_MBOX_DATA 0x0000000f
0096 
0097 #define CPU_INT_STATUS_ENABLE_ADDRESS   0x00000419
0098 #define CPU_INT_STATUS_ENABLE_BIT_S 0
0099 #define CPU_INT_STATUS_ENABLE_BIT   0x000000ff
0100 
0101 #define ERROR_STATUS_ENABLE_ADDRESS     0x0000041a
0102 #define ERROR_STATUS_ENABLE_RX_UNDERFLOW_S  1
0103 #define ERROR_STATUS_ENABLE_RX_UNDERFLOW    0x00000002
0104 
0105 #define ERROR_STATUS_ENABLE_TX_OVERFLOW_S   0
0106 #define ERROR_STATUS_ENABLE_TX_OVERFLOW     0x00000001
0107 
0108 #define COUNTER_INT_STATUS_ENABLE_ADDRESS   0x0000041b
0109 #define COUNTER_INT_STATUS_ENABLE_BIT_S     0
0110 #define COUNTER_INT_STATUS_ENABLE_BIT       0x000000ff
0111 
0112 #define COUNT_ADDRESS           0x00000420
0113 
0114 #define COUNT_DEC_ADDRESS       0x00000440
0115 
0116 #define WINDOW_DATA_ADDRESS     0x00000474
0117 #define WINDOW_WRITE_ADDR_ADDRESS   0x00000478
0118 #define WINDOW_READ_ADDR_ADDRESS    0x0000047c
0119 #define CPU_DBG_SEL_ADDRESS     0x00000483
0120 #define CPU_DBG_ADDRESS         0x00000484
0121 
0122 #define LOCAL_SCRATCH_ADDRESS       0x000000c0
0123 #define ATH6KL_OPTION_SLEEP_DISABLE 0x08
0124 
0125 #define RTC_BASE_ADDRESS        0x00004000
0126 #define GPIO_BASE_ADDRESS       0x00014000
0127 #define MBOX_BASE_ADDRESS       0x00018000
0128 #define ANALOG_INTF_BASE_ADDRESS    0x0001c000
0129 
0130 /* real name of the register is unknown */
0131 #define ATH6KL_ANALOG_PLL_REGISTER  (ANALOG_INTF_BASE_ADDRESS + 0x284)
0132 
0133 #define SM(f, v)    (((v) << f##_S) & f)
0134 #define MS(f, v)    (((v) & f) >> f##_S)
0135 
0136 /*
0137  * xxx_HOST_INTEREST_ADDRESS is the address in Target RAM of the
0138  * host_interest structure.
0139  *
0140  * Host Interest is shared between Host and Target in order to coordinate
0141  * between the two, and is intended to remain constant (with additions only
0142  * at the end).
0143  */
0144 #define ATH6KL_AR6003_HI_START_ADDR           0x00540600
0145 #define ATH6KL_AR6004_HI_START_ADDR           0x00400800
0146 
0147 /*
0148  * These are items that the Host may need to access
0149  * via BMI or via the Diagnostic Window. The position
0150  * of items in this structure must remain constant.
0151  * across firmware revisions!
0152  *
0153  * Types for each item must be fixed size across target and host platforms.
0154  * The structure is used only to calculate offset for each register with
0155  * HI_ITEM() macro, no values are stored to it.
0156  *
0157  * More items may be added at the end.
0158  */
0159 struct host_interest {
0160     /*
0161      * Pointer to application-defined area, if any.
0162      * Set by Target application during startup.
0163      */
0164     u32 hi_app_host_interest;                      /* 0x00 */
0165 
0166     /* Pointer to register dump area, valid after Target crash. */
0167     u32 hi_failure_state;                          /* 0x04 */
0168 
0169     /* Pointer to debug logging header */
0170     u32 hi_dbglog_hdr;                             /* 0x08 */
0171 
0172     u32 hi_unused1;                       /* 0x0c */
0173 
0174     /*
0175      * General-purpose flag bits, similar to ATH6KL_OPTION_* flags.
0176      * Can be used by application rather than by OS.
0177      */
0178     u32 hi_option_flag;                            /* 0x10 */
0179 
0180     /*
0181      * Boolean that determines whether or not to
0182      * display messages on the serial port.
0183      */
0184     u32 hi_serial_enable;                          /* 0x14 */
0185 
0186     /* Start address of DataSet index, if any */
0187     u32 hi_dset_list_head;                         /* 0x18 */
0188 
0189     /* Override Target application start address */
0190     u32 hi_app_start;                              /* 0x1c */
0191 
0192     /* Clock and voltage tuning */
0193     u32 hi_skip_clock_init;                        /* 0x20 */
0194     u32 hi_core_clock_setting;                     /* 0x24 */
0195     u32 hi_cpu_clock_setting;                      /* 0x28 */
0196     u32 hi_system_sleep_setting;                   /* 0x2c */
0197     u32 hi_xtal_control_setting;                   /* 0x30 */
0198     u32 hi_pll_ctrl_setting_24ghz;                 /* 0x34 */
0199     u32 hi_pll_ctrl_setting_5ghz;                  /* 0x38 */
0200     u32 hi_ref_voltage_trim_setting;               /* 0x3c */
0201     u32 hi_clock_info;                             /* 0x40 */
0202 
0203     /*
0204      * Flash configuration overrides, used only
0205      * when firmware is not executing from flash.
0206      * (When using flash, modify the global variables
0207      * with equivalent names.)
0208      */
0209     u32 hi_bank0_addr_value;                       /* 0x44 */
0210     u32 hi_bank0_read_value;                       /* 0x48 */
0211     u32 hi_bank0_write_value;                      /* 0x4c */
0212     u32 hi_bank0_config_value;                     /* 0x50 */
0213 
0214     /* Pointer to Board Data  */
0215     u32 hi_board_data;                             /* 0x54 */
0216     u32 hi_board_data_initialized;                 /* 0x58 */
0217 
0218     u32 hi_dset_ram_index_tbl;                     /* 0x5c */
0219 
0220     u32 hi_desired_baud_rate;                      /* 0x60 */
0221     u32 hi_dbglog_config;                          /* 0x64 */
0222     u32 hi_end_ram_reserve_sz;                     /* 0x68 */
0223     u32 hi_mbox_io_block_sz;                       /* 0x6c */
0224 
0225     u32 hi_num_bpatch_streams;                     /* 0x70 -- unused */
0226     u32 hi_mbox_isr_yield_limit;                   /* 0x74 */
0227 
0228     u32 hi_refclk_hz;                              /* 0x78 */
0229     u32 hi_ext_clk_detected;                       /* 0x7c */
0230     u32 hi_dbg_uart_txpin;                         /* 0x80 */
0231     u32 hi_dbg_uart_rxpin;                         /* 0x84 */
0232     u32 hi_hci_uart_baud;                          /* 0x88 */
0233     u32 hi_hci_uart_pin_assignments;               /* 0x8C */
0234     /*
0235      * NOTE: byte [0] = tx pin, [1] = rx pin, [2] = rts pin, [3] = cts
0236      * pin
0237      */
0238     u32 hi_hci_uart_baud_scale_val;                /* 0x90 */
0239     u32 hi_hci_uart_baud_step_val;                 /* 0x94 */
0240 
0241     u32 hi_allocram_start;                         /* 0x98 */
0242     u32 hi_allocram_sz;                            /* 0x9c */
0243     u32 hi_hci_bridge_flags;                       /* 0xa0 */
0244     u32 hi_hci_uart_support_pins;                  /* 0xa4 */
0245     /*
0246      * NOTE: byte [0] = RESET pin (bit 7 is polarity),
0247      * bytes[1]..bytes[3] are for future use
0248      */
0249     u32 hi_hci_uart_pwr_mgmt_params;               /* 0xa8 */
0250     /*
0251      * 0xa8   - [1]: 0 = UART FC active low, 1 = UART FC active high
0252      *      [31:16]: wakeup timeout in ms
0253      */
0254 
0255     /* Pointer to extended board data */
0256     u32 hi_board_ext_data;                /* 0xac */
0257     u32 hi_board_ext_data_config;         /* 0xb0 */
0258 
0259     /*
0260      * Bit [0]  :   valid
0261      * Bit[31:16:   size
0262      */
0263     /*
0264      * hi_reset_flag is used to do some stuff when target reset.
0265      * such as restore app_start after warm reset or
0266      * preserve host Interest area, or preserve ROM data, literals etc.
0267      */
0268     u32 hi_reset_flag;                            /* 0xb4 */
0269     /* indicate hi_reset_flag is valid */
0270     u32 hi_reset_flag_valid;                      /* 0xb8 */
0271     u32 hi_hci_uart_pwr_mgmt_params_ext;           /* 0xbc */
0272     /*
0273      * 0xbc - [31:0]: idle timeout in ms
0274      */
0275     /* ACS flags */
0276     u32 hi_acs_flags;                              /* 0xc0 */
0277     u32 hi_console_flags;                          /* 0xc4 */
0278     u32 hi_nvram_state;                            /* 0xc8 */
0279     u32 hi_option_flag2;                           /* 0xcc */
0280 
0281     /* If non-zero, override values sent to Host in WMI_READY event. */
0282     u32 hi_sw_version_override;                    /* 0xd0 */
0283     u32 hi_abi_version_override;                   /* 0xd4 */
0284 
0285     /*
0286      * Percentage of high priority RX traffic to total expected RX traffic -
0287      * applicable only to ar6004
0288      */
0289     u32 hi_hp_rx_traffic_ratio;                    /* 0xd8 */
0290 
0291     /* test applications flags */
0292     u32 hi_test_apps_related;                      /* 0xdc */
0293     /* location of test script */
0294     u32 hi_ota_testscript;                         /* 0xe0 */
0295     /* location of CAL data */
0296     u32 hi_cal_data;                               /* 0xe4 */
0297     /* Number of packet log buffers */
0298     u32 hi_pktlog_num_buffers;                     /* 0xe8 */
0299 
0300 } __packed;
0301 
0302 #define HI_ITEM(item)  offsetof(struct host_interest, item)
0303 
0304 #define HI_OPTION_MAC_ADDR_METHOD_SHIFT 3
0305 
0306 #define HI_OPTION_FW_MODE_IBSS    0x0
0307 #define HI_OPTION_FW_MODE_BSS_STA 0x1
0308 #define HI_OPTION_FW_MODE_AP      0x2
0309 
0310 #define HI_OPTION_FW_SUBMODE_NONE      0x0
0311 #define HI_OPTION_FW_SUBMODE_P2PDEV    0x1
0312 #define HI_OPTION_FW_SUBMODE_P2PCLIENT 0x2
0313 #define HI_OPTION_FW_SUBMODE_P2PGO     0x3
0314 
0315 #define HI_OPTION_NUM_DEV_SHIFT   0x9
0316 
0317 #define HI_OPTION_FW_BRIDGE_SHIFT 0x04
0318 
0319 /* Fw Mode/SubMode Mask
0320 |------------------------------------------------------------------------------|
0321 |   SUB   |   SUB   |   SUB   |  SUB    |         |         |         |
0322 | MODE[3] | MODE[2] | MODE[1] | MODE[0] | MODE[3] | MODE[2] | MODE[1] | MODE[0|
0323 |   (2)   |   (2)   |   (2)   |   (2)   |   (2)   |   (2)   |   (2)   |   (2)
0324 |------------------------------------------------------------------------------|
0325 */
0326 #define HI_OPTION_FW_MODE_BITS         0x2
0327 #define HI_OPTION_FW_MODE_SHIFT        0xC
0328 
0329 #define HI_OPTION_FW_SUBMODE_BITS      0x2
0330 #define HI_OPTION_FW_SUBMODE_SHIFT     0x14
0331 
0332 /* Convert a Target virtual address into a Target physical address */
0333 #define AR6003_VTOP(vaddr) ((vaddr) & 0x001fffff)
0334 #define AR6004_VTOP(vaddr) (vaddr)
0335 
0336 #define TARG_VTOP(target_type, vaddr) \
0337     (((target_type) == TARGET_TYPE_AR6003) ? AR6003_VTOP(vaddr) : \
0338     (((target_type) == TARGET_TYPE_AR6004) ? AR6004_VTOP(vaddr) : 0))
0339 
0340 #define ATH6KL_FWLOG_PAYLOAD_SIZE       1500
0341 
0342 struct ath6kl_dbglog_buf {
0343     __le32 next;
0344     __le32 buffer_addr;
0345     __le32 bufsize;
0346     __le32 length;
0347     __le32 count;
0348     __le32 free;
0349 } __packed;
0350 
0351 struct ath6kl_dbglog_hdr {
0352     __le32 dbuf_addr;
0353     __le32 dropped;
0354 } __packed;
0355 
0356 #endif