Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp1082758rdh; Fri, 27 Oct 2023 04:27:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHYqnAsm8CXH/e7QaERj477fDGiq9Ke5CkcePUzQweAJ/YWvrDtFVRBh+vBnSx6JmHZTnnf X-Received: by 2002:a25:4201:0:b0:d9a:4d90:feda with SMTP id p1-20020a254201000000b00d9a4d90fedamr2119734yba.62.1698406075184; Fri, 27 Oct 2023 04:27:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698406075; cv=none; d=google.com; s=arc-20160816; b=xeUjnpxmKGEalKaarlQQlVsIjzQMDXdKPM/YSg0clTeaflgDOffyLFxePf3gaBi4Nd 44sbvKWPYwFnAAfiZMzsJ/mjIelC2vuXmHOeNGzeaoKIFGCSmNJODnD2AIKx3iRQ07gS jeV/mUdoUp4kl5m/ctf2VICKpBFauWPG13NwjDZrrz70vti8ZkXo4wSl5jhN25LUuj6m DT1PIT2L/RSE5F7Y+LKZJBfGg/dzsXRl0+Jfq1vIev02tMyq01M7yg4k05QgodKCuxts Q+bTVJWla3e5mvrIdyFXcVM1jsIu8z7hpddrZu/osmegiiQ1md0GnXWQLmqKyWu/yEcF Pufw== 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 :from:references:cc:to:content-language:subject:user-agent :mime-version:date:message-id:dkim-signature; bh=FVAaLrP2Y61ubiHPirPmK1VRJY7APR1sGBGoK51Hgs0=; fh=HhO/z3N7X3iBbekllfGDCo++Tzus/N5kbX2+f7UGb6w=; b=kV+slsw+YoAJKgubhfA0WaJ6ncJ9aFqlKu2gBgEIwVkVrbJCNOU+H+iIfUDW7FRD1G 1B9G0M5MPT/No5uv5LHrF1qbmxhezzIijipDbf/adxx3QLVAWpFOEN0QoDr2gW/pbYAV AA3i4A7m4JhVWsnwCoTmXCgTRVn7tvkEvCEMFA64Gl9ubk+zI6RvRvjwsJDt/rM7vAp8 yhb3XlrZ1ZmubV9nDJPgachkMek7ot0xfnqGBqQuerH0I54iYyV1B0lh4FKrPaFMYNra hO2K74hNu26gKPaxC6A8u1kta7AaIQoEi3MOG9U+50FdkLKV1WEaQlwSzNVJJs+f/vG2 4aAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="CxM/mo0w"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id p16-20020a258e10000000b00d9cc5169043si2238118ybl.266.2023.10.27.04.27.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Oct 2023 04:27:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="CxM/mo0w"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (Postfix) with ESMTP id 5587682F4E16; Fri, 27 Oct 2023 04:27:53 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345585AbjJ0L1t (ORCPT + 99 others); Fri, 27 Oct 2023 07:27:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230101AbjJ0L1s (ORCPT ); Fri, 27 Oct 2023 07:27:48 -0400 Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F359AB for ; Fri, 27 Oct 2023 04:27:45 -0700 (PDT) Received: by mail-lf1-x12d.google.com with SMTP id 2adb3069b0e04-507962561adso2943863e87.0 for ; Fri, 27 Oct 2023 04:27:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698406063; x=1699010863; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=FVAaLrP2Y61ubiHPirPmK1VRJY7APR1sGBGoK51Hgs0=; b=CxM/mo0w4UKAjdM/C+fC3a4HpxcM6lXzTcqpYbzcb3IbvjBMMiKNWGjV4fvX+tu40O ciF9nj6045HLOIEtn9sT/Gy/MYIsukHPFUVSG0NaoVeIOtNt875EnJJrj2tJrCs56EjH XfCxRkxNIr+tH+Oo4Dr653OVHRGCVQApOT+P3elqqi1RIlMth0FS0JKTcSRd+Q9bOu0g M5LuGaSG/RjGzjg+joirF0QUSWfvP4uMEpJVbDeOillZy19ihj/p7+pMNZfezGiQxCJA JsI5z2jPoPXEeIrq8pefJigB4THO4g2dGr8Q6vrJ4he9dj+jGRz0hRnJpC2DBDI0s5IK Jglw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698406063; x=1699010863; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=FVAaLrP2Y61ubiHPirPmK1VRJY7APR1sGBGoK51Hgs0=; b=AKzSCpfItmgMPcM20Td9cPUrHkfsg3u3sX280nXKgi2gNI16t3ImChTPenedoZuv+j 5hhcciL0BJTDFeSv1NfXc3StTbvx+3J2opRamRvyV9GZRjDw1zpI8hM2ugDpu47itBZz iSkJAJfhRZnKAchDIi38+xeWI31+xeXP5poQF5cYIWjRY209bBoYr14lzMEsC5/H2HS7 d+7wN0qubk88nDUT6tZk/08V4BpqyiUaGW8E+nw48cR6kuDY+T0yRHs9ik+UVPw9EmlO U9KKnRCnHBI+4zub/yCytUA3Rb8YgPry6IgH4ixU/LaK8WJu4SiF++nvZtggg7HPkSxL iWuw== X-Gm-Message-State: AOJu0YzuHAybT83Lh5UdgwmtQfXGisxr9SxHyoZT0jIh8G+SONHVtC9H 33fmrhVmJ2zJcb5R0gqtRmcWJQ== X-Received: by 2002:a19:ad44:0:b0:4fb:9f93:365f with SMTP id s4-20020a19ad44000000b004fb9f93365fmr1592200lfd.38.1698406063485; Fri, 27 Oct 2023 04:27:43 -0700 (PDT) Received: from [192.168.0.22] ([78.10.206.168]) by smtp.gmail.com with ESMTPSA id z6-20020ac25de6000000b004fddb0eb961sm248896lfq.18.2023.10.27.04.27.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 27 Oct 2023 04:27:43 -0700 (PDT) Message-ID: <65911ec0-e073-435f-846a-c5501dd5d3a9@linaro.org> Date: Fri, 27 Oct 2023 13:27:41 +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 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 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> From: Krzysztof Kozlowski Autoc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VODaFicsUkjheOD4BfWEcVUqa+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: <20231027033104.1348921-3-chris.packham@alliedtelesis.co.nz> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Fri, 27 Oct 2023 04:27:53 -0700 (PDT) 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 > 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. Best regards, Krzysztof