Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1377273yba; Sat, 6 Apr 2019 10:35:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqwsuoyX+u5sGSYygft3HDxCmFURuDGvoTiHfUHwnD4yUPGv9HIs3kFvXj8HkBKuJ4upe5sM X-Received: by 2002:a62:1b8a:: with SMTP id b132mr20034543pfb.19.1554572138178; Sat, 06 Apr 2019 10:35:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554572138; cv=none; d=google.com; s=arc-20160816; b=XUEIEoqXviOoxNrD65wTr3RnGOo+rAIHc5xsKwANyWPGnJrPDffpHghUi6CHLLBbFE WVD2SKduKMaHkoOKrfAhbR5vk+NWyIKRKOweKXIx0/wjjQvjf+ft3tDlQaRhOAiEyFl1 fxCcj8R5zggdz5ppSMXTG370IdyGDNiXnKZN/PpOvwc2rGP9dmVTiQsxUEgmL21TYXhZ 69z04LIqCaB8qJyh0Wfq7rUgNYr8qGJcCvVAxqbMs7M/3M2iok4SaYejG6o6H2NXd+4t O+dGp/AGJUrl2z58Dgx71dsU7iXVnrhX7NzhNZaGY1ewlhOKqH3PVoOIpwGo3f/pOvn1 2Inw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:user-agent :message-id:mime-version:date:subject:cc:to:from:dkim-signature; bh=922JEjccApCj82iz5uZPCYJJCIUu+JvOgZ+xR8ZEMjY=; b=KsW3hhpSDS9CjlOLsSC+jQcb/t/TL9ya6RvhWckVwSaaQHSH+pZf0RfnzW2emR/Kog XFX9mkFRYjMqvuKnBmPPxdgF14z8J4Mm9xQjBkU9R2R5BRe/O42dQGzewlCoTmSzIlPs V942Fw+oohz5/QORJqlUHi4tR+SDsbQLdmvoH/xOIcMwAuX86uD+vb7hh232FuoiYJwE gRn7I0oihTcQg/uK1ca0cF0fkU81k+jLmiFLqWEzxLZEZaM+IUMjnm4E6bdjnDH5B/rg 1yfs7wN6EgYIZTOcfP3D48Q0PZ3Nw8tmp4YLB8UNFGcCkpYXDl+T66WHB1rJEIHlNh1C jvXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=iMu6tqRc; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l68si22247846plb.342.2019.04.06.10.35.22; Sat, 06 Apr 2019 10:35:38 -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=@gmail.com header.s=20161025 header.b=iMu6tqRc; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726580AbfDFReh (ORCPT + 99 others); Sat, 6 Apr 2019 13:34:37 -0400 Received: from mail-wr1-f52.google.com ([209.85.221.52]:32983 "EHLO mail-wr1-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726452AbfDFReh (ORCPT ); Sat, 6 Apr 2019 13:34:37 -0400 Received: by mail-wr1-f52.google.com with SMTP id q1so11621017wrp.0; Sat, 06 Apr 2019 10:34:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:mime-version:message-id:user-agent :content-transfer-encoding; bh=922JEjccApCj82iz5uZPCYJJCIUu+JvOgZ+xR8ZEMjY=; b=iMu6tqRcaj9vZlfdH8r/b//41d+HURHTSDwmuCj1Ey3Z28VNJIrnLZ2s5qjBp4jJbS gdEJZosuyA3LmhhlIgEeTqqC8WGZhBFSYl5sdzjx0y8akM4a3Dw0IBoYgetrhweXLS+b p0cx33GGo57C+ym3oJf1Z87/ruyyLc1Esc3GgKKx+Tvoyyq46CMWQB6FZ3GdtwIFWP5j 4rqXHxgSbRIsUhFLFsprQNct7lZU5Qla5duNyRHEOVa34KBPgPjO5s4fVUwa2E6VaLaf KI7bYO/fkUiwUZNidHvKuNVILwBMtq82rgxGeSwPiWkcILtinziFnCr8KyJcpRdqxTv2 acBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:mime-version:message-id :user-agent:content-transfer-encoding; bh=922JEjccApCj82iz5uZPCYJJCIUu+JvOgZ+xR8ZEMjY=; b=lmc/aLSUGEvc9caZly3rFyCz9ONMBAum297oOUY7eRcAIK5fC5+XM2x/Ixec2a7EN4 HJIDh0r7CiqW5ZrBqEByEVP/aQqdZjk9jYrDkkKeApzf2FiPHQbKJU5cOuzZjbKTpoCo bkACG3xPFNaRsGdGWPl8MRx+/dmxk46hGcrD9lmY9f/B0/YBgUKx7jBJx8+tc9EnkYuU /crv0sTrRK3L46dABXKmIX6ZBmXFocyW+zVR+rgrnICTzIBDj4um+MvXhNS+HsbzUyGu PNj0LGS+HdAmdIjFKaMgprNPVDyubCR95emlrtGLYOcqfmZuMCbwKXkwhpzsLn4psIKQ TjNw== X-Gm-Message-State: APjAAAUSeJdRJ1/JZeXUscMec2HAuhQijRtG85JvXl9OdKih063adaJh eU6Jr0Yb/yXVwp2jh4dVBaQ= X-Received: by 2002:adf:eac9:: with SMTP id o9mr12158138wrn.85.1554572074876; Sat, 06 Apr 2019 10:34:34 -0700 (PDT) Received: from localhost ([92.59.185.54]) by smtp.gmail.com with ESMTPSA id d6sm35360220wrx.62.2019.04.06.10.34.33 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sat, 06 Apr 2019 10:34:33 -0700 (PDT) From: Vicente Bergas To: , , Mark Brown , Heiko Stuebner Cc: , Subject: [BUG] Rockchip SPI: long burst writes produce unexpected result Date: Sat, 06 Apr 2019 19:34:32 +0200 MIME-Version: 1.0 Message-ID: <21d83ed2-a8db-49cf-ba8c-c7844157d7b0@gmail.com> User-Agent: Trojita Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 =20 Num space interface space SoC Status Notes=20 -------------------------------------------------------- 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 =3D "spi-gpio"; #address-cells =3D <1>; #size-cells =3D <0>; cs-gpios =3D <&gpio1 RK_PB2 GPIO_ACTIVE_HIGH>; sck-gpios =3D <&gpio1 RK_PB1 GPIO_ACTIVE_HIGH>; mosi-gpios =3D <&gpio1 RK_PB0 GPIO_ACTIVE_HIGH>; miso-gpios =3D <&gpio1 RK_PA7 GPIO_ACTIVE_HIGH>; num-chipselects =3D <1>; spidev@0 { compatible =3D "spidev"; reg =3D <0>; spi-max-frequency =3D <50000000>; }; }; 2, 5, 6, 7, 8) device tree is &spi1 { status =3D "okay"; spidev@0 { compatible =3D "spidev"; reg =3D <0>; spi-max-frequency =3D <50000000>; }; }; 5, 6, 7, 8) Burst writes are performed this way enum { BURST =3D 48 }; struct spi_ioc_transfer msg[0x105]; unsigned i =3D 0; for (unsigned j =3D 0; j < wcnt; j +=3D BURST) { msg[i++] =3D { .tx_buf =3D warr, .len =3D BURST