xref: /openbmc/u-boot/include/altera.h (revision 68968901)
1 /*
2  * (C) Copyright 2002
3  * Rich Ireland, Enterasys Networks, rireland@enterasys.com.
4  *
5  * SPDX-License-Identifier:	GPL-2.0+
6  */
7 
8 #include <fpga.h>
9 
10 #ifndef _ALTERA_H_
11 #define _ALTERA_H_
12 
13 typedef enum {				/* typedef Altera_iface */
14 	min_altera_iface_type,		/* insert all new types after this */
15 	passive_serial,			/* serial data and external clock */
16 	passive_parallel_synchronous,	/* parallel data */
17 	passive_parallel_asynchronous,	/* parallel data */
18 	passive_serial_asynchronous,	/* serial data w/ internal clock (not used)	*/
19 	altera_jtag_mode,		/* jtag/tap serial (not used ) */
20 	fast_passive_parallel,		/* fast passive parallel (FPP) */
21 	fast_passive_parallel_security,	/* fast passive parallel with security (FPPS) */
22 	max_altera_iface_type		/* insert all new types before this */
23 } Altera_iface;				/* end, typedef Altera_iface */
24 
25 typedef enum {			/* typedef Altera_Family */
26 	min_altera_type,	/* insert all new types after this */
27 	Altera_ACEX1K,		/* ACEX1K Family */
28 	Altera_CYC2,		/* CYCLONII Family */
29 	Altera_StratixII,	/* StratixII Family */
30 /* Add new models here */
31 	max_altera_type		/* insert all new types before this */
32 } Altera_Family;		/* end, typedef Altera_Family */
33 
34 typedef struct {		/* typedef Altera_desc */
35 	Altera_Family	family;	/* part type */
36 	Altera_iface	iface;	/* interface type */
37 	size_t		size;	/* bytes of data part can accept */
38 	void *		iface_fns;/* interface function table */
39 	void *		base;	/* base interface address */
40 	int		cookie;	/* implementation specific cookie */
41 } Altera_desc;			/* end, typedef Altera_desc */
42 
43 /* Generic Altera Functions
44  *********************************************************************/
45 extern int altera_load(Altera_desc *desc, const void *image, size_t size);
46 extern int altera_dump(Altera_desc *desc, const void *buf, size_t bsize);
47 extern int altera_info(Altera_desc *desc);
48 
49 /* Board specific implementation specific function types
50  *********************************************************************/
51 typedef int (*Altera_pre_fn)( int cookie );
52 typedef int (*Altera_config_fn)( int assert_config, int flush, int cookie );
53 typedef int (*Altera_status_fn)( int cookie );
54 typedef int (*Altera_done_fn)( int cookie );
55 typedef int (*Altera_clk_fn)( int assert_clk, int flush, int cookie );
56 typedef int (*Altera_data_fn)( int assert_data, int flush, int cookie );
57 typedef int(*Altera_write_fn)(const void *buf, size_t len, int flush, int cookie);
58 typedef int (*Altera_abort_fn)( int cookie );
59 typedef int (*Altera_post_fn)( int cookie );
60 
61 typedef struct {
62 	Altera_pre_fn pre;
63 	Altera_config_fn config;
64 	Altera_status_fn status;
65 	Altera_done_fn done;
66 	Altera_clk_fn clk;
67 	Altera_data_fn data;
68 	Altera_abort_fn abort;
69 	Altera_post_fn post;
70 } altera_board_specific_func;
71 
72 #endif /* _ALTERA_H_ */
73