From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefano Babic Date: Tue, 16 Nov 2010 10:34:44 +0100 Subject: [U-Boot] [PATCH v2 1/1] imx: Get fec mac address from fuse In-Reply-To: References: <1289705187-11350-1-git-send-email-r64343@freescale.com> <4CE0155D.8090800@denx.de> <20101116065304.9D24214EA7E@gemini.denx.de> Message-ID: <4CE25034.4090403@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 11/16/2010 08:16 AM, Jason Liu wrote: >>> struct iim_regs { >>> u32 stat; >>> u32 statm; >>> u32 err; >>> u32 emask; >>> u32 fctl; >>> u32 ua; >>> u32 la; >>> u32 sdat; >>> u32 prev; >>> u32 srev; >>> u32 preg_p; >>> u32 scs0; >>> u32 scs1; >>> u32 scs2; >>> u32 scs3; >>> u32 res0[0x1f1]; >>> u32 iim_bank_area0_1[9]; >>> u32 mac_addr[6]; >>> u32 iim_bank_area0_2[0x11]; >>> u32 res1[0xe0]; >>> u32 iim_bank_area1[0x20]; >>> u32 res2[0xe0]; >>> u32 iim_bank_area2[0x20]; >>> u32 res3[0xe0]; >>> u32 iim_bank_area3[0x20]; >>> u32 res4[0xe0]; >>> }; >> >> This struct is supposed to describe some register layout defined by >> the hardware - but does the hardware know anything about teh special >> meaning "MAC address" of this specific field, or is this an >> interpretation that we just define as we like? The MAC address is stored at a specific address, that is different in each i.MX implementation. There are a lot of fields the hardware is aware of. > > This is defined according to the IC spec and it should be hw layout. > We can read such kind of fuse just like read register. But currently, uboot > require that all the register array should be included into one > structure and not > use the *(offset + base_addr) method, this is also stefano suggestion. But for > fuse support, there are many fuses but we only use FEC_MAC fuse > currently, this is why > I ask how to handle it better in uboot. > > Stefano, what's your comments? I would like to propose a structure to better clarify the internal layout. Let me explain and check if this can be suitable for you. We could use a union to define the different layouts for the fuse banks, such as (the example is for the i.MX51): typedef union fuse_bank { struct { u32 fuse_lock; u32 osc_jtag; u32 reserved0; u32 bt ..... u32 mac_addr[6]; .... u32 reserved_filled[..]; /* to fill the 0x80-0xFF*/ }; /* Now the layout for the other fuse banks */ struct { .... }; /* * If we do not want to set now the layout, we can distinguish * only between real register and reserved addresses * as you already did */ struct { u32 fuse_regs[0x20]; u32 reserved[0xe0]; } } And in your structure you can have something like this: .... u32 scs3; u32 res0[0x1f1]; fuse_bank fuses[4]; } You do not need to set the layout for the fuse banks 1-3, if you do not want, but the structure is prepared if someone else will add functions to manage the fuses. What do you think about it ? Best regards, Stefano Babic -- ===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de =====================================================================