diff mbox

[U-Boot] imx: mx6q_4x_mt41j128.cfg: Setup CCM_CCOSR register

Message ID 1366223610-29127-1-git-send-email-festevam@gmail.com
State Awaiting Upstream
Delegated to: Stefano Babic
Headers show

Commit Message

Fabio Estevam April 17, 2013, 6:33 p.m. UTC
From: Fabio Estevam <fabio.estevam@freescale.com>

Setup CCM_CCOSR register to provide a CKO1 clock frequency of 16.5 MHz.

CKO1 drives sgtl5000 codec clock on mx6qsabrelite and doing this setup in the 
bootloader will allow us to remove a lot of code in arch/arm/mach-imx/mach-imx6q.c 
from the mainline kernel.

mx6q_4x_mt41j128.cfg is also used by mx6qsabresd, and it is safe to use it for
this board as well.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
 board/freescale/imx/ddr/mx6q_4x_mt41j128.cfg |   11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Eric Nelson April 17, 2013, 6:57 p.m. UTC | #1
Thanks Fabio,

On 04/17/2013 11:33 AM, Fabio Estevam wrote:
> From: Fabio Estevam <fabio.estevam@freescale.com>
>
> Setup CCM_CCOSR register to provide a CKO1 clock frequency of 16.5 MHz.
>
> CKO1 drives sgtl5000 codec clock on mx6qsabrelite and doing this setup in the
> bootloader will allow us to remove a lot of code in arch/arm/mach-imx/mach-imx6q.c
> from the mainline kernel.
>

More importantly than eliminating code in the mainline kernel,
enabling the clock will remove squeal after an ungraceful
reboot (watchdog) if hooked up to speakers. I believe you
can see this under Android by issuing a 'reboot' command.

We've been meaning to push a patch for this for a while.

We did it in two parts.

1.) Add routine to enable the clock:
	https://github.com/boundarydevices/u-boot-imx6/commit/7087d645ea1ad476825ea96a1b6f3747f5980028

2.) Enable it on each of SABRE Lite, Nitrogen6X and one of our custom
boards.
	https://github.com/boundarydevices/u-boot-imx6/commit/44b1015f69b52c0a7d7b930b0607af7a724e29bb

> mx6q_4x_mt41j128.cfg is also used by mx6qsabresd, and it is safe to use it for
> this board as well.
>

Does wandboard also use SGTL5000 connected up to CKO1?

> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> ---
>   board/freescale/imx/ddr/mx6q_4x_mt41j128.cfg |   11 +++++++++++
>   1 file changed, 11 insertions(+)
>
> diff --git a/board/freescale/imx/ddr/mx6q_4x_mt41j128.cfg b/board/freescale/imx/ddr/mx6q_4x_mt41j128.cfg
> index f4cae5e..4661775 100644
> --- a/board/freescale/imx/ddr/mx6q_4x_mt41j128.cfg
> +++ b/board/freescale/imx/ddr/mx6q_4x_mt41j128.cfg
> @@ -172,3 +172,14 @@ DATA 4 0x020e0010 0xF00000CF
>   /* set IPU AXI-id0 Qos=0xf(bypass) AXI-id1 Qos=0x7 */
>   DATA 4 0x020e0018 0x007F007F
>   DATA 4 0x020e001c 0x007F007F
> +
> +/*
> + * Setup CCM_CCOSR register as follows:
> + *
> + * cko1_en  = 1	   --> CKO1 enabled
> + * cko1_div = 111  --> divide by 8
> + * cko1_sel = 1011 --> ahb_clk_root
> + *
> + * This sets CKO1 at ahb_clk_root/8 = 132/8 = 16.5 MHz
> + */
> +DATA 4 0x020c4060 0x000000fb
>
Fabio Estevam April 17, 2013, 7:22 p.m. UTC | #2
Hi Eric,

On Wed, Apr 17, 2013 at 3:57 PM, Eric Nelson
<eric.nelson@boundarydevices.com> wrote:

> More importantly than eliminating code in the mainline kernel,
> enabling the clock will remove squeal after an ungraceful
> reboot (watchdog) if hooked up to speakers. I believe you
> can see this under Android by issuing a 'reboot' command.

Ok, great. I was not aware of this problem. Glad to know that it also fixes it.

I can send this same change to nitrogen and wandboard.

> Does wandboard also use SGTL5000 connected up to CKO1?

Yes, it does.

I started to adding audio support to wandboard in the mainline kernel,
then I saw all the code that mx6qsabrelite uses to configure the cko1,
and I preferred not to repeat it again.

It is much simpler to let the bootloader take care of it, as it is a
simple register write.

Regards,

Fabio Estevam
prem kumar April 18, 2013, 5:27 a.m. UTC | #3
Hi all,

I am working on IMX6Q-SabreLite Board.in that board we have sgtl5000
codec.so I would like to add (sgtl5000) codec support in *u-boot level*.There
is no code available in u-boot level for this codec.Can you please help me
How to initialize this audio codec and how to test this one in UBOOT level.

It will be very helpful if you send any u-boot level patch for this
codec(sgtl5000).

Thanks
Prem.


On Thu, Apr 18, 2013 at 12:52 AM, Fabio Estevam <festevam@gmail.com> wrote:

> Hi Eric,
>
> On Wed, Apr 17, 2013 at 3:57 PM, Eric Nelson
> <eric.nelson@boundarydevices.com> wrote:
>
> > More importantly than eliminating code in the mainline kernel,
> > enabling the clock will remove squeal after an ungraceful
> > reboot (watchdog) if hooked up to speakers. I believe you
> > can see this under Android by issuing a 'reboot' command.
>
> Ok, great. I was not aware of this problem. Glad to know that it also
> fixes it.
>
> I can send this same change to nitrogen and wandboard.
>
> > Does wandboard also use SGTL5000 connected up to CKO1?
>
> Yes, it does.
>
> I started to adding audio support to wandboard in the mainline kernel,
> then I saw all the code that mx6qsabrelite uses to configure the cko1,
> and I preferred not to repeat it again.
>
> It is much simpler to let the bootloader take care of it, as it is a
> simple register write.
>
> Regards,
>
> Fabio Estevam
> _______________________________________________
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>
Fabio Estevam April 18, 2013, 3:56 p.m. UTC | #4
On Thu, Apr 18, 2013 at 2:27 AM, prem s <prem441@gmail.com> wrote:
> Hi all,
>
> I am working on IMX6Q-SabreLite Board.in that board we have sgtl5000
> codec.so I would like to add (sgtl5000) codec support in u-boot level.There
> is no code available in u-boot level for this codec.Can you please help me
> How to initialize this audio codec and how to test this one in UBOOT level.
>
> It will be very helpful if you send any u-boot level patch for this
> codec(sgtl5000).

I don't have plans to adding audio support into U-boot for imx.

Maybe you could try to use the OBDS code from Freescale, which
provides standalone code for setting up various peripherals and then
you can use it as a reference for adding audio support in U-boot.

Just curious: what is your requirement in terms of providing the user
with an audio response?

Would booting the kernel fast and providing the audio response in the
kernel meet your goal?

Regards,

Fabio Estevam
Stefano Babic April 25, 2013, 7:15 p.m. UTC | #5
On 17/04/2013 20:33, Fabio Estevam wrote:
> From: Fabio Estevam <fabio.estevam@freescale.com>
> 
> Setup CCM_CCOSR register to provide a CKO1 clock frequency of 16.5 MHz.
> 
> CKO1 drives sgtl5000 codec clock on mx6qsabrelite and doing this setup in the 
> bootloader will allow us to remove a lot of code in arch/arm/mach-imx/mach-imx6q.c 
> from the mainline kernel.
> 
> mx6q_4x_mt41j128.cfg is also used by mx6qsabresd, and it is safe to use it for
> this board as well.
> 
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> ---


Applied to u-boot-imx, thanks.

Best regards,
Stefano Babic
diff mbox

Patch

diff --git a/board/freescale/imx/ddr/mx6q_4x_mt41j128.cfg b/board/freescale/imx/ddr/mx6q_4x_mt41j128.cfg
index f4cae5e..4661775 100644
--- a/board/freescale/imx/ddr/mx6q_4x_mt41j128.cfg
+++ b/board/freescale/imx/ddr/mx6q_4x_mt41j128.cfg
@@ -172,3 +172,14 @@  DATA 4 0x020e0010 0xF00000CF
 /* set IPU AXI-id0 Qos=0xf(bypass) AXI-id1 Qos=0x7 */
 DATA 4 0x020e0018 0x007F007F
 DATA 4 0x020e001c 0x007F007F
+
+/*
+ * Setup CCM_CCOSR register as follows:
+ *
+ * cko1_en  = 1	   --> CKO1 enabled
+ * cko1_div = 111  --> divide by 8
+ * cko1_sel = 1011 --> ahb_clk_root
+ *
+ * This sets CKO1 at ahb_clk_root/8 = 132/8 = 16.5 MHz
+ */
+DATA 4 0x020c4060 0x000000fb