Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b0d5217c authored by Kyungmin Park's avatar Kyungmin Park Committed by Ben Dooks
Browse files

ARM: S5PC1xx: add gpiolib and external/gpio interrupt support



Add support for gpiolib calls. This is based on the gpiolib implementation
from plat-s3c64xx tree.
Add support for external interrupts for GPIO H banks.
Add support for GPIO interrupts for all banks.

Signed-off-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: default avatarMarek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: default avatarBen Dooks <ben-linux@fluff.org>
parent d7b9ace5
Loading
Loading
Loading
Loading
+6 −0
Original line number Original line Diff line number Diff line
@@ -159,6 +159,12 @@ config S3C_GPIO_CFG_S3C64XX
	  Internal configuration to enable S3C64XX style GPIO configuration
	  Internal configuration to enable S3C64XX style GPIO configuration
	  functions.
	  functions.


config S5P_GPIO_CFG_S5PC1XX
	bool
	help
	  Internal configuration to enable S5PC1XX style GPIO configuration
	  functions.

# DMA
# DMA


config S3C_DMA
config S3C_DMA
+3 −0
Original line number Original line Diff line number Diff line
@@ -15,6 +15,9 @@ config PLAT_S5PC1XX
	select ARCH_REQUIRE_GPIOLIB
	select ARCH_REQUIRE_GPIOLIB
	select S3C_GPIO_TRACK
	select S3C_GPIO_TRACK
	select S3C_GPIO_PULL_UPDOWN
	select S3C_GPIO_PULL_UPDOWN
	select S3C_GPIO_CFG_S3C24XX
	select S3C_GPIO_CFG_S3C64XX
	select S5P_GPIO_CFG_S5PC1XX
	help
	help
	  Base platform code for any Samsung S5PC1XX device
	  Base platform code for any Samsung S5PC1XX device


+3 −1
Original line number Original line Diff line number Diff line
@@ -13,8 +13,9 @@ obj- :=


obj-y				+= dev-uart.o
obj-y				+= dev-uart.o
obj-y				+= cpu.o
obj-y				+= cpu.o
obj-y				+= irq.o
obj-y				+= irq.o irq-gpio.o irq-eint.o
obj-y				+= clock.o
obj-y				+= clock.o
obj-y				+= gpiolib.o


# CPU support
# CPU support


@@ -23,5 +24,6 @@ obj-$(CONFIG_CPU_S5PC100_CLOCK) += s5pc100-clock.o


# Device setup
# Device setup


obj-$(CONFIG_S5P_GPIO_CFG_S5PC1XX) += gpio-config.o
obj-$(CONFIG_S5PC100_SETUP_I2C0) += setup-i2c0.o
obj-$(CONFIG_S5PC100_SETUP_I2C0) += setup-i2c0.o
obj-$(CONFIG_S5PC100_SETUP_I2C1) += setup-i2c1.o
obj-$(CONFIG_S5PC100_SETUP_I2C1) += setup-i2c1.o
+5 −0
Original line number Original line Diff line number Diff line
@@ -59,6 +59,11 @@ static struct map_desc s5pc1xx_iodesc[] __initdata = {
		.pfn		= __phys_to_pfn(S5PC1XX_PA_CLK_OTHER),
		.pfn		= __phys_to_pfn(S5PC1XX_PA_CLK_OTHER),
		.length		= SZ_4K,
		.length		= SZ_4K,
		.type		= MT_DEVICE,
		.type		= MT_DEVICE,
	}, {
		.virtual	= (unsigned long)S5PC1XX_VA_GPIO,
		.pfn		= __phys_to_pfn(S5PC100_PA_GPIO),
		.length		= SZ_4K,
		.type		= MT_DEVICE,
	}, {
	}, {
		.virtual	= (unsigned long)S5PC1XX_VA_CHIPID,
		.virtual	= (unsigned long)S5PC1XX_VA_CHIPID,
		.pfn		= __phys_to_pfn(S5PC1XX_PA_CHIPID),
		.pfn		= __phys_to_pfn(S5PC1XX_PA_CHIPID),
+62 −0
Original line number Original line Diff line number Diff line
/* linux/arch/arm/plat-s5pc1xx/gpio-config.c
 *
 * Copyright 2009 Samsung Electronics
 *
 * S5PC1XX GPIO Configuration.
 *
 * Based on plat-s3c64xx/gpio-config.c
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
*/

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/gpio.h>
#include <linux/io.h>

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

s5p_gpio_drvstr_t s5p_gpio_get_drvstr(unsigned int pin, unsigned int off)
{
	struct s3c_gpio_chip *chip = s3c_gpiolib_getchip(pin);
	void __iomem *reg;
	int shift = off * 2;
	u32 drvstr;

	if (!chip)
		return -EINVAL;

	reg = chip->base + 0x0C;

	drvstr = __raw_readl(reg);
	drvstr = 0xffff & (0x3 << shift);
	drvstr = drvstr >> shift;

	return (__force s5p_gpio_drvstr_t)drvstr;
}
EXPORT_SYMBOL(s5p_gpio_get_drvstr);

int s5p_gpio_set_drvstr(unsigned int pin, unsigned int off,
			s5p_gpio_drvstr_t drvstr)
{
	struct s3c_gpio_chip *chip = s3c_gpiolib_getchip(pin);
	void __iomem *reg;
	int shift = off * 2;
	u32 tmp;

	if (!chip)
		return -EINVAL;

	reg = chip->base + 0x0C;

	tmp = __raw_readl(reg);
	tmp |= drvstr << shift;

	__raw_writel(tmp, reg);

	return 0;
}
EXPORT_SYMBOL(s5p_gpio_set_drvstr);
Loading