linux-stable/include/soc/tegra/ivc.h
Arnd Bergmann a6eeafba11 firmware: tegra: Changes for v6.2-rc1
This adds new BPMP ABI so that newer features can be enabled.
 Furthermore, the BPMP driver is updated to use iosys-map helpers to
 allow working with shared memory regions that are located in system
 memory.
 
 Apart from that, several minor cleanups are included.
 -----BEGIN PGP SIGNATURE-----
 
 iQJHBAABCAAxFiEEiOrDCAFJzPfAjcif3SOs138+s6EFAmN7rlETHHRyZWRpbmdA
 bnZpZGlhLmNvbQAKCRDdI6zXfz6zoaT0EACUyPn96EovNyLMY9Ay/EgJbCtBB7MG
 k1ow5NoM3ZU8LXQLwtmqQcNrBxi9edQDU40vZqzoLrhWuTIQbVdu9F+rb6oYMnC4
 4POrbXKtuuFz9lr+k8xYs/M44qFQsFosvH/yr64GL9/l2yQCrKd8UP8xkxlwcE9N
 K4a8Lum+aNM6UwAoDvFiY97PkYf3SHgfpFbZ1teWARTnpOGaC3zpUPqOIREL7f08
 SezHFK5+qmMI6D+VtsG9EETjYYeHpstmEW5j2tM3HI/noAlfY7JEBffoaptWmJ02
 7A4OkWS7vbR/m69JQcpVEj5oFDUQAYMYbdEfNR/FMPPL+nAviC2yiNjWzvELgqfJ
 xyrtK0GqXIGOS8bQbb+nlXK+T+RiaRMFFHFp6DVKKx06QHLNYHefoRR94AjUGwyu
 So4POKimX0VLgMZi2votP4gQH3WKgqTsvtk+Spwq4XLH+Id5wRhg6miEInpaid/L
 mwoVqr4cW2ECeH5RzadtR0mR1bgL0uweXBXQFLw5Hp6MnGhD3LwNUNz/NlL5sO11
 q67df3K3zccatPniOQza/WV7uul0rC+EZl9zeexSGEMlUjVHv77/99e7vDfRWe12
 NNBbQxL8SmlFXriYEdWv+ZuI43tXkuk9OaSx0A1WjA4XZFwn2/3JGz9owPCDdGII
 SyUKFp9olvkMYg==
 =e9FJ
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEo6/YBQwIrVS28WGKmmx57+YAGNkFAmN9O8AACgkQmmx57+YA
 GNl+hRAAlwOn0/70DAtKWh49vg03JDm/fe4HYPBRNRz3z20+3qMMaINB2nCKLDhy
 1+uiafbkhW6Wl/NTA+RCFbHno3ztFjHxMvUyOa/PmN3FWz1hIGR/EQk8aRVY3Jsu
 y+Qf2+UhsyUVJYjU0S2Mz4kdbE2hGPAmVG05MCQ1CQhLk2nIoofLqqPfKOAHqppu
 KqCxMzsJmPjC/6FUtM6+o7AC1wnNMO9qOR152hoPe2d8yVdydta339sDxUBKH6fE
 HeodQNnvNmK3M1FQf9q7Mqa1ltyyTZZKB3MMWulZFPGnnZF8u8b2jslxNQaQ+pfb
 G61V9KvX7sLV8mw+lXPP+lquP85IwOOajhoCGF/Pa8nofjL5vfJE4lH4spuUkFTa
 nWKlVhXMnpAyzQ1K7qSeA+UycZwXGAUriwVJeSyB9jrg5bBzbtaNXQ+KoB/yV2Vn
 sQoH4Aspm52ePLggZUnDOZTuq6NUC4HZOyApPRQgPoSGiMkFwS6ic4ae0gGDXdyT
 ShHkAjF2wDOcL0fxpS5Y1lRtNI9NBFAeuETrjE1QQfT6MnTjLRpWnTsylIu01lTz
 1Eh4x8cOwOiYuYD52ozbnZ0F3roUbbvIm67/zgF/Up9h8qwCyIUZ1rkHQDMruBrx
 c91zgDxoqrEfp7Mbdu/wFWnQYhfSD6g9spBixbtflmCnMblerog=
 =yh95
 -----END PGP SIGNATURE-----

Merge tag 'tegra-for-6.2-firmware-v2' of git://git.kernel.org/pub/scm/linux/kernel/git/tegra/linux into soc/drivers

firmware: tegra: Changes for v6.2-rc1

This adds new BPMP ABI so that newer features can be enabled.
Furthermore, the BPMP driver is updated to use iosys-map helpers to
allow working with shared memory regions that are located in system
memory.

Apart from that, several minor cleanups are included.

* tag 'tegra-for-6.2-firmware-v2' of git://git.kernel.org/pub/scm/linux/kernel/git/tegra/linux:
  firmware: tegra: Remove surplus dev_err() when using platform_get_irq_byname()
  firmware: tegra: Update BPMP ABI
  firmware: tegra: bpmp: Do not support big-endian
  firmware: tegra: bpmp: Use iosys-map helpers
  firmware: tegra: bpmp: Prefer u32 over uint32_t

Link: https://lore.kernel.org/r/20221121171239.2041835-2-thierry.reding@gmail.com
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2022-11-22 22:14:39 +01:00

103 lines
2.7 KiB
C

/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
*/
#ifndef __TEGRA_IVC_H
#define __TEGRA_IVC_H
#include <linux/device.h>
#include <linux/dma-mapping.h>
#include <linux/iosys-map.h>
#include <linux/types.h>
struct tegra_ivc_header;
struct tegra_ivc {
struct device *peer;
struct {
struct iosys_map map;
unsigned int position;
dma_addr_t phys;
} rx, tx;
void (*notify)(struct tegra_ivc *ivc, void *data);
void *notify_data;
unsigned int num_frames;
size_t frame_size;
};
/**
* tegra_ivc_read_get_next_frame - Peek at the next frame to receive
* @ivc pointer of the IVC channel
*
* Peek at the next frame to be received, without removing it from
* the queue.
*
* Returns a pointer to the frame, or an error encoded pointer.
*/
int tegra_ivc_read_get_next_frame(struct tegra_ivc *ivc, struct iosys_map *map);
/**
* tegra_ivc_read_advance - Advance the read queue
* @ivc pointer of the IVC channel
*
* Advance the read queue
*
* Returns 0, or a negative error value if failed.
*/
int tegra_ivc_read_advance(struct tegra_ivc *ivc);
/**
* tegra_ivc_write_get_next_frame - Poke at the next frame to transmit
* @ivc pointer of the IVC channel
*
* Get access to the next frame.
*
* Returns a pointer to the frame, or an error encoded pointer.
*/
int tegra_ivc_write_get_next_frame(struct tegra_ivc *ivc, struct iosys_map *map);
/**
* tegra_ivc_write_advance - Advance the write queue
* @ivc pointer of the IVC channel
*
* Advance the write queue
*
* Returns 0, or a negative error value if failed.
*/
int tegra_ivc_write_advance(struct tegra_ivc *ivc);
/**
* tegra_ivc_notified - handle internal messages
* @ivc pointer of the IVC channel
*
* This function must be called following every notification.
*
* Returns 0 if the channel is ready for communication, or -EAGAIN if a channel
* reset is in progress.
*/
int tegra_ivc_notified(struct tegra_ivc *ivc);
/**
* tegra_ivc_reset - initiates a reset of the shared memory state
* @ivc pointer of the IVC channel
*
* This function must be called after a channel is reserved before it is used
* for communication. The channel will be ready for use when a subsequent call
* to notify the remote of the channel reset.
*/
void tegra_ivc_reset(struct tegra_ivc *ivc);
size_t tegra_ivc_align(size_t size);
unsigned tegra_ivc_total_queue_size(unsigned queue_size);
int tegra_ivc_init(struct tegra_ivc *ivc, struct device *peer, const struct iosys_map *rx,
dma_addr_t rx_phys, const struct iosys_map *tx, dma_addr_t tx_phys,
unsigned int num_frames, size_t frame_size,
void (*notify)(struct tegra_ivc *ivc, void *data),
void *data);
void tegra_ivc_cleanup(struct tegra_ivc *ivc);
#endif /* __TEGRA_IVC_H */