]> git.ipfire.org Git - people/ms/u-boot.git/blame - board/linkstation/hwctl.c
rename CFG_ macros to CONFIG_SYS
[people/ms/u-boot.git] / board / linkstation / hwctl.c
CommitLineData
61525f2f
GL
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
17#include <config.h>
18#include <common.h>
19#include <command.h>
20#include <asm/io.h>
21
22#define mdelay(n) udelay((n)*1000)
23
6d0f6bcf 24#define AVR_PORT CONFIG_SYS_NS16550_COM2
61525f2f
GL
25
26/* 2005.5.10 BUFFALO add */
27/*--------------------------------------------------------------*/
28static inline void miconCntl_SendUart(unsigned char dat)
29{
db9084de 30 out_8((unsigned char *)AVR_PORT, dat);
61525f2f
GL
31 mdelay(1);
32}
33
34/*--------------------------------------------------------------*/
35void miconCntl_SendCmd(unsigned char dat)
36{
37 int i;
38
39 for (i=0; i<4; i++){
40 miconCntl_SendUart(dat);
41 }
42}
43
44/*--------------------------------------------------------------*/
45void miconCntl_FanLow(void)
46{
47#ifdef CONFIG_HTGL
48 miconCntl_SendCmd(0x5C);
49#endif
50}
51
52/*--------------------------------------------------------------*/
53void miconCntl_FanHigh(void)
54{
55#ifdef CONFIG_HTGL
56 miconCntl_SendCmd(0x5D);
57#endif
58}
59
60/*--------------------------------------------------------------*/
61/* 1000Mbps */
62void miconCntl_Eth1000M(int up)
63{
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
75}
76
77/*--------------------------------------------------------------*/
78/* 100Mbps */
79void miconCntl_Eth100M(int up)
80{
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
90}
91
92/*--------------------------------------------------------------*/
93/* 10Mbps */
94void miconCntl_Eth10M(int up)
95{
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
105}
106
107/*--------------------------------------------------------------*/
108/* */
109void miconCntl_5f(void)
110{
111 miconCntl_SendCmd(0x5F);
112 mdelay(100);
113}
114
115/*--------------------------------------------------------------*/
116/* "reboot start" signal */
117void miconCntl_Reboot(void)
118{
119 miconCntl_SendCmd(0x43);
120}
121
122/*--------------------------------------------------------------*/
123/* Disable watchdog timer */
124void miconCntl_DisWDT(void)
125{
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 */
135}