Marc Jones | a67d4fd | 2007-05-04 19:05:36 +0000 | [diff] [blame] | 1 | /* |
Stefan Reinauer | 7e61e45 | 2008-01-18 10:35:56 +0000 | [diff] [blame] | 2 | * This file is part of the coreboot project. |
Uwe Hermann | 344e457 | 2007-05-22 10:12:49 +0000 | [diff] [blame] | 3 | * |
| 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 Hermann | 344e457 | 2007-05-22 10:12:49 +0000 | [diff] [blame] | 14 | */ |
Li-Ta Lo | 5d69896 | 2006-04-20 21:31:47 +0000 | [diff] [blame] | 15 | |
Marc Jones | a67d4fd | 2007-05-04 19:05:36 +0000 | [diff] [blame] | 16 | #include "cs5536.h" |
Christian Gmeiner | b5dfcae | 2012-07-20 10:21:29 +0200 | [diff] [blame] | 17 | #include "smbus.h" |
Marc Jones | a67d4fd | 2007-05-04 19:05:36 +0000 | [diff] [blame] | 18 | |
Li-Ta Lo | 5d69896 | 2006-04-20 21:31:47 +0000 | [diff] [blame] | 19 | /* initialization for SMBus Controller */ |
Marc Jones | a67d4fd | 2007-05-04 19:05:36 +0000 | [diff] [blame] | 20 | static void cs5536_enable_smbus(void) |
| 21 | { |
| 22 | |
| 23 | /* Set SCL freq and enable SMB controller */ |
Jordan Crouse | 2a133f7 | 2007-05-10 18:43:57 +0000 | [diff] [blame] | 24 | /*outb((0x20 << 1) | SMB_CTRL2_ENABLE, smbus_io_base + SMB_CTRL2); */ |
Marc Jones | a67d4fd | 2007-05-04 19:05:36 +0000 | [diff] [blame] | 25 | 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 Jones | a67d4fd | 2007-05-04 19:05:36 +0000 | [diff] [blame] | 32 | static inline int smbus_read_byte(unsigned device, unsigned address) |
| 33 | { |
Jordan Crouse | 2a133f7 | 2007-05-10 18:43:57 +0000 | [diff] [blame] | 34 | return do_smbus_read_byte(SMBUS_IO_BASE, device, address); |
Marc Jones | a67d4fd | 2007-05-04 19:05:36 +0000 | [diff] [blame] | 35 | } |