示例#1
0
void set_backup_values(int overwrite)
{
	backup_t back;
	int i;

	get_backup_values(&back);
	if(!overwrite) {
		if(strncmp(back.signature,"MPL\0",4)==0) {
			puts("Not possible to write Backup\n");
			return;
		}
	}
	memcpy(back.signature,"MPL\0",4);
	i = getenv_f("serial#",back.serial_name,16);
	if(i < 0) {
		puts("Not possible to write Backup\n");
		return;
	}
	back.serial_name[16]=0;
	i = getenv_f("ethaddr",back.eth_addr,20);
	if(i < 0) {
		puts("Not possible to write Backup\n");
		return;
	}
	back.eth_addr[20]=0;
	i2c_write(CONFIG_SYS_DEF_EEPROM_ADDR, I2C_BACKUP_ADDR,2,(void *)&back,sizeof(backup_t));
}
示例#2
0
文件: hub405.c 项目: 0s4l/u-boot-xlnx
/*
 * Check Board Identity:
 */
int checkboard (void)
{
	char str[64];
	int i = getenv_f("serial#", str, sizeof(str));

	puts ("Board: ");

	if (i == -1) {
		puts ("### No HW ID - assuming HUB405");
	} else {
		puts(str);
	}

	if (getenv_f("bd_type", str, sizeof(str)) != -1) {
		printf(" (%s", str);
	} else {
		puts(" (Missing bd_type!");
	}

	gd->board_type = board_revision();
	printf(", Rev 1.%ld)\n", gd->board_type);

	/*
	 * Disable sleep mode in LXT971
	 */
	lxt971_no_sleep();

	return 0;
}
示例#3
0
int checkboard(void)
{
    char name[] = CONFIG_SYS_BOARD_NAME;
    char buf[64];
    char *s;
    int i;

#ifdef CONFIG_SYS_FORM_CUSTOM
    s = "Custom";
#elif CONFIG_SYS_FORM_6U_CPCI
    s = "6U CompactPCI";
#elif CONFIG_SYS_FORM_ATCA_PMC
    s = "ATCA w/PMC";
#elif CONFIG_SYS_FORM_ATCA_AMC
    s = "ATCA w/AMC";
#elif CONFIG_SYS_FORM_VME
    s = "VME";
#elif CONFIG_SYS_FORM_6U_VPX
    s = "6U VPX";
#elif CONFIG_SYS_FORM_PMC
    s = "PMC";
#elif CONFIG_SYS_FORM_PCI
    s = "PCI";
#elif CONFIG_SYS_FORM_3U_CPCI
    s = "3U CompactPCI";
#elif CONFIG_SYS_FORM_AMC
    s = "AdvancedMC";
#elif CONFIG_SYS_FORM_XMC
    s = "XMC";
#elif CONFIG_SYS_FORM_PMC_XMC
    s = "PMC/XMC";
#elif CONFIG_SYS_FORM_PCI_EXPRESS
    s = "PCI Express";
#elif CONFIG_SYS_FORM_3U_VPX
    s = "3U VPX";
#else
#error "Form factor not defined"
#endif

    name[strlen(name) - 1] += get_board_derivative();
    printf("Board: X-ES %s %s SBC\n", name, s);

    /* Display board specific information */
    puts("       ");
    i = getenv_f("board_rev", buf, sizeof(buf));
    if (i > 0)
        printf("Rev %s, ", buf);
    i = getenv_f("serial#", buf, sizeof(buf));
    if (i > 0)
        printf("Serial# %s, ", buf);
    i = getenv_f("board_cfg", buf, sizeof(buf));
    if (i > 0)
        printf("Cfg %s", buf);
    puts("\n");

    return 0;
}
示例#4
0
/*
 * Check Board Identity:
 */
int checkboard(void)
{
	char buf[64];
	int i = getenv_f("serial#", buf, sizeof(buf));

	puts("Board: Zeus-");

	if (in_be32((void *)GPIO0_IR) & GPIO_VAL(CONFIG_SYS_GPIO_ZEUS_PE))
		puts("PE");
	else
		puts("CE");

	puts(" of BulletEndPoint");

	if (i > 0) {
		puts(", serial# ");
		puts(buf);
	}
	putc('\n');

	/* both LED's off */
	gpio_write_bit(CONFIG_SYS_GPIO_LED_RED, 0);
	gpio_write_bit(CONFIG_SYS_GPIO_LED_GREEN, 0);
	udelay(10000);
	/* and on again */
	gpio_write_bit(CONFIG_SYS_GPIO_LED_RED, 1);
	gpio_write_bit(CONFIG_SYS_GPIO_LED_GREEN, 1);

	return (0);
}
示例#5
0
int checkboard (void)
{
    int index;
    int len;
    char str[64];
    int i = getenv_f("serial#", str, sizeof (str));

    puts ("Board: ");

    if (i == -1) {
        puts ("### No HW ID - assuming AR405");
    } else {
        puts(str);
    }

    puts ("\nFPGA:  ");

    /* display infos on fpgaimage */
    index = 15;
    for (i = 0; i < 4; i++) {
        len = fpgadata[index];
        printf ("%s ", &(fpgadata[index + 1]));
        index += len + 3;
    }

    putc ('\n');

    /*
     * Disable sleep mode in LXT971
     */
    lxt971_no_sleep();

    return 0;
}
示例#6
0
int checkboard (void)
{
	char str[64];
	int flashcnt;
	int delay;

	puts ("Board: ");

	if (getenv_f("serial#", str, sizeof(str))  == -1) {
		puts ("### No HW ID - assuming CMS700");
	} else {
		puts(str);
	}

	printf(" (PLD-Version=%02d)\n",
	       in_8((void *)(CONFIG_SYS_PLD_BASE + 0x1001)));

	/*
	 * Flash LEDs
	 */
	for (flashcnt = 0; flashcnt < 3; flashcnt++) {
		out_8((void *)LED_REG, 0x00); /* LEDs off */
		for (delay = 0; delay < 100; delay++)
			udelay(1000);
		out_8((void *)LED_REG, 0x0f); /* LEDs on */
		for (delay = 0; delay < 50; delay++)
			udelay(1000);
	}
	out_8((void *)LED_REG, 0x70);

	return 0;
}
示例#7
0
文件: hwconfig.c 项目: NVSL/MingII
static const char *__hwconfig(const char *opt, size_t *arglen)
{
	const char *env_hwconfig = NULL;
	char buf[HWCONFIG_PRE_RELOC_BUF_SIZE];

	if (gd->flags & GD_FLG_ENV_READY) {
		env_hwconfig = getenv("hwconfig");
	} else {
		/*
		 * Use our own on stack based buffer before relocation to allow
		 * accessing longer hwconfig strings that might be in the
		 * environment before we've relocated.  This is pretty fragile
		 * on both the use of stack and if the buffer is big enough.
		 * However we will get a warning from getenv_f for the later.
		 */
		if ((getenv_f("hwconfig", buf, sizeof(buf))) > 0)
			env_hwconfig = buf;
	}

	if (env_hwconfig)
		return hwconfig_parse(env_hwconfig, strlen(env_hwconfig),
				      opt, ";", ':', arglen);

	if (board_hwconfig)
		return hwconfig_parse(board_hwconfig, strlen(board_hwconfig),
				      opt, ";", ':', arglen);

	if (cpu_hwconfig)
		return hwconfig_parse(cpu_hwconfig, strlen(cpu_hwconfig),
				      opt, ";", ':', arglen);

	return NULL;
}
示例#8
0
文件: ip860.c 项目: 0s4l/u-boot-xlnx
int checkboard (void)
{
	unsigned char *s, *e;
	unsigned char buf[64];
	int i;

	puts ("Board: ");

	i = getenv_f("serial#", (char *)buf, sizeof (buf));
	s = (i > 0) ? buf : NULL;

	if (!s || strncmp ((char *)s, "IP860", 5)) {
		puts ("### No HW ID - assuming IP860");
	} else {
		for (e = s; *e; ++e) {
			if (*e == ' ')
				break;
		}

		for (; s < e; ++s) {
			putc (*s);
		}
	}

	putc ('\n');

	return (0);
}
static bool add_charger_cmdline(void)
{
	char *cmdline = malloc(COMMAND_LINE_SIZE);
	if (!cmdline) {
		printf("%s: alloc for cmdline fails.\n", __func__);
		return false;
	}
	/*
	 * we need to access before the env is relocated,
	 * gd->env_buf is too small, don't use getenv();
	 */
	if (gd->flags & GD_FLG_ENV_READY) {
		strncpy(cmdline, getenv("bootargs"), COMMAND_LINE_SIZE);
		printf("%s: getenv()\n", __func__);
	} else {
		getenv_f("bootargs", cmdline, COMMAND_LINE_SIZE);
		printf("%s: getenv_f()\n", __func__);
	}
	debug("%s: bootargs = %s\n", __func__, getenv("bootargs"));
	sprintf(cmdline + strlen(cmdline), " androidboot.mode=charger");
	if (setenv("bootargs", cmdline)) {
		printf("%s: set bootargs fails\n", __func__);
		free(cmdline);
		return false;
	}
	debug("%s: bootargs = %s\n", __func__, getenv("bootargs"));

	free(cmdline);
	return true;
}
示例#10
0
int checkboard (void)
{
	char buf[64];
	int i;
	int l = getenv_f("serial#", buf, sizeof(buf));

	puts ("Board: ");

#ifdef SB_ETX094
	gd->board_type = 0; /* 0 = 2SDRAM-Device */
#else
	gd->board_type = 1; /* 1 = 1SDRAM-Device */
#endif

	if (l < 0 || strncmp(buf, "ETX_", 4)) {
		puts ("### No HW ID - assuming ETX_094\n");
		read_hw_vers ();
		return (0);
	}

	for (i = 0; i < l; ++i) {
		if (buf[i] == ' ')
			break;
		putc(buf[i]);
	}
	putc ('\n');

	read_hw_vers ();
	return (0);
}
示例#11
0
int fsl_use_spd(void)
{
	int use_spd = 0;

#ifdef CONFIG_DDR_SPD
	char buffer[HWCONFIG_BUFFER_SIZE];
	char *buf = NULL;

	/*
	 * Extract hwconfig from environment since we have not properly setup
	 * the environment but need it for ddr config params
	 */
	if (getenv_f("hwconfig", buffer, sizeof(buffer)) > 0)
		buf = buffer;

	/* if hwconfig is not enabled, or "sdram" is not defined, use spd */
	if (hwconfig_sub_f("fsl_ddr", "sdram", buf)) {
		if (hwconfig_subarg_cmp_f("fsl_ddr", "sdram", "spd", buf))
			use_spd = 1;
		else if (hwconfig_subarg_cmp_f("fsl_ddr", "sdram",
					       "fixed", buf))
			use_spd = 0;
		else
			use_spd = 1;
	} else
		use_spd = 1;
#endif

	return use_spd;
}
示例#12
0
/*
 * Check Board Identity:
 */
int checkboard (void)
{
	int index;
	int len;
	char str[64];
	int i = getenv_f("serial#", str, sizeof (str));

	puts ("Board: ");

	if (i == -1) {
		puts ("### No HW ID - assuming DU405");
	} else {
		puts (str);
	}

	puts ("\nFPGA:  ");

	/* display infos on fpgaimage */
	index = 15;
	for (i = 0; i < 4; i++) {
		len = fpgadata[index];
		printf ("%s ", &(fpgadata[index + 1]));
		index += len + 3;
	}

	putc ('\n');

	/*
	 * Reset external DUART via FPGA
	 */
	out_8((void *)FPGA_MODE_REG, 0xff); /* reset high active */
	out_8((void *)FPGA_MODE_REG, 0x00); /* low again */

	return 0;
}
示例#13
0
static int init_baudrate(void)
{
	char baudrate[15];
	int i = getenv_f("baudrate", baudrate, sizeof(baudrate));
	gd->bd->bi_baudrate = gd->baudrate = (i > 0)
	    ? simple_strtoul(baudrate, NULL, 10)
	    : CONFIG_BAUDRATE;
	return 0;
}
示例#14
0
文件: board.c 项目: Aorjoa/bootloader
static int init_baudrate(void)
{
	char tmp[64];		/* long enough for environment variables */
	int i = getenv_f("baudrate", tmp, sizeof(tmp));

	gd->baudrate = (i > 0)
	    ? (int)simple_strtoul(tmp, NULL, 10)
	    : CONFIG_BAUDRATE;
	return (0);
}
示例#15
0
int checkboard (void)
{
	char buf[64];
	int i = getenv_f("serial#", buf, sizeof(buf));

	if ((i < 0) || strncmp(buf, "ELPT860", 7))
		printf ("### No HW ID - assuming ELPT860\n");

	return (0);		/* success */
}
示例#16
0
int checkboard(void)
{
	char buf[64];
	int i;

	printf("Board: X-ES %s PMC SBC\n", CONFIG_SYS_BOARD_NAME);
	printf("       ");
	i = getenv_f("board_rev", buf, sizeof(buf));
	if (i > 0)
		printf("Rev %s, ", buf);
	i = getenv_f("serial#", buf, sizeof(buf));
	if (i > 0)
		printf("Serial# %s, ", buf);
	i = getenv_f("board_cfg", buf, sizeof(buf));
	if (i > 0)
		printf("Cfg %s", buf);
	printf("\n");

	return 0;
}
示例#17
0
文件: lwmon5.c 项目: 01hyang/u-boot
/*
 * lwmon5 specific implementation of spl_start_uboot()
 *
 * RETURN
 * 0 if booting into OS is selected (default)
 * 1 if booting into U-Boot is selected
 */
int spl_start_uboot(void)
{
	char s[8];

	env_init();
	getenv_f("boot_os", s, sizeof(s));
	if ((s != NULL) && (strcmp(s, "yes") == 0))
		return 0;

	return 1;
}
示例#18
0
int checkboard(void)
{
#ifndef CONFIG_CPCI405_VER2
	int index;
	int len;
#endif
	char str[64];
	int i = getenv_f("serial#", str, sizeof(str));
	unsigned short ver;

	puts("Board: ");

	if (i == -1)
		puts("### No HW ID - assuming CPCI405");
	else
		puts(str);

	ver = cpci405_version();
	printf(" (Ver %d.x, ", ver);

	if (ctermm2()) {
		char str[4];

		/*
		 * Read board-id and save in env-variable
		 */
		sprintf(str, "%d", *(unsigned char *)0xf0000400);
		setenv("boardid", str);
		printf("CTERM-M2 - Id=%s)", str);
	} else {
		if (cpci405_host())
			puts("PCI Host Version)");
		else
			puts("PCI Adapter Version)");
	}

#ifndef CONFIG_CPCI405_VER2
	puts("\nFPGA:	");

	/* display infos on fpgaimage */
	index = 15;
	for (i = 0; i < 4; i++) {
		len = fpgadata[index];
		printf("%s ", &(fpgadata[index + 1]));
		index += len + 3;
	}
#endif

	putc('\n');
	return 0;
}
示例#19
0
文件: ocotea.c 项目: Brian1013/u-boot
int checkboard (void)
{
	char buf[64];
	int i = getenv_f("serial#", buf, sizeof(buf));

	printf ("Board: Ocotea - AMCC PPC440GX Evaluation Board");
	if (i > 0) {
		puts(", serial# ");
		puts(buf);
	}
	putc ('\n');

	return (0);
}
示例#20
0
int checkboard(void)
{
	char str[32];

	puts("Board            : esd ARM9 HMI Panel - OTC570");
	if (getenv_f("serial#", str, sizeof(str)) > 0) {
		puts(", serial# ");
		puts(str);
	}
	printf("\n");
	printf("Hardware-revision: 1.%d\n", get_hw_rev());
	printf("Mach-type        : %lu\n", gd->bd->bi_arch_number);
	return 0;
}
示例#21
0
文件: icon.c 项目: 01hyang/u-boot
int checkboard(void)
{
	char buf[64];
	int i = getenv_f("serial#", buf, sizeof(buf));

	printf("Board: ICON");
	if (i > 0) {
		puts(", serial# ");
		puts(buf);
	}
	putc('\n');

	return 0;
}
示例#22
0
int checkboard (void)
{
	char str[64];
	int i = getenv_f("serial#", str, sizeof(str));

	puts ("Board: ");

	if (i == -1) {
		puts ("### No HW ID - assuming VOH405");
	} else {
		puts(str);
	}

	if (getenv_f("bd_type", str, sizeof(str)) != -1) {
		printf(" (%s)", str);
	} else {
		puts(" (Missing bd_type!)");
	}

	putc ('\n');

	return 0;
}
示例#23
0
文件: yucca.c 项目: JamesAng/ub
int checkboard (void)
{
	char buf[64];
	int i = getenv_f("serial#", buf, sizeof(buf));

	printf("Board: Yucca - AMCC 440SPe Evaluation Board");
	if (i > 0) {
		puts(", serial# ");
		puts(buf);
	}
	putc('\n');

	return 0;
}
示例#24
0
文件: lwmon5.c 项目: 01hyang/u-boot
int checkboard(void)
{
	char buf[64];
	int i = getenv_f("serial#", buf, sizeof(buf));

	printf("Board: %s", __stringify(CONFIG_HOSTNAME));

	if (i > 0) {
		puts(", serial# ");
		puts(buf);
	}
	putc('\n');

	return (0);
}
示例#25
0
文件: rbc823.c 项目: 0s4l/u-boot-xlnx
int checkboard (void)
{
	char buf[64];
	int i = getenv_f("serial#", buf, sizeof(buf));

	if (i < 0 || strncmp(buf, "TQM8", 4)) {
		printf ("### No HW ID - assuming RBC823\n");
		return (0);
	}

	puts(buf);
	putc('\n');

	return (0);
}
示例#26
0
/*
 * Check Board Identity:
 */
int checkboard(void)
{
	char str[64];
	int i = getenv_f("serial#", str, sizeof(str));

	puts("Board: ");

	if (i == -1)
		puts("### No HW ID - assuming PLU405");
	else
		puts(str);

	putc('\n');
	return 0;
}
示例#27
0
/*
 * Check Board Identity
 */
int checkboard (void)
{
	char buf[64];
	int i = getenv_f("serial#", buf, sizeof(buf));

	puts ("Board: AcTux-3 rev.");
	putc (ACTUX3_BOARDREL + 'A' - 1);

	if (i > 0) {
		puts (", serial# ");
		puts (buf);
	}
	putc ('\n');

	return (0);
}
示例#28
0
phys_size_t initdram (int board_type)
{
	char buf[64];
	int i = getenv_f("dramsize", buf, sizeof(buf));

	if (i > 0) {
		char *s = buf;
		if ((s[0] == '0') && ((s[1] == 'x') || (s[1] == 'X'))) {
			s += 2;
		}
		return (long int)simple_strtoul (s, NULL, 16);
	} else {
		/* give all 64 MB */
		return 64 * 1024 * 1024;
	}
}
示例#29
0
/*
 * Check Board Identity:
 */
int checkboard (void)
{
	char str[64];
	int i = getenv_f("serial#", str, sizeof(str));

	puts ("Board: ");

	if (i == -1) {
		puts ("### No HW ID - assuming UC100");
	} else {
		puts(str);
	}

	printf (" (SWITCH=%1X)\n", board_switch());

	return 0;
}
示例#30
0
int board_mmc_init(bd_t *bd)
{
	struct immap __iomem *im = (struct immap __iomem *)CONFIG_SYS_IMMR;
	char buffer[HWCONFIG_BUFFER_SIZE] = {0};
	int esdhc_hwconfig_enabled = 0;

	if (getenv_f("hwconfig", buffer, sizeof(buffer)) > 0)
		esdhc_hwconfig_enabled = hwconfig_f("esdhc", buffer);

	if (esdhc_hwconfig_enabled == 0)
		return 0;

	clrsetbits_be32(&im->sysconf.sicrl, SICRL_USB_B, SICRL_USB_B_SD);
	clrsetbits_be32(&im->sysconf.sicrh, SICRH_SPI, SICRH_SPI_SD);

	return fsl_esdhc_mmc_init(bd);
}