blob: 172414e3d44071747ee0224f28b8b2e23dcc644a [file] [log] [blame]
Richard Smithcb8eab42006-07-24 04:25:47 +00001#include "i440bx_smbus.h"
2
3#define SMBUS_IO_BASE 0x0f00
4
5static void enable_smbus(void)
6{
7 device_t dev;
8 dev = pci_locate_device(PCI_ID(0x8086, 0x7113), 0);
9 if (dev == PCI_DEV_INVALID) {
10 die("SMBUS controller not found\r\n");
11 }
12 uint8_t enable;
13 print_spew("SMBus controller enabled\r\n");
Richard Smithd7088c42006-07-30 00:23:20 +000014 pci_write_config32(dev, 0x90, SMBUS_IO_BASE | 1 );
Richard Smithcb8eab42006-07-24 04:25:47 +000015 // Enable and set SMBBus
16 // 0x01 Interrupt to SMI#
17 // (0x4<<1)|1 set interrupt to IRQ9
18 pci_write_config8(dev, 0xd2, (0x4<<1)|1);
19
20 // Enable the IO space
21 pci_write_config16(dev, 0x04, 1);
22
23 /* clear any lingering errors, so the transaction will run */
Richard Smithd7088c42006-07-30 00:23:20 +000024 outb(0x1e, SMBUS_IO_BASE + SMBHST_STATUS);
25}
26
27
28
29static int smbus_read_byte(unsigned device, unsigned address)
30{
31 return do_smbus_read_byte(SMBUS_IO_BASE, device, address);
32}
33
34
35// The following functions are broken. Do no use until you
36// have fixed the low level code to do the right thing.
37//
38#if 0
39static int smbus_write_byte(unsigned device, unsigned address, unsigned char val)
40{
41 return do_smbus_write_byte(SMBUS_IO_BASE, device, address, val);
Richard Smithcb8eab42006-07-24 04:25:47 +000042}
43
44static int smbus_recv_byte(unsigned device)
45{
46 return do_smbus_recv_byte(SMBUS_IO_BASE, device);
47}
48
49static int smbus_send_byte(unsigned device, unsigned char val)
50{
51 return do_smbus_send_byte(SMBUS_IO_BASE, device, val);
52}
Richard Smithd7088c42006-07-30 00:23:20 +000053#endif