2 * This file is part of the coreboot project.
4 * Copyright (C) 2007 Rudolf Marek <r.marek@assembler.cz>
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; version 2 of the License.
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.
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
20 #ifndef SOUTHBRIDGE_VIA_VT8237R_VT8237R_H
21 #define SOUTHBRIDGE_VIA_VT8237R_VT8237R_H
25 /* Static resources for the VT8237R southbridge */
27 #define VT8237R_APIC_ID 0x2
28 #define VT8237R_ACPI_IO_BASE 0x500
29 #define VT8237R_SMBUS_IO_BASE 0x400
30 /* 0x0 disabled, 0x2 reserved, 0xf = IRQ15 */
31 #define VT8237R_ACPI_IRQ 0x9
33 #define VT8237S_SPI_MEM_BASE 0xfed02000ULL
35 #define VT8237S_SPI_MEM_BASE 0xfed02000UL
37 #define VT8237R_HPET_ADDR 0xfed00000ULL
41 #define IDE_CONF_I 0x41
42 #define IDE_CONF_II 0x42
43 #define IDE_CONF_FIFO 0x43
44 #define IDE_MISC_I 0x44
45 #define IDE_MISC_II 0x45
48 #define VT8237R_IDE0_80PIN_CABLE ((1UL<<28)|(1UL<<20))
49 #define VT8237R_IDE1_80PIN_CABLE ((1UL<<12)|(1UL<< 4))
50 #define VT8237R_IDE_CABLESEL_MASK (VT8237R_IDE0_80PIN_CABLE|VT8237R_IDE1_80PIN_CABLE)
53 #define VT8237R_PSON 0x82
54 #define VT8237R_POWER_WELL 0x94
55 #define VT8237R_SMBUS_IO_BASE_REG 0xd0
56 #define VT8237R_SMBUS_HOST_CONF 0xd2
58 #define SMBHSTSTAT (VT8237R_SMBUS_IO_BASE + 0x0)
59 #define SMBSLVSTAT (VT8237R_SMBUS_IO_BASE + 0x1)
60 #define SMBHSTCTL (VT8237R_SMBUS_IO_BASE + 0x2)
61 #define SMBHSTCMD (VT8237R_SMBUS_IO_BASE + 0x3)
62 #define SMBXMITADD (VT8237R_SMBUS_IO_BASE + 0x4)
63 #define SMBHSTDAT0 (VT8237R_SMBUS_IO_BASE + 0x5)
65 #define HOST_RESET 0xff
66 /* 1 in the 0 bit of SMBHSTADD states to READ. */
68 #define SMBUS_TIMEOUT (100 * 1000 * 10)
69 #define I2C_TRANS_CMD 0x40
70 #define CLOCK_SLAVE_ADDRESS 0x69
72 #if CONFIG_DEBUG_SMBUS
73 #define PRINT_DEBUG(x) print_debug(x)
74 #define PRINT_DEBUG_HEX16(x) print_debug_hex16(x)
76 #define PRINT_DEBUG(x)
77 #define PRINT_DEBUG_HEX16(x)
80 #define SMBUS_DELAY() inb(0x80)
82 struct vt8237_network_rom {
105 #if defined(__GNUC__)
106 __attribute__ ((packed))
112 u8 smbus_read_byte(u8 dimm, u8 offset);
113 void enable_smbus(void);
114 void smbus_fixup(const struct mem_controller *ctrl);
115 // these are in vt8237_early_smbus.c - do they really belong there?
116 void vt8237_sb_enable_fid_vid(void);
117 void enable_rom_decode(void);
118 void vt8237_early_spi_init(void);
119 int vt8237_early_network_init(struct vt8237_network_rom *rom);
122 #include <device/device.h>
123 void writeback(struct device *dev, u16 where, u8 what);
124 void dump_south(device_t dev);
125 u32 vt8237_ide_80pin_detect(struct device *dev);