2 * Copyright 2004 Tyan Computer
6 #include "ck804_smbus.h"
8 #define SMBUS_IO_BASE 0x1000
10 static void enable_smbus(void)
13 dev = pci_locate_device(PCI_ID(0x10de, 0x0052), 0);
14 if (dev == PCI_DEV_INVALID)
15 die("SMBus controller not found\n");
17 print_debug("SMBus controller enabled\n");
19 /* Set SMBus I/O base. */
20 pci_write_config32(dev, 0x20, SMBUS_IO_BASE | 1);
22 /* Set SMBus I/O space enable. */
23 pci_write_config16(dev, 0x4, 0x01);
25 /* Clear any lingering errors, so the transaction will run. */
26 outb(inb(SMBUS_IO_BASE + SMBHSTSTAT), SMBUS_IO_BASE + SMBHSTSTAT);
29 static int smbus_read_byte(unsigned device, unsigned address)
31 return do_smbus_read_byte(SMBUS_IO_BASE, device, address);
34 static int smbus_write_byte(unsigned device, unsigned address,
37 return do_smbus_write_byte(SMBUS_IO_BASE, device, address, val);