From patchwork Thu Jul 19 12:40:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sumit Garg X-Patchwork-Id: 142343 Delivered-To: patches@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp1687918ljj; Thu, 19 Jul 2018 05:41:27 -0700 (PDT) X-Received: by 2002:a63:9741:: with SMTP id d1-v6mr9595007pgo.403.1532004087299; Thu, 19 Jul 2018 05:41:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532004087; cv=none; d=google.com; s=arc-20160816; b=J2+lU6wYZcu2rzAUqCT99G5Yh8/4HGBqWo2O90hc+59jY60Z5340T+mJsvA+6V/qkq XmYerc3VVnepDQqLPuQ8ryDwkXhAOTS85jLL8zmQ1xHyCHKRkrRnX0IuzZC8n2oYrSi5 aRbt8IavNyTKACXGARlnEHW+nKC6RZ2vrFoR2+FIal9EGtBYCD0sGmxCg9oGiIwJuPlf CRLiNGss8l8bqMM9fDc9GhQcIx3zB/mZkvJIGnxc6Zbe8sxhdt8A6geHEMJnr3C55pui fpYhhSqJYVBXeabQCig6gO7W8TWMIzWwmlDvl1k05TGUMK9i5BvOiCj+TJw9dmafOGoe n5Fg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=caceg+fiv3xSTXYJkmNVYL9R9wxfoUhfpyBYdZccsHc=; b=bp2e9rHBc4s1KROXzKWl/LhWiKul9zcbPTt+YrffzHmK8oOgUm44fhB40cHZBMS5ly lj9+PEbvhT/qm81HMcc31C2FQ+LcA6aVC76Jo+oy18Fn6aYNNjPjnxsqpnCplbrDHHOw 4PyIucWeiZUtjCFg2wEPVwK2+XT7m/YKUuBLgsuSlr/GJk6bZcy8OhOi7pUNilPg6j+R 44D1OEOhbJE8M4pO8kJesJe8g9vFaRN7Ymc6MO3vBRP/wu5IBpf2cy20TyzjBoWo/EJa 9cYPAh1imTs4re1IPK0DfewkH26gwjlx/4/Dnzi/a4XmGkNVQ468Elk6mboy23bZ8Wft sOWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OelN3U+Q; spf=pass (google.com: domain of sumit.garg@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=sumit.garg@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id c8-v6sor1617573pgt.351.2018.07.19.05.41.27 for (Google Transport Security); Thu, 19 Jul 2018 05:41:27 -0700 (PDT) Received-SPF: pass (google.com: domain of sumit.garg@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OelN3U+Q; spf=pass (google.com: domain of sumit.garg@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=sumit.garg@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=caceg+fiv3xSTXYJkmNVYL9R9wxfoUhfpyBYdZccsHc=; b=OelN3U+Q2pzWHVniHCAFkY5AxoJnZYIYA/vkuhX+M13puyq3O8svoM1+ScdrbPG0hd 9YCsdaTT5gbwgyAeegjZWN37XD+4CJQIO/PS+lkhfizSgEOF6P3DAi2gsmexTwL7LGNh 3NMRgS4A+IlIHPjUCA62B4/jgeTNSz+MYYkvM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=caceg+fiv3xSTXYJkmNVYL9R9wxfoUhfpyBYdZccsHc=; b=frXFwQVoSGk7eAG/WQNy63f+z7m+qbRJCEqum5FcWIJfATl35g32op7E80Ge+RhN7R vaGWBWv88FJltr+C8klhkNg3HhrLAHlHAKPFcWw+C1crlnvacxkNd/Wg33l0liCgcjJd nx8zKhiRkCyTRor/w6UlctqnFYdqOQqpMh4lv2+nO8yVrQfZyuELF9GFwO/aHTEhQftA bGwNOlbLT9cisJxTY3SNFIUoBDiKRjJkhBOVyI6QsPZ5CmcVFHNZf8skGNKlPOY3KANT Nh0CwS+4L7NAR1mertMmZk/jBe/HZ5bJJPN7k06yQ9hVhygBayu20TO66n/kMSJYwmCx CJnw== X-Gm-Message-State: AOUpUlFlmgSZvq17l+YBFqFg3ejLxExFD3NdkX/CtKIhNI9oyPv/GDTd UXOgo7KsI4q0n17fXJP2kchcm/4o X-Google-Smtp-Source: AAOMgpfu8IuE8RCRFTPh4GI2bOyV871hYelYAJGeG4cSjJNnDN1DL2ip4SlBbSr0owKVRM0mD03B2w== X-Received: by 2002:a63:9a52:: with SMTP id e18-v6mr9753472pgo.188.1532004086781; Thu, 19 Jul 2018 05:41:26 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([117.212.88.88]) by smtp.gmail.com with ESMTPSA id v3-v6sm23145045pgb.54.2018.07.19.05.41.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 19 Jul 2018 05:41:26 -0700 (PDT) From: Sumit Garg To: daniel.thompson@linaro.org Cc: patches@linaro.org, Sumit Garg Subject: [PATCH] synquacer: Enable optional OP-TEE support Date: Thu, 19 Jul 2018 18:10:55 +0530 Message-Id: <1532004055-29999-1-git-send-email-sumit.garg@linaro.org> X-Mailer: git-send-email 2.7.4 OP-TEE is optional on Developerbox controlled via GPIO (DIP SW-3-3). Signed-off-by: Sumit Garg --- plat/socionext/synquacer/include/platform_def.h | 1 + plat/socionext/synquacer/platform.mk | 4 ++++ plat/socionext/synquacer/sq_bl31_setup.c | 25 +++++++++++++++++-------- 3 files changed, 22 insertions(+), 8 deletions(-) -- 2.7.4 diff --git a/plat/socionext/synquacer/include/platform_def.h b/plat/socionext/synquacer/include/platform_def.h index 3e16642..09556e2 100644 --- a/plat/socionext/synquacer/include/platform_def.h +++ b/plat/socionext/synquacer/include/platform_def.h @@ -77,5 +77,6 @@ #define PLAT_SQ_GICR_BASE 0x30400000 #define PLAT_SQ_GPIO_BASE 0x51000000 +#define PLAT_SQ_OPTEE_GPIO_EN_MASK 0x4 #endif /* __PLATFORM_DEF_H__ */ diff --git a/plat/socionext/synquacer/platform.mk b/plat/socionext/synquacer/platform.mk index 546f84a..96427a1 100644 --- a/plat/socionext/synquacer/platform.mk +++ b/plat/socionext/synquacer/platform.mk @@ -18,6 +18,10 @@ ERRATA_A53_855873 := 1 # Libraries include lib/xlat_tables_v2/xlat_tables.mk +ifeq (${SPD},opteed) +TF_CFLAGS_aarch64 += -DBL32_BASE=0xfc000000 +endif + PLAT_PATH := plat/socionext/synquacer PLAT_INCLUDES := -I$(PLAT_PATH)/include \ -I$(PLAT_PATH)/drivers/scpi \ diff --git a/plat/socionext/synquacer/sq_bl31_setup.c b/plat/socionext/synquacer/sq_bl31_setup.c index 461c8de..753de7b 100644 --- a/plat/socionext/synquacer/sq_bl31_setup.c +++ b/plat/socionext/synquacer/sq_bl31_setup.c @@ -71,14 +71,23 @@ void bl31_early_platform_setup(bl31_params_t *from_bl2, assert(plat_params_from_bl2 == NULL); #ifdef BL32_BASE - /* Populate entry point information for BL32 */ - SET_PARAM_HEAD(&bl32_image_ep_info, - PARAM_EP, - VERSION_1, - 0); - SET_SECURITY_STATE(bl32_image_ep_info.h.attr, SECURE); - bl32_image_ep_info.pc = BL32_BASE; - bl32_image_ep_info.spsr = sq_get_spsr_for_bl32_entry(); + NOTICE("TF-A compiled with SPD=opteed\n"); + + if (mmio_read_32(PLAT_SQ_GPIO_BASE) & PLAT_SQ_OPTEE_GPIO_EN_MASK) { + NOTICE("OP-TEE is loaded by SCP firmware\n"); + /* Populate entry point information for BL32 */ + SET_PARAM_HEAD(&bl32_image_ep_info, + PARAM_EP, + VERSION_1, + 0); + SET_SECURITY_STATE(bl32_image_ep_info.h.attr, SECURE); + bl32_image_ep_info.pc = BL32_BASE; + bl32_image_ep_info.spsr = sq_get_spsr_for_bl32_entry(); + } else { + NOTICE("OP-TEE is not loaded by SCP firmware\n"); + } +#else + NOTICE("TF-A compiled without SPD=opteed\n"); #endif /* BL32_BASE */ /* Populate entry point information for BL33 */