Skip to contentSkip to conversation

i2c: qup: Add device tree bindings information

PATCH In review Ivan T. Ivanov 7 participants 16 messages Aug 29, 2013 – Sep 26, 2013 8 messages not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 i2c: qup: Add device tree bindings information

From: "Ivan T. Ivanov" <[email protected]>

The Qualcomm Universal Peripherial (QUP) wraps I2C mini-core and provide input and output FIFO's for it. I2C controller can operate as master with supported bus speeds of 100Kbps and 400Kbps.

---
 Documentation/devicetree/bindings/i2c/i2c-qup.txt |   99 +++++++++++++++++++++
 1 file changed, 99 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/i2c/i2c-qup.txt
Documentation/devicetree/bindings/i2c/i2c-qup.txt new file +99 -0
new file mode 100644
index 0000000..c682726
@@ -0,0 +1,99 @@
+Qualcomm Universal Periferial (QUP) I2C controller
+
+Required properties:
+ - compatible : should be "qcom,i2c-qup"
+ - reg : Offset and length of the register region for the device
+ - interrupts : core interrupt
+
+ - pinctrl-names: Should contain only one value - "default".
+ - pinctrl-0: Should specify pin control group used for this controller.
+
+ - clocks : phandles to clock instances of the device tree nodes
+ - clock-names :
+		"core" : Allow access to FIFO buffers and registers
+		"iface" : Clock used by QUP interface
+
+ - #address-cells : should be <1> Address cells for I2C device address
+ - #size-cells : should be <0> I2C addresses have no size component.
+
+Optional properties :
+ - Child nodes conforming to i2c bus binding
+ - clock-frequency : Desired I2C bus clock frequency in Hz. If
+		not set thedefault frequency is 100kHz
+ - qcom,src-freq : Frequency of the source clocking this bus in Hz.
+		Divider value is set based on soruce-frequency and
+		desired I2C bus frequency. If this value is not
+		provided, the source clock is assumed to be running
+		at 19.2 MHz.
+
+Aliases: An alias may optionally be used to bind the I2C controller
+to bus number. Aliases are of the form i2c<n> where <n> is an integer
+representing the bus number to use.
+
+Example:
+
+ aliases {
+		i2c0 = &i2c_A;
+		i2c1 = &i2c_B;
+		i2c2 = &i2c_C;
+ };
+
+ i2c_A: i2c@f9967000 {
+		compatible = "qcom,i2c-qup";
+		reg = <0Xf9967000 0x1000>;
+		interrupts = <0 105 0>;
+
+		pinctrl-names = "default";
+		pinctrl-0 = <&i2c0_data>;
+
+		clocks = <&core>, <&iface>;
+		clock-names = "core", "iface";
+
+		clock-frequency = <100000>;
+		qcom,src-freq = <50000000>;
+		status = "disabled";
+
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		dummy@60 {
+			compatible = "dummy";
+			reg = <0x60>;
+		};
+	};
+
+ i2c_B: i2c@f9923000 {
+		compatible = "qcom,i2c-qup";
+		reg = <0xf9923000 0x1000>;
+		interrupts = <0 95 0>;
+
+		pinctrl-names = "default";
+		pinctrl-0 = <&i2c1_data>;
+
+		clocks = <&core>, <&iface>;
+		clock-names = "core", "iface";
+
+		clock-frequency = <100000>;
+		qcom,src-freq = <19200000>;
+
+		#address-cells = <1>;
+		#size-cells = <0>;
+	};
+
+ i2c_C: i2c@f9924000 {
+		compatible = "qcom,i2c-qup";
+		reg = <0xf9924000 0x1000>;
+		interrupts = <0 96 0>;
+
+		pinctrl-names = "default";
+		pinctrl-0 = <&i2c5_data>;
+
+		clocks = <&core>, <&iface>;
+		clock-names = "core", "iface";
+
+		clock-frequency = <100000>;
+		qcom,src-freq = <50000000>;
+
+		#address-cells = <1>;
+		#size-cells = <0>;
+	};
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 2/2 i2c: New bus driver for the QUP I2C controller

From: "Ivan T. Ivanov" <[email protected]>

This bus driver supports the QUP i2c hardware controller in the Qualcomm MSM SOCs. The Qualcomm Universal Peripheral Engine (QUP) is a general purpose data path engine with input/output FIFOs and an embedded i2c
mini-core. The driver supports FIFO mode (for low bandwidth applications)
and block mode (interrupt generated for each block-size data transfer). The driver currently does not support DMA transfers.

Shamelessly based on codeaurora version of the driver.

This controller could be found in the following chip-sets:
msm9625, msm8974, msm8610, msm8226, mpq8092.

---
 drivers/i2c/busses/Kconfig   |   10 +
 drivers/i2c/busses/Makefile  |    1 +
 drivers/i2c/busses/i2c-qup.c |  909 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 920 insertions(+)
 create mode 100644 drivers/i2c/busses/i2c-qup.c
drivers/i2c/busses/Kconfig +10 -0
index fcdd321..c76ddd4 100644
@@ -777,6 +777,16 @@ config I2C_RCAR
 	  This driver can also be built as a module.  If so, the module
 	  will be called i2c-rcar.
 
+config I2C_QUP
+	tristate "Qualcomm QUP based I2C controller"
+	depends on ARCH_MSM
+	help
+	  If you say yes to this option, support will be included for the
+	  built-in I2C interface on the MSM family processors.
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called i2c-qup.
+
 comment "External I2C/SMBus adapter drivers"
 
 config I2C_DIOLAN_U2C
drivers/i2c/busses/Makefile +1 -0
index d00997f..77127df 100644
@@ -76,6 +76,7 @@ obj-$(CONFIG_I2C_OCTEON)	+= i2c-octeon.o
 obj-$(CONFIG_I2C_XILINX)	+= i2c-xiic.o
 obj-$(CONFIG_I2C_XLR)		+= i2c-xlr.o
 obj-$(CONFIG_I2C_RCAR)		+= i2c-rcar.o
+obj-$(CONFIG_I2C_QUP)		+= i2c-qup.o
 
 # External I2C/SMBus adapter drivers
 obj-$(CONFIG_I2C_DIOLAN_U2C)	+= i2c-diolan-u2c.o
drivers/i2c/busses/i2c-qup.c new file +909 -0

909 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#2 lore raw

Re: [PATCH 2/2] i2c: New bus driver for the QUP I2C controller

Hey Ivan-

Some nits below.

Quoted 6 lines · Ivan T. Ivanov

From: "Ivan T. Ivanov" <[email protected]>

This bus driver supports the QUP i2c hardware controller in the Qualcomm MSM SOCs. The Qualcomm Universal Peripheral Engine (QUP) is a general purpose data path engine with input/output FIFOs and an embedded i2c
mini-core. The driver supports FIFO mode (for low bandwidth applications)

Rogue tab in your commit message.

Quoted 7 lines

and block mode (interrupt generated for each block-size data transfer). The driver currently does not support DMA transfers.

Shamelessly based on codeaurora version of the driver.

This controller could be found in the following chip-sets:
msm9625, msm8974, msm8610, msm8226, mpq8092.

This may be good to include in the Kconfig help text.

Quoted 46 lines
---
 drivers/i2c/busses/Kconfig   |   10 +
 drivers/i2c/busses/Makefile  |    1 +
 drivers/i2c/busses/i2c-qup.c |  909 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 920 insertions(+)
 create mode 100644 drivers/i2c/busses/i2c-qup.c
drivers/i2c/busses/Kconfig +10 -0
index fcdd321..c76ddd4 100644
@@ -777,6 +777,16 @@ config I2C_RCAR
 	  This driver can also be built as a module.  If so, the module
 	  will be called i2c-rcar.
 
+config I2C_QUP
+	tristate "Qualcomm QUP based I2C controller"
+	depends on ARCH_MSM
+	help
+	  If you say yes to this option, support will be included for the
+	  built-in I2C interface on the MSM family processors.
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called i2c-qup.
+
 comment "External I2C/SMBus adapter drivers"
 
 config I2C_DIOLAN_U2C
drivers/i2c/busses/Makefile +1 -0
index d00997f..77127df 100644
@@ -76,6 +76,7 @@ obj-$(CONFIG_I2C_OCTEON)	+= i2c-octeon.o
 obj-$(CONFIG_I2C_XILINX)	+= i2c-xiic.o
 obj-$(CONFIG_I2C_XLR)		+= i2c-xlr.o
 obj-$(CONFIG_I2C_RCAR)		+= i2c-rcar.o
+obj-$(CONFIG_I2C_QUP)		+= i2c-qup.o
 
 # External I2C/SMBus adapter drivers
 obj-$(CONFIG_I2C_DIOLAN_U2C)	+= i2c-diolan-u2c.o
drivers/i2c/busses/i2c-qup.c new file +0 -0
new file mode 100644
index 0000000..3b5ef91

[..]

Quoted 4 lines
drivers/i2c/busses/i2c-qup.c new file +4 -0
+
+static int qup_i2c_change_state(struct qup_i2c_dev *qup, u32 state)
+{
+	if (qup_i2c_poll_state(qup, 0, true) != 0)

drivers/i2c/busses/i2c-qup.c line 244

Quoted 10 lines
drivers/i2c/busses/i2c-qup.c new file +10 -0
+		return -EIO;
+
+	writel(state, qup->base + QUP_STATE);
+
+	if (qup_i2c_poll_state(qup, state, false) != 0)
+		return -EIO;
+	return 0;
+}
+
+static void qup_i2c_enable(struct qup_i2c_dev *qup, bool state)

Bit of a confusing name, especially when qup_i2c_enable(qup, false) is used. I'd suggest qup_i2c_set_state or qup_i2c_set_enabled.

Quoted 15 lines
drivers/i2c/busses/i2c-qup.c new file +15 -0
+{
+	u32 config;
+
+	if (state) {
+		clk_prepare_enable(qup->clk);
+		clk_prepare_enable(qup->pclk);
+	} else {
+		qup_i2c_change_state(qup, QUP_RESET_STATE);
+		clk_disable_unprepare(qup->clk);
+		config = readl(qup->base + QUP_CONFIG);
+		config |= QUP_CLOCK_AUTO_GATE;
+		writel(config, qup->base + QUP_CONFIG);
+		clk_disable_unprepare(qup->pclk);
+	}
+}

[..]

Quoted 2 lines
drivers/i2c/busses/i2c-qup.c new file +2 -0
+static int qup_i2c_probe(struct platform_device *pdev)
+{

[..]

drivers/i2c/busses/i2c-qup.c line 743

Quoted 9 lines
drivers/i2c/busses/i2c-qup.c new file +9 -0
+
+	ret = devm_request_irq(qup->dev, qup->irq, qup_i2c_interrupt,
+			       IRQF_TRIGGER_HIGH, "i2c_qup", qup);
+	if (ret) {
+		dev_err(qup->dev, "Request %d IRQ failed\n", qup->irq);
+		return ret;
+	}
+
+	disable_irq(qup->irq);

How is this not racy, in the case where a pending interrupt is left from the bootloader (which seems to be possible based on the comments below)?

Quoted 14 lines
drivers/i2c/busses/i2c-qup.c new file +14 -0
+
+	init_completion(&qup->xfer);
+
+	ret = clk_set_rate(qup->clk, qup->src_clk_freq);
+	if (ret)
+		dev_info(qup->dev, "Fail to set core clk, %dHz:%d\n",
+			 qup->src_clk_freq, ret);
+
+	qup_i2c_enable(qup, true);
+
+	/*
+	 * If bootloaders leave a pending interrupt on certain QUP's,
+	 * then we reset the core before registering for interrupts.
+	 */

[..]

Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
#3 lore raw

Re: [PATCH 2/2] i2c: New bus driver for the QUP I2C controller

Hi,

Quoted 5 lines · Josh Cartwright

Hey Ivan-

Some nits below.

On Thu, Aug 29, 2013 at 04:27:53PM +0300, Ivan T. Ivanov wrote:

Quoted 8 lines
Quoted 6 lines

From: "Ivan T. Ivanov" <[email protected]>

This bus driver supports the QUP i2c hardware controller in the Qualcomm MSM SOCs. The Qualcomm Universal Peripheral Engine (QUP) is a general purpose data path engine with input/output FIFOs and an embedded i2c
mini-core. The driver supports FIFO mode (for low bandwidth applications)

Rogue tab in your commit message.

Will fix.

Quoted 10 lines
Quoted 8 lines

and block mode (interrupt generated for each block-size data transfer). The driver currently does not support DMA transfers.

Shamelessly based on codeaurora version of the driver.

This controller could be found in the following chip-sets:
msm9625, msm8974, msm8610, msm8226, mpq8092.

This may be good to include in the Kconfig help text.

Will do.

Quoted 57 lines
Quoted 47 lines
---
 drivers/i2c/busses/Kconfig   |   10 +
 drivers/i2c/busses/Makefile  |    1 +
 drivers/i2c/busses/i2c-qup.c |  909 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 920 insertions(+)
 create mode 100644 drivers/i2c/busses/i2c-qup.c
drivers/i2c/busses/Kconfig +10 -0
index fcdd321..c76ddd4 100644
@@ -777,6 +777,16 @@ config I2C_RCAR
 	  This driver can also be built as a module.  If so, the module
 	  will be called i2c-rcar.
 
+config I2C_QUP
+	tristate "Qualcomm QUP based I2C controller"
+	depends on ARCH_MSM
+	help
+	  If you say yes to this option, support will be included for the
+	  built-in I2C interface on the MSM family processors.
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called i2c-qup.
+
 comment "External I2C/SMBus adapter drivers"
 
 config I2C_DIOLAN_U2C
drivers/i2c/busses/Makefile +1 -0
index d00997f..77127df 100644
@@ -76,6 +76,7 @@ obj-$(CONFIG_I2C_OCTEON)	+= i2c-octeon.o
 obj-$(CONFIG_I2C_XILINX)	+= i2c-xiic.o
 obj-$(CONFIG_I2C_XLR)		+= i2c-xlr.o
 obj-$(CONFIG_I2C_RCAR)		+= i2c-rcar.o
+obj-$(CONFIG_I2C_QUP)		+= i2c-qup.o
 
 # External I2C/SMBus adapter drivers
 obj-$(CONFIG_I2C_DIOLAN_U2C)	+= i2c-diolan-u2c.o
drivers/i2c/busses/i2c-qup.c new file +0 -0
new file mode 100644
index 0000000..3b5ef91

[..]

Quoted 9 lines
drivers/i2c/busses/i2c-qup.c new file +9 -0
+
+static int qup_i2c_change_state(struct qup_i2c_dev *qup, u32 state)
+{
+	if (qup_i2c_poll_state(qup, 0, true) != 0)
+		return -EIO;
+
+	writel(state, qup->base + QUP_STATE);
+
+	if (qup_i2c_poll_state(qup, state, false) != 0)
Quoted 8 lines

drivers/i2c/busses/i2c-qup.c line 244

Quoted 5 lines
drivers/i2c/busses/i2c-qup.c new file +5 -0
+		return -EIO;
+	return 0;
+}
+
+static void qup_i2c_enable(struct qup_i2c_dev *qup, bool state)

Bit of a confusing name, especially when qup_i2c_enable(qup, false) is used. I'd suggest qup_i2c_set_state or qup_i2c_set_enabled.

Indeed. I prefer qup_i2c_set_enabled.

Quoted 20 lines
Quoted 16 lines
drivers/i2c/busses/i2c-qup.c new file +15 -0
+{
+	u32 config;
+
+	if (state) {
+		clk_prepare_enable(qup->clk);
+		clk_prepare_enable(qup->pclk);
+	} else {
+		qup_i2c_change_state(qup, QUP_RESET_STATE);
+		clk_disable_unprepare(qup->clk);
+		config = readl(qup->base + QUP_CONFIG);
+		config |= QUP_CLOCK_AUTO_GATE;
+		writel(config, qup->base + QUP_CONFIG);
+		clk_disable_unprepare(qup->pclk);
+	}
+}

[..]

Quoted 2 lines
drivers/i2c/busses/i2c-qup.c new file +2 -0
+static int qup_i2c_probe(struct platform_device *pdev)
+{

[..]

Quoted 12 lines

drivers/i2c/busses/i2c-qup.c line 743

Quoted 9 lines
drivers/i2c/busses/i2c-qup.c new file +9 -0
+
+	ret = devm_request_irq(qup->dev, qup->irq, qup_i2c_interrupt,
+			       IRQF_TRIGGER_HIGH, "i2c_qup", qup);
+	if (ret) {
+		dev_err(qup->dev, "Request %d IRQ failed\n", qup->irq);
+		return ret;
+	}
+
+	disable_irq(qup->irq);

How is this not racy, in the case where a pending interrupt is left from the bootloader (which seems to be possible based on the comments below)?

Yes it looks weird. Interrupt handler will check and exit if there is no message for transfer. I am looking for better way to handle this.

Thanks,
Ivan

Quoted 17 lines
Quoted 15 lines
drivers/i2c/busses/i2c-qup.c new file +14 -0
+
+	init_completion(&qup->xfer);
+
+	ret = clk_set_rate(qup->clk, qup->src_clk_freq);
+	if (ret)
+		dev_info(qup->dev, "Fail to set core clk, %dHz:%d\n",
+			 qup->src_clk_freq, ret);
+
+	qup_i2c_enable(qup, true);
+
+	/*
+	 * If bootloaders leave a pending interrupt on certain QUP's,
+	 * then we reset the core before registering for interrupts.
+	 */

[..]

A message that is not in the archive (sent off-list or not yet received): 1378825856.960.47.camel-yvhxILDKWb8ylMT5ByZ5bDRGLm/uyL/[email protected]

#5 lore raw

Re: [PATCH 2/2] i2c: New bus driver for the QUP I2C controller

Quoted 6 lines · Ivan T. Ivanov
Quoted 5 lines · Josh Cartwright

Hey Ivan-

Some nits below.

On Thu, Aug 29, 2013 at 04:27:53PM +0300, Ivan T. Ivanov wrote:

[..]

Quoted 16 lines
Quoted 15 lines
Quoted 2 lines
drivers/i2c/busses/i2c-qup.c new file +2 -0
+static int qup_i2c_probe(struct platform_device *pdev)
+{

[..]

drivers/i2c/busses/i2c-qup.c line 743

Quoted 9 lines
drivers/i2c/busses/i2c-qup.c new file +9 -0
+
+	ret = devm_request_irq(qup->dev, qup->irq, qup_i2c_interrupt,
+			       IRQF_TRIGGER_HIGH, "i2c_qup", qup);
+	if (ret) {
+		dev_err(qup->dev, "Request %d IRQ failed\n", qup->irq);
+		return ret;
+	}
+
+	disable_irq(qup->irq);

How is this not racy, in the case where a pending interrupt is left from the bootloader (which seems to be possible based on the comments below)?

Quoted 2 lines

Yes it looks weird. Interrupt handler will check and exit if there is no message for transfer. I am looking for better way to handle this.

Below in probe() it looks like a controller reset is issued. I'm wondering if the best way to fix this is to move that up so it happens sooner (so we can assume here that the controller is in a non-interrupting state).

Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
#6 lore raw

Re: [PATCH 2/2] i2c: New bus driver for the QUP I2C controller

Hi,

Quoted 24 lines · Josh Cartwright
Quoted 6 lines · Ivan T. Ivanov
Quoted 5 lines · Josh Cartwright

Hey Ivan-

Some nits below.

On Thu, Aug 29, 2013 at 04:27:53PM +0300, Ivan T. Ivanov wrote:

[..]

Quoted 16 lines
Quoted 15 lines
Quoted 2 lines
drivers/i2c/busses/i2c-qup.c new file +2 -0
+static int qup_i2c_probe(struct platform_device *pdev)
+{

[..]

drivers/i2c/busses/i2c-qup.c line 743

Quoted 9 lines
drivers/i2c/busses/i2c-qup.c new file +9 -0
+
+	ret = devm_request_irq(qup->dev, qup->irq, qup_i2c_interrupt,
+			       IRQF_TRIGGER_HIGH, "i2c_qup", qup);
+	if (ret) {
+		dev_err(qup->dev, "Request %d IRQ failed\n", qup->irq);
+		return ret;
+	}
+
+	disable_irq(qup->irq);

How is this not racy, in the case where a pending interrupt is left from the bootloader (which seems to be possible based on the comments below)?

Quoted 7 lines
Quoted 2 lines

Yes it looks weird. Interrupt handler will check and exit if there is no message for transfer. I am looking for better way to handle this.

Below in probe() it looks like a controller reset is issued. I'm wondering if the best way to fix this is to move that up so it happens sooner (so we can assume here that the controller is in a non-interrupting state).

Thanks, sound reasonable.

Ivan

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): 3A0F4153-1C55-4008-8EB1-D6FA60D87CEA-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org

#9 lore raw

Hi Kumar,

Quoted 14 lines · Kumar Gala
Quoted 12 lines · Ivan T. Ivanov

From: "Ivan T. Ivanov" <[email protected]>

The Qualcomm Universal Peripherial (QUP) wraps I2C mini-core and provide input and output FIFO's for it. I2C controller can operate as master with supported bus speeds of 100Kbps and 400Kbps.

---
Documentation/devicetree/bindings/i2c/i2c-qup.txt | 99 +++++++++++++++++++++

1 file changed, 99 insertions(+)

create mode 100644 Documentation/devicetree/bindings/i2c/i2c-qup.txt

Quoted 9 lines

Documentation/devicetree/bindings/i2c/i2c-qup.txt line 1

Quoted 7 lines
Documentation/devicetree/bindings/i2c/i2c-qup.txt new file +1 -0
new file mode 100644
index 0000000..c682726
@@ -0,0 +1,99 @@
+Qualcomm Universal Periferial (QUP) I2C controller

[nit: remove extra spaces before ':']

ok.

Quoted 21 lines
Quoted 21 lines
Documentation/devicetree/bindings/i2c/i2c-qup.txt new file +20 -0
+
+Required properties:
+ - compatible : should be "qcom,i2c-qup"
+ - reg : Offset and length of the register region for the device
+ - interrupts : core interrupt
+
+ - pinctrl-names: Should contain only one value - "default".
+ - pinctrl-0: Should specify pin control group used for this controller.
+
+ - clocks : phandles to clock instances of the device tree nodes
+ - clock-names :
+		"core" : Allow access to FIFO buffers and registers
+		"iface" : Clock used by QUP interface
+
+ - #address-cells : should be <1> Address cells for I2C device address
+ - #size-cells : should be <0> I2C addresses have no size component.
+
+Optional properties :
+ - Child nodes conforming to i2c bus binding
+ - clock-frequency : Desired I2C bus clock frequency in Hz. If
Quoted 8 lines

Documentation/devicetree/bindings/i2c/i2c-qup.txt line 27

Quoted 6 lines
Documentation/devicetree/bindings/i2c/i2c-qup.txt new file +6 -0
+		not set thedefault frequency is 100kHz
+ - qcom,src-freq : Frequency of the source clocking this bus in Hz.
+		Divider value is set based on soruce-frequency and
+		desired I2C bus frequency. If this value is not
+		provided, the source clock is assumed to be running
+		at 19.2 MHz.

I'd spell out frequency instead of 'freq' to be consistent with 'clock-frequency'

ok.

Quoted 2 lines

Is the frequency of the 'iface' clock? Can we not use clk_get_rate?

It is for 'core' clock. I think that for higher I2C bus frequencies, 'core' clock have to be higher, but I am not sure what is relation.

Quoted 15 lines

Documentation/devicetree/bindings/i2c/i2c-qup.txt line 39

Quoted 13 lines
Documentation/devicetree/bindings/i2c/i2c-qup.txt new file +12 -0
+
+Aliases: An alias may optionally be used to bind the I2C controller
+to bus number. Aliases are of the form i2c<n> where <n> is an integer
+representing the bus number to use.
+
+Example:
+
+ aliases {
+		i2c0 = &i2c_A;
+		i2c1 = &i2c_B;
+		i2c2 = &i2c_C;
+ };

What is the purpose here?

Define on which I2C bus this controller operate. I2C client drivers usually do i2c_get_adapter(bus_number) before its registration. This is for drivers before invention of of_i2c_register_devices(), I believe.

Thanks,
Ivan

Quoted 67 lines
Quoted 63 lines
Documentation/devicetree/bindings/i2c/i2c-qup.txt new file +60 -0
+
+ i2c_A: i2c@f9967000 {
+		compatible = "qcom,i2c-qup";
+		reg = <0Xf9967000 0x1000>;
+		interrupts = <0 105 0>;
+
+		pinctrl-names = "default";
+		pinctrl-0 = <&i2c0_data>;
+
+		clocks = <&core>, <&iface>;
+		clock-names = "core", "iface";
+
+		clock-frequency = <100000>;
+		qcom,src-freq = <50000000>;
+		status = "disabled";
+
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		dummy@60 {
+			compatible = "dummy";
+			reg = <0x60>;
+		};
+	};
+
+ i2c_B: i2c@f9923000 {
+		compatible = "qcom,i2c-qup";
+		reg = <0xf9923000 0x1000>;
+		interrupts = <0 95 0>;
+
+		pinctrl-names = "default";
+		pinctrl-0 = <&i2c1_data>;
+
+		clocks = <&core>, <&iface>;
+		clock-names = "core", "iface";
+
+		clock-frequency = <100000>;
+		qcom,src-freq = <19200000>;
+
+		#address-cells = <1>;
+		#size-cells = <0>;
+	};
+
+ i2c_C: i2c@f9924000 {
+		compatible = "qcom,i2c-qup";
+		reg = <0xf9924000 0x1000>;
+		interrupts = <0 96 0>;
+
+		pinctrl-names = "default";
+		pinctrl-0 = <&i2c5_data>;
+
+		clocks = <&core>, <&iface>;
+		clock-names = "core", "iface";
+
+		clock-frequency = <100000>;
+		qcom,src-freq = <50000000>;
+
+		#address-cells = <1>;
+		#size-cells = <0>;
+	};
Signature · 1 line
1.7.9.5

- k

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): 767E9FBB-2975-4795-9C7E-69E302511FF2-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org

#12 lore raw

Hi Kumar,

Quoted 1 line · Kumar Gala

On Aug 29, 2013, at 12:26 PM, Ivan T. Ivanov wrote:

<snip>

Quoted 16 lines
Quoted 16 lines
Quoted 4 lines
Quoted 4 lines
Documentation/devicetree/bindings/i2c/i2c-qup.txt new file +4 -0
+
+Optional properties :
+ - Child nodes conforming to i2c bus binding
+ - clock-frequency : Desired I2C bus clock frequency in Hz. If
Quoted 8 lines

Documentation/devicetree/bindings/i2c/i2c-qup.txt line 27

Quoted 6 lines
Documentation/devicetree/bindings/i2c/i2c-qup.txt new file +6 -0
+		not set thedefault frequency is 100kHz
+ - qcom,src-freq : Frequency of the source clocking this bus in Hz.
+		Divider value is set based on soruce-frequency and
+		desired I2C bus frequency. If this value is not
+		provided, the source clock is assumed to be running
+		at 19.2 MHz.

I'd spell out frequency instead of 'freq' to be consistent with 'clock-frequency'

ok.

Quoted 1 line
Quoted 6 lines
Quoted 4 lines
Quoted 1 line

Is the frequency of the 'iface' clock? Can we not use clk_get_rate?

It is for 'core' clock. I think that for higher I2C bus frequencies, 'core' clock have to be higher, but I am not sure what is relation.

Ok, can we use clk_get_rate on the 'core' clk to get its frequency instead of needing a DT prop for it?

Probably I didn't explain it well. The 'core' clock have to be accelerated before higher bus frequencies could be achieved.

Quoted 18 lines
Quoted 18 lines
Quoted 17 lines
Quoted 5 lines
Documentation/devicetree/bindings/i2c/i2c-qup.txt new file +2 -0
+
+Aliases: An alias may optionally be used to bind the I2C controller

Documentation/devicetree/bindings/i2c/i2c-qup.txt line 39

Quoted 10 lines
Documentation/devicetree/bindings/i2c/i2c-qup.txt new file +10 -0
+to bus number. Aliases are of the form i2c<n> where <n> is an integer
+representing the bus number to use.
+
+Example:
+
+ aliases {
+		i2c0 = &i2c_A;
+		i2c1 = &i2c_B;
+		i2c2 = &i2c_C;
+ };

What is the purpose here?

Quoted 6 lines
Quoted 4 lines

Define on which I2C bus this controller operate. I2C client drivers usually do i2c_get_adapter(bus_number) before its registration. This is for drivers before invention of of_i2c_register_devices(), I believe.

Since this is for upstream why dont we use of_i2c_register_devices() and remove this stuff related to aliases.

Adapter driver already is using of_i2c_register_devices(). Also OF helper function will/or is already part of i2c_register_adapter(). Attempt here was to make it compatible with older i2c client drivers.

Regards,
Ivan

Quoted 3 lines

- k

#13 lore raw

[Hmm. Fixing b0rked LKML address; that might explain why I am not seeing Kumar's replies.]

Quoted 22 lines · Ivan T. Ivanov

Hi Kumar,

Quoted 19 lines · Kumar Gala
Quoted 18 lines · Ivan T. Ivanov
Quoted 4 lines
Quoted 4 lines
(quoted diff) +4 -0
+
+Optional properties :
+ - Child nodes conforming to i2c bus binding
+ - clock-frequency : Desired I2C bus clock frequency in Hz. If
Quoted 8 lines

Review

Quoted 6 lines
(quoted diff) +6 -0
+		not set thedefault frequency is 100kHz
+ - qcom,src-freq : Frequency of the source clocking this bus in Hz.
+		Divider value is set based on soruce-frequency and
+		desired I2C bus frequency. If this value is not
+		provided, the source clock is assumed to be running
+		at 19.2 MHz.

I'd spell out frequency instead of 'freq' to be consistent with 'clock-frequency'

ok.

Quoted 2 lines

Is the frequency of the 'iface' clock? Can we not use clk_get_rate?

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

It is for 'core' clock. I think that for higher I2C bus frequencies, 'core' clock have to be higher, but I am not sure what is relation.

Ok, can we use clk_get_rate on the 'core' clk to get its frequency instead of needing a DT prop for it?

Probably I didn't explain it well. The 'core' clock have to be accelerated before higher bus frequencies could be achieved.

I think what Kumar is suggesting is that the QUP driver not do an explicit clk_set_rate() at all (which AFAICT is what's currently being done to set the consuming clock to the rate specified in 'qcom,src-freq'), but instead assume that the consuming clock has already been setup properly. Then the driver just uses clk_get_rate() and clock-frequency to calculate how to setup any internal dividers.

Quoted 19 lines
Quoted 19 lines
Quoted 18 lines
Quoted 5 lines
Quoted 5 lines
(quoted diff) +5 -0
+Aliases: An alias may optionally be used to bind the I2C controller
+to bus number. Aliases are of the form i2c<n> where <n> is an integer
+representing the bus number to use.
+
+Example:
Quoted 8 lines

Review

Quoted 6 lines
(quoted diff) +6 -0
+
+ aliases {
+		i2c0 = &i2c_A;
+		i2c1 = &i2c_B;
+		i2c2 = &i2c_C;
+ };

What is the purpose here?

Define on which I2C bus this controller operate. I2C client drivers usually do i2c_get_adapter(bus_number) before its registration. This is for drivers before invention of of_i2c_register_devices(), I believe.

Quoted 5 lines
Quoted 1 line

Since this is for upstream why dont we use of_i2c_register_devices() and remove this stuff related to aliases.

Adapter driver already is using of_i2c_register_devices(). Also OF helper function will/or is already part of i2c_register_adapter(). Attempt here was to make it compatible with older i2c client drivers.

I agree with Kumar on removing this. If we decide it is something worth keeping, logic to support it doesn't belong in the QUP driver, but in the i2c core.

Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
#14 lore raw

Hi,

Quoted 3 lines · Josh Cartwright

[Hmm. Fixing b0rked LKML address; that might explain why I am not seeing Kumar's replies.]

Yes, sorry about this.

Quoted 31 lines · Ivan T. Ivanov
Quoted 22 lines

Hi Kumar,

Quoted 19 lines · Kumar Gala
Quoted 18 lines · Ivan T. Ivanov
Quoted 4 lines
Quoted 4 lines
(quoted diff) +4 -0
+
+Optional properties :
+ - Child nodes conforming to i2c bus binding
+ - clock-frequency : Desired I2C bus clock frequency in Hz. If
Quoted 8 lines

Review

Quoted 6 lines
(quoted diff) +6 -0
+		not set thedefault frequency is 100kHz
+ - qcom,src-freq : Frequency of the source clocking this bus in Hz.
+		Divider value is set based on soruce-frequency and
+		desired I2C bus frequency. If this value is not
+		provided, the source clock is assumed to be running
+		at 19.2 MHz.

I'd spell out frequency instead of 'freq' to be consistent with 'clock-frequency'

ok.

Quoted 2 lines

Is the frequency of the 'iface' clock? Can we not use clk_get_rate?

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

It is for 'core' clock. I think that for higher I2C bus frequencies, 'core' clock have to be higher, but I am not sure what is relation.

Ok, can we use clk_get_rate on the 'core' clk to get its frequency instead of needing a DT prop for it?

Probably I didn't explain it well. The 'core' clock have to be accelerated before higher bus frequencies could be achieved.

Quoted 6 lines

I think what Kumar is suggesting is that the QUP driver not do an explicit clk_set_rate() at all (which AFAICT is what's currently being done to set the consuming clock to the rate specified in 'qcom,src-freq'), but instead assume that the consuming clock has already been setup properly. Then the driver just uses clk_get_rate() and clock-frequency to calculate how to setup any internal dividers.

Yes, I think I got it, but the point is that clock is not already set and it is driver responsibility to do that.

Quoted 22 lines
Quoted 22 lines
Quoted 21 lines
Quoted 15 lines
Quoted 14 lines

Review

Quoted 12 lines
(quoted diff) +11 -0
+Aliases: An alias may optionally be used to bind the I2C controller
+to bus number. Aliases are of the form i2c<n> where <n> is an integer
+representing the bus number to use.
+
+Example:
+
+ aliases {
+		i2c0 = &i2c_A;
+		i2c1 = &i2c_B;
+		i2c2 = &i2c_C;
+ };

What is the purpose here?

Quoted 4 lines

Define on which I2C bus this controller operate. I2C client drivers usually do i2c_get_adapter(bus_number) before its registration. This is for drivers before invention of of_i2c_register_devices(), I believe.

Since this is for upstream why dont we use of_i2c_register_devices() and remove this stuff related to aliases.

Quoted 7 lines
Quoted 3 lines

Adapter driver already is using of_i2c_register_devices(). Also OF helper function will/or is already part of i2c_register_adapter(). Attempt here was to make it compatible with older i2c client drivers.

I agree with Kumar on removing this. If we decide it is something worth keeping, logic to support it doesn't belong in the QUP driver, but in the i2c core.

I don't have strong objection here, will remove aliases support.

Regards,
Ivan

Quoted 1 line
#15 lore raw
Quoted 6 lines
Quoted 4 lines

I agree with Kumar on removing this. If we decide it is something worth keeping, logic to support it doesn't belong in the QUP driver, but in the i2c core.

I don't have strong objection here, will remove aliases support.

When resubmitting, please test against v3.12-rcX. of_i2c_register_devices() is in the core meanwhile and alias support for of is in the core for a while, too. Check i2c_add_adapter().

#16 lore raw

Hi,

Quoted 9 lines · Wolfram Sang
Quoted 5 lines
Quoted 3 lines

I agree with Kumar on removing this. If we decide it is something worth keeping, logic to support it doesn't belong in the QUP driver, but in the i2c core.

I don't have strong objection here, will remove aliases support.

When resubmitting, please test against v3.12-rcX. of_i2c_register_devices() is in the core meanwhile and alias support for of is in the core for a while, too. Check i2c_add_adapter().

Thanks, I will.

Regards,
Ivan

#17 lore raw
In reply to Ivan T. Ivanov
Quoted 18 lines · Ivan T. Ivanov

From: "Ivan T. Ivanov" <[email protected]>

The Qualcomm Universal Peripherial (QUP) wraps I2C mini-core and provide input and output FIFO's for it. I2C controller can operate as master with supported bus speeds of 100Kbps and 400Kbps.

---
 Documentation/devicetree/bindings/i2c/i2c-qup.txt |   99 +++++++++++++++++++++
 1 file changed, 99 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/i2c/i2c-qup.txt
Documentation/devicetree/bindings/i2c/i2c-qup.txt new file +0 -0
new file mode 100644
index 0000000..c682726

Documentation/devicetree/bindings/i2c/i2c-qup.txt line 6

Quoted 6 lines
Documentation/devicetree/bindings/i2c/i2c-qup.txt new file +6 -0
@@ -0,0 +1,99 @@
+Qualcomm Universal Periferial (QUP) I2C controller
+
+Required properties:
+ - compatible : should be "qcom,i2c-qup"
+ - reg : Offset and length of the register region for the device
+ - interrupts : core interrupt

How about the following:

- interrupts: interrupt-specifier for the core interrupt.

Documentation/devicetree/bindings/i2c/i2c-qup.txt line 11

Quoted 5 lines
Documentation/devicetree/bindings/i2c/i2c-qup.txt new file +5 -0
+
+ - pinctrl-names: Should contain only one value - "default".
+ - pinctrl-0: Should specify pin control group used for this controller.
+
+ - clocks : phandles to clock instances of the device tree nodes

Clocks aren't just phandles, they have a clock-specifier component. This should probably be something like:

- clocks: a list of phandle + clock-specifier pairs for each entry in clock-names

Documentation/devicetree/bindings/i2c/i2c-qup.txt line 13

Quoted 2 lines
Documentation/devicetree/bindings/i2c/i2c-qup.txt new file +2 -0
+ - clock-names :
+		"core" : Allow access to FIFO buffers and registers

Huh? That description doesn't seem to descripe the hardware.

Documentation/devicetree/bindings/i2c/i2c-qup.txt line 14

Quoted 1 line
Documentation/devicetree/bindings/i2c/i2c-qup.txt new file +1 -0
+		"iface" : Clock used by QUP interface

Which interface? The slave interface the CPUs access, or the interface to the I2C devices?

Are these the only clock inputs to the device?

Is there a regulator input that might need to be specified?

Documentation/devicetree/bindings/i2c/i2c-qup.txt line 22

Quoted 8 lines
Documentation/devicetree/bindings/i2c/i2c-qup.txt new file +8 -0
+
+ - #address-cells : should be <1> Address cells for I2C device address
+ - #size-cells : should be <0> I2C addresses have no size component.
+
+Optional properties :
+ - Child nodes conforming to i2c bus binding
+ - clock-frequency : Desired I2C bus clock frequency in Hz. If
+		not set thedefault frequency is 100kHz

Why is this necessary?

Documentation/devicetree/bindings/i2c/i2c-qup.txt line 27

Quoted 5 lines
Documentation/devicetree/bindings/i2c/i2c-qup.txt new file +5 -0
+ - qcom,src-freq : Frequency of the source clocking this bus in Hz.
+		Divider value is set based on soruce-frequency and
+		desired I2C bus frequency. If this value is not
+		provided, the source clock is assumed to be running
+		at 19.2 MHz.

This looks like it should be a clock input.

Thanks,
Mark.

A message that is not in the archive (sent off-list or not yet received): 20130912162840.GE22013-NuALmloUBlrZROr8t4l/[email protected]

#19 lore raw

Hi Mark,

Quoted 28 lines · Mark Rutland
Quoted 18 lines · Ivan T. Ivanov

From: "Ivan T. Ivanov" <[email protected]>

The Qualcomm Universal Peripherial (QUP) wraps I2C mini-core and provide input and output FIFO's for it. I2C controller can operate as master with supported bus speeds of 100Kbps and 400Kbps.

---
 Documentation/devicetree/bindings/i2c/i2c-qup.txt |   99 +++++++++++++++++++++
 1 file changed, 99 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/i2c/i2c-qup.txt
Documentation/devicetree/bindings/i2c/i2c-qup.txt new file +0 -0
new file mode 100644
index 0000000..c682726

Documentation/devicetree/bindings/i2c/i2c-qup.txt line 6

Quoted 6 lines
Documentation/devicetree/bindings/i2c/i2c-qup.txt new file +6 -0
@@ -0,0 +1,99 @@
+Qualcomm Universal Periferial (QUP) I2C controller
+
+Required properties:
+ - compatible : should be "qcom,i2c-qup"
+ - reg : Offset and length of the register region for the device
+ - interrupts : core interrupt

How about the following:

Quoted 1 line

- interrupts: interrupt-specifier for the core interrupt.

Ok.

Quoted 10 lines

Documentation/devicetree/bindings/i2c/i2c-qup.txt line 11

Quoted 6 lines
Documentation/devicetree/bindings/i2c/i2c-qup.txt new file +5 -0
+
+ - pinctrl-names: Should contain only one value - "default".
+ - pinctrl-0: Should specify pin control group used for this controller.
+
+ - clocks : phandles to clock instances of the device tree nodes

Clocks aren't just phandles, they have a clock-specifier component. This should probably be something like:

Quoted 2 lines

- clocks: a list of phandle + clock-specifier pairs for each entry in clock-names

Right now MSM clocks [1] are just phandles, I should add #clock-cells = <0>.

Quoted 5 lines

Documentation/devicetree/bindings/i2c/i2c-qup.txt line 13

Quoted 3 lines
Documentation/devicetree/bindings/i2c/i2c-qup.txt new file +2 -0
+ - clock-names :
+		"core" : Allow access to FIFO buffers and registers

Huh? That description doesn't seem to descripe the hardware.

How about: Allow access to I2C core FIFO buffers and registers.

Quoted 5 lines

Documentation/devicetree/bindings/i2c/i2c-qup.txt line 14

Quoted 2 lines
Documentation/devicetree/bindings/i2c/i2c-qup.txt new file +1 -0
+		"iface" : Clock used by QUP interface

Which interface? The slave interface the CPUs access, or the interface to the I2C devices?

My understanding for this is that QUP is wrapping I2C core. QUP is interface to I2C core.

Quoted 2 lines

Are these the only clock inputs to the device?

Yep.

Quoted 3 lines

Is there a regulator input that might need to be specified?

No. Power management is done via clock gating.

Quoted 10 lines

Documentation/devicetree/bindings/i2c/i2c-qup.txt line 22

Quoted 8 lines
Documentation/devicetree/bindings/i2c/i2c-qup.txt new file +8 -0
+
+ - #address-cells : should be <1> Address cells for I2C device address
+ - #size-cells : should be <0> I2C addresses have no size component.
+
+Optional properties :
+ - Child nodes conforming to i2c bus binding
+ - clock-frequency : Desired I2C bus clock frequency in Hz. If
+		not set thedefault frequency is 100kHz

Why is this necessary?

This is how I2C bus frequency could be specified. It is standard I2C property. Not sure that I get the question.

Quoted 8 lines

Documentation/devicetree/bindings/i2c/i2c-qup.txt line 27

Quoted 6 lines
Documentation/devicetree/bindings/i2c/i2c-qup.txt new file +5 -0
+ - qcom,src-freq : Frequency of the source clocking this bus in Hz.
+		Divider value is set based on soruce-frequency and
+		desired I2C bus frequency. If this value is not
+		provided, the source clock is assumed to be running
+		at 19.2 MHz.

This looks like it should be a clock input.

Thanks, I will change it.

Regard,
Ivan

[1] https://lkml.org/lkml/2013/7/24/729

Quoted 3 lines

Thanks,
Mark.

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 1379063595.16481.19.camel-yvhxILDKWb8ylMT5ByZ5bDRGLm/uyL/[email protected]

#21 lore raw
Quoted 16 lines · Ivan T. Ivanov

Hi Mark,

Quoted 13 lines · Mark Rutland
Quoted 12 lines · Ivan T. Ivanov

From: "Ivan T. Ivanov" <[email protected]>

The Qualcomm Universal Peripherial (QUP) wraps I2C mini-core and provide input and output FIFO's for it. I2C controller can operate as master with supported bus speeds of 100Kbps and 400Kbps.

---
 Documentation/devicetree/bindings/i2c/i2c-qup.txt |   99 +++++++++++++++++++++
 1 file changed, 99 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/i2c/i2c-qup.txt
Quoted 7 lines
Quoted 7 lines

Documentation/devicetree/bindings/i2c/i2c-qup.txt line 1

Quoted 7 lines
Documentation/devicetree/bindings/i2c/i2c-qup.txt new file +1 -0
new file mode 100644
index 0000000..c682726
@@ -0,0 +1,99 @@
+Qualcomm Universal Periferial (QUP) I2C controller

s/Periferial/Peripheral/ ?

Quoted 22 lines
Quoted 9 lines

Documentation/devicetree/bindings/i2c/i2c-qup.txt line 6

Quoted 5 lines
Documentation/devicetree/bindings/i2c/i2c-qup.txt new file +5 -0
+
+Required properties:
+ - compatible : should be "qcom,i2c-qup"
+ - reg : Offset and length of the register region for the device
+ - interrupts : core interrupt

How about the following:

- interrupts: interrupt-specifier for the core interrupt.

Ok.

Quoted 10 lines

Documentation/devicetree/bindings/i2c/i2c-qup.txt line 11

Quoted 6 lines
Documentation/devicetree/bindings/i2c/i2c-qup.txt new file +5 -0
+
+ - pinctrl-names: Should contain only one value - "default".
+ - pinctrl-0: Should specify pin control group used for this controller.
+
+ - clocks : phandles to clock instances of the device tree nodes

Clocks aren't just phandles, they have a clock-specifier component. This should probably be something like:

Quoted 4 lines
Quoted 2 lines

- clocks: a list of phandle + clock-specifier pairs for each entry in clock-names

Right now MSM clocks [1] are just phandles, I should add #clock-cells = <0>.

I see no reason to strongly tie the binding to a particular set of clocks when it's easy to make it generic. What if a new platform uses QUP, but its clocks have a number of clock-cells? As clock-specifiers may be zero cells, describing this as a phandle + clock-specifier pair means this will work with any clock provider following the common clock bindings.

Quoted 8 lines
Quoted 6 lines

Documentation/devicetree/bindings/i2c/i2c-qup.txt line 13

Quoted 4 lines
Documentation/devicetree/bindings/i2c/i2c-qup.txt new file +2 -0
+ - clock-names :
+		"core" : Allow access to FIFO buffers and registers

Huh? That description doesn't seem to descripe the hardware.

How about: Allow access to I2C core FIFO buffers and registers.

My only concern here is the words "allow access", as that seems odd in the context of a hardware description.

It seems most bindings don't describe what the clocks do as that's defined in the manual for a piece of hardware anyway, so unfortunately I don't have a good example.

I think something like the below would be more in keeping with what's expected:

"core": Clock controlling the FIFO buffers and registers

Quoted 10 lines
Quoted 6 lines

Documentation/devicetree/bindings/i2c/i2c-qup.txt line 14

Quoted 3 lines
Documentation/devicetree/bindings/i2c/i2c-qup.txt new file +1 -0
+		"iface" : Clock used by QUP interface

Which interface? The slave interface the CPUs access, or the interface to the I2C devices?

My understanding for this is that QUP is wrapping I2C core. QUP is interface to I2C core.

Ok.

Quoted 5 lines
Quoted 3 lines

Are these the only clock inputs to the device?

Yep.

Ok.

Quoted 6 lines
Quoted 4 lines

Is there a regulator input that might need to be specified?

No. Power management is done via clock gating.

Ok.

Quoted 12 lines
Quoted 11 lines

Documentation/devicetree/bindings/i2c/i2c-qup.txt line 22

Quoted 9 lines
Documentation/devicetree/bindings/i2c/i2c-qup.txt new file +8 -0
+
+ - #address-cells : should be <1> Address cells for I2C device address
+ - #size-cells : should be <0> I2C addresses have no size component.
+
+Optional properties :
+ - Child nodes conforming to i2c bus binding
+ - clock-frequency : Desired I2C bus clock frequency in Hz. If
+		not set thedefault frequency is 100kHz

Why is this necessary?

Quoted 2 lines

This is how I2C bus frequency could be specified. It is standard I2C property. Not sure that I get the question.

Not all i2c bindings have this, but I see many do. Never mind.

Quoted 11 lines
Quoted 9 lines

Documentation/devicetree/bindings/i2c/i2c-qup.txt line 27

Quoted 7 lines
Documentation/devicetree/bindings/i2c/i2c-qup.txt new file +5 -0
+ - qcom,src-freq : Frequency of the source clocking this bus in Hz.
+		Divider value is set based on soruce-frequency and
+		desired I2C bus frequency. If this value is not
+		provided, the source clock is assumed to be running
+		at 19.2 MHz.

This looks like it should be a clock input.

Thanks, I will change it.

Great!

Cheers,
Mark.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 20130916133226.GD30650-NuALmloUBlrZROr8t4l/[email protected]

#23 lore raw

Hi Mark,

Quoted 17 lines · Mark Rutland
Quoted 16 lines · Ivan T. Ivanov

Hi Mark,

Quoted 13 lines · Mark Rutland
Quoted 12 lines · Ivan T. Ivanov

From: "Ivan T. Ivanov" <[email protected]>

The Qualcomm Universal Peripherial (QUP) wraps I2C mini-core and provide input and output FIFO's for it. I2C controller can operate as master with supported bus speeds of 100Kbps and 400Kbps.

---
 Documentation/devicetree/bindings/i2c/i2c-qup.txt |   99 +++++++++++++++++++++
 1 file changed, 99 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/i2c/i2c-qup.txt
Quoted 9 lines
Quoted 7 lines
Quoted 7 lines

Documentation/devicetree/bindings/i2c/i2c-qup.txt line 1

Quoted 7 lines
Documentation/devicetree/bindings/i2c/i2c-qup.txt new file +1 -0
new file mode 100644
index 0000000..c682726
@@ -0,0 +1,99 @@
+Qualcomm Universal Periferial (QUP) I2C controller

s/Periferial/Peripheral/ ?

Thanks.

Quoted 26 lines
Quoted 26 lines
Quoted 10 lines

Documentation/devicetree/bindings/i2c/i2c-qup.txt line 6

Quoted 6 lines
Documentation/devicetree/bindings/i2c/i2c-qup.txt new file +5 -0
+
+Required properties:
+ - compatible : should be "qcom,i2c-qup"
+ - reg : Offset and length of the register region for the device
+ - interrupts : core interrupt

How about the following:

- interrupts: interrupt-specifier for the core interrupt.

Ok.

Quoted 12 lines

Documentation/devicetree/bindings/i2c/i2c-qup.txt line 11

Quoted 6 lines
Documentation/devicetree/bindings/i2c/i2c-qup.txt new file +5 -0
+
+ - pinctrl-names: Should contain only one value - "default".
+ - pinctrl-0: Should specify pin control group used for this controller.
+
+ - clocks : phandles to clock instances of the device tree nodes

Clocks aren't just phandles, they have a clock-specifier component. This should probably be something like:

- clocks: a list of phandle + clock-specifier pairs for each entry in clock-names

Quoted 8 lines
Quoted 1 line

Right now MSM clocks [1] are just phandles, I should add #clock-cells = <0>.

I see no reason to strongly tie the binding to a particular set of clocks when it's easy to make it generic. What if a new platform uses QUP, but its clocks have a number of clock-cells? As clock-specifiers may be zero cells, describing this as a phandle + clock-specifier pair means this will work with any clock provider following the common clock bindings.

I doubt that any other platform will use Qualcomm specific peripheral, but I see you point. Will change this.

Quoted 13 lines
Quoted 9 lines
Quoted 7 lines

Documentation/devicetree/bindings/i2c/i2c-qup.txt line 13

Quoted 5 lines
Documentation/devicetree/bindings/i2c/i2c-qup.txt new file +2 -0
+ - clock-names :
+		"core" : Allow access to FIFO buffers and registers

Huh? That description doesn't seem to descripe the hardware.

How about: Allow access to I2C core FIFO buffers and registers.

My only concern here is the words "allow access", as that seems odd in the context of a hardware description.

Quoted 8 lines

It seems most bindings don't describe what the clocks do as that's defined in the manual for a piece of hardware anyway, so unfortunately I don't have a good example.

I think something like the below would be more in keeping with what's expected:

"core": Clock controlling the FIFO buffers and registers

Ok, thanks will reword.

Quoted 58 lines
Quoted 11 lines
Quoted 7 lines

Documentation/devicetree/bindings/i2c/i2c-qup.txt line 14

Quoted 4 lines
Documentation/devicetree/bindings/i2c/i2c-qup.txt new file +1 -0
+		"iface" : Clock used by QUP interface

Which interface? The slave interface the CPUs access, or the interface to the I2C devices?

My understanding for this is that QUP is wrapping I2C core. QUP is interface to I2C core.

Ok.

Quoted 5 lines
Quoted 3 lines

Are these the only clock inputs to the device?

Yep.

Ok.

Quoted 6 lines
Quoted 4 lines

Is there a regulator input that might need to be specified?

No. Power management is done via clock gating.

Ok.

Quoted 12 lines
Quoted 11 lines

Documentation/devicetree/bindings/i2c/i2c-qup.txt line 22

Quoted 9 lines
Documentation/devicetree/bindings/i2c/i2c-qup.txt new file +8 -0
+
+ - #address-cells : should be <1> Address cells for I2C device address
+ - #size-cells : should be <0> I2C addresses have no size component.
+
+Optional properties :
+ - Child nodes conforming to i2c bus binding
+ - clock-frequency : Desired I2C bus clock frequency in Hz. If
+		not set thedefault frequency is 100kHz

Why is this necessary?

Quoted 2 lines

This is how I2C bus frequency could be specified. It is standard I2C property. Not sure that I get the question.

Not all i2c bindings have this, but I see many do. Never mind.

Quoted 10 lines
Quoted 9 lines

Documentation/devicetree/bindings/i2c/i2c-qup.txt line 27

Quoted 7 lines
Documentation/devicetree/bindings/i2c/i2c-qup.txt new file +5 -0
+ - qcom,src-freq : Frequency of the source clocking this bus in Hz.
+		Divider value is set based on soruce-frequency and
+		desired I2C bus frequency. If this value is not
+		provided, the source clock is assumed to be running
+		at 19.2 MHz.

This looks like it should be a clock input.

Quoted 3 lines
Quoted 1 line

Thanks, I will change it.

Great!

Regards,
Ivan

Quoted 7 lines

Cheers,
Mark.
--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html