From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B9311C43381 for ; Sat, 30 Mar 2019 18:20:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 952F7217F5 for ; Sat, 30 Mar 2019 18:20:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730866AbfC3SUl (ORCPT ); Sat, 30 Mar 2019 14:20:41 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:33674 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730857AbfC3SUk (ORCPT ); Sat, 30 Mar 2019 14:20:40 -0400 Received: from localhost (unknown [IPv6:2a01:e0a:2c:6930:5cf4:84a1:2763:fe0d]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: bbrezillon) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id AAA56280B0E; Sat, 30 Mar 2019 18:20:38 +0000 (GMT) Date: Sat, 30 Mar 2019 19:20:36 +0100 From: Boris Brezillon To: Daniel Mack Cc: Miquel Raynal , Richard Weinberger , stable@vger.kernel.org, linux-mtd@lists.infradead.org, haojian.zhuang@gmail.com, robert.jarzmik@free.fr, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH] mtd: rawnand: marvell: select target before setting up data interface Message-ID: <20190330192036.193e9e1c@collabora.com> In-Reply-To: <60179efc-122f-2439-bd20-ab27b29afa32@zonque.org> References: <20190321212010.3995-1-daniel@zonque.org> <20190322093046.71df010d@xps13> <6bcd6f18-6e57-2221-9e32-5bbabfffc48d@zonque.org> <20190325100909.5f3558b9@xps13> <60179efc-122f-2439-bd20-ab27b29afa32@zonque.org> Organization: Collabora X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org On Mon, 25 Mar 2019 17:21:42 +0100 Daniel Mack wrote: > Hi Miquel, > > On 25/3/2019 10:09 AM, Miquel Raynal wrote: > > Daniel Mack wrote on Fri, 22 Mar 2019 19:48:08 > > +0100: > > > >> Hi Miquel, > >> > >> On 22/3/2019 9:30 AM, Miquel Raynal wrote: > >>> + Richard: this is fixes materials > >>> > >>> Daniel Mack wrote on Thu, 21 Mar 2019 22:20:10 > >>> +0100: > >>> > >>>> Now that the nand drivers are responsible for selecting the target > >>>> prior to hardware access, a call to marvell_nfc_select_target() is > >>>> necessary from marvell_nfc_setup_data_interface(). > >>>> > >>>> This is a regression introduced by commit b25251414f6e ("mtd: > >>>> rawnand: marvell: Stop implementing ->select_chip()"). > >>>> > >>>> Fixes: b25251414f6e ("mtd: rawnand: marvell: Stop implementing ->select_chip()") > >>>> Cc: Boris Brezillon > >>>> Cc: > >>>> Signed-off-by: Daniel Mack > >>>> --- > >>>> drivers/mtd/nand/raw/marvell_nand.c | 2 ++ > >>>> 1 file changed, 2 insertions(+) > >>>> > >>>> diff --git a/drivers/mtd/nand/raw/marvell_nand.c b/drivers/mtd/nand/raw/marvell_nand.c > >>>> index 84283c6bb0ff..93abe5be8995 100644 > >>>> --- a/drivers/mtd/nand/raw/marvell_nand.c > >>>> +++ b/drivers/mtd/nand/raw/marvell_nand.c > >>>> @@ -2325,6 +2325,8 @@ static int marvell_nfc_setup_data_interface(struct nand_chip *chip, int chipnr, > >>>> struct marvell_nfc_timings nfc_tmg; > >>>> int read_delay; > >>>> > >>>> + marvell_nfc_select_target(chip, chip->cur_cs); > >>>> + > >>>> sdr = nand_get_sdr_timings(conf); > >>>> if (IS_ERR(sdr)) > >>>> return PTR_ERR(sdr); > >>> > >>> I had a short look yesterday and this is very likely to be the root > >>> cause of the regression, thank you very much! > >> > >> Yes it is, it fixes the regression I have reported. > >> > >> Do you want me to resend with that nit addressed you mentioned? My > >> version works well, I know that much :) > > > > Yes please, resent with Boris' comment addressed and we'll be fine. > > I tried this now, and with 'chip->cur_cs' instead of 'chipnr', the > regression is back. This function is invoked twice during boot, and in > both cases, 'chip->cur_cs' is -1, while 'chipnr' is 0. The 2nd time this > function is invoked, the 'selected_die' cache value is 0, so > marvell_nfc_select_target() bails early, which seems to be a problem. > > I can't quite make sense of that yet, all I know is that calling > marvell_nfc_select_target() with -1 from > marvell_nfc_setup_data_interface() makes the driver functional again. Hmm. Can you try with the following diff applied? --->8--- diff --git a/drivers/mtd/nand/raw/marvell_nand.c b/drivers/mtd/nand/raw/marvell_nand.c index f38e5c1b87e4..e8eccf6afc8f 100644 --- a/drivers/mtd/nand/raw/marvell_nand.c +++ b/drivers/mtd/nand/raw/marvell_nand.c @@ -722,9 +722,6 @@ static void marvell_nfc_select_target(struct nand_chip *chip, struct marvell_nfc *nfc = to_marvell_nfc(chip->controller); u32 ndcr_generic; - if (chip == nfc->selected_chip && die_nr == marvell_nand->selected_die) - return; - writel_relaxed(marvell_nand->ndtr0, nfc->regs + NDTR0); writel_relaxed(marvell_nand->ndtr1, nfc->regs + NDTR1);