blob: 25b6951daa7c860e6e5f81df5ae301225ec9d01d [file] [log] [blame]
stepan836ae292010-12-08 05:42:47 +00001#include "smbus.h"
Li-Ta Lo416b3d72006-03-02 18:02:24 +00002
3#define SMBUS_IO_BASE 0x6000
4
5/* initialization for SMBus Controller */
Nils Jacobse4740702010-07-26 23:46:25 +00006static void cs5535_enable_smbus(void)
Li-Ta Lo416b3d72006-03-02 18:02:24 +00007{
8 unsigned char val;
9
Li-Ta Lo042f0432006-03-17 20:11:38 +000010 /* reset SMBUS controller */
Li-Ta Lo71eae202006-03-13 21:58:43 +000011 outb(0, SMBUS_IO_BASE + SMB_CTRL2);
Li-Ta Lo416b3d72006-03-02 18:02:24 +000012
Li-Ta Lo71eae202006-03-13 21:58:43 +000013 /* Set SCL freq and enable SMB controller */
14 val = inb(SMBUS_IO_BASE + SMB_CTRL2);
Li-Ta Loa413ecc2006-03-13 22:18:39 +000015 val |= ((0x20 << 1) | SMB_CTRL2_ENABLE);
Li-Ta Lo71eae202006-03-13 21:58:43 +000016 outb(val, SMBUS_IO_BASE + SMB_CTRL2);
Li-Ta Lo416b3d72006-03-02 18:02:24 +000017
Li-Ta Lo71eae202006-03-13 21:58:43 +000018 /* Setup SMBus host controller address to 0xEF */
Li-Ta Lo416b3d72006-03-02 18:02:24 +000019 val = inb(SMBUS_IO_BASE + SMB_ADD);
20 val |= (0xEF | SMB_ADD_SAEN);
Stefan Reinauer14e22772010-04-27 06:56:47 +000021 outb(val, SMBUS_IO_BASE + SMB_ADD);
Li-Ta Lo042f0432006-03-17 20:11:38 +000022}