From patchwork Tue Nov 4 08:20:18 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 5223571 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 12FFCC11AC for ; Tue, 4 Nov 2014 08:26:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 51FAB2013A for ; Tue, 4 Nov 2014 08:26:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7D2E920125 for ; Tue, 4 Nov 2014 08:26:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751223AbaKDI0E (ORCPT ); Tue, 4 Nov 2014 03:26:04 -0500 Received: from webbox1416.server-home.net ([77.236.96.61]:33525 "EHLO webbox1416.server-home.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752148AbaKDI0D (ORCPT ); Tue, 4 Nov 2014 03:26:03 -0500 X-Greylist: delayed 425 seconds by postgrey-1.27 at vger.kernel.org; Tue, 04 Nov 2014 03:26:03 EST Received: from imapserver.systec-electronic.com (unknown [212.185.67.148]) by webbox1416.server-home.net (Postfix) with ESMTPA id 354F827A54C; Tue, 4 Nov 2014 09:18:56 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by imapserver.systec-electronic.com (Postfix) with ESMTP id 17652DA0C7F; Tue, 4 Nov 2014 09:18:56 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at imapserver.systec-electronic.com Received: from imapserver.systec-electronic.com ([127.0.0.1]) by localhost (imapserver.systec-electronic.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Og7sZMQfIK08; Tue, 4 Nov 2014 09:18:53 +0100 (CET) Received: from ws-stein.systec-electronic.de (unknown [192.168.10.109]) by imapserver.systec-electronic.com (Postfix) with ESMTP id 748D8DA0AC8; Tue, 4 Nov 2014 09:18:53 +0100 (CET) From: Alexander Stein To: Mark Brown Cc: Alexander Stein , linux-spi@vger.kernel.org Subject: [PATCH 1/1] spi: fsl-dspi: Fix CTAR selection Date: Tue, 4 Nov 2014 09:20:18 +0100 Message-Id: <1415089218-2011-1-git-send-email-alexander.stein@systec-electronic.com> X-Mailer: git-send-email 2.0.4 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.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 There are only 4 CTAR registers (CTAR0 - CTAR3) so we can only use the lower 2 bits of the chip select to select a CTAR register. SPI_PUSHR_CTAS used the lower 3 bits which would result in wrong bit values if the chip selects 4/5 are used. For those chip selects SPI_CTAR even calculated offsets of non-existing registers. Signed-off-by: Alexander Stein --- drivers/spi/spi-fsl-dspi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c index 4482160..831ceb4 100644 --- a/drivers/spi/spi-fsl-dspi.c +++ b/drivers/spi/spi-fsl-dspi.c @@ -46,7 +46,7 @@ #define SPI_TCR 0x08 -#define SPI_CTAR(x) (0x0c + (x * 4)) +#define SPI_CTAR(x) (0x0c + (((x) & 0x3) * 4)) #define SPI_CTAR_FMSZ(x) (((x) & 0x0000000f) << 27) #define SPI_CTAR_CPOL(x) ((x) << 26) #define SPI_CTAR_CPHA(x) ((x) << 25) @@ -70,7 +70,7 @@ #define SPI_PUSHR 0x34 #define SPI_PUSHR_CONT (1 << 31) -#define SPI_PUSHR_CTAS(x) (((x) & 0x00000007) << 28) +#define SPI_PUSHR_CTAS(x) (((x) & 0x00000003) << 28) #define SPI_PUSHR_EOQ (1 << 27) #define SPI_PUSHR_CTCNT (1 << 26) #define SPI_PUSHR_PCS(x) (((1 << x) & 0x0000003f) << 16)