i2c mux support
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@1809 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
diff --git a/src/include/device/device.h b/src/include/device/device.h
index 167a518..253ec97 100644
--- a/src/include/device/device.h
+++ b/src/include/device/device.h
@@ -33,6 +33,7 @@
void (*init)(device_t dev);
unsigned int (*scan_bus)(device_t bus, unsigned int max);
void (*enable)(device_t dev);
+ void (*set_link)(device_t dev, unsigned int link);
const struct pci_operations *ops_pci;
const struct smbus_bus_operations *ops_smbus_bus;
const struct pci_bus_operations *ops_pci_bus;
@@ -50,7 +51,7 @@
};
#define MAX_RESOURCES 12
-#define MAX_LINKS 4
+#define MAX_LINKS 8
/*
* There is one device structure for each slot-number/function-number
* combination:
diff --git a/src/include/device/smbus.h b/src/include/device/smbus.h
index 40e49ee..148c4d7 100644
--- a/src/include/device/smbus.h
+++ b/src/include/device/smbus.h
@@ -21,50 +21,29 @@
int (*block_write) (device_t dev, uint8_t cmd, uint8_t bytes, const uint8_t *buffer);
};
-static inline int smbus_quick_read(device_t dev)
+static inline const struct smbus_bus_operations *ops_smbus_bus(struct bus *bus)
{
- return dev->bus->dev->ops->ops_smbus_bus->quick_read(dev);
+ const struct smbus_bus_operations *bops;
+ bops = 0;
+ if (bus && bus->dev && bus->dev->ops) {
+ bops = bus->dev->ops->ops_smbus_bus;
+ }
+ return bops;
}
-static inline int smbus_quick_write(device_t dev)
-{
- return dev->bus->dev->ops->ops_smbus_bus->quick_write(dev);
-}
-static inline int smbus_recv_byte(device_t dev)
-{
- return dev->bus->dev->ops->ops_smbus_bus->recv_byte(dev);
-}
-static inline int smbus_send_byte(device_t dev, uint8_t byte)
-{
- return dev->bus->dev->ops->ops_smbus_bus->send_byte(dev, byte);
-}
-static inline int smbus_read_byte(device_t dev, uint8_t addr)
-{
- return dev->bus->dev->ops->ops_smbus_bus->read_byte(dev, addr);
-}
-static inline int smbus_write_byte(device_t dev, uint8_t addr, uint8_t val)
-{
- return dev->bus->dev->ops->ops_smbus_bus->write_byte(dev, addr, val);
-}
-static inline int smbus_read_word(device_t dev, uint8_t addr)
-{
- return dev->bus->dev->ops->ops_smbus_bus->read_word(dev, addr);
-}
-static inline int smbus_write_word(device_t dev, uint8_t addr, uint16_t val)
-{
- return dev->bus->dev->ops->ops_smbus_bus->write_word(dev, addr, val);
-}
-static inline int smbus_process_call(device_t dev, uint8_t cmd, uint16_t data)
-{
- return dev->bus->dev->ops->ops_smbus_bus->process_call(dev, cmd, data);
-}
-static inline int smbus_block_read(device_t dev, uint8_t cmd, uint8_t bytes, uint8_t *buffer)
-{
- return dev->bus->dev->ops->ops_smbus_bus->block_read(dev, cmd, bytes, buffer);
-}
-static inline int smbus_block_write(device_t dev, uint8_t cmd, uint8_t bytes, const uint8_t *buffer)
-{
- return dev->bus->dev->ops->ops_smbus_bus->block_write(dev, cmd, bytes, buffer);
-}
+struct bus *get_pbus_smbus(device_t dev);
+int smbus_set_link(device_t dev);
+
+int smbus_quick_read(device_t dev);
+int smbus_quick_write(device_t dev);
+int smbus_recv_byte(device_t dev);
+int smbus_send_byte(device_t dev, uint8_t byte);
+int smbus_read_byte(device_t dev, uint8_t addr);
+int smbus_write_byte(device_t dev, uint8_t addr, uint8_t val);
+int smbus_read_word(device_t dev, uint8_t addr);
+int smbus_write_word(device_t dev, uint8_t addr, uint16_t val);
+int smbus_process_call(device_t dev, uint8_t cmd, uint16_t data);
+int smbus_block_read(device_t dev, uint8_t cmd, uint8_t bytes, uint8_t *buffer);
+int smbus_block_write(device_t dev, uint8_t cmd, uint8_t bytes, const uint8_t *buffer);
#endif /* DEVICE_SMBUS_H */