h2_p2_dbg_board.h 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. /*
  2. *
  3. * BRIEF MODULE DESCRIPTION
  4. * TI H2 and P2 Debug Board hardware map
  5. *
  6. * Copyright (C) 2004 MPC-Data Limited. (http://www.mpc-data.co.uk)
  7. * Author: MPC-Data Limited
  8. * Dave Peverley
  9. *
  10. * This program is free software; you can redistribute it and/or modify it
  11. * under the terms of the GNU General Public License as published by the
  12. * Free Software Foundation; either version 2 of the License, or (at your
  13. * option) any later version.
  14. *
  15. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
  16. * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  17. * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
  18. * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  19. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  20. * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  21. * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
  22. * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  23. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  24. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  25. *
  26. * You should have received a copy of the GNU General Public License along
  27. * with this program; if not, write to the Free Software Foundation, Inc.,
  28. * 675 Mass Ave, Cambridge, MA 02139, USA.
  29. */
  30. #ifndef __INCLUDED_H2_P2_DBH_BOARD_H
  31. #define __INCLUDED_H2_P2_DBH_BOARD_H
  32. #include <asm/arch/sizes.h>
  33. /*
  34. * The Debug board is designed to function with the P2 Sample, H2
  35. * Sample and 1610 Innovator boards. The main difference AFAICT is
  36. * the chip selects used with each system ;
  37. *
  38. * P2 Sample : CS1 of OMAP730 is used to select the CPLD & LAN regs
  39. * H2 Sample : CS1a is used to select the CPLD registers.
  40. *
  41. */
  42. /***************************************************************************
  43. * CPLD Registers
  44. **************************************************************************/
  45. #define H2DBG_CPLD_REVISION 0x04000010
  46. #define H2DBG_BOARD_REVISION 0x04000012
  47. #define H2DBG_GPIO_REGISTER 0x04000014
  48. #define H2DBG_LED_CONTROL 0x04000016
  49. #define H2DBG_MISC_INPUT 0x04000018
  50. #define H2DBG_LAN_STATUS 0x0400001A
  51. #define H2DBG_LAN_RESET 0x0400001C
  52. #define H2DBG_ETH_REG_BASE 0x04000300
  53. /***************************************************************************
  54. * Ethernet Control Registers
  55. * These are for the LAN91C96 on the debug board
  56. **************************************************************************/
  57. /* Bank 0 in IO space */
  58. #define ETH_TCR (H2DBG_ETH_REG_BASE + 0x00) /* Transmit Control Register */
  59. #define ETH_EPH_STATUS (H2DBG_ETH_REG_BASE + 0x02) /* EPH Status Register */
  60. #define ETH_RCR (H2DBG_ETH_REG_BASE + 0x04) /* Receive Control Register */
  61. #define ETH_COUNTER (H2DBG_ETH_REG_BASE + 0x06) /* Counter Register */
  62. #define ETH_MIR (H2DBG_ETH_REG_BASE + 0x08) /* Memory Information Register */
  63. #define ETH_MCR (H2DBG_ETH_REG_BASE + 0x0A) /* Memory Configuration Register */
  64. /* Bank 1 in IO space */
  65. #define ETH_CONFIG (H2DBG_ETH_REG_BASE + 0x00) /* Configuration Register */
  66. #define ETH_BASE (H2DBG_ETH_REG_BASE + 0x02) /* Base Address Register */
  67. #define ETH_IA0 (H2DBG_ETH_REG_BASE + 0x04) /* Individual Address Register - 0 */
  68. #define ETH_IA1 (H2DBG_ETH_REG_BASE + 0x05) /* Individual Address Register - 1 */
  69. #define ETH_IA2 (H2DBG_ETH_REG_BASE + 0x06) /* Individual Address Register - 2 */
  70. #define ETH_IA3 (H2DBG_ETH_REG_BASE + 0x07) /* Individual Address Register - 3 */
  71. #define ETH_IA4 (H2DBG_ETH_REG_BASE + 0x08) /* Individual Address Register - 4 */
  72. #define ETH_IA5 (H2DBG_ETH_REG_BASE + 0x09) /* Individual Address Register - 5 */
  73. #define ETH_GEN_PURPOSE (H2DBG_ETH_REG_BASE + 0x0A) /* General Address Registers */
  74. #define ETH_CONTROL (H2DBG_ETH_REG_BASE + 0x0B) /* Control Register */
  75. /* Bank 2 in IO space */
  76. #define ETH_MMU (H2DBG_ETH_REG_BASE + 0x00) /* MMU Command Register */
  77. #define ETH_AUTO_TX_START (H2DBG_ETH_REG_BASE + 0x01) /* Auto Tx Start Register */
  78. #define ETH_PNR (H2DBG_ETH_REG_BASE + 0x02) /* Packet Number Register */
  79. #define ETH_ARR (H2DBG_ETH_REG_BASE + 0x03) /* Allocation Result Register */
  80. #define ETH_FIFO (H2DBG_ETH_REG_BASE + 0x04) /* FIFO Ports Register */
  81. #define ETH_POINTER (H2DBG_ETH_REG_BASE + 0x06) /* Pointer Register */
  82. #define ETH_DATA_HIGH (H2DBG_ETH_REG_BASE + 0x08) /* Data High Register */
  83. #define ETH_DATA_LOW (H2DBG_ETH_REG_BASE + 0x0A) /* Data Low Register */
  84. #define ETH_INT_STATS (H2DBG_ETH_REG_BASE + 0x0C) /* Interrupt Status Register - RO */
  85. #define ETH_INT_ACK (H2DBG_ETH_REG_BASE + 0x0C) /* Interrupt Acknowledge Register -WO */
  86. #define ETH_INT_MASK (H2DBG_ETH_REG_BASE + 0x0D) /* Interrupt Mask Register */
  87. #ifndef __ASSEMBLY__
  88. /*
  89. * A couple of utility inlines to aid debugging using the LED's on the
  90. * debug board.
  91. */
  92. static inline void set_led_state(int state)
  93. {
  94. static unsigned long hw_led_state = 0;
  95. volatile unsigned short *led_address = (volatile unsigned short *)0x04000016;
  96. hw_led_state = ((unsigned long)state);
  97. *((unsigned short *) (led_address)) = (unsigned short) (~hw_led_state & 0xFFFF);
  98. }
  99. static inline void spin_up_leds(void)
  100. {
  101. volatile int i, j, k;
  102. for (k = 0; k < 2; k++) {
  103. for (i = 0; i < 16; i++) {
  104. for (j = 0; j < 5000; j++) {
  105. set_led_state(1 << i);
  106. }
  107. }
  108. for (i = 15; i >= 0; i--) {
  109. for (j = 0; j < 5000; j++) {
  110. set_led_state(1 << i);
  111. }
  112. }
  113. }
  114. }
  115. #endif /* ! __ASSEMBLY__ */
  116. #endif /* ! __INCLUDED_H2_P2_DBH_BOARD_H */