From patchwork Fri Jan 5 16:03:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 760226 Delivered-To: patch@linaro.org Received: by 2002:a5d:678d:0:b0:336:6142:bf13 with SMTP id v13csp113125wru; Fri, 5 Jan 2024 08:04:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IFeFGwVodQTLAizVcIHSKTt/dGT/LsBZdDDCLySsJYLmlahcx4c+/dRIORTVsxcaWMF2xrx X-Received: by 2002:a05:600c:5408:b0:40d:8397:e6eb with SMTP id he8-20020a05600c540800b0040d8397e6ebmr1316600wmb.101.1704470652997; Fri, 05 Jan 2024 08:04:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704470652; cv=none; d=google.com; s=arc-20160816; b=dMZEQBfuC+BAl89+SFoIOEbpUAl+fD6Hwd9MCtORjNDKvkNVhmfDIbkH85hJrpnWC/ sZC/wurrVuMsVnx9vFQKvRgQ39g8R9e3wIdnKckIU54LHMe3oOaocXoTwF73lWrTN4fk uSx3Yn/+0gWvJAD37yDdiZLNY6kIdA8aVUB/uereaQpSmAxMpBJClOnNj+XIG1ywY9Pm f+1EgHUvbbkpRyceJ9iD9eyRqW9PE6T3QsEMf8Piy5dV6A7qvbAZktO3vPpLMPRhWx/h b44p2tB3orNm9iFCwrUfYGy3g3yyY+vbnB4iyk2mkto3R/AdPcdrNm6Pxf1YQhQ3aenS ZiKw== 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=nh+g78OdcKB9P8k62/pfi3iJzyGRmniCRGTOIUXmHJY=; fh=h6Eq66jBrHEi9kuYHKAceTAlwuoqS+v2a4kYq7FIs+o=; b=Pw5XDqYsUo3OrP95Q/EA5OVMWZGWpikDgCFFU0lk4h5ZkmBe8pbLl9zAcycZK0XR0y mBDtUgdhfUr3pyy70CbtQwHcn7Y3wrUnYDUlj6q3S/0UqP5lwJORYeOX/jM8TWbN2dIs KStsQTwoTfAbYkWIv9UeGaf+Mur6TOPj2686BS97CkggndfrR/7SqOVA0LeJP5NC/8Iz k6oT7pn5szq/NfJRnKLQdGdtXoBdJatFxFwhek14i006biLVJyehBh2MMJ5B7iYUlGPg GOk/mpVBDm2lNKyJdrOhhyG9Nc9eegmVPYz+c8ZX+mxRw/P5P482V8Tw6TthuXr6dfFG +hkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kDHA3xtP; 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 r3-20020a05600c35c300b0040d88c91930si661746wmq.89.2024.01.05.08.04.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jan 2024 08:04:12 -0800 (PST) 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=kDHA3xtP; 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 2848C87646; Fri, 5 Jan 2024 17:04:10 +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="kDHA3xtP"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 11560877CD; Fri, 5 Jan 2024 17:04:07 +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-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) (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 78E418761C for ; Fri, 5 Jan 2024 17:04:04 +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-x332.google.com with SMTP id 5b1f17b1804b1-40e3a67ca9fso4039335e9.0 for ; Fri, 05 Jan 2024 08:04:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704470644; x=1705075444; 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=nh+g78OdcKB9P8k62/pfi3iJzyGRmniCRGTOIUXmHJY=; b=kDHA3xtPSTlVIqS59NnBWZx0e9zIrIBJlWmZq8s/e4jR2IWzaMsOm8s1flmtvnHpjY xr9fdR7goj/jSFxt5VRAHfGXn63szYWqmHJShvxsudm3SHA8pB90fiEXfHp2ksq+2stQ GcvLJO/HPZ9i/4YTXnw0mqeJG7OS02BLKlPVp6LnSrZu9n1ttyGpGDBZzWUbJETWxEZ/ eQkwrlGLxPylozQ+NiBOWdj9M6/chJoXpsYAojptxwjGjtDaXgxeXqzUKbdInQhhMXkZ GaISFHHHpLWKwfVtLpN8nCvnrcCDOSolTwFFge1dFy9cyRrl7X7ojgxVZEf+Mlm1HRke qFWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704470644; x=1705075444; 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=nh+g78OdcKB9P8k62/pfi3iJzyGRmniCRGTOIUXmHJY=; b=GPKfURBoQjIgO1VpTxbAODClsdTrAXB1oGXf4gdgX+UMt6kh4UZX7336oSYlvvhX1/ AZlsO8yEExK+QSjxUxDfKcpDp2cn1HSqYFudhn6jGJIlRb/vfSoOBQq0oF5LbCbFxXVt jYzBlEMoxprjB8L0GZGkusHWbgRSTCIL8qwqC/DXfVoxteHddn641BZP9UOQkcGIMbLE jJf/560hLZtkJA7eEBe5I7wg4C44NyxezLpua2vM1N9hpkFzzCEYJvC6ckjqwsVD9X3V pQETXW5BEFRMcIjbpRjJsNs1QUJLKZq5r8DP7MKDurKMVZN9RnWN58l+312CdjNmE6zK 7UZg== X-Gm-Message-State: AOJu0YygsHg0hOii0LRVV9dWuMeuRPsbcGc7W716IckMU+vHYEwjIKAA mIqbzbp36JTKNSNhXk1FgvNrAIUpPIRhrA== X-Received: by 2002:a05:600c:45cd:b0:40d:38ba:544e with SMTP id s13-20020a05600c45cd00b0040d38ba544emr1398819wmo.60.1704470643765; Fri, 05 Jan 2024 08:04:03 -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 m39-20020a05600c3b2700b0040d85a304desm1977372wms.35.2024.01.05.08.04.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jan 2024 08:04:03 -0800 (PST) From: Caleb Connolly To: Tom Rini , Simon Glass Cc: Sumit Garg , u-boot@lists.denx.de, Caleb Connolly Subject: [PATCH] boot: add support for button commands Date: Fri, 5 Jan 2024 16:03:58 +0000 Message-ID: <20240105160359.634310-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=