From patchwork Thu Aug 22 22:01:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kyle Swenson X-Patchwork-Id: 13774262 X-Patchwork-Delegate: kuba@kernel.org Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02on2074.outbound.protection.outlook.com [40.107.249.74]) (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 C608F1D1F50; Thu, 22 Aug 2024 22:01:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.249.74 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724364087; cv=fail; b=aijsCcrEwyaowcHC3OdY8uPzrD9VWR6Zi+ldZuDEH/an95RDsb8LxnZhpQUWWj6OpYIZGJ6fYeW97AFYJSv+TZxOHCPCrFZwynKBz2q6crko0XAmVB1f/hLmCaPMZLCpuNfsz3DiJJvtHRv3xLMl9pDQ5X6A7BrpochbRtUgcRM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724364087; c=relaxed/simple; bh=xLbJpuX9HhNR0ZV7nGzIbn+qa8rhRWpmZ/L+/G5WYUg=; h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To: Content-Type:MIME-Version; b=V03nZvHPeBFkcJRZ0xNihKgxNyStbWwePKcXOIqRxPl4016TN48Rr5s9xRK3gz/G/gJvHSsrwTQZE2d3uZ7T4iReBxO8UbR7PUySb+/xbLAvV5D2EtcGjcgJucvQZWFYnjGdFcaf1fwFlm7gjhGnL8Ikwof6GkgLzL08eVT+gfg= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=est.tech; spf=pass smtp.mailfrom=est.tech; dkim=pass (1024-bit key) header.d=est.tech header.i=@est.tech header.b=ayQA1A7j; arc=fail smtp.client-ip=40.107.249.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=est.tech Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=est.tech Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=est.tech header.i=@est.tech header.b="ayQA1A7j" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=wS0wLU4S35gjUNc4Ad8rTW3NOc5L8KvuFWv8DUERg317HC1mz/VcsIGRlyGXdJFKLqVYWB/3tl6UxXQeEeHV8GMtXbHEt+QpVHavmJQRC+ZXpqNpB5kYPpgN8cEHBMAcnTaat9zeesKTKAe2kOB8tj3+aPsZMl05dyb+VHuMsA78vWINV2ecHkshW2BIh/dH0atJjZkOYcmWgH0pUnfZQWSjLgiaDv3aot0SxlJps5wOdwUpBD6M3hBE1eD0DxpbHsO8iYX8sl7dcCc6nfEnVcNjOwbvyW1ZVz1HhtgbsaVmiMPosdQbDw7NUqx4RV5ftaA8mOWXRzTXZF+aMNyP0w== 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=M1+c90ViFgnoHYXSMmljfEgNQKRL7U0g9sqAaPhSrrc=; b=Ia1OZqcQByxkrH5nr2thWr4QESO1fEfMQ4kPdHPGXm2oOg6FPavTprpVNScwn8K9yRKfX357NdtonJaXglLu7c7e2zZ/fHpH16aV2/vsFe2DOh9yA21HO9HwJyz5Wj//S6jutwYSBecbBzFK7LUDNQkDKwMsydAVxTaIG/ZOCg0Og3KvZ7upnj257QuF8XvQn/9+1Gmyui1tSjE+gNSqgYyI+66CjeoFyIZb2bsMwvdzOg0Iss2Yp2c/W8FeaLKNYnFBPshcZKfHa/KEy2Eh+es/7JKeGMNSb+jax9Qv4K9a5kuBM9fBkX6NBUDtILyJTbhpe07rp9Rzgp/cxBrz7A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=est.tech; dmarc=pass action=none header.from=est.tech; dkim=pass header.d=est.tech; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=est.tech; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=M1+c90ViFgnoHYXSMmljfEgNQKRL7U0g9sqAaPhSrrc=; b=ayQA1A7jihzevWY7lWzsmqAcotYZOUITgYqZXVvo9vxYaxPKdSGI62Ki0rhzpcvu3aysGzpLgYJa193DpUOygFmk2J/msZ1gdf6AMTQKqgVHfmy987LKWbHG/n5EcZBCET66zgrd62euXDmoxvCgpsnnLhKCX4Mpv0H56bYOPeA= Received: from AM7P189MB0807.EURP189.PROD.OUTLOOK.COM (2603:10a6:20b:115::19) by PRAP189MB1828.EURP189.PROD.OUTLOOK.COM (2603:10a6:102:27a::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.21; Thu, 22 Aug 2024 22:01:22 +0000 Received: from AM7P189MB0807.EURP189.PROD.OUTLOOK.COM ([fe80::53cd:a2f6:34be:7dab]) by AM7P189MB0807.EURP189.PROD.OUTLOOK.COM ([fe80::53cd:a2f6:34be:7dab%6]) with mapi id 15.20.7897.014; Thu, 22 Aug 2024 22:01:22 +0000 From: Kyle Swenson To: "o.rempel@pengutronix.de" , "kory.maincent@bootlin.com" , "davem@davemloft.net" , "edumazet@google.com" , "kuba@kernel.org" , "pabeni@redhat.com" CC: "robh@kernel.org" , "krzk+dt@kernel.org" , "conor+dt@kernel.org" , "thomas.petazzoni@bootlin.com" , Kyle Swenson , "netdev@vger.kernel.org" , "devicetree@vger.kernel.org" Subject: [PATCH net-next v2 2/2] net: pse-pd: tps23881: Support reset-gpios Thread-Topic: [PATCH net-next v2 2/2] net: pse-pd: tps23881: Support reset-gpios Thread-Index: AQHa9N7ToI4XRfgfPE60nFrdlScw3w== Date: Thu, 22 Aug 2024 22:01:22 +0000 Message-ID: <20240822220100.3030184-3-kyle.swenson@est.tech> References: <20240822220100.3030184-1-kyle.swenson@est.tech> In-Reply-To: <20240822220100.3030184-1-kyle.swenson@est.tech> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=est.tech; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: AM7P189MB0807:EE_|PRAP189MB1828:EE_ x-ms-office365-filtering-correlation-id: 5b9cdd57-2629-4e03-be97-08dcc2f5f593 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0;ARA:13230040|1800799024|7416014|376014|366016|38070700018; x-microsoft-antispam-message-info: =?iso-8859-1?q?cSfKsSVSLTnbc+HPT56z0xyKTX?= =?iso-8859-1?q?4dpyK/YY4dZGb0YqnjaAzyu3OQo8cBEP6cfLU57oA37LuQN944wbz5rAELpD?= =?iso-8859-1?q?rcarLsTZYOzjqjJ39AWbv4SaqtP5AMXS3XLm4TRtsomkRHpxHZ1BN7lZ9yVu?= =?iso-8859-1?q?qjHUjv5ZH0y99yylPe/niGdKiWBjzE2l4ZYvf3zRkMSz33FPyvu4dyNPafV9?= =?iso-8859-1?q?l09s2dERjEkpZI9mZ0cC3ppXoqs2Vl9RltpOOP7YpSjWo2THY4Cu3MSrVgZi?= =?iso-8859-1?q?5q/TAkAWM2oy9NxGmZ6w48x5APZvoeLmCHf/Sgq7MSDJ0fL93aUSiTwz/MfO?= =?iso-8859-1?q?bO3lGau35Kqw9mPKZ5ZoqrURWJV8FzsNO1RWlr4gTgOXz+XP5wy7TENdnOv4?= =?iso-8859-1?q?h4K2QgP44fPm4ivpZxcQAqshlcHnHCXlTf+pvlHDr+k4TbsY1Sp0X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PQUJh4cmNvMWp8mlfpAMqextSAHg+Lso1q73c5xO4gVSRi09JT2+nIa?= =?iso-8859-1?q?kEC1ovcG9RikfoKInQuLDHomXcKDSRddfSPk93CWugngQ08NNmBcGcLiCDyS?= =?iso-8859-1?q?UiaHBsYu5GvSljKTxu2gvqdw=3D=3D?= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM7P189MB0807.EURP189.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(7416014)(376014)(366016)(38070700018);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?k+82PZXaHGHX+C3s/IhKY1b?= =?iso-8859-1?q?yb8xrkzDXg+zqNjqNQcUuRobXZpEjsq0JO+5grKBBDP0+qd7WwgiEAu6/kfG?= =?iso-8859-1?q?lXX0tXdBKHD7lPHJjsZrHGUwQq/IxWSWc1p8nQny3B3ZmHYvNyaNMGrCTw0W?= =?iso-8859-1?q?y6te07icfCLBhLOId41gxTcWHOrE2vhIrbcsYRwIR5Poe14dAMaeKCeHpswA?= =?iso-8859-1?q?R0mVvN2nD+4YvThFFi054Z13U23jy2pipB5vsET2wne6NZ+U+RsuJCOrvXrz?= =?iso-8859-1?q?6Z9AAknZ4f4weUH6OO2ZwqCUhB/GYhybDbgfdw0nHwYZhdKI1as8n5DFDZXc?= =?iso-8859-1?q?T77bUn+RISFyvCLElVH5a1H9fMr/S1fTYyvRztHyJhvEd0Gi+dpBiDFl0RUq?= =?iso-8859-1?q?IK5gunmGToK59zK4ooiJsXUxoLhHSoaZUrvEVt58TaXXq2bGB5lVbh/ECnJv?= =?iso-8859-1?q?ORqwYel+km1MgJNJ0gUVpbKDNkVA/sA9gguG17OUpGs98Wnu8R22PiptoepR?= =?iso-8859-1?q?V/JAABresGq6JPtK6ZL8kSxDILwvcsCYXsnuikhBL6SWeKauuM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?q?aOPcbxKdM/9gCRwSPgo0Qjncr9zxgL1jMGy4YbKwCfB1sex2dayiIuPDoQfv?= =?iso-8859-1?q?FBTkiLE10I76Ul6vf0TkT5KEC9oTjdpAj4Yew+OhdCc6T8If3ldEptszgYsb?= =?iso-8859-1?q?UkhYY9o8IX1j0Y+0mdceybr+4lS8SOGc4ICLHncoBFR5x+CmcyutrLU4VCH7?= =?iso-8859-1?q?BVApWGywQ0n93SrnjLeBKCrKyV3tWIGjMbuA8zg=3D=3D?= Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-OriginatorOrg: est.tech X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: AM7P189MB0807.EURP189.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-Network-Message-Id: 5b9cdd57-2629-4e03-be97-08dcc2f5f593 X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Aug 2024 22:01:22.2114 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: d2585e63-66b9-44b6-a76e-4f4b217d97fd X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: qzAWgKrLxP1K3cgr3M3IAYoAiJL33OrrPJQerKrek7mqH9BTnxfkHtIkT8oucKvA10SksjI/tlxg+HYBmdhhBQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PRAP189MB1828 X-Patchwork-Delegate: kuba@kernel.org The TPS23880/1 has an active-low reset pin that some boards connect to the SoC to control when the TPS23880 is pulled out of reset. Add support for this via a reset-gpios property in the DTS. Signed-off-by: Kyle Swenson Acked-by: Oleksij Rempel Reviewed-by: Kory Maincent --- drivers/net/pse-pd/tps23881.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/net/pse-pd/tps23881.c b/drivers/net/pse-pd/tps23881.c index 2ea75686a319..5c4e88be46ee 100644 --- a/drivers/net/pse-pd/tps23881.c +++ b/drivers/net/pse-pd/tps23881.c @@ -6,10 +6,11 @@ */ #include #include #include +#include #include #include #include #include #include @@ -735,10 +736,11 @@ static int tps23881_flash_sram_fw(struct i2c_client *client) static int tps23881_i2c_probe(struct i2c_client *client) { struct device *dev = &client->dev; struct tps23881_priv *priv; + struct gpio_desc *reset; int ret; u8 val; if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { dev_err(dev, "i2c check functionality failed\n"); @@ -747,10 +749,29 @@ static int tps23881_i2c_probe(struct i2c_client *client) priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); if (!priv) return -ENOMEM; + reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH); + if (IS_ERR(reset)) + return dev_err_probe(&client->dev, PTR_ERR(reset), "Failed to get reset GPIO\n"); + + if (reset) { + /* TPS23880 datasheet (Rev G) indicates minimum reset pulse is 5us */ + usleep_range(5, 10); + gpiod_set_value_cansleep(reset, 0); /* De-assert reset */ + + /* TPS23880 datasheet indicates the minimum time after power on reset + * should be 20ms, but the document describing how to load SRAM ("How + * to Load TPS2388x SRAM and Parity Code over I2C" (Rev E)) + * indicates we should delay that programming by at least 50ms. So + * we'll wait the entire 50ms here to ensure we're safe to go to the + * SRAM loading proceedure. + */ + msleep(50); + } + ret = i2c_smbus_read_byte_data(client, TPS23881_REG_DEVID); if (ret < 0) return ret; if (FIELD_GET(TPS23881_REG_DEVID_MASK, ret) != TPS23881_DEVICE_ID) {