From patchwork Sun Jun 10 13:03:43 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vikram Narayanan X-Patchwork-Id: 163995 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 8C2A6B6FD7 for ; Sun, 10 Jun 2012 23:03:56 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 1C654281D1; Sun, 10 Jun 2012 15:03:55 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id h1gFmNC+Vrdd; Sun, 10 Jun 2012 15:03:54 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 3E5C8281C1; Sun, 10 Jun 2012 15:03:53 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 295D3281B8 for ; Sun, 10 Jun 2012 15:03:52 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id OeRjXhTjNkq3 for ; Sun, 10 Jun 2012 15:03:51 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-pb0-f44.google.com (mail-pb0-f44.google.com [209.85.160.44]) by theia.denx.de (Postfix) with ESMTPS id 79B9C281B7 for ; Sun, 10 Jun 2012 15:03:51 +0200 (CEST) Received: by pbcwy7 with SMTP id wy7so4136312pbc.3 for ; Sun, 10 Jun 2012 06:03:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=qBK2PdoFYfa78rQUA85njjLHuleVEMRHUpX+RkhVH5E=; b=Ig0h7griLXS1QYAHLGxVjhrj1uBDO61kuAKITfA9s+XqHVcQDD/Gf3VbNaZ51r1Idl l5D6Ij2Ivritt5x1du2A6ivUHZJLmflQpKE0cLyrJhSm9+0bKJOPhTzBgIaiZeX3CI8M F2WUgfNDN7fC6V+uE92wfaJZZhrlWKIlY7g1fji+qj3rM9eYV2jS47VjuEjFaNFfc+BK AZc3+owOxeXUL+q1INtFbdiTdR+CXQBjFkoJb2JIgaU59VlgFQ8kKfjxTWrWdzcr1UvP XaE0BeSnunhDgMyN/AOieF3CkSUEUY+yINx0+adYKQoCmzirUtjnGqDxSNm5DTnrBWrJ v9GQ== Received: by 10.68.216.5 with SMTP id om5mr15837525pbc.64.1339333429581; Sun, 10 Jun 2012 06:03:49 -0700 (PDT) Received: from [192.168.1.4] ([122.165.225.85]) by mx.google.com with ESMTPS id ok6sm14818471pbb.29.2012.06.10.06.03.46 (version=SSLv3 cipher=OTHER); Sun, 10 Jun 2012 06:03:48 -0700 (PDT) Message-ID: <4FD49B2F.8090706@gmail.com> Date: Sun, 10 Jun 2012 18:33:43 +0530 From: Vikram Narayanan User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2 MIME-Version: 1.0 To: u-boot@lists.denx.de References: <4FD49AA5.7000303@gmail.com> In-Reply-To: <4FD49AA5.7000303@gmail.com> Cc: Fabio Estevam , John Rigby Subject: [U-Boot] [PATCH 2/3] tx25: Use generic gpio_* calls X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Instead of manipulating gpio registers directly, use the calls from the gpio library. Signed-off-by: Vikram Narayanan Cc: John Rigby Cc: Stefano Babic --- board/karo/tx25/tx25.c | 28 ++++++++++++---------------- 1 files changed, 12 insertions(+), 16 deletions(-) diff --git a/board/karo/tx25/tx25.c b/board/karo/tx25/tx25.c index 2a29943..6d03130 100644 --- a/board/karo/tx25/tx25.c +++ b/board/karo/tx25/tx25.c @@ -34,14 +34,13 @@ DECLARE_GLOBAL_DATA_PTR; #ifdef CONFIG_FEC_MXC +#define GPIO_FEC_RESET_B MXC_GPIO_PORT_TO_NUM(4, 7) +#define GPIO_FEC_ENABLE_B MXC_GPIO_PORT_TO_NUM(4, 9) void tx25_fec_init(void) { struct iomuxc_mux_ctl *muxctl; struct iomuxc_pad_ctl *padctl; - u32 val; u32 gpio_mux_mode = MX25_PIN_MUX_MODE(5); - struct gpio_regs *gpio4 = (struct gpio_regs *)IMX_GPIO4_BASE; - struct gpio_regs *gpio3 = (struct gpio_regs *)IMX_GPIO3_BASE; u32 saved_rdata0_mode, saved_rdata1_mode, saved_rx_dv_mode; debug("tx25_fec_init\n"); @@ -66,18 +65,18 @@ void tx25_fec_init(void) writel(0x0, &padctl->pad_d11); /* drop PHY power and assert reset (low) */ - val = readl(&gpio4->gpio_dr) & ~((1 << 7) | (1 << 9)); - writel(val, &gpio4->gpio_dr); - val = readl(&gpio4->gpio_dir) | (1 << 7) | (1 << 9); - writel(val, &gpio4->gpio_dir); + gpio_direction_output(GPIO_FEC_RESET_B, 0); + gpio_direction_output(GPIO_FEC_ENABLE_B, 0); + + gpio_direction_output(GPIO_FEC_RESET_B, 1); + gpio_direction_output(GPIO_FEC_ENABLE_B, 1); mdelay(5); debug("resetting phy\n"); /* turn on PHY power leaving reset asserted */ - val = readl(&gpio4->gpio_dr) | 1 << 9; - writel(val, &gpio4->gpio_dr); + gpio_direction_output(GPIO_FEC_ENABLE_B, 1); mdelay(10); @@ -107,19 +106,16 @@ void tx25_fec_init(void) /* * set each to 1 and make each an output */ - val = readl(&gpio3->gpio_dr) | (1 << 10) | (1 << 11) | (1 << 12); - writel(val, &gpio3->gpio_dr); - val = readl(&gpio3->gpio_dir) | (1 << 10) | (1 << 11) | (1 << 12); - writel(val, &gpio3->gpio_dir); + gpio_direction_output(MXC_GPIO_PORT_TO_NUM(3, 10), 1); + gpio_direction_output(MXC_GPIO_PORT_TO_NUM(3, 11), 1); + gpio_direction_output(MXC_GPIO_PORT_TO_NUM(3, 12), 1); mdelay(22); /* this value came from RedBoot */ /* * deassert PHY reset */ - val = readl(&gpio4->gpio_dr) | 1 << 7; - writel(val, &gpio4->gpio_dr); - writel(val, &gpio4->gpio_dr); + gpio_direction_output(GPIO_FEC_RESET_B, 1); mdelay(5);