Skip to contentSkip to conversation

Beagleboard rev C memory timings & suspend/resume

RFC PATCH In review Jean Pihet 5 participants 32 messages Apr 29, 2009 – Jun 9, 2009

Subsystems (4)
lore
Share & tools
lore

Jean Pihet

author
#0 lore raw

Hi,

The suspend/resume on Beagleboard has some problem due to bad memory timings. Suspending for more than 5 to 10 seconds shows memory corruption.

The new chips on rev Cx boards are using 2 DDR chip selects and it looks like the 2nd memory part is not correctly put into self refresh. As an experimentation I tried the same kernel with 'mem=128M' and it resumes correctly after 1 min in suspend.

I could not find the latest DDR detailed specs from Micron. The part number is MT29C2G48MAKLCJI-6 IT. Are those available? Is this part identical to 2 1Gb parts?

Now for the code in the kernel, there are some changes needed to support 2 CS'es:
- the SDRC parameters need to be updated for the new memory part
- the SDRC parameters need to include the ACTIM_CTRL_A_0, ACTIM_CTRL_A_1, ACTIM_CTRL_B_0, ACTIM_CTRL_B_1, RFR_CTRL_0 and RFR_CTRL_1 registers. Since the parameters for the 2nd CS are the same, this can be avoided by writing the same values to the 2 sets of registers
- is there a need to differentiate between 1Gb and 2Gb chips, or can we just write the same params for both CS'es even if only one is being used?
- the 'configure_sdrc' function in arch/arm/mach-omap2/sram34xx.S needs to program the 2 sets of registers. Here is a patch excerpt below. This patch only does not help the suspend/resume though.

Any idea or suggestion?

Regards,
Jean

---

arch/arm/mach-omap2/sram34xx.S +23 -6
index 487fa86..6d5843a 100644
@@ -175,15 +175,24 @@ wait_dll_unlock:
        bne     wait_dll_unlock
        bx      lr
 configure_sdrc:
-       ldr     r11, omap3_sdrc_rfr_ctrl
+       ldr     r11, omap3_sdrc_rfr_ctrl_0
        str     r0, [r11]
-       ldr     r11, omap3_sdrc_actim_ctrla
+       ldr     r11, omap3_sdrc_rfr_ctrl_1
+       str     r0, [r11]
+       ldr     r11, omap3_sdrc_actim_ctrla_0
+       str     r1, [r11]
+       ldr     r11, omap3_sdrc_actim_ctrla_1
        str     r1, [r11]
-       ldr     r11, omap3_sdrc_actim_ctrlb
+       ldr     r11, omap3_sdrc_actim_ctrlb_0
+       str     r2, [r11]
+       ldr     r11, omap3_sdrc_actim_ctrlb_1
        str     r2, [r11]
        ldr     r11, omap3_sdrc_mr_0
        str     r6, [r11]
        ldr     r6, [r11]               @ posted-write barrier for SDRC
+       ldr     r11, omap3_sdrc_mr_1
+       str     r6, [r11]
+       ldr     r6, [r11]               @ posted-write barrier for SDRC
        bx      lr
 
 omap3_sdrc_power:
@@ -194,14 +203,22 @@ omap3_cm_idlest1_core:
        .word OMAP34XX_CM_REGADDR(CORE_MOD, CM_IDLEST)
 omap3_cm_iclken1_core:
        .word OMAP34XX_CM_REGADDR(CORE_MOD, CM_ICLKEN1)
-omap3_sdrc_rfr_ctrl:
+omap3_sdrc_rfr_ctrl_0:
        .word OMAP34XX_SDRC_REGADDR(SDRC_RFR_CTRL_0)
-omap3_sdrc_actim_ctrla:
+omap3_sdrc_rfr_ctrl_1:
+       .word OMAP34XX_SDRC_REGADDR(SDRC_RFR_CTRL_1)
+omap3_sdrc_actim_ctrla_0:
        .word OMAP34XX_SDRC_REGADDR(SDRC_ACTIM_CTRL_A_0)
-omap3_sdrc_actim_ctrlb:
+omap3_sdrc_actim_ctrla_1:
+       .word OMAP34XX_SDRC_REGADDR(SDRC_ACTIM_CTRL_A_1)
+omap3_sdrc_actim_ctrlb_0:
        .word OMAP34XX_SDRC_REGADDR(SDRC_ACTIM_CTRL_B_0)
+omap3_sdrc_actim_ctrlb_1:
+       .word OMAP34XX_SDRC_REGADDR(SDRC_ACTIM_CTRL_B_1)
 omap3_sdrc_mr_0:
        .word OMAP34XX_SDRC_REGADDR(SDRC_MR_0)
+omap3_sdrc_mr_1:
+       .word OMAP34XX_SDRC_REGADDR(SDRC_MR_1)
 omap3_sdrc_dlla_status:
        .word OMAP34XX_SDRC_REGADDR(SDRC_DLLA_STATUS)
 omap3_sdrc_dlla_ctrl:
maintainer
#1 lore raw

Hello Jean,

sorry about the delay,

Quoted 7 lines · Jean Pihet

The suspend/resume on Beagleboard has some problem due to bad memory timings. Suspending for more than 5 to 10 seconds shows memory corruption.

The new chips on rev Cx boards are using 2 DDR chip selects and it looks like the 2nd memory part is not correctly put into self refresh. As an experimentation I tried the same kernel with 'mem=128M' and it resumes correctly after 1 min in suspend.

Nice work, this seems likely to be the cause.

Quoted 3 lines

I could not find the latest DDR detailed specs from Micron. The part number is MT29C2G48MAKLCJI-6 IT. Are those available? Is this part identical to 2 1Gb parts?

The combined part's web page is:

http://www.micron.com/products/partdetail?part=MT29C2G48MAKLCJI-6%20IT

The SDRAM datasheet is the same that is used for all the other Micron parts that we've run across so far:

http://download.micron.com/pdf/datasheets/dram/mobile/1gb_ddr_mobile_sdram_t48m.pdf

Quoted 13 lines

Now for the code in the kernel, there are some changes needed to support 2 CS'es:
- the SDRC parameters need to be updated for the new memory part
- the SDRC parameters need to include the ACTIM_CTRL_A_0, ACTIM_CTRL_A_1, ACTIM_CTRL_B_0, ACTIM_CTRL_B_1, RFR_CTRL_0 and RFR_CTRL_1 registers. Since the parameters for the 2nd CS are the same, this can be avoided by writing the same values to the 2 sets of registers
- is there a need to differentiate between 1Gb and 2Gb chips, or can we just write the same params for both CS'es even if only one is being used?
- the 'configure_sdrc' function in arch/arm/mach-omap2/sram34xx.S needs to program the 2 sets of registers. Here is a patch excerpt below. This patch only does not help the suspend/resume though.

Quoted 1 line

Any idea or suggestion?

Looks like a good start. Since the two SDRC chip-selects can technically address parts with different timings, we should not assume that the two chip selects will be the same. Admittedly this seems like an unlikely situation, but it's not impossible for non-POP OMAPs.

Re: suspend/resume, if you're talking about the code in sleep34xx.S, it looks like this is already in good shape.

Re: board & SDRC changes: would suggest modifying omap2_sdrc_init() to take either two struct omap_sdrc_params pointers, or one struct with two pointers. omap2_init_common_hw() will also need to be updated for that, and all of the board-*.c files also.

Sound reasonable?

arch/arm/mach-omap2/sram34xx.S wait_dll_unlock: · line 196

Quoted 7 lines
        ldr     r11, omap3_sdrc_mr_0
        str     r6, [r11]
        ldr     r6, [r11]               @ posted-write barrier for SDRC
arch/arm/mach-omap2/sram34xx.S +3 -0
+       ldr     r11, omap3_sdrc_mr_1
+       str     r6, [r11]
+       ldr     r6, [r11]               @ posted-write barrier for SDRC
        bx      lr

By the way, there's no need to duplicate the posted-write barrier. There should only be one, appearing right before the 'bx lr'.

regards,

- Paul

author
#2 lore raw

Hi Paul,

Quoted 3 lines · On Thursday 07 May 2009 01:39:02 Paul Walmsley wrote:

Hello Jean,

sorry about the delay,

Thanks for replying!

Quoted 18 lines · Jean Pihet
Quoted 8 lines

The suspend/resume on Beagleboard has some problem due to bad memory timings. Suspending for more than 5 to 10 seconds shows memory corruption.

The new chips on rev Cx boards are using 2 DDR chip selects and it looks like the 2nd memory part is not correctly put into self refresh. As an experimentation I tried the same kernel with 'mem=128M' and it resumes correctly after 1 min in suspend.

Nice work, this seems likely to be the cause.

Quoted 3 lines

I could not find the latest DDR detailed specs from Micron. The part number is MT29C2G48MAKLCJI-6 IT. Are those available? Is this part identical to 2 1Gb parts?

The combined part's web page is:

Quoted 7 lines

http://www.micron.com/products/partdetail?part=MT29C2G48MAKLCJI-6%20IT

The SDRAM datasheet is the same that is used for all the other Micron parts that we've run across so far:

http://download.micron.com/pdf/datasheets/dram/mobile/1gb_ddr_mobile_sdram_
t48m.pdf

Ok so we have 2 DDRs combined.
That does not explain why the self-refresh is ok with only 1 part while it fails with the 2 parts.
Could it be that the timings are too tight? Is there something special for the SDRC to support the 2 CSes correctly?

We already have used the self refresh with 2 parts hooked on a 3430, not Micron parts though, so the code looks correct.

I think we need help from the HW vendors here to identify the root cause:
SDRC, DDR parts, connections?

Quoted 13 lines
Quoted 13 lines

Now for the code in the kernel, there are some changes needed to support 2 CS'es:
- the SDRC parameters need to be updated for the new memory part
- the SDRC parameters need to include the ACTIM_CTRL_A_0, ACTIM_CTRL_A_1, ACTIM_CTRL_B_0, ACTIM_CTRL_B_1, RFR_CTRL_0 and RFR_CTRL_1 registers. Since the parameters for the 2nd CS are the same, this can be avoided by writing the same values to the 2 sets of registers
- is there a need to differentiate between 1Gb and 2Gb chips, or can we just write the same params for both CS'es even if only one is being used?
- the 'configure_sdrc' function in arch/arm/mach-omap2/sram34xx.S needs to program the 2 sets of registers. Here is a patch excerpt below. This patch only does not help the suspend/resume though.

Quoted 6 lines
Quoted 1 line

Any idea or suggestion?

Looks like a good start. Since the two SDRC chip-selects can technically address parts with different timings, we should not assume that the two chip selects will be the same. Admittedly this seems like an unlikely situation, but it's not impossible for non-POP OMAPs.

Makes sense. It is better to have correct and generic code.

Quoted 9 lines

Re: suspend/resume, if you're talking about the code in sleep34xx.S, it looks like this is already in good shape.

Re: board & SDRC changes: would suggest modifying omap2_sdrc_init() to take either two struct omap_sdrc_params pointers, or one struct with two pointers. omap2_init_common_hw() will also need to be updated for that, and all of the board-*.c files also.

Sound reasonable?

Sure. I can write the new code, but I prefer to have the self refresh working first.

Quoted 10 lines

arch/arm/mach-omap2/sram34xx.S wait_dll_unlock: · line 196

Quoted 7 lines
        ldr     r11, omap3_sdrc_mr_0
        str     r6, [r11]
        ldr     r6, [r11]               @ posted-write barrier for SDRC
arch/arm/mach-omap2/sram34xx.S +3 -0
+       ldr     r11, omap3_sdrc_mr_1
+       str     r6, [r11]
+       ldr     r6, [r11]               @ posted-write barrier for SDRC
        bx      lr

By the way, there's no need to duplicate the posted-write barrier. There should only be one, appearing right before the 'bx lr'.

Ok I will take it into account.

Quoted 4 lines

regards,

- Paul

Regards,
Jean

author
#3 lore raw

Hi,

FYI I tried to relax the DDR timings (mainly tRC, tWTR, tXP, tXSR, ARCV) but that did not help.

Quoted 1 line

From the OMAP datasheet it looks like the ARCV setting is off: shouldn't it be

(tREFI/tCK)+50=(7800/6)+50=0x546?

Is there a way to know if the self refresh works on both parts?

Regards,
Jean

Quoted 107 lines · On Thursday 07 May 2009 13:18:30 Jean Pihet wrote:

Hi Paul,

Quoted 3 lines · On Thursday 07 May 2009 01:39:02 Paul Walmsley wrote:

Hello Jean,

sorry about the delay,

Thanks for replying!

Quoted 18 lines · Jean Pihet
Quoted 8 lines

The suspend/resume on Beagleboard has some problem due to bad memory timings. Suspending for more than 5 to 10 seconds shows memory corruption.

The new chips on rev Cx boards are using 2 DDR chip selects and it looks like the 2nd memory part is not correctly put into self refresh. As an experimentation I tried the same kernel with 'mem=128M' and it resumes correctly after 1 min in suspend.

Nice work, this seems likely to be the cause.

Quoted 3 lines

I could not find the latest DDR detailed specs from Micron. The part number is MT29C2G48MAKLCJI-6 IT. Are those available? Is this part identical to 2 1Gb parts?

The combined part's web page is:

Quoted 7 lines

http://www.micron.com/products/partdetail?part=MT29C2G48MAKLCJI-6%20IT

The SDRAM datasheet is the same that is used for all the other Micron parts that we've run across so far:

http://download.micron.com/pdf/datasheets/dram/mobile/1gb_ddr_mobile_sdra
m_ t48m.pdf

Ok so we have 2 DDRs combined.
That does not explain why the self-refresh is ok with only 1 part while it fails with the 2 parts.
Could it be that the timings are too tight? Is there something special for the SDRC to support the 2 CSes correctly?

We already have used the self refresh with 2 parts hooked on a 3430, not Micron parts though, so the code looks correct.

I think we need help from the HW vendors here to identify the root cause:
SDRC, DDR parts, connections?

Quoted 14 lines
Quoted 14 lines

Now for the code in the kernel, there are some changes needed to support 2 CS'es:
- the SDRC parameters need to be updated for the new memory part
- the SDRC parameters need to include the ACTIM_CTRL_A_0, ACTIM_CTRL_A_1, ACTIM_CTRL_B_0, ACTIM_CTRL_B_1, RFR_CTRL_0 and RFR_CTRL_1 registers. Since the parameters for the 2nd CS are the same, this can be avoided by writing the same values to the 2 sets of registers
- is there a need to differentiate between 1Gb and 2Gb chips, or can we just write the same params for both CS'es even if only one is being used? - the 'configure_sdrc' function in arch/arm/mach-omap2/sram34xx.S needs to program the 2 sets of registers. Here is a patch excerpt below. This patch only does not help the suspend/resume though.

Quoted 6 lines
Quoted 1 line

Any idea or suggestion?

Looks like a good start. Since the two SDRC chip-selects can technically address parts with different timings, we should not assume that the two chip selects will be the same. Admittedly this seems like an unlikely situation, but it's not impossible for non-POP OMAPs.

Makes sense. It is better to have correct and generic code.

Quoted 9 lines

Re: suspend/resume, if you're talking about the code in sleep34xx.S, it looks like this is already in good shape.

Re: board & SDRC changes: would suggest modifying omap2_sdrc_init() to take either two struct omap_sdrc_params pointers, or one struct with two pointers. omap2_init_common_hw() will also need to be updated for that, and all of the board-*.c files also.

Sound reasonable?

Sure. I can write the new code, but I prefer to have the self refresh working first.

Quoted 10 lines

arch/arm/mach-omap2/sram34xx.S wait_dll_unlock: · line 196

Quoted 7 lines
        ldr     r11, omap3_sdrc_mr_0
        str     r6, [r11]
        ldr     r6, [r11]               @ posted-write barrier for SDRC
arch/arm/mach-omap2/sram34xx.S +3 -0
+       ldr     r11, omap3_sdrc_mr_1
+       str     r6, [r11]
+       ldr     r6, [r11]               @ posted-write barrier for SDRC
        bx      lr

By the way, there's no need to duplicate the posted-write barrier. There should only be one, appearing right before the 'bx lr'.

Ok I will take it into account.

Quoted 3 lines

regards,

- Paul

Regards,
Jean

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

maintainer
#4 lore raw

Hello Jean

Quoted 2 lines · Jean Pihet

From the OMAP datasheet it looks like the ARCV setting is off: shouldn't it be (tREFI/tCK)+50=(7800/6)+50=0x546?

Could you elaborate further what you're seeing? It would help to see the register value that you're using to come to this conclusion.

- Paul

Quoted 116 lines

Is there a way to know if the self refresh works on both parts?

Regards,
Jean

Quoted 107 lines · On Thursday 07 May 2009 13:18:30 Jean Pihet wrote:

Hi Paul,

Quoted 3 lines · On Thursday 07 May 2009 01:39:02 Paul Walmsley wrote:

Hello Jean,

sorry about the delay,

Thanks for replying!

Quoted 18 lines · Jean Pihet
Quoted 8 lines

The suspend/resume on Beagleboard has some problem due to bad memory timings. Suspending for more than 5 to 10 seconds shows memory corruption.

The new chips on rev Cx boards are using 2 DDR chip selects and it looks like the 2nd memory part is not correctly put into self refresh. As an experimentation I tried the same kernel with 'mem=128M' and it resumes correctly after 1 min in suspend.

Nice work, this seems likely to be the cause.

Quoted 3 lines

I could not find the latest DDR detailed specs from Micron. The part number is MT29C2G48MAKLCJI-6 IT. Are those available? Is this part identical to 2 1Gb parts?

The combined part's web page is:

Quoted 7 lines

http://www.micron.com/products/partdetail?part=MT29C2G48MAKLCJI-6%20IT

The SDRAM datasheet is the same that is used for all the other Micron parts that we've run across so far:

http://download.micron.com/pdf/datasheets/dram/mobile/1gb_ddr_mobile_sdra
m_ t48m.pdf

Ok so we have 2 DDRs combined.
That does not explain why the self-refresh is ok with only 1 part while it fails with the 2 parts.
Could it be that the timings are too tight? Is there something special for the SDRC to support the 2 CSes correctly?

We already have used the self refresh with 2 parts hooked on a 3430, not Micron parts though, so the code looks correct.

I think we need help from the HW vendors here to identify the root cause:
SDRC, DDR parts, connections?

Quoted 14 lines
Quoted 14 lines

Now for the code in the kernel, there are some changes needed to support 2 CS'es:
- the SDRC parameters need to be updated for the new memory part
- the SDRC parameters need to include the ACTIM_CTRL_A_0, ACTIM_CTRL_A_1, ACTIM_CTRL_B_0, ACTIM_CTRL_B_1, RFR_CTRL_0 and RFR_CTRL_1 registers. Since the parameters for the 2nd CS are the same, this can be avoided by writing the same values to the 2 sets of registers
- is there a need to differentiate between 1Gb and 2Gb chips, or can we just write the same params for both CS'es even if only one is being used? - the 'configure_sdrc' function in arch/arm/mach-omap2/sram34xx.S needs to program the 2 sets of registers. Here is a patch excerpt below. This patch only does not help the suspend/resume though.

Quoted 6 lines
Quoted 1 line

Any idea or suggestion?

Looks like a good start. Since the two SDRC chip-selects can technically address parts with different timings, we should not assume that the two chip selects will be the same. Admittedly this seems like an unlikely situation, but it's not impossible for non-POP OMAPs.

Makes sense. It is better to have correct and generic code.

Quoted 9 lines

Re: suspend/resume, if you're talking about the code in sleep34xx.S, it looks like this is already in good shape.

Re: board & SDRC changes: would suggest modifying omap2_sdrc_init() to take either two struct omap_sdrc_params pointers, or one struct with two pointers. omap2_init_common_hw() will also need to be updated for that, and all of the board-*.c files also.

Sound reasonable?

Sure. I can write the new code, but I prefer to have the self refresh working first.

Quoted 10 lines

arch/arm/mach-omap2/sram34xx.S wait_dll_unlock: · line 196

Quoted 7 lines
        ldr     r11, omap3_sdrc_mr_0
        str     r6, [r11]
        ldr     r6, [r11]               @ posted-write barrier for SDRC
arch/arm/mach-omap2/sram34xx.S +3 -0
+       ldr     r11, omap3_sdrc_mr_1
+       str     r6, [r11]
+       ldr     r6, [r11]               @ posted-write barrier for SDRC
        bx      lr

By the way, there's no need to duplicate the posted-write barrier. There should only be one, appearing right before the 'bx lr'.

Ok I will take it into account.

Quoted 3 lines

regards,

- Paul

Regards,
Jean

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

- Paul

author
#5 lore raw

Paul,

Quoted 8 lines · On Thursday 07 May 2009 20:59:43 Paul Walmsley wrote:

Hello Jean

Quoted 2 lines · Jean Pihet

From the OMAP datasheet it looks like the ARCV setting is off: shouldn't it be (tREFI/tCK)+50=(7800/6)+50=0x546?

Could you elaborate further what you're seeing? It would help to see the register value that you're using to come to this conclusion.

The SDRC_RFR_CTRL_p registers are now programmed with 0x4dc01, which means the fiel ARCV has the value 0x4dc=1244.

Quoted 1 line

From the DDR datasheet we need an average refresh period of 7.8us and a clock

period of 6ns (166MHz). From the definition of the ARCV field in the OMAP TRM I need to program ARCV with: (tREFI/tCK)+50 = (7800/6)+50=1350=0x546. The SDRC_RFR_CTRL_p registers would then have the value of 0x54601.

Does that make sense? Am I wrong with the calculation?

Quoted 2 lines

- Paul

Regards,
Jean

Quoted 119 lines
Quoted 117 lines

Is there a way to know if the self refresh works on both parts?

Regards,
Jean

Quoted 110 lines · On Thursday 07 May 2009 13:18:30 Jean Pihet wrote:

Hi Paul,

Quoted 3 lines · On Thursday 07 May 2009 01:39:02 Paul Walmsley wrote:

Hello Jean,

sorry about the delay,

Thanks for replying!

Quoted 18 lines · Jean Pihet
Quoted 8 lines

The suspend/resume on Beagleboard has some problem due to bad memory timings. Suspending for more than 5 to 10 seconds shows memory corruption.

The new chips on rev Cx boards are using 2 DDR chip selects and it looks like the 2nd memory part is not correctly put into self refresh. As an experimentation I tried the same kernel with 'mem=128M' and it resumes correctly after 1 min in suspend.

Nice work, this seems likely to be the cause.

Quoted 3 lines

I could not find the latest DDR detailed specs from Micron. The part number is MT29C2G48MAKLCJI-6 IT. Are those available? Is this part identical to 2 1Gb parts?

The combined part's web page is:

Quoted 8 lines

http://www.micron.com/products/partdetail?part=MT29C2G48MAKLCJI-6%20I
T

The SDRAM datasheet is the same that is used for all the other Micron parts that we've run across so far:

http://download.micron.com/pdf/datasheets/dram/mobile/1gb_ddr_mobile_
sdra m_ t48m.pdf

Ok so we have 2 DDRs combined.
That does not explain why the self-refresh is ok with only 1 part while it fails with the 2 parts.
Could it be that the timings are too tight? Is there something special for the SDRC to support the 2 CSes correctly?

We already have used the self refresh with 2 parts hooked on a 3430, not Micron parts though, so the code looks correct.

I think we need help from the HW vendors here to identify the root
cause: SDRC, DDR parts, connections?

Quoted 15 lines
Quoted 15 lines

Now for the code in the kernel, there are some changes needed to support 2 CS'es:
- the SDRC parameters need to be updated for the new memory part
- the SDRC parameters need to include the ACTIM_CTRL_A_0, ACTIM_CTRL_A_1, ACTIM_CTRL_B_0, ACTIM_CTRL_B_1, RFR_CTRL_0 and RFR_CTRL_1 registers. Since the parameters for the 2nd CS are the same, this can be avoided by writing the same values to the 2 sets of registers
- is there a need to differentiate between 1Gb and 2Gb chips, or can we just write the same params for both CS'es even if only one is being used? - the 'configure_sdrc' function in arch/arm/mach-omap2/sram34xx.S needs to program the 2 sets of registers. Here is a patch excerpt below. This patch only does not help the suspend/resume though.

Quoted 7 lines
Quoted 1 line

Any idea or suggestion?

Looks like a good start. Since the two SDRC chip-selects can technically address parts with different timings, we should not assume that the two chip selects will be the same. Admittedly this seems like an unlikely situation, but it's not impossible for non-POP OMAPs.

Makes sense. It is better to have correct and generic code.

Quoted 9 lines

Re: suspend/resume, if you're talking about the code in sleep34xx.S, it looks like this is already in good shape.

Re: board & SDRC changes: would suggest modifying omap2_sdrc_init() to take either two struct omap_sdrc_params pointers, or one struct with two pointers. omap2_init_common_hw() will also need to be updated for that, and all of the board-*.c files also.

Sound reasonable?

Sure. I can write the new code, but I prefer to have the self refresh working first.

Quoted 10 lines
Quoted 7 lines
        ldr     r11, omap3_sdrc_mr_0
        str     r6, [r11]
        ldr     r6, [r11]               @ posted-write barrier for

SDRC + ldr r11, omap3_sdrc_mr_1

(quoted diff) +2 -0
+       str     r6, [r11]
+       ldr     r6, [r11]               @ posted-write barrier for

SDRC bx lr

By the way, there's no need to duplicate the posted-write barrier. There should only be one, appearing right before the 'bx lr'.

Ok I will take it into account.

Quoted 3 lines

regards,

- Paul

Regards,
Jean

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

- Paul

maintainer
#6 lore raw

Hello Jean,

Quoted 7 lines · Jean Pihet
Quoted 6 lines · On Thursday 07 May 2009 20:59:43 Paul Walmsley wrote:
Quoted 2 lines · Jean Pihet

From the OMAP datasheet it looks like the ARCV setting is off: shouldn't it be (tREFI/tCK)+50=(7800/6)+50=0x546?

Could you elaborate further what you're seeing? It would help to see the register value that you're using to come to this conclusion.

Quoted 8 lines

The SDRC_RFR_CTRL_p registers are now programmed with 0x4dc01, which means the fiel ARCV has the value 0x4dc=1244.
From the DDR datasheet we need an average refresh period of 7.8us and a clock period of 6ns (166MHz). From the definition of the ARCV field in the OMAP TRM I need to program ARCV with: (tREFI/tCK)+50 = (7800/6)+50=1350=0x546. The SDRC_RFR_CTRL_p registers would then have the value of 0x54601.

Does that make sense? Am I wrong with the calculation?

According to the TRM, the 50 cycles should be subtracted rather than added (section 11.2.6.3.3.4). One other thing is that the bootloaders I've seen program DPLL3 such that the SDRC clock is 166000000 Hz, rather than 166666666 Hz, so tCK winds up being something like 6.024... ns.

Auto-refresh is only used while the SDRC is active, though. So unless memory corruption is evident outside of suspend, the ARCV value is unlikely to be the problem.

It sounds like the problem is related to self-refresh, that the SDRAM bank on one of the chipselects either can't enter or exit self-refresh. You have self-refresh working on a different board with both SDRC CS0 and CS1 in use, correct? Is that with an ES2 or ES3 chip?

One possibility: perhaps the problem is with Beagle's pin mux settings. You might want to boot with mem=128M and make sure CONTROL_PADCONF_SAD2D_SBUSFLAG and CONTROL_PADCONF_SDRC_CKE1 are in mode 0 before suspend and after resume.

Another thought: it could be that the ROM code on Beagle is not programming the correct SDRC register values after resume. You might try booting with mem=128M and dumping the SDRC register values before suspend and after resume.

- Paul

author
#7 lore raw

Hi Paul,

Quoted 19 lines · On Saturday 09 May 2009 00:43:43 Paul Walmsley wrote:

Hello Jean,

Quoted 16 lines · Jean Pihet
Quoted 6 lines · On Thursday 07 May 2009 20:59:43 Paul Walmsley wrote:
Quoted 2 lines · Jean Pihet

From the OMAP datasheet it looks like the ARCV setting is off:
shouldn't it be (tREFI/tCK)+50=(7800/6)+50=0x546?

Could you elaborate further what you're seeing? It would help to see the register value that you're using to come to this conclusion.

The SDRC_RFR_CTRL_p registers are now programmed with 0x4dc01, which means the fiel ARCV has the value 0x4dc=1244.
From the DDR datasheet we need an average refresh period of 7.8us and a clock period of 6ns (166MHz). From the definition of the ARCV field in the OMAP TRM I need to program ARCV with: (tREFI/tCK)+50 = (7800/6)+50=1350=0x546. The SDRC_RFR_CTRL_p registers would then have the value of 0x54601.

Quoted 6 lines
Quoted 1 line

Does that make sense? Am I wrong with the calculation?

According to the TRM, the 50 cycles should be subtracted rather than added (section 11.2.6.3.3.4). One other thing is that the bootloaders I've seen program DPLL3 such that the SDRC clock is 166000000 Hz, rather than 166666666 Hz, so tCK winds up being something like 6.024... ns.

The settings should be ok with tCK=6.024ns

Quoted 3 lines

Auto-refresh is only used while the SDRC is active, though. So unless memory corruption is evident outside of suspend, the ARCV value is unlikely to be the problem.

Ok

Quoted 9 lines

It sounds like the problem is related to self-refresh, that the SDRAM bank on one of the chipselects either can't enter or exit self-refresh. You have self-refresh working on a different board with both SDRC CS0 and CS1 in use, correct? Is that with an ES2 or ES3 chip?

One possibility: perhaps the problem is with Beagle's pin mux settings. You might want to boot with mem=128M and make sure CONTROL_PADCONF_SAD2D_SBUSFLAG and CONTROL_PADCONF_SDRC_CKE1 are in mode 0 before suspend and after resume.

Yes that definitely is the root cause. I should have checked this first ;-( The U-Boot change is committed, cf.
http://gitorious.org/u-boot-omap3/mainline/commit/c6f01ad390308800693c62dbdb096ab59e03630b
and
http://gitorious.org/u-boot-omap3/mainline/commit/4025cfbde3611b14c0d4831a5524e5e061128e30

Quoted 4 lines

Another thought: it could be that the ROM code on Beagle is not programming the correct SDRC register values after resume. You might try booting with mem=128M and dumping the SDRC register values before suspend and after resume.

Those are OK.

I am looking at a fix for the SDRC setup with 2 CSes. I will propose the changes asap.

Quoted 2 lines

- Paul

Thx & regards,
Jean

maintainer
#8 lore raw

Hi Jean,

Quoted 10 lines · Jean Pihet
Quoted 4 lines · On Saturday 09 May 2009 00:43:43 Paul Walmsley wrote:

One possibility: perhaps the problem is with Beagle's pin mux settings. You might want to boot with mem=128M and make sure CONTROL_PADCONF_SAD2D_SBUSFLAG and CONTROL_PADCONF_SDRC_CKE1 are in mode 0 before suspend and after resume.

Yes that definitely is the root cause. I should have checked this first ;-( The U-Boot change is committed, cf.
http://gitorious.org/u-boot-omap3/mainline/commit/c6f01ad390308800693c62dbdb096ab59e03630b
and
http://gitorious.org/u-boot-omap3/mainline/commit/4025cfbde3611b14c0d4831a5524e5e061128e30

Nice work!

Sounds like we should also patch mach-omap2/sdrc.c:omap2_sdrc_init() to warn if the sdrc_cke1 pin mux is wrong if a second struct omap_sdrc_params
* is passed. Probably board-omap3beagle.c should also remux the pad if it's wrong. Otherwise there will be a lot of unhappy Rev C BeagleBoard users.

Quoted 2 lines

I am looking at a fix for the SDRC setup with 2 CSes. I will propose the changes asap.

Excellent, thanks Jean.

- Paul

author
#9 lore raw

RFC PATCH 1/1 OMAP3: add support for 2 SDRAM chip selects (was: Re: Beagleboard rev C memory timings & suspend/resume)

Hi Paul, Kevin,

Here is a patch for the SDRC 2nd CS support. It applies on top of the current pm branch.

I have some questions:
- Is it OK to copy the micron sdram params file to a new file with the 2 CSes params? One could use a unique file with #ifdef SDRC_SUPPORT_2_CSES.
- Does the RX51 board have 2 sdram parts? If so I need to update the board file as well.

Comments are welcome.

Regards,
Jean

From 517f52f4bef8225c5921b55ecd96eda2e0c4b697 Mon Sep 17 00:00:00 2001
From: Jean Pihet <[email protected]>
Date: Tue, 26 May 2009 14:55:57 +0200
Subject: [PATCH] OMAP3: add support for 2 SDRAM chip selects

Some boards (Beagle Cx, Overo) have 2 SDRAM parts
connected to the SDRC.

This patch adds the following:
- ensure that the CKE signals mux settings are correct
- extend the omap_sdrc_params struct with the 2nd CS params
- add a new file for the micron sdram params for 2 CSes
- adapt the sram sleep code to configure the SDRC for the 2nd CS

Thanks to Paul Walmsley and Kevin Hilman for the suggestions and code reviews.

Tested on Beagleboard rev C2 and B5.

Quoted 24 lines · On Monday 11 May 2009 22:27:50 Paul Walmsley wrote:

Hi Jean,

Quoted 6 lines · Jean Pihet
Quoted 4 lines · On Saturday 09 May 2009 00:43:43 Paul Walmsley wrote:

One possibility: perhaps the problem is with Beagle's pin mux settings. You might want to boot with mem=128M and make sure CONTROL_PADCONF_SAD2D_SBUSFLAG and CONTROL_PADCONF_SDRC_CKE1 are in mode 0 before suspend and after resume.

Quoted 6 lines

Yes that definitely is the root cause. I should have checked this first ;-( The U-Boot change is committed, cf.
http://gitorious.org/u-boot-omap3/mainline/commit/c6f01ad390308800693c62d
bdb096ab59e03630b and
http://gitorious.org/u-boot-omap3/mainline/commit/4025cfbde3611b14c0d4831
a5524e5e061128e30

Nice work!

Sounds like we should also patch mach-omap2/sdrc.c:omap2_sdrc_init() to warn if the sdrc_cke1 pin mux is wrong if a second struct omap_sdrc_params
* is passed. Probably board-omap3beagle.c should also remux the pad if it's wrong. Otherwise there will be a lot of unhappy Rev C BeagleBoard users.

Quoted 7 lines
Quoted 2 lines

I am looking at a fix for the SDRC setup with 2 CSes. I will propose the changes asap.

Excellent, thanks Jean.

- Paul

From 517f52f4bef8225c5921b55ecd96eda2e0c4b697 Mon Sep 17 00:00:00 2001
From: Jean Pihet <[email protected]>
Date: Tue, 26 May 2009 14:55:57 +0200
Subject: [PATCH] OMAP3: add support for 2 SDRAM chip selects

Some boards (Beagle Cx, Overo) have 2 SDRAM parts
connected to the SDRC.

This patch adds the following:
- ensure that the CKE signals mux settings are correct
- extend the omap_sdrc_params struct with the 2nd CS params
- add a new file for the micron sdram params for 2 CSes
- adapt the sram sleep code to configure the SDRC for the 2nd CS

Thanks to Paul Walmsley and Kevin Hilman for the suggestions and code reviews.

Tested on Beagleboard rev C2 and B5.

---
 arch/arm/mach-omap2/board-omap3beagle.c            |    6 +-
 arch/arm/mach-omap2/board-overo.c                  |    6 +-
 arch/arm/mach-omap2/board-rx51-sdram.c             |    8 +-
 arch/arm/mach-omap2/clock34xx.c                    |   18 ++-
 arch/arm/mach-omap2/mux.c                          |    6 +
 .../mach-omap2/sdram-micron-mt46h32m32lf-6-2cses.h |   93 ++++++++++++++
 arch/arm/mach-omap2/sdram-micron-mt46h32m32lf-6.h  |   60 +++++-----
 .../mach-omap2/sdram-qimonda-hyb18m512160af-6.h    |   40 +++---
 arch/arm/mach-omap2/sdrc.c                         |   15 ++-
 arch/arm/mach-omap2/sram34xx.S                     |  128 +++++++++++++++-----
 arch/arm/plat-omap/include/mach/mux.h              |    4 +
 arch/arm/plat-omap/include/mach/sdrc.h             |   23 +++--
 arch/arm/plat-omap/include/mach/sram.h             |   12 +-
 arch/arm/plat-omap/sram.c                          |   34 +++--
 14 files changed, 329 insertions(+), 124 deletions(-)
 create mode 100644 arch/arm/mach-omap2/sdram-micron-mt46h32m32lf-6-2cses.h
arch/arm/mach-omap2/board-omap3beagle.c +5 -1
index 7294dbf..7128213 100644
@@ -110,7 +110,7 @@ static struct platform_device omap3beagle_nand_device = {
 	.resource	= &omap3beagle_nand_resource,
 };
 
-#include "sdram-micron-mt46h32m32lf-6.h"
+#include "sdram-micron-mt46h32m32lf-6-2cses.h"
 
 static struct omap_uart_config omap3_beagle_uart_config __initdata = {
 	.enabled_uarts	= ((1 << 0) | (1 << 1) | (1 << 2)),
@@ -441,6 +441,10 @@ static void __init omap3_beagle_init(void)
 	usb_musb_init();
 	usb_ehci_init();
 	omap3beagle_flash_init();
+
+	/* Ensure SDRC pins are mux'd for self-refresh */
+	omap_cfg_reg(H16_34XX_SDRC_CKE0);
+	omap_cfg_reg(H17_34XX_SDRC_CKE1);
 }
 
 static void __init omap3_beagle_map_io(void)
arch/arm/mach-omap2/board-overo.c +5 -1
index 9eae608..a6ac353 100644
@@ -47,7 +47,7 @@
 #include <mach/nand.h>
 #include <mach/usb.h>
 
-#include "sdram-micron-mt46h32m32lf-6.h"
+#include "sdram-micron-mt46h32m32lf-6-2cses.h"
 #include "twl4030-generic-scripts.h"
 #include "mmc-twl4030.h"
 
@@ -391,6 +391,10 @@ static void __init overo_init(void)
 	overo_init_smsc911x();
 	overo_ads7846_init();
 
+	/* Ensure SDRC pins are mux'd for self-refresh */
+	omap_cfg_reg(H16_34XX_SDRC_CKE0);
+	omap_cfg_reg(H17_34XX_SDRC_CKE1);
+
 	if ((gpio_request(OVERO_GPIO_W2W_NRESET,
 			  "OVERO_GPIO_W2W_NRESET") == 0) &&
 	    (gpio_direction_output(OVERO_GPIO_W2W_NRESET, 1) == 0)) {
arch/arm/mach-omap2/board-rx51-sdram.c +4 -4
index 32b5da4..2e37b0f 100644
@@ -204,10 +204,10 @@ struct omap_sdrc_params *rx51_get_sdram_timings(void)
 	rfr_ctrl = l | 0x3; /* autorefresh, reload counter with 8xARCV */
 
 	rx51_sdrc_params[0].rate = 133333333;
-	rx51_sdrc_params[0].actim_ctrla = actim_ctrla;
-	rx51_sdrc_params[0].actim_ctrlb = actim_ctrlb;
-	rx51_sdrc_params[0].rfr_ctrl = rfr_ctrl;
-	rx51_sdrc_params[0].mr = 0x32;
+	rx51_sdrc_params[0].actim_ctrl_a_0 = actim_ctrla;
+	rx51_sdrc_params[0].actim_ctrl_b_0 = actim_ctrlb;
+	rx51_sdrc_params[0].rfr_ctrl_0 = rfr_ctrl;
+	rx51_sdrc_params[0].mr_0 = 0x32;
 
 	rx51_sdrc_params[1].rate = 0;
 
arch/arm/mach-omap2/clock34xx.c +12 -6
index 3cee6b4..a019711 100644
@@ -518,12 +518,18 @@ static int omap3_core_dpll_m2_set_rate(struct clk *clk, unsigned long rate)
 
 	pr_debug("clock: changing CORE DPLL rate from %lu to %lu\n", clk->rate,
 		 validrate);
-	pr_debug("clock: SDRC timing params used: %08x %08x %08x\n",
-		 sp->rfr_ctrl, sp->actim_ctrla, sp->actim_ctrlb);
-
-	omap3_configure_core_dpll(sp->rfr_ctrl, sp->actim_ctrla,
-				  sp->actim_ctrlb, new_div, unlock_dll, c,
-				  sp->mr, rate > clk->rate);
+	pr_debug("Clock: SDRC timing params used: "
+		 "CS0 %08x %08x %08x %08x, CS1 %08x %08x %08x %08x\n",
+		 sp->rfr_ctrl_0, sp->actim_ctrl_a_0,
+		 sp->actim_ctrl_b_0, sp->mr_0,
+		 sp->rfr_ctrl_1, sp->actim_ctrl_a_1,
+		 sp->actim_ctrl_b_1, sp->mr_1);
+
+	omap3_configure_core_dpll(new_div, unlock_dll, c, rate > clk->rate,
+				  sp->rfr_ctrl_0, sp->actim_ctrl_a_0,
+				  sp->actim_ctrl_b_0, sp->mr_0,
+				  sp->rfr_ctrl_1, sp->actim_ctrl_a_1,
+				  sp->actim_ctrl_b_1, sp->mr_1);
 
 	return 0;
 }
arch/arm/mach-omap2/mux.c +6 -0
index 026c4fc..43d6b92 100644
@@ -486,6 +486,12 @@ MUX_CFG_34XX("H19_34XX_GPIO164_OUT", 0x19c,
 		OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_OUTPUT)
 MUX_CFG_34XX("J25_34XX_GPIO170", 0x1c6,
 		OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_INPUT)
+
+/* OMAP3 SDRC CKE signals to SDR/DDR ram chips */
+MUX_CFG_34XX("H16_34XX_SDRC_CKE0", 0x262,
+		OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_OUTPUT)
+MUX_CFG_34XX("H17_34XX_SDRC_CKE1", 0x264,
+		OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_OUTPUT)
 };
 
 #define OMAP34XX_PINS_SZ	ARRAY_SIZE(omap34xx_pins)
arch/arm/mach-omap2/sdram-micron-mt46h32m32lf-6-2cses.h new file +93 -0

93 lines not on this page · raw message

arch/arm/mach-omap2/sdram-micron-mt46h32m32lf-6.h +30 -30

76 lines not on this page · raw message

arch/arm/mach-omap2/sdram-qimonda-hyb18m512160af-6.h +20 -20
index 74a92c8..b637460 100644
@@ -20,32 +20,32 @@
 /* XXX Using ARE = 0x1 (no autorefresh burst) -- can this be changed? */
 static struct omap_sdrc_params hyb18m512160af6_sdrc_params[] = {
 	[0] = {
-		.rate	     = 165941176,
-		.actim_ctrla = 0x629db4c6,
-		.actim_ctrlb = 0x00012214,
-		.rfr_ctrl    = 0x0004dc01,
-		.mr	     = 0x00000032,
+		.rate		= 165941176,
+		.actim_ctrl_a_0	= 0x629db4c6,
+		.actim_ctrl_b_0	= 0x00012214,
+		.rfr_ctrl_0	= 0x0004dc01,
+		.mr_0		= 0x00000032,
 	},
 	[1] = {
-		.rate	     = 133333333,
-		.actim_ctrla = 0x5219b485,
-		.actim_ctrlb = 0x00012210,
-		.rfr_ctrl    = 0x0003de01,
-		.mr	     = 0x00000032,
+		.rate		= 133333333,
+		.actim_ctrl_a_0	= 0x5219b485,
+		.actim_ctrl_b_0	= 0x00012210,
+		.rfr_ctrl_0	= 0x0003de01,
+		.mr_0		= 0x00000032,
 	},
 	[2] = {
-		.rate	     = 82970588,
-		.actim_ctrla = 0x31512283,
-		.actim_ctrlb = 0x0001220a,
-		.rfr_ctrl    = 0x00025501,
-		.mr	     = 0x00000022,
+		.rate		= 82970588,
+		.actim_ctrl_a_0	= 0x31512283,
+		.actim_ctrl_b_0	= 0x0001220a,
+		.rfr_ctrl_0	= 0x00025501,
+		.mr_0		= 0x00000022,
 	},
 	[3] = {
-		.rate	     = 66666666,
-		.actim_ctrla = 0x290d2243,
-		.actim_ctrlb = 0x00012208,
-		.rfr_ctrl    = 0x0001d601,
-		.mr	     = 0x00000022,
+		.rate		= 66666666,
+		.actim_ctrl_a_0	= 0x290d2243,
+		.actim_ctrl_b_0	= 0x00012208,
+		.rfr_ctrl_0	= 0x0001d601,
+		.mr_0		= 0x00000022,
 	},
 	[4] = {
 		.rate	     = 0
arch/arm/mach-omap2/sdrc.c +10 -5
index c832d83..072dcc9 100644
@@ -72,14 +72,19 @@ void omap2_sms_restore_context(void)
  * omap2_sdrc_get_params - return SDRC register values for a given clock rate
  * @r: SDRC clock rate (in Hz)
  *
- * Return pre-calculated values for the SDRC_ACTIM_CTRLA,
- * SDRC_ACTIM_CTRLB, SDRC_RFR_CTRL, and SDRC_MR registers, for a given
- * SDRC clock rate 'r'.  These parameters control various timing
+ * Return pre-calculated values for the SDRC_ACTIM_CTRL_A_[01],
+ * SDRC_ACTIM_CTRL_B_[01], SDRC_RFR_CTRL_[01], and SDRC_MR_[01] registers,
+ * for a given SDRC clock rate 'r'.
+ * These parameters control various timing
  * delays in the SDRAM controller that are expressed in terms of the
  * number of SDRC clock cycles to wait; hence the clock rate
  * dependency. Note that sdrc_init_params must be sorted rate
- * descending.  Also assumes that both chip-selects use the same
- * timing parameters.  Returns a struct omap_sdrc_params * upon
+ * descending.
+ *
+ * The omap_sdrc_params struct supports different timing parameters
+ * for 2 chip selects.
+ *
+ * Returns a struct omap_sdrc_params * upon
  * success, or NULL upon failure.
  */
 struct omap_sdrc_params *omap2_sdrc_get_params(unsigned long r)
arch/arm/mach-omap2/sram34xx.S +98 -30

184 lines not on this page · raw message

arch/arm/plat-omap/include/mach/mux.h +4 -0
index f7e298a..7368aba 100644
@@ -803,6 +803,10 @@ enum omap34xx_index {
 	AE5_34XX_GPIO143,
 	H19_34XX_GPIO164_OUT,
 	J25_34XX_GPIO170,
+
+	/* OMAP3 SDRC CKE signals to SDR/DDR ram chips */
+	H16_34XX_SDRC_CKE0,
+	H17_34XX_SDRC_CKE1,
 };
 
 struct omap_mux_cfg {
arch/arm/plat-omap/include/mach/sdrc.h +15 -8
index a678bc8..e14204c 100644
@@ -94,22 +94,29 @@
 /**
  * struct omap_sdrc_params - SDRC parameters for a given SDRC clock rate
  * @rate: SDRC clock rate (in Hz)
- * @actim_ctrla: Value to program to SDRC_ACTIM_CTRLA for this rate
- * @actim_ctrlb: Value to program to SDRC_ACTIM_CTRLB for this rate
- * @rfr_ctrl: Value to program to SDRC_RFR_CTRL for this rate
- * @mr: Value to program to SDRC_MR for this rate
+ * @actim_ctrl_a_[01]: Value to program to SDRC_ACTIM_CTRL_A_[01] for this rate
+ * @actim_ctrl_b_[01]: Value to program to SDRC_ACTIM_CTRL_B_[01] for this rate
+ * @rfr_ctrl_[01]: Value to program to SDRC_RFR_CTRL_[01] for this rate
+ * @mr_[01]: Value to program to SDRC_MR_[01] for this rate
  *
  * This structure holds a pre-computed set of register values for the
  * SDRC for a given SDRC clock rate and SDRAM chip.  These are
  * intended to be pre-computed and specified in an array in the board-*.c
  * files.  The structure is keyed off the 'rate' field.
+ *
+ * The struct supports up to 2 CSes. The fields *_0 are used for the 1st
+ * CS, the fields *_1 are used for the 2nd one.
  */
 struct omap_sdrc_params {
 	unsigned long rate;
-	u32 actim_ctrla;
-	u32 actim_ctrlb;
-	u32 rfr_ctrl;
-	u32 mr;
+	u32 actim_ctrl_a_0;
+	u32 actim_ctrl_b_0;
+	u32 rfr_ctrl_0;
+	u32 mr_0;
+	u32 actim_ctrl_a_1;
+	u32 actim_ctrl_b_1;
+	u32 rfr_ctrl_1;
+	u32 mr_1;
 };
 
 void omap2_sms_save_context(void);
arch/arm/plat-omap/include/mach/sram.h +7 -5
index ad0a600..2194b04 100644
@@ -21,11 +21,13 @@ extern void omap2_sram_reprogram_sdrc(u32 perf_level, u32 dll_val,
 				      u32 mem_type);
 extern u32 omap2_set_prcm(u32 dpll_ctrl_val, u32 sdrc_rfr_val, int bypass);
 
-extern u32 omap3_configure_core_dpll(u32 sdrc_rfr_ctrl,
-				     u32 sdrc_actim_ctrla,
-				     u32 sdrc_actim_ctrlb, u32 m2,
-				     u32 unlock_dll, u32 f, u32 sdrc_mr,
-				     u32 inc);
+extern u32 omap3_configure_core_dpll(
+			u32 m2, u32 unlock_dll, u32 f, u32 inc,
+			u32 sdrc_rfr_ctrl_0, u32 sdrc_actim_ctrl_a_0,
+			u32 sdrc_actim_ctrl_b_0, u32 sdrc_mr_0,
+			u32 sdrc_rfr_ctrl_1, u32 sdrc_actim_ctrl_a_1,
+			u32 sdrc_actim_ctrl_b_1, u32 sdrc_mr_1);
+
 extern void omap3_sram_restore_context(void);
 
 /* Do not use these */
arch/arm/plat-omap/sram.c +20 -14
index a2e60e7..517f45b 100644
@@ -368,23 +368,29 @@ static inline int omap243x_sram_init(void)
 
 #ifdef CONFIG_ARCH_OMAP3
 
-static u32 (*_omap3_sram_configure_core_dpll)(u32 sdrc_rfr_ctrl,
-					      u32 sdrc_actim_ctrla,
-					      u32 sdrc_actim_ctrlb,
-					      u32 m2, u32 unlock_dll,
-					      u32 f, u32 sdrc_mr, u32 inc);
-u32 omap3_configure_core_dpll(u32 sdrc_rfr_ctrl, u32 sdrc_actim_ctrla,
-			      u32 sdrc_actim_ctrlb, u32 m2, u32 unlock_dll,
-			      u32 f, u32 sdrc_mr, u32 inc)
- {
+static u32 (*_omap3_sram_configure_core_dpll)(
+				u32 m2, u32 unlock_dll, u32 f, u32 inc,
+				u32 sdrc_rfr_ctrl_0, u32 sdrc_actim_ctrl_a_0,
+				u32 sdrc_actim_ctrl_b_0, u32 sdrc_mr_0,
+				u32 sdrc_rfr_ctrl_1, u32 sdrc_actim_ctrl_a_1,
+				u32 sdrc_actim_ctrl_b_1, u32 sdrc_mr_1);
+
+u32 omap3_configure_core_dpll(u32 m2, u32 unlock_dll, u32 f, u32 inc,
+			      u32 sdrc_rfr_ctrl_0, u32 sdrc_actim_ctrl_a_0,
+			      u32 sdrc_actim_ctrl_b_0, u32 sdrc_mr_0,
+			      u32 sdrc_rfr_ctrl_1, u32 sdrc_actim_ctrl_a_1,
+			      u32 sdrc_actim_ctrl_b_1, u32 sdrc_mr_1)
+{
 	if (!_omap3_sram_configure_core_dpll)
 		omap_sram_error();
 
-	return _omap3_sram_configure_core_dpll(sdrc_rfr_ctrl,
-					       sdrc_actim_ctrla,
-					       sdrc_actim_ctrlb, m2,
-					       unlock_dll, f, sdrc_mr, inc);
- }
+	return _omap3_sram_configure_core_dpll(
+				m2, unlock_dll, f, inc,
+				sdrc_rfr_ctrl_0, sdrc_actim_ctrl_a_0,
+				sdrc_actim_ctrl_b_0, sdrc_mr_0,
+				sdrc_rfr_ctrl_1, sdrc_actim_ctrl_a_1,
+				sdrc_actim_ctrl_b_1, sdrc_mr_1);
+}
 
 #ifdef CONFIG_PM
 void omap3_sram_restore_context(void)
Signature · 1 line
1.6.1.2.MVISTA.50.gdf8fd
maintainer
#10 lore raw

Re: [RFC][PATCH] OMAP3: add support for 2 SDRAM chip selects (was: Re: Beagleboard rev C memory timings & suspend/resume)

Hi Jean,

a minor request: it is easier to comment on these patches if they are included inline in the E-mail message, rather than attached. That way code comments can be inlined in the reply.

Quoted 2 lines · Jean Pihet

Here is a patch for the SDRC 2nd CS support. It applies on top of the current pm branch.

Thanks for doing this work.

Quoted 3 lines

I have some questions:
- Is it OK to copy the micron sdram params file to a new file with the 2 CSes params? One could use a unique file with #ifdef SDRC_SUPPORT_2_CSES.

Is it possible for the SDRAM parameter files to remain unchanged, and to simply pass two struct omap_sdrc_params * to omap2_init_common_hw() and then to omap2_sdrc_init()? Boards with only CS0 in use should pass NULL for the second omap_sdrc_params *.

So something like this (I realize the PM branch has additional parameters here also):

void __init omap2_init_common_hw(struct omap_sdrc_params *sdrc_cs0,
struct omap_sdrc_params *sdrc_cs1)

Then:

void __init omap2_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
struct omap_sdrc_params *sdrc_cs1)

I would prefer that approach.

It would also be good to avoid changing the SDRC CS1 parameters in the SRAM code if the board does not use CS1. Maybe pass in a flag that indicates whether CS1 is in use, and if not, avoid programming those registers? The (admittedly minor) overhead of loading the CS1 registers off the stack would be nice to avoid also.

Quoted 2 lines

- Does the RX51 board have 2 sdram parts? If so I need to update the board file as well.

Probably best if someone from Nokia handles this.

- Paul

author
#11 lore raw

Re: [RFC][PATCH] OMAP3: add support for 2 SDRAM chip selects (was: Re: Beagleboard rev C memory timings & suspend/resume)

Hi Paul,

OK I will rework the code and send a patch when done.

Regards,
Jean

Quoted 47 lines · On Wednesday 03 June 2009 01:40:13 Paul Walmsley wrote:

Hi Jean,

a minor request: it is easier to comment on these patches if they are included inline in the E-mail message, rather than attached. That way code comments can be inlined in the reply.

Quoted 2 lines · Jean Pihet

Here is a patch for the SDRC 2nd CS support. It applies on top of the current pm branch.

Thanks for doing this work.

Quoted 3 lines

I have some questions:
- Is it OK to copy the micron sdram params file to a new file with the 2 CSes params? One could use a unique file with #ifdef SDRC_SUPPORT_2_CSES.

Is it possible for the SDRAM parameter files to remain unchanged, and to simply pass two struct omap_sdrc_params * to omap2_init_common_hw() and then to omap2_sdrc_init()? Boards with only CS0 in use should pass NULL for the second omap_sdrc_params *.

So something like this (I realize the PM branch has additional parameters here also):

void __init omap2_init_common_hw(struct omap_sdrc_params *sdrc_cs0,
struct omap_sdrc_params *sdrc_cs1)

Then:

void __init omap2_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
struct omap_sdrc_params *sdrc_cs1)

I would prefer that approach.

It would also be good to avoid changing the SDRC CS1 parameters in the SRAM code if the board does not use CS1. Maybe pass in a flag that indicates whether CS1 is in use, and if not, avoid programming those registers? The (admittedly minor) overhead of loading the CS1 registers off the stack would be nice to avoid also.

Quoted 2 lines

- Does the RX51 board have 2 sdram parts? If so I need to update the board file as well.

Probably best if someone from Nokia handles this.

- Paul

author
#12 lore raw

Re: [RFC][PATCH] OMAP3: add support for 2 SDRAM chip selects (was: Re: Beagleboard rev C memory timings & suspend/resume)

In reply to Paul Walmsley

Hi Paul, Kevin,

Here is the new patch that includes all the remarks and suggestion. The description is here below.

Some notes:
- all calls to omap2_init_common_hw have been adapted in the board files. it looks like 2430SDP and Pandora board files are broken since they use only one param. Can that be checked on those boards?
- it is assumed that RX51 only uses 1 CS. Is that correct?

Can you review it and possibly merge?

Thanks & regards,
Jean

--

Quoted 1 line

From 097a640997b74638e0e7200ecd5834205204c956 Mon Sep 17 00:00:00 2001

From: Jean Pihet <[email protected]>
Date: Fri, 5 Jun 2009 17:19:00 +0200
Subject: [PATCH] [PATCH] OMAP3: add support for 2 SDRAM chip selects

Some boards (Beagle Cx, Overo) have 2 SDRAM parts
connected to the SDRC.

This patch adds the following:
- ensure that the CKE signals mux settings are correct
- add a new argument of type omap_sdrc_params struct* to omap2_init_common_hw and omap2_sdrc_init for the 2nd CS params
- adapted the OMAP boards files to the new prototype of omap2_init_common_hw. Only Beagle and Overo are using the 2 CS'es
- adapt the sram sleep code to configure the SDRC for the 2nd CS

Note: If the 2nd param to omap2_init_common_hw is NULL, then the parameters are not programmed into the SDRC CS1 registers

Tested on 3430 SDP and Beagleboard rev C2 and B5, with suspend/resume and frequency changes (cpufreq).

Thanks to Paul Walmsley and Kevin Hilman for the suggestions and code reviews.

---
 arch/arm/mach-omap2/board-2430sdp.c      |    2 +-
 arch/arm/mach-omap2/board-3430sdp.c      |    6 +-
 arch/arm/mach-omap2/board-apollon.c      |    2 +-
 arch/arm/mach-omap2/board-generic.c      |    2 +-
 arch/arm/mach-omap2/board-h4.c           |    2 +-
 arch/arm/mach-omap2/board-ldp.c          |    2 +-
 arch/arm/mach-omap2/board-n800.c         |    2 +-
 arch/arm/mach-omap2/board-omap2evm.c     |    2 +-
 arch/arm/mach-omap2/board-omap3beagle.c  |   11 ++-
 arch/arm/mach-omap2/board-omap3evm.c     |    6 +-
 arch/arm/mach-omap2/board-omap3pandora.c |    3 +-
 arch/arm/mach-omap2/board-overo.c        |    8 ++-
 arch/arm/mach-omap2/board-rx51.c         |    6 +-
 arch/arm/mach-omap2/clock34xx.c          |   37 ++++++--
 arch/arm/mach-omap2/io.c                 |    5 +-
 arch/arm/mach-omap2/mux.c                |    6 ++
 arch/arm/mach-omap2/sdrc.c               |   63 +++++++++-----
 arch/arm/mach-omap2/sram34xx.S           |  137 
+++++++++++++++++++++++-------
 arch/arm/plat-omap/include/mach/io.h     |    3 +-
 arch/arm/plat-omap/include/mach/mux.h    |    4 +
 arch/arm/plat-omap/include/mach/sdrc.h   |    8 +-
 arch/arm/plat-omap/include/mach/sram.h   |   23 +++--
 arch/arm/plat-omap/sram.c                |   34 +++++---
 23 files changed, 266 insertions(+), 108 deletions(-)
(quoted diff) +0 -0

b/arch/arm/mach-omap2/board-2430sdp.c
index aa5df72..4cb7bc5 100644

arch/arm/mach-omap2/board-2430sdp.c +1 -1
@@ -322,7 +322,7 @@ out:
 
 static void __init omap_2430sdp_init_irq(void)
 {
-	omap2_init_common_hw(NULL);
+	omap2_init_common_hw(NULL, NULL, NULL, NULL, NULL);
 	omap_init_irq();
 	omap_gpio_init();
 	sdp2430_init_smc91x();
(quoted diff) +0 -0

b/arch/arm/mach-omap2/board-3430sdp.c
index 195b749..24e2728 100644

arch/arm/mach-omap2/board-3430sdp.c +4 -2
@@ -302,8 +302,10 @@ static inline void __init sdp3430_init_smc91x(void)
 
 static void __init omap_3430sdp_init_irq(void)
 {
-	omap2_init_common_hw(hyb18m512160af6_sdrc_params, omap3_mpu_rate_table,
-			     omap3_dsp_rate_table, omap3_l3_rate_table);
+	omap2_init_common_hw(hyb18m512160af6_sdrc_params, NULL,
+			     omap3_mpu_rate_table,
+			     omap3_dsp_rate_table,
+			     omap3_l3_rate_table);
 	omap_init_irq();
 	omap_gpio_init();
 	sdp3430_init_smc91x();
(quoted diff) +0 -0

b/arch/arm/mach-omap2/board-apollon.c
index 2e24812..2dd1350 100644

arch/arm/mach-omap2/board-apollon.c +1 -1
@@ -323,7 +323,7 @@ out:
 
 static void __init omap_apollon_init_irq(void)
 {
-	omap2_init_common_hw(NULL, NULL, NULL, NULL);
+	omap2_init_common_hw(NULL, NULL, NULL, NULL, NULL);
 	omap_init_irq();
 	omap_gpio_init();
 	apollon_init_smc91x();
(quoted diff) +0 -0

b/arch/arm/mach-omap2/board-generic.c
index be763a9..763329b 100644

arch/arm/mach-omap2/board-generic.c +1 -1
@@ -33,7 +33,7 @@
 
 static void __init omap_generic_init_irq(void)
 {
-	omap2_init_common_hw(NULL, NULL, NULL, NULL);
+	omap2_init_common_hw(NULL, NULL, NULL, NULL, NULL);
 	omap_init_irq();
 }
 
arch/arm/mach-omap2/board-h4.c +1 -1
index 8f54939..17c3599 100644
@@ -348,7 +348,7 @@ static void __init h4_init_flash(void)
 
 static void __init omap_h4_init_irq(void)
 {
-	omap2_init_common_hw(NULL, NULL, NULL, NULL);
+	omap2_init_common_hw(NULL, NULL, NULL, NULL, NULL);
 	omap_init_irq();
 	omap_gpio_init();
 	h4_init_flash();
arch/arm/mach-omap2/board-ldp.c +1 -1
index 9f41dc9..b012806 100644
@@ -344,7 +344,7 @@ static inline void __init ldp_init_smc911x(void)
 
 static void __init omap_ldp_init_irq(void)
 {
-	omap2_init_common_hw(NULL, NULL, NULL, NULL);
+	omap2_init_common_hw(NULL, NULL, NULL, NULL, NULL);
 	omap_init_irq();
 	omap_gpio_init();
 	ldp_init_smc911x();
(quoted diff) +0 -0

b/arch/arm/mach-omap2/board-n800.c
index ac7cf3f..ad53f4a 100644

arch/arm/mach-omap2/board-n800.c +1 -1
@@ -127,7 +127,7 @@ static struct lm8323_platform_data lm8323_pdata = {
 
 void __init nokia_n800_init_irq(void)
 {
-	omap2_init_common_hw(NULL, NULL, NULL, NULL);
+	omap2_init_common_hw(NULL, NULL, NULL, NULL, NULL);
 	omap_init_irq();
 	omap_gpio_init();
 
(quoted diff) +0 -0

b/arch/arm/mach-omap2/board-omap2evm.c
index 4fac1be..56a26d4 100644

arch/arm/mach-omap2/board-omap2evm.c +1 -1
@@ -276,7 +276,7 @@ static struct twl4030_keypad_data omap2evm_kp_data = {
 
 static void __init omap2_evm_init_irq(void)
 {
-	omap2_init_common_hw(NULL, NULL, NULL, NULL);
+	omap2_init_common_hw(NULL, NULL, NULL, NULL, NULL);
 	omap_init_irq();
 	omap_gpio_init();
 	omap2evm_init_smc911x();
(quoted diff) +0 -0

b/arch/arm/mach-omap2/board-omap3beagle.c
index 7294dbf..872beb6 100644

arch/arm/mach-omap2/board-omap3beagle.c +9 -2
@@ -312,8 +312,11 @@ static int __init omap3_beagle_i2c_init(void)
 
 static void __init omap3_beagle_init_irq(void)
 {
-	omap2_init_common_hw(mt46h32m32lf6_sdrc_params, omap3_mpu_rate_table,
-			     omap3_dsp_rate_table, omap3_l3_rate_table);
+	omap2_init_common_hw(mt46h32m32lf6_sdrc_params,
+			     mt46h32m32lf6_sdrc_params,
+			     omap3_mpu_rate_table,
+			     omap3_dsp_rate_table,
+			     omap3_l3_rate_table);
 	omap_init_irq();
 	omap_gpio_init();
 }
@@ -441,6 +444,10 @@ static void __init omap3_beagle_init(void)
 	usb_musb_init();
 	usb_ehci_init();
 	omap3beagle_flash_init();
+
+	/* Ensure SDRC pins are mux'd for self-refresh */
+	omap_cfg_reg(H16_34XX_SDRC_CKE0);
+	omap_cfg_reg(H17_34XX_SDRC_CKE1);
 }
 
 static void __init omap3_beagle_map_io(void)
(quoted diff) +0 -0

b/arch/arm/mach-omap2/board-omap3evm.c
index f017f0d..3b9c96a 100644

arch/arm/mach-omap2/board-omap3evm.c +4 -2
@@ -276,8 +276,10 @@ struct spi_board_info omap3evm_spi_board_info[] = {
 
 static void __init omap3_evm_init_irq(void)
 {
-	omap2_init_common_hw(mt46h32m32lf6_sdrc_params, omap3_mpu_rate_table,
-	                     omap3_dsp_rate_table, omap3_l3_rate_table);
+	omap2_init_common_hw(mt46h32m32lf6_sdrc_params, NULL,
+			     omap3_mpu_rate_table,
+			     omap3_dsp_rate_table,
+			     omap3_l3_rate_table);
 	omap_init_irq();
 	omap_gpio_init();
 	omap3evm_init_smc911x();
(quoted diff) +0 -0

b/arch/arm/mach-omap2/board-omap3pandora.c
index c67f62f..05ab99e 100644

arch/arm/mach-omap2/board-omap3pandora.c +2 -1
@@ -220,7 +220,8 @@ static int __init omap3pandora_i2c_init(void)
 
 static void __init omap3pandora_init_irq(void)
 {
-	omap2_init_common_hw(mt46h32m32lf6_sdrc_params);
+	omap2_init_common_hw(mt46h32m32lf6_sdrc_params, NULL,
+			     NULL, NULL, NULL);
 	omap_init_irq();
 	omap_gpio_init();
 }
(quoted diff) +0 -0

b/arch/arm/mach-omap2/board-overo.c
index 9eae608..2c6d2c5 100644

arch/arm/mach-omap2/board-overo.c +7 -1
@@ -355,7 +355,9 @@ static int __init overo_i2c_init(void)
 
 static void __init overo_init_irq(void)
 {
-	omap2_init_common_hw(mt46h32m32lf6_sdrc_params, NULL, NULL, NULL);
+	omap2_init_common_hw(mt46h32m32lf6_sdrc_params,
+			     mt46h32m32lf6_sdrc_params,
+			     NULL, NULL, NULL);
 	omap_init_irq();
 	omap_gpio_init();
 }
@@ -391,6 +393,10 @@ static void __init overo_init(void)
 	overo_init_smsc911x();
 	overo_ads7846_init();
 
+	/* Ensure SDRC pins are mux'd for self-refresh */
+	omap_cfg_reg(H16_34XX_SDRC_CKE0);
+	omap_cfg_reg(H17_34XX_SDRC_CKE1);
+
 	if ((gpio_request(OVERO_GPIO_W2W_NRESET,
 			  "OVERO_GPIO_W2W_NRESET") == 0) &&
 	    (gpio_direction_output(OVERO_GPIO_W2W_NRESET, 1) == 0)) {
(quoted diff) +0 -0

b/arch/arm/mach-omap2/board-rx51.c
index 09035b0..d48459f 100644

arch/arm/mach-omap2/board-rx51.c +4 -2
@@ -64,8 +64,10 @@ static struct omap_board_config_kernel rx51_config[] = {
 
 static void __init rx51_init_irq(void)
 {
-	omap2_init_common_hw(rx51_get_sdram_timings(), omap3_mpu_rate_table,
-			     omap3_dsp_rate_table, omap3_l3_rate_table);
+	omap2_init_common_hw(rx51_get_sdram_timings(), NULL,
+			     omap3_mpu_rate_table,
+			     omap3_dsp_rate_table,
+			     omap3_l3_rate_table);
 	omap_init_irq();
 	omap_gpio_init();
 }
arch/arm/mach-omap2/clock34xx.c +0 -0
index 3cee6b4..f262787 100644
@@ -478,7 +478,9 @@ static int omap3_core_dpll_m2_set_rate(struct clk *clk, 

unsigned long rate)
u32 unlock_dll = 0;
u32 c;
unsigned long validrate, sdrcrate, mpurate;
- struct omap_sdrc_params *sp;
+ struct omap_sdrc_params *sdrc_cs0;
+ struct omap_sdrc_params *sdrc_cs1;
+ int ret;

if (!clk || !rate)
return -EINVAL;
@@ -496,8 +498,8 @@ static int omap3_core_dpll_m2_set_rate(struct clk *clk, unsigned long rate)
else
sdrcrate >>= ((clk->rate / rate) >> 1);

- sp = omap2_sdrc_get_params(sdrcrate);
- if (!sp)
+ ret = omap2_sdrc_get_params(sdrcrate, &sdrc_cs0, &sdrc_cs1);
+ if (ret)
return -EINVAL;

if (sdrcrate < MIN_SDRC_DLL_LOCK_FREQ) {
@@ -518,12 +520,29 @@ static int omap3_core_dpll_m2_set_rate(struct clk *clk, unsigned long rate)

pr_debug("clock: changing CORE DPLL rate from %lu to %lu\n", clk->rate,
validrate);
- pr_debug("clock: SDRC timing params used: %08x %08x %08x\n",
- sp->rfr_ctrl, sp->actim_ctrla, sp->actim_ctrlb);
-
- omap3_configure_core_dpll(sp->rfr_ctrl, sp->actim_ctrla,
- sp->actim_ctrlb, new_div, unlock_dll, c,
- sp->mr, rate > clk->rate);
+ pr_debug("clock: SDRC CS0 timing params used:"
+ " RFR %08x CTRLA %08x CTRLB %08x MR %08x\n",
+ sdrc_cs0->rfr_ctrl, sdrc_cs0->actim_ctrla,
+ sdrc_cs0->actim_ctrlb, sdrc_cs0->mr);
+ if (sdrc_cs1)
+ pr_debug("clock: SDRC CS1 timing params used: "
+ " RFR %08x CTRLA %08x CTRLB %08x MR %08x\n",
+ sdrc_cs1->rfr_ctrl, sdrc_cs1->actim_ctrla,
+ sdrc_cs1->actim_ctrlb, sdrc_cs1->mr);
+
+ if (sdrc_cs1)
+ omap3_configure_core_dpll(

+				  new_div, unlock_dll, c, rate > clk->rate,
+				  sdrc_cs0->rfr_ctrl, sdrc_cs0->actim_ctrla,
+				  sdrc_cs0->actim_ctrlb, sdrc_cs0->mr,
+				  sdrc_cs1->rfr_ctrl, sdrc_cs1->actim_ctrla,
+				  sdrc_cs1->actim_ctrlb, sdrc_cs1->mr);
+	else
+		omap3_configure_core_dpll(
+				  new_div, unlock_dll, c, rate > clk->rate,
+				  sdrc_cs0->rfr_ctrl, sdrc_cs0->actim_ctrla,
+				  sdrc_cs0->actim_ctrlb, sdrc_cs0->mr,
+				  0, 0, 0, 0);

return 0;
}

arch/arm/mach-omap2/io.c +2 -1
index 6fb6c29..aa000b4 100644
@@ -231,7 +231,8 @@ static int __init _omap2_init_reprogram_sdrc(void)
 	return v;
 }
 
-void __init omap2_init_common_hw(struct omap_sdrc_params *sp,
+void __init omap2_init_common_hw(struct omap_sdrc_params *sdrc_cs0,
+				 struct omap_sdrc_params *sdrc_cs1,
 				 struct omap_opp *mpu_opps,
 				 struct omap_opp *dsp_opps,
 				 struct omap_opp *l3_opps)
@@ -244,7 +245,7 @@ void __init omap2_init_common_hw(struct omap_sdrc_params 

*sp,
omapdev_init(omapdevs);
omap2_clk_init();
omap_pm_if_init();
- omap2_sdrc_init(sp);
+ omap2_sdrc_init(sdrc_cs0, sdrc_cs1);

_omap2_init_reprogram_sdrc();

arch/arm/mach-omap2/mux.c +6 -0
index 026c4fc..43d6b92 100644
@@ -486,6 +486,12 @@ MUX_CFG_34XX("H19_34XX_GPIO164_OUT", 0x19c,
 		OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_OUTPUT)
 MUX_CFG_34XX("J25_34XX_GPIO170", 0x1c6,
 		OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_INPUT)
+
+/* OMAP3 SDRC CKE signals to SDR/DDR ram chips */
+MUX_CFG_34XX("H16_34XX_SDRC_CKE0", 0x262,
+		OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_OUTPUT)
+MUX_CFG_34XX("H17_34XX_SDRC_CKE1", 0x264,
+		OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_OUTPUT)
 };
 
 #define OMAP34XX_PINS_SZ	ARRAY_SIZE(omap34xx_pins)
arch/arm/mach-omap2/sdrc.c +35 -19

75 lines not on this page · raw message

*omap2_globals)

/**
* omap2_sdrc_init - initialize SMS, SDRC devices on boot
- * @sp: pointer to a null-terminated list of struct omap_sdrc_params
+ * @sdrc_cs[01]: pointers to a null-terminated list of struct omap_sdrc_params
+ * Support for 2 chip selects timings
*
* Turn on smart idle modes for SDRAM scheduler and controller.
* Program a known-good configuration for the SDRC to deal with buggy
* bootloaders.
*/
-void __init omap2_sdrc_init(struct omap_sdrc_params *sp) +void __init omap2_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
+ struct omap_sdrc_params *sdrc_cs1)
{
u32 l;

@@ -129,7 +147,8 @@ void __init omap2_sdrc_init(struct omap_sdrc_params *sp)
l |= (0x2 << 3);
sdrc_write_reg(l, SDRC_SYSCONFIG);

- sdrc_init_params = sp;
+ sdrc_init_params_cs0 = sdrc_cs0;
+ sdrc_init_params_cs1 = sdrc_cs1;

/* XXX Enable SRFRONIDLEREQ here also? */
l = (1 << SDRC_POWER_EXTCLKDIS_SHIFT) |

arch/arm/mach-omap2/sram34xx.S +107 -30

193 lines not on this page · raw message

(quoted diff) +0 -0

b/arch/arm/plat-omap/include/mach/io.h
index 54c159b..d4c78b4 100644

arch/arm/plat-omap/include/mach/io.h +2 -1
@@ -192,7 +192,8 @@ extern void omap1_map_common_io(void);
 extern void omap1_init_common_hw(void);
 
 extern void omap2_map_common_io(void);
-extern void omap2_init_common_hw(struct omap_sdrc_params *sp,
+extern void omap2_init_common_hw(struct omap_sdrc_params *sdrc_cs0,
+				 struct omap_sdrc_params *sdrc_cs1,
 				 struct omap_opp *mpu_opps,
 				 struct omap_opp *dsp_opps,
 				 struct omap_opp *l3_opps);
(quoted diff) +0 -0

b/arch/arm/plat-omap/include/mach/mux.h
index f7e298a..7368aba 100644

arch/arm/plat-omap/include/mach/mux.h +4 -0
@@ -803,6 +803,10 @@ enum omap34xx_index {
 	AE5_34XX_GPIO143,
 	H19_34XX_GPIO164_OUT,
 	J25_34XX_GPIO170,
+
+	/* OMAP3 SDRC CKE signals to SDR/DDR ram chips */
+	H16_34XX_SDRC_CKE0,
+	H17_34XX_SDRC_CKE1,
 };
 
 struct omap_mux_cfg {
(quoted diff) +0 -0

b/arch/arm/plat-omap/include/mach/sdrc.h
index a678bc8..7e22143 100644

arch/arm/plat-omap/include/mach/sdrc.h +5 -3
@@ -114,9 +114,11 @@ struct omap_sdrc_params {
 
 void omap2_sms_save_context(void);
 void omap2_sms_restore_context(void);
-void __init omap2_sdrc_init(struct omap_sdrc_params *);
-struct omap_sdrc_params *omap2_sdrc_get_params(unsigned long r);
-
+void __init omap2_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
+			    struct omap_sdrc_params *sdrc_cs1);
+int omap2_sdrc_get_params(unsigned long r,
+			  struct omap_sdrc_params **sdrc_cs0,
+			  struct omap_sdrc_params **sdrc_cs1);
 #ifdef CONFIG_ARCH_OMAP2
 
 struct memory_timings {
(quoted diff) +0 -0

b/arch/arm/plat-omap/include/mach/sram.h
index ad0a600..98906ea 100644

arch/arm/plat-omap/include/mach/sram.h +0 -0
@@ -21,11 +21,13 @@ extern void omap2_sram_reprogram_sdrc(u32 perf_level, u32 

dll_val,
u32 mem_type);
extern u32 omap2_set_prcm(u32 dpll_ctrl_val, u32 sdrc_rfr_val, int bypass);

-extern u32 omap3_configure_core_dpll(u32 sdrc_rfr_ctrl,

-				     u32 sdrc_actim_ctrla,
-				     u32 sdrc_actim_ctrlb, u32 m2,
-				     u32 unlock_dll, u32 f, u32 sdrc_mr,
-				     u32 inc);

+extern u32 omap3_configure_core_dpll(
+ u32 m2, u32 unlock_dll, u32 f, u32 inc,
+ u32 sdrc_rfr_ctrl_0, u32 sdrc_actim_ctrl_a_0,
+ u32 sdrc_actim_ctrl_b_0, u32 sdrc_mr_0,
+ u32 sdrc_rfr_ctrl_1, u32 sdrc_actim_ctrl_a_1,
+ u32 sdrc_actim_ctrl_b_1, u32 sdrc_mr_1);
+
extern void omap3_sram_restore_context(void);

/* Do not use these */
@@ -61,11 +63,12 @@ extern void omap243x_sram_reprogram_sdrc(u32 perf_level, u32 dll_val,
extern unsigned long omap243x_sram_reprogram_sdrc_sz;

-extern u32 omap3_sram_configure_core_dpll(u32 sdrc_rfr_ctrl,

-					  u32 sdrc_actim_ctrla,
-					  u32 sdrc_actim_ctrlb, u32 m2,
-					  u32 unlock_dll, u32 f, u32 sdrc_mr,
-					  u32 inc);

+extern u32 omap3_sram_configure_core_dpll(
+ u32 m2, u32 unlock_dll, u32 f, u32 inc,
+ u32 sdrc_rfr_ctrl_0, u32 sdrc_actim_ctrl_a_0,
+ u32 sdrc_actim_ctrl_b_0, u32 sdrc_mr_0,
+ u32 sdrc_rfr_ctrl_1, u32 sdrc_actim_ctrl_a_1,
+ u32 sdrc_actim_ctrl_b_1, u32 sdrc_mr_1);
extern unsigned long omap3_sram_configure_core_dpll_sz;

#ifdef CONFIG_PM

arch/arm/plat-omap/sram.c +20 -14
index a2e60e7..517f45b 100644
@@ -368,23 +368,29 @@ static inline int omap243x_sram_init(void)
 
 #ifdef CONFIG_ARCH_OMAP3
 
-static u32 (*_omap3_sram_configure_core_dpll)(u32 sdrc_rfr_ctrl,
-					      u32 sdrc_actim_ctrla,
-					      u32 sdrc_actim_ctrlb,
-					      u32 m2, u32 unlock_dll,
-					      u32 f, u32 sdrc_mr, u32 inc);
-u32 omap3_configure_core_dpll(u32 sdrc_rfr_ctrl, u32 sdrc_actim_ctrla,
-			      u32 sdrc_actim_ctrlb, u32 m2, u32 unlock_dll,
-			      u32 f, u32 sdrc_mr, u32 inc)
- {
+static u32 (*_omap3_sram_configure_core_dpll)(
+				u32 m2, u32 unlock_dll, u32 f, u32 inc,
+				u32 sdrc_rfr_ctrl_0, u32 sdrc_actim_ctrl_a_0,
+				u32 sdrc_actim_ctrl_b_0, u32 sdrc_mr_0,
+				u32 sdrc_rfr_ctrl_1, u32 sdrc_actim_ctrl_a_1,
+				u32 sdrc_actim_ctrl_b_1, u32 sdrc_mr_1);
+
+u32 omap3_configure_core_dpll(u32 m2, u32 unlock_dll, u32 f, u32 inc,
+			      u32 sdrc_rfr_ctrl_0, u32 sdrc_actim_ctrl_a_0,
+			      u32 sdrc_actim_ctrl_b_0, u32 sdrc_mr_0,
+			      u32 sdrc_rfr_ctrl_1, u32 sdrc_actim_ctrl_a_1,
+			      u32 sdrc_actim_ctrl_b_1, u32 sdrc_mr_1)
+{
 	if (!_omap3_sram_configure_core_dpll)
 		omap_sram_error();
 
-	return _omap3_sram_configure_core_dpll(sdrc_rfr_ctrl,
-					       sdrc_actim_ctrla,
-					       sdrc_actim_ctrlb, m2,
-					       unlock_dll, f, sdrc_mr, inc);
- }
+	return _omap3_sram_configure_core_dpll(
+				m2, unlock_dll, f, inc,
+				sdrc_rfr_ctrl_0, sdrc_actim_ctrl_a_0,
+				sdrc_actim_ctrl_b_0, sdrc_mr_0,
+				sdrc_rfr_ctrl_1, sdrc_actim_ctrl_a_1,
+				sdrc_actim_ctrl_b_1, sdrc_mr_1);
+}
 
 #ifdef CONFIG_PM
 void omap3_sram_restore_context(void)
Signature · 1 line
1.6.2.5.168.g3823
Quoted 47 lines · On Wednesday 03 June 2009 01:40:13 Paul Walmsley wrote:

Hi Jean,

a minor request: it is easier to comment on these patches if they are included inline in the E-mail message, rather than attached. That way code comments can be inlined in the reply.

Quoted 2 lines · Jean Pihet

Here is a patch for the SDRC 2nd CS support. It applies on top of the current pm branch.

Thanks for doing this work.

Quoted 3 lines

I have some questions:
- Is it OK to copy the micron sdram params file to a new file with the 2 CSes params? One could use a unique file with #ifdef SDRC_SUPPORT_2_CSES.

Is it possible for the SDRAM parameter files to remain unchanged, and to simply pass two struct omap_sdrc_params * to omap2_init_common_hw() and then to omap2_sdrc_init()? Boards with only CS0 in use should pass NULL for the second omap_sdrc_params *.

So something like this (I realize the PM branch has additional parameters here also):

void __init omap2_init_common_hw(struct omap_sdrc_params *sdrc_cs0,
struct omap_sdrc_params *sdrc_cs1)

Then:

void __init omap2_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
struct omap_sdrc_params *sdrc_cs1)

I would prefer that approach.

It would also be good to avoid changing the SDRC CS1 parameters in the SRAM code if the board does not use CS1. Maybe pass in a flag that indicates whether CS1 is in use, and if not, avoid programming those registers? The (admittedly minor) overhead of loading the CS1 registers off the stack would be nice to avoid also.

Quoted 2 lines

- Does the RX51 board have 2 sdram parts? If so I need to update the board file as well.

Probably best if someone from Nokia handles this.

- Paul

maintainer Acked-by
#13 lore raw

Re: [RFC][PATCH] OMAP3: add support for 2 SDRAM chip selects (was: Re: Beagleboard rev C memory timings & suspend/resume)

Hi Jean,

Quoted 10 lines · Jean Pihet

Here is the new patch that includes all the remarks and suggestion. The description is here below.

Some notes:
- all calls to omap2_init_common_hw have been adapted in the board files. it looks like 2430SDP and Pandora board files are broken since they use only one param. Can that be checked on those boards?
- it is assumed that RX51 only uses 1 CS. Is that correct?

Can you review it and possibly merge?

Looks great.

Tero, does RX51 use two SDRC chipselects!

Quoted 898 lines

Thanks & regards,
Jean

--
From 097a640997b74638e0e7200ecd5834205204c956 Mon Sep 17 00:00:00 2001
From: Jean Pihet <[email protected]>
Date: Fri, 5 Jun 2009 17:19:00 +0200
Subject: [PATCH] [PATCH] OMAP3: add support for 2 SDRAM chip selects

Some boards (Beagle Cx, Overo) have 2 SDRAM parts
connected to the SDRC.

This patch adds the following:
- ensure that the CKE signals mux settings are correct
- add a new argument of type omap_sdrc_params struct* to omap2_init_common_hw and omap2_sdrc_init for the 2nd CS params
- adapted the OMAP boards files to the new prototype of omap2_init_common_hw. Only Beagle and Overo are using the 2 CS'es
- adapt the sram sleep code to configure the SDRC for the 2nd CS

Note: If the 2nd param to omap2_init_common_hw is NULL, then the parameters are not programmed into the SDRC CS1 registers

Tested on 3430 SDP and Beagleboard rev C2 and B5, with suspend/resume and frequency changes (cpufreq).

Thanks to Paul Walmsley and Kevin Hilman for the suggestions and code reviews.

---
 arch/arm/mach-omap2/board-2430sdp.c      |    2 +-
 arch/arm/mach-omap2/board-3430sdp.c      |    6 +-
 arch/arm/mach-omap2/board-apollon.c      |    2 +-
 arch/arm/mach-omap2/board-generic.c      |    2 +-
 arch/arm/mach-omap2/board-h4.c           |    2 +-
 arch/arm/mach-omap2/board-ldp.c          |    2 +-
 arch/arm/mach-omap2/board-n800.c         |    2 +-
 arch/arm/mach-omap2/board-omap2evm.c     |    2 +-
 arch/arm/mach-omap2/board-omap3beagle.c  |   11 ++-
 arch/arm/mach-omap2/board-omap3evm.c     |    6 +-
 arch/arm/mach-omap2/board-omap3pandora.c |    3 +-
 arch/arm/mach-omap2/board-overo.c        |    8 ++-
 arch/arm/mach-omap2/board-rx51.c         |    6 +-
 arch/arm/mach-omap2/clock34xx.c          |   37 ++++++--
 arch/arm/mach-omap2/io.c                 |    5 +-
 arch/arm/mach-omap2/mux.c                |    6 ++
 arch/arm/mach-omap2/sdrc.c               |   63 +++++++++-----
 arch/arm/mach-omap2/sram34xx.S           |  137 
+++++++++++++++++++++++-------
 arch/arm/plat-omap/include/mach/io.h     |    3 +-
 arch/arm/plat-omap/include/mach/mux.h    |    4 +
 arch/arm/plat-omap/include/mach/sdrc.h   |    8 +-
 arch/arm/plat-omap/include/mach/sram.h   |   23 +++--
 arch/arm/plat-omap/sram.c                |   34 +++++---
 23 files changed, 266 insertions(+), 108 deletions(-)
arch/arm/mach-omap2/board-2430sdp.c +1 -1
index aa5df72..4cb7bc5 100644
@@ -322,7 +322,7 @@ out:
 
 static void __init omap_2430sdp_init_irq(void)
 {
-	omap2_init_common_hw(NULL);
+	omap2_init_common_hw(NULL, NULL, NULL, NULL, NULL);
 	omap_init_irq();
 	omap_gpio_init();
 	sdp2430_init_smc91x();
arch/arm/mach-omap2/board-3430sdp.c +4 -2
index 195b749..24e2728 100644
@@ -302,8 +302,10 @@ static inline void __init sdp3430_init_smc91x(void)
 
 static void __init omap_3430sdp_init_irq(void)
 {
-	omap2_init_common_hw(hyb18m512160af6_sdrc_params, omap3_mpu_rate_table,
-			     omap3_dsp_rate_table, omap3_l3_rate_table);
+	omap2_init_common_hw(hyb18m512160af6_sdrc_params, NULL,
+			     omap3_mpu_rate_table,
+			     omap3_dsp_rate_table,
+			     omap3_l3_rate_table);
 	omap_init_irq();
 	omap_gpio_init();
 	sdp3430_init_smc91x();
arch/arm/mach-omap2/board-apollon.c +1 -1
index 2e24812..2dd1350 100644
@@ -323,7 +323,7 @@ out:
 
 static void __init omap_apollon_init_irq(void)
 {
-	omap2_init_common_hw(NULL, NULL, NULL, NULL);
+	omap2_init_common_hw(NULL, NULL, NULL, NULL, NULL);
 	omap_init_irq();
 	omap_gpio_init();
 	apollon_init_smc91x();
arch/arm/mach-omap2/board-generic.c +1 -1
index be763a9..763329b 100644
@@ -33,7 +33,7 @@
 
 static void __init omap_generic_init_irq(void)
 {
-	omap2_init_common_hw(NULL, NULL, NULL, NULL);
+	omap2_init_common_hw(NULL, NULL, NULL, NULL, NULL);
 	omap_init_irq();
 }
 
arch/arm/mach-omap2/board-h4.c +1 -1
index 8f54939..17c3599 100644
@@ -348,7 +348,7 @@ static void __init h4_init_flash(void)
 
 static void __init omap_h4_init_irq(void)
 {
-	omap2_init_common_hw(NULL, NULL, NULL, NULL);
+	omap2_init_common_hw(NULL, NULL, NULL, NULL, NULL);
 	omap_init_irq();
 	omap_gpio_init();
 	h4_init_flash();
arch/arm/mach-omap2/board-ldp.c +1 -1
index 9f41dc9..b012806 100644
@@ -344,7 +344,7 @@ static inline void __init ldp_init_smc911x(void)
 
 static void __init omap_ldp_init_irq(void)
 {
-	omap2_init_common_hw(NULL, NULL, NULL, NULL);
+	omap2_init_common_hw(NULL, NULL, NULL, NULL, NULL);
 	omap_init_irq();
 	omap_gpio_init();
 	ldp_init_smc911x();
arch/arm/mach-omap2/board-n800.c +1 -1
index ac7cf3f..ad53f4a 100644
@@ -127,7 +127,7 @@ static struct lm8323_platform_data lm8323_pdata = {
 
 void __init nokia_n800_init_irq(void)
 {
-	omap2_init_common_hw(NULL, NULL, NULL, NULL);
+	omap2_init_common_hw(NULL, NULL, NULL, NULL, NULL);
 	omap_init_irq();
 	omap_gpio_init();
 
arch/arm/mach-omap2/board-omap2evm.c +1 -1
index 4fac1be..56a26d4 100644
@@ -276,7 +276,7 @@ static struct twl4030_keypad_data omap2evm_kp_data = {
 
 static void __init omap2_evm_init_irq(void)
 {
-	omap2_init_common_hw(NULL, NULL, NULL, NULL);
+	omap2_init_common_hw(NULL, NULL, NULL, NULL, NULL);
 	omap_init_irq();
 	omap_gpio_init();
 	omap2evm_init_smc911x();
arch/arm/mach-omap2/board-omap3beagle.c +9 -2
index 7294dbf..872beb6 100644
@@ -312,8 +312,11 @@ static int __init omap3_beagle_i2c_init(void)
 
 static void __init omap3_beagle_init_irq(void)
 {
-	omap2_init_common_hw(mt46h32m32lf6_sdrc_params, omap3_mpu_rate_table,
-			     omap3_dsp_rate_table, omap3_l3_rate_table);
+	omap2_init_common_hw(mt46h32m32lf6_sdrc_params,
+			     mt46h32m32lf6_sdrc_params,
+			     omap3_mpu_rate_table,
+			     omap3_dsp_rate_table,
+			     omap3_l3_rate_table);
 	omap_init_irq();
 	omap_gpio_init();
 }
@@ -441,6 +444,10 @@ static void __init omap3_beagle_init(void)
 	usb_musb_init();
 	usb_ehci_init();
 	omap3beagle_flash_init();
+
+	/* Ensure SDRC pins are mux'd for self-refresh */
+	omap_cfg_reg(H16_34XX_SDRC_CKE0);
+	omap_cfg_reg(H17_34XX_SDRC_CKE1);
 }
 
 static void __init omap3_beagle_map_io(void)
arch/arm/mach-omap2/board-omap3evm.c +4 -2
index f017f0d..3b9c96a 100644
@@ -276,8 +276,10 @@ struct spi_board_info omap3evm_spi_board_info[] = {
 
 static void __init omap3_evm_init_irq(void)
 {
-	omap2_init_common_hw(mt46h32m32lf6_sdrc_params, omap3_mpu_rate_table,
-	                     omap3_dsp_rate_table, omap3_l3_rate_table);
+	omap2_init_common_hw(mt46h32m32lf6_sdrc_params, NULL,
+			     omap3_mpu_rate_table,
+			     omap3_dsp_rate_table,
+			     omap3_l3_rate_table);
 	omap_init_irq();
 	omap_gpio_init();
 	omap3evm_init_smc911x();
arch/arm/mach-omap2/board-omap3pandora.c +2 -1
index c67f62f..05ab99e 100644
@@ -220,7 +220,8 @@ static int __init omap3pandora_i2c_init(void)
 
 static void __init omap3pandora_init_irq(void)
 {
-	omap2_init_common_hw(mt46h32m32lf6_sdrc_params);
+	omap2_init_common_hw(mt46h32m32lf6_sdrc_params, NULL,
+			     NULL, NULL, NULL);
 	omap_init_irq();
 	omap_gpio_init();
 }
arch/arm/mach-omap2/board-overo.c +7 -1
index 9eae608..2c6d2c5 100644
@@ -355,7 +355,9 @@ static int __init overo_i2c_init(void)
 
 static void __init overo_init_irq(void)
 {
-	omap2_init_common_hw(mt46h32m32lf6_sdrc_params, NULL, NULL, NULL);
+	omap2_init_common_hw(mt46h32m32lf6_sdrc_params,
+			     mt46h32m32lf6_sdrc_params,
+			     NULL, NULL, NULL);
 	omap_init_irq();
 	omap_gpio_init();
 }
@@ -391,6 +393,10 @@ static void __init overo_init(void)
 	overo_init_smsc911x();
 	overo_ads7846_init();
 
+	/* Ensure SDRC pins are mux'd for self-refresh */
+	omap_cfg_reg(H16_34XX_SDRC_CKE0);
+	omap_cfg_reg(H17_34XX_SDRC_CKE1);
+
 	if ((gpio_request(OVERO_GPIO_W2W_NRESET,
 			  "OVERO_GPIO_W2W_NRESET") == 0) &&
 	    (gpio_direction_output(OVERO_GPIO_W2W_NRESET, 1) == 0)) {
arch/arm/mach-omap2/board-rx51.c +4 -2
index 09035b0..d48459f 100644
@@ -64,8 +64,10 @@ static struct omap_board_config_kernel rx51_config[] = {
 
 static void __init rx51_init_irq(void)
 {
-	omap2_init_common_hw(rx51_get_sdram_timings(), omap3_mpu_rate_table,
-			     omap3_dsp_rate_table, omap3_l3_rate_table);
+	omap2_init_common_hw(rx51_get_sdram_timings(), NULL,
+			     omap3_mpu_rate_table,
+			     omap3_dsp_rate_table,
+			     omap3_l3_rate_table);
 	omap_init_irq();
 	omap_gpio_init();
 }
arch/arm/mach-omap2/clock34xx.c +3 -1
index 3cee6b4..f262787 100644
@@ -478,7 +478,9 @@ static int omap3_core_dpll_m2_set_rate(struct clk *clk, 
 unsigned long rate)
 	u32 unlock_dll = 0;
 	u32 c;
 	unsigned long validrate, sdrcrate, mpurate;
-	struct omap_sdrc_params *sp;
+	struct omap_sdrc_params *sdrc_cs0;
+	struct omap_sdrc_params *sdrc_cs1;
+	int ret;
 
 	if (!clk || !rate)
arch/arm/mach-omap2/clock34xx.c +2 -2
 		return -EINVAL;
@@ -496,8 +498,8 @@ static int omap3_core_dpll_m2_set_rate(struct clk *clk, 
 unsigned long rate)
 	else
 		sdrcrate >>= ((clk->rate / rate) >> 1);
 
-	sp = omap2_sdrc_get_params(sdrcrate);
-	if (!sp)
+	ret = omap2_sdrc_get_params(sdrcrate, &sdrc_cs0, &sdrc_cs1);
+	if (ret)
 		return -EINVAL;
 
arch/arm/mach-omap2/clock34xx.c +23 -6
 	if (sdrcrate < MIN_SDRC_DLL_LOCK_FREQ) {
@@ -518,12 +520,29 @@ static int omap3_core_dpll_m2_set_rate(struct clk *clk, 
 unsigned long rate)
 
 	pr_debug("clock: changing CORE DPLL rate from %lu to %lu\n", clk->rate,
 		 validrate);
-	pr_debug("clock: SDRC timing params used: %08x %08x %08x\n",
-		 sp->rfr_ctrl, sp->actim_ctrla, sp->actim_ctrlb);
-
-	omap3_configure_core_dpll(sp->rfr_ctrl, sp->actim_ctrla,
-				  sp->actim_ctrlb, new_div, unlock_dll, c,
-				  sp->mr, rate > clk->rate);
+	pr_debug("clock: SDRC CS0 timing params used:"
+		 " RFR %08x CTRLA %08x CTRLB %08x MR %08x\n",
+		 sdrc_cs0->rfr_ctrl, sdrc_cs0->actim_ctrla,
+		 sdrc_cs0->actim_ctrlb, sdrc_cs0->mr);
+	if (sdrc_cs1)
+		pr_debug("clock: SDRC CS1 timing params used: "
+		 " RFR %08x CTRLA %08x CTRLB %08x MR %08x\n",
+		 sdrc_cs1->rfr_ctrl, sdrc_cs1->actim_ctrla,
+		 sdrc_cs1->actim_ctrlb, sdrc_cs1->mr);
+
+	if (sdrc_cs1)
+		omap3_configure_core_dpll(
+				  new_div, unlock_dll, c, rate > clk->rate,
+				  sdrc_cs0->rfr_ctrl, sdrc_cs0->actim_ctrla,
+				  sdrc_cs0->actim_ctrlb, sdrc_cs0->mr,
+				  sdrc_cs1->rfr_ctrl, sdrc_cs1->actim_ctrla,
+				  sdrc_cs1->actim_ctrlb, sdrc_cs1->mr);
+	else
+		omap3_configure_core_dpll(
+				  new_div, unlock_dll, c, rate > clk->rate,
+				  sdrc_cs0->rfr_ctrl, sdrc_cs0->actim_ctrla,
+				  sdrc_cs0->actim_ctrlb, sdrc_cs0->mr,
+				  0, 0, 0, 0);
 
 	return 0;

}

arch/arm/mach-omap2/io.c +3 -2
index 6fb6c29..aa000b4 100644
@@ -231,7 +231,8 @@ static int __init _omap2_init_reprogram_sdrc(void)
 	return v;
 }
 
-void __init omap2_init_common_hw(struct omap_sdrc_params *sp,
+void __init omap2_init_common_hw(struct omap_sdrc_params *sdrc_cs0,
+				 struct omap_sdrc_params *sdrc_cs1,
 				 struct omap_opp *mpu_opps,
 				 struct omap_opp *dsp_opps,
 				 struct omap_opp *l3_opps)
@@ -244,7 +245,7 @@ void __init omap2_init_common_hw(struct omap_sdrc_params 
 *sp,
 	omapdev_init(omapdevs);
 	omap2_clk_init();
 	omap_pm_if_init();
-	omap2_sdrc_init(sp);
+	omap2_sdrc_init(sdrc_cs0, sdrc_cs1);
 
 	_omap2_init_reprogram_sdrc();
arch/arm/mach-omap2/mux.c +6 -0
index 026c4fc..43d6b92 100644
@@ -486,6 +486,12 @@ MUX_CFG_34XX("H19_34XX_GPIO164_OUT", 0x19c,
 		OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_OUTPUT)
 MUX_CFG_34XX("J25_34XX_GPIO170", 0x1c6,
 		OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_INPUT)
+
+/* OMAP3 SDRC CKE signals to SDR/DDR ram chips */
+MUX_CFG_34XX("H16_34XX_SDRC_CKE0", 0x262,
+		OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_OUTPUT)
+MUX_CFG_34XX("H17_34XX_SDRC_CKE1", 0x264,
+		OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_OUTPUT)
 };
 
 #define OMAP34XX_PINS_SZ	ARRAY_SIZE(omap34xx_pins)
arch/arm/mach-omap2/sdrc.c +36 -20
index c832d83..b42f5ae 100644
@@ -32,7 +32,7 @@
 #include <mach/sdrc.h>
 #include "sdrc.h"
 
-static struct omap_sdrc_params *sdrc_init_params;
+static struct omap_sdrc_params *sdrc_init_params_cs0, *sdrc_init_params_cs1;
 
 void __iomem *omap2_sdrc_base;
 void __iomem *omap2_sms_base;
@@ -71,33 +71,49 @@ void omap2_sms_restore_context(void)
 /**
  * omap2_sdrc_get_params - return SDRC register values for a given clock rate
  * @r: SDRC clock rate (in Hz)
+ * @sdrc_cs0: chip select 0 ram timings **
+ * @sdrc_cs1: chip select 1 ram timings **
  *
  * Return pre-calculated values for the SDRC_ACTIM_CTRLA,
- * SDRC_ACTIM_CTRLB, SDRC_RFR_CTRL, and SDRC_MR registers, for a given
- * SDRC clock rate 'r'.  These parameters control various timing
- * delays in the SDRAM controller that are expressed in terms of the
- * number of SDRC clock cycles to wait; hence the clock rate
- * dependency. Note that sdrc_init_params must be sorted rate
- * descending.  Also assumes that both chip-selects use the same
- * timing parameters.  Returns a struct omap_sdrc_params * upon
- * success, or NULL upon failure.
+ *  SDRC_ACTIM_CTRLB, SDRC_RFR_CTRL and SDRC_MR registers in sdrc_cs[01]
+ *  structs,for a given SDRC clock rate 'r'.
+ * These parameters control various timing delays in the SDRAM controller
+ *  that are expressed in terms of the number of SDRC clock cycles to
+ *  wait; hence the clock rate dependency.
+ *
+ * Supports 2 different timing parameters for both chip selects.
+ *
+ * Note 1: the sdrc_init_params_cs[01] must be sorted rate descending.
+ * Note 2: If sdrc_init_params_cs_1 is not NULL it must be of same size
+ *  as sdrc_init_params_cs_0.
+ *
+ * Fills in the struct omap_sdrc_params * for each chip select.
+ * Returns 0 upon success or -1 upon failure.
  */
-struct omap_sdrc_params *omap2_sdrc_get_params(unsigned long r)
+int omap2_sdrc_get_params(unsigned long r,
+			  struct omap_sdrc_params **sdrc_cs0,
+			  struct omap_sdrc_params **sdrc_cs1)
 {
-	struct omap_sdrc_params *sp;
+	struct omap_sdrc_params *sp0, *sp1;
 
-	if (!sdrc_init_params)
-		return NULL;
+	if (!sdrc_init_params_cs0)
+		return -1;
 
-	sp = sdrc_init_params;
+	sp0 = sdrc_init_params_cs0;
+	sp1 = sdrc_init_params_cs1;
 
-	while (sp->rate && sp->rate != r)
-		sp++;
+	while (sp0->rate && sp0->rate != r) {
+		sp0++;
+		if (sdrc_init_params_cs1)
+			sp1++;
+	}
 
-	if (!sp->rate)
-		return NULL;
+	if (!sp0->rate)
+		return -1;
 
-	return sp;
+	*sdrc_cs0 = sp0;
+	*sdrc_cs1 = sp1;
+	return 0;
 }
 
 
@@ -109,13 +125,15 @@ void __init omap2_set_globals_sdrc(struct omap_globals 
 *omap2_globals)
 
 /**
  * omap2_sdrc_init - initialize SMS, SDRC devices on boot
- * @sp: pointer to a null-terminated list of struct omap_sdrc_params
+ * @sdrc_cs[01]: pointers to a null-terminated list of struct 

omap_sdrc_params
+ * Support for 2 chip selects timings
*
* Turn on smart idle modes for SDRAM scheduler and controller.
* Program a known-good configuration for the SDRC to deal with buggy
* bootloaders.
*/

arch/arm/mach-omap2/sdrc.c +4 -2
-void __init omap2_sdrc_init(struct omap_sdrc_params *sp)
+void __init omap2_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
+			    struct omap_sdrc_params *sdrc_cs1)
 {
 	u32 l;
@@ -129,7 +147,8 @@ void __init omap2_sdrc_init(struct omap_sdrc_params *sp)
 	l |= (0x2 << 3);
 	sdrc_write_reg(l, SDRC_SYSCONFIG);
 
-	sdrc_init_params = sp;
+	sdrc_init_params_cs0 = sdrc_cs0;
+	sdrc_init_params_cs1 = sdrc_cs1;
 
 	/* XXX Enable SRFRONIDLEREQ here also? */
 	l = (1 << SDRC_POWER_EXTCLKDIS_SHIFT) |
arch/arm/mach-omap2/sram34xx.S +107 -30
index f41f8d9..3aef744 100644
@@ -36,7 +36,7 @@
 
 	.text
 
-/* r4 parameters */
+/* r1 parameters */
 #define SDRC_NO_UNLOCK_DLL		0x0
 #define SDRC_UNLOCK_DLL			0x1
 
@@ -71,40 +71,71 @@
 
 /*
  * omap3_sram_configure_core_dpll - change DPLL3 M2 divider
- * r0 = new SDRC_RFR_CTRL register contents
- * r1 = new SDRC_ACTIM_CTRLA register contents
- * r2 = new SDRC_ACTIM_CTRLB register contents
- * r3 = new M2 divider setting (only 1 and 2 supported right now)
- * r4 = unlock SDRC DLL? (1 = yes, 0 = no).  Only unlock DLL for
+ *
+ * Params passed in registers:
+ *  r0 = new M2 divider setting (only 1 and 2 supported right now)
+ *  r1 = unlock SDRC DLL? (1 = yes, 0 = no).  Only unlock DLL for
  *      SDRC rates < 83MHz
- * r5 = number of MPU cycles to wait for SDRC to stabilize after
+ *  r2 = number of MPU cycles to wait for SDRC to stabilize after
  *      reprogramming the SDRC when switching to a slower MPU speed
- * r6 = new SDRC_MR_0 register value
- * r7 = increasing SDRC rate? (1 = yes, 0 = no)
+ *  r3 = increasing SDRC rate? (1 = yes, 0 = no)
+ *
+ * Params passed via the stack. The needed params will be copied in SRAM
+ *  before use by the code in SRAM (SDRAM is not accessible during SDRC
+ *  reconfiguration):
+ *  new SDRC_RFR_CTRL_0 register contents
+ *  new SDRC_ACTIM_CTRL_A_0 register contents
+ *  new SDRC_ACTIM_CTRL_B_0 register contents
+ *  new SDRC_MR_0 register value
+ *  new SDRC_RFR_CTRL_1 register contents
+ *  new SDRC_ACTIM_CTRL_A_1 register contents
+ *  new SDRC_ACTIM_CTRL_B_1 register contents
+ *  new SDRC_MR_1 register value
  *
+ * If the param SDRC_RFR_CTRL_1 is 0, the parameters
+ *  are not programmed into the SDRC CS1 registers
  */
 ENTRY(omap3_sram_configure_core_dpll)
 	stmfd	sp!, {r1-r12, lr}	@ store regs to stack
-	ldr	r4, [sp, #52]		@ pull extra args off the stack
-	ldr	r5, [sp, #56]		@ load extra args from the stack
-	ldr	r6, [sp, #60]		@ load extra args from the stack
-	ldr	r7, [sp, #64]		@ load extra args from the stack
+
+					@ pull the extra args off the stack
+					@  and store them in SRAM
+	ldr	r4, [sp, #52]
+	str     r4, omap_sdrc_rfr_ctrl_0_val
+	ldr	r4, [sp, #56]
+	str     r4, omap_sdrc_actim_ctrl_a_0_val
+	ldr	r4, [sp, #60]
+	str     r4, omap_sdrc_actim_ctrl_b_0_val
+	ldr	r4, [sp, #64]
+	str     r4, omap_sdrc_mr_0_val
+	ldr	r4, [sp, #68]
+	str     r4, omap_sdrc_rfr_ctrl_1_val
+	cmp	r4, #0			@ if SDRC_RFR_CTRL_1 is 0,
+	beq	skip_cs1_params		@  do not use cs1 params
+	ldr	r4, [sp, #72]
+	str     r4, omap_sdrc_actim_ctrl_a_1_val
+	ldr	r4, [sp, #76]
+	str     r4, omap_sdrc_actim_ctrl_b_1_val
+	ldr	r4, [sp, #80]
+	str     r4, omap_sdrc_mr_1_val
+skip_cs1_params:
 	dsb				@ flush buffered writes to interconnect
-	cmp	r7, #1			@ if increasing SDRC clk rate,
+
+	cmp	r3, #1			@ if increasing SDRC clk rate,
 	bleq	configure_sdrc		@ program the SDRC regs early (for RFR)
-	cmp	r4, #SDRC_UNLOCK_DLL	@ set the intended DLL state
+	cmp	r1, #SDRC_UNLOCK_DLL	@ set the intended DLL state
 	bleq	unlock_dll
 	blne	lock_dll
 	bl	sdram_in_selfrefresh	@ put SDRAM in self refresh, idle SDRC
 	bl 	configure_core_dpll	@ change the DPLL3 M2 divider
 	bl	enable_sdrc		@ take SDRC out of idle
-	cmp	r4, #SDRC_UNLOCK_DLL	@ wait for DLL status to change
+	cmp	r1, #SDRC_UNLOCK_DLL	@ wait for DLL status to change
 	bleq	wait_dll_unlock
 	blne	wait_dll_lock
-	cmp	r7, #1			@ if increasing SDRC clk rate,
+	cmp	r3, #1			@ if increasing SDRC clk rate,
 	beq	return_to_sdram		@ return to SDRAM code, otherwise,
 	bl	configure_sdrc		@ reprogram SDRC regs now
-	mov	r12, r5
+	mov	r12, r2
 	bl	wait_clk_stable		@ wait for SDRC to stabilize
 return_to_sdram:
 	isb				@ prevent speculative exec past here
@@ -149,7 +180,7 @@ configure_core_dpll:
 	ldr	r12, [r11]
 	ldr	r10, core_m2_mask_val	@ modify m2 for core dpll
 	and	r12, r12, r10
-	orr	r12, r12, r3, lsl #CORE_DPLL_CLKOUT_DIV_SHIFT
+	orr	r12, r12, r0, lsl #CORE_DPLL_CLKOUT_DIV_SHIFT
 	str	r12, [r11]
 	ldr	r12, [r11]		@ posted-write barrier for CM
 	bx	lr
@@ -187,15 +218,34 @@ wait_dll_unlock:
 	bne	wait_dll_unlock
 	bx	lr
 configure_sdrc:
-	ldr	r11, omap3_sdrc_rfr_ctrl
-	str	r0, [r11]
-	ldr	r11, omap3_sdrc_actim_ctrla
-	str	r1, [r11]
-	ldr	r11, omap3_sdrc_actim_ctrlb
-	str	r2, [r11]
+	ldr	r12, omap_sdrc_rfr_ctrl_0_val	@ fetch value from SRAM
+	ldr	r11, omap3_sdrc_rfr_ctrl_0	@ fetch addr from SRAM
+	str	r12, [r11]			@ store
+	ldr	r12, omap_sdrc_actim_ctrl_a_0_val
+	ldr	r11, omap3_sdrc_actim_ctrl_a_0
+	str	r12, [r11]
+	ldr	r12, omap_sdrc_actim_ctrl_b_0_val
+	ldr	r11, omap3_sdrc_actim_ctrl_b_0
+	str	r12, [r11]
+	ldr	r12, omap_sdrc_mr_0_val
 	ldr	r11, omap3_sdrc_mr_0
-	str	r6, [r11]
-	ldr	r6, [r11]		@ posted-write barrier for SDRC
+	str	r12, [r11]
+	ldr	r12, omap_sdrc_rfr_ctrl_1_val
+	cmp	r12, #0			@ if SDRC_RFR_CTRL_1 is 0,
+	beq	skip_cs1_prog		@  do not program cs1 params
+	ldr	r11, omap3_sdrc_rfr_ctrl_1
+	str	r12, [r11]
+	ldr	r12, omap_sdrc_actim_ctrl_a_1_val
+	ldr	r11, omap3_sdrc_actim_ctrl_a_1
+	str	r12, [r11]
+	ldr	r12, omap_sdrc_actim_ctrl_b_1_val
+	ldr	r11, omap3_sdrc_actim_ctrl_b_1
+	str	r12, [r11]
+	ldr	r12, omap_sdrc_mr_1_val
+	ldr	r11, omap3_sdrc_mr_1
+	str	r12, [r11]
+skip_cs1_prog:
+	ldr	r12, [r11]		@ posted-write barrier for SDRC
 	bx	lr
 
 omap3_sdrc_power:
@@ -206,14 +256,40 @@ omap3_cm_idlest1_core:
 	.word OMAP34XX_CM_REGADDR(CORE_MOD, CM_IDLEST)
 omap3_cm_iclken1_core:
 	.word OMAP34XX_CM_REGADDR(CORE_MOD, CM_ICLKEN1)
-omap3_sdrc_rfr_ctrl:
+
+omap3_sdrc_rfr_ctrl_0:
 	.word OMAP34XX_SDRC_REGADDR(SDRC_RFR_CTRL_0)
-omap3_sdrc_actim_ctrla:
+omap3_sdrc_rfr_ctrl_1:
+	.word OMAP34XX_SDRC_REGADDR(SDRC_RFR_CTRL_1)
+omap3_sdrc_actim_ctrl_a_0:
 	.word OMAP34XX_SDRC_REGADDR(SDRC_ACTIM_CTRL_A_0)
-omap3_sdrc_actim_ctrlb:
+omap3_sdrc_actim_ctrl_a_1:
+	.word OMAP34XX_SDRC_REGADDR(SDRC_ACTIM_CTRL_A_1)
+omap3_sdrc_actim_ctrl_b_0:
 	.word OMAP34XX_SDRC_REGADDR(SDRC_ACTIM_CTRL_B_0)
+omap3_sdrc_actim_ctrl_b_1:
+	.word OMAP34XX_SDRC_REGADDR(SDRC_ACTIM_CTRL_B_1)
 omap3_sdrc_mr_0:
 	.word OMAP34XX_SDRC_REGADDR(SDRC_MR_0)
+omap3_sdrc_mr_1:
+	.word OMAP34XX_SDRC_REGADDR(SDRC_MR_1)
+omap_sdrc_rfr_ctrl_0_val:
+	.word 0xDEADBEEF
+omap_sdrc_rfr_ctrl_1_val:
+	.word 0xDEADBEEF
+omap_sdrc_actim_ctrl_a_0_val:
+	.word 0xDEADBEEF
+omap_sdrc_actim_ctrl_a_1_val:
+	.word 0xDEADBEEF
+omap_sdrc_actim_ctrl_b_0_val:
+	.word 0xDEADBEEF
+omap_sdrc_actim_ctrl_b_1_val:
+	.word 0xDEADBEEF
+omap_sdrc_mr_0_val:
+	.word 0xDEADBEEF
+omap_sdrc_mr_1_val:
+	.word 0xDEADBEEF
+
 omap3_sdrc_dlla_status:
 	.word OMAP34XX_SDRC_REGADDR(SDRC_DLLA_STATUS)
 omap3_sdrc_dlla_ctrl:
@@ -223,3 +299,4 @@ core_m2_mask_val:
 
 ENTRY(omap3_sram_configure_core_dpll_sz)
 	.word	. - omap3_sram_configure_core_dpll
+
arch/arm/plat-omap/include/mach/io.h +2 -1
index 54c159b..d4c78b4 100644
@@ -192,7 +192,8 @@ extern void omap1_map_common_io(void);
 extern void omap1_init_common_hw(void);
 
 extern void omap2_map_common_io(void);
-extern void omap2_init_common_hw(struct omap_sdrc_params *sp,
+extern void omap2_init_common_hw(struct omap_sdrc_params *sdrc_cs0,
+				 struct omap_sdrc_params *sdrc_cs1,
 				 struct omap_opp *mpu_opps,
 				 struct omap_opp *dsp_opps,
 				 struct omap_opp *l3_opps);
arch/arm/plat-omap/include/mach/mux.h +4 -0
index f7e298a..7368aba 100644
@@ -803,6 +803,10 @@ enum omap34xx_index {
 	AE5_34XX_GPIO143,
 	H19_34XX_GPIO164_OUT,
 	J25_34XX_GPIO170,
+
+	/* OMAP3 SDRC CKE signals to SDR/DDR ram chips */
+	H16_34XX_SDRC_CKE0,
+	H17_34XX_SDRC_CKE1,
 };
 
 struct omap_mux_cfg {
arch/arm/plat-omap/include/mach/sdrc.h +5 -3
index a678bc8..7e22143 100644
@@ -114,9 +114,11 @@ struct omap_sdrc_params {
 
 void omap2_sms_save_context(void);
 void omap2_sms_restore_context(void);
-void __init omap2_sdrc_init(struct omap_sdrc_params *);
-struct omap_sdrc_params *omap2_sdrc_get_params(unsigned long r);
-
+void __init omap2_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
+			    struct omap_sdrc_params *sdrc_cs1);
+int omap2_sdrc_get_params(unsigned long r,
+			  struct omap_sdrc_params **sdrc_cs0,
+			  struct omap_sdrc_params **sdrc_cs1);
 #ifdef CONFIG_ARCH_OMAP2
 
 struct memory_timings {
arch/arm/plat-omap/include/mach/sram.h +7 -5
index ad0a600..98906ea 100644
@@ -21,11 +21,13 @@ extern void omap2_sram_reprogram_sdrc(u32 perf_level, u32 
 dll_val,
 				      u32 mem_type);
 extern u32 omap2_set_prcm(u32 dpll_ctrl_val, u32 sdrc_rfr_val, int bypass);
 
-extern u32 omap3_configure_core_dpll(u32 sdrc_rfr_ctrl,
-				     u32 sdrc_actim_ctrla,
-				     u32 sdrc_actim_ctrlb, u32 m2,
-				     u32 unlock_dll, u32 f, u32 sdrc_mr,
-				     u32 inc);
+extern u32 omap3_configure_core_dpll(
+			u32 m2, u32 unlock_dll, u32 f, u32 inc,
+			u32 sdrc_rfr_ctrl_0, u32 sdrc_actim_ctrl_a_0,
+			u32 sdrc_actim_ctrl_b_0, u32 sdrc_mr_0,
+			u32 sdrc_rfr_ctrl_1, u32 sdrc_actim_ctrl_a_1,
+			u32 sdrc_actim_ctrl_b_1, u32 sdrc_mr_1);
+
 extern void omap3_sram_restore_context(void);
 

/* Do not use these */

arch/arm/plat-omap/include/mach/sram.h +6 -5
@@ -61,11 +63,12 @@ extern void omap243x_sram_reprogram_sdrc(u32 perf_level, 
 u32 dll_val,
 extern unsigned long omap243x_sram_reprogram_sdrc_sz;
 
 
-extern u32 omap3_sram_configure_core_dpll(u32 sdrc_rfr_ctrl,
-					  u32 sdrc_actim_ctrla,
-					  u32 sdrc_actim_ctrlb, u32 m2,
-					  u32 unlock_dll, u32 f, u32 sdrc_mr,
-					  u32 inc);
+extern u32 omap3_sram_configure_core_dpll(
+			u32 m2, u32 unlock_dll, u32 f, u32 inc,
+			u32 sdrc_rfr_ctrl_0, u32 sdrc_actim_ctrl_a_0,
+			u32 sdrc_actim_ctrl_b_0, u32 sdrc_mr_0,
+			u32 sdrc_rfr_ctrl_1, u32 sdrc_actim_ctrl_a_1,
+			u32 sdrc_actim_ctrl_b_1, u32 sdrc_mr_1);
 extern unsigned long omap3_sram_configure_core_dpll_sz;
 

#ifdef CONFIG_PM

arch/arm/plat-omap/sram.c +20 -14
index a2e60e7..517f45b 100644
@@ -368,23 +368,29 @@ static inline int omap243x_sram_init(void)
 
 #ifdef CONFIG_ARCH_OMAP3
 
-static u32 (*_omap3_sram_configure_core_dpll)(u32 sdrc_rfr_ctrl,
-					      u32 sdrc_actim_ctrla,
-					      u32 sdrc_actim_ctrlb,
-					      u32 m2, u32 unlock_dll,
-					      u32 f, u32 sdrc_mr, u32 inc);
-u32 omap3_configure_core_dpll(u32 sdrc_rfr_ctrl, u32 sdrc_actim_ctrla,
-			      u32 sdrc_actim_ctrlb, u32 m2, u32 unlock_dll,
-			      u32 f, u32 sdrc_mr, u32 inc)
- {
+static u32 (*_omap3_sram_configure_core_dpll)(
+				u32 m2, u32 unlock_dll, u32 f, u32 inc,
+				u32 sdrc_rfr_ctrl_0, u32 sdrc_actim_ctrl_a_0,
+				u32 sdrc_actim_ctrl_b_0, u32 sdrc_mr_0,
+				u32 sdrc_rfr_ctrl_1, u32 sdrc_actim_ctrl_a_1,
+				u32 sdrc_actim_ctrl_b_1, u32 sdrc_mr_1);
+
+u32 omap3_configure_core_dpll(u32 m2, u32 unlock_dll, u32 f, u32 inc,
+			      u32 sdrc_rfr_ctrl_0, u32 sdrc_actim_ctrl_a_0,
+			      u32 sdrc_actim_ctrl_b_0, u32 sdrc_mr_0,
+			      u32 sdrc_rfr_ctrl_1, u32 sdrc_actim_ctrl_a_1,
+			      u32 sdrc_actim_ctrl_b_1, u32 sdrc_mr_1)
+{
 	if (!_omap3_sram_configure_core_dpll)
 		omap_sram_error();
 
-	return _omap3_sram_configure_core_dpll(sdrc_rfr_ctrl,
-					       sdrc_actim_ctrla,
-					       sdrc_actim_ctrlb, m2,
-					       unlock_dll, f, sdrc_mr, inc);
- }
+	return _omap3_sram_configure_core_dpll(
+				m2, unlock_dll, f, inc,
+				sdrc_rfr_ctrl_0, sdrc_actim_ctrl_a_0,
+				sdrc_actim_ctrl_b_0, sdrc_mr_0,
+				sdrc_rfr_ctrl_1, sdrc_actim_ctrl_a_1,
+				sdrc_actim_ctrl_b_1, sdrc_mr_1);
+}
 
 #ifdef CONFIG_PM
 void omap3_sram_restore_context(void)
Signature · 1 line
1.6.2.5.168.g3823
Quoted 40 lines · On Wednesday 03 June 2009 01:40:13 Paul Walmsley wrote:

Hi Jean,

a minor request: it is easier to comment on these patches if they are included inline in the E-mail message, rather than attached. That way code comments can be inlined in the reply.

Quoted 2 lines · Jean Pihet

Here is a patch for the SDRC 2nd CS support. It applies on top of the current pm branch.

Thanks for doing this work.

Quoted 3 lines

I have some questions:
- Is it OK to copy the micron sdram params file to a new file with the 2 CSes params? One could use a unique file with #ifdef SDRC_SUPPORT_2_CSES.

Is it possible for the SDRAM parameter files to remain unchanged, and to simply pass two struct omap_sdrc_params * to omap2_init_common_hw() and then to omap2_sdrc_init()? Boards with only CS0 in use should pass NULL for the second omap_sdrc_params *.

So something like this (I realize the PM branch has additional parameters here also):

void __init omap2_init_common_hw(struct omap_sdrc_params *sdrc_cs0,
struct omap_sdrc_params *sdrc_cs1)

Then:

void __init omap2_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
struct omap_sdrc_params *sdrc_cs1)

I would prefer that approach.

It would also be good to avoid changing the SDRC CS1 parameters in the SRAM code if the board does not use CS1. Maybe pass in a flag that indicates whether CS1 is in use, and if not, avoid programming those registers? The (admittedly minor) overhead of loading the CS1 registers off the stack would be nice to avoid also.

Quoted 7 lines
Quoted 2 lines

- Does the RX51 board have 2 sdram parts? If so I need to update the board file as well.

Probably best if someone from Nokia handles this.

- Paul

- Paul

#14 lore raw

RE: [RFC][PATCH] OMAP3: add support for 2 SDRAM chip selects (was: Re: Beagleboard rev C memory timings & suspend/resume)

Quoted 21 lines

-----Original Message-----
From: ext Paul Walmsley [mailto:[email protected]]
Sent: 05 June, 2009 21:11
To: Jean Pihet; Kristo Tero (Nokia-D/Tampere)
Cc: Kevin Hilman; linux-omap
Subject: Re: [RFC][PATCH] OMAP3: add support for 2 SDRAM chip selects (was: Re: Beagleboard rev C memory timings & suspend/resume)

Hi Jean,

Quoted 6 lines · Jean Pihet

Here is the new patch that includes all the remarks and suggestion. The description is here below.

Some notes:
- all calls to omap2_init_common_hw have been adapted in the board files. it looks like 2430SDP and Pandora board files are

broken since

Quoted 8 lines
Quoted 4 lines

they use only one param. Can that be checked on those boards?
- it is assumed that RX51 only uses 1 CS. Is that correct?

Can you review it and possibly merge?

Looks great.

Tero, does RX51 use two SDRC chipselects!

Yes, I'll take a look at this and post a patch on top of this. I did this for the earlier version already, but need to re-check this one.

-Tero

Quoted 957 lines
Quoted 6 lines

Thanks & regards,
Jean

--
From 097a640997b74638e0e7200ecd5834205204c956 Mon Sep 17

00:00:00 2001

Quoted 15 lines

From: Jean Pihet <[email protected]>
Date: Fri, 5 Jun 2009 17:19:00 +0200
Subject: [PATCH] [PATCH] OMAP3: add support for 2 SDRAM chip selects

Some boards (Beagle Cx, Overo) have 2 SDRAM parts connected to the SDRC.

This patch adds the following:
- ensure that the CKE signals mux settings are correct
- add a new argument of type omap_sdrc_params struct* to omap2_init_common_hw and omap2_sdrc_init for the 2nd CS params
- adapted the OMAP boards files to the new prototype of omap2_init_common_hw. Only Beagle and Overo are using the 2 CS'es
- adapt the sram sleep code to configure the SDRC for the 2nd CS

Quoted 4 lines

Note: If the 2nd param to omap2_init_common_hw is NULL, then the parameters are not programmed into the SDRC CS1 registers

Tested on 3430 SDP and Beagleboard rev C2 and B5, with

suspend/resume

Quoted 3 lines

and frequency changes (cpufreq).

Thanks to Paul Walmsley and Kevin Hilman for the suggestions

and code

Quoted 49 lines

reviews.

---
 arch/arm/mach-omap2/board-2430sdp.c      |    2 +-
 arch/arm/mach-omap2/board-3430sdp.c      |    6 +-
 arch/arm/mach-omap2/board-apollon.c      |    2 +-
 arch/arm/mach-omap2/board-generic.c      |    2 +-
 arch/arm/mach-omap2/board-h4.c           |    2 +-
 arch/arm/mach-omap2/board-ldp.c          |    2 +-
 arch/arm/mach-omap2/board-n800.c         |    2 +-
 arch/arm/mach-omap2/board-omap2evm.c     |    2 +-
 arch/arm/mach-omap2/board-omap3beagle.c  |   11 ++-
 arch/arm/mach-omap2/board-omap3evm.c     |    6 +-
 arch/arm/mach-omap2/board-omap3pandora.c |    3 +-
 arch/arm/mach-omap2/board-overo.c        |    8 ++-
 arch/arm/mach-omap2/board-rx51.c         |    6 +-
 arch/arm/mach-omap2/clock34xx.c          |   37 ++++++--
 arch/arm/mach-omap2/io.c                 |    5 +-
 arch/arm/mach-omap2/mux.c                |    6 ++
 arch/arm/mach-omap2/sdrc.c               |   63 +++++++++-----
 arch/arm/mach-omap2/sram34xx.S           |  137
+++++++++++++++++++++++-------
 arch/arm/plat-omap/include/mach/io.h     |    3 +-
 arch/arm/plat-omap/include/mach/mux.h    |    4 +
 arch/arm/plat-omap/include/mach/sdrc.h   |    8 +-
 arch/arm/plat-omap/include/mach/sram.h   |   23 +++--
 arch/arm/plat-omap/sram.c                |   34 +++++---
 23 files changed, 266 insertions(+), 108 deletions(-)
arch/arm/mach-omap2/board-2430sdp.c +1 -1
index aa5df72..4cb7bc5 100644
@@ -322,7 +322,7 @@ out:
 
 static void __init omap_2430sdp_init_irq(void)  {
-    omap2_init_common_hw(NULL);
+    omap2_init_common_hw(NULL, NULL, NULL, NULL, NULL);
     omap_init_irq();
     omap_gpio_init();
     sdp2430_init_smc91x();
arch/arm/mach-omap2/board-3430sdp.c +0 -0
index 195b749..24e2728 100644

arch/arm/mach-omap2/board-3430sdp.c static inline void __init · line 305

Quoted 4 lines
arch/arm/mach-omap2/board-3430sdp.c +0 -1
@@ -302,8 +302,10 @@ static inline void __init
 sdp3430_init_smc91x(void)
 
 static void __init omap_3430sdp_init_irq(void)  {
-    omap2_init_common_hw(hyb18m512160af6_sdrc_params,

omap3_mpu_rate_table,

arch/arm/mach-omap2/board-n800.c static struct lm8323_platform_data

Quoted 64 lines
arch/arm/mach-omap2/board-3430sdp.c +4 -1
-                         omap3_dsp_rate_table, omap3_l3_rate_table);
+    omap2_init_common_hw(hyb18m512160af6_sdrc_params, NULL,
+                         omap3_mpu_rate_table,
+                         omap3_dsp_rate_table,
+                         omap3_l3_rate_table);
     omap_init_irq();
     omap_gpio_init();
     sdp3430_init_smc91x();
arch/arm/mach-omap2/board-apollon.c +1 -1
index 2e24812..2dd1350 100644
@@ -323,7 +323,7 @@ out:
 
 static void __init omap_apollon_init_irq(void)  {
-    omap2_init_common_hw(NULL, NULL, NULL, NULL);
+    omap2_init_common_hw(NULL, NULL, NULL, NULL, NULL);
     omap_init_irq();
     omap_gpio_init();
     apollon_init_smc91x();
arch/arm/mach-omap2/board-generic.c +1 -1
index be763a9..763329b 100644
@@ -33,7 +33,7 @@
 
 static void __init omap_generic_init_irq(void)  {
-    omap2_init_common_hw(NULL, NULL, NULL, NULL);
+    omap2_init_common_hw(NULL, NULL, NULL, NULL, NULL);
     omap_init_irq();
 }
 
(quoted diff) +0 -0

b/arch/arm/mach-omap2/board-h4.c index 8f54939..17c3599 100644

arch/arm/mach-omap2/board-h4.c +1 -1
@@ -348,7 +348,7 @@ static void __init h4_init_flash(void)
 
 static void __init omap_h4_init_irq(void)  {
-    omap2_init_common_hw(NULL, NULL, NULL, NULL);
+    omap2_init_common_hw(NULL, NULL, NULL, NULL, NULL);
     omap_init_irq();
     omap_gpio_init();
     h4_init_flash();
(quoted diff) +0 -0

b/arch/arm/mach-omap2/board-ldp.c index 9f41dc9..b012806 100644

arch/arm/mach-omap2/board-ldp.c +1 -1
@@ -344,7 +344,7 @@ static inline void __init ldp_init_smc911x(void)
 
 static void __init omap_ldp_init_irq(void)  {
-    omap2_init_common_hw(NULL, NULL, NULL, NULL);
+    omap2_init_common_hw(NULL, NULL, NULL, NULL, NULL);
     omap_init_irq();
     omap_gpio_init();
     ldp_init_smc911x();
arch/arm/mach-omap2/board-n800.c +0 -0
index ac7cf3f..ad53f4a 100644
@@ -127,7 +127,7 @@ static struct lm8323_platform_data

lm8323_pdata =

arch/arm/mach-omap2/board-omap2evm.c static struct twl4030_keypad_data

Quoted 14 lines
arch/arm/mach-omap2/board-n800.c +1 -1
 {
 
 void __init nokia_n800_init_irq(void)  {
-    omap2_init_common_hw(NULL, NULL, NULL, NULL);
+    omap2_init_common_hw(NULL, NULL, NULL, NULL, NULL);
     omap_init_irq();
     omap_gpio_init();
 
arch/arm/mach-omap2/board-omap2evm.c +0 -0
index 4fac1be..56a26d4 100644
@@ -276,7 +276,7 @@ static struct twl4030_keypad_data

omap2evm_kp_data

Quoted 14 lines
arch/arm/mach-omap2/board-omap2evm.c +1 -1
 = {
 
 static void __init omap2_evm_init_irq(void)  {
-    omap2_init_common_hw(NULL, NULL, NULL, NULL);
+    omap2_init_common_hw(NULL, NULL, NULL, NULL, NULL);
     omap_init_irq();
     omap_gpio_init();
     omap2evm_init_smc911x();
arch/arm/mach-omap2/board-omap3beagle.c +0 -0
index 7294dbf..872beb6 100644

arch/arm/mach-omap2/board-omap3beagle.c static int __init omap3_beagle_i2c_init(void) · line 314

Quoted 3 lines
arch/arm/mach-omap2/board-omap3beagle.c +0 -1
@@ -312,8 +312,11 @@ static int __init omap3_beagle_i2c_init(void)
 
 static void __init omap3_beagle_init_irq(void)  {
-    omap2_init_common_hw(mt46h32m32lf6_sdrc_params,

omap3_mpu_rate_table,

arch/arm/mach-omap2/board-omap3evm.c struct spi_board_info

Quoted 26 lines
arch/arm/mach-omap2/board-omap3beagle.c +9 -1
-                         omap3_dsp_rate_table, omap3_l3_rate_table);
+    omap2_init_common_hw(mt46h32m32lf6_sdrc_params,
+                         mt46h32m32lf6_sdrc_params,
+                         omap3_mpu_rate_table,
+                         omap3_dsp_rate_table,
+                         omap3_l3_rate_table);
     omap_init_irq();
     omap_gpio_init();
 }
@@ -441,6 +444,10 @@ static void __init omap3_beagle_init(void)
     usb_musb_init();
     usb_ehci_init();
     omap3beagle_flash_init();
+
+    /* Ensure SDRC pins are mux'd for self-refresh */
+    omap_cfg_reg(H16_34XX_SDRC_CKE0);
+    omap_cfg_reg(H17_34XX_SDRC_CKE1);
 }
 
 static void __init omap3_beagle_map_io(void) diff --git

a/arch/arm/mach-omap2/board-omap3evm.c
b/arch/arm/mach-omap2/board-omap3evm.c
index f017f0d..3b9c96a 100644

arch/arm/mach-omap2/board-omap3evm.c +0 -0
@@ -276,8 +276,10 @@ struct spi_board_info

omap3evm_spi_board_info[] =

arch/arm/mach-omap2/board-omap3evm.c struct spi_board_info · line 279

Quoted 4 lines
arch/arm/mach-omap2/board-omap3evm.c +0 -1
 {
 
 static void __init omap3_evm_init_irq(void)  {
-    omap2_init_common_hw(mt46h32m32lf6_sdrc_params,

omap3_mpu_rate_table,

Quoted 28 lines
arch/arm/mach-omap2/board-omap3evm.c +4 -1
-                         omap3_dsp_rate_table, omap3_l3_rate_table);
+    omap2_init_common_hw(mt46h32m32lf6_sdrc_params, NULL,
+                         omap3_mpu_rate_table,
+                         omap3_dsp_rate_table,
+                         omap3_l3_rate_table);
     omap_init_irq();
     omap_gpio_init();
     omap3evm_init_smc911x();
arch/arm/mach-omap2/board-omap3pandora.c +2 -1
index c67f62f..05ab99e 100644
@@ -220,7 +220,8 @@ static int __init omap3pandora_i2c_init(void)
 
 static void __init omap3pandora_init_irq(void)  {
-    omap2_init_common_hw(mt46h32m32lf6_sdrc_params);
+    omap2_init_common_hw(mt46h32m32lf6_sdrc_params, NULL,
+                         NULL, NULL, NULL);
     omap_init_irq();
     omap_gpio_init();
 }
arch/arm/mach-omap2/board-overo.c +0 -0
index 9eae608..2c6d2c5 100644

arch/arm/mach-omap2/board-overo.c static int __init overo_i2c_init(void) · line 357

Quoted 3 lines
arch/arm/mach-omap2/board-overo.c +0 -1
@@ -355,7 +355,9 @@ static int __init overo_i2c_init(void)
 
 static void __init overo_init_irq(void)  {
-    omap2_init_common_hw(mt46h32m32lf6_sdrc_params, NULL,

NULL, NULL);

Quoted 7 lines
arch/arm/mach-omap2/board-overo.c +3 -0
+    omap2_init_common_hw(mt46h32m32lf6_sdrc_params,
+                         mt46h32m32lf6_sdrc_params,
+                         NULL, NULL, NULL);
     omap_init_irq();
     omap_gpio_init();
 }

arch/arm/mach-omap2/board-overo.c static void __init overo_init(void) · line 402

Quoted 10 lines
arch/arm/mach-omap2/board-overo.c +4 -0
@@ -391,6 +393,10 @@ static void __init overo_init(void)
     overo_init_smsc911x();
     overo_ads7846_init();
 
+    /* Ensure SDRC pins are mux'd for self-refresh */
+    omap_cfg_reg(H16_34XX_SDRC_CKE0);
+    omap_cfg_reg(H17_34XX_SDRC_CKE1);
+
     if ((gpio_request(OVERO_GPIO_W2W_NRESET,
                       "OVERO_GPIO_W2W_NRESET") == 0) &&
         (gpio_direction_output(OVERO_GPIO_W2W_NRESET, 1) ==

0)) { diff

arch/arm/mach-omap2/board-rx51.c static struct omap_board_config_kernel · line 67

Quoted 10 lines

--git a/arch/arm/mach-omap2/board-rx51.c
b/arch/arm/mach-omap2/board-rx51.c
index 09035b0..d48459f 100644

arch/arm/mach-omap2/board-rx51.c +0 -1
@@ -64,8 +64,10 @@ static struct omap_board_config_kernel
 rx51_config[] = {
 
 static void __init rx51_init_irq(void)  {
-    omap2_init_common_hw(rx51_get_sdram_timings(),

omap3_mpu_rate_table,

arch/arm/mach-omap2/clock34xx.c static int

Quoted 13 lines
arch/arm/mach-omap2/board-rx51.c +4 -1
-                         omap3_dsp_rate_table, omap3_l3_rate_table);
+    omap2_init_common_hw(rx51_get_sdram_timings(), NULL,
+                         omap3_mpu_rate_table,
+                         omap3_dsp_rate_table,
+                         omap3_l3_rate_table);
     omap_init_irq();
     omap_gpio_init();
 }
(quoted diff) +0 -0

b/arch/arm/mach-omap2/clock34xx.c index 3cee6b4..f262787 100644

arch/arm/mach-omap2/clock34xx.c +0 -0
@@ -478,7 +478,9 @@ static int

omap3_core_dpll_m2_set_rate(struct clk

arch/arm/mach-omap2/clock34xx.c static int

Quoted 12 lines
arch/arm/mach-omap2/clock34xx.c +3 -1
 *clk, unsigned long rate)
     u32 unlock_dll = 0;
     u32 c;
     unsigned long validrate, sdrcrate, mpurate;
-    struct omap_sdrc_params *sp;
+    struct omap_sdrc_params *sdrc_cs0;
+    struct omap_sdrc_params *sdrc_cs1;
+    int ret;
 
     if (!clk || !rate)
             return -EINVAL;
arch/arm/mach-omap2/clock34xx.c +0 -0
@@ -496,8 +498,8 @@ static int

omap3_core_dpll_m2_set_rate(struct clk

Quoted 11 lines
arch/arm/mach-omap2/clock34xx.c +2 -2
 *clk, unsigned long rate)
     else
             sdrcrate >>= ((clk->rate / rate) >> 1);
 
-    sp = omap2_sdrc_get_params(sdrcrate);
-    if (!sp)
+    ret = omap2_sdrc_get_params(sdrcrate, &sdrc_cs0, &sdrc_cs1);
+    if (ret)
             return -EINVAL;
 
     if (sdrcrate < MIN_SDRC_DLL_LOCK_FREQ) { @@ -518,12 +520,29 @@
Quoted 1 line

static int omap3_core_dpll_m2_set_rate(struct clk *clk,

unsigned long

Quoted 3 lines

rate)

pr_debug("clock: changing CORE DPLL rate from %lu to

%lu\n", clk->rate,

arch/arm/mach-omap2/clock34xx.c

Quoted 6 lines
              validrate);
arch/arm/mach-omap2/clock34xx.c +0 -5
-    pr_debug("clock: SDRC timing params used: %08x %08x %08x\n",
-             sp->rfr_ctrl, sp->actim_ctrla, sp->actim_ctrlb);
-
-    omap3_configure_core_dpll(sp->rfr_ctrl, sp->actim_ctrla,
-                              sp->actim_ctrlb, new_div,

unlock_dll, c,

Quoted 14 lines
arch/arm/mach-omap2/clock34xx.c +13 -1
-                              sp->mr, rate > clk->rate);
+    pr_debug("clock: SDRC CS0 timing params used:"
+             " RFR %08x CTRLA %08x CTRLB %08x MR %08x\n",
+             sdrc_cs0->rfr_ctrl, sdrc_cs0->actim_ctrla,
+             sdrc_cs0->actim_ctrlb, sdrc_cs0->mr);
+    if (sdrc_cs1)
+            pr_debug("clock: SDRC CS1 timing params used: "
+             " RFR %08x CTRLA %08x CTRLB %08x MR %08x\n",
+             sdrc_cs1->rfr_ctrl, sdrc_cs1->actim_ctrla,
+             sdrc_cs1->actim_ctrlb, sdrc_cs1->mr);
+
+    if (sdrc_cs1)
+            omap3_configure_core_dpll(
+                              new_div, unlock_dll, c, rate
Quoted 2 lines

clk->rate,
+ sdrc_cs0->rfr_ctrl,

sdrc_cs0->actim_ctrla,

arch/arm/mach-omap2/clock34xx.c

Quoted 2 lines
arch/arm/mach-omap2/clock34xx.c +2 -0
+                              sdrc_cs0->actim_ctrlb, sdrc_cs0->mr,
+                              sdrc_cs1->rfr_ctrl,

sdrc_cs1->actim_ctrla,

Quoted 6 lines
arch/arm/mach-omap2/clock34xx.c +4 -0
+                              sdrc_cs1->actim_ctrlb, sdrc_cs1->mr);
+    else
+            omap3_configure_core_dpll(
+                              new_div, unlock_dll, c, rate

clk->rate,
+ sdrc_cs0->rfr_ctrl,

sdrc_cs0->actim_ctrla,

Review

Quoted 6 lines
arch/arm/mach-omap2/clock34xx.c +2 -0
+                              sdrc_cs0->actim_ctrlb, sdrc_cs0->mr,
+                              0, 0, 0, 0);
 
     return 0;
 }
(quoted diff) +0 -0

b/arch/arm/mach-omap2/io.c index

arch/arm/mach-omap2/io.c static int __init

Quoted 4 lines

6fb6c29..aa000b4 100644

arch/arm/mach-omap2/io.c +0 -0
@@ -231,7 +231,8 @@ static int __init

_omap2_init_reprogram_sdrc(void)

Quoted 51 lines
arch/arm/mach-omap2/io.c +3 -2
     return v;
 }
 
-void __init omap2_init_common_hw(struct omap_sdrc_params *sp,
+void __init omap2_init_common_hw(struct omap_sdrc_params *sdrc_cs0,
+                             struct omap_sdrc_params *sdrc_cs1,
                              struct omap_opp *mpu_opps,
                              struct omap_opp *dsp_opps,
                              struct omap_opp *l3_opps)
@@ -244,7 +245,7 @@ void __init omap2_init_common_hw(struct
 omap_sdrc_params *sp,
     omapdev_init(omapdevs);
     omap2_clk_init();
     omap_pm_if_init();
-    omap2_sdrc_init(sp);
+    omap2_sdrc_init(sdrc_cs0, sdrc_cs1);
 
     _omap2_init_reprogram_sdrc();
arch/arm/mach-omap2/mux.c +6 -0
index 026c4fc..43d6b92 100644
@@ -486,6 +486,12 @@ MUX_CFG_34XX("H19_34XX_GPIO164_OUT", 0x19c,
             OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_OUTPUT)
 MUX_CFG_34XX("J25_34XX_GPIO170", 0x1c6,
             OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_INPUT)
+
+/* OMAP3 SDRC CKE signals to SDR/DDR ram chips */
+MUX_CFG_34XX("H16_34XX_SDRC_CKE0", 0x262,
+            OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_OUTPUT)
+MUX_CFG_34XX("H17_34XX_SDRC_CKE1", 0x264,
+            OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_OUTPUT)
 };
 
 #define OMAP34XX_PINS_SZ    ARRAY_SIZE(omap34xx_pins)
arch/arm/mach-omap2/sdrc.c +2 -1
index c832d83..b42f5ae 100644
@@ -32,7 +32,7 @@
 #include <mach/sdrc.h>
 #include "sdrc.h"
 
-static struct omap_sdrc_params *sdrc_init_params;
+static struct omap_sdrc_params *sdrc_init_params_cs0,
+*sdrc_init_params_cs1;
 
 void __iomem *omap2_sdrc_base;
 void __iomem *omap2_sms_base;

arch/arm/mach-omap2/sdrc.c void omap2_sms_restore_context(void) · line 72

Quoted 2 lines
arch/arm/mach-omap2/sdrc.c +0 -0
@@ -71,33 +71,49 @@ void omap2_sms_restore_context(void)
 /**
  * omap2_sdrc_get_params - return SDRC register values for

a given clock rate

Quoted 12 lines
arch/arm/mach-omap2/sdrc.c +2 -1
  * @r: SDRC clock rate (in Hz)
+ * @sdrc_cs0: chip select 0 ram timings **
+ * @sdrc_cs1: chip select 1 ram timings **
  *
  * Return pre-calculated values for the SDRC_ACTIM_CTRLA,
- * SDRC_ACTIM_CTRLB, SDRC_RFR_CTRL, and SDRC_MR registers, for a

given
- * SDRC clock rate 'r'. These parameters control various timing
- * delays in the SDRAM controller that are expressed in terms of the
- * number of SDRC clock cycles to wait; hence the clock rate
- * dependency. Note that sdrc_init_params must be sorted rate
- * descending. Also assumes that both chip-selects use the same

Quoted 8 lines

- * timing parameters. Returns a struct omap_sdrc_params * upon
- * success, or NULL upon failure.
+ * SDRC_ACTIM_CTRLB, SDRC_RFR_CTRL and SDRC_MR registers in
+ sdrc_cs[01]
+ * structs,for a given SDRC clock rate 'r'.
+ * These parameters control various timing delays in the SDRAM
+ controller
+ * that are expressed in terms of the number of SDRC clock

cycles to

Quoted 5 lines

+ * wait; hence the clock rate dependency.
+ *
+ * Supports 2 different timing parameters for both chip selects.
+ *
+ * Note 1: the sdrc_init_params_cs[01] must be sorted rate

descending.

Quoted 48 lines

+ * Note 2: If sdrc_init_params_cs_1 is not NULL it must be of same
+ size
+ * as sdrc_init_params_cs_0.
+ *
+ * Fills in the struct omap_sdrc_params * for each chip select.
+ * Returns 0 upon success or -1 upon failure.
*/

arch/arm/mach-omap2/sdrc.c +18 -10
-struct omap_sdrc_params *omap2_sdrc_get_params(unsigned long r)
+int omap2_sdrc_get_params(unsigned long r,
+                      struct omap_sdrc_params **sdrc_cs0,
+                      struct omap_sdrc_params **sdrc_cs1)
 {
-    struct omap_sdrc_params *sp;
+    struct omap_sdrc_params *sp0, *sp1;
 
-    if (!sdrc_init_params)
-            return NULL;
+    if (!sdrc_init_params_cs0)
+            return -1;
 
-    sp = sdrc_init_params;
+    sp0 = sdrc_init_params_cs0;
+    sp1 = sdrc_init_params_cs1;
 
-    while (sp->rate && sp->rate != r)
-            sp++;
+    while (sp0->rate && sp0->rate != r) {
+            sp0++;
+            if (sdrc_init_params_cs1)
+                    sp1++;
+    }
 
-    if (!sp->rate)
-            return NULL;
+    if (!sp0->rate)
+            return -1;
 
-    return sp;
+    *sdrc_cs0 = sp0;
+    *sdrc_cs1 = sp1;
+    return 0;
 }
@@ -109,13 +125,15 @@ void __init omap2_set_globals_sdrc(struct

omap_globals
*omap2_globals)

Quoted 9 lines

/**
* omap2_sdrc_init - initialize SMS, SDRC devices on boot
- * @sp: pointer to a null-terminated list of struct omap_sdrc_params
+ * @sdrc_cs[01]: pointers to a null-terminated list of struct omap_sdrc_params
+ * Support for 2 chip selects timings
*
* Turn on smart idle modes for SDRAM scheduler and controller.
* Program a known-good configuration for the SDRC to deal

with buggy

arch/arm/mach-omap2/sdrc.c void __init omap2_sdrc_init(struct

Quoted 9 lines

* bootloaders.
*/

arch/arm/mach-omap2/sdrc.c +2 -1
-void __init omap2_sdrc_init(struct omap_sdrc_params *sp)
+void __init omap2_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
+                        struct omap_sdrc_params *sdrc_cs1)
 {
     u32 l;
@@ -129,7 +147,8 @@ void __init omap2_sdrc_init(struct

omap_sdrc_params *sp)

Quoted 58 lines
arch/arm/mach-omap2/sdrc.c +2 -1
     l |= (0x2 << 3);
     sdrc_write_reg(l, SDRC_SYSCONFIG);
 
-    sdrc_init_params = sp;
+    sdrc_init_params_cs0 = sdrc_cs0;
+    sdrc_init_params_cs1 = sdrc_cs1;
 
     /* XXX Enable SRFRONIDLEREQ here also? */
     l = (1 << SDRC_POWER_EXTCLKDIS_SHIFT) | diff --git

a/arch/arm/mach-omap2/sram34xx.S b/arch/arm/mach-omap2/sram34xx.S index f41f8d9..3aef744 100644

arch/arm/mach-omap2/sram34xx.S +22 -9
@@ -36,7 +36,7 @@
 
     .text
 
-/* r4 parameters */
+/* r1 parameters */
 #define SDRC_NO_UNLOCK_DLL          0x0
 #define SDRC_UNLOCK_DLL                     0x1
 
@@ -71,40 +71,71 @@
 
 /*
  * omap3_sram_configure_core_dpll - change DPLL3 M2 divider
- * r0 = new SDRC_RFR_CTRL register contents
- * r1 = new SDRC_ACTIM_CTRLA register contents
- * r2 = new SDRC_ACTIM_CTRLB register contents
- * r3 = new M2 divider setting (only 1 and 2 supported right now)
- * r4 = unlock SDRC DLL? (1 = yes, 0 = no).  Only unlock DLL for
+ *
+ * Params passed in registers:
+ *  r0 = new M2 divider setting (only 1 and 2 supported right now)
+ *  r1 = unlock SDRC DLL? (1 = yes, 0 = no).  Only unlock DLL for
  *      SDRC rates < 83MHz
- * r5 = number of MPU cycles to wait for SDRC to stabilize after
+ *  r2 = number of MPU cycles to wait for SDRC to stabilize after
  *      reprogramming the SDRC when switching to a slower MPU speed
- * r6 = new SDRC_MR_0 register value
- * r7 = increasing SDRC rate? (1 = yes, 0 = no)
+ *  r3 = increasing SDRC rate? (1 = yes, 0 = no)
+ *
+ * Params passed via the stack. The needed params will be copied in
+ SRAM
+ *  before use by the code in SRAM (SDRAM is not accessible during
+ SDRC
+ *  reconfiguration):
+ *  new SDRC_RFR_CTRL_0 register contents
+ *  new SDRC_ACTIM_CTRL_A_0 register contents
+ *  new SDRC_ACTIM_CTRL_B_0 register contents
+ *  new SDRC_MR_0 register value
+ *  new SDRC_RFR_CTRL_1 register contents
+ *  new SDRC_ACTIM_CTRL_A_1 register contents
+ *  new SDRC_ACTIM_CTRL_B_1 register contents
+ *  new SDRC_MR_1 register value
  *
+ * If the param SDRC_RFR_CTRL_1 is 0, the parameters

arch/arm/mach-omap2/sram34xx.S line 103

Quoted 10 lines
arch/arm/mach-omap2/sram34xx.S +3 -4
+ *  are not programmed into the SDRC CS1 registers
  */
 ENTRY(omap3_sram_configure_core_dpll)
     stmfd   sp!, {r1-r12, lr}       @ store regs to stack
-    ldr     r4, [sp, #52]           @ pull extra args off the stack
-    ldr     r5, [sp, #56]           @ load extra args from the stack
-    ldr     r6, [sp, #60]           @ load extra args from the stack
-    ldr     r7, [sp, #64]           @ load extra args from the stack
+
+                                    @ pull the extra args

off the stack

Quoted 11 lines
arch/arm/mach-omap2/sram34xx.S +11 -0
+                                    @  and store them in SRAM
+    ldr     r4, [sp, #52]
+    str     r4, omap_sdrc_rfr_ctrl_0_val
+    ldr     r4, [sp, #56]
+    str     r4, omap_sdrc_actim_ctrl_a_0_val
+    ldr     r4, [sp, #60]
+    str     r4, omap_sdrc_actim_ctrl_b_0_val
+    ldr     r4, [sp, #64]
+    str     r4, omap_sdrc_mr_0_val
+    ldr     r4, [sp, #68]
+    str     r4, omap_sdrc_rfr_ctrl_1_val

arch/arm/mach-omap2/sram34xx.S

Quoted 10 lines
arch/arm/mach-omap2/sram34xx.S +9 -0
+    cmp     r4, #0                  @ if SDRC_RFR_CTRL_1 is 0,
+    beq     skip_cs1_params         @  do not use cs1 params
+    ldr     r4, [sp, #72]
+    str     r4, omap_sdrc_actim_ctrl_a_1_val
+    ldr     r4, [sp, #76]
+    str     r4, omap_sdrc_actim_ctrl_b_1_val
+    ldr     r4, [sp, #80]
+    str     r4, omap_sdrc_mr_1_val
+skip_cs1_params:
     dsb                             @ flush buffered writes

to interconnect

arch/arm/mach-omap2/sram34xx.S

Quoted 4 lines
arch/arm/mach-omap2/sram34xx.S +2 -1
-    cmp     r7, #1                  @ if increasing SDRC clk rate,
+
+    cmp     r3, #1                  @ if increasing SDRC clk rate,
     bleq    configure_sdrc          @ program the SDRC regs

early (for RFR)

arch/arm/mach-omap2/sram34xx.S

Quoted 5 lines
arch/arm/mach-omap2/sram34xx.S +1 -1
-    cmp     r4, #SDRC_UNLOCK_DLL    @ set the intended DLL state
+    cmp     r1, #SDRC_UNLOCK_DLL    @ set the intended DLL state
     bleq    unlock_dll
     blne    lock_dll
     bl      sdram_in_selfrefresh    @ put SDRAM in self

refresh, idle SDRC

arch/arm/mach-omap2/sram34xx.S

Quoted 9 lines
arch/arm/mach-omap2/sram34xx.S +2 -2
     bl      configure_core_dpll     @ change the DPLL3 M2 divider
     bl      enable_sdrc             @ take SDRC out of idle
-    cmp     r4, #SDRC_UNLOCK_DLL    @ wait for DLL status to change
+    cmp     r1, #SDRC_UNLOCK_DLL    @ wait for DLL status to change
     bleq    wait_dll_unlock
     blne    wait_dll_lock
-    cmp     r7, #1                  @ if increasing SDRC clk rate,
+    cmp     r3, #1                  @ if increasing SDRC clk rate,
     beq     return_to_sdram         @ return to SDRAM code,

otherwise,

arch/arm/mach-omap2/sram34xx.S

Quoted 6 lines
arch/arm/mach-omap2/sram34xx.S +1 -1
     bl      configure_sdrc          @ reprogram SDRC regs now
-    mov     r12, r5
+    mov     r12, r2
     bl      wait_clk_stable         @ wait for SDRC to stabilize
 return_to_sdram:
     isb                             @ prevent speculative

exec past here

Quoted 179 lines
arch/arm/mach-omap2/sram34xx.S +58 -12
@@ -149,7 +180,7 @@ configure_core_dpll:
     ldr     r12, [r11]
     ldr     r10, core_m2_mask_val   @ modify m2 for core dpll
     and     r12, r12, r10
-    orr     r12, r12, r3, lsl #CORE_DPLL_CLKOUT_DIV_SHIFT
+    orr     r12, r12, r0, lsl #CORE_DPLL_CLKOUT_DIV_SHIFT
     str     r12, [r11]
     ldr     r12, [r11]              @ posted-write barrier for CM
     bx      lr
@@ -187,15 +218,34 @@ wait_dll_unlock:
     bne     wait_dll_unlock
     bx      lr
 configure_sdrc:
-    ldr     r11, omap3_sdrc_rfr_ctrl
-    str     r0, [r11]
-    ldr     r11, omap3_sdrc_actim_ctrla
-    str     r1, [r11]
-    ldr     r11, omap3_sdrc_actim_ctrlb
-    str     r2, [r11]
+    ldr     r12, omap_sdrc_rfr_ctrl_0_val   @ fetch value from SRAM
+    ldr     r11, omap3_sdrc_rfr_ctrl_0      @ fetch addr from SRAM
+    str     r12, [r11]                      @ store
+    ldr     r12, omap_sdrc_actim_ctrl_a_0_val
+    ldr     r11, omap3_sdrc_actim_ctrl_a_0
+    str     r12, [r11]
+    ldr     r12, omap_sdrc_actim_ctrl_b_0_val
+    ldr     r11, omap3_sdrc_actim_ctrl_b_0
+    str     r12, [r11]
+    ldr     r12, omap_sdrc_mr_0_val
     ldr     r11, omap3_sdrc_mr_0
-    str     r6, [r11]
-    ldr     r6, [r11]               @ posted-write barrier for SDRC
+    str     r12, [r11]
+    ldr     r12, omap_sdrc_rfr_ctrl_1_val
+    cmp     r12, #0                 @ if SDRC_RFR_CTRL_1 is 0,
+    beq     skip_cs1_prog           @  do not program cs1 params
+    ldr     r11, omap3_sdrc_rfr_ctrl_1
+    str     r12, [r11]
+    ldr     r12, omap_sdrc_actim_ctrl_a_1_val
+    ldr     r11, omap3_sdrc_actim_ctrl_a_1
+    str     r12, [r11]
+    ldr     r12, omap_sdrc_actim_ctrl_b_1_val
+    ldr     r11, omap3_sdrc_actim_ctrl_b_1
+    str     r12, [r11]
+    ldr     r12, omap_sdrc_mr_1_val
+    ldr     r11, omap3_sdrc_mr_1
+    str     r12, [r11]
+skip_cs1_prog:
+    ldr     r12, [r11]              @ posted-write barrier for SDRC
     bx      lr
 
 omap3_sdrc_power:
@@ -206,14 +256,40 @@ omap3_cm_idlest1_core:
     .word OMAP34XX_CM_REGADDR(CORE_MOD, CM_IDLEST)
 omap3_cm_iclken1_core:
     .word OMAP34XX_CM_REGADDR(CORE_MOD, CM_ICLKEN1)
-omap3_sdrc_rfr_ctrl:
+
+omap3_sdrc_rfr_ctrl_0:
     .word OMAP34XX_SDRC_REGADDR(SDRC_RFR_CTRL_0)
-omap3_sdrc_actim_ctrla:
+omap3_sdrc_rfr_ctrl_1:
+    .word OMAP34XX_SDRC_REGADDR(SDRC_RFR_CTRL_1)
+omap3_sdrc_actim_ctrl_a_0:
     .word OMAP34XX_SDRC_REGADDR(SDRC_ACTIM_CTRL_A_0)
-omap3_sdrc_actim_ctrlb:
+omap3_sdrc_actim_ctrl_a_1:
+    .word OMAP34XX_SDRC_REGADDR(SDRC_ACTIM_CTRL_A_1)
+omap3_sdrc_actim_ctrl_b_0:
     .word OMAP34XX_SDRC_REGADDR(SDRC_ACTIM_CTRL_B_0)
+omap3_sdrc_actim_ctrl_b_1:
+    .word OMAP34XX_SDRC_REGADDR(SDRC_ACTIM_CTRL_B_1)
 omap3_sdrc_mr_0:
     .word OMAP34XX_SDRC_REGADDR(SDRC_MR_0)
+omap3_sdrc_mr_1:
+    .word OMAP34XX_SDRC_REGADDR(SDRC_MR_1)
+omap_sdrc_rfr_ctrl_0_val:
+    .word 0xDEADBEEF
+omap_sdrc_rfr_ctrl_1_val:
+    .word 0xDEADBEEF
+omap_sdrc_actim_ctrl_a_0_val:
+    .word 0xDEADBEEF
+omap_sdrc_actim_ctrl_a_1_val:
+    .word 0xDEADBEEF
+omap_sdrc_actim_ctrl_b_0_val:
+    .word 0xDEADBEEF
+omap_sdrc_actim_ctrl_b_1_val:
+    .word 0xDEADBEEF
+omap_sdrc_mr_0_val:
+    .word 0xDEADBEEF
+omap_sdrc_mr_1_val:
+    .word 0xDEADBEEF
+
 omap3_sdrc_dlla_status:
     .word OMAP34XX_SDRC_REGADDR(SDRC_DLLA_STATUS)
 omap3_sdrc_dlla_ctrl:
@@ -223,3 +299,4 @@ core_m2_mask_val:
 
 ENTRY(omap3_sram_configure_core_dpll_sz)
     .word   . - omap3_sram_configure_core_dpll
+
arch/arm/plat-omap/include/mach/io.h +2 -0
index 54c159b..d4c78b4 100644
@@ -192,7 +192,8 @@ extern void omap1_map_common_io(void);  extern
 void omap1_init_common_hw(void);
 
 extern void omap2_map_common_io(void); -extern void
 omap2_init_common_hw(struct omap_sdrc_params *sp,
+extern void omap2_init_common_hw(struct omap_sdrc_params *sdrc_cs0,
+                             struct omap_sdrc_params *sdrc_cs1,
                              struct omap_opp *mpu_opps,
                              struct omap_opp *dsp_opps,
                              struct omap_opp *l3_opps);
arch/arm/plat-omap/include/mach/mux.h +4 -0
index f7e298a..7368aba 100644
@@ -803,6 +803,10 @@ enum omap34xx_index {
     AE5_34XX_GPIO143,
     H19_34XX_GPIO164_OUT,
     J25_34XX_GPIO170,
+
+    /* OMAP3 SDRC CKE signals to SDR/DDR ram chips */
+    H16_34XX_SDRC_CKE0,
+    H17_34XX_SDRC_CKE1,
 };
 
 struct omap_mux_cfg {
arch/arm/plat-omap/include/mach/sdrc.h +0 -0
index a678bc8..7e22143 100644
@@ -114,9 +114,11 @@ struct omap_sdrc_params {
 
 void omap2_sms_save_context(void);
 void omap2_sms_restore_context(void); -void __init

omap2_sdrc_init(struct omap_sdrc_params *); -struct omap_sdrc_params *omap2_sdrc_get_params(unsigned long r);

arch/arm/plat-omap/include/mach/sdrc.h +5 -1
-
+void __init omap2_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
+                        struct omap_sdrc_params *sdrc_cs1); int
+omap2_sdrc_get_params(unsigned long r,
+                      struct omap_sdrc_params **sdrc_cs0,
+                      struct omap_sdrc_params **sdrc_cs1);
 #ifdef CONFIG_ARCH_OMAP2
 
 struct memory_timings {
arch/arm/plat-omap/include/mach/sram.h +7 -5
index ad0a600..98906ea 100644
@@ -21,11 +21,13 @@ extern void omap2_sram_reprogram_sdrc(u32
 perf_level, u32 dll_val,
                                   u32 mem_type);
 extern u32 omap2_set_prcm(u32 dpll_ctrl_val, u32 sdrc_rfr_val, int
 bypass);
 
-extern u32 omap3_configure_core_dpll(u32 sdrc_rfr_ctrl,
-                                 u32 sdrc_actim_ctrla,
-                                 u32 sdrc_actim_ctrlb, u32 m2,
-                                 u32 unlock_dll, u32 f, u32 sdrc_mr,
-                                 u32 inc);
+extern u32 omap3_configure_core_dpll(
+                    u32 m2, u32 unlock_dll, u32 f, u32 inc,
+                    u32 sdrc_rfr_ctrl_0, u32 sdrc_actim_ctrl_a_0,
+                    u32 sdrc_actim_ctrl_b_0, u32 sdrc_mr_0,
+                    u32 sdrc_rfr_ctrl_1, u32 sdrc_actim_ctrl_a_1,
+                    u32 sdrc_actim_ctrl_b_1, u32 sdrc_mr_1);
+
 extern void omap3_sram_restore_context(void);

/* Do not use these */

arch/arm/plat-omap/include/mach/sram.h extern void omap243x_sram_reprogram_sdrc(u32 · line 69

Quoted 9 lines
arch/arm/plat-omap/include/mach/sram.h +0 -4
@@ -61,11 +63,12 @@ extern void omap243x_sram_reprogram_sdrc(u32
 perf_level,
 u32 dll_val,
 extern unsigned long omap243x_sram_reprogram_sdrc_sz;
 
 
-extern u32 omap3_sram_configure_core_dpll(u32 sdrc_rfr_ctrl,
-                                      u32 sdrc_actim_ctrla,
-                                      u32 sdrc_actim_ctrlb, u32 m2,
-                                      u32 unlock_dll, u32

f, u32 sdrc_mr,

Quoted 15 lines
arch/arm/plat-omap/include/mach/sram.h +6 -1
-                                      u32 inc);
+extern u32 omap3_sram_configure_core_dpll(
+                    u32 m2, u32 unlock_dll, u32 f, u32 inc,
+                    u32 sdrc_rfr_ctrl_0, u32 sdrc_actim_ctrl_a_0,
+                    u32 sdrc_actim_ctrl_b_0, u32 sdrc_mr_0,
+                    u32 sdrc_rfr_ctrl_1, u32 sdrc_actim_ctrl_a_1,
+                    u32 sdrc_actim_ctrl_b_1, u32 sdrc_mr_1);
 extern unsigned long omap3_sram_configure_core_dpll_sz;

#ifdef CONFIG_PM

arch/arm/plat-omap/sram.c +0 -0
index a2e60e7..517f45b 100644

arch/arm/plat-omap/sram.c static inline int omap243x_sram_init(void) · line 375

Quoted 8 lines
arch/arm/plat-omap/sram.c +0 -5
@@ -368,23 +368,29 @@ static inline int omap243x_sram_init(void)
 
 #ifdef CONFIG_ARCH_OMAP3
 
-static u32 (*_omap3_sram_configure_core_dpll)(u32 sdrc_rfr_ctrl,
-                                          u32 sdrc_actim_ctrla,
-                                          u32 sdrc_actim_ctrlb,
-                                          u32 m2, u32 unlock_dll,
-                                          u32 f, u32

sdrc_mr, u32 inc);

arch/arm/plat-omap/sram.c static inline int omap243x_sram_init(void) · line 376

Quoted 1 line
arch/arm/plat-omap/sram.c +0 -1
-u32 omap3_configure_core_dpll(u32 sdrc_rfr_ctrl, u32

sdrc_actim_ctrla,

arch/arm/plat-omap/sram.c static inline int omap243x_sram_init(void) · line 377

Quoted 1 line
arch/arm/plat-omap/sram.c +0 -1
-                          u32 sdrc_actim_ctrlb, u32 m2, u32

unlock_dll,

arch/arm/plat-omap/sram.c static inline int omap243x_sram_init(void)

Quoted 5 lines
arch/arm/plat-omap/sram.c +3 -2
-                          u32 f, u32 sdrc_mr, u32 inc)
- {
+static u32 (*_omap3_sram_configure_core_dpll)(
+                            u32 m2, u32 unlock_dll, u32 f, u32 inc,
+                            u32 sdrc_rfr_ctrl_0, u32

sdrc_actim_ctrl_a_0,

arch/arm/plat-omap/sram.c static inline int omap243x_sram_init(void) · line 375

Quoted 2 lines
arch/arm/plat-omap/sram.c +2 -0
+                            u32 sdrc_actim_ctrl_b_0, u32 sdrc_mr_0,
+                            u32 sdrc_rfr_ctrl_1, u32

sdrc_actim_ctrl_a_1,

arch/arm/plat-omap/sram.c static inline int omap243x_sram_init(void)

Quoted 3 lines
arch/arm/plat-omap/sram.c +3 -0
+                            u32 sdrc_actim_ctrl_b_1, u32 sdrc_mr_1);
+
+u32 omap3_configure_core_dpll(u32 m2, u32 unlock_dll, u32

f, u32 inc,

arch/arm/plat-omap/sram.c static inline int omap243x_sram_init(void) · line 379

Quoted 1 line
arch/arm/plat-omap/sram.c +1 -0
+                          u32 sdrc_rfr_ctrl_0, u32

sdrc_actim_ctrl_a_0,

arch/arm/plat-omap/sram.c static inline int omap243x_sram_init(void) · line 381

Quoted 2 lines
arch/arm/plat-omap/sram.c +2 -0
+                          u32 sdrc_actim_ctrl_b_0, u32 sdrc_mr_0,
+                          u32 sdrc_rfr_ctrl_1, u32

sdrc_actim_ctrl_a_1,

arch/arm/plat-omap/sram.c static inline int omap243x_sram_init(void)

Quoted 8 lines
arch/arm/plat-omap/sram.c +1 -4
+                          u32 sdrc_actim_ctrl_b_1, u32 sdrc_mr_1) {
     if (!_omap3_sram_configure_core_dpll)
             omap_sram_error();
 
-    return _omap3_sram_configure_core_dpll(sdrc_rfr_ctrl,
-                                           sdrc_actim_ctrla,
-                                           sdrc_actim_ctrlb, m2,
-                                           unlock_dll, f,

sdrc_mr, inc);

Quoted 16 lines
arch/arm/plat-omap/sram.c +7 -2
- }
+    return _omap3_sram_configure_core_dpll(
+                            m2, unlock_dll, f, inc,
+                            sdrc_rfr_ctrl_0, sdrc_actim_ctrl_a_0,
+                            sdrc_actim_ctrl_b_0, sdrc_mr_0,
+                            sdrc_rfr_ctrl_1, sdrc_actim_ctrl_a_1,
+                            sdrc_actim_ctrl_b_1, sdrc_mr_1);
+}
 
 #ifdef CONFIG_PM
 void omap3_sram_restore_context(void)
--

1.6.2.5.168.g3823

Quoted 9 lines
Quoted 8 lines · On Wednesday 03 June 2009 01:40:13 Paul Walmsley wrote:

Hi Jean,

a minor request: it is easier to comment on these patches if they are included inline in the E-mail message, rather than attached. That way code comments can be inlined in the reply.

Quoted 1 line · Jean Pihet

Here is a patch for the SDRC 2nd CS support. It applies

on top of

Quoted 6 lines
Quoted 6 lines
Quoted 1 line

the current pm branch.

Thanks for doing this work.

Quoted 2 lines

I have some questions:
- Is it OK to copy the micron sdram params file to a new

file with

Quoted 1 line
Quoted 1 line
Quoted 1 line

the 2 CSes params? One could use a unique file with

#ifdef SDRC_SUPPORT_2_CSES.

Quoted 14 lines
Quoted 14 lines

Is it possible for the SDRAM parameter files to remain unchanged, and to simply pass two struct omap_sdrc_params * to omap2_init_common_hw() and then to omap2_sdrc_init()? Boards with only CS0 in use should pass NULL for the second omap_sdrc_params *.

So something like this (I realize the PM branch has additional parameters here also):

void __init omap2_init_common_hw(struct omap_sdrc_params *sdrc_cs0,
struct omap_sdrc_params *sdrc_cs1)

Then:

Quoted 8 lines
Quoted 8 lines

void __init omap2_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
struct omap_sdrc_params *sdrc_cs1)

I would prefer that approach.

It would also be good to avoid changing the SDRC CS1 parameters in the SRAM code if the board does not use CS1. Maybe pass in a flag that indicates whether CS1 is in use, and if not, avoid

programming

Quoted 1 line
Quoted 1 line

those registers? The (admittedly minor) overhead of

loading the CS1

Quoted 11 lines
Quoted 9 lines

registers off the stack would be nice to avoid also.

Quoted 2 lines

- Does the RX51 board have 2 sdram parts? If so I need to update the board file as well.

Probably best if someone from Nokia handles this.

- Paul

- Paul

author
#15 lore raw

Re: [RFC][PATCH] OMAP3: add support for 2 SDRAM chip selects (was: Re: Beagleboard rev C memory timings & suspend/resume)

In reply to Paul Walmsley

Paul,

Here is the updated patch that fixes the Overo build as well. Can you check it?

Kevin, can you push it if it is correct?

Regards,
Jean

Quoted 1 line

From ebe57354b04444de059e1f042e0c488f761853f0 Mon Sep 17 00:00:00 2001

From: Jean Pihet <[email protected]>
Date: Fri, 5 Jun 2009 17:19:00 +0200
Subject: OMAP3: add support for 2 SDRAM chip selects

Some boards (Beagle Cx, Overo) have 2 SDRAM parts
connected to the SDRC.

This patch adds the following:
- ensure that the CKE signals mux settings are correct
- add a new argument of type omap_sdrc_params struct* to omap2_init_common_hw and omap2_sdrc_init for the 2nd CS params
- adapted the OMAP boards files to the new prototype of omap2_init_common_hw. Only Beagle and Overo are using the 2 CS'es
- adapt the sram sleep code to configure the SDRC for the 2nd CS

Note: If the 2nd param to omap2_init_common_hw is NULL, then the parameters are not programmed into the SDRC CS1 registers

Tested on 3430 SDP and Beagleboard rev C2 and B5, with suspend/resume and frequency changes (cpufreq).

Thanks to Paul Walmsley and Kevin Hilman for the suggestions and code reviews.

---
 arch/arm/mach-omap2/board-2430sdp.c      |    2 +-
 arch/arm/mach-omap2/board-3430sdp.c      |    6 +-
 arch/arm/mach-omap2/board-apollon.c      |    2 +-
 arch/arm/mach-omap2/board-generic.c      |    2 +-
 arch/arm/mach-omap2/board-h4.c           |    2 +-
 arch/arm/mach-omap2/board-ldp.c          |    2 +-
 arch/arm/mach-omap2/board-n800.c         |    2 +-
 arch/arm/mach-omap2/board-omap2evm.c     |    2 +-
 arch/arm/mach-omap2/board-omap3beagle.c  |   11 ++-
 arch/arm/mach-omap2/board-omap3evm.c     |    6 +-
 arch/arm/mach-omap2/board-omap3pandora.c |    3 +-
 arch/arm/mach-omap2/board-overo.c        |    9 ++-
 arch/arm/mach-omap2/board-rx51.c         |    6 +-
 arch/arm/mach-omap2/clock34xx.c          |   37 ++++++--
 arch/arm/mach-omap2/io.c                 |    5 +-
 arch/arm/mach-omap2/mux.c                |    6 ++
 arch/arm/mach-omap2/sdrc.c               |   63 +++++++++-----
 arch/arm/mach-omap2/sram34xx.S           |  137 
+++++++++++++++++++++++-------
 arch/arm/plat-omap/include/mach/io.h     |    3 +-
 arch/arm/plat-omap/include/mach/mux.h    |    4 +
 arch/arm/plat-omap/include/mach/sdrc.h   |    8 +-
 arch/arm/plat-omap/include/mach/sram.h   |   23 +++--
 arch/arm/plat-omap/sram.c                |   34 +++++---
 23 files changed, 267 insertions(+), 108 deletions(-)
(quoted diff) +0 -0

b/arch/arm/mach-omap2/board-2430sdp.c
index aa5df72..4cb7bc5 100644

arch/arm/mach-omap2/board-2430sdp.c +1 -1
@@ -322,7 +322,7 @@ out:
 
 static void __init omap_2430sdp_init_irq(void)
 {
-	omap2_init_common_hw(NULL);
+	omap2_init_common_hw(NULL, NULL, NULL, NULL, NULL);
 	omap_init_irq();
 	omap_gpio_init();
 	sdp2430_init_smc91x();
(quoted diff) +0 -0

b/arch/arm/mach-omap2/board-3430sdp.c
index 195b749..24e2728 100644

arch/arm/mach-omap2/board-3430sdp.c +4 -2
@@ -302,8 +302,10 @@ static inline void __init sdp3430_init_smc91x(void)
 
 static void __init omap_3430sdp_init_irq(void)
 {
-	omap2_init_common_hw(hyb18m512160af6_sdrc_params, omap3_mpu_rate_table,
-			     omap3_dsp_rate_table, omap3_l3_rate_table);
+	omap2_init_common_hw(hyb18m512160af6_sdrc_params, NULL,
+			     omap3_mpu_rate_table,
+			     omap3_dsp_rate_table,
+			     omap3_l3_rate_table);
 	omap_init_irq();
 	omap_gpio_init();
 	sdp3430_init_smc91x();
(quoted diff) +0 -0

b/arch/arm/mach-omap2/board-apollon.c
index 2e24812..2dd1350 100644

arch/arm/mach-omap2/board-apollon.c +1 -1
@@ -323,7 +323,7 @@ out:
 
 static void __init omap_apollon_init_irq(void)
 {
-	omap2_init_common_hw(NULL, NULL, NULL, NULL);
+	omap2_init_common_hw(NULL, NULL, NULL, NULL, NULL);
 	omap_init_irq();
 	omap_gpio_init();
 	apollon_init_smc91x();
(quoted diff) +0 -0

b/arch/arm/mach-omap2/board-generic.c
index be763a9..763329b 100644

arch/arm/mach-omap2/board-generic.c +1 -1
@@ -33,7 +33,7 @@
 
 static void __init omap_generic_init_irq(void)
 {
-	omap2_init_common_hw(NULL, NULL, NULL, NULL);
+	omap2_init_common_hw(NULL, NULL, NULL, NULL, NULL);
 	omap_init_irq();
 }
 
arch/arm/mach-omap2/board-h4.c +1 -1
index 8f54939..17c3599 100644
@@ -348,7 +348,7 @@ static void __init h4_init_flash(void)
 
 static void __init omap_h4_init_irq(void)
 {
-	omap2_init_common_hw(NULL, NULL, NULL, NULL);
+	omap2_init_common_hw(NULL, NULL, NULL, NULL, NULL);
 	omap_init_irq();
 	omap_gpio_init();
 	h4_init_flash();
arch/arm/mach-omap2/board-ldp.c +1 -1
index 9f41dc9..b012806 100644
@@ -344,7 +344,7 @@ static inline void __init ldp_init_smc911x(void)
 
 static void __init omap_ldp_init_irq(void)
 {
-	omap2_init_common_hw(NULL, NULL, NULL, NULL);
+	omap2_init_common_hw(NULL, NULL, NULL, NULL, NULL);
 	omap_init_irq();
 	omap_gpio_init();
 	ldp_init_smc911x();
(quoted diff) +0 -0

b/arch/arm/mach-omap2/board-n800.c
index ac7cf3f..ad53f4a 100644

arch/arm/mach-omap2/board-n800.c +1 -1
@@ -127,7 +127,7 @@ static struct lm8323_platform_data lm8323_pdata = {
 
 void __init nokia_n800_init_irq(void)
 {
-	omap2_init_common_hw(NULL, NULL, NULL, NULL);
+	omap2_init_common_hw(NULL, NULL, NULL, NULL, NULL);
 	omap_init_irq();
 	omap_gpio_init();
 
(quoted diff) +0 -0

b/arch/arm/mach-omap2/board-omap2evm.c
index 4fac1be..56a26d4 100644

arch/arm/mach-omap2/board-omap2evm.c +1 -1
@@ -276,7 +276,7 @@ static struct twl4030_keypad_data omap2evm_kp_data = {
 
 static void __init omap2_evm_init_irq(void)
 {
-	omap2_init_common_hw(NULL, NULL, NULL, NULL);
+	omap2_init_common_hw(NULL, NULL, NULL, NULL, NULL);
 	omap_init_irq();
 	omap_gpio_init();
 	omap2evm_init_smc911x();
(quoted diff) +0 -0

b/arch/arm/mach-omap2/board-omap3beagle.c
index 7294dbf..872beb6 100644

arch/arm/mach-omap2/board-omap3beagle.c +9 -2
@@ -312,8 +312,11 @@ static int __init omap3_beagle_i2c_init(void)
 
 static void __init omap3_beagle_init_irq(void)
 {
-	omap2_init_common_hw(mt46h32m32lf6_sdrc_params, omap3_mpu_rate_table,
-			     omap3_dsp_rate_table, omap3_l3_rate_table);
+	omap2_init_common_hw(mt46h32m32lf6_sdrc_params,
+			     mt46h32m32lf6_sdrc_params,
+			     omap3_mpu_rate_table,
+			     omap3_dsp_rate_table,
+			     omap3_l3_rate_table);
 	omap_init_irq();
 	omap_gpio_init();
 }
@@ -441,6 +444,10 @@ static void __init omap3_beagle_init(void)
 	usb_musb_init();
 	usb_ehci_init();
 	omap3beagle_flash_init();
+
+	/* Ensure SDRC pins are mux'd for self-refresh */
+	omap_cfg_reg(H16_34XX_SDRC_CKE0);
+	omap_cfg_reg(H17_34XX_SDRC_CKE1);
 }
 
 static void __init omap3_beagle_map_io(void)
(quoted diff) +0 -0

b/arch/arm/mach-omap2/board-omap3evm.c
index f017f0d..3b9c96a 100644

arch/arm/mach-omap2/board-omap3evm.c +4 -2
@@ -276,8 +276,10 @@ struct spi_board_info omap3evm_spi_board_info[] = {
 
 static void __init omap3_evm_init_irq(void)
 {
-	omap2_init_common_hw(mt46h32m32lf6_sdrc_params, omap3_mpu_rate_table,
-	                     omap3_dsp_rate_table, omap3_l3_rate_table);
+	omap2_init_common_hw(mt46h32m32lf6_sdrc_params, NULL,
+			     omap3_mpu_rate_table,
+			     omap3_dsp_rate_table,
+			     omap3_l3_rate_table);
 	omap_init_irq();
 	omap_gpio_init();
 	omap3evm_init_smc911x();
(quoted diff) +0 -0

b/arch/arm/mach-omap2/board-omap3pandora.c
index c67f62f..05ab99e 100644

arch/arm/mach-omap2/board-omap3pandora.c +2 -1
@@ -220,7 +220,8 @@ static int __init omap3pandora_i2c_init(void)
 
 static void __init omap3pandora_init_irq(void)
 {
-	omap2_init_common_hw(mt46h32m32lf6_sdrc_params);
+	omap2_init_common_hw(mt46h32m32lf6_sdrc_params, NULL,
+			     NULL, NULL, NULL);
 	omap_init_irq();
 	omap_gpio_init();
 }
(quoted diff) +0 -0

b/arch/arm/mach-omap2/board-overo.c
index 9eae608..50902d4 100644

arch/arm/mach-omap2/board-overo.c +8 -1
@@ -45,6 +45,7 @@
 #include <mach/gpmc.h>
 #include <mach/hardware.h>
 #include <mach/nand.h>
+#include <mach/mux.h>
 #include <mach/usb.h>
 
 #include "sdram-micron-mt46h32m32lf-6.h"
@@ -355,7 +356,9 @@ static int __init overo_i2c_init(void)
 
 static void __init overo_init_irq(void)
 {
-	omap2_init_common_hw(mt46h32m32lf6_sdrc_params, NULL, NULL, NULL);
+	omap2_init_common_hw(mt46h32m32lf6_sdrc_params,
+			     mt46h32m32lf6_sdrc_params,
+			     NULL, NULL, NULL);
 	omap_init_irq();
 	omap_gpio_init();
 }
@@ -391,6 +394,10 @@ static void __init overo_init(void)
 	overo_init_smsc911x();
 	overo_ads7846_init();
 
+	/* Ensure SDRC pins are mux'd for self-refresh */
+	omap_cfg_reg(H16_34XX_SDRC_CKE0);
+	omap_cfg_reg(H17_34XX_SDRC_CKE1);
+
 	if ((gpio_request(OVERO_GPIO_W2W_NRESET,
 			  "OVERO_GPIO_W2W_NRESET") == 0) &&
 	    (gpio_direction_output(OVERO_GPIO_W2W_NRESET, 1) == 0)) {
(quoted diff) +0 -0

b/arch/arm/mach-omap2/board-rx51.c
index 09035b0..d48459f 100644

arch/arm/mach-omap2/board-rx51.c +4 -2
@@ -64,8 +64,10 @@ static struct omap_board_config_kernel rx51_config[] = {
 
 static void __init rx51_init_irq(void)
 {
-	omap2_init_common_hw(rx51_get_sdram_timings(), omap3_mpu_rate_table,
-			     omap3_dsp_rate_table, omap3_l3_rate_table);
+	omap2_init_common_hw(rx51_get_sdram_timings(), NULL,
+			     omap3_mpu_rate_table,
+			     omap3_dsp_rate_table,
+			     omap3_l3_rate_table);
 	omap_init_irq();
 	omap_gpio_init();
 }
arch/arm/mach-omap2/clock34xx.c +0 -0
index 3cee6b4..f262787 100644
@@ -478,7 +478,9 @@ static int omap3_core_dpll_m2_set_rate(struct clk *clk, 

unsigned long rate)
u32 unlock_dll = 0;
u32 c;
unsigned long validrate, sdrcrate, mpurate;
- struct omap_sdrc_params *sp;
+ struct omap_sdrc_params *sdrc_cs0;
+ struct omap_sdrc_params *sdrc_cs1;
+ int ret;

if (!clk || !rate)
return -EINVAL;
@@ -496,8 +498,8 @@ static int omap3_core_dpll_m2_set_rate(struct clk *clk, unsigned long rate)
else
sdrcrate >>= ((clk->rate / rate) >> 1);

- sp = omap2_sdrc_get_params(sdrcrate);
- if (!sp)
+ ret = omap2_sdrc_get_params(sdrcrate, &sdrc_cs0, &sdrc_cs1);
+ if (ret)
return -EINVAL;

if (sdrcrate < MIN_SDRC_DLL_LOCK_FREQ) {
@@ -518,12 +520,29 @@ static int omap3_core_dpll_m2_set_rate(struct clk *clk, unsigned long rate)

pr_debug("clock: changing CORE DPLL rate from %lu to %lu\n", clk->rate,
validrate);
- pr_debug("clock: SDRC timing params used: %08x %08x %08x\n",
- sp->rfr_ctrl, sp->actim_ctrla, sp->actim_ctrlb);
-
- omap3_configure_core_dpll(sp->rfr_ctrl, sp->actim_ctrla,
- sp->actim_ctrlb, new_div, unlock_dll, c,
- sp->mr, rate > clk->rate);
+ pr_debug("clock: SDRC CS0 timing params used:"
+ " RFR %08x CTRLA %08x CTRLB %08x MR %08x\n",
+ sdrc_cs0->rfr_ctrl, sdrc_cs0->actim_ctrla,
+ sdrc_cs0->actim_ctrlb, sdrc_cs0->mr);
+ if (sdrc_cs1)
+ pr_debug("clock: SDRC CS1 timing params used: "
+ " RFR %08x CTRLA %08x CTRLB %08x MR %08x\n",
+ sdrc_cs1->rfr_ctrl, sdrc_cs1->actim_ctrla,
+ sdrc_cs1->actim_ctrlb, sdrc_cs1->mr);
+
+ if (sdrc_cs1)
+ omap3_configure_core_dpll(

+				  new_div, unlock_dll, c, rate > clk->rate,
+				  sdrc_cs0->rfr_ctrl, sdrc_cs0->actim_ctrla,
+				  sdrc_cs0->actim_ctrlb, sdrc_cs0->mr,
+				  sdrc_cs1->rfr_ctrl, sdrc_cs1->actim_ctrla,
+				  sdrc_cs1->actim_ctrlb, sdrc_cs1->mr);
+	else
+		omap3_configure_core_dpll(
+				  new_div, unlock_dll, c, rate > clk->rate,
+				  sdrc_cs0->rfr_ctrl, sdrc_cs0->actim_ctrla,
+				  sdrc_cs0->actim_ctrlb, sdrc_cs0->mr,
+				  0, 0, 0, 0);

return 0;
}

arch/arm/mach-omap2/io.c +2 -1
index 6fb6c29..aa000b4 100644
@@ -231,7 +231,8 @@ static int __init _omap2_init_reprogram_sdrc(void)
 	return v;
 }
 
-void __init omap2_init_common_hw(struct omap_sdrc_params *sp,
+void __init omap2_init_common_hw(struct omap_sdrc_params *sdrc_cs0,
+				 struct omap_sdrc_params *sdrc_cs1,
 				 struct omap_opp *mpu_opps,
 				 struct omap_opp *dsp_opps,
 				 struct omap_opp *l3_opps)
@@ -244,7 +245,7 @@ void __init omap2_init_common_hw(struct omap_sdrc_params 

*sp,
omapdev_init(omapdevs);
omap2_clk_init();
omap_pm_if_init();
- omap2_sdrc_init(sp);
+ omap2_sdrc_init(sdrc_cs0, sdrc_cs1);

_omap2_init_reprogram_sdrc();

arch/arm/mach-omap2/mux.c +6 -0
index 026c4fc..43d6b92 100644
@@ -486,6 +486,12 @@ MUX_CFG_34XX("H19_34XX_GPIO164_OUT", 0x19c,
 		OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_OUTPUT)
 MUX_CFG_34XX("J25_34XX_GPIO170", 0x1c6,
 		OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_INPUT)
+
+/* OMAP3 SDRC CKE signals to SDR/DDR ram chips */
+MUX_CFG_34XX("H16_34XX_SDRC_CKE0", 0x262,
+		OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_OUTPUT)
+MUX_CFG_34XX("H17_34XX_SDRC_CKE1", 0x264,
+		OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_OUTPUT)
 };
 
 #define OMAP34XX_PINS_SZ	ARRAY_SIZE(omap34xx_pins)
arch/arm/mach-omap2/sdrc.c +35 -19

75 lines not on this page · raw message

*omap2_globals)

/**
* omap2_sdrc_init - initialize SMS, SDRC devices on boot
- * @sp: pointer to a null-terminated list of struct omap_sdrc_params
+ * @sdrc_cs[01]: pointers to a null-terminated list of struct omap_sdrc_params
+ * Support for 2 chip selects timings
*
* Turn on smart idle modes for SDRAM scheduler and controller.
* Program a known-good configuration for the SDRC to deal with buggy
* bootloaders.
*/
-void __init omap2_sdrc_init(struct omap_sdrc_params *sp) +void __init omap2_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
+ struct omap_sdrc_params *sdrc_cs1)
{
u32 l;

@@ -129,7 +147,8 @@ void __init omap2_sdrc_init(struct omap_sdrc_params *sp)
l |= (0x2 << 3);
sdrc_write_reg(l, SDRC_SYSCONFIG);

- sdrc_init_params = sp;
+ sdrc_init_params_cs0 = sdrc_cs0;
+ sdrc_init_params_cs1 = sdrc_cs1;

/* XXX Enable SRFRONIDLEREQ here also? */
l = (1 << SDRC_POWER_EXTCLKDIS_SHIFT) |

arch/arm/mach-omap2/sram34xx.S +107 -30

193 lines not on this page · raw message

(quoted diff) +0 -0

b/arch/arm/plat-omap/include/mach/io.h
index 54c159b..d4c78b4 100644

arch/arm/plat-omap/include/mach/io.h +2 -1
@@ -192,7 +192,8 @@ extern void omap1_map_common_io(void);
 extern void omap1_init_common_hw(void);
 
 extern void omap2_map_common_io(void);
-extern void omap2_init_common_hw(struct omap_sdrc_params *sp,
+extern void omap2_init_common_hw(struct omap_sdrc_params *sdrc_cs0,
+				 struct omap_sdrc_params *sdrc_cs1,
 				 struct omap_opp *mpu_opps,
 				 struct omap_opp *dsp_opps,
 				 struct omap_opp *l3_opps);
(quoted diff) +0 -0

b/arch/arm/plat-omap/include/mach/mux.h
index f7e298a..7368aba 100644

arch/arm/plat-omap/include/mach/mux.h +4 -0
@@ -803,6 +803,10 @@ enum omap34xx_index {
 	AE5_34XX_GPIO143,
 	H19_34XX_GPIO164_OUT,
 	J25_34XX_GPIO170,
+
+	/* OMAP3 SDRC CKE signals to SDR/DDR ram chips */
+	H16_34XX_SDRC_CKE0,
+	H17_34XX_SDRC_CKE1,
 };
 
 struct omap_mux_cfg {
(quoted diff) +0 -0

b/arch/arm/plat-omap/include/mach/sdrc.h
index a678bc8..7e22143 100644

arch/arm/plat-omap/include/mach/sdrc.h +5 -3
@@ -114,9 +114,11 @@ struct omap_sdrc_params {
 
 void omap2_sms_save_context(void);
 void omap2_sms_restore_context(void);
-void __init omap2_sdrc_init(struct omap_sdrc_params *);
-struct omap_sdrc_params *omap2_sdrc_get_params(unsigned long r);
-
+void __init omap2_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
+			    struct omap_sdrc_params *sdrc_cs1);
+int omap2_sdrc_get_params(unsigned long r,
+			  struct omap_sdrc_params **sdrc_cs0,
+			  struct omap_sdrc_params **sdrc_cs1);
 #ifdef CONFIG_ARCH_OMAP2
 
 struct memory_timings {
(quoted diff) +0 -0

b/arch/arm/plat-omap/include/mach/sram.h
index ad0a600..98906ea 100644

arch/arm/plat-omap/include/mach/sram.h +0 -0
@@ -21,11 +21,13 @@ extern void omap2_sram_reprogram_sdrc(u32 perf_level, u32 

dll_val,
u32 mem_type);
extern u32 omap2_set_prcm(u32 dpll_ctrl_val, u32 sdrc_rfr_val, int bypass);

-extern u32 omap3_configure_core_dpll(u32 sdrc_rfr_ctrl,

-				     u32 sdrc_actim_ctrla,
-				     u32 sdrc_actim_ctrlb, u32 m2,
-				     u32 unlock_dll, u32 f, u32 sdrc_mr,
-				     u32 inc);

+extern u32 omap3_configure_core_dpll(
+ u32 m2, u32 unlock_dll, u32 f, u32 inc,
+ u32 sdrc_rfr_ctrl_0, u32 sdrc_actim_ctrl_a_0,
+ u32 sdrc_actim_ctrl_b_0, u32 sdrc_mr_0,
+ u32 sdrc_rfr_ctrl_1, u32 sdrc_actim_ctrl_a_1,
+ u32 sdrc_actim_ctrl_b_1, u32 sdrc_mr_1);
+
extern void omap3_sram_restore_context(void);

/* Do not use these */
@@ -61,11 +63,12 @@ extern void omap243x_sram_reprogram_sdrc(u32 perf_level, u32 dll_val,
extern unsigned long omap243x_sram_reprogram_sdrc_sz;

-extern u32 omap3_sram_configure_core_dpll(u32 sdrc_rfr_ctrl,

-					  u32 sdrc_actim_ctrla,
-					  u32 sdrc_actim_ctrlb, u32 m2,
-					  u32 unlock_dll, u32 f, u32 sdrc_mr,
-					  u32 inc);

+extern u32 omap3_sram_configure_core_dpll(
+ u32 m2, u32 unlock_dll, u32 f, u32 inc,
+ u32 sdrc_rfr_ctrl_0, u32 sdrc_actim_ctrl_a_0,
+ u32 sdrc_actim_ctrl_b_0, u32 sdrc_mr_0,
+ u32 sdrc_rfr_ctrl_1, u32 sdrc_actim_ctrl_a_1,
+ u32 sdrc_actim_ctrl_b_1, u32 sdrc_mr_1);
extern unsigned long omap3_sram_configure_core_dpll_sz;

#ifdef CONFIG_PM

arch/arm/plat-omap/sram.c +20 -14
index a2e60e7..517f45b 100644
@@ -368,23 +368,29 @@ static inline int omap243x_sram_init(void)
 
 #ifdef CONFIG_ARCH_OMAP3
 
-static u32 (*_omap3_sram_configure_core_dpll)(u32 sdrc_rfr_ctrl,
-					      u32 sdrc_actim_ctrla,
-					      u32 sdrc_actim_ctrlb,
-					      u32 m2, u32 unlock_dll,
-					      u32 f, u32 sdrc_mr, u32 inc);
-u32 omap3_configure_core_dpll(u32 sdrc_rfr_ctrl, u32 sdrc_actim_ctrla,
-			      u32 sdrc_actim_ctrlb, u32 m2, u32 unlock_dll,
-			      u32 f, u32 sdrc_mr, u32 inc)
- {
+static u32 (*_omap3_sram_configure_core_dpll)(
+				u32 m2, u32 unlock_dll, u32 f, u32 inc,
+				u32 sdrc_rfr_ctrl_0, u32 sdrc_actim_ctrl_a_0,
+				u32 sdrc_actim_ctrl_b_0, u32 sdrc_mr_0,
+				u32 sdrc_rfr_ctrl_1, u32 sdrc_actim_ctrl_a_1,
+				u32 sdrc_actim_ctrl_b_1, u32 sdrc_mr_1);
+
+u32 omap3_configure_core_dpll(u32 m2, u32 unlock_dll, u32 f, u32 inc,
+			      u32 sdrc_rfr_ctrl_0, u32 sdrc_actim_ctrl_a_0,
+			      u32 sdrc_actim_ctrl_b_0, u32 sdrc_mr_0,
+			      u32 sdrc_rfr_ctrl_1, u32 sdrc_actim_ctrl_a_1,
+			      u32 sdrc_actim_ctrl_b_1, u32 sdrc_mr_1)
+{
 	if (!_omap3_sram_configure_core_dpll)
 		omap_sram_error();
 
-	return _omap3_sram_configure_core_dpll(sdrc_rfr_ctrl,
-					       sdrc_actim_ctrla,
-					       sdrc_actim_ctrlb, m2,
-					       unlock_dll, f, sdrc_mr, inc);
- }
+	return _omap3_sram_configure_core_dpll(
+				m2, unlock_dll, f, inc,
+				sdrc_rfr_ctrl_0, sdrc_actim_ctrl_a_0,
+				sdrc_actim_ctrl_b_0, sdrc_mr_0,
+				sdrc_rfr_ctrl_1, sdrc_actim_ctrl_a_1,
+				sdrc_actim_ctrl_b_1, sdrc_mr_1);
+}
 
 #ifdef CONFIG_PM
 void omap3_sram_restore_context(void)
Signature · 1 line
1.6.2.5.168.g3823
Quoted 23 lines · On Friday 05 June 2009 20:10:40 Paul Walmsley wrote:

Hi Jean,

Quoted 10 lines · Jean Pihet

Here is the new patch that includes all the remarks and suggestion. The description is here below.

Some notes:
- all calls to omap2_init_common_hw have been adapted in the board files. it looks like 2430SDP and Pandora board files are broken since they use only one param. Can that be checked on those boards?
- it is assumed that RX51 only uses 1 CS. Is that correct?

Can you review it and possibly merge?

Looks great.

Tero, does RX51 use two SDRC chipselects!

Quoted 3 lines

Thanks & regards,
Jean

#16 lore raw

Re: [RFC][PATCH] OMAP3: add support for 2 SDRAM chip selects (was: Re: Beagleboard rev C memory timings & suspend/resume)

Quoted 6 lines · Jean Pihet

Paul,

Here is the updated patch that fixes the Overo build as well. Can you check it?

Kevin, can you push it if it is correct?

Can you run it through checkpatch, fix the errors and also merge Tero's RX51 patch if it looks good to you.

Below are the checkpatch errors I get: looks lik your mailer is probably wrapping the patch and there is also one error to fix.

Kevin

ERROR: patch seems to be corrupt (line wrapped?)
#306: FILE: arch/arm/mach-omap2/clock34xx.c:477:
unsigned long rate)

ERROR: trailing whitespace
#494: FILE: arch/arm/mach-omap2/sdrc.c:128:
+ * @sdrc_cs[01]: pointers to a null-terminated list of struct $

total: 2 errors, 0 warnings, 648 lines checked

Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.

Quoted 878 lines

Regards,
Jean

From ebe57354b04444de059e1f042e0c488f761853f0 Mon Sep 17 00:00:00 2001
From: Jean Pihet <[email protected]>
Date: Fri, 5 Jun 2009 17:19:00 +0200
Subject: OMAP3: add support for 2 SDRAM chip selects

Some boards (Beagle Cx, Overo) have 2 SDRAM parts
connected to the SDRC.

This patch adds the following:
- ensure that the CKE signals mux settings are correct
- add a new argument of type omap_sdrc_params struct* to omap2_init_common_hw and omap2_sdrc_init for the 2nd CS params
- adapted the OMAP boards files to the new prototype of omap2_init_common_hw. Only Beagle and Overo are using the 2 CS'es
- adapt the sram sleep code to configure the SDRC for the 2nd CS

Note: If the 2nd param to omap2_init_common_hw is NULL, then the parameters are not programmed into the SDRC CS1 registers

Tested on 3430 SDP and Beagleboard rev C2 and B5, with suspend/resume and frequency changes (cpufreq).

Thanks to Paul Walmsley and Kevin Hilman for the suggestions and code reviews.

---
 arch/arm/mach-omap2/board-2430sdp.c      |    2 +-
 arch/arm/mach-omap2/board-3430sdp.c      |    6 +-
 arch/arm/mach-omap2/board-apollon.c      |    2 +-
 arch/arm/mach-omap2/board-generic.c      |    2 +-
 arch/arm/mach-omap2/board-h4.c           |    2 +-
 arch/arm/mach-omap2/board-ldp.c          |    2 +-
 arch/arm/mach-omap2/board-n800.c         |    2 +-
 arch/arm/mach-omap2/board-omap2evm.c     |    2 +-
 arch/arm/mach-omap2/board-omap3beagle.c  |   11 ++-
 arch/arm/mach-omap2/board-omap3evm.c     |    6 +-
 arch/arm/mach-omap2/board-omap3pandora.c |    3 +-
 arch/arm/mach-omap2/board-overo.c        |    9 ++-
 arch/arm/mach-omap2/board-rx51.c         |    6 +-
 arch/arm/mach-omap2/clock34xx.c          |   37 ++++++--
 arch/arm/mach-omap2/io.c                 |    5 +-
 arch/arm/mach-omap2/mux.c                |    6 ++
 arch/arm/mach-omap2/sdrc.c               |   63 +++++++++-----
 arch/arm/mach-omap2/sram34xx.S           |  137 
+++++++++++++++++++++++-------
 arch/arm/plat-omap/include/mach/io.h     |    3 +-
 arch/arm/plat-omap/include/mach/mux.h    |    4 +
 arch/arm/plat-omap/include/mach/sdrc.h   |    8 +-
 arch/arm/plat-omap/include/mach/sram.h   |   23 +++--
 arch/arm/plat-omap/sram.c                |   34 +++++---
 23 files changed, 267 insertions(+), 108 deletions(-)
arch/arm/mach-omap2/board-2430sdp.c +1 -1
index aa5df72..4cb7bc5 100644
@@ -322,7 +322,7 @@ out:
 
 static void __init omap_2430sdp_init_irq(void)
 {
-	omap2_init_common_hw(NULL);
+	omap2_init_common_hw(NULL, NULL, NULL, NULL, NULL);
 	omap_init_irq();
 	omap_gpio_init();
 	sdp2430_init_smc91x();
arch/arm/mach-omap2/board-3430sdp.c +4 -2
index 195b749..24e2728 100644
@@ -302,8 +302,10 @@ static inline void __init sdp3430_init_smc91x(void)
 
 static void __init omap_3430sdp_init_irq(void)
 {
-	omap2_init_common_hw(hyb18m512160af6_sdrc_params, omap3_mpu_rate_table,
-			     omap3_dsp_rate_table, omap3_l3_rate_table);
+	omap2_init_common_hw(hyb18m512160af6_sdrc_params, NULL,
+			     omap3_mpu_rate_table,
+			     omap3_dsp_rate_table,
+			     omap3_l3_rate_table);
 	omap_init_irq();
 	omap_gpio_init();
 	sdp3430_init_smc91x();
arch/arm/mach-omap2/board-apollon.c +1 -1
index 2e24812..2dd1350 100644
@@ -323,7 +323,7 @@ out:
 
 static void __init omap_apollon_init_irq(void)
 {
-	omap2_init_common_hw(NULL, NULL, NULL, NULL);
+	omap2_init_common_hw(NULL, NULL, NULL, NULL, NULL);
 	omap_init_irq();
 	omap_gpio_init();
 	apollon_init_smc91x();
arch/arm/mach-omap2/board-generic.c +1 -1
index be763a9..763329b 100644
@@ -33,7 +33,7 @@
 
 static void __init omap_generic_init_irq(void)
 {
-	omap2_init_common_hw(NULL, NULL, NULL, NULL);
+	omap2_init_common_hw(NULL, NULL, NULL, NULL, NULL);
 	omap_init_irq();
 }
 
arch/arm/mach-omap2/board-h4.c +1 -1
index 8f54939..17c3599 100644
@@ -348,7 +348,7 @@ static void __init h4_init_flash(void)
 
 static void __init omap_h4_init_irq(void)
 {
-	omap2_init_common_hw(NULL, NULL, NULL, NULL);
+	omap2_init_common_hw(NULL, NULL, NULL, NULL, NULL);
 	omap_init_irq();
 	omap_gpio_init();
 	h4_init_flash();
arch/arm/mach-omap2/board-ldp.c +1 -1
index 9f41dc9..b012806 100644
@@ -344,7 +344,7 @@ static inline void __init ldp_init_smc911x(void)
 
 static void __init omap_ldp_init_irq(void)
 {
-	omap2_init_common_hw(NULL, NULL, NULL, NULL);
+	omap2_init_common_hw(NULL, NULL, NULL, NULL, NULL);
 	omap_init_irq();
 	omap_gpio_init();
 	ldp_init_smc911x();
arch/arm/mach-omap2/board-n800.c +1 -1
index ac7cf3f..ad53f4a 100644
@@ -127,7 +127,7 @@ static struct lm8323_platform_data lm8323_pdata = {
 
 void __init nokia_n800_init_irq(void)
 {
-	omap2_init_common_hw(NULL, NULL, NULL, NULL);
+	omap2_init_common_hw(NULL, NULL, NULL, NULL, NULL);
 	omap_init_irq();
 	omap_gpio_init();
 
arch/arm/mach-omap2/board-omap2evm.c +1 -1
index 4fac1be..56a26d4 100644
@@ -276,7 +276,7 @@ static struct twl4030_keypad_data omap2evm_kp_data = {
 
 static void __init omap2_evm_init_irq(void)
 {
-	omap2_init_common_hw(NULL, NULL, NULL, NULL);
+	omap2_init_common_hw(NULL, NULL, NULL, NULL, NULL);
 	omap_init_irq();
 	omap_gpio_init();
 	omap2evm_init_smc911x();
arch/arm/mach-omap2/board-omap3beagle.c +9 -2
index 7294dbf..872beb6 100644
@@ -312,8 +312,11 @@ static int __init omap3_beagle_i2c_init(void)
 
 static void __init omap3_beagle_init_irq(void)
 {
-	omap2_init_common_hw(mt46h32m32lf6_sdrc_params, omap3_mpu_rate_table,
-			     omap3_dsp_rate_table, omap3_l3_rate_table);
+	omap2_init_common_hw(mt46h32m32lf6_sdrc_params,
+			     mt46h32m32lf6_sdrc_params,
+			     omap3_mpu_rate_table,
+			     omap3_dsp_rate_table,
+			     omap3_l3_rate_table);
 	omap_init_irq();
 	omap_gpio_init();
 }
@@ -441,6 +444,10 @@ static void __init omap3_beagle_init(void)
 	usb_musb_init();
 	usb_ehci_init();
 	omap3beagle_flash_init();
+
+	/* Ensure SDRC pins are mux'd for self-refresh */
+	omap_cfg_reg(H16_34XX_SDRC_CKE0);
+	omap_cfg_reg(H17_34XX_SDRC_CKE1);
 }
 
 static void __init omap3_beagle_map_io(void)
arch/arm/mach-omap2/board-omap3evm.c +4 -2
index f017f0d..3b9c96a 100644
@@ -276,8 +276,10 @@ struct spi_board_info omap3evm_spi_board_info[] = {
 
 static void __init omap3_evm_init_irq(void)
 {
-	omap2_init_common_hw(mt46h32m32lf6_sdrc_params, omap3_mpu_rate_table,
-	                     omap3_dsp_rate_table, omap3_l3_rate_table);
+	omap2_init_common_hw(mt46h32m32lf6_sdrc_params, NULL,
+			     omap3_mpu_rate_table,
+			     omap3_dsp_rate_table,
+			     omap3_l3_rate_table);
 	omap_init_irq();
 	omap_gpio_init();
 	omap3evm_init_smc911x();
arch/arm/mach-omap2/board-omap3pandora.c +2 -1
index c67f62f..05ab99e 100644
@@ -220,7 +220,8 @@ static int __init omap3pandora_i2c_init(void)
 
 static void __init omap3pandora_init_irq(void)
 {
-	omap2_init_common_hw(mt46h32m32lf6_sdrc_params);
+	omap2_init_common_hw(mt46h32m32lf6_sdrc_params, NULL,
+			     NULL, NULL, NULL);
 	omap_init_irq();
 	omap_gpio_init();
 }
arch/arm/mach-omap2/board-overo.c +8 -1
index 9eae608..50902d4 100644
@@ -45,6 +45,7 @@
 #include <mach/gpmc.h>
 #include <mach/hardware.h>
 #include <mach/nand.h>
+#include <mach/mux.h>
 #include <mach/usb.h>
 
 #include "sdram-micron-mt46h32m32lf-6.h"
@@ -355,7 +356,9 @@ static int __init overo_i2c_init(void)
 
 static void __init overo_init_irq(void)
 {
-	omap2_init_common_hw(mt46h32m32lf6_sdrc_params, NULL, NULL, NULL);
+	omap2_init_common_hw(mt46h32m32lf6_sdrc_params,
+			     mt46h32m32lf6_sdrc_params,
+			     NULL, NULL, NULL);
 	omap_init_irq();
 	omap_gpio_init();
 }
@@ -391,6 +394,10 @@ static void __init overo_init(void)
 	overo_init_smsc911x();
 	overo_ads7846_init();
 
+	/* Ensure SDRC pins are mux'd for self-refresh */
+	omap_cfg_reg(H16_34XX_SDRC_CKE0);
+	omap_cfg_reg(H17_34XX_SDRC_CKE1);
+
 	if ((gpio_request(OVERO_GPIO_W2W_NRESET,
 			  "OVERO_GPIO_W2W_NRESET") == 0) &&
 	    (gpio_direction_output(OVERO_GPIO_W2W_NRESET, 1) == 0)) {
arch/arm/mach-omap2/board-rx51.c +4 -2
index 09035b0..d48459f 100644
@@ -64,8 +64,10 @@ static struct omap_board_config_kernel rx51_config[] = {
 
 static void __init rx51_init_irq(void)
 {
-	omap2_init_common_hw(rx51_get_sdram_timings(), omap3_mpu_rate_table,
-			     omap3_dsp_rate_table, omap3_l3_rate_table);
+	omap2_init_common_hw(rx51_get_sdram_timings(), NULL,
+			     omap3_mpu_rate_table,
+			     omap3_dsp_rate_table,
+			     omap3_l3_rate_table);
 	omap_init_irq();
 	omap_gpio_init();
 }
arch/arm/mach-omap2/clock34xx.c +3 -1
index 3cee6b4..f262787 100644
@@ -478,7 +478,9 @@ static int omap3_core_dpll_m2_set_rate(struct clk *clk, 
 unsigned long rate)
 	u32 unlock_dll = 0;
 	u32 c;
 	unsigned long validrate, sdrcrate, mpurate;
-	struct omap_sdrc_params *sp;
+	struct omap_sdrc_params *sdrc_cs0;
+	struct omap_sdrc_params *sdrc_cs1;
+	int ret;
 
 	if (!clk || !rate)
arch/arm/mach-omap2/clock34xx.c +2 -2
 		return -EINVAL;
@@ -496,8 +498,8 @@ static int omap3_core_dpll_m2_set_rate(struct clk *clk, 
 unsigned long rate)
 	else
 		sdrcrate >>= ((clk->rate / rate) >> 1);
 
-	sp = omap2_sdrc_get_params(sdrcrate);
-	if (!sp)
+	ret = omap2_sdrc_get_params(sdrcrate, &sdrc_cs0, &sdrc_cs1);
+	if (ret)
 		return -EINVAL;
 
arch/arm/mach-omap2/clock34xx.c +23 -6
 	if (sdrcrate < MIN_SDRC_DLL_LOCK_FREQ) {
@@ -518,12 +520,29 @@ static int omap3_core_dpll_m2_set_rate(struct clk *clk, 
 unsigned long rate)
 
 	pr_debug("clock: changing CORE DPLL rate from %lu to %lu\n", clk->rate,
 		 validrate);
-	pr_debug("clock: SDRC timing params used: %08x %08x %08x\n",
-		 sp->rfr_ctrl, sp->actim_ctrla, sp->actim_ctrlb);
-
-	omap3_configure_core_dpll(sp->rfr_ctrl, sp->actim_ctrla,
-				  sp->actim_ctrlb, new_div, unlock_dll, c,
-				  sp->mr, rate > clk->rate);
+	pr_debug("clock: SDRC CS0 timing params used:"
+		 " RFR %08x CTRLA %08x CTRLB %08x MR %08x\n",
+		 sdrc_cs0->rfr_ctrl, sdrc_cs0->actim_ctrla,
+		 sdrc_cs0->actim_ctrlb, sdrc_cs0->mr);
+	if (sdrc_cs1)
+		pr_debug("clock: SDRC CS1 timing params used: "
+		 " RFR %08x CTRLA %08x CTRLB %08x MR %08x\n",
+		 sdrc_cs1->rfr_ctrl, sdrc_cs1->actim_ctrla,
+		 sdrc_cs1->actim_ctrlb, sdrc_cs1->mr);
+
+	if (sdrc_cs1)
+		omap3_configure_core_dpll(
+				  new_div, unlock_dll, c, rate > clk->rate,
+				  sdrc_cs0->rfr_ctrl, sdrc_cs0->actim_ctrla,
+				  sdrc_cs0->actim_ctrlb, sdrc_cs0->mr,
+				  sdrc_cs1->rfr_ctrl, sdrc_cs1->actim_ctrla,
+				  sdrc_cs1->actim_ctrlb, sdrc_cs1->mr);
+	else
+		omap3_configure_core_dpll(
+				  new_div, unlock_dll, c, rate > clk->rate,
+				  sdrc_cs0->rfr_ctrl, sdrc_cs0->actim_ctrla,
+				  sdrc_cs0->actim_ctrlb, sdrc_cs0->mr,
+				  0, 0, 0, 0);
 
 	return 0;

}

arch/arm/mach-omap2/io.c +3 -2
index 6fb6c29..aa000b4 100644
@@ -231,7 +231,8 @@ static int __init _omap2_init_reprogram_sdrc(void)
 	return v;
 }
 
-void __init omap2_init_common_hw(struct omap_sdrc_params *sp,
+void __init omap2_init_common_hw(struct omap_sdrc_params *sdrc_cs0,
+				 struct omap_sdrc_params *sdrc_cs1,
 				 struct omap_opp *mpu_opps,
 				 struct omap_opp *dsp_opps,
 				 struct omap_opp *l3_opps)
@@ -244,7 +245,7 @@ void __init omap2_init_common_hw(struct omap_sdrc_params 
 *sp,
 	omapdev_init(omapdevs);
 	omap2_clk_init();
 	omap_pm_if_init();
-	omap2_sdrc_init(sp);
+	omap2_sdrc_init(sdrc_cs0, sdrc_cs1);
 
 	_omap2_init_reprogram_sdrc();
arch/arm/mach-omap2/mux.c +6 -0
index 026c4fc..43d6b92 100644
@@ -486,6 +486,12 @@ MUX_CFG_34XX("H19_34XX_GPIO164_OUT", 0x19c,
 		OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_OUTPUT)
 MUX_CFG_34XX("J25_34XX_GPIO170", 0x1c6,
 		OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_INPUT)
+
+/* OMAP3 SDRC CKE signals to SDR/DDR ram chips */
+MUX_CFG_34XX("H16_34XX_SDRC_CKE0", 0x262,
+		OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_OUTPUT)
+MUX_CFG_34XX("H17_34XX_SDRC_CKE1", 0x264,
+		OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_OUTPUT)
 };
 
 #define OMAP34XX_PINS_SZ	ARRAY_SIZE(omap34xx_pins)
arch/arm/mach-omap2/sdrc.c +36 -20
index c832d83..b42f5ae 100644
@@ -32,7 +32,7 @@
 #include <mach/sdrc.h>
 #include "sdrc.h"
 
-static struct omap_sdrc_params *sdrc_init_params;
+static struct omap_sdrc_params *sdrc_init_params_cs0, *sdrc_init_params_cs1;
 
 void __iomem *omap2_sdrc_base;
 void __iomem *omap2_sms_base;
@@ -71,33 +71,49 @@ void omap2_sms_restore_context(void)
 /**
  * omap2_sdrc_get_params - return SDRC register values for a given clock rate
  * @r: SDRC clock rate (in Hz)
+ * @sdrc_cs0: chip select 0 ram timings **
+ * @sdrc_cs1: chip select 1 ram timings **
  *
  * Return pre-calculated values for the SDRC_ACTIM_CTRLA,
- * SDRC_ACTIM_CTRLB, SDRC_RFR_CTRL, and SDRC_MR registers, for a given
- * SDRC clock rate 'r'.  These parameters control various timing
- * delays in the SDRAM controller that are expressed in terms of the
- * number of SDRC clock cycles to wait; hence the clock rate
- * dependency. Note that sdrc_init_params must be sorted rate
- * descending.  Also assumes that both chip-selects use the same
- * timing parameters.  Returns a struct omap_sdrc_params * upon
- * success, or NULL upon failure.
+ *  SDRC_ACTIM_CTRLB, SDRC_RFR_CTRL and SDRC_MR registers in sdrc_cs[01]
+ *  structs,for a given SDRC clock rate 'r'.
+ * These parameters control various timing delays in the SDRAM controller
+ *  that are expressed in terms of the number of SDRC clock cycles to
+ *  wait; hence the clock rate dependency.
+ *
+ * Supports 2 different timing parameters for both chip selects.
+ *
+ * Note 1: the sdrc_init_params_cs[01] must be sorted rate descending.
+ * Note 2: If sdrc_init_params_cs_1 is not NULL it must be of same size
+ *  as sdrc_init_params_cs_0.
+ *
+ * Fills in the struct omap_sdrc_params * for each chip select.
+ * Returns 0 upon success or -1 upon failure.
  */
-struct omap_sdrc_params *omap2_sdrc_get_params(unsigned long r)
+int omap2_sdrc_get_params(unsigned long r,
+			  struct omap_sdrc_params **sdrc_cs0,
+			  struct omap_sdrc_params **sdrc_cs1)
 {
-	struct omap_sdrc_params *sp;
+	struct omap_sdrc_params *sp0, *sp1;
 
-	if (!sdrc_init_params)
-		return NULL;
+	if (!sdrc_init_params_cs0)
+		return -1;
 
-	sp = sdrc_init_params;
+	sp0 = sdrc_init_params_cs0;
+	sp1 = sdrc_init_params_cs1;
 
-	while (sp->rate && sp->rate != r)
-		sp++;
+	while (sp0->rate && sp0->rate != r) {
+		sp0++;
+		if (sdrc_init_params_cs1)
+			sp1++;
+	}
 
-	if (!sp->rate)
-		return NULL;
+	if (!sp0->rate)
+		return -1;
 
-	return sp;
+	*sdrc_cs0 = sp0;
+	*sdrc_cs1 = sp1;
+	return 0;
 }
 
 
@@ -109,13 +125,15 @@ void __init omap2_set_globals_sdrc(struct omap_globals 
 *omap2_globals)
 
 /**
  * omap2_sdrc_init - initialize SMS, SDRC devices on boot
- * @sp: pointer to a null-terminated list of struct omap_sdrc_params
+ * @sdrc_cs[01]: pointers to a null-terminated list of struct 

omap_sdrc_params
+ * Support for 2 chip selects timings
*
* Turn on smart idle modes for SDRAM scheduler and controller.
* Program a known-good configuration for the SDRC to deal with buggy
* bootloaders.
*/

arch/arm/mach-omap2/sdrc.c +4 -2
-void __init omap2_sdrc_init(struct omap_sdrc_params *sp)
+void __init omap2_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
+			    struct omap_sdrc_params *sdrc_cs1)
 {
 	u32 l;
@@ -129,7 +147,8 @@ void __init omap2_sdrc_init(struct omap_sdrc_params *sp)
 	l |= (0x2 << 3);
 	sdrc_write_reg(l, SDRC_SYSCONFIG);
 
-	sdrc_init_params = sp;
+	sdrc_init_params_cs0 = sdrc_cs0;
+	sdrc_init_params_cs1 = sdrc_cs1;
 
 	/* XXX Enable SRFRONIDLEREQ here also? */
 	l = (1 << SDRC_POWER_EXTCLKDIS_SHIFT) |
arch/arm/mach-omap2/sram34xx.S +107 -30
index f41f8d9..3aef744 100644
@@ -36,7 +36,7 @@
 
 	.text
 
-/* r4 parameters */
+/* r1 parameters */
 #define SDRC_NO_UNLOCK_DLL		0x0
 #define SDRC_UNLOCK_DLL			0x1
 
@@ -71,40 +71,71 @@
 
 /*
  * omap3_sram_configure_core_dpll - change DPLL3 M2 divider
- * r0 = new SDRC_RFR_CTRL register contents
- * r1 = new SDRC_ACTIM_CTRLA register contents
- * r2 = new SDRC_ACTIM_CTRLB register contents
- * r3 = new M2 divider setting (only 1 and 2 supported right now)
- * r4 = unlock SDRC DLL? (1 = yes, 0 = no).  Only unlock DLL for
+ *
+ * Params passed in registers:
+ *  r0 = new M2 divider setting (only 1 and 2 supported right now)
+ *  r1 = unlock SDRC DLL? (1 = yes, 0 = no).  Only unlock DLL for
  *      SDRC rates < 83MHz
- * r5 = number of MPU cycles to wait for SDRC to stabilize after
+ *  r2 = number of MPU cycles to wait for SDRC to stabilize after
  *      reprogramming the SDRC when switching to a slower MPU speed
- * r6 = new SDRC_MR_0 register value
- * r7 = increasing SDRC rate? (1 = yes, 0 = no)
+ *  r3 = increasing SDRC rate? (1 = yes, 0 = no)
+ *
+ * Params passed via the stack. The needed params will be copied in SRAM
+ *  before use by the code in SRAM (SDRAM is not accessible during SDRC
+ *  reconfiguration):
+ *  new SDRC_RFR_CTRL_0 register contents
+ *  new SDRC_ACTIM_CTRL_A_0 register contents
+ *  new SDRC_ACTIM_CTRL_B_0 register contents
+ *  new SDRC_MR_0 register value
+ *  new SDRC_RFR_CTRL_1 register contents
+ *  new SDRC_ACTIM_CTRL_A_1 register contents
+ *  new SDRC_ACTIM_CTRL_B_1 register contents
+ *  new SDRC_MR_1 register value
  *
+ * If the param SDRC_RFR_CTRL_1 is 0, the parameters
+ *  are not programmed into the SDRC CS1 registers
  */
 ENTRY(omap3_sram_configure_core_dpll)
 	stmfd	sp!, {r1-r12, lr}	@ store regs to stack
-	ldr	r4, [sp, #52]		@ pull extra args off the stack
-	ldr	r5, [sp, #56]		@ load extra args from the stack
-	ldr	r6, [sp, #60]		@ load extra args from the stack
-	ldr	r7, [sp, #64]		@ load extra args from the stack
+
+					@ pull the extra args off the stack
+					@  and store them in SRAM
+	ldr	r4, [sp, #52]
+	str     r4, omap_sdrc_rfr_ctrl_0_val
+	ldr	r4, [sp, #56]
+	str     r4, omap_sdrc_actim_ctrl_a_0_val
+	ldr	r4, [sp, #60]
+	str     r4, omap_sdrc_actim_ctrl_b_0_val
+	ldr	r4, [sp, #64]
+	str     r4, omap_sdrc_mr_0_val
+	ldr	r4, [sp, #68]
+	str     r4, omap_sdrc_rfr_ctrl_1_val
+	cmp	r4, #0			@ if SDRC_RFR_CTRL_1 is 0,
+	beq	skip_cs1_params		@  do not use cs1 params
+	ldr	r4, [sp, #72]
+	str     r4, omap_sdrc_actim_ctrl_a_1_val
+	ldr	r4, [sp, #76]
+	str     r4, omap_sdrc_actim_ctrl_b_1_val
+	ldr	r4, [sp, #80]
+	str     r4, omap_sdrc_mr_1_val
+skip_cs1_params:
 	dsb				@ flush buffered writes to interconnect
-	cmp	r7, #1			@ if increasing SDRC clk rate,
+
+	cmp	r3, #1			@ if increasing SDRC clk rate,
 	bleq	configure_sdrc		@ program the SDRC regs early (for RFR)
-	cmp	r4, #SDRC_UNLOCK_DLL	@ set the intended DLL state
+	cmp	r1, #SDRC_UNLOCK_DLL	@ set the intended DLL state
 	bleq	unlock_dll
 	blne	lock_dll
 	bl	sdram_in_selfrefresh	@ put SDRAM in self refresh, idle SDRC
 	bl 	configure_core_dpll	@ change the DPLL3 M2 divider
 	bl	enable_sdrc		@ take SDRC out of idle
-	cmp	r4, #SDRC_UNLOCK_DLL	@ wait for DLL status to change
+	cmp	r1, #SDRC_UNLOCK_DLL	@ wait for DLL status to change
 	bleq	wait_dll_unlock
 	blne	wait_dll_lock
-	cmp	r7, #1			@ if increasing SDRC clk rate,
+	cmp	r3, #1			@ if increasing SDRC clk rate,
 	beq	return_to_sdram		@ return to SDRAM code, otherwise,
 	bl	configure_sdrc		@ reprogram SDRC regs now
-	mov	r12, r5
+	mov	r12, r2
 	bl	wait_clk_stable		@ wait for SDRC to stabilize
 return_to_sdram:
 	isb				@ prevent speculative exec past here
@@ -149,7 +180,7 @@ configure_core_dpll:
 	ldr	r12, [r11]
 	ldr	r10, core_m2_mask_val	@ modify m2 for core dpll
 	and	r12, r12, r10
-	orr	r12, r12, r3, lsl #CORE_DPLL_CLKOUT_DIV_SHIFT
+	orr	r12, r12, r0, lsl #CORE_DPLL_CLKOUT_DIV_SHIFT
 	str	r12, [r11]
 	ldr	r12, [r11]		@ posted-write barrier for CM
 	bx	lr
@@ -187,15 +218,34 @@ wait_dll_unlock:
 	bne	wait_dll_unlock
 	bx	lr
 configure_sdrc:
-	ldr	r11, omap3_sdrc_rfr_ctrl
-	str	r0, [r11]
-	ldr	r11, omap3_sdrc_actim_ctrla
-	str	r1, [r11]
-	ldr	r11, omap3_sdrc_actim_ctrlb
-	str	r2, [r11]
+	ldr	r12, omap_sdrc_rfr_ctrl_0_val	@ fetch value from SRAM
+	ldr	r11, omap3_sdrc_rfr_ctrl_0	@ fetch addr from SRAM
+	str	r12, [r11]			@ store
+	ldr	r12, omap_sdrc_actim_ctrl_a_0_val
+	ldr	r11, omap3_sdrc_actim_ctrl_a_0
+	str	r12, [r11]
+	ldr	r12, omap_sdrc_actim_ctrl_b_0_val
+	ldr	r11, omap3_sdrc_actim_ctrl_b_0
+	str	r12, [r11]
+	ldr	r12, omap_sdrc_mr_0_val
 	ldr	r11, omap3_sdrc_mr_0
-	str	r6, [r11]
-	ldr	r6, [r11]		@ posted-write barrier for SDRC
+	str	r12, [r11]
+	ldr	r12, omap_sdrc_rfr_ctrl_1_val
+	cmp	r12, #0			@ if SDRC_RFR_CTRL_1 is 0,
+	beq	skip_cs1_prog		@  do not program cs1 params
+	ldr	r11, omap3_sdrc_rfr_ctrl_1
+	str	r12, [r11]
+	ldr	r12, omap_sdrc_actim_ctrl_a_1_val
+	ldr	r11, omap3_sdrc_actim_ctrl_a_1
+	str	r12, [r11]
+	ldr	r12, omap_sdrc_actim_ctrl_b_1_val
+	ldr	r11, omap3_sdrc_actim_ctrl_b_1
+	str	r12, [r11]
+	ldr	r12, omap_sdrc_mr_1_val
+	ldr	r11, omap3_sdrc_mr_1
+	str	r12, [r11]
+skip_cs1_prog:
+	ldr	r12, [r11]		@ posted-write barrier for SDRC
 	bx	lr
 
 omap3_sdrc_power:
@@ -206,14 +256,40 @@ omap3_cm_idlest1_core:
 	.word OMAP34XX_CM_REGADDR(CORE_MOD, CM_IDLEST)
 omap3_cm_iclken1_core:
 	.word OMAP34XX_CM_REGADDR(CORE_MOD, CM_ICLKEN1)
-omap3_sdrc_rfr_ctrl:
+
+omap3_sdrc_rfr_ctrl_0:
 	.word OMAP34XX_SDRC_REGADDR(SDRC_RFR_CTRL_0)
-omap3_sdrc_actim_ctrla:
+omap3_sdrc_rfr_ctrl_1:
+	.word OMAP34XX_SDRC_REGADDR(SDRC_RFR_CTRL_1)
+omap3_sdrc_actim_ctrl_a_0:
 	.word OMAP34XX_SDRC_REGADDR(SDRC_ACTIM_CTRL_A_0)
-omap3_sdrc_actim_ctrlb:
+omap3_sdrc_actim_ctrl_a_1:
+	.word OMAP34XX_SDRC_REGADDR(SDRC_ACTIM_CTRL_A_1)
+omap3_sdrc_actim_ctrl_b_0:
 	.word OMAP34XX_SDRC_REGADDR(SDRC_ACTIM_CTRL_B_0)
+omap3_sdrc_actim_ctrl_b_1:
+	.word OMAP34XX_SDRC_REGADDR(SDRC_ACTIM_CTRL_B_1)
 omap3_sdrc_mr_0:
 	.word OMAP34XX_SDRC_REGADDR(SDRC_MR_0)
+omap3_sdrc_mr_1:
+	.word OMAP34XX_SDRC_REGADDR(SDRC_MR_1)
+omap_sdrc_rfr_ctrl_0_val:
+	.word 0xDEADBEEF
+omap_sdrc_rfr_ctrl_1_val:
+	.word 0xDEADBEEF
+omap_sdrc_actim_ctrl_a_0_val:
+	.word 0xDEADBEEF
+omap_sdrc_actim_ctrl_a_1_val:
+	.word 0xDEADBEEF
+omap_sdrc_actim_ctrl_b_0_val:
+	.word 0xDEADBEEF
+omap_sdrc_actim_ctrl_b_1_val:
+	.word 0xDEADBEEF
+omap_sdrc_mr_0_val:
+	.word 0xDEADBEEF
+omap_sdrc_mr_1_val:
+	.word 0xDEADBEEF
+
 omap3_sdrc_dlla_status:
 	.word OMAP34XX_SDRC_REGADDR(SDRC_DLLA_STATUS)
 omap3_sdrc_dlla_ctrl:
@@ -223,3 +299,4 @@ core_m2_mask_val:
 
 ENTRY(omap3_sram_configure_core_dpll_sz)
 	.word	. - omap3_sram_configure_core_dpll
+
arch/arm/plat-omap/include/mach/io.h +2 -1
index 54c159b..d4c78b4 100644
@@ -192,7 +192,8 @@ extern void omap1_map_common_io(void);
 extern void omap1_init_common_hw(void);
 
 extern void omap2_map_common_io(void);
-extern void omap2_init_common_hw(struct omap_sdrc_params *sp,
+extern void omap2_init_common_hw(struct omap_sdrc_params *sdrc_cs0,
+				 struct omap_sdrc_params *sdrc_cs1,
 				 struct omap_opp *mpu_opps,
 				 struct omap_opp *dsp_opps,
 				 struct omap_opp *l3_opps);
arch/arm/plat-omap/include/mach/mux.h +4 -0
index f7e298a..7368aba 100644
@@ -803,6 +803,10 @@ enum omap34xx_index {
 	AE5_34XX_GPIO143,
 	H19_34XX_GPIO164_OUT,
 	J25_34XX_GPIO170,
+
+	/* OMAP3 SDRC CKE signals to SDR/DDR ram chips */
+	H16_34XX_SDRC_CKE0,
+	H17_34XX_SDRC_CKE1,
 };
 
 struct omap_mux_cfg {
arch/arm/plat-omap/include/mach/sdrc.h +5 -3
index a678bc8..7e22143 100644
@@ -114,9 +114,11 @@ struct omap_sdrc_params {
 
 void omap2_sms_save_context(void);
 void omap2_sms_restore_context(void);
-void __init omap2_sdrc_init(struct omap_sdrc_params *);
-struct omap_sdrc_params *omap2_sdrc_get_params(unsigned long r);
-
+void __init omap2_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
+			    struct omap_sdrc_params *sdrc_cs1);
+int omap2_sdrc_get_params(unsigned long r,
+			  struct omap_sdrc_params **sdrc_cs0,
+			  struct omap_sdrc_params **sdrc_cs1);
 #ifdef CONFIG_ARCH_OMAP2
 
 struct memory_timings {
arch/arm/plat-omap/include/mach/sram.h +7 -5
index ad0a600..98906ea 100644
@@ -21,11 +21,13 @@ extern void omap2_sram_reprogram_sdrc(u32 perf_level, u32 
 dll_val,
 				      u32 mem_type);
 extern u32 omap2_set_prcm(u32 dpll_ctrl_val, u32 sdrc_rfr_val, int bypass);
 
-extern u32 omap3_configure_core_dpll(u32 sdrc_rfr_ctrl,
-				     u32 sdrc_actim_ctrla,
-				     u32 sdrc_actim_ctrlb, u32 m2,
-				     u32 unlock_dll, u32 f, u32 sdrc_mr,
-				     u32 inc);
+extern u32 omap3_configure_core_dpll(
+			u32 m2, u32 unlock_dll, u32 f, u32 inc,
+			u32 sdrc_rfr_ctrl_0, u32 sdrc_actim_ctrl_a_0,
+			u32 sdrc_actim_ctrl_b_0, u32 sdrc_mr_0,
+			u32 sdrc_rfr_ctrl_1, u32 sdrc_actim_ctrl_a_1,
+			u32 sdrc_actim_ctrl_b_1, u32 sdrc_mr_1);
+
 extern void omap3_sram_restore_context(void);
 

/* Do not use these */

arch/arm/plat-omap/include/mach/sram.h +6 -5
@@ -61,11 +63,12 @@ extern void omap243x_sram_reprogram_sdrc(u32 perf_level, 
 u32 dll_val,
 extern unsigned long omap243x_sram_reprogram_sdrc_sz;
 
 
-extern u32 omap3_sram_configure_core_dpll(u32 sdrc_rfr_ctrl,
-					  u32 sdrc_actim_ctrla,
-					  u32 sdrc_actim_ctrlb, u32 m2,
-					  u32 unlock_dll, u32 f, u32 sdrc_mr,
-					  u32 inc);
+extern u32 omap3_sram_configure_core_dpll(
+			u32 m2, u32 unlock_dll, u32 f, u32 inc,
+			u32 sdrc_rfr_ctrl_0, u32 sdrc_actim_ctrl_a_0,
+			u32 sdrc_actim_ctrl_b_0, u32 sdrc_mr_0,
+			u32 sdrc_rfr_ctrl_1, u32 sdrc_actim_ctrl_a_1,
+			u32 sdrc_actim_ctrl_b_1, u32 sdrc_mr_1);
 extern unsigned long omap3_sram_configure_core_dpll_sz;
 

#ifdef CONFIG_PM

arch/arm/plat-omap/sram.c +20 -14
index a2e60e7..517f45b 100644
@@ -368,23 +368,29 @@ static inline int omap243x_sram_init(void)
 
 #ifdef CONFIG_ARCH_OMAP3
 
-static u32 (*_omap3_sram_configure_core_dpll)(u32 sdrc_rfr_ctrl,
-					      u32 sdrc_actim_ctrla,
-					      u32 sdrc_actim_ctrlb,
-					      u32 m2, u32 unlock_dll,
-					      u32 f, u32 sdrc_mr, u32 inc);
-u32 omap3_configure_core_dpll(u32 sdrc_rfr_ctrl, u32 sdrc_actim_ctrla,
-			      u32 sdrc_actim_ctrlb, u32 m2, u32 unlock_dll,
-			      u32 f, u32 sdrc_mr, u32 inc)
- {
+static u32 (*_omap3_sram_configure_core_dpll)(
+				u32 m2, u32 unlock_dll, u32 f, u32 inc,
+				u32 sdrc_rfr_ctrl_0, u32 sdrc_actim_ctrl_a_0,
+				u32 sdrc_actim_ctrl_b_0, u32 sdrc_mr_0,
+				u32 sdrc_rfr_ctrl_1, u32 sdrc_actim_ctrl_a_1,
+				u32 sdrc_actim_ctrl_b_1, u32 sdrc_mr_1);
+
+u32 omap3_configure_core_dpll(u32 m2, u32 unlock_dll, u32 f, u32 inc,
+			      u32 sdrc_rfr_ctrl_0, u32 sdrc_actim_ctrl_a_0,
+			      u32 sdrc_actim_ctrl_b_0, u32 sdrc_mr_0,
+			      u32 sdrc_rfr_ctrl_1, u32 sdrc_actim_ctrl_a_1,
+			      u32 sdrc_actim_ctrl_b_1, u32 sdrc_mr_1)
+{
 	if (!_omap3_sram_configure_core_dpll)
 		omap_sram_error();
 
-	return _omap3_sram_configure_core_dpll(sdrc_rfr_ctrl,
-					       sdrc_actim_ctrla,
-					       sdrc_actim_ctrlb, m2,
-					       unlock_dll, f, sdrc_mr, inc);
- }
+	return _omap3_sram_configure_core_dpll(
+				m2, unlock_dll, f, inc,
+				sdrc_rfr_ctrl_0, sdrc_actim_ctrl_a_0,
+				sdrc_actim_ctrl_b_0, sdrc_mr_0,
+				sdrc_rfr_ctrl_1, sdrc_actim_ctrl_a_1,
+				sdrc_actim_ctrl_b_1, sdrc_mr_1);
+}
 
 #ifdef CONFIG_PM
 void omap3_sram_restore_context(void)
Signature · 1 line
1.6.2.5.168.g3823
Quoted 23 lines · On Friday 05 June 2009 20:10:40 Paul Walmsley wrote:

Hi Jean,

Quoted 10 lines · Jean Pihet

Here is the new patch that includes all the remarks and suggestion. The description is here below.

Some notes:
- all calls to omap2_init_common_hw have been adapted in the board files. it looks like 2430SDP and Pandora board files are broken since they use only one param. Can that be checked on those boards?
- it is assumed that RX51 only uses 1 CS. Is that correct?

Can you review it and possibly merge?

Looks great.

Tero, does RX51 use two SDRC chipselects!

Quoted 3 lines

Thanks & regards,
Jean

author
#17 lore raw

Re: [RFC][PATCH] OMAP3: add support for 2 SDRAM chip selects (was: Re: Beagleboard rev C memory timings & suspend/resume)

Quoted 10 lines · On Monday 08 June 2009 16:59:36 Kevin Hilman wrote:
Quoted 6 lines · Jean Pihet

Paul,

Here is the updated patch that fixes the Overo build as well. Can you check it?

Kevin, can you push it if it is correct?

Can you run it through checkpatch, fix the errors and also merge Tero's RX51 patch if it looks good to you.

Ok. I will check. The cause might be the mailer.

I think we need the omap_cfg_reg calls in the RX51 board file as well, even if the bootloader has the mux setting already right. That way a warning will be issued in case of a faulty bootloader. Do you agree?

Quoted 5 lines

Below are the checkpatch errors I get: looks lik your mailer is probably wrapping the patch and there is also one error to fix.

Kevin

Regards,
Jean

Quoted 894 lines

ERROR: patch seems to be corrupt (line wrapped?)
#306: FILE: arch/arm/mach-omap2/clock34xx.c:477:
unsigned long rate)

ERROR: trailing whitespace
#494: FILE: arch/arm/mach-omap2/sdrc.c:128:
+ * @sdrc_cs[01]: pointers to a null-terminated list of struct $

total: 2 errors, 0 warnings, 648 lines checked

Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.

Quoted 879 lines

Regards,
Jean

From ebe57354b04444de059e1f042e0c488f761853f0 Mon Sep 17 00:00:00 2001
From: Jean Pihet <[email protected]>
Date: Fri, 5 Jun 2009 17:19:00 +0200
Subject: OMAP3: add support for 2 SDRAM chip selects

Some boards (Beagle Cx, Overo) have 2 SDRAM parts
connected to the SDRC.

This patch adds the following:
- ensure that the CKE signals mux settings are correct
- add a new argument of type omap_sdrc_params struct* to omap2_init_common_hw and omap2_sdrc_init for the 2nd CS params
- adapted the OMAP boards files to the new prototype of omap2_init_common_hw. Only Beagle and Overo are using the 2 CS'es
- adapt the sram sleep code to configure the SDRC for the 2nd CS

Note: If the 2nd param to omap2_init_common_hw is NULL, then the parameters are not programmed into the SDRC CS1 registers

Tested on 3430 SDP and Beagleboard rev C2 and B5, with suspend/resume and frequency changes (cpufreq).

Thanks to Paul Walmsley and Kevin Hilman for the suggestions and code reviews.

---
 arch/arm/mach-omap2/board-2430sdp.c      |    2 +-
 arch/arm/mach-omap2/board-3430sdp.c      |    6 +-
 arch/arm/mach-omap2/board-apollon.c      |    2 +-
 arch/arm/mach-omap2/board-generic.c      |    2 +-
 arch/arm/mach-omap2/board-h4.c           |    2 +-
 arch/arm/mach-omap2/board-ldp.c          |    2 +-
 arch/arm/mach-omap2/board-n800.c         |    2 +-
 arch/arm/mach-omap2/board-omap2evm.c     |    2 +-
 arch/arm/mach-omap2/board-omap3beagle.c  |   11 ++-
 arch/arm/mach-omap2/board-omap3evm.c     |    6 +-
 arch/arm/mach-omap2/board-omap3pandora.c |    3 +-
 arch/arm/mach-omap2/board-overo.c        |    9 ++-
 arch/arm/mach-omap2/board-rx51.c         |    6 +-
 arch/arm/mach-omap2/clock34xx.c          |   37 ++++++--
 arch/arm/mach-omap2/io.c                 |    5 +-
 arch/arm/mach-omap2/mux.c                |    6 ++
 arch/arm/mach-omap2/sdrc.c               |   63 +++++++++-----
 arch/arm/mach-omap2/sram34xx.S           |  137
+++++++++++++++++++++++-------
 arch/arm/plat-omap/include/mach/io.h     |    3 +-
 arch/arm/plat-omap/include/mach/mux.h    |    4 +
 arch/arm/plat-omap/include/mach/sdrc.h   |    8 +-
 arch/arm/plat-omap/include/mach/sram.h   |   23 +++--
 arch/arm/plat-omap/sram.c                |   34 +++++---
 23 files changed, 267 insertions(+), 108 deletions(-)
arch/arm/mach-omap2/board-2430sdp.c +1 -1
index aa5df72..4cb7bc5 100644
@@ -322,7 +322,7 @@ out:
 
 static void __init omap_2430sdp_init_irq(void)
 {
-	omap2_init_common_hw(NULL);
+	omap2_init_common_hw(NULL, NULL, NULL, NULL, NULL);
 	omap_init_irq();
 	omap_gpio_init();
 	sdp2430_init_smc91x();
arch/arm/mach-omap2/board-3430sdp.c +4 -2
index 195b749..24e2728 100644
@@ -302,8 +302,10 @@ static inline void __init sdp3430_init_smc91x(void)
 
 static void __init omap_3430sdp_init_irq(void)
 {
-	omap2_init_common_hw(hyb18m512160af6_sdrc_params, omap3_mpu_rate_table,
-			     omap3_dsp_rate_table, omap3_l3_rate_table);
+	omap2_init_common_hw(hyb18m512160af6_sdrc_params, NULL,
+			     omap3_mpu_rate_table,
+			     omap3_dsp_rate_table,
+			     omap3_l3_rate_table);
 	omap_init_irq();
 	omap_gpio_init();
 	sdp3430_init_smc91x();
arch/arm/mach-omap2/board-apollon.c +1 -1
index 2e24812..2dd1350 100644
@@ -323,7 +323,7 @@ out:
 
 static void __init omap_apollon_init_irq(void)
 {
-	omap2_init_common_hw(NULL, NULL, NULL, NULL);
+	omap2_init_common_hw(NULL, NULL, NULL, NULL, NULL);
 	omap_init_irq();
 	omap_gpio_init();
 	apollon_init_smc91x();
arch/arm/mach-omap2/board-generic.c +1 -1
index be763a9..763329b 100644
@@ -33,7 +33,7 @@
 
 static void __init omap_generic_init_irq(void)
 {
-	omap2_init_common_hw(NULL, NULL, NULL, NULL);
+	omap2_init_common_hw(NULL, NULL, NULL, NULL, NULL);
 	omap_init_irq();
 }
 
(quoted diff) +0 -0

b/arch/arm/mach-omap2/board-h4.c index 8f54939..17c3599 100644

arch/arm/mach-omap2/board-h4.c +1 -1
@@ -348,7 +348,7 @@ static void __init h4_init_flash(void)
 
 static void __init omap_h4_init_irq(void)
 {
-	omap2_init_common_hw(NULL, NULL, NULL, NULL);
+	omap2_init_common_hw(NULL, NULL, NULL, NULL, NULL);
 	omap_init_irq();
 	omap_gpio_init();
 	h4_init_flash();
(quoted diff) +0 -0

b/arch/arm/mach-omap2/board-ldp.c index 9f41dc9..b012806 100644

arch/arm/mach-omap2/board-ldp.c +1 -1
@@ -344,7 +344,7 @@ static inline void __init ldp_init_smc911x(void)
 
 static void __init omap_ldp_init_irq(void)
 {
-	omap2_init_common_hw(NULL, NULL, NULL, NULL);
+	omap2_init_common_hw(NULL, NULL, NULL, NULL, NULL);
 	omap_init_irq();
 	omap_gpio_init();
 	ldp_init_smc911x();
arch/arm/mach-omap2/board-n800.c +1 -1
index ac7cf3f..ad53f4a 100644
@@ -127,7 +127,7 @@ static struct lm8323_platform_data lm8323_pdata = {
 
 void __init nokia_n800_init_irq(void)
 {
-	omap2_init_common_hw(NULL, NULL, NULL, NULL);
+	omap2_init_common_hw(NULL, NULL, NULL, NULL, NULL);
 	omap_init_irq();
 	omap_gpio_init();
 
arch/arm/mach-omap2/board-omap2evm.c +1 -1
index 4fac1be..56a26d4 100644
@@ -276,7 +276,7 @@ static struct twl4030_keypad_data omap2evm_kp_data =
 {
 
 static void __init omap2_evm_init_irq(void)
 {
-	omap2_init_common_hw(NULL, NULL, NULL, NULL);
+	omap2_init_common_hw(NULL, NULL, NULL, NULL, NULL);
 	omap_init_irq();
 	omap_gpio_init();
arch/arm/mach-omap2/board-omap2evm.c +0 -0
 	omap2evm_init_smc911x();
arch/arm/mach-omap2/board-omap3beagle.c +9 -2
index 7294dbf..872beb6 100644
@@ -312,8 +312,11 @@ static int __init omap3_beagle_i2c_init(void)
 
 static void __init omap3_beagle_init_irq(void)
 {
-	omap2_init_common_hw(mt46h32m32lf6_sdrc_params, omap3_mpu_rate_table,
-			     omap3_dsp_rate_table, omap3_l3_rate_table);
+	omap2_init_common_hw(mt46h32m32lf6_sdrc_params,
+			     mt46h32m32lf6_sdrc_params,
+			     omap3_mpu_rate_table,
+			     omap3_dsp_rate_table,
+			     omap3_l3_rate_table);
 	omap_init_irq();
 	omap_gpio_init();
 }
@@ -441,6 +444,10 @@ static void __init omap3_beagle_init(void)
 	usb_musb_init();
 	usb_ehci_init();
 	omap3beagle_flash_init();
+
+	/* Ensure SDRC pins are mux'd for self-refresh */
+	omap_cfg_reg(H16_34XX_SDRC_CKE0);
+	omap_cfg_reg(H17_34XX_SDRC_CKE1);
 }
 
 static void __init omap3_beagle_map_io(void)
arch/arm/mach-omap2/board-omap3evm.c +4 -2
index f017f0d..3b9c96a 100644
@@ -276,8 +276,10 @@ struct spi_board_info omap3evm_spi_board_info[] = {
 
 static void __init omap3_evm_init_irq(void)
 {
-	omap2_init_common_hw(mt46h32m32lf6_sdrc_params, omap3_mpu_rate_table,
-	                     omap3_dsp_rate_table, omap3_l3_rate_table);
+	omap2_init_common_hw(mt46h32m32lf6_sdrc_params, NULL,
+			     omap3_mpu_rate_table,
+			     omap3_dsp_rate_table,
+			     omap3_l3_rate_table);
 	omap_init_irq();
 	omap_gpio_init();
 	omap3evm_init_smc911x();
arch/arm/mach-omap2/board-omap3pandora.c +2 -1
index c67f62f..05ab99e 100644
@@ -220,7 +220,8 @@ static int __init omap3pandora_i2c_init(void)
 
 static void __init omap3pandora_init_irq(void)
 {
-	omap2_init_common_hw(mt46h32m32lf6_sdrc_params);
+	omap2_init_common_hw(mt46h32m32lf6_sdrc_params, NULL,
+			     NULL, NULL, NULL);
 	omap_init_irq();
 	omap_gpio_init();
 }
arch/arm/mach-omap2/board-overo.c +8 -1
index 9eae608..50902d4 100644
@@ -45,6 +45,7 @@
 #include <mach/gpmc.h>
 #include <mach/hardware.h>
 #include <mach/nand.h>
+#include <mach/mux.h>
 #include <mach/usb.h>
 
 #include "sdram-micron-mt46h32m32lf-6.h"
@@ -355,7 +356,9 @@ static int __init overo_i2c_init(void)
 
 static void __init overo_init_irq(void)
 {
-	omap2_init_common_hw(mt46h32m32lf6_sdrc_params, NULL, NULL, NULL);
+	omap2_init_common_hw(mt46h32m32lf6_sdrc_params,
+			     mt46h32m32lf6_sdrc_params,
+			     NULL, NULL, NULL);
 	omap_init_irq();
 	omap_gpio_init();
 }
@@ -391,6 +394,10 @@ static void __init overo_init(void)
 	overo_init_smsc911x();
 	overo_ads7846_init();
 
+	/* Ensure SDRC pins are mux'd for self-refresh */
+	omap_cfg_reg(H16_34XX_SDRC_CKE0);
+	omap_cfg_reg(H17_34XX_SDRC_CKE1);
+
 	if ((gpio_request(OVERO_GPIO_W2W_NRESET,
 			  "OVERO_GPIO_W2W_NRESET") == 0) &&
 	    (gpio_direction_output(OVERO_GPIO_W2W_NRESET, 1) == 0)) {
arch/arm/mach-omap2/board-rx51.c +4 -2
index 09035b0..d48459f 100644
@@ -64,8 +64,10 @@ static struct omap_board_config_kernel rx51_config[] =
 {
 
 static void __init rx51_init_irq(void)
 {
-	omap2_init_common_hw(rx51_get_sdram_timings(), omap3_mpu_rate_table,
-			     omap3_dsp_rate_table, omap3_l3_rate_table);
+	omap2_init_common_hw(rx51_get_sdram_timings(), NULL,
+			     omap3_mpu_rate_table,
+			     omap3_dsp_rate_table,
+			     omap3_l3_rate_table);
 	omap_init_irq();
 	omap_gpio_init();

}

(quoted diff) +0 -0

b/arch/arm/mach-omap2/clock34xx.c index 3cee6b4..f262787 100644

arch/arm/mach-omap2/clock34xx.c +3 -1
@@ -478,7 +478,9 @@ static int omap3_core_dpll_m2_set_rate(struct clk
 *clk, unsigned long rate)
 	u32 unlock_dll = 0;
 	u32 c;
 	unsigned long validrate, sdrcrate, mpurate;
-	struct omap_sdrc_params *sp;
+	struct omap_sdrc_params *sdrc_cs0;
+	struct omap_sdrc_params *sdrc_cs1;
+	int ret;
 
 	if (!clk || !rate)
arch/arm/mach-omap2/clock34xx.c +2 -2
 		return -EINVAL;
@@ -496,8 +498,8 @@ static int omap3_core_dpll_m2_set_rate(struct clk
 *clk, unsigned long rate)
 	else
 		sdrcrate >>= ((clk->rate / rate) >> 1);
 
-	sp = omap2_sdrc_get_params(sdrcrate);
-	if (!sp)
+	ret = omap2_sdrc_get_params(sdrcrate, &sdrc_cs0, &sdrc_cs1);
+	if (ret)
 		return -EINVAL;
 
arch/arm/mach-omap2/clock34xx.c +23 -6
 	if (sdrcrate < MIN_SDRC_DLL_LOCK_FREQ) {
@@ -518,12 +520,29 @@ static int omap3_core_dpll_m2_set_rate(struct clk
 *clk, unsigned long rate)
 
 	pr_debug("clock: changing CORE DPLL rate from %lu to %lu\n", clk->rate,
 		 validrate);
-	pr_debug("clock: SDRC timing params used: %08x %08x %08x\n",
-		 sp->rfr_ctrl, sp->actim_ctrla, sp->actim_ctrlb);
-
-	omap3_configure_core_dpll(sp->rfr_ctrl, sp->actim_ctrla,
-				  sp->actim_ctrlb, new_div, unlock_dll, c,
-				  sp->mr, rate > clk->rate);
+	pr_debug("clock: SDRC CS0 timing params used:"
+		 " RFR %08x CTRLA %08x CTRLB %08x MR %08x\n",
+		 sdrc_cs0->rfr_ctrl, sdrc_cs0->actim_ctrla,
+		 sdrc_cs0->actim_ctrlb, sdrc_cs0->mr);
+	if (sdrc_cs1)
+		pr_debug("clock: SDRC CS1 timing params used: "
+		 " RFR %08x CTRLA %08x CTRLB %08x MR %08x\n",
+		 sdrc_cs1->rfr_ctrl, sdrc_cs1->actim_ctrla,
+		 sdrc_cs1->actim_ctrlb, sdrc_cs1->mr);
+
+	if (sdrc_cs1)
+		omap3_configure_core_dpll(
+				  new_div, unlock_dll, c, rate > clk->rate,
+				  sdrc_cs0->rfr_ctrl, sdrc_cs0->actim_ctrla,
+				  sdrc_cs0->actim_ctrlb, sdrc_cs0->mr,
+				  sdrc_cs1->rfr_ctrl, sdrc_cs1->actim_ctrla,
+				  sdrc_cs1->actim_ctrlb, sdrc_cs1->mr);
+	else
+		omap3_configure_core_dpll(
+				  new_div, unlock_dll, c, rate > clk->rate,
+				  sdrc_cs0->rfr_ctrl, sdrc_cs0->actim_ctrla,
+				  sdrc_cs0->actim_ctrlb, sdrc_cs0->mr,
+				  0, 0, 0, 0);
 
 	return 0;

}

arch/arm/mach-omap2/io.c +3 -2
index 6fb6c29..aa000b4 100644
@@ -231,7 +231,8 @@ static int __init _omap2_init_reprogram_sdrc(void)
 	return v;
 }
 
-void __init omap2_init_common_hw(struct omap_sdrc_params *sp,
+void __init omap2_init_common_hw(struct omap_sdrc_params *sdrc_cs0,
+				 struct omap_sdrc_params *sdrc_cs1,
 				 struct omap_opp *mpu_opps,
 				 struct omap_opp *dsp_opps,
 				 struct omap_opp *l3_opps)
@@ -244,7 +245,7 @@ void __init omap2_init_common_hw(struct
 omap_sdrc_params *sp,
 	omapdev_init(omapdevs);
 	omap2_clk_init();
 	omap_pm_if_init();
-	omap2_sdrc_init(sp);
+	omap2_sdrc_init(sdrc_cs0, sdrc_cs1);
 
 	_omap2_init_reprogram_sdrc();
arch/arm/mach-omap2/mux.c +6 -0
index 026c4fc..43d6b92 100644
@@ -486,6 +486,12 @@ MUX_CFG_34XX("H19_34XX_GPIO164_OUT", 0x19c,
 		OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_OUTPUT)
 MUX_CFG_34XX("J25_34XX_GPIO170", 0x1c6,
 		OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_INPUT)
+
+/* OMAP3 SDRC CKE signals to SDR/DDR ram chips */
+MUX_CFG_34XX("H16_34XX_SDRC_CKE0", 0x262,
+		OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_OUTPUT)
+MUX_CFG_34XX("H17_34XX_SDRC_CKE1", 0x264,
+		OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_OUTPUT)
 };
 
 #define OMAP34XX_PINS_SZ	ARRAY_SIZE(omap34xx_pins)
arch/arm/mach-omap2/sdrc.c +1 -1
index c832d83..b42f5ae 100644
@@ -32,7 +32,7 @@
 #include <mach/sdrc.h>
 #include "sdrc.h"
 
-static struct omap_sdrc_params *sdrc_init_params;
+static struct omap_sdrc_params *sdrc_init_params_cs0,
 *sdrc_init_params_cs1;
 
 void __iomem *omap2_sdrc_base;

void __iomem *omap2_sms_base;

arch/arm/mach-omap2/sdrc.c +5 -8
@@ -71,33 +71,49 @@ void omap2_sms_restore_context(void)
 /**
  * omap2_sdrc_get_params - return SDRC register values for a given clock
 rate * @r: SDRC clock rate (in Hz)
+ * @sdrc_cs0: chip select 0 ram timings **
+ * @sdrc_cs1: chip select 1 ram timings **
  *
  * Return pre-calculated values for the SDRC_ACTIM_CTRLA,
- * SDRC_ACTIM_CTRLB, SDRC_RFR_CTRL, and SDRC_MR registers, for a given
- * SDRC clock rate 'r'.  These parameters control various timing
- * delays in the SDRAM controller that are expressed in terms of the
- * number of SDRC clock cycles to wait; hence the clock rate
- * dependency. Note that sdrc_init_params must be sorted rate
- * descending.  Also assumes that both chip-selects use the same
- * timing parameters.  Returns a struct omap_sdrc_params * upon
- * success, or NULL upon failure.
+ *  SDRC_ACTIM_CTRLB, SDRC_RFR_CTRL and SDRC_MR registers in sdrc_cs[01]
+ *  structs,for a given SDRC clock rate 'r'.
+ * These parameters control various timing delays in the SDRAM

controller + * that are expressed in terms of the number of SDRC clock cycles to + * wait; hence the clock rate dependency.
+ *
+ * Supports 2 different timing parameters for both chip selects.
+ *
+ * Note 1: the sdrc_init_params_cs[01] must be sorted rate descending.
+ * Note 2: If sdrc_init_params_cs_1 is not NULL it must be of same size
+ * as sdrc_init_params_cs_0.
+ *
+ * Fills in the struct omap_sdrc_params * for each chip select.
+ * Returns 0 upon success or -1 upon failure.
*/

arch/arm/mach-omap2/sdrc.c +19 -11
-struct omap_sdrc_params *omap2_sdrc_get_params(unsigned long r)
+int omap2_sdrc_get_params(unsigned long r,
+			  struct omap_sdrc_params **sdrc_cs0,
+			  struct omap_sdrc_params **sdrc_cs1)
 {
-	struct omap_sdrc_params *sp;
+	struct omap_sdrc_params *sp0, *sp1;
 
-	if (!sdrc_init_params)
-		return NULL;
+	if (!sdrc_init_params_cs0)
+		return -1;
 
-	sp = sdrc_init_params;
+	sp0 = sdrc_init_params_cs0;
+	sp1 = sdrc_init_params_cs1;
 
-	while (sp->rate && sp->rate != r)
-		sp++;
+	while (sp0->rate && sp0->rate != r) {
+		sp0++;
+		if (sdrc_init_params_cs1)
+			sp1++;
+	}
 
-	if (!sp->rate)
-		return NULL;
+	if (!sp0->rate)
+		return -1;
 
-	return sp;
+	*sdrc_cs0 = sp0;
+	*sdrc_cs1 = sp1;
+	return 0;
 }
@@ -109,13 +125,15 @@ void __init omap2_set_globals_sdrc(struct
 omap_globals *omap2_globals)
 
 /**
  * omap2_sdrc_init - initialize SMS, SDRC devices on boot
- * @sp: pointer to a null-terminated list of struct omap_sdrc_params
+ * @sdrc_cs[01]: pointers to a null-terminated list of struct

omap_sdrc_params
+ * Support for 2 chip selects timings
*
* Turn on smart idle modes for SDRAM scheduler and controller.
* Program a known-good configuration for the SDRC to deal with buggy
* bootloaders.
*/

arch/arm/mach-omap2/sdrc.c +4 -2
-void __init omap2_sdrc_init(struct omap_sdrc_params *sp)
+void __init omap2_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
+			    struct omap_sdrc_params *sdrc_cs1)
 {
 	u32 l;
@@ -129,7 +147,8 @@ void __init omap2_sdrc_init(struct omap_sdrc_params
 *sp) l |= (0x2 << 3);
 	sdrc_write_reg(l, SDRC_SYSCONFIG);
 
-	sdrc_init_params = sp;
+	sdrc_init_params_cs0 = sdrc_cs0;
+	sdrc_init_params_cs1 = sdrc_cs1;
 
 	/* XXX Enable SRFRONIDLEREQ here also? */
 	l = (1 << SDRC_POWER_EXTCLKDIS_SHIFT) |
(quoted diff) +0 -0

b/arch/arm/mach-omap2/sram34xx.S index f41f8d9..3aef744 100644

arch/arm/mach-omap2/sram34xx.S +107 -30
@@ -36,7 +36,7 @@
 
 	.text
 
-/* r4 parameters */
+/* r1 parameters */
 #define SDRC_NO_UNLOCK_DLL		0x0
 #define SDRC_UNLOCK_DLL			0x1
 
@@ -71,40 +71,71 @@
 
 /*
  * omap3_sram_configure_core_dpll - change DPLL3 M2 divider
- * r0 = new SDRC_RFR_CTRL register contents
- * r1 = new SDRC_ACTIM_CTRLA register contents
- * r2 = new SDRC_ACTIM_CTRLB register contents
- * r3 = new M2 divider setting (only 1 and 2 supported right now)
- * r4 = unlock SDRC DLL? (1 = yes, 0 = no).  Only unlock DLL for
+ *
+ * Params passed in registers:
+ *  r0 = new M2 divider setting (only 1 and 2 supported right now)
+ *  r1 = unlock SDRC DLL? (1 = yes, 0 = no).  Only unlock DLL for
  *      SDRC rates < 83MHz
- * r5 = number of MPU cycles to wait for SDRC to stabilize after
+ *  r2 = number of MPU cycles to wait for SDRC to stabilize after
  *      reprogramming the SDRC when switching to a slower MPU speed
- * r6 = new SDRC_MR_0 register value
- * r7 = increasing SDRC rate? (1 = yes, 0 = no)
+ *  r3 = increasing SDRC rate? (1 = yes, 0 = no)
+ *
+ * Params passed via the stack. The needed params will be copied in SRAM
+ *  before use by the code in SRAM (SDRAM is not accessible during SDRC
+ *  reconfiguration):
+ *  new SDRC_RFR_CTRL_0 register contents
+ *  new SDRC_ACTIM_CTRL_A_0 register contents
+ *  new SDRC_ACTIM_CTRL_B_0 register contents
+ *  new SDRC_MR_0 register value
+ *  new SDRC_RFR_CTRL_1 register contents
+ *  new SDRC_ACTIM_CTRL_A_1 register contents
+ *  new SDRC_ACTIM_CTRL_B_1 register contents
+ *  new SDRC_MR_1 register value
  *
+ * If the param SDRC_RFR_CTRL_1 is 0, the parameters
+ *  are not programmed into the SDRC CS1 registers
  */
 ENTRY(omap3_sram_configure_core_dpll)
 	stmfd	sp!, {r1-r12, lr}	@ store regs to stack
-	ldr	r4, [sp, #52]		@ pull extra args off the stack
-	ldr	r5, [sp, #56]		@ load extra args from the stack
-	ldr	r6, [sp, #60]		@ load extra args from the stack
-	ldr	r7, [sp, #64]		@ load extra args from the stack
+
+					@ pull the extra args off the stack
+					@  and store them in SRAM
+	ldr	r4, [sp, #52]
+	str     r4, omap_sdrc_rfr_ctrl_0_val
+	ldr	r4, [sp, #56]
+	str     r4, omap_sdrc_actim_ctrl_a_0_val
+	ldr	r4, [sp, #60]
+	str     r4, omap_sdrc_actim_ctrl_b_0_val
+	ldr	r4, [sp, #64]
+	str     r4, omap_sdrc_mr_0_val
+	ldr	r4, [sp, #68]
+	str     r4, omap_sdrc_rfr_ctrl_1_val
+	cmp	r4, #0			@ if SDRC_RFR_CTRL_1 is 0,
+	beq	skip_cs1_params		@  do not use cs1 params
+	ldr	r4, [sp, #72]
+	str     r4, omap_sdrc_actim_ctrl_a_1_val
+	ldr	r4, [sp, #76]
+	str     r4, omap_sdrc_actim_ctrl_b_1_val
+	ldr	r4, [sp, #80]
+	str     r4, omap_sdrc_mr_1_val
+skip_cs1_params:
 	dsb				@ flush buffered writes to interconnect
-	cmp	r7, #1			@ if increasing SDRC clk rate,
+
+	cmp	r3, #1			@ if increasing SDRC clk rate,
 	bleq	configure_sdrc		@ program the SDRC regs early (for RFR)
-	cmp	r4, #SDRC_UNLOCK_DLL	@ set the intended DLL state
+	cmp	r1, #SDRC_UNLOCK_DLL	@ set the intended DLL state
 	bleq	unlock_dll
 	blne	lock_dll
 	bl	sdram_in_selfrefresh	@ put SDRAM in self refresh, idle SDRC
 	bl 	configure_core_dpll	@ change the DPLL3 M2 divider
 	bl	enable_sdrc		@ take SDRC out of idle
-	cmp	r4, #SDRC_UNLOCK_DLL	@ wait for DLL status to change
+	cmp	r1, #SDRC_UNLOCK_DLL	@ wait for DLL status to change
 	bleq	wait_dll_unlock
 	blne	wait_dll_lock
-	cmp	r7, #1			@ if increasing SDRC clk rate,
+	cmp	r3, #1			@ if increasing SDRC clk rate,
 	beq	return_to_sdram		@ return to SDRAM code, otherwise,
 	bl	configure_sdrc		@ reprogram SDRC regs now
-	mov	r12, r5
+	mov	r12, r2
 	bl	wait_clk_stable		@ wait for SDRC to stabilize
 return_to_sdram:
 	isb				@ prevent speculative exec past here
@@ -149,7 +180,7 @@ configure_core_dpll:
 	ldr	r12, [r11]
 	ldr	r10, core_m2_mask_val	@ modify m2 for core dpll
 	and	r12, r12, r10
-	orr	r12, r12, r3, lsl #CORE_DPLL_CLKOUT_DIV_SHIFT
+	orr	r12, r12, r0, lsl #CORE_DPLL_CLKOUT_DIV_SHIFT
 	str	r12, [r11]
 	ldr	r12, [r11]		@ posted-write barrier for CM
 	bx	lr
@@ -187,15 +218,34 @@ wait_dll_unlock:
 	bne	wait_dll_unlock
 	bx	lr
 configure_sdrc:
-	ldr	r11, omap3_sdrc_rfr_ctrl
-	str	r0, [r11]
-	ldr	r11, omap3_sdrc_actim_ctrla
-	str	r1, [r11]
-	ldr	r11, omap3_sdrc_actim_ctrlb
-	str	r2, [r11]
+	ldr	r12, omap_sdrc_rfr_ctrl_0_val	@ fetch value from SRAM
+	ldr	r11, omap3_sdrc_rfr_ctrl_0	@ fetch addr from SRAM
+	str	r12, [r11]			@ store
+	ldr	r12, omap_sdrc_actim_ctrl_a_0_val
+	ldr	r11, omap3_sdrc_actim_ctrl_a_0
+	str	r12, [r11]
+	ldr	r12, omap_sdrc_actim_ctrl_b_0_val
+	ldr	r11, omap3_sdrc_actim_ctrl_b_0
+	str	r12, [r11]
+	ldr	r12, omap_sdrc_mr_0_val
 	ldr	r11, omap3_sdrc_mr_0
-	str	r6, [r11]
-	ldr	r6, [r11]		@ posted-write barrier for SDRC
+	str	r12, [r11]
+	ldr	r12, omap_sdrc_rfr_ctrl_1_val
+	cmp	r12, #0			@ if SDRC_RFR_CTRL_1 is 0,
+	beq	skip_cs1_prog		@  do not program cs1 params
+	ldr	r11, omap3_sdrc_rfr_ctrl_1
+	str	r12, [r11]
+	ldr	r12, omap_sdrc_actim_ctrl_a_1_val
+	ldr	r11, omap3_sdrc_actim_ctrl_a_1
+	str	r12, [r11]
+	ldr	r12, omap_sdrc_actim_ctrl_b_1_val
+	ldr	r11, omap3_sdrc_actim_ctrl_b_1
+	str	r12, [r11]
+	ldr	r12, omap_sdrc_mr_1_val
+	ldr	r11, omap3_sdrc_mr_1
+	str	r12, [r11]
+skip_cs1_prog:
+	ldr	r12, [r11]		@ posted-write barrier for SDRC
 	bx	lr
 
 omap3_sdrc_power:
@@ -206,14 +256,40 @@ omap3_cm_idlest1_core:
 	.word OMAP34XX_CM_REGADDR(CORE_MOD, CM_IDLEST)
 omap3_cm_iclken1_core:
 	.word OMAP34XX_CM_REGADDR(CORE_MOD, CM_ICLKEN1)
-omap3_sdrc_rfr_ctrl:
+
+omap3_sdrc_rfr_ctrl_0:
 	.word OMAP34XX_SDRC_REGADDR(SDRC_RFR_CTRL_0)
-omap3_sdrc_actim_ctrla:
+omap3_sdrc_rfr_ctrl_1:
+	.word OMAP34XX_SDRC_REGADDR(SDRC_RFR_CTRL_1)
+omap3_sdrc_actim_ctrl_a_0:
 	.word OMAP34XX_SDRC_REGADDR(SDRC_ACTIM_CTRL_A_0)
-omap3_sdrc_actim_ctrlb:
+omap3_sdrc_actim_ctrl_a_1:
+	.word OMAP34XX_SDRC_REGADDR(SDRC_ACTIM_CTRL_A_1)
+omap3_sdrc_actim_ctrl_b_0:
 	.word OMAP34XX_SDRC_REGADDR(SDRC_ACTIM_CTRL_B_0)
+omap3_sdrc_actim_ctrl_b_1:
+	.word OMAP34XX_SDRC_REGADDR(SDRC_ACTIM_CTRL_B_1)
 omap3_sdrc_mr_0:
 	.word OMAP34XX_SDRC_REGADDR(SDRC_MR_0)
+omap3_sdrc_mr_1:
+	.word OMAP34XX_SDRC_REGADDR(SDRC_MR_1)
+omap_sdrc_rfr_ctrl_0_val:
+	.word 0xDEADBEEF
+omap_sdrc_rfr_ctrl_1_val:
+	.word 0xDEADBEEF
+omap_sdrc_actim_ctrl_a_0_val:
+	.word 0xDEADBEEF
+omap_sdrc_actim_ctrl_a_1_val:
+	.word 0xDEADBEEF
+omap_sdrc_actim_ctrl_b_0_val:
+	.word 0xDEADBEEF
+omap_sdrc_actim_ctrl_b_1_val:
+	.word 0xDEADBEEF
+omap_sdrc_mr_0_val:
+	.word 0xDEADBEEF
+omap_sdrc_mr_1_val:
+	.word 0xDEADBEEF
+
 omap3_sdrc_dlla_status:
 	.word OMAP34XX_SDRC_REGADDR(SDRC_DLLA_STATUS)
 omap3_sdrc_dlla_ctrl:
@@ -223,3 +299,4 @@ core_m2_mask_val:
 
 ENTRY(omap3_sram_configure_core_dpll_sz)
 	.word	. - omap3_sram_configure_core_dpll
+
arch/arm/plat-omap/include/mach/io.h +2 -1
index 54c159b..d4c78b4 100644
@@ -192,7 +192,8 @@ extern void omap1_map_common_io(void);
 extern void omap1_init_common_hw(void);
 
 extern void omap2_map_common_io(void);
-extern void omap2_init_common_hw(struct omap_sdrc_params *sp,
+extern void omap2_init_common_hw(struct omap_sdrc_params *sdrc_cs0,
+				 struct omap_sdrc_params *sdrc_cs1,
 				 struct omap_opp *mpu_opps,
 				 struct omap_opp *dsp_opps,
 				 struct omap_opp *l3_opps);
arch/arm/plat-omap/include/mach/mux.h +4 -0
index f7e298a..7368aba 100644
@@ -803,6 +803,10 @@ enum omap34xx_index {
 	AE5_34XX_GPIO143,
 	H19_34XX_GPIO164_OUT,
 	J25_34XX_GPIO170,
+
+	/* OMAP3 SDRC CKE signals to SDR/DDR ram chips */
+	H16_34XX_SDRC_CKE0,
+	H17_34XX_SDRC_CKE1,
 };
 
 struct omap_mux_cfg {
arch/arm/plat-omap/include/mach/sdrc.h +5 -3
index a678bc8..7e22143 100644
@@ -114,9 +114,11 @@ struct omap_sdrc_params {
 
 void omap2_sms_save_context(void);
 void omap2_sms_restore_context(void);
-void __init omap2_sdrc_init(struct omap_sdrc_params *);
-struct omap_sdrc_params *omap2_sdrc_get_params(unsigned long r);
-
+void __init omap2_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
+			    struct omap_sdrc_params *sdrc_cs1);
+int omap2_sdrc_get_params(unsigned long r,
+			  struct omap_sdrc_params **sdrc_cs0,
+			  struct omap_sdrc_params **sdrc_cs1);
 #ifdef CONFIG_ARCH_OMAP2
 
 struct memory_timings {
arch/arm/plat-omap/include/mach/sram.h +7 -5
index ad0a600..98906ea 100644
@@ -21,11 +21,13 @@ extern void omap2_sram_reprogram_sdrc(u32 perf_level,
 u32 dll_val,
 				      u32 mem_type);
 extern u32 omap2_set_prcm(u32 dpll_ctrl_val, u32 sdrc_rfr_val, int
 bypass);
 
-extern u32 omap3_configure_core_dpll(u32 sdrc_rfr_ctrl,
-				     u32 sdrc_actim_ctrla,
-				     u32 sdrc_actim_ctrlb, u32 m2,
-				     u32 unlock_dll, u32 f, u32 sdrc_mr,
-				     u32 inc);
+extern u32 omap3_configure_core_dpll(
+			u32 m2, u32 unlock_dll, u32 f, u32 inc,
+			u32 sdrc_rfr_ctrl_0, u32 sdrc_actim_ctrl_a_0,
+			u32 sdrc_actim_ctrl_b_0, u32 sdrc_mr_0,
+			u32 sdrc_rfr_ctrl_1, u32 sdrc_actim_ctrl_a_1,
+			u32 sdrc_actim_ctrl_b_1, u32 sdrc_mr_1);
+
 extern void omap3_sram_restore_context(void);

/* Do not use these */

arch/arm/plat-omap/include/mach/sram.h +6 -5
@@ -61,11 +63,12 @@ extern void omap243x_sram_reprogram_sdrc(u32
 perf_level, u32 dll_val,
 extern unsigned long omap243x_sram_reprogram_sdrc_sz;
 
 
-extern u32 omap3_sram_configure_core_dpll(u32 sdrc_rfr_ctrl,
-					  u32 sdrc_actim_ctrla,
-					  u32 sdrc_actim_ctrlb, u32 m2,
-					  u32 unlock_dll, u32 f, u32 sdrc_mr,
-					  u32 inc);
+extern u32 omap3_sram_configure_core_dpll(
+			u32 m2, u32 unlock_dll, u32 f, u32 inc,
+			u32 sdrc_rfr_ctrl_0, u32 sdrc_actim_ctrl_a_0,
+			u32 sdrc_actim_ctrl_b_0, u32 sdrc_mr_0,
+			u32 sdrc_rfr_ctrl_1, u32 sdrc_actim_ctrl_a_1,
+			u32 sdrc_actim_ctrl_b_1, u32 sdrc_mr_1);
 extern unsigned long omap3_sram_configure_core_dpll_sz;
 

#ifdef CONFIG_PM

arch/arm/plat-omap/sram.c +20 -15
index a2e60e7..517f45b 100644
@@ -368,23 +368,29 @@ static inline int omap243x_sram_init(void)
 
 #ifdef CONFIG_ARCH_OMAP3
 
-static u32 (*_omap3_sram_configure_core_dpll)(u32 sdrc_rfr_ctrl,
-					      u32 sdrc_actim_ctrla,
-					      u32 sdrc_actim_ctrlb,
-					      u32 m2, u32 unlock_dll,
-					      u32 f, u32 sdrc_mr, u32 inc);
-u32 omap3_configure_core_dpll(u32 sdrc_rfr_ctrl, u32 sdrc_actim_ctrla,
-			      u32 sdrc_actim_ctrlb, u32 m2, u32 unlock_dll,
-			      u32 f, u32 sdrc_mr, u32 inc)
- {
+static u32 (*_omap3_sram_configure_core_dpll)(
+				u32 m2, u32 unlock_dll, u32 f, u32 inc,
+				u32 sdrc_rfr_ctrl_0, u32 sdrc_actim_ctrl_a_0,
+				u32 sdrc_actim_ctrl_b_0, u32 sdrc_mr_0,
+				u32 sdrc_rfr_ctrl_1, u32 sdrc_actim_ctrl_a_1,
+				u32 sdrc_actim_ctrl_b_1, u32 sdrc_mr_1);
+
+u32 omap3_configure_core_dpll(u32 m2, u32 unlock_dll, u32 f, u32 inc,
+			      u32 sdrc_rfr_ctrl_0, u32 sdrc_actim_ctrl_a_0,
+			      u32 sdrc_actim_ctrl_b_0, u32 sdrc_mr_0,
+			      u32 sdrc_rfr_ctrl_1, u32 sdrc_actim_ctrl_a_1,
+			      u32 sdrc_actim_ctrl_b_1, u32 sdrc_mr_1)
+{
 	if (!_omap3_sram_configure_core_dpll)
 		omap_sram_error();
 
-	return _omap3_sram_configure_core_dpll(sdrc_rfr_ctrl,
-					       sdrc_actim_ctrla,
-					       sdrc_actim_ctrlb, m2,
-					       unlock_dll, f, sdrc_mr, inc);
- }
+	return _omap3_sram_configure_core_dpll(
+				m2, unlock_dll, f, inc,
+				sdrc_rfr_ctrl_0, sdrc_actim_ctrl_a_0,
+				sdrc_actim_ctrl_b_0, sdrc_mr_0,
+				sdrc_rfr_ctrl_1, sdrc_actim_ctrl_a_1,
+				sdrc_actim_ctrl_b_1, sdrc_mr_1);
+}
 
 #ifdef CONFIG_PM
 void omap3_sram_restore_context(void)
--

1.6.2.5.168.g3823

Quoted 22 lines · On Friday 05 June 2009 20:10:40 Paul Walmsley wrote:

Hi Jean,

Quoted 10 lines · Jean Pihet

Here is the new patch that includes all the remarks and suggestion. The description is here below.

Some notes:
- all calls to omap2_init_common_hw have been adapted in the board files. it looks like 2430SDP and Pandora board files are broken since they use only one param. Can that be checked on those boards?
- it is assumed that RX51 only uses 1 CS. Is that correct?

Can you review it and possibly merge?

Looks great.

Tero, does RX51 use two SDRC chipselects!

Quoted 2 lines

Thanks & regards,
Jean

#18 lore raw

Re: [RFC][PATCH] OMAP3: add support for 2 SDRAM chip selects

Quoted 9 lines · Jean Pihet
Quoted 8 lines · On Monday 08 June 2009 16:59:36 Kevin Hilman wrote:
Quoted 6 lines · Jean Pihet

Paul,

Here is the updated patch that fixes the Overo build as well. Can you check it?

Kevin, can you push it if it is correct?

Quoted 8 lines
Quoted 2 lines

Can you run it through checkpatch, fix the errors and also merge Tero's RX51 patch if it looks good to you.

Ok. I will check. The cause might be the mailer.

I think we need the omap_cfg_reg calls in the RX51 board file as well, even if the bootloader has the mux setting already right. That way a warning will be issued in case of a faulty bootloader. Do you agree?

I agree.

Kevin

Quoted 902 lines
Quoted 5 lines

Below are the checkpatch errors I get: looks lik your mailer is probably wrapping the patch and there is also one error to fix.

Kevin

Regards,
Jean

Quoted 894 lines

ERROR: patch seems to be corrupt (line wrapped?)
#306: FILE: arch/arm/mach-omap2/clock34xx.c:477:
unsigned long rate)

ERROR: trailing whitespace
#494: FILE: arch/arm/mach-omap2/sdrc.c:128:
+ * @sdrc_cs[01]: pointers to a null-terminated list of struct $

total: 2 errors, 0 warnings, 648 lines checked

Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.

Quoted 879 lines

Regards,
Jean

From ebe57354b04444de059e1f042e0c488f761853f0 Mon Sep 17 00:00:00 2001
From: Jean Pihet <[email protected]>
Date: Fri, 5 Jun 2009 17:19:00 +0200
Subject: OMAP3: add support for 2 SDRAM chip selects

Some boards (Beagle Cx, Overo) have 2 SDRAM parts
connected to the SDRC.

This patch adds the following:
- ensure that the CKE signals mux settings are correct
- add a new argument of type omap_sdrc_params struct* to omap2_init_common_hw and omap2_sdrc_init for the 2nd CS params
- adapted the OMAP boards files to the new prototype of omap2_init_common_hw. Only Beagle and Overo are using the 2 CS'es
- adapt the sram sleep code to configure the SDRC for the 2nd CS

Note: If the 2nd param to omap2_init_common_hw is NULL, then the parameters are not programmed into the SDRC CS1 registers

Tested on 3430 SDP and Beagleboard rev C2 and B5, with suspend/resume and frequency changes (cpufreq).

Thanks to Paul Walmsley and Kevin Hilman for the suggestions and code reviews.

---
 arch/arm/mach-omap2/board-2430sdp.c      |    2 +-
 arch/arm/mach-omap2/board-3430sdp.c      |    6 +-
 arch/arm/mach-omap2/board-apollon.c      |    2 +-
 arch/arm/mach-omap2/board-generic.c      |    2 +-
 arch/arm/mach-omap2/board-h4.c           |    2 +-
 arch/arm/mach-omap2/board-ldp.c          |    2 +-
 arch/arm/mach-omap2/board-n800.c         |    2 +-
 arch/arm/mach-omap2/board-omap2evm.c     |    2 +-
 arch/arm/mach-omap2/board-omap3beagle.c  |   11 ++-
 arch/arm/mach-omap2/board-omap3evm.c     |    6 +-
 arch/arm/mach-omap2/board-omap3pandora.c |    3 +-
 arch/arm/mach-omap2/board-overo.c        |    9 ++-
 arch/arm/mach-omap2/board-rx51.c         |    6 +-
 arch/arm/mach-omap2/clock34xx.c          |   37 ++++++--
 arch/arm/mach-omap2/io.c                 |    5 +-
 arch/arm/mach-omap2/mux.c                |    6 ++
 arch/arm/mach-omap2/sdrc.c               |   63 +++++++++-----
 arch/arm/mach-omap2/sram34xx.S           |  137
+++++++++++++++++++++++-------
 arch/arm/plat-omap/include/mach/io.h     |    3 +-
 arch/arm/plat-omap/include/mach/mux.h    |    4 +
 arch/arm/plat-omap/include/mach/sdrc.h   |    8 +-
 arch/arm/plat-omap/include/mach/sram.h   |   23 +++--
 arch/arm/plat-omap/sram.c                |   34 +++++---
 23 files changed, 267 insertions(+), 108 deletions(-)
arch/arm/mach-omap2/board-2430sdp.c +1 -1
index aa5df72..4cb7bc5 100644
@@ -322,7 +322,7 @@ out:
 
 static void __init omap_2430sdp_init_irq(void)
 {
-	omap2_init_common_hw(NULL);
+	omap2_init_common_hw(NULL, NULL, NULL, NULL, NULL);
 	omap_init_irq();
 	omap_gpio_init();
 	sdp2430_init_smc91x();
arch/arm/mach-omap2/board-3430sdp.c +4 -2
index 195b749..24e2728 100644
@@ -302,8 +302,10 @@ static inline void __init sdp3430_init_smc91x(void)
 
 static void __init omap_3430sdp_init_irq(void)
 {
-	omap2_init_common_hw(hyb18m512160af6_sdrc_params, omap3_mpu_rate_table,
-			     omap3_dsp_rate_table, omap3_l3_rate_table);
+	omap2_init_common_hw(hyb18m512160af6_sdrc_params, NULL,
+			     omap3_mpu_rate_table,
+			     omap3_dsp_rate_table,
+			     omap3_l3_rate_table);
 	omap_init_irq();
 	omap_gpio_init();
 	sdp3430_init_smc91x();
arch/arm/mach-omap2/board-apollon.c +1 -1
index 2e24812..2dd1350 100644
@@ -323,7 +323,7 @@ out:
 
 static void __init omap_apollon_init_irq(void)
 {
-	omap2_init_common_hw(NULL, NULL, NULL, NULL);
+	omap2_init_common_hw(NULL, NULL, NULL, NULL, NULL);
 	omap_init_irq();
 	omap_gpio_init();
 	apollon_init_smc91x();
arch/arm/mach-omap2/board-generic.c +1 -1
index be763a9..763329b 100644
@@ -33,7 +33,7 @@
 
 static void __init omap_generic_init_irq(void)
 {
-	omap2_init_common_hw(NULL, NULL, NULL, NULL);
+	omap2_init_common_hw(NULL, NULL, NULL, NULL, NULL);
 	omap_init_irq();
 }
 
(quoted diff) +0 -0

b/arch/arm/mach-omap2/board-h4.c index 8f54939..17c3599 100644

arch/arm/mach-omap2/board-h4.c +1 -1
@@ -348,7 +348,7 @@ static void __init h4_init_flash(void)
 
 static void __init omap_h4_init_irq(void)
 {
-	omap2_init_common_hw(NULL, NULL, NULL, NULL);
+	omap2_init_common_hw(NULL, NULL, NULL, NULL, NULL);
 	omap_init_irq();
 	omap_gpio_init();
 	h4_init_flash();
(quoted diff) +0 -0

b/arch/arm/mach-omap2/board-ldp.c index 9f41dc9..b012806 100644

arch/arm/mach-omap2/board-ldp.c +1 -1
@@ -344,7 +344,7 @@ static inline void __init ldp_init_smc911x(void)
 
 static void __init omap_ldp_init_irq(void)
 {
-	omap2_init_common_hw(NULL, NULL, NULL, NULL);
+	omap2_init_common_hw(NULL, NULL, NULL, NULL, NULL);
 	omap_init_irq();
 	omap_gpio_init();
 	ldp_init_smc911x();
arch/arm/mach-omap2/board-n800.c +1 -1
index ac7cf3f..ad53f4a 100644
@@ -127,7 +127,7 @@ static struct lm8323_platform_data lm8323_pdata = {
 
 void __init nokia_n800_init_irq(void)
 {
-	omap2_init_common_hw(NULL, NULL, NULL, NULL);
+	omap2_init_common_hw(NULL, NULL, NULL, NULL, NULL);
 	omap_init_irq();
 	omap_gpio_init();
 
arch/arm/mach-omap2/board-omap2evm.c +1 -1
index 4fac1be..56a26d4 100644
@@ -276,7 +276,7 @@ static struct twl4030_keypad_data omap2evm_kp_data =
 {
 
 static void __init omap2_evm_init_irq(void)
 {
-	omap2_init_common_hw(NULL, NULL, NULL, NULL);
+	omap2_init_common_hw(NULL, NULL, NULL, NULL, NULL);
 	omap_init_irq();
 	omap_gpio_init();
arch/arm/mach-omap2/board-omap2evm.c +0 -0
 	omap2evm_init_smc911x();
arch/arm/mach-omap2/board-omap3beagle.c +9 -2
index 7294dbf..872beb6 100644
@@ -312,8 +312,11 @@ static int __init omap3_beagle_i2c_init(void)
 
 static void __init omap3_beagle_init_irq(void)
 {
-	omap2_init_common_hw(mt46h32m32lf6_sdrc_params, omap3_mpu_rate_table,
-			     omap3_dsp_rate_table, omap3_l3_rate_table);
+	omap2_init_common_hw(mt46h32m32lf6_sdrc_params,
+			     mt46h32m32lf6_sdrc_params,
+			     omap3_mpu_rate_table,
+			     omap3_dsp_rate_table,
+			     omap3_l3_rate_table);
 	omap_init_irq();
 	omap_gpio_init();
 }
@@ -441,6 +444,10 @@ static void __init omap3_beagle_init(void)
 	usb_musb_init();
 	usb_ehci_init();
 	omap3beagle_flash_init();
+
+	/* Ensure SDRC pins are mux'd for self-refresh */
+	omap_cfg_reg(H16_34XX_SDRC_CKE0);
+	omap_cfg_reg(H17_34XX_SDRC_CKE1);
 }
 
 static void __init omap3_beagle_map_io(void)
arch/arm/mach-omap2/board-omap3evm.c +4 -2
index f017f0d..3b9c96a 100644
@@ -276,8 +276,10 @@ struct spi_board_info omap3evm_spi_board_info[] = {
 
 static void __init omap3_evm_init_irq(void)
 {
-	omap2_init_common_hw(mt46h32m32lf6_sdrc_params, omap3_mpu_rate_table,
-	                     omap3_dsp_rate_table, omap3_l3_rate_table);
+	omap2_init_common_hw(mt46h32m32lf6_sdrc_params, NULL,
+			     omap3_mpu_rate_table,
+			     omap3_dsp_rate_table,
+			     omap3_l3_rate_table);
 	omap_init_irq();
 	omap_gpio_init();
 	omap3evm_init_smc911x();
arch/arm/mach-omap2/board-omap3pandora.c +2 -1
index c67f62f..05ab99e 100644
@@ -220,7 +220,8 @@ static int __init omap3pandora_i2c_init(void)
 
 static void __init omap3pandora_init_irq(void)
 {
-	omap2_init_common_hw(mt46h32m32lf6_sdrc_params);
+	omap2_init_common_hw(mt46h32m32lf6_sdrc_params, NULL,
+			     NULL, NULL, NULL);
 	omap_init_irq();
 	omap_gpio_init();
 }
arch/arm/mach-omap2/board-overo.c +8 -1
index 9eae608..50902d4 100644
@@ -45,6 +45,7 @@
 #include <mach/gpmc.h>
 #include <mach/hardware.h>
 #include <mach/nand.h>
+#include <mach/mux.h>
 #include <mach/usb.h>
 
 #include "sdram-micron-mt46h32m32lf-6.h"
@@ -355,7 +356,9 @@ static int __init overo_i2c_init(void)
 
 static void __init overo_init_irq(void)
 {
-	omap2_init_common_hw(mt46h32m32lf6_sdrc_params, NULL, NULL, NULL);
+	omap2_init_common_hw(mt46h32m32lf6_sdrc_params,
+			     mt46h32m32lf6_sdrc_params,
+			     NULL, NULL, NULL);
 	omap_init_irq();
 	omap_gpio_init();
 }
@@ -391,6 +394,10 @@ static void __init overo_init(void)
 	overo_init_smsc911x();
 	overo_ads7846_init();
 
+	/* Ensure SDRC pins are mux'd for self-refresh */
+	omap_cfg_reg(H16_34XX_SDRC_CKE0);
+	omap_cfg_reg(H17_34XX_SDRC_CKE1);
+
 	if ((gpio_request(OVERO_GPIO_W2W_NRESET,
 			  "OVERO_GPIO_W2W_NRESET") == 0) &&
 	    (gpio_direction_output(OVERO_GPIO_W2W_NRESET, 1) == 0)) {
arch/arm/mach-omap2/board-rx51.c +4 -2
index 09035b0..d48459f 100644
@@ -64,8 +64,10 @@ static struct omap_board_config_kernel rx51_config[] =
 {
 
 static void __init rx51_init_irq(void)
 {
-	omap2_init_common_hw(rx51_get_sdram_timings(), omap3_mpu_rate_table,
-			     omap3_dsp_rate_table, omap3_l3_rate_table);
+	omap2_init_common_hw(rx51_get_sdram_timings(), NULL,
+			     omap3_mpu_rate_table,
+			     omap3_dsp_rate_table,
+			     omap3_l3_rate_table);
 	omap_init_irq();
 	omap_gpio_init();

}

(quoted diff) +0 -0

b/arch/arm/mach-omap2/clock34xx.c index 3cee6b4..f262787 100644

arch/arm/mach-omap2/clock34xx.c +3 -1
@@ -478,7 +478,9 @@ static int omap3_core_dpll_m2_set_rate(struct clk
 *clk, unsigned long rate)
 	u32 unlock_dll = 0;
 	u32 c;
 	unsigned long validrate, sdrcrate, mpurate;
-	struct omap_sdrc_params *sp;
+	struct omap_sdrc_params *sdrc_cs0;
+	struct omap_sdrc_params *sdrc_cs1;
+	int ret;
 
 	if (!clk || !rate)
arch/arm/mach-omap2/clock34xx.c +2 -2
 		return -EINVAL;
@@ -496,8 +498,8 @@ static int omap3_core_dpll_m2_set_rate(struct clk
 *clk, unsigned long rate)
 	else
 		sdrcrate >>= ((clk->rate / rate) >> 1);
 
-	sp = omap2_sdrc_get_params(sdrcrate);
-	if (!sp)
+	ret = omap2_sdrc_get_params(sdrcrate, &sdrc_cs0, &sdrc_cs1);
+	if (ret)
 		return -EINVAL;
 
arch/arm/mach-omap2/clock34xx.c +23 -6
 	if (sdrcrate < MIN_SDRC_DLL_LOCK_FREQ) {
@@ -518,12 +520,29 @@ static int omap3_core_dpll_m2_set_rate(struct clk
 *clk, unsigned long rate)
 
 	pr_debug("clock: changing CORE DPLL rate from %lu to %lu\n", clk->rate,
 		 validrate);
-	pr_debug("clock: SDRC timing params used: %08x %08x %08x\n",
-		 sp->rfr_ctrl, sp->actim_ctrla, sp->actim_ctrlb);
-
-	omap3_configure_core_dpll(sp->rfr_ctrl, sp->actim_ctrla,
-				  sp->actim_ctrlb, new_div, unlock_dll, c,
-				  sp->mr, rate > clk->rate);
+	pr_debug("clock: SDRC CS0 timing params used:"
+		 " RFR %08x CTRLA %08x CTRLB %08x MR %08x\n",
+		 sdrc_cs0->rfr_ctrl, sdrc_cs0->actim_ctrla,
+		 sdrc_cs0->actim_ctrlb, sdrc_cs0->mr);
+	if (sdrc_cs1)
+		pr_debug("clock: SDRC CS1 timing params used: "
+		 " RFR %08x CTRLA %08x CTRLB %08x MR %08x\n",
+		 sdrc_cs1->rfr_ctrl, sdrc_cs1->actim_ctrla,
+		 sdrc_cs1->actim_ctrlb, sdrc_cs1->mr);
+
+	if (sdrc_cs1)
+		omap3_configure_core_dpll(
+				  new_div, unlock_dll, c, rate > clk->rate,
+				  sdrc_cs0->rfr_ctrl, sdrc_cs0->actim_ctrla,
+				  sdrc_cs0->actim_ctrlb, sdrc_cs0->mr,
+				  sdrc_cs1->rfr_ctrl, sdrc_cs1->actim_ctrla,
+				  sdrc_cs1->actim_ctrlb, sdrc_cs1->mr);
+	else
+		omap3_configure_core_dpll(
+				  new_div, unlock_dll, c, rate > clk->rate,
+				  sdrc_cs0->rfr_ctrl, sdrc_cs0->actim_ctrla,
+				  sdrc_cs0->actim_ctrlb, sdrc_cs0->mr,
+				  0, 0, 0, 0);
 
 	return 0;

}

arch/arm/mach-omap2/io.c +3 -2
index 6fb6c29..aa000b4 100644
@@ -231,7 +231,8 @@ static int __init _omap2_init_reprogram_sdrc(void)
 	return v;
 }
 
-void __init omap2_init_common_hw(struct omap_sdrc_params *sp,
+void __init omap2_init_common_hw(struct omap_sdrc_params *sdrc_cs0,
+				 struct omap_sdrc_params *sdrc_cs1,
 				 struct omap_opp *mpu_opps,
 				 struct omap_opp *dsp_opps,
 				 struct omap_opp *l3_opps)
@@ -244,7 +245,7 @@ void __init omap2_init_common_hw(struct
 omap_sdrc_params *sp,
 	omapdev_init(omapdevs);
 	omap2_clk_init();
 	omap_pm_if_init();
-	omap2_sdrc_init(sp);
+	omap2_sdrc_init(sdrc_cs0, sdrc_cs1);
 
 	_omap2_init_reprogram_sdrc();
arch/arm/mach-omap2/mux.c +6 -0
index 026c4fc..43d6b92 100644
@@ -486,6 +486,12 @@ MUX_CFG_34XX("H19_34XX_GPIO164_OUT", 0x19c,
 		OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_OUTPUT)
 MUX_CFG_34XX("J25_34XX_GPIO170", 0x1c6,
 		OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_INPUT)
+
+/* OMAP3 SDRC CKE signals to SDR/DDR ram chips */
+MUX_CFG_34XX("H16_34XX_SDRC_CKE0", 0x262,
+		OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_OUTPUT)
+MUX_CFG_34XX("H17_34XX_SDRC_CKE1", 0x264,
+		OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_OUTPUT)
 };
 
 #define OMAP34XX_PINS_SZ	ARRAY_SIZE(omap34xx_pins)
arch/arm/mach-omap2/sdrc.c +1 -1
index c832d83..b42f5ae 100644
@@ -32,7 +32,7 @@
 #include <mach/sdrc.h>
 #include "sdrc.h"
 
-static struct omap_sdrc_params *sdrc_init_params;
+static struct omap_sdrc_params *sdrc_init_params_cs0,
 *sdrc_init_params_cs1;
 
 void __iomem *omap2_sdrc_base;

void __iomem *omap2_sms_base;

arch/arm/mach-omap2/sdrc.c +5 -8
@@ -71,33 +71,49 @@ void omap2_sms_restore_context(void)
 /**
  * omap2_sdrc_get_params - return SDRC register values for a given clock
 rate * @r: SDRC clock rate (in Hz)
+ * @sdrc_cs0: chip select 0 ram timings **
+ * @sdrc_cs1: chip select 1 ram timings **
  *
  * Return pre-calculated values for the SDRC_ACTIM_CTRLA,
- * SDRC_ACTIM_CTRLB, SDRC_RFR_CTRL, and SDRC_MR registers, for a given
- * SDRC clock rate 'r'.  These parameters control various timing
- * delays in the SDRAM controller that are expressed in terms of the
- * number of SDRC clock cycles to wait; hence the clock rate
- * dependency. Note that sdrc_init_params must be sorted rate
- * descending.  Also assumes that both chip-selects use the same
- * timing parameters.  Returns a struct omap_sdrc_params * upon
- * success, or NULL upon failure.
+ *  SDRC_ACTIM_CTRLB, SDRC_RFR_CTRL and SDRC_MR registers in sdrc_cs[01]
+ *  structs,for a given SDRC clock rate 'r'.
+ * These parameters control various timing delays in the SDRAM

controller + * that are expressed in terms of the number of SDRC clock cycles to + * wait; hence the clock rate dependency.
+ *
+ * Supports 2 different timing parameters for both chip selects.
+ *
+ * Note 1: the sdrc_init_params_cs[01] must be sorted rate descending.
+ * Note 2: If sdrc_init_params_cs_1 is not NULL it must be of same size
+ * as sdrc_init_params_cs_0.
+ *
+ * Fills in the struct omap_sdrc_params * for each chip select.
+ * Returns 0 upon success or -1 upon failure.
*/

arch/arm/mach-omap2/sdrc.c +19 -11
-struct omap_sdrc_params *omap2_sdrc_get_params(unsigned long r)
+int omap2_sdrc_get_params(unsigned long r,
+			  struct omap_sdrc_params **sdrc_cs0,
+			  struct omap_sdrc_params **sdrc_cs1)
 {
-	struct omap_sdrc_params *sp;
+	struct omap_sdrc_params *sp0, *sp1;
 
-	if (!sdrc_init_params)
-		return NULL;
+	if (!sdrc_init_params_cs0)
+		return -1;
 
-	sp = sdrc_init_params;
+	sp0 = sdrc_init_params_cs0;
+	sp1 = sdrc_init_params_cs1;
 
-	while (sp->rate && sp->rate != r)
-		sp++;
+	while (sp0->rate && sp0->rate != r) {
+		sp0++;
+		if (sdrc_init_params_cs1)
+			sp1++;
+	}
 
-	if (!sp->rate)
-		return NULL;
+	if (!sp0->rate)
+		return -1;
 
-	return sp;
+	*sdrc_cs0 = sp0;
+	*sdrc_cs1 = sp1;
+	return 0;
 }
@@ -109,13 +125,15 @@ void __init omap2_set_globals_sdrc(struct
 omap_globals *omap2_globals)
 
 /**
  * omap2_sdrc_init - initialize SMS, SDRC devices on boot
- * @sp: pointer to a null-terminated list of struct omap_sdrc_params
+ * @sdrc_cs[01]: pointers to a null-terminated list of struct

omap_sdrc_params
+ * Support for 2 chip selects timings
*
* Turn on smart idle modes for SDRAM scheduler and controller.
* Program a known-good configuration for the SDRC to deal with buggy
* bootloaders.
*/

arch/arm/mach-omap2/sdrc.c +4 -2
-void __init omap2_sdrc_init(struct omap_sdrc_params *sp)
+void __init omap2_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
+			    struct omap_sdrc_params *sdrc_cs1)
 {
 	u32 l;
@@ -129,7 +147,8 @@ void __init omap2_sdrc_init(struct omap_sdrc_params
 *sp) l |= (0x2 << 3);
 	sdrc_write_reg(l, SDRC_SYSCONFIG);
 
-	sdrc_init_params = sp;
+	sdrc_init_params_cs0 = sdrc_cs0;
+	sdrc_init_params_cs1 = sdrc_cs1;
 
 	/* XXX Enable SRFRONIDLEREQ here also? */
 	l = (1 << SDRC_POWER_EXTCLKDIS_SHIFT) |
(quoted diff) +0 -0

b/arch/arm/mach-omap2/sram34xx.S index f41f8d9..3aef744 100644

arch/arm/mach-omap2/sram34xx.S +107 -30
@@ -36,7 +36,7 @@
 
 	.text
 
-/* r4 parameters */
+/* r1 parameters */
 #define SDRC_NO_UNLOCK_DLL		0x0
 #define SDRC_UNLOCK_DLL			0x1
 
@@ -71,40 +71,71 @@
 
 /*
  * omap3_sram_configure_core_dpll - change DPLL3 M2 divider
- * r0 = new SDRC_RFR_CTRL register contents
- * r1 = new SDRC_ACTIM_CTRLA register contents
- * r2 = new SDRC_ACTIM_CTRLB register contents
- * r3 = new M2 divider setting (only 1 and 2 supported right now)
- * r4 = unlock SDRC DLL? (1 = yes, 0 = no).  Only unlock DLL for
+ *
+ * Params passed in registers:
+ *  r0 = new M2 divider setting (only 1 and 2 supported right now)
+ *  r1 = unlock SDRC DLL? (1 = yes, 0 = no).  Only unlock DLL for
  *      SDRC rates < 83MHz
- * r5 = number of MPU cycles to wait for SDRC to stabilize after
+ *  r2 = number of MPU cycles to wait for SDRC to stabilize after
  *      reprogramming the SDRC when switching to a slower MPU speed
- * r6 = new SDRC_MR_0 register value
- * r7 = increasing SDRC rate? (1 = yes, 0 = no)
+ *  r3 = increasing SDRC rate? (1 = yes, 0 = no)
+ *
+ * Params passed via the stack. The needed params will be copied in SRAM
+ *  before use by the code in SRAM (SDRAM is not accessible during SDRC
+ *  reconfiguration):
+ *  new SDRC_RFR_CTRL_0 register contents
+ *  new SDRC_ACTIM_CTRL_A_0 register contents
+ *  new SDRC_ACTIM_CTRL_B_0 register contents
+ *  new SDRC_MR_0 register value
+ *  new SDRC_RFR_CTRL_1 register contents
+ *  new SDRC_ACTIM_CTRL_A_1 register contents
+ *  new SDRC_ACTIM_CTRL_B_1 register contents
+ *  new SDRC_MR_1 register value
  *
+ * If the param SDRC_RFR_CTRL_1 is 0, the parameters
+ *  are not programmed into the SDRC CS1 registers
  */
 ENTRY(omap3_sram_configure_core_dpll)
 	stmfd	sp!, {r1-r12, lr}	@ store regs to stack
-	ldr	r4, [sp, #52]		@ pull extra args off the stack
-	ldr	r5, [sp, #56]		@ load extra args from the stack
-	ldr	r6, [sp, #60]		@ load extra args from the stack
-	ldr	r7, [sp, #64]		@ load extra args from the stack
+
+					@ pull the extra args off the stack
+					@  and store them in SRAM
+	ldr	r4, [sp, #52]
+	str     r4, omap_sdrc_rfr_ctrl_0_val
+	ldr	r4, [sp, #56]
+	str     r4, omap_sdrc_actim_ctrl_a_0_val
+	ldr	r4, [sp, #60]
+	str     r4, omap_sdrc_actim_ctrl_b_0_val
+	ldr	r4, [sp, #64]
+	str     r4, omap_sdrc_mr_0_val
+	ldr	r4, [sp, #68]
+	str     r4, omap_sdrc_rfr_ctrl_1_val
+	cmp	r4, #0			@ if SDRC_RFR_CTRL_1 is 0,
+	beq	skip_cs1_params		@  do not use cs1 params
+	ldr	r4, [sp, #72]
+	str     r4, omap_sdrc_actim_ctrl_a_1_val
+	ldr	r4, [sp, #76]
+	str     r4, omap_sdrc_actim_ctrl_b_1_val
+	ldr	r4, [sp, #80]
+	str     r4, omap_sdrc_mr_1_val
+skip_cs1_params:
 	dsb				@ flush buffered writes to interconnect
-	cmp	r7, #1			@ if increasing SDRC clk rate,
+
+	cmp	r3, #1			@ if increasing SDRC clk rate,
 	bleq	configure_sdrc		@ program the SDRC regs early (for RFR)
-	cmp	r4, #SDRC_UNLOCK_DLL	@ set the intended DLL state
+	cmp	r1, #SDRC_UNLOCK_DLL	@ set the intended DLL state
 	bleq	unlock_dll
 	blne	lock_dll
 	bl	sdram_in_selfrefresh	@ put SDRAM in self refresh, idle SDRC
 	bl 	configure_core_dpll	@ change the DPLL3 M2 divider
 	bl	enable_sdrc		@ take SDRC out of idle
-	cmp	r4, #SDRC_UNLOCK_DLL	@ wait for DLL status to change
+	cmp	r1, #SDRC_UNLOCK_DLL	@ wait for DLL status to change
 	bleq	wait_dll_unlock
 	blne	wait_dll_lock
-	cmp	r7, #1			@ if increasing SDRC clk rate,
+	cmp	r3, #1			@ if increasing SDRC clk rate,
 	beq	return_to_sdram		@ return to SDRAM code, otherwise,
 	bl	configure_sdrc		@ reprogram SDRC regs now
-	mov	r12, r5
+	mov	r12, r2
 	bl	wait_clk_stable		@ wait for SDRC to stabilize
 return_to_sdram:
 	isb				@ prevent speculative exec past here
@@ -149,7 +180,7 @@ configure_core_dpll:
 	ldr	r12, [r11]
 	ldr	r10, core_m2_mask_val	@ modify m2 for core dpll
 	and	r12, r12, r10
-	orr	r12, r12, r3, lsl #CORE_DPLL_CLKOUT_DIV_SHIFT
+	orr	r12, r12, r0, lsl #CORE_DPLL_CLKOUT_DIV_SHIFT
 	str	r12, [r11]
 	ldr	r12, [r11]		@ posted-write barrier for CM
 	bx	lr
@@ -187,15 +218,34 @@ wait_dll_unlock:
 	bne	wait_dll_unlock
 	bx	lr
 configure_sdrc:
-	ldr	r11, omap3_sdrc_rfr_ctrl
-	str	r0, [r11]
-	ldr	r11, omap3_sdrc_actim_ctrla
-	str	r1, [r11]
-	ldr	r11, omap3_sdrc_actim_ctrlb
-	str	r2, [r11]
+	ldr	r12, omap_sdrc_rfr_ctrl_0_val	@ fetch value from SRAM
+	ldr	r11, omap3_sdrc_rfr_ctrl_0	@ fetch addr from SRAM
+	str	r12, [r11]			@ store
+	ldr	r12, omap_sdrc_actim_ctrl_a_0_val
+	ldr	r11, omap3_sdrc_actim_ctrl_a_0
+	str	r12, [r11]
+	ldr	r12, omap_sdrc_actim_ctrl_b_0_val
+	ldr	r11, omap3_sdrc_actim_ctrl_b_0
+	str	r12, [r11]
+	ldr	r12, omap_sdrc_mr_0_val
 	ldr	r11, omap3_sdrc_mr_0
-	str	r6, [r11]
-	ldr	r6, [r11]		@ posted-write barrier for SDRC
+	str	r12, [r11]
+	ldr	r12, omap_sdrc_rfr_ctrl_1_val
+	cmp	r12, #0			@ if SDRC_RFR_CTRL_1 is 0,
+	beq	skip_cs1_prog		@  do not program cs1 params
+	ldr	r11, omap3_sdrc_rfr_ctrl_1
+	str	r12, [r11]
+	ldr	r12, omap_sdrc_actim_ctrl_a_1_val
+	ldr	r11, omap3_sdrc_actim_ctrl_a_1
+	str	r12, [r11]
+	ldr	r12, omap_sdrc_actim_ctrl_b_1_val
+	ldr	r11, omap3_sdrc_actim_ctrl_b_1
+	str	r12, [r11]
+	ldr	r12, omap_sdrc_mr_1_val
+	ldr	r11, omap3_sdrc_mr_1
+	str	r12, [r11]
+skip_cs1_prog:
+	ldr	r12, [r11]		@ posted-write barrier for SDRC
 	bx	lr
 
 omap3_sdrc_power:
@@ -206,14 +256,40 @@ omap3_cm_idlest1_core:
 	.word OMAP34XX_CM_REGADDR(CORE_MOD, CM_IDLEST)
 omap3_cm_iclken1_core:
 	.word OMAP34XX_CM_REGADDR(CORE_MOD, CM_ICLKEN1)
-omap3_sdrc_rfr_ctrl:
+
+omap3_sdrc_rfr_ctrl_0:
 	.word OMAP34XX_SDRC_REGADDR(SDRC_RFR_CTRL_0)
-omap3_sdrc_actim_ctrla:
+omap3_sdrc_rfr_ctrl_1:
+	.word OMAP34XX_SDRC_REGADDR(SDRC_RFR_CTRL_1)
+omap3_sdrc_actim_ctrl_a_0:
 	.word OMAP34XX_SDRC_REGADDR(SDRC_ACTIM_CTRL_A_0)
-omap3_sdrc_actim_ctrlb:
+omap3_sdrc_actim_ctrl_a_1:
+	.word OMAP34XX_SDRC_REGADDR(SDRC_ACTIM_CTRL_A_1)
+omap3_sdrc_actim_ctrl_b_0:
 	.word OMAP34XX_SDRC_REGADDR(SDRC_ACTIM_CTRL_B_0)
+omap3_sdrc_actim_ctrl_b_1:
+	.word OMAP34XX_SDRC_REGADDR(SDRC_ACTIM_CTRL_B_1)
 omap3_sdrc_mr_0:
 	.word OMAP34XX_SDRC_REGADDR(SDRC_MR_0)
+omap3_sdrc_mr_1:
+	.word OMAP34XX_SDRC_REGADDR(SDRC_MR_1)
+omap_sdrc_rfr_ctrl_0_val:
+	.word 0xDEADBEEF
+omap_sdrc_rfr_ctrl_1_val:
+	.word 0xDEADBEEF
+omap_sdrc_actim_ctrl_a_0_val:
+	.word 0xDEADBEEF
+omap_sdrc_actim_ctrl_a_1_val:
+	.word 0xDEADBEEF
+omap_sdrc_actim_ctrl_b_0_val:
+	.word 0xDEADBEEF
+omap_sdrc_actim_ctrl_b_1_val:
+	.word 0xDEADBEEF
+omap_sdrc_mr_0_val:
+	.word 0xDEADBEEF
+omap_sdrc_mr_1_val:
+	.word 0xDEADBEEF
+
 omap3_sdrc_dlla_status:
 	.word OMAP34XX_SDRC_REGADDR(SDRC_DLLA_STATUS)
 omap3_sdrc_dlla_ctrl:
@@ -223,3 +299,4 @@ core_m2_mask_val:
 
 ENTRY(omap3_sram_configure_core_dpll_sz)
 	.word	. - omap3_sram_configure_core_dpll
+
arch/arm/plat-omap/include/mach/io.h +2 -1
index 54c159b..d4c78b4 100644
@@ -192,7 +192,8 @@ extern void omap1_map_common_io(void);
 extern void omap1_init_common_hw(void);
 
 extern void omap2_map_common_io(void);
-extern void omap2_init_common_hw(struct omap_sdrc_params *sp,
+extern void omap2_init_common_hw(struct omap_sdrc_params *sdrc_cs0,
+				 struct omap_sdrc_params *sdrc_cs1,
 				 struct omap_opp *mpu_opps,
 				 struct omap_opp *dsp_opps,
 				 struct omap_opp *l3_opps);
arch/arm/plat-omap/include/mach/mux.h +4 -0
index f7e298a..7368aba 100644
@@ -803,6 +803,10 @@ enum omap34xx_index {
 	AE5_34XX_GPIO143,
 	H19_34XX_GPIO164_OUT,
 	J25_34XX_GPIO170,
+
+	/* OMAP3 SDRC CKE signals to SDR/DDR ram chips */
+	H16_34XX_SDRC_CKE0,
+	H17_34XX_SDRC_CKE1,
 };
 
 struct omap_mux_cfg {
arch/arm/plat-omap/include/mach/sdrc.h +5 -3
index a678bc8..7e22143 100644
@@ -114,9 +114,11 @@ struct omap_sdrc_params {
 
 void omap2_sms_save_context(void);
 void omap2_sms_restore_context(void);
-void __init omap2_sdrc_init(struct omap_sdrc_params *);
-struct omap_sdrc_params *omap2_sdrc_get_params(unsigned long r);
-
+void __init omap2_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
+			    struct omap_sdrc_params *sdrc_cs1);
+int omap2_sdrc_get_params(unsigned long r,
+			  struct omap_sdrc_params **sdrc_cs0,
+			  struct omap_sdrc_params **sdrc_cs1);
 #ifdef CONFIG_ARCH_OMAP2
 
 struct memory_timings {
arch/arm/plat-omap/include/mach/sram.h +7 -5
index ad0a600..98906ea 100644
@@ -21,11 +21,13 @@ extern void omap2_sram_reprogram_sdrc(u32 perf_level,
 u32 dll_val,
 				      u32 mem_type);
 extern u32 omap2_set_prcm(u32 dpll_ctrl_val, u32 sdrc_rfr_val, int
 bypass);
 
-extern u32 omap3_configure_core_dpll(u32 sdrc_rfr_ctrl,
-				     u32 sdrc_actim_ctrla,
-				     u32 sdrc_actim_ctrlb, u32 m2,
-				     u32 unlock_dll, u32 f, u32 sdrc_mr,
-				     u32 inc);
+extern u32 omap3_configure_core_dpll(
+			u32 m2, u32 unlock_dll, u32 f, u32 inc,
+			u32 sdrc_rfr_ctrl_0, u32 sdrc_actim_ctrl_a_0,
+			u32 sdrc_actim_ctrl_b_0, u32 sdrc_mr_0,
+			u32 sdrc_rfr_ctrl_1, u32 sdrc_actim_ctrl_a_1,
+			u32 sdrc_actim_ctrl_b_1, u32 sdrc_mr_1);
+
 extern void omap3_sram_restore_context(void);

/* Do not use these */

arch/arm/plat-omap/include/mach/sram.h +6 -5
@@ -61,11 +63,12 @@ extern void omap243x_sram_reprogram_sdrc(u32
 perf_level, u32 dll_val,
 extern unsigned long omap243x_sram_reprogram_sdrc_sz;
 
 
-extern u32 omap3_sram_configure_core_dpll(u32 sdrc_rfr_ctrl,
-					  u32 sdrc_actim_ctrla,
-					  u32 sdrc_actim_ctrlb, u32 m2,
-					  u32 unlock_dll, u32 f, u32 sdrc_mr,
-					  u32 inc);
+extern u32 omap3_sram_configure_core_dpll(
+			u32 m2, u32 unlock_dll, u32 f, u32 inc,
+			u32 sdrc_rfr_ctrl_0, u32 sdrc_actim_ctrl_a_0,
+			u32 sdrc_actim_ctrl_b_0, u32 sdrc_mr_0,
+			u32 sdrc_rfr_ctrl_1, u32 sdrc_actim_ctrl_a_1,
+			u32 sdrc_actim_ctrl_b_1, u32 sdrc_mr_1);
 extern unsigned long omap3_sram_configure_core_dpll_sz;
 

#ifdef CONFIG_PM

arch/arm/plat-omap/sram.c +20 -15
index a2e60e7..517f45b 100644
@@ -368,23 +368,29 @@ static inline int omap243x_sram_init(void)
 
 #ifdef CONFIG_ARCH_OMAP3
 
-static u32 (*_omap3_sram_configure_core_dpll)(u32 sdrc_rfr_ctrl,
-					      u32 sdrc_actim_ctrla,
-					      u32 sdrc_actim_ctrlb,
-					      u32 m2, u32 unlock_dll,
-					      u32 f, u32 sdrc_mr, u32 inc);
-u32 omap3_configure_core_dpll(u32 sdrc_rfr_ctrl, u32 sdrc_actim_ctrla,
-			      u32 sdrc_actim_ctrlb, u32 m2, u32 unlock_dll,
-			      u32 f, u32 sdrc_mr, u32 inc)
- {
+static u32 (*_omap3_sram_configure_core_dpll)(
+				u32 m2, u32 unlock_dll, u32 f, u32 inc,
+				u32 sdrc_rfr_ctrl_0, u32 sdrc_actim_ctrl_a_0,
+				u32 sdrc_actim_ctrl_b_0, u32 sdrc_mr_0,
+				u32 sdrc_rfr_ctrl_1, u32 sdrc_actim_ctrl_a_1,
+				u32 sdrc_actim_ctrl_b_1, u32 sdrc_mr_1);
+
+u32 omap3_configure_core_dpll(u32 m2, u32 unlock_dll, u32 f, u32 inc,
+			      u32 sdrc_rfr_ctrl_0, u32 sdrc_actim_ctrl_a_0,
+			      u32 sdrc_actim_ctrl_b_0, u32 sdrc_mr_0,
+			      u32 sdrc_rfr_ctrl_1, u32 sdrc_actim_ctrl_a_1,
+			      u32 sdrc_actim_ctrl_b_1, u32 sdrc_mr_1)
+{
 	if (!_omap3_sram_configure_core_dpll)
 		omap_sram_error();
 
-	return _omap3_sram_configure_core_dpll(sdrc_rfr_ctrl,
-					       sdrc_actim_ctrla,
-					       sdrc_actim_ctrlb, m2,
-					       unlock_dll, f, sdrc_mr, inc);
- }
+	return _omap3_sram_configure_core_dpll(
+				m2, unlock_dll, f, inc,
+				sdrc_rfr_ctrl_0, sdrc_actim_ctrl_a_0,
+				sdrc_actim_ctrl_b_0, sdrc_mr_0,
+				sdrc_rfr_ctrl_1, sdrc_actim_ctrl_a_1,
+				sdrc_actim_ctrl_b_1, sdrc_mr_1);
+}
 
 #ifdef CONFIG_PM
 void omap3_sram_restore_context(void)
--

1.6.2.5.168.g3823

Quoted 22 lines · On Friday 05 June 2009 20:10:40 Paul Walmsley wrote:

Hi Jean,

Quoted 10 lines · Jean Pihet

Here is the new patch that includes all the remarks and suggestion. The description is here below.

Some notes:
- all calls to omap2_init_common_hw have been adapted in the board files. it looks like 2430SDP and Pandora board files are broken since they use only one param. Can that be checked on those boards?
- it is assumed that RX51 only uses 1 CS. Is that correct?

Can you review it and possibly merge?

Looks great.

Tero, does RX51 use two SDRC chipselects!

Quoted 2 lines

Thanks & regards,
Jean

#19 lore raw

RE: [RFC][PATCH] OMAP3: add support for 2 SDRAM chip selects

Quoted 23 lines

-----Original Message-----
From: ext Kevin Hilman [mailto:[email protected]]
Sent: 08 June, 2009 20:24
To: Jean Pihet
Cc: Paul Walmsley; Kristo Tero (Nokia-D/Tampere); linux-omap
Subject: Re: [RFC][PATCH] OMAP3: add support for 2 SDRAM chip selects

Quoted 12 lines · Jean Pihet
Quoted 11 lines · On Monday 08 June 2009 16:59:36 Kevin Hilman wrote:
Quoted 6 lines · Jean Pihet

Paul,

Here is the updated patch that fixes the Overo build as well. Can you check it?

Kevin, can you push it if it is correct?

Can you run it through checkpatch, fix the errors and also merge Tero's
RX51 patch if it looks good to you.

Quoted 8 lines
Quoted 3 lines

Ok. I will check. The cause might be the mailer.

I think we need the omap_cfg_reg calls in the RX51 board

file as well,

Quoted 2 lines

even if the bootloader has the mux setting already right. That way a warning will be issued in case of a faulty bootloader. Do you agree?

I agree.

Well, this is ok for me too as it does not really change anything. I will voice my opinion here though. :)

I find it somewhat weird that we take care of two pads in this fashion out of ~350 or so, where in most cases we just assume that the pads are configured properly by the boot loader. Should we do the same for every pad? Does the kernel even boot if the CKE signals are configured incorrectly? I would guess the boot loader will fail to load the kernel image into SDRAM in that case.

-Tero

Quoted 953 lines

Kevin

Quoted 20 lines
Quoted 5 lines

Below are the checkpatch errors I get: looks lik your mailer is probably wrapping the patch and there is also one error to fix.

Kevin

Regards,
Jean

Quoted 12 lines

ERROR: patch seems to be corrupt (line wrapped?)
#306: FILE: arch/arm/mach-omap2/clock34xx.c:477:
unsigned long rate)

ERROR: trailing whitespace
#494: FILE: arch/arm/mach-omap2/sdrc.c:128:
+ * @sdrc_cs[01]: pointers to a null-terminated list of struct $

total: 2 errors, 0 warnings, 648 lines checked

Your patch has style problems, please review. If any of

these errors

Quoted 1 line
Quoted 1 line

are false positives report them to the maintainer, see

CHECKPATCH in

Quoted 5 lines
Quoted 5 lines

MAINTAINERS.

Quoted 3 lines

Regards,
Jean

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

From ebe57354b04444de059e1f042e0c488f761853f0 Mon Sep 17 00:00:00 2001
From: Jean Pihet <[email protected]>
Date: Fri, 5 Jun 2009 17:19:00 +0200
Subject: OMAP3: add support for 2 SDRAM chip selects

Some boards (Beagle Cx, Overo) have 2 SDRAM parts

connected to the

Quoted 68 lines
Quoted 68 lines
Quoted 68 lines

SDRC.

This patch adds the following:
- ensure that the CKE signals mux settings are correct
- add a new argument of type omap_sdrc_params struct* to omap2_init_common_hw and omap2_sdrc_init for the 2nd CS params
- adapted the OMAP boards files to the new prototype of omap2_init_common_hw. Only Beagle and Overo are using the 2 CS'es
- adapt the sram sleep code to configure the SDRC for the 2nd CS

Note: If the 2nd param to omap2_init_common_hw is NULL, then the parameters are not programmed into the SDRC CS1 registers

Tested on 3430 SDP and Beagleboard rev C2 and B5, with suspend/resume and frequency changes (cpufreq).

Thanks to Paul Walmsley and Kevin Hilman for the suggestions and code reviews.

---
 arch/arm/mach-omap2/board-2430sdp.c      |    2 +-
 arch/arm/mach-omap2/board-3430sdp.c      |    6 +-
 arch/arm/mach-omap2/board-apollon.c      |    2 +-
 arch/arm/mach-omap2/board-generic.c      |    2 +-
 arch/arm/mach-omap2/board-h4.c           |    2 +-
 arch/arm/mach-omap2/board-ldp.c          |    2 +-
 arch/arm/mach-omap2/board-n800.c         |    2 +-
 arch/arm/mach-omap2/board-omap2evm.c     |    2 +-
 arch/arm/mach-omap2/board-omap3beagle.c  |   11 ++-
 arch/arm/mach-omap2/board-omap3evm.c     |    6 +-
 arch/arm/mach-omap2/board-omap3pandora.c |    3 +-
 arch/arm/mach-omap2/board-overo.c        |    9 ++-
 arch/arm/mach-omap2/board-rx51.c         |    6 +-
 arch/arm/mach-omap2/clock34xx.c          |   37 ++++++--
 arch/arm/mach-omap2/io.c                 |    5 +-
 arch/arm/mach-omap2/mux.c                |    6 ++
 arch/arm/mach-omap2/sdrc.c               |   63 +++++++++-----
 arch/arm/mach-omap2/sram34xx.S           |  137
+++++++++++++++++++++++-------
 arch/arm/plat-omap/include/mach/io.h     |    3 +-
 arch/arm/plat-omap/include/mach/mux.h    |    4 +
 arch/arm/plat-omap/include/mach/sdrc.h   |    8 +-
 arch/arm/plat-omap/include/mach/sram.h   |   23 +++--
 arch/arm/plat-omap/sram.c                |   34 +++++---
 23 files changed, 267 insertions(+), 108 deletions(-)
arch/arm/mach-omap2/board-2430sdp.c +1 -1
index aa5df72..4cb7bc5 100644
@@ -322,7 +322,7 @@ out:
 
 static void __init omap_2430sdp_init_irq(void)  {
- omap2_init_common_hw(NULL);
+ omap2_init_common_hw(NULL, NULL, NULL, NULL, NULL);
  omap_init_irq();
  omap_gpio_init();
  sdp2430_init_smc91x();
arch/arm/mach-omap2/board-3430sdp.c +0 -0
index 195b749..24e2728 100644
@@ -302,8 +302,10 @@ static inline void __init
 sdp3430_init_smc91x(void)
 
Quoted 2 lines
Quoted 2 lines

arch/arm/mach-omap2/board-3430sdp.c static inline void __init · line 305

Quoted 2 lines
arch/arm/mach-omap2/board-3430sdp.c +0 -1
 static void __init omap_3430sdp_init_irq(void)  {
- omap2_init_common_hw(hyb18m512160af6_sdrc_params,

omap3_mpu_rate_table,

Quoted 53 lines
Quoted 53 lines
Quoted 53 lines
arch/arm/mach-omap2/board-3430sdp.c +4 -1
-                      omap3_dsp_rate_table, omap3_l3_rate_table);
+ omap2_init_common_hw(hyb18m512160af6_sdrc_params, NULL,
+                      omap3_mpu_rate_table,
+                      omap3_dsp_rate_table,
+                      omap3_l3_rate_table);
  omap_init_irq();
  omap_gpio_init();
  sdp3430_init_smc91x();
arch/arm/mach-omap2/board-apollon.c +1 -1
index 2e24812..2dd1350 100644
@@ -323,7 +323,7 @@ out:
 
 static void __init omap_apollon_init_irq(void)  {
- omap2_init_common_hw(NULL, NULL, NULL, NULL);
+ omap2_init_common_hw(NULL, NULL, NULL, NULL, NULL);
  omap_init_irq();
  omap_gpio_init();
  apollon_init_smc91x();
arch/arm/mach-omap2/board-generic.c +1 -1
index be763a9..763329b 100644
@@ -33,7 +33,7 @@
 
 static void __init omap_generic_init_irq(void)  {
- omap2_init_common_hw(NULL, NULL, NULL, NULL);
+ omap2_init_common_hw(NULL, NULL, NULL, NULL, NULL);
  omap_init_irq();
 }
 
(quoted diff) +0 -0

b/arch/arm/mach-omap2/board-h4.c index 8f54939..17c3599 100644

arch/arm/mach-omap2/board-h4.c +1 -1
@@ -348,7 +348,7 @@ static void __init h4_init_flash(void)
 
 static void __init omap_h4_init_irq(void)  {
- omap2_init_common_hw(NULL, NULL, NULL, NULL);
+ omap2_init_common_hw(NULL, NULL, NULL, NULL, NULL);
  omap_init_irq();
  omap_gpio_init();
  h4_init_flash();
(quoted diff) +0 -0

b/arch/arm/mach-omap2/board-ldp.c index 9f41dc9..b012806 100644

arch/arm/mach-omap2/board-ldp.c +0 -0
@@ -344,7 +344,7 @@ static inline void __init
 ldp_init_smc911x(void)
 
Quoted 12 lines
Quoted 4 lines
Quoted 4 lines
arch/arm/mach-omap2/board-ldp.c +1 -1
 static void __init omap_ldp_init_irq(void)  {
- omap2_init_common_hw(NULL, NULL, NULL, NULL);
+ omap2_init_common_hw(NULL, NULL, NULL, NULL, NULL);
  omap_init_irq();
Quoted 8 lines

arch/arm/mach-omap2/board-n800.c static struct lm8323_platform_data

Quoted 8 lines
arch/arm/mach-omap2/board-ldp.c +0 -0
  omap_gpio_init();
  ldp_init_smc911x();
arch/arm/mach-omap2/board-n800.c +0 -0
index ac7cf3f..ad53f4a 100644
@@ -127,7 +127,7 @@ static struct lm8323_platform_data

lm8323_pdata

Quoted 29 lines
Quoted 29 lines
Quoted 29 lines
arch/arm/mach-omap2/board-n800.c +1 -1
 = {
 
 void __init nokia_n800_init_irq(void)  {
- omap2_init_common_hw(NULL, NULL, NULL, NULL);
+ omap2_init_common_hw(NULL, NULL, NULL, NULL, NULL);
  omap_init_irq();
  omap_gpio_init();
 
arch/arm/mach-omap2/board-omap2evm.c +1 -1
index 4fac1be..56a26d4 100644
@@ -276,7 +276,7 @@ static struct twl4030_keypad_data
 omap2evm_kp_data = {
 
 static void __init omap2_evm_init_irq(void)  {
- omap2_init_common_hw(NULL, NULL, NULL, NULL);
+ omap2_init_common_hw(NULL, NULL, NULL, NULL, NULL);
  omap_init_irq();
  omap_gpio_init();
  omap2evm_init_smc911x();
arch/arm/mach-omap2/board-omap3beagle.c +0 -0
index 7294dbf..872beb6 100644
@@ -312,8 +312,11 @@ static int __init omap3_beagle_i2c_init(void)
 
Quoted 2 lines
Quoted 2 lines

arch/arm/mach-omap2/board-omap3beagle.c static int __init omap3_beagle_i2c_init(void) · line 314

Quoted 2 lines
arch/arm/mach-omap2/board-omap3beagle.c +0 -1
 static void __init omap3_beagle_init_irq(void)  {
- omap2_init_common_hw(mt46h32m32lf6_sdrc_params,

omap3_mpu_rate_table,

Quoted 28 lines
Quoted 28 lines
Quoted 28 lines
arch/arm/mach-omap2/board-omap3beagle.c +9 -1
-                      omap3_dsp_rate_table, omap3_l3_rate_table);
+ omap2_init_common_hw(mt46h32m32lf6_sdrc_params,
+                      mt46h32m32lf6_sdrc_params,
+                      omap3_mpu_rate_table,
+                      omap3_dsp_rate_table,
+                      omap3_l3_rate_table);
  omap_init_irq();
  omap_gpio_init();
 }
@@ -441,6 +444,10 @@ static void __init omap3_beagle_init(void)
  usb_musb_init();
  usb_ehci_init();
  omap3beagle_flash_init();
+
+ /* Ensure SDRC pins are mux'd for self-refresh */
+ omap_cfg_reg(H16_34XX_SDRC_CKE0);
+ omap_cfg_reg(H17_34XX_SDRC_CKE1);
 }
 
 static void __init omap3_beagle_map_io(void) diff --git

a/arch/arm/mach-omap2/board-omap3evm.c
b/arch/arm/mach-omap2/board-omap3evm.c
index f017f0d..3b9c96a 100644

arch/arm/mach-omap2/board-omap3evm.c +0 -0
@@ -276,8 +276,10 @@ struct spi_board_info
 omap3evm_spi_board_info[] = {
 
Quoted 2 lines
Quoted 2 lines

arch/arm/mach-omap2/board-omap3evm.c struct spi_board_info · line 279

Quoted 2 lines
arch/arm/mach-omap2/board-omap3evm.c +0 -1
 static void __init omap3_evm_init_irq(void)  {
- omap2_init_common_hw(mt46h32m32lf6_sdrc_params,

omap3_mpu_rate_table,

Quoted 34 lines
Quoted 34 lines
Quoted 34 lines
arch/arm/mach-omap2/board-omap3evm.c +4 -1
-                      omap3_dsp_rate_table, omap3_l3_rate_table);
+ omap2_init_common_hw(mt46h32m32lf6_sdrc_params, NULL,
+                      omap3_mpu_rate_table,
+                      omap3_dsp_rate_table,
+                      omap3_l3_rate_table);
  omap_init_irq();
  omap_gpio_init();
  omap3evm_init_smc911x();
arch/arm/mach-omap2/board-omap3pandora.c +2 -1
index c67f62f..05ab99e 100644
@@ -220,7 +220,8 @@ static int __init omap3pandora_i2c_init(void)
 
 static void __init omap3pandora_init_irq(void)  {
- omap2_init_common_hw(mt46h32m32lf6_sdrc_params);
+ omap2_init_common_hw(mt46h32m32lf6_sdrc_params, NULL,
+                      NULL, NULL, NULL);
  omap_init_irq();
  omap_gpio_init();
 }
arch/arm/mach-omap2/board-overo.c +1 -0
index 9eae608..50902d4 100644
@@ -45,6 +45,7 @@
 #include <mach/gpmc.h>
 #include <mach/hardware.h>
 #include <mach/nand.h>
+#include <mach/mux.h>
 #include <mach/usb.h>
 
Quoted 5 lines
Quoted 5 lines

arch/arm/mach-omap2/board-overo.c static int __init overo_i2c_init(void) · line 357

Quoted 5 lines
arch/arm/mach-omap2/board-overo.c +0 -1
 #include "sdram-micron-mt46h32m32lf-6.h"
@@ -355,7 +356,9 @@ static int __init overo_i2c_init(void)
 
 static void __init overo_init_irq(void)  {
- omap2_init_common_hw(mt46h32m32lf6_sdrc_params, NULL,

NULL, NULL);

Quoted 25 lines
Quoted 25 lines
Quoted 25 lines
arch/arm/mach-omap2/board-overo.c +7 -0
+ omap2_init_common_hw(mt46h32m32lf6_sdrc_params,
+                      mt46h32m32lf6_sdrc_params,
+                      NULL, NULL, NULL);
  omap_init_irq();
  omap_gpio_init();
 }
@@ -391,6 +394,10 @@ static void __init overo_init(void)
  overo_init_smsc911x();
  overo_ads7846_init();
 
+ /* Ensure SDRC pins are mux'd for self-refresh */
+ omap_cfg_reg(H16_34XX_SDRC_CKE0);
+ omap_cfg_reg(H17_34XX_SDRC_CKE1);
+
  if ((gpio_request(OVERO_GPIO_W2W_NRESET,
                    "OVERO_GPIO_W2W_NRESET") == 0) &&
      (gpio_direction_output(OVERO_GPIO_W2W_NRESET, 1) == 0)) {
arch/arm/mach-omap2/board-rx51.c +0 -0
index 09035b0..d48459f 100644
@@ -64,8 +64,10 @@ static struct omap_board_config_kernel
 rx51_config[] = {
 
Quoted 2 lines
Quoted 2 lines

arch/arm/mach-omap2/board-rx51.c static struct omap_board_config_kernel · line 67

Quoted 2 lines
arch/arm/mach-omap2/board-rx51.c +0 -1
 static void __init rx51_init_irq(void)  {
- omap2_init_common_hw(rx51_get_sdram_timings(),

omap3_mpu_rate_table,

Quoted 35 lines
Quoted 35 lines
Quoted 35 lines
arch/arm/mach-omap2/board-rx51.c +4 -1
-                      omap3_dsp_rate_table, omap3_l3_rate_table);
+ omap2_init_common_hw(rx51_get_sdram_timings(), NULL,
+                      omap3_mpu_rate_table,
+                      omap3_dsp_rate_table,
+                      omap3_l3_rate_table);
  omap_init_irq();
  omap_gpio_init();
 }
(quoted diff) +0 -0

b/arch/arm/mach-omap2/clock34xx.c index 3cee6b4..f262787 100644

arch/arm/mach-omap2/clock34xx.c +3 -1
@@ -478,7 +478,9 @@ static int omap3_core_dpll_m2_set_rate(struct
 clk *clk, unsigned long rate)
  u32 unlock_dll = 0;
  u32 c;
  unsigned long validrate, sdrcrate, mpurate;
- struct omap_sdrc_params *sp;
+ struct omap_sdrc_params *sdrc_cs0;
+ struct omap_sdrc_params *sdrc_cs1;
+ int ret;
 
  if (!clk || !rate)
          return -EINVAL;
arch/arm/mach-omap2/clock34xx.c +2 -2
@@ -496,8 +498,8 @@ static int omap3_core_dpll_m2_set_rate(struct
 clk *clk, unsigned long rate)
  else
          sdrcrate >>= ((clk->rate / rate) >> 1);
 
- sp = omap2_sdrc_get_params(sdrcrate);
- if (!sp)
+ ret = omap2_sdrc_get_params(sdrcrate, &sdrc_cs0, &sdrc_cs1);
+ if (ret)
          return -EINVAL;
 
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

if (sdrcrate < MIN_SDRC_DLL_LOCK_FREQ) { @@ -518,12 +520,29 @@
static int omap3_core_dpll_m2_set_rate(struct clk *clk, unsigned long rate)

pr_debug("clock: changing CORE DPLL rate from %lu to

%lu\n", clk->rate,

Quoted 6 lines
Quoted 6 lines

arch/arm/mach-omap2/clock34xx.c

Quoted 6 lines
           validrate);

- pr_debug("clock: SDRC timing params used: %08x %08x %08x\n",

arch/arm/mach-omap2/clock34xx.c +0 -4
-          sp->rfr_ctrl, sp->actim_ctrla, sp->actim_ctrlb);
-
- omap3_configure_core_dpll(sp->rfr_ctrl, sp->actim_ctrla,
-                           sp->actim_ctrlb, new_div,

unlock_dll, c,

Quoted 14 lines
Quoted 6 lines
Quoted 6 lines
arch/arm/mach-omap2/clock34xx.c +5 -1
-                           sp->mr, rate > clk->rate);
+ pr_debug("clock: SDRC CS0 timing params used:"
+          " RFR %08x CTRLA %08x CTRLB %08x MR %08x\n",
+          sdrc_cs0->rfr_ctrl, sdrc_cs0->actim_ctrla,
+          sdrc_cs0->actim_ctrlb, sdrc_cs0->mr);
+ if (sdrc_cs1)
Quoted 8 lines

arch/arm/mach-omap2/clock34xx.c

Quoted 8 lines
arch/arm/mach-omap2/clock34xx.c +8 -0
+         pr_debug("clock: SDRC CS1 timing params used: "
+          " RFR %08x CTRLA %08x CTRLB %08x MR %08x\n",
+          sdrc_cs1->rfr_ctrl, sdrc_cs1->actim_ctrla,
+          sdrc_cs1->actim_ctrlb, sdrc_cs1->mr);
+
+ if (sdrc_cs1)
+         omap3_configure_core_dpll(
+                           new_div, unlock_dll, c, rate
Quoted 2 lines

clk->rate,

Quoted 1 line
Quoted 1 line

+ sdrc_cs0->rfr_ctrl,

sdrc_cs0->actim_ctrla,

Quoted 2 lines
Quoted 2 lines

arch/arm/mach-omap2/clock34xx.c

Quoted 2 lines
arch/arm/mach-omap2/clock34xx.c +2 -0
+                           sdrc_cs0->actim_ctrlb, sdrc_cs0->mr,
+                           sdrc_cs1->rfr_ctrl,

sdrc_cs1->actim_ctrla,

Quoted 6 lines
Quoted 4 lines

arch/arm/mach-omap2/clock34xx.c

Quoted 4 lines
arch/arm/mach-omap2/clock34xx.c +4 -0
+                           sdrc_cs1->actim_ctrlb, sdrc_cs1->mr);
+ else
+         omap3_configure_core_dpll(
+                           new_div, unlock_dll, c, rate

clk->rate,

Quoted 1 line
Quoted 1 line

+ sdrc_cs0->rfr_ctrl,

sdrc_cs0->actim_ctrla,

Quoted 10 lines
Quoted 10 lines

arch/arm/mach-omap2/io.c static int __init

Quoted 10 lines
arch/arm/mach-omap2/clock34xx.c +2 -0
+                           sdrc_cs0->actim_ctrlb, sdrc_cs0->mr,
+                           0, 0, 0, 0);
 
  return 0;
 }
arch/arm/mach-omap2/io.c +0 -0
index 6fb6c29..aa000b4 100644
@@ -231,7 +231,8 @@ static int __init

_omap2_init_reprogram_sdrc(void)

Quoted 5 lines
Quoted 5 lines

arch/arm/mach-omap2/io.c static int __init _omap2_init_reprogram_sdrc(void)

Quoted 5 lines
arch/arm/mach-omap2/io.c +1 -1
  return v;
 }
 
-void __init omap2_init_common_hw(struct omap_sdrc_params *sp,
+void __init omap2_init_common_hw(struct omap_sdrc_params

*sdrc_cs0,

Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
arch/arm/mach-omap2/io.c +2 -1
+                          struct omap_sdrc_params *sdrc_cs1,
                           struct omap_opp *mpu_opps,
                           struct omap_opp *dsp_opps,
                           struct omap_opp *l3_opps)
@@ -244,7 +245,7 @@ void __init omap2_init_common_hw(struct
 omap_sdrc_params *sp,
  omapdev_init(omapdevs);
  omap2_clk_init();
  omap_pm_if_init();
- omap2_sdrc_init(sp);
+ omap2_sdrc_init(sdrc_cs0, sdrc_cs1);
 
Quoted 3 lines
Quoted 3 lines

Review

Quoted 3 lines
arch/arm/mach-omap2/io.c +0 -0
  _omap2_init_reprogram_sdrc();
(quoted diff) +0 -0

b/arch/arm/mach-omap2/mux.c

Quoted 28 lines
Quoted 28 lines
Quoted 28 lines

index 026c4fc..43d6b92 100644

arch/arm/mach-omap2/mux.c +6 -0
@@ -486,6 +486,12 @@ MUX_CFG_34XX("H19_34XX_GPIO164_OUT", 0x19c,
          OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_OUTPUT)
 MUX_CFG_34XX("J25_34XX_GPIO170", 0x1c6,
          OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_INPUT)
+
+/* OMAP3 SDRC CKE signals to SDR/DDR ram chips */
+MUX_CFG_34XX("H16_34XX_SDRC_CKE0", 0x262,
+         OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_OUTPUT)
+MUX_CFG_34XX("H17_34XX_SDRC_CKE1", 0x264,
+         OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_OUTPUT)
 };
 
 #define OMAP34XX_PINS_SZ ARRAY_SIZE(omap34xx_pins)
(quoted diff) +0 -0

b/arch/arm/mach-omap2/sdrc.c index c832d83..b42f5ae 100644

arch/arm/mach-omap2/sdrc.c +1 -1
@@ -32,7 +32,7 @@
 #include <mach/sdrc.h>
 #include "sdrc.h"
 
-static struct omap_sdrc_params *sdrc_init_params;
+static struct omap_sdrc_params *sdrc_init_params_cs0,
 *sdrc_init_params_cs1;
 
Quoted 5 lines
Quoted 5 lines

arch/arm/mach-omap2/sdrc.c void omap2_sms_restore_context(void) · line 72

Quoted 5 lines
arch/arm/mach-omap2/sdrc.c +0 -0
 void __iomem *omap2_sdrc_base;

void __iomem *omap2_sms_base;

arch/arm/mach-omap2/sdrc.c +0 -0
@@ -71,33 +71,49 @@ void omap2_sms_restore_context(void)
 /**
  * omap2_sdrc_get_params - return SDRC register values

for a given

Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
arch/arm/mach-omap2/sdrc.c +2 -1
 clock rate * @r: SDRC clock rate (in Hz)
+ * @sdrc_cs0: chip select 0 ram timings **
+ * @sdrc_cs1: chip select 1 ram timings **
  *
  * Return pre-calculated values for the SDRC_ACTIM_CTRLA,
- * SDRC_ACTIM_CTRLB, SDRC_RFR_CTRL, and SDRC_MR registers, for a

given
- * SDRC clock rate 'r'. These parameters control various timing
- * delays in the SDRAM controller that are expressed in terms of the
- * number of SDRC clock cycles to wait; hence the clock rate
- * dependency. Note that sdrc_init_params must be sorted rate
- * descending. Also assumes that both chip-selects use the same
- * timing parameters. Returns a struct omap_sdrc_params * upon
- * success, or NULL upon failure.
+ * SDRC_ACTIM_CTRLB, SDRC_RFR_CTRL and SDRC_MR registers in
+ sdrc_cs[01]

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

+ * structs,for a given SDRC clock rate 'r'.
+ * These parameters control various timing delays in the SDRAM controller + * that are expressed in terms of the number of SDRC clock cycles to + * wait; hence the clock rate dependency.
+ *
+ * Supports 2 different timing parameters for both chip selects.
+ *
+ * Note 1: the sdrc_init_params_cs[01] must be sorted

rate descending.

Quoted 1 line
Quoted 1 line
Quoted 1 line

+ * Note 2: If sdrc_init_params_cs_1 is not NULL it must

be of same

Quoted 46 lines
Quoted 46 lines
Quoted 46 lines

+ size
+ * as sdrc_init_params_cs_0.
+ *
+ * Fills in the struct omap_sdrc_params * for each chip select.
+ * Returns 0 upon success or -1 upon failure.
*/

arch/arm/mach-omap2/sdrc.c +18 -10
-struct omap_sdrc_params *omap2_sdrc_get_params(unsigned long r)
+int omap2_sdrc_get_params(unsigned long r,
+                   struct omap_sdrc_params **sdrc_cs0,
+                   struct omap_sdrc_params **sdrc_cs1)
 {
- struct omap_sdrc_params *sp;
+ struct omap_sdrc_params *sp0, *sp1;
 
- if (!sdrc_init_params)
-         return NULL;
+ if (!sdrc_init_params_cs0)
+         return -1;
 
- sp = sdrc_init_params;
+ sp0 = sdrc_init_params_cs0;
+ sp1 = sdrc_init_params_cs1;
 
- while (sp->rate && sp->rate != r)
-         sp++;
+ while (sp0->rate && sp0->rate != r) {
+         sp0++;
+         if (sdrc_init_params_cs1)
+                 sp1++;
+ }
 
- if (!sp->rate)
-         return NULL;
+ if (!sp0->rate)
+         return -1;
 
- return sp;
+ *sdrc_cs0 = sp0;
+ *sdrc_cs1 = sp1;
+ return 0;
 }
@@ -109,13 +125,15 @@ void __init omap2_set_globals_sdrc(struct
 omap_globals *omap2_globals)
 
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
arch/arm/mach-omap2/sdrc.c +0 -1
 /**
  * omap2_sdrc_init - initialize SMS, SDRC devices on boot
- * @sp: pointer to a null-terminated list of struct

omap_sdrc_params
+ * @sdrc_cs[01]: pointers to a null-terminated list of struct omap_sdrc_params
+ * Support for 2 chip selects timings
*
* Turn on smart idle modes for SDRAM scheduler and controller.
* Program a known-good configuration for the SDRC to

deal with buggy

Quoted 34 lines
Quoted 34 lines
Quoted 34 lines

* bootloaders.
*/

arch/arm/mach-omap2/sdrc.c +2 -1
-void __init omap2_sdrc_init(struct omap_sdrc_params *sp)
+void __init omap2_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
+                     struct omap_sdrc_params *sdrc_cs1)
 {
  u32 l;
@@ -129,7 +147,8 @@ void __init omap2_sdrc_init(struct

omap_sdrc_params
*sp) l |= (0x2 << 3);
sdrc_write_reg(l, SDRC_SYSCONFIG);

- sdrc_init_params = sp;
+ sdrc_init_params_cs0 = sdrc_cs0;
+ sdrc_init_params_cs1 = sdrc_cs1;

/* XXX Enable SRFRONIDLEREQ here also? */
l = (1 << SDRC_POWER_EXTCLKDIS_SHIFT) | diff --git
a/arch/arm/mach-omap2/sram34xx.S b/arch/arm/mach-omap2/sram34xx.S index f41f8d9..3aef744 100644

arch/arm/mach-omap2/sram34xx.S +1 -1
@@ -36,7 +36,7 @@
 
  .text
 
-/* r4 parameters */
+/* r1 parameters */
 #define SDRC_NO_UNLOCK_DLL               0x0
 #define SDRC_UNLOCK_DLL                  0x1
 
@@ -71,40 +71,71 @@
 
Quoted 10 lines
Quoted 10 lines

arch/arm/mach-omap2/sram34xx.S

Quoted 10 lines
arch/arm/mach-omap2/sram34xx.S +3 -5
 /*
  * omap3_sram_configure_core_dpll - change DPLL3 M2 divider
- * r0 = new SDRC_RFR_CTRL register contents
- * r1 = new SDRC_ACTIM_CTRLA register contents
- * r2 = new SDRC_ACTIM_CTRLB register contents
- * r3 = new M2 divider setting (only 1 and 2 supported right now)
- * r4 = unlock SDRC DLL? (1 = yes, 0 = no).  Only unlock DLL for
+ *
+ * Params passed in registers:
+ *  r0 = new M2 divider setting (only 1 and 2 supported

right now)

Quoted 5 lines
Quoted 5 lines

arch/arm/mach-omap2/sram34xx.S

Quoted 5 lines
arch/arm/mach-omap2/sram34xx.S +2 -1
+ *  r1 = unlock SDRC DLL? (1 = yes, 0 = no).  Only unlock DLL for
  *      SDRC rates < 83MHz
- * r5 = number of MPU cycles to wait for SDRC to stabilize after
+ *  r2 = number of MPU cycles to wait for SDRC to stabilize after
  *      reprogramming the SDRC when switching to a

slower MPU speed

Quoted 7 lines
Quoted 7 lines

arch/arm/mach-omap2/sram34xx.S

Quoted 7 lines
arch/arm/mach-omap2/sram34xx.S +5 -2
- * r6 = new SDRC_MR_0 register value
- * r7 = increasing SDRC rate? (1 = yes, 0 = no)
+ *  r3 = increasing SDRC rate? (1 = yes, 0 = no)
+ *
+ * Params passed via the stack. The needed params will be copied
+ in SRAM
+ *  before use by the code in SRAM (SDRAM is not

accessible during

Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
arch/arm/mach-omap2/sram34xx.S +12 -0
+ SDRC
+ *  reconfiguration):
+ *  new SDRC_RFR_CTRL_0 register contents
+ *  new SDRC_ACTIM_CTRL_A_0 register contents
+ *  new SDRC_ACTIM_CTRL_B_0 register contents
+ *  new SDRC_MR_0 register value
+ *  new SDRC_RFR_CTRL_1 register contents
+ *  new SDRC_ACTIM_CTRL_A_1 register contents
+ *  new SDRC_ACTIM_CTRL_B_1 register contents
+ *  new SDRC_MR_1 register value
  *
+ * If the param SDRC_RFR_CTRL_1 is 0, the parameters
+ *  are not programmed into the SDRC CS1 registers
  */
Quoted 8 lines
Quoted 8 lines

arch/arm/mach-omap2/sram34xx.S

Quoted 8 lines
arch/arm/mach-omap2/sram34xx.S +2 -4
 ENTRY(omap3_sram_configure_core_dpll)
  stmfd   sp!, {r1-r12, lr}       @ store regs to stack
- ldr     r4, [sp, #52]           @ pull extra args off the stack
- ldr     r5, [sp, #56]           @ load extra args from the stack
- ldr     r6, [sp, #60]           @ load extra args from the stack
- ldr     r7, [sp, #64]           @ load extra args from the stack
+
+                                 @ pull the extra args

off the stack

Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
arch/arm/mach-omap2/sram34xx.S +13 -0
+                                 @  and store them in SRAM
+ ldr     r4, [sp, #52]
+ str     r4, omap_sdrc_rfr_ctrl_0_val
+ ldr     r4, [sp, #56]
+ str     r4, omap_sdrc_actim_ctrl_a_0_val
+ ldr     r4, [sp, #60]
+ str     r4, omap_sdrc_actim_ctrl_b_0_val
+ ldr     r4, [sp, #64]
+ str     r4, omap_sdrc_mr_0_val
+ ldr     r4, [sp, #68]
+ str     r4, omap_sdrc_rfr_ctrl_1_val
+ cmp     r4, #0                  @ if SDRC_RFR_CTRL_1 is 0,
+ beq     skip_cs1_params         @  do not use cs1 params
Quoted 8 lines
Quoted 8 lines

arch/arm/mach-omap2/sram34xx.S

Quoted 8 lines
arch/arm/mach-omap2/sram34xx.S +7 -0
+ ldr     r4, [sp, #72]
+ str     r4, omap_sdrc_actim_ctrl_a_1_val
+ ldr     r4, [sp, #76]
+ str     r4, omap_sdrc_actim_ctrl_b_1_val
+ ldr     r4, [sp, #80]
+ str     r4, omap_sdrc_mr_1_val
+skip_cs1_params:
  dsb                             @ flush buffered writes

to interconnect

Quoted 4 lines
Quoted 4 lines

arch/arm/mach-omap2/sram34xx.S

Quoted 4 lines
arch/arm/mach-omap2/sram34xx.S +2 -1
- cmp     r7, #1                  @ if increasing SDRC clk rate,
+
+ cmp     r3, #1                  @ if increasing SDRC clk rate,
  bleq    configure_sdrc          @ program the SDRC regs

early (for RFR)

Quoted 5 lines
Quoted 5 lines

arch/arm/mach-omap2/sram34xx.S

Quoted 5 lines
arch/arm/mach-omap2/sram34xx.S +1 -1
- cmp     r4, #SDRC_UNLOCK_DLL    @ set the intended DLL state
+ cmp     r1, #SDRC_UNLOCK_DLL    @ set the intended DLL state
  bleq    unlock_dll
  blne    lock_dll
  bl      sdram_in_selfrefresh    @ put SDRAM in self

refresh, idle SDRC

Quoted 9 lines
Quoted 9 lines

arch/arm/mach-omap2/sram34xx.S

Quoted 9 lines
arch/arm/mach-omap2/sram34xx.S +2 -2
  bl      configure_core_dpll     @ change the DPLL3 M2 divider
  bl      enable_sdrc             @ take SDRC out of idle
- cmp     r4, #SDRC_UNLOCK_DLL    @ wait for DLL status to change
+ cmp     r1, #SDRC_UNLOCK_DLL    @ wait for DLL status to change
  bleq    wait_dll_unlock
  blne    wait_dll_lock
- cmp     r7, #1                  @ if increasing SDRC clk rate,
+ cmp     r3, #1                  @ if increasing SDRC clk rate,
  beq     return_to_sdram         @ return to SDRAM code,

otherwise,

Quoted 6 lines
Quoted 6 lines

arch/arm/mach-omap2/sram34xx.S

Quoted 6 lines
arch/arm/mach-omap2/sram34xx.S +1 -1
  bl      configure_sdrc          @ reprogram SDRC regs now
- mov     r12, r5
+ mov     r12, r2
  bl      wait_clk_stable         @ wait for SDRC to stabilize
 return_to_sdram:
  isb                             @ prevent speculative

exec past here

Quoted 98 lines
Quoted 98 lines
Quoted 98 lines
arch/arm/mach-omap2/sram34xx.S +57 -12
@@ -149,7 +180,7 @@ configure_core_dpll:
  ldr     r12, [r11]
  ldr     r10, core_m2_mask_val   @ modify m2 for core dpll
  and     r12, r12, r10
- orr     r12, r12, r3, lsl #CORE_DPLL_CLKOUT_DIV_SHIFT
+ orr     r12, r12, r0, lsl #CORE_DPLL_CLKOUT_DIV_SHIFT
  str     r12, [r11]
  ldr     r12, [r11]              @ posted-write barrier for CM
  bx      lr
@@ -187,15 +218,34 @@ wait_dll_unlock:
  bne     wait_dll_unlock
  bx      lr
 configure_sdrc:
- ldr     r11, omap3_sdrc_rfr_ctrl
- str     r0, [r11]
- ldr     r11, omap3_sdrc_actim_ctrla
- str     r1, [r11]
- ldr     r11, omap3_sdrc_actim_ctrlb
- str     r2, [r11]
+ ldr     r12, omap_sdrc_rfr_ctrl_0_val   @ fetch value from SRAM
+ ldr     r11, omap3_sdrc_rfr_ctrl_0      @ fetch addr from SRAM
+ str     r12, [r11]                      @ store
+ ldr     r12, omap_sdrc_actim_ctrl_a_0_val
+ ldr     r11, omap3_sdrc_actim_ctrl_a_0
+ str     r12, [r11]
+ ldr     r12, omap_sdrc_actim_ctrl_b_0_val
+ ldr     r11, omap3_sdrc_actim_ctrl_b_0
+ str     r12, [r11]
+ ldr     r12, omap_sdrc_mr_0_val
  ldr     r11, omap3_sdrc_mr_0
- str     r6, [r11]
- ldr     r6, [r11]               @ posted-write barrier for SDRC
+ str     r12, [r11]
+ ldr     r12, omap_sdrc_rfr_ctrl_1_val
+ cmp     r12, #0                 @ if SDRC_RFR_CTRL_1 is 0,
+ beq     skip_cs1_prog           @  do not program cs1 params
+ ldr     r11, omap3_sdrc_rfr_ctrl_1
+ str     r12, [r11]
+ ldr     r12, omap_sdrc_actim_ctrl_a_1_val
+ ldr     r11, omap3_sdrc_actim_ctrl_a_1
+ str     r12, [r11]
+ ldr     r12, omap_sdrc_actim_ctrl_b_1_val
+ ldr     r11, omap3_sdrc_actim_ctrl_b_1
+ str     r12, [r11]
+ ldr     r12, omap_sdrc_mr_1_val
+ ldr     r11, omap3_sdrc_mr_1
+ str     r12, [r11]
+skip_cs1_prog:
+ ldr     r12, [r11]              @ posted-write barrier for SDRC
  bx      lr
 
 omap3_sdrc_power:
@@ -206,14 +256,40 @@ omap3_cm_idlest1_core:
  .word OMAP34XX_CM_REGADDR(CORE_MOD, CM_IDLEST)
 omap3_cm_iclken1_core:
  .word OMAP34XX_CM_REGADDR(CORE_MOD, CM_ICLKEN1)
-omap3_sdrc_rfr_ctrl:
+
+omap3_sdrc_rfr_ctrl_0:
  .word OMAP34XX_SDRC_REGADDR(SDRC_RFR_CTRL_0)
-omap3_sdrc_actim_ctrla:
+omap3_sdrc_rfr_ctrl_1:
+ .word OMAP34XX_SDRC_REGADDR(SDRC_RFR_CTRL_1)
+omap3_sdrc_actim_ctrl_a_0:
  .word OMAP34XX_SDRC_REGADDR(SDRC_ACTIM_CTRL_A_0)
-omap3_sdrc_actim_ctrlb:
+omap3_sdrc_actim_ctrl_a_1:
+ .word OMAP34XX_SDRC_REGADDR(SDRC_ACTIM_CTRL_A_1)
+omap3_sdrc_actim_ctrl_b_0:
  .word OMAP34XX_SDRC_REGADDR(SDRC_ACTIM_CTRL_B_0)
+omap3_sdrc_actim_ctrl_b_1:
+ .word OMAP34XX_SDRC_REGADDR(SDRC_ACTIM_CTRL_B_1)
 omap3_sdrc_mr_0:
  .word OMAP34XX_SDRC_REGADDR(SDRC_MR_0)
+omap3_sdrc_mr_1:
+ .word OMAP34XX_SDRC_REGADDR(SDRC_MR_1)
+omap_sdrc_rfr_ctrl_0_val:
+ .word 0xDEADBEEF
+omap_sdrc_rfr_ctrl_1_val:
+ .word 0xDEADBEEF
+omap_sdrc_actim_ctrl_a_0_val:
+ .word 0xDEADBEEF
+omap_sdrc_actim_ctrl_a_1_val:
+ .word 0xDEADBEEF
+omap_sdrc_actim_ctrl_b_0_val:
+ .word 0xDEADBEEF
+omap_sdrc_actim_ctrl_b_1_val:
+ .word 0xDEADBEEF
+omap_sdrc_mr_0_val:
+ .word 0xDEADBEEF
+omap_sdrc_mr_1_val:
+ .word 0xDEADBEEF
+
 omap3_sdrc_dlla_status:
  .word OMAP34XX_SDRC_REGADDR(SDRC_DLLA_STATUS)
 omap3_sdrc_dlla_ctrl:
@@ -223,3 +299,4 @@ core_m2_mask_val:
 
Quoted 9 lines
Quoted 9 lines

arch/arm/plat-omap/include/mach/io.h extern void

Quoted 9 lines
arch/arm/mach-omap2/sram34xx.S +1 -0
 ENTRY(omap3_sram_configure_core_dpll_sz)
  .word   . - omap3_sram_configure_core_dpll
+
arch/arm/plat-omap/include/mach/io.h +0 -0
index 54c159b..d4c78b4 100644
@@ -192,7 +192,8 @@ extern void

omap1_map_common_io(void); extern

Quoted 5 lines
Quoted 5 lines

arch/arm/plat-omap/include/mach/io.h extern void · line 196

Quoted 5 lines
arch/arm/plat-omap/include/mach/io.h +1 -0
 void omap1_init_common_hw(void);
 
 extern void omap2_map_common_io(void); -extern void
 omap2_init_common_hw(struct omap_sdrc_params *sp,
+extern void omap2_init_common_hw(struct omap_sdrc_params

*sdrc_cs0,

Quoted 39 lines
Quoted 39 lines
Quoted 39 lines
arch/arm/plat-omap/include/mach/io.h +1 -0
+                          struct omap_sdrc_params *sdrc_cs1,
                           struct omap_opp *mpu_opps,
                           struct omap_opp *dsp_opps,
                           struct omap_opp *l3_opps);
arch/arm/plat-omap/include/mach/mux.h +4 -0
index f7e298a..7368aba 100644
@@ -803,6 +803,10 @@ enum omap34xx_index {
  AE5_34XX_GPIO143,
  H19_34XX_GPIO164_OUT,
  J25_34XX_GPIO170,
+
+ /* OMAP3 SDRC CKE signals to SDR/DDR ram chips */
+ H16_34XX_SDRC_CKE0,
+ H17_34XX_SDRC_CKE1,
 };
 
 struct omap_mux_cfg {
arch/arm/plat-omap/include/mach/sdrc.h +0 -0
index a678bc8..7e22143 100644
@@ -114,9 +114,11 @@ struct omap_sdrc_params {
 
 void omap2_sms_save_context(void);  void

omap2_sms_restore_context(void); -void __init omap2_sdrc_init(struct omap_sdrc_params *); -struct omap_sdrc_params *omap2_sdrc_get_params(unsigned long r);

arch/arm/plat-omap/include/mach/sdrc.h +5 -1
-
+void __init omap2_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
+                     struct omap_sdrc_params *sdrc_cs1); int
+omap2_sdrc_get_params(unsigned long r,
+                   struct omap_sdrc_params **sdrc_cs0,
+                   struct omap_sdrc_params **sdrc_cs1);
 #ifdef CONFIG_ARCH_OMAP2
Quoted 11 lines
Quoted 11 lines

arch/arm/plat-omap/include/mach/sram.h extern void omap2_sram_reprogram_sdrc(u32 · line 24

Quoted 11 lines

struct memory_timings {

arch/arm/plat-omap/include/mach/sram.h +0 -0
index ad0a600..98906ea 100644
@@ -21,11 +21,13 @@ extern void omap2_sram_reprogram_sdrc(u32
 perf_level,
 u32 dll_val,
                                u32 mem_type);
 extern u32 omap2_set_prcm(u32 dpll_ctrl_val, u32

sdrc_rfr_val, int

Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
arch/arm/plat-omap/include/mach/sram.h +7 -5
 bypass);
 
-extern u32 omap3_configure_core_dpll(u32 sdrc_rfr_ctrl,
-                              u32 sdrc_actim_ctrla,
-                              u32 sdrc_actim_ctrlb, u32 m2,
-                              u32 unlock_dll, u32 f, u32 sdrc_mr,
-                              u32 inc);
+extern u32 omap3_configure_core_dpll(
+                 u32 m2, u32 unlock_dll, u32 f, u32 inc,
+                 u32 sdrc_rfr_ctrl_0, u32 sdrc_actim_ctrl_a_0,
+                 u32 sdrc_actim_ctrl_b_0, u32 sdrc_mr_0,
+                 u32 sdrc_rfr_ctrl_1, u32 sdrc_actim_ctrl_a_1,
+                 u32 sdrc_actim_ctrl_b_1, u32 sdrc_mr_1);
+

extern void omap3_sram_restore_context(void);

/* Do not use these */

arch/arm/plat-omap/include/mach/sram.h +0 -0
@@ -61,11 +63,12 @@ extern void omap243x_sram_reprogram_sdrc(u32

perf_level, u32 dll_val, extern unsigned long
omap243x_sram_reprogram_sdrc_sz;

Quoted 4 lines
Quoted 4 lines

arch/arm/plat-omap/include/mach/sram.h

Quoted 4 lines
arch/arm/plat-omap/include/mach/sram.h +0 -4
-extern u32 omap3_sram_configure_core_dpll(u32 sdrc_rfr_ctrl,
-                                   u32 sdrc_actim_ctrla,
-                                   u32 sdrc_actim_ctrlb, u32 m2,
-                                   u32 unlock_dll, u32

f, u32 sdrc_mr,

Quoted 11 lines
Quoted 11 lines

Review

Quoted 11 lines
arch/arm/plat-omap/include/mach/sram.h +6 -1
-                                   u32 inc);
+extern u32 omap3_sram_configure_core_dpll(
+                 u32 m2, u32 unlock_dll, u32 f, u32 inc,
+                 u32 sdrc_rfr_ctrl_0, u32 sdrc_actim_ctrl_a_0,
+                 u32 sdrc_actim_ctrl_b_0, u32 sdrc_mr_0,
+                 u32 sdrc_rfr_ctrl_1, u32 sdrc_actim_ctrl_a_1,
+                 u32 sdrc_actim_ctrl_b_1, u32 sdrc_mr_1);
 extern unsigned long omap3_sram_configure_core_dpll_sz;
 
 #ifdef CONFIG_PM
(quoted diff) +0 -0

b/arch/arm/plat-omap/sram.c

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

index a2e60e7..517f45b 100644

arch/arm/plat-omap/sram.c +0 -0
@@ -368,23 +368,29 @@ static inline int omap243x_sram_init(void)
 
Quoted 7 lines
Quoted 7 lines

arch/arm/plat-omap/sram.c static inline int omap243x_sram_init(void)

Quoted 7 lines
arch/arm/plat-omap/sram.c +0 -5
 #ifdef CONFIG_ARCH_OMAP3
 
-static u32 (*_omap3_sram_configure_core_dpll)(u32 sdrc_rfr_ctrl,
-                                       u32 sdrc_actim_ctrla,
-                                       u32 sdrc_actim_ctrlb,
-                                       u32 m2, u32 unlock_dll,
-                                       u32 f, u32

sdrc_mr, u32 inc);

Quoted 1 line
Quoted 1 line

arch/arm/plat-omap/sram.c static inline int omap243x_sram_init(void) · line 376

Quoted 1 line
arch/arm/plat-omap/sram.c +0 -1
-u32 omap3_configure_core_dpll(u32 sdrc_rfr_ctrl, u32

sdrc_actim_ctrla,

Quoted 1 line
Quoted 1 line

arch/arm/plat-omap/sram.c static inline int omap243x_sram_init(void) · line 377

Quoted 1 line
arch/arm/plat-omap/sram.c +0 -1
-                       u32 sdrc_actim_ctrlb, u32 m2, u32

unlock_dll,

Quoted 5 lines
Quoted 5 lines

arch/arm/plat-omap/sram.c static inline int omap243x_sram_init(void)

Quoted 5 lines
arch/arm/plat-omap/sram.c +3 -2
-                       u32 f, u32 sdrc_mr, u32 inc)
- {
+static u32 (*_omap3_sram_configure_core_dpll)(
+                         u32 m2, u32 unlock_dll, u32 f, u32 inc,
+                         u32 sdrc_rfr_ctrl_0, u32

sdrc_actim_ctrl_a_0,

Quoted 2 lines
Quoted 2 lines

arch/arm/plat-omap/sram.c static inline int omap243x_sram_init(void) · line 375

Quoted 2 lines
arch/arm/plat-omap/sram.c +2 -0
+                         u32 sdrc_actim_ctrl_b_0, u32 sdrc_mr_0,
+                         u32 sdrc_rfr_ctrl_1, u32

sdrc_actim_ctrl_a_1,

Quoted 3 lines
Quoted 3 lines

arch/arm/plat-omap/sram.c static inline int omap243x_sram_init(void)

Quoted 3 lines
arch/arm/plat-omap/sram.c +3 -0
+                         u32 sdrc_actim_ctrl_b_1, u32 sdrc_mr_1);
+
+u32 omap3_configure_core_dpll(u32 m2, u32 unlock_dll,

u32 f, u32 inc,

Quoted 1 line
Quoted 1 line

arch/arm/plat-omap/sram.c static inline int omap243x_sram_init(void) · line 379

Quoted 1 line
arch/arm/plat-omap/sram.c +1 -0
+                       u32 sdrc_rfr_ctrl_0, u32

sdrc_actim_ctrl_a_0,

Quoted 2 lines
Quoted 2 lines

arch/arm/plat-omap/sram.c static inline int omap243x_sram_init(void) · line 381

Quoted 2 lines
arch/arm/plat-omap/sram.c +2 -0
+                       u32 sdrc_actim_ctrl_b_0, u32 sdrc_mr_0,
+                       u32 sdrc_rfr_ctrl_1, u32

sdrc_actim_ctrl_a_1,

Quoted 8 lines
Quoted 8 lines

arch/arm/plat-omap/sram.c static inline int omap243x_sram_init(void)

Quoted 8 lines
arch/arm/plat-omap/sram.c +1 -4
+                       u32 sdrc_actim_ctrl_b_1, u32 sdrc_mr_1) {
  if (!_omap3_sram_configure_core_dpll)
          omap_sram_error();
 
- return _omap3_sram_configure_core_dpll(sdrc_rfr_ctrl,
-                                        sdrc_actim_ctrla,
-                                        sdrc_actim_ctrlb, m2,
-                                        unlock_dll, f,

sdrc_mr, inc);

Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
arch/arm/plat-omap/sram.c +6 -2
- }
+ return _omap3_sram_configure_core_dpll(
+                         m2, unlock_dll, f, inc,
+                         sdrc_rfr_ctrl_0, sdrc_actim_ctrl_a_0,
+                         sdrc_actim_ctrl_b_0, sdrc_mr_0,
+                         sdrc_rfr_ctrl_1, sdrc_actim_ctrl_a_1,
+                         sdrc_actim_ctrl_b_1, sdrc_mr_1); }
 
 #ifdef CONFIG_PM
 void omap3_sram_restore_context(void)
--

1.6.2.5.168.g3823

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines · On Friday 05 June 2009 20:10:40 Paul Walmsley wrote:
Quoted 4 lines

Hi Jean,

Quoted 1 line · Jean Pihet

Here is the new patch that includes all the remarks

and suggestion.

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

The description is here below.

Some notes:
- all calls to omap2_init_common_hw have been adapted in the board files. it looks like 2430SDP and Pandora board files are broken since they use only one param. Can that be

checked on those boards?

Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 3 lines

- it is assumed that RX51 only uses 1 CS. Is that correct?

Can you review it and possibly merge?

Looks great.

Tero, does RX51 use two SDRC chipselects!

Quoted 2 lines

Thanks & regards,
Jean

author
#20 lore raw

Re: [RFC][PATCH] OMAP3: add support for 2 SDRAM chip selects

Quoted 32 lines · On Tuesday 09 June 2009 10:14:58 [email protected] wrote:
Quoted 23 lines

-----Original Message-----
From: ext Kevin Hilman [mailto:[email protected]]
Sent: 08 June, 2009 20:24
To: Jean Pihet
Cc: Paul Walmsley; Kristo Tero (Nokia-D/Tampere); linux-omap
Subject: Re: [RFC][PATCH] OMAP3: add support for 2 SDRAM chip selects

Quoted 15 lines · Jean Pihet
Quoted 11 lines · On Monday 08 June 2009 16:59:36 Kevin Hilman wrote:
Quoted 6 lines · Jean Pihet

Paul,

Here is the updated patch that fixes the Overo build as well. Can you check it?

Kevin, can you push it if it is correct?

Can you run it through checkpatch, fix the errors and also merge Tero's
RX51 patch if it looks good to you.

Ok. I will check. The cause might be the mailer.

Quoted 8 lines
Quoted 1 line

I think we need the omap_cfg_reg calls in the RX51 board

file as well,

Quoted 2 lines

even if the bootloader has the mux setting already right. That way a warning will be issued in case of a faulty bootloader. Do you agree?

I agree.

Quoted 7 lines

Well, this is ok for me too as it does not really change anything. I will voice my opinion here though. :)

I find it somewhat weird that we take care of two pads in this fashion out of ~350 or so, where in most cases we just assume that the pads are configured properly by the boot loader. Should we do the same for every pad?

Got your point. This omap_cfg_reg throws a warning if the pad is incorrectly configured. The goal is to better track the problem in case of a wrong/older bootloader. In the ideal world the bootloader and kernel should match and do it all right!

Quoted 3 lines

Does the kernel even boot if the CKE signals are configured incorrectly? I would guess the boot loader will fail to load the kernel image into SDRAM in that case.

The kernel boots fine in that case, only the SDRAM contents are not preserved when going to low power mode.

Quoted 2 lines

-Tero

#21 lore raw

RE: [RFC][PATCH] OMAP3: add support for 2 SDRAM chip selects

Quoted 60 lines

-----Original Message-----
From: ext Jean Pihet [mailto:[email protected]]
Sent: 09 June, 2009 11:24
To: Kristo Tero (Nokia-D/Tampere)
Cc: [email protected]; [email protected]; [email protected]
Subject: Re: [RFC][PATCH] OMAP3: add support for 2 SDRAM chip selects

Quoted 6 lines · On Tuesday 09 June 2009 10:14:58 [email protected] wrote:
Quoted 6 lines

-----Original Message-----
From: ext Kevin Hilman [mailto:[email protected]]
Sent: 08 June, 2009 20:24
To: Jean Pihet
Cc: Paul Walmsley; Kristo Tero (Nokia-D/Tampere); linux-omap
Subject: Re: [RFC][PATCH] OMAP3: add support for 2 SDRAM

chip selects

Quoted 15 lines
Quoted 15 lines
Quoted 13 lines · Jean Pihet
Quoted 11 lines · On Monday 08 June 2009 16:59:36 Kevin Hilman wrote:
Quoted 6 lines · Jean Pihet

Paul,

Here is the updated patch that fixes the Overo build as well. Can you check it?

Kevin, can you push it if it is correct?

Can you run it through checkpatch, fix the errors and also merge Tero's
RX51 patch if it looks good to you.

Quoted 7 lines
Quoted 7 lines
Quoted 3 lines

Ok. I will check. The cause might be the mailer.

I think we need the omap_cfg_reg calls in the RX51 board

file as well,

Quoted 1 line

even if the bootloader has the mux setting already right.

That way

Quoted 1 line
Quoted 1 line
Quoted 1 line

a warning will be issued in case of a faulty bootloader.

Do you agree?

Quoted 7 lines
Quoted 2 lines

I agree.

Well, this is ok for me too as it does not really change anything. I will voice my opinion here though. :)

I find it somewhat weird that we take care of two pads in

this fashion

Quoted 2 lines

out of ~350 or so, where in most cases we just assume that the pads are configured properly by the boot loader. Should we do the

same for

Quoted 1 line

every pad?

Got your point. This omap_cfg_reg throws a warning if the pad is incorrectly configured. The goal is to better track the problem in case of a wrong/older bootloader. In the ideal world the bootloader and kernel should match and do it all right!

Quoted 5 lines
Quoted 3 lines

Does the kernel even boot if the CKE signals are configured incorrectly? I would guess the boot loader will fail to load the kernel image into SDRAM in that case.

The kernel boots fine in that case, only the SDRAM contents are not preserved when going to low power mode.

Ok, in this case it sounds ok to me also as it might generate hard to track bugs.

-Tero

maintainer
#22 lore raw

Re: [RFC][PATCH] OMAP3: add support for 2 SDRAM chip selects (was: Re: Beagleboard rev C memory timings & suspend/resume)

In reply to Jean Pihet

Hi Jean,

Quoted 28 lines · Jean Pihet

Here is the updated patch that fixes the Overo build as well. Can you check it?

arch/arm/mach-omap2/board-overo.c +4 -1
index 9eae608..50902d4 100644
@@ -45,6 +45,7 @@
 #include <mach/gpmc.h>
 #include <mach/hardware.h>
 #include <mach/nand.h>
+#include <mach/mux.h>
 #include <mach/usb.h>
 
 #include "sdram-micron-mt46h32m32lf-6.h"
@@ -355,7 +356,9 @@ static int __init overo_i2c_init(void)
 
 static void __init overo_init_irq(void)
 {
-	omap2_init_common_hw(mt46h32m32lf6_sdrc_params, NULL, NULL, NULL);
+	omap2_init_common_hw(mt46h32m32lf6_sdrc_params,
+			     mt46h32m32lf6_sdrc_params,
+			     NULL, NULL, NULL);
 	omap_init_irq();
 	omap_gpio_init();
 }

arch/arm/mach-omap2/board-overo.c static void __init overo_init(void) · line 403

Quoted 10 lines
arch/arm/mach-omap2/board-overo.c +4 -0
@@ -391,6 +394,10 @@ static void __init overo_init(void)
 	overo_init_smsc911x();
 	overo_ads7846_init();
 
+	/* Ensure SDRC pins are mux'd for self-refresh */
+	omap_cfg_reg(H16_34XX_SDRC_CKE0);
+	omap_cfg_reg(H17_34XX_SDRC_CKE1);
+
 	if ((gpio_request(OVERO_GPIO_W2W_NRESET,
 			  "OVERO_GPIO_W2W_NRESET") == 0) &&
 	    (gpio_direction_output(OVERO_GPIO_W2W_NRESET, 1) == 0)) {

These changes look fine to me based on a quick look. Haven't tried building it.

- Paul

maintainer
#23 lore raw

Re: [RFC][PATCH] OMAP3: add support for 2 SDRAM chip selects (was: Re: Beagleboard rev C memory timings & suspend/resume)

In reply to Jean Pihet

Hi Jean,

Quoted 4 lines · Jean Pihet

Some notes:
- all calls to omap2_init_common_hw have been adapted in the board files. it looks like 2430SDP and Pandora board files are broken since they use only one param. Can that be checked on those boards?

Yep, builds with those two boards are broken on the PM branch, and it looks like your patch fixes both.

Gražyvdas, looks like Pandora might use 2 SDRAM chipselects also?

- Paul

#24 lore raw

Re: [RFC][PATCH] OMAP3: add support for 2 SDRAM chip selects (was: Re: Beagleboard rev C memory timings & suspend/resume)

Quoted 9 lines · Paul Walmsley

Hi Jean,

Quoted 4 lines · Jean Pihet

Some notes:
- all calls to omap2_init_common_hw have been adapted in the board files. it looks like 2430SDP and Pandora board files are broken since they use only one param. Can that be checked on those boards?

Quoted 4 lines

Yep, builds with those two boards are broken on the PM branch, and it looks like your patch fixes both.

Gražyvdas, looks like Pandora might use 2 SDRAM chipselects also?

Yes it does, it uses different part than Beagle rev C (256/512 RAM/NAND instead of 256/256), but RAM portion should be identical I guess.

Gražvydas
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

author
#25 lore raw

Re: [RFC][PATCH] OMAP3: add support for 2 SDRAM chip selects (was: Re: Beagleboard rev C memory timings & suspend/resume)

Paul, Gražvydas,

Ok, thanks!

Here is a patch that addresses the Pandora's use of 2 SDRAM chip selects. It applies on top of 'OMAP3: add support for 2 SDRAM chip selects'.

Is that OK? It has been build tested only.

Regards,
Jean

From 297a0b09267fc1a0ae4428771ff54b73b27d5bbe Mon Sep 17 00:00:00 2001
From: Jean Pihet <[email protected]>
Date: Mon, 8 Jun 2009 10:49:53 +0200
Subject: OMAP3 Pandora: add support for 2 SDRAM chip selects

This allows the self refresh to work correctly on
Pandora.

---
 arch/arm/mach-omap2/board-omap3pandora.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
(quoted diff) +0 -0

b/arch/arm/mach-omap2/board-omap3pandora.c
index 05ab99e..ba015b4 100644

arch/arm/mach-omap2/board-omap3pandora.c +7 -1
@@ -44,6 +44,7 @@
 #include <mach/gpmc.h>
 #include <mach/hardware.h>
 #include <mach/nand.h>
+#include <mach/mux.h>
 #include <mach/usb.h>
 #include <mach/mcspi.h>
 
@@ -220,7 +221,8 @@ static int __init omap3pandora_i2c_init(void)
 
 static void __init omap3pandora_init_irq(void)
 {
-	omap2_init_common_hw(mt46h32m32lf6_sdrc_params, NULL,
+	omap2_init_common_hw(mt46h32m32lf6_sdrc_params,
+			     mt46h32m32lf6_sdrc_params,
 			     NULL, NULL, NULL);
 	omap_init_irq();
 	omap_gpio_init();
@@ -307,6 +309,10 @@ static void __init omap3pandora_init(void)
 	usb_ehci_init();
 	omap3pandora_flash_init();
 	omap3pandora_ads7846_init();
+
+	/* Ensure SDRC pins are mux'd for self-refresh */
+	omap_cfg_reg(H16_34XX_SDRC_CKE0);
+	omap_cfg_reg(H17_34XX_SDRC_CKE1);
 }
 
 static void __init omap3pandora_map_io(void)
Signature · 1 line
1.6.2.5.168.g3823
Quoted 12 lines · On Saturday 06 June 2009 12:50:42 Grazvydas Ignotas wrote:
Quoted 11 lines · Paul Walmsley

Hi Jean,

Quoted 4 lines · Jean Pihet

Some notes:
- all calls to omap2_init_common_hw have been adapted in the board files. it looks like 2430SDP and Pandora board files are broken since they use only one param. Can that be checked on those boards?

Yep, builds with those two boards are broken on the PM branch, and it looks like your patch fixes both.

Quoted 8 lines
Quoted 1 line

Gražyvdas, looks like Pandora might use 2 SDRAM chipselects also?

Yes it does, it uses different part than Beagle rev C (256/512 RAM/NAND instead of 256/256), but RAM portion should be identical I guess.

Gražvydas

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#26 lore raw

Re: [RFC][PATCH] OMAP3: add support for 2 SDRAM chip selects (was: Re: Beagleboard rev C memory timings & suspend/resume)

Quoted 8 lines · Jean Pihet

Paul, Gražvydas,

Ok, thanks!

Here is a patch that addresses the Pandora's use of 2 SDRAM chip selects. It applies on top of 'OMAP3: add support for 2 SDRAM chip selects'.

Is that OK? It has been build tested only.

thanks!

Quoted 31 lines

Regards,
Jean

From 297a0b09267fc1a0ae4428771ff54b73b27d5bbe Mon Sep 17 00:00:00 2001
From: Jean Pihet <[email protected]>
Date: Mon, 8 Jun 2009 10:49:53 +0200
Subject: OMAP3 Pandora: add support for 2 SDRAM chip selects

This allows the self refresh to work correctly on
Pandora.

---
 arch/arm/mach-omap2/board-omap3pandora.c |    8 +++++++-

 1 files changed, 7 insertions(+), 1 deletions(-)
arch/arm/mach-omap2/board-omap3pandora.c +1 -0
index 05ab99e..ba015b4 100644
@@ -44,6 +44,7 @@
  #include <mach/gpmc.h>
  #include <mach/hardware.h>
  #include <mach/nand.h>
+#include <mach/mux.h>
  #include <mach/usb.h>
  #include <mach/mcspi.h>
 

arch/arm/mach-omap2/board-omap3pandora.c static int __init omap3pandora_i2c_init(void) · line 226

Quoted 7 lines
arch/arm/mach-omap2/board-omap3pandora.c +2 -1
@@ -220,7 +221,8 @@ static int __init omap3pandora_i2c_init(void)
 
  static void __init omap3pandora_init_irq(void)
  {
-       omap2_init_common_hw(mt46h32m32lf6_sdrc_params, NULL,
+       omap2_init_common_hw(mt46h32m32lf6_sdrc_params,
+                            mt46h32m32lf6_sdrc_params,
                             NULL, NULL, NULL);

Hm, since pandora uses OMAP3530, maybe it should also have omap3_*_rate_table args passed? Could also be true for Overo, at least for omap3_mpu_rate_table and omap3_l3_rate_table, as some models use OMAP3503 without the DSP.

Quoted 17 lines
arch/arm/mach-omap2/board-omap3pandora.c +4 -1
        omap_init_irq();
        omap_gpio_init();
@@ -307,6 +309,10 @@ static void __init omap3pandora_init(void)
        usb_ehci_init();
        omap3pandora_flash_init();
        omap3pandora_ads7846_init();
+
+       /* Ensure SDRC pins are mux'd for self-refresh */
+       omap_cfg_reg(H16_34XX_SDRC_CKE0);
+       omap_cfg_reg(H17_34XX_SDRC_CKE1);
  }
 
  static void __init omap3pandora_map_io(void)
--

1.6.2.5.168.g3823

Quoted 24 lines
Quoted 20 lines · On Saturday 06 June 2009 12:50:42 Grazvydas Ignotas wrote:
Quoted 8 lines · Paul Walmsley

Hi Jean,

Quoted 4 lines · Jean Pihet

Some notes:
- all calls to omap2_init_common_hw have been adapted in the board files. it looks like 2430SDP and Pandora board files are broken since they use only one param. Can that be checked on those boards?

Quoted 4 lines

Yep, builds with those two boards are broken on the PM branch, and it looks like your patch fixes both.

Gražyvdas, looks like Pandora might use 2 SDRAM chipselects also?

Yes it does, it uses different part than Beagle rev C (256/512 RAM/NAND instead of 256/256), but RAM portion should be identical I guess.

Gražvydas

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

author
#27 lore raw

Re: [RFC][PATCH] OMAP3: add support for 2 SDRAM chip selects (was: Re: Beagleboard rev C memory timings & suspend/resume)

Hi Kevin,

Quoted 11 lines · On Monday 08 June 2009 13:01:18 Grazvydas Ignotas wrote:
Quoted 6 lines

 static void __init omap3pandora_init_irq(void)
 {
-       omap2_init_common_hw(mt46h32m32lf6_sdrc_params, NULL,
+       omap2_init_common_hw(mt46h32m32lf6_sdrc_params,
+                            mt46h32m32lf6_sdrc_params, NULL, NULL, NULL);

Hm, since pandora uses OMAP3530, maybe it should also have omap3_*_rate_table args passed? Could also be true for Overo, at least for omap3_mpu_rate_table and omap3_l3_rate_table, as some models use OMAP3503 without the DSP.

Which table rates shall we pass for Overo and Pandora? I will update the patch set with the needed ones.

Regards,
Jean
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#28 lore raw

Re: [RFC][PATCH] OMAP3: add support for 2 SDRAM chip selects

Quoted 10 lines · Jean Pihet

Hi Kevin,

Quoted 7 lines · On Monday 08 June 2009 13:01:18 Grazvydas Ignotas wrote:
Quoted 6 lines

 static void __init omap3pandora_init_irq(void)
 {
-       omap2_init_common_hw(mt46h32m32lf6_sdrc_params, NULL,
+       omap2_init_common_hw(mt46h32m32lf6_sdrc_params,
+                            mt46h32m32lf6_sdrc_params, NULL, NULL, NULL);

Quoted 8 lines
Quoted 4 lines

Hm, since pandora uses OMAP3530, maybe it should also have omap3_*_rate_table args passed? Could also be true for Overo, at least for omap3_mpu_rate_table and omap3_l3_rate_table, as some models use OMAP3503 without the DSP.

Which table rates shall we pass for Overo and Pandora? I will update the patch set with the needed ones.

Let's leave any rate table changes out of this series. That is an unrelated change.

The Pandora/Overo folks should do some testing with the current rate tables and DVFS/CPUfreq to see if they work for them.

Kevin
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

maintainer
#29 lore raw
In reply to Jean Pihet

Hello Jean,

one other suggestion. You mentioned that you had self-refresh working on another OMAP3430 board with two SDRAM chip-selects. You might consider dumping the SDRC registers from that board, and dumping the SDRC registers on Beagle rev C, and comparing. It could be that the bootloader on your other board is setting some important bit.

- Paul

author
#30 lore raw
Quoted 7 lines · On Thursday 07 May 2009 21:18:41 Paul Walmsley wrote:

Hello Jean,

one other suggestion. You mentioned that you had self-refresh working on another OMAP3430 board with two SDRAM chip-selects. You might consider dumping the SDRC registers from that board, and dumping the SDRC registers on Beagle rev C, and comparing. It could be that the bootloader on your other board is setting some important bit.

The comparison gives the following:
- the timings are slightly different but given that the parts are not the same I do not think it is a problem
- the fields FIXEDDELAY and MODEFIXEDDELAYINITLAT are set in SDRC_DLLA_CTRL, the register value is 0x2600000A. Does that affect the 166MHz operation?
- the field DEEPPD of SDRC_MCFG_p is set to 0. That setting could affect the suspend/resume
- the MUX scheme is different: ADDRMUXLEGACY is set to 0
- the field BANKALLOCATION of SDRC_MCFG_p is set to 0 instead of 2

I tried to change those fields on the Beagleboard but still suspending for more than 10sec corrupts the memory.

Quoted 1 line

- Paul

Regards,
Jean

maintainer
#31 lore raw
Quoted 8 lines · Jean Pihet
Quoted 7 lines · On Thursday 07 May 2009 21:18:41 Paul Walmsley wrote:

Hello Jean,

one other suggestion. You mentioned that you had self-refresh working on another OMAP3430 board with two SDRAM chip-selects. You might consider dumping the SDRC registers from that board, and dumping the SDRC registers on Beagle rev C, and comparing. It could be that the bootloader on your other board is setting some important bit.

Quoted 5 lines

The comparison gives the following:
- the timings are slightly different but given that the parts are not the same I do not think it is a problem
- the fields FIXEDDELAY and MODEFIXEDDELAYINITLAT are set in SDRC_DLLA_CTRL, the register value is 0x2600000A. Does that affect the 166MHz operation?

It shouldn't.

Quoted 2 lines

- the field DEEPPD of SDRC_MCFG_p is set to 0. That setting could affect the suspend/resume

I don't think this should matter, since we never power off the SDRAM.

Quoted 2 lines

- the MUX scheme is different: ADDRMUXLEGACY is set to 0
- the field BANKALLOCATION of SDRC_MCFG_p is set to 0 instead of 2

- Paul