sunxi: net: Use net_ops hooks to get the MAC
Subsystems (4)
PATCH 1/1 sunxi: net: Use net_ops hooks to get the MAC
This patch series is split off from my previous series, [PATCH v3] Retrieve MAC address from EEPROM
and only adds, uses and fixes the read/write rom_hwaddr hooks.
I changed things around as suggested by Hans. As far as I can tell this should work now as you described. The fdt_fixup_ethernet function should populate the environment as expected.
PATCH 1/6 net: dw: Add read_rom_hwaddr net_op hook
Add the read_rom_hwaddr net_op hook so that it can be called from boards to read the mac from a ROM chip.
--- drivers/net/designware.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
drivers/net/designware.c +16 -0
@@ -230,6 +230,21 @@ static int _dw_write_hwaddr(struct dw_eth_dev *priv, u8 *mac_id)return 0 ; } +__weak int dw_board_read_rom_hwaddr (unsigned char *enetaddr,int id) +{ +return -ENOSYS ; +} + +static int designware_eth_read_rom_hwaddr (struct udevice *dev) +{ +struct eth_pdata *pdata =dev_get_platdata (dev); + +if (!dev) +return -ENOSYS ; + +return dw_board_read_rom_hwaddr (pdata->enetaddr, dev->seq); +} +static void dw_adjust_link (struct eth_mac_regs *mac_p,struct phy_device *phydev) {
@@ -685,6 +700,7 @@ static const struct eth_ops designware_eth_ops = { .free_pkt = designware_eth_free_pkt, .stop = designware_eth_stop, .write_hwaddr = designware_eth_write_hwaddr, + .read_rom_hwaddr = designware_eth_read_rom_hwaddr, };static int designware_eth_ofdata_to_platdata (struct udevice *dev)
Signature · 1 line
2.10.2
PATCH 1/1 Use eth_ops hooks to set the MAC address
This patch series uses the read/write rom_hwaddr for sunxi based devices. It is split off from, but still dependant on my other patch-series, Retrieve MAC address from EEPROM.
PATCH 1/6 net: dw: Add read_rom_hwaddr net_op hook
In reply to Olliver SchinaglHi,
Quoted 35 lines · Olliver Schinagl
Add the
read_rom_hwaddrnet_ophook so that it can be called from boards to read the mac from a ROM chip.Signed-off-by Olliver Schinagl <[email protected]>--- drivers/net/designware.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)drivers/net/designware.c +15
-0@@ -230,6 +230,21 @@ static int _dw_write_hwaddr(struct dw_eth_dev *priv, u8 *mac_id)return 0 ; } +__weak int dw_board_read_rom_hwaddr (unsigned char *enetaddr,int id) +{ +return -ENOSYS ; +} + +static int designware_eth_read_rom_hwaddr (struct udevice *dev) +{ +struct eth_pdata *pdata =dev_get_platdata (dev); + +if (!dev) +return -ENOSYS ; + +return dw_board_read_rom_hwaddr (pdata->enetaddr, dev->seq); +} +static void dw_adjust_link (struct eth_mac_regs *mac_p,struct phy_device *phydev) {
drivers/net/designware.c static const struct eth_ops designware_eth_ops = { · line 706
Quoted 7 lines
drivers/net/designware.c +1
-0@@ -685,6 +700,7 @@ static const struct eth_ops designware_eth_ops = { .free_pkt = designware_eth_free_pkt, .stop = designware_eth_stop, .write_hwaddr = designware_eth_write_hwaddr, + .read_rom_hwaddr = designware_eth_read_rom_hwaddr, };static int designware_eth_ofdata_to_platdata (struct udevice *dev)
You should not call board code from a driver. But since this is a sunxi driver, why not move all the code that reads the serial number into this file?
Regards,
Simon
PATCH 1/6 net: dw: Add read_rom_hwaddr net_op hook
Quoted 44 lines · Simon Glass
Hi,
Quoted 41 lines · Olliver Schinagl
Add the
read_rom_hwaddrnet_ophook so that it can be called from boards to read the mac from a ROM chip.Signed-off-by Olliver Schinagl <[email protected]>--- drivers/net/designware.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)drivers/net/designware.c +16
-0@@ -230,6 +230,21 @@ static int _dw_write_hwaddr(struct dw_eth_dev *priv, u8 *mac_id)return 0 ; } +__weak int dw_board_read_rom_hwaddr (unsigned char *enetaddr,int id) +{ +return -ENOSYS ; +} + +static int designware_eth_read_rom_hwaddr (struct udevice *dev) +{ +struct eth_pdata *pdata =dev_get_platdata (dev); + +if (!dev) +return -ENOSYS ; + +return dw_board_read_rom_hwaddr (pdata->enetaddr, dev->seq); +} +static void dw_adjust_link (struct eth_mac_regs *mac_p,struct phy_device *phydev) {@@ -685,6 +700,7 @@ static const struct eth_ops designware_eth_ops = { .free_pkt = designware_eth_free_pkt, .stop = designware_eth_stop, .write_hwaddr = designware_eth_write_hwaddr, + .read_rom_hwaddr = designware_eth_read_rom_hwaddr, };
Quoted 4 lines
drivers/net/designware.c static const struct eth_ops designware_eth_ops = { · line 706
Quoted 1 line
drivers/net/designware.c +0
-0static int designware_eth_ofdata_to_platdata (struct udevice *dev)You should not call board code from a driver. But since this is a sunxi driver, why not move all the code that reads the serial number into this file?
Hey Simon,
unless I missunderstand, this is how Joe suggested in a while ago, and how it has been implemented in a few other drivers. Can you elaborate a bit more?
Olliver
Quoted 3 lines
Regards,
Simon
PATCH 1/6 net: dw: Add read_rom_hwaddr net_op hook
Hi Oliver,
Quoted 54 lines · Olliver Schinagl
Quoted 47 lines · Simon Glass
Hi,
Quoted 43 lines · Olliver Schinagl
Add the
read_rom_hwaddrnet_ophook so that it can be called from boards to read the mac from a ROM chip.Signed-off-by Olliver Schinagl <[email protected]>--- drivers/net/designware.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)drivers/net/designware.c +15
-0@@ -230,6 +230,21 @@ static int _dw_write_hwaddr(struct dw_eth_dev *priv, u8 *mac_id)return 0 ; } +__weak int dw_board_read_rom_hwaddr (unsigned char *enetaddr,int id) +{ +return -ENOSYS ; +} + +static int designware_eth_read_rom_hwaddr (struct udevice *dev) +{ +struct eth_pdata *pdata =dev_get_platdata (dev); + +if (!dev) +return -ENOSYS ; + +return dw_board_read_rom_hwaddr (pdata->enetaddr, dev->seq); +} +static void dw_adjust_link (struct eth_mac_regs *mac_p,struct phy_device *phydev){drivers/net/designware.c +1
-0@@ -685,6 +700,7 @@ static const struct eth_ops designware_eth_ops = { .free_pkt = designware_eth_free_pkt, .stop = designware_eth_stop, .write_hwaddr = designware_eth_write_hwaddr, + .read_rom_hwaddr = designware_eth_read_rom_hwaddr, };Quoted 5 lines
drivers/net/designware.c static const struct eth_ops designware_eth_ops = { · line 706
Quoted 1 line
drivers/net/designware.c +0
-0static int designware_eth_ofdata_to_platdata (struct udevice *dev)You should not call board code from a driver. But since this is a sunxi driver, why not move all the code that reads the serial number into this file?
Quoted 5 lines
Hey Simon,
unless I missunderstand, this is how Joe suggested in a while ago, and how it has been implemented in a few other drivers. Can you elaborate a bit more?
Yes...drivers must not call into board-specific code, nor have board-specific #defines. This limits their usefulness for other boards.
Adding hooks like this (particularly with the word 'board' in the name) should be avoided.
We end up with bidirectional coupling between the board and the driver. The board should use the driver but not the other way around. I understand that you are trying to get around this by using a weak function, but with driver model I'm really trying hard to avoid weak functions. They normally indicate an ad-hoc API and can generally be avoided with a bit more design thought.
If you have a standard way of reading the serial number which is supported by all sunxi boards, then you should be able to add your changes to the sunxi Ethernet driver (which uses designware.c?). Then you can leave the designware.c code alone and avoid adding a hook.
In a sense you end up subclassing the designware driver.
Also see this series which deals with a similar problem with rockchip:
http://lists.denx.de/pipermail/u-boot/2016-November/274256.html
Regards,
Simon
PATCH 1/6 net: dw: Add read_rom_hwaddr net_op hook
Hey Simon,
Quoted 53 lines · Simon Glass
Hi Oliver,
Quoted 50 lines · Olliver Schinagl
Quoted 49 lines · Simon Glass
Hi,
Quoted 36 lines · Olliver Schinagl
Add the
read_rom_hwaddrnet_ophook so that it can be called from boards to read the mac from a ROM chip.Signed-off-by Olliver Schinagl <[email protected]>--- drivers/net/designware.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)drivers/net/designware.c +15
-0@@ -230,6 +230,21 @@ static int _dw_write_hwaddr(struct dw_eth_dev *priv, u8 *mac_id)return 0 ; } +__weak int dw_board_read_rom_hwaddr (unsigned char *enetaddr,int id) +{ +return -ENOSYS ; +} + +static int designware_eth_read_rom_hwaddr (struct udevice *dev) +{ +struct eth_pdata *pdata =dev_get_platdata (dev); + +if (!dev) +return -ENOSYS ; + +return dw_board_read_rom_hwaddr (pdata->enetaddr, dev->seq); +} +static void dw_adjust_link (struct eth_mac_regs *mac_p,struct phy_device *phydev){drivers/net/designware.c static const struct eth_ops designware_eth_ops = { · line 706
Quoted 7 lines
drivers/net/designware.c +1
-0@@ -685,6 +700,7 @@ static const struct eth_ops designware_eth_ops = { .free_pkt = designware_eth_free_pkt, .stop = designware_eth_stop, .write_hwaddr = designware_eth_write_hwaddr, + .read_rom_hwaddr = designware_eth_read_rom_hwaddr, };static int designware_eth_ofdata_to_platdata (struct udevice *dev)You should not call board code from a driver. But since this is a sunxi driver, why not move all the code that reads the serial number into this file?
Quoted 8 lines
Quoted 5 lines
Hey Simon,
unless I missunderstand, this is how Joe suggested in a while ago, and how it has been implemented in a few other drivers. Can you elaborate a bit more?
Yes...drivers must not call into board-specific code, nor have board-specific #defines. This limits their usefulness for other boards.
Hmm, well as I said, I just followed Joe's suggestion with his example. also isn't this exactly how the zynq does it as well?
Quoted 11 lines
Adding hooks like this (particularly with the word 'board' in the name) should be avoided.
We end up with bidirectional coupling between the board and the driver. The board should use the driver but not the other way around. I understand that you are trying to get around this by using a weak function, but with driver model I'm really trying hard to avoid weak functions. They normally indicate an ad-hoc API and can generally be avoided with a bit more design thought.
Quoted 4 lines
If you have a standard way of reading the serial number which is supported by all sunxi boards, then you should be able to add your changes to the sunxi Ethernet driver (which uses
designware.c?). Then you can leave thedesignware.ccode alone and avoid adding a hook.
Well yes and no. We use designware, but also sunxi_emac, and some sdio_realtek that does not have a driver yet. But in essence, this is somewhat what I do in this patch I guess. I have the weak driver specific function in the sunxi code.
But I think I'm starting to understand your solution and will read up on the rockchip patches and rewrite this bit.
Quoted 9 lines
In a sense you end up subclassing the designware driver.
Also see this series which deals with a similar problem with rockchip:
http://lists.denx.de/pipermail/u-boot/2016-November/274256.html
Regards,
Simon
PATCH 1/6 net: dw: Add read_rom_hwaddr net_op hook
Quoted 74 lines · Olliver Schinagl
Hey Simon,
Quoted 69 lines · Simon Glass
Hi Oliver,
Quoted 64 lines · Olliver Schinagl
Quoted 50 lines · Simon Glass
Hi,
Quoted 45 lines · Olliver Schinagl
Add the
read_rom_hwaddrnet_ophook so that it can be called from boards
to read the mac from a ROM chip.Signed-off-by Olliver Schinagl <[email protected]>--- drivers/net/designware.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)drivers/net/designware.c +15
-0@@ -230,6 +230,21 @@ static int _dw_write_hwaddr(struct dw_eth_dev *priv, u8 *mac_id)return 0 ; } +__weak int dw_board_read_rom_hwaddr (unsigned char *enetaddr,int id) +{ +return -ENOSYS ; +} + +static int designware_eth_read_rom_hwaddr (struct udevice *dev) +{ +struct eth_pdata *pdata =dev_get_platdata (dev); + +if (!dev) +return -ENOSYS ; + +return dw_board_read_rom_hwaddr (pdata->enetaddr, dev->seq); +} + static void dw_adjust_link(struct eth_mac_regs *mac_p,struct
phy_device*phydev)
{drivers/net/designware.c +1
-0@@ -685,6 +700,7 @@ static const struct eth_ops designware_eth_ops = { .free_pkt = designware_eth_free_pkt, .stop = designware_eth_stop, .write_hwaddr = designware_eth_write_hwaddr, + .read_rom_hwaddr = designware_eth_read_rom_hwaddr, };Quoted 5 lines
drivers/net/designware.c static const struct eth_ops designware_eth_ops = { · line 706
Quoted 1 line
drivers/net/designware.c +0
-0static int designware_eth_ofdata_to_platdata (struct udevice *dev)You should not call board code from a driver. But since this is a sunxi driver, why not move all the code that reads the serial number into this file?
Hey Simon,
unless I missunderstand, this is how Joe suggested in a while ago, and how
it has been implemented in a few other drivers. Can you elaborate a bit more?
Quoted 6 lines
Quoted 3 lines
Yes...drivers must not call into board-specific code, nor have board-specific #defines. This limits their usefulness for other boards.
Hmm, well as I said, I just followed Joe's suggestion with his example. also isn't this exactly how the zynq does it as well?
Sorry for misleading you. Simon has since convinced me that making a separate board-specific driver that leverages the core driver's code is a cleaner approach, and now what I recommend.
Quoted 38 lines
Quoted 10 lines
Adding hooks like this (particularly with the word 'board' in the name) should be avoided.
We end up with bidirectional coupling between the board and the driver. The board should use the driver but not the other way around. I understand that you are trying to get around this by using a weak function, but with driver model I'm really trying hard to avoid weak functions. They normally indicate an ad-hoc API and can generally be avoided with a bit more design thought.
Quoted 4 lines
If you have a standard way of reading the serial number which is supported by all sunxi boards, then you should be able to add your changes to the sunxi Ethernet driver (which uses
designware.c?). Then you can leave thedesignware.ccode alone and avoid adding a hook.Well yes and no. We use designware, but also
sunxi_emac, and somesdio_realtekthat does not have a driver yet. But in essence, this is somewhat what I do in this patch I guess. I have the weak driver specific function in the sunxi code.But I think I'm starting to understand your solution and will read up on the rockchip patches and rewrite this bit.
Quoted 9 lines
In a sense you end up subclassing the designware driver.
Also see this series which deals with a similar problem with rockchip:
http://lists.denx.de/pipermail/u-boot/2016-November/274256.html
Regards,
Simon_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
PATCH 2/6 net: sunxi-emac: Write HW address via function
In reply to Olliver SchinaglCurrently the mac address is programmed directly in _sunxi_emac_eth_init making it a one time inflexible operation. By moving it into a separate function, we can now use this more flexibly.
--- drivers/net/sunxi_emac.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-)
drivers/net/sunxi_emac.c +15 -4
@@ -327,6 +327,20 @@ static void emac_reset(struct emac_eth_dev *priv)udelay (200 ); } +static int _sunxi_write_hwaddr (struct emac_eth_dev *priv,u8 *enetaddr) +{ +struct emac_regs *regs = priv->regs; +u32 enetaddr_lo, enetaddr_hi; + + enetaddr_lo = enetaddr[2 ] | (enetaddr[1 ] <<8 ) | (enetaddr[0 ] <<16 ); + enetaddr_hi = enetaddr[5 ] | (enetaddr[4 ] <<8 ) | (enetaddr[3 ] <<16 ); + +writel (enetaddr_hi, ®s->mac_a1); +writel (enetaddr_lo, ®s->mac_a0); + +return 0 ; +} +static int _sunxi_emac_eth_init (struct emac_eth_dev *priv,u8 *enetaddr) {struct emac_regs *regs = priv->regs;
@@ -350,10 +364,7 @@ static int _sunxi_emac_eth_init(struct emac_eth_dev *priv, u8 *enetaddr)/* Set up EMAC */ emac_setup (priv); -writel (enetaddr[0 ] <<16 | enetaddr[1 ] <<8 | enetaddr[2 ], - ®s->mac_a1); -writel (enetaddr[3 ] <<16 | enetaddr[4 ] <<8 | enetaddr[5 ], - ®s->mac_a0); +_sunxi_write_hwaddr (priv, enetaddr);mdelay (1 );
Signature · 1 line
2.10.2
PATCH 2/6 net: sunxi-emac: Write HW address via function
Quoted 5 lines · Olliver Schinagl
Currently the mac address is programmed directly in
_sunxi_emac_eth_initmaking it a one time inflexible operation. By moving it into a separate function, we can now use this more flexibly.Signed-off-by Olliver Schinagl <[email protected]>
[U-Boot] net: sunxi-emac: Write HW address via function
In reply to Olliver SchinaglHi oliver at schinagl.nl,
https://patchwork.ozlabs.org/patch/699295/ was applied to u-boot-net.git.
Thanks!
-Joe
PATCH 3/6 net: sunxi-emac: Add write_hwaddr net_op hook
In reply to Olliver SchinaglExpose enetaddr writing via net_ops so that it can be hooked into.
--- drivers/net/sunxi_emac.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/net/sunxi_emac.c +12 -0
@@ -554,6 +554,17 @@ static void sunxi_emac_eth_stop(struct udevice *dev)/* Nothing to do here */ } +static int sunxi_emac_eth_write_hwaddr (struct udevice *dev) +{ +struct eth_pdata *pdata =dev_get_platdata (dev); +struct emac_eth_dev *priv =dev_get_priv (dev); + +if (!dev) +return -ENOSYS ; + +return _sunxi_write_hwaddr (priv, pdata->enetaddr); +} +static int sunxi_emac_eth_probe (struct udevice *dev) {struct eth_pdata *pdata =dev_get_platdata (dev);
@@ -570,6 +581,7 @@ static const struct eth_ops sunxi_emac_eth_ops = { .send = sunxi_emac_eth_send, .recv = sunxi_emac_eth_recv, .stop = sunxi_emac_eth_stop, + .write_hwaddr = sunxi_emac_eth_write_hwaddr, };static int sunxi_emac_eth_ofdata_to_platdata (struct udevice *dev)
Signature · 1 line
2.10.2
PATCH 3/6 net: sunxi-emac: Add write_hwaddr net_op hook
Quoted 14 lines · Olliver Schinagl
Expose enetaddr writing via
net_opsso that it can be hooked into.Signed-off-by Olliver Schinagl <[email protected]>--- drivers/net/sunxi_emac.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)drivers/net/sunxi_emac.c +0
-0@@ -554,6 +554,17 @@ static void sunxi_emac_eth_stop(struct udevice *dev)/* Nothing to do here */ }
drivers/net/sunxi_emac.c static void sunxi_emac_eth_stop(struct udevice *dev) · line 565
Quoted 10 lines
drivers/net/sunxi_emac.c +9
-0+static int sunxi_emac_eth_write_hwaddr (struct udevice *dev) +{ +struct eth_pdata *pdata =dev_get_platdata (dev); +struct emac_eth_dev *priv =dev_get_priv (dev); + +if (!dev) +return -ENOSYS ; + +return _sunxi_write_hwaddr (priv, pdata->enetaddr);
You should check the pdata ptr value before dereferencing it.
Quoted 20 lines
drivers/net/sunxi_emac.c +3
-1+} +static int sunxi_emac_eth_probe (struct udevice *dev) {struct eth_pdata *pdata =dev_get_platdata (dev);@@ -570,6 +581,7 @@ static const struct eth_ops sunxi_emac_eth_ops = { .send = sunxi_emac_eth_send, .recv = sunxi_emac_eth_recv, .stop = sunxi_emac_eth_stop, + .write_hwaddr = sunxi_emac_eth_write_hwaddr, };static int sunxi_emac_eth_ofdata_to_platdata (struct udevice *dev) --2.10.2
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
PATCH 4/6 net: sunxi-emac: Add read_rom_hwaddr net_op hook
In reply to Olliver SchinaglAdd the read_rom_hwaddr net_op hook so that it can be called from boards to read the mac from a ROM chip.
--- drivers/net/sunxi_emac.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
drivers/net/sunxi_emac.c +16 -0
@@ -565,6 +565,21 @@ static int sunxi_emac_eth_write_hwaddr(struct udevice *dev)return _sunxi_write_hwaddr (priv, pdata->enetaddr); } +__weak int sunxi_emac_board_read_rom_hwaddr (unsigned char *enetaddr,int id) +{ +return -ENOSYS ; +} + +static int sunxi_emac_eth_read_rom_hwaddr (struct udevice *dev) +{ +struct eth_pdata *pdata =dev_get_platdata (dev); + +if (!dev) +return -ENOSYS ; + +return sunxi_emac_board_read_rom_hwaddr (pdata->enetaddr, dev->seq); +} +static int sunxi_emac_eth_probe (struct udevice *dev) {struct eth_pdata *pdata =dev_get_platdata (dev);
@@ -582,6 +597,7 @@ static const struct eth_ops sunxi_emac_eth_ops = { .recv = sunxi_emac_eth_recv, .stop = sunxi_emac_eth_stop, .write_hwaddr = sunxi_emac_eth_write_hwaddr, + .read_rom_hwaddr = sunxi_emac_eth_read_rom_hwaddr, };static int sunxi_emac_eth_ofdata_to_platdata (struct udevice *dev)
Signature · 1 line
2.10.2
PATCH 4/6 net: sunxi-emac: Add read_rom_hwaddr net_op hook
Quoted 35 lines · Olliver Schinagl
Add the
read_rom_hwaddrnet_ophook so that it can be called from boards to read the mac from a ROM chip.Signed-off-by Olliver Schinagl <[email protected]>--- drivers/net/sunxi_emac.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)drivers/net/sunxi_emac.c +15
-0@@ -565,6 +565,21 @@ static int sunxi_emac_eth_write_hwaddr(struct udevice *dev)return _sunxi_write_hwaddr (priv, pdata->enetaddr); } +__weak int sunxi_emac_board_read_rom_hwaddr (unsigned char *enetaddr,int id) +{ +return -ENOSYS ; +} + +static int sunxi_emac_eth_read_rom_hwaddr (struct udevice *dev) +{ +struct eth_pdata *pdata =dev_get_platdata (dev); + +if (!dev) +return -ENOSYS ; + +return sunxi_emac_board_read_rom_hwaddr (pdata->enetaddr, dev->seq); +} +static int sunxi_emac_eth_probe (struct udevice *dev) {struct eth_pdata *pdata =dev_get_platdata (dev);
drivers/net/sunxi_emac.c static const struct eth_ops sunxi_emac_eth_ops = { · line 601
Quoted 5 lines
drivers/net/sunxi_emac.c +1
-0@@ -582,6 +597,7 @@ static const struct eth_ops sunxi_emac_eth_ops = { .recv = sunxi_emac_eth_recv, .stop = sunxi_emac_eth_stop, .write_hwaddr = sunxi_emac_eth_write_hwaddr, + .read_rom_hwaddr = sunxi_emac_eth_read_rom_hwaddr, };
I think we are already on the same page, but the solution would look like this, but the ops themselves would be redefined in a separate board-specific driver and would only have a read_rom_hwaddr op in that driver, not this one. Then the board specific "sunxi_emac_eth_read_rom_hwaddr()" would simply be in that driver, not a weak reference to it.
Quoted 8 lines
drivers/net/sunxi_emac.c +0
-1static int sunxi_emac_eth_ofdata_to_platdata (struct udevice *dev) --2.10.2
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
PATCH 5/6 arm: sunxi: Use board hooks to obtain MAC address
In reply to Olliver SchinaglAdd board hooks allowing to get ethernet addresses in a board specific manner. Currently this is done by generating a MAC address from the SID and injecting the ethernet device number in the first octet.
This usually happens as a fallback, if either the eeprom fails to set a MAC address or the FDT forces an override.
--- arch/arm/include/asm/arch-sunxi/sys_proto.h | 11 ++ board/sunxi/board.c | 161 +++++++++++++++------------- net/eth_legacy.c | 1 + 3 files changed, 98 insertions(+), 75 deletions(-)
arch/arm/include/asm/arch-sunxi/sys_proto.h +11 -0
@@ -30,4 +30,15 @@ void eth_init_board(void);static inline void eth_init_board (void ) {}#endif +int board_get_enetaddr (const int i,unsigned char *mac_addr); + +#if CONFIG_SUNXI_EMAC +int sunxi_emac_board_read_rom_hwaddr (unsigned char *enetaddr,int id); +#endif + +#if defined(CONFIG_SUNXI_GMAC ) || defined(CONFIG_ETH_DESIGNWARE ) +int dw_board_read_rom_hwaddr (unsigned char *enetaddr,int id); +#endif + +#endif
board/sunxi/board.c +86 -75
200 lines not on this page · raw message
net/eth_legacy.c +1 -0
@@ -10,6 +10,7 @@#include <command.h> #include <environment.h> #include <net.h> +#include <i2c.h> #include <phy.h> #include <linux/errno.h> #include "eth_internal.h"
Signature · 1 line
2.10.2
PATCH 5/6 arm: sunxi: Use board hooks to obtain MAC address
Quoted 83 lines · Olliver Schinagl
Add board hooks allowing to get ethernet addresses in a board specific manner. Currently this is done by generating a MAC address from the SID and injecting the ethernet device number in the first octet.
This usually happens as a fallback, if either the eeprom fails to set a MAC address or the FDT forces an override.
Signed-off-by Olliver Schinagl <[email protected]>--- arch/arm/include/asm/arch-sunxi/sys_proto.h | 11 ++ board/sunxi/board.c | 161 +++++++++++++++------------- net/eth_legacy.c | 1 + 3 files changed, 98 insertions(+), 75 deletions(-)arch/arm/include/asm/arch-sunxi/sys_proto.h +11
-0@@ -30,4 +30,15 @@ void eth_init_board(void);static inline void eth_init_board (void ) {}#endif +int board_get_enetaddr (const int i,unsigned char *mac_addr); + +#if CONFIG_SUNXI_EMAC +int sunxi_emac_board_read_rom_hwaddr (unsigned char *enetaddr,int id); +#endif + +#if defined(CONFIG_SUNXI_GMAC ) || defined(CONFIG_ETH_DESIGNWARE ) +int dw_board_read_rom_hwaddr (unsigned char *enetaddr,int id); +#endif + +#endif board/sunxi/board.c +29
-0@@ -21,6 +21,7 @@#include <asm/arch/gpio.h> #include <asm/arch/mmc.h> #include <asm/arch/spl.h> +#include <asm/arch/sys_proto.h> #include <asm/arch/usb_phy.h> #ifndef CONFIG_ARM64 #include <asm/armv7.h> @@ -564,6 +565,34 @@ int g_dnl_board_usb_cable_connected(void) }#endif +int sunxi_get_board_serial (unsigned int *serial) +{ +int ret; + + ret =sunxi_get_sid (serial); +if (!ret || serial[0 ]) +return -ENOSYS ; + +/* +* The single words 1 - 3 of the SID have quite a few bits +* which are the same on many models, so we take a crc32 +* of all 3 words, to get a more unique value. +* +* Note we only do this on newer SoCs as we cannot change +* the algorithm on older SoCs since those have been using +* fixed mac-addresses/serial based on only using word 3 for a +* long time and changing a fixed mac-address/serial with an +* u-boot update is not good. +*/ +#if !defined(CONFIG_MACH_SUN4I ) && !defined(CONFIG_MACH_SUN5I ) && \ + !defined(CONFIG_MACH_SUN6I ) && !defined(CONFIG_MACH_SUN7I ) && \ + !defined(CONFIG_MACH_SUN8I_A23 ) && !defined(CONFIG_MACH_SUN8I_A33 ) + serial[3 ] =crc32 (0 , (unsigned char *)&serial[1 ],12 ); +#endif + +return 0 ; +} +#ifdef CONFIG_SERIAL_TAG void get_board_serial (struct tag_serialnr *serialnr) {@@ -585,6 +614,54 @@ void get_board_serial(struct tag_serialnr *serialnr)#endif
board/sunxi/board.c void get_board_serial(struct tag_serialnr *serialnr) · line 624
Quoted 10 lines
board/sunxi/board.c +8
-0/* +* Generate a MAC address based on device index and the serial number. +* The first half of the of the first octet holds the eth index. +* +* In the second octet we forcefully mark the MAC address to a locally +* administered MAC address. +* +*/ +int board_get_enetaddr (const int index,unsigned char *enetaddr)
This would be part of a board-specific eth driver.
Quoted 170 lines
board/sunxi/board.c +49
-75+{ +uint8_t mac_addr[ARP_HLEN ] = {0x00 }; +unsigned int serial[4 ]; +int ret; + +if ((index <0 ) || !enetaddr) +return -ENOSYS ; + + ret =sunxi_get_board_serial (serial); +if (!ret) +return ret; + +/* Ensure the NIC specific bytes of the mac are not all 0 */ +if ((serial[3 ] &0xffffff ) ==0 ) + serial[3 ] |=0x800000 ; + + mac_addr[0 ] = (index <<4 ); + mac_addr[1 ] = (serial[0 ] >>0 ) &0xff ; + mac_addr[2 ] = (serial[3 ] >>24 ) &0xff ; + mac_addr[3 ] = (serial[3 ] >>16 ) &0xff ; + mac_addr[4 ] = (serial[3 ] >>8 ) &0xff ; + mac_addr[5 ] = (serial[3 ] >>0 ) &0xff ; + +set_local_ethaddr (mac_addr); +memcpy (enetaddr, mac_addr,ARP_HLEN ); + +return 0 ; +} + +int sunxi_emac_board_read_rom_hwaddr (unsigned char *enetaddr,int id) +{ +return board_get_enetaddr (id, enetaddr); +} + +int dw_board_read_rom_hwaddr (unsigned char *enetaddr,int id) +{ +return board_get_enetaddr (id, enetaddr); +} + +/* * Check the SPL header for the "sunxi" variant. If found: parse values * that might have been passed by the loader ("fel" utility), and update * the environment accordingly. @@ -617,77 +694,10 @@ static void parse_spl_header(const uint32_t spl_addr)setenv_hex ("fel_scriptaddr" , spl->fel_script_address); } -/* -* Note this function gets called multiple times. -* It must not make any changes to env variables which already exist. -*/ -static void setup_environment (const void *fdt) -{ -char serial_string[17 ] = {0 }; -unsigned int sid[4 ]; -uint8_t mac_addr[6 ]; -char ethaddr[16 ]; -int i, ret; - - ret =sunxi_get_sid (sid); -if (ret ==0 && sid[0 ] !=0 ) { -/* -* The single words 1 - 3 of the SID have quite a few bits -* which are the same on many models, so we take a crc32 -* of all 3 words, to get a more unique value. -* -* Note we only do this on newer SoCs as we cannot change -* the algorithm on older SoCs since those have been using -* fixed mac-addresses based on only using word 3 for a -* long time and changing a fixed mac-address with an -* u-boot update is not good. -*/ -#if !defined(CONFIG_MACH_SUN4I ) && !defined(CONFIG_MACH_SUN5I ) && \ - !defined(CONFIG_MACH_SUN6I ) && !defined(CONFIG_MACH_SUN7I ) && \ - !defined(CONFIG_MACH_SUN8I_A23 ) && !defined(CONFIG_MACH_SUN8I_A33 ) - sid[3 ] =crc32 (0 , (unsigned char *)&sid[1 ],12 ); -#endif - -/* Ensure the NIC specific bytes of the mac are not all 0 */ -if ((sid[3 ] &0xffffff ) ==0 ) - sid[3 ] |=0x800000 ; - -for (i =0 ; i <4 ; i++) { -sprintf (ethaddr,"ethernet%d" , i); -if (!fdt_get_alias (fdt, ethaddr)) -continue ; - -if (i ==0 ) -strcpy (ethaddr,"ethaddr" ); -else -sprintf (ethaddr,"eth%daddr" , i); - -if (getenv (ethaddr)) -continue ; - -/* Non OUI / registered MAC address */ - mac_addr[0 ] = (i <<4 ) |0x02 ; - mac_addr[1 ] = (sid[0 ] >>0 ) &0xff ; - mac_addr[2 ] = (sid[3 ] >>24 ) &0xff ; - mac_addr[3 ] = (sid[3 ] >>16 ) &0xff ; - mac_addr[4 ] = (sid[3 ] >>8 ) &0xff ; - mac_addr[5 ] = (sid[3 ] >>0 ) &0xff ; - -eth_setenv_enetaddr (ethaddr, mac_addr); - } - -if (!getenv ("serial#" )) { -snprintf (serial_string,sizeof (serial_string), -"%08x%08x" , sid[0 ], sid[3 ]); - -setenv ("serial#" , serial_string); - } - } -} -int misc_init_r (void ) {__maybe_unused int ret; +unsigned int serial[4 ];setenv ("fel_booted" ,NULL );setenv ("fel_scriptaddr" ,NULL );@@ -697,7 +707,14 @@ int misc_init_r(void)parse_spl_header (SPL_ADDR ); } -setup_environment (gd->fdt_blob); +if (sunxi_get_board_serial (serial)) { +char serial_string[17 ] = {0 }; + +snprintf (serial_string,sizeof (serial_string), +"%08x%08x" , serial[0 ], serial[3 ]); + +setenv ("serial#" , serial_string); + }#ifndef CONFIG_MACH_SUN9I ret =sunxi_usb_phy_probe ();@@ -713,12 +730,6 @@ int ft_board_setup(void *blob, bd_t *bd) {int __maybe_unused r; -/* -* Call setup_environment again in case the boot fdt has -* ethernet aliases the u-boot copy does not have. -*/ -setup_environment (blob); -#ifdef CONFIG_VIDEO_DT_SIMPLEFB r =sunxi_simplefb_setup (blob);if (r)net/eth_legacy.c +1
-1@@ -10,6 +10,7 @@#include <command.h> #include <environment.h> #include <net.h> +#include <i2c.h> #include <phy.h> #include <linux/errno.h> #include "eth_internal.h" --2.10.2
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
PATCH 5/6 arm: sunxi: Use board hooks to obtain MAC address
Hey Joe,
Quoted 85 lines · Joe Hershberger
Quoted 84 lines · Olliver Schinagl
Add board hooks allowing to get ethernet addresses in a board specific manner. Currently this is done by generating a MAC address from the SID and injecting the ethernet device number in the first octet.
This usually happens as a fallback, if either the eeprom fails to set a MAC address or the FDT forces an override.
Signed-off-by Olliver Schinagl <[email protected]>--- arch/arm/include/asm/arch-sunxi/sys_proto.h | 11 ++ board/sunxi/board.c | 161 +++++++++++++++------------- net/eth_legacy.c | 1 + 3 files changed, 98 insertions(+), 75 deletions(-)arch/arm/include/asm/arch-sunxi/sys_proto.h +11
-0@@ -30,4 +30,15 @@ void eth_init_board(void);static inline void eth_init_board (void ) {}#endif +int board_get_enetaddr (const int i,unsigned char *mac_addr); + +#if CONFIG_SUNXI_EMAC +int sunxi_emac_board_read_rom_hwaddr (unsigned char *enetaddr,int id); +#endif + +#if defined(CONFIG_SUNXI_GMAC ) || defined(CONFIG_ETH_DESIGNWARE ) +int dw_board_read_rom_hwaddr (unsigned char *enetaddr,int id); +#endif + +#endif board/sunxi/board.c +29
-0@@ -21,6 +21,7 @@#include <asm/arch/gpio.h> #include <asm/arch/mmc.h> #include <asm/arch/spl.h> +#include <asm/arch/sys_proto.h> #include <asm/arch/usb_phy.h> #ifndef CONFIG_ARM64 #include <asm/armv7.h> @@ -564,6 +565,34 @@ int g_dnl_board_usb_cable_connected(void) }#endif +int sunxi_get_board_serial (unsigned int *serial) +{ +int ret; + + ret =sunxi_get_sid (serial); +if (!ret || serial[0 ]) +return -ENOSYS ; + +/* +* The single words 1 - 3 of the SID have quite a few bits +* which are the same on many models, so we take a crc32 +* of all 3 words, to get a more unique value. +* +* Note we only do this on newer SoCs as we cannot change +* the algorithm on older SoCs since those have been using +* fixed mac-addresses/serial based on only using word 3 for a +* long time and changing a fixed mac-address/serial with an +* u-boot update is not good. +*/ +#if !defined(CONFIG_MACH_SUN4I ) && !defined(CONFIG_MACH_SUN5I ) && \ + !defined(CONFIG_MACH_SUN6I ) && !defined(CONFIG_MACH_SUN7I ) && \ + !defined(CONFIG_MACH_SUN8I_A23 ) && !defined(CONFIG_MACH_SUN8I_A33 ) + serial[3 ] =crc32 (0 , (unsigned char *)&serial[1 ],12 ); +#endif + +return 0 ; +} +#ifdef CONFIG_SERIAL_TAG void get_board_serial (struct tag_serialnr *serialnr) {@@ -585,6 +614,54 @@ void get_board_serial(struct tag_serialnr *serialnr)#endif
Quoted 11 lines
board/sunxi/board.c void get_board_serial(struct tag_serialnr *serialnr) · line 624
Quoted 9 lines
board/sunxi/board.c +8
-0/* +* Generate a MAC address based on device index and the serial number. +* The first half of the of the first octet holds the eth index. +* +* In the second octet we forcefully mark the MAC address to a locally +* administered MAC address. +* +*/ +int board_get_enetaddr (const int index,unsigned char *enetaddr)This would be part of a board-specific eth driver.
this is being called now from sunxi_gmac.c and sunxi_emac.c and supplies these board specific drivers with a mac address based on the serial number of the board. I could move this logic over, but then i'd have to add it to both eth drivers. By having it in the board.c file, we have 2 simple functions in the board-specific eth driver:
static int sunxi_gmac_eth_read_rom_hwaddr(struct udevice *dev)
{
struct eth_pdata *pdata = dev_get_platdata(dev);
return board_get_enetaddr(dev->seq, pdata->enetaddr);
}So do you propose to dupilicate the code into both board specific drivers, have it named differently or that the shared code live elsewhere?
Olliver
Quoted 171 lines
Quoted 171 lines
board/sunxi/board.c +49
-75+{ +uint8_t mac_addr[ARP_HLEN ] = {0x00 }; +unsigned int serial[4 ]; +int ret; + +if ((index <0 ) || !enetaddr) +return -ENOSYS ; + + ret =sunxi_get_board_serial (serial); +if (!ret) +return ret; + +/* Ensure the NIC specific bytes of the mac are not all 0 */ +if ((serial[3 ] &0xffffff ) ==0 ) + serial[3 ] |=0x800000 ; + + mac_addr[0 ] = (index <<4 ); + mac_addr[1 ] = (serial[0 ] >>0 ) &0xff ; + mac_addr[2 ] = (serial[3 ] >>24 ) &0xff ; + mac_addr[3 ] = (serial[3 ] >>16 ) &0xff ; + mac_addr[4 ] = (serial[3 ] >>8 ) &0xff ; + mac_addr[5 ] = (serial[3 ] >>0 ) &0xff ; + +set_local_ethaddr (mac_addr); +memcpy (enetaddr, mac_addr,ARP_HLEN ); + +return 0 ; +} + +int sunxi_emac_board_read_rom_hwaddr (unsigned char *enetaddr,int id) +{ +return board_get_enetaddr (id, enetaddr); +} + +int dw_board_read_rom_hwaddr (unsigned char *enetaddr,int id) +{ +return board_get_enetaddr (id, enetaddr); +} + +/* * Check the SPL header for the "sunxi" variant. If found: parse values * that might have been passed by the loader ("fel" utility), and update * the environment accordingly. @@ -617,77 +694,10 @@ static void parse_spl_header(const uint32_t spl_addr)setenv_hex ("fel_scriptaddr" , spl->fel_script_address); } -/* -* Note this function gets called multiple times. -* It must not make any changes to env variables which already exist. -*/ -static void setup_environment (const void *fdt) -{ -char serial_string[17 ] = {0 }; -unsigned int sid[4 ]; -uint8_t mac_addr[6 ]; -char ethaddr[16 ]; -int i, ret; - - ret =sunxi_get_sid (sid); -if (ret ==0 && sid[0 ] !=0 ) { -/* -* The single words 1 - 3 of the SID have quite a few bits -* which are the same on many models, so we take a crc32 -* of all 3 words, to get a more unique value. -* -* Note we only do this on newer SoCs as we cannot change -* the algorithm on older SoCs since those have been using -* fixed mac-addresses based on only using word 3 for a -* long time and changing a fixed mac-address with an -* u-boot update is not good. -*/ -#if !defined(CONFIG_MACH_SUN4I ) && !defined(CONFIG_MACH_SUN5I ) && \ - !defined(CONFIG_MACH_SUN6I ) && !defined(CONFIG_MACH_SUN7I ) && \ - !defined(CONFIG_MACH_SUN8I_A23 ) && !defined(CONFIG_MACH_SUN8I_A33 ) - sid[3 ] =crc32 (0 , (unsigned char *)&sid[1 ],12 ); -#endif - -/* Ensure the NIC specific bytes of the mac are not all 0 */ -if ((sid[3 ] &0xffffff ) ==0 ) - sid[3 ] |=0x800000 ; - -for (i =0 ; i <4 ; i++) { -sprintf (ethaddr,"ethernet%d" , i); -if (!fdt_get_alias (fdt, ethaddr)) -continue ; - -if (i ==0 ) -strcpy (ethaddr,"ethaddr" ); -else -sprintf (ethaddr,"eth%daddr" , i); - -if (getenv (ethaddr)) -continue ; - -/* Non OUI / registered MAC address */ - mac_addr[0 ] = (i <<4 ) |0x02 ; - mac_addr[1 ] = (sid[0 ] >>0 ) &0xff ; - mac_addr[2 ] = (sid[3 ] >>24 ) &0xff ; - mac_addr[3 ] = (sid[3 ] >>16 ) &0xff ; - mac_addr[4 ] = (sid[3 ] >>8 ) &0xff ; - mac_addr[5 ] = (sid[3 ] >>0 ) &0xff ; - -eth_setenv_enetaddr (ethaddr, mac_addr); - } - -if (!getenv ("serial#" )) { -snprintf (serial_string,sizeof (serial_string), -"%08x%08x" , sid[0 ], sid[3 ]); - -setenv ("serial#" , serial_string); - } - } -} -int misc_init_r (void ) {__maybe_unused int ret; +unsigned int serial[4 ];setenv ("fel_booted" ,NULL );setenv ("fel_scriptaddr" ,NULL );@@ -697,7 +707,14 @@ int misc_init_r(void)parse_spl_header (SPL_ADDR ); } -setup_environment (gd->fdt_blob); +if (sunxi_get_board_serial (serial)) { +char serial_string[17 ] = {0 }; + +snprintf (serial_string,sizeof (serial_string), +"%08x%08x" , serial[0 ], serial[3 ]); + +setenv ("serial#" , serial_string); + }#ifndef CONFIG_MACH_SUN9I ret =sunxi_usb_phy_probe ();@@ -713,12 +730,6 @@ int ft_board_setup(void *blob, bd_t *bd) {int __maybe_unused r; -/* -* Call setup_environment again in case the boot fdt has -* ethernet aliases the u-boot copy does not have. -*/ -setup_environment (blob); -#ifdef CONFIG_VIDEO_DT_SIMPLEFB r =sunxi_simplefb_setup (blob);if (r)net/eth_legacy.c +1
-1@@ -10,6 +10,7 @@#include <command.h> #include <environment.h> #include <net.h> +#include <i2c.h> #include <phy.h> #include <linux/errno.h> #include "eth_internal.h" --2.10.2
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
PATCH 5/6 arm: sunxi: Use board hooks to obtain MAC address
Quoted 134 lines · Olliver Schinagl
Hey Joe,
Quoted 100 lines · Joe Hershberger
Quoted 98 lines · Olliver Schinagl
Add board hooks allowing to get ethernet addresses in a board specific
manner. Currently this is done by generating a MAC address from the SID and injecting the ethernet device number in the first octet.This usually happens as a fallback, if either the eeprom fails to set a
MAC address or the FDT forces an override.Signed-off-by Olliver Schinagl <[email protected]>---
arch/arm/include/asm/arch-sunxi/sys_proto.h | 11 ++ board/sunxi/board.c | 161
+++++++++++++++-------------
net/eth_legacy.c | 1 +3 files changed, 98 insertions(+), 75 deletions(-)arch/arm/include/asm/arch-sunxi/sys_proto.h +11
-0@@ -30,4 +30,15 @@ void eth_init_board(void); static inline void eth_init_board(void) {} #endif +int board_get_enetaddr (const int i,unsigned char *mac_addr); + +#if CONFIG_SUNXI_EMAC +int sunxi_emac_board_read_rom_hwaddr (unsigned char *enetaddr,int id); +#endif + +#if defined(CONFIG_SUNXI_GMAC ) || defined(CONFIG_ETH_DESIGNWARE ) +int dw_board_read_rom_hwaddr (unsigned char *enetaddr,int id); +#endif + +#endif
board/sunxi/board.c +11
-0@@ -21,6 +21,7 @@ #include <asm/arch/gpio.h> #include <asm/arch/mmc.h> #include <asm/arch/spl.h> +#include <asm/arch/sys_proto.h> #include <asm/arch/usb_phy.h> #ifndef CONFIG_ARM64 #include <asm/armv7.h>@@ -564,6 +565,34 @@ int g_dnl_board_usb_cable_connected(void) } #endif +int sunxi_get_board_serial (unsigned int *serial) +{ + int ret; + + ret = sunxi_get_sid(serial); + if (!ret || serial[0]) + return -ENOSYS; + + /* +* The single words 1 - 3 of the SID have quite a few bits
+ * which are the same on many models, so we take a crc32 + * of all 3 words, to get a more unique value. + *
+ * Note we only do this on newer SoCs as we cannot change + * the algorithm on older SoCs since those have been using
+ * fixed mac-addresses/serial based on only using word 3 for a
+ * long time and changing a fixed mac-address/serial with an
+ * u-boot update is not good.
+ */
+#if !defined(CONFIG_MACH_SUN4I) && !defined(CONFIG_MACH_SUN5I) && \
+ !defined(CONFIG_MACH_SUN6I) && !defined(CONFIG_MACH_SUN7I) && \
+ !defined(CONFIG_MACH_SUN8I_A23) && !defined(CONFIG_MACH_SUN8I_A33)
+ serial[3] =crc32(0, (unsigned char *)&serial[1], 12);board/sunxi/board.c +5
-0+#endif + + return 0; +} +#ifdef
CONFIG_SERIAL_TAG
voidget_board_serial(struct tag_serialnr *serialnr){board/sunxi/board.c +0
-0@@ -585,6 +614,54 @@ void get_board_serial(struct tag_serialnr *serialnr) #endifQuoted 13 lines
Quoted 11 lines
board/sunxi/board.c +1
-0/* +* Generate a MAC address based on device index and the serial number.
+ * The first half of the of the first octet holds the eth index.
+ *
+ * In the second octet we forcefully mark the MAC address to a locally
+ * administered MAC address.
+ *
+ */
+intboard_get_enetaddr(const int index, unsigned char *enetaddr)This would be part of a board-specific eth driver.
this is being called now from
sunxi_gmac.candsunxi_emac.cand supplies
these board specific drivers with a mac address based on the serial number of the board. I could move this logic over, but then i'd have to
add it to both eth drivers. By having it in theboard.cfile, we have 2
simple functions in the board-specific eth driver:static int
sunxi_gmac_eth_read_rom_hwaddr(struct udevice *dev){ struct eth_pdata *pdata = dev_get_platdata(dev); return board_get_enetaddr(dev->seq, pdata->enetaddr); }
Quoted 3 lines
So do you propose to dupilicate the code into both board specific drivers, have it named differently or that the shared code live elsewhere?
Replying to myself here,
I just realized, while this bit was not accepted, the overal implementation has changed in the set. So before, I did things wrong :) As Simon explained last time.
To clarify, I now have added the logic to the sunxi gmac and emac board specific drivers. But afaik they share no common code. (like sunxi_common.c in drivers/net)
With that in mind, how we did things up until now, was to have a fallback scenario where we use the SoC serial number to generate a MAC address.
If this is go be done with the board specific driver, we'd need to still however call board specific functions (sunxi_get_board_serial).
The solution I think is still one of the previously mentioned, a sunxi_common.c which does the serial -> MAC conversion according to the previous logic, using sunxi_get_board_serial() (which really is a SoC specific function, rather board) or have (sunxi)_board_get_enetaddr() in the same spot where it is now.
Writing this, I realize the sunxi_common.c approach may not be half bad, even if it only contains a single function for now.
Olliver
Quoted 195 lines
Olliver
Quoted 184 lines
Quoted 184 lines
board/sunxi/board.c +13
-0+{ + uint8_t mac_addr[ARP_HLEN] = { 0x00 }; + unsigned int serial[4]; + int ret; + + if ((index < 0) || !enetaddr) + return -ENOSYS; + + ret = sunxi_get_board_serial(serial); + if (!ret) + return ret; + + /* Ensure the NIC specific bytes of the mac are not all 0*/
+ if ((serial[3] &0xffffff) == 0)
+ serial[3] |=0x800000;board/sunxi/board.c +15
-0+ + mac_addr[0] = (index << 4); + mac_addr[1] = (serial[0] >> 0) & 0xff; + mac_addr[2] = (serial[3] >> 24) & 0xff; + mac_addr[3] = (serial[3] >> 16) & 0xff; + mac_addr[4] = (serial[3] >> 8) & 0xff; + mac_addr[5] = (serial[3] >> 0) & 0xff; + + set_local_ethaddr(mac_addr); + memcpy(enetaddr, mac_addr, ARP_HLEN); + + return 0; +} + +int sunxi_emac_board_read_rom_hwaddr(unsigned char *enetaddr,int id)
board/sunxi/board.c +10
-0+{ + return board_get_enetaddr(id, enetaddr); +} + +int dw_board_read_rom_hwaddr (unsigned char *enetaddr,int id) +{ + return board_get_enetaddr(id, enetaddr); +} + +/* * Check the SPL header for the "sunxi" variant. If found: parse values
* that might have been passed by the loader ("fel" utility), and update
* the environment accordingly.board/sunxi/board.c +0
-3@@ -617,77 +694,10 @@ static void parse_spl_header(const uint32_t spl_addr) setenv_hex("fel_scriptaddr", spl->fel_script_address); } -/* -* Note this function gets called multiple times. -* It must not make any changes to env variables which already exist.
- */board/sunxi/board.c +0
-12-static void setup_environment (const void *fdt) -{ - char serial_string[17] = { 0 }; - unsigned int sid[4]; - uint8_t mac_addr[6]; - char ethaddr[16]; - int i, ret; - - ret = sunxi_get_sid(sid); - if (ret == 0 && sid[0] != 0) { - /* -* The single words 1 - 3 of the SID have quite a few bits
- * which are the same on many models, so we take a crc32
- * of all 3 words, to get a more unique value. - *
- * Note we only do this on newer SoCs as we cannot change
- * the algorithm on older SoCs since those have been using
- * fixed mac-addresses based on only using word 3 for a
- * long time and changing a fixed mac-address with an
- * u-boot update is not good.
- */
-#if !defined(CONFIG_MACH_SUN4I) && !defined(CONFIG_MACH_SUN5I) && \
- !defined(CONFIG_MACH_SUN6I) && !defined(CONFIG_MACH_SUN7I) && \
- !defined(CONFIG_MACH_SUN8I_A23) && !defined(CONFIG_MACH_SUN8I_A33)
- sid[3] =crc32(0, (unsigned char *)&sid[1], 12);board/sunxi/board.c +0
-3-#endif - - /* Ensure the NIC specific bytes of the mac arenot all 0 */
- if ((sid[3] &0xffffff) == 0)
- sid[3] |=0x800000;board/sunxi/board.c +0
-27- - for (i = 0; i < 4; i++) { - sprintf(ethaddr, "ethernet%d", i); - if (!fdt_get_alias(fdt, ethaddr)) - continue; - - if (i == 0) - strcpy(ethaddr, "ethaddr"); - else - sprintf(ethaddr, "eth%daddr", i); - - if (getenv(ethaddr)) - continue; - - /* Non OUI / registered MAC address */ - mac_addr[0] = (i << 4) | 0x02; - mac_addr[1] = (sid[0] >> 0) & 0xff; - mac_addr[2] = (sid[3] >> 24) & 0xff; - mac_addr[3] = (sid[3] >> 16) & 0xff; - mac_addr[4] = (sid[3] >> 8) & 0xff; - mac_addr[5] = (sid[3] >> 0) & 0xff; - - eth_setenv_enetaddr(ethaddr, mac_addr); - } - - if (!getenv("serial#")) { - snprintf(serial_string,
sizeof(serial_string),
- "%08x%08x", sid[0], sid[3]);board/sunxi/board.c +0
-6- - setenv("serial#", serial_string); - } - } -} -int
misc_init_r(void)
{
__maybe_unused int ret;
+ unsigned int serial[4];setenv("fel_booted", NULL);
setenv("fel_scriptaddr", NULL);board/sunxi/board.c +8
-7@@ -697,7 +707,14 @@ int misc_init_r(void) parse_spl_header(SPL_ADDR); } - setup_environment(gd->fdt_blob); + if (sunxi_get_board_serial(serial)) { + char serial_string[17] = { 0 }; + + snprintf(serial_string, sizeof(serial_string), + "%08x%08x", serial[0], serial[3]); + + setenv("serial#", serial_string); + } #ifndef CONFIG_MACH_SUN9I ret = sunxi_usb_phy_probe();@@ -713,12 +730,6 @@ int ft_board_setup(void *blob, bd_t *bd) { int __maybe_unused r; - /* - * Call setup_environment again in case the boot fdt has - * ethernet aliases the u-boot copy does not have. - */ - setup_environment(blob); - #ifdef CONFIG_VIDEO_DT_SIMPLEFB r = sunxi_simplefb_setup(blob); if (r)net/eth_legacy.c +1
-1@@ -10,6 +10,7 @@ #include <command.h> #include <environment.h> #include <net.h> +#include <i2c.h> #include <phy.h> #include <linux/errno.h> #include "eth_internal.h" --2.10.2
Quoted 4 lines
Quoted 4 lines
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot
PATCH 5/6 arm: sunxi: Use board hooks to obtain MAC address
Quoted 155 lines · On Fri, Apr 7, 2017 at 8:57 AM, <[email protected]> wrote:
Quoted 134 lines · Olliver Schinagl
Hey Joe,
Quoted 100 lines · Joe Hershberger
Quoted 98 lines · Olliver Schinagl
Add board hooks allowing to get ethernet addresses in a board specific
manner. Currently this is done by generating a MAC address from the SID and injecting the ethernet device number in the first octet.This usually happens as a fallback, if either the eeprom fails to set a
MAC address or the FDT forces an override.Signed-off-by Olliver Schinagl <[email protected]>--- arch/arm/include/asm/arch-sunxi/sys_proto.h | 11 ++ board/sunxi/board.c | 161 +++++++++++++++------------- net/eth_legacy.c | 1 + 3 files changed, 98 insertions(+), 75 deletions(-)arch/arm/include/asm/arch-sunxi/sys_proto.h +11
-0@@ -30,4 +30,15 @@ void eth_init_board(void);static inline void eth_init_board (void ) {}#endif +int board_get_enetaddr (const int i,unsigned char *mac_addr); + +#if CONFIG_SUNXI_EMAC +int sunxi_emac_board_read_rom_hwaddr (unsigned char *enetaddr,int id); +#endif + +#if defined(CONFIG_SUNXI_GMAC ) || defined(CONFIG_ETH_DESIGNWARE ) +int dw_board_read_rom_hwaddr (unsigned char *enetaddr,int id); +#endif + +#endif
board/sunxi/board.c +11
-0@@ -21,6 +21,7 @@#include <asm/arch/gpio.h> #include <asm/arch/mmc.h> #include <asm/arch/spl.h> +#include <asm/arch/sys_proto.h> #include <asm/arch/usb_phy.h> #ifndef CONFIG_ARM64 #include <asm/armv7.h> @@ -564,6 +565,34 @@ int g_dnl_board_usb_cable_connected(void) }#endif +int sunxi_get_board_serial (unsigned int *serial) +{ +int ret; + + ret =sunxi_get_sid (serial); +if (!ret || serial[0 ]) +return -ENOSYS ; + +/* +* The single words 1 - 3 of the SID have quite a few bits
board/sunxi/board.c +5
-0+* which are the same on many models, so we take a crc32 +* of all 3 words, to get a more unique value. +* +* Note we only do this on newer SoCs as we cannot change +* the algorithm on older SoCs since those have been using
+ * fixed mac-addresses/serial based on only using word 3
for a
+ * long time and changing a fixed mac-address/serial with
anboard/sunxi/board.c +3
-0+* u-boot update is not good. +*/ +#if !defined(CONFIG_MACH_SUN4I ) && !defined(CONFIG_MACH_SUN5I )&& \
+ !defined(CONFIG_MACH_SUN6I) && !defined(CONFIG_MACH_SUN7I)
&& \
+ !defined(CONFIG_MACH_SUN8I_A23) &&
!defined(CONFIG_MACH_SUN8I_A33)board/sunxi/board.c +6
-0+ serial[3 ] =crc32 (0 , (unsigned char *)&serial[1 ],12 ); +#endif + +return 0 ; +} +#ifdef CONFIG_SERIAL_TAG void get_board_serial (struct tag_serialnr *serialnr) {@@ -585,6 +614,54 @@ void get_board_serial(struct tag_serialnr *serialnr)#endif Quoted 13 lines
Quoted 11 lines
board/sunxi/board.c +1
-0/* +* Generate a MAC address based on device index and the serial number.
+ * The first half of the of the first octet holds the eth index.
+ *
+ * In the second octet we forcefully mark the MAC address to a locally
+ * administered MAC address.
+ *
+ */
+intboard_get_enetaddr(const int index, unsigned char *enetaddr)This would be part of a board-specific eth driver.
this is being called now from
sunxi_gmac.candsunxi_emac.cand supplies
these board specific drivers with a mac address based on the serial number of the board. I could move this logic over, but then i'd have to
add it to both eth drivers. By having it in theboard.cfile, we have 2
simple functions in the board-specific eth driver:static int
sunxi_gmac_eth_read_rom_hwaddr(struct udevice *dev){ struct eth_pdata *pdata = dev_get_platdata(dev); return board_get_enetaddr(dev->seq, pdata->enetaddr); }Quoted 3 lines
So do you propose to dupilicate the code into both board specific drivers, have it named differently or that the shared code live elsewhere?
Replying to myself here,
I just realized, while this bit was not accepted, the overal implementation has changed in the set. So before, I did things wrong :) As Simon explained last time.
To clarify, I now have added the logic to the sunxi gmac and emac board specific drivers. But afaik they share no common code. (like
sunxi_common.cindrivers/net)With that in mind, how we did things up until now, was to have a fallback scenario where we use the SoC serial number to generate a MAC address.
If this is go be done with the board specific driver, we'd need to still however call board specific functions (
sunxi_get_board_serial).
Quoted 8 lines
The solution I think is still one of the previously mentioned, a
sunxi_common.cwhich does the serial -> MAC conversion according to the previous logic, usingsunxi_get_board_serial()(which really is a SoC specific function, rather board) or have (sunxi)_board_get_enetaddr() in the same spot where it is now.Writing this, I realize the
sunxi_common.capproach may not be half bad, even if it only contains a single function for now.
Sounds like the common layout has promise. Care to send an RFC for how it would look?
Thanks,
-Joe
PATCH 5/6 arm: sunxi: Use board hooks to obtain MAC address
Hey Joe,
Quoted 160 lines · Joe Hershberger
Quoted 159 lines · On Fri, Apr 7, 2017 at 8:57 AM, <[email protected]> wrote:
Quoted 132 lines · Olliver Schinagl
Hey Joe,
Quoted 100 lines · Joe Hershberger
Quoted 98 lines · Olliver Schinagl
Add board hooks allowing to get ethernet addresses in a board specific
manner. Currently this is done by generating a MAC address from the SID and injecting the ethernet device number in the first octet.This usually happens as a fallback, if either the eeprom fails to set a
MAC address or the FDT forces an override.Signed-off-by Olliver Schinagl <[email protected]>--- arch/arm/include/asm/arch-sunxi/sys_proto.h | 11 ++ board/sunxi/board.c | 161 +++++++++++++++------------- net/eth_legacy.c | 1 + 3 files changed, 98 insertions(+), 75 deletions(-)arch/arm/include/asm/arch-sunxi/sys_proto.h +11
-0@@ -30,4 +30,15 @@ void eth_init_board(void);static inline void eth_init_board (void ) {}#endif +int board_get_enetaddr (const int i,unsigned char *mac_addr); + +#if CONFIG_SUNXI_EMAC +int sunxi_emac_board_read_rom_hwaddr (unsigned char *enetaddr,int id); +#endif + +#if defined(CONFIG_SUNXI_GMAC ) || defined(CONFIG_ETH_DESIGNWARE ) +int dw_board_read_rom_hwaddr (unsigned char *enetaddr,int id); +#endif + +#endifboard/sunxi/board.c +11
-0@@ -21,6 +21,7 @@#include <asm/arch/gpio.h> #include <asm/arch/mmc.h> #include <asm/arch/spl.h> +#include <asm/arch/sys_proto.h> #include <asm/arch/usb_phy.h> #ifndef CONFIG_ARM64 #include <asm/armv7.h> @@ -564,6 +565,34 @@ int g_dnl_board_usb_cable_connected(void) }#endif +int sunxi_get_board_serial (unsigned int *serial) +{ +int ret; + + ret =sunxi_get_sid (serial); +if (!ret || serial[0 ]) +return -ENOSYS ; + +/* +* The single words 1 - 3 of the SID have quite a few bits
board/sunxi/board.c +5
-0+* which are the same on many models, so we take a crc32 +* of all 3 words, to get a more unique value. +* +* Note we only do this on newer SoCs as we cannot change +* the algorithm on older SoCs since those have been using
+ * fixed mac-addresses/serial based on only using word 3
for a
+ * long time and changing a fixed mac-address/serial with
anboard/sunxi/board.c +3
-0+* u-boot update is not good. +*/ +#if !defined(CONFIG_MACH_SUN4I ) && !defined(CONFIG_MACH_SUN5I )&& \
+ !defined(CONFIG_MACH_SUN6I) && !defined(CONFIG_MACH_SUN7I)
&& \
+ !defined(CONFIG_MACH_SUN8I_A23) &&
!defined(CONFIG_MACH_SUN8I_A33)board/sunxi/board.c +6
-0+ serial[3 ] =crc32 (0 , (unsigned char *)&serial[1 ],12 ); +#endif + +return 0 ; +} +#ifdef CONFIG_SERIAL_TAG void get_board_serial (struct tag_serialnr *serialnr) {@@ -585,6 +614,54 @@ void get_board_serial(struct tag_serialnr *serialnr)#endif Quoted 12 lines
Quoted 11 lines
board/sunxi/board.c +1
-0/* +* Generate a MAC address based on device index and the serial number.
+ * The first half of the of the first octet holds the eth index.
+ *
+ * In the second octet we forcefully mark the MAC address to a locally
+ * administered MAC address.
+ *
+ */
+intboard_get_enetaddr(const int index, unsigned char *enetaddr)This would be part of a board-specific eth driver.
this is being called now from
sunxi_gmac.candsunxi_emac.cand supplies
these board specific drivers with a mac address based on the serial number of the board. I could move this logic over, but then i'd have to
add it to both eth drivers. By having it in theboard.cfile, we have 2
simple functions in the board-specific eth driver:static int
sunxi_gmac_eth_read_rom_hwaddr(struct udevice *dev){ struct eth_pdata *pdata = dev_get_platdata(dev); return board_get_enetaddr(dev->seq, pdata->enetaddr); }Quoted 3 lines
So do you propose to dupilicate the code into both board specific drivers, have it named differently or that the shared code live elsewhere?
Replying to myself here,
I just realized, while this bit was not accepted, the overal implementation has changed in the set. So before, I did things wrong :) As Simon explained last time.
To clarify, I now have added the logic to the sunxi gmac and emac board specific drivers. But afaik they share no common code. (like
sunxi_common.cindrivers/net)With that in mind, how we did things up until now, was to have a fallback scenario where we use the SoC serial number to generate a MAC address.
If this is go be done with the board specific driver, we'd need to still however call board specific functions (
sunxi_get_board_serial).The solution I think is still one of the previously mentioned, a
sunxi_common.cwhich does the serial -> MAC conversion according to the previous logic, usingsunxi_get_board_serial()(which really is a SoC specific function, rather board) or have (sunxi)_board_get_enetaddr() in the same spot where it is now.
Quoted 4 lines
Quoted 2 lines
Writing this, I realize the
sunxi_common.capproach may not be half bad, even if it only contains a single function for now.Sounds like the common layout has promise. Care to send an RFC for how it would look?
Not sure if we are on the same page :) but I've sent a patch set which includes the change. Find it on patchwork [0].
We should discuss it there I reccon, but for now, it is a single function for the read_rom_hwaddr hook for sunxi_emac, sunxi_gmac and sun8i_emac. I saw more similar code paths, such as the write_hwaddr, which could move here as well. I think in time with some effort a few more functions can go into this shared file.
The only thing I haven't figured out yet, where I did continue the original thread [1], is how to solve the fdt_fixup scenario.
Olliver
[0] https://patchwork.ozlabs.org/patch/749103/
[1] https://patchwork.ozlabs.org/patch/699288/
Quoted 3 lines
Thanks,
-Joe
Signature · 5 lines
Met vriendelijke groeten, Kind regards, 与亲切的问候 Olliver Schinagl Research & Development Ultimaker B.V. http://www.ultimaker.com
PATCH 6/6 net: sunxi: Enable eeprom on OLinuXino Lime boards
In reply to Olliver SchinaglThis patch enables the I2C EEPROM to be probed for a MAC address on the OLinuXino Lime1 and Lime2 boards. Other boards surely qualify as well but where not tested yet.
--- configs/A10-OLinuXino-Lime_defconfig | 4 ++++ configs/A20-OLinuXino-Lime2_defconfig | 4 ++++ configs/A20-OLinuXino-Lime_defconfig | 4 ++++ configs/A20-OLinuXino_MICRO_defconfig | 4 ++++ 4 files changed, 16 insertions(+)
configs/A10-OLinuXino-Lime_defconfig +4 -0
@@ -13,6 +13,10 @@ CONFIG_SPL=y # CONFIG_CMD_IMLS is not set # CONFIG_CMD_FLASH is not set # CONFIG_CMD_FPGA is not set +CONFIG_NET_ETHADDR_EEPROM=y +CONFIG_NET_ETHADDR_EEPROM_I2C=y +CONFIG_NET_ETHADDR_EEPROM_I2C_BUS=1 +CONFIG_I2C1_ENABLE=y CONFIG_AXP_ALDO3_VOLT=2800 CONFIG_AXP_ALDO4_VOLT=2800 CONFIG_USB_EHCI_HCD=y
configs/A20-OLinuXino-Lime2_defconfig +4 -0
@@ -18,6 +18,10 @@ CONFIG_CMD_USB_MASS_STORAGE=y CONFIG_DFU_RAM=y CONFIG_RTL8211X_PHY_FORCE_MASTER=y CONFIG_ETH_DESIGNWARE=y +CONFIG_NET_ETHADDR_EEPROM=y +CONFIG_NET_ETHADDR_EEPROM_I2C=y +CONFIG_NET_ETHADDR_EEPROM_I2C_BUS=1 +CONFIG_I2C1_ENABLE=y CONFIG_AXP_ALDO3_VOLT=2800 CONFIG_AXP_ALDO4_VOLT=2800 CONFIG_USB_EHCI_HCD=y
configs/A20-OLinuXino-Lime_defconfig +4 -0
@@ -12,6 +12,10 @@ CONFIG_SPL=y # CONFIG_CMD_FLASH is not set # CONFIG_CMD_FPGA is not set CONFIG_ETH_DESIGNWARE=y +CONFIG_NET_ETHADDR_EEPROM=y +CONFIG_NET_ETHADDR_EEPROM_I2C=y +CONFIG_NET_ETHADDR_EEPROM_I2C_BUS=1 +CONFIG_I2C1_ENABLE=y CONFIG_AXP_ALDO3_VOLT=2800 CONFIG_AXP_ALDO4_VOLT=2800 CONFIG_USB_EHCI_HCD=y
configs/A20-OLinuXino_MICRO_defconfig +4 -0
@@ -15,6 +15,10 @@ CONFIG_SPL=y # CONFIG_CMD_FLASH is not set # CONFIG_CMD_FPGA is not set CONFIG_ETH_DESIGNWARE=y +CONFIG_NET_ETHADDR_EEPROM=y +CONFIG_NET_ETHADDR_EEPROM_I2C=y +CONFIG_NET_ETHADDR_EEPROM_I2C_BUS=1 +CONFIG_I2C1_ENABLE=y CONFIG_AXP_ALDO3_VOLT=2800 CONFIG_AXP_ALDO4_VOLT=2800 CONFIG_USB_EHCI_HCD=y
Signature · 1 line
2.10.2
PATCH 6/6 net: sunxi: Enable eeprom on OLinuXino Lime boards
Quoted 3 lines · Olliver Schinagl
This patch enables the I2C EEPROM to be probed for a MAC address on the OLinuXino Lime1 and Lime2 boards. Other boards surely qualify as well but where not tested yet.
typo: where -> were
Quoted 76 lines
Signed-off-by Olliver Schinagl <[email protected]>--- configs/A10-OLinuXino-Lime_defconfig | 4 ++++ configs/A20-OLinuXino-Lime2_defconfig | 4 ++++ configs/A20-OLinuXino-Lime_defconfig | 4 ++++ configs/A20-OLinuXino_MICRO_defconfig | 4 ++++ 4 files changed, 16 insertions(+)configs/A10-OLinuXino-Lime_defconfig +4
-0@@ -13,6 +13,10 @@ CONFIG_SPL=y # CONFIG_CMD_IMLS is not set # CONFIG_CMD_FLASH is not set # CONFIG_CMD_FPGA is not set +CONFIG_NET_ETHADDR_EEPROM=y +CONFIG_NET_ETHADDR_EEPROM_I2C=y +CONFIG_NET_ETHADDR_EEPROM_I2C_BUS=1 +CONFIG_I2C1_ENABLE=y CONFIG_AXP_ALDO3_VOLT=2800 CONFIG_AXP_ALDO4_VOLT=2800 CONFIG_USB_EHCI_HCD=yconfigs/A20-OLinuXino-Lime2_defconfig +4
-0@@ -18,6 +18,10 @@ CONFIG_CMD_USB_MASS_STORAGE=y CONFIG_DFU_RAM=y CONFIG_RTL8211X_PHY_FORCE_MASTER=y CONFIG_ETH_DESIGNWARE=y +CONFIG_NET_ETHADDR_EEPROM=y +CONFIG_NET_ETHADDR_EEPROM_I2C=y +CONFIG_NET_ETHADDR_EEPROM_I2C_BUS=1 +CONFIG_I2C1_ENABLE=y CONFIG_AXP_ALDO3_VOLT=2800 CONFIG_AXP_ALDO4_VOLT=2800 CONFIG_USB_EHCI_HCD=yconfigs/A20-OLinuXino-Lime_defconfig +4
-0@@ -12,6 +12,10 @@ CONFIG_SPL=y # CONFIG_CMD_FLASH is not set # CONFIG_CMD_FPGA is not set CONFIG_ETH_DESIGNWARE=y +CONFIG_NET_ETHADDR_EEPROM=y +CONFIG_NET_ETHADDR_EEPROM_I2C=y +CONFIG_NET_ETHADDR_EEPROM_I2C_BUS=1 +CONFIG_I2C1_ENABLE=y CONFIG_AXP_ALDO3_VOLT=2800 CONFIG_AXP_ALDO4_VOLT=2800 CONFIG_USB_EHCI_HCD=yconfigs/A20-OLinuXino_MICRO_defconfig +4
-1@@ -15,6 +15,10 @@ CONFIG_SPL=y # CONFIG_CMD_FLASH is not set # CONFIG_CMD_FPGA is not set CONFIG_ETH_DESIGNWARE=y +CONFIG_NET_ETHADDR_EEPROM=y +CONFIG_NET_ETHADDR_EEPROM_I2C=y +CONFIG_NET_ETHADDR_EEPROM_I2C_BUS=1 +CONFIG_I2C1_ENABLE=y CONFIG_AXP_ALDO3_VOLT=2800 CONFIG_AXP_ALDO4_VOLT=2800 CONFIG_USB_EHCI_HCD=y --2.10.2
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] net: sunxi: Enable eeprom on OLinuXino Lime boards
In reply to Olliver SchinaglHi oliver at schinagl.nl,
https://patchwork.ozlabs.org/patch/699297/ was applied to u-boot-net.git.
Thanks!
-Joe