Select Git revision
intel_rdt_pseudo_lock.c
knav_qmss_queue.c 45.37 KiB
/*
* Keystone Queue Manager subsystem driver
*
* Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com
* Authors: Sandeep Nair <sandeep_n@ti.com>
* Cyril Chemparathy <cyril@ti.com>
* Santosh Shilimkar <santosh.shilimkar@ti.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*/
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/device.h>
#include <linux/clk.h>
#include <linux/io.h>
#include <linux/interrupt.h>
#include <linux/bitops.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
#include <linux/platform_device.h>
#include <linux/dma-mapping.h>
#include <linux/of.h>
#include <linux/of_irq.h>
#include <linux/of_device.h>
#include <linux/of_address.h>
#include <linux/pm_runtime.h>
#include <linux/firmware.h>
#include <linux/debugfs.h>
#include <linux/seq_file.h>
#include <linux/string.h>
#include <linux/soc/ti/knav_qmss.h>
#include "knav_qmss.h"
static struct knav_device *kdev;
static DEFINE_MUTEX(knav_dev_lock);
/* Queue manager register indices in DTS */
#define KNAV_QUEUE_PEEK_REG_INDEX 0
#define KNAV_QUEUE_STATUS_REG_INDEX 1
#define KNAV_QUEUE_CONFIG_REG_INDEX 2
#define KNAV_QUEUE_REGION_REG_INDEX 3
#define KNAV_QUEUE_PUSH_REG_INDEX 4
#define KNAV_QUEUE_POP_REG_INDEX 5
/* PDSP register indices in DTS */
#define KNAV_QUEUE_PDSP_IRAM_REG_INDEX 0
#define KNAV_QUEUE_PDSP_REGS_REG_INDEX 1
#define KNAV_QUEUE_PDSP_INTD_REG_INDEX 2
#define KNAV_QUEUE_PDSP_CMD_REG_INDEX 3
#define knav_queue_idx_to_inst(kdev, idx) \
(kdev->instances + (idx << kdev->inst_shift))
#define for_each_handle_rcu(qh, inst) \
list_for_each_entry_rcu(qh, &inst->handles, list)
#define for_each_instance(idx, inst, kdev) \
for (idx = 0, inst = kdev->instances; \
idx < (kdev)->num_queues_in_use; \
idx++, inst = knav_queue_idx_to_inst(kdev, idx))