* [PATCH 0/5] i2c: meson-axg: add I2C controller driver
@ 2017-11-17 8:02 ` Yixun Lan
0 siblings, 0 replies; 47+ messages in thread
From: Yixun Lan @ 2017-11-17 8:02 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.
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 | 1 +
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, 158 insertions(+), 4 deletions(-)
--
2.14.1
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH 0/5] i2c: meson-axg: add I2C controller driver
@ 2017-11-17 8:02 ` Yixun Lan
0 siblings, 0 replies; 47+ messages in thread
From: Yixun Lan @ 2017-11-17 8:02 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.
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 | 1 +
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, 158 insertions(+), 4 deletions(-)
--
2.14.1
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH 0/5] i2c: meson-axg: add I2C controller driver
@ 2017-11-17 8:02 ` Yixun Lan
0 siblings, 0 replies; 47+ messages in thread
From: Yixun Lan @ 2017-11-17 8:02 UTC (permalink / raw)
To: linux-arm-kernel
This patch set try to add I2C controller driver for
the Amlogic's Meson-AXG SoC.
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 | 1 +
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, 158 insertions(+), 4 deletions(-)
--
2.14.1
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH 0/5] i2c: meson-axg: add I2C controller driver
@ 2017-11-17 8:02 ` Yixun Lan
0 siblings, 0 replies; 47+ messages in thread
From: Yixun Lan @ 2017-11-17 8:02 UTC (permalink / raw)
To: linus-amlogic
This patch set try to add I2C controller driver for
the Amlogic's Meson-AXG SoC.
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 | 1 +
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, 158 insertions(+), 4 deletions(-)
--
2.14.1
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH 1/5] dt-bindings: i2c: update documentation for the Meson-AXG
2017-11-17 8:02 ` Yixun Lan
(?)
(?)
@ 2017-11-17 8:02 ` Yixun Lan
-1 siblings, 0 replies; 47+ messages in thread
From: Yixun Lan @ 2017-11-17 8:02 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 | 1 +
1 file changed, 1 insertion(+)
diff --git a/Documentation/devicetree/bindings/i2c/i2c-meson.txt b/Documentation/devicetree/bindings/i2c/i2c-meson.txt
index 611b934c7e10..3097d2b44dad 100644
--- a/Documentation/devicetree/bindings/i2c/i2c-meson.txt
+++ b/Documentation/devicetree/bindings/i2c/i2c-meson.txt
@@ -2,6 +2,7 @@ Amlogic Meson I2C controller
Required properties:
- compatible: must be "amlogic,meson6-i2c" or "amlogic,meson-gxbb-i2c"
+ "amlogic,meson-axg-i2c"
- reg: physical address and length of the device registers
- interrupts: a single interrupt specifier
- clocks: clock for the device
--
2.14.1
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH 1/5] dt-bindings: i2c: update documentation for the Meson-AXG
@ 2017-11-17 8:02 ` Yixun Lan
0 siblings, 0 replies; 47+ messages in thread
From: Yixun Lan @ 2017-11-17 8:02 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 | 1 +
1 file changed, 1 insertion(+)
diff --git a/Documentation/devicetree/bindings/i2c/i2c-meson.txt b/Documentation/devicetree/bindings/i2c/i2c-meson.txt
index 611b934c7e10..3097d2b44dad 100644
--- a/Documentation/devicetree/bindings/i2c/i2c-meson.txt
+++ b/Documentation/devicetree/bindings/i2c/i2c-meson.txt
@@ -2,6 +2,7 @@ Amlogic Meson I2C controller
Required properties:
- compatible: must be "amlogic,meson6-i2c" or "amlogic,meson-gxbb-i2c"
+ "amlogic,meson-axg-i2c"
- reg: physical address and length of the device registers
- interrupts: a single interrupt specifier
- clocks: clock for the device
--
2.14.1
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH 1/5] dt-bindings: i2c: update documentation for the Meson-AXG
@ 2017-11-17 8:02 ` Yixun Lan
0 siblings, 0 replies; 47+ messages in thread
From: Yixun Lan @ 2017-11-17 8:02 UTC (permalink / raw)
To: linux-arm-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 | 1 +
1 file changed, 1 insertion(+)
diff --git a/Documentation/devicetree/bindings/i2c/i2c-meson.txt b/Documentation/devicetree/bindings/i2c/i2c-meson.txt
index 611b934c7e10..3097d2b44dad 100644
--- a/Documentation/devicetree/bindings/i2c/i2c-meson.txt
+++ b/Documentation/devicetree/bindings/i2c/i2c-meson.txt
@@ -2,6 +2,7 @@ Amlogic Meson I2C controller
Required properties:
- compatible: must be "amlogic,meson6-i2c" or "amlogic,meson-gxbb-i2c"
+ "amlogic,meson-axg-i2c"
- reg: physical address and length of the device registers
- interrupts: a single interrupt specifier
- clocks: clock for the device
--
2.14.1
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH 1/5] dt-bindings: i2c: update documentation for the Meson-AXG
@ 2017-11-17 8:02 ` Yixun Lan
0 siblings, 0 replies; 47+ messages in thread
From: Yixun Lan @ 2017-11-17 8:02 UTC (permalink / raw)
To: linus-amlogic
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 | 1 +
1 file changed, 1 insertion(+)
diff --git a/Documentation/devicetree/bindings/i2c/i2c-meson.txt b/Documentation/devicetree/bindings/i2c/i2c-meson.txt
index 611b934c7e10..3097d2b44dad 100644
--- a/Documentation/devicetree/bindings/i2c/i2c-meson.txt
+++ b/Documentation/devicetree/bindings/i2c/i2c-meson.txt
@@ -2,6 +2,7 @@ Amlogic Meson I2C controller
Required properties:
- compatible: must be "amlogic,meson6-i2c" or "amlogic,meson-gxbb-i2c"
+ "amlogic,meson-axg-i2c"
- reg: physical address and length of the device registers
- interrupts: a single interrupt specifier
- clocks: clock for the device
--
2.14.1
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH 2/5] i2c: meson: add configurable divider factors
2017-11-17 8:02 ` Yixun Lan
(?)
(?)
@ 2017-11-17 8:02 ` Yixun Lan
-1 siblings, 0 replies; 47+ messages in thread
From: Yixun Lan @ 2017-11-17 8:02 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.
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..517f2cddeff3 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;
+
+ 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 = (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.14.1
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH 2/5] i2c: meson: add configurable divider factors
@ 2017-11-17 8:02 ` Yixun Lan
0 siblings, 0 replies; 47+ messages in thread
From: Yixun Lan @ 2017-11-17 8:02 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.
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..517f2cddeff3 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;
+
+ 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 = (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.14.1
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH 2/5] i2c: meson: add configurable divider factors
@ 2017-11-17 8:02 ` Yixun Lan
0 siblings, 0 replies; 47+ messages in thread
From: Yixun Lan @ 2017-11-17 8:02 UTC (permalink / raw)
To: linux-arm-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.
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..517f2cddeff3 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;
+
+ 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 = (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.14.1
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH 2/5] i2c: meson: add configurable divider factors
@ 2017-11-17 8:02 ` Yixun Lan
0 siblings, 0 replies; 47+ messages in thread
From: Yixun Lan @ 2017-11-17 8:02 UTC (permalink / raw)
To: linus-amlogic
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.
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..517f2cddeff3 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;
+
+ 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 = (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.14.1
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH 3/5] ARM64: dts: meson-axg: add I2C DT info for Meson-AXG SoC
2017-11-17 8:02 ` Yixun Lan
(?)
(?)
@ 2017-11-17 8:02 ` Yixun Lan
-1 siblings, 0 replies; 47+ messages in thread
From: Yixun Lan @ 2017-11-17 8:02 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..99e967aff439 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>;
};
+ i2c_m0: 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";
+ };
+
+ i2c_m1: 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";
+ };
+
+ i2c_m2: 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";
+ };
+
+ i2c_m3: 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.14.1
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH 3/5] ARM64: dts: meson-axg: add I2C DT info for Meson-AXG SoC
@ 2017-11-17 8:02 ` Yixun Lan
0 siblings, 0 replies; 47+ messages in thread
From: Yixun Lan @ 2017-11-17 8:02 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..99e967aff439 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>;
};
+ i2c_m0: 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";
+ };
+
+ i2c_m1: 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";
+ };
+
+ i2c_m2: 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";
+ };
+
+ i2c_m3: 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.14.1
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH 3/5] ARM64: dts: meson-axg: add I2C DT info for Meson-AXG SoC
@ 2017-11-17 8:02 ` Yixun Lan
0 siblings, 0 replies; 47+ messages in thread
From: Yixun Lan @ 2017-11-17 8:02 UTC (permalink / raw)
To: linux-arm-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..99e967aff439 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>;
};
+ i2c_m0: i2c at 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";
+ };
+
+ i2c_m1: i2c at 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";
+ };
+
+ i2c_m2: i2c at 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";
+ };
+
+ i2c_m3: i2c at 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 at 24000 {
compatible = "amlogic,meson-gx-uart", "amlogic,meson-uart";
reg = <0x0 0x24000 0x0 0x14>;
@@ -312,6 +360,17 @@
};
};
+ i2c_ao: i2c at 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 at 3000 {
compatible = "amlogic,meson-gx-uart", "amlogic,meson-ao-uart";
reg = <0x0 0x3000 0x0 0x18>;
--
2.14.1
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH 3/5] ARM64: dts: meson-axg: add I2C DT info for Meson-AXG SoC
@ 2017-11-17 8:02 ` Yixun Lan
0 siblings, 0 replies; 47+ messages in thread
From: Yixun Lan @ 2017-11-17 8:02 UTC (permalink / raw)
To: linus-amlogic
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..99e967aff439 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>;
};
+ i2c_m0: i2c at 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";
+ };
+
+ i2c_m1: i2c at 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";
+ };
+
+ i2c_m2: i2c at 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";
+ };
+
+ i2c_m3: i2c at 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 at 24000 {
compatible = "amlogic,meson-gx-uart", "amlogic,meson-uart";
reg = <0x0 0x24000 0x0 0x14>;
@@ -312,6 +360,17 @@
};
};
+ i2c_ao: i2c at 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 at 3000 {
compatible = "amlogic,meson-gx-uart", "amlogic,meson-ao-uart";
reg = <0x0 0x3000 0x0 0x18>;
--
2.14.1
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH 4/5] ARM64: dts: meson-axg: describe pin DT info for I2C controller
2017-11-17 8:02 ` Yixun Lan
(?)
(?)
@ 2017-11-17 8:02 ` Yixun Lan
-1 siblings, 0 replies; 47+ messages in thread
From: Yixun Lan @ 2017-11-17 8:02 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 99e967aff439..edbfd6022078 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";
};
};
+
+ i2c_m0_pins: i2c_m0 {
+ mux {
+ groups = "i2c_sck_m0",
+ "i2c_sda_m0";
+ function = "i2c_m0";
+ };
+ };
+
+ i2c_m1_z_pins: i2c_m1_z {
+ mux {
+ groups = "i2c_sck_m1_z",
+ "i2c_sda_m1_z";
+ function = "i2c_m1";
+ };
+ };
+
+ i2c_m1_x_pins: i2c_m1_x {
+ mux {
+ groups = "i2c_sck_m1_x",
+ "i2c_sda_m1_x";
+ function = "i2c_m1";
+ };
+ };
+
+ i2c_m2_x_pins: i2c_m2_x {
+ mux {
+ groups = "i2c_sck_m2_x",
+ "i2c_sda_m2_x";
+ function = "i2c_m2";
+ };
+ };
+
+ i2c_m2_a_pins: i2c_m2_a {
+ mux {
+ groups = "i2c_sck_m2_a",
+ "i2c_sda_m2_a";
+ function = "i2c_m2";
+ };
+ };
+
+ i2c_m3_a6_pins: i2c_m3_a6 {
+ mux {
+ groups = "i2c_sda_m3_a6",
+ "i2c_sck_m3_a7";
+ function = "i2c_m3";
+ };
+ };
+
+ i2c_m3_a12_pins: i2c_m3_a12 {
+ mux {
+ groups = "i2c_sda_m3_a12",
+ "i2c_sck_m3_a13";
+ function = "i2c_m3";
+ };
+ };
+
+ i2c_m3_a19_pins: i2c_m3_a19 {
+ mux {
+ groups = "i2c_sda_m3_a19",
+ "i2c_sck_m3_a20";
+ function = "i2c_m3";
+ };
+ };
};
};
--
2.14.1
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH 4/5] ARM64: dts: meson-axg: describe pin DT info for I2C controller
@ 2017-11-17 8:02 ` Yixun Lan
0 siblings, 0 replies; 47+ messages in thread
From: Yixun Lan @ 2017-11-17 8:02 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 99e967aff439..edbfd6022078 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";
};
};
+
+ i2c_m0_pins: i2c_m0 {
+ mux {
+ groups = "i2c_sck_m0",
+ "i2c_sda_m0";
+ function = "i2c_m0";
+ };
+ };
+
+ i2c_m1_z_pins: i2c_m1_z {
+ mux {
+ groups = "i2c_sck_m1_z",
+ "i2c_sda_m1_z";
+ function = "i2c_m1";
+ };
+ };
+
+ i2c_m1_x_pins: i2c_m1_x {
+ mux {
+ groups = "i2c_sck_m1_x",
+ "i2c_sda_m1_x";
+ function = "i2c_m1";
+ };
+ };
+
+ i2c_m2_x_pins: i2c_m2_x {
+ mux {
+ groups = "i2c_sck_m2_x",
+ "i2c_sda_m2_x";
+ function = "i2c_m2";
+ };
+ };
+
+ i2c_m2_a_pins: i2c_m2_a {
+ mux {
+ groups = "i2c_sck_m2_a",
+ "i2c_sda_m2_a";
+ function = "i2c_m2";
+ };
+ };
+
+ i2c_m3_a6_pins: i2c_m3_a6 {
+ mux {
+ groups = "i2c_sda_m3_a6",
+ "i2c_sck_m3_a7";
+ function = "i2c_m3";
+ };
+ };
+
+ i2c_m3_a12_pins: i2c_m3_a12 {
+ mux {
+ groups = "i2c_sda_m3_a12",
+ "i2c_sck_m3_a13";
+ function = "i2c_m3";
+ };
+ };
+
+ i2c_m3_a19_pins: i2c_m3_a19 {
+ mux {
+ groups = "i2c_sda_m3_a19",
+ "i2c_sck_m3_a20";
+ function = "i2c_m3";
+ };
+ };
};
};
--
2.14.1
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH 4/5] ARM64: dts: meson-axg: describe pin DT info for I2C controller
@ 2017-11-17 8:02 ` Yixun Lan
0 siblings, 0 replies; 47+ messages in thread
From: Yixun Lan @ 2017-11-17 8:02 UTC (permalink / raw)
To: linux-arm-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 99e967aff439..edbfd6022078 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";
};
};
+
+ i2c_m0_pins: i2c_m0 {
+ mux {
+ groups = "i2c_sck_m0",
+ "i2c_sda_m0";
+ function = "i2c_m0";
+ };
+ };
+
+ i2c_m1_z_pins: i2c_m1_z {
+ mux {
+ groups = "i2c_sck_m1_z",
+ "i2c_sda_m1_z";
+ function = "i2c_m1";
+ };
+ };
+
+ i2c_m1_x_pins: i2c_m1_x {
+ mux {
+ groups = "i2c_sck_m1_x",
+ "i2c_sda_m1_x";
+ function = "i2c_m1";
+ };
+ };
+
+ i2c_m2_x_pins: i2c_m2_x {
+ mux {
+ groups = "i2c_sck_m2_x",
+ "i2c_sda_m2_x";
+ function = "i2c_m2";
+ };
+ };
+
+ i2c_m2_a_pins: i2c_m2_a {
+ mux {
+ groups = "i2c_sck_m2_a",
+ "i2c_sda_m2_a";
+ function = "i2c_m2";
+ };
+ };
+
+ i2c_m3_a6_pins: i2c_m3_a6 {
+ mux {
+ groups = "i2c_sda_m3_a6",
+ "i2c_sck_m3_a7";
+ function = "i2c_m3";
+ };
+ };
+
+ i2c_m3_a12_pins: i2c_m3_a12 {
+ mux {
+ groups = "i2c_sda_m3_a12",
+ "i2c_sck_m3_a13";
+ function = "i2c_m3";
+ };
+ };
+
+ i2c_m3_a19_pins: i2c_m3_a19 {
+ mux {
+ groups = "i2c_sda_m3_a19",
+ "i2c_sck_m3_a20";
+ function = "i2c_m3";
+ };
+ };
};
};
--
2.14.1
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH 4/5] ARM64: dts: meson-axg: describe pin DT info for I2C controller
@ 2017-11-17 8:02 ` Yixun Lan
0 siblings, 0 replies; 47+ messages in thread
From: Yixun Lan @ 2017-11-17 8:02 UTC (permalink / raw)
To: linus-amlogic
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 99e967aff439..edbfd6022078 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";
};
};
+
+ i2c_m0_pins: i2c_m0 {
+ mux {
+ groups = "i2c_sck_m0",
+ "i2c_sda_m0";
+ function = "i2c_m0";
+ };
+ };
+
+ i2c_m1_z_pins: i2c_m1_z {
+ mux {
+ groups = "i2c_sck_m1_z",
+ "i2c_sda_m1_z";
+ function = "i2c_m1";
+ };
+ };
+
+ i2c_m1_x_pins: i2c_m1_x {
+ mux {
+ groups = "i2c_sck_m1_x",
+ "i2c_sda_m1_x";
+ function = "i2c_m1";
+ };
+ };
+
+ i2c_m2_x_pins: i2c_m2_x {
+ mux {
+ groups = "i2c_sck_m2_x",
+ "i2c_sda_m2_x";
+ function = "i2c_m2";
+ };
+ };
+
+ i2c_m2_a_pins: i2c_m2_a {
+ mux {
+ groups = "i2c_sck_m2_a",
+ "i2c_sda_m2_a";
+ function = "i2c_m2";
+ };
+ };
+
+ i2c_m3_a6_pins: i2c_m3_a6 {
+ mux {
+ groups = "i2c_sda_m3_a6",
+ "i2c_sck_m3_a7";
+ function = "i2c_m3";
+ };
+ };
+
+ i2c_m3_a12_pins: i2c_m3_a12 {
+ mux {
+ groups = "i2c_sda_m3_a12",
+ "i2c_sck_m3_a13";
+ function = "i2c_m3";
+ };
+ };
+
+ i2c_m3_a19_pins: i2c_m3_a19 {
+ mux {
+ groups = "i2c_sda_m3_a19",
+ "i2c_sck_m3_a20";
+ function = "i2c_m3";
+ };
+ };
};
};
--
2.14.1
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH 5/5] ARM64: dts: meson-axg: enable I2C Master-1 for the audio speaker
2017-11-17 8:02 ` Yixun Lan
(?)
(?)
@ 2017-11-17 8:02 ` Yixun Lan
-1 siblings, 0 replies; 47+ messages in thread
From: Yixun Lan @ 2017-11-17 8:02 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..74730e40f992 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 = <ð_rgmii_y_pins>;
pinctrl-names = "default";
};
+
+&i2c_m1 {
+ status = "okay";
+ pinctrl-0 = <&i2c_m1_z_pins>;
+ pinctrl-names = "default";
+};
--
2.14.1
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH 5/5] ARM64: dts: meson-axg: enable I2C Master-1 for the audio speaker
@ 2017-11-17 8:02 ` Yixun Lan
0 siblings, 0 replies; 47+ messages in thread
From: Yixun Lan @ 2017-11-17 8:02 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..74730e40f992 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 = <ð_rgmii_y_pins>;
pinctrl-names = "default";
};
+
+&i2c_m1 {
+ status = "okay";
+ pinctrl-0 = <&i2c_m1_z_pins>;
+ pinctrl-names = "default";
+};
--
2.14.1
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH 5/5] ARM64: dts: meson-axg: enable I2C Master-1 for the audio speaker
@ 2017-11-17 8:02 ` Yixun Lan
0 siblings, 0 replies; 47+ messages in thread
From: Yixun Lan @ 2017-11-17 8:02 UTC (permalink / raw)
To: linux-arm-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..74730e40f992 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 = <ð_rgmii_y_pins>;
pinctrl-names = "default";
};
+
+&i2c_m1 {
+ status = "okay";
+ pinctrl-0 = <&i2c_m1_z_pins>;
+ pinctrl-names = "default";
+};
--
2.14.1
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH 5/5] ARM64: dts: meson-axg: enable I2C Master-1 for the audio speaker
@ 2017-11-17 8:02 ` Yixun Lan
0 siblings, 0 replies; 47+ messages in thread
From: Yixun Lan @ 2017-11-17 8:02 UTC (permalink / raw)
To: linus-amlogic
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..74730e40f992 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 = <ð_rgmii_y_pins>;
pinctrl-names = "default";
};
+
+&i2c_m1 {
+ status = "okay";
+ pinctrl-0 = <&i2c_m1_z_pins>;
+ pinctrl-names = "default";
+};
--
2.14.1
^ permalink raw reply related [flat|nested] 47+ messages in thread
* Re: [PATCH 1/5] dt-bindings: i2c: update documentation for the Meson-AXG
2017-11-17 8:02 ` Yixun Lan
(?)
@ 2017-11-17 13:02 ` Neil Armstrong
-1 siblings, 0 replies; 47+ messages in thread
From: Neil Armstrong @ 2017-11-17 13:02 UTC (permalink / raw)
To: Yixun Lan, Wolfram Sang, Rob Herring, Mark Rutland, linux-i2c,
devicetree, Kevin Hilman
Cc: Jerome Brunet, Carlo Caione, Jian Hu, linux-amlogic,
linux-arm-kernel, linux-kernel
On 17/11/2017 09:02, 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 | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/Documentation/devicetree/bindings/i2c/i2c-meson.txt b/Documentation/devicetree/bindings/i2c/i2c-meson.txt
> index 611b934c7e10..3097d2b44dad 100644
> --- a/Documentation/devicetree/bindings/i2c/i2c-meson.txt
> +++ b/Documentation/devicetree/bindings/i2c/i2c-meson.txt
> @@ -2,6 +2,7 @@ Amlogic Meson I2C controller
>
> Required properties:
> - compatible: must be "amlogic,meson6-i2c" or "amlogic,meson-gxbb-i2c"
> + "amlogic,meson-axg-i2c"
Hi Yixun, Jian,
Maybe you should reformat by using :
- 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
Neil
> - reg: physical address and length of the device registers
> - interrupts: a single interrupt specifier
> - clocks: clock for the device
>
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH 1/5] dt-bindings: i2c: update documentation for the Meson-AXG
@ 2017-11-17 13:02 ` Neil Armstrong
0 siblings, 0 replies; 47+ messages in thread
From: Neil Armstrong @ 2017-11-17 13:02 UTC (permalink / raw)
To: linux-arm-kernel
On 17/11/2017 09:02, 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 | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/Documentation/devicetree/bindings/i2c/i2c-meson.txt b/Documentation/devicetree/bindings/i2c/i2c-meson.txt
> index 611b934c7e10..3097d2b44dad 100644
> --- a/Documentation/devicetree/bindings/i2c/i2c-meson.txt
> +++ b/Documentation/devicetree/bindings/i2c/i2c-meson.txt
> @@ -2,6 +2,7 @@ Amlogic Meson I2C controller
>
> Required properties:
> - compatible: must be "amlogic,meson6-i2c" or "amlogic,meson-gxbb-i2c"
> + "amlogic,meson-axg-i2c"
Hi Yixun, Jian,
Maybe you should reformat by using :
- 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
Neil
> - reg: physical address and length of the device registers
> - interrupts: a single interrupt specifier
> - clocks: clock for the device
>
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH 1/5] dt-bindings: i2c: update documentation for the Meson-AXG
@ 2017-11-17 13:02 ` Neil Armstrong
0 siblings, 0 replies; 47+ messages in thread
From: Neil Armstrong @ 2017-11-17 13:02 UTC (permalink / raw)
To: linus-amlogic
On 17/11/2017 09:02, 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 | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/Documentation/devicetree/bindings/i2c/i2c-meson.txt b/Documentation/devicetree/bindings/i2c/i2c-meson.txt
> index 611b934c7e10..3097d2b44dad 100644
> --- a/Documentation/devicetree/bindings/i2c/i2c-meson.txt
> +++ b/Documentation/devicetree/bindings/i2c/i2c-meson.txt
> @@ -2,6 +2,7 @@ Amlogic Meson I2C controller
>
> Required properties:
> - compatible: must be "amlogic,meson6-i2c" or "amlogic,meson-gxbb-i2c"
> + "amlogic,meson-axg-i2c"
Hi Yixun, Jian,
Maybe you should reformat by using :
- 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
Neil
> - reg: physical address and length of the device registers
> - interrupts: a single interrupt specifier
> - clocks: clock for the device
>
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH 2/5] i2c: meson: add configurable divider factors
2017-11-17 8:02 ` Yixun Lan
(?)
@ 2017-11-17 13:02 ` Neil Armstrong
-1 siblings, 0 replies; 47+ messages in thread
From: Neil Armstrong @ 2017-11-17 13:02 UTC (permalink / raw)
To: Yixun Lan, Wolfram Sang, Rob Herring, Mark Rutland, linux-i2c,
devicetree, Kevin Hilman
Cc: Jerome Brunet, Carlo Caione, Jian Hu, linux-amlogic,
linux-arm-kernel, linux-kernel
On 17/11/2017 09:02, 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.
>
> 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..517f2cddeff3 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;
> +
> + 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 = (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 = {
>
Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH 2/5] i2c: meson: add configurable divider factors
@ 2017-11-17 13:02 ` Neil Armstrong
0 siblings, 0 replies; 47+ messages in thread
From: Neil Armstrong @ 2017-11-17 13:02 UTC (permalink / raw)
To: linux-arm-kernel
On 17/11/2017 09:02, 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.
>
> 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..517f2cddeff3 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;
> +
> + 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 = (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 = {
>
Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH 2/5] i2c: meson: add configurable divider factors
@ 2017-11-17 13:02 ` Neil Armstrong
0 siblings, 0 replies; 47+ messages in thread
From: Neil Armstrong @ 2017-11-17 13:02 UTC (permalink / raw)
To: linus-amlogic
On 17/11/2017 09:02, 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.
>
> 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..517f2cddeff3 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;
> +
> + 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 = (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 = {
>
Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH 3/5] ARM64: dts: meson-axg: add I2C DT info for Meson-AXG SoC
2017-11-17 8:02 ` Yixun Lan
(?)
@ 2017-11-17 13:05 ` Neil Armstrong
-1 siblings, 0 replies; 47+ messages in thread
From: Neil Armstrong @ 2017-11-17 13:05 UTC (permalink / raw)
To: Yixun Lan, Wolfram Sang, Rob Herring, Mark Rutland, linux-i2c,
devicetree, Kevin Hilman
Cc: Jerome Brunet, Carlo Caione, Jian Hu, linux-amlogic,
linux-arm-kernel, linux-kernel
Hi Yixun, Jian,
On 17/11/2017 09:02, Yixun Lan wrote:
> 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..99e967aff439 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>;
> };
>
> + i2c_m0: i2c@1f000 {
Can you use a more simple "i2c0" phandle naming instead ? or get back to the "i2c_A/B/C/D" naming like in meson_gx to keep consistency ?
[...]
> + };
> +
> + i2c_m1: i2c@1e000 {
[...]
> + };
> +
> + i2c_m2: i2c@1d000 {
[...]
> + };
> +
> + i2c_m3: i2c@1c000 {
[...]
> + };
> +
> 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 {
Can you keep the same "i2c_AO" as in meson-gx ?
[...]
> + };
> +
> uart_AO: serial@3000 {
> compatible = "amlogic,meson-gx-uart", "amlogic,meson-ao-uart";
> reg = <0x0 0x3000 0x0 0x18>;
>
Neil
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH 3/5] ARM64: dts: meson-axg: add I2C DT info for Meson-AXG SoC
@ 2017-11-17 13:05 ` Neil Armstrong
0 siblings, 0 replies; 47+ messages in thread
From: Neil Armstrong @ 2017-11-17 13:05 UTC (permalink / raw)
To: linux-arm-kernel
Hi Yixun, Jian,
On 17/11/2017 09:02, Yixun Lan wrote:
> 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..99e967aff439 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>;
> };
>
> + i2c_m0: i2c at 1f000 {
Can you use a more simple "i2c0" phandle naming instead ? or get back to the "i2c_A/B/C/D" naming like in meson_gx to keep consistency ?
[...]
> + };
> +
> + i2c_m1: i2c at 1e000 {
[...]
> + };
> +
> + i2c_m2: i2c at 1d000 {
[...]
> + };
> +
> + i2c_m3: i2c at 1c000 {
[...]
> + };
> +
> uart_A: serial at 24000 {
> compatible = "amlogic,meson-gx-uart", "amlogic,meson-uart";
> reg = <0x0 0x24000 0x0 0x14>;
> @@ -312,6 +360,17 @@
> };
> };
>
> + i2c_ao: i2c at 5000 {
Can you keep the same "i2c_AO" as in meson-gx ?
[...]
> + };
> +
> uart_AO: serial at 3000 {
> compatible = "amlogic,meson-gx-uart", "amlogic,meson-ao-uart";
> reg = <0x0 0x3000 0x0 0x18>;
>
Neil
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH 3/5] ARM64: dts: meson-axg: add I2C DT info for Meson-AXG SoC
@ 2017-11-17 13:05 ` Neil Armstrong
0 siblings, 0 replies; 47+ messages in thread
From: Neil Armstrong @ 2017-11-17 13:05 UTC (permalink / raw)
To: linus-amlogic
Hi Yixun, Jian,
On 17/11/2017 09:02, Yixun Lan wrote:
> 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..99e967aff439 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>;
> };
>
> + i2c_m0: i2c at 1f000 {
Can you use a more simple "i2c0" phandle naming instead ? or get back to the "i2c_A/B/C/D" naming like in meson_gx to keep consistency ?
[...]
> + };
> +
> + i2c_m1: i2c at 1e000 {
[...]
> + };
> +
> + i2c_m2: i2c at 1d000 {
[...]
> + };
> +
> + i2c_m3: i2c at 1c000 {
[...]
> + };
> +
> uart_A: serial at 24000 {
> compatible = "amlogic,meson-gx-uart", "amlogic,meson-uart";
> reg = <0x0 0x24000 0x0 0x14>;
> @@ -312,6 +360,17 @@
> };
> };
>
> + i2c_ao: i2c at 5000 {
Can you keep the same "i2c_AO" as in meson-gx ?
[...]
> + };
> +
> uart_AO: serial at 3000 {
> compatible = "amlogic,meson-gx-uart", "amlogic,meson-ao-uart";
> reg = <0x0 0x3000 0x0 0x18>;
>
Neil
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH 4/5] ARM64: dts: meson-axg: describe pin DT info for I2C controller
2017-11-17 8:02 ` Yixun Lan
(?)
@ 2017-11-17 13:06 ` Neil Armstrong
-1 siblings, 0 replies; 47+ messages in thread
From: Neil Armstrong @ 2017-11-17 13:06 UTC (permalink / raw)
To: Yixun Lan, Wolfram Sang, Rob Herring, Mark Rutland, linux-i2c,
devicetree, Kevin Hilman
Cc: Jerome Brunet, Carlo Caione, Jian Hu, linux-amlogic,
linux-arm-kernel, linux-kernel
On 17/11/2017 09:02, Yixun Lan wrote:
> 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 99e967aff439..edbfd6022078 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";
> };
> };
> +
> + i2c_m0_pins: i2c_m0 {
> + mux {
> + groups = "i2c_sck_m0",
> + "i2c_sda_m0";
> + function = "i2c_m0";
> + };
> + };
> +
> + i2c_m1_z_pins: i2c_m1_z {
> + mux {
> + groups = "i2c_sck_m1_z",
> + "i2c_sda_m1_z";
> + function = "i2c_m1";
> + };
> + };
> +
> + i2c_m1_x_pins: i2c_m1_x {
> + mux {
> + groups = "i2c_sck_m1_x",
> + "i2c_sda_m1_x";
> + function = "i2c_m1";
> + };
> + };
> +
> + i2c_m2_x_pins: i2c_m2_x {
> + mux {
> + groups = "i2c_sck_m2_x",
> + "i2c_sda_m2_x";
> + function = "i2c_m2";
> + };
> + };
> +
> + i2c_m2_a_pins: i2c_m2_a {
> + mux {
> + groups = "i2c_sck_m2_a",
> + "i2c_sda_m2_a";
> + function = "i2c_m2";
> + };
> + };
> +
> + i2c_m3_a6_pins: i2c_m3_a6 {
> + mux {
> + groups = "i2c_sda_m3_a6",
> + "i2c_sck_m3_a7";
> + function = "i2c_m3";
> + };
> + };
> +
> + i2c_m3_a12_pins: i2c_m3_a12 {
> + mux {
> + groups = "i2c_sda_m3_a12",
> + "i2c_sck_m3_a13";
> + function = "i2c_m3";
> + };
> + };
> +
> + i2c_m3_a19_pins: i2c_m3_a19 {
> + mux {
> + groups = "i2c_sda_m3_a19",
> + "i2c_sck_m3_a20";
> + function = "i2c_m3";
> + };
> + };
> };
> };
>
>
Same here fore the naming of the i2c nodes.
Neil
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH 4/5] ARM64: dts: meson-axg: describe pin DT info for I2C controller
@ 2017-11-17 13:06 ` Neil Armstrong
0 siblings, 0 replies; 47+ messages in thread
From: Neil Armstrong @ 2017-11-17 13:06 UTC (permalink / raw)
To: linux-arm-kernel
On 17/11/2017 09:02, Yixun Lan wrote:
> 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 99e967aff439..edbfd6022078 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";
> };
> };
> +
> + i2c_m0_pins: i2c_m0 {
> + mux {
> + groups = "i2c_sck_m0",
> + "i2c_sda_m0";
> + function = "i2c_m0";
> + };
> + };
> +
> + i2c_m1_z_pins: i2c_m1_z {
> + mux {
> + groups = "i2c_sck_m1_z",
> + "i2c_sda_m1_z";
> + function = "i2c_m1";
> + };
> + };
> +
> + i2c_m1_x_pins: i2c_m1_x {
> + mux {
> + groups = "i2c_sck_m1_x",
> + "i2c_sda_m1_x";
> + function = "i2c_m1";
> + };
> + };
> +
> + i2c_m2_x_pins: i2c_m2_x {
> + mux {
> + groups = "i2c_sck_m2_x",
> + "i2c_sda_m2_x";
> + function = "i2c_m2";
> + };
> + };
> +
> + i2c_m2_a_pins: i2c_m2_a {
> + mux {
> + groups = "i2c_sck_m2_a",
> + "i2c_sda_m2_a";
> + function = "i2c_m2";
> + };
> + };
> +
> + i2c_m3_a6_pins: i2c_m3_a6 {
> + mux {
> + groups = "i2c_sda_m3_a6",
> + "i2c_sck_m3_a7";
> + function = "i2c_m3";
> + };
> + };
> +
> + i2c_m3_a12_pins: i2c_m3_a12 {
> + mux {
> + groups = "i2c_sda_m3_a12",
> + "i2c_sck_m3_a13";
> + function = "i2c_m3";
> + };
> + };
> +
> + i2c_m3_a19_pins: i2c_m3_a19 {
> + mux {
> + groups = "i2c_sda_m3_a19",
> + "i2c_sck_m3_a20";
> + function = "i2c_m3";
> + };
> + };
> };
> };
>
>
Same here fore the naming of the i2c nodes.
Neil
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH 4/5] ARM64: dts: meson-axg: describe pin DT info for I2C controller
@ 2017-11-17 13:06 ` Neil Armstrong
0 siblings, 0 replies; 47+ messages in thread
From: Neil Armstrong @ 2017-11-17 13:06 UTC (permalink / raw)
To: linus-amlogic
On 17/11/2017 09:02, Yixun Lan wrote:
> 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 99e967aff439..edbfd6022078 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";
> };
> };
> +
> + i2c_m0_pins: i2c_m0 {
> + mux {
> + groups = "i2c_sck_m0",
> + "i2c_sda_m0";
> + function = "i2c_m0";
> + };
> + };
> +
> + i2c_m1_z_pins: i2c_m1_z {
> + mux {
> + groups = "i2c_sck_m1_z",
> + "i2c_sda_m1_z";
> + function = "i2c_m1";
> + };
> + };
> +
> + i2c_m1_x_pins: i2c_m1_x {
> + mux {
> + groups = "i2c_sck_m1_x",
> + "i2c_sda_m1_x";
> + function = "i2c_m1";
> + };
> + };
> +
> + i2c_m2_x_pins: i2c_m2_x {
> + mux {
> + groups = "i2c_sck_m2_x",
> + "i2c_sda_m2_x";
> + function = "i2c_m2";
> + };
> + };
> +
> + i2c_m2_a_pins: i2c_m2_a {
> + mux {
> + groups = "i2c_sck_m2_a",
> + "i2c_sda_m2_a";
> + function = "i2c_m2";
> + };
> + };
> +
> + i2c_m3_a6_pins: i2c_m3_a6 {
> + mux {
> + groups = "i2c_sda_m3_a6",
> + "i2c_sck_m3_a7";
> + function = "i2c_m3";
> + };
> + };
> +
> + i2c_m3_a12_pins: i2c_m3_a12 {
> + mux {
> + groups = "i2c_sda_m3_a12",
> + "i2c_sck_m3_a13";
> + function = "i2c_m3";
> + };
> + };
> +
> + i2c_m3_a19_pins: i2c_m3_a19 {
> + mux {
> + groups = "i2c_sda_m3_a19",
> + "i2c_sck_m3_a20";
> + function = "i2c_m3";
> + };
> + };
> };
> };
>
>
Same here fore the naming of the i2c nodes.
Neil
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH 1/5] dt-bindings: i2c: update documentation for the Meson-AXG
2017-11-17 13:02 ` Neil Armstrong
(?)
(?)
@ 2017-11-17 13:47 ` Yixun Lan
-1 siblings, 0 replies; 47+ messages in thread
From: Yixun Lan @ 2017-11-17 13:47 UTC (permalink / raw)
To: Neil Armstrong, Wolfram Sang, Rob Herring, Mark Rutland,
linux-i2c, devicetree, Kevin Hilman
Cc: yixun.lan, Jerome Brunet, Carlo Caione, Jian Hu, linux-amlogic,
linux-arm-kernel, linux-kernel
Hi Neil
On 11/17/17 21:02, Neil Armstrong wrote:
> On 17/11/2017 09:02, 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 | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/Documentation/devicetree/bindings/i2c/i2c-meson.txt b/Documentation/devicetree/bindings/i2c/i2c-meson.txt
>> index 611b934c7e10..3097d2b44dad 100644
>> --- a/Documentation/devicetree/bindings/i2c/i2c-meson.txt
>> +++ b/Documentation/devicetree/bindings/i2c/i2c-meson.txt
>> @@ -2,6 +2,7 @@ Amlogic Meson I2C controller
>>
>> Required properties:
>> - compatible: must be "amlogic,meson6-i2c" or "amlogic,meson-gxbb-i2c"
>> + "amlogic,meson-axg-i2c"
>
> Hi Yixun, Jian,
>
> Maybe you should reformat by using :
> - 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
>
> Neil
>
sure, we can do this.
thanks for the review
>> - reg: physical address and length of the device registers
>> - interrupts: a single interrupt specifier
>> - clocks: clock for the device
>>
>
> .
>
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH 1/5] dt-bindings: i2c: update documentation for the Meson-AXG
@ 2017-11-17 13:47 ` Yixun Lan
0 siblings, 0 replies; 47+ messages in thread
From: Yixun Lan @ 2017-11-17 13:47 UTC (permalink / raw)
To: Neil Armstrong, Wolfram Sang, Rob Herring, Mark Rutland,
linux-i2c, devicetree, Kevin Hilman
Cc: yixun.lan, Jerome Brunet, Carlo Caione, Jian Hu, linux-amlogic,
linux-arm-kernel, linux-kernel
Hi Neil
On 11/17/17 21:02, Neil Armstrong wrote:
> On 17/11/2017 09:02, 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 | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/Documentation/devicetree/bindings/i2c/i2c-meson.txt b/Documentation/devicetree/bindings/i2c/i2c-meson.txt
>> index 611b934c7e10..3097d2b44dad 100644
>> --- a/Documentation/devicetree/bindings/i2c/i2c-meson.txt
>> +++ b/Documentation/devicetree/bindings/i2c/i2c-meson.txt
>> @@ -2,6 +2,7 @@ Amlogic Meson I2C controller
>>
>> Required properties:
>> - compatible: must be "amlogic,meson6-i2c" or "amlogic,meson-gxbb-i2c"
>> + "amlogic,meson-axg-i2c"
>
> Hi Yixun, Jian,
>
> Maybe you should reformat by using :
> - 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
>
> Neil
>
sure, we can do this.
thanks for the review
>> - reg: physical address and length of the device registers
>> - interrupts: a single interrupt specifier
>> - clocks: clock for the device
>>
>
> .
>
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH 1/5] dt-bindings: i2c: update documentation for the Meson-AXG
@ 2017-11-17 13:47 ` Yixun Lan
0 siblings, 0 replies; 47+ messages in thread
From: Yixun Lan @ 2017-11-17 13:47 UTC (permalink / raw)
To: linux-arm-kernel
Hi Neil
On 11/17/17 21:02, Neil Armstrong wrote:
> On 17/11/2017 09:02, 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 | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/Documentation/devicetree/bindings/i2c/i2c-meson.txt b/Documentation/devicetree/bindings/i2c/i2c-meson.txt
>> index 611b934c7e10..3097d2b44dad 100644
>> --- a/Documentation/devicetree/bindings/i2c/i2c-meson.txt
>> +++ b/Documentation/devicetree/bindings/i2c/i2c-meson.txt
>> @@ -2,6 +2,7 @@ Amlogic Meson I2C controller
>>
>> Required properties:
>> - compatible: must be "amlogic,meson6-i2c" or "amlogic,meson-gxbb-i2c"
>> + "amlogic,meson-axg-i2c"
>
> Hi Yixun, Jian,
>
> Maybe you should reformat by using :
> - 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
>
> Neil
>
sure, we can do this.
thanks for the review
>> - reg: physical address and length of the device registers
>> - interrupts: a single interrupt specifier
>> - clocks: clock for the device
>>
>
> .
>
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH 1/5] dt-bindings: i2c: update documentation for the Meson-AXG
@ 2017-11-17 13:47 ` Yixun Lan
0 siblings, 0 replies; 47+ messages in thread
From: Yixun Lan @ 2017-11-17 13:47 UTC (permalink / raw)
To: linus-amlogic
Hi Neil
On 11/17/17 21:02, Neil Armstrong wrote:
> On 17/11/2017 09:02, 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 | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/Documentation/devicetree/bindings/i2c/i2c-meson.txt b/Documentation/devicetree/bindings/i2c/i2c-meson.txt
>> index 611b934c7e10..3097d2b44dad 100644
>> --- a/Documentation/devicetree/bindings/i2c/i2c-meson.txt
>> +++ b/Documentation/devicetree/bindings/i2c/i2c-meson.txt
>> @@ -2,6 +2,7 @@ Amlogic Meson I2C controller
>>
>> Required properties:
>> - compatible: must be "amlogic,meson6-i2c" or "amlogic,meson-gxbb-i2c"
>> + "amlogic,meson-axg-i2c"
>
> Hi Yixun, Jian,
>
> Maybe you should reformat by using :
> - 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
>
> Neil
>
sure, we can do this.
thanks for the review
>> - reg: physical address and length of the device registers
>> - interrupts: a single interrupt specifier
>> - clocks: clock for the device
>>
>
> .
>
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH 3/5] ARM64: dts: meson-axg: add I2C DT info for Meson-AXG SoC
@ 2017-11-17 14:02 ` Yixun Lan
0 siblings, 0 replies; 47+ messages in thread
From: Yixun Lan @ 2017-11-17 14:02 UTC (permalink / raw)
To: Neil Armstrong, Wolfram Sang, Rob Herring, Mark Rutland,
linux-i2c, devicetree, Kevin Hilman
Cc: yixun.lan, Jerome Brunet, Carlo Caione, Jian Hu, linux-amlogic,
linux-arm-kernel, linux-kernel
Hi Neil
see my comments in line
On 11/17/17 21:05, Neil Armstrong wrote:
> Hi Yixun, Jian,
>
> On 17/11/2017 09:02, Yixun Lan wrote:
>> 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..99e967aff439 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>;
>> };
>>
>> + i2c_m0: i2c@1f000 {
>
> Can you use a more simple "i2c0" phandle naming instead ? or get back to the "i2c_A/B/C/D" naming like in meson_gx to keep consistency ?
>
Ok, I would prefer to use 'i2c0' then
we had a internal discussion about the inconsistent naming of the I2C
controller, and reach a consensus to name them as:
the EE domain: ee_i2c_m0, ee_i2c_m1 ..
the AO domain: ao_i2c_m0, ao_i2c_s0
in the future datasheet.
note: 'ee' means the EE domain, m0 mean the master 0, s0 mean the I2C
slave 0
> [...]
>
>> + };
>> +
>> + i2c_m1: i2c@1e000 {
>
> [...]
>
>> + };
>> +
>> + i2c_m2: i2c@1d000 {
>
> [...]
>
>> + };
>> +
>> + i2c_m3: i2c@1c000 {
>
> [...]
>
>> + };
>> +
>> 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 {
>
> Can you keep the same "i2c_AO" as in meson-gx ?
>
>
sure, can do
> [...]
>
>> + };
>> +
>> uart_AO: serial@3000 {
>> compatible = "amlogic,meson-gx-uart", "amlogic,meson-ao-uart";
>> reg = <0x0 0x3000 0x0 0x18>;
>>
>
> Neil
>
> .
>
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH 3/5] ARM64: dts: meson-axg: add I2C DT info for Meson-AXG SoC
@ 2017-11-17 14:02 ` Yixun Lan
0 siblings, 0 replies; 47+ messages in thread
From: Yixun Lan @ 2017-11-17 14:02 UTC (permalink / raw)
To: Neil Armstrong, Wolfram Sang, Rob Herring, Mark Rutland,
linux-i2c-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA, Kevin Hilman
Cc: yixun.lan-LpR1jeaWuhtBDgjK7y7TUQ, Jerome Brunet, Carlo Caione,
Jian Hu, linux-amlogic-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
Hi Neil
see my comments in line
On 11/17/17 21:05, Neil Armstrong wrote:
> Hi Yixun, Jian,
>
> On 17/11/2017 09:02, Yixun Lan wrote:
>> From: Jian Hu <jian.hu-LpR1jeaWuhtBDgjK7y7TUQ@public.gmane.org>
>>
>> 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-LpR1jeaWuhtBDgjK7y7TUQ@public.gmane.org>
>> Signed-off-by: Yixun Lan <yixun.lan-LpR1jeaWuhtBDgjK7y7TUQ@public.gmane.org>
>> ---
>> 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..99e967aff439 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>;
>> };
>>
>> + i2c_m0: i2c@1f000 {
>
> Can you use a more simple "i2c0" phandle naming instead ? or get back to the "i2c_A/B/C/D" naming like in meson_gx to keep consistency ?
>
Ok, I would prefer to use 'i2c0' then
we had a internal discussion about the inconsistent naming of the I2C
controller, and reach a consensus to name them as:
the EE domain: ee_i2c_m0, ee_i2c_m1 ..
the AO domain: ao_i2c_m0, ao_i2c_s0
in the future datasheet.
note: 'ee' means the EE domain, m0 mean the master 0, s0 mean the I2C
slave 0
> [...]
>
>> + };
>> +
>> + i2c_m1: i2c@1e000 {
>
> [...]
>
>> + };
>> +
>> + i2c_m2: i2c@1d000 {
>
> [...]
>
>> + };
>> +
>> + i2c_m3: i2c@1c000 {
>
> [...]
>
>> + };
>> +
>> 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 {
>
> Can you keep the same "i2c_AO" as in meson-gx ?
>
>
sure, can do
> [...]
>
>> + };
>> +
>> uart_AO: serial@3000 {
>> compatible = "amlogic,meson-gx-uart", "amlogic,meson-ao-uart";
>> reg = <0x0 0x3000 0x0 0x18>;
>>
>
> Neil
>
> .
>
--
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] 47+ messages in thread
* [PATCH 3/5] ARM64: dts: meson-axg: add I2C DT info for Meson-AXG SoC
@ 2017-11-17 14:02 ` Yixun Lan
0 siblings, 0 replies; 47+ messages in thread
From: Yixun Lan @ 2017-11-17 14:02 UTC (permalink / raw)
To: linux-arm-kernel
Hi Neil
see my comments in line
On 11/17/17 21:05, Neil Armstrong wrote:
> Hi Yixun, Jian,
>
> On 17/11/2017 09:02, Yixun Lan wrote:
>> 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..99e967aff439 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>;
>> };
>>
>> + i2c_m0: i2c at 1f000 {
>
> Can you use a more simple "i2c0" phandle naming instead ? or get back to the "i2c_A/B/C/D" naming like in meson_gx to keep consistency ?
>
Ok, I would prefer to use 'i2c0' then
we had a internal discussion about the inconsistent naming of the I2C
controller, and reach a consensus to name them as:
the EE domain: ee_i2c_m0, ee_i2c_m1 ..
the AO domain: ao_i2c_m0, ao_i2c_s0
in the future datasheet.
note: 'ee' means the EE domain, m0 mean the master 0, s0 mean the I2C
slave 0
> [...]
>
>> + };
>> +
>> + i2c_m1: i2c at 1e000 {
>
> [...]
>
>> + };
>> +
>> + i2c_m2: i2c at 1d000 {
>
> [...]
>
>> + };
>> +
>> + i2c_m3: i2c at 1c000 {
>
> [...]
>
>> + };
>> +
>> uart_A: serial at 24000 {
>> compatible = "amlogic,meson-gx-uart", "amlogic,meson-uart";
>> reg = <0x0 0x24000 0x0 0x14>;
>> @@ -312,6 +360,17 @@
>> };
>> };
>>
>> + i2c_ao: i2c at 5000 {
>
> Can you keep the same "i2c_AO" as in meson-gx ?
>
>
sure, can do
> [...]
>
>> + };
>> +
>> uart_AO: serial at 3000 {
>> compatible = "amlogic,meson-gx-uart", "amlogic,meson-ao-uart";
>> reg = <0x0 0x3000 0x0 0x18>;
>>
>
> Neil
>
> .
>
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH 3/5] ARM64: dts: meson-axg: add I2C DT info for Meson-AXG SoC
@ 2017-11-17 14:02 ` Yixun Lan
0 siblings, 0 replies; 47+ messages in thread
From: Yixun Lan @ 2017-11-17 14:02 UTC (permalink / raw)
To: linus-amlogic
Hi Neil
see my comments in line
On 11/17/17 21:05, Neil Armstrong wrote:
> Hi Yixun, Jian,
>
> On 17/11/2017 09:02, Yixun Lan wrote:
>> 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..99e967aff439 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>;
>> };
>>
>> + i2c_m0: i2c at 1f000 {
>
> Can you use a more simple "i2c0" phandle naming instead ? or get back to the "i2c_A/B/C/D" naming like in meson_gx to keep consistency ?
>
Ok, I would prefer to use 'i2c0' then
we had a internal discussion about the inconsistent naming of the I2C
controller, and reach a consensus to name them as:
the EE domain: ee_i2c_m0, ee_i2c_m1 ..
the AO domain: ao_i2c_m0, ao_i2c_s0
in the future datasheet.
note: 'ee' means the EE domain, m0 mean the master 0, s0 mean the I2C
slave 0
> [...]
>
>> + };
>> +
>> + i2c_m1: i2c at 1e000 {
>
> [...]
>
>> + };
>> +
>> + i2c_m2: i2c at 1d000 {
>
> [...]
>
>> + };
>> +
>> + i2c_m3: i2c at 1c000 {
>
> [...]
>
>> + };
>> +
>> uart_A: serial at 24000 {
>> compatible = "amlogic,meson-gx-uart", "amlogic,meson-uart";
>> reg = <0x0 0x24000 0x0 0x14>;
>> @@ -312,6 +360,17 @@
>> };
>> };
>>
>> + i2c_ao: i2c at 5000 {
>
> Can you keep the same "i2c_AO" as in meson-gx ?
>
>
sure, can do
> [...]
>
>> + };
>> +
>> uart_AO: serial at 3000 {
>> compatible = "amlogic,meson-gx-uart", "amlogic,meson-ao-uart";
>> reg = <0x0 0x3000 0x0 0x18>;
>>
>
> Neil
>
> .
>
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH 2/5] i2c: meson: add configurable divider factors
2017-11-17 8:02 ` Yixun Lan
(?)
@ 2017-11-17 20:32 ` Martin Blumenstingl
-1 siblings, 0 replies; 47+ messages in thread
From: Martin Blumenstingl @ 2017-11-17 20:32 UTC (permalink / raw)
To: Yixun Lan
Cc: Wolfram Sang, Rob Herring, Mark Rutland, linux-i2c, devicetree,
Kevin Hilman, Neil Armstrong, linux-kernel, Jian Hu,
Carlo Caione, linux-amlogic, linux-arm-kernel, Jerome Brunet
On Fri, Nov 17, 2017 at 9:02 AM, Yixun Lan <yixun.lan@amlogic.com> 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.
>
> 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..517f2cddeff3 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;
> +
> + struct meson_i2c_data *data;
shouldn't this be const (like the definitions below)?
> };
>
> 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 = (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.14.1
>
>
> _______________________________________________
> linux-amlogic mailing list
> linux-amlogic@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-amlogic
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH 2/5] i2c: meson: add configurable divider factors
@ 2017-11-17 20:32 ` Martin Blumenstingl
0 siblings, 0 replies; 47+ messages in thread
From: Martin Blumenstingl @ 2017-11-17 20:32 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, Nov 17, 2017 at 9:02 AM, Yixun Lan <yixun.lan@amlogic.com> 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.
>
> 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..517f2cddeff3 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;
> +
> + struct meson_i2c_data *data;
shouldn't this be const (like the definitions below)?
> };
>
> 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 = (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.14.1
>
>
> _______________________________________________
> linux-amlogic mailing list
> linux-amlogic at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-amlogic
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH 2/5] i2c: meson: add configurable divider factors
@ 2017-11-17 20:32 ` Martin Blumenstingl
0 siblings, 0 replies; 47+ messages in thread
From: Martin Blumenstingl @ 2017-11-17 20:32 UTC (permalink / raw)
To: linus-amlogic
On Fri, Nov 17, 2017 at 9:02 AM, Yixun Lan <yixun.lan@amlogic.com> 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.
>
> 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..517f2cddeff3 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;
> +
> + struct meson_i2c_data *data;
shouldn't this be const (like the definitions below)?
> };
>
> 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 = (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.14.1
>
>
> _______________________________________________
> linux-amlogic mailing list
> linux-amlogic at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-amlogic
^ permalink raw reply [flat|nested] 47+ messages in thread
end of thread, other threads:[~2017-11-17 20:33 UTC | newest]
Thread overview: 47+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-17 8:02 [PATCH 0/5] i2c: meson-axg: add I2C controller driver Yixun Lan
2017-11-17 8:02 ` Yixun Lan
2017-11-17 8:02 ` Yixun Lan
2017-11-17 8:02 ` Yixun Lan
2017-11-17 8:02 ` [PATCH 1/5] dt-bindings: i2c: update documentation for the Meson-AXG Yixun Lan
2017-11-17 8:02 ` Yixun Lan
2017-11-17 8:02 ` Yixun Lan
2017-11-17 8:02 ` Yixun Lan
2017-11-17 13:02 ` Neil Armstrong
2017-11-17 13:02 ` Neil Armstrong
2017-11-17 13:02 ` Neil Armstrong
2017-11-17 13:47 ` Yixun Lan
2017-11-17 13:47 ` Yixun Lan
2017-11-17 13:47 ` Yixun Lan
2017-11-17 13:47 ` Yixun Lan
2017-11-17 8:02 ` [PATCH 2/5] i2c: meson: add configurable divider factors Yixun Lan
2017-11-17 8:02 ` Yixun Lan
2017-11-17 8:02 ` Yixun Lan
2017-11-17 8:02 ` Yixun Lan
2017-11-17 13:02 ` Neil Armstrong
2017-11-17 13:02 ` Neil Armstrong
2017-11-17 13:02 ` Neil Armstrong
2017-11-17 20:32 ` Martin Blumenstingl
2017-11-17 20:32 ` Martin Blumenstingl
2017-11-17 20:32 ` Martin Blumenstingl
2017-11-17 8:02 ` [PATCH 3/5] ARM64: dts: meson-axg: add I2C DT info for Meson-AXG SoC Yixun Lan
2017-11-17 8:02 ` Yixun Lan
2017-11-17 8:02 ` Yixun Lan
2017-11-17 8:02 ` Yixun Lan
2017-11-17 13:05 ` Neil Armstrong
2017-11-17 13:05 ` Neil Armstrong
2017-11-17 13:05 ` Neil Armstrong
2017-11-17 14:02 ` Yixun Lan
2017-11-17 14:02 ` Yixun Lan
2017-11-17 14:02 ` Yixun Lan
2017-11-17 14:02 ` Yixun Lan
2017-11-17 8:02 ` [PATCH 4/5] ARM64: dts: meson-axg: describe pin DT info for I2C controller Yixun Lan
2017-11-17 8:02 ` Yixun Lan
2017-11-17 8:02 ` Yixun Lan
2017-11-17 8:02 ` Yixun Lan
2017-11-17 13:06 ` Neil Armstrong
2017-11-17 13:06 ` Neil Armstrong
2017-11-17 13:06 ` Neil Armstrong
2017-11-17 8:02 ` [PATCH 5/5] ARM64: dts: meson-axg: enable I2C Master-1 for the audio speaker Yixun Lan
2017-11-17 8:02 ` Yixun Lan
2017-11-17 8:02 ` Yixun Lan
2017-11-17 8:02 ` Yixun Lan
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.