Skip to contentSkip to conversation

Add support for MINI2440 (s3c2440). Documentation about the product can be found on: http://www.friendlyarm.net/products/mini2440

PATCH New Gabriel Huau 1 participant 1 message Apr 14, 2012

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add support for MINI2440 (s3c2440). Documentation about the product can be found on: http://www.friendlyarm.net/products/mini2440

---
 arch/arm/cpu/arm920t/cpu.c                  |   34 +++
 arch/arm/cpu/arm920t/start.S                |    4 +
 arch/arm/include/asm/arch-s3c24x0/s3c24x0.h |   51 +----
 board/friendlyarm/mini2440/Makefile         |   45 ++++
 board/friendlyarm/mini2440/lowlevel_init.S  |  197 ++++++++++++++++
 board/friendlyarm/mini2440/mini2440.c       |  279 +++++++++++++++++++++++
 boards.cfg                                  |    1 +
 drivers/i2c/s3c24x0_i2c.c                   |   11 +-
 drivers/mtd/nand/s3c2410_nand.c             |   82 +++++++
 include/configs/mini2440.h                  |  323 +++++++++++++++++++++++++++
 10 files changed, 973 insertions(+), 54 deletions(-)
 create mode 100644 board/friendlyarm/mini2440/Makefile
 create mode 100644 board/friendlyarm/mini2440/lowlevel_init.S
 create mode 100644 board/friendlyarm/mini2440/mini2440.c
 create mode 100644 include/configs/mini2440.h
arch/arm/cpu/arm920t/cpu.c +34 -0
index 34adb11..baf3d01 100644
@@ -32,9 +32,43 @@
 #include <common.h>
 #include <command.h>
 #include <asm/system.h>
+#include <asm/arch/s3c2440.h>
+
+/* FCLK = 405 MHz, HCLK = 101 MHz, PCLK = 50 MHz, UCLK = 48 MHz */
+#define CLKDIVN_VAL	7
+#define M_MDIV		0x7f
+#define M_PDIV		0x2
+#define M_SDIV		0x1
+
+#define U_M_MDIV	0x38
+#define U_M_PDIV	0x2
+#define U_M_SDIV	0x2
 
 static void cache_flush(void);
 
+int arch_cpu_init (void)
+{
+	struct s3c24x0_clock_power * const clk_power = s3c24x0_get_base_clock_power();
+	int i;
+
+	/* to reduce PLL lock time, adjust the LOCKTIME register */
+	clk_power->locktime = 0xFFFFFF;
+	clk_power->clkdivn = CLKDIVN_VAL;
+
+	/* configure UPLL */
+	clk_power->upllcon = ((U_M_MDIV << 12) + (U_M_PDIV << 4) + U_M_SDIV);
+	/* some delay between MPLL and UPLL */
+	for(i = 0; i < 100000; i++);
+
+	/* configure MPLL */
+	clk_power->mpllcon = ((M_MDIV << 12) + (M_PDIV << 4) + M_SDIV);
+
+	/* some delay between MPLL and UPLL */
+	for(i = 0; i < 500000; i++);
+
+	return 0;
+}
+
 int cleanup_before_linux (void)
 {
 	/*
arch/arm/cpu/arm920t/start.S +4 -0
index 8c5612c..1d75fb5 100644
@@ -165,6 +165,10 @@ copyex:
 	ldr	r1, =0x3ff
 	ldr	r0, =INTSUBMSK
 	str	r1, [r0]
+# else
+	ldr	r1, =0xffff
+	ldr	r0, =INTSUBMSK
+	str	r1, [r0]
 # endif
 
 	/* FCLK:HCLK:PCLK = 1:2:4 */
arch/arm/include/asm/arch-s3c24x0/s3c24x0.h +1 -50

63 lines not on this page · raw message

board/friendlyarm/mini2440/Makefile new file +45 -0

45 lines not on this page · raw message

board/friendlyarm/mini2440/lowlevel_init.S new file +197 -0

197 lines not on this page · raw message

board/friendlyarm/mini2440/mini2440.c new file +279 -0

279 lines not on this page · raw message

boards.cfg +1 -0
index 3cf75c3..93eeb3c 100644
@@ -61,6 +61,7 @@ mx1ads                       arm         arm920t     -                   -
 scb9328                      arm         arm920t     -                   -              imx
 cm4008                       arm         arm920t     -                   -              ks8695
 cm41xx                       arm         arm920t     -                   -              ks8695
+mini2440                     arm         arm920t     mini2440            friendlyarm    s3c24x0
 VCMA9                        arm         arm920t     vcma9               mpl            s3c24x0
 smdk2410                     arm         arm920t     -                   samsung        s3c24x0
 omap1510inn                  arm         arm925t     -                   ti
drivers/i2c/s3c24x0_i2c.c +7 -4
index ba6f39b..c7e4064 100644
@@ -55,14 +55,15 @@
 
 static int GetI2CSDA(void)
 {
-	struct s3c24x0_gpio *gpio = s3c24x0_get_base_gpio();
-
 #ifdef CONFIG_S3C2410
+	struct s3c24x0_gpio *gpio = s3c24x0_get_base_gpio();
 	return (readl(&gpio->gpedat) & 0x8000) >> 15;
 #endif
 #ifdef CONFIG_S3C2400
+	struct s3c24x0_gpio *gpio = s3c24x0_get_base_gpio();
 	return (readl(&gpio->pgdat) & 0x0020) >> 5;
 #endif
+	return 0;
 }
 
 #if 0
@@ -74,12 +75,12 @@ static void SetI2CSDA(int x)
 
 static void SetI2CSCL(int x)
 {
-	struct s3c24x0_gpio *gpio = s3c24x0_get_base_gpio();
-
 #ifdef CONFIG_S3C2410
+	struct s3c24x0_gpio *gpio = s3c24x0_get_base_gpio();
 	writel((readl(&gpio->gpedat) & ~0x4000) | (x & 1) << 14, &gpio->gpedat);
 #endif
 #ifdef CONFIG_S3C2400
+	struct s3c24x0_gpio *gpio = s3c24x0_get_base_gpio();
 	writel((readl(&gpio->pgdat) & ~0x0040) | (x & 1) << 6, &gpio->pgdat);
 #endif
 }
@@ -115,7 +116,9 @@ static void ReadWriteByte(void)
 void i2c_init(int speed, int slaveadd)
 {
 	struct s3c24x0_i2c *i2c = s3c24x0_get_base_i2c();
+#if defined(CONFIG_S3C2410) || defined(CONFIG_S3C2400)
 	struct s3c24x0_gpio *gpio = s3c24x0_get_base_gpio();
+#endif
 	ulong freq, pres = 16, div;
 	int i;
 
drivers/mtd/nand/s3c2410_nand.c +82 -0

138 lines not on this page · raw message

include/configs/mini2440.h new file +323 -0

323 lines not on this page · raw message

Signature · 4 lines
1.7.9.1


--17pEHd4RhPHOinZp--