blob: 3ce5fd8862ce3c7a1e194db0ab7533962bde8803 [file] [log] [blame]
Yinghai Lu7213d0f2004-12-03 03:39:04 +00001#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 <cpu/x86/msr.h>
Yinghai Lu7213d0f2004-12-03 03:39:04 +00008
Edward O'Callaghan2c9d2cf2014-10-27 23:29:29 +11009static void lm63_init(struct device *dev)
Yinghai Lu7213d0f2004-12-03 03:39:04 +000010{
11 int result;
Vikram Narayanan0786bc62011-12-26 22:52:01 +053012 if (dev->enabled && dev->path.type == DEVICE_PATH_I2C) {
13 if (ops_smbus_bus(get_pbus_smbus(dev))) {
14 if (dev->bus->dev->path.type == DEVICE_PATH_I2C)
15 smbus_set_link(dev); // it is under mux
Yinghai Lu7213d0f2004-12-03 03:39:04 +000016 result = smbus_read_byte(dev, 0x03);
Vikram Narayanan0786bc62011-12-26 22:52:01 +053017// result &= ~0x04;
Yinghai Lu7213d0f2004-12-03 03:39:04 +000018 result |= 0x04;
Vikram Narayanan0786bc62011-12-26 22:52:01 +053019 smbus_write_byte(dev, 0x03, result & 0xff); // config lm63
Yinghai Lu7213d0f2004-12-03 03:39:04 +000020 }
Yinghai Lu7213d0f2004-12-03 03:39:04 +000021 }
Yinghai Lu7213d0f2004-12-03 03:39:04 +000022}
Vikram Narayanan0786bc62011-12-26 22:52:01 +053023
Yinghai Lu7213d0f2004-12-03 03:39:04 +000024static struct device_operations lm63_operations = {
Edward O'Callaghan524625d2014-10-31 07:55:45 +110025 .read_resources = DEVICE_NOOP,
26 .set_resources = DEVICE_NOOP,
27 .enable_resources = DEVICE_NOOP,
Vikram Narayanan0786bc62011-12-26 22:52:01 +053028 .init = lm63_init,
Yinghai Lu7213d0f2004-12-03 03:39:04 +000029};
30
31static void enable_dev(struct device *dev)
32{
33 dev->ops = &lm63_operations;
34}
35
36struct chip_operations drivers_i2c_lm63_ops = {
Uwe Hermanna7aa29b2006-11-05 18:50:49 +000037 CHIP_NAME("National Semiconductor LM63")
Stefan Reinauer14e22772010-04-27 06:56:47 +000038 .enable_dev = enable_dev,
Yinghai Lu7213d0f2004-12-03 03:39:04 +000039};