From patchwork Fri Apr 12 19:04:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 788296 Delivered-To: patch@linaro.org Received: by 2002:adf:e6ca:0:b0:346:15ad:a2a with SMTP id y10csp872122wrm; Fri, 12 Apr 2024 12:06:22 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCX7u6NQQkdLHf6Lv4d68pQdEORdFsJ0egngdRsIlUzzfNqG+16J99fKVx0l26TF0S1yNrGHVnzBtr8m8c7A/ZM6 X-Google-Smtp-Source: AGHT+IH7QN6yUngvghOcKphhLy5TnFbgufJ4C6EjCdUc4DWANiodPQnkalTUPmmBSKOpUJqFqYBK X-Received: by 2002:a05:6512:3137:b0:515:a733:2e0e with SMTP id p23-20020a056512313700b00515a7332e0emr2176901lfd.25.1712948782244; Fri, 12 Apr 2024 12:06:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712948782; cv=none; d=google.com; s=arc-20160816; b=qF3LtlM5oazOTePZOnUI5iQk74OylDqmEsvxjISYaHqY6V0iv3JafqBYNfD4h5BZj9 DaSeU0QfnVuZxWqNwjtldMEK1P0iDm/htUIa9EDCmYG8pBVNsqXDtKzPvWxdkTBa7O1m Y/VifcSIwMIrULm5mgWB83284SAISiK7dFWbtibnDKmPYh/qb2cFCDxVo4Qv9ecGLmRO HrgdYIUOVZsIeJZY0mnUSel2/UP79+40dC0saP+Hj3TLhOj4gD2QBfAg8anTVU7PWEzr akUhY4w3OIO4YLSo1LVLXkGYrmtf9oEYg1NlMqx5MuJibfzzMQBe0SdBCW/nAf84WGSy fjGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=QB/8ep8thFQQU4ta2bSV2+q9DJBmJSoE10CldHQqNHI=; fh=81VUbZUay50YNu+YzgM080xU0ctxcYknDaBwU+y0UKY=; b=R/myjJUcgsWbBOUfvm5N2JKGFLjyrJ1ju7BO4CrEJNYIzuUW+ERiNOYR+kYri+J2Yh TBR2mvZq2n1Y9ZlrEYU33JI+vudgz0bGZDO3WL0qj/bMfSkeFR6QAwIAv1Bc5Ul8JuK7 pni4N+rtJ3DjFHPHHSeGJ0/EXMRpekBYUjUJYiu6+J2ct53lysFDlWZjx1PV0MW5bD8f vKUWNQCHF414ZyZA+lICMbjFYJVxWvZut/1LIRJl5VHSdBdw3JxPXNQbp+o87vnLDFf7 Y0ezvHQTVRxEw6uIBr7xDSNX0eELxbWCIGq0vY8A/6xYOKaegjysxeQkNWb8vqQqBsWD OwRA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QZj4jF+L; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id t20-20020a50d714000000b0056ffad2be8csi948196edi.388.2024.04.12.12.06.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 12:06:22 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QZj4jF+L; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 48F78881C8; Fri, 12 Apr 2024 21:06:21 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org 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=linaro.org header.i=@linaro.org header.b="QZj4jF+L"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9AB18881CD; Fri, 12 Apr 2024 21:06:20 +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-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) (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 832E9881BB for ; Fri, 12 Apr 2024 21:06:18 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=caleb.connolly@linaro.org Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-41804f10c68so4721545e9.3 for ; Fri, 12 Apr 2024 12:06:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712948778; x=1713553578; darn=lists.denx.de; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=QB/8ep8thFQQU4ta2bSV2+q9DJBmJSoE10CldHQqNHI=; b=QZj4jF+LjFKwvpu1bxFNz/iS7yaSLTp2sekQhw1URgX3roPuMLk4Yp+XiG1egpQfMB R9cvge1uCM+yMBsrlwT+uE3xUjlLF5h29O/0HVycw77bVJCI6H4PIzvtY3UoaISCtuJR zLImUahrJ+z1Asb/+GujM3ZEuaHL8+7ZxchoQTB0qWpmza1VACuMhhdB4EfvTb4X7spr nOUtihAyTtuglxpwj55iVXOkoNq4gNiE7aou9A3f0kdpT5L5SkPOZe2qMOV1wBWiEPCg R+uKgi7PqZar2UTBBzAogRmSKj5NZk5J1Z4JYM9d0Unb9vQX0yPAvHoCPo9eZ4nLgnN+ ykZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712948778; x=1713553578; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=QB/8ep8thFQQU4ta2bSV2+q9DJBmJSoE10CldHQqNHI=; b=LWOJdjiEZtujFt2FOoYWDp5mTwOt9qWfa9xg3MjacqRTzQugmKB4j3fr77/CaiLo0I 3aw7on5P+0hEYlTij8XW+2R26WK0yGTvNupj3pAX7BRKOaLyGzdwOamnipqZEjZp0xB4 7NtFJvAeQpmLsRqldVUcIeQnzWLsOVFhp0Z47ravDT2dQalqb3zvw3NiV45RwYKBpUIZ lsy387htf/tLXAjhWp9Tqdm0oCeGDJkDT7g/+ji3aE0nDzMtNnb2k9vbEKRVWzKr1Ow/ d368QxEnZNeSD8DX8PVW1KH/AJyYVZU5YyEhEjKMagklsM6/Vyr9mZKMcNcgyAROiaes qJUg== X-Gm-Message-State: AOJu0YxneTBWU9RmqMW2BmMlS1egmaWHvZ5stWTKElIG6kHu4f3lyeeM LQ2MUA8Uqvxmh4JtBgfRr4++Z4ugnTOqwuwlU0o+0q+PVxZtRKH9CWpWS90d5DU= X-Received: by 2002:a05:6000:a8d:b0:343:7ed6:765b with SMTP id dh13-20020a0560000a8d00b003437ed6765bmr2399361wrb.39.1712948777969; Fri, 12 Apr 2024 12:06:17 -0700 (PDT) Received: from cymric.caleb.rex.connolly.tech (92.40.204.173.threembb.co.uk. [92.40.204.173]) by smtp.gmail.com with ESMTPSA id z15-20020adfe54f000000b00345c2f84d5asm4838062wrm.10.2024.04.12.12.06.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 12:06:17 -0700 (PDT) From: Caleb Connolly To: Artur Rojek , Bin Meng , Caleb Connolly , Chanho Park , Christian Taedcke , Heinrich Schuchardt , Jaehoon Chung , Marek Vasut , Shiji Yang , Simon Glass , Tom Rini Cc: u-boot@lists.denx.de Subject: [PATCH] event: add an event for livetree fixups Date: Fri, 12 Apr 2024 20:04:02 +0100 Message-ID: <20240412190542.1576801-1-caleb.connolly@linaro.org> X-Mailer: git-send-email 2.44.0 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 Introduce a new EVT_OF_LIVE event to allow for the livetree to be modified before dm_init_and_scan(). Boards can perform fixups here to handle incompatibilities between U-Boot drivers and upstream DT. This will be used by Qualcomm platforms in future patches to enable setting the dr_mode property if the board doesn't provide one. This has to be set before dm_init_and_scan() is called as this property effects the binding of drivers. Signed-off-by: Caleb Connolly --- common/board_r.c | 1 + common/event.c | 2 ++ include/event.h | 12 ++++++++++++ 3 files changed, 15 insertions(+) diff --git a/common/board_r.c b/common/board_r.c index da0b80f24ff0..7d2da51193ab 100644 --- a/common/board_r.c +++ b/common/board_r.c @@ -217,8 +217,9 @@ static int initr_of_live(void) (struct device_node **)gd_of_root_ptr()); bootstage_accum(BOOTSTAGE_ID_ACCUM_OF_LIVE); if (ret) return ret; + event_notify_null(EVT_OF_LIVE); } return 0; } diff --git a/common/event.c b/common/event.c index 16c2ba6cc921..db32ea0d06f8 100644 --- a/common/event.c +++ b/common/event.c @@ -45,8 +45,10 @@ const char *const type_name[] = { /* fdt hooks */ "ft_fixup", + "of_live", + /* main loop events */ "main_loop", }; diff --git a/include/event.h b/include/event.h index a8f046da3c32..c6436c07d16f 100644 --- a/include/event.h +++ b/include/event.h @@ -144,8 +144,20 @@ enum event_t { * images fail. */ EVT_FT_FIXUP, + /** + * @EVT_OF_LIVE: + * This event is triggered when using CONFIG_OF_LIVE immediately after + * the live tree has been created. It has no parameters, the live tree + * can be accessed from gd->of_root, or using the of_* helpers. + * + * This is intended to be used for performing board specific fixups + * on the tree before it is used by U-Boot. It is much more efficient + * to access and modify than the FDT. + */ + EVT_OF_LIVE, + /** * @EVT_MAIN_LOOP: * This event is triggered immediately before calling main_loop() which * is the entry point of the command line. Its parameter is NULL.