acpiphp: Execute ACPI _REG method for hotadded devices
[linux/fpc-iii.git] / arch / arm / plat-s5pc1xx / gpio-config.c
blobbba675df9c75137521e17f2d212aeb8dd90d4d67
1 /* linux/arch/arm/plat-s5pc1xx/gpio-config.c
3 * Copyright 2009 Samsung Electronics
5 * S5PC1XX GPIO Configuration.
7 * Based on plat-s3c64xx/gpio-config.c
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
14 #include <linux/kernel.h>
15 #include <linux/module.h>
16 #include <linux/gpio.h>
17 #include <linux/io.h>
19 #include <mach/gpio-core.h>
20 #include <plat/gpio-cfg-s5pc1xx.h>
22 s5p_gpio_drvstr_t s5p_gpio_get_drvstr(unsigned int pin, unsigned int off)
24 struct s3c_gpio_chip *chip = s3c_gpiolib_getchip(pin);
25 void __iomem *reg;
26 int shift = off * 2;
27 u32 drvstr;
29 if (!chip)
30 return -EINVAL;
32 reg = chip->base + 0x0C;
34 drvstr = __raw_readl(reg);
35 drvstr = 0xffff & (0x3 << shift);
36 drvstr = drvstr >> shift;
38 return (__force s5p_gpio_drvstr_t)drvstr;
40 EXPORT_SYMBOL(s5p_gpio_get_drvstr);
42 int s5p_gpio_set_drvstr(unsigned int pin, unsigned int off,
43 s5p_gpio_drvstr_t drvstr)
45 struct s3c_gpio_chip *chip = s3c_gpiolib_getchip(pin);
46 void __iomem *reg;
47 int shift = off * 2;
48 u32 tmp;
50 if (!chip)
51 return -EINVAL;
53 reg = chip->base + 0x0C;
55 tmp = __raw_readl(reg);
56 tmp |= drvstr << shift;
58 __raw_writel(tmp, reg);
60 return 0;
62 EXPORT_SYMBOL(s5p_gpio_set_drvstr);