sc3.h 2.7 KB

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