#include <linux/crc4.h>
#include <linux/device.h>
#include <linux/fsi.h>
#include <linux/idr.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/of_device.h>
#include <linux/slab.h>
#include <linux/bitops.h>
#include <linux/cdev.h>
#include <linux/fs.h>
#include <linux/uaccess.h>
#include "fsi-master.h"
#include "fsi-slave.h"
#define CREATE_TRACE_POINTS
#include <trace/events/fsi.h>
#define FSI_SLAVE_CONF_NEXT_MASK …
#define FSI_SLAVE_CONF_SLOTS_MASK …
#define FSI_SLAVE_CONF_SLOTS_SHIFT …
#define FSI_SLAVE_CONF_VERSION_MASK …
#define FSI_SLAVE_CONF_VERSION_SHIFT …
#define FSI_SLAVE_CONF_TYPE_MASK …
#define FSI_SLAVE_CONF_TYPE_SHIFT …
#define FSI_SLAVE_CONF_CRC_SHIFT …
#define FSI_SLAVE_CONF_CRC_MASK …
#define FSI_SLAVE_CONF_DATA_BITS …
#define FSI_PEEK_BASE …
static const int engine_page_size = …;
#define FSI_SLAVE_BASE …
#define FSI_SMODE …
#define FSI_SISC …
#define FSI_SSTAT …
#define FSI_SLBUS …
#define FSI_LLMODE …
#define FSI_SMODE_WSC …
#define FSI_SMODE_ECRC …
#define FSI_SMODE_SID_SHIFT …
#define FSI_SMODE_SID_MASK …
#define FSI_SMODE_ED_SHIFT …
#define FSI_SMODE_ED_MASK …
#define FSI_SMODE_SD_SHIFT …
#define FSI_SMODE_SD_MASK …
#define FSI_SMODE_LBCRR_SHIFT …
#define FSI_SMODE_LBCRR_MASK …
#define FSI_SLBUS_FORCE …
#define FSI_LLMODE_ASYNC …
#define FSI_SLAVE_SIZE_23b …
static DEFINE_IDA(master_ida);
static const int slave_retries = …;
static int discard_errors;
static dev_t fsi_base_dev;
static DEFINE_IDA(fsi_minor_ida);
#define FSI_CHAR_MAX_DEVICES …
#define FSI_CHAR_LEGACY_TOP …
static int fsi_master_read(struct fsi_master *master, int link,
uint8_t slave_id, uint32_t addr, void *val, size_t size);
static int fsi_master_write(struct fsi_master *master, int link,
uint8_t slave_id, uint32_t addr, const void *val, size_t size);
static int fsi_master_break(struct fsi_master *master, int link);
int fsi_device_read(struct fsi_device *dev, uint32_t addr, void *val,
size_t size)
{ … }
EXPORT_SYMBOL_GPL(…);
int fsi_device_write(struct fsi_device *dev, uint32_t addr, const void *val,
size_t size)
{ … }
EXPORT_SYMBOL_GPL(…);
int fsi_device_peek(struct fsi_device *dev, void *val)
{ … }
static void fsi_device_release(struct device *_device)
{ … }
static struct fsi_device *fsi_create_device(struct fsi_slave *slave)
{ … }
static int fsi_slave_calc_addr(struct fsi_slave *slave, uint32_t *addrp,
uint8_t *idp)
{ … }
static int fsi_slave_report_and_clear_errors(struct fsi_slave *slave)
{ … }
static inline uint32_t fsi_smode_echodly(int x)
{ … }
static inline uint32_t fsi_smode_senddly(int x)
{ … }
static inline uint32_t fsi_smode_lbcrr(int x)
{ … }
static inline uint32_t fsi_smode_sid(int x)
{ … }
static uint32_t fsi_slave_smode(int id, u8 t_senddly, u8 t_echodly)
{ … }
static int fsi_slave_set_smode(struct fsi_slave *slave)
{ … }
static int fsi_slave_handle_error(struct fsi_slave *slave, bool write,
uint32_t addr, size_t size)
{ … }
int fsi_slave_read(struct fsi_slave *slave, uint32_t addr,
void *val, size_t size)
{ … }
EXPORT_SYMBOL_GPL(…);
int fsi_slave_write(struct fsi_slave *slave, uint32_t addr,
const void *val, size_t size)
{ … }
EXPORT_SYMBOL_GPL(…);
int fsi_slave_claim_range(struct fsi_slave *slave,
uint32_t addr, uint32_t size)
{ … }
EXPORT_SYMBOL_GPL(…);
void fsi_slave_release_range(struct fsi_slave *slave,
uint32_t addr, uint32_t size)
{ … }
EXPORT_SYMBOL_GPL(…);
static bool fsi_device_node_matches(struct device *dev, struct device_node *np,
uint32_t addr, uint32_t size)
{ … }
static struct device_node *fsi_device_find_of_node(struct fsi_device *dev)
{ … }
static int fsi_slave_scan(struct fsi_slave *slave)
{ … }
static unsigned long aligned_access_size(size_t offset, size_t count)
{ … }
static ssize_t fsi_slave_sysfs_raw_read(struct file *file,
struct kobject *kobj, struct bin_attribute *attr, char *buf,
loff_t off, size_t count)
{ … }
static ssize_t fsi_slave_sysfs_raw_write(struct file *file,
struct kobject *kobj, struct bin_attribute *attr,
char *buf, loff_t off, size_t count)
{ … }
static const struct bin_attribute fsi_slave_raw_attr = …;
static void fsi_slave_release(struct device *dev)
{ … }
static bool fsi_slave_node_matches(struct device_node *np,
int link, uint8_t id)
{ … }
static struct device_node *fsi_slave_find_of_node(struct fsi_master *master,
int link, uint8_t id)
{ … }
static ssize_t cfam_read(struct file *filep, char __user *buf, size_t count,
loff_t *offset)
{ … }
static ssize_t cfam_write(struct file *filep, const char __user *buf,
size_t count, loff_t *offset)
{ … }
static loff_t cfam_llseek(struct file *file, loff_t offset, int whence)
{ … }
static int cfam_open(struct inode *inode, struct file *file)
{ … }
static const struct file_operations cfam_fops = …;
static ssize_t send_term_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static DEVICE_ATTR_WO(send_term);
static ssize_t slave_send_echo_show(struct device *dev,
struct device_attribute *attr,
char *buf)
{ … }
static ssize_t slave_send_echo_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count)
{ … }
static DEVICE_ATTR(send_echo_delays, 0600,
slave_send_echo_show, slave_send_echo_store);
static ssize_t chip_id_show(struct device *dev,
struct device_attribute *attr,
char *buf)
{ … }
static DEVICE_ATTR_RO(chip_id);
static ssize_t cfam_id_show(struct device *dev,
struct device_attribute *attr,
char *buf)
{ … }
static DEVICE_ATTR_RO(cfam_id);
static struct attribute *cfam_attr[] = …;
static const struct attribute_group cfam_attr_group = …;
static const struct attribute_group *cfam_attr_groups[] = …;
static char *cfam_devnode(const struct device *dev, umode_t *mode,
kuid_t *uid, kgid_t *gid)
{ … }
static const struct device_type cfam_type = …;
static char *fsi_cdev_devnode(const struct device *dev, umode_t *mode,
kuid_t *uid, kgid_t *gid)
{ … }
const struct device_type fsi_cdev_type = …;
EXPORT_SYMBOL_GPL(…);
static int fsi_adjust_index(int index)
{ … }
static int __fsi_get_new_minor(struct fsi_slave *slave, enum fsi_dev_type type,
dev_t *out_dev, int *out_index)
{ … }
static const char *const fsi_dev_type_names[] = …;
int fsi_get_new_minor(struct fsi_device *fdev, enum fsi_dev_type type,
dev_t *out_dev, int *out_index)
{ … }
EXPORT_SYMBOL_GPL(…);
void fsi_free_minor(dev_t dev)
{ … }
EXPORT_SYMBOL_GPL(…);
static int fsi_slave_init(struct fsi_master *master, int link, uint8_t id)
{ … }
static int fsi_check_access(uint32_t addr, size_t size)
{ … }
static int fsi_master_read(struct fsi_master *master, int link,
uint8_t slave_id, uint32_t addr, void *val, size_t size)
{ … }
static int fsi_master_write(struct fsi_master *master, int link,
uint8_t slave_id, uint32_t addr, const void *val, size_t size)
{ … }
static int fsi_master_link_disable(struct fsi_master *master, int link)
{ … }
static int fsi_master_link_enable(struct fsi_master *master, int link)
{ … }
static int fsi_master_break(struct fsi_master *master, int link)
{ … }
static int fsi_master_scan(struct fsi_master *master)
{ … }
static int fsi_slave_remove_device(struct device *dev, void *arg)
{ … }
static int fsi_master_remove_slave(struct device *dev, void *arg)
{ … }
static void fsi_master_unscan(struct fsi_master *master)
{ … }
int fsi_master_rescan(struct fsi_master *master)
{ … }
EXPORT_SYMBOL_GPL(…);
static ssize_t master_rescan_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count)
{ … }
static DEVICE_ATTR(rescan, 0200, NULL, master_rescan_store);
static ssize_t master_break_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count)
{ … }
static DEVICE_ATTR(break, 0200, NULL, master_break_store);
static struct attribute *master_attrs[] = …;
ATTRIBUTE_GROUPS(…);
static struct class fsi_master_class = …;
int fsi_master_register(struct fsi_master *master)
{ … }
EXPORT_SYMBOL_GPL(…);
void fsi_master_unregister(struct fsi_master *master)
{ … }
EXPORT_SYMBOL_GPL(…);
static int fsi_bus_match(struct device *dev, const struct device_driver *drv)
{ … }
int fsi_driver_register(struct fsi_driver *fsi_drv)
{ … }
EXPORT_SYMBOL_GPL(…);
void fsi_driver_unregister(struct fsi_driver *fsi_drv)
{ … }
EXPORT_SYMBOL_GPL(…);
struct bus_type fsi_bus_type = …;
EXPORT_SYMBOL_GPL(…);
static int __init fsi_init(void)
{ … }
postcore_initcall(fsi_init);
static void fsi_exit(void)
{ … }
module_exit(fsi_exit);
module_param(discard_errors, int, 0664);
MODULE_LICENSE(…) …;
MODULE_PARM_DESC(…) …;