From patchwork Fri Jul 29 22:13:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kamal Dasu X-Patchwork-Id: 9252935 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 4691B6075F for ; Fri, 29 Jul 2016 22:13:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 375C928423 for ; Fri, 29 Jul 2016 22:13:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2BF0028437; Fri, 29 Jul 2016 22:13:48 +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_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, 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 C93EA28423 for ; Fri, 29 Jul 2016 22:13:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754160AbcG2WNr (ORCPT ); Fri, 29 Jul 2016 18:13:47 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:34373 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753130AbcG2WNr (ORCPT ); Fri, 29 Jul 2016 18:13:47 -0400 Received: by mail-pf0-f194.google.com with SMTP id g202so6089306pfb.1 for ; Fri, 29 Jul 2016 15:13:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=NQyjZg+lHmGnI6cag8EBYIeH4LBb103OvGrKYfhQfGk=; b=XwwGB1KpMvfXPLwc1mIhPiczfVaIrz6ZOgsnzLKZVrysiL0142Y50TV2RBcLYk80lQ 4h/ZNmXIHZ23QYxD2Yn4WZoi8BeGUthpBXPQdbbs+qtL0bVA94gEhuCqjrxB0ZiROC5T HZROJa7YL535gJeOihZqunky/N+d52ye2vQRJqVgjbLM5MC1LiL/iJHHylM8TSnzf8Cn bALQp1Ni2GCsoaDvJc46H/Og2E1etOnWWfX8gwC67G6Cf1FqUxswqSuffs0PqPSvGeX2 qEiRRogP8+nOnTxcVU/j9AQ7eS+vQm2hcbktRhsGuvRtG8FIpNm+al3rktDQW648x/gA YBcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=NQyjZg+lHmGnI6cag8EBYIeH4LBb103OvGrKYfhQfGk=; b=gMYLv3ECWw5wPt/j7m3kCPQHHiY/sR0b5KLwChbT2WcikHwx7FsDRrS0ak9mSKKqbt ijw0NhPxEPT9qHnaSKQBTn8MF2THTreplpPJf0qugzdmnVh1MIf5Vfhw6+rlkFbekHqE DqZ8NmXydobpIrjbYONBYpFuU0p9vjRSomy7DXyYSUYM3DpdpvymAXhsoEUQL9OaFZwp GicSJnCsatc1Oczeb2d1890lupCoNecRDqFlS9Hsc/qbGPmhCGca8miIeTesknkIFFzO ZnAJ4OR9t3fR7+oU6npztb+4Xp/isCbsAL32slJDl3kU8EUKQyxm3pknrMGbOpufQSNV bQEg== X-Gm-Message-State: AEkoous2+PuZF/l353ZkZEy4GrxmwBBfbcG0XlwPbxeYl20XebQL50n6z4YMbhFvpWkdMg== X-Received: by 10.98.36.15 with SMTP id r15mr73248430pfj.1.1469830426259; Fri, 29 Jul 2016 15:13:46 -0700 (PDT) Received: from mail.broadcom.com ([216.31.219.19]) by smtp.gmail.com with ESMTPSA id zk7sm27207051pac.41.2016.07.29.15.13.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 29 Jul 2016 15:13:45 -0700 (PDT) From: Kamal Dasu To: broonie@kernel.org, linux-spi@vger.kernel.org, linux-mtd@lists.infradead.org, vigneshr@ti.com, f.fainelli@gmail.com Cc: bcm-kernel-feedback-list@broadcom.com, vikram.prakash@broadcom.com, andy.fung@broadcom.com, jon.mason@broadcom.com, jchandra@broadcom.com, Kamal Dasu Subject: [PATCH v5 4/8] mtd: m25p80: Let m25p80_read() fallback to spi transfer Date: Fri, 29 Jul 2016 18:13:09 -0400 Message-Id: <1469830393-13295-5-git-send-email-kdasu.kdev@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1469830393-13295-1-git-send-email-kdasu.kdev@gmail.com> References: <1469830393-13295-1-git-send-email-kdasu.kdev@gmail.com> 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 In m25p80_read() even though spi_flash_read() is supported by some drivers, under certain circumstances like unaligned buffer, address or address range limitations on certain SoCs let it fallback to core spi reads. Such drivers are expected to return -EAGAIN so that the m25p80_read() uses standard spi transfer. Signed-off-by: Kamal Dasu --- drivers/mtd/devices/m25p80.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c index 9d68544..3f90542 100644 --- a/drivers/mtd/devices/m25p80.c +++ b/drivers/mtd/devices/m25p80.c @@ -149,8 +149,11 @@ static int m25p80_read(struct spi_nor *nor, loff_t from, size_t len, msg.data_nbits = m25p80_rx_nbits(nor); ret = spi_flash_read(spi, &msg); - *retlen = msg.retlen; - return ret; + /* some drivers might need to fallback to spi transfer */ + if (ret != -EAGAIN) { + *retlen = msg.retlen; + return ret; + } } spi_message_init(&m);