Since some people disapprove of white space cleanups mixed in regular commits
[coreboot.git] / src / southbridge / amd / cs5535 / cs5535_early_smbus.c
1 #include "cs5535_smbus.h"
2
3 #define SMBUS_IO_BASE 0x6000
4
5 /* initialization for SMBus Controller */
6 static int cs5535_enable_smbus(void)
7 {
8         unsigned char val;
9
10         /* reset SMBUS controller */
11         outb(0, SMBUS_IO_BASE + SMB_CTRL2);
12
13         /* Set SCL freq and enable SMB controller */
14         val = inb(SMBUS_IO_BASE + SMB_CTRL2);
15         val |= ((0x20 << 1) | SMB_CTRL2_ENABLE);
16         outb(val, SMBUS_IO_BASE + SMB_CTRL2);
17
18         /* Setup SMBus host controller address to 0xEF */
19         val = inb(SMBUS_IO_BASE + SMB_ADD);
20         val |= (0xEF | SMB_ADD_SAEN);
21         outb(val, SMBUS_IO_BASE + SMB_ADD);
22 }
23
24 static int smbus_read_byte(unsigned device, unsigned address)
25 {
26         return do_smbus_read_byte(SMBUS_IO_BASE, device, address-1);
27 }
28
29 #if 0
30 static int smbus_recv_byte(unsigned device)
31 {
32         return do_smbus_recv_byte(SMBUS_IO_BASE, device);
33 }
34
35 static int smbus_send_byte(unsigned device, unsigned char val)
36 {
37         return do_smbus_send_byte(SMBUS_IO_BASE, device, val);
38 }
39
40
41 static int smbus_write_byte(unsigned device, unsigned address, unsigned char val)
42 {
43         return do_smbus_write_byte(SMBUS_IO_BASE, device, address, val);
44 }
45 #endif