diff mbox

[U-Boot,PATCHv6,25/28] net: sun7i_mac: Add read_rom_hwaddr hook

Message ID 20170515080244.21345-26-oliver@schinagl.nl
State Changes Requested
Delegated to: Jagannadha Sutradharudu Teki
Headers show

Commit Message

Olliver Schinagl May 15, 2017, 8:02 a.m. UTC
With this patch sun7i_mac can now get the MAC address from the board in
a predetermined board specific manner.

Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
---
 drivers/net/Makefile    | 2 +-
 drivers/net/sun7i_mac.c | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

Comments

Maxime Ripard May 15, 2017, 8:22 a.m. UTC | #1
On Mon, May 15, 2017 at 10:02:41AM +0200, Olliver Schinagl wrote:
> With this patch sun7i_mac can now get the MAC address from the board in
> a predetermined board specific manner.
> 
> Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
> ---
>  drivers/net/Makefile    | 2 +-
>  drivers/net/sun7i_mac.c | 2 ++
>  2 files changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/Makefile b/drivers/net/Makefile
> index 86dee7d746..5df5567536 100644
> --- a/drivers/net/Makefile
> +++ b/drivers/net/Makefile
> @@ -23,7 +23,7 @@ obj-$(CONFIG_E1000) += e1000.o
>  obj-$(CONFIG_E1000_SPI) += e1000_spi.o
>  obj-$(CONFIG_EEPRO100) += eepro100.o
>  obj-$(CONFIG_SUN4I_EMAC) += sunxi_common.o sun4i_mac.o
> -obj-$(CONFIG_SUN7I_MAC) += sun7i_mac.o
> +obj-$(CONFIG_SUN7I_MAC) += sunxi_common.o sun7i_mac.o

Shouldn't that be turned in a Kconfig option selected by both drivers?

Maxime
Olliver Schinagl May 15, 2017, 12:20 p.m. UTC | #2
Hey Maxime,

On 15-05-17 10:22, Maxime Ripard wrote:
> On Mon, May 15, 2017 at 10:02:41AM +0200, Olliver Schinagl wrote:
>> With this patch sun7i_mac can now get the MAC address from the board in
>> a predetermined board specific manner.
>>
>> Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
>> ---
>>  drivers/net/Makefile    | 2 +-
>>  drivers/net/sun7i_mac.c | 2 ++
>>  2 files changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/Makefile b/drivers/net/Makefile
>> index 86dee7d746..5df5567536 100644
>> --- a/drivers/net/Makefile
>> +++ b/drivers/net/Makefile
>> @@ -23,7 +23,7 @@ obj-$(CONFIG_E1000) += e1000.o
>>  obj-$(CONFIG_E1000_SPI) += e1000_spi.o
>>  obj-$(CONFIG_EEPRO100) += eepro100.o
>>  obj-$(CONFIG_SUN4I_EMAC) += sunxi_common.o sun4i_mac.o
>> -obj-$(CONFIG_SUN7I_MAC) += sun7i_mac.o
>> +obj-$(CONFIG_SUN7I_MAC) += sunxi_common.o sun7i_mac.o
>
> Shouldn't that be turned in a Kconfig option selected by both drivers?
What do you mean? There are some common functions that all of them 
share, such as reading the MAC address.

Or do you mean we should make the net_op rom_read_hwaddr() a 
configurable Kconfig?

Olliver

>
> Maxime
>
Maxime Ripard May 16, 2017, 12:17 p.m. UTC | #3
On Mon, May 15, 2017 at 02:20:25PM +0200, Olliver Schinagl wrote:
> Hey Maxime,
> 
> On 15-05-17 10:22, Maxime Ripard wrote:
> > On Mon, May 15, 2017 at 10:02:41AM +0200, Olliver Schinagl wrote:
> > > With this patch sun7i_mac can now get the MAC address from the board in
> > > a predetermined board specific manner.
> > > 
> > > Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
> > > ---
> > >  drivers/net/Makefile    | 2 +-
> > >  drivers/net/sun7i_mac.c | 2 ++
> > >  2 files changed, 3 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/net/Makefile b/drivers/net/Makefile
> > > index 86dee7d746..5df5567536 100644
> > > --- a/drivers/net/Makefile
> > > +++ b/drivers/net/Makefile
> > > @@ -23,7 +23,7 @@ obj-$(CONFIG_E1000) += e1000.o
> > >  obj-$(CONFIG_E1000_SPI) += e1000_spi.o
> > >  obj-$(CONFIG_EEPRO100) += eepro100.o
> > >  obj-$(CONFIG_SUN4I_EMAC) += sunxi_common.o sun4i_mac.o
> > > -obj-$(CONFIG_SUN7I_MAC) += sun7i_mac.o
> > > +obj-$(CONFIG_SUN7I_MAC) += sunxi_common.o sun7i_mac.o
> > 
> > Shouldn't that be turned in a Kconfig option selected by both drivers?
> What do you mean? There are some common functions that all of them share,
> such as reading the MAC address.
> 
> Or do you mean we should make the net_op rom_read_hwaddr() a configurable
> Kconfig?

I meant having a KConfig symbol to compile sunxi_common, and then have
that symbol selected by the three EMAC/GMAC Kconfig symbol.

Maxime
diff mbox

Patch

diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index 86dee7d746..5df5567536 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -23,7 +23,7 @@  obj-$(CONFIG_E1000) += e1000.o
 obj-$(CONFIG_E1000_SPI) += e1000_spi.o
 obj-$(CONFIG_EEPRO100) += eepro100.o
 obj-$(CONFIG_SUN4I_EMAC) += sunxi_common.o sun4i_mac.o
-obj-$(CONFIG_SUN7I_MAC) += sun7i_mac.o
+obj-$(CONFIG_SUN7I_MAC) += sunxi_common.o sun7i_mac.o
 obj-$(CONFIG_SUN8I_EMAC) += sun8i_emac.o
 obj-$(CONFIG_ENC28J60) += enc28j60.o
 obj-$(CONFIG_EP93XX) += ep93xx_eth.o
diff --git a/drivers/net/sun7i_mac.c b/drivers/net/sun7i_mac.c
index f8c6a58c08..b10a6ec03a 100644
--- a/drivers/net/sun7i_mac.c
+++ b/drivers/net/sun7i_mac.c
@@ -15,6 +15,7 @@ 
 #include <net.h>
 
 #include "designware.h"
+#include "sunxi_common.h"
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -102,6 +103,7 @@  const struct eth_ops sun7i_mac_eth_ops = {
 	.free_pkt		= designware_eth_free_pkt,
 	.stop			= designware_eth_stop,
 	.write_hwaddr		= designware_eth_write_hwaddr,
+	.read_rom_hwaddr	= sunxi_mac_read_rom_hwaddr,
 };
 
 static const struct udevice_id sun7i_mac_eth_ids[] = {