1 /* 2 * otpdefs.h SROM/OTP definitions. 3 * 4 * Copyright (C) 1999-2019, Broadcom. 5 * 6 * Unless you and Broadcom execute a separate written software license 7 * agreement governing use of this software, this software is licensed to you 8 * under the terms of the GNU General Public License version 2 (the "GPL"), 9 * available at http://www.broadcom.com/licenses/GPLv2.php, with the 10 * following added to such license: 11 * 12 * As a special exception, the copyright holders of this software give you 13 * permission to link this software with independent modules, and to copy and 14 * distribute the resulting executable under terms of your choice, provided that 15 * you also meet, for each linked independent module, the terms and conditions 16 * of the license of that module. An independent module is a module which is 17 * not derived from this software. The special exception does not apply to any 18 * modifications of the software. 19 * 20 * Notwithstanding the above, under no circumstances may you combine this 21 * software in any way with any other Broadcom software provided under a license 22 * other than the GPL, without Broadcom's express prior written consent. 23 * 24 * <<Broadcom-WL-IPTag/Open:>> 25 * 26 * $Id$ 27 */ 28 29 #ifndef _OTPDEFS_H_ 30 #define _OTPDEFS_H_ 31 32 /* SFLASH */ 33 #define SFLASH_ADDRESS_OFFSET_4368 0x1C000000u 34 #define SFLASH_SKU_OFFSET_4368 0xEu 35 #define SFLASH_MACADDR_OFFSET_4368 0x4u 36 /* 37 * In sflash based chips, first word in sflash says the length. 38 * So only default value is defined here. Actual length is read 39 * from sflash in dhdpcie_srom_sflash_health_chk 40 * 0x0521 * 2 .x2 since length says number of words. 41 */ 42 #define SFLASH_LEN_4368 0xA42u 43 44 #define SROM_ADDRESS_OFFSET_4355 0x0800u 45 #define SROM_ADDRESS_OFFSET_4364 0xA000u 46 #define SROM_ADDRESS_OFFSET_4377 0x0800u 47 #define SROM_ADDRESS(sih, offset) (SI_ENUM_BASE(sih) + (offset)) 48 #define SROM_MACADDR_OFFSET_4355 0x84u 49 #define SROM_MACADDR_OFFSET_4364 0x82u 50 #define SROM_MACADDR_OFFSET_4377 0xE2u 51 #define SROM_SKU_OFFSET_4355 0x8Au 52 #define SROM_SKU_OFFSET_4364 0x8Cu 53 #define SROM_SKU_OFFSET_4377 0xECu 54 #define SROM_CAL_SIG1_OFFSET_4355 0xB8u 55 #define SROM_CAL_SIG2_OFFSET_4355 0xBAu 56 #define SROM_CAL_SIG1_OFFSET_4364 0xA0u 57 #define SROM_CAL_SIG2_OFFSET_4364 0xA2u 58 #define SROM_CAL_SIG1 0x4c42u 59 #define SROM_CAL_SIG2 0x424fu 60 #define SROM_LEN_4355 512u 61 #define SROM_LEN_4364 2048u 62 #define SROM_LEN_4377 2048u 63 64 #define OTP_USER_AREA_OFFSET_4355 0xC0u 65 #define OTP_USER_AREA_OFFSET_4364 0xC0u 66 #define OTP_USER_AREA_OFFSET_4368 0x120u 67 #define OTP_USER_AREA_OFFSET_4377 0x120u 68 #define OTP_OFFSET_4368 0x5000u 69 #define OTP_OFFSET_4377 0x11000u 70 #define OTP_CTRL1_VAL 0xFA0000 71 #define OTP_ADDRESS(sih, offset) (SI_ENUM_BASE(sih) + (offset)) 72 #define OTP_VERSION_TUPLE_ID 0x15 73 #define OTP_VENDOR_TUPLE_ID 0x80 74 #define OTP_CIS_REGION_END_TUPLE_ID 0XFF 75 76 #define PCIE_CTRL_REG_ADDR(sih) (SI_ENUM_BASE(sih) + 0x3000) 77 #define SPROM_CTRL_REG_ADDR(sih) (SI_ENUM_BASE(sih) + CC_SROM_CTRL) 78 #define SPROM_CTRL_OPCODE_READ_MASK 0x9FFFFFFF 79 #define SPROM_CTRL_START_BUSY_MASK 0x80000000 80 #define SPROM_ADDR(sih) (SI_ENUM_BASE(sih) + CC_SROM_ADDRESS) 81 #define SPROM_DATA(sih) (SI_ENUM_BASE(sih) + CC_SROM_DATA) 82 #define OTP_CTRL1_REG_ADDR(sih) (SI_ENUM_BASE(sih) + 0xF4) 83 #define PMU_MINRESMASK_REG_ADDR(sih) (SI_ENUM_BASE(sih) + MINRESMASKREG) 84 #define CHIP_COMMON_STATUS_REG_ADDR(sih) (SI_ENUM_BASE(sih) + CC_CHIPST) 85 #define CHIP_COMMON_CLKDIV2_ADDR(sih) (SI_ENUM_BASE(sih) + CC_CLKDIV2) 86 87 #define CC_CLKDIV2_SPROMDIV_MASK 0x7u 88 #define CC_CLKDIV2_SPROMDIV_VAL 0X4u 89 #define CC_CHIPSTATUS_STRAP_BTUART_MASK 0x40u 90 #define PMU_OTP_PWR_ON_MASK 0xC47 91 #define PMU_PWRUP_DELAY 500 /* in us */ 92 #define DONGLE_TREFUP_PROGRAM_DELAY 5000 /* 5ms in us */ 93 #define SPROM_BUSY_POLL_DELAY 5 /* 5us */ 94 95 typedef enum { 96 BCM4355_IDX = 0, 97 BCM4364_IDX, 98 BCM4368_IDX, 99 BCM4377_IDX, 100 BCMMAX_IDX 101 } chip_idx_t; 102 103 typedef enum { 104 BCM4368_BTOP_IDX, 105 BCM4377_BTOP_IDX, 106 BCMMAX_BTOP_IDX 107 } chip_idx_btop_t; 108 109 typedef enum { BCM4368_SFLASH_IDX, BCMMAX_SFLASH_IDX } chip_idx_sflash_t; 110 111 extern uint32 otp_addr_offsets[]; 112 extern uint32 otp_usrarea_offsets[]; 113 extern uint32 sku_offsets[]; 114 extern uint32 srf_addr_offsets[]; 115 extern uint32 supported_chips[]; 116 117 char *dhd_get_plat_sku(void); 118 #endif /* _OTPDEFS_H */ 119