
Dear Lukasz Majewski,
On 20 July 2011 17:35, Lukasz Majewski l.majewski@samsung.com wrote:
This patch adds support for software I2C for GONI reference target. 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 Cc: Minkyu Kang mk7.kang@samsung.com Cc: Heiko Schocher hs@denx.de
Changes for v2: - Generic GPIO code added to arch/arm/gpio.h - Platform dependent GPIO code added to board/samsung/goni.c - Code cleanup
arch/arm/include/asm/arch-s5pc1xx/gpio.h | 36 ++++++++++++++++++++++++++++++ board/samsung/goni/goni.c | 30 +++++++++++++++++++++++- include/configs/s5p_goni.h | 13 ++++++++++ 3 files changed, 77 insertions(+), 2 deletions(-)
diff --git a/arch/arm/include/asm/arch-s5pc1xx/gpio.h b/arch/arm/include/asm/arch-s5pc1xx/gpio.h index 903de9c..8d2e2e9 100644 --- a/arch/arm/include/asm/arch-s5pc1xx/gpio.h +++ b/arch/arm/include/asm/arch-s5pc1xx/gpio.h
please add s5pc2xx also.
diff --git a/board/samsung/goni/goni.c b/board/samsung/goni/goni.c index e24cd29..d1ff956 100644 --- a/board/samsung/goni/goni.c +++ b/board/samsung/goni/goni.c @@ -1,7 +1,8 @@ /*
- Copyright (C) 2008-2009 Samsung Electronics
- Copyright (C) 2008-2011 Samsung Electronics
* Minkyu Kang mk7.kang@samsung.com * Kyungmin Park kyungmin.park@samsung.com
- Lukasz Majewski l.majewski@samsung.com
* * See file CREDITS for list of people who contributed to this * project. @@ -28,7 +29,7 @@
DECLARE_GLOBAL_DATA_PTR;
-static struct s5pc110_gpio *s5pc110_gpio; +struct s5pc110_gpio *s5pc110_gpio;
Why?
int board_init(void) { @@ -96,3 +97,28 @@ int board_mmc_init(bd_t *bis) return s5p_mmc_init(0, 4); } #endif
+#ifdef CONFIG_SOFT_I2C +void i2c_init_board(void) {} +/* Platform dependent functions for extracting GPIO number */ +int s5p_gpio_get_nr(void *gp_ptr, int gpio) +{
- unsigned int offset = gp_ptr - (void *) s5pc110_gpio;
- offset /= sizeof(struct s5p_gpio_bank);
- return (offset * GPIO_PER_BANK) + gpio;
+}
+struct s5p_gpio_bank *s5p_gpio_get_bank(int nr) +{
- int bank = nr / GPIO_PER_BANK;
- bank *= sizeof(struct s5p_gpio_bank);
- return (struct s5p_gpio_bank *) ((void *) s5pc110_gpio + bank);
+}
+int s5p_gpio_get_pin(int nr) +{
- return nr % GPIO_PER_BANK;
+} +#endif
I think these codes are not board specific. Please make common file for I2C gpio for s5p.
Thanks Minkyu Kang