Received: by 2002:a05:7412:ba23:b0:fa:4c10:6cad with SMTP id jp35csp862737rdb; Fri, 19 Jan 2024 00:43:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IG1F4EK6+osnSnaBHrAZCpO7/8iHMijj5MSrRWUehr3clm57M5DQI8lSCHbd+2E/lr1vtAK X-Received: by 2002:a9d:630b:0:b0:6e0:d484:26aa with SMTP id q11-20020a9d630b000000b006e0d48426aamr2219469otk.19.1705653832376; Fri, 19 Jan 2024 00:43:52 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705653832; cv=pass; d=google.com; s=arc-20160816; b=qQkUT4T/vTm4efDWwg7A0PSfMQFS5G1hbtDsaqhY8iEsr+S8Ae0af8ogSMgOWPOZmw LUzu7jS5pxf2FTatEOpRYkmu7Ay1zzdvuu3ScxCnXuTNMprpgl3/gR8vL++ac1B09Ct1 vri5EgLO6gfSMP12AzqBGHWcTPjSrr7mT74PDZVD3rQHb+nOZeK03uEHh3pfPcOh8AFf H0fdX2/BrVZNo5sXpgk3lKY4u4AqSjDjVZoBxHzw5BOy8mUJcLVy5Je1yrCuBR/kG+nI g0K/UfvTk2bvBZaOfn4g3JygYd3KHOQgu5wf+/rObvAubb1DweBVAVr/xxfyiVOAPKHB 2Qwg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=V8Jw334gbtlpfyMf//A4Kl+X5QTyArqRPZ+OYE2aYXw=; fh=4k/hBd5bniHYlcfGRcGNASfaBL4ptGqyAdLkGSvHCDM=; b=RwrnRR9OtVxhaPXGoMns55qmX0VGFyvEnFKjFeDtlQxQivZEdH+4S9gGcuBHmi8btc WvuzORQAMtdN1xdPow3p0089/a5JphKMpVtT+PAtrtEJu5S4cgbRe1n6YMb3dPLhAVEk GrxxbqL0Tz+S6H84n86wFdzWyrKxxbSVx/SjjyXdo+pxN7Uvw0cCYwP8GneWHLwgwjog Rdio2bPftfbWHmjTcuKJZ9K5dY4AOydkWSgofsOiHiXEA5zQUPH1+7KiG21Qn7475QK2 9pku9R4M35hN8PRceK+HaBM6Mb2yWcrYYuqxLKLnye6erlY6oymKbR+RfMWzoP1jteeB tlWQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="JcgJmH/Z"; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-30919-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-30919-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id s5-20020a656445000000b005ceefb4435csi2795882pgv.438.2024.01.19.00.43.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jan 2024 00:43:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-30919-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="JcgJmH/Z"; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-30919-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-30919-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 51825B22D57 for ; Fri, 19 Jan 2024 08:43:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DF17F224F6; Fri, 19 Jan 2024 08:43:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="JcgJmH/Z" Received: from mail-lf1-f49.google.com (mail-lf1-f49.google.com [209.85.167.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 61DFEDDDC for ; Fri, 19 Jan 2024 08:43:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705653816; cv=none; b=bJSwAQP1lmZtr4l0xkAoriYypqwNCKgQfpx7iQoGfY8tLQJcDORqJWMOaV3OxAsVMr7j4rO6iw6xR84j/3Mta4Z4kcsNICMdBIlZXc1UPySs+6tRdd92Mvj/jvT4lsmyPvaDe0RGPDPKetbzvRhkCp6nLhrykRRTn1LM8AbDsvI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705653816; c=relaxed/simple; bh=PFKESGwT+52VOtSt0GyKDZV9D4/icQHM8Qc6/fiJ5to=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=l1kVm6Of54dbboZHDkowLzn943Ae1C0xeeBggZeOUFvfgKVJ2Pv1hn9B79IFJZ8YG/VeHwsUQzBc5yBXDEGXhgNmnABoI42CxrqrKwvr8dfzKI4GzTap5j/0nRHweKsYC3uVfopcQ9HG8GK7paTeMu55v2VlkJ62thGmmINbC9A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=JcgJmH/Z; arc=none smtp.client-ip=209.85.167.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-lf1-f49.google.com with SMTP id 2adb3069b0e04-50e5a9bcec9so571796e87.3 for ; Fri, 19 Jan 2024 00:43:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1705653813; x=1706258613; darn=vger.kernel.org; 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=V8Jw334gbtlpfyMf//A4Kl+X5QTyArqRPZ+OYE2aYXw=; b=JcgJmH/ZUamO5lf2vlfraUpon6jWYMC+N1GW7Wqev9THV1ATPjfMX+0FNsuvQLUcXs O0zJ3Rz/ZTh/2zY5iWTFq6dPCwRxhtXNnKIHy8bEvvz0u8WteetOcH1R41DcgxQq3OWX x0dYoetdVdBTg6sPDNdNv/r2x3jk6Ann70RZo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705653813; x=1706258613; 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=V8Jw334gbtlpfyMf//A4Kl+X5QTyArqRPZ+OYE2aYXw=; b=PgkeXA9UdDCbyd431dvBWCos1dmaGFvVVJPOPUj9X7LVXhNz4xROPA4T/2fFGpjlil HWAt1lHmEmCjoKmvnG5JY0TtHL4RaYXA2xXqaUnGHRrnhqB9fIm4S7cWc1/zo181qKur buDJezLp1WbQ4DB+/Uq7TOsSpG4sqOc5JRMqy6kDHsDRYl0I8l6GVoBc851NkJMgXKuk NnjdQTHXLsWFDVAmnRs/LBvqz2UvSuSucjZ/NfCWt2MF5AqzG7n7bFD9/6CXw3m0LWZs UtoZZHzHMlnDsNVSuW+QVagE4RSLlewz8bytu4Pgh6Qvz/lFC7NtFd5LTru1sQzXSPpc v7AA== X-Gm-Message-State: AOJu0YxuEE/xR2LpSYiPCW+Ex9/aSuHeKo2INtqnCucEkJVloYP79c8T MQhU1/J727H2zbtsbfWxPRz1z/EtA6+cbzNrMiTXyqwefDDTynEANrmJD0QmfA== X-Received: by 2002:ac2:464c:0:b0:50e:3479:3846 with SMTP id s12-20020ac2464c000000b0050e34793846mr474705lfo.68.1705653813409; Fri, 19 Jan 2024 00:43:33 -0800 (PST) Received: from cracow.c.googlers.com.com (138.58.228.35.bc.googleusercontent.com. [35.228.58.138]) by smtp.gmail.com with ESMTPSA id q23-20020ac246f7000000b0050e6aff6630sm905591lfo.152.2024.01.19.00.43.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jan 2024 00:43:33 -0800 (PST) From: Lukasz Majczak To: Gwendal Grignou , Tzung-Bi Shih , Radoslaw Biernacki , Wim Van Sebroeck , Lee Jones , Benson Leung , Guenter Roeck , Krzysztof Kozlowski , linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org, chrome-platform@lists.linux.dev Cc: Lukasz Majczak Subject: [PATCH v3 1/3] platform/chrome: Update binary interface for EC-based watchdog Date: Fri, 19 Jan 2024 08:43:25 +0000 Message-ID: <20240119084328.3135503-2-lma@chromium.org> X-Mailer: git-send-email 2.43.0.429.g432eaa2c6b-goog In-Reply-To: <20240119084328.3135503-1-lma@chromium.org> References: <20240119084328.3135503-1-lma@chromium.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Update structures and defines related to EC_CMD_HANG_DETECT to allow usage of new EC-based watchdog. Signed-off-by: Lukasz Majczak --- .../linux/platform_data/cros_ec_commands.h | 78 +++++++++---------- 1 file changed, 35 insertions(+), 43 deletions(-) diff --git a/include/linux/platform_data/cros_ec_commands.h b/include/linux/platform_data/cros_ec_commands.h index 7dae17b62a4d..ecc47d5fe239 100644 --- a/include/linux/platform_data/cros_ec_commands.h +++ b/include/linux/platform_data/cros_ec_commands.h @@ -3961,60 +3961,52 @@ struct ec_response_i2c_passthru { } __ec_align1; /*****************************************************************************/ -/* Power button hang detect */ - +/* AP hang detect */ #define EC_CMD_HANG_DETECT 0x009F -/* Reasons to start hang detection timer */ -/* Power button pressed */ -#define EC_HANG_START_ON_POWER_PRESS BIT(0) - -/* Lid closed */ -#define EC_HANG_START_ON_LID_CLOSE BIT(1) - - /* Lid opened */ -#define EC_HANG_START_ON_LID_OPEN BIT(2) - -/* Start of AP S3->S0 transition (booting or resuming from suspend) */ -#define EC_HANG_START_ON_RESUME BIT(3) - -/* Reasons to cancel hang detection */ +#define EC_HANG_DETECT_MIN_TIMEOUT 5 +#define EC_HANG_DETECT_MAX_TIMEOUT 65535 -/* Power button released */ -#define EC_HANG_STOP_ON_POWER_RELEASE BIT(8) +/* EC hang detect commands */ +enum ec_hang_detect_cmds { + /* Reload AP hang detect timer. */ + EC_HANG_DETECT_CMD_RELOAD = 0x0, -/* Any host command from AP received */ -#define EC_HANG_STOP_ON_HOST_COMMAND BIT(9) + /* Stop AP hang detect timer. */ + EC_HANG_DETECT_CMD_CANCEL = 0x1, -/* Stop on end of AP S0->S3 transition (suspending or shutting down) */ -#define EC_HANG_STOP_ON_SUSPEND BIT(10) + /* Configure watchdog with given reboot timeout and + * cancel currently running AP hang detect timer. + */ + EC_HANG_DETECT_CMD_SET_TIMEOUT = 0x2, -/* - * If this flag is set, all the other fields are ignored, and the hang detect - * timer is started. This provides the AP a way to start the hang timer - * without reconfiguring any of the other hang detect settings. Note that - * you must previously have configured the timeouts. - */ -#define EC_HANG_START_NOW BIT(30) + /* Get last hang status - whether the AP boot was clear or not */ + EC_HANG_DETECT_CMD_GET_STATUS = 0x3, -/* - * If this flag is set, all the other fields are ignored (including - * EC_HANG_START_NOW). This provides the AP a way to stop the hang timer - * without reconfiguring any of the other hang detect settings. - */ -#define EC_HANG_STOP_NOW BIT(31) + /* Clear last hang status. Called when AP is rebooting/shutting down + * gracefully. + */ + EC_HANG_DETECT_CMD_CLEAR_STATUS = 0x4 +}; struct ec_params_hang_detect { - /* Flags; see EC_HANG_* */ - uint32_t flags; - - /* Timeout in msec before generating host event, if enabled */ - uint16_t host_event_timeout_msec; + uint16_t command; /* enum ec_hang_detect_cmds */ + /* Timeout in seconds before generating reboot */ + uint16_t reboot_timeout_sec; +} __ec_align2; - /* Timeout in msec before generating warm reboot, if enabled */ - uint16_t warm_reboot_timeout_msec; -} __ec_align4; +/* Status codes that describe whether AP has boot normally or the hang has been + * detected and EC has reset AP + */ +enum ec_hang_detect_status { + EC_HANG_DETECT_AP_BOOT_NORMAL = 0x0, + EC_HANG_DETECT_AP_BOOT_EC_WDT = 0x1, + EC_HANG_DETECT_AP_BOOT_COUNT, +}; +struct ec_response_hang_detect { + uint8_t status; /* enum ec_hang_detect_status */ +} __ec_align1; /*****************************************************************************/ /* Commands for battery charging */ -- 2.43.0.429.g432eaa2c6b-goog