5 #include <linux/kernel.h>
13 #include <asm/segment.h>
18 # define DBG_DEVS(args) printk args
20 # define DBG_DEVS(args)
32 #define CONFIG_ON_KEY 0x55
33 #define CONFIG_OFF_KEY 0xaa
47 #define CONFIG_CONTROL 0x02
48 #define INDEX_ADDRESS 0x03
49 #define LOGICAL_DEVICE_NUMBER 0x07
50 #define DEVICE_ID 0x20
51 #define DEVICE_REV 0x21
52 #define POWER_CONTROL 0x22
53 #define POWER_MGMT 0x23
59 #define INTERRUPT_SEL 0x70
60 #define INTERRUPT_SEL_2 0x72
61 #define DMA_CHANNEL_SEL 0x74
63 #define FDD_MODE_REGISTER 0x90
64 #define FDD_OPTION_REGISTER 0x91
67 #define VALID_DEVICE_ID 2
70 #define KYBD_INTERRUPT 1
71 #define MOUS_INTERRUPT 12
72 #define COM2_BASE 0x2f8
73 #define COM2_INTERRUPT 3
74 #define COM1_BASE 0x3f8
75 #define COM1_INTERRUPT 4
76 #define PARP_BASE 0x3bc
77 #define PARP_INTERRUPT 7
79 static unsigned long __init SMCConfigState(
unsigned long baseAddr)
83 unsigned long configPort;
84 unsigned long indexPort;
85 unsigned long dataPort;
89 configPort = indexPort = baseAddr;
90 dataPort = configPort + 1;
99 devId =
inb(dataPort);
108 return (i != NUM_RETRIES) ? baseAddr : 0
L;
111 static void __init SMCRunState(
unsigned long baseAddr)
116 static unsigned long __init SMCDetectUltraIO(
void)
118 unsigned long baseAddr;
121 if ( ( baseAddr = SMCConfigState( baseAddr ) ) == 0x3F0 ) {
125 if ( ( baseAddr = SMCConfigState( baseAddr ) ) == 0x370 ) {
128 return( (
unsigned long )0 );
131 static void __init SMCEnableDevice(
unsigned long baseAddr,
136 unsigned long indexPort;
137 unsigned long dataPort;
139 indexPort = baseAddr;
140 dataPort = baseAddr + 1;
143 outb(device, dataPort);
146 outb(( portaddr & 0xFF ), dataPort);
149 outb((portaddr >> 8) & 0xFF, dataPort);
152 outb(interrupt, dataPort);
158 static void __init SMCEnableKYBD(
unsigned long baseAddr)
160 unsigned long indexPort;
161 unsigned long dataPort;
163 indexPort = baseAddr;
164 dataPort = baseAddr + 1;
179 static void __init SMCEnableFDC(
unsigned long baseAddr)
181 unsigned long indexPort;
182 unsigned long dataPort;
184 unsigned char oldValue;
186 indexPort = baseAddr;
187 dataPort = baseAddr + 1;
193 oldValue =
inb(dataPort);
196 outb(oldValue, dataPort);
199 outb(0x06, dataPort );
202 outb(0x02, dataPort);
209 static void __init SMCReportDeviceStatus(
unsigned long baseAddr)
211 unsigned long indexPort;
212 unsigned long dataPort;
213 unsigned char currentControl;
215 indexPort = baseAddr;
216 dataPort = baseAddr + 1;
219 currentControl =
inb(dataPort);
222 ?
"\t+FDC Enabled\n" :
"\t-FDC Disabled\n");
224 ?
"\t+IDE1 Enabled\n" :
"\t-IDE1 Disabled\n");
226 ?
"\t+IDE2 Enabled\n" :
"\t-IDE2 Disabled\n");
228 ?
"\t+PARP Enabled\n" :
"\t-PARP Disabled\n");
230 ?
"\t+SER1 Enabled\n" :
"\t-SER1 Disabled\n");
232 ?
"\t+SER2 Enabled\n" :
"\t-SER2 Disabled\n");
240 unsigned long SMCUltraBase;
244 if ((SMCUltraBase = SMCDetectUltraIO()) != 0
UL) {
246 SMCReportDeviceStatus(SMCUltraBase);
249 DBG_DEVS((
"SMC FDC37C93X: SER1 done\n"));
251 DBG_DEVS((
"SMC FDC37C93X: SER2 done\n"));
253 DBG_DEVS((
"SMC FDC37C93X: PARP done\n"));
256 SMCEnableKYBD(SMCUltraBase);
257 DBG_DEVS((
"SMC FDC37C93X: KYB done\n"));
258 SMCEnableFDC(SMCUltraBase);
259 DBG_DEVS((
"SMC FDC37C93X: FDC done\n"));
261 SMCReportDeviceStatus(SMCUltraBase);
263 SMCRunState(SMCUltraBase);
265 printk(
"SMC FDC37C93X Ultra I/O Controller found @ 0x%lx\n",
271 DBG_DEVS((
"No SMC FDC37C93X Ultra I/O Controller found\n"));