From patchwork Thu Jun 20 07:13:39 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Lin X-Patchwork-Id: 252765 X-Patchwork-Delegate: albert.aribaud@free.fr 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 B14C22C02AC for ; Thu, 20 Jun 2013 17:14:11 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 34F164A114; Thu, 20 Jun 2013 09:14:10 +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 6TQGQEXmukep; Thu, 20 Jun 2013 09:14:10 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B1FB64A105; Thu, 20 Jun 2013 09:14:04 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 7A5664A105 for ; Thu, 20 Jun 2013 09:13:58 +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 cCrCumtcYcuD for ; Thu, 20 Jun 2013 09:13:52 +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-pa0-f46.google.com (mail-pa0-f46.google.com [209.85.220.46]) by theia.denx.de (Postfix) with ESMTPS id 4B4F24A0EF for ; Thu, 20 Jun 2013 09:13:46 +0200 (CEST) Received: by mail-pa0-f46.google.com with SMTP id fa11so5969616pad.5 for ; Thu, 20 Jun 2013 00:13:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=message-id:subject:from:to:cc:date:content-type:x-mailer :mime-version:content-transfer-encoding:x-gm-message-state; bh=FCeZIqh4zhKPxbkCzrU19dRUQv2yOuo//mz4cXofRCE=; b=ffNJL77hr8gsmWAzfXHJ65wNiBxHK0uT3Yl6v5KB+tN5Hw7G0QjH9OG/kbpHzAZjvD 5uutaqOzxhSp1hNU76xw+87JRWWKV6NDB2Kx58AI5Eg1Xh03yoGuL9aFnQd1QQIgCYRM eBzHeaVOu3Zws60f/fw8MMLHlXXaaRWHT3FUJGk4bCZYLIzvjaNyyREH2zZEG05QjEiY AdenjpTh9dIpb4ZaZKd7KAchEo2rbdFiw8ZnFWwm/VXEyvnQhlPWJ+Mm6w2LsEM+voxe S29BF+wIKFjgt2szIe4YUm2gUS1lqA4mGvMLUOYmG54Dx+H2pOWH6rbg0SZot7eL084E Z0zQ== X-Received: by 10.68.243.40 with SMTP id wv8mr6313122pbc.34.1371712425410; Thu, 20 Jun 2013 00:13:45 -0700 (PDT) Received: from [192.168.0.100] (218-173-175-221.dynamic.hinet.net. [218.173.175.221]) by mx.google.com with ESMTPSA id ot10sm26608314pbb.12.2013.06.20.00.13.42 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 20 Jun 2013 00:13:44 -0700 (PDT) Message-ID: <1371712419.4200.1.camel@phoenix> From: Axel Lin To: Stefan Roese Date: Thu, 20 Jun 2013 15:13:39 +0800 X-Mailer: Evolution 3.6.4-0ubuntu1 Mime-Version: 1.0 X-Gm-Message-State: ALoCoQm7XcBLG5ObhCfr6BIJSRp/iAPJxM9TyHG4Lt0BovQtQCfj3CvcR+frOvG5n2QvcB9iWwhx Cc: Vasut , Marek@theia.denx.de, u-boot@lists.denx.de, Tom Rini Subject: [U-Boot] [PATCH] gpio: spear_gpio: Fix gpio_set_value() implementation 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 In current gpio_set_value() implementation, it always sets the gpio control bit no matter the value argument is 0 or 1. Thus the GPIOs never set to low. This patch fixes this bug. Signed-off-by: Axel Lin Acked-by: Stefan Roese --- drivers/gpio/spear_gpio.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/gpio/spear_gpio.c b/drivers/gpio/spear_gpio.c index d3c728e..8878608 100644 --- a/drivers/gpio/spear_gpio.c +++ b/drivers/gpio/spear_gpio.c @@ -52,7 +52,10 @@ int gpio_set_value(unsigned gpio, int value) { struct gpio_regs *regs = (struct gpio_regs *)CONFIG_GPIO_BASE; - writel(1 << gpio, ®s->gpiodata[DATA_REG_ADDR(gpio)]); + if (value) + writel(1 << gpio, ®s->gpiodata[DATA_REG_ADDR(gpio)]); + else + writel(0, ®s->gpiodata[DATA_REG_ADDR(gpio)]); return 0; }