diff --git a/qiboot/include/qi.h b/qiboot/include/qi.h index 1ddf9cb..1ecf31f 100644 --- a/qiboot/include/qi.h +++ b/qiboot/include/qi.h @@ -74,6 +74,7 @@ struct board_api { unsigned long linux_tag_placement; const struct board_variant const * (*get_board_variant)(void); int (*is_this_board)(void); + void (*early_port_init)(void); void (*port_init)(void); void (*putc)(char); void (*close)(void); diff --git a/qiboot/include/s3c6410.h b/qiboot/include/s3c6410.h index 960c493..7314fc2 100644 --- a/qiboot/include/s3c6410.h +++ b/qiboot/include/s3c6410.h @@ -96,8 +96,6 @@ extern ulong virt_to_phy_smdk2416(ulong addr); extern void test_hsmmc (uint width, uint test, uint start_blk, uint blknum); -/* external variables */ -extern struct movi_offset_t ofsinfo; //#include @@ -107,7 +105,7 @@ typedef enum { S3C64XX_UART2, } S3C64XX_UARTS_NR; -#define __REG(x) (*((unsigned int *)(x))) +#define __REG(x) (*((volatile unsigned int *)(x))) //#include #endif diff --git a/qiboot/src/cpu/s3c6410/gta03-steppingstone.c b/qiboot/src/cpu/s3c6410/gta03-steppingstone.c new file mode 100644 index 0000000..be5d37b --- /dev/null +++ b/qiboot/src/cpu/s3c6410/gta03-steppingstone.c @@ -0,0 +1,76 @@ +#include +#include +#include +#include + +#define GTA03_DEBUG_UART 3 + +/* out of steppingstone */ +extern const struct board_variant const * get_board_variant_gta03(void); +extern void port_init_gta03(void); + + +int is_this_board_gta03(void) +{ + /* FIXME: find something gta03 specific */ + return 1; +} + +static void putc_gta03(char c) +{ + serial_putc_s3c64xx(GTA03_DEBUG_UART, c); +} + +int sd_card_init_gta03(void) +{ + extern int s3c6410_mmc_init(int verbose); + + return s3c6410_mmc_init(1); +} + +int sd_card_block_read_gta03(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_gta03 = { + .name = "GTA03", + .linux_machine_id = 1866, + .linux_mem_start = 0x50000000, + .linux_mem_size = (128 * 1024 * 1024), + .linux_tag_placement = 0x50000000 + 0x100, + .get_board_variant = get_board_variant_gta03, + .is_this_board = is_this_board_gta03, + .port_init = port_init_gta03, + .putc = putc_gta03, + .kernel_source = { + [0] = { + .name = "SD Card rootfs", + .block_read = sd_card_block_read_gta03, + .filesystem = FS_EXT2, + .partition_index = 2, + .filepath = "boot/uImage.bin", + .initramfs_filepath = "boot/initramfs.gz", + .commandline = "console=ttySAC3,115200 " \ + "loglevel=8 init=/bin/sh " \ + "root=/dev/ram ramdisk_size=6000000" + }, + [1] = { + .name = "SD Card backup rootfs", + .block_read = sd_card_block_read_gta03, + .filesystem = FS_EXT2, + .partition_index = 3, + .filepath = "boot/uImage.bin", + .initramfs_filepath = "boot/initramfs.gz", + .commandline = "console=ttySAC3,115200 " \ + "loglevel=8 init=/bin/sh " + }, }, +}; + diff --git a/qiboot/src/cpu/s3c6410/gta03.c b/qiboot/src/cpu/s3c6410/gta03.c index d2141ca..167746f 100644 --- a/qiboot/src/cpu/s3c6410/gta03.c +++ b/qiboot/src/cpu/s3c6410/gta03.c @@ -5,8 +5,6 @@ #include #include -#define GTA03_DEBUG_UART 3 - #define PCF50633_I2C_ADS 0x73 const struct pcf50633_init gta03_pcf50633_init[] = { @@ -795,67 +793,3 @@ const struct board_variant const * get_board_variant_gta03(void) return &board_variants[gta03_get_pcb_revision()]; } -int is_this_board_gta03(void) -{ - /* FIXME: find something gta03 specific */ - return 1; -} - -static __attribute__ (( section (".steppingstone") )) void putc_gta03(char c) -{ - serial_putc_s3c64xx(GTA03_DEBUG_UART, c); -} - -int sd_card_init_gta03(void) -{ - extern int s3c6410_mmc_init(int verbose); - - return s3c6410_mmc_init(1); -} - -int sd_card_block_read_gta03(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_gta03 = { - .name = "GTA03", - .linux_machine_id = 1866, - .linux_mem_start = 0x50000000, - .linux_mem_size = (128 * 1024 * 1024), - .linux_tag_placement = 0x50000000 + 0x100, - .get_board_variant = get_board_variant_gta03, - .is_this_board = is_this_board_gta03, - .port_init = port_init_gta03, - .putc = putc_gta03, - .kernel_source = { - [0] = { - .name = "SD Card rootfs", - .block_read = sd_card_block_read_gta03, - .filesystem = FS_EXT2, - .partition_index = 2, - .filepath = "boot/uImage.bin", - .initramfs_filepath = "boot/initramfs.gz", - .commandline = "console=ttySAC3,115200 " \ - "loglevel=8 init=/bin/sh " \ - "root=/dev/ram ramdisk_size=6000000" - }, - [1] = { - .name = "SD Card backup rootfs", - .block_read = sd_card_block_read_gta03, - .filesystem = FS_EXT2, - .partition_index = 3, - .filepath = "boot/uImage.bin", - .initramfs_filepath = "boot/initramfs.gz", - .commandline = "console=ttySAC3,115200 " \ - "loglevel=8 init=/bin/sh " - }, }, -}; - diff --git a/qiboot/src/cpu/s3c6410/qi.lds b/qiboot/src/cpu/s3c6410/qi.lds index 4bdddb8..41defed 100644 --- a/qiboot/src/cpu/s3c6410/qi.lds +++ b/qiboot/src/cpu/s3c6410/qi.lds @@ -45,12 +45,12 @@ SECTIONS src/cpu/s3c6410/start.o (.text .rodata* .data .bss) 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/gta03-steppingstone.o (.text .rodata* .data .bss) + src/cpu/s3c6410/smdk6410-steppingstone.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) - src/ctype.o (.text .rodata* .data .bss) +/* src/ctype.o (.text .rodata* .data .bss) */ * (.steppingstone) } diff --git a/qiboot/src/cpu/s3c6410/smdk6410-steppingstone.c b/qiboot/src/cpu/s3c6410/smdk6410-steppingstone.c new file mode 100644 index 0000000..02b22e6 --- /dev/null +++ b/qiboot/src/cpu/s3c6410/smdk6410-steppingstone.c @@ -0,0 +1,71 @@ +#include +#include +#include + +#define SMDK6410_DEBUG_UART 0 + +extern const struct board_variant const * get_board_variant_smdk6410(void); + +int is_this_board_smdk6410(void) +{ + /* FIXME: find something smdk6410 specific */ + return 1; +} + +static 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 = 1866 /* 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, + .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/qiboot/src/cpu/s3c6410/smdk6410.c b/qiboot/src/cpu/s3c6410/smdk6410.c index 5085fd4..63dc3b6 100644 --- a/qiboot/src/cpu/s3c6410/smdk6410.c +++ b/qiboot/src/cpu/s3c6410/smdk6410.c @@ -2,9 +2,6 @@ #include #include -#define SMDK6410_DEBUG_UART 0 - - static const struct board_variant board_variants[] = { [0] = { .name = "SMDK", @@ -12,11 +9,6 @@ static const struct board_variant board_variants[] = { }, }; -void port_init_smdk6410(void) -{ - -} - /** * returns PCB revision information in b0, d8, d9 * SMDK6410 EVB returns 0x000 @@ -33,67 +25,3 @@ 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/qiboot/src/cpu/s3c6410/start.S b/qiboot/src/cpu/s3c6410/start.S index 3d63fc7..ad2ef6c 100644 --- a/qiboot/src/cpu/s3c6410/start.S +++ b/qiboot/src/cpu/s3c6410/start.S @@ -421,6 +421,8 @@ start_code: ldr r1, =0x1FFF str r1, [r0, #UDIVSLOT_OFFSET] + ldr r1, =0x55 + str r1, [r0, #UTXH_OFFSET] @'U' /* >> CFG_VIDEO_LOGO_MAX_SIZE */ #define CFG_GBL_DATA_SIZE 128 /* size in bytes reserved for initial data */ diff --git a/qiboot/src/cpu/s3c6410/start_qi.c b/qiboot/src/cpu/s3c6410/start_qi.c index 28d70ee..b5b7cb9 100644 --- a/qiboot/src/cpu/s3c6410/start_qi.c +++ b/qiboot/src/cpu/s3c6410/start_qi.c @@ -80,7 +80,9 @@ void start_qi(void) /* okay, do the critical port and serial init for our board */ - this_board->port_init(); + if (this_board->early_port_init) + this_board->early_port_init(); + set_putc_func(this_board->putc); /* stick some hello messages on debug console */ @@ -90,13 +92,7 @@ void start_qi(void) stringify2(BUILD_VERSION)" " "\n"); - puts(stringify2(BUILD_DATE) " Copyright (C) 2008 Openmoko, Inc.\n"); - puts("\n Detected: "); - - puts(this_board->name); - puts(", "); - puts((this_board->get_board_variant)()->name); - puts("\n"); + puts(stringify2(BUILD_DATE) " Copyright (C) 2008 Openmoko, Inc.\n\n"); if (!is_jtag) { /* @@ -122,6 +118,16 @@ void start_qi(void) 256 * 2, (u8 *)0x53000000); } + /* all of Qi is in memory now, stuff outside steppingstone too */ + + if (this_board->port_init) + this_board->port_init(); + + puts("\n Detected: "); + puts(this_board->name); + puts(", "); + puts((this_board->get_board_variant)()->name); + puts("\n"); /* * jump to bootloader_second_phase() running from DRAM copy