fpga.c 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /*
  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. #include <common.h>
  25. #include <asm/arch/mx31.h>
  26. #include <asm/arch/mx31-regs.h>
  27. #include <mxc_gpio.h>
  28. #include <fpga.h>
  29. #include <lattice.h>
  30. #include "qong_fpga.h"
  31. DECLARE_GLOBAL_DATA_PTR;
  32. #if defined(CONFIG_FPGA)
  33. static void qong_jtag_init(void)
  34. {
  35. return;
  36. }
  37. static void qong_fpga_jtag_set_tdi(int value)
  38. {
  39. mxc_gpio_set(QONG_FPGA_TDI_PIN, value);
  40. }
  41. static void qong_fpga_jtag_set_tms(int value)
  42. {
  43. mxc_gpio_set(QONG_FPGA_TMS_PIN, value);
  44. }
  45. static void qong_fpga_jtag_set_tck(int value)
  46. {
  47. mxc_gpio_set(QONG_FPGA_TCK_PIN, value);
  48. }
  49. static int qong_fpga_jtag_get_tdo(void)
  50. {
  51. return mxc_gpio_get(QONG_FPGA_TDO_PIN);
  52. }
  53. lattice_board_specific_func qong_fpga_fns = {
  54. qong_jtag_init,
  55. qong_fpga_jtag_set_tdi,
  56. qong_fpga_jtag_set_tms,
  57. qong_fpga_jtag_set_tck,
  58. qong_fpga_jtag_get_tdo
  59. };
  60. Lattice_desc qong_fpga[CONFIG_FPGA_COUNT] = {
  61. {
  62. Lattice_XP2,
  63. lattice_jtag_mode,
  64. 356519,
  65. (void *) &qong_fpga_fns,
  66. NULL,
  67. 0,
  68. "lfxp2_5e_ftbga256"
  69. },
  70. };
  71. int qong_fpga_init(void)
  72. {
  73. int i;
  74. fpga_init();
  75. for (i = 0; i < CONFIG_FPGA_COUNT; i++) {
  76. fpga_add(fpga_lattice, &qong_fpga[i]);
  77. }
  78. return 0;
  79. }
  80. #endif