From patchwork Sun May 24 02:13:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Welling X-Patchwork-Id: 6470941 Return-Path: X-Original-To: patchwork-linux-arm@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 71C4DC0020 for ; Sun, 24 May 2015 02:18:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B3F2720604 for ; Sun, 24 May 2015 02:18:36 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D85B3205DE for ; Sun, 24 May 2015 02:18:35 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YwLR6-0005bY-NF; Sun, 24 May 2015 02:14:44 +0000 Received: from mail-ig0-x22a.google.com ([2607:f8b0:4001:c05::22a]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YwLQp-0005Wr-8u for linux-arm-kernel@lists.infradead.org; Sun, 24 May 2015 02:14:31 +0000 Received: by igbpi8 with SMTP id pi8so17031811igb.0 for ; Sat, 23 May 2015 19:14:05 -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=PtKFwuhBdYtbKTbrVaCP3lKUVZbTOexuuLIQv0Cf6Gk=; b=bOhaBWd6EaPe6NFSwI/0gdwgDIofUuYXJAqVk0/5Ei5hqWoz6sM2/WXilHFVqnMjyv LxKc14mFlzctPMEYhxBQOIxeGvMYbEmkHBgpELPkdMvyfDsnHwLs9F3SDOXnzmms9Gf+ XaWoz0HgKTHsTzeqmUGVjUGC3sSveTqWyP/9i5bdTSOwWlvjG3V6CZvc9LCmFtck3PzO H9/d932oh5kv59IOY1NSVWwJ+6puPwm+8vWh2auHPi6QjvePBoInLCzJBeyMtvGeZVb6 9SMsRd/BRvkGWhIZRYgFfgtBexHc4cgXrMdsRSgIscjFW1q+cL+/zBoUImumJ4FGGJX7 Ba1w== X-Received: by 10.50.88.71 with SMTP id be7mr15119620igb.20.1432433645258; Sat, 23 May 2015 19:14:05 -0700 (PDT) Received: from localhost.localdomain (74-84-113-14.client.mchsi.com. [74.84.113.14]) by mx.google.com with ESMTPSA id d15sm2847465igo.8.2015.05.23.19.14.03 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 23 May 2015 19:14:04 -0700 (PDT) From: Michael Welling To: broonie@kernel.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-next@vger.kernel.org, linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/4] spi: omap2-mcspi: Fix set_cs function for active high Date: Sat, 23 May 2015 21:13:43 -0500 Message-Id: <1432433625-23407-3-git-send-email-mwelling@ieee.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1432433625-23407-1-git-send-email-mwelling@ieee.org> References: <20150522122544.GL21391@sirena.org.uk> <1432433625-23407-1-git-send-email-mwelling@ieee.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150523_191427_414190_C76EA6E1 X-CRM114-Status: GOOD ( 11.22 ) X-Spam-Score: -0.4 (/) Cc: Michael Welling X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, 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 The core spi driver swaps the polarity of the enable based on SPI_CS_HIGH. The omap2 controller has an internal configuration register bit called OMAP2_MCSPI_CHCONF_EPOL to handle active high chip selects as well. So we have to revert swap the polarity back for the correct setting of the OMAP2_MCSPI_CHCONF_FORCE bit in omap2_mcspi_set_cs. 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 304b427..502db29 100644 --- a/drivers/spi/spi-omap2-mcspi.c +++ b/drivers/spi/spi-omap2-mcspi.c @@ -247,6 +247,13 @@ static void omap2_mcspi_set_cs(struct spi_device *spi, bool enable) { u32 l; + /* The controller handles the inverted chip selects + * using the OMAP2_MCSPI_CHCONF_EPOL bit so revert + * the inversion from the core spi_set_cs function. + */ + if (spi->mode & SPI_CS_HIGH) + enable = !enable; + if (spi->controller_state) { l = mcspi_cached_chconf0(spi);