diff mbox

[U-Boot,[PATCH,v2] pandaboard: 1/1] Modification of Elpida DDR2 RAM for Pandaboard-ES Rev B3

Message ID 1384423612-18697-2-git-send-email-hardik.patel@volansystech.com
State Changes Requested
Delegated to: Tom Rini
Headers show

Commit Message

Hardik Nov. 14, 2013, 10:06 a.m. UTC
From: Hardik Patel <hardik.patel@volansystech.com>

Signed-off-by: Hardik Patel <hardik.patel@volansystech.com>
---
 arch/arm/cpu/armv7/omap4/sdram_elpida.c |    2 +-
 board/ti/panda/panda.c                  |   24 ++++++++++++++++++++++++
 2 files changed, 25 insertions(+), 1 deletion(-)

Comments

Robert Nelson Nov. 14, 2013, 3:29 p.m. UTC | #1
On Thu, Nov 14, 2013 at 4:06 AM, Hardik <hardik.patel@volansystech.com> wrote:
> From: Hardik Patel <hardik.patel@volansystech.com>
>
> Signed-off-by: Hardik Patel <hardik.patel@volansystech.com>
> ---
>  arch/arm/cpu/armv7/omap4/sdram_elpida.c |    2 +-
>  board/ti/panda/panda.c                  |   24 ++++++++++++++++++++++++
>  2 files changed, 25 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm/cpu/armv7/omap4/sdram_elpida.c b/arch/arm/cpu/armv7/omap4/sdram_elpida.c
> index e4c8316..9fbdeea 100644
> --- a/arch/arm/cpu/armv7/omap4/sdram_elpida.c
> +++ b/arch/arm/cpu/armv7/omap4/sdram_elpida.c
> @@ -123,7 +123,7 @@ static void emif_get_reg_dump_sdp(u32 emif_nr, const struct emif_regs **regs)
>                 *regs = &emif_regs_elpida_200_mhz_2cs;
>         else if (omap4_rev == OMAP4430_ES2_3)
>                 *regs = &emif_regs_elpida_400_mhz_1cs;
> -       else if (omap4_rev < OMAP4470_ES1_0)
> +       else if (omap4_rev < OMAP4470_ES1_0 && !is_panda_es_rev_b3())
>                 *regs = &emif_regs_elpida_400_mhz_2cs;
>         else
>                 *regs = &emif_regs_elpida_400_mhz_1cs;
> diff --git a/board/ti/panda/panda.c b/board/ti/panda/panda.c
> index c104024..5a7f80a 100644
> --- a/board/ti/panda/panda.c
> +++ b/board/ti/panda/panda.c
> @@ -122,6 +122,30 @@ int get_board_revision(void)
>         return board_id;
>  }
>
> +/*
> +* Routine: is_panda_es_rev_b3
> +* Description: Detect if we are running on B3 version of ES panda board,
> +*              This can be done by reading the level of GPIO 171
> +*              and checking the processor revisions.
> +*              GPIO171: 1 => Panda ES Rev B3
> +*/
> +u8 is_panda_es_rev_b3(void)
> +{
> +        int processor_rev = omap_revision();
> +        int ret = 0;
> +
> +        if ((processor_rev >= OMAP4460_ES1_0 &&
> +             processor_rev <= OMAP4460_ES1_1)) {
> +
> +                /* Setup the mux for the common board ID pins (gpio 171) */
> +                writew((IEN | M3), (*ctrl)->control_padconf_core_base + UNIPRO_TX0);
> +
> +                /* if processor_rev is panda ES and GPIO171 is 1, it is rev b3 */
> +                ret = gpio_get_value(PANDA_BOARD_ID_2_GPIO);
> +        }
> +        return ret;
> +}
> +
>  /**
>   * @brief misc_init_r - Configure Panda board specific configurations
>   * such as power configurations, ethernet initialization as phase2 of


Nice, this works great on my Panda ES B3.

Tested-by: Robert Nelson <robertcnelson@gmai.com>


U-Boot SPL 2013.10-00339-g712d969 (Nov 14 2013 - 09:21:19)
OMAP4460 ES1.1
SPL: Please implement spl_start_uboot() for your board
SPL: Direct Linux boot not active!
reading u-boot.img
reading u-boot.img


U-Boot 2013.10-00339-g712d969 (Nov 14 2013 - 09:21:19)

CPU  : OMAP4460 ES1.1
Board: OMAP4 Panda
I2C:   ready
DRAM:  1 GiB
MMC:   OMAP SD/MMC: 0
Using default environment

BTW, should be bump the system enviroment board_name, that way it
loads a different kernel *.dtb? (omap4-panda-es-b3.dtb)

As right now it'll load the omap4-panda-es.dtb which currently uses
both cs lines on the emif driver..

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/arm/boot/dts/omap4-panda-common.dtsi#n373

Regards,
Michael Nazzareno Trimarchi Nov. 14, 2013, 3:41 p.m. UTC | #2
Hi

On Thu, Nov 14, 2013 at 11:06 AM, Hardik <hardik.patel@volansystech.com> wrote:
> From: Hardik Patel <hardik.patel@volansystech.com>
>
> Signed-off-by: Hardik Patel <hardik.patel@volansystech.com>
> ---
>  arch/arm/cpu/armv7/omap4/sdram_elpida.c |    2 +-
>  board/ti/panda/panda.c                  |   24 ++++++++++++++++++++++++
>  2 files changed, 25 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm/cpu/armv7/omap4/sdram_elpida.c b/arch/arm/cpu/armv7/omap4/sdram_elpida.c
> index e4c8316..9fbdeea 100644
> --- a/arch/arm/cpu/armv7/omap4/sdram_elpida.c
> +++ b/arch/arm/cpu/armv7/omap4/sdram_elpida.c
> @@ -123,7 +123,7 @@ static void emif_get_reg_dump_sdp(u32 emif_nr, const struct emif_regs **regs)
>                 *regs = &emif_regs_elpida_200_mhz_2cs;
>         else if (omap4_rev == OMAP4430_ES2_3)
>                 *regs = &emif_regs_elpida_400_mhz_1cs;
> -       else if (omap4_rev < OMAP4470_ES1_0)
> +       else if (omap4_rev < OMAP4470_ES1_0 && !is_panda_es_rev_b3())
>                 *regs = &emif_regs_elpida_400_mhz_2cs;
>         else
>                 *regs = &emif_regs_elpida_400_mhz_1cs;
> diff --git a/board/ti/panda/panda.c b/board/ti/panda/panda.c
> index c104024..5a7f80a 100644

No, it's not ok. Sorry but implement in this way it's a no-sense

> +       else if (omap4_rev < OMAP4470_ES1_0 && !is_panda_es_rev_b3()  && !is_cat() &&
                        !is_dog())
>                 *regs = &emif_regs_elpida_400_mhz_2cs;

Michael


> --- a/board/ti/panda/panda.c
> +++ b/board/ti/panda/panda.c
> @@ -122,6 +122,30 @@ int get_board_revision(void)
>         return board_id;
>  }
>
> +/*
> +* Routine: is_panda_es_rev_b3
> +* Description: Detect if we are running on B3 version of ES panda board,
> +*              This can be done by reading the level of GPIO 171
> +*              and checking the processor revisions.
> +*              GPIO171: 1 => Panda ES Rev B3
> +*/
> +u8 is_panda_es_rev_b3(void)
> +{
> +        int processor_rev = omap_revision();
> +        int ret = 0;
> +
> +        if ((processor_rev >= OMAP4460_ES1_0 &&
> +             processor_rev <= OMAP4460_ES1_1)) {
> +
> +                /* Setup the mux for the common board ID pins (gpio 171) */
> +                writew((IEN | M3), (*ctrl)->control_padconf_core_base + UNIPRO_TX0);
> +
> +                /* if processor_rev is panda ES and GPIO171 is 1, it is rev b3 */
> +                ret = gpio_get_value(PANDA_BOARD_ID_2_GPIO);
> +        }
> +        return ret;
> +}
> +
>  /**
>   * @brief misc_init_r - Configure Panda board specific configurations
>   * such as power configurations, ethernet initialization as phase2 of
> --
> 1.7.9.5
>
> _______________________________________________
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
Tom Rini Nov. 14, 2013, 4:19 p.m. UTC | #3
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 11/14/2013 05:06 AM, Hardik wrote:
> From: Hardik Patel <hardik.patel@volansystech.com>
> 
> Signed-off-by: Hardik Patel <hardik.patel@volansystech.com>
> ---
>  arch/arm/cpu/armv7/omap4/sdram_elpida.c |    2 +-
>  board/ti/panda/panda.c                  |   24 ++++++++++++++++++++++++
>  2 files changed, 25 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/cpu/armv7/omap4/sdram_elpida.c b/arch/arm/cpu/armv7/omap4/sdram_elpida.c
> index e4c8316..9fbdeea 100644
> --- a/arch/arm/cpu/armv7/omap4/sdram_elpida.c
> +++ b/arch/arm/cpu/armv7/omap4/sdram_elpida.c
> @@ -123,7 +123,7 @@ static void emif_get_reg_dump_sdp(u32 emif_nr, const struct emif_regs **regs)
>  		*regs = &emif_regs_elpida_200_mhz_2cs;
>  	else if (omap4_rev == OMAP4430_ES2_3)
>  		*regs = &emif_regs_elpida_400_mhz_1cs;
> -	else if (omap4_rev < OMAP4470_ES1_0)
> +	else if (omap4_rev < OMAP4470_ES1_0 && !is_panda_es_rev_b3())
>  		*regs = &emif_regs_elpida_400_mhz_2cs;
>  	else
>  		*regs = &emif_regs_elpida_400_mhz_1cs;
> diff --git a/board/ti/panda/panda.c b/board/ti/panda/panda.c
> index c104024..5a7f80a 100644
> --- a/board/ti/panda/panda.c
> +++ b/board/ti/panda/panda.c
> @@ -122,6 +122,30 @@ int get_board_revision(void)
>  	return board_id;
>  }
>  
> +/*
> +* Routine: is_panda_es_rev_b3
> +* Description: Detect if we are running on B3 version of ES panda board,
> +*              This can be done by reading the level of GPIO 171 
> +*              and checking the processor revisions.
> +*              GPIO171: 1 => Panda ES Rev B3
> +*/
> +u8 is_panda_es_rev_b3(void)
> +{
> +        int processor_rev = omap_revision();
> +        int ret = 0;
> +
> +        if ((processor_rev >= OMAP4460_ES1_0 &&
> +             processor_rev <= OMAP4460_ES1_1)) {
> +
> +                /* Setup the mux for the common board ID pins (gpio 171) */
> +                writew((IEN | M3), (*ctrl)->control_padconf_core_base + UNIPRO_TX0);
> +
> +                /* if processor_rev is panda ES and GPIO171 is 1, it is rev b3 */
> +                ret = gpio_get_value(PANDA_BOARD_ID_2_GPIO);
> +        }
> +        return ret;
> +}
> +
>  /**
>   * @brief misc_init_r - Configure Panda board specific configurations
>   * such as power configurations, ethernet initialization as phase2 of

This isn't right.  What I was saying is that board/ti/panda/panda.c
needs to provide its own emif_get_reg_dump function, which will (as
designed) override the current one from
arch/arm/cpu/armv7/omap4/sdram_elpida.c

- -- 
Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBAgAGBQJShPgfAAoJENk4IS6UOR1WROMP/3lqEirFqwVeXUaq2eyphdnD
AQzrzGE3ARc/gb7PqoAKGcvr7HZXQqa/ueRib/QyCRT53gc9S/nJu/wLN/i3NAVJ
4Y2LOgIkWlPi1k2l1mHvb6SZRVC4ZBFr3MwxoOQCRzMmBCAOwjSzimllT/nA9oSF
7r2/4tsYpidEoXxK8hn8lKpcfLeAda3MRdQwRjnWXfkJD+rBuAE/w0xCy8I5UmJr
+7J25HFacEbdceexAuzn4wFpSjex5o4yMyD6TFShzsG3GP8aktvWzXi94gx2FZhF
r6526qnjRXH7+RefIVlb95u2+/VpGz9Zu69xga2aszvU+kLHV0s2TTV6SVVmf2aG
Rj4JUxHc6wBYSB3tVNP1NJBiSS3WrmEIlmnQqZXmx51GfJKBHPGaljt5ldGMAUtT
/gtTRw0tw5q/Lv2dHy7BByqxTxk+8iko52X/9zl+vqzKuZS9oOS7/8Wu6q6pXeZc
jm8W/dCRCtO8h1j7BZVJTA+LE05MWKiA6P79lWAR08Eh7U2OwvkCq8WsRBtdxk5z
hqqy09OliHnMliNIRzW5LA8UiBmbw4mXIl27HrX8eNJ0PSXuRFCravm50OLph88L
BQDhKETjVy/dguq/L5lC+FgHwI0U6Hoip20Y8qy/m8YywdutKhw5Zk9jxMZFNCOb
KrOq3OJiJE8d4oSe8VnA
=NxpQ
-----END PGP SIGNATURE-----
Michael Nazzareno Trimarchi Nov. 14, 2013, 4:28 p.m. UTC | #4
Hi

On Thu, Nov 14, 2013 at 5:19 PM, Tom Rini <trini@ti.com> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 11/14/2013 05:06 AM, Hardik wrote:
>> From: Hardik Patel <hardik.patel@volansystech.com>
>>
>> Signed-off-by: Hardik Patel <hardik.patel@volansystech.com>
>> ---
>>  arch/arm/cpu/armv7/omap4/sdram_elpida.c |    2 +-
>>  board/ti/panda/panda.c                  |   24 ++++++++++++++++++++++++
>>  2 files changed, 25 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/arm/cpu/armv7/omap4/sdram_elpida.c b/arch/arm/cpu/armv7/omap4/sdram_elpida.c
>> index e4c8316..9fbdeea 100644
>> --- a/arch/arm/cpu/armv7/omap4/sdram_elpida.c
>> +++ b/arch/arm/cpu/armv7/omap4/sdram_elpida.c
>> @@ -123,7 +123,7 @@ static void emif_get_reg_dump_sdp(u32 emif_nr, const struct emif_regs **regs)
>>               *regs = &emif_regs_elpida_200_mhz_2cs;
>>       else if (omap4_rev == OMAP4430_ES2_3)
>>               *regs = &emif_regs_elpida_400_mhz_1cs;
>> -     else if (omap4_rev < OMAP4470_ES1_0)
>> +     else if (omap4_rev < OMAP4470_ES1_0 && !is_panda_es_rev_b3())
>>               *regs = &emif_regs_elpida_400_mhz_2cs;
>>       else
>>               *regs = &emif_regs_elpida_400_mhz_1cs;
>> diff --git a/board/ti/panda/panda.c b/board/ti/panda/panda.c
>> index c104024..5a7f80a 100644
>> --- a/board/ti/panda/panda.c
>> +++ b/board/ti/panda/panda.c
>> @@ -122,6 +122,30 @@ int get_board_revision(void)
>>       return board_id;
>>  }
>>
>> +/*
>> +* Routine: is_panda_es_rev_b3
>> +* Description: Detect if we are running on B3 version of ES panda board,
>> +*              This can be done by reading the level of GPIO 171
>> +*              and checking the processor revisions.
>> +*              GPIO171: 1 => Panda ES Rev B3
>> +*/
>> +u8 is_panda_es_rev_b3(void)
>> +{
>> +        int processor_rev = omap_revision();
>> +        int ret = 0;
>> +
>> +        if ((processor_rev >= OMAP4460_ES1_0 &&
>> +             processor_rev <= OMAP4460_ES1_1)) {
>> +
>> +                /* Setup the mux for the common board ID pins (gpio 171) */
>> +                writew((IEN | M3), (*ctrl)->control_padconf_core_base + UNIPRO_TX0);
>> +
>> +                /* if processor_rev is panda ES and GPIO171 is 1, it is rev b3 */
>> +                ret = gpio_get_value(PANDA_BOARD_ID_2_GPIO);
>> +        }
>> +        return ret;
>> +}
>> +
>>  /**
>>   * @brief misc_init_r - Configure Panda board specific configurations
>>   * such as power configurations, ethernet initialization as phase2 of
>
> This isn't right.  What I was saying is that board/ti/panda/panda.c
> needs to provide its own emif_get_reg_dump function, which will (as
> designed) override the current one from
> arch/arm/cpu/armv7/omap4/sdram_elpida.c
>

Any problem to have visibility of emif_regs array of lpddr?

Michael


> - --
> Tom
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.11 (GNU/Linux)
> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
>
> iQIcBAEBAgAGBQJShPgfAAoJENk4IS6UOR1WROMP/3lqEirFqwVeXUaq2eyphdnD
> AQzrzGE3ARc/gb7PqoAKGcvr7HZXQqa/ueRib/QyCRT53gc9S/nJu/wLN/i3NAVJ
> 4Y2LOgIkWlPi1k2l1mHvb6SZRVC4ZBFr3MwxoOQCRzMmBCAOwjSzimllT/nA9oSF
> 7r2/4tsYpidEoXxK8hn8lKpcfLeAda3MRdQwRjnWXfkJD+rBuAE/w0xCy8I5UmJr
> +7J25HFacEbdceexAuzn4wFpSjex5o4yMyD6TFShzsG3GP8aktvWzXi94gx2FZhF
> r6526qnjRXH7+RefIVlb95u2+/VpGz9Zu69xga2aszvU+kLHV0s2TTV6SVVmf2aG
> Rj4JUxHc6wBYSB3tVNP1NJBiSS3WrmEIlmnQqZXmx51GfJKBHPGaljt5ldGMAUtT
> /gtTRw0tw5q/Lv2dHy7BByqxTxk+8iko52X/9zl+vqzKuZS9oOS7/8Wu6q6pXeZc
> jm8W/dCRCtO8h1j7BZVJTA+LE05MWKiA6P79lWAR08Eh7U2OwvkCq8WsRBtdxk5z
> hqqy09OliHnMliNIRzW5LA8UiBmbw4mXIl27HrX8eNJ0PSXuRFCravm50OLph88L
> BQDhKETjVy/dguq/L5lC+FgHwI0U6Hoip20Y8qy/m8YywdutKhw5Zk9jxMZFNCOb
> KrOq3OJiJE8d4oSe8VnA
> =NxpQ
> -----END PGP SIGNATURE-----
> _______________________________________________
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
Tom Rini Nov. 14, 2013, 4:32 p.m. UTC | #5
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 11/14/2013 11:28 AM, Michael Trimarchi wrote:
> Hi
> 
> On Thu, Nov 14, 2013 at 5:19 PM, Tom Rini <trini@ti.com> wrote:
> On 11/14/2013 05:06 AM, Hardik wrote:
>>>> From: Hardik Patel <hardik.patel@volansystech.com>
>>>>
>>>> Signed-off-by: Hardik Patel <hardik.patel@volansystech.com>
>>>> ---
>>>>  arch/arm/cpu/armv7/omap4/sdram_elpida.c |    2 +-
>>>>  board/ti/panda/panda.c                  |   24 ++++++++++++++++++++++++
>>>>  2 files changed, 25 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/arch/arm/cpu/armv7/omap4/sdram_elpida.c b/arch/arm/cpu/armv7/omap4/sdram_elpida.c
>>>> index e4c8316..9fbdeea 100644
>>>> --- a/arch/arm/cpu/armv7/omap4/sdram_elpida.c
>>>> +++ b/arch/arm/cpu/armv7/omap4/sdram_elpida.c
>>>> @@ -123,7 +123,7 @@ static void emif_get_reg_dump_sdp(u32 emif_nr, const struct emif_regs **regs)
>>>>               *regs = &emif_regs_elpida_200_mhz_2cs;
>>>>       else if (omap4_rev == OMAP4430_ES2_3)
>>>>               *regs = &emif_regs_elpida_400_mhz_1cs;
>>>> -     else if (omap4_rev < OMAP4470_ES1_0)
>>>> +     else if (omap4_rev < OMAP4470_ES1_0 && !is_panda_es_rev_b3())
>>>>               *regs = &emif_regs_elpida_400_mhz_2cs;
>>>>       else
>>>>               *regs = &emif_regs_elpida_400_mhz_1cs;
>>>> diff --git a/board/ti/panda/panda.c b/board/ti/panda/panda.c
>>>> index c104024..5a7f80a 100644
>>>> --- a/board/ti/panda/panda.c
>>>> +++ b/board/ti/panda/panda.c
>>>> @@ -122,6 +122,30 @@ int get_board_revision(void)
>>>>       return board_id;
>>>>  }
>>>>
>>>> +/*
>>>> +* Routine: is_panda_es_rev_b3
>>>> +* Description: Detect if we are running on B3 version of ES panda board,
>>>> +*              This can be done by reading the level of GPIO 171
>>>> +*              and checking the processor revisions.
>>>> +*              GPIO171: 1 => Panda ES Rev B3
>>>> +*/
>>>> +u8 is_panda_es_rev_b3(void)
>>>> +{
>>>> +        int processor_rev = omap_revision();
>>>> +        int ret = 0;
>>>> +
>>>> +        if ((processor_rev >= OMAP4460_ES1_0 &&
>>>> +             processor_rev <= OMAP4460_ES1_1)) {
>>>> +
>>>> +                /* Setup the mux for the common board ID pins (gpio 171) */
>>>> +                writew((IEN | M3), (*ctrl)->control_padconf_core_base + UNIPRO_TX0);
>>>> +
>>>> +                /* if processor_rev is panda ES and GPIO171 is 1, it is rev b3 */
>>>> +                ret = gpio_get_value(PANDA_BOARD_ID_2_GPIO);
>>>> +        }
>>>> +        return ret;
>>>> +}
>>>> +
>>>>  /**
>>>>   * @brief misc_init_r - Configure Panda board specific configurations
>>>>   * such as power configurations, ethernet initialization as phase2 of
> 
> This isn't right.  What I was saying is that board/ti/panda/panda.c
> needs to provide its own emif_get_reg_dump function, which will (as
> designed) override the current one from
> arch/arm/cpu/armv7/omap4/sdram_elpida.c
> 
> 
>> Any problem to have visibility of emif_regs array of lpddr?

Things that need exposing so that we can do what was intended before
should be exposed, in <asm/arch-omap4/sys_proto.h> I think.

- -- 
Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBAgAGBQJShPszAAoJENk4IS6UOR1W2TMP/RzK77vL75h5HYP23RKP/CWx
i7A/xbStKYT8ozh2s1IyHsKohVmnFmIh6lIa4cTYMzrqQBIJxnw9NB1p73qRFPFS
M8Bwx0QS3IU9Wqybk2w1x26Ymm65NWcAQ9SvPh4EBCpdnu1JnJoaceekw1fp55Pb
B+H/44Xr5D57F4R0DAuLqT2Kc6uoMf69X6I/DU7CuxhcceoMAMaFrZq+WrLAqIeY
M5qsCTsyOIQdzV4pheR9gH7F6dbzlA9uee2lshIP0yN5JJmWkZc1CjMR0SsStSpy
RKFJuNOgv32v7CGwvyA/HAk6KdKy5VSWUhHT/+1B3fMzIZhxypOlL90Vbz2Zlh5N
J5E5RNWsQaBJnVaEpo/4wWOTWmq/L5+lQLyJVPUkZFGocHgRBT8gqkcREe/+mSKx
DaxX4mLNlCvooMrNSakPPZHtPHXnVieMAvhdKDDdhLRKHAST+1hZD/ztBD63bwcJ
eSvGBe6SDv/K/mScU9eeNtJzVYs6O1VZm9sqgJBPhgUTN/Mfv7NbZVF3m4rMpkeB
PbQ/eSzxERBxeiInrPh2Ns62oDxCXTodOw5qy+jUQ72WPI/3zMNRHaBbyXTNn9nZ
NAj4XSex3tiQUpJYw21wbshEuCz4/Lo5LBWXeksdg0bfSxWX9jG/mpkOE6NACSyE
7TeL/tTeum0zVByyfhjG
=ZmUi
-----END PGP SIGNATURE-----
Hardik Nov. 14, 2013, 6:43 p.m. UTC | #6
On Thu, Nov 14, 2013 at 10:02 PM, Tom Rini <trini@ti.com> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 11/14/2013 11:28 AM, Michael Trimarchi wrote:
>> Hi
>>
>> On Thu, Nov 14, 2013 at 5:19 PM, Tom Rini <trini@ti.com> wrote:
>> On 11/14/2013 05:06 AM, Hardik wrote:
>>>>> From: Hardik Patel <hardik.patel@volansystech.com>
>>>>>
>>>>> Signed-off-by: Hardik Patel <hardik.patel@volansystech.com>
>>>>> ---
>>>>>  arch/arm/cpu/armv7/omap4/sdram_elpida.c |    2 +-
>>>>>  board/ti/panda/panda.c                  |   24
++++++++++++++++++++++++
>>>>>  2 files changed, 25 insertions(+), 1 deletion(-)
>>>>>
>>>>> diff --git a/arch/arm/cpu/armv7/omap4/sdram_elpida.c
b/arch/arm/cpu/armv7/omap4/sdram_elpida.c
>>>>> index e4c8316..9fbdeea 100644
>>>>> --- a/arch/arm/cpu/armv7/omap4/sdram_elpida.c
>>>>> +++ b/arch/arm/cpu/armv7/omap4/sdram_elpida.c
>>>>> @@ -123,7 +123,7 @@ static void emif_get_reg_dump_sdp(u32 emif_nr,
const struct emif_regs **regs)
>>>>>               *regs = &emif_regs_elpida_200_mhz_2cs;
>>>>>       else if (omap4_rev == OMAP4430_ES2_3)
>>>>>               *regs = &emif_regs_elpida_400_mhz_1cs;
>>>>> -     else if (omap4_rev < OMAP4470_ES1_0)
>>>>> +     else if (omap4_rev < OMAP4470_ES1_0 && !is_panda_es_rev_b3())
>>>>>               *regs = &emif_regs_elpida_400_mhz_2cs;
>>>>>       else
>>>>>               *regs = &emif_regs_elpida_400_mhz_1cs;
>>>>> diff --git a/board/ti/panda/panda.c b/board/ti/panda/panda.c
>>>>> index c104024..5a7f80a 100644
>>>>> --- a/board/ti/panda/panda.c
>>>>> +++ b/board/ti/panda/panda.c
>>>>> @@ -122,6 +122,30 @@ int get_board_revision(void)
>>>>>       return board_id;
>>>>>  }
>>>>>
>>>>> +/*
>>>>> +* Routine: is_panda_es_rev_b3
>>>>> +* Description: Detect if we are running on B3 version of ES panda
board,
>>>>> +*              This can be done by reading the level of GPIO 171
>>>>> +*              and checking the processor revisions.
>>>>> +*              GPIO171: 1 => Panda ES Rev B3
>>>>> +*/
>>>>> +u8 is_panda_es_rev_b3(void)
>>>>> +{
>>>>> +        int processor_rev = omap_revision();
>>>>> +        int ret = 0;
>>>>> +
>>>>> +        if ((processor_rev >= OMAP4460_ES1_0 &&
>>>>> +             processor_rev <= OMAP4460_ES1_1)) {
>>>>> +
>>>>> +                /* Setup the mux for the common board ID pins (gpio
171) */
>>>>> +                writew((IEN | M3),
(*ctrl)->control_padconf_core_base + UNIPRO_TX0);
>>>>> +
>>>>> +                /* if processor_rev is panda ES and GPIO171 is 1, it
is rev b3 */
>>>>> +                ret = gpio_get_value(PANDA_BOARD_ID_2_GPIO);
>>>>> +        }
>>>>> +        return ret;
>>>>> +}
>>>>> +
>>>>>  /**
>>>>>   * @brief misc_init_r - Configure Panda board specific configurations
>>>>>   * such as power configurations, ethernet initialization as phase2 of
>>
>> This isn't right.  What I was saying is that board/ti/panda/panda.c
>> needs to provide its own emif_get_reg_dump function, which will (as
>> designed) override the current one from
>> arch/arm/cpu/armv7/omap4/sdram_elpida.c
>>
>>
>>> Any problem to have visibility of emif_regs array of lpddr?
>
> Things that need exposing so that we can do what was intended before
> should be exposed, in <asm/arch-omap4/sys_proto.h> I think.
>
> - --
> Tom
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.11 (GNU/Linux)
> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
>
> iQIcBAEBAgAGBQJShPszAAoJENk4IS6UOR1W2TMP/RzK77vL75h5HYP23RKP/CWx
> i7A/xbStKYT8ozh2s1IyHsKohVmnFmIh6lIa4cTYMzrqQBIJxnw9NB1p73qRFPFS
> M8Bwx0QS3IU9Wqybk2w1x26Ymm65NWcAQ9SvPh4EBCpdnu1JnJoaceekw1fp55Pb
> B+H/44Xr5D57F4R0DAuLqT2Kc6uoMf69X6I/DU7CuxhcceoMAMaFrZq+WrLAqIeY
> M5qsCTsyOIQdzV4pheR9gH7F6dbzlA9uee2lshIP0yN5JJmWkZc1CjMR0SsStSpy
> RKFJuNOgv32v7CGwvyA/HAk6KdKy5VSWUhHT/+1B3fMzIZhxypOlL90Vbz2Zlh5N
> J5E5RNWsQaBJnVaEpo/4wWOTWmq/L5+lQLyJVPUkZFGocHgRBT8gqkcREe/+mSKx
> DaxX4mLNlCvooMrNSakPPZHtPHXnVieMAvhdKDDdhLRKHAST+1hZD/ztBD63bwcJ
> eSvGBe6SDv/K/mScU9eeNtJzVYs6O1VZm9sqgJBPhgUTN/Mfv7NbZVF3m4rMpkeB
> PbQ/eSzxERBxeiInrPh2Ns62oDxCXTodOw5qy+jUQ72WPI/3zMNRHaBbyXTNn9nZ
> NAj4XSex3tiQUpJYw21wbshEuCz4/Lo5LBWXeksdg0bfSxWX9jG/mpkOE6NACSyE
> 7TeL/tTeum0zVByyfhjG
> =ZmUi
> -----END PGP SIGNATURE-----

Hi Tom, Michel,

Thanks for your feedback on this.

We had implemented override of "emif_get_reg_dump" function in panda.c.
However, we thought checking detection of pandaboard in sdram_elpida.c be
smaller change and it was also under omap4. However, now I realized after
discussing that this may break in case of non panda.c OMAP4 boards.

Based on your feedback,we are going to correct it like below. I am trying
to explain it in brief:

1) We are going to extern emif_regs in <asm/arch-omap4/sys_proto.h>, so
that we can access them in panda.c
#ifdef CONFIG_SYS_EMIF_PRECALCULATED_TIMING_REGS
extern const struct emif_regs emif_regs_elpida_200_mhz_2cs;
extern const struct emif_regs emif_regs_elpida_380_mhz_1cs;
extern const struct emif_regs emif_regs_elpida_400_mhz_1cs;
extern const struct emif_regs emif_regs_elpida_400_mhz_2cs;
#endif

2) "emif_regs_elpida_200_mhz_2cs" & "emif_regs_elpida_380_mhz_1cs" are
defined as "*static* const" in sdram_elpida.c. So, we need to remove
"static" out of them as we are accessing it outside. This will be change in
sdram_elpida.c.

3) In Panda.c, we will write "emif_get_reg_dump" strong function as below
to override one of sdram_elpida.c. We would still need
"is_panda_es_rev_b3()" function to identify rev b3. However we will use it
properly by NOT using NOT OPERATOR( ! is_panda_es_rev_b3() ) .

#ifdef CONFIG_SYS_EMIF_PRECALCULATED_TIMING_REGS
static void emif_get_reg_dump(u32 emif_nr, const struct emif_regs **regs)
{
    u32 omap4_rev = omap_revision();

    /* Same devices and geometry on both EMIFs */
    if (omap4_rev == OMAP4430_ES1_0)
        *regs = &emif_regs_elpida_380_mhz_1cs;
    else if (omap4_rev == OMAP4430_ES2_0)
        *regs = &emif_regs_elpida_200_mhz_2cs;
    else if (omap4_rev == OMAP4430_ES2_3)
        *regs = &emif_regs_elpida_400_mhz_1cs;
    else if (omap4_rev < OMAP4470_ES1_0) {
            if( *is_panda_es_rev_b3()* )
                   *regs = &emif_regs_elpida_400_mhz_1cs;
            else
                *regs = &emif_regs_elpida_400_mhz_2cs;
        }
    else
        *regs = &emif_regs_elpida_400_mhz_1cs;
}
#endif

All changes will be protected by "#ifdef
CONFIG_SYS_EMIF_PRECALCULATED_TIMING_REGS" macro.

Please let me know if above changes makes sense.

Thanks,
Hardik
Michael Nazzareno Trimarchi Nov. 14, 2013, 6:58 p.m. UTC | #7
Hi

On Thu, Nov 14, 2013 at 7:43 PM, Hardik Patel
<hardik.patel@volansystech.com> wrote:
>
>
> On Thu, Nov 14, 2013 at 10:02 PM, Tom Rini <trini@ti.com> wrote:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> On 11/14/2013 11:28 AM, Michael Trimarchi wrote:
>>> Hi
>>>
>>> On Thu, Nov 14, 2013 at 5:19 PM, Tom Rini <trini@ti.com> wrote:
>>> On 11/14/2013 05:06 AM, Hardik wrote:
>>>>>> From: Hardik Patel <hardik.patel@volansystech.com>
>>>>>>
>>>>>> Signed-off-by: Hardik Patel <hardik.patel@volansystech.com>
>>>>>> ---
>>>>>>  arch/arm/cpu/armv7/omap4/sdram_elpida.c |    2 +-
>>>>>>  board/ti/panda/panda.c                  |   24
>>>>>> ++++++++++++++++++++++++
>>>>>>  2 files changed, 25 insertions(+), 1 deletion(-)
>>>>>>
>>>>>> diff --git a/arch/arm/cpu/armv7/omap4/sdram_elpida.c
>>>>>> b/arch/arm/cpu/armv7/omap4/sdram_elpida.c
>>>>>> index e4c8316..9fbdeea 100644
>>>>>> --- a/arch/arm/cpu/armv7/omap4/sdram_elpida.c
>>>>>> +++ b/arch/arm/cpu/armv7/omap4/sdram_elpida.c
>>>>>> @@ -123,7 +123,7 @@ static void emif_get_reg_dump_sdp(u32 emif_nr,
>>>>>> const struct emif_regs **regs)
>>>>>>               *regs = &emif_regs_elpida_200_mhz_2cs;
>>>>>>       else if (omap4_rev == OMAP4430_ES2_3)
>>>>>>               *regs = &emif_regs_elpida_400_mhz_1cs;
>>>>>> -     else if (omap4_rev < OMAP4470_ES1_0)
>>>>>> +     else if (omap4_rev < OMAP4470_ES1_0 && !is_panda_es_rev_b3())
>>>>>>               *regs = &emif_regs_elpida_400_mhz_2cs;
>>>>>>       else
>>>>>>               *regs = &emif_regs_elpida_400_mhz_1cs;
>>>>>> diff --git a/board/ti/panda/panda.c b/board/ti/panda/panda.c
>>>>>> index c104024..5a7f80a 100644
>>>>>> --- a/board/ti/panda/panda.c
>>>>>> +++ b/board/ti/panda/panda.c
>>>>>> @@ -122,6 +122,30 @@ int get_board_revision(void)
>>>>>>       return board_id;
>>>>>>  }
>>>>>>
>>>>>> +/*
>>>>>> +* Routine: is_panda_es_rev_b3
>>>>>> +* Description: Detect if we are running on B3 version of ES panda
>>>>>> board,
>>>>>> +*              This can be done by reading the level of GPIO 171
>>>>>> +*              and checking the processor revisions.
>>>>>> +*              GPIO171: 1 => Panda ES Rev B3
>>>>>> +*/
>>>>>> +u8 is_panda_es_rev_b3(void)
>>>>>> +{
>>>>>> +        int processor_rev = omap_revision();
>>>>>> +        int ret = 0;
>>>>>> +
>>>>>> +        if ((processor_rev >= OMAP4460_ES1_0 &&
>>>>>> +             processor_rev <= OMAP4460_ES1_1)) {
>>>>>> +
>>>>>> +                /* Setup the mux for the common board ID pins (gpio
>>>>>> 171) */
>>>>>> +                writew((IEN | M3), (*ctrl)->control_padconf_core_base
>>>>>> + UNIPRO_TX0);
>>>>>> +
>>>>>> +                /* if processor_rev is panda ES and GPIO171 is 1, it
>>>>>> is rev b3 */
>>>>>> +                ret = gpio_get_value(PANDA_BOARD_ID_2_GPIO);
>>>>>> +        }
>>>>>> +        return ret;
>>>>>> +}
>>>>>> +
>>>>>>  /**
>>>>>>   * @brief misc_init_r - Configure Panda board specific configurations
>>>>>>   * such as power configurations, ethernet initialization as phase2 of
>>>
>>> This isn't right.  What I was saying is that board/ti/panda/panda.c
>>> needs to provide its own emif_get_reg_dump function, which will (as
>>> designed) override the current one from
>>> arch/arm/cpu/armv7/omap4/sdram_elpida.c
>>>
>>>
>>>> Any problem to have visibility of emif_regs array of lpddr?
>>
>> Things that need exposing so that we can do what was intended before
>> should be exposed, in <asm/arch-omap4/sys_proto.h> I think.
>>
>> - --
>> Tom
>> -----BEGIN PGP SIGNATURE-----
>> Version: GnuPG v1.4.11 (GNU/Linux)
>> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
>>
>> iQIcBAEBAgAGBQJShPszAAoJENk4IS6UOR1W2TMP/RzK77vL75h5HYP23RKP/CWx
>> i7A/xbStKYT8ozh2s1IyHsKohVmnFmIh6lIa4cTYMzrqQBIJxnw9NB1p73qRFPFS
>> M8Bwx0QS3IU9Wqybk2w1x26Ymm65NWcAQ9SvPh4EBCpdnu1JnJoaceekw1fp55Pb
>> B+H/44Xr5D57F4R0DAuLqT2Kc6uoMf69X6I/DU7CuxhcceoMAMaFrZq+WrLAqIeY
>> M5qsCTsyOIQdzV4pheR9gH7F6dbzlA9uee2lshIP0yN5JJmWkZc1CjMR0SsStSpy
>> RKFJuNOgv32v7CGwvyA/HAk6KdKy5VSWUhHT/+1B3fMzIZhxypOlL90Vbz2Zlh5N
>> J5E5RNWsQaBJnVaEpo/4wWOTWmq/L5+lQLyJVPUkZFGocHgRBT8gqkcREe/+mSKx
>> DaxX4mLNlCvooMrNSakPPZHtPHXnVieMAvhdKDDdhLRKHAST+1hZD/ztBD63bwcJ
>> eSvGBe6SDv/K/mScU9eeNtJzVYs6O1VZm9sqgJBPhgUTN/Mfv7NbZVF3m4rMpkeB
>> PbQ/eSzxERBxeiInrPh2Ns62oDxCXTodOw5qy+jUQ72WPI/3zMNRHaBbyXTNn9nZ
>> NAj4XSex3tiQUpJYw21wbshEuCz4/Lo5LBWXeksdg0bfSxWX9jG/mpkOE6NACSyE
>> 7TeL/tTeum0zVByyfhjG
>> =ZmUi
>> -----END PGP SIGNATURE-----
>
> Hi Tom, Michel,
>
> Thanks for your feedback on this.
>
> We had implemented override of "emif_get_reg_dump" function in panda.c.
> However, we thought checking detection of pandaboard in sdram_elpida.c be
> smaller change and it was also under omap4. However, now I realized after
> discussing that this may break in case of non panda.c OMAP4 boards.
>
> Based on your feedback,we are going to correct it like below. I am trying to
> explain it in brief:
>
> 1) We are going to extern emif_regs in <asm/arch-omap4/sys_proto.h>, so that
> we can access them in panda.c
> #ifdef CONFIG_SYS_EMIF_PRECALCULATED_TIMING_REGS
> extern const struct emif_regs emif_regs_elpida_200_mhz_2cs;
> extern const struct emif_regs emif_regs_elpida_380_mhz_1cs;
> extern const struct emif_regs emif_regs_elpida_400_mhz_1cs;
> extern const struct emif_regs emif_regs_elpida_400_mhz_2cs;
> #endif
>

I prefer having them in type name and have a function that give back
the pointer of the regs?

> 2) "emif_regs_elpida_200_mhz_2cs" & "emif_regs_elpida_380_mhz_1cs" are
> defined as "static const" in sdram_elpida.c. So, we need to remove "static"
> out of them as we are accessing it outside. This will be change in
> sdram_elpida.c.
>
> 3) In Panda.c, we will write "emif_get_reg_dump" strong function as below to
> override one of sdram_elpida.c. We would still need "is_panda_es_rev_b3()"
> function to identify rev b3. However we will use it properly by NOT using
> NOT OPERATOR( ! is_panda_es_rev_b3() ) .
>
> #ifdef CONFIG_SYS_EMIF_PRECALCULATED_TIMING_REGS
> static void emif_get_reg_dump(u32 emif_nr, const struct emif_regs **regs)
> {
>     u32 omap4_rev = omap_revision();
>
>     /* Same devices and geometry on both EMIFs */
>     if (omap4_rev == OMAP4430_ES1_0)
>         *regs = &emif_regs_elpida_380_mhz_1cs;
>     else if (omap4_rev == OMAP4430_ES2_0)
>
>         *regs = &emif_regs_elpida_200_mhz_2cs;
>     else if (omap4_rev == OMAP4430_ES2_3)
>         *regs = &emif_regs_elpida_400_mhz_1cs;
>     else if (omap4_rev < OMAP4470_ES1_0) {
>             if( is_panda_es_rev_b3() )
>                    *regs = &emif_regs_elpida_400_mhz_1cs;
>             else
>
>                 *regs = &emif_regs_elpida_400_mhz_2cs;
>         }
>     else
>         *regs = &emif_regs_elpida_400_mhz_1cs;
> }

Is it possible to arrange it in a switch?

Michael

> #endif
>
> All changes will be protected by "#ifdef
> CONFIG_SYS_EMIF_PRECALCULATED_TIMING_REGS" macro.
>
> Please let me know if above changes makes sense.
>
> Thanks,
> Hardik
Tom Rini Nov. 14, 2013, 7:02 p.m. UTC | #8
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 11/14/2013 01:43 PM, Hardik Patel wrote:
> 
> 
> On Thu, Nov 14, 2013 at 10:02 PM, Tom Rini <trini@ti.com
> <mailto:trini@ti.com>> wrote:
> On 11/14/2013 11:28 AM, Michael Trimarchi wrote:
>>>> Hi
>>>>
>>>> On Thu, Nov 14, 2013 at 5:19 PM, Tom Rini <trini@ti.com
>> <mailto:trini@ti.com>> wrote:
>>>> On 11/14/2013 05:06 AM, Hardik wrote:
>>>>>>> From: Hardik Patel <hardik.patel@volansystech.com
>> <mailto:hardik.patel@volansystech.com>>
>>>>>>>
>>>>>>> Signed-off-by: Hardik Patel <hardik.patel@volansystech.com
>> <mailto:hardik.patel@volansystech.com>>
>>>>>>> ---
>>>>>>>  arch/arm/cpu/armv7/omap4/sdram_elpida.c |    2 +-
>>>>>>>  board/ti/panda/panda.c                  |   24
>> ++++++++++++++++++++++++
>>>>>>>  2 files changed, 25 insertions(+), 1 deletion(-)
>>>>>>>
>>>>>>> diff --git a/arch/arm/cpu/armv7/omap4/sdram_elpida.c
>> b/arch/arm/cpu/armv7/omap4/sdram_elpida.c
>>>>>>> index e4c8316..9fbdeea 100644
>>>>>>> --- a/arch/arm/cpu/armv7/omap4/sdram_elpida.c
>>>>>>> +++ b/arch/arm/cpu/armv7/omap4/sdram_elpida.c
>>>>>>> @@ -123,7 +123,7 @@ static void emif_get_reg_dump_sdp(u32 emif_nr,
>> const struct emif_regs **regs)
>>>>>>>               *regs = &emif_regs_elpida_200_mhz_2cs;
>>>>>>>       else if (omap4_rev == OMAP4430_ES2_3)
>>>>>>>               *regs = &emif_regs_elpida_400_mhz_1cs;
>>>>>>> -     else if (omap4_rev < OMAP4470_ES1_0)
>>>>>>> +     else if (omap4_rev < OMAP4470_ES1_0 && !is_panda_es_rev_b3())
>>>>>>>               *regs = &emif_regs_elpida_400_mhz_2cs;
>>>>>>>       else
>>>>>>>               *regs = &emif_regs_elpida_400_mhz_1cs;
>>>>>>> diff --git a/board/ti/panda/panda.c b/board/ti/panda/panda.c
>>>>>>> index c104024..5a7f80a 100644
>>>>>>> --- a/board/ti/panda/panda.c
>>>>>>> +++ b/board/ti/panda/panda.c
>>>>>>> @@ -122,6 +122,30 @@ int get_board_revision(void)
>>>>>>>       return board_id;
>>>>>>>  }
>>>>>>>
>>>>>>> +/*
>>>>>>> +* Routine: is_panda_es_rev_b3
>>>>>>> +* Description: Detect if we are running on B3 version of ES panda
>> board,
>>>>>>> +*              This can be done by reading the level of GPIO 171
>>>>>>> +*              and checking the processor revisions.
>>>>>>> +*              GPIO171: 1 => Panda ES Rev B3
>>>>>>> +*/
>>>>>>> +u8 is_panda_es_rev_b3(void)
>>>>>>> +{
>>>>>>> +        int processor_rev = omap_revision();
>>>>>>> +        int ret = 0;
>>>>>>> +
>>>>>>> +        if ((processor_rev >= OMAP4460_ES1_0 &&
>>>>>>> +             processor_rev <= OMAP4460_ES1_1)) {
>>>>>>> +
>>>>>>> +                /* Setup the mux for the common board ID pins
>> (gpio 171) */
>>>>>>> +                writew((IEN | M3),
>> (*ctrl)->control_padconf_core_base + UNIPRO_TX0);
>>>>>>> +
>>>>>>> +                /* if processor_rev is panda ES and GPIO171 is 1,
>> it is rev b3 */
>>>>>>> +                ret = gpio_get_value(PANDA_BOARD_ID_2_GPIO);
>>>>>>> +        }
>>>>>>> +        return ret;
>>>>>>> +}
>>>>>>> +
>>>>>>>  /**
>>>>>>>   * @brief misc_init_r - Configure Panda board specific configurations
>>>>>>>   * such as power configurations, ethernet initialization as phase2 of
>>>>
>>>> This isn't right.  What I was saying is that board/ti/panda/panda.c
>>>> needs to provide its own emif_get_reg_dump function, which will (as
>>>> designed) override the current one from
>>>> arch/arm/cpu/armv7/omap4/sdram_elpida.c
>>>>
>>>>
>>>>> Any problem to have visibility of emif_regs array of lpddr?
> 
> Things that need exposing so that we can do what was intended before
> should be exposed, in <asm/arch-omap4/sys_proto.h> I think.
> 
> 
> Hi Tom, Michel,
> 
> Thanks for your feedback on this.
> 
> We had implemented override of "emif_get_reg_dump" function in panda.c.
> However, we thought checking detection of pandaboard in sdram_elpida.c
> be smaller change and it was also under omap4. However, now I realized
> after discussing that this may break in case of non panda.c OMAP4 boards.
> 
> Based on your feedback,we are going to correct it like below. I am
> trying to explain it in brief:
> 
> 1) We are going to extern emif_regs in <asm/arch-omap4/sys_proto.h>, so
> that we can access them in panda.c
> #ifdef CONFIG_SYS_EMIF_PRECALCULATED_TIMING_REGS
> extern const struct emif_regs emif_regs_elpida_200_mhz_2cs;
> extern const struct emif_regs emif_regs_elpida_380_mhz_1cs;
> extern const struct emif_regs emif_regs_elpida_400_mhz_1cs;
> extern const struct emif_regs emif_regs_elpida_400_mhz_2cs;
> #endif

Minor nit, don't protect externs with #ifdef, that's not required.
Otherwise, sounds like a good plan, thanks.

- -- 
Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBAgAGBQJShR43AAoJENk4IS6UOR1WZH4P+wTVrxdCNuvPVIhos2l7ilwR
yY/QJaPZ2KMlIAHkS56AGe1EYW+LvoVOgrocmYiTq4FgFbeDwEraJ9+Sqaeghg/+
pyTlvbLXjTUuipfe8G8sKFFeTMlRQSDA4xIsDNR05cU3NcC2IvUrYA8IaWG/b4cE
FndWWAPOqnJ3ZQmzDgOtuMwmBm0kkhKJ/5eobzhW/eReS/d6SD9A0GZQ9VOCmulf
/bRIyebcq0/HXpzL9TMaBp5z+48e3TE/ANIL9TnaTQUwcCErGsJ8JcJUQ50hrCVf
mqv/rrH38FSI2B9ZoejcnpadmArHL2wLY+PQlyerS3tmeZ2BUVYE3ex5/9aXg32b
HJxd+9YgHyAtYNym92X08uXmtLv7eKnN65TR89A8pWqwNuhfsBZIPjNh0zCDJaY6
nGupJIU/XKBACJsnSaiQ08FfXjasBTcZe5XZEOxMU6/FOiYs9uqJGy4XoeWFONrN
w4SNryORZmdggAuSD/OPKTeZWECXI2AES0O1gHHZj3dUx5S0009sZBQ2odJDkrD+
ZBMF60y8DNBAgImCyL4SOaOcX8iPwktTc/mj2eQyPSbS8oEjJEuCO5a76MaVrc1m
kkFiuxjmURn3J23z6wByyvaVKw2ElQL4vmFCvaDAP48SKGVdtEJlLDDpgA4xSOjs
TL1otD20nlVXUh/Coz/D
=IXue
-----END PGP SIGNATURE-----
Nishanth Menon Nov. 14, 2013, 7:41 p.m. UTC | #9
On 11/14/2013 04:06 AM, Hardik wrote:
> From: Hardik Patel <hardik.patel@volansystech.com>
Add some details about the change -> commit message is usually
suggested as a good thing to have.

[...]
> diff --git a/board/ti/panda/panda.c b/board/ti/panda/panda.c
> index c104024..5a7f80a 100644
> --- a/board/ti/panda/panda.c
> +++ b/board/ti/panda/panda.c
> @@ -122,6 +122,30 @@ int get_board_revision(void)
>  	return board_id;
>  }
>  
> +/*
> +* Routine: is_panda_es_rev_b3
> +* Description: Detect if we are running on B3 version of ES panda board,
> +*              This can be done by reading the level of GPIO 171 
> +*              and checking the processor revisions.
> +*              GPIO171: 1 => Panda ES Rev B3
> +*/

will be good to see some kernel-doc style comments here..
/**
 * u8 is_panda_es_rev_b3 - Detect if we are running on B3 version of
ES panda
 *
 * This can be done by reading the level of GPIO 171 and checking the
 * processor revisions.  GPIO171: 1 => Panda ES Rev B3 (if using OMAP4460)
 */

u8 is_panda_es_rev_b3(void)


> +u8 is_panda_es_rev_b3(void)
> +{
> +        int processor_rev = omap_revision();
> +        int ret = 0;
> +
> +        if ((processor_rev >= OMAP4460_ES1_0 &&
> +             processor_rev <= OMAP4460_ES1_1)) {
> +
> +                /* Setup the mux for the common board ID pins (gpio 171) */
> +                writew((IEN | M3), (*ctrl)->control_padconf_core_base + UNIPRO_TX0);
Could rather belong to mux code in board/ti/panda/panda_mux_data.h?

> +
> +                /* if processor_rev is panda ES and GPIO171 is 1, it is rev b3 */
> +                ret = gpio_get_value(PANDA_BOARD_ID_2_GPIO);
> +        }
> +        return ret;
> +}
Why cant we do something equivalent to beagle here? see
board/ti/beagle/beagle.c

> +
>  /**
>   * @brief misc_init_r - Configure Panda board specific configurations
>   * such as power configurations, ethernet initialization as phase2 of
>
Tom Rini Nov. 14, 2013, 7:49 p.m. UTC | #10
On Thu, Nov 14, 2013 at 01:41:48PM -0600, Nishanth Menon wrote:

> On 11/14/2013 04:06 AM, Hardik wrote:
> > From: Hardik Patel <hardik.patel@volansystech.com>
> Add some details about the change -> commit message is usually
> suggested as a good thing to have.
> 
> [...]
> > diff --git a/board/ti/panda/panda.c b/board/ti/panda/panda.c
> > index c104024..5a7f80a 100644
> > --- a/board/ti/panda/panda.c
> > +++ b/board/ti/panda/panda.c
> > @@ -122,6 +122,30 @@ int get_board_revision(void)
> >  	return board_id;
> >  }
> >  
> > +/*
> > +* Routine: is_panda_es_rev_b3
> > +* Description: Detect if we are running on B3 version of ES panda board,
> > +*              This can be done by reading the level of GPIO 171 

Using Nishanth's reply since I had this one handy.  There's trailing
whitespace here, which the gerrit test setup makes very visible, but
also shows that checkpatch.pl wasn't run before submission, so please
fix that in v3.  Thanks!
Nishanth Menon Nov. 14, 2013, 8:26 p.m. UTC | #11
On 11/14/2013 01:41 PM, Nishanth Menon wrote:
> On 11/14/2013 04:06 AM, Hardik wrote:
>> From: Hardik Patel <hardik.patel@volansystech.com>
> Add some details about the change -> commit message is usually
> suggested as a good thing to have.
> 

Forgot to mention that you might want a better $subject here. the
current one sucks :(

I suggest some thing like:
ARM: OMAP4+: panda-es: Support Rev B3 Elpida DDR2

Commit message will state something on the lines of:
OMAP4460 PandaBoard-ES samples till Rev B3 used ABC DDR2, however,
starting Rev B3, boards are now manufactured with Elpida XYZ DDR2
....


This kind of helps folks not reading pandaboard mailing lists to
understand the context of the change.
jmgrimaud Nov. 21, 2013, 9:17 a.m. UTC | #12
Hello,
I'm glad to see that solutions arrive to be able to boot on Pandaboard Rev
B3.
On top of this, does anybody could indicate me where I can find the u-boot
repository and how to build it for Pandaboard ?

To summarize, I made 3 tests:

clone git://git.denx.de/u-boot.git
checkout v2013.10 -b tmp
build with omap4_panda_config
>> when I flash MLO and u-boot.bin files in my sdcard, it does not boot at
>> all

clone https://android.googlesource.com/device/ti/panda/bootloader/uboot.git
no specific checkout
build with omap4_panda_config
>> when I flash MLO and u-boot.bin files in my sdcard, it does not boot at
>> all

follow instructions from omappedia, i.e. retrieve, patch and build u-boot
and xloader from git.omapzoom.org
(http://omappedia.org/wiki/4AI.1.7_OMAP4_Icecream_Sandwich_Panda_Notes).
>> when I flash xloader and bootloader files in my sdcard, it works very
>> well on PandaRevB2, but not on Rev B3. Unfortunately, I do not know how
>> to apply the changes described in this subject, as there is not the same
>> files.





--
View this message in context: http://u-boot.10912.n7.nabble.com/PATCH-pandaboard-0-1-Modification-of-Elpida-DDR2-RAM-for-Pandaboard-ES-Rev-B3-tp166135p168096.html
Sent from the U-Boot mailing list archive at Nabble.com.
Hardik Nov. 27, 2013, 3:46 p.m. UTC | #13
From: Hardik Patel <hardik.patel@volansystech.com>

OMAP4460 PandaBoard-ES till Rev B3 used Elpida EDB8064B2PB-xx-F RAM. However, starting Rev B3,
boards are now manufactured with Elpida EDB8164B3PF-xx-F DDR2 RAM.

---
Changes for v3:
   - Implemented strong emif_get_reg_dump function in panda.c to eliminate change in sdram_elpida.c
   - Extern emif_regs_* under sys_proto.h to be used by emif_get_reg_dump function in panda.c
   - Kernel doc style commenting
   - Run checkpatch to remove white spaces
Changes for v2:
   - Use pre-calculated timings for Elpida RAM instead of automatic
   - Added function to detect Pandaboard-ES Rev-B3 using GPIO 171 

Hardik Patel (1):
  Modification of Elpida RAM for Pandaboard-ES Rev-B3

 arch/arm/cpu/armv7/omap4/sdram_elpida.c     |    4 +-
 arch/arm/include/asm/arch-omap4/sys_proto.h |    4 ++
 board/ti/panda/panda.c                      |   60 +++++++++++++++++++++++++++
 3 files changed, 66 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/arch/arm/cpu/armv7/omap4/sdram_elpida.c b/arch/arm/cpu/armv7/omap4/sdram_elpida.c
index e4c8316..9fbdeea 100644
--- a/arch/arm/cpu/armv7/omap4/sdram_elpida.c
+++ b/arch/arm/cpu/armv7/omap4/sdram_elpida.c
@@ -123,7 +123,7 @@  static void emif_get_reg_dump_sdp(u32 emif_nr, const struct emif_regs **regs)
 		*regs = &emif_regs_elpida_200_mhz_2cs;
 	else if (omap4_rev == OMAP4430_ES2_3)
 		*regs = &emif_regs_elpida_400_mhz_1cs;
-	else if (omap4_rev < OMAP4470_ES1_0)
+	else if (omap4_rev < OMAP4470_ES1_0 && !is_panda_es_rev_b3())
 		*regs = &emif_regs_elpida_400_mhz_2cs;
 	else
 		*regs = &emif_regs_elpida_400_mhz_1cs;
diff --git a/board/ti/panda/panda.c b/board/ti/panda/panda.c
index c104024..5a7f80a 100644
--- a/board/ti/panda/panda.c
+++ b/board/ti/panda/panda.c
@@ -122,6 +122,30 @@  int get_board_revision(void)
 	return board_id;
 }
 
+/*
+* Routine: is_panda_es_rev_b3
+* Description: Detect if we are running on B3 version of ES panda board,
+*              This can be done by reading the level of GPIO 171 
+*              and checking the processor revisions.
+*              GPIO171: 1 => Panda ES Rev B3
+*/
+u8 is_panda_es_rev_b3(void)
+{
+        int processor_rev = omap_revision();
+        int ret = 0;
+
+        if ((processor_rev >= OMAP4460_ES1_0 &&
+             processor_rev <= OMAP4460_ES1_1)) {
+
+                /* Setup the mux for the common board ID pins (gpio 171) */
+                writew((IEN | M3), (*ctrl)->control_padconf_core_base + UNIPRO_TX0);
+
+                /* if processor_rev is panda ES and GPIO171 is 1, it is rev b3 */
+                ret = gpio_get_value(PANDA_BOARD_ID_2_GPIO);
+        }
+        return ret;
+}
+
 /**
  * @brief misc_init_r - Configure Panda board specific configurations
  * such as power configurations, ethernet initialization as phase2 of