LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [RFC/PATCH] net: ethernet: nixge: Use of_get_mac_address()
@ 2018-04-26 21:57 Moritz Fischer
  2018-04-26 22:04 ` Moritz Fischer
  0 siblings, 1 reply; 3+ messages in thread
From: Moritz Fischer @ 2018-04-26 21:57 UTC (permalink / raw)
  To: linux-kernel
  Cc: devicetree, netdev, davem, robh+dt, mark.rutland, Moritz Fischer

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 = <&eth1_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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFC/PATCH] net: ethernet: nixge: Use of_get_mac_address()
  2018-04-26 21:57 [RFC/PATCH] net: ethernet: nixge: Use of_get_mac_address() Moritz Fischer
@ 2018-04-26 22:04 ` Moritz Fischer
  2018-05-01 15:05   ` Rob Herring
  0 siblings, 1 reply; 3+ messages in thread
From: Moritz Fischer @ 2018-04-26 22:04 UTC (permalink / raw)
  To: Moritz Fischer
  Cc: linux-kernel, devicetree, netdev, davem, robh+dt, mark.rutland

On Thu, Apr 26, 2018 at 02:57:42PM -0700, Moritz Fischer wrote:
> 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 = <&eth1_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);
Sorry, that should be &pdev->dev.of_node here ... I'll resubmit if
general idea ok.

> +	if (mac_addr)
>  		ether_addr_copy(ndev->dev_addr, mac_addr);
>  	else
>  		eth_hw_addr_random(ndev);
> -- 
> 2.17.0
> 

- Moritz

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFC/PATCH] net: ethernet: nixge: Use of_get_mac_address()
  2018-04-26 22:04 ` Moritz Fischer
@ 2018-05-01 15:05   ` Rob Herring
  0 siblings, 0 replies; 3+ messages in thread
From: Rob Herring @ 2018-05-01 15:05 UTC (permalink / raw)
  To: Moritz Fischer; +Cc: linux-kernel, devicetree, netdev, davem, mark.rutland

On Thu, Apr 26, 2018 at 03:04:01PM -0700, Moritz Fischer wrote:
> On Thu, Apr 26, 2018 at 02:57:42PM -0700, Moritz Fischer wrote:
> > 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.

Fine by me. It really comes down to whether there are any users that 
would be impacted.

Rob

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-05-01 15:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-26 21:57 [RFC/PATCH] net: ethernet: nixge: Use of_get_mac_address() Moritz Fischer
2018-04-26 22:04 ` Moritz Fischer
2018-05-01 15:05   ` Rob Herring

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).