From patchwork Mon Nov 14 14:22:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Walle X-Patchwork-Id: 9427635 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 8D85060471 for ; Mon, 14 Nov 2016 14:31:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7EF7F2881E for ; Mon, 14 Nov 2016 14:31:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 735FA28821; Mon, 14 Nov 2016 14:31:23 +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 E562B2881E for ; Mon, 14 Nov 2016 14:31:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753581AbcKNObP (ORCPT ); Mon, 14 Nov 2016 09:31:15 -0500 Received: from ssl.serverraum.org ([213.133.101.245]:56986 "EHLO ssl.serverraum.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753578AbcKNObP (ORCPT ); Mon, 14 Nov 2016 09:31:15 -0500 X-Greylist: delayed 490 seconds by postgrey-1.27 at vger.kernel.org; Mon, 14 Nov 2016 09:31:14 EST Received: from ssl.serverraum.org (web.serverraum.org [172.16.0.2]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by ssl.serverraum.org (Postfix) with ESMTPSA id 9A93B2225C; Mon, 14 Nov 2016 15:22:59 +0100 (CET) Authentication-Results: ssl.serverraum.org; dmarc=none header.from=walle.cc DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2016061301; t=1479133379; bh=WDgtsPBxoJQ63Z9VYYFFPjdoT7gvUtGg2oFOwA0ss4M=; h=Date:From:To:Cc:Subject:From; b=nhf/UNr6XIzES9No3YJ7LMMXX/s9Rnuy+JqQO+zdxGgnT2AupssJuxdm+XkNGa2z2 aw4zHHIoYEoRfIAmgpBXS8K5FDZXasuxQ99/AusKti/Hl99mVcUQu1worTRZnDRv92 qZ7ZLdt6NxLu9W+SPnDqghiwFz4nESUb67Pxc/ec= MIME-Version: 1.0 Date: Mon, 14 Nov 2016 15:22:59 +0100 From: Michael Walle To: Heiner Kallweit , Mark Brown , Michal Suchanek Cc: linux-spi@vger.kernel.org, linux-mtd@vger.kernel.org Subject: fsl-espi, m25p80 and max_transfer_size / max_message_size Message-ID: <17913d2dea0200f818af5f42a0b2ed42@walle.cc> X-Sender: michael@walle.cc User-Agent: Roundcube Webmail/1.1.5 X-Virus-Scanned: clamav-milter 0.99.2 at web X-Virus-Status: Clean 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 Hi, since commit 02a595d5d6e4 (spi: fsl-espi: eliminate spi nor flash read loop) the fsl-espi is (partly?) broken. Reading 64k from the flash results in the following error: fsl_espi ffe110000.spi: message too long, size is 65540 bytes spi_master spi32766: failed to transfer one message from queue We are using the m25p80 driver which checks the max_transfer_size. The fsl-espi driver sets the max_message_size to 64k. As far as I understand it, a message can contain multiple transfers. The m25p80 uses two transfers (one 4 byte and one with max_transfer_size, that is 64k) and thus the message has a total length of 65540 bytes which is too long for the driver. I didn't find where the max_message_size is checked and I also don't know which part is resposible to handle the correct sizes. The m25p80 driver? Should it use spi_max_message_size() instead of spi_max_transfer_size() ? For example: ret = spi_sync(spi, &m); -michael --- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- a/drivers/mtd/devices/m25p80.c +++ b/drivers/mtd/devices/m25p80.c @@ -172,7 +172,7 @@ static ssize_t m25p80_read(struct spi_nor *nor, loff_t from, size_t len, t[1].rx_buf = buf; t[1].rx_nbits = m25p80_rx_nbits(nor); - t[1].len = min(len, spi_max_transfer_size(spi) - t[0].len); + t[1].len = min(len, spi_max_message_size(spi) - t[0].len); spi_message_add_tail(&t[1], &m);