Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0
0002  *
0003  * mcp251xfd - Microchip MCP251xFD Family CAN controller driver
0004  *
0005  * Copyright (c) 2021, 2022 Pengutronix,
0006  *               Marc Kleine-Budde <kernel@pengutronix.de>
0007  */
0008 
0009 #ifndef _MCP251XFD_RAM_H
0010 #define _MCP251XFD_RAM_H
0011 
0012 #include <linux/ethtool.h>
0013 
0014 #define CAN_RAM_NUM_MAX (-1)
0015 
0016 enum can_ram_mode {
0017     CAN_RAM_MODE_CAN,
0018     CAN_RAM_MODE_CANFD,
0019     __CAN_RAM_MODE_MAX
0020 };
0021 
0022 struct can_ram_obj_config {
0023     u8 size[__CAN_RAM_MODE_MAX];
0024 
0025     u8 def[__CAN_RAM_MODE_MAX];
0026     u8 min;
0027     u8 max;
0028 
0029     u8 fifo_num;
0030     u8 fifo_depth_min;
0031     u8 fifo_depth_coalesce_min;
0032 };
0033 
0034 struct can_ram_config {
0035     const struct can_ram_obj_config rx;
0036     const struct can_ram_obj_config tx;
0037 
0038     u16 size;
0039     u8 fifo_depth;
0040 };
0041 
0042 struct can_ram_layout {
0043     u8 default_rx;
0044     u8 default_tx;
0045 
0046     u8 max_rx;
0047     u8 max_tx;
0048 
0049     u8 cur_rx;
0050     u8 cur_tx;
0051 
0052     u8 rx_coalesce;
0053     u8 tx_coalesce;
0054 };
0055 
0056 void can_ram_get_layout(struct can_ram_layout *layout,
0057             const struct can_ram_config *config,
0058             const struct ethtool_ringparam *ring,
0059             const struct ethtool_coalesce *ec,
0060             const bool fd_mode);
0061 
0062 #endif