From patchwork Thu Jun 21 09:43:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 139515 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp1846326lji; Thu, 21 Jun 2018 02:46:12 -0700 (PDT) X-Google-Smtp-Source: ADUXVKISxQlyiG/NVa5Zei6kuo67LKn6bSA1ysay6CblK15TUtE5xR+KXy9y666ZTvBo0PLlCZEg X-Received: by 2002:a1c:7ce:: with SMTP id 197-v6mr4376446wmh.134.1529574372396; Thu, 21 Jun 2018 02:46:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529574372; cv=none; d=google.com; s=arc-20160816; b=LYSkaYc1DdaTTAeIRSur9ghXhL+MeNGcCeBDNHIrHb6q0IaK2AXhHW5N3RCw1TfgBv aZD4DyR8IztlRWi2TMzZT6YE+GRwZ0K5lQBv1lfaIiJeQh3qzSVStSfmjk0Z7GF2nntJ LsnRw06U2p6JuVMLwCOAZ5b4qoTMcBblDNs4PP+KgxSei6VN+GQKsRRCZKCaOGXDmnX7 IpaO0akXYqh6CzeXQOiewozHLMcZhDD+FJXmDIj/DyCPk4MK5mHLRv8ZBLE3kDnrqLpR X+ipO4lo/IibSTq4SNCTcq85k5hDUGyhMf+uxjYlY+aa7+EHxIBqUQ1ayyhwUG+f39CY g62w== 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:spamdiagnosticmetadata :spamdiagnosticoutput:mime-version:references:in-reply-to:message-id :date:cc:to:from:dkim-signature:arc-authentication-results; bh=+Xigs0/pycWk/Bxzn6lQFDgCQg7JbKx5lbTLF7QyEIk=; b=KroMG7P2YcOEBtuVCDq+PDceA7KMpnYE7jt9vkvr76mNObSBnXYaZV8L4/fY1nABqw 1qR8OFURyeDStY6+454doAatqnBXGZ77Qbr5/MNo2T+xyxJ2BAzjL8NioDiTPUprnl/F qc4jz9AyospaBg6m1fCV2tqUI814vbXPf4T/LdLj/QPbK6TmeBV53NNuFC5CTKGpHXXS F8uhloRjgouwNVLcecjwvn1VBH63ha2HHI8YiuZWKTKFeQuuphWwrjkgdP7xtScikUM2 QTHDasGtkjIlfQFeY7Om4Co1nSMWkZm3vIYsEbrpDVOsZpFyLkFxIccPhNDDVYn2TTWb aHgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nxp.com header.s=selector1 header.b=JashanxP; 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 s26-v6si860321wrs.459.2018.06.21.02.46.12; Thu, 21 Jun 2018 02:46:12 -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; dkim=fail header.i=@nxp.com header.s=selector1 header.b=JashanxP; 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 9F68D1BDD4; Thu, 21 Jun 2018 11:45:51 +0200 (CEST) Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20087.outbound.protection.outlook.com [40.107.2.87]) by dpdk.org (Postfix) with ESMTP id 2011E1BDD4 for ; Thu, 21 Jun 2018 11:45:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+Xigs0/pycWk/Bxzn6lQFDgCQg7JbKx5lbTLF7QyEIk=; b=JashanxP3yPph9wV3b81JnqF+qF/ppcRVsg+0NdIW8heintFtbg0tkWI0FpskjzL9+2Md49408X5GVAmH9LTvdo3iZaAT/XYYq0C0+Un/VTtQaEq3YeJ4oLtri2ZmJRK+WCl5lXWFWTJBAnnaoEScrPkhtP4p4Rev29vQeCgngY= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=hemant.agrawal@nxp.com; Received: from bf-netperf1.ap.freescale.net (14.142.187.166) by AM2PR04MB0755.eurprd04.prod.outlook.com (2a01:111:e400:8411::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.863.16; Thu, 21 Jun 2018 09:45:44 +0000 From: Hemant Agrawal To: dev@dpdk.org Cc: ferruh.yigit@intel.com, Akhil Goyal Date: Thu, 21 Jun 2018 15:13:58 +0530 Message-Id: <1529574244-18997-4-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1529574244-18997-1-git-send-email-hemant.agrawal@nxp.com> References: <1529574244-18997-1-git-send-email-hemant.agrawal@nxp.com> MIME-Version: 1.0 X-Originating-IP: [14.142.187.166] X-ClientProxiedBy: BM1PR0101CA0035.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:1a::21) To AM2PR04MB0755.eurprd04.prod.outlook.com (2a01:111:e400:8411::15) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 608672fe-679f-4b0e-a14a-08d5d75bc2dc X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(5600026)(711020)(48565401081)(2017052603328)(7153060)(7193020); SRVR:AM2PR04MB0755; X-Microsoft-Exchange-Diagnostics: 1; AM2PR04MB0755; 3:Wcmi+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lS0jUm+TrX5R6aaKlP+5cfHhfY1BPkFJwEqbp0KSIdLyYLrbP7GJ9YcrhyYtRkWeOZS/KnFmdXEK4hKgAZPMFPMJdF/7AcPVX+QnYg+MUgZ6nTRVQy70R5eOXFT24fy8V2zUNYW9DkV3z5NGmrtdhfrVIdsh/l2E9XP22cEUMY84tURbODPvVjcpYmZ3hb8vw83uRWNjLAIKXA2v0DT3cU1IqHrqCX4UkRhCnp+zCkpISfGBAdX/ChXEqDpK024LSrE8uXocnFBt0xfvZXV/YnPxzcXntRbvcao6HwkV2Cj2giwC1nJDGOqT3zQ6NcPxE6z7B78hIs0ECqYbp3h8e7; 4:zXSdVRNd4Ily56i7aFewNoxhCjxLqTR3aAro2RQyytYMG7oSJzX3223GX9O9/Qlrywg+IuZeC0GJainG7C9Kg9SHYikDRHL1C7Ceohu91lsINyzkLzk/OgzpaFJX0x/8Z/6XVHBbHLaoHJtQSLwfRi1jUlRNcM+1ZK/iAnVbxtHbryoq/faMvp26f7DO1KhMK8Ln8RkITiIdAvPxiypN7CATZNqeOAIPxRo36eION0t9vmm8RcRTobxNxPOi823Dty9mW1Bl2i4CDTtg1OCYJRaWYo4YF2N6hp0LtlKphQRT0p4l2HjfT89AUXaDzxz2 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231254)(944501410)(52105095)(10201501046)(93006095)(93001095)(3002001)(6055026)(149027)(150027)(6041310)(20161123564045)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(6072148)(201708071742011)(7699016); SRVR:AM2PR04MB0755; BCL:0; PCL:0; RULEID:; SRVR:AM2PR04MB0755; X-Forefront-PRVS: 07106EF9B9 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(396003)(376002)(366004)(39860400002)(346002)(39380400002)(199004)(189003)(50466002)(6116002)(6506007)(55236004)(76176011)(2906002)(6512007)(478600001)(51416003)(48376002)(52116002)(3846002)(2361001)(186003)(26005)(16526019)(956004)(11346002)(97736004)(2351001)(5009440100003)(386003)(446003)(4326008)(8936002)(8676002)(476003)(486006)(7736002)(81156014)(81166006)(305945005)(16586007)(6916009)(6486002)(105586002)(106356001)(2616005)(47776003)(53936002)(36756003)(50226002)(44832011)(86362001)(68736007)(25786009)(5660300001)(316002)(6666003)(66066001)(110426005); DIR:OUT; SFP:1101; SCL:1; SRVR:AM2PR04MB0755; H:bf-netperf1.ap.freescale.net; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM2PR04MB0755; 23:nGQvn3b4XY1Xa9MjOLqF1njIHFBCvC37sNMn3URhy?= u1PtQ2FRwmKf6iDBI/aYN78HNe9/OtBUz/2O7V4OYOLS/ng0OAPdjle/nPMBCvAtTMcFipqNRZXw4K/The9SH3PiwwSTGvtRmGHmntZw2x+oenf0tl12VS3wg5PF7UMQkTig5uGdpxpAooBNaw1vezBQMosnHl/94uWVvtjuaF9buY1Rj84hYCvR++5b94KifeYwj73iZeqR1LKoIQ6MW0I0a9c/39QThyjN6LpbfgLoesFZ3GrNfHlcaPoX/sCzicFSYoYUm92iozypR7sWueL/rFCtv/rPwazbdQXvren7g1rqwskGn/c3fo+1paPcRTztc9cKuSC4d9AiEuS9YrbX3PH39gbEeOPegrNA3LRZs06N24gHby6tiIzR7QekdzTWPQQK2ymrdQcIz6V8rNx1sNnvakxm6gVp4E2gbMuM/5/7XLYBmYIf5F11LGLucQChctpnBs0fb9bRRGpYI8qR/Gd2Ae1UMvHPu6Y94GMgedYq4wlu/nbruofzw307AWDX6iSJUVO/tge3CRJSxxgQq6WJmbxu8OKriaU2IG+xYs3T1ZyvZ8dR7aDntZQ19RzXNvZvw0IxNpb/P1XFfbecsaaOzFeV9U/InCprGWyyfhgdAcaJM30Zy9ftyxUajHxfqp8l17tH5yGKUQl5HaPV6gzEVzLkxPUiBIqcNHcdn81cJzzCSdbx/HN9BI21ebwcI31xryk6va7HRnuK8AxEqOuQMPs0PPzr3ZU829x9keoN2e055VmbpxpXGT9iwXJ5cxxaxeZFBXGtCNWR04WqL2/U4Wj/BZpateGPD2mT0pczFx/j1nlaKxtPADD/bXrv9i/GLJB/QTeOMZpsn0CPB5oi/PS9mLLlDlxoymlktk8fxitut5ghRdWgEOVCAMV5DdYKv2vCdvyOzodPh2jR9HQUlXBoIvCAGFzRdBeMWnTCz8tpSj5hbp/UEnv4LWVB/gTNkbNUwcxSTgOQV+7gFur2dmLZylQQreGcpsMnQs3xMFExSJE1d6G8zgGxnzpPaWezuOxdRoIhCyUDNN22WWZlvpHdC2AvdGLNb4slDdsfAiIqT06sLYsjelnbX6I9FExRUPwxoj+KyhThKHppM5ItGMXCPqIkti/1p9z/ciLqxkVoUlLWppN00cabywMuIgF+lf4GRBD0ddbudUdY/oM25dt3rOPmokC5UG0bmeBQQmmvfqtZh4my+uoER5JyntmTSGNtfLM5POIspDdXSpVHweYLvZWsoJuGz7eIcp2rC8lqYomsn7y2jNOA14= X-Microsoft-Antispam-Message-Info: ynOvNF/cLoo8dVisqRsIK7hD7Xm/37ecK3IL+eweQrZGMBWlorAPOoylV2yejeLONrCpTifB2B5Xnv3499iyJcgo6O0Vv1KEklo6pWBCsGPSng3ehNjmH/lNJabDRxPDjv07CyJNLwj8V+b/DL1k1KS9NnswTIW3hwScHNMwuPoM4yK46IrOUrIAphGrTVy9AQymCQYOoVLUWD9MCm2zm0AN37D83uTM9Iz8AhlvFqV0KY0hRDmyE2ZUsSnOcuveUU/RdCqNFGSxUft5GA4as/oigG1mdD8lF7eHcGLKzgkSv6rRgjsUVtZMF/9MbW4OqxyfTbnSeETqKzCW9gbmow== X-Microsoft-Exchange-Diagnostics: 1; AM2PR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f5ZSsKl4Si6NSE+6P X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jun 2018 09:45:44.5261 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 608672fe-679f-4b0e-a14a-08d5d75bc2dc X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM2PR04MB0755 Subject: [dpdk-dev] [PATCH 04/10] bus/dpaa: implement new of API to get MAC address 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" From: Akhil Goyal Signed-off-by: Akhil Goyal --- drivers/bus/dpaa/base/fman/of.c | 39 +++++++++++++++++++++++++++++++ drivers/bus/dpaa/include/of.h | 2 ++ drivers/bus/dpaa/rte_bus_dpaa_version.map | 8 +++++++ 3 files changed, 49 insertions(+) -- 2.7.4 diff --git a/drivers/bus/dpaa/base/fman/of.c b/drivers/bus/dpaa/base/fman/of.c index eb55cb9..a7f3174 100644 --- a/drivers/bus/dpaa/base/fman/of.c +++ b/drivers/bus/dpaa/base/fman/of.c @@ -546,3 +546,42 @@ of_device_is_compatible(const struct device_node *dev_node, return true; return false; } + +static const void *of_get_mac_addr(const struct device_node *np, + const char *name) +{ + return of_get_property(np, name, NULL); +} + +/** + * Search the device tree for the best MAC address to use. 'mac-address' is + * checked first, because that is supposed to contain to "most recent" MAC + * address. If that isn't set, then 'local-mac-address' is checked next, + * because that is the default address. If that isn't set, then the obsolete + * 'address' is checked, just in case we're using an old device tree. + * + * Note that the 'address' property is supposed to contain a virtual address of + * the register set, but some DTS files have redefined that property to be the + * MAC address. + * + * All-zero MAC addresses are rejected, because those could be properties that + * exist in the device tree, but were not set by U-Boot. For example, the + * DTS could define 'mac-address' and 'local-mac-address', with zero MAC + * addresses. Some older U-Boots only initialized 'local-mac-address'. In + * this case, the real MAC is in 'local-mac-address', and 'mac-address' exists + * but is all zeros. + */ +const void *of_get_mac_address(const struct device_node *np) +{ + const void *addr; + + addr = of_get_mac_addr(np, "mac-address"); + if (addr) + return addr; + + addr = of_get_mac_addr(np, "local-mac-address"); + if (addr) + return addr; + + return of_get_mac_addr(np, "address"); +} diff --git a/drivers/bus/dpaa/include/of.h b/drivers/bus/dpaa/include/of.h index 151be5a..7ea7608 100644 --- a/drivers/bus/dpaa/include/of.h +++ b/drivers/bus/dpaa/include/of.h @@ -109,6 +109,8 @@ const struct device_node *of_get_parent(const struct device_node *dev_node); const struct device_node *of_get_next_child(const struct device_node *dev_node, const struct device_node *prev); +const void *of_get_mac_address(const struct device_node *np); + #define for_each_child_node(parent, child) \ for (child = of_get_next_child(parent, NULL); child != NULL; \ child = of_get_next_child(parent, child)) diff --git a/drivers/bus/dpaa/rte_bus_dpaa_version.map b/drivers/bus/dpaa/rte_bus_dpaa_version.map index 8d90285..e00c911 100644 --- a/drivers/bus/dpaa/rte_bus_dpaa_version.map +++ b/drivers/bus/dpaa/rte_bus_dpaa_version.map @@ -92,3 +92,11 @@ DPDK_18.02 { local: *; } DPDK_17.11; + +DPDK_18.08 { + global: + + of_get_mac_address; + + local: *; +} DPDK_18.02;