From patchwork Sun Apr 28 12:53:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Petr_=C5=A0tetiar?= X-Patchwork-Id: 10920911 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4D8501398 for ; Sun, 28 Apr 2019 12:53:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 34FD128478 for ; Sun, 28 Apr 2019 12:53:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 259AD288DA; Sun, 28 Apr 2019 12:53:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3CD8328478 for ; Sun, 28 Apr 2019 12:53:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=ScbgfdHBHHcKC4/iGjM83eGN479pU1gZPpJexoFKNtk=; b=AVFoiFhbfBxDZ1 jo6GWl2puZoQcn3rlDarNW3Vyj5gVNyDZDcjcKUHfy//cbcnwd8XcGGeMQSg9qY0FwRPyE7cxti2b lzSHnZOqHEeg8rO2M4K2ghObIGo3rbDfKcpU+5agYgGg/4EW7Oa190QJ6ChJ8eOgwXLKK+VxfYHsX 9bUz42j44PMIX1qS+B/59p9/lh33cUP/Mg2uumPIzPKuhhRvt5taYGofBD/bbGiruKwbKhJcdRC+M BzaO2yJKza8j2JZbsRfHSD2k+7SxglLGPlssqMVKFfNo8Y6V/DEhWGKCCwRQAKKTVDyl5HKQzAVRE HiQoideDLrhJW37umTkA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hKjJV-0001rE-9J; Sun, 28 Apr 2019 12:53:49 +0000 Received: from smtp-out.xnet.cz ([178.217.244.18]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hKjJR-0001q9-Cj; Sun, 28 Apr 2019 12:53:47 +0000 Received: from meh.true.cz (meh.true.cz [108.61.167.218]) (Authenticated sender: petr@true.cz) by smtp-out.xnet.cz (Postfix) with ESMTPSA id 4D2D44532; Sun, 28 Apr 2019 14:53:37 +0200 (CEST) Received: by meh.true.cz (OpenSMTPD) with ESMTP id c6257092; Sun, 28 Apr 2019 14:53:35 +0200 (CEST) From: =?utf-8?q?Petr_=C5=A0tetiar?= To: netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Matthias Brugger Subject: [PATCH v2 0/4] of_net: Add NVMEM support to of_get_mac_address Date: Sun, 28 Apr 2019 14:53:18 +0200 Message-Id: <1556456002-13430-1-git-send-email-ynezz@true.cz> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190428_055345_735966_68E29574 X-CRM114-Status: GOOD ( 11.22 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Lunn , Florian Fainelli , Maxime Ripard , linux-mediatek@lists.infradead.org, Rob Herring , Srinivas Kandagatla , Alban Bedel , =?utf-8?q?Petr_=C5=A0tetiar?= , Frank Rowand , linux-arm-kernel@lists.infradead.org, Heiner Kallweit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Hi, this patch series is a continuation of my previous attempt[1], where I've tried to wire MTD layer into of_get_mac_address, so it would be possible to load MAC addresses from various NVMEMs as EEPROMs etc. Predecessor of this patch which used directly MTD layer has originated in OpenWrt some time ago and supports already about 497 use cases in 357 device tree files. During the review process of my 1st attempt I was told, that I shouldn't be using MTD directly, but I should rather use new NVMEM subsystem, so this patch series tries to accommodate that. First patch is wiring NVMEM support directly into of_get_mac_address as it's obvious, that adding support for NVMEM into every other driver would mean adding a lot of repetitive code. This patch allows us to configure MAC addresses in various devices like ethernet and wireless adapters directly from of_get_mac_address, which is used by quite a lot of drivers in the tree already. Second patch is simply updating documentation with NVMEM bits, also adding some missing bits like mac-address and local-mac-address properties, which are currently supported by of_get_mac_address. Third and fourth patches are simply removing duplicate NVMEM code which is no longer needed as the first patch has added NVMEM support directly into of_get_mac_address. Just for a better picture, this patch series and one simple patch[2] on top of it, allows me to configure 8Devices Carambola2 board's MAC addresses with following DTS (simplified): &spi { flash@0 { partitions { art: partition@ff0000 { label = "art"; reg = <0xff0000 0x010000>; read-only; nvmem-cells { compatible = "nvmem-cells"; #address-cells = <1>; #size-cells = <1>; eth0_addr: eth-mac-addr@0 { reg = <0x0 0x6>; }; eth1_addr: eth-mac-addr@6 { reg = <0x6 0x6>; }; wmac_addr: wifi-mac-addr@1002 { reg = <0x1002 0x6>; }; }; }; }; }; }; ð0 { nvmem-cells = <ð0_addr>; nvmem-cell-names = "mac-address"; }; ð1 { nvmem-cells = <ð1_addr>; nvmem-cell-names = "mac-address"; }; &wmac { nvmem-cells = <&wmac_addr>; nvmem-cell-names = "mac-address"; }; 1. https://patchwork.ozlabs.org/patch/1086628/ 2. https://patchwork.ozlabs.org/patch/890738/ -- ynezz Petr Štetiar (4): of_net: Add NVMEM support to of_get_mac_address dt-bindings: doc: Reflect new NVMEM of_get_mac_address behaviour net: macb: Drop nvmem_get_mac_address usage net: davinci_emac: Drop nvmem_get_mac_address usage .../devicetree/bindings/net/altera_tse.txt | 5 ++- Documentation/devicetree/bindings/net/amd-xgbe.txt | 5 +-- .../devicetree/bindings/net/brcm,amac.txt | 4 +-- Documentation/devicetree/bindings/net/cpsw.txt | 5 +-- .../devicetree/bindings/net/davinci_emac.txt | 5 +-- Documentation/devicetree/bindings/net/dsa/dsa.txt | 13 ++----- Documentation/devicetree/bindings/net/ethernet.txt | 6 ++-- .../devicetree/bindings/net/hisilicon-femac.txt | 6 ++-- .../bindings/net/hisilicon-hix5hd2-gmac.txt | 7 ++-- .../devicetree/bindings/net/keystone-netcp.txt | 8 ++--- Documentation/devicetree/bindings/net/macb.txt | 5 ++- .../devicetree/bindings/net/marvell-pxa168.txt | 5 +-- .../devicetree/bindings/net/microchip,enc28j60.txt | 3 +- .../devicetree/bindings/net/microchip,lan78xx.txt | 5 ++- .../devicetree/bindings/net/qca,qca7000.txt | 4 ++- .../devicetree/bindings/net/samsung-sxgbe.txt | 6 ++-- .../bindings/net/snps,dwc-qos-ethernet.txt | 6 ++-- .../bindings/net/socionext,uniphier-ave4.txt | 4 +-- .../devicetree/bindings/net/socionext-netsec.txt | 7 ++-- .../bindings/net/wireless/mediatek,mt76.txt | 5 +-- .../devicetree/bindings/net/wireless/qca,ath9k.txt | 4 +-- drivers/net/ethernet/cadence/macb_main.c | 12 ++----- drivers/net/ethernet/ti/davinci_emac.c | 14 +++----- drivers/of/of_net.c | 42 ++++++++++++++++++++-- 24 files changed, 102 insertions(+), 84 deletions(-)