blob: 5f66822b884df5c4776eeb1470129ccfad9b9856 [file] [log] [blame]
Alexandru Gagniucee2bc272013-05-21 12:35:08 -05001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2013 Alexandru Gagniuc <mr.nuke.me@gmail.com>
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 as published by
8 * the Free Software Foundation, either version 2 of the License, or
9 * (at your option) any later version.
10 *
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.
Alexandru Gagniucee2bc272013-05-21 12:35:08 -050015 */
16
17/**
Martin Roth49348182016-07-06 10:17:19 -060018 * @file via_early_smbus.h
Alexandru Gagniucee2bc272013-05-21 12:35:08 -050019 *
20 * This file contains generic definitions used in VIA SMBus controllers.
21 *
22 * Functions defined in device/early/smbus.h are each implemented in a separate
23 * early_smbus_[func_name].c file. This makes it possible to override any of
Martin Roth84422b12014-12-09 13:49:05 -070024 * these functions by not including them in your build, via Makefile.c. This is
Alexandru Gagniucee2bc272013-05-21 12:35:08 -050025 * useful when there is a need to work around chipset bugs.
26 *
27 * These implementations work with most via chipsets. Any VIA port should try
28 * to use these. Makefile.inc needs to be adapted to link against the files
29 * providing SMBus functionality:
30 * @code
31 * romstage-y += ./../../../southbridge/via/common/early_smbus_func.c
32 * @endcode
33 */
34
35/**
36 * \brief SMBus IO ports in relation to the base IO port
37 */
38#define SMBHSTSTAT(base) ((u16)base + 0x0)
39#define SMBSLVSTAT(base) ((u16)base + 0x1)
40#define SMBHSTCTL(base) ((u16)base + 0x2)
41#define SMBHSTCMD(base) ((u16)base + 0x3)
42#define SMBXMITADD(base) ((u16)base + 0x4)
43#define SMBHSTDAT0(base) ((u16)base + 0x5)
44#define SMBHSTDAT1(base) ((u16)base + 0x6)
45#define SMBBLKDAT(base) ((u16)base + 0x7)
46#define SMBSLVCTL(base) ((u16)base + 0x8)
47#define SMBTRNSADD(base) ((u16)base + 0x9)
48#define SMBSLVDATA (base) ((u16)base + 0xa)
49
50#define SMBUS_TIMEOUT (100*1000*10)
51
52#include <device/early_smbus.h>
53#include <arch/io.h>