How to set a MAC address when using U-Boot with CONFIG_CMD_NET=n

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to set a MAC address when using U-Boot with CONFIG_CMD_NET=n

Jump to solution
6,322 Views
jiriluznicky
Contributor III

Hello,

is there any recommended way, how to set MAC address for FEC on iMX6UL when networking is disabled in U-Boot? We have MAC address burned in fuses. When U-Boot is compiled with networking support ethaddr is set as environment value, and propagated to kernel correctly.

When networking support is disabled, MAC address is not set. We got this error:

fec 2188000.ethernet (unnamed net_device) (uninitialized): Invalid MAC address: 00:00:00:00:00:00

I thought, that MAC address fuses are read by kernel driver, but obviously not. Or is there something missing in dts file?

Edit:

there is a piece of code in fec_main.c in function fec_get_mac, which obviously should do it.

Thanks for any info

Jiri

Labels (1)
1 Solution
3,864 Views
igorpadykov
NXP Employee
NXP Employee
0 Kudos
6 Replies
3,864 Views
igorpadykov
NXP Employee
NXP Employee

Hi Jiri

one can try suggestion provided in sect.43.3.2 Getting a MAC Address

attached Linux Manual

Best regards

igor

-----------------------------------------------------------------------------------------------------------------------

Note: If this post answers your question, please click the Correct Answer button. Thank you!

-----------------------------------------------------------------------------------------------------------------------

0 Kudos
3,864 Views
jiriluznicky
Contributor III

Hi,

the section 45.3.2 Getting a MAC Address in Linux Manual is only described what function fec_get_mac in Ethernet driver do. So, there is nothing more to try. There are four options. Three options which work (kernel cmd line, dts file, MAC set by bootloader) and one which doesn't (OCOTP alias Fuses).

To be more specific. In function fec_get_mac is following code (line 1637):

        /*

         * 3) from flash or fuse (via platform data)

         */

               ...

                if (pdata)

                        iap = (unsigned char *)&pdata->mac;

The question is, who set pdata->mac earlier.

0 Kudos
3,864 Views
igorpadykov
NXP Employee
NXP Employee

one can check linux/..arm/mach-imx/common.c

0 Kudos
3,864 Views
jiriluznicky
Contributor III

Honestly, I would by very surprised (and happy) if someone shows me the exact location when the read of OCOTP_MAC is done in kernel code.

0 Kudos
3,864 Views
jiriluznicky
Contributor III

In linux-4.6.2 to be more specific. Or is it present only in old 3.14 from BSP.

0 Kudos
3,865 Views
igorpadykov
NXP Employee
NXP Employee

linux-4.6.2 is not supported, please try official nxp bsps from i.MX6 product page

http://www.nxp.com/products/microcontrollers-and-processors/arm-processors/i.mx-applications-process...

0 Kudos