From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?utf-8?Q?Beno=C3=AEt_Th=C3=A9baudeau?= Date: Mon, 20 Aug 2012 14:27:21 +0200 (CEST) Subject: [U-Boot] [PATCH 6/7] mx35: Fix eSDHC clocks In-Reply-To: <50322881.9050408@denx.de> Message-ID: <227325533.2583480.1345465641753.JavaMail.root@advansee.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Stefano, > On 14/08/2012 22:33, Beno?t Th?baudeau wrote: > > Each eSDHC instance has a dedicated clock. > > > > Signed-off-by: Beno?t Th?baudeau > > Cc: Stefano Babic > > --- > > Hi Beno?t, > > > .../arch/arm/cpu/arm1136/mx35/generic.c | 14 > > ++++++++++++-- > > .../arch/arm/include/asm/arch-mx35/clock.h | 4 +++- > > 2 files changed, 15 insertions(+), 3 deletions(-) > > > > diff --git u-boot-4d3c95f.orig/arch/arm/cpu/arm1136/mx35/generic.c > > u-boot-4d3c95f/arch/arm/cpu/arm1136/mx35/generic.c > > index 4af052c..15a0098 100644 > > --- u-boot-4d3c95f.orig/arch/arm/cpu/arm1136/mx35/generic.c > > +++ u-boot-4d3c95f/arch/arm/cpu/arm1136/mx35/generic.c > > @@ -368,8 +368,12 @@ unsigned int mxc_get_clock(enum mxc_clock clk) > > return get_ipg_per_clk(); > > case MXC_UART_CLK: > > return imx_get_uartclk(); > > - case MXC_ESDHC_CLK: > > + case MXC_ESDHC1_CLK: > > return mxc_get_peri_clock(ESDHC1_CLK); > > + case MXC_ESDHC2_CLK: > > + return mxc_get_peri_clock(ESDHC2_CLK); > > + case MXC_ESDHC3_CLK: > > + return mxc_get_peri_clock(ESDHC3_CLK); > > case MXC_USB_CLK: > > return mxc_get_main_clock(USB_CLK); > > case MXC_FEC_CLK: > > Your change let understand that we can have different clocks among > the > ESDHC controllers. Indeed. > One thing is not clear to me is that the MX35 have > two ESDHC controllers, and you define here a thitd one. Where is it ? No, there are 3. See the reference manual. It's referenced in the memory map, in the interrupts, in the pin multiplexing and in the clocks. > Even if the two controllers can have different clocks, this is not > supported by the driver. In fact, in drivers/mmc/fsl_esdhc.c: > > int sdhc_clk = gd->sdhc_clk; > > The driver uses always the same clock, stored in the global > structure. > Before extending the code as in this patch, the driver should be > modified to handle separate clocks. Currently the driver supports > multiple controller, but they share the same clock or at least the > same > frequency. Indeed, I had seen that. I didn't know what to decide as to the driver clocks, so I made this change to select the correct clock if a single clock or frequency is used. If several clock frequencies are to be supported at once, what kind of API would you like? gd->sdhc_clk could be changed to an array, then the corresponding index could be passed to the init function through the fsl_esdhc_cfg struct. Best regards, Beno?t