brintos

brintos / linux-shallow public Read only

0
0
Text · 2.5 KiB · 0e9904f Raw
83 lines · c
1/* SPDX-License-Identifier: GPL-2.0-or-later */2/*******************************************************************************3 *4 * CTU CAN FD IP Core5 *6 * Copyright (C) 2015-2018 Ondrej Ille <ondrej.ille@gmail.com> FEE CTU7 * Copyright (C) 2018-2021 Ondrej Ille <ondrej.ille@gmail.com> self-funded8 * Copyright (C) 2018-2019 Martin Jerabek <martin.jerabek01@gmail.com> FEE CTU9 * Copyright (C) 2018-2021 Pavel Pisa <pisa@cmp.felk.cvut.cz> FEE CTU/self-funded10 *11 * Project advisors:12 *     Jiri Novak <jnovak@fel.cvut.cz>13 *     Pavel Pisa <pisa@cmp.felk.cvut.cz>14 *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 ******************************************************************************/19 20#ifndef __CTUCANFD__21#define __CTUCANFD__22 23#include <linux/netdevice.h>24#include <linux/can/dev.h>25#include <linux/list.h>26 27enum ctu_can_fd_can_registers;28 29struct ctucan_priv {30	struct can_priv can; /* must be first member! */31 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);37 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 */43 44	struct napi_struct napi;45	struct device *dev;46	struct clk *can_clk;47 48	int irq_flags;49	unsigned long drv_flags;50 51	u32 rxfrm_first_word;52 53	struct list_head peers_on_pdev;54};55 56/**57 * ctucan_probe_common - Device type independent registration call58 *59 * This function does all the memory allocation and registration for the CAN60 * device.61 *62 * @dev:	Handle to the generic device structure63 * @addr:	Base address of CTU CAN FD core address64 * @irq:	Interrupt number65 * @ntxbufs:	Number of implemented Tx buffers66 * @can_clk_rate: Clock rate, if 0 then clock are taken from device node67 * @pm_enable_call: Whether pm_runtime_enable should be called68 * @set_drvdata_fnc: Function to set network driver data for physical device69 *70 * Return: 0 on success and failure value on error71 */72int 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));78 79int ctucan_suspend(struct device *dev) __maybe_unused;80int ctucan_resume(struct device *dev) __maybe_unused;81 82#endif /*__CTUCANFD__*/83