From patchwork Wed Aug 31 07:31:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Phil Reid X-Patchwork-Id: 9306461 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id EDC58607D2 for ; Wed, 31 Aug 2016 07:32:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E4ED3286EB for ; Wed, 31 Aug 2016 07:32:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D9BF7287A0; Wed, 31 Aug 2016 07:32:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 65242288AA for ; Wed, 31 Aug 2016 07:32:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759131AbcHaHcR (ORCPT ); Wed, 31 Aug 2016 03:32:17 -0400 Received: from 203-59-230-133.perm.iinet.net.au ([203.59.230.133]:38750 "EHLO preid-centos7.electromag.com.au" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1758938AbcHaHcR (ORCPT ); Wed, 31 Aug 2016 03:32:17 -0400 Received: by preid-centos7.electromag.com.au (Postfix, from userid 1000) id E7ACC3003A424; Wed, 31 Aug 2016 15:32:14 +0800 (AWST) From: Phil Reid To: broonie@kernel.org, linux-spi@vger.kernel.org Cc: Phil Reid Subject: [PATCH 1/1] spi: sc18is602: Add reset control via gpio pin. Date: Wed, 31 Aug 2016 15:31:38 +0800 Message-Id: <1472628698-10599-2-git-send-email-preid@electromag.com.au> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1472628698-10599-1-git-send-email-preid@electromag.com.au> References: <1472628698-10599-1-git-send-email-preid@electromag.com.au> Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This sc18is602 has a reset pin that may need to be deasserted. Add optional binding to specifiy the reset pin via a gpio and deassert during probe. Signed-off-by: Phil Reid --- drivers/spi/spi-sc18is602.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/spi/spi-sc18is602.c b/drivers/spi/spi-sc18is602.c index 36af4d4..5666b5d 100644 --- a/drivers/spi/spi-sc18is602.c +++ b/drivers/spi/spi-sc18is602.c @@ -23,6 +23,7 @@ #include #include #include +#include enum chips { sc18is602, sc18is602b, sc18is603 }; @@ -50,6 +51,8 @@ struct sc18is602 { u8 buffer[SC18IS602_BUFSIZ + 1]; int tlen; /* Data queued for tx in buffer */ int rindex; /* Receive data index in buffer */ + + struct gpio_desc *reset; }; static int sc18is602_wait_ready(struct sc18is602 *hw, int len) @@ -257,6 +260,12 @@ static int sc18is602_probe(struct i2c_client *client, hw = spi_master_get_devdata(master); i2c_set_clientdata(client, hw); + /* assert reset and then release */ + hw->reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH); + if (IS_ERR(hw->reset)) + return PTR_ERR(hw->reset); + gpiod_set_value(hw->reset, 0); + hw->master = master; hw->client = client; hw->dev = dev;