From: Moritz Fischer <mdf@kernel.org>
To: linux-kernel@vger.kernel.org
Cc: devicetree@vger.kernel.org, netdev@vger.kernel.org,
davem@davemloft.net, robh+dt@kernel.org, mark.rutland@arm.com,
Moritz Fischer <mdf@kernel.org>
Subject: [RFC/PATCH] net: ethernet: nixge: Use of_get_mac_address()
Date: Thu, 26 Apr 2018 14:57:42 -0700 [thread overview]
Message-ID: <20180426215742.18966-1-mdf@kernel.org> (raw)
Make nixge driver work with 'mac-address' property instead of
'address' property. There are currently no in-tree users and
the only users of this driver are devices that use overlays
we control to instantiate the device together with the corresponding
FPGA images.
Signed-off-by: Moritz Fischer <mdf@kernel.org>
---
Hi David, Rob,
with Mike's change that enable the generic 'mac-address'
binding that I barely missed with the submission of this
driver I was wondering if we can still change the binding.
I'm aware that this generally is a nonono case, since the binding
is considered API, but since there are no users outside of our
devicetree overlays that we ship with our devices I thought I'd ask.
If you don't think that's a good idea do you think supporting both
would be worthwhile?
Thanks,
Moritz
---
.../devicetree/bindings/net/nixge.txt | 4 ++--
drivers/net/ethernet/ni/nixge.c | 20 ++-----------------
2 files changed, 4 insertions(+), 20 deletions(-)
diff --git a/Documentation/devicetree/bindings/net/nixge.txt b/Documentation/devicetree/bindings/net/nixge.txt
index e55af7f0881a..9bc1ecfb6762 100644
--- a/Documentation/devicetree/bindings/net/nixge.txt
+++ b/Documentation/devicetree/bindings/net/nixge.txt
@@ -8,7 +8,7 @@ Required properties:
- phy-mode: See ethernet.txt file in the same directory.
- phy-handle: See ethernet.txt file in the same directory.
- nvmem-cells: Phandle of nvmem cell containing the MAC address
-- nvmem-cell-names: Should be "address"
+- nvmem-cell-names: Should be "mac-address"
Examples (10G generic PHY):
nixge0: ethernet@40000000 {
@@ -16,7 +16,7 @@ Examples (10G generic PHY):
reg = <0x40000000 0x6000>;
nvmem-cells = <ð1_addr>;
- nvmem-cell-names = "address";
+ nvmem-cell-names = "mac-address";
interrupts = <0 29 IRQ_TYPE_LEVEL_HIGH>, <0 30 IRQ_TYPE_LEVEL_HIGH>;
interrupt-names = "rx", "tx";
diff --git a/drivers/net/ethernet/ni/nixge.c b/drivers/net/ethernet/ni/nixge.c
index 27364b7572fc..7918c7b7273b 100644
--- a/drivers/net/ethernet/ni/nixge.c
+++ b/drivers/net/ethernet/ni/nixge.c
@@ -1162,22 +1162,6 @@ static int nixge_mdio_setup(struct nixge_priv *priv, struct device_node *np)
return of_mdiobus_register(bus, np);
}
-static void *nixge_get_nvmem_address(struct device *dev)
-{
- struct nvmem_cell *cell;
- size_t cell_size;
- char *mac;
-
- cell = nvmem_cell_get(dev, "address");
- if (IS_ERR(cell))
- return cell;
-
- mac = nvmem_cell_read(cell, &cell_size);
- nvmem_cell_put(cell);
-
- return mac;
-}
-
static int nixge_probe(struct platform_device *pdev)
{
struct nixge_priv *priv;
@@ -1201,8 +1185,8 @@ static int nixge_probe(struct platform_device *pdev)
ndev->min_mtu = 64;
ndev->max_mtu = NIXGE_JUMBO_MTU;
- mac_addr = nixge_get_nvmem_address(&pdev->dev);
- if (mac_addr && is_valid_ether_addr(mac_addr))
+ mac_addr = of_get_mac_address(np);
+ if (mac_addr)
ether_addr_copy(ndev->dev_addr, mac_addr);
else
eth_hw_addr_random(ndev);
--
2.17.0
next reply other threads:[~2018-04-26 21:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-26 21:57 Moritz Fischer [this message]
2018-04-26 22:04 ` [RFC/PATCH] net: ethernet: nixge: Use of_get_mac_address() Moritz Fischer
2018-05-01 15:05 ` Rob Herring
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180426215742.18966-1-mdf@kernel.org \
--to=mdf@kernel.org \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=netdev@vger.kernel.org \
--cc=robh+dt@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).