PATCHv6 1/2] dt-bindings: i2c: Add Altera I2C Controller
Subsystems (2)
PATCH RESEND 1/1 PATCHv6 1/2] dt-bindings: i2c: Add Altera I2C Controller
From: Thor Thayer <[email protected]>
Add the documentation to support the Altera synthesizable logic I2C Controller in FPGA.
---
v2 Change the subject to identify dt-bindings
Add synthesizable logic to description.
Change compatible string to "altr,softip-i2c" Make description of clock phandle singular since 1 clock. Remove altr, from fifo-size
Specify fifo-size is in bytes.
v3 Add version to compatible string "altr,softip-i2c-v1.0"
Add for use in FPGA in description.
v4 No Change - Add Acked-by
v5-6 No Change
--- .../devicetree/bindings/i2c/i2c-altera.txt | 39 ++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 Documentation/devicetree/bindings/i2c/i2c-altera.txt
Documentation/devicetree/bindings/i2c/i2c-altera.txt new file +39 -0
@@ -0,0 +1,39 @@ +* Altera I2C Controller +* This is Altera's synthesizable logic block I2C Controller for use +* in Altera's FPGAs. + +Required properties : + - compatible : should be "altr,softip-i2c-v1.0" + - reg : Offset and length of the register set for the device + - interrupts : <IRQ> where IRQ is the interrupt number. + - clocks : phandle to input clock. + - #address-cells = <1>; + - #size-cells = <0>; + +Recommended properties : + - clock-frequency : desired I2C bus clock frequency in Hz. + +Optional properties : + - fifo-size : Size of the RX and TX FIFOs in bytes. + - Child nodes conforming to i2c bus binding + +Example : + + i2c@100080000 { + compatible = "altr,softip-i2c-v1.0"; + reg = <0x00000001 0x00080000 0x00000040>; + interrupt-parent = <&intc>; + interrupts = <0 43 4>; + clocks = <&clk_0>; + clock-frequency = <100000>; + #address-cells = <1>; + #size-cells = <0>; + fifo-size = <4>; + + eeprom@51 { + compatible = "atmel,24c32"; + reg = <0x51>; + pagesize = <32>; + }; + }; +
Signature · 1 line
2.7.4
PATCH RESEND 1/1 PATCHv6 2/2] i2c: altera: Add Altera I2C Controller driver
From: Thor Thayer <[email protected]>
Add driver support for the Altera I2C Controller. The I2C controller is soft IP for use in FPGAs.
---
v2 Remove altr, from fifo-size to agree with bindings.
Change compatible string to "altr,softip-i2c"
v3 Add version to compatible string "altr,softip-i2c-v1.0" v4 Add default 100kHz message. Cleanup IRQ error message. v5 Cleanup header usage - remove init.h.
Fix 1 byte RX bug and add convenience function for transfer shared by RX and TX. Use readl_poll_timeout_atomic() function.
Cache the I2C Interrupt Status Enable Register.
Cleanup of irq_mask by combining into 1 function.
Use i2c_8bit_addr_from_msg() for cleaner xfer_msg implementation. Restructure altr_i2c_xfer() without arrays and indexes.
Remove redundant assignments.
Remove function calls from inside if() statements.
Convert of_property_read_u32() to device_property_read_u32().
Call i2c_m_read() once in irq.
v6 Add isr_mask to structure kernel docs
Prepend altr_ to irq functions.
Remove recover function.
Remove i2c_m_rd(). Just code directly.
Use bool to signal completion.
Add isr_status to structure and structure kernel docs.
Change to threaded irq for core complete polling.
Add I2C_FUNC_SMBUS_EMUL to supported functionality.
Remove __func__ from dev_err() and dev_dbg().
Remove re-init on NACK.
Move MAINTAINERS addition from separate patch to here.
Add Reviewed-by: Andy Shevchenko from previous review.
--- MAINTAINERS | 5 + drivers/i2c/busses/Kconfig | 10 + drivers/i2c/busses/Makefile | 1 + drivers/i2c/busses/i2c-altera.c | 511 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 527 insertions(+) create mode 100644 drivers/i2c/busses/i2c-altera.c
MAINTAINERS +5 -0
@@ -644,6 +644,11 @@ ALPS PS/2 TOUCHPAD DRIVER R: Pali Rohár <[email protected]> F: drivers/input/mouse/alps.* +ALTERA I2C CONTROLLER DRIVER +M: Thor Thayer <[email protected]> +S: Maintained +F: drivers/i2c/busses/i2c-altera.c + ALTERA MAILBOX DRIVER M: Ley Foon Tan <[email protected]> L: [email protected] (moderated for non-subscribers)
drivers/i2c/busses/Kconfig +10 -0
@@ -336,6 +336,16 @@ config I2C_POWERMAC comment "I2C system bus drivers (mostly embedded / system-on-chip)" +config I2C_ALTERA + tristate "Altera Soft IP I2C" + depends on (ARCH_SOCFPGA || NIOS2) && OF + help + If you say yes to this option, support will be included for the + Altera Soft IP I2C interfaces on SoCFPGA and Nios2 architectures. + + This driver can also be built as a module. If so, the module + will be called i2c-altera. + config I2C_ASPEED tristate "Aspeed I2C Controller" depends on ARCH_ASPEED || COMPILE_TEST
drivers/i2c/busses/Makefile +1 -0
@@ -30,6 +30,7 @@ obj-$(CONFIG_I2C_HYDRA) += i2c-hydra.o obj-$(CONFIG_I2C_POWERMAC) += i2c-powermac.o # Embedded system I2C/SMBus host controller drivers +obj-$(CONFIG_I2C_ALTERA) += i2c-altera.o obj-$(CONFIG_I2C_ASPEED) += i2c-aspeed.o obj-$(CONFIG_I2C_AT91) += i2c-at91.o obj-$(CONFIG_I2C_AU1550) += i2c-au1550.o
drivers/i2c/busses/i2c-altera.c new file +511 -0
511 lines not on this page · raw message
Signature · 1 line
2.7.4
Wolfram Sang
AppliedRe: [[RESEND]PATCHv6 2/2] i2c: altera: Add Altera I2C Controller driver
Quoted 8 lines · thor.thayer at linux.intel.com
From: Thor Thayer <[email protected]>
Add driver support for the Altera I2C Controller. The I2C controller is soft IP for use in FPGAs.
Signed-off-by Thor Thayer <[email protected]>Reviewed-by Andy Shevchenko <[email protected]>---
Applied to for-next (will be in v4.14), thanks!
drivers/i2c/busses/i2c-altera.c line 304
Quoted 3 lines
drivers/i2c/busses/i2c-altera.c new file +3
-0+if (finish) { +/* Wait for the Core to finish */ + ret = readl_poll_timeout_atomic(idev->base + ALTR_I2C_STATUS,
I wonder a bit about polling in an interrupt handler (maybe threaded irqs?) but we can fix that later, I think.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170913/7e14cb49/attachment.sig>
Re: [[RESEND]PATCHv6 2/2] i2c: altera: Add Altera I2C Controller driver
Quoted 10 lines · Wolfram Sang
Quoted 8 lines · On Mon, Sep 11, 2017 at 04:17:20PM -0500, [email protected] wrote:
From: Thor Thayer <[email protected]>
Add driver support for the Altera I2C Controller. The I2C controller is soft IP for use in FPGAs.
Signed-off-by Thor Thayer <[email protected]>Reviewed-by Andy Shevchenko <[email protected]>---
Quoted 9 lines
Applied to for-next (will be in v4.14), thanks!
drivers/i2c/busses/i2c-altera.c line 304
Quoted 3 lines
drivers/i2c/busses/i2c-altera.c new file +3
-0+if (finish) { +/* Wait for the Core to finish */ + ret = readl_poll_timeout_atomic(idev->base + ALTR_I2C_STATUS,I wonder a bit about polling in an interrupt handler (maybe threaded irqs?) but we can fix that later, I think.
Yes, based on your previous feedback, I changed to a threaded IRQ as shown below. The altr_i2c_isr_quick wakes up this IRQ handler if the status is non-zero.
+
+ ret = devm_request_threaded_irq(&pdev->dev, irq, altr_i2c_isr_quick,
+ altr_i2c_isr, IRQF_ONESHOT,
+ pdev->name, idev);
Thanks for the review and applying the patch!
Re: [[RESEND]PATCHv6 2/2] i2c: altera: Add Altera I2C Controller driver
In reply to [email protected]And please use [PATCH V6 RESEND ...] in the future; the double '[[' confuses the tools like patchwork.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170913/1fd70aff/attachment-0001.sig>
Wolfram Sang
AppliedQuoted 7 lines · thor.thayer at linux.intel.com
From: Thor Thayer <[email protected]>
Add the documentation to support the Altera synthesizable logic I2C Controller in FPGA.
Signed-off-by Thor Thayer <[email protected]>Acked-by Rob Herring <[email protected]>
Applied to for-next (will be in v4.14), thanks!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170913/6b2e99bd/attachment.sig>