Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1157819 > unrolled thread

[PATCH v5 0/6] i2c: at91: add support to FIFOs and alternative command

Started byCyrille Pitchen <cyrille.pitchen@atmel.com>
First post2015-06-03 18:30 +0200
Last post2015-06-03 18:30 +0200
Articles 3 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH v5 0/6] i2c: at91: add support to FIFOs and alternative command Cyrille Pitchen <cyrille.pitchen@atmel.com> - 2015-06-03 18:30 +0200
    [PATCH v5 5/6] i2c: at91: print hardware version Cyrille Pitchen <cyrille.pitchen@atmel.com> - 2015-06-03 18:30 +0200
    [PATCH v5 3/6] i2c: at91: update documentation for DT bindings Cyrille Pitchen <cyrille.pitchen@atmel.com> - 2015-06-03 18:30 +0200

#1157819 — [PATCH v5 0/6] i2c: at91: add support to FIFOs and alternative command

FromCyrille Pitchen <cyrille.pitchen@atmel.com>
Date2015-06-03 18:30 +0200
Subject[PATCH v5 0/6] i2c: at91: add support to FIFOs and alternative command
Message-ID<pxjId-6rK-7@gated-at.bofh.it>
ChangeLog

v5:
- print I2C controller version in an already existing dev_info() instead of
  adding a new one.

v4:
- replace 0x%x by %#x when printing I2C controller version
- change the order of patches: the race condition bug fix becomes the first
  patch so it be can more easily applied to older kernels.

v3:
- fix braces {} coding style issue
- split the alternative command patch into 2 patches: the first one fixes
  a race condition whereas the second one is the actual alternative command
  patch

v2:
- fix typo in comment for AT91_TWI_SVEN.
- document new device tree bindings like "atmel,fifo-size".
- explicitly set the has_alt_cmd boolean to false to already existing chip
  configs.
- use the BIT() macro to define the register bits and do a little cleanup in a
  dedicated patch.
- reword some comments to better explain why the TXCOMP interrupt is no longer
  enabled in at91_do_twi_transfer() but later in
  at91_twi_write_data_dma_callback() to avoid a race condition when DMA is used.
- remove useless TXCOMP interrupt enable line in at91_twi_write_next_byte()
  since this interrupt is also enabled by at91_do_twi_transfer() for PIO
  transfers.

v1:
This series of patches adds support of two new features which will be
introduced with Atmel sama5d2x SoC.

First, the alternative command mode eases the sending of STOP conditions.
Before starting an I2C transaction, the size data to be transfered is
written into the new Alternative Command Register. For each byte transferred,
the I2C controller decreases this counter and automatically sends a STOP
condition when the counter value reaches 0, that is to say when the last byte
of the transaction has been sent/received. So there is no longer need to set
the STOP bit into the Control Register.

Then the use of FIFOs allows to reduce number I/O accesses: for instance,
the TX FIFO allows to write up to 4 data in a single access to the Transmit
Holding Register. Also the RX FIFO allows to read up to 4 data in a single
access to the Receive Holding Register. Currently only DMA transfers take
advantage of FIFOs.

Cyrille Pitchen (6):
  i2c: at91: fix a race condition when using the DMA controller
  i2c: at91: use BIT() macro to define register bits
  i2c: at91: update documentation for DT bindings
  i2c: at91: add support for new alternative command mode
  i2c: at91: print hardware version
  i2c: at91: add support to FIFOs

 Documentation/devicetree/bindings/i2c/i2c-at91.txt |  29 +-
 drivers/i2c/busses/i2c-at91.c                      | 356 +++++++++++++++++----
 2 files changed, 322 insertions(+), 63 deletions(-)

-- 
1.8.2.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1157821 — [PATCH v5 5/6] i2c: at91: print hardware version

FromCyrille Pitchen <cyrille.pitchen@atmel.com>
Date2015-06-03 18:30 +0200
Subject[PATCH v5 5/6] i2c: at91: print hardware version
Message-ID<pxjIf-6rK-37@gated-at.bofh.it>
In reply to#1157819
The probe() function now prints the hardware version of the I2C
controller.

Signed-off-by: Cyrille Pitchen <cyrille.pitchen@atmel.com>
---
 drivers/i2c/busses/i2c-at91.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c
index 67b4f15..89a8e61 100644
--- a/drivers/i2c/busses/i2c-at91.c
+++ b/drivers/i2c/busses/i2c-at91.c
@@ -85,6 +85,8 @@
 #define	AT91_TWI_ACR_DATAL(len)	((len) & 0xff)
 #define	AT91_TWI_ACR_DIR	BIT(8)
 
+#define	AT91_TWI_VER		0x00fc	/* Version Register */
+
 struct at91_twi_pdata {
 	unsigned clk_max_div;
 	unsigned clk_offset;
@@ -908,7 +910,8 @@ static int at91_twi_probe(struct platform_device *pdev)
 		return rc;
 	}
 
-	dev_info(dev->dev, "AT91 i2c bus driver.\n");
+	dev_info(dev->dev, "AT91 i2c bus driver (version: %#x).\n",
+		 at91_twi_read(dev, AT91_TWI_VER));
 	return 0;
 }
 
-- 
1.8.2.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1157823 — [PATCH v5 3/6] i2c: at91: update documentation for DT bindings

FromCyrille Pitchen <cyrille.pitchen@atmel.com>
Date2015-06-03 18:30 +0200
Subject[PATCH v5 3/6] i2c: at91: update documentation for DT bindings
Message-ID<pxjIf-6rK-41@gated-at.bofh.it>
In reply to#1157819
add a new value "atmel,at91sama5d2-i2c" for the "compatible" property.
add a new optional property "atmel,fifo-size" to enable FIFO support when
available.
add missing optional properties "dmas" and "dma-names".

Signed-off-by: Cyrille Pitchen <cyrille.pitchen@atmel.com>
---
 Documentation/devicetree/bindings/i2c/i2c-at91.txt | 29 ++++++++++++++++++++--
 1 file changed, 27 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/i2c/i2c-at91.txt b/Documentation/devicetree/bindings/i2c/i2c-at91.txt
index 388f0a2..7c04fd9 100644
--- a/Documentation/devicetree/bindings/i2c/i2c-at91.txt
+++ b/Documentation/devicetree/bindings/i2c/i2c-at91.txt
@@ -2,8 +2,8 @@ I2C for Atmel platforms
 
 Required properties :
 - compatible : Must be "atmel,at91rm9200-i2c", "atmel,at91sam9261-i2c",
-     "atmel,at91sam9260-i2c", "atmel,at91sam9g20-i2c", "atmel,at91sam9g10-i2c"
-     or "atmel,at91sam9x5-i2c"
+     "atmel,at91sam9260-i2c", "atmel,at91sam9g20-i2c", "atmel,at91sam9g10-i2c",
+     "atmel,at91sam9x5-i2c" or "atmel,at91sama5d2-i2c"
 - reg: physical base address of the controller and length of memory mapped
      region.
 - interrupts: interrupt number to the cpu.
@@ -13,6 +13,9 @@ Required properties :
 
 Optional properties:
 - clock-frequency: Desired I2C bus frequency in Hz, otherwise defaults to 100000
+- dmas: A list of two dma specifiers, one for each entry in dma-names.
+- dma-names: should contain "tx" and "rx".
+- atmel,fifo-size: size of the RX and TX FIFOs, if available.
 - Child nodes conforming to i2c bus binding
 
 Examples :
@@ -32,3 +35,25 @@ i2c0: i2c@fff84000 {
 		pagesize = <128>;
 	}
 }
+
+i2c0: i2c@f8034600 {
+	compatible = "atmel,at91sama5d2-i2c";
+	reg = <0xf8034600 0x100>;
+	interrupts = <19 IRQ_TYPE_LEVEL_HIGH 7>;
+	dmas = <&dma0
+		(AT91_XDMAC_DT_MEM_IF(0) | AT91_XDMAC_DT_PER_IF(1))
+		AT91_XDMAC_DT_PERID(11)>,
+	       <&dma0
+		(AT91_XDMAC_DT_MEM_IF(0) | AT91_XDMAC_DT_PER_IF(1))
+		AT91_XDMAC_DT_PERID(12)>;
+	dma-names = "tx", "rx";
+	#address-cells = <1>;
+	#size-cells = <0>;
+	clocks = <&flx0>;
+	atmel,fifo-size = <32>;
+
+	wm8731: wm8731@1a {
+		compatible = "wm8731";
+		reg = <0x1a>;
+	};
+};
-- 
1.8.2.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web