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 DB06AC4743D for ; Tue, 8 Jun 2021 17:56:44 +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 9FD5360FF4 for ; Tue, 8 Jun 2021 17:56:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9FD5360FF4 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 DCB3A82EAC; Tue, 8 Jun 2021 19:56:40 +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="ncmtzmlT"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 58E4F82EA8; Tue, 8 Jun 2021 19:56:39 +0200 (CEST) Received: from mail-ot1-x334.google.com (mail-ot1-x334.google.com [IPv6:2607:f8b0:4864:20::334]) (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 5C64082D2D for ; Tue, 8 Jun 2021 19:56:36 +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-x334.google.com with SMTP id w23-20020a9d5a970000b02903d0ef989477so16769378oth.9 for ; Tue, 08 Jun 2021 10:56:36 -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=Wa0m51T3SxvVSk7TG6i3ERLiYYR6Ku6G2cJwYae0H1I=; b=ncmtzmlTW50ZSKGieBthfGgtcYMkNDWk0AJFdN3XuKBJzxem3Yf4L2aQ4I0F8e3zoT Rq+REu8x2NWjtdbyQ57ezLFy+GAsbLMSfTey5Ka3FMs30A+g9PcnMqV3FfsfaebiTM4C pRugBz6kG2p9/HWR5RdMCrYMYqqcqsSzV00XT9+6187AedE4y/ovAwdD/661kjIU6+bW O39VkD+MEEYW+toaiyM6GH/i75UtKWEegiu6XgrzDOFxfAH2PjRoy523RKGTbK0T0/4j xNaUoYr5sPWadU2UQJS3UkYET2d0olhaWQ+0ceRRLqRJFysDZ88CX5WlRjXP0NcGZa3E wXWg== 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=Wa0m51T3SxvVSk7TG6i3ERLiYYR6Ku6G2cJwYae0H1I=; b=VaP/E/clX8LfUPzfhFbBa6kruxwApLJR2bf5ZJba4pZ+bafWReWXf6MXNvLBxwX8ZZ BP6jQqrQFX8YrZnHp9u/dzFueK8TXnK1C3V1szGPXxujLtL6npDosSvmCyVLPR+cUMak TBaCEl/2D4lYUj0Fn9IjGnWx6bwEECf8befp6LfsC2ipfWnA5vlhMjZKZ8Pziakm/cVI 4Z9BWFutPB/uiD3nNiPPRrY74F71qDTIf9o2QEg1gWMTsGI3pGd5Bbg9jQo9bmdxTVqt NXgb0nGRaX2hXppPDAlW+ptA/cbeXQ0l1pbxm+/RReOSKrhLD7InvalaksIwI4XafWeO wCWA== X-Gm-Message-State: AOAM530/avxTJ1JycH+RzrBuiF1CBntLLXsCUGmKhDmMpadlrHBMZsdI kQv4xGRT2+sb6v+8ZEP3whvoA273UPM= X-Google-Smtp-Source: ABdhPJzlYlDd23IOlj+zcB1fdMt/iSaFT7SqeFmI08yeZQvg674M2cZM2inVf/TiUdaFTDCPl6or1g== X-Received: by 2002:a9d:7558:: with SMTP id b24mr1636653otl.60.1623174994444; Tue, 08 Jun 2021 10:56:34 -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 a24sm3189228otr.3.2021.06.08.10.56.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Jun 2021 10:56:33 -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 v2 0/5] rockchip_sfc: add support for Rockchip SFC Date: Tue, 8 Jun 2021 12:56:21 -0500 Message-Id: <20210608175626.5176-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 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