OpenBIC
OpenSource Bridge-IC
altera.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 ALTERA_H
18#define ALTERA_H
19
20#include <stdint.h>
21
22#define CPLD_UPDATE_SIZE 0x80
23
24// on-chip Flash IP
25#define ON_CHIP_FLASH_IP_CSR_STATUS_REG 0x00200020
26#define ON_CHIP_FLASH_IP_DATA_REG 0x00000000
27
28// Dual-boot IP
29#define DUAL_BOOT_IP_BASE 0x00200000
30#define M04_CFM1_START_ADDR 0x00027000
31#define M04_CFM1_END_ADDR 0x00049FFF
32
33// status register
34#define BUSY_IDLE 0x00
35#define BUSY_ERASE 0x01
36#define BUSY_WRITE 0x02
37#define BUSY_READ 0x03
38#define READ_SUCCESS 0x04
39#define WRITE_SUCCESS 0x08
40#define ERASE_SUCCESS 0x10
41#define STATUS_BIT_MASK 0x1F
42
43typedef struct _altera_max10_attr {
44 uint8_t bus;
45 uint8_t target_addr;
49
50int change_word_to_byte(uint8_t *output, int intput);
51int get_register_via_i2c(int reg, int *val);
52int set_register_via_i2c(int reg, int val);
53int max10_reg_read(int address);
54int max10_reg_write(int address, int data);
55int max10_status_read(void);
56int max10_write_flash_data(int address, int data);
57int cpld_altera_max10_fw_update(uint32_t offset, uint16_t msg_len, uint8_t *msg);
59
60#endif
uint32_t val
Definition: plat_util.c:40
struct _altera_max10_attr altera_max10_attr
int pal_load_altera_max10_attr()
int max10_reg_read(int address)
Definition: altera.c:98
int change_word_to_byte(uint8_t *output, int intput)
Definition: altera.c:49
int cpld_altera_max10_fw_update(uint32_t offset, uint16_t msg_len, uint8_t *msg)
Definition: altera.c:159
int max10_write_flash_data(int address, int data)
Definition: altera.c:154
int max10_reg_write(int address, int data)
Definition: altera.c:145
int get_register_via_i2c(int reg, int *val)
Definition: altera.c:64
int max10_status_read(void)
Definition: altera.c:110
int set_register_via_i2c(int reg, int val)
Definition: altera.c:115
uint8_t data[]
Definition: isl69259.c:2
uint32_t offset
Definition: pldm_firmware_update.h:0
Definition: altera.h:43
uint8_t bus
Definition: altera.h:44
int update_start_addr
Definition: altera.h:46
int update_end_addr
Definition: altera.h:47
uint8_t target_addr
Definition: altera.h:45