1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2019 Intel Corporation
5 #ifndef _OPAE_INTEL_MAX10_H_
6 #define _OPAE_INTEL_MAX10_H_
8 #include "opae_osdep.h"
11 #define INTEL_MAX10_MAX_MDIO_DEVS 2
12 #define PKVL_NUMBER_PORTS 4
14 /* max10 capability flags */
15 #define MAX10_FLAGS_NO_I2C2 BIT(0)
16 #define MAX10_FLAGS_NO_BMCIMG_FLASH BIT(1)
17 #define MAX10_FLAGS_DEVICE_TABLE BIT(2)
18 #define MAX10_FLAGS_SPI BIT(3)
19 #define MAX10_FLGAS_NIOS_SPI BIT(4)
20 #define MAX10_FLAGS_PKVL BIT(5)
22 struct intel_max10_device {
23 unsigned int flags; /*max10 hardware capability*/
24 struct altera_spi_device *spi_master;
25 struct spi_transaction_dev *spi_tran_dev;
28 #define FLASH_BASE 0x10000000
29 #define FLASH_OPTION_BITS 0x10000
31 #define NIOS2_FW_VERSION_OFF 0x300400
32 #define RSU_REG_OFF 0x30042c
33 #define FPGA_RP_LOAD BIT(3)
34 #define NIOS2_PRERESET BIT(4)
35 #define NIOS2_HANG BIT(5)
36 #define RSU_ENABLE BIT(6)
37 #define NIOS2_RESET BIT(7)
38 #define NIOS2_I2C2_POLL_STOP BIT(13)
39 #define FPGA_RECONF_REG_OFF 0x300430
40 #define COUNTDOWN_START BIT(18)
41 #define MAX10_BUILD_VER_OFF 0x300468
42 #define PCB_INFO GENMASK(31, 24)
43 #define MAX10_BUILD_VERION GENMASK(23, 0)
44 #define FPGA_PAGE_INFO_OFF 0x30046c
45 #define DT_AVAIL_REG_OFF 0x300490
46 #define DT_AVAIL BIT(0)
47 #define DT_BASE_ADDR_REG_OFF 0x300494
48 #define PKVL_POLLING_CTRL 0x300480
49 #define PKVL_LINK_STATUS 0x300564
51 #define DFT_MAX_SIZE 0x7e0000
53 int max10_reg_read(unsigned int reg, unsigned int *val);
54 int max10_reg_write(unsigned int reg, unsigned int val);
55 struct intel_max10_device *
56 intel_max10_device_probe(struct altera_spi_device *spi,
58 int intel_max10_device_remove(struct intel_max10_device *dev);