2017-02-01 23:53:41 +07:00
|
|
|
/* FSI device & driver interfaces
|
|
|
|
*
|
|
|
|
* Copyright (C) IBM Corporation 2016
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef LINUX_FSI_H
|
|
|
|
#define LINUX_FSI_H
|
|
|
|
|
|
|
|
#include <linux/device.h>
|
|
|
|
|
2017-02-01 23:53:42 +07:00
|
|
|
struct fsi_device {
|
2017-02-01 23:53:43 +07:00
|
|
|
struct device dev;
|
|
|
|
u8 engine_type;
|
|
|
|
u8 version;
|
2017-06-07 04:08:44 +07:00
|
|
|
u8 unit;
|
|
|
|
struct fsi_slave *slave;
|
|
|
|
uint32_t addr;
|
|
|
|
uint32_t size;
|
2017-02-01 23:53:42 +07:00
|
|
|
};
|
|
|
|
|
2017-06-07 04:08:45 +07:00
|
|
|
extern int fsi_device_read(struct fsi_device *dev, uint32_t addr,
|
|
|
|
void *val, size_t size);
|
|
|
|
extern int fsi_device_write(struct fsi_device *dev, uint32_t addr,
|
|
|
|
const void *val, size_t size);
|
|
|
|
extern int fsi_device_peek(struct fsi_device *dev, void *val);
|
|
|
|
|
2017-02-01 23:53:43 +07:00
|
|
|
struct fsi_device_id {
|
|
|
|
u8 engine_type;
|
|
|
|
u8 version;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define FSI_VERSION_ANY 0
|
|
|
|
|
|
|
|
#define FSI_DEVICE(t) \
|
|
|
|
.engine_type = (t), .version = FSI_VERSION_ANY,
|
|
|
|
|
|
|
|
#define FSI_DEVICE_VERSIONED(t, v) \
|
|
|
|
.engine_type = (t), .version = (v),
|
|
|
|
|
2017-02-01 23:53:42 +07:00
|
|
|
struct fsi_driver {
|
2017-02-01 23:53:43 +07:00
|
|
|
struct device_driver drv;
|
|
|
|
const struct fsi_device_id *id_table;
|
2017-02-01 23:53:42 +07:00
|
|
|
};
|
|
|
|
|
|
|
|
#define to_fsi_dev(devp) container_of(devp, struct fsi_device, dev)
|
|
|
|
#define to_fsi_drv(drvp) container_of(drvp, struct fsi_driver, drv)
|
|
|
|
|
2017-02-01 23:53:41 +07:00
|
|
|
extern struct bus_type fsi_bus_type;
|
|
|
|
|
|
|
|
#endif /* LINUX_FSI_H */
|