2 * CAAM control-plane driver backend
3 * Controller-level driver, kernel property detection, initialization
5 * Copyright 2008-2015 Freescale Semiconductor, Inc.
8 #include <linux/of_address.h>
9 #include <linux/of_irq.h>
15 #include "desc_constr.h"
21 * Descriptor to instantiate RNG State Handle 0 in normal mode and
22 * load the JDKEK, TDKEK and TDSK registers
24 static void build_instantiation_desc(u32 *desc, int handle, int do_sk)
26 u32 *jump_cmd, op_flags;
28 init_job_desc(desc, 0);
30 op_flags = OP_TYPE_CLASS1_ALG | OP_ALG_ALGSEL_RNG |
31 (handle << OP_ALG_AAI_SHIFT) | OP_ALG_AS_INIT;
33 /* INIT RNG in non-test mode */
34 append_operation(desc, op_flags);
36 if (!handle && do_sk) {
38 * For SH0, Secure Keys must be generated as well
42 jump_cmd = append_jump(desc, JUMP_CLASS_CLASS1);
43 set_jump_tgt_here(desc, jump_cmd);
46 * load 1 to clear written reg:
47 * resets the done interrrupt and returns the RNG to idle.
49 append_load_imm_u32(desc, 1, LDST_SRCDST_WORD_CLRW);
51 /* Initialize State Handle */
52 append_operation(desc, OP_TYPE_CLASS1_ALG | OP_ALG_ALGSEL_RNG |
56 append_jump(desc, JUMP_CLASS_CLASS1 | JUMP_TYPE_HALT);
59 /* Descriptor for deinstantiation of State Handle 0 of the RNG block. */
60 static void build_deinstantiation_desc(u32 *desc, int handle)
62 init_job_desc(desc, 0);
64 /* Uninstantiate State Handle 0 */
65 append_operation(desc, OP_TYPE_CLASS1_ALG | OP_ALG_ALGSEL_RNG |
66 (handle << OP_ALG_AAI_SHIFT) | OP_ALG_AS_INITFINAL);
68 append_jump(desc, JUMP_CLASS_CLASS1 | JUMP_TYPE_HALT);
72 * run_descriptor_deco0 - runs a descriptor on DECO0, under direct control of
73 * the software (no JR/QI used).
74 * @ctrldev - pointer to device
75 * @status - descriptor status, after being run
77 * Return: - 0 if no error occurred
78 * - -ENODEV if the DECO couldn't be acquired
79 * - -EAGAIN if an error occurred while executing the descriptor
81 static inline int run_descriptor_deco0(struct device *ctrldev, u32 *desc,
84 struct caam_drv_private *ctrlpriv = dev_get_drvdata(ctrldev);
85 struct caam_full __iomem *topregs;
86 unsigned int timeout = 100000;
87 u32 deco_dbg_reg, flags;
90 /* Set the bit to request direct access to DECO0 */
91 topregs = (struct caam_full __iomem *)ctrlpriv->ctrl;
92 setbits32(&topregs->ctrl.deco_rq, DECORR_RQD0ENABLE);
94 while (!(rd_reg32(&topregs->ctrl.deco_rq) & DECORR_DEN0) &&
99 dev_err(ctrldev, "failed to acquire DECO 0\n");
100 clrbits32(&topregs->ctrl.deco_rq, DECORR_RQD0ENABLE);
104 for (i = 0; i < desc_len(desc); i++)
105 wr_reg32(&topregs->deco.descbuf[i], *(desc + i));
107 flags = DECO_JQCR_WHL;
109 * If the descriptor length is longer than 4 words, then the
110 * FOUR bit in JRCTRL register must be set.
112 if (desc_len(desc) >= 4)
113 flags |= DECO_JQCR_FOUR;
115 /* Instruct the DECO to execute it */
116 wr_reg32(&topregs->deco.jr_ctl_hi, flags);
120 deco_dbg_reg = rd_reg32(&topregs->deco.desc_dbg);
122 * If an error occured in the descriptor, then
123 * the DECO status field will be set to 0x0D
125 if ((deco_dbg_reg & DESC_DBG_DECO_STAT_MASK) ==
126 DESC_DBG_DECO_STAT_HOST_ERR)
129 } while ((deco_dbg_reg & DESC_DBG_DECO_STAT_VALID) && --timeout);
131 *status = rd_reg32(&topregs->deco.op_status_hi) &
132 DECO_OP_STATUS_HI_ERR_MASK;
134 /* Mark the DECO as free */
135 clrbits32(&topregs->ctrl.deco_rq, DECORR_RQD0ENABLE);
144 * instantiate_rng - builds and executes a descriptor on DECO0,
145 * which initializes the RNG block.
146 * @ctrldev - pointer to device
147 * @state_handle_mask - bitmask containing the instantiation status
148 * for the RNG4 state handles which exist in
149 * the RNG4 block: 1 if it's been instantiated
150 * by an external entry, 0 otherwise.
151 * @gen_sk - generate data to be loaded into the JDKEK, TDKEK and TDSK;
152 * Caution: this can be done only once; if the keys need to be
153 * regenerated, a POR is required
155 * Return: - 0 if no error occurred
156 * - -ENOMEM if there isn't enough memory to allocate the descriptor
157 * - -ENODEV if DECO0 couldn't be acquired
158 * - -EAGAIN if an error occurred when executing the descriptor
159 * f.i. there was a RNG hardware error due to not "good enough"
160 * entropy being aquired.
162 static int instantiate_rng(struct device *ctrldev, int state_handle_mask,
165 struct caam_drv_private *ctrlpriv = dev_get_drvdata(ctrldev);
166 struct caam_full __iomem *topregs;
167 struct rng4tst __iomem *r4tst;
168 u32 *desc, status, rdsta_val;
171 topregs = (struct caam_full __iomem *)ctrlpriv->ctrl;
172 r4tst = &topregs->ctrl.r4tst[0];
174 desc = kmalloc(CAAM_CMD_SZ * 7, GFP_KERNEL);
178 for (sh_idx = 0; sh_idx < RNG4_MAX_HANDLES; sh_idx++) {
180 * If the corresponding bit is set, this state handle
181 * was initialized by somebody else, so it's left alone.
183 if ((1 << sh_idx) & state_handle_mask)
186 /* Create the descriptor for instantiating RNG State Handle */
187 build_instantiation_desc(desc, sh_idx, gen_sk);
189 /* Try to run it through DECO0 */
190 ret = run_descriptor_deco0(ctrldev, desc, &status);
193 * If ret is not 0, or descriptor status is not 0, then
194 * something went wrong. No need to try the next state
195 * handle (if available), bail out here.
196 * Also, if for some reason, the State Handle didn't get
197 * instantiated although the descriptor has finished
198 * without any error (HW optimizations for later
199 * CAAM eras), then try again.
202 rd_reg32(&topregs->ctrl.r4tst[0].rdsta) & RDSTA_IFMASK;
203 if (status || !(rdsta_val & (1 << sh_idx)))
208 dev_info(ctrldev, "Instantiated RNG4 SH%d\n", sh_idx);
209 /* Clear the contents before recreating the descriptor */
210 memset(desc, 0x00, CAAM_CMD_SZ * 7);
219 * deinstantiate_rng - builds and executes a descriptor on DECO0,
220 * which deinitializes the RNG block.
221 * @ctrldev - pointer to device
222 * @state_handle_mask - bitmask containing the instantiation status
223 * for the RNG4 state handles which exist in
224 * the RNG4 block: 1 if it's been instantiated
226 * Return: - 0 if no error occurred
227 * - -ENOMEM if there isn't enough memory to allocate the descriptor
228 * - -ENODEV if DECO0 couldn't be acquired
229 * - -EAGAIN if an error occurred when executing the descriptor
231 static int deinstantiate_rng(struct device *ctrldev, int state_handle_mask)
236 desc = kmalloc(CAAM_CMD_SZ * 3, GFP_KERNEL);
240 for (sh_idx = 0; sh_idx < RNG4_MAX_HANDLES; sh_idx++) {
242 * If the corresponding bit is set, then it means the state
243 * handle was initialized by us, and thus it needs to be
244 * deintialized as well
246 if ((1 << sh_idx) & state_handle_mask) {
248 * Create the descriptor for deinstantating this state
251 build_deinstantiation_desc(desc, sh_idx);
253 /* Try to run it through DECO0 */
254 ret = run_descriptor_deco0(ctrldev, desc, &status);
258 "Failed to deinstantiate RNG4 SH%d\n",
262 dev_info(ctrldev, "Deinstantiated RNG4 SH%d\n", sh_idx);
271 static int caam_remove(struct platform_device *pdev)
273 struct device *ctrldev;
274 struct caam_drv_private *ctrlpriv;
275 struct caam_full __iomem *topregs;
278 ctrldev = &pdev->dev;
279 ctrlpriv = dev_get_drvdata(ctrldev);
280 topregs = (struct caam_full __iomem *)ctrlpriv->ctrl;
282 /* Remove platform devices for JobRs */
283 for (ring = 0; ring < ctrlpriv->total_jobrs; ring++) {
284 if (ctrlpriv->jrpdev[ring])
285 of_device_unregister(ctrlpriv->jrpdev[ring]);
288 /* De-initialize RNG state handles initialized by this driver. */
289 if (ctrlpriv->rng4_sh_init)
290 deinstantiate_rng(ctrldev, ctrlpriv->rng4_sh_init);
292 /* Shut down debug views */
293 #ifdef CONFIG_DEBUG_FS
294 debugfs_remove_recursive(ctrlpriv->dfs_root);
297 /* Unmap controller region */
298 iounmap(&topregs->ctrl);
301 /* shut clocks off before finalizing shutdown */
302 clk_disable(ctrlpriv->caam_ipg);
303 clk_disable(ctrlpriv->caam_mem);
304 clk_disable(ctrlpriv->caam_aclk);
305 clk_disable(ctrlpriv->caam_emi_slow);
308 kfree(ctrlpriv->jrpdev);
315 * kick_trng - sets the various parameters for enabling the initialization
316 * of the RNG4 block in CAAM
317 * @pdev - pointer to the platform device
318 * @ent_delay - Defines the length (in system clocks) of each entropy sample.
320 static void kick_trng(struct platform_device *pdev, int ent_delay)
322 struct device *ctrldev = &pdev->dev;
323 struct caam_drv_private *ctrlpriv = dev_get_drvdata(ctrldev);
324 struct caam_full __iomem *topregs;
325 struct rng4tst __iomem *r4tst;
328 topregs = (struct caam_full __iomem *)ctrlpriv->ctrl;
329 r4tst = &topregs->ctrl.r4tst[0];
331 /* put RNG4 into program mode */
332 setbits32(&r4tst->rtmctl, RTMCTL_PRGM);
335 * Performance-wise, it does not make sense to
336 * set the delay to a value that is lower
337 * than the last one that worked (i.e. the state handles
338 * were instantiated properly. Thus, instead of wasting
339 * time trying to set the values controlling the sample
340 * frequency, the function simply returns.
342 val = (rd_reg32(&r4tst->rtsdctl) & RTSDCTL_ENT_DLY_MASK)
343 >> RTSDCTL_ENT_DLY_SHIFT;
344 if (ent_delay <= val) {
345 /* put RNG4 into run mode */
346 clrbits32(&r4tst->rtmctl, RTMCTL_PRGM);
350 val = rd_reg32(&r4tst->rtsdctl);
351 val = (val & ~RTSDCTL_ENT_DLY_MASK) |
352 (ent_delay << RTSDCTL_ENT_DLY_SHIFT);
353 wr_reg32(&r4tst->rtsdctl, val);
354 /* min. freq. count, equal to 1/4 of the entropy sample length */
355 wr_reg32(&r4tst->rtfrqmin, ent_delay >> 2);
356 /* max. freq. count, equal to 16 times the entropy sample length */
357 wr_reg32(&r4tst->rtfrqmax, ent_delay << 4);
358 /* put RNG4 into run mode */
359 clrbits32(&r4tst->rtmctl, RTMCTL_PRGM);
363 * caam_get_era() - Return the ERA of the SEC on SoC, based
364 * on the SEC_VID register.
365 * Returns the ERA number (1..4) or -ENOTSUPP if the ERA is unknown.
366 * @caam_id - the value of the SEC_VID register
368 int caam_get_era(u64 caam_id)
370 struct sec_vid *sec_vid = (struct sec_vid *)&caam_id;
371 static const struct {
386 for (i = 0; i < ARRAY_SIZE(caam_eras); i++)
387 if (caam_eras[i].ip_id == sec_vid->ip_id &&
388 caam_eras[i].maj_rev == sec_vid->maj_rev)
389 return caam_eras[i].era;
393 EXPORT_SYMBOL(caam_get_era);
395 /* Probe routine for CAAM top (controller) level */
396 static int caam_probe(struct platform_device *pdev)
398 int ret, ring, rspec, gen_sk, ent_delay = RTSDCTL_ENT_DLY_MIN;
401 struct device_node *nprop, *np;
402 struct caam_ctrl __iomem *ctrl;
403 struct caam_full __iomem *topregs;
404 struct snvs_full __iomem *snvsregs;
405 struct caam_drv_private *ctrlpriv;
406 #ifdef CONFIG_DEBUG_FS
407 struct caam_perfmon *perfmon;
411 ctrlpriv = kzalloc(sizeof(struct caam_drv_private), GFP_KERNEL);
416 dev_set_drvdata(dev, ctrlpriv);
417 ctrlpriv->pdev = pdev;
418 nprop = pdev->dev.of_node;
420 /* Get configuration properties from device tree */
421 /* First, get register page */
422 ctrl = of_iomap(nprop, 0);
424 dev_err(dev, "caam: of_iomap() failed\n");
427 ctrlpriv->ctrl = (struct caam_ctrl __force *)ctrl;
429 /* topregs used to derive pointers to CAAM sub-blocks only */
430 topregs = (struct caam_full __iomem *)ctrl;
432 /* Get the IRQ of the controller (for security violations only) */
433 ctrlpriv->secvio_irq = irq_of_parse_and_map(nprop, 0);
435 /* Get SNVS register Page */
436 np = of_find_compatible_node(NULL, NULL, "fsl,imx6q-caam-snvs");
441 snvsregs = of_iomap(np, 0);
442 ctrlpriv->snvs = snvsregs;
443 /* Get CAAM-SM node and of_iomap() and save */
444 np = of_find_compatible_node(NULL, NULL, "fsl,imx6q-caam-sm");
449 ctrlpriv->sm_base = of_iomap(np, 0);
450 ctrlpriv->sm_size = 0x3fff;
453 * ARM targets tend to have clock control subsystems that can
454 * enable/disable clocking to our device. Turn clocking on to proceed
457 ctrlpriv->caam_ipg = devm_clk_get(&ctrlpriv->pdev->dev, "caam_ipg");
458 if (IS_ERR(ctrlpriv->caam_ipg)) {
459 ret = PTR_ERR(ctrlpriv->caam_ipg);
460 dev_err(&ctrlpriv->pdev->dev,
461 "can't identify CAAM ipg clk: %d\n", ret);
464 ctrlpriv->caam_mem = devm_clk_get(&ctrlpriv->pdev->dev, "caam_mem");
465 if (IS_ERR(ctrlpriv->caam_mem)) {
466 ret = PTR_ERR(ctrlpriv->caam_mem);
467 dev_err(&ctrlpriv->pdev->dev,
468 "can't identify CAAM secure mem clk: %d\n", ret);
471 ctrlpriv->caam_aclk = devm_clk_get(&ctrlpriv->pdev->dev, "caam_aclk");
472 if (IS_ERR(ctrlpriv->caam_aclk)) {
473 ret = PTR_ERR(ctrlpriv->caam_aclk);
474 dev_err(&ctrlpriv->pdev->dev,
475 "can't identify CAAM aclk clk: %d\n", ret);
479 ctrlpriv->caam_emi_slow = devm_clk_get(&ctrlpriv->pdev->dev,
481 ret = clk_prepare_enable(ctrlpriv->caam_emi_slow);
483 dev_err(&pdev->dev, "can't prepare CAAM emi"
484 " slow clock: %d\n", ret);
488 ret = clk_prepare(ctrlpriv->caam_ipg);
490 dev_err(&pdev->dev, "can't prepare CAAM ipg clock: %d\n", ret);
493 ret = clk_prepare(ctrlpriv->caam_mem);
495 dev_err(&pdev->dev, "can't prepare CAAM secure mem clock: %d\n",
499 ret = clk_prepare(ctrlpriv->caam_aclk);
501 dev_err(&pdev->dev, "can't prepare CAAM aclk clock: %d\n", ret);
505 ret = clk_enable(ctrlpriv->caam_ipg);
507 dev_err(&pdev->dev, "can't enable CAAM ipg clock: %d\n", ret);
510 ret = clk_enable(ctrlpriv->caam_mem);
512 dev_err(&pdev->dev, "can't enable CAAM secure mem clock: %d\n",
516 ret = clk_enable(ctrlpriv->caam_aclk);
518 dev_err(&pdev->dev, "can't enable CAAM aclk clock: %d\n", ret);
522 pr_debug("%s caam_ipg clock:%d\n", __func__,
523 (int)clk_get_rate(ctrlpriv->caam_ipg));
524 pr_debug("%s caam_mem clock:%d\n", __func__,
525 (int)clk_get_rate(ctrlpriv->caam_mem));
526 pr_debug("%s caam_aclk clock:%d\n", __func__,
527 (int)clk_get_rate(ctrlpriv->caam_aclk));
531 * Enable DECO watchdogs and, if this is a PHYS_ADDR_T_64BIT kernel,
532 * long pointers in master configuration register
534 setbits32(&topregs->ctrl.mcr, MCFGR_WDENABLE |
535 (sizeof(dma_addr_t) == sizeof(u64) ? MCFGR_LONG_PTR : 0));
537 if (sizeof(dma_addr_t) == sizeof(u64))
538 if (of_device_is_compatible(nprop, "fsl,sec-v5.0"))
539 dma_set_mask(dev, DMA_BIT_MASK(40));
541 dma_set_mask(dev, DMA_BIT_MASK(36));
543 dma_set_mask(dev, DMA_BIT_MASK(32));
546 * Detect and enable JobRs
547 * First, find out how many ring spec'ed, allocate references
548 * for all, then go probe each one.
551 for_each_compatible_node(np, NULL, "fsl,sec-v4.0-job-ring")
554 /* for backward compatible with device trees */
555 for_each_compatible_node(np, NULL, "fsl,sec4.0-job-ring")
559 ctrlpriv->jrpdev = kzalloc(sizeof(struct platform_device *) * rspec,
561 if (ctrlpriv->jrpdev == NULL) {
562 iounmap(&topregs->ctrl);
567 ctrlpriv->total_jobrs = 0;
568 for_each_compatible_node(np, NULL, "fsl,sec-v4.0-job-ring") {
569 ctrlpriv->jrpdev[ring] =
570 of_platform_device_create(np, NULL, dev);
571 if (!ctrlpriv->jrpdev[ring]) {
572 pr_warn("JR%d Platform device creation error\n", ring);
575 ctrlpriv->total_jobrs++;
579 for_each_compatible_node(np, NULL, "fsl,sec4.0-job-ring") {
580 ctrlpriv->jrpdev[ring] =
581 of_platform_device_create(np, NULL, dev);
582 if (!ctrlpriv->jrpdev[ring]) {
583 pr_warn("JR%d Platform device creation error\n",
587 ctrlpriv->total_jobrs++;
592 /* Check to see if QI present. If so, enable */
593 ctrlpriv->qi_present = !!(rd_reg64(&topregs->ctrl.perfmon.comp_parms) &
595 if (ctrlpriv->qi_present) {
596 ctrlpriv->qi = (struct caam_queue_if __force *)&topregs->qi;
597 /* This is all that's required to physically enable QI */
598 wr_reg32(&topregs->qi.qi_control_lo, QICTL_DQEN);
601 /* If no QI and no rings specified, quit and go home */
602 if ((!ctrlpriv->qi_present) && (!ctrlpriv->total_jobrs)) {
603 dev_err(dev, "no queues configured, terminating\n");
608 cha_vid = rd_reg64(&topregs->ctrl.perfmon.cha_id);
611 * If SEC has RNG version >= 4 and RNG state handle has not been
612 * already instantiated, do RNG instantiation
614 if ((cha_vid & CHA_ID_RNG_MASK) >> CHA_ID_RNG_SHIFT >= 4) {
615 ctrlpriv->rng4_sh_init =
616 rd_reg32(&topregs->ctrl.r4tst[0].rdsta);
618 * If the secure keys (TDKEK, JDKEK, TDSK), were already
619 * generated, signal this to the function that is instantiating
620 * the state handles. An error would occur if RNG4 attempts
621 * to regenerate these keys before the next POR.
623 gen_sk = ctrlpriv->rng4_sh_init & RDSTA_SKVN ? 0 : 1;
624 ctrlpriv->rng4_sh_init &= RDSTA_IFMASK;
627 rd_reg32(&topregs->ctrl.r4tst[0].rdsta) &
630 * If either SH were instantiated by somebody else
631 * (e.g. u-boot) then it is assumed that the entropy
632 * parameters are properly set and thus the function
633 * setting these (kick_trng(...)) is skipped.
634 * Also, if a handle was instantiated, do not change
635 * the TRNG parameters.
637 if (!(ctrlpriv->rng4_sh_init || inst_handles)) {
638 kick_trng(pdev, ent_delay);
642 * if instantiate_rng(...) fails, the loop will rerun
643 * and the kick_trng(...) function will modfiy the
644 * upper and lower limits of the entropy sampling
645 * interval, leading to a sucessful initialization of
648 ret = instantiate_rng(dev, inst_handles,
650 } while ((ret == -EAGAIN) && (ent_delay < RTSDCTL_ENT_DLY_MAX));
652 dev_err(dev, "failed to instantiate RNG");
657 * Set handles init'ed by this module as the complement of the
658 * already initialized ones
660 ctrlpriv->rng4_sh_init = ~ctrlpriv->rng4_sh_init & RDSTA_IFMASK;
662 /* Enable RDB bit so that RNG works faster */
663 setbits32(&topregs->ctrl.scfgr, SCFGR_RDBENABLE);
666 /* NOTE: RTIC detection ought to go here, around Si time */
668 caam_id = rd_reg64(&topregs->ctrl.perfmon.caam_id);
670 /* Report "alive" for developer to see */
671 dev_info(dev, "device ID = 0x%016llx (Era %d)\n", caam_id,
672 caam_get_era(caam_id));
673 dev_info(dev, "job rings = %d, qi = %d\n",
674 ctrlpriv->total_jobrs, ctrlpriv->qi_present);
676 #ifdef CONFIG_DEBUG_FS
678 * FIXME: needs better naming distinction, as some amalgamation of
679 * "caam" and nprop->full_name. The OF name isn't distinctive,
680 * but does separate instances
682 perfmon = (struct caam_perfmon __force *)&ctrl->perfmon;
684 ctrlpriv->dfs_root = debugfs_create_dir("caam", NULL);
685 ctrlpriv->ctl = debugfs_create_dir("ctl", ctrlpriv->dfs_root);
687 /* Controller-level - performance monitor counters */
688 ctrlpriv->ctl_rq_dequeued =
689 debugfs_create_u64("rq_dequeued",
690 S_IRUSR | S_IRGRP | S_IROTH,
691 ctrlpriv->ctl, &perfmon->req_dequeued);
692 ctrlpriv->ctl_ob_enc_req =
693 debugfs_create_u64("ob_rq_encrypted",
694 S_IRUSR | S_IRGRP | S_IROTH,
695 ctrlpriv->ctl, &perfmon->ob_enc_req);
696 ctrlpriv->ctl_ib_dec_req =
697 debugfs_create_u64("ib_rq_decrypted",
698 S_IRUSR | S_IRGRP | S_IROTH,
699 ctrlpriv->ctl, &perfmon->ib_dec_req);
700 ctrlpriv->ctl_ob_enc_bytes =
701 debugfs_create_u64("ob_bytes_encrypted",
702 S_IRUSR | S_IRGRP | S_IROTH,
703 ctrlpriv->ctl, &perfmon->ob_enc_bytes);
704 ctrlpriv->ctl_ob_prot_bytes =
705 debugfs_create_u64("ob_bytes_protected",
706 S_IRUSR | S_IRGRP | S_IROTH,
707 ctrlpriv->ctl, &perfmon->ob_prot_bytes);
708 ctrlpriv->ctl_ib_dec_bytes =
709 debugfs_create_u64("ib_bytes_decrypted",
710 S_IRUSR | S_IRGRP | S_IROTH,
711 ctrlpriv->ctl, &perfmon->ib_dec_bytes);
712 ctrlpriv->ctl_ib_valid_bytes =
713 debugfs_create_u64("ib_bytes_validated",
714 S_IRUSR | S_IRGRP | S_IROTH,
715 ctrlpriv->ctl, &perfmon->ib_valid_bytes);
717 /* Controller level - global status values */
718 ctrlpriv->ctl_faultaddr =
719 debugfs_create_u64("fault_addr",
720 S_IRUSR | S_IRGRP | S_IROTH,
721 ctrlpriv->ctl, &perfmon->faultaddr);
722 ctrlpriv->ctl_faultdetail =
723 debugfs_create_u32("fault_detail",
724 S_IRUSR | S_IRGRP | S_IROTH,
725 ctrlpriv->ctl, &perfmon->faultdetail);
726 ctrlpriv->ctl_faultstatus =
727 debugfs_create_u32("fault_status",
728 S_IRUSR | S_IRGRP | S_IROTH,
729 ctrlpriv->ctl, &perfmon->status);
731 /* Internal covering keys (useful in non-secure mode only) */
732 ctrlpriv->ctl_kek_wrap.data = &ctrlpriv->ctrl->kek[0];
733 ctrlpriv->ctl_kek_wrap.size = KEK_KEY_SIZE * sizeof(u32);
734 ctrlpriv->ctl_kek = debugfs_create_blob("kek",
738 &ctrlpriv->ctl_kek_wrap);
740 ctrlpriv->ctl_tkek_wrap.data = &ctrlpriv->ctrl->tkek[0];
741 ctrlpriv->ctl_tkek_wrap.size = KEK_KEY_SIZE * sizeof(u32);
742 ctrlpriv->ctl_tkek = debugfs_create_blob("tkek",
746 &ctrlpriv->ctl_tkek_wrap);
748 ctrlpriv->ctl_tdsk_wrap.data = &ctrlpriv->ctrl->tdsk[0];
749 ctrlpriv->ctl_tdsk_wrap.size = KEK_KEY_SIZE * sizeof(u32);
750 ctrlpriv->ctl_tdsk = debugfs_create_blob("tdsk",
754 &ctrlpriv->ctl_tdsk_wrap);
759 static struct of_device_id caam_match[] = {
761 .compatible = "fsl,sec-v4.0",
764 .compatible = "fsl,sec4.0",
768 MODULE_DEVICE_TABLE(of, caam_match);
770 static struct platform_driver caam_driver = {
773 .owner = THIS_MODULE,
774 .of_match_table = caam_match,
777 .remove = caam_remove,
780 module_platform_driver(caam_driver);
782 MODULE_LICENSE("GPL");
783 MODULE_DESCRIPTION("FSL CAAM request backend");
784 MODULE_AUTHOR("Freescale Semiconductor - NMG/STC");