sc3.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. /*
  2. * (C) Copyright 2000
  3. * Wolfgang Denk, DENX Software Engineering, wd@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. * hcWriteWord - write a 16 bit value into the USB controller
  25. * @base: base address to access the chip registers
  26. * @value: 16 bit value to write into register @offset
  27. * @offset: register to write the @value into
  28. *
  29. */
  30. static void inline hcWriteWord (unsigned long base, unsigned int value,
  31. unsigned int offset)
  32. {
  33. out_le16 ((volatile u16*)(base + 2), offset | 0x80);
  34. out_le16 ((volatile u16*)base, value);
  35. }
  36. /**
  37. * hcWriteDWord - write a 32 bit value into the USB controller
  38. * @base: base address to access the chip registers
  39. * @value: 32 bit value to write into register @offset
  40. * @offset: register to write the @value into
  41. *
  42. */
  43. static void inline hcWriteDWord (unsigned long base, unsigned long value,
  44. unsigned int offset)
  45. {
  46. out_le16 ((volatile u16*)(base + 2), offset | 0x80);
  47. out_le16 ((volatile u16*)base, value);
  48. out_le16 ((volatile u16*)base, value >> 16);
  49. }
  50. /**
  51. * hcReadWord - read a 16 bit value from the USB controller
  52. * @base: base address to access the chip registers
  53. * @offset: register to read from
  54. *
  55. * Returns the readed register value
  56. */
  57. static unsigned int inline hcReadWord (unsigned long base, unsigned int offset)
  58. {
  59. out_le16 ((volatile u16*)(base + 2), offset);
  60. return (in_le16 ((volatile u16*)base));
  61. }
  62. /**
  63. * hcReadDWord - read a 32 bit value from the USB controller
  64. * @base: base address to access the chip registers
  65. * @offset: register to read from
  66. *
  67. * Returns the readed register value
  68. */
  69. static unsigned long inline hcReadDWord (unsigned long base, unsigned int offset)
  70. {
  71. unsigned long val, val16;
  72. out_le16 ((volatile u16*)(base + 2), offset);
  73. val = in_le16((volatile u16*)base);
  74. val16 = in_le16((volatile u16*)base);
  75. return (val | (val16 << 16));
  76. }
  77. /* control and status registers isp1161 */
  78. #define HcRevision 0x00
  79. #define HcControl 0x01
  80. #define HcCommandStatus 0x02
  81. #define HcInterruptStatus 0x03
  82. #define HcInterruptEnable 0x04
  83. #define HcInterruptDisable 0x05
  84. #define HcFmInterval 0x0D
  85. #define HcFmRemaining 0x0E
  86. #define HcFmNumber 0x0F
  87. #define HcLSThreshold 0x11
  88. #define HcRhDescriptorA 0x12
  89. #define HcRhDescriptorB 0x13
  90. #define HcRhStatus 0x14
  91. #define HcRhPortStatus1 0x15
  92. #define HcRhPortStatus2 0x16
  93. #define HcHardwareConfiguration 0x20
  94. #define HcDMAConfiguration 0x21
  95. #define HcTransferCounter 0x22
  96. #define HcuPInterrupt 0x24
  97. #define HcuPInterruptEnable 0x25
  98. #define HcChipID 0x27
  99. #define HcScratch 0x28
  100. #define HcSoftwareReset 0x29
  101. #define HcITLBufferLength 0x2A
  102. #define HcATLBufferLength 0x2B
  103. #define HcBufferStatus 0x2C
  104. #define HcReadBackITL0Length 0x2D
  105. #define HcReadBackITL1Length 0x2E
  106. #define HcITLBufferPort 0x40
  107. #define HcATLBufferPort 0x41