hwctl.c 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. /*
  2. * hwctl.c
  3. *
  4. * LinkStation HW Control Driver
  5. *
  6. * Copyright (C) 2001-2004 BUFFALO INC.
  7. *
  8. * This software may be used and distributed according to the terms of
  9. * the GNU General Public License (GPL), incorporated herein by reference.
  10. * Drivers based on or derived from this code fall under the GPL and must
  11. * retain the authorship, copyright and license notice. This file is not
  12. * a complete program and may only be used when the entire operating
  13. * system is licensed under the GPL.
  14. *
  15. */
  16. #include <config.h>
  17. #include <common.h>
  18. #include <command.h>
  19. #include <asm/io.h>
  20. #define AVR_PORT CONFIG_SYS_NS16550_COM2
  21. /* 2005.5.10 BUFFALO add */
  22. /*--------------------------------------------------------------*/
  23. static inline void miconCntl_SendUart(unsigned char dat)
  24. {
  25. out_8((unsigned char *)AVR_PORT, dat);
  26. mdelay(1);
  27. }
  28. /*--------------------------------------------------------------*/
  29. void miconCntl_SendCmd(unsigned char dat)
  30. {
  31. int i;
  32. for (i=0; i<4; i++){
  33. miconCntl_SendUart(dat);
  34. }
  35. }
  36. /*--------------------------------------------------------------*/
  37. void miconCntl_FanLow(void)
  38. {
  39. #ifdef CONFIG_HTGL
  40. miconCntl_SendCmd(0x5C);
  41. #endif
  42. }
  43. /*--------------------------------------------------------------*/
  44. void miconCntl_FanHigh(void)
  45. {
  46. #ifdef CONFIG_HTGL
  47. miconCntl_SendCmd(0x5D);
  48. #endif
  49. }
  50. /*--------------------------------------------------------------*/
  51. /* 1000Mbps */
  52. void miconCntl_Eth1000M(int up)
  53. {
  54. #ifdef CONFIG_HTGL
  55. if (up)
  56. miconCntl_SendCmd(0x93);
  57. else
  58. miconCntl_SendCmd(0x92);
  59. #else
  60. if (up)
  61. miconCntl_SendCmd(0x5D);
  62. else
  63. miconCntl_SendCmd(0x5C);
  64. #endif
  65. }
  66. /*--------------------------------------------------------------*/
  67. /* 100Mbps */
  68. void miconCntl_Eth100M(int up)
  69. {
  70. #ifdef CONFIG_HTGL
  71. if (up)
  72. miconCntl_SendCmd(0x91);
  73. else
  74. miconCntl_SendCmd(0x90);
  75. #else
  76. if (up)
  77. miconCntl_SendCmd(0x5C);
  78. #endif
  79. }
  80. /*--------------------------------------------------------------*/
  81. /* 10Mbps */
  82. void miconCntl_Eth10M(int up)
  83. {
  84. #ifdef CONFIG_HTGL
  85. if (up)
  86. miconCntl_SendCmd(0x8F);
  87. else
  88. miconCntl_SendCmd(0x8E);
  89. #else
  90. if (up)
  91. miconCntl_SendCmd(0x5C);
  92. #endif
  93. }
  94. /*--------------------------------------------------------------*/
  95. /* */
  96. void miconCntl_5f(void)
  97. {
  98. miconCntl_SendCmd(0x5F);
  99. mdelay(100);
  100. }
  101. /*--------------------------------------------------------------*/
  102. /* "reboot start" signal */
  103. void miconCntl_Reboot(void)
  104. {
  105. miconCntl_SendCmd(0x43);
  106. }
  107. /*--------------------------------------------------------------*/
  108. /* Disable watchdog timer */
  109. void miconCntl_DisWDT(void)
  110. {
  111. miconCntl_SendCmd(0x41); /* A */
  112. miconCntl_SendCmd(0x46); /* F */
  113. miconCntl_SendCmd(0x4A); /* J */
  114. miconCntl_SendCmd(0x3E); /* > */
  115. miconCntl_SendCmd(0x56); /* V */
  116. miconCntl_SendCmd(0x3E); /* > */
  117. miconCntl_SendCmd(0x5A); /* Z */
  118. miconCntl_SendCmd(0x56); /* V */
  119. miconCntl_SendCmd(0x4B); /* K */
  120. }