From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefano Babic Date: Mon, 19 Sep 2011 09:26:39 +0200 Subject: [U-Boot] [PATCH] mx1: add mx1/l support for mxc_i2c In-Reply-To: <201109190857.11742.marek.vasut@gmail.com> References: <20110822205643.18696.97664.stgit@shuttle2.etheralp.ch> <201109190857.11742.marek.vasut@gmail.com> Message-ID: <4E76EEAF.202@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/19/2011 08:57 AM, Marek Vasut wrote: > On Monday, August 22, 2011 10:56:43 PM Eric Jarrige wrote: >> Signed-off-by: Eric Jarrige >> Cc: Stefano Babic >> Cc: Heiko Schocher >> @@ -94,6 +98,8 @@ void i2c_init(int speed, int unused) >> /* start the required I2C clock */ >> writel(readl(&sc_regs->cgr0) | (3 << I2C_CLK_OFFSET), >> &sc_regs->cgr0); >> +#elif defined(CONFIG_IMX) >> + freq = get_HCLK(); >> #else >> freq = mxc_get_clock(MXC_IPG_PERCLK); >> #endif > > Please, no more ifdefs -- can't you actually modify your header files or add > some which would define mxc_get_clock() ? That'd make this way much more clean. In principl, I agree completely with Marek, and we have tried to get rid as much of possible of #ifdef in drivers. I know we have already discussed about the opportunity to fix the whole IMX stuff, and I agreed with you that this processor is obsolete and make no sense to invest a lot of time for it. However, what about to define mxc_get_clock() as simple macro ? Maybe in imx-regs.h, as exceptiion for this processor (normally the imx-regs.h contains only defines and structures for the internal registers) ? Something like: #define mxc_get_clock(a) (get_HCLK()) 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 =====================================================================