From patchwork Tue Apr 23 13:51:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robin Gong X-Patchwork-Id: 10913117 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 45EC61708 for ; Tue, 23 Apr 2019 13:52:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 33363286DB for ; Tue, 23 Apr 2019 13:52:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 26A3E287E3; Tue, 23 Apr 2019 13:52:10 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B3F5028740 for ; Tue, 23 Apr 2019 13:52:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:In-Reply-To:References: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=dVgIW9GKbxag54+bJHHktz88S+eWLDs601eT7rNeiXA=; b=ewmBJU3l5hDNNn gEB7Es+whRdjARO5FYyjq79pw54zjAn9ZdRn8+s5fWGw4vM6E5Kofu0uiuH+RIDdnx+UchYoczXp6 6Ij99J/1dpqsImUICXVHMSy3BzSbvG/kjvfUgTMolY+B2jz/eSAV3ENCFxXjUJCWJZOiWgddNzRXi XOZathue5d1DIu378KYr9xBdbBFDQ6VpdOCAVN86FF4+5xP8vd5t5g4H3wp3X6g5K32irxjGCG44z Nn4CGBQ3y60OU2IM6Y59eoBAQ4eO5shFu5PFn9UszVy9Dq1CIJF6AAlB0FF3OqBB5Cc85Xfb275nY /fDbvjWA2m7k1cSRqOhA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hIvq8-0003Uh-AW; Tue, 23 Apr 2019 13:52:04 +0000 Received: from mail-ve1eur02on0604.outbound.protection.outlook.com ([2a01:111:f400:fe06::604] helo=EUR02-VE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hIvpO-0002Nh-Au for linux-arm-kernel@lists.infradead.org; Tue, 23 Apr 2019 13:51:20 +0000 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=k50CCJij/s6qWEO4Fq0H7vns/NMsTvl743kCznP12O4=; b=w9FhmcBj6E+Ko9VOavtxfM10YxU8kre/U46nyMxeaEq63DOCNnHELF2GMcTNno53nZCCi6lVNQHpK/DTlzRndBZTwnWp/OnQfc+SKUGVk5z/DwmuJ9NKK9tLqH0C5J8vWrRgwOT6ja76xCeYhG/WTk/p9gY9Y/SFgW2U+scuhrQ= Received: from VI1PR04MB4543.eurprd04.prod.outlook.com (20.177.55.90) by VI1PR04MB5901.eurprd04.prod.outlook.com (20.178.205.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1813.12; Tue, 23 Apr 2019 13:51:10 +0000 Received: from VI1PR04MB4543.eurprd04.prod.outlook.com ([fe80::5d07:911b:18e1:1525]) by VI1PR04MB4543.eurprd04.prod.outlook.com ([fe80::5d07:911b:18e1:1525%4]) with mapi id 15.20.1813.017; Tue, 23 Apr 2019 13:51:10 +0000 From: Robin Gong To: "broonie@kernel.org" , "shawnguo@kernel.org" , "s.hauer@pengutronix.de" , "festevam@gmail.com" , "robh+dt@kernel.org" , "mark.rutland@arm.com" , "u.kleine-koenig@pengutronix.de" , "plyatov@gmail.com" , "sean.nyekjaer@prevas.dk" Subject: [PATCH v1 07/15] spi: imx: remove ERR009165 workaround on i.mx6ul Thread-Topic: [PATCH v1 07/15] spi: imx: remove ERR009165 workaround on i.mx6ul Thread-Index: AQHU+dubHBTOMwY8i0SA163dzuNb9w== Date: Tue, 23 Apr 2019 13:51:10 +0000 Message-ID: <1556027045-5269-8-git-send-email-yibin.gong@nxp.com> References: <1556027045-5269-1-git-send-email-yibin.gong@nxp.com> In-Reply-To: <1556027045-5269-1-git-send-email-yibin.gong@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.7.4 x-clientproxiedby: HK2PR04CA0044.apcprd04.prod.outlook.com (2603:1096:202:14::12) To VI1PR04MB4543.eurprd04.prod.outlook.com (2603:10a6:803:6d::26) authentication-results: spf=none (sender IP is ) smtp.mailfrom=yibin.gong@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [119.31.174.66] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: be6dda1c-5693-43e7-abad-08d6c7f2bdfc x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600141)(711020)(4605104)(4618075)(2017052603328)(7193020); SRVR:VI1PR04MB5901; x-ms-traffictypediagnostic: VI1PR04MB5901: x-microsoft-antispam-prvs: x-forefront-prvs: 0016DEFF96 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(136003)(396003)(376002)(346002)(39860400002)(199004)(189003)(6506007)(102836004)(86362001)(97736004)(386003)(7416002)(36756003)(14444005)(2201001)(25786009)(4326008)(305945005)(26005)(256004)(73956011)(71190400001)(71200400001)(7736002)(64756008)(66556008)(66476007)(478600001)(66446008)(66946007)(11346002)(316002)(14454004)(446003)(81156014)(8676002)(68736007)(54906003)(81166006)(2501003)(8936002)(186003)(5660300002)(6436002)(110136005)(3846002)(6116002)(6486002)(53936002)(66066001)(6512007)(486006)(476003)(99286004)(76176011)(50226002)(2616005)(52116002)(2906002); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR04MB5901; H:VI1PR04MB4543.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-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: fmcTg+jtYK3bYyWHdC6XokBvDlt+lo7R8xz8yKo2JJsWznNNmiT3n2aHX9DVm62dax5ctW5WB4KtC97ITQbQTmWvRSWZB7N6H0K028QACzqiUGFZXBVqQ7iV8Z9GrnZLsU86S0vYop1kMlVj+1MI1JryAQFkU9K25kzBKKzywT34966++o87xmeK1Q3bR9EtSYVPedcdu4/ABtS69ukeY65fHIfQdujo8p+lKD9QCMS1RRb/W9r6ggKHMXIZRYvned6JAMaDPbFpV7T7FRtiL/gE/THAVzK2PI9th0ofBE6zbb2ryvxvvToFSciUUG5bqkrChUNmvmf1vnIkHzEJ3stNN4o6Tt8BiBU9LcNFXJbvplzaQ/jZZkpdyovmFAU6zuHQo0TUwzpRB7JYSa70icFROCmZrU7LR4TssXMrSl8= MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: be6dda1c-5693-43e7-abad-08d6c7f2bdfc X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Apr 2019 13:51:10.5601 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB5901 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190423_065118_517723_7ABACF47 X-CRM114-Status: GOOD ( 18.54 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "devicetree@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-spi@vger.kernel.org" , dl-linux-imx , "kernel@pengutronix.de" , "dmaengine@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP ERR009165 fix on i.mx6ul and next chip, such as i.mx6ull/i.mx8mq/i.mx8mm. Remove workaround on those chips. Add new i.mx6ul type for that. Signed-off-by: Robin Gong --- drivers/spi/spi-imx.c | 39 +++++++++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c index eb56eac..2e5e978 100644 --- a/drivers/spi/spi-imx.c +++ b/drivers/spi/spi-imx.c @@ -57,6 +57,7 @@ enum spi_imx_devtype { IMX35_CSPI, /* CSPI on all i.mx except above */ IMX51_ECSPI, /* ECSPI on i.mx51 */ IMX53_ECSPI, /* ECSPI on i.mx53 and later */ + IMX6UL_ECSPI, /* ERR009165 fix from i.mx6ul */ }; struct spi_imx_data; @@ -128,7 +129,8 @@ static inline int is_imx35_cspi(struct spi_imx_data *d) static inline int is_imx51_ecspi(struct spi_imx_data *d) { - return d->devtype_data->devtype == IMX51_ECSPI; + return d->devtype_data->devtype == IMX51_ECSPI || + d->devtype_data->devtype == IMX6UL_ECSPI; } static inline int is_imx53_ecspi(struct spi_imx_data *d) @@ -585,9 +587,16 @@ static int mx51_ecspi_prepare_transfer(struct spi_imx_data *spi_imx, ctrl |= mx51_ecspi_clkdiv(spi_imx, t->speed_hz, &clk); spi_imx->spi_bus_clk = clk; - /* ERR009165: work in XHC mode as PIO */ - if (spi_imx->usedma) - ctrl &= ~MX51_ECSPI_CTRL_SMC; + /* + * ERR009165: work in XHC mode instead of SMC as PIO on the chips + * before i.mx6ul. + */ + if (spi_imx->usedma) { + if (spi_imx->devtype_data->devtype == IMX6UL_ECSPI) + ctrl |= MX51_ECSPI_CTRL_SMC; + else + ctrl &= ~MX51_ECSPI_CTRL_SMC; + } writel(ctrl, spi_imx->base + MX51_ECSPI_CTRL); @@ -615,6 +624,8 @@ static void mx51_setup_wml(struct spi_imx_data *spi_imx) { u32 tx_wml = 0; + if (spi_imx->devtype_data->devtype == IMX6UL_ECSPI) + tx_wml = spi_imx->wml; /* * Configure the DMA register: setup the watermark * and enable DMA request. @@ -1012,6 +1023,22 @@ static struct spi_imx_devtype_data imx53_ecspi_devtype_data = { .devtype = IMX53_ECSPI, }; +static struct spi_imx_devtype_data imx6ul_ecspi_devtype_data = { + .intctrl = mx51_ecspi_intctrl, + .prepare_message = mx51_ecspi_prepare_message, + .prepare_transfer = mx51_ecspi_prepare_transfer, + .trigger = mx51_ecspi_trigger, + .rx_available = mx51_ecspi_rx_available, + .reset = mx51_ecspi_reset, + .setup_wml = mx51_setup_wml, + .fifo_size = 64, + .has_dmamode = true, + .dynamic_burst = true, + .has_slavemode = true, + .disable = mx51_ecspi_disable, + .devtype = IMX6UL_ECSPI, +}; + static const struct platform_device_id spi_imx_devtype[] = { { .name = "imx1-cspi", @@ -1035,6 +1062,9 @@ static const struct platform_device_id spi_imx_devtype[] = { .name = "imx53-ecspi", .driver_data = (kernel_ulong_t) &imx53_ecspi_devtype_data, }, { + .name = "imx6ul-ecspi", + .driver_data = (kernel_ulong_t) &imx6ul_ecspi_devtype_data, + }, { /* sentinel */ } }; @@ -1047,6 +1077,7 @@ static const struct of_device_id spi_imx_dt_ids[] = { { .compatible = "fsl,imx35-cspi", .data = &imx35_cspi_devtype_data, }, { .compatible = "fsl,imx51-ecspi", .data = &imx51_ecspi_devtype_data, }, { .compatible = "fsl,imx53-ecspi", .data = &imx53_ecspi_devtype_data, }, + { .compatible = "fsl,imx6ul-ecspi", .data = &imx6ul_ecspi_devtype_data, }, { /* sentinel */ } }; MODULE_DEVICE_TABLE(of, spi_imx_dt_ids);