1 #include <console/console.h>
2 #include <device/device.h>
3 #include <device/smbus.h>
4 #include <device/pci.h>
5 #include <device/pci_ids.h>
6 #include <device/pci_ops.h>
7 #include <part/hard_reset.h>
8 #include <cpu/x86/msr.h>
11 #define ADM1026_DEVICE 0x2c /* 0x2e or 0x2d */
12 #define ADM1026_REG_CONFIG1 0x00
13 #define CFG1_MONITOR 0x01
14 #define CFG1_INT_ENABLE 0x02
15 #define CFG1_INT_CLEAR 0x04
16 #define CFG1_AIN8_9 0x08
17 #define CFG1_THERM_HOT 0x10
18 #define CFT1_DAC_AFC 0x20
19 #define CFG1_PWM_AFC 0x40
20 #define CFG1_RESET 0x80
21 #define ADM1026_REG_CONFIG2 0x01
22 #define ADM1026_REG_CONFIG3 0x07
24 static void adm1026_init(device_t dev)
26 if (dev->enabled && dev->path.type == DEVICE_PATH_I2C)
28 if(ops_smbus_bus(get_pbus_smbus(dev))) {
29 if( dev->bus->dev->path.type == DEVICE_PATH_I2C) smbus_set_link(dev); // it is under mux
30 adm1026_enable_monitoring(dev);
36 static void adm1026_enable_monitoring(device_t dev)
39 result = smbus_read_byte(dev, ADM1026_REG_CONFIG1);
41 result = (result | CFG1_MONITOR) & ~(CFG1_INT_CLEAR | CFG1_RESET);
42 result = smbus_write_byte(dev, ADM1026_REG_CONFIG1, result);
44 result = smbus_read_byte(dev, ADM1026_REG_CONFIG1);
45 if (!(result & CFG1_MONITOR)) {
46 printk_debug("ADM1026: monitoring would not enable");
49 static void adm1026_noop(device_t dummy)
53 static struct device_operations adm1026_operations = {
54 .read_resources = adm1026_noop,
55 .set_resources = adm1026_noop,
56 .enable_resources = adm1026_noop,
60 static void enable_dev(struct device *dev)
62 dev->ops = &adm1026_operations;
65 struct chip_operations drivers_i2c_adm1026_ops = {
67 .enable_dev = enable_dev,