From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00053.outbound.protection.outlook.com [40.107.0.53]) by dpdk.org (Postfix) with ESMTP id 8CB1C1C445 for ; Fri, 6 Jul 2018 10:12:06 +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=EwCpVbrB33pYBR+EiOKlVN766GCOUUI5XCGhSrXfjD4=; b=GlM0PlVDklFXMNn2xwGinh9K0NS4S890gZHn0/sm8h6YjITtQ/WKkHxSenus/sbAR6mHcMWqpVUzXSdfeOQgXAE9k3KvnJtxXnHsghJH0dun0UPAsRn2uVSPR1I3SBThBOVn4H58HUWE2OOC+kHxlDJ0zQliGc+E7NPuGdxkk2I= 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.906.23; Fri, 6 Jul 2018 08:12:04 +0000 From: Hemant Agrawal To: dev@dpdk.org Cc: shreyansh.jain@nxp.com, Akhil Goyal Date: Fri, 6 Jul 2018 13:40:04 +0530 Message-Id: <1530864613-11754-7-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1530864613-11754-1-git-send-email-hemant.agrawal@nxp.com> References: <1530697431-1244-1-git-send-email-hemant.agrawal@nxp.com> <1530864613-11754-1-git-send-email-hemant.agrawal@nxp.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [14.142.187.166] X-ClientProxiedBy: PN1PR01CA0076.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c00:1::16) To AM2PR04MB0755.eurprd04.prod.outlook.com (2a01:111:e400:8411::15) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7c52ac5f-4176-44d9-34c7-08d5e3182913 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600053)(711020)(48565401081)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020); SRVR:AM2PR04MB0755; X-Microsoft-Exchange-Diagnostics: 1; AM2PR04MB0755; 3:MH/CHWiAaBxKPIMBkauXlX8El5CaHuIrNGIIa6kKHrrjZ4lqvNFepH5+nprdxTlyOpfbF0b8KNVo46OjDTuae96CigDeJdvumzAI7EpPuJ9x8E0oGenOZIoNkNQJQ3XzbQ9iVbvaTGvOfo5CdFgR/VtG66sMW8IIsAEiSPTnd5d0YjWRK65BjCkRsEAkk64UlbgzzhU8KHyiyVaiqPHLvYqpSYkxU5KSOrnEWQXILzEIn1s88T/YobxhHDMMUtD7; 25:JR1tWlygcTPRUuM50hK1hQTuWDvE2Iwxs65T3D2Sesb77FGdmvE6URwRISf5ImwfYnifITJJztSN+fL3eB8EcYDRy+yEdG3FQ7eqiRfa7EuOKblNwji4anMeEDdli/whe3PvEDiIMwoX4+AGjX+MZ7dxJV0jgRsSZmvO7dFG8rZwiOugA+uQ0XFaiXB0J3YO0cXQ3XJuQfqrRD/aMYe4c/zgZHqtSn3o2vX5xXfG5Hx0OMwZVtORVBKAPnaCl2CBdSRGn0mO6W/mVaDfl8HMybsQycWO6+kC8q3ayQ7/+ObkOyMM/grQbZIwlco4GByxY4OjsvxfLe42xAUZ2SifZw==; 31:BfIrqquAqXzJrFUQzkc8IsCQIDsHjRDADMJFjDK14TIeh7WOHMy82Sj0Aeo3sG2kcXnezjgVT2CHXWprwbivuVjv5Zs7vIelimknDb/uemH63i/moFN+T8hh/6cjgomkVCo9zWXPPH7/mWW+n9as7GfY200TzEbF26/tyXYNrNWoahkvoOTCFwcdNS+BksgDsovtJqZI5mqKsYqcb/QfQtY6U5TW4TiNRCb1JQrkSdg= X-MS-TrafficTypeDiagnostic: AM2PR04MB0755: X-Microsoft-Exchange-Diagnostics: 1; AM2PR04MB0755; 20:sPOnvhU8C5s25DnMo8c8BVNse6Gm8H2DxNRydma1bdMHcaB+30gR4Tnv/gGEfzSCLVD6TQCwHUVUOSrOiJa22bo4ZaP77e9k2Yq6pMGE2RDObh9BpwP7YTZtDpANocpkBxjGLF1KRQkj30sSRhicxyqSr6yqNhEbjxyz6dWoWSncZNdQWYi2Yad/evK9qvAa637uJ2ogvbYqJAj+oFsItOCU6dhmzmxlVeuoF1QbMjuQGY6+KXbTD6A23rEeMRzOGuX3b+O+1t31Pt8kXncxJnJZEw44cU+wTCUBQ5LKaeF2LR9AU9DCTsdf0r81N5QnIC3PTKCkfK3S2MIwJY8zeraNtH9rriF8ohSVngGorpPujW59R2kd/SAfO/tK8yAsUYySS/D6ajGZ9LWlMabRDBVTqMfyGhbHv7yi/UNdw59GvFvPwD422d6vdMN2nZ5Jap2DytYZolWA7eZthJrMcu+wl5q073kjH+mi67mktsCFq8Qk4mid6BOYGWFmVh2k; 4:wgxGjl78tWyAj+Rl7cxS9YfJF7PZjRXHpb6Zopl2evUPuIlv/pTWbqmJiTclmeGoNKIXEHbrnqUl3nGZpwNGYA2DVIag0pV9djHICiCSqW59UN80AcUPOtnLNrLtfFL+qLOGEas5wKSCJmETseOUyx5wRb63LAqtW+imlgrtrgkKQLGJO8WvAe+IQuAwIFWmfYYbW8T9aozi9H1dAoAM6ltvUH+H6us2HVwU5RbIsXBoeu1YxhR/YCS74A55otV80fbQY9eMVdrBZmduQ3CXEsZgveDymlxY6GtP6qvRl791sG50YN2V2OTWwcwUCO82 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)(3002001)(10201501046)(93006095)(93001095)(3231254)(944501410)(52105095)(6055026)(149027)(150027)(6041310)(20161123558120)(20161123564045)(20161123560045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011)(7699016); SRVR:AM2PR04MB0755; BCL:0; PCL:0; RULEID:; SRVR:AM2PR04MB0755; X-Forefront-PRVS: 0725D9E8D0 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39860400002)(396003)(136003)(366004)(346002)(376002)(199004)(189003)(956004)(66066001)(446003)(6116002)(2616005)(476003)(5009440100003)(6916009)(76176011)(186003)(16586007)(16526019)(105586002)(478600001)(86362001)(44832011)(106356001)(3846002)(4326008)(486006)(11346002)(6486002)(2906002)(25786009)(305945005)(47776003)(50466002)(2361001)(7736002)(5660300001)(6512007)(48376002)(8936002)(68736007)(36756003)(97736004)(55236004)(6506007)(53936002)(26005)(51416003)(50226002)(8676002)(2351001)(81156014)(81166006)(386003)(52116002)(316002)(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:yrI+GoamZq55wnW0ShRumKEgKDt/DJTAlRmppee45?= =?us-ascii?Q?TXAlvR246Izcc5xAcoCauu9nQunKTqGFr7a2K5fequKsVS9UQBxAwavNHCwa?= =?us-ascii?Q?KxoNlJo/0Iq0k+3dxK7XgXJuiEc/KnOuayZ3gn3JpR9QRskw3vmrcLiVNQdk?= =?us-ascii?Q?j+qndhQeGQtD7lvdvI1oueIRa/F8JUPv1iXUv4IkNdBPgge5sDFCOQavm9lq?= =?us-ascii?Q?6xbyQmdjZ+hE95fQClHWfPPAjKkilSLSigCFmhw/RTbgJuPE7/mcDGBp8Owe?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sPjQ==; 5:tc6Q4dFWtM9x8TZ0DaVa9paKG4zIpgQmY4MV1LHtNETOLP99ID+qdUluJnTshC//K91XwVPFu9+iF8OQvqCqDRMY635at5ZHdWvGdWJiG5uyXlvKqrW+60v/z4ohPDlHMoxgpTK8/xbfVNK9E8uSHBxE+f7X6aPHjGYkzwvWeq4=; 24:x7etJjddVB3rhpgR2B27ODzTPHdgq5sizfEPodaGlsmnyMeHJsoRl51SO1g+fJRGKFW8HCTsqnI6AWdo5QhZ2+TLb9rQUEw3UleO6WANluk= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; AM2PR04MB0755; 7:4yk0siupVuxeMzjiplDESVFo6cODexXxnqri3CfPTtoSpCu5ivAu4jSQLF+VPZabCNhFvoDLuSL0L5M2qjyDVcsIngv9MTBHcw2V/1upoRgkv/byZlQM2jS7vGEr7MsbGP5KQ0Vq5+HABGGTIqK9tepWgFQ0qr0fj2oNlxIOqU5V9WfS6XiX3thnYYFjmHmFS6ps8yiCHnuCZSvrSmkma69VlwmZ55fobjRE5+cmYdxMNCu6XNRl9Ld0JXj3+48o X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jul 2018 08:12:04.1841 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7c52ac5f-4176-44d9-34c7-08d5e3182913 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 v3 07/16] 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: , X-List-Received-Date: Fri, 06 Jul 2018 08:12:06 -0000 From: Akhil Goyal Signed-off-by: Akhil Goyal Acked-by: Shreyansh Jain --- 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(+) 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; -- 2.7.4