diff options
| author | Wolfgang Denk <wd@denx.de> | 2011-06-01 22:04:12 +0200 | 
|---|---|---|
| committer | Wolfgang Denk <wd@denx.de> | 2011-06-01 22:04:12 +0200 | 
| commit | 033cd2c42bf335d3b96e9612695f6c30b83dce2b (patch) | |
| tree | 1bc9e1d9163cd3114bfeb016d4f4311fbbbec491 /board/keymile/km_arm/km_arm.c | |
| parent | 2130b03309dcf56dab11b6fd0be3b4bedc7f628c (diff) | |
| parent | cd3af8b56749b3200cd858b5a9424c6661958e5f (diff) | |
| download | olio-uboot-2014.01-033cd2c42bf335d3b96e9612695f6c30b83dce2b.tar.xz olio-uboot-2014.01-033cd2c42bf335d3b96e9612695f6c30b83dce2b.zip | |
Merge branch 'master' of git://git.denx.de/u-boot-arm
* 'master' of git://git.denx.de/u-boot-arm:
  SMDKV310: Fix incorrect conditional compilation for MIU linear mapping
  SMDKV310: CPU fequency and mmc_pre_ratio modified
  armv7: Add support for ST-Ericsson U8500 href platform
  I2C: Add driver for ST-Ericsson U8500 i2c
  armv7: Add ST-Ericsson u8500 arch
  Kirkwood: boards cleanup for deprecated CONFIG_CMD_AUTOSCRIPT
  ARMV7: Vexpress: Add missing MMC header
  arm/km: update mgcoge3un board support
  mvgbe: enable configurability of PORT_SERIAL_CONTROL_VALUE
  arm/km: rename mgcoge2un to mgcoge3un
  arm/km: add second serial interface for kirkwood
  arm/km: disable ls (through jffs2 support)
  arm/km: introduce bootcount env variable and clean km_arm
  arm/km: move CONFIG_EXTRA_ENV_SETTINGS from board to km_arm file
  arm/km: remove CONFIG_SYS_KWD_CONFIG from keymile-common.h
  ARMV7: MMC SPL Boot support for SMDKV310 board
  ARMV7: Add support for Samsung SMDKV310 Board
  S5PC2XX: clock: support pwm clock for evt1 (cpu revision 1)
  S5P: add set_mmc_clk for external clock control
  S5PC2XX: Support the cpu revision
  S5P:SROM config code moved to s5p-common directory
  Add _end for the end of u-boot image for SMDK6400
  MMC S5P: Fix typo
  S5P: GPIO Macro Values Corrected.
  SMDK2410: various cleanup/code style fixes
  SMDK2410: use the CFI driver (and remove the old one)
  SMDK2410: remove unneeded config.mk
  SMDK2410: activate ARM relocation feature
  BeagleBoard: fixed typo in typecast
  mvsata: issue hard reset on initialization
  VCMA9: use ARM relocation feature to fix build error
  MX31: drop warnings due to missing prototype for mxc_watchdog_reset()
  MX5: drop config.mk from efikamx board
  MX31: Make get_reset_cause() static and drop unreachable code
  MX53: Remove CONFIG_SYS_BOOTMAPSZ from mx53 config files.
  MX53: Handle silicon revision 2.1 case
  mx5: board: code clean up for checkboard code
  MX51: vision2: Fix build for vision2 board.
  MX51: vision: Let video mode struct be independant of watchdog.
  MX53: Add initial support for MX53SMD board.
  MX53: support for freescale MX53LOCO board
  mx5: Fix CONFIG_OF_LIBFDT redefined warning
  mx5: Remove unnecessary CONFIG_SYS_BOOTMAPSZ definition
  mx31pdk: Clean up mx31pdk.h file
Diffstat (limited to 'board/keymile/km_arm/km_arm.c')
| -rw-r--r-- | board/keymile/km_arm/km_arm.c | 108 | 
1 files changed, 81 insertions, 27 deletions
| diff --git a/board/keymile/km_arm/km_arm.c b/board/keymile/km_arm/km_arm.c index c772ee2a5..d86acc9d0 100644 --- a/board/keymile/km_arm/km_arm.c +++ b/board/keymile/km_arm/km_arm.c @@ -41,6 +41,16 @@  DECLARE_GLOBAL_DATA_PTR; +/* + * BOCO FPGA definitions + */ +#define BOCO		0x10 +#define REG_CTRL_H		0x02 +#define MASK_WRL_UNITRUN	0x01 +#define MASK_RBX_PGY_PRESENT	0x40 +#define REG_IRQ_CIRQ2		0x2d +#define MASK_RBI_DEFECT_16	0x01 +  /* Multi-Purpose Pins Functionality configuration */  u32 kwmpp_config[] = {  	MPP0_NF_IO2, @@ -102,68 +112,119 @@ u32 kwmpp_config[] = {  	0  }; +#if defined(CONFIG_MGCOGE3UN) +/* + * Wait for startup OK from mgcoge3ne + */ +int startup_allowed(void) +{ +	unsigned char buf; + +	/* +	 * Read CIRQ16 bit (bit 0) +	 */ +	if (i2c_read(BOCO, REG_IRQ_CIRQ2, 1, &buf, 1) != 0) +		printf("%s: Error reading Boco\n", __func__); +	else +		if ((buf & MASK_RBI_DEFECT_16) == MASK_RBI_DEFECT_16) +			return 1; +	return 0; +} + +/* + * mgcoge3un has always ethernet present. Its connected to the 6061 switch + * and provides ICNev and piggy4 connections. + */ +int ethernet_present(void) +{ +	return 1; +} +#else  int ethernet_present(void)  {  	uchar	buf;  	int	ret = 0; -	if (i2c_read(0x10, 2, 1, &buf, 1) != 0) { +	if (i2c_read(BOCO, REG_CTRL_H, 1, &buf, 1) != 0) {  		printf("%s: Error reading Boco\n", __func__);  		return -1;  	} -	if ((buf & 0x40) == 0x40) +	if ((buf & MASK_RBX_PGY_PRESENT) == MASK_RBX_PGY_PRESENT)  		ret = 1;  	return ret;  } +#endif  int initialize_unit_leds(void)  {  	/* -	 * init the unit LEDs -	 * per default they all are +	 * Init the unit LEDs per default they all are  	 * ok apart from bootstat -	 * LED connected through BOCO -	 * BOCO	lies at the address  0x10 -	 * LEDs are in the block CTRL_H	(addr 0x02) -	 * BOOTSTAT LED is the first 0x01  	 */ -	#define BOCO        0x10 -	#define CTRL_H      0x02 -	#define APPLEDMASK  0x01  	uchar buf; -	if (i2c_read(BOCO, CTRL_H, 1, &buf, 1) != 0) { +	if (i2c_read(BOCO, REG_CTRL_H, 1, &buf, 1) != 0) {  		printf("%s: Error reading Boco\n", __func__);  		return -1;  	} -	buf |= APPLEDMASK; -	if (i2c_write(BOCO, CTRL_H, 1, &buf, 1) != 0) { +	buf |= MASK_WRL_UNITRUN; +	if (i2c_write(BOCO, REG_CTRL_H, 1, &buf, 1) != 0) {  		printf("%s: Error writing Boco\n", __func__);  		return -1;  	}  	return 0;  } +#if defined(CONFIG_BOOTCOUNT_LIMIT) +void set_bootcount_addr(void) +{ +	uchar buf[32]; +	unsigned int bootcountaddr; +	bootcountaddr = gd->ram_size - BOOTCOUNT_ADDR; +	sprintf((char *)buf, "0x%x", bootcountaddr); +	setenv("bootcountaddr", (char *)buf); +} +#endif +  int misc_init_r(void)  {  	char *str;  	int mach_type; -	puts("Piggy:"); -	if (ethernet_present() == 0) -		puts (" not"); -	puts(" present\n"); -  	str = getenv("mach_type");  	if (str != NULL) {  		mach_type = simple_strtoul(str, NULL, 10);  		printf("Overwriting MACH_TYPE with %d!!!\n", mach_type);  		gd->bd->bi_arch_number = mach_type;  	} +#if defined(CONFIG_MGCOGE3UN) +	char *wait_for_ne; +	wait_for_ne = getenv("waitforne"); +	if (wait_for_ne != NULL) { +		if (strcmp(wait_for_ne, "true") == 0) { +			int cnt = 0; +			puts("NE go: "); +			while (startup_allowed() == 0) { +				udelay(200000); +				cnt++; +				if (cnt == 5) +					puts("wait\b\b\b\b"); +				if (cnt == 10) { +					cnt = 0; +					puts("    \b\b\b\b"); +				} +			} +			puts("OK\n"); +		} +	} +#endif  	initialize_unit_leds(); - +	set_km_env(); +#if defined(CONFIG_BOOTCOUNT_LIMIT) +	set_bootcount_addr(); +#endif  	return 0;  } @@ -182,7 +243,6 @@ int board_early_init_f(void)  	writel(tmp | FLASH_GPIO_PIN , KW_GPIO0_BASE);  	tmp = readl(KW_GPIO0_BASE + 4);  	writel(tmp & (~FLASH_GPIO_PIN) , KW_GPIO0_BASE + 4); -	printf("KM: setting NAND mode\n");  #if defined(CONFIG_SOFT_I2C)  	/* init the GPIO for I2C Bitbang driver */ @@ -212,12 +272,6 @@ int board_init(void)  	return 0;  } -int last_stage_init(void) -{ -	set_km_env(); -	return 0; -} -  #if defined(CONFIG_CMD_SF)  int do_spi_toggle(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])  { |