1 /* SPDX-License-Identifier: GPL-2.0+ */
4 * Rich Ireland, Enterasys Networks, rireland@enterasys.com.
13 * For the StratixV FPGA programming via SPI, the following
14 * information is coded in the 32bit cookie:
16 * SPI-Bus | SPI-Dev | Config-Pin | Done-Pin
18 #define FPGA_COOKIE(bus, dev, config, done) \
19 (((bus) << 24) | ((dev) << 16) | ((config) << 8) | (done))
20 #define COOKIE2SPI_BUS(c) (((c) >> 24) & 0xff)
21 #define COOKIE2SPI_DEV(c) (((c) >> 16) & 0xff)
22 #define COOKIE2CONFIG(c) (((c) >> 8) & 0xff)
23 #define COOKIE2DONE(c) ((c) & 0xff)
26 /* insert all new types after this */
27 min_altera_iface_type,
28 /* serial data and external clock */
31 passive_parallel_synchronous,
33 passive_parallel_asynchronous,
34 /* serial data w/ internal clock (not used) */
35 passive_serial_asynchronous,
36 /* jtag/tap serial (not used ) */
38 /* fast passive parallel (FPP) */
39 fast_passive_parallel,
40 /* fast passive parallel with security (FPPS) */
41 fast_passive_parallel_security,
42 /* secure device manager (SDM) mailbox */
43 secure_device_manager_mailbox,
44 /* insert all new types before this */
45 max_altera_iface_type,
49 /* insert all new types after this */
55 /* StratixII Family */
61 /* Intel FPGA Family with SDM (Secure Device Manager) Mailbox */
62 Intel_FPGA_SDM_Mailbox,
64 /* Add new models here */
66 /* insert all new types before this */
72 enum altera_family family;
74 enum altera_iface iface;
75 /* bytes of data part can accept */
77 /* interface function table */
79 /* base interface address */
81 /* implementation specific cookie */
85 /* Generic Altera Functions
86 *********************************************************************/
87 extern int altera_load(Altera_desc *desc, const void *image, size_t size);
88 extern int altera_dump(Altera_desc *desc, const void *buf, size_t bsize);
89 extern int altera_info(Altera_desc *desc);
91 /* Board specific implementation specific function types
92 *********************************************************************/
93 typedef int (*Altera_pre_fn)( int cookie );
94 typedef int (*Altera_config_fn)( int assert_config, int flush, int cookie );
95 typedef int (*Altera_status_fn)( int cookie );
96 typedef int (*Altera_done_fn)( int cookie );
97 typedef int (*Altera_clk_fn)( int assert_clk, int flush, int cookie );
98 typedef int (*Altera_data_fn)( int assert_data, int flush, int cookie );
99 typedef int(*Altera_write_fn)(const void *buf, size_t len, int flush, int cookie);
100 typedef int (*Altera_abort_fn)( int cookie );
101 typedef int (*Altera_post_fn)( int cookie );
105 Altera_config_fn config;
106 Altera_status_fn status;
110 Altera_write_fn write;
111 Altera_abort_fn abort;
113 } altera_board_specific_func;
115 #ifdef CONFIG_FPGA_SOCFPGA
116 int socfpga_load(Altera_desc *desc, const void *rbf_data, size_t rbf_size);
119 #ifdef CONFIG_FPGA_STRATIX_V
120 int stratixv_load(Altera_desc *desc, const void *rbf_data, size_t rbf_size);
123 #ifdef CONFIG_FPGA_INTEL_SDM_MAILBOX
124 int intel_sdm_mb_load(Altera_desc *desc, const void *rbf_data,
128 #endif /* _ALTERA_H_ */