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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BF541C433F5 for ; Wed, 23 Feb 2022 17:16:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243334AbiBWRRP (ORCPT ); Wed, 23 Feb 2022 12:17:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238195AbiBWRRP (ORCPT ); Wed, 23 Feb 2022 12:17:15 -0500 Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0CC59340FE for ; Wed, 23 Feb 2022 09:16:45 -0800 (PST) Received: from [127.0.0.1] (p578adb1c.dip0.t-ipconnect.de [87.138.219.28]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: marex@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id 08C9183CA4; Wed, 23 Feb 2022 18:16:42 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1645636603; bh=RgbkOZTT6CdelzgfuHz+sgXFDq3+udCp8tIBFBR3nKw=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=YQorQK8QIr6WHlKqCRpIh2TRB5prnJ+pZTj9XicR4E1fbSadCCB5gM451vAtdqRB5 Z03lchYm/S6DnplKUh+uL2tmP8lTk4L5xNG9tyYrp+cfDeyg0XkJdwkyt9x+5KySc8 hCAG/DWdH0H0VPLrM/HBAEnSeDYnGixpIpR/stdiVD4maEYzDCpciT0TGUCOejd0UQ ALm0zDjKNKDAG4yFFqob+ELE2LpqWxG7mPF31O2ppy7r8zWaLaZYCQtjith+n8NrDe P9oBRPpsYhIHjjMgOJJqjaxVHhiWNh1dPbrE2q4+D5rZYWdZAW4rS+g2u3KZsVtD7P 2OjaK9I9tzWRA== Message-ID: Date: Wed, 23 Feb 2022 18:16:42 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.6.0 Subject: Re: [PATCH] [RFC] spi: cadence-quadspi: Disable DAC on SoCFPGA Content-Language: en-US To: Dinh Nguyen , linux-spi@vger.kernel.org Cc: Pratyush Yadav References: <20220221043238.295369-1-marex@denx.de> <79280984-e71d-e767-bb67-bd2a2fe31858@kernel.org> <04e70d1a-c07b-e1dc-aea6-36fe9b7ce667@kernel.org> <8060ae0e-700e-3b72-3ab9-e7ca8e19ad9e@denx.de> <8dc7a7d6-d24f-b3a6-32b9-64cdb8c6f3be@kernel.org> <861ec3ba-65c5-d4e9-d1f4-9f7e5408f7cf@denx.de> <0ad3907c-660c-af7a-89b6-ca6954c08813@kernel.org> From: Marek Vasut In-Reply-To: <0ad3907c-660c-af7a-89b6-ca6954c08813@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org On 2/23/22 17:46, Dinh Nguyen wrote: > > > On 2/23/22 10:43, Marek Vasut wrote: >> On 2/23/22 17:28, Dinh Nguyen wrote: >>> >>> >>> On 2/22/22 18:54, Marek Vasut wrote: >>>> On 2/22/22 22:32, Dinh Nguyen wrote: >>>>> >>>>> >>>>> On 2/22/22 12:30, Marek Vasut wrote: >>>>>> On 2/22/22 16:49, Dinh Nguyen wrote: >>>>>>> >>>>>>> >>>>>>> On 2/21/22 11:05, Marek Vasut wrote: >>>>>>>> On 2/21/22 17:38, Dinh Nguyen wrote: >>>>>>>>> >>>>>>>>> >>>>>>>>> On 2/20/22 22:32, Marek Vasut wrote: >>>>>>>>>> On SoCFPGA Gen5, DAC memcpy_fromio() in >>>>>>>>>> cqspi_direct_read_execute() >>>>>>>>>> leads to data abort, disable DAC to avoid triggering it: >>>>>>>>>> >>>>>>>>>> Unhandled fault: imprecise external abort (0x1406) at 0x0400d3e9 >>>>>>>>>> [0400d3e9] *pgd=00000000 >>>>>>>>>> >>>>>>>>>> Signed-off-by: Marek Vasut >>>>>>>>>> Cc: Dinh Nguyen >>>>>>>>>> Cc: Pratyush Yadav >>>>>>>>>> --- >>>>>>>>>>   drivers/spi/spi-cadence-quadspi.c | 2 +- >>>>>>>>>>   1 file changed, 1 insertion(+), 1 deletion(-) >>>>>>>>>> >>>>>>>>>> diff --git a/drivers/spi/spi-cadence-quadspi.c >>>>>>>>>> b/drivers/spi/spi-cadence-quadspi.c >>>>>>>>>> index b808c94641fa6..65f2c2449be09 100644 >>>>>>>>>> --- a/drivers/spi/spi-cadence-quadspi.c >>>>>>>>>> +++ b/drivers/spi/spi-cadence-quadspi.c >>>>>>>>>> @@ -1870,7 +1870,7 @@ static const struct >>>>>>>>>> cqspi_driver_platdata intel_lgm_qspi = { >>>>>>>>>>   }; >>>>>>>>>>   static const struct cqspi_driver_platdata socfpga_qspi = { >>>>>>>>>> -    .quirks = CQSPI_NO_SUPPORT_WR_COMPLETION, >>>>>>>>>> +    .quirks = CQSPI_DISABLE_DAC_MODE | >>>>>>>>>> CQSPI_NO_SUPPORT_WR_COMPLETION, >>>>>>>>>>   }; >>>>>>>>>>   static const struct cqspi_driver_platdata versal_ospi = { >>>>>>>>> >>>>>>>>> Acked-by: Dinh Nguyen >>>>>>>> >>>>>>>> Is this DAC really not working on socfpga gen5 or is there some >>>>>>>> other issue ? >>>>>>> >>>>>>> I don't know the answer to this question. What is the DAC in the >>>>>>> QSPI module and how do I go about testing it? >>>>>> >>>>>> DAC = direct access. >>>>>> >>>>>> How do you go about testing this -- compile kernel with/without >>>>>> this patch, boot on SoCFPGA Gen5 with QSPI NOR attached, the >>>>>> kernel crashes without this patch on imprecise external abort. >>>>> >>>>> Hmm...I just tested v5.17-rc3 on a C5 board and QSPI looks to be >>>>> working fine: >>>>> >>>>> [    1.744489] spi-nor spi1.0: found n25q512ax3, expected mt25qu02g >>>>> [    1.750534] dma-pl330 ffe01000.pdma: Reset Channel-0  CS-f >>>>> FTC-40000 >>>>> [    1.756941] spi-nor spi1.0: n25q512ax3 (65536 Kbytes) >>>>> [    1.762369] 2 fixed-partitions partitions found on MTD device >>>>> ff705000.spi.0 >>>>> [    1.769425] Creating 2 MTD partitions on "ff705000.spi.0": >>>>> [    1.774925] 0x000000000000-0x000000800000 : "Flash 0 Raw Data" >>>>> [    1.781942] 0x000000800000-0x000008000000 : "Flash 0 jffs2 >>>>> Filesystem" >>>>> [    1.788468] mtd: partition "Flash 0 jffs2 Filesystem" extends >>>>> beyond the end of device "ff705000.spi.0" -- size truncated to >>>>> 0x3800000 >>>> >>>> I wonder if we might be missing some clock enable somewhere. >>>> >>>> Can you mail me the whole boot log ? (I'm using u-boot 2022.01 btw.) >>> >>> I tested with U-Boot 2022.01 as well: >>> >>> >>> => run nfsboot_dinh >>> Kernel image @ 0x1000000 [ 0x000000 - 0x54edd0 ] >>> ## Flattened Device Tree blob at 02000000 >>>     Booting using the fdt blob at 0x2000000 >>>     Loading Device Tree to 09ff8000, end 09fffeb1 ... OK >>> >>> Starting kernel ... >>> >>> Deasserting all peripheral resets >>> [    0.000000] Booting Linux on physical CPU 0x0 >>> [    0.000000] Linux version 5.17.0-rc3 (dinguyen@linux-builds1) >>> (arm-linux-gnue abihf-gcc (Ubuntu/Linaro 7.5.0-3ubuntu1~18.04) 7.5.0, >>> GNU ld (GNU Binutils for U buntu) 2.30) #1 SMP Wed Feb 23 08:51:18 >>> CST 2022 >>> [    0.000000] CPU: ARMv7 Processor [413fc090] revision 0 (ARMv7), >>> cr=10c5387d >>> [    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing >>> instructio n cache >>> [    0.000000] OF: fdt: Machine model: Altera SOCFPGA Cyclone V SoC >>> Development  Kit >>> [    0.000000] Memory policy: Data cache writealloc >> >> This is weird. >> >> One more thing, I have two SPI NORs on this CQSPI, one on each chip >> select, do you think that can make any difference ? >> >> Besides that, I used latest next for my tests, not latest linus tree. > > Let me test on latest next. Thank you If you cannot reproduce it there, drop this patch and I'll revisit this on my side.