|
@@ -277,8 +277,41 @@ static ssize_t trigger_cntr_store(struct device *dev,
|
|
|
}
|
|
|
static DEVICE_ATTR_RW(trigger_cntr);
|
|
|
|
|
|
+static ssize_t buffer_size_show(struct device *dev,
|
|
|
+ struct device_attribute *attr, char *buf)
|
|
|
+{
|
|
|
+ struct tmc_drvdata *drvdata = dev_get_drvdata(dev->parent);
|
|
|
+
|
|
|
+ return sprintf(buf, "%#x\n", drvdata->size);
|
|
|
+}
|
|
|
+
|
|
|
+static ssize_t buffer_size_store(struct device *dev,
|
|
|
+ struct device_attribute *attr,
|
|
|
+ const char *buf, size_t size)
|
|
|
+{
|
|
|
+ int ret;
|
|
|
+ unsigned long val;
|
|
|
+ struct tmc_drvdata *drvdata = dev_get_drvdata(dev->parent);
|
|
|
+
|
|
|
+ /* Only permitted for TMC-ETRs */
|
|
|
+ if (drvdata->config_type != TMC_CONFIG_TYPE_ETR)
|
|
|
+ return -EPERM;
|
|
|
+
|
|
|
+ ret = kstrtoul(buf, 0, &val);
|
|
|
+ if (ret)
|
|
|
+ return ret;
|
|
|
+ /* The buffer size should be page aligned */
|
|
|
+ if (val & (PAGE_SIZE - 1))
|
|
|
+ return -EINVAL;
|
|
|
+ drvdata->size = val;
|
|
|
+ return size;
|
|
|
+}
|
|
|
+
|
|
|
+static DEVICE_ATTR_RW(buffer_size);
|
|
|
+
|
|
|
static struct attribute *coresight_tmc_attrs[] = {
|
|
|
&dev_attr_trigger_cntr.attr,
|
|
|
+ &dev_attr_buffer_size.attr,
|
|
|
NULL,
|
|
|
};
|
|
|
|