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

laforge at sita.openmoko.org laforge at sita.openmoko.org
Sun Feb 11 04:07:30 CET 2007


Author: laforge
Date: 2007-02-11 04:07:29 +0100 (Sun, 11 Feb 2007)
New Revision: 948

Modified:
   trunk/src/target/u-boot/patches/uboot-neo1973-poweroff.patch
Log:
* add full PMU register initialization during boot.  We want to start
  with a clean state, and with only those units powered up that we need.


Modified: trunk/src/target/u-boot/patches/uboot-neo1973-poweroff.patch
===================================================================
--- trunk/src/target/u-boot/patches/uboot-neo1973-poweroff.patch	2007-02-11 03:05:27 UTC (rev 947)
+++ trunk/src/target/u-boot/patches/uboot-neo1973-poweroff.patch	2007-02-11 03:07:29 UTC (rev 948)
@@ -5,8 +5,8 @@
 
 Index: u-boot/board/neo1973/Makefile
 ===================================================================
---- u-boot.orig/board/neo1973/Makefile	2007-02-09 01:04:03.000000000 +0100
-+++ u-boot/board/neo1973/Makefile	2007-02-09 01:09:37.000000000 +0100
+--- u-boot.orig/board/neo1973/Makefile	2007-02-10 19:33:14.000000000 +0100
++++ u-boot/board/neo1973/Makefile	2007-02-10 20:22:57.000000000 +0100
 @@ -25,7 +25,7 @@
  
  LIB	= lib$(BOARD).a
@@ -19,7 +19,7 @@
 Index: u-boot/board/neo1973/cmd_neo1973.c
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ u-boot/board/neo1973/cmd_neo1973.c	2007-02-09 01:09:37.000000000 +0100
++++ u-boot/board/neo1973/cmd_neo1973.c	2007-02-10 19:33:17.000000000 +0100
 @@ -0,0 +1,148 @@
 +/*
 + * (C) Copyright 2006 by OpenMoko, Inc.
@@ -171,8 +171,8 @@
 +#endif	/* CFG_CMD_BDI */
 Index: u-boot/board/neo1973/neo1973.c
 ===================================================================
---- u-boot.orig/board/neo1973/neo1973.c	2007-02-09 01:09:35.000000000 +0100
-+++ u-boot/board/neo1973/neo1973.c	2007-02-09 01:09:48.000000000 +0100
+--- u-boot.orig/board/neo1973/neo1973.c	2007-02-10 19:33:14.000000000 +0100
++++ u-boot/board/neo1973/neo1973.c	2007-02-10 21:45:30.000000000 +0100
 @@ -34,8 +34,14 @@
  #include <s3c2410.h>
  #include <i2c.h>
@@ -225,19 +225,19 @@
  	gpio->GPBUP = 0x000007FF;
  	gpio->GPBDAT |= 0x4;		/* Set GBP2 to high (Flash power-up) */
  
-@@ -184,6 +193,7 @@
+@@ -184,26 +193,65 @@
  int board_late_init(void)
  {
  	unsigned char tmp;
 +	char buf[32];
  
- 	tmp = 0x17; /* charge backup battery with 100uA during ACTIVE+STANDBY*/
- 	i2c_write(0x08, 0x2d, 1, &tmp, 1);
-@@ -204,6 +214,61 @@
- 	/* enable D2REG 3.3V (SC/MMC power) */
- 	i2c_write(0x08, 0x25, 1, &mmc_power, 1);
- #endif
-+
+-	tmp = 0x17; /* charge backup battery with 100uA during ACTIVE+STANDBY*/
+-	i2c_write(0x08, 0x2d, 1, &tmp, 1);
++	/* Initialize the Power Management Unit with a safe register set */
++	pcf50606_init();
+ 
+-	tmp = 0x1a; /* 4.2V battery, precharge 0.1*Ifast */
+-	i2c_write(0x08, 0x2b, 1, &tmp, 1);
 +	/* obtain wake-up reason, save INT1 in environment */
 +	tmp = pcf50606_reg_read(PCF50606_REG_INT1);
 +	sprintf(buf, "0x%02x", tmp);
@@ -257,7 +257,7 @@
 +		neo1973_wakeup_cause = NEO1973_WAKEUP_POWER_KEY;
 +		/* we've been woken up by a falling edge of the onkey */
 +
-+		/* we can't just setenv(bootdelay,-1) because that would 
++		/* we can't just setenv(bootdelay,-1) because that would
 +		 * accidentially become permanent if the user does saveenv */
 +		if (neo1973_911_key_pressed())
 +			nobootdelay = 1;
@@ -288,14 +288,26 @@
 +	neo1973_vibrator(1);
 +	udelay(50000);
 +	neo1973_vibrator(0);
-+
+ 
+-	tmp = 0x0f; /* CHGAPE | AUTOFST | fast charge */
+-	i2c_write(0x08, 0x29, 1, &tmp, 1);
 +	/* switch on the backlight */
 +	neo1973_backlight(1);
-+
+ 
+-#if defined(CONFIG_ARCH_GTA01B_v2) || defined(CONFIG_ARCH_GTA01B_v3)
+-	tmp = 0xe4;	/* CPU Voltage: 2.1V */
+-	i2c_write(0x08, 0x21, 1, &tmp, 1);
+-#endif
+-
+-#if defined(CONFIG_ARCH_GTA01_v3) || defined(CONFIG_ARCH_GTA01_v4)
+-	const char mmc_power = 0x8f;
+-	/* enable D2REG 3.3V (SC/MMC power) */
+-	i2c_write(0x08, 0x25, 1, &mmc_power, 1);
+-#endif
  	return 0;
  }
  
-@@ -227,3 +292,38 @@
+@@ -227,3 +275,38 @@
  	return 0x00000230;
  #endif
  }
@@ -337,8 +349,8 @@
 Index: u-boot/board/neo1973/pcf50606.h
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ u-boot/board/neo1973/pcf50606.h	2007-02-09 01:09:37.000000000 +0100
-@@ -0,0 +1,265 @@
++++ u-boot/board/neo1973/pcf50606.h	2007-02-10 20:19:12.000000000 +0100
+@@ -0,0 +1,267 @@
 +#ifndef _PCF50606_H
 +#define _PCF50606_H
 +
@@ -602,12 +614,14 @@
 +
 +u_int8_t pcf50606_reg_set_bit_mask(u_int8_t reg, u_int8_t mask, u_int8_t val);
 +
++void pcf50606_init(void);
++
 +#endif /* _PCF50606_H */
 +
 Index: u-boot/board/neo1973/neo1973.h
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ u-boot/board/neo1973/neo1973.h	2007-02-09 01:09:37.000000000 +0100
++++ u-boot/board/neo1973/neo1973.h	2007-02-10 19:33:17.000000000 +0100
 @@ -0,0 +1,18 @@
 +#ifndef _NEO1973_H
 +#define _NEO1973_H
@@ -630,11 +644,13 @@
 Index: u-boot/board/neo1973/pcf50606.c
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ u-boot/board/neo1973/pcf50606.c	2007-02-09 01:09:37.000000000 +0100
-@@ -0,0 +1,24 @@
++++ u-boot/board/neo1973/pcf50606.c	2007-02-10 22:55:32.000000000 +0100
+@@ -0,0 +1,193 @@
 +
 +#include <common.h>
 +#include <i2c.h>
++#include "pcf50606.h"
++#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
 +
 +#define PCF50606_I2C_ADDR		0x08
 +
@@ -656,10 +672,177 @@
 +	pcf50606_reg_write(reg, (val & mask) | (tmp & ~mask));
 +}
 +
++static const u_int8_t regs_valid[] = { 
++	PCF50606_REG_OOCS,
++	PCF50606_REG_INT1M,
++	PCF50606_REG_INT2M,
++	PCF50606_REG_INT3M,
++	PCF50606_REG_OOCC1,
++	PCF50606_REG_OOCC2,
++	PCF50606_REG_PSSC,
++	PCF50606_REG_PWROKM,
++	PCF50606_REG_DCDC1,
++	PCF50606_REG_DCDC2,
++	PCF50606_REG_DCDC3,
++	PCF50606_REG_DCDC4,
++	PCF50606_REG_DCDEC1,
++	PCF50606_REG_DCDEC2,
++	PCF50606_REG_DCUDC1,
++	PCF50606_REG_DCUDC2,
++	PCF50606_REG_IOREGC,
++	PCF50606_REG_D1REGC1,
++	PCF50606_REG_D2REGC1,
++	PCF50606_REG_D3REGC1,
++	PCF50606_REG_LPREGC1,
++	PCF50606_REG_LPREGC2,
++	PCF50606_REG_MBCC1,
++	PCF50606_REG_MBCC2,
++	PCF50606_REG_MBCC3,
++	PCF50606_REG_BBCC,
++	PCF50606_REG_ADCC1,
++	PCF50606_REG_ADCC2,
++	PCF50606_REG_ACDC1,
++	PCF50606_REG_BVMC,
++	PCF50606_REG_PWMC1,
++	PCF50606_REG_LEDC1,
++	PCF50606_REG_LEDC2,
++	PCF50606_REG_GPOC1,
++	PCF50606_REG_GPOC2,
++	PCF50606_REG_GPOC3,
++	PCF50606_REG_GPOC4,
++	PCF50606_REG_GPOC5,
++};
++
++
++static const u_int8_t initial_register_set[__NUM_PCF50606_REGS] = {
++	[PCF50606_REG_OOCS] 	= 0x00,
++	/* gap */
++	[PCF50606_REG_INT1M]	= PCF50606_INT1_SECOND,
++	[PCF50606_REG_INT2M]	= 0x00,
++	[PCF50606_REG_INT3M]	= PCF50606_INT3_TSCPRES,
++	[PCF50606_REG_OOCC1] 	= PCF50606_OOCC1_RTCWAK |
++				  PCF50606_OOCC1_CHGWAK |
++				  PCF50606_OOCC1_EXTONWAK_HIGH,
++	[PCF50606_REG_OOCC2]	= PCF50606_OOCC2_ONKEYDB_14ms |
++				  PCF50606_OOCC2_EXTONDB_14ms,
++	/* gap */
++	[PCF50606_REG_PSSC]	= 0x00,
++	[PCF50606_REG_PWROKM]	= 0x00,
++	/* gap */
++#if defined(CONFIG_ARCH_GTA01B_v2)
++	[PCF50606_REG_DCDC1]	= 0x1e,	/* GL_3V3: off */
++#elif defined(CONFIG_ARCH_GTA01B_v3)
++	[PCF50606_REG_DCDC1]	= 0x18,	/* GL_1V5: off */
++#endif
++	[PCF50606_REG_DCDC2]	= 0x00,
++	[PCF50606_REG_DCDC3]	= 0x00,
++	[PCF50606_REG_DCDC4]	= 0x30, /* 1.25A */
++
++	[PCF50606_REG_DCDEC1]	= 0xe8, /* IO_3V3: on */
++	[PCF50606_REG_DCDEC2]	= 0x00,
++
++#if defined(CONFIG_ARCH_GTA01_v3) || defined(CONFIG_ARCH_GTA01_v4)
++	[PCF50606_REG_DCUDC1]	= 0xe3, /* CORE_1V8: 1.8V */
++#elif defined(CONFIG_ARCH_GTA01B_v2) || defined(CONFIG_ARCH_GTA01B_v3)
++	[PCF50606_REG_DCUDC1]	= 0xe4, /* CORE_1V8: 2.1V */
++#endif
++	[PCF50606_REG_DCUDC2]	= 0x30, /* 1.25A current limit */
++
++#if defined(CONFIG_ARCH_GTA01_v3)
++	[PCF50606_REG_IOREGC]	= 0x13, /* VTCXO_2V8: off */
++#elif defined(CONFIG_ARCH_GTA01_v4) || defined(CONFIG_ARCH_GTA01B_v2) || defined(CONFIG_ARCH_GTA01B_v3)
++	//see internal bug 94 [PCF50606_REG_IOREGC]	= 0x18, /* CODEC_3V3: off */
++	[PCF50606_REG_IOREGC]	= 0xf8, /* CODEC_3V3: on */
++#endif
++
++#if defined(CONFIG_ARCH_GTA01_v3) || defined(CONFIG_ARCH_GTA01_v4)
++	[PCF50606_REG_D1REGC1]	= 0x15, /* VRF_3V: off */
++#elif defined(CONFIG_ARCH_GTA01B_v2) || defined(CONFIG_ARCH_GTA01B_v3)
++	[PCF50606_REG_D1REGC1]	= 0x16, /* BT_3V15: off */
++#endif
++
++#if defined(CONFIG_ARCH_GTA01_v3)
++	[PCF50606_REG_D2REGC1]	= 0xf8, /* SD_3V3: on */
++#elif defined(CONFIG_ARCH_GTA01_v4) || defined(CONFIG_ARCH_GTA01B_v2) || defined(CONFIG_ARCH_GTA01B_v3)
++	[PCF50606_REG_D2REGC1]	= 0x10, /* GL_2V5: off */
++#endif
++
++#if defined(CONFIG_ARCH_GTA01_v3)
++	[PCF50606_REG_D3REGC1]	= 0x18, /* CODEC_3V3: off */
++#elif defined(CONFIG_ARCH_GTA01_v4)
++	[PCF50606_REG_D3REGC1]	= 0x13, /* VTXCO_2V8: off */
++#elif defined(CONFIG_ARCH_GTA01B_v2) || defined(CONFIG_ARCH_GTA01B_v3)
++	[PCF50606_REG_D3REGC1]	= 0x00, /* USER1: off */
++#endif
++
++	[PCF50606_REG_LPREGC1]	= 0xf8, /* LCM_3V3: on */
++	[PCF50606_REG_LPREGC2]	= 0x00,
++
++	[PCF50606_REG_MBCC1]	= 0x01, /* CHGAPE */
++	[PCF50606_REG_MBCC2]	= 0x00,	/* unlimited charging */
++	[PCF50606_REG_MBCC3]	= 0x1a, /* 0.2*Ifast, 4.20V */
++	[PCF50606_REG_BBCC]	= 0x13, /* 50uA */
++	[PCF50606_REG_ADCC1]	= 0x00,
++	[PCF50606_REG_ADCC2]	= 0x00,
++	/* gap */
++	[PCF50606_REG_ACDC1]	= 0x00,
++	[PCF50606_REG_BVMC]	= PCF50606_BVMC_THRSHLD_2V8,
++	[PCF50606_REG_PWMC1]	= 0x00,
++	[PCF50606_REG_LEDC1]	= 0x00,
++	[PCF50606_REG_LEDC2]	= 0x00,
++	[PCF50606_REG_GPOC1]	= 0x00,
++	[PCF50606_REG_GPOC2]	= 0x00,
++	[PCF50606_REG_GPOC3]	= 0x00,
++	[PCF50606_REG_GPOC4]	= 0x00,
++	[PCF50606_REG_GPOC5]	= 0x00,
++};
++
++
++/* initialize PCF50606 register set */
++void pcf50606_init(void)
++{
++#if 0
++	/* We don't want to write to RTC, Alarm and other status registers
++	 * but rather concentrate on efficiently writing/stting those we
++	 * need */
++
++	pcf50606_reg_write(PCF50606_REG_OOCS,
++			   initial_register_set[PCF50606_REG_OOCS]);
++
++	/* GAP: 0x02-0x04 */
++
++	i2c_write(PCF50606_I2C_ADDR, 0x05, 1,
++		  &initial_register_set[0x05], 5);
++
++	/* GAP: 0x0a..0a17 */
++
++	i2c_write(PCF50606_I2C_ADDR, 0x18, 1,
++		  &initial_register_set[0x18], 2);
++
++	/* GAP: 0x1a */
++
++	i2c_write(PCF50606_I2C_ADDR, 0x1b, 1,
++		  &initial_register_set[0x1b], 17);
++
++	/* GAP: 0x2c */
++
++	i2c_write(PCF50606_I2C_ADDR, 0x2d, 1,
++		  &initial_register_set[0x2d], 3);
++
++	/* GAP: 0x30-0x32 */
++	i2c_write(PCF50606_I2C_ADDR, 0x23, 1,
++		  &initial_register_set[0x33], 10);
++#else
++	int i;
++	for (i = 0; i < ARRAY_SIZE(regs_valid); i++)
++		pcf50606_reg_write(regs_valid[i],
++				   initial_register_set[regs_valid[i]]);
++#endif
++}
 Index: u-boot/common/main.c
 ===================================================================
---- u-boot.orig/common/main.c	2007-02-09 01:04:04.000000000 +0100
-+++ u-boot/common/main.c	2007-02-09 01:09:37.000000000 +0100
+--- u-boot.orig/common/main.c	2007-02-10 19:33:14.000000000 +0100
++++ u-boot/common/main.c	2007-02-10 19:33:17.000000000 +0100
 @@ -61,6 +61,7 @@
  #undef DEBUG_PARSER
  





More information about the commitlog mailing list