[PATCH 1/3] qi-split-boards-smdk6410-gta03.patch

Andy Green andy at openmoko.com
Fri Oct 31 11:52:50 CET 2008


Signed-off-by: Andy Green <andy at openmoko.com>
---

 include/neo_smdk6410.h           |    6 ++
 include/smdk6410.h               |    6 ++
 src/cpu/s3c6410/gta03.c          |   15 ++----
 src/cpu/s3c6410/qi.lds           |    1 
 src/cpu/s3c6410/serial-s3c64xx.c |   23 +++------
 src/cpu/s3c6410/smdk6410.c       |   99 ++++++++++++++++++++++++++++++++++++++
 src/cpu/s3c6410/start_qi.c       |    2 +
 7 files changed, 127 insertions(+), 25 deletions(-)
 create mode 100644 include/neo_smdk6410.h
 create mode 100644 include/smdk6410.h
 create mode 100644 src/cpu/s3c6410/smdk6410.c

diff --git a/include/neo_smdk6410.h b/include/neo_smdk6410.h
new file mode 100644
index 0000000..a438170
--- /dev/null
+++ b/include/neo_smdk6410.h
@@ -0,0 +1,6 @@
+#ifndef __ASM_MODE__
+#include <qi.h>
+extern const struct board_api board_api_smdk6410;
+#endif
+
+#define TEXT_BASE_SMDK6410 0x53000000
diff --git a/include/smdk6410.h b/include/smdk6410.h
new file mode 100644
index 0000000..a438170
--- /dev/null
+++ b/include/smdk6410.h
@@ -0,0 +1,6 @@
+#ifndef __ASM_MODE__
+#include <qi.h>
+extern const struct board_api board_api_smdk6410;
+#endif
+
+#define TEXT_BASE_SMDK6410 0x53000000
diff --git a/src/cpu/s3c6410/gta03.c b/src/cpu/s3c6410/gta03.c
index e925740..6c63ca0 100644
--- a/src/cpu/s3c6410/gta03.c
+++ b/src/cpu/s3c6410/gta03.c
@@ -5,17 +5,13 @@
 //#include <i2c-bitbang-s3c24xx.h>
 #include <pcf50633.h>
 
-#define GTA03_DEBUG_UART 0
+#define GTA03_DEBUG_UART 3
 
 #define PCF50633_I2C_ADS 0x73
 
 
 static const struct board_variant board_variants[] = {
 	[0] = {
-		.name = "SMDK",
-		.machine_revision = 0,
-	},
-	[1] = {
 		.name = "GTA03 EVT1",
 		.machine_revision = 1
 	}
@@ -192,7 +188,7 @@ unsigned long s3c6410_mmc_bread(int dev_num, unsigned long blknr, unsigned long
  */
 const struct board_api board_api_gta03 = {
 	.name = "GTA03",
-	.linux_machine_id = 1626 /*1866*/,
+	.linux_machine_id = 1866,
 	.linux_mem_start = 0x50000000,
 	.linux_mem_size = (128 * 1024 * 1024),
 	.linux_tag_placement = 0x50000000 + 0x100,
@@ -208,8 +204,9 @@ const struct board_api board_api_gta03 = {
 			.partition_index = 2,
 			.filepath = "boot/uImage.bin",
 			.initramfs_filepath = "boot/initramfs.gz",
-			.commandline = "console=ttySAC0,115200 " \
-				       "loglevel=8 init=/bin/sh root=/dev/ram ramdisk_size=6000000"
+			.commandline = "console=ttySAC3,115200 " \
+				       "loglevel=8 init=/bin/sh " \
+				       "root=/dev/ram ramdisk_size=6000000"
 		},
 		[1] = {
 			.name = "SD Card backup rootfs",
@@ -218,7 +215,7 @@ const struct board_api board_api_gta03 = {
 			.partition_index = 3,
 			.filepath = "boot/uImage.bin",
 			.initramfs_filepath = "boot/initramfs.gz",
-			.commandline = "console=ttySAC0,115200 " \
+			.commandline = "console=ttySAC3,115200 " \
 				       "loglevel=8 init=/bin/sh "
 		},	},
 };
diff --git a/src/cpu/s3c6410/qi.lds b/src/cpu/s3c6410/qi.lds
index 7a89334..4bdddb8 100644
--- a/src/cpu/s3c6410/qi.lds
+++ b/src/cpu/s3c6410/qi.lds
@@ -46,6 +46,7 @@ SECTIONS
 	  src/cpu/s3c6410/start_qi.o		(.text .rodata* .data .bss)
 	  src/cpu/s3c6410/serial-s3c64xx.o	(.text .rodata* .data .bss)
 	  src/cpu/s3c6410/gta03.o		(.text .rodata* .data .bss)
+	  src/cpu/s3c6410/smdk6410.o		(.text .rodata* .data .bss)
 	  src/cpu/s3c6410/hs_mmc.o		(.text .rodata* .data .bss)
 	  src/utils.o				(.text .rodata* .data .bss)
 	  src/memory-test.o			(.text .rodata* .data .bss)
diff --git a/src/cpu/s3c6410/serial-s3c64xx.c b/src/cpu/s3c6410/serial-s3c64xx.c
index 7e5a2b3..256419b 100644
--- a/src/cpu/s3c6410/serial-s3c64xx.c
+++ b/src/cpu/s3c6410/serial-s3c64xx.c
@@ -1,6 +1,6 @@
 /*
  * (C) Copyright 2007 OpenMoko, Inc.
- * Author: xiangfu liu <xiangfu at openmoko.org>
+ * Author: Andy Green <andy at openmoko.com>
  *
  * Configuation settings for the FIC Neo GTA02 Linux GSM phone
  *
@@ -28,20 +28,11 @@
  */
 void serial_putc_s3c64xx(const int uart, const char c)
 {
-	switch(uart)
-	{
-	case 0:
-		while (!( UTRSTAT0_REG & 0x2 ))
-			;
-		UTXH0_REG = c;
-		break;
-	case 1:
-		while (!( UTRSTAT1_REG & 0x2))
-			;
-		UTXH1_REG = c;
-		break;
+	if (uart >= 4)
+		return;
 
-	default:
-		break;
-	}
+	while (!(__REG(0x7F005000 + UTRSTAT_OFFSET + (uart << 10)) & 0x2))
+		;
+
+	__REG(0x7F005000 + UTXH_OFFSET + (uart << 10)) = c;
 }
diff --git a/src/cpu/s3c6410/smdk6410.c b/src/cpu/s3c6410/smdk6410.c
new file mode 100644
index 0000000..5085fd4
--- /dev/null
+++ b/src/cpu/s3c6410/smdk6410.c
@@ -0,0 +1,99 @@
+#include <qi.h>
+#include <neo_smdk6410.h>
+#include <serial-s3c64xx.h>
+
+#define SMDK6410_DEBUG_UART 0
+
+
+static const struct board_variant board_variants[] = {
+	[0] = {
+		.name = "SMDK",
+		.machine_revision = 0,
+	},
+};
+
+void port_init_smdk6410(void)
+{
+
+}
+
+/**
+ * returns PCB revision information in b0, d8, d9
+ * SMDK6410 EVB returns 0x000
+ * SMDK6410 returns 0x001
+ */
+
+int smdk6410_get_pcb_revision(void)
+{
+	return 0;
+}
+
+const struct board_variant const * get_board_variant_smdk6410(void)
+{
+	return &board_variants[smdk6410_get_pcb_revision()];
+}
+
+int is_this_board_smdk6410(void)
+{
+	/* FIXME: find something smdk6410 specific */
+	return 1;
+}
+
+static  __attribute__ (( section (".steppingstone") )) void putc_smdk6410(char c)
+{
+	serial_putc_s3c64xx(SMDK6410_DEBUG_UART, c);
+}
+
+int sd_card_init_smdk6410(void)
+{
+	extern int s3c6410_mmc_init(int verbose);
+
+	return s3c6410_mmc_init(1);
+}
+
+int sd_card_block_read_smdk6410(unsigned char * buf, unsigned long start512,
+							       int blocks512)
+{
+unsigned long s3c6410_mmc_bread(int dev_num, unsigned long blknr, unsigned long blkcnt,
+								     void *dst);
+
+	return s3c6410_mmc_bread(0, start512, blocks512, buf);
+}
+
+/*
+ * our API for bootloader on this machine
+ */
+const struct board_api board_api_smdk6410 = {
+	.name = "SMDK6410",
+	.linux_machine_id = 1626,
+	.linux_mem_start = 0x50000000,
+	.linux_mem_size = (128 * 1024 * 1024),
+	.linux_tag_placement = 0x50000000 + 0x100,
+	.get_board_variant = get_board_variant_smdk6410,
+	.is_this_board = is_this_board_smdk6410,
+	.port_init = port_init_smdk6410,
+	.putc = putc_smdk6410,
+	.kernel_source = {
+		[0] = {
+			.name = "SD Card rootfs",
+			.block_read = sd_card_block_read_smdk6410,
+			.filesystem = FS_EXT2,
+			.partition_index = 2,
+			.filepath = "boot/uImage.bin",
+			.initramfs_filepath = "boot/initramfs.gz",
+			.commandline = "console=ttySAC0,115200 " \
+				       "loglevel=8 init=/bin/sh " \
+				       " root=/dev/ram ramdisk_size=6000000"
+		},
+		[1] = {
+			.name = "SD Card backup rootfs",
+			.block_read = sd_card_block_read_smdk6410,
+			.filesystem = FS_EXT2,
+			.partition_index = 3,
+			.filepath = "boot/uImage.bin",
+			.initramfs_filepath = "boot/initramfs.gz",
+			.commandline = "console=ttySAC0,115200 " \
+				       "loglevel=8 init=/bin/sh "
+		},	},
+};
+
diff --git a/src/cpu/s3c6410/start_qi.c b/src/cpu/s3c6410/start_qi.c
index ac94b66..28d70ee 100644
--- a/src/cpu/s3c6410/start_qi.c
+++ b/src/cpu/s3c6410/start_qi.c
@@ -26,6 +26,7 @@
 
 #include <qi.h>
 #include <neo_gta03.h>
+#include <neo_smdk6410.h>
 
 #define stringify2(s) stringify1(s)
 #define stringify1(s) #s
@@ -33,6 +34,7 @@
 extern void bootloader_second_phase(void);
 
 const struct board_api *boards[] = {
+			&board_api_smdk6410,
 			&board_api_gta03,
 			NULL /* always last */
 };




More information about the openmoko-kernel mailing list