9
0
Fork 0

svn_rev_109

do not know anymore
This commit is contained in:
Sascha Hauer 2007-07-05 18:01:23 +02:00 committed by Sascha Hauer
parent 11a0b5a0dd
commit abfbbad1eb
32 changed files with 835 additions and 1860 deletions

View File

@ -23,6 +23,7 @@ config MACH_MX1ADS
config MACH_ECO920
bool "eco920"
select HAS_AT91_ETHER
select HAS_AT91_I2C
select HAS_CFI
select ARCH_AT91RM9200
help
@ -34,4 +35,5 @@ config ARM920T
bool
source common/Kconfig
source net/Kconfig
source drivers/Kconfig

View File

@ -13,7 +13,7 @@ cpu-$(CONFIG_ARM920T) := arm920t
TEXT_BASE = 0x21e00000
CPPFLAGS += -mabi=apcs-gnu -DTEXT_BASE=$(TEXT_BASE)
CFLAGS := -fno-common -msoft-float -O2
CFLAGS := -fno-common -msoft-float -Os
LDFLAGS_vmlinux :=-L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc -Ttext $(TEXT_BASE)
ifeq ($(incdir-y),)

View File

@ -1,4 +1,4 @@
obj-y += armlinux.o
obj-$(CONFIG_CMD_BOOTM) += armlinux.o
obj-y += _ashldi3.o
obj-y += _ashrdi3.o
obj-y += board.o
@ -8,3 +8,4 @@ obj-y += _divsi3.o
obj-y += _modsi3.o
obj-y += _udivsi3.o
obj-y += _umodsi3.o
obj-y += _lshrdi3.o

View File

@ -44,6 +44,9 @@
#include <devices.h>
#include <version.h>
#include <net.h>
#include <cfi_flash.h>
ulong load_addr = CFG_LOAD_ADDR; /* Default Load Address */
DECLARE_GLOBAL_DATA_PTR;
@ -185,6 +188,8 @@ static void display_flash_config (ulong size)
*/
typedef int (init_fnc_t) (void);
extern int mem_init(void);
int print_cpuinfo (void); /* test-only */
init_fnc_t *init_sequence[] = {
@ -195,6 +200,12 @@ init_fnc_t *init_sequence[] = {
init_baudrate, /* initialze baudrate settings */
serial_init, /* serial communications setup */
console_init_f, /* stage 1 init of console */
#ifdef CONFIG_DRIVER_CFI
flash_init,
#endif
#ifdef CONFIG_CMD_MEMORY
mem_init,
#endif
display_banner, /* say that we are here */
#if defined(CONFIG_DISPLAY_CPUINFO)
print_cpuinfo, /* display cpu info (and speed) */
@ -237,8 +248,7 @@ void start_armboot (void)
#ifndef CFG_NO_FLASH
/* configure available FLASH banks */
size = flash_init ();
display_flash_config (size);
// display_flash_config (size);
#endif /* CFG_NO_FLASH */
#ifdef CONFIG_VFD
@ -283,12 +293,8 @@ void start_armboot (void)
drv_vfd_init();
#endif /* CONFIG_VFD */
devices_init (); /* get the devices list going. */
jumptable_init ();
console_init_r (); /* fully init console as a device */
#if defined(CONFIG_MISC_INIT_R)
/* miscellaneous platform dependent initialisations */
misc_init_r ();

View File

@ -26,9 +26,10 @@
#include <at91rm9200_net.h>
#include <dm9161.h>
#include <miiphy.h>
//#include <splash.h>
//#include <s1d13706fb.h>
#include <splash.h>
#include <s1d13706fb.h>
#include <net.h>
#include <cfi_flash.h>
DECLARE_GLOBAL_DATA_PTR;
@ -37,11 +38,31 @@ DECLARE_GLOBAL_DATA_PTR;
* Miscelaneous platform dependent initialisations
*/
struct cfi_platform_data cfi_info = {
};
struct device_d cfi_dev = {
.name = "nor",
.map_base = 0x11000000,
.size = 16 * 1024 * 1024,
.platform_data = &cfi_info,
};
struct device_d sdram_dev = {
.name = "ram",
.map_base = 0x20000000,
.size = 32 * 1024 * 1024,
};
int board_init (void)
{
/* Enable Ctrlc */
console_init_f ();
gd->bd->bi_arch_number = MACH_TYPE_ECO920;
gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
@ -50,17 +71,20 @@ int board_init (void)
int dram_init (void)
{
register_device(&cfi_dev);
register_device(&sdram_dev);
gd->bd->bi_dram[0].start = PHYS_SDRAM;
gd->bd->bi_dram[0].size = PHYS_SDRAM_SIZE;
return 0;
}
#ifdef CONFIG_DRIVER_NET_AT91_ETHER
static unsigned int phy_is_connected (AT91PS_EMAC p_mac)
{
return 1;
}
#if 0
static unsigned char phy_init_bogus (AT91PS_EMAC p_mac)
{
unsigned short val;
@ -139,9 +163,10 @@ void at91rm9200_GetPhyInterface(AT91PS_PhyOps p_phyops)
/* ditto */
p_phyops->AutoNegotiate = NULL;
}
#endif
static int *efb_init(struct efb_info *efb)
#ifdef CONFIG_DRIVER_VIDEO_S1D13706
static int efb_init(struct efb_info *efb)
{
writeb(GPIO_CONTROL0_GPO, efb->regs + EFB_GPIO_CONTROL1);
writeb(PCLK_SOURCE_CLKI2, efb->regs + EFB_PCLK_CONF);
@ -174,18 +199,21 @@ static struct efb_info efb = {
PANEL_TYPE_COLOR | PANEL_TYPE_FORMAT_2,
};
#endif
#define SMC_CSR3 0xFFFFFF7C
int misc_init_r(void)
{
/* Initialization of the Static Memory Controller for Chip Select 3 */
*(volatile unsigned long*)SMC_CSR3 = 0x00002185;
// s1d13706fb_init(&efb);
// splash_set_fb_data(&efb.fbd);
// eth_set_current(&at91rm9200_eth);
#ifdef CONFIG_DRIVER_VIDEO_S1D13706
s1d13706fb_init(&efb);
#endif
#ifdef CONFIG_CMD_SPLASH
splash_set_fb_data(&efb.fbd);
#endif
#ifdef CONFIG_DRIVER_NET_AT91_ETHER
eth_set_current(&at91rm9200_eth);
#endif
return 0;
}

View File

@ -1,7 +1,11 @@
menuconfig COMMANDS
bool "Commands"
if COMMANDS
config ZLIB
bool
config BZLIB
bool
menu "Commands"
config COMMON_ENV_FLASH
bool
@ -44,4 +48,28 @@ config CMD_SAVES
depends on CMD_LOADS
prompt "saves"
endif
config CMD_SPLASH
bool
prompt "splash"
config CMD_SLEEP
bool
prompt "sleep"
config CMD_BOOTM
bool
prompt "bootm"
config CMD_BOOTM_ZLIB
bool
depends on CMD_BOOTM
select ZLIB
prompt "bootm with zlib support"
config CMD_BOOTM_BZLIB
bool
depends on CMD_BOOTM
select BZLIB
prompt "bootm with bzlib support"
endmenu

View File

@ -1,7 +1,7 @@
obj-y += cmd_bootm.o
obj-$(CONFIG_CMD_BOOTM) += cmd_bootm.o
#obj-y += cmd_elf.o
#obj-y += cmd_itest.o
#obj-y += cmd_net.o
obj-$(CONFIG_NET) += cmd_net.o
#obj-y += cmd_usb.o
#obj-y += docecc.o
obj-y += flash.o
@ -15,13 +15,14 @@ obj-y += env_common.o
#obj-y += memsize.o
#obj-y += usb_kbd.o
#obj-y += bedbug.o
obj-$(CONFIG_CMD_CONSOLE) += cmd_console.o
#obj-$(CONFIG_CMD_CONSOLE) += cmd_console.o
#obj-y += cmd_fat.o
obj-$(CONFIG_CMD_LOADB) += cmd_loadb.o
obj-$(CONFIG_CMD_LOADB) += xyzModem.o
obj-$(CONFIG_CMD_LOADB) += crc16.o
obj-$(CONFIG_CMD_LOADS) += cmd_loads.o
#obj-y += cmd_pci.o
#obj-y += cmd_ximg.o
#obj-y += env_dataflash.o
#obj-y += ft_build.o
#obj-y += miiphybb.o
#obj-y += usb_storage.o
@ -48,11 +49,9 @@ obj-$(CONFIG_CMD_AUTOSCRIPT) += cmd_autoscript.o
obj-$(CONFIG_CMD_FLASH) += cmd_flash.o
obj-$(CONFIG_CMD_MEMORY) += cmd_mem.o
#obj-y += cmd_reginfo.o
#obj-y += crc16.o
obj-y += environment.o
#obj-y += kgdb.o
#obj-y += soft_i2c.o
#obj-y += xyzModem.o
#obj-y += cmd_bdinfo.o
#obj-y += cmd_display.o
#obj-y += cmd_fpga.o
@ -66,9 +65,7 @@ obj-$(CONFIG_CMD_MII) += cmd_mii.o
obj-$(CONFIG_CMD_I2C) += cmd_i2c.o
#obj-y += cmd_misc.o
#obj-y += cmd_scsi.o
obj-y += devices.o
#obj-y += env_nowhere.o
obj-y += lists.o
#obj-y += cmd_bmp.o
#obj-y += cmd_dtt.o
#obj-y += cmd_ide.o
@ -84,9 +81,9 @@ obj-y += dlmalloc.o
#obj-y += cmd_universe.o
obj-y += exports.o
obj-y += main.o
#obj-y += s_record.o
obj-$(CONFIG_CMD_LOADS) += s_record.o
obj-y += clock.o
obj-$(CONFIG_CMD_SPLASH) += cmd_splash.o
# obj-y += spartan3.o
# obj-y += spartan2.o
# obj-y += ACEX1K.o
@ -94,3 +91,5 @@ obj-y += clock.o
# obj-y += fpga.o
# obj-y += altera.o
# obj-y += cyclon2.o
obj-$(CONFIG_CMD_SLEEP) += cmd_misc.o
obj-y += mtdpart.o

View File

@ -27,433 +27,44 @@
#include <common.h>
#include <command.h>
#ifdef CONFIG_HAS_DATAFLASH
#include <dataflash.h>
#endif
#if (CONFIG_COMMANDS & CFG_CMD_JFFS2) && defined(CONFIG_JFFS2_CMDLINE)
#include <jffs2/jffs2.h>
/* parition handling routines */
int mtdparts_init(void);
int id_parse(const char *id, const char **ret_id, u8 *dev_type, u8 *dev_num);
int find_dev_and_part(const char *id, struct mtd_device **dev,
u8 *part_num, struct part_info **part);
#endif
extern flash_info_t flash_info[]; /* info for FLASH chips */
/*
* The user interface starts numbering for Flash banks with 1
* for historical reasons.
*/
/*
* this routine looks for an abbreviated flash range specification.
* the syntax is B:SF[-SL], where B is the bank number, SF is the first
* sector to erase, and SL is the last sector to erase (defaults to SF).
* bank numbers start at 1 to be consistent with other specs, sector numbers
* start at zero.
*
* returns: 1 - correct spec; *pinfo, *psf and *psl are
* set appropriately
* 0 - doesn't look like an abbreviated spec
* -1 - looks like an abbreviated spec, but got
* a parsing error, a number out of range,
* or an invalid flash bank.
*/
static int
abbrev_spec (char *str, flash_info_t ** pinfo, int *psf, int *psl)
{
flash_info_t *fp;
int bank, first, last;
char *p, *ep;
if ((p = strchr (str, ':')) == NULL)
return 0;
*p++ = '\0';
bank = simple_strtoul (str, &ep, 10);
if (ep == str || *ep != '\0' ||
bank < 1 || bank > CFG_MAX_FLASH_BANKS ||
(fp = &flash_info[bank - 1])->flash_id == FLASH_UNKNOWN)
return -1;
str = p;
if ((p = strchr (str, '-')) != NULL)
*p++ = '\0';
first = simple_strtoul (str, &ep, 10);
if (ep == str || *ep != '\0' || first >= fp->sector_count)
return -1;
if (p != NULL) {
last = simple_strtoul (p, &ep, 10);
if (ep == p || *ep != '\0' ||
last < first || last >= fp->sector_count)
return -1;
} else {
last = first;
}
*pinfo = fp;
*psf = first;
*psl = last;
return 1;
}
/*
* This function computes the start and end addresses for both
* erase and protect commands. The range of the addresses on which
* either of the commands is to operate can be given in two forms:
* 1. <cmd> start end - operate on <'start', 'end')
* 2. <cmd> start +length - operate on <'start', start + length)
* If the second form is used and the end address doesn't fall on the
* sector boundary, than it will be adjusted to the next sector boundary.
* If it isn't in the flash, the function will fail (return -1).
* Input:
* arg1, arg2: address specification (i.e. both command arguments)
* Output:
* addr_first, addr_last: computed address range
* Return:
* 1: success
* -1: failure (bad format, bad address).
*/
static int
addr_spec(char *arg1, char *arg2, ulong *addr_first, ulong *addr_last)
{
char *ep;
char len_used; /* indicates if the "start +length" form used */
char found;
ulong bank;
*addr_first = simple_strtoul(arg1, &ep, 16);
if (ep == arg1 || *ep != '\0')
return -1;
len_used = 0;
if (arg2 && *arg2 == '+'){
len_used = 1;
++arg2;
}
*addr_last = simple_strtoul(arg2, &ep, 16);
if (ep == arg2 || *ep != '\0')
return -1;
if (len_used){
/*
* *addr_last has the length, compute correct *addr_last
* XXX watch out for the integer overflow! Right now it is
* checked for in both the callers.
*/
*addr_last = *addr_first + *addr_last - 1;
/*
* It may happen that *addr_last doesn't fall on the sector
* boundary. We want to round such an address to the next
* sector boundary, so that the commands don't fail later on.
*/
/* find the end addr of the sector where the *addr_last is */
found = 0;
for (bank = 0; bank < CFG_MAX_FLASH_BANKS && !found; ++bank){
int i;
flash_info_t *info = &flash_info[bank];
for (i = 0; i < info->sector_count && !found; ++i){
/* get the end address of the sector */
ulong sector_end_addr;
if (i == info->sector_count - 1){
sector_end_addr =
info->start[0] + info->size - 1;
} else {
sector_end_addr =
info->start[i+1] - 1;
}
if (*addr_last <= sector_end_addr &&
*addr_last >= info->start[i]){
/* sector found */
found = 1;
/* adjust *addr_last if necessary */
if (*addr_last < sector_end_addr){
*addr_last = sector_end_addr;
}
}
} /* sector */
} /* bank */
if (!found){
/* error, addres not in flash */
printf("Error: end address (0x%08lx) not in flash!\n",
*addr_last);
return -1;
}
} /* "start +length" from used */
return 1;
}
static int
flash_fill_sect_ranges (ulong addr_first, ulong addr_last,
int *s_first, int *s_last,
int *s_count )
{
flash_info_t *info;
ulong bank;
int rcode = 0;
*s_count = 0;
for (bank=0; bank < CFG_MAX_FLASH_BANKS; ++bank) {
s_first[bank] = -1; /* first sector to erase */
s_last [bank] = -1; /* last sector to erase */
}
for (bank=0,info=&flash_info[0];
(bank < CFG_MAX_FLASH_BANKS) && (addr_first <= addr_last);
++bank, ++info) {
ulong b_end;
int sect;
short s_end;
if (info->flash_id == FLASH_UNKNOWN) {
continue;
}
b_end = info->start[0] + info->size - 1; /* bank end addr */
s_end = info->sector_count - 1; /* last sector */
for (sect=0; sect < info->sector_count; ++sect) {
ulong end; /* last address in current sect */
end = (sect == s_end) ? b_end : info->start[sect + 1] - 1;
if (addr_first > end)
continue;
if (addr_last < info->start[sect])
continue;
if (addr_first == info->start[sect]) {
s_first[bank] = sect;
}
if (addr_last == end) {
s_last[bank] = sect;
}
}
if (s_first[bank] >= 0) {
if (s_last[bank] < 0) {
if (addr_last > b_end) {
s_last[bank] = s_end;
} else {
puts ("Error: end address"
" not on sector boundary\n");
rcode = 1;
break;
}
}
if (s_last[bank] < s_first[bank]) {
puts ("Error: end sector"
" precedes start sector\n");
rcode = 1;
break;
}
sect = s_last[bank];
addr_first = (sect == s_end) ? b_end + 1: info->start[sect + 1];
(*s_count) += s_last[bank] - s_first[bank] + 1;
} else if (addr_first >= info->start[0] && addr_first < b_end) {
puts ("Error: start address not on sector boundary\n");
rcode = 1;
break;
} else if (s_last[bank] >= 0) {
puts ("Error: cannot span across banks when they are"
" mapped in reverse order\n");
rcode = 1;
break;
}
}
return rcode;
}
int do_flinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
ulong bank;
#ifdef CONFIG_HAS_DATAFLASH
dataflash_print_info();
#endif
if (argc == 1) { /* print info for all FLASH banks */
for (bank=0; bank <CFG_MAX_FLASH_BANKS; ++bank) {
printf ("\nBank # %ld: ", bank+1);
flash_print_info (&flash_info[bank]);
}
return 0;
}
bank = simple_strtoul(argv[1], NULL, 16);
if ((bank < 1) || (bank > CFG_MAX_FLASH_BANKS)) {
printf ("Only FLASH Banks # 1 ... # %d supported\n",
CFG_MAX_FLASH_BANKS);
return 1;
}
printf ("\nBank # %ld: ", bank);
flash_print_info (&flash_info[bank-1]);
printf("%s is broken\n",__FUNCTION__);
return 0;
}
int do_flerase (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
flash_info_t *info;
ulong bank, addr_first, addr_last;
int n, sect_first, sect_last;
#if (CONFIG_COMMANDS & CFG_CMD_JFFS2) && defined(CONFIG_JFFS2_CMDLINE)
struct mtd_device *dev;
struct part_info *part;
u8 dev_type, dev_num, pnum;
#endif
int rcode = 0;
struct memarea_info mem;
if (argc < 2) {
if (argc != 2) {
printf ("Usage:\n%s\n", cmdtp->usage);
return 1;
}
if (strcmp(argv[1], "all") == 0) {
for (bank=1; bank<=CFG_MAX_FLASH_BANKS; ++bank) {
printf ("Erase Flash Bank # %ld ", bank);
info = &flash_info[bank-1];
rcode = flash_erase (info, 0, info->sector_count-1);
}
return rcode;
}
if (spec_str_to_info(argv[1], &mem)) {
printf("-ENOPARSE\n");
return 1;
}
if ((n = abbrev_spec(argv[1], &info, &sect_first, &sect_last)) != 0) {
if (n < 0) {
puts ("Bad sector specification\n");
return 1;
}
printf ("Erase Flash Sectors %d-%d in Bank # %d ",
sect_first, sect_last, (info-flash_info)+1);
rcode = flash_erase(info, sect_first, sect_last);
return rcode;
}
if (!mem.device->driver) {
printf("This device has no driver\n");
return 1;
}
if (!mem.device->driver->erase) {
printf("This device cannot be erased\n");
return 1;
}
#if (CONFIG_COMMANDS & CFG_CMD_JFFS2) && defined(CONFIG_JFFS2_CMDLINE)
/* erase <part-id> - erase partition */
if ((argc == 2) && (id_parse(argv[1], NULL, &dev_type, &dev_num) == 0)) {
mtdparts_init();
if (find_dev_and_part(argv[1], &dev, &pnum, &part) == 0) {
if (dev->id->type == MTD_DEV_TYPE_NOR) {
bank = dev->id->num;
info = &flash_info[bank];
addr_first = part->offset + info->start[0];
addr_last = addr_first + part->size - 1;
printf ("Erase Flash Parition %s, "
"bank %d, 0x%08lx - 0x%08lx ",
argv[1], bank, addr_first,
addr_last);
rcode = flash_sect_erase(addr_first, addr_last);
return rcode;
}
printf("cannot erase, not a NOR device\n");
return 1;
}
}
#endif
if (argc != 3) {
printf ("Usage:\n%s\n", cmdtp->usage);
return 1;
}
if (strcmp(argv[1], "bank") == 0) {
bank = simple_strtoul(argv[2], NULL, 16);
if ((bank < 1) || (bank > CFG_MAX_FLASH_BANKS)) {
printf ("Only FLASH Banks # 1 ... # %d supported\n",
CFG_MAX_FLASH_BANKS);
return 1;
}
printf ("Erase Flash Bank # %ld ", bank);
info = &flash_info[bank-1];
rcode = flash_erase (info, 0, info->sector_count-1);
return rcode;
}
if (addr_spec(argv[1], argv[2], &addr_first, &addr_last) < 0){
printf ("Bad address format\n");
return 1;
}
if (addr_first >= addr_last) {
printf ("Usage:\n%s\n", cmdtp->usage);
return 1;
}
rcode = flash_sect_erase(addr_first, addr_last);
return rcode;
}
int flash_sect_erase (ulong addr_first, ulong addr_last)
{
flash_info_t *info;
ulong bank;
#ifdef CFG_MAX_FLASH_BANKS_DETECT
int s_first[CFG_MAX_FLASH_BANKS_DETECT], s_last[CFG_MAX_FLASH_BANKS_DETECT];
#else
int s_first[CFG_MAX_FLASH_BANKS], s_last[CFG_MAX_FLASH_BANKS];
#endif
int erased = 0;
int planned;
int rcode = 0;
rcode = flash_fill_sect_ranges (addr_first, addr_last,
s_first, s_last, &planned );
if (planned && (rcode == 0)) {
for (bank=0,info=&flash_info[0];
(bank < CFG_MAX_FLASH_BANKS) && (rcode == 0);
++bank, ++info) {
if (s_first[bank]>=0) {
erased += s_last[bank] - s_first[bank] + 1;
debug ("Erase Flash from 0x%08lx to 0x%08lx "
"in Bank # %ld ",
info->start[s_first[bank]],
(s_last[bank] == info->sector_count) ?
info->start[0] + info->size - 1:
info->start[s_last[bank]+1] - 1,
bank+1);
rcode = flash_erase (info, s_first[bank], s_last[bank]);
}
}
printf ("Erased %d sectors\n", erased);
} else if (rcode == 0) {
puts ("Error: start and/or end address"
" not on sector boundary\n");
rcode = 1;
}
return rcode;
mem.device->driver->erase(mem.device, &mem);
return 0;
}
int do_protect (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
flash_info_t *info;
ulong bank, addr_first, addr_last;
int i, p, n, sect_first, sect_last;
#if (CONFIG_COMMANDS & CFG_CMD_JFFS2) && defined(CONFIG_JFFS2_CMDLINE)
struct mtd_device *dev;
struct part_info *part;
u8 dev_type, dev_num, pnum;
#endif
int p;
int rcode = 0;
#ifdef CONFIG_HAS_DATAFLASH
int status;
#endif
struct memarea_info mem_info;
if (argc < 3) {
printf ("Usage:\n%s\n", cmdtp->usage);
@ -469,216 +80,18 @@ int do_protect (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
return 1;
}
#ifdef CONFIG_HAS_DATAFLASH
if ((strcmp(argv[2], "all") != 0) && (strcmp(argv[2], "bank") != 0)) {
addr_first = simple_strtoul(argv[2], NULL, 16);
addr_last = simple_strtoul(argv[3], NULL, 16);
if (addr_dataflash(addr_first) && addr_dataflash(addr_last)) {
status = dataflash_real_protect(p,addr_first,addr_last);
if (status < 0){
puts ("Bad DataFlash sector specification\n");
return 1;
}
printf("%sProtect %d DataFlash Sectors\n",
p ? "" : "Un-", status);
return 0;
}
}
#endif
if (strcmp(argv[2], "all") == 0) {
for (bank=1; bank<=CFG_MAX_FLASH_BANKS; ++bank) {
info = &flash_info[bank-1];
if (info->flash_id == FLASH_UNKNOWN) {
continue;
}
printf ("%sProtect Flash Bank # %ld\n",
p ? "" : "Un-", bank);
for (i=0; i<info->sector_count; ++i) {
#if defined(CFG_FLASH_PROTECTION)
if (flash_real_protect(info, i, p))
rcode = 1;
putc ('.');
#else
info->protect[i] = p;
#endif /* CFG_FLASH_PROTECTION */
}
#if defined(CFG_FLASH_PROTECTION)
if (!rcode) puts (" done\n");
#endif /* CFG_FLASH_PROTECTION */
}
return rcode;
}
if ((n = abbrev_spec(argv[2], &info, &sect_first, &sect_last)) != 0) {
if (n < 0) {
puts ("Bad sector specification\n");
return 1;
}
printf("%sProtect Flash Sectors %d-%d in Bank # %d\n",
p ? "" : "Un-", sect_first, sect_last,
(info-flash_info)+1);
for (i = sect_first; i <= sect_last; i++) {
#if defined(CFG_FLASH_PROTECTION)
if (flash_real_protect(info, i, p))
rcode = 1;
putc ('.');
#else
info->protect[i] = p;
#endif /* CFG_FLASH_PROTECTION */
}
#if defined(CFG_FLASH_PROTECTION)
if (!rcode) puts (" done\n");
#endif /* CFG_FLASH_PROTECTION */
return rcode;
}
#if (CONFIG_COMMANDS & CFG_CMD_JFFS2) && defined(CONFIG_JFFS2_CMDLINE)
/* protect on/off <part-id> */
if ((argc == 3) && (id_parse(argv[2], NULL, &dev_type, &dev_num) == 0)) {
mtdparts_init();
if (find_dev_and_part(argv[2], &dev, &pnum, &part) == 0) {
if (dev->id->type == MTD_DEV_TYPE_NOR) {
bank = dev->id->num;
info = &flash_info[bank];
addr_first = part->offset + info->start[0];
addr_last = addr_first + part->size - 1;
printf ("%sProtect Flash Parition %s, "
"bank %d, 0x%08lx - 0x%08lx\n",
p ? "" : "Un", argv[1],
bank, addr_first, addr_last);
rcode = flash_sect_protect (p, addr_first, addr_last);
return rcode;
}
printf("cannot %sprotect, not a NOR device\n",
p ? "" : "un");
return 1;
}
}
#endif
if (argc != 4) {
printf ("Usage:\n%s\n", cmdtp->usage);
if (spec_str_to_info(argv[2], &mem_info)) {
printf ("-EPARSE\n");
return 1;
}
if (strcmp(argv[2], "bank") == 0) {
bank = simple_strtoul(argv[3], NULL, 16);
if ((bank < 1) || (bank > CFG_MAX_FLASH_BANKS)) {
printf ("Only FLASH Banks # 1 ... # %d supported\n",
CFG_MAX_FLASH_BANKS);
return 1;
}
printf ("%sProtect Flash Bank # %ld\n",
p ? "" : "Un-", bank);
info = &flash_info[bank-1];
if (info->flash_id == FLASH_UNKNOWN) {
puts ("missing or unknown FLASH type\n");
return 1;
}
for (i=0; i<info->sector_count; ++i) {
#if defined(CFG_FLASH_PROTECTION)
if (flash_real_protect(info, i, p))
rcode = 1;
putc ('.');
#else
info->protect[i] = p;
#endif /* CFG_FLASH_PROTECTION */
}
#if defined(CFG_FLASH_PROTECTION)
if (!rcode) puts (" done\n");
#endif /* CFG_FLASH_PROTECTION */
return rcode;
}
if (addr_spec(argv[2], argv[3], &addr_first, &addr_last) < 0){
printf("Bad address format\n");
return 1;
}
if (addr_first >= addr_last) {
printf ("Usage:\n%s\n", cmdtp->usage);
return 1;
}
rcode = flash_sect_protect (p, addr_first, addr_last);
// rcode = flash_sect_protect (p, addr_first, addr_last);
return rcode;
}
int flash_sect_protect (int p, ulong addr_first, ulong addr_last)
{
flash_info_t *info;
ulong bank;
#ifdef CFG_MAX_FLASH_BANKS_DETECT
int s_first[CFG_MAX_FLASH_BANKS_DETECT], s_last[CFG_MAX_FLASH_BANKS_DETECT];
#else
int s_first[CFG_MAX_FLASH_BANKS], s_last[CFG_MAX_FLASH_BANKS];
#endif
int protected, i;
int planned;
int rcode;
rcode = flash_fill_sect_ranges( addr_first, addr_last, s_first, s_last, &planned );
protected = 0;
if (planned && (rcode == 0)) {
for (bank=0,info=&flash_info[0]; bank < CFG_MAX_FLASH_BANKS; ++bank, ++info) {
if (info->flash_id == FLASH_UNKNOWN) {
continue;
}
if (s_first[bank]>=0 && s_first[bank]<=s_last[bank]) {
debug ("%sProtecting sectors %d..%d in bank %ld\n",
p ? "" : "Un-",
s_first[bank], s_last[bank], bank+1);
protected += s_last[bank] - s_first[bank] + 1;
for (i=s_first[bank]; i<=s_last[bank]; ++i) {
#if defined(CFG_FLASH_PROTECTION)
if (flash_real_protect(info, i, p))
rcode = 1;
putc ('.');
#else
info->protect[i] = p;
#endif /* CFG_FLASH_PROTECTION */
}
}
}
#if defined(CFG_FLASH_PROTECTION)
puts (" done\n");
#endif /* CFG_FLASH_PROTECTION */
printf ("%sProtected %d sectors\n",
p ? "" : "Un-", protected);
} else if (rcode == 0) {
puts ("Error: start and/or end address"
" not on sector boundary\n");
rcode = 1;
}
return rcode;
}
/**************************************************/
#if (CONFIG_COMMANDS & CFG_CMD_JFFS2) && defined(CONFIG_JFFS2_CMDLINE)
# define TMP_ERASE "erase <part-id>\n - erase partition\n"
# define TMP_PROT_ON "protect on <part-id>\n - protect partition\n"
# define TMP_PROT_OFF "protect off <part-id>\n - make partition writable\n"
#else
# define TMP_ERASE /* empty */
# define TMP_PROT_ON /* empty */
# define TMP_PROT_OFF /* empty */
#endif
U_BOOT_CMD(
flinfo, 2, 1, do_flinfo,
@ -688,17 +101,9 @@ U_BOOT_CMD(
);
U_BOOT_CMD(
erase, 3, 0, do_flerase,
erase, 2, 0, do_flerase,
"erase - erase FLASH memory\n",
"start end\n"
" - erase FLASH from addr 'start' to addr 'end'\n"
"erase start +len\n"
" - erase FLASH from addr 'start' to the end of sect "
"w/addr 'start'+'len'-1\n"
"erase N:SF[-SL]\n - erase sectors SF-SL in FLASH bank # N\n"
"erase bank N\n - erase FLASH bank # N\n"
TMP_ERASE
"erase all\n - erase all FLASH banks\n"
"write me\n"
);
U_BOOT_CMD(
@ -712,7 +117,6 @@ U_BOOT_CMD(
"protect on N:SF[-SL]\n"
" - protect sectors SF-SL in FLASH bank # N\n"
"protect on bank N\n - protect FLASH bank # N\n"
TMP_PROT_ON
"protect on all\n - protect all FLASH banks\n"
"protect off start end\n"
" - make FLASH from addr 'start' to addr 'end' writable\n"
@ -722,10 +126,5 @@ U_BOOT_CMD(
"protect off N:SF[-SL]\n"
" - make sectors SF-SL writable in FLASH bank # N\n"
"protect off bank N\n - make FLASH bank # N writable\n"
TMP_PROT_OFF
"protect off all\n - make all FLASH banks writable\n"
);
#undef TMP_ERASE
#undef TMP_PROT_ON
#undef TMP_PROT_OFF

View File

@ -29,12 +29,7 @@
#include <common.h>
#include <command.h>
#if (CONFIG_COMMANDS & CFG_CMD_MMC)
#include <mmc.h>
#endif
#ifdef CONFIG_HAS_DATAFLASH
#include <dataflash.h>
#endif
#include <driver.h>
#ifdef CMD_MEM_DEBUG
#define PRINTF(fmt,args...) printf (fmt ,##args)
@ -42,15 +37,6 @@
#define PRINTF(fmt,args...)
#endif
static int mod_mem(cmd_tbl_t *, int, int, int, char *[]);
/* Display values from last command.
* Memory modify remembered values are different from display memory.
*/
uint dp_last_addr, dp_last_size;
uint dp_last_length = 0x40;
uint mm_last_addr, mm_last_size;
/* Memory Display
*
* Syntax:
@ -59,79 +45,53 @@ uint mm_last_addr, mm_last_size;
#define DISP_LINE_LEN 16
int do_mem_md ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
ulong addr, length;
ulong i, nbytes, linebytes;
ulong addr, offs;
ulong i, nbytes = 0x100, linebytes;
struct memarea_info mem;
u_char *cp;
int size;
int rc = 0;
/* We use the last specified parameters, unless new ones are
* entered.
*/
addr = dp_last_addr;
size = dp_last_size;
length = dp_last_length;
if (argc < 2) {
printf ("Usage:\n%s\n", cmdtp->usage);
return 1;
}
if ((flag & CMD_FLAG_REPEAT) == 0) {
/* New command specified. Check for a size specification.
* Defaults to long if no or incorrect specification.
*/
if ((size = cmd_get_data_size(argv[0], 4)) < 0)
return 1;
if (spec_str_to_info(argv[1], &mem)) {
printf("-ENOPARSE\n");
return -1;
}
/* Address is specified since argc > 1
*/
addr = simple_strtoul(argv[1], NULL, 16);
offs = mem.start;
if (mem.device->map_flags & MAP_READ)
addr = mem.device->map_base + offs;
else {
printf("cannot yet show unmapped devices\n");
return -1;
}
/* If another parameter, it is the length to display.
* Length is the number of objects, not number of bytes.
*/
if (argc > 2)
length = simple_strtoul(argv[2], NULL, 16);
}
if (mem.flags & MEMAREA_SIZE_SPECIFIED)
nbytes = mem.size;
else
nbytes = min(0x100, mem.size);
/* Print the lines.
if ((size = cmd_get_data_size(argv[0], 4)) < 0)
return 1;
/* Print the lines.
*
* We buffer all read data, so we can make sure data is read only
* once, and all accesses are with the specified bus width.
*/
nbytes = length * size;
do {
char linebuf[DISP_LINE_LEN];
uint *uip = (uint *)linebuf;
ushort *usp = (ushort *)linebuf;
u_char *ucp = (u_char *)linebuf;
#ifdef CONFIG_HAS_DATAFLASH
int rc;
#endif
printf("%08lx:", addr);
printf("%08lx:", offs);
linebytes = (nbytes>DISP_LINE_LEN)?DISP_LINE_LEN:nbytes;
#ifdef CONFIG_HAS_DATAFLASH
if ((rc = read_dataflash(addr, (linebytes/size)*size, linebuf)) == DATAFLASH_OK){
/* if outside dataflash */
/*if (rc != 1) {
dataflash_perror (rc);
return (1);
}*/
for (i=0; i<linebytes; i+= size) {
if (size == 4) {
printf(" %08x", *uip++);
} else if (size == 2) {
printf(" %04x", *usp++);
} else {
printf(" %02x", *ucp++);
}
addr += size;
}
} else { /* addr does not correspond to DataFlash */
#endif
for (i=0; i<linebytes; i+= size) {
if (size == 4) {
printf(" %08x", (*uip++ = *((uint *)addr)));
@ -141,11 +101,10 @@ int do_mem_md ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
printf(" %02x", (*ucp++ = *((u_char *)addr)));
}
addr += size;
offs += size;
}
#ifdef CONFIG_HAS_DATAFLASH
}
#endif
puts (" ");
puts (" ");
cp = (u_char *)linebuf;
for (i=0; i<linebytes; i++) {
if ((*cp < 0x20) || (*cp > 0x7e))
@ -162,24 +121,13 @@ int do_mem_md ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
}
} while (nbytes > 0);
dp_last_addr = addr;
dp_last_length = length;
dp_last_size = size;
return (rc);
}
int do_mem_mm ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
return mod_mem (cmdtp, 1, flag, argc, argv);
}
int do_mem_nm ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
return mod_mem (cmdtp, 0, flag, argc, argv);
}
int do_mem_mw ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
ulong addr, writeval, count;
struct memarea_info mem;
int size;
if ((argc < 3) || (argc > 4)) {
@ -192,9 +140,18 @@ int do_mem_mw ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
if ((size = cmd_get_data_size(argv[0], 4)) < 1)
return 1;
/* Address is specified since argc > 1
*/
addr = simple_strtoul(argv[1], NULL, 16);
if (spec_str_to_info(argv[1], &mem)) {
printf("-ENOPARSE\n");
return -1;
}
addr = mem.start;
if (mem.device->map_flags & MAP_WRITE)
addr += mem.device->map_base;
else {
printf("cannot yet modify unmapped devices\n");
return -1;
}
/* Get the value to write.
*/
@ -301,13 +258,6 @@ int do_mem_cmp (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
count = simple_strtoul(argv[3], NULL, 16);
#ifdef CONFIG_HAS_DATAFLASH
if (addr_dataflash(addr1) | addr_dataflash(addr2)){
puts ("Comparison with DataFlash space not supported.\n\r");
return 0;
}
#endif
ngood = 0;
while (count-- > 0) {
@ -358,9 +308,11 @@ int do_mem_cmp (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
int do_mem_cp ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
ulong addr, dest, count;
struct memarea_info dst, src;
int size;
if (argc != 4) {
if (argc != 3) {
printf ("Usage:\n%s\n", cmdtp->usage);
return 1;
}
@ -370,122 +322,49 @@ int do_mem_cp ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
if ((size = cmd_get_data_size(argv[0], 4)) < 0)
return 1;
addr = simple_strtoul(argv[1], NULL, 16);
if (spec_str_to_info(argv[1], &src)) {
printf("-ENOPARSE\n");
return -1;
}
dest = simple_strtoul(argv[2], NULL, 16);
if (spec_str_to_info(argv[2], &dst)) {
printf("-ENOPARSE\n");
return -1;
}
count = simple_strtoul(argv[3], NULL, 16);
if (!src.size && !dst.size) {
printf("no size given. We should copy the whole device\n");
return 1;
}
if (count == 0) {
puts ("Zero length ???\n");
return 1;
}
if (!src.size || !dst.size)
count = dst.size | src.size;
else
count = min(src.size, dst.size);
#ifndef CFG_NO_FLASH
/* check if we are copying to Flash */
if ( (addr2info(dest) != NULL)
#ifdef CONFIG_HAS_DATAFLASH
&& (!addr_dataflash(addr))
#endif
) {
int rc;
count /= size;
puts ("Copy to Flash... ");
if ((dst.device->map_flags & MAP_WRITE) &&
(src.device->map_flags & MAP_READ)) {
addr = src.device->map_base + src.start;
dest = dst.device->map_base + dst.start;
printf("copy from 0x%08x to 0x%08x count %d\n",addr, dest, count);
rc = flash_write ((char *)addr, dest, count*size);
if (rc != 0) {
flash_perror (rc);
return (1);
}
puts ("done\n");
return 0;
}
#endif
#if (CONFIG_COMMANDS & CFG_CMD_MMC)
if (mmc2info(dest)) {
int rc;
puts ("Copy to MMC... ");
switch (rc = mmc_write ((uchar *)addr, dest, count*size)) {
case 0:
putc ('\n');
return 1;
case -1:
puts ("failed\n");
return 1;
default:
printf ("%s[%d] FIXME: rc=%d\n",__FILE__,__LINE__,rc);
return 1;
}
puts ("done\n");
return 0;
}
if (mmc2info(addr)) {
int rc;
puts ("Copy from MMC... ");
switch (rc = mmc_read (addr, (uchar *)dest, count*size)) {
case 0:
putc ('\n');
return 1;
case -1:
puts ("failed\n");
return 1;
default:
printf ("%s[%d] FIXME: rc=%d\n",__FILE__,__LINE__,rc);
return 1;
}
puts ("done\n");
return 0;
}
#endif
#ifdef CONFIG_HAS_DATAFLASH
/* Check if we are copying from RAM or Flash to DataFlash */
if (addr_dataflash(dest) && !addr_dataflash(addr)){
int rc;
puts ("Copy to DataFlash... ");
rc = write_dataflash (dest, addr, count*size);
if (rc != 1) {
dataflash_perror (rc);
return (1);
}
puts ("done\n");
return 0;
}
/* Check if we are copying from DataFlash to RAM */
if (addr_dataflash(addr) && !addr_dataflash(dest) && (addr2info(dest)==NULL) ){
int rc;
rc = read_dataflash(addr, count * size, (char *) dest);
if (rc != 1) {
dataflash_perror (rc);
return (1);
}
return 0;
}
if (addr_dataflash(addr) && addr_dataflash(dest)){
puts ("Unsupported combination of source/destination.\n\r");
return 1;
}
#endif
while (count-- > 0) {
if (size == 4)
*((ulong *)dest) = *((ulong *)addr);
else if (size == 2)
*((ushort *)dest) = *((ushort *)addr);
else
*((u_char *)dest) = *((u_char *)addr);
addr += size;
dest += size;
}
while (count-- > 0) {
if (size == 4)
*((ulong *)dest) = *((ulong *)addr);
else if (size == 2)
*((ushort *)dest) = *((ushort *)addr);
else
*((u_char *)dest) = *((u_char *)addr);
addr += size;
dest += size;
}
return 0;
} else {
printf("can not yet copy to unmapped devices\n");
return -1;
}
return 0;
}
@ -873,109 +752,6 @@ int do_mem_mtest (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
#endif
}
/* Modify memory.
*
* Syntax:
* mm{.b, .w, .l} {addr}
* nm{.b, .w, .l} {addr}
*/
static int
mod_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char *argv[])
{
ulong addr, i;
int nbytes, size;
extern char console_buffer[];
if (argc != 2) {
printf ("Usage:\n%s\n", cmdtp->usage);
return 1;
}
#ifdef CONFIG_BOOT_RETRY_TIME
reset_cmd_timeout(); /* got a good command to get here */
#endif
/* We use the last specified parameters, unless new ones are
* entered.
*/
addr = mm_last_addr;
size = mm_last_size;
if ((flag & CMD_FLAG_REPEAT) == 0) {
/* New command specified. Check for a size specification.
* Defaults to long if no or incorrect specification.
*/
if ((size = cmd_get_data_size(argv[0], 4)) < 0)
return 1;
/* Address is specified since argc > 1
*/
addr = simple_strtoul(argv[1], NULL, 16);
}
#ifdef CONFIG_HAS_DATAFLASH
if (addr_dataflash(addr)){
puts ("Can't modify DataFlash in place. Use cp instead.\n\r");
return 0;
}
#endif
/* Print the address, followed by value. Then accept input for
* the next value. A non-converted value exits.
*/
do {
printf("%08lx:", addr);
if (size == 4)
printf(" %08x", *((uint *)addr));
else if (size == 2)
printf(" %04x", *((ushort *)addr));
else
printf(" %02x", *((u_char *)addr));
nbytes = readline (" ? ");
if (nbytes == 0 || (nbytes == 1 && console_buffer[0] == '-')) {
/* <CR> pressed as only input, don't modify current
* location and move to next. "-" pressed will go back.
*/
if (incrflag)
addr += nbytes ? -size : size;
nbytes = 1;
#ifdef CONFIG_BOOT_RETRY_TIME
reset_cmd_timeout(); /* good enough to not time out */
#endif
}
#ifdef CONFIG_BOOT_RETRY_TIME
else if (nbytes == -2) {
break; /* timed out, exit the command */
}
#endif
else {
char *endp;
i = simple_strtoul(console_buffer, &endp, 16);
nbytes = endp - console_buffer;
if (nbytes) {
#ifdef CONFIG_BOOT_RETRY_TIME
/* good enough to not time out
*/
reset_cmd_timeout();
#endif
if (size == 4)
*((uint *)addr) = i;
else if (size == 2)
*((ushort *)addr) = i;
else
*((u_char *)addr) = i;
if (incrflag)
addr += size;
}
}
} while (nbytes);
mm_last_addr = addr;
mm_last_size = size;
return 0;
}
#ifndef CONFIG_CRC32_VERIFY
int do_mem_crc (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
@ -1061,26 +837,46 @@ int do_mem_crc (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
}
#endif /* CONFIG_CRC32_VERIFY */
int mem_probe(struct device_d *dev)
{
printf("mem_probe: %s base: 0x%08x size: 0x%08x\n", dev->name, dev->map_base, dev->size);
dev->map_flags = MAP_READ | MAP_WRITE;
return 0;
}
struct device_d mem_dev = {
.name = "mem",
.map_base = 0,
.size = ~0, /* FIXME: should be 0x100000000, ahem... */
.map_flags = MAP_READ | MAP_WRITE,
};
struct driver_d mem_drv = {
.name = "mem",
.probe = mem_probe,
};
struct driver_d ram_drv = {
.name = "ram",
.probe = mem_probe,
};
int mem_init(void)
{
register_device(&mem_dev);
register_driver(&mem_drv);
register_driver(&ram_drv);
return 0;
}
U_BOOT_CMD(
md, 3, 1, do_mem_md,
"md - memory display\n",
"[.b, .w, .l] address [# of objects]\n - memory display\n"
);
U_BOOT_CMD(
mm, 2, 1, do_mem_mm,
"mm - memory modify (auto-incrementing)\n",
"[.b, .w, .l] address\n" " - memory modify, auto increment address\n"
);
U_BOOT_CMD(
nm, 2, 1, do_mem_nm,
"nm - memory modify (constant address)\n",
"[.b, .w, .l] address\n - memory modify, read and keep address\n"
);
U_BOOT_CMD(
mw, 4, 1, do_mem_mw,
"mw - memory write (fill)\n",

View File

@ -40,10 +40,10 @@ int do_sleep (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
return 1;
}
delay = simple_strtoul(argv[1], NULL, 10) * CFG_HZ;
delay = simple_strtoul(argv[1], NULL, 10);
start = get_time_ns();
while (!is_timeout(start, delay * 1000000));
while (!is_timeout(start, delay * SECOND));
return 0;
}

View File

@ -55,10 +55,9 @@ DECLARE_GLOBAL_DATA_PTR;
#if !defined(CFG_ENV_IS_IN_NVRAM) && \
!defined(CFG_ENV_IS_IN_EEPROM) && \
!defined(CFG_ENV_IS_IN_FLASH) && \
!defined(CFG_ENV_IS_IN_DATAFLASH) && \
!defined(CFG_ENV_IS_IN_NAND) && \
!defined(CFG_ENV_IS_NOWHERE)
# error Define one of CFG_ENV_IS_IN_{NVRAM|EEPROM|FLASH|DATAFLASH|NOWHERE}
# error Define one of CFG_ENV_IS_IN_{NVRAM|EEPROM|FLASH|NOWHERE}
#endif
#define XMK_STR(x) #x
@ -155,10 +154,8 @@ int do_printenv (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
int _do_setenv (int flag, int argc, char *argv[])
{
int i, len, oldval;
int console = -1;
uchar *env, *nxt = NULL;
char *name;
bd_t *bd = gd->bd;
uchar *env_data = env_get_addr(0);
@ -204,31 +201,6 @@ int _do_setenv (int flag, int argc, char *argv[])
}
#endif
/* Check for console redirection */
if (strcmp(name,"stdin") == 0) {
console = stdin;
} else if (strcmp(name,"stdout") == 0) {
console = stdout;
} else if (strcmp(name,"stderr") == 0) {
console = stderr;
}
if (console != -1) {
if (argc < 3) { /* Cannot delete it! */
printf("Can't delete \"%s\"\n", name);
return 1;
}
/* Try assigning specified device */
if (console_assign (console, argv[2]) < 0)
return 1;
#ifdef CONFIG_SERIAL_MULTI
if (serial_assign (argv[2]) < 0)
return 1;
#endif
}
/*
* Switch to new baudrate if new baudrate is supported
*/
@ -336,33 +308,6 @@ int _do_setenv (int flag, int argc, char *argv[])
* entry in the enviornment is changed
*/
if (strcmp(argv[1],"ethaddr") == 0) {
char *s = argv[2]; /* always use only one arg */
char *e;
for (i=0; i<6; ++i) {
bd->bi_enetaddr[i] = s ? simple_strtoul(s, &e, 16) : 0;
if (s) s = (*e) ? e+1 : e;
}
#ifdef CONFIG_NET_MULTI
eth_set_enetaddr(0, argv[2]);
#endif
return 0;
}
if (strcmp(argv[1],"ipaddr") == 0) {
char *s = argv[2]; /* always use only one arg */
char *e;
unsigned long addr;
bd->bi_ip_addr = 0;
for (addr=0, i=0; i<4; ++i) {
ulong val = s ? simple_strtoul(s, &e, 10) : 0;
addr <<= 8;
addr |= (val & 0xFF);
if (s) s = (*e) ? e+1 : e;
}
bd->bi_ip_addr = htonl(addr);
return 0;
}
if (strcmp(argv[1],"loadaddr") == 0) {
load_addr = simple_strtoul(argv[2], NULL, 16);
return 0;
@ -374,17 +319,6 @@ int _do_setenv (int flag, int argc, char *argv[])
}
#endif /* CFG_CMD_NET */
#ifdef CONFIG_AMIGAONEG3SE
if (strcmp(argv[1], "vga_fg_color") == 0 ||
strcmp(argv[1], "vga_bg_color") == 0 ) {
extern void video_set_color(unsigned char attr);
extern unsigned char video_get_attr(void);
video_set_color(video_get_attr());
return 0;
}
#endif /* CONFIG_AMIGAONEG3SE */
return 0;
}

View File

@ -48,51 +48,6 @@ extern int overwrite_console (void);
#endif /* CFG_CONSOLE_IS_IN_ENV */
static int console_setfile (int file, device_t * dev)
{
int error = 0;
if (dev == NULL)
return -1;
switch (file) {
case stdin:
case stdout:
case stderr:
/* Start new device */
if (dev->start) {
error = dev->start ();
/* If it's not started dont use it */
if (error < 0)
break;
}
/* Assign the new device (leaving the existing one started) */
stdio_devices[file] = dev;
/*
* Update monitor functions
* (to use the console stuff by other applications)
*/
switch (file) {
case stdin:
gd->jt[XF_getc] = dev->getc;
gd->jt[XF_tstc] = dev->tstc;
break;
case stdout:
gd->jt[XF_putc] = dev->putc;
gd->jt[XF_puts] = dev->puts;
gd->jt[XF_printf] = printf;
break;
}
break;
default: /* Invalid file ID */
error = -1;
}
return error;
}
/** U-Boot INITIAL CONSOLE-NOT COMPATIBLE FUNCTIONS *************************/
void serial_printf (const char *fmt, ...)
@ -111,7 +66,7 @@ void serial_printf (const char *fmt, ...)
serial_puts (printbuffer);
}
#if 0
int fgetc (int file)
{
if (file < MAX_FILES)
@ -157,28 +112,16 @@ void fprintf (int file, const char *fmt, ...)
/* Send to desired file */
fputs (file, printbuffer);
}
#endif
/** U-Boot INITIAL CONSOLE-COMPATIBLE FUNCTION *****************************/
int getc (void)
{
if (gd->flags & GD_FLG_DEVINIT) {
/* Get from the standard input */
return fgetc (stdin);
}
/* Send directly to the handler */
return serial_getc ();
}
int tstc (void)
{
if (gd->flags & GD_FLG_DEVINIT) {
/* Test the standard input */
return ftstc (stdin);
}
/* Send directly to the handler */
return serial_tstc ();
}
@ -189,13 +132,7 @@ void putc (const char c)
return;
#endif
if (gd->flags & GD_FLG_DEVINIT) {
/* Send to the standard output */
fputc (stdout, c);
} else {
/* Send directly to the handler */
serial_putc (c);
}
serial_putc (c);
}
void puts (const char *s)
@ -205,13 +142,7 @@ void puts (const char *s)
return;
#endif
if (gd->flags & GD_FLG_DEVINIT) {
/* Send to the standard output */
fputs (stdout, s);
} else {
/* Send directly to the handler */
serial_puts (s);
}
serial_puts (s);
}
void printf (const char *fmt, ...)
@ -286,78 +217,6 @@ void clear_ctrlc (void)
ctrlc_was_pressed = 0;
}
#ifdef CONFIG_MODEM_SUPPORT_DEBUG
char screen[1024];
char *cursor = screen;
int once = 0;
inline void dbg(const char *fmt, ...)
{
va_list args;
uint i;
char printbuffer[CFG_PBSIZE];
if (!once) {
memset(screen, 0, sizeof(screen));
once++;
}
va_start(args, fmt);
/* For this to work, printbuffer must be larger than
* anything we ever want to print.
*/
i = vsprintf(printbuffer, fmt, args);
va_end(args);
if ((screen + sizeof(screen) - 1 - cursor) < strlen(printbuffer)+1) {
memset(screen, 0, sizeof(screen));
cursor = screen;
}
sprintf(cursor, printbuffer);
cursor += strlen(printbuffer);
}
#else
inline void dbg(const char *fmt, ...)
{
}
#endif
/** U-Boot INIT FUNCTIONS *************************************************/
int console_assign (int file, char *devname)
{
int flag, i;
/* Check for valid file */
switch (file) {
case stdin:
flag = DEV_FLAGS_INPUT;
break;
case stdout:
case stderr:
flag = DEV_FLAGS_OUTPUT;
break;
default:
return -1;
}
/* Check for valid device name */
for (i = 1; i <= ListNumItems (devlist); i++) {
device_t *dev = ListGetPtrToItem (devlist, i);
if (strcmp (devname, dev->name) == 0) {
if (dev->flags & flag)
return console_setfile (file, dev);
return -1;
}
}
return -1;
}
/* Called before relocation - use serial functions */
int console_init_f (void)
{
@ -370,193 +229,3 @@ int console_init_f (void)
return (0);
}
#if defined(CFG_CONSOLE_IS_IN_ENV) || defined(CONFIG_SPLASH_SCREEN) || defined(CONFIG_SILENT_CONSOLE)
/* search a device */
device_t *search_device (int flags, char *name)
{
int i, items;
device_t *dev = NULL;
items = ListNumItems (devlist);
if (name == NULL)
return dev;
for (i = 1; i <= items; i++) {
dev = ListGetPtrToItem (devlist, i);
if ((dev->flags & flags) && (strcmp (name, dev->name) == 0)) {
break;
}
}
return dev;
}
#endif /* CFG_CONSOLE_IS_IN_ENV || CONFIG_SPLASH_SCREEN */
#ifdef CFG_CONSOLE_IS_IN_ENV
/* Called after the relocation - use desired console functions */
int console_init_r (void)
{
char *stdinname, *stdoutname, *stderrname;
device_t *inputdev = NULL, *outputdev = NULL, *errdev = NULL;
#ifdef CFG_CONSOLE_ENV_OVERWRITE
int i;
#endif /* CFG_CONSOLE_ENV_OVERWRITE */
/* set default handlers at first */
gd->jt[XF_getc] = serial_getc;
gd->jt[XF_tstc] = serial_tstc;
gd->jt[XF_putc] = serial_putc;
gd->jt[XF_puts] = serial_puts;
gd->jt[XF_printf] = serial_printf;
/* stdin stdout and stderr are in environment */
/* scan for it */
stdinname = getenv ("stdin");
stdoutname = getenv ("stdout");
stderrname = getenv ("stderr");
if (OVERWRITE_CONSOLE == 0) { /* if not overwritten by config switch */
inputdev = search_device (DEV_FLAGS_INPUT, stdinname);
outputdev = search_device (DEV_FLAGS_OUTPUT, stdoutname);
errdev = search_device (DEV_FLAGS_OUTPUT, stderrname);
}
/* if the devices are overwritten or not found, use default device */
if (inputdev == NULL) {
inputdev = search_device (DEV_FLAGS_INPUT, "serial");
}
if (outputdev == NULL) {
outputdev = search_device (DEV_FLAGS_OUTPUT, "serial");
}
if (errdev == NULL) {
errdev = search_device (DEV_FLAGS_OUTPUT, "serial");
}
/* Initializes output console first */
if (outputdev != NULL) {
console_setfile (stdout, outputdev);
}
if (errdev != NULL) {
console_setfile (stderr, errdev);
}
if (inputdev != NULL) {
console_setfile (stdin, inputdev);
}
gd->flags |= GD_FLG_DEVINIT; /* device initialization completed */
#ifndef CFG_CONSOLE_INFO_QUIET
/* Print information */
puts ("In: ");
if (stdio_devices[stdin] == NULL) {
puts ("No input devices available!\n");
} else {
printf ("%s\n", stdio_devices[stdin]->name);
}
puts ("Out: ");
if (stdio_devices[stdout] == NULL) {
puts ("No output devices available!\n");
} else {
printf ("%s\n", stdio_devices[stdout]->name);
}
puts ("Err: ");
if (stdio_devices[stderr] == NULL) {
puts ("No error devices available!\n");
} else {
printf ("%s\n", stdio_devices[stderr]->name);
}
#endif /* CFG_CONSOLE_INFO_QUIET */
#ifdef CFG_CONSOLE_ENV_OVERWRITE
/* set the environment variables (will overwrite previous env settings) */
for (i = 0; i < 3; i++) {
setenv (stdio_names[i], stdio_devices[i]->name);
}
#endif /* CFG_CONSOLE_ENV_OVERWRITE */
return (0);
}
#else /* CFG_CONSOLE_IS_IN_ENV */
/* Called after the relocation - use desired console functions */
int console_init_r (void)
{
device_t *inputdev = NULL, *outputdev = NULL;
int i, items = ListNumItems (devlist);
#ifdef CONFIG_SPLASH_SCREEN
/* suppress all output if splash screen is enabled and we have
a bmp to display */
if (getenv("splashimage") != NULL)
outputdev = search_device (DEV_FLAGS_OUTPUT, "nulldev");
#endif
#ifdef CONFIG_SILENT_CONSOLE
/* Suppress all output if "silent" mode requested */
if (gd->flags & GD_FLG_SILENT)
outputdev = search_device (DEV_FLAGS_OUTPUT, "nulldev");
#endif
/* Scan devices looking for input and output devices */
for (i = 1;
(i <= items) && ((inputdev == NULL) || (outputdev == NULL));
i++
) {
device_t *dev = ListGetPtrToItem (devlist, i);
if ((dev->flags & DEV_FLAGS_INPUT) && (inputdev == NULL)) {
inputdev = dev;
}
if ((dev->flags & DEV_FLAGS_OUTPUT) && (outputdev == NULL)) {
outputdev = dev;
}
}
/* Initializes output console first */
if (outputdev != NULL) {
console_setfile (stdout, outputdev);
console_setfile (stderr, outputdev);
}
/* Initializes input console */
if (inputdev != NULL) {
console_setfile (stdin, inputdev);
}
gd->flags |= GD_FLG_DEVINIT; /* device initialization completed */
#ifndef CFG_CONSOLE_INFO_QUIET
/* Print information */
puts ("In: ");
if (stdio_devices[stdin] == NULL) {
puts ("No input devices available!\n");
} else {
printf ("%s\n", stdio_devices[stdin]->name);
}
puts ("Out: ");
if (stdio_devices[stdout] == NULL) {
puts ("No output devices available!\n");
} else {
printf ("%s\n", stdio_devices[stdout]->name);
}
puts ("Err: ");
if (stdio_devices[stderr] == NULL) {
puts ("No error devices available!\n");
} else {
printf ("%s\n", stdio_devices[stderr]->name);
}
#endif /* CFG_CONSOLE_INFO_QUIET */
/* Setting environment variables */
for (i = 0; i < 3; i++) {
setenv (stdio_names[i], stdio_devices[i]->name);
}
return (0);
}
#endif /* CFG_CONSOLE_IS_IN_ENV */

View File

@ -1,103 +0,0 @@
/* LowLevel function for DataFlash environment support
* Author : Gilles Gastaldi (Atmel)
*
* 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_DATAFLASH) /* Environment is in DataFlash */
#include <command.h>
#include <environment.h>
#include <linux/stddef.h>
#include <dataflash.h>
DECLARE_GLOBAL_DATA_PTR;
env_t *env_ptr = NULL;
char * env_name_spec = "dataflash";
extern int read_dataflash (unsigned long addr, unsigned long size, char
*result);
extern int write_dataflash (unsigned long addr_dest, unsigned long addr_src,
unsigned long size);
extern int AT91F_DataflashInit (void);
extern uchar default_environment[];
/* extern int default_environment_size; */
uchar env_get_char_spec (int index)
{
uchar c;
read_dataflash (CFG_ENV_ADDR+index+offsetof(env_t,data),1,&c);
return (c);
}
void env_relocate_spec (void)
{
read_dataflash (CFG_ENV_ADDR,CFG_ENV_SIZE,(uchar *)env_ptr);
}
int saveenv(void)
{
/* env must be copied to do not alter env structure in memory*/
unsigned char temp[CFG_ENV_SIZE];
int i;
memcpy(temp, env_ptr, CFG_ENV_SIZE);
return write_dataflash (CFG_ENV_ADDR, (unsigned long)temp, CFG_ENV_SIZE);
}
/************************************************************************
* Initialize Environment use
*
* We are still running from ROM, so data use is limited
* Use a (moderately small) buffer on the stack
*/
int env_init(void)
{
ulong crc, len, new;
unsigned off;
uchar buf[64];
if (gd->env_valid == 0){
AT91F_DataflashInit(); /* prepare for DATAFLASH read/write */
/* read old CRC */
read_dataflash (CFG_ENV_ADDR+offsetof(env_t,crc),sizeof(ulong),&crc);
new = 0;
len = ENV_SIZE;
off = offsetof(env_t,data);
while (len > 0) {
int n = (len > sizeof(buf)) ? sizeof(buf) : len;
read_dataflash (CFG_ENV_ADDR+off,n , buf);
new = crc32 (new, buf, n);
len -= n;
off += n;
}
if (crc == new) {
gd->env_addr = offsetof(env_t,data);
gd->env_valid = 1;
} else {
gd->env_addr = (ulong)&default_environment[0];
gd->env_valid = 0;
}
}
return (0);
}
#endif /* CFG_ENV_IS_IN_DATAFLASH */

View File

@ -176,10 +176,10 @@ int saveenv(void)
puts ("Erasing Flash...");
debug (" %08lX ... %08lX ...",
(ulong)flash_addr_new, end_addr_new);
if (flash_sect_erase ((ulong)flash_addr_new, end_addr_new)) {
goto Done;
}
#warning saveenv is broken
// if (flash_sect_erase ((ulong)flash_addr_new, end_addr_new)) {
// goto Done;
// }
puts ("Writing to Flash... ");
debug (" %08lX ... %08lX ...",
@ -232,8 +232,8 @@ Done:
if (saved_data)
free (saved_data);
/* try to re-protect */
(void) flash_sect_protect (1, (ulong)flash_addr, end_addr);
(void) flash_sect_protect (1, (ulong)flash_addr_new, end_addr_new);
// (void) flash_sect_protect (1, (ulong)flash_addr, end_addr);
// (void) flash_sect_protect (1, (ulong)flash_addr_new, end_addr_new);
return rc;
}
@ -302,12 +302,12 @@ int saveenv(void)
debug ("Protect off %08lX ... %08lX\n",
(ulong)flash_sect_addr, end_addr);
if (flash_sect_protect (0, flash_sect_addr, end_addr))
return 1;
// if (flash_sect_protect (0, flash_sect_addr, end_addr))
// return 1;
puts ("Erasing Flash...");
if (flash_sect_erase (flash_sect_addr, end_addr))
return 1;
// if (flash_sect_erase (flash_sect_addr, end_addr))
// return 1;
puts ("Writing to Flash... ");
rc = flash_write((char *)env_buffer, flash_sect_addr, len);
@ -319,7 +319,7 @@ int saveenv(void)
}
/* try to re-protect */
(void) flash_sect_protect (1, flash_sect_addr, end_addr);
// (void) flash_sect_protect (1, flash_sect_addr, end_addr);
return rcode;
}

View File

@ -24,170 +24,20 @@
/* #define DEBUG */
#include <common.h>
#include <command.h>
#include <flash.h>
#if !defined(CFG_NO_FLASH)
#include <cfi_flash.h>
extern flash_info_t flash_info[]; /* info for FLASH chips */
/*-----------------------------------------------------------------------
* Functions
*/
/*-----------------------------------------------------------------------
* Set protection status for monitor sectors
*
* The monitor is always located in the _first_ Flash bank.
* If necessary you have to map the second bank at lower addresses.
*/
void
flash_protect (int flag, ulong from, ulong to, flash_info_t *info)
{
ulong b_end = info->start[0] + info->size - 1; /* bank end address */
short s_end = info->sector_count - 1; /* index of last sector */
int i;
debug ("flash_protect %s: from 0x%08lX to 0x%08lX\n",
(flag & FLAG_PROTECT_SET) ? "ON" :
(flag & FLAG_PROTECT_CLEAR) ? "OFF" : "???",
from, to);
/* Do nothing if input data is bad. */
if (info->sector_count == 0 || info->size == 0 || to < from) {
return;
}
/* There is nothing to do if we have no data about the flash
* or the protect range and flash range don't overlap.
*/
if (info->flash_id == FLASH_UNKNOWN ||
to < info->start[0] || from > b_end) {
return;
}
for (i=0; i<info->sector_count; ++i) {
ulong end; /* last address in current sect */
end = (i == s_end) ? b_end : info->start[i + 1] - 1;
/* Update protection if any part of the sector
* is in the specified range.
*/
if (from <= end && to >= info->start[i]) {
if (flag & FLAG_PROTECT_CLEAR) {
#if defined(CFG_FLASH_PROTECTION)
flash_real_protect(info, i, 0);
#else
info->protect[i] = 0;
#endif /* CFG_FLASH_PROTECTION */
debug ("protect off %d\n", i);
}
else if (flag & FLAG_PROTECT_SET) {
#if defined(CFG_FLASH_PROTECTION)
flash_real_protect(info, i, 1);
#else
info->protect[i] = 1;
#endif /* CFG_FLASH_PROTECTION */
debug ("protect on %d\n", i);
}
}
}
}
/*-----------------------------------------------------------------------
*/
flash_info_t *
addr2info (ulong addr)
{
#ifndef CONFIG_SPD823TS
flash_info_t *info;
int i;
for (i=0, info=&flash_info[0]; i<CFG_MAX_FLASH_BANKS; ++i, ++info) {
if (info->flash_id != FLASH_UNKNOWN &&
addr >= info->start[0] &&
/* WARNING - The '- 1' is needed if the flash
* is at the end of the address space, since
* info->start[0] + info->size wraps back to 0.
* Please don't change this unless you understand this.
*/
addr <= info->start[0] + info->size - 1) {
return (info);
}
}
#endif /* CONFIG_SPD823TS */
printf("%s is broken\n",__FUNCTION__);
return (NULL);
}
/*-----------------------------------------------------------------------
* Copy memory to flash.
* Make sure all target addresses are within Flash bounds,
* and no protected sectors are hit.
* Returns:
* ERR_OK 0 - OK
* ERR_TIMOUT 1 - write timeout
* ERR_NOT_ERASED 2 - Flash not erased
* ERR_PROTECTED 4 - target range includes protected sectors
* ERR_INVAL 8 - target address not in Flash memory
* ERR_ALIGN 16 - target address not aligned on boundary
* (only some targets require alignment)
*/
int
flash_write (char *src, ulong addr, ulong cnt)
{
#ifdef CONFIG_SPD823TS
return (ERR_TIMOUT); /* any other error codes are possible as well */
#else
int i;
ulong end = addr + cnt - 1;
flash_info_t *info_first = addr2info (addr);
flash_info_t *info_last = addr2info (end );
flash_info_t *info;
if (cnt == 0) {
return (ERR_OK);
}
if (!info_first || !info_last) {
return (ERR_INVAL);
}
for (info = info_first; info <= info_last; ++info) {
ulong b_end = info->start[0] + info->size; /* bank end addr */
short s_end = info->sector_count - 1;
for (i=0; i<info->sector_count; ++i) {
ulong e_addr = (i == s_end) ? b_end : info->start[i + 1];
if ((end >= info->start[i]) && (addr < e_addr) &&
(info->protect[i] != 0) ) {
return (ERR_PROTECTED);
}
}
}
/* finally write data to flash */
for (info = info_first; info <= info_last && cnt>0; ++info) {
ulong len;
len = info->start[0] + info->size - addr;
if (len > cnt)
len = cnt;
if ((i = write_buff(info, (uchar *)src, addr, len)) != 0) {
return (i);
}
cnt -= len;
addr += len;
src += len;
}
return (ERR_OK);
#endif /* CONFIG_SPD823TS */
}
/*-----------------------------------------------------------------------
*/
void flash_perror (int err)
{
switch (err) {
@ -222,7 +72,3 @@ void flash_perror (int err)
break;
}
}
/*-----------------------------------------------------------------------
*/
#endif /* !CFG_NO_FLASH */

View File

@ -1,8 +1,8 @@
obj-y += bcm5221.o
obj-y += dm9161.o
obj-y += i2c.o
obj-y += interrupts.o
obj-y += lowlevel_init.o
obj-y += lxt972.o
obj-$(CONFIG_DRIVER_NET_AT91_ETHER) += bcm5221.o
obj-$(CONFIG_DRIVER_NET_AT91_ETHER) += dm9161.o
obj-$(CONFIG_DRIVER_NET_AT91_I2C) += i2c.o
obj-y += interrupts.o
obj-y += lowlevel_init.o
obj-$(CONFIG_DRIVER_NET_AT91_ETHER) += lxt972.o
obj-y += serial.o
obj-y += usb_ohci.o
# obj-y += usb_ohci.o

View File

@ -2,6 +2,8 @@ menu "drivers"
source "drivers/serial/Kconfig"
source "drivers/net/Kconfig"
source "drivers/video/Kconfig"
source "drivers/i2c/Kconfig"
config HAS_CFI
bool

View File

@ -1,3 +1,4 @@
obj-y += net/
obj-y += serial/
obj-y += video/
obj-$(CONFIG_DRIVER_CFI) += cfi_flash.o

View File

@ -39,7 +39,7 @@
#include <asm/byteorder.h>
#include <environment.h>
#include <clock.h>
#ifdef CFG_FLASH_CFI_DRIVER
#include <cfi_flash.h>
/*
* This file implements a Common Flash Interface (CFI) driver for U-Boot.
@ -158,15 +158,6 @@ typedef union {
static uint flash_offset_cfi[2]={FLASH_OFFSET_CFI,FLASH_OFFSET_CFI_ALT};
/* use CFG_MAX_FLASH_BANKS_DETECT if defined */
#ifdef CFG_MAX_FLASH_BANKS_DETECT
static ulong bank_base[CFG_MAX_FLASH_BANKS_DETECT] = CFG_FLASH_BANKS_LIST;
flash_info_t flash_info[CFG_MAX_FLASH_BANKS_DETECT]; /* FLASH chips info */
#else
static ulong bank_base[CFG_MAX_FLASH_BANKS] = CFG_FLASH_BANKS_LIST;
flash_info_t flash_info[CFG_MAX_FLASH_BANKS]; /* FLASH chips info */
#endif
/*
* Check if chip width is defined. If not, start detecting with 8bit.
*/
@ -193,7 +184,7 @@ static int flash_detect_cfi (flash_info_t * info);
static int flash_write_cfiword (flash_info_t * info, ulong dest, cfiword_t cword);
static int flash_full_status_check (flash_info_t * info, flash_sect_t sector,
uint64_t tout, char *prompt);
ulong flash_get_size (ulong base, int banknum);
ulong flash_get_size (flash_info_t *info, ulong base);
#if defined(CFG_ENV_IS_IN_FLASH) || defined(CFG_ENV_ADDR_REDUND) || (CFG_MONITOR_BASE >= CFG_FLASH_BASE)
static flash_info_t *flash_get_info(ulong base);
#endif
@ -331,176 +322,111 @@ ulong flash_read_long (flash_info_t * info, flash_sect_t sect, uint offset)
/*-----------------------------------------------------------------------
*/
unsigned long flash_init (void)
int cfi_probe (struct device_d *dev)
{
unsigned long size = 0;
int i;
struct cfi_platform_data *pdev = (struct cfi_platform_data *)dev->platform_data;
flash_info_t *info = &pdev->finfo;
#ifdef CFG_FLASH_PROTECTION
char *s = getenv("unlock");
#endif
dev->map_flags = MAP_READ;
printf("cfi_probe: %s base: 0x%08x size: 0x%08x\n", dev->name, dev->map_base, dev->size);
/* Init: no FLASHes known */
for (i = 0; i < CFG_MAX_FLASH_BANKS; ++i) {
flash_info[i].flash_id = FLASH_UNKNOWN;
size += flash_info[i].size = flash_get_size (bank_base[i], i);
if (flash_info[i].flash_id == FLASH_UNKNOWN) {
info->flash_id = FLASH_UNKNOWN;
size += info->size = flash_get_size(info, dev->map_base);
if (info->flash_id == FLASH_UNKNOWN) {
#ifndef CFG_FLASH_QUIET_TEST
printf ("## Unknown FLASH on Bank %d - Size = 0x%08lx = %ld MB\n",
i+1, flash_info[i].size, flash_info[i].size << 20);
printf ("## Unknown FLASH on Bank at 0x%08x - Size = 0x%08lx = %ld MB\n",
dev->map_base, info->size, info->size << 20);
#endif /* CFG_FLASH_QUIET_TEST */
}
#ifdef CFG_FLASH_PROTECTION
else if ((s != NULL) && (strcmp(s, "yes") == 0)) {
/*
* Only the U-Boot image and it's environment is protected,
* all other sectors are unprotected (unlocked) if flash
* hardware protection is used (CFG_FLASH_PROTECTION) and
* the environment variable "unlock" is set to "yes".
*/
if (flash_info[i].legacy_unlock) {
int k;
/*
* Disable legacy_unlock temporarily, since
* flash_real_protect would relock all other sectors
* again otherwise.
*/
flash_info[i].legacy_unlock = 0;
/*
* Legacy unlocking (e.g. Intel J3) -> unlock only one
* sector. This will unlock all sectors.
*/
flash_real_protect (&flash_info[i], 0, 0);
flash_info[i].legacy_unlock = 1;
/*
* Manually mark other sectors as unlocked (unprotected)
*/
for (k = 1; k < flash_info[i].sector_count; k++)
flash_info[i].protect[k] = 0;
} else {
/*
* No legancy unlocking -> unlock all sectors
*/
flash_protect (FLAG_PROTECT_CLEAR,
flash_info[i].start[0],
flash_info[i].start[0] + flash_info[i].size - 1,
&flash_info[i]);
}
}
#endif /* CFG_FLASH_PROTECTION */
}
/* Monitor protection ON by default */
#if (CFG_MONITOR_BASE >= CFG_FLASH_BASE)
flash_protect (FLAG_PROTECT_SET,
CFG_MONITOR_BASE,
CFG_MONITOR_BASE + monitor_flash_len - 1,
flash_get_info(CFG_MONITOR_BASE));
#endif
/* Environment protection ON by default */
#ifdef CFG_ENV_IS_IN_FLASH
flash_protect (FLAG_PROTECT_SET,
CFG_ENV_ADDR,
CFG_ENV_ADDR + CFG_ENV_SECT_SIZE - 1,
flash_get_info(CFG_ENV_ADDR));
#endif
/* Redundant environment protection ON by default */
#ifdef CFG_ENV_ADDR_REDUND
flash_protect (FLAG_PROTECT_SET,
CFG_ENV_ADDR_REDUND,
CFG_ENV_ADDR_REDUND + CFG_ENV_SIZE_REDUND - 1,
flash_get_info(CFG_ENV_ADDR_REDUND));
#endif
return (size);
return 0;
}
/*-----------------------------------------------------------------------
*/
#if defined(CFG_ENV_IS_IN_FLASH) || defined(CFG_ENV_ADDR_REDUND) || (CFG_MONITOR_BASE >= CFG_FLASH_BASE)
static flash_info_t *flash_get_info(ulong base)
static int flash_find_sector(flash_info_t * info, unsigned long adr)
{
int i;
flash_info_t * info = 0;
int i;
unsigned long end;
for (i = 0; i < CFG_MAX_FLASH_BANKS; i ++) {
info = & flash_info[i];
if (info->size && info->start[0] <= base &&
base <= info->start[0] + info->size - 1)
break;
}
return i == CFG_MAX_FLASH_BANKS ? 0 : info;
for (i = 0; i < info->sector_count; i++) {
if (i == info->sector_count)
end = info->start[0] + info->size - 1;
else
end = info->start[i + 1] - 1;
if (adr >= info->start[i] && adr <= end)
return i;
}
return -1;
}
#endif
/*-----------------------------------------------------------------------
*/
int flash_erase (flash_info_t * info, int s_first, int s_last)
int flash_erase_one (flash_info_t * info, long sect)
{
int rcode = 0;
int prot;
flash_sect_t sect;
if (info->flash_id != FLASH_MAN_CFI) {
puts ("Can't erase unknown flash type - aborted\n");
return 1;
}
if ((s_first < 0) || (s_first > s_last)) {
puts ("- no sectors to erase\n");
return 1;
switch (info->vendor) {
case CFI_CMDSET_INTEL_STANDARD:
case CFI_CMDSET_INTEL_EXTENDED:
flash_write_cmd (info, sect, 0, FLASH_CMD_CLEAR_STATUS);
flash_write_cmd (info, sect, 0, FLASH_CMD_BLOCK_ERASE);
flash_write_cmd (info, sect, 0, FLASH_CMD_ERASE_CONFIRM);
break;
case CFI_CMDSET_AMD_STANDARD:
case CFI_CMDSET_AMD_EXTENDED:
flash_unlock_seq (info, sect);
flash_write_cmd (info, sect, AMD_ADDR_ERASE_START,
AMD_CMD_ERASE_START);
flash_unlock_seq (info, sect);
flash_write_cmd (info, sect, 0, AMD_CMD_ERASE_SECTOR);
break;
default:
debug ("Unkown flash vendor %d\n",
info->vendor);
break;
}
if (flash_full_status_check
(info, sect, info->erase_blk_tout, "erase")) {
rcode = 1;
} else
putc ('.');
prot = 0;
for (sect = s_first; sect <= s_last; ++sect) {
if (info->protect[sect]) {
prot++;
}
}
if (prot) {
printf ("- Warning: %d protected sectors will not be erased!\n", prot);
} else {
putc ('\n');
}
return rcode;
}
int cfi_erase(struct device_d *dev, struct memarea_info *mem)
{
struct cfi_platform_data *pdata = dev->platform_data;
flash_info_t *finfo = &pdata->finfo;
unsigned long start, end;
for (sect = s_first; sect <= s_last; sect++) {
if (info->protect[sect] == 0) { /* not protected */
switch (info->vendor) {
case CFI_CMDSET_INTEL_STANDARD:
case CFI_CMDSET_INTEL_EXTENDED:
flash_write_cmd (info, sect, 0, FLASH_CMD_CLEAR_STATUS);
flash_write_cmd (info, sect, 0, FLASH_CMD_BLOCK_ERASE);
flash_write_cmd (info, sect, 0, FLASH_CMD_ERASE_CONFIRM);
break;
case CFI_CMDSET_AMD_STANDARD:
case CFI_CMDSET_AMD_EXTENDED:
flash_unlock_seq (info, sect);
flash_write_cmd (info, sect, AMD_ADDR_ERASE_START,
AMD_CMD_ERASE_START);
flash_unlock_seq (info, sect);
flash_write_cmd (info, sect, 0, AMD_CMD_ERASE_SECTOR);
break;
default:
debug ("Unkown flash vendor %d\n",
info->vendor);
break;
}
printf("start: 0x%08x\n",mem->start);
printf("end: 0x%08x\n",mem->end);
printf("base: 0x%08x\n",mem->device->map_base);
start = flash_find_sector(finfo, mem->start + mem->device->map_base);
end = flash_find_sector(finfo, mem->end + mem->device->map_base);
if (flash_full_status_check
(info, sect, info->erase_blk_tout, "erase")) {
rcode = 1;
} else
putc ('.');
}
}
puts (" done\n");
return rcode;
printf("would erase sectors %d to %d\n",start, end);
return 0;
}
static ssize_t cfi_write(struct device_d* dev, void* buf, size_t count, unsigned long offset) {
printf("cfi_write: buf=0x%08x count=0x%08x offset=0x%08x\n",buf, count, offset);
return count;
}
static struct driver_d cfi_driver = {
.name = "nor",
.probe = cfi_probe,
.write = cfi_write,
.erase = cfi_erase,
};
int flash_init(void)
{
return register_driver(&cfi_driver);
}
/*-----------------------------------------------------------------------
@ -793,10 +719,6 @@ static int flash_status_check (flash_info_t * info, flash_sect_t sector,
{
uint64_t start;
#if CFG_HZ != 1000
tout *= CFG_HZ/1000;
#endif
/* Wait for command completion */
start = get_time_ns();
while (flash_is_busy (info, sector)) {
@ -1176,9 +1098,8 @@ static int flash_detect_cfi (flash_info_t * info)
* The following code cannot be run from FLASH!
*
*/
ulong flash_get_size (ulong base, int banknum)
ulong flash_get_size (flash_info_t *info, ulong base)
{
flash_info_t *info = &flash_info[banknum];
int i, j;
flash_sect_t sect_cnt;
unsigned long sector;
@ -1532,4 +1453,4 @@ static int flash_write_cfibuffer (flash_info_t * info, ulong dest, uchar * cp,
}
}
#endif /* CFG_FLASH_USE_BUFFER_WRITE */
#endif /* CFG_FLASH_CFI */

View File

@ -5,6 +5,7 @@ config HAS_AT91_ETHER
bool
menu "Network drivers"
depends on NET
config DRIVER_NET_CS8900
bool "cs8900 ethernet driver"

View File

@ -38,8 +38,8 @@
typedef struct bd_info {
int bi_baudrate; /* serial console baudrate */
unsigned long bi_ip_addr; /* IP Address */
unsigned char bi_enetaddr[6]; /* Ethernet adress */
// unsigned long bi_ip_addr; /* IP Address */
// unsigned char bi_enetaddr[6]; /* Ethernet adress */
struct environment_s *bi_env;
ulong bi_arch_number; /* unique id for this board */
ulong bi_boot_params; /* where this board expects params */

11
include/cfi_flash.h Normal file
View File

@ -0,0 +1,11 @@
#ifndef __CFI_FLASH_H
#define __CFI_FLASH_H
struct cfi_platform_data {
flash_info_t finfo;
};
int flash_init (void);
#endif /* __CFI_FLASH_H */

View File

@ -148,7 +148,7 @@
#define CONFIG_CMD_DFL (CFG_CMD_ALL & ~CFG_CMD_NONSTD)
#ifndef CONFIG_COMMANDS
#define CONFIG_COMMANDS CONFIG_CMD_DFL
#define CONFIG_COMMANDS 0
#endif

View File

@ -635,4 +635,19 @@ void show_boot_progress (int status);
*/
int cmd_get_data_size(char* arg, int default_size);
#define MEMAREA_SIZE_SPECIFIED 1
struct memarea_info {
struct device_d *device;
unsigned long start;
unsigned long end;
unsigned long size;
unsigned long flags;
};
int spec_str_to_info(const char *str, struct memarea_info *info);
/* Just like simple_strtoul(), but this one honors a K/M/G suffix */
unsigned long strtoul_suffix(const char *str, char **endp, int base);
#endif /* __COMMON_H_ */

View File

@ -91,14 +91,6 @@
#define CONFIG_ZERO_BOOTDELAY_CHECK
/* #define CONFIG_ENV_OVERWRITE 1 */
#if 0
#define CONFIG_COMMANDS \
(CFG_CMD_CONSOLE | CFG_CMD_LOADB | \
CFG_CMD_LOADS | CFG_CMD_MEMORY | CFG_CMD_ENV | \
CFG_CMD_RUN | CFG_CMD_FLASH | CFG_CMD_MISC | \
CFG_CMD_NET | \
CFG_CMD_BOOTD | CFG_CMD_DHCP)
#endif
#define CONFIG_CMDLINE_EDITING 1
#define CONFIG_EXTRA_ENV_SETTINGS \
@ -151,7 +143,6 @@
#define CFG_MAXARGS 32 /* max number of command args */
#define CFG_PBSIZE (CFG_CBSIZE+sizeof(CFG_PROMPT)+16) /* Print Buffer Size */
#define CFG_HZ 1000
#define CLOCK_TICK_RATE AT91C_MASTER_CLOCK/2 /* AT91C_TC0_CMR is implicitly set to */
/* AT91C_TC_TIMER_DIV1_CLOCK */

52
include/driver.h Normal file
View File

@ -0,0 +1,52 @@
#ifndef DRIVER_H
#define DRIVER_H
#define MAX_DRIVER_NAME 16
#define MAP_READ 1
#define MAP_WRITE 2
struct memarea_info;
struct device_d {
char name[MAX_DRIVER_NAME];
unsigned long size;
/* For devices which are directly mapped into memory, i.e. NOR Flash or
* SDRAM.
*/
unsigned long map_base;
unsigned long map_flags;
void *platform_data;
/* The driver for this device */
struct driver_d *driver;
struct device_d *next;
struct partition *part;
};
struct driver_d {
char name[MAX_DRIVER_NAME];
void *priv;
struct driver_d *next;
int (*probe) (struct device_d *);
ssize_t (*read) (struct device_d*, void* buf, size_t count, unsigned long offset);
ssize_t (*write) (struct device_d*, void* buf, size_t count, unsigned long offset);
ssize_t (*erase) (struct device_d*, struct memarea_info *);
};
int register_driver(struct driver_d *);
int register_device(struct device_d *);
void unregister_device(struct device_d *);
struct device_d *device_from_spec_str(const char *str, char **endp);
struct device_d *get_device_by_name(char *name);
#endif /* DRIVER_H */

View File

@ -24,12 +24,15 @@
#ifndef _FLASH_H_
#define _FLASH_H_
#include <driver.h>
#ifndef CFG_NO_FLASH
/*-----------------------------------------------------------------------
* FLASH Info: contains chip specific data, per FLASH bank
*/
typedef struct {
struct driver_d driver;
ulong size; /* total bank size in bytes */
ushort sector_count; /* number of erase units */
ulong flash_id; /* combined device & manufacturer code */
@ -82,9 +85,7 @@ typedef struct {
#define CFI_FLASH_SHIFT_WIDTH 3
/* Prototypes */
extern unsigned long flash_init (void);
extern void flash_print_info (flash_info_t *);
extern int flash_erase (flash_info_t *, int, int);
extern int flash_sect_erase (ulong addr_first, ulong addr_last);
extern int flash_sect_protect (int flag, ulong addr_first, ulong addr_last);

View File

@ -113,9 +113,6 @@ struct eth_device {
extern int eth_initialize(bd_t *bis); /* Initialize network subsystem */
extern int eth_register(struct eth_device* dev);/* Register network device */
extern void eth_try_another(int first_restart); /* Change the device */
#ifdef CONFIG_NET_MULTI
extern void eth_set_current(void); /* set nterface to ethcur var. */
#endif
extern struct eth_device *eth_get_dev(void); /* get the current device MAC */
extern struct eth_device *eth_get_dev_by_name(char *devname); /* get device */
extern int eth_get_dev_index (void); /* get the device index */
@ -324,6 +321,17 @@ extern ushort CDPNativeVLAN; /* CDP returned native VLAN */
extern ushort CDPApplianceVLAN; /* CDP returned appliance VLAN */
extern int NetState; /* Network loop state */
/* ---------- Added by sha ------------ */
extern IPaddr_t NetArpWaitPacketIP;
extern uchar *NetArpWaitPacketMAC;
extern uchar *NetArpWaitTxPacket; /* THE transmit packet */
extern int NetArpWaitTxPacketSize;
extern int NetArpWaitTry;
extern uint64_t NetArpWaitTimerStart;
extern void ArpRequest (void);
/* ------------------------------------ */
#define NETLOOP_CONTINUE 1
#define NETLOOP_RESTART 2
#define NETLOOP_SUCCESS 3
@ -338,20 +346,14 @@ typedef enum { BOOTP, RARP, ARP, TFTP, DHCP, PING, DNS, NFS, CDP, NETCONS, SNTP
/* from net/net.c */
extern char BootFile[128]; /* Boot File name */
#if (CONFIG_COMMANDS & CFG_CMD_PING)
extern IPaddr_t NetPingIP; /* the ip address to ping */
#endif
#if (CONFIG_COMMANDS & CFG_CMD_CDP)
/* when CDP completes these hold the return values */
extern ushort CDPNativeVLAN;
extern ushort CDPApplianceVLAN;
#endif
#if (CONFIG_COMMANDS & CFG_CMD_SNTP)
extern IPaddr_t NetNtpServerIP; /* the ip address to NTP */
extern int NetTimeOffset; /* offset time from UTC */
#endif
/* Initialize the network adapter */
extern int NetLoop(proto_t);

17
include/partition.h Normal file
View File

@ -0,0 +1,17 @@
#ifndef __PARTITION_H
#define __PARTITION_H
struct device_d;
struct partition {
int num;
struct device_d *parent;
struct device_d device;
struct partition *next;
};
#endif /* __PARTITION_H */

View File

@ -1,15 +1,14 @@
obj-y += bzlib.o
obj-y += bzlib_crctable.o
obj-y += bzlib_decompress.o
obj-y += bzlib_huffman.o
obj-y += bzlib_randtable.o
obj-y += crc32.o
obj-y += ctype.o
obj-y += display_options.o
obj-y += ldiv.o
obj-y += string.o
obj-y += vsprintf.o
obj-y += zlib.o
obj-y += div64.o
obj-y += misc.o
obj-$(CONFIG_BZLIB) += bzlib.o
obj-$(CONFIG_BZLIB) += bzlib_crctable.o
obj-$(CONFIG_BZLIB) += bzlib_decompress.o
obj-$(CONFIG_BZLIB) += bzlib_huffman.o
obj-$(CONFIG_BZLIB) += bzlib_randtable.o
obj-y += crc32.o
obj-y += ctype.o
obj-y += display_options.o
obj-y += ldiv.o
obj-y += string.o
obj-y += vsprintf.o
obj-$(CONFIG_ZLIB) += zlib.o
obj-y += div64.o
obj-y += misc.o

View File

@ -1,5 +1,8 @@
#include <common.h>
#include <command.h>
#include <driver.h>
#include <linux/ctype.h>
int cmd_get_data_size(char* arg, int default_size)
{
@ -22,3 +25,327 @@ int cmd_get_data_size(char* arg, int default_size)
}
return default_size;
}
static struct device_d *first_device = NULL;
static struct driver_d *first_driver = NULL;
int do_devinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
struct device_d *dev = first_device;
struct driver_d *drv = first_driver;
printf("devices:\n");
while(dev) {
printf("%10s: base=0x%08x size=0x%08x\n",dev->name, dev->map_base, dev->size);
dev = dev->next;
}
printf("drivers:\n");
while(drv) {
printf("%10s\n",drv->name);
drv = drv->next;
}
return 0;
}
U_BOOT_CMD(
devinfo, 1, 0, do_devinfo,
"devinfo - display info about devices and drivers\n",
""
);
static struct device_d *match_driver(struct driver_d *d, struct device_d *first_dev)
{
struct device_d *device;
if (first_dev)
device = first_dev->next;
else
device = first_device;
while (device) {
if (!strcmp(device->name, d->name))
return device;
device = device->next;
}
return 0;
}
static struct driver_d *match_device(struct device_d *d)
{
struct driver_d *driver = first_driver;
while (driver) {
if (!strcmp(driver->name, d->name))
return driver;
driver = driver->next;
}
return 0;
}
int register_device(struct device_d *new_device)
{
struct driver_d *drv;
struct device_d *dev;
dev = first_device;
printf("register_device: %s\n",new_device->name);
if(!dev) {
first_device = new_device;
} else {
while(dev->next)
dev = dev->next;
}
dev->next = new_device;
new_device->next = 0;
drv = match_device(new_device);
if (drv) {
if (!drv->probe(new_device)) {
printf("setting driver to 0x%08x\n",drv);
new_device->driver = drv;
}
}
return 0;
}
void unregister_device(struct device_d *old_dev)
{
struct device_d *dev;
printf("unregister_device: %s\n",old_dev->name);
dev = first_device;
while (dev) {
if (!strcmp(dev->next->name, old_dev->name)) {
dev->next = old_dev->next;
return;
}
dev = dev->next;
}
}
struct driver_d *get_driver_by_name(char *name)
{
struct driver_d *d;
d = first_driver;
while(d) {
if(!strcmp(name, d->name))
break;
d = d->next;
}
return d;
}
struct device_d *get_device_by_name(char *name)
{
struct device_d *d;
d = first_device;
while(d) {
if(!strcmp(name, d->name))
break;
d = d->next;
}
return d;
}
int register_driver(struct driver_d *new_driver)
{
struct driver_d *drv;
struct device_d *dev = NULL;
drv = first_driver;
printf("register_driver: %s\n",new_driver->name);
if(!drv) {
first_driver = new_driver;
} else {
while(drv->next)
drv = drv->next;
}
drv->next = new_driver;
new_driver->next = 0;
while((dev = match_driver(new_driver, dev))) {
if(!new_driver->probe(dev))
dev->driver = new_driver;
}
return 0;
}
static char devicename_from_spec_str_buf[MAX_DRIVER_NAME];
char *devicename_from_spec_str(const char *str, char **endp)
{
char *buf = devicename_from_spec_str_buf;
const char *end;
int i = 0;
if (isdigit(*str)) {
/* No device name given, use default driver mem */
sprintf(buf, "mem");
end = str;
} else {
/* OK, we have a device name, parse it */
while (*str) {
if (*str == ':') {
str++;
buf[i] = 0;
break;
}
buf[i++] = *str++;
buf[i] = 0;
if (i == MAX_DRIVER_NAME)
return NULL;
}
end = str;
}
if (endp)
*endp = (char *)end;
return buf;
}
/* Get a device struct from the beginning of the string. Default to mem if no
* device is given, return NULL if a unknown device is given.
* If endp is not NULL, this function stores a pointer to the first character
* after the device name in *endp.
*/
struct device_d *device_from_spec_str(const char *str, char **endp)
{
char *name;
name = devicename_from_spec_str(str, endp);
return get_device_by_name(name);
}
unsigned long strtoul_suffix(const char *str, char **endp, int base)
{
unsigned long val;
char *end;
val = simple_strtoul(str, &end, base);
switch (*end) {
case 'G':
val *= 1024;
case 'M':
val *= 1024;
case 'k':
case 'K':
val *= 1024;
end++;
}
if (endp)
*endp = (char *)end;
return val;
}
/*
* Parse a string representing a memory area and fill in a struct memarea_info.
* FIXME: Check for end of devices
*/
int spec_str_to_info(const char *str, struct memarea_info *info)
{
char *endp;
memset(info, 0, sizeof(struct memarea_info));
info->device = device_from_spec_str(str, &endp);
if (!info->device) {
printf("unknown device: %s\n", devicename_from_spec_str(str, NULL));
return 1;
}
str = endp;
if (!*str) {
/* no area specification given, use whole device */
info->size = info->device->size;
info->end = info->size - 1;
goto out;
}
if (*str == '+') {
/* no beginning given but size so start is 0 */
info->size = strtoul_suffix(str + 1, &endp, 0);
info->end = info->size - 1;
info->flags = MEMAREA_SIZE_SPECIFIED;
goto out;
}
if (*str == '-') {
/* no beginning given but end, so start is 0 */
info->end = strtoul_suffix(str + 1, &endp, 0);
info->size = info->end + 1;
info->flags = MEMAREA_SIZE_SPECIFIED;
goto out;
}
str = endp;
info->start = strtoul_suffix(str, &endp, 0);
str = endp;
if (info->start >= info->device->size) {
printf("Start address is beyond device\n");
return -1;
}
if (!*str) {
/* beginning given, but no size, pad to the and of the device */
info->end = info->device->size - 1;
info->size = info->end - info->start + 1;
goto out;
}
if (*str == '-') {
/* beginning and end given */
info->end = strtoul_suffix(str + 1, NULL, 0);
info->size = info->end - info->start + 1;
if (info->end < info->start) {
printf("end < start\n");
return -1;
}
info->flags = MEMAREA_SIZE_SPECIFIED;
goto out;
}
if (*str == '+') {
/* beginning and size given */
info->size = strtoul_suffix(str + 1, NULL, 0);
info->end = info->start + info->size - 1;
info->flags = MEMAREA_SIZE_SPECIFIED;
goto out;
}
out:
/* check for device boundaries */
if (info->end > info->device->size) {
info->end = info->device->size - 1;
info->size = info->end - info->start + 1;
}
#if 1
printf("start: 0x%08x\n",info->start);
printf("size: 0x%08x\n",info->size);
printf("end: 0x%08x\n",info->end);
#endif
return 0;
}

30
net/Kconfig Normal file
View File

@ -0,0 +1,30 @@
menuconfig NET
bool "Networking support"
if NET
config NET_DHCP
bool
prompt "dhcp support"
config NET_RARP
bool
prompt "rarp protocol support"
config NET_SNTP
bool
prompt "sntp support"
config NET_NFS
bool
prompt "nfs support"
config NET_PING
bool
prompt "ping support"
config NET_TFTP
bool
prompt "tftp support"
endif