1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*******************************************************************************
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
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 ******************************************************************************/
23 #include <linux/netdevice.h>
24 #include <linux/can/dev.h>
25 #include <linux/list.h>
27 enum ctu_can_fd_can_registers
;
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
;
42 spinlock_t tx_lock
; /* spinlock to serialize allocation and processing of TX buffers */
44 struct napi_struct napi
;
49 unsigned long drv_flags
;
53 struct list_head peers_on_pdev
;
57 * ctucan_probe_common - Device type independent registration call
59 * This function does all the memory allocation and registration for the CAN
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
,
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__*/