mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Alexey Galakhov <agalakhov@gmail.com>
To: barebox@lists.infradead.org
Cc: Alexey Galakhov <agalakhov@gmail.com>
Subject: [PATCHv4 5/7] S5P lowlevel clock init
Date: Fri, 18 May 2012 15:43:29 +0600	[thread overview]
Message-ID: <1337334211-12576-6-git-send-email-agalakhov@gmail.com> (raw)
In-Reply-To: <1337334211-12576-1-git-send-email-agalakhov@gmail.com>

Signed-off-by: Alexey Galakhov <agalakhov@gmail.com>
---
 arch/arm/mach-samsung/Makefile                   |    1 +
 arch/arm/mach-samsung/include/mach/s3c-generic.h |    4 ++
 arch/arm/mach-samsung/lowlevel-s5pcxx.c          |   61 ++++++++++++++++++++++
 3 files changed, 66 insertions(+)
 create mode 100644 arch/arm/mach-samsung/lowlevel-s5pcxx.c

diff --git a/arch/arm/mach-samsung/Makefile b/arch/arm/mach-samsung/Makefile
index 0b95e14..d7344c8 100644
--- a/arch/arm/mach-samsung/Makefile
+++ b/arch/arm/mach-samsung/Makefile
@@ -1,5 +1,6 @@
 obj-y += s3c-timer.o generic.o
 obj-lowlevel-$(CONFIG_ARCH_S3C24xx) += lowlevel-s3c24x0.o
+obj-lowlevel-$(CONFIG_ARCH_S5PCxx) += lowlevel-s5pcxx.o
 obj-$(CONFIG_ARCH_S3C24xx) += gpio-s3c24x0.o s3c24xx-clocks.o mem-s3c24x0.o
 obj-$(CONFIG_ARCH_S5PCxx) += gpio-s5pcxx.o clocks-s5pcxx.o
 obj-$(CONFIG_S3C_LOWLEVEL_INIT) += $(obj-lowlevel-y)
diff --git a/arch/arm/mach-samsung/include/mach/s3c-generic.h b/arch/arm/mach-samsung/include/mach/s3c-generic.h
index 9d40ef8..11b083d 100644
--- a/arch/arm/mach-samsung/include/mach/s3c-generic.h
+++ b/arch/arm/mach-samsung/include/mach/s3c-generic.h
@@ -37,3 +37,7 @@ unsigned s3c_get_uart_clk(unsigned src);
 uint32_t s3c24xx_get_memory_size(void);
 void s3c24xx_disable_second_sdram_bank(void);
 #endif
+
+#ifdef CONFIG_ARCH_S5PCxx
+void s5p_init_pll(void);
+#endif
diff --git a/arch/arm/mach-samsung/lowlevel-s5pcxx.c b/arch/arm/mach-samsung/lowlevel-s5pcxx.c
new file mode 100644
index 0000000..15afa47
--- /dev/null
+++ b/arch/arm/mach-samsung/lowlevel-s5pcxx.c
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2012 Alexey Galakhov
+ *
+ * Based on code from u-boot found somewhere on the web
+ * that seems to originate from Samsung
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <config.h>
+#include <common.h>
+#include <io.h>
+#include <init.h>
+#include <mach/s3c-iomap.h>
+#include <mach/s3c-clocks.h>
+#include <mach/s3c-generic.h>
+
+#ifdef CONFIG_S3C_PLL_INIT
+void  __bare_init s5p_init_pll(void)
+{
+    uint32_t reg;
+    int i;
+
+    /* Set Mux to FIN */
+    writel(0, S5P_CLK_SRC0);
+
+    writel(BOARD_APLL_LOCKTIME, S5P_xPLL_LOCK + S5P_APLL);
+
+    /* Disable PLL */
+    writel(0, S5P_xPLL_CON + S5P_APLL);
+    writel(0, S5P_xPLL_CON + S5P_MPLL);
+
+    /* Set up dividers */
+    reg = readl(S5P_CLK_DIV0);
+    reg &= ~(BOARD_CLK_DIV0_MASK);
+    reg |= (BOARD_CLK_DIV0_VAL);
+    writel(reg, S5P_CLK_DIV0);
+
+    /* Set up PLLs */
+    writel(BOARD_APLL_VAL, S5P_xPLL_CON + S5P_APLL);
+    writel(BOARD_MPLL_VAL, S5P_xPLL_CON + S5P_MPLL);
+    writel(BOARD_EPLL_VAL, S5P_xPLL_CON + S5P_EPLL);
+    writel(BOARD_VPLL_VAL, S5P_xPLL_CON + S5P_VPLL);
+
+    /* Wait for sync */
+    for (i = 0; i < 0x10000; ++i)
+        barrier();
+
+    reg = readl(S5P_CLK_SRC0);
+    reg |= 0x1111; /* switch MUX to PLL outputs */
+    writel(reg, S5P_CLK_SRC0);
+}
+#endif /* CONFIG_S3C_PLL_INIT */
-- 
1.7.10


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

  parent reply	other threads:[~2012-05-18  9:44 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-15 13:20 [PATCHv3 0/7] Cleaned up version of S5PV210 code Alexey Galakhov
2012-05-15 13:20 ` [PATCH 1/7] Make S3C24xx config options available for all S3Cs Alexey Galakhov
2012-05-15 13:20 ` [PATCH 2/7] Split S3C generic and S3C24xx specific code Alexey Galakhov
2012-05-17 17:52   ` Sascha Hauer
2012-05-17 18:33     ` Alexey Galakhov
2012-05-17 19:49       ` Juergen Beisert
2012-05-18  6:49         ` Alexey Galakhov
2012-05-18  8:38           ` Sascha Hauer
2012-05-18  9:06             ` Alexey Galakhov
2012-05-18  8:35       ` Sascha Hauer
2012-05-18  9:43     ` [PATCHv4 0/7] S5PV210 support (upd.) Alexey Galakhov
2012-05-18  9:43       ` [PATCH 1/7] Make S3C24xx config options available for all S3Cs Alexey Galakhov
2012-05-18  9:43       ` [PATCHv4 2/7] Split S3C generic and S3C24xx specific code Alexey Galakhov
2012-05-18  9:43       ` [PATCH 3/7] Add support for Samsung S5P architecture (S5PV210) Alexey Galakhov
2012-05-18  9:43       ` [PATCH 4/7] S5P boot header and image generator Alexey Galakhov
2012-05-18  9:43       ` Alexey Galakhov [this message]
2012-05-18  9:43       ` [PATCHv4 6/7] S5P DRAM support Alexey Galakhov
2012-05-21 20:02         ` Sascha Hauer
2012-05-22  9:17           ` Alexey Galakhov
2012-05-22 18:29             ` Sascha Hauer
2012-05-22 19:12               ` Alexey Galakhov
2012-05-18  9:43       ` [PATCHv4 7/7] Add FriendlyArm Tiny210 board (S5PV210) Alexey Galakhov
2012-05-21 20:00       ` [PATCHv4 0/7] S5PV210 support (upd.) Sascha Hauer
2012-05-22  9:18         ` Alexey Galakhov
2012-05-15 13:20 ` [PATCH 3/7] Add support for Samsung S5P architecture (S5PV210) Alexey Galakhov
2012-05-15 13:20 ` [PATCH 4/7] S5P boot header and image generator Alexey Galakhov
2012-05-15 13:20 ` [PATCH 5/7] S5P lowlevel clock init Alexey Galakhov
2012-05-15 13:20 ` [PATCH 6/7] S5P DRAM support Alexey Galakhov
2012-05-15 13:20 ` [PATCH 7/7] Add FriendlyArm Tiny210 board (S5PV210) Alexey Galakhov

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=1337334211-12576-6-git-send-email-agalakhov@gmail.com \
    --to=agalakhov@gmail.com \
    --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