linux/drivers/net/can/ifi_canfd/ifi_canfd.c

/*
 * CAN bus driver for IFI CANFD controller
 *
 * Copyright (C) 2016 Marek Vasut <[email protected]>
 *
 * Details about this controller can be found at
 * http://www.ifi-pld.de/IP/CANFD/canfd.html
 *
 * This file is licensed under the terms of the GNU General Public
 * License version 2. This program is licensed "as is" without any
 * warranty of any kind, whether express or implied.
 */

#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/ethtool.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/netdevice.h>
#include <linux/of.h>
#include <linux/platform_device.h>

#include <linux/can/dev.h>

#define IFI_CANFD_STCMD
#define IFI_CANFD_STCMD_HARDRESET
#define IFI_CANFD_STCMD_ENABLE
#define IFI_CANFD_STCMD_ERROR_ACTIVE
#define IFI_CANFD_STCMD_ERROR_PASSIVE
#define IFI_CANFD_STCMD_BUSOFF
#define IFI_CANFD_STCMD_ERROR_WARNING
#define IFI_CANFD_STCMD_BUSMONITOR
#define IFI_CANFD_STCMD_LOOPBACK
#define IFI_CANFD_STCMD_DISABLE_CANFD
#define IFI_CANFD_STCMD_ENABLE_ISO
#define IFI_CANFD_STCMD_ENABLE_7_9_8_8_TIMING
#define IFI_CANFD_STCMD_NORMAL_MODE

#define IFI_CANFD_RXSTCMD
#define IFI_CANFD_RXSTCMD_REMOVE_MSG
#define IFI_CANFD_RXSTCMD_RESET
#define IFI_CANFD_RXSTCMD_EMPTY
#define IFI_CANFD_RXSTCMD_OVERFLOW

#define IFI_CANFD_TXSTCMD
#define IFI_CANFD_TXSTCMD_ADD_MSG
#define IFI_CANFD_TXSTCMD_HIGH_PRIO
#define IFI_CANFD_TXSTCMD_RESET
#define IFI_CANFD_TXSTCMD_EMPTY
#define IFI_CANFD_TXSTCMD_FULL
#define IFI_CANFD_TXSTCMD_OVERFLOW

#define IFI_CANFD_INTERRUPT
#define IFI_CANFD_INTERRUPT_ERROR_BUSOFF
#define IFI_CANFD_INTERRUPT_ERROR_WARNING
#define IFI_CANFD_INTERRUPT_ERROR_STATE_CHG
#define IFI_CANFD_INTERRUPT_ERROR_REC_TEC_INC
#define IFI_CANFD_INTERRUPT_ERROR_COUNTER
#define IFI_CANFD_INTERRUPT_TXFIFO_EMPTY
#define IFI_CANFD_INTERRUPT_TXFIFO_REMOVE
#define IFI_CANFD_INTERRUPT_RXFIFO_NEMPTY
#define IFI_CANFD_INTERRUPT_RXFIFO_NEMPTY_PER
#define IFI_CANFD_INTERRUPT_SET_IRQ

#define IFI_CANFD_IRQMASK
#define IFI_CANFD_IRQMASK_ERROR_BUSOFF
#define IFI_CANFD_IRQMASK_ERROR_WARNING
#define IFI_CANFD_IRQMASK_ERROR_STATE_CHG
#define IFI_CANFD_IRQMASK_ERROR_REC_TEC_INC
#define IFI_CANFD_IRQMASK_SET_ERR
#define IFI_CANFD_IRQMASK_SET_TS
#define IFI_CANFD_IRQMASK_TXFIFO_EMPTY
#define IFI_CANFD_IRQMASK_SET_TX
#define IFI_CANFD_IRQMASK_RXFIFO_NEMPTY
#define IFI_CANFD_IRQMASK_SET_RX

#define IFI_CANFD_TIME
#define IFI_CANFD_FTIME
#define IFI_CANFD_TIME_TIMEB_OFF
#define IFI_CANFD_TIME_TIMEA_OFF
#define IFI_CANFD_TIME_PRESCALE_OFF
#define IFI_CANFD_TIME_SJW_OFF_7_9_8_8
#define IFI_CANFD_TIME_SJW_OFF_4_12_6_6
#define IFI_CANFD_TIME_SET_SJW_4_12_6_6
#define IFI_CANFD_TIME_SET_TIMEB_4_12_6_6
#define IFI_CANFD_TIME_SET_PRESC_4_12_6_6
#define IFI_CANFD_TIME_SET_TIMEA_4_12_6_6

#define IFI_CANFD_TDELAY
#define IFI_CANFD_TDELAY_DEFAULT
#define IFI_CANFD_TDELAY_MASK
#define IFI_CANFD_TDELAY_ABS
#define IFI_CANFD_TDELAY_EN

#define IFI_CANFD_ERROR
#define IFI_CANFD_ERROR_TX_OFFSET
#define IFI_CANFD_ERROR_TX_MASK
#define IFI_CANFD_ERROR_RX_OFFSET
#define IFI_CANFD_ERROR_RX_MASK

#define IFI_CANFD_ERRCNT

#define IFI_CANFD_SUSPEND

#define IFI_CANFD_REPEAT

#define IFI_CANFD_TRAFFIC

#define IFI_CANFD_TSCONTROL

#define IFI_CANFD_TSC

#define IFI_CANFD_TST

#define IFI_CANFD_RES1

#define IFI_CANFD_ERROR_CTR
#define IFI_CANFD_ERROR_CTR_UNLOCK_MAGIC
#define IFI_CANFD_ERROR_CTR_OVERLOAD_FIRST
#define IFI_CANFD_ERROR_CTR_ACK_ERROR_FIRST
#define IFI_CANFD_ERROR_CTR_BIT0_ERROR_FIRST
#define IFI_CANFD_ERROR_CTR_BIT1_ERROR_FIRST
#define IFI_CANFD_ERROR_CTR_STUFF_ERROR_FIRST
#define IFI_CANFD_ERROR_CTR_CRC_ERROR_FIRST
#define IFI_CANFD_ERROR_CTR_FORM_ERROR_FIRST
#define IFI_CANFD_ERROR_CTR_OVERLOAD_ALL
#define IFI_CANFD_ERROR_CTR_ACK_ERROR_ALL
#define IFI_CANFD_ERROR_CTR_BIT0_ERROR_ALL
#define IFI_CANFD_ERROR_CTR_BIT1_ERROR_ALL
#define IFI_CANFD_ERROR_CTR_STUFF_ERROR_ALL
#define IFI_CANFD_ERROR_CTR_CRC_ERROR_ALL
#define IFI_CANFD_ERROR_CTR_FORM_ERROR_ALL
#define IFI_CANFD_ERROR_CTR_BITPOSITION_OFFSET
#define IFI_CANFD_ERROR_CTR_BITPOSITION_MASK
#define IFI_CANFD_ERROR_CTR_ER_RESET
#define IFI_CANFD_ERROR_CTR_ER_ENABLE

#define IFI_CANFD_PAR

#define IFI_CANFD_CANCLOCK

#define IFI_CANFD_SYSCLOCK

#define IFI_CANFD_VER
#define IFI_CANFD_VER_REV_MASK
#define IFI_CANFD_VER_REV_MIN_SUPPORTED

#define IFI_CANFD_IP_ID
#define IFI_CANFD_IP_ID_VALUE

#define IFI_CANFD_TEST

#define IFI_CANFD_RXFIFO_TS_63_32

#define IFI_CANFD_RXFIFO_TS_31_0

#define IFI_CANFD_RXFIFO_DLC
#define IFI_CANFD_RXFIFO_DLC_DLC_OFFSET
#define IFI_CANFD_RXFIFO_DLC_DLC_MASK
#define IFI_CANFD_RXFIFO_DLC_RTR
#define IFI_CANFD_RXFIFO_DLC_EDL
#define IFI_CANFD_RXFIFO_DLC_BRS
#define IFI_CANFD_RXFIFO_DLC_ESI
#define IFI_CANFD_RXFIFO_DLC_OBJ_OFFSET
#define IFI_CANFD_RXFIFO_DLC_OBJ_MASK
#define IFI_CANFD_RXFIFO_DLC_FNR_OFFSET
#define IFI_CANFD_RXFIFO_DLC_FNR_MASK

#define IFI_CANFD_RXFIFO_ID
#define IFI_CANFD_RXFIFO_ID_ID_OFFSET
#define IFI_CANFD_RXFIFO_ID_ID_STD_MASK
#define IFI_CANFD_RXFIFO_ID_ID_STD_OFFSET
#define IFI_CANFD_RXFIFO_ID_ID_STD_WIDTH
#define IFI_CANFD_RXFIFO_ID_ID_XTD_MASK
#define IFI_CANFD_RXFIFO_ID_ID_XTD_OFFSET
#define IFI_CANFD_RXFIFO_ID_ID_XTD_WIDTH
#define IFI_CANFD_RXFIFO_ID_IDE

#define IFI_CANFD_RXFIFO_DATA

#define IFI_CANFD_TXFIFO_SUSPEND_US

#define IFI_CANFD_TXFIFO_REPEATCOUNT

#define IFI_CANFD_TXFIFO_DLC
#define IFI_CANFD_TXFIFO_DLC_DLC_OFFSET
#define IFI_CANFD_TXFIFO_DLC_DLC_MASK
#define IFI_CANFD_TXFIFO_DLC_RTR
#define IFI_CANFD_TXFIFO_DLC_EDL
#define IFI_CANFD_TXFIFO_DLC_BRS
#define IFI_CANFD_TXFIFO_DLC_FNR_OFFSET
#define IFI_CANFD_TXFIFO_DLC_FNR_MASK

#define IFI_CANFD_TXFIFO_ID
#define IFI_CANFD_TXFIFO_ID_ID_OFFSET
#define IFI_CANFD_TXFIFO_ID_ID_STD_MASK
#define IFI_CANFD_TXFIFO_ID_ID_STD_OFFSET
#define IFI_CANFD_TXFIFO_ID_ID_STD_WIDTH
#define IFI_CANFD_TXFIFO_ID_ID_XTD_MASK
#define IFI_CANFD_TXFIFO_ID_ID_XTD_OFFSET
#define IFI_CANFD_TXFIFO_ID_ID_XTD_WIDTH
#define IFI_CANFD_TXFIFO_ID_IDE

#define IFI_CANFD_TXFIFO_DATA

#define IFI_CANFD_FILTER_MASK(n)
#define IFI_CANFD_FILTER_MASK_EXT
#define IFI_CANFD_FILTER_MASK_EDL
#define IFI_CANFD_FILTER_MASK_VALID

#define IFI_CANFD_FILTER_IDENT(n)
#define IFI_CANFD_FILTER_IDENT_IDE
#define IFI_CANFD_FILTER_IDENT_CANFD
#define IFI_CANFD_FILTER_IDENT_VALID

/* IFI CANFD private data structure */
struct ifi_canfd_priv {};

static void ifi_canfd_irq_enable(struct net_device *ndev, bool enable)
{}

static void ifi_canfd_read_fifo(struct net_device *ndev)
{}

static int ifi_canfd_do_rx_poll(struct net_device *ndev, int quota)
{}

static int ifi_canfd_handle_lost_msg(struct net_device *ndev)
{}

static int ifi_canfd_handle_lec_err(struct net_device *ndev)
{}

static int ifi_canfd_get_berr_counter(const struct net_device *ndev,
				      struct can_berr_counter *bec)
{}

static int ifi_canfd_handle_state_change(struct net_device *ndev,
					 enum can_state new_state)
{}

static int ifi_canfd_handle_state_errors(struct net_device *ndev)
{}

static int ifi_canfd_poll(struct napi_struct *napi, int quota)
{}

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

static const struct can_bittiming_const ifi_canfd_bittiming_const =;

static void ifi_canfd_set_bittiming(struct net_device *ndev)
{}

static void ifi_canfd_set_filter(struct net_device *ndev, const u32 id,
				 const u32 mask, const u32 ident)
{}

static void ifi_canfd_set_filters(struct net_device *ndev)
{}

static void ifi_canfd_start(struct net_device *ndev)
{}

static void ifi_canfd_stop(struct net_device *ndev)
{}

static int ifi_canfd_set_mode(struct net_device *ndev, enum can_mode mode)
{}

static int ifi_canfd_open(struct net_device *ndev)
{}

static int ifi_canfd_close(struct net_device *ndev)
{}

static netdev_tx_t ifi_canfd_start_xmit(struct sk_buff *skb,
					struct net_device *ndev)
{}

static const struct net_device_ops ifi_canfd_netdev_ops =;

static const struct ethtool_ops ifi_canfd_ethtool_ops =;

static int ifi_canfd_plat_probe(struct platform_device *pdev)
{}

static void ifi_canfd_plat_remove(struct platform_device *pdev)
{}

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

static struct platform_driver ifi_canfd_plat_driver =;

module_platform_driver();

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