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>
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
);
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
);
53 reg
= chip
->base
+ 0x0C;
55 tmp
= __raw_readl(reg
);
56 tmp
|= drvstr
<< shift
;
58 __raw_writel(tmp
, reg
);
62 EXPORT_SYMBOL(s5p_gpio_set_drvstr
);