diff mbox

igep00x0, beagle and omap3evm: fixing bug at prcm_init

Message ID 1311215103-3048-1-git-send-email-ricardo.salveti@linaro.org
State Accepted
Commit 745d564dc95db61a4488cb98e747b207dbb80621
Headers show

Commit Message

Ricardo Salveti July 21, 2011, 2:25 a.m. UTC
Commit 73eb46434657c8c2c9e7c9146406031fc4d124ce changed get_cpu_rev()
to be a generic function for all omap 3 based boards, to remove
duplicated code. As a side effect, the behavior changed for beagle and
omap3evm when the board is based on 37XX, returning a different value
then CPU3430_ES2, causing a bug at prcm_init.

The fix is already applied for overo, as you can see from commit
24b8b7f41a83540433024854736518876257672c, changing the index calculation
to behave correctly with all board revs. This patch only applies the
same fix for the other omap 3 based boards that could be affected.

BugLink: https://bugs.launchpad.net/ubuntu/+source/x-loader/+bug/813407

Signed-off-by: Ricardo Salveti de Araujo <ricardo.salveti@linaro.org>
---
 board/igep00x0/igep00x0.c             |    2 +-
 board/omap3530beagle/omap3530beagle.c |    2 +-
 board/omap3evm/omap3evm.c             |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

Comments

Enric Balletbo Serra July 21, 2011, 7:32 a.m. UTC | #1
Hi,

2011/7/21 Ricardo Salveti de Araujo <ricardo.salveti@linaro.org>:
> Commit 73eb46434657c8c2c9e7c9146406031fc4d124ce changed get_cpu_rev()
> to be a generic function for all omap 3 based boards, to remove
> duplicated code. As a side effect, the behavior changed for beagle and
> omap3evm when the board is based on 37XX, returning a different value
> then CPU3430_ES2, causing a bug at prcm_init.
>
> The fix is already applied for overo, as you can see from commit
> 24b8b7f41a83540433024854736518876257672c, changing the index calculation
> to behave correctly with all board revs. This patch only applies the
> same fix for the other omap 3 based boards that could be affected.
>
> BugLink: https://bugs.launchpad.net/ubuntu/+source/x-loader/+bug/813407
>
> Signed-off-by: Ricardo Salveti de Araujo <ricardo.salveti@linaro.org>
> ---
>  board/igep00x0/igep00x0.c             |    2 +-
>  board/omap3530beagle/omap3530beagle.c |    2 +-
>  board/omap3evm/omap3evm.c             |    2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/board/igep00x0/igep00x0.c b/board/igep00x0/igep00x0.c
> index 5550741..d880b48 100644
> --- a/board/igep00x0/igep00x0.c
> +++ b/board/igep00x0/igep00x0.c
> @@ -169,7 +169,7 @@ void prcm_init(void)
>         * and sil_index will get the values for that SysClk for the
>         * appropriate silicon rev.
>         */
> -       sil_index = get_cpu_rev() - 1;
> +       sil_index = (get_cpu_rev() == CPU_3XX_ES10) ? 0 : 1;
>
>        /* Unlock MPU DPLL (slows things down, and needed later) */
>        sr32(CM_CLKEN_PLL_MPU, 0, 3, PLL_LOW_POWER_BYPASS);
> diff --git a/board/omap3530beagle/omap3530beagle.c b/board/omap3530beagle/omap3530beagle.c
> index 102c6d9..829a66d 100644
> --- a/board/omap3530beagle/omap3530beagle.c
> +++ b/board/omap3530beagle/omap3530beagle.c
> @@ -439,7 +439,7 @@ void prcm_init(void)
>         * and sil_index will get the values for that SysClk for the
>         * appropriate silicon rev.
>         */
> -       sil_index = get_cpu_rev() - 1;
> +       sil_index = (get_cpu_rev() == CPU_3XX_ES10) ? 0 : 1;
>
>        /* Unlock MPU DPLL (slows things down, and needed later) */
>        sr32(CM_CLKEN_PLL_MPU, 0, 3, PLL_LOW_POWER_BYPASS);
> diff --git a/board/omap3evm/omap3evm.c b/board/omap3evm/omap3evm.c
> index 6048964..0ba5c55 100644
> --- a/board/omap3evm/omap3evm.c
> +++ b/board/omap3evm/omap3evm.c
> @@ -271,7 +271,7 @@ void prcm_init(void)
>         * and sil_index will get the values for that SysClk for the
>         * appropriate silicon rev.
>         */
> -       sil_index = get_cpu_rev() - 1;
> +       sil_index = (get_cpu_rev() == CPU_3XX_ES10) ? 0 : 1;
>
>        /* Unlock MPU DPLL (slows things down, and needed later) */
>        sr32(CM_CLKEN_PLL_MPU, 0, 3, PLL_LOW_POWER_BYPASS);
> --
> 1.7.4.1
>
> --
> --
> To unsubscribe from this group, email: x-loader+unsubscribe@googlegroups.com
> For more options: http://groups.google.com/group/x-loader?hl=en?hl=en
> Home Page: http://gitorious.org/x-loader
>

Good, looks good for me. Have my ack for the IGEP part
Felipe Balbi July 21, 2011, 7:47 a.m. UTC | #2
On Wed, Jul 20, 2011 at 11:25:03PM -0300, Ricardo Salveti de Araujo wrote:
> Commit 73eb46434657c8c2c9e7c9146406031fc4d124ce changed get_cpu_rev()
> to be a generic function for all omap 3 based boards, to remove
> duplicated code. As a side effect, the behavior changed for beagle and
> omap3evm when the board is based on 37XX, returning a different value
> then CPU3430_ES2, causing a bug at prcm_init.
> 
> The fix is already applied for overo, as you can see from commit
> 24b8b7f41a83540433024854736518876257672c, changing the index calculation
> to behave correctly with all board revs. This patch only applies the
> same fix for the other omap 3 based boards that could be affected.
> 
> BugLink: https://bugs.launchpad.net/ubuntu/+source/x-loader/+bug/813407
> 
> Signed-off-by: Ricardo Salveti de Araujo <ricardo.salveti@linaro.org>
> ---
>  board/igep00x0/igep00x0.c             |    2 +-
>  board/omap3530beagle/omap3530beagle.c |    2 +-
>  board/omap3evm/omap3evm.c             |    2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/board/igep00x0/igep00x0.c b/board/igep00x0/igep00x0.c
> index 5550741..d880b48 100644
> --- a/board/igep00x0/igep00x0.c
> +++ b/board/igep00x0/igep00x0.c
> @@ -169,7 +169,7 @@ void prcm_init(void)
>  	 * and sil_index will get the values for that SysClk for the
>  	 * appropriate silicon rev.
>  	 */
> -	sil_index = get_cpu_rev() - 1;
> +	sil_index = (get_cpu_rev() == CPU_3XX_ES10) ? 0 : 1;

the ternary operator is unnecessary. get_cpu_rev() == CPU_3XX_ES10 will
already evaluate to 1 or 0. So you could:

sil_index = !(get_cpu_rev() == CPU_3XX_ES10);
Gadiyar, Anand Aug. 3, 2011, 1:52 p.m. UTC | #3
Ricardo Salveti de Araujo wrote:
> Commit 73eb46434657c8c2c9e7c9146406031fc4d124ce changed get_cpu_rev()
> to be a generic function for all omap 3 based boards, to remove
> duplicated code. As a side effect, the behavior changed for beagle and
> omap3evm when the board is based on 37XX, returning a different value
> then CPU3430_ES2, causing a bug at prcm_init.
> 
> The fix is already applied for overo, as you can see from commit
> 24b8b7f41a83540433024854736518876257672c, changing the index 
> calculation
> to behave correctly with all board revs. This patch only applies the
> same fix for the other omap 3 based boards that could be affected.
> 
> BugLink: 
> https://bugs.launchpad.net/ubuntu/+source/x-loader/+bug/813407
> 
> Signed-off-by: Ricardo Salveti de Araujo <ricardo.salveti@linaro.org>

Thanks!

Applied with Enric's Ack and Felipe's suggested change.

- Anand
diff mbox

Patch

diff --git a/board/igep00x0/igep00x0.c b/board/igep00x0/igep00x0.c
index 5550741..d880b48 100644
--- a/board/igep00x0/igep00x0.c
+++ b/board/igep00x0/igep00x0.c
@@ -169,7 +169,7 @@  void prcm_init(void)
 	 * and sil_index will get the values for that SysClk for the
 	 * appropriate silicon rev.
 	 */
-	sil_index = get_cpu_rev() - 1;
+	sil_index = (get_cpu_rev() == CPU_3XX_ES10) ? 0 : 1;
 
 	/* Unlock MPU DPLL (slows things down, and needed later) */
 	sr32(CM_CLKEN_PLL_MPU, 0, 3, PLL_LOW_POWER_BYPASS);
diff --git a/board/omap3530beagle/omap3530beagle.c b/board/omap3530beagle/omap3530beagle.c
index 102c6d9..829a66d 100644
--- a/board/omap3530beagle/omap3530beagle.c
+++ b/board/omap3530beagle/omap3530beagle.c
@@ -439,7 +439,7 @@  void prcm_init(void)
 	 * and sil_index will get the values for that SysClk for the
 	 * appropriate silicon rev.
 	 */
-	sil_index = get_cpu_rev() - 1;
+	sil_index = (get_cpu_rev() == CPU_3XX_ES10) ? 0 : 1;
 
 	/* Unlock MPU DPLL (slows things down, and needed later) */
 	sr32(CM_CLKEN_PLL_MPU, 0, 3, PLL_LOW_POWER_BYPASS);
diff --git a/board/omap3evm/omap3evm.c b/board/omap3evm/omap3evm.c
index 6048964..0ba5c55 100644
--- a/board/omap3evm/omap3evm.c
+++ b/board/omap3evm/omap3evm.c
@@ -271,7 +271,7 @@  void prcm_init(void)
 	 * and sil_index will get the values for that SysClk for the
 	 * appropriate silicon rev.
 	 */
-	sil_index = get_cpu_rev() - 1;
+	sil_index = (get_cpu_rev() == CPU_3XX_ES10) ? 0 : 1;
 
 	/* Unlock MPU DPLL (slows things down, and needed later) */
 	sr32(CM_CLKEN_PLL_MPU, 0, 3, PLL_LOW_POWER_BYPASS);