static int __init init_clock_states(void) { unsigned int i; /* * Disable peripheral clocks enabled by bootloader/default * but without drivers */ for (i = 0; i < ARRAY_SIZE(loader_enabled_clk); i++) if (!clk_enable(loader_enabled_clk[i])) clk_disable(loader_enabled_clk[i]); /* * APEATCLK and APETRACECLK are enabled at boot and needed * in order to debug with Lauterbach */ if (!clk_enable(&apeatclk)) { if (!ux500_jtag_enabled()) clk_disable(&apeatclk); } if (!clk_enable(&apetraceclk)) { if (!ux500_jtag_enabled()) clk_disable(&apetraceclk); } INIT_DELAYED_WORK(&sysclk_disable_work, sysclk_init_disable); schedule_delayed_work(&sysclk_disable_work, 10 * HZ); return 0; }
static int __init product_detect(void) { int err; int origin_err; struct tee_operation operation = {0}; struct tee_context context; struct tee_session session; /* Selects trustzone application needed for the job. */ struct tee_uuid static_uuid = { STATIC_TEE_TA_START_LOW, STATIC_TEE_TA_START_MID, STATIC_TEE_TA_START_HIGH, STATIC_TEE_TA_START_CLOCKSEQ, }; err = teec_initialize_context(NULL, &context); if (err) { pr_err("ux500-product: unable to initialize tee context," " err = %d\n", err); err = -EINVAL; goto error0; } err = teec_open_session(&context, &session, &static_uuid, TEEC_LOGIN_PUBLIC, NULL, NULL, &origin_err); if (err) { pr_err("ux500-product: unable to open tee session," " tee error = %d, origin error = %d\n", err, origin_err); err = -EINVAL; goto error1; } memset(&operation, 0, sizeof(struct tee_operation)); if (cpu_is_u8500_family()) { operation.shm[0].buffer = &product_config; operation.shm[0].size = sizeof(product_config); operation.shm[0].flags = TEEC_MEM_OUTPUT; operation.flags = TEEC_MEMREF_0_USED; } else if (cpu_is_ux540_family()) { operation.param[0].tmpref.buffer = &product_config; operation.param[0].tmpref.size = sizeof(product_config); operation.types = TEEC_PARAM_TYPES(TEEC_MEMREF_TEMP_OUTPUT, TEEC_NONE, TEEC_NONE, TEEC_NONE); } else { pr_err("ux500-product: incorrect memref\n"); err = -EINVAL; goto error1; } err = teec_invoke_command(&session, TEE_STA_GET_PRODUCT_CONFIG, &operation, &origin_err); if (err) { pr_err("ux500-product: fetching product settings failed, err=%d", err); err = -EINVAL; goto error1; } switch (product_config.product_id) { case TEE_PRODUCT_ID_8400: pr_info("ux500-product: u8400 detected\n"); break; case TEE_PRODUCT_ID_8500B: pr_info("ux500-product: u8500B detected\n"); break; case TEE_PRODUCT_ID_9500: pr_info("ux500-product: a9500 detected\n"); break; case TEE_PRODUCT_ID_7400: pr_info("ux500-product: u7400 detected\n"); break; case TEE_PRODUCT_ID_8500C: pr_info("ux500-product: u8500C detected\n"); break; case TEE_PRODUCT_ID_8500A: pr_info("ux500-product: u8500A detected\n"); break; case TEE_PRODUCT_ID_8500E: pr_info("ux500-product: u8500E detected\n"); break; case TEE_PRODUCT_ID_8520F: pr_info("ux500-product: u8520F detected\n"); break; case TEE_PRODUCT_ID_8520H: pr_info("ux500-product: u8520H detected\n"); break; case TEE_PRODUCT_ID_9540: pr_info("ux500-product: u9540 detected\n"); break; case TEE_PRODUCT_ID_9500C: pr_info("ux500-product: a9500C detected\n"); break; case TEE_PRODUCT_ID_8500F: pr_info("ux500-product: u8500F detected\n"); break; case TEE_PRODUCT_ID_8540APE: pr_info("ux500-product: u8540APE detected\n"); break; case TEE_PRODUCT_ID_8540XMIP: pr_info("ux500-product: u8540XMIP detected\n"); break; case TEE_PRODUCT_ID_8520E: pr_info("ux500-product: u8520E detected\n"); break; case TEE_PRODUCT_ID_8520J: pr_info("ux500-product: u8520J detected\n"); break; case TEE_PRODUCT_ID_UNKNOWN: default: pr_info("ux500-product: UNKNOWN! (0x%x) detected\n", product_config.product_id); break; } pr_info("ux500-product: JTAG is %s\n", ux500_jtag_enabled() ? "enabled" : "disabled"); error1: (void) teec_finalize_context(&context); error0: return err; }
static bool inline tpiu_clocked(void) { return ux500_jtag_enabled(); }