uboot-sunxi: add SPI patches for T113 and add SPI variant for MYIR
authorZoltan HERPAI <wigyori@uid0.hu>
Thu, 20 Jul 2023 16:43:48 +0000 (18:43 +0200)
committerZoltan HERPAI <wigyori@uid0.hu>
Thu, 20 Jul 2023 16:43:48 +0000 (18:43 +0200)
Signed-off-by: Zoltan HERPAI <wigyori@uid0.hu>
package/boot/uboot-sunxi/patches/4200-spi.patch [new file with mode: 0644]
package/boot/uboot-sunxi/patches/4201-myir-spi.patch [new file with mode: 0644]

diff --git a/package/boot/uboot-sunxi/patches/4200-spi.patch b/package/boot/uboot-sunxi/patches/4200-spi.patch
new file mode 100644 (file)
index 0000000..c4d20f5
--- /dev/null
@@ -0,0 +1,751 @@
+From patchwork Fri May 19 13:40:07 2023
+Content-Type: text/plain; charset="utf-8"
+MIME-Version: 1.0
+Content-Transfer-Encoding: 7bit
+X-Patchwork-Submitter: Maksim Kiselev <bigunclemax@gmail.com>
+X-Patchwork-Id: 1783781
+X-Patchwork-Delegate: andre.przywara@arm.com
+Return-Path: <u-boot-bounces@lists.denx.de>
+X-Original-To: incoming@patchwork.ozlabs.org
+Delivered-To: patchwork-incoming@legolas.ozlabs.org
+Authentication-Results: legolas.ozlabs.org;
+ spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de
+ (client-ip=85.214.62.61; helo=phobos.denx.de;
+ envelope-from=u-boot-bounces@lists.denx.de; receiver=<UNKNOWN>)
+Authentication-Results: legolas.ozlabs.org;
+       dkim=pass (2048-bit key;
+ unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256
+ header.s=20221208 header.b=cTD9tSbd;
+       dkim-atps=neutral
+Received: from phobos.denx.de (phobos.denx.de [85.214.62.61])
+       (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
+        key-exchange X25519 server-signature ECDSA (P-384))
+       (No client certificate requested)
+       by legolas.ozlabs.org (Postfix) with ESMTPS id 4QN7Jx1TH1z20dv
+       for <incoming@patchwork.ozlabs.org>; Fri, 19 May 2023 23:40:49 +1000 (AEST)
+Received: from h2850616.stratoserver.net (localhost [IPv6:::1])
+       by phobos.denx.de (Postfix) with ESMTP id BC5EE86312;
+       Fri, 19 May 2023 15:40:37 +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="cTD9tSbd";
+       dkim-atps=neutral
+Received: by phobos.denx.de (Postfix, from userid 109)
+ id 76B3D86312; Fri, 19 May 2023 15:40:35 +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.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,
+ DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE,
+ SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no
+ version=3.4.2
+Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com
+ [IPv6:2a00:1450:4864:20::42c])
+ (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 5F8AE862F7
+ for <u-boot@lists.denx.de>; Fri, 19 May 2023 15:40:32 +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=bigunclemax@gmail.com
+Received: by mail-wr1-x42c.google.com with SMTP id
+ ffacd0b85a97d-30957dd7640so370247f8f.3
+ for <u-boot@lists.denx.de>; Fri, 19 May 2023 06:40:32 -0700 (PDT)
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
+ d=gmail.com; s=20221208; t=1684503631; x=1687095631;
+ h=content-transfer-encoding:mime-version:references:in-reply-to
+ :message-id:date:subject:cc:to:from:from:to:cc:subject:date
+ :message-id:reply-to;
+ bh=YUP1z0w4h2cZv/wQXQCw1Cy1zgJe6JHGfqSmy2vVnL8=;
+ b=cTD9tSbdyQlxF0Y7erPxsd79LYuLiPINAeD1DMRr/7GOIs4kwUj3c+aIdBEPDd2sNx
+ QUUWCtJO8xyhoqLLZPq6VRe4vgHDv6xGVMZGEKJ+WtKyZ3ki9MTyErk/jL0xZMTlMYdk
+ os6PhwH/RpouCAMKTMyq++YZtUBMRnLMF/9nc7vwWLPEmx/2U4za8Qe90XS02sB/hwsT
+ HU4v0YoXBkX2drI2tERNRIKzsIXJRoeu3mwV4QW8dDkGkIP45XtW2BqQjgCwd19q4LOf
+ cnlkGxCIlk5fuS5QghrV+W1tN7S1hGLCHgD4U3ddN4sZHhCxZTOnBYxUEHMCLnV3XZsy
+ 4xFg==
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
+ d=1e100.net; s=20221208; t=1684503631; x=1687095631;
+ h=content-transfer-encoding:mime-version:references:in-reply-to
+ :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
+ :subject:date:message-id:reply-to;
+ bh=YUP1z0w4h2cZv/wQXQCw1Cy1zgJe6JHGfqSmy2vVnL8=;
+ b=KjEg432zx44xNg4Z1IwQygnJdbxJPj9HjQq03tgXlZF6K3tBgBrjSuzzq1Gbvlz6PZ
+ LhlH3p0PzZpJpNwxIVul5ETVJAKUBYPmVgziizxy54jhi7INZF5OYiv9504QKW5slpBv
+ R4lq+U/kRVbgfydEXRBdE6vbDPfUvg6kHtHT1S14Cd+KZXI1mplmaQulTBmSXpTH0UH9
+ KF9DNiZXlS2zU64vkurAlefEj78IIHt4b1O6qEgpBi+rt6ah4RW5Uapn296g/Dgy6b/T
+ QCjmIh5KVlFOTi9vFwTPKDo9qQ0Nzq709I5rxhNNZEbuO0Gd/nSk+RzvYHAEjBFpAnJe
+ Fe1g==
+X-Gm-Message-State: AC+VfDyvlP1JR37qkV9MYt5TDplSIUbUgxJODKI0TwJTMNVb/VhJVqrd
+ 9zNxItUGraxvDCAiwxhXu/mYGBxAhKs=
+X-Google-Smtp-Source: 
+ ACHHUZ5G99dPHkK4AviYJ4YM/vZ1llN4335rcmycK/cfHMEFhg609FaTXuZb6u10r9U2wYvZcRHwKQ==
+X-Received: by 2002:adf:e60b:0:b0:309:a4e:52d3 with SMTP id
+ p11-20020adfe60b000000b003090a4e52d3mr2047534wrm.5.1684503631220;
+ Fri, 19 May 2023 06:40:31 -0700 (PDT)
+Received: from localhost.localdomain ([176.221.215.212])
+ by smtp.gmail.com with ESMTPSA id
+ l5-20020adfe585000000b002f7780eee10sm5315421wrm.59.2023.05.19.06.40.30
+ (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
+ Fri, 19 May 2023 06:40:30 -0700 (PDT)
+From: Maxim Kiselev <bigunclemax@gmail.com>
+To: u-boot@lists.denx.de
+Cc: Maxim Kiselev <bigunclemax@gmail.com>,
+ Jagan Teki <jagan@amarulasolutions.com>,
+ Andre Przywara <andre.przywara@arm.com>, Rick Chen <rick@andestech.com>,
+ Leo <ycliang@andestech.com>
+Subject: [RFC PATCH v1 1/3] sunxi: SPL SPI: Add SPI boot support for the
+ Allwinner R528/T113 SoCs
+Date: Fri, 19 May 2023 16:40:07 +0300
+Message-Id: <20230519134010.3102343-2-bigunclemax@gmail.com>
+X-Mailer: git-send-email 2.39.2
+In-Reply-To: <20230519134010.3102343-1-bigunclemax@gmail.com>
+References: <20230519134010.3102343-1-bigunclemax@gmail.com>
+MIME-Version: 1.0
+X-BeenThere: u-boot@lists.denx.de
+X-Mailman-Version: 2.1.39
+Precedence: list
+List-Id: U-Boot discussion <u-boot.lists.denx.de>
+List-Unsubscribe: <https://lists.denx.de/options/u-boot>,
+ <mailto:u-boot-request@lists.denx.de?subject=unsubscribe>
+List-Archive: <https://lists.denx.de/pipermail/u-boot/>
+List-Post: <mailto:u-boot@lists.denx.de>
+List-Help: <mailto:u-boot-request@lists.denx.de?subject=help>
+List-Subscribe: <https://lists.denx.de/listinfo/u-boot>,
+ <mailto:u-boot-request@lists.denx.de?subject=subscribe>
+Errors-To: u-boot-bounces@lists.denx.de
+Sender: "U-Boot" <u-boot-bounces@lists.denx.de>
+X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de
+X-Virus-Status: Clean
+
+R528/T113 SoCs uses the same SPI IP as the H6, also have the same clocks
+and reset bits layout, but the CCU base is different. Another difference
+is that the new SoCs do not have a clock divider inside. Instead of this
+we should configure sample mode depending on input clock rate.
+
+The pin assignment is also different: the H6 uses PC0, the R528/T113 PC4
+instead. This makes for a change in spi0_pinmux_setup() routine.
+
+This patch extends the H6/H616 #ifdef guards to also cover the R528/T113,
+using the shared CONFIG_SUNXI_GEN_NCAT2 and CONFIG_MACH_SUN8I_R528
+symbols. Also use CONFIG_SUNXI_GEN_NCAT2 symbol for the Kconfig
+dependency.
+
+Signed-off-by: Maxim Kiselev <bigunclemax@gmail.com>
+Tested-by: Sam Edwards <CFSworks@gmail.com>
+---
+ arch/arm/mach-sunxi/Kconfig         |  2 +-
+ arch/arm/mach-sunxi/spl_spi_sunxi.c | 78 +++++++++++++++++++++--------
+ 2 files changed, 58 insertions(+), 22 deletions(-)
+
+diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig
+index 142d86afc6..210dd41176 100644
+--- a/arch/arm/mach-sunxi/Kconfig
++++ b/arch/arm/mach-sunxi/Kconfig
+@@ -998,7 +998,7 @@ config SPL_STACK_R_ADDR
+ config SPL_SPI_SUNXI
+       bool "Support for SPI Flash on Allwinner SoCs in SPL"
+-      depends on MACH_SUN4I || MACH_SUN5I || MACH_SUN7I || MACH_SUNXI_H3_H5 || MACH_SUN50I || MACH_SUN8I_R40 || SUN50I_GEN_H6 || MACH_SUNIV
++      depends on MACH_SUN4I || MACH_SUN5I || MACH_SUN7I || MACH_SUNXI_H3_H5 || MACH_SUN50I || MACH_SUN8I_R40 || SUN50I_GEN_H6 || MACH_SUNIV || SUNXI_GEN_NCAT2
+       help
+         Enable support for SPI Flash. This option allows SPL to read from
+         sunxi SPI Flash. It uses the same method as the boot ROM, so does
+diff --git a/arch/arm/mach-sunxi/spl_spi_sunxi.c b/arch/arm/mach-sunxi/spl_spi_sunxi.c
+index c2410dd7bb..3cfbf56d59 100644
+--- a/arch/arm/mach-sunxi/spl_spi_sunxi.c
++++ b/arch/arm/mach-sunxi/spl_spi_sunxi.c
+@@ -73,18 +73,27 @@
+ #define SUN6I_CTL_ENABLE            BIT(0)
+ #define SUN6I_CTL_MASTER            BIT(1)
+ #define SUN6I_CTL_SRST              BIT(31)
++#define SUN6I_TCR_SDM               BIT(13)
+ #define SUN6I_TCR_XCH               BIT(31)
+ /*****************************************************************************/
+-#define CCM_AHB_GATING0             (0x01C20000 + 0x60)
+-#define CCM_H6_SPI_BGR_REG          (0x03001000 + 0x96c)
+-#ifdef CONFIG_SUN50I_GEN_H6
+-#define CCM_SPI0_CLK                (0x03001000 + 0x940)
++#if defined(CONFIG_SUN50I_GEN_H6)
++#define CCM_BASE                    0x03001000
++#elif defined(CONFIG_SUNXI_GEN_NCAT2)
++#define CCM_BASE                    0x02001000
+ #else
+-#define CCM_SPI0_CLK                (0x01C20000 + 0xA0)
++#define CCM_BASE                    0x01C20000
+ #endif
+-#define SUN6I_BUS_SOFT_RST_REG0     (0x01C20000 + 0x2C0)
++
++#define CCM_AHB_GATING0             (CCM_BASE + 0x60)
++#define CCM_H6_SPI_BGR_REG          (CCM_BASE + 0x96c)
++#if defined(CONFIG_SUN50I_GEN_H6) || defined(CONFIG_SUNXI_GEN_NCAT2)
++#define CCM_SPI0_CLK                (CCM_BASE + 0x940)
++#else
++#define CCM_SPI0_CLK                (CCM_BASE + 0xA0)
++#endif
++#define SUN6I_BUS_SOFT_RST_REG0     (CCM_BASE + 0x2C0)
+ #define AHB_RESET_SPI0_SHIFT        20
+ #define AHB_GATE_OFFSET_SPI0        20
+@@ -102,17 +111,22 @@
+  */
+ static void spi0_pinmux_setup(unsigned int pin_function)
+ {
+-      /* All chips use PC0 and PC2. */
+-      sunxi_gpio_set_cfgpin(SUNXI_GPC(0), pin_function);
++      /* All chips use PC2. And all chips use PC0, except R528/T113 */
++      if (!IS_ENABLED(CONFIG_MACH_SUN8I_R528))
++              sunxi_gpio_set_cfgpin(SUNXI_GPC(0), pin_function);
++
+       sunxi_gpio_set_cfgpin(SUNXI_GPC(2), pin_function);
+-      /* All chips except H6 and H616 use PC1. */
+-      if (!IS_ENABLED(CONFIG_SUN50I_GEN_H6))
++      /* All chips except H6/H616/R528/T113 use PC1. */
++      if (!IS_ENABLED(CONFIG_SUN50I_GEN_H6) &&
++          !IS_ENABLED(CONFIG_MACH_SUN8I_R528))
+               sunxi_gpio_set_cfgpin(SUNXI_GPC(1), pin_function);
+-      if (IS_ENABLED(CONFIG_MACH_SUN50I_H6))
++      if (IS_ENABLED(CONFIG_MACH_SUN50I_H6) ||
++          IS_ENABLED(CONFIG_MACH_SUN8I_R528))
+               sunxi_gpio_set_cfgpin(SUNXI_GPC(5), pin_function);
+-      if (IS_ENABLED(CONFIG_MACH_SUN50I_H616))
++      if (IS_ENABLED(CONFIG_MACH_SUN50I_H616) ||
++          IS_ENABLED(CONFIG_MACH_SUN8I_R528))
+               sunxi_gpio_set_cfgpin(SUNXI_GPC(4), pin_function);
+       /* Older generations use PC23 for CS, newer ones use PC3. */
+@@ -126,7 +140,8 @@ static void spi0_pinmux_setup(unsigned int pin_function)
+ static bool is_sun6i_gen_spi(void)
+ {
+       return IS_ENABLED(CONFIG_SUNXI_GEN_SUN6I) ||
+-             IS_ENABLED(CONFIG_SUN50I_GEN_H6);
++             IS_ENABLED(CONFIG_SUN50I_GEN_H6) ||
++             IS_ENABLED(CONFIG_SUNXI_GEN_NCAT2);
+ }
+ static uintptr_t spi0_base_address(void)
+@@ -137,6 +152,9 @@ static uintptr_t spi0_base_address(void)
+       if (IS_ENABLED(CONFIG_SUN50I_GEN_H6))
+               return 0x05010000;
++      if (IS_ENABLED(CONFIG_SUNXI_GEN_NCAT2))
++              return 0x04025000;
++
+       if (!is_sun6i_gen_spi() ||
+           IS_ENABLED(CONFIG_MACH_SUNIV))
+               return 0x01C05000;
+@@ -152,23 +170,30 @@ static void spi0_enable_clock(void)
+       uintptr_t base = spi0_base_address();
+       /* Deassert SPI0 reset on SUN6I */
+-      if (IS_ENABLED(CONFIG_SUN50I_GEN_H6))
++      if (IS_ENABLED(CONFIG_SUN50I_GEN_H6) ||
++          IS_ENABLED(CONFIG_SUNXI_GEN_NCAT2))
+               setbits_le32(CCM_H6_SPI_BGR_REG, (1U << 16) | 0x1);
+       else if (is_sun6i_gen_spi())
+               setbits_le32(SUN6I_BUS_SOFT_RST_REG0,
+                            (1 << AHB_RESET_SPI0_SHIFT));
+       /* Open the SPI0 gate */
+-      if (!IS_ENABLED(CONFIG_SUN50I_GEN_H6))
++      if (!IS_ENABLED(CONFIG_SUN50I_GEN_H6) &&
++          !IS_ENABLED(CONFIG_SUNXI_GEN_NCAT2))
+               setbits_le32(CCM_AHB_GATING0, (1 << AHB_GATE_OFFSET_SPI0));
+       if (IS_ENABLED(CONFIG_MACH_SUNIV)) {
+               /* Divide by 32, clock source is AHB clock 200MHz */
+               writel(SPI0_CLK_DIV_BY_32, base + SUN6I_SPI0_CCTL);
+       } else {
+-              /* Divide by 4 */
+-              writel(SPI0_CLK_DIV_BY_4, base + (is_sun6i_gen_spi() ?
+-                                        SUN6I_SPI0_CCTL : SUN4I_SPI0_CCTL));
++              /* New SoCs do not have a clock divider inside */
++              if (!IS_ENABLED(CONFIG_SUNXI_GEN_NCAT2)) {
++                      /* Divide by 4 */
++                      writel(SPI0_CLK_DIV_BY_4,
++                             base + (is_sun6i_gen_spi() ? SUN6I_SPI0_CCTL :
++                             SUN4I_SPI0_CCTL));
++              }
++
+               /* 24MHz from OSC24M */
+               writel((1 << 31), CCM_SPI0_CLK);
+       }
+@@ -180,6 +205,14 @@ static void spi0_enable_clock(void)
+               /* Wait for completion */
+               while (readl(base + SUN6I_SPI0_GCR) & SUN6I_CTL_SRST)
+                       ;
++
++              /*
++               * For new SoCs we should configure sample mode depending on
++               * input clock. As 24MHz from OSC24M is used, we could use
++               * normal sample mode by setting SDM bit in the TCR register
++               */
++              if (IS_ENABLED(CONFIG_SUNXI_GEN_NCAT2))
++                      setbits_le32(base + SUN6I_SPI0_TCR, SUN6I_TCR_SDM);
+       } else {
+               /* Enable SPI in the master mode and reset FIFO */
+               setbits_le32(base + SUN4I_SPI0_CTL, SUN4I_CTL_MASTER |
+@@ -206,11 +239,13 @@ static void spi0_disable_clock(void)
+               writel(0, CCM_SPI0_CLK);
+       /* Close the SPI0 gate */
+-      if (!IS_ENABLED(CONFIG_SUN50I_GEN_H6))
++      if (!IS_ENABLED(CONFIG_SUN50I_GEN_H6) &&
++          !IS_ENABLED(CONFIG_SUNXI_GEN_NCAT2))
+               clrbits_le32(CCM_AHB_GATING0, (1 << AHB_GATE_OFFSET_SPI0));
+       /* Assert SPI0 reset on SUN6I */
+-      if (IS_ENABLED(CONFIG_SUN50I_GEN_H6))
++      if (IS_ENABLED(CONFIG_SUN50I_GEN_H6) ||
++          IS_ENABLED(CONFIG_SUNXI_GEN_NCAT2))
+               clrbits_le32(CCM_H6_SPI_BGR_REG, (1U << 16) | 0x1);
+       else if (is_sun6i_gen_spi())
+               clrbits_le32(SUN6I_BUS_SOFT_RST_REG0,
+@@ -224,7 +259,8 @@ static void spi0_init(void)
+       if (IS_ENABLED(CONFIG_MACH_SUN50I) ||
+           IS_ENABLED(CONFIG_SUN50I_GEN_H6))
+               pin_function = SUN50I_GPC_SPI0;
+-      else if (IS_ENABLED(CONFIG_MACH_SUNIV))
++      else if (IS_ENABLED(CONFIG_MACH_SUNIV) ||
++               IS_ENABLED(CONFIG_MACH_SUN8I_R528))
+               pin_function = SUNIV_GPC_SPI0;
+       spi0_pinmux_setup(pin_function);
+
+From patchwork Fri May 19 13:40:08 2023
+Content-Type: text/plain; charset="utf-8"
+MIME-Version: 1.0
+Content-Transfer-Encoding: 7bit
+X-Patchwork-Submitter: Maksim Kiselev <bigunclemax@gmail.com>
+X-Patchwork-Id: 1783782
+X-Patchwork-Delegate: andre.przywara@arm.com
+Return-Path: <u-boot-bounces@lists.denx.de>
+X-Original-To: incoming@patchwork.ozlabs.org
+Delivered-To: patchwork-incoming@legolas.ozlabs.org
+Authentication-Results: legolas.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=<UNKNOWN>)
+Authentication-Results: legolas.ozlabs.org;
+       dkim=pass (2048-bit key;
+ unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256
+ header.s=20221208 header.b=XVN86gy6;
+       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 ECDSA (P-384))
+       (No client certificate requested)
+       by legolas.ozlabs.org (Postfix) with ESMTPS id 4QN7KH4Bzbz20dv
+       for <incoming@patchwork.ozlabs.org>; Fri, 19 May 2023 23:41:07 +1000 (AEST)
+Received: from h2850616.stratoserver.net (localhost [IPv6:::1])
+       by phobos.denx.de (Postfix) with ESMTP id 0451386328;
+       Fri, 19 May 2023 15:40:42 +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="XVN86gy6";
+       dkim-atps=neutral
+Received: by phobos.denx.de (Postfix, from userid 109)
+ id 8B5B986327; Fri, 19 May 2023 15:40:40 +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.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,
+ DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE,
+ SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no
+ version=3.4.2
+Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com
+ [IPv6:2a00:1450:4864:20::42a])
+ (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 4A39286131
+ for <u-boot@lists.denx.de>; Fri, 19 May 2023 15:40:37 +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=bigunclemax@gmail.com
+Received: by mail-wr1-x42a.google.com with SMTP id
+ ffacd0b85a97d-307d20548adso2178236f8f.0
+ for <u-boot@lists.denx.de>; Fri, 19 May 2023 06:40:37 -0700 (PDT)
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
+ d=gmail.com; s=20221208; t=1684503636; x=1687095636;
+ h=content-transfer-encoding:mime-version:references:in-reply-to
+ :message-id:date:subject:cc:to:from:from:to:cc:subject:date
+ :message-id:reply-to;
+ bh=y8+rF/p5Jdncjufm65vWHEGLS+C/ytaDC9RSOXQj3YY=;
+ b=XVN86gy67HoVcRBvpuLqZWNZjA0qoeGsc1plc19OUmaDbDkfIz97H+xr4reZEBCj12
+ PokzHuazEC6QCiGZI46+hcptobvX09pQGcfer9yoxdFD7W7w9uDhwAgceQZ9NILRaH/I
+ gvaxtYIQ9jjvb60TnHm3E9ORj5KlcY3aS1B2iDBw3tstlcrKeLTT2gWaSvZf4m4WBaF3
+ R0fz+CDnjhfAAZkyj9vr9/wvPSl4aVe/MxctoNRRZOTW3nC5Vr7G9OMH5V9wtlp5X9f/
+ FFOfUSx62PitgyezRFVsdororOdlHsSqq9tGh9qaVbBPBtGWI0J69haBU/Vi5OVBUox/
+ C+Wg==
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
+ d=1e100.net; s=20221208; t=1684503636; x=1687095636;
+ h=content-transfer-encoding:mime-version:references:in-reply-to
+ :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
+ :subject:date:message-id:reply-to;
+ bh=y8+rF/p5Jdncjufm65vWHEGLS+C/ytaDC9RSOXQj3YY=;
+ b=BIVofAJc2HA5kiEUXl6+vfzeq5peOA4vRnGVTtbcSRRoATcx72Yv+fTJEjA7usMwB7
+ 3DMiHkH14gVXqDLM020VfVyJI9s3Wa2eQAracOP2LaBMOhDuG/XoLdGTomPPbA/hDNdk
+ w+RWBpG0oY3dpjEgsGTOo7op70GZ2ugI5SYe8ZIFTTO8DN71MYq/z0wo6On4k9l5X3sP
+ nv15nZkgqzwBVi8n+zSuz+ocXR08O9c+pgqWNoX7XwohjHjU9EOhNosihH1HKv/WpV6G
+ /VNimAooGEcGiulbeMgirYC2qOb9/nq6TzFa7xnYNff3MR5MDE4G7s+wlfaB0/WwD+sU
+ +C7g==
+X-Gm-Message-State: AC+VfDzbvvkLM5kEmV1WxzB5hTeKHweME4U+BnwLiEXS8cX2Tj5flr98
+ DRNdhkguOOYWqDZIPsvxebO06NiixPk=
+X-Google-Smtp-Source: 
+ ACHHUZ5ZYgm4pzeYsvUicktbj4rwgRUtHboj9r3ofAcxlNjpTAnaHo/yhaOSHex344NVs25oWALOmg==
+X-Received: by 2002:adf:df84:0:b0:306:2dc3:8b67 with SMTP id
+ z4-20020adfdf84000000b003062dc38b67mr1991533wrl.53.1684503636216;
+ Fri, 19 May 2023 06:40:36 -0700 (PDT)
+Received: from localhost.localdomain ([176.221.215.212])
+ by smtp.gmail.com with ESMTPSA id
+ l5-20020adfe585000000b002f7780eee10sm5315421wrm.59.2023.05.19.06.40.35
+ (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
+ Fri, 19 May 2023 06:40:35 -0700 (PDT)
+From: Maxim Kiselev <bigunclemax@gmail.com>
+To: u-boot@lists.denx.de
+Cc: Maxim Kiselev <bigunclemax@gmail.com>,
+ Jagan Teki <jagan@amarulasolutions.com>,
+ Andre Przywara <andre.przywara@arm.com>, Rick Chen <rick@andestech.com>,
+ Leo <ycliang@andestech.com>
+Subject: [RFC PATCH v1 2/3] spi: sunxi: Add support for R329/D1/R528/T113 SPI
+ controller
+Date: Fri, 19 May 2023 16:40:08 +0300
+Message-Id: <20230519134010.3102343-3-bigunclemax@gmail.com>
+X-Mailer: git-send-email 2.39.2
+In-Reply-To: <20230519134010.3102343-1-bigunclemax@gmail.com>
+References: <20230519134010.3102343-1-bigunclemax@gmail.com>
+MIME-Version: 1.0
+X-BeenThere: u-boot@lists.denx.de
+X-Mailman-Version: 2.1.39
+Precedence: list
+List-Id: U-Boot discussion <u-boot.lists.denx.de>
+List-Unsubscribe: <https://lists.denx.de/options/u-boot>,
+ <mailto:u-boot-request@lists.denx.de?subject=unsubscribe>
+List-Archive: <https://lists.denx.de/pipermail/u-boot/>
+List-Post: <mailto:u-boot@lists.denx.de>
+List-Help: <mailto:u-boot-request@lists.denx.de?subject=help>
+List-Subscribe: <https://lists.denx.de/listinfo/u-boot>,
+ <mailto:u-boot-request@lists.denx.de?subject=subscribe>
+Errors-To: u-boot-bounces@lists.denx.de
+Sender: "U-Boot" <u-boot-bounces@lists.denx.de>
+X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de
+X-Virus-Status: Clean
+
+These SoCs have two SPI controllers that are quite similar to the SPI
+on previous Allwinner SoCs. The main difference is that new SoCs
+don't have a clock divider (SPI_CCR register) inside SPI IP.
+
+Instead SPI sample mode should be configured depending on the input clock.
+
+For now SPI input clock source selection is not supported by this driver,
+and only HOSC@24MHz can be used as input clock. Therefore, according to
+the, manual we could change the SPI sample mode from delay half
+cycle(default) to normal.
+
+This patch adds a quirk for this kind of SPI controllers
+
+Signed-off-by: Maxim Kiselev <bigunclemax@gmail.com>
+Tested-by: Sam Edwards <CFSworks@gmail.com>
+---
+ drivers/spi/spi-sunxi.c | 34 +++++++++++++++++++++++++++++++++-
+ 1 file changed, 33 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/spi/spi-sunxi.c b/drivers/spi/spi-sunxi.c
+index c56d82d998..9ec6b359e2 100644
+--- a/drivers/spi/spi-sunxi.c
++++ b/drivers/spi/spi-sunxi.c
+@@ -117,6 +117,8 @@ enum sun4i_spi_bits {
+       SPI_TCR_XCH,
+       SPI_TCR_CS_MANUAL,
+       SPI_TCR_CS_LEVEL,
++      SPI_TCR_SDC,
++      SPI_TCR_SDM,
+       SPI_FCR_TF_RST,
+       SPI_FCR_RF_RST,
+       SPI_FSR_RF_CNT_MASK,
+@@ -128,6 +130,7 @@ struct sun4i_spi_variant {
+       u32 fifo_depth;
+       bool has_soft_reset;
+       bool has_burst_ctl;
++      bool has_clk_ctl;
+ };
+ struct sun4i_spi_plat {
+@@ -302,7 +305,19 @@ static int sun4i_spi_claim_bus(struct udevice *dev)
+       setbits_le32(SPI_REG(priv, SPI_TCR), SPI_BIT(priv, SPI_TCR_CS_MANUAL) |
+                    SPI_BIT(priv, SPI_TCR_CS_ACTIVE_LOW));
+-      sun4i_spi_set_speed_mode(dev->parent);
++      if (priv->variant->has_clk_ctl) {
++              sun4i_spi_set_speed_mode(dev->parent);
++      } else {
++              /*
++               * At this moment there is no ability to change input clock.
++               * Therefore, we can only use default HOSC@24MHz clock and
++               * set SPI sampling mode to normal
++               */
++              clrsetbits_le32(SPI_REG(priv, SPI_TCR),
++                              SPI_BIT(priv, SPI_TCR_SDC) |
++                              SPI_BIT(priv, SPI_TCR_SDM),
++                              SPI_BIT(priv, SPI_TCR_SDM));
++      }
+       return 0;
+ }
+@@ -516,6 +531,8 @@ static const u32 sun6i_spi_bits[] = {
+       [SPI_TCR_CS_MASK]       = 0x30,
+       [SPI_TCR_CS_MANUAL]     = BIT(6),
+       [SPI_TCR_CS_LEVEL]      = BIT(7),
++      [SPI_TCR_SDC]           = BIT(11),
++      [SPI_TCR_SDM]           = BIT(13),
+       [SPI_TCR_XCH]           = BIT(31),
+       [SPI_FCR_RF_RST]        = BIT(15),
+       [SPI_FCR_TF_RST]        = BIT(31),
+@@ -526,6 +543,7 @@ static const struct sun4i_spi_variant sun4i_a10_spi_variant = {
+       .regs                   = sun4i_spi_regs,
+       .bits                   = sun4i_spi_bits,
+       .fifo_depth             = 64,
++      .has_clk_ctl            = true,
+ };
+ static const struct sun4i_spi_variant sun6i_a31_spi_variant = {
+@@ -534,6 +552,7 @@ static const struct sun4i_spi_variant sun6i_a31_spi_variant = {
+       .fifo_depth             = 128,
+       .has_soft_reset         = true,
+       .has_burst_ctl          = true,
++      .has_clk_ctl            = true,
+ };
+ static const struct sun4i_spi_variant sun8i_h3_spi_variant = {
+@@ -542,6 +561,15 @@ static const struct sun4i_spi_variant sun8i_h3_spi_variant = {
+       .fifo_depth             = 64,
+       .has_soft_reset         = true,
+       .has_burst_ctl          = true,
++      .has_clk_ctl            = true,
++};
++
++static const struct sun4i_spi_variant sun50i_r329_spi_variant = {
++      .regs                   = sun6i_spi_regs,
++      .bits                   = sun6i_spi_bits,
++      .fifo_depth             = 64,
++      .has_soft_reset         = true,
++      .has_burst_ctl          = true,
+ };
+ static const struct udevice_id sun4i_spi_ids[] = {
+@@ -557,6 +585,10 @@ static const struct udevice_id sun4i_spi_ids[] = {
+         .compatible = "allwinner,sun8i-h3-spi",
+         .data = (ulong)&sun8i_h3_spi_variant,
+       },
++      {
++        .compatible = "allwinner,sun50i-r329-spi",
++        .data = (ulong)&sun50i_r329_spi_variant,
++      },
+       { /* sentinel */ }
+ };
+
+From patchwork Fri May 19 13:40:09 2023
+Content-Type: text/plain; charset="utf-8"
+MIME-Version: 1.0
+Content-Transfer-Encoding: 7bit
+X-Patchwork-Submitter: Maksim Kiselev <bigunclemax@gmail.com>
+X-Patchwork-Id: 1783783
+X-Patchwork-Delegate: andre.przywara@arm.com
+Return-Path: <u-boot-bounces@lists.denx.de>
+X-Original-To: incoming@patchwork.ozlabs.org
+Delivered-To: patchwork-incoming@legolas.ozlabs.org
+Authentication-Results: legolas.ozlabs.org;
+ spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de
+ (client-ip=85.214.62.61; helo=phobos.denx.de;
+ envelope-from=u-boot-bounces@lists.denx.de; receiver=<UNKNOWN>)
+Authentication-Results: legolas.ozlabs.org;
+       dkim=pass (2048-bit key;
+ unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256
+ header.s=20221208 header.b=WKEkOHKi;
+       dkim-atps=neutral
+Received: from phobos.denx.de (phobos.denx.de [85.214.62.61])
+       (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
+        key-exchange X25519 server-signature ECDSA (P-384))
+       (No client certificate requested)
+       by legolas.ozlabs.org (Postfix) with ESMTPS id 4QN7KT2Ntcz20dv
+       for <incoming@patchwork.ozlabs.org>; Fri, 19 May 2023 23:41:17 +1000 (AEST)
+Received: from h2850616.stratoserver.net (localhost [IPv6:::1])
+       by phobos.denx.de (Postfix) with ESMTP id 4EBFA8634E;
+       Fri, 19 May 2023 15:40:47 +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="WKEkOHKi";
+       dkim-atps=neutral
+Received: by phobos.denx.de (Postfix, from userid 109)
+ id 7157D86334; Fri, 19 May 2023 15:40:43 +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.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,
+ DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE,
+ SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no
+ version=3.4.2
+Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com
+ [IPv6:2a00:1450:4864:20::432])
+ (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 C224E86131
+ for <u-boot@lists.denx.de>; Fri, 19 May 2023 15:40: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=bigunclemax@gmail.com
+Received: by mail-wr1-x432.google.com with SMTP id
+ ffacd0b85a97d-309550d4f73so501090f8f.1
+ for <u-boot@lists.denx.de>; Fri, 19 May 2023 06:40:40 -0700 (PDT)
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
+ d=gmail.com; s=20221208; t=1684503640; x=1687095640;
+ h=content-transfer-encoding:mime-version:references:in-reply-to
+ :message-id:date:subject:cc:to:from:from:to:cc:subject:date
+ :message-id:reply-to;
+ bh=NrlUXRmVOv93TD0HdBbwH04KM6T5eHPc/wRD/kVHw50=;
+ b=WKEkOHKiGzpdoQNn0FShQ9ESX297aAOR2qdZ43W5RSGiXWij7hEgbg3BzrPR3w9okx
+ X21Je0wJ4l+VUyv48EHiHlhMezq1Vgk44Ne/aOOYikouUf8k6fkjzjoT9wkw0x+Sqgr6
+ MgodDFL5CQ1qpMCU3lQxKqSE1eVQd1O2KNT5JMucQrnux/0gLwAf3sLczeydvCvK0nv8
+ m3vmYqBy/w8MzGD4ogeM1slUX24ilT7wZHx1fDoz2K6ygRgeN7UzRJP9iqNMuxjVWj2o
+ YLngIulrlZarjLLeH8Yas8HPrycICIb+QgA84WIY65U+F0s5Bliv/EW1CIqFPBFxrxET
+ OhUQ==
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
+ d=1e100.net; s=20221208; t=1684503640; x=1687095640;
+ h=content-transfer-encoding:mime-version:references:in-reply-to
+ :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
+ :subject:date:message-id:reply-to;
+ bh=NrlUXRmVOv93TD0HdBbwH04KM6T5eHPc/wRD/kVHw50=;
+ b=L3leC190RMssJ8neJlB3kWCGFUE71ArJn2vb/I6cuJ1N/CJ3XZRIdjsDUFNw7ED//R
+ 2JpNx3x7mnB/fhojtzCkk+UuzkRuZNISO/Bgu/7pxVoRVth4aEx7frZ+boGZlMy9oUQ0
+ KYPzme2rcMGpi+Gl2P9Rv65K3jrnZs7N+r2VvcEDd+Y3TmL+xogAuuC+2l46qJHQ2qXT
+ OOHfKXTsAxyc5vOKrL7WpF+EynCAWhuj03Ps4FxQfllOA4CGGiEUv5jKm0yM8D/HpBz8
+ ys1nHELarilGdHatUQO5gAB87Ir9vKsfTKt9hleIFJdWN1B0wvXYi0o2Lkj8TCI5D3l2
+ SE9w==
+X-Gm-Message-State: AC+VfDyMqvODjmLMCPv0QeUpXa78p1k0ZcyJHKZLfTTaiVbDjq+aL7JT
+ c4Qx93jxKzpnkxV7RPOXLurVp/bZ8qA=
+X-Google-Smtp-Source: 
+ ACHHUZ6RxZNvSxCvoRohqWdRTv2thSi33TWc4CN0RsmFexdSvPZtKWRMQQ7Nqt/2bACBm66BUi/Qcw==
+X-Received: by 2002:a5d:5305:0:b0:306:3ec9:99c5 with SMTP id
+ e5-20020a5d5305000000b003063ec999c5mr1949351wrv.9.1684503639737;
+ Fri, 19 May 2023 06:40:39 -0700 (PDT)
+Received: from localhost.localdomain ([176.221.215.212])
+ by smtp.gmail.com with ESMTPSA id
+ l5-20020adfe585000000b002f7780eee10sm5315421wrm.59.2023.05.19.06.40.38
+ (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
+ Fri, 19 May 2023 06:40:39 -0700 (PDT)
+From: Maxim Kiselev <bigunclemax@gmail.com>
+To: u-boot@lists.denx.de
+Cc: Maxim Kiselev <bigunclemax@gmail.com>,
+ Jagan Teki <jagan@amarulasolutions.com>,
+ Andre Przywara <andre.przywara@arm.com>, Rick Chen <rick@andestech.com>,
+ Leo <ycliang@andestech.com>
+Subject: [RFC PATCH v1 3/3] riscv: dts: allwinner: d1: Add SPI controllers
+ node
+Date: Fri, 19 May 2023 16:40:09 +0300
+Message-Id: <20230519134010.3102343-4-bigunclemax@gmail.com>
+X-Mailer: git-send-email 2.39.2
+In-Reply-To: <20230519134010.3102343-1-bigunclemax@gmail.com>
+References: <20230519134010.3102343-1-bigunclemax@gmail.com>
+MIME-Version: 1.0
+X-BeenThere: u-boot@lists.denx.de
+X-Mailman-Version: 2.1.39
+Precedence: list
+List-Id: U-Boot discussion <u-boot.lists.denx.de>
+List-Unsubscribe: <https://lists.denx.de/options/u-boot>,
+ <mailto:u-boot-request@lists.denx.de?subject=unsubscribe>
+List-Archive: <https://lists.denx.de/pipermail/u-boot/>
+List-Post: <mailto:u-boot@lists.denx.de>
+List-Help: <mailto:u-boot-request@lists.denx.de?subject=help>
+List-Subscribe: <https://lists.denx.de/listinfo/u-boot>,
+ <mailto:u-boot-request@lists.denx.de?subject=subscribe>
+Errors-To: u-boot-bounces@lists.denx.de
+Sender: "U-Boot" <u-boot-bounces@lists.denx.de>
+X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de
+X-Virus-Status: Clean
+
+Some boards form the MangoPi family (MQ\MQ-Dual\MQ-R) may have
+an optional SPI flash that connects to the SPI0 controller.
+
+This controller is the same for R329/D1/R528/T113s SoCs and
+should be supported by the sun50i-r329-spi driver.
+
+So let's add its DT nodes.
+
+Signed-off-by: Maxim Kiselev <bigunclemax@gmail.com>
+Reviewed-by: Sam Edwards <CFSworks@gmail.com>
+---
+ arch/riscv/dts/sunxi-d1s-t113.dtsi | 37 ++++++++++++++++++++++++++++++
+ 1 file changed, 37 insertions(+)
+
+diff --git a/arch/riscv/dts/sunxi-d1s-t113.dtsi b/arch/riscv/dts/sunxi-d1s-t113.dtsi
+index a7c95f59a0..094ad0e460 100644
+--- a/arch/riscv/dts/sunxi-d1s-t113.dtsi
++++ b/arch/riscv/dts/sunxi-d1s-t113.dtsi
+@@ -123,6 +123,12 @@
+                               function = "emac";
+                       };
++                      /omit-if-no-ref/
++                      spi0_pins: spi0-pins {
++                              pins = "PC2", "PC3", "PC4", "PC5";
++                              function = "spi0";
++                      };
++
+                       /omit-if-no-ref/
+                       uart1_pg6_pins: uart1-pg6-pins {
+                               pins = "PG6", "PG7";
+@@ -456,6 +462,37 @@
+                       #size-cells = <0>;
+               };
++              spi0: spi@4025000 {
++                      compatible = "allwinner,sun20i-d1-spi",
++                                   "allwinner,sun50i-r329-spi";
++                      reg = <0x04025000 0x1000>;
++                      interrupts = <SOC_PERIPHERAL_IRQ(15) IRQ_TYPE_LEVEL_HIGH>;
++                      clocks = <&ccu CLK_BUS_SPI0>, <&ccu CLK_SPI0>;
++                      clock-names = "ahb", "mod";
++                      dmas = <&dma 22>, <&dma 22>;
++                      dma-names = "rx", "tx";
++                      resets = <&ccu RST_BUS_SPI0>;
++                      status = "disabled";
++                      #address-cells = <1>;
++                      #size-cells = <0>;
++              };
++
++              spi1: spi@4026000 {
++                      compatible = "allwinner,sun20i-d1-spi-dbi",
++                                   "allwinner,sun50i-r329-spi-dbi",
++                                   "allwinner,sun50i-r329-spi";
++                      reg = <0x04026000 0x1000>;
++                      interrupts = <SOC_PERIPHERAL_IRQ(16) IRQ_TYPE_LEVEL_HIGH>;
++                      clocks = <&ccu CLK_BUS_SPI1>, <&ccu CLK_SPI1>;
++                      clock-names = "ahb", "mod";
++                      dmas = <&dma 23>, <&dma 23>;
++                      dma-names = "rx", "tx";
++                      resets = <&ccu RST_BUS_SPI1>;
++                      status = "disabled";
++                      #address-cells = <1>;
++                      #size-cells = <0>;
++              };
++
+               usb_otg: usb@4100000 {
+                       compatible = "allwinner,sun20i-d1-musb",
+                                    "allwinner,sun8i-a33-musb";
diff --git a/package/boot/uboot-sunxi/patches/4201-myir-spi.patch b/package/boot/uboot-sunxi/patches/4201-myir-spi.patch
new file mode 100644 (file)
index 0000000..0d1dde5
--- /dev/null
@@ -0,0 +1,115 @@
+diff -ruN u-boot-2023.04/arch/arm/dts/Makefile spi/arch/arm/dts/Makefile
+--- u-boot-2023.04/arch/arm/dts/Makefile       2023-07-20 13:58:39.714010154 +0200
++++ spi/arch/arm/dts/Makefile  2023-07-20 14:46:44.403569974 +0200
+@@ -715,6 +715,7 @@
+       sun8i-t113s-mangopi-mq-r-t113.dtb \
+       sun8i-t113s-mangopi-mqdual-t113.dtb \
+       sun8i-t113s-myir-myd-yt113x.dtb \
++      sun8i-t113s-myir-myd-yt113x-spi.dtb \
+       sun8i-t113s-rongpin-rp-t113.dtb
+ dtb-$(CONFIG_MACH_SUN50I_H5) += \
+       sun50i-h5-bananapi-m2-plus.dtb \
+diff -ruN u-boot-2023.04/arch/arm/dts/sun8i-t113s-myir-myd-yt113x-spi.dts spi/arch/arm/dts/sun8i-t113s-myir-myd-yt113x-spi.dts
+--- u-boot-2023.04/arch/arm/dts/sun8i-t113s-myir-myd-yt113x-spi.dts    1970-01-01 01:00:00.000000000 +0100
++++ spi/arch/arm/dts/sun8i-t113s-myir-myd-yt113x-spi.dts       2023-07-20 14:52:36.468334540 +0200
+@@ -0,0 +1,59 @@
++// SPDX-License-Identifier: (GPL-2.0+ or MIT)
++// Copyright (C) 2022 Arm Ltd.
++
++#include <dt-bindings/interrupt-controller/irq.h>
++
++/dts-v1/;
++
++#include "sun8i-t113s.dtsi"
++#include "sunxi-d1s-t113-mangopi-mq-r.dtsi"
++
++/ {
++      model = "MYIR MYD-YT113X (SPI)";
++      compatible = "myir,myd-yt113x", "myir,myc-yt113x", "allwinner,sun8i-t113s";
++
++      aliases {
++              serial5 = &uart5;
++      };
++
++      chosen {
++              stdout-path = "serial5:115200n8";
++      };
++};
++
++&cpu0 {
++      cpu-supply = <&reg_vcc_core>;
++};
++
++&cpu1 {
++      cpu-supply = <&reg_vcc_core>;
++};
++
++&pio {
++      /omit-if-no-ref/
++      uart5_pins: uart5-pins {
++              pins = "PE6", "PE7";
++              function = "uart5";
++      };
++};
++
++&uart5 {
++      pinctrl-names = "default";
++      pinctrl-0 = <&uart5_pins>;
++      status = "okay";
++};
++
++&uart3 {
++      status = "disabled";
++};
++
++&spi0 {
++      pinctrl-names = "default";
++      pinctrl-0 = <&spi0_pins>;
++      status = "okay";
++      spi_nand@0 {
++              compatible = "spi-nand";
++              reg = <0>;
++               spi-max-frequency = <52000000>;
++      };
++};
+diff -ruN u-boot-2023.04/configs/myir_myd_t113x-spi_defconfig spi/configs/myir_myd_t113x-spi_defconfig
+--- u-boot-2023.04/configs/myir_myd_t113x-spi_defconfig        1970-01-01 01:00:00.000000000 +0100
++++ spi/configs/myir_myd_t113x-spi_defconfig   2023-07-20 14:33:59.790587258 +0200
+@@ -0,0 +1,37 @@
++CONFIG_ARM=y
++CONFIG_ARCH_SUNXI=y
++CONFIG_DEFAULT_DEVICE_TREE="sun8i-t113s-myir-myd-yt113x-spi"
++CONFIG_SUNXI_MINIMUM_DRAM_MB=128
++CONFIG_SPL=y
++CONFIG_SPL_SPI_SUNXI=y
++CONFIG_MTD_SPI_NAND=y
++CONFIG_MACH_SUN8I_R528=y
++CONFIG_CONS_INDEX=6
++CONFIG_MMC0_CD_PIN="PF6"
++# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
++CONFIG_SYS_MONITOR_LEN=786432
++CONFIG_DRAM_CLK=792
++CONFIG_DRAM_ZQ=8092667
++CONFIG_DRAM_SUNXI_ODT_EN=0
++CONFIG_DRAM_SUNXI_TPR0=0x004a2195
++CONFIG_DRAM_SUNXI_TPR11=0x340000
++CONFIG_DRAM_SUNXI_TPR12=0x46
++CONFIG_DRAM_SUNXI_TPR13=0x34000100
++CONFIG_PHY_MOTORCOMM=y
++CONFIG_SUN8I_EMAC=y
++CONFIG_RGMII=y
++CONFIG_RMII=y
++CONFIG_MTD=y
++CONFIG_DM_MTD=y
++CONFIG_SYS_MTDPARTS_RUNTIME=y
++CONFIG_NAND_STM32_FMC2=y
++CONFIG_SYS_NAND_ONFI_DETECTION=y
++CONFIG_MTD_SPI_NAND=y
++CONFIG_DM_SPI_FLASH=y
++CONFIG_SPI_FLASH_MACRONIX=y
++CONFIG_SPI_FLASH_SPANSION=y
++CONFIG_SPI_FLASH_STMICRO=y
++CONFIG_SPI_FLASH_WINBOND=y
++# CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
++CONFIG_SPI_FLASH_MTD=y
++CONFIG_SPI=y