[PATCH] omap4: pandaboard: ehci fref_clkout per board revision

27 views
Skip to first unread message

Ricardo Salveti de Araujo

unread,
May 21, 2011, 6:16:42 AM5/21/11
to x-lo...@googlegroups.com, pat...@linaro.org, Ricardo Salveti de Araujo
Add support for correctly configuring the fref_clkout depending on the
board revision of the pandaboard. This patch is necessary to make u-boot
work with the smsc usb+ethernet driver.

Based on patch from David Anders <x013...@ti.com> from
omap4_panda_L24.9 branch at gitorious.org/pandaboard x-loader tree.

Signed-off-by: Ricardo Salveti de Araujo <ricardo...@linaro.org>
---
board/omap4430panda/omap4430panda.c | 30 ++++++++++++++++++++++++++----
1 files changed, 26 insertions(+), 4 deletions(-)

diff --git a/board/omap4430panda/omap4430panda.c b/board/omap4430panda/omap4430panda.c
index 962820b..c76ad17 100644
--- a/board/omap4430panda/omap4430panda.c
+++ b/board/omap4430panda/omap4430panda.c
@@ -531,6 +531,7 @@ static void ddr_init(void)
*****************************************/
int board_init(void)
{
+ unsigned int rev = omap_revision();
unsigned int v;

/*
@@ -546,10 +547,31 @@ int board_init(void)
v = __raw_readl(OMAP44XX_GPIO_BASE2 + __GPIO_DATAOUT);
__raw_writel((v & ~(1 << 30)), OMAP44XX_GPIO_BASE2 + __GPIO_DATAOUT);

- /* kill USB PLL */
-
- v = __raw_readl(CM_CLKMODE_DPLL_USB);
- __raw_writel((v & ~7) | 1, CM_CLKMODE_DPLL_USB);
+ if (rev != OMAP4430_ES1_0) {
+ if (__raw_readl(0x4805D138) & (1<<22)) {
+ /* enable software ioreq */
+ sr32(0x4A30a31C, 8, 1, 0x1);
+ /* set for sys_clk (38.4MHz) */
+ sr32(0x4A30a31C, 1, 2, 0x0);
+ /* set divisor to 2 */
+ sr32(0x4A30a31C, 16, 4, 0x1);
+ /* set the clock source to active */
+ sr32(0x4A30a110, 0, 1, 0x1);
+ /* enable clocks */
+ sr32(0x4A30a110, 2, 2, 0x3);
+ } else {
+ /* enable software ioreq */
+ sr32(0x4A30a314, 8, 1, 0x1);
+ /* set for PER_DPLL */
+ sr32(0x4A30a314, 1, 2, 0x2);
+ /* set divisor to 16 */
+ sr32(0x4A30a314, 16, 4, 0xf);
+ /* set the clock source to active */
+ sr32(0x4A30a110, 0, 1, 0x1);
+ /* enable clocks */
+ sr32(0x4A30a110, 2, 2, 0x3);
+ }
+ }

return 0;
}
--
1.7.4.1

Menon, Nishanth

unread,
May 21, 2011, 9:13:22 AM5/21/11
to x-lo...@googlegroups.com, pat...@linaro.org, Ricardo Salveti de Araujo

Thanks for finding it and sending the patch. I like everything about
this patch except for hardcoded 0x4A30a110 -> given that OMAP4460
silicon is also in the near future, debugging code should not involve
looking up register values in TRM. we probably have quiet a few of
them already there, (certain authors have a penchant for hardcoded
values instead of adding a couple of #defines...), but lets try not to
add anymore?

Regards,
Nishanth Menon

Gadiyar, Anand

unread,
May 23, 2011, 7:27:09 AM5/23/11
to x-lo...@googlegroups.com, pat...@linaro.org, Ricardo Salveti de Araujo
Menon, Nishanth wrote:
> On Sat, May 21, 2011 at 05:16, Ricardo Salveti de Araujo <ricardo...@linaro.org> wrote:
> > Add support for correctly configuring the fref_clkout depending on the
> > board revision of the pandaboard. This patch is necessary to make u-boot
> > work with the smsc usb+ethernet driver.
> >
> > Based on patch from David Anders <x013...@ti.com> from
> > omap4_panda_L24.9 branch at gitorious.org/pandaboard x-loader tree.
> >
> > Signed-off-by: Ricardo Salveti de Araujo <ricardo...@linaro.org>
> > ---
> >  board/omap4430panda/omap4430panda.c |   30 ++++++++++++++++++++++++++----
> >  1 files changed, 26 insertions(+), 4 deletions(-)

...

> Thanks for finding it and sending the patch. I like everything about
> this patch except for hardcoded 0x4A30a110 -> given that OMAP4460
> silicon is also in the near future, debugging code should not involve
> looking up register values in TRM. we probably have quiet a few of
> them already there, (certain authors have a penchant for hardcoded
> values instead of adding a couple of #defines...), but lets try not to
> add anymore?


I'll wait for an updated version, then apply it and bump up the x-loader revision.

- Anand

Ricardo Salveti de Araujo

unread,
Jul 11, 2011, 3:39:17 AM7/11/11
to x-lo...@googlegroups.com, pat...@linaro.org, Ricardo Salveti de Araujo
Add support for correctly configuring the fref_clkout depending on the
board revision of the pandaboard. This patch is necessary to make u-boot
work with the smsc usb+ethernet driver.

Tested USB+Eth with TFTP and PXE using linaro u-boot:
http://git.linaro.org/gitweb?p=boot/u-boot-linaro-stable.git;a=summary

Based on patch from David Anders <x013...@ti.com> from
omap4_panda_L24.9 branch at gitorious.org/pandaboard x-loader tree.

Changes since v1:
* Moving the code from s_init instead of adding a new block

Signed-off-by: Ricardo Salveti de Araujo <ricardo...@linaro.org>
---

board/omap4430panda/omap4430panda.c | 58 +++++++++++++++-------------------
1 files changed, 26 insertions(+), 32 deletions(-)

diff --git a/board/omap4430panda/omap4430panda.c b/board/omap4430panda/omap4430panda.c
index 9b4e457..bcee6fe 100644


--- a/board/omap4430panda/omap4430panda.c
+++ b/board/omap4430panda/omap4430panda.c
@@ -531,6 +531,7 @@ static void ddr_init(void)
*****************************************/
int board_init(void)
{
+ unsigned int rev = omap_revision();
unsigned int v;

/*

@@ -546,10 +547,32 @@ int board_init(void)


v = __raw_readl(OMAP44XX_GPIO_BASE2 + __GPIO_DATAOUT);
__raw_writel((v & ~(1 << 30)), OMAP44XX_GPIO_BASE2 + __GPIO_DATAOUT);

- /* kill USB PLL */

+ if (rev == OMAP4430_ES1_0)
+ return 0;



- v = __raw_readl(CM_CLKMODE_DPLL_USB);
- __raw_writel((v & ~7) | 1, CM_CLKMODE_DPLL_USB);

+ if (__raw_readl(OMAP44XX_GPIO_BASE6 + __GPIO_DATAIN) & (1 << 22)) {


+ /* enable software ioreq */

+ sr32(OMAP44XX_SCRM_AUXCLK3, 8, 1, 0x1);


+ /* set for sys_clk (38.4MHz) */

+ sr32(OMAP44XX_SCRM_AUXCLK3, 1, 2, 0x0);


+ /* set divisor to 2 */

+ sr32(OMAP44XX_SCRM_AUXCLK3, 16, 4, 0x1);


+ /* set the clock source to active */

+ sr32(OMAP44XX_SCRM_ALTCLKSRC, 0, 1, 0x1);


+ /* enable clocks */

+ sr32(OMAP44XX_SCRM_ALTCLKSRC, 2, 2, 0x3);


+ } else {
+ /* enable software ioreq */

+ sr32(OMAP44XX_SCRM_AUXCLK1, 8, 1, 0x1);


+ /* set for PER_DPLL */

+ sr32(OMAP44XX_SCRM_AUXCLK1, 1, 2, 0x2);


+ /* set divisor to 16 */

+ sr32(OMAP44XX_SCRM_AUXCLK1, 16, 4, 0xf);


+ /* set the clock source to active */

+ sr32(OMAP44XX_SCRM_ALTCLKSRC, 0, 1, 0x1);


+ /* enable clocks */

+ sr32(OMAP44XX_SCRM_ALTCLKSRC, 2, 2, 0x3);
+ }

return 0;
}
@@ -683,8 +706,6 @@ static int scale_vcores(void)

void s_init(void)
{
- unsigned int rev = omap_revision();
-
/*
* this is required to survive the muxconf in the case the ROM
* started up USB OTG
@@ -707,33 +728,6 @@ void s_init(void)
/* setup_auxcr(get_device_type(), external_boot); */

ddr_init();
-
- if (rev == OMAP4430_ES1_0)
- return;
-
- if (__raw_readl(OMAP44XX_GPIO_BASE6 + __GPIO_DATAIN) & (1 << 22)) {
- /* enable software ioreq */
- sr32(OMAP44XX_SCRM_AUXCLK3, 8, 1, 0x1);
- /* set for sys_clk (38.4MHz) */
- sr32(OMAP44XX_SCRM_AUXCLK3, 1, 2, 0x0);
- /* set divisor to 2 */
- sr32(OMAP44XX_SCRM_AUXCLK3, 16, 4, 0x1);
- /* set the clock source to active */
- sr32(OMAP44XX_SCRM_ALTCLKSRC, 0, 1, 0x1);
- /* enable clocks */
- sr32(OMAP44XX_SCRM_ALTCLKSRC, 2, 2, 0x3);
- } else {
- /* enable software ioreq */
- sr32(OMAP44XX_SCRM_AUXCLK1, 8, 1, 0x1);
- /* set for PER_DPLL */
- sr32(OMAP44XX_SCRM_AUXCLK1, 1, 2, 0x2);
- /* set divisor to 16 */
- sr32(OMAP44XX_SCRM_AUXCLK1, 16, 4, 0xf);
- /* set the clock source to active */
- sr32(OMAP44XX_SCRM_ALTCLKSRC, 0, 1, 0x1);
- /* enable clocks */
- sr32(OMAP44XX_SCRM_ALTCLKSRC, 2, 2, 0x3);
- }
}

/*******************************************************
--
1.7.4.1

Gadiyar, Anand

unread,
Jul 14, 2011, 6:58:26 AM7/14/11
to x-lo...@googlegroups.com, pat...@linaro.org
Ricardo Salveti de Araujo wrote:
> Add support for correctly configuring the fref_clkout depending on the
> board revision of the pandaboard. This patch is necessary to make u-boot
> work with the smsc usb+ethernet driver.
>
> Tested USB+Eth with TFTP and PXE using linaro u-boot:
> http://git.linaro.org/gitweb?p=boot/u-boot-linaro-stable.git;a=summary
>
> Based on patch from David Anders <x013...@ti.com> from
> omap4_panda_L24.9 branch at gitorious.org/pandaboard x-loader tree.
>
> Changes since v1:
> * Moving the code from s_init instead of adding a new block
>
> Signed-off-by: Ricardo Salveti de Araujo <ricardo...@linaro.org>

Applied, thanks!

Reply all
Reply to author
Forward
0 new messages