Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 318382
b: refs/heads/master
c: 82c2f96
h: refs/heads/master
v: v3
  • Loading branch information
Alex Porosanu authored and Herbert Xu committed Jul 11, 2012
1 parent f8dcc9e commit d1cad9d
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1af8ea862c9a9a6d5dc100850036cc7a641bb242
refs/heads/master: 82c2f9607b8a4667e9d89613478748f4e2b7288b
41 changes: 39 additions & 2 deletions trunk/drivers/crypto/caam/ctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "jr.h"
#include "desc_constr.h"
#include "error.h"
#include "ctrl.h"

static int caam_remove(struct platform_device *pdev)
{
Expand Down Expand Up @@ -155,10 +156,44 @@ static void kick_trng(struct platform_device *pdev)
clrbits32(&r4tst->rtmctl, RTMCTL_PRGM);
}

/**
* caam_get_era() - Return the ERA of the SEC on SoC, based
* on the SEC_VID register.
* Returns the ERA number (1..4) or -ENOTSUPP if the ERA is unknown.
* @caam_id - the value of the SEC_VID register
**/
int caam_get_era(u64 caam_id)
{
struct sec_vid *sec_vid = (struct sec_vid *)&caam_id;
static const struct {
u16 ip_id;
u8 maj_rev;
u8 era;
} caam_eras[] = {
{0x0A10, 1, 1},
{0x0A10, 2, 2},
{0x0A12, 1, 3},
{0x0A14, 1, 3},
{0x0A14, 2, 4},
{0x0A16, 1, 4},
{0x0A11, 1, 4}
};
int i;

for (i = 0; i < ARRAY_SIZE(caam_eras); i++)
if (caam_eras[i].ip_id == sec_vid->ip_id &&
caam_eras[i].maj_rev == sec_vid->maj_rev)
return caam_eras[i].era;

return -ENOTSUPP;
}
EXPORT_SYMBOL(caam_get_era);

/* Probe routine for CAAM top (controller) level */
static int caam_probe(struct platform_device *pdev)
{
int ret, ring, rspec;
u64 caam_id;
struct device *dev;
struct device_node *nprop, *np;
struct caam_ctrl __iomem *ctrl;
Expand Down Expand Up @@ -276,9 +311,11 @@ static int caam_probe(struct platform_device *pdev)
/* Initialize queue allocator lock */
spin_lock_init(&ctrlpriv->jr_alloc_lock);

caam_id = rd_reg64(&topregs->ctrl.perfmon.caam_id);

/* Report "alive" for developer to see */
dev_info(dev, "device ID = 0x%016llx\n",
rd_reg64(&topregs->ctrl.perfmon.caam_id));
dev_info(dev, "device ID = 0x%016llx (Era %d)\n", caam_id,
caam_get_era(caam_id));
dev_info(dev, "job rings = %d, qi = %d\n",
ctrlpriv->total_jobrs, ctrlpriv->qi_present);

Expand Down
13 changes: 13 additions & 0 deletions trunk/drivers/crypto/caam/ctrl.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* CAAM control-plane driver backend public-level include definitions
*
* Copyright 2012 Freescale Semiconductor, Inc.
*/

#ifndef CTRL_H
#define CTRL_H

/* Prototypes for backend-level services exposed to APIs */
int caam_get_era(u64 caam_id);

#endif /* CTRL_H */
6 changes: 6 additions & 0 deletions trunk/drivers/crypto/caam/regs.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,12 @@ struct jr_outentry {
#define CHA_NUM_DECONUM_SHIFT 56
#define CHA_NUM_DECONUM_MASK (0xfull << CHA_NUM_DECONUM_SHIFT)

struct sec_vid {
u16 ip_id;
u8 maj_rev;
u8 min_rev;
};

struct caam_perfmon {
/* Performance Monitor Registers f00-f9f */
u64 req_dequeued; /* PC_REQ_DEQ - Dequeued Requests */
Expand Down

0 comments on commit d1cad9d

Please sign in to comment.