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=-10.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT 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 43E19C47082 for ; Tue, 8 Jun 2021 18:11:28 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7523A61278 for ; Tue, 8 Jun 2021 18:11:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7523A61278 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0750C82EAF; Tue, 8 Jun 2021 20:11:18 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="XQV2P7Ua"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E2F5E82EBA; Tue, 8 Jun 2021 20:11:14 +0200 (CEST) Received: from mail-ot1-x335.google.com (mail-ot1-x335.google.com [IPv6:2607:f8b0:4864:20::335]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 8516A80050 for ; Tue, 8 Jun 2021 20:11:08 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=macroalpha82@gmail.com Received: by mail-ot1-x335.google.com with SMTP id i12-20020a05683033ecb02903346fa0f74dso21192969otu.10 for ; Tue, 08 Jun 2021 11:11:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=/GWnLWFxqatBV594qMw2ItSemFrpExvK6wZ97atdTTw=; b=XQV2P7UatrnmZ/djUZ/bdp/NBbsKs1+PpbIKgbnc4bap+ibVmq9/7aPzilbfKU9tlr XBgbqZvd1Q1GJ8PIz1PUR16RUEAHXn8xOgf5Yyga0TpP7Nst3R0FCZA/O9D3PbIe0Jbp J5gvocNmDn6FbJMC/W6/b54YXT5Nd0l9/emqmOS7Q8wG1oYiCKNWkeBPP0wkyg0KPkfw pt0YMUcupuL48VcsrJKWxWslJBR/IGu5YHHM56bKF3Pf4NJfw8yx9nTEBixky/15v+f5 UISYJLmIZ7lT8fF/TyCvzDNh+NW/EkCxZYkGd1had6qz16JujM84BiksnB9as3A7ymfg IJ3Q== 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:message-id:mime-version :content-transfer-encoding; bh=/GWnLWFxqatBV594qMw2ItSemFrpExvK6wZ97atdTTw=; b=Djm4But8q5f/celMzeM2AACNfCD71Cq4Z5pB8ktmKcJOS0CPwhi1CNNChOzaXp3ZW7 McoEgG0nXr1BA6u6nOIoo9k3nrBDMStGVufHmygTiPMtgfYIJw0e5TUR3c9finD1yk8L VwXY5lApcRw08LzyVGNTS2+2pyf3rLZWODKmMX+vBpHoXaKX04uk7Uiu8ebfVrhV/ZVp lAmis35A03EfGmLXxKMw1W7pz+WA5gXOa8PsSxgZdgW5acEjlUzbYbC+Gy/ACIn1hLqA 2ICEV6GxgfVKkae8fA00Qs3xVPWF3/YlLfOE8Lv9d2s58ADXNFosljI4IsTvw0pQB6hx MiPA== X-Gm-Message-State: AOAM532ZfzMXAyesip39MKpRJPchdYwCF2pqgIAlx9y8Zq33SdQKDXlT Dq707Spe7k8ForeSbILEx64ymGvEZGI= X-Google-Smtp-Source: ABdhPJx6F17q1TVaJ2c9Srz7QaR7ONysbZpUvj1cwiwoJRkiXmG5QHQACsbqSxNfKM/TV+SFVXCHNg== X-Received: by 2002:a9d:2034:: with SMTP id n49mr16927592ota.231.1623175866867; Tue, 08 Jun 2021 11:11:06 -0700 (PDT) Received: from wintermute.localdomain (cpe-76-183-134-35.tx.res.rr.com. [76.183.134.35]) by smtp.gmail.com with ESMTPSA id n66sm2894199oih.50.2021.06.08.11.11.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Jun 2021 11:11:06 -0700 (PDT) From: Chris Morgan To: u-boot@lists.denx.de Cc: heiko.stuebner@theobroma-systems.com, vigneshr@ti.com, jagan@amarulasolutions.com, kever.yang@rock-chips.com, philipp.tomsich@vrull.eu, sjg@chromium.org, jon.lin@rock-chips.com, Chris Morgan Subject: [PATCH v3 0/5] rockchip_sfc: add support for Rockchip SFC Date: Tue, 8 Jun 2021 13:10:55 -0500 Message-Id: <20210608181100.14093-1-macroalpha82@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.4 at phobos.denx.de X-Virus-Status: Clean From: Chris Morgan Changes from v2: - Resending due to glitch with patch file truncating final two lines on patch 1/5 and incorrect patch version number on patch 5/5. Changes from v1: - Reworked code to utilize spi-mem framework, and based it closely off of work in progress code for mainline Linux. - Removed DMA, as it didn't offer much performance benefit for booting (in my test cases), added complexity to the code, and interfered with A-TF. - Updated the names of the bindings to match the work in progress Linux code. - Moved alias to u-boot specific device-tree for Odroid Go Advance. Alias is updated with the spi0 node pointing to the SFC to help the sf command as well as facilitate booting from the SFC. - Note 2 below no longer applies, as rebasing this off of upstream code should allow the device to work for NAND, and by utilizing the spi-mem framework it no longer has to extract the parameters from the dm_spi_ops.xfer. Requesting comments for a proposed patchset for adding the Rockchip serial flash controller to u-boot. The goal of these patches is to enable it for the Odroid Go Advance so that it may eventually boot exclusively from the SFC on mainline U-boot (I have tested this and it works). The specific help I need with this patch is: 1) I don't know the best way to upstream the XTX25F128B flash chip. This chip uses a continuation code for the manufacturer ID, however I cannot seem to find any way to actually read the continuation code. There is a risk of this driver, used as-is, to collide with another chip which has the same manufacturer ID with a different continuation code. 2) The Rockchip SFC driver itself (as it is mostly as-is from the BSP U-Boot sources) supports SPI NAND and chips of varying sizes, but my implementation only permits me to test with a single 128Mb flash chip. The driver itself does some checking on the bitlen in the routine rockchip_sfc_xfer() which is what is called for the dm_spi_ops.xfer. I'm not sure if there is a better way to do this. Additionally, I have to bit-shift the address written to the SFC as I suspect the value is meant to be left justified, but I never tested it further. Additionally, it might be worth mentioning but I noticed the Rockchip BROM will only boot the TPL/SPL off of the SFC if I write it to address 0x10000. This is not documented and different than the address looked at for SD card booting (512 * 64 = 0x8000 for SD Card booting). Also, like the SD card driver I can confirm that if DMA is enabled at the SPL stage A-TF seems to fail silently, then when Linux loads it hangs. There is an ifdef to force FIFO mode only in the SPL stage. Tested: Read (works) Write (works if you write to an erased sector) Erase (works) SPL Read (works if you edit the u-boot,spl-boot-order) Chris Morgan (5): spi: rockchip_sfc: add support for Rockchip SFC rockchip: px30: Add support for using SFC rockchip: px30: add the serial flash controller mtd: spi-nor-ids: Add XTX XT25F128B rockchip: px30: add support for SFC for Odroid Go Advance arch/arm/dts/px30.dtsi | 38 ++ arch/arm/dts/rk3326-odroid-go2-u-boot.dtsi | 17 + arch/arm/dts/rk3326-odroid-go2.dts | 16 + arch/arm/mach-rockchip/px30/px30.c | 64 +++ drivers/mtd/spi/Kconfig | 6 + drivers/mtd/spi/spi-nor-ids.c | 8 + drivers/spi/Kconfig | 8 + drivers/spi/Makefile | 1 + drivers/spi/rockchip_sfc.c | 495 +++++++++++++++++++++ 9 files changed, 653 insertions(+) create mode 100644 drivers/spi/rockchip_sfc.c -- 2.25.1