cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

tcan4x5x.h (1123B)


      1/* SPDX-License-Identifier: GPL-2.0
      2 *
      3 * tcan4x5x - Texas Instruments TCAN4x5x Family CAN controller driver
      4 *
      5 * Copyright (c) 2020 Pengutronix,
      6 *                    Marc Kleine-Budde <kernel@pengutronix.de>
      7 */
      8
      9#ifndef _TCAN4X5X_H
     10#define _TCAN4X5X_H
     11
     12#include <linux/gpio/consumer.h>
     13#include <linux/regmap.h>
     14#include <linux/regulator/consumer.h>
     15#include <linux/spi/spi.h>
     16
     17#include "m_can.h"
     18
     19#define TCAN4X5X_SANITIZE_SPI 1
     20
     21struct __packed tcan4x5x_buf_cmd {
     22	u8 cmd;
     23	__be16 addr;
     24	u8 len;
     25};
     26
     27struct tcan4x5x_map_buf {
     28	struct tcan4x5x_buf_cmd cmd;
     29	u8 data[256 * sizeof(u32)];
     30} ____cacheline_aligned;
     31
     32struct tcan4x5x_priv {
     33	struct m_can_classdev cdev;
     34
     35	struct regmap *regmap;
     36	struct spi_device *spi;
     37
     38	struct gpio_desc *reset_gpio;
     39	struct gpio_desc *device_wake_gpio;
     40	struct gpio_desc *device_state_gpio;
     41	struct regulator *power;
     42
     43	struct tcan4x5x_map_buf map_buf_rx;
     44	struct tcan4x5x_map_buf map_buf_tx;
     45};
     46
     47static inline void
     48tcan4x5x_spi_cmd_set_len(struct tcan4x5x_buf_cmd *cmd, u8 len)
     49{
     50	/* number of u32 */
     51	cmd->len = len >> 2;
     52}
     53
     54int tcan4x5x_regmap_init(struct tcan4x5x_priv *priv);
     55
     56#endif