From patchwork Fri Jun 15 18:26:14 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vikram Narayanan X-Patchwork-Id: 165215 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 ACE58B6F9D for ; Sat, 16 Jun 2012 04:26:35 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 9F85128123; Fri, 15 Jun 2012 20:26:33 +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 wG9gEDNwOVc8; Fri, 15 Jun 2012 20:26:33 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 309CD28125; Fri, 15 Jun 2012 20:26:32 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id E624528125 for ; Fri, 15 Jun 2012 20:26:30 +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 diFXNZapBA+I for ; Fri, 15 Jun 2012 20:26:29 +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-pz0-f44.google.com (mail-pz0-f44.google.com [209.85.210.44]) by theia.denx.de (Postfix) with ESMTPS id 7522828123 for ; Fri, 15 Jun 2012 20:26:27 +0200 (CEST) Received: by dacx6 with SMTP id x6so4057966dac.3 for ; Fri, 15 Jun 2012 11:26:26 -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=0C/tqCc/JvJNQoZU7dIgBTvar492k0mrAnrX5DZHMnc=; b=BUnm3DEcTvXLjmf/iGWCuMKfc2LSilY5KTcSQd2sAmjPR8j1jpdfEt5KjDrWuvg4J4 ZlbCNWsTtB0yOGuEVBD/Y9LnVBeUXZ73b7rpcCAlXT11Q5SdA7oasisCfbJQALbe4UA9 ezS/1R/oP7fSU8cr0mLk7LH3Ga9WdNS1GmoTtMDOHD9fB4rr5WxFcU3OAO3dhm8NNLip 0jUU8Q65Z0CWS/CXkO/Zd+Z9kQ+wYbF+l1v5s0SutKIWL3M9HgDfdVhDS9+KUIfdwu08 H4KOh6ZchRTKP4joh4SIbB5NaogNpf4hzUzTiFScl4Kpv27wm5zVpltLMZrR5GqJRfC5 WtVA== Received: by 10.68.227.69 with SMTP id ry5mr1101439pbc.16.1339784786224; Fri, 15 Jun 2012 11:26:26 -0700 (PDT) Received: from [115.242.146.219] ([115.242.146.219]) by mx.google.com with ESMTPS id np8sm13991894pbc.71.2012.06.15.11.26.21 (version=SSLv3 cipher=OTHER); Fri, 15 Jun 2012 11:26:25 -0700 (PDT) Message-ID: <4FDB7E46.2050404@gmail.com> Date: Fri, 15 Jun 2012 23:56:14 +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: <4FD77055.3080502@gmail.com> In-Reply-To: <4FD77055.3080502@gmail.com> Cc: Fabio Estevam , John Rigby Subject: [U-Boot] [PATCH v3] 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 Acked-by: Stefano Babic Cc: John Rigby Cc: Fabio Estevam --- Changes from v2: Swap the place of the change log and commit message. Changes from v1: Used appropriate gpio_* lib calls. board/karo/tx25/tx25.c | 25 +++++++++---------------- 1 files changed, 9 insertions(+), 16 deletions(-) diff --git a/board/karo/tx25/tx25.c b/board/karo/tx25/tx25.c index 2a29943..ff2de38 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,15 @@ 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); 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 +103,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_set_value(GPIO_FEC_RESET_B, 1); mdelay(5);