aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/clock34xx.c
diff options
context:
space:
mode:
authorJean Pihet <jpihet@mvista.com>2009-07-24 21:43:25 -0400
committerpaul <paul@twilight.(none)>2009-07-24 21:43:25 -0400
commit58cda884ecc87dcce18d463b0c8bd928dae63ad8 (patch)
tree7bae55dfa93ba324c7478f5affa11ac66e2cab1a /arch/arm/mach-omap2/clock34xx.c
parent4be3bd7849165e7efa6b0b35a23d6a3598d97465 (diff)
OMAP3 SDRC: add support for 2 SDRAM chip selects
Some OMAP3 boards (Beagle Cx, Overo, RX51, Pandora) have 2 SDRAM parts connected to the SDRC. This patch adds the following: - 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 - add the SDRC 2nd CS registers offsets defines - 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). Signed-off-by: Jean Pihet <jpihet@mvista.com> Signed-off-by: Paul Walmsley <paul@pwsan.com>
Diffstat (limited to 'arch/arm/mach-omap2/clock34xx.c')
-rw-r--r--arch/arm/mach-omap2/clock34xx.c37
1 files changed, 28 insertions, 9 deletions
diff --git a/arch/arm/mach-omap2/clock34xx.c b/arch/arm/mach-omap2/clock34xx.c
index 045da923e75b..1c6480d3ad62 100644
--- a/arch/arm/mach-omap2/clock34xx.c
+++ b/arch/arm/mach-omap2/clock34xx.c
@@ -725,7 +725,9 @@ static int omap3_core_dpll_m2_set_rate(struct clk *clk, unsigned long rate)
725 u32 unlock_dll = 0; 725 u32 unlock_dll = 0;
726 u32 c; 726 u32 c;
727 unsigned long validrate, sdrcrate, mpurate; 727 unsigned long validrate, sdrcrate, mpurate;
728 struct omap_sdrc_params *sp; 728 struct omap_sdrc_params *sdrc_cs0;
729 struct omap_sdrc_params *sdrc_cs1;
730 int ret;
729 731
730 if (!clk || !rate) 732 if (!clk || !rate)
731 return -EINVAL; 733 return -EINVAL;
@@ -743,8 +745,8 @@ static int omap3_core_dpll_m2_set_rate(struct clk *clk, unsigned long rate)
743 else 745 else
744 sdrcrate >>= ((clk->rate / rate) >> 1); 746 sdrcrate >>= ((clk->rate / rate) >> 1);
745 747
746 sp = omap2_sdrc_get_params(sdrcrate); 748 ret = omap2_sdrc_get_params(sdrcrate, &sdrc_cs0, &sdrc_cs1);
747 if (!sp) 749 if (ret)
748 return -EINVAL; 750 return -EINVAL;
749 751
750 if (sdrcrate < MIN_SDRC_DLL_LOCK_FREQ) { 752 if (sdrcrate < MIN_SDRC_DLL_LOCK_FREQ) {
@@ -765,12 +767,29 @@ static int omap3_core_dpll_m2_set_rate(struct clk *clk, unsigned long rate)
765 767
766 pr_debug("clock: changing CORE DPLL rate from %lu to %lu\n", clk->rate, 768 pr_debug("clock: changing CORE DPLL rate from %lu to %lu\n", clk->rate,
767 validrate); 769 validrate);
768 pr_debug("clock: SDRC timing params used: %08x %08x %08x\n", 770 pr_debug("clock: SDRC CS0 timing params used:"
769 sp->rfr_ctrl, sp->actim_ctrla, sp->actim_ctrlb); 771 " RFR %08x CTRLA %08x CTRLB %08x MR %08x\n",
770 772 sdrc_cs0->rfr_ctrl, sdrc_cs0->actim_ctrla,
771 omap3_configure_core_dpll(sp->rfr_ctrl, sp->actim_ctrla, 773 sdrc_cs0->actim_ctrlb, sdrc_cs0->mr);
772 sp->actim_ctrlb, new_div, unlock_dll, c, 774 if (sdrc_cs1)
773 sp->mr, rate > clk->rate); 775 pr_debug("clock: SDRC CS1 timing params used: "
776 " RFR %08x CTRLA %08x CTRLB %08x MR %08x\n",
777 sdrc_cs1->rfr_ctrl, sdrc_cs1->actim_ctrla,
778 sdrc_cs1->actim_ctrlb, sdrc_cs1->mr);
779
780 if (sdrc_cs1)
781 omap3_configure_core_dpll(
782 new_div, unlock_dll, c, rate > clk->rate,
783 sdrc_cs0->rfr_ctrl, sdrc_cs0->actim_ctrla,
784 sdrc_cs0->actim_ctrlb, sdrc_cs0->mr,
785 sdrc_cs1->rfr_ctrl, sdrc_cs1->actim_ctrla,
786 sdrc_cs1->actim_ctrlb, sdrc_cs1->mr);
787 else
788 omap3_configure_core_dpll(
789 new_div, unlock_dll, c, rate > clk->rate,
790 sdrc_cs0->rfr_ctrl, sdrc_cs0->actim_ctrla,
791 sdrc_cs0->actim_ctrlb, sdrc_cs0->mr,
792 0, 0, 0, 0);
774 793
775 return 0; 794 return 0;
776} 795}