1*30519460SAditya Srivastava /* 2dad0d04fSFariya Fatima * Copyright (c) 2014 Redpine Signals Inc. 3dad0d04fSFariya Fatima * 4dad0d04fSFariya Fatima * Permission to use, copy, modify, and/or distribute this software for any 5dad0d04fSFariya Fatima * purpose with or without fee is hereby granted, provided that the above 6dad0d04fSFariya Fatima * copyright notice and this permission notice appear in all copies. 7dad0d04fSFariya Fatima * 8dad0d04fSFariya Fatima * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9dad0d04fSFariya Fatima * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10dad0d04fSFariya Fatima * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11dad0d04fSFariya Fatima * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12dad0d04fSFariya Fatima * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13dad0d04fSFariya Fatima * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14dad0d04fSFariya Fatima * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15dad0d04fSFariya Fatima */ 16dad0d04fSFariya Fatima 17dad0d04fSFariya Fatima #ifndef __RSI_BOOTPARAMS_HEADER_H__ 18dad0d04fSFariya Fatima #define __RSI_BOOTPARAMS_HEADER_H__ 19dad0d04fSFariya Fatima 20dad0d04fSFariya Fatima #define CRYSTAL_GOOD_TIME BIT(0) 21dad0d04fSFariya Fatima #define BOOTUP_MODE_INFO BIT(1) 22dad0d04fSFariya Fatima #define WIFI_TAPLL_CONFIGS BIT(5) 23dad0d04fSFariya Fatima #define WIFI_PLL960_CONFIGS BIT(6) 24dad0d04fSFariya Fatima #define WIFI_AFEPLL_CONFIGS BIT(7) 25dad0d04fSFariya Fatima #define WIFI_SWITCH_CLK_CONFIGS BIT(8) 26dad0d04fSFariya Fatima 271b1bed01SPrameela Rani Garnepudi #define TA_PLL_M_VAL_20 9 281b1bed01SPrameela Rani Garnepudi #define TA_PLL_N_VAL_20 0 29dad0d04fSFariya Fatima #define TA_PLL_P_VAL_20 4 30dad0d04fSFariya Fatima 31dad0d04fSFariya Fatima #define PLL960_M_VAL_20 0x14 32dad0d04fSFariya Fatima #define PLL960_N_VAL_20 0 33dad0d04fSFariya Fatima #define PLL960_P_VAL_20 5 34dad0d04fSFariya Fatima 351b1bed01SPrameela Rani Garnepudi #define UMAC_CLK_40MHZ 80 36dad0d04fSFariya Fatima 371b1bed01SPrameela Rani Garnepudi #define TA_PLL_M_VAL_40 9 381b1bed01SPrameela Rani Garnepudi #define TA_PLL_N_VAL_40 0 391b1bed01SPrameela Rani Garnepudi #define TA_PLL_P_VAL_40 4 40dad0d04fSFariya Fatima 41dad0d04fSFariya Fatima #define PLL960_M_VAL_40 0x14 42dad0d04fSFariya Fatima #define PLL960_N_VAL_40 0 43dad0d04fSFariya Fatima #define PLL960_P_VAL_40 5 44dad0d04fSFariya Fatima 45dad0d04fSFariya Fatima #define UMAC_CLK_20BW \ 46dad0d04fSFariya Fatima (((TA_PLL_M_VAL_20 + 1) * 40) / \ 47dad0d04fSFariya Fatima ((TA_PLL_N_VAL_20 + 1) * (TA_PLL_P_VAL_20 + 1))) 48dad0d04fSFariya Fatima #define VALID_20 \ 498c1475bdSAmitkumar Karwar (WIFI_TAPLL_CONFIGS | WIFI_PLL960_CONFIGS | WIFI_AFEPLL_CONFIGS | \ 508c1475bdSAmitkumar Karwar WIFI_SWITCH_CLK_CONFIGS | BOOTUP_MODE_INFO | CRYSTAL_GOOD_TIME) 51dad0d04fSFariya Fatima #define UMAC_CLK_40BW \ 52dad0d04fSFariya Fatima (((TA_PLL_M_VAL_40 + 1) * 40) / \ 53dad0d04fSFariya Fatima ((TA_PLL_N_VAL_40 + 1) * (TA_PLL_P_VAL_40 + 1))) 54dad0d04fSFariya Fatima #define VALID_40 \ 55dad0d04fSFariya Fatima (WIFI_PLL960_CONFIGS | WIFI_AFEPLL_CONFIGS | WIFI_SWITCH_CLK_CONFIGS | \ 56dad0d04fSFariya Fatima WIFI_TAPLL_CONFIGS | CRYSTAL_GOOD_TIME | BOOTUP_MODE_INFO) 57dad0d04fSFariya Fatima 58dad0d04fSFariya Fatima /* structure to store configs related to TAPLL programming */ 59dad0d04fSFariya Fatima struct tapll_info { 60dad0d04fSFariya Fatima __le16 pll_reg_1; 61dad0d04fSFariya Fatima __le16 pll_reg_2; 62dad0d04fSFariya Fatima } __packed; 63dad0d04fSFariya Fatima 64dad0d04fSFariya Fatima /* structure to store configs related to PLL960 programming */ 65dad0d04fSFariya Fatima struct pll960_info { 66dad0d04fSFariya Fatima __le16 pll_reg_1; 67dad0d04fSFariya Fatima __le16 pll_reg_2; 68dad0d04fSFariya Fatima __le16 pll_reg_3; 69dad0d04fSFariya Fatima } __packed; 70dad0d04fSFariya Fatima 71dad0d04fSFariya Fatima /* structure to store configs related to AFEPLL programming */ 72dad0d04fSFariya Fatima struct afepll_info { 73dad0d04fSFariya Fatima __le16 pll_reg; 74dad0d04fSFariya Fatima } __packed; 75dad0d04fSFariya Fatima 76dad0d04fSFariya Fatima /* structure to store configs related to pll configs */ 77dad0d04fSFariya Fatima struct pll_config { 78dad0d04fSFariya Fatima struct tapll_info tapll_info_g; 79dad0d04fSFariya Fatima struct pll960_info pll960_info_g; 80dad0d04fSFariya Fatima struct afepll_info afepll_info_g; 81dad0d04fSFariya Fatima } __packed; 82dad0d04fSFariya Fatima 83f911c861SSiva Rebbagondla struct pll_config_9116 { 84f911c861SSiva Rebbagondla __le16 pll_ctrl_set_reg; 85f911c861SSiva Rebbagondla __le16 pll_ctrl_clr_reg; 86f911c861SSiva Rebbagondla __le16 pll_modem_conig_reg; 87f911c861SSiva Rebbagondla __le16 soc_clk_config_reg; 88f911c861SSiva Rebbagondla __le16 adc_dac_strm1_config_reg; 89f911c861SSiva Rebbagondla __le16 adc_dac_strm2_config_reg; 90f911c861SSiva Rebbagondla } __packed; 91f911c861SSiva Rebbagondla 92dad0d04fSFariya Fatima /* structure to store configs related to UMAC clk programming */ 93dad0d04fSFariya Fatima struct switch_clk { 94dad0d04fSFariya Fatima __le16 switch_clk_info; 95dad0d04fSFariya Fatima /* If switch_bbp_lmac_clk_reg is set then this value will be programmed 96dad0d04fSFariya Fatima * into reg 97dad0d04fSFariya Fatima */ 98dad0d04fSFariya Fatima __le16 bbp_lmac_clk_reg_val; 99dad0d04fSFariya Fatima /* if switch_umac_clk is set then this value will be programmed */ 100dad0d04fSFariya Fatima __le16 umac_clock_reg_config; 101dad0d04fSFariya Fatima /* if switch_qspi_clk is set then this value will be programmed */ 102dad0d04fSFariya Fatima __le16 qspi_uart_clock_reg_config; 103dad0d04fSFariya Fatima } __packed; 104dad0d04fSFariya Fatima 105f911c861SSiva Rebbagondla #define RSI_SWITCH_TASS_CLK BIT(0) 106f911c861SSiva Rebbagondla #define RSI_SWITCH_QSPI_CLK BIT(1) 107f911c861SSiva Rebbagondla #define RSI_SWITCH_SLP_CLK_2_32 BIT(2) 108f911c861SSiva Rebbagondla #define RSI_SWITCH_WLAN_BBP_LMAC_CLK_REG BIT(3) 109f911c861SSiva Rebbagondla #define RSI_SWITCH_ZBBT_BBP_LMAC_CLK_REG BIT(4) 110f911c861SSiva Rebbagondla #define RSI_SWITCH_BBP_LMAC_CLK_REG BIT(5) 111f911c861SSiva Rebbagondla #define RSI_MODEM_CLK_160MHZ BIT(6) 112f911c861SSiva Rebbagondla 113f911c861SSiva Rebbagondla struct switch_clk_9116 { 114f911c861SSiva Rebbagondla __le32 switch_clk_info; 115f911c861SSiva Rebbagondla __le32 tass_clock_reg; 116f911c861SSiva Rebbagondla __le32 wlan_bbp_lmac_clk_reg_val; 117f911c861SSiva Rebbagondla __le32 zbbt_bbp_lmac_clk_reg_val; 118f911c861SSiva Rebbagondla __le32 bbp_lmac_clk_en_val; 119f911c861SSiva Rebbagondla } __packed; 120f911c861SSiva Rebbagondla 121dad0d04fSFariya Fatima struct device_clk_info { 122dad0d04fSFariya Fatima struct pll_config pll_config_g; 123dad0d04fSFariya Fatima struct switch_clk switch_clk_g; 124dad0d04fSFariya Fatima } __packed; 125dad0d04fSFariya Fatima 126f911c861SSiva Rebbagondla struct device_clk_info_9116 { 127f911c861SSiva Rebbagondla struct pll_config_9116 pll_config_9116_g; 128f911c861SSiva Rebbagondla struct switch_clk_9116 switch_clk_9116_g; 129f911c861SSiva Rebbagondla } __packed; 130f911c861SSiva Rebbagondla 131dad0d04fSFariya Fatima struct bootup_params { 132dad0d04fSFariya Fatima __le16 magic_number; 133dad0d04fSFariya Fatima __le16 crystal_good_time; 134dad0d04fSFariya Fatima __le32 valid; 135dad0d04fSFariya Fatima __le32 reserved_for_valids; 136dad0d04fSFariya Fatima __le16 bootup_mode_info; 137dad0d04fSFariya Fatima /* configuration used for digital loop back */ 138dad0d04fSFariya Fatima __le16 digital_loop_back_params; 139dad0d04fSFariya Fatima __le16 rtls_timestamp_en; 140dad0d04fSFariya Fatima __le16 host_spi_intr_cfg; 141dad0d04fSFariya Fatima struct device_clk_info device_clk_info[3]; 142dad0d04fSFariya Fatima /* ulp buckboost wait time */ 143dad0d04fSFariya Fatima __le32 buckboost_wakeup_cnt; 144dad0d04fSFariya Fatima /* pmu wakeup wait time & WDT EN info */ 145dad0d04fSFariya Fatima __le16 pmu_wakeup_wait; 146dad0d04fSFariya Fatima u8 shutdown_wait_time; 147dad0d04fSFariya Fatima /* Sleep clock source selection */ 148dad0d04fSFariya Fatima u8 pmu_slp_clkout_sel; 149dad0d04fSFariya Fatima /* WDT programming values */ 150dad0d04fSFariya Fatima __le32 wdt_prog_value; 151dad0d04fSFariya Fatima /* WDT soc reset delay */ 152dad0d04fSFariya Fatima __le32 wdt_soc_rst_delay; 153dad0d04fSFariya Fatima /* dcdc modes configs */ 154dad0d04fSFariya Fatima __le32 dcdc_operation_mode; 155dad0d04fSFariya Fatima __le32 soc_reset_wait_cnt; 1561b1bed01SPrameela Rani Garnepudi __le32 waiting_time_at_fresh_sleep; 1571b1bed01SPrameela Rani Garnepudi __le32 max_threshold_to_avoid_sleep; 1581b1bed01SPrameela Rani Garnepudi u8 beacon_resedue_alg_en; 159dad0d04fSFariya Fatima } __packed; 160f911c861SSiva Rebbagondla 161f911c861SSiva Rebbagondla struct bootup_params_9116 { 162f911c861SSiva Rebbagondla __le16 magic_number; 163f911c861SSiva Rebbagondla #define LOADED_TOKEN 0x5AA5 /* Bootup params are installed by host 164f911c861SSiva Rebbagondla * or OTP/FLASH (Bootloader) 165f911c861SSiva Rebbagondla */ 166f911c861SSiva Rebbagondla #define ROM_TOKEN 0x55AA /* Bootup params are taken from ROM 167f911c861SSiva Rebbagondla * itself in MCU mode. 168f911c861SSiva Rebbagondla */ 169f911c861SSiva Rebbagondla __le16 crystal_good_time; 170f911c861SSiva Rebbagondla __le32 valid; 171f911c861SSiva Rebbagondla __le32 reserved_for_valids; 172f911c861SSiva Rebbagondla __le16 bootup_mode_info; 173f911c861SSiva Rebbagondla #define BT_COEXIST BIT(0) 174f911c861SSiva Rebbagondla #define BOOTUP_MODE (BIT(2) | BIT(1)) 175f911c861SSiva Rebbagondla #define CUR_DEV_MODE_9116 (bootup_params_9116.bootup_mode_info >> 1) 176f911c861SSiva Rebbagondla __le16 digital_loop_back_params; 177f911c861SSiva Rebbagondla __le16 rtls_timestamp_en; 178f911c861SSiva Rebbagondla __le16 host_spi_intr_cfg; 179f911c861SSiva Rebbagondla struct device_clk_info_9116 device_clk_info_9116[1]; 180f911c861SSiva Rebbagondla __le32 buckboost_wakeup_cnt; 181f911c861SSiva Rebbagondla __le16 pmu_wakeup_wait; 182f911c861SSiva Rebbagondla u8 shutdown_wait_time; 183f911c861SSiva Rebbagondla u8 pmu_slp_clkout_sel; 184f911c861SSiva Rebbagondla __le32 wdt_prog_value; 185f911c861SSiva Rebbagondla __le32 wdt_soc_rst_delay; 186f911c861SSiva Rebbagondla __le32 dcdc_operation_mode; 187f911c861SSiva Rebbagondla __le32 soc_reset_wait_cnt; 188f911c861SSiva Rebbagondla __le32 waiting_time_at_fresh_sleep; 189f911c861SSiva Rebbagondla __le32 max_threshold_to_avoid_sleep; 190f911c861SSiva Rebbagondla u8 beacon_resedue_alg_en; 191f911c861SSiva Rebbagondla } __packed; 192f911c861SSiva Rebbagondla 193dad0d04fSFariya Fatima #endif 194