summaryrefslogtreecommitdiff
path: root/arch/arm/mach-mx28
diff options
context:
space:
mode:
authorZhou Jingyu <b02241@freescale.com>2010-02-24 16:35:17 +0800
committerAlejandro Gonzalez <alex.gonzalez@digi.com>2010-05-25 11:17:17 +0200
commita5d45ab631b4bbe4fb4ae402d12ae1b7e0e7e9b1 (patch)
tree0a2cc682133efcfa44e2dc1bbe5bd9b7573388ab /arch/arm/mach-mx28
parenta71d6807af088647720baeff6cf4a75fdc49b9a5 (diff)
ENGR00117740-2 mxs battery driver, porting
mxs battery driver, porting Signed-off-by: Zhou Jingyu <Jingyu.Zhou@freescale.com> Signed-off-by: Alejandro Gonzalez <alex.gonzalez@digi.com>
Diffstat (limited to 'arch/arm/mach-mx28')
-rw-r--r--arch/arm/mach-mx28/device.c84
-rw-r--r--arch/arm/mach-mx28/include/mach/mx28.h5
2 files changed, 88 insertions, 1 deletions
diff --git a/arch/arm/mach-mx28/device.c b/arch/arm/mach-mx28/device.c
index b3343eb7ac47..39012dc06222 100644
--- a/arch/arm/mach-mx28/device.c
+++ b/arch/arm/mach-mx28/device.c
@@ -38,6 +38,7 @@
#include <mach/dma.h>
#include <mach/lradc.h>
#include <mach/lcdif.h>
+#include <mach/ddi_bc.h>
#include "device.h"
#include "mx28_pins.h"
@@ -884,6 +885,87 @@ static inline void mx28_init_flexcan(void)
{
}
#endif
+#if defined(CONFIG_BATTERY_MXS)
+/* battery info data */
+static ddi_bc_Cfg_t battery_data = {
+ .u32StateMachinePeriod = 100, /* ms */
+ .u16CurrentRampSlope = 75, /* mA/s */
+ .u16ConditioningThresholdVoltage = 2900, /* mV */
+ .u16ConditioningMaxVoltage = 3000, /* mV */
+ .u16ConditioningCurrent = 60, /* mA */
+ .u32ConditioningTimeout = 4*60*60*1000, /* ms (4 hours) */
+ .u16ChargingVoltage = 4200, /* mV */
+ /* FIXME: the current comparator could have h/w bugs in current
+ * detection through POWER_STS.CHRGSTS bit */
+ .u16ChargingCurrent = 600, /* mA 600 */
+ .u16ChargingThresholdCurrent = 60, /* mA 60 */
+ .u32ChargingTimeout = 4*60*60*1000,/* ms (4 hours) */
+ .u32TopOffPeriod = 30*60*1000, /* ms (30 minutes) */
+ .monitorDieTemp = 1, /* Monitor the die */
+ .u8DieTempHigh = 75, /* deg centigrade */
+ .u8DieTempLow = 65, /* deg centigrade */
+ .u16DieTempSafeCurrent = 0, /* mA */
+ .monitorBatteryTemp = 0, /* Monitor the battery*/
+ .u8BatteryTempChannel = 1, /* LRADC 1 */
+ .u16BatteryTempHigh = 642, /* Unknown units */
+ .u16BatteryTempLow = 497, /* Unknown units */
+ .u16BatteryTempSafeCurrent = 0, /* mA */
+};
+
+static struct resource battery_resource[] = {
+ {/* 0 */
+ .flags = IORESOURCE_IRQ,
+ .start = IRQ_VDD5V,
+ .end = IRQ_VDD5V,
+ },
+ {/* 1 */
+ .flags = IORESOURCE_IRQ,
+ .start = IRQ_DCDC4P2_BRNOUT,
+ .end = IRQ_DCDC4P2_BRNOUT,
+ },
+ {/* 2 */
+ .flags = IORESOURCE_IRQ,
+ .start = IRQ_BATT_BRNOUT,
+ .end = IRQ_BATT_BRNOUT,
+ },
+ {/* 3 */
+ .flags = IORESOURCE_IRQ,
+ .start = IRQ_VDDD_BRNOUT,
+ .end = IRQ_VDDD_BRNOUT,
+ },
+ {/* 4 */
+ .flags = IORESOURCE_IRQ,
+ .start = IRQ_VDDA_BRNOUT,
+ .end = IRQ_VDDA_BRNOUT,
+ },
+ {/* 5 */
+ .flags = IORESOURCE_IRQ,
+ .start = IRQ_VDDIO_BRNOUT,
+ .end = IRQ_VDDIO_BRNOUT,
+ },
+ {/* 6 */
+ .flags = IORESOURCE_IRQ,
+ .start = IRQ_VDD5V_DROOP,
+ .end = IRQ_VDD5V_DROOP,
+ },
+};
+
+static void mx28_init_battery(void)
+{
+ struct platform_device *pdev;
+ pdev = mxs_get_device("mxs-battery", 0);
+ if (pdev) {
+ pdev->resource = battery_resource,
+ pdev->num_resources = ARRAY_SIZE(battery_resource),
+ pdev->dev.platform_data = &battery_data;
+ mxs_add_device(pdev, 3);
+ }
+}
+#else
+static void mx28_init_battery(void)
+{
+}
+#endif
#if defined(CONFIG_CRYPTO_DEV_DCP)
@@ -939,6 +1021,8 @@ int __init mx28_device_init(void)
mx28_init_lcdif();
mx28_init_pxp();
mx28_init_dcp();
+ mx28_init_battery();
+
return 0;
}
diff --git a/arch/arm/mach-mx28/include/mach/mx28.h b/arch/arm/mach-mx28/include/mach/mx28.h
index 1680f06a7f16..465336b4b44b 100644
--- a/arch/arm/mach-mx28/include/mach/mx28.h
+++ b/arch/arm/mach-mx28/include/mach/mx28.h
@@ -80,7 +80,7 @@
/* IRQ Definitions */
#define IRQ_BATT_BRNOUT 0
-#define IRQ_VDD_BRNOUT 1
+#define IRQ_VDDD_BRNOUT 1
#define IRQ_VDDIO_BRNOUT 2
#define IRQ_VDDA_BRNOUT 3
#define IRQ_VDD5V_DROOP 4
@@ -210,6 +210,9 @@
#define ARCH_NR_IRQS 128
+/* On i.MX28, all interrupt sources can be configured as FIQ */
+#define FIQ_START IRQ_BATT_BRNOUT
+
#define MX28_SOC_IO_ADDRESS(x) \
((x) - MX28_SOC_IO_PHYS_BASE + MX28_SOC_IO_VIRT_BASE)