linux/drivers/net/can/rockchip/rockchip_canfd-core.c

// SPDX-License-Identifier: GPL-2.0
//
// Copyright (c) 2023, 2024 Pengutronix,
//               Marc Kleine-Budde <[email protected]>
//
// Based on:
//
// Rockchip CANFD driver
//
// Copyright (c) 2020 Rockchip Electronics Co. Ltd.
//

#include <linux/delay.h>
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <linux/string.h>

#include "rockchip_canfd.h"

static const struct rkcanfd_devtype_data rkcanfd_devtype_data_rk3568v2 =;

/* The rk3568 CAN-FD errata sheet as of Tue 07 Nov 2023 11:25:31 +08:00
 * states that only the rk3568v2 is affected by erratum 5, but tests
 * with the rk3568v2 and rk3568v3 show that the RX_FIFO_CNT is
 * sometimes too high. In contrast to the errata sheet mark rk3568v3
 * as effected by erratum 5, too.
 */
static const struct rkcanfd_devtype_data rkcanfd_devtype_data_rk3568v3 =;

static const char *__rkcanfd_get_model_str(enum rkcanfd_model model)
{}

static inline const char *
rkcanfd_get_model_str(const struct rkcanfd_priv *priv)
{}

/* Note:
 *
 * The formula to calculate the CAN System Clock is:
 *
 * Tsclk = 2 x Tclk x (brp + 1)
 *
 * Double the data sheet's brp_min, brp_max and brp_inc values (both
 * for the arbitration and data bit timing) to take the "2 x" into
 * account.
 */
static const struct can_bittiming_const rkcanfd_bittiming_const =;

static const struct can_bittiming_const rkcanfd_data_bittiming_const =;

static void rkcanfd_chip_set_reset_mode(const struct rkcanfd_priv *priv)
{}

static void rkcanfd_chip_set_work_mode(const struct rkcanfd_priv *priv)
{}

static int rkcanfd_set_bittiming(struct rkcanfd_priv *priv)
{}

static void rkcanfd_get_berr_counter_corrected(struct rkcanfd_priv *priv,
					       struct can_berr_counter *bec)
{}

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

static void rkcanfd_chip_interrupts_enable(const struct rkcanfd_priv *priv)
{}

static void rkcanfd_chip_interrupts_disable(const struct rkcanfd_priv *priv)
{}

static void rkcanfd_chip_fifo_setup(struct rkcanfd_priv *priv)
{}

static void rkcanfd_chip_start(struct rkcanfd_priv *priv)
{}

static void __rkcanfd_chip_stop(struct rkcanfd_priv *priv, const enum can_state state)
{}

static void rkcanfd_chip_stop(struct rkcanfd_priv *priv, const enum can_state state)
{}

static void rkcanfd_chip_stop_sync(struct rkcanfd_priv *priv, const enum can_state state)
{}

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

static struct sk_buff *
rkcanfd_alloc_can_err_skb(struct rkcanfd_priv *priv,
			  struct can_frame **cf, u32 *timestamp)
{}

static const char *rkcanfd_get_error_type_str(unsigned int type)
{}

#define RKCAN_ERROR_CODE(reg_ec, code)

static void
rkcanfd_handle_error_int_reg_ec(struct rkcanfd_priv *priv, struct can_frame *cf,
				const u32 reg_ec)
{}

static int rkcanfd_handle_error_int(struct rkcanfd_priv *priv)
{}

static int rkcanfd_handle_state_error_int(struct rkcanfd_priv *priv)
{}

static int
rkcanfd_handle_rx_fifo_overflow_int(struct rkcanfd_priv *priv)
{}

#define rkcanfd_handle(priv, irq, ...)

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

static int rkcanfd_open(struct net_device *ndev)
{}

static int rkcanfd_stop(struct net_device *ndev)
{}

static const struct net_device_ops rkcanfd_netdev_ops =;

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

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

static void rkcanfd_register_done(const struct rkcanfd_priv *priv)
{}

static int rkcanfd_register(struct rkcanfd_priv *priv)
{}

static inline void rkcanfd_unregister(struct rkcanfd_priv *priv)
{}

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

static int rkcanfd_probe(struct platform_device *pdev)
{}

static void rkcanfd_remove(struct platform_device *pdev)
{}

static const struct dev_pm_ops rkcanfd_pm_ops =;

static struct platform_driver rkcanfd_driver =;
module_platform_driver();

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