From patchwork Sun Sep 11 18:37:33 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Fernandes X-Patchwork-Id: 114245 X-Patchwork-Delegate: trini@ti.com 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 561F4B7256 for ; Mon, 12 Sep 2011 04:37:59 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 705EF281BC; Sun, 11 Sep 2011 20:37:56 +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 uNkHz-bh7jbA; Sun, 11 Sep 2011 20:37:56 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id EE538281BD; Sun, 11 Sep 2011 20:37:53 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id DEDF7281BD for ; Sun, 11 Sep 2011 20:37:51 +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 ryrHaAVlHPR7 for ; Sun, 11 Sep 2011 20:37:50 +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-yw0-f44.google.com (mail-yw0-f44.google.com [209.85.213.44]) by theia.denx.de (Postfix) with ESMTPS id 861FF281BC for ; Sun, 11 Sep 2011 20:37:48 +0200 (CEST) Received: by ywa6 with SMTP id 6so1079697ywa.3 for ; Sun, 11 Sep 2011 11:37:46 -0700 (PDT) Received: by 10.101.166.31 with SMTP id t31mr3416554ano.73.1315766266205; Sun, 11 Sep 2011 11:37:46 -0700 (PDT) Received: from localhost.localdomain (cpe-76-184-244-226.tx.res.rr.com [76.184.244.226]) by mx.google.com with ESMTPS id w16sm11553922anl.2.2011.09.11.11.37.43 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 11 Sep 2011 11:37:44 -0700 (PDT) From: Joel A Fernandes To: u-boot@lists.denx.de Date: Sun, 11 Sep 2011 13:37:33 -0500 Message-Id: <1315766253-11093-1-git-send-email-agnel.joel@gmail.com> X-Mailer: git-send-email 1.7.1 To: u-boot@lists.denx.de Cc: Greg Turner , beagleboard@googlegroups.com, k-kooi@ti.com Subject: [U-Boot] [PATCH] BeagleBoard: Remove userbutton command and use gpio command instead X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Remove userbutton command and do the detection in board config file using the gpio command Signed-off-by: Joel A Fernandes Signed-off-by: Jason Kridner --- This addresses the suggestions at: http://patchwork.ozlabs.org/patch/110123/ Also, with the removal of the userbutton command, all checkpatch errors are automatically fixed. board/ti/beagle/beagle.c | 55 ---------------------------------------- include/configs/omap3_beagle.h | 11 ++++++- 2 files changed, 9 insertions(+), 57 deletions(-) diff --git a/board/ti/beagle/beagle.c b/board/ti/beagle/beagle.c index 8cdceaf..9ce8aeb 100644 --- a/board/ti/beagle/beagle.c +++ b/board/ti/beagle/beagle.c @@ -479,58 +479,3 @@ int ehci_hcd_init(void) } #endif /* CONFIG_USB_EHCI */ - -/* - * This command returns the status of the user button on beagle xM - * Input - none - * Returns - 1 if button is held down - * 0 if button is not held down - */ -int do_userbutton (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) -{ - int button = 0; - int gpio; - - /* - * pass address parameter as argv[0] (aka command name), - * and all remaining args - */ - switch (get_board_revision()) { - case REVISION_AXBX: - case REVISION_CX: - case REVISION_C4: - gpio = 7; - break; - case REVISION_XM_A: - case REVISION_XM_B: - case REVISION_XM_C: - default: - gpio = 4; - break; - } - gpio_request(gpio, ""); - gpio_direction_input(gpio); - printf("The user button is currently "); - if (gpio_get_value(gpio)) - { - button = 1; - printf("PRESSED.\n"); - } - else - { - button = 0; - printf("NOT pressed.\n"); - } - - gpio_free(gpio); - - return !button; -} - -/* -------------------------------------------------------------------- */ - -U_BOOT_CMD( - userbutton, CONFIG_SYS_MAXARGS, 1, do_userbutton, - "Return the status of the BeagleBoard USER button", - "" -); diff --git a/include/configs/omap3_beagle.h b/include/configs/omap3_beagle.h index 1369c89..0cf81a6 100644 --- a/include/configs/omap3_beagle.h +++ b/include/configs/omap3_beagle.h @@ -164,6 +164,7 @@ #define CONFIG_CMD_PING #define CONFIG_CMD_DHCP #define CONFIG_CMD_SETEXPR /* Evaluate expressions */ +#define CONFIG_CMD_GPIO /* Enable gpio command */ #undef CONFIG_CMD_FLASH /* flinfo, erase, protect */ #undef CONFIG_CMD_FPGA /* FPGA configuration Support */ @@ -277,10 +278,16 @@ "ramboot=echo Booting from ramdisk ...; " \ "run ramargs; " \ "bootm ${loadaddr}\0" \ - + "userbutton=if gpio input 173; then run userbutton_xm; " \ + "else run userbutton_nonxm; fi;\0" \ + "userbutton_xm=gpio input 4;\0" \ + "userbutton_nonxm=gpio input 7;\0" +/* "run userbutton" will return 1 (false) if is pressed and 0 (false) if not */ #define CONFIG_BOOTCOMMAND \ "if mmc rescan ${mmcdev}; then " \ - "if userbutton; then " \ + "if run userbutton; then " \ + "setenv bootenv uEnv.txt;" \ + "else " \ "setenv bootenv user.txt;" \ "fi;" \ "echo SD/MMC found on device ${mmcdev};" \