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

werner at sita.openmoko.org werner at sita.openmoko.org
Tue Apr 1 01:28:35 CEST 2008


Author: werner
Date: 2008-04-01 01:28:30 +0200 (Tue, 01 Apr 2008)
New Revision: 4278

Added:
   trunk/src/target/u-boot/patches/uboot-add-rev-detection.patch
Modified:
   trunk/src/target/u-boot/patches/series
   trunk/src/target/u-boot/patches/wait-for-power.patch
Log:
series, uboot-add-rev-detection.patch:
- board/neo1973/gta02/gta02.c: added support for hardware-assisted detection of
  board revision

wait-for-power.patch: updated for above changes



Modified: trunk/src/target/u-boot/patches/series
===================================================================
--- trunk/src/target/u-boot/patches/series	2008-03-31 17:44:47 UTC (rev 4277)
+++ trunk/src/target/u-boot/patches/series	2008-03-31 23:28:30 UTC (rev 4278)
@@ -96,6 +96,9 @@
 # use pull-downs to keep unused inputs from floating
 fix-cpu-input-pulldowns.patch
 
+# make u-boot revision-agnostic (for GTA02v5 and above)
+uboot-add-rev-detection.patch
+
 # Experimental.
 gpb-shadow.patch
 wait-for-power.patch

Added: trunk/src/target/u-boot/patches/uboot-add-rev-detection.patch
===================================================================
--- trunk/src/target/u-boot/patches/uboot-add-rev-detection.patch	2008-03-31 17:44:47 UTC (rev 4277)
+++ trunk/src/target/u-boot/patches/uboot-add-rev-detection.patch	2008-03-31 23:28:30 UTC (rev 4278)
@@ -0,0 +1,131 @@
+uboot-add-rev-detection.patch
+
+GTA02 A6+ has board rev detection capability, provide
+ int gta02_get_pcb_revision(void)
+which returns
+
+b9    b8        b2    b1    b0
+GPD4  GPD3     GPD0  GPC15 GPC13
+
+GTA02 A5 and before:  0x000
+GTA02 A6           :  0x101
+
+Also create pcb_rev in the environment, which contains, eg, 0x101 and
+can be passed into the operating system on the commandline.  For linux
+this can then be seen from userspace by
+
+cat /proc/cmdline
+
+Signed-off-by: Andy Green <andy at openmoko.com>
+---
+
+ board/neo1973/gta02/gta02.c |   73 ++++++++++++++++++++++++++++++++++++++++++-
+ 1 files changed, 72 insertions(+), 1 deletions(-)
+
+Index: u-boot/board/neo1973/gta02/gta02.c
+===================================================================
+--- u-boot.orig/board/neo1973/gta02/gta02.c
++++ u-boot/board/neo1973/gta02/gta02.c
+@@ -68,6 +68,8 @@
+ extern unsigned char booted_from_nor;
+ extern int nobootdelay;
+ 
++int gta02_get_pcb_revision(void);
++
+ static inline void delay (unsigned long loops)
+ {
+ 	__asm__ volatile ("1:\n"
+@@ -170,12 +172,25 @@
+ 	gpio->GPBCON = 0x00155555;
+ 	gpio->GPBUP = 0x000007FF;
+ 
+-	/* pulldown on "PIO_5" BT module to stop float when unpowered */
++	/*
++	 * PCB rev index found on C13, C15, D0, D3 and D4.  These are NC or
++	 * pulled up by 10K.  Therefore to ensure no current flows when they
++	 * are not interrogated, we drive them high.  When we interrogate them
++	 * we make them pulled them down inputs briefly and set them high op
++	 * again afterwards.
++	 */
++
++	/* pulldown on "PIO_5" BT module to stop float when unpowered
++	 * C13 and C15 are b0 and b1 of PCB rev index
++	 */
+ 	gpio->GPCCON = 0x55555155;
+ 	gpio->GPCUP = 0x0000FFFF & ~(1 << 5);
++	gpio->GPCDAT |= (1 << 13) | (1 << 15); /* index detect -> hi */
+ 
++	/* D0, D3 and D4 are b2, b3 and b4 of PCB rev index */
+ 	gpio->GPDCON = 0x55555555;
+ 	gpio->GPDUP = 0x0000FFFF;
++	gpio->GPDDAT |= (1 << 0) | (1 << 3) | (1 << 4); /* index detect -> hi */
+ 
+ 	/* pulldown on GPE11 / SPIMISO0 - goes to debug board and will float */
+ 	gpio->GPECON = 0xAAAAAAAA;
+@@ -245,6 +260,12 @@
+ 	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);
+ 
+ 	/* Initialize the Power Management Unit with a safe register set */
+ 	pcf50633_init();
+@@ -521,3 +542,53 @@
+ 	else
+ 		gpio->GPBDAT &= ~(1 << led);
+ }
++
++/**
++ * returns PCB revision information in b9,b8 and b2,b1,b0
++ * Pre-GTA02 A6 returns 0x000
++ *     GTA02 A6 returns 0x101
++ */
++
++int gta02_get_pcb_revision(void)
++{
++	S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO();
++	int n;
++	u32 u;
++
++	/* make C13 and C15 pulled-down inputs */
++	gpio->GPCCON &= ~0xcc000000;
++	gpio->GPCUP  &= ~((1 << 13) | (1 << 15));
++	/* D0, D3 and D4 pulled-down inputs */
++	gpio->GPDCON &= ~0x000003c3;
++	gpio->GPDUP  &= ~((1 << 0) | (1 << 3) | (1 << 4));
++
++	/* delay after changing pulldowns */
++	u = gpio->GPCDAT;
++	u = gpio->GPDDAT;
++
++	/* read the version info */
++	u = gpio->GPCDAT;
++	n =  (u >> (13 - 0)) & 0x001;
++	n |= (u >> (15 - 1)) & 0x002;
++	u = gpio->GPDDAT;
++	n |= (u << (0 + 2))  & 0x004;
++
++	n |= (u << (8 - 3))  & 0x100;
++	n |= (u << (9 - 4))  & 0x200;
++
++	/*
++	 * when not being interrogated, all of the revision GPIO
++	 * are set to output HIGH without pulldown so no current flows
++	 * if they are NC or pulled up.
++	 */
++	/* make C13 and C15 high ouputs with no pulldowns */
++	gpio->GPCCON |= 0x44000000;
++	gpio->GPCUP  |= (1 << 13) | (1 << 15);
++	gpio->GPCDAT |= (1 << 13) | (1 << 15);
++	/* D0, D3 and D4 high ouputs with no pulldowns */
++	gpio->GPDCON |= 0x00000141;
++	gpio->GPDUP  |= (1 << 0) | (1 << 3) | (1 << 4);
++	gpio->GPDDAT |= (1 << 0) | (1 << 3) | (1 << 4);
++
++	return n;
++}

Modified: trunk/src/target/u-boot/patches/wait-for-power.patch
===================================================================
--- trunk/src/target/u-boot/patches/wait-for-power.patch	2008-03-31 17:44:47 UTC (rev 4277)
+++ trunk/src/target/u-boot/patches/wait-for-power.patch	2008-03-31 23:28:30 UTC (rev 4278)
@@ -39,7 +39,7 @@
  unsigned int neo1973_wakeup_cause;
  extern unsigned char booted_from_nand;
  extern unsigned char booted_from_nor;
-@@ -229,6 +234,42 @@
+@@ -254,6 +259,42 @@
  	return 0;
  }
  
@@ -82,15 +82,15 @@
  int board_late_init(void)
  {
  	S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO();
-@@ -236,6 +277,7 @@
+@@ -261,6 +302,7 @@
  	char buf[32];
  	int menu_vote = 0; /* <= 0: no, > 0: yes */
  	int seconds = 0;
 +	int enter_bootmenu;
+ 	int rev = gta02_get_pcb_revision();
  
- 	/* Initialize the Power Management Unit with a safe register set */
- 	pcf50633_init();
-@@ -244,12 +286,13 @@
+ 	printf("PCB rev: 0x%03X\n", rev);
+@@ -275,12 +317,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)
-@@ -311,9 +354,15 @@
+@@ -342,9 +385,15 @@
  	neo1973_poweroff();
  
  continue_boot:
@@ -122,7 +122,7 @@
  
  #if 0
  	{
-@@ -324,7 +373,7 @@
+@@ -355,7 +404,7 @@
  	}
  #endif
  





More information about the commitlog mailing list