From patchwork Tue Jan 9 11:51:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 761052 Delivered-To: patch@linaro.org Received: by 2002:a5d:6e02:0:b0:337:62d3:c6d5 with SMTP id h2csp1320998wrz; Tue, 9 Jan 2024 03:53:27 -0800 (PST) X-Google-Smtp-Source: AGHT+IEvZfGraTQwN4Qz4Wh+bq6E+M3O2or4tM/h8GJxdxUkn1uPKGNw5EX6VOzimX5spzwqjb2I X-Received: by 2002:a5d:638a:0:b0:336:5f5d:70aa with SMTP id p10-20020a5d638a000000b003365f5d70aamr433771wru.129.1704801207592; Tue, 09 Jan 2024 03:53:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704801207; cv=none; d=google.com; s=arc-20160816; b=RhEwheSpcfOFXgy1Wtdgm9vOzYsFyM4E/Ce9EUwbizeEedFmW1uEDmz+aLHbVSc6Mc owvNVxs6TEMD9ABmOmo0NGnxPnGe3dZWkQ7p4wq+w+4H68dOsiuV1bCLeT23fwZJV5IP UmuOYMhgzRuWatde+H8WBNoXo0J/YXwgT1911jO8kMWebmg0QExGEv5ttpbVg86vS53g 9XHLKjst9JY+lsa/VsZCXQdUGoVIhZxC0idB81h2iHfQTgwEpBS41BfNhNXu0dDGQn+O E0CcXHw0qsGzWjDzDKCV0D1tPeMHmDqZlrhbWCNysuFpHnraqDMH5ijC7kWRrQngHj2y 4c9g== 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=oLNuw72sflaDdDkVNGqe8SXb8ph4kQY7q0fSNmk6Wis=; fh=rR0E0XMpBvjLoYuahhul57s1Ey5QWD0sC/xxWUMeFNo=; b=WetWJ+lvSUhQioWPnthQHWwv0iImn6gWwVqRuhWzEeCKfnPm+RNL/13mtETOSy/+pO g9bqIgzpPcTYmt7RdfH0dc1gbMqQk7q+1UA+qi5o4oAlk59GHa3ChObz4Fg86PMpx8EC GwzYhIk+KewJ9M5hUPdMruDAbZ+OeQgEZzH4ca0bARkhP4Eoh1yVfIrXT0fXzzfzP1Gp oiELsPMqBbcQcZdiCTjw+gJqMjEj6MPWendQNhpcUPxj9rxweN98z/mOjSJlYjIKJJN6 bSEeOOGyacoF/UBrwBz1Ew2TvocsPIMSVxY0whYAh2j4zK7F1RDiHjgw/NBwZ1xeYdtM 037g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JgSDw+dC; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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. [85.214.62.61]) by mx.google.com with ESMTPS id f4-20020adfb604000000b003367a5b9b25si870406wre.199.2024.01.09.03.53.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jan 2024 03:53:27 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JgSDw+dC; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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 69B9487800; Tue, 9 Jan 2024 12:53:26 +0100 (CET) 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="JgSDw+dC"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 977DB87823; Tue, 9 Jan 2024 12:53:25 +0100 (CET) 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, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) (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 7E9E98773F for ; Tue, 9 Jan 2024 12:53:23 +0100 (CET) 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-x32d.google.com with SMTP id 5b1f17b1804b1-40d5a41143fso31791835e9.3 for ; Tue, 09 Jan 2024 03:53:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704801203; x=1705406003; 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=oLNuw72sflaDdDkVNGqe8SXb8ph4kQY7q0fSNmk6Wis=; b=JgSDw+dC12A1UBROTuJSTVe0v1BqoYOxMtrByA6hKIkc/ucx3fFEUqa6S1uenmFB3H E2UpRVKvoGBDMQWRgrWRE2+4SKsJep67jZswELlMk1nPOWw81Rgso3qPmNprfgeccjYV i0gvUfPYDMWLsdPxkJcN9dlC7dMh25Mov1mzPAR7XP2M58N1vKqGVkMCBPJBik4Ily1o RooHyCy+bGhkhZgRfuc3LZySNlbVqiDJqR4SJD2RYoICqkAspKCLGNJSlPl/yMeJjUWx Ph9WkYFghWHlwhgVzNM1IFAJDpoM57pBipM7ucxQqbfYaOSQKd0kG/xyENxNbIEzbASa V0qA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704801203; x=1705406003; 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=oLNuw72sflaDdDkVNGqe8SXb8ph4kQY7q0fSNmk6Wis=; b=lIoK+8Ml/qP28R0vGw5q/oe8M2E2tvpVhfuXKTZfU3J+RSMg27YhuW1BIK0l4I8rA3 0LQ6PZZkstyYTlWbodiiL/RBh6xsbJEM90LKFyn/zZN4ULC540eYctNGGwMlRLXGR7VR RM9AgFd08Zpy7aQejrtlALaxScffkewz1pbTtO+F/ETHfrbSNkjywyi6/wXsOIBH9HOt VL3R0t8OKb6OWE+PRVkM8gewb5LvUCtgJF6X+W516+KiVQ7zfizXPRhRoD9jUB6OtVz4 3Q1FkHtwALrD8KWPw8EQ+pKrBAKlfq7R8SqKWUScEfx5R9bbFxfTOd6+VLM8I5Jo6U15 DjNg== X-Gm-Message-State: AOJu0YykFMwvfGxlGJy8Zs0lqVeRKbY3xAZRQEa6REN6IGR3L5lNOaeU qZnkHn8dj/RFc0QFisVQIPGRL26Jm04RWw== X-Received: by 2002:a05:600c:45d2:b0:40e:5209:2311 with SMTP id s18-20020a05600c45d200b0040e52092311mr238453wmo.83.1704801202856; Tue, 09 Jan 2024 03:53:22 -0800 (PST) Received: from lion.caleb.rex.connolly.tech (host-92-17-96-230.as13285.net. [92.17.96.230]) by smtp.gmail.com with ESMTPSA id p3-20020a05600c358300b0040d91930f93sm3260688wmq.11.2024.01.09.03.53.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jan 2024 03:53:22 -0800 (PST) From: Caleb Connolly To: Tom Rini , Simon Glass , Sumit Garg Cc: u-boot@lists.denx.de, Caleb Connolly , Svyatoslav Ryhel Subject: [PATCH v2] boot: add support for button commands Date: Tue, 9 Jan 2024 11:51:09 +0000 Message-ID: <20240109115310.1917139-1-caleb.connolly@linaro.org> X-Mailer: git-send-email 2.42.1 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 With the relatively new button API in U-Boot, it's now much easier to model the common usecase of mapping arbitrary actions to different buttons during boot - for example entering fastboot mode, setting some additional kernel cmdline arguments, or booting with a custom recovery ramdisk, to name a few. Historically, this functionality has been implemented in board code, making it fixed for a given U-Boot binary and requiring the code be duplicated and modified for every board. Implement a generic abstraction to run an arbitrary command during boot when a specific button is pressed. The button -> command mapping is configured via environment variables with the following format: button_cmd_N_name=