[Armadeus-commitlog] SF.net SVN: armadeus:[1071] trunk/buildroot/target/device/armadeus
Brought to you by:
sszy
|
From: <ar...@us...> - 2009-02-18 14:22:05
|
Revision: 1071
http://armadeus.svn.sourceforge.net/armadeus/?rev=1071&view=rev
Author: artemys
Date: 2009-02-18 14:22:01 +0000 (Wed, 18 Feb 2009)
Log Message:
-----------
[LINUX] Add power management infrastructure for APF27
Modified Paths:
--------------
trunk/buildroot/target/device/armadeus/apf27/apf27-linux-2.6.27.13.config
trunk/buildroot/target/device/armadeus/linux/kernel-patches/2.6.27.13/090-armadeus-alsa-create_imx-alsa_h.patch
trunk/buildroot/target/device/armadeus/linux/kernel-patches/2.6.27.13/281-apf27-armadeus-add_apf27.c.patch
trunk/buildroot/target/device/armadeus/linux/kernel-patches/2.6.27.13/302-apf27-armadeus-add_imx-alsa_h_to_plat-mxc_include_mach.patch
Added Paths:
-----------
trunk/buildroot/target/device/armadeus/linux/kernel-patches/2.6.27.13/310-apf27-armadeus-nfc-makes_it_compile_with_CONFIG_PM.patch
trunk/buildroot/target/device/armadeus/linux/kernel-patches/2.6.27.13/311-apf27-armadeus-mx27-add_pm_infra.patch
Modified: trunk/buildroot/target/device/armadeus/apf27/apf27-linux-2.6.27.13.config
===================================================================
--- trunk/buildroot/target/device/armadeus/apf27/apf27-linux-2.6.27.13.config 2009-02-18 09:28:39 UTC (rev 1070)
+++ trunk/buildroot/target/device/armadeus/apf27/apf27-linux-2.6.27.13.config 2009-02-18 14:22:01 UTC (rev 1071)
@@ -1,7 +1,7 @@
#
# Automatically generated make config: don't edit
-# Linux kernel version: 2.6.27.2
-# Fri Jan 16 16:33:51 2009
+# Linux kernel version: 2.6.27.13
+# Wed Feb 18 14:46:03 2009
#
CONFIG_ARM=y
CONFIG_SYS_SUPPORTS_APM_EMULATION=y
@@ -292,7 +292,15 @@
#
# Power management options
#
-# CONFIG_PM is not set
+CONFIG_PM=y
+CONFIG_PM_DEBUG=y
+CONFIG_PM_VERBOSE=y
+CONFIG_CAN_PM_TRACE=y
+CONFIG_PM_SLEEP=y
+CONFIG_SUSPEND=y
+# CONFIG_PM_TEST_SUSPEND is not set
+CONFIG_SUSPEND_FREEZER=y
+# CONFIG_APM_EMULATION is not set
CONFIG_ARCH_SUSPEND_POSSIBLE=y
CONFIG_NET=y
@@ -467,7 +475,6 @@
CONFIG_MTD_PHYSMAP_LEN=0x0
CONFIG_MTD_PHYSMAP_BANKWIDTH=2
# CONFIG_MTD_ARM_INTEGRATOR is not set
-# CONFIG_MTD_APF9328 is not set
# CONFIG_MTD_PLATRAM is not set
#
@@ -990,6 +997,7 @@
CONFIG_USB_DEVICEFS=y
# CONFIG_USB_DEVICE_CLASS is not set
# CONFIG_USB_DYNAMIC_MINORS is not set
+CONFIG_USB_SUSPEND=y
# CONFIG_USB_OTG is not set
# CONFIG_USB_OTG_WHITELIST is not set
# CONFIG_USB_OTG_BLACKLIST_HUB is not set
@@ -1004,7 +1012,6 @@
# CONFIG_USB_EHCI_TT_NEWSCHED is not set
CONFIG_USB_EHCI_MXC=y
# CONFIG_USB_ISP116X_HCD is not set
-# CONFIG_USB_ISP1760_HCD is not set
# CONFIG_USB_SL811_HCD is not set
# CONFIG_USB_R8A66597_HCD is not set
Modified: trunk/buildroot/target/device/armadeus/linux/kernel-patches/2.6.27.13/090-armadeus-alsa-create_imx-alsa_h.patch
===================================================================
--- trunk/buildroot/target/device/armadeus/linux/kernel-patches/2.6.27.13/090-armadeus-alsa-create_imx-alsa_h.patch 2009-02-18 09:28:39 UTC (rev 1070)
+++ trunk/buildroot/target/device/armadeus/linux/kernel-patches/2.6.27.13/090-armadeus-alsa-create_imx-alsa_h.patch 2009-02-18 14:22:01 UTC (rev 1071)
@@ -3,7 +3,7 @@
(Take a look at armadeus/target/linux/ directory to know how to generate it)
--- linux-2.6.27.13.original/arch/arm/mach-imx/include/mach/imx-alsa.h
+++ linux-2.6.27.13.mod/arch/arm/mach-imx/include/mach/imx-alsa.h
-@@ -0,0 +1,151 @@
+@@ -0,0 +1,152 @@
+/*
+ * linux/include/asm-arm/arch-imx/imx-alsa.h
+ *
@@ -139,8 +139,8 @@
+void snd_imx_init_mixer(void);
+
+#ifdef CONFIG_PM
-+void snd_imx_suspend_mixer(void);
-+void snd_imx_resume_mixer(void);
++void snd_tsc210x_suspend_mixer(void);
++void snd_tsc210x_resume_mixer(void);
+#endif
+
+int snd_imx_alsa_post_probe(struct platform_device *pdev, struct imx_alsa_codec_config *config);
@@ -155,3 +155,4 @@
+void snd_imx_alsa_dma_interrupt(int, void *);
+
+#endif
++
Modified: trunk/buildroot/target/device/armadeus/linux/kernel-patches/2.6.27.13/281-apf27-armadeus-add_apf27.c.patch
===================================================================
--- trunk/buildroot/target/device/armadeus/linux/kernel-patches/2.6.27.13/281-apf27-armadeus-add_apf27.c.patch 2009-02-18 09:28:39 UTC (rev 1070)
+++ trunk/buildroot/target/device/armadeus/linux/kernel-patches/2.6.27.13/281-apf27-armadeus-add_apf27.c.patch 2009-02-18 14:22:01 UTC (rev 1071)
@@ -3,7 +3,7 @@
(Take a look at armadeus/target/linux/ directory to know how to generate it)
--- linux-2.6.27.13.original/arch/arm/mach-mx2/apf27.c
+++ linux-2.6.27.13.mod/arch/arm/mach-mx2/apf27.c
-@@ -0,0 +1,983 @@
+@@ -0,0 +1,1109 @@
+ /*
+ * apf27.c
+ *
@@ -157,10 +157,9 @@
+ .irq = 0
+ },
+};
++#endif /* CONFIG_I2C */
+
+
-+#endif
-+
+#ifdef CONFIG_SPI
+#define MAX1027_CS (GPIO_PORTD | 28)
+static int mxc_cspi0_pins[] = {
@@ -222,7 +221,7 @@
+ .init = gpio_spi1_active,
+ .exit = gpio_spi1_inactive,
+};
-+#endif // CONFIG_SPI
++#endif /* CONFIG_SPI */
+
+
+static int mxc_uart0_pins[] = {
@@ -386,7 +385,7 @@
+ },
+ .id = 0,
+};
-+#endif // CONFIG_IMX_BACKLIGHT
++#endif /* CONFIG_IMX_BACKLIGHT */
+
+#endif /* CONFIG_FB_MXC */
+
@@ -528,6 +527,7 @@
+{
+ /* configure int pin as GPIO */
+ mxc_gpio_mode( GPIO_PORTF | TSC2101_INT | GPIO_IN | GPIO_GPIO );
++
+ return 0;
+}
+
@@ -890,11 +890,39 @@
+ ALSA_SOUND,
+};
+
++
++/* APF27 power management stuff */
++#define CONFIG_USE_LED_FOR_PM
++#define CONFIG_USE_SWITCH_FOR_PM
++
++
++#define APF27DEV_USER_SWITCH (GPIO_PORTF | 13)
++#define APF27DEV_USER_SWITCH_IRQ (IRQ_GPIOF(13))
++#define APF27DEV_USER_LED (GPIO_PORTF | 14)
+#define APF27DEV_POWER_DOWN_NOT (GPIO_PORTF | 16)
++
+static int apf27dev_pwr_ctl_pins[] = {
+ (APF27DEV_POWER_DOWN_NOT | GPIO_OUT | GPIO_GPIO),
++#ifdef CONFIG_USE_SWITCH_FOR_PM
++ (APF27DEV_USER_SWITCH | GPIO_IN | GPIO_GPIO),
++#endif
++#ifdef CONFIG_USE_LED_FOR_PM
++ (APF27DEV_USER_LED | GPIO_OUT | GPIO_GPIO),
++#endif
+};
+
++static void apf27dev_power_up(void)
++{
++ gpio_set_value(APF27DEV_POWER_DOWN_NOT, 1);
++}
++
++#ifdef CONFIG_USE_SWITCH_FOR_PM
++static irqreturn_t apf27dev_user_switch_irq_handler(int irq, void *dev_id)
++{
++ return IRQ_HANDLED;
++}
++#endif
++
+static int gpio_pwr_ctl_active(void)
+{
+ int err;
@@ -902,27 +930,124 @@
+ err = mxc_gpio_setup_multiple(apf27dev_pwr_ctl_pins,
+ ARRAY_SIZE(apf27dev_pwr_ctl_pins), "pwr-ctl");
+ if (err < 0)
-+ pr_err("Failed to register power control pins\n");
-+
++ pr_err("Failed to register power control pins !\n");
++
++ apf27dev_power_up();
++#ifdef CONFIG_USE_LED_FOR_PM
++ gpio_set_value(GPIO_PORTF | 14, 0);
++#endif
++#ifdef CONFIG_USE_SWITCH_FOR_PM
++ err = request_irq(APF27DEV_USER_SWITCH_IRQ, apf27dev_user_switch_irq_handler,
++ IRQF_TRIGGER_FALLING,
++ "PM irq", NULL);
++ if (err < 0)
++ pr_err("Failed to register PM irq !\n");
++#endif
++
+ return err;
+}
+
-+static void apf27dev_power_up(void)
-+{
-+ gpio_set_value(APF27DEV_POWER_DOWN_NOT, 1);
-+ gpio_pwr_ctl_active();
-+}
++#ifdef CONFIG_PM
+
+static void apf27dev_power_down(void)
+{
+ gpio_set_value(APF27DEV_POWER_DOWN_NOT, 0);
+}
+
-+static void __init apf27_init(void)
++#define CCM_PCCR0 (IO_ADDRESS(CCM_BASE_ADDR) + 0x20)
++#define CCM_PCCR1 (IO_ADDRESS(CCM_BASE_ADDR) + 0x24)
++static void dump_clocks(void)
+{
-+ /* init apf27dev power down pin */
++ u32 reg;
++
++ reg = __raw_readl(CCM_CSCR);
++ printk("CSCR: 0x%08x\n", reg);
++ reg = __raw_readl(CCM_PCCR0);
++ printk("PCCR0: 0x%08x\n", reg);
++ reg = __raw_readl(CCM_PCCR1);
++ printk("PCCR1: 0x%08x\n", reg);
++}
++
++char port[6] = {'A', 'B', 'C', 'D', 'E', 'F'};
++
++static void dump_gpio_port(int id)
++{
++ u32 reg;
++
++ reg = __raw_readl(VA_GPIO_BASE + MXC_DDIR(id));
++ printk("DDIR_%c: 0x%08x\n", port[id], reg);
++ reg = __raw_readl(VA_GPIO_BASE + MXC_DR(id));
++ printk("DR_%c: 0x%08x\n", port[id], reg);
++ reg = __raw_readl(VA_GPIO_BASE + MXC_GIUS(id));
++ printk("GIUS_%c: 0x%08x\n", port[id], reg);
++ reg = __raw_readl(VA_GPIO_BASE + MXC_OCR1(id));
++ printk("OCR1_%c: 0x%08x\n", port[id], reg);
++ reg = __raw_readl(VA_GPIO_BASE + MXC_OCR2(id));
++ printk("OCR2_%c: 0x%08x\n", port[id], reg);
++ printk("---\n");
++}
++
++static void dump_gpios(void)
++{
++ int i;
++
++ printk("*************************\n");
++ for (i=0; i<6; i++) {
++ dump_gpio_port(i);
++ }
++}
++
++
++static int apf27_pm_suspend(struct sys_device *sd, pm_message_t state)
++{
++ printk("___ %s\n", __func__);
++
++ dump_clocks();
++ dump_gpios();
++
++ apf27dev_power_down();
++#ifdef CONFIG_USE_LED_FOR_PM
++ gpio_set_value(GPIO_PORTF | 14, 1);
++#endif
++
++ return 0;
++}
++
++static int apf27_pm_resume(struct sys_device *sd)
++{
++ printk("___ %s\n", __func__);
+ apf27dev_power_up();
++#ifdef CONFIG_USE_LED_FOR_PM
++ gpio_set_value(GPIO_PORTF | 14, 0);
++#endif
+
++ return 0;
++}
++
++#else
++# define apf27_pm_suspend NULL
++# define apf27_pm_resume NULL
++#endif /* CONFIG_PM */
++
++static struct sysdev_class apf27_pm_sysclass = {
++ .name = "mach-apf27",
++ .suspend = apf27_pm_suspend,
++ .resume = apf27_pm_resume,
++};
++
++static struct sys_device apf27_pm_sysdev = {
++ .cls = &apf27_pm_sysclass,
++};
++
++
++static void __init apf27_init(void)
++{
++ sysdev_class_register(&apf27_pm_sysclass);
++ sysdev_register(&apf27_pm_sysdev);
++
++ /* init apf27dev power management related pins */
++ gpio_pwr_ctl_active();
++
+ gpio_fec_active();
+
+ mxc_register_device(&mxc_uart_device0, &uart_pdata[0]);
@@ -979,6 +1104,7 @@
+};
+
+MACHINE_START(APF27, "Armadeus APF27")
++ /* Maintainer: Julien Boibessot <jul...@ar...> */
+ .phys_io = AIPI_BASE_ADDR,
+ .io_pg_offst = ((AIPI_BASE_ADDR_VIRT) >> 18) & 0xfffc,
+ .boot_params = PHYS_OFFSET + 0x100,
Modified: trunk/buildroot/target/device/armadeus/linux/kernel-patches/2.6.27.13/302-apf27-armadeus-add_imx-alsa_h_to_plat-mxc_include_mach.patch
===================================================================
--- trunk/buildroot/target/device/armadeus/linux/kernel-patches/2.6.27.13/302-apf27-armadeus-add_imx-alsa_h_to_plat-mxc_include_mach.patch 2009-02-18 09:28:39 UTC (rev 1070)
+++ trunk/buildroot/target/device/armadeus/linux/kernel-patches/2.6.27.13/302-apf27-armadeus-add_imx-alsa_h_to_plat-mxc_include_mach.patch 2009-02-18 14:22:01 UTC (rev 1071)
@@ -122,8 +122,8 @@
+void snd_imx_init_mixer(void);
+
+#ifdef CONFIG_PM
-+void snd_imx_suspend_mixer(void);
-+void snd_imx_resume_mixer(void);
++void snd_tsc210x_suspend_mixer(void);
++void snd_tsc210x_resume_mixer(void);
+#endif
+
+int snd_imx_alsa_post_probe(struct platform_device *pdev, struct imx_alsa_codec_config *config);
Added: trunk/buildroot/target/device/armadeus/linux/kernel-patches/2.6.27.13/310-apf27-armadeus-nfc-makes_it_compile_with_CONFIG_PM.patch
===================================================================
--- trunk/buildroot/target/device/armadeus/linux/kernel-patches/2.6.27.13/310-apf27-armadeus-nfc-makes_it_compile_with_CONFIG_PM.patch (rev 0)
+++ trunk/buildroot/target/device/armadeus/linux/kernel-patches/2.6.27.13/310-apf27-armadeus-nfc-makes_it_compile_with_CONFIG_PM.patch 2009-02-18 14:22:01 UTC (rev 1071)
@@ -0,0 +1,38 @@
+Index: linux-2.6.27.13/drivers/mtd/nand/mxc_nand.c
+===================================================================
+--- linux-2.6.27.13.orig/drivers/mtd/nand/mxc_nand.c 2009-02-13 10:36:31.000000000 +0100
++++ linux-2.6.27.13/drivers/mtd/nand/mxc_nand.c 2009-02-13 10:49:24.000000000 +0100
+@@ -1060,7 +1060,8 @@
+ #ifdef CONFIG_PM
+ static int mxcnd_suspend(struct platform_device *pdev, pm_message_t state)
+ {
+- struct mtd_info *info = platform_get_drvdata(pdev);
++ struct mxc_nand_host *host = platform_get_drvdata(pdev);
++ struct mtd_info *info = &(host->mtd);
+ int ret = 0;
+
+ DEBUG(MTD_DEBUG_LEVEL0, "MXC_ND : NAND suspend\n");
+@@ -1068,19 +1069,20 @@
+ ret = info->suspend(info);
+
+ /* Disable the NFC clock */
+- clk_disable(nfc_clk); /* FIXME */
++ clk_disable(host->clk);
+
+ return ret;
+ }
+
+ static int mxcnd_resume(struct platform_device *pdev)
+ {
+- struct mtd_info *info = platform_get_drvdata(pdev);
++ struct mxc_nand_host *host = platform_get_drvdata(pdev);
++ struct mtd_info *info = &(host->mtd);
+ int ret = 0;
+
+ DEBUG(MTD_DEBUG_LEVEL0, "MXC_ND : NAND resume\n");
+ /* Enable the NFC clock */
+- clk_enable(nfc_clk); /* FIXME */
++ clk_enable(host->clk);
+
+ if (info)
+ info->resume(info);
Added: trunk/buildroot/target/device/armadeus/linux/kernel-patches/2.6.27.13/311-apf27-armadeus-mx27-add_pm_infra.patch
===================================================================
--- trunk/buildroot/target/device/armadeus/linux/kernel-patches/2.6.27.13/311-apf27-armadeus-mx27-add_pm_infra.patch (rev 0)
+++ trunk/buildroot/target/device/armadeus/linux/kernel-patches/2.6.27.13/311-apf27-armadeus-mx27-add_pm_infra.patch 2009-02-18 14:22:01 UTC (rev 1071)
@@ -0,0 +1,166 @@
+Index: linux-2.6.27.13/arch/arm/mach-mx2/Makefile
+===================================================================
+--- linux-2.6.27.13.orig/arch/arm/mach-mx2/Makefile 2009-02-13 11:29:59.000000000 +0100
++++ linux-2.6.27.13/arch/arm/mach-mx2/Makefile 2009-02-13 11:30:59.000000000 +0100
+@@ -9,6 +9,7 @@
+ obj-$(CONFIG_MACH_MX27) += cpu_imx27.o
+ obj-$(CONFIG_MACH_MX27) += clock_imx27.o
+ obj-$(CONFIG_CPU_FREQ_IMX27) += cpufreq_imx27.o
++obj-$(CONFIG_PM) += pm.o
+
+ obj-$(CONFIG_MACH_APF27) += apf27.o
+ obj-$(CONFIG_MACH_MX27ADS) += mx27ads.o
+Index: linux-2.6.27.13/arch/arm/mach-mx2/pm.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.27.13/arch/arm/mach-mx2/pm.c 2009-02-18 14:06:54.000000000 +0100
+@@ -0,0 +1,149 @@
++/*
++ * linux/arch/arm/mach-mx2/pm.c
++ *
++ * i.MX2x Power Management Routines
++ *
++ * Original code for the SA11x0:
++ * Copyright (c) 2001 Cliff Brake <cb...@ac...>
++ *
++ * Modified for the PXA250 by Nicolas Pitre:
++ * Copyright (c) 2002 Monta Vista Software, Inc.
++ *
++ * Modified for the OMAP1510 by David Singleton:
++ * Copyright (c) 2002 Monta Vista Software, Inc.
++ *
++ * Cleanup 2004 for OMAP1510/1610 by Dirk Behme <dir...@de...>
++ *
++ * Modified for the i.MX27
++ * Copyright 2007 Freescale Semiconductor, Inc. All Rights Reserved.
++ *
++ * Modified for i.MX2x by Julien Boibessot <jul...@ar...>
++ * Copyright (c) 2009 Armadeus systems
++ *
++ * This program is free software; you can redistribute it and/or modify it
++ * under the terms of the GNU General Public License as published by the
++ * Free Software Foundation; either version 2 of the License, or (at your
++ * option) any later version.
++ *
++ */
++
++#define DEBUG
++
++#include <linux/pm.h>
++#include <linux/suspend.h>
++#include <asm/io.h>
++// #include <asm/arch/mxc_pm.h>
++#include <mach/system.h> /* arch_idle() */
++
++
++#define DOZE_MODE 0
++#define WAIT_MODE 1
++#define STOP_MODE 2
++#define DSM_MODE 3
++
++#define CCM_CSCR (IO_ADDRESS(CCM_BASE_ADDR) + 0x0)
++
++static void mx2_pm_lowpower(u32 mode)
++{
++ u32 cscr;
++
++ local_irq_disable();
++
++ /* WAIT and DOZE execute WFI only */
++ switch (mode) {
++ case STOP_MODE:
++ case DSM_MODE:
++ /* Clear MPEN and SPEN to disable MPLL/SPLL */
++ cscr = __raw_readl(CCM_CSCR);
++ cscr &= 0xFFFFFFFC;
++ __raw_writel(cscr, CCM_CSCR);
++ break;
++ }
++
++ /* Executes WFI */
++ arch_idle();
++
++ local_irq_enable();
++}
++
++
++/* All the power modes we support */
++static int mx2_pm_valid(suspend_state_t state)
++{
++ switch (state) {
++ case PM_SUSPEND_ON:
++ case PM_SUSPEND_STANDBY:
++ case PM_SUSPEND_MEM:
++ return 1;
++
++ default:
++ return 0;
++ }
++}
++
++static int mx2_pm_enter(suspend_state_t state)
++{
++ pr_debug("%s\n", __func__);
++
++ switch (state) {
++ case PM_SUSPEND_MEM:
++ mx2_pm_lowpower(STOP_MODE);
++ break;
++
++ case PM_SUSPEND_STANDBY:
++ mx2_pm_lowpower(WAIT_MODE);
++ break;
++
++ case PM_SUSPEND_ON:
++ printk("PM_SUSPEND_ON\n");
++ break;
++
++ case PM_SUSPEND_MAX:
++ mx2_pm_lowpower(DSM_MODE);
++ break;
++
++ default:
++ printk("unsupported suspend state: %d\n", state);
++ return -1;
++ }
++
++ return 0;
++}
++
++/* Called after processes are frozen, but before we shut down devices. */
++static int mx2_pm_prepare(void)
++{
++ pr_debug("%s\n", __func__);
++ return 0;
++}
++
++/* Called after devices are re-setup, but before processes are thawed. */
++static void mx2_pm_finish(void)
++{
++ pr_debug("%s: proc out of sleep\n", __func__);
++}
++
++/* Called right prior to thawing processes. */
++static void mx2_pm_end(void)
++{
++ pr_debug("%s: all devices should be running now\n", __func__);
++}
++
++struct platform_suspend_ops mx2_pm_ops = {
++ .valid = mx2_pm_valid,
++ .prepare = mx2_pm_prepare,
++ .enter = mx2_pm_enter,
++ .finish = mx2_pm_finish,
++ .end = mx2_pm_end,
++};
++
++static int __init mx2_pm_init(void)
++{
++ printk("Power Management for Freescale i.MX2x\n");
++
++ suspend_set_ops(&mx2_pm_ops);
++
++ return 0;
++}
++
++device_initcall(mx2_pm_init);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|