summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorŁukasz Majewski <l.majewski@samsung.com>2011-08-22 22:34:58 +0000
committerAlbert ARIBAUD <albert.u.boot@aribaud.net>2011-09-04 11:36:15 +0200
commit9f15bc0c1cc1a88ee655ea2dc3dd56caf8e5de79 (patch)
tree5efcd83fcf9b339bfeef9a69e1912501f7785bcf /arch
parentd07dc4993d646a1b1857a987f9145bf0a8c21370 (diff)
downloadtalos-obmc-uboot-9f15bc0c1cc1a88ee655ea2dc3dd56caf8e5de79.tar.gz
talos-obmc-uboot-9f15bc0c1cc1a88ee655ea2dc3dd56caf8e5de79.zip
i2c:gpio:s5p: I2C GPIO Software implementation (via soft_i2c)
This patch adds support for software I2C for GONI and Universal C210 reference targets. It adds support for access to GPIOs by number, not as it is present, by bank and offset. Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Minkyu Kang <mk7.kang@samsung.com> Cc: Heiko Schocher <hs@denx.de>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/include/asm/arch-s5pc1xx/gpio.h13
-rw-r--r--arch/arm/include/asm/arch-s5pc2xx/gpio.h29
2 files changed, 42 insertions, 0 deletions
diff --git a/arch/arm/include/asm/arch-s5pc1xx/gpio.h b/arch/arm/include/asm/arch-s5pc1xx/gpio.h
index 903de9c337..76b901b397 100644
--- a/arch/arm/include/asm/arch-s5pc1xx/gpio.h
+++ b/arch/arm/include/asm/arch-s5pc1xx/gpio.h
@@ -134,6 +134,19 @@ unsigned int s5p_gpio_get_value(struct s5p_gpio_bank *bank, int gpio);
void s5p_gpio_set_pull(struct s5p_gpio_bank *bank, int gpio, int mode);
void s5p_gpio_set_drv(struct s5p_gpio_bank *bank, int gpio, int mode);
void s5p_gpio_set_rate(struct s5p_gpio_bank *bank, int gpio, int mode);
+
+/* GPIO pins per bank */
+#define GPIO_PER_BANK 8
+
+static inline unsigned int s5p_gpio_base(int nr)
+{
+ return S5PC110_GPIO_BASE;
+}
+
+#define s5pc110_gpio_get_nr(bank, pin) \
+ ((((((unsigned int)&(((struct s5pc110_gpio *)S5PC110_GPIO_BASE)->bank))\
+ - S5PC110_GPIO_BASE) / sizeof(struct s5p_gpio_bank)) \
+ * GPIO_PER_BANK) + pin)
#endif
/* Pin configurations */
diff --git a/arch/arm/include/asm/arch-s5pc2xx/gpio.h b/arch/arm/include/asm/arch-s5pc2xx/gpio.h
index 8db5895b86..8be620cae6 100644
--- a/arch/arm/include/asm/arch-s5pc2xx/gpio.h
+++ b/arch/arm/include/asm/arch-s5pc2xx/gpio.h
@@ -88,6 +88,35 @@ unsigned int s5p_gpio_get_value(struct s5p_gpio_bank *bank, int gpio);
void s5p_gpio_set_pull(struct s5p_gpio_bank *bank, int gpio, int mode);
void s5p_gpio_set_drv(struct s5p_gpio_bank *bank, int gpio, int mode);
void s5p_gpio_set_rate(struct s5p_gpio_bank *bank, int gpio, int mode);
+
+/* GPIO pins per bank */
+#define GPIO_PER_BANK 8
+
+#define s5pc210_gpio_part1_get_nr(bank, pin) \
+ ((((((unsigned int) &(((struct s5pc210_gpio_part1 *) \
+ S5PC210_GPIO_PART1_BASE)->bank)) \
+ - S5PC210_GPIO_PART1_BASE) / sizeof(struct s5p_gpio_bank)) \
+ * GPIO_PER_BANK) + pin)
+
+#define GPIO_PART1_MAX ((sizeof(struct s5pc210_gpio_part1) \
+ / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
+
+#define s5pc210_gpio_part2_get_nr(bank, pin) \
+ (((((((unsigned int) &(((struct s5pc210_gpio_part2 *) \
+ S5PC210_GPIO_PART2_BASE)->bank)) \
+ - S5PC210_GPIO_PART2_BASE) / sizeof(struct s5p_gpio_bank)) \
+ * GPIO_PER_BANK) + pin) + GPIO_PART1_MAX)
+
+static inline unsigned int s5p_gpio_base(int nr)
+{
+ if (nr < GPIO_PART1_MAX)
+ return S5PC210_GPIO_PART1_BASE;
+ else
+ return S5PC210_GPIO_PART2_BASE;
+
+ return 0;
+}
+
#endif
/* Pin configurations */
OpenPOWER on IntegriCloud