From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefano Babic Date: Thu, 29 Sep 2011 16:16:09 +0200 Subject: [U-Boot] [Resend PATCH V2 (forgot generic.c)] mx31: provide readable WEIM CS accessor In-Reply-To: <4E847A4E.5000602@hale.at> References: <1317214100-1379-2-git-send-email-helmut.raiger@hale.at> <1317299103-18117-1-git-send-email-helmut.raiger@hale.at> <4E8470D8.1030702@denx.de> <4E847A4E.5000602@hale.at> Message-ID: <4E847DA9.6060508@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 09/29/2011 04:01 PM, Helmut Raiger wrote: > On 09/29/2011 03:21 PM, Stefano Babic wrote: >> >>> >>> static u32 mx31_decode_pll(u32 reg, u32 infreq) >>> { >>> @@ -126,6 +128,13 @@ void mx31_set_pad(enum iomux_pins pin, u32 config) >>> >>> } >>> >>> +void mxc_setup_weimcs(int cs, const struct mxc_weimcs *weimcs) >>> +{ >>> + writel(weimcs->upper, WEIM_CSCR_U(cs)); >>> + writel(weimcs->lower, WEIM_CSCR_L(cs)); >>> + writel(weimcs->additional, WEIM_CSCR_A(cs)); >>> +} >> Even if more hidden, the access is always made with base + offset, >> instead of defining a structure. >> > > Do you really thing this is more readable: > > ------------ in imx_regs.h ----------- > > struct mx31_weim_cscr { > u32 upper; > u32 lower; > u32 additional; > u32 reserved; > }; > > struct mx31_weim { > struct mx31_weim_cscr cscr[6]; > }; > > -------------- in generic.c -------------- > > void mxc_setup_weimcs(int cs, const struct mxc_weimcs *weimcs) > { > struct mx31_weim *weim = (struct mx31_weim *) WEIM_BASE; > struct mx31_weim_cscr *cscr = &weim->cscr[cs]; > > writel(weimcs->upper, &cscr->upper); > writel(weimcs->lower, &cscr->lower); > writel(weimcs->additional, &cscr->additional); > } > > > It seems pretty clumsy to me, but for sure a matter of taste. > Helmut Check in the ML and also in code - more as a question of taste, this is a coding style rule in u-boot. 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 =====================================================================