From patchwork Fri Jul 10 17:19:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 235258 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp647823ilg; Fri, 10 Jul 2020 10:24:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzJVaFNCiK/PrcsXVtCoASgAoRA7XDPsY5hJmESuwOyOvXECDcyfrluZXDGAmIpMsKuFk0g X-Received: by 2002:a50:d501:: with SMTP id u1mr78658194edi.159.1594401865624; Fri, 10 Jul 2020 10:24:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594401865; cv=none; d=google.com; s=arc-20160816; b=TVJAGKaXR9sP3fDoesSkT7F2+5YPaUw4QabbG+435M2EsFUvKaOfv3+KYYquiWoVfW r9Pt/Gd+o0USFtMnPgV/OvK+M8ow3JuLwXd7ckeNsYlDKZPw9jWvBT7NCnj+gJUet9sr HwmmA4w44Y7SEL99AyPhw18URNSEqU8GCkbNPm9liWF9H32vXmsXsd/SJEHR5GEfB7Bc uaKhUhDqI19cY/Iw7tRYFLnmfb8VvDJeGcFUM2LeIjUWS8v7XKdonkByEl5xI6jRdkYb sFCqAF0wZ0DzAiQxMLEKIToBNROeDqn5k1wSUpI3RQ4zQWjibbiwrvePThkvONrmIUM+ 4WGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:cc:to:from; bh=LbQqvUt9iMcKwiGrZbRtwTtEtHzJCc+JTT6jI32vVUE=; b=k9e/EXk80ag7/lf6N5k6nINWYcbfQ576+zseivrmIaZ6CB4DARD9+kfP5oelZmnT8s KhvL8MJH/uGNPR7I8LmwemWE3Lf8nKisajH513u5lZZAUbayxKLfx/guTCFoU4Y+rEUf kPGu9+liwUa/qede6VUwvtvBVaOAV/L9xCKPHIhvRDuc+YbYCh+RPbOmazpRmc0Z5V4E yh5qcuyV5lJvzt4AKFmM+yGj5VYIdn+Sq6AqIaEh5JzR42Ghpnzq5hWSEHlPR/QcnHx5 ps2z9k8CUMbh0matYhmsvUGT5LFqezF5xI/AXCVtkIsNQVE7U79FgoGHdh7AUpKKoCVK 2ZIg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from dpdk.org (dpdk.org. [92.243.14.124]) by mx.google.com with ESMTP id z8si4382633edp.515.2020.07.10.10.24.25; Fri, 10 Jul 2020 10:24:25 -0700 (PDT) Received-SPF: pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) client-ip=92.243.14.124; Authentication-Results: mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 906901DDCC; Fri, 10 Jul 2020 19:24:14 +0200 (CEST) Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by dpdk.org (Postfix) with ESMTP id 6355B1DDB1 for ; Fri, 10 Jul 2020 19:24:13 +0200 (CEST) Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 2A8F11A0489; Fri, 10 Jul 2020 19:24:13 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 7724C1A04A5; Fri, 10 Jul 2020 19:24:11 +0200 (CEST) Received: from bf-netperf1.ap.freescale.net (bf-netperf1.ap.freescale.net [10.232.133.63]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 41598402D3; Sat, 11 Jul 2020 01:24:09 +0800 (SGT) From: Hemant Agrawal To: dev@dpdk.org Cc: ferruh.yigit@intel.com, Hemant Agrawal Date: Fri, 10 Jul 2020 22:49:43 +0530 Message-Id: <20200710171946.23246-6-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200710171946.23246-1-hemant.agrawal@nxp.com> References: <20200710171946.23246-1-hemant.agrawal@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-dev] [PATCH v2 6/9] bus/dpaa: add Virtual Storage Profile port init X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This patch add support to initialize the VSP ports in the FMAN library. Signed-off-by: Hemant Agrawal --- drivers/bus/dpaa/base/fman/fman.c | 57 +++++++++++++++++++++++++++++++ drivers/bus/dpaa/include/fman.h | 3 ++ 2 files changed, 60 insertions(+) -- 2.17.1 diff --git a/drivers/bus/dpaa/base/fman/fman.c b/drivers/bus/dpaa/base/fman/fman.c index 3ae29bf06..39102bc1f 100644 --- a/drivers/bus/dpaa/base/fman/fman.c +++ b/drivers/bus/dpaa/base/fman/fman.c @@ -145,6 +145,61 @@ fman_get_mac_index(uint64_t regs_addr_host, uint8_t *mac_idx) return ret; } +static void fman_if_vsp_init(struct __fman_if *__if) +{ + const phandle *prop; + int cell_index; + const struct device_node *dev; + size_t lenp; + const uint8_t mac_idx[] = {-1, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1}; + + if (__if->__if.mac_type == fman_mac_1g) { + for_each_compatible_node(dev, NULL, + "fsl,fman-port-1g-rx-extended-args") { + prop = of_get_property(dev, "cell-index", &lenp); + if (prop) { + cell_index = of_read_number( + &prop[0], + lenp / sizeof(phandle)); + if (cell_index == mac_idx[__if->__if.mac_idx]) { + prop = of_get_property( + dev, + "vsp-window", &lenp); + if (prop) { + __if->__if.num_profiles = + of_read_number( + &prop[0], 1); + __if->__if.base_profile_id = + of_read_number( + &prop[1], 1); + } + } + } + } + } else if (__if->__if.mac_type == fman_mac_10g) { + for_each_compatible_node(dev, NULL, + "fsl,fman-port-10g-rx-extended-args") { + prop = of_get_property(dev, "cell-index", &lenp); + if (prop) { + cell_index = of_read_number( + &prop[0], lenp / sizeof(phandle)); + if (cell_index == mac_idx[__if->__if.mac_idx]) { + prop = of_get_property( + dev, "vsp-window", &lenp); + if (prop) { + __if->__if.num_profiles = + of_read_number( + &prop[0], 1); + __if->__if.base_profile_id = + of_read_number( + &prop[1], 1); + } + } + } + } + } +} + static int fman_if_init(const struct device_node *dpa_node) { @@ -519,6 +574,8 @@ fman_if_init(const struct device_node *dpa_node) if (is_shared) __if->__if.is_shared_mac = 1; + fman_if_vsp_init(__if); + /* Parsing of the network interface is complete, add it to the list */ DPAA_BUS_LOG(DEBUG, "Found %s, Tx Channel = %x, FMAN = %x," "Port ID = %x", diff --git a/drivers/bus/dpaa/include/fman.h b/drivers/bus/dpaa/include/fman.h index cb7f18ca2..dcf408372 100644 --- a/drivers/bus/dpaa/include/fman.h +++ b/drivers/bus/dpaa/include/fman.h @@ -321,6 +321,9 @@ struct fman_if { /* The Qman channel to schedule Tx FQs to */ u16 tx_channel_id; + uint8_t base_profile_id; + uint8_t num_profiles; + uint8_t is_shared_mac; /* The hard-coded FQIDs for this interface. Note: this doesn't cover * the PCD nor the "Rx default" FQIDs, which are configured via FMC