devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/5]  i2c: meson-axg: add I2C controller driver
@ 2017-11-20 14:54 Yixun Lan
  2017-11-20 14:54 ` [PATCH v2 1/5] dt-bindings: i2c: update documentation for the Meson-AXG Yixun Lan
                   ` (5 more replies)
  0 siblings, 6 replies; 15+ messages in thread
From: Yixun Lan @ 2017-11-20 14:54 UTC (permalink / raw)
  To: Wolfram Sang, Rob Herring, Mark Rutland, linux-i2c, devicetree,
	Kevin Hilman
  Cc: Neil Armstrong, Jerome Brunet, Carlo Caione, Yixun Lan, Jian Hu,
	linux-amlogic, linux-arm-kernel, linux-kernel

This patch set try to add I2C controller driver for
the Amlogic's Meson-AXG SoC.

Changes since v1 [1]
 - update dt-bindings doc (Neil Armstrong)
 - make meson_i2c_data const (Martin Blumenstingl)
 - DTS: adjust naming, change from the 'i2c_m0' to 'i2c0' style

[1] http://lkml.kernel.org/r/20171117080236.32504-1-yixun.lan@amlogic.com

Jian Hu (5):
  dt-bindings: i2c: update documentation for the Meson-AXG
  i2c: meson: add configurable divider factors
  ARM64: dts: meson-axg: add I2C DT info for Meson-AXG SoC
  ARM64: dts: meson-axg: describe pin DT info for I2C controller
  ARM64: dts: meson-axg: enable I2C Master-1 for the audio speaker

 .../devicetree/bindings/i2c/i2c-meson.txt          |   6 +-
 arch/arm64/boot/dts/amlogic/meson-axg-s400.dts     |   6 +
 arch/arm64/boot/dts/amlogic/meson-axg.dtsi         | 123 +++++++++++++++++++++
 drivers/i2c/busses/i2c-meson.c                     |  32 +++++-
 4 files changed, 162 insertions(+), 5 deletions(-)

-- 
2.15.0

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH v2 1/5] dt-bindings: i2c: update documentation for the Meson-AXG
  2017-11-20 14:54 [PATCH v2 0/5] i2c: meson-axg: add I2C controller driver Yixun Lan
@ 2017-11-20 14:54 ` Yixun Lan
  2017-11-20 21:33   ` Rob Herring
       [not found]   ` <20171120145415.6581-2-yixun.lan-LpR1jeaWuhtBDgjK7y7TUQ@public.gmane.org>
  2017-11-20 14:54 ` [PATCH v2 2/5] i2c: meson: add configurable divider factors Yixun Lan
                   ` (4 subsequent siblings)
  5 siblings, 2 replies; 15+ messages in thread
From: Yixun Lan @ 2017-11-20 14:54 UTC (permalink / raw)
  To: Wolfram Sang, Rob Herring, Mark Rutland, linux-i2c, devicetree,
	Kevin Hilman
  Cc: Neil Armstrong, Jerome Brunet, Carlo Caione, Yixun Lan, Jian Hu,
	linux-amlogic, linux-arm-kernel, linux-kernel

From: Jian Hu <jian.hu@amlogic.com>

Update the doc to explicitly add Meson-AXG to support list

Signed-off-by: Jian Hu <jian.hu@amlogic.com>
Signed-off-by: Yixun Lan <yixun.lan@amlogic.com>
---
 Documentation/devicetree/bindings/i2c/i2c-meson.txt | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/i2c/i2c-meson.txt b/Documentation/devicetree/bindings/i2c/i2c-meson.txt
index 611b934c7e10..13d410de077c 100644
--- a/Documentation/devicetree/bindings/i2c/i2c-meson.txt
+++ b/Documentation/devicetree/bindings/i2c/i2c-meson.txt
@@ -1,7 +1,11 @@
 Amlogic Meson I2C controller
 
 Required properties:
- - compatible: must be "amlogic,meson6-i2c" or "amlogic,meson-gxbb-i2c"
+ - compatible: must be:
+	"amlogic,meson6-i2c" for Meson8 and compatible SoCs
+	"amlogic,meson-gxbb-i2c" for GXBB and compatible SoCs
+	"amlogic,meson-axg-i2c"for AXG and compatible SoCs
+
  - reg: physical address and length of the device registers
  - interrupts: a single interrupt specifier
  - clocks: clock for the device
-- 
2.15.0

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH v2 2/5] i2c: meson: add configurable divider factors
  2017-11-20 14:54 [PATCH v2 0/5] i2c: meson-axg: add I2C controller driver Yixun Lan
  2017-11-20 14:54 ` [PATCH v2 1/5] dt-bindings: i2c: update documentation for the Meson-AXG Yixun Lan
@ 2017-11-20 14:54 ` Yixun Lan
  2017-12-13 13:52   ` Yixun Lan
  2018-01-24  6:28   ` [v2,2/5] " Wolfram Sang
  2017-11-20 14:54 ` [PATCH v2 3/5] ARM64: dts: meson-axg: add I2C DT info for Meson-AXG SoC Yixun Lan
                   ` (3 subsequent siblings)
  5 siblings, 2 replies; 15+ messages in thread
From: Yixun Lan @ 2017-11-20 14:54 UTC (permalink / raw)
  To: Wolfram Sang, Rob Herring, Mark Rutland, linux-i2c, devicetree,
	Kevin Hilman
  Cc: Neil Armstrong, Jerome Brunet, Carlo Caione, Yixun Lan, Jian Hu,
	linux-amlogic, linux-arm-kernel, linux-kernel

From: Jian Hu <jian.hu@amlogic.com>

This patch try to add support for I2C controller in Meson-AXG SoC,
Due to the IP changes between I2C controller, we need to introduce
a compatible data to make the divider factor configurable.

Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Jian Hu <jian.hu@amlogic.com>
Signed-off-by: Yixun Lan <yixun.lan@amlogic.com>
---
 drivers/i2c/busses/i2c-meson.c | 32 ++++++++++++++++++++++++++++----
 1 file changed, 28 insertions(+), 4 deletions(-)

diff --git a/drivers/i2c/busses/i2c-meson.c b/drivers/i2c/busses/i2c-meson.c
index 88d15b92ec35..37c4aa76f37a 100644
--- a/drivers/i2c/busses/i2c-meson.c
+++ b/drivers/i2c/busses/i2c-meson.c
@@ -16,6 +16,7 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/of.h>
+#include <linux/of_device.h>
 #include <linux/platform_device.h>
 #include <linux/types.h>
 
@@ -57,6 +58,10 @@ enum {
 	STATE_WRITE,
 };
 
+struct meson_i2c_data {
+	unsigned char div_factor;
+};
+
 /**
  * struct meson_i2c - Meson I2C device private data
  *
@@ -93,6 +98,8 @@ struct meson_i2c {
 	struct completion	done;
 	u32			tokens[2];
 	int			num_tokens;
+
+	const struct meson_i2c_data *data;
 };
 
 static void meson_i2c_set_mask(struct meson_i2c *i2c, int reg, u32 mask,
@@ -128,7 +135,7 @@ static void meson_i2c_set_clk_div(struct meson_i2c *i2c, unsigned int freq)
 	unsigned long clk_rate = clk_get_rate(i2c->clk);
 	unsigned int div;
 
-	div = DIV_ROUND_UP(clk_rate, freq * 4);
+	div = DIV_ROUND_UP(clk_rate, freq * i2c->data->div_factor);
 
 	/* clock divider has 12 bits */
 	if (div >= (1 << 12)) {
@@ -376,6 +383,9 @@ static int meson_i2c_probe(struct platform_device *pdev)
 	spin_lock_init(&i2c->lock);
 	init_completion(&i2c->done);
 
+	i2c->data = (const struct meson_i2c_data *)
+		of_device_get_match_data(&pdev->dev);
+
 	i2c->clk = devm_clk_get(&pdev->dev, NULL);
 	if (IS_ERR(i2c->clk)) {
 		dev_err(&pdev->dev, "can't get device clock\n");
@@ -440,11 +450,25 @@ static int meson_i2c_remove(struct platform_device *pdev)
 	return 0;
 }
 
+static const struct meson_i2c_data i2c_meson6_data = {
+	.div_factor = 4,
+};
+
+static const struct meson_i2c_data i2c_gxbb_data = {
+	.div_factor = 4,
+};
+
+static const struct meson_i2c_data i2c_axg_data = {
+	.div_factor = 3,
+};
+
 static const struct of_device_id meson_i2c_match[] = {
-	{ .compatible = "amlogic,meson6-i2c" },
-	{ .compatible = "amlogic,meson-gxbb-i2c" },
-	{ },
+	{ .compatible = "amlogic,meson6-i2c", .data = &i2c_meson6_data },
+	{ .compatible = "amlogic,meson-gxbb-i2c", .data = &i2c_gxbb_data },
+	{ .compatible = "amlogic,meson-axg-i2c", .data = &i2c_axg_data },
+	{},
 };
+
 MODULE_DEVICE_TABLE(of, meson_i2c_match);
 
 static struct platform_driver meson_i2c_driver = {
-- 
2.15.0

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH v2 3/5] ARM64: dts: meson-axg: add I2C DT info for Meson-AXG SoC
  2017-11-20 14:54 [PATCH v2 0/5] i2c: meson-axg: add I2C controller driver Yixun Lan
  2017-11-20 14:54 ` [PATCH v2 1/5] dt-bindings: i2c: update documentation for the Meson-AXG Yixun Lan
  2017-11-20 14:54 ` [PATCH v2 2/5] i2c: meson: add configurable divider factors Yixun Lan
@ 2017-11-20 14:54 ` Yixun Lan
  2017-11-20 14:54 ` [PATCH v2 4/5] ARM64: dts: meson-axg: describe pin DT info for I2C controller Yixun Lan
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 15+ messages in thread
From: Yixun Lan @ 2017-11-20 14:54 UTC (permalink / raw)
  To: Wolfram Sang, Rob Herring, Mark Rutland, linux-i2c, devicetree,
	Kevin Hilman
  Cc: Neil Armstrong, Jerome Brunet, Carlo Caione, Yixun Lan, Jian Hu,
	linux-amlogic, linux-arm-kernel, linux-kernel

From: Jian Hu <jian.hu@amlogic.com>

There are four I2C masters in EE domain, and one I2C Master in
AO domain, the DT info here should describe them all.

Signed-off-by: Jian Hu <jian.hu@amlogic.com>
Signed-off-by: Yixun Lan <yixun.lan@amlogic.com>
---
 arch/arm64/boot/dts/amlogic/meson-axg.dtsi | 59 ++++++++++++++++++++++++++++++
 1 file changed, 59 insertions(+)

diff --git a/arch/arm64/boot/dts/amlogic/meson-axg.dtsi b/arch/arm64/boot/dts/amlogic/meson-axg.dtsi
index 57faaa9d8013..b8ddec6e2cbe 100644
--- a/arch/arm64/boot/dts/amlogic/meson-axg.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-axg.dtsi
@@ -129,6 +129,54 @@
 				#reset-cells = <1>;
 			};
 
+			i2c0: i2c@1f000 {
+				compatible = "amlogic,meson-axg-i2c";
+				status = "disabled";
+				reg = <0x0 0x1f000 0x0 0x20>;
+				interrupts = <GIC_SPI 21 IRQ_TYPE_EDGE_RISING>,
+					<GIC_SPI 47 IRQ_TYPE_EDGE_RISING>;
+				#address-cells = <1>;
+				#size-cells = <0>;
+				clocks = <&clkc CLKID_I2C>;
+				clock-names = "clk_i2c";
+			};
+
+			i2c1: i2c@1e000 {
+				compatible = "amlogic,meson-axg-i2c";
+				#address-cells = <1>;
+				#size-cells = <0>;
+				reg = <0x0 0x1e000 0x0 0x20>;
+				status = "disabled";
+				interrupts = <GIC_SPI 214 IRQ_TYPE_EDGE_RISING>,
+					<GIC_SPI 48 IRQ_TYPE_EDGE_RISING>;
+				clocks = <&clkc CLKID_I2C>;
+				clock-names = "clk_i2c";
+			};
+
+			i2c2: i2c@1d000 {
+				compatible = "amlogic,meson-axg-i2c";
+				status = "disabled";
+				reg = <0x0 0x1d000 0x0 0x20>;
+				interrupts = <GIC_SPI 215 IRQ_TYPE_EDGE_RISING>,
+					<GIC_SPI 49 IRQ_TYPE_EDGE_RISING>;
+				#address-cells = <1>;
+				#size-cells = <0>;
+				clocks = <&clkc CLKID_I2C>;
+				clock-names = "clk_i2c";
+			};
+
+			i2c3: i2c@1c000 {
+				compatible = "amlogic,meson-axg-i2c";
+				status = "disabled";
+				reg = <0x0 0x1c000 0x0 0x20>;
+				interrupts = <GIC_SPI 39 IRQ_TYPE_EDGE_RISING>,
+					<GIC_SPI 50 IRQ_TYPE_EDGE_RISING>;
+				#address-cells = <1>;
+				#size-cells = <0>;
+				clocks = <&clkc CLKID_I2C>;
+				clock-names = "clk_i2c";
+			};
+
 			uart_A: serial@24000 {
 				compatible = "amlogic,meson-gx-uart", "amlogic,meson-uart";
 				reg = <0x0 0x24000 0x0 0x14>;
@@ -312,6 +360,17 @@
 				};
 			};
 
+			i2c_AO: i2c@5000 {
+				compatible = "amlogic,meson-axg-i2c";
+				status = "disabled";
+				reg = <0x0 0x05000 0x0 0x20>;
+				interrupts = <GIC_SPI 195 IRQ_TYPE_EDGE_RISING>;
+				#address-cells = <1>;
+				#size-cells = <0>;
+				clocks = <&clkc CLKID_I2C>;
+				clock-names = "clk_i2c";
+			};
+
 			uart_AO: serial@3000 {
 				compatible = "amlogic,meson-gx-uart", "amlogic,meson-ao-uart";
 				reg = <0x0 0x3000 0x0 0x18>;
-- 
2.15.0

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH v2 4/5] ARM64: dts: meson-axg: describe pin DT info for I2C controller
  2017-11-20 14:54 [PATCH v2 0/5] i2c: meson-axg: add I2C controller driver Yixun Lan
                   ` (2 preceding siblings ...)
  2017-11-20 14:54 ` [PATCH v2 3/5] ARM64: dts: meson-axg: add I2C DT info for Meson-AXG SoC Yixun Lan
@ 2017-11-20 14:54 ` Yixun Lan
  2017-11-20 14:54 ` [PATCH v2 5/5] ARM64: dts: meson-axg: enable I2C Master-1 for the audio speaker Yixun Lan
  2018-01-17  0:28 ` [PATCH v2 0/5] i2c: meson-axg: add I2C controller driver Kevin Hilman
  5 siblings, 0 replies; 15+ messages in thread
From: Yixun Lan @ 2017-11-20 14:54 UTC (permalink / raw)
  To: Wolfram Sang, Rob Herring, Mark Rutland, linux-i2c, devicetree,
	Kevin Hilman
  Cc: Neil Armstrong, Jerome Brunet, Carlo Caione, Yixun Lan, Jian Hu,
	linux-amlogic, linux-arm-kernel, linux-kernel

From: Jian Hu <jian.hu@amlogic.com>

Describe all the pin mux for the I2C controller which found in
Meson-AXG SoC.

Signed-off-by: Jian Hu <jian.hu@amlogic.com>
Signed-off-by: Yixun Lan <yixun.lan@amlogic.com>
---
 arch/arm64/boot/dts/amlogic/meson-axg.dtsi | 64 ++++++++++++++++++++++++++++++
 1 file changed, 64 insertions(+)

diff --git a/arch/arm64/boot/dts/amlogic/meson-axg.dtsi b/arch/arm64/boot/dts/amlogic/meson-axg.dtsi
index b8ddec6e2cbe..51e2262e5277 100644
--- a/arch/arm64/boot/dts/amlogic/meson-axg.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-axg.dtsi
@@ -304,6 +304,70 @@
 						function = "eth";
 					};
 				};
+
+				i2c0_pins: i2c0 {
+					mux {
+						groups = "i2c0_sck",
+							"i2c0_sda";
+						function = "i2c0";
+					};
+				};
+
+				i2c1_z_pins: i2c1_z {
+					mux {
+						groups = "i2c1_sck_z",
+							"i2c1_sda_z";
+						function = "i2c1";
+					};
+				};
+
+				i2c1_x_pins: i2c1_x {
+					mux {
+						groups = "i2c1_sck_x",
+							"i2c1_sda_x";
+						function = "i2c1";
+					};
+				};
+
+				i2c2_x_pins: i2c2_x {
+					mux {
+						groups = "i2c2_sck_x",
+							"i2c2_sda_x";
+						function = "i2c2";
+					};
+				};
+
+				i2c2_a_pins: i2c2_a {
+					mux {
+						groups = "i2c2_sck_a",
+							"i2c2_sda_a";
+						function = "i2c2";
+					};
+				};
+
+				i2c3_a6_pins: i2c3_a6 {
+					mux {
+						groups = "i2c3_sda_a6",
+							"i2c3_sck_a7";
+						function = "i2c3";
+					};
+				};
+
+				i2c3_a12_pins: i2c3_a12 {
+					mux {
+						groups = "i2c3_sda_a12",
+							"i2c3_sck_a13";
+						function = "i2c3";
+					};
+				};
+
+				i2c3_a19_pins: i2c3_a19 {
+					mux {
+						groups = "i2c3_sda_a19",
+							"i2c3_sck_a20";
+						function = "i2c3";
+					};
+				};
 			};
 		};
 
-- 
2.15.0

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH v2 5/5] ARM64: dts: meson-axg: enable I2C Master-1 for the audio speaker
  2017-11-20 14:54 [PATCH v2 0/5] i2c: meson-axg: add I2C controller driver Yixun Lan
                   ` (3 preceding siblings ...)
  2017-11-20 14:54 ` [PATCH v2 4/5] ARM64: dts: meson-axg: describe pin DT info for I2C controller Yixun Lan
@ 2017-11-20 14:54 ` Yixun Lan
  2018-01-17  0:28 ` [PATCH v2 0/5] i2c: meson-axg: add I2C controller driver Kevin Hilman
  5 siblings, 0 replies; 15+ messages in thread
From: Yixun Lan @ 2017-11-20 14:54 UTC (permalink / raw)
  To: Wolfram Sang, Rob Herring, Mark Rutland, linux-i2c, devicetree,
	Kevin Hilman
  Cc: Neil Armstrong, Jerome Brunet, Carlo Caione, Yixun Lan, Jian Hu,
	linux-amlogic, linux-arm-kernel, linux-kernel

From: Jian Hu <jian.hu@amlogic.com>

In the S400 board, The I2C master-1 is connecting to
the audio speaker daughter board.

Signed-off-by: Jian Hu <jian.hu@amlogic.com>
Signed-off-by: Yixun Lan <yixun.lan@amlogic.com>
---
 arch/arm64/boot/dts/amlogic/meson-axg-s400.dts | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/arm64/boot/dts/amlogic/meson-axg-s400.dts b/arch/arm64/boot/dts/amlogic/meson-axg-s400.dts
index 7b39a9fe2b0f..0864d1ff2d9b 100644
--- a/arch/arm64/boot/dts/amlogic/meson-axg-s400.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-axg-s400.dts
@@ -28,3 +28,9 @@
 	pinctrl-0 = <&eth_rgmii_y_pins>;
 	pinctrl-names = "default";
 };
+
+&i2c1 {
+	status = "okay";
+	pinctrl-0 = <&i2c1_z_pins>;
+	pinctrl-names = "default";
+};
-- 
2.15.0

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH v2 1/5] dt-bindings: i2c: update documentation for the Meson-AXG
  2017-11-20 14:54 ` [PATCH v2 1/5] dt-bindings: i2c: update documentation for the Meson-AXG Yixun Lan
@ 2017-11-20 21:33   ` Rob Herring
       [not found]   ` <20171120145415.6581-2-yixun.lan-LpR1jeaWuhtBDgjK7y7TUQ@public.gmane.org>
  1 sibling, 0 replies; 15+ messages in thread
From: Rob Herring @ 2017-11-20 21:33 UTC (permalink / raw)
  To: Yixun Lan
  Cc: Wolfram Sang, Mark Rutland, linux-i2c, devicetree, Kevin Hilman,
	Neil Armstrong, Jerome Brunet, Carlo Caione, Jian Hu,
	linux-amlogic, linux-arm-kernel, linux-kernel

On Mon, Nov 20, 2017 at 10:54:11PM +0800, Yixun Lan wrote:
> From: Jian Hu <jian.hu@amlogic.com>
> 
> Update the doc to explicitly add Meson-AXG to support list
> 
> Signed-off-by: Jian Hu <jian.hu@amlogic.com>
> Signed-off-by: Yixun Lan <yixun.lan@amlogic.com>
> ---
>  Documentation/devicetree/bindings/i2c/i2c-meson.txt | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)

Acked-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v2 2/5] i2c: meson: add configurable divider factors
  2017-11-20 14:54 ` [PATCH v2 2/5] i2c: meson: add configurable divider factors Yixun Lan
@ 2017-12-13 13:52   ` Yixun Lan
  2018-01-24  6:28   ` [v2,2/5] " Wolfram Sang
  1 sibling, 0 replies; 15+ messages in thread
From: Yixun Lan @ 2017-12-13 13:52 UTC (permalink / raw)
  To: Wolfram Sang, Rob Herring, Mark Rutland, linux-i2c, devicetree,
	Kevin Hilman
  Cc: yixun.lan, Neil Armstrong, Jerome Brunet, Carlo Caione, Jian Hu,
	linux-amlogic, linux-arm-kernel, linux-kernel

Hi Wolfram

On 11/20/2017 10:54 PM, Yixun Lan wrote:
> From: Jian Hu <jian.hu@amlogic.com>
> 
> This patch try to add support for I2C controller in Meson-AXG SoC,
> Due to the IP changes between I2C controller, we need to introduce
> a compatible data to make the divider factor configurable.
> 
> Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
> Signed-off-by: Jian Hu <jian.hu@amlogic.com>
> Signed-off-by: Yixun Lan <yixun.lan@amlogic.com>
> ---
>  drivers/i2c/busses/i2c-meson.c | 32 ++++++++++++++++++++++++++++----
>  1 file changed, 28 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-meson.c b/drivers/i2c/busses/i2c-meson.c
> index 88d15b92ec35..37c4aa76f37a 100644
> --- a/drivers/i2c/busses/i2c-meson.c
> +++ b/drivers/i2c/busses/i2c-meson.c
> @@ -16,6 +16,7 @@
>  #include <linux/kernel.h>
>  #include <linux/module.h>
>  #include <linux/of.h>
> +#include <linux/of_device.h>
>  #include <linux/platform_device.h>
>  #include <linux/types.h>
>  
> @@ -57,6 +58,10 @@ enum {
>  	STATE_WRITE,
>  };
>  
> +struct meson_i2c_data {
> +	unsigned char div_factor;
> +};
> +
>  /**
>   * struct meson_i2c - Meson I2C device private data
>   *
> @@ -93,6 +98,8 @@ struct meson_i2c {
>  	struct completion	done;
>  	u32			tokens[2];
>  	int			num_tokens;
> +
> +	const struct meson_i2c_data *data;
>  };
>  
>  static void meson_i2c_set_mask(struct meson_i2c *i2c, int reg, u32 mask,
> @@ -128,7 +135,7 @@ static void meson_i2c_set_clk_div(struct meson_i2c *i2c, unsigned int freq)
>  	unsigned long clk_rate = clk_get_rate(i2c->clk);
>  	unsigned int div;
>  
> -	div = DIV_ROUND_UP(clk_rate, freq * 4);
> +	div = DIV_ROUND_UP(clk_rate, freq * i2c->data->div_factor);
>  
>  	/* clock divider has 12 bits */
>  	if (div >= (1 << 12)) {
> @@ -376,6 +383,9 @@ static int meson_i2c_probe(struct platform_device *pdev)
>  	spin_lock_init(&i2c->lock);
>  	init_completion(&i2c->done);
>  
> +	i2c->data = (const struct meson_i2c_data *)
> +		of_device_get_match_data(&pdev->dev);
> +
>  	i2c->clk = devm_clk_get(&pdev->dev, NULL);
>  	if (IS_ERR(i2c->clk)) {
>  		dev_err(&pdev->dev, "can't get device clock\n");
> @@ -440,11 +450,25 @@ static int meson_i2c_remove(struct platform_device *pdev)
>  	return 0;
>  }
>  
> +static const struct meson_i2c_data i2c_meson6_data = {
> +	.div_factor = 4,
> +};
> +
> +static const struct meson_i2c_data i2c_gxbb_data = {
> +	.div_factor = 4,
> +};
> +
> +static const struct meson_i2c_data i2c_axg_data = {
> +	.div_factor = 3,
> +};
> +
>  static const struct of_device_id meson_i2c_match[] = {
> -	{ .compatible = "amlogic,meson6-i2c" },
> -	{ .compatible = "amlogic,meson-gxbb-i2c" },
> -	{ },
> +	{ .compatible = "amlogic,meson6-i2c", .data = &i2c_meson6_data },
> +	{ .compatible = "amlogic,meson-gxbb-i2c", .data = &i2c_gxbb_data },
> +	{ .compatible = "amlogic,meson-axg-i2c", .data = &i2c_axg_data },
> +	{},
>  };
> +
>  MODULE_DEVICE_TABLE(of, meson_i2c_match);
>  
>  static struct platform_driver meson_i2c_driver = {
> 


this is merely a ping, do you have any comment on this patch?
or could you take this patch along with patch 1 [1](with Rob's Ack) if
you think it's ready/good?

thanks

[1]
http://lists.infradead.org/pipermail/linux-amlogic/2017-November/005405.html
http://lists.infradead.org/pipermail/linux-amlogic/2017-November/005417.html

Yixun

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v2 0/5]  i2c: meson-axg: add I2C controller driver
  2017-11-20 14:54 [PATCH v2 0/5] i2c: meson-axg: add I2C controller driver Yixun Lan
                   ` (4 preceding siblings ...)
  2017-11-20 14:54 ` [PATCH v2 5/5] ARM64: dts: meson-axg: enable I2C Master-1 for the audio speaker Yixun Lan
@ 2018-01-17  0:28 ` Kevin Hilman
       [not found]   ` <7ho9ltba6c.fsf-rdvid1DuHRBWk0Htik3J/w@public.gmane.org>
  5 siblings, 1 reply; 15+ messages in thread
From: Kevin Hilman @ 2018-01-17  0:28 UTC (permalink / raw)
  To: Wolfram Sang, Yixun Lan
  Cc: Rob Herring, Mark Rutland, linux-i2c, devicetree, Neil Armstrong,
	Jerome Brunet, Carlo Caione, Jian Hu, linux-amlogic,
	linux-arm-kernel, linux-kernel

Hi Wolfram,

Yixun Lan <yixun.lan@amlogic.com> writes:

> This patch set try to add I2C controller driver for
> the Amlogic's Meson-AXG SoC.
>
> Changes since v1 [1]
>  - update dt-bindings doc (Neil Armstrong)
>  - make meson_i2c_data const (Martin Blumenstingl)
>  - DTS: adjust naming, change from the 'i2c_m0' to 'i2c0' style
>
> [1] http://lkml.kernel.org/r/20171117080236.32504-1-yixun.lan@amlogic.com
>
> Jian Hu (5):
>   dt-bindings: i2c: update documentation for the Meson-AXG
>   i2c: meson: add configurable divider factors

Could you have a look at these two patches?  They've been
acked/reviewed/tested and are just waiting your review/merge.

>   ARM64: dts: meson-axg: add I2C DT info for Meson-AXG SoC
>   ARM64: dts: meson-axg: describe pin DT info for I2C controller
>   ARM64: dts: meson-axg: enable I2C Master-1 for the audio speaker

Once you've merged, I'll take the DT patches through my amlogic tree.

Thanks,

Kevin

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [v2,1/5] dt-bindings: i2c: update documentation for the Meson-AXG
       [not found]   ` <20171120145415.6581-2-yixun.lan-LpR1jeaWuhtBDgjK7y7TUQ@public.gmane.org>
@ 2018-01-24  6:26     ` Wolfram Sang
  0 siblings, 0 replies; 15+ messages in thread
From: Wolfram Sang @ 2018-01-24  6:26 UTC (permalink / raw)
  To: Yixun Lan
  Cc: Rob Herring, Mark Rutland, linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Kevin Hilman, Neil Armstrong,
	Jerome Brunet, Carlo Caione, Jian Hu,
	linux-amlogic-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 459 bytes --]

On Mon, Nov 20, 2017 at 10:54:11PM +0800, Yixun Lan wrote:
> From: Jian Hu <jian.hu-LpR1jeaWuhtBDgjK7y7TUQ@public.gmane.org>
> 
> Update the doc to explicitly add Meson-AXG to support list
> 
> Signed-off-by: Jian Hu <jian.hu-LpR1jeaWuhtBDgjK7y7TUQ@public.gmane.org>
> Signed-off-by: Yixun Lan <yixun.lan-LpR1jeaWuhtBDgjK7y7TUQ@public.gmane.org>
> Acked-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>

Applied to for-next, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [v2,2/5] i2c: meson: add configurable divider factors
  2017-11-20 14:54 ` [PATCH v2 2/5] i2c: meson: add configurable divider factors Yixun Lan
  2017-12-13 13:52   ` Yixun Lan
@ 2018-01-24  6:28   ` Wolfram Sang
  2018-01-24  6:51     ` Yixun Lan
  1 sibling, 1 reply; 15+ messages in thread
From: Wolfram Sang @ 2018-01-24  6:28 UTC (permalink / raw)
  To: Yixun Lan
  Cc: Rob Herring, Mark Rutland, linux-i2c, devicetree, Kevin Hilman,
	Neil Armstrong, Jerome Brunet, Carlo Caione, Jian Hu,
	linux-amlogic, linux-arm-kernel, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 766 bytes --]

On Mon, Nov 20, 2017 at 10:54:12PM +0800, Yixun Lan wrote:
> From: Jian Hu <jian.hu@amlogic.com>
> 
> This patch try to add support for I2C controller in Meson-AXG SoC,
> Due to the IP changes between I2C controller, we need to introduce
> a compatible data to make the divider factor configurable.
> 
> Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
> Signed-off-by: Jian Hu <jian.hu@amlogic.com>
> Signed-off-by: Yixun Lan <yixun.lan@amlogic.com>

Applied to for-next, thanks!

But I got two build warnings, please fix them with an incremental patch:

drivers/i2c/busses/i2c-meson.c:103: warning: No description found for parameter 'data'
drivers/i2c/busses/i2c-meson.c:103: warning: Excess struct member 'irq' description in 'meson_i2c'


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v2 0/5]  i2c: meson-axg: add I2C controller driver
       [not found]   ` <7ho9ltba6c.fsf-rdvid1DuHRBWk0Htik3J/w@public.gmane.org>
@ 2018-01-24  6:30     ` Wolfram Sang
  2018-01-30 23:53       ` Kevin Hilman
  0 siblings, 1 reply; 15+ messages in thread
From: Wolfram Sang @ 2018-01-24  6:30 UTC (permalink / raw)
  To: Kevin Hilman
  Cc: Yixun Lan, Rob Herring, Mark Rutland,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Neil Armstrong, Jerome Brunet,
	Carlo Caione, Jian Hu,
	linux-amlogic-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 329 bytes --]


> >   ARM64: dts: meson-axg: add I2C DT info for Meson-AXG SoC
> >   ARM64: dts: meson-axg: describe pin DT info for I2C controller
> >   ARM64: dts: meson-axg: enable I2C Master-1 for the audio speaker
> 
> Once you've merged, I'll take the DT patches through my amlogic tree.

Done now! Have fun with the patches...


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [v2,2/5] i2c: meson: add configurable divider factors
  2018-01-24  6:28   ` [v2,2/5] " Wolfram Sang
@ 2018-01-24  6:51     ` Yixun Lan
  2018-01-24 11:46       ` Wolfram Sang
  0 siblings, 1 reply; 15+ messages in thread
From: Yixun Lan @ 2018-01-24  6:51 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: yixun.lan-LpR1jeaWuhtBDgjK7y7TUQ, Rob Herring, Mark Rutland,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Kevin Hilman, Neil Armstrong,
	Jerome Brunet, Carlo Caione, Jian Hu,
	linux-amlogic-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

Hi Wolfram:



On 01/24/18 14:28, Wolfram Sang wrote:
> On Mon, Nov 20, 2017 at 10:54:12PM +0800, Yixun Lan wrote:
>> From: Jian Hu <jian.hu-LpR1jeaWuhtBDgjK7y7TUQ@public.gmane.org>
>>
>> This patch try to add support for I2C controller in Meson-AXG SoC,
>> Due to the IP changes between I2C controller, we need to introduce
>> a compatible data to make the divider factor configurable.
>>
>> Reviewed-by: Neil Armstrong <narmstrong-rdvid1DuHRBWk0Htik3J/w@public.gmane.org>
>> Signed-off-by: Jian Hu <jian.hu-LpR1jeaWuhtBDgjK7y7TUQ@public.gmane.org>
>> Signed-off-by: Yixun Lan <yixun.lan-LpR1jeaWuhtBDgjK7y7TUQ@public.gmane.org>
> 
> Applied to for-next, thanks!
> 
> But I got two build warnings, please fix them with an incremental patch:
> 
> drivers/i2c/busses/i2c-meson.c:103: warning: No description found for parameter 'data'
> drivers/i2c/busses/i2c-meson.c:103: warning: Excess struct member 'irq' description in 'meson_i2c'
> 
first, many thanks for pushing this..

I understand from above warnings, and can compose a patch to fix this.

but, I didn't get this build warnings while test locally, so is there
any specific compiler option that I need to pass to?

Yixun
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [v2,2/5] i2c: meson: add configurable divider factors
  2018-01-24  6:51     ` Yixun Lan
@ 2018-01-24 11:46       ` Wolfram Sang
  0 siblings, 0 replies; 15+ messages in thread
From: Wolfram Sang @ 2018-01-24 11:46 UTC (permalink / raw)
  To: Yixun Lan
  Cc: Rob Herring, Mark Rutland, linux-i2c, devicetree, Kevin Hilman,
	Neil Armstrong, Jerome Brunet, Carlo Caione, Jian Hu,
	linux-amlogic, linux-arm-kernel, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 215 bytes --]

> but, I didn't get this build warnings while test locally, so is there
> any specific compiler option that I need to pass to?

I used "W=1 C=1" when compiling. My gcc version is:

(Debian 6.3.0-18) 6.3.0 20170516


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v2 0/5]  i2c: meson-axg: add I2C controller driver
  2018-01-24  6:30     ` Wolfram Sang
@ 2018-01-30 23:53       ` Kevin Hilman
  0 siblings, 0 replies; 15+ messages in thread
From: Kevin Hilman @ 2018-01-30 23:53 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: Yixun Lan, Rob Herring, Mark Rutland, linux-i2c, devicetree,
	Neil Armstrong, Jerome Brunet, Carlo Caione, Jian Hu,
	linux-amlogic, linux-arm-kernel, linux-kernel

Wolfram Sang <wsa@the-dreams.de> writes:

>> >   ARM64: dts: meson-axg: add I2C DT info for Meson-AXG SoC
>> >   ARM64: dts: meson-axg: describe pin DT info for I2C controller
>> >   ARM64: dts: meson-axg: enable I2C Master-1 for the audio speaker
>> 
>> Once you've merged, I'll take the DT patches through my amlogic tree.
>
> Done now! Have fun with the patches...

Thanks!

The DT patches are now queued in the amlogic tree (branch: v4.17/dt64)

Kevin

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2018-01-30 23:53 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-20 14:54 [PATCH v2 0/5] i2c: meson-axg: add I2C controller driver Yixun Lan
2017-11-20 14:54 ` [PATCH v2 1/5] dt-bindings: i2c: update documentation for the Meson-AXG Yixun Lan
2017-11-20 21:33   ` Rob Herring
     [not found]   ` <20171120145415.6581-2-yixun.lan-LpR1jeaWuhtBDgjK7y7TUQ@public.gmane.org>
2018-01-24  6:26     ` [v2,1/5] " Wolfram Sang
2017-11-20 14:54 ` [PATCH v2 2/5] i2c: meson: add configurable divider factors Yixun Lan
2017-12-13 13:52   ` Yixun Lan
2018-01-24  6:28   ` [v2,2/5] " Wolfram Sang
2018-01-24  6:51     ` Yixun Lan
2018-01-24 11:46       ` Wolfram Sang
2017-11-20 14:54 ` [PATCH v2 3/5] ARM64: dts: meson-axg: add I2C DT info for Meson-AXG SoC Yixun Lan
2017-11-20 14:54 ` [PATCH v2 4/5] ARM64: dts: meson-axg: describe pin DT info for I2C controller Yixun Lan
2017-11-20 14:54 ` [PATCH v2 5/5] ARM64: dts: meson-axg: enable I2C Master-1 for the audio speaker Yixun Lan
2018-01-17  0:28 ` [PATCH v2 0/5] i2c: meson-axg: add I2C controller driver Kevin Hilman
     [not found]   ` <7ho9ltba6c.fsf-rdvid1DuHRBWk0Htik3J/w@public.gmane.org>
2018-01-24  6:30     ` Wolfram Sang
2018-01-30 23:53       ` Kevin Hilman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).