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

Commit 838c6d49 authored by Marek Szyprowski's avatar Marek Szyprowski Committed by Ben Dooks
Browse files

ARM: SAMSUNG: move driver strength gpio configuration helper to common dir



Driver strength parameter can be changed not only on S5PC100 but also
on S5PV210/S5PC110 platforms, so move the helper functions to the common
plat-samsung directory.

Signed-off-by: default avatarMarek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: default avatarBen Dooks <ben-linux@fluff.org>
parent 14b8a0f9
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@ config PLAT_S5P
	select NO_IOPORT
	select ARCH_REQUIRE_GPIOLIB
	select S3C_GPIO_TRACK
	select S5P_GPIO_DRVSTR
	select SAMSUNG_GPIOLIB_4BIT
	select S3C_GPIO_CFG_S3C64XX
	select S3C_GPIO_PULL_UPDOWN
+1 −1
Original line number Diff line number Diff line
@@ -16,9 +16,9 @@ config PLAT_S5PC1XX
	select SAMSUNG_IRQ_VIC_TIMER
	select S3C_GPIO_TRACK
	select S3C_GPIO_PULL_UPDOWN
	select S5P_GPIO_DRVSTR
	select S3C_GPIO_CFG_S3C24XX
	select S3C_GPIO_CFG_S3C64XX
	select S5P_GPIO_CFG_S5PC1XX
	help
	  Base platform code for any Samsung S5PC1XX device

+0 −1
Original line number Diff line number Diff line
@@ -24,7 +24,6 @@ obj-$(CONFIG_CPU_S5PC100_CLOCK) += s5pc100-clock.o

# Device setup

obj-$(CONFIG_S5P_GPIO_CFG_S5PC1XX) += gpio-config.o
obj-$(CONFIG_S5PC1XX_SETUP_FB_24BPP) += setup-fb-24bpp.o
obj-$(CONFIG_S5PC1XX_SETUP_I2C0) += setup-i2c0.o
obj-$(CONFIG_S5PC1XX_SETUP_I2C1) += setup-i2c1.o
+0 −62
Original line number 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 <plat/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);
+0 −32
Original line number Diff line number Diff line
/* linux/arch/arm/plat-s5pc1xx/include/plat/gpio-cfg.h
 *
 * Copyright 2009 Samsung Electronic
 *
 * S5PC1XX Platform - GPIO pin configuration
 *
 * 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.
*/

/* This file contains the necessary definitions to get the basic gpio
 * pin configuration done such as setting a pin to input or output or
 * changing the pull-{up,down} configurations.
 */

#ifndef __GPIO_CFG_S5PC1XX_H
#define __GPIO_CFG_S5PC1XX_H __FILE__

typedef unsigned int __bitwise__ s5p_gpio_drvstr_t;

#define S5P_GPIO_DRVSTR_LV1	0x00
#define S5P_GPIO_DRVSTR_LV2	0x01
#define S5P_GPIO_DRVSTR_LV3	0x10
#define S5P_GPIO_DRVSTR_LV4	0x11

extern s5p_gpio_drvstr_t s5p_gpio_get_drvstr(unsigned int pin, unsigned int off);

extern int s5p_gpio_set_drvstr(unsigned int pin, unsigned int off,
			s5p_gpio_drvstr_t drvstr);

#endif /* __GPIO_CFG_S5PC1XX_H */
Loading