* [PATCH 1/4] dt-bindings: i2c: Specify reset as optional
@ 2025-05-06 9:59 Akhil R
2025-05-06 9:59 ` [PATCH 2/4] i2c: tegra: make reset an optional property Akhil R
` (6 more replies)
0 siblings, 7 replies; 11+ messages in thread
From: Akhil R @ 2025-05-06 9:59 UTC (permalink / raw)
To: andi.shyti, robh, krzk+dt, onor+dt, thierry.reding, jonathanh,
ldewangan, digetx, p.zabel, linux-i2c, devicetree, linux-tegra,
linux-kernel
Cc: Akhil R
Specify reset as optional in the description for controllers that has an
internal software reset available
Signed-off-by: Akhil R <akhilrajeev@nvidia.com>
---
Documentation/devicetree/bindings/i2c/nvidia,tegra20-i2c.yaml | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/Documentation/devicetree/bindings/i2c/nvidia,tegra20-i2c.yaml b/Documentation/devicetree/bindings/i2c/nvidia,tegra20-i2c.yaml
index b57ae6963e62..19aefc022c8b 100644
--- a/Documentation/devicetree/bindings/i2c/nvidia,tegra20-i2c.yaml
+++ b/Documentation/devicetree/bindings/i2c/nvidia,tegra20-i2c.yaml
@@ -97,7 +97,9 @@ properties:
resets:
items:
- - description: module reset
+ - description: |
+ Module reset. This property is optional for controllers in Tegra194 and later
+ chips where an internal software reset is available as an alternative.
reset-names:
items:
--
2.43.2
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 2/4] i2c: tegra: make reset an optional property
2025-05-06 9:59 [PATCH 1/4] dt-bindings: i2c: Specify reset as optional Akhil R
@ 2025-05-06 9:59 ` Akhil R
2025-05-06 10:14 ` Philipp Zabel
2025-05-06 9:59 ` [PATCH 3/4] i2c: tegra: Remove dma_sync_*() calls Akhil R
` (5 subsequent siblings)
6 siblings, 1 reply; 11+ messages in thread
From: Akhil R @ 2025-05-06 9:59 UTC (permalink / raw)
To: andi.shyti, robh, krzk+dt, onor+dt, thierry.reding, jonathanh,
ldewangan, digetx, p.zabel, linux-i2c, devicetree, linux-tegra,
linux-kernel
Cc: Akhil R
For controllers that has an internal software reset, make the reset
property optional. This is useful in systems that choose to restrict
reset control from Linux.
Signed-off-by: Akhil R <akhilrajeev@nvidia.com>
---
drivers/i2c/busses/i2c-tegra.c | 35 ++++++++++++++++++++++++++++++++--
1 file changed, 33 insertions(+), 2 deletions(-)
diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
index 87976e99e6d0..49b77dcef184 100644
--- a/drivers/i2c/busses/i2c-tegra.c
+++ b/drivers/i2c/busses/i2c-tegra.c
@@ -134,6 +134,8 @@
#define I2C_MST_FIFO_STATUS_TX GENMASK(23, 16)
#define I2C_MST_FIFO_STATUS_RX GENMASK(7, 0)
+#define I2C_MASTER_RESET_CNTRL 0x0a8
+
/* configuration load timeout in microseconds */
#define I2C_CONFIG_LOAD_TIMEOUT 1000000
@@ -184,6 +186,9 @@ enum msg_end_type {
* @has_mst_fifo: The I2C controller contains the new MST FIFO interface that
* provides additional features and allows for longer messages to
* be transferred in one go.
+ * @has_mst_reset: The I2C controller contains MASTER_RESET_CTRL register which
+ * provides an alternative to controller reset when configured as
+ * I2C master
* @quirks: I2C adapter quirks for limiting write/read transfer size and not
* allowing 0 length transfers.
* @supports_bus_clear: Bus Clear support to recover from bus hang during
@@ -213,6 +218,7 @@ struct tegra_i2c_hw_feature {
bool has_multi_master_mode;
bool has_slcg_override_reg;
bool has_mst_fifo;
+ bool has_mst_reset;
const struct i2c_adapter_quirks *quirks;
bool supports_bus_clear;
bool has_apb_dma;
@@ -604,6 +610,18 @@ static int tegra_i2c_wait_for_config_load(struct tegra_i2c_dev *i2c_dev)
return 0;
}
+static int tegra_i2c_master_reset(struct tegra_i2c_dev *i2c_dev)
+{
+ if (!i2c_dev->hw->has_mst_reset)
+ return -EOPNOTSUPP;
+
+ i2c_writel(i2c_dev, 0x1, I2C_MASTER_RESET_CNTRL);
+ udelay(1);
+ i2c_writel(i2c_dev, 0x0, I2C_MASTER_RESET_CNTRL);
+
+ return 0;
+}
+
static int tegra_i2c_init(struct tegra_i2c_dev *i2c_dev)
{
u32 val, clk_divisor, clk_multiplier, tsu_thd, tlow, thigh, non_hs_mode;
@@ -621,8 +639,10 @@ static int tegra_i2c_init(struct tegra_i2c_dev *i2c_dev)
*/
if (handle)
err = acpi_evaluate_object(handle, "_RST", NULL, NULL);
- else
+ else if (i2c_dev->rst)
err = reset_control_reset(i2c_dev->rst);
+ else
+ err = tegra_i2c_master_reset(i2c_dev);
WARN_ON_ONCE(err);
@@ -1467,6 +1487,7 @@ static const struct tegra_i2c_hw_feature tegra20_i2c_hw = {
.has_multi_master_mode = false,
.has_slcg_override_reg = false,
.has_mst_fifo = false,
+ .has_mst_reset = false,
.quirks = &tegra_i2c_quirks,
.supports_bus_clear = false,
.has_apb_dma = true,
@@ -1491,6 +1512,7 @@ static const struct tegra_i2c_hw_feature tegra30_i2c_hw = {
.has_multi_master_mode = false,
.has_slcg_override_reg = false,
.has_mst_fifo = false,
+ .has_mst_reset = false,
.quirks = &tegra_i2c_quirks,
.supports_bus_clear = false,
.has_apb_dma = true,
@@ -1515,6 +1537,7 @@ static const struct tegra_i2c_hw_feature tegra114_i2c_hw = {
.has_multi_master_mode = false,
.has_slcg_override_reg = false,
.has_mst_fifo = false,
+ .has_mst_reset = false,
.quirks = &tegra_i2c_quirks,
.supports_bus_clear = true,
.has_apb_dma = true,
@@ -1539,6 +1562,7 @@ static const struct tegra_i2c_hw_feature tegra124_i2c_hw = {
.has_multi_master_mode = false,
.has_slcg_override_reg = true,
.has_mst_fifo = false,
+ .has_mst_reset = false,
.quirks = &tegra_i2c_quirks,
.supports_bus_clear = true,
.has_apb_dma = true,
@@ -1563,6 +1587,7 @@ static const struct tegra_i2c_hw_feature tegra210_i2c_hw = {
.has_multi_master_mode = false,
.has_slcg_override_reg = true,
.has_mst_fifo = false,
+ .has_mst_reset = false,
.quirks = &tegra_i2c_quirks,
.supports_bus_clear = true,
.has_apb_dma = true,
@@ -1587,6 +1612,7 @@ static const struct tegra_i2c_hw_feature tegra186_i2c_hw = {
.has_multi_master_mode = false,
.has_slcg_override_reg = true,
.has_mst_fifo = false,
+ .has_mst_reset = false,
.quirks = &tegra_i2c_quirks,
.supports_bus_clear = true,
.has_apb_dma = false,
@@ -1611,6 +1637,7 @@ static const struct tegra_i2c_hw_feature tegra194_i2c_hw = {
.has_multi_master_mode = true,
.has_slcg_override_reg = true,
.has_mst_fifo = true,
+ .has_mst_reset = true,
.quirks = &tegra194_i2c_quirks,
.supports_bus_clear = true,
.has_apb_dma = false,
@@ -1666,7 +1693,11 @@ static int tegra_i2c_init_reset(struct tegra_i2c_dev *i2c_dev)
if (ACPI_HANDLE(i2c_dev->dev))
return 0;
- i2c_dev->rst = devm_reset_control_get_exclusive(i2c_dev->dev, "i2c");
+ if (i2c_dev->hw->has_mst_reset)
+ i2c_dev->rst = devm_reset_control_get_optional_exclusive(i2c_dev->dev, "i2c");
+ else
+ i2c_dev->rst = devm_reset_control_get_exclusive(i2c_dev->dev, "i2c");
+
if (IS_ERR(i2c_dev->rst))
return dev_err_probe(i2c_dev->dev, PTR_ERR(i2c_dev->rst),
"failed to get reset control\n");
--
2.43.2
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 3/4] i2c: tegra: Remove dma_sync_*() calls
2025-05-06 9:59 [PATCH 1/4] dt-bindings: i2c: Specify reset as optional Akhil R
2025-05-06 9:59 ` [PATCH 2/4] i2c: tegra: make reset an optional property Akhil R
@ 2025-05-06 9:59 ` Akhil R
2025-05-06 10:04 ` Akhil R
2025-05-06 9:59 ` [PATCH 4/4] arm64: tegra: Add I2C aliases for Tegra234 Akhil R
` (4 subsequent siblings)
6 siblings, 1 reply; 11+ messages in thread
From: Akhil R @ 2025-05-06 9:59 UTC (permalink / raw)
To: andi.shyti, robh, krzk+dt, onor+dt, thierry.reding, jonathanh,
ldewangan, digetx, p.zabel, linux-i2c, devicetree, linux-tegra,
linux-kernel
Cc: Akhil R, Robin Murphy
Calling dma_sync_*() on a buffer from dma_alloc_coherent() is pointless.
The driver should not be doing its own bounce-buffering if the buffer is
allocated through dma_alloc_coherent()
Suggested-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Akhil R <akhilrajeev@nvidia.com>
---
drivers/i2c/busses/i2c-tegra.c | 20 +-------------------
1 file changed, 1 insertion(+), 19 deletions(-)
diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
index 49b77dcef184..35057e977688 100644
--- a/drivers/i2c/busses/i2c-tegra.c
+++ b/drivers/i2c/busses/i2c-tegra.c
@@ -1290,17 +1290,9 @@ static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev,
if (i2c_dev->dma_mode) {
if (i2c_dev->msg_read) {
- dma_sync_single_for_device(i2c_dev->dma_dev,
- i2c_dev->dma_phys,
- xfer_size, DMA_FROM_DEVICE);
-
err = tegra_i2c_dma_submit(i2c_dev, xfer_size);
if (err)
return err;
- } else {
- dma_sync_single_for_cpu(i2c_dev->dma_dev,
- i2c_dev->dma_phys,
- xfer_size, DMA_TO_DEVICE);
}
}
@@ -1310,11 +1302,6 @@ static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev,
if (i2c_dev->dma_mode) {
memcpy(i2c_dev->dma_buf + I2C_PACKET_HEADER_SIZE,
msg->buf, i2c_dev->msg_len);
-
- dma_sync_single_for_device(i2c_dev->dma_dev,
- i2c_dev->dma_phys,
- xfer_size, DMA_TO_DEVICE);
-
err = tegra_i2c_dma_submit(i2c_dev, xfer_size);
if (err)
return err;
@@ -1355,13 +1342,8 @@ static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev,
return -ETIMEDOUT;
}
- if (i2c_dev->msg_read && i2c_dev->msg_err == I2C_ERR_NONE) {
- dma_sync_single_for_cpu(i2c_dev->dma_dev,
- i2c_dev->dma_phys,
- xfer_size, DMA_FROM_DEVICE);
-
+ if (i2c_dev->msg_read && i2c_dev->msg_err == I2C_ERR_NONE)
memcpy(i2c_dev->msg_buf, i2c_dev->dma_buf, i2c_dev->msg_len);
- }
}
time_left = tegra_i2c_wait_completion(i2c_dev, &i2c_dev->msg_complete,
--
2.43.2
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 4/4] arm64: tegra: Add I2C aliases for Tegra234
2025-05-06 9:59 [PATCH 1/4] dt-bindings: i2c: Specify reset as optional Akhil R
2025-05-06 9:59 ` [PATCH 2/4] i2c: tegra: make reset an optional property Akhil R
2025-05-06 9:59 ` [PATCH 3/4] i2c: tegra: Remove dma_sync_*() calls Akhil R
@ 2025-05-06 9:59 ` Akhil R
2025-05-06 10:11 ` [PATCH 1/4] dt-bindings: i2c: Specify reset as optional Philipp Zabel
` (3 subsequent siblings)
6 siblings, 0 replies; 11+ messages in thread
From: Akhil R @ 2025-05-06 9:59 UTC (permalink / raw)
To: andi.shyti, robh, krzk+dt, onor+dt, thierry.reding, jonathanh,
ldewangan, digetx, p.zabel, linux-i2c, devicetree, linux-tegra,
linux-kernel
Cc: Akhil R
Add aliases for all I2C nodes so that the I2C devnode numbers align with
hardware bus number.
Signed-off-by: Akhil R <akhilrajeev@nvidia.com>
---
arch/arm64/boot/dts/nvidia/tegra234.dtsi | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/arch/arm64/boot/dts/nvidia/tegra234.dtsi b/arch/arm64/boot/dts/nvidia/tegra234.dtsi
index 2601b43b2d8c..c9f3724d2418 100644
--- a/arch/arm64/boot/dts/nvidia/tegra234.dtsi
+++ b/arch/arm64/boot/dts/nvidia/tegra234.dtsi
@@ -16,6 +16,18 @@ / {
#address-cells = <2>;
#size-cells = <2>;
+ aliases {
+ i2c0 = &gen1_i2c;
+ i2c1 = &gen2_i2c;
+ i2c2 = &cam_i2c;
+ i2c3 = &dp_aux_ch1_i2c;
+ i2c4 = &bpmp_i2c;
+ i2c5 = &dp_aux_ch0_i2c;
+ i2c6 = &dp_aux_ch2_i2c;
+ i2c7 = &gen8_i2c;
+ i2c8 = &dp_aux_ch3_i2c;
+ };
+
bus@0 {
compatible = "simple-bus";
--
2.43.2
^ permalink raw reply related [flat|nested] 11+ messages in thread
* RE: [PATCH 3/4] i2c: tegra: Remove dma_sync_*() calls
2025-05-06 9:59 ` [PATCH 3/4] i2c: tegra: Remove dma_sync_*() calls Akhil R
@ 2025-05-06 10:04 ` Akhil R
0 siblings, 0 replies; 11+ messages in thread
From: Akhil R @ 2025-05-06 10:04 UTC (permalink / raw)
To: andi.shyti@kernel.org, robh@kernel.org, krzk+dt@kernel.org,
onor+dt@kernel.org, thierry.reding@gmail.com, Jon Hunter,
Laxman Dewangan, digetx@gmail.com, p.zabel@pengutronix.de,
linux-i2c@vger.kernel.org, devicetree@vger.kernel.org,
linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Robin Murphy
> Calling dma_sync_*() on a buffer from dma_alloc_coherent() is pointless.
> The driver should not be doing its own bounce-buffering if the buffer is
> allocated through dma_alloc_coherent()
>
> Suggested-by: Robin Murphy <robin.murphy@arm.com>
> Signed-off-by: Akhil R <akhilrajeev@nvidia.com>
Related thread - https://lore.kernel.org/all/acdbf49c-1a73-a0b9-a10d-42d544be3117@arm.com/
Regards,
Akhil
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/4] dt-bindings: i2c: Specify reset as optional
2025-05-06 9:59 [PATCH 1/4] dt-bindings: i2c: Specify reset as optional Akhil R
` (2 preceding siblings ...)
2025-05-06 9:59 ` [PATCH 4/4] arm64: tegra: Add I2C aliases for Tegra234 Akhil R
@ 2025-05-06 10:11 ` Philipp Zabel
2025-05-08 15:09 ` Conor Dooley
` (2 subsequent siblings)
6 siblings, 0 replies; 11+ messages in thread
From: Philipp Zabel @ 2025-05-06 10:11 UTC (permalink / raw)
To: Akhil R, andi.shyti, robh, krzk+dt, onor+dt, thierry.reding,
jonathanh, ldewangan, digetx, linux-i2c, devicetree, linux-tegra,
linux-kernel
On Di, 2025-05-06 at 15:29 +0530, Akhil R wrote:
> Specify reset as optional in the description for controllers that has an
> internal software reset available
>
> Signed-off-by: Akhil R <akhilrajeev@nvidia.com>
> ---
> Documentation/devicetree/bindings/i2c/nvidia,tegra20-i2c.yaml | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/devicetree/bindings/i2c/nvidia,tegra20-i2c.yaml b/Documentation/devicetree/bindings/i2c/nvidia,tegra20-i2c.yaml
> index b57ae6963e62..19aefc022c8b 100644
> --- a/Documentation/devicetree/bindings/i2c/nvidia,tegra20-i2c.yaml
> +++ b/Documentation/devicetree/bindings/i2c/nvidia,tegra20-i2c.yaml
> @@ -97,7 +97,9 @@ properties:
>
> resets:
> items:
> - - description: module reset
> + - description: |
> + Module reset. This property is optional for controllers in Tegra194 and later
> + chips where an internal software reset is available as an alternative.
If the module reset was not optional before, shouldn't the resets
property have been marked as required? Then, instead of the comment,
you could conditionally remove the required status for nvidia,tegra194-
i2c.
regards
Philipp
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 2/4] i2c: tegra: make reset an optional property
2025-05-06 9:59 ` [PATCH 2/4] i2c: tegra: make reset an optional property Akhil R
@ 2025-05-06 10:14 ` Philipp Zabel
0 siblings, 0 replies; 11+ messages in thread
From: Philipp Zabel @ 2025-05-06 10:14 UTC (permalink / raw)
To: Akhil R, andi.shyti, robh, krzk+dt, onor+dt, thierry.reding,
jonathanh, ldewangan, digetx, linux-i2c, devicetree, linux-tegra,
linux-kernel
On Di, 2025-05-06 at 15:29 +0530, Akhil R wrote:
> For controllers that has an internal software reset, make the reset
> property optional. This is useful in systems that choose to restrict
> reset control from Linux.
>
> Signed-off-by: Akhil R <akhilrajeev@nvidia.com>
> ---
> drivers/i2c/busses/i2c-tegra.c | 35 ++++++++++++++++++++++++++++++++--
> 1 file changed, 33 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
> index 87976e99e6d0..49b77dcef184 100644
> --- a/drivers/i2c/busses/i2c-tegra.c
> +++ b/drivers/i2c/busses/i2c-tegra.c
> @@ -134,6 +134,8 @@
> #define I2C_MST_FIFO_STATUS_TX GENMASK(23, 16)
> #define I2C_MST_FIFO_STATUS_RX GENMASK(7, 0)
>
> +#define I2C_MASTER_RESET_CNTRL 0x0a8
> +
> /* configuration load timeout in microseconds */
> #define I2C_CONFIG_LOAD_TIMEOUT 1000000
>
> @@ -184,6 +186,9 @@ enum msg_end_type {
> * @has_mst_fifo: The I2C controller contains the new MST FIFO interface that
> * provides additional features and allows for longer messages to
> * be transferred in one go.
> + * @has_mst_reset: The I2C controller contains MASTER_RESET_CTRL register which
> + * provides an alternative to controller reset when configured as
> + * I2C master
> * @quirks: I2C adapter quirks for limiting write/read transfer size and not
> * allowing 0 length transfers.
> * @supports_bus_clear: Bus Clear support to recover from bus hang during
> @@ -213,6 +218,7 @@ struct tegra_i2c_hw_feature {
> bool has_multi_master_mode;
> bool has_slcg_override_reg;
> bool has_mst_fifo;
> + bool has_mst_reset;
> const struct i2c_adapter_quirks *quirks;
> bool supports_bus_clear;
> bool has_apb_dma;
> @@ -604,6 +610,18 @@ static int tegra_i2c_wait_for_config_load(struct tegra_i2c_dev *i2c_dev)
> return 0;
> }
>
> +static int tegra_i2c_master_reset(struct tegra_i2c_dev *i2c_dev)
> +{
> + if (!i2c_dev->hw->has_mst_reset)
> + return -EOPNOTSUPP;
> +
> + i2c_writel(i2c_dev, 0x1, I2C_MASTER_RESET_CNTRL);
> + udelay(1);
> + i2c_writel(i2c_dev, 0x0, I2C_MASTER_RESET_CNTRL);
> +
> + return 0;
> +}
> +
> static int tegra_i2c_init(struct tegra_i2c_dev *i2c_dev)
> {
> u32 val, clk_divisor, clk_multiplier, tsu_thd, tlow, thigh, non_hs_mode;
> @@ -621,8 +639,10 @@ static int tegra_i2c_init(struct tegra_i2c_dev *i2c_dev)
> */
> if (handle)
> err = acpi_evaluate_object(handle, "_RST", NULL, NULL);
> - else
> + else if (i2c_dev->rst)
> err = reset_control_reset(i2c_dev->rst);
> + else
> + err = tegra_i2c_master_reset(i2c_dev);
>
> WARN_ON_ONCE(err);
>
> @@ -1467,6 +1487,7 @@ static const struct tegra_i2c_hw_feature tegra20_i2c_hw = {
> .has_multi_master_mode = false,
> .has_slcg_override_reg = false,
> .has_mst_fifo = false,
> + .has_mst_reset = false,
> .quirks = &tegra_i2c_quirks,
> .supports_bus_clear = false,
> .has_apb_dma = true,
> @@ -1491,6 +1512,7 @@ static const struct tegra_i2c_hw_feature tegra30_i2c_hw = {
> .has_multi_master_mode = false,
> .has_slcg_override_reg = false,
> .has_mst_fifo = false,
> + .has_mst_reset = false,
> .quirks = &tegra_i2c_quirks,
> .supports_bus_clear = false,
> .has_apb_dma = true,
> @@ -1515,6 +1537,7 @@ static const struct tegra_i2c_hw_feature tegra114_i2c_hw = {
> .has_multi_master_mode = false,
> .has_slcg_override_reg = false,
> .has_mst_fifo = false,
> + .has_mst_reset = false,
> .quirks = &tegra_i2c_quirks,
> .supports_bus_clear = true,
> .has_apb_dma = true,
> @@ -1539,6 +1562,7 @@ static const struct tegra_i2c_hw_feature tegra124_i2c_hw = {
> .has_multi_master_mode = false,
> .has_slcg_override_reg = true,
> .has_mst_fifo = false,
> + .has_mst_reset = false,
> .quirks = &tegra_i2c_quirks,
> .supports_bus_clear = true,
> .has_apb_dma = true,
> @@ -1563,6 +1587,7 @@ static const struct tegra_i2c_hw_feature tegra210_i2c_hw = {
> .has_multi_master_mode = false,
> .has_slcg_override_reg = true,
> .has_mst_fifo = false,
> + .has_mst_reset = false,
> .quirks = &tegra_i2c_quirks,
> .supports_bus_clear = true,
> .has_apb_dma = true,
> @@ -1587,6 +1612,7 @@ static const struct tegra_i2c_hw_feature tegra186_i2c_hw = {
> .has_multi_master_mode = false,
> .has_slcg_override_reg = true,
> .has_mst_fifo = false,
> + .has_mst_reset = false,
> .quirks = &tegra_i2c_quirks,
> .supports_bus_clear = true,
> .has_apb_dma = false,
> @@ -1611,6 +1637,7 @@ static const struct tegra_i2c_hw_feature tegra194_i2c_hw = {
> .has_multi_master_mode = true,
> .has_slcg_override_reg = true,
> .has_mst_fifo = true,
> + .has_mst_reset = true,
> .quirks = &tegra194_i2c_quirks,
> .supports_bus_clear = true,
> .has_apb_dma = false,
> @@ -1666,7 +1693,11 @@ static int tegra_i2c_init_reset(struct tegra_i2c_dev *i2c_dev)
> if (ACPI_HANDLE(i2c_dev->dev))
> return 0;
>
> - i2c_dev->rst = devm_reset_control_get_exclusive(i2c_dev->dev, "i2c");
> + if (i2c_dev->hw->has_mst_reset)
> + i2c_dev->rst = devm_reset_control_get_optional_exclusive(i2c_dev->dev, "i2c");
> + else
> + i2c_dev->rst = devm_reset_control_get_exclusive(i2c_dev->dev, "i2c");
This could just use devm_reset_control_get_optional_exclusive()
unconditionally. If the device tree correctly marked the required
resets as non-optional, DT checks would guarantee that required resets
are present in the device tree.
regards
Philipp
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/4] dt-bindings: i2c: Specify reset as optional
2025-05-06 9:59 [PATCH 1/4] dt-bindings: i2c: Specify reset as optional Akhil R
` (3 preceding siblings ...)
2025-05-06 10:11 ` [PATCH 1/4] dt-bindings: i2c: Specify reset as optional Philipp Zabel
@ 2025-05-08 15:09 ` Conor Dooley
2025-05-08 20:33 ` (subset) " Thierry Reding
2025-05-12 23:20 ` Andi Shyti
6 siblings, 0 replies; 11+ messages in thread
From: Conor Dooley @ 2025-05-08 15:09 UTC (permalink / raw)
To: Akhil R
Cc: andi.shyti, robh, krzk+dt, conor+dt, thierry.reding, jonathanh,
ldewangan, digetx, p.zabel, linux-i2c, devicetree, linux-tegra,
linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1351 bytes --]
On Tue, May 06, 2025 at 03:29:33PM +0530, Akhil R wrote:
> Specify reset as optional in the description for controllers that has an
> internal software reset available
Optionality of properties is not determined by text. The property is not
marked required in the binding, and therefore is optionally on all
platforms. If some platforms require it, you should submit a patch making
it mandatory there (via the required keyword).
Cheers,
Conor.
>
> Signed-off-by: Akhil R <akhilrajeev@nvidia.com>
> ---
> Documentation/devicetree/bindings/i2c/nvidia,tegra20-i2c.yaml | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/devicetree/bindings/i2c/nvidia,tegra20-i2c.yaml b/Documentation/devicetree/bindings/i2c/nvidia,tegra20-i2c.yaml
> index b57ae6963e62..19aefc022c8b 100644
> --- a/Documentation/devicetree/bindings/i2c/nvidia,tegra20-i2c.yaml
> +++ b/Documentation/devicetree/bindings/i2c/nvidia,tegra20-i2c.yaml
> @@ -97,7 +97,9 @@ properties:
>
> resets:
> items:
> - - description: module reset
> + - description: |
> + Module reset. This property is optional for controllers in Tegra194 and later
> + chips where an internal software reset is available as an alternative.
>
> reset-names:
> items:
> --
> 2.43.2
>
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: (subset) [PATCH 1/4] dt-bindings: i2c: Specify reset as optional
2025-05-06 9:59 [PATCH 1/4] dt-bindings: i2c: Specify reset as optional Akhil R
` (4 preceding siblings ...)
2025-05-08 15:09 ` Conor Dooley
@ 2025-05-08 20:33 ` Thierry Reding
2025-05-12 23:20 ` Andi Shyti
6 siblings, 0 replies; 11+ messages in thread
From: Thierry Reding @ 2025-05-08 20:33 UTC (permalink / raw)
To: andi.shyti, robh, krzk+dt, onor+dt, thierry.reding, jonathanh,
ldewangan, digetx, p.zabel, linux-i2c, devicetree, linux-tegra,
linux-kernel, Akhil R
From: Thierry Reding <treding@nvidia.com>
On Tue, 06 May 2025 15:29:33 +0530, Akhil R wrote:
> Specify reset as optional in the description for controllers that has an
> internal software reset available
>
>
Applied, thanks!
[4/4] arm64: tegra: Add I2C aliases for Tegra234
commit: 34c6ba89e1487181b4278e5c1b329327439ec715
Best regards,
--
Thierry Reding <treding@nvidia.com>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/4] dt-bindings: i2c: Specify reset as optional
2025-05-06 9:59 [PATCH 1/4] dt-bindings: i2c: Specify reset as optional Akhil R
` (5 preceding siblings ...)
2025-05-08 20:33 ` (subset) " Thierry Reding
@ 2025-05-12 23:20 ` Andi Shyti
2025-05-13 4:24 ` Akhil R
6 siblings, 1 reply; 11+ messages in thread
From: Andi Shyti @ 2025-05-12 23:20 UTC (permalink / raw)
To: Akhil R
Cc: robh, krzk+dt, conor+dt, thierry.reding, jonathanh, ldewangan,
digetx, p.zabel, linux-i2c, devicetree, linux-tegra, linux-kernel
Hi Akhil,
I am assuming you are going to send a v2 for patches 1 to 3 with
the proposed changes?
Andi
On Tue, May 06, 2025 at 03:29:33PM +0530, Akhil R wrote:
> Specify reset as optional in the description for controllers that has an
> internal software reset available
>
> Signed-off-by: Akhil R <akhilrajeev@nvidia.com>
> ---
> Documentation/devicetree/bindings/i2c/nvidia,tegra20-i2c.yaml | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/devicetree/bindings/i2c/nvidia,tegra20-i2c.yaml b/Documentation/devicetree/bindings/i2c/nvidia,tegra20-i2c.yaml
> index b57ae6963e62..19aefc022c8b 100644
> --- a/Documentation/devicetree/bindings/i2c/nvidia,tegra20-i2c.yaml
> +++ b/Documentation/devicetree/bindings/i2c/nvidia,tegra20-i2c.yaml
> @@ -97,7 +97,9 @@ properties:
>
> resets:
> items:
> - - description: module reset
> + - description: |
> + Module reset. This property is optional for controllers in Tegra194 and later
> + chips where an internal software reset is available as an alternative.
>
> reset-names:
> items:
> --
> 2.43.2
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* RE: [PATCH 1/4] dt-bindings: i2c: Specify reset as optional
2025-05-12 23:20 ` Andi Shyti
@ 2025-05-13 4:24 ` Akhil R
0 siblings, 0 replies; 11+ messages in thread
From: Akhil R @ 2025-05-13 4:24 UTC (permalink / raw)
To: Andi Shyti
Cc: robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org,
thierry.reding@gmail.com, Jon Hunter, Laxman Dewangan,
digetx@gmail.com, p.zabel@pengutronix.de,
linux-i2c@vger.kernel.org, devicetree@vger.kernel.org,
linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org
> Hi Akhil,
>
> I am assuming you are going to send a v2 for patches 1 to 3 with the proposed
> changes?
Hi Andi, Yes, I will send out a new version.
Thanks Philipp and Conor for the reviews. Will send an updated patch making
'reset' required for the appropriate compatible.
Regards,
Akhil
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2025-05-13 4:25 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-06 9:59 [PATCH 1/4] dt-bindings: i2c: Specify reset as optional Akhil R
2025-05-06 9:59 ` [PATCH 2/4] i2c: tegra: make reset an optional property Akhil R
2025-05-06 10:14 ` Philipp Zabel
2025-05-06 9:59 ` [PATCH 3/4] i2c: tegra: Remove dma_sync_*() calls Akhil R
2025-05-06 10:04 ` Akhil R
2025-05-06 9:59 ` [PATCH 4/4] arm64: tegra: Add I2C aliases for Tegra234 Akhil R
2025-05-06 10:11 ` [PATCH 1/4] dt-bindings: i2c: Specify reset as optional Philipp Zabel
2025-05-08 15:09 ` Conor Dooley
2025-05-08 20:33 ` (subset) " Thierry Reding
2025-05-12 23:20 ` Andi Shyti
2025-05-13 4:24 ` Akhil R
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox