tree: drop last paragraph of GPL copyright header
[coreboot.git] / src / mainboard / intel / d810e2cb / gpio.c
blob6241435890da7761199c5a14cea4b8f39cc07640
1 /*
2 * This file is part of the coreboot project.
4 * Copyright (C) 2010 Joseph Smith <joe@settoplinux.org>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
17 #define PME_DEV PNP_DEV(0x4e, 0x0a)
18 #define PME_IO_BASE_ADDR 0x800 /* Runtime register base address */
20 /* Early mainboard specific GPIO setup. */
21 static void mb_gpio_init(void)
23 device_t dev;
24 uint16_t port;
26 /* Southbridge GPIOs. */
27 /* Set the LPC device statically. */
28 dev = PCI_DEV(0x0, 0x1f, 0x0);
30 /* Set the value for GPIO base address register and enable GPIO. */
31 pci_write_config32(dev, GPIO_BASE, (GPIO_BASE_ADDR | 1));
32 pci_write_config8(dev, GPIO_CNTL, 0x10);
34 udelay(10);
35 outl(0x1a203180, GPIO_BASE_ADDR + 0x00); /* GPIO_USE_SEL */
36 outl(0x0000ffff, GPIO_BASE_ADDR + 0x04); /* GP_IO_SEL */
37 outl(0x13bf0000, GPIO_BASE_ADDR + 0x0c); /* GP_LVL */
38 outl(0x00040000, GPIO_BASE_ADDR + 0x18); /* GPO_BLINK */
39 outl(0x000039ff, GPIO_BASE_ADDR + 0x2c); /* GPI_INV */
41 /* Super I/O GPIOs. */
42 dev = PME_DEV;
43 port = dev >> 8;
45 /* Enter the configuration state. */
46 outb(0x55, port);
47 pnp_set_logical_device(dev);
48 pnp_set_enable(dev, 0);
49 pnp_set_iobase(dev, PNP_IDX_IO0, PME_IO_BASE_ADDR);
50 pnp_set_enable(dev, 1);
52 /* GP10 - J1B1 */
53 outl(0x01, PME_IO_BASE_ADDR + 0x23);
55 /* GP11 - J1B2 */
56 outl(0x01, PME_IO_BASE_ADDR + 0x24);
58 /* GP12 - J2B1 */
59 outl(0x01, PME_IO_BASE_ADDR + 0x25);
61 /* GP13 - J2B2 */
62 outl(0x01, PME_IO_BASE_ADDR + 0x26);
64 /* GP14 - J1X */
65 outl(0x01, PME_IO_BASE_ADDR + 0x27);
67 /* GP15 - J1Y */
68 outl(0x01, PME_IO_BASE_ADDR + 0x28);
70 /* GP16 - J2X */
71 outl(0x01, PME_IO_BASE_ADDR + 0x29);
73 /* GP17 - J2Y */
74 outl(0x01, PME_IO_BASE_ADDR + 0x2a);
76 /* GP20 - 8042 P17 */
77 outl(0x01, PME_IO_BASE_ADDR + 0x2b);
79 /* GP21 - 8042 P16 */
80 outl(0x00, PME_IO_BASE_ADDR + 0x2c);
82 /* GP22 - 8042 P12 */
83 outl(0x00, PME_IO_BASE_ADDR + 0x2d);
85 /* GP24 */
86 outl(0x00, PME_IO_BASE_ADDR + 0x2f);
88 /* GP25 - MIDI_IN */
89 outl(0x01, PME_IO_BASE_ADDR + 0x30);
91 /* GP26 - MIDI_OUT */
92 outl(0x01, PME_IO_BASE_ADDR + 0x31);
94 /* GP27 - nIO_SMI */
95 outl(0x04, PME_IO_BASE_ADDR + 0x32);
97 /* GP30 - FAN_TACH2 */
98 outl(0x05, PME_IO_BASE_ADDR + 0x33);
100 /* GP31 - FAN_TACH1 */
101 outl(0x05, PME_IO_BASE_ADDR + 0x34);
103 /* GP32 - FAN2 */
104 outl(0x04, PME_IO_BASE_ADDR + 0x35);
106 /* GP33 - FAN1 */
107 outl(0x04, PME_IO_BASE_ADDR + 0x36);
109 /* GP34 - IRRX2 */
110 outl(0x05, PME_IO_BASE_ADDR + 0x37);
112 /* GP35 - IRTX2 */
113 outl(0x04, PME_IO_BASE_ADDR + 0x38);
115 /* GP36 - nKBDRST */
116 outl(0x84, PME_IO_BASE_ADDR + 0x39);
118 /* GP37 - A20M */
119 outl(0x84, PME_IO_BASE_ADDR + 0x3a);
121 /* GP40 - DRVDEN0 */
122 outl(0x04, PME_IO_BASE_ADDR + 0x3b);
124 /* GP41 - DRVDEN1 */
125 outl(0x04, PME_IO_BASE_ADDR + 0x3c);
127 /* GP42 - nIO_PME */
128 outl(0x84, PME_IO_BASE_ADDR + 0x3d);
130 /* GP43 */
131 outl(0x00, PME_IO_BASE_ADDR + 0x3e);
133 /* GP50 - nIR2 */
134 outl(0x05, PME_IO_BASE_ADDR + 0x3f);
136 /* GP51 - nDCD2 */
137 outl(0x05, PME_IO_BASE_ADDR + 0x40);
139 /* GP52 - RXD2 */
140 outl(0x05, PME_IO_BASE_ADDR + 0x41);
142 /* GP53 - TXD2 */
143 outl(0x04, PME_IO_BASE_ADDR + 0x42);
145 /* GP54 - nDSR2 */
146 outl(0x05, PME_IO_BASE_ADDR + 0x43);
148 /* GP55 - nRTS2 */
149 outl(0x04, PME_IO_BASE_ADDR + 0x44);
151 /* GP56 - nCTS2 */
152 outl(0x05, PME_IO_BASE_ADDR + 0x45);
154 /* GP57 - nDTR2 */
155 outl(0x04, PME_IO_BASE_ADDR + 0x46);
157 /* GP60 - LED1 */
158 outl(0x84, PME_IO_BASE_ADDR + 0x47);
160 /* GP61 - LED2 */
161 outl(0x84, PME_IO_BASE_ADDR + 0x48);
163 /* GP1 */
164 outl(0x00, PME_IO_BASE_ADDR + 0x4b);
166 /* GP2 */
167 outl(0x14, PME_IO_BASE_ADDR + 0x4c);
169 /* GP3 */
170 outl(0xda, PME_IO_BASE_ADDR + 0x4d);
172 /* GP4 */
173 outl(0x08, PME_IO_BASE_ADDR + 0x4e);
175 /* GP5 */
176 outl(0x00, PME_IO_BASE_ADDR + 0x4f);
178 /* GP6 */
179 outl(0x00, PME_IO_BASE_ADDR + 0x50);
181 /* FAN1 */
182 outl(0x01, PME_IO_BASE_ADDR + 0x56);
184 /* FAN2 */
185 outl(0x01, PME_IO_BASE_ADDR + 0x57);
187 /* Fan Control */
188 outl(0xf0, PME_IO_BASE_ADDR + 0x58);
190 /* Fan1 Preload */
191 outl(0x00, PME_IO_BASE_ADDR + 0x5b);
193 /* Fan2 Preload */
194 outl(0x00, PME_IO_BASE_ADDR + 0x5c);
196 /* LED1 */
197 outl(0x03, PME_IO_BASE_ADDR + 0x5d);
199 /* LED2 */
200 outl(0x03, PME_IO_BASE_ADDR + 0x5e);
202 /* Keyboard Scan Code */
203 outl(0x00, PME_IO_BASE_ADDR + 0x5f);
205 /* Exit the configuration state. */
206 outb(0xaa, port);