blob: 56114df9700dd38cfa099f2eb48f6f731be6d0ad [file] [log] [blame]
Thomas Gleixnerd2912cb2019-06-04 10:11:33 +02001// SPDX-License-Identifier: GPL-2.0-only
eric miao2c8086a2007-09-11 19:13:17 -07002/*
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 miaoe9bba8e2007-10-30 08:01:38 +01009 * 2007-08-21: eric miao <eric.miao@marvell.com>
eric miao2c8086a2007-09-11 19:13:17 -070010 * initial version
eric miao2c8086a2007-09-11 19:13:17 -070011 */
12
13#include <linux/module.h>
14#include <linux/kernel.h>
15#include <linux/init.h>
16#include <linux/io.h>
Rafael J. Wysocki2eaa03b2011-04-22 22:03:11 +020017#include <linux/syscore_ops.h>
eric miao2c8086a2007-09-11 19:13:17 -070018
Russell Kinga09e64f2008-08-05 16:14:15 +010019#include <mach/hardware.h>
Arnd Bergmann4c25c5d2015-01-30 10:45:33 +010020#include "mfp-pxa3xx.h"
Russell Kinga09e64f2008-08-05 16:14:15 +010021#include <mach/pxa3xx-regs.h>
eric miao2c8086a2007-09-11 19:13:17 -070022
Russell Kingd4fc8582008-01-08 15:12:22 +000023#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. Wysocki2eaa03b2011-04-22 22:03:11 +020031static int pxa3xx_mfp_suspend(void)
Russell Kingd4fc8582008-01-08 15:12:22 +000032{
Eric Miaof8dec042009-01-15 16:42:56 +080033 mfp_config_lpm();
Russell Kingd4fc8582008-01-08 15:12:22 +000034 return 0;
35}
36
Rafael J. Wysocki2eaa03b2011-04-22 22:03:11 +020037static void pxa3xx_mfp_resume(void)
Russell Kingd4fc8582008-01-08 15:12:22 +000038{
Eric Miaof8dec042009-01-15 16:42:56 +080039 mfp_config_run();
eric miaoc4d1fb62008-01-28 23:00:02 +000040
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 Kingd4fc8582008-01-08 15:12:22 +000047}
eric miao4be35e22008-02-04 10:07:09 +080048#else
49#define pxa3xx_mfp_suspend NULL
50#define pxa3xx_mfp_resume NULL
51#endif
Russell Kingd4fc8582008-01-08 15:12:22 +000052
Rafael J. Wysocki2eaa03b2011-04-22 22:03:11 +020053struct syscore_ops pxa3xx_mfp_syscore_ops = {
Russell Kingd4fc8582008-01-08 15:12:22 +000054 .suspend = pxa3xx_mfp_suspend,
Rafael J. Wysocki2eaa03b2011-04-22 22:03:11 +020055 .resume = pxa3xx_mfp_resume,
Russell Kingd4fc8582008-01-08 15:12:22 +000056};