net: merge bugfix: Marvell Kirkwood gigabit ethernet driver
[u-boot-kw.git] / board / linkstation / hwctl.c
blob9fd56ae23459aa70a1cf3a6e48395b1ef1a45bfb
1 /*
2 * hwctl.c
4 * LinkStation HW Control Driver
6 * Copyright (C) 2001-2004 BUFFALO INC.
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.
17 #include <config.h>
18 #include <common.h>
19 #include <command.h>
20 #include <asm/io.h>
22 #define mdelay(n) udelay((n)*1000)
24 #define AVR_PORT CONFIG_SYS_NS16550_COM2
26 /* 2005.5.10 BUFFALO add */
27 /*--------------------------------------------------------------*/
28 static inline void miconCntl_SendUart(unsigned char dat)
30 out_8((unsigned char *)AVR_PORT, dat);
31 mdelay(1);
34 /*--------------------------------------------------------------*/
35 void miconCntl_SendCmd(unsigned char dat)
37 int i;
39 for (i=0; i<4; i++){
40 miconCntl_SendUart(dat);
44 /*--------------------------------------------------------------*/
45 void miconCntl_FanLow(void)
47 #ifdef CONFIG_HTGL
48 miconCntl_SendCmd(0x5C);
49 #endif
52 /*--------------------------------------------------------------*/
53 void miconCntl_FanHigh(void)
55 #ifdef CONFIG_HTGL
56 miconCntl_SendCmd(0x5D);
57 #endif
60 /*--------------------------------------------------------------*/
61 /* 1000Mbps */
62 void miconCntl_Eth1000M(int up)
64 #ifdef CONFIG_HTGL
65 if (up)
66 miconCntl_SendCmd(0x93);
67 else
68 miconCntl_SendCmd(0x92);
69 #else
70 if (up)
71 miconCntl_SendCmd(0x5D);
72 else
73 miconCntl_SendCmd(0x5C);
74 #endif
77 /*--------------------------------------------------------------*/
78 /* 100Mbps */
79 void miconCntl_Eth100M(int up)
81 #ifdef CONFIG_HTGL
82 if (up)
83 miconCntl_SendCmd(0x91);
84 else
85 miconCntl_SendCmd(0x90);
86 #else
87 if (up)
88 miconCntl_SendCmd(0x5C);
89 #endif
92 /*--------------------------------------------------------------*/
93 /* 10Mbps */
94 void miconCntl_Eth10M(int up)
96 #ifdef CONFIG_HTGL
97 if (up)
98 miconCntl_SendCmd(0x8F);
99 else
100 miconCntl_SendCmd(0x8E);
101 #else
102 if (up)
103 miconCntl_SendCmd(0x5C);
104 #endif
107 /*--------------------------------------------------------------*/
108 /* */
109 void miconCntl_5f(void)
111 miconCntl_SendCmd(0x5F);
112 mdelay(100);
115 /*--------------------------------------------------------------*/
116 /* "reboot start" signal */
117 void miconCntl_Reboot(void)
119 miconCntl_SendCmd(0x43);
122 /*--------------------------------------------------------------*/
123 /* Disable watchdog timer */
124 void miconCntl_DisWDT(void)
126 miconCntl_SendCmd(0x41); /* A */
127 miconCntl_SendCmd(0x46); /* F */
128 miconCntl_SendCmd(0x4A); /* J */
129 miconCntl_SendCmd(0x3E); /* > */
130 miconCntl_SendCmd(0x56); /* V */
131 miconCntl_SendCmd(0x3E); /* > */
132 miconCntl_SendCmd(0x5A); /* Z */
133 miconCntl_SendCmd(0x56); /* V */
134 miconCntl_SendCmd(0x4B); /* K */