linux/drivers/misc/c2port/core.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 *  Silicon Labs C2 port core Linux support
 *
 *  Copyright (c) 2007 Rodolfo Giometti <[email protected]>
 *  Copyright (c) 2007 Eurotech S.p.A. <[email protected]>
 */

#include <linux/module.h>
#include <linux/init.h>
#include <linux/device.h>
#include <linux/errno.h>
#include <linux/err.h>
#include <linux/kernel.h>
#include <linux/ctype.h>
#include <linux/delay.h>
#include <linux/idr.h>
#include <linux/sched.h>
#include <linux/slab.h>

#include <linux/c2port.h>

#define DRIVER_NAME
#define DRIVER_VERSION

static DEFINE_SPINLOCK(c2port_idr_lock);
static DEFINE_IDR(c2port_idr);

/*
 * Local variables
 */

static struct class *c2port_class;

/*
 * C2 registers & commands defines
 */

/* C2 registers */
#define C2PORT_DEVICEID
#define C2PORT_REVID
#define C2PORT_FPCTL
#define C2PORT_FPDAT

/* C2 interface commands */
#define C2PORT_GET_VERSION
#define C2PORT_DEVICE_ERASE
#define C2PORT_BLOCK_READ
#define C2PORT_BLOCK_WRITE
#define C2PORT_PAGE_ERASE

/* C2 status return codes */
#define C2PORT_INVALID_COMMAND
#define C2PORT_COMMAND_FAILED
#define C2PORT_COMMAND_OK

/*
 * C2 port low level signal managements
 */

static void c2port_reset(struct c2port_device *dev)
{}

static void c2port_strobe_ck(struct c2port_device *dev)
{}

/*
 * C2 port basic functions
 */

static void c2port_write_ar(struct c2port_device *dev, u8 addr)
{}

static int c2port_read_ar(struct c2port_device *dev, u8 *addr)
{}

static int c2port_write_dr(struct c2port_device *dev, u8 data)
{}

static int c2port_read_dr(struct c2port_device *dev, u8 *data)
{}

static int c2port_poll_in_busy(struct c2port_device *dev)
{}

static int c2port_poll_out_ready(struct c2port_device *dev)
{}

/*
 * sysfs methods
 */

static ssize_t c2port_show_name(struct device *dev,
				struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR(name, 0444, c2port_show_name, NULL);

static ssize_t c2port_show_flash_blocks_num(struct device *dev,
				struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR(flash_blocks_num, 0444, c2port_show_flash_blocks_num, NULL);

static ssize_t c2port_show_flash_block_size(struct device *dev,
				struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR(flash_block_size, 0444, c2port_show_flash_block_size, NULL);

static ssize_t c2port_show_flash_size(struct device *dev,
				struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR(flash_size, 0444, c2port_show_flash_size, NULL);

static ssize_t access_show(struct device *dev, struct device_attribute *attr,
			   char *buf)
{}

static ssize_t access_store(struct device *dev, struct device_attribute *attr,
			    const char *buf, size_t count)
{}
static DEVICE_ATTR_RW(access);

static ssize_t c2port_store_reset(struct device *dev,
				struct device_attribute *attr,
				const char *buf, size_t count)
{}
static DEVICE_ATTR(reset, 0200, NULL, c2port_store_reset);

static ssize_t __c2port_show_dev_id(struct c2port_device *dev, char *buf)
{}

static ssize_t c2port_show_dev_id(struct device *dev,
				struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR(dev_id, 0444, c2port_show_dev_id, NULL);

static ssize_t __c2port_show_rev_id(struct c2port_device *dev, char *buf)
{}

static ssize_t c2port_show_rev_id(struct device *dev,
				struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR(rev_id, 0444, c2port_show_rev_id, NULL);

static ssize_t c2port_show_flash_access(struct device *dev,
				struct device_attribute *attr, char *buf)
{}

static ssize_t __c2port_store_flash_access(struct c2port_device *dev,
						int status)
{}

static ssize_t c2port_store_flash_access(struct device *dev,
				struct device_attribute *attr,
				const char *buf, size_t count)
{}
static DEVICE_ATTR(flash_access, 0644, c2port_show_flash_access,
		   c2port_store_flash_access);

static ssize_t __c2port_write_flash_erase(struct c2port_device *dev)
{}

static ssize_t c2port_store_flash_erase(struct device *dev,
				struct device_attribute *attr,
				const char *buf, size_t count)
{}
static DEVICE_ATTR(flash_erase, 0200, NULL, c2port_store_flash_erase);

static ssize_t __c2port_read_flash_data(struct c2port_device *dev,
				char *buffer, loff_t offset, size_t count)
{}

static ssize_t c2port_read_flash_data(struct file *filp, struct kobject *kobj,
				struct bin_attribute *attr,
				char *buffer, loff_t offset, size_t count)
{}

static ssize_t __c2port_write_flash_data(struct c2port_device *dev,
				char *buffer, loff_t offset, size_t count)
{}

static ssize_t c2port_write_flash_data(struct file *filp, struct kobject *kobj,
				struct bin_attribute *attr,
				char *buffer, loff_t offset, size_t count)
{}
/* size is computed at run-time */
static BIN_ATTR(flash_data, 0644, c2port_read_flash_data,
		c2port_write_flash_data, 0);

/*
 * Class attributes
 */
static struct attribute *c2port_attrs[] =;

static struct bin_attribute *c2port_bin_attrs[] =;

static const struct attribute_group c2port_group =;

static const struct attribute_group *c2port_groups[] =;

/*
 * Exported functions
 */

struct c2port_device *c2port_device_register(char *name,
					struct c2port_ops *ops, void *devdata)
{}
EXPORT_SYMBOL();

void c2port_device_unregister(struct c2port_device *c2dev)
{}
EXPORT_SYMBOL();

/*
 * Module stuff
 */

static int __init c2port_init(void)
{}

static void __exit c2port_exit(void)
{}

module_init();
module_exit(c2port_exit);

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();