public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
From: Michal Simek <michal.simek@amd.com>
To: Lars-Peter Clausen <lars@metafoo.de>, Wolfram Sang <wsa@kernel.org>
Cc: Shubhrajyoti Datta <Shubhrajyoti.datta@amd.com>,
	Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	linux-i2c@vger.kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH 2/2] i2c: cadence: Add reset controller support
Date: Fri, 31 Mar 2023 08:49:09 +0200	[thread overview]
Message-ID: <1e929c0d-9a3c-1adb-b5de-e953f2cf3795@amd.com> (raw)
In-Reply-To: <20230330180448.269635-2-lars@metafoo.de>



On 3/30/23 20:04, Lars-Peter Clausen wrote:
> The Cadence I2C controller has an external reset signal that needs to be
> de-asserted before the I2C controller can be used.
> 
> Add support to the driver to be able to take the peripheral out of reset
> using the reset controller API. The reset is optional in the driver for
> compatibility to systems where the reset managed by the bootloader.
> 
> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
> ---
>   drivers/i2c/busses/i2c-cadence.c | 26 ++++++++++++++++++++++----
>   1 file changed, 22 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-cadence.c b/drivers/i2c/busses/i2c-cadence.c
> index 8f61a633c42c..102774ab2497 100644
> --- a/drivers/i2c/busses/i2c-cadence.c
> +++ b/drivers/i2c/busses/i2c-cadence.c
> @@ -16,6 +16,7 @@
>   #include <linux/of.h>
>   #include <linux/pm_runtime.h>
>   #include <linux/pinctrl/consumer.h>
> +#include <linux/reset.h>
>   
>   /* Register offsets for the I2C device. */
>   #define CDNS_I2C_CR_OFFSET		0x00 /* Control Register, RW */
> @@ -178,6 +179,7 @@ enum cdns_i2c_slave_state {
>    * @bus_hold_flag:	Flag used in repeated start for clearing HOLD bit
>    * @clk:		Pointer to struct clk
>    * @clk_rate_change_nb:	Notifier block for clock rate changes
> + * @reset:		Reset control for the device
>    * @quirks:		flag for broken hold bit usage in r1p10
>    * @ctrl_reg:		Cached value of the control register.
>    * @ctrl_reg_diva_divb: value of fields DIV_A and DIV_B from CR register
> @@ -204,6 +206,7 @@ struct cdns_i2c {
>   	unsigned int bus_hold_flag;
>   	struct clk *clk;
>   	struct notifier_block clk_rate_change_nb;
> +	struct reset_control *reset;
>   	u32 quirks;
>   	u32 ctrl_reg;
>   	struct i2c_bus_recovery_info rinfo;
> @@ -1325,10 +1328,22 @@ static int cdns_i2c_probe(struct platform_device *pdev)
>   		return dev_err_probe(&pdev->dev, PTR_ERR(id->clk),
>   				     "input clock not found.\n");
>   
> +	id->reset = devm_reset_control_get_optional_shared(&pdev->dev, NULL);
> +	if (IS_ERR(id->reset))
> +		return dev_err_probe(&pdev->dev, PTR_ERR(id->reset),
> +							 "Failed to request reset.\n");

incorrect alignment.

> +
>   	ret = clk_prepare_enable(id->clk);
>   	if (ret)
>   		dev_err(&pdev->dev, "Unable to enable clock.\n");
>   
> +	ret = reset_control_deassert(id->reset);
> +	if (ret) {
> +		dev_err_probe(&pdev->dev, ret,
> +					  "Failed to de-assert reset.\n");

incorrect alignment

The rest looks good to me.

M

  reply	other threads:[~2023-03-31  6:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-30 18:04 [PATCH 1/2] dt-bindings: i2c: cadence: Document reset property Lars-Peter Clausen
2023-03-30 18:04 ` [PATCH 2/2] i2c: cadence: Add reset controller support Lars-Peter Clausen
2023-03-31  6:49   ` Michal Simek [this message]
2023-03-31 16:42     ` Lars-Peter Clausen
2023-03-31  9:42 ` [PATCH 1/2] dt-bindings: i2c: cadence: Document reset property Krzysztof Kozlowski
2023-03-31 17:11   ` Lars-Peter Clausen
2023-03-31 20:21     ` Krzysztof Kozlowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1e929c0d-9a3c-1adb-b5de-e953f2cf3795@amd.com \
    --to=michal.simek@amd.com \
    --cc=Shubhrajyoti.datta@amd.com \
    --cc=devicetree@vger.kernel.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=lars@metafoo.de \
    --cc=linux-i2c@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=wsa@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox