1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /* FSI device & driver interfaces
4 * Copyright (C) IBM Corporation 2016
10 #include <linux/device.h>
17 struct fsi_slave *slave;
22 extern int fsi_device_read(struct fsi_device *dev, uint32_t addr,
23 void *val, size_t size);
24 extern int fsi_device_write(struct fsi_device *dev, uint32_t addr,
25 const void *val, size_t size);
26 extern int fsi_device_peek(struct fsi_device *dev, void *val);
28 struct fsi_device_id {
33 #define FSI_VERSION_ANY 0
35 #define FSI_DEVICE(t) \
36 .engine_type = (t), .version = FSI_VERSION_ANY,
38 #define FSI_DEVICE_VERSIONED(t, v) \
39 .engine_type = (t), .version = (v),
42 struct device_driver drv;
43 const struct fsi_device_id *id_table;
46 #define to_fsi_dev(devp) container_of(devp, struct fsi_device, dev)
47 #define to_fsi_drv(drvp) container_of(drvp, struct fsi_driver, drv)
49 extern int fsi_driver_register(struct fsi_driver *fsi_drv);
50 extern void fsi_driver_unregister(struct fsi_driver *fsi_drv);
52 /* module_fsi_driver() - Helper macro for drivers that don't do
53 * anything special in module init/exit. This eliminates a lot of
54 * boilerplate. Each module may only use this macro once, and
55 * calling it replaces module_init() and module_exit()
57 #define module_fsi_driver(__fsi_driver) \
58 module_driver(__fsi_driver, fsi_driver_register, \
59 fsi_driver_unregister)
61 /* direct slave API */
62 extern int fsi_slave_claim_range(struct fsi_slave *slave,
63 uint32_t addr, uint32_t size);
64 extern void fsi_slave_release_range(struct fsi_slave *slave,
65 uint32_t addr, uint32_t size);
66 extern int fsi_slave_read(struct fsi_slave *slave, uint32_t addr,
67 void *val, size_t size);
68 extern int fsi_slave_write(struct fsi_slave *slave, uint32_t addr,
69 const void *val, size_t size);
71 extern struct bus_type fsi_bus_type;
72 extern const struct device_type fsi_cdev_type;
81 extern int fsi_get_new_minor(struct fsi_device *fdev, enum fsi_dev_type type,
82 dev_t *out_dev, int *out_index);
83 extern void fsi_free_minor(dev_t dev);
85 #endif /* LINUX_FSI_H */