2 * This file is part of the coreboot project.
4 * Copyright (C) 2008 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.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 #define PME_DEV PNP_DEV(0x2e, 0x0a)
22 #define PME_IO_BASE_ADDR 0x800 /* Runtime register base address */
23 #define ICH_IO_BASE_ADDR 0x00000500 /* GPIO base address register */
25 /* Early mainboard specific GPIO setup. */
26 static void mb_gpio_init(void)
32 /* Southbridge GPIOs. */
33 /* Set the LPC device statically. */
34 dev = PCI_DEV(0x0, 0x1f, 0x0);
36 /* Set the value for GPIO base address register and enable GPIO. */
37 pci_write_config32(dev, GPIO_BASE_ICH0_5, (ICH_IO_BASE_ADDR | 1));
38 pci_write_config8(dev, GPIO_CNTL_ICH0_5, 0x10);
40 /* Set GPIO25 to input and drive GPIO23 to high,
41 * this enables the LAN controller.
44 set_gpio = 0x0000ffff;
46 outl(set_gpio, ICH_IO_BASE_ADDR + 0x04);
48 set_gpio = 0x1b3f0000;
50 outl(set_gpio, ICH_IO_BASE_ADDR + 0x0c);
52 /* Super I/O GPIOs. */
56 outb(0x55, port); /* Enter the configuration state. */
57 pnp_set_logical_device(dev);
58 pnp_set_enable(dev, 0);
59 pnp_set_iobase(dev, PNP_IDX_IO0, PME_IO_BASE_ADDR);
60 pnp_set_enable(dev, 1);
61 outl(0x03, PME_IO_BASE_ADDR + 0x1e); /* Force Disk Change */
62 outl(0x02, PME_IO_BASE_ADDR + 0x1f); /* Floppy Data Rate */
63 outl(0x81, PME_IO_BASE_ADDR + 0x20); /* UART1 FIFO */
64 outl(0x81, PME_IO_BASE_ADDR + 0x21); /* UART2 FIFO */
65 outl(0x00, PME_IO_BASE_ADDR + 0x22); /* Device Disable */
66 outl(0x01, PME_IO_BASE_ADDR + 0x23); /* GP10 */
67 outl(0x01, PME_IO_BASE_ADDR + 0x24); /* GP11 */
68 outl(0x01, PME_IO_BASE_ADDR + 0x25); /* GP12 */
69 outl(0x01, PME_IO_BASE_ADDR + 0x26); /* GP13 */
70 outl(0x01, PME_IO_BASE_ADDR + 0x27); /* GP14 */
71 outl(0x01, PME_IO_BASE_ADDR + 0x28); /* GP15 */
72 outl(0x01, PME_IO_BASE_ADDR + 0x29); /* GP16 */
73 outl(0x01, PME_IO_BASE_ADDR + 0x2a); /* GP17 */
74 outl(0x01, PME_IO_BASE_ADDR + 0x2b); /* GP20 */
75 outl(0x01, PME_IO_BASE_ADDR + 0x2c); /* GP21 */
76 outl(0x01, PME_IO_BASE_ADDR + 0x2d); /* GP22 */
77 outl(0x01, PME_IO_BASE_ADDR + 0x2f); /* GP24 */
78 outl(0x01, PME_IO_BASE_ADDR + 0x30); /* GP25 */
79 outl(0x01, PME_IO_BASE_ADDR + 0x31); /* GP26 */
80 outl(0x01, PME_IO_BASE_ADDR + 0x32); /* GP27 */
81 outl(0x05, PME_IO_BASE_ADDR + 0x33); /* GP30 */
82 outl(0x05, PME_IO_BASE_ADDR + 0x34); /* GP31 */
83 outl(0x84, PME_IO_BASE_ADDR + 0x35); /* GP32 */
84 outl(0x84, PME_IO_BASE_ADDR + 0x36); /* GP33 */
85 outl(0x00, PME_IO_BASE_ADDR + 0x37); /* GP34 */
86 outl(0x04, PME_IO_BASE_ADDR + 0x38); /* GP35 */
87 outl(0x01, PME_IO_BASE_ADDR + 0x39); /* GP36 */
88 outl(0x01, PME_IO_BASE_ADDR + 0x3a); /* GP37 */
89 outl(0x01, PME_IO_BASE_ADDR + 0x3b); /* GP40 */
90 outl(0x01, PME_IO_BASE_ADDR + 0x3c); /* GP41 */
91 outl(0x86, PME_IO_BASE_ADDR + 0x3d); /* GP42 */
92 outl(0x01, PME_IO_BASE_ADDR + 0x3e); /* GP43 */
93 outl(0x05, PME_IO_BASE_ADDR + 0x3f); /* GP50 */
94 outl(0x05, PME_IO_BASE_ADDR + 0x40); /* GP51 */
95 outl(0x05, PME_IO_BASE_ADDR + 0x41); /* GP52 */
96 outl(0x04, PME_IO_BASE_ADDR + 0x42); /* GP53 */
97 outl(0x05, PME_IO_BASE_ADDR + 0x43); /* GP54 */
98 outl(0x04, PME_IO_BASE_ADDR + 0x44); /* GP55 */
99 outl(0x05, PME_IO_BASE_ADDR + 0x45); /* GP56 */
100 outl(0x04, PME_IO_BASE_ADDR + 0x46); /* GP57 */
101 outl(0x01, PME_IO_BASE_ADDR + 0x47); /* GP58 */
102 outl(0x01, PME_IO_BASE_ADDR + 0x48); /* GP59 */
103 outl(0x00, PME_IO_BASE_ADDR + 0x4b); /* GP1 */
104 outl(0x04, PME_IO_BASE_ADDR + 0x4c); /* GP2 */
105 outl(0xc0, PME_IO_BASE_ADDR + 0x4d); /* GP3 */
106 outl(0x00, PME_IO_BASE_ADDR + 0x4e); /* GP4 */
107 outl(0x04, PME_IO_BASE_ADDR + 0x4f); /* GP5 */
108 outl(0x00, PME_IO_BASE_ADDR + 0x50); /* GP6 */
109 outl(0x01, PME_IO_BASE_ADDR + 0x56); /* FAN1 */
110 outl(0x01, PME_IO_BASE_ADDR + 0x57); /* FAN2 */
111 outl(0x58, PME_IO_BASE_ADDR + 0x58); /* Fan Control */
112 outl(0xff, PME_IO_BASE_ADDR + 0x59); /* Fan1 Tachometer */
113 outl(0x50, PME_IO_BASE_ADDR + 0x5a); /* Fan2 Tachometer */
114 outl(0x00, PME_IO_BASE_ADDR + 0x5b); /* Fan1 Preload */
115 outl(0x00, PME_IO_BASE_ADDR + 0x5c); /* Fan2 Preload */
116 outl(0x00, PME_IO_BASE_ADDR + 0x5d); /* LED1 */
117 outl(0x00, PME_IO_BASE_ADDR + 0x5e); /* LED2 */
118 outl(0x00, PME_IO_BASE_ADDR + 0x5f); /* Keyboard Scan Code */
119 outb(0xaa, port); /* Exit the configuration state. */