#include <linux/crc4.h>
#include <linux/delay.h>
#include <linux/device.h>
#include <linux/fsi.h>
#include <linux/gpio/consumer.h>
#include <linux/io.h>
#include <linux/irqflags.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
#include "fsi-master.h"
#define FSI_GPIO_STD_DLY …
#define LAST_ADDR_INVALID …
struct fsi_master_gpio { … };
#define CREATE_TRACE_POINTS
#include <trace/events/fsi_master_gpio.h>
#define to_fsi_master_gpio(m) …
struct fsi_gpio_msg { … };
static void clock_toggle(struct fsi_master_gpio *master, int count)
{ … }
static int sda_clock_in(struct fsi_master_gpio *master)
{ … }
static void sda_out(struct fsi_master_gpio *master, int value)
{ … }
static void set_sda_input(struct fsi_master_gpio *master)
{ … }
static void set_sda_output(struct fsi_master_gpio *master, int value)
{ … }
static void clock_zeros(struct fsi_master_gpio *master, int count)
{ … }
static void echo_delay(struct fsi_master_gpio *master)
{ … }
static void serial_in(struct fsi_master_gpio *master, struct fsi_gpio_msg *msg,
uint8_t num_bits)
{ … }
static void serial_out(struct fsi_master_gpio *master,
const struct fsi_gpio_msg *cmd)
{ … }
static void msg_push_bits(struct fsi_gpio_msg *msg, uint64_t data, int bits)
{ … }
static void msg_push_crc(struct fsi_gpio_msg *msg)
{ … }
static bool check_same_address(struct fsi_master_gpio *master, int id,
uint32_t addr)
{ … }
static bool check_relative_address(struct fsi_master_gpio *master, int id,
uint32_t addr, uint32_t *rel_addrp)
{ … }
static void last_address_update(struct fsi_master_gpio *master,
int id, bool valid, uint32_t addr)
{ … }
static void build_ar_command(struct fsi_master_gpio *master,
struct fsi_gpio_msg *cmd, uint8_t id,
uint32_t addr, size_t size, const void *data)
{ … }
static void build_dpoll_command(struct fsi_gpio_msg *cmd, uint8_t slave_id)
{ … }
static void build_epoll_command(struct fsi_gpio_msg *cmd, uint8_t slave_id)
{ … }
static void build_term_command(struct fsi_gpio_msg *cmd, uint8_t slave_id)
{ … }
static int read_one_response(struct fsi_master_gpio *master,
uint8_t data_size, struct fsi_gpio_msg *msgp, uint8_t *tagp)
{ … }
static int issue_term(struct fsi_master_gpio *master, uint8_t slave)
{ … }
static int poll_for_response(struct fsi_master_gpio *master,
uint8_t slave, uint8_t size, void *data)
{ … }
static int send_request(struct fsi_master_gpio *master,
struct fsi_gpio_msg *cmd)
{ … }
static int fsi_master_gpio_xfer(struct fsi_master_gpio *master, uint8_t slave,
struct fsi_gpio_msg *cmd, size_t resp_len, void *resp)
{ … }
static int fsi_master_gpio_read(struct fsi_master *_master, int link,
uint8_t id, uint32_t addr, void *val, size_t size)
{ … }
static int fsi_master_gpio_write(struct fsi_master *_master, int link,
uint8_t id, uint32_t addr, const void *val, size_t size)
{ … }
static int fsi_master_gpio_term(struct fsi_master *_master,
int link, uint8_t id)
{ … }
static int fsi_master_gpio_break(struct fsi_master *_master, int link)
{ … }
static void fsi_master_gpio_init(struct fsi_master_gpio *master)
{ … }
static void fsi_master_gpio_init_external(struct fsi_master_gpio *master)
{ … }
static int fsi_master_gpio_link_enable(struct fsi_master *_master, int link,
bool enable)
{ … }
static int fsi_master_gpio_link_config(struct fsi_master *_master, int link,
u8 t_send_delay, u8 t_echo_delay)
{ … }
static ssize_t external_mode_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static ssize_t external_mode_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count)
{ … }
static DEVICE_ATTR(external_mode, 0664,
external_mode_show, external_mode_store);
static void fsi_master_gpio_release(struct device *dev)
{ … }
static int fsi_master_gpio_probe(struct platform_device *pdev)
{ … }
static void fsi_master_gpio_remove(struct platform_device *pdev)
{ … }
static const struct of_device_id fsi_master_gpio_match[] = …;
MODULE_DEVICE_TABLE(of, fsi_master_gpio_match);
static struct platform_driver fsi_master_gpio_driver = …;
module_platform_driver(…) …;
MODULE_LICENSE(…) …;