From patchwork Fri Oct 4 12:07:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: POPESCU Catalin X-Patchwork-Id: 13822213 Received: from EUR03-VI1-obe.outbound.protection.outlook.com (mail-vi1eur03on2087.outbound.protection.outlook.com [40.107.103.87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9EA951FAA; Fri, 4 Oct 2024 12:07:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.103.87 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728043669; cv=fail; b=vEEih9bK2vMvmYiVZi8o/h7uBjgQSjPYvCpf7fKe4POtLfDvcLlOoKA0xJjS8JbWa5VzuLY0oKK9x4MslqUhLKHZP3mAenjeNbOFJUBQB1f1Gi7Ny0e/ndsNEwTyidfn4B5q9Wf9mjtleFOSduB0ti2BUVptqao4Y7KvCfrcvMk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728043669; c=relaxed/simple; bh=zA+8xOj5XpFM2Wvn2mGYoAxCBw2Xptl3UhwUdidTQlA=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version:Content-Type; b=EKlibjlxHvaeSN3RK+dpJA8RodSB0LY5JG6+X5ZXVGGX2M6ZDpgG8wZfM5mz1m8AdBgeQqWTQRhQ+lvO89Kl+VrgavjiMAPoy9OEACrwTDxxteAiaAsn1bPJQkzKZ1b85iWaw+UAPt5oE7ZhnDuFQ0qtnSQWOQx9xx0vHtRL6cc= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=leica-geosystems.com; spf=fail smtp.mailfrom=leica-geosystems.com; dkim=pass (1024-bit key) header.d=leica-geosystems.com header.i=@leica-geosystems.com header.b=ifc5V/sA; arc=fail smtp.client-ip=40.107.103.87 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=leica-geosystems.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=leica-geosystems.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=leica-geosystems.com header.i=@leica-geosystems.com header.b="ifc5V/sA" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=o/8EcFVSICFSX4jSKSyCJvj3/pvFQ4eVZwy5D/L5V2OzLIfoTmRNDjSG02h6EOlfeiI9ahg+deSgoA8Lrg3ZIrCoW/6AXuBwiY2zicQXFnidpHB361NKsiF2tMjZ/LIKs+cFZCb89V5qQ8T8JrpFUF0/nmAqCyQAAKpFzgqFPTPLyGjY8mz0n2yUHWJnDdrDR/tDVETCYc5s/I+rfP4EZAA5krEEAsY5mAzvtjkWfu+o0p3Ql4OQsAAVxlxLW0U+b4GK0YWeKF7NDiaBGlgoOoOdjSrf+3qsz7Rrojt4/ZPAXoEUFWjsUdYJM2U7czBQQ4xSLjIQf5qX6msva4b9fw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=NCUWttN/BnOXjnZLtlhpD54NykMZK0LnB4i37A0SyQk=; b=uiNzq2Gi/9wM4oCrfE1iXfemUkG3Di8SOcj7upe9ZouP8uuWOeM+BQWQH6BkZqJA/7ZmcJsId1+YsFzy4jBmrapvW6soHSuhZUP6lmA5im4HlyYM9noS6vryT/aZsS17WVhDRg+ecBOI6OTpncN9zHl6QqaxuJj0YIvxGv6jImEkis6rrkH5Rq4qceBkHTntmoxZzEnXir3M7nET4o6Ob0Ycytl/PEfeqU8kWDVfpPG/XmgQ1y73bjNeM9Qt6gP02yjyzGto7tMXTigkcTaBemSy4z9lfKAYGn1MBmtPBXAg+o5fOCKD9RtgDlGI16BGZotd/pLrpbgqxYaHZTtijQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 193.8.40.94) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=leica-geosystems.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=leica-geosystems.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leica-geosystems.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NCUWttN/BnOXjnZLtlhpD54NykMZK0LnB4i37A0SyQk=; b=ifc5V/sAJqFTAOIw4X+NXlwR/5vTIxjraks+S9GFfsltRl9NEVacSVdIj9NEDlXMavo897Cfp2t4ucwvZOF5/aHTeh4kAOWrqdHgVKc5kGPZvwJzL3GslMQhdFqHLVg8uyq/eyvP137pj0fd3Qobt3sTu5FiZHsqxK0EZGRBqAo= Received: from AS4P191CA0030.EURP191.PROD.OUTLOOK.COM (2603:10a6:20b:5d9::16) by GVXPR06MB9226.eurprd06.prod.outlook.com (2603:10a6:150:1b7::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.18; Fri, 4 Oct 2024 12:07:42 +0000 Received: from AM4PEPF00027A5D.eurprd04.prod.outlook.com (2603:10a6:20b:5d9:cafe::2c) by AS4P191CA0030.outlook.office365.com (2603:10a6:20b:5d9::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.18 via Frontend Transport; Fri, 4 Oct 2024 12:07:42 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 193.8.40.94) smtp.mailfrom=leica-geosystems.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=leica-geosystems.com; Received-SPF: Pass (protection.outlook.com: domain of leica-geosystems.com designates 193.8.40.94 as permitted sender) receiver=protection.outlook.com; client-ip=193.8.40.94; helo=hexagon.com; pr=C Received: from hexagon.com (193.8.40.94) by AM4PEPF00027A5D.mail.protection.outlook.com (10.167.16.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.11 via Frontend Transport; Fri, 4 Oct 2024 12:07:42 +0000 Received: from aherlnxbspsrv01.lgs-net.com ([10.60.34.116]) by hexagon.com with Microsoft SMTPSVC(10.0.17763.1697); Fri, 4 Oct 2024 14:07:42 +0200 From: Catalin Popescu To: ulf.hansson@linaro.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, p.zabel@pengutronix.de Cc: linux-mmc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, m.felsch@pengutronix.de, bsp-development.geo@leica-geosystems.com, Catalin Popescu Subject: [PATCH 1/2] dt-bindings: mmc: mmc-pwrseq-simple: add support for reset control Date: Fri, 4 Oct 2024 14:07:39 +0200 Message-Id: <20241004120740.2887776-1-catalin.popescu@leica-geosystems.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-mmc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-OriginalArrivalTime: 04 Oct 2024 12:07:42.0411 (UTC) FILETIME=[03C9B1B0:01DB1656] X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM4PEPF00027A5D:EE_|GVXPR06MB9226:EE_ X-MS-Office365-Filtering-Correlation-Id: d854b761-5f60-48de-de58-08dce46d2666 X-SET-LOWER-SCL-SCANNER: YES X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|376014|82310400026|1800799024; X-Microsoft-Antispam-Message-Info: TjLXER6F2Hwl5ThEbhTctIgBJbbj5FZcO+zoQynxQyYN7yhg+oFTw2LVvTRO4UdUrUAUFVI+ihldHOHGY/Jab0lUGPTL/hqmMbqvpJWxNNWjY/trlMy1NaAJd9PUuGwPE3gh+0IkvS3BOYLemv4P9DtaEwAUCuMFRKRy8zVFBDsh2tcxKn7kBrYHqBrHMfbJmK8uYJyCHQweFWKkRS7FlftQ/tNTgFk/ZMrDtTeOECYEtmHXU0ZcURs/jJ9aMqMbgf96apOQHY5Lsp1CyiBW5rO1xh/0YxcVNHz/Mtb7D7YNjg9riMngZzXMMPXWUpUzpb5L1drhqiSPGA4UnFrPcDrD2DXMDSiXHFXj/XflYv7HZW+PCTEp56Y0yWqqcx+oAz+fLZvyWI8KC7WaycKBdIbhyMkevTJ/UqgCxSwqYx/CImK3QxbtlSl/FoYXbVTkw+qUOJWTdE6WZpGFnLGazLtUCZHmkw3pNlOxTi2zyQ4KGqC77fjNlv2INBW+ejAjWBAnH0cmRv3dAx3WGBA323JhzbKKJg/IngKSX3ZQGslAX+iBtZZDMu4YlFWNlNcwgq3jWHP28NbS3r7qWAPXVTdaqJdweUMgKeEMTMC5n80r08w71M0ZmqeqOBBbFI9FGmIU11dQRNPxtyHlXo4V1ono93tX5GuwpsY1vhq2S/7GulYmuW2WETDlbCkDef1sLpUBx1UTuuDGwcr/8ajX54Fsp7y8/pAYKs7a7nW8Cm+fekstA1OyMKX70099s2qF9gB23lDuWli59HrpUzNgxzT8NcVeawXqusxEEH1feAMPtKBJSaXNcnAASE+y5Oix++ahWCnh7FXFoWa+0cJSMhRz4H2uhgKFgtEDMsNnUjQApSkqIDK/Df5+LCUAW0/3els8NtKpDKBbqhvEACt+eZDT0xJVlgFKzoPpq64PN2lf2cy4HH9LAWE5N9p6MWBzgI+sDdxJdSREIkJYuAAzviVAqqogXP8f7+Nv0Yszf65oLKyaFva2oNnKNHP7Fbvn612lxBrDYVG7mmw2wE3EoDZU0ON3mhY8zzEdBTdP8IhAVxrIopO/muepJrI0bTXWNO9VB1IBWDgyvEoUp3TRnJYagcPjgZAQ9V4H9CKASasf6Hg4iCazHUwo5iachRHwY3ZdXITEjN3c2ZwNGiZZWM+0oUX5LrpMutUuSyGSc0oWgKxaGE0nv6ENZqc+MnM8ilExmID9ixqN++ODgyq0WOaCpWMMdqq8dDfoi0ZBHvv3dlKhNfYprthTMmKemTTY8C/uT2W9QOi/BOgl7VSHSzCyRymkOULiH4PkAb3VC3QfHGoSOgtJAz25X4HgTzANwskFIaAKeGC7xgfFzZ5van2wlQjF0iF8gK8uHo9A1owTfcMm2NzdglxcX+pvSLpT X-Forefront-Antispam-Report: CIP:193.8.40.94;CTRY:CH;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:hexagon.com;PTR:ahersrvdom50.leica-geosystems.com;CAT:NONE;SFS:(13230040)(36860700013)(376014)(82310400026)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: leica-geosystems.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Oct 2024 12:07:42.5674 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d854b761-5f60-48de-de58-08dce46d2666 X-MS-Exchange-CrossTenant-Id: 1b16ab3e-b8f6-4fe3-9f3e-2db7fe549f6a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=1b16ab3e-b8f6-4fe3-9f3e-2db7fe549f6a;Ip=[193.8.40.94];Helo=[hexagon.com] X-MS-Exchange-CrossTenant-AuthSource: AM4PEPF00027A5D.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: GVXPR06MB9226 Add compatible value "mmc-pwrseq-simple-reset" to support reset control instead of gpios. Reset controls being refcounted, they allow to use shared resets or gpios across drivers. Support of reset control is limited to one single reset control. Signed-off-by: Catalin Popescu --- .../bindings/mmc/mmc-pwrseq-simple.yaml | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/mmc/mmc-pwrseq-simple.yaml b/Documentation/devicetree/bindings/mmc/mmc-pwrseq-simple.yaml index 00feaafc1063..da218260af01 100644 --- a/Documentation/devicetree/bindings/mmc/mmc-pwrseq-simple.yaml +++ b/Documentation/devicetree/bindings/mmc/mmc-pwrseq-simple.yaml @@ -16,12 +16,13 @@ description: properties: compatible: - const: mmc-pwrseq-simple + enum: + - mmc-pwrseq-simple + - mmc-pwrseq-simple-reset reset-gpios: minItems: 1 # Put some limit to avoid false warnings - maxItems: 32 description: contains a list of GPIO specifiers. The reset GPIOs are asserted at initialization and prior we start the power up procedure of the card. @@ -50,6 +51,22 @@ properties: required: - compatible +allOf: + - if: + properties: + compatible: + contains: + enum: + - mmc-pwrseq-simple-reset + then: + properties: + reset-gpios: + maxItems: 1 + else: + properties: + reset-gpios: + maxItems: 32 + additionalProperties: false examples: From patchwork Fri Oct 4 12:07:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: POPESCU Catalin X-Patchwork-Id: 13822214 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2089.outbound.protection.outlook.com [40.107.21.89]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E3E1815A849; Fri, 4 Oct 2024 12:07:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.21.89 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728043669; cv=fail; b=JmjIYxZRinKpD1OhLv3Z5LuSBSZBCdf84H8+H9aWslCqH3N/0hrGw4dOKWzQ58ngvZ5CC6X2kdc+xysVHpyubB0IaJlwIZBfGgDVQRqIr03I7UkhBnturAkYG5mzL/oLgdnpH9LHbBz31JAk2E2t2I0khYkaynT0v/nMTQuZZ0o= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728043669; c=relaxed/simple; bh=Moj2Oip1PQ8rXBx6SMLlr9zeA7XcM5ORv26+rf/qDvI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=iMlgtHv7LKht/Nze09uAcQi/46wtEgNWJMCDbHts3yHfHNxkHbGm1Y90CNKv/gUYwYuoMwsLsLZSwJpyNoF7HGAcjnwUEUTl9/tIh1maE23eiDGzeYNMfG+HNgISNcloIgvR2wDXItxvKBrS194z6nTD+HeYJxm/AP9vqG7abuM= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=leica-geosystems.com; spf=fail smtp.mailfrom=leica-geosystems.com; dkim=pass (1024-bit key) header.d=leica-geosystems.com header.i=@leica-geosystems.com header.b=uwOYQ/kB; arc=fail smtp.client-ip=40.107.21.89 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=leica-geosystems.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=leica-geosystems.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=leica-geosystems.com header.i=@leica-geosystems.com header.b="uwOYQ/kB" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=YuiYFquqEFUjpO7um3uPhZuJxYb+DTHsoCKCdtG8DbPfWY4BqrWOqfEfuy1ng+8gvGYhqV0P0D/3OxnRJipZlg9Np+0usIosyInOYhQUJnUzVZAvWB1ZEnRdgjWN3npO0YYJDCpzNgMR+LBGSDCiHWGu0IoY68oU/Rw2slC/HAHTY9T/1ZUZPWAnyoLaSyY1OA0tISnh6SGLfgtWNiYPURd0qZ8Wo1ZANzZsEdpeqoU4R0X7Uo6c4RAEICDhN9lAK8ePff/gX8fOmEbroCuQlPh4x+c3XbPRA87S0M90Y4cXAaeZQQLk31h1I3VI0mYeZyGdRK1NsXNXrmVfrTxX3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=RtinHPJCX0Ghf1AHtH9ixH1p5qJwB7vMIjeRtYao5fY=; b=eTv/AHn1+ka4EPNmz/SMm2vY2EUa34dpo6XXUMIzOabxyeTn7EGHC3Qyu+ffP96iG7iZ0/UKriGpXpYXMYwLKj8lRWn29vSz4MdELa66h7ikN0NCvno1iK6tOysCvWN9mDIpEuwTBMTJ1Av7cd99U/Z+RdNytPtUKrYHwwvbJKrWAcydJ1Qd0YwTBM/0haDFuj7yhZr3GAY4T9O7hf7E6zOqH1CSPPAkprv3myV61ul6hUVsNCl4/fXgY/uNreRQgCx1CgbnDkXrtwAZuNGBn1spF17HPuQJ7kT141LNP/F9/ZG1zeJRd7KEQhFPgmOm4COFcKfX5Ar6gEGWhj2TWA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 193.8.40.94) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=leica-geosystems.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=leica-geosystems.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leica-geosystems.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RtinHPJCX0Ghf1AHtH9ixH1p5qJwB7vMIjeRtYao5fY=; b=uwOYQ/kBFObaE8KzggIfSVK9fr6RfPG++slp667SOdbvavfLgBfutzTuxCMKrq+4MM5XXdR+bF91jUfJcTx0GxpKpKoIEBdLlKMovxdioRdgDG8v5SKuoaY9fTChxBFP4gOqOmJo5++mRO920IOmrPvakJajwX4JYJCtx4C+8As= Received: from AS4P191CA0026.EURP191.PROD.OUTLOOK.COM (2603:10a6:20b:5d9::17) by PAXPR06MB7775.eurprd06.prod.outlook.com (2603:10a6:102:157::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.27; Fri, 4 Oct 2024 12:07:43 +0000 Received: from AM4PEPF00027A5D.eurprd04.prod.outlook.com (2603:10a6:20b:5d9:cafe::88) by AS4P191CA0026.outlook.office365.com (2603:10a6:20b:5d9::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.18 via Frontend Transport; Fri, 4 Oct 2024 12:07:43 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 193.8.40.94) smtp.mailfrom=leica-geosystems.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=leica-geosystems.com; Received-SPF: Pass (protection.outlook.com: domain of leica-geosystems.com designates 193.8.40.94 as permitted sender) receiver=protection.outlook.com; client-ip=193.8.40.94; helo=hexagon.com; pr=C Received: from hexagon.com (193.8.40.94) by AM4PEPF00027A5D.mail.protection.outlook.com (10.167.16.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.11 via Frontend Transport; Fri, 4 Oct 2024 12:07:43 +0000 Received: from aherlnxbspsrv01.lgs-net.com ([10.60.34.116]) by hexagon.com with Microsoft SMTPSVC(10.0.17763.1697); Fri, 4 Oct 2024 14:07:43 +0200 From: Catalin Popescu To: ulf.hansson@linaro.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, p.zabel@pengutronix.de Cc: linux-mmc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, m.felsch@pengutronix.de, bsp-development.geo@leica-geosystems.com, Catalin Popescu Subject: [PATCH 2/2] mmc: pwrseq_simple: add support for reset control Date: Fri, 4 Oct 2024 14:07:40 +0200 Message-Id: <20241004120740.2887776-2-catalin.popescu@leica-geosystems.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241004120740.2887776-1-catalin.popescu@leica-geosystems.com> References: <20241004120740.2887776-1-catalin.popescu@leica-geosystems.com> Precedence: bulk X-Mailing-List: linux-mmc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-OriginalArrivalTime: 04 Oct 2024 12:07:43.0067 (UTC) FILETIME=[042DCAB0:01DB1656] X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM4PEPF00027A5D:EE_|PAXPR06MB7775:EE_ X-MS-Office365-Filtering-Correlation-Id: 02af0b58-1fdb-4f5f-d8f0-08dce46d26e2 X-SET-LOWER-SCL-SCANNER: YES X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: K3jhXyyr/8nt94IoGhplXWgCb0EzvLd5iWA7/ESC6/KnqgD8uNKXe8/7ekSV+wKubzYc0zsSRRaps0M9/BaQIcGwNIpXEOH2ONv2RxhacBTWk/GftB4kljEfpi9p6HzZn6iY9gb+4tIcFozEoW2Niwb+rIDbLFoKfrZnk4jI5WMppYSxf5B601WHsbpPjfPg5yMdK598ZgF+rqcPB0TxQ4AI+0+fgR1XWLRlLcOBFF5k4+H6ilIamrJgXqe+5PeZOAvUYEDd34imKPB+hfcMTuk4p2n+Nnjs+EzZxTis7H0stJ4643nmqJ6170H7eQWvBhfTHdXgRWqam0lcBC7RwAHpIyUulSEMSfyMsnNtZnAVbrwtGMS5LOXFIaBsFfhTa8oij2XZg/HCv4jx0jlOPA31KnCnPQGcDqJz19MmLg6r1GobYEiI04Pe32zgDUn66HgiKMYqu0xvieuQHvKVfSxrvPrPeySbt066ybShVhe6lEuNd7jDrsPZ3owU4c1NpFRktVTT+1AKwtDPv6TENv7H4JlTixstQJJXwUJU565Wa0WHdZ6V9w5zqFb9XE7pCJtKJ/KRXHu/MgxznSmHmB93tl0GtVrH3hlUpJtnNT3P7xp//6rKtYWZ6C4wQGBvYlodgjXrg+5D2qfNM6yK65v0jrAGJnCA77yyNWpRizIGN378Mr7LAyuNokKRRJ58qtKcNeRVGaiv6O6dLAFWkRz7FTPLmNtV3skkGnSVcGolg8ih4Xi+Omxsm+5OL/WUu/iKQCYjc5cd+ozUMfDDRz+zYxL7qbCA/IlQAaLChvfqVCQZtChz2d9Pv7i8xmDem8LHHDHOzIQlNcw6ecINxNN4T+k4FrMBwbuuRpZs+2i2HDEnd1UM3Y9iYPSkVIF7Yvwg2oS7bw8LOcSo01M5CnwAM+MXyVfa2YNgbjINpMjSjcC8NA4Kb2XC21m7ybJdwMhuI6mIkNHhRJquUPlywkNbsxx+EgfeUMBPIfx5uxSMrn1T6O8zDqVSx3+5i/qC4PThrC5HvDxlQzBgFWtSBC20nyXKvY0eJ48daMfBwehL3pB01e6mdWwCweYMb2yglyLZE2jr4eLhusc6K7fShBid44eRouTqAumg4RuIIfKrWa74465ygvNJojRKxO1A/bNMJ5CxiTGer3WLigYw4uMSyHQ+FUJz5saIwitz65VlOsj1d8npu8WPj1wm0f15n4QceswZde/rL8Eysa2Kl6veLtORiaZMt/phDgUKZVeANZcDWSVlQuOndS3qedgqhGduwaFZrHdQxWRZmD2tuEcBrpD3oN4FvXsoBqZOpT6I02c3ZI+WEJDGGbQcyuw6/M6F/njlEgUzQ/waAHsemrWpUMwqgVqmY2VsWs4VCZ56VdrqK+LDtNTWh+Ij+6/b X-Forefront-Antispam-Report: CIP:193.8.40.94;CTRY:CH;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:hexagon.com;PTR:ahersrvdom50.leica-geosystems.com;CAT:NONE;SFS:(13230040)(376014)(1800799024)(36860700013)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: leica-geosystems.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Oct 2024 12:07:43.3799 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 02af0b58-1fdb-4f5f-d8f0-08dce46d26e2 X-MS-Exchange-CrossTenant-Id: 1b16ab3e-b8f6-4fe3-9f3e-2db7fe549f6a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=1b16ab3e-b8f6-4fe3-9f3e-2db7fe549f6a;Ip=[193.8.40.94];Helo=[hexagon.com] X-MS-Exchange-CrossTenant-AuthSource: AM4PEPF00027A5D.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR06MB7775 Reset controls are refcounted and as such allows to use shared resets or gpios across drivers. Add support for reset control while keeping in place the support for gpios. Use compatible string to choose between reset control ("mmc-pwrseq-simple-reset") and reset gpios ("mmc-pwrseq-simple"). Only one reset control is supported. Signed-off-by: Catalin Popescu --- drivers/mmc/core/pwrseq_simple.c | 58 ++++++++++++++++++++++++++------ 1 file changed, 48 insertions(+), 10 deletions(-) diff --git a/drivers/mmc/core/pwrseq_simple.c b/drivers/mmc/core/pwrseq_simple.c index 9e016b0746f5..6495b97d48d9 100644 --- a/drivers/mmc/core/pwrseq_simple.c +++ b/drivers/mmc/core/pwrseq_simple.c @@ -17,11 +17,17 @@ #include #include #include +#include +#include #include #include "pwrseq.h" +struct mmc_pwrseq_simple_data { + bool use_reset; +}; + struct mmc_pwrseq_simple { struct mmc_pwrseq pwrseq; bool clk_enabled; @@ -29,6 +35,8 @@ struct mmc_pwrseq_simple { u32 power_off_delay_us; struct clk *ext_clk; struct gpio_descs *reset_gpios; + struct reset_control *reset_ctrl; + const struct mmc_pwrseq_simple_data *data; }; #define to_pwrseq_simple(p) container_of(p, struct mmc_pwrseq_simple, pwrseq) @@ -67,14 +75,21 @@ static void mmc_pwrseq_simple_pre_power_on(struct mmc_host *host) pwrseq->clk_enabled = true; } - mmc_pwrseq_simple_set_gpios_value(pwrseq, 1); + if (pwrseq->data->use_reset) { + reset_control_deassert(pwrseq->reset_ctrl); + reset_control_assert(pwrseq->reset_ctrl); + } else + mmc_pwrseq_simple_set_gpios_value(pwrseq, 1); } static void mmc_pwrseq_simple_post_power_on(struct mmc_host *host) { struct mmc_pwrseq_simple *pwrseq = to_pwrseq_simple(host->pwrseq); - mmc_pwrseq_simple_set_gpios_value(pwrseq, 0); + if (pwrseq->data->use_reset) + reset_control_deassert(pwrseq->reset_ctrl); + else + mmc_pwrseq_simple_set_gpios_value(pwrseq, 0); if (pwrseq->post_power_on_delay_ms) msleep(pwrseq->post_power_on_delay_ms); @@ -84,7 +99,10 @@ static void mmc_pwrseq_simple_power_off(struct mmc_host *host) { struct mmc_pwrseq_simple *pwrseq = to_pwrseq_simple(host->pwrseq); - mmc_pwrseq_simple_set_gpios_value(pwrseq, 1); + if (pwrseq->data->use_reset) + reset_control_assert(pwrseq->reset_ctrl); + else + mmc_pwrseq_simple_set_gpios_value(pwrseq, 1); if (pwrseq->power_off_delay_us) usleep_range(pwrseq->power_off_delay_us, @@ -102,8 +120,17 @@ static const struct mmc_pwrseq_ops mmc_pwrseq_simple_ops = { .power_off = mmc_pwrseq_simple_power_off, }; +struct mmc_pwrseq_simple_data mmc_pwrseq_simple_gpio = { + .use_reset = false, +}; + +struct mmc_pwrseq_simple_data mmc_pwrseq_simple_reset = { + .use_reset = true, +}; + static const struct of_device_id mmc_pwrseq_simple_of_match[] = { - { .compatible = "mmc-pwrseq-simple",}, + { .compatible = "mmc-pwrseq-simple", .data = &mmc_pwrseq_simple_gpio }, + { .compatible = "mmc-pwrseq-simple-reset", .data = &mmc_pwrseq_simple_reset }, {/* sentinel */}, }; MODULE_DEVICE_TABLE(of, mmc_pwrseq_simple_of_match); @@ -121,12 +148,23 @@ static int mmc_pwrseq_simple_probe(struct platform_device *pdev) if (IS_ERR(pwrseq->ext_clk) && PTR_ERR(pwrseq->ext_clk) != -ENOENT) return dev_err_probe(dev, PTR_ERR(pwrseq->ext_clk), "external clock not ready\n"); - pwrseq->reset_gpios = devm_gpiod_get_array(dev, "reset", - GPIOD_OUT_HIGH); - if (IS_ERR(pwrseq->reset_gpios) && - PTR_ERR(pwrseq->reset_gpios) != -ENOENT && - PTR_ERR(pwrseq->reset_gpios) != -ENOSYS) { - return dev_err_probe(dev, PTR_ERR(pwrseq->reset_gpios), "reset GPIOs not ready\n"); + pwrseq->data = of_device_get_match_data(dev); + if (!pwrseq->data) + return -EINVAL; + + if (pwrseq->data->use_reset) { + pwrseq->reset_ctrl = devm_reset_control_get_optional_shared(dev, NULL); + if (IS_ERR(pwrseq->reset_ctrl)) + return dev_err_probe(dev, PTR_ERR(pwrseq->reset_ctrl), + "reset controls not ready\n"); + } else { + pwrseq->reset_gpios = devm_gpiod_get_array(dev, "reset", GPIOD_OUT_HIGH); + if (IS_ERR(pwrseq->reset_gpios) && + PTR_ERR(pwrseq->reset_gpios) != -ENOENT && + PTR_ERR(pwrseq->reset_gpios) != -ENOSYS) { + return dev_err_probe(dev, PTR_ERR(pwrseq->reset_gpios), + "reset GPIOs not ready\n"); + } } device_property_read_u32(dev, "post-power-on-delay-ms",