linux/drivers/net/can/spi/hi311x.c

// SPDX-License-Identifier: GPL-2.0-only
/* CAN bus driver for Holt HI3110 CAN Controller with SPI Interface
 *
 * Copyright(C) Timesys Corporation 2016
 *
 * Based on Microchip 251x CAN Controller (mcp251x) Linux kernel driver
 * Copyright 2009 Christian Pellegrin EVOL S.r.l.
 * Copyright 2007 Raymarine UK, Ltd. All Rights Reserved.
 * Copyright 2006 Arcom Control Systems Ltd.
 *
 * Based on CAN bus driver for the CCAN controller written by
 * - Sascha Hauer, Marc Kleine-Budde, Pengutronix
 * - Simon Kallweit, intefo AG
 * Copyright 2007
 */

#include <linux/can/core.h>
#include <linux/can/dev.h>
#include <linux/clk.h>
#include <linux/completion.h>
#include <linux/delay.h>
#include <linux/device.h>
#include <linux/ethtool.h>
#include <linux/freezer.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/kernel.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/netdevice.h>
#include <linux/platform_device.h>
#include <linux/property.h>
#include <linux/regulator/consumer.h>
#include <linux/slab.h>
#include <linux/spi/spi.h>
#include <linux/uaccess.h>

#define HI3110_MASTER_RESET
#define HI3110_READ_CTRL0
#define HI3110_READ_CTRL1
#define HI3110_READ_STATF
#define HI3110_WRITE_CTRL0
#define HI3110_WRITE_CTRL1
#define HI3110_WRITE_INTE
#define HI3110_WRITE_BTR0
#define HI3110_WRITE_BTR1
#define HI3110_READ_BTR0
#define HI3110_READ_BTR1
#define HI3110_READ_INTF
#define HI3110_READ_ERR
#define HI3110_READ_FIFO_WOTIME
#define HI3110_WRITE_FIFO
#define HI3110_READ_MESSTAT
#define HI3110_READ_REC
#define HI3110_READ_TEC

#define HI3110_CTRL0_MODE_MASK
#define HI3110_CTRL0_NORMAL_MODE
#define HI3110_CTRL0_LOOPBACK_MODE
#define HI3110_CTRL0_MONITOR_MODE
#define HI3110_CTRL0_SLEEP_MODE
#define HI3110_CTRL0_INIT_MODE

#define HI3110_CTRL1_TXEN

#define HI3110_INT_RXTMP
#define HI3110_INT_RXFIFO
#define HI3110_INT_TXCPLT
#define HI3110_INT_BUSERR
#define HI3110_INT_MCHG
#define HI3110_INT_WAKEUP
#define HI3110_INT_F1MESS
#define HI3110_INT_F0MESS

#define HI3110_ERR_BUSOFF
#define HI3110_ERR_TXERRP
#define HI3110_ERR_RXERRP
#define HI3110_ERR_BITERR
#define HI3110_ERR_FRMERR
#define HI3110_ERR_CRCERR
#define HI3110_ERR_ACKERR
#define HI3110_ERR_STUFERR
#define HI3110_ERR_PROTOCOL_MASK
#define HI3110_ERR_PASSIVE_MASK

#define HI3110_STAT_RXFMTY
#define HI3110_STAT_BUSOFF
#define HI3110_STAT_ERRP
#define HI3110_STAT_ERRW
#define HI3110_STAT_TXMTY

#define HI3110_BTR0_SJW_SHIFT
#define HI3110_BTR0_BRP_SHIFT

#define HI3110_BTR1_SAMP_3PERBIT
#define HI3110_BTR1_SAMP_1PERBIT
#define HI3110_BTR1_TSEG2_SHIFT
#define HI3110_BTR1_TSEG1_SHIFT

#define HI3110_FIFO_WOTIME_TAG_OFF
#define HI3110_FIFO_WOTIME_ID_OFF
#define HI3110_FIFO_WOTIME_DLC_OFF
#define HI3110_FIFO_WOTIME_DAT_OFF

#define HI3110_FIFO_WOTIME_TAG_IDE
#define HI3110_FIFO_WOTIME_ID_RTR

#define HI3110_FIFO_TAG_OFF
#define HI3110_FIFO_ID_OFF
#define HI3110_FIFO_STD_DLC_OFF
#define HI3110_FIFO_STD_DATA_OFF
#define HI3110_FIFO_EXT_DLC_OFF
#define HI3110_FIFO_EXT_DATA_OFF

#define HI3110_CAN_MAX_DATA_LEN
#define HI3110_RX_BUF_LEN
#define HI3110_TX_STD_BUF_LEN
#define HI3110_TX_EXT_BUF_LEN
#define HI3110_CAN_FRAME_MAX_BITS
#define HI3110_EFF_FLAGS

#define HI3110_TX_ECHO_SKB_MAX

#define HI3110_OST_DELAY_MS

#define DEVICE_NAME

static const struct can_bittiming_const hi3110_bittiming_const =;

enum hi3110_model {};

struct hi3110_priv {};

static void hi3110_clean(struct net_device *net)
{}

/* Note about handling of error return of hi3110_spi_trans: accessing
 * registers via SPI is not really different conceptually than using
 * normal I/O assembler instructions, although it's much more
 * complicated from a practical POV. So it's not advisable to always
 * check the return value of this function. Imagine that every
 * read{b,l}, write{b,l} and friends would be bracketed in "if ( < 0)
 * error();", it would be a great mess (well there are some situation
 * when exception handling C++ like could be useful after all). So we
 * just check that transfers are OK at the beginning of our
 * conversation with the chip and to avoid doing really nasty things
 * (like injecting bogus packets in the network stack).
 */
static int hi3110_spi_trans(struct spi_device *spi, int len)
{}

static int hi3110_cmd(struct spi_device *spi, u8 command)
{}

static u8 hi3110_read(struct spi_device *spi, u8 command)
{}

static void hi3110_write(struct spi_device *spi, u8 reg, u8 val)
{}

static void hi3110_hw_tx_frame(struct spi_device *spi, u8 *buf, int len)
{}

static void hi3110_hw_tx(struct spi_device *spi, struct can_frame *frame)
{}

static void hi3110_hw_rx_frame(struct spi_device *spi, u8 *buf)
{}

static void hi3110_hw_rx(struct spi_device *spi)
{}

static void hi3110_hw_sleep(struct spi_device *spi)
{}

static netdev_tx_t hi3110_hard_start_xmit(struct sk_buff *skb,
					  struct net_device *net)
{}

static int hi3110_do_set_mode(struct net_device *net, enum can_mode mode)
{}

static int hi3110_get_berr_counter(const struct net_device *net,
				   struct can_berr_counter *bec)
{}

static int hi3110_set_normal_mode(struct spi_device *spi)
{}

static int hi3110_do_set_bittiming(struct net_device *net)
{}

static int hi3110_setup(struct net_device *net)
{}

static int hi3110_hw_reset(struct spi_device *spi)
{}

static int hi3110_hw_probe(struct spi_device *spi)
{}

static int hi3110_power_enable(struct regulator *reg, int enable)
{}

static int hi3110_stop(struct net_device *net)
{}

static void hi3110_tx_work_handler(struct work_struct *ws)
{}

static void hi3110_restart_work_handler(struct work_struct *ws)
{}

static irqreturn_t hi3110_can_ist(int irq, void *dev_id)
{}

static int hi3110_open(struct net_device *net)
{}

static const struct net_device_ops hi3110_netdev_ops =;

static const struct ethtool_ops hi3110_ethtool_ops =;

static const struct of_device_id hi3110_of_match[] =;
MODULE_DEVICE_TABLE(of, hi3110_of_match);

static const struct spi_device_id hi3110_id_table[] =;
MODULE_DEVICE_TABLE(spi, hi3110_id_table);

static int hi3110_can_probe(struct spi_device *spi)
{}

static void hi3110_can_remove(struct spi_device *spi)
{}

static int __maybe_unused hi3110_can_suspend(struct device *dev)
{}

static int __maybe_unused hi3110_can_resume(struct device *dev)
{}

static SIMPLE_DEV_PM_OPS(hi3110_can_pm_ops, hi3110_can_suspend, hi3110_can_resume);

static struct spi_driver hi3110_can_driver =;

module_spi_driver();

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