blob: 6536a0b6952a2b3532d8e4fea7f8e7d0c5b0e59f [file] [log] [blame]
Stefano Babicb9eb3fd2010-06-29 11:48:24 +02001/*
2 * (C) Copyright 2010
3 * Stefano Babic, DENX Software Engineering, sbabic@denx.de
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 <common.h>
Stefano Babic86271112011-03-14 15:43:56 +010026#include <asm/arch/clock.h>
27#include <asm/arch/imx-regs.h>
Stefano Babic9400f592011-08-21 10:52:58 +020028#include <asm/gpio.h>
Stefano Babicb9eb3fd2010-06-29 11:48:24 +020029#include <fpga.h>
30#include <lattice.h>
31#include "qong_fpga.h"
32
33DECLARE_GLOBAL_DATA_PTR;
34
35#if defined(CONFIG_FPGA)
36
37static void qong_jtag_init(void)
38{
39 return;
40}
41
42static void qong_fpga_jtag_set_tdi(int value)
43{
Stefano Babic9400f592011-08-21 10:52:58 +020044 gpio_set_value(QONG_FPGA_TDI_PIN, value);
Stefano Babicb9eb3fd2010-06-29 11:48:24 +020045}
46
47static void qong_fpga_jtag_set_tms(int value)
48{
Stefano Babic9400f592011-08-21 10:52:58 +020049 gpio_set_value(QONG_FPGA_TMS_PIN, value);
Stefano Babicb9eb3fd2010-06-29 11:48:24 +020050}
51
52static void qong_fpga_jtag_set_tck(int value)
53{
Stefano Babic9400f592011-08-21 10:52:58 +020054 gpio_set_value(QONG_FPGA_TCK_PIN, value);
Stefano Babicb9eb3fd2010-06-29 11:48:24 +020055}
56
57static int qong_fpga_jtag_get_tdo(void)
58{
Stefano Babic9400f592011-08-21 10:52:58 +020059 return gpio_get_value(QONG_FPGA_TDO_PIN);
Stefano Babicb9eb3fd2010-06-29 11:48:24 +020060}
61
62lattice_board_specific_func qong_fpga_fns = {
63 qong_jtag_init,
64 qong_fpga_jtag_set_tdi,
65 qong_fpga_jtag_set_tms,
66 qong_fpga_jtag_set_tck,
67 qong_fpga_jtag_get_tdo
68};
69
70Lattice_desc qong_fpga[CONFIG_FPGA_COUNT] = {
71 {
72 Lattice_XP2,
73 lattice_jtag_mode,
74 356519,
75 (void *) &qong_fpga_fns,
76 NULL,
77 0,
78 "lfxp2_5e_ftbga256"
79 },
80};
81
82int qong_fpga_init(void)
83{
84 int i;
85
86 fpga_init();
87
88 for (i = 0; i < CONFIG_FPGA_COUNT; i++) {
89 fpga_add(fpga_lattice, &qong_fpga[i]);
90 }
91 return 0;
92}
93
94#endif