r4282 - trunk/src/target/u-boot/patches

werner at sita.openmoko.org werner at sita.openmoko.org
Tue Apr 1 03:53:39 CEST 2008


Author: werner
Date: 2008-04-01 03:53:34 +0200 (Tue, 01 Apr 2008)
New Revision: 4282

Added:
   trunk/src/target/u-boot/patches/config-gta02v5-beyond.patch
Modified:
   trunk/src/target/u-boot/patches/gpb-shadow.patch
   trunk/src/target/u-boot/patches/series
   trunk/src/target/u-boot/patches/wait-for-power.patch
Log:
This set of changes makes u-boot detect hardware revisions >= GTA02v5 at run
time instead of build time. The revision tag and the boot prompt are adjusted
accordingly.

Note that new code should use gta02_revision for feature tests, not
CONFIG_GTA02_REVISION !

For backward-compatibility, "make gta02v6_config" is still supported (and
yields exactly the same result as "make gta02v5_config".

config-gta02v5-beyond.patch:
- Makefile: gta02v6_config choice was missing
- board/neo1973/gta02/split_by_variant.sh: gta02v6_config is identical to
  gta02v5_config
- board/neo1973/gta02/gta02.c (board_late_init): removed revision handing to
  new function set_revision
- include/configs/neo1973_gta02.h, board/neo1973/gta02/gta02.c (CFG_PROMPT):
  CFG_PROMPT now points to a variable set in set_revision
- board/neo1973/gta02/gta02.c (gta02_revision): new global variable to replace
  CONFIG_GTA02_REVISION
- board/neo1973/gta02/gta02.c (get_board_rev): use gta02_revision instead of
  CONFIG_GTA02_REVISION
- board/neo1973/gta02/gta02.c (gta02_get_pcb_revision): GTA02v6 code is 0x01,
  not 0x101
- drivers/usb/usbdfu.c (dfu_trailer_matching): use the compile-time revision
  CONFIG_USB_DFU_REVISION instead of the run-time revision get_board_rev()
- board/neo1973/gta01/split_by_variant.sh,
  board/neo1973/gta02/split_by_variant.sh: add definitions in $CFGTMP also to
  $CFGINC

gpb-shadow.patch, wait-for-power.patch: updated for context changes



Added: trunk/src/target/u-boot/patches/config-gta02v5-beyond.patch
===================================================================
--- trunk/src/target/u-boot/patches/config-gta02v5-beyond.patch	2008-04-01 01:16:55 UTC (rev 4281)
+++ trunk/src/target/u-boot/patches/config-gta02v5-beyond.patch	2008-04-01 01:53:34 UTC (rev 4282)
@@ -0,0 +1,197 @@
+This set of changes makes u-boot detect hardware revisions >= GTA02v5 at run
+time instead of build time. The revision tag and the boot prompt are adjusted
+accordingly.
+
+Note that new code should use gta02_revision for feature tests, not 
+CONFIG_GTA02_REVISION !
+
+For backward-compatibility, "make gta02v6_config" is still supported (and
+yields exactly the same result as "make gta02v5_config".
+
+Index: u-boot/Makefile
+===================================================================
+--- u-boot.orig/Makefile
++++ u-boot/Makefile
+@@ -2437,7 +2437,8 @@
+ gta02v2_config \
+ gta02v3_config \
+ gta02v4_config \
+-gta02v5_config:	unconfig
++gta02v5_config \
++gta02v6_config:	unconfig
+ 	@sh board/neo1973/gta02/split_by_variant.sh $@
+ 
+ gta01_config \
+Index: u-boot/board/neo1973/gta02/gta02.c
+===================================================================
+--- u-boot.orig/board/neo1973/gta02/gta02.c
++++ u-boot/board/neo1973/gta02/gta02.c
+@@ -67,6 +67,13 @@
+ extern unsigned char booted_from_nand;
+ extern unsigned char booted_from_nor;
+ extern int nobootdelay;
++char __cfg_prompt[20] = "GTA02vXX # ";
++
++/*
++ * In >GTA02v5, use gta02_revision to test for features, not
++ * CONFIG_GTA02_REVISION or CONFIG_ARCH_GTA02_vX !
++ */
++int gta02_revision;
+ 
+ int gta02_get_pcb_revision(void);
+ 
+@@ -253,6 +260,37 @@
+ 	return 0;
+ }
+ 
++static void set_revision(void)
++{
++	int rev = gta02_get_pcb_revision();
++	char buf[32];
++
++	if (CONFIG_GTA02_REVISION < 5)
++		gta02_revision = CONFIG_GTA02_REVISION;
++	else {
++		switch (rev) {
++		case 0x000:
++			gta02_revision = 5;
++			break;
++		case 0x001:
++			gta02_revision = 6;
++			break;
++		default:
++			printf("Unrecognized hardware revision 0x%03x. "
++			    "Defaulting to GTA02v6.\n", rev);
++			gta02_revision = 6;
++		}
++	}
++	sprintf(__cfg_prompt, "GTA02v%d # ", gta02_revision);
++
++#if 1 /* remove these after checking that Andy doesn't need them anymore */
++	printf("PCB rev: 0x%03X\n", rev);
++	/* expose in the env so we can add to kernel commandline */
++	sprintf(buf, "0x%03X", rev);
++	setenv("pcb_rev", buf);
++#endif
++}
++
+ int board_late_init(void)
+ {
+ 	S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO();
+@@ -260,12 +298,8 @@
+ 	char buf[32];
+ 	int menu_vote = 0; /* <= 0: no, > 0: yes */
+ 	int seconds = 0;
+-	int rev = gta02_get_pcb_revision();
+ 
+-	printf("PCB rev: 0x%03X\n", rev);
+-	/* expose in the env so we can add to kernel commandline */
+-	sprintf(buf, "0x%03X", rev);
+-	setenv("pcb_rev", buf);
++	set_revision();
+ 
+ 	/* Initialize the Power Management Unit with a safe register set */
+ 	pcf50633_init();
+@@ -378,7 +412,7 @@
+ 
+ u_int32_t get_board_rev(void)
+ {
+-	return 0x300+0x10*CONFIG_GTA02_REVISION;
++	return 0x300+0x10*gta02_revision;
+ }
+ 
+ void neo1973_poweroff(void)
+@@ -546,7 +580,7 @@
+ /**
+  * returns PCB revision information in b9,b8 and b2,b1,b0
+  * Pre-GTA02 A6 returns 0x000
+- *     GTA02 A6 returns 0x101
++ *     GTA02 A6 returns 0x001
+  */
+ 
+ int gta02_get_pcb_revision(void)
+Index: u-boot/board/neo1973/gta02/split_by_variant.sh
+===================================================================
+--- u-boot.orig/board/neo1973/gta02/split_by_variant.sh
++++ u-boot/board/neo1973/gta02/split_by_variant.sh
+@@ -42,19 +42,12 @@
+ 	echo "CONFIG_USB_DFU_REVISION=0x0340" > $CFGTMP
+ 	;;
+ 
+-	gta02v5_config)
++	gta02v5_config|gta02v6_config)
+ 	echo "#define CONFIG_ARCH_GTA02_v5" > $CFGINC
+ 	echo "#define CONFIG_GTA02_REVISION 5" >> $CFGINC
+ 	echo "CONFIG_USB_DFU_REVISION=0x0350" > $CFGTMP
+ 	;;
+ 
+-	gta02v6_config)
+-	echo "#define CONFIG_ARCH_GTA02_v6" > $CFGINC
+-	echo "#define CONFIG_GTA02_REVISION 6" >> $CFGINC
+-	echo "CONFIG_USB_DFU_REVISION=0x0360" > $CFGTMP
+-	;;
+-
+-
+ 	*)
+ 	echo "$0:: Unrecognised config - using GTA02v5 config"
+ 	echo "#define CONFIG_ARCH_GTA02_v5" > $CFGINC
+@@ -65,6 +58,7 @@
+ 	esac
+ 
+ fi
++sed 's/^/#define /;s/=/ /' <$CFGTMP >>$CFGINC
+ # ---------------------------------------------------------
+ # Complete the configuration
+ # ---------------------------------------------------------
+Index: u-boot/include/configs/neo1973_gta02.h
+===================================================================
+--- u-boot.orig/include/configs/neo1973_gta02.h
++++ u-boot/include/configs/neo1973_gta02.h
+@@ -127,8 +127,12 @@
+ 
+ #define STRINGIFY(s) DO_STRINGIFY(s)	/* expand the argument */
+ #define DO_STRINGIFY(s) #s		/* quote it */
+-#define	CFG_PROMPT		"GTA02v" STRINGIFY(CONFIG_GTA02_REVISION) " # "
++#define	CFG_PROMPT			__cfg_prompt
+ 						/* Monitor Command Prompt */
++#ifndef __ASSEMBLY__
++extern char __cfg_prompt[20];
++#endif
++
+ #if defined(CONFIG_ARCH_GTA02_v1)
+ #define	CONFIG_S3C2440		1		/* SAMSUNG S3C2440 SoC		*/
+ #else
+@@ -293,4 +297,8 @@
+ 
+ #define DFU_NUM_ALTERNATES	7
+ 
++#ifndef __ASSEMBLY__
++extern int gta02_revision; /* use this instead of CONFIG_GTA02_REVISION */
++#endif
++
+ #endif	/* __CONFIG_H */
+Index: u-boot/drivers/usb/usbdfu.c
+===================================================================
+--- u-boot.orig/drivers/usb/usbdfu.c
++++ u-boot/drivers/usb/usbdfu.c
+@@ -101,7 +101,7 @@
+ 	     trailer->product != CONFIG_USBD_PRODUCTID_GSERIAL))
+ 		return 0;
+ #ifdef CONFIG_REVISION_TAG
+-	if (trailer->revision != get_board_rev())
++	if (trailer->revision != CONFIG_USB_DFU_REVISION)
+ 		return 0;
+ #endif
+ 
+Index: u-boot/board/neo1973/gta01/split_by_variant.sh
+===================================================================
+--- u-boot.orig/board/neo1973/gta01/split_by_variant.sh
++++ u-boot/board/neo1973/gta01/split_by_variant.sh
+@@ -58,6 +58,7 @@
+ 	esac
+ 
+ fi
++sed 's/^/#define /;s/=/ /' <$CFGTMP >>$CFGINC
+ # ---------------------------------------------------------
+ # Complete the configuration
+ # ---------------------------------------------------------

Modified: trunk/src/target/u-boot/patches/gpb-shadow.patch
===================================================================
--- trunk/src/target/u-boot/patches/gpb-shadow.patch	2008-04-01 01:16:55 UTC (rev 4281)
+++ trunk/src/target/u-boot/patches/gpb-shadow.patch	2008-04-01 01:53:34 UTC (rev 4282)
@@ -8,15 +8,16 @@
 ===================================================================
 --- u-boot.orig/board/neo1973/gta02/gta02.c
 +++ u-boot/board/neo1973/gta02/gta02.c
-@@ -67,6 +67,7 @@
- extern unsigned char booted_from_nand;
- extern unsigned char booted_from_nor;
- extern int nobootdelay;
+@@ -75,6 +75,8 @@
+  */
+ int gta02_revision;
+ 
 +static uint16_t gpb_shadow = 0; /* to work around GTA02v5 LED bug */
++
+ int gta02_get_pcb_revision(void);
  
  static inline void delay (unsigned long loops)
- {
-@@ -388,6 +389,7 @@
+@@ -452,6 +454,7 @@
  #else
  		gpio->GPBDAT &= ~(1 << 3);	/* GPB3 */
  #endif
@@ -24,7 +25,7 @@
  }
  
  void neo1973_gsm(int on)
-@@ -507,8 +509,12 @@
+@@ -571,10 +574,14 @@
  	if (led > 2)
  		return;
  
@@ -41,3 +42,5 @@
 +		gpio->GPBDAT = (gpio->GPBDAT | gpb_shadow) & ~(1 << led);
 +	}
  }
+ 
+ /**

Modified: trunk/src/target/u-boot/patches/series
===================================================================
--- trunk/src/target/u-boot/patches/series	2008-04-01 01:16:55 UTC (rev 4281)
+++ trunk/src/target/u-boot/patches/series	2008-04-01 01:53:34 UTC (rev 4282)
@@ -98,6 +98,7 @@
 
 # make u-boot revision-agnostic (for GTA02v5 and above)
 uboot-add-rev-detection.patch
+config-gta02v5-beyond.patch
 
 # Experimental.
 gpb-shadow.patch

Modified: trunk/src/target/u-boot/patches/wait-for-power.patch
===================================================================
--- trunk/src/target/u-boot/patches/wait-for-power.patch	2008-04-01 01:16:55 UTC (rev 4281)
+++ trunk/src/target/u-boot/patches/wait-for-power.patch	2008-04-01 01:53:34 UTC (rev 4282)
@@ -39,8 +39,8 @@
  unsigned int neo1973_wakeup_cause;
  extern unsigned char booted_from_nand;
  extern unsigned char booted_from_nor;
-@@ -254,6 +259,42 @@
- 	return 0;
+@@ -293,6 +298,42 @@
+ #endif
  }
  
 +static void poll_charger(void)
@@ -82,15 +82,15 @@
  int board_late_init(void)
  {
  	S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO();
-@@ -261,6 +302,7 @@
+@@ -300,6 +341,7 @@
  	char buf[32];
  	int menu_vote = 0; /* <= 0: no, > 0: yes */
  	int seconds = 0;
 +	int enter_bootmenu;
- 	int rev = gta02_get_pcb_revision();
  
- 	printf("PCB rev: 0x%03X\n", rev);
-@@ -275,12 +317,13 @@
+ 	set_revision();
+ 
+@@ -310,12 +352,13 @@
  	int1 = pcf50633_reg_read(PCF50633_REG_INT1);
  	int2 = pcf50633_reg_read(PCF50633_REG_INT2);
  
@@ -106,7 +106,7 @@
  	neo1973_vibrator(0);
  
  #if defined(CONFIG_ARCH_GTA02_v1)
-@@ -342,9 +385,15 @@
+@@ -377,9 +420,15 @@
  	neo1973_poweroff();
  
  continue_boot:
@@ -122,7 +122,7 @@
  
  #if 0
  	{
-@@ -355,7 +404,7 @@
+@@ -390,7 +439,7 @@
  	}
  #endif
  





More information about the commitlog mailing list