blob: e11b91f236ae07f48f502d9df7a2e111a1399d63 [file] [log] [blame]
Marc Jonesa67d4fd2007-05-04 19:05:36 +00001/*
Stefan Reinauer7e61e452008-01-18 10:35:56 +00002 * This file is part of the coreboot project.
Uwe Hermann344e4572007-05-22 10:12:49 +00003 *
4 * Copyright (C) 2007 Advanced Micro Devices, Inc.
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 version 2 as
8 * published by 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.
Uwe Hermann344e4572007-05-22 10:12:49 +000014 */
Li-Ta Lo5d698962006-04-20 21:31:47 +000015
Marc Jonesa67d4fd2007-05-04 19:05:36 +000016#include "cs5536.h"
Christian Gmeinerb5dfcae2012-07-20 10:21:29 +020017#include "smbus.h"
Marc Jonesa67d4fd2007-05-04 19:05:36 +000018
Li-Ta Lo5d698962006-04-20 21:31:47 +000019/* initialization for SMBus Controller */
Marc Jonesa67d4fd2007-05-04 19:05:36 +000020static void cs5536_enable_smbus(void)
21{
22
23 /* Set SCL freq and enable SMB controller */
Jordan Crouse2a133f72007-05-10 18:43:57 +000024 /*outb((0x20 << 1) | SMB_CTRL2_ENABLE, smbus_io_base + SMB_CTRL2); */
Marc Jonesa67d4fd2007-05-04 19:05:36 +000025 outb((0x7F << 1) | SMB_CTRL2_ENABLE, SMBUS_IO_BASE + SMB_CTRL2);
26
27 /* Setup SMBus host controller address to 0xEF */
28 outb((0xEF | SMB_ADD_SAEN), SMBUS_IO_BASE + SMB_ADD);
29
30}
31
Marc Jonesa67d4fd2007-05-04 19:05:36 +000032static inline int smbus_read_byte(unsigned device, unsigned address)
33{
Jordan Crouse2a133f72007-05-10 18:43:57 +000034 return do_smbus_read_byte(SMBUS_IO_BASE, device, address);
Marc Jonesa67d4fd2007-05-04 19:05:36 +000035}