From patchwork Tue Jul 14 13:23:25 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Andrew Y. Kuksov" X-Patchwork-Id: 6787091 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 569EEC05AC for ; Tue, 14 Jul 2015 13:23:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5B85420663 for ; Tue, 14 Jul 2015 13:23:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 725EB206F4 for ; Tue, 14 Jul 2015 13:23:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752403AbbGNNXi (ORCPT ); Tue, 14 Jul 2015 09:23:38 -0400 Received: from mail-la0-f49.google.com ([209.85.215.49]:35161 "EHLO mail-la0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752784AbbGNNXh (ORCPT ); Tue, 14 Jul 2015 09:23:37 -0400 Received: by lahh5 with SMTP id h5so5974937lah.2 for ; Tue, 14 Jul 2015 06:23:35 -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; bh=B4N1fITw5pxeRiSAABfKEZKlS+1wYQmdgEViIeIQ4Mc=; b=0P8I/RZqMveSTKR0GfgDVU7UJsGfWlhQafM3IWOWVGzq0AfFXLYNMT+0f5WboP0Eai 4negXV08AO1FnKq/Yb47GLdlOS7F695uCWhY5j56YOyOAHdmu6GuGc+0juPlMh/YFbeP O/BTfYIbsYJ11KssZQ9muc3zRELQX2e3DMkZK0ss9+/2dhevKVyJKYuDgfPePHqh8jYl OKPW+9SpGylY05XoSGdktqcd2y326lcRFOt81IvHIxmNkt6LQaI7Ogn/Zk2aVHz0NYTd Wqj9JhHv5MLgXpkDa8gVv4ypMZAvWaV/vXLPuSZpLfS7nRORPFioISxHm9MujXBgUEL8 v1fg== X-Received: by 10.152.205.1 with SMTP id lc1mr14966801lac.75.1436880215489; Tue, 14 Jul 2015 06:23:35 -0700 (PDT) Received: from localhost.localdomain ([194.85.169.3]) by smtp.gmail.com with ESMTPSA id si3sm279935lbb.32.2015.07.14.06.23.34 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 14 Jul 2015 06:23:34 -0700 (PDT) From: "Andrew Y. Kuksov" To: broonie@kernel.org Cc: linux-spi@vger.kernel.org, shawnguo@kernel.org, linux-arm-kernel@lists.infradead.org, "Andrew Y. Kuksov" Subject: [PATCH] spi: imx: fix ecspi mode setup Date: Tue, 14 Jul 2015 16:23:25 +0300 Message-Id: <1436880205-25023-1-git-send-email-qxovxp@gmail.com> X-Mailer: git-send-email 2.1.0 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.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_WEB, 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 Fixed problem with setting spi mode 0 or 1 after setting mode 2 or 3 Signed-off-by: Andrew Y. Kuksov --- drivers/spi/spi-imx.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c index eb7d3a6..36b6ece 100644 --- a/drivers/spi/spi-imx.c +++ b/drivers/spi/spi-imx.c @@ -335,13 +335,20 @@ static int __maybe_unused mx51_ecspi_config(struct spi_imx_data *spi_imx, if (config->mode & SPI_CPHA) cfg |= MX51_ECSPI_CONFIG_SCLKPHA(config->cs); + else + cfg &= ~MX51_ECSPI_CONFIG_SCLKPHA(config->cs); if (config->mode & SPI_CPOL) { cfg |= MX51_ECSPI_CONFIG_SCLKPOL(config->cs); cfg |= MX51_ECSPI_CONFIG_SCLKCTL(config->cs); + } else { + cfg &= ~MX51_ECSPI_CONFIG_SCLKPOL(config->cs); + cfg &= ~MX51_ECSPI_CONFIG_SCLKCTL(config->cs); } if (config->mode & SPI_CS_HIGH) cfg |= MX51_ECSPI_CONFIG_SSBPOL(config->cs); + else + cfg &= ~MX51_ECSPI_CONFIG_SSBPOL(config->cs); writel(ctrl, spi_imx->base + MX51_ECSPI_CTRL); writel(cfg, spi_imx->base + MX51_ECSPI_CONFIG);