eric miao | 2c8086a | 2007-09-11 19:13:17 -0700 | [diff] [blame] | 1 | /* |
| 2 | * linux/arch/arm/mach-pxa/mfp.c |
| 3 | * |
| 4 | * PXA3xx Multi-Function Pin Support |
| 5 | * |
| 6 | * Copyright (C) 2007 Marvell Internation Ltd. |
| 7 | * |
eric miao | e9bba8e | 2007-10-30 08:01:38 +0100 | [diff] [blame] | 8 | * 2007-08-21: eric miao <eric.miao@marvell.com> |
eric miao | 2c8086a | 2007-09-11 19:13:17 -0700 | [diff] [blame] | 9 | * initial version |
| 10 | * |
| 11 | * This program is free software; you can redistribute it and/or modify |
| 12 | * it under the terms of the GNU General Public License version 2 as |
| 13 | * published by the Free Software Foundation. |
| 14 | */ |
| 15 | |
| 16 | #include <linux/module.h> |
| 17 | #include <linux/kernel.h> |
| 18 | #include <linux/init.h> |
| 19 | #include <linux/io.h> |
Rafael J. Wysocki | 2eaa03b | 2011-04-22 22:03:11 +0200 | [diff] [blame] | 20 | #include <linux/syscore_ops.h> |
eric miao | 2c8086a | 2007-09-11 19:13:17 -0700 | [diff] [blame] | 21 | |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 22 | #include <mach/hardware.h> |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 23 | #include <mach/mfp-pxa3xx.h> |
| 24 | #include <mach/pxa3xx-regs.h> |
eric miao | 2c8086a | 2007-09-11 19:13:17 -0700 | [diff] [blame] | 25 | |
Russell King | d4fc858 | 2008-01-08 15:12:22 +0000 | [diff] [blame] | 26 | #ifdef CONFIG_PM |
| 27 | /* |
| 28 | * Configure the MFPs appropriately for suspend/resume. |
| 29 | * FIXME: this should probably depend on which system state we're |
| 30 | * entering - for instance, we might not want to place MFP pins in |
| 31 | * a pull-down mode if they're an active low chip select, and we're |
| 32 | * just entering standby. |
| 33 | */ |
Rafael J. Wysocki | 2eaa03b | 2011-04-22 22:03:11 +0200 | [diff] [blame] | 34 | static int pxa3xx_mfp_suspend(void) |
Russell King | d4fc858 | 2008-01-08 15:12:22 +0000 | [diff] [blame] | 35 | { |
Eric Miao | f8dec04 | 2009-01-15 16:42:56 +0800 | [diff] [blame] | 36 | mfp_config_lpm(); |
Russell King | d4fc858 | 2008-01-08 15:12:22 +0000 | [diff] [blame] | 37 | return 0; |
| 38 | } |
| 39 | |
Rafael J. Wysocki | 2eaa03b | 2011-04-22 22:03:11 +0200 | [diff] [blame] | 40 | static void pxa3xx_mfp_resume(void) |
Russell King | d4fc858 | 2008-01-08 15:12:22 +0000 | [diff] [blame] | 41 | { |
Eric Miao | f8dec04 | 2009-01-15 16:42:56 +0800 | [diff] [blame] | 42 | mfp_config_run(); |
eric miao | c4d1fb6 | 2008-01-28 23:00:02 +0000 | [diff] [blame] | 43 | |
| 44 | /* clear RDH bit when MFP settings are restored |
| 45 | * |
| 46 | * NOTE: the last 3 bits DxS are write-1-to-clear so carefully |
| 47 | * preserve them here in case they will be referenced later |
| 48 | */ |
| 49 | ASCR &= ~(ASCR_RDH | ASCR_D1S | ASCR_D2S | ASCR_D3S); |
Russell King | d4fc858 | 2008-01-08 15:12:22 +0000 | [diff] [blame] | 50 | } |
eric miao | 4be35e2 | 2008-02-04 10:07:09 +0800 | [diff] [blame] | 51 | #else |
| 52 | #define pxa3xx_mfp_suspend NULL |
| 53 | #define pxa3xx_mfp_resume NULL |
| 54 | #endif |
Russell King | d4fc858 | 2008-01-08 15:12:22 +0000 | [diff] [blame] | 55 | |
Rafael J. Wysocki | 2eaa03b | 2011-04-22 22:03:11 +0200 | [diff] [blame] | 56 | struct syscore_ops pxa3xx_mfp_syscore_ops = { |
Russell King | d4fc858 | 2008-01-08 15:12:22 +0000 | [diff] [blame] | 57 | .suspend = pxa3xx_mfp_suspend, |
Rafael J. Wysocki | 2eaa03b | 2011-04-22 22:03:11 +0200 | [diff] [blame] | 58 | .resume = pxa3xx_mfp_resume, |
Russell King | d4fc858 | 2008-01-08 15:12:22 +0000 | [diff] [blame] | 59 | }; |