setting mac address for i.mx28 board

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

setting mac address for i.mx28 board

3,838 Views
mehmet
Contributor I

Hi all,

I need some help about setting mac address. I don't use uboot. How can I set MAC address of system.

Thanks

Mehmet

Tags (1)
0 Kudos
Reply
10 Replies

2,557 Views
Kirill
Contributor I

You could google about 'ethtool' utility, in sources for gingerbread I am find some matches with it. 

/kernel_imx/net/core/ethtool.c

could not say about it more, because never work with it, but may be it will help you

is it only one way to resolve the problem, maybe you will find alternative. 

0 Kudos
Reply

2,557 Views
Nico
Contributor II

This is a method, ok..

I boot from sdcard...and i save the mac address in the environment of sdcard using "setenv ethaddr <your new mac>".

But if in the same board, i insert a new sdcard..automatically the mac address is different, because like mac address is taken the one present in the new sdcard, instead the mac address must be univocal for a board.

There is a tool under uboot:

U-BOOT >mii

"

Usage:
mii device                       - list available devices
mii device <devname>     - set current device
mii info <addr>                - display MII PHY info
mii read <addr> <reg>      - read MII PHY <addr> register <reg>
mii write <addr> <reg> <data> - write MII PHY <addr> register <reg>
mii dump <addr> <reg>    - pretty-print <addr> <reg> (0-5 only)
Addr and/or reg may be ranges, e.g. 2-7.

"

but i can't use it !!


Kirill Danilenko said:

U-BOOT > setenv ethaddr <your new mac>


0 Kudos
Reply

2,557 Views
Kirill
Contributor I

U-BOOT > setenv ethaddr <your new mac>


0 Kudos
Reply

2,557 Views
Nico
Contributor II

I have to set it when it makes the boot...

Kirill Danilenko said:

0 Kudos
Reply

2,557 Views
Kirill
Contributor I
0 Kudos
Reply

2,557 Views
Nico
Contributor II

I have to set mac address too...any idea?

I can set MAC address only using bit burner where i go to write the otp register HW_OCOTP_CUST0 after changing the first fixed 16bit in mx28_evk.c under uboot sources.

Is it possible to do  the same thing without using bitburner? Maybe in the boot sequence...what about using mii utilities?

Thanks

0 Kudos
Reply

2,557 Views
Nico
Contributor II

I have to set mac address too...any idea?

What about using mii utility ?

0 Kudos
Reply

2,557 Views
JRJ
Contributor I

This is how U-Boot does it.(For eth0 only)

int fec_get_mac_addr(unsigned char *mac)
{
    u32 val;

    /*set this bit to open the OTP banks for reading*/
    REG_WR(REGS_OCOTP_BASE, HW_OCOTP_CTRL_SET,
        BM_OCOTP_CTRL_RD_BANK_OPEN);

    /*wait until OTP contents are readable*/
    while (BM_OCOTP_CTRL_BUSY & REG_RD(REGS_OCOTP_BASE, HW_OCOTP_CTRL))
        udelay(100);

    mac[0] = 0x00;
    mac[1] = 0x04;
    val = REG_RD(REGS_OCOTP_BASE, HW_OCOTP_CUSTn(0));
    mac[2] = (val >> 24) & 0xFF;
    mac[3] = (val >> 16) & 0xFF;
    mac[4] = (val >> 8) & 0xFF;
    mac[5] = (val >> 0) & 0xFF;
    return 0;
}

0 Kudos
Reply

2,557 Views
JRJ
Contributor I
But how does one write the first 2 32bit OCOTP from target code. Some code I can include in my system configuration code executed in production.
0 Kudos
Reply

2,557 Views
BryanJI
Contributor I

The first 2 32bit OCOTP is used to store mac address. You need to read Enthernet part of datasheet and then you know how to set mac address to register.

 

Read uboot code and learn how it set mac address.

0 Kudos
Reply