b723fbba978017bf209d02b6cf5a5bd2e1c36e77
[coreboot.git] / src / southbridge / via / vt8237r / vt8237r.h
1 /*
2  * This file is part of the LinuxBIOS project.
3  *
4  * Copyright (C) 2007 Rudolf Marek <r.marek@assembler.cz>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License v2 as published by
8  * the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
18  */
19
20 #ifndef SOUTHBRIDGE_VIA_VT8237R_VT8237R_H
21 #define SOUTHBRIDGE_VIA_VT8237R_VT8237R_H
22
23 /* Static resources for the VT8237R southbridge */
24
25 #define VT8237R_APIC_ID                 0x2
26 #define VT8237R_ACPI_IO_BASE            0x500
27 #define VT8237R_SMBUS_IO_BASE           0x400
28 /* 0x0 disabled, 0x2 reserved, 0xf = IRQ15 */
29 #define VT8237R_ACPI_IRQ                0x9
30 #define VT8237R_HPET_ADDR               0xfed00000ULL
31 #define VT8237R_APIC_BASE               0xfec00000ULL
32
33 /* IDE */
34 #define IDE_CS                          0x40
35 #define IDE_CONF_I                      0x41
36 #define IDE_CONF_II                     0x42
37 #define IDE_CONF_FIFO                   0x43
38 #define IDE_MISC_I                      0x44
39 #define IDE_MISC_II                     0x45
40 #define IDE_UDMA                        0x50
41
42 /* SMBus */
43 #define VT8237R_POWER_WELL              0x94
44 #define VT8237R_SMBUS_IO_BASE_REG       0xd0
45 #define VT8237R_SMBUS_HOST_CONF         0xd2
46
47 #define SMBHSTSTAT                      (VT8237R_SMBUS_IO_BASE + 0x0)
48 #define SMBSLVSTAT                      (VT8237R_SMBUS_IO_BASE + 0x1)
49 #define SMBHSTCTL                       (VT8237R_SMBUS_IO_BASE + 0x2)
50 #define SMBHSTCMD                       (VT8237R_SMBUS_IO_BASE + 0x3)
51 #define SMBXMITADD                      (VT8237R_SMBUS_IO_BASE + 0x4)
52 #define SMBHSTDAT0                      (VT8237R_SMBUS_IO_BASE + 0x5)
53
54 #define HOST_RESET                      0xff
55 /* 1 in the 0 bit of SMBHSTADD states to READ. */
56 #define READ_CMD                        0x01
57 #define SMBUS_TIMEOUT                   (100 * 1000 * 10)
58 #define I2C_TRANS_CMD                   0x40
59 #define CLOCK_SLAVE_ADDRESS             0x69
60
61 #if DEBUG_SMBUS == 1
62 #define PRINT_DEBUG(x)          print_debug(x)
63 #define PRINT_DEBUG_HEX16(x)    print_debug_hex16(x)
64 #else
65 #define PRINT_DEBUG(x)
66 #define PRINT_DEBUG_HEX16(x)
67 #endif
68
69 #define SMBUS_DELAY() inb(0x80)
70
71 #endif