From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefano Babic Date: Mon, 24 Sep 2012 13:54:34 +0200 Subject: [U-Boot] I2C on iMX25 In-Reply-To: <214426378.5044408.1348484711663.JavaMail.root@advansee.com> References: <214426378.5044408.1348484711663.JavaMail.root@advansee.com> Message-ID: <506049FA.50300@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 24/09/2012 13:05, Beno?t Th?baudeau wrote: >> But this seems the right solution. The mxc_get_clk() gets as >> parameter >> an enum representing a peripheral or a special clock name, valid for >> a >> SOC. The driver should use the peripheral name. > > Yes and no. The best would be to add a clock abstraction function > imx_get_i2cclk(), like what exists for UART. This is what I did. However, this duplicates the interface because we have a mxc_get_clk() and a function names for each peripheral. We have then a plethora of new functions, one for each peripheral, and all SOCs must implement them to be consistent. I prefer to have only one function, available for all SOCs. Everybody who starts with a new iMX SOC then knows that he must implement mxc_get_clk(), and that is all. >> diff --git a/arch/arm/cpu/armv7/mx5/clock.c >> b/arch/arm/cpu/armv7/mx5/clock.c >> index c67c3cf..8fa737a 100644 >> --- a/arch/arm/cpu/armv7/mx5/clock.c >> +++ b/arch/arm/cpu/armv7/mx5/clock.c >> @@ -482,6 +482,7 @@ unsigned int mxc_get_clock(enum mxc_clock clk) >> case MXC_IPG_CLK: >> return get_ipg_clk(); >> case MXC_IPG_PERCLK: >> + case MXC_I2C_CLK: >> return get_ipg_per_clk(); >> case MXC_UART_CLK: >> return get_uart_clk(); >> >> >> and updating the mxc_i2c driver to follow the same rule. > > That can be a good solution. What do you think about my imx_get_i2cclk()? > My preference goes to not add it. Regards, Stefano -- ===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================