mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-23 05:56:14 -04:00
crypto: ccree - add CID and PID support
The new HW uses a new standard product and component ID registers replacing the old ad-hoc version and signature gister schemes. Update the driver to support the new HW ID registers. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
committed by
Herbert Xu
parent
6f17e00f77
commit
dcf6285d18
@@ -1,5 +1,5 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
/* Copyright (C) 2012-2018 ARM Limited or its affiliates. */
|
||||
/* Copyright (C) 2012-2019 ARM Limited or its affiliates. */
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/debugfs.h>
|
||||
@@ -25,9 +25,24 @@ struct cc_debugfs_ctx {
|
||||
*/
|
||||
static struct dentry *cc_debugfs_dir;
|
||||
|
||||
static struct debugfs_reg32 debug_regs[] = {
|
||||
static struct debugfs_reg32 ver_sig_regs[] = {
|
||||
{ .name = "SIGNATURE" }, /* Must be 0th */
|
||||
{ .name = "VERSION" }, /* Must be 1st */
|
||||
};
|
||||
|
||||
static struct debugfs_reg32 pid_cid_regs[] = {
|
||||
CC_DEBUG_REG(PERIPHERAL_ID_0),
|
||||
CC_DEBUG_REG(PERIPHERAL_ID_1),
|
||||
CC_DEBUG_REG(PERIPHERAL_ID_2),
|
||||
CC_DEBUG_REG(PERIPHERAL_ID_3),
|
||||
CC_DEBUG_REG(PERIPHERAL_ID_4),
|
||||
CC_DEBUG_REG(COMPONENT_ID_0),
|
||||
CC_DEBUG_REG(COMPONENT_ID_1),
|
||||
CC_DEBUG_REG(COMPONENT_ID_2),
|
||||
CC_DEBUG_REG(COMPONENT_ID_3),
|
||||
};
|
||||
|
||||
static struct debugfs_reg32 debug_regs[] = {
|
||||
CC_DEBUG_REG(HOST_IRR),
|
||||
CC_DEBUG_REG(HOST_POWER_DOWN_EN),
|
||||
CC_DEBUG_REG(AXIM_MON_ERR),
|
||||
@@ -53,10 +68,7 @@ int cc_debugfs_init(struct cc_drvdata *drvdata)
|
||||
{
|
||||
struct device *dev = drvdata_to_dev(drvdata);
|
||||
struct cc_debugfs_ctx *ctx;
|
||||
struct debugfs_regset32 *regset;
|
||||
|
||||
debug_regs[0].offset = drvdata->sig_offset;
|
||||
debug_regs[1].offset = drvdata->ver_offset;
|
||||
struct debugfs_regset32 *regset, *verset;
|
||||
|
||||
ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL);
|
||||
if (!ctx)
|
||||
@@ -75,8 +87,26 @@ int cc_debugfs_init(struct cc_drvdata *drvdata)
|
||||
debugfs_create_regset32("regs", 0400, ctx->dir, regset);
|
||||
debugfs_create_bool("coherent", 0400, ctx->dir, &drvdata->coherent);
|
||||
|
||||
drvdata->debugfs = ctx;
|
||||
verset = devm_kzalloc(dev, sizeof(*verset), GFP_KERNEL);
|
||||
/* Failing here is not important enough to fail the module load */
|
||||
if (!regset)
|
||||
goto out;
|
||||
|
||||
if (drvdata->hw_rev <= CC_HW_REV_712) {
|
||||
ver_sig_regs[0].offset = drvdata->sig_offset;
|
||||
ver_sig_regs[1].offset = drvdata->ver_offset;
|
||||
verset->regs = ver_sig_regs;
|
||||
verset->nregs = ARRAY_SIZE(ver_sig_regs);
|
||||
} else {
|
||||
verset->regs = pid_cid_regs;
|
||||
verset->nregs = ARRAY_SIZE(pid_cid_regs);
|
||||
}
|
||||
verset->base = drvdata->cc_base;
|
||||
|
||||
debugfs_create_regset32("version", 0400, ctx->dir, verset);
|
||||
|
||||
out:
|
||||
drvdata->debugfs = ctx;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user