blob: 2eaad1e976f8114da52f354f93517fa5d11fc76a [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 *
Wolfgang Denk1a459662013-07-08 09:37:19 +02005 * SPDX-License-Identifier: GPL-2.0+
Stefano Babicb9eb3fd2010-06-29 11:48:24 +02006 */
7
8#include <common.h>
Stefano Babic86271112011-03-14 15:43:56 +01009#include <asm/arch/clock.h>
10#include <asm/arch/imx-regs.h>
Stefano Babic9400f592011-08-21 10:52:58 +020011#include <asm/gpio.h>
Stefano Babicb9eb3fd2010-06-29 11:48:24 +020012#include <fpga.h>
13#include <lattice.h>
14#include "qong_fpga.h"
15
16DECLARE_GLOBAL_DATA_PTR;
17
18#if defined(CONFIG_FPGA)
19
20static void qong_jtag_init(void)
21{
22 return;
23}
24
25static void qong_fpga_jtag_set_tdi(int value)
26{
Stefano Babic9400f592011-08-21 10:52:58 +020027 gpio_set_value(QONG_FPGA_TDI_PIN, value);
Stefano Babicb9eb3fd2010-06-29 11:48:24 +020028}
29
30static void qong_fpga_jtag_set_tms(int value)
31{
Stefano Babic9400f592011-08-21 10:52:58 +020032 gpio_set_value(QONG_FPGA_TMS_PIN, value);
Stefano Babicb9eb3fd2010-06-29 11:48:24 +020033}
34
35static void qong_fpga_jtag_set_tck(int value)
36{
Stefano Babic9400f592011-08-21 10:52:58 +020037 gpio_set_value(QONG_FPGA_TCK_PIN, value);
Stefano Babicb9eb3fd2010-06-29 11:48:24 +020038}
39
40static int qong_fpga_jtag_get_tdo(void)
41{
Stefano Babic9400f592011-08-21 10:52:58 +020042 return gpio_get_value(QONG_FPGA_TDO_PIN);
Stefano Babicb9eb3fd2010-06-29 11:48:24 +020043}
44
45lattice_board_specific_func qong_fpga_fns = {
46 qong_jtag_init,
47 qong_fpga_jtag_set_tdi,
48 qong_fpga_jtag_set_tms,
49 qong_fpga_jtag_set_tck,
50 qong_fpga_jtag_get_tdo
51};
52
53Lattice_desc qong_fpga[CONFIG_FPGA_COUNT] = {
54 {
55 Lattice_XP2,
56 lattice_jtag_mode,
57 356519,
58 (void *) &qong_fpga_fns,
59 NULL,
60 0,
61 "lfxp2_5e_ftbga256"
62 },
63};
64
65int qong_fpga_init(void)
66{
67 int i;
68
69 fpga_init();
70
71 for (i = 0; i < CONFIG_FPGA_COUNT; i++) {
72 fpga_add(fpga_lattice, &qong_fpga[i]);
73 }
74 return 0;
75}
76
77#endif