From patchwork Mon Oct 17 10:02:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yao yuan X-Patchwork-Id: 9379261 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5AF63607D4 for ; Mon, 17 Oct 2016 12:49:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4DEEC292D9 for ; Mon, 17 Oct 2016 12:49:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 429A9292DD; Mon, 17 Oct 2016 12:49:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E33B3292D9 for ; Mon, 17 Oct 2016 12:49:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755088AbcJQMsf (ORCPT ); Mon, 17 Oct 2016 08:48:35 -0400 Received: from mail-sn1nam02on0133.outbound.protection.outlook.com ([104.47.36.133]:34976 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753689AbcJQMrj (ORCPT ); Mon, 17 Oct 2016 08:47:39 -0400 X-Greylist: delayed 3570 seconds by postgrey-1.27 at vger.kernel.org; Mon, 17 Oct 2016 08:47:38 EDT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freescale.onmicrosoft.com; s=selector1-freescale-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=soMlFLY7hlbx7n8jPt4nHvjagiNBx63geQOtej/L16c=; b=EEGOyQ+y3qY9jgFnugfwfQgy5L9U3LYREnQnqnuo/W/VQbW1fA+RuwqEKeyhV+kkSAK7XK/a7yoKYaghwP+7xJmPAJb6sf92O+6thSZrQ2w3oY6DlXUVpKS903NPTaNFLAFpSWDP72uIVTQoRxmnfMr3PssmErOIAHPcbVlSG3g= Received: from BN6PR03CA0030.namprd03.prod.outlook.com (10.175.124.16) by CY1PR0301MB1996.namprd03.prod.outlook.com (10.164.2.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.669.16; Mon, 17 Oct 2016 10:15:01 +0000 Received: from BY2FFO11FD009.protection.gbl (2a01:111:f400:7c0c::166) by BN6PR03CA0030.outlook.office365.com (2603:10b6:404:10c::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.639.5 via Frontend Transport; Mon, 17 Oct 2016 10:15:01 +0000 Authentication-Results: spf=neutral (sender IP is 192.88.168.50) smtp.mailfrom=freescale.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=freescale.com; Received-SPF: Neutral (protection.outlook.com: 192.88.168.50 is neither permitted nor denied by domain of freescale.com) Received: from tx30smr01.am.freescale.net (192.88.168.50) by BY2FFO11FD009.mail.protection.outlook.com (10.1.14.73) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.669.7 via Frontend Transport; Mon, 17 Oct 2016 10:15:00 +0000 Received: from titan.ap.freescale.net ([10.192.208.233]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id u9HAEv16000942; Mon, 17 Oct 2016 03:14:58 -0700 From: Yuan Yao To: CC: , , Subject: [PATCH] spi: dspi: clear SPI_SR before enable interrupt Date: Mon, 17 Oct 2016 18:02:34 +0800 Message-ID: <1476698554-12150-1-git-send-email-yao.yuan@freescale.com> X-Mailer: git-send-email 2.1.0.27.g96db324 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(7916002)(2980300002)(199003)(189002)(356003)(50986999)(92566002)(97736004)(11100500001)(6916009)(42882006)(6666003)(104016004)(5003940100001)(77096005)(48376002)(33646002)(5660300001)(2351001)(2906002)(575784001)(626004)(229853001)(36756003)(68736007)(110136003)(305945005)(7846002)(106466001)(50226002)(8666005)(50466002)(105606002)(19580405001)(87936001)(586003)(8676002)(8936002)(81156014)(19580395003)(81166006)(189998001)(47776003)(4326007)(7059030); DIR:OUT; SFP:1102; SCL:1; SRVR:CY1PR0301MB1996; H:tx30smr01.am.freescale.net; FPR:; SPF:Neutral; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD009; 1:ydnn+jMPXgLDAjvj0tBUfRvhLvupP8GFpi7O1SurIPxch06xXQ0jHRZk0mjAz96Xs0RKzTFCkwGt8Q7Qu9J6HRCBTUWX78gEq2I+Jg45M/i3TheRCQA6Qb/rkow9Q4LYGUnTPRjG5j59PG4u7GnbYWuNWnZC7StvnQQSPyKL1IyCBKAmEVkvJQYZKEwwCbDTlDMRBlr1hLzD55qhzq4jTrlCQrCgSnkWkhreA6op6t+VR61866epodwDbaNl3rkMWUg/0VoS2cc4Eg4BW6mNCnomDS60hw0QpgPsNidNafAgVeqsha4sZ7aNqfeabk1tYqO+XjjTCiXW+69IFQiafbERVPaDIW7doLUKm8lJ8U4tqz3sxlwogv0lMrwIKoZ8zeJOifljseno/UGU6iEDJF24/p2UtlKzT9rlQ5RAX/p88k1gqBLuXRE2n75cW5CMd/qDGhE83zQuiHVNRe+e0KYnB25eXy/GkR5FZ480y9lvrszcbQ+xQIpWCdIwuATWgnmpSMvFtWAcPp1XFSYCLznXUlkU9N9XGTRUzK1zoKU1rug7GvEp57LwQ7q9NlxC6sxefuC7fUH7Pe4ZsO1P7Q== MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 533f3b93-e03b-4606-0f98-08d3f676746e X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1996; 2:4HT34zTTi263GhoqwWVE4L0FWWYLzg04TSZVCsRZ4qcDwee6sGCHtNFb002SAK1Gq6SA6iCU6Bm/RY8cPg37ktbYp4RPtWTt8fOSIr0NMIY8FVpO3OShELtEH4YlsvHRBvXLFhem75DXaOX+/OsohesJZc+VZxUSsBhrmrlKuGJ2Bt08y92aLCP46wlTRcseccv8TWO4is/n05PVZkWweg==; 3:bSpZdayNtvZosDp8U53nnyba3+LGfLcZw9n513bcHQoB4nrYUNXsK5VS67sx/LvyHlxYtyhux+6TRjXJ/BsKqqBGVXwj0sRC8S6nyFeILXw/n9EAtmRcXZbrCKrFNQg/3PKzq+yXT+/NF9A4Zr0VLt4lU+eye0y+y/lLOaJT9o81I5e4FTnYX5KzSu/Ve0q2Y2meeqjTGlBAnjo5FWXhXfgCXbW6856Gnj6hYGbcK/elXaC2UucliHcGaX7QVb0m; 25:/KriM+EK+29U8XbdBjx1+Xp/iu82NfUBbE1qB4FIRaI5jRV0IBdX44KORnNJDvGLTsD+jbfjtkeytr00Kp6Weecfo1/Yo+mEpY5VZtFFWMObZyUyJ5plhhguey66EWFe7ep4aBtfxYWWUlEid27XEy33fkVIKNzpza+d28fDsms7TDkf1oRWVoIFa+ODhJJOe6but1mOMwp8Sd2TQ3iqyZo3J4GGjpyF4YWE0rpfRZDbXgowxe7EuxlnYmGmLEpSrBTq4Im3uMHyj7iAE6nTLY3mQQLi//OG7QRc7DJGSAuk547V+DHeBHe4665ML09R60en1Sjsd8210onAcuFXUvUddknGilHyAe2apNfhCHKrgLGtBPedSn9a54aeg6J7arA9HuG8NKEe/0VimyR4Zab8u35G7m+2XrUsuO7jwRv+toCMMJ0AcUmKyLJST975zdtaqLaKx g/w+DcgAlcozw== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CY1PR0301MB1996; X-LD-Processed: 710a03f5-10f6-4d38-9ff4-a80b81da590d,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1996; 31:Q4Zz2przKpWMQNauS/XNulIsXysqZYdKTJzPh78HiPKRFqD+Z1Jyn9Wu0DriVKVh4WeBOFRkHXLwu4KYczyUOpEGja4MrokowGLhiM3yiuh9puC+EhIkt8tZuNEXsynLse6trPx0jOkoCtEIfXUIMs4XB4TdfTFYa8tMdrtHgTyTNyjomP5Bus/nWXUfrEJQsqMCz9bhuItargV8BffxCDrPf6+xgW5twJGjpxL3kdCLkaLeZ28RViA0jsdEGp+o/NC4KvfI5sQdM+c070MtRQ==; 20:MA8Qc4BzgfgrXnrKqzpR2P6niME3TGqIlzn64qqU3lqPGQL9xHzFIu9IZgChb2rPMNpfpvsmTV5ymHyHSgpBEasuelYMRr7bZIZjHeA8JpryeAtisPwyMRtq11C/KHoWWUOrg2NnfXCucYdqvlHSr7wvNlyS7244p+5jNmwF+dgagqr2gvZxNBQblRX/9yaGNIlpVNmJBhhZYIQrTbdkO8zNN46rBk2aRkAXQrAA4i/DDcs4ra3RuIMF3oYQ/CM4gl7V/FJpAmUGtPW1C4eCtaloUhBpyUfkXJWCgXMmsG2g2qRK47M4ys2oizZnawME1HPDdmAwHHG+vVTzRnjkoyTfBXEoPzRaaGUW99bkFDxsucfgPD5hSvKjupT9C2JalFl+eLascNdVdDIsad+kd6yWf4JrjKv2gpNIM8fiynhk3S6OcW75asT4hxX4IEKyCryLF3Ss7ZKEmZUnkaspMZT+ox60/bEbslIVa26FKd1xO21HPSiAMHj8eiU+8jZ4Df0rQu3nljMh+ZXTEB2Z1NyIyDNGQGNFtR1ENmOX/Ir2TnVp5WQ6iQAKESSOEO2JCRBOZJh7DERaMJd73pCsA3rr0mUjEs8m/L91MOCSRhI= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(13017025)(13023025)(5005006)(8121501046)(13015025)(13024025)(13018025)(10201501046)(3002001)(6055026); SRVR:CY1PR0301MB1996; BCL:0; PCL:0; RULEID:; SRVR:CY1PR0301MB1996; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1996; 4:y/YsIQcrXE1iBq/Ued9FOUFMexAcMfEPiuwQ621Sq5nKhyloElu0ZE8I/BE0/Cl0q+n7d1TuxMshWNZtnSEH29A9zBMCjEjMebF0p/hHmN5C8+MYKBGrCCj7ZSb+FnbbDJ+aXdNjW4G9jAmsWiz6eoPUdthtTmC0Xo9XhMI0oRGd4s+iG52pWHjxlohW0YwUd3fk2VuSH56CAp31X7VTLjLSffbOrwZVVIjGP0d7okpQ2TTxVwwN0aEsFZVgiS2NLdHtQHtToaJFDomqYrcL3N4Iky5N+hMIQX22fGLn/Yo4OVWT3ZZ7hOzVH1z/lu6fNGWgigi4+KT4wtxVy2kQJBpDNzHtMC4w0b+9Kad9QQx/uXLUcsWsHyHAoadNvQ3Tspr8uXDiTPgcC+u4QoKZH5fh4PPs8LK2lWy1gua6yFNEc0e+bmg5zesARx1E7Bc9Zx1V9/wIwI9EyzMHbh+q/FaL2aoLsT0RIF8+IjmTxVHt3Tw/rj4FmqLmPNLPvCYWT4BUSteihmK8CO3ERoyAOqtI+a6emLNikPa2VVJdGQeit/CnOezY/dg8EhhSJRr7 X-Forefront-PRVS: 0098BA6C6C X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR0301MB1996; 23:B8mXawEMaiVR68RNVkMAxhLmKVcW6rVM5JN7sAT?= =?us-ascii?Q?Hs5bFfAuPJ779Snsr1t3h+t+ZlVz0FM+Y00CbLDN2kOz6FGP4xYYqFixMuV1?= =?us-ascii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NH4nVYv/ub2JErT/oDmq7zaeDCXO2y?= =?us-ascii?Q?0DNlY0uT2ttXExg940iXCBWpTZyeiD46a/VJR2gm269TIu5cHlUbPgODDOnJ?= =?us-ascii?Q?difAzLS8dXFbv3n7ROLDQUamKkFGzLdAvli8GRxDBdR3LBNh70w=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1996; 6:NzI/l4cvappj12oUwa96bn6RvI3wA10aY/Qd2POG9mEFifzZ/AjOboIKuf85ErrdUj7xGx/sq56Ml0FzPdZmMokQI/ND5cAS/8QSCmgMiSLyMXZ7rrLDI5A8RxDZqxU6a0msowH+jV0Z8zPoxdciGES/b8mIgTlF4oiL4SIT0t2eBzXhmujOH8TeJog7UQfYb4nl4h+msxQjSX9ntQQ7pSejI03zLOqJhvSnpqQqvxkHaMcCqNN2+Vlci6XXCj0ebjRVIWDvKjocFDnKHzXkQTU2EV+AulHcooe7kHXXu4DEQkljsGGv/Q+UeDlX2iTAPU0LmnJktJ0cfOgushzlyEWonBSyHh9jiEXT4HPj/Jc=; 5:wbIgGDd0StsLYMuvX5At0bCeoDN/iQv1p5d2rmRjcmXZ3aE57pHRG+URFCGLdlahnX6MWa7O0COVDWOoL6laVAnYPPno0C77aTkK1sRdvlaXT5lw3okfFhvx1lpdddjBwHEFwTgoLrbH+TXSVDt2PA==; 24:ppSGj5lgnoDsoI03LC/xwvpSHWN2CDp1G3+TAWmXPNpVZF+FhuQ3GVrxz1gkREmauuEvFetiMX5QoW4m/HBHIHM0pVMtzsR/BN1yqzAxvyI= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1996; 7:yWYQLhe5xRgKGsFBR4JPlsI3+EoUjrho6RYelXu9MMt33QWIxEDu2PrnAccX87Nxi+p+9cngya8ZVfLokKPsZKYqLaOZ9sj8r6Hi2J9hhYExUtPicz7C/e7HDHzvfCHCHVgA48glSQ25TzCKP0dSlghTqLb9EJyZ/z+ClIXBwRqIRvsMdLlbq+OUIY+QaJaMwMwr11ZrH2fyAeL9FF2PRi7qMmZZXNz/rrsmMNgn3USGEZQ10t3gO+RV8IFnyF3NuhvPF0Cpp4yBP0wt8mujy0UY6FDz56gvCdfFtO5G46hmPqj4CLdzv3PaAIYxa6gMpqMtvk37TEYP6VHZOhYS7z+JY3j1vOg323mkPX1Kww8= X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2016 10:15:00.7443 (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.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR0301MB1996 Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Yuan Yao Once dspi is used in uboot, the SPI_SR have been set by some value. At this time, if kernel enable the interrupt before clear the status flag, that will trigger the wrong interrupt. Signed-off-by: Yuan Yao --- drivers/spi/spi-fsl-dspi.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c index 35c0dd9..a67b0ff 100644 --- a/drivers/spi/spi-fsl-dspi.c +++ b/drivers/spi/spi-fsl-dspi.c @@ -70,6 +70,7 @@ #define SPI_SR 0x2c #define SPI_SR_EOQF 0x10000000 #define SPI_SR_TCFQF 0x80000000 +#define SPI_SR_CLEAR 0xdaad0000 #define SPI_RSER 0x30 #define SPI_RSER_EOQFE 0x10000000 @@ -646,6 +647,11 @@ static const struct regmap_config dspi_regmap_config = { .max_register = 0x88, }; +static void dspi_init(struct fsl_dspi *dspi) +{ + regmap_write(dspi->regmap, SPI_SR, SPI_SR_CLEAR); +} + static int dspi_probe(struct platform_device *pdev) { struct device_node *np = pdev->dev.of_node; @@ -709,6 +715,7 @@ static int dspi_probe(struct platform_device *pdev) return PTR_ERR(dspi->regmap); } + dspi_init(dspi); dspi->irq = platform_get_irq(pdev, 0); if (dspi->irq < 0) { dev_err(&pdev->dev, "can't get platform irq\n");