@@ -141,3 +141,11 @@ Description:
This debugfs interface is used for enabling the
hwtrigger. Hwtrigger can be enabled by writing
a '1' to the file.
+
+What: /sys/kernel/debug/dcc/.../[list-number]/QAD
+Date: January 2023
+Contact: Souradeep Chowdhury <quic_schowdhu@quicinc.com>
+Description:
+ This debugfs interface is used for enabling the
+ QAD. QAD can be enabled by writing a '1' to the
+ file.
@@ -38,6 +38,7 @@
#define DCC_LL_SW_TRIGGER 0x2c
#define DCC_LL_BUS_ACCESS_STATUS 0x30
#define DCC_CTI_TRIG 0x34
+#define DCC_QAD_OUTPUT 0x38
/* Default value used if a bit 6 in the HW_INFO register is set. */
#define DCC_FIX_LOOP_OFFSET 16
@@ -118,6 +119,7 @@ struct dcc_config_entry {
* @enable_bitmap: Bitmap to capture the enabled status of each linked list of addresses
* @cti_bitmap: Bitmap to capture the cti-trigger status of each linked list of addresses
* @hwtrig_bitmap: Bitmap to capture the hwtrig status of each linked list of addresses
+ * @qad_bitmap: Bitmap to capture the qad status of each linked list of addresses
*/
struct dcc_drvdata {
void __iomem *base;
@@ -137,6 +139,7 @@ struct dcc_drvdata {
unsigned long *enable_bitmap;
unsigned long *cti_bitmap;
unsigned long *hwtrig_bitmap;
+ unsigned long *qad_bitmap;
};
struct dcc_cfg_attr {
@@ -599,6 +602,8 @@ static int dcc_enable(struct dcc_drvdata *drvdata, unsigned int curr_list)
dcc_list_writel(drvdata, DCC_TRIGGER_MASK,
curr_list, DCC_LL_CFG);
if (drvdata->mem_map_ver == 3) {
+ dcc_list_writel(drvdata, test_bit(curr_list, drvdata->qad_bitmap), curr_list,
+ DCC_QAD_OUTPUT);
dcc_list_writel(drvdata, test_bit(curr_list, drvdata->cti_bitmap), curr_list,
DCC_CTI_TRIG);
if (test_bit(curr_list, drvdata->hwtrig_bitmap))
@@ -1245,6 +1250,64 @@ static const struct file_operations hwtrigger_fops = {
.llseek = generic_file_llseek,
};
+static ssize_t qad_read(struct file *filp, char __user *userbuf,
+ size_t count, loff_t *ppos)
+{
+ char *buf;
+ int curr_list;
+
+ struct dcc_drvdata *drvdata = filp->private_data;
+
+ curr_list = dcc_filp_curr_list(filp);
+
+ mutex_lock(&drvdata->mutex);
+
+ if (test_bit(curr_list, drvdata->qad_bitmap))
+ buf = "Y\n";
+ else
+ buf = "N\n";
+
+ mutex_unlock(&drvdata->mutex);
+
+ return simple_read_from_buffer(userbuf, count, ppos, buf, strlen(buf));
+}
+
+static ssize_t qad_write(struct file *filp, const char __user *userbuf,
+ size_t count, loff_t *ppos)
+{
+ int ret, curr_list;
+ bool val;
+ struct dcc_drvdata *drvdata = filp->private_data;
+
+ curr_list = dcc_filp_curr_list(filp);
+
+ if (drvdata->mem_map_ver != 3) {
+ dev_err(drvdata->dev, "QAD is not supported\n");
+ return -EINVAL;
+ }
+
+ if (test_bit(curr_list, drvdata->enable_bitmap))
+ return -EBUSY;
+
+ ret = kstrtobool_from_user(userbuf, count, &val);
+ if (ret < 0)
+ return ret;
+
+ if (val)
+ set_bit(curr_list, drvdata->qad_bitmap);
+ else
+ clear_bit(curr_list, drvdata->qad_bitmap);
+
+ return count;
+}
+
+static const struct file_operations qad_fops = {
+ .read = qad_read,
+ .write = qad_write,
+ .open = simple_open,
+ .llseek = generic_file_llseek,
+};
+
static void dcc_delete_debug_dir(struct dcc_drvdata *drvdata)
{
debugfs_remove_recursive(drvdata->dbg_dir);
@@ -1276,6 +1339,7 @@ static void dcc_create_debug_dir(struct dcc_drvdata *drvdata)
drvdata, &config_reset_fops);
debugfs_create_file("ctitrigger", 0600, list, drvdata, &ctitrigger_fops);
debugfs_create_file("hwtrigger", 0600, list, drvdata, &hwtrigger_fops);
+ debugfs_create_file("QAD", 0600, list, drvdata, &qad_fops);
}
static ssize_t dcc_sram_read(struct file *file, char __user *data,
@@ -1447,6 +1511,10 @@ static int __init dcc_probe(struct platform_device *pdev)
if (!drvdata->hwtrig_bitmap)
return -ENOMEM;
+ drvdata->qad_bitmap = devm_bitmap_alloc(dev, drvdata->nr_link_list, GFP_KERNEL);
+ if (!drvdata->qad_bitmap)
+ return -ENOMEM;
+
drvdata->cfg_head = devm_kcalloc(dev, drvdata->nr_link_list,
sizeof(*drvdata->cfg_head), GFP_KERNEL);
if (!drvdata->cfg_head)