Merge tag 'trace-printf-v6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/trace...
[drm/drm-misc.git] / drivers / net / can / ctucanfd / ctucanfd.h
blob0e9904f6a05d60301c5669ee0e6b1a5988277ea6
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*******************************************************************************
4 * CTU CAN FD IP Core
6 * Copyright (C) 2015-2018 Ondrej Ille <ondrej.ille@gmail.com> FEE CTU
7 * Copyright (C) 2018-2021 Ondrej Ille <ondrej.ille@gmail.com> self-funded
8 * Copyright (C) 2018-2019 Martin Jerabek <martin.jerabek01@gmail.com> FEE CTU
9 * Copyright (C) 2018-2021 Pavel Pisa <pisa@cmp.felk.cvut.cz> FEE CTU/self-funded
11 * Project advisors:
12 * Jiri Novak <jnovak@fel.cvut.cz>
13 * Pavel Pisa <pisa@cmp.felk.cvut.cz>
15 * Department of Measurement (http://meas.fel.cvut.cz/)
16 * Faculty of Electrical Engineering (http://www.fel.cvut.cz)
17 * Czech Technical University (http://www.cvut.cz/)
18 ******************************************************************************/
20 #ifndef __CTUCANFD__
21 #define __CTUCANFD__
23 #include <linux/netdevice.h>
24 #include <linux/can/dev.h>
25 #include <linux/list.h>
27 enum ctu_can_fd_can_registers;
29 struct ctucan_priv {
30 struct can_priv can; /* must be first member! */
32 void __iomem *mem_base;
33 u32 (*read_reg)(struct ctucan_priv *priv,
34 enum ctu_can_fd_can_registers reg);
35 void (*write_reg)(struct ctucan_priv *priv,
36 enum ctu_can_fd_can_registers reg, u32 val);
38 unsigned int txb_head;
39 unsigned int txb_tail;
40 u32 txb_prio;
41 unsigned int ntxbufs;
42 spinlock_t tx_lock; /* spinlock to serialize allocation and processing of TX buffers */
44 struct napi_struct napi;
45 struct device *dev;
46 struct clk *can_clk;
48 int irq_flags;
49 unsigned long drv_flags;
51 u32 rxfrm_first_word;
53 struct list_head peers_on_pdev;
56 /**
57 * ctucan_probe_common - Device type independent registration call
59 * This function does all the memory allocation and registration for the CAN
60 * device.
62 * @dev: Handle to the generic device structure
63 * @addr: Base address of CTU CAN FD core address
64 * @irq: Interrupt number
65 * @ntxbufs: Number of implemented Tx buffers
66 * @can_clk_rate: Clock rate, if 0 then clock are taken from device node
67 * @pm_enable_call: Whether pm_runtime_enable should be called
68 * @set_drvdata_fnc: Function to set network driver data for physical device
70 * Return: 0 on success and failure value on error
72 int ctucan_probe_common(struct device *dev, void __iomem *addr,
73 int irq, unsigned int ntxbufs,
74 unsigned long can_clk_rate,
75 int pm_enable_call,
76 void (*set_drvdata_fnc)(struct device *dev,
77 struct net_device *ndev));
79 int ctucan_suspend(struct device *dev) __maybe_unused;
80 int ctucan_resume(struct device *dev) __maybe_unused;
82 #endif /*__CTUCANFD__*/