1c609719bSwdenk /* 2c609719bSwdenk * (C) Copyright 2002 3c609719bSwdenk * Rich Ireland, Enterasys Networks, rireland@enterasys.com. 4c609719bSwdenk * 5c609719bSwdenk * See file CREDITS for list of people who contributed to this 6c609719bSwdenk * project. 7c609719bSwdenk * 8c609719bSwdenk * This program is free software; you can redistribute it and/or 9c609719bSwdenk * modify it under the terms of the GNU General Public License as 10c609719bSwdenk * published by the Free Software Foundation; either version 2 of 11c609719bSwdenk * the License, or (at your option) any later version. 12c609719bSwdenk * 13c609719bSwdenk * This program is distributed in the hope that it will be useful, 14c609719bSwdenk * but WITHOUT ANY WARRANTY; without even the implied warranty of 15c609719bSwdenk * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16c609719bSwdenk * GNU General Public License for more details. 17c609719bSwdenk * 18c609719bSwdenk * You should have received a copy of the GNU General Public License 19c609719bSwdenk * along with this program; if not, write to the Free Software 20c609719bSwdenk * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 21c609719bSwdenk * MA 02111-1307 USA 22c609719bSwdenk * 23c609719bSwdenk */ 24c609719bSwdenk 25c609719bSwdenk #include <fpga.h> 26c609719bSwdenk 27c609719bSwdenk #ifndef _XILINX_H_ 28c609719bSwdenk #define _XILINX_H_ 29c609719bSwdenk 30c609719bSwdenk /* Xilinx Model definitions 31c609719bSwdenk *********************************************************************/ 326d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #define CONFIG_SYS_SPARTAN2 CONFIG_SYS_FPGA_DEV( 0x1 ) 336d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #define CONFIG_SYS_VIRTEX_E CONFIG_SYS_FPGA_DEV( 0x2 ) 346d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #define CONFIG_SYS_VIRTEX2 CONFIG_SYS_FPGA_DEV( 0x4 ) 356d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #define CONFIG_SYS_SPARTAN3 CONFIG_SYS_FPGA_DEV( 0x8 ) 366d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #define CONFIG_SYS_XILINX_SPARTAN2 (CONFIG_SYS_FPGA_XILINX | CONFIG_SYS_SPARTAN2) 376d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #define CONFIG_SYS_XILINX_VIRTEX_E (CONFIG_SYS_FPGA_XILINX | CONFIG_SYS_VIRTEX_E) 386d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #define CONFIG_SYS_XILINX_VIRTEX2 (CONFIG_SYS_FPGA_XILINX | CONFIG_SYS_VIRTEX2) 396d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #define CONFIG_SYS_XILINX_SPARTAN3 (CONFIG_SYS_FPGA_XILINX | CONFIG_SYS_SPARTAN3) 40c609719bSwdenk /* XXX - Add new models here */ 41c609719bSwdenk 42c609719bSwdenk 43c609719bSwdenk /* Xilinx Interface definitions 44c609719bSwdenk *********************************************************************/ 456d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #define CONFIG_SYS_XILINX_IF_SS CONFIG_SYS_FPGA_IF( 0x1 ) /* slave serial */ 466d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #define CONFIG_SYS_XILINX_IF_MS CONFIG_SYS_FPGA_IF( 0x2 ) /* master serial */ 476d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #define CONFIG_SYS_XILINX_IF_SP CONFIG_SYS_FPGA_IF( 0x4 ) /* slave parallel */ 486d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #define CONFIG_SYS_XILINX_IF_JTAG CONFIG_SYS_FPGA_IF( 0x8 ) /* jtag */ 496d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #define CONFIG_SYS_XILINX_IF_MSM CONFIG_SYS_FPGA_IF( 0x10 ) /* master selectmap */ 506d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #define CONFIG_SYS_XILINX_IF_SSM CONFIG_SYS_FPGA_IF( 0x20 ) /* slave selectmap */ 51c609719bSwdenk 52c609719bSwdenk /* Xilinx types 53c609719bSwdenk *********************************************************************/ 54c609719bSwdenk typedef enum { /* typedef Xilinx_iface */ 55c609719bSwdenk min_xilinx_iface_type, /* low range check value */ 56c609719bSwdenk slave_serial, /* serial data and external clock */ 57c609719bSwdenk master_serial, /* serial data w/ internal clock (not used) */ 58c609719bSwdenk slave_parallel, /* parallel data w/ external latch */ 59c609719bSwdenk jtag_mode, /* jtag/tap serial (not used ) */ 60c609719bSwdenk master_selectmap, /* master SelectMap (virtex2) */ 61c609719bSwdenk slave_selectmap, /* slave SelectMap (virtex2) */ 62c609719bSwdenk max_xilinx_iface_type /* insert all new types before this */ 63c609719bSwdenk } Xilinx_iface; /* end, typedef Xilinx_iface */ 64c609719bSwdenk 65c609719bSwdenk typedef enum { /* typedef Xilinx_Family */ 66c609719bSwdenk min_xilinx_type, /* low range check value */ 67c609719bSwdenk Xilinx_Spartan2, /* Spartan-II Family */ 68c609719bSwdenk Xilinx_VirtexE, /* Virtex-E Family */ 69c609719bSwdenk Xilinx_Virtex2, /* Virtex2 Family */ 70875c7893SWolfgang Denk Xilinx_Spartan3, /* Spartan-III Family */ 71c609719bSwdenk max_xilinx_type /* insert all new types before this */ 72c609719bSwdenk } Xilinx_Family; /* end, typedef Xilinx_Family */ 73c609719bSwdenk 74c609719bSwdenk typedef struct { /* typedef Xilinx_desc */ 75c609719bSwdenk Xilinx_Family family; /* part type */ 76c609719bSwdenk Xilinx_iface iface; /* interface type */ 77c609719bSwdenk size_t size; /* bytes of data part can accept */ 78c609719bSwdenk void *iface_fns; /* interface function table */ 79c609719bSwdenk int cookie; /* implementation specific cookie */ 80c609719bSwdenk } Xilinx_desc; /* end, typedef Xilinx_desc */ 81c609719bSwdenk 82c609719bSwdenk /* Generic Xilinx Functions 83c609719bSwdenk *********************************************************************/ 84*e6a857daSWolfgang Denk extern int xilinx_load(Xilinx_desc *desc, const void *image, size_t size); 85*e6a857daSWolfgang Denk extern int xilinx_dump(Xilinx_desc *desc, const void *buf, size_t bsize); 86c609719bSwdenk extern int xilinx_info(Xilinx_desc *desc); 87c609719bSwdenk 88c609719bSwdenk /* Board specific implementation specific function types 89c609719bSwdenk *********************************************************************/ 90c609719bSwdenk typedef int (*Xilinx_pgm_fn)( int assert_pgm, int flush, int cookie ); 91c609719bSwdenk typedef int (*Xilinx_init_fn)( int cookie ); 92c609719bSwdenk typedef int (*Xilinx_err_fn)( int cookie ); 93c609719bSwdenk typedef int (*Xilinx_done_fn)( int cookie ); 94c609719bSwdenk typedef int (*Xilinx_clk_fn)( int assert_clk, int flush, int cookie ); 95c609719bSwdenk typedef int (*Xilinx_cs_fn)( int assert_cs, int flush, int cookie ); 96c609719bSwdenk typedef int (*Xilinx_wr_fn)( int assert_write, int flush, int cookie ); 97c609719bSwdenk typedef int (*Xilinx_rdata_fn)( unsigned char *data, int cookie ); 98c609719bSwdenk typedef int (*Xilinx_wdata_fn)( unsigned char data, int flush, int cookie ); 99c609719bSwdenk typedef int (*Xilinx_busy_fn)( int cookie ); 100c609719bSwdenk typedef int (*Xilinx_abort_fn)( int cookie ); 101c609719bSwdenk typedef int (*Xilinx_pre_fn)( int cookie ); 102c609719bSwdenk typedef int (*Xilinx_post_fn)( int cookie ); 10389083346SWolfgang Wegner typedef int (*Xilinx_bwr_fn)( void *buf, size_t len, int flush, int cookie ); 104c609719bSwdenk 105c609719bSwdenk #endif /* _XILINX_H_ */ 106