Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp5990736ybe; Tue, 10 Sep 2019 11:50:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqy6KW7hGMjhQpBJT5JiPxyFr2DDVkxII6E5ku71pies85Aqv+2LOfw45IMX2tGS87VnsSsN X-Received: by 2002:aa7:c80e:: with SMTP id a14mr14569273edt.205.1568141435252; Tue, 10 Sep 2019 11:50:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568141435; cv=none; d=google.com; s=arc-20160816; b=iTH2ug0MuhbSQewYIPx0r1OszQE4QfjitCn07q6LmNZ9T68F+nYvNFJ6a8z3Vub3// YD4ng6IpMv+h7PmdWQAoxkuv+MOji1W26rxQaaXLuWojLDPM4eJlvzRAku2SKNv02fKx cG/mwWeZDHS4v+K7ziYb0XPTzZQgk8U1qHIsuFgLGuI29QlAvHmBH0UfHu1aob26A7lC WefOWMrsiDwaT/3jpWQTTYIt//ssgzLXIdnmsZ4s/UZSX9+Xnnd/tY0/Z5Rs5xNetLYm tfgeYReCX5Hz9+pIAWUJPNohroDdKyPeom6xPG2ltDxv1sIpfBEtGsbtqa1blSBWDb2Q acPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature:dkim-filter; bh=hsCBtVZ6afRsYXrckjljItT6Prlzv9FqLtINzPuvIGs=; b=QZmDhguBhe6x4okz5tvkpSmds2K3edtfyihdSc0kGqcqN60AHCrIK+euNtUE4BuQeZ YeWEc0oG2rnROHzZEYsscdBU0bUE9VYT0AuIwJvZNvh0cVSFC6X4Nq6CNSi/1VWgaDLZ HixUTH4domc7ZkjFZ1HEup7kVwKTjTN2DCLpStpkEJSTezB78e83w/1AmQL9gwK2sRFk cW/3JUAow7sOu+0KSiwNKb8xa6p2fSUR23JtB/Zi32zHMzoIEZUSusIRAaj//CNO9FlX koMwZxIBTyhNpJ+ynbFccVxD1kp5hoKJQ/MlqRMiv8ATn+brruwBzIuoz4v3aDFYgIuK NXHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=zIiaUuDv; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q26si9417360ejx.34.2019.09.10.11.50.10; Tue, 10 Sep 2019 11:50:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=zIiaUuDv; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732665AbfIJHR1 (ORCPT + 99 others); Tue, 10 Sep 2019 03:17:27 -0400 Received: from conssluserg-04.nifty.com ([210.131.2.83]:53921 "EHLO conssluserg-04.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726377AbfIJHR1 (ORCPT ); Tue, 10 Sep 2019 03:17:27 -0400 Received: from mail-vs1-f41.google.com (mail-vs1-f41.google.com [209.85.217.41]) (authenticated) by conssluserg-04.nifty.com with ESMTP id x8A7HElL021816 for ; Tue, 10 Sep 2019 16:17:15 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-04.nifty.com x8A7HElL021816 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1568099835; bh=hsCBtVZ6afRsYXrckjljItT6Prlzv9FqLtINzPuvIGs=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=zIiaUuDvKWGTsx0stSbjODQ3HFdeOn1ktVTBIztypScoJiMV/5t14AwsThyfBMXf3 89Gt1A1yLK4Z0bMFM2sb34wPOXlOUGpk6PFaMySmY0Milq3G+HBqvB+96hLXLq+RhO PsEc1zpy2ApgWVNmrDgrp71k+jr4ZEQoUg1vPbHIucJgYKknFeMls/z7DCf+qTrA3W Fdr8964ODe3HeLSlvYZwqs15UnfpiuueDlVFtJlVxhfV2NXBQt8pBLGSTRPPbSiSMg vQ7RoQG26Uu7w7UOQYtGMOhGYO1ameFi9Gnq+yboUmaphgFgYpiSktVJFJMB4yx3Nk N93UoqjcPSnFg== X-Nifty-SrcIP: [209.85.217.41] Received: by mail-vs1-f41.google.com with SMTP id g14so5031410vsp.1 for ; Tue, 10 Sep 2019 00:17:14 -0700 (PDT) X-Gm-Message-State: APjAAAWSN2BsvcQzih8i9VIDAWXVN/lDJCOrriTwrDcp/u+wlPZzv8sb hevk1s3ZPtZN/3EbTm7wnUyjf2udM8uh/iSQ5t0= X-Received: by 2002:a67:eb18:: with SMTP id a24mr15067230vso.155.1568099833884; Tue, 10 Sep 2019 00:17:13 -0700 (PDT) MIME-Version: 1.0 References: <5143724.5TqzkYX0oI@dabox> In-Reply-To: <5143724.5TqzkYX0oI@dabox> From: Masahiro Yamada Date: Tue, 10 Sep 2019 16:16:37 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: mtd raw nand denali.c broken for Intel/Altera Cyclone V To: Tim Sander Cc: Vignesh Raghavendra , Dinh Nguyen , Richard Weinberger , Linux Kernel Mailing List , Marek Vasut , linux-mtd , Miquel Raynal , Brian Norris , David Woodhouse Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 6, 2019 at 9:39 PM Tim Sander wrote: > > Hi > > I have noticed that there multiple breakages piling up for the denali nand > driver on the Intel/Altera Cyclone V. Unfortunately i had no time to track the > mainline kernel closely. So the breakage seems to pile up. I am a little > disapointed that Intel is not on the lookout that the kernel works on the > chips they are selling. I was really happy about the state of the platform > before concerning mainline support. > > The failure starts with kernel 4.19 or stable kernel release 4.18.19. The > commit is ba4a1b62a2d742df9e9c607ac53b3bf33496508f. Just for clarification, this corresponds to 0d55c668b218a1db68b5044bce4de74e1bd0f0c8 upstream. > The problem here is that > our platform works with a zero in the SPARE_AREA_SKIP_BYTES register. Please clarify the scope of "our platform". (Only you, or your company, or every individual using this chip?) First, SPARE_AREA_SKIP_BYTES is not the property of the hardware. Rather, it is about the OOB layout, in other words, this parameter is defined by software. For example, U-Boot supports the Denali NAND driver. The SPARE_AREA_SKIP_BYTES is a user-configurable parameter: https://github.com/u-boot/u-boot/blob/v2019.10-rc3/drivers/mtd/nand/raw/Kconfig#L112 Your platform works with a zero in the SPARE_AREA_SKIP_BYTES register because the NAND chip on the board was initialized with a zero set to the SPARE_AREA_SKIP_BYTES register. If the NAND chip had been initialized with 8 set to the SPARE_AREA_SKIP_BYTES register, it would have been working with 8 to the SPARE_AREA_SKIP_BYTES. The Boot ROM is the only (semi-)software that is unconfigurable by users, so the value of SPARE_AREA_SKIP_BYTES should be aligned with the boot ROM. I recommend you to check the spec of the boot ROM. (The maintainer of the platform, Dihn is CC'ed, so I hope he will jump in) Second, I doubt 0 is a good value for SPARE_AREA_SKIP_BYTES. As explained in commit log, SPARE_AREA_SKIP_BYTES==0 means the OOB is used for ECC without any offset. So, the BBM marked in the factory will be destroyed. > But in > this case the patch assumes the default value 8 which is straight out wrong > on this variant. Without this patch reverted all blocks of the nand flash are > beeing marked bad :-(. > > When reverting the patch ba4a1b62a2d742df9e9c607ac53b3bf33496508f i can boot > 4.19.10 again. > > With 5.0 the it goes further down the drain and i didn't manage to boot it > even with the above patch reverted. > > I also tried 5.3-rc7 with the above patch reverted and the variable t_x dirty hacked to the > value 0x1388 as i got the impression that the timing calculation is off too. I still get an > interrupt error and boot failure: git-bisect is a general solution to pin point the problem. BTW, if you end up with hacking the clock frequency, something is already wrong. denali->clk_rate, denali->clk_x_rate should be 50MHz, 200MHz, respectively. If not, please check the clock driver and your DT. > [ 0.817588] nand: device found, Manufacturer ID: 0x2c, Chip ID: 0xda > [ 0.823946] nand: Micron MT29F2G08ABAEAWP > [ 0.827965] nand: 256 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64 > [ 1.887052] denali-nand-dt ff900000.nand: timeout while waiting for irq 0x1000 > [ 2.911056] denali-nand-dt ff900000.nand: timeout while waiting for irq 0x1000 > > I have seen this https://lore.kernel.org/patchwork/patch/983055/ thread and > this might fix at least the 4.19 boot problem. > > I would be really happy for hints how to get the Intel Cyclone V working again. > > Best regards > Tim > > > > > ______________________________________________________ > Linux MTD discussion mailing list > http://lists.infradead.org/mailman/listinfo/linux-mtd/ -- Best Regards Masahiro Yamada