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)
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);
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. */
45 /* Enter the configuration state. */
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);
53 outl(0x01, PME_IO_BASE_ADDR
+ 0x23);
56 outl(0x01, PME_IO_BASE_ADDR
+ 0x24);
59 outl(0x01, PME_IO_BASE_ADDR
+ 0x25);
62 outl(0x01, PME_IO_BASE_ADDR
+ 0x26);
65 outl(0x01, PME_IO_BASE_ADDR
+ 0x27);
68 outl(0x01, PME_IO_BASE_ADDR
+ 0x28);
71 outl(0x01, PME_IO_BASE_ADDR
+ 0x29);
74 outl(0x01, PME_IO_BASE_ADDR
+ 0x2a);
77 outl(0x01, PME_IO_BASE_ADDR
+ 0x2b);
80 outl(0x00, PME_IO_BASE_ADDR
+ 0x2c);
83 outl(0x00, PME_IO_BASE_ADDR
+ 0x2d);
86 outl(0x00, PME_IO_BASE_ADDR
+ 0x2f);
89 outl(0x01, PME_IO_BASE_ADDR
+ 0x30);
92 outl(0x01, PME_IO_BASE_ADDR
+ 0x31);
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);
104 outl(0x04, PME_IO_BASE_ADDR
+ 0x35);
107 outl(0x04, PME_IO_BASE_ADDR
+ 0x36);
110 outl(0x05, PME_IO_BASE_ADDR
+ 0x37);
113 outl(0x04, PME_IO_BASE_ADDR
+ 0x38);
116 outl(0x84, PME_IO_BASE_ADDR
+ 0x39);
119 outl(0x84, PME_IO_BASE_ADDR
+ 0x3a);
122 outl(0x04, PME_IO_BASE_ADDR
+ 0x3b);
125 outl(0x04, PME_IO_BASE_ADDR
+ 0x3c);
128 outl(0x84, PME_IO_BASE_ADDR
+ 0x3d);
131 outl(0x00, PME_IO_BASE_ADDR
+ 0x3e);
134 outl(0x05, PME_IO_BASE_ADDR
+ 0x3f);
137 outl(0x05, PME_IO_BASE_ADDR
+ 0x40);
140 outl(0x05, PME_IO_BASE_ADDR
+ 0x41);
143 outl(0x04, PME_IO_BASE_ADDR
+ 0x42);
146 outl(0x05, PME_IO_BASE_ADDR
+ 0x43);
149 outl(0x04, PME_IO_BASE_ADDR
+ 0x44);
152 outl(0x05, PME_IO_BASE_ADDR
+ 0x45);
155 outl(0x04, PME_IO_BASE_ADDR
+ 0x46);
158 outl(0x84, PME_IO_BASE_ADDR
+ 0x47);
161 outl(0x84, PME_IO_BASE_ADDR
+ 0x48);
164 outl(0x00, PME_IO_BASE_ADDR
+ 0x4b);
167 outl(0x14, PME_IO_BASE_ADDR
+ 0x4c);
170 outl(0xda, PME_IO_BASE_ADDR
+ 0x4d);
173 outl(0x08, PME_IO_BASE_ADDR
+ 0x4e);
176 outl(0x00, PME_IO_BASE_ADDR
+ 0x4f);
179 outl(0x00, PME_IO_BASE_ADDR
+ 0x50);
182 outl(0x01, PME_IO_BASE_ADDR
+ 0x56);
185 outl(0x01, PME_IO_BASE_ADDR
+ 0x57);
188 outl(0xf0, PME_IO_BASE_ADDR
+ 0x58);
191 outl(0x00, PME_IO_BASE_ADDR
+ 0x5b);
194 outl(0x00, PME_IO_BASE_ADDR
+ 0x5c);
197 outl(0x03, PME_IO_BASE_ADDR
+ 0x5d);
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. */