Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp1087939rdh; Fri, 27 Oct 2023 04:37:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFBwUDUEpqaPP1hkzxFzhuFqZk2Lu3Kdr7jlv+TvKsljcYHwpblyFvMCMz2j4dUjJ9n29Z+ X-Received: by 2002:a81:ad62:0:b0:5a7:c01d:268 with SMTP id l34-20020a81ad62000000b005a7c01d0268mr2442257ywk.18.1698406643392; Fri, 27 Oct 2023 04:37:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698406643; cv=none; d=google.com; s=arc-20160816; b=H5AiRtvvwQMPcx5Ro0vVyrHMJEG+NQ7p82gvrZhIhsfrB6W2t/mGMZiJmpPsXk4UzU SOJcnzc/S9BF4GolmPbE9vBONNymMXSkUIvNsOfdpkUg3Sex5Rbsg0dK4QNUNAjxkfpO y4DJBTGVdDfT89EqXT0v0uduVSuxbLN+l2d912ueoOQCOME/Spn+qDhUDEkRSKVCVxDg emXxolMyEUEr3qgBwhHSEyvcir2RuLOg06hlMLpfTKFsTH5lL5abG4o8bRT57kfmJNFV VwePPD+HUCm8LW2HwRAVQbf+P241DYpe2AJb6JGOKSHmEw97bFEjawpMwV1/gIW9qSy+ HQRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:autocrypt :references:cc:to:from:content-language:subject:user-agent :mime-version:date:message-id:dkim-signature; bh=w3s//VVCSpk4dUjpSZEVYFJAipDT2VsjgfuyVu7eSqw=; fh=v6GDMPHzRpQjnGbKVmYmM8h1o1IV8u7DHoOW/pEW5Qo=; b=xOEEHGTEw9nWMbwZU91SOwoeXWZq4fsGptmlgF9An1L6njuSAjAXR+paLZoa78cMrC VK90xiQI6Nwqvro2UoWobMsdOqN3Eh3yOeD5SGwCNfM2e/Diwiv5epthmt5snuhKpKR3 BKvZIeltrUatKbKfTos3zRrL082pI7zN3sG4iMNc6aoW/2xXtfskaEkiW2+TY6U8pTsv vYc8Mh74trXDP6kG493AmdVbGp5nZH5Ewz39/HHILSDKRMKTXRmFkqJYT7jOvx8lApXl qRO2cJT6J58eVgr/pziQhMO/vKYiHCYuEfIu7QmFxb8qobeFQ21JX+ORn6rpc6GE47GA WGBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eMAmwQkf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id s128-20020a815e86000000b0059bde0b55fbsi2175540ywb.24.2023.10.27.04.37.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Oct 2023 04:37:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eMAmwQkf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 4498F8379440; Fri, 27 Oct 2023 04:37:20 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231464AbjJ0LhN (ORCPT + 99 others); Fri, 27 Oct 2023 07:37:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231340AbjJ0LhL (ORCPT ); Fri, 27 Oct 2023 07:37:11 -0400 Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 066981AC for ; Fri, 27 Oct 2023 04:37:08 -0700 (PDT) Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-507a29c7eefso2847777e87.1 for ; Fri, 27 Oct 2023 04:37:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698406627; x=1699011427; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:autocrypt:references:cc:to :from:content-language:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=w3s//VVCSpk4dUjpSZEVYFJAipDT2VsjgfuyVu7eSqw=; b=eMAmwQkf1Df6WEC/0tWXobeuRNmOaVe2npGsOBD6pugviuaRvTE4081yrMcHMRyxWz YtHWmo13vNkV4O0Vlg8zrNMNdu228c6dOFpiAnV71DrbOm7Mf/vT0Pz1p6p6E9hqKAwk +A6EBqQlAUQrU3/aAsAf3q0HrGPClME7iBUa8x5Hip8OtoMW52v5BCLSZZZq6CYbw7OH 1gaOpICi45YVCw0q9NMuxeU2YOf4w083atEPiktbqGtEP30yJzgoabWUkjj5hFAcIwdq ZkqDgvolORlxzxWNtwXusNP4hDQP5Sa+afJz/FLm8QYRqpKStiL12kcYgW7WF2WDCbQU MtVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698406627; x=1699011427; h=content-transfer-encoding:in-reply-to:autocrypt:references:cc:to :from:content-language:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=w3s//VVCSpk4dUjpSZEVYFJAipDT2VsjgfuyVu7eSqw=; b=k5j5TOEd5+c1l3HZnFyaIs+feliK2ZinC5rHkTwhge1maQYbSxG9DpNE/ylfyu7TG8 9ovzy56Mwvkxd66zKSvx11buPSzgXssZ8LwI0rFXNlpLam2Pjy5yxnELKYqT70KV7X6E mDC4YshJ2ziSN6ovErFmvD6ofPaCdD8jZRrEdwQeaar8zfLAfXOSCnWNrqe8W/16uyAT Sg+usF2X52F/HL2G6NsnhJI95aCgOsb5Q+VkdAb/Hlrq0wCqe0wnn/zRhueryiYqJp9g dHjCpBIe/G3o0zoWw86Shr/Du352NHEncnEBuNfJVU8o+NZlPDf+ogFaQL/FTyG1wrJY rooQ== X-Gm-Message-State: AOJu0YzyIH9Ab65g0X+jflbUp1yI8uviomWKyzs411K1FImbjk9cU+ik QNlUeJZYqeNXQd3PgqHXPYqajQ== X-Received: by 2002:a05:6512:401d:b0:503:3787:f75a with SMTP id br29-20020a056512401d00b005033787f75amr2079952lfb.62.1698406626704; Fri, 27 Oct 2023 04:37:06 -0700 (PDT) Received: from [192.168.0.22] ([78.10.206.168]) by smtp.gmail.com with ESMTPSA id j11-20020a05651231cb00b005056c997ed6sm245636lfe.163.2023.10.27.04.37.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 27 Oct 2023 04:37:06 -0700 (PDT) Message-ID: <9eebec9b-e6fd-4a22-89ea-b434f446e061@linaro.org> Date: Fri, 27 Oct 2023 13:37:05 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v5 2/2] i2c: mv64xxx: add an optional bus-reset-gpios property Content-Language: en-US From: Krzysztof Kozlowski To: Chris Packham , gregory.clement@bootlin.com, andi.shyti@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, Abel Vesa , Mark Brown Cc: linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org References: <20231027033104.1348921-1-chris.packham@alliedtelesis.co.nz> <20231027033104.1348921-3-chris.packham@alliedtelesis.co.nz> <65911ec0-e073-435f-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/ +HYjC/qfDxT7tjKXqBQEscVODaFicsUkjheOD4BfWEcVUqa+XdUEciwG/SgNyxBZepj41oVq FPSVE+Ni2tNrW/e16b8mgXNngHSnbsr6pAIXZH3qFW+4TKPMGZ2rZ6zITrMip+12jgw4mGjy 5y06JZvA02rZT2k9aa7i9dUUFggaanI09jNGbRA/ABEBAAHCwXwEGAEKACYCGwwWIQSb0H4O DFH41ZZ3t1Qbk0N9O0FimwUCYDzvagUJFF+UtgAKCRAbk0N9O0Fim9JzD/0auoGtUu4mgnna oEEpQEOjgT7l9TVuO3Qa/SeH+E0m55y5Fjpp6ZToc481za3xAcxK/BtIX5Wn1mQ6+szfrJQ6 59y2io437BeuWIRjQniSxHz1kgtFECiV30yHRgOoQlzUea7FgsnuWdstgfWi6LxstswEzxLZ Sj1EqpXYZE4uLjh6dW292sO+j4LEqPYr53hyV4I2LPmptPE9Rb9yCTAbSUlzgjiyyjuXhcwM qf3lzsm02y7Ooq+ERVKiJzlvLd9tSe4jRx6Z6LMXhB21fa5DGs/tHAcUF35hSJrvMJzPT/+u /oVmYDFZkbLlqs2XpWaVCo2jv8+iHxZZ9FL7F6AHFzqEFdqGnJQqmEApiRqH6b4jRBOgJ+cY qc+rJggwMQcJL9F+oDm3wX47nr6jIsEB5ZftdybIzpMZ5V9v45lUwmdnMrSzZVgC4jRGXzsU EViBQt2CopXtHtYfPAO5nAkIvKSNp3jmGxZw4aTc5xoAZBLo0OV+Ezo71pg3AYvq0a3/oGRG KQ06ztUMRrj8eVtpImjsWCd0bDWRaaR4vqhCHvAG9iWXZu4qh3ipie2Y0oSJygcZT7H3UZxq fyYKiqEmRuqsvv6dcbblD8ZLkz1EVZL6djImH5zc5x8qpVxlA0A0i23v5QvN00m6G9NFF0Le D2GYIS41Kv4Isx2dEFh+/Q== In-Reply-To: <65911ec0-e073-435f-846a-c5501dd5d3a9@linaro.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Fri, 27 Oct 2023 04:37:20 -0700 (PDT) On 27/10/2023 13:27, Krzysztof Kozlowski wrote: > On 27/10/2023 05:31, Chris Packham wrote: >> Some hardware designs have a GPIO used to control the reset of all the >> devices on and I2C bus. It's not possible for every child node to >> declare a reset-gpios property as only the first device probed would be >> able to successfully request it (the others will get -EBUSY). Represent Cc: Mark, Also this part is not true. If the bus is non-discoverable, then it is possible to have reset-gpios in each probed device. You can share GPIOs, so no problem with -EBUSY at all. The problem is doing reset: 1. in proper moment for all devices 2. without affecting other devices when one unbinds/remove() The (2) above is not solveable easy in kernel and we already had nice talks about it just few days ago: 1. Apple case: https://social.treehouse.systems/@marcan/111268780311634160 2. my WSA884x: https://lore.kernel.org/alsa-devel/84f9f1c4-0627-4986-8160-b4ab99469b81@linaro.org/ Last, I would like to apologize to you Chris. I understand that bringing such feedback at v5 is not that good. I had plenty of time to say something earlier, so this is not really professional from my side. I am sorry, just my brain did not connect all these topics together. I apologize. Best regards, Krzysztof >> this kind of hardware design by associating the bus-reset-gpios with the >> parent I2C bus. The reset line will be released prior to the child I2C >> devices being probed. >> >> Signed-off-by: Chris Packham >> --- >> >> Notes: >> Changes in v5: >> - Rename reset-gpios and reset-duration-us to bus-reset-gpios and >> bus-reset-duration-us as requested by Wolfram >> Changes in v4: >> - Add missing gpio/consumer.h >> - use fsleep() for enforcing reset-duration >> Changes in v3: >> - Rename reset-delay to reset-duration >> - Use reset-duration-us property to control the reset pulse rather than >> delaying after the reset >> Changes in v2: >> - Add a property to cover the length of delay after releasing the reset >> GPIO >> - Use dev_err_probe() when requesing the GPIO fails >> >> drivers/i2c/busses/i2c-mv64xxx.c | 16 ++++++++++++++++ >> 1 file changed, 16 insertions(+) >> >> diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c >> index efd28bbecf61..6e2762d22e5a 100644 >> --- a/drivers/i2c/busses/i2c-mv64xxx.c >> +++ b/drivers/i2c/busses/i2c-mv64xxx.c >> @@ -13,6 +13,7 @@ >> #include >> #include >> #include >> +#include >> #include >> #include >> #include >> @@ -160,6 +161,7 @@ struct mv64xxx_i2c_data { >> bool clk_n_base_0; >> struct i2c_bus_recovery_info rinfo; >> bool atomic; >> + struct gpio_desc *reset_gpio; >> }; >> >> static struct mv64xxx_i2c_regs mv64xxx_i2c_regs_mv64xxx = { >> @@ -1036,6 +1038,7 @@ mv64xxx_i2c_probe(struct platform_device *pd) >> struct mv64xxx_i2c_data *drv_data; >> struct mv64xxx_i2c_pdata *pdata = dev_get_platdata(&pd->dev); >> struct resource *res; >> + u32 reset_duration; >> int rc; >> >> if ((!pdata && !pd->dev.of_node)) >> @@ -1083,6 +1086,14 @@ mv64xxx_i2c_probe(struct platform_device *pd) >> if (drv_data->irq < 0) >> return drv_data->irq; >> >> + drv_data->reset_gpio = devm_gpiod_get_optional(&pd->dev, "bus-reset", GPIOD_OUT_HIGH); >> + if (IS_ERR(drv_data->reset_gpio)) >> + return dev_err_probe(&pd->dev, PTR_ERR(drv_data->reset_gpio), >> + "Cannot get reset gpio\n"); >> + rc = device_property_read_u32(&pd->dev, "bus-reset-duration-us", &reset_duration); >> + if (rc) >> + reset_duration = 1; > > No, this should be solved by core - for entire I2C at minimum. This is > not specific to this device.