Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp75688ima; Tue, 23 Oct 2018 19:51:33 -0700 (PDT) X-Google-Smtp-Source: AJdET5eKhMvnhz4bOBYyW8Ds6+rqnQJmEN+Rq06hgG1bnPUmUQfiJdx35DF0DWvjWs02xiUs4YFb X-Received: by 2002:aa7:8598:: with SMTP id w24-v6mr863412pfn.77.1540349493930; Tue, 23 Oct 2018 19:51:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540349493; cv=none; d=google.com; s=arc-20160816; b=OsBgHL/KYXOhk9ftz8CyZX9SHuRiiUDbr7U3KrXaBJRAGf/4h00rPv7ZTv1UgfKToD TeBFJf7bCm1Tv9FQJgVAsmfu6Ujat8kDH7OhX1Ckpes4woKYgWnkTjpcIMo0v44Gs7e3 6yE+3ydLMSkXlnYobAddXG09f/j2YXugAuzK53zAODO5X0ZaQ46ao2HxpyNRhv/x6Ytk kbJXv2NYoO7G95qB70U7SVfvyyFROsD7pNh9OROaQdWmbQrSPquvMDGPId7pjAj5Y+vR 50fy9fq265+x16/M+2caAuVutP0J11BiYRiKHDiRdDG2tAunidqcUEHUgjaEEiD9uUkw 1x/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature; bh=88Bk73JhFI8S45jYy2+Xy+cZeA7EfsJEjxfoMVPvu80=; b=shtHZAm4r0GMJqulP8aJgPtBj/tEslJB6KjHvH0aOjjVGi6fD5JUObmOLNtBOa5foZ MYTLn2f3rip5JnTes3wCHzwTIQhUnK/UK4TgHAeMbUG5ONY9uZUAAqs2LdmQNM5uZkDY SQaXIsIlxG3qz5Ye8V/3lFSWElo+ZxzP/GvM/X5UMZiYKtG9Aox/Orc8Nqbcnv6iHP8c JOA1iDQPz03G7en7I3rt50NhkSJ+pzp4Al1naqQ+6KT2Z2DXDNX4rjaA4w4eLNyp9/sa AfU2+igYNIt6UU2jzxk4aaUqNY050YOcYfcyeUSgbXP14we62l6/TkL7/H7nCjxv9dHR 7JKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector1 header.b=vnJY+CTG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n5-v6si3221152pgg.186.2018.10.23.19.51.18; Tue, 23 Oct 2018 19:51:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector1 header.b=vnJY+CTG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727206AbeJXLQo (ORCPT + 99 others); Wed, 24 Oct 2018 07:16:44 -0400 Received: from mail-eopbgr70042.outbound.protection.outlook.com ([40.107.7.42]:39072 "EHLO EUR04-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725896AbeJXLQn (ORCPT ); Wed, 24 Oct 2018 07:16:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=88Bk73JhFI8S45jYy2+Xy+cZeA7EfsJEjxfoMVPvu80=; b=vnJY+CTG4aojiV9Guf1R6jesFsVUmMJGF8I0/neY9cIDsQxM2iN+j890tMNvoSQCZzXiIY+faxC8ohBfbLGGAx1t5MDTNsBC6Y+/igkCjN8VFgizcAkHb3w7CMjAYBKZwPjykMdVJA1eXJ3HrU6WMOlRAZ/Qf1WE74440qTIgyg= Received: from AM6PR04MB5016.eurprd04.prod.outlook.com (20.177.34.88) by AM6PR04MB4358.eurprd04.prod.outlook.com (52.135.169.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1250.29; Wed, 24 Oct 2018 02:50:32 +0000 Received: from AM6PR04MB5016.eurprd04.prod.outlook.com ([fe80::14d:71ff:bbe0:a643]) by AM6PR04MB5016.eurprd04.prod.outlook.com ([fe80::14d:71ff:bbe0:a643%2]) with mapi id 15.20.1250.028; Wed, 24 Oct 2018 02:50:32 +0000 From: Clark Wang To: "broonie@kernel.org" CC: "linux-spi@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Clark Wang Subject: [PATCH 5/5] spi: lpspi: CLK pin becomes low when CR_RST=1 Thread-Topic: [PATCH 5/5] spi: lpspi: CLK pin becomes low when CR_RST=1 Thread-Index: AQHUa0RU/fO2DSpo+kGys4cA/FBa8A== Date: Wed, 24 Oct 2018 02:50:32 +0000 Message-ID: <20181024024808.14485-5-xiaoning.wang@nxp.com> References: <20181024024808.14485-1-xiaoning.wang@nxp.com> In-Reply-To: <20181024024808.14485-1-xiaoning.wang@nxp.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: SG2PR06CA0110.apcprd06.prod.outlook.com (2603:1096:1:1d::12) To AM6PR04MB5016.eurprd04.prod.outlook.com (2603:10a6:20b:9::24) authentication-results: spf=none (sender IP is ) smtp.mailfrom=xiaoning.wang@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [92.121.68.129] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;AM6PR04MB4358;6:1qrJ4MuEq8vrjMUNPRP0uNVq3ctl4ww/oD2qAlycrLFavTz7UQzh7WqDqx+1PhK4SMpU7rLMFMM/26t7csTij0pU/lAZGnemffaNPP0xvTUurVlRSaOcTmj7Yl5NcUPe6pD78EIoeIxbUGH/4SHOFLeVHkor3lX0c5XvGlwl0z3qUitVEGRc59jDjvPZm5pyUmH4WKBc+9Cpw6GSS7FhIEn/njA2NorhBWYkHYvIhL6UnZ2cfpGh/oMWRnfv8MdB/pedkaxvxYTippAAcycYnAOGj98JlHPmyGZ5c3c6FSCBCbffFD4Qxd8BmaG4yaOHvd0V+FwF6TSGFAQGQKwt2HvGYxi0tWTGHy7OyJ92czqajyO4enHBT/HFpEwPMMj3JIRWrzEmbBP5y4ZdNXbVebTK22oC2pzFXSpz+2efzgQatH+AgWInd4iElDNGkZV4ikqFrtZaixgeIJbD2WgprA==;5:lv2eRmzyCq85ugMmVDyUdcXngeKsnh+iq065JJI+4ncy+cm4tTn2dDHgY0gmCkdGK8mMv/daeB1fgoLdfGNZN49g+JGeVMDzBgcGrA3wjmkEd93GY/ekrtOeOHxDnGzIC3CuXSA6XLgN8zEj5eqUp2IUd+T3kiJyqDAo4zberqQ=;7:jBBQIibMHxjXQD5i9EWhLxMIfkHyL2els+XGDe5HxFoGMddaZmMtzakrgVoTRBTrVDdPAlPRqxspmdCFJVCM5axJdT4vHl9c6rOOUV5x7obpMlQtzDtnSLEwLmIeoVlp0A8aEYFppmZJZ3KJGnBu7WL22eiNxDd0CoojV+VHpcHSwSYpX/dfBkNUFkO0biL2yRhxYDCtbXyKUDjTvRbMOwW+HREyNqLX1iMweK0bF+6Z437bA3WkNcdVe/J0bpeR x-ms-office365-filtering-correlation-id: c38fc723-7cf1-4546-1d04-08d6395b76d3 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020);SRVR:AM6PR04MB4358; x-ms-traffictypediagnostic: AM6PR04MB4358: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(185117386973197); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3002001)(3231355)(944501410)(52105095)(10201501046)(93006095)(93001095)(6055026)(148016)(149066)(150057)(6041310)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123560045)(20161123564045)(201708071742011)(7699051)(76991095);SRVR:AM6PR04MB4358;BCL:0;PCL:0;RULEID:;SRVR:AM6PR04MB4358; x-forefront-prvs: 083526BF8A x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(396003)(376002)(39860400002)(346002)(366004)(136003)(199004)(189003)(36756003)(53936002)(105586002)(71190400001)(99286004)(256004)(386003)(6506007)(71200400001)(102836004)(8936002)(14454004)(7736002)(4326008)(305945005)(1730700003)(81156014)(316002)(106356001)(5640700003)(81166006)(2351001)(2501003)(478600001)(6436002)(54906003)(3846002)(5660300001)(476003)(8676002)(6116002)(11346002)(66066001)(6916009)(26005)(486006)(446003)(68736007)(76176011)(25786009)(6512007)(6486002)(2900100001)(2616005)(2906002)(97736004)(86362001)(1076002)(52116002)(186003)(5250100002);DIR:OUT;SFP:1101;SCL:1;SRVR:AM6PR04MB4358;H:AM6PR04MB5016.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: fQWBfxYO0giIzA2V4mHhixN21AWrqHDRsruaVWYFFCvZ9Swm4Rh89NUYps26zEvZlaKN4778A/JFEEGjGfUL9icbG7qNPV4Pce8satpqK60zdkBFOm1uMSTbpsdeaRdJ+uzIGgJW+gdREwMYLJvTxQOc4pwfM7mBEXJI5ZtVfQjAigpHF/75u1t2U5DhGmhxgJqSW5QjoMw2mlx2yCOSfdT3+BoPm2PLuPRl0PsyRyuBSWaQ4sKPo9HmLhK6jXxbYZRUaMwSkOwc0z4DmYuRDqlfRfwboEfjykYbOnI+SlPrhVUl0DCuzY6wUQiHQv6OCHVdbQJnxxaMmbiwp8Fh4rYgLuRTEF6lHgpwhm+e3jQ= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c38fc723-7cf1-4546-1d04-08d6395b76d3 X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Oct 2018 02:50:32.0670 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR04MB4358 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Remove Reset operation in fsl_lpspi_config(). This RST may cause both CLK and CS pins go from high to low level under cs-gpio mode. Add fsl_lpspi_reset() function after one message transfer to clear all flags in use. Signed-off-by: Xiaoning Wang Reviewed-by: Fugang Duan --- drivers/spi/spi-fsl-lpspi.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/drivers/spi/spi-fsl-lpspi.c b/drivers/spi/spi-fsl-lpspi.c index a8a6699e2741..844b713553d1 100644 --- a/drivers/spi/spi-fsl-lpspi.c +++ b/drivers/spi/spi-fsl-lpspi.c @@ -281,10 +281,6 @@ static int fsl_lpspi_config(struct fsl_lpspi_data *fsl= _lpspi) u32 temp; int ret; =20 - temp =3D CR_RST; - writel(temp, fsl_lpspi->base + IMX7ULP_CR); - writel(0, fsl_lpspi->base + IMX7ULP_CR); - if (!fsl_lpspi->is_slave) { ret =3D fsl_lpspi_set_bitrate(fsl_lpspi); if (ret) @@ -375,6 +371,21 @@ static int fsl_lpspi_wait_for_completion(struct spi_co= ntroller *controller) return 0; } =20 +static int fsl_lpspi_reset(struct fsl_lpspi_data *fsl_lpspi) +{ + u32 temp; + + /* W1C for all flags in SR */ + temp =3D 0x3F << 8; + writel(temp, fsl_lpspi->base + IMX7ULP_SR); + + /* Clear FIFO and disable module */ + temp =3D CR_RRF | CR_RTF; + writel(temp, fsl_lpspi->base + IMX7ULP_CR); + + return 0; +} + static int fsl_lpspi_transfer_one(struct spi_controller *controller, struct spi_device *spi, struct spi_transfer *t) @@ -396,9 +407,7 @@ static int fsl_lpspi_transfer_one(struct spi_controller= *controller, if (ret) return ret; =20 - ret =3D fsl_lpspi_txfifo_empty(fsl_lpspi); - if (ret) - return ret; + fsl_lpspi_reset(fsl_lpspi); =20 return 0; } --=20 2.17.1