i2c:gpio:s5p I2C GPIO rework
Subsystems (2)
cover i2c:gpio:s5p I2C GPIO rework
Below patches are supposed to adapt S5P processor's GPIO subsystem to soft_i2c software GPIO framework.
For this purpose some renaming has been performed. Patch tested at GONI reference target.
Lukasz Majewski (2):
gpio:samsung s5p_ suffix add for GPIO functions i2c:gpio:s5p: I2C GPIO Software implementation (via soft_i2c)
arch/arm/include/asm/arch-s5pc1xx/gpio.h | 18 +++++---- arch/arm/include/asm/arch-s5pc2xx/gpio.h | 16 ++++---- board/samsung/goni/goni.c | 63 +++++++++++++++++++++++++++-- board/samsung/smdkc100/smdkc100.c | 2 +- board/samsung/smdkv310/smdkv310.c | 8 ++-- drivers/gpio/s5p_gpio.c | 20 +++++----- include/configs/s5p_goni.h | 13 ++++++ 7 files changed, 104 insertions(+), 36 deletions(-)
Signature · 1 line
1.7.2.3
PATCH 1/2 gpio:s5p s5p_ suffix add for GPIO functions
This change is driven by need of general gpio_* functions, which as their parameter are accepting the GPIO pin number, NOT block and pin.
This makes the code alike to omap, and allows for using I2C software generic framework.
--- arch/arm/include/asm/arch-s5pc1xx/gpio.h | 16 ++++++++-------- arch/arm/include/asm/arch-s5pc2xx/gpio.h | 16 ++++++++-------- board/samsung/goni/goni.c | 8 ++++---- board/samsung/smdkc100/smdkc100.c | 2 +- board/samsung/smdkv310/smdkv310.c | 8 ++++---- drivers/gpio/s5p_gpio.c | 20 ++++++++++---------- 6 files changed, 35 insertions(+), 35 deletions(-)
arch/arm/include/asm/arch-s5pc1xx/gpio.h +8 -8
@@ -126,14 +126,14 @@ struct s5pc110_gpio { };/* functions */ -void gpio_cfg_pin (struct s5p_gpio_bank *bank,int gpio,int cfg); -void gpio_direction_output (struct s5p_gpio_bank *bank,int gpio,int en); -void gpio_direction_input (struct s5p_gpio_bank *bank,int gpio); -void gpio_set_value (struct s5p_gpio_bank *bank,int gpio,int en); -unsigned int gpio_get_value (struct s5p_gpio_bank *bank,int gpio); -void gpio_set_pull (struct s5p_gpio_bank *bank,int gpio,int mode); -void gpio_set_drv (struct s5p_gpio_bank *bank,int gpio,int mode); -void gpio_set_rate (struct s5p_gpio_bank *bank,int gpio,int mode); +void s5p_gpio_cfg_pin (struct s5p_gpio_bank *bank,int gpio,int cfg); +void s5p_gpio_direction_output (struct s5p_gpio_bank *bank,int gpio,int en); +void s5p_gpio_direction_input (struct s5p_gpio_bank *bank,int gpio); +void s5p_gpio_set_value (struct s5p_gpio_bank *bank,int gpio,int en); +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);#endif /* Pin configurations */
arch/arm/include/asm/arch-s5pc2xx/gpio.h +8 -8
@@ -80,14 +80,14 @@ struct s5pc210_gpio_part3 { };/* functions */ -void gpio_cfg_pin (struct s5p_gpio_bank *bank,int gpio,int cfg); -void gpio_direction_output (struct s5p_gpio_bank *bank,int gpio,int en); -void gpio_direction_input (struct s5p_gpio_bank *bank,int gpio); -void gpio_set_value (struct s5p_gpio_bank *bank,int gpio,int en); -unsigned int gpio_get_value (struct s5p_gpio_bank *bank,int gpio); -void gpio_set_pull (struct s5p_gpio_bank *bank,int gpio,int mode); -void gpio_set_drv (struct s5p_gpio_bank *bank,int gpio,int mode); -void gpio_set_rate (struct s5p_gpio_bank *bank,int gpio,int mode); +void s5p_gpio_cfg_pin (struct s5p_gpio_bank *bank,int gpio,int cfg); +void s5p_gpio_direction_output (struct s5p_gpio_bank *bank,int gpio,int en); +void s5p_gpio_direction_input (struct s5p_gpio_bank *bank,int gpio); +void s5p_gpio_set_value (struct s5p_gpio_bank *bank,int gpio,int en); +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);#endif /* Pin configurations */
board/samsung/goni/goni.c +4 -4
@@ -73,7 +73,7 @@ int board_mmc_init(bd_t *bis)int i;/* MASSMEMORY_EN: XMSMDATA7: GPJ2[7] output high */ -gpio_direction_output (&s5pc110_gpio->j2,7 ,1 ); +s5p_gpio_direction_output (&s5pc110_gpio->j2,7 ,1 );/* * MMC0 GPIO
@@ -86,11 +86,11 @@ int board_mmc_init(bd_t *bis)if (i ==2 )continue ;/* GPG0[0:6] special function 2 */ -gpio_cfg_pin (&s5pc110_gpio->g0, i,0x2 ); +s5p_gpio_cfg_pin (&s5pc110_gpio->g0, i,0x2 );/* GPG0[0:6] pull disable */ -gpio_set_pull (&s5pc110_gpio->g0, i,GPIO_PULL_NONE ); +s5p_gpio_set_pull (&s5pc110_gpio->g0, i,GPIO_PULL_NONE );/* GPG0[0:6] drv 4x */ -gpio_set_drv (&s5pc110_gpio->g0, i,GPIO_DRV_4X ); +s5p_gpio_set_drv (&s5pc110_gpio->g0, i,GPIO_DRV_4X ); }return s5p_mmc_init (0 ,4 );
board/samsung/smdkc100/smdkc100.c +1 -1
@@ -41,7 +41,7 @@ static void smc9115_pre_init(void) (struct s5pc100_gpio *)samsung_get_base_gpio ();/* gpio configuration GPK0CON */ -gpio_cfg_pin (&gpio->k0,CONFIG_ENV_SROM_BANK ,GPIO_FUNC (2 )); +s5p_gpio_cfg_pin (&gpio->k0,CONFIG_ENV_SROM_BANK ,GPIO_FUNC (2 ));/* Ethernet needs bus width of 16 bits */ smc_bw_conf =SMC_DATA16_WIDTH (CONFIG_ENV_SROM_BANK );
board/samsung/smdkv310/smdkv310.c +4 -4
@@ -37,7 +37,7 @@ static void smc9115_pre_init(void)u32 smc_bw_conf, smc_bc_conf;/* gpio configuration GPK0CON */ -gpio_cfg_pin (&gpio2->y0,CONFIG_ENV_SROM_BANK ,GPIO_FUNC (2 )); +s5p_gpio_cfg_pin (&gpio2->y0,CONFIG_ENV_SROM_BANK ,GPIO_FUNC (2 ));/* Ethernet needs bus width of 16 bits */ smc_bw_conf =SROMC_DATA16_WIDTH (CONFIG_ENV_SROM_BANK );
@@ -116,10 +116,10 @@ int board_mmc_init(bd_t *bis)*/ for (i =0 ; i <7 ; i++) {/* GPK2[0:6] special function 2 */ -gpio_cfg_pin (&gpio2->k2, i,GPIO_FUNC (0x2 )); +s5p_gpio_cfg_pin (&gpio2->k2, i,GPIO_FUNC (0x2 ));/* GPK2[0:6] drv 4x */ -gpio_set_drv (&gpio2->k2, i,GPIO_DRV_4X ); +s5p_gpio_set_drv (&gpio2->k2, i,GPIO_DRV_4X );/* GPK2[0:1] pull disable */ if (i ==0 || i ==1 ) {
@@ -128,7 +128,7 @@ int board_mmc_init(bd_t *bis) }/* GPK2[2:6] pull up */ -gpio_set_pull (&gpio2->k2, i,GPIO_PULL_UP ); +s5p_gpio_set_pull (&gpio2->k2, i,GPIO_PULL_UP ); } err =s5p_mmc_init (2 ,4 );return err;
drivers/gpio/s5p_gpio.c +10 -10
@@ -36,7 +36,7 @@#define RATE_MASK (x) (0x1 << (x + 16))#define RATE_SET (x) (0x1 << (x + 16)) -void gpio_cfg_pin (struct s5p_gpio_bank *bank,int gpio,int cfg) +void s5p_gpio_cfg_pin (struct s5p_gpio_bank *bank,int gpio,int cfg) {unsigned int value;
@@ -46,11 +46,11 @@ void gpio_cfg_pin(struct s5p_gpio_bank *bank, int gpio, int cfg)writel (value, &bank->con); } -void gpio_direction_output (struct s5p_gpio_bank *bank,int gpio,int en) +void s5p_gpio_direction_output (struct s5p_gpio_bank *bank,int gpio,int en) {unsigned int value; -gpio_cfg_pin (bank, gpio,GPIO_OUTPUT ); +s5p_gpio_cfg_pin (bank, gpio,GPIO_OUTPUT ); value =readl (&bank->dat); value &= ~DAT_MASK (gpio);
@@ -59,12 +59,12 @@ void gpio_direction_output(struct s5p_gpio_bank *bank, int gpio, int en)writel (value, &bank->dat); } -void gpio_direction_input (struct s5p_gpio_bank *bank,int gpio) +void s5p_gpio_direction_input (struct s5p_gpio_bank *bank,int gpio) { -gpio_cfg_pin (bank, gpio,GPIO_INPUT ); +s5p_gpio_cfg_pin (bank, gpio,GPIO_INPUT ); } -void gpio_set_value (struct s5p_gpio_bank *bank,int gpio,int en) +void s5p_gpio_set_value (struct s5p_gpio_bank *bank,int gpio,int en) {unsigned int value;
@@ -75,7 +75,7 @@ void gpio_set_value(struct s5p_gpio_bank *bank, int gpio, int en)writel (value, &bank->dat); } -unsigned int gpio_get_value (struct s5p_gpio_bank *bank,int gpio) +unsigned int s5p_gpio_get_value (struct s5p_gpio_bank *bank,int gpio) {unsigned int value;
@@ -83,7 +83,7 @@ unsigned int gpio_get_value(struct s5p_gpio_bank *bank, int gpio)return !!(value &DAT_MASK (gpio)); } -void gpio_set_pull (struct s5p_gpio_bank *bank,int gpio,int mode) +void s5p_gpio_set_pull (struct s5p_gpio_bank *bank,int gpio,int mode) {unsigned int value;
@@ -102,7 +102,7 @@ void gpio_set_pull(struct s5p_gpio_bank *bank, int gpio, int mode)writel (value, &bank->pull); } -void gpio_set_drv (struct s5p_gpio_bank *bank,int gpio,int mode) +void s5p_gpio_set_drv (struct s5p_gpio_bank *bank,int gpio,int mode) {unsigned int value;
@@ -123,7 +123,7 @@ void gpio_set_drv(struct s5p_gpio_bank *bank, int gpio, int mode)writel (value, &bank->drv); } -void gpio_set_rate (struct s5p_gpio_bank *bank,int gpio,int mode) +void s5p_gpio_set_rate (struct s5p_gpio_bank *bank,int gpio,int mode) {unsigned int value;
Signature · 1 line
1.7.2.3
PATCH 1/2 gpio:s5p s5p_ suffix add for GPIO functions
Dear Lukasz Majewski,
Quoted 9 lines · Lukasz Majewski
This change is driven by need of general gpio_* functions, which as their parameter are accepting the GPIO pin number, NOT block and pin.
This makes the code alike to omap, and allows for using I2C software generic framework.
Signed-off-by Lukasz Majewski <[email protected]>Cc Minkyu Kang <[email protected]>
Quoted 8 lines
---
?arch/arm/include/asm/arch-s5pc1xx/gpio.h | ? 16 ++++++++-------- ?arch/arm/include/asm/arch-s5pc2xx/gpio.h | ? 16 ++++++++-------- ?board/samsung/goni/goni.c ? ? ? ? ? ? ? ?| ? ?8 ++++---- ?board/samsung/smdkc100/smdkc100.c ? ? ? ?| ? ?2 +- ?board/samsung/smdkv310/smdkv310.c ? ? ? ?| ? ?8 ++++---- ?drivers/gpio/s5p_gpio.c ? ? ? ? ? ? ? ? ?| ? 20 ++++++++++----------?6 files changed, 35 insertions(+), 35 deletions(-)
Please make it single patch. separate from i2c patch.
Thanks
Minkyu Kang
Signature · 2 lines
from. prom. www.promsoft.net
PATCH RESEND 1/1 gpio:samsung s5p_ suffix add for GPIO functions
In reply to Lukasz MajewskiThis change is driven by need of general gpio_* functions, which as their parameter are accepting the GPIO pin number, NOT block and pin.
This makes the code alike to omap, and allows for using more generic frameworks (e.g. software I2C).
--- arch/arm/include/asm/arch-s5pc1xx/gpio.h | 16 ++++++++-------- arch/arm/include/asm/arch-s5pc2xx/gpio.h | 16 ++++++++-------- board/samsung/goni/goni.c | 8 ++++---- board/samsung/smdkc100/smdkc100.c | 2 +- board/samsung/smdkv310/smdkv310.c | 8 ++++---- drivers/gpio/s5p_gpio.c | 20 ++++++++++---------- 6 files changed, 35 insertions(+), 35 deletions(-)
arch/arm/include/asm/arch-s5pc1xx/gpio.h +8 -8
@@ -126,14 +126,14 @@ struct s5pc110_gpio { };/* functions */ -void gpio_cfg_pin (struct s5p_gpio_bank *bank,int gpio,int cfg); -void gpio_direction_output (struct s5p_gpio_bank *bank,int gpio,int en); -void gpio_direction_input (struct s5p_gpio_bank *bank,int gpio); -void gpio_set_value (struct s5p_gpio_bank *bank,int gpio,int en); -unsigned int gpio_get_value (struct s5p_gpio_bank *bank,int gpio); -void gpio_set_pull (struct s5p_gpio_bank *bank,int gpio,int mode); -void gpio_set_drv (struct s5p_gpio_bank *bank,int gpio,int mode); -void gpio_set_rate (struct s5p_gpio_bank *bank,int gpio,int mode); +void s5p_gpio_cfg_pin (struct s5p_gpio_bank *bank,int gpio,int cfg); +void s5p_gpio_direction_output (struct s5p_gpio_bank *bank,int gpio,int en); +void s5p_gpio_direction_input (struct s5p_gpio_bank *bank,int gpio); +void s5p_gpio_set_value (struct s5p_gpio_bank *bank,int gpio,int en); +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);#endif /* Pin configurations */
arch/arm/include/asm/arch-s5pc2xx/gpio.h +8 -8
@@ -80,14 +80,14 @@ struct s5pc210_gpio_part3 { };/* functions */ -void gpio_cfg_pin (struct s5p_gpio_bank *bank,int gpio,int cfg); -void gpio_direction_output (struct s5p_gpio_bank *bank,int gpio,int en); -void gpio_direction_input (struct s5p_gpio_bank *bank,int gpio); -void gpio_set_value (struct s5p_gpio_bank *bank,int gpio,int en); -unsigned int gpio_get_value (struct s5p_gpio_bank *bank,int gpio); -void gpio_set_pull (struct s5p_gpio_bank *bank,int gpio,int mode); -void gpio_set_drv (struct s5p_gpio_bank *bank,int gpio,int mode); -void gpio_set_rate (struct s5p_gpio_bank *bank,int gpio,int mode); +void s5p_gpio_cfg_pin (struct s5p_gpio_bank *bank,int gpio,int cfg); +void s5p_gpio_direction_output (struct s5p_gpio_bank *bank,int gpio,int en); +void s5p_gpio_direction_input (struct s5p_gpio_bank *bank,int gpio); +void s5p_gpio_set_value (struct s5p_gpio_bank *bank,int gpio,int en); +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);#endif /* Pin configurations */
board/samsung/goni/goni.c +4 -4
@@ -73,7 +73,7 @@ int board_mmc_init(bd_t *bis)int i;/* MASSMEMORY_EN: XMSMDATA7: GPJ2[7] output high */ -gpio_direction_output (&s5pc110_gpio->j2,7 ,1 ); +s5p_gpio_direction_output (&s5pc110_gpio->j2,7 ,1 );/* * MMC0 GPIO
@@ -86,11 +86,11 @@ int board_mmc_init(bd_t *bis)if (i ==2 )continue ;/* GPG0[0:6] special function 2 */ -gpio_cfg_pin (&s5pc110_gpio->g0, i,0x2 ); +s5p_gpio_cfg_pin (&s5pc110_gpio->g0, i,0x2 );/* GPG0[0:6] pull disable */ -gpio_set_pull (&s5pc110_gpio->g0, i,GPIO_PULL_NONE ); +s5p_gpio_set_pull (&s5pc110_gpio->g0, i,GPIO_PULL_NONE );/* GPG0[0:6] drv 4x */ -gpio_set_drv (&s5pc110_gpio->g0, i,GPIO_DRV_4X ); +s5p_gpio_set_drv (&s5pc110_gpio->g0, i,GPIO_DRV_4X ); }return s5p_mmc_init (0 ,4 );
board/samsung/smdkc100/smdkc100.c +1 -1
@@ -41,7 +41,7 @@ static void smc9115_pre_init(void) (struct s5pc100_gpio *)samsung_get_base_gpio ();/* gpio configuration GPK0CON */ -gpio_cfg_pin (&gpio->k0,CONFIG_ENV_SROM_BANK ,GPIO_FUNC (2 )); +s5p_gpio_cfg_pin (&gpio->k0,CONFIG_ENV_SROM_BANK ,GPIO_FUNC (2 ));/* Ethernet needs bus width of 16 bits */ smc_bw_conf =SMC_DATA16_WIDTH (CONFIG_ENV_SROM_BANK );
board/samsung/smdkv310/smdkv310.c +4 -4
@@ -37,7 +37,7 @@ static void smc9115_pre_init(void)u32 smc_bw_conf, smc_bc_conf;/* gpio configuration GPK0CON */ -gpio_cfg_pin (&gpio2->y0,CONFIG_ENV_SROM_BANK ,GPIO_FUNC (2 )); +s5p_gpio_cfg_pin (&gpio2->y0,CONFIG_ENV_SROM_BANK ,GPIO_FUNC (2 ));/* Ethernet needs bus width of 16 bits */ smc_bw_conf =SROMC_DATA16_WIDTH (CONFIG_ENV_SROM_BANK );
@@ -116,10 +116,10 @@ int board_mmc_init(bd_t *bis)*/ for (i =0 ; i <7 ; i++) {/* GPK2[0:6] special function 2 */ -gpio_cfg_pin (&gpio2->k2, i,GPIO_FUNC (0x2 )); +s5p_gpio_cfg_pin (&gpio2->k2, i,GPIO_FUNC (0x2 ));/* GPK2[0:6] drv 4x */ -gpio_set_drv (&gpio2->k2, i,GPIO_DRV_4X ); +s5p_gpio_set_drv (&gpio2->k2, i,GPIO_DRV_4X );/* GPK2[0:1] pull disable */ if (i ==0 || i ==1 ) {
@@ -128,7 +128,7 @@ int board_mmc_init(bd_t *bis) }/* GPK2[2:6] pull up */ -gpio_set_pull (&gpio2->k2, i,GPIO_PULL_UP ); +s5p_gpio_set_pull (&gpio2->k2, i,GPIO_PULL_UP ); } err =s5p_mmc_init (2 ,4 );return err;
drivers/gpio/s5p_gpio.c +10 -10
@@ -36,7 +36,7 @@#define RATE_MASK (x) (0x1 << (x + 16))#define RATE_SET (x) (0x1 << (x + 16)) -void gpio_cfg_pin (struct s5p_gpio_bank *bank,int gpio,int cfg) +void s5p_gpio_cfg_pin (struct s5p_gpio_bank *bank,int gpio,int cfg) {unsigned int value;
@@ -46,11 +46,11 @@ void gpio_cfg_pin(struct s5p_gpio_bank *bank, int gpio, int cfg)writel (value, &bank->con); } -void gpio_direction_output (struct s5p_gpio_bank *bank,int gpio,int en) +void s5p_gpio_direction_output (struct s5p_gpio_bank *bank,int gpio,int en) {unsigned int value; -gpio_cfg_pin (bank, gpio,GPIO_OUTPUT ); +s5p_gpio_cfg_pin (bank, gpio,GPIO_OUTPUT ); value =readl (&bank->dat); value &= ~DAT_MASK (gpio);
@@ -59,12 +59,12 @@ void gpio_direction_output(struct s5p_gpio_bank *bank, int gpio, int en)writel (value, &bank->dat); } -void gpio_direction_input (struct s5p_gpio_bank *bank,int gpio) +void s5p_gpio_direction_input (struct s5p_gpio_bank *bank,int gpio) { -gpio_cfg_pin (bank, gpio,GPIO_INPUT ); +s5p_gpio_cfg_pin (bank, gpio,GPIO_INPUT ); } -void gpio_set_value (struct s5p_gpio_bank *bank,int gpio,int en) +void s5p_gpio_set_value (struct s5p_gpio_bank *bank,int gpio,int en) {unsigned int value;
@@ -75,7 +75,7 @@ void gpio_set_value(struct s5p_gpio_bank *bank, int gpio, int en)writel (value, &bank->dat); } -unsigned int gpio_get_value (struct s5p_gpio_bank *bank,int gpio) +unsigned int s5p_gpio_get_value (struct s5p_gpio_bank *bank,int gpio) {unsigned int value;
@@ -83,7 +83,7 @@ unsigned int gpio_get_value(struct s5p_gpio_bank *bank, int gpio)return !!(value &DAT_MASK (gpio)); } -void gpio_set_pull (struct s5p_gpio_bank *bank,int gpio,int mode) +void s5p_gpio_set_pull (struct s5p_gpio_bank *bank,int gpio,int mode) {unsigned int value;
@@ -102,7 +102,7 @@ void gpio_set_pull(struct s5p_gpio_bank *bank, int gpio, int mode)writel (value, &bank->pull); } -void gpio_set_drv (struct s5p_gpio_bank *bank,int gpio,int mode) +void s5p_gpio_set_drv (struct s5p_gpio_bank *bank,int gpio,int mode) {unsigned int value;
@@ -123,7 +123,7 @@ void gpio_set_drv(struct s5p_gpio_bank *bank, int gpio, int mode)writel (value, &bank->drv); } -void gpio_set_rate (struct s5p_gpio_bank *bank,int gpio,int mode) +void s5p_gpio_set_rate (struct s5p_gpio_bank *bank,int gpio,int mode) {unsigned int value;
Signature · 1 line
1.7.2.3
PATCH RESEND 1/1 gpio:samsung s5p_ suffix add for GPIO functions
Quoted 3 lines · Lukasz Majewski
This change is driven by need of general gpio_* functions, which as their parameter are accepting the GPIO pin number, NOT block and pin.
-mike
PATCH RESEND 1/1 gpio:samsung s5p_ suffix add for GPIO functions
Dear Lukasz Majewski,
Quoted 7 lines · Mike Frysinger
Quoted 3 lines · Lukasz Majewski
This change is driven by need of general gpio_* functions, which as their parameter are accepting the GPIO pin number, NOT block and pin.
Acked-by Mike Frysinger <[email protected]>-mike
applied to u-boot-samsung
Thanks
Minkyu Kang
Signature · 2 lines
from. prom. www.promsoft.net
PATCH 1/1 gpio:samsung: s5p_ suffix add for GPIO functions (C210_universal)
In reply to Lukasz MajewskiThis is a cosmetic patch, which is changing the gpio_ prefix to s5p_gpio_.
--- board/samsung/universal_c210/universal.c | 28 ++++++++++++++-------------- 1 files changed, 14 insertions(+), 14 deletions(-)
board/samsung/universal_c210/universal.c +14 -14
@@ -160,7 +160,7 @@ int board_mmc_init(bd_t *bis)* you should set it HIGH since it removes the inverter */ /* MASSMEMORY_EN: XMDMDATA_6: GPE3[6] */ -gpio_direction_output (&gpio1->e3,6 ,0 ); +s5p_gpio_direction_output (&gpio1->e3,6 ,0 );break ;default :/*
@@ -168,7 +168,7 @@ int board_mmc_init(bd_t *bis)* But set it as HIGH to ensure */ /* MASSMEMORY_EN: XMDMADDR_3: GPE1[3] */ -gpio_direction_output (&gpio1->e1,3 ,1 ); +s5p_gpio_direction_output (&gpio1->e1,3 ,1 );break ; }
@@ -192,25 +192,25 @@ int board_mmc_init(bd_t *bis)if (i ==2 )continue ;/* GPK0[0:6] special function 2 */ -gpio_cfg_pin (&gpio2->k0, i,0x2 ); +s5p_gpio_cfg_pin (&gpio2->k0, i,0x2 );/* GPK0[0:6] pull disable */ -gpio_set_pull (&gpio2->k0, i,GPIO_PULL_NONE ); +s5p_gpio_set_pull (&gpio2->k0, i,GPIO_PULL_NONE );/* GPK0[0:6] drv 4x */ -gpio_set_drv (&gpio2->k0, i,GPIO_DRV_4X ); +s5p_gpio_set_drv (&gpio2->k0, i,GPIO_DRV_4X ); }for (i =3 ; i <7 ; i++) {/* GPK1[3:6] special function 3 */ -gpio_cfg_pin (&gpio2->k1, i,0x3 ); +s5p_gpio_cfg_pin (&gpio2->k1, i,0x3 );/* GPK1[3:6] pull disable */ -gpio_set_pull (&gpio2->k1, i,GPIO_PULL_NONE ); +s5p_gpio_set_pull (&gpio2->k1, i,GPIO_PULL_NONE );/* GPK1[3:6] drv 4x */ -gpio_set_drv (&gpio2->k1, i,GPIO_DRV_4X ); +s5p_gpio_set_drv (&gpio2->k1, i,GPIO_DRV_4X ); }/* T-flash detect */ -gpio_cfg_pin (&gpio2->x3,4 ,0xf ); -gpio_set_pull (&gpio2->x3,4 ,GPIO_PULL_UP ); +s5p_gpio_cfg_pin (&gpio2->x3,4 ,0xf ); +s5p_gpio_set_pull (&gpio2->x3,4 ,GPIO_PULL_UP );/* * MMC device init
@@ -223,7 +223,7 @@ int board_mmc_init(bd_t *bis)* Check the T-flash detect pin * GPX3[4] T-flash detect pin */ -if (!gpio_get_value (&gpio2->x3,4 )) { +if (!s5p_gpio_get_value (&gpio2->x3,4 )) {/* * SD card GPIO: * GPK2[0] SD_2_CLK(2)
@@ -235,11 +235,11 @@ int board_mmc_init(bd_t *bis)if (i ==2 )continue ;/* GPK2[0:6] special function 2 */ -gpio_cfg_pin (&gpio2->k2, i,0x2 ); +s5p_gpio_cfg_pin (&gpio2->k2, i,0x2 );/* GPK2[0:6] pull disable */ -gpio_set_pull (&gpio2->k2, i,GPIO_PULL_NONE ); +s5p_gpio_set_pull (&gpio2->k2, i,GPIO_PULL_NONE );/* GPK2[0:6] drv 4x */ -gpio_set_drv (&gpio2->k2, i,GPIO_DRV_4X ); +s5p_gpio_set_drv (&gpio2->k2, i,GPIO_DRV_4X ); } err =s5p_mmc_init (2 ,4 ); }
Signature · 1 line
1.7.2.3
PATCH 1/1 gpio:samsung: s5p_ suffix add for GPIO functions (C210_universal)
Dear Lukasz,
Quoted 9 lines · Lukasz Majewski
This is a cosmetic patch, which is changing the
gpio_prefix tos5p_gpio_.Signed-off-by Lukasz Majewski <[email protected]>Signed-off-by Kyungmin Park <[email protected]>Cc Minkyu Kang <[email protected]>---
?board/samsung/universal_c210/universal.c | ? 28 ++++++++++++++-------------- ?1 files changed, 14 insertions(+), 14 deletions(-)
applied to u-boot-samsung
Thanks
Minkyu Kang
Signature · 2 lines
from. prom. www.promsoft.net
PATCH 2/2 i2c:gpio:s5p: I2C GPIO Software implementation (via soft_i2c)
In reply to Lukasz Majewski--- arch/arm/include/asm/arch-s5pc1xx/gpio.h | 2 + board/samsung/goni/goni.c | 55 +++++++++++++++++++++++++++++- include/configs/s5p_goni.h | 13 +++++++ 3 files changed, 69 insertions(+), 1 deletions(-)
arch/arm/include/asm/arch-s5pc1xx/gpio.h +2 -0
@@ -155,4 +155,6 @@ void s5p_gpio_set_rate(struct s5p_gpio_bank *bank, int gpio, int mode);#define GPIO_DRV_FAST 0x0#define GPIO_DRV_SLOW 0x1 +/* GPIO pins per bank */ +#define GPIO_PER_BANK 8#endif
board/samsung/goni/goni.c +54 -1
64 lines not on this page · raw message
include/configs/s5p_goni.h +13 -0
@@ -224,4 +224,17 @@#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_LOAD_ADDR - 0x1000000) +#include <asm/arch/gpio.h> +/* +* I2C Settings +*/ +#define S5PC110_GPIO_J3 (S5PC110_GPIO_BASE + 0x2C0) +#define CONFIG_SOFT_I2C_GPIO_SCL s5p_gpio_get_nr(S5PC110_GPIO_J3, 3) +#define CONFIG_SOFT_I2C_GPIO_SDA s5p_gpio_get_nr(S5PC110_GPIO_J3, 0) + +#define CONFIG_SOFT_I2C 1 +#define CONFIG_SYS_I2C_INIT_BOARD +#define CONFIG_SYS_I2C_SPEED 50000 +#define CONFIG_I2C_MULTI_BUS +#define CONFIG_SYS_MAX_I2C_BUS 7#endif /* __CONFIG_H */
Signature · 1 line
1.7.2.3
PATCH 2/2 i2c:gpio:s5p: I2C GPIO Software implementation (via soft_i2c)
Dear Lukasz Majewski,
Quoted 7 lines · Lukasz Majewski
Signed-off-by Lukasz Majewski <[email protected]>Cc Minkyu Kang <[email protected]>---
?arch/arm/include/asm/arch-s5pc1xx/gpio.h | ? ?2 + ?board/samsung/goni/goni.c ? ? ? ? ? ? ? ?| ? 55 +++++++++++++++++++++++++++++- ?include/configs/s5p_goni.h ? ? ? ? ? ? ? | ? 13 +++++++?3 files changed, 69 insertions(+), 1 deletions(-)
You missing commit message.
Quoted 30 lines
arch/arm/include/asm/arch-s5pc1xx/gpio.h +0
-0@@ -155,4 +155,6 @@ void s5p_gpio_set_rate(struct s5p_gpio_bank *bank, int gpio, int mode);?#define
GPIO_DRV_FAST?0x0
?#defineGPIO_DRV_SLOW?0x1arch/arm/include/asm/arch-s5pc1xx/gpio.h +2
-0+/* GPIO pins per bank ?*/ +#define GPIO_PER_BANK 8?#endif
board/samsung/goni/goni.c +0
-0@@ -1,7 +1,8 @@?/*
- * ?Copyright (C) 2008-2009 Samsung Electronics
+ * ?Copyright (C) 2008-2011 Samsung Electronics
?* ?Minkyu Kang <[email protected]>
?* ?Kyungmin Park <[email protected]>
+ * ?Lukasz Majewski <[email protected]>
?*
?* See file CREDITS for list of people who contributed to this ?* project.board/samsung/goni/goni.c +0
-0@@ -96,3 +97,55 @@ int board_mmc_init(bd_t *bis) ? ? ? ?return s5p_mmc_init(0, 4); ?}?#endif
board/samsung/goni/goni.c int board_mmc_init(bd_t *bis) · line 103
Quoted 4 lines
board/samsung/goni/goni.c +4
-0+ +#ifdef CONFIG_SOFT_I2C + +enum {I2C_PMIC ,I2C_NUM , };
What purpose of these enum? Where these used?
Quoted 38 lines
board/samsung/goni/goni.c +38
-0+ +void i2c_init_board (void ) {} + +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); +} + +inline int s5p_gpio_get_pin (int nr) +{ + ? ? ? return nr % GPIO_PER_BANK; +} + +inline int gpio_direction_input (int nr) +{ + ? ? ? s5p_gpio_direction_input(s5p_gpio_get_bank(nr), + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?s5p_gpio_get_pin(nr)); +} + +inline int gpio_direction_output (int nr,int value) +{ + ? ? ? s5p_gpio_direction_output(s5p_gpio_get_bank(nr), + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? s5p_gpio_get_pin(nr), value); +} + +inline int gpio_get_value (int nr) +{
board/samsung/goni/goni.c int board_mmc_init(bd_t *bis) · line 151
Quoted 10 lines
board/samsung/goni/goni.c +10
-0+ ? ? ? return (int) s5p_gpio_get_value(s5p_gpio_get_bank(nr), + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? s5p_gpio_get_pin(nr)); +} + +inline void gpio_set_value (int nr,int value) +{ + ? ? ? s5p_gpio_set_value(s5p_gpio_get_bank(nr), + ? ? ? ? ? ? ? ? ? ? ? ? ?s5p_gpio_get_pin(nr), value); +} +#endif
I think It's not a board specific. Please make common file for I2C gpio for s5p.
Quoted 5 lines
include/configs/s5p_goni.h +0
-0
include/configs/s5p_goni.h line 233
Quoted 10 lines
include/configs/s5p_goni.h +7
-0@@ -224,4 +224,17 @@ ?#define CONFIG_SYS_INIT_SP_ADDR ? ? ? ?(CONFIG_SYS_LOAD_ADDR - 0x1000000) +#include <asm/arch/gpio.h> +/* +* I2C Settings +*/ +#define S5PC110_GPIO_J3 ? ? ? ?(S5PC110_GPIO_BASE + 0x2C0) +#define CONFIG_SOFT_I2C_GPIO_SCL s5p_gpio_get_nr(S5PC110_GPIO_J3, 3) +#define CONFIG_SOFT_I2C_GPIO_SDA s5p_gpio_get_nr(S5PC110_GPIO_J3, 0)
I have one question.
How we can handle multiple bus?
I mean.. how we can change SCL and SDA?
Quoted 9 lines
include/configs/s5p_goni.h +6
-0+ +#define CONFIG_SOFT_I2C ? ? ? ? ? ? ? ?1 +#define CONFIG_SYS_I2C_INIT_BOARD +#define CONFIG_SYS_I2C_SPEED ? 50000 +#define CONFIG_I2C_MULTI_BUS +#define CONFIG_SYS_MAX_I2C_BUS 7?#endif /*
__CONFIG_H*/
--
1.7.2.3
Thanks
Minkyu Kang
Signature · 2 lines
from. prom. www.promsoft.net
PATCH 2/2 i2c:gpio:s5p: I2C GPIO Software implementation (via soft_i2c)
Hi Minkyu,
Quoted 7 lines
board/samsung/goni/goni.c int board_mmc_init(bd_t *bis) · line 103
Quoted 4 lines
board/samsung/goni/goni.c +4
-0+ +#ifdef CONFIG_SOFT_I2C + +enum {I2C_PMIC ,I2C_NUM , };What purpose of these enum?
Where these used?
For now goni reference target is going to use only one I2C bus (implemented as soft_i2c GPIO). Therefore this enum will be erased for v2. In the future, however this might be needed.
Quoted 8 lines
Quoted 4 lines
(quoted diff) +2
-0+#define S5PC110_GPIO_J3 ? ? ? ?(S5PC110_GPIO_BASE + 0x2C0) +#define CONFIG_SOFT_I2C_GPIO_SCL s5p_gpio_get_nr(S5PC110_GPIO_J3,3) +#define
CONFIG_SOFT_I2C_GPIO_SDAs5p_gpio_get_nr(S5PC110_GPIO_J3, 0)I have one question.
How we can handle multiple bus?
I mean.. how we can change SCL and SDA?
I've asked this question to Heiko Schocher already. Please refer to this reply:
http://lists.denx.de/pipermail/u-boot/2011-July/095610.html
Signature · 6 lines
Best regards, Lukasz Majewski Samsung Poland R&D Center Platform Group
PATCH v2 1/1 i2c:gpio:s5p: I2C GPIO Software implementation (via soft_i2c)
In reply to Lukasz MajewskiThis 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.
---
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(-)
arch/arm/include/asm/arch-s5pc1xx/gpio.h +36 -0
@@ -134,6 +134,40 @@ 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); +struct s5p_gpio_bank *s5p_gpio_get_bank (int nr); +int s5p_gpio_get_pin (int nr); + +static inline int gpio_request (int gpio,const char *label) +{ +return 0 ; +} + +static inline int gpio_direction_input (int nr) +{ +s5p_gpio_direction_input (s5p_gpio_get_bank (nr), +s5p_gpio_get_pin (nr)); +return 0 ; +} + +static inline int gpio_direction_output (int nr,int value) +{ +s5p_gpio_direction_output (s5p_gpio_get_bank (nr), +s5p_gpio_get_pin (nr), value); +return 0 ; +} + +static inline int gpio_get_value (int nr) +{ +return (int )s5p_gpio_get_value (s5p_gpio_get_bank (nr), +s5p_gpio_get_pin (nr)); +} + +static inline void gpio_set_value (int nr,int value) +{ +s5p_gpio_set_value (s5p_gpio_get_bank (nr), +s5p_gpio_get_pin (nr), value); +} +#endif /* Pin configurations */
@@ -155,4 +189,6 @@ void s5p_gpio_set_rate(struct s5p_gpio_bank *bank, int gpio, int mode);#define GPIO_DRV_FAST 0x0#define GPIO_DRV_SLOW 0x1 +/* GPIO pins per bank */ +#define GPIO_PER_BANK 8#endif
board/samsung/goni/goni.c +28 -2
@@ -1,7 +1,8 @@/* -* Copyright (C) 2008-2009 Samsung Electronics +* Copyright (C) 2008-2011 Samsung Electronics * Minkyu Kang <[email protected]> * Kyungmin Park <[email protected]> +* Lukasz Majewski <[email protected]> * * 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;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
include/configs/s5p_goni.h +13 -0
@@ -224,4 +224,17 @@#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_LOAD_ADDR - 0x1000000) +#include <asm/arch/gpio.h> +/* +* I2C Settings +*/ +#define S5PC110_GPIO_J3 (S5PC110_GPIO_BASE + 0x2C0) +#define CONFIG_SOFT_I2C_GPIO_SCL s5p_gpio_get_nr(S5PC110_GPIO_J3, 3) +#define CONFIG_SOFT_I2C_GPIO_SDA s5p_gpio_get_nr(S5PC110_GPIO_J3, 0) + +#define CONFIG_SOFT_I2C 1 +#define CONFIG_SYS_I2C_SPEED 50000 +#define CONFIG_I2C_MULTI_BUS +#define CONFIG_SYS_MAX_I2C_BUS 7 +#endif /* __CONFIG_H */
Signature · 1 line
1.7.2.3
PATCH v2 1/1 i2c:gpio:s5p: I2C GPIO Software implementation (via soft_i2c)
Dear Lukasz Majewski,
arch/arm/include/asm/arch-s5pc1xx/gpio.h
Quoted 24 lines · Lukasz Majewski
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 <[email protected]>Signed-off-by Kyungmin Park <[email protected]>Cc Minkyu Kang <[email protected]>Cc Heiko Schocher <[email protected]>---
Changes for v2:
? ? ? ?- Generic GPIO code added toarch/arm/gpio.h
? ? ? ?- Platform dependent GPIO code added toboard/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(-)
arch/arm/include/asm/arch-s5pc1xx/gpio.h +0
-0
please add s5pc2xx also.
Quoted 15 lines
board/samsung/goni/goni.c +0
-0@@ -1,7 +1,8 @@?/*
- * ?Copyright (C) 2008-2009 Samsung Electronics
+ * ?Copyright (C) 2008-2011 Samsung Electronics
?* ?Minkyu Kang <[email protected]>
?* ?Kyungmin Park <[email protected]>
+ * ?Lukasz Majewski <[email protected]>
?*
?* See file CREDITS for list of people who contributed to this ?* project.
board/samsung/goni/goni.c line 32
Quoted 5 lines
board/samsung/goni/goni.c +1
-1@@ -28,7 +29,7 @@ ?DECLARE_GLOBAL_DATA_PTR; -static struct s5pc110_gpio *s5pc110_gpio; +struct s5pc110_gpio *s5pc110_gpio;
Why?
Quoted 22 lines
board/samsung/goni/goni.c +0
-0?int board_init(void) ?{@@ -96,3 +97,28 @@ int board_mmc_init(bd_t *bis) ? ? ? ?return s5p_mmc_init(0, 4); ?}?#endif
board/samsung/goni/goni.c +15
-0+ +#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;
board/samsung/goni/goni.c int board_mmc_init(bd_t *bis) · line 124
Quoted 10 lines
board/samsung/goni/goni.c +10
-0+ ? ? ? 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
Signature · 2 lines
from. prom. www.promsoft.net
PATCH v3 1/1 i2c:gpio:s5p: I2C GPIO Software implementation (via soft_i2c)
In reply to Lukasz MajewskiThis 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.
---
Changes for v2:
- Generic GPIO code added to arch/arm/gpio.h
- Platform dependent GPIO code added to board/samsung/goni.c
- Code cleanup
Changes for v3:
- I2C GPIO common code added to drivers/gpio/s5p_gpio.c
- i2c_init_board() function added(required by soft_i2c)
--- arch/arm/include/asm/arch-s5pc1xx/gpio.h | 38 ++++++++++++++++++++++++++++++ board/samsung/goni/goni.c | 16 ++++++++---- drivers/gpio/s5p_gpio.c | 24 +++++++++++++++++++ include/configs/s5p_goni.h | 14 +++++++++++ 4 files changed, 86 insertions(+), 6 deletions(-)
arch/arm/include/asm/arch-s5pc1xx/gpio.h +38 -0
@@ -134,6 +134,41 @@ 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); +struct s5p_gpio_bank *s5p_gpio_get_bank (int nr); +int s5p_gpio_get_pin (int nr); + +static inline int gpio_request (int gpio,const char *label) +{ +return 0 ; +} + +static inline int gpio_direction_input (int nr) +{ +s5p_gpio_direction_input (s5p_gpio_get_bank (nr), +s5p_gpio_get_pin (nr)); +return 0 ; +} + +static inline int gpio_direction_output (int nr,int value) +{ +s5p_gpio_direction_output (s5p_gpio_get_bank (nr), +s5p_gpio_get_pin (nr), value); +return 0 ; +} + +static inline int gpio_get_value (int nr) +{ +return (int )s5p_gpio_get_value (s5p_gpio_get_bank (nr), +s5p_gpio_get_pin (nr)); +} + +static inline void gpio_set_value (int nr,int value) +{ +s5p_gpio_set_value (s5p_gpio_get_bank (nr), +s5p_gpio_get_pin (nr), value); +} + +extern struct s5pc110_gpio *s5p_gpio;#endif /* Pin configurations */
@@ -155,4 +190,7 @@ void s5p_gpio_set_rate(struct s5p_gpio_bank *bank, int gpio, int mode);#define GPIO_DRV_FAST 0x0#define GPIO_DRV_SLOW 0x1 +/* GPIO pins per bank */ +#define GPIO_PER_BANK 8 +#endif
board/samsung/goni/goni.c +10 -6
@@ -28,12 +28,12 @@DECLARE_GLOBAL_DATA_PTR ; -static struct s5pc110_gpio *s5pc110_gpio; +struct s5pc110_gpio *s5p_gpio;int board_init (void ) {/* Set Initial global variables */ - s5pc110_gpio = (struct s5pc110_gpio *)S5PC110_GPIO_BASE ; + s5p_gpio = (struct s5pc110_gpio *)S5PC110_GPIO_BASE ; gd->bd->bi_arch_number =MACH_TYPE_GONI ; gd->bd->bi_boot_params =PHYS_SDRAM_1 +0x100 ;
@@ -67,13 +67,17 @@ int checkboard(void) }#endif +#ifdef CONFIG_SOFT_I2C +void i2c_init_board (void ) {} +#endif +#ifdef CONFIG_GENERIC_MMC int board_mmc_init (bd_t *bis) {int i;/* MASSMEMORY_EN: XMSMDATA7: GPJ2[7] output high */ -s5p_gpio_direction_output (&s5pc110_gpio->j2,7 ,1 ); +s5p_gpio_direction_output (&s5p_gpio->j2,7 ,1 );/* * MMC0 GPIO
@@ -86,11 +90,11 @@ int board_mmc_init(bd_t *bis)if (i ==2 )continue ;/* GPG0[0:6] special function 2 */ -s5p_gpio_cfg_pin (&s5pc110_gpio->g0, i,0x2 ); +s5p_gpio_cfg_pin (&s5p_gpio->g0, i,0x2 );/* GPG0[0:6] pull disable */ -s5p_gpio_set_pull (&s5pc110_gpio->g0, i,GPIO_PULL_NONE ); +s5p_gpio_set_pull (&s5p_gpio->g0, i,GPIO_PULL_NONE );/* GPG0[0:6] drv 4x */ -s5p_gpio_set_drv (&s5pc110_gpio->g0, i,GPIO_DRV_4X ); +s5p_gpio_set_drv (&s5p_gpio->g0, i,GPIO_DRV_4X ); }return s5p_mmc_init (0 ,4 );
drivers/gpio/s5p_gpio.c +24 -0
@@ -141,3 +141,27 @@ void s5p_gpio_set_rate(struct s5p_gpio_bank *bank, int gpio, int mode)writel (value, &bank->drv); } + +#ifdef CONFIG_SOFT_I2C +/* Platform dependent functions for extracting GPIO number */ +int s5p_gpio_get_nr (void *gp_ptr,int gpio) +{ +unsigned int offset = gp_ptr - (void *) s5p_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 *) s5p_gpio + bank); +} + +int s5p_gpio_get_pin (int nr) +{ +return nr %GPIO_PER_BANK ; +} +#endif
include/configs/s5p_goni.h +14 -0
@@ -223,4 +223,18 @@#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_LOAD_ADDR - 0x1000000) +#include <asm/arch/gpio.h> +/* +* I2C Settings +*/ +#define S5PC110_GPIO_J3 (S5PC110_GPIO_BASE + 0x2C0) +#define CONFIG_SOFT_I2C_GPIO_SCL s5p_gpio_get_nr(S5PC110_GPIO_J3, 3) +#define CONFIG_SOFT_I2C_GPIO_SDA s5p_gpio_get_nr(S5PC110_GPIO_J3, 0) + +#define CONFIG_SOFT_I2C 1 +#define CONFIG_SYS_I2C_SPEED 50000 +#define CONFIG_SYS_I2C_INIT_BOARD +#define CONFIG_I2C_MULTI_BUS +#define CONFIG_SYS_MAX_I2C_BUS 7 +#endif /* __CONFIG_H */
Signature · 1 line
1.7.2.3
PATCH v3 1/1 i2c:gpio:s5p: I2C GPIO Software implementation (via soft_i2c)
Dear Lukasz Majewski,
Quoted 9 lines · Lukasz Majewski
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 <[email protected]>Signed-off-by Kyungmin Park <[email protected]>Cc Minkyu Kang <[email protected]>Cc Heiko Schocher <[email protected]>
Quoted 10 lines
---
Changes for v2:
? ? ? ?- Generic GPIO code added toarch/arm/gpio.h
? ? ? ?- Platform dependent GPIO code added toboard/samsung/goni.c? ? ? ?- Code cleanup
Changes for v3:
? ? ? ?- I2C GPIO common code added todrivers/gpio/s5p_gpio.c
? ? ? ?-i2c_init_board()functionadded(required by soft_i2c)
---
?arch/arm/include/asm/arch-s5pc1xx/gpio.h | ? 38 ++++++++++++++++++++++++++++++
Please adds s5pc2xx also.
Quoted 64 lines
?board/samsung/goni/goni.c ? ? ? ? ? ? ? ?| ? 16 ++++++++---- ?drivers/gpio/s5p_gpio.c ? ? ? ? ? ? ? ? ?| ? 24 +++++++++++++++++++ ?include/configs/s5p_goni.h ? ? ? ? ? ? ? | ? 14 +++++++++++?4 files changed, 86 insertions(+), 6 deletions(-)
arch/arm/include/asm/arch-s5pc1xx/gpio.h +35
-0@@ -134,6 +134,41 @@ 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); +struct s5p_gpio_bank *s5p_gpio_get_bank (int nr); +int s5p_gpio_get_pin (int nr); + +static inline int gpio_request (int gpio,const char *label) +{ + ? ? ? return 0; +} + +static inline int gpio_direction_input (int nr) +{ + ? ? ? s5p_gpio_direction_input(s5p_gpio_get_bank(nr), + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? s5p_gpio_get_pin(nr)); + ? ? ? return 0; +} + +static inline int gpio_direction_output (int nr,int value) +{ + ? ? ? s5p_gpio_direction_output(s5p_gpio_get_bank(nr), + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?s5p_gpio_get_pin(nr), value); + ? ? ? return 0; +} + +static inline int gpio_get_value (int nr) +{ + ? ? ? return (int) s5p_gpio_get_value(s5p_gpio_get_bank(nr), + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?s5p_gpio_get_pin(nr)); +} + +static inline void gpio_set_value (int nr,int value) +{ + ? ? ? s5p_gpio_set_value(s5p_gpio_get_bank(nr), + ? ? ? ? ? ? ? ? ? ? ? ? s5p_gpio_get_pin(nr), value); +} + +extern struct s5pc110_gpio *s5p_gpio;?#endif
?/* Pin configurations */
arch/arm/include/asm/arch-s5pc1xx/gpio.h +0
-0@@ -155,4 +190,7 @@ void s5p_gpio_set_rate(struct s5p_gpio_bank *bank, int gpio, int mode);?#define
GPIO_DRV_FAST?0x0
?#defineGPIO_DRV_SLOW?0x1arch/arm/include/asm/arch-s5pc1xx/gpio.h +3
-0+/* GPIO pins per bank ?*/ +#define GPIO_PER_BANK 8 +?#endif
board/samsung/goni/goni.c +0
-0
board/samsung/goni/goni.c line 31
Quoted 5 lines
board/samsung/goni/goni.c +1
-1@@ -28,12 +28,12 @@ ?DECLARE_GLOBAL_DATA_PTR; -static struct s5pc110_gpio *s5pc110_gpio; +struct s5pc110_gpio *s5p_gpio;
Why you removed the "static"?
And.. why you change s5pc110_gpio to s5p_gpio? It is unrelated changes with this patch.
Quoted 13 lines
board/samsung/goni/goni.c +0
-0?int board_init(void) ?{? ? ? ?/* Set Initial global variables */
- ? ? ?s5pc110_gpio= (structs5pc110_gpio*)S5PC110_GPIO_BASE;
+ ? ? ?s5p_gpio= (structs5pc110_gpio*)S5PC110_GPIO_BASE;? ? ? ?gd->bd->bi_arch_number =
MACH_TYPE_GONI; ? ? ? ?gd->bd->bi_boot_params =PHYS_SDRAM_1+0x100;board/samsung/goni/goni.c +0
-0@@ -67,13 +67,17 @@ int checkboard(void) ?}?#endif
board/samsung/goni/goni.c int checkboard(void) · line 72
Quoted 3 lines
board/samsung/goni/goni.c +3
-0+#ifdef CONFIG_SOFT_I2C +void i2c_init_board (void ) {} +#endif
Empty function?
then please undef CONFIG_SYS_I2C_INIT_BOARD.
Quoted 9 lines
+
?#ifdefCONFIG_GENERIC_MMC
?intboard_mmc_init(bd_t *bis)
?{
? ? ? ?int i;? ? ? ?/*
MASSMEMORY_EN: XMSMDATA7: GPJ2[7] output high */
- ? ? ?s5p_gpio_direction_output(&s5pc110_gpio->j2, 7, 1);
+ ? ? ?s5p_gpio_direction_output(&s5p_gpio->j2, 7, 1);
unrelated change.
Quoted 9 lines
? ? ? ?/*
? ? ? ? * MMC0 GPIOboard/samsung/goni/goni.c +0
-0@@ -86,11 +90,11 @@ int board_mmc_init(bd_t *bis) ? ? ? ? ? ? ? ?if (i == 2) ? ? ? ? ? ? ? ? ? ? ? ?continue;? ? ? ? ? ? ? ?/* GPG0[0:6] special function 2 */
- ? ? ? ? ? ? ?s5p_gpio_cfg_pin(&s5pc110_gpio->g0, i, 0x2);
+ ? ? ? ? ? ? ?s5p_gpio_cfg_pin(&s5p_gpio->g0, i, 0x2);
ditto.
Quoted 3 lines
? ? ? ? ? ? ? ?/* GPG0[0:6] pull disable */
- ? ? ? ? ? ? ?s5p_gpio_set_pull(&s5pc110_gpio->g0, i, GPIO_PULL_NONE);
+ ? ? ? ? ? ? ?s5p_gpio_set_pull(&s5p_gpio->g0, i, GPIO_PULL_NONE);
ditto.
Quoted 3 lines
? ? ? ? ? ? ? ?/* GPG0[0:6] drv 4x */
- ? ? ? ? ? ? ?s5p_gpio_set_drv(&s5pc110_gpio->g0, i, GPIO_DRV_4X);
+ ? ? ? ? ? ? ?s5p_gpio_set_drv(&s5p_gpio->g0, i, GPIO_DRV_4X);
ditto.
drivers/gpio/s5p_gpio.c void s5p_gpio_set_rate(struct s5p_gpio_bank *bank, int gpio, int mode) · line 145
Quoted 13 lines
? ? ? ?}
? ? ? ?return
s5p_mmc_init(0, 4);drivers/gpio/s5p_gpio.c +2
-0@@ -141,3 +141,27 @@ void s5p_gpio_set_rate(struct s5p_gpio_bank *bank, int gpio, int mode) ? ? ? ?writel(value, &bank->drv); ?} + +#ifdef CONFIG_SOFT_I2C
I think, we don't have to use ifdef here. These are looks common functions of GPIO.
Quoted 44 lines
drivers/gpio/s5p_gpio.c +22
-0+/* Platform dependent functions for extracting GPIO number */ +int s5p_gpio_get_nr (void *gp_ptr,int gpio) +{ + ? ? ? unsigned int offset = gp_ptr - (void *) s5p_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 *) s5p_gpio + bank); +} + +int s5p_gpio_get_pin (int nr) +{ + ? ? ? return nr % GPIO_PER_BANK; +} +#endif include/configs/s5p_goni.h +14
-0@@ -223,4 +223,18 @@ ?#define CONFIG_SYS_INIT_SP_ADDR ? ? ? ?(CONFIG_SYS_LOAD_ADDR - 0x1000000) +#include <asm/arch/gpio.h> +/* +* I2C Settings +*/ +#define S5PC110_GPIO_J3 ? ? ? ? ?(S5PC110_GPIO_BASE + 0x2C0) +#define CONFIG_SOFT_I2C_GPIO_SCL s5p_gpio_get_nr(S5PC110_GPIO_J3, 3) +#define CONFIG_SOFT_I2C_GPIO_SDA s5p_gpio_get_nr(S5PC110_GPIO_J3, 0) + +#define CONFIG_SOFT_I2C ? ? ? ?1 +#define CONFIG_SYS_I2C_SPEED ? 50000 +#define CONFIG_SYS_I2C_INIT_BOARD +#define CONFIG_I2C_MULTI_BUS +#define CONFIG_SYS_MAX_I2C_BUS 7 +
Quoted 1 line
?#endif /*
__CONFIG_H*/
I think, you can divide into 2 patches. One is for GPIO.
Another is for enabling soft i2c.
Thanks
Minkyu Kang
Signature · 2 lines
from. prom. www.promsoft.net
cover i2c:gpio:s5p: I2C GPIO SW implementation (via soft_i2c)
In reply to Lukasz MajewskiThis patches adds support for I2C GPIO S5PC1xx and S5PC2xx targets. Moreover the I2C GPIO on the S5PC110 GONI reference target is enabled.
Lukasz Majewski (2):
i2c:gpio:s5p: I2C GPIO Software implementation (via soft_i2c) i2c:gpio:s5p: Enable I2C GPIO on the GONI target
arch/arm/include/asm/arch-s5pc1xx/gpio.h | 38 +++++++++++++++++++++++++++++ arch/arm/include/asm/arch-s5pc2xx/gpio.h | 39 ++++++++++++++++++++++++++++++ board/samsung/goni/goni.c | 2 + board/samsung/universal_c210/universal.c | 2 + drivers/gpio/s5p_gpio.c | 21 ++++++++++++++++ include/configs/s5p_goni.h | 13 ++++++++++ 6 files changed, 115 insertions(+), 0 deletions(-)
Signature · 1 line
1.7.2.3
PATCH v4 1/2 i2c:gpio:s5p: I2C GPIO Software implementation (via soft_i2c)
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.
---
Changes for v2:
- Generic GPIO code added to arch/arm/gpio.h
- Platform dependent GPIO code added to board/samsung/goni.c
- Code cleanup
Changes for v3:
- I2C GPIO common code added to drivers/gpio/s5p_gpio.c
- i2c_init_board() function added(required by soft_i2c)
Changes for v4:
- i2x_init_board() removed
- s5pc210 support added
- GPIO code and I2C enable code split to separate patches
--- arch/arm/include/asm/arch-s5pc1xx/gpio.h | 38 +++++++++++++++++++++++++++++ arch/arm/include/asm/arch-s5pc2xx/gpio.h | 39 ++++++++++++++++++++++++++++++ board/samsung/goni/goni.c | 2 + board/samsung/universal_c210/universal.c | 2 + drivers/gpio/s5p_gpio.c | 21 ++++++++++++++++ 5 files changed, 102 insertions(+), 0 deletions(-)
arch/arm/include/asm/arch-s5pc1xx/gpio.h +38 -0
@@ -134,6 +134,41 @@ 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); +struct s5p_gpio_bank *s5p_gpio_get_bank (int nr); +int s5p_gpio_get_pin (int nr); + +static inline int gpio_request (int gpio,const char *label) +{ +return 0 ; +} + +static inline int gpio_direction_input (int nr) +{ +s5p_gpio_direction_input (s5p_gpio_get_bank (nr), +s5p_gpio_get_pin (nr)); +return 0 ; +} + +static inline int gpio_direction_output (int nr,int value) +{ +s5p_gpio_direction_output (s5p_gpio_get_bank (nr), +s5p_gpio_get_pin (nr), value); +return 0 ; +} + +static inline int gpio_get_value (int nr) +{ +return (int )s5p_gpio_get_value (s5p_gpio_get_bank (nr), +s5p_gpio_get_pin (nr)); +} + +static inline void gpio_set_value (int nr,int value) +{ +s5p_gpio_set_value (s5p_gpio_get_bank (nr), +s5p_gpio_get_pin (nr), value); +} + +extern void *s5p_gpio;#endif /* Pin configurations */
@@ -155,4 +190,7 @@ void s5p_gpio_set_rate(struct s5p_gpio_bank *bank, int gpio, int mode);#define GPIO_DRV_FAST 0x0#define GPIO_DRV_SLOW 0x1 +/* GPIO pins per bank */ +#define GPIO_PER_BANK 8 +#endif
arch/arm/include/asm/arch-s5pc2xx/gpio.h +39 -0
@@ -88,6 +88,41 @@ 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); +struct s5p_gpio_bank *s5p_gpio_get_bank (int nr); +int s5p_gpio_get_pin (int nr); + +static inline int gpio_request (int gpio,const char *label) +{ +return 0 ; +} + +static inline int gpio_direction_input (int nr) +{ +s5p_gpio_direction_input (s5p_gpio_get_bank (nr), +s5p_gpio_get_pin (nr)); +return 0 ; +} + +static inline int gpio_direction_output (int nr,int value) +{ +s5p_gpio_direction_output (s5p_gpio_get_bank (nr), +s5p_gpio_get_pin (nr), value); +return 0 ; +} + +static inline int gpio_get_value (int nr) +{ +return (int )s5p_gpio_get_value (s5p_gpio_get_bank (nr), +s5p_gpio_get_pin (nr)); +} + +static inline void gpio_set_value (int nr,int value) +{ +s5p_gpio_set_value (s5p_gpio_get_bank (nr), +s5p_gpio_get_pin (nr), value); +} + +extern void *s5p_gpio;#endif /* Pin configurations */
@@ -108,4 +143,8 @@ void s5p_gpio_set_rate(struct s5p_gpio_bank *bank, int gpio, int mode);#define GPIO_DRV_4X 0x3#define GPIO_DRV_FAST 0x0#define GPIO_DRV_SLOW 0x1 + +/* GPIO pins per bank */ +#define GPIO_PER_BANK 8 +#endif
board/samsung/goni/goni.c +2 -0
@@ -29,11 +29,13 @@DECLARE_GLOBAL_DATA_PTR ;static struct s5pc110_gpio *s5pc110_gpio; +void *s5p_gpio;int board_init (void ) {/* Set Initial global variables */ s5pc110_gpio = (struct s5pc110_gpio *)S5PC110_GPIO_BASE ; + s5p_gpio = (void *) s5pc110_gpio; gd->bd->bi_arch_number =MACH_TYPE_GONI ; gd->bd->bi_boot_params =PHYS_SDRAM_1 +0x100 ;
board/samsung/universal_c210/universal.c +2 -0
@@ -32,6 +32,7 @@ DECLARE_GLOBAL_DATA_PTR;struct s5pc210_gpio_part1 *gpio1;struct s5pc210_gpio_part2 *gpio2; +void *s5p_gpio;unsigned int board_rev;u32 get_board_rev (void )
@@ -50,6 +51,7 @@ int board_init(void) { gpio1 = (struct s5pc210_gpio_part1 *)S5PC210_GPIO_PART1_BASE ; gpio2 = (struct s5pc210_gpio_part2 *)S5PC210_GPIO_PART2_BASE ; + s5p_gpio = (void *) gpio1;/* ptr used with I2C SW implementation */ gd->bd->bi_arch_number =MACH_TYPE_UNIVERSAL_C210 ; gd->bd->bi_boot_params =PHYS_SDRAM_1 +0x100 ;
drivers/gpio/s5p_gpio.c +21 -0
@@ -141,3 +141,24 @@ void s5p_gpio_set_rate(struct s5p_gpio_bank *bank, int gpio, int mode)writel (value, &bank->drv); } + +int s5p_gpio_get_nr (void *gp_ptr,int gpio) +{ +unsigned int offset = gp_ptr - (void *) s5p_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 *) s5p_gpio + bank); +} + +int s5p_gpio_get_pin (int nr) +{ +return nr %GPIO_PER_BANK ; +}
Signature · 1 line
1.7.2.3
PATCH v4 1/2 i2c:gpio:s5p: I2C GPIO Software implementation (via soft_i2c)
Dear Lukasz Majewski,
Quoted 40 lines · Lukasz Majewski
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 <[email protected]>Signed-off-by Kyungmin Park <[email protected]>Cc Minkyu Kang <[email protected]>Cc Heiko Schocher <[email protected]>---
Changes for v2:
? ? ? ?- Generic GPIO code added toarch/arm/gpio.h
? ? ? ?- Platform dependent GPIO code added toboard/samsung/goni.c? ? ? ?- Code cleanup
Changes for v3:
? ? ? ?- I2C GPIO common code added todrivers/gpio/s5p_gpio.c? ? ? ?-i2c_init_board()functionadded(required by soft_i2c)Changes for v4:
? ? ? ?-i2x_init_board()removed
? ? ? ?- s5pc210 support added
? ? ? ?- GPIO code and I2C enable code split to separate patches
---?arch/arm/include/asm/arch-s5pc1xx/gpio.h | ? 38 +++++++++++++++++++++++++++++ ?arch/arm/include/asm/arch-s5pc2xx/gpio.h | ? 39 ++++++++++++++++++++++++++++++ ?board/samsung/goni/goni.c ? ? ? ? ? ? ? ?| ? ?2 + ?board/samsung/universal_c210/universal.c | ? ?2 + ?drivers/gpio/s5p_gpio.c ? ? ? ? ? ? ? ? ?| ? 21 ++++++++++++++++?5 files changed, 102 insertions(+), 0 deletions(-)
board/samsung/goni/goni.c +1
-0@@ -29,11 +29,13 @@ ?DECLARE_GLOBAL_DATA_PTR; ?static struct s5pc110_gpio *s5pc110_gpio; +void *s5p_gpio; ?int board_init(void) ?{
Quoted 3 lines
? ? ? ?/* Set Initial global variables */
? ? ? ?s5pc110_gpio = (structs5pc110_gpio*)S5PC110_GPIO_BASE;
+ ? ? ?s5p_gpio= (void *)s5pc110_gpio;
I can't understand it.
Why is it need?
If you want to get gpio base address, then use the define value directly. s5p_gpio pointer is unnecessary.
Quoted 16 lines
? ? ? ?gd->bd->bi_arch_number =
MACH_TYPE_GONI; ? ? ? ?gd->bd->bi_boot_params =PHYS_SDRAM_1+0x100;board/samsung/universal_c210/universal.c +1
-0@@ -32,6 +32,7 @@ DECLARE_GLOBAL_DATA_PTR; ?struct s5pc210_gpio_part1 *gpio1; ?struct s5pc210_gpio_part2 *gpio2; +void *s5p_gpio; ?unsigned int board_rev; ?u32 get_board_rev(void)
board/samsung/universal_c210/universal.c int board_init(void) · line 54
Quoted 4 lines
board/samsung/universal_c210/universal.c +1
-0@@ -50,6 +51,7 @@ int board_init(void) ?{ ? ? ? ?gpio1 = (struct s5pc210_gpio_part1 *) S5PC210_GPIO_PART1_BASE; ? ? ? ?gpio2 = (struct s5pc210_gpio_part2 *) S5PC210_GPIO_PART2_BASE; + ? ? ? s5p_gpio = (void *) gpio1; /* ptr used with I2C SW implementation */
How can use gpio part2??
Quoted 8 lines
board/samsung/universal_c210/universal.c +0
-0? ? ? ?gd->bd->bi_arch_number = MACH_TYPE_UNIVERSAL_C210; ? ? ? ?gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;drivers/gpio/s5p_gpio.c +0
-0
drivers/gpio/s5p_gpio.c void s5p_gpio_set_rate(struct s5p_gpio_bank *bank, int gpio, int mode) · line 147
Quoted 7 lines
drivers/gpio/s5p_gpio.c +4
-0@@ -141,3 +141,24 @@ void s5p_gpio_set_rate(struct s5p_gpio_bank *bank, int gpio, int mode) ? ? ? ?writel(value, &bank->drv); ?} + +int s5p_gpio_get_nr (void *gp_ptr,int gpio) +{ + ? ? ? unsigned int offset = gp_ptr - (void *) s5p_gpio;
As I said..
the purpose of s5p_gpio is to get base address, then please use define value.
Quoted 8 lines
drivers/gpio/s5p_gpio.c +8
-0+ ? ? ? 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;
drivers/gpio/s5p_gpio.c void s5p_gpio_set_rate(struct s5p_gpio_bank *bank, int gpio, int mode)
Quoted 10 lines
drivers/gpio/s5p_gpio.c +9
-1+ ? ? ? bank *= sizeof(struct s5p_gpio_bank); + + ? ? ? return (struct s5p_gpio_bank *) ((void *) s5p_gpio + bank); +} + +int s5p_gpio_get_pin (int nr) +{ + ? ? ? return nr % GPIO_PER_BANK; +} --
And you should solve how can use gpio part2.
Thanks
Minkyu Kang.
Signature · 2 lines
from. prom. www.promsoft.net
PATCH 2/2 i2c:gpio:s5p: Enable I2C GPIO on the GONI target
In reply to Lukasz MajewskiThis patch enables the software I2C for GONI reference target.
--- include/configs/s5p_goni.h | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-)
include/configs/s5p_goni.h +13 -0
@@ -223,4 +223,17 @@#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_LOAD_ADDR - 0x1000000) +#include <asm/arch/gpio.h> +/* +* I2C Settings +*/ +#define S5PC110_GPIO_J3 (S5PC110_GPIO_BASE + 0x2C0) +#define CONFIG_SOFT_I2C_GPIO_SCL s5p_gpio_get_nr(S5PC110_GPIO_J3, 3) +#define CONFIG_SOFT_I2C_GPIO_SDA s5p_gpio_get_nr(S5PC110_GPIO_J3, 0) + +#define CONFIG_SOFT_I2C 1 +#define CONFIG_SYS_I2C_SPEED 50000 +#define CONFIG_I2C_MULTI_BUS +#define CONFIG_SYS_MAX_I2C_BUS 7 +#endif /* __CONFIG_H */
Signature · 1 line
1.7.2.3
v2 cover i2c:gpio:s5p I2C GPIO rework
In reply to Lukasz MajewskiBelow patches are supposed to adapt S5P processor's GPIO subsystem to soft_i2c software GPIO framework.
Lukasz Majewski (2):
i2c:gpio:s5p: I2C GPIO Software implementation (via soft_i2c) i2c:gpio:s5p: Enable I2C GPIO on the GONI target
arch/arm/include/asm/arch-s5pc1xx/gpio.h | 13 +++++++++ arch/arm/include/asm/arch-s5pc2xx/gpio.h | 29 +++++++++++++++++++ drivers/gpio/s5p_gpio.c | 44 ++++++++++++++++++++++++++++++ include/configs/s5p_goni.h | 12 ++++++++ 4 files changed, 98 insertions(+), 0 deletions(-)
---
Changes for v2:
- Macros for calculating the pin number from block pointer
- Removal of the s5p_gpio generic pointer
Signature · 1 line
1.7.2.3
PATCH v6 1/2 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.
---
Changes for v2:
- Generic GPIO code added to arch/arm/gpio.h
- Platform dependent GPIO code added to board/samsung/goni.c
- Code cleanup
Changes for v3:
- I2C GPIO common code added to drivers/gpio/s5p_gpio.c
- i2c_init_board() function added(required by soft_i2c)
Changes for v4:
- i2x_init_board() removed
- s5pc210 support added
- GPIO code and I2C enable code split to separate patches
Changes for v5:
- s5p_gpio pointer removed and replaced with generic s5p_gpio_base function
- removed duplicated code
Changes for v6:
- s5pc[1|2]10_gpio_get_nr macro added. More redable code for I2C gpio pins definition
--- arch/arm/include/asm/arch-s5pc1xx/gpio.h | 13 +++++++++ arch/arm/include/asm/arch-s5pc2xx/gpio.h | 29 +++++++++++++++++++ drivers/gpio/s5p_gpio.c | 44 ++++++++++++++++++++++++++++++ 3 files changed, 86 insertions(+), 0 deletions(-)
arch/arm/include/asm/arch-s5pc1xx/gpio.h +13 -0
@@ -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 */
arch/arm/include/asm/arch-s5pc2xx/gpio.h +29 -0
@@ -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 */
drivers/gpio/s5p_gpio.c +44 -0
47 lines not on this page · raw message
Signature · 1 line
1.7.2.3
PATCH v6 1/2 i2c:gpio:s5p: I2C GPIO Software implementation (via soft_i2c)
Dear Lukasz Majewski,
Quoted 29 lines · Lukasz Majewski
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 <[email protected]>Signed-off-by Kyungmin Park <[email protected]>Cc Minkyu Kang <[email protected]>Cc Heiko Schocher <[email protected]>---
Changes for v2:
? ? ? ?- Generic GPIO code added toarch/arm/gpio.h
? ? ? ?- Platform dependent GPIO code added toboard/samsung/goni.c? ? ? ?- Code cleanup
Changes for v3:
? ? ? ?- I2C GPIO common code added todrivers/gpio/s5p_gpio.c? ? ? ?-i2c_init_board()functionadded(required by soft_i2c)Changes for v4:
? ? ? ?-i2x_init_board()removed
? ? ? ?- s5pc210 support added
? ? ? ?- GPIO code and I2C enable code split to separate patches Changes for v5:
? ? ? ?-s5p_gpiopointer removed and replaced with generics5p_gpio_base? ? ? ?function
? ? ? ?- removed duplicated code
Changes for v6:
? ? ? ?- s5pc[1|2]10_gpio_get_nr macro added. More redable code for I2C ? ? ? ?gpio pins definition
---
Quoted 5 lines
?arch/arm/include/asm/arch-s5pc1xx/gpio.h | ? 13 +++++++++ ?arch/arm/include/asm/arch-s5pc2xx/gpio.h | ? 29 +++++++++++++++++++ ?drivers/gpio/s5p_gpio.c ? ? ? ? ? ? ? ? ?| ? 44 ++++++++++++++++++++++++++++++?3 files changed, 86 insertions(+), 0 deletions(-)
applied to u-boot-samsung
Thanks
Minkyu Kang
Signature · 2 lines
from. prom. www.promsoft.net
PATCH v2 2/2 i2c:gpio:s5p: Enable I2C GPIO on the GONI target
In reply to Lukasz MajewskiThis patch enables the software I2C for GONI reference target.
---
Changes for v2:
- Replace explicit GPIO definition with more readable one
--- include/configs/s5p_goni.h | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-)
include/configs/s5p_goni.h +12 -0
@@ -223,4 +223,16 @@#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_LOAD_ADDR - 0x1000000) +#include <asm/arch/gpio.h> +/* +* I2C Settings +*/ +#define CONFIG_SOFT_I2C_GPIO_SCL s5pc110_gpio_get_nr(j4, 3) +#define CONFIG_SOFT_I2C_GPIO_SDA s5pc110_gpio_get_nr(j4, 0) + +#define CONFIG_SOFT_I2C 1 +#define CONFIG_SYS_I2C_SPEED 50000 +#define CONFIG_I2C_MULTI_BUS +#define CONFIG_SYS_MAX_I2C_BUS 7 +#endif /* __CONFIG_H */
Signature · 1 line
1.7.2.3
PATCH v2 2/2 i2c:gpio:s5p: Enable I2C GPIO on the GONI target
Dear Lukasz Majewski,
Quoted 7 lines · Lukasz Majewski
This patch enables the software I2C for GONI reference target.
Signed-off-by Lukasz Majewski <[email protected]>Signed-off-by Kyungmin Park <[email protected]>Cc Minkyu Kang <[email protected]>Cc Heiko Schocher <[email protected]>
Quoted 7 lines
---
Changes for v2:
? ? ? ?- Replace explicit GPIO definition with more readable one
---
?include/configs/s5p_goni.h | ? 12 ++++++++++++
?1 files changed, 12 insertions(+), 0 deletions(-)
applied to u-boot-samsung
Thanks
Minkyu Kang
Signature · 2 lines
from. prom. www.promsoft.net