All of lore.kernel.org
 help / color / mirror / Atom feed
From: Igor Grinberg <grinberg@compulab.co.il>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/3] omap3evm: Update ethernet reset sequence for	Rev.G board
Date: Thu, 23 Jun 2011 12:07:50 +0300	[thread overview]
Message-ID: <4E030266.6000009@compulab.co.il> (raw)
In-Reply-To: <1308770649-3802-3-git-send-email-premi@ti.com>

Hi Sanjeev,

On 06/22/11 22:24, Sanjeev Premi wrote:
> From: Sriramakrishnan <srk@ti.com>
>
> The GPIO pin used for resetting the external LAN chip has
> changed for Rev.G board.
>
> Signed-off-by: Sriramakrishnan <srk@ti.com>
> Signed-off-by: Sanjeev Premi <premi@ti.com>
> ---
>  board/ti/evm/evm.c |   27 ++++++++++++++++++---------
>  1 files changed, 18 insertions(+), 9 deletions(-)
>
> diff --git a/board/ti/evm/evm.c b/board/ti/evm/evm.c
> index 8f9f141..57e5fa5 100644
> --- a/board/ti/evm/evm.c
> +++ b/board/ti/evm/evm.c
> @@ -181,17 +181,26 @@ static void setup_net_chip(void)
>   */
>  static void reset_net_chip(void)
>  {
> -	struct gpio *gpio3_base = (struct gpio *)OMAP34XX_GPIO3_BASE;
> -
> -	/* Make GPIO 64 as output pin */
> -	writel(readl(&gpio3_base->oe) & ~(GPIO0), &gpio3_base->oe);
> -
> -	/* Now send a pulse on the GPIO pin */
> -	writel(GPIO0, &gpio3_base->setdataout);
> +	struct gpio *gpio_base;
> +	u32 pin;
> +
> +	if (get_omap3_evm_rev() == OMAP3EVM_BOARD_GEN_1) {
> +		gpio_base = (struct gpio *)OMAP34XX_GPIO3_BASE;
> +		pin = GPIO0;	/* Output pin: GPIO Bank 3, pin 0 */
> +	} else {
> +		gpio_base = (struct gpio *)OMAP34XX_GPIO1_BASE;
> +		pin = GPIO7;	/* Output pin: GPIO Bank 0, pin 7 */
> +	}
> +
> +	/* Configure the pin as output */
> +	writel(readl(&gpio_base->oe) & ~(pin), &gpio_base->oe);
> +
> +	/* Send a pulse on the GPIO pin */
> +	writel(pin, &gpio_base->setdataout);
>  	udelay(1);
> -	writel(GPIO0, &gpio3_base->cleardataout);
> +	writel(pin, &gpio_base->cleardataout);
>  	udelay(1);
> -	writel(GPIO0, &gpio3_base->setdataout);
> +	writel(pin, &gpio_base->setdataout);

Why keep messing with the gpio registers?
Why not use gpio framework?
Though it is omap specific, but it will be much cleaner then the above.


-- 
Regards,
Igor.

  reply	other threads:[~2011-06-23  9:07 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-22 19:24 [U-Boot] [PATCH 0/3] omap3evm: Generic ethernet fixes Sanjeev Premi
2011-06-22 19:24 ` [U-Boot] [PATCH 1/3] omap3evm: eth: split function setup_net_chip Sanjeev Premi
2011-07-28 13:29   ` Wolfgang Denk
2011-06-22 19:24 ` [U-Boot] [PATCH 2/3] omap3evm: Update ethernet reset sequence for Rev.G board Sanjeev Premi
2011-06-23  9:07   ` Igor Grinberg [this message]
2011-06-23 11:12     ` Premi, Sanjeev
2011-06-23 11:18       ` Premi, Sanjeev
2011-06-27  5:06         ` Premi, Sanjeev
2011-06-27  6:47           ` Igor Grinberg
2011-06-27 10:43             ` Premi, Sanjeev
2011-07-28 13:32   ` Wolfgang Denk
2011-06-22 19:24 ` [U-Boot] [PATCH 3/3] omap3evm: eth: Include functions only when necessary Sanjeev Premi

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=4E030266.6000009@compulab.co.il \
    --to=grinberg@compulab.co.il \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.