From: Wolfgang Denk Date: Thu, 22 Oct 2009 23:30:50 +0200 Subject: [U-Boot] [PATCH] ppc4xx: Initialize magnetic couplers on PLU405 In-Reply-To: <200910222308.14956.matthias.fuchs@esd-electronics.com> References: <200910222308.14956.matthias.fuchs@esd-electronics.com> Message-ID: <20091022213050.34088F3108C@gemini.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 Dear Matthias Fuchs, In message <200910222308.14956.matthias.fuchs@esd-electronics.com> you wrote: > > + u8 *ctrl = (u8*)addr; > + > + /* reset */ > + out_8(ctrl, 0x21); > + > + /* dominant */ > + out_8(ctrl + 6, 0x00); > + out_8(ctrl + 7, 0x14); > + out_8(ctrl + 8, 0xfe); > + out_8(ctrl, 0x20); Please do not acces hardware using a base address plus offsets, please declare and use a proper C struct for this. Also, you want to add some symbolic constants (and comments) for all the magic numbers used here. Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de There are two ways of constructing a software design. One way is to make it so simple that there are obviously no deficiencies and the other is to make it so complicated that there are no obvious defi- ciencies. - Charles Anthony Richard Hoare