From patchwork Mon Dec 7 07:07:16 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Werner X-Patchwork-Id: 7780951 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.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id EE4BFBEEE1 for ; Mon, 7 Dec 2015 07:15:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 324DC203F4 for ; Mon, 7 Dec 2015 07:15:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 46B9420412 for ; Mon, 7 Dec 2015 07:15:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752776AbbLGHPl (ORCPT ); Mon, 7 Dec 2015 02:15:41 -0500 Received: from mail1.bemta14.messagelabs.com ([193.109.254.111]:31027 "EHLO mail1.bemta14.messagelabs.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752625AbbLGHPl (ORCPT ); Mon, 7 Dec 2015 02:15:41 -0500 X-Greylist: delayed 391 seconds by postgrey-1.27 at vger.kernel.org; Mon, 07 Dec 2015 02:15:41 EST Received: from [85.158.140.195] by server-7.bemta-14.messagelabs.com id 46/4F-28221-39035665; Mon, 07 Dec 2015 07:09:07 +0000 X-Env-Sender: Andreas.Werner@men.de X-Msg-Ref: server-7.tower-193.messagelabs.com!1449472146!8816149!1 X-Originating-IP: [80.255.6.145] X-StarScan-Received: X-StarScan-Version: 7.35; banners=-,-,- X-VirusChecked: Checked Received: (qmail 13266 invoked from network); 7 Dec 2015 07:09:07 -0000 Received: from unknown (HELO keys.men.de) (80.255.6.145) by server-7.tower-193.messagelabs.com with AES128-SHA encrypted SMTP; 7 Dec 2015 07:09:07 -0000 Received: from MEN-EX01.intra.men.de ([192.168.1.1]) by keys.men.de (PGP Universal service); Mon, 07 Dec 2015 08:09:07 +0100 X-PGP-Universal: processed; by keys.men.de on Mon, 07 Dec 2015 08:09:07 +0100 Received: from awelinux (192.1.1.170) by MEN-EX01.intra.men.de (192.168.1.1) with Microsoft SMTP Server (TLS) id 15.0.1076.9; Mon, 7 Dec 2015 08:09:06 +0100 Date: Mon, 7 Dec 2015 08:07:16 +0100 From: Andreas Werner To: CC: , Subject: [PATCH] spi/spi-fsl-espi.c: Add spi cs polarity support Message-ID: <20151207070657.GA25586@awelinux> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) X-Originating-IP: [192.1.1.170] X-ClientProxiedBy: MEN-EX01.intra.men.de (192.168.1.1) To MEN-EX01.intra.men.de (192.168.1.1) X-EXCLAIMER-MD-CONFIG: e4841e51-7998-49c0-ba41-8b8a0e2d8962 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.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 Add CS polarity flag to be able to set the CS polarity via the DT property spi-cs-high. Signed-off-by: Andreas Werner --- drivers/spi/spi-fsl-espi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi-fsl-espi.c b/drivers/spi/spi-fsl-espi.c index c27124a..2dc70953 100644 --- a/drivers/spi/spi-fsl-espi.c +++ b/drivers/spi/spi-fsl-espi.c @@ -495,7 +495,7 @@ static int fsl_espi_setup(struct spi_device *spi) ®_base->csmode[spi->chip_select]); /* mask out bits we are going to set */ cs->hw_mode &= ~(CSMODE_CP_BEGIN_EDGECLK | CSMODE_CI_INACTIVEHIGH - | CSMODE_REV); + | CSMODE_REV | CSMODE_POL_1); if (spi->mode & SPI_CPHA) cs->hw_mode |= CSMODE_CP_BEGIN_EDGECLK; @@ -503,6 +503,8 @@ static int fsl_espi_setup(struct spi_device *spi) cs->hw_mode |= CSMODE_CI_INACTIVEHIGH; if (!(spi->mode & SPI_LSB_FIRST)) cs->hw_mode |= CSMODE_REV; + if (!(spi->mode & SPI_CS_HIGH)) + cs->hw_mode |= CSMODE_POL_1; /* Handle the loop mode */ loop_mode = mpc8xxx_spi_read_reg(®_base->mode);