From patchwork Tue May 7 10:03:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Marko X-Patchwork-Id: 1932375 X-Patchwork-Delegate: dario.binacchi@amarulasolutions.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=sartura.hr header.i=@sartura.hr header.a=rsa-sha256 header.s=sartura header.b=c+HXBARC; dkim-atps=neutral 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=patchwork.ozlabs.org) 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 (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VYYmc5gRJz1xnS for ; Tue, 7 May 2024 20:05:04 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 75F3B8875A; Tue, 7 May 2024 12:04:40 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=sartura.hr 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=sartura.hr header.i=@sartura.hr header.b="c+HXBARC"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 26F9888744; Tue, 7 May 2024 12:04:39 +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,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [IPv6:2a00:1450:4864:20::62a]) (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 C17EE8873A for ; Tue, 7 May 2024 12:04:35 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=sartura.hr Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=robert.marko@sartura.hr Received: by mail-ej1-x62a.google.com with SMTP id a640c23a62f3a-a59a934ad50so648681266b.1 for ; Tue, 07 May 2024 03:04:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sartura.hr; s=sartura; t=1715076275; x=1715681075; darn=lists.denx.de; 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=fEoYJCWC0+hvqMQyC2wNI8nJ6/kCzwwBeEaWdHGCqA0=; b=c+HXBARCx7oh5/ZlngcYddObbOcgoJYEGthm9/B4gLjb1EX/XzLpUercQa1viEebgN 97t3Y9VTIIOG3FYy3KtoUsG7P4+dpz6uGOBsPybFO+6tpJvU+2PVuuo+zjZZzsbpRamX a+/ciyBPdJDhj3pnHn3F4B4f0aMHt40SSPcqOj6/zIgGJsgtFU+GETXmSSDSUpINLUh5 DSec9wfbTw8k6+f2+BW1vku7ai1iDvoJJn1yTBfyYSFLKOJJlkGxe3UxNCtAsR0IZSlL QH8gNeSsrih7QLW0Y6NrzJdsVSZUOwAdfaBxJJtoVKEc3g7qZu7hk0p7j6tzxpcArMn7 r2mA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715076275; x=1715681075; 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=fEoYJCWC0+hvqMQyC2wNI8nJ6/kCzwwBeEaWdHGCqA0=; b=Q/KPBq7Kg7xE+gmYb1wenfojo1Zrcgkln3rqfIIl8doohNYHp4njmdx/GRv2Cs32CT YEpOw77452GCoXFm7z+Mp/hcf3DtwQip2JjnCNfGzEKcP/uDjthdXk7c8pe9dNRKja2z Q4WTpn0SzN28OZv7XH8ALPUKZJFyh3pXCHj/ZBIvJX0KlOA0FegeX4F8pNCNl/ZQySeO gjlCLwf7rp2ChQ9MJOGrHBKD1DXgN689KSbcytgvW19w285CVTkgJnXBRb01bbiOF/e3 F02FQLEpg96dn3BBA62VzjMlUKqGbQlAIW8EIq5e74SWcL3KporWgGpDEdcoT5yx+7bo lSLw== X-Forwarded-Encrypted: i=1; AJvYcCXLdaTvSgU6RVx27yDRQBdS/z3JRYD1swk8sO5ObAm2Gu737pkYdJc297xa5mxxapGE0J1YBQUkA3GS3o0tB76FyQX0eA== X-Gm-Message-State: AOJu0YxvSc7WnAouOVIZhOLHUlyqTXzYAgQxKzEuYg1uJSXVv1w3pQiy C2EMqGqxxDYo/tAReKs+SfPhc7cnLaBdkoYDLWkEktVFrh+WP2x9lWK1FodUDIc= X-Google-Smtp-Source: AGHT+IHZPYBaRdntq2pVvSgz4rNGOO6kCWyJ17CajTnEfP8CfwO87d1zXhfILjajhCZEpxdLcpA2/g== X-Received: by 2002:a17:907:7248:b0:a59:b784:ced4 with SMTP id ds8-20020a170907724800b00a59b784ced4mr6480013ejc.75.1715076275192; Tue, 07 May 2024 03:04:35 -0700 (PDT) Received: from fedora.. (cpe-188-129-46-59.dynamic.amis.hr. [188.129.46.59]) by smtp.googlemail.com with ESMTPSA id s20-20020a170906455400b00a59c4a16e4asm2878350ejq.120.2024.05.07.03.04.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 03:04:34 -0700 (PDT) From: Robert Marko To: sjg@chromium.org, trini@konsulko.com, jagan@amarulasolutions.com, vigneshr@ti.com, marek.vasut+renesas@mailbox.org, u-boot@lists.denx.de Cc: j.beck@linefinity.com, Robert Marko Subject: [RFC PATCH 1/5] dm: core: add on_reset method Date: Tue, 7 May 2024 12:03:49 +0200 Message-ID: <20240507100431.206670-2-robert.marko@sartura.hr> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240507100431.206670-1-robert.marko@sartura.hr> References: <20240507100431.206670-1-robert.marko@sartura.hr> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.8 at phobos.denx.de X-Virus-Status: Clean Currently, we dont have a specific method that is intented to be called right before calling board reset. Intention for this method is to be able to exit 4-byte adressing mode on SPI-NOR devices before reset. Signed-off-by: Robert Marko --- include/dm/device.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/dm/device.h b/include/dm/device.h index add67f9ec0..19713d958c 100644 --- a/include/dm/device.h +++ b/include/dm/device.h @@ -344,6 +344,7 @@ struct udevice_id { * @probe: Called to probe a device, i.e. activate it * @remove: Called to remove a device, i.e. de-activate it * @unbind: Called to unbind a device from its driver + * @on_reset: Called befora calling board reset * @of_to_plat: Called before probe to decode device tree data * @child_post_bind: Called after a new child has been bound * @child_pre_probe: Called before a child device is probed. The device has @@ -379,6 +380,7 @@ struct driver { int (*probe)(struct udevice *dev); int (*remove)(struct udevice *dev); int (*unbind)(struct udevice *dev); + int (*on_reset)(struct udevice *dev); int (*of_to_plat)(struct udevice *dev); int (*child_post_bind)(struct udevice *dev); int (*child_pre_probe)(struct udevice *dev); From patchwork Tue May 7 10:03:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Marko X-Patchwork-Id: 1932374 X-Patchwork-Delegate: dario.binacchi@amarulasolutions.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=sartura.hr header.i=@sartura.hr header.a=rsa-sha256 header.s=sartura header.b=UNJtnyBV; dkim-atps=neutral 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=patchwork.ozlabs.org) 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 (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VYYmP0kkFz1xnS for ; Tue, 7 May 2024 20:04:53 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 19F3588746; Tue, 7 May 2024 12:04:40 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=sartura.hr 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=sartura.hr header.i=@sartura.hr header.b="UNJtnyBV"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id F405788754; Tue, 7 May 2024 12:04:38 +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,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [IPv6:2a00:1450:4864:20::62d]) (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 E695588744 for ; Tue, 7 May 2024 12:04:36 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=sartura.hr Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=robert.marko@sartura.hr Received: by mail-ej1-x62d.google.com with SMTP id a640c23a62f3a-a599eedc8eeso654988866b.1 for ; Tue, 07 May 2024 03:04:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sartura.hr; s=sartura; t=1715076276; x=1715681076; darn=lists.denx.de; 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=uN8R3yFYxBl2uw5OglmUuCxQs3m7FqhK4SCJsxeCBUM=; b=UNJtnyBVpbTiZAAF1Mxa9VdK5o1mtCOxn1nl4igB9IsuaQ/pXH0GV5G28rbUvyZ6nP IVdsC50o6Co/A3J16D7x0IOxjYdiS7sE4d23tQf/JppRKjL3s+jZZh1WPcwNOGNlS0WE YKoxSXonIhqYvgF+eYWOKcYPMvw/ExJoebqj4TWwi5jkvtre5YS0uxDxJOdb5pG3Hc4U o6XRi768O5ynRodZ2NXWIBo9S5kKkrWvu3vHYFg2iNJvqASr+OzT1pOajhxEsVx9kYMi L//VJJLhWkJP3Laxmdr3sYhbRYm07NG2dKrHs8Z3sbrvjmk7XisMxzLI9Q0OBUSXmyy/ hOXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715076276; x=1715681076; 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=uN8R3yFYxBl2uw5OglmUuCxQs3m7FqhK4SCJsxeCBUM=; b=fw9OROev16awVVM4S58Jk/xh4lpK+XHZJZHfQEN9XBALjauXQv8i9V0Q7252GlbSSR QgJ6rHAqetVJ54YeQ0JrROORbFXdtQLb3Qt60ojbxBCy+KWUlblPzMbZ89+Qr/tUQZj3 9KklbIl5Bf3T1P4sAQG9o+IrIA/haV5W8Twuo/Tutwnme12VtGr2cyp94MCEKcJREeKO xMYdwCxiki0y4aMMM79qR8VyHvqkBcxxIBxrCINP4beqarBVpRJ5Ml4Q/y1UpUfAg61E Yqikf14I5ITwn1kVxcP4K+9cfX9Xbr61BcF//LogawwafmsAAYhw/53/LdRwN6qdxoYU 3GPg== X-Forwarded-Encrypted: i=1; AJvYcCW4lUfNJUPqOX8cG88aYpvN1OCccOIK26km+TIpJnzQQQ4dqB/m6wzqGHnknJEJyljq5Q1+Fz3D6gO2vcq8KicCBTGu+w== X-Gm-Message-State: AOJu0YzN/bbO0Tr1oO2sa47AQ2qhzag5ZTWDmp+IXWiONx3kpH5y7vvf sH7zcgdHwW19ObU7Wru/4fQfxyE7B3KxMhrYKPISfPAiTMwzUhbE42OIfCPNuQM= X-Google-Smtp-Source: AGHT+IG5HOqvMcnofa+yr9M5SzTRG0BW3H0ko7D7eylygKbXHV6jm25QZ9ocWY8pVds3XUcZXr6JAA== X-Received: by 2002:a17:907:7203:b0:a59:c31a:91be with SMTP id dr3-20020a170907720300b00a59c31a91bemr4391019ejc.16.1715076276313; Tue, 07 May 2024 03:04:36 -0700 (PDT) Received: from fedora.. (cpe-188-129-46-59.dynamic.amis.hr. [188.129.46.59]) by smtp.googlemail.com with ESMTPSA id s20-20020a170906455400b00a59c4a16e4asm2878350ejq.120.2024.05.07.03.04.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 03:04:35 -0700 (PDT) From: Robert Marko To: sjg@chromium.org, trini@konsulko.com, jagan@amarulasolutions.com, vigneshr@ti.com, marek.vasut+renesas@mailbox.org, u-boot@lists.denx.de Cc: j.beck@linefinity.com, Robert Marko Subject: [RFC PATCH 2/5] dm: core: introduce uclass_id_on_reset() Date: Tue, 7 May 2024 12:03:50 +0200 Message-ID: <20240507100431.206670-3-robert.marko@sartura.hr> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240507100431.206670-1-robert.marko@sartura.hr> References: <20240507100431.206670-1-robert.marko@sartura.hr> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.8 at phobos.denx.de X-Virus-Status: Clean Implement a helper to call .on_reset method for every device in a certain uclass. Intention is to use this helper for UCLASS_SPI_FLASH before board reset to exit 4-byte adressing mode. Signed-off-by: Robert Marko --- drivers/core/uclass.c | 13 +++++++++++++ include/dm/uclass.h | 8 ++++++++ 2 files changed, 21 insertions(+) diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c index e46d5717aa..bed5553d5e 100644 --- a/drivers/core/uclass.c +++ b/drivers/core/uclass.c @@ -831,6 +831,19 @@ int uclass_id_count(enum uclass_id id) return count; } +int uclass_id_on_reset(enum uclass_id id) +{ + struct udevice *dev; + struct uclass *uc; + + uclass_id_foreach_dev(id, dev, uc) { + if (dev->driver->on_reset) + return dev->driver->on_reset(dev); + } + + return 0; +} + UCLASS_DRIVER(nop) = { .id = UCLASS_NOP, .name = "nop", diff --git a/include/dm/uclass.h b/include/dm/uclass.h index 456eef7f2f..57eb1b144f 100644 --- a/include/dm/uclass.h +++ b/include/dm/uclass.h @@ -454,6 +454,14 @@ int uclass_probe_all(enum uclass_id id); */ int uclass_id_count(enum uclass_id id); +/** + * uclass_id_on_reset() - call on_reset for devices of a given uclass ID + * + * @id: uclass ID to look up + * Return: 0 if OK, other -ve on error + */ +int uclass_id_on_reset(enum uclass_id id); + /** * uclass_id_foreach_dev() - iterate through devices of a given uclass ID * From patchwork Tue May 7 10:03:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Marko X-Patchwork-Id: 1932376 X-Patchwork-Delegate: dario.binacchi@amarulasolutions.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=sartura.hr header.i=@sartura.hr header.a=rsa-sha256 header.s=sartura header.b=yWdoMI6L; dkim-atps=neutral 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=patchwork.ozlabs.org) 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 (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VYYmr3Lbvz1ydW for ; Tue, 7 May 2024 20:05:16 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D36B888760; Tue, 7 May 2024 12:04:41 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=sartura.hr 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=sartura.hr header.i=@sartura.hr header.b="yWdoMI6L"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2F8C38875F; Tue, 7 May 2024 12:04:41 +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,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) (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 C46A38874A for ; Tue, 7 May 2024 12:04:37 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=sartura.hr Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=robert.marko@sartura.hr Received: by mail-ej1-x633.google.com with SMTP id a640c23a62f3a-a59a0e4b773so693183466b.2 for ; Tue, 07 May 2024 03:04:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sartura.hr; s=sartura; t=1715076277; x=1715681077; darn=lists.denx.de; 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=vsXHH3tlBcKEad3v9mRb4Z+8Xx+3jxTikoglNmEAeWE=; b=yWdoMI6Ld6qJhL8IxU1DKYqo3xX1Tj+2JC1YQJToHyC6LCVIgjAh6T1aAUl05rlcBB 8JiLT4shUmjBbM0nOag7MpN6CVXNGCCQs/YQiso0/3nzM6nBImMXhCIc1zTDo6OBC+cN eYzRzD7J0wTvTlw0q3b5qpFqLL+wW8ir7wX9jgkc2G1NyglLFG6iiJpD6H4iBWxx0Nkg OR1z2dsJHvkHRwClxqxTuIByJT2h99nTRahynDmuz7OVLtWos19xkq57axMfI6eY6pd7 RZmo8FA8lSE85RoVycK2uz9cbNF3cEbZ5CG0V9TKxMic5SsW/HjXRs9ljkAZBPx3S/cD a/lw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715076277; x=1715681077; 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=vsXHH3tlBcKEad3v9mRb4Z+8Xx+3jxTikoglNmEAeWE=; b=cJx3/Z3QvBzZyiVj+z8jqbZoSYQMC6muBCTx2gRSOVVo3k4EYmJWSls+jKkSoN9Hla rWVLIR6YvziYzyreU8DxL5U+hDtiUq2xGkZFf5wkuAX2g85LUzgF3VdgV3TgE4dve40u TOCsCPx6WfmYr4D16rzzWAQGzJahnqtOr63Gl/vPzKJVSaF31geDZKlVgktxedAWq0OF 7kG0wHQDgvoooQR8fvqboJhRV990xWERTjJd07sQyRBGvfVI+TsTyd8Xly8+uRT78mu8 F8q6ftbC5db0cxieFevxFYgca3xHDPujMUgeA7AtkPBP5tl4sZ/CXdNRRh4qbNnGaGdU B9aw== X-Forwarded-Encrypted: i=1; AJvYcCWpFYDUVT5avtTjg7SAR7qCt4fS3S2EPwSYIopqPi71nUKXxY7iswpZvQH4euOpbuHv/taoirny4eoj0uwVPD1fT5uKVA== X-Gm-Message-State: AOJu0YxEq7q6wrQRoOrqE59DDhEFywlVTZk56EOqUqLHz9ksrEuN6a2X wObANU61afl5ZeEFjQ3MFi/3SPRwjhfORJL6Vk8NTz9OL8QzseFr5z/Zc2/v4WU= X-Google-Smtp-Source: AGHT+IEBIsPkFRIEz1Fio5lTmKH2kAk/uOMArOGJTVuetUEFCwRNe5pBFwOH3TCKXRlN6IKV2fTdbA== X-Received: by 2002:a17:906:a43:b0:a59:c090:7780 with SMTP id x3-20020a1709060a4300b00a59c0907780mr4323355ejf.7.1715076277307; Tue, 07 May 2024 03:04:37 -0700 (PDT) Received: from fedora.. (cpe-188-129-46-59.dynamic.amis.hr. [188.129.46.59]) by smtp.googlemail.com with ESMTPSA id s20-20020a170906455400b00a59c4a16e4asm2878350ejq.120.2024.05.07.03.04.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 03:04:36 -0700 (PDT) From: Robert Marko To: sjg@chromium.org, trini@konsulko.com, jagan@amarulasolutions.com, vigneshr@ti.com, marek.vasut+renesas@mailbox.org, u-boot@lists.denx.de Cc: j.beck@linefinity.com, Robert Marko Subject: [RFC PATCH 3/5] mtd: spi-nor: rename and export 4-byte adressing mode function Date: Tue, 7 May 2024 12:03:51 +0200 Message-ID: <20240507100431.206670-4-robert.marko@sartura.hr> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240507100431.206670-1-robert.marko@sartura.hr> References: <20240507100431.206670-1-robert.marko@sartura.hr> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.8 at phobos.denx.de X-Virus-Status: Clean Currently 4-byte adressing mode function is not exported, but since we plan to use it outside of the SPI NOR core we need to export it. While we are here, rename it to align the naming with the rest of exported functions. Signed-off-by: Robert Marko --- drivers/mtd/spi/spi-nor-core.c | 7 +++---- include/linux/mtd/spi-nor.h | 10 ++++++++++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c index 8882b045ce..8a64ee40c3 100644 --- a/drivers/mtd/spi/spi-nor-core.c +++ b/drivers/mtd/spi/spi-nor-core.c @@ -682,8 +682,7 @@ static void spi_nor_set_4byte_opcodes(struct spi_nor *nor, #endif /* !CONFIG_SPI_FLASH_BAR */ /* Enable/disable 4-byte addressing mode. */ -static int set_4byte(struct spi_nor *nor, const struct flash_info *info, - int enable) +int spi_nor_set_4byte(struct spi_nor *nor, const struct flash_info *info, int enable) { int status; bool need_wren = false; @@ -3481,7 +3480,7 @@ static int s25_s28_post_bfpt_fixup(struct spi_nor *nor, */ if (params->size > SZ_128M) { if (bfpt->dwords[BFPT_DWORD(16)] & BFPT_DWORD16_EX4B_PWRCYC) { - ret = set_4byte(nor, nor->info, 1); + ret = spi_nor_set_4byte(nor, nor->info, 1); if (ret) return ret; } @@ -3915,7 +3914,7 @@ static int spi_nor_init(struct spi_nor *nor) */ if (nor->flags & SNOR_F_BROKEN_RESET) debug("enabling reset hack; may not recover from unexpected reboots\n"); - set_4byte(nor, nor->info, 1); + spi_nor_set_4byte(nor, nor->info, 1); } return 0; diff --git a/include/linux/mtd/spi-nor.h b/include/linux/mtd/spi-nor.h index 80e56cf308..94c0e5e98f 100644 --- a/include/linux/mtd/spi-nor.h +++ b/include/linux/mtd/spi-nor.h @@ -646,6 +646,16 @@ static inline int spi_nor_remove(struct spi_nor *nor) * Return: 0 for success, -errno for failure. */ int spi_nor_remove(struct spi_nor *nor); + +/** + * spi_nor_set_4byte() - perform cleanup before booting to the next stage + * @nor: the spi_nor structure + * @flash_info: the flash_info structure + * @enable: enable or disable 4byte mode + * + * Return: 0 for success, -errno for failure. + */ +int spi_nor_set_4byte(struct spi_nor *nor, const struct flash_info *info, int enable); #endif #endif From patchwork Tue May 7 10:03:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Marko X-Patchwork-Id: 1932377 X-Patchwork-Delegate: dario.binacchi@amarulasolutions.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=sartura.hr header.i=@sartura.hr header.a=rsa-sha256 header.s=sartura header.b=SA5IrlNA; dkim-atps=neutral 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=patchwork.ozlabs.org) 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 (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VYYn515Qnz1ydW for ; Tue, 7 May 2024 20:05:29 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 44F9A88742; Tue, 7 May 2024 12:04:44 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=sartura.hr 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=sartura.hr header.i=@sartura.hr header.b="SA5IrlNA"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C284888742; Tue, 7 May 2024 12:04:42 +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,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x636.google.com (mail-ej1-x636.google.com [IPv6:2a00:1450:4864:20::636]) (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 D9B3988750 for ; Tue, 7 May 2024 12:04:38 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=sartura.hr Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=robert.marko@sartura.hr Received: by mail-ej1-x636.google.com with SMTP id a640c23a62f3a-a59a5f81af4so752158066b.3 for ; Tue, 07 May 2024 03:04:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sartura.hr; s=sartura; t=1715076278; x=1715681078; darn=lists.denx.de; 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=LZFM/0jiokvrFy3Z+ryB6aiOjjvnOIQs2tA/TbvBVuE=; b=SA5IrlNAlxK63jUyfNy/QrJwLacTdxnY21c0bBHSgeoPdpen5jkTGZGpIFq3XevXcq frblBFytmtdh06fiOgFlHM+YIAUCWjTcKKTiKjEQym+t0vA47az2wBHSDmlu2TXWNQSo +AY+STKBPTEw2xerSL7WvSxHHbpEtYz3jXs8t7W97hk8nlx8qPbCuSXj2WVtbxc3WUM4 IX/FWZXsTn09HapSXLjCdiVH3K3WlIiCvMfn89DvV90hgxukdqj+aIzID5zzrtbqsJ4q ijIuBYudBRBzvaXQ/IWWcr1sQ+XDEdHpkzOy8qNXvKc1DwAZuwacO4ir2jE2byMESRqs 5AVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715076278; x=1715681078; 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=LZFM/0jiokvrFy3Z+ryB6aiOjjvnOIQs2tA/TbvBVuE=; b=clKQcrcttpKSe2gkjdusNOMAyyGKkveECAS6NIa5/LZvHuvLyHWhhpP+5leHniDjO6 qOZ+Hz3pO+10dip8PSGLw4Y49gHgphpWr+vUJsFHDdGYawI5KcApvcBEohhQiFtLB7hz z5m/ncLFDAgGtf1lg/yX5j+QpV315snf8IzT8BTcVKSwHXUcSD+9t5vuWK8o2ar2wmGK E3MR4g1C5rI+NkOIeOh8oQIk+BMh94ooTfpvrjGP1Za9xhimFt7NvGpXYDgeR2WXPPnF Lq7+NrN4fIn1/wMJYxfNH5VdMgRYCl31ZF1bGlKbTjChLNF1Dhsxsf9TfXREzuW5+9RB MGPA== X-Forwarded-Encrypted: i=1; AJvYcCXKdyE8QrIo71Lm6pf7Gn+RTvjOn+GWlXmWkTCWOy1nMNHLmM1S7V2l5Km6yr+kD5UDocNW/NG7r0D6XQTN2Qc7QwngLg== X-Gm-Message-State: AOJu0YxDikvtuGk05cRX50Br+F5S7NwMUetQ49nz9mzJdhJGKTWHzFve 3pWrolQRIa9EfYZYwdS1gCRiuNVXfIQntmOyx/VhWVJPtnr+nJoyFz86bZlYk2Q= X-Google-Smtp-Source: AGHT+IE7YS+eiSCXqnEQUyag70UdlzhA/d85p4C6V3b6QPN9x1CUaNoTrwmQ9VeZOm2awZJv06gtpQ== X-Received: by 2002:a17:906:a159:b0:a58:e71d:d74 with SMTP id bu25-20020a170906a15900b00a58e71d0d74mr7617021ejb.13.1715076278328; Tue, 07 May 2024 03:04:38 -0700 (PDT) Received: from fedora.. (cpe-188-129-46-59.dynamic.amis.hr. [188.129.46.59]) by smtp.googlemail.com with ESMTPSA id s20-20020a170906455400b00a59c4a16e4asm2878350ejq.120.2024.05.07.03.04.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 03:04:37 -0700 (PDT) From: Robert Marko To: sjg@chromium.org, trini@konsulko.com, jagan@amarulasolutions.com, vigneshr@ti.com, marek.vasut+renesas@mailbox.org, u-boot@lists.denx.de Cc: j.beck@linefinity.com, Robert Marko Subject: [RFC PATCH 4/5] mtd: spi: sf: implement .on_reset method Date: Tue, 7 May 2024 12:03:52 +0200 Message-ID: <20240507100431.206670-5-robert.marko@sartura.hr> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240507100431.206670-1-robert.marko@sartura.hr> References: <20240507100431.206670-1-robert.marko@sartura.hr> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.8 at phobos.denx.de X-Virus-Status: Clean Implement .on_reset method for SPI flash, by extending the remove method to exit 4-byte adressing mode in case it was entered before. This fixes the issue with 4-byte adressing mode being left enabled on board reset. That is an issue on Qualcomm IPQ4019 boards since the CPU expects flash to be in 3-byte adressing mode and will just hang otherwise. Note that this does not fix a case where you remove the power while U-Boot is still running and in that case it will still be stuck in 4-byte mode. Signed-off-by: Robert Marko --- drivers/mtd/spi/sf_probe.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/mtd/spi/sf_probe.c b/drivers/mtd/spi/sf_probe.c index de6516f106..31dae17ba0 100644 --- a/drivers/mtd/spi/sf_probe.c +++ b/drivers/mtd/spi/sf_probe.c @@ -225,6 +225,15 @@ static int spi_flash_std_remove(struct udevice *dev) struct spi_flash *flash = dev_get_uclass_priv(dev); int ret; + if (flash->addr_width == 4 && + !(flash->info->flags & SPI_NOR_OCTAL_DTR_READ) && + (JEDEC_MFR(flash->info) != SNOR_MFR_SPANSION) && + !(flash->flags & SNOR_F_4B_OPCODES)) { + ret = spi_nor_set_4byte(flash, flash->info, 0); + if (ret) + return ret; + } + if (CONFIG_IS_ENABLED(SPI_DIRMAP)) { spi_mem_dirmap_destroy(flash->dirmap.wdesc); spi_mem_dirmap_destroy(flash->dirmap.rdesc); @@ -258,6 +267,7 @@ U_BOOT_DRIVER(jedec_spi_nor) = { .of_match = spi_flash_std_ids, .probe = spi_flash_std_probe, .remove = spi_flash_std_remove, + .on_reset = spi_flash_std_remove, .priv_auto = sizeof(struct spi_nor), .ops = &spi_flash_std_ops, .flags = DM_FLAG_OS_PREPARE, From patchwork Tue May 7 10:03:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Marko X-Patchwork-Id: 1932378 X-Patchwork-Delegate: dario.binacchi@amarulasolutions.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=sartura.hr header.i=@sartura.hr header.a=rsa-sha256 header.s=sartura header.b=bm2ZPJ3w; dkim-atps=neutral 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=patchwork.ozlabs.org) 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 (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VYYnJ6zQhz1ydW for ; Tue, 7 May 2024 20:05:40 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9DD7D8875E; Tue, 7 May 2024 12:04:44 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=sartura.hr 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=sartura.hr header.i=@sartura.hr header.b="bm2ZPJ3w"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9371188742; Tue, 7 May 2024 12:04: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,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) (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 B67318873A for ; Tue, 7 May 2024 12:04:39 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=sartura.hr Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=robert.marko@sartura.hr Received: by mail-ej1-x631.google.com with SMTP id a640c23a62f3a-a59a8f0d941so758704366b.2 for ; Tue, 07 May 2024 03:04:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sartura.hr; s=sartura; t=1715076279; x=1715681079; darn=lists.denx.de; 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=BSGurHe28qrCxQerOrRZiFNpjgoWWWIO5x6tYS0bToA=; b=bm2ZPJ3wLk7raHuCNXmwNduMdr4PJh+byvst6BJQq9hErtsfj6R1Na+bFeNmV5ZI9O Vp6ID1iAnXdlJWTdMpDbnKyjP5sWfeMdH0RPRDr3YO2d49IbU9qVKLHm1eupILxsV6l+ i8H3gJp4F4Mf9XvEvPuUPB2P2rMba0rYdXeNB2DoWWU8E9oNJwo98Dj1+sdm65PMRJr+ QaXva/biiAqtj5SfAR5eH7IGL9HILkKHnOr/6t2UwkjGo85HCxdU0bD9nEjE0mcfqOdN Cn4iPaIfDS+DjRuzTjB5sj5rrmtK0ELL9AAzfKPnqI1+oflxbvj+kZvQJfi0d+BKfs/G /r1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715076279; x=1715681079; 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=BSGurHe28qrCxQerOrRZiFNpjgoWWWIO5x6tYS0bToA=; b=SymgS8aRSaHGqowt77irgW1mAQxQR1B7h5vcLGS/thd/uuoyKbH9RCS3Xp6jvNbxfB zFTEqRh47b+ReOvYEwK0/YbXkDuKjbRdfFV/RYqLpSHpgGev0T4tZJ85WCIt211SEq/a zk1z54SA4Csc0DaFwgsGFC3YuhHLkesEhX3lrHI0U2SRIlVleoY6ZmhPqwG7JguPlDGL H1w974iL3VtmyEPRcjKC+nC11wve6bLlZhmlHPiGEHKcPGfDCHcYx0iTDhk5xInl0r7f Fv4irF6lSRqsWV4Ah8Z1sR/qiaPsX9W3ZxlrmDUmD6pcdnitlpEtlArzff6NwI+DpryW SHfA== X-Forwarded-Encrypted: i=1; AJvYcCVcOXS/DNVtSmkwHErhTHw0m7VQXr0Ecn5YBPpa+SdqorC3E3cm863zm2RVbLzuWK9oJQH4WyETQuWJQ7t6UjD/48fIoQ== X-Gm-Message-State: AOJu0Yx3azZyVH99pixkWrxqQXIlZfLn96C7o6tu16vnI0RUCr+XToKv NJ+R2f5mUk1wgdrL7Z6im3WCWLRh3fUxlGg/hUiKE3PX1+TzkkzU7Rf1lG/s3tY= X-Google-Smtp-Source: AGHT+IFZDJbqpQ7CCpD6UffKkw4o/GaiZJz6BVpL04juNUbP6lITkg3E4750XZGAq2wYuQKWAhaz8Q== X-Received: by 2002:a17:907:9493:b0:a59:bacc:b082 with SMTP id dm19-20020a170907949300b00a59baccb082mr4680178ejc.60.1715076279287; Tue, 07 May 2024 03:04:39 -0700 (PDT) Received: from fedora.. (cpe-188-129-46-59.dynamic.amis.hr. [188.129.46.59]) by smtp.googlemail.com with ESMTPSA id s20-20020a170906455400b00a59c4a16e4asm2878350ejq.120.2024.05.07.03.04.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 03:04:38 -0700 (PDT) From: Robert Marko To: sjg@chromium.org, trini@konsulko.com, jagan@amarulasolutions.com, vigneshr@ti.com, marek.vasut+renesas@mailbox.org, u-boot@lists.denx.de Cc: j.beck@linefinity.com, Robert Marko Subject: [RFC PATCH 5/5] sysreset: call .on_reset for UCLASS_SPI_FLASH before reset request Date: Tue, 7 May 2024 12:03:53 +0200 Message-ID: <20240507100431.206670-6-robert.marko@sartura.hr> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240507100431.206670-1-robert.marko@sartura.hr> References: <20240507100431.206670-1-robert.marko@sartura.hr> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.8 at phobos.denx.de X-Virus-Status: Clean Call .on_reset method for UCLASS_SPI_FLASH devices before requesting reset. This fixes the issue with 4-byte adressing mode being left enabled on board reset. That is an issue on Qualcomm IPQ4019 boards since the CPU expects flash to be in 3-byte adressing mode and will just hang otherwise. Note that this does not fix a case where you remove the power while U-Boot is still running and in that case it will still be stuck in 4-byte mode. Signed-off-by: Robert Marko --- drivers/sysreset/sysreset-uclass.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/sysreset/sysreset-uclass.c b/drivers/sysreset/sysreset-uclass.c index 6151b5fe03..8321cc4230 100644 --- a/drivers/sysreset/sysreset-uclass.c +++ b/drivers/sysreset/sysreset-uclass.c @@ -30,6 +30,13 @@ int sysreset_request(struct udevice *dev, enum sysreset_t type) if (!ops->request) return -ENOSYS; + /* + * Call the .on_reset op for SPI flash devices. + * This is required for most devices in order to exit the + * 4-byte adressing mode. + */ + uclass_id_on_reset(UCLASS_SPI_FLASH); + return ops->request(dev, type); }