Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 191914
b: refs/heads/master
c: 1ec7269
h: refs/heads/master
v: v3
  • Loading branch information
Ben Dooks committed May 6, 2010
1 parent a0a6a43 commit 884ba1b
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9bbb851c7079ff670ba3fe6c7ce93bb5daa9a694
refs/heads/master: 1ec7269fd8b05044f2cb4059b679e053d57460f5
1 change: 1 addition & 0 deletions trunk/arch/arm/mach-s3c2410/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ config CPU_S3C2410
bool
depends on ARCH_S3C2410
select CPU_ARM920T
select S3C_GPIO_PULL_UP
select S3C2410_CLOCK
select S3C2410_GPIO
select CPU_LLSERIAL_S3C2410
Expand Down
8 changes: 8 additions & 0 deletions trunk/arch/arm/mach-s3c2410/s3c2410.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <linux/list.h>
#include <linux/timer.h>
#include <linux/init.h>
#include <linux/gpio.h>
#include <linux/clk.h>
#include <linux/sysdev.h>
#include <linux/serial_core.h>
Expand All @@ -40,6 +41,10 @@
#include <plat/clock.h>
#include <plat/pll.h>

#include <plat/gpio-core.h>
#include <plat/gpio-cfg.h>
#include <plat/gpio-cfg-helpers.h>

/* Initial IO mappings */

static struct map_desc s3c2410_iodesc[] __initdata = {
Expand All @@ -65,6 +70,9 @@ void __init s3c2410_init_uarts(struct s3c2410_uartcfg *cfg, int no)

void __init s3c2410_map_io(void)
{
s3c24xx_gpiocfg_default.set_pull = s3c_gpio_setpull_1up;
s3c24xx_gpiocfg_default.get_pull = s3c_gpio_getpull_1up;

iotable_init(s3c2410_iodesc, ARRAY_SIZE(s3c2410_iodesc));
}

Expand Down
1 change: 1 addition & 0 deletions trunk/arch/arm/mach-s3c2440/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ config CPU_S3C2440
bool
depends on ARCH_S3C2410
select CPU_ARM920T
select S3C_GPIO_PULL_UP
select S3C2410_CLOCK
select S3C2410_PM if PM
select S3C2410_GPIO
Expand Down
8 changes: 8 additions & 0 deletions trunk/arch/arm/mach-s3c2440/s3c2440.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <linux/platform_device.h>
#include <linux/serial_core.h>
#include <linux/sysdev.h>
#include <linux/gpio.h>
#include <linux/clk.h>
#include <linux/io.h>

Expand All @@ -33,6 +34,10 @@
#include <plat/cpu.h>
#include <plat/s3c244x.h>

#include <plat/gpio-core.h>
#include <plat/gpio-cfg.h>
#include <plat/gpio-cfg-helpers.h>

static struct sys_device s3c2440_sysdev = {
.cls = &s3c2440_sysclass,
};
Expand All @@ -41,6 +46,9 @@ int __init s3c2440_init(void)
{
printk("S3C2440: Initialising architecture\n");

s3c24xx_gpiocfg_default.set_pull = s3c_gpio_setpull_1up;
s3c24xx_gpiocfg_default.get_pull = s3c_gpio_getpull_1up;

/* change irq for watchdog */

s3c_device_wdt.resource[1].start = IRQ_S3C2440_WDT;
Expand Down
32 changes: 32 additions & 0 deletions trunk/arch/arm/plat-samsung/gpio-config.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,3 +164,35 @@ s3c_gpio_pull_t s3c_gpio_getpull_updown(struct s3c_gpio_chip *chip,
return (__force s3c_gpio_pull_t)pup;
}
#endif

#ifdef CONFIG_S3C_GPIO_PULL_UP
int s3c_gpio_setpull_1up(struct s3c_gpio_chip *chip,
unsigned int off, s3c_gpio_pull_t pull)
{
void __iomem *reg = chip->base + 0x08;
u32 pup = __raw_readl(reg);

pup = __raw_readl(reg);

if (pup == S3C_GPIO_PULL_UP)
pup &= ~(1 << off);
else if (pup == S3C_GPIO_PULL_NONE)
pup |= (1 << off);
else
return -EINVAL;

__raw_writel(pup, reg);
return 0;
}

s3c_gpio_pull_t s3c_gpio_getpull_1up(struct s3c_gpio_chip *chip,
unsigned int off)
{
void __iomem *reg = chip->base + 0x08;
u32 pup = __raw_readl(reg);

pup &= (1 << off);
return pup ? S3C_GPIO_PULL_NONE : S3C_GPIO_PULL_UP;
}
#endif /* CONFIG_S3C_GPIO_PULL_UP */

11 changes: 11 additions & 0 deletions trunk/arch/arm/plat-samsung/include/plat/gpio-cfg-helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,17 @@ extern int s3c_gpio_setpull_updown(struct s3c_gpio_chip *chip,
extern s3c_gpio_pull_t s3c_gpio_getpull_updown(struct s3c_gpio_chip *chip,
unsigned int off);

/**
* s3c_gpio_getpull_1up() - Get configuration for choice of up or none
* @chip: The gpio chip that the GPIO pin belongs to
* @off: The offset to the pin to get the configuration of.
*
* This helper function reads the state of the pull-up resistor for the
* given GPIO in the same case as s3c_gpio_setpull_1up.
*/
extern s3c_gpio_pull_t s3c_gpio_getpull_1up(struct s3c_gpio_chip *chip,
unsigned int off);

/**
* s3c_gpio_setpull_s3c2443() - Pull configuration for s3c2443.
* @chip: The gpio chip that is being configured.
Expand Down

0 comments on commit 884ba1b

Please sign in to comment.