public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Przemyslaw Marczak <p.marczak@samsung.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v10 1/2] EXYNOS: Add GPIO pin numbering and rename definitions
Date: Tue, 29 Apr 2014 18:36:15 +0200	[thread overview]
Message-ID: <535FD4FF.1050001@samsung.com> (raw)
In-Reply-To: <1398693547-13986-2-git-send-email-akshay.s@samsung.com>

Hello,
On 04/28/2014 03:59 PM, 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@samsung.com>
> Signed-off-by: Rajeshwari Shinde <rajeshwari.s@samsung.com>
> Signed-off-by: Akshay Saraswat <akshay.s@samsung.com>
> ---


In this function and probably in the whole code you need to check cpu id 
for Exynos4 and Exynos4x12.

>   static int exynos4_mmc_config(int peripheral, int flags)
>   {
> -	struct exynos4_gpio_part2 *gpio2 =
> -		(struct exynos4_gpio_part2 *)samsung_get_base_gpio_part2();
> -	struct s5p_gpio_bank *bank, *bank_ext;
> -	int i;
> +	int i, start = 0, start_ext = 0;
>
>   	switch (peripheral) {
>   	case PERIPH_ID_SDMMC0:
> -		bank = &gpio2->k0;
> -		bank_ext = &gpio2->k1;
Here is a bug on trats2. After your changes in arch/gpio.h
bank = &gpio2->k0 is the same as EXYNOS4_GPIO_K00 only for Exyynos4 not 
4x12.

So here please do this:
if (proid_is_exynos4412()) {
     start = EXYNOS4X12_GPIO_K00;
     start_ext = EXYNOS4X12_GPIO_K13;
} else {
     start = EXYNOS4_GPIO_K00;
     start_ext = EXYNOS4_GPIO_K13;
}

I am not sure what about the rest code because it works,
so it looks like we can use Exynos4 definitions also for Exynos4x12.


> +		start = EXYNOS4_GPIO_K00;
> +		start_ext = EXYNOS4_GPIO_K13;
>   		break;
>   	case PERIPH_ID_SDMMC2:
> -		bank = &gpio2->k2;
> -		bank_ext = &gpio2->k3;
> +		start = EXYNOS4_GPIO_K20;
> +		start_ext = EXYNOS4_GPIO_K33;
>   		break;
>   	default:
>   		return -1;
>   	}
> -	for (i = 0; i < 7; i++) {
> +	for (i = start; i < (start + 7); i++) {

And here is the main reason why MMC doesn't work.
		if (i == start + 2)

>   		if (i == 2)
>   			continue;
> -		s5p_gpio_cfg_pin(bank, i,  GPIO_FUNC(0x2));
> -		s5p_gpio_set_pull(bank, i, GPIO_PULL_NONE);
> -		s5p_gpio_set_drv(bank, i, GPIO_DRV_4X);
> +		gpio_cfg_pin(i,  S5P_GPIO_FUNC(0x2));
> +		gpio_set_pull(i, S5P_GPIO_PULL_NONE);
> +		gpio_set_drv(i, S5P_GPIO_DRV_4X);
>   	}
>   	if (flags & PINMUX_FLAG_8BIT_MODE) {
> -		for (i = 3; i < 7; i++) {
> -			s5p_gpio_cfg_pin(bank_ext, i,  GPIO_FUNC(0x3));
> -			s5p_gpio_set_pull(bank_ext, i, GPIO_PULL_NONE);
> -			s5p_gpio_set_drv(bank_ext, i, GPIO_DRV_4X);
> +		for (i = start_ext; i < (start_ext + 4); i++) {
> +			gpio_cfg_pin(i,  S5P_GPIO_FUNC(0x3));
> +			gpio_set_pull(i, S5P_GPIO_PULL_NONE);
> +			gpio_set_drv(i, S5P_GPIO_DRV_4X);
>   		}
>   	}

After those two fixes I didn't saw any other issues on trats and trats2.

This still needs test for goni.

And please check for the dead code...

Thanks
-- 
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com

  reply	other threads:[~2014-04-29 16:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-28 13:59 [U-Boot] [PATCH v10 0/2] S5P: Exynos: Add GPIO numbering feature Akshay Saraswat
2014-04-28 13:59 ` [U-Boot] [PATCH v10 1/2] EXYNOS: Add GPIO pin numbering and rename definitions Akshay Saraswat
2014-04-29 16:36   ` Przemyslaw Marczak [this message]
2014-04-30 14:25     ` Przemyslaw Marczak
2014-04-28 13:59 ` [U-Boot] [PATCH v10 2/2] S5P: Exynos: Config: Enable GPIO CMD config Akshay Saraswat
2014-04-28 18:14 ` [U-Boot] [PATCH v10 0/2] S5P: Exynos: Add GPIO numbering feature Przemyslaw Marczak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=535FD4FF.1050001@samsung.com \
    --to=p.marczak@samsung.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox