blob: f865eb422563142a71a692bf83e301d0a69789ee [file] [log] [blame]
Stefano Babicfbb1f582010-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>
26#include <asm/arch/mx31.h>
27#include <asm/arch/mx31-regs.h>
28#include <mxc_gpio.h>
29#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{
44 mxc_gpio_set(QONG_FPGA_TDI_PIN, value);
45}
46
47static void qong_fpga_jtag_set_tms(int value)
48{
49 mxc_gpio_set(QONG_FPGA_TMS_PIN, value);
50}
51
52static void qong_fpga_jtag_set_tck(int value)
53{
54 mxc_gpio_set(QONG_FPGA_TCK_PIN, value);
55}
56
57static int qong_fpga_jtag_get_tdo(void)
58{
59 return mxc_gpio_get(QONG_FPGA_TDO_PIN);
60}
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
95