From patchwork Mon Apr 14 06:29:59 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Barry Song <21cnbao@gmail.com> X-Patchwork-Id: 3976711 Return-Path: X-Original-To: patchwork-linux-spi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E7B79BFF02 for ; Mon, 14 Apr 2014 06:31:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2569A201C8 for ; Mon, 14 Apr 2014 06:31:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 41909201CE for ; Mon, 14 Apr 2014 06:31:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750831AbaDNGbB (ORCPT ); Mon, 14 Apr 2014 02:31:01 -0400 Received: from mail-pd0-f179.google.com ([209.85.192.179]:64658 "EHLO mail-pd0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750751AbaDNGbA (ORCPT ); Mon, 14 Apr 2014 02:31:00 -0400 Received: by mail-pd0-f179.google.com with SMTP id w10so7648837pde.24 for ; Sun, 13 Apr 2014 23:31:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=vnbpugOnDQMpKpmJR3FzoY8FyrIystiPIHempvvaVR4=; b=Dv74VJNxev2qNfkj16ElGZgcDFC86qMfR56SBaGHE/ktk1dvY746SpkbVT9qQ9fMl1 YyikGFzCRBVNvRQVpmM541LQJyInqLeRrOAF5CA4yRhOY9SJ7uSFU6FGtgZvI4OHLicr 8X9QkRnkt3R6I1eIbiUgwML69XC7IzHsrGOEbDRZCSfYH8B3AbTyg+kDStYxo19re3Jo KMqZiLspA1Pr2tRoOJ1LjbT0izItWBh+Ry+hyARkZEo0H2JATiAu2ptLObpmpxtLJ0S7 HrD5cX0Kg3bdQfU4hNEJiXer05g3oE2VgpRz6TeNgm4jYBIf3Dn1dz27heuf0+WpASuS UrQA== X-Received: by 10.68.113.194 with SMTP id ja2mr42388680pbb.30.1397457060195; Sun, 13 Apr 2014 23:31:00 -0700 (PDT) Received: from localhost.localdomain ([117.136.8.58]) by mx.google.com with ESMTPSA id cz3sm31653608pbc.9.2014.04.13.23.30.56 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 13 Apr 2014 23:30:59 -0700 (PDT) From: Barry Song <21cnbao@gmail.com> To: broonie@kernel.org, linux-spi@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, workgroup.linux@csr.com, Qipan Li , Barry Song Subject: [PATCH 3/5] spi: sirf: make GPIO chipselect function work well Date: Mon, 14 Apr 2014 14:29:59 +0800 Message-Id: <1397457001-5266-4-git-send-email-21cnbao@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1397457001-5266-1-git-send-email-21cnbao@gmail.com> References: <1397457001-5266-1-git-send-email-21cnbao@gmail.com> Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 From: Qipan Li orignal GPIO chipslect is not standard because it don't take care to the chipselect signal: BITBANG_CS_ACTIVE and BITBANG_CS_INACTIVE. Signed-off-by: Qipan Li Signed-off-by: Barry Song --- drivers/spi/spi-sirf.c | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-) diff --git a/drivers/spi/spi-sirf.c b/drivers/spi/spi-sirf.c index 9b30743..67d8909 100644 --- a/drivers/spi/spi-sirf.c +++ b/drivers/spi/spi-sirf.c @@ -470,7 +470,16 @@ static void spi_sirfsoc_chipselect(struct spi_device *spi, int value) writel(regval, sspi->base + SIRFSOC_SPI_CTRL); } else { int gpio = sspi->chipselect[spi->chip_select]; - gpio_direction_output(gpio, spi->mode & SPI_CS_HIGH ? 0 : 1); + switch (value) { + case BITBANG_CS_ACTIVE: + gpio_direction_output(gpio, + spi->mode & SPI_CS_HIGH ? 1 : 0); + break; + case BITBANG_CS_INACTIVE: + gpio_direction_output(gpio, + spi->mode & SPI_CS_HIGH ? 0 : 1); + break; + } } }