blob: 7a2bece03215604e65564e2ca3185c9a48824272 [file] [log] [blame]
wdenkc6097192002-11-03 00:24:07 +00001/*
2 * (C) Copyright 2002
3 * Rich Ireland, Enterasys Networks, rireland@enterasys.com.
4 *
5 * See file CREDITS for list of people who contributed to this
6 * project.
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21 * MA 02111-1307 USA
22 *
23 */
24
25#include <fpga.h>
26
27#ifndef _ALTERA_H_
28#define _ALTERA_H_
29
wdenk9b7f3842003-10-09 20:09:04 +000030/* Altera Model definitions
31 *********************************************************************/
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +020032#define CONFIG_SYS_ACEX1K CONFIG_SYS_FPGA_DEV( 0x1 )
33#define CONFIG_SYS_CYCLON2 CONFIG_SYS_FPGA_DEV( 0x2 )
34#define CONFIG_SYS_STRATIX_II CONFIG_SYS_FPGA_DEV( 0x4 )
wdenkc6097192002-11-03 00:24:07 +000035
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +020036#define CONFIG_SYS_ALTERA_ACEX1K (CONFIG_SYS_FPGA_ALTERA | CONFIG_SYS_ACEX1K)
37#define CONFIG_SYS_ALTERA_CYCLON2 (CONFIG_SYS_FPGA_ALTERA | CONFIG_SYS_CYCLON2)
38#define CONFIG_SYS_ALTERA_STRATIX_II (CONFIG_SYS_FPGA_ALTERA | CONFIG_SYS_STRATIX_II)
wdenkc6097192002-11-03 00:24:07 +000039/* Add new models here */
40
wdenk9b7f3842003-10-09 20:09:04 +000041/* Altera Interface definitions
42 *********************************************************************/
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +020043#define CONFIG_SYS_ALTERA_IF_PS CONFIG_SYS_FPGA_IF( 0x1 ) /* passive serial */
44#define CONFIG_SYS_ALTERA_IF_FPP CONFIG_SYS_FPGA_IF( 0x2 ) /* fast passive parallel */
wdenkc6097192002-11-03 00:24:07 +000045/* Add new interfaces here */
46
wdenk9b7f3842003-10-09 20:09:04 +000047typedef enum { /* typedef Altera_iface */
48 min_altera_iface_type, /* insert all new types after this */
49 passive_serial, /* serial data and external clock */
50 passive_parallel_synchronous, /* parallel data */
51 passive_parallel_asynchronous, /* parallel data */
52 passive_serial_asynchronous, /* serial data w/ internal clock (not used) */
53 altera_jtag_mode, /* jtag/tap serial (not used ) */
Michael Jones9c5ef8d2011-07-14 22:09:28 +000054 fast_passive_parallel, /* fast passive parallel (FPP) */
eran liberty4c373a92008-03-27 00:50:49 +010055 fast_passive_parallel_security, /* fast passive parallel with security (FPPS) */
wdenk9b7f3842003-10-09 20:09:04 +000056 max_altera_iface_type /* insert all new types before this */
57} Altera_iface; /* end, typedef Altera_iface */
wdenkc6097192002-11-03 00:24:07 +000058
wdenk9b7f3842003-10-09 20:09:04 +000059typedef enum { /* typedef Altera_Family */
Michael Jones9c5ef8d2011-07-14 22:09:28 +000060 min_altera_type, /* insert all new types after this */
61 Altera_ACEX1K, /* ACEX1K Family */
62 Altera_CYC2, /* CYCLONII Family */
eran liberty4c373a92008-03-27 00:50:49 +010063 Altera_StratixII, /* StratixII Familiy */
wdenkc6097192002-11-03 00:24:07 +000064/* Add new models here */
Michael Jones9c5ef8d2011-07-14 22:09:28 +000065 max_altera_type /* insert all new types before this */
wdenk9b7f3842003-10-09 20:09:04 +000066} Altera_Family; /* end, typedef Altera_Family */
wdenkc6097192002-11-03 00:24:07 +000067
wdenk9b7f3842003-10-09 20:09:04 +000068typedef struct { /* typedef Altera_desc */
69 Altera_Family family; /* part type */
70 Altera_iface iface; /* interface type */
71 size_t size; /* bytes of data part can accept */
72 void * iface_fns;/* interface function table */
73 void * base; /* base interface address */
74 int cookie; /* implementation specific cookie */
75} Altera_desc; /* end, typedef Altera_desc */
wdenkc6097192002-11-03 00:24:07 +000076
wdenk9b7f3842003-10-09 20:09:04 +000077/* Generic Altera Functions
78 *********************************************************************/
Wolfgang Denk74f9b382011-07-30 13:33:49 +000079extern int altera_load(Altera_desc *desc, const void *image, size_t size);
80extern int altera_dump(Altera_desc *desc, const void *buf, size_t bsize);
81extern int altera_info(Altera_desc *desc);
wdenk9b7f3842003-10-09 20:09:04 +000082
83/* Board specific implementation specific function types
84 *********************************************************************/
85typedef int (*Altera_pre_fn)( int cookie );
86typedef int (*Altera_config_fn)( int assert_config, int flush, int cookie );
87typedef int (*Altera_status_fn)( int cookie );
88typedef int (*Altera_done_fn)( int cookie );
89typedef int (*Altera_clk_fn)( int assert_clk, int flush, int cookie );
90typedef int (*Altera_data_fn)( int assert_data, int flush, int cookie );
Wolfgang Denk74f9b382011-07-30 13:33:49 +000091typedef int(*Altera_write_fn)(const void *buf, size_t len, int flush, int cookie);
wdenk9b7f3842003-10-09 20:09:04 +000092typedef int (*Altera_abort_fn)( int cookie );
93typedef int (*Altera_post_fn)( int cookie );
wdenkc6097192002-11-03 00:24:07 +000094
eran liberty4c373a92008-03-27 00:50:49 +010095typedef struct {
96 Altera_pre_fn pre;
97 Altera_config_fn config;
98 Altera_status_fn status;
99 Altera_done_fn done;
100 Altera_clk_fn clk;
101 Altera_data_fn data;
102 Altera_abort_fn abort;
103 Altera_post_fn post;
104} altera_board_specific_func;
105
wdenk9b7f3842003-10-09 20:09:04 +0000106#endif /* _ALTERA_H_ */