OpenBIC
OpenSource Bridge-IC
pt5161l.h
Go to the documentation of this file.
1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef PT5161L_H
18#define PT5161L_H
19
20#include "hal_i2c.h"
21
22#define PT5161L_I2C_MST_INIT_CTRL_BIT_BANG_MODE_EN_GET(x) (((x) & 0x04) >> 2)
23#define PT5161L_I2C_MST_INIT_CTRL_BIT_BANG_MODE_EN_SET(x) (((x) << 2) & 0x04)
24#define PT5161L_I2C_MST_INIT_CTRL_BIT_BANG_MODE_EN_MODIFY(r, x) ((((x) << 2) & 0x04) | ((r) & 0xfb))
25
26#define PT5161L_SELF_WR_CSR_CMD 1
27#define PT5161L_MAIN_MICRO_FW_INFO (96 * 1024 - 128)
28#define PT5161L_MM_FW_VERSION_MAJOR 0
29#define PT5161L_MM_FW_VERSION_MINOR 1
30#define PT5161L_MM_FW_VERSION_BUILD 2
31
32//Main Micro codes for writing and reading EEPROM via MM-assist
33#define PT5161L_MM_EEPROM_WRITE_REG_CODE 1
34#define PT5161L_MM_EEPROM_WRITE_END_CODE 2
35#define PT5161L_MM_EEPROM_READ_END_CODE 3
36#define PT5161L_MM_EEPROM_READ_REG_CODE 4
37#define PT5161L_MM_STATUS_TIME_5MS 5
38#define PT5161L_MM_STATUS_TIME_10MS 10
39#define PT5161L_MM_EEPROM_ASSIST_CMD_ADDR 0x920
40#define PT5161L_EEPROM_BLOCK_BASE_ADDR 0x88e7
41#define PT5161L_EEPROM_BLOCK_CMD_MODIFIER 0x80
42#define PT5161L_EEPROM_BLOCK_WRITE_SIZE 32
43#define PT5161L_EEPROM_PAGE_SIZE 256
44
45#define PT5161L_MAIN_SRAM_DMEM_OFFSET (64 * 1024)
46#define PT5161L_TG_RD_LOC_IND_SRAM 0x16
47#define PT5161L_TEMP_OFFSET 0x42c
49#define PT5161L_I2C_MST_IC_CMD_ADDR 0xd04
51#define PT5161L_I2C_MST_DATA0_ADDR 0xd05
53#define PT5161L_I2C_MST_DATA1_ADDR 0xd06
55#define PT5161L_I2C_MST_DATA2_ADDR 0xd07
57#define PT5161L_I2C_MST_DATA3_ADDR 0xd08
59#define PT5161L_I2C_MST_CMD_ADDR 0xd09
60#define PT5161L_I2C_MST_BB_OUTPUT_ADDRESS 0xd0b
61#define PT5161L_I2C_MST_INIT_CTRL_ADDRESS 0xd0a
62#define PT5161L_MAIN_MICRO_INDIRECT 0xd99
63
64#define PT5161L_MUTEX_LOCK_MS 1000
65#define PCIE_RETIMER_UPDATE_MAX_OFFSET 0x40000
66
67#define PT5161L_VENDOR_ID_LENGTH 7
68extern uint8_t PT5161L_VENDOR_ID[7];
69
71bool pt5161l_get_fw_version(I2C_MSG *msg, uint8_t *version);
72uint8_t pcie_retimer_fw_update(I2C_MSG *msg, uint32_t offset, uint16_t msg_len, uint8_t *msg_buf,
73 uint8_t flag);
74
75#endif
uint32_t version
Definition: pldm_base.h:1
uint32_t offset
Definition: pldm_firmware_update.h:0
uint8_t PT5161L_VENDOR_ID[7]
Definition: pt5161l.c:29
uint8_t pcie_retimer_fw_update(I2C_MSG *msg, uint32_t offset, uint16_t msg_len, uint8_t *msg_buf, uint8_t flag)
Definition: pt5161l.c:854
bool pt5161l_get_vendor_id(I2C_MSG *msg)
Definition: pt5161l.c:31
bool pt5161l_get_fw_version(I2C_MSG *msg, uint8_t *version)
Definition: pt5161l.c:935
Definition: hal_i2c.h:163