wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2002 |
| 3 | * Rich Ireland, Enterasys Networks, rireland@enterasys.com. |
| 4 | * |
Wolfgang Denk | 1a45966 | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 5 | * SPDX-License-Identifier: GPL-2.0+ |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | #include <fpga.h> |
| 9 | |
| 10 | #ifndef _ALTERA_H_ |
| 11 | #define _ALTERA_H_ |
| 12 | |
Marek Vasut | d44ef7f | 2014-09-16 20:48:33 +0200 | [diff] [blame] | 13 | enum altera_iface { |
| 14 | /* insert all new types after this */ |
| 15 | min_altera_iface_type, |
| 16 | /* serial data and external clock */ |
| 17 | passive_serial, |
| 18 | /* parallel data */ |
| 19 | passive_parallel_synchronous, |
| 20 | /* parallel data */ |
| 21 | passive_parallel_asynchronous, |
| 22 | /* serial data w/ internal clock (not used) */ |
| 23 | passive_serial_asynchronous, |
| 24 | /* jtag/tap serial (not used ) */ |
| 25 | altera_jtag_mode, |
| 26 | /* fast passive parallel (FPP) */ |
| 27 | fast_passive_parallel, |
| 28 | /* fast passive parallel with security (FPPS) */ |
| 29 | fast_passive_parallel_security, |
| 30 | /* insert all new types before this */ |
| 31 | max_altera_iface_type, |
| 32 | }; |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 33 | |
Marek Vasut | d44ef7f | 2014-09-16 20:48:33 +0200 | [diff] [blame] | 34 | enum altera_family { |
| 35 | /* insert all new types after this */ |
| 36 | min_altera_type, |
| 37 | /* ACEX1K Family */ |
| 38 | Altera_ACEX1K, |
| 39 | /* CYCLONII Family */ |
| 40 | Altera_CYC2, |
| 41 | /* StratixII Family */ |
| 42 | Altera_StratixII, |
Pavel Machek | 230fe9b | 2014-09-08 14:08:45 +0200 | [diff] [blame^] | 43 | /* SoCFPGA Family */ |
| 44 | Altera_SoCFPGA, |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 45 | |
Marek Vasut | d44ef7f | 2014-09-16 20:48:33 +0200 | [diff] [blame] | 46 | /* Add new models here */ |
| 47 | |
| 48 | /* insert all new types before this */ |
| 49 | max_altera_type, |
| 50 | }; |
| 51 | |
| 52 | typedef struct { |
| 53 | /* part type */ |
| 54 | enum altera_family family; |
| 55 | /* interface type */ |
| 56 | enum altera_iface iface; |
| 57 | /* bytes of data part can accept */ |
| 58 | size_t size; |
| 59 | /* interface function table */ |
| 60 | void *iface_fns; |
| 61 | /* base interface address */ |
| 62 | void *base; |
| 63 | /* implementation specific cookie */ |
| 64 | int cookie; |
| 65 | } Altera_desc; |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 66 | |
wdenk | 5da627a | 2003-10-09 20:09:04 +0000 | [diff] [blame] | 67 | /* Generic Altera Functions |
| 68 | *********************************************************************/ |
Wolfgang Denk | e6a857d | 2011-07-30 13:33:49 +0000 | [diff] [blame] | 69 | extern int altera_load(Altera_desc *desc, const void *image, size_t size); |
| 70 | extern int altera_dump(Altera_desc *desc, const void *buf, size_t bsize); |
| 71 | extern int altera_info(Altera_desc *desc); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 72 | |
wdenk | 5da627a | 2003-10-09 20:09:04 +0000 | [diff] [blame] | 73 | /* Board specific implementation specific function types |
| 74 | *********************************************************************/ |
| 75 | typedef int (*Altera_pre_fn)( int cookie ); |
| 76 | typedef int (*Altera_config_fn)( int assert_config, int flush, int cookie ); |
| 77 | typedef int (*Altera_status_fn)( int cookie ); |
| 78 | typedef int (*Altera_done_fn)( int cookie ); |
| 79 | typedef int (*Altera_clk_fn)( int assert_clk, int flush, int cookie ); |
| 80 | typedef int (*Altera_data_fn)( int assert_data, int flush, int cookie ); |
Wolfgang Denk | e6a857d | 2011-07-30 13:33:49 +0000 | [diff] [blame] | 81 | typedef int(*Altera_write_fn)(const void *buf, size_t len, int flush, int cookie); |
wdenk | 5da627a | 2003-10-09 20:09:04 +0000 | [diff] [blame] | 82 | typedef int (*Altera_abort_fn)( int cookie ); |
| 83 | typedef int (*Altera_post_fn)( int cookie ); |
| 84 | |
eran liberty | 3c735e7 | 2008-03-27 00:50:49 +0100 | [diff] [blame] | 85 | typedef struct { |
| 86 | Altera_pre_fn pre; |
| 87 | Altera_config_fn config; |
| 88 | Altera_status_fn status; |
| 89 | Altera_done_fn done; |
| 90 | Altera_clk_fn clk; |
| 91 | Altera_data_fn data; |
| 92 | Altera_abort_fn abort; |
| 93 | Altera_post_fn post; |
| 94 | } altera_board_specific_func; |
| 95 | |
Pavel Machek | 230fe9b | 2014-09-08 14:08:45 +0200 | [diff] [blame^] | 96 | #ifdef CONFIG_FPGA_SOCFPGA |
| 97 | int socfpga_load(Altera_desc *desc, const void *rbf_data, size_t rbf_size); |
| 98 | #endif |
| 99 | |
wdenk | 5da627a | 2003-10-09 20:09:04 +0000 | [diff] [blame] | 100 | #endif /* _ALTERA_H_ */ |