From patchwork Mon Apr 14 11:55:26 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taras Kondratiuk X-Patchwork-Id: 28315 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ig0-f198.google.com (mail-ig0-f198.google.com [209.85.213.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6D11120F46 for ; Mon, 14 Apr 2014 11:57:52 +0000 (UTC) Received: by mail-ig0-f198.google.com with SMTP id ur14sf12041078igb.9 for ; Mon, 14 Apr 2014 04:57:51 -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=LXVqX+cdU02DcnfPrtoKL9XZ95mTLJyK4jo6mdq1BjAkNp8jp8rsqDVHMe/nnxCf+T 32wF3VxMI4Tn++3+pSP4Zgj87AvxcQdP7e7G4iXH0dPexP8JYUeestas0ME8Or1iz4Ba JcAGHt+74XMmdpTcJOx30MKneEwn9zujPX1K2MbFAY/tnYekc54yVy7jGT5OLo7irGpk J0sx67TKXkqSYNVNaIC1UgpSgr/2cfLw7JVSvVe2a8fO/vFX6r58cmFegpkgxy3SQdvA K14j7toVVk7zanYoxsERZY3Y3N9pCiWYn7BhQoX4520vW9LqhpxXXa4kRNkgcARGDOS2 YxOg== X-Gm-Message-State: ALoCoQl14nzDOekjei/zX45rg7sds0SpVLCof7b9Ykr++xjXcztyDgzwyQhlB+oxBa7X94RoNG8i X-Received: by 10.182.200.162 with SMTP id jt2mr20320304obc.34.1397476671837; Mon, 14 Apr 2014 04:57:51 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.82.16 with SMTP id g16ls2641737qgd.25.gmail; Mon, 14 Apr 2014 04:57:51 -0700 (PDT) X-Received: by 10.52.72.48 with SMTP id a16mr30211657vdv.19.1397476671766; Mon, 14 Apr 2014 04:57:51 -0700 (PDT) Received: from mail-ve0-f178.google.com (mail-ve0-f178.google.com [209.85.128.178]) by mx.google.com with ESMTPS id ph6si2708047veb.161.2014.04.14.04.57.51 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 14 Apr 2014 04:57:51 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.178 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.178; Received: by mail-ve0-f178.google.com with SMTP id jw12so7603892veb.9 for ; Mon, 14 Apr 2014 04:57:51 -0700 (PDT) X-Received: by 10.52.165.105 with SMTP id yx9mr30554125vdb.22.1397476671695; Mon, 14 Apr 2014 04:57:51 -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 ib8csp141309vcb; Mon, 14 Apr 2014 04:57:51 -0700 (PDT) X-Received: by 10.224.169.5 with SMTP id w5mr2357018qay.96.1397476671297; Mon, 14 Apr 2014 04:57:51 -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 s3si823954qas.43.2014.04.14.04.57.50 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 14 Apr 2014 04:57:51 -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 1WZfWA-0001mq-Qf; Mon, 14 Apr 2014 11:57:42 +0000 Received: from mail-lb0-f176.google.com ([209.85.217.176]) by ip-10-141-164-156.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1WZfUQ-0001jm-L2 for lng-odp@lists.linaro.org; Mon, 14 Apr 2014 11:55:54 +0000 Received: by mail-lb0-f176.google.com with SMTP id 10so5477463lbg.21 for ; Mon, 14 Apr 2014 04:55:56 -0700 (PDT) X-Received: by 10.152.87.102 with SMTP id w6mr1163037laz.46.1397476556273; Mon, 14 Apr 2014 04:55:56 -0700 (PDT) Received: from uglx0153363.synapse.com ([195.238.92.128]) by mx.google.com with ESMTPSA id bm3sm14022014lbb.12.2014.04.14.04.55.55 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 14 Apr 2014 04:55:55 -0700 (PDT) From: Taras Kondratiuk To: lng-odp@lists.linaro.org Date: Mon, 14 Apr 2014 14:55:26 +0300 Message-Id: <1397476530-20816-7-git-send-email-taras.kondratiuk@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1397476530-20816-1-git-send-email-taras.kondratiuk@linaro.org> References: <1397476530-20816-1-git-send-email-taras.kondratiuk@linaro.org> Cc: Filip Moerman Subject: [lng-odp] [PATCH 06/10] 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.128.178 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;