From patchwork Thu May 18 13:22:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 9734301 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 5AAE1600CC for ; Thu, 18 May 2017 13:22:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 434612845C for ; Thu, 18 May 2017 13:22:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 37F9128692; Thu, 18 May 2017 13:22:53 +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.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 0BAC82845C for ; Thu, 18 May 2017 13:22:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934383AbdERNWi (ORCPT ); Thu, 18 May 2017 09:22:38 -0400 Received: from mail-dm3nam03on0075.outbound.protection.outlook.com ([104.47.41.75]:61440 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933929AbdERNWe (ORCPT ); Thu, 18 May 2017 09:22:34 -0400 Received: from BN3PR03CA0099.namprd03.prod.outlook.com (10.174.66.17) by BLUPR03MB165.namprd03.prod.outlook.com (10.255.212.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1084.16; Thu, 18 May 2017 13:22:27 +0000 Received: from BN1AFFO11FD028.protection.gbl (2a01:111:f400:7c10::180) by BN3PR03CA0099.outlook.office365.com (2603:10b6:400:4::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1101.14 via Frontend Transport; Thu, 18 May 2017 13:22:26 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=fail action=none header.from=nxp.com; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BN1AFFO11FD028.mail.protection.outlook.com (10.58.52.88) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1075.5 via Frontend Transport; Thu, 18 May 2017 13:22:26 +0000 Received: from r49496.am.freescale.net (r49496.am.freescale.net [10.29.244.146]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id v4IDMOXi013499; Thu, 18 May 2017 06:22:24 -0700 From: Fabio Estevam To: CC: , , , Fabio Estevam Subject: [PATCH] spi: imx: Revert "spi: imx: dynamic burst length adjust for PIO mode" Date: Thu, 18 May 2017 10:22:15 -0300 Message-ID: <1495113735-11891-1-git-send-email-fabio.estevam@nxp.com> X-Mailer: git-send-email 2.7.4 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131395873467612220; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(336005)(39850400002)(39380400002)(39860400002)(39400400002)(39410400002)(39840400002)(39450400003)(2980300002)(1110001)(1109001)(339900001)(199003)(189002)(9170700003)(6916009)(47776003)(53936002)(498600001)(6666003)(85426001)(48376002)(4326008)(2351001)(8656002)(54906002)(356003)(77096006)(110136004)(38730400002)(50466002)(2906002)(33646002)(305945005)(81166006)(104016004)(575784001)(86362001)(50226002)(106466001)(36756003)(50986999)(105606002)(5003940100001)(8936002)(5660300001)(8676002)(189998001); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR03MB165; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; MLV:ovrnspm; A:1; MX:1; PTR:InfoDomainNonexistent; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD028; 1:Ngbp0dCsZe19g5Cb/JliClwpUvwE3DpDFGvay5S1cTx5xtPBo+RSkV+4rpaFpCCEX2710gZwsu9l8NEGQNfd9FEGT1DJwadcEsdW7zkO43lhmGhXPl6to65RyrTvA0HByzPy+thm6/xaZyerMPwjYplx+D+REofstWpiKCzQib35RZ4ue5xVNmKlvorQlmEARpCFU9VYImMk6ngv5TWQ1/DrkF5HNCXfQaVoP1kE3F52ujj5qsiwyQ8aCZb/a1Q3bQf2vSC/LcW7t/jEcAidKoq++lt7Tboc7RDKGa82MwcZcVA1FyE4yHih9ItkAp0r+AhOp8TUsYy9xmWk/FSTitee7CvIVINPoiYR1L8ajQpFVrTcOgUFhdKei3ZFLWv3CIQPke+6rOA9wJoE04r6vUHqHB5aDKig7x+GCH1r32T6eeRz1t6fkFvsQMelEUmcpEXXZWx7Gn9gmTPPHQfzmgbJCEiVQh/iJVirZqLeQ8qIiIsN4St6iOtiOo0/5abu9F73uuiqcjvWLRWTTdhtVfdClXZdl0wSmm8N+rPb+sclSuIm3VmcJTpJHkptFr/EN/x7CFzl2UGWhso6Bmf4WES4EuVbgIE+6nJIrYyRvM7gPASavqG4+aFScMX4eub4K85U+l9l6nWBFCNif4oMJt6l0sNa+taPJrZwKwZC3dKazLCLox8hKFnWiap0MHP5BrG52EE7m/kKb9vZy8LerugNyJoXuORE8z1WKw6aFFM= MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7e2cf2b2-4d7e-43c3-dadc-08d49df0ed71 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131430075)(201703131517081); SRVR:BLUPR03MB165; X-Microsoft-Exchange-Diagnostics: 1; BLUPR03MB165; 3:5pPN+sM/nbzfU8brgJ03ASlqeO4y1Aebo0jD0/A7UNi1hn5yqVBnQNoVdONb8Bu2/Hu43Ig2BVMy7VkQY+GbPqJKRUEJxE3Fw517CnTblZnFeKCa2gAVsnYbyviLVNRaOuKVvQ5gXKd7bUmfFfdb9MEsmYvR8AgmInYVyjEN7Sh4AyFhyzvcxT5JaFwvSG1LGsoNd2kkvr/po5hhKDuAbgwm6q1E9xPMUeVAbOyGc4hUOULLi5N1SlvAYFQ58ypr/05oDbhtoDX/6p7m2+J4Z6M0BG/c8FvCIRWuiYkeaaEwVwZwckVfX+R0BuwNjcP7/UbbBm5fkGTghcdlp6SQrQPV8JYDJS4M7gsS30FsAl6p6BBfkU+dxnPOD+F6YCdMyn+dCgPeb44Imlj94DIC/Oa/MMXQAKoRylz3JE2dUrmoFjDjhzMqVmLBuBiTJelD; 25:YDmQIf+mJNgBi/eah9AxlHZJmhvP+P9/fcHCmPz4JLMzHeXd8wfxbbXBvqSnsdO7h079OKvXVhOqO6p9isUizottn9odrIbifWJ7ZAxbguJxG7EQHlLmpljYYSbg9+kHxpWpcmwSFpikQxBAO4ZQqUVyz5mKiVZo1qVt+p1onJ/Mjpue/3apSeqSIC7WvjWf7lXeNgjhpGXi/Aq9PUjJV7QMQYiEw8/FG/I0SyqaXeQJRrjK8MzuHtkea0KI133NtaC7s5nYfqouGum1+zYyBUxuZEia7uZa1/c9WVYgZmsJYiJznj3f332eyaKmv8J90zYsHHjJUuDWoHtcpE+PwHRp/anpD2G/3SAcjjKp8vxY7OUO9XoTusfjKrLG5uMhyWuXze/6g8/yITpkNcJBKIZuapCYhvy1xBDUxO13hrGbboiU5NfZx5FqiF2ydd9DthchWaWNOZb3TIq80GE8Og== X-Microsoft-Exchange-Diagnostics: 1; BLUPR03MB165; 31:6utLOPgUP9ZPj7Lm3gDptQykH4CJdovVgo1fguxn7LSLZb3chzm6OAjSAMPjWzyyd2F/StrjRDALVwyPwbLw1Z0yz6wHIjCDA/7qUvR2Cf6rU3+1dODwTLRAoRxq8x+aqsCTodUP49jwutO8dRwaGU+wdjSl3Qnl3h5oqKYRNdS1yW7Nru4nrn1z8Lpo7C1/o7elcUxKvjy2D9fzyYmju2wgdny5FX2gU8hcWPySBp8X/beMOaJbDOeswPbfixNyiVYcMkrJk+kUZyaz6kXZBw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095135)(601004)(2401047)(13024025)(13023025)(8121501046)(13018025)(5005006)(13017025)(13015025)(3002001)(10201501046)(93006095)(93001095)(6055026)(6096035)(20161123565025)(20161123561025)(20161123556025)(20161123559100)(20161123563025)(201703131430075)(201703131448075)(201703131433075)(201703161259150)(201703151042153); SRVR:BLUPR03MB165; BCL:0; PCL:0; RULEID:(400006); SRVR:BLUPR03MB165; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR03MB165; 4:JOE8kKFF+8X4YmUnppL495i+hp2p7LAkuN9OTykfSie?= =?us-ascii?Q?5RhOCti94qrbytuOIvR0CDn/kYbT1FosXGwOpPV81c8uayGZzMX1M0cqVOFh?= =?us-ascii?Q?09P0FrTnA1XM7UNw/xoph61DL/zqBPzkq90WY1B2w1FoCZr0QMCx0veTUIQA?= =?us-ascii?Q?KHPgSL26+ew/Wpt8ub8JuM/I+YHHbux4FX6hHePUb9c7LCA5zCxNNNs3OmYi?= =?us-ascii?Q?VlVCmusp0Yi9ECg3vV2xP0ROyx4GFCbN077ep1fthHljR+BWRnw6zIC+djRz?= =?us-ascii?Q?VZ7HbneCu+FYbJ3FrMuOawj2MkI6cZ00AD/S/samkFSfjUP0FXtGD1MBIg4u?= =?us-ascii?Q?dVIYW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EfHmWiQm4Y0M2Z38atpp2aFSvAObIeLq8Cei2qM/pv/U/g8olsoqk= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BLUPR03MB165; 7:mxd7loUbJcbMGJGMxsbHAzezYCOFamwTtAkhwuvehY6MHezpf8yglxphbvj9ivRPYfNkGXvkfL7mO5uLBm7acIIRlP0Gatn7BpWWNlHM3/r46fjOXw52Jkh1tC4DUQRwMd8My2sDNAmQmsEzB4LkLL1rHVfafzGal1/S9pAVAUIlKDgcbdK/pGTwUqlK/2ICfSDkWTDWL6A7k+q13MOS9fBtR5AN8/187lC6CJjMjXocsXgpypQYU7bexeF/efKAWCQ0vfoOXFmT0m3ofom+vBxSTMPMbsVBq6pCgRvwXSg6/wilHLyQNLXEgx9T/DLGTEtGWrVHXHBV0xFtIg1njw== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 May 2017 13:22:26.5740 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR03MB165 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 This reverts commit 8d4a6cad7adb3ddac32cd52635f20e11de11a658. Commit 8d4a6cad7adb ("spi: imx: dynamic burst length adjust for PIO mode") breaks the detection of the SPI NOR on a imx6q-sabresd board: m25p80 spi0.0: unrecognized JEDEC id bytes: 10, 00, 00 # cat /proc/mtd dev: size erasesize name After reverting this commit SPI works back to normal again: m25p80 spi0.0: m25p32 (4096 Kbytes) # cat /proc/mtd dev: size erasesize name mtd0: 00400000 00010000 "spi0.0" It also causes kernel crashes on imx6dl-sabreauto and imx6sl-evk boards as reported by Leonard Crestez, so better revert it. Reported-by: Leonard Crestez Signed-off-by: Fabio Estevam --- drivers/spi/spi-imx.c | 157 +++----------------------------------------------- 1 file changed, 8 insertions(+), 149 deletions(-) diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c index 782045f..b402530 100644 --- a/drivers/spi/spi-imx.c +++ b/drivers/spi/spi-imx.c @@ -56,11 +56,9 @@ /* The maximum bytes that a sdma BD can transfer.*/ #define MAX_SDMA_BD_BYTES (1 << 15) -#define MX51_ECSPI_CTRL_MAX_BURST 512 struct spi_imx_config { unsigned int speed_hz; unsigned int bpw; - unsigned int len; }; enum spi_imx_devtype { @@ -99,14 +97,12 @@ struct spi_imx_data { unsigned int bytes_per_word; unsigned int spi_drctl; - unsigned int count, count_index; + unsigned int count; void (*tx)(struct spi_imx_data *); void (*rx)(struct spi_imx_data *); void *rx_buf; const void *tx_buf; unsigned int txfifo; /* number of words pushed in tx FIFO */ - unsigned int dynamic_burst, bpw_rx; - unsigned int bpw_w; /* DMA */ bool usedma; @@ -256,7 +252,6 @@ static bool spi_imx_can_dma(struct spi_master *master, struct spi_device *spi, #define MX51_ECSPI_CTRL_PREDIV_OFFSET 12 #define MX51_ECSPI_CTRL_CS(cs) ((cs) << 18) #define MX51_ECSPI_CTRL_BL_OFFSET 20 -#define MX51_ECSPI_CTRL_BL_MASK (0xfff << 20) #define MX51_ECSPI_CONFIG 0x0c #define MX51_ECSPI_CONFIG_SCLKPHA(cs) (1 << ((cs) + 0)) @@ -284,71 +279,6 @@ static bool spi_imx_can_dma(struct spi_master *master, struct spi_device *spi, #define MX51_ECSPI_TESTREG 0x20 #define MX51_ECSPI_TESTREG_LBC BIT(31) -static void spi_imx_u32_swap_u8(struct spi_transfer *transfer, u32 *buf) -{ - int i; - - for (i = 0; i < transfer->len / 4; i++) - *(buf + i) = cpu_to_be32(*(buf + i)); -} - -static void spi_imx_u32_swap_u16(struct spi_transfer *transfer, u32 *buf) -{ - int i; - - for (i = 0; i < transfer->len / 4; i++) { - u16 *temp = (u16 *)buf; - - *(temp + i * 2) = cpu_to_be16(*(temp + i * 2)); - *(temp + i * 2 + 1) = cpu_to_be16(*(temp + i * 2 + 1)); - - *(buf + i) = cpu_to_be32(*(buf + i)); - } -} - -static void spi_imx_buf_rx_swap(struct spi_imx_data *spi_imx) -{ - if (!spi_imx->bpw_rx) { - spi_imx_buf_rx_u32(spi_imx); - return; - } - - if (spi_imx->bpw_w == 1) - spi_imx_buf_rx_u8(spi_imx); - else if (spi_imx->bpw_w == 2) - spi_imx_buf_rx_u16(spi_imx); -} - -static void spi_imx_buf_tx_swap(struct spi_imx_data *spi_imx) -{ - u32 ctrl, val; - - if (spi_imx->count == spi_imx->count_index) { - spi_imx->count_index = spi_imx->count > sizeof(u32) ? - spi_imx->count % sizeof(u32) : 0; - ctrl = readl(spi_imx->base + MX51_ECSPI_CTRL); - ctrl &= ~MX51_ECSPI_CTRL_BL_MASK; - if (spi_imx->count >= sizeof(u32)) { - val = spi_imx->count - spi_imx->count_index; - } else { - val = spi_imx->bpw_w; - spi_imx->bpw_rx = 1; - } - ctrl |= ((val * 8 - 1) << MX51_ECSPI_CTRL_BL_OFFSET); - writel(ctrl, spi_imx->base + MX51_ECSPI_CTRL); - } - - if (spi_imx->count >= sizeof(u32)) { - spi_imx_buf_tx_u32(spi_imx); - return; - } - - if (spi_imx->bpw_w == 1) - spi_imx_buf_tx_u8(spi_imx); - else if (spi_imx->bpw_w == 2) - spi_imx_buf_tx_u16(spi_imx); -} - /* MX51 eCSPI */ static unsigned int mx51_ecspi_clkdiv(struct spi_imx_data *spi_imx, unsigned int fspi, unsigned int *fres) @@ -440,15 +370,7 @@ static int mx51_ecspi_config(struct spi_device *spi, /* set chip select to use */ ctrl |= MX51_ECSPI_CTRL_CS(spi->chip_select); - if (spi_imx->dynamic_burst) { - if (config->len > MX51_ECSPI_CTRL_MAX_BURST) - ctrl |= MX51_ECSPI_CTRL_BL_MASK; - else - ctrl |= (((config->len - config->len % 4) * 8 - 1) << - MX51_ECSPI_CTRL_BL_OFFSET); - } else { - ctrl |= (config->bpw - 1) << MX51_ECSPI_CTRL_BL_OFFSET; - } + ctrl |= (config->bpw - 1) << MX51_ECSPI_CTRL_BL_OFFSET; cfg |= MX51_ECSPI_CONFIG_SBBCTRL(spi->chip_select); @@ -883,8 +805,6 @@ static void spi_imx_push(struct spi_imx_data *spi_imx) while (spi_imx->txfifo < spi_imx_get_fifosize(spi_imx)) { if (!spi_imx->count) break; - if (spi_imx->txfifo && (spi_imx->count == spi_imx->count_index)) - break; spi_imx->tx(spi_imx); spi_imx->txfifo++; } @@ -975,12 +895,8 @@ static int spi_imx_setupxfer(struct spi_device *spi, struct spi_imx_config config; int ret; - spi_imx->dynamic_burst = 0; - spi_imx->bpw_rx = 0; - config.bpw = t ? t->bits_per_word : spi->bits_per_word; config.speed_hz = t ? t->speed_hz : spi->max_speed_hz; - config.len = t->len; if (!config.speed_hz) config.speed_hz = spi->max_speed_hz; @@ -989,32 +905,14 @@ static int spi_imx_setupxfer(struct spi_device *spi, /* Initialize the functions for transfer */ if (config.bpw <= 8) { - if (t->len >= sizeof(u32) && is_imx51_ecspi(spi_imx)) { - spi_imx->dynamic_burst = 1; - spi_imx->rx = spi_imx_buf_rx_swap; - spi_imx->tx = spi_imx_buf_tx_swap; - } else { - spi_imx->rx = spi_imx_buf_rx_u8; - spi_imx->tx = spi_imx_buf_tx_u8; - } + spi_imx->rx = spi_imx_buf_rx_u8; + spi_imx->tx = spi_imx_buf_tx_u8; } else if (config.bpw <= 16) { - if (t->len >= sizeof(u32) && is_imx51_ecspi(spi_imx)) { - spi_imx->dynamic_burst = 1; - spi_imx->rx = spi_imx_buf_rx_swap; - spi_imx->tx = spi_imx_buf_tx_swap; - } else { - spi_imx->rx = spi_imx_buf_rx_u16; - spi_imx->tx = spi_imx_buf_tx_u16; - } + spi_imx->rx = spi_imx_buf_rx_u16; + spi_imx->tx = spi_imx_buf_tx_u16; } else { - if (is_imx51_ecspi(spi_imx)) { - spi_imx->dynamic_burst = 1; - spi_imx->rx = spi_imx_buf_rx_swap; - spi_imx->tx = spi_imx_buf_tx_swap; - } else { - spi_imx->rx = spi_imx_buf_rx_u32; - spi_imx->tx = spi_imx_buf_tx_u32; - } + spi_imx->rx = spi_imx_buf_rx_u32; + spi_imx->tx = spi_imx_buf_tx_u32; } if (spi_imx_can_dma(spi_imx->bitbang.master, spi, t)) @@ -1022,8 +920,6 @@ static int spi_imx_setupxfer(struct spi_device *spi, else spi_imx->usedma = 0; - spi_imx->bpw_w = DIV_ROUND_UP(config.bpw, 8); - if (spi_imx->usedma) { ret = spi_imx_dma_configure(spi->master, spi_imx_bytes_per_word(config.bpw)); @@ -1198,27 +1094,6 @@ static int spi_imx_pio_transfer(struct spi_device *spi, spi_imx->count = transfer->len; spi_imx->txfifo = 0; - if (spi_imx->dynamic_burst) { - if (spi_imx->count > MX51_ECSPI_CTRL_MAX_BURST) - spi_imx->count_index = spi_imx->count % - MX51_ECSPI_CTRL_MAX_BURST; - else - spi_imx->count_index = spi_imx->count % sizeof(u32); - - switch (spi_imx->bpw_w) { - case 1: - spi_imx_u32_swap_u8(transfer, - (u32 *)transfer->tx_buf); - break; - case 2: - spi_imx_u32_swap_u16(transfer, - (u32 *)transfer->tx_buf); - break; - default: - break; - } - } - reinit_completion(&spi_imx->xfer_done); spi_imx_push(spi_imx); @@ -1235,22 +1110,6 @@ static int spi_imx_pio_transfer(struct spi_device *spi, return -ETIMEDOUT; } - if (spi_imx->dynamic_burst) { - switch (spi_imx->bpw_w) { - case 1: - spi_imx_u32_swap_u8(transfer, - (u32 *)transfer->rx_buf); - break; - case 2: - spi_imx_u32_swap_u16(transfer, - (u32 *)transfer->rx_buf); - break; - default: - break; - } - spi_imx->dynamic_burst = 0; - } - return transfer->len; }