#include <linux/bitmap.h>
#include <linux/bitops.h>
#include <linux/can/dev.h>
#include <linux/clk.h>
#include <linux/errno.h>
#include <linux/ethtool.h>
#include <linux/interrupt.h>
#include <linux/iopoll.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/netdevice.h>
#include <linux/of.h>
#include <linux/phy/phy.h>
#include <linux/platform_device.h>
#include <linux/reset.h>
#include <linux/types.h>
#define RCANFD_DRV_NAME …
#define RCANFD_GRMCFG_RCMC …
#define RCANFD_GCFG_EEFE …
#define RCANFD_GCFG_CMPOC …
#define RCANFD_GCFG_DCS …
#define RCANFD_GCFG_DCE …
#define RCANFD_GCFG_TPRI …
#define RCANFD_GCTR_TSRST …
#define RCANFD_GCTR_CFMPOFIE …
#define RCANFD_GCTR_THLEIE …
#define RCANFD_GCTR_MEIE …
#define RCANFD_GCTR_DEIE …
#define RCANFD_GCTR_GSLPR …
#define RCANFD_GCTR_GMDC_MASK …
#define RCANFD_GCTR_GMDC_GOPM …
#define RCANFD_GCTR_GMDC_GRESET …
#define RCANFD_GCTR_GMDC_GTEST …
#define RCANFD_GSTS_GRAMINIT …
#define RCANFD_GSTS_GSLPSTS …
#define RCANFD_GSTS_GHLTSTS …
#define RCANFD_GSTS_GRSTSTS …
#define RCANFD_GSTS_GNOPM …
#define RCANFD_GERFL_EEF0_7 …
#define RCANFD_GERFL_EEF(ch) …
#define RCANFD_GERFL_CMPOF …
#define RCANFD_GERFL_THLES …
#define RCANFD_GERFL_MES …
#define RCANFD_GERFL_DEF …
#define RCANFD_GERFL_ERR(gpriv, x) …
#define RCANFD_GAFLCFG_SETRNC(gpriv, n, x) …
#define RCANFD_GAFLCFG_GETRNC(gpriv, n, x) …
#define RCANFD_GAFLECTR_AFLDAE …
#define RCANFD_GAFLECTR_AFLPN(gpriv, x) …
#define RCANFD_GAFLID_GAFLLB …
#define RCANFD_GAFLP1_GAFLFDP(x) …
#define RCANFD_CFG_SJW(x) …
#define RCANFD_CFG_TSEG2(x) …
#define RCANFD_CFG_TSEG1(x) …
#define RCANFD_CFG_BRP(x) …
#define RCANFD_NCFG_NTSEG2(gpriv, x) …
#define RCANFD_NCFG_NTSEG1(gpriv, x) …
#define RCANFD_NCFG_NSJW(gpriv, x) …
#define RCANFD_NCFG_NBRP(x) …
#define RCANFD_CCTR_CTME …
#define RCANFD_CCTR_ERRD …
#define RCANFD_CCTR_BOM_MASK …
#define RCANFD_CCTR_BOM_ISO …
#define RCANFD_CCTR_BOM_BENTRY …
#define RCANFD_CCTR_BOM_BEND …
#define RCANFD_CCTR_TDCVFIE …
#define RCANFD_CCTR_SOCOIE …
#define RCANFD_CCTR_EOCOIE …
#define RCANFD_CCTR_TAIE …
#define RCANFD_CCTR_ALIE …
#define RCANFD_CCTR_BLIE …
#define RCANFD_CCTR_OLIE …
#define RCANFD_CCTR_BORIE …
#define RCANFD_CCTR_BOEIE …
#define RCANFD_CCTR_EPIE …
#define RCANFD_CCTR_EWIE …
#define RCANFD_CCTR_BEIE …
#define RCANFD_CCTR_CSLPR …
#define RCANFD_CCTR_CHMDC_MASK …
#define RCANFD_CCTR_CHDMC_COPM …
#define RCANFD_CCTR_CHDMC_CRESET …
#define RCANFD_CCTR_CHDMC_CHLT …
#define RCANFD_CSTS_COMSTS …
#define RCANFD_CSTS_RECSTS …
#define RCANFD_CSTS_TRMSTS …
#define RCANFD_CSTS_BOSTS …
#define RCANFD_CSTS_EPSTS …
#define RCANFD_CSTS_SLPSTS …
#define RCANFD_CSTS_HLTSTS …
#define RCANFD_CSTS_CRSTSTS …
#define RCANFD_CSTS_TECCNT(x) …
#define RCANFD_CSTS_RECCNT(x) …
#define RCANFD_CERFL_ADERR …
#define RCANFD_CERFL_B0ERR …
#define RCANFD_CERFL_B1ERR …
#define RCANFD_CERFL_CERR …
#define RCANFD_CERFL_AERR …
#define RCANFD_CERFL_FERR …
#define RCANFD_CERFL_SERR …
#define RCANFD_CERFL_ALF …
#define RCANFD_CERFL_BLF …
#define RCANFD_CERFL_OVLF …
#define RCANFD_CERFL_BORF …
#define RCANFD_CERFL_BOEF …
#define RCANFD_CERFL_EPF …
#define RCANFD_CERFL_EWF …
#define RCANFD_CERFL_BEF …
#define RCANFD_CERFL_ERR(x) …
#define RCANFD_DCFG_DSJW(gpriv, x) …
#define RCANFD_DCFG_DTSEG2(gpriv, x) …
#define RCANFD_DCFG_DTSEG1(gpriv, x) …
#define RCANFD_DCFG_DBRP(x) …
#define RCANFD_GEN4_FDCFG_CLOE …
#define RCANFD_GEN4_FDCFG_FDOE …
#define RCANFD_FDCFG_TDCE …
#define RCANFD_FDCFG_TDCOC …
#define RCANFD_FDCFG_TDCO(x) …
#define RCANFD_RFCC_RFIM …
#define RCANFD_RFCC_RFDC(x) …
#define RCANFD_RFCC_RFPLS(x) …
#define RCANFD_RFCC_RFIE …
#define RCANFD_RFCC_RFE …
#define RCANFD_RFSTS_RFIF …
#define RCANFD_RFSTS_RFMLT …
#define RCANFD_RFSTS_RFFLL …
#define RCANFD_RFSTS_RFEMP …
#define RCANFD_RFID_RFIDE …
#define RCANFD_RFID_RFRTR …
#define RCANFD_RFPTR_RFDLC(x) …
#define RCANFD_RFPTR_RFPTR(x) …
#define RCANFD_RFPTR_RFTS(x) …
#define RCANFD_RFFDSTS_RFFDF …
#define RCANFD_RFFDSTS_RFBRS …
#define RCANFD_RFFDSTS_RFESI …
#define RCANFD_CFCC_CFTML(gpriv, x) …
#define RCANFD_CFCC_CFM(gpriv, x) …
#define RCANFD_CFCC_CFIM …
#define RCANFD_CFCC_CFDC(gpriv, x) …
#define RCANFD_CFCC_CFPLS(x) …
#define RCANFD_CFCC_CFTXIE …
#define RCANFD_CFCC_CFE …
#define RCANFD_CFSTS_CFMC(x) …
#define RCANFD_CFSTS_CFTXIF …
#define RCANFD_CFSTS_CFMLT …
#define RCANFD_CFSTS_CFFLL …
#define RCANFD_CFSTS_CFEMP …
#define RCANFD_CFID_CFIDE …
#define RCANFD_CFID_CFRTR …
#define RCANFD_CFID_CFID_MASK(x) …
#define RCANFD_CFPTR_CFDLC(x) …
#define RCANFD_CFPTR_CFPTR(x) …
#define RCANFD_CFPTR_CFTS(x) …
#define RCANFD_CFFDCSTS_CFFDF …
#define RCANFD_CFFDCSTS_CFBRS …
#define RCANFD_CFFDCSTS_CFESI …
#define RCANFD_CCFG(m) …
#define RCANFD_CCTR(m) …
#define RCANFD_CSTS(m) …
#define RCANFD_CERFL(m) …
#define RCANFD_GCFG …
#define RCANFD_GCTR …
#define RCANFD_GSTS …
#define RCANFD_GERFL …
#define RCANFD_GTSC …
#define RCANFD_GAFLECTR …
#define RCANFD_GAFLCFG(ch) …
#define RCANFD_RMNB …
#define RCANFD_RMND(y) …
#define RCANFD_RFCC(gpriv, x) …
#define RCANFD_RFSTS(gpriv, x) …
#define RCANFD_RFPCTR(gpriv, x) …
#define RCANFD_CFCC(gpriv, ch, idx) …
#define RCANFD_CFSTS(gpriv, ch, idx) …
#define RCANFD_CFPCTR(gpriv, ch, idx) …
#define RCANFD_FESTS …
#define RCANFD_FFSTS …
#define RCANFD_FMSTS …
#define RCANFD_RFISTS …
#define RCANFD_CFRISTS …
#define RCANFD_CFTISTS …
#define RCANFD_TMC(p) …
#define RCANFD_TMSTS(p) …
#define RCANFD_TMTRSTS(y) …
#define RCANFD_TMTARSTS(y) …
#define RCANFD_TMTCSTS(y) …
#define RCANFD_TMTASTS(y) …
#define RCANFD_TMIEC(y) …
#define RCANFD_TXQCC(m) …
#define RCANFD_TXQSTS(m) …
#define RCANFD_TXQPCTR(m) …
#define RCANFD_THLCC(m) …
#define RCANFD_THLSTS(m) …
#define RCANFD_THLPCTR(m) …
#define RCANFD_GTINTSTS0 …
#define RCANFD_GTINTSTS1 …
#define RCANFD_GTSTCFG …
#define RCANFD_GTSTCTR …
#define RCANFD_GLOCKK …
#define RCANFD_GRMCFG …
#define RCANFD_GAFLID(offset, j) …
#define RCANFD_GAFLM(offset, j) …
#define RCANFD_GAFLP0(offset, j) …
#define RCANFD_GAFLP1(offset, j) …
#define RCANFD_C_GAFL_OFFSET …
#define RCANFD_C_RMID(q) …
#define RCANFD_C_RMPTR(q) …
#define RCANFD_C_RMDF0(q) …
#define RCANFD_C_RMDF1(q) …
#define RCANFD_C_RFOFFSET …
#define RCANFD_C_RFID(x) …
#define RCANFD_C_RFPTR(x) …
#define RCANFD_C_RFDF(x, df) …
#define RCANFD_C_CFOFFSET …
#define RCANFD_C_CFID(ch, idx) …
#define RCANFD_C_CFPTR(ch, idx) …
#define RCANFD_C_CFDF(ch, idx, df) …
#define RCANFD_C_TMID(p) …
#define RCANFD_C_TMPTR(p) …
#define RCANFD_C_TMDF0(p) …
#define RCANFD_C_TMDF1(p) …
#define RCANFD_C_THLACC(m) …
#define RCANFD_C_RPGACC(r) …
#define RCANFD_GEN4_FDCFG(m) …
#define RCANFD_GEN4_GAFL_OFFSET …
#define RCANFD_F_DCFG(gpriv, m) …
#define RCANFD_F_CFDCFG(m) …
#define RCANFD_F_CFDCTR(m) …
#define RCANFD_F_CFDSTS(m) …
#define RCANFD_F_CFDCRC(m) …
#define RCANFD_F_GAFL_OFFSET …
#define RCANFD_F_RMID(q) …
#define RCANFD_F_RMPTR(q) …
#define RCANFD_F_RMFDSTS(q) …
#define RCANFD_F_RMDF(q, b) …
#define RCANFD_F_RFOFFSET(gpriv) …
#define RCANFD_F_RFID(gpriv, x) …
#define RCANFD_F_RFPTR(gpriv, x) …
#define RCANFD_F_RFFDSTS(gpriv, x) …
#define RCANFD_F_RFDF(gpriv, x, df) …
#define RCANFD_F_CFOFFSET(gpriv) …
#define RCANFD_F_CFID(gpriv, ch, idx) …
#define RCANFD_F_CFPTR(gpriv, ch, idx) …
#define RCANFD_F_CFFDCSTS(gpriv, ch, idx) …
#define RCANFD_F_CFDF(gpriv, ch, idx, df) …
#define RCANFD_F_TMID(p) …
#define RCANFD_F_TMPTR(p) …
#define RCANFD_F_TMFDCTR(p) …
#define RCANFD_F_TMDF(p, b) …
#define RCANFD_F_THLACC(m) …
#define RCANFD_F_RPGACC(r) …
#define RCANFD_FIFO_DEPTH …
#define RCANFD_NAPI_WEIGHT …
#define RCANFD_NUM_CHANNELS …
#define RCANFD_CHANNELS_MASK …
#define RCANFD_GAFL_PAGENUM(entry) …
#define RCANFD_CHANNEL_NUMRULES …
#define RCANFD_RFFIFO_IDX …
#define RCANFD_CFFIFO_IDX …
struct rcar_canfd_global;
struct rcar_canfd_hw_info { … };
struct rcar_canfd_channel { … };
struct rcar_canfd_global { … };
static const struct can_bittiming_const rcar_canfd_nom_bittiming_const = …;
static const struct can_bittiming_const rcar_canfd_data_bittiming_const = …;
static const struct can_bittiming_const rcar_canfd_bittiming_const = …;
static const struct rcar_canfd_hw_info rcar_gen3_hw_info = …;
static const struct rcar_canfd_hw_info rcar_gen4_hw_info = …;
static const struct rcar_canfd_hw_info rzg2l_hw_info = …;
static inline bool is_gen4(struct rcar_canfd_global *gpriv)
{ … }
static inline u32 reg_gen4(struct rcar_canfd_global *gpriv,
u32 gen4, u32 not_gen4)
{ … }
static inline void rcar_canfd_update(u32 mask, u32 val, u32 __iomem *reg)
{ … }
static inline u32 rcar_canfd_read(void __iomem *base, u32 offset)
{ … }
static inline void rcar_canfd_write(void __iomem *base, u32 offset, u32 val)
{ … }
static void rcar_canfd_set_bit(void __iomem *base, u32 reg, u32 val)
{ … }
static void rcar_canfd_clear_bit(void __iomem *base, u32 reg, u32 val)
{ … }
static void rcar_canfd_update_bit(void __iomem *base, u32 reg,
u32 mask, u32 val)
{ … }
static void rcar_canfd_get_data(struct rcar_canfd_channel *priv,
struct canfd_frame *cf, u32 off)
{ … }
static void rcar_canfd_put_data(struct rcar_canfd_channel *priv,
struct canfd_frame *cf, u32 off)
{ … }
static void rcar_canfd_tx_failure_cleanup(struct net_device *ndev)
{ … }
static void rcar_canfd_set_mode(struct rcar_canfd_global *gpriv)
{ … }
static int rcar_canfd_reset_controller(struct rcar_canfd_global *gpriv)
{ … }
static void rcar_canfd_configure_controller(struct rcar_canfd_global *gpriv)
{ … }
static void rcar_canfd_configure_afl_rules(struct rcar_canfd_global *gpriv,
u32 ch)
{ … }
static void rcar_canfd_configure_rx(struct rcar_canfd_global *gpriv, u32 ch)
{ … }
static void rcar_canfd_configure_tx(struct rcar_canfd_global *gpriv, u32 ch)
{ … }
static void rcar_canfd_enable_global_interrupts(struct rcar_canfd_global *gpriv)
{ … }
static void rcar_canfd_disable_global_interrupts(struct rcar_canfd_global
*gpriv)
{ … }
static void rcar_canfd_enable_channel_interrupts(struct rcar_canfd_channel
*priv)
{ … }
static void rcar_canfd_disable_channel_interrupts(struct rcar_canfd_channel
*priv)
{ … }
static void rcar_canfd_global_error(struct net_device *ndev)
{ … }
static void rcar_canfd_error(struct net_device *ndev, u32 cerfl,
u16 txerr, u16 rxerr)
{ … }
static void rcar_canfd_tx_done(struct net_device *ndev)
{ … }
static void rcar_canfd_handle_global_err(struct rcar_canfd_global *gpriv, u32 ch)
{ … }
static irqreturn_t rcar_canfd_global_err_interrupt(int irq, void *dev_id)
{ … }
static void rcar_canfd_handle_global_receive(struct rcar_canfd_global *gpriv, u32 ch)
{ … }
static irqreturn_t rcar_canfd_global_receive_fifo_interrupt(int irq, void *dev_id)
{ … }
static irqreturn_t rcar_canfd_global_interrupt(int irq, void *dev_id)
{ … }
static void rcar_canfd_state_change(struct net_device *ndev,
u16 txerr, u16 rxerr)
{ … }
static void rcar_canfd_handle_channel_tx(struct rcar_canfd_global *gpriv, u32 ch)
{ … }
static irqreturn_t rcar_canfd_channel_tx_interrupt(int irq, void *dev_id)
{ … }
static void rcar_canfd_handle_channel_err(struct rcar_canfd_global *gpriv, u32 ch)
{ … }
static irqreturn_t rcar_canfd_channel_err_interrupt(int irq, void *dev_id)
{ … }
static irqreturn_t rcar_canfd_channel_interrupt(int irq, void *dev_id)
{ … }
static void rcar_canfd_set_bittiming(struct net_device *dev)
{ … }
static int rcar_canfd_start(struct net_device *ndev)
{ … }
static int rcar_canfd_open(struct net_device *ndev)
{ … }
static void rcar_canfd_stop(struct net_device *ndev)
{ … }
static int rcar_canfd_close(struct net_device *ndev)
{ … }
static netdev_tx_t rcar_canfd_start_xmit(struct sk_buff *skb,
struct net_device *ndev)
{ … }
static void rcar_canfd_rx_pkt(struct rcar_canfd_channel *priv)
{ … }
static int rcar_canfd_rx_poll(struct napi_struct *napi, int quota)
{ … }
static int rcar_canfd_do_set_mode(struct net_device *ndev, enum can_mode mode)
{ … }
static int rcar_canfd_get_berr_counter(const struct net_device *dev,
struct can_berr_counter *bec)
{ … }
static const struct net_device_ops rcar_canfd_netdev_ops = …;
static const struct ethtool_ops rcar_canfd_ethtool_ops = …;
static int rcar_canfd_channel_probe(struct rcar_canfd_global *gpriv, u32 ch,
u32 fcan_freq, struct phy *transceiver)
{ … }
static void rcar_canfd_channel_remove(struct rcar_canfd_global *gpriv, u32 ch)
{ … }
static int rcar_canfd_probe(struct platform_device *pdev)
{ … }
static void rcar_canfd_remove(struct platform_device *pdev)
{ … }
static int __maybe_unused rcar_canfd_suspend(struct device *dev)
{ … }
static int __maybe_unused rcar_canfd_resume(struct device *dev)
{ … }
static SIMPLE_DEV_PM_OPS(rcar_canfd_pm_ops, rcar_canfd_suspend,
rcar_canfd_resume);
static const __maybe_unused struct of_device_id rcar_canfd_of_table[] = …;
MODULE_DEVICE_TABLE(of, rcar_canfd_of_table);
static struct platform_driver rcar_canfd_driver = …;
module_platform_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_ALIAS(…) …;