coreboot-v3/include/device/smbus.h
<<
>>
Prefs
   1/*
   2        This program is free software; you can redistribute it and/or modify
   3        it under the terms of the GNU General Public License as published by
   4        the Free Software Foundation; either version 2 of the License, or
   5        (at your option) any later version.
   6        
   7        This program is distributed in the hope that it will be useful,
   8        but WITHOUT ANY WARRANTY; without even the implied warranty of
   9        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  10        GNU General Public License for more details.
  11        
  12        You should have received a copy of the GNU General Public License
  13        along with this program; if not, write to the Free Software
  14        Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
  15
  16*/
  17
  18#ifndef DEVICE_SMBUS_H
  19#define DEVICE_SMBUS_H
  20
  21#include <device/device.h>
  22#include <device/path.h>
  23#include <device/smbus_def.h>
  24
  25/* Common smbus bus operations */
  26struct smbus_bus_operations {
  27        int (*quick_read)  (struct device *dev);
  28        int (*quick_write) (struct device *dev);
  29        int (*recv_byte)   (struct device *dev);
  30        int (*send_byte)   (struct device *dev, u8 value);
  31        int (*read_byte)   (struct device *dev, u8 addr);
  32        int (*write_byte)  (struct device *dev, u8 addr, u8 value);
  33        int (*read_word)   (struct device *dev, u8 addr);
  34        int (*write_word)  (struct device *dev, u8 addr, u16 value);
  35        int (*process_call)(struct device *dev, u8 cmd, u16 data);
  36        int (*block_read)  (struct device *dev, u8 cmd, u8 bytes, u8 *buffer);
  37        int (*block_write) (struct device *dev, u8 cmd, u8 bytes, const u8 *buffer);
  38};
  39
  40static inline const struct smbus_bus_operations *ops_smbus_bus(struct bus *bus)
  41{
  42        const struct smbus_bus_operations *bops;
  43        bops = 0;
  44        if (bus && bus->dev && bus->dev->ops) {
  45                bops = bus->dev->ops->ops_smbus_bus;
  46        }
  47        return bops;
  48}
  49struct bus *get_pbus_smbus(struct device *dev);
  50int smbus_set_link(struct device *dev);
  51
  52int smbus_quick_read(struct device *dev);
  53int smbus_quick_write(struct device *dev);
  54int smbus_recv_byte(struct device *dev);
  55int smbus_send_byte(struct device *dev, u8 byte);
  56int smbus_read_byte(struct device *dev, u8 addr);
  57int smbus_write_byte(struct device *dev, u8 addr, u8 val);
  58int smbus_read_word(struct device *dev, u8 addr);
  59int smbus_write_word(struct device *dev, u8 addr, u16 val);
  60int smbus_process_call(struct device *dev, u8 cmd, u16 data);
  61int smbus_block_read(struct device *dev, u8 cmd, u8 bytes, u8 *buffer);
  62int smbus_block_write(struct device *dev, u8 cmd, u8 bytes, const u8 *buffer);
  63
  64#endif /* DEVICE_SMBUS_H */
  65
lxr.linux.no kindly hosted by Redpill Linpro AS, provider of Linux consulting and operations services since 1995.