1 /** 2 * Copyright (c) 2017 Redpine Signals Inc. 3 * 4 * Permission to use, copy, modify, and/or distribute this software for any 5 * purpose with or without fee is hereby granted, provided that the above 6 * copyright notice and this permission notice appear in all copies. 7 * 8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 */ 16 17 #ifndef __RSI_HAL_H__ 18 #define __RSI_HAL_H__ 19 20 #define FLASH_WRITE_CHUNK_SIZE (4 * 1024) 21 #define FLASH_SECTOR_SIZE (4 * 1024) 22 23 #define FLASH_SIZE_ADDR 0x04000016 24 #define PING_BUFFER_ADDRESS 0x19000 25 #define PONG_BUFFER_ADDRESS 0x1a000 26 #define SWBL_REGIN 0x41050034 27 #define SWBL_REGOUT 0x4105003c 28 #define PING_WRITE 0x1 29 #define PONG_WRITE 0x2 30 31 #define BL_CMD_TIMEOUT 2000 32 #define BL_BURN_TIMEOUT (50 * 1000) 33 34 #define REGIN_VALID 0xA 35 #define REGIN_INPUT 0xA0 36 #define REGOUT_VALID 0xAB 37 #define REGOUT_INVALID (~0xAB) 38 #define CMD_PASS 0xAA 39 #define CMD_FAIL 0xCC 40 41 #define LOAD_HOSTED_FW 'A' 42 #define BURN_HOSTED_FW 'B' 43 #define PING_VALID 'I' 44 #define PONG_VALID 'O' 45 #define PING_AVAIL 'I' 46 #define PONG_AVAIL 'O' 47 #define EOF_REACHED 'E' 48 #define CHECK_CRC 'K' 49 #define POLLING_MODE 'P' 50 #define CONFIG_AUTO_READ_MODE 'R' 51 #define JUMP_TO_ZERO_PC 'J' 52 #define FW_LOADING_SUCCESSFUL 'S' 53 #define LOADING_INITIATED '1' 54 55 /* Boot loader commands */ 56 #define SEND_RPS_FILE '2' 57 58 #define FW_IMAGE_MIN_ADDRESS (68 * 1024) 59 #define MAX_FLASH_FILE_SIZE (400 * 1024) //400K 60 #define FLASH_START_ADDRESS 16 61 62 #define COMMON_HAL_CARD_READY_IND 0x0 63 64 #define COMMAN_HAL_WAIT_FOR_CARD_READY 1 65 66 #define RSI_DEV_OPMODE_WIFI_ALONE 1 67 #define RSI_DEV_COEX_MODE_WIFI_ALONE 1 68 69 struct bl_header { 70 __le32 flags; 71 __le32 image_no; 72 __le32 check_sum; 73 __le32 flash_start_address; 74 __le32 flash_len; 75 } __packed; 76 77 struct ta_metadata { 78 char *name; 79 unsigned int address; 80 }; 81 82 int rsi_hal_device_init(struct rsi_hw *adapter); 83 84 #endif 85