mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 16/22] ARM: am33xx: make DDR PLL frequency configurable
Date: Mon, 26 Aug 2013 08:55:57 +0200	[thread overview]
Message-ID: <1377500163-28962-17-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1377500163-28962-1-git-send-email-s.hauer@pengutronix.de>

Needed for 400MHz DDR3.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/boards/beaglebone/lowlevel.c          |  2 +-
 arch/arm/boards/pcm051/lowlevel.c              |  2 +-
 arch/arm/mach-omap/am33xx_clock.c              | 10 +++++-----
 arch/arm/mach-omap/include/mach/am33xx-clock.h |  6 ++++--
 4 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/arch/arm/boards/beaglebone/lowlevel.c b/arch/arm/boards/beaglebone/lowlevel.c
index febe714..0a32d3b 100644
--- a/arch/arm/boards/beaglebone/lowlevel.c
+++ b/arch/arm/boards/beaglebone/lowlevel.c
@@ -89,7 +89,7 @@ static int beaglebone_board_init(void)
 	if (running_in_sdram())
 		return 0;
 
-	pll_init(MPUPLL_M_500, 24);
+	pll_init(MPUPLL_M_500, 24, DDRPLL_M_266);
 
 	am335x_sdram_init(0x18B, &ddr2_cmd_ctrl, &ddr2_regs, &ddr2_data);
 
diff --git a/arch/arm/boards/pcm051/lowlevel.c b/arch/arm/boards/pcm051/lowlevel.c
index 6ad170f..793d154 100644
--- a/arch/arm/boards/pcm051/lowlevel.c
+++ b/arch/arm/boards/pcm051/lowlevel.c
@@ -67,7 +67,7 @@ static int pcm051_board_init(void)
 	if (running_in_sdram())
 		return 0;
 
-	pll_init(MPUPLL_M_600, 25);
+	pll_init(MPUPLL_M_600, 25, DDRPLL_M_266);
 
 	am335x_sdram_init(0x18B, &MT41J256M8HX15E_2x256M8_cmd,
 			&MT41J256M8HX15E_2x256M8_regs,
diff --git a/arch/arm/mach-omap/am33xx_clock.c b/arch/arm/mach-omap/am33xx_clock.c
index c6cae42..692b0ec 100644
--- a/arch/arm/mach-omap/am33xx_clock.c
+++ b/arch/arm/mach-omap/am33xx_clock.c
@@ -248,7 +248,7 @@ static void per_pll_config(int osc)
 	while(__raw_readl(CM_IDLEST_DPLL_PER) != 0x1);
 }
 
-static void ddr_pll_config(int osc)
+static void ddr_pll_config(int osc, int ddrpll_M)
 {
 	u32 clkmode, clksel, div_m2;
 
@@ -263,7 +263,7 @@ static void ddr_pll_config(int osc)
 	while ((__raw_readl(CM_IDLEST_DPLL_DDR) & 0x00000100) != 0x00000100);
 
 	clksel = clksel & (~0x7ffff);
-	clksel = clksel | ((DDRPLL_M << 0x8) | (osc - 1));
+	clksel = clksel | ((ddrpll_M << 0x8) | (osc - 1));
 	__raw_writel(clksel, CM_CLKSEL_DPLL_DDR);
 
 	div_m2 = div_m2 & 0xFFFFFFE0;
@@ -288,18 +288,18 @@ void enable_ddr_clocks(void)
 		PRCM_L3_GCLK_ACTIVITY));
 	/* Poll if module is functional */
 	while ((__raw_readl(CM_PER_EMIF_CLKCTRL)) != PRCM_MOD_EN);
-
 }
 
 /*
  * Configure the PLL/PRCM for necessary peripherals
  */
-void pll_init(int mpupll_M, int osc)
+void pll_init(int mpupll_M, int osc, int ddrpll_M)
 {
 	mpu_pll_config(mpupll_M, osc);
 	core_pll_config(osc);
 	per_pll_config(osc);
-	ddr_pll_config(osc);
+	ddr_pll_config(osc, ddrpll_M);
+
 	/* Enable the required interconnect clocks */
 	interface_clocks_enable();
 	/* Enable power domain transition */
diff --git a/arch/arm/mach-omap/include/mach/am33xx-clock.h b/arch/arm/mach-omap/include/mach/am33xx-clock.h
index 6035da6..b3c7519 100644
--- a/arch/arm/mach-omap/include/mach/am33xx-clock.h
+++ b/arch/arm/mach-omap/include/mach/am33xx-clock.h
@@ -48,7 +48,9 @@
 
 /* DDR Freq is 266 MHZ for now*/
 /* Set Fdll = 400 MHZ , Fdll = M * 2 * CLKINP/ N + 1; clkout = Fdll /(2 * M2) */
-#define DDRPLL_M	266
+#define DDRPLL_M_266	266
+#define DDRPLL_M_400	400
+#define DDRPLL_N	(OSC - 1)
 #define DDRPLL_M2	1
 
 /* PRCM */
@@ -181,7 +183,7 @@
 
 #define CM_ALWON_GPMC_CLKCTRL           CM_PER_GPMC_CLKCTRL
 
-extern void pll_init(int mpupll_M, int osc);
+extern void pll_init(int mpupll_M, int osc, int ddrpll_M);
 extern void enable_ddr_clocks(void);
 
 #endif  /* endif _AM33XX_CLOCKS_H_ */
-- 
1.8.4.rc3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2013-08-26  6:56 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-26  6:55 [PATCH] am33xx beaglebone and related Sascha Hauer
2013-08-26  6:55 ` [PATCH 01/22] console: fix console without CONFIG_PARAMETER Sascha Hauer
2013-08-26  6:55 ` [PATCH 02/22] mci: omap: advertise 8 bit support Sascha Hauer
2013-08-26  6:55 ` [PATCH 03/22] mci: omap: implement device detect callback Sascha Hauer
2013-08-26  6:55 ` [PATCH 04/22] mci: omap: Allow to set mmc devname via platformdata Sascha Hauer
2013-08-26  6:55 ` [PATCH 05/22] ARM: omap: Allow to set mmc devname used for booting Sascha Hauer
2013-08-26  6:55 ` [PATCH 06/22] ARM: omap: fix omap_save_bootinfo Sascha Hauer
2013-08-26 12:00   ` Teresa Gamez
2013-08-26  6:55 ` [PATCH 07/22] ARM: omap: rename INIT_LL to omap_uart_lowlevel_init Sascha Hauer
2013-08-26  6:55 ` [PATCH 08/22] ARM: am33xx: Cleanup of lowlevel code Sascha Hauer
2013-08-26  6:55 ` [PATCH 09/22] ARM: pcm051: Clean up " Sascha Hauer
2013-08-26  6:55 ` [PATCH 10/22] ARM: beaglebone: " Sascha Hauer
2013-08-26  6:55 ` [PATCH 11/22] ARM: am33xx: set bootsource instance correctly for MMC1 Sascha Hauer
2013-08-26  6:55 ` [PATCH 12/22] ARM: cpuinfo: display the core name and version Sascha Hauer
2013-08-26  6:55 ` [PATCH 13/22] ARM: am33xx: implement cpu revision decoding Sascha Hauer
2013-08-26  6:55 ` [PATCH 14/22] ARM: am33xx: beaglebone: configure I2C EEPROM Sascha Hauer
2013-08-26  6:55 ` [PATCH 15/22] ARM: am33xx: Add mmc1 registration helper Sascha Hauer
2013-08-26  6:55 ` Sascha Hauer [this message]
2013-08-26  6:55 ` [PATCH 17/22] rework debug_ll Sascha Hauer
2013-08-26  6:55 ` [PATCH 18/22] ARM: beaglebone: Initialize UART for lowlevel debugging Sascha Hauer
2013-08-26  6:56 ` [PATCH 19/22] ARM: beaglebone: add support for beaglebone black with DDR3 RAM Sascha Hauer
2013-08-26  6:56 ` [PATCH 20/22] ARM: beaglebone: register sd/emmc with persistent name Sascha Hauer
2013-08-26  6:56 ` [PATCH 21/22] ARM: beaglebone: update mlo_small defconfig Sascha Hauer
2013-08-26  6:56 ` [PATCH 22/22] ARM: beaglebone: update defconfig Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1377500163-28962-17-git-send-email-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox