From patchwork Tue Dec 8 06:43:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Bondarenko X-Patchwork-Id: 7794851 Return-Path: X-Original-To: patchwork-linux-spi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 0DDAF9F39B for ; Tue, 8 Dec 2015 06:47:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 25988204E3 for ; Tue, 8 Dec 2015 06:47:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 251D7204EA for ; Tue, 8 Dec 2015 06:46:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932460AbbLHGqp (ORCPT ); Tue, 8 Dec 2015 01:46:45 -0500 Received: from mail-lf0-f50.google.com ([209.85.215.50]:33656 "EHLO mail-lf0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932830AbbLHGnz (ORCPT ); Tue, 8 Dec 2015 01:43:55 -0500 Received: by lfaz4 with SMTP id z4so6395074lfa.0; Mon, 07 Dec 2015 22:43:53 -0800 (PST) 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=Ii4h0OT0YrPq03m8qesW5C5J7wwTGtP7cyXZXm5cJ0A=; b=G6tahFrsdY8Qb5n7OAQIjZQd0GfTITeWCZ/N45R6PT7FMCkqs9Sdkag9WRkzNXvnRL wqnwkDzTy61Ut3fHiNP8ZR9xh/Igng1UmSzz5Zl7LAK8lw+PhI3lAqXpe7lSFv3boLIu 3XuOOaUMOfddD6QyPsaDL7FKXi7ZTK7bvY7zXrz7ZcXdtSgllCGk2Hd/ay7jUHJjBEYU Wo1/a/lzEPsibStatictPziUhviL6XAOnTX8UN/iuPCVIOITywgUJrpXHqQttVfiO55q Oxm3HFb4IGeM62nMMwYUE9pRdZhfHbKa1uN8pmaCWvpV73ABNGjkApY2oIumtICwdUoI rfaw== X-Received: by 10.25.213.145 with SMTP id m139mr768026lfg.150.1449557033871; Mon, 07 Dec 2015 22:43:53 -0800 (PST) Received: from localhost.localdomain (c-89-233-200-205.cust.bredband2.com. [89.233.200.205]) by smtp.gmail.com with ESMTPSA id d2sm286875lbc.11.2015.12.07.22.43.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 07 Dec 2015 22:43:53 -0800 (PST) From: Anton Bondarenko To: broonie@kernel.org, b38343@freescale.com, s.hauer@pengutronix.de Cc: linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, vladimir_zapolskiy@mentor.com, jiada_wang@mentor.com Subject: [PATCH v6 1/8] spi: imx: fix loopback mode setup after controller reset Date: Tue, 8 Dec 2015 07:43:43 +0100 Message-Id: <1449557030-27525-2-git-send-email-anton.bondarenko.sama@gmail.com> X-Mailer: git-send-email 2.6.3 In-Reply-To: <1449557030-27525-1-git-send-email-anton.bondarenko.sama@gmail.com> References: <1449557030-27525-1-git-send-email-anton.bondarenko.sama@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=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, 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 If controller hold in reset it's not possible to write any register except CTRL. So all other registers must be updated only after controller bring out from reset. Signed-off-by: Anton Bondarenko --- drivers/spi/spi-imx.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c index 410522f..3aa33c8 100644 --- a/drivers/spi/spi-imx.c +++ b/drivers/spi/spi-imx.c @@ -356,6 +356,9 @@ static int __maybe_unused mx51_ecspi_config(struct spi_imx_data *spi_imx, else cfg &= ~MX51_ECSPI_CONFIG_SSBPOL(config->cs); + /* CTRL register always go first to bring out controller from reset */ + writel(ctrl, spi_imx->base + MX51_ECSPI_CTRL); + reg = readl(spi_imx->base + MX51_ECSPI_TESTREG); if (config->mode & SPI_LOOP) reg |= MX51_ECSPI_TESTREG_LBC; @@ -363,7 +366,6 @@ static int __maybe_unused mx51_ecspi_config(struct spi_imx_data *spi_imx, reg &= ~MX51_ECSPI_TESTREG_LBC; writel(reg, spi_imx->base + MX51_ECSPI_TESTREG); - writel(ctrl, spi_imx->base + MX51_ECSPI_CTRL); writel(cfg, spi_imx->base + MX51_ECSPI_CONFIG); /*