summaryrefslogtreecommitdiff
path: root/arch/arm/mach-mx23
diff options
context:
space:
mode:
authorZhou Jingyu <b02241@freescale.com>2010-03-11 10:08:32 +0800
committerFrank Li <Frank.Li@freescale.com>2010-03-16 12:37:52 +0800
commitb35a3a001fad7d967fae6ad7ebc9cc7405baa4b4 (patch)
treea892adb05e3059ca69ecf41cf34b63e5c0028054 /arch/arm/mach-mx23
parent0efd56e02ed8d1c3cbc8de291c5452a54cb0866d (diff)
ENGR00121496: mx23 battery driver restructure
mx23 battery driver restructure Signed-off-by: Zhou Jingyu <Jingyu.Zhou@freescale.com>
Diffstat (limited to 'arch/arm/mach-mx23')
-rw-r--r--arch/arm/mach-mx23/device.c87
-rw-r--r--arch/arm/mach-mx23/include/mach/irqs.h6
2 files changed, 93 insertions, 0 deletions
diff --git a/arch/arm/mach-mx23/device.c b/arch/arm/mach-mx23/device.c
index 31f514b5266a..fc2ddc1a01ef 100644
--- a/arch/arm/mach-mx23/device.c
+++ b/arch/arm/mach-mx23/device.c
@@ -36,8 +36,10 @@
#include <mach/regs-lradc.h>
#include <mach/device.h>
#include <mach/dma.h>
+#include <mach/irqs.h>
#include <mach/lradc.h>
#include <mach/lcdif.h>
+#include <mach/ddi_bc.h>
#include "device.h"
#include "mx23_pins.h"
@@ -602,6 +604,89 @@ static void mx23_init_mmc(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_BO,
+ .end = IRQ_DCDC4P2_BO,
+ },
+ {/* 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_VDD18_BRNOUT,
+ .end = IRQ_VDD18_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 mx23_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 mx23_init_battery(void)
+{
+}
+#endif
+
+
int __init mx23_device_init(void)
{
mx23_init_dma();
@@ -617,6 +702,8 @@ int __init mx23_device_init(void)
mx23_init_mmc();
mx23_init_lcdif();
mx23_init_pxp();
+ mx23_init_battery();
+
return 0;
}
diff --git a/arch/arm/mach-mx23/include/mach/irqs.h b/arch/arm/mach-mx23/include/mach/irqs.h
index dc4e578b0e34..5d5211b6e889 100644
--- a/arch/arm/mach-mx23/include/mach/irqs.h
+++ b/arch/arm/mach-mx23/include/mach/irqs.h
@@ -94,3 +94,9 @@
/* Hard disk IRQ is a GPMI attention IRQ */
#define IRQ_HARDDISK IRQ_GPMI_ATTENTION
+
+#ifndef __ASSEMBLY__
+void mxs_set_irq_fiq(unsigned int irq, unsigned int type);
+void mxs_enable_fiq_functionality(int enable);
+#endif
+