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\r\n");
18 print_debug("SMBus controller enabled\r\n");
19 /* set smbus iobase */
20 pci_write_config32(dev, 0x20, SMBUS_IO_BASE | 1);
21 /* Set smbus iospace enable */
22 pci_write_config16(dev, 0x4, 0x01);
23 /* clear any lingering errors, so the transaction will run */
24 outb(inb(SMBUS_IO_BASE + SMBHSTSTAT), SMBUS_IO_BASE + SMBHSTSTAT);
27 static int smbus_read_byte(unsigned device, unsigned address)
29 return do_smbus_read_byte(SMBUS_IO_BASE, device, address);
31 static int smbus_write_byte(unsigned device, unsigned address, unsigned char val)
33 return do_smbus_write_byte(SMBUS_IO_BASE, device, address, val);