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=-0.7 required=3.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS autolearn=unavailable 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 73777C10F0E for ; Sun, 7 Apr 2019 19:55:30 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4261E20880 for ; Sun, 7 Apr 2019 19:55:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="rVBXHls1"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="LapOJaf0" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4261E20880 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=3rk9f0PeTFcYQx0f7mFuQUOXoxsnlTamUlmlUZYwuiI=; b=rVBXHls1EH5dvF HkIiqNzpgu8wlYT+ZseoY8zUFlw2Zuzo1nUj6yXcNxVzvRqaqK0mHyEf+Gcigs49iHNpupSf0//b6 b4Ul0JR+YMCZhjjwx3mpGGC/SI49dchCy7108gbGgLBL8Tt0DDpu1aAb+wWrXzYB+b2vUoEi4QdqZ xE266c50suDf+r+TzvEcdvbQvAcHx8BQyP8Qth12XXkQmO5vkARmOvGwk39OD5jlbG0yfD+8QpKpF 5Q0UyRljm12vPsE82xoRy9sEs4eshXFgfUazR92l5ukBhRlBt8Y5Pebnv80e860l1/62DIxpy7GqK YzqK5XPUzFJ/mstz95VA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hDDt1-000820-4M; Sun, 07 Apr 2019 19:55:27 +0000 Received: from mail-io1-xd41.google.com ([2607:f8b0:4864:20::d41]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hDDsx-00080l-3q; Sun, 07 Apr 2019 19:55:24 +0000 Received: by mail-io1-xd41.google.com with SMTP id d201so9224584iof.7; Sun, 07 Apr 2019 12:55:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=2EWbvybACw2pSft+F1QNp/jKhIc9KZCDXtH4EJ6g6PI=; b=LapOJaf0RNbdg3JVgScEJq9pCS0Le+0P958mg0oFP14h4/F3pWrmrL2pmQxZ44k7Mz 4Jh9Rlt9CeHevs7Ji3Uv58E5fTxTLJOR+zUvUI7lyoTa62IxW+2dfFFCpmxTanq84Ylm 1PSI8IcvLZ13rV6Tu46cacvm+EtSJgSvGSEIga5RB35J358D/4Z2FoIIKrIlN1c/A6bf Kpqck6qDWWWDZJdSHnRLTSEhX0LkcOh/nIK3qzY9gCu1n2lZf8FMYo+t8uhl4u4FainX H5YQopnB/9aFWbpwABmKfS3yrsMoFoNRHRSrXUYIq5Je79+gXHlbXQQnkV0CHOxpa2zt HgmQ== 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=2EWbvybACw2pSft+F1QNp/jKhIc9KZCDXtH4EJ6g6PI=; b=RuKjbPvHrOXysdDfxC5PhnWuoYFrg5Iet+5GJSEOP7IngD9i4QjWQFaOq1Gg3cjIzi L0Ws16a5gWTl+p1F2vHS+VDpdb7yPMtt31RjM5g1lP+PYCaE3gWAbklQG1sqSi/w3me5 rHaWGPbmmVil6hJIiM+Qn1vznFza47Em7II1Xzu6TioSTUS1e+M/QuHAyv0dg0kEbYVx 3WT1aHmFo3lFDyBDSSOt1CH+e1fpkFHiB6m9Pveax9uCA/zJ6eyI2Bdtl1W3oD6keTyz avI2LAlm19sld70JwnFdR3isaZMdrVavDmaYXRKK3rDVxs5S/c24XUtpSi1iUDfpPt+f HnbQ== X-Gm-Message-State: APjAAAWMrH2NBFuuW5HNd6ZrDwuK28LqmA8//2rJ7DoXCjb6ZdoU2HSc CjXQ/a/YwPHErsQ1wijqJXB0svrX4m1w7WJ9VBk273ZS X-Google-Smtp-Source: APXvYqx0LbMcwaYEC11t/Y3Vniv00WToYUFSWOlFL+8L3oi45ov8pNkWZxG8I5pM/VSOKPTXEp2h4M7SHTy+WojY6+k= X-Received: by 2002:a6b:ca87:: with SMTP id a129mr16787818iog.187.1554666921482; Sun, 07 Apr 2019 12:55:21 -0700 (PDT) MIME-Version: 1.0 References: <21d83ed2-a8db-49cf-ba8c-c7844157d7b0@gmail.com> In-Reply-To: <21d83ed2-a8db-49cf-ba8c-c7844157d7b0@gmail.com> From: Emil Renner Berthing Date: Sun, 7 Apr 2019 21:55:10 +0200 Message-ID: Subject: Re: [BUG] Rockchip SPI: long burst writes produce unexpected result To: Vicente Bergas X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190407_125523_184182_7C482484 X-CRM114-Status: GOOD ( 14.41 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Heiko Stuebner , Linux Kernel Mailing List , linux-spi@vger.kernel.org, "open list:ARM/Rockchip SoC..." , Mark Brown , linux-arm-kernel Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Vicente, On Sat, 6 Apr 2019 at 19:35, Vicente Bergas wrote: > > Hi, > i have been experiencing issues writing to NOR-Flash SPI Memories > from two RK3399-based platforms: gru-kevin and sapphire board. > For kevin, this resulted in a bricked device because that memory > is the only boot device. > Fortunately an external programmer is available. > > In order to isolate where the issue can be, several tests have been > done, after which it makes me think the issue is related to the > Rockchip SPI driver. > > 4KB burst reads work fine. > The issue is only observed on the write burst length. > > Test user user/kernel kernel RK3399 > Num space interface space SoC Status Notes > -------------------------------------------------------- > 1 flashrom linux_mtd MTD/RKspi RKspi Fail > 2 flashrom linux_spi RKspi RKspi Fail > 3 flashrom linux_spi spi_gpio GPIO OK > 4 custom linux_spi spi_gpio GPIO OK 260-byte burst writes > 5 custom linux_spi RKspi RKspi Fail 260-byte burst writes > 6 custom linux_spi RKspi RKspi OK 1-byte burst writes > 7 custom linux_spi RKspi RKspi OK 47-byte burst writes > 8 custom linux_spi RKspi RKspi Fail 48-byte burst writes > > 3, 4) Unaccetably slow, device tree is > spi_gpio { > compatible = "spi-gpio"; > #address-cells = <1>; > #size-cells = <0>; > cs-gpios = <&gpio1 RK_PB2 GPIO_ACTIVE_HIGH>; > sck-gpios = <&gpio1 RK_PB1 GPIO_ACTIVE_HIGH>; > mosi-gpios = <&gpio1 RK_PB0 GPIO_ACTIVE_HIGH>; > miso-gpios = <&gpio1 RK_PA7 GPIO_ACTIVE_HIGH>; > num-chipselects = <1>; > spidev@0 { > compatible = "spidev"; > reg = <0>; > spi-max-frequency = <50000000>; > }; > }; > 2, 5, 6, 7, 8) device tree is > &spi1 { Since you say reverting the "set min/max speed" patch fixes your issues could you try raising the spi clock like this and see if it works for you? + assigned-clocks = <&cru SCLK_SPI1>; + assigned-clock-rates = <400000000>; Of course the driver shouldn't let you configure the spi-controller in a way that makes it skip bytes, but if this works for you then I still think you're better off explicitly setting the spi clock speed rather than having the driver raise it for you. At least while it does it without checking for errors or having a way to lower it again as outlined in the commit message. > status = "okay"; > spidev@0 { > compatible = "spidev"; > reg = <0>; > spi-max-frequency = <50000000>; > }; > }; > ... /Emil _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel