* [PATCH 2/3] arm/dt: tegra: Use new compatible value for DVC I2C controller
[not found] ` <1324186101-23695-1-git-send-email-swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
@ 2011-12-18 5:28 ` Stephen Warren
2011-12-18 5:28 ` [PATCH 3/3] arm/dt: Add ADT7461 to Seaboard Stephen Warren
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Stephen Warren @ 2011-12-18 5:28 UTC (permalink / raw)
To: Olof Johansson, Colin Cross, Ben Dooks
Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA,
linux-i2c-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Stephen Warren
Update the device tree to indicate which I2C controller is the DVC
controller. AUXDATA needs to be updated too, since the compatible
value changed.
Signed-off-by: Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
---
It'd be best to apply this to the same tree as the previous patch. If
that doesn't happen, the DVC I2C driver won't be instantiated due to
the compatible value not being supported. In practice, this isn't an
issue though, since nothing uses the DVC I2C controller yet.
This relies on 0d4f747 "arm/tegra: convert tegra20 to GIC devicetree
binding" for context.
arch/arm/boot/dts/tegra20.dtsi | 2 +-
arch/arm/mach-tegra/board-dt.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm/boot/dts/tegra20.dtsi b/arch/arm/boot/dts/tegra20.dtsi
index 660c8ad..3da7afd 100644
--- a/arch/arm/boot/dts/tegra20.dtsi
+++ b/arch/arm/boot/dts/tegra20.dtsi
@@ -39,7 +39,7 @@
i2c@7000d000 {
#address-cells = <1>;
#size-cells = <0>;
- compatible = "nvidia,tegra20-i2c";
+ compatible = "nvidia,tegra20-i2c-dvc";
reg = <0x7000D000 0x200>;
interrupts = < 0 53 0x04 >;
};
diff --git a/arch/arm/mach-tegra/board-dt.c b/arch/arm/mach-tegra/board-dt.c
index b44633b..9abc89d 100644
--- a/arch/arm/mach-tegra/board-dt.c
+++ b/arch/arm/mach-tegra/board-dt.c
@@ -74,7 +74,7 @@ struct of_dev_auxdata tegra20_auxdata_lookup[] __initdata = {
OF_DEV_AUXDATA("nvidia,tegra20-i2c", TEGRA_I2C_BASE, "tegra-i2c.0", NULL),
OF_DEV_AUXDATA("nvidia,tegra20-i2c", TEGRA_I2C2_BASE, "tegra-i2c.1", NULL),
OF_DEV_AUXDATA("nvidia,tegra20-i2c", TEGRA_I2C3_BASE, "tegra-i2c.2", NULL),
- OF_DEV_AUXDATA("nvidia,tegra20-i2c", TEGRA_DVC_BASE, "tegra-i2c.3", NULL),
+ OF_DEV_AUXDATA("nvidia,tegra20-i2c-dvc", TEGRA_DVC_BASE, "tegra-i2c.3", NULL),
OF_DEV_AUXDATA("nvidia,tegra20-i2s", TEGRA_I2S1_BASE, "tegra-i2s.0", NULL),
OF_DEV_AUXDATA("nvidia,tegra20-i2s", TEGRA_I2S2_BASE, "tegra-i2s.1", NULL),
OF_DEV_AUXDATA("nvidia,tegra20-das", TEGRA_APB_MISC_DAS_BASE, "tegra-das", NULL),
--
1.7.5.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/3] arm/dt: Add ADT7461 to Seaboard
[not found] ` <1324186101-23695-1-git-send-email-swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2011-12-18 5:28 ` [PATCH 2/3] arm/dt: tegra: Use new compatible value for DVC I2C controller Stephen Warren
@ 2011-12-18 5:28 ` Stephen Warren
2011-12-18 5:41 ` [PATCH 1/3] i2c: tegra: Support DVC controller in device tree Olof Johansson
2011-12-18 15:42 ` Thierry Reding
3 siblings, 0 replies; 6+ messages in thread
From: Stephen Warren @ 2011-12-18 5:28 UTC (permalink / raw)
To: Olof Johansson, Colin Cross, Ben Dooks
Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA,
linux-i2c-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Stephen Warren
The ADT7461 is a temperature monitoring IC. One is present on the DVC
I2C bus on Seaboard.
Signed-off-by: Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
---
For this to be useful, the previous two patches are required. Without
them, all the I2C transactions to this device will time out and spew
errors, but other device shouldn't be affected.
arch/arm/boot/dts/tegra-seaboard.dts | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/arch/arm/boot/dts/tegra-seaboard.dts b/arch/arm/boot/dts/tegra-seaboard.dts
index 3cfbd04..b55a02e 100644
--- a/arch/arm/boot/dts/tegra-seaboard.dts
+++ b/arch/arm/boot/dts/tegra-seaboard.dts
@@ -25,6 +25,11 @@
i2c@7000d000 {
clock-frequency = <400000>;
+
+ adt7461@4c {
+ compatible = "adt7461";
+ reg = <0x4c>;
+ };
};
serial@70006000 {
--
1.7.5.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/3] i2c: tegra: Support DVC controller in device tree
[not found] ` <1324186101-23695-1-git-send-email-swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2011-12-18 5:28 ` [PATCH 2/3] arm/dt: tegra: Use new compatible value for DVC I2C controller Stephen Warren
2011-12-18 5:28 ` [PATCH 3/3] arm/dt: Add ADT7461 to Seaboard Stephen Warren
@ 2011-12-18 5:41 ` Olof Johansson
2011-12-18 15:42 ` Thierry Reding
3 siblings, 0 replies; 6+ messages in thread
From: Olof Johansson @ 2011-12-18 5:41 UTC (permalink / raw)
To: Stephen Warren
Cc: Colin Cross, Ben Dooks, linux-tegra-u79uwXL29TY76Z2rM5mHXA,
linux-i2c-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ
Hi,
On Sat, Dec 17, 2011 at 10:28:19PM -0700, Stephen Warren wrote:
> One of the Tegra I2C blocks is inside the DVC (Digital Voltage Controller)
> block. This block is identical to the rest of the I2C blocks, except that
> it only supports master mode, it has registers moved around, and it needs
> some extra init to get it into I2C mode. The register moves are handled
> by i2c_readl and i2c_writel
>
> This patch adds a new compatible value for controllers of this "DVC"
> type; I figured that this approach was reasonable, as opposed to adding
> an is-dvc property under the existing compatible value, since the HW
> truly is different.
>
> Signed-off-by: Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
> ---
> Ben, it'd probably be simplest if you could ack this patch, and we
> could take it through the Tegra tree.
>
> drivers/i2c/busses/i2c-tegra.c | 37 +++++++++++++++++++++++++------------
> 1 files changed, 25 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
> index 46b6500..c264e8c 100644
> --- a/drivers/i2c/busses/i2c-tegra.c
> +++ b/drivers/i2c/busses/i2c-tegra.c
> @@ -26,6 +26,7 @@
> #include <linux/delay.h>
> #include <linux/slab.h>
> #include <linux/i2c-tegra.h>
> +#include <linux/of_device.h>
> #include <linux/of_i2c.h>
> #include <linux/module.h>
>
> @@ -558,6 +559,18 @@ static const struct i2c_algorithm tegra_i2c_algo = {
> .functionality = tegra_i2c_func,
> };
>
> +#if defined(CONFIG_OF)
> +/* Match table for of_platform binding */
> +static const struct of_device_id tegra_i2c_of_match[] __devinitconst = {
> + { .compatible = "nvidia,tegra20-i2c", .data = (void *)0},
> + { .compatible = "nvidia,tegra20-i2c-dvc", .data = (void *)1},
> + {},
> +};
> +MODULE_DEVICE_TABLE(of, tegra_i2c_of_match);
> +#else
> +#define tegra_i2c_of_match NULL
> +#endif
> +
> static int tegra_i2c_probe(struct platform_device *pdev)
> {
> struct tegra_i2c_dev *i2c_dev;
> @@ -636,7 +649,18 @@ static int tegra_i2c_probe(struct platform_device *pdev)
> i2c_dev->bus_clk_rate = be32_to_cpup(prop);
> }
>
> - if (pdev->id == 3)
> +#if defined(CONFIG_OF)
> + if (pdev->dev.of_node) {
> + const struct of_device_id *match;
> +
> + match = of_match_device(tegra_i2c_of_match, &pdev->dev);
> + if (!match)
> + return -EINVAL;
> +
> + i2c_dev->is_dvc = match->data;
I would rather see a:
i2c_dev->is_dvc = of_device_is_compatible(pdev->dev.of_node,
"nvidia,tegra20-i2c-dvc");
...instead of passing a flag through the match data.
-Olof
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/3] i2c: tegra: Support DVC controller in device tree
[not found] ` <1324186101-23695-1-git-send-email-swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
` (2 preceding siblings ...)
2011-12-18 5:41 ` [PATCH 1/3] i2c: tegra: Support DVC controller in device tree Olof Johansson
@ 2011-12-18 15:42 ` Thierry Reding
[not found] ` <20111218154208.GA5600-RM9K5IK7kjIQXX3q8xo1gnVAuStQJXxyR5q1nwbD4aMs9pC9oP6+/A@public.gmane.org>
3 siblings, 1 reply; 6+ messages in thread
From: Thierry Reding @ 2011-12-18 15:42 UTC (permalink / raw)
To: Stephen Warren
Cc: Olof Johansson, Colin Cross, Ben Dooks,
linux-tegra-u79uwXL29TY76Z2rM5mHXA,
linux-i2c-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ
[-- Attachment #1: Type: text/plain, Size: 562 bytes --]
* Stephen Warren wrote:
[...]
> @@ -636,7 +649,18 @@ static int tegra_i2c_probe(struct platform_device *pdev)
> i2c_dev->bus_clk_rate = be32_to_cpup(prop);
> }
>
> - if (pdev->id == 3)
> +#if defined(CONFIG_OF)
> + if (pdev->dev.of_node) {
> + const struct of_device_id *match;
> +
> + match = of_match_device(tegra_i2c_of_match, &pdev->dev);
> + if (!match)
> + return -EINVAL;
> +
> + i2c_dev->is_dvc = match->data;
> + }
> +#endif
> + else if (pdev->id == 3)
Shouldn't the "else" move into the CONFIG_OF branch?
Thierry
[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread