From patchwork Tue Jun 15 19:10:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Morgan X-Patchwork-Id: 1492419 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=MuYGEf8e; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4G4Hwl5mWdz9sCD for ; Wed, 16 Jun 2021 05:11:17 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9E41B828C2; Tue, 15 Jun 2021 21:11:05 +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="MuYGEf8e"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 30C02828A4; Tue, 15 Jun 2021 21:11:02 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ot1-x333.google.com (mail-ot1-x333.google.com [IPv6:2607:f8b0:4864:20::333]) (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 516C8828A4 for ; Tue, 15 Jun 2021 21:10:58 +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-x333.google.com with SMTP id 6-20020a9d07860000b02903e83bf8f8fcso15348494oto.12 for ; Tue, 15 Jun 2021 12:10:58 -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=Gpym9HkZXlO+x0btEgNp117r1ERQLw6p6U3KOxM1Wa0=; b=MuYGEf8eDD3Xu+4ovq308Cb0/R1u1/FB4TdFkkPpzooz58qIXaZGS8kZ3sHbT8yfsx g0+rmHOi4P90SK9LKQOY/t6gu3WQnZ+Ajij013C3MEr3OjsLIiEaH6Fet/6TORNizC1x +YATvSuXtdN8mq83rWeV3LVDBA3pkn5Mak9rmEOmYbUxesb644LdDoOx0pJXD8FoWBr+ 65IZIJgfmRvrqEqjFbBn+qpX+LNnfc6JRr696D4in1q/Qd9M3CEKLHgLQS+qQKOX5Cjf W43eLr8IiQnc6vpeQ2nyKSLuhrbIm0ajUgtd/ma35YyycGgPDv3ZVOd1KiIH4gKt0W+q CfgQ== 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=Gpym9HkZXlO+x0btEgNp117r1ERQLw6p6U3KOxM1Wa0=; b=AboEkLwAonyVAtL5xtkMW3erKrh3EieZ5o7EdoJBCfrh2i4by6rUj5UdqXYBrIjJJd zWg+ZVL5qccwBMzbf4wZwi+UNmr5CoZa4f1lEsu3bg1OZlTWwyE+rmwZ543RImq+36q6 8mMpRBKr7bsWvdZtgmEgnz+O+vNFfI10b/sxpt2VXrM0SgA7UFCHhP7ggj+A/TeCvXsj qO4jrYt8Q0hgH42Tab5VaGS5hniQqbp8Xl3fr3oWwygBLXjfHzqj6BbcEa2PiSzJ4tqV rnkUe6UGeTfeXd9CrR/Mvxwoyw7js5c3fDOu/5JiYNN3jaQohfsgnGq/Tx+UaIdiYUvc hM1w== X-Gm-Message-State: AOAM533Jwoz4rrxJS4NReQx+Mdu/7Z8VX/L+bivJJ6/B6DMGCxCf8Ygv c2ETALPPJW80T4U86ejPm4SOvGKkD3s= X-Google-Smtp-Source: ABdhPJxAA3H2jYFhK4UqqRpAKAXA6Vqd4lbslD2DGwPu5NTAS+HiP8s5l29Grezn95oEaNLUnsuEQw== X-Received: by 2002:a9d:66d9:: with SMTP id t25mr600499otm.217.1623784254966; Tue, 15 Jun 2021 12:10:54 -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 m10sm3960873oig.9.2021.06.15.12.10.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Jun 2021 12:10:54 -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, macromorgan@hotmail.com Subject: [PATCH v4 0/5] rockchip_sfc: add support for Rockchip SFC Date: Tue, 15 Jun 2021 14:10:41 -0500 Message-Id: <20210615191046.11812-1-macroalpha82@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 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.103.2 at phobos.denx.de X-Virus-Status: Clean From: Chris Morgan Changes from v3: - Added "rockchip_sfc_adjust_op_work()" function from proposed Linux driver to fix potential issue on hardware. Note I never noticed this issue while testing, so I cannot test if it fixed any specific issue for me. - Updated of-compatible string back to "rockchip,sfc" to match what is currently proposed for upstream driver. The hardware itself has multiple versions but a register is present in the hardware that is read by the driver to set version specific functionality. - Updated px30.dtsi and rk3266-odroid-go2.dts device-trees so that sfc nodes match what is in upstream. 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. Known Issues Remaining with this Patch Series: 1) I don't know the best way to upstream the XTX25F128B flash chip. This chip should use a continuation code for the manufacturer ID, however I cannot seem to find any way to actually read the continuation code as one may not be present. 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. 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. FIFO mode was removed from the driver to simplify it and for this reason. Tested: Read (works) Write (works) 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 | 18 + 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 | 4 + drivers/spi/Kconfig | 8 + drivers/spi/Makefile | 1 + drivers/spi/rockchip_sfc.c | 513 +++++++++++++++++++++ 9 files changed, 668 insertions(+) create mode 100644 drivers/spi/rockchip_sfc.c