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