From patchwork Thu Apr 17 11:56:17 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taras Kondratiuk X-Patchwork-Id: 28560 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ig0-f197.google.com (mail-ig0-f197.google.com [209.85.213.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3F8A820674 for ; Thu, 17 Apr 2014 11:57:36 +0000 (UTC) Received: by mail-ig0-f197.google.com with SMTP id hn18sf1928683igb.0 for ; Thu, 17 Apr 2014 04:57:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:cc:subject:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list:content-type :content-transfer-encoding; bh=VARvOCVglMYkaxVkwJZpAbRBt0UOTPg9Kst7GYNRMhg=; b=LAIyO6UekFDr9dKT723sS03VtG6OI7idY/VEo6SWrQutwgfOOWZEivaD5A5bHm7r0h bWvczPA7o13qUb9gVKmHx1uIpl2C1fW3ghhPn/DqO0Cjzm/svpbvywLoWQDFCogy+5SF qHk8wpT0cJtKn5t698pI8gU+3zU0HfA8BG1Q02U36x91/DqLbeMCwvWvaSvZoUCZxuah CUHaqQhpt46b6unF9EWPsamK+iUIRYPiRWbtAcIQTJFmEpj89Y+mnexzPKPoTteixNmn 63rLdoRd58RnJiAPv2J50HPV6FhzYltK69f/z0ZrVHKGo14uUYAKXQOmmQdT+ttyLMWv v0dw== X-Gm-Message-State: ALoCoQnF0o4CZOBD3/i99WLhjeKQMNiRW65WpcNUPDaNZ50AE1Dq9H34Os4r9qMNoDBuRgTlR1rh X-Received: by 10.43.14.137 with SMTP id pq9mr4777312icb.12.1397735855689; Thu, 17 Apr 2014 04:57:35 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.27.138 with SMTP id 10ls1168821qgx.52.gmail; Thu, 17 Apr 2014 04:57:35 -0700 (PDT) X-Received: by 10.58.77.238 with SMTP id v14mr1754800vew.27.1397735855472; Thu, 17 Apr 2014 04:57:35 -0700 (PDT) Received: from mail-vc0-f174.google.com (mail-vc0-f174.google.com [209.85.220.174]) by mx.google.com with ESMTPS id b7si4411959vev.202.2014.04.17.04.57.35 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 17 Apr 2014 04:57:35 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.174 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.174; Received: by mail-vc0-f174.google.com with SMTP id ld13so357723vcb.5 for ; Thu, 17 Apr 2014 04:57:35 -0700 (PDT) X-Received: by 10.220.75.7 with SMTP id w7mr7363430vcj.20.1397735855380; Thu, 17 Apr 2014 04:57:35 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp29019vcb; Thu, 17 Apr 2014 04:57:35 -0700 (PDT) X-Received: by 10.224.79.72 with SMTP id o8mr11963873qak.20.1397735855001; Thu, 17 Apr 2014 04:57:35 -0700 (PDT) Received: from ip-10-141-164-156.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id f7si10524347qge.98.2014.04.17.04.57.34 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 17 Apr 2014 04:57:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-141-164-156.ec2.internal) by ip-10-141-164-156.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1WakwT-00067B-WA; Thu, 17 Apr 2014 11:57:21 +0000 Received: from mail-ee0-f50.google.com ([74.125.83.50]) by ip-10-141-164-156.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1Wakvl-00064X-PK for lng-odp@lists.linaro.org; Thu, 17 Apr 2014 11:56:37 +0000 Received: by mail-ee0-f50.google.com with SMTP id c13so571217eek.23 for ; Thu, 17 Apr 2014 04:56:44 -0700 (PDT) X-Received: by 10.14.210.65 with SMTP id t41mr13505193eeo.35.1397735803761; Thu, 17 Apr 2014 04:56:43 -0700 (PDT) Received: from uglx0153363.synapse.com ([195.238.92.128]) by mx.google.com with ESMTPSA id z48sm66742553eel.27.2014.04.17.04.56.42 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 17 Apr 2014 04:56:43 -0700 (PDT) From: Taras Kondratiuk To: lng-odp@lists.linaro.org Date: Thu, 17 Apr 2014 14:56:17 +0300 Message-Id: <1397735782-31924-7-git-send-email-taras.kondratiuk@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1397735782-31924-1-git-send-email-taras.kondratiuk@linaro.org> References: <1397735782-31924-1-git-send-email-taras.kondratiuk@linaro.org> Cc: Filip Moerman Subject: [lng-odp] [PATCH v2 06/11] Keystone2: Initialize hardware X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: lng-odp-bounces@lists.linaro.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: taras.kondratiuk@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.174 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Init hardware and helper libraries environment on ODP init. Signed-off-by: Taras Kondratiuk --- platform/linux-keystone2/source/odp_init.c | 84 ++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) diff --git a/platform/linux-keystone2/source/odp_init.c b/platform/linux-keystone2/source/odp_init.c index d4c2eb8..b466e67 100644 --- a/platform/linux-keystone2/source/odp_init.c +++ b/platform/linux-keystone2/source/odp_init.c @@ -7,6 +7,85 @@ #include #include #include +#include +#include +#include +#include +#include + +/* + * Make region_configs[] global, because hw_config is saved in + * ti_em_rh_init_global() and it references region_configs[]. + */ +static ti_em_osal_hw_region_config_t region_configs[TI_ODP_REGION_NUM]; + +static int ti_init_hw_config(void) +{ + ti_em_rh_hw_config_t hw_config; + ti_em_osal_hw_region_config_t *reg_config; + memset(&hw_config, 0, sizeof(ti_em_rh_hw_config_t)); + + /* Set ODP initialization parameters */ + hw_config.private_free_queue_idx = MY_EM_PRIVATE_FREE_QUEUE_IDX; + hw_config.hw_queue_base_idx = MY_EM_SCHED_QUEUE_IDX; + hw_config.dma_idx = -1; /* not used */ + hw_config.dma_queue_base_idx = 0; /* not used */ + hw_config.device_id = MY_EM_DEVICE_ID; + hw_config.process_id = MY_EM_PROCESS_ID; + hw_config.chain_config_ptr = NULL; + hw_config.dispatch_mode = MY_EM_DISPATCH_MODE; + + /* The location of the PDSP communication memory (physical address) */ + hw_config.pdsp_comm_mem_config.paddr = MY_EM_PDSP_COMM_MEM_BASE; + hw_config.pdsp_comm_mem_config.vaddr = MY_EM_PDSP_COMM_MEM_VBASE; + hw_config.pdsp_comm_mem_config.size = MY_EM_PDSP_COMM_MEM_SIZE; + hw_config.pdsp_comm_mem_config.offset = MY_EM_PDSP_COMM_MEM_OFFSET; + + TI_EM_OSAL_TRACE(2, "physical address of the PDSP communication memory is 0x%x\n", + hw_config.pdsp_comm_mem_config.paddr); + + /* Define descriptor regions */ + reg_config = ®ion_configs[TI_EM_RH_PUBLIC]; + reg_config->region_idx = TI_ODP_PUBLIC_REGION_IDX; + reg_config->desc_size = TI_ODP_PUBLIC_DESC_SIZE; + reg_config->desc_num = TI_ODP_PUBLIC_DESC_NUM; + reg_config->desc_base = TI_ODP_PUBLIC_DESC_BASE; + reg_config->desc_vbase = TI_ODP_PUBLIC_DESC_VBASE; + reg_config->desc_offset = TI_ODP_PUBLIC_DESC_OFFSET; + reg_config->desc_flag = TI_EM_RH_UNMANAGED_DESCRIPTOR; + reg_config->start_idx = TI_ODP_PUBLIC_START_DESC_IDX; + + reg_config = ®ion_configs[TI_EM_RH_PRIVATE]; + reg_config->region_idx = TI_ODP_PRIVATE_REGION_IDX; + reg_config->desc_size = TI_EM_PRIVATE_EVENT_DSC_SIZE; + reg_config->desc_num = TI_EM_RH_PRIVATE_EVENT_NUM; + reg_config->desc_base = TI_ODP_PRIVATE_DESC_BASE; + reg_config->desc_vbase = TI_ODP_PRIVATE_DESC_VBASE; + reg_config->desc_offset = TI_ODP_PRIVATE_DESC_OFFSET; + reg_config->desc_flag = TI_EM_RH_UNMANAGED_DESCRIPTOR; + reg_config->start_idx = TI_ODP_PRIVATE_START_DESC_IDX; + + hw_config.region_num = TI_ODP_REGION_NUM; + hw_config.region_configs = ®ion_configs[0]; + + /* Define PDSP configuration */ + hw_config.pdsp_num = 0; + /* do not use router (no chaining) */ + hw_config.pdsp_router.pdsp_id = -1; + + TI_EM_OSAL_TRACE(1, "calling EM global initialization\n"); + + /* call OpenEM global initialization */ + if (ti_em_rh_init_global(0, + NULL, + MY_EM_CORE_NUM, + &hw_config) != EM_OK) { + TI_EM_OSAL_ERROR("EM global initialization failed!\n"); + return -1; + } + + return 0; +} int odp_init_global(void) @@ -15,6 +94,9 @@ int odp_init_global(void) odp_system_info_init(); + ti_em_osal_core_init_global(); + ti_init_hw_config(); + if (odp_shm_init_global()) { ODP_ERR("ODP shm init failed.\n"); return -1; @@ -53,6 +135,8 @@ int odp_init_local(int thr_id) { odp_thread_init_local(thr_id); + ti_em_rh_init_local(); + if (odp_pktio_init_local()) { ODP_ERR("ODP packet io local init failed.\n"); return -1;