Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp965305pxk; Fri, 25 Sep 2020 02:37:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyLR2dvh890UHuh7J7jGaxodlmygZMFpa/6o4uDfvgrzBlQEkABJG0KVoiUgtbzVARIeJH9 X-Received: by 2002:a17:906:c289:: with SMTP id r9mr1908051ejz.402.1601026667373; Fri, 25 Sep 2020 02:37:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601026667; cv=none; d=google.com; s=arc-20160816; b=V6BT9F6HR3RCU4CVGz/EJa1GD+PO1/cYfqEhv9cJaMCTIeJrhcx3lpNqQzNEDNgcTr u6XkGlY/pDScs57rhGdfVseqxD3SV2/GKf5gG5RTxDS0cow0cC27D5ItV+H6GPCbdFsN Pb1fbXO27rDXU8H1GY+HYaXh9axoqggMnAt7FzPND+X+dQCvPUBAHxPx1z1k7qCZJcgx CvcTXU/m+g32ISaxNCqnvQjg/kOW7J7lTb8H/k3mUrIQ2FrPwjr5dA1AKoC0YDUOVEQr HvRlOw0z8jNKr4SYNqpkyyzneCzEAFckcbrHG04ZO10IyRwXX3CYdNFPIY+Fa/WopYiW UvrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=CopwlfwvxR6TDA4NEpPReJrXwzQ2YdaVXCfZyj+KeI8=; b=bkpJ9qbUKEaUh86kMFjm2gxRm6kvMKuhDPrxCLzKLro2q+74jnD7dV314zSPDgglo1 UO70x0lPdEo8a6FiGeA34uTt7fnbEmWTDhe9dEqA9RS3D56V3O/e5ea890ydqI6ZU+mF RFdY2rJpW9gXNCyL8YsNXF7ouOKGMiT1S4YFmbkudfJzSA9/ul2+AOtq6Fr3eA5vJH5c BZreVuPEVHVqCZ5w40rz9IUsZL9QGruRJLtIh8JQ6X01q0YBApiPpYu3MSS/fCbG2j3M PSCvzrAvUhMplkLQWmu/Cb7pq2jZNesaKPa/GjJPdSJFj5L70NxzfPWMNNRHhUB0zERR UMUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=gQDqhM1E; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a12si1523379eds.181.2020.09.25.02.37.24; Fri, 25 Sep 2020 02:37:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=gQDqhM1E; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727960AbgIYJgU (ORCPT + 99 others); Fri, 25 Sep 2020 05:36:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727905AbgIYJgU (ORCPT ); Fri, 25 Sep 2020 05:36:20 -0400 Received: from mail-vs1-xe43.google.com (mail-vs1-xe43.google.com [IPv6:2607:f8b0:4864:20::e43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0722BC0613D4 for ; Fri, 25 Sep 2020 02:36:20 -0700 (PDT) Received: by mail-vs1-xe43.google.com with SMTP id e2so1010983vsr.7 for ; Fri, 25 Sep 2020 02:36:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=CopwlfwvxR6TDA4NEpPReJrXwzQ2YdaVXCfZyj+KeI8=; b=gQDqhM1EBxhhdAdupXGC+mi8HP42zIBAb+/5WouwU0pwYgc43PjnSIDyqhNXoJBgwE nA9S7PMscej5cgQCrvf55Dp29QyMHvwUDUtmdsjDRjaEHcRFBhd7dmLwMWl9mvoH7sp/ 4lRasNIvYZAFCtIP9ZaogcqOJXzEYU/4iYpzI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=CopwlfwvxR6TDA4NEpPReJrXwzQ2YdaVXCfZyj+KeI8=; b=hT3A9he7Vo5VPRsRawq+ajUhcWIuyaBV69gMv22EK9iEfzPRCgJFKkDiOYMTsihHru TdLgXhIOVOOiJaS2dXWkkltN0vbjDLTirFynE9N0AOVCfv2XFfylbfwf7Daj1zyEM3lo T65pTW88ihDqYfCw6xAw8vQqs33z2wfl+6cdFsmISY/9M0NoYD3WHbwFYF9/S+F0afrW 2zMOe1x5rAo1xMGmvFlP/td76T4dXEcmSMJqvOMO/DxVbZPgnF8In9v7IcgthGBuQGoQ TkuTmVXEiu6kyzqSP+QolzIfQ8LtB4StlUzZmVFkoAaZDIz/qPl78yRvZsdN1Eas5Vy5 as3A== X-Gm-Message-State: AOAM532vQzTH5Wf3xX5d0uewgpVFU0HhvjHBZpmp1DAnWJ1A5Ona1lzl 4vBKs0J4iM97G1Qy8r0iDfRM6GnwIJrjzqCvZBAq4A== X-Received: by 2002:a67:b917:: with SMTP id q23mr2061999vsn.37.1601026578879; Fri, 25 Sep 2020 02:36:18 -0700 (PDT) MIME-Version: 1.0 References: <20200925065418.1077472-1-ikjn@chromium.org> <20200925145255.v3.2.I48d59ef5398f3633c6ebbab093da6b4b06495780@changeid> In-Reply-To: <20200925145255.v3.2.I48d59ef5398f3633c6ebbab093da6b4b06495780@changeid> From: Ikjoon Jang Date: Fri, 25 Sep 2020 17:36:08 +0800 Message-ID: Subject: Re: [PATCH v3 2/6] spi: spi-mtk-nor: fix mishandled logics in checking SPI memory operation To: Rob Herring , Mark Brown , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , linux-spi@vger.kernel.org, linux-mtd@lists.infradead.org Cc: Matthias Brugger , "moderated list:ARM/Mediatek SoC support" , open list , "moderated list:ARM/Mediatek SoC support" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 25, 2020 at 2:54 PM Ikjoon Jang wrote: > > Fix a bug which limits its protocol availability in supports_op(). > > Fixes: a59b2c7c56bf ("spi: spi-mtk-nor: support standard spi properties") > Signed-off-by: Ikjoon Jang > --- This is also duplicated work of https://patchwork.kernel.org/patch/11797723/, I'm going to drop this patch in v4. > > (no changes since v1) > > drivers/spi/spi-mtk-nor.c | 26 +++++++++++--------------- > 1 file changed, 11 insertions(+), 15 deletions(-) > > diff --git a/drivers/spi/spi-mtk-nor.c b/drivers/spi/spi-mtk-nor.c > index 6e6ca2b8e6c8..0f7d4ec68730 100644 > --- a/drivers/spi/spi-mtk-nor.c > +++ b/drivers/spi/spi-mtk-nor.c > @@ -211,28 +211,24 @@ static bool mtk_nor_supports_op(struct spi_mem *mem, > if (op->cmd.buswidth != 1) > return false; > > + if (!spi_mem_default_supports_op(mem, op)) > + return false; > + > if ((op->addr.nbytes == 3) || (op->addr.nbytes == 4)) { > - switch(op->data.dir) { > - case SPI_MEM_DATA_IN: > - if (!mtk_nor_match_read(op)) > - return false; > - break; > - case SPI_MEM_DATA_OUT: > - if ((op->addr.buswidth != 1) || > - (op->dummy.nbytes != 0) || > - (op->data.buswidth != 1)) > - return false; > - break; > - default: > - break; > - } > + if ((op->data.dir == SPI_MEM_DATA_IN) && mtk_nor_match_read(op)) > + return true; > + else if (op->data.dir == SPI_MEM_DATA_OUT) > + return (op->addr.buswidth == 1) && > + (op->dummy.nbytes == 0) && > + (op->data.buswidth == 1); > } > + > len = op->cmd.nbytes + op->addr.nbytes + op->dummy.nbytes; > if ((len > MTK_NOR_PRG_MAX_SIZE) || > ((op->data.nbytes) && (len == MTK_NOR_PRG_MAX_SIZE))) > return false; > > - return spi_mem_default_supports_op(mem, op); > + return true; > } > > static void mtk_nor_setup_bus(struct mtk_nor *sp, const struct spi_mem_op *op) > -- > 2.28.0.681.g6f77f65b4e-goog >