summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorFrank Li <Frank.Li@freescale.com>2010-04-13 14:11:52 +0800
committerAlejandro Gonzalez <alex.gonzalez@digi.com>2010-05-25 11:20:24 +0200
commit81d98ca18cbc3d66200b5d28859b28869df7ad7e (patch)
tree0664d3819937d5e7919c55daad984775bd890294 /arch
parent1959540617e21d8e16db725d2fd0042eced9393e (diff)
ENGR00122477-2 iMX23 Enable persistent bit support
enable persistent bit support Signed-off-by: Frank Li <Frank.Li@freescale.com> Signed-off-by: Alejandro Gonzalez <alex.gonzalez@digi.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-mx23/device.c115
-rw-r--r--arch/arm/plat-mxs/device.c19
-rw-r--r--arch/arm/plat-mxs/include/mach/device.h12
3 files changed, 140 insertions, 6 deletions
diff --git a/arch/arm/mach-mx23/device.c b/arch/arm/mach-mx23/device.c
index 33c4d7d5c845..38ad3f77181f 100644
--- a/arch/arm/mach-mx23/device.c
+++ b/arch/arm/mach-mx23/device.c
@@ -705,12 +705,13 @@ 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);
- }
+ if (pdev == NULL || IS_ERR(pdev))
+ return;
+ 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)
@@ -733,6 +734,107 @@ static inline mx23_init_spdif(void)
}
#endif
+#if defined(CONFIG_MXS_PERSISTENT)
+static const struct mxs_persistent_bit_config
+mx23_persistent_bit_config[] = {
+ { .reg = 0, .start = 0, .width = 1,
+ .name = "CLOCKSOURCE" },
+ { .reg = 0, .start = 1, .width = 1,
+ .name = "ALARM_WAKE_EN" },
+ { .reg = 0, .start = 2, .width = 1,
+ .name = "ALARM_EN" },
+ { .reg = 0, .start = 3, .width = 1,
+ .name = "CLK_SECS" },
+ { .reg = 0, .start = 4, .width = 1,
+ .name = "XTAL24MHZ_PWRUP" },
+ { .reg = 0, .start = 5, .width = 1,
+ .name = "XTAL32MHZ_PWRUP" },
+ { .reg = 0, .start = 6, .width = 1,
+ .name = "XTAL32_FREQ" },
+ { .reg = 0, .start = 7, .width = 1,
+ .name = "ALARM_WAKE" },
+ { .reg = 0, .start = 8, .width = 5,
+ .name = "MSEC_RES" },
+ { .reg = 0, .start = 13, .width = 1,
+ .name = "DISABLE_XTALOK" },
+ { .reg = 0, .start = 14, .width = 2,
+ .name = "LOWERBIAS" },
+ { .reg = 0, .start = 16, .width = 1,
+ .name = "DISABLE_PSWITCH" },
+ { .reg = 0, .start = 17, .width = 1,
+ .name = "AUTO_RESTART" },
+ { .reg = 0, .start = 18, .width = 14,
+ .name = "SPARE_ANALOG" },
+
+ { .reg = 1, .start = 0, .width = 1,
+ .name = "FORCE_RECOVERY" },
+ { .reg = 1, .start = 1, .width = 1,
+ .name = "NAND_SECONDARY_BOOT" },
+ { .reg = 1, .start = 2, .width = 1,
+ .name = "NAND_SDK_BLOCK_REWRITE" },
+ { .reg = 1, .start = 3, .width = 1,
+ .name = "SD_SPEED_ENABLE" },
+ { .reg = 1, .start = 4, .width = 1,
+ .name = "SD_INIT_SEQ_1_DISABLE" },
+ { .reg = 1, .start = 5, .width = 1,
+ .name = "SD_CMD0_DISABLE" },
+ { .reg = 1, .start = 6, .width = 1,
+ .name = "SD_INIT_SEQ_2_ENABLE" },
+ { .reg = 1, .start = 7, .width = 1,
+ .name = "OTG_ATL_ROLE_BIT" },
+ { .reg = 1, .start = 8, .width = 1,
+ .name = "OTG_HNP_BIT" },
+ { .reg = 1, .start = 9, .width = 1,
+ .name = "USB_LOW_POWER_MODE" },
+ { .reg = 1, .start = 10, .width = 1,
+ .name = "SKIP_CHECKDISK" },
+ { .reg = 1, .start = 11, .width = 1,
+ .name = "USB_BOOT_PLAYER_MODE" },
+ { .reg = 1, .start = 12, .width = 1,
+ .name = "ENUMERATE_500MA_TWICE" },
+ { .reg = 1, .start = 13, .width = 19,
+ .name = "SPARE_GENERAL" },
+
+ { .reg = 2, .start = 0, .width = 32,
+ .name = "SPARE_2" },
+ { .reg = 3, .start = 0, .width = 32,
+ .name = "SPARE_3" },
+ { .reg = 4, .start = 0, .width = 32,
+ .name = "SPARE_4" },
+ { .reg = 5, .start = 0, .width = 32,
+ .name = "SPARE_5" },
+};
+
+static struct mxs_platform_persistent_data mx23_persistent_data = {
+ .bit_config_tab = mx23_persistent_bit_config,
+ .bit_config_cnt = ARRAY_SIZE(mx23_persistent_bit_config),
+};
+
+static struct resource mx23_persistent_res[] = {
+ {
+ .flags = IORESOURCE_MEM,
+ .start = RTC_PHYS_ADDR,
+ .end = RTC_PHYS_ADDR + 0x2000 - 1,
+ },
+};
+
+static void mx23_init_persistent(void)
+{
+ struct platform_device *pdev;
+ pdev = mxs_get_device("mxs-persistent", 0);
+ if (pdev == NULL || IS_ERR(pdev))
+ return;
+ pdev->dev.platform_data = &mx23_persistent_data;
+ pdev->resource = mx23_persistent_res,
+ pdev->num_resources = ARRAY_SIZE(mx23_persistent_res),
+ mxs_add_device(pdev, 3);
+}
+#else
+static void mx23_init_persistent()
+{
+}
+#endif
+
int __init mx23_device_init(void)
{
mx23_init_dma();
@@ -751,6 +853,7 @@ int __init mx23_device_init(void)
mx23_init_lcdif();
mx23_init_pxp();
mx23_init_battery();
+ mx23_init_persistent();
return 0;
}
diff --git a/arch/arm/plat-mxs/device.c b/arch/arm/plat-mxs/device.c
index 684ffd8e2afa..00180846885b 100644
--- a/arch/arm/plat-mxs/device.c
+++ b/arch/arm/plat-mxs/device.c
@@ -441,6 +441,16 @@ static struct platform_device busfreq_device = {
},
};
+#ifdef CONFIG_MXS_PERSISTENT
+static struct platform_device mxs_persistent = {
+ .name = "mxs-persistent",
+ .id = 0,
+ .dev = {
+ .release = mxs_nop_release,
+ },
+};
+#endif
+
static inline void mxs_init_busfreq(void)
{
(void)platform_device_register(&busfreq_device);
@@ -505,6 +515,15 @@ static struct mxs_dev_lookup dev_lookup[] = {
.pdev = &mxs_rtc,
},
#endif
+
+#if defined(CONFIG_MXS_PERSISTENT)
+ {
+ .name = "mxs-persistent",
+ .size = 1,
+ .pdev = &mxs_persistent,
+ },
+#endif
+
#if defined(CONFIG_FB_MXS) || defined(CONFIG_FB_MXS_MODULE)
{
.name = "mxs-fb",
diff --git a/arch/arm/plat-mxs/include/mach/device.h b/arch/arm/plat-mxs/include/mach/device.h
index 3f9280ffd7f6..7a99647ed0ff 100644
--- a/arch/arm/plat-mxs/include/mach/device.h
+++ b/arch/arm/plat-mxs/include/mach/device.h
@@ -220,6 +220,18 @@ struct gpmi_platform_data {
};
+struct mxs_persistent_bit_config {
+ int reg;
+ int start;
+ int width;
+ const char *name;
+};
+
+struct mxs_platform_persistent_data {
+ const struct mxs_persistent_bit_config *bit_config_tab;
+ int bit_config_cnt;
+};
+
extern void mxs_timer_init(struct mxs_sys_timer *timer);
extern void mxs_nomatch_timer_init(struct mxs_sys_timer *timer);