[U-Boot] [PATCH v12 1/2] S5P: Exynos: Add GPIO pin numbering and rename definitions
Minkyu Kang
mk7.kang at samsung.com
Tue May 13 01:59:40 CEST 2014
Dear Akshay Saraswat,
On 06/05/14 23:36, Akshay Saraswat wrote:
> This patch includes following changes :
> * Adds gpio pin numbering support for EXYNOS SOCs.
> To have consistent 0..n-1 GPIO numbering the banks are divided
> into different parts where ever they have holes in them.
>
> * Rename GPIO definitions from GPIO_... to S5P_GPIO_...
> These changes were done to enable cmd_gpio for EXYNOS and
> cmd_gpio has GPIO_INPUT same as s5p_gpio driver and hence
> getting a error during compilation.
>
> * Adds support for name to gpio conversion in s5p_gpio to enable
> gpio command EXYNOS SoCs. Function has been added to asm/gpio.h
> to decode the input gpio name to gpio number.
> Example: SMDK5420 # gpio set gpa00
>
> Signed-off-by: Leela Krishna Amudala <l.krishna at samsung.com>
> Signed-off-by: Rajeshwari Shinde <rajeshwari.s at samsung.com>
> Signed-off-by: Akshay Saraswat <akshay.s at samsung.com>
> Acked-by: Przemyslaw Marczak <p.marczak at samsung.com>
> ---
> Changes in V12:
> - Added change log in this patch.
> - Fixed few bugs and typos.
> - Added "Acked-by: Przemyslaw Marczak".
> Changes in v11:
> - Created and fixed pinmux_config for Exynos 4412.
> - Removed dead code.
> Changes in v10:
> - Made arch-exynos/gpio.h -> arch/gpio.h.
> - Removed dead code.
> - Edited pin numbmers in dts files.
> Changes in V9:
> - Fixed checkpatch errors.
> - Fixed naming error in exynosxxxx_gpio_data arrays which could
> be the possible reason behind data abort witnessed over
> Exynos4 boards.
> Changes in V8:
> - Fixed arndale board compile time errors introduced due to
> patch-set v7.
> Changes in V7:
> - Added changes for other SoCs like Exynos 4412, 4210 etc.
> Changes in V6:
> - Updated patch with corresponding changes for Exynos 5420.
> Changes in V5:
> - Rebased on latest u-boot-samsung tree.
> - Removed Exynos5 specific code in gpio driver api to
> get bank.
> Changes in V4:
> - To have consistent 0..n-1 GPIO numbering the banks
> are divided into different parts where ever they
> have holes in them.
> - Function and table to support gpio command moved
> to s5p-gpio driver.
> - Rebased on latest u-boot-samsung tree.
> Changes in V3:
> - GPIO Table added to calculate the base address
> of input gpio bank.
>
> arch/arm/cpu/armv7/exynos/pinmux.c | 561 +++++----
> arch/arm/dts/exynos4210-origen.dts | 4 +-
> arch/arm/dts/exynos4210-trats.dts | 6 +-
> arch/arm/dts/exynos4210-universal_c210.dts | 4 +-
> arch/arm/dts/exynos4412-trats2.dts | 4 +-
> arch/arm/include/asm/arch-exynos/cpu.h | 17 +-
> arch/arm/include/asm/arch-exynos/gpio.h | 1761 +++++++++++++++++++++++-----
> arch/arm/include/asm/arch-s5pc1xx/gpio.h | 948 ++++++++++++---
> board/samsung/arndale/arndale.c | 11 +-
> board/samsung/goni/goni.c | 32 +-
> board/samsung/smdk5250/exynos5-dt.c | 20 +-
> board/samsung/smdk5250/smdk5250.c | 19 +-
> board/samsung/smdk5420/smdk5420.c | 15 +-
> board/samsung/smdkc100/smdkc100.c | 5 +-
> board/samsung/smdkv310/smdkv310.c | 19 +-
> board/samsung/trats/trats.c | 39 +-
> board/samsung/trats2/trats2.c | 74 +-
> board/samsung/universal_c210/universal.c | 51 +-
> drivers/gpio/s5p_gpio.c | 204 +++-
> 19 files changed, 2899 insertions(+), 895 deletions(-)
>
> diff --git a/board/samsung/arndale/arndale.c b/board/samsung/arndale/arndale.c
> index 9efc355..ef88314 100644
> --- a/board/samsung/arndale/arndale.c
> +++ b/board/samsung/arndale/arndale.c
> @@ -16,17 +16,14 @@ DECLARE_GLOBAL_DATA_PTR;
> #ifdef CONFIG_USB_EHCI_EXYNOS
> int board_usb_init(int index, enum usb_init_type init)
> {
> - struct exynos5_gpio_part1 *gpio = (struct exynos5_gpio_part1 *)
> - samsung_get_base_gpio_part1();
> -
> /* Configure gpios for usb 3503 hub:
> * disconnect, toggle reset and connect
> */
> - s5p_gpio_direction_output(&gpio->d1, 7, 0);
> - s5p_gpio_direction_output(&gpio->x3, 5, 0);
> + gpio_direction_output(EXYNOS5_GPIO_D17, 0);
> + gpio_direction_output(EXYNOS5_GPIO_X35, 0);
>
> - s5p_gpio_direction_output(&gpio->x3, 5, 1);
> - s5p_gpio_direction_output(&gpio->d1, 7, 1);
> + gpio_direction_output(EXYNOS5_GPIO_X35, 1);
> + gpio_direction_output(EXYNOS5_GPIO_D17, 1);
>
> return 0;
> }
> diff --git a/board/samsung/goni/goni.c b/board/samsung/goni/goni.c
> index 61b9ece..4cea63b 100644
> --- a/board/samsung/goni/goni.c
> +++ b/board/samsung/goni/goni.c
> @@ -17,8 +17,6 @@
>
> DECLARE_GLOBAL_DATA_PTR;
>
> -static struct s5pc110_gpio *s5pc110_gpio;
> -
> u32 get_board_rev(void)
> {
> return 0;
> @@ -27,8 +25,6 @@ u32 get_board_rev(void)
> int board_init(void)
> {
> /* Set Initial global variables */
> - s5pc110_gpio = (struct s5pc110_gpio *)S5PC110_GPIO_BASE;
> -
> gd->bd->bi_arch_number = MACH_TYPE_GONI;
> gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
>
> @@ -82,7 +78,7 @@ int board_mmc_init(bd_t *bis)
> int i, ret, ret_sd = 0;
>
> /* MASSMEMORY_EN: XMSMDATA7: GPJ2[7] output high */
> - s5p_gpio_direction_output(&s5pc110_gpio->j2, 7, 1);
> + gpio_direction_output(S5PC110_GPIO_J27, 1);
>
> /*
> * MMC0 GPIO
> @@ -91,15 +87,15 @@ int board_mmc_init(bd_t *bis)
> * GPG0[2] SD_0_CDn -> Not used
> * GPG0[3:6] SD_0_DATA[0:3]
> */
> - for (i = 0; i < 7; i++) {
> - if (i == 2)
> + for (i = S5PC110_GPIO_G00; i < S5PC110_GPIO_G07; i++) {
> + if (i == S5PC110_GPIO_G02)
> continue;
> /* GPG0[0:6] special function 2 */
> - s5p_gpio_cfg_pin(&s5pc110_gpio->g0, i, 0x2);
> + gpio_cfg_pin(i, 0x2);
> /* GPG0[0:6] pull disable */
> - s5p_gpio_set_pull(&s5pc110_gpio->g0, i, GPIO_PULL_NONE);
> + gpio_set_pull(i, S5P_GPIO_PULL_NONE);
> /* GPG0[0:6] drv 4x */
> - s5p_gpio_set_drv(&s5pc110_gpio->g0, i, GPIO_DRV_4X);
> + gpio_set_drv(i, S5P_GPIO_DRV_4X);
> }
>
> ret = s5p_mmc_init(0, 4);
> @@ -110,20 +106,20 @@ int board_mmc_init(bd_t *bis)
> * SD card (T_FLASH) detect and init
> * T_FLASH_DETECT: EINT28: GPH3[4] input mode
> */
> - s5p_gpio_cfg_pin(&s5pc110_gpio->h3, 4, GPIO_INPUT);
> - s5p_gpio_set_pull(&s5pc110_gpio->h3, 4, GPIO_PULL_UP);
> + gpio_cfg_pin(S5PC110_GPIO_H34, S5P_GPIO_INPUT);
> + gpio_set_pull(S5PC110_GPIO_H34, S5P_GPIO_PULL_UP);
>
> - if (!s5p_gpio_get_value(&s5pc110_gpio->h3, 4)) {
> - for (i = 0; i < 7; i++) {
> - if (i == 2)
> + if (!gpio_get_value(S5PC110_GPIO_H34)) {
> + for (i = S5PC110_GPIO_G20; i < S5PC110_GPIO_G27; i++) {
> + if (i == S5PC110_GPIO_G22)
> continue;
>
> /* GPG2[0:6] special function 2 */
> - s5p_gpio_cfg_pin(&s5pc110_gpio->g2, i, 0x2);
> + gpio_cfg_pin(i, 0x2);
> /* GPG2[0:6] pull disable */
> - s5p_gpio_set_pull(&s5pc110_gpio->g2, i, GPIO_PULL_NONE);
> + gpio_set_pull(i, S5P_GPIO_PULL_NONE);
> /* GPG2[0:6] drv 4x */
> - s5p_gpio_set_drv(&s5pc110_gpio->g2, i, GPIO_DRV_4X);
> + gpio_set_drv(i, S5P_GPIO_DRV_4X);
> }
>
> ret_sd = s5p_mmc_init(2, 4);
> diff --git a/board/samsung/smdk5250/exynos5-dt.c b/board/samsung/smdk5250/exynos5-dt.c
> index 379a45c..58821c4 100644
> --- a/board/samsung/smdk5250/exynos5-dt.c
> +++ b/board/samsung/smdk5250/exynos5-dt.c
> @@ -27,12 +27,9 @@ DECLARE_GLOBAL_DATA_PTR;
> #ifdef CONFIG_SOUND_MAX98095
> static void board_enable_audio_codec(void)
> {
> - struct exynos5_gpio_part1 *gpio1 = (struct exynos5_gpio_part1 *)
> - samsung_get_base_gpio_part1();
> -
> /* Enable MAX98095 Codec */
> - s5p_gpio_direction_output(&gpio1->x1, 7, 1);
> - s5p_gpio_set_pull(&gpio1->x1, 7, GPIO_PULL_NONE);
> + gpio_direction_output(EXYNOS5_GPIO_X17, 1);
> + gpio_set_pull(EXYNOS5_GPIO_X17, S5P_GPIO_PULL_NONE);
> }
> #endif
>
> @@ -47,19 +44,16 @@ int exynos_init(void)
> #ifdef CONFIG_LCD
> void exynos_cfg_lcd_gpio(void)
> {
> - struct exynos5_gpio_part1 *gpio1 =
> - (struct exynos5_gpio_part1 *)samsung_get_base_gpio_part1();
> -
> /* For Backlight */
> - s5p_gpio_cfg_pin(&gpio1->b2, 0, GPIO_OUTPUT);
> - s5p_gpio_set_value(&gpio1->b2, 0, 1);
> + gpio_cfg_pin(EXYNOS5_GPIO_B20, S5P_GPIO_OUTPUT);
> + gpio_set_value(EXYNOS5_GPIO_B20, 1);
>
> /* LCD power on */
> - s5p_gpio_cfg_pin(&gpio1->x1, 5, GPIO_OUTPUT);
> - s5p_gpio_set_value(&gpio1->x1, 5, 1);
> + gpio_cfg_pin(EXYNOS5_GPIO_X15, S5P_GPIO_OUTPUT);
> + gpio_set_value(EXYNOS5_GPIO_X15, 1);
>
> /* Set Hotplug detect for DP */
> - s5p_gpio_cfg_pin(&gpio1->x0, 7, GPIO_FUNC(0x3));
> + gpio_cfg_pin(EXYNOS5_GPIO_X07, S5P_GPIO_FUNC(0x3));
> }
>
> void exynos_set_dp_phy(unsigned int onoff)
> diff --git a/board/samsung/smdk5250/smdk5250.c b/board/samsung/smdk5250/smdk5250.c
> index 28a6d9e..014b7bd 100644
> --- a/board/samsung/smdk5250/smdk5250.c
> +++ b/board/samsung/smdk5250/smdk5250.c
> @@ -29,12 +29,9 @@ DECLARE_GLOBAL_DATA_PTR;
> #ifdef CONFIG_SOUND_MAX98095
> static void board_enable_audio_codec(void)
> {
> - struct exynos5_gpio_part1 *gpio1 = (struct exynos5_gpio_part1 *)
> - samsung_get_base_gpio_part1();
> -
> /* Enable MAX98095 Codec */
> - s5p_gpio_direction_output(&gpio1->x1, 7, 1);
> - s5p_gpio_set_pull(&gpio1->x1, 7, GPIO_PULL_NONE);
> + gpio_direction_output(EXYNOS5_GPIO_X17, 1);
> + gpio_set_pull(EXYNOS5_GPIO_X17, S5P_GPIO_PULL_NONE);
> }
> #endif
>
> @@ -275,19 +272,17 @@ int exynos_power_init(void)
> #ifdef CONFIG_LCD
> void exynos_cfg_lcd_gpio(void)
> {
> - struct exynos5_gpio_part1 *gpio1 =
> - (struct exynos5_gpio_part1 *) samsung_get_base_gpio_part1();
>
> /* For Backlight */
> - s5p_gpio_cfg_pin(&gpio1->b2, 0, GPIO_OUTPUT);
> - s5p_gpio_set_value(&gpio1->b2, 0, 1);
> + gpio_cfg_pin(EXYNOS5_GPIO_B20, S5P_GPIO_OUTPUT);
> + gpio_set_value(EXYNOS5_GPIO_B20, 1);
>
> /* LCD power on */
> - s5p_gpio_cfg_pin(&gpio1->x1, 5, GPIO_OUTPUT);
> - s5p_gpio_set_value(&gpio1->x1, 5, 1);
> + gpio_cfg_pin(EXYNOS5_GPIO_X15, S5P_GPIO_OUTPUT);
> + gpio_set_value(EXYNOS5_GPIO_X15, 1);
>
> /* Set Hotplug detect for DP */
> - s5p_gpio_cfg_pin(&gpio1->x0, 7, GPIO_FUNC(0x3));
> + gpio_cfg_pin(EXYNOS5_GPIO_X07, S5P_GPIO_FUNC(0x3));
> }
>
> void exynos_set_dp_phy(unsigned int onoff)
> diff --git a/board/samsung/smdk5420/smdk5420.c b/board/samsung/smdk5420/smdk5420.c
> index e4606ec..fa3aa2c 100644
> --- a/board/samsung/smdk5420/smdk5420.c
> +++ b/board/samsung/smdk5420/smdk5420.c
> @@ -21,11 +21,8 @@ DECLARE_GLOBAL_DATA_PTR;
> #ifdef CONFIG_USB_EHCI_EXYNOS
> static int board_usb_vbus_init(void)
> {
> - struct exynos5_gpio_part1 *gpio1 = (struct exynos5_gpio_part1 *)
> - samsung_get_base_gpio_part1();
> -
> /* Enable VBUS power switch */
> - s5p_gpio_direction_output(&gpio1->x2, 6, 1);
> + gpio_direction_output(EXYNOS5420_GPIO_X26, 1);
>
> /* VBUS turn ON time */
> mdelay(3);
> @@ -49,15 +46,15 @@ void cfg_lcd_gpio(void)
> (struct exynos5_gpio_part1 *)samsung_get_base_gpio_part1();
>
> /* For Backlight */
> - s5p_gpio_cfg_pin(&gpio1->b2, 0, GPIO_OUTPUT);
> - s5p_gpio_set_value(&gpio1->b2, 0, 1);
> + gpio_cfg_pin(EXYNOS5420_GPIO_B10, S5P_GPIO_OUTPUT);
GPIO_B20
> + gpio_set_value(EXYNOS5420_GPIO_B20, 1);
>
> /* LCD power on */
> - s5p_gpio_cfg_pin(&gpio1->x1, 5, GPIO_OUTPUT);
> - s5p_gpio_set_value(&gpio1->x1, 5, 1);
> + gpio_cfg_pin(EXYNOS5420_GPIO_X15, S5P_GPIO_OUTPUT);
> + gpio_set_value(EXYNOS5420_GPIO_X15, 1);
>
> /* Set Hotplug detect for DP */
> - s5p_gpio_cfg_pin(&gpio1->x0, 7, GPIO_FUNC(0x3));
> + gpio_cfg_pin(EXYNOS5420_GPIO_X07, S5P_GPIO_FUNC(0x3));
> }
>
> vidinfo_t panel_info = {
Thanks,
Minkyu Kang.
More information about the U-Boot
mailing list