From patchwork Wed May 13 10:12:15 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: haikun wang X-Patchwork-Id: 6395991 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 CA031BEEE1 for ; Wed, 13 May 2015 10:16:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F1D7C20381 for ; Wed, 13 May 2015 10:16:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 13404203DA for ; Wed, 13 May 2015 10:16:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753585AbbEMKQC (ORCPT ); Wed, 13 May 2015 06:16:02 -0400 Received: from mail-by2on0121.outbound.protection.outlook.com ([207.46.100.121]:47590 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753559AbbEMKQA (ORCPT ); Wed, 13 May 2015 06:16:00 -0400 Received: from BN3PR0301CA0011.namprd03.prod.outlook.com (10.160.180.149) by BN1PR0301MB0609.namprd03.prod.outlook.com (10.160.170.24) with Microsoft SMTP Server (TLS) id 15.1.154.19; Wed, 13 May 2015 10:15:58 +0000 Received: from BY2FFO11OLC009.protection.gbl (2a01:111:f400:7c0c::183) by BN3PR0301CA0011.outlook.office365.com (2a01:111:e400:4000::21) with Microsoft SMTP Server (TLS) id 15.1.166.22 via Frontend Transport; Wed, 13 May 2015 10:15:58 +0000 Authentication-Results: spf=fail (sender IP is 192.88.158.2) smtp.mailfrom=freescale.com; freescale.mail.onmicrosoft.com; dkim=none (message not signed) header.d=none; Received-SPF: Fail (protection.outlook.com: domain of freescale.com does not designate 192.88.158.2 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.158.2; helo=az84smr01.freescale.net; Received: from az84smr01.freescale.net (192.88.158.2) by BY2FFO11OLC009.mail.protection.outlook.com (10.1.15.0) with Microsoft SMTP Server (TLS) id 15.1.160.8 via Frontend Transport; Wed, 13 May 2015 10:15:58 +0000 Received: from titan.ap.freescale.net ([10.192.208.233]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id t4DAFtAL007273; Wed, 13 May 2015 03:15:56 -0700 From: Haikun Wang To: CC: , Haikun Wang Subject: [PATCH v1 3/3] spi: spi-fsl-dspi: Bug fix incorrect CS de-assert Date: Wed, 13 May 2015 18:12:15 +0800 Message-ID: <1431511935-19820-1-git-send-email-haikun.wang@freescale.com> X-Mailer: git-send-email 2.1.0.27.g96db324 X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11OLC009; 1:Qry9g3fP2V5R4J3Ik+3bSZEE6p91hmMfkDadPlp/JmoGwOMFxDYcsdN1untFRvgZeliI03zxjeSGBTQSqD3IJIxvAszvRUbDa5Fz73Ipe01k3O4jdGX5ZpknrY+pcJXpVuLCn4Ifarc+3QEZgUo3nq5KO25GPp7D3tqUdu3qLz8UjEQ+MMGQX6ca43OVXaNSx6EJC4DclU83UMVj1h3yTJhkv55hWRPZkB+WCoZpq3+JN8gdWhqdAwskLtCXBFJWmS8ya1zpQpLbfj8JoZDLtLaxTbepLVWz31NeUkltG23JNx+SjKVq7pjQ1x7Zp4hkKYVtSaTt/2/XpZIicP3wOA== X-Forefront-Antispam-Report: CIP:192.88.158.2; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(339900001)(189002)(199003)(85426001)(50226001)(33646002)(86362001)(92566002)(77096005)(77156002)(62966003)(47776003)(50466002)(6806004)(106466001)(104016003)(48376002)(230783001)(46102003)(189998001)(87936001)(36756003)(110136002)(5001960100002)(107886002)(50986999)(105606002)(2351001)(229853001)(19580395003)(19580405001)(4001430100001); DIR:OUT; SFP:1102; SCL:1; SRVR:BN1PR0301MB0609; H:az84smr01.freescale.net; FPR:; SPF:Fail; MLV:sfv; MX:1; A:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BN1PR0301MB0609; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(5005006)(3002001); SRVR:BN1PR0301MB0609; BCL:0; PCL:0; RULEID:; SRVR:BN1PR0301MB0609; X-Forefront-PRVS: 0575F81B58 X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 May 2015 10:15:58.7782 (UTC) X-MS-Exchange-CrossTenant-Id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=710a03f5-10f6-4d38-9ff4-a80b81da590d; Ip=[192.88.158.2]; Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN1PR0301MB0609 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=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 SPI chip select signal need to keep asserted between several spi_transfer in the same spi_message usually. But the driver will de-assert CS signal and the assert it between serval spi_transfer in the same spi_message under some condiations. This patch fix the bug. Here is an example: Assume you have two variables like the following, struct spi_transfer a; struct spi_transfer b; if you send a spi_message only includes 'a' first, and then you send a spi_message includes 'a' and 'b' but without resetting 'a'. Driver will de-assert CS and then assert CS between 'a' and 'b'. Signed-off-by: Haikun Wang --- 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 f6e2ef9..557842a 100644 --- a/drivers/spi/spi-fsl-dspi.c +++ b/drivers/spi/spi-fsl-dspi.c @@ -365,10 +365,10 @@ static int dspi_transfer_one_message(struct spi_master *master, dspi->cur_msg = message; dspi->cur_chip = spi_get_ctldata(spi); dspi->cs = spi->chip_select; + dspi->cs_change = 0; if (dspi->cur_transfer->transfer_list.next == &dspi->cur_msg->transfers) - transfer->cs_change = 1; - dspi->cs_change = transfer->cs_change; + dspi->cs_change = 1; dspi->void_write_data = dspi->cur_chip->void_write_data; dspi->dataflags = 0;