1 /* linux/arch/arm/mach-s3c2412/gpio.c
3 * Copyright (c) 2007 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/.
8 * S3C2412/S3C2413 specific GPIO support
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
15 #include <linux/kernel.h>
16 #include <linux/types.h>
17 #include <linux/module.h>
18 #include <linux/interrupt.h>
20 #include <asm/mach/arch.h>
21 #include <asm/mach/map.h>
23 #include <mach/regs-gpio.h>
25 #include <mach/hardware.h>
27 int s3c2412_gpio_set_sleepcfg(unsigned int pin, unsigned int state)
29 void __iomem *base = S3C24XX_GPIO_BASE(pin);
30 unsigned long offs = S3C2410_GPIO_OFFSET(pin);
36 if (pin < S3C2410_GPIO_BANKB)
39 if (pin >= S3C2410_GPIO_BANKF &&
40 pin <= S3C2410_GPIO_BANKG)
43 if (pin > (S3C2410_GPIO_BANKH + 32))
46 local_irq_save(flags);
48 slpcon = __raw_readl(base + 0x0C);
50 slpcon &= ~(3 << offs);
51 slpcon |= state << offs;
53 __raw_writel(slpcon, base + 0x0C);
55 local_irq_restore(flags);
60 EXPORT_SYMBOL(s3c2412_gpio_set_sleepcfg);