commit
7fc792895b
@ -0,0 +1,13 @@ |
||||
*.orig |
||||
*.a |
||||
*.o |
||||
*.depend |
||||
System.map |
||||
/u-boot |
||||
/u-boot.map |
||||
/u-boot.bin |
||||
/u-boot.srec |
||||
/LOG |
||||
/errlog |
||||
/reloc_off |
||||
|
@ -0,0 +1,144 @@ |
||||
/* |
||||
* (C) Copyright 2000 |
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
||||
* |
||||
* See file CREDITS for list of people who contributed to this |
||||
* project. |
||||
* |
||||
* 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. |
||||
* |
||||
* You should have received a copy of the GNU General Public License |
||||
* along with this program; if not, write to the Free Software |
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
||||
* MA 02111-1307 USA |
||||
*/ |
||||
|
||||
OUTPUT_ARCH(m68k) |
||||
SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); |
||||
/* Do we need any of these for elf? |
||||
__DYNAMIC = 0; */ |
||||
SECTIONS |
||||
{ |
||||
/* Read-only sections, merged into text segment: */ |
||||
. = + SIZEOF_HEADERS; |
||||
.interp : { *(.interp) } |
||||
.hash : { *(.hash) } |
||||
.dynsym : { *(.dynsym) } |
||||
.dynstr : { *(.dynstr) } |
||||
.rel.text : { *(.rel.text) } |
||||
.rela.text : { *(.rela.text) } |
||||
.rel.data : { *(.rel.data) } |
||||
.rela.data : { *(.rela.data) } |
||||
.rel.rodata : { *(.rel.rodata) } |
||||
.rela.rodata : { *(.rela.rodata) } |
||||
.rel.got : { *(.rel.got) } |
||||
.rela.got : { *(.rela.got) } |
||||
.rel.ctors : { *(.rel.ctors) } |
||||
.rela.ctors : { *(.rela.ctors) } |
||||
.rel.dtors : { *(.rel.dtors) } |
||||
.rela.dtors : { *(.rela.dtors) } |
||||
.rel.bss : { *(.rel.bss) } |
||||
.rela.bss : { *(.rela.bss) } |
||||
.rel.plt : { *(.rel.plt) } |
||||
.rela.plt : { *(.rela.plt) } |
||||
.init : { *(.init) } |
||||
.plt : { *(.plt) } |
||||
.text : |
||||
{ |
||||
/* WARNING - the following is hand-optimized to fit within */ |
||||
/* the sector layout of our flash chips! XXX FIXME XXX */ |
||||
|
||||
cpu/mcf5445x/start.o (.text) |
||||
lib_m68k/traps.o (.text) |
||||
lib_m68k/interrupts.o (.text) |
||||
common/dlmalloc.o (.text) |
||||
lib_generic/zlib.o (.text) |
||||
|
||||
. = DEFINED(env_offset) ? env_offset : .; |
||||
common/environment.o (.text) |
||||
|
||||
*(.text) |
||||
*(.fixup) |
||||
*(.got1) |
||||
} |
||||
_etext = .; |
||||
PROVIDE (etext = .); |
||||
.rodata : |
||||
{ |
||||
*(.rodata) |
||||
*(.rodata1) |
||||
} |
||||
.fini : { *(.fini) } =0 |
||||
.ctors : { *(.ctors) } |
||||
.dtors : { *(.dtors) } |
||||
|
||||
/* Read-write section, merged into data segment: */ |
||||
. = (. + 0x00FF) & 0xFFFFFF00; |
||||
_erotext = .; |
||||
PROVIDE (erotext = .); |
||||
|
||||
.reloc : |
||||
{ |
||||
__got_start = .; |
||||
*(.got) |
||||
__got_end = .; |
||||
_GOT2_TABLE_ = .; |
||||
*(.got2) |
||||
_FIXUP_TABLE_ = .; |
||||
*(.fixup) |
||||
} |
||||
__got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2; |
||||
__fixup_entries = (. - _FIXUP_TABLE_)>>2; |
||||
|
||||
.data : |
||||
{ |
||||
*(.data) |
||||
*(.data1) |
||||
*(.sdata) |
||||
*(.sdata2) |
||||
*(.dynamic) |
||||
CONSTRUCTORS |
||||
} |
||||
_edata = .; |
||||
PROVIDE (edata = .); |
||||
|
||||
. = .; |
||||
__u_boot_cmd_start = .; |
||||
.u_boot_cmd : { *(.u_boot_cmd) } |
||||
__u_boot_cmd_end = .; |
||||
|
||||
|
||||
. = .; |
||||
__start___ex_table = .; |
||||
__ex_table : { *(__ex_table) } |
||||
__stop___ex_table = .; |
||||
|
||||
. = ALIGN(256); |
||||
__init_begin = .; |
||||
.text.init : { *(.text.init) } |
||||
.data.init : { *(.data.init) } |
||||
. = ALIGN(256); |
||||
__init_end = .; |
||||
|
||||
__bss_start = .; |
||||
.bss : |
||||
{ |
||||
_sbss = .; |
||||
*(.sbss) *(.scommon) |
||||
*(.dynbss) |
||||
*(.bss) |
||||
*(COMMON) |
||||
. = ALIGN(4); |
||||
_ebss = .; |
||||
} |
||||
_end = . ; |
||||
PROVIDE (end = .); |
||||
} |
@ -0,0 +1,141 @@ |
||||
/* |
||||
* (C) Copyright 2000 |
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
||||
* |
||||
* See file CREDITS for list of people who contributed to this |
||||
* project. |
||||
* |
||||
* 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. |
||||
* |
||||
* You should have received a copy of the GNU General Public License |
||||
* along with this program; if not, write to the Free Software |
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
||||
* MA 02111-1307 USA |
||||
*/ |
||||
|
||||
OUTPUT_ARCH(m68k) |
||||
SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); |
||||
/* Do we need any of these for elf? |
||||
__DYNAMIC = 0; */ |
||||
SECTIONS |
||||
{ |
||||
/* Read-only sections, merged into text segment: */ |
||||
. = + SIZEOF_HEADERS; |
||||
.interp : { *(.interp) } |
||||
.hash : { *(.hash) } |
||||
.dynsym : { *(.dynsym) } |
||||
.dynstr : { *(.dynstr) } |
||||
.rel.text : { *(.rel.text) } |
||||
.rela.text : { *(.rela.text) } |
||||
.rel.data : { *(.rel.data) } |
||||
.rela.data : { *(.rela.data) } |
||||
.rel.rodata : { *(.rel.rodata) } |
||||
.rela.rodata : { *(.rela.rodata) } |
||||
.rel.got : { *(.rel.got) } |
||||
.rela.got : { *(.rela.got) } |
||||
.rel.ctors : { *(.rel.ctors) } |
||||
.rela.ctors : { *(.rela.ctors) } |
||||
.rel.dtors : { *(.rel.dtors) } |
||||
.rela.dtors : { *(.rela.dtors) } |
||||
.rel.bss : { *(.rel.bss) } |
||||
.rela.bss : { *(.rela.bss) } |
||||
.rel.plt : { *(.rel.plt) } |
||||
.rela.plt : { *(.rela.plt) } |
||||
.init : { *(.init) } |
||||
.plt : { *(.plt) } |
||||
.text : |
||||
{ |
||||
/* WARNING - the following is hand-optimized to fit within */ |
||||
/* the sector layout of our flash chips! XXX FIXME XXX */ |
||||
|
||||
cpu/mcf5445x/start.o (.text) |
||||
lib_m68k/traps.o (.text) |
||||
lib_m68k/interrupts.o (.text) |
||||
common/dlmalloc.o (.text) |
||||
lib_generic/zlib.o (.text) |
||||
|
||||
*(.text) |
||||
*(.fixup) |
||||
*(.got1) |
||||
} |
||||
_etext = .; |
||||
PROVIDE (etext = .); |
||||
.rodata : |
||||
{ |
||||
*(.rodata) |
||||
*(.rodata1) |
||||
} |
||||
.fini : { *(.fini) } =0 |
||||
.ctors : { *(.ctors) } |
||||
.dtors : { *(.dtors) } |
||||
|
||||
/* Read-write section, merged into data segment: */ |
||||
. = (. + 0x00FF) & 0xFFFFFF00; |
||||
_erotext = .; |
||||
PROVIDE (erotext = .); |
||||
|
||||
.reloc : |
||||
{ |
||||
__got_start = .; |
||||
*(.got) |
||||
__got_end = .; |
||||
_GOT2_TABLE_ = .; |
||||
*(.got2) |
||||
_FIXUP_TABLE_ = .; |
||||
*(.fixup) |
||||
} |
||||
__got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2; |
||||
__fixup_entries = (. - _FIXUP_TABLE_)>>2; |
||||
|
||||
.data : |
||||
{ |
||||
*(.data) |
||||
*(.data1) |
||||
*(.sdata) |
||||
*(.sdata2) |
||||
*(.dynamic) |
||||
CONSTRUCTORS |
||||
} |
||||
_edata = .; |
||||
PROVIDE (edata = .); |
||||
|
||||
. = .; |
||||
__u_boot_cmd_start = .; |
||||
.u_boot_cmd : { *(.u_boot_cmd) } |
||||
__u_boot_cmd_end = .; |
||||
|
||||
|
||||
. = .; |
||||
__start___ex_table = .; |
||||
__ex_table : { *(__ex_table) } |
||||
__stop___ex_table = .; |
||||
|
||||
. = ALIGN(256); |
||||
__init_begin = .; |
||||
.text.init : { *(.text.init) } |
||||
.data.init : { *(.data.init) } |
||||
. = ALIGN(256); |
||||
__init_end = .; |
||||
|
||||
__bss_start = .; |
||||
.bss : |
||||
{ |
||||
_sbss = .; |
||||
*(.sbss) *(.scommon) |
||||
*(.dynbss) |
||||
*(.bss) |
||||
*(COMMON) |
||||
. = ALIGN(4); |
||||
_ebss = .; |
||||
} |
||||
_end = . ; |
||||
PROVIDE (end = .); |
||||
} |
@ -1,3 +1,3 @@ |
||||
#TEXT_BASE = 0xa1700000
|
||||
TEXT_BASE = 0xa3000000
|
||||
TEXT_BASE = 0xa3080000
|
||||
#TEXT_BASE = 0
|
||||
|
@ -0,0 +1,155 @@ |
||||
/*
|
||||
* U-Boot command for OneNAND support |
||||
* |
||||
* Copyright (C) 2005-2007 Samsung Electronics |
||||
* Kyungmin Park <kyungmin.park@samsung.com> |
||||
* |
||||
* This program is free software; you can redistribute it and/or modify |
||||
* it under the terms of the GNU General Public License version 2 as |
||||
* published by the Free Software Foundation. |
||||
*/ |
||||
|
||||
#include <common.h> |
||||
#include <command.h> |
||||
|
||||
#ifdef CONFIG_CMD_ONENAND |
||||
|
||||
#include <linux/mtd/compat.h> |
||||
#include <linux/mtd/mtd.h> |
||||
#include <linux/mtd/onenand.h> |
||||
|
||||
#include <asm/io.h> |
||||
|
||||
extern struct mtd_info onenand_mtd; |
||||
extern struct onenand_chip onenand_chip; |
||||
|
||||
int do_onenand(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) |
||||
{ |
||||
int ret = 0; |
||||
|
||||
switch (argc) { |
||||
case 0: |
||||
case 1: |
||||
printf("Usage:\n%s\n", cmdtp->usage); |
||||
return 1; |
||||
|
||||
case 2: |
||||
if (strncmp(argv[1], "open", 4) == 0) { |
||||
onenand_init(); |
||||
return 0; |
||||
} |
||||
onenand_print_device_info(onenand_chip.device_id, 1); |
||||
return 0; |
||||
|
||||
default: |
||||
/* At least 4 args */ |
||||
if (strncmp(argv[1], "erase", 5) == 0) { |
||||
struct erase_info instr; |
||||
ulong start, end; |
||||
ulong block; |
||||
|
||||
start = simple_strtoul(argv[2], NULL, 10); |
||||
end = simple_strtoul(argv[3], NULL, 10); |
||||
start -= (unsigned long)onenand_chip.base; |
||||
end -= (unsigned long)onenand_chip.base; |
||||
|
||||
if (!end || end < 0) |
||||
end = start; |
||||
|
||||
printf("Erase block from %d to %d\n", start, end); |
||||
|
||||
for (block = start; block <= end; block++) { |
||||
instr.addr = block << onenand_chip.erase_shift; |
||||
instr.len = 1 << onenand_chip.erase_shift; |
||||
ret = onenand_erase(&onenand_mtd, &instr); |
||||
if (ret) { |
||||
printf("erase failed %d\n", block); |
||||
break; |
||||
} |
||||
} |
||||
|
||||
return 0; |
||||
} |
||||
|
||||
if (strncmp(argv[1], "read", 4) == 0) { |
||||
ulong addr = simple_strtoul(argv[2], NULL, 16); |
||||
ulong ofs = simple_strtoul(argv[3], NULL, 16); |
||||
size_t len = simple_strtoul(argv[4], NULL, 16); |
||||
size_t retlen = 0; |
||||
int oob = strncmp(argv[1], "read.oob", 8) ? 0 : 1; |
||||
|
||||
ofs -= (unsigned long)onenand_chip.base; |
||||
|
||||
if (oob) |
||||
onenand_read_oob(&onenand_mtd, ofs, len, |
||||
&retlen, (u_char *) addr); |
||||
else |
||||
onenand_read(&onenand_mtd, ofs, len, &retlen, |
||||
(u_char *) addr); |
||||
printf("Done\n"); |
||||
|
||||
return 0; |
||||
} |
||||
|
||||
if (strncmp(argv[1], "write", 5) == 0) { |
||||
ulong addr = simple_strtoul(argv[2], NULL, 16); |
||||
ulong ofs = simple_strtoul(argv[3], NULL, 16); |
||||
size_t len = simple_strtoul(argv[4], NULL, 16); |
||||
size_t retlen = 0; |
||||
|
||||
ofs -= (unsigned long)onenand_chip.base; |
||||
|
||||
onenand_write(&onenand_mtd, ofs, len, &retlen, |
||||
(u_char *) addr); |
||||
printf("Done\n"); |
||||
|
||||
return 0; |
||||
} |
||||
|
||||
if (strncmp(argv[1], "block", 5) == 0) { |
||||
ulong addr = simple_strtoul(argv[2], NULL, 16); |
||||
ulong block = simple_strtoul(argv[3], NULL, 10); |
||||
ulong page = simple_strtoul(argv[4], NULL, 10); |
||||
size_t len = simple_strtol(argv[5], NULL, 10); |
||||
size_t retlen = 0; |
||||
ulong ofs; |
||||
int oob = strncmp(argv[1], "block.oob", 9) ? 0 : 1; |
||||
|
||||
ofs = block << onenand_chip.erase_shift; |
||||
if (page) |
||||
ofs += page << onenand_chip.page_shift; |
||||
|
||||
if (!len) { |
||||
if (oob) |
||||
len = 64; |
||||
else |
||||
len = 512; |
||||
} |
||||
|
||||
if (oob) |
||||
onenand_read_oob(&onenand_mtd, ofs, len, |
||||
&retlen, (u_char *) addr); |
||||
else |
||||
onenand_read(&onenand_mtd, ofs, len, &retlen, |
||||
(u_char *) addr); |
||||
return 0; |
||||
} |
||||
|
||||
break; |
||||
} |
||||
|
||||
return 0; |
||||
} |
||||
|
||||
U_BOOT_CMD( |
||||
onenand, 6, 1, do_onenand, |
||||
"onenand - OneNAND sub-system\n", |
||||
"info - show available OneNAND devices\n" |
||||
"onenand read[.oob] addr ofs len - read data at ofs with len to addr\n" |
||||
"onenand write addr ofs len - write data at ofs with len from addr\n" |
||||
"onenand erase saddr eaddr - erase block start addr to end addr\n" |
||||
"onenand block[.oob] addr block [page] [len] - " |
||||
"read data with (block [, page]) to addr" |
||||
); |
||||
|
||||
#endif /* CONFIG_CMD_ONENAND */ |
@ -0,0 +1,134 @@ |
||||
/*
|
||||
* (C) Copyright 2005-2007 Samsung Electronics |
||||
* Kyungmin Park <kyungmin.park@samsung.com> |
||||
* |
||||
* See file CREDITS for list of people who contributed to this |
||||
* project. |
||||
* |
||||
* 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. |
||||
* |
||||
* You should have received a copy of the GNU General Public License |
||||
* along with this program; if not, write to the Free Software |
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
||||
* MA 02111-1307 USA |
||||
*/ |
||||
|
||||
#include <common.h> |
||||
|
||||
#if defined(CFG_ENV_IS_IN_ONENAND) /* Environment is in OneNAND */ |
||||
|
||||
#include <command.h> |
||||
#include <environment.h> |
||||
#include <linux/stddef.h> |
||||
#include <malloc.h> |
||||
|
||||
#include <linux/mtd/compat.h> |
||||
#include <linux/mtd/mtd.h> |
||||
#include <linux/mtd/onenand.h> |
||||
|
||||
extern struct mtd_info onenand_mtd; |
||||
extern struct onenand_chip onenand_chip; |
||||
|
||||
/* References to names in env_common.c */ |
||||
extern uchar default_environment[]; |
||||
|
||||
#define ONENAND_ENV_SIZE(mtd) (mtd.oobblock - ENV_HEADER_SIZE) |
||||
|
||||
char *env_name_spec = "OneNAND"; |
||||
|
||||
#ifdef ENV_IS_EMBEDDED |
||||
extern uchar environment[]; |
||||
env_t *env_ptr = (env_t *) (&environment[0]); |
||||
#else /* ! ENV_IS_EMBEDDED */ |
||||
static unsigned char onenand_env[MAX_ONENAND_PAGESIZE]; |
||||
env_t *env_ptr = (env_t *) onenand_env; |
||||
#endif /* ENV_IS_EMBEDDED */ |
||||
|
||||
uchar env_get_char_spec(int index) |
||||
{ |
||||
DECLARE_GLOBAL_DATA_PTR; |
||||
|
||||
return (*((uchar *) (gd->env_addr + index))); |
||||
} |
||||
|
||||
void env_relocate_spec(void) |
||||
{ |
||||
DECLARE_GLOBAL_DATA_PTR; |
||||
unsigned long env_addr; |
||||
int use_default = 0; |
||||
int retlen; |
||||
|
||||
env_addr = CFG_ENV_ADDR; |
||||
env_addr -= (unsigned long)onenand_chip.base; |
||||
|
||||
/* Check OneNAND exist */ |
||||
if (onenand_mtd.oobblock) |
||||
/* Ignore read fail */ |
||||
onenand_read(&onenand_mtd, env_addr, onenand_mtd.oobblock, |
||||
&retlen, (u_char *) env_ptr); |
||||
else |
||||
onenand_mtd.oobblock = MAX_ONENAND_PAGESIZE; |
||||
|
||||
if (crc32(0, env_ptr->data, ONENAND_ENV_SIZE(onenand_mtd)) != |
||||
env_ptr->crc) |
||||
use_default = 1; |
||||
|
||||
if (use_default) { |
||||
memcpy(env_ptr->data, default_environment, |
||||
ONENAND_ENV_SIZE(onenand_mtd)); |
||||
env_ptr->crc = |
||||
crc32(0, env_ptr->data, ONENAND_ENV_SIZE(onenand_mtd)); |
||||
} |
||||
|
||||
gd->env_addr = (ulong) & env_ptr->data; |
||||
gd->env_valid = 1; |
||||
} |
||||
|
||||
int saveenv(void) |
||||
{ |
||||
unsigned long env_addr = CFG_ENV_ADDR; |
||||
struct erase_info instr; |
||||
int retlen; |
||||
|
||||
instr.len = CFG_ENV_SIZE; |
||||
instr.addr = env_addr; |
||||
instr.addr -= (unsigned long)onenand_chip.base; |
||||
if (onenand_erase(&onenand_mtd, &instr)) { |
||||
printf("OneNAND: erase failed at 0x%08x\n", env_addr); |
||||
return 1; |
||||
} |
||||
|
||||
/* update crc */ |
||||
env_ptr->crc = |
||||
crc32(0, env_ptr->data, onenand_mtd.oobblock - ENV_HEADER_SIZE); |
||||
|
||||
env_addr -= (unsigned long)onenand_chip.base; |
||||
if (onenand_write(&onenand_mtd, env_addr, onenand_mtd.oobblock, &retlen, |
||||
(u_char *) env_ptr)) { |
||||
printf("OneNAND: write failed at 0x%08x\n", instr.addr); |
||||
return 2; |
||||
} |
||||
|
||||
return 0; |
||||
} |
||||
|
||||
int env_init(void) |
||||
{ |
||||
DECLARE_GLOBAL_DATA_PTR; |
||||
|
||||
/* use default */ |
||||
gd->env_addr = (ulong) & default_environment[0]; |
||||
gd->env_valid = 1; |
||||
|
||||
return 0; |
||||
} |
||||
|
||||
#endif /* CFG_ENV_IS_IN_ONENAND */ |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue