Hi Simon, On Tue, Jun 26, 2018 at 6:18 PM, Simon Glass <s...@chromium.org> wrote: > Hi Joe, > > On 26 June 2018 at 14:19, Joe Hershberger <joe.hershber...@ni.com> wrote: >> Use the dev_ functions to access DT properties. >> >> Also correct the reading of the fake MAC address. The format from the DT >> is u32s, so to accurately read the MAC from the DT, we need to cast each >> value to a u8. >> >> Signed-off-by: Joe Hershberger <joe.hershber...@ni.com> >> --- >> >> drivers/net/sandbox.c | 15 +++++++++++---- >> 1 file changed, 11 insertions(+), 4 deletions(-) >> >> diff --git a/drivers/net/sandbox.c b/drivers/net/sandbox.c >> index b34712bd06..d5a30c05b8 100644 >> --- a/drivers/net/sandbox.c >> +++ b/drivers/net/sandbox.c >> @@ -56,13 +56,20 @@ void sandbox_eth_skip_timeout(void) >> static int sb_eth_start(struct udevice *dev) >> { >> struct eth_sandbox_priv *priv = dev_get_priv(dev); >> + /* The DT integers are 32-bits */ >> + const u32 mac[ARP_HLEN]; >> >> debug("eth_sandbox: Start\n"); >> >> - fdtdec_get_byte_array(gd->fdt_blob, dev_of_offset(dev), >> - "fake-host-hwaddr", priv->fake_host_hwaddr, >> - ARP_HLEN); >> + if (dev_read_u32_array(dev, "fake-host-hwaddr", mac, ARP_HLEN)) { >> + printf("'fake-host-hwaddr' is missing from the DT\n"); >> + return -EINVAL; >> + } > > This is not equivalent - I think you need a dev_read_u8_array() or similar.
Yes, I know it's not equivalent... I noted that in the commit log. This is fixing a bug too. > >> + for (int i = 0; i < ARP_HLEN; i++) >> + priv->fake_host_hwaddr[i] = (uint8_t)mac[i]; >> + >> priv->recv_packet_buffer = net_rx_packets[0]; >> + >> return 0; >> } >> >> @@ -204,7 +211,7 @@ static int sb_eth_ofdata_to_platdata(struct udevice *dev) >> { >> struct eth_pdata *pdata = dev_get_platdata(dev); >> >> - pdata->iobase = devfdt_get_addr(dev); >> + pdata->iobase = dev_read_addr(dev); >> return 0; >> } >> >> -- >> 2.11.0 >> > > Regards, > Simon > _______________________________________________ > U-Boot mailing list > U-Boot@lists.denx.de > https://lists.denx.de/listinfo/u-boot _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot