[aadk-commits] dbailey: u-boot/trunk r879 - in /u-boot/trunk/u-boot_1.1.3: board/s800i/ comm...

SVN commits to the AADK repository aadk-commits at lists.digium.com
Thu May 15 15:20:33 CDT 2008


Author: dbailey
Date: Thu May 15 15:20:32 2008
New Revision: 879

URL: http://svn.digium.com/view/aadk?view=rev&rev=879
Log:
Merge branch with the ability to discern between rev B and rev C hardware
Added ability to set test result in MFG prom

Added:
    u-boot/trunk/u-boot_1.1.3/board/s800i/i2c_led.c
      - copied, made public unchanged from r878, u-boot/private/dbailey/revc/u-boot_1.1.3/board/s800i/i2c_led.c
    u-boot/trunk/u-boot_1.1.3/board/s800i/portg_led.c
      - copied, made public unchanged from r878, u-boot/private/dbailey/revc/u-boot_1.1.3/board/s800i/portg_led.c
    u-boot/trunk/u-boot_1.1.3/include/configs/s800i_boardrev.h
      - copied, made public unchanged from r878, u-boot/private/dbailey/revc/u-boot_1.1.3/include/configs/s800i_boardrev.h
Modified:
    u-boot/trunk/u-boot_1.1.3/board/s800i/Makefile
    u-boot/trunk/u-boot_1.1.3/board/s800i/dig_i2c_eeprom.h
    u-boot/trunk/u-boot_1.1.3/board/s800i/i2c_cfg.c
    u-boot/trunk/u-boot_1.1.3/board/s800i/s800i.c
    u-boot/trunk/u-boot_1.1.3/common/main.c
    u-boot/trunk/u-boot_1.1.3/include/configs/board_id.h
    u-boot/trunk/u-boot_1.1.3/include/configs/s800i.h
    u-boot/trunk/u-boot_1.1.3/lib_blackfin/board.c

Modified: u-boot/trunk/u-boot_1.1.3/board/s800i/Makefile
URL: http://svn.digium.com/view/aadk/u-boot/trunk/u-boot_1.1.3/board/s800i/Makefile?view=diff&rev=879&r1=878&r2=879
==============================================================================
--- u-boot/trunk/u-boot_1.1.3/board/s800i/Makefile (original)
+++ u-boot/trunk/u-boot_1.1.3/board/s800i/Makefile Thu May 15 15:20:32 2008
@@ -29,7 +29,7 @@
 
 LIB	= lib$(BOARD).a
 
-OBJS	= $(BOARD).o flash.o ether_bf537.o post-memory.o stm_m25p64.o adm.o i2c.o i2c_cfg.o
+OBJS	= $(BOARD).o flash.o ether_bf537.o post-memory.o stm_m25p64.o adm.o i2c.o i2c_cfg.o i2c_led.o portg_led.o
 
 $(LIB):	.depend $(OBJS)
 	$(AR) crv $@ $(OBJS)

Modified: u-boot/trunk/u-boot_1.1.3/board/s800i/dig_i2c_eeprom.h
URL: http://svn.digium.com/view/aadk/u-boot/trunk/u-boot_1.1.3/board/s800i/dig_i2c_eeprom.h?view=diff&rev=879&r1=878&r2=879
==============================================================================
--- u-boot/trunk/u-boot_1.1.3/board/s800i/dig_i2c_eeprom.h (original)
+++ u-boot/trunk/u-boot_1.1.3/board/s800i/dig_i2c_eeprom.h Thu May 15 15:20:32 2008
@@ -23,7 +23,7 @@
 	DIGCMD_CRC,
 	DIGCMD_NULL
 };
-	
+
 /*
  * Structure indicating the type of data, the size of the data, 
  * and where it is located in the memory block
@@ -36,8 +36,23 @@
 
 extern const struct rom_location eeprom_map[];
 
+/* 
+ * Enumerate the states of the TDM clock 
+ */
+enum tdmfreq_state {
+	TDMFREQ_2048KHZ = 0,
+	TDMFREQ_8192KHZ,
+};
+
+
 /*** Prototype ***/
 int get_i2c_mac(unsigned char * mac); 
+int get_i2c_boardrev(char * boardrev);
 void set_bootcmd_args(void);
-		
+
+int init_i2c_led(void);
+int init_portg_led(void);
+int init_portg_tdm(enum tdmfreq_state speed);
+int set_led_thermometer(int level, int color);
+
 #endif

Modified: u-boot/trunk/u-boot_1.1.3/board/s800i/i2c_cfg.c
URL: http://svn.digium.com/view/aadk/u-boot/trunk/u-boot_1.1.3/board/s800i/i2c_cfg.c?view=diff&rev=879&r1=878&r2=879
==============================================================================
--- u-boot/trunk/u-boot_1.1.3/board/s800i/i2c_cfg.c (original)
+++ u-boot/trunk/u-boot_1.1.3/board/s800i/i2c_cfg.c Thu May 15 15:20:32 2008
@@ -104,6 +104,98 @@
 	return 0; 
 }
 
+/*
+ * 	Retrieve the Board Revision stored in i2c EEPROM memory
+ */
+int get_i2c_boardrev(char * boardrev)
+{
+	unsigned char   prom_image[I2C_PROM_SIZE +1];
+
+	boardrev[0] = '\0'; 
+	
+	/* Get the contents of the existing eeprom */
+	if (0 != get_i2c_eeprom_data(prom_image)) {
+		return -1;
+	}
+	
+	copy_i2c_field(DIGCMD_BOARD_REVISION, boardrev, prom_image);
+	return 0;
+}
+
+
+/* All i2c transfers are described by this data structure */
+struct i2c_msg {
+	u16 addr;		/* slave address			*/
+	u16 flags;
+#define I2C_M_STOP		0x2
+#define I2C_M_RD		0x1
+	u16 len;		/* msg length				*/
+	u8 *buf;		/* pointer to msg data			*/
+};
+
+static int i2c_write_24c01_page(uchar chip, uint addr, uchar *buffer, int len)
+{
+	struct i2c_msg msg;
+	u8 msg_packet[I2C_24C01_PAGE_SIZE+3];
+	int num_written;
+	int i;
+	int page_end;
+	
+	page_end = ((addr/I2C_24C01_PAGE_SIZE) +1) * I2C_24C01_PAGE_SIZE;
+	
+	/* Load the address in what will be written to the chip address write */
+	msg_packet[0] = (u8)((addr >>  0) & 0x000000FF);
+	
+	for (i= 1, num_written = 0; addr < page_end && num_written < len; num_written++, addr++){
+		msg_packet[i++] = buffer[num_written];
+	}
+	msg.addr = chip;
+	msg.flags = 0;
+	
+	msg.len = i;
+	msg.buf = msg_packet;
+
+	if (i2c_transfer(&msg)) {
+		return -1;
+	}
+
+	msg.flags = I2C_M_RD;
+	msg.len = 2;
+	msg.buf = msg_packet;
+
+	/* Now wait until the write is done*/
+	for (i = 0; i < 100; i++){
+		if (0 == i2c_transfer(&msg)) {
+			break;
+		}
+	}
+	return num_written;
+}
+
+/*
+ *	This function takes a block of data and writes it into a 24c01 style 
+ * 	I2C FLASH prom. 
+ */
+static int i2c_write_24c01(uchar chip, uint addr, uchar *buffer, int len)
+{
+	int res;
+	int total = 0;
+	int end_addr = addr+len;
+	
+	while (addr < end_addr){
+		res = i2c_write_24c01_page(chip, addr, buffer, len-total);
+		if (0 < res){
+			addr 	+= res;
+			buffer  += res;
+			total	+= res;
+		} else {
+			break;
+		}
+	}
+	return total;
+}
+
+
 /* 
  * 	Modify Boot Arguments
  *	If the following arguments are not set in the bootargs environment parameter, 
@@ -259,3 +351,84 @@
 				"\n    - Format and Print configuration settings stored in I2C eeprom\n" \
 		  );
 
+static int do_digtest ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+{
+	int i;
+	int val = -1;
+	int count;
+	ulong		    conv_num;
+	unsigned char   prom_image[I2C_PROM_SIZE +1];
+	uchar chip = I2C_PROM_ADDRESS;
+	struct rom_location * curr_field;
+
+	
+	/* Get the contents of the existing eeprom */
+	if (0 != i2c_read(chip, 0, 1, prom_image,I2C_PROM_SIZE)) {
+		printf("Cannot access serial EEPROM\n");
+		return -1;
+	}
+
+	conv_num = crc32(0, prom_image, CRC_LOC);
+	if (*(ulong *)(&prom_image[CRC_LOC]) == conv_num) {
+		printf("Existing eeprom is valid\n");
+	} else {
+		printf("Existing eeprom is corrupt\n");
+		return -1;
+	}
+	
+	for (i =1; i < argc; i++){
+		if (0 == strcmp("pass", argv[i])) {
+			val = 1;
+			break;
+		} else if (0 == strcmp("fail", argv[i])) {
+			val = 0;
+			break;
+		} else {
+			printf("Invalid option: %s\n", argv[i]);
+		}
+	}
+
+	if (0 <= val) {
+		for (curr_field = &eeprom_map[0]; curr_field->state != DIGCMD_MFG_TEST_RESULT; curr_field++)
+		{}
+		prom_image[curr_field->offset] = val;
+		/* increment the test count */
+		for (curr_field = &eeprom_map[0]; curr_field->state != DIGCMD_MFG_TEST_COUNT; curr_field++)
+		{}
+		count = prom_image[curr_field->offset];
+		if (count < 127 ) {
+			count++;
+		} else if (count > 127 ) {
+			count = 0;
+		}
+		prom_image[curr_field->offset] = count;
+
+		for (curr_field = &eeprom_map[0]; curr_field->state != DIGCMD_CRC; curr_field++)
+		{}
+		conv_num = crc32(0, prom_image, curr_field->offset);
+		*(ulong *)(&prom_image[curr_field->offset]) = conv_num;
+		printf("Writing test result %d, count=%d to eeprom\n", val, count);
+		if (I2C_PROM_SIZE != i2c_write_24c01(chip, 0 , prom_image, I2C_PROM_SIZE)){
+			printf("Error in writing MANUFACTURING information!!!!!!!\n");
+		}
+	} else {
+		/* Report what is in memory */
+		for (curr_field = &eeprom_map[0]; curr_field->state != DIGCMD_MFG_TEST_RESULT; curr_field++)
+		{}
+		val = prom_image[curr_field->offset];
+		/* increment the test count */
+		for (curr_field = &eeprom_map[0]; curr_field->state != DIGCMD_MFG_TEST_COUNT; curr_field++)
+		{}
+		count = prom_image[curr_field->offset];
+		printf("MFG test result is %s. Test has been run %d times\n", 1 == val ? "pass" : "fail" , count);
+	}
+	return 0;
+}
+
+
+U_BOOT_CMD(
+	dgtest,	2,	1,	do_digtest,		\
+	"dgtest     - Digium MFG Test command\n",				\
+	"[<pass|fail>\n    - Updates the functional test results\n" \
+);
+

Copied: u-boot/trunk/u-boot_1.1.3/board/s800i/i2c_led.c (from r878, u-boot/private/dbailey/revc/u-boot_1.1.3/board/s800i/i2c_led.c)
URL: http://svn.digium.com/view/aadk/u-boot/trunk/u-boot_1.1.3/board/s800i/i2c_led.c?view=diff&rev=879&p1=u-boot/private/dbailey/revc/u-boot_1.1.3/board/s800i/i2c_led.c&r1=878&p2=u-boot/trunk/u-boot_1.1.3/board/s800i/i2c_led.c&r2=879
==============================================================================
--- u-boot/private/dbailey/revc/u-boot_1.1.3/board/s800i/i2c_led.c (original)
+++ u-boot/trunk/u-boot_1.1.3/board/s800i/i2c_led.c Thu May 15 15:20:32 2008
@@ -1,0 +1,173 @@
+/*
+ * (C) Copyright 2007
+ * Doug Bailey, Digium Inc., dbailey at digium.com 
+ *
+ * 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>
+#include <command.h>
+#include <i2c.h>
+#include <asm/byteorder.h>
+#include <configs/s800i_boardrev.h>
+#include "dig_i2c_eeprom.h"
+
+#define NUM_I2C_LEDS (16)
+
+#define PCA9635_AUTOINC_MASK_NONE	(0x00)
+#define PCA9635_AUTOINC_MASK_ALL	(0x80)
+#define PCA9635_AUTOINC_MASK_BRIGHT	(0xa0)
+#define PCA9635_AUTOINC_MASK_GLBCTL (0xc0)
+#define PCA9635_AUTOINC_MASK_ALLCTL	(0xe0)
+
+#define PCA9635_REG_MODE1 		0x0
+#define PCA9635_REG_MODE2 		0x1
+#define PCA9635_REG_BRIGHTNESS0 0x2
+#define PCA9635_REG_GRPPWM		0x12
+#define PCA9635_REG_GRPFREQ		0x13
+#define PCA9635_REG_LEDOUT0		0x14
+#define PCA9635_REG_SUBADR1		0x18
+#define PCA9635_REG_SUBADR2		0x19
+#define PCA9635_REG_SUBADR3		0x1a
+#define PCA9635_REG_ALLCALLADR	0x1b
+#define PCA9635_NUM_REGS		(PCA9635_REG_ALLCALLADR +1)
+
+#define S800I_PCA9635_ADDR 	(0x10)
+#define I2C_RESET_ADDR 		(0x3)
+
+/* All transfers are described by this data structure */
+struct i2c_msg {
+	u16 addr;		/* slave address			*/
+	u16 flags;		
+#define I2C_M_STOP		0x2
+#define I2C_M_RD		0x1
+	u16 len;		/* msg length				*/
+	u8 *buf;		/* pointer to msg data			*/
+};
+
+int i2c_transfer(struct i2c_msg *msg);
+
+struct led_state {
+	unsigned char led_state[NUM_I2C_LEDS/4];
+	unsigned char led_bright[NUM_I2C_LEDS];
+};
+
+struct led_state leddata  = {
+	.led_state = {0x44, 0x44, 0x44, 0x44},
+	.led_bright = {0xff, 0xff, 0xff, 0xff, 
+					0xff, 0xff, 0xff, 0xff, 
+					0xff, 0xff, 0xff, 0xff, 
+					0xff, 0xff, 0xff, 0xff},
+};
+
+static int update_leds(void)
+{
+	uchar data[NUM_I2C_LEDS+1];
+	struct i2c_msg msg;
+	int i, res;
+	
+	data[0] = PCA9635_REG_LEDOUT0 | PCA9635_AUTOINC_MASK_ALL;
+	for (i = 0; i < NUM_I2C_LEDS/4; i++) {
+		data[i+1] = leddata.led_state[i];
+	}
+	msg.addr = S800I_PCA9635_ADDR;
+	msg.flags = 0;
+	msg.len = NUM_I2C_LEDS/4 +1;
+	msg.buf = data;
+	res = i2c_transfer(&msg);
+	
+	data[0] = PCA9635_REG_BRIGHTNESS0 | PCA9635_AUTOINC_MASK_ALL;
+	for (i = 0; i < NUM_I2C_LEDS; i++) {
+		data[i+1] = leddata.led_bright[i];
+	}
+	msg.addr = S800I_PCA9635_ADDR;
+	msg.flags = 0;
+	msg.len = NUM_I2C_LEDS +1;
+	msg.buf = data;
+	res = i2c_transfer(&msg);
+	
+	return 0;
+}
+
+int init_i2c_led(void)
+{
+	int res = 0x55;
+	uchar reset_data[2] = {0xa5,0x5a};
+	uchar init_stream[25] = {PCA9635_REG_MODE1 | PCA9635_AUTOINC_MASK_ALL, 0,5,
+					0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+					0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+					0xff,0,
+					5,5,5,5	};
+					
+	struct i2c_msg msg;
+	
+	/* Attempt to reset the IC */
+	msg.addr = I2C_RESET_ADDR;
+	msg.flags = 0;
+	msg.len = 2;
+	msg.buf = reset_data;
+	res = i2c_transfer(&msg);
+	
+	/* See if the IC device is there */
+	if(0 > (res = i2c_probe(S800I_PCA9635_ADDR))) {
+		printf ("ERROR: Cannot find LED driver at I2C address 0x%x\n", S800I_PCA9635_ADDR);
+		return -1;
+	}
+	
+	/* Load the initialization string */
+	msg.addr = S800I_PCA9635_ADDR;
+	msg.flags = 0;
+	msg.len = 25;
+	msg.buf = init_stream;
+	res = i2c_transfer(&msg);
+
+	return 0;
+}
+
+int set_led_thermometer(int level, int color) 
+{
+	uchar mask; 
+	int i;
+	
+	if(BOARDREV_UNKOWN == board_revision || BOARDREV_B == board_revision ||
+		  		0 > level || NUM_I2C_LEDS/2 < level ) {
+		return -1;
+	}
+	
+	switch(color) {
+		case 1:
+			mask = 0x1;
+			break;
+		case 2:
+			mask = 0x4;
+			break;
+		default:
+			mask = 0x5;
+			break;
+	}
+	for(i = 0; i < level; i++) {
+		leddata.led_state[i/2] &= 0x0f << ((i & 1)? 0 : 4);
+		leddata.led_state[i/2] |= mask << ((i & 1)? 4 : 0);
+	}
+	for(; i < NUM_I2C_LEDS/2; i++) {
+		leddata.led_state[i/2] &= 0xf << ((i & 1) ? 0 : 4);
+	}
+		
+	update_leds();
+	
+	return 0;
+}
+
+

Copied: u-boot/trunk/u-boot_1.1.3/board/s800i/portg_led.c (from r878, u-boot/private/dbailey/revc/u-boot_1.1.3/board/s800i/portg_led.c)
URL: http://svn.digium.com/view/aadk/u-boot/trunk/u-boot_1.1.3/board/s800i/portg_led.c?view=diff&rev=879&p1=u-boot/private/dbailey/revc/u-boot_1.1.3/board/s800i/portg_led.c&r1=878&p2=u-boot/trunk/u-boot_1.1.3/board/s800i/portg_led.c&r2=879
==============================================================================
--- u-boot/private/dbailey/revc/u-boot_1.1.3/board/s800i/portg_led.c (original)
+++ u-boot/trunk/u-boot_1.1.3/board/s800i/portg_led.c Thu May 15 15:20:32 2008
@@ -1,0 +1,54 @@
+/*
+ * (C) Copyright 2007
+ * Doug Bailey, Digium Inc., dbailey at digium.com 
+ *
+ * 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>
+#include <config.h>
+#include <command.h>
+#include <asm/blackfin.h>
+#include "dig_i2c_eeprom.h"
+
+#define POWER_LED_OFFSET (15)
+#define TDM_FREQ_OFFSET (12)	/* Select the speed of the tdm clock */
+
+int init_portg_led(void)
+{
+	*pPORTG_FER 	&= ~(1<<POWER_LED_OFFSET);	
+	*pPORTGIO_SET 	|= (1<<POWER_LED_OFFSET);
+	*pPORTGIO_DIR 	|= (1<<POWER_LED_OFFSET);
+	__builtin_bfin_ssync();
+	*pPORTGIO_CLEAR = (1<<POWER_LED_OFFSET);  /* activate the led */
+	__builtin_bfin_ssync();
+
+	return 0;	
+}
+
+int init_portg_tdm(enum tdmfreq_state speed)
+{
+	*pPORTG_FER 	&= ~(1<<TDM_FREQ_OFFSET);	
+	*pPORTGIO_SET 	|= (1<<TDM_FREQ_OFFSET);
+	*pPORTGIO_DIR 	|= (1<<TDM_FREQ_OFFSET);
+	__builtin_bfin_ssync();
+	if (speed == TDMFREQ_8192KHZ)
+		*pPORTGIO_CLEAR = (1<<TDM_FREQ_OFFSET);  /* high speed*/
+	else
+		*pPORTGIO_SET = (1<<TDM_FREQ_OFFSET);  /* low speed*/
+	__builtin_bfin_ssync();
+
+	return 0;	
+}

Modified: u-boot/trunk/u-boot_1.1.3/board/s800i/s800i.c
URL: http://svn.digium.com/view/aadk/u-boot/trunk/u-boot_1.1.3/board/s800i/s800i.c?view=diff&rev=879&r1=878&r2=879
==============================================================================
--- u-boot/trunk/u-boot_1.1.3/board/s800i/s800i.c (original)
+++ u-boot/trunk/u-boot_1.1.3/board/s800i/s800i.c Thu May 15 15:20:32 2008
@@ -29,12 +29,58 @@
 #include <config.h>
 #include <command.h>
 #include <asm/blackfin.h>
+#include <configs/s800i_boardrev.h>
 #include "adm.h"
 #include "ether_bf537.h"
 #include "dig_i2c_eeprom.h"
 
+int board_revision = BOARDREV_UNKOWN;
+
 #define POST_WORD_ADDR 0xFF903FFC
 
+int find_boardrev(void)
+{
+	char boardrev_info[I2C_PROM_SIZE];
+	int result = BOARDREV_UNKOWN;
+
+	if (0 == get_i2c_boardrev(boardrev_info) ) {
+		if ('b' == boardrev_info[0] || 'B' == boardrev_info[0]) {
+			result = BOARDREV_B;
+		}
+		else if ('c' == boardrev_info[0] || 'C' == boardrev_info[0]) {
+			result = BOARDREV_C;
+		}
+		else if ('d' == boardrev_info[0] || 'D' == boardrev_info[0]) {
+			result = BOARDREV_D;
+		}
+	} else {	/* The mfg info is hosed, try to find the LED chip
+				 * If the I2C LED IC is found, then assume it is a rev C board
+				*/
+		if (0 == init_i2c_led()) {	
+			result = BOARDREV_C;
+		}
+	}
+	board_revision = result;
+	return result;
+}
+
+
+/* Sets the PLL VCO to set the core clock rate */
+void set_vco(unsigned short vco_mult)
+{
+	unsigned short current;
+	
+	*pSIC_IWR=0x01;  /* Set PLL to take Core out of idle */
+	current = *pPLL_CTL & 0x81FF;
+	current |= (vco_mult & 0x3f) << 9;
+	*pPLL_CTL=current;
+	/* Sequence needed to bring the processor out of IDLE */
+	asm("CLI R0;");
+	asm("IDLE;");
+	asm("STI R0;");
+	while (!(*pPLL_STAT & 0x20));	/* Don't leave until I'm locked */
+}
+	
 /*
  * the bootldr command loads an address, checks to see if there
  *   is a Boot stream that the on-chip BOOTROM can understand,
@@ -173,11 +219,17 @@
 	udelay(5000);
 	ide_init();
 #endif
-	adm_init();	
+	adm_init();
+
+	if (BOARDREV_UNKOWN != board_revision && BOARDREV_B != board_revision) {
+		init_i2c_led();
+		init_portg_led();
+	}
 	SetupMacAddr(nid);
 
 	set_bootcmd_args();		/* Modify arguments that are passed to OS */
 
+	set_led_thermometer(8, 1);
 	return 0;
 }
 #endif

Modified: u-boot/trunk/u-boot_1.1.3/common/main.c
URL: http://svn.digium.com/view/aadk/u-boot/trunk/u-boot_1.1.3/common/main.c?view=diff&rev=879&r1=878&r2=879
==============================================================================
--- u-boot/trunk/u-boot_1.1.3/common/main.c (original)
+++ u-boot/trunk/u-boot_1.1.3/common/main.c Thu May 15 15:20:32 2008
@@ -27,6 +27,7 @@
 #include <watchdog.h>
 #include <command.h>
 #include <malloc.h>
+#include <configs/s800i_boardrev.h>
 
 #ifdef CFG_HUSH_PARSER
 #include <hush.h>
@@ -270,7 +271,7 @@
 			}
 			udelay (10000);
 		}
-
+		set_led_thermometer(8, bootdelay % 3);  /* cycle led lighting */
 		printf ("\b\b\b%2d ", bootdelay);
 	}
 

Modified: u-boot/trunk/u-boot_1.1.3/include/configs/board_id.h
URL: http://svn.digium.com/view/aadk/u-boot/trunk/u-boot_1.1.3/include/configs/board_id.h?view=diff&rev=879&r1=878&r2=879
==============================================================================
--- u-boot/trunk/u-boot_1.1.3/include/configs/board_id.h (original)
+++ u-boot/trunk/u-boot_1.1.3/include/configs/board_id.h Thu May 15 15:20:32 2008
@@ -1,6 +1,6 @@
 /*Autogenerated header file*/
 #ifndef __BOARD_ID_H__
 #define __BOARD_ID_H__
-#define VENDOR_ID "Unknown"
-#define CFG_PROMPT ">"
+#define VENDOR_ID "revc x.x.x"
+#define CFG_PROMPT "revc> "
 #endif

Modified: u-boot/trunk/u-boot_1.1.3/include/configs/s800i.h
URL: http://svn.digium.com/view/aadk/u-boot/trunk/u-boot_1.1.3/include/configs/s800i.h?view=diff&rev=879&r1=878&r2=879
==============================================================================
--- u-boot/trunk/u-boot_1.1.3/include/configs/s800i.h (original)
+++ u-boot/trunk/u-boot_1.1.3/include/configs/s800i.h Thu May 15 15:20:32 2008
@@ -17,8 +17,8 @@
 /* CONFIG_SPI_BAUD controls the SPI peripheral clock divider     */
 /* Values can range from 2-65535                                 */
 /* SCK Frequency = SCLK / (2 * CONFIG_SPI_BAUD)                  */
-#define CONFIG_SPI_BAUD                        3
-#define CONFIG_SPI_BAUD_INITBLOCK              4
+#define CONFIG_SPI_BAUD                        4
+#define CONFIG_SPI_BAUD_INITBLOCK              5
 
 /* CONFIG_CLKIN_HZ is any value in Hz                            */
 /* #define CONFIG_CLKIN_HZ          40960000 */
@@ -31,13 +31,15 @@
 #define CONFIG_PLL_BYPASS               0
 /* CONFIG_VCO_MULT controls what the multiplier of the PLL is.   */
 /* Values can range from 1-64                                    */
-#define CONFIG_VCO_MULT			20
 /* CONFIG_CCLK_DIV controls what the core clock divider is       */
 /* Values can be 1, 2, 4, or 8 ONLY                              */
-#define CONFIG_CCLK_DIV			1
 /* CONFIG_SCLK_DIV controls what the peripheral clock divider is */
 /* Values can range from 1-15                                    */
+#define CONFIG_VCO_MULT			24
+#define CONFIG_CCLK_DIV			1
 #define CONFIG_SCLK_DIV			5
+
+#define CONFIG_VCO_MULT_SLOW	20
 
 #if ( CONFIG_CLKIN_HALF == 0 )
 #define CONFIG_VCO_HZ           ( CONFIG_CLKIN_HZ * CONFIG_VCO_MULT )

Copied: u-boot/trunk/u-boot_1.1.3/include/configs/s800i_boardrev.h (from r878, u-boot/private/dbailey/revc/u-boot_1.1.3/include/configs/s800i_boardrev.h)
URL: http://svn.digium.com/view/aadk/u-boot/trunk/u-boot_1.1.3/include/configs/s800i_boardrev.h?view=diff&rev=879&p1=u-boot/private/dbailey/revc/u-boot_1.1.3/include/configs/s800i_boardrev.h&r1=878&p2=u-boot/trunk/u-boot_1.1.3/include/configs/s800i_boardrev.h&r2=879
==============================================================================
--- u-boot/private/dbailey/revc/u-boot_1.1.3/include/configs/s800i_boardrev.h (original)
+++ u-boot/trunk/u-boot_1.1.3/include/configs/s800i_boardrev.h Thu May 15 15:20:32 2008
@@ -1,0 +1,15 @@
+#ifndef __CONFIG_S800I_BOARDREV_H__
+#define __CONFIG_S800I_BOARDREV_H__
+
+#define BOARDREV_UNKOWN	(-1)
+#define BOARDREV_B 		(0)
+#define BOARDREV_C 		(1)
+#define BOARDREV_D 		(2)
+
+int handle_reset_source(unsigned short swrst_image);
+int find_boardrev(void);
+void set_vco(unsigned short vco_mult);
+extern int board_revision;
+
+#endif
+

Modified: u-boot/trunk/u-boot_1.1.3/lib_blackfin/board.c
URL: http://svn.digium.com/view/aadk/u-boot/trunk/u-boot_1.1.3/lib_blackfin/board.c?view=diff&rev=879&r1=878&r2=879
==============================================================================
--- u-boot/trunk/u-boot_1.1.3/lib_blackfin/board.c (original)
+++ u-boot/trunk/u-boot_1.1.3/lib_blackfin/board.c Thu May 15 15:20:32 2008
@@ -35,6 +35,7 @@
 #include <i2c.h>
 #include "blackfin_board.h"
 #include "../drivers/smc91111.h"
+#include <configs/s800i_boardrev.h>
 
 #if defined(CONFIG_BF537)&&defined(CONFIG_POST)
 #include <post.h>
@@ -43,10 +44,6 @@
 
 #ifndef CFG_NO_FLASH
 extern flash_info_t flash_info[];
-#endif
-
-#ifdef S800I_RESET_HARDEN
-int handle_reset_source(unsigned short swrst_image);
 #endif
 
 static inline u_long get_vco(void)
@@ -195,6 +192,7 @@
 	DECLARE_GLOBAL_DATA_PTR;
 	ulong addr;
 	bd_t *bd;
+	char * board_series = "Unknown";
 
 #ifdef S800I_RESET_HARDEN
 	handle_reset_source(*pSWRST);
@@ -216,6 +214,7 @@
 	/* Initialize */
 	init_IRQ();
 	env_init();		/* initialize environment */
+
 	init_baudrate();	/* initialze baudrate settings */
 	serial_init();		/* serial communications setup */
 	console_init_f();
@@ -224,6 +223,30 @@
 #if defined(CONFIG_RTC_BF533) && (CONFIG_COMMANDS & CFG_CMD_DATE)
 	rtc_init();
 #endif
+
+#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C)
+	init_func_i2c();
+#endif
+
+	find_boardrev();	/* Digium determine the board revision */
+	if (BOARDREV_B == board_revision) {
+		set_vco(CONFIG_VCO_MULT_SLOW);
+		serial_init();		/* reset serial communications setup */
+		console_init_f();
+	}
+	switch (board_revision) {
+		case BOARDREV_B:
+			board_series = "B";
+			break;
+		case BOARDREV_C:
+			board_series = "C";
+			break;
+		case BOARDREV_D:
+			board_series = "D";
+			break;
+	}
+	printf("Board Series: %s\n", board_series);
+	
 	timer_init();
 	printf("Clock: VCO: %lu MHz, Core: %lu MHz, System: %lu MHz\n", \
 	get_vco()/1000000, get_cclk()/1000000, get_sclk()/1000000);
@@ -281,10 +304,6 @@
 	mem_malloc_init();
 	malloc_bin_reloc();
 
-#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C)
-	init_func_i2c();
-#endif
-
 #ifdef CONFIG_SPI
 # if ! defined(CFG_ENV_IS_IN_EEPROM)
 	spi_init_f();




More information about the aadk-commits mailing list