gsi_trans.c (762f99f4f3cb41a775b5157dd761217beba65873) gsi_trans.c (5fc7f9ba2e510fe725f0fff6ddfe824f7184da03)
1// SPDX-License-Identifier: GPL-2.0
2
3/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
4 * Copyright (C) 2019-2020 Linaro Ltd.
5 */
6
7#include <linux/types.h>
8#include <linux/bits.h>

--- 306 unchanged lines hidden (view full) ---

315
316/* Release previously-reserved TRE entries to a channel */
317static void
318gsi_trans_tre_release(struct gsi_trans_info *trans_info, u32 tre_count)
319{
320 atomic_add(tre_count, &trans_info->tre_avail);
321}
322
1// SPDX-License-Identifier: GPL-2.0
2
3/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
4 * Copyright (C) 2019-2020 Linaro Ltd.
5 */
6
7#include <linux/types.h>
8#include <linux/bits.h>

--- 306 unchanged lines hidden (view full) ---

315
316/* Release previously-reserved TRE entries to a channel */
317static void
318gsi_trans_tre_release(struct gsi_trans_info *trans_info, u32 tre_count)
319{
320 atomic_add(tre_count, &trans_info->tre_avail);
321}
322
323/* Return true if no transactions are allocated, false otherwise */
324bool gsi_channel_trans_idle(struct gsi *gsi, u32 channel_id)
325{
326 u32 tre_max = gsi_channel_tre_max(gsi, channel_id);
327 struct gsi_trans_info *trans_info;
328
329 trans_info = &gsi->channel[channel_id].trans_info;
330
331 return atomic_read(&trans_info->tre_avail) == tre_max;
332}
333
323/* Allocate a GSI transaction on a channel */
324struct gsi_trans *gsi_channel_trans_alloc(struct gsi *gsi, u32 channel_id,
325 u32 tre_count,
326 enum dma_data_direction direction)
327{
328 struct gsi_channel *channel = &gsi->channel[channel_id];
329 struct gsi_trans_info *trans_info;
330 struct gsi_trans *trans;

--- 480 unchanged lines hidden ---
334/* Allocate a GSI transaction on a channel */
335struct gsi_trans *gsi_channel_trans_alloc(struct gsi *gsi, u32 channel_id,
336 u32 tre_count,
337 enum dma_data_direction direction)
338{
339 struct gsi_channel *channel = &gsi->channel[channel_id];
340 struct gsi_trans_info *trans_info;
341 struct gsi_trans *trans;

--- 480 unchanged lines hidden ---