[U-Boot] [RFC PATCH v2 2/2] ARMV7: OMAP4: Add twl6032 support

2013-10-08 Thread Oleg Kosheliev
From: Oleg Kosheliev oleg.koshel...@ti.com

Added chip type detection and twl6032
support in the battery control
and charge functions.

Based on Balaji T K balaj...@ti.com patches for TI u-boot.

Signed-off-by: Oleg Kosheliev oleg.koshel...@ti.com
---
 drivers/power/twl6030.c |   54 +--
 include/twl6030.h   |   20 ++
 2 files changed, 68 insertions(+), 6 deletions(-)

diff --git a/drivers/power/twl6030.c b/drivers/power/twl6030.c
index 6bf1a33..a1c6663 100644
--- a/drivers/power/twl6030.c
+++ b/drivers/power/twl6030.c
@@ -20,6 +20,15 @@ static struct twl6030_data twl6030_info = {
.vbat_shift = TWL6030_VBAT_SHIFT,
 };
 
+static struct twl6030_data twl6032_info = {
+   .chip_type  = chip_TWL6032,
+   .adc_rbase  = TWL6032_GPCH0_LSB,
+   .adc_ctrl   = TWL6032_CTRL_P1,
+   .adc_enable = CTRL_P1_SP1,
+   .vbat_mult  = TWL6032_VBAT_MULT,
+   .vbat_shift = TWL6032_VBAT_SHIFT,
+};
+
 static int twl6030_gpadc_read_channel(u8 channel_no)
 {
u8 lsb = 0;
@@ -115,6 +124,18 @@ int twl6030_get_battery_voltage(void)
 {
int battery_volt = 0;
int ret = 0;
+   u8 vbatch;
+
+   if (twl-chip_type == chip_TWL6030) {
+   vbatch = TWL6030_GPADC_VBAT_CHNL;
+   } else {
+   ret = twl6030_i2c_write_u8(TWL6030_CHIP_ADC,
+  TWL6032_GPSELECT_ISB,
+  TWL6032_GPADC_VBAT_CHNL);
+   if (ret)
+   return ret;
+   vbatch = 0;
+   }
 
/* Start GPADC SW conversion */
ret = twl6030_gpadc_sw2_trigger();
@@ -124,7 +145,7 @@ int twl6030_get_battery_voltage(void)
}
 
/* measure Vbat voltage */
-   battery_volt = twl6030_gpadc_read_channel(7);
+   battery_volt = twl6030_gpadc_read_channel(vbatch);
if (battery_volt  0) {
printf(Failed to read battery voltage\n);
return ret;
@@ -137,14 +158,35 @@ int twl6030_get_battery_voltage(void)
 
 void twl6030_init_battery_charging(void)
 {
-   u8 stat1 = 0;
+   u8 val = 0;
int battery_volt = 0;
int ret = 0;
 
-   twl = twl6030_info;
+   ret = twl6030_i2c_read_u8(TWL6030_CHIP_USB, USB_PRODUCT_ID_LSB, val);
+   if (ret) {
+   puts(twl6030_init_battery_charging(): could not determine 
chip!\n);
+   return;
+   }
+   if (val == 0x30) {
+   twl = twl6030_info;
+   } else if (val == 0x32) {
+   twl = twl6032_info;
+   } else {
+   puts(twl6030_init_battery_charging(): unsupported chip 
type\n);
+   return;
+   }
 
/* Enable VBAT measurement */
-   twl6030_i2c_write_u8(TWL6030_CHIP_PM, MISC1, VBAT_MEAS);
+   if (twl-chip_type == chip_TWL6030) {
+   twl6030_i2c_write_u8(TWL6030_CHIP_PM, MISC1, VBAT_MEAS);
+   twl6030_i2c_write_u8(TWL6030_CHIP_ADC,
+TWL6030_GPADC_CTRL,
+GPADC_CTRL_SCALER_DIV4);
+   } else {
+   twl6030_i2c_write_u8(TWL6030_CHIP_ADC,
+TWL6032_GPADC_CTRL2,
+GPADC_CTRL2_CH18_SCALER_EN);
+   }
 
/* Enable GPADC module */
ret = twl6030_i2c_write_u8(TWL6030_CHIP_CHARGER, TOGGLE1, FGS | GPADCS);
@@ -161,10 +203,10 @@ void twl6030_init_battery_charging(void)
printf(Main battery voltage too low!\n);
 
/* Check for the presence of USB charger */
-   twl6030_i2c_read_u8(TWL6030_CHIP_CHARGER, CONTROLLER_STAT1, stat1);
+   twl6030_i2c_read_u8(TWL6030_CHIP_CHARGER, CONTROLLER_STAT1, val);
 
/* check for battery presence indirectly via Fuel gauge */
-   if ((stat1  VBUS_DET)  (battery_volt  3300))
+   if ((val  VBUS_DET)  (battery_volt  3300))
twl6030_start_usb_charging();
 
return;
diff --git a/include/twl6030.h b/include/twl6030.h
index 9399737..7898699 100644
--- a/include/twl6030.h
+++ b/include/twl6030.h
@@ -110,15 +110,35 @@
 #define CTRL_P2_EOCP2  (1  1)
 #define CTRL_P2_BUSY   (1  0)
 
+#define TWL6032_CTRL_P10x36
+#define CTRL_P1_SP1(1  3)
+
 #define GPCH0_LSB  0x57
 #define GPCH0_MSB  0x58
 
+#define TWL6032_GPCH0_LSB  0x3b
+
+#define TWL6032_GPSELECT_ISB   0x35
+
+#define USB_PRODUCT_ID_LSB 0x02
+
+#define TWL6030_GPADC_VBAT_CHNL0x07
+#define TWL6032_GPADC_VBAT_CHNL0x12
+
+#define TWL6030_GPADC_CTRL 0x2e
+#define TWL6032_GPADC_CTRL20x2f
+#define GPADC_CTRL2_CH18_SCALER_EN (1  2)
+#define GPADC_CTRL_SCALER_DIV4 (1  3)
+
 #define TWL6030_VBAT_MULT  40 * 1000
+#define TWL6032_VBAT_MULT  25 * 1000
 
 #define TWL6030_VBAT_SHIFT (10 + 3)
+#define TWL6032_VBAT_SHIFT (12 + 2)
 
 enum twl603x_chip_type{
chip_TWL6030

[U-Boot] [RFC PATCH v2 0/2] ARMV7: OMAP4: Add support for twl6032

2013-10-08 Thread Oleg Kosheliev
From: Oleg Kosheliev oleg.koshel...@globallogic.com

TWL6032 is a companion Power Management IC (PMIC) of OMAP4470.
This chip is similar to TWL6030 but has slight difference
in some registers e.g. for GPADC.
In u-boot only TWL6030 is supported now, thus there is no ability to 
boot OMAP4470 with TWL6032 because u-boot hangs when attempts to get
the battery voltage from GPADC using false ctrl register address.
These patches add the detection of the TWL chip type and support
for TWL6032 chip in the battery charger driver.

Changes in v2:
- removed typedef for twl603x_chip_type
- printf replaced with puts

Oleg Kosheliev (2):
  ARMV7: OMAP4: Add struct for twl603x data
  ARMV7: OMAP4: Add twl6032 support

 drivers/power/twl6030.c |   77 +--
 include/twl6030.h   |   38 +++
 2 files changed, 105 insertions(+), 10 deletions(-)

-- 
1.7.9.5

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [RFC PATCH v2 1/2] ARMV7: OMAP4: Add struct for twl603x data

2013-10-08 Thread Oleg Kosheliev
From: Oleg Kosheliev oleg.koshel...@ti.com

The data struct is used to support different
PMIC chip types. It contains the chip type and
the data (e.g. registers addresses, adc multiplier)
which is different for twl6030 and twl6032.
Replaced some hardcoded values with the
structure vars.

Based on Balaji T K balaj...@ti.com patches for TI u-boot.

Signed-off-by: Oleg Kosheliev oleg.koshel...@ti.com
---
 drivers/power/twl6030.c |   25 -
 include/twl6030.h   |   18 ++
 2 files changed, 38 insertions(+), 5 deletions(-)

diff --git a/drivers/power/twl6030.c b/drivers/power/twl6030.c
index 0858b60..6bf1a33 100644
--- a/drivers/power/twl6030.c
+++ b/drivers/power/twl6030.c
@@ -9,6 +9,17 @@
 
 #include twl6030.h
 
+static struct twl6030_data *twl;
+
+static struct twl6030_data twl6030_info = {
+   .chip_type  = chip_TWL6030,
+   .adc_rbase  = GPCH0_LSB,
+   .adc_ctrl   = CTRL_P2,
+   .adc_enable = CTRL_P2_SP2,
+   .vbat_mult  = TWL6030_VBAT_MULT,
+   .vbat_shift = TWL6030_VBAT_SHIFT,
+};
+
 static int twl6030_gpadc_read_channel(u8 channel_no)
 {
u8 lsb = 0;
@@ -16,12 +27,12 @@ static int twl6030_gpadc_read_channel(u8 channel_no)
int ret = 0;
 
ret = twl6030_i2c_read_u8(TWL6030_CHIP_ADC,
- GPCH0_LSB + channel_no * 2, lsb);
+ twl-adc_rbase + channel_no * 2, lsb);
if (ret)
return ret;
 
ret = twl6030_i2c_read_u8(TWL6030_CHIP_ADC,
- GPCH0_MSB + channel_no * 2, msb);
+ twl-adc_rbase + 1 + channel_no * 2, msb);
if (ret)
return ret;
 
@@ -33,7 +44,8 @@ static int twl6030_gpadc_sw2_trigger(void)
u8 val;
int ret = 0;
 
-   ret = twl6030_i2c_write_u8(TWL6030_CHIP_ADC, CTRL_P2, CTRL_P2_SP2);
+   ret = twl6030_i2c_write_u8(TWL6030_CHIP_ADC,
+  twl-adc_ctrl, twl-adc_enable);
if (ret)
return ret;
 
@@ -41,7 +53,8 @@ static int twl6030_gpadc_sw2_trigger(void)
val =  CTRL_P2_BUSY;
 
while (!((val  CTRL_P2_EOCP2)  (!(val  CTRL_P2_BUSY {
-   ret = twl6030_i2c_read_u8(TWL6030_CHIP_ADC, CTRL_P2, val);
+   ret = twl6030_i2c_read_u8(TWL6030_CHIP_ADC,
+ twl-adc_ctrl, val);
if (ret)
return ret;
udelay(1000);
@@ -116,7 +129,7 @@ int twl6030_get_battery_voltage(void)
printf(Failed to read battery voltage\n);
return ret;
}
-   battery_volt = (battery_volt * 25 * 1000)  (10 + 2);
+   battery_volt = (battery_volt * twl-vbat_mult)  twl-vbat_shift;
printf(Battery Voltage: %d mV\n, battery_volt);
 
return battery_volt;
@@ -128,6 +141,8 @@ void twl6030_init_battery_charging(void)
int battery_volt = 0;
int ret = 0;
 
+   twl = twl6030_info;
+
/* Enable VBAT measurement */
twl6030_i2c_write_u8(TWL6030_CHIP_PM, MISC1, VBAT_MEAS);
 
diff --git a/include/twl6030.h b/include/twl6030.h
index b4035ba..9399737 100644
--- a/include/twl6030.h
+++ b/include/twl6030.h
@@ -113,6 +113,24 @@
 #define GPCH0_LSB  0x57
 #define GPCH0_MSB  0x58
 
+#define TWL6030_VBAT_MULT  40 * 1000
+
+#define TWL6030_VBAT_SHIFT (10 + 3)
+
+enum twl603x_chip_type{
+   chip_TWL6030,
+   chip_TWL603X_cnt
+};
+
+struct twl6030_data{
+   u8 chip_type;
+   u8 adc_rbase;
+   u8 adc_ctrl;
+   u8 adc_enable;
+   int vbat_mult;
+   int vbat_shift;
+};
+
 /* Functions to read and write from TWL6030 */
 static inline int twl6030_i2c_write_u8(u8 chip_no, u8 reg, u8 val)
 {
-- 
1.7.9.5

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] SPL binary too large for OMAP4460 OCM

2013-09-04 Thread Oleg Kosheliev
Hi, André


From: u-boot-boun...@lists.denx.de [u-boot-boun...@lists.denx.de] on
behalf of André Schaller [an.sch...@googlemail.com]
Sent: Wednesday, September 04, 2013 10:09 AM
To: u-boot@lists.denx.de
Subject: [U-Boot] SPL binary too large for OMAP4460 OCM

Hi everybody,

I need to add functionality to the SPL code. I tried to implement in a
memory-saving way, however, the SPL is about 45 kB after compilation. To
get compilation working, I had to set CONFIG_SPL_MAX_SIZE to (45 *
1024). Now, the SPL as well as u-boot won't boot. After the device'
(PandaBoard ES - OMAP4460) reset, nothing happens regarding it's output
on terminal.

My question: is it theoretically possible to to establish a successfully
booting SPL with ~45 kB in size for this device? The device'
on-chip-memory is 56kB so it could fit in there. If so, what needs to be
configured / tuned to get it working? Are there any other features I
could omit from the binary to make it smaller?

Thanks a lot,
André
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

We can use the area 0x4030 - 0x4030bfff for downloading the SPL image.
If the image exceed this - it leads to corrupting the ROM code stack and
the device hangs up.
See my patch [U-Boot] [RFC PATCH] armv7:omap4-common: Correct check of the
SPL image size. (It's not in mainline. I'll do some corrections and send v2
soon.)
For HS devices the SPL image is loaded from the address 0x40304350. So we
have 0x4030bfff - 0x40304350 = 0x7CAF = 31,919 bytes for SPL.
The area from 0x4030 till 0x40304350 in HS devices is used for security
data.
If you have GP device you can use the whole 0x4030 - 0x4030bfff space
i.e. 49,152 bytes, just change #define CONFIG_SPL_TEXT_BASE from 0x40304350
to 0x4030.

Best regards,
  Oleg
http://www.globallogic.com/email_disclaimer.txt
 http://www.globallogic.com/email_disclaimer.txt
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [RFC PATCH 2/2] ARMV7: OMAP4: Add twl6032 support

2013-07-24 Thread Oleg Kosheliev
From: Oleg Kosheliev oleg.koshel...@ti.com

Added chip type detection and twl6032
support in the battery control
and charge functions.

Based on Balaji T K balaj...@ti.com patches for TI u-boot.

Signed-off-by: Oleg Kosheliev oleg.koshel...@ti.com
---
 drivers/power/twl6030.c |   56 ++-
 include/twl6030.h   |   20 +
 2 files changed, 70 insertions(+), 6 deletions(-)

diff --git a/drivers/power/twl6030.c b/drivers/power/twl6030.c
index badcd4a..8d8f1b5 100644
--- a/drivers/power/twl6030.c
+++ b/drivers/power/twl6030.c
@@ -36,6 +36,15 @@ static struct twl6030_data twl6030_info = {
.vbat_shift = TWL6030_VBAT_SHIFT,
 };
 
+static struct twl6030_data twl6032_info = {
+   .chip_type  = chip_TWL6032,
+   .adc_rbase  = TWL6032_GPCH0_LSB,
+   .adc_ctrl   = TWL6032_CTRL_P1,
+   .adc_enable = CTRL_P1_SP1,
+   .vbat_mult  = TWL6032_VBAT_MULT,
+   .vbat_shift = TWL6032_VBAT_SHIFT,
+};
+
 static int twl6030_gpadc_read_channel(u8 channel_no)
 {
u8 lsb = 0;
@@ -131,6 +140,18 @@ int twl6030_get_battery_voltage(void)
 {
int battery_volt = 0;
int ret = 0;
+   u8 vbatch;
+
+   if (twl-chip_type == chip_TWL6030) {
+   vbatch = TWL6030_GPADC_VBAT_CHNL;
+   } else {
+   ret = twl6030_i2c_write_u8(TWL6030_CHIP_ADC,
+  TWL6032_GPSELECT_ISB,
+  TWL6032_GPADC_VBAT_CHNL);
+   if (ret)
+   return ret;
+   vbatch = 0;
+   }
 
/* Start GPADC SW conversion */
ret = twl6030_gpadc_sw2_trigger();
@@ -140,7 +161,7 @@ int twl6030_get_battery_voltage(void)
}
 
/* measure Vbat voltage */
-   battery_volt = twl6030_gpadc_read_channel(7);
+   battery_volt = twl6030_gpadc_read_channel(vbatch);
if (battery_volt  0) {
printf(Failed to read battery voltage\n);
return ret;
@@ -153,14 +174,37 @@ int twl6030_get_battery_voltage(void)
 
 void twl6030_init_battery_charging(void)
 {
-   u8 stat1 = 0;
+   u8 val = 0;
int battery_volt = 0;
int ret = 0;
 
-   twl = twl6030_info;
+   ret = twl6030_i2c_read_u8(TWL6030_CHIP_USB, USB_PRODUCT_ID_LSB, val);
+   if (ret) {
+   printf(twl6030_init_battery_charging():  \
+  could not determine chip!\n);
+   return;
+   }
+   if (val == 0x30) {
+   twl = twl6030_info;
+   } else if (val == 0x32) {
+   twl = twl6032_info;
+   } else {
+   printf(twl6030_init_battery_charging():  \
+  unsupported chip type\n);
+   return;
+   }
 
/* Enable VBAT measurement */
-   twl6030_i2c_write_u8(TWL6030_CHIP_PM, MISC1, VBAT_MEAS);
+   if (twl-chip_type == chip_TWL6030) {
+   twl6030_i2c_write_u8(TWL6030_CHIP_PM, MISC1, VBAT_MEAS);
+   twl6030_i2c_write_u8(TWL6030_CHIP_ADC,
+TWL6030_GPADC_CTRL,
+GPADC_CTRL_SCALER_DIV4);
+   } else {
+   twl6030_i2c_write_u8(TWL6030_CHIP_ADC,
+TWL6032_GPADC_CTRL2,
+GPADC_CTRL2_CH18_SCALER_EN);
+   }
 
/* Enable GPADC module */
ret = twl6030_i2c_write_u8(TWL6030_CHIP_CHARGER, TOGGLE1, FGS | GPADCS);
@@ -177,10 +221,10 @@ void twl6030_init_battery_charging(void)
printf(Main battery voltage too low!\n);
 
/* Check for the presence of USB charger */
-   twl6030_i2c_read_u8(TWL6030_CHIP_CHARGER, CONTROLLER_STAT1, stat1);
+   twl6030_i2c_read_u8(TWL6030_CHIP_CHARGER, CONTROLLER_STAT1, val);
 
/* check for battery presence indirectly via Fuel gauge */
-   if ((stat1  VBUS_DET)  (battery_volt  3300))
+   if ((val  VBUS_DET)  (battery_volt  3300))
twl6030_start_usb_charging();
 
return;
diff --git a/include/twl6030.h b/include/twl6030.h
index c0db668..9fd2c8b 100644
--- a/include/twl6030.h
+++ b/include/twl6030.h
@@ -126,15 +126,35 @@
 #define CTRL_P2_EOCP2  (1  1)
 #define CTRL_P2_BUSY   (1  0)
 
+#define TWL6032_CTRL_P10x36
+#define CTRL_P1_SP1(1  3)
+
 #define GPCH0_LSB  0x57
 #define GPCH0_MSB  0x58
 
+#define TWL6032_GPCH0_LSB  0x3b
+
+#define TWL6032_GPSELECT_ISB   0x35
+
+#define USB_PRODUCT_ID_LSB 0x02
+
+#define TWL6030_GPADC_VBAT_CHNL0x07
+#define TWL6032_GPADC_VBAT_CHNL0x12
+
+#define TWL6030_GPADC_CTRL 0x2e
+#define TWL6032_GPADC_CTRL20x2f
+#define GPADC_CTRL2_CH18_SCALER_EN (1  2)
+#define GPADC_CTRL_SCALER_DIV4 (1  3)
+
 #define TWL6030_VBAT_MULT  40 * 1000
+#define TWL6032_VBAT_MULT  25 * 1000
 
 #define TWL6030_VBAT_SHIFT (10 + 3)
+#define TWL6032_VBAT_SHIFT (12 + 2)
 
 typedef

[U-Boot] [RFC PATCH 1/2] ARMV7: OMAP4: Add struct for twl603x data

2013-07-24 Thread Oleg Kosheliev
From: Oleg Kosheliev oleg.koshel...@ti.com

The data struct is used to support different
PMIC chip types. It contains the chip type and
the data (e.g. registers addresses, adc multiplier)
which is different for twl6030 and twl6032.
Replaced some hardcoded values with the
structure vars.

Based on Balaji T K balaj...@ti.com patches for TI u-boot.

Signed-off-by: Oleg Kosheliev oleg.koshel...@ti.com
---
 drivers/power/twl6030.c |   25 -
 include/twl6030.h   |   18 ++
 2 files changed, 38 insertions(+), 5 deletions(-)

diff --git a/drivers/power/twl6030.c b/drivers/power/twl6030.c
index d421e60..badcd4a 100644
--- a/drivers/power/twl6030.c
+++ b/drivers/power/twl6030.c
@@ -25,6 +25,17 @@
 
 #include twl6030.h
 
+static struct twl6030_data *twl;
+
+static struct twl6030_data twl6030_info = {
+   .chip_type  = chip_TWL6030,
+   .adc_rbase  = GPCH0_LSB,
+   .adc_ctrl   = CTRL_P2,
+   .adc_enable = CTRL_P2_SP2,
+   .vbat_mult  = TWL6030_VBAT_MULT,
+   .vbat_shift = TWL6030_VBAT_SHIFT,
+};
+
 static int twl6030_gpadc_read_channel(u8 channel_no)
 {
u8 lsb = 0;
@@ -32,12 +43,12 @@ static int twl6030_gpadc_read_channel(u8 channel_no)
int ret = 0;
 
ret = twl6030_i2c_read_u8(TWL6030_CHIP_ADC,
- GPCH0_LSB + channel_no * 2, lsb);
+ twl-adc_rbase + channel_no * 2, lsb);
if (ret)
return ret;
 
ret = twl6030_i2c_read_u8(TWL6030_CHIP_ADC,
- GPCH0_MSB + channel_no * 2, msb);
+ twl-adc_rbase + 1 + channel_no * 2, msb);
if (ret)
return ret;
 
@@ -49,7 +60,8 @@ static int twl6030_gpadc_sw2_trigger(void)
u8 val;
int ret = 0;
 
-   ret = twl6030_i2c_write_u8(TWL6030_CHIP_ADC, CTRL_P2, CTRL_P2_SP2);
+   ret = twl6030_i2c_write_u8(TWL6030_CHIP_ADC,
+  twl-adc_ctrl, twl-adc_enable);
if (ret)
return ret;
 
@@ -57,7 +69,8 @@ static int twl6030_gpadc_sw2_trigger(void)
val =  CTRL_P2_BUSY;
 
while (!((val  CTRL_P2_EOCP2)  (!(val  CTRL_P2_BUSY {
-   ret = twl6030_i2c_read_u8(TWL6030_CHIP_ADC, CTRL_P2, val);
+   ret = twl6030_i2c_read_u8(TWL6030_CHIP_ADC,
+ twl-adc_ctrl, val);
if (ret)
return ret;
udelay(1000);
@@ -132,7 +145,7 @@ int twl6030_get_battery_voltage(void)
printf(Failed to read battery voltage\n);
return ret;
}
-   battery_volt = (battery_volt * 25 * 1000)  (10 + 2);
+   battery_volt = (battery_volt * twl-vbat_mult)  twl-vbat_shift;
printf(Battery Voltage: %d mV\n, battery_volt);
 
return battery_volt;
@@ -144,6 +157,8 @@ void twl6030_init_battery_charging(void)
int battery_volt = 0;
int ret = 0;
 
+   twl = twl6030_info;
+
/* Enable VBAT measurement */
twl6030_i2c_write_u8(TWL6030_CHIP_PM, MISC1, VBAT_MEAS);
 
diff --git a/include/twl6030.h b/include/twl6030.h
index 029b21f..c0db668 100644
--- a/include/twl6030.h
+++ b/include/twl6030.h
@@ -129,6 +129,24 @@
 #define GPCH0_LSB  0x57
 #define GPCH0_MSB  0x58
 
+#define TWL6030_VBAT_MULT  40 * 1000
+
+#define TWL6030_VBAT_SHIFT (10 + 3)
+
+typedef enum {
+   chip_TWL6030,
+   chip_TWL603X_cnt
+}t_TWL603X_chip_type;
+
+struct twl6030_data{
+   t_TWL603X_chip_type chip_type;
+   u8 adc_rbase;
+   u8 adc_ctrl;
+   u8 adc_enable;
+   int vbat_mult;
+   int vbat_shift;
+};
+
 /* Functions to read and write from TWL6030 */
 static inline int twl6030_i2c_write_u8(u8 chip_no, u8 reg, u8 val)
 {
-- 
1.7.9.5

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [RFC PATCH] armv7:omap4-common: Correct check of the SPL image size

2013-07-24 Thread Oleg Kosheliev
From: Oleg_Kosheliev oleg.koshel...@ti.com

The u-boot-spl image must be stored in SRAM at
addresses from 0x4030 till 0x4030bfff.
Higher than that area is located the ROM code stack.
Thus we should check that the highest address
of the SPL image is not in the stack area or higher.
In this patch CONFIG_SPL_MAX_SIZE is corrected based
on the max allowed for SPL image address.

Signed-off-by: Oleg Kosheliev oleg.koshel...@ti.com
---
 include/configs/omap4_common.h |9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/include/configs/omap4_common.h b/include/configs/omap4_common.h
index 2fa4382..aeeef6c 100644
--- a/include/configs/omap4_common.h
+++ b/include/configs/omap4_common.h
@@ -266,7 +266,14 @@
 #define CONFIG_SPL
 #define CONFIG_SPL_FRAMEWORK
 #define CONFIG_SPL_TEXT_BASE   0x40304350
-#define CONFIG_SPL_MAX_SIZE(38 * 1024)
+/*
+ * The allowed space in SRAM for SPL is from 0x4030 till 0x4030bfff.
+ * The space above 0x4030c000 is used by ROM code stack
+ * and this area must not be rewritten by the SPL
+ */
+#define CONFIG_SPL_MAX_ADDR0x4030bfff
+#define CONFIG_SPL_MAX_SIZE(CONFIG_SPL_MAX_ADDR - \
+CONFIG_SPL_TEXT_BASE)
 #define CONFIG_SPL_STACK   CONFIG_SYS_INIT_SP_ADDR
 #define CONFIG_SPL_DISPLAY_PRINT
 
-- 
1.7.9.5

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [RFC PATCH 0/2] ARMV7: OMAP4: Add support for twl6032

2013-07-24 Thread Oleg Kosheliev
From: Oleg Kosheliev oleg.koshel...@ti.com

TWL6032 is a companion Power Management IC (PMIC) of OMAP4470.
This chip is similar to TWL6030 but has slight difference
in some registers e.g. for GPADC.
In u-boot only TWL6030 is supported now, thus there is no ability to 
boot OMAP4470 with TWL6032 because u-boot hangs when attempts to get
the battery voltage from GPADC using false ctrl register address.
These patches add the detection of the TWL chip type and support
for TWL6032 chip in the battery charger driver.

Oleg Kosheliev (2):
  ARMV7: OMAP4: Add struct for twl603x data
  ARMV7: OMAP4: Add twl6032 support

 drivers/power/twl6030.c |   79 +--
 include/twl6030.h   |   38 +++
 2 files changed, 107 insertions(+), 10 deletions(-)

-- 
1.7.9.5

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot