From patchwork Thu May 7 23:36:54 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Welling X-Patchwork-Id: 6361291 Return-Path: X-Original-To: patchwork-linux-spi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 76C669F1C2 for ; Thu, 7 May 2015 23:38:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 99AE72038F for ; Thu, 7 May 2015 23:38:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AC504202A1 for ; Thu, 7 May 2015 23:38:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752506AbbEGXhG (ORCPT ); Thu, 7 May 2015 19:37:06 -0400 Received: from mail-ig0-f173.google.com ([209.85.213.173]:38622 "EHLO mail-ig0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751333AbbEGXhC (ORCPT ); Thu, 7 May 2015 19:37:02 -0400 Received: by igbhj9 with SMTP id hj9so7750841igb.1; Thu, 07 May 2015 16:37:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=Ut+nTt6mMYRLDZCpsT9dlG84ojsYnU29A7IZ1ks2M70=; b=gHV/L48Ovm3IR/J7kYmjZ53HDq5yHZ6XjN127hikSU8pAwYnFZKDT6JEKhUXzPFN/A ZVaAMBr0+NBSAs5OcYOr4CtOV9qZiPa9kvz/+16By/jirxkrmRDBCjabbv1AObIgkaGh ePvLMmB2RZzpUZh0MG/sT138/BhzRnVP7fqIP0KSLIoFh2rXAdEcp8V41C64+n3EZV5x 6pNgw6m3FlqaWHgDvlcGoYfSCeWJqVvn6YeC6DGebI+KoQ/MfgXe4nD3Tw6MmMbazok7 tkc1aKAL0G6BrCZevoICIr1eLSvmDh3xnNeu5qhsU+Xyx5DeHz3CAwNMBIZn8drewCz5 fEPg== X-Received: by 10.107.12.93 with SMTP id w90mr1509102ioi.10.1431041822089; Thu, 07 May 2015 16:37:02 -0700 (PDT) Received: from deathray.hitronhub.home (173-22-240-38.client.mchsi.com. [173.22.240.38]) by mx.google.com with ESMTPSA id v14sm2584027igd.12.2015.05.07.16.37.01 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 07 May 2015 16:37:01 -0700 (PDT) From: Michael Welling To: broonie@kernel.org, linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Michael Welling Subject: [PATCH v4 2/2] spi: omap2-mcspi: Add gpio_request and init CS Date: Thu, 7 May 2015 18:36:54 -0500 Message-Id: <1431041814-24757-3-git-send-email-mwelling@ieee.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1431041814-24757-1-git-send-email-mwelling@ieee.org> References: <1431041814-24757-1-git-send-email-mwelling@ieee.org> Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP If GPIO chipselects are specified initialise the GPIO in the setup function. Signed-off-by: Michael Welling --- drivers/spi/spi-omap2-mcspi.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c index 3ac06ad..370c333 100644 --- a/drivers/spi/spi-omap2-mcspi.c +++ b/drivers/spi/spi-omap2-mcspi.c @@ -35,6 +35,7 @@ #include #include +#include #include @@ -1015,6 +1016,12 @@ static int omap2_mcspi_setup(struct spi_device *spi) if (ret < 0) return ret; + if (gpio_is_valid(spi->cs_gpio)) { + if (gpio_request(spi->cs_gpio, dev_name(&spi->dev)) == 0) + gpio_direction_output(spi->cs_gpio, + !(spi->mode & SPI_CS_HIGH)); + } + ret = omap2_mcspi_setup_transfer(spi, NULL); pm_runtime_mark_last_busy(mcspi->dev); pm_runtime_put_autosuspend(mcspi->dev);